Exemplo n.º 1
0
        internal void Init()
        {
            lock (LockObject)
            {
                PetToPlayer.Clear();
                PlayerToClass.Clear();
                TakenPetOrPlayerAction.Clear();
                VerifiedPets.Clear();
                VerifiedPlayers.Clear();
                PossiblePlayerCache.Clear();

                AddVerifiedPlayer(ConfigUtil.PlayerName, DateUtil.ToDouble(DateTime.Now));

                ConfigUtil.ReadPlayers().ForEach(player =>
                {
                    if (!string.IsNullOrEmpty(player) && player.Length > 2)
                    {
                        var split = player.Split('=');
                        if (split.Length == 2 && double.TryParse(split[1], out double parsed))
                        {
                            AddVerifiedPlayer(split[0], parsed);
                        }
                        else
                        {
                            AddVerifiedPlayer(split[0], 0d);
                        }
                    }
                });

                var mapping = ConfigUtil.ReadPetMapping();
                foreach (var key in mapping.Keys)
                {
                    if (!VerifiedPlayers.ContainsKey(mapping[key]))
                    {
                        AddVerifiedPlayer(mapping[key], 0d);
                    }

                    AddVerifiedPet(key);
                    AddPetToPlayer(key, mapping[key], true);
                }

                PetMappingUpdated = false;
            }
        }
Exemplo n.º 2
0
        internal void Clear()
        {
            lock (this)
            {
                PetToPlayer.Clear();
                PlayerToClass.Clear();
                TakenPetOrPlayerAction.Clear();
                VerifiedPets.Clear();
                VerifiedPlayers.Clear();

                AddVerifiedPlayer(ConfigUtil.PlayerName);
                foreach (var keypair in ConfigUtil.ReadPetMapping())
                {
                    AddVerifiedPlayer(keypair.Value);
                    AddVerifiedPet(keypair.Key);
                    AddPetToPlayer(keypair.Key, keypair.Value);
                }

                ConfigUtil.ReadPlayers().ForEach(player => AddVerifiedPlayer(player));
                PetMappingUpdated = PlayersUpdated = false;
            }
        }