diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 31e8bbc..f6b2706 100755 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -292,9 +292,7 @@ "breed_preview_format":"Viewing %NAME%:
%DESCRIPTION%^D4|RETURN TO BREED LIST^R2^H", "tack":{ "view_tack_set":"^I%ICONID%^T7View %SETNAME% Tack Set:^BM%SWF%^R1^H", - "set_peice_format":"%ITEMNAME%: %ITEMDESC%
[ BONUS: %BONUS% ]
", - "bonus_format":"+%BOOST% %STAT%", - "and":" & " + "set_peice_format":"%ITEMNAME%: %ITEMDESC%
", } }, "multiroom":{ diff --git a/Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs b/Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs index ba23473..8f60a91 100644 --- a/Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs @@ -16,6 +16,13 @@ namespace HISP.Game.Items tackItems = new List(); } + public int IconId + { + get + { + return GetSaddle().IconId; + } + } public string SetName; private List tackItems; public void Add(Item.ItemInformation item) @@ -23,6 +30,48 @@ namespace HISP.Game.Items Logger.DebugPrint("Added "+item.Name+" To Tack Set: "+this.SetName); tackItems.Add(item); } + + public Item.ItemInformation GetSaddle() + { + foreach(Item.ItemInformation tackItem in TackItems) + { + if(tackItem.MiscFlags[0] == 1) // Saddle + return tackItem; + } + throw new KeyNotFoundException("Saddle not found."); + } + + + public Item.ItemInformation GetSaddlePad() + { + foreach(Item.ItemInformation tackItem in TackItems) + { + if(tackItem.MiscFlags[0] == 2) // SaddlePad + return tackItem; + } + throw new KeyNotFoundException("SaddlePad not found."); + } + + public Item.ItemInformation GetBridle() + { + foreach(Item.ItemInformation tackItem in TackItems) + { + if(tackItem.MiscFlags[0] == 3) // Bridle + return tackItem; + } + throw new KeyNotFoundException("GetBridle not found."); + } + + public string[] GetSwfNames() + { + string[] swfs = new string[3]; + swfs[0] = GetSaddle().EmbedSwf; + swfs[1] = GetSaddlePad().EmbedSwf; + swfs[2] = GetBridle().EmbedSwf; + + return swfs; + } + public Item.ItemInformation[] TackItems { get @@ -37,7 +86,7 @@ namespace HISP.Game.Items return firstChar + str.Substring(1); } private static List tackSets = new List(); - public TackSet[] TackSets + public static TackSet[] TackSets { get { @@ -69,18 +118,24 @@ namespace HISP.Game.Items set.Add(itemInfo); } catch(KeyNotFoundException) - { - continue; + { + TackSet tackSet = new TackSet(); + tackSet.SetName = capitalizeFirstLetter(itemInfo.EmbedSwf); + Logger.DebugPrint("Created Tack Set: "+tackSet.SetName); + tackSet.Add(itemInfo); + tackSets.Add(tackSet); } - - TackSet tackSet = new TackSet(); - tackSet.SetName = capitalizeFirstLetter(itemInfo.EmbedSwf); - tackSet.Add(itemInfo); - tackSets.Add(tackSet); - Logger.DebugPrint("Created Tack Set: "+tackSet.SetName); } } + foreach(TackSet set in TackSets) + { + if(set.TackItems.Length < 3) + { + Logger.DebugPrint("Removing set: "+set.SetName); + tackSets.Remove(set); + } + } } } } \ No newline at end of file diff --git a/Horse Isle Server/HorseIsleServer/Game/Messages.cs b/Horse Isle Server/HorseIsleServer/Game/Messages.cs index e9b5b7b..5fddc45 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Messages.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Messages.cs @@ -518,14 +518,10 @@ namespace HISP.Game // Click public static string NothingInterestingHere; - public static string FormatTackBoost(string stat, int amount) - { - return TackBonusFormat.Replace("%BOOST%",amount.ToString("N0")).Replace("%STAT%",stat); - } - public static string FormatTackSetPeice(string itemName, string itemDescription, string bonus) + public static string FormatTackSetPeice(string itemName, string itemDescription) { - return TackSetPeiceFormat.Replace("%ITEMNAME%",itemName).Replace("%ITEMDESC%", itemDescription).Replace("%BONUS%",bonus); + return TackSetPeiceFormat.Replace("%ITEMNAME%",itemName).Replace("%ITEMDESC%", itemDescription); } public static string FormatTackSetView(int iconId, string tackSetName, string swf) diff --git a/Horse Isle Server/HorseIsleServer/Game/Meta.cs b/Horse Isle Server/HorseIsleServer/Game/Meta.cs index 020ddeb..73d96aa 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Meta.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Meta.cs @@ -319,6 +319,48 @@ namespace HISP.Game throw new Exception("A mathematically impossible error occured. please check wether the laws of physics still apply."); } + public static string buildTackPeiceLibary(Item.ItemInformation item) + { + string message = ""; + message += Messages.FormatTackSetPeice(item.Name, item.Description); + return message; + } + + public static string BuildTackLibary() + { + string message = ""; + + foreach(Tack.TackSet set in Tack.TackSets) + { + string[] setSwfs = set.GetSwfNames(); + string swf = "breedviewer.swf?terrain=book2&breed=tackonly"; + if(setSwfs.Length >= 1) + swf += "&saddle="+setSwfs[0]; + if(setSwfs.Length >= 2) + swf += "&saddlepad="+setSwfs[1]; + if(setSwfs.Length >= 3) + swf += "&bridle="+setSwfs[2]; + swf += "&j="; + + message += Messages.FormatTackSetView(set.IconId, set.SetName, swf); + + // Write all peices + try + { + message += buildTackPeiceLibary(set.GetSaddle()); + message += buildTackPeiceLibary(set.GetSaddlePad()); + message += buildTackPeiceLibary(set.GetBridle()); + } + catch(Exception e) + { + Logger.ErrorPrint(e.Message); + } + } + message += Messages.BackToMap; + message += Messages.MetaTerminator; + return message; + } + public static string BuildHorseReleased() { string message = ""; diff --git a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs index b9f43a4..329ae40 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs @@ -591,8 +591,6 @@ namespace HISP.Server // Tack (Horse) Messages.TackViewSetFormat = gameData.messages.meta.libary.tack.view_tack_set; Messages.TackSetPeiceFormat = gameData.messages.meta.libary.tack.set_peice_format; - Messages.TackBonusFormat = gameData.messages.meta.libary.tack.bonus_format; - Messages.TackAndSeperator = gameData.messages.meta.libary.tack.and; // Vet Messages.VetServiceHorseFormat = gameData.messages.meta.vet.service_horse; diff --git a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs index 4c83c7d..7ed3258 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs @@ -1338,19 +1338,10 @@ namespace HISP.Server metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildAllStats(sender.LoggedinUser)); sender.SendPacket(metaPacket); break; - case "31": // Find Ranch - break; case "9": // View Tack - break; - case "10": // View Competitions - break; - case "12": // View Miigames - break; - case "22": // View Locations - break; - case "23": // View Awards - break; - case "38": // Read Books + sender.LoggedinUser.MetaPriority = true; + metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildTackLibary()); + sender.SendPacket(metaPacket); break; case "53": // Misc Stats / Tracked Items sender.LoggedinUser.MetaPriority = true;