diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json
index 425d560..36799b3 100644
--- a/DataCollection/gamedata.json
+++ b/DataCollection/gamedata.json
@@ -129,10 +129,10 @@
"fountain":"Although it's not recommended, you could drink from this fountain if you are thirsty...^T6Drink from the public fountain. ^B1D^R1^X^Z",
"venus_flytrap_format":"The Giant Venus Flytrap chomped at you!
OUCH!!
It chomped your pocket, taking $%MONEY% with it!!",
"password_input":"
^PLReply:|^PS14|ANSWER^R1",
- "poetry":{
+ "last_poet":"^R1^LLast Player Poet:%USERNAME% ^R1",
+ "multiroom":{
"other_players_participating":"
^LThe following other players are participating:",
- "partcipent_format":"^R1^T3%USERNAME%",
- "lastplayer_format":"^R1^LLast Player Poet:%USERNAME% ^R1"
+ "partcipent_format":"^R1^T3%USERNAME%"
},
"bank":{
"made_interest":"^LYou made $%MONEY% in interest since your last visit.^R1",
diff --git a/Horse Isle Server/Horse Isle Server/Game/Messages.cs b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
index 2380df9..3505e5c 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Messages.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
@@ -304,6 +304,13 @@ namespace HISP.Game
public static string LongFullLine;
public static string MetaTerminator;
+ // Birckpoet
+ public static string LastPoetFormat;
+
+ // Multiroom
+ public static string MultiroomPlayersParticipating;
+ public static string MultiroomParticipentFormat;
+
// Inn
public static string InnBuyMeal;
public static string InnBuyRest;
@@ -331,6 +338,14 @@ namespace HISP.Game
// Click
public static string NothingInterestingHere;
+ public static string FormatLastPoet(string name)
+ {
+ return LastPoetFormat.Replace("%USERNAME%", name);
+ }
+ public static string FormatMultiroomParticipent(string name)
+ {
+ return MultiroomParticipentFormat.Replace("%USERNAME%", name);
+ }
public static string FormatVenusFlyTrapMeta(int money)
{
return VenusFlyTrapFormat.Replace("%MONEY%", money.ToString("N0"));
diff --git a/Horse Isle Server/Horse Isle Server/Game/Meta.cs b/Horse Isle Server/Horse Isle Server/Game/Meta.cs
index 6ee0713..1e02750 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Meta.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Meta.cs
@@ -206,6 +206,29 @@ namespace HISP.Game
return message;
}
+
+ private static string buildMultiroom(string id, User user)
+ {
+ string message = Messages.MultiroomPlayersParticipating;
+ foreach(User userOnTile in GameServer.GetUsersOnSpecialTileCode("MULTIROOM-"+id))
+ {
+ if (userOnTile.Id == user.Id)
+ continue;
+ message += Messages.FormatMultiroomParticipent(userOnTile.Username);
+ }
+ if(id[0] == 'P') // Poet
+ {
+ int lastPoet = Database.GetLastPlayer(id);
+ string username = "";
+ if(lastPoet != -1)
+ username = Database.GetUsername(lastPoet);
+
+ message += Messages.FormatLastPoet(username);
+ }
+ message += Messages.ExitThisPlace;
+ message += Messages.MetaTerminator;
+ return message;
+ }
private static string buildEquippedCompetitionGear(User user)
{
string message = Messages.CompetitionGearSelected;
@@ -698,6 +721,11 @@ namespace HISP.Game
{
message += buildVenusFlyTrap(user);
}
+ if(TileCode == "MULTIROOM")
+ {
+ user.MetaPriority = false; // acturally want to track updates here >-<
+ message += buildMultiroom(TileArg, user);
+ }
if(TileCode == "PASSWORD")
{
message += buildPassword();
@@ -721,6 +749,7 @@ namespace HISP.Game
return message;
}
+
public static string BuildAbuseReportPage()
{
string reportReasons = "";
diff --git a/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs b/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs
index a0e3772..01ff3f8 100644
--- a/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/SwfModules/Brickpoet.cs
@@ -150,6 +150,8 @@ namespace HISP.Game.SwfModules
{
Logger.InfoPrint("Loading poetry room: " + room.ToString());
poetryRooms.Add(getPoetryRoom(room));
+ if (!Database.LastPlayerExist("P" + room))
+ Database.AddLastPlayer("P" + room, -1);
}
}
diff --git a/Horse Isle Server/Horse Isle Server/Server/Database.cs b/Horse Isle Server/Horse Isle Server/Server/Database.cs
index 1bf6e01..ef3ca74 100644
--- a/Horse Isle Server/Horse Isle Server/Server/Database.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/Database.cs
@@ -33,6 +33,7 @@ namespace HISP.Server
string Leaderboards = "CREATE TABLE Leaderboards(playerId INT, minigame TEXT(128), wins INT, looses INT, timesplayed INT, score INT, type TEXT(128))";
string NpcStartPoint = "CREATE TABLE NpcStartPoint(playerId INT, npcId INT, chatpointId INT)";
string PoetryRooms = "CREATE TABLE PoetryRooms(poetId INT, X INT, Y INT, roomId INT)";
+ string LastPlayer = "CREATE TABLE LastPlayer(roomId TEXT(1028), playerId INT)";
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
@@ -216,6 +217,20 @@ namespace HISP.Server
Logger.WarnPrint(e.Message);
};
+ try
+ {
+
+ MySqlCommand sqlCommand = db.CreateCommand();
+ sqlCommand.CommandText = LastPlayer;
+ sqlCommand.ExecuteNonQuery();
+ sqlCommand.Dispose();
+ }
+ catch (Exception e)
+ {
+ Logger.WarnPrint(e.Message);
+ };
+
+
try
{
@@ -277,6 +292,71 @@ namespace HISP.Server
}
+ public static void AddLastPlayer(string roomId, int playerId)
+ {
+ using (MySqlConnection db = new MySqlConnection(ConnectionString))
+ {
+ db.Open();
+ MySqlCommand sqlCommand = db.CreateCommand();
+ sqlCommand.CommandText = "INSERT INTO LastPlayer VALUES(@roomId,@playerId)";
+ sqlCommand.Parameters.AddWithValue("@roomId", roomId);
+ sqlCommand.Parameters.AddWithValue("@playerId", playerId);
+ sqlCommand.Prepare();
+ sqlCommand.ExecuteNonQuery();
+
+ sqlCommand.Dispose();
+ }
+ }
+
+ public static bool LastPlayerExist(string roomId)
+ {
+ using (MySqlConnection db = new MySqlConnection(ConnectionString))
+ {
+ db.Open();
+ MySqlCommand sqlCommand = db.CreateCommand();
+ sqlCommand.CommandText = "SELECT COUNT(1) FROM LastPlayer WHERE roomId=@roomId";
+ sqlCommand.Parameters.AddWithValue("@roomId", roomId);
+ sqlCommand.Prepare();
+ int count = Convert.ToInt32(sqlCommand.ExecuteScalar());
+
+ sqlCommand.Dispose();
+ return count > 0;
+ }
+ }
+
+ public static int GetLastPlayer(string roomId)
+ {
+ using (MySqlConnection db = new MySqlConnection(ConnectionString))
+ {
+ db.Open();
+ MySqlCommand sqlCommand = db.CreateCommand();
+ sqlCommand.CommandText = "SELECT playerId FROM LastPlayer WHERE roomId=@roomId";
+ sqlCommand.Parameters.AddWithValue("@roomId", roomId);
+ sqlCommand.Prepare();
+ int playerId = Convert.ToInt32(sqlCommand.ExecuteScalar());
+
+ sqlCommand.Dispose();
+ return playerId;
+ }
+ }
+
+
+ public static void SetLastPlayer(string roomId, int playerId)
+ {
+ using (MySqlConnection db = new MySqlConnection(ConnectionString))
+ {
+ db.Open();
+ MySqlCommand sqlCommand = db.CreateCommand();
+ sqlCommand.CommandText = "UPDATE LastPlayer SET playerId=@playerId WHERE roomId=@roomId";
+ sqlCommand.Parameters.AddWithValue("@roomId", roomId);
+ sqlCommand.Parameters.AddWithValue("@playerId", playerId);
+ sqlCommand.Prepare();
+ sqlCommand.ExecuteNonQuery();
+
+ sqlCommand.Dispose();
+ }
+ }
+
public static void AddPoetWord(int id, int x, int y, int room)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
index 9cf6455..6e75567 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
@@ -453,6 +453,7 @@ namespace HISP.Server
}
+
Item.Present = gameData.item.special.present;
Item.MailMessage = gameData.item.special.mail_message;
Item.DorothyShoes = gameData.item.special.dorothy_shoes;
@@ -589,6 +590,13 @@ namespace HISP.Server
Messages.PasswordNotice = gameData.messages.chat.password_included;
Messages.CapsNotice = gameData.messages.chat.caps_notice;
+ // Brickpoet
+ Messages.LastPoetFormat = gameData.messages.meta.last_poet;
+
+ // Mutliroom
+ Messages.MultiroomParticipentFormat = gameData.messages.meta.multiroom.partcipent_format;
+ Messages.MultiroomPlayersParticipating = gameData.messages.meta.multiroom.other_players_participating;
+
// Dropped Items
Messages.NothingMessage = gameData.messages.meta.dropped_items.nothing_message;
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
index 5a096dc..75deec2 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
@@ -484,7 +484,6 @@ namespace HISP.Server
break;
}
-
int roomId = packet[2] - 40;
int peiceId;
int x;
@@ -501,37 +500,31 @@ namespace HISP.Server
room = Brickpoet.GetPoetryRoom(roomId);
peice = Brickpoet.GetPoetryPeice(room, peiceId);
+
}
catch (Exception)
{
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to move a peice in an invalid brickpoet room: " + roomId);
break;
}
+
peice.X = x;
peice.Y = y;
- foreach(GameClient client in connectedClients)
+ foreach(User user in GetUsersOnSpecialTileCode("MULTIROOM-" + "P" + roomId.ToString()))
{
- if(client.LoggedIn)
- {
- if (client.LoggedinUser.Id == sender.LoggedinUser.Id)
- continue;
+ if (user.Id == sender.LoggedinUser.Id)
+ continue;
- if (World.InSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y))
- {
- World.SpecialTile tile = World.GetSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y);
+ byte[] updatePoetRoomPacket = PacketBuilder.CreateBrickPoetMovePacket(peice);
+ user.LoggedinClient.SendPacket(updatePoetRoomPacket);
+
+ }
- if (tile.Code.StartsWith("MULTIROOM-"))
- {
- string roomNo = tile.Code.Split('-')[1];
- if (roomNo == "P" + roomId.ToString())
- {
- byte[] updatePoetRoomPacket = PacketBuilder.CreateBrickPoetMovePacket(peice);
- client.SendPacket(updatePoetRoomPacket);
- }
- }
- }
- }
+ if (Database.GetLastPlayer("P" + roomId) == sender.LoggedinUser.Id)
+ {
+ Database.SetLastPlayer("P" + roomId, sender.LoggedinUser.Id);
+ UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y);
}
break;
@@ -2399,6 +2392,29 @@ namespace HISP.Server
return usersInIsle.ToArray();
}
+
+ public static User[] GetUsersOnSpecialTileCode(string code)
+ {
+ List userList = new List();
+
+ foreach (GameClient client in connectedClients)
+ {
+ if (client.LoggedIn)
+ {
+
+ if (World.InSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y))
+ {
+ World.SpecialTile tile = World.GetSpecialTile(client.LoggedinUser.X, client.LoggedinUser.Y);
+
+ if (tile.Code == code)
+ {
+ userList.Add(client.LoggedinUser);
+ }
+ }
+ }
+ }
+ return userList.ToArray();
+ }
public static User[] GetUsersAt(int x, int y, bool includeStealth = false, bool includeMuted = false)
{
List usersHere = new List();