fix hands calculation

This commit is contained in:
SilicaAndPina 2021-02-06 21:27:21 +13:00
parent be88fc102c
commit cb134800b9
3 changed files with 22 additions and 5 deletions

View file

@ -2,6 +2,7 @@
using HISP.Game.Items;
using System.Collections.Generic;
using System.Globalization;
namespace HISP.Game.Horse
{
@ -520,13 +521,27 @@ namespace HISP.Game.Horse
if(isBreedViewer)
return ((double)height / 4.00);
else
return ((double)height / 4.08);
{
int h1 = 0;
int h2 = 0;
for(int i = 0; i < height; i++)
{
h2++;
if (h2 == 4)
{
h2 = 0;
h1++;
}
}
double hands = double.Parse(h1 + "." + h2); // This is terrible. dont do this.
return hands;
}
}
public static string BreedViewerSwf(HorseInstance horse, string terrainTileType)
{
double hands = CalculateHands(horse.AdvancedStats.Height, true);
string swf = "breedviewer.swf?terrain=" + terrainTileType + "&breed=" + horse.Breed.Swf + "&color=" + horse.Color + "&hands=" + hands.ToString();
string swf = "breedviewer.swf?terrain=" + terrainTileType + "&breed=" + horse.Breed.Swf + "&color=" + horse.Color + "&hands=" + hands.ToString(CultureInfo.InvariantCulture);
if (horse.Equipment.Saddle != null)
swf += "&saddle=" + horse.Equipment.Saddle.EmbedSwf;
if (horse.Equipment.SaddlePad != null)

View file

@ -1,6 +1,7 @@
using HISP.Server;
using System;
using System.Drawing;
using System.Globalization;
namespace HISP.Game
{
@ -879,7 +880,7 @@ namespace HISP.Game
}
public static string FormatHorseHandsHigh(string color, string breed,string sex, double handsHigh)
{
return HorseHandsHeightFormat.Replace("%COLOR%", color).Replace("%SEX%", sex).Replace("%HANDS%", handsHigh.ToString("0.0")).Replace("%BREED%", breed);
return HorseHandsHeightFormat.Replace("%COLOR%", color).Replace("%SEX%", sex).Replace("%HANDS%", handsHigh.ToString(CultureInfo.InvariantCulture)).Replace("%BREED%", breed);
}
public static string FormatHorseExperience(int experience)
{

View file

@ -8,6 +8,7 @@ using HISP.Game.Services;
using HISP.Game.SwfModules;
using HISP.Game.Horse;
using HISP.Game.Items;
using System.Globalization;
namespace HISP.Server
{
@ -524,7 +525,7 @@ namespace HISP.Server
double cost = gameData.services.vet.price_multipliers[i].cost;
int id = gameData.services.vet.price_multipliers[i].id;
Vet vet = new Vet(id, cost);
Logger.DebugPrint("Registered Vet: " + vet.Id + " selling at: " + vet.PriceMultiplier);
Logger.DebugPrint("Registered Vet: " + vet.Id + " selling at: " + vet.PriceMultiplier.ToString(CultureInfo.InvariantCulture));
}
int totalGroomers = gameData.services.groomer.price_multipliers.Count;
for (int i = 0; i < totalGroomers; i++)
@ -533,7 +534,7 @@ namespace HISP.Server
int id = gameData.services.groomer.price_multipliers[i].id;
int max = gameData.services.groomer.price_multipliers[i].max;
Groomer groomer = new Groomer(id, cost, max);
Logger.DebugPrint("Registered Groomer: " + groomer.Id + " selling at: " + groomer.PriceMultiplier);
Logger.DebugPrint("Registered Groomer: " + groomer.Id + " selling at: " + groomer.PriceMultiplier.ToString(CultureInfo.InvariantCulture));
}
int totalBooks = gameData.books.Count;
for (int i = 0; i < totalBooks; i++)