From 8078554918dc4e239c991e0020c26b943f580c88 Mon Sep 17 00:00:00 2001 From: supertiger1234 Date: Mon, 21 Dec 2020 14:31:06 +0000 Subject: [PATCH] added stats idk!! --- .../Horse Isle Server/Server/Database.cs | 56 ++++ .../Horse Isle Server/Server/GameClient.cs | 3 +- .../Horse Isle Server/Server/GameServer.cs | 4 +- WebInterface/master-site/index.html | 228 ------------- WebInterface/master-site/index.php | 306 ++++++++++++++++++ 5 files changed, 367 insertions(+), 230 deletions(-) delete mode 100644 WebInterface/master-site/index.html create mode 100644 WebInterface/master-site/index.php diff --git a/Horse Isle Server/Horse Isle Server/Server/Database.cs b/Horse Isle Server/Horse Isle Server/Server/Database.cs index 02c0104..48ce5d5 100644 --- a/Horse Isle Server/Horse Isle Server/Server/Database.cs +++ b/Horse Isle Server/Horse Isle Server/Server/Database.cs @@ -24,6 +24,9 @@ namespace HISP.Server string ShopInventory = "CREATE TABLE ShopInventory(ShopID INT, RandomID INT, ItemID INT)"; string DroppedItems = "CREATE TABLE DroppedItems(X INT, Y INT, RandomID INT, ItemID INT, DespawnTimer INT)"; string TrackedQuest = "CREATE TABLE TrackedQuest(playerId INT, questId INT, timesCompleted INT)"; + string OnlineUsers = "CREATE TABLE OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3))"; + string DeleteOnlineUsers = "DELETE FROM OnlineUsers"; + try { @@ -148,6 +151,29 @@ namespace HISP.Server { Logger.WarnPrint(e.Message); }; + try + { + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = OnlineUsers; + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + catch (Exception e) + { + Logger.WarnPrint(e.Message); + }; + try + { + + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = DeleteOnlineUsers; + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + catch (Exception e) + { + Logger.WarnPrint(e.Message); + }; } } @@ -379,6 +405,36 @@ namespace HISP.Server sqlCommand.Dispose(); } } + public static void AddOnlineUser(int playerId, bool Admin, bool Moderator) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "INSERT INTO OnlineUsers VALUES(@playerId, @admin, @moderator)"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + sqlCommand.Parameters.AddWithValue("@admin", Admin ? "YES" : "NO"); + sqlCommand.Parameters.AddWithValue("@moderator", Moderator ? "YES" : "NO"); + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + } + public static void RemoveOnlineUser(int playerId) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "DELETE FROM OnlineUsers WHERE (playerId=@playerId)"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + } public static List GetShopInventory(int shopId) { using (MySqlConnection db = new MySqlConnection(ConnectionString)) diff --git a/Horse Isle Server/Horse Isle Server/Server/GameClient.cs b/Horse Isle Server/Horse Isle Server/Server/GameClient.cs index b69019c..56da355 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameClient.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameClient.cs @@ -198,7 +198,7 @@ namespace HISP.Server public void Disconnect() { - recvPackets.Abort(); + if(updateTimer != null) updateTimer.Dispose(); if(inactivityTimer != null) @@ -213,6 +213,7 @@ namespace HISP.Server LoggedinUser = null; ClientSocket.Close(); ClientSocket.Dispose(); + recvPackets.Abort(); } public void Kick(string Reason) diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs index 67fbbe0..b5015b8 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs @@ -65,6 +65,7 @@ namespace HISP.Server Logger.ErrorPrint(sender.RemoteIp + " Requested user information when not logged in."); return; } + Database.AddOnlineUser(sender.LoggedinUser.Id, sender.LoggedinUser.Administrator, sender.LoggedinUser.Moderator); Logger.DebugPrint(sender.LoggedinUser.Username + " Requested user information."); User user = sender.LoggedinUser; @@ -1205,9 +1206,10 @@ namespace HISP.Server public static void OnDisconnect(GameClient sender) { connectedClients.Remove(sender); - + Logger.DebugPrint("owoo disconnect"); if (sender.LoggedIn) { + Database.RemoveOnlineUser(sender.LoggedinUser.Id); // Send disconnect message byte[] logoutMessageBytes = PacketBuilder.CreateChat(Messages.FormatLogoutMessage(sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_LEFT); foreach (GameClient client in ConnectedClients) diff --git a/WebInterface/master-site/index.html b/WebInterface/master-site/index.html deleted file mode 100644 index 64bd0d8..0000000 --- a/WebInterface/master-site/index.html +++ /dev/null @@ -1,228 +0,0 @@ - -HORSE ISLE - Online Multiplayer Horse Game - - - - - - - - - - - - - - - - - - - - - -
Welcome to Horse Isle 
- - - - - -
USER:
PASS:
(Forgot?)
- -
 
-
- - -
- -
- - - - - - - -

Create a FREE Account
OR Log into your existing Horse Isle account at upper right
OR Give a Gift Membership or Bonus to an existing player
-
-Fan Art Competition Winners: View Fan Art Contests from 2009 and 2011.
-
-Parents! Please click for some important information: Parent's Guide
-
- -CURRENTLY:
12 Players Online Now
11 Subscribers Online Now
0 Moderators Online Now
3,981 Active Accounts

ABOUT:
-Horse Isle is a vast multi-player horse based world. It allows for many players to interact while searching for wild -horses roaming the lands. Once you have a horse, you can train it, take care of it, and compete with other players. Although the world graphics are simple 2D, they have been beautifully designed to create an interesting and vast world to explore. This land is completely non-violent. A great place for any aged player to have fun. -
- -
-

- -(If you can see the scene above, it should tell you if you have the necessary software required to play the game)
-(If not, you would need to download/upgrade for free Flash Player) -
- -
-
COSTS:
-You can play Horse Isle for FREE! or $5/mo USD game memberships provide many benefits.
- -
FEATURES:
-Several different entertaining game activities:
-
    -
  • Capturing, training, and competing with your horses. These involve racing, jumping, dressage - all many-player games. Winning these events takes a combination of your horse's abilities, and your skill at the particular game.
  • -
  • Completing mini-games throughout the world for fun and game money. Many are multiplayer also.
  • -
  • Solving story-based quests and adventures by talking with characters in the game. There is a large variation of quests, from buried treasure, labyrinths, and painting, to simply returning someone's books!
  • -
  • Buying and building up your very own ranch, making a piece of Horse Isle your very own!
  • -
  • Naming and taking care of your horses. Finding them better tack, or even finding your horse a nice pet!
  • -
  • Interacting with other players via chat, private chat, postal messages, actions, trading, competitive mini-games, and cooperative mini-games. Group activities include drawing rooms, music rooms, and poetry rooms!
  • -
  • Searching the world for buried treasures, rare items, and hidden adventures.
  • -
  • Trying to get the highest score or best times of many different tracked games.
  • -
-Ever-expanding content within the world includes:
-
    -
  • 20+ unique communities located on different islands and climates. With unique weather systems.
  • -
  • Over 100 unique horse breeds, very detailed with professional renderings of each breed in each color. More added regularly.
  • -
  • 500+ computer characters (residents) which you can interact with to complete adventures and learn things.
  • -
  • 500+ Adventure Quests. Completing these can earn you awards and bonuses.
  • -
  • Hundreds of unique objects that can be found in the world or handled during quests.
  • -
  • 60+ unique minigames, many horse-based.
  • -
  • Many completely original soundtracks and game musics, professionally produced.
  • -
-
-REQUIRES:
-The game requires Flash 8. So any computer with Flash 8 should be able to run it (PC, MAC, and Linux (with Flash Player 9)). -However it does use a lot of graphics, so a slow computer may have troubles. Any computer bought in the last 3-5 years should be fine. It also needs quick Internet, so dialup users may not enjoy the game fully. - -

SCREEN SHOTS: (Pause your mouse over an image to popup details)
-The Group Drawing Room. Great place for pictionary, tictactoe or just drawing! -The Library. Viewing one of the breeds of Horse Isle. -Treeton. One of the towns in Horse Isle. -Quite the gathering of horse riders in the Desert! -A cold little community in Horse Isle. -A Drawing Room competition area on Art Isle. -Giant flowers and Rainbows make Flower Isle a special Island to visit. -One of the Arena MiniGames, This is Horse Racing. - - -
-
-
-Horse Isle tested and developed using Firefox Browser
- - - - - - -
-
-[ New Player Guide ]
-[ Rules ] -[ Terms and Conditions ] -[ Privacy Policy ]

-[ Expected Behavior ] -[ Contact Us ] -[ Credits ]
-Copyright © 2020 Horse Isle - - - - - diff --git a/WebInterface/master-site/index.php b/WebInterface/master-site/index.php new file mode 100644 index 0000000..61f3acf --- /dev/null +++ b/WebInterface/master-site/index.php @@ -0,0 +1,306 @@ + + + + + HORSE ISLE - Online Multiplayer Horse Game + + + + + + + + + + + + + + + + + +
Welcome to Horse Isle 
+ + + + + + + + + + + + + +
USER:
PASS:
(Forgot? )
 
+ + +
+ + + + +
+ + + + + +
+ + + + + + + +
+

Create a FREE Account
+
+
+ OR Log into your existing Horse Isle account at upper right + +
+
OR Give a Gift Membership or Bonus to an + existing player

+ Fan Art Competition Winners: View Fan + Art Contests from 2009 and 2011.
+
+ Parents! Please click for some important information: Parent's Guide
+
+ + CURRENTLY:
+ fetch_row()[0] )?> Players Online Now
+ fetch_row()[0] )?> Subscribers Online Now
+ fetch_row()[0] )?> Moderators Online Now
+ fetch_row()[0] )?> Active Accounts

+ ABOUT:
+ Horse Isle is a vast multi-player horse based world. It allows for many players to + interact while searching for wild + horses roaming the lands. Once you have a horse, you can train it, take care of + it, and compete with other players. Although the world graphics are simple 2D, + they have been beautifully designed to create an interesting and vast world to + explore. This land is completely non-violent. A great place for any aged player to + have fun. +
+ +
+

+ + (If you can see the scene above, it should tell you if you have the necessary + software required to play the game)
+ (If not, you would need to download/upgrade for free Flash Player)

COSTS:
+ You can play Horse Isle for FREE! or $5/mo USD game memberships provide many benefits.
+ +
FEATURES:
+ Several different entertaining game activities:
+
    +
  • Capturing, training, and competing with your horses. These involve racing, + jumping, dressage - all many-player games. Winning these events takes a + combination of your horse's abilities, and your skill at the particular game. +
  • +
  • Completing mini-games throughout the world for fun and game money. Many are + multiplayer also.
  • +
  • Solving story-based quests and adventures by talking with characters in the + game. There is a large variation of quests, from buried treasure, labyrinths, + and painting, to simply returning someone's books!
  • +
  • Buying and building up your very own ranch, making a piece of Horse Isle + your very own!
  • +
  • Naming and taking care of your horses. Finding them better tack, or even + finding your horse a nice pet!
  • +
  • Interacting with other players via chat, private chat, postal messages, + actions, trading, competitive mini-games, and cooperative mini-games. Group + activities include drawing rooms, music rooms, and poetry rooms!
  • +
  • Searching the world for buried treasures, rare items, and hidden adventures. +
  • +
  • Trying to get the highest score or best times of many different tracked + games.
  • +
+ Ever-expanding content within the world includes:
+
    +
  • 20+ unique communities located on different islands and climates. With + unique weather systems.
  • +
  • Over 100 unique horse breeds, very detailed with professional renderings of + each breed in each color. More added regularly.
  • +
  • 500+ computer characters (residents) which you can interact with to complete + adventures and learn things.
  • +
  • 500+ Adventure Quests. Completing these can earn you awards and bonuses. +
  • +
  • Hundreds of unique objects that can be found in the world or handled during + quests.
  • +
  • 60+ unique minigames, many horse-based.
  • +
  • Many completely original soundtracks and game musics, professionally + produced.
  • +
+
+ REQUIRES:
+ The game requires Flash 8. So any computer with Flash 8 should be able to run it + (PC, MAC, and Linux (with Flash Player 9)). + However it does use a lot of graphics, so a slow computer may have troubles. Any + computer bought in the last 3-5 years should be fine. It also needs quick + Internet, so dialup users may not enjoy the game fully. + +

SCREEN SHOTS: (Pause your mouse over an image to popup details)
+
+ The Group Drawing Room. Great place for pictionary, tictactoe or just drawing! + The Library. Viewing one of the breeds of Horse Isle. + Treeton. One of the towns in Horse Isle. + Quite the gathering of horse riders in the Desert! + A cold little community in Horse Isle. + A Drawing Room competition area on Art Isle. + Giant flowers and Rainbows make Flower Isle a special Island to visit. + One of the Arena MiniGames, This is Horse Racing. + + +
+
+
+ Horse Isle tested and developed using Firefox Browser
+ + + +
+
+ [ New Player Guide ]
+ [ Rules ] [ Terms + and Conditions ] [ Privacy Policy ]
+
+ [ Expected Behavior ] [ Contact Us ] [ Credits + ]
+ Copyright © 2020 Horse Isle + + + + \ No newline at end of file