Exemple #1
0
        public static Faction GetSharedExtraFaction(this Pawn p, Pawn target, ExtraFactionType type, Quest forQuest = null)
        {
            Faction extraFaction  = p.GetExtraFaction(type, forQuest);
            Faction extraFaction2 = target.GetExtraFaction(type, forQuest);

            if (extraFaction != null && extraFaction == extraFaction2)
            {
                return(extraFaction);
            }
            return(null);
        }
Exemple #2
0
 public static Faction GetExtraFaction(this Pawn p, ExtraFactionType extraFactionType, Quest forQuest = null)
 {
     tmpExtraFactions.Clear();
     GetExtraFactionsFromQuestParts(p, tmpExtraFactions, forQuest);
     for (int i = 0; i < tmpExtraFactions.Count; i++)
     {
         if (tmpExtraFactions[i].factionType == extraFactionType)
         {
             Faction faction = tmpExtraFactions[i].faction;
             tmpExtraFactions.Clear();
             return(faction);
         }
     }
     tmpExtraFactions.Clear();
     return(null);
 }
Exemple #3
0
        public static bool GetExtraFaction(ref Faction __result, Pawn p, ExtraFactionType extraFactionType, Quest forQuest = null)
        {
            //tmpExtraFactions.Clear();
            List <ExtraFaction> tmpExtraFactions = new List <ExtraFaction>();

            QuestUtility.GetExtraFactionsFromQuestParts(p, tmpExtraFactions, forQuest);
            for (int i = 0; i < tmpExtraFactions.Count; i++)
            {
                if (tmpExtraFactions[i].factionType == extraFactionType)
                {
                    Faction faction = tmpExtraFactions[i].faction;
                    tmpExtraFactions.Clear();
                    __result = faction;
                    return(false);
                }
            }

            //tmpExtraFactions.Clear();
            __result = null;
            return(false);
        }
        public static QuestPart_ExtraFaction ExtraFaction(this Quest quest, Faction faction, IEnumerable <Pawn> pawns, ExtraFactionType factionType, bool areHelpers = false, string inSignalRemovePawn = null)
        {
            QuestPart_ExtraFaction questPart_ExtraFaction = new QuestPart_ExtraFaction
            {
                affectedPawns      = pawns.ToList(),
                extraFaction       = new ExtraFaction(faction, factionType),
                areHelpers         = areHelpers,
                inSignalRemovePawn = inSignalRemovePawn
            };

            quest.AddPart(questPart_ExtraFaction);
            return(questPart_ExtraFaction);
        }
Exemple #5
0
 public static string GetLabel(this ExtraFactionType factionType)
 {
     return(("ExtraFactionType_" + factionType.ToString()).Translate());
 }
Exemple #6
0
 public static bool InSameExtraFaction(this Pawn p, Pawn target, ExtraFactionType type, Quest forQuest = null)
 {
     return(p.GetSharedExtraFaction(target, type, forQuest) != null);
 }
Exemple #7
0
 public ExtraFaction(Faction faction, ExtraFactionType factionType)
 {
     this.faction     = faction;
     this.factionType = factionType;
 }