diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 536b262..e6e5c9f 100644 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -87,11 +87,16 @@ "location_format":" You are%META% ", "tile_format":"%TILENAME%", "private_notes_format":"^ATMy Private Game Notes^H^PB160|%PRIVATENOTES%^PS7|SAVE NOTES", - "transport_format":"^R1^LTransport via %METHOD% to %PLACE%^R1^I%ICON%^T4Trip Costs $%COST% one way. ^B1M%XY%^BY%ID%", + "transport_format":"^LTransport via %METHOD% to %PLACE%^R1^I%ICON%^T4Trip Costs $%COST% one way. ^B1M%XY%^BY%ID%^R1", "exit_this_place":"^X", "end_of_meta":"^Z", "back_to_map":"^M", "long_full_line":"^L", + "awards_page":{ + "awards_header":"^ATYour Awards Earned^H", + "no_awards":"
You have not earned any awards yet. You can view a list of earnable awards in a Horse Isle Library.", + "award_format":"^I%ICON%^T8 %NAME% ($%BONUS% bonus)^R1" + }, "highscores":{ "header_meta":"^ATMini-Game Rankings^H", "highscore_format":"%GAMETITLE% Rank: #%RANKING% With: %SCORE% points (%TOTALPLAYS% plays)
", @@ -531127,5 +531132,62 @@ {"buys_item_types":["CLOTHES","ROCK","MISC","JEWELRY"],"buy_percent":75,"sell_percent":125,"stocks_itemids":[79,357,182]}, {"buys_item_types":["PLAYERFOOD"],"buy_percent":75,"sell_percent":125,"stocks_itemids":[129,126,132,140,537,348]}, {"buys_item_types":["PLAYERFOOD"],"buy_percent":75,"sell_percent":125,"stocks_itemids":[11,44,139,8,7]} + ], + "award_list":[ + {"sort_by":100,"title":"25% Quest Points Complete","icon_id":189,"earn_money":20000,"on_complete_text":"You have earned the 25% Quest Points Completed Award! $20,000 Bonus!","description":"Earn this award by completing one-quarter of the available Quest Points in the game."}, + {"sort_by":101,"title":"50% Quest Points Complete","icon_id":188,"earn_money":50000,"on_complete_text":"You have earned the 50% Quest Points Completed Award! $50,000 Bonus!","description":"Earn this award by completing one-half of the available Quest Points in the game."}, + {"sort_by":102,"title":"75% Quest Points Complete","icon_id":187,"earn_money":80000,"on_complete_text":"You have earned the 75% Quest Points Completed Award! $80,000 Bonus!","description":"Earn this award by completing three quarters of the available Quest Points in the game."}, + {"sort_by":103,"title":"100% Quest Points Complete","icon_id":177,"earn_money":150000,"on_complete_text":"You have earned the 100% Quest Points Completed Award! $150,000 Bonus!","description":"Earn this award by completing ALL of the available Quest Points in the game."}, + {"sort_by":64,"title":"Good Jumper","icon_id":179,"earn_money":5000,"on_complete_text":"You have earned the Good Jumper Award! $5,000 Bonus!","description":"Win a jumping arena competition (Advanced or Pro) with at least 2 other opponents to earn this award."}, + {"sort_by":64,"title":"Great Jumper","icon_id":178,"earn_money":15000,"on_complete_text":"You have earned the Great Jumper Award! $15,000 Bonus!","description":"Win a jumping arena competition (Advanced or Pro) with at least 4 other opponents to earn this award."}, + {"sort_by":64,"title":"Good Racer","icon_id":179,"earn_money":5000,"on_complete_text":"You have earned the Good Racer Award! $5,000 Bonus!","description":"Win a racing arena competition with at least 2 other opponents to earn this award."}, + {"sort_by":64,"title":"Great Racer","icon_id":178,"earn_money":15000,"on_complete_text":"You have earned the Great Racer Award! $15,000 Bonus!","description":"Win a racing arena competition with at least 4 other opponents to earn this award."}, + {"sort_by":64,"title":"Good Dressage","icon_id":179,"earn_money":5000,"on_complete_text":"You have earned the Good Dressage Award! $5,000 Bonus!","description":"Win a dressage arena competition with at least 2 other opponents to earn this award."}, + {"sort_by":64,"title":"Great Dressage","icon_id":178,"earn_money":15000,"on_complete_text":"You have earned the Great Dressage Award! $15,000 Bonus!","description":"Win a dressage arena competition with at least 4 other opponents to earn this award."}, + {"sort_by":40,"title":"Riddler's Riddles Award","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Riddler's Riddles Award! $5,000 Bonus!","description":"Complete all of the Riddler's Riddles to earn this award."}, + {"sort_by":50,"title":"Minigame Player","icon_id":189,"earn_money":5000,"on_complete_text":"You earned the Minigame Players Award! $5,000 Bonus!","description":"Get scores recorded in at least 30 different minigames to earn this Award."}, + {"sort_by":51,"title":"Minigame Master","icon_id":188,"earn_money":10000,"on_complete_text":"You earned the Minigame Master Award! $10,000 Bonus!","description":"Get scores recorded in at least 60 different minigames to earn this Award."}, + {"sort_by":55,"title":"Minigame Nut","icon_id":189,"earn_money":5000,"on_complete_text":"You have earned the Minigame Nut Award! $5,000 Bonus!","description":"Play minigames a grand total of 1000 times to earn this award."}, + {"sort_by":56,"title":"Minigame Crazy","icon_id":188,"earn_money":15000,"on_complete_text":"You have earned the Minigame Crazy Award! $15,000 Bonus!","description":"Play minigames a grand total of 10,000 times to earn this award."}, + {"sort_by":110,"title":"Beta Tester Award","icon_id":186,"earn_money":0,"on_complete_text":"Player was a Beta Tester.","description":"Player was a Beta Tester prior to game going Live."}, + {"sort_by":30,"title":"Geo Wiz","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Geo Wiz Award! $5,000 Bonus!","description":"Earn 7000 or more points in the Geo Hunt mini game."}, + {"sort_by":69,"title":"Pirate Tracker","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Pirate Tracker Award! $5,000 Bonus!","description":"Find 10 buried pirate treasures to earn this award."}, + {"sort_by":69,"title":"Pirate Stalker","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Pirate Stalker Award! $15,000 Bonus!","description":"Find 100 buried pirate treasures to earn this award."}, + {"sort_by":68,"title":"Leprechaun","icon_id":49,"earn_money":5000,"on_complete_text":"You have earned the Leprechaun Award! $5,000 Bonus!","description":"Find 3 Pots of Gold to earn this award."}, + {"sort_by":68,"title":"Lucky Leprechaun","icon_id":49,"earn_money":15000,"on_complete_text":"You have earned the Lucky Leprechaun Award! $15,000 Bonus!","description":"Find 20 Pots of Gold to earn this award."}, + {"sort_by":78,"title":"Craftiness","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Craftiness Award! $5,000 Bonus!","description":"Craft 100 times to earn this award."}, + {"sort_by":78,"title":"Workmanship","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Workmanship Award! $15,000 Bonus!","description":"Craft 1,000 times to earn this award."}, + {"sort_by":82,"title":"Wrangler","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Wrangler Award! $5,000 Bonus!","description":"Capture horses 100 times to earn this award."}, + {"sort_by":82,"title":"Pro Wrangler","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Pro Wrangler Award! $15,000 Bonus!","description":"Capture horses 1,000 times to earn this award."}, + {"sort_by":85,"title":"Pro Trainer","icon_id":186,"earn_money":25000,"on_complete_text":"You have earned the Pro Trainer Award! $25,000 Bonus!","description":"Train horses 1,000 times to earn this award."}, + {"sort_by":80,"title":"Traveler","icon_id":186,"earn_money":10000,"on_complete_text":"You have earned the Traveler Award! $10,000 Bonus!","description":"Take a transport 500 times to earn this award."}, + {"sort_by":80,"title":"Globetrotter","icon_id":186,"earn_money":30000,"on_complete_text":"You have earned the Globetrotter Award! $30,000 Bonus!","description":"Take a transport 5,000 times to earn this award."}, + {"sort_by":73,"title":"Trader","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Trader Award! $5,000 Bonus!","description":"Make 100 trades with other players to earn this award."}, + {"sort_by":70,"title":"Well Wisher","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Well Wisher Award! $5,000 Bonus!","description":"Use 100 wishing coins to earn this award."}, + {"sort_by":70,"title":"Star Wisher","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Star Wisher Award! $15,000 Bonus!","description":"Use 1,000 wishing coins to earn this award."}, + {"sort_by":64,"title":"Perseverance","icon_id":178,"earn_money":15000,"on_complete_text":"You have earned the Perseverance Award! $15,000 Bonus!","description":"Lose 100 arena competitions to earn this award."}, + {"sort_by":41,"title":"Quick Wit","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Quick Wit Award! $5,000 Bonus!","description":"Answer 25 Real Time Riddles to earn this award."}, + {"sort_by":41,"title":"Riddle Genius","icon_id":186,"earn_money":15000,"on_complete_text":"You earned the Riddle Genius Award! $15,000 Bonus!","description":"Answer 250 Real Time Riddles to earn this award."}, + {"sort_by":30,"title":"Horse Anatomy Wiz","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Horse Anatomy Wiz Award! $5,000 Bonus!","description":"Earn 10,500 or more points in the Horse Parts mini game."}, + {"sort_by":30,"title":"Diamond Miner","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Diamond Miner Award! $5,000 Bonus!","description":"Earn 19,000 or more points in the Diamond Math Mine mini game."}, + {"sort_by":30,"title":"Coco-Nut Award","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Coco-Nut Award Award! $5,000 Bonus!","description":"Earn 2500 or more points in the Coconut Bounce mini game."}, + {"sort_by":64,"title":"Strong Horse Award","icon_id":179,"earn_money":5000,"on_complete_text":"You have earned the Strong Horse Award! $5,000 Bonus!","description":"Win a draft arena competition with at least 2 other opponents to earn this award."}, + {"sort_by":64,"title":"Strongest Horse Award","icon_id":178,"earn_money":15000,"on_complete_text":"You have earned the Strongest Horse Award! $15,000 Bonus!","description":"Win a draft arena competition with at least 4 other opponents to earn this award."}, + {"sort_by":90,"title":"Camel Rider","icon_id":186,"earn_money":5000,"on_complete_text":"You earned the Camel Rider Award! $5,000 Bonus!","description":"Ride a camel to earn this award."}, + {"sort_by":90,"title":"Llama Rider","icon_id":186,"earn_money":3000,"on_complete_text":"You earned the Llama Rider Award! $3,000 Bonus!","description":"Ride a llama to earn this award."}, + {"sort_by":110,"title":"Pegasus Friend","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Pegasus Friend Award! $5,000 Bonus!","description":"Team up with a Pegasus 5 times at the Uniter to earn this award."}, + {"sort_by":110,"title":"Unicorn Friend","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Unicorn Friend Award! $5,000 Bonus!","description":"Team up with a Unicorn 5 times at the Uniter to earn this award."}, + {"sort_by":88,"title":"Vendor","icon_id":186,"earn_money":5000,"on_complete_text":"You have earned the Vendor Award! $5,000 Bonus!","description":"Sell 100 horses to the Pawneer to earn this award."}, + {"sort_by":88,"title":"Pro Vendor","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Pro Vendor Award! $15,000 Bonus!","description":"Sell 1,000 horses to the Pawneer to earn this award."}, + {"sort_by":82,"title":"Top Wrangler","icon_id":186,"earn_money":50000,"on_complete_text":"You have earned the Top Wrangler Award! $50,000 Bonus!","description":"Capture horses 10,000 times to earn this award."}, + {"sort_by":78,"title":"Star Apprentice","icon_id":186,"earn_money":50000,"on_complete_text":"You have earned the Star Apprentice Award! $50,000 Bonus!","description":"Craft 10,000 times to earn this award."}, + {"sort_by":78,"title":"Master Craftsman","icon_id":186,"earn_money":250000,"on_complete_text":"You have earned the Master Craftsman Award! $250,000 Bonus!","description":"Craft 100,000 times to earn this award."}, + {"sort_by":80,"title":"Tour Guide","icon_id":186,"earn_money":250000,"on_complete_text":"You have earned the Tour Guide Award! $250,000 Bonus!","description":"Take a transport 50,000 times to earn this award."}, + {"sort_by":73,"title":"Pro Trader","icon_id":186,"earn_money":15000,"on_complete_text":"You have earned the Pro Trader Award! $15,000 Bonus!","description":"Make 1,000 trades with other players to earn this award."}, + {"sort_by":70,"title":"Extraordinary Wisher","icon_id":186,"earn_money":50000,"on_complete_text":"You have earned the Extraordinary Wisher Award! $50,000 Bonus!","description":"Use 10,000 wishing coins to earn this award."}, + {"sort_by":88,"title":"Top Vendor","icon_id":186,"earn_money":50000,"on_complete_text":"You have earned the Top Vendor Award! $50,000 Bonus!","description":"Sell 10,000 horses to the Pawneer to earn this award."}, + {"sort_by":85,"title":"Top Trainer","icon_id":186,"earn_money":100000,"on_complete_text":"You have earned the Top Trainer Award! $100,000 Bonus!","description":"Train horses 10,000 times to earn this award."}, + {"sort_by":41,"title":"Quiz Genius","icon_id":186,"earn_money":15000,"on_complete_text":"You earned the Quiz Genius Award! $15,000 Bonus!","description":"Finish 15 Real Time Quizzes first to earn this award."}, + {"sort_by":110,"title":"UniPeg Friend","icon_id":186,"earn_money":50000,"on_complete_text":"You have earned the UniPeg Friend Award! $50,000 Bonus!","description":"Team up with a UniPeg 5 times at the Uniter to earn this award."} ] } \ No newline at end of file diff --git a/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs b/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs index 98eca70..86e2f17 100644 --- a/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs +++ b/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs @@ -43,6 +43,19 @@ namespace HISP.Game.Chat return false; } } + if (args[0] == "QUEST") + { + int questId = 0; + try + { + questId = int.Parse(args[1]); + Quest.ActivateQuest(user, Quest.GetQuestById(questId)); + } + catch (Exception) + { + return false; + } + } byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT); user.LoggedinClient.SendPacket(chatPacket); diff --git a/Horse Isle Server/Horse Isle Server/Game/Messages.cs b/Horse Isle Server/Horse Isle Server/Game/Messages.cs index 045b5da..6509a8f 100644 --- a/Horse Isle Server/Horse Isle Server/Game/Messages.cs +++ b/Horse Isle Server/Horse Isle Server/Game/Messages.cs @@ -1,4 +1,5 @@ using HISP.Server; +using System; namespace HISP.Game { @@ -173,6 +174,12 @@ namespace HISP.Game public static string GameHighScoreHeaderFormat; public static string GameHighScoreFormat; + // Awards + + public static string AwardHeader; + public static string NoAwards; + public static string AwardFormat; + // Shop public static string ThingsIAmSelling; @@ -240,6 +247,11 @@ namespace HISP.Game // Click public static string NothingInterestingHere; + public static string FormatAwardEntry(int iconId, string title, int moneyBonus) + { + return AwardFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", title).Replace("%BONUS%", moneyBonus.ToString("N0")); + } + public static string FormatBestTimeHeader(string gameName) { return GameBestTimeHeaderFormat.Replace("%GAMETITLE%", gameName); @@ -278,7 +290,9 @@ namespace HISP.Game } public static string FormatQuestFooter(int totalQuestsComplete, int totalQuests, int questPoints, int totalQuestPoints) { - return QuestFooterFormat.Replace("%TOTALCOMPLETED%", totalQuestsComplete.ToString("N0")).Replace("%TOTALQUESTS%", totalQuests.ToString("N0")).Replace("%TOTALPERCENT%", ((totalQuestsComplete / totalQuests) * 100).ToString()).Replace("%YOURQP%", questPoints.ToString("N0")).Replace("%YOURQP%", totalQuestPoints.ToString("N0")).Replace("%QPERCENT%", ((totalQuestsComplete / totalQuests) * 100).ToString()).Replace("%MAXQP%", totalQuestPoints.ToString("N0")); + int questsComplete = Convert.ToInt32(Math.Floor(((decimal)totalQuestsComplete / (decimal)totalQuests) * (decimal)100.0)); + int questPointsComplete = Convert.ToInt32(Math.Floor(((decimal)questPoints / (decimal)totalQuestPoints) * (decimal)100.0)); + return QuestFooterFormat.Replace("%TOTALCOMPLETED%", totalQuestsComplete.ToString("N0")).Replace("%TOTALQUESTS%", totalQuests.ToString("N0")).Replace("%TOTALPERCENT%", questsComplete.ToString()).Replace("%YOURQP%", questPoints.ToString("N0")).Replace("%YOURQP%", totalQuestPoints.ToString("N0")).Replace("%QPERCENT%", questPointsComplete.ToString()).Replace("%MAXQP%", totalQuestPoints.ToString("N0")); } public static string FormatQuestLogQuest(string questTitle, int questPoints, string difficulty, string completionStatus) { @@ -429,7 +443,7 @@ namespace HISP.Game } public static string FormatShopEntry(int iconid, string count, string name, int price) { - return ShopEntryFormat.Replace("%ICONID%", iconid.ToString()).Replace("%COUNT%", count).Replace("%TITLE%", name).Replace("%PRICE%", price.ToString()); + return ShopEntryFormat.Replace("%ICONID%", iconid.ToString()).Replace("%COUNT%", count).Replace("%TITLE%", name).Replace("%PRICE%", price.ToString("N0")); } public static string FormatWearButton(int randomId) { diff --git a/Horse Isle Server/Horse Isle Server/Game/Meta.cs b/Horse Isle Server/Horse Isle Server/Game/Meta.cs index ae263e7..3b3b862 100644 --- a/Horse Isle Server/Horse Isle Server/Game/Meta.cs +++ b/Horse Isle Server/Horse Isle Server/Game/Meta.cs @@ -323,7 +323,6 @@ namespace HISP.Game Transport.TransportLocation transportLocation = Transport.GetTransportLocation(transportLocationId); message += Messages.FormatTransportMessage(transportLocation.Type, transportLocation.LocationTitle, transportLocation.Cost, transportLocation.Id, transportLocation.GotoX, transportLocation.GotoY); } - message += "^R1"; message += Messages.ExitThisPlace; message += Messages.MetaTerminator; return message; @@ -358,6 +357,22 @@ namespace HISP.Game return message; } + public static string BuildAwardList(User user) + { + string message = Messages.AwardHeader; + if (user.Awards.AwardsEarned.Length <= 0) + message += Messages.NoAwards; + else + foreach(Award.AwardEntry award in user.Awards.AwardsEarned) + message += Messages.FormatAwardEntry(award.IconId, award.Title, award.MoneyBonus); + + + + + message += Messages.BackToMap; + message += Messages.MetaTerminator; + return message; + } public static string BuildQuestLog(User user) { string message = ""; @@ -382,14 +397,8 @@ namespace HISP.Game message += Messages.FormatQuestLogQuest(quest.Title, quest.QuestPointsEarned, quest.Difficulty, fmsg); } - int totalComplete = 0; - int totalQuestPoints = 0; - foreach(Quest.QuestEntry quest in questList) - { - if(user.Quests.GetTrackedQuestAmount(quest.Id) > 0) - totalComplete++; - totalQuestPoints += quest.QuestPointsEarned; - } + int totalComplete = Quest.GetTotalQuestsComplete(user); + int totalQuestPoints = Quest.GetTotalQuestPoints(); message += Messages.FormatQuestFooter(totalComplete, questList.Length, user.QuestPoints, totalQuestPoints); message += Messages.BackToMap; @@ -434,7 +443,7 @@ namespace HISP.Game if (TileCode == "TRANSPORT") { Transport.TransportPoint point = Transport.GetTransportPoint(specialTile.X, specialTile.Y); - message += Meta.BuildTransportInfo(point) + "^R1"; + message += Meta.BuildTransportInfo(point); } if (TileCode == "STRAWPILE") diff --git a/Horse Isle Server/Horse Isle Server/Game/Quest.cs b/Horse Isle Server/Horse Isle Server/Game/Quest.cs index 07c942f..993b731 100644 --- a/Horse Isle Server/Horse Isle Server/Game/Quest.cs +++ b/Horse Isle Server/Horse Isle Server/Game/Quest.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using HISP.Player; using HISP.Server; @@ -70,6 +71,21 @@ namespace HISP.Game } return totalQp; } + + + public static int GetTotalQuestsComplete(User user) + { + QuestEntry[] questList = GetPublicQuestList(); + int totalComplete = 0; + foreach (QuestEntry quest in questList) + { + if (user.Quests.GetTrackedQuestAmount(quest.Id) > 0) + totalComplete++; + } + return totalComplete; + } + + public static QuestEntry[] GetPublicQuestList() { QuestEntry[] quests = QuestList.OrderBy(o => o.Title).ToArray(); @@ -104,6 +120,11 @@ namespace HISP.Game } + // Check if user has award unlocked + if(quest.AwardRequired != 0) + if (!user.Awards.HasAward(Award.GetAwardById(quest.AwardRequired))) + return false; + // Check if i have required items foreach (QuestItemInfo itemInfo in quest.ItemsRequired) { @@ -180,6 +201,26 @@ namespace HISP.Game byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); user.LoggedinClient.SendPacket(ChatPacket); } + + + // Check if award unlocked + int questPointsPercent = Convert.ToInt32(Math.Floor(((decimal)user.QuestPoints / (decimal)GetTotalQuestPoints()) * (decimal)100.0)); + if (questPointsPercent >= 25) + user.Awards.AddAward(Award.GetAwardById(1)); // 25% Quest Completion Award. + if (questPointsPercent >= 50) + user.Awards.AddAward(Award.GetAwardById(2)); // 50% Quest Completion Award. + if (questPointsPercent >= 75) + user.Awards.AddAward(Award.GetAwardById(3)); // 75% Quest Completion Award. + if (questPointsPercent >= 100) + user.Awards.AddAward(Award.GetAwardById(4)); // 100% Quest Completion Award. + + // Is cloud isles quest? + if(quest.Id == 1373) + { + byte[] swfLoadPacket = PacketBuilder.CreateSwfModulePacket("ballooncutscene", PacketBuilder.PACKET_SWF_CUTSCENE); + user.LoggedinClient.SendPacket(swfLoadPacket); + } + return true; } else { @@ -193,6 +234,7 @@ namespace HISP.Game } return false; }; + } public static bool DoesQuestExist(int id) { diff --git a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj index 4e97b61..665b7ad 100644 --- a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj +++ b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj @@ -81,6 +81,7 @@ + diff --git a/Horse Isle Server/Horse Isle Server/Player/Award.cs b/Horse Isle Server/Horse Isle Server/Player/Award.cs new file mode 100644 index 0000000..2d724b7 --- /dev/null +++ b/Horse Isle Server/Horse Isle Server/Player/Award.cs @@ -0,0 +1,97 @@ +using HISP.Server; +using System; +using System.Collections.Generic; + +namespace HISP.Player +{ + class Award + { + public struct AwardEntry + { + public int Id; + public int Sort; + public string Title; + public int IconId; + public int MoneyBonus; + public string CompletionText; + public string Description; + } + + public static AwardEntry[] GlobalAwardList; + + public static AwardEntry GetAwardById(int id) + { + try + { + AwardEntry award = GlobalAwardList[id - 1]; + if (award.Id == id) + return award; + } + catch (Exception) { }; + + foreach(AwardEntry award in GlobalAwardList) + { + if (award.Id == id) + return award; + } + + throw new KeyNotFoundException("Award ID " + id + " Does not exist."); + } + + + private List awardsEarned; + private User baseUser; + public AwardEntry[] AwardsEarned + { + get + { + return awardsEarned.ToArray(); + } + } + + public bool HasAward(AwardEntry award) + { + foreach(AwardEntry awardEntry in AwardsEarned) + { + if (awardEntry.Id == award.Id) + return true; + } + return false; + } + + public void AddAward(AwardEntry award,bool addToDatabase=true) + { + if (HasAward(award)) + return; + + if (addToDatabase) + { + Database.AddAward(baseUser.Id, award.Id); + + baseUser.Money += award.MoneyBonus; + + byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT); + baseUser.LoggedinClient.SendPacket(chatPacket); + } + + + awardsEarned.Add(award); + } + + public Award(User user) + { + baseUser = user; + int[] awards = Database.GetAwards(user.Id); + awardsEarned = new List(); + + foreach (int awardid in awards) + { + AddAward(GetAwardById(awardid), false); + } + + } + + + + } +} diff --git a/Horse Isle Server/Horse Isle Server/Player/User.cs b/Horse Isle Server/Horse Isle Server/Player/User.cs index 0c0fce8..240f36d 100644 --- a/Horse Isle Server/Horse Isle Server/Player/User.cs +++ b/Horse Isle Server/Horse Isle Server/Player/User.cs @@ -40,6 +40,7 @@ namespace HISP.Player public Shop LastShoppedAt; public PlayerQuests Quests; public Highscore Highscores; + public Award Awards; public int FreeMinutes { get @@ -374,7 +375,7 @@ namespace HISP.Player Gender = Database.GetGender(UserId); MailBox = new Mailbox(this); Highscores = new Highscore(this); - + Awards = new Award(this); // Generate SecCodes diff --git a/Horse Isle Server/Horse Isle Server/Server/Database.cs b/Horse Isle Server/Horse Isle Server/Server/Database.cs index 9e24ece..0477ed9 100644 --- a/Horse Isle Server/Horse Isle Server/Server/Database.cs +++ b/Horse Isle Server/Horse Isle Server/Server/Database.cs @@ -27,6 +27,7 @@ namespace HISP.Server string TrackedQuest = "CREATE TABLE TrackedQuest(playerId INT, questId INT, timesCompleted INT)"; string OnlineUsers = "CREATE TABLE OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3), Subscribed TEXT(3))"; string CompetitionGear = "CREATE TABLE CompetitionGear(playerId INT, headItem INT, bodyItem INT, legItem INT, feetItem INT)"; + string Awards = "CREATE TABLE Awards(playerId INT, awardId INT)"; string Jewelry = "CREATE TABLE Jewelry(playerId INT, slot1 INT, slot2 INT, slot3 INT, slot4 INT)"; string Leaderboards = "CREATE TABLE Leaderboards(playerId INT, minigame TEXT(128), wins INT, looses INT, timesplayed INT, score INT, type TEXT(128))"; string DeleteOnlineUsers = "DELETE FROM OnlineUsers"; @@ -97,6 +98,19 @@ namespace HISP.Server Logger.WarnPrint(e.Message); }; + try + { + + MySqlCommand sqlCommand = db.CreateCommand(); + sqlCommand.CommandText = Awards; + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + } + catch (Exception e) + { + Logger.WarnPrint(e.Message); + }; + try { @@ -506,6 +520,48 @@ namespace HISP.Server return timesComplete; } } + + + + public static int[] GetAwards(int playerId) + { + List awards = new List(); + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "SELECT awardId FROM Awards WHERE playerId=@playerId"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + + sqlCommand.Prepare(); + MySqlDataReader reader = sqlCommand.ExecuteReader(); + while(reader.Read()) + { + awards.Add(reader.GetInt32(0)); + } + sqlCommand.Dispose(); + return awards.ToArray(); + } + } + public static void AddAward(int playerId, int awardId) + { + using (MySqlConnection db = new MySqlConnection(ConnectionString)) + { + db.Open(); + MySqlCommand sqlCommand = db.CreateCommand(); + + sqlCommand.CommandText = "INSERT INTO Awards VALUES(@playerId,@awardId)"; + sqlCommand.Parameters.AddWithValue("@playerId", playerId); + sqlCommand.Parameters.AddWithValue("@awardId", awardId); + + sqlCommand.Prepare(); + sqlCommand.ExecuteNonQuery(); + sqlCommand.Dispose(); + return; + } + } + public static bool HasCompetitionGear(int playerId) { diff --git a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs index 1bcd70e..80276e9 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs @@ -3,6 +3,7 @@ using System.IO; using Newtonsoft.Json; using HISP.Game; using HISP.Game.Chat; +using HISP.Player; namespace HISP.Server { @@ -372,6 +373,27 @@ namespace HISP.Server Logger.DebugPrint("Registered Shop ID: "+ shop.Id + " Selling items at " + shop.SellPricePercentage + "% and buying at " + shop.BuyPricePercentage); } + // Register awards + + int totalAwards = gameData.award_list.Count; + Award.GlobalAwardList = new Award.AwardEntry[totalAwards]; + for (int i = 0; i < totalAwards; i++) + { + + Award.AwardEntry award = new Award.AwardEntry(); + award.Id = i+1; + award.Sort = gameData.award_list[i].sort_by; + award.Title = gameData.award_list[i].title; + award.IconId = gameData.award_list[i].icon_id; + award.MoneyBonus = gameData.award_list[i].earn_money; + award.CompletionText = gameData.award_list[i].on_complete_text; + award.Description = gameData.award_list[i].description; + + Award.GlobalAwardList[i] = award; + + Logger.DebugPrint("Registered Award ID: " + award.Id + " - " + award.Title); + } + Item.Present = gameData.item.special.present; Item.MailMessage = gameData.item.special.mail_message; Item.DorothyShoes = gameData.item.special.dorothy_shoes; @@ -562,6 +584,12 @@ namespace HISP.Server Messages.GameBestTimeHeaderFormat = gameData.messages.meta.highscores.game_besttime_header; Messages.GameBestTimeFormat = gameData.messages.meta.highscores.game_besttime_format; + // Awards + + Messages.AwardHeader = gameData.messages.meta.awards_page.awards_header; + Messages.NoAwards = gameData.messages.meta.awards_page.no_awards; + Messages.AwardFormat = gameData.messages.meta.awards_page.award_format; + // Sec Codes Messages.InvalidSecCodeError = gameData.messages.sec_code.invalid_sec_code; diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs index 6ae13a8..5fd2c9e 100644 --- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs +++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs @@ -161,6 +161,10 @@ namespace HISP.Server metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildMinigameRankingsForUser(sender.LoggedinUser)); sender.SendPacket(metaPacket); break; + case 24: + metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildAwardList(sender.LoggedinUser)); + sender.SendPacket(metaPacket); + break; default: Logger.ErrorPrint("Dynamic button #" + buttonId + " unknown..."); break; @@ -311,6 +315,45 @@ namespace HISP.Server UpdateArea(sender); UpdateUserInfo(sender.LoggedinUser); } + else if (method == PacketBuilder.SECCODE_AWARD) + { + byte[] ExpectedSecCode = sender.LoggedinUser.GenerateSecCode(); + byte[] GotSecCode = new byte[4]; + Array.ConstrainedCopy(packet, 2, GotSecCode, 0, GotSecCode.Length); + Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " ")); + if (ExpectedSecCode.SequenceEqual(GotSecCode)) + { + if (packet.Length < 6) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode AWARD request with invalid size"); + return; + } + + string packetStr = Encoding.UTF8.GetString(packet); + string awardIdStr = packetStr.Substring(6, packetStr.Length - 6 - 2); + + int value = -1; + try + { + value = int.Parse(awardIdStr); + } + catch (FormatException) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent correct sec code, but invalid awardid value"); + return; + } + + sender.LoggedinUser.Awards.AddAward(Award.GetAwardById(value)); + return; + } + else + { + byte[] errorMessage = PacketBuilder.CreateChat(Messages.InvalidSecCodeError, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(errorMessage); + Logger.HackerPrint(sender.LoggedinUser.Username + " Sent invalid sec code"); + return; + } + } else if (method == PacketBuilder.SECCODE_SCORE || method == PacketBuilder.SECCODE_TIME) { bool time = (method == PacketBuilder.SECCODE_TIME); @@ -329,10 +372,10 @@ namespace HISP.Server string packetStr = Encoding.UTF8.GetString(packet); string gameInfoStr = packetStr.Substring(6, packetStr.Length - 6 - 2); - if(gameInfoStr.Contains("|")) + if (gameInfoStr.Contains("|")) { string[] gameInfo = gameInfoStr.Split('|'); - if(gameInfo.Length < 2) + if (gameInfo.Length < 2) { Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a invalid seccode score request"); return; @@ -340,7 +383,7 @@ namespace HISP.Server string gameTitle = gameInfo[0]; string gameScoreStr = gameInfo[1]; - + int value = -1; try { @@ -378,7 +421,7 @@ namespace HISP.Server Logger.HackerPrint(sender.LoggedinUser.Username + " Sent invalid sec code"); return; } - } + } else if (method == PacketBuilder.SECCODE_MONEY) { @@ -533,7 +576,7 @@ namespace HISP.Server return; } } - else if(method == PacketBuilder.PLAYERINFO_HIGHSCORES_LIST) + else if (method == PacketBuilder.PLAYERINFO_HIGHSCORES_LIST) { string packetStr = Encoding.UTF8.GetString(packet); string gameName = packetStr.Substring(2, packetStr.Length - 4); diff --git a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs index 33d561a..4dc35e4 100644 --- a/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs +++ b/Horse Isle Server/Horse Isle Server/Server/PacketBuilder.cs @@ -46,7 +46,7 @@ namespace HISP.Server public const byte SECCODE_SCORE = 0x3D; public const byte SECCODE_TIME = 0x3E; public const byte SECCODE_MONEY = 0x1E; - + public const byte SECCODE_AWARD = 0x33; public const byte NPC_START_CHAT = 0x14; public const byte NPC_CONTINUE_CHAT = 0x15; @@ -550,9 +550,9 @@ namespace HISP.Server public static byte[] CreatePlayerData(int money, int playerCount, int mail) { - byte[] moneyStrBytes = Encoding.UTF8.GetBytes(money.ToString()); - byte[] playerStrBytes = Encoding.UTF8.GetBytes(playerCount.ToString()); - byte[] mailStrBytes = Encoding.UTF8.GetBytes(mail.ToString()); + byte[] moneyStrBytes = Encoding.UTF8.GetBytes(money.ToString("N0")); + byte[] playerStrBytes = Encoding.UTF8.GetBytes(playerCount.ToString("N0")); + byte[] mailStrBytes = Encoding.UTF8.GetBytes(mail.ToString("N0")); MemoryStream ms = new MemoryStream(); ms.WriteByte(PACKET_BASE_STATS); diff --git a/WebInterface/game-site/account.php b/WebInterface/game-site/account.php new file mode 100644 index 0000000..0fb79d7 --- /dev/null +++ b/WebInterface/game-site/account.php @@ -0,0 +1,388 @@ + +HORSE ISLE - Online Multiplayer Horse Game + + + + + + + + + + + + + + + + + + + + + +
Welcome to Horse Isle 
+ + + + +
PINTO.HORSEISLE.COM
Logged in as: SilicaAndPina





+ +
 
+
+ + + + + + +
When Ready, Enter the World



(bigger borders version)
(same window version)
Welcome back SilicaAndPina, Here is your account info and Horse Isle server status: (refresh)

It has been: 0.2 hours since you were last online. You have logged in 2 times.
You have $5,910 in Horse Isle money on hand and $0 in the bank.
You have earned 25 of 63005 total quest points (0% Complete)


+ + + +
+ + + + + + + + + + + +
+ +SILICAANDPINA'S PINTO SUBSCRIPTION STATUS:
ACTIVE
(31 days remain in your subscription) (Subscription Benefits) +
+ +
BUY 1 Month Membership $5.00usd (adds 31 days membership time to the account that you are currently logged in with.) Non-refundable. +
+ + + + + + + + + + + + + + + + +
+
+ +
+ +
BUY Full Year Membership $40.00usd (adds 366 days membership time to the account you are logged in with. saves $20.00 off monthly subscription) Non-refundable. +
+ + + + + + + + + + + + + + + + +
+
+ + + + +
+ + + + + +
BUY $100,000 Horse Isle Currency per $1.00usd
+Select:
+ (Gives your account Horse Isle currency for use in the game. You can earn Horse Isle money by playing the game. This is not required.) Non-refundable.
+ + + + + + + + + + + + + + + + +
+ +
+ +
+BUY Pawneer Order $8.00usd (allows you to order a custom breed/color/gender horse on server from Pawneer. This is not required, you can trade other players to get the breed you desire also.) Non-refundable. +
+ + + + + + + + + + + + + + + + +
+
+ +
+ +
+BUY 5 Pawneer Orders $30.00usd (save $10.00 - allows you to order 5 custom horses from Pawneer) Non-refundable. +
+ + + + + + + + + + + + + + + + +
+
+ + +
If you happen to have any: Redeem Horse Bucks
+
Alternative Payment Methods: Check/Cash via postal mail +

Gift Payments: Pay for a different player +

+ + + +
+ +

+ + + + +
+
+[ Rules ] +[ Terms and Conditions ] +[ Privacy Policy ]
+[ Expected Behavior ] +[ Contact Us ] +[ Credits ]
+Copyright © 2020 Horse Isle + + + + + diff --git a/WebInterface/game-site/coconutbounce.swf b/WebInterface/game-site/coconutbounce.swf new file mode 100644 index 0000000..220eb30 Binary files /dev/null and b/WebInterface/game-site/coconutbounce.swf differ diff --git a/WebInterface/game-site/index.php b/WebInterface/game-site/index.php new file mode 100644 index 0000000..5ba4217 --- /dev/null +++ b/WebInterface/game-site/index.php @@ -0,0 +1,138 @@ + +HORSE ISLE - Online Multiplayer Horse Game + + + + + + + + + + + + + + + + + + + + + +
Welcome to Horse Isle 
+ + + + + + + +
USER:
PASS:
(Forgot?)
+ +
 
+
+ +
+ +
+If you have an account on this server (PINTO.HORSEISLE.COM) please login in at upper right.
+ Otherwise click for Main Horse Isle 1 Site. +

+ + + + + + + +
+
+[ Rules ] +[ Terms and Conditions ] +[ Privacy Policy ]
+[ Expected Behavior ] +[ Contact Us ] +[ Credits ]
+Copyright © 2020 Horse Isle + + + + + diff --git a/WebInterface/game-site/web/but-forums.gif b/WebInterface/game-site/web/but-forums.gif new file mode 100644 index 0000000..9674a77 Binary files /dev/null and b/WebInterface/game-site/web/but-forums.gif differ diff --git a/WebInterface/game-site/web/but-helpcenter.gif b/WebInterface/game-site/web/but-helpcenter.gif new file mode 100644 index 0000000..63cf011 Binary files /dev/null and b/WebInterface/game-site/web/but-helpcenter.gif differ diff --git a/WebInterface/game-site/web/but-logout.gif b/WebInterface/game-site/web/but-logout.gif new file mode 100644 index 0000000..bf313ff Binary files /dev/null and b/WebInterface/game-site/web/but-logout.gif differ diff --git a/WebInterface/game-site/web/but-mainpage.gif b/WebInterface/game-site/web/but-mainpage.gif new file mode 100644 index 0000000..49deb65 Binary files /dev/null and b/WebInterface/game-site/web/but-mainpage.gif differ diff --git a/WebInterface/game-site/web/but-news.gif b/WebInterface/game-site/web/but-news.gif new file mode 100644 index 0000000..e16e9bd Binary files /dev/null and b/WebInterface/game-site/web/but-news.gif differ diff --git a/WebInterface/game-site/web/but-serverlist.gif b/WebInterface/game-site/web/but-serverlist.gif new file mode 100644 index 0000000..c4b83d5 Binary files /dev/null and b/WebInterface/game-site/web/but-serverlist.gif differ diff --git a/WebInterface/game-site/web/hoilgui1.gif b/WebInterface/game-site/web/hoilgui1.gif new file mode 100644 index 0000000..8aba810 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui1.gif differ diff --git a/WebInterface/game-site/web/hoilgui10.gif b/WebInterface/game-site/web/hoilgui10.gif new file mode 100644 index 0000000..599085a Binary files /dev/null and b/WebInterface/game-site/web/hoilgui10.gif differ diff --git a/WebInterface/game-site/web/hoilgui11.gif b/WebInterface/game-site/web/hoilgui11.gif new file mode 100644 index 0000000..2b7cd48 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui11.gif differ diff --git a/WebInterface/game-site/web/hoilgui12.gif b/WebInterface/game-site/web/hoilgui12.gif new file mode 100644 index 0000000..bc04a46 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui12.gif differ diff --git a/WebInterface/game-site/web/hoilgui2.gif b/WebInterface/game-site/web/hoilgui2.gif new file mode 100644 index 0000000..97a7f39 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui2.gif differ diff --git a/WebInterface/game-site/web/hoilgui3.gif b/WebInterface/game-site/web/hoilgui3.gif new file mode 100644 index 0000000..91684c9 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui3.gif differ diff --git a/WebInterface/game-site/web/hoilgui4.gif b/WebInterface/game-site/web/hoilgui4.gif new file mode 100644 index 0000000..9f55f47 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui4.gif differ diff --git a/WebInterface/game-site/web/hoilgui5.gif b/WebInterface/game-site/web/hoilgui5.gif new file mode 100644 index 0000000..401c907 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui5.gif differ diff --git a/WebInterface/game-site/web/hoilgui6.gif b/WebInterface/game-site/web/hoilgui6.gif new file mode 100644 index 0000000..40ddbd2 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui6.gif differ diff --git a/WebInterface/game-site/web/hoilgui7.gif b/WebInterface/game-site/web/hoilgui7.gif new file mode 100644 index 0000000..8766ab8 Binary files /dev/null and b/WebInterface/game-site/web/hoilgui7.gif differ diff --git a/WebInterface/game-site/web/paypalpayment.phpQamt=5.00&cc=USD&cm=588125&item_name=One%20Month%20Horse%20Isle%20Membership-on%20pinto.horseisle.com&item_number=588125&st=Completed&tx=6PY64521GH722681D b/WebInterface/game-site/web/paypalpayment.phpQamt=5.00&cc=USD&cm=588125&item_name=One%20Month%20Horse%20Isle%20Membership-on%20pinto.horseisle.com&item_number=588125&st=Completed&tx=6PY64521GH722681D new file mode 100644 index 0000000..bea27f0 --- /dev/null +++ b/WebInterface/game-site/web/paypalpayment.phpQamt=5.00&cc=USD&cm=588125&item_name=One%20Month%20Horse%20Isle%20Membership-on%20pinto.horseisle.com&item_number=588125&st=Completed&tx=6PY64521GH722681D @@ -0,0 +1,141 @@ + +HORSE ISLE - Online Multiplayer Horse Game + + + + + + + + + + + + + + + + + + + + + +
Welcome to Horse Isle 
+ + + + +
PINTO.HORSEISLE.COM
Logged in as: SilicaAndPina





+ +
 
+
+
+
+ +Thank you for your Horse Isle PayPal Payment!
+
+Your transaction has been completed, and a receipt for your purchase has been emailed to you from PayPal.
+You may log into your account at http://www.paypal.com/us to view details of this transaction.
+
+If you bought a membership or game money, it will be credited to your account usually within one minute. +Click back to your ACCOUNT page to see any credited subscription time or game money. (click refresh on the page if it has not yet showed)
+(NOTE: If you paid via paypal e-check it takes paypal 3-4 days to clear the check and notify us.)
+
+PARENTS: please email support@horseisle.com from the paypal email or signup email to +block chat, or limit time online for this account if you want to.
+
+ + + + + +
+
+[ Rules ] +[ Terms and Conditions ] +[ Privacy Policy ]
+[ Expected Behavior ] +[ Contact Us ] +[ Credits ]
+Copyright © 2020 Horse Isle + + + + + diff --git a/WebInterface/game-site/web/playersonline.phpQid=588112 b/WebInterface/game-site/web/playersonline.phpQid=588112 new file mode 100644 index 0000000..a0c88c7 --- /dev/null +++ b/WebInterface/game-site/web/playersonline.phpQid=588112 @@ -0,0 +1 @@ +11 players
online now:

Akasha
EquusKay
Gho
Indus
Invalid
LilacDiamonds
Lozzy
OrientExpress
Passion
Rhysand
Riesl
(0 buddies)
This list refreshes every 30 seconds. \ No newline at end of file diff --git a/WebInterface/game-site/web/screenshots/enterhorseisle.png b/WebInterface/game-site/web/screenshots/enterhorseisle.png new file mode 100644 index 0000000..f3e257d Binary files /dev/null and b/WebInterface/game-site/web/screenshots/enterhorseisle.png differ