From 524c7f22149b50f3fcf5a5983698ffbb39ab547f Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Thu, 4 Mar 2021 00:34:30 +1300 Subject: [PATCH] Add profiles --- DataCollection/gamedata.json | 49 +++++- .../HorseIsleServer/Game/Messages.cs | 82 +++++++-- .../HorseIsleServer/Game/Meta.cs | 166 ++++++++++++++---- .../HorseIsleServer/Game/Quest.cs | 3 +- .../HorseIsleServer/Server/GameDataJson.cs | 28 +++ .../HorseIsleServer/Server/GameServer.cs | 29 ++- .../HorseIsleServer/Server/PacketBuilder.cs | 1 + 7 files changed, 295 insertions(+), 63 deletions(-) diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 43d8d56..7b0512f 100755 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -920,7 +920,7 @@ }, "stats_page":{ "stats_bar_format":"^ATPlayer %USERNAME%'s Details^H", - "stats_area_format":"Currently %AREA%", + "stats_area_format":"Currently%AREA%", "stats_money_format":"
Money: $%MONEY%", "stats_freetime_format":"
Today's Free Time Remaining: %FREEMINUTES% minutes.", "stats_description_format":"
Description: %PLAYERDESC%", @@ -939,16 +939,26 @@ "stats_awards":"^T5Your Horse Isle Awards:^D24|VIEW AWARDS^R1", "stats_misc":"^T5Your Horse Isle Misc Tracked Stats:^D53|VIEW STATS^R1", "competition_gear":{ - "head_format":"^R1^I%ICON%^T7%ITEM% on your head.^B4X1", - "body_format":"^R1^I%ICON%^T7%ITEM% on your body.^B4X2", - "legs_format":"^R1^I%ICON%^T7%ITEM% on your legs.^B4X3", - "feet_format":"^R1^I%ICON%^T7%ITEM% on your feet.^B4X4" + "head_format":"^R1^I%ICON%^T7%ITEM% on %PRONOUN% head.", + "body_format":"^R1^I%ICON%^T7%ITEM% on %PRONOUN% body.", + "legs_format":"^R1^I%ICON%^T7%ITEM% on %PRONOUN% legs.", + "feet_format":"^R1^I%ICON%^T7%ITEM% on %PRONOUN% feet.", + + "remove_head":"^B4X1", + "remove_body":"^B4X2", + "remove_legs":"^B4X3", + "remove_feet":"^B4X4", }, "jewelry":{ - "slot_1":"^I%ICON%^T7%ITEM%^B4X5^R1", - "slot_2":"^I%ICON%^T7%ITEM%^B4X6^R1", - "slot_3":"^I%ICON%^T7%ITEM%^B4X7^R1", - "slot_4":"^I%ICON%^T7%ITEM%^B4X8^R1" + "slot_1":"^I%ICON%^T7%ITEM%%BUTTON%^R1", + "slot_2":"^I%ICON%^T7%ITEM%%BUTTON%^R1", + "slot_3":"^I%ICON%^T7%ITEM%%BUTTON%^R1", + "slot_4":"^I%ICON%^T7%ITEM%%BUTTON%^R1", + + "remove_slot_1":"^B4X5", + "remove_slot_2":"^B4X6", + "remove_slot_3":"^B4X7", + "remove_slot_4":"^B4X8" }, "hunger_stat_name":"hungry", "thirst_stat_name":"thirsty", @@ -960,9 +970,30 @@ ], "msg":{ "no_jewelry_equipped":"You have no Jewelry on.", + "no_jewelry_other":"%PRONOUN% has no Jewelry on.", + "no_competition_gear":"^LYou have nothing interesting for special competition gear.", + "no_competition_gear_other":"^L%PRONOUN% has nothing interesting for special competition gear.", + "competition_gear_selected":"^LYou have the following selected for competition gear:", + "competition_gear_other_selected":"^L%PRONOUN% has the following selected for competition gear:", + "jewelry_selected":"You have the following lovely jewelry on:", + "jewelry_other":"%PRONOUN% has no Jewelry on.", + + + "other_horses":"^R1^LHere are %PRONOUN% horses:^R1" + }, + "pronouns":{ + + "female_she":"She", + "female_her":"her", + + "male_he":"He", + "male_his":"his", + + + "you_your":"your" } }, diff --git a/Horse Isle Server/HorseIsleServer/Game/Messages.cs b/Horse Isle Server/HorseIsleServer/Game/Messages.cs index 52a0344..2b2f580 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Messages.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Messages.cs @@ -339,6 +339,15 @@ namespace HISP.Game public static string RakeNothing; public static string ShovelNothing; + // Pronouns + public static string PronounMaleHe; + public static string PronounMaleHis; + + public static string PronounFemaleShe; + public static string PronounFemaleHer; + + public static string PronounYouYour; + // Stats Page public static string StatsBarFormat; public static string StatsAreaFormat; @@ -359,11 +368,21 @@ namespace HISP.Game public static string JewelrySlot3Format; public static string JewelrySlot4Format; + public static string JewelryRemoveSlot1Button; + public static string JewelryRemoveSlot2Button; + public static string JewelryRemoveSlot3Button; + public static string JewelryRemoveSlot4Button; + public static string CompetitionGearHeadFormat; public static string CompetitionGearBodyFormat; public static string CompetitionGearLegsFormat; public static string CompetitionGearFeetFormat; + public static string CompetitionGearRemoveHeadButton; + public static string CompetitionGearRemoveBodyButton; + public static string CompetitionGearRemoveLegsButton; + public static string CompetitionGearRemoveFeetButton; + public static string StatsPrivateNotesButton; public static string StatsQuestsButton; public static string StatsMinigameRankingButton; @@ -371,14 +390,23 @@ namespace HISP.Game public static string StatsMiscButton; public static string NoJewerlyEquipped; + public static string NoJewerlyEquippedOther; + public static string NoCompetitionGear; + public static string NoCompetitionGearOther; + public static string JewelrySelected; + public static string JewelrySelectedOther; + public static string CompetitionGearSelected; + public static string CompetitionGearSelectedOther; public static string StatHunger; public static string StatThirst; public static string StatTired; + public static string StatsOtherHorses; + public static string[] StatPlayerFormats; // Misc Stats @@ -992,6 +1020,28 @@ namespace HISP.Game // Click public static string NothingInterestingHere; + + public static string FormatOtherNoCompetitionGear(string pronoun) + { + return NoCompetitionGearOther.Replace("%PRONOUN%", pronoun); + } + public static string FormatOtherCompetitionGear(string pronoun) + { + return CompetitionGearSelectedOther.Replace("%PRONOUN%", pronoun); + } + public static string FormatOtherJewelerySelected(string pronoun) + { + return JewelrySelectedOther.Replace("%PRONOUN%", pronoun); + } + public static string FormatOtherNoJewelery(string pronoun) + { + return NoJewerlyEquippedOther.Replace("%PRONOUN%", pronoun); + } + public static string FormatOtherHorsesMeta(string pronoun) + { + return StatsOtherHorses.Replace("%PRONOUN%", pronoun); + } + // Socials public static string FormatSocialButton(int socialId, string buttonName) { @@ -2095,38 +2145,38 @@ namespace HISP.Game { return statFormat.Replace("%STAT%", statName); } - public static string FormatJewelrySlot1(string itemName, int icon) + public static string FormatJewelrySlot1(string itemName, int icon, bool other) { - return JewelrySlot1Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return JewelrySlot1Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%BUTTON%", other ? "" : Messages.JewelryRemoveSlot1Button); } - public static string FormatJewelrySlot2(string itemName, int icon) + public static string FormatJewelrySlot2(string itemName, int icon, bool other) { - return JewelrySlot2Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return JewelrySlot2Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%BUTTON%", other ? "" : Messages.JewelryRemoveSlot2Button); } - public static string FormatJewelrySlot3(string itemName, int icon) + public static string FormatJewelrySlot3(string itemName, int icon, bool other) { - return JewelrySlot3Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return JewelrySlot3Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%BUTTON%", other ? "" : Messages.JewelryRemoveSlot3Button); } - public static string FormatJewelrySlot4(string itemName, int icon) + public static string FormatJewelrySlot4(string itemName, int icon, bool other) { - return JewelrySlot4Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return JewelrySlot4Format.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%BUTTON%", other ? "" : Messages.JewelryRemoveSlot4Button); } - public static string FormatCompetitionGearHead(string itemName, int icon) + public static string FormatCompetitionGearHead(string itemName, string pronoun, int icon, bool other) { - return CompetitionGearHeadFormat.Replace("%ITEM%", itemName).Replace("%ICON%",icon.ToString()); + return CompetitionGearHeadFormat.Replace("%ITEM%", itemName).Replace("%ICON%",icon.ToString()).Replace("%PRONOUN%", pronoun) + (other ? "" : Messages.CompetitionGearRemoveHeadButton); } - public static string FormatCompetitionGearBody(string itemName, int icon) + public static string FormatCompetitionGearBody(string itemName, string pronoun, int icon, bool other) { - return CompetitionGearBodyFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return CompetitionGearBodyFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%PRONOUN%", pronoun) + (other ? "" : Messages.CompetitionGearRemoveBodyButton); ; } - public static string FormatCompetitionGearLegs(string itemName, int icon) + public static string FormatCompetitionGearLegs(string itemName, string pronoun, int icon, bool other) { - return CompetitionGearLegsFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return CompetitionGearLegsFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%PRONOUN%", pronoun) + (other ? "" : Messages.CompetitionGearRemoveLegsButton); } - public static string FormatCompetitionGearFeet(string itemName, int icon) + public static string FormatCompetitionGearFeet(string itemName, string pronoun, int icon, bool other) { - return CompetitionGearFeetFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()); + return CompetitionGearFeetFormat.Replace("%ITEM%", itemName).Replace("%ICON%", icon.ToString()).Replace("%PRONOUN%", pronoun) + (other ? "" : Messages.CompetitionGearRemoveFeetButton ); } public static string FormatStatsBar(string username) { diff --git a/Horse Isle Server/HorseIsleServer/Game/Meta.cs b/Horse Isle Server/HorseIsleServer/Game/Meta.cs index ca1f888..cf1e76a 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Meta.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Meta.cs @@ -246,20 +246,59 @@ namespace HISP.Game return message; } - private static string buildWornJewelery(User user) + private static string buildWornJewelery(User user, bool other) { - string message = Messages.JewelrySelected; - if (user.EquipedJewelry.Slot1 != null) - message += Messages.FormatJewelrySlot1(user.EquipedJewelry.Slot1.Name, user.EquipedJewelry.Slot1.IconId); - if (user.EquipedJewelry.Slot2 != null) - message += Messages.FormatJewelrySlot2(user.EquipedJewelry.Slot2.Name, user.EquipedJewelry.Slot2.IconId); - if (user.EquipedJewelry.Slot3 != null) - message += Messages.FormatJewelrySlot3(user.EquipedJewelry.Slot3.Name, user.EquipedJewelry.Slot3.IconId); - if (user.EquipedJewelry.Slot4 != null) - message += Messages.FormatJewelrySlot4(user.EquipedJewelry.Slot4.Name, user.EquipedJewelry.Slot4.IconId); + string message = ""; + + // Insert LGBT Patch here + + string pronoun = ""; + if (other) + { + if (user.Gender == "FEMALE") + pronoun = Messages.PronounFemaleShe; + + if (user.Gender == "MALE") + pronoun = Messages.PronounMaleHe; + } + + if (!other) + message += Messages.JewelrySelected; + else + message += Messages.FormatOtherJewelerySelected(pronoun); + + bool hasMsg = false; + + if (user.EquipedJewelry.Slot1 != null) + { + message += Messages.FormatJewelrySlot1(user.EquipedJewelry.Slot1.Name, user.EquipedJewelry.Slot1.IconId, other); + hasMsg = true; + } + if (user.EquipedJewelry.Slot2 != null) + { + message += Messages.FormatJewelrySlot2(user.EquipedJewelry.Slot2.Name, user.EquipedJewelry.Slot2.IconId, other); + hasMsg = true; + } + if (user.EquipedJewelry.Slot3 != null) + { + message += Messages.FormatJewelrySlot3(user.EquipedJewelry.Slot3.Name, user.EquipedJewelry.Slot3.IconId, other); + hasMsg = true; + } + if (user.EquipedJewelry.Slot4 != null) + { + message += Messages.FormatJewelrySlot4(user.EquipedJewelry.Slot4.Name, user.EquipedJewelry.Slot4.IconId, other); + hasMsg = true; + } + + if (!hasMsg) + { + if (!other) + message = Messages.NoJewerlyEquipped; + else + message = Messages.FormatOtherNoJewelery(pronoun); + } + - if (message == Messages.JewelrySelected) - message = Messages.NoJewerlyEquipped; return message; } @@ -297,20 +336,57 @@ namespace HISP.Game message += Messages.MetaTerminator; return message; } - private static string buildEquippedCompetitionGear(User user) + private static string buildEquippedCompetitionGear(User user, bool other = false) { - string message = Messages.CompetitionGearSelected; - if (user.EquipedCompetitionGear.Head != null) - message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, user.EquipedCompetitionGear.Head.IconId); - if (user.EquipedCompetitionGear.Body != null) - message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, user.EquipedCompetitionGear.Body.IconId); - if (user.EquipedCompetitionGear.Legs != null) - message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, user.EquipedCompetitionGear.Legs.IconId); - if (user.EquipedCompetitionGear.Feet != null) - message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, user.EquipedCompetitionGear.Feet.IconId); + string message = ""; - if (message == Messages.CompetitionGearSelected) - message = Messages.NoCompetitionGear; + if (!other) + message = Messages.CompetitionGearSelected; + + // Insert LGBT Patch Here + + string pronoun = Messages.PronounYouYour; + if(other) + { + if (user.Gender == "FEMALE") + pronoun = Messages.PronounFemaleShe; + + if (user.Gender == "MALE") + pronoun = Messages.PronounMaleHe; + + message = Messages.FormatOtherCompetitionGear(pronoun); + } + + bool hasMsg = false; + + if (user.EquipedCompetitionGear.Head != null) + { + message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, pronoun, user.EquipedCompetitionGear.Head.IconId, other); + hasMsg = true; + } + if (user.EquipedCompetitionGear.Body != null) + { + message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, pronoun, user.EquipedCompetitionGear.Body.IconId, other); + hasMsg = true; + } + if (user.EquipedCompetitionGear.Legs != null) + { + message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, pronoun, user.EquipedCompetitionGear.Legs.IconId, other); + hasMsg = true; + } + if (user.EquipedCompetitionGear.Feet != null) + { + message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, pronoun, user.EquipedCompetitionGear.Feet.IconId, other); + hasMsg = true; + } + + if (!hasMsg) + { + if (!other) + message = Messages.NoCompetitionGear; + else + message = Messages.FormatOtherNoCompetitionGear(pronoun); + } return message; @@ -897,14 +973,15 @@ namespace HISP.Game message += Messages.MetaTerminator; return message; } - public static string BuildStatsMenu(User user) + public static string BuildStatsMenu(User user, bool other=false) { string message = Messages.FormatStatsBar(user.Username); string areaString = buildAreaString(user.X, user.Y); if (areaString != "") message += Messages.FormatStatsArea(areaString); - message += Messages.FormatMoneyStat(user.Money); + if(!other) + message += Messages.FormatMoneyStat(user.Money); if (!user.Subscribed) message += Messages.FormatFreeTime(user.FreeMinutes); message += Messages.FormatPlayerDescriptionForStatsMenu(user.ProfilePage); @@ -913,13 +990,36 @@ namespace HISP.Game message += Messages.FormatThirstStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Thirst), Messages.StatThirst)); message += Messages.FormatTiredStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Tiredness), Messages.StatTired)); message += Messages.FormatGenderStat(user.Gender); - message += Messages.FormatJewelryStat(buildWornJewelery(user)); - message += Messages.FormatCompetitionGearStat(buildEquippedCompetitionGear(user)); - message += Messages.StatsPrivateNotesButton; - message += Messages.StatsQuestsButton; - message += Messages.StatsMinigameRankingButton; - message += Messages.StatsAwardsButton; - message += Messages.StatsMiscButton; + message += Messages.FormatJewelryStat(buildWornJewelery(user, other)); + message += Messages.FormatCompetitionGearStat(buildEquippedCompetitionGear(user, other)); + + if(!other) + { + message += Messages.StatsPrivateNotesButton; + message += Messages.StatsQuestsButton; + message += Messages.StatsMinigameRankingButton; + message += Messages.StatsAwardsButton; + message += Messages.StatsMiscButton; + } + else + { + // Insert LGBT Patch here + + string pronoun = ""; + if (other) + { + if (user.Gender == "FEMALE") + pronoun = Messages.PronounFemaleHer; + + if (user.Gender == "MALE") + pronoun = Messages.PronounMaleHis; + } + + message += Messages.FormatOtherHorsesMeta(pronoun); + + message += buildHorseList(user, false); + } + message += Messages.BackToMap; message += Messages.MetaTerminator; diff --git a/Horse Isle Server/HorseIsleServer/Game/Quest.cs b/Horse Isle Server/HorseIsleServer/Game/Quest.cs index 62c0286..b21ab7b 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Quest.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Quest.cs @@ -330,11 +330,10 @@ namespace HISP.Game return quest; } } - throw new KeyNotFoundException("QuestId: " + id + " Dont exist."); + throw new KeyNotFoundException("Quest Id: " + id + " Dont exist."); } public static bool UseTool(User user, string tool, int x, int y) { - if (tool == Quest.Shovel) { // check Treasures diff --git a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs index 2405bd7..1cf5846 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs @@ -1152,6 +1152,15 @@ namespace HISP.Server Messages.LoginMessageFormat = gameData.messages.login_format; Messages.LogoutMessageFormat = gameData.messages.logout_format; + // Pronoun + Messages.PronounFemaleShe = gameData.messages.meta.stats_page.pronouns.female_she; + Messages.PronounFemaleHer = gameData.messages.meta.stats_page.pronouns.female_her; + + Messages.PronounMaleHe = gameData.messages.meta.stats_page.pronouns.male_he; + Messages.PronounMaleHis = gameData.messages.meta.stats_page.pronouns.male_his; + + Messages.PronounYouYour = gameData.messages.meta.stats_page.pronouns.you_your; + // Stats Messages.StatsBarFormat = gameData.messages.meta.stats_page.stats_bar_format; Messages.StatsAreaFormat = gameData.messages.meta.stats_page.stats_area_format; @@ -1172,11 +1181,21 @@ namespace HISP.Server Messages.JewelrySlot3Format = gameData.messages.meta.stats_page.jewelry.slot_3; Messages.JewelrySlot4Format = gameData.messages.meta.stats_page.jewelry.slot_4; + Messages.JewelryRemoveSlot1Button = gameData.messages.meta.stats_page.competition_gear.remove_slot_1; + Messages.JewelryRemoveSlot2Button = gameData.messages.meta.stats_page.competition_gear.remove_slot_2; + Messages.JewelryRemoveSlot3Button = gameData.messages.meta.stats_page.competition_gear.remove_slot_3; + Messages.JewelryRemoveSlot4Button = gameData.messages.meta.stats_page.competition_gear.remove_slot_4; + Messages.CompetitionGearHeadFormat = gameData.messages.meta.stats_page.competition_gear.head_format; Messages.CompetitionGearBodyFormat = gameData.messages.meta.stats_page.competition_gear.body_format; Messages.CompetitionGearLegsFormat = gameData.messages.meta.stats_page.competition_gear.legs_format; Messages.CompetitionGearFeetFormat = gameData.messages.meta.stats_page.competition_gear.feet_format; + Messages.CompetitionGearRemoveHeadButton = gameData.messages.meta.stats_page.competition_gear.remove_head; + Messages.CompetitionGearRemoveBodyButton = gameData.messages.meta.stats_page.competition_gear.remove_body; + Messages.CompetitionGearRemoveLegsButton = gameData.messages.meta.stats_page.competition_gear.remove_legs; + Messages.CompetitionGearRemoveFeetButton = gameData.messages.meta.stats_page.competition_gear.remove_feet; + Messages.StatsPrivateNotesButton = gameData.messages.meta.stats_page.stats_private_notes; Messages.StatsQuestsButton = gameData.messages.meta.stats_page.stats_quests; Messages.StatsMinigameRankingButton = gameData.messages.meta.stats_page.stats_minigame_ranking; @@ -1184,14 +1203,23 @@ namespace HISP.Server Messages.StatsMiscButton = gameData.messages.meta.stats_page.stats_misc; Messages.JewelrySelected = gameData.messages.meta.stats_page.msg.jewelry_selected; + Messages.JewelrySelectedOther = gameData.messages.meta.stats_page.msg.jewelry_other; + Messages.NoJewerlyEquipped = gameData.messages.meta.stats_page.msg.no_jewelry_equipped; + Messages.NoJewerlyEquippedOther = gameData.messages.meta.stats_page.msg.no_jewelry_other; + Messages.NoCompetitionGear = gameData.messages.meta.stats_page.msg.no_competition_gear; + Messages.NoCompetitionGearOther = gameData.messages.meta.stats_page.msg.no_competition_gear_other; + Messages.CompetitionGearSelected = gameData.messages.meta.stats_page.msg.competition_gear_selected; + Messages.CompetitionGearSelectedOther = gameData.messages.meta.stats_page.msg.competition_gear_other_selected; Messages.StatHunger = gameData.messages.meta.stats_page.hunger_stat_name; Messages.StatThirst = gameData.messages.meta.stats_page.thirst_stat_name; Messages.StatTired = gameData.messages.meta.stats_page.tired_stat_name; + Messages.StatsOtherHorses = gameData.messages.meta.stats_page.msg.other_horses; + Messages.StatPlayerFormats = gameData.messages.meta.stats_page.player_stats.ToObject(); // Misc Stats diff --git a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs index 0fbd4f4..99aa696 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs @@ -235,13 +235,36 @@ namespace HISP.Server if (sender.LoggedinUser.TradingWith != null) sender.LoggedinUser.TradingWith.AcceptTrade(); break; + case PacketBuilder.PLAYER_INTERACTION_PROFILE: + string packetStr = Encoding.UTF8.GetString(packet); + string playerIdStr = packetStr.Substring(2, packetStr.Length - 4); + int playerId = -1; + try + { + playerId = int.Parse(playerIdStr); + } + catch (FormatException) + { + Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to trade with User ID NaN."); + break; + } + + if(IsUserOnline(playerId)) + { + User user = GetUserById(playerId); + sender.LoggedinUser.MetaPriority = true; + + byte[] metaTag = PacketBuilder.CreateMetaPacket(Meta.BuildStatsMenu(user, true)); + sender.SendPacket(metaTag); + } + break; case PacketBuilder.PLAYER_INTERACTION_ADD_ITEM: if (sender.LoggedinUser.TradingWith == null) break; if (packet.Length < 5) break; - string packetStr = Encoding.UTF8.GetString(packet); + packetStr = Encoding.UTF8.GetString(packet); string idStr = packetStr.Substring(2, packetStr.Length - 4); char firstChar = idStr[0]; switch(firstChar) @@ -313,8 +336,8 @@ namespace HISP.Server break; case PacketBuilder.PLAYER_INTERACTION_TRADE: packetStr = Encoding.UTF8.GetString(packet); - string playerIdStr = packetStr.Substring(2, packetStr.Length - 4); - int playerId = -1; + playerIdStr = packetStr.Substring(2, packetStr.Length - 4); + playerId = -1; try { playerId = int.Parse(playerIdStr); diff --git a/Horse Isle Server/HorseIsleServer/Server/PacketBuilder.cs b/Horse Isle Server/HorseIsleServer/Server/PacketBuilder.cs index 05f222e..9caa2fb 100755 --- a/Horse Isle Server/HorseIsleServer/Server/PacketBuilder.cs +++ b/Horse Isle Server/HorseIsleServer/Server/PacketBuilder.cs @@ -56,6 +56,7 @@ namespace HISP.Server public const byte SOCIALS_MENU = 0x14; public const byte SOCIALS_USE = 0x15; + public const byte PLAYER_INTERACTION_PROFILE = 0x14; public const byte PLAYER_INTERACTION_TRADE = 0x28; public const byte PLAYER_INTERACTION_ADD_ITEM = 0x29; public const byte PLAYER_INTERACTION_ACCEPT = 0x2A;