mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-12 07:59:48 +12:00
fix "a/an" and crashing
This commit is contained in:
parent
ff91d7bafb
commit
905dc1a6ce
5 changed files with 49 additions and 30 deletions
|
@ -518,7 +518,7 @@
|
||||||
"stat_format":"%BASE%;%COMPAINON%;%TACK%;%MAX%;",
|
"stat_format":"%BASE%;%COMPAINON%;%TACK%;%MAX%;",
|
||||||
"basic_stat_format":"^AB%HEALTH%;%HUNGER%;%THIRST%;%MOOD%;%ENERGY%;%GROOM%;%SHOES%;",
|
"basic_stat_format":"^AB%HEALTH%;%HUNGER%;%THIRST%;%MOOD%;%ENERGY%;%GROOM%;%SHOES%;",
|
||||||
"horses_here":"<B>HORSES HERE:</B><BR>",
|
"horses_here":"<B>HORSES HERE:</B><BR>",
|
||||||
"wild_horse":"^I252^T6%NAME%, It's a %BREED%^B3U%RANDOMID%^R1",
|
"wild_horse":"^I252^T6%NAME%, It's a%N% %BREED%^B3U%RANDOMID%^R1",
|
||||||
"cannot_mount_tacked":"Cannot ride horse until fully tacked.",
|
"cannot_mount_tacked":"Cannot ride horse until fully tacked.",
|
||||||
"dismount_because_tack":"You had to stop riding %HORSENAME% because it no longer had tack.",
|
"dismount_because_tack":"You had to stop riding %HORSENAME% because it no longer had tack.",
|
||||||
"horse_timer":"You have 60 seconds to capture the horse. Good luck!",
|
"horse_timer":"You have 60 seconds to capture the horse. Good luck!",
|
||||||
|
|
|
@ -12,6 +12,11 @@ namespace HISP.Game
|
||||||
|
|
||||||
// Mod isle
|
// Mod isle
|
||||||
public static string ModIsleMessage;
|
public static string ModIsleMessage;
|
||||||
|
|
||||||
|
// Auction House
|
||||||
|
public static string AuctionCurrentRunning;
|
||||||
|
|
||||||
|
|
||||||
// Warp Command
|
// Warp Command
|
||||||
public static string SuccessfullyWarpedToLocation;
|
public static string SuccessfullyWarpedToLocation;
|
||||||
public static string SuccessfullyWarpedToPlayer;
|
public static string SuccessfullyWarpedToPlayer;
|
||||||
|
@ -1599,9 +1604,9 @@ namespace HISP.Game
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string FormatWildHorse(string name, string breed, int randomId)
|
public static string FormatWildHorse(string name, string breed, int randomId, bool vowel)
|
||||||
{
|
{
|
||||||
return WildHorseFormat.Replace("%NAME%", name).Replace("%BREED%", breed).Replace("%RANDOMID%", randomId.ToString());
|
return WildHorseFormat.Replace("%NAME%", name).Replace("%BREED%", breed).Replace("%RANDOMID%", randomId.ToString()).Replace("%N%", vowel ? "n" : "");
|
||||||
}
|
}
|
||||||
public static string FormatHorseBreedPreview(string name, string description)
|
public static string FormatHorseBreedPreview(string name, string description)
|
||||||
{
|
{
|
||||||
|
|
|
@ -740,7 +740,8 @@ namespace HISP.Game
|
||||||
message = Messages.HorsesHere;
|
message = Messages.HorsesHere;
|
||||||
foreach (WildHorse horse in horses)
|
foreach (WildHorse horse in horses)
|
||||||
{
|
{
|
||||||
message += Messages.FormatWildHorse(horse.Instance.Name, horse.Instance.Breed.Name, horse.Instance.RandomId);
|
bool vowel = (horse.Instance.Breed.Name[0].ToString().ToLower() == "a" || horse.Instance.Breed.Name[0].ToString().ToLower() == "i" || horse.Instance.Breed.Name[0].ToString().ToLower() == "u" || horse.Instance.Breed.Name[0].ToString().ToLower() == "e" || horse.Instance.Breed.Name[0].ToString().ToLower() == "o");
|
||||||
|
message += Messages.FormatWildHorse(horse.Instance.Name, horse.Instance.Breed.Name, horse.Instance.RandomId, vowel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
|
|
|
@ -146,31 +146,43 @@ namespace HISP.Game
|
||||||
if (GameServer.GetUsersAt(this.X, this.Y, true, true).Length > 0)
|
if (GameServer.GetUsersAt(this.X, this.Y, true, true).Length > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int direction = GameServer.RandomNumberGenerator.Next(0, 3);
|
int tries = 0;
|
||||||
int tryX = this.X;
|
while(true)
|
||||||
int tryY = this.Y;
|
|
||||||
|
|
||||||
switch (direction)
|
|
||||||
{
|
{
|
||||||
case 0:
|
int direction = GameServer.RandomNumberGenerator.Next(0, 3);
|
||||||
tryX += 1;
|
int tryX = this.X;
|
||||||
break;
|
int tryY = this.Y;
|
||||||
case 1:
|
|
||||||
tryX -= 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
tryY += 1;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tryY -= 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canNpcBeHere(tryX, tryY))
|
switch (direction)
|
||||||
{
|
{
|
||||||
X = tryX;
|
case 0:
|
||||||
Y = tryY;
|
tryX += 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tryX -= 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tryY += 1;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
tryY -= 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canNpcBeHere(tryX, tryY))
|
||||||
|
{
|
||||||
|
X = tryX;
|
||||||
|
Y = tryY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tries++;
|
||||||
|
if (tries > 100) // yo stuck lol
|
||||||
|
{
|
||||||
|
Logger.ErrorPrint("NPC: " + this.Name + " is probably stuck (cant move after 100 tries)");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else // Is Scripted.
|
else // Is Scripted.
|
||||||
{
|
{
|
||||||
|
@ -292,8 +304,7 @@ namespace HISP.Game
|
||||||
Logger.DebugPrint("Making NPC's randomly wander.");
|
Logger.DebugPrint("Making NPC's randomly wander.");
|
||||||
foreach(NpcEntry npc in NpcList)
|
foreach(NpcEntry npc in NpcList)
|
||||||
{
|
{
|
||||||
if(GameServer.RandomNumberGenerator.Next(0,100) > 50)
|
npc.RandomWander();
|
||||||
npc.RandomWander();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1383,7 +1383,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
db.Open();
|
db.Open();
|
||||||
MySqlCommand sqlCommand = db.CreateCommand();
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
sqlCommand.CommandText = "INSERT INTO Horses VALUES(@randomId,@originalOwner,@leaseTime,@leaser,@breed,@name,@description,@sex,@color,@health,@shoes,@hunger,@thirst,@mood,@groom,@tiredness,@experience,@speed,@strength,@conformation,@agility,@endurance,@inteligence,@personality,@height,@saddle,@saddlepad,@bridle,@companion,@autosell,@training,@category,@spoiled,@magicused)";
|
sqlCommand.CommandText = "INSERT INTO Horses VALUES(@randomId,@originalOwner,@leaseTime,@leaser,@breed,@name,@description,@sex,@color,@health,@shoes,@hunger,@thirst,@mood,@groom,@tiredness,@experience,@speed,@strength,@conformation,@agility,@endurance,@inteligence,@personality,@height,@saddle,@saddlepad,@bridle,@companion,@autosell,@training,@category,@spoiled,@magicused,@hidden)";
|
||||||
|
|
||||||
sqlCommand.Parameters.AddWithValue("@randomId", horse.RandomId);
|
sqlCommand.Parameters.AddWithValue("@randomId", horse.RandomId);
|
||||||
sqlCommand.Parameters.AddWithValue("@originalOwner", horse.Owner);
|
sqlCommand.Parameters.AddWithValue("@originalOwner", horse.Owner);
|
||||||
|
@ -1443,6 +1443,8 @@ namespace HISP.Server
|
||||||
sqlCommand.Parameters.AddWithValue("@spoiled", horse.Spoiled);
|
sqlCommand.Parameters.AddWithValue("@spoiled", horse.Spoiled);
|
||||||
sqlCommand.Parameters.AddWithValue("@magicused", horse.MagicUsed);
|
sqlCommand.Parameters.AddWithValue("@magicused", horse.MagicUsed);
|
||||||
|
|
||||||
|
sqlCommand.Parameters.AddWithValue("@hidden", horse.Hidden ? "YES" : "NO");
|
||||||
|
|
||||||
sqlCommand.Prepare();
|
sqlCommand.Prepare();
|
||||||
sqlCommand.ExecuteNonQuery();
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
|
@ -1464,7 +1466,7 @@ namespace HISP.Server
|
||||||
int magicUsed = reader.GetInt32(33);
|
int magicUsed = reader.GetInt32(33);
|
||||||
int autosell = reader.GetInt32(29);
|
int autosell = reader.GetInt32(29);
|
||||||
int leaseTime = reader.GetInt32(2);
|
int leaseTime = reader.GetInt32(2);
|
||||||
bool hidden = reader.GetString(33) == "YES";
|
bool hidden = reader.GetString(34) == "YES";
|
||||||
|
|
||||||
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime);
|
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime);
|
||||||
inst.Owner = reader.GetInt32(1);
|
inst.Owner = reader.GetInt32(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue