mirror of
https://github.com/islehorse/HISP.git
synced 2025-06-07 03:21:27 +12:00
Weirest bug ever happened, it said "Item.ItemInformation" is higher protection level than Item.Tack even though both were public, i eventurally found that it was because Item was "class" where as "Item.Tack" was "public class" so i made everything be "public class"
This commit is contained in:
parent
6a620f4be5
commit
3c25795188
50 changed files with 186 additions and 60 deletions
86
Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs
Normal file
86
Horse Isle Server/HorseIsleServer/Game/Items/Tack.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using HISP.Server;
|
||||
|
||||
namespace HISP.Game.Items
|
||||
{
|
||||
public class Tack
|
||||
{
|
||||
public class TackSet
|
||||
{
|
||||
public TackSet()
|
||||
{
|
||||
tackItems = new List<Item.ItemInformation>();
|
||||
}
|
||||
|
||||
public string SetName;
|
||||
private List<Item.ItemInformation> tackItems;
|
||||
public void Add(Item.ItemInformation item)
|
||||
{
|
||||
Logger.DebugPrint("Added "+item.Name+" To Tack Set: "+this.SetName);
|
||||
tackItems.Add(item);
|
||||
}
|
||||
public Item.ItemInformation[] TackItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return tackItems.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
private static string capitalizeFirstLetter(string str)
|
||||
{
|
||||
char firstChar = char.ToUpper(str[0]);
|
||||
return firstChar + str.Substring(1);
|
||||
}
|
||||
private static List<TackSet> tackSets = new List<TackSet>();
|
||||
public TackSet[] TackSets
|
||||
{
|
||||
get
|
||||
{
|
||||
return tackSets.ToArray();
|
||||
}
|
||||
}
|
||||
public static TackSet GetSetByName(string name)
|
||||
{
|
||||
foreach(TackSet set in tackSets)
|
||||
{
|
||||
if(set.SetName == name)
|
||||
{
|
||||
return set;
|
||||
}
|
||||
}
|
||||
throw new KeyNotFoundException("No TackSet with name: "+name+" was found.");
|
||||
}
|
||||
|
||||
public static void GenerateTackSets()
|
||||
{
|
||||
foreach(Item.ItemInformation itemInfo in Item.Items)
|
||||
{
|
||||
if(itemInfo.Type == "TACK")
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
TackSet set = GetSetByName(capitalizeFirstLetter(itemInfo.EmbedSwf));
|
||||
set.Add(itemInfo);
|
||||
}
|
||||
catch(KeyNotFoundException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TackSet tackSet = new TackSet();
|
||||
tackSet.SetName = capitalizeFirstLetter(itemInfo.EmbedSwf);
|
||||
tackSet.Add(itemInfo);
|
||||
tackSets.Add(tackSet);
|
||||
Logger.DebugPrint("Created Tack Set: "+tackSet.SetName);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue