mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 21:25:42 +12:00
check if cant afford services
This commit is contained in:
parent
c884ae1e3a
commit
c57d7079d9
3 changed files with 13 additions and 6 deletions
|
@ -136,7 +136,7 @@
|
|||
"vet":{
|
||||
"service_horse":"^LYour horse %HORSENAME%: health currently %CURHEALTH%/%MAXHEALTH%^R1",
|
||||
"not_needed":"^I257^T8Vet services are not needed for this horse.^R1",
|
||||
"apply":"^I257^T6Apply vet services for $%PRICE% ^B3V%RANDOMID%",
|
||||
"apply":"^I257^T6Apply vet services for $%PRICE% ^B3V%RANDOMID%^R1",
|
||||
"apply_all":"^R1^I257^T6Apply all vet services for $%PRICE% ^B3v^R1",
|
||||
|
||||
"now_full_health":"Your horse %HORSENAME% is now at full health!",
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace HISP.Game.Services
|
|||
public double PriceMultiplier;
|
||||
public int CalculatePrice(int health)
|
||||
{
|
||||
double price = ((double)health - 1000.0) * PriceMultiplier;
|
||||
return Convert.ToInt32(Math.Floor(price));
|
||||
double price = (1000.0 - (double)health) * PriceMultiplier;
|
||||
return Convert.ToInt32(Math.Round(price));
|
||||
}
|
||||
|
||||
public static Vet GetVetById(int id)
|
||||
|
|
|
@ -211,8 +211,13 @@ namespace HISP.Server
|
|||
|
||||
foreach (HorseInstance horse in sender.LoggedinUser.HorseInventory.HorseList)
|
||||
price += vet.CalculatePrice(horse.BasicStats.Health);
|
||||
|
||||
if (sender.LoggedinUser.Money >= price)
|
||||
if(price == 0)
|
||||
{
|
||||
byte[] notNeededMessagePacket = PacketBuilder.CreateChat(Messages.VetServicesNotNeededAll, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(notNeededMessagePacket);
|
||||
break;
|
||||
}
|
||||
else if (sender.LoggedinUser.Money >= price)
|
||||
{
|
||||
foreach (HorseInstance horse in sender.LoggedinUser.HorseInventory.HorseList)
|
||||
horse.BasicStats.Health = 1000;
|
||||
|
@ -227,7 +232,9 @@ namespace HISP.Server
|
|||
{
|
||||
byte[] cannotAffordMessagePacket = PacketBuilder.CreateChat(Messages.VetCannotAffordMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(cannotAffordMessagePacket);
|
||||
break;
|
||||
}
|
||||
UpdateArea(sender);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -276,9 +283,9 @@ namespace HISP.Server
|
|||
byte[] cantAffordMessage = PacketBuilder.CreateChat(Messages.VetCannotAffordMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(cantAffordMessage);
|
||||
}
|
||||
UpdateArea(sender);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue