diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 6a56e51..b6ebf7a 100755 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -300,7 +300,7 @@ "money_offer_submenu":"How much money do you want to OFFER player?^PMAmount of money to offer:|%CURRENTMONEYOFFER%^PS3|Add to offer^R1", "object_offer_submenu":"^PMQuantity of item (%QUANTITY% max):|1^R1^PS3|Add to offer^R1", - + "trade_ridden_horse":"You had to stop riding your horse since you are trading it!", "waiting_for_other_to_accept":"Waiting for other player to Accept or Reject trade...", @@ -827,6 +827,11 @@ "set_peice_format":"%ITEMNAME%: %ITEMDESC%
", } }, + "multihorses":{ + "other_players_here":"^LThe following other players are here:", + "select_a_horse":"^LSelect a horse to join with:^R1", + "horse_format":"^I252^T8#%NUMBER%: %HORSENAME% (%BREED%) ^BM%SWF%^R1" + }, "multiroom":{ "other_players_participating":"^LThe following other players are participating:", "partcipent_format":"^R1^T3%USERNAME%" diff --git a/Horse Isle Server/HorseIsleServer/Game/Messages.cs b/Horse Isle Server/HorseIsleServer/Game/Messages.cs index 733486c..ceff899 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Messages.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Messages.cs @@ -34,6 +34,11 @@ namespace HISP.Game public static string EventEndRealTimeRiddle; public static string EventWonRealTimeRiddleFormat; + // MultiHorses + public static string OtherPlayersHere; + public static string MultiHorseSelectOneToJoinWith; + public static string MultiHorseFormat; + // 2Player public static string TwoPlayerOtherPlayer; public static string TwoPlayerPlayerFormat; @@ -118,6 +123,8 @@ namespace HISP.Game public static string TradeYouSpentMoneyMessageFormat; public static string TradeYouReceivedMoneyMessageFormat; + public static string TradeRiddenHorse; + public static string TradeYouCantCarryMoreItems; public static string TradeOtherCantCarryMoreItems; @@ -1057,6 +1064,14 @@ namespace HISP.Game // Click public static string NothingInterestingHere; + + // MULTIHORSES + public static string FormatMultiHorses(int placing, string horseName, string horseBreed, string swf) + { + return MultiHorseFormat.Replace("%NUMBER%", placing.ToString()).Replace("%HORSENAME%", horseName).Replace("%BREED%", horseBreed).Replace("%SWF%", swf); + } + + // 2PLAYER public static string Format2PlayerRecordLose(string gameTitle) { return TwoPlayerRecordedLossFormat.Replace("%GAMETITLE%", gameTitle); diff --git a/Horse Isle Server/HorseIsleServer/Game/Meta.cs b/Horse Isle Server/HorseIsleServer/Game/Meta.cs index 445b70b..7617d19 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Meta.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Meta.cs @@ -1551,6 +1551,45 @@ namespace HISP.Game message += Messages.MetaTerminator; return message; } + private static string buildMultiHorses(User user, string swf) + { + string message = Messages.OtherPlayersHere; + Multiroom room = Multiroom.GetMultiroom(user.X, user.Y); + room.Join(user); + + foreach (User userOnTile in room.JoinedUsers) + { + if (userOnTile.Id == user.Id) + continue; + + message += Messages.FormatMultiroomParticipent(userOnTile.Username); + } + + message += Messages.R1; + + message += Messages.MultiHorseSelectOneToJoinWith; + int placing = 1; + foreach (HorseInstance horse in user.HorseInventory.HorseList.OrderBy(o => o.Name).ToArray()) + { + if (horse.Leaser > 0) + continue; + + HorseInfo.StatCalculator speedStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.SPEED, user); + HorseInfo.StatCalculator strengthStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.STRENGTH, user); + HorseInfo.StatCalculator conformationStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.CONFORMATION, user); + HorseInfo.StatCalculator agilityStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.AGILITY, user); + HorseInfo.StatCalculator enduranceStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.ENDURANCE, user); + HorseInfo.StatCalculator inteligenceStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.INTELIGENCE, user); + HorseInfo.StatCalculator personalityStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.PERSONALITY, user); + + message += Messages.FormatMultiHorses(placing, horse.Name, horse.Breed.Name, swf + ".swf?ID=" + horse.RandomId + "&PL=" + user.Username + "&SP=" + speedStat.Total + "&ST=" + strengthStat.Total + "&CO=" + conformationStat.Total + "&AG=" + agilityStat.Total + "&EN=" + enduranceStat.Total + "&IN=" + inteligenceStat.Total + "&PE=" + personalityStat.Total + "&"); + } + + message += Messages.ExitThisPlace; + message += Messages.MetaTerminator; + return message; + + } private static string buildHorseGame(User user, string swf) { string message = Messages.HorseGamesSelectHorse; @@ -1560,7 +1599,17 @@ namespace HISP.Game if (horse.Leaser > 0) continue; - message += Messages.FormatHorseGamesEntry(placing, horse.Name, swf + ".swf?ID=" + horse.RandomId + "&SP=" + horse.AdvancedStats.Speed + "&ST=" + horse.AdvancedStats.Strength + "&CO=" + horse.AdvancedStats.Conformation + "&AG=" + horse.AdvancedStats.Agility + "&EN=" + horse.AdvancedStats.Endurance + "&IN=" + horse.AdvancedStats.Inteligence + "&PE=" + horse.AdvancedStats.Personality + "&"); + + HorseInfo.StatCalculator speedStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.SPEED, user); + HorseInfo.StatCalculator strengthStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.STRENGTH, user); + HorseInfo.StatCalculator conformationStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.CONFORMATION, user); + HorseInfo.StatCalculator agilityStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.AGILITY, user); + HorseInfo.StatCalculator enduranceStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.ENDURANCE, user); + HorseInfo.StatCalculator inteligenceStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.INTELIGENCE, user); + HorseInfo.StatCalculator personalityStat = new HorseInfo.StatCalculator(horse, HorseInfo.StatType.PERSONALITY, user); + + + message += Messages.FormatHorseGamesEntry(placing, horse.Name, swf + ".swf?ID=" + horse.RandomId + "&SP=" + speedStat.Total + "&ST=" + strengthStat.Total + "&CO=" + conformationStat.Total + "&AG=" + agilityStat.Total + "&EN=" + enduranceStat.Total + "&IN=" + inteligenceStat.Total + "&PE=" + personalityStat.Total + "&"); } message += Messages.ExitThisPlace; message += Messages.MetaTerminator; @@ -2917,6 +2966,10 @@ namespace HISP.Game { message += buildLibary(); } + if(TileCode == "MULTIHORSES") + { + message += buildMultiHorses(user, TileArg); + } if (TileCode == "POND") { message += buildPond(user); diff --git a/Horse Isle Server/HorseIsleServer/Game/Multiroom.cs b/Horse Isle Server/HorseIsleServer/Game/Multiroom.cs index 9d3b380..fadbad1 100644 --- a/Horse Isle Server/HorseIsleServer/Game/Multiroom.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Multiroom.cs @@ -15,7 +15,6 @@ namespace HISP.Game throw new KeyNotFoundException(); } - public static bool IsMultiRoomAt(int x, int y) { foreach (Multiroom multiroom in Multirooms) @@ -38,7 +37,7 @@ namespace HISP.Game { if (tile.Code != null) { - if (tile.Code.StartsWith("MULTIROOM") || tile.Code.StartsWith("2PLAYER") || tile.Code.StartsWith("AUCTION")) + if (tile.Code.StartsWith("MULTIROOM") || tile.Code.StartsWith("MULTIHORSES") || tile.Code.StartsWith("2PLAYER") || tile.Code.StartsWith("AUCTION")) { Logger.DebugPrint("Created Multiroom @ " + tile.X.ToString() + "," + tile.Y.ToString()); new Multiroom(tile.X, tile.Y); diff --git a/Horse Isle Server/HorseIsleServer/Player/Trade.cs b/Horse Isle Server/HorseIsleServer/Player/Trade.cs index c86231b..1abbea1 100644 --- a/Horse Isle Server/HorseIsleServer/Player/Trade.cs +++ b/Horse Isle Server/HorseIsleServer/Player/Trade.cs @@ -155,6 +155,19 @@ namespace HISP.Player foreach (HorseInstance inst in HorsesOffered) // Transfer Horses { inst.Owner = OtherTrade.Trader.Id; + + // Dismount horse if its traded + if (Trader.CurrentlyRidingHorse != null) + { + if (Trader.CurrentlyRidingHorse.RandomId == inst.RandomId) + { + byte[] disMounted = PacketBuilder.CreateChat(Messages.TradeRiddenHorse, PacketBuilder.CHAT_BOTTOM_RIGHT); + Trader.Facing %= 5; + Trader.CurrentlyRidingHorse = null; + Trader.LoggedinClient.SendPacket(disMounted); + } + } + Trader.HorseInventory.DeleteHorse(inst, false); OtherTrade.Trader.HorseInventory.AddHorse(inst, false); } diff --git a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs index de552bb..9541327 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameDataJson.cs @@ -874,6 +874,11 @@ namespace HISP.Server Messages.EventEndRealTimeRiddle = gameData.messages.events.real_time_riddle.event_end; Messages.EventWonRealTimeRiddleFormat = gameData.messages.events.real_time_riddle.event_won; + // MultiHorses + Messages.OtherPlayersHere = gameData.messages.meta.multihorses.other_players_here; + Messages.MultiHorseSelectOneToJoinWith = gameData.messages.meta.multihorses.select_a_horse; + Messages.MultiHorseFormat = gameData.messages.meta.multihorses.horse_format; + // 2Player Messages.TwoPlayerOtherPlayer = gameData.messages.meta.two_player.other_player; Messages.TwoPlayerPlayerFormat = gameData.messages.meta.two_player.player_name; @@ -953,6 +958,8 @@ namespace HISP.Server Messages.TradeCanceledBecuasePlayerMovedMessage = gameData.messages.meta.player_interaction.trade.trade_canceled_moved; Messages.TradeCanceledInterupted = gameData.messages.meta.player_interaction.trade.trade_interupted; + Messages.TradeRiddenHorse = gameData.messages.meta.player_interaction.trade.trade_ridden_horse; + Messages.TradeYouCantHandleMoreHorses = gameData.messages.meta.player_interaction.trade.cant_handle_more_horses; Messages.TradeOtherPlayerCantHandleMoreHorsesFormat = gameData.messages.meta.player_interaction.trade.other_player_cant_handle_more_horses;