Example #1
0
        private static void HouseUpgradeDialog(GamePlayer player, byte response)
        {
            if (response != 0x01)
            {
                return;
            }

            var itemWeak = player.TempProperties.getProperty <WeakReference>(DeedWeak, new WeakRef(null));

            player.TempProperties.removeProperty(DeedWeak);

            var item  = (InventoryItem)itemWeak.Target;
            var house = (House)player.TempProperties.getProperty <object>(TargetHouse, null);

            player.TempProperties.removeProperty(TargetHouse);

            if (house == null)
            {
                ChatUtil.SendSystemMessage(player, "No House selected!");
                return;
            }

            if (item == null || item.SlotPosition == (int)eInventorySlot.Ground ||
                item.OwnerID == null || item.OwnerID != player.InternalID)
            {
                ChatUtil.SendSystemMessage(player, "This does not work without a House Deed.");
                return;
            }

            if (HouseMgr.UpgradeHouse(house, item))
            {
                player.Inventory.RemoveItem(item);
                InventoryLogging.LogInventoryAction(player, $"(HOUSE;{house.HouseNumber})", eInventoryActionType.Other, item.Template, item.Count);
            }
        }