Example #1
0
        public static void RemovePetRequest(IRealmClient client, RealmPacketIn packet)
        {
            int key = packet.ReadInt32();

            if (!client.ActiveCharacter.OwnedPets.ContainsKey(key))
            {
                client.ActiveCharacter.YouAreFuckingCheater("Trying delete not existing pet.", 10);
            }
            else if (client.ActiveCharacter.Asda2Pet != null && client.ActiveCharacter.Asda2Pet.Guid == key)
            {
                client.ActiveCharacter.SendInfoMsg("You can't delete summoned pet.");
            }
            else
            {
                Asda2PetRecord ownedPet = client.ActiveCharacter.OwnedPets[key];
                client.ActiveCharacter.OwnedPets.Remove(key);
                Asda2PetHandler.SendPetRemovedResponse(client, ownedPet.Guid);
                ownedPet.DeleteLater();
            }
        }
Example #2
0
        public static void PetSyntesRequest(IRealmClient client, RealmPacketIn packet)
        {
            bool flag = packet.ReadByte() == (byte)1;
            int  key1 = packet.ReadInt32();
            int  key2 = packet.ReadInt32();

            packet.ReadInt32();
            int   num1     = (int)packet.ReadByte();
            short slotInq1 = packet.ReadInt16();

            packet.ReadInt32();
            int   num2     = (int)packet.ReadByte();
            short slotInq2 = packet.ReadInt16();

            packet.ReadInt32();
            int   num3     = (int)packet.ReadByte();
            short slotInq3 = packet.ReadInt16();

            if (!client.ActiveCharacter.OwnedPets.ContainsKey(key1) ||
                !client.ActiveCharacter.OwnedPets.ContainsKey(key2))
            {
                client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with not existing pets.", 20);
                Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo,
                                                            (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
            }
            else if (client.ActiveCharacter.Asda2Pet != null &&
                     (client.ActiveCharacter.Asda2Pet.Guid == key1 || client.ActiveCharacter.Asda2Pet.Guid == key2))
            {
                Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.CantUseCurrentlySummonedPet,
                                                            (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
            }
            else
            {
                Asda2Item regularItem1 = client.ActiveCharacter.Asda2Inventory.GetRegularItem(slotInq1);
                Asda2Item regularItem2 = client.ActiveCharacter.Asda2Inventory.GetRegularItem(slotInq2);
                Asda2Item shopShopItem = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slotInq3);
                if (regularItem1 == null || regularItem2 == null && flag)
                {
                    client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with not existing rank or class item.",
                                                                20);
                    Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo,
                                                                (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                }
                else if (regularItem1.Category != Asda2ItemCategory.PetSynesisPotion ||
                         regularItem2 != null && regularItem2.Category != Asda2ItemCategory.PetPotion)
                {
                    client.ActiveCharacter.YouAreFuckingCheater(
                        "Tries to sysnes with rank or class potion item with wrong category.", 50);
                    Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo,
                                                                (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                }
                else if (shopShopItem != null &&
                         shopShopItem.Category != Asda2ItemCategory.PetSynthesisSupplementOrPetLevelProtection)
                {
                    client.ActiveCharacter.YouAreFuckingCheater(
                        "Tries to sysnes with supliment potion item with wrong category.", 50);
                    Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo,
                                                                (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                }
                else if ((int)regularItem1.RequiredLevel > client.ActiveCharacter.Level)
                {
                    Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.IncorrectSuplimentLevel,
                                                                (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                }
                else
                {
                    Asda2PetRecord ownedPet1 = client.ActiveCharacter.OwnedPets[key1];
                    Asda2PetRecord ownedPet2 = client.ActiveCharacter.OwnedPets[key2];
                    if (ownedPet1.Level < (byte)5 ||
                        (int)ownedPet2.Level + (shopShopItem == null ? 0 : 2) < (flag ? 5 : 3))
                    {
                        client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with low level pets.", 50);
                        Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.LowPetLevel,
                                                                    (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                    }
                    else
                    {
                        int rarity = flag
                            ? CharacterFormulas.CalcResultSyntesPetRarity(ownedPet1.Template.Rarity,
                                                                          ownedPet2.Template.Rarity)
                            : CharacterFormulas.CalcResultEvolutionPetRarity(ownedPet1.Template.Rarity,
                                                                             ownedPet2.Template.Rarity);
                        PetTemplate petTemplate = flag
                            ? Asda2PetMgr.PetTemplatesByRankAndRarity[regularItem1.Template.ValueOnUse][rarity].Values
                                                  .ToArray <PetTemplate>()[
                            Utility.Random(0,
                                           Asda2PetMgr.PetTemplatesByRankAndRarity[regularItem1.Template.ValueOnUse][
                                               rarity].Count - 1)]
                            : ownedPet1.Template.GetEvolutionTemplate(rarity, regularItem1.Template.ValueOnUse);
                        if (petTemplate == null)
                        {
                            if (flag)
                            {
                                client.ActiveCharacter.YouAreFuckingCheater(
                                    string.Format(
                                        "Tries to sysnes, but result pet template was null. Please report to developers. Rarity {0} Rank {1}.",
                                        (object)rarity, (object)regularItem1.Template.ValueOnUse), 0);
                            }
                            else
                            {
                                client.ActiveCharacter.YouAreFuckingCheater(
                                    string.Format(
                                        "Tries to evalute, but result pet template was null. Please report to developers. Rarity {0} Rank {1}.",
                                        (object)rarity, (object)regularItem1.Template.ValueOnUse), 0);
                            }
                            Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.LowPetLevel,
                                                                        (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null, (Asda2Item)null, 0, 0);
                        }
                        else
                        {
                            Asda2PetRecord resultPet = client.ActiveCharacter.AddAsda2Pet(petTemplate, true);
                            regularItem1.ModAmount(-1);
                            if (regularItem2 != null)
                            {
                                regularItem2.ModAmount(-1);
                            }
                            if (shopShopItem != null)
                            {
                                shopShopItem.ModAmount(-1);
                            }
                            client.ActiveCharacter.OwnedPets.Remove(key1);
                            client.ActiveCharacter.OwnedPets.Remove(key2);
                            Asda2PetHandler.SendPetSyntesResultResponse(client, PetSynethisResult.Ok, resultPet,
                                                                        regularItem1, regularItem2, shopShopItem, ownedPet1.Guid, ownedPet2.Guid);
                            ownedPet1.DeleteLater();
                            ownedPet2.DeleteLater();
                        }
                    }
                }
            }
        }