Fix Opening Present with ItemId 0

This commit is contained in:
Bluzume 2021-11-27 00:44:18 -05:00
parent 65dbd60f8c
commit 92643bf4e2
5 changed files with 11 additions and 5 deletions

@ -1 +1 @@
Subproject commit 85caa27ee931439d76003b5471a9dac906b491ba
Subproject commit 35bf0e04a686990d7237326c048fd18b3a081aa5

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -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
{