Exemplo n.º 1
0
    private void RefreshVFXEffects()
    {
        bool endlessDay   = false;
        bool dustDeposits = false;

        if (this.sensibleToEndlessDay)
        {
            endlessDay = SimulationGlobal.GlobalTagsContains(DownloadableContent8.EndlessDay.ReadOnlyTag);
        }
        if (base.PointOfInterest.UntappedDustDeposits)
        {
            dustDeposits = SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag);
        }
        this.RefreshVFXEffects(endlessDay, dustDeposits);
    }
    private bool CanSearch(Army army, IWorldPositionable item, IQuestManagementService questManagementService, IQuestRepositoryService questRepositoryService)
    {
        if (army.HasCatspaw)
        {
            return(false);
        }
        PointOfInterest pointOfInterest = item as PointOfInterest;

        if (pointOfInterest == null)
        {
            return(false);
        }
        if (pointOfInterest.Type != ELCPUtilities.QuestLocation && pointOfInterest.Type != "NavalQuestLocation")
        {
            return(false);
        }
        if (pointOfInterest.Interaction.IsLocked(army.Empire.Index, "ArmyActionSearch"))
        {
            return(false);
        }
        if (ELCPUtilities.UseELCPPeacefulCreepingNodes)
        {
            if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != army.Empire)
            {
                if (pointOfInterest.Empire == null)
                {
                    return(false);
                }
                if (!(pointOfInterest.Empire is MajorEmpire))
                {
                    return(false);
                }
                DepartmentOfForeignAffairs agency = army.Empire.GetAgency <DepartmentOfForeignAffairs>();
                if (agency == null)
                {
                    return(false);
                }
                if (!agency.IsFriend(pointOfInterest.Empire))
                {
                    return(false);
                }
            }
        }
        else if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != army.Empire)
        {
            return(false);
        }
        if ((pointOfInterest.Interaction.Bits & army.Empire.Bits) == army.Empire.Bits && !SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag))
        {
            return(false);
        }
        if (SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag) && !pointOfInterest.UntappedDustDeposits && (pointOfInterest.Interaction.Bits & army.Empire.Bits) == army.Empire.Bits)
        {
            return(false);
        }
        if ((pointOfInterest.Interaction.Bits & army.Empire.Bits) != 0)
        {
            using (IEnumerator <QuestMarker> enumerator = questManagementService.GetMarkersByBoundTargetGUID(pointOfInterest.GUID).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Quest quest;
                    if (questRepositoryService.TryGetValue(enumerator.Current.QuestGUID, out quest) && quest.EmpireBits == army.Empire.Bits)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
        return(true);
    }
Exemplo n.º 3
0
    public static bool CanSearch(global::Empire empire, IWorldPositionable item, IQuestManagementService questManagementService)
    {
        PointOfInterest pointOfInterest = item as PointOfInterest;

        if (pointOfInterest == null)
        {
            return(false);
        }
        if (pointOfInterest.Type != ELCPUtilities.QuestLocation && pointOfInterest.Type != "NavalQuestLocation")
        {
            Diagnostics.Log("fail1 {0}", new object[]
            {
                pointOfInterest.Type
            });
            return(false);
        }
        if (pointOfInterest.Interaction.IsLocked(empire.Index, "ArmyActionSearch"))
        {
            Diagnostics.Log("fail2");
            return(false);
        }
        if (ELCPUtilities.UseELCPPeacefulCreepingNodes)
        {
            if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != empire)
            {
                if (pointOfInterest.Empire == null)
                {
                    return(false);
                }
                if (!(pointOfInterest.Empire is MajorEmpire))
                {
                    return(false);
                }
                DepartmentOfForeignAffairs agency = empire.GetAgency <DepartmentOfForeignAffairs>();
                if (agency == null)
                {
                    return(false);
                }
                if (!agency.IsFriend(pointOfInterest.Empire))
                {
                    return(false);
                }
            }
        }
        else if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != empire)
        {
            return(false);
        }
        if ((pointOfInterest.Interaction.Bits & empire.Bits) == empire.Bits && !SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag))
        {
            Diagnostics.Log("fail3");
            return(false);
        }
        if (SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag) && !pointOfInterest.UntappedDustDeposits && (pointOfInterest.Interaction.Bits & empire.Bits) == empire.Bits)
        {
            Diagnostics.Log("fail4");
            return(false);
        }
        if ((pointOfInterest.Interaction.Bits & empire.Bits) != 0)
        {
            using (IEnumerator <QuestMarker> enumerator = questManagementService.GetMarkersByBoundTargetGUID(pointOfInterest.GUID).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (enumerator.Current.IsVisibleFor(empire))
                    {
                        Diagnostics.Log("fail5");
                        return(false);
                    }
                }
            }
            return(true);
        }
        return(true);
    }
Exemplo n.º 4
0
    protected override void ShowTooltip(WorldPosition worldPosition)
    {
        if (this.guiTooltipService == null)
        {
            return;
        }
        if (AgeManager.IsMouseCovered)
        {
            return;
        }
        IWorldPositionningService service = base.GameService.Game.Services.GetService <IWorldPositionningService>();

        if (worldPosition.IsValid)
        {
            if (service != null)
            {
                if (service == null)
                {
                    this.guiTooltipService.HideTooltip();
                    return;
                }
                if ((service.GetExplorationBits(worldPosition) & base.EmpireBits) == 0)
                {
                    this.guiTooltipService.HideTooltip();
                    return;
                }
                AgeTransform         cursorTooltipAnchor = this.guiTooltipService.GetCursorTooltipAnchor();
                AgeTooltipAnchorMode anchorMode          = AgeTooltipAnchorMode.FREE;
                global::CursorTarget cursorTarget        = null;
                if (base.CursorTargetService.HighlightedCursorTargets.Count > 0)
                {
                    for (int i = 0; i < base.CursorTargetService.HighlightedCursorTargets.Count; i++)
                    {
                        Diagnostics.Log("Cursortarget {0} at {1} is {2} and has tooltipclass {3}", new object[]
                        {
                            i,
                            worldPosition,
                            base.CursorTargetService.HighlightedCursorTargets[i].GetType(),
                            (base.CursorTargetService.HighlightedCursorTargets[i] as global::CursorTarget).TooltipClass
                        });
                        Diagnostics.Log("Conten: {0}", new object[]
                        {
                            (base.CursorTargetService.HighlightedCursorTargets[i] as global::CursorTarget).TooltipContent
                        });
                        Diagnostics.Log("Context: {0}", new object[]
                        {
                            (base.CursorTargetService.HighlightedCursorTargets[i] as global::CursorTarget).TooltipContext.GetType()
                        });
                        if (cursorTarget == null)
                        {
                            cursorTarget = (base.CursorTargetService.HighlightedCursorTargets[i] as global::CursorTarget);
                        }
                        else if (StaticString.IsNullOrEmpty(cursorTarget.TooltipClass))
                        {
                            cursorTarget = (base.CursorTargetService.HighlightedCursorTargets[i] as global::CursorTarget);
                        }
                    }
                }
                string          text            = string.Format("Worldposition: {0} {1}", worldPosition.Row, worldPosition.Column);
                PointOfInterest pointOfInterest = service.GetPointOfInterest(worldPosition);
                if (pointOfInterest != null)
                {
                    text += "\nhas POI!";
                    IQuestManagementService service2 = base.GameService.Game.Services.GetService <IQuestManagementService>();
                    IQuestRepositoryService service3 = base.GameService.Game.Services.GetService <IQuestRepositoryService>();
                    global::Empire          empire   = base.GameService.Game.Services.GetService <IPlayerControllerRepositoryService>().ActivePlayerController.Empire as global::Empire;
                    if (empire != null)
                    {
                        text += string.Concat(new object[]
                        {
                            "\n",
                            pointOfInterest.Type,
                            ", ",
                            pointOfInterest.Interaction.IsLocked(empire.Index, "ArmyActionSearch").ToString(),
                            ", ",
                            pointOfInterest.Interaction.Bits,
                            ", ",
                            empire.Bits,
                            ", ",
                            (pointOfInterest.Interaction.Bits & empire.Bits) == empire.Bits,
                            ", ",
                            pointOfInterest.UntappedDustDeposits.ToString(),
                            ", ",
                            SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag).ToString()
                        }).ToString();
                        foreach (QuestMarker questMarker in service2.GetMarkersByBoundTargetGUID(pointOfInterest.GUID))
                        {
                            Quest quest;
                            if (service3.TryGetValue(questMarker.QuestGUID, out quest))
                            {
                                text = text + "\nhas Questmarker for quest" + quest.QuestDefinition.Name;
                                QuestBehaviour questBehaviour = service3.GetQuestBehaviour(quest.Name, empire.Index);
                                if (questBehaviour != null)
                                {
                                    QuestBehaviourTreeNode_ConditionCheck_HasResourceAmount questBehaviourTreeNode_ConditionCheck_HasResourceAmount;
                                    if (quest.QuestDefinition.Variables.First((QuestVariableDefinition p) => p.VarName == "$NameOfStrategicResourceToGather1") != null && this.TryGetFirstNodeOfType <QuestBehaviourTreeNode_ConditionCheck_HasResourceAmount>(questBehaviour.Root as BehaviourTreeNodeController, out questBehaviourTreeNode_ConditionCheck_HasResourceAmount))
                                    {
                                        string resourceName = questBehaviourTreeNode_ConditionCheck_HasResourceAmount.ResourceName;
                                        int    wantedAmount = questBehaviourTreeNode_ConditionCheck_HasResourceAmount.WantedAmount;
                                        text = text + "\nResource: " + resourceName;
                                        text = text + "\nAmount: " + wantedAmount;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                if (!(cursorTarget != null) || StaticString.IsNullOrEmpty(cursorTarget.TooltipClass))
                {
                    if (base.TooltipFilters != null)
                    {
                        if (!Array.Exists <StaticString>(base.TooltipFilters, (StaticString match) => match == "Terrain"))
                        {
                            this.guiTooltipService.HideTooltip();
                            return;
                        }
                    }
                    this.guiTooltipService.ShowTooltip(string.Empty, text, worldPosition, cursorTooltipAnchor, anchorMode, 0f, false);
                    return;
                }
                if (base.TooltipFilters == null || Array.Exists <StaticString>(base.TooltipFilters, (StaticString match) => match == cursorTarget.TooltipClass))
                {
                    this.guiTooltipService.ShowTooltip(string.Empty, text, worldPosition, cursorTooltipAnchor, anchorMode, 0f, false);
                    return;
                }
                this.guiTooltipService.HideTooltip();
                return;
            }
        }
        else
        {
            this.guiTooltipService.HideTooltip();
        }
    }
Exemplo n.º 5
0
    private bool CanSearch(Army army, PointOfInterest pointOfInterest, IQuestManagementService questManagementService, IQuestRepositoryService questRepositoryService, ref bool available)
    {
        IGameService service = Services.GetService <IGameService>();

        if (service == null)
        {
            return(false);
        }
        global::Game game = service.Game as global::Game;

        if (game == null)
        {
            return(false);
        }
        if (pointOfInterest == null)
        {
            return(false);
        }
        if (pointOfInterest.Type != ELCPUtilities.QuestLocation)
        {
            return(false);
        }
        if (ELCPUtilities.UseELCPPeacefulCreepingNodes)
        {
            if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != army.Empire)
            {
                if (pointOfInterest.Empire == null)
                {
                    return(false);
                }
                if (!(pointOfInterest.Empire is MajorEmpire))
                {
                    return(false);
                }
                DepartmentOfForeignAffairs agency = army.Empire.GetAgency <DepartmentOfForeignAffairs>();
                if (agency == null)
                {
                    return(false);
                }
                if (!agency.IsFriend(pointOfInterest.Empire))
                {
                    return(false);
                }
            }
        }
        else if (pointOfInterest.CreepingNodeGUID != GameEntityGUID.Zero && pointOfInterest.Empire != army.Empire)
        {
            return(false);
        }
        bool flag = false;

        foreach (QuestMarker questMarker in questManagementService.GetMarkersByBoundTargetGUID(pointOfInterest.GUID))
        {
            Quest quest;
            if (!questMarker.IgnoreInteraction && questRepositoryService.TryGetValue(questMarker.QuestGUID, out quest) && quest.EmpireBits == army.Empire.Bits)
            {
                if (!quest.QuestDefinition.SkipLockedQuestTarget)
                {
                    available = true;
                    return(true);
                }
                flag = true;
            }
        }
        if (pointOfInterest.UntappedDustDeposits && SimulationGlobal.GlobalTagsContains(SeasonManager.RuinDustDepositsTag))
        {
            return(true);
        }
        if (pointOfInterest.Interaction.IsLocked(army.Empire.Index, this.Name))
        {
            return(false);
        }
        IWorldPositionningService service2 = game.Services.GetService <IWorldPositionningService>();

        if (service2 != null && service2.IsWaterTile(pointOfInterest.WorldPosition))
        {
            return(false);
        }
        global::Empire[] empires = game.Empires;
        for (int i = 0; i < empires.Length; i++)
        {
            using (IEnumerator <Army> enumerator2 = empires[i].GetAgency <DepartmentOfDefense>().Armies.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    if (enumerator2.Current.WorldPosition == pointOfInterest.WorldPosition)
                    {
                        return(false);
                    }
                }
            }
        }
        if ((pointOfInterest.Interaction.Bits & army.Empire.Bits) == 0)
        {
            return(true);
        }
        available = true;
        if (flag)
        {
            available = true;
            return(true);
        }
        return(false);
    }