public void Walk(ConquerAngle Angle) { int dx = 0, dy = 0; switch (Angle) { case ConquerAngle.North: dx = -1; dy = -1; break; case ConquerAngle.South: dx = 1; dy = 1; break; case ConquerAngle.East: dx = 1; dy = -1; break; case ConquerAngle.West: dx = -1; dy = 1; break; case ConquerAngle.NorthWest: dx = -1; break; case ConquerAngle.SouthWest: dy = 1; break; case ConquerAngle.NorthEast: dy = -1; break; case ConquerAngle.SouthEast: dx = 1; break; } Location.X = (ushort)(Location.X + dx); Location.Y = (ushort)(Location.Y + dy); }
public IEntity() { Location = new Location(); Location.X = 400; Location.Y = 400; Location.MapID = 1002; Action = ConquerAction.Stand; Angle = ConquerAngle.Unknown; }
public override void Execute(GameClient Client, byte *pPacket) { EntityMovement *Packet = (EntityMovement *)pPacket; if (Packet->UID == Client.Entity.UID) { ConquerAngle Direction = (ConquerAngle)(Packet->Direction % 8); Client.Entity.Walk(Direction); if (!Kernel.IsWalkable(Client.Entity.Location.MapID, Client.Entity.Location.X, Client.Entity.Location.Y)) { Client.Disconnect(); } else { Client.SendScreen(Packet, Packet->Size, true); Kernel.GetScreen(Client, null); } } else { Client.Disconnect(); } }
public static ConquerAngle OppositeAngle(ConquerAngle angle) { byte myAngle = (byte)angle; if (myAngle > 3) return (ConquerAngle)(myAngle - 4); else return (ConquerAngle)(myAngle + 4); }