From 1229f3d44e040a770afb246d3b7b96aab2586b08 Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Thu, 7 Jan 2021 11:35:11 +1300 Subject: [PATCH] add format functions --- DataCollection/gamedata.json | 2 +- .../Horse Isle Server/Game/Messages.cs | 84 ++++++++++++++++++- .../Horse Isle Server/Server/GameDataJson.cs | 2 +- 3 files changed, 85 insertions(+), 3 deletions(-) diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index bef13c4..e841490 100644 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -172,7 +172,7 @@ "wearing_tacked":"^HWEARING/TACKED:
", "tacked_format":"^I%ICON%^T5%NAME%^B4LN%ITEMID%^R1", "companion":"^HCOMPANION:
", - "companion_selected":"^I%ICON%^T5%NAME%^B4LN%ID%^D6|CHANGE^R1", + "companion_selected":"^I%ICON%^T5%NAME%^B4LN%ITEMID%^D6|CHANGE^R1", "no_companion":"^T5Horse has no companion^D6|SELECT^R1", "advanced_stats":"^HADVANCED STATS:
Special treats:%SPOILED% Magic residue:%MAGICUSED%
", diff --git a/Horse Isle Server/Horse Isle Server/Game/Messages.cs b/Horse Isle Server/Horse Isle Server/Game/Messages.cs index 8ace7e5..ab3ec6e 100644 --- a/Horse Isle Server/Horse Isle Server/Game/Messages.cs +++ b/Horse Isle Server/Horse Isle Server/Game/Messages.cs @@ -180,7 +180,7 @@ namespace HISP.Game public static string HorseNameFormat; public static string HorseReleasedByFormat; - public static string HorseHandsHightFormat; + public static string HorseHandsHeightFormat; public static string HorseExperienceEarnedFormat; public static string HorseTrainableInFormat; @@ -401,6 +401,88 @@ namespace HISP.Game // Click public static string NothingInterestingHere; + + public static string FormatHorseName(string name) + { + return HorseNameFormat.Replace("%NAME%", name); + } + public static string FormatHorseReleasedBy(string name) + { + return HorseReleasedByFormat.Replace("%USERNAME%", name); + } + public static string FormatHorseHandsHigh(string color, string sex, int handsHigh) + { + return HorseHandsHeightFormat.Replace("%COLOR%", color).Replace("%SEX%", sex).Replace("%HANDS%", handsHigh.ToString()); + } + public static string FormatHorseExperience(int experience) + { + return HorseExperienceEarnedFormat.Replace("%EXP%", experience.ToString("N0")); + } + public static string FormatTrainableIn(int minutes) + { + return HorseTrainableInFormat.Replace("%TIME%", minutes.ToString()); + } + + public static string FormatMountButton(int randomId) + { + return HorseMountButtonFormat.Replace("%ID%", randomId.ToString()); + } + public static string FormatFeedButton(int randomId) + { + return HorseFeedButtonFormat.Replace("%ID%", randomId.ToString()); + } + public static string FormatTackButton(int randomId) + { + return HorseTackButtonFormat.Replace("%ID%", randomId.ToString()); + } + public static string FormatPetButton(int randomId) + { + return HorsePetButtonFormat.Replace("%ID%", randomId.ToString()); + } + public static string FormatProfileButton(int randomId) + { + return HorseProfileButtonFormat.Replace("%ID%", randomId.ToString()); + } + + public static string FormatAutoSellPrice(int money) + { + return HorseAutoSellPriceFormat.Replace("%MONEY%", money.ToString("N0")); + } + public static string FormatAutoSell(string autoSellStr) + { + return HorseAutoSellFormat.Replace("%AUTOSELL%", autoSellStr); + } + + public static string FormatHorseCategory(string category) + { + return HorseCurrentlyCategoryFormat.Replace("%CATEGORY%", category); + } + public static string FormatHorseTackEntry(int iconId, string name, int itemId) + { + return HorseTackFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", name).Replace("%ITEMID%", itemId.ToString()); + } + public static string FormatHorseCompanionEntry(int iconId, string name, int itemId) + { + return HorseCompanionFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", name).Replace("%ITEMID%", itemId.ToString()); + } + + public static string FormatHorseAdvancedStats(int spoiled, int magicUsed) + { + return HorseAdvancedStatsFormat.Replace("%SPOILED%", spoiled.ToString()).Replace("%MAGICUSED%", magicUsed.ToString()); + } + public static string FormatHorseBreedDetails(string breedName, string description) + { + return HorseBreedDetailsFormat.Replace("%BREED%", breedName).Replace("%DESCRIPTION%", description); + } + public static string FormatHorseHeight(int minHeight, int maxHeight) + { + return HorseHeightRangeFormat.Replace("%MIN%", minHeight.ToString()).Replace("%MAX%", maxHeight.ToString()); + } + public static string FormatPossibleColors(string[] colors) + { + return HorsePossibleColorsFormat.Replace("%COLORS%", String.Join(",", colors)); + } + public static string FormatHorseCategoryChangedMessage(string newCategory) { return UpdateHorseCategory.Replace("%CATEGORY%", newCategory); diff --git a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs index 50b04ad..d1d74c9 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs @@ -614,7 +614,7 @@ namespace HISP.Server Messages.HorseNameFormat = gameData.messages.meta.horse.horse_inventory.your_horse_format; Messages.HorseReleasedByFormat = gameData.messages.meta.horse.horse_inventory.released_by_format; - Messages.HorseHandsHightFormat = gameData.messages.meta.horse.horse_inventory.hands_high; + Messages.HorseHandsHeightFormat = gameData.messages.meta.horse.horse_inventory.hands_high; Messages.HorseExperienceEarnedFormat = gameData.messages.meta.horse.horse_inventory.experience; Messages.HorseTrainableInFormat = gameData.messages.meta.horse.horse_inventory.trainable_in;