Exemplo 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
     {
         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!");
     }
 }