mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
Fix Presents ..
This commit is contained in:
parent
89037e0255
commit
65dbd60f8c
3 changed files with 10 additions and 6 deletions
|
@ -90,7 +90,7 @@ namespace HISP.Game.Chat
|
|||
ItemInstance newItemInstance = new ItemInstance(itemId);
|
||||
|
||||
if (itemId == Item.Present)
|
||||
newItemInstance.Data = Item.GetRandomItem(false).Id;
|
||||
newItemInstance.Data = Item.GetRandomItem().Id;
|
||||
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ namespace HISP.Game.Chat
|
|||
ItemInstance itmInstance = new ItemInstance(itemId);
|
||||
|
||||
if (itemId == Item.Present)
|
||||
itmInstance.Data = Item.GetRandomItem(false).Id;
|
||||
itmInstance.Data = Item.GetRandomItem().Id;
|
||||
|
||||
client.LoggedinUser.Inventory.AddIgnoringFull(itmInstance);
|
||||
}
|
||||
|
|
|
@ -122,15 +122,14 @@ namespace HISP.Game.Items
|
|||
public int ItemCount;
|
||||
}
|
||||
|
||||
public static ItemInformation GetRandomItem(bool allowQuest)
|
||||
public static ItemInformation GetRandomItem()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Item.ItemInformation itm = Items[GameServer.RandomNumberGenerator.Next(0, Items.Length)];
|
||||
|
||||
if(!allowQuest)
|
||||
if (itm.Type == "QUEST" || itm.Type == "CONCEPTUAL")
|
||||
continue;
|
||||
if (itm.Type == "QUEST" || itm.Type == "CONCEPTUAL" || itm.Type == "TEXT")
|
||||
continue;
|
||||
|
||||
return itm;
|
||||
}
|
||||
|
|
|
@ -6453,6 +6453,11 @@ namespace HISP.Server
|
|||
{
|
||||
InventoryItem item = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
||||
int newItem = item.ItemInstances[0].Data;
|
||||
if(newItem == 0)
|
||||
{
|
||||
// TODO: Get "Present is empty" message.
|
||||
sender.LoggedinUser.Inventory.Remove(item.ItemInstances[0]);
|
||||
}
|
||||
try
|
||||
{
|
||||
sender.LoggedinUser.Inventory.Add(new ItemInstance(newItem));
|
||||
|
|
Loading…
Add table
Reference in a new issue