mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 05:05:53 +12:00
Fix npc chat? ???
This commit is contained in:
parent
dbbf913719
commit
ea544dcbe1
7 changed files with 43 additions and 22 deletions
|
@ -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