From 92643bf4e28044ddc170f62d24092bfd0a1530b4 Mon Sep 17 00:00:00 2001 From: Bluzume <39113159+KuromeSan@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:44:18 -0500 Subject: [PATCH] Fix Opening Present with ItemId 0 --- HorseIsleData | 2 +- HorseIsleServer/HorseIsleServer/Game/Chat/Command.cs | 2 +- HorseIsleServer/HorseIsleServer/Game/Messages.cs | 2 +- HorseIsleServer/HorseIsleServer/Server/GameDataJson.cs | 2 +- HorseIsleServer/HorseIsleServer/Server/GameServer.cs | 8 +++++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/HorseIsleData b/HorseIsleData index 85caa27..35bf0e0 160000 --- a/HorseIsleData +++ b/HorseIsleData @@ -1 +1 @@ -Subproject commit 85caa27ee931439d76003b5471a9dac906b491ba +Subproject commit 35bf0e04a686990d7237326c048fd18b3a081aa5 diff --git a/HorseIsleServer/HorseIsleServer/Game/Chat/Command.cs b/HorseIsleServer/HorseIsleServer/Game/Chat/Command.cs index 293f01b..55a2f61 100644 --- a/HorseIsleServer/HorseIsleServer/Game/Chat/Command.cs +++ b/HorseIsleServer/HorseIsleServer/Game/Chat/Command.cs @@ -82,7 +82,7 @@ namespace HISP.Game.Chat } else { - itemId = Item.GetRandomItem(false).Id; + itemId = Item.GetRandomItem().Id; } Item.GetItemById(itemId); // Calling this makes sure this item id exists. diff --git a/HorseIsleServer/HorseIsleServer/Game/Messages.cs b/HorseIsleServer/HorseIsleServer/Game/Messages.cs index 1f70f78..54dd46f 100644 --- a/HorseIsleServer/HorseIsleServer/Game/Messages.cs +++ b/HorseIsleServer/HorseIsleServer/Game/Messages.cs @@ -478,7 +478,7 @@ namespace HISP.Game public static string SantaWrapItemFormat; public static string SantaWrappedObjectMessage; public static string SantaCantWrapInvFull; - + public static string SantaCantOpenNothingInside; public static string SantaItemOpenedFormat; public static string SantaItemCantOpenInvFull; diff --git a/HorseIsleServer/HorseIsleServer/Server/GameDataJson.cs b/HorseIsleServer/HorseIsleServer/Server/GameDataJson.cs index e930597..261515a 100644 --- a/HorseIsleServer/HorseIsleServer/Server/GameDataJson.cs +++ b/HorseIsleServer/HorseIsleServer/Server/GameDataJson.cs @@ -1558,7 +1558,7 @@ namespace HISP.Server Messages.SantaWrapItemFormat = gameData.messages.meta.santa.wrap_format; Messages.SantaWrappedObjectMessage = gameData.messages.meta.santa.wrapped_object; Messages.SantaCantWrapInvFull = gameData.messages.meta.santa.wrap_fail_inv_full; - + Messages.SantaCantOpenNothingInside = gameData.messages.meta.santa.open_fail_empty; Messages.SantaItemOpenedFormat = gameData.messages.meta.santa.open_format; Messages.SantaItemCantOpenInvFull = gameData.messages.meta.santa.open_fail_inv_full; diff --git a/HorseIsleServer/HorseIsleServer/Server/GameServer.cs b/HorseIsleServer/HorseIsleServer/Server/GameServer.cs index 0f09a08..2c0431a 100644 --- a/HorseIsleServer/HorseIsleServer/Server/GameServer.cs +++ b/HorseIsleServer/HorseIsleServer/Server/GameServer.cs @@ -6455,8 +6455,14 @@ namespace HISP.Server int newItem = item.ItemInstances[0].Data; if(newItem == 0) { - // TODO: Get "Present is empty" message. sender.LoggedinUser.Inventory.Remove(item.ItemInstances[0]); + + byte[] itemOpenFailedNothingInside = PacketBuilder.CreateChat(Messages.SantaCantOpenNothingInside, PacketBuilder.CHAT_BOTTOM_RIGHT); + sender.SendPacket(itemOpenFailedNothingInside); + + UpdateInventory(sender); + + break; } try {