ModernUO/Projects/UOContent/Skills/Tracking/QuestArrow.cs
Kamron Batman b6cd408623
Updates Message Packets (#321)
### API Breaking Change
Combined `AsciiMessage` and `UnicodeMessage` into a single function that takes two arguments, `bool ascii` and `string lang`. Lang can be null (or anything) if ascii is true. 

- [X] Changes message packets
- [X] Cleans up some code
- [X] Uses benchmarks to determine if the spanwriter + copyfrom
2020-11-20 21:50:13 -08:00

68 lines
1.3 KiB
C#

using Server.Mobiles;
using Server.Network;
namespace Server
{
public class QuestArrow
{
public QuestArrow(PlayerMobile m, Mobile t)
{
Running = true;
Mobile = m;
Target = t;
}
public QuestArrow(PlayerMobile m, Mobile t, int x, int y) : this(m, t)
{
Update(x, y);
}
public PlayerMobile Mobile { get; }
public Mobile Target { get; }
public bool Running { get; private set; }
public void Update()
{
Update(Target.X, Target.Y);
}
public void Update(int x, int y)
{
if (!Running)
{
return;
}
Mobile.NetState.SendSetArrow(x, y, Target.Serial);
}
public void Stop()
{
Stop(Target.X, Target.Y);
}
public void Stop(int x, int y)
{
if (!Running)
{
return;
}
Mobile.ClearQuestArrow();
Mobile.NetState.SendCancelArrow(x, y, Target.Serial);
Running = false;
OnStop();
}
public virtual void OnStop()
{
}
public virtual void OnClick(bool rightClick)
{
}
}
}