Add Training Pens

This commit is contained in:
SilicaAndPina 2021-02-16 01:08:54 +13:00
parent 99653314ed
commit 7b8583dcea
7 changed files with 274 additions and 13 deletions

View file

@ -76,6 +76,14 @@ namespace HISP.Game
public static string RanchHorsesFullyRested;
public static string RanchWagonDroppedYouOff;
// Training Pen
public static string TrainedInStatFormat;
public static string TrainerHeaderFormat;
public static string TrainerHorseEntryFormat;
public static string TrainerHorseFullyTrainedFormat;
public static string TrainerCantTrainAgainInFormat;
public static string TrainerCantAfford;
// Santa
public static string SantaHiddenText; // Text that claims that it costs $10 to wrap a present thats sent to the client but never displayed for some reason. also wrapping is free on pinto so IDEK.
public static string SantaWrapItemFormat;
@ -732,6 +740,28 @@ namespace HISP.Game
// Click
public static string NothingInterestingHere;
public static string FormatTrainerCantTrainAgainIn(int time)
{
return TrainerCantTrainAgainInFormat.Replace("%TIME%", time.ToString());
}
public static string FormatTrainerFullyTrained(string horseName, int curStat)
{
return TrainerHorseFullyTrainedFormat.Replace("%HORSENAME%", horseName).Replace("%STAT%", curStat.ToString());
}
public static string FormatTrainerTrainInEntry(string horseName, int curStat, int maxStat, int randomId)
{
return TrainerHorseEntryFormat.Replace("%HORSENAME%", horseName).Replace("%CURSTAT%", curStat.ToString()).Replace("%MAXSTAT%", maxStat.ToString()).Replace("%RANDOMID%", randomId.ToString());
}
public static string FormatTrainerHeaderFormat(string stat, int price, int amountInStat, int expamount)
{
return TrainerHeaderFormat.Replace("%STAT%", stat).Replace("%PRICE%", price.ToString("N0", CultureInfo.InvariantCulture)).Replace("%AMOUNT%", amountInStat.ToString("N0", CultureInfo.InvariantCulture)).Replace("%EXPAMOUNT%", expamount.ToString("N0", CultureInfo.InvariantCulture));
}
public static string FormatTrainedInStatFormat(string horseName, string stat)
{
return TrainedInStatFormat.Replace("%HORSENAME%", horseName).Replace("%STAT%", stat);
}
public static string FormatSantaOpenPresent(string itemName)
{
return SantaItemOpenedFormat.Replace("%ITEM%", itemName);
@ -1942,7 +1972,7 @@ namespace HISP.Game
}
public static string FormatDirectChatMessageForSender(string username,string toUsername, string message)
{
return DirectChatFormatForSender.Replace("%FROMUSER%", username).Replace("%TOUSER%", toUsername).Replace(" %MESSAGE%", message);
return DirectChatFormatForSender.Replace("%FROMUSER%", username).Replace("%TOUSER%", toUsername).Replace("%MESSAGE%", message);
}
public static string FormatIdleWarningMessage()
{

View file

@ -645,6 +645,7 @@ namespace HISP.Game
{
string message = "";
message += Messages.RanchTrainAllAttempt;
int horsesTrained = 0;
foreach(HorseInstance horse in user.HorseInventory.HorseList)
{
if(horse.BasicStats.Mood < 200)
@ -659,7 +660,8 @@ namespace HISP.Game
horse.AdvancedStats.Agility += 1;
horse.AdvancedStats.Endurance += 1;
horse.BasicStats.Experience += 1;
horse.TrainTimer = 720;
horse.TrainTimer = 720;
horsesTrained++;
message += Messages.FormatRanchTrain(horse.Name, 1, 1, 1, 1, 1, 1);
}
else
@ -1111,6 +1113,8 @@ namespace HISP.Game
if (user.BankInterest > user.BankMoney)
{
moneyMade = user.BankInterest - user.BankMoney;
if (moneyMade > 100000000)
moneyMade = 100000000;
user.BankMoney += moneyMade;
}
@ -1954,6 +1958,53 @@ namespace HISP.Game
message += Messages.MetaTerminator;
return message;
}
private static string buildTrainer(User user, Trainer trainer)
{
string message = "";
message += Messages.FormatTrainerHeaderFormat(trainer.ImprovesStat, trainer.MoneyCost, trainer.ImprovesAmount, trainer.ExperienceGained);
foreach (HorseInstance horse in user.HorseInventory.HorseList.OrderBy(o => o.Name).ToList())
{
HorseInfo.StatCalculator speedStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.SPEED);
HorseInfo.StatCalculator strengthStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.STRENGTH);
HorseInfo.StatCalculator conformationStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.CONFORMATION);
HorseInfo.StatCalculator agilityStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.AGILITY);
HorseInfo.StatCalculator enduranceStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.ENDURANCE);
HorseInfo.StatCalculator statCalculator;
switch (trainer.ImprovesStat.ToUpper())
{
case "SPEED":
statCalculator = speedStat;
break;
case "STRENGTH":
statCalculator = strengthStat;
break;
case "AGILITY":
statCalculator = agilityStat;
break;
case "ENDURANCE":
statCalculator = enduranceStat;
break;
case "CONFORMATION":
statCalculator = conformationStat;
break;
default:
statCalculator = speedStat;
break;
}
if(statCalculator.BreedValue < statCalculator.MaxValue)
message += Messages.FormatTrainerTrainInEntry(horse.Name, statCalculator.BreedValue, statCalculator.MaxValue, horse.RandomId);
else
message += Messages.FormatTrainerFullyTrained(horse.Name, statCalculator.BreedValue);
}
message += Messages.ExitThisPlace;
message += Messages.MetaTerminator;
return message;
}
private static string buildPawneer(User user)
{
string message = "";
@ -2065,6 +2116,10 @@ namespace HISP.Game
{
message += buildRiddlerRiddle(user);
}
if(TileCode == "TRAINER")
{
message += buildTrainer(user, Trainer.GetTrainerById(int.Parse(TileArg)));
}
if (TileCode == "LIBRARY")
{
message += buildLibary();

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HISP.Game.Services
{
public class Trainer
{
public static List<Trainer> Trainers = new List<Trainer>();
public int Id;
public string ImprovesStat;
public int ImprovesAmount;
public int ThirstCost;
public int MoodCost;
public int HungerCost;
public int MoneyCost;
public int ExperienceGained;
public static Trainer GetTrainerById(int id)
{
foreach (Trainer trainer in Trainers)
if (trainer.Id == id)
return trainer;
throw new KeyNotFoundException("Trainer " + id + " not found");
}
}
}