diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json
index e76755f..4555a68 100644
--- a/DataCollection/gamedata.json
+++ b/DataCollection/gamedata.json
@@ -17,14 +17,6 @@
"rake":"You rake all over, but uncover nothing interesting.",
"shovel":"You dig all over, but turn up nothing."
},
- "npc":{
-
- "start_chat_format":"^I%ICONID%^T8%NAME%, %DESCRIPTION%",
- "chatpoint_format":" Conversation with %NAME%, %DESCRIPTION%
%NAME%: %TEXT%",
- "reply_format":"^N%TEXT%^BHB%ID%^R2",
- "npc_information_button":"^B4LC%ID%",
- "npc_talk_button":"^BA%ID%"
- },
"transport":{
"not_enough_money":"You cannot afford this trip!",
"welcome_to_format":"Welcome to %PLACE%."
@@ -61,7 +53,15 @@
"exit_this_place":"^X",
"end_of_meta":"^Z",
"back_to_map":"^M",
- "long_full_line":"^L",
+ "long_full_line":"^L",
+ "npc":{
+ "start_chat_format":"^I%ICONID%^T8%NAME%, %DESCRIPTION%",
+ "chatpoint_format":" Conversation with %NAME%, %DESCRIPTION%
%NAME%: %TEXT%",
+ "reply_format":"^N%TEXT%^BHB%ID%^R2",
+ "npc_information_format":"Looking at %NAME%:
%DESCRIPTION%",
+ "npc_information_button":"^B4LC%ID%",
+ "npc_talk_button":"^BA%ID%"
+ },
"inventory":{
"header_format":"^ATYour Inventory^HYou are carrying the following %ITEMCOUNT% different items: (%MAXITEMS% max)",
"item_entry":"^I%ICONID%^T4(%COUNT%) %TITLE%",
@@ -76,6 +76,7 @@
"nothing_message":"^LYou see nothing on the ground of interest.^R1",
"items_message":"^LYou see the following on the ground:^R1",
"item_format":"^I%ICONID%^T3%ITEMNAME%^B4G%RANDOMID%^B4LE%RANDOMID%^R1",
+ "item_information_format":"Looking at %NAME%:
%DESCRIPTION%",
"grab_all":"^T3^B4R^R1"
},
"nearby":{
diff --git a/Horse Isle Server/Horse Isle Server/Game/DroppedItems.cs b/Horse Isle Server/Horse Isle Server/Game/DroppedItems.cs
index e0bebe5..558039f 100644
--- a/Horse Isle Server/Horse Isle Server/Game/DroppedItems.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/DroppedItems.cs
@@ -72,6 +72,20 @@ namespace HISP.Game
}
}
+
+ public static bool IsDroppedItemExist(int randomId)
+ {
+ try
+ {
+ GetDroppedItemById(randomId);
+ return true;
+
+ }
+ catch(KeyNotFoundException)
+ {
+ return false;
+ }
+ }
public static DroppedItem GetDroppedItemById(int randomId)
{
diff --git a/Horse Isle Server/Horse Isle Server/Game/Item.cs b/Horse Isle Server/Horse Isle Server/Game/Item.cs
index 9b14476..c39cb04 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Item.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Item.cs
@@ -83,6 +83,20 @@ namespace HISP.Game
}
throw new KeyNotFoundException("id: " + id + " is not a throwable item.");
}
+
+ public static bool ItemIdExist(int id)
+ {
+ try
+ {
+ GetItemById(id);
+ return true;
+ }
+ catch(KeyNotFoundException)
+ {
+ return false;
+ }
+ }
+
public static ItemInformation GetItemById(int id)
{
foreach(ItemInformation item in Items)
diff --git a/Horse Isle Server/Horse Isle Server/Game/Map.cs b/Horse Isle Server/Horse Isle Server/Game/Map.cs
index 4064466..5aead20 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Map.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Map.cs
@@ -66,11 +66,10 @@ namespace HISP.Game
overlayPassable = true;
bool tilePassable = false;
- if (terrainPassable || overlayPassable)
+ if (terrainPassable || overlayPassable && otileId != 0)
tilePassable = true;
- if (!overlayPassable && (tileId != 0 && otileId != 0))
- tilePassable = false;
-
+
+ Logger.DebugPrint("Overlay: " + otileId + " Terrain: " + tileId);
return tilePassable;
diff --git a/Horse Isle Server/Horse Isle Server/Game/Messages.cs b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
index 830fe15..5a04cf6 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Messages.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
@@ -65,6 +65,8 @@ namespace HISP.Game
public static string GrabbedItemMessage;
public static string GrabbedAllObjectsMessage;
public static string DroppedAnItemMessage;
+ public static string ItemInformationFormat;
+
// Inventory
public static string InventoryItemFormat;
@@ -83,6 +85,7 @@ namespace HISP.Game
public static string NpcReplyFormat;
public static string NpcInformationButton;
public static string NpcTalkButton;
+ public static string NpcInformationFormat;
// Meta
public static string IsleFormat;
@@ -115,6 +118,15 @@ namespace HISP.Game
public static string BoatCutscene;
public static string WagonCutscene;
public static string BallonCutscene;
+
+ public static string FormatNpcInformation(string name, string description)
+ {
+ return NpcInformationFormat.Replace("%NAME%", name).Replace("%DESCRIPTION%", description);
+ }
+ public static string FormatItemInformation(string name, string description)
+ {
+ return ItemInformationFormat.Replace("%NAME%", name).Replace("%DESCRIPTION%", description);
+ }
public static string FormatNpcChatpoint(string name, string shortDescription, string chatText)
{
return NpcChatpointFormat.Replace("%NAME%", name).Replace("%DESCRIPTION%", shortDescription).Replace("%TEXT%", chatText);
diff --git a/Horse Isle Server/Horse Isle Server/Game/Meta.cs b/Horse Isle Server/Horse Isle Server/Game/Meta.cs
index 8e6bbf3..ab831e0 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Meta.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Meta.cs
@@ -30,6 +30,7 @@ namespace HISP.Game
User[] nearbyUsers = GameServer.GetNearbyUsers(x, y, true, true);
if (nearbyUsers.Length > 1)
{
+ playersNearby += Messages.Seperator;
playersNearby += Messages.NearbyPlayers;
playersNearby += Messages.Seperator;
@@ -76,7 +77,6 @@ namespace HISP.Game
private static string buildCommonInfo(int x, int y)
{
string message = "";
-
message += buildNearbyString(x, y);
// Dropped Items
@@ -124,6 +124,22 @@ namespace HISP.Game
}
return message;
}
+ public static string BuildNpcInfo(Npc.NpcEntry npcInfo)
+ {
+ string message = "";
+ message += Messages.FormatNpcInformation(npcInfo.Name, npcInfo.LongDescription);
+ message += Messages.BackToMap;
+ message += Messages.MetaTerminator;
+ return message;
+ }
+ public static string BuildItemInfo(Item.ItemInformation itemInfo)
+ {
+ string message = "";
+ message += Messages.FormatItemInformation(itemInfo.Name, itemInfo.Description);
+ message += Messages.BackToMap;
+ message += Messages.MetaTerminator;
+ return message;
+ }
public static string BuildTransportInfo(Transport.TransportPoint transportPoint)
{
string message = "";
@@ -151,8 +167,9 @@ namespace HISP.Game
if (specialTile.Description != null && specialTile.Description != "")
message += specialTile.Description;
-
- message += buildNpc(user, specialTile.X, specialTile.Y);
+
+ string npc = buildNpc(user, specialTile.X, specialTile.Y);
+ message += npc;
if (specialTile.Code == null)
message += buildCommonInfo(specialTile.X, specialTile.Y);
@@ -259,6 +276,7 @@ namespace HISP.Game
message += buildNpc(user, x, y);
+
message += buildCommonInfo(x, y);
return message;
}
diff --git a/Horse Isle Server/Horse Isle Server/Game/Npc.cs b/Horse Isle Server/Horse Isle Server/Game/Npc.cs
index 239cf3a..ead5125 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Npc.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Npc.cs
@@ -84,6 +84,18 @@ namespace HISP.Game
throw new KeyNotFoundException("Npc chatpoint id: " + chatpointId + " not found!");
}
+ public static bool NpcExists(int id)
+ {
+ try
+ {
+ GetNpcById(id);
+ return true;
+ }
+ catch (KeyNotFoundException)
+ {
+ return false;
+ }
+ }
public static NpcEntry GetNpcById(int id)
{
foreach(NpcEntry npc in NpcList)
diff --git a/Horse Isle Server/Horse Isle Server/Player/User.cs b/Horse Isle Server/Horse Isle Server/Player/User.cs
index 7251751..a1d6d63 100644
--- a/Horse Isle Server/Horse Isle Server/Player/User.cs
+++ b/Horse Isle Server/Horse Isle Server/Player/User.cs
@@ -24,6 +24,8 @@ namespace HISP.Player
public bool MuteSocials = false;
public bool MuteLogins = false;
+ public bool MetaPriority = false;
+
public bool Stealth = false;
public int Facing;
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
index ff8fd03..a27e7df 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
@@ -133,6 +133,7 @@ namespace HISP.Server
byte method = packet[1];
if (method == PacketBuilder.VIEW_PROFILE)
{
+ sender.LoggedinUser.MetaPriority = true;
byte[] profilePacket = PacketBuilder.CreateProfilePacket(sender.LoggedinUser.ProfilePage);
sender.SendPacket(profilePacket);
}
@@ -325,6 +326,7 @@ namespace HISP.Server
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to start talking to an NPC with id that is NaN.");
return;
}
+ sender.LoggedinUser.MetaPriority = true;
Npc.NpcEntry entry = Npc.GetNpcById(chatId);
string metaInfo = Meta.BuildChatpoint(sender.LoggedinUser, entry, entry.Chatpoints[0]);
byte[] metaPacket = PacketBuilder.CreateMetaPacket(metaInfo);
@@ -364,13 +366,11 @@ namespace HISP.Server
UpdateArea(sender,true);
return;
}
+ sender.LoggedinUser.MetaPriority = true;
string metaInfo = Meta.BuildChatpoint(sender.LoggedinUser, lastNpc, Npc.GetNpcChatpoint(lastNpc, reply.GotoChatpoint));
byte[] metaPacket = PacketBuilder.CreateMetaPacket(metaInfo);
sender.SendPacket(metaPacket);
return;
-
-
-
}
}
public static void OnTransportUsed(GameClient sender, byte[] packet)
@@ -636,6 +636,58 @@ namespace HISP.Server
byte[] ChatPacket = PacketBuilder.CreateChat(Messages.BinocularsNothing, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(ChatPacket);
}
+ break;
+ case PacketBuilder.INFORMATION:
+ packetStr = Encoding.UTF8.GetString(packet);
+ randomIdStr = packetStr.Substring(3, packet.Length - 3);
+ randomId = 0;
+
+ try
+ {
+ randomId = Int32.Parse(randomIdStr);
+ }
+ catch (InvalidOperationException)
+ {
+ Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet.");
+ return;
+ }
+ if (packet[2] == PacketBuilder.ITEM_INFORMATON)
+ {
+
+ int itemId = -1;
+ if (sender.LoggedinUser.Inventory.HasItem(randomId))
+ itemId = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId).ItemId;
+ else if (DroppedItems.IsDroppedItemExist(randomId))
+ itemId = DroppedItems.GetDroppedItemById(randomId).instance.ItemId;
+
+ if (itemId == -1)
+ {
+ Logger.HackerPrint(sender.LoggedinUser.Username + " asked for details of non existiant item.");
+ return;
+ }
+ sender.LoggedinUser.MetaPriority = true;
+ Item.ItemInformation info = Item.GetItemById(itemId);
+ string infoMessage = Meta.BuildItemInfo(info);
+ byte[] metaPacket = PacketBuilder.CreateMetaPacket(infoMessage);
+ sender.SendPacket(metaPacket);
+ }
+ else if(packet[2] == PacketBuilder.NPC_INFORMATION)
+ {
+ if(Npc.NpcExists(randomId))
+ {
+ sender.LoggedinUser.MetaPriority = true;
+ Npc.NpcEntry npc = Npc.GetNpcById(randomId);
+ string infoMessage = Meta.BuildNpcInfo(npc);
+ byte[] metaPacket = PacketBuilder.CreateMetaPacket(infoMessage);
+ sender.SendPacket(metaPacket);
+ }
+ else
+ {
+ Logger.HackerPrint(sender.LoggedinUser.Username + " asked for details of non existiant npc.");
+ return;
+ }
+ }
+
break;
default:
Logger.WarnPrint(sender.LoggedinUser.Username + " Sent an unknown Item Interaction Packet type: " + action.ToString() + ", Packet Dump: " + BitConverter.ToString(packet).Replace('-', ' '));
@@ -705,7 +757,7 @@ namespace HISP.Server
if (client.LoggedIn)
if (!client.LoggedinUser.MuteLogins)
if (client.LoggedinUser.Id != userId)
- client.SendPacket(loginMessageBytes);
+ client.SendPacket(loginMessageBytes);
UpdateUserInfo(sender.LoggedinUser);
@@ -850,7 +902,9 @@ namespace HISP.Server
UpdateArea(client, justArea);
foreach (User nearbyUser in GameServer.GetNearbyUsers(client.LoggedinUser.X, client.LoggedinUser.Y, false, false))
if (nearbyUser.Id != client.LoggedinUser.Id)
- UpdateArea(nearbyUser.LoggedinClient, justArea);
+ if(!nearbyUser.MetaPriority)
+ UpdateArea(nearbyUser.LoggedinClient, justArea);
+
UpdateUserInfo(client.LoggedinUser);
}
@@ -859,6 +913,7 @@ namespace HISP.Server
{
if (!forClient.LoggedIn)
return;
+ forClient.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildInventoryInfo(forClient.LoggedinUser.Inventory));
forClient.SendPacket(metaPacket);
}
@@ -939,6 +994,7 @@ namespace HISP.Server
}
byte[] AreaMessage = PacketBuilder.CreateMetaPacket(LocationStr);
forClient.SendPacket(AreaMessage);
+ forClient.LoggedinUser.MetaPriority = false;
}
diff --git a/Horse Isle Server/Horse Isle Server/Server/Gamedata.cs b/Horse Isle Server/Horse Isle Server/Server/Gamedata.cs
index 9cd7691..ed5b1bb 100644
--- a/Horse Isle Server/Horse Isle Server/Server/Gamedata.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/Gamedata.cs
@@ -398,11 +398,12 @@ namespace HISP.Server
Messages.PasswordNotice = gameData.messages.chat.password_included;
Messages.CapsNotice = gameData.messages.chat.caps_notice;
- // Hardcoded messages
+ // Dropped Items
Messages.NothingMessage = gameData.messages.meta.dropped_items.nothing_message;
Messages.ItemsOnGroundMessage = gameData.messages.meta.dropped_items.items_message;
Messages.GrabItemFormat = gameData.messages.meta.dropped_items.item_format;
+ Messages.ItemInformationFormat = gameData.messages.meta.dropped_items.item_information_format;
Messages.GrabAllItemsButton = gameData.messages.meta.dropped_items.grab_all;
Messages.DroppedAnItemMessage = gameData.messages.dropped_item_message;
Messages.GrabbedAllObjectsMessage = gameData.messages.grab_all_message;
@@ -426,7 +427,7 @@ namespace HISP.Server
Messages.BackToMap = gameData.messages.meta.back_to_map;
Messages.LongFullLine = gameData.messages.meta.long_full_line;
Messages.MetaTerminator = gameData.messages.meta.end_of_meta;
-
+
Messages.GrabbedItemMessage = gameData.messages.grab_message;
Messages.GrabAllItemsMessage = gameData.messages.grab_all_message;
@@ -450,11 +451,12 @@ namespace HISP.Server
// Npc
- Messages.NpcStartChatFormat = gameData.messages.npc.start_chat_format;
- Messages.NpcChatpointFormat = gameData.messages.npc.chatpoint_format;
- Messages.NpcReplyFormat = gameData.messages.npc.reply_format;
- Messages.NpcTalkButton = gameData.messages.npc.npc_talk_button;
- Messages.NpcInformationButton = gameData.messages.npc.npc_information_button;
+ Messages.NpcStartChatFormat = gameData.messages.meta.npc.start_chat_format;
+ Messages.NpcChatpointFormat = gameData.messages.meta.npc.chatpoint_format;
+ Messages.NpcReplyFormat = gameData.messages.meta.npc.reply_format;
+ Messages.NpcTalkButton = gameData.messages.meta.npc.npc_talk_button;
+ Messages.NpcInformationButton = gameData.messages.meta.npc.npc_information_button;
+ Messages.NpcInformationFormat = gameData.messages.meta.npc.npc_information_format;
// Map Data
diff --git a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
index 39577b3..2448220 100644
--- a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs
@@ -59,6 +59,10 @@ namespace HISP.Server
public const byte CHAT_BOTTOM_RIGHT = 0x15;
public const byte CHAT_DM_RIGHT = 0x16;
+ public const byte INFORMATION = 0x28;
+ public const byte ITEM_INFORMATON = 0x14;
+ public const byte NPC_INFORMATION = 0x16;
+
public const byte ITEM_DROP = 0x1E;
public const byte ITEM_PICKUP = 0x14;
public const byte ITEM_BINOCULARS = 0x5C;
@@ -625,7 +629,7 @@ namespace HISP.Server
}
public static byte[] CreateWelcomeMessage(string username)
{
- string formattedStr = Messages.FormatLoginMessage(username);
+ string formattedStr = Messages.FormatWelcomeMessage(username);
return CreateChat(formattedStr, CHAT_BOTTOM_RIGHT);
}