mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
map out horse breed options
This commit is contained in:
parent
6d3abac89a
commit
65f27553df
5 changed files with 129 additions and 11 deletions
|
@ -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!<BR><B>OUCH!!</B><BR>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":"<B>HORSES HERE:</B><BR>",
|
||||
"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: <B>%NAME%:</B><BR>",
|
||||
"released_by_format":" <I>Released by %USERNAME%:Released by %USERNAME%:</I>",
|
||||
"hands_high":"<BR>^H It is a %COLOR% %BREED% %SEX% standing %HANDS% hands high.<BR>",
|
||||
"experience":" It has earned %EXP% experience points.<BR>",
|
||||
|
||||
"trainable_in":" Trainable again in %TIME%m.<BR>",
|
||||
"currently_trainable":" Currently trainable.<BR>",
|
||||
|
||||
"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":"^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%ID%^D6|CHANGE^R1",
|
||||
"no_companion":"^T5Horse has no companion^D6|SELECT^R1",
|
||||
|
||||
"advanced_stats":"^H<B>ADVANCED STATS:</B><BR> Special treats:%SPOILED% Magic residue:%MAGICUSED%<BR>",
|
||||
"breed_details":"<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: black,brown,chestnut,bay,grey,roan<BR>",
|
||||
"release_horse":"^D8|RELEASE HORSE^R1",
|
||||
"other_horses":"^LOther Horses Owned:^R1",
|
||||
|
||||
},
|
||||
},
|
||||
"libary":{
|
||||
"main_menu":"Welcome to the Library! You can research different subjects.<BR>^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",
|
||||
|
|
|
@ -58,7 +58,27 @@ namespace HISP.Game.Horse
|
|||
|
||||
public static List<Category> HorseCategories = new List<Category>();
|
||||
public static List<Breed> Breeds = new List<Breed>();
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue