fix npc chats-

This commit is contained in:
SilicaAndPina 2021-01-02 13:50:32 +13:00
parent 4c7a9c8ed1
commit 2d7eb8c6c2
7 changed files with 5918 additions and 858 deletions
Horse Isle Server/Horse Isle Server/Game

View file

@ -229,8 +229,6 @@ namespace HISP.Game
{
string message = "";
Npc.NpcEntry[] entries = Npc.GetNpcByXAndY(x, y);
if (entries.Length > 0)
message += Messages.Seperator;
foreach (Npc.NpcEntry ent in entries)
{
if (ent.AdminOnly && !user.Administrator)
@ -636,11 +634,11 @@ namespace HISP.Game
string message = "";
if (specialTile.Code == null)
message += buildLocationString(specialTile.X, specialTile.Y)+Messages.Seperator;
message += buildLocationString(specialTile.X, specialTile.Y);
if (specialTile.Title != null && specialTile.Title != "")
message += Messages.FormatTileName(specialTile.Title) + Messages.Seperator;
message += Messages.FormatTileName(specialTile.Title);
if (specialTile.Description != null && specialTile.Description != "")
message += specialTile.Description;
@ -802,7 +800,9 @@ namespace HISP.Game
if (Quest.ActivateQuest(user, quest, true))
{
user.MetaPriority = true;
if(quest.GotoNpcChatpoint != -1)
if (quest.SetNpcChatpoint != -1)
Npc.SetDefaultChatpoint(user, npc, quest.SetNpcChatpoint);
if (quest.GotoNpcChatpoint != -1)
chatpoint = Npc.GetNpcChatpoint(npc,quest.GotoNpcChatpoint);
if (quest.SuccessNpcChat != null)
chatpoint.ChatText = quest.SuccessNpcChat;

View file

@ -1,4 +1,6 @@
using System.Collections.Generic;
using HISP.Player;
using HISP.Server;
using System.Collections.Generic;
namespace HISP.Game
@ -81,6 +83,24 @@ namespace HISP.Game
throw new KeyNotFoundException("Npc chatpoint id: " + chatpointId + " not found!");
}
public static int GetDefaultChatpoint(User user, NpcEntry npc)
{
if (Database.HasNpcStartpointSet(user.Id, npc.Id))
return Database.GetNpcStartPoint(user.Id, npc.Id);
else
return 0;
}
public static void SetDefaultChatpoint(User user, NpcEntry npc, int chatpointId)
{
if (Database.HasNpcStartpointSet(user.Id, npc.Id))
Database.SetNpcStartPoint(user.Id, npc.Id, chatpointId);
else
Database.AddNpcStartPoint(user.Id, npc.Id, chatpointId);
}
public static bool NpcExists(int id)
{
try

View file

@ -47,6 +47,7 @@ namespace HISP.Game
public int MoneyEarned;
public QuestItemInfo[] ItemsEarned;
public int QuestPointsEarned;
public int SetNpcChatpoint;
public int GotoNpcChatpoint;
public int WarpX;
public int WarpY;