diff --git a/Horse Isle Server/Horse Isle Server/Meta.cs b/Horse Isle Server/Horse Isle Server/Meta.cs index 4b8e803..505abc4 100644 --- a/Horse Isle Server/Horse Isle Server/Meta.cs +++ b/Horse Isle Server/Horse Isle Server/Meta.cs @@ -138,7 +138,7 @@ namespace Horse_Isle_Server return message; } - public static string BuildInventoryInfo(IInventory inv) + public static string BuildInventoryInfo(PlayerInventory inv) { string message = ""; message += Messages.FormatPlayerInventoryHeaderMeta(inv.Count, Messages.DefaultInventoryMax); @@ -167,7 +167,7 @@ namespace Horse_Isle_Server if (Item.IsThrowable(itemInfo.Id)) message += Messages.FormatItemThrowButton(randomId); - if(itemInfo.Type != "QUEST" || itemInfo.Type != "TEXT") + if (itemInfo.Type != "QUEST" && itemInfo.Type != "TEXT" && World.CanDropItems(inv.BaseUser.X, inv.BaseUser.Y)) message += Messages.FormatItemDropButton(randomId); message += Messages.FormatItemInformationButton(randomId); message += "^R1"; diff --git a/Horse Isle Server/Horse Isle Server/PlayerInventory.cs b/Horse Isle Server/Horse Isle Server/PlayerInventory.cs index 37fb5ac..3bf4c47 100644 --- a/Horse Isle Server/Horse Isle Server/PlayerInventory.cs +++ b/Horse Isle Server/Horse Isle Server/PlayerInventory.cs @@ -8,14 +8,14 @@ namespace Horse_Isle_Server { class PlayerInventory : IInventory { - private User baseUser; + public User BaseUser; private List inventoryItems; public PlayerInventory(User forUser) { inventoryItems = new List(); - baseUser = forUser; - ItemInstance[] instances = Database.GetPlayerInventory(baseUser.Id).ToArray(); + BaseUser = forUser; + ItemInstance[] instances = Database.GetPlayerInventory(BaseUser.Id).ToArray(); foreach(ItemInstance instance in instances) { addItem(instance, false); @@ -32,7 +32,7 @@ namespace Horse_Isle_Server private void addItem(ItemInstance item, bool addToDatabase) { if (addToDatabase) - Database.AddItemToInventory(baseUser.Id, item); + Database.AddItemToInventory(BaseUser.Id, item); foreach (InventoryItem invetoryItem in inventoryItems) { @@ -51,10 +51,6 @@ namespace Horse_Isle_Server } - public void Add(ItemInstance item) - { - addItem(item, true); - } public InventoryItem[] GetItemList() @@ -67,7 +63,7 @@ namespace Horse_Isle_Server public void Remove(ItemInstance item) { - Database.RemoveItemFromInventory(baseUser.Id, item); + Database.RemoveItemFromInventory(BaseUser.Id, item); foreach (InventoryItem inventoryItem in inventoryItems) { @@ -148,5 +144,9 @@ namespace Horse_Isle_Server throw new KeyNotFoundException("random id: " + randomId + " not found in inventory"); } + public void Add(ItemInstance item) + { + addItem(item, true); + } } } diff --git a/Horse Isle Server/Horse Isle Server/World.cs b/Horse Isle Server/Horse Isle Server/World.cs index 7fd8c7b..4f4d6c1 100644 --- a/Horse Isle Server/Horse Isle Server/World.cs +++ b/Horse Isle Server/Horse Isle Server/World.cs @@ -197,6 +197,17 @@ namespace Horse_Isle_Server throw new KeyNotFoundException("x,y not in a town!"); } + public static bool CanDropItems(int x, int y) + { + if (World.InSpecialTile(x, y)) + { + World.SpecialTile tile = World.GetSpecialTile(x, y); + if (tile.Code != null) + return false; + } + return true; + } + public static string GetWeather() { return Database.GetWorldWeather();