コード例 #1
0
 public Byte[] RequestStorage(string ServerKey, int ChestId)
 {
     OperationsLog("Storge request for " + @ChestId + " on " + @ServerKey + "received.");
       				ServerTracking sInv = sMasterSettings.GlobalTracking.ServerTrackingList.Where(x => @x.ServerKey == @ServerKey).FirstOrDefault();
       				if(sInv == null)
       				{
       					sInv = new ServerTracking(ServerKey);
       					sMasterSettings.GlobalTracking.ServerTrackingList.Add(sInv);
       					OperationsLog("Added Server Inventory for " + @sInv.ServerKey);
       				}
       				ServerStorageTracking sSto = sInv.ServerStorageHash.Where(x => x.StorageChestGUID == ChestId).FirstOrDefault();
       				if(sSto == null)
       				{
       					sSto = new ServerStorageTracking(@ServerKey, ChestId);
       					StorageBuffer.Add(sSto);
       					OperationsLog("Added storage for " + ChestId);
       				}
       				using(MemoryStream stream = new MemoryStream())
       			{
       					try
       					{
             Serializer.PrepareSerializer<ServerStorageTracking>();
             Serializer.Serialize(stream, sSto);
       					}catch(Exception ex){LogError(ex);}
       				return stream.ToArray();
       			}
 }
コード例 #2
0
        private void Storage_ContainerOpened(object sender, ContainerOpenedEventArgs e)
        {
            try
            {
                if (e.ItemGuid == 0) { return; }
                if (AetherObjects.Collection[e.ItemGuid].Name != "Storage") { return; }

                mCurrentStoragePendingIds = new HashSet<int>();
                mCurrentStorage = GetServerStorageFromLocker(@GearFiles.ServerKey, e.ItemGuid);

                if (!AetherObjects.Collection[e.ItemGuid].HasIdData || mCurrentStorage.OwnerName == String.Empty)
                {
                    mCurrentStoragePendingIds.Add(e.ItemGuid);
                    Core.Actions.RequestId(e.ItemGuid);
                }
                else
                {
                    mCurrentStorage.OwnerName = @AetherObjects.Collection[mCurrentStorage.StorageChestGUID].Values(AStringValueKeys.FullDescription).Trim().Substring(9);
                    mCurrentStorage.ChestKey = @mCurrentStorage.OwnerName + @"'s Storage";
                    mCurrentStorage.LastUpdateTime = DateTime.Now.ToString();
                }

                if (StorageRenderTime == DateTime.MinValue)
                {
                    StorageRenderTime = DateTime.Now;
                    Core.RenderFrame += StorageContainerTapback;
                }

            }
            catch (Exception ex) { LogError(ex); }
        }
コード例 #3
0
            internal void StorageUpdate(ServerStorageTracking Storage)
            {
                ServerStorageTracking SafeStorage = Serializer.DeepClone(Storage);

                if(!_ServerKeyDictionary.ContainsKey(SafeStorage.ServerKey)){_ServerKeyDictionary.Add(@SafeStorage.ServerKey, new BlockDictionary());}
                BlockDictionary ServerBlock = _ServerKeyDictionary[@SafeStorage.ServerKey];

                ServerBlock._HolderDictionary.Remove(@SafeStorage.ChestKey);
                foreach(KeyValuePair<AObjectClass, HashSet<InventoryObject>> kvp in ServerBlock._ClassKeyDictionary)
                {
                    kvp.Value.RemoveWhere(x => x.OwnerOrChest == @SafeStorage.ChestKey);
                }
                foreach(KeyValuePair<string, HashSet<InventoryObject>> kvp in ServerBlock._NameKeyDictionary)
                {
                    kvp.Value.RemoveWhere(x => x.OwnerOrChest == @SafeStorage.ChestKey);
                }
                foreach(KeyValuePair<string, HashSet<InventoryObject>> kvp in ServerBlock._FragmentDictionary)
                {
                    kvp.Value.RemoveWhere(x => x.OwnerOrChest == @SafeStorage.ChestKey);
                }
                foreach(KeyValuePair<int, HashSet<InventoryObject>> kvp in ServerBlock._SpellIdDictionary)
                {
                    kvp.Value.RemoveWhere(x => x.OwnerOrChest == @SafeStorage.ChestKey);
                }
                ServerBlock._EquipmentHash.RemoveWhere(x => x.OwnerOrChest == @SafeStorage.ChestKey);

                foreach(InventoryObject io in SafeStorage.StorageChestItems)
                {
                    if(!ServerBlock._HolderDictionary.ContainsKey(@io.OwnerOrChest)){ServerBlock._HolderDictionary.Add(@io.OwnerOrChest, new HashSet<InventoryObject>());}
                    ServerBlock._HolderDictionary[@io.OwnerOrChest].Add(io);
                    if(!ServerBlock._ClassKeyDictionary.ContainsKey(io.ObjectClass)){ServerBlock._ClassKeyDictionary.Add(io.ObjectClass, new HashSet<InventoryObject>());}
                    ServerBlock._ClassKeyDictionary[io.ObjectClass].Add(io);
                    if(!ServerBlock._NameKeyDictionary.ContainsKey(@io.Name)){ServerBlock._NameKeyDictionary.Add(@io.Name, new HashSet<InventoryObject>());}
                    ServerBlock._NameKeyDictionary[@io.Name].Add(io);
                    foreach(string fragement in io.Name.ToLower().Split(' '))
                    {
                        if(!ServerBlock._FragmentDictionary.ContainsKey(@fragement)){ServerBlock._FragmentDictionary.Add(@fragement, new HashSet<InventoryObject>());}
                        ServerBlock._FragmentDictionary[@fragement].Add(io);
                    }
                    foreach(int SpellId in io.aetherObject.Spells)
                    {
                        if(!ServerBlock._SpellIdDictionary.ContainsKey(SpellId)){ServerBlock._SpellIdDictionary.Add(SpellId, new HashSet<InventoryObject>());}
                        ServerBlock._SpellIdDictionary[SpellId].Add(io);
                    }
                    if(io.EquipableSlot != 0) {ServerBlock._EquipmentHash.Add(io);}
                }
            }
コード例 #4
0
 void SubmitStorageToGearLocker(ServerStorageTracking UpdatedStorage)
 {
     try
     {
         using(MemoryStream stream = new MemoryStream())
         {
             Serializer.PrepareSerializer<ServerStorageTracking>();
             Serializer.Serialize(stream, UpdatedStorage);
             LockerAccess.StoreCharacterStorage(stream.ToArray(), @GearFiles.CharacterKey);
         }
     }catch(Exception ex){LogError(ex);}
 }