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());
     }
 }
Beispiel #2
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || slotIdx >= 3)
         {
             return;
         }
         PlayerTitles titles  = player.titles;
         int          titleId = titles.GetEquip(slotIdx);
         if (titleId > 0 && player.UpdateEquipedTitle(slotIdx, 0))
         {
             titles.SetEquip(slotIdx, 0);
             if (TitlesManager.Contains(titleId, player.equipments.beret) && player.ExecuteQuery($"UPDATE accounts SET character_beret='0' WHERE id='{player.playerId}'"))
             {
                 player.equipments.beret = 0;
                 Room room = player.room;
                 if (room != null && room.GetSlot(player.slotId, out Slot slot))
                 {
                     slot.equipment = player.equipments;
                 }
             }
             client.SendCompletePacket(PackageDataManager.BASE_TITLE_DETACH_SUCCESS_PAK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.BASE_TITLE_DETACH_ERROR_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
 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!");
     }
 }