[PacketHandler(RealmServerOpCode.PetSyntes)]//6112 public static void PetSyntesRequest(IRealmClient client, RealmPacketIn packet) { var IsSyntes = packet.ReadByte() == 1; //default : 0Len : 1 var pet1Guid = packet.ReadInt32(); //default : 69837Len : 4 var pet2Guid = packet.ReadInt32(); //default : 69831Len : 4 var RankPotionId = packet.ReadInt32(); //default : 37803Len : 4 var rankPotionInv = packet.ReadByte(); //default : 2Len : 1 var rankPotionSlot = packet.ReadInt16(); //default : 27Len : 2 var classPotionItemId = packet.ReadInt32(); //default : -1Len : 4 var classPotionInv = packet.ReadByte(); //default : 0Len : 1 var classPotionSlot = packet.ReadInt16(); //default : -1Len : 2 var premItemId = packet.ReadInt32(); //default : 31Len : 4 var premItemInv = packet.ReadByte(); //default : 1Len : 1 var premItemSlot = packet.ReadInt16(); //default : 12Len : 2 if (!client.ActiveCharacter.OwnedPets.ContainsKey(pet1Guid) || !client.ActiveCharacter.OwnedPets.ContainsKey(pet2Guid)) { client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with not existing pets.", 20); SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo); return; } if (client.ActiveCharacter.Asda2Pet != null && (client.ActiveCharacter.Asda2Pet.Guid == pet1Guid || client.ActiveCharacter.Asda2Pet.Guid == pet2Guid)) { SendPetSyntesResultResponse(client, PetSynethisResult.CantUseCurrentlySummonedPet); return; } var rankPotionItem = client.ActiveCharacter.Asda2Inventory.GetRegularItem(rankPotionSlot); var classPotionItem = client.ActiveCharacter.Asda2Inventory.GetRegularItem(classPotionSlot); var suplItem = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(premItemSlot); if (rankPotionItem == null || (classPotionItem == null && IsSyntes)) { client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with not existing rank or class item.", 20); SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo); return; } if (rankPotionItem.Category != Asda2ItemCategory.PetSynesisPotion || (classPotionItem != null && classPotionItem.Category != Asda2ItemCategory.PetPotion)) { client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with rank or class potion item with wrong category.", 50); SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo); return; } if (suplItem != null && suplItem.Category != Asda2ItemCategory.PetSynthesisSupplementOrPetLevelProtection) { client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with supliment potion item with wrong category.", 50); SendPetSyntesResultResponse(client, PetSynethisResult.AbnormalPetInfo); return; } if (rankPotionItem.RequiredLevel > client.ActiveCharacter.Level) { SendPetSyntesResultResponse(client, PetSynethisResult.IncorrectSuplimentLevel); return; } var pet1 = client.ActiveCharacter.OwnedPets[pet1Guid]; var pet2 = client.ActiveCharacter.OwnedPets[pet2Guid]; if (pet1.Level < 5 || (pet2.Level + (suplItem == null ? 0 : 2)) < (IsSyntes ? 5 : 3)) { client.ActiveCharacter.YouAreFuckingCheater("Tries to sysnes with low level pets.", 50); SendPetSyntesResultResponse(client, PetSynethisResult.LowPetLevel); return; } var resultPetRatiry = IsSyntes ? CharacterFormulas.CalcResultSyntesPetRarity(pet1.Template.Rarity, pet2.Template.Rarity) : CharacterFormulas.CalcResultEvolutionPetRarity(pet1.Template.Rarity, pet2.Template.Rarity); if (!Asda2PetMgr.PetTemplatesByRankAndRarity.ContainsKey(rankPotionItem.Template.ValueOnUse)) { client.ActiveCharacter.SendErrorMsg("No data for syntes."); SendPetSyntesResultResponse(client, PetSynethisResult.SuplimentInfoAbnormal); return; } var resultPetTemplate = IsSyntes ? Asda2PetMgr.PetTemplatesByRankAndRarity[rankPotionItem.Template.ValueOnUse][resultPetRatiry].Values. ToArray()[ Util.Utility.Random(0, Asda2PetMgr.PetTemplatesByRankAndRarity[rankPotionItem.Template.ValueOnUse][ resultPetRatiry].Count - 1)] : pet1.Template.GetEvolutionTemplate(resultPetRatiry, rankPotionItem.Template.ValueOnUse); if (resultPetTemplate == null) { if (IsSyntes) { client.ActiveCharacter.YouAreFuckingCheater(string.Format("Tries to sysnes, but result pet template was null. Please report to developers. Rarity {0} Rank {1}.", resultPetRatiry, rankPotionItem.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}.", resultPetRatiry, rankPotionItem.Template.ValueOnUse), 0); } SendPetSyntesResultResponse(client, PetSynethisResult.LowPetLevel); return; } var resultPet = client.ActiveCharacter.AddAsda2Pet(resultPetTemplate, true); rankPotionItem.ModAmount(-1); if (classPotionItem != null) { classPotionItem.ModAmount(-1); } if (suplItem != null) { suplItem.ModAmount(-1); } client.ActiveCharacter.OwnedPets.Remove(pet1Guid); client.ActiveCharacter.OwnedPets.Remove(pet2Guid); SendPetSyntesResultResponse(client, PetSynethisResult.Ok, resultPet, rankPotionItem, classPotionItem, suplItem, pet1.Guid, pet2.Guid); pet1.DeleteLater(); pet2.DeleteLater(); }
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(); } } } } }