From 15eb93ea77b2dc836c282753cb6ea8cddf5b12de Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Sun, 7 Feb 2021 16:26:22 +1300 Subject: [PATCH] Add 1 million bucks --- DataCollection/gamedata.json | 3 ++ .../HorseIsleServer/Game/Messages.cs | 5 +++ .../HorseIsleServer/Game/World.cs | 2 +- .../HorseIsleServer/Server/GameDataJson.cs | 5 +++ .../HorseIsleServer/Server/GameServer.cs | 45 +++++++++++++++---- 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 1c91258..ce6e276 100755 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -11,6 +11,7 @@ "click_nothing_message":"Nothing interesting here...", "playtime_timeout":"You have run out of playtime for now. In one minute you will be disconnected. You gain one minute of playtime every 8 minutes. Please come back later!", "random_movement":"You are sooo %STAT%. You wander dizzily in a different direction.", + "incorrect_password":"Incorrect. You will have to find the correct answer somewhere...", "new_user":{ "starting_message":"Welcome Newest Rider of Horse Isle!
Start by talking to Welcome Willy in the cabin. Click the TALK button by his name in the right hand window. He will know the location of a buried treasure on this island! Move to the spot he describes using the arrow keys. Then Click the WRENCH Icon at the lower right.", "starting_x":522, @@ -54,6 +55,7 @@ "item_deleted":"You Lost an %ITEM%!", "money_earned":"You Earned $%MONEY%!", "highscore_beaten":"You just beat your best score! New high score: %SCORE%.", + "best_highscore_beaten":"CONGRATULATIONS! You just beat the all time top score! BONUS: $2,500", "best_time_beaten":"Your new best time: %TIME%." }, "dropped_items":{ @@ -233,6 +235,7 @@ "horse_release":"Are you SURE you want to let the horse go?^T2If so, click ^B3X%RANDOMID%^R6", "cant_release_currently_riding":"You cannot release the horse you are riding!", "released_horse":"You released the horse! It now roams Horse Isle freely. It will disappear in an hour.", + "horse_bucked":"Your inexperienced horse has become frustrated and has bucked you off! (Horse gained 1exp)", "allstats":{ "all_stats_header":"All of your horses' complete stats:", "horse_name_entry":"

%HORSENAME%: %COLOR% %BREEDNAME% %SEX% (%EXP%exp)
", diff --git a/Horse Isle Server/HorseIsleServer/Game/Messages.cs b/Horse Isle Server/HorseIsleServer/Game/Messages.cs index 52ca69a..007eb0f 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Messages.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Messages.cs @@ -244,6 +244,7 @@ namespace HISP.Game public static string HorseEntryFormat; public static string ViewBaiscStats; public static string ViewAdvancedStats; + public static string HorseBuckedYou; public static string HorseRidingMessageFormat; public static string HorseNameFormat; @@ -469,6 +470,7 @@ namespace HISP.Game public static string YouLostAnItemFormat; public static string YouEarnedMoneyFormat; public static string BeatHighscoreFormat; + public static string BeatBestHighscore; public static string BeatBestTimeFormat; // Abuse Report @@ -574,6 +576,9 @@ namespace HISP.Game public static string KickReasonIdleFormat; public static string KickReasonNoTime; + // Password + public static string IncorrectPasswordMessage; + // Swf public static string BoatCutscene; public static string WagonCutscene; diff --git a/Horse Isle Server/HorseIsleServer/Game/World.cs b/Horse Isle Server/HorseIsleServer/Game/World.cs index 829815b..54d9f3f 100755 --- a/Horse Isle Server/HorseIsleServer/Game/World.cs +++ b/Horse Isle Server/HorseIsleServer/Game/World.cs @@ -73,7 +73,7 @@ namespace HISP.Game Database.SetWeather(Name, value); foreach(User user in GameServer.GetUsersInIsle(this,true,true)) { - GameServer.UpdateWeather(user.LoggedinClient); + GameServer.UpdateWorld(user.LoggedinClient); } } } diff --git a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs index e8a65b9..0ed802f 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs @@ -788,6 +788,7 @@ namespace HISP.Server Messages.HorseEntryFormat = gameData.messages.meta.horse.horse_format; Messages.ViewBaiscStats = gameData.messages.meta.horse.view_basic_stats; Messages.ViewAdvancedStats = gameData.messages.meta.horse.view_advanced_stats; + Messages.HorseBuckedYou = gameData.messages.meta.horse.horse_bucked; Messages.HorseRidingMessageFormat = gameData.messages.meta.horse.riding_message; Messages.HorseNameFormat = gameData.messages.meta.horse.horse_inventory.your_horse_format; @@ -1069,6 +1070,9 @@ namespace HISP.Server Messages.InnCannotAffordService = gameData.messages.inn.cant_afford; Messages.InnFullyRested = gameData.messages.inn.fully_rested; + // Password + Messages.IncorrectPasswordMessage = gameData.messages.incorrect_password; + // Fountain Messages.FountainMeta = gameData.messages.meta.fountain; Messages.FountainDrankYourFull = gameData.messages.fountain.drank_your_fill; @@ -1110,6 +1114,7 @@ namespace HISP.Server Messages.YouLostAnItemFormat = gameData.messages.sec_code.item_deleted; Messages.YouEarnedMoneyFormat = gameData.messages.sec_code.money_earned; Messages.BeatHighscoreFormat = gameData.messages.sec_code.highscore_beaten; + Messages.BeatBestHighscore = gameData.messages.sec_code.best_highscore_beaten; Messages.BeatBestTimeFormat = gameData.messages.sec_code.best_time_beaten; // Inventory diff --git a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs index 94d7524..4a4739e 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs @@ -1198,7 +1198,11 @@ namespace HISP.Server } else { - Quest.FailQuest(sender.LoggedinUser, Quest.GetQuestById(questId), false); + Quest.QuestResult result = Quest.FailQuest(sender.LoggedinUser, Quest.GetQuestById(questId), true); + if (result.NpcChat == null || result.NpcChat == "") + result.NpcChat = Messages.IncorrectPasswordMessage; + byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(ChatPacket); } } else @@ -2192,9 +2196,19 @@ namespace HISP.Server Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent correct sec code, but invalid score value"); return; } + Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameTitle, 5); + bool bestScoreEver = false; + if (scores.Length >= 1) + bestScoreEver = scores[0].Score <= value; bool newHighscore = sender.LoggedinUser.Highscores.UpdateHighscore(gameTitle, value, time); - if (newHighscore && !time) + if(bestScoreEver && !time) + { + byte[] bestScoreBeaten = PacketBuilder.CreateChat(Messages.BeatBestHighscore, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(bestScoreBeaten); + sender.LoggedinUser.Money += 2500; + } + else if (newHighscore && !time) { byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatHighscoreBeatenMessage(value), PacketBuilder.CHAT_BOTTOM_RIGHT); sender.SendPacket(chatPacket); @@ -2464,6 +2478,22 @@ namespace HISP.Server } User loggedInUser = sender.LoggedinUser; + + if(loggedInUser.CurrentlyRidingHorse != null) + { + if(loggedInUser.CurrentlyRidingHorse.BasicStats.Experience < 25) + { + if(GameServer.RandomNumberGenerator.Next(0,250) > 240) + { + loggedInUser.CurrentlyRidingHorse.BasicStats.Experience++; + sender.LoggedinUser.CurrentlyRidingHorse = null; + sender.LoggedinUser.Facing %= 5; + byte[] horseBuckedMessage = PacketBuilder.CreateChat(Messages.HorseBuckedYou, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(horseBuckedMessage); + } + } + } + byte movementDirection = packet[1]; if (loggedInUser.Thirst <= 0 || loggedInUser.Hunger <= 0 || loggedInUser.Tiredness <= 0) @@ -2571,7 +2601,7 @@ namespace HISP.Server newY -= 1; - if (loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move + if (loggedInUser.Facing == (direction + (onHorse * 5)) && loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move if (Map.CheckPassable(newX, newY - 1) || loggedInUser.NoClip) { newY -= 1; @@ -2585,7 +2615,7 @@ namespace HISP.Server newX -= 1; - if (loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move + if (loggedInUser.Facing == (direction + (onHorse * 5)) && loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move if (Map.CheckPassable(newX - 1, newY) || loggedInUser.NoClip) { newX -= 1; @@ -2599,7 +2629,7 @@ namespace HISP.Server newX += 1; - if (loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move + if (loggedInUser.Facing == (direction + (onHorse * 5)) && loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move if (Map.CheckPassable(newX + 1, newY) || loggedInUser.NoClip) { newX += 1; @@ -2613,7 +2643,7 @@ namespace HISP.Server newY += 1; - if (loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move + if (loggedInUser.Facing == (direction + (onHorse * 5)) && loggedInUser.CurrentlyRidingHorse != null && !World.InTown(loggedInUser.X, loggedInUser.Y)) // Double move if (Map.CheckPassable(newX, newY + 1) || loggedInUser.NoClip) { newY += 1; @@ -2642,7 +2672,6 @@ namespace HISP.Server sender.SendPacket(moveResponse); } - Update(sender); } public static void OnQuitPacket(GameClient sender, byte[] packet) @@ -4189,7 +4218,7 @@ namespace HISP.Server if(!nearbyUser.MetaPriority) UpdateArea(nearbyUser.LoggedinClient); - + UpdateWeather(client); UpdateUserInfo(client.LoggedinUser); }