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:
SilicaPi 2021-01-31 01:18:52 +13:00
parent 6a620f4be5
commit 3c25795188
50 changed files with 186 additions and 60 deletions

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
namespace HISP.Game
{
class AbuseReport
public class AbuseReport
{
public struct ReportReason
{

View file

@ -6,7 +6,7 @@ using HISP.Server;
namespace HISP.Game.Chat
{
class Chat
public class Chat
{
public struct Correction
{

View file

@ -1,11 +1,12 @@
using HISP.Player;
using HISP.Server;
using HISP.Game.Items;
using System;
using System.Collections.Generic;
namespace HISP.Game.Chat
{
class Command
public class Command
{
public static bool Give(string message, string[] args, User user)

View file

@ -4,7 +4,7 @@
namespace HISP.Game
{
// Inventory
class InventoryException : Exception { };
class InventoryFullException : InventoryException { };
class InventoryMaxStackException : InventoryException { };
public class InventoryException : Exception { };
public class InventoryFullException : InventoryException { };
public class InventoryMaxStackException : InventoryException { };
}

View file

@ -1,9 +1,11 @@
using HISP.Server;
using HISP.Game.Items;
using System.Collections.Generic;
namespace HISP.Game.Horse
{
class HorseInfo
public class HorseInfo
{
public enum StatType
{

View file

@ -4,7 +4,7 @@ using HISP.Server;
namespace HISP.Game.Horse
{
class HorseInstance
public class HorseInstance
{
public HorseInstance(HorseInfo.Breed breed, int randomId = -1, string loadName=null, string loadDescription = "", int loadSpoiled=0, string loadCategory="KEEPER", int loadMagicUsed=0, int loadAutoSell=0)
{

View file

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace HISP.Game.Horse
{
class WildHorse
public class WildHorse
{
public WildHorse(HorseInstance horse, int MapX = -1, int MapY = -1, int despawnTimeout=60, bool addToDatabase = true)

View file

@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace HISP.Game.Inventory
{
class HorseInventory
public class HorseInventory
{
private User baseUser;
private List<HorseInstance> horsesList = new List<HorseInstance>();

View file

@ -1,4 +1,5 @@

using HISP.Game.Items;
namespace HISP.Game.Inventory
{

View file

@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using HISP.Game.Items;
namespace HISP.Game.Inventory
{
class InventoryItem
public class InventoryItem
{
public InventoryItem()
{

View file

@ -2,11 +2,12 @@
using System.Linq;
using HISP.Player;
using HISP.Server;
using HISP.Game.Items;
namespace HISP.Game.Inventory
{
class PlayerInventory : IInventory
public class PlayerInventory : IInventory
{

View file

@ -1,11 +1,12 @@
using HISP.Game.Services;
using HISP.Server;
using HISP.Game.Items;
using System.Collections.Generic;
using System.Linq;
namespace HISP.Game.Inventory
{
class ShopInventory : IInventory
public class ShopInventory : IInventory
{
private Shop baseShop;
private List<InventoryItem> inventoryItems;

View file

@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using HISP.Server;
using HISP.Game;
namespace HISP.Game
namespace HISP.Game.Items
{
class DroppedItems
public class DroppedItems
{
public struct DroppedItem
{

View file

@ -1,10 +1,11 @@
using HISP.Player;
using HISP.Server;
using HISP.Game;
using System.Collections.Generic;
namespace HISP.Game
namespace HISP.Game.Items
{
class Item
public class Item
{
public struct Effects
{
@ -138,7 +139,10 @@ namespace HISP.Game
return false;
}
}
public static void DoSpecialCases()
{
Tack.GenerateTackSets();
}
public static ItemInformation GetItemById(int id)
{
foreach(ItemInformation item in Items)

View file

@ -1,7 +1,8 @@
using HISP.Security;
namespace HISP.Game
using HISP.Game;
namespace HISP.Game.Items
{
class ItemInstance
public class ItemInstance
{
public int RandomId;
public int ItemId;

View 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);
}
}
}
}
}

View file

@ -4,7 +4,7 @@ using HISP.Server;
namespace HISP.Game
{
class Map
public class Map
{
public struct TerrainTile
{

View file

@ -4,7 +4,7 @@ using System.Drawing;
namespace HISP.Game
{
class Messages
public class Messages
{
public static int RequiredChatViolations;
public static int DefaultInventoryMax;
@ -517,7 +517,21 @@ 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)
{
return TackSetPeiceFormat.Replace("%ITEMNAME%",itemName).Replace("%ITEMDESC%", itemDescription).Replace("%BONUS%",bonus);
}
public static string FormatTackSetView(int iconId, string tackSetName, string swf)
{
return TackViewSetFormat.Replace("%ICONID%",iconId.ToString()).Replace("%SETNAME%", tackSetName).Replace("%SWF%",swf);
}
public static string FormatWhispererHorseFoundMeta(string mapXys)
{

View file

@ -3,6 +3,7 @@ using HISP.Game.Inventory;
using HISP.Game.Services;
using HISP.Player;
using HISP.Server;
using HISP.Game.Items;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,7 +11,7 @@ using System.Drawing;
namespace HISP.Game
{
class Meta
public class Meta
{
// Meta

View file

@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace HISP.Game
{
class Npc
public class Npc
{
public struct NpcReply
{

View file

@ -4,10 +4,11 @@ using System.Linq;
using HISP.Game.Inventory;
using HISP.Player;
using HISP.Server;
using HISP.Game.Items;
namespace HISP.Game
{
class Quest
public class Quest
{
public const string Shovel = "SHOVEL";
public const string Binoculars = "BINOCS";

View file

@ -1,4 +1,6 @@
using HISP.Player;
using HISP.Game.Items;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,7 +9,7 @@ using System.Threading.Tasks;
namespace HISP.Game.Services
{
class Inn
public class Inn
{
private static List<Inn> listInns = new List<Inn>();
public static Inn[] Inns

View file

@ -1,11 +1,12 @@
using HISP.Game.Inventory;
using HISP.Server;
using HISP.Game.Items;
using System;
using System.Collections.Generic;
namespace HISP.Game.Services
{
class Shop
public class Shop
{
public int Id;

View file

@ -2,7 +2,7 @@
namespace HISP.Game.Services
{
class Transport
public class Transport
{
public struct TransportLocation
{

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace HISP.Game.Services
{
class Vet
public class Vet
{
public static List<Vet> Vets = new List<Vet>();

View file

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace HISP.Game.SwfModules
{
class Brickpoet
public class Brickpoet
{
public struct PoetryEntry {
public int Id;

View file

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace HISP.Game
{
class Tracking
public class Tracking
{
public enum TrackableItem
{

View file

@ -4,7 +4,7 @@ using HISP.Server;
namespace HISP.Game
{
class World
public class World
{
public struct Isle
{