mirror of
https://github.com/islehorse/HISP.git
synced 2025-05-23 19:46:26 +12:00
Fix npc chat? ???
This commit is contained in:
parent
dbbf913719
commit
ea544dcbe1
7 changed files with 43 additions and 22 deletions
HorseIsleServer/LibHISP/Server
|
@ -18,7 +18,7 @@ namespace HISP.Server
|
|||
public static int IntrestRate = 3333;
|
||||
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
||||
public static string MapFile = "HI1.MAP";
|
||||
public static string GameDataFile = "gamedata.json";
|
||||
public static string GameData = "gamedata.json";
|
||||
public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
|
||||
|
||||
public static int LogLevel = 4;
|
||||
|
@ -92,7 +92,7 @@ namespace HISP.Server
|
|||
Motd = data;
|
||||
break;
|
||||
case "gamedata":
|
||||
GameDataFile = data;
|
||||
GameData = data;
|
||||
break;
|
||||
case "crossdomain":
|
||||
CrossDomainPolicyFile = data;
|
||||
|
|
|
@ -12,21 +12,41 @@ using System.Globalization;
|
|||
using HISP.Security;
|
||||
using System;
|
||||
using HISP.Game.Events;
|
||||
|
||||
using System.Dynamic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
public class GameDataJson
|
||||
{
|
||||
|
||||
public static void ReadGamedata()
|
||||
{
|
||||
if (!File.Exists(ConfigReader.GameDataFile))
|
||||
{
|
||||
Logger.ErrorPrint("Game Data JSON File: " + ConfigReader.GameDataFile + " Does not exist!");
|
||||
throw new FileNotFoundException(ConfigReader.GameDataFile + " Not found :(");
|
||||
dynamic gameData;
|
||||
if (Directory.Exists(ConfigReader.GameData))
|
||||
{
|
||||
gameData = new JObject();
|
||||
string[] files = Directory.GetFiles(ConfigReader.GameData);
|
||||
foreach(string file in files)
|
||||
{
|
||||
string jsonData = File.ReadAllText(file);
|
||||
JObject thisData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
JObject jData = (JObject)gameData;
|
||||
jData.Merge(thisData);
|
||||
|
||||
}
|
||||
}
|
||||
string jsonData = File.ReadAllText(ConfigReader.GameDataFile);
|
||||
dynamic gameData = JsonConvert.DeserializeObject(jsonData);
|
||||
else if (File.Exists(ConfigReader.GameData))
|
||||
{
|
||||
string jsonData = File.ReadAllText(ConfigReader.GameData);
|
||||
gameData = JsonConvert.DeserializeObject(jsonData);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.ErrorPrint("Game Data : " + ConfigReader.GameData + " Does not exist!");
|
||||
GameServer.ShutdownServer();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Register Towns
|
||||
int totalTowns = gameData.places.towns.Count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue