Пример #1
0
            internal void CharacterUpdate(CharacterInventoryTracking Character)
            {
                CharacterInventoryTracking SafeCharacter = Serializer.DeepClone(Character);

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

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

                foreach(InventoryObject io in SafeCharacter.InventoryItems)
                {
                    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);}
                }
            }
Пример #2
0
 public Byte[] RequestCharacterInventory(string ServerKey, string CharacterKey)
 {
     OperationsLog("Character Inventory Request for " + @ServerKey + " received from " + @CharacterKey);
       				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);
       				}
       				CharacterInventoryTracking cInv = sInv.CharacterInventoryHash.Where(x => @x.CharacterKey == @CharacterKey).FirstOrDefault();
       				if(cInv == null)
       				{
       					cInv = new CharacterInventoryTracking(ServerKey, CharacterKey);
       					InventoryBuffer.Add(cInv);
       					OperationsLog("Added Character Inventory for" + @cInv.CharacterKey);
       				}
       				using(MemoryStream stream = new MemoryStream())
       			{
       					try
       					{
             Serializer.PrepareSerializer<CharacterInventoryTracking>();
             Serializer.Serialize(stream, cInv);
       					}catch(Exception ex){LogError(ex);}
       				return stream.ToArray();
       			}
 }
        private void InitLoginFilenames()
        {
            try
            {
                GearFiles.CharacterKey = @AetherServer.ServerName + "_" + @AetherCharacter.CharStats.Name;
                mCharacterSettings = GetCharacterSettingsFromLocker(@GearFiles.CharacterKey);
                glCharacterInventory = GetCharcterInventoryFromLocker(@GearFiles.ServerKey, @GearFiles.CharacterKey);
                if(mCharacterSettings.AccountKey == String.Empty) {mCharacterSettings.AccountKey = @GearFiles.AccountKey;}
                if(mCharacterSettings.CharacterKey == String.Empty) {mCharacterSettings.CharacterKey = @GearFiles.CharacterKey;}
                if(mCharacterSettings.ServerKey == String.Empty) {mCharacterSettings.ServerKey = @GearFiles.ServerKey;}

            } catch (Exception ex) { LogError(ex); }
        }