/// <summary> /// Handling the ChangeDirection action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.Direction = (byte)General.Direction; client.AttackPacket = null; client.SendToScreen(General, false); }
/// <summary> /// Handling the EnterMap action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (!Core.Kernel.Clients.Contains(client.EntityUID)) { client.NetworkClient.Disconnect("Not added in clients."); return; } ushort SendMap = client.Map.InheritanceMap; GeneralDataPacket mapEnter = new GeneralDataPacket(Enums.DataAction.EnterMap) { Id = SendMap, Data1 = SendMap, Data3Low = client.X, Data3High = client.Y }; client.Send(mapEnter); using (var mapinfo = new Packets.MapInfoPacket()) { mapinfo.MapID = SendMap; mapinfo.DocID = SendMap; // not entire sure what docid is, will figure this out later! foreach (Enums.MapTypeFlags flag in client.Map.Flags.Values) { mapinfo.AddFlag(flag); } mapinfo.Finish(); client.Send(mapinfo); } }
public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.AttackPacket = null; if (client.Booth != null) { client.Booth.CancelBooth(); } if (client.DynamicMap != null) { if (!client.LeaveDynamicMap()) { client.NetworkClient.Disconnect("FAILED_TO_PORTAL_DYNAMIC_MAP"); } return; } if (client.Map.InheritanceMap == client.Map.MapID) { Core.PortalPoint StartLocation = new Core.PortalPoint(client.Map.MapID, General.Data1Low, General.Data1High); if (Core.Screen.ValidDistance(client.X, client.Y, StartLocation.X, StartLocation.Y)) { if (Core.Kernel.Portals.ContainsKey(StartLocation)) { Core.PortalPoint Destination; if (Core.Kernel.Portals.TryGetValue(StartLocation, out Destination)) { client.Teleport(Destination.MapID, Destination.X, Destination.Y); return; } } } } client.Teleport(client.Map.MapID, client.LastX, client.LastY); }
/// <summary> /// Handling the GetSurroundings action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.LoggedIn) { if (client.Booth != null) { client.Booth.CancelBooth(); } client.Screen.ClearScreen(); client.Screen.UpdateScreen(null); if (client.WasInArena) { client.WasInArena = false; if (client.LostArena) { Data.ArenaMatch.SendLose(client); } else { Data.ArenaMatch.SendWin(client); } } Threads.WeatherThread.ShowWeather(client); } }
/// <summary> /// Handling the EnterMap action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (!Core.Kernel.Clients.Contains(client.EntityUID)) { client.NetworkClient.Disconnect("Not added in clients."); return; } ushort SendMap = client.Map.InheritanceMap; GeneralDataPacket mapEnter = new GeneralDataPacket(Enums.DataAction.EnterMap) { Id = SendMap, Data1 = SendMap, Data3Low = client.X, Data3High = client.Y }; client.Send(mapEnter); using (var mapinfo = new Packets.MapInfoPacket()) { mapinfo.MapID = SendMap; mapinfo.DocID = SendMap; // not entire sure what docid is, will figure this out later! foreach (Enums.MapTypeFlags flag in client.Map.Flags.Values) mapinfo.AddFlag(flag); mapinfo.Finish(); client.Send(mapinfo); } }
/// <summary> /// Handling the GetSynAttr action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.LoadGuildInfo(); Core.LoginHandler.Handle(client); client.Teleport(client.Map.MapID, client.X, client.Y); // poor fix, but updates lastmap to proper ... }
/// <summary> /// Handling the Revive action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.Alive) { return; } // check tournament spawns etc. do ReviveHere() and Teleport() for tournaments ;) client.Revive(); }
public static void Marriage(Entities.GameClient client) { GeneralDataPacket pack = new GeneralDataPacket(); pack.Id = client.EntityUID; pack.Data1 = 1067; pack.Action = Enums.DataAction.PostCmd; //(Enums.DataAction)116; pack.Data3Low = client.X; pack.Data3High = client.Y; client.Send(pack); }
/// <summary> /// Handling the GetItemSet action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.Send(General); client.LoginProtection = DateTime.Now; client.LoggedIn = true; client.Inventory.SendAll(); client.Equipments.SendItemInfos(); client.Equipments.SendGears(); client.Screen.UpdateScreen(null); }
/// <summary> /// Handling the QueryPlayer action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { uint uid = General.Data1; if (client.Map.MapObjects.ContainsKey(uid)) { Maps.IMapObject target = client.Map.MapObjects[uid]; if (target is Entities.GameClient) (target as Entities.GameClient).Send(client.CreateSpawnPacket()); if ((target is Entities.GameClient)) // or mob etc. client.Send(target.CreateSpawnPacket()); } }
public static void Handle(Entities.GameClient client, GeneralDataPacket general) { if (client.Team == null) return; uint TargetID = general.Data1; Entities.GameClient TeamMember; if (client.Team.Members.TryGetValue(TargetID, out TeamMember)) { general.Data3Low = TeamMember.X; general.Data3High = TeamMember.Y; client.Send(general); } }
public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.Booth != null) { client.Booth.CancelBooth(); return; } if (client.Map.MapID != 1036) return; client.Booth = new Data.Booth(); client.Booth.ShopOwner = client; client.Booth.CreateBooth(General); }
public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.Booth != null) { client.Booth.CancelBooth(); return; } if (client.Map.MapID != 1036) { return; } client.Booth = new Data.Booth(); client.Booth.ShopOwner = client; client.Booth.CreateBooth(General); }
public static void Handle(Entities.GameClient client, GeneralDataPacket general) { if (client.Team == null) { return; } uint TargetID = general.Data1; Entities.GameClient TeamMember; if (client.Team.Members.TryGetValue(TargetID, out TeamMember)) { general.Data3Low = TeamMember.X; general.Data3High = TeamMember.Y; client.Send(general); } }
/// <summary> /// Handling the ChangeAction action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { Enums.ActionType actiontype = (Enums.ActionType)General.Data1Low; client.AttackPacket = null; if (client.Action != Enums.ActionType.Sit && client.Action != Enums.ActionType.Lie) { if (actiontype == Enums.ActionType.Sit || actiontype == Enums.ActionType.Lie) { client.SitTime = DateTime.Now; client.UpdateStamina(true); } } client.Action = actiontype; client.SendToScreen(General, false); }
/// <summary> /// Handling the QueryPlayer action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { uint uid = General.Data1; if (client.Map.MapObjects.ContainsKey(uid)) { Maps.IMapObject target = client.Map.MapObjects[uid]; if (target is Entities.GameClient) { (target as Entities.GameClient).Send(client.CreateSpawnPacket()); } if ((target is Entities.GameClient)) // or mob etc. { client.Send(target.CreateSpawnPacket()); } } }
/// <summary> /// Handling the GetSurroundings action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.LoggedIn) { if (client.Booth != null) client.Booth.CancelBooth(); client.Screen.ClearScreen(); client.Screen.UpdateScreen(null); if (client.WasInArena) { client.WasInArena = false; if (client.LostArena) Data.ArenaMatch.SendLose(client); else Data.ArenaMatch.SendWin(client); } Threads.WeatherThread.ShowWeather(client); } }
/// <summary> /// Handling the QueryEquipment & QueryFriendEquip action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { Entities.GameClient target; if (Core.Kernel.Clients.TrySelect(General.Data1, out target)) { client.Send(target.CreateSpawnPacket()); foreach (Data.ItemInfo equip in target.Equipments.Equips.Values) { equip.SendViewPacket(target.EntityUID, client); } using (var msg = Packets.Message.MessageCore.CreateSystem( target.Name, string.Format(Core.MessageConst.VIEW_EQUIP, client.Name))) target.Send(msg); using (var stringpacket = new Packets.StringPacket(new StringPacker(target.SpouseName))) { stringpacket.Action = Enums.StringAction.QueryMate; client.Send(stringpacket); } } }
/// <summary> /// Handling the GetWeaponSkillSet action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.SpellData.SendProfInfos(); client.Send(General); }
/// <summary> /// Handling the SetPkMode action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.PKMode = (Enums.PKMode)General.Data1Low; client.Send(General); }
/// <summary> /// Handling the Jump action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (!client.Alive) return; if (client.ContainsFlag1(Enums.Effect1.IceBlock)) return; if (client.Booth != null) { client.Booth.CancelBooth(); client.Pullback(); } client.Action = Enums.ActionType.None; client.AttackPacket = null; ushort JumpX = General.Data1Low; ushort JumpY = General.Data1High; if (Core.Screen.GetDistance(client.X, client.Y, JumpX, JumpY) > 28) { client.Pullback(); return; } if (!client.Map.ValidCoord(JumpX, JumpY)) { client.Pullback(); return; } /*DateTime time = new ProjectX_V3_Lib.Time.SystemTime(General.Timestamp); if (client.LastMovement > time) { client.Pullback(); // speedhack return; }*/ if (!(DateTime.Now >= client.LastMovement.AddMilliseconds(400)) && client.LastMoveJump) { client.Pullback(); // speedhack return; } if (client.Battle != null) { if (!client.Battle.EnterArea(client)) { client.Pullback(); return; } else if (!client.Battle.LeaveArea(client)) { client.Pullback(); return; } } if (Calculations.BasicCalculations.ChanceSuccess(50)) client.Stamina += 7; client.LastMoveJump = true; client.LastMovement = DateTime.Now; client.LastX = client.X; client.LastY = client.Y; client.X = JumpX; client.Y = JumpY; client.SendToScreen(General, true); Data.AdvancedSkill.SkillInArea(client, client.X, client.Y); }
public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.RemoveFlag1(Enums.Effect1.Fly); }
/// <summary> /// Handling the GetAssociation action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { // Load friends [If not loaded] // Send friends client.Send(General); }
/// <summary> /// Handling the QueryStatInfo action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.BaseEntity.CalculateBaseStats(); // just in case ... client.Send(client.CreateStatsPacket()); }
/// <summary> /// Handling the Jump action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (!client.Alive) { return; } if (client.ContainsFlag1(Enums.Effect1.IceBlock)) { return; } if (client.Booth != null) { client.Booth.CancelBooth(); client.Pullback(); } client.Action = Enums.ActionType.None; client.AttackPacket = null; ushort JumpX = General.Data1Low; ushort JumpY = General.Data1High; if (Core.Screen.GetDistance(client.X, client.Y, JumpX, JumpY) > 28) { client.Pullback(); return; } if (!client.Map.ValidCoord(JumpX, JumpY)) { client.Pullback(); return; } /*DateTime time = new ProjectX_V3_Lib.Time.SystemTime(General.Timestamp); * if (client.LastMovement > time) * { * client.Pullback(); // speedhack * return; * }*/ if (!(DateTime.Now >= client.LastMovement.AddMilliseconds(400)) && client.LastMoveJump) { client.Pullback(); // speedhack return; } if (client.Battle != null) { if (!client.Battle.EnterArea(client)) { client.Pullback(); return; } else if (!client.Battle.LeaveArea(client)) { client.Pullback(); return; } } if (Calculations.BasicCalculations.ChanceSuccess(50)) { client.Stamina += 7; } client.LastMoveJump = true; client.LastMovement = DateTime.Now; client.LastX = client.X; client.LastY = client.Y; client.X = JumpX; client.Y = JumpY; client.SendToScreen(General, true); Data.AdvancedSkill.SkillInArea(client, client.X, client.Y); }