void HandleGameControl_MoveDown(GameControl sender, EventArgs e) { using (var pw = ClientPacket.MoveDown()) { Socket.Send(pw, ClientMessageType.CharacterMove); } }
void HandleGameControl_Use(GameControl sender, EventArgs e) { var useEntity = Map.Spatial.Get<DynamicEntity>(UserChar.ToRectangle(), UsableEntityFilter); if (useEntity == null) return; using (var pw = ClientPacket.UseWorld(useEntity.MapEntityIndex)) { Socket.Send(pw, ClientMessageType.CharacterInteract); } }
void HandleGameControl_TalkToNPC(GameControl sender, EventArgs e) { var r = UserChar.ToRectangle(GameData.MaxNPCChatDistance); CharacterEntity npc = Map.Spatial.Get<Character>(r, x => x.HasChatDialog || !x.ProvidedQuests.IsEmpty()); if (npc == null) return; using (var pw = ClientPacket.StartNPCChatDialog(npc.MapEntityIndex, false)) { Socket.Send(pw, ClientMessageType.CharacterInteract); } }
void HandleGameControl_Shop(GameControl sender, EventArgs e) { var shopOwner = GetClosestValidShopOwner(UserChar); if (shopOwner == null) return; using (var pw = ClientPacket.StartShopping(shopOwner.MapEntityIndex)) { Socket.Send(pw, ClientMessageType.CharacterInteract); } }
void HandleGameControl_PickUp(GameControl sender, EventArgs e) { var pickupItem = Map.Spatial.Get<ItemEntity>(GameData.GetPickupArea(UserChar)); if (pickupItem == null) return; using (var pw = ClientPacket.PickupItem(pickupItem.MapEntityIndex)) { Socket.Send(pw, ClientMessageType.CharacterInteract); } }
void HandleGameControl_Attack(GameControl sender, EventArgs e) { using (var pw = ClientPacket.Attack(TargetIndex)) { Socket.Send(pw, ClientMessageType.CharacterAction); } }