mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 05:05:53 +12:00
Add wishing well
This commit is contained in:
parent
876eb69113
commit
8781ca6b84
9 changed files with 180 additions and 4 deletions
|
@ -56,7 +56,19 @@ namespace HISP.Game
|
|||
public static int PawneerOrder;
|
||||
public static int Telescope;
|
||||
public static int Pitchfork;
|
||||
public static int WishingCoin;
|
||||
|
||||
public static ItemInformation[] GetAllWishableItems()
|
||||
{
|
||||
List<ItemInformation> itemInfo = new List<ItemInformation>();
|
||||
foreach(ItemInformation item in Items)
|
||||
{
|
||||
if (item.WishingWell)
|
||||
itemInfo.Add(item);
|
||||
}
|
||||
return itemInfo.ToArray();
|
||||
}
|
||||
|
||||
public static bool ConsumeItem(User user, ItemInformation itmInfo)
|
||||
{
|
||||
|
||||
|
|
|
@ -188,7 +188,19 @@ namespace HISP.Game
|
|||
public static string AwardHeader;
|
||||
public static string NoAwards;
|
||||
public static string AwardFormat;
|
||||
|
||||
|
||||
// Wishing Well
|
||||
|
||||
public static string NoWishingCoins;
|
||||
public static string WishingWellMeta;
|
||||
public static string YouHaveWishingCoinsFormat;
|
||||
|
||||
public static string TossedCoin;
|
||||
public static string WishItemsFormat;
|
||||
public static string WishMoneyFormat;
|
||||
public static string WishWorldPeaceFormat;
|
||||
public static string WorldPeaceOnlySoDeep;
|
||||
|
||||
|
||||
// Shop
|
||||
public static string ThingsIAmSelling;
|
||||
|
@ -307,6 +319,27 @@ namespace HISP.Game
|
|||
|
||||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatNumberOfWishingCoins(int amount)
|
||||
{
|
||||
return YouHaveWishingCoinsFormat.Replace("%AMOUNT%", amount.ToString("N0"));
|
||||
}
|
||||
|
||||
public static string FormatWishThingsMessage(string item1, string item2)
|
||||
{
|
||||
return WishItemsFormat.Replace("%ITEM%", item1).Replace("%ITEM2%", item2);
|
||||
}
|
||||
public static string FormatWishMoneyMessage(int money)
|
||||
{
|
||||
return WishMoneyFormat.Replace("%MONEY%", money.ToString("N0"));
|
||||
}
|
||||
public static string FormatWishWorldPeaceMessage(int money, string item)
|
||||
{
|
||||
return WishWorldPeaceFormat.Replace("%MONEY%", money.ToString("N0")).Replace("%ITEM%", item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string FormatInnEnjoyedServiceMessage(string item, int price)
|
||||
{
|
||||
return InnEnjoyedServiceFormat.Replace("%ITEM%", item).Replace("%PRICE%", price.ToString("N0"));
|
||||
|
|
|
@ -142,6 +142,30 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
|
||||
private static string buildWishingWell(User user)
|
||||
{
|
||||
string message = "";
|
||||
bool hasCoins = user.Inventory.HasItemId(Item.WishingCoin);
|
||||
if(!hasCoins)
|
||||
{
|
||||
message += Messages.NoWishingCoins;
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryItem wishingCoins = user.Inventory.GetItemByItemId(Item.WishingCoin);
|
||||
int totalCoins = wishingCoins.ItemInstances.Count;
|
||||
message += Messages.FormatNumberOfWishingCoins(totalCoins);
|
||||
message += Messages.WishingWellMeta;
|
||||
}
|
||||
|
||||
message += Messages.ExitThisPlace;
|
||||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static string buildCommonInfo(int x, int y)
|
||||
{
|
||||
string message = "";
|
||||
|
@ -378,6 +402,7 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
|
||||
public static string BuildAwardList(User user)
|
||||
{
|
||||
string message = Messages.AwardHeader;
|
||||
|
@ -625,7 +650,10 @@ namespace HISP.Game
|
|||
message += buildShopInfo(shop,user.Inventory);
|
||||
|
||||
}
|
||||
|
||||
if(TileCode == "WISHINGWELL")
|
||||
{
|
||||
message += Meta.buildWishingWell(user);
|
||||
}
|
||||
if(TileCode == "INN")
|
||||
{
|
||||
int InnID = int.Parse(TileArg);
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace HISP.Game.Services
|
|||
public Item.ItemInformation GetStockedItem(int itemId)
|
||||
{
|
||||
|
||||
// Check if inn stock.. (pun intended)
|
||||
// Check if inn stock..
|
||||
foreach(Item.ItemInformation offering in RestsOffered)
|
||||
{
|
||||
if (offering.Id == itemId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue