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; using System.Collections.Generic;
namespace HISP.Game namespace HISP.Game
{ {
class AbuseReport public class AbuseReport
{ {
public struct ReportReason public struct ReportReason
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ using HISP.Server;
namespace HISP.Game.Horse 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) 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 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) 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 namespace HISP.Game.Inventory
{ {
class HorseInventory public class HorseInventory
{ {
private User baseUser; private User baseUser;
private List<HorseInstance> horsesList = new List<HorseInstance>(); private List<HorseInstance> horsesList = new List<HorseInstance>();

View file

@ -1,4 +1,5 @@
 using HISP.Game.Items;
namespace HISP.Game.Inventory namespace HISP.Game.Inventory
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,8 @@
using HISP.Security; using HISP.Security;
namespace HISP.Game using HISP.Game;
namespace HISP.Game.Items
{ {
class ItemInstance public class ItemInstance
{ {
public int RandomId; public int RandomId;
public int ItemId; 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 namespace HISP.Game
{ {
class Map public class Map
{ {
public struct TerrainTile public struct TerrainTile
{ {

View file

@ -4,7 +4,7 @@ using System.Drawing;
namespace HISP.Game namespace HISP.Game
{ {
class Messages public class Messages
{ {
public static int RequiredChatViolations; public static int RequiredChatViolations;
public static int DefaultInventoryMax; public static int DefaultInventoryMax;
@ -517,7 +517,21 @@ namespace HISP.Game
// Click // Click
public static string NothingInterestingHere; 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) public static string FormatWhispererHorseFoundMeta(string mapXys)
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace HISP.Player namespace HISP.Player
{ {
class Award public class Award
{ {
public struct AwardEntry public struct AwardEntry
{ {

View file

@ -1,9 +1,10 @@
using HISP.Game; using HISP.Game;
using HISP.Server; using HISP.Server;
using HISP.Game.Items;
namespace HISP.Player.Equips namespace HISP.Player.Equips
{ {
class CompetitionGear public class CompetitionGear
{ {
public const int MISC_FLAG_HEAD = 1; public const int MISC_FLAG_HEAD = 1;
public const int MISC_FLAG_BODY = 2; public const int MISC_FLAG_BODY = 2;

View file

@ -1,9 +1,10 @@
using HISP.Game; using HISP.Game;
using HISP.Server; using HISP.Server;
using HISP.Game.Items;
namespace HISP.Player.Equips namespace HISP.Player.Equips
{ {
class Jewelry public class Jewelry
{ {
private int playerId; private int playerId;

View file

@ -3,7 +3,7 @@ using HISP.Server;
namespace HISP.Player namespace HISP.Player
{ {
class Friends public class Friends
{ {
private User baseUser; private User baseUser;
public List<int> List; public List<int> List;

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace HISP.Player namespace HISP.Player
{ {
class Highscore public class Highscore
{ {
public class HighscoreTableEntry public class HighscoreTableEntry
{ {

View file

@ -2,7 +2,7 @@
namespace HISP.Player namespace HISP.Player
{ {
class Mailbox public class Mailbox
{ {
private User baseUser; private User baseUser;
public int MailCount; public int MailCount;

View file

@ -3,7 +3,7 @@ using HISP.Server;
namespace HISP.Player namespace HISP.Player
{ {
class PlayerQuests public class PlayerQuests
{ {
private List<TrackedQuest> trackedQuests = new List<TrackedQuest>(); private List<TrackedQuest> trackedQuests = new List<TrackedQuest>();
public User BaseUser; public User BaseUser;

View file

@ -2,7 +2,7 @@
using HISP.Server; using HISP.Server;
namespace HISP namespace HISP
{ {
class TrackedQuest public class TrackedQuest
{ {
public TrackedQuest(int playerID, int questID, int timesComplete) public TrackedQuest(int playerID, int questID, int timesComplete)
{ {

View file

@ -9,7 +9,7 @@ using HISP.Game.Horse;
namespace HISP.Player namespace HISP.Player
{ {
class User public class User
{ {
public int Id; public int Id;

View file

@ -1,12 +1,14 @@
using System; using System;
using HISP.Game; using HISP.Game;
using HISP.Game.Items;
using HISP.Game.Horse; using HISP.Game.Horse;
using HISP.Game.SwfModules; using HISP.Game.SwfModules;
using HISP.Security; using HISP.Security;
using HISP.Server; using HISP.Server;
namespace HISP namespace HISP
{ {
class Program public class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
@ -20,6 +22,7 @@ namespace HISP
DroppedItems.Init(); DroppedItems.Init();
WildHorse.Init(); WildHorse.Init();
Brickpoet.LoadPoetryRooms(); Brickpoet.LoadPoetryRooms();
Item.DoSpecialCases();
GameServer.StartServer(); GameServer.StartServer();
} }

View file

@ -13,10 +13,10 @@ namespace HISP.Properties {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource public class, for looking up localized strings, etc.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This public class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // public class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
@ -33,7 +33,7 @@ namespace HISP.Properties {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this public class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
@ -48,7 +48,7 @@ namespace HISP.Properties {
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource public class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {

View file

@ -5,7 +5,7 @@ using HISP.Server;
namespace HISP.Security namespace HISP.Security
{ {
class Authentication public class Authentication
{ {
public static string DecryptLogin(string encpass) public static string DecryptLogin(string encpass)
{ {

View file

@ -4,7 +4,7 @@ using System.IO;
using HISP.Server; using HISP.Server;
namespace HISP.Security namespace HISP.Security
{ {
class CrossDomainPolicy public class CrossDomainPolicy
{ {
public static byte[] GetPolicy() public static byte[] GetPolicy()
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
namespace HISP.Security namespace HISP.Security
{ {
class RandomID public class RandomID
{ {
private static int prevId = 0; private static int prevId = 0;
public static int NextRandomId(int randomId=-1) public static int NextRandomId(int randomId=-1)

View file

@ -4,7 +4,7 @@ using System.IO;
namespace HISP.Server namespace HISP.Server
{ {
class ConfigReader public class ConfigReader
{ {
public static int Port; public static int Port;
public static string BindIP; public static string BindIP;

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace HISP.Server namespace HISP.Server
{ {
class Converters public class Converters
{ {
// Thanks Stackoverflow (https://stackoverflow.com/questions/321370/how-can-i-convert-a-hex-string-to-a-byte-array) // Thanks Stackoverflow (https://stackoverflow.com/questions/321370/how-can-i-convert-a-hex-string-to-a-byte-array)
private static int getHexVal(char hex) private static int getHexVal(char hex)

View file

@ -5,10 +5,11 @@ using HISP.Game;
using HISP.Player; using HISP.Player;
using HISP.Game.Horse; using HISP.Game.Horse;
using HISP.Game.Inventory; using HISP.Game.Inventory;
using HISP.Game.Items;
namespace HISP.Server namespace HISP.Server
{ {
class Database public class Database
{ {
public static string ConnectionString = ""; public static string ConnectionString = "";

View file

@ -9,7 +9,7 @@ using HISP.Game.Horse;
namespace HISP.Server namespace HISP.Server
{ {
class GameClient public class GameClient
{ {
public Socket ClientSocket; public Socket ClientSocket;
public string RemoteIp; public string RemoteIp;

View file

@ -7,10 +7,11 @@ using HISP.Player;
using HISP.Game.Services; using HISP.Game.Services;
using HISP.Game.SwfModules; using HISP.Game.SwfModules;
using HISP.Game.Horse; using HISP.Game.Horse;
using HISP.Game.Items;
namespace HISP.Server namespace HISP.Server
{ {
class GameDataJson public class GameDataJson
{ {
public static void ReadGamedata() public static void ReadGamedata()

View file

@ -16,10 +16,11 @@ using HISP.Game.Services;
using HISP.Game.Inventory; using HISP.Game.Inventory;
using HISP.Game.SwfModules; using HISP.Game.SwfModules;
using HISP.Game.Horse; using HISP.Game.Horse;
using HISP.Game.Items;
namespace HISP.Server namespace HISP.Server
{ {
class GameServer public class GameServer
{ {
public static Socket ServerSocket; public static Socket ServerSocket;

View file

@ -2,7 +2,7 @@
namespace HISP.Server namespace HISP.Server
{ {
class Logger public class Logger
{ {
public static void HackerPrint(string text) // When someone is obviously cheating. public static void HackerPrint(string text) // When someone is obviously cheating.
{ {

View file

@ -7,7 +7,7 @@ using HISP.Game.SwfModules;
namespace HISP.Server namespace HISP.Server
{ {
class PacketBuilder public class PacketBuilder
{ {
public const byte PACKET_TERMINATOR = 0x00; public const byte PACKET_TERMINATOR = 0x00;