예제 #1
0
 private static void GetCardMedalInfo(CardAwards card, int medalId)
 {
     if (medalId == 0)
     {
         return;
     }
     if (medalId >= 1 && medalId <= 50)
     {
         card.brooch++;
     }
     else if (medalId >= 51 && medalId <= 100)
     {
         card.insignia++;
     }
     else if (medalId >= 101 && medalId <= 116)
     {
         card.medal++;
     }
 }
예제 #2
0
        private static void GenerateList(string path, string missionName)
        {
            int missionId = ConvertStringToInt(missionName);

            if (missionId == 0)
            {
                Logger.Warning(" [MissionCardXML] mission inválid: " + missionName);
            }
            byte[] buffer;
            try
            {
                buffer = File.ReadAllBytes(path);
            }
            catch
            {
                buffer = new byte[0];
            }
            if (buffer.Length == 0)
            {
                return;
            }
            try
            {
                PacketReader receive = new PacketReader(buffer);
                receive.ReadS(4);
                int questType = receive.ReadD();
                receive.ReadB(16);
                int valor1 = 0, valor2 = 0;
                for (int i = 0; i < 40; i++)
                {
                    int missionBId = valor2++, cardBId = valor1;
                    if (valor2 == 4)
                    {
                        valor2 = 0;
                        valor1++;
                    }
                    int reqType = receive.ReadUH();
                    list.Add(new Card(cardBId, missionBId)
                    {
                        missionType  = (MissionTypeEnum)receive.ReadC(),
                        mapId        = receive.ReadC(),
                        missionLimit = receive.ReadC(),
                        weaponReq    = (ClassTypeEnum)receive.ReadC(),
                        weaponReqId  = receive.ReadUH(),

                        missionId = missionId
                    });
                    if (questType == 1)
                    {
                        receive.ReadB(24);
                    }
                }
                int vai = questType == 2 ? 5 : 1;
                for (int i = 0; i < 10; i++)
                {
                    int gold   = receive.ReadD();
                    int xp     = receive.ReadD();
                    int medals = receive.ReadD();
                    for (int i2 = 0; i2 < vai; i2++)
                    {
                        int unk       = receive.ReadD();
                        int type      = receive.ReadD();
                        int itemId    = receive.ReadD();
                        int itemCount = receive.ReadD();
                    }
                    CardAwards card = new CardAwards {
                        id = missionId, card = i, exp = questType == 1 ? (xp * 10) : xp, gold = gold
                    };
                    GetCardMedalInfo(card, medals);
                    if (!card.Unusable())
                    {
                        awards.Add(card);
                    }
                }
                if (questType == 2)
                {
                    int goldResult = receive.ReadD();
                    receive.ReadB(8);
                    for (int i = 0; i < 5; i++)
                    {
                        int unkI      = receive.ReadD();
                        int typeI     = receive.ReadD(); //1 - unidade | 2 - dias
                        int itemId    = receive.ReadD();
                        int itemCount = receive.ReadD();
                        if (unkI > 0)
                        {
                            items.Add(new MissionItemAward {
                                missionId = missionId, item = new ItemsModel(itemId)
                                {
                                    equip = 1, count = itemCount, name = "Mission item"
                                }
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
            }
        }