mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-18 19:01:32 +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);
|
ItemInstance newItemInstance = new ItemInstance(itemId);
|
||||||
|
|
||||||
if (itemId == Item.Present)
|
if (itemId == Item.Present)
|
||||||
newItemInstance.Data = Item.GetRandomItem(false).Id;
|
newItemInstance.Data = Item.GetRandomItem().Id;
|
||||||
|
|
||||||
if (args.Length >= 3)
|
if (args.Length >= 3)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace HISP.Game.Chat
|
||||||
ItemInstance itmInstance = new ItemInstance(itemId);
|
ItemInstance itmInstance = new ItemInstance(itemId);
|
||||||
|
|
||||||
if (itemId == Item.Present)
|
if (itemId == Item.Present)
|
||||||
itmInstance.Data = Item.GetRandomItem(false).Id;
|
itmInstance.Data = Item.GetRandomItem().Id;
|
||||||
|
|
||||||
client.LoggedinUser.Inventory.AddIgnoringFull(itmInstance);
|
client.LoggedinUser.Inventory.AddIgnoringFull(itmInstance);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,15 +122,14 @@ namespace HISP.Game.Items
|
||||||
public int ItemCount;
|
public int ItemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemInformation GetRandomItem(bool allowQuest)
|
public static ItemInformation GetRandomItem()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Item.ItemInformation itm = Items[GameServer.RandomNumberGenerator.Next(0, Items.Length)];
|
Item.ItemInformation itm = Items[GameServer.RandomNumberGenerator.Next(0, Items.Length)];
|
||||||
|
|
||||||
if(!allowQuest)
|
if (itm.Type == "QUEST" || itm.Type == "CONCEPTUAL" || itm.Type == "TEXT")
|
||||||
if (itm.Type == "QUEST" || itm.Type == "CONCEPTUAL")
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
return itm;
|
return itm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6453,6 +6453,11 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
InventoryItem item = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
InventoryItem item = sender.LoggedinUser.Inventory.GetItemByRandomid(randomId);
|
||||||
int newItem = item.ItemInstances[0].Data;
|
int newItem = item.ItemInstances[0].Data;
|
||||||
|
if(newItem == 0)
|
||||||
|
{
|
||||||
|
// TODO: Get "Present is empty" message.
|
||||||
|
sender.LoggedinUser.Inventory.Remove(item.ItemInstances[0]);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.Inventory.Add(new ItemInstance(newItem));
|
sender.LoggedinUser.Inventory.Add(new ItemInstance(newItem));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue