Beispiel #1
0
    public override void Deactivate()
    {
        base.Deactivate();
        WorldCircle  worldCircle = new WorldCircle(base.WorldPosition, base.WorldEffectDefinition.Range);
        List <short> list        = new List <short>();

        WorldPosition[] worldPositions = worldCircle.GetWorldPositions(base.WorldEffectManager.WorldPositionningService.World.WorldParameters);
        for (int i = 0; i < worldPositions.Length; i++)
        {
            short regionIndex = base.WorldEffectManager.WorldPositionningService.GetRegionIndex(worldPositions[i]);
            if (!list.Contains(regionIndex))
            {
                Region region = base.WorldEffectManager.WorldPositionningService.GetRegion(worldPositions[i]);
                if (region.City != null)
                {
                    for (int j = 0; j < region.City.Districts.Count; j++)
                    {
                        District district = region.City.Districts[j];
                        if (this.descriptorsAppliedOnDistrict.ContainsKey(district.WorldPosition))
                        {
                            List <string> list2 = this.descriptorsAppliedOnDistrict[district.WorldPosition];
                            for (int k = 0; k < list2.Count; k++)
                            {
                                StaticString descriptorNames = list2[k];
                                district.RemoveDescriptorByName(descriptorNames);
                            }
                        }
                        district.Refresh(false);
                    }
                }
                list.Add(regionIndex);
            }
        }
        worldPositions = new WorldCircle(base.WorldPosition, base.WorldEffectDefinition.Range + 1).GetWorldPositions(base.WorldEffectManager.WorldPositionningService.World.WorldParameters);
        for (int l = 0; l < worldPositions.Length; l++)
        {
            PointOfInterest pointOfInterest = base.WorldEffectManager.WorldPositionningService.GetPointOfInterest(worldPositions[l]);
            if (pointOfInterest != null)
            {
                if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero)
                {
                    IGameEntity gameEntity = null;
                    if (base.WorldEffectManager.GameEntityRepositoryService.TryGetValue(pointOfInterest.CreepingNodeGUID, out gameEntity))
                    {
                        CreepingNode creepingNode = gameEntity as CreepingNode;
                        if (!creepingNode.IsUnderConstruction)
                        {
                            creepingNode.ReApplyFIMSEOnCreepingNode();
                        }
                    }
                }
                else if (pointOfInterest.SimulationObject.Tags.Contains(Village.ConvertedVillage))
                {
                    DepartmentOfTheInterior.ReApplyFIMSEOnConvertedVillage(pointOfInterest.Empire, pointOfInterest);
                }
            }
        }
    }
Beispiel #2
0
    private List <District> GetAffectedDistrict()
    {
        List <District> list        = new List <District>();
        WorldCircle     worldCircle = new WorldCircle(base.WorldPosition, base.WorldEffectDefinition.Range);
        List <short>    list2       = new List <short>();

        WorldPosition[] worldPositions = worldCircle.GetWorldPositions(base.WorldEffectManager.WorldPositionningService.World.WorldParameters);
        for (int i = 0; i < worldPositions.Length; i++)
        {
            short regionIndex = base.WorldEffectManager.WorldPositionningService.GetRegionIndex(worldPositions[i]);
            if (!list2.Contains(regionIndex))
            {
                Region region = base.WorldEffectManager.WorldPositionningService.GetRegion(worldPositions[i]);
                if (region.City != null)
                {
                    foreach (District district in region.City.Districts)
                    {
                        if (base.HasAnEffectOnPosition(district.WorldPosition))
                        {
                            list.Add(district);
                        }
                    }
                }
                list2.Add(regionIndex);
            }
        }
        worldPositions = new WorldCircle(base.WorldPosition, base.WorldEffectDefinition.Range + 1).GetWorldPositions(base.WorldEffectManager.WorldPositionningService.World.WorldParameters);
        for (int j = 0; j < worldPositions.Length; j++)
        {
            PointOfInterest pointOfInterest = base.WorldEffectManager.WorldPositionningService.GetPointOfInterest(worldPositions[j]);
            if (pointOfInterest != null)
            {
                if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero)
                {
                    IGameEntity gameEntity = null;
                    if (base.WorldEffectManager.GameEntityRepositoryService.TryGetValue(pointOfInterest.CreepingNodeGUID, out gameEntity))
                    {
                        CreepingNode creepingNode = gameEntity as CreepingNode;
                        if (!creepingNode.IsUnderConstruction)
                        {
                            creepingNode.ReApplyFIMSEOnCreepingNode();
                        }
                    }
                }
                else if (pointOfInterest.SimulationObject.Tags.Contains(Village.ConvertedVillage))
                {
                    DepartmentOfTheInterior.ReApplyFIMSEOnConvertedVillage(pointOfInterest.Empire, pointOfInterest);
                }
            }
        }
        return(list);
    }