public static CharacterPositionClass Read(PacketHeader header, BinaryReader br) { CharacterPositionClass mtp = new CharacterPositionClass(); mtp.CellIndex = br.ReadUInt32(); return(mtp); }
private void Client_OnUpdatePosition(object sender, CharacterPositionClass e) { TaskProcessor.AddTask(new Task(Task.TaskType.PlayerUpdatePosition, (Connection)sender, e)); }
public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc) { _maps[client.Character.MapID].UpdatePlayerPosition(client, cpc); }
public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp) { _maps[client.Character.MapID].ProcessMoveRequest(client, mtp); }
public static CharacterPositionClass Read(PacketHeader header, BinaryReader br) { CharacterPositionClass mtp = new CharacterPositionClass(); mtp.CellIndex = br.ReadUInt32(); return mtp; }
public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc) { client.Character.CellIndex = cpc.CellIndex; // Inform other clients ObserveMovementPacket omp = new ObserveMovementPacket(client.Character.WorldID, cpc.CellIndex, client.Character.MoveSpeed); foreach (Connection c in _players.Values) { if (c.AccountID != client.AccountID) { // Send move update c.SendPacket(omp); } } }
public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp) { // Check to see if we hit any npcs foreach (NPC npc in _npcs.Values) { if (npc.CellIndex == mtp.CellIndex) { // Hit this npc - Check distance Vector target = Utils.DecodeCellIndex(_mapID, mtp.CellIndex); Vector start = Utils.DecodeCellIndex(_mapID, client.Character.CellIndex); Vector toTarget = target - start; double distSquared = toTarget.LengthSquared; if (distSquared > 13) { // Out of range, just move there client.SendPacket(new PlayerMovePacket(mtp.CellIndex, client.Character.MoveSpeed)); } else { // Talk to NPC npc.DoDialog(client); } // no matter what, we are done here return; } } // Check to see if we hit monsters // Check to see if we hit other players // Just move client.SendPacket(new PlayerMovePacket(mtp.CellIndex, client.Character.MoveSpeed)); }
void UpdatePosition_Handler(PacketHeader header, BinaryReader br) { OnUpdatePosition(this, CharacterPositionClass.Read(header, br)); }
void MoveTo_Handler(PacketHeader header, BinaryReader br) { OnMoveTo(this, CharacterPositionClass.Read(header, br)); }
public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc) { _maps[client.Character.MapID].UpdatePlayerPosition(client, cpc); }
public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp) { _maps[client.Character.MapID].ProcessMoveRequest(client, mtp); }
private void Client_OnUpdatePosition(object sender, CharacterPositionClass e) { TaskProcessor.AddTask(new Task(Task.TaskType.PlayerUpdatePosition, (Connection)sender, e)); }