mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 12:19:15 +12:00
Make "View Tack" work, still some ordering problems though >_>
This commit is contained in:
parent
3c25795188
commit
6ea23e5870
6 changed files with 112 additions and 32 deletions
|
@ -16,6 +16,13 @@ namespace HISP.Game.Items
|
|||
tackItems = new List<Item.ItemInformation>();
|
||||
}
|
||||
|
||||
public int IconId
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetSaddle().IconId;
|
||||
}
|
||||
}
|
||||
public string SetName;
|
||||
private List<Item.ItemInformation> 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<TackSet> tackSets = new List<TackSet>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue