public static bool GetAssociation(Models.Entities.Player player, DataExchangePacket packet) { // load friends // load enemies player.ClientSocket.Send(packet); return(true); }
public static bool GetMagicSet(Models.Entities.Player player, DataExchangePacket packet) { var spells = Database.Dal.Spells.GetAllSkills(player.DbPlayer.Id); foreach (var dbSpell in spells) { player.Spells.TryAddSkill(dbSpell); } player.Spells.SendAllSkills(); player.ClientSocket.Send(packet); return(true); }
public static bool GetWeaponSkillSet(Models.Entities.Player player, DataExchangePacket packet) { var proficiencies = Database.Dal.Spells.GetAllProficiencies(player.DbPlayer.Id); foreach (var dbSpell in proficiencies) { player.Spells.TryAddProficiency(dbSpell); } player.Spells.SendAllProficiencies(); player.ClientSocket.Send(packet); return(true); }
public static bool GetItemSet(Models.Entities.Player player, DataExchangePacket packet) { player.ClientSocket.Send(packet); player.LoggedIn = true; foreach (var dbOwnerItem in Database.Dal.Inventories.GetInventory(player.DbPlayer.Id)) { var item = Collections.ItemCollection.CreateItemById((uint)dbOwnerItem.ItemId); item.DbOwnerItem = dbOwnerItem; if (!string.IsNullOrWhiteSpace(dbOwnerItem.Color)) { item.Color = dbOwnerItem.Color.ToEnum <Enums.ItemColor>(); } item.Gem1 = dbOwnerItem.Gem1.ToEnum <Enums.Gem>(); item.Gem2 = dbOwnerItem.Gem2.ToEnum <Enums.Gem>(); if (!player.Inventory.Add(item)) { player.ClientSocket.Disconnect(Drivers.Messages.Errors.FAILED_TO_LOAD_INVENTORY); return(false); } } foreach (var dbOwnerItem in Database.Dal.Equipments.GetEquipments(player.DbPlayer.Id)) { var item = Collections.ItemCollection.CreateItemById((uint)dbOwnerItem.ItemId); item.DbOwnerItem = dbOwnerItem; item.Position = dbOwnerItem.Position.ToEnum <Enums.ItemPosition>(); if (!string.IsNullOrWhiteSpace(dbOwnerItem.Color)) { item.Color = dbOwnerItem.Color.ToEnum <Enums.ItemColor>(); } item.Gem1 = dbOwnerItem.Gem1.ToEnum <Enums.Gem>(); item.Gem2 = dbOwnerItem.Gem2.ToEnum <Enums.Gem>(); if (!player.Equipments.Equip(item, item.Position, false, false, true)) { player.ClientSocket.Disconnect(Drivers.Messages.Errors.FAILED_TO_LOAD_EQUIPMENTS); return(false); } } player.UpdateScreen(false); return(true); }
public static bool GetSurroundings(Models.Entities.Player player, DataExchangePacket packet) { if (player.Map != null) { player.Map.DisplayWeather(player); } player.UpdateScreen(true); if (player.MapChangeEvents.Count > 0) { Action <Models.Entities.Player> mapChangeEvent; while (player.MapChangeEvents.TryDequeue(out mapChangeEvent)) { mapChangeEvent.Invoke(player); } } return(true); }
public static bool Handle(Models.Entities.Player player, DataExchangePacket packet) { if (!player.LoggedIn) { // First time logging in ... // Set map ... player.Teleport(player.DbPlayer.MapId.Value, player.DbPlayer.X.Value, player.DbPlayer.Y.Value); player.LastMap = Collections.MapCollection.GetMap(player.DbPlayer.LastMapId.Value); player.LastMapX = player.DbPlayer.LastMapX.Value; player.LastMapY = player.DbPlayer.LastMapY.Value; player.LoginProtectionEndTime = DateTime.UtcNow.AddSeconds(10); player.ValidateLoginMap(); } if (!Collections.PlayerCollection.ContainsClientId(player.ClientId)) { Database.Dal.Accounts.Ban( player.DbPlayer.Account, Drivers.Messages.BYPASS_LOGIN_ENTER_MAP, Database.Models.DbAccount.BanRangeType.Perm); player.ClientSocket.Disconnect(Drivers.Messages.BYPASS_LOGIN_ENTER_MAP); return(false); } player.ClientSocket.Send(new Models.Packets.Client.DataExchangePacket { ExchangeType = Enums.ExchangeType.EnterMap, ClientId = (uint)player.Map.ClientMapId, Data1 = (uint)player.Map.ClientMapId, Data3Low = player.X, Data3High = player.Y }); player.ClientSocket.Send(new Models.Packets.Location.MapInfoPacket { Map = player.Map }); return(true); }
public static bool GetSynAttr(Models.Entities.Player player, DataExchangePacket packet) { int guildId; if (Database.Dal.Guilds.HasGuild(player.DbPlayer.Id, out guildId)) { Models.Guilds.Guild guild; if (Collections.GuildCollection.TryGetGuild(guildId, out guild)) { Models.Guilds.GuildMember member; if (guild.TryGetMember(player.DbPlayer.Id, out member)) { player.Guild = guild; player.GuildMember = member; member.Player = player; player.UpdateClientGuild(); } } } player.ClientSocket.Send(packet); return(true); }
public static DataExchangePacket HandlePacket(Models.Entities.Player player, DataExchangePacket packet, out uint subPacketId) { subPacketId = (uint)packet.ExchangeType; return(packet); }