mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +12:00
Add vets
This commit is contained in:
parent
b8376e9451
commit
4f61b636a6
6 changed files with 130 additions and 2 deletions
|
@ -136,10 +136,11 @@
|
||||||
"vet":{
|
"vet":{
|
||||||
"service_horse":"^LYour horse %HORSENAME%: health currently %CURHEALTH%/%MAXHEALTH%^R1",
|
"service_horse":"^LYour horse %HORSENAME%: health currently %CURHEALTH%/%MAXHEALTH%^R1",
|
||||||
"not_needed":"^I257^T8Vet services are not needed for this horse.^R1",
|
"not_needed":"^I257^T8Vet services are not needed for this horse.^R1",
|
||||||
|
"apply":"^I257^T6Apply vet services for $%PRICE% ^B3V%RANDOMID%",
|
||||||
"apply_all":"^R1^I257^T6Apply all vet services for $%PRICE% ^B3v^R1",
|
"apply_all":"^R1^I257^T6Apply all vet services for $%PRICE% ^B3v^R1",
|
||||||
|
|
||||||
"now_full_health":"Your horse %HORSENAME% is now at full health!",
|
"now_full_health":"Your horse %HORSENAME% is now at full health!",
|
||||||
"not_needed":"Your horses do not require any vet services right now.",
|
"not_needed_all":"Your horses do not require any vet services right now.",
|
||||||
"all_full":"Your horses are now all at full health!",
|
"all_full":"Your horses are now all at full health!",
|
||||||
},
|
},
|
||||||
"pond":{
|
"pond":{
|
||||||
|
@ -713,6 +714,13 @@
|
||||||
"pm_sound":"PM"
|
"pm_sound":"PM"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"vet":{
|
||||||
|
"price_multipliers":[
|
||||||
|
{"id":1,"cost":0.5},
|
||||||
|
{"id":2,"cost":0.8},
|
||||||
|
{"id":3,"cost":0.9}
|
||||||
|
]
|
||||||
|
},
|
||||||
"horses":{
|
"horses":{
|
||||||
"names":["A Buck Or Two","A Cowboy's Dream","A Cowgirls's Dream","A Promise Kept","A Smile","A Splash Of Class",
|
"names":["A Buck Or Two","A Cowboy's Dream","A Cowgirls's Dream","A Promise Kept","A Smile","A Splash Of Class",
|
||||||
"A Whole Lotta Luck","A'dab","A'idah","Abaccus","Abalone","Abba",
|
"A Whole Lotta Luck","A'dab","A'idah","Abaccus","Abalone","Abba",
|
||||||
|
|
|
@ -296,6 +296,17 @@ namespace HISP.Game
|
||||||
public static string HorseEquipFormat;
|
public static string HorseEquipFormat;
|
||||||
public static string BackToHorse;
|
public static string BackToHorse;
|
||||||
|
|
||||||
|
// Vet
|
||||||
|
public static string VetServiceHorseFormat;
|
||||||
|
public static string VetSerivcesNotNeeded;
|
||||||
|
public static string VetApplyServicesFormat;
|
||||||
|
|
||||||
|
public static string VetApplyServicesForAllFormat;
|
||||||
|
public static string VetFullHealthRecoveredMessageFormat;
|
||||||
|
|
||||||
|
public static string VetServicesNotNeededAll;
|
||||||
|
public static string VetAllFullHealthRecoveredMessage;
|
||||||
|
|
||||||
// Consume
|
// Consume
|
||||||
|
|
||||||
public static string ConsumeItemFormat;
|
public static string ConsumeItemFormat;
|
||||||
|
@ -490,6 +501,27 @@ namespace HISP.Game
|
||||||
// Click
|
// Click
|
||||||
public static string NothingInterestingHere;
|
public static string NothingInterestingHere;
|
||||||
|
|
||||||
|
public static string FormatVetServiceHorseMeta(string horseName, int currentHealth, int maxHealth)
|
||||||
|
{
|
||||||
|
return VetServiceHorseFormat.Replace("%HORSENAME%", horseName).Replace("%CURHEALTH%", currentHealth.ToString()).Replace("%MAXHEALTH%", maxHealth.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatVetApplyServiceMeta(int price, int randomId)
|
||||||
|
{
|
||||||
|
return VetApplyServicesFormat.Replace("%PRICE%", price.ToString()).Replace("%RANDOMID%", randomId.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatVetApplyAllServiceMeta(int price)
|
||||||
|
{
|
||||||
|
return VetApplyServicesForAllFormat.Replace("%PRICE%", price.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatVetHorseAtFullHealthMessage(string horseName)
|
||||||
|
{
|
||||||
|
return VetFullHealthRecoveredMessageFormat.Replace("%HORSENAME%", horseName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string FormatPondNotThirsty(string horseName)
|
public static string FormatPondNotThirsty(string horseName)
|
||||||
{
|
{
|
||||||
return PondNotThirstyFormat.Replace("%HORSENAME%", horseName);
|
return PondNotThirstyFormat.Replace("%HORSENAME%", horseName);
|
||||||
|
|
|
@ -803,6 +803,30 @@ namespace HISP.Game
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string buildVet(Vet vet, User user)
|
||||||
|
{
|
||||||
|
string message = "";
|
||||||
|
int totalPrice = 0;
|
||||||
|
foreach (HorseInstance horse in user.HorseInventory.HorseList)
|
||||||
|
{
|
||||||
|
message += Messages.FormatVetServiceHorseMeta(horse.Name, horse.BasicStats.Health, 1000);
|
||||||
|
|
||||||
|
if (horse.BasicStats.Health >= 1000)
|
||||||
|
message += Messages.VetSerivcesNotNeeded;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int price = vet.CalculatePrice(horse.BasicStats.Health);
|
||||||
|
totalPrice += price;
|
||||||
|
|
||||||
|
message += Messages.FormatVetApplyServiceMeta(price, horse.RandomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
message += Messages.FormatVetApplyAllServiceMeta(totalPrice);
|
||||||
|
message += Messages.ExitThisPlace;
|
||||||
|
message += Messages.MetaTerminator;
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
|
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
|
||||||
{
|
{
|
||||||
|
@ -862,6 +886,13 @@ namespace HISP.Game
|
||||||
message += buildShopInfo(shop,user.Inventory);
|
message += buildShopInfo(shop,user.Inventory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(TileCode == "VET")
|
||||||
|
{
|
||||||
|
int VetId = int.Parse(TileArg);
|
||||||
|
Vet vet = Vet.GetVetById(VetId);
|
||||||
|
message += buildVet(vet, user);
|
||||||
|
Logger.DebugPrint(message);
|
||||||
|
}
|
||||||
if(TileCode == "BANK")
|
if(TileCode == "BANK")
|
||||||
{
|
{
|
||||||
message += buildBank(user);
|
message += buildBank(user);
|
||||||
|
|
39
Horse Isle Server/Horse Isle Server/Game/Services/Vet.cs
Normal file
39
Horse Isle Server/Horse Isle Server/Game/Services/Vet.cs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace HISP.Game.Services
|
||||||
|
{
|
||||||
|
class Vet
|
||||||
|
{
|
||||||
|
|
||||||
|
public static List<Vet> Vets = new List<Vet>();
|
||||||
|
|
||||||
|
public Vet(int id, double price)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
PriceMultiplier = price;
|
||||||
|
Vets.Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Id;
|
||||||
|
public double PriceMultiplier;
|
||||||
|
public int CalculatePrice(int health)
|
||||||
|
{
|
||||||
|
double price = ((double)health - 1000.0) * PriceMultiplier;
|
||||||
|
return Convert.ToInt32(Math.Floor(price));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vet GetVetById(int id)
|
||||||
|
{
|
||||||
|
foreach(Vet vet in Vets)
|
||||||
|
{
|
||||||
|
if (id == vet.Id)
|
||||||
|
return vet;
|
||||||
|
}
|
||||||
|
throw new KeyNotFoundException("Vet with id: " + id + " Not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,6 +87,7 @@
|
||||||
<Compile Include="Game\Services\Inn.cs" />
|
<Compile Include="Game\Services\Inn.cs" />
|
||||||
<Compile Include="Game\Services\Shop.cs" />
|
<Compile Include="Game\Services\Shop.cs" />
|
||||||
<Compile Include="Game\Inventory\ShopInventory.cs" />
|
<Compile Include="Game\Inventory\ShopInventory.cs" />
|
||||||
|
<Compile Include="Game\Services\Vet.cs" />
|
||||||
<Compile Include="Game\SwfModules\Brickpoet.cs" />
|
<Compile Include="Game\SwfModules\Brickpoet.cs" />
|
||||||
<Compile Include="Game\Tracking.cs" />
|
<Compile Include="Game\Tracking.cs" />
|
||||||
<Compile Include="Player\Award.cs" />
|
<Compile Include="Player\Award.cs" />
|
||||||
|
|
|
@ -502,7 +502,14 @@ namespace HISP.Server
|
||||||
Tracking.TrackedItemsStatsMenu.Add(trackedItem);
|
Tracking.TrackedItemsStatsMenu.Add(trackedItem);
|
||||||
Logger.DebugPrint("Registered Tracked Item: " + trackedItem.What + " value: " + trackedItem.Value);
|
Logger.DebugPrint("Registered Tracked Item: " + trackedItem.What + " value: " + trackedItem.Value);
|
||||||
}
|
}
|
||||||
|
int totalVets = gameData.vet.price_multipliers.Count;
|
||||||
|
for (int i = 0; i < totalVets; i++)
|
||||||
|
{
|
||||||
|
double cost = gameData.vet.price_multipliers[i].cost;
|
||||||
|
int id = gameData.vet.price_multipliers[i].id;
|
||||||
|
Vet vet = new Vet(id, cost);
|
||||||
|
Logger.DebugPrint("Registered Vet: " + vet.Id + " selling at: " + vet.PriceMultiplier);
|
||||||
|
}
|
||||||
HorseInfo.HorseNames = gameData.horses.names.ToObject<string[]>();
|
HorseInfo.HorseNames = gameData.horses.names.ToObject<string[]>();
|
||||||
|
|
||||||
Item.Present = gameData.item.special.present;
|
Item.Present = gameData.item.special.present;
|
||||||
|
@ -580,6 +587,16 @@ namespace HISP.Server
|
||||||
Messages.StatMiscNoneRecorded = gameData.messages.meta.misc_stats.no_stats_recorded;
|
Messages.StatMiscNoneRecorded = gameData.messages.meta.misc_stats.no_stats_recorded;
|
||||||
Messages.StatMiscEntryFormat = gameData.messages.meta.misc_stats.stat_format;
|
Messages.StatMiscEntryFormat = gameData.messages.meta.misc_stats.stat_format;
|
||||||
|
|
||||||
|
// Vet
|
||||||
|
Messages.VetServiceHorseFormat = gameData.messages.meta.vet.service_horse;
|
||||||
|
Messages.VetSerivcesNotNeeded = gameData.messages.meta.vet.not_needed;
|
||||||
|
Messages.VetApplyServicesFormat = gameData.messages.meta.vet.apply;
|
||||||
|
|
||||||
|
Messages.VetApplyServicesForAllFormat = gameData.messages.meta.vet.apply_all;
|
||||||
|
Messages.VetFullHealthRecoveredMessageFormat = gameData.messages.meta.vet.now_full_health;
|
||||||
|
Messages.VetServicesNotNeededAll = gameData.messages.meta.vet.not_needed_all;
|
||||||
|
Messages.VetAllFullHealthRecoveredMessage = gameData.messages.meta.vet.all_full;
|
||||||
|
|
||||||
// Pond
|
// Pond
|
||||||
Messages.PondHeader = gameData.messages.meta.pond.header;
|
Messages.PondHeader = gameData.messages.meta.pond.header;
|
||||||
Messages.PondGoFishing = gameData.messages.meta.pond.go_fishing;
|
Messages.PondGoFishing = gameData.messages.meta.pond.go_fishing;
|
||||||
|
|
Loading…
Add table
Reference in a new issue