mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 05:05:40 +12:00
no message
This commit is contained in:
parent
c245f267f5
commit
7a8cc2c2a6
4 changed files with 56 additions and 6 deletions
|
@ -141,7 +141,6 @@ namespace Horse_Isle_Server
|
|||
if (specialTile.ExitX != 0 && specialTile.ExitY != 0)
|
||||
message += Messages.ExitThisPlace + Messages.MetaTerminator;
|
||||
|
||||
Logger.DebugPrint(message);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
@ -193,6 +192,7 @@ namespace Horse_Isle_Server
|
|||
{
|
||||
message += Messages.FormatNpcReply(reply.ReplyText, reply.Id);
|
||||
}
|
||||
message += Messages.BackToMap + Messages.MetaTerminator;
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,18 @@ namespace Horse_Isle_Server
|
|||
}
|
||||
throw new KeyNotFoundException("Npc reply with " + id + " not found!");
|
||||
}
|
||||
public static NpcChat GetNpcChatpoint(NpcEntry npc, int chatpointId)
|
||||
{
|
||||
foreach(Npc.NpcChat chatpoint in npc.Chatpoints)
|
||||
{
|
||||
if(chatpoint.Id == chatpointId)
|
||||
{
|
||||
return chatpoint;
|
||||
}
|
||||
}
|
||||
|
||||
throw new KeyNotFoundException("Npc chatpoint id: " + chatpointId + " not found!");
|
||||
}
|
||||
public static NpcEntry GetNpcById(int id)
|
||||
{
|
||||
foreach(NpcEntry npc in NpcList)
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Horse_Isle_Server
|
|||
public const byte PACKET_PLAYERINFO = 0x16;
|
||||
|
||||
public const byte NPC_START_CHAT = 0x14;
|
||||
public const byte NPC_CONTINUE_CHAT = 0x15;
|
||||
|
||||
public const byte PLAYERINFO_LEAVE = 0x16;
|
||||
public const byte PLAYERINFO_UPDATE_OR_CREATE = 0x15;
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace Horse_Isle_Server
|
|||
return;
|
||||
}
|
||||
byte action = packet[1];
|
||||
if(action == PacketBuilder.NPC_START_CHAT)
|
||||
if (action == PacketBuilder.NPC_START_CHAT)
|
||||
{
|
||||
|
||||
string packetStr = Encoding.UTF8.GetString(packet);
|
||||
|
@ -320,9 +320,9 @@ namespace Horse_Isle_Server
|
|||
{
|
||||
chatId = int.Parse(number);
|
||||
}
|
||||
catch(InvalidOperationException)
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to use a transport with id that is NaN.");
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to start talking to an NPC with id that is NaN.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -331,9 +331,46 @@ namespace Horse_Isle_Server
|
|||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(metaInfo);
|
||||
sender.SendPacket(metaPacket);
|
||||
}
|
||||
else
|
||||
else if (action == PacketBuilder.NPC_CONTINUE_CHAT)
|
||||
{
|
||||
Logger.ErrorPrint("Unknown npc interaction! - Packet Dump: " + BitConverter.ToString(packet).Replace('-', ' '));
|
||||
string packetStr = Encoding.UTF8.GetString(packet);
|
||||
string number = packetStr.Substring(2, packetStr.Length - 4);
|
||||
int replyId = 0;
|
||||
try
|
||||
{
|
||||
replyId = int.Parse(number);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to reply to an NPC with replyid that is NaN.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Npc.NpcEntry npc in Npc.NpcList)
|
||||
{
|
||||
foreach (Npc.NpcChat chatpoint in npc.Chatpoints)
|
||||
{
|
||||
foreach (Npc.NpcReply reply in chatpoint.Replies)
|
||||
{
|
||||
if (reply.Id == replyId)
|
||||
{
|
||||
if (reply.GotoChatpoint == -1)
|
||||
{
|
||||
UpdateArea(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
string metaInfo = Meta.BuildChatpoint(npc,Npc.GetNpcChatpoint(npc, reply.GotoChatpoint));
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(metaInfo);
|
||||
sender.SendPacket(metaPacket);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to reply with replyid that does not exist.");
|
||||
|
||||
}
|
||||
}
|
||||
public static void OnTransportUsed(Client sender, byte[] packet)
|
||||
|
|
Loading…
Add table
Reference in a new issue