mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 21:25:42 +12:00
no message
This commit is contained in:
parent
c3497a6582
commit
d3b9cbf7a7
3 changed files with 22 additions and 11 deletions
|
@ -138,7 +138,7 @@ namespace Horse_Isle_Server
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string BuildInventoryInfo(IInventory inv)
|
public static string BuildInventoryInfo(PlayerInventory inv)
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "";
|
||||||
message += Messages.FormatPlayerInventoryHeaderMeta(inv.Count, Messages.DefaultInventoryMax);
|
message += Messages.FormatPlayerInventoryHeaderMeta(inv.Count, Messages.DefaultInventoryMax);
|
||||||
|
@ -167,7 +167,7 @@ namespace Horse_Isle_Server
|
||||||
if (Item.IsThrowable(itemInfo.Id))
|
if (Item.IsThrowable(itemInfo.Id))
|
||||||
message += Messages.FormatItemThrowButton(randomId);
|
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.FormatItemDropButton(randomId);
|
||||||
message += Messages.FormatItemInformationButton(randomId);
|
message += Messages.FormatItemInformationButton(randomId);
|
||||||
message += "^R1";
|
message += "^R1";
|
||||||
|
|
|
@ -8,14 +8,14 @@ namespace Horse_Isle_Server
|
||||||
{
|
{
|
||||||
class PlayerInventory : IInventory
|
class PlayerInventory : IInventory
|
||||||
{
|
{
|
||||||
private User baseUser;
|
public User BaseUser;
|
||||||
private List<InventoryItem> inventoryItems;
|
private List<InventoryItem> inventoryItems;
|
||||||
public PlayerInventory(User forUser)
|
public PlayerInventory(User forUser)
|
||||||
{
|
{
|
||||||
inventoryItems = new List<InventoryItem>();
|
inventoryItems = new List<InventoryItem>();
|
||||||
|
|
||||||
baseUser = forUser;
|
BaseUser = forUser;
|
||||||
ItemInstance[] instances = Database.GetPlayerInventory(baseUser.Id).ToArray();
|
ItemInstance[] instances = Database.GetPlayerInventory(BaseUser.Id).ToArray();
|
||||||
foreach(ItemInstance instance in instances)
|
foreach(ItemInstance instance in instances)
|
||||||
{
|
{
|
||||||
addItem(instance, false);
|
addItem(instance, false);
|
||||||
|
@ -32,7 +32,7 @@ namespace Horse_Isle_Server
|
||||||
private void addItem(ItemInstance item, bool addToDatabase)
|
private void addItem(ItemInstance item, bool addToDatabase)
|
||||||
{
|
{
|
||||||
if (addToDatabase)
|
if (addToDatabase)
|
||||||
Database.AddItemToInventory(baseUser.Id, item);
|
Database.AddItemToInventory(BaseUser.Id, item);
|
||||||
|
|
||||||
foreach (InventoryItem invetoryItem in inventoryItems)
|
foreach (InventoryItem invetoryItem in inventoryItems)
|
||||||
{
|
{
|
||||||
|
@ -51,10 +51,6 @@ namespace Horse_Isle_Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Add(ItemInstance item)
|
|
||||||
{
|
|
||||||
addItem(item, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public InventoryItem[] GetItemList()
|
public InventoryItem[] GetItemList()
|
||||||
|
@ -67,7 +63,7 @@ namespace Horse_Isle_Server
|
||||||
public void Remove(ItemInstance item)
|
public void Remove(ItemInstance item)
|
||||||
{
|
{
|
||||||
|
|
||||||
Database.RemoveItemFromInventory(baseUser.Id, item);
|
Database.RemoveItemFromInventory(BaseUser.Id, item);
|
||||||
|
|
||||||
foreach (InventoryItem inventoryItem in inventoryItems)
|
foreach (InventoryItem inventoryItem in inventoryItems)
|
||||||
{
|
{
|
||||||
|
@ -148,5 +144,9 @@ namespace Horse_Isle_Server
|
||||||
throw new KeyNotFoundException("random id: " + randomId + " not found in inventory");
|
throw new KeyNotFoundException("random id: " + randomId + " not found in inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Add(ItemInstance item)
|
||||||
|
{
|
||||||
|
addItem(item, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,17 @@ namespace Horse_Isle_Server
|
||||||
throw new KeyNotFoundException("x,y not in a town!");
|
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()
|
public static string GetWeather()
|
||||||
{
|
{
|
||||||
return Database.GetWorldWeather();
|
return Database.GetWorldWeather();
|
||||||
|
|
Loading…
Add table
Reference in a new issue