Exemplo n.º 1
0
            internal HashSet<InventoryObject> GetInventory(InventoryRequest IRequest)
            {
                if(!_ServerKeyDictionary.ContainsKey(@IRequest.ServerKey)) {return new HashSet<InventoryObject>();}
                BlockDictionary ServerInventory = _ServerKeyDictionary[@IRequest.ServerKey];

                if(IRequest.ByClass != AObjectClass.Unknown)
                {
                    if(ServerInventory._ClassKeyDictionary.ContainsKey(IRequest.ByClass)) {return ServerInventory._ClassKeyDictionary[IRequest.ByClass];}
                    else{return new HashSet<InventoryObject>();}
                }
                else if(IRequest.ByName != String.Empty)
                {
                    if(IRequest.StringType == 1 && ServerInventory._HolderDictionary.ContainsKey(@IRequest.ByName)){return ServerInventory._HolderDictionary[@IRequest.ByName];}
                    else if(IRequest.StringType == 2 && ServerInventory._FragmentDictionary.ContainsKey(@IRequest.ByName)) {return ServerInventory._FragmentDictionary[@IRequest.ByName];}
                    else if(ServerInventory._NameKeyDictionary.ContainsKey(@IRequest.ByName)){return ServerInventory._NameKeyDictionary[@IRequest.ByName];}
                    else{return new HashSet<InventoryObject>();}
                }
                else if(IRequest.BySpellId.Count != 0)
                {
                    List<int> GetSpells = ServerInventory._SpellIdDictionary.Keys.Intersect(IRequest.BySpellId).ToList();
                    if(GetSpells.Count == 0) {return new HashSet<InventoryObject>();}
                    HashSet<InventoryObject> ReturnObjects = new HashSet<InventoryObject>();
                    foreach(int spellid in GetSpells)
                    {
                        ReturnObjects.UnionWith(ServerInventory._SpellIdDictionary[spellid]);
                    }
                    return ReturnObjects;
                }
                else if(IRequest.ByEquippable)
                {
                    return ServerInventory._EquipmentHash;
                }
                else
                {
                    HashSet<InventoryObject> AllHash = new HashSet<InventoryObject>();
                    foreach(KeyValuePair<string, HashSet<InventoryObject>> kvp in ServerInventory._HolderDictionary)
                    {
                        AllHash.UnionWith(kvp.Value);
                    }
                    return AllHash;
                }
            }
Exemplo n.º 2
0
 public Byte[] RequestInventory(InventoryRequest IRequest)
 {
     HashSet<InventoryObject> InventoryReturn = InventoryAccess.GetInventory(IRequest);
       				using(MemoryStream stream = new MemoryStream())
       			{
       					try
       					{
       						Serializer.PrepareSerializer<HashSet<InventoryObject>>();
             Serializer.Serialize(stream, InventoryReturn);
       					}catch(Exception ex){LogError(ex);}
       				return stream.ToArray();
       			}
 }
 HashSet<InventoryObject> GetInventoryFromLocker(InventoryRequest IRequest)
 {
     using(MemoryStream stream = new MemoryStream(LockerAccess.RequestInventory(IRequest)))
     {
         Serializer.PrepareSerializer<HashSet<InventoryObject>>();
         LastSet = Serializer.Deserialize<HashSet<InventoryObject>>(stream);
         return new HashSet<InventoryObject>(LastSet);
     }
 }