public static void ResurectPetRequest(IRealmClient client, RealmPacketIn packet) { int key = packet.ReadInt32(); int num = (int)packet.ReadByte(); short slotInq = packet.ReadInt16(); if (!client.ActiveCharacter.OwnedPets.ContainsKey(key)) { client.ActiveCharacter.YouAreFuckingCheater("Trying to resurect not existing pet", 20); } else { Asda2Item regularItem = client.ActiveCharacter.Asda2Inventory.GetRegularItem(slotInq); if (regularItem == null) { client.ActiveCharacter.YouAreFuckingCheater( "Trying to resurect pet with not existint resurect item.", 10); } else { Asda2PetRecord ownedPet = client.ActiveCharacter.OwnedPets[key]; if (regularItem.Category == Asda2ItemCategory.PetFoodMeat || regularItem.Category == Asda2ItemCategory.PetFoodVegetable || regularItem.Category == Asda2ItemCategory.PetFoodOil) { if (client.ActiveCharacter.Asda2Pet != null) { client.ActiveCharacter.Asda2Pet.Feed(regularItem.Template.ValueOnUse / 2); regularItem.ModAmount(-1); Asda2PetHandler.SendPetResurectedResponse(client, ownedPet, regularItem); } else { client.ActiveCharacter.SendInfoMsg("You must summon pet to feed."); } } else if (regularItem.Category != Asda2ItemCategory.PetResurect) { client.ActiveCharacter.YouAreFuckingCheater("Trying to resurect pet with not a resurect item.", 50); } else if (ownedPet.HungerPrc != (byte)0) { client.ActiveCharacter.YouAreFuckingCheater("Trying to resurect alive pet.", 50); } else { ownedPet.HungerPrc = (byte)5; regularItem.ModAmount(-1); Asda2PetHandler.SendPetResurectedResponse(client, ownedPet, regularItem); } } } }
public static void ChangePetNameRequest(IRealmClient client, RealmPacketIn packet) { int key = packet.ReadInt32(); string s = packet.ReadAsdaString(16, Locale.Start); if (!Asda2EncodingHelper.IsPrueEnglish(s)) { client.ActiveCharacter.SendOnlyEnglishCharactersAllowed("pet name"); Asda2PetHandler.SendPetNameChangedResponse(client, Asda2PetNamehangeResult.AbnormalPetInfo, (Asda2PetRecord)null, (Asda2Item)null); } else { ++packet.Position; short slotInq = packet.ReadInt16(); if (!client.ActiveCharacter.OwnedPets.ContainsKey(key)) { client.ActiveCharacter.YouAreFuckingCheater("Trying to summon not existing pet.", 20); Asda2PetHandler.SendPetNameChangedResponse(client, Asda2PetNamehangeResult.AbnormalPetInfo, (Asda2PetRecord)null, (Asda2Item)null); } else { Asda2PetRecord ownedPet = client.ActiveCharacter.OwnedPets[key]; Asda2Item shopShopItem = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slotInq); if (!ownedPet.CanChangeName) { if (shopShopItem == null) { Asda2PetHandler.SendPetNameChangedResponse(client, Asda2PetNamehangeResult.YouMustHavePremiumItemToChangePetName, ownedPet, (Asda2Item)null); return; } shopShopItem.ModAmount(-1); } ownedPet.Name = s; ownedPet.CanChangeName = false; Asda2PetHandler.SendPetNameChangedResponse(client, Asda2PetNamehangeResult.Ok, ownedPet, shopShopItem); GlobalHandler.UpdateCharacterPetInfoToArea(client.ActiveCharacter); } } }
public static void ChangeFaceOrHairRequest(IRealmClient client, RealmPacketIn packet) { bool isHair = packet.ReadByte() == (byte)1; short key = packet.ReadInt16(); int num1 = (int)packet.ReadByte(); int num2 = (int)packet.ReadByte(); packet.ReadInt32(); packet.Position += 2; short slotInq = packet.ReadInt16(); Asda2Item shopShopItem = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slotInq); if (isHair) { if (!Asda2StyleMgr.HairTemplates.ContainsKey(key)) { client.ActiveCharacter.YouAreFuckingCheater("Trying to change hair to unknown hair.", 50); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, true, false, (Asda2Item)null); return; } HairTableRecord hairTemplate = Asda2StyleMgr.HairTemplates[key]; if (hairTemplate.Price > 0 && !client.ActiveCharacter.SubtractMoney((uint)hairTemplate.Price)) { client.ActiveCharacter.SendInfoMsg("Not enought gold."); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, false, (Asda2Item)null); return; } if (hairTemplate.CuponCount > 0) { if (shopShopItem == null || shopShopItem.Category != Asda2ItemCategory.StyleShopCoupon) { client.ActiveCharacter.YouAreFuckingCheater("Not enought style coupons.", 30); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, false, (Asda2Item)null); return; } shopShopItem.ModAmount(-hairTemplate.CuponCount); } client.ActiveCharacter.HairColor = hairTemplate.HairColor; client.ActiveCharacter.HairStyle = hairTemplate.HairId; } else { if (!Asda2StyleMgr.FaceTemplates.ContainsKey(key)) { client.ActiveCharacter.YouAreFuckingCheater("Trying to change face to unknown face.", 50); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, false, (Asda2Item)null); return; } FaceTableRecord faceTemplate = Asda2StyleMgr.FaceTemplates[key]; if (faceTemplate.Price > 0 && !client.ActiveCharacter.SubtractMoney((uint)faceTemplate.Price)) { client.ActiveCharacter.SendInfoMsg("Not enought gold."); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, false, (Asda2Item)null); return; } if (faceTemplate.CuponCount > 0) { if (shopShopItem == null || shopShopItem.Category != Asda2ItemCategory.StyleShopCoupon) { client.ActiveCharacter.YouAreFuckingCheater("Not enought style coupons.", 30); Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, false, (Asda2Item)null); return; } shopShopItem.ModAmount(-faceTemplate.CuponCount); } client.ActiveCharacter.Record.Face = (byte)faceTemplate.FaceId; } Asda2StyleHandler.SendFaceOrHairChangedResponse(client, isHair, true, shopShopItem); }
private static void ProcessFunctionalItem(IRealmClient client, uint parametr, short slot) { Asda2Item item = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slot); if (item == null) { FunctionalItemsHandler.SendUpdateShopItemInfoResponse(client, UseFunctionalItemError.FunctionalItemDoesNotExist, (Asda2Item)null); } else { UseFunctionalItemError status = UseFunctionalItemError.Ok; if ((int)item.RequiredLevel > client.ActiveCharacter.Level) { FunctionalItemsHandler.SendUpdateShopItemInfoResponse(client, UseFunctionalItemError.YorLevelIsNotHightEnoght, item); } else { ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => { try { switch (item.Category) { case Asda2ItemCategory.IncPAtk: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncMAtk: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncPDef: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncMdef: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncHp: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncMp: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncStr: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncSta: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncInt: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncSpi: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncDex: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncLuck: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncMoveSpeed: if (client.ActiveCharacter.LastTransportUsedTime + TimeSpan.FromMilliseconds(30000.0) > DateTime.Now) { status = UseFunctionalItemError.CoolingTimeRemain; break; } if (item.Record.IsSoulBound && item.Record.AuctionEndTime != DateTime.MinValue && DateTime.Now > item.Record.AuctionEndTime) { Asda2InventoryHandler.ItemRemovedFromInventoryResponse(client.ActiveCharacter, item, DeleteOrSellItemStatus.Ok, 0); item.Destroy(); client.ActiveCharacter.SendInfoMsg("Vehicle expired."); status = UseFunctionalItemError.TheDurationOfTheShopitemHaExprised; break; } if (item.Record.AuctionEndTime == DateTime.MinValue) { item.Record.AuctionEndTime = DateTime.Now + TimeSpan.FromDays((double)item.AttackTime); } client.ActiveCharacter.LastTransportUsedTime = DateTime.Now; item.IsSoulbound = true; client.ActiveCharacter.TransportItemId = item.ItemId; AchievementProgressRecord progressRecord1 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(85U); switch (++progressRecord1.Counter) { case 1: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Rapid219))); break; case 1000: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Rapid219))); break; } progressRecord1.SaveAndFlush(); break; case Asda2ItemCategory.IncExp: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncDropChance: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncDigChance: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncExpStackable: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.IncAtackSpeed: client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, false); FunctionalItemsHandler.SendShopItemUsedResponse(client, item.ItemId, (int)item.Template.AtackRange); break; case Asda2ItemCategory.ExpandWarehouse: if (client.ActiveCharacter.Record.PremiumWarehouseBagsCount >= (byte)8) { status = UseFunctionalItemError.WarehouseHasReachedMaxCapacity; break; } ++client.ActiveCharacter.Record.PremiumWarehouseBagsCount; FunctionalItemsHandler.SendWarehouseSlotsExpandedResponse(client, false); break; case Asda2ItemCategory.ResetAllSkill: FunctionalItemsHandler.ResetSkills(client.ActiveCharacter); Asda2CharacterHandler.SendLearnedSkillsInfo(client.ActiveCharacter); AchievementProgressRecord progressRecord2 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(84U); switch (++progressRecord2.Counter) { case 3: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId .Perfectionist218))); break; case 5: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Perfectionist218))); break; } progressRecord2.SaveAndFlush(); break; case Asda2ItemCategory.ResetOneSkill: Spell spell1 = client.ActiveCharacter.Spells.First <Spell>( (Func <Spell, bool>)(s => (long)s.RealId == (long)parametr)); if (spell1 != null) { int num1 = 0 + spell1.Cost; for (int index = spell1.Level - 1; index > 0; --index) { Spell spell2 = SpellHandler.Get((uint)spell1.RealId + (uint)(index * 1000)); if (spell2 != null) { num1 += spell2.Cost; } } uint num2 = (uint)(num1 / 2); client.ActiveCharacter.Spells.Remove(spell1); client.ActiveCharacter.AddMoney(num2); Asda2CharacterHandler.SendPreResurectResponse(client.ActiveCharacter); FunctionalItemsHandler.SendSkillResetedResponse(client, spell1.RealId, (short)spell1.Level, num2); Asda2CharacterHandler.SendUpdateStatsOneResponse(client); Asda2CharacterHandler.SendUpdateStatsResponse(client); client.ActiveCharacter.SendMoneyUpdate(); AchievementProgressRecord progressRecord3 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(84U); switch (++progressRecord3.Counter) { case 3: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId .Perfectionist218))); break; case 5: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId .Perfectionist218))); break; } progressRecord3.SaveAndFlush(); break; } status = UseFunctionalItemError.FailedToUse; client.ActiveCharacter.SendInfoMsg("Skill is not learned. Restart client."); break; case Asda2ItemCategory.TeleportToCharacter: if (parametr >= 10U || client.ActiveCharacter.TeleportPoints[parametr] == null) { status = UseFunctionalItemError.FailedToUse; break; } Asda2TeleportingPointRecord teleportPoint = client.ActiveCharacter.TeleportPoints[parametr]; client.ActiveCharacter.TeleportTo(teleportPoint.MapId, new Vector3((float)teleportPoint.X, (float)teleportPoint.Y)); AchievementProgressRecord progressRecord4 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(89U); switch (++progressRecord4.Counter) { case 50: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Traveler223))); break; case 100: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Traveler223))); break; } progressRecord4.SaveAndFlush(); break; case Asda2ItemCategory.InstantRecover100PrcHP: if (client.ActiveCharacter.Last100PrcRecoveryUsed + 30000U > (uint)Environment.TickCount) { status = UseFunctionalItemError.CoolingTimeRemain; break; } client.ActiveCharacter.Last100PrcRecoveryUsed = (uint)Environment.TickCount; client.ActiveCharacter.HealPercent(100, (Unit)null, (SpellEffect)null); break; case Asda2ItemCategory.InstantRecover100PrcHPandMP: if (client.ActiveCharacter.Last100PrcRecoveryUsed + 30000U < (uint)Environment.TickCount) { status = UseFunctionalItemError.CoolingTimeRemain; } client.ActiveCharacter.HealPercent(100, (Unit)null, (SpellEffect)null); client.ActiveCharacter.Power = client.ActiveCharacter.MaxPower; client.ActiveCharacter.Last100PrcRecoveryUsed = (uint)Environment.TickCount; break; case Asda2ItemCategory.RecoverHp10TimesByPrcOver30Sec: PereodicAction pereodicAction = (PereodicAction)null; if (client.ActiveCharacter.PereodicActions.ContainsKey(Asda2PereodicActionType .HpRegenPrc)) { pereodicAction = client.ActiveCharacter.PereodicActions[Asda2PereodicActionType.HpRegenPrc]; } if (pereodicAction != null && pereodicAction.CallsNum >= 10 && pereodicAction.Value >= item.Template.ValueOnUse) { status = UseFunctionalItemError.CoolingTimeRemain; break; } if (client.ActiveCharacter.PereodicActions.ContainsKey(Asda2PereodicActionType .HpRegenPrc)) { client.ActiveCharacter.PereodicActions.Remove( Asda2PereodicActionType.HpRegenPrc); } client.ActiveCharacter.PereodicActions.Add(Asda2PereodicActionType.HpRegenPrc, new PereodicAction(client.ActiveCharacter, item.Template.ValueOnUse, 10, 3000, Asda2PereodicActionType.HpRegenPrc)); break; case Asda2ItemCategory.ShopBanner: if (client.ActiveCharacter.Level < 10) { status = UseFunctionalItemError.YorLevelIsNotHightEnoght; break; } FunctionalItemsHandler.SendPremiumLongBuffInfoResponse(client, (byte)client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, true), item.ItemId, (short)item.Template.PackageId); break; case Asda2ItemCategory.OpenWarehouse: break; case Asda2ItemCategory.PremiumPotions: FunctionalItemsHandler.SendPremiumLongBuffInfoResponse(client, (byte)client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, true), item.ItemId, (short)item.Template.PackageId); client.ActiveCharacter.Asda2WingsItemId = (short)item.ItemId; AchievementProgressRecord progressRecord5 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(86U); switch (++progressRecord5.Counter) { case 50: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Winged220))); break; case 100: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Winged220))); break; } progressRecord5.SaveAndFlush(); break; case Asda2ItemCategory.ExpandInventory: FunctionalItemsHandler.SendPremiumLongBuffInfoResponse(client, (byte)client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, true), item.ItemId, (short)item.Template.PackageId); AchievementProgressRecord progressRecord6 = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(87U); switch (++progressRecord6.Counter) { case 3: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Packrat221))); break; case 5: client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Packrat221))); break; } progressRecord6.SaveAndFlush(); break; case Asda2ItemCategory.PetNotEatingByDays: FunctionalItemsHandler.SendPremiumLongBuffInfoResponse(client, (byte)client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, true), item.ItemId, (short)item.Template.PackageId); client.ActiveCharacter.Map.CallDelayed(500, (Action)(() => client.ActiveCharacter.GetTitle(Asda2TitleId.Treat366))); break; case Asda2ItemCategory.RemoveDeathPenaltiesByDays: FunctionalItemsHandler.SendPremiumLongBuffInfoResponse(client, (byte)client.ActiveCharacter.ApplyFunctionItemBuff(item.ItemId, true), item.ItemId, (short)item.Template.PackageId); break; default: status = UseFunctionalItemError.NotAunctionalItem; break; } } catch (AlreadyBuffedExcepton ex) { status = UseFunctionalItemError.AlreadyFeelingTheEffectOfSimilarSkillType; } if (status == UseFunctionalItemError.Ok && item.Category != Asda2ItemCategory.IncMoveSpeed) { item.ModAmount(-1); } FunctionalItemsHandler.SendUpdateShopItemInfoResponse(client, status, item); })); } } }
public static void SendMailMessageRequest(IRealmClient client, RealmPacketIn packet) { packet.ReadInt32(); short slotInq = packet.ReadInt16(); Asda2InventoryType asda2InventoryType = (Asda2InventoryType)packet.ReadByte(); ushort num = packet.ReadUInt16(); uint sendedGold = packet.ReadUInt32(); string str = packet.ReadAsdaString(20, Locale.Start); string subject = packet.ReadAsdaString(32, Locale.Start); string message = packet.ReadAsdaString(126, Locale.Start); if (!Asda2EncodingHelper.IsPrueEnglish(message)) { client.ActiveCharacter.SendOnlyEnglishCharactersAllowed("message"); Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.WrongInformation, (Asda2Item)null); } else if (!Asda2EncodingHelper.IsPrueEnglish(subject)) { client.ActiveCharacter.SendOnlyEnglishCharactersAllowed("subject"); Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.WrongInformation, (Asda2Item)null); } else { Asda2Item asda2Item = asda2InventoryType == Asda2InventoryType.Shop ? client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slotInq) : client.ActiveCharacter.Asda2Inventory.GetRegularItem(slotInq); if (client.ActiveCharacter.Money < 1001U || client.ActiveCharacter.Money - 1000U < sendedGold) { Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.IncifitientGold, (Asda2Item)null); } else { Character chr = World.GetCharacter(str, false); CharacterRecord chrRec = chr == null?CharacterRecord.GetRecordByName(str) : chr.Record; if (chrRec == null) { Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.RecipentNotFounded, (Asda2Item)null); } else { Asda2Item sendItem = (Asda2Item)null; if (asda2Item != null) { if (asda2Item.IsSoulbound) { Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.YouCantSendThisItem, (Asda2Item)null); return; } if (asda2Item.Amount < (int)num) { client.ActiveCharacter.YouAreFuckingCheater("Tying to mail wrong item amount", 50); Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.WrongInformation, (Asda2Item)null); return; } asda2Item.ModAmount(-(num == (ushort)0 ? 1 : (int)num)); sendItem = Asda2Item.CreateItem(asda2Item.Template, (Character)null, num == (ushort)0 ? 1 : (int)num); sendItem.Record.SaveLater(); } client.ActiveCharacter.SubtractMoney(sendedGold + 1000U); Log.Create(Log.Types.ItemOperations, LogSourceType.Character, client.ActiveCharacter.EntryId) .AddAttribute("source", 0.0, "send_mail").AddItemAttributes(sendItem, "sent") .AddItemAttributes(asda2Item, "source").AddAttribute("gold", (double)sendedGold, "") .AddAttribute("receiver", (double)chrRec.EntityLowId, str).Write(); ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => { Asda2MailMessage record = new Asda2MailMessage(subject, message, sendItem, sendedGold, chrRec.EntityLowId, client.ActiveCharacter.Name); record.CreateLater(); if (chr == null) { return; } chr.MailMessages.Add(record.Guid, record); chr.SendMailMsg(string.Format("You recieve new message from {0}. Subject {1}.", (object)client.ActiveCharacter.Name, (object)record.Subject)); Asda2MailHandler.SendYouHaveNewMailResponse(chr.Client, 1); })); Asda2MailHandler.SendMailMessageSendedResponse(client, MailMessageSendedStatus.Ok, asda2Item); } } } }
public static void BreakPetLvlLimitRequest(IRealmClient client, RealmPacketIn packet) { int key = packet.ReadInt32(); packet.ReadInt32(); int num1 = (int)packet.ReadByte(); short slotInq1 = packet.ReadInt16(); packet.ReadInt32(); int num2 = (int)packet.ReadByte(); short slotInq2 = packet.ReadInt16(); if (!client.ActiveCharacter.OwnedPets.ContainsKey(key)) { client.ActiveCharacter.YouAreFuckingCheater("Trying to break pet lvl limit not existing pet.", 20); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.AbnormalPetInfo, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else { Asda2Item regularItem = client.ActiveCharacter.Asda2Inventory.GetRegularItem(slotInq1); if (regularItem == null) { client.ActiveCharacter.YouAreFuckingCheater( "Trying to break pet lvl limit with not existint break lvl item.", 10); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.PetLimitPotionInfoAbnormal, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else if (regularItem.Category != Asda2ItemCategory.PetLevelBreakPotion) { client.ActiveCharacter.YouAreFuckingCheater("Trying to resurect pet with not a resurect item.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.PetLimitPotionInfoAbnormal, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else { Asda2PetRecord ownedPet = client.ActiveCharacter.OwnedPets[key]; if (regularItem.Template.ValueOnUse != (int)ownedPet.Level) { client.ActiveCharacter.YouAreFuckingCheater("Trying to break pet level limit wrong level item.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.TheLevelOfLimitBreakItemIsTooLow, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else if (!ownedPet.IsMaxExpirience) { client.ActiveCharacter.YouAreFuckingCheater( "Trying to break pet level limit with not 100prc exp.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.Not100PrcExp, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else if ((int)ownedPet.Level != (int)ownedPet.MaxLevel) { client.ActiveCharacter.YouAreFuckingCheater( "Trying to break pet level limit with not maxed level.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.TheLevelOfLimitBreakItemIsTooLow, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else if (ownedPet.Level >= (byte)10) { client.ActiveCharacter.YouAreFuckingCheater("Trying to break pet level limit more than 10 lvl.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.MaximumBreakLvlLimitReached, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else { bool flag = CharacterFormulas.CalcPetLevelBreakSuccess(); Asda2Item shopShopItem = client.ActiveCharacter.Asda2Inventory.GetShopShopItem(slotInq2); if (shopShopItem != null && shopShopItem.Category != Asda2ItemCategory.PetLevelProtection) { client.ActiveCharacter.YouAreFuckingCheater( "Trying to break pet level limit with incorect category supl.", 50); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, PetLimitBreakStatus.MaximumBreakLvlLimitReached, (Asda2PetRecord)null, (Asda2Item)null, (Asda2Item)null); } else { if (flag) { ++ownedPet.MaxLevel; ++ownedPet.Level; } else { ownedPet.RemovePrcExp(shopShopItem == null ? 50 : 10); } if (shopShopItem != null) { shopShopItem.ModAmount(-1); } regularItem.ModAmount(-1); Asda2PetHandler.SendPetLevelLimitBreakedResponse(client, flag ? PetLimitBreakStatus.Ok : PetLimitBreakStatus.FailedRedusedBy50, ownedPet, regularItem, shopShopItem); } } } } }
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(); } } } } }