mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Fix npc chat? ???
This commit is contained in:
parent
dbbf913719
commit
ea544dcbe1
7 changed files with 43 additions and 22 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 69e6a3393d1fe41986a92c489a43ea6d920786df
|
Subproject commit c872d4a508e1514f302c6b3eac98c91db2d125d7
|
|
@ -2559,17 +2559,15 @@ namespace HISP.Game
|
||||||
if (result.GotoChatpoint != -1)
|
if (result.GotoChatpoint != -1)
|
||||||
chatpoint = Npc.GetNpcChatpoint(npc, result.GotoChatpoint);
|
chatpoint = Npc.GetNpcChatpoint(npc, result.GotoChatpoint);
|
||||||
|
|
||||||
if (chatpoint.ChatText.Trim() == "")
|
if (result.NpcChat != null && result.NpcChat.Trim() != "")
|
||||||
if (result.NpcChat != null)
|
chatpoint.ChatText = result.NpcChat;
|
||||||
if(result.NpcChat.Trim() != "")
|
|
||||||
chatpoint.ChatText = result.NpcChat;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (result.GotoChatpoint != -1)
|
if (result.GotoChatpoint != -1)
|
||||||
chatpoint = Npc.GetNpcChatpoint(npc, result.GotoChatpoint);
|
chatpoint = Npc.GetNpcChatpoint(npc, result.GotoChatpoint);
|
||||||
|
|
||||||
if (result.NpcChat != null)
|
if (result.NpcChat != null && result.NpcChat.Trim() != "")
|
||||||
chatpoint.ChatText = result.NpcChat;
|
chatpoint.ChatText = result.NpcChat;
|
||||||
|
|
||||||
if (result.HideRepliesOnFail)
|
if (result.HideRepliesOnFail)
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace HISP.Game
|
||||||
res.QuestCompleted = true;
|
res.QuestCompleted = true;
|
||||||
if (npcActivation)
|
if (npcActivation)
|
||||||
{
|
{
|
||||||
if (quest.SuccessNpcChat != null && quest.SuccessNpcChat != "")
|
if (quest.SuccessNpcChat != null && quest.SuccessNpcChat.Trim() != "")
|
||||||
res.NpcChat = quest.SuccessNpcChat;
|
res.NpcChat = quest.SuccessNpcChat;
|
||||||
|
|
||||||
if(quest.SetNpcChatpoint != -1)
|
if(quest.SetNpcChatpoint != -1)
|
||||||
|
@ -241,7 +241,7 @@ namespace HISP.Game
|
||||||
user.LoggedinClient.SendPacket(ChatPacket);
|
user.LoggedinClient.SendPacket(ChatPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quest.SuccessNpcChat != null)
|
if (quest.SuccessNpcChat != null && quest.SuccessNpcChat.Trim() != "")
|
||||||
{
|
{
|
||||||
if (!npcActivation)
|
if (!npcActivation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,14 +14,16 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ContentWithTargetPath Include="..\..\HorseIsleData\gamedata.json">
|
<ContentWithTargetPath Include="..\..\HorseIsleData\gamedata\**">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<TargetPath>gamedata.json</TargetPath>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<TargetPath>gamedata\%(Filename)%(Extension)</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</ContentWithTargetPath>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ContentWithTargetPath Include="..\..\HorseIsleData\HI1.MAP">
|
<ContentWithTargetPath Include="..\..\HorseIsleData\HI1.MAP">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<TargetPath>HI1.MAP</TargetPath>
|
<TargetPath>HI1.MAP</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</ContentWithTargetPath>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -30,9 +30,10 @@ sql_lite=false
|
||||||
# the default was downloaded from the original server
|
# the default was downloaded from the original server
|
||||||
map=HI1.MAP
|
map=HI1.MAP
|
||||||
|
|
||||||
# This file contains all definitions in the game
|
# This folder contains all definitions in the game
|
||||||
# such as items, horses. and quest data.
|
# such as items, horses. and quest data.
|
||||||
gamedata=gamedata.json
|
# NOTE: This can be a folder or a file.
|
||||||
|
gamedata=gamedata
|
||||||
|
|
||||||
# =======================
|
# =======================
|
||||||
# Security
|
# Security
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace HISP.Server
|
||||||
public static int IntrestRate = 3333;
|
public static int IntrestRate = 3333;
|
||||||
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
||||||
public static string MapFile = "HI1.MAP";
|
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 string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
|
||||||
|
|
||||||
public static int LogLevel = 4;
|
public static int LogLevel = 4;
|
||||||
|
@ -92,7 +92,7 @@ namespace HISP.Server
|
||||||
Motd = data;
|
Motd = data;
|
||||||
break;
|
break;
|
||||||
case "gamedata":
|
case "gamedata":
|
||||||
GameDataFile = data;
|
GameData = data;
|
||||||
break;
|
break;
|
||||||
case "crossdomain":
|
case "crossdomain":
|
||||||
CrossDomainPolicyFile = data;
|
CrossDomainPolicyFile = data;
|
||||||
|
|
|
@ -12,21 +12,41 @@ using System.Globalization;
|
||||||
using HISP.Security;
|
using HISP.Security;
|
||||||
using System;
|
using System;
|
||||||
using HISP.Game.Events;
|
using HISP.Game.Events;
|
||||||
|
using System.Dynamic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace HISP.Server
|
namespace HISP.Server
|
||||||
{
|
{
|
||||||
public class GameDataJson
|
public class GameDataJson
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void ReadGamedata()
|
public static void ReadGamedata()
|
||||||
{
|
{
|
||||||
if (!File.Exists(ConfigReader.GameDataFile))
|
dynamic gameData;
|
||||||
{
|
if (Directory.Exists(ConfigReader.GameData))
|
||||||
Logger.ErrorPrint("Game Data JSON File: " + ConfigReader.GameDataFile + " Does not exist!");
|
{
|
||||||
throw new FileNotFoundException(ConfigReader.GameDataFile + " Not found :(");
|
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);
|
else if (File.Exists(ConfigReader.GameData))
|
||||||
dynamic gameData = JsonConvert.DeserializeObject(jsonData);
|
{
|
||||||
|
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
|
// Register Towns
|
||||||
int totalTowns = gameData.places.towns.Count;
|
int totalTowns = gameData.places.towns.Count;
|
||||||
|
|
Loading…
Add table
Reference in a new issue