* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand. * WIP - Rewriting packets. * Cleanup and updates README * Converts more packets * Fixes header * Converts Effects packets. * Forgot the send command * Adds the start of containers packets. * Adds message packets with caching * Extends the send methods * Starts to add Acquire methods * Converted the packets * Cleanup * Cleanup * Adds more packets * Adds more packets * Fixes clearing arrays from pool. Adds Mobile Incoming * Converts more packets. * Moves more packets * Moves more packets * Test compression * Merges * Migrating to an idiomatic syntax that also supports compression, and proxying. * Optimize the stack alloc. Changes attributes * Converted container packets * Visual Studio doesn't auto save files. I am still getting used to subpar IDEs. * Adds static packet caching. Will profile later. Converts more packets * Fixes packets and changes how compression is configured * WIP - Adds basics for Gumps. Not finished though. * Fix file * Fixes formatting * Changed SpanWriter to be more idiomatic. * Fixes Span vs RawSpan and missing stackallocs * Converts over some more gumps * WIP - Deletes 32bit support. * Drops RDRand32 support. * Fixes gump compilation * Converting gump components * Removes old huffman compression function * Revert signature for backwards compatibility * WIP - Converting more gump components * Creates ArraySet for the strings. Updates AppendTo to reference that. * Converts the maining gump components * Cleans up gump components * Cleans up directives * Cleans up ArraySet and moves it. Adds null-coalescing-assignment * Cleanup, Target Packets, and C# 8 changes. * Removed OPL Packet * World packets * Fixing packet uses * Cleans up code. Fixes packet uses in various places. * More cleanup for packets * Code cleanup * Converts more packet uses and cleans up more code * More code cleanup * Finishes fixing the packets in Item * Updates secure trade packets * Updates core and gets it to compile. * Moved packets to scripts. Fixed account handler use of packets * Code cleanup * Updates chat packets * Code cleanuo * Adds party packets, but need to implement them. * Party packets WIP * Finishes party packets * Rearrange movement namespaces and classes * Finishes plant packets * Code Formatting * Fixes moving effects * Code cleanup, eliminates equipinfo * Adds more packets. Fixes bugs with various packets. * Finishes mahjon packets * Fixes mahjong packet * Code cleanup * Finishes mahjong packets * Adds Map packets * Add multifacet maps and charts * Cleans up some packets with UTF8 * Optimizes packets * Cleans up more packets. Moves the MessageHelper * Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets. * Updates protocol extensions packet receiver * Fixes a few bugs. Fixes a few more packets. * Code cleanup and fixing more packets * Fixes packet effects * Cleaned up more code * Buff Icon cleanup * Removed unused constructors * Code Cleanup. Adds BoatHS Packets * Moves house files. Updates house foundation packets. * Deployment cleanup * Fixes: * Code cleanup * More code cleanup * More code cleanup * Cleaned up BaseHouse * Enforces styling * Converts foreach to linq where possible. * Dont need that * Goals/Readme updates * Removes 32bit support at the highest level. Turns on HRT by default. * Code cleanup. Fixes extended features packet. * Fixes various bugs * Code cleanup * Code cleanup * Code cleanup. Fixes gump X/Y assignment. * Code cleanup using |= operator * More code cleanup * Cleanup * Fixes spacing issues. Thanks Visual Studio. You suck. * Compiler error * Fixes NPE from RunUO 2.7 * Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README * Fixes more packets. Stupid trailing nulls. * Fixes various bugs. * Fixes for gumps * Fixes more gump stuff. Going to split it out later since it is getting insane * Recoded the gump writing * WIP * *Added output path of scripts project to dev branch *Activated debugging in code
331 lines
8.4 KiB
C#
331 lines
8.4 KiB
C#
using System;
|
|
using Server.Items;
|
|
using Server.Network;
|
|
|
|
namespace Server.Mobiles
|
|
{
|
|
public class PlagueBeastLord : BaseCreature, ICarvable, IScissorable
|
|
{
|
|
private DecayTimer m_Timer;
|
|
|
|
[Constructible]
|
|
public PlagueBeastLord() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
|
{
|
|
Body = 775;
|
|
BaseSoundID = 679;
|
|
SpeechHue = 0x3B2;
|
|
|
|
SetStr(500);
|
|
SetDex(100);
|
|
SetInt(30);
|
|
|
|
SetHits(1800);
|
|
|
|
SetDamage(20, 25);
|
|
|
|
SetDamageType(ResistanceType.Physical, 50);
|
|
SetDamageType(ResistanceType.Fire, 25);
|
|
SetDamageType(ResistanceType.Poison, 25);
|
|
|
|
SetResistance(ResistanceType.Physical, 45, 55);
|
|
SetResistance(ResistanceType.Fire, 40, 50);
|
|
SetResistance(ResistanceType.Cold, 25, 35);
|
|
SetResistance(ResistanceType.Poison, 75, 85);
|
|
SetResistance(ResistanceType.Energy, 25, 35);
|
|
|
|
SetSkill(SkillName.Tactics, 100);
|
|
SetSkill(SkillName.Wrestling, 100);
|
|
|
|
Fame = 2000;
|
|
Karma = -2000;
|
|
|
|
VirtualArmor = 50;
|
|
}
|
|
|
|
public PlagueBeastLord(Serial serial) : base(serial)
|
|
{
|
|
}
|
|
|
|
public override string CorpseName => "a plague beast lord corpse";
|
|
public override Poison PoisonImmune => Poison.Lethal;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public Mobile OpenedBy{ get; set; }
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public bool IsBleeding
|
|
{
|
|
get
|
|
{
|
|
Container pack = Backpack;
|
|
|
|
if (pack != null)
|
|
for (int i = 0; i < pack.Items.Count; i++)
|
|
if (pack.Items[i] is PlagueBeastBlood blood && !blood.Patched)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override string DefaultName => "a plague beast lord";
|
|
|
|
public virtual void Carve(Mobile from, Item item)
|
|
{
|
|
if (OpenedBy == null && IsAccessibleTo(from))
|
|
{
|
|
OpenedBy = from;
|
|
|
|
m_Timer ??= new DecayTimer(this);
|
|
|
|
if (!m_Timer.Running)
|
|
m_Timer.Start();
|
|
|
|
m_Timer.StartDissolving();
|
|
|
|
PlagueBeastBackpack pack = new PlagueBeastBackpack();
|
|
AddItem(pack);
|
|
pack.Initialize();
|
|
|
|
foreach (NetState state in GetClientsInRange(12))
|
|
{
|
|
Mobile m = state.Mobile;
|
|
|
|
if (m?.Player == true && m != from)
|
|
PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1071919, from.Name,
|
|
m.NetState); // * ~1_VAL~ slices through the plague beast's amorphous tissue *
|
|
}
|
|
|
|
from.LocalOverheadMessage(MessageType.Regular, 0x21,
|
|
1071904); // * You slice through the plague beast's amorphous tissue *
|
|
Timer.DelayCall(TimeSpan.Zero, pack.Open, from);
|
|
}
|
|
}
|
|
|
|
public virtual bool Scissor(Mobile from, Scissors scissors)
|
|
{
|
|
if (IsAccessibleTo(from))
|
|
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2,
|
|
1071918); // You can't cut through the plague beast's amorphous skin with scissors!
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (IsAccessibleTo(from))
|
|
{
|
|
if (OpenedBy != null && Backpack != null)
|
|
Backpack.DisplayTo(from);
|
|
else
|
|
PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1071917,
|
|
from.NetState); // * You attempt to tear open the amorphous flesh, but it resists *
|
|
}
|
|
}
|
|
|
|
public override bool OnDragDrop(Mobile from, Item dropped)
|
|
{
|
|
if (IsAccessibleTo(from) && (dropped is PlagueBeastInnard || dropped is PlagueBeastGland))
|
|
return base.OnDragDrop(from, dropped);
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void OnDeath(Container c)
|
|
{
|
|
base.OnDeath(c);
|
|
|
|
for (int i = c.Items.Count - 1; i >= 0; i--)
|
|
c.Items[i].Delete();
|
|
}
|
|
|
|
public override void OnDelete()
|
|
{
|
|
if (OpenedBy?.Holding is PlagueBeastInnard)
|
|
OpenedBy.Holding.Delete();
|
|
|
|
if (Backpack != null)
|
|
{
|
|
for (int i = Backpack.Items.Count - 1; i >= 0; i--)
|
|
Backpack.Items[i].Delete();
|
|
|
|
Backpack.Delete();
|
|
}
|
|
|
|
base.OnDelete();
|
|
}
|
|
|
|
public override void OnMovement(Mobile m, Point3D oldLocation)
|
|
{
|
|
base.OnMovement(m, oldLocation);
|
|
|
|
if (Backpack != null && IsAccessibleTo(m) && m.InRange(oldLocation, 3) && !m.InRange(this, 3))
|
|
Backpack.SendRemovePacket();
|
|
}
|
|
|
|
public override bool CheckNonlocalLift(Mobile from, Item item) => true;
|
|
|
|
public override bool CheckNonlocalDrop(Mobile from, Item item, Item target) => true;
|
|
|
|
public override bool IsSnoop(Mobile from) => false;
|
|
|
|
public override int GetIdleSound() => 0x1BF;
|
|
|
|
public override int GetAttackSound() => 0x1C0;
|
|
|
|
public override int GetHurtSound() => 0x1C1;
|
|
|
|
public override int GetDeathSound() => 0x1C2;
|
|
|
|
public virtual void OnParalyzed(Mobile from)
|
|
{
|
|
FightMode = FightMode.None;
|
|
Frozen = true;
|
|
Blessed = true;
|
|
Combatant = null;
|
|
Hue = 0x480;
|
|
from.Combatant = null;
|
|
from.Warmode = false;
|
|
|
|
m_Timer = new DecayTimer(this);
|
|
m_Timer.Start();
|
|
|
|
Timer.DelayCall(TimeSpan.Zero, BroadcastMessage);
|
|
}
|
|
|
|
private void BroadcastMessage()
|
|
{
|
|
PublicOverheadMessage(MessageType.Regular, 0x3B2,
|
|
1071920); // * The plague beast's amorphous flesh hardens and becomes immobilized *
|
|
}
|
|
|
|
public virtual bool IsAccessibleTo(Mobile check)
|
|
{
|
|
if (check.AccessLevel >= AccessLevel.GameMaster)
|
|
return true;
|
|
|
|
if (!InRange(check, 2))
|
|
PrivateOverheadMessage(MessageType.Label, 0x3B2, 500446, check.NetState); // That is too far away.
|
|
else if (OpenedBy != null && OpenedBy != check)
|
|
PrivateOverheadMessage(MessageType.Label, 0x3B2, 500365,
|
|
check.NetState); // That is being used by someone else
|
|
else if (Frozen)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
public void Unfreeze()
|
|
{
|
|
FightMode = FightMode.Closest;
|
|
Frozen = false;
|
|
Blessed = false;
|
|
|
|
if (OpenedBy == null)
|
|
Hue = 0;
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.Write(OpenedBy);
|
|
|
|
if (m_Timer != null)
|
|
{
|
|
writer.Write(true);
|
|
writer.Write(m_Timer.Count);
|
|
writer.Write(m_Timer.Deadline);
|
|
}
|
|
else
|
|
{
|
|
writer.Write(false);
|
|
}
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
OpenedBy = reader.ReadMobile();
|
|
|
|
if (reader.ReadBool())
|
|
{
|
|
int count = reader.ReadInt();
|
|
int deadline = reader.ReadInt();
|
|
|
|
m_Timer = new DecayTimer(this, count, deadline);
|
|
m_Timer.Start();
|
|
}
|
|
|
|
if (FightMode == FightMode.None)
|
|
Frozen = true;
|
|
}
|
|
|
|
private class DecayTimer : Timer
|
|
{
|
|
private PlagueBeastLord m_Lord;
|
|
|
|
public DecayTimer(PlagueBeastLord lord, int count = 0, int deadline = 120) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1))
|
|
{
|
|
m_Lord = lord;
|
|
Count = count;
|
|
Deadline = deadline;
|
|
}
|
|
|
|
public int Count{ get; private set; }
|
|
|
|
public int Deadline{ get; private set; }
|
|
|
|
protected override void OnTick()
|
|
{
|
|
if (m_Lord?.Deleted != false)
|
|
{
|
|
Stop();
|
|
return;
|
|
}
|
|
|
|
if (Count + 15 == Deadline)
|
|
{
|
|
if (m_Lord.OpenedBy != null)
|
|
m_Lord.PublicOverheadMessage(MessageType.Regular, 0x3B2,
|
|
1071921); // * The plague beast begins to bubble and dissolve! *
|
|
|
|
m_Lord.PlaySound(0x103);
|
|
}
|
|
else if (Count + 10 == Deadline)
|
|
{
|
|
m_Lord.PlaySound(0x21);
|
|
}
|
|
else if (Count + 5 == Deadline)
|
|
{
|
|
m_Lord.PlaySound(0x1C2);
|
|
}
|
|
else if (Count == Deadline)
|
|
{
|
|
m_Lord.Unfreeze();
|
|
|
|
if (m_Lord.OpenedBy != null)
|
|
m_Lord.Kill();
|
|
|
|
Stop();
|
|
}
|
|
else if (Count % 15 == 0)
|
|
{
|
|
m_Lord.PlaySound(0x1BF);
|
|
}
|
|
|
|
Count++;
|
|
}
|
|
|
|
public void StartDissolving()
|
|
{
|
|
Deadline = Math.Min(Count + 60, Deadline);
|
|
}
|
|
}
|
|
}
|
|
}
|