mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Add ability to view horse list of other players if that player is not online- (Ranch)
This commit is contained in:
parent
9e7743e24d
commit
e9cee36b24
7 changed files with 421 additions and 169 deletions
|
@ -198,8 +198,8 @@
|
|||
"wagon":"<BR>^T6Your Wagon can take you to the nearest station.^D7|STATION^R1^H",
|
||||
"training_pen":"<BR>^T6You can train all your horses via the Pen^D13|TRAIN ALL^R1^H",
|
||||
"train_all":"You attempt to train all of your horses:",
|
||||
"train_success":"<BR>Training <B>%HORSENAME%</B>: +1SP +1ST +1CO +1AG +1EN +1exp",
|
||||
"train_cant_train":"<B>%HORSENAME%</B>: Horse needs to rest %TIME% game minutes.",
|
||||
"train_success":"<BR>Training <B>%HORSENAME%</B>: +%SPEED%SP +%STRENGTH%ST +%CONFORMATION%CO +%AGILITY%AG +%ENDURANCE%EN +%EXP%exp",
|
||||
"train_cant_train":"<BR><B>%HORSENAME%</B>: Horse needs to rest %TIME% game minutes.",
|
||||
"fully_rested":"<BR>You have a Barn. All of your horses are fully relaxed now.",
|
||||
"wagon_used":"Your wagon dropped you off at the nearest station."
|
||||
},
|
||||
|
@ -310,6 +310,10 @@
|
|||
"cant_release_currently_riding":"You cannot release the horse you are riding!",
|
||||
"released_horse":"You released the horse! It now roams Horse Isle freely. It will disappear in an hour.",
|
||||
"horse_bucked":"Your inexperienced horse has become frustrated and has <B>bucked you off</B>! (Horse gained 1exp)",
|
||||
|
||||
"auto_sell_success":"Horse %HORSENAME% Purchase Completed!",
|
||||
"auto_sell_insufficent_money":"You cannot afford that horse!",
|
||||
"auto_sell_toomany_horses":"You do not have any room for another horse. Barns on your ranch allow for more horses.",
|
||||
"allstats":{
|
||||
"all_stats_header":"<B>All of your horses' complete stats:</B>",
|
||||
"horse_name_entry":"<BR><BR><B>%HORSENAME%</B>: <I>%COLOR% %BREEDNAME% %SEX% (%EXP%exp)</I><BR>",
|
||||
|
@ -344,6 +348,7 @@
|
|||
},
|
||||
"horse_inventory":{
|
||||
"your_horse_format":"Your horse: <B>%NAME%:</B><BR>",
|
||||
"horse_others_format":"<B>%NAME%:</B><BR>",
|
||||
"description_format":" <I>%DESCRIPTION%</I>",
|
||||
"hands_high":"<BR>^H It is a %COLOR% %BREED% %SEX% standing %HANDS% hands high.<BR>",
|
||||
"experience":" It has earned %EXP% experience points.<BR>",
|
||||
|
@ -361,20 +366,23 @@
|
|||
|
||||
"no_auto_sell":"NO Auto-Sell",
|
||||
"auto_sell_format":"Auto-Selling: $%MONEY%",
|
||||
"change_auto_sell":"^D25|CHANGE AUTO-SELL",
|
||||
"set_auto_sell":"^D25|SET AUTO-SELL PRICE",
|
||||
"change_auto_sell":"^D25|CHANGE AUTO-SELL^R1",
|
||||
"set_auto_sell":"^D25|SET AUTO-SELL PRICE^R1",
|
||||
"auto_sell_others":"^T3[Auto-Sell: $%PRICE%]^D26|BUY HORSE^R1",
|
||||
"auto_sell":"^R1^T2[%AUTOSELL%]",
|
||||
"cannot_auto_sell_tacked":"^R1^T8Cannot set Auto-Sell on a Horse with Tack",
|
||||
"cannot_auto_sell_tacked":"^R1^T8Cannot set Auto-Sell on a Horse with Tack^R1",
|
||||
|
||||
"marked_as":"^R1^LHorse currently marked [%CATEGORY%]. Mark:^R1^D52c1|KEEPER^D52c2|TRAINING^D52c3|TRADING^D52c4|RETIRED^R1",
|
||||
"marked_as":"^LHorse currently marked [%CATEGORY%].%MARKOPTIONS%^R1",
|
||||
"marking_options":" Mark:^R1^D52c1|KEEPER^D52c2|TRAINING^D52c3|TRADING^D52c4|RETIRED",
|
||||
"horse_stats":"^H<B>HORSE STATS:</B><BR>",
|
||||
"wearing_tacked":"^H<B>WEARING/TACKED:</B><BR>",
|
||||
"tacked_format":"^I%ICON%^T5%NAME%^B4LN%ITEMID%^R1",
|
||||
"companion":"^H<B>COMPANION:</B><BR>",
|
||||
"companion_selected":"^I%ICON%^T5%NAME%^B4LN%ITEMID%^D6|CHANGE^R1",
|
||||
"companion_selected":"^I%ICON%^T5%NAME%^B4LN%ITEMID%%COMPANIONCHANGEBUTTON%",
|
||||
"companion_change_button":"^D6|CHANGE",
|
||||
"no_companion":"^T5Horse has no companion^D6|SELECT^R1",
|
||||
|
||||
"advanced_stats":"^H<B>ADVANCED STATS:</B><BR> Special treats:%SPOILED% Magic residue:%MAGICUSED%<BR>^AA",
|
||||
"advanced_stats":"^R1^H<B>ADVANCED STATS:</B><BR> Special treats:%SPOILED% Magic residue:%MAGICUSED%<BR>^AA",
|
||||
"breed_details":"^H<B>BREED DETAILS:</B><BR>Name: %BREED%<BR>Description: %DESCRIPTION%",
|
||||
"height_range":"<BR>Average Height Range: %MIN%-%MAX% hands<BR>",
|
||||
"possible_colors":"<BR>Possible Colors: %COLORS%<BR>",
|
||||
|
|
|
@ -83,7 +83,6 @@ namespace HISP.Game.Horse
|
|||
category = loadCategory;
|
||||
spoiled = loadSpoiled;
|
||||
magicUsed = loadMagicUsed;
|
||||
TrainTimer = 0;
|
||||
RanchId = 0;
|
||||
Leaser = 0;
|
||||
}
|
||||
|
@ -117,7 +116,21 @@ namespace HISP.Game.Horse
|
|||
}
|
||||
public string Sex;
|
||||
public string Color;
|
||||
public int TrainTimer;
|
||||
public int TrainTimer
|
||||
{
|
||||
get
|
||||
{
|
||||
int timeout = Database.GetHorseTrainTimeout(this.RandomId);
|
||||
if (timeout < 0)
|
||||
return 0;
|
||||
else
|
||||
return timeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
Database.SetHorseTrainTimeout(this.RandomId, value);
|
||||
}
|
||||
}
|
||||
public HorseInfo.Breed Breed;
|
||||
public HorseInfo.BasicStats BasicStats;
|
||||
public HorseInfo.AdvancedStats AdvancedStats;
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace HISP.Game
|
|||
public static string BuildingVegatableGarden;
|
||||
|
||||
public static string RanchTrainAllAttempt;
|
||||
public static string RanchTrainSuccess;
|
||||
public static string RanchTrainSuccessFormat;
|
||||
public static string RanchTrainCantTrain;
|
||||
public static string RanchHorsesFullyRested;
|
||||
public static string RanchWagonDroppedYouOff;
|
||||
|
@ -311,7 +311,8 @@ namespace HISP.Game
|
|||
public static string HorseBuckedYou;
|
||||
|
||||
public static string HorseRidingMessageFormat;
|
||||
public static string HorseNameFormat;
|
||||
public static string HorseNameYoursFormat;
|
||||
public static string HorseNameOthersFormat;
|
||||
public static string HorseDescriptionFormat;
|
||||
public static string HorseHandsHeightFormat;
|
||||
public static string HorseExperienceEarnedFormat;
|
||||
|
@ -333,6 +334,7 @@ namespace HISP.Game
|
|||
public static string HorseAutoSellPriceFormat;
|
||||
public static string HorseCantAutoSellTacked;
|
||||
public static string HorseCurrentlyCategoryFormat;
|
||||
public static string HorseMarkAsCategory;
|
||||
public static string HorseStats;
|
||||
public static string HorseTacked;
|
||||
public static string HorseTackFormat;
|
||||
|
@ -365,6 +367,7 @@ namespace HISP.Game
|
|||
|
||||
public static string HorseChangeAutoSell;
|
||||
public static string HorseSetAutoSell;
|
||||
public static string HorseCompanionChangeButton;
|
||||
|
||||
public static string HorseTackFailAutoSell;
|
||||
public static string HorseAreYouSureYouWantToReleaseFormat;
|
||||
|
@ -660,6 +663,15 @@ namespace HISP.Game
|
|||
|
||||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatRanchTrainFail(string horseName, int timeout)
|
||||
{
|
||||
return RanchTrainCantTrain.Replace("%HORSENAME%", horseName).Replace("%TIME%", timeout.ToString());
|
||||
}
|
||||
public static string FormatRanchTrain(string horseName, int speed, int strength, int conformation, int agility, int endurance, int exp)
|
||||
{
|
||||
return RanchTrainSuccessFormat.Replace("%HORSENAME%", horseName).Replace("%SPEED%", speed.ToString("N0")).Replace("%STRENGTH%", strength.ToString("N0")).Replace("%CONFORMATION%", conformation.ToString("N0")).Replace("%AGILITY%", agility.ToString("N0")).Replace("%ENDURANCE%", endurance.ToString("N0")).Replace("%EXP%", exp.ToString("N0"));
|
||||
}
|
||||
public static string FormatRanchDescOthers(string description)
|
||||
{
|
||||
return RanchDescriptionOthersFormat.Replace("%DESCRIPTION%", description);
|
||||
|
@ -742,7 +754,7 @@ namespace HISP.Game
|
|||
}
|
||||
public static string FormatTrainSuccess(string horseName)
|
||||
{
|
||||
return RanchTrainSuccess.Replace("%HORSENAME%", horseName);
|
||||
return RanchTrainSuccessFormat.Replace("%HORSENAME%", horseName);
|
||||
}
|
||||
public static string FormatCantTrain(string horseName)
|
||||
{
|
||||
|
@ -1044,9 +1056,13 @@ namespace HISP.Game
|
|||
|
||||
|
||||
|
||||
public static string FormatHorseName(string name)
|
||||
public static string FormatHorseNameYours(string name)
|
||||
{
|
||||
return HorseNameFormat.Replace("%NAME%", name);
|
||||
return HorseNameYoursFormat.Replace("%NAME%", name);
|
||||
}
|
||||
public static string FormatHorseNameOthers(string name)
|
||||
{
|
||||
return HorseNameOthersFormat.Replace("%NAME%", name);
|
||||
}
|
||||
public static string FormatHorseDescription(string Description)
|
||||
{
|
||||
|
@ -1099,17 +1115,17 @@ namespace HISP.Game
|
|||
return HorseAutoSellFormat.Replace("%AUTOSELL%", autoSellStr);
|
||||
}
|
||||
|
||||
public static string FormatHorseCategory(string category)
|
||||
public static string FormatHorseCategory(string category, string markAsCategoryButtons)
|
||||
{
|
||||
return HorseCurrentlyCategoryFormat.Replace("%CATEGORY%", category);
|
||||
return HorseCurrentlyCategoryFormat.Replace("%CATEGORY%", category).Replace("%MARKOPTIONS%", markAsCategoryButtons);
|
||||
}
|
||||
public static string FormatHorseTackEntry(int iconId, string name, int itemId)
|
||||
{
|
||||
return HorseTackFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", name).Replace("%ITEMID%", itemId.ToString());
|
||||
}
|
||||
public static string FormatHorseCompanionEntry(int iconId, string name, int itemId)
|
||||
public static string FormatHorseCompanionEntry(int iconId, string name, string companionChangeButton, int itemId)
|
||||
{
|
||||
return HorseCompanionFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", name).Replace("%ITEMID%", itemId.ToString());
|
||||
return HorseCompanionFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", name).Replace("%ITEMID%", itemId.ToString()).Replace("%COMPANIONCHANGEBUTTON%", companionChangeButton);
|
||||
}
|
||||
|
||||
public static string FormatHorseAdvancedStats(int spoiled, int magicUsed)
|
||||
|
|
|
@ -261,6 +261,30 @@ namespace HISP.Game
|
|||
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
private static string buildHorseListIndependantlyOfUserInstance(int userId)
|
||||
{
|
||||
string message = "";
|
||||
int i = 1;
|
||||
|
||||
|
||||
foreach (HorseInfo.Category category in HorseInfo.HorseCategories)
|
||||
{
|
||||
HorseInstance[] horsesInCategory = Database.GetPlayerHorsesInCategory(userId, category.Name);
|
||||
if (horsesInCategory.Length > 0)
|
||||
{
|
||||
message += category.MetaOthers;
|
||||
foreach (HorseInstance instance in horsesInCategory)
|
||||
{
|
||||
message += Messages.FormatHorseEntry(i, instance.Name, instance.Breed.Name, instance.RandomId, instance.AutoSell > 0);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message;
|
||||
|
||||
}
|
||||
public static string buildLibary()
|
||||
{
|
||||
|
@ -581,6 +605,34 @@ namespace HISP.Game
|
|||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string BuildRanchTraining(User user)
|
||||
{
|
||||
string message = "";
|
||||
message += Messages.RanchTrainAllAttempt;
|
||||
foreach(HorseInstance horse in user.HorseInventory.HorseList)
|
||||
{
|
||||
if(horse.TrainTimer == 0)
|
||||
{
|
||||
horse.AdvancedStats.Speed += 1;
|
||||
horse.AdvancedStats.Strength += 1;
|
||||
horse.AdvancedStats.Conformation += 1;
|
||||
horse.AdvancedStats.Agility += 1;
|
||||
horse.AdvancedStats.Endurance += 1;
|
||||
horse.BasicStats.Experience += 1;
|
||||
horse.TrainTimer = 720;
|
||||
message += Messages.FormatRanchTrain(horse.Name, 1, 1, 1, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
message += Messages.FormatRanchTrainFail(horse.Name, horse.TrainTimer);
|
||||
}
|
||||
}
|
||||
message += Messages.BackToMap;
|
||||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string BuildTransportInfo(User user, Transport.TransportPoint transportPoint)
|
||||
{
|
||||
string message = "";
|
||||
|
@ -1087,13 +1139,24 @@ namespace HISP.Game
|
|||
{
|
||||
string message = "";
|
||||
message += Messages.FormatViewBuilding(upgrade.Title, upgrade.Description);
|
||||
|
||||
message += Messages.BackToMap;
|
||||
return message;
|
||||
}
|
||||
public static string BuildRanchBuilding(Ranch ranch, Ranch.RanchBuilding upgrade)
|
||||
public static string BuildRanchBuilding(Ranch ranch, Ranch.RanchBuilding building)
|
||||
{
|
||||
string message = "";
|
||||
message += Messages.FormatViewBuilding(upgrade.Title, upgrade.Description);
|
||||
message += Messages.FormatViewBuilding(building.Title, building.Description);
|
||||
if(building.Id == 1 || building.Id == 10 || building.Id == 11) // Barn, Big Barn, Gold Barn
|
||||
{
|
||||
int ranchOwner = ranch.OwnerId; // TOCTOU BAD
|
||||
|
||||
if (ranchOwner != -1)
|
||||
{
|
||||
string horsesList = buildHorseListIndependantlyOfUserInstance(ranchOwner);
|
||||
message += Messages.FormatBarn(horsesList);
|
||||
}
|
||||
}
|
||||
message += Messages.BackToMap;
|
||||
return message;
|
||||
}
|
||||
|
@ -1402,7 +1465,7 @@ namespace HISP.Game
|
|||
}
|
||||
return Messages.FormatAbuseReportMetaPage(reportReasons);
|
||||
}
|
||||
private static string buildHorseList(User user)
|
||||
private static string buildHorseList(User user, bool youView=true)
|
||||
{
|
||||
string message = "";
|
||||
int i = 1;
|
||||
|
@ -1411,7 +1474,10 @@ namespace HISP.Game
|
|||
HorseInstance[] horsesInCategory = user.HorseInventory.GetHorsesInCategory(category);
|
||||
if (horsesInCategory.Length > 0)
|
||||
{
|
||||
message += category.Meta;
|
||||
if (youView)
|
||||
message += category.Meta;
|
||||
else
|
||||
message += category.MetaOthers;
|
||||
foreach (HorseInstance instance in horsesInCategory)
|
||||
{
|
||||
message += Messages.FormatHorseEntry(i, instance.Name, instance.Breed.Name, instance.RandomId, instance.AutoSell > 0);
|
||||
|
@ -1569,8 +1635,14 @@ namespace HISP.Game
|
|||
}
|
||||
public static string BuildHorseInformation(HorseInstance horse, User user)
|
||||
{
|
||||
bool isMyHorse = horse.Owner == user.Id;
|
||||
|
||||
string message = "";
|
||||
message += Messages.FormatHorseName(horse.Name);
|
||||
if (isMyHorse)
|
||||
message += Messages.FormatHorseNameYours(horse.Name);
|
||||
else
|
||||
message += Messages.FormatHorseNameOthers(horse.Name);
|
||||
|
||||
message += Messages.FormatHorseDescription(horse.Description);
|
||||
message += Messages.FormatHorseHandsHigh(horse.Color, horse.Breed.Name, horse.Sex, HorseInfo.CalculateHands(horse.AdvancedStats.Height, false));
|
||||
message += Messages.FormatHorseExperience(horse.BasicStats.Experience);
|
||||
|
@ -1580,36 +1652,46 @@ namespace HISP.Game
|
|||
else
|
||||
message += Messages.HorseIsTrainable;
|
||||
|
||||
if (user.CurrentlyRidingHorse == null)
|
||||
message += Messages.FormatMountButton(horse.RandomId);
|
||||
else
|
||||
message += Messages.FormatDisMountButton(horse.RandomId);
|
||||
|
||||
message += Messages.FormatFeedButton(horse.RandomId);
|
||||
message += Messages.FormatTackButton(horse.RandomId);
|
||||
message += Messages.FormatPetButton(horse.RandomId);
|
||||
message += Messages.FormatProfileButton(horse.RandomId);
|
||||
|
||||
if (horse.Equipment.Saddle == null && horse.Equipment.SaddlePad == null && horse.Equipment.Bridle == null && horse.Equipment.Companion == null)
|
||||
if(isMyHorse)
|
||||
{
|
||||
string autoSellMessage = Messages.HorseNoAutoSell;
|
||||
if (horse.AutoSell > 0)
|
||||
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
||||
message += Messages.FormatAutoSell(autoSellMessage);
|
||||
if (horse.AutoSell > 0)
|
||||
message += Messages.HorseChangeAutoSell;
|
||||
if (user.CurrentlyRidingHorse == null)
|
||||
message += Messages.FormatMountButton(horse.RandomId);
|
||||
else
|
||||
message += Messages.HorseSetAutoSell;
|
||||
}
|
||||
else
|
||||
{
|
||||
message += Messages.HorseCantAutoSellTacked;
|
||||
message += Messages.FormatDisMountButton(horse.RandomId);
|
||||
|
||||
|
||||
message += Messages.FormatFeedButton(horse.RandomId);
|
||||
message += Messages.FormatTackButton(horse.RandomId);
|
||||
message += Messages.FormatPetButton(horse.RandomId);
|
||||
message += Messages.FormatProfileButton(horse.RandomId);
|
||||
|
||||
if (horse.Equipment.Saddle == null && horse.Equipment.SaddlePad == null && horse.Equipment.Bridle == null && horse.Equipment.Companion == null)
|
||||
{
|
||||
string autoSellMessage = Messages.HorseNoAutoSell;
|
||||
if (horse.AutoSell > 0)
|
||||
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
||||
message += Messages.FormatAutoSell(autoSellMessage);
|
||||
if (horse.AutoSell > 0)
|
||||
message += Messages.HorseChangeAutoSell;
|
||||
else
|
||||
message += Messages.HorseSetAutoSell;
|
||||
}
|
||||
else
|
||||
{
|
||||
message += Messages.HorseCantAutoSellTacked;
|
||||
}
|
||||
}
|
||||
|
||||
message += Messages.FormatHorseCategory(horse.Category);
|
||||
|
||||
|
||||
if(isMyHorse)
|
||||
message += Messages.FormatHorseCategory(horse.Category, Messages.HorseMarkAsCategory);
|
||||
else
|
||||
message += Messages.FormatHorseCategory(horse.Category, "");
|
||||
|
||||
message += Messages.HorseStats;
|
||||
|
||||
// What is energy?
|
||||
// Energy == Tiredness
|
||||
message += Messages.FormatHorseBasicStat(horse.BasicStats.Health, horse.BasicStats.Hunger, horse.BasicStats.Thirst, horse.BasicStats.Mood, horse.BasicStats.Tiredness, horse.BasicStats.Groom, horse.BasicStats.Shoes);
|
||||
message += Messages.HorseTacked;
|
||||
|
||||
|
@ -1623,9 +1705,13 @@ namespace HISP.Game
|
|||
|
||||
message += Messages.HorseCompanion;
|
||||
if (horse.Equipment.Companion != null)
|
||||
message += Messages.FormatHorseCompanionEntry(horse.Equipment.Companion.IconId, horse.Equipment.Companion.Name, horse.Equipment.Companion.Id);
|
||||
if(isMyHorse)
|
||||
message += Messages.FormatHorseCompanionEntry(horse.Equipment.Companion.IconId, horse.Equipment.Companion.Name, Messages.HorseCompanionChangeButton, horse.Equipment.Companion.Id);
|
||||
else
|
||||
message += Messages.FormatHorseCompanionEntry(horse.Equipment.Companion.IconId, horse.Equipment.Companion.Name, "", horse.Equipment.Companion.Id);
|
||||
else
|
||||
message += Messages.HorseNoCompanion;
|
||||
if(isMyHorse)
|
||||
message += Messages.HorseNoCompanion;
|
||||
|
||||
message += Messages.FormatHorseAdvancedStats(horse.Spoiled, horse.MagicUsed);
|
||||
|
||||
|
@ -1650,23 +1736,30 @@ namespace HISP.Game
|
|||
|
||||
message += Messages.FormatPossibleColors(horse.Breed.Colors);
|
||||
|
||||
bool canRelease = true;
|
||||
if(World.InTown(user.X, user.Y))
|
||||
canRelease = false;
|
||||
|
||||
|
||||
if (World.InSpecialTile(user.X, user.Y))
|
||||
if(isMyHorse)
|
||||
{
|
||||
World.SpecialTile tile = World.GetSpecialTile(user.X, user.Y);
|
||||
if (tile.Code != null)
|
||||
bool canRelease = true;
|
||||
if (World.InTown(user.X, user.Y))
|
||||
canRelease = false;
|
||||
|
||||
|
||||
if (World.InSpecialTile(user.X, user.Y))
|
||||
{
|
||||
World.SpecialTile tile = World.GetSpecialTile(user.X, user.Y);
|
||||
if (tile.Code != null)
|
||||
canRelease = false;
|
||||
}
|
||||
|
||||
if (canRelease)
|
||||
message += Messages.HorseReleaseButton;
|
||||
}
|
||||
|
||||
if(canRelease)
|
||||
message += Messages.HorseReleaseButton;
|
||||
|
||||
message += Messages.HorseOthers;
|
||||
message += buildHorseList(user);
|
||||
if (isMyHorse)
|
||||
message += buildHorseList(user);
|
||||
else
|
||||
message += buildHorseListIndependantlyOfUserInstance(horse.Owner);
|
||||
|
||||
message += Messages.BackToMapHorse;
|
||||
message += Messages.MetaTerminator;
|
||||
|
|
|
@ -1420,6 +1420,60 @@ namespace HISP.Server
|
|||
|
||||
}
|
||||
|
||||
public static HorseInstance ReadHorseInstance(MySqlDataReader reader)
|
||||
{
|
||||
int randomId = reader.GetInt32(0);
|
||||
int breedId = reader.GetInt32(4);
|
||||
|
||||
HorseInfo.Breed horseBreed = HorseInfo.GetBreedById(breedId);
|
||||
string name = reader.GetString(5);
|
||||
string description = reader.GetString(6);
|
||||
int spoiled = reader.GetInt32(32);
|
||||
string category = reader.GetString(31);
|
||||
int magicUsed = reader.GetInt32(33);
|
||||
int autosell = reader.GetInt32(29);
|
||||
|
||||
|
||||
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell);
|
||||
inst.Owner = reader.GetInt32(1);
|
||||
inst.RanchId = reader.GetInt32(2);
|
||||
inst.Leaser = reader.GetInt32(3);
|
||||
inst.Sex = reader.GetString(7);
|
||||
inst.Color = reader.GetString(8);
|
||||
|
||||
|
||||
int health = reader.GetInt32(9);
|
||||
int shoes = reader.GetInt32(10);
|
||||
int hunger = reader.GetInt32(11);
|
||||
int thirst = reader.GetInt32(12);
|
||||
int mood = reader.GetInt32(13);
|
||||
int groom = reader.GetInt32(14);
|
||||
int tiredness = reader.GetInt32(15);
|
||||
int experience = reader.GetInt32(16);
|
||||
inst.BasicStats = new HorseInfo.BasicStats(inst, health, shoes, hunger, thirst, mood, groom, tiredness, experience);
|
||||
|
||||
|
||||
int speed = reader.GetInt32(17);
|
||||
int strength = reader.GetInt32(18);
|
||||
int conformation = reader.GetInt32(19);
|
||||
int agility = reader.GetInt32(20);
|
||||
int endurance = reader.GetInt32(21);
|
||||
int inteligence = reader.GetInt32(22);
|
||||
int personality = reader.GetInt32(23);
|
||||
int height = reader.GetInt32(24);
|
||||
inst.AdvancedStats = new HorseInfo.AdvancedStats(inst, speed, strength, conformation, agility, inteligence, endurance, personality, height);
|
||||
|
||||
if (!reader.IsDBNull(25))
|
||||
inst.Equipment.Saddle = Item.GetItemById(reader.GetInt32(25));
|
||||
if (!reader.IsDBNull(26))
|
||||
inst.Equipment.SaddlePad = Item.GetItemById(reader.GetInt32(26));
|
||||
if (!reader.IsDBNull(27))
|
||||
inst.Equipment.Bridle = Item.GetItemById(reader.GetInt32(27));
|
||||
if (!reader.IsDBNull(28))
|
||||
inst.Equipment.Companion = Item.GetItemById(reader.GetInt32(28));
|
||||
return inst;
|
||||
}
|
||||
|
||||
public static void LoadHorseInventory(HorseInventory inv, int playerId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
|
@ -1433,58 +1487,7 @@ namespace HISP.Server
|
|||
|
||||
while (reader.Read())
|
||||
{
|
||||
int randomId = reader.GetInt32(0);
|
||||
int breedId = reader.GetInt32(4);
|
||||
|
||||
HorseInfo.Breed horseBreed = HorseInfo.GetBreedById(breedId);
|
||||
string name = reader.GetString(5);
|
||||
string description = reader.GetString(6);
|
||||
int spoiled = reader.GetInt32(32);
|
||||
string category = reader.GetString(31);
|
||||
int magicUsed = reader.GetInt32(33);
|
||||
int autosell = reader.GetInt32(29);
|
||||
|
||||
|
||||
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell);
|
||||
inst.Owner = reader.GetInt32(1);
|
||||
inst.RanchId = reader.GetInt32(2);
|
||||
inst.Leaser = reader.GetInt32(3);
|
||||
inst.Sex = reader.GetString(7);
|
||||
inst.Color = reader.GetString(8);
|
||||
|
||||
|
||||
int health = reader.GetInt32(9);
|
||||
int shoes = reader.GetInt32(10);
|
||||
int hunger = reader.GetInt32(11);
|
||||
int thirst = reader.GetInt32(12);
|
||||
int mood = reader.GetInt32(13);
|
||||
int groom = reader.GetInt32(14);
|
||||
int tiredness = reader.GetInt32(15);
|
||||
int experience = reader.GetInt32(16);
|
||||
inst.BasicStats = new HorseInfo.BasicStats(inst, health, shoes, hunger, thirst, mood, groom, tiredness, experience);
|
||||
|
||||
|
||||
int speed = reader.GetInt32(17);
|
||||
int strength = reader.GetInt32(18);
|
||||
int conformation = reader.GetInt32(19);
|
||||
int agility = reader.GetInt32(20);
|
||||
int endurance = reader.GetInt32(21);
|
||||
int inteligence = reader.GetInt32(22);
|
||||
int personality = reader.GetInt32(23);
|
||||
int height = reader.GetInt32(24);
|
||||
inst.AdvancedStats = new HorseInfo.AdvancedStats(inst, speed, strength, conformation, agility, inteligence, endurance, personality, height);
|
||||
|
||||
if (!reader.IsDBNull(25))
|
||||
inst.Equipment.Saddle = Item.GetItemById(reader.GetInt32(25));
|
||||
if (!reader.IsDBNull(26))
|
||||
inst.Equipment.SaddlePad = Item.GetItemById(reader.GetInt32(26));
|
||||
if (!reader.IsDBNull(27))
|
||||
inst.Equipment.Bridle = Item.GetItemById(reader.GetInt32(27));
|
||||
if (!reader.IsDBNull(28))
|
||||
inst.Equipment.Companion = Item.GetItemById(reader.GetInt32(28));
|
||||
|
||||
inst.TrainTimer = reader.GetInt32(30);
|
||||
inv.AddHorse(inst, false);
|
||||
inv.AddHorse(ReadHorseInstance(reader), false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2145,6 +2148,95 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void DecHorseTrainTimeout()
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Horses SET trainTimer=trainTimer-1 WHERE trainTimer-1 > -1";
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static HorseInstance[] GetPlayerHorsesInCategory(int playerId, string category)
|
||||
{
|
||||
|
||||
List<HorseInstance> instances = new List<HorseInstance>();
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT * FROM Horses WHERE ownerId=@playerId AND category=@category";
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Parameters.AddWithValue("@category", category);
|
||||
sqlCommand.Prepare();
|
||||
MySqlDataReader reader = sqlCommand.ExecuteReader();
|
||||
while(reader.Read())
|
||||
{
|
||||
instances.Add(ReadHorseInstance(reader));
|
||||
}
|
||||
sqlCommand.Dispose();
|
||||
return instances.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static HorseInstance GetPlayerHorse(int horseRandomId)
|
||||
{
|
||||
HorseInstance instance = null;
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT * FROM Horses WHERE randomId=@horseRandomId";
|
||||
sqlCommand.Parameters.AddWithValue("@horseRandomId", horseRandomId);
|
||||
sqlCommand.Prepare();
|
||||
MySqlDataReader reader = sqlCommand.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
instance = ReadHorseInstance(reader);
|
||||
break;
|
||||
}
|
||||
|
||||
sqlCommand.Dispose();
|
||||
if (instance == null)
|
||||
throw new KeyNotFoundException();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetHorseTrainTimeout(int horseRandomId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "SELECT trainTimer FROM Horses WHERE randomId=@randomId";
|
||||
sqlCommand.Parameters.AddWithValue("@randomId", horseRandomId);
|
||||
sqlCommand.Prepare();
|
||||
int trainTimer = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||
sqlCommand.Dispose();
|
||||
return trainTimer;
|
||||
}
|
||||
}
|
||||
public static void SetHorseTrainTimeout(int horseRandomId, int trainTimeout)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Horses SET trainTimer=@trainTimer WHERE randomId=@randomId";
|
||||
sqlCommand.Parameters.AddWithValue("@trainTimer", trainTimeout);
|
||||
sqlCommand.Parameters.AddWithValue("@randomId", horseRandomId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetHorseCategory(int horseRandomId, string Category)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
|
|
|
@ -722,7 +722,7 @@ namespace HISP.Server
|
|||
Messages.BuildingVegatableGarden = gameData.messages.meta.ranch.special.vegatable_garden;
|
||||
|
||||
Messages.RanchTrainAllAttempt = gameData.messages.meta.ranch.special.train_all;
|
||||
Messages.RanchTrainSuccess = gameData.messages.meta.ranch.special.train_success;
|
||||
Messages.RanchTrainSuccessFormat = gameData.messages.meta.ranch.special.train_success;
|
||||
Messages.RanchTrainCantTrain = gameData.messages.meta.ranch.special.train_cant_train;
|
||||
Messages.RanchHorsesFullyRested = gameData.messages.meta.ranch.special.fully_rested;
|
||||
Messages.RanchWagonDroppedYouOff = gameData.messages.meta.ranch.special.wagon_used;
|
||||
|
@ -938,7 +938,8 @@ namespace HISP.Server
|
|||
Messages.HorseBuckedYou = gameData.messages.meta.horse.horse_bucked;
|
||||
|
||||
Messages.HorseRidingMessageFormat = gameData.messages.meta.horse.riding_message;
|
||||
Messages.HorseNameFormat = gameData.messages.meta.horse.horse_inventory.your_horse_format;
|
||||
Messages.HorseNameYoursFormat = gameData.messages.meta.horse.horse_inventory.your_horse_format;
|
||||
Messages.HorseNameOthersFormat = gameData.messages.meta.horse.horse_inventory.horse_others_format;
|
||||
Messages.HorseDescriptionFormat = gameData.messages.meta.horse.horse_inventory.description_format;
|
||||
Messages.HorseHandsHeightFormat = gameData.messages.meta.horse.horse_inventory.hands_high;
|
||||
Messages.HorseExperienceEarnedFormat = gameData.messages.meta.horse.horse_inventory.experience;
|
||||
|
@ -962,12 +963,14 @@ namespace HISP.Server
|
|||
Messages.HorseCantAutoSellTacked = gameData.messages.meta.horse.horse_inventory.cannot_auto_sell_tacked;
|
||||
|
||||
Messages.HorseCurrentlyCategoryFormat = gameData.messages.meta.horse.horse_inventory.marked_as;
|
||||
Messages.HorseMarkAsCategory = gameData.messages.meta.horse.horse_inventory.marking_options;
|
||||
Messages.HorseStats = gameData.messages.meta.horse.horse_inventory.horse_stats;
|
||||
Messages.HorseTacked = gameData.messages.meta.horse.horse_inventory.wearing_tacked;
|
||||
Messages.HorseTackFormat = gameData.messages.meta.horse.horse_inventory.tacked_format;
|
||||
|
||||
Messages.HorseCompanion = gameData.messages.meta.horse.horse_inventory.companion;
|
||||
Messages.HorseCompanionFormat = gameData.messages.meta.horse.horse_inventory.companion_selected;
|
||||
Messages.HorseCompanionChangeButton = gameData.messages.meta.horse.companion_change_button;
|
||||
Messages.HorseNoCompanion = gameData.messages.meta.horse.horse_inventory.no_companion;
|
||||
|
||||
Messages.HorseAdvancedStatsFormat = gameData.messages.meta.horse.horse_inventory.advanced_stats;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace HISP.Server
|
|||
private static void onGameTick(object state)
|
||||
{
|
||||
World.TickWorldClock();
|
||||
|
||||
Database.DecHorseTrainTimeout();
|
||||
gameTimer.Change(gameTickSpeed, gameTickSpeed);
|
||||
}
|
||||
private static void onMinuteTick(object state)
|
||||
|
@ -166,11 +166,11 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
HorseInstance horseFeedInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
|
||||
sender.LoggedinUser.LastViewedHorse = horseInst;
|
||||
sender.LoggedinUser.LastViewedHorse = horseFeedInst;
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseFeedMenu(horseInst, sender.LoggedinUser));
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseFeedMenu(horseFeedInst, sender.LoggedinUser));
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
}
|
||||
|
@ -195,24 +195,24 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
sender.LoggedinUser.LastViewedHorse = horseInst;
|
||||
HorseInstance horsePetInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
sender.LoggedinUser.LastViewedHorse = horsePetInst;
|
||||
int randMoodAddition = RandomNumberGenerator.Next(1, 20);
|
||||
int randTiredMinus = RandomNumberGenerator.Next(1, 10);
|
||||
|
||||
|
||||
|
||||
string msgs = "";
|
||||
if (horseInst.BasicStats.Mood + randMoodAddition >= 1000)
|
||||
if (horsePetInst.BasicStats.Mood + randMoodAddition >= 1000)
|
||||
msgs += Messages.HorsePetTooHappy;
|
||||
if (horseInst.BasicStats.Tiredness - randTiredMinus <= 0)
|
||||
if (horsePetInst.BasicStats.Tiredness - randTiredMinus <= 0)
|
||||
msgs += Messages.HorsePetTooTired;
|
||||
|
||||
|
||||
|
||||
|
||||
horseInst.BasicStats.Tiredness -= randTiredMinus;
|
||||
horseInst.BasicStats.Mood += randMoodAddition;
|
||||
|
||||
horsePetInst.BasicStats.Tiredness -= randTiredMinus;
|
||||
horsePetInst.BasicStats.Mood += randMoodAddition;
|
||||
|
||||
byte[] petMessagePacket = PacketBuilder.CreateChat(Messages.FormatHorsePetMessage(msgs,randMoodAddition, randTiredMinus), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(petMessagePacket);
|
||||
|
@ -284,8 +284,8 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
sender.LoggedinUser.LastViewedHorse = horseInst;
|
||||
HorseInstance horseVetServiceInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
sender.LoggedinUser.LastViewedHorse = horseVetServiceInst;
|
||||
|
||||
if(World.InSpecialTile(sender.LoggedinUser.X, sender.LoggedinUser.Y))
|
||||
{
|
||||
|
@ -296,13 +296,13 @@ namespace HISP.Server
|
|||
int vetId = int.Parse(vetInfo[1]);
|
||||
|
||||
Vet vet = Vet.GetVetById(vetId);
|
||||
int price = vet.CalculatePrice(horseInst.BasicStats.Health);
|
||||
int price = vet.CalculatePrice(horseVetServiceInst.BasicStats.Health);
|
||||
if(sender.LoggedinUser.Money >= price)
|
||||
{
|
||||
horseInst.BasicStats.Health = 1000;
|
||||
horseVetServiceInst.BasicStats.Health = 1000;
|
||||
sender.LoggedinUser.Money -= price;
|
||||
|
||||
byte[] messagePacket = PacketBuilder.CreateChat(Messages.FormatVetHorseAtFullHealthMessage(horseInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] messagePacket = PacketBuilder.CreateChat(Messages.FormatVetHorseAtFullHealthMessage(horseVetServiceInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(messagePacket);
|
||||
}
|
||||
else
|
||||
|
@ -450,10 +450,10 @@ namespace HISP.Server
|
|||
}
|
||||
|
||||
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
HorseInstance horseReleaseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
if(sender.LoggedinUser.CurrentlyRidingHorse != null)
|
||||
{
|
||||
if(horseInst.RandomId == sender.LoggedinUser.CurrentlyRidingHorse.RandomId)
|
||||
if(horseReleaseInst.RandomId == sender.LoggedinUser.CurrentlyRidingHorse.RandomId)
|
||||
{
|
||||
byte[] errorChatPacket = PacketBuilder.CreateChat(Messages.HorseCantReleaseTheHorseYourRidingOn, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(errorChatPacket);
|
||||
|
@ -462,15 +462,15 @@ namespace HISP.Server
|
|||
|
||||
}
|
||||
|
||||
if (horseInst.Description == "")
|
||||
horseInst.Description += Messages.FormatHorseReleasedBy(sender.LoggedinUser.Username);
|
||||
if (horseReleaseInst.Description == "")
|
||||
horseReleaseInst.Description += Messages.FormatHorseReleasedBy(sender.LoggedinUser.Username);
|
||||
|
||||
Logger.InfoPrint(sender.LoggedinUser.Username + " RELEASED HORSE: " + horseInst.Name + " (a " + horseInst.Breed.Name + ").");
|
||||
Logger.InfoPrint(sender.LoggedinUser.Username + " RELEASED HORSE: " + horseReleaseInst.Name + " (a " + horseReleaseInst.Breed.Name + ").");
|
||||
|
||||
sender.LoggedinUser.HorseInventory.DeleteHorse(horseInst);
|
||||
new WildHorse(horseInst, sender.LoggedinUser.X, sender.LoggedinUser.Y, 60, true);
|
||||
sender.LoggedinUser.HorseInventory.DeleteHorse(horseReleaseInst);
|
||||
new WildHorse(horseReleaseInst, sender.LoggedinUser.X, sender.LoggedinUser.Y, 60, true);
|
||||
|
||||
sender.LoggedinUser.LastViewedHorse = horseInst;
|
||||
sender.LoggedinUser.LastViewedHorse = horseReleaseInst;
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseReleased());
|
||||
sender.SendPacket(metaPacket);
|
||||
|
@ -497,11 +497,11 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
HorseInstance horseTackInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
|
||||
sender.LoggedinUser.LastViewedHorse = horseInst;
|
||||
sender.LoggedinUser.LastViewedHorse = horseTackInst;
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildTackMenu(horseInst, sender.LoggedinUser));
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildTackMenu(horseTackInst, sender.LoggedinUser));
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
}
|
||||
|
@ -536,25 +536,25 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
HorseInstance horseDrinkInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
|
||||
if(horseInst.BasicStats.Health < 200)
|
||||
if(horseDrinkInst.BasicStats.Health < 200)
|
||||
{
|
||||
byte[] hpToLow = PacketBuilder.CreateChat(Messages.FormatPondHpLowMessage(horseInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] hpToLow = PacketBuilder.CreateChat(Messages.FormatPondHpLowMessage(horseDrinkInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(hpToLow);
|
||||
break;
|
||||
}
|
||||
|
||||
if(horseInst.BasicStats.Thirst < 1000)
|
||||
if(horseDrinkInst.BasicStats.Thirst < 1000)
|
||||
{
|
||||
horseInst.BasicStats.Thirst = 1000;
|
||||
byte[] drinkFull = PacketBuilder.CreateChat(Messages.FormatPondDrinkFull(horseInst.Name),PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
horseDrinkInst.BasicStats.Thirst = 1000;
|
||||
byte[] drinkFull = PacketBuilder.CreateChat(Messages.FormatPondDrinkFull(horseDrinkInst.Name),PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(drinkFull);
|
||||
|
||||
if(RandomNumberGenerator.Next(0, 100) < 25)
|
||||
{
|
||||
horseInst.BasicStats.Health -= 200;
|
||||
byte[] ohNoes = PacketBuilder.CreateChat(Messages.FormatPondDrinkOhNoes(horseInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
horseDrinkInst.BasicStats.Health -= 200;
|
||||
byte[] ohNoes = PacketBuilder.CreateChat(Messages.FormatPondDrinkOhNoes(horseDrinkInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(ohNoes);
|
||||
}
|
||||
|
||||
|
@ -562,7 +562,7 @@ namespace HISP.Server
|
|||
}
|
||||
else
|
||||
{
|
||||
byte[] notThirsty = PacketBuilder.CreateChat(Messages.FormatPondNotThirsty(horseInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] notThirsty = PacketBuilder.CreateChat(Messages.FormatPondNotThirsty(horseDrinkInst.Name), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(notThirsty);
|
||||
break;
|
||||
}
|
||||
|
@ -768,6 +768,7 @@ namespace HISP.Server
|
|||
sender.LoggedinUser.Facing %= 5;
|
||||
byte[] rideHorsePacket = PacketBuilder.CreateHorseRidePacket(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Facing, 10, true);
|
||||
sender.SendPacket(rideHorsePacket);
|
||||
sender.LoggedinUser.NoClip = false;
|
||||
|
||||
UpdateUserInfo(sender.LoggedinUser);
|
||||
}
|
||||
|
@ -793,24 +794,24 @@ namespace HISP.Server
|
|||
}
|
||||
if (sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
HorseInstance horseMountInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
|
||||
if(horseInst.Equipment.Saddle == null || horseInst.Equipment.SaddlePad == null || horseInst.Equipment.Bridle == null)
|
||||
if(horseMountInst.Equipment.Saddle == null || horseMountInst.Equipment.SaddlePad == null || horseMountInst.Equipment.Bridle == null)
|
||||
{
|
||||
byte[] horseNotTackedMessage = PacketBuilder.CreateChat(Messages.HorseCannotMountUntilTackedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(horseNotTackedMessage);
|
||||
break;
|
||||
}
|
||||
|
||||
string ridingHorseMessage = Messages.FormatHorseRidingMessage(horseInst.Name);
|
||||
string ridingHorseMessage = Messages.FormatHorseRidingMessage(horseMountInst.Name);
|
||||
byte[] ridingHorseMessagePacket = PacketBuilder.CreateChat(ridingHorseMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(ridingHorseMessagePacket);
|
||||
|
||||
sender.LoggedinUser.CurrentlyRidingHorse = horseInst;
|
||||
sender.LoggedinUser.CurrentlyRidingHorse = horseMountInst;
|
||||
|
||||
// Determine what sprite to use;
|
||||
int incBy = 0;
|
||||
switch(horseInst.Color)
|
||||
switch(horseMountInst.Color)
|
||||
{
|
||||
case "brown":
|
||||
incBy = 1;
|
||||
|
@ -846,34 +847,36 @@ namespace HISP.Server
|
|||
}
|
||||
|
||||
|
||||
if(horseInst.Breed.Type == "zebra")
|
||||
if(horseMountInst.Breed.Type == "zebra")
|
||||
{
|
||||
incBy = 11;
|
||||
}
|
||||
if(horseInst.Breed.Id == 5) // Appaloosa
|
||||
if(horseMountInst.Breed.Id == 5) // Appaloosa
|
||||
{
|
||||
if(horseInst.Color == "brown")
|
||||
if(horseMountInst.Color == "brown")
|
||||
incBy = 12;
|
||||
}
|
||||
if (horseInst.Breed.Type == "camel")
|
||||
if (horseMountInst.Breed.Type == "camel")
|
||||
{
|
||||
if (horseInst.Color == "brown")
|
||||
if (horseMountInst.Color == "brown")
|
||||
incBy = 13;
|
||||
if (horseInst.Color == "white")
|
||||
if (horseMountInst.Color == "white")
|
||||
incBy = 14;
|
||||
|
||||
}
|
||||
if (horseInst.Breed.Type == "unicorn")
|
||||
if (horseMountInst.Breed.Type == "unicorn")
|
||||
{
|
||||
incBy = 15;
|
||||
}
|
||||
if (horseInst.Breed.Type == "pegasus")
|
||||
if (horseMountInst.Breed.Type == "pegasus")
|
||||
{
|
||||
incBy = 16;
|
||||
sender.LoggedinUser.NoClip = true;
|
||||
}
|
||||
if(horseInst.Breed.Id == 170) // Unipeg
|
||||
if(horseMountInst.Breed.Id == 170) // Unipeg
|
||||
{
|
||||
incBy = 17;
|
||||
sender.LoggedinUser.NoClip = true;
|
||||
}
|
||||
|
||||
incBy *= 5;
|
||||
|
@ -896,6 +899,7 @@ namespace HISP.Server
|
|||
randomId = 0;
|
||||
packetStr = Encoding.UTF8.GetString(packet);
|
||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
||||
HorseInstance horseInst;
|
||||
try
|
||||
{
|
||||
randomId = int.Parse(randomIdStr);
|
||||
|
@ -908,13 +912,22 @@ namespace HISP.Server
|
|||
}
|
||||
if(sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
|
||||
{
|
||||
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
|
||||
UpdateHorseMenu(sender, horseInst);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.HackerPrint(sender.LoggedinUser.Username + " Tried to look at a non existant horse.");
|
||||
break;
|
||||
try
|
||||
{ // Not your horse? possibly viewed inside a ranch?
|
||||
horseInst = Database.GetPlayerHorse(randomId);
|
||||
UpdateHorseMenu(sender, horseInst);
|
||||
break;
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
Logger.HackerPrint(sender.LoggedinUser.Username + " Tried to look at a non existant horse.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1427,6 +1440,17 @@ namespace HISP.Server
|
|||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildMinigamesLibary());
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
case "13": // Train All (Ranch)
|
||||
if (sender.LoggedinUser.OwnedRanch != null)
|
||||
{
|
||||
if(sender.LoggedinUser.OwnedRanch.GetBuildingCount(6) > 0) // Training Pen
|
||||
{
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildRanchTraining(sender.LoggedinUser));
|
||||
sender.SendPacket(metaPacket);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "20": // Minigame Rankings
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildMinigameRankingsForUser(sender.LoggedinUser));
|
||||
|
@ -4790,7 +4814,10 @@ namespace HISP.Server
|
|||
{
|
||||
int TileID = Map.GetTileId(forClient.LoggedinUser.X, forClient.LoggedinUser.Y, false);
|
||||
string type = Map.TerrainTiles[TileID - 1].Type;
|
||||
forClient.LoggedinUser.LastViewedHorse = horseInst;
|
||||
|
||||
if(horseInst.Owner == forClient.LoggedinUser.Id)
|
||||
forClient.LoggedinUser.LastViewedHorse = horseInst;
|
||||
|
||||
forClient.LoggedinUser.MetaPriority = true;
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseInformation(horseInst, forClient.LoggedinUser));
|
||||
forClient.SendPacket(metaPacket);
|
||||
|
|
Loading…
Add table
Reference in a new issue