private PopulationHandler(string id, Population.Type t, NPC npc)
        {
            areaId = id;
            type   = t;

            population = new List <NPC>(new[] { npc });
        }
        static void AddPriv(string area, NPC npc)
        {
            Population.Type type = npc.profession == ReferenceData.Profession.Creature ? Population.Type.Bounties : Population.Type.Population;

            var dict = type == Population.Type.Bounties ? bounties : populations;

            if (dict.ContainsKey(area))
            {
                dict[area].Add(npc);
            }
            else
            {
                dict.Add(area, new PopulationHandler(area, type, npc));
            }
        }
Exemplo n.º 3
0
        public Population GetPopulation(Population.Type t)
        {
            string id = (type == AreaType.Dungeon || type == AreaType.Arena || type == AreaType.Nest) ?
                        GeneratePath(false) + parent
                : AreaId;

            switch (t)
            {
            case Population.Type.Bounties: return(_bounties ?? (_bounties = Population.Load(t, id) ?? new Population(t, id)));

            case Population.Type.Population: return(_population ?? (_population = Population.Load(t, id) ?? new Population(t, id)));

            default: return(null);
            }
        }