Exemple #1
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));
        }
        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));
        }
Exemple #3
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || titleId >= 45)
         {
             return;
         }
         PlayerTitles titles = player.titles;
         TitleQ       titleQ = TitlesManager.GetTitle(titleId);
         if (titleQ == null)
         {
             client.SendCompletePacket(PackageDataManager.BASE_TITLE_GET_ERROR_PAK);
             return;
         }
         TitlesManager.Get2Titles(titleQ.req1, titleQ.req2, out TitleQ titleReq1, out TitleQ titleReq2);
         if ((titleQ.req1 == 0 || titleReq1 != null) && (titleQ.req2 == 0 || titleReq2 != null) && player.rankId >= titleQ.rank && player.brooch >= titleQ.brooch && player.medal >= titleQ.medals && player.blueorder >= titleQ.blueOrder && player.insignia >= titleQ.insignia && !titles.Contains(titleQ.flag) && titles.Contains(titleReq1.flag) && titles.Contains(titleReq2.flag))
         {
             if (titles.Slots < titleQ.slot && player.UpdateTitleSlots(titleQ.slot))
             {
                 titles.Slots = titleQ.slot;
             }
             if (player.UpdateTitlesFlags(titles.Add(titleQ.flag)) && player.UpdateTitleRequirements(player.brooch - titleQ.brooch, player.insignia - titleQ.insignia, player.medal - titleQ.medals, player.blueorder - titleQ.blueOrder))
             {
                 player.brooch    -= titleQ.brooch;
                 player.medal     -= titleQ.medals;
                 player.blueorder -= titleQ.blueOrder;
                 player.insignia  -= titleQ.insignia;
                 List <ItemsModel> items = TitlesManager.GetAwards(titleId);
                 if (items.Count > 0)
                 {
                     client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, items));
                 }
                 client.SendPacket(new BASE_QUEST_UPDATE_INFO_PAK(player));
                 client.SendPacket(new BASE_TITLE_GET_PAK(0, titles.Slots));
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.BASE_TITLE_GET_ERROR_PAK);
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.BASE_TITLE_GET_ERROR_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
        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));
        }
Exemple #5
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));
        }