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
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,10 +13,10 @@ namespace HISP.Properties {
/// <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>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// This public class was auto-generated by the StronglyTypedResourceBuilder
// public class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
@ -33,7 +33,7 @@ namespace HISP.Properties {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// Returns the cached ResourceManager instance used by this public class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -48,7 +48,7 @@ namespace HISP.Properties {
/// <summary>
/// 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>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
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)
private static int getHexVal(char hex)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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