public override void run() { if (this._client == null) { return; } if (this._client._player == null) { return; } try { Account player = this._client._player; ItemsModel itemsModel1 = player._inventory.getItem(this.objId); if (itemsModel1 != null) { this.itemId = itemsModel1._id; this.oldCOUNT = itemsModel1._count; if (itemsModel1._category == 3 && player._inventory._items.Count >= 500) { this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(2147487785U, (ItemsModel)null, (Account)null)); Logger.warning("O inventário do jogador: '" + player.player_name + "' está cheio demais!"); return; } if (this.itemId == 1301049000) { if (PlayerManager.updateKD(player.player_id, 0, 0, player._statistic.headshots_count, player._statistic.totalkills_count)) { player._statistic.kills_count = 0; player._statistic.deaths_count = 0; this._client.SendPacket((SendPacket) new BASE_USER_CHANGE_STATS_PAK(player._statistic)); } else { this.erro = 2147483648U; } } else if (this.itemId == 1301048000) { if (PlayerManager.updateFights(0, 0, 0, 0, player._statistic.totalfights_count, player.player_id)) { player._statistic.fights = 0; player._statistic.fights_win = 0; player._statistic.fights_lost = 0; player._statistic.fights_draw = 0; this._client.SendPacket((SendPacket) new BASE_USER_CHANGE_STATS_PAK(player._statistic)); } else { this.erro = 2147483648U; } } else if (this.itemId == 1301050000) { if (ComDiv.updateDB("accounts", "escapes", (object)0, "player_id", (object)player.player_id)) { player._statistic.escapes = 0; this._client.SendPacket((SendPacket) new BASE_USER_CHANGE_STATS_PAK(player._statistic)); } else { this.erro = 2147483648U; } } else if (this.itemId == 1301053000) { if (PlayerManager.updateClanBattles(player.clanId, 0, 0, 0)) { Clan clan = ClanManager.getClan(player.clanId); if (clan._id > 0 && clan.owner_id == this._client.player_id) { clan.partidas = 0; clan.vitorias = 0; clan.derrotas = 0; this._client.SendPacket((SendPacket) new CLAN_CHANGE_FIGHTS_PAK()); } else { this.erro = 2147483648U; } } else { this.erro = 2147483648U; } } else if (this.itemId == 1301055000) { Clan clan = ClanManager.getClan(player.clanId); if (clan._id > 0 && clan.owner_id == this._client.player_id) { if (clan.maxPlayers + 50 <= 250 && ComDiv.updateDB("clan_data", "max_players", (object)(clan.maxPlayers + 50), "clan_id", (object)player.clanId)) { clan.maxPlayers += 50; this._client.SendPacket((SendPacket) new CLAN_CHANGE_MAX_PLAYERS_PAK(clan.maxPlayers)); } else { this.erro = 2147487830U; } } else { this.erro = 2147487830U; } } else if (this.itemId == 1301056000) { Clan clan = ClanManager.getClan(player.clanId); if (clan._id > 0 && (double)clan._pontos != 1000.0) { if (ComDiv.updateDB("clan_data", "pontos", (object)1000f, "clan_id", (object)player.clanId)) { clan._pontos = 1000f; this._client.SendPacket((SendPacket) new CLAN_CHANGE_POINTS_PAK()); } else { this.erro = 2147487830U; } } else { this.erro = 2147487830U; } } else if (this.itemId > 1301113000 && this.itemId < 1301119000) { int increase = this.itemId == 1301114000 ? 500 : (this.itemId == 1301115000 ? 1000 : (this.itemId == 1301116000 ? 5000 : (this.itemId == 1301117000 ? 10000 : 30000))); if (ComDiv.updateDB("accounts", "gp", (object)(player._gp + increase), "player_id", (object)player.player_id)) { player._gp += increase; this._client.SendPacket((SendPacket) new AUTH_GOLD_REWARD_PAK(increase, player._gp, 0)); } else { this.erro = 2147483648U; } } else if (this.itemId == 1301999000) { if (ComDiv.updateDB("accounts", "exp", (object)(player._exp + 515999), "player_id", (object)player.player_id)) { player._exp += 515999; this._client.SendPacket((SendPacket) new A_3096_PAK(515999, 0)); } else { this.erro = 2147483648U; } } else if (itemsModel1._category == 3 && RandomBoxXML.ContainsBox(this.itemId)) { RandomBoxModel box = RandomBoxXML.getBox(this.itemId); if (box != null) { List <RandomBoxItem> sortedList = box.getSortedList(INVENTORY_ITEM_EQUIP_REC.GetRandomNumber(1, 100)); List <RandomBoxItem> rewardList = box.getRewardList(sortedList, INVENTORY_ITEM_EQUIP_REC.GetRandomNumber(0, sortedList.Count)); if (rewardList.Count > 0) { int index1 = rewardList[0].index; this._client.SendPacket((SendPacket) new AUTH_RANDOM_BOX_REWARD_PAK(this.itemId, index1)); List <ItemsModel> items = new List <ItemsModel>(); for (int index2 = 0; index2 < rewardList.Count; ++index2) { RandomBoxItem randomBoxItem = rewardList[index2]; if (randomBoxItem.item != null) { items.Add(randomBoxItem.item); } else if (PlayerManager.updateAccountGold(player.player_id, player._gp + (int)randomBoxItem.count)) { player._gp += (int)randomBoxItem.count; this._client.SendPacket((SendPacket) new AUTH_GOLD_REWARD_PAK((int)randomBoxItem.count, player._gp, 0)); } else { this.erro = 2147483648U; break; } if (randomBoxItem.special) { using (AUTH_JACKPOT_NOTICE_PAK jackpotNoticePak = new AUTH_JACKPOT_NOTICE_PAK(player.player_name, this.itemId, index1)) GameManager.SendPacketToAllClients((SendPacket)jackpotNoticePak); } } if (items.Count > 0) { this._client.SendPacket((SendPacket) new INVENTORY_ITEM_CREATE_PAK(1, player, items)); } } else { this.erro = 2147483648U; } } else { this.erro = 2147483648U; } } else { int idStatics = ComDiv.getIdStatics(itemsModel1._id, 1); if (idStatics <= 11) { if (itemsModel1._equip == 1) { itemsModel1._equip = 2; ItemsModel itemsModel2 = itemsModel1; DateTime dateTime = DateTime.Now; dateTime = dateTime.AddSeconds((double)itemsModel1._count); int num = (int)uint.Parse(dateTime.ToString("yyMMddHHmm")); itemsModel2._count = (uint)num; ComDiv.updateDB("player_items", "object_id", (object)this.objId, "owner_id", (object)player.player_id, new string[2] { "count", "equip" }, (object)(long)itemsModel1._count, (object)itemsModel1._equip); } else { this.erro = 2147483648U; } } else if (idStatics == 13) { this.cupomIncreaseDays(player, itemsModel1._name); } else if (idStatics == 15) { this.cupomIncreaseGold(player, itemsModel1._id); } else { this.erro = 2147483648U; } } } else { this.erro = 2147483648U; } this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(this.erro, itemsModel1, player)); } catch (OverflowException ex) { Logger.error("[Data do erro: " + DateTime.Now.ToString("dd/MM/yyyy HH:mm") + "] Obj: " + (object)this.objId + "; Id do item: " + (object)this.itemId + "; Count na Db: " + (object)this.oldCOUNT + "; Id do cara: " + (object)this._client.player_id + "; Nick: '" + this._client._player.player_name + "'\r\n" + ex.ToString()); this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(2147483648U, (ItemsModel)null, (Account)null)); } catch (Exception ex) { Logger.info("INVENTORY_ITEM_EQUIP_REC: " + ex.ToString()); this._client.SendPacket((SendPacket) new INVENTORY_ITEM_EQUIP_PAK(2147483648U, (ItemsModel)null, (Account)null)); } }
public override void run() { if (_client == null || _client._player == null) { return; } try { Account p = _client._player; ItemsModel itemObj = p._inventory.getItem(objId); if (itemObj != null) { itemId = itemObj._id; oldCOUNT = itemObj._count; if (itemObj._category == 3 && p._inventory._items.Count >= 500) { _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(0x80001029)); SaveLog.warning("O inventário do jogador: '" + p.player_name + "' está cheio demais!"); Printf.warning("Inventario do jogador " + p.player_name + " esta cheio"); return; } if (itemId == 1301049000) { if (PlayerManager.updateKD(p.player_id, 0, 0, p._statistic.headshots_count, p._statistic.totalkills_count)) { p._statistic.kills_count = 0; p._statistic.deaths_count = 0; _client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(p._statistic)); } else { erro = 0x80000000; } } else if (itemId == 1301048000) { if (PlayerManager.updateFights(0, 0, 0, 0, p._statistic.totalfights_count, p.player_id)) { p._statistic.fights = 0; p._statistic.fights_win = 0; p._statistic.fights_lost = 0; p._statistic.fights_draw = 0; _client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(p._statistic)); } else { erro = 0x80000000; } } else if (itemId == 1301050000) { if (ComDiv.updateDB("contas", "escapes", 0, "player_id", p.player_id)) { p._statistic.escapes = 0; _client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(p._statistic)); } else { erro = 0x80000000; } } else if (itemId == 1301053000) { if (PlayerManager.updateClanBattles(p.clanId, 0, 0, 0)) { Clan c = ClanManager.getClan(p.clanId); if (c._id > 0 && c.owner_id == _client.player_id) { c.partidas = 0; c.vitorias = 0; c.derrotas = 0; _client.SendPacket(new CLAN_CHANGE_FIGHTS_PAK()); } else { erro = 0x80000000; } } else { erro = 0x80000000; } } else if (itemId == 1301055000) { Clan c = ClanManager.getClan(p.clanId); if (c._id > 0 && c.owner_id == _client.player_id) { if (c.maxPlayers + 50 <= 250 && ComDiv.updateDB("clan_data", "max_players", c.maxPlayers + 50, "clan_id", p.clanId)) { c.maxPlayers += 50; _client.SendPacket(new CLAN_CHANGE_MAX_PLAYERS_PAK(c.maxPlayers)); } else { erro = 0x80001056; } } else { erro = 0x80001056; } } else if (itemId == 1301056000) { Clan c = ClanManager.getClan(p.clanId); if (c._id > 0 && c._pontos != 1000) { if (ComDiv.updateDB("clan_data", "pontos", 1000.0f, "clan_id", p.clanId)) { c._pontos = 1000; _client.SendPacket(new CLAN_CHANGE_POINTS_PAK()); } else { erro = 0x80001056; } } else { erro = 0x80001056; } } else if (itemId > 1301113000 && itemId < 1301119000) { int goldReceive = itemId == 1301114000 ? 500 : (itemId == 1301115000 ? 1000 : (itemId == 1301116000 ? 5000 : (itemId == 1301117000 ? 10000 : 30000))); if (ComDiv.updateDB("contas", "gp", p._gp + goldReceive, "player_id", p.player_id)) { p._gp += goldReceive; _client.SendPacket(new AUTH_GOLD_REWARD_PAK(goldReceive, p._gp, 0)); } else { erro = 0x80000000; } } else if (itemId == 1301999000) { if (ComDiv.updateDB("contas", "exp", p._exp + 515999, "player_id", p.player_id)) { p._exp += 515999; _client.SendPacket(new A_3096_PAK(515999, 0)); } else { erro = 0x80000000; } } else if (itemObj._category == 3 && RandomBoxXML.ContainsBox(itemId)) { RandomBoxModel box = RandomBoxXML.getBox(itemId); if (box != null) { List <RandomBoxItem> sortedList = box.getSortedList(GetRandomNumber(1, 100)); List <RandomBoxItem> rewardList = box.getRewardList(sortedList, GetRandomNumber(0, sortedList.Count)); if (rewardList.Count > 0) { int itemIdx = rewardList[0].index; _client.SendPacket(new AUTH_RANDOM_BOX_REWARD_PAK(itemId, itemIdx)); List <ItemsModel> rewards = new List <ItemsModel>(); for (int i = 0; i < rewardList.Count; i++) { RandomBoxItem cupom = rewardList[i]; if (cupom.item != null) { rewards.Add(cupom.item); } else if (PlayerManager.updateAccountGold(p.player_id, p._gp + (int)cupom.count)) { p._gp += (int)cupom.count; _client.SendPacket(new AUTH_GOLD_REWARD_PAK((int)cupom.count, p._gp, 0)); } else { erro = 0x80000000; break; } if (cupom.special) { using (AUTH_JACKPOT_NOTICE_PAK packet = new AUTH_JACKPOT_NOTICE_PAK(p.player_name, itemId, itemIdx)) GameManager.SendPacketToAllClients(packet); } } if (rewards.Count > 0) { _client.SendPacket(new INVENTORY_ITEM_CREATE_PAK(1, p, rewards)); } } else { erro = 0x80000000; } sortedList = null; rewardList = null; } else { erro = 0x80000000; } } else { int wclass = ComDiv.getIdStatics(itemObj._id, 1); if (wclass <= 11) { if (itemObj._equip == 1) { itemObj._equip = 2; itemObj._count = uint.Parse(DateTime.Now.AddSeconds(itemObj._count).ToString("yyMMddHHmm")); ComDiv.updateDB("player_items", "id", objId, "owner_id", p.player_id, new string[] { "count", "equip" }, (long)itemObj._count, itemObj._equip); } else { erro = 0x80000000; } } else if (wclass == 13) { cupomIncreaseDays(p, itemObj._name); } else if (wclass == 15) { cupomIncreaseGold(p, itemObj._id); } else { erro = 0x80000000; } } } else { erro = 0x80000000; } _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(erro, itemObj, p)); } catch (OverflowException ex) { Printf.b_danger("[INVENTORY_ITEM_EQUIP_REC.run] Erro fatal!"); SaveLog.fatal(" Obj: " + objId + "; Id do item: " + itemId + "; Count na Db: " + oldCOUNT + "; Id do cara: " + _client.player_id + "; Nick: '" + _client._player.player_name + "'\r\n" + ex.ToString()); _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(0x80000000)); } catch (Exception ex) { Printf.b_danger("[INVENTORY_ITEM_EQUIP_REC.run] Erro fatal!"); SaveLog.fatal(ex.ToString()); _client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(0x80000000)); } }