private static void HandleNewBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); int beautyItemId = packet.ReadInt(); EquipColor equipColor = packet.Read <EquipColor>(); Item beautyItem = new Item(beautyItemId) { Color = equipColor, IsTemplate = false, IsEquipped = true, OwnerCharacterId = session.Player.CharacterId, OwnerCharacterName = session.Player.Name }; BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(session.Player.ShopId); if (useVoucher) { if (!PayWithVoucher(session, beautyShop)) { return; } } else { if (!PayWithShopItemTokenCost(session, beautyItemId, beautyShop)) { return; } } ModifyBeauty(session, packet, beautyItem); }
// Make a copy of item public Item(Item other) { Id = other.Id; InventoryTab = other.InventoryTab; ItemSlot = other.ItemSlot; GemSlot = other.GemSlot; Rarity = other.Rarity; SlotMax = other.SlotMax; PlayCount = other.PlayCount; Content = other.Content; Uid = other.Uid; Slot = other.Slot; Amount = other.Amount; CreationTime = other.CreationTime; ExpiryTime = other.ExpiryTime; TimesAttributesChanged = other.TimesAttributesChanged; IsLocked = other.IsLocked; UnlockTime = other.UnlockTime; RemainingGlamorForges = other.RemainingGlamorForges; Enchants = other.Enchants; EnchantExp = other.EnchantExp; CanRepackage = other.CanRepackage; Charges = other.Charges; TransferFlag = other.TransferFlag; RemainingTrades = other.RemainingTrades; PairedCharacterId = other.PairedCharacterId; PairedCharacterName = other.PairedCharacterName; Owner = other.Owner; Color = other.Color; HairD = other.HairD; AppearanceFlag = other.AppearanceFlag; Stats = new ItemStats(other.Stats); }
private static void HandleModifyExistingBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); long beautyItemUid = packet.ReadLong(); EquipColor equipColor = packet.Read <EquipColor>(); Item beautyItem = session.Player.Inventory.GetEquippedItem(beautyItemUid); if (beautyItem.ItemSlot is ItemSlot.CP) // This should only work with the mirror shop { HatData hatData = packet.Read <HatData>(); beautyItem.HatData = hatData; session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.Player.FieldPlayer, beautyItem)); return; } BeautyShop beautyShop = DatabaseManager.BeautyShops.FindById(session.Player.ShopId); if (beautyShop is null) { return; } if (!HandleShopPay(session, beautyShop, useVoucher)) { return; } beautyItem.Color = equipColor; ModifyBeauty(session, packet, beautyItem); }
public Item(int id) { Id = id; Level = ItemMetadataStorage.GetLevel(id); Uid = GuidGenerator.Long(); InventoryTab = ItemMetadataStorage.GetTab(id); ItemSlot = ItemMetadataStorage.GetSlot(id); GemSlot = ItemMetadataStorage.GetGem(id); Rarity = ItemMetadataStorage.GetRarity(id); StackLimit = ItemMetadataStorage.GetStackLimit(id); EnableBreak = ItemMetadataStorage.GetEnableBreak(id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(id); IsDress = ItemMetadataStorage.GetIsDress(id); IsTemplate = ItemMetadataStorage.GetIsTemplate(id); IsCustomScore = ItemMetadataStorage.GetIsCustomScore(id); Gender = ItemMetadataStorage.GetGender(id); RemainingGlamorForges = ItemExtractionMetadataStorage.GetExtractionCount(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); FileName = ItemMetadataStorage.GetFileName(id); SkillId = ItemMetadataStorage.GetSkillID(id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(id); Content = ItemMetadataStorage.GetContent(id); Function = ItemMetadataStorage.GetFunction(id); Tag = ItemMetadataStorage.GetTag(id); ShopID = ItemMetadataStorage.GetShopID(id); Slot = -1; Amount = 1; Score = new MusicScore(); Stats = new ItemStats(id, Rarity, Level); Color = ItemMetadataStorage.GetEquipColor(id); CanRepackage = true; // If false, item becomes untradable }
public static void ChangeFace(GameSession session, int faceId, out Item previousFace, out Item newFace) { Random random = Random.Shared; // Grab random preset color ColorPaletteMetadata palette = ColorPaletteMetadataStorage.GetMetadata(1); // pick from palette 2. Seems like it's the correct palette for basic face colors int indexColor = random.Next(palette.DefaultColors.Count); MixedColor color = palette.DefaultColors[indexColor]; newFace = new(faceId) { Color = EquipColor.Argb(color, indexColor, palette.PaletteId), IsEquipped = true, OwnerCharacterId = session.Player.CharacterId, OwnerCharacterName = session.Player.Name }; Dictionary <ItemSlot, Item> cosmetics = session.Player.Inventory.Cosmetics; //Remove old face if (cosmetics.Remove(ItemSlot.FA, out previousFace)) { previousFace.Slot = -1; DatabaseManager.Items.Delete(previousFace.Uid); session.FieldManager.BroadcastPacket(EquipmentPacket.UnequipItem(session.Player.FieldPlayer, previousFace)); } cosmetics[ItemSlot.FA] = newFace; } }
public static Item TutorialBow(Player owner) { // bow 15100216 // [longsword] Tairen Royal Longsword - 13200309 // [shield] Tairen Royal Shield - 14100279 // [greatsword] Tairen Royal Greatsword - 15000313 // [scepter] Tairen Royal Scepter - 13300308 // [codex] Tairen Royal Codex - 14000270 // [staff] Tairen Royal Staff - 15200312 // [cannon] Tairen Royal Cannon - 15300308 // [bow] Tairen Royal Bow - 15100305 // [dagger] Tairen Royal Knife - 13100314 // [star] Tairen Royal Star - 13400307 // [blade] Tairen Royal Blade - 15400294 // [knuckles] Tairen Royal Knuckles - 15500226 // [orb] Tairen Royal Spirit - 15600228 return(new Item(15100216) { Uid = 3430503306390578751, // Make sure its unique! If the UID is equipped, it will say "Equipped" on the item in your inventory Rarity = 1, CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), Owner = owner, Color = EquipColor.Custom(MixedColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0xBC, 0xBC, 0xB3), Maple2Storage.Types.Color.Argb(0xFF, 0xC3, 0xDA, 0x3D), Maple2Storage.Types.Color.Argb(0xFF, 0xB0, 0xB4, 0xBA) ), 10, 0x13 ), TransferFlag = TransferFlag.Binds | TransferFlag.Splitable, }); }
private static void HandleModifyExistingBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); long beautyItemUid = packet.ReadLong(); EquipColor equipColor = packet.Read <EquipColor>(); Item beautyItem = session.Player.GetEquippedItem(beautyItemUid); if (beautyItem.ItemSlot == ItemSlot.CP) { HatData hatData = packet.Read <HatData>(); beautyItem.HatData = hatData; session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, beautyItem)); return; } BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(session.Player.ShopId); if (!HandleShopPay(session, beautyShop, useVoucher)) { return; } beautyItem.Color = equipColor; ModifyBeauty(session, packet, beautyItem); }
public static Item TutorialBow() { return(new Item(15100216) { Uid = 3430503306390578751, // Make sure its unique! If the UID is equipped, it will say "Equipped" on the item in your inventory Rarity = 1, CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), //Owner = owner, Color = EquipColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0xBC, 0xBC, 0xB3), Maple2Storage.Types.Color.Argb(0xFF, 0xC3, 0xDA, 0x3D), Maple2Storage.Types.Color.Argb(0xFF, 0xB0, 0xB4, 0xBA), 0x13 ), AppearanceFlag = 0x5, Stats = new ItemStats { BasicAttributes = { ItemStat.Of(ItemAttribute.CriticalRate, 12), ItemStat.Of(ItemAttribute.MinWeaponAtk, 15), ItemStat.Of(ItemAttribute.MaxWeaponAtk, 17) } }, Transfer = TransferFlag.Binds | TransferFlag.Splitable, }); }
private static void HandleNewBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); int beautyItemId = packet.ReadInt(); EquipColor equipColor = packet.Read <EquipColor>(); Item beautyItem = new Item(beautyItemId) { Color = equipColor, IsTemplate = false }; BeautyMetadata beautyShop = BeautyMetadataStorage.GetCosmeticShopByItemId(beautyItem.Id); if (useVoucher) { if (!PayWithVoucher(session, beautyShop)) { return; } } else { if (!PayWithShopItemTokenCost(session, beautyItemId)) { return; } } ModifyBeauty(session, packet, beautyItem); }
public Item(int id, bool saveToDatabase = true) { Id = id; SetMetadataValues(); Name = ItemMetadataStorage.GetName(id); Level = ItemMetadataStorage.GetLevel(id); ItemSlot = ItemMetadataStorage.GetSlot(id); IsTemplate = ItemMetadataStorage.GetIsTemplate(id); if (GemSlot == GemSlot.TRANS) { TransparencyBadgeBools = new byte[10]; } Rarity = ItemMetadataStorage.GetRarity(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); Color = ItemMetadataStorage.GetEquipColor(id); CreationTime = TimeInfo.Now(); RemainingGlamorForges = ItemExtractionMetadataStorage.GetExtractionCount(id); Slot = -1; Amount = 1; Score = new(); Stats = new(id, Rarity, ItemSlot, Level); if (saveToDatabase) { Uid = DatabaseManager.Items.Insert(this); } }
private static void HandleRandomHair(GameSession session, PacketReader packet) { int shopId = packet.ReadInt(); bool useVoucher = packet.ReadBool(); BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(shopId); List <BeautyItem> beautyItems = BeautyMetadataStorage.GetGenderItems(beautyShop.ShopId, session.Player.Gender); if (!HandleShopPay(session, beautyShop, useVoucher)) { return; } // Grab random hair Random random = new Random(); int indexHair = random.Next(beautyItems.Count); BeautyItem chosenHair = beautyItems[indexHair]; //Grab a preset hair and length of hair ItemMetadata beautyItemData = ItemMetadataStorage.GetMetadata(chosenHair.ItemId); int indexPreset = random.Next(beautyItemData.HairPresets.Count); HairPresets chosenPreset = beautyItemData.HairPresets[indexPreset]; //Grab random front hair length double chosenFrontLength = random.NextDouble() * (beautyItemData.HairPresets[indexPreset].MaxScale - beautyItemData.HairPresets[indexPreset].MinScale) + beautyItemData.HairPresets[indexPreset].MinScale; //Grab random back hair length double chosenBackLength = random.NextDouble() * (beautyItemData.HairPresets[indexPreset].MaxScale - beautyItemData.HairPresets[indexPreset].MinScale) + beautyItemData.HairPresets[indexPreset].MinScale; // Grab random preset color ColorPaletteMetadata palette = ColorPaletteMetadataStorage.GetMetadata(2); // pick from palette 2. Seems like it's the correct palette for basic hair colors int indexColor = random.Next(palette.DefaultColors.Count); MixedColor color = palette.DefaultColors[indexColor]; Dictionary <ItemSlot, Item> equippedInventory = session.Player.GetEquippedInventory(InventoryTab.Gear); Item newHair = new Item(chosenHair.ItemId) { Color = EquipColor.Argb(color, indexColor, palette.PaletteId), HairD = new HairData((float)chosenBackLength, (float)chosenFrontLength, chosenPreset.BackPositionCoord, chosenPreset.BackPositionRotation, chosenPreset.FrontPositionCoord, chosenPreset.FrontPositionRotation), IsTemplate = false }; //Remove old hair if (session.Player.Equips.Remove(ItemSlot.HR, out Item previousHair)) { previousHair.Slot = -1; session.Player.HairInventory.RandomHair = previousHair; // store the previous hair session.FieldManager.BroadcastPacket(EquipmentPacket.UnequipItem(session.FieldPlayer, previousHair)); } equippedInventory[ItemSlot.HR] = newHair; session.FieldManager.BroadcastPacket(EquipmentPacket.EquipItem(session.FieldPlayer, newHair, ItemSlot.HR)); session.Send(BeautyPacket.RandomHairOption(previousHair, newHair)); }
private static void HandleCreate(LoginSession session, PacketReader packet) { Gender gender = (Gender)packet.ReadByte(); Job job = (Job)packet.ReadShort(); string name = packet.ReadUnicodeString(); SkinColor skinColor = packet.Read <SkinColor>(); packet.Skip(2); if (DatabaseManager.Characters.NameExists(name)) { session.Send(ResponseCharCreatePacket.NameTaken()); return; } Account account = DatabaseManager.Accounts.FindById(session.AccountId); Player newCharacter = new(account, name, gender, job, skinColor); session.CharacterId = newCharacter.CharacterId; byte equipCount = packet.ReadByte(); for (int i = 0; i < equipCount; i++) { int id = packet.ReadInt(); string typeStr = packet.ReadUnicodeString(); if (!Enum.TryParse(typeStr, out ItemSlot type)) { throw new ArgumentException($"Unknown equip type: {typeStr}"); } EquipColor equipColor = packet.Read <EquipColor>(); switch (type) { case ItemSlot.HR: // Hair // Hair Length/Position float backLength = packet.ReadFloat(); CoordF backPositionCoord = packet.Read <CoordF>(); CoordF backPositionRotation = packet.Read <CoordF>(); float frontLength = packet.ReadFloat(); CoordF frontPositionCoord = packet.Read <CoordF>(); CoordF frontPositionRotation = packet.Read <CoordF>(); if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.HR, new(id) { Color = equipColor, HairData = new(backLength, frontLength, backPositionCoord, backPositionRotation, frontPositionCoord, frontPositionRotation), IsTemplate = false, IsEquipped = true }); break;
private static void HandleDyeItem(GameSession session, PacketReader packet) { BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(506); byte itemCount = packet.ReadByte(); short[] quantity = new short[itemCount]; bool[] useVoucher = new bool[itemCount]; byte[] unk1 = new byte[itemCount]; long[] unk2 = new long[itemCount]; int[] unk3 = new int[itemCount]; long[] itemUid = new long[itemCount]; int[] itemId = new int[itemCount]; EquipColor[] equipColor = new EquipColor[itemCount]; int[] paletteId = new int[itemCount]; CoordF[] hatXPosition = new CoordF[itemCount]; CoordF[] hatYPosition = new CoordF[itemCount]; CoordF[] hatZPosition = new CoordF[itemCount]; CoordF[] hatRotation = new CoordF[itemCount]; int[] hatScale = new int[itemCount]; for (int i = 0; i < itemCount; i++) { quantity[i] = packet.ReadShort(); // should always be one useVoucher[i] = packet.ReadBool(); unk1[i] = packet.ReadByte(); // just 0 unk2[i] = packet.ReadLong(); // just 0 unk3[i] = packet.ReadInt(); // also 0 itemUid[i] = packet.ReadLong(); itemId[i] = packet.ReadInt(); equipColor[i] = packet.Read <EquipColor>(); paletteId[i] = packet.ReadInt(); Item item = session.Player.GetEquippedItem(itemUid[i]); if (item == null) { return; } if (item.ItemSlot == ItemSlot.CP) { hatXPosition[i] = packet.Read <CoordF>(); // TODO: implement correct hat positioning hatYPosition[i] = packet.Read <CoordF>(); hatZPosition[i] = packet.Read <CoordF>(); hatRotation[i] = packet.Read <CoordF>(); hatScale[i] = packet.ReadInt(); } if (!HandleShopPay(session, beautyShop, useVoucher[i])) { return; } item.Color = equipColor[i]; session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, item)); } }
// Make a copy of item public Item(Item other) { Id = other.Id; Name = other.Name; Level = other.Level; Gender = other.Gender; InventoryTab = other.InventoryTab; ItemSlot = other.ItemSlot; GemSlot = other.GemSlot; Rarity = other.Rarity; StackLimit = other.StackLimit; EnableBreak = other.EnableBreak; IsTwoHand = other.IsTwoHand; IsDress = other.IsDress; IsTemplate = other.IsTemplate; IsCustomScore = other.IsCustomScore; PlayCount = other.PlayCount; FileName = other.FileName; Function = other.Function; Uid = other.Uid; Slot = other.Slot; Amount = other.Amount; CreationTime = other.CreationTime; ExpiryTime = other.ExpiryTime; TimesAttributesChanged = other.TimesAttributesChanged; IsLocked = other.IsLocked; UnlockTime = other.UnlockTime; RemainingGlamorForges = other.RemainingGlamorForges; GachaDismantleId = other.GachaDismantleId; Enchants = other.Enchants; EnchantExp = other.EnchantExp; RepackageCount = other.RepackageCount; Charges = other.Charges; TransferFlag = other.TransferFlag; RemainingTrades = other.RemainingTrades; PairedCharacterId = other.PairedCharacterId; PairedCharacterName = other.PairedCharacterName; PetSkinBadgeId = other.PetSkinBadgeId; RecommendJobs = other.RecommendJobs; OwnerCharacterId = other.OwnerCharacterId; OwnerCharacterName = other.OwnerCharacterName; InventoryId = other.InventoryId; BankInventoryId = other.BankInventoryId; BlackMarketCategory = other.BlackMarketCategory; Category = other.Category; HomeId = other.HomeId; Color = other.Color; HairData = other.HairData; HatData = other.HatData; Score = new(); Stats = new(other.Stats); UGC = other.UGC; }
public static Item ShoesMale() { return(new Item(11700852) { Uid = 2754959794416496484, CreationTime = 1558494660, Color = EquipColor.Custom(MixedColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x69, 0xB5), Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x85, 0xDB), Maple2Storage.Types.Color.Argb(0xFF, 0x48, 0x5E, 0xA8)), 10, 4 ), }); }
public static Item FaceMale() { return(new Item(10300051) { Uid = 2754959794416496483, CreationTime = 1558494660, Color = EquipColor.Custom(MixedColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x7E, 0xF3, 0xF8), Maple2Storage.Types.Color.Argb(0xFF, 0xF7, 0xE3, 0xE3), Maple2Storage.Types.Color.Argb(0xFF, 0x14, 0x07, 0x02)), 10, 0 ), }); }
public static Item CloathMale() { return(new Item(12200398) { Uid = 2754959794416496484, CreationTime = 1558494660, Color = EquipColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x69, 0xB5), Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x85, 0xDB), Maple2Storage.Types.Color.Argb(0xFF, 0x48, 0x5E, 0xA8), 4 ), }); }
// MALE ITEMS public static Item HairMale() { return(new Item(10200003) { Uid = 2867972925711604442, CreationTime = 1565575851, Color = EquipColor.Custom(MixedColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x69, 0xB5), Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x85, 0xDB), Maple2Storage.Types.Color.Argb(0xFF, 0x48, 0x5E, 0xA8)), 10, 4 ), HairD = new HairData(0.3f, 0.3f, new CoordF(), new CoordF(), new CoordF(), new CoordF()), }); }
public static Item Face() { return(new Item(10300004) { Uid = 2754959794416496483, CreationTime = 1558494660, Color = EquipColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0xB5, 0x24, 0x29), Maple2Storage.Types.Color.Argb(0xFF, 0xF7, 0xE3, 0xE3), Maple2Storage.Types.Color.Argb(0xFF, 0x14, 0x07, 0x02), 0 ), AppearanceFlag = 3, }); }
private static void HandleDyeItem(GameSession session, PacketReader packet) { BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(506); byte itemCount = packet.ReadByte(); short[] quantity = new short[itemCount]; bool[] useVoucher = new bool[itemCount]; byte[] unk1 = new byte[itemCount]; long[] unk2 = new long[itemCount]; int[] unk3 = new int[itemCount]; long[] itemUid = new long[itemCount]; int[] itemId = new int[itemCount]; EquipColor[] equipColor = new EquipColor[itemCount]; HatData[] hatData = new HatData[itemCount]; for (int i = 0; i < itemCount; i++) { quantity[i] = packet.ReadShort(); // should always be one useVoucher[i] = packet.ReadBool(); unk1[i] = packet.ReadByte(); // just 0 unk2[i] = packet.ReadLong(); // just 0 unk3[i] = packet.ReadInt(); // also 0 itemUid[i] = packet.ReadLong(); itemId[i] = packet.ReadInt(); equipColor[i] = packet.Read <EquipColor>(); Item item = session.Player.GetEquippedItem(itemUid[i]); if (item == null) { return; } if (!HandleShopPay(session, beautyShop, useVoucher[i])) { return; } if (item.ItemSlot == ItemSlot.CP) { hatData[i] = packet.Read <HatData>(); item.HatData = hatData[i]; } item.Color = equipColor[i]; Console.WriteLine(item.Color); session.FieldManager.BroadcastPacket(ItemExtraDataPacket.Update(session.FieldPlayer, item)); } }
protected override List <ColorPaletteMetadata> Parse() { List <ColorPaletteMetadata> palette = new List <ColorPaletteMetadata>(); foreach (PackFileEntry entry in Resources.XmlFiles) { if (!entry.Name.StartsWith("table/colorpalette")) { continue; } XmlDocument document = Resources.XmlMemFile.GetDocument(entry.FileHeader); foreach (XmlNode node in document.DocumentElement.ChildNodes) { ColorPaletteMetadata metadata = new ColorPaletteMetadata(); if (node.Name == "colorPalette") { metadata.PaletteId = int.Parse(node.Attributes["id"].Value); foreach (XmlNode colorNode in node) { int index = int.Parse(colorNode.Attributes["colorSN"].Value); int primary = Convert.ToInt32(colorNode.Attributes["ch0"].Value, 16); byte[] primaryBytes = BitConverter.GetBytes(primary); Array.Reverse(primaryBytes); int secondary = Convert.ToInt32(colorNode.Attributes["ch1"].Value, 16); byte[] secondaryBytes = BitConverter.GetBytes(secondary); Array.Reverse(secondaryBytes); int tertiary = Convert.ToInt32(colorNode.Attributes["ch2"].Value, 16); byte[] tertiaryBytes = BitConverter.GetBytes(tertiary); Array.Reverse(tertiaryBytes); EquipColor newColor = EquipColor.Custom( Color.Argb(primaryBytes[0], primaryBytes[1], primaryBytes[2], primaryBytes[3]), Color.Argb(secondaryBytes[0], secondaryBytes[1], secondaryBytes[2], secondaryBytes[3]), Color.Argb(tertiaryBytes[0], tertiaryBytes[1], tertiaryBytes[2], tertiaryBytes[3]), index); metadata.DefaultColors.Add(newColor); } } palette.Add(metadata); } } return(palette); }
public static Item Hair() { return(new Item(10200148) { Uid = 2867972925711604442, CreationTime = 1565575851, Color = EquipColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x7E, 0xCC, 0xF7), Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x85, 0xDB), Maple2Storage.Types.Color.Argb(0xFF, 0x48, 0x5E, 0xA8), 15 ), HairD = new HairData(0.3f, 0.3f, new CoordF(), new CoordF(), new CoordF(), new CoordF()), AppearanceFlag = 2, }); }
// MALE ITEMS public static Item HairMale() { return(new Item(10200003) { Uid = 2867972925711604442, CreationTime = 1565575851, Color = EquipColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x69, 0xB5), Maple2Storage.Types.Color.Argb(0xFF, 0x4C, 0x85, 0xDB), Maple2Storage.Types.Color.Argb(0xFF, 0x48, 0x5E, 0xA8), 4 ), HairD = new HairData(0.3f, 0.3f, new byte[24], new byte[24]), AppearanceFlag = 2, }); }
public static Item DefaultCodex(Player owner) { return(new Item(14000270) { Uid = 3430503306390578751, // Make sure its unique! If the UID is equipped, it will say "Equipped" on the item in your inventory Rarity = 1, CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), Owner = owner, Color = EquipColor.Custom(MixedColor.Custom( Maple2Storage.Types.Color.Argb(0xFF, 0xBC, 0xBC, 0xB3), Maple2Storage.Types.Color.Argb(0xFF, 0xC3, 0xDA, 0x3D), Maple2Storage.Types.Color.Argb(0xFF, 0xB0, 0xB4, 0xBA)), 10, 0x13 ), TransferFlag = TransferFlag.Binds | TransferFlag.Splitable, }); }
public Item(int id) { Id = id; SetMetadataValues(id); Level = ItemMetadataStorage.GetLevel(id); ItemSlot = ItemMetadataStorage.GetSlot(id); Rarity = ItemMetadataStorage.GetRarity(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); Color = ItemMetadataStorage.GetEquipColor(id); CreationTime = DateTimeOffset.Now.ToUnixTimeSeconds(); RemainingGlamorForges = ItemExtractionMetadataStorage.GetExtractionCount(id); Slot = -1; Amount = 1; Score = new MusicScore(); Stats = new ItemStats(id, Rarity, Level, IsTwoHand); CanRepackage = true; // If false, item becomes untradable Uid = DatabaseManager.AddItem(this); }
public static void ChangeHair(GameSession session, int hairId, out Item previousHair, out Item newHair) { Random random = Random.Shared; //Grab a preset hair and length of hair ItemCustomizeMetadata customize = ItemMetadataStorage.GetMetadata(hairId).Customize; int indexPreset = random.Next(customize.HairPresets.Count); HairPresets chosenPreset = customize.HairPresets[indexPreset]; //Grab random front hair length double chosenFrontLength = random.NextDouble() * (customize.HairPresets[indexPreset].MaxScale - customize.HairPresets[indexPreset].MinScale) + customize.HairPresets[indexPreset].MinScale; //Grab random back hair length double chosenBackLength = random.NextDouble() * (customize.HairPresets[indexPreset].MaxScale - customize.HairPresets[indexPreset].MinScale) + customize.HairPresets[indexPreset].MinScale; // Grab random preset color ColorPaletteMetadata palette = ColorPaletteMetadataStorage.GetMetadata(2); // pick from palette 2. Seems like it's the correct palette for basic hair colors int indexColor = random.Next(palette.DefaultColors.Count); MixedColor color = palette.DefaultColors[indexColor]; newHair = new(hairId) { Color = EquipColor.Argb(color, indexColor, palette.PaletteId), HairData = new((float)chosenBackLength, (float)chosenFrontLength, chosenPreset.BackPositionCoord, chosenPreset.BackPositionRotation, chosenPreset.FrontPositionCoord, chosenPreset.FrontPositionRotation), IsEquipped = true, OwnerCharacterId = session.Player.CharacterId, OwnerCharacterName = session.Player.Name }; Dictionary <ItemSlot, Item> cosmetics = session.Player.Inventory.Cosmetics; //Remove old hair if (cosmetics.Remove(ItemSlot.HR, out previousHair)) { previousHair.Slot = -1; session.Player.HairInventory.RandomHair = previousHair; // store the previous hair DatabaseManager.Items.Delete(previousHair.Uid); session.FieldManager.BroadcastPacket(EquipmentPacket.UnequipItem(session.Player.FieldPlayer, previousHair)); } cosmetics[ItemSlot.HR] = newHair; }
// Make a copy of item public Item(Item other) { Id = other.Id; InventoryTab = other.InventoryTab; ItemSlot = other.ItemSlot; GemSlot = other.GemSlot; Rarity = other.Rarity; StackLimit = other.StackLimit; EnableBreak = other.EnableBreak; IsTwoHand = other.IsTwoHand; IsDress = other.IsDress; IsTemplate = other.IsTemplate; PlayCount = other.PlayCount; FileName = other.FileName; Content = other.Content; FunctionName = other.FunctionName; FunctionId = other.FunctionId; FunctionDuration = other.FunctionDuration; FunctionFieldId = other.FunctionFieldId; FunctionCapacity = other.FunctionCapacity; FunctionTargetLevel = other.FunctionTargetLevel; Uid = other.Uid; Slot = other.Slot; Amount = other.Amount; CreationTime = other.CreationTime; ExpiryTime = other.ExpiryTime; TimesAttributesChanged = other.TimesAttributesChanged; IsLocked = other.IsLocked; UnlockTime = other.UnlockTime; RemainingGlamorForges = other.RemainingGlamorForges; Enchants = other.Enchants; EnchantExp = other.EnchantExp; CanRepackage = other.CanRepackage; Charges = other.Charges; TransferFlag = other.TransferFlag; RemainingTrades = other.RemainingTrades; PairedCharacterId = other.PairedCharacterId; PairedCharacterName = other.PairedCharacterName; Owner = other.Owner; Color = other.Color; HairD = other.HairD; AppearanceFlag = other.AppearanceFlag; Stats = new ItemStats(other.Stats); }
// Make a copy of item public Item(Item other) { Id = other.Id; InventoryTab = other.InventoryTab; ItemSlot = other.ItemSlot; GemSlot = other.GemSlot; Rarity = other.Rarity; StackLimit = other.StackLimit; EnableBreak = other.EnableBreak; IsTwoHand = other.IsTwoHand; IsDress = other.IsDress; IsTemplate = other.IsTemplate; IsCustomScore = other.IsCustomScore; PlayCount = other.PlayCount; FileName = other.FileName; Content = other.Content; Function = other.Function; AdBalloon = other.AdBalloon; Uid = other.Uid; Slot = other.Slot; Amount = other.Amount; CreationTime = other.CreationTime; ExpiryTime = other.ExpiryTime; TimesAttributesChanged = other.TimesAttributesChanged; IsLocked = other.IsLocked; UnlockTime = other.UnlockTime; RemainingGlamorForges = other.RemainingGlamorForges; GachaDismantleId = other.GachaDismantleId; Enchants = other.Enchants; EnchantExp = other.EnchantExp; CanRepackage = other.CanRepackage; Charges = other.Charges; TransferFlag = other.TransferFlag; RemainingTrades = other.RemainingTrades; PairedCharacterId = other.PairedCharacterId; PairedCharacterName = other.PairedCharacterName; PetSkinBadgeId = other.PetSkinBadgeId; Owner = other.Owner; Color = other.Color; HairData = other.HairData; HatData = other.HatData; Score = new MusicScore(); Stats = new ItemStats(other.Stats); }
private static void HandleModifyExistingBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); long beautyItemUid = packet.ReadLong(); EquipColor equipColor = packet.Read <EquipColor>(); int colorIndex = packet.ReadInt(); Item beautyItem = session.Player.Equips.FirstOrDefault(x => x.Value.Uid == beautyItemUid).Value; BeautyMetadata beautyShop = BeautyMetadataStorage.GetCosmeticShopByItemId(beautyItem.Id); if (!HandleShopPay(session, beautyShop, useVoucher)) { return; } beautyItem.Color = equipColor; ModifyBeauty(session, packet, beautyItem); }
private static void HandleNewBeauty(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); bool useVoucher = packet.ReadBool(); int beautyItemId = packet.ReadInt(); EquipColor equipColor = packet.Read <EquipColor>(); Item beautyItem = new(beautyItemId) { Color = equipColor, IsEquipped = true, OwnerCharacterId = session.Player.CharacterId, OwnerCharacterName = session.Player.Name }; BeautyShop beautyShop = DatabaseManager.BeautyShops.FindById(session.Player.ShopId); if (beautyShop is null) { return; } if (useVoucher) { if (!PayWithVoucher(session, beautyShop)) { return; } } else { if (!PayWithShopItemTokenCost(session, beautyItemId, beautyShop)) { return; } } ModifyBeauty(session, packet, beautyItem); }