public static void SendFaceOrHairChangedResponse(IRealmClient client, bool isHair, bool success = false, Asda2Item usedItem = null) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.FaceOrHairChanged)) { packet.WriteByte(success ? 1 : 0); packet.WriteByte(isHair ? 1 : 2); packet.WriteByte(client.ActiveCharacter.HairStyle); packet.WriteByte(client.ActiveCharacter.HairColor); packet.WriteByte(client.ActiveCharacter.Record.Face); packet.WriteInt32(client.ActiveCharacter.Asda2Inventory.Weight); packet.WriteInt32(client.ActiveCharacter.Money); Asda2InventoryHandler.WriteItemInfoToPacket(packet, usedItem, false); client.Send(packet, true); if (!success) { return; } AchievementProgressRecord progressRecord = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(9U); switch (++progressRecord.Counter) { case 50: client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Beautiful47); break; case 100: client.ActiveCharacter.GetTitle(Asda2TitleId.Beautiful47); break; } progressRecord.SaveAndFlush(); } }
public static bool AddItem(Character chr, Asda2ItemTemplate templ, int amount, Character triggerer) { var actualAmount = amount; var inv = chr.Asda2Inventory; // just add Asda2Item item = null; Asda2InventoryError err = inv.TryAdd((int)templ.ItemId, amount, false, ref item); if (err != Asda2InventoryError.Ok || amount < actualAmount) { // something went wrong if (err != Asda2InventoryError.Ok) { Asda2InventoryHandler.SendItemReplacedResponse(chr.Client); } return(false); } Log.Create(Log.Types.ItemOperations, LogSourceType.Character, chr.EntryId) .AddAttribute("source", 0, "created_by_gm") .AddItemAttributes(item) .AddAttribute("map", (double)chr.MapId, chr.MapId.ToString()) .AddAttribute("x", chr.Asda2Position.X) .AddAttribute("y", chr.Asda2Position.Y) .AddAttribute("gm", triggerer.EntryId, triggerer.Name) .Write(); Asda2InventoryHandler.SendBuyItemResponse(Asda2BuyItemStatus.Ok, chr, new[] { item, null, null, null, null }); return(true); }
public static bool AddItem(Character chr, Asda2ItemTemplate templ, int amount, Character triggerer) { int num = amount; Asda2PlayerInventory asda2Inventory = chr.Asda2Inventory; Asda2Item asda2Item = (Asda2Item)null; Asda2InventoryError asda2InventoryError = asda2Inventory.TryAdd((int)templ.ItemId, amount, false, ref asda2Item, new Asda2InventoryType?(), (Asda2Item)null); if (asda2InventoryError != Asda2InventoryError.Ok || amount < num) { if (asda2InventoryError != Asda2InventoryError.Ok) { Asda2InventoryHandler.SendItemReplacedResponse(chr.Client, Asda2InventoryError.NotInfoAboutItem, (short)0, (byte)0, 0, (short)0, 0, (byte)0, 0, (short)0, false); } return(false); } Log.Create(Log.Types.ItemOperations, LogSourceType.Character, chr.EntryId) .AddAttribute("source", 0.0, "created_by_gm").AddItemAttributes(asda2Item, "") .AddAttribute("map", (double)chr.MapId, chr.MapId.ToString()) .AddAttribute("x", (double)chr.Asda2Position.X, "") .AddAttribute("y", (double)chr.Asda2Position.Y, "") .AddAttribute("gm", (double)triggerer.EntryId, triggerer.Name).Write(); Asda2InventoryHandler.SendBuyItemResponse(Asda2BuyItemStatus.Ok, chr, new Asda2Item[5] { asda2Item, null, null, null, null }); return(true); }
/// <summary> /// Gives the receiver the money and informs everyone else /// </summary> /// <param name="receiver"></param> /// <param name="amount"></param> protected void SendMoney(Character receiver, uint amount) { Asda2InventoryHandler.SendGoldPickupedResponse(receiver.Money + amount, receiver); receiver.AddMoney(amount); Asda2TitleChecker.OnGoldPickUp(receiver); //LootHandler.SendClearMoney(this); }
public static void SendItemBuyedFromPrivateShopResponse(Character chr, PrivateShopBuyResult status, List <Asda2Item> buyedItems) { Asda2Item[] asda2ItemArray = new Asda2Item[6]; if (buyedItems != null) { for (int index = 0; index < buyedItems.Count; ++index) { asda2ItemArray[index] = buyedItems[index]; } } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemBuyedFromPrivateShop)) { packet.WriteByte((byte)status); if (status == PrivateShopBuyResult.Ok) { packet.WriteInt16(chr.Asda2Inventory.Weight); packet.WriteInt32(chr.Money); packet.WriteByte(buyedItems.Count <Asda2Item>((Func <Asda2Item, bool>)(i => i != null))); for (int index = 0; index < 6; ++index) { Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2ItemArray[index], false); } } chr.Send(packet, false); } }
public static void SendFactionResetedResponse(IRealmClient client, bool ok, Asda2Item item) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.FactionReseted)) { packet.WriteByte(ok ? 1 : 0); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, true); client.Send(packet, false); } }
public static void SendFactionResetedResponse(IRealmClient client, bool ok, Asda2Item item) { using (var packet = new RealmPacketOut(RealmServerOpCode.FactionReseted)) //6705 { packet.WriteByte(ok ? 1 : 0); //{status}default value : 1 Len : 1 Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, true); client.Send(packet); } }
public static void SendMailItemTakedResponse(IRealmClient client, Asda2MailItemTakedStatus status, Asda2Item item) { using (var packet = new RealmPacketOut(RealmServerOpCode.MailItemTaked)) //6625 { packet.WriteByte((byte)status); //{status}default value : 1 Len : 1 packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{weight}default value : 10565 Len : 2 packet.WriteInt32(client.ActiveCharacter.Money); //{money}default value : 5538958 Len : 4 Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); client.Send(packet, addEnd: true); } }
public static void SendMailItemTakedResponse(IRealmClient client, Asda2MailItemTakedStatus status, Asda2Item item) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MailItemTaked)) { packet.WriteByte((byte)status); packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); packet.WriteInt32(client.ActiveCharacter.Money); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); client.Send(packet, true); } }
public static void SendPetNameChangedResponse(IRealmClient client, Asda2PetNamehangeResult status, Asda2PetRecord pet, Asda2Item changeNameItem) { using (var packet = new RealmPacketOut(RealmServerOpCode.PetNameChanged)) //6119 { packet.WriteByte((byte)status); //{status}default value : 1 Len : 1 packet.WriteInt32(client.ActiveCharacter.AccId); //{accId}default value : 355335 Len : 4 packet.WriteInt32(pet == null ? 0 : pet.Guid); //{petId}default value : 54857 Len : 4 packet.WriteFixedAsciiString(pet == null ? "" : pet.Name, 16); //{petName}default value : Len : 21 Asda2InventoryHandler.WriteItemInfoToPacket(packet, changeNameItem, false); client.Send(packet, addEnd: true); } }
public static void SendMailMessageInfoResponse(IRealmClient client, ShowMailMessageStatus status, Asda2MailMessage msg) { using (var packet = new RealmPacketOut(RealmServerOpCode.MailMessageInfo)) //6623 { packet.WriteByte((byte)status); //{status}default value : 1 Len : 1 packet.WriteInt32((int)(msg == null?0:msg.Guid)); //{msgGuid}default value : 379808 Len : 4 packet.WriteInt32(msg == null ? 0 : msg.Gold); //{goldAmount}default value : 5600 Len : 4 Asda2InventoryHandler.WriteItemInfoToPacket(packet, msg == null ? null:msg.Item, true); packet.WriteFixedAsciiString(msg == null ?"":msg.Body, 128); //{message}default value : Len : 128 client.Send(packet, addEnd: true); } }
public static void SendInventoryInfoResponse(IRealmClient client) { var inventory = client.ActiveCharacter.Asda2Inventory; var inventoryPacks = new List <List <Asda2Item> >(); var itemIndex = 0; var allItems = inventory.RegularItems.Where(it => it != null).ToArray(); while (itemIndex < allItems.Length) { inventoryPacks.Add(new List <Asda2Item>(allItems.Skip(itemIndex).Take(9))); itemIndex += 9; } foreach (var inventoryPack in inventoryPacks) { using (var packet = new RealmPacketOut(RealmServerOpCode.RegularInventoryInfo))//4048 { for (int i = 0; i < inventoryPack.Count; i += 1) { var item = inventoryPack[i]; if (item != null) { Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); } //WriteItemDataToPacket(item, packet, 2); } client.Send(packet, addEnd: false); } } inventoryPacks.Clear(); itemIndex = 0; allItems = inventory.ShopItems.Where(it => it != null).ToArray(); while (itemIndex < allItems.Length) { inventoryPacks.Add(new List <Asda2Item>(allItems.Skip(itemIndex).Take(9))); itemIndex += 9; } foreach (var inventoryPack in inventoryPacks) { using (var packet = new RealmPacketOut(RealmServerOpCode.ShopInventoryInfo))//4045 { for (int i = 0; i < inventoryPack.Count; i += 1) { var item = inventoryPack[i]; if (item != null) { Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); } //WriteItemDataToPacket(item, packet, 1); } client.Send(packet, addEnd: false); } } }
public static void SendMailMessageInfoResponse(IRealmClient client, ShowMailMessageStatus status, Asda2MailMessage msg) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MailMessageInfo)) { packet.WriteByte((byte)status); packet.WriteInt32(msg == null ? 0 : (int)msg.Guid); packet.WriteInt32(msg == null ? 0U : msg.Gold); Asda2InventoryHandler.WriteItemInfoToPacket(packet, msg == null ? (Asda2Item)null : msg.Item, true); packet.WriteFixedAsciiString(msg == null ? "" : msg.Body, 128, Locale.Start); client.Send(packet, true); } }
public static void SendVeicheRegisteredResponse(Character chr, Asda2Item veicheItem, RegisterMountStatus status, int veicheId = -1) { using (var packet = new RealmPacketOut(RealmServerOpCode.VeicheRegistered)) //6769 { packet.WriteByte((byte)status); //{status}default value : 1 Len : 1 packet.WriteInt32(chr.AccId); //{accId}default value : 361343 Len : 4 Asda2InventoryHandler.WriteItemInfoToPacket(packet, veicheItem); packet.WriteInt16(chr.Asda2Inventory.Weight); //{invWeight}default value : 11847 Len : 2 packet.WriteInt32(veicheId); //value name : unk4 default value : 56Len : 4 chr.Send(packet); } }
public static void SendUpdateShopItemInfoResponse(IRealmClient client, UseFunctionalItemError status, Asda2Item funcItem = null) { using (var packet = new RealmPacketOut(RealmServerOpCode.UpdateShopItemInfo)) //5451 { packet.WriteByte((byte)status); //{status}default value : 1 Len : 1 packet.WriteInt16(client.ActiveCharacter.SessionId); //{sessId}default value : 57 Len : 2 Asda2InventoryHandler.WriteItemInfoToPacket(packet, funcItem, false); packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{invWeight}default value : 10364 Len : 2 packet.WriteInt32((int)(funcItem == null ? 0 : funcItem.Record == null ? -1 : (funcItem.Record.AuctionEndTime - DateTime.Now).TotalHours)); //value name : unk4 default value : 0Len : 4 packet.WriteInt16(15000); client.Send(packet, addEnd: true); } }
public static void SendPetNameChangedResponse(IRealmClient client, Asda2PetNamehangeResult status, Asda2PetRecord pet, Asda2Item changeNameItem) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.PetNameChanged)) { packet.WriteByte((byte)status); packet.WriteInt32(client.ActiveCharacter.AccId); packet.WriteInt32(pet == null ? 0 : pet.Guid); packet.WriteFixedAsciiString(pet == null ? "" : pet.Name, 16, Locale.Start); Asda2InventoryHandler.WriteItemInfoToPacket(packet, changeNameItem, false); client.Send(packet, true); } }
public static void SendVeicheRegisteredResponse(Character chr, Asda2Item veicheItem, Asda2MountHandler.RegisterMountStatus status, int veicheId = -1) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.VeicheRegistered)) { packet.WriteByte((byte)status); packet.WriteInt32(chr.AccId); Asda2InventoryHandler.WriteItemInfoToPacket(packet, veicheItem, false); packet.WriteInt16(chr.Asda2Inventory.Weight); packet.WriteInt32(veicheId); chr.Send(packet, false); } }
public static void SendDigEndedResponse(IRealmClient client, bool success, Asda2Item item = null) { if (client == null || client.ActiveCharacter == null) { return; } using (var packet = new RealmPacketOut(RealmServerOpCode.DigEnded)) //5431 { packet.WriteByte(success ? 1 : 0); //{status}default value : 1 Len : 1 packet.WriteInt16(client.ActiveCharacter.SessionId); //{sessId}default value : 32 Len : 2 Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); client.ActiveCharacter.SendPacketToArea(packet); } }
public static void SendCharacterRegularEquipmentInfoResponse(IRealmClient client, Character target) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.CharacterRegularEquipmentInfo)) { packet.WriteInt32(target.AccId); for (int index = 0; index < 11; ++index) { Asda2Item asda2Item = target.Asda2Inventory.Equipment[index]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } client.Send(packet, true); } }
public static void SendFaceOrHairChangedResponse(IRealmClient client, bool isHair, bool success = false, Asda2Item usedItem = null) { using (var packet = new RealmPacketOut(RealmServerOpCode.FaceOrHairChanged)) //5471 { packet.WriteByte(success?1:0); //{status}default value : 1 Len : 1 packet.WriteByte(isHair?1:2); //{hair1face2}default value : 2 Len : 1 packet.WriteByte(client.ActiveCharacter.HairStyle); //{hairId}default value : 3 Len : 1 packet.WriteByte(client.ActiveCharacter.HairColor); //{hairColor}default value : 3 Len : 1 packet.WriteByte(client.ActiveCharacter.Record.Face); //{faceId}default value : 105 Len : 1 packet.WriteInt32(client.ActiveCharacter.Asda2Inventory.Weight); //{invWeight}default value : 10202 Len : 4 packet.WriteInt32(client.ActiveCharacter.Money); //{money}default value : 41512584 Len : 4 Asda2InventoryHandler.WriteItemInfoToPacket(packet, usedItem, false); client.Send(packet, addEnd: true); } }
public static void SendUpdateShopItemInfoResponse(IRealmClient client, UseFunctionalItemError status, Asda2Item funcItem = null) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.UpdateShopItemInfo)) { packet.WriteByte((byte)status); packet.WriteInt16(client.ActiveCharacter.SessionId); Asda2InventoryHandler.WriteItemInfoToPacket(packet, funcItem, false); packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); packet.WriteInt32(funcItem == null ? 0 : (funcItem.Record == null ? -1 : (int)(funcItem.Record.AuctionEndTime - DateTime.Now).TotalHours)); packet.WriteInt16(15000); client.Send(packet, true); client.ActiveCharacter.SendPacketToArea(packet, true, true, Locale.Any, new float?()); } }
public static void DismissPlayerFromWarRequest(IRealmClient client, RealmPacketIn packet) { short num = packet.ReadInt16(); if (!client.ActiveCharacter.IsAsda2BattlegroundInProgress) { client.ActiveCharacter.YouAreFuckingCheater("Trying to dissmis someone while not on war.", 50); } else { Character character = client.ActiveCharacter.CurrentBattleGround.GetCharacter(client.ActiveCharacter.Asda2FactionId, (byte)num); if (character == null) { client.ActiveCharacter.SendWarMsg("Target character not found."); } using (RealmPacketOut packet1 = new RealmPacketOut(RealmServerOpCode.DismissPlayerFromWarRequestResult)) { if (character == null || !client.ActiveCharacter.CurrentBattleGround.TryStartDissmisProgress(client.ActiveCharacter, character) || client.ActiveCharacter.Money < 10000U) { packet1.WriteByte(0); packet1.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); Asda2InventoryHandler.WriteItemInfoToPacket(packet1, (Asda2Item)null, false); } else { packet1.WriteByte(1); packet1.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); Asda2InventoryHandler.WriteItemInfoToPacket(packet1, client.ActiveCharacter.Asda2Inventory.GetRegularItem((short)0), false); client.ActiveCharacter.SubtractMoney(10000U); } client.Send(packet1, true); } } }
public static void SendWarEndedOneResponse(IRealmClient client, IEnumerable <Asda2Item> prizeItems) { var items = new Asda2Item[4]; var ind = 0; foreach (var asda2Item in prizeItems) { items[ind++] = asda2Item; } using (var packet = new RealmPacketOut(RealmServerOpCode.WarEndedOne)) //6733 { packet.WriteByte(1); //value name : unk5 default value : 1Len : 1 packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{weight}default value : 10945 Len : 2 packet.WriteInt32(client.ActiveCharacter.Money); //{money}default value : 5514558 Len : 4 for (int i = 0; i < 4; i += 1) { var item = items[i]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); } client.Send(packet, addEnd: true); } }
public static void SendItemDisplayedResponse(Character displayer, Asda2Item item, Character reciever) { if (reciever == null) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemDisplayed)) { packet.WriteInt32(displayer.AccId); packet.WriteFixedAsciiString(displayer.Name, 20, Locale.Start); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); displayer.SendPacketToArea(packet, true, true, Locale.Any, new float?()); } } else { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemDisplayed)) { packet.WriteInt32(displayer.AccId); packet.WriteFixedAsciiString(displayer.Name, 20, Locale.Start); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); reciever.Send(packet, false); } } }
public static void SendWarEndedOneResponse(IRealmClient client, IEnumerable <Asda2Item> prizeItems) { Asda2Item[] asda2ItemArray = new Asda2Item[4]; int num = 0; foreach (Asda2Item prizeItem in prizeItems) { asda2ItemArray[num++] = prizeItem; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WarEndedOne)) { packet.WriteByte(1); packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); packet.WriteInt32(client.ActiveCharacter.Money); for (int index = 0; index < 4; ++index) { Asda2Item asda2Item = asda2ItemArray[index]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } client.Send(packet, true); } }
public static void SendCharacterFullInfoResponse(IRealmClient client, Character target) { AchievementProgressRecord progressRecord = client.ActiveCharacter.Achievements.GetOrCreateProgressRecord(8U); switch (++progressRecord.Counter) { case 500: client.ActiveCharacter.Map.CallDelayed(500, () => client.ActiveCharacter.DiscoverTitle(Asda2TitleId.Curious46)); break; case 1000: client.ActiveCharacter.Map.CallDelayed(500, () => client.ActiveCharacter.GetTitle(Asda2TitleId.Curious46)); break; } progressRecord.SaveAndFlush(); using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.CharacterFullInfo)) { packet.WriteByte(target.Level); packet.WriteByte(target.ProfessionLevel); packet.WriteByte((byte)target.Archetype.ClassId); packet.WriteFixedAsciiString(target.Guild == null ? "" : target.Guild.Name, 17, Locale.Start); packet.WriteSkip(unk9); packet.WriteInt32(target.AccId); packet.WriteByte(3); for (int index = 0; index < 9; ++index) { Asda2Item asda2Item = target.Asda2Inventory.Equipment[index + 11]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } client.Send(packet, true); } }
[PacketHandler(RealmServerOpCode.DismissPlayerFromWar)]//6186 public static void DismissPlayerFromWarRequest(IRealmClient client, RealmPacketIn packet) { var warID = packet.ReadInt16();//default : 6Len : 2 // var charACCiD = packet.ReadInt32();//default : 357812Len : 4 if (!client.ActiveCharacter.IsAsda2BattlegroundInProgress) { client.ActiveCharacter.YouAreFuckingCheater("Trying to dissmis someone while not on war.", 50); return; } var target = client.ActiveCharacter.CurrentBattleGround.GetCharacter(client.ActiveCharacter.Asda2FactionId, (byte)warID); if (target == null) { client.ActiveCharacter.SendWarMsg("Target character not found."); } using (var p = new RealmPacketOut(RealmServerOpCode.DismissPlayerFromWarRequestResult))//6187 { if (target == null || !client.ActiveCharacter.CurrentBattleGround.TryStartDissmisProgress(client.ActiveCharacter, target) || client.ActiveCharacter.Money < 10000) { p.WriteByte(0); //{status}default value : 1 Len : 1 p.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{invWeight}default value : 10665 Len : 2 Asda2InventoryHandler.WriteItemInfoToPacket(p, null, false); } else { p.WriteByte(1); //{status}default value : 1 Len : 1 p.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{invWeight}default value : 10665 Len : 2 Asda2InventoryHandler.WriteItemInfoToPacket(p, client.ActiveCharacter.Asda2Inventory.GetRegularItem(0), false); client.ActiveCharacter.SubtractMoney(10000); } client.Send(p, addEnd: true); } }
public static void SendCraftedResponse(IRealmClient client, bool sucess, byte craftTimes, Asda2Item craftedItem, List <Asda2Item> craftMaterials) { using (var packet = new RealmPacketOut(RealmServerOpCode.Crafted)) //6603 { packet.WriteByte(sucess ? 1 : 0); //{status}default value : 1 Len : 1 packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); //{weight}default value : 11558 Len : 2 packet.WriteByte(client.ActiveCharacter.Record.CraftingLevel); //{lvl}default value : 1 Len : 1 packet.WriteInt32(0); //value name : unk4 default value : 0Len : 4 packet.WriteInt16((short)client.ActiveCharacter.Record.CraftingExp); //{expPrc}default value : 0 Len : 2 packet.WriteInt16(craftTimes); //{craftTimes}default value : 1 Len : 2 Asda2InventoryHandler.WriteItemInfoToPacket(packet, craftedItem, false); for (int i = 0; i < craftMaterials.Count; i++) { var item = craftMaterials.Count <= i ? null : craftMaterials[i]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); } // for (int i = 0; i < 7; i += 1) //{ // var item = craftMaterials.Count <= i ? null : craftMaterials[i]; // Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); //} client.Send(packet); } }
public static void SendInventoryInfoResponse(IRealmClient client) { Asda2PlayerInventory asda2Inventory = client.ActiveCharacter.Asda2Inventory; List <List <Asda2Item> > asda2ItemListList = new List <List <Asda2Item> >(); int count1 = 0; Asda2Item[] array1 = asda2Inventory.RegularItems .Where(it => it != null).ToArray(); while (count1 < array1.Length) { asda2ItemListList.Add(new List <Asda2Item>(array1.Skip(count1) .Take(9))); count1 += 9; } foreach (List <Asda2Item> asda2ItemList in asda2ItemListList) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.RegularInventoryInfo)) { for (int index = 0; index < asda2ItemList.Count; ++index) { Asda2Item asda2Item = asda2ItemList[index]; if (asda2Item != null) { Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } } client.Send(packet, false); } } asda2ItemListList.Clear(); int count2 = 0; Asda2Item[] array2 = asda2Inventory.ShopItems .Where(it => it != null).ToArray(); while (count2 < array2.Length) { asda2ItemListList.Add(new List <Asda2Item>(array2.Skip(count2) .Take(9))); count2 += 9; } foreach (List <Asda2Item> asda2ItemList in asda2ItemListList) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ShopInventoryInfo)) { for (int index = 0; index < asda2ItemList.Count; ++index) { Asda2Item asda2Item = asda2ItemList[index]; if (asda2Item != null) { Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } } client.Send(packet, false); } } }
public static void SendEnterGameResposeResponse(IRealmClient client) { if (client.Account == null) { return; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.EnterGameRespose)) { RealmAccount account = client.Account; Character activeCharacter = account.ActiveCharacter; if (activeCharacter == null) { return; } packet.WriteInt32(account.AccountId); packet.WriteFixedAsciiString(activeCharacter.Name, 20, Locale.Start); packet.WriteInt16(activeCharacter.Record.CharNum); packet.WriteByte(activeCharacter.Record.Zodiac); packet.WriteByte((byte)activeCharacter.Gender); packet.WriteByte(activeCharacter.ProfessionLevel); packet.WriteByte((byte)activeCharacter.Archetype.ClassId); packet.WriteByte(activeCharacter.Level); packet.WriteUInt32(activeCharacter.Experience); packet.WriteInt32(0); packet.WriteInt16(activeCharacter.Spells.AvalibleSkillPoints); packet.WriteInt16(0); packet.WriteByte(0); packet.WriteInt16(15000); packet.WriteInt16(1000); packet.WriteInt64(0L); packet.WriteByte(0); packet.WriteByte(3); packet.WriteInt16((client.ActiveCharacter.Record.PremiumWarehouseBagsCount + 1) * 30); packet.WriteInt16( client.ActiveCharacter.Asda2Inventory.WarehouseItems.Count( i => i != null)); packet.WriteInt16((client.ActiveCharacter.Record.PremiumAvatarWarehouseBagsCount + 1) * 30); packet.WriteInt16( client.ActiveCharacter.Asda2Inventory.AvatarWarehouseItems .Count(i => i != null)); packet.WriteByte(0); packet.WriteByte(1); packet.WriteInt16(-1); packet.WriteInt16(0); packet.WriteByte(activeCharacter.Record.Zodiac); packet.WriteByte(activeCharacter.HairStyle); packet.WriteByte(activeCharacter.HairColor); packet.WriteByte(activeCharacter.Facial); packet.WriteInt32(activeCharacter.Health); packet.WriteInt16(activeCharacter.Power); packet.WriteInt32(activeCharacter.MaxHealth); packet.WriteInt16(activeCharacter.MaxPower); packet.WriteInt16((short)activeCharacter.MinDamage); packet.WriteInt16((short)activeCharacter.MaxDamage); packet.WriteInt16((short)activeCharacter.RangedAttackPower); packet.WriteInt16((short)activeCharacter.RangedAttackPower); packet.WriteInt16(activeCharacter.ArcaneResist); packet.WriteInt16(activeCharacter.Defense); packet.WriteInt16(activeCharacter.Defense); packet.WriteInt32(activeCharacter.BlockValue); packet.WriteInt32(activeCharacter.BlockValue); packet.WriteInt16(15); packet.WriteInt16(7); packet.WriteInt16(4); packet.WriteSkip(unk51); packet.WriteSkip(activeCharacter.SettingsFlags); packet.WriteInt32(activeCharacter.AvatarMask); for (int index = 11; index < 20; ++index) { Asda2Item asda2Item = client.ActiveCharacter.Asda2Inventory.Equipment[index]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } client.Send(packet, false); } }