From 533777fb3a35d815c84c0d41159b7e836fc1a8e1 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 19 Jan 2022 22:11:25 -0500 Subject: [PATCH] Changes --- Map Server/Actors/Chara/Character.cs | 29 ++++++++++++++++++++++++ Map Server/Actors/Chara/Player/Player.cs | 28 ----------------------- Map Server/Lua/LuaUtils.cs | 13 +++++++++-- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Map Server/Actors/Chara/Character.cs b/Map Server/Actors/Chara/Character.cs index 20a7caea..4c60a1ca 100644 --- a/Map Server/Actors/Chara/Character.cs +++ b/Map Server/Actors/Chara/Character.cs @@ -1182,6 +1182,35 @@ namespace Meteor.Map.Actors return targetFind.GetTargets(); } + public void GraphicChange(uint slot, uint graphicId) + { + appearanceIds[slot] = graphicId; + } + + public void GraphicChange(uint slot, uint weapId, uint equipId, uint variantId, uint colorId) + { + + uint mixedVariantId; + + if (weapId == 0) + mixedVariantId = ((variantId & 0x1F) << 5) | colorId; + else + mixedVariantId = variantId; + + uint graphicId = + (weapId & 0x3FF) << 20 | + (equipId & 0x3FF) << 10 | + (mixedVariantId & 0x3FF); + + appearanceIds[slot] = graphicId; + + } + + public void SendAppearance() + { + zone.BroadcastPacketAroundActor(this, CreateAppearancePacket()); + } + #region Inventory public void SendItemPackage(Player player, uint id) { diff --git a/Map Server/Actors/Chara/Player/Player.cs b/Map Server/Actors/Chara/Player/Player.cs index 6dfd78cc..e12d9169 100644 --- a/Map Server/Actors/Chara/Player/Player.cs +++ b/Map Server/Actors/Chara/Player/Player.cs @@ -978,29 +978,6 @@ namespace Meteor.Map.Actors //zone.BroadcastPacketAroundActor(this, worldMasterMessage); } - public void GraphicChange(uint slot, uint graphicId) - { - appearanceIds[slot] = graphicId; - } - - public void GraphicChange(uint slot, uint weapId, uint equipId, uint variantId, uint colorId) - { - - uint mixedVariantId; - - if (weapId == 0) - mixedVariantId = ((variantId & 0x1F) << 5) | colorId; - else - mixedVariantId = variantId; - - uint graphicId = - (weapId & 0x3FF) << 20 | - (equipId & 0x3FF) << 10 | - (mixedVariantId & 0x3FF); - - appearanceIds[slot] = graphicId; - - } public void GraphicChange(int slot, InventoryItem invItem) { @@ -1062,11 +1039,6 @@ namespace Meteor.Map.Actors BroadcastPacket(CreateAppearancePacket(), true); } - public void SendAppearance() - { - BroadcastPacket(CreateAppearancePacket(), true); - } - public void SendCharaExpInfo() { if (lastStep == 0) diff --git a/Map Server/Lua/LuaUtils.cs b/Map Server/Lua/LuaUtils.cs index 4abeb02c..0595d064 100644 --- a/Map Server/Lua/LuaUtils.cs +++ b/Map Server/Lua/LuaUtils.cs @@ -33,7 +33,6 @@ namespace Meteor.Map { class LuaUtils { - public class ItemRefParam { public uint actorId; @@ -53,12 +52,22 @@ namespace Meteor.Map public readonly uint actorId; public readonly ushort[] itemSlots; public readonly byte[] itemPackages; + public readonly int numItems; public MultiItemRefParam(uint actorId, ushort[] itemSlots, byte[] itemPackages) { this.actorId = actorId; this.itemSlots = itemSlots; this.itemPackages = itemPackages; + this.numItems = itemSlots.Length; + } + + public MultiItemRefParam(uint actorId, ushort itemSlot, byte itemPackage) + { + this.actorId = actorId; + this.itemSlots = new ushort[] { itemSlot }; + this.itemPackages = new byte[] { itemPackage }; + numItems = 1; } } @@ -120,7 +129,7 @@ namespace Meteor.Map uint actorId = Utils.SwapEndian(reader.ReadUInt32()); ushort slot = Utils.SwapEndian(reader.ReadUInt16()); byte itemPackage = reader.ReadByte(); - value = new ItemRefParam(actorId, slot, itemPackage); + value = new MultiItemRefParam(actorId, slot, itemPackage); } break; case 0x8: //Multi Item Reference to Inventory Spot