Пример #1
0
 public override void run()
 {
     try
     {
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         PlayerTitles titles = player._titles;
         TitleQ       title  = TitlesXML.getTitle((int)this.titleId, true);
         TitleQ       title1;
         TitleQ       title2;
         TitleQ       title3;
         TitlesXML.get3Titles(titles.Equiped1, titles.Equiped2, titles.Equiped3, out title1, out title2, out title3, false);
         if (this.slotIdx >= (byte)3 || this.titleId >= (byte)45 || (titles == null || title == null) || (title._classId == title1._classId && this.slotIdx != (byte)0 || title._classId == title2._classId && this.slotIdx != (byte)1) || (title._classId == title3._classId && this.slotIdx != (byte)2 || (!titles.Contains(title._flag) || titles.Equiped1 == (int)this.titleId) || (titles.Equiped2 == (int)this.titleId || titles.Equiped3 == (int)this.titleId)))
         {
             this.erro = 2147483648U;
         }
         else if (TitleManager.getInstance().updateEquipedTitle(titles.ownerId, (int)this.slotIdx, (int)this.titleId))
         {
             titles.SetEquip((int)this.slotIdx, (int)this.titleId);
         }
         else
         {
             this.erro = 2147483648U;
         }
         this._client.SendPacket((SendPacket) new BASE_TITLE_USE_PAK(this.erro));
     }
     catch (Exception ex)
     {
         Logger.info("BASE_TITLE_USE_REC: " + ex.ToString());
     }
 }
Пример #2
0
        public static string GetAllTitles(Account p)
        {
            if (p._titles.ownerId == 0L)
            {
                TitleManager.getInstance().CreateTitleDB(p.player_id);
                p._titles = new PlayerTitles()
                {
                    ownerId = p.player_id
                };
            }
            PlayerTitles titles = p._titles;
            int          num    = 0;

            for (int titleId = 1; titleId <= 44; ++titleId)
            {
                TitleQ title = TitlesXML.getTitle(titleId, true);
                if (title != null && !titles.Contains(title._flag))
                {
                    ++num;
                    titles.Add(title._flag);
                    if (titles.Slots < title._slot)
                    {
                        titles.Slots = title._slot;
                    }
                }
            }
            if (num > 0)
            {
                ComDiv.updateDB("player_titles", "titleslots", (object)titles.Slots, "owner_id", (object)p.player_id);
                TitleManager.getInstance().updateTitlesFlags(p.player_id, titles.Flags);
                p.SendPacket((SendPacket) new BASE_2626_PAK(p));
            }
            return(Translation.GetLabel("TitleAcquisiton", (object)num));
        }
Пример #3
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());
     }
 }
        public static string GetAllTitles(Account p)
        {
            if (p._titles.ownerId == 0)
            {
                TitleManager.getInstance().CreateTitleDB(p.player_id);
                p._titles = new PlayerTitles {
                    ownerId = p.player_id
                };
            }
            PlayerTitles titles = p._titles;
            int          count  = 0;

            for (int i = 1; i <= 44; i++)
            {
                TitleQ title = TitlesXML.getTitle(i, true);
                if (title != null && !titles.Contains(title._flag))
                {
                    count++;
                    titles.Add(title._flag);
                    if (titles.Slots < title._slot)
                    {
                        titles.Slots = title._slot;
                    }
                }
            }
            if (count > 0)
            {
                ComDiv.updateDB("player_titles", "titleslots", titles.Slots, "owner_id", p.player_id);
                TitleManager.getInstance().updateTitlesFlags(p.player_id, titles.Flags);
                p.SendPacket(new BASE_2626_PAK(p));
            }
            return(Translation.GetLabel("TitleAcquisiton", count));
        }
        public static string SendTitlePlayer(string str)
        {
            string txt = str.Substring(str.IndexOf(" ") + 1);

            string[] split     = txt.Split(' ');
            long     player_id = Convert.ToInt64(split[0]);

            Account p = AccountManager.getAccount(player_id, 0);

            if (p._titles.ownerId == 0)
            {
                TitleManager.getInstance().CreateTitleDB(p.player_id);
                p._titles = new PlayerTitles {
                    ownerId = p.player_id
                };
            }
            PlayerTitles titles = p._titles;
            int          count  = 0;

            for (int i = 1; i <= 44; i++)
            {
                TitleQ title = TitlesXML.getTitle(i, true);
                if (title != null && !titles.Contains(title._flag))
                {
                    count++;
                    titles.Add(title._flag);
                    if (titles.Slots < title._slot)
                    {
                        titles.Slots = title._slot;
                    }
                }
            }
            if (count > 0)
            {
                ComDiv.updateDB("player_titles", "titleslots", titles.Slots, "owner_id", p.player_id);
                TitleManager.getInstance().updateTitlesFlags(p.player_id, titles.Flags);
                p.SendPacket(new BASE_2626_PAK(p));
            }
            return(Translation.GetLabel("TitleAcquisiton", count));
        }
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         PlayerTitles t = p._titles;
         TitleQ       titleQ = TitlesXML.getTitle(titleId),
                      eq1, eq2, eq3;
         TitlesXML.get3Titles(t.Equiped1, t.Equiped2, t.Equiped3, out eq1, out eq2, out eq3, false);
         if (slotIdx >= 3 || titleId >= 45 || t == null || titleQ == null || titleQ._classId == eq1._classId && slotIdx != 0 || titleQ._classId == eq2._classId && slotIdx != 1 || titleQ._classId == eq3._classId && slotIdx != 2 || !t.Contains(titleQ._flag) || t.Equiped1 == titleId || t.Equiped2 == titleId || t.Equiped3 == titleId)
         {
             erro = 0x80000000;
         }
         else
         {
             if (TitleManager.getInstance().updateEquipedTitle(t.ownerId, slotIdx, titleId))
             {
                 t.SetEquip(slotIdx, titleId);
             }
             else
             {
                 erro = 0x80000000;
             }
         }
         _client.SendPacket(new BASE_TITLE_USE_PAK(erro));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BASE_TITLE_USE_REC.run] Erro fatal!");
     }
 }
Пример #7
0
        public static string SendTitlePlayer(string str)
        {
            Account account = AccountManager.getAccount(Convert.ToInt64(str.Substring(str.IndexOf(" ") + 1).Split(' ')[0]), 0);

            if (account._titles.ownerId == 0L)
            {
                TitleManager.getInstance().CreateTitleDB(account.player_id);
                account._titles = new PlayerTitles()
                {
                    ownerId = account.player_id
                };
            }
            PlayerTitles titles = account._titles;
            int          num    = 0;

            for (int titleId = 1; titleId <= 44; ++titleId)
            {
                TitleQ title = TitlesXML.getTitle(titleId, true);
                if (title != null && !titles.Contains(title._flag))
                {
                    ++num;
                    titles.Add(title._flag);
                    if (titles.Slots < title._slot)
                    {
                        titles.Slots = title._slot;
                    }
                }
            }
            if (num > 0)
            {
                ComDiv.updateDB("player_titles", "titleslots", (object)titles.Slots, "owner_id", (object)account.player_id);
                TitleManager.getInstance().updateTitlesFlags(account.player_id, titles.Flags);
                account.SendPacket((SendPacket) new BASE_2626_PAK(account));
            }
            return(Translation.GetLabel("TitleAcquisiton", (object)num));
        }
Пример #8
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!");
     }
 }