示例#1
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null || this.titleIdx >= 45)
         {
             return;
         }
         if (player._titles.ownerId == 0L)
         {
             TitleManager.getInstance().CreateTitleDB(player.player_id);
             player._titles = new PlayerTitles()
             {
                 ownerId = player.player_id
             };
         }
         TitleQ title = TitlesXML.getTitle(this.titleIdx, true);
         if (title != null)
         {
             TitleQ title1;
             TitleQ title2;
             TitlesXML.get2Titles(title._req1, title._req2, out title1, out title2, false);
             if ((title._req1 == 0 || title1 != null) && (title._req2 == 0 || title2 != null) && (player._rank >= title._rank && player.brooch >= title._brooch && (player.medal >= title._medals && player.blue_order >= title._blueOrder)) && (player.insignia >= title._insignia && !player._titles.Contains(title._flag) && (player._titles.Contains(title1._flag) && player._titles.Contains(title2._flag))))
             {
                 player.brooch     -= title._brooch;
                 player.medal      -= title._medals;
                 player.blue_order -= title._blueOrder;
                 player.insignia   -= title._insignia;
                 long flags = player._titles.Add(title._flag);
                 TitleManager.getInstance().updateTitlesFlags(player.player_id, flags);
                 List <ItemsModel> awards = TitleAwardsXML.getAwards(this.titleIdx);
                 if (awards.Count > 0)
                 {
                     this._client.SendPacket((SendPacket) new INVENTORY_ITEM_CREATE_PAK(1, player, awards));
                 }
                 this._client.SendPacket((SendPacket) new BASE_QUEST_UPDATE_INFO_PAK(player));
                 TitleManager.getInstance().updateRequi(player.player_id, player.medal, player.insignia, player.blue_order, player.brooch);
                 if (player._titles.Slots < title._slot)
                 {
                     player._titles.Slots = title._slot;
                     ComDiv.updateDB("player_titles", "titleslots", (object)player._titles.Slots, "owner_id", (object)player.player_id);
                 }
             }
             else
             {
                 this.erro = 2147487875U;
             }
         }
         else
         {
             this.erro = 2147487875U;
         }
         this._client.SendPacket((SendPacket) new BASE_TITLE_GET_PAK(this.erro, player._titles.Slots));
     }
     catch (Exception ex)
     {
         Logger.warning("[BASE_TITLE_GET_REC] " + ex.ToString());
     }
 }
示例#2
0
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null || titleIdx >= 45)
         {
             return;
         }
         if (p._titles.ownerId == 0)
         {
             TitleManager.getInstance().CreateTitleDB(p.player_id);
             p._titles = new PlayerTitles {
                 ownerId = p.player_id
             };
         }
         TitleQ t1 = TitlesXML.getTitle(titleIdx);
         if (t1 != null)
         {
             TitleQ tr1, tr2;
             TitlesXML.get2Titles(t1._req1, t1._req2, out tr1, out tr2, false);
             if ((t1._req1 == 0 || tr1 != null) &&
                 (t1._req2 == 0 || tr2 != null) &&
                 p._rank >= t1._rank &&
                 p.brooch >= t1._brooch &&
                 p.medal >= t1._medals &&
                 p.blue_order >= t1._blueOrder &&
                 p.insignia >= t1._insignia &&
                 !p._titles.Contains(t1._flag) &&
                 p._titles.Contains(tr1._flag) &&
                 p._titles.Contains(tr2._flag))
             {
                 p.brooch     -= t1._brooch;
                 p.medal      -= t1._medals;
                 p.blue_order -= t1._blueOrder;
                 p.insignia   -= t1._insignia;
                 long flags = p._titles.Add(t1._flag);
                 TitleManager.getInstance().updateTitlesFlags(p.player_id, flags);
                 List <ItemsModel> items = TitleAwardsXML.getAwards(titleIdx);
                 if (items.Count > 0)
                 {
                     _client.SendPacket(new INVENTORY_ITEM_CREATE_PAK(1, p, items));
                 }
                 _client.SendPacket(new BASE_QUEST_UPDATE_INFO_PAK(p));
                 TitleManager.getInstance().updateRequi(p.player_id, p.medal, p.insignia, p.blue_order, p.brooch);
                 if (p._titles.Slots < t1._slot)
                 {
                     p._titles.Slots = t1._slot;
                     ComDiv.updateDB("player_titles", "titleslots", p._titles.Slots, "owner_id", p.player_id);
                 }
             }
             else
             {
                 erro = 0x80001083;
             }
         }
         else
         {
             erro = 0x80001083;
         }
         _client.SendPacket(new BASE_TITLE_GET_PAK(erro, p._titles.Slots));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BASE_TITLE_GET_REC.run] Erro fatal!");
     }
 }