Beispiel #1
0
 public Inventory.ItemDescription GetItemDescriptionByClassId(int appId, ulong contextId, ulong classId, bool isCurrency)
 {
     try
     {
         var inventory = Inventories[appId];
         if (isCurrency)
         {
             var key = string.Format("{0}_{1}", classId, 0);
             return(inventory[contextId].RgDescriptions[key]);
         }
         else
         {
             Inventory.Item item = null;
             foreach (var rgItem in inventory[contextId].RgInventory)
             {
                 if (rgItem.Value.ClassId == classId)
                 {
                     item = inventory[contextId].RgInventory[rgItem.Key];
                 }
             }
             var key = string.Format("{0}_{1}", classId, item.InstanceId);
             return(inventory[contextId].RgDescriptions[key]);
         }
     }
     catch
     {
         return(null);
     }
 }
Beispiel #2
0
 public Inventory.ItemDescription GetItemDescription(int appId, ulong contextId, ulong id, bool isCurrency)
 {
     try
     {
         var inventory = Inventories[appId];
         if (isCurrency)
         {
             Inventory.CurrencyItem currencyItem = null;
             if (inventory[contextId].RgCurrencies.ContainsKey(id.ToString()))
             {
                 currencyItem = inventory[contextId].RgCurrencies[id.ToString()];
             }
             var key = string.Format("{0}_{1}", currencyItem.ClassId, 0);
             return(inventory[contextId].RgDescriptions[key]);
         }
         else
         {
             Inventory.Item item = null;
             if (inventory[contextId].RgInventory.ContainsKey(id.ToString()))
             {
                 item = inventory[contextId].RgInventory[id.ToString()];
             }
             var key = string.Format("{0}_{1}", item.ClassId, item.InstanceId);
             return(inventory[contextId].RgDescriptions[key]);
         }
     }
     catch
     {
         return(null);
     }
 }