diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json
index 6a57408..481bb9c 100644
--- a/DataCollection/gamedata.json
+++ b/DataCollection/gamedata.json
@@ -125,6 +125,7 @@
"exit_this_place":"^X",
"end_of_meta":"^Z",
"back_to_map":"^M",
+ "back_to_map_horse":"^MM",
"long_full_line":"^L",
"fountain":"Although it's not recommended, you could drink from this fountain if you are thirsty...^T6Drink from the public fountain. ^B1D^R1^X^Z",
"venus_flytrap_format":"The Giant Venus Flytrap chomped at you!
OUCH!!
It chomped your pocket, taking $%MONEY% with it!!",
@@ -132,6 +133,7 @@
"last_poet":"^R1^LLast Player Poet:%USERNAME% ^R1",
"horse":{
"stat_format":"%BASE%;%COMPAINON%;%TACK%;%MAX%;",
+ "basic_stat_format":"^AB%HEALTH%;%HUNGER%;%THIRST%;%MOOD%;%ENERGY%;%GROOM%;%SHOES%;^H",
"horses_here":"HORSES HERE:
",
"wild_horse":"^I252^T6%NAME%, It's a %BREED%^B3U%RANDOMID%^R1",
"horse_timer":"You have 60 seconds to capture the horse. Good luck!",
@@ -142,7 +144,41 @@
"update_category":"Horse set as %CATEGORY%",
"horse_format":"^I252^T7#%NUMB%: %NAME% (%BREED%) ^B3L%ID%^R1",
"view_basic_stats":"^T6View all of basic stats together:^D33|BASIC STATS^R1",
- "view_advanced_stats":"^T6View all advanced stats together:^D34|ALL STATS^R1"
+ "view_advanced_stats":"^T6View all advanced stats together:^D34|ALL STATS^R1",
+
+ "horse_inventory":{
+ "your_horse_format":"Your horse: %NAME%:
",
+ "released_by_format":" Released by %USERNAME%:Released by %USERNAME%:",
+ "hands_high":"
^H It is a %COLOR% %BREED% %SEX% standing %HANDS% hands high.
",
+ "experience":" It has earned %EXP% experience points.
",
+
+ "trainable_in":" Trainable again in %TIME%m.
",
+ "currently_trainable":" Currently trainable.
",
+
+ "mount_button":"^B3O%ID%",
+ "feed_button":"^B3F%ID%",
+ "tack_button":"^B3T%ID%",
+ "pet_button":"^B3P%ID%",
+ "profile_button":"^B3E%ID%",
+
+ "auto_sell":"^R1^T2[NO Auto-Sell]^D25|SET AUTO-SELL PRICE",
+ "cannot_auto_sell_tacked":"^R1^T8Cannot set Auto-Sell on a Horse with Tack",
+ "marked_as":"^R1^LHorse currently marked [KEEPER]. Mark:^R1^D52c1|KEEPER^D52c2|TRAINING^D52c3|TRADING^D52c4|RETIRED^R1",
+ "horse_stats":"^HHORSE STATS:
",
+ "wearing_tacked":"^HWEARING/TACKED:
",
+ "tacked_format":"^I%ICON%^T5%NAME%^B4LN%ITEMID%^R1",
+ "companion":"^HCOMPANION:
",
+ "companion_selected":"^I%ICON%^T5%NAME%^B4LN%ID%^D6|CHANGE^R1",
+ "no_companion":"^T5Horse has no companion^D6|SELECT^R1",
+
+ "advanced_stats":"^HADVANCED STATS:
Special treats:%SPOILED% Magic residue:%MAGICUSED%
",
+ "breed_details":"BREED DETAILS:
Name: %BREED%
Description: %DESCRIPTION%",
+ "height_range":"
Average Height Range: %MIN%-%MAX% hands
",
+ "possible_colors":"
Possible Colors: black,brown,chestnut,bay,grey,roan
",
+ "release_horse":"^D8|RELEASE HORSE^R1",
+ "other_horses":"^LOther Horses Owned:^R1",
+
+ },
},
"libary":{
"main_menu":"Welcome to the Library! You can research different subjects.
^T2Search Residents: ^D30|SEARCH NPC^R1^T2Search Ranches: ^D31|SEARCH RANCH^R1^T2Research Horses: ^D4|VIEW BREEDS^R1^T2Research Tack: ^D9|VIEW TACK^R1^T2Research Companions: ^D10|VIEW COMPANIONS^R1^T2Research Mini-Games: ^D12|VIEW MINIGAMES^R1^T2Research Locations: ^D22|VIEW LOCATIONS^R1^T2Research Awards: ^D23|VIEW AWARDS^R1^T2Read Books: ^D38|READ BOOKS^R1",
diff --git a/Horse Isle Server/Horse Isle Server/Game/Horse/HorseInfo.cs b/Horse Isle Server/Horse Isle Server/Game/Horse/HorseInfo.cs
index a368fbd..b655b78 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Horse/HorseInfo.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Horse/HorseInfo.cs
@@ -58,7 +58,27 @@ namespace HISP.Game.Horse
public static List HorseCategories = new List();
public static List Breeds = new List();
+ public static double CalculateHands(int height)
+ {
+ return ((double)height / 4.0);
+ }
+ public static string BreedViewerSwf(HorseInstance horse, string terrainTileType)
+ {
+ double hands = CalculateHands(horse.AdvancedStats.Height);
+ string swf = "breedviewer.swf?terrain=" + terrainTileType + "&breed=" + horse.Breed.Swf + "&color=" + horse.Color + "&hands=" + hands.ToString();
+ if (horse.Equipment.Saddle != null)
+ swf += "&saddle=" + horse.Equipment.Saddle.EmbedSwf;
+ if (horse.Equipment.SaddlePad != null)
+ swf += "&saddlepad=" + horse.Equipment.SaddlePad.EmbedSwf;
+ if (horse.Equipment.Bridle != null)
+ swf += "&bridle=" + horse.Equipment.Bridle.EmbedSwf;
+ if (horse.Equipment.Companion != null)
+ swf += "&companion=" + horse.Equipment.Companion.EmbedSwf;
+ swf += "&junk=";
+
+ return swf;
+ }
public static Breed GetBreedById(int id)
{
foreach(Breed breed in Breeds)
diff --git a/Horse Isle Server/Horse Isle Server/Game/Inventory/HorseInventory.cs b/Horse Isle Server/Horse Isle Server/Game/Inventory/HorseInventory.cs
index 1528606..8502c82 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Inventory/HorseInventory.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Inventory/HorseInventory.cs
@@ -24,6 +24,12 @@ namespace HISP.Game.Inventory
return 7; // will change when ranches are implemented.
}
}
+ public HorseInventory(User user)
+ {
+ baseUser = user;
+ Database.LoadHorseInventory(this, baseUser.Id);
+ }
+
public void AddHorse(HorseInstance horse, bool addToDb=true)
{
if (HorseList.Length + 1 > MaxHorses)
@@ -34,10 +40,27 @@ namespace HISP.Game.Inventory
Database.AddHorse(horse);
horsesList.Add(horse);
}
- public HorseInventory(User user)
- {
- baseUser = user;
- Database.LoadHorseInventory(this, baseUser.Id);
+
+ public bool HorseIdExist(int randomId)
+ {
+ try
+ {
+ GetHorseById(randomId);
+ return true;
+ }
+ catch(KeyNotFoundException)
+ {
+ return false;
+ }
+ }
+ public HorseInstance GetHorseById(int randomId)
+ {
+ foreach(HorseInstance inst in HorseList)
+ {
+ if (inst.RandomId == randomId)
+ return inst;
+ }
+ throw new KeyNotFoundException();
}
public HorseInstance[] GetHorsesInCategory(HorseInfo.Category category)
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
index 0865caa..0cd5fb8 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
@@ -99,15 +99,50 @@ namespace HISP.Server
byte method = packet[1];
switch(method)
{
- case PacketBuilder.PACKET_CLIENT_TERMINATOR: // 19 0a 00 (horse list)
+ case PacketBuilder.HORSE_LIST:
sender.LoggedinUser.MetaPriority = true;
byte[] metaTags = PacketBuilder.CreateMetaPacket(Meta.BuildHorseInventory(sender.LoggedinUser));
sender.SendPacket(metaTags);
+ break;
+ case PacketBuilder.HORSE_LOOK:
+ int randomId = 0;
+ string packetStr = Encoding.UTF8.GetString(packet);
+ string randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
+ try
+ {
+ randomId = int.Parse(randomIdStr);
+
+ }
+ catch (Exception)
+ {
+ Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid randomid to horse interaction packet ");
+ return;
+ }
+ if(sender.LoggedinUser.HorseInventory.HorseIdExist(randomId))
+ {
+ int TileID = Map.GetTileId(sender.LoggedinUser.X, sender.LoggedinUser.Y, false);
+ string type = Map.TerrainTiles[TileID - 1].Type;
+ HorseInstance horse = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
+ string loadSwf = HorseInfo.BreedViewerSwf(horse, type);
+
+
+ byte[] swfPacket = PacketBuilder.CreateSwfModulePacket(loadSwf, PacketBuilder.PACKET_SWF_MODULE_FORCE);
+ sender.SendPacket(swfPacket);
+
+ }
+ else
+ {
+ Logger.HackerPrint(sender.LoggedinUser.Username + " Tried to look at a non existant horse.");
+ break;
+ }
+
break;
case PacketBuilder.HORSE_ESCAPE:
if(WildHorse.DoesHorseExist(sender.LoggedinUser.CapturingHorseId))
{
WildHorse capturing = WildHorse.GetHorseById(sender.LoggedinUser.CapturingHorseId);
+ sender.LoggedinUser.CapturingHorseId = 0;
+
capturing.Escape();
Logger.InfoPrint(sender.LoggedinUser.Username + " Failed to capture: " + capturing.Instance.Breed.Name + " new location: " + capturing.X + ", " + capturing.Y);
@@ -123,8 +158,10 @@ namespace HISP.Server
if (WildHorse.DoesHorseExist(sender.LoggedinUser.CapturingHorseId))
{
WildHorse capturing = WildHorse.GetHorseById(sender.LoggedinUser.CapturingHorseId);
-
- try{
+ sender.LoggedinUser.CapturingHorseId = 0;
+
+ try
+ {
capturing.Capture(sender.LoggedinUser);
}
catch(InventoryFullException)
@@ -145,9 +182,9 @@ namespace HISP.Server
break;
case PacketBuilder.HORSE_TRY_CAPTURE:
- int randomId = 0;
- string packetStr = Encoding.UTF8.GetString(packet);
- string randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
+ randomId = 0;
+ packetStr = Encoding.UTF8.GetString(packet);
+ randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
try
{
randomId = int.Parse(randomIdStr);
diff --git a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
index 3eb4665..531035d 100644
--- a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
@@ -45,6 +45,8 @@ namespace HISP.Server
public const byte PACKET_WISH = 0x2C;
public const byte PACKET_SWFMODULE = 0x50;
+ public const byte HORSE_LIST = 0x0A;
+ public const byte HORSE_LOOK = 0x14;
public const byte HORSE_TRY_CAPTURE = 0x1C;
public const byte HORSE_ESCAPE = 0x1E;
public const byte HORSE_CAUGHT = 0x1D;