Add horse name list

This commit is contained in:
SilicaAndPina 2021-01-13 23:28:39 +13:00
parent 7500dc0230
commit b68103fa41
7 changed files with 1553 additions and 14 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using HISP.Server;
using System.Collections.Generic;
namespace HISP.Game.Horse
{
@ -56,8 +57,17 @@ namespace HISP.Game.Horse
public string Meta;
}
public static string[] HorseNames;
public static List<Category> HorseCategories = new List<Category>();
public static List<Breed> Breeds = new List<Breed>();
public static string GenerateHorseName()
{
int indx = 0;
int max = HorseNames.Length;
int i = GameServer.RandomNumberGenerator.Next(indx, max);
return HorseNames[i];
}
public static double CalculateHands(int height)
{
return ((double)height / 4.0);

View file

@ -179,7 +179,7 @@ namespace HISP.Game
public static string HorseRidingMessageFormat;
public static string HorseNameFormat;
public static string HorseReleasedByFormat;
public static string HorseDescriptionFormat;
public static string HorseHandsHeightFormat;
public static string HorseExperienceEarnedFormat;
@ -212,6 +212,7 @@ namespace HISP.Game
public static string HorseReleaseButton;
public static string HorseOthers;
public static string HorseDescriptionEditFormat;
public static string HorseEquipTackMessageFormat;
public static string HorseUnEquipTackMessageFormat;
@ -429,6 +430,10 @@ namespace HISP.Game
// Click
public static string NothingInterestingHere;
public static string FormatDescriptionEditMeta(string username, string description)
{
return HorseDescriptionEditFormat.Replace("%HORSENAME%", username).Replace("%DESCRIPTION%", description);
}
public static string FormatHorsePetMessage(int mood, int tiredness)
{
return HorsePetMessageFormat.Replace("%MOOD%", mood.ToString()).Replace("%TIREDNESS%", tiredness.ToString());
@ -488,9 +493,9 @@ namespace HISP.Game
{
return HorseNameFormat.Replace("%NAME%", name);
}
public static string FormatHorseReleasedBy(string name)
public static string FormatHorseDescription(string Description)
{
return HorseReleasedByFormat.Replace("%USERNAME%", name);
return HorseDescriptionFormat.Replace("%DESCRIPTION%", Description);
}
public static string FormatHorseHandsHigh(string color, string breed,string sex, int handsHigh)
{

View file

@ -989,12 +989,17 @@ namespace HISP.Game
message += Messages.BackToHorse;
return message;
}
public static string BuildHorseDescriptionEditMeta(HorseInstance horse)
{
string message = Messages.FormatDescriptionEditMeta(horse.Name, horse.Description);
message += Messages.BackToHorse;
return message;
}
public static string BuildHorseInformation(HorseInstance horse, User user)
{
string message = "";
message += Messages.FormatHorseName(horse.Name);
message += Messages.FormatHorseReleasedBy(Database.GetUsername(horse.Owner));
message += Messages.FormatHorseDescription(Database.GetUsername(horse.Owner));
message += Messages.FormatHorseHandsHigh(horse.Color, horse.Breed.Name, horse.Sex, Convert.ToInt32(Math.Floor(HorseInfo.CalculateHands(horse.AdvancedStats.Height))));
message += Messages.FormatHorseExperience(horse.BasicStats.Experience);

View file

@ -253,7 +253,7 @@ namespace HISP.Server
npcEntry.LibarySearchable = gameData.npc_list[i].libary_searchable;
npcEntry.IconId = gameData.npc_list[i].icon_id;
Logger.DebugPrint("\tNPC ID:" + npcEntry.Id.ToString() + " NAME: " + npcEntry.Name);
Logger.DebugPrint("NPC ID:" + npcEntry.Id.ToString() + " NAME: " + npcEntry.Name);
List<Npc.NpcChat> chats = new List<Npc.NpcChat>();
int totalNpcChat = gameData.npc_list[i].chatpoints.Count;
for (int ii = 0; ii < totalNpcChat; ii++)
@ -263,7 +263,7 @@ namespace HISP.Server
npcChat.ChatText = gameData.npc_list[i].chatpoints[ii].chat_text;
npcChat.ActivateQuestId = gameData.npc_list[i].chatpoints[ii].activate_questid;
Logger.DebugPrint("\t\tCHATPOINT ID: " + npcChat.Id.ToString() + " TEXT: " + npcChat.ChatText);
Logger.DebugPrint("CHATPOINT ID: " + npcChat.Id.ToString() + " TEXT: " + npcChat.ChatText);
int totalNpcReply = gameData.npc_list[i].chatpoints[ii].replies.Count;
List<Npc.NpcReply> replys = new List<Npc.NpcReply>();
for (int iii = 0; iii < totalNpcReply; iii++)
@ -279,7 +279,7 @@ namespace HISP.Server
if (gameData.npc_list[i].chatpoints[ii].replies[iii].requires_questid_not_completed != null)
npcReply.RequiresQuestIdNotCompleted = gameData.npc_list[i].chatpoints[ii].replies[iii].requires_questid_not_completed;
Logger.DebugPrint("\t\t\tREPLY ID: " + npcReply.Id.ToString() + " TEXT: " + npcReply.ReplyText);
Logger.DebugPrint("REPLY ID: " + npcReply.Id.ToString() + " TEXT: " + npcReply.ReplyText);
replys.Add(npcReply);
}
@ -408,7 +408,7 @@ namespace HISP.Server
reason.Name = gameData.messages.meta.abuse_report.reasons[i].name;
reason.Meta = gameData.messages.meta.abuse_report.reasons[i].meta;
AbuseReport.AddReason(reason);
Logger.DebugPrint("Reigstered Abuse Report Reason: " + reason.Name);
Logger.DebugPrint("Registered Abuse Report Reason: " + reason.Name);
}
// Map Data
@ -494,6 +494,8 @@ namespace HISP.Server
Logger.DebugPrint("Registering horse category type: " + category.Name);
}
HorseInfo.HorseNames = gameData.horses.names.ToObject<string[]>();
Item.Present = gameData.item.special.present;
Item.MailMessage = gameData.item.special.mail_message;
Item.DorothyShoes = gameData.item.special.dorothy_shoes;
@ -613,7 +615,7 @@ namespace HISP.Server
Messages.HorseRidingMessageFormat = gameData.messages.meta.horse.riding_message;
Messages.HorseNameFormat = gameData.messages.meta.horse.horse_inventory.your_horse_format;
Messages.HorseReleasedByFormat = gameData.messages.meta.horse.horse_inventory.released_by_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;
@ -648,6 +650,7 @@ namespace HISP.Server
Messages.HorseReleaseButton = gameData.messages.meta.horse.horse_inventory.release_horse;
Messages.HorseOthers = gameData.messages.meta.horse.horse_inventory.other_horses;
Messages.HorseDescriptionEditFormat = gameData.messages.meta.horse.description_edit;
Messages.HorseEquipTackMessageFormat = gameData.messages.meta.horse.equip_tack_message;
Messages.HorseUnEquipTackMessageFormat = gameData.messages.meta.horse.unequip_tack_message;
Messages.HorseStopRidingMessage = gameData.messages.meta.horse.stop_riding_message;

View file

@ -104,6 +104,26 @@ namespace HISP.Server
byte[] metaTags = PacketBuilder.CreateMetaPacket(Meta.BuildHorseInventory(sender.LoggedinUser));
sender.SendPacket(metaTags);
break;
case PacketBuilder.HORSE_PROFILE:
byte methodProfileEdit = packet[2];
if(methodProfileEdit == PacketBuilder.HORSE_PROFILE_EDIT)
{
if (sender.LoggedinUser.LastViewedHorse != null)
{
sender.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseDescriptionEditMeta(sender.LoggedinUser.LastViewedHorse));
sender.SendPacket(metaPacket);
}
else
{
Logger.ErrorPrint(sender.LoggedinUser.Username + "Trying to edit description of no horse");
}
}
else
{
Logger.InfoPrint(BitConverter.ToString(packet).Replace("-", " "));
}
break;
case PacketBuilder.HORSE_FEED:
int randomId = 0;
string packetStr = Encoding.UTF8.GetString(packet);
@ -151,8 +171,8 @@ namespace HISP.Server
{
HorseInstance horseInst = sender.LoggedinUser.HorseInventory.GetHorseById(randomId);
sender.LoggedinUser.LastViewedHorse = horseInst;
int randMoodAddition = RandomNumberGenerator.Next(0, 20);
int randTiredMinus = RandomNumberGenerator.Next(0, 10);
int randMoodAddition = RandomNumberGenerator.Next(1, 20);
int randTiredMinus = RandomNumberGenerator.Next(1, 10);
horseInst.BasicStats.Tiredness -= randTiredMinus;
horseInst.BasicStats.Mood += randMoodAddition;

View file

@ -50,6 +50,8 @@ namespace HISP.Server
public const byte HORSE_LOOK = 0x14;
public const byte HORSE_FEED = 0x15;
public const byte HORSE_PET = 0x18;
public const byte HORSE_PROFILE = 0x2C;
public const byte HORSE_PROFILE_EDIT = 0x14;
public const byte HORSE_TRY_CAPTURE = 0x1C;
public const byte HORSE_TACK = 0x16;
public const byte HORSE_GIVE_FEED = 0x1B;