From 85a0de29685d13a24badd361cbe8685e76a03c92 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Fri, 8 Apr 2022 22:18:14 -0700 Subject: [PATCH] Support add/remove/update of chest --- EOLib/Domain/Item/ItemDropValidator.cs | 8 ++ EOLib/Domain/Map/ChestItem.cs | 26 ++++ EOLib/Domain/Map/MapActions.cs | 32 ++++- EOLib/Net/API/Chest.cs | 120 ------------------ EOLib/Net/API/PacketAPI.cs | 1 - .../PacketHandlers/Chest/ChestAgreeHandler.cs | 37 ++++++ EOLib/PacketHandlers/Chest/ChestGetHandler.cs | 82 ++++++++++++ .../PacketHandlers/Chest/ChestOpenHandler.cs | 4 +- .../Controllers/InventoryController.cs | 91 ++++++++----- EndlessClient/Dialogs/ChestDialog.cs | 2 +- EndlessClient/HUD/Panels/InventoryPanel.cs | 33 ++--- EndlessClient/Old/PacketAPICallbackManager.cs | 25 ---- 12 files changed, 255 insertions(+), 206 deletions(-) create mode 100644 EOLib/Domain/Map/ChestItem.cs delete mode 100644 EOLib/Net/API/Chest.cs create mode 100644 EOLib/PacketHandlers/Chest/ChestAgreeHandler.cs create mode 100644 EOLib/PacketHandlers/Chest/ChestGetHandler.cs diff --git a/EOLib/Domain/Item/ItemDropValidator.cs b/EOLib/Domain/Item/ItemDropValidator.cs index 55d8ef0a6..aa89b41f1 100644 --- a/EOLib/Domain/Item/ItemDropValidator.cs +++ b/EOLib/Domain/Item/ItemDropValidator.cs @@ -20,6 +20,12 @@ public class ItemDropValidator : IItemDropValidator _currentMapStateProvider = currentMapStateProvider; } + public ItemDropResult ValidateItemDrop(ICharacter mainCharacter, IInventoryItem item) + { + var coord = new MapCoordinate(mainCharacter.RenderProperties.MapX, mainCharacter.RenderProperties.MapY); + return ValidateItemDrop(mainCharacter, item, coord); + } + public ItemDropResult ValidateItemDrop(ICharacter mainCharacter, IInventoryItem item, MapCoordinate dropPoint) { if (item.ItemID <= 0) @@ -43,6 +49,8 @@ public ItemDropResult ValidateItemDrop(ICharacter mainCharacter, IInventoryItem public interface IItemDropValidator { + ItemDropResult ValidateItemDrop(ICharacter mainCharacter, IInventoryItem item); + ItemDropResult ValidateItemDrop(ICharacter mainCharacter, IInventoryItem item, MapCoordinate dropPoint); } } diff --git a/EOLib/Domain/Map/ChestItem.cs b/EOLib/Domain/Map/ChestItem.cs new file mode 100644 index 000000000..d11230c83 --- /dev/null +++ b/EOLib/Domain/Map/ChestItem.cs @@ -0,0 +1,26 @@ +using EOLib.Domain.Character; + +namespace EOLib.Domain.Map +{ + public class ChestItem : InventoryItem + { + public int Slot { get; } + + public ChestItem(short itemID, int amount, int slot) + : base(itemID, amount) + { + Slot = slot; + } + + public override bool Equals(object obj) + { + var chestItem = obj as ChestItem; + return base.Equals(chestItem) && Slot == chestItem.Slot; + } + + public override int GetHashCode() + { + return base.GetHashCode() * -1521134295 + Slot.GetHashCode(); + } + } +} diff --git a/EOLib/Domain/Map/MapActions.cs b/EOLib/Domain/Map/MapActions.cs index f935dc5d8..0e70035c0 100644 --- a/EOLib/Domain/Map/MapActions.cs +++ b/EOLib/Domain/Map/MapActions.cs @@ -13,16 +13,19 @@ public class MapActions : IMapActions private readonly IItemPickupValidator _itemPickupValidator; private readonly ICharacterProvider _characterProvider; private readonly ICurrentMapStateRepository _currentMapStateRepository; + private readonly IChestDataProvider _chestDataProvider; public MapActions(IPacketSendService packetSendService, IItemPickupValidator itemPickupValidator, ICharacterProvider characterProvider, - ICurrentMapStateRepository currentMapStateRepository) + ICurrentMapStateRepository currentMapStateRepository, + IChestDataProvider chestDataProvider) { _packetSendService = packetSendService; _itemPickupValidator = itemPickupValidator; _characterProvider = characterProvider; _currentMapStateRepository = currentMapStateRepository; + _chestDataProvider = chestDataProvider; } public void RequestRefresh() @@ -66,6 +69,29 @@ public void OpenChest(byte x, byte y) _packetSendService.SendPacket(packet); } + + public void AddItemToChest(IInventoryItem item) + { + var packet = new PacketBuilder(PacketFamily.Chest, PacketAction.Add) + .AddChar((byte)_chestDataProvider.Location.X) + .AddChar((byte)_chestDataProvider.Location.Y) + .AddShort(item.ItemID) + .AddThree(item.Amount) + .Build(); + + _packetSendService.SendPacket(packet); + } + + public void TakeItemFromChest(short itemId) + { + var packet = new PacketBuilder(PacketFamily.Chest, PacketAction.Take) + .AddChar((byte)_chestDataProvider.Location.X) + .AddChar((byte)_chestDataProvider.Location.Y) + .AddShort(itemId) + .Build(); + + _packetSendService.SendPacket(packet); + } } public interface IMapActions @@ -77,5 +103,9 @@ public interface IMapActions void OpenDoor(IWarp warp); void OpenChest(byte x, byte y); + + void AddItemToChest(IInventoryItem item); + + void TakeItemFromChest(short itemId); } } diff --git a/EOLib/Net/API/Chest.cs b/EOLib/Net/API/Chest.cs deleted file mode 100644 index 6b6522086..000000000 --- a/EOLib/Net/API/Chest.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using EOLib.Domain.Character; -using EOLib.Net.Handlers; - -namespace EOLib.Net.API -{ - public struct ChestData - { - private readonly List _items; - - public byte X { get; private set; } - public byte Y { get; private set; } - - public IList Items - { - get - { - var itemsToReturn = _items.Select(x => new InventoryItem(x.ItemID, x.Amount)); - return itemsToReturn.ToList(); - } - } - - internal ChestData(OldPacket pkt, bool containsCoords) - : this() - { - X = containsCoords ? pkt.GetChar() : byte.MinValue; - Y = containsCoords ? pkt.GetChar() : byte.MinValue; - - var numRemaining = pkt.PeekEndString().Length / 5; - _items = new List(numRemaining); - for (var i = 0; i < numRemaining; ++i) - { - _items.Add(new InventoryItem(pkt.GetShort(), pkt.GetThree())); - } - } - } - - partial class PacketAPI - { - public delegate void ChestDataChangeEvent(short id, int amount, byte weight, byte maxWeight, ChestData data); - - public event Action OnChestAgree; - public event ChestDataChangeEvent OnChestGetItem; - public event ChestDataChangeEvent OnChestAddItem; - - private void _createChestMembers() - { - m_client.AddPacketHandler(new FamilyActionPair(PacketFamily.Chest, PacketAction.Get), _handleChestGet, true); - m_client.AddPacketHandler(new FamilyActionPair(PacketFamily.Chest, PacketAction.Agree), _handleChestAgree, true); - m_client.AddPacketHandler(new FamilyActionPair(PacketFamily.Chest, PacketAction.Reply), _handleChestReply, true); - } - - public bool ChestTakeItem(byte x, byte y, short itemID) - { - if (!m_client.ConnectedAndInitialized || !Initialized) - return false; - - OldPacket pkt = new OldPacket(PacketFamily.Chest, PacketAction.Take); - pkt.AddChar(x); - pkt.AddChar(y); - pkt.AddShort(itemID); - - return m_client.SendPacket(pkt); - } - - public bool ChestAddItem(byte x, byte y, short itemID, int amount) - { - if (!m_client.ConnectedAndInitialized || !Initialized) - return false; - - OldPacket pkt = new OldPacket(PacketFamily.Chest, PacketAction.Add); - pkt.AddChar(x); - pkt.AddChar(y); - pkt.AddShort(itemID); - pkt.AddThree(amount); - - return m_client.SendPacket(pkt); - } - - /// - /// Handler for CHEST_GET packet, sent as confirmation to character that item is being taken - /// - private void _handleChestGet(OldPacket pkt) - { - if (OnChestGetItem == null) return; - short takenID = pkt.GetShort(); - int takenAmount = pkt.GetThree(); - byte characterWeight = pkt.GetChar(); - byte characterMaxWeight = pkt.GetChar(); - ChestData data = new ChestData(pkt, false); - OnChestGetItem(takenID, takenAmount, characterWeight, characterMaxWeight, data); - } - - /// - /// Handler for CHEST_AGREE packet, sent as update to other characters near a chest that was modified by another player - /// - private void _handleChestAgree(OldPacket pkt) - { - if (OnChestAgree != null) - OnChestAgree(new ChestData(pkt, false)); - } - - /// - /// Handler for CHEST_REPLY packet, sent in response to main player adding an item to a chest - /// - private void _handleChestReply(OldPacket pkt) - { - if (OnChestAddItem == null) return; - - short remainingID = pkt.GetShort(); - int remainingAmount = pkt.GetInt(); - byte characterWeight = pkt.GetChar(); - byte characterMaxWeight = pkt.GetChar(); - ChestData data = new ChestData(pkt, false); - OnChestAddItem(remainingID, remainingAmount, characterWeight, characterMaxWeight, data); - } - } -} diff --git a/EOLib/Net/API/PacketAPI.cs b/EOLib/Net/API/PacketAPI.cs index d978f60c2..19ef11d21 100644 --- a/EOLib/Net/API/PacketAPI.cs +++ b/EOLib/Net/API/PacketAPI.cs @@ -21,7 +21,6 @@ public PacketAPI(EOClient client) //each of these sets up members of the partial PacketAPI class relevant to a particular packet family _createBankMembers(); - _createChestMembers(); _createInitMembers(); _createLockerMembers(); _createMusicMembers(); diff --git a/EOLib/PacketHandlers/Chest/ChestAgreeHandler.cs b/EOLib/PacketHandlers/Chest/ChestAgreeHandler.cs new file mode 100644 index 000000000..541e31906 --- /dev/null +++ b/EOLib/PacketHandlers/Chest/ChestAgreeHandler.cs @@ -0,0 +1,37 @@ +using AutomaticTypeMapper; +using EOLib.Domain.Character; +using EOLib.Domain.Login; +using EOLib.Domain.Map; +using EOLib.Net; +using EOLib.Net.Handlers; + +namespace EOLib.PacketHandlers.Chest +{ + [AutoMappedType] + public class ChestAgreeHandler : InGameOnlyPacketHandler + { + private readonly IChestDataRepository _chestDataRepository; + + public override PacketFamily Family => PacketFamily.Chest; + + public override PacketAction Action => PacketAction.Agree; + + public ChestAgreeHandler(IPlayerInfoProvider playerInfoProvider, + IChestDataRepository chestDataRepository) + : base(playerInfoProvider) + { + _chestDataRepository = chestDataRepository; + } + + public override bool HandlePacket(IPacket packet) + { + _chestDataRepository.Items.Clear(); + + int i = 0; + while (packet.ReadPosition < packet.Length) + _chestDataRepository.Items.Add(new ChestItem(packet.ReadShort(), packet.ReadThree(), i++)); + + return true; + } + } +} diff --git a/EOLib/PacketHandlers/Chest/ChestGetHandler.cs b/EOLib/PacketHandlers/Chest/ChestGetHandler.cs new file mode 100644 index 000000000..60037abc1 --- /dev/null +++ b/EOLib/PacketHandlers/Chest/ChestGetHandler.cs @@ -0,0 +1,82 @@ +using AutomaticTypeMapper; +using EOLib.Domain.Character; +using EOLib.Domain.Login; +using EOLib.Domain.Map; +using EOLib.Net; +using Optional.Collections; + +namespace EOLib.PacketHandlers.Chest +{ + /// + /// Handler for CHEST_GET packet, sent as confirmation to character that item is being taken + /// + [AutoMappedType] + public class ChestGetHandler : ChestAgreeHandler + { + private readonly ICharacterRepository _characterRepository; + private readonly ICharacterInventoryRepository _characterInventoryRepository; + + public override PacketFamily Family => PacketFamily.Chest; + + public override PacketAction Action => PacketAction.Get; + + public ChestGetHandler(IPlayerInfoProvider playerInfoProvider, + IChestDataRepository chestDataRepository, + ICharacterRepository characterRepository, + ICharacterInventoryRepository characterInventoryRepository) + : base(playerInfoProvider, chestDataRepository) + { + _characterRepository = characterRepository; + _characterInventoryRepository = characterInventoryRepository; + } + + public override bool HandlePacket(IPacket packet) + { + var itemId = packet.ReadShort(); + var amount = Action == PacketAction.Get ? packet.ReadThree() : packet.ReadInt(); + var weight = packet.ReadChar(); + var maxWeight = packet.ReadChar(); + + _characterInventoryRepository.ItemInventory.SingleOrNone(x => x.ItemID == itemId) + .Match( + some: existing => + { + _characterInventoryRepository.ItemInventory.Remove(existing); + if (amount > 0 || itemId == 1) + { + _characterInventoryRepository.ItemInventory.Add(existing.WithAmount(existing.Amount + (Action == PacketAction.Get ? amount : -amount))); + } + }, + none: () => + { + if (amount > 0) + _characterInventoryRepository.ItemInventory.Add(new InventoryItem(itemId, amount)); + }); + + var stats = _characterRepository.MainCharacter.Stats + .WithNewStat(CharacterStat.Weight, weight) + .WithNewStat(CharacterStat.MaxWeight, maxWeight); + + _characterRepository.MainCharacter = _characterRepository.MainCharacter.WithStats(stats); + + return base.HandlePacket(packet); + } + } + + /// + /// Handler for CHEST_REPLY packet, sent in response to main player adding an item to a chest + /// + [AutoMappedType] + public class ChestReplyHandler : ChestGetHandler + { + public override PacketAction Action => PacketAction.Reply; + + public ChestReplyHandler(IPlayerInfoProvider playerInfoProvider, + IChestDataRepository chestDataRepository, + ICharacterRepository characterRepository, + ICharacterInventoryRepository characterInventoryRepository) + : base(playerInfoProvider, chestDataRepository, characterRepository, characterInventoryRepository) + { + } + } +} diff --git a/EOLib/PacketHandlers/Chest/ChestOpenHandler.cs b/EOLib/PacketHandlers/Chest/ChestOpenHandler.cs index d44f6b793..1609115a3 100644 --- a/EOLib/PacketHandlers/Chest/ChestOpenHandler.cs +++ b/EOLib/PacketHandlers/Chest/ChestOpenHandler.cs @@ -30,8 +30,10 @@ public override bool HandlePacket(IPacket packet) _chestDataRepository.ResetState(); _chestDataRepository.Location = new MapCoordinate(x, y); + + int i = 0; while (packet.ReadPosition < packet.Length) - _chestDataRepository.Items.Add(new InventoryItem(packet.ReadShort(), packet.ReadThree())); + _chestDataRepository.Items.Add(new ChestItem(packet.ReadShort(), packet.ReadThree(), i++)); return true; } diff --git a/EndlessClient/Controllers/InventoryController.cs b/EndlessClient/Controllers/InventoryController.cs index d9655c91c..99fb2e50b 100644 --- a/EndlessClient/Controllers/InventoryController.cs +++ b/EndlessClient/Controllers/InventoryController.cs @@ -27,6 +27,7 @@ public class InventoryController : IInventoryController private readonly IItemActions _itemActions; private readonly IInGameDialogActions _inGameDialogActions; private readonly IPaperdollActions _paperdollActions; + private readonly IMapActions _mapActions; private readonly IItemEquipValidator _itemEquipValidator; private readonly IItemDropValidator _itemDropValidator; private readonly ICharacterProvider _characterProvider; @@ -42,6 +43,7 @@ public class InventoryController : IInventoryController public InventoryController(IItemActions itemActions, IInGameDialogActions inGameDialogActions, IPaperdollActions paperdollActions, + IMapActions mapActions, IItemEquipValidator itemEquipValidator, IItemDropValidator itemDropValidator, ICharacterProvider characterProvider, @@ -57,6 +59,7 @@ public class InventoryController : IInventoryController _itemActions = itemActions; _inGameDialogActions = inGameDialogActions; _paperdollActions = paperdollActions; + _mapActions = mapActions; _itemEquipValidator = itemEquipValidator; _itemDropValidator = itemDropValidator; _characterProvider = characterProvider; @@ -206,39 +209,7 @@ public void DropItem(EIFRecord itemData, IInventoryItem inventoryItem) } else if (validationResult == ItemDropResult.Ok) { - if (inventoryItem.Amount > 1) - { - var transferDialog = _itemTransferDialogFactory.CreateItemTransferDialog( - itemData.Name, - ItemTransferDialog.TransferType.DropItems, - inventoryItem.Amount, - EOResourceID.DIALOG_TRANSFER_DROP); - transferDialog.DialogClosing += (sender, e) => - { - if (e.Result == XNADialogResult.OK) - { - if (inventoryItem.ItemID == 1 && transferDialog.SelectedAmount > 10000) - { - var warningMsg = _eoMessageBoxFactory.CreateMessageBox(DialogResourceID.DROP_MANY_GOLD_ON_GROUND, EODialogButtons.OkCancel); - warningMsg.DialogClosing += (_, warningArgs) => - { - if (warningArgs.Result == XNADialogResult.OK) - _itemActions.DropItem(inventoryItem.ItemID, transferDialog.SelectedAmount, dropPoint); - }; - warningMsg.ShowDialog(); - } - else - { - _itemActions.DropItem(inventoryItem.ItemID, transferDialog.SelectedAmount, dropPoint); - } - } - }; - transferDialog.ShowDialog(); - } - else - { - _itemActions.DropItem(inventoryItem.ItemID, 1, dropPoint); - } + DoItemDrop(itemData, inventoryItem, a => _itemActions.DropItem(inventoryItem.ItemID, a, dropPoint)); } else if (validationResult == ItemDropResult.TooFar) { @@ -246,6 +217,21 @@ public void DropItem(EIFRecord itemData, IInventoryItem inventoryItem) } } + public void DropItemInChest(EIFRecord itemData, IInventoryItem inventoryItem) + { + var validationResult = _itemDropValidator.ValidateItemDrop(_characterProvider.MainCharacter, inventoryItem); + + if (validationResult == ItemDropResult.Lore) + { + var msgBox = _eoMessageBoxFactory.CreateMessageBox(DialogResourceID.ITEM_IS_LORE_ITEM, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader); + msgBox.ShowDialog(); + } + else + { + DoItemDrop(itemData, inventoryItem, a => _mapActions.AddItemToChest(inventoryItem.WithAmount(a))); + } + } + public void JunkItem(EIFRecord itemData, IInventoryItem inventoryItem) { if (inventoryItem.Amount > 1) @@ -269,6 +255,43 @@ public void JunkItem(EIFRecord itemData, IInventoryItem inventoryItem) _itemActions.JunkItem(inventoryItem.ItemID, 1); } } + + private void DoItemDrop(EIFRecord itemData, IInventoryItem inventoryItem, Action dropAction) + { + if (inventoryItem.Amount > 1) + { + var transferDialog = _itemTransferDialogFactory.CreateItemTransferDialog( + itemData.Name, + ItemTransferDialog.TransferType.DropItems, + inventoryItem.Amount, + EOResourceID.DIALOG_TRANSFER_DROP); + transferDialog.DialogClosing += (sender, e) => + { + if (e.Result == XNADialogResult.OK) + { + if (inventoryItem.ItemID == 1 && transferDialog.SelectedAmount > 10000) + { + var warningMsg = _eoMessageBoxFactory.CreateMessageBox(DialogResourceID.DROP_MANY_GOLD_ON_GROUND, EODialogButtons.OkCancel); + warningMsg.DialogClosing += (_, warningArgs) => + { + if (warningArgs.Result == XNADialogResult.OK) + dropAction(transferDialog.SelectedAmount); + }; + warningMsg.ShowDialog(); + } + else + { + dropAction(transferDialog.SelectedAmount); + } + } + }; + transferDialog.ShowDialog(); + } + else + { + dropAction(1); + } + } } public interface IInventoryController @@ -283,6 +306,8 @@ public interface IInventoryController void DropItem(EIFRecord itemData, IInventoryItem inventoryItem); + void DropItemInChest(EIFRecord itemData, IInventoryItem inventoryItem); + void JunkItem(EIFRecord itemData, IInventoryItem inventoryItem); } } diff --git a/EndlessClient/Dialogs/ChestDialog.cs b/EndlessClient/Dialogs/ChestDialog.cs index 5fb14531d..e370e0e65 100644 --- a/EndlessClient/Dialogs/ChestDialog.cs +++ b/EndlessClient/Dialogs/ChestDialog.cs @@ -123,7 +123,7 @@ private void TakeItem(IInventoryItem item, EIFRecord itemData) } else { - // todo: take chest item + _mapActions.TakeItemFromChest(item.ItemID); } } } diff --git a/EndlessClient/HUD/Panels/InventoryPanel.cs b/EndlessClient/HUD/Panels/InventoryPanel.cs index c7749706b..8d41fd61e 100644 --- a/EndlessClient/HUD/Panels/InventoryPanel.cs +++ b/EndlessClient/HUD/Panels/InventoryPanel.cs @@ -388,6 +388,14 @@ private void HandleItemDoneDragging(object sender, InventoryPanelItem.ItemDragCo _inventoryController.EquipItem(item.Data); } }); + _activeDialogProvider.ChestDialog.MatchSome(x => + { + if (x.MouseOver && x.MouseOverPreviously) + { + dialogDrop = true; + _inventoryController.DropItemInChest(item.Data, item.InventoryItem); + } + }); if (dialogDrop) { @@ -440,30 +448,7 @@ private void HandleItemDoneDragging(object sender, InventoryPanelItem.ItemDragCo #region Unimplemented drag action /* - if (ChestDialog.Instance != null && ChestDialog.Instance.MouseOver && ChestDialog.Instance.MouseOverPreviously) - { - if (m_itemData.Special == ItemSpecial.Lore) - { - EOMessageBox.Show(DialogResourceID.ITEM_IS_LORE_ITEM, EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader); - } - else if (m_inventory.Amount > 1) - { - ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.DropItems, m_inventory.Amount); - dlg.DialogClosing += (sender, args) => - { - if (args.Result == XNADialogResult.OK && - !m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY, - m_inventory.ItemID, dlg.SelectedAmount)) - EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu(); - }; - } - else - { - if (!m_api.ChestAddItem(ChestDialog.Instance.CurrentChestX, ChestDialog.Instance.CurrentChestY, m_inventory.ItemID, 1)) - EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu(); - } - } - else if (LockerDialog.Instance != null && LockerDialog.Instance.MouseOver && LockerDialog.Instance.MouseOverPreviously) + if (LockerDialog.Instance != null && LockerDialog.Instance.MouseOver && LockerDialog.Instance.MouseOverPreviously) { byte x = LockerDialog.Instance.X; byte y = LockerDialog.Instance.Y; diff --git a/EndlessClient/Old/PacketAPICallbackManager.cs b/EndlessClient/Old/PacketAPICallbackManager.cs index ea8fa7940..ffb1a8356 100644 --- a/EndlessClient/Old/PacketAPICallbackManager.cs +++ b/EndlessClient/Old/PacketAPICallbackManager.cs @@ -24,11 +24,6 @@ public PacketAPICallbackManager(PacketAPI apiObj, EOGame game) public void AssignCallbacks() { - //chest related - m_packetAPI.OnChestAgree += _chestAgree; - m_packetAPI.OnChestAddItem += _chestAddItem; - m_packetAPI.OnChestGetItem += _chestGetItem; - m_packetAPI.OnMapMutation += _mapMutate; //npc related @@ -73,26 +68,6 @@ public void AssignCallbacks() m_packetAPI.OnCastSpellTargetGroup += _playerCastGroupSpell; } - private void _chestAgree(ChestData data) - { - //if (ChestDialog.Instance != null) - // ChestDialog.Instance.InitializeItems(data.Items); - } - - private void _chestAddItem(short id, int amount, byte weight, byte maxWeight, ChestData data) - { - //OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight, maxWeight); - //ChestDialog.Instance.InitializeItems(data.Items); - //m_game.Hud.RefreshStats(); - } - - private void _chestGetItem(short id, int amount, byte weight, byte maxWeight, ChestData data) - { - //OldWorld.Instance.MainPlayer.ActiveCharacter.UpdateInventoryItem(id, amount, weight, maxWeight, true); - //ChestDialog.Instance.InitializeItems(data.Items); - //m_game.Hud.RefreshStats(); - } - private void _mapMutate() { if (File.Exists("maps\\00000.emf"))