mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 12:19:15 +12:00
Fix ordering and fully implement "View Companion"
This commit is contained in:
parent
bd149e4ecf
commit
7bf0f37427
7 changed files with 91 additions and 43 deletions
|
@ -122,10 +122,7 @@ namespace HISP.Game.Horse
|
|||
{
|
||||
get
|
||||
{
|
||||
int offsetBy = 0;
|
||||
if (baseHorse.Equipment.Companion != null)
|
||||
offsetBy += getOffetFrom(baseHorse.Equipment.Companion);
|
||||
return offsetBy;
|
||||
return baseHorse.Equipment.Companion.GetMiscFlag(0);
|
||||
}
|
||||
}
|
||||
public int TackOffset
|
||||
|
@ -134,11 +131,11 @@ namespace HISP.Game.Horse
|
|||
{
|
||||
int offsetBy = 0;
|
||||
if (baseHorse.Equipment.Saddle != null)
|
||||
offsetBy += getOffetFrom(baseHorse.Equipment.Saddle);
|
||||
offsetBy += getOffsetFrom(baseHorse.Equipment.Saddle);
|
||||
if (baseHorse.Equipment.SaddlePad != null)
|
||||
offsetBy += getOffetFrom(baseHorse.Equipment.SaddlePad);
|
||||
offsetBy += getOffsetFrom(baseHorse.Equipment.SaddlePad);
|
||||
if (baseHorse.Equipment.Bridle != null)
|
||||
offsetBy += getOffetFrom(baseHorse.Equipment.Bridle);
|
||||
offsetBy += getOffsetFrom(baseHorse.Equipment.Bridle);
|
||||
return offsetBy;
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +147,7 @@ namespace HISP.Game.Horse
|
|||
}
|
||||
}
|
||||
|
||||
private int getOffetFrom(Item.ItemInformation tackPeice)
|
||||
private int getOffsetFrom(Item.ItemInformation tackPeice)
|
||||
{
|
||||
int offsetBy = 0;
|
||||
foreach (Item.Effects effect in baseHorse.Equipment.Bridle.Effects)
|
||||
|
|
|
@ -40,6 +40,14 @@ namespace HISP.Game.Items
|
|||
|
||||
public SpawnRules SpawnParamaters;
|
||||
|
||||
public int GetMiscFlag(int no)
|
||||
{
|
||||
if(MiscFlags.Length <= no)
|
||||
return 0;
|
||||
else
|
||||
return MiscFlags[no];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public struct ThrowableItem
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace HISP.Game.Items
|
|||
{
|
||||
foreach(Item.ItemInformation tackItem in TackItems)
|
||||
{
|
||||
if(tackItem.MiscFlags[0] == 1) // Saddle
|
||||
if(tackItem.GetMiscFlag(0) == 1) // Saddle
|
||||
return tackItem;
|
||||
}
|
||||
throw new KeyNotFoundException("Saddle not found.");
|
||||
|
@ -46,7 +46,7 @@ namespace HISP.Game.Items
|
|||
{
|
||||
foreach(Item.ItemInformation tackItem in TackItems)
|
||||
{
|
||||
if(tackItem.MiscFlags[0] == 2) // SaddlePad
|
||||
if(tackItem.GetMiscFlag(0) == 2) // SaddlePad
|
||||
return tackItem;
|
||||
}
|
||||
throw new KeyNotFoundException("SaddlePad not found.");
|
||||
|
@ -56,7 +56,7 @@ namespace HISP.Game.Items
|
|||
{
|
||||
foreach(Item.ItemInformation tackItem in TackItems)
|
||||
{
|
||||
if(tackItem.MiscFlags[0] == 3) // Bridle
|
||||
if(tackItem.GetMiscFlag(0) == 3) // Bridle
|
||||
return tackItem;
|
||||
}
|
||||
throw new KeyNotFoundException("GetBridle not found.");
|
||||
|
@ -79,6 +79,18 @@ namespace HISP.Game.Items
|
|||
return tackItems.ToArray();
|
||||
}
|
||||
}
|
||||
public int SortPosition()
|
||||
{
|
||||
int pos = 0;
|
||||
foreach(Item.ItemInformation tackitem in TackItems)
|
||||
{
|
||||
foreach(Item.Effects effect in tackitem.Effects)
|
||||
{
|
||||
pos += effect.EffectAmount;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
private static string capitalizeFirstLetter(string str)
|
||||
{
|
||||
|
|
|
@ -526,7 +526,7 @@ namespace HISP.Game
|
|||
}
|
||||
public static string FormatCompanionViewButton(int iconid, string itemName, string swf)
|
||||
{
|
||||
return CompanionViewFormat.Replace("%ICONID%", iconId.ToString()).Replace("%COMPANIONNAME%",itemName).Replace("%SWF%", swf);
|
||||
return CompanionViewFormat.Replace("%ICONID%", iconid.ToString()).Replace("%COMPANIONNAME%",itemName).Replace("%SWF%", swf);
|
||||
}
|
||||
public static string FormatTackSetPeice(string itemName, string itemDescription)
|
||||
{
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace HISP.Game
|
|||
{
|
||||
string message = "";
|
||||
|
||||
foreach(Tack.TackSet set in Tack.TackSets)
|
||||
foreach(Tack.TackSet set in Tack.TackSets.OrderBy(o => o.SortPosition()).ToArray())
|
||||
{
|
||||
string[] setSwfs = set.GetSwfNames();
|
||||
string swf = "breedviewer.swf?terrain=book2&breed=tackonly";
|
||||
|
@ -361,6 +361,23 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
public static string BuildCompanionLibary()
|
||||
{
|
||||
string message = "";
|
||||
foreach(Item.ItemInformation itm in Item.Items.OrderBy(o => o.GetMiscFlag(0)).ToArray())
|
||||
{
|
||||
if(itm.Type == "COMPANION" && itm.EmbedSwf != null)
|
||||
{
|
||||
string swf = "breedviewer.swf?terrain=book2&breed=tackonly&companion="+itm.EmbedSwf+"&j=";
|
||||
message += Messages.FormatCompanionViewButton(itm.IconId, itm.Name, swf);
|
||||
message += Messages.FormatCompanionEntry(itm.Description);
|
||||
}
|
||||
}
|
||||
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