Esempio n. 1
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null || this.slotIdx >= 3 || player._titles == null)
         {
             return;
         }
         PlayerTitles titles = player._titles;
         int          equip  = titles.GetEquip(this.slotIdx);
         if (equip > 0 && TitleManager.getInstance().updateEquipedTitle(titles.ownerId, this.slotIdx, 0))
         {
             titles.SetEquip(this.slotIdx, 0);
             if (TitleAwardsXML.Contains(equip, player._equip._beret) && ComDiv.updateDB("accounts", "char_beret", (object)0, "player_id", (object)player.player_id))
             {
                 player._equip._beret = 0;
                 Room room = player._room;
                 if (room != null)
                 {
                     AllUtils.updateSlotEquips(player, room);
                 }
             }
         }
         else
         {
             this.erro = 2147483648U;
         }
         this._client.SendPacket((SendPacket) new BASE_TITLE_DETACH_PAK(this.erro));
     }
     catch (Exception ex)
     {
         Logger.info("BASE_TITLE_DETACH_REC: " + ex.ToString());
     }
 }
 public override void run()
 {
     try
     {
         if (_client == null)
         {
             return;
         }
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         data = new PlayerEquipedItems();
         DBQuery query = new DBQuery();
         if ((type & 1) == 1)
         {
             LoadCharaData(p, query);
         }
         if ((type & 2) == 2)
         {
             LoadWeaponsData(p, query);
         }
         if (ComDiv.updateDB("contas", "player_id", p.player_id, query.GetTables(), query.GetValues()))
         {
             UpdateChara(p);
             UpdateWeapons(p);
         }
         query = null;
         Room room = p._room;
         if (room != null)
         {
             if (type > 0)
             {
                 AllUtils.updateSlotEquips(p, room);
             }
             room.changeSlotState(p._slotId, SLOT_STATE.NORMAL, true);
         }
         _client.SendPacket(new SHOP_LEAVE_PAK());
         if (erro > 0)
         {
             _client.SendPacket(new INVENTORY_EQUIPED_ITEMS_PAK(p, 3));
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[SHOP_LEAVE_REC.run] Erro fatal!");
     }
 }
Esempio n. 3
0
 public override void run()
 {
     try
     {
         if (this._client == null)
         {
             return;
         }
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         this.data = new PlayerEquipedItems();
         DBQuery query = new DBQuery();
         if ((this.type & 1) == 1)
         {
             this.LoadCharaData(player, query);
         }
         if ((this.type & 2) == 2)
         {
             this.LoadWeaponsData(player, query);
         }
         if (ComDiv.updateDB("accounts", "player_id", (object)player.player_id, query.GetTables(), query.GetValues()))
         {
             this.UpdateChara(player);
             this.UpdateWeapons(player);
         }
         Room room = player._room;
         if (room != null)
         {
             if (this.type > 0)
             {
                 AllUtils.updateSlotEquips(player, room);
             }
             room.changeSlotState(player._slotId, SLOT_STATE.NORMAL, true);
         }
         this._client.SendPacket((SendPacket) new SHOP_LEAVE_PAK());
         if (this.erro <= 0)
         {
             return;
         }
         this._client.SendPacket((SendPacket) new INVENTORY_EQUIPED_ITEMS_PAK(player, 3));
     }
     catch (Exception ex)
     {
         Logger.info("SHOP_LEAVE_REC: " + ex.ToString());
     }
 }
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null || slotIdx >= 3 || p._titles == null)
         {
             return;
         }
         PlayerTitles t       = p._titles;
         int          titleId = t.GetEquip(slotIdx);
         if (titleId > 0 &&
             TitleManager.getInstance().updateEquipedTitle(t.ownerId, slotIdx, 0))
         {
             t.SetEquip(slotIdx, 0);
             if (TitleAwardsXML.Contains(titleId, p._equip._beret) && ComDiv.updateDB("contas", "char_beret", 0, "player_id", p.player_id))
             {
                 p._equip._beret = 0;
                 Room room = p._room;
                 if (room != null)
                 {
                     AllUtils.updateSlotEquips(p, room);
                 }
             }
         }
         else
         {
             erro = 0x80000000;
         }
         _client.SendPacket(new BASE_TITLE_DETACH_PAK(erro));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BASE_TITLE_DETACH_REC.run] Erro fatal!");
     }
 }