public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { if (!initiator.IsColonist || !recipient.IsColonist) { return(0f); } if (!PartyUtility.AcceptableGameConditionsToStartParty(initiator.Map)) { return(0f); } PsychologyPawn realRecipient = recipient as PsychologyPawn; PsychologyPawn realInitiator = initiator as PsychologyPawn; if (realRecipient == null || realInitiator == null) { return(0f); } if (!LovePartnerRelationUtility.LovePartnerRelationExists(initiator, recipient)) { return(0f); } if (realInitiator.psyche.lastDateTick >= Find.TickManager.TicksGame - GenDate.TicksPerDay * 7 || realRecipient.psyche.lastDateTick >= Find.TickManager.TicksGame - GenDate.TicksPerDay * 7) { return(0f); } if (initiator.health.summaryHealth.SummaryHealthPercent < 1f || recipient.health.summaryHealth.SummaryHealthPercent < 1f) { return(0f); } return(1.2f * realInitiator.psyche.GetPersonalityRating(PersonalityNodeDefOf.Romantic) * (1f - realInitiator.psyche.GetPersonalityRating(PersonalityNodeDefOf.Independent)) * realRecipient.psyche.GetPersonalityRating(PersonalityNodeDefOf.Romantic) * (1f - realRecipient.psyche.GetPersonalityRating(PersonalityNodeDefOf.Independent)) * RendezvousUtility.ColonySizeFactor(initiator)); }
public override void OnActivate(int pinID) { if (pinID != 120) { return; } int lastSelectionIndex; PartyEditData loadTeamPreset = PartyUtility.LoadTeamPresets(PlayerPartyTypes.RankMatch, out lastSelectionIndex, false)[lastSelectionIndex]; for (int index = 0; index < loadTeamPreset.PartyData.VSWAITMEMBER_START; ++index) { if (index + 1 > loadTeamPreset.Units.Length || loadTeamPreset.Units[index] == null) { this.ActivateOutputLinks(201); return; } } List <int> intList = new List <int>(); for (int index = 0; index < loadTeamPreset.PartyData.VSWAITMEMBER_START; ++index) { int num = PlayerPrefsUtility.GetInt(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index, -1); if (num >= 0) { if (intList.Contains(num)) { this.ActivateOutputLinks(202); return; } intList.Add(num); } } this.ActivateOutputLinks(200); }
public override StateGraph CreateGraph() { StateGraph stateGraph = new StateGraph(); LordToil_Funeral lordToil_Funeral = new LordToil_Funeral(this.spot); stateGraph.AddToil(lordToil_Funeral); LordToil_End lordToil_End = new LordToil_End(); stateGraph.AddToil(lordToil_End); Transition transition = new Transition(lordToil_Funeral, lordToil_End); transition.AddTrigger(new Trigger_TickCondition(() => !PartyUtility.AcceptableGameConditionsToContinueParty(base.Map))); transition.AddTrigger(new Trigger_PawnLostViolently()); transition.AddPreAction(new TransitionAction_Message("MessageFuneralCalledOff".Translate(), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, this.Map, false))); stateGraph.AddTransition(transition); int length = Rand.RangeInclusive(GenDate.TicksPerHour, Mathf.RoundToInt(GenDate.TicksPerHour * 2.5f)); this.timeoutTrigger = new Trigger_TicksPassed(length); Transition transition2 = new Transition(lordToil_Funeral, lordToil_End); transition2.AddTrigger(this.timeoutTrigger); transition2.AddPreAction(new TransitionAction_Custom((Action) delegate { this.Finished(); })); stateGraph.AddTransition(transition2); return(stateGraph); }
public override void OnSuccess(WWWResult www) { if (Network.IsError) { switch (Network.ErrCode) { case Network.EErrCode.NoUnitParty: case Network.EErrCode.IllegalParty: this.OnFailed(); break; default: FlowNode_Network.Retry(); break; } } WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text); GameManager instance = MonoSingleton <GameManager> .Instance; try { if (jsonObject.body == null) { throw new InvalidJSONException(); } instance.Deserialize(jsonObject.body.player); instance.Deserialize(jsonObject.body.parties); } catch (Exception ex) { FlowNode_Network.Retry(); return; } Json_Party[] parties = jsonObject.body.parties; if (parties != null && parties.Length > 0) { Json_Party json = parties[0]; for (int index1 = 0; index1 < 11; ++index1) { int num = index1; if (index1 != 9) { PartyData party = new PartyData((PlayerPartyTypes)num); party.Deserialize(json); PartyWindow2.EditPartyTypes editPartyType = ((PlayerPartyTypes)num).ToEditPartyType(); List <PartyEditData> teams = new List <PartyEditData>(); int maxTeamCount = editPartyType.GetMaxTeamCount(); for (int index2 = 0; index2 < maxTeamCount; ++index2) { PartyEditData partyEditData = new PartyEditData(PartyUtility.CreateDefaultPartyNameFromIndex(index2), party); teams.Add(partyEditData); } PartyUtility.SaveTeamPresets(editPartyType, 0, teams, false); } } } Network.RemoveAPI(); ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(10); }
public override void Tick() { base.Tick(); if (!LovePartnerRelationUtility.LovePartnerRelationExists(this.pawn, this.partner)) { this.pawn.health.RemoveHediff(this); } else if (Find.TickManager.TicksGame >= this.day && GenLocalDate.HourOfDay(this.pawn) == this.hour) { if (this.pawn.GetTimeAssignment() != TimeAssignmentDefOf.Work && this.partner.GetTimeAssignment() != TimeAssignmentDefOf.Work && !this.pawn.Drafted && !this.partner.Drafted && PartyUtility.AcceptableGameConditionsToStartParty(this.pawn.Map) && this.pawn.Map == this.partner.Map) { pawn.jobs.StopAll(); if (pawn.Awake() && partner.Awake()) { LordMaker.MakeNewLord(this.pawn.Faction, new LordJob_Date(this.pawn, this.partner), this.pawn.Map, new Pawn[] { this.pawn, this.partner }); } else if (pawn.Awake()) { this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.MissedDate, this.partner); } else { this.partner.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.MissedDate, this.pawn); } } else { this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.DateCancelled); this.partner.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.DateCancelled); } this.pawn.health.RemoveHediff(this); } }
public override bool IsPossible() { if (target is Map map) { map = target as Map; } else { return(false); } pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, Helper.AnyPlayerMap); if (pawn == null) { return(false); } IntVec3 intVec; if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { return(false); } return(true); }
public static bool TryStartMassFuneral(Map map) { if (Utils.CurrentDay() == 7 || Utils.CurrentDay() == 14) { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, map); if (pawn == null) { return(false); } IntVec3 intVec; if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { return(false); } foreach (Pawn deadPawn in Resources.deadPawnsForMassFuneralBuried) { if (deadPawn != null) { deadPawnsNames = deadPawnsNames + deadPawn.Label + "\n"; } } Lord lord = LordMaker.MakeNewLord(pawn.Faction, new LordJob_RimStory(Resources.lastGrave.Position, pawn), map, null); Find.LetterStack.ReceiveLetter("FuneralLetter".Translate(), "FuneralDesc".Translate() + deadPawnsNames, LetterDefOf.NeutralEvent, Resources.lastGrave); deadPawnsNames = ""; return(true); } return(false); }
private void CheckPlayableTeams(QuestParam quest, List <PartyEditData> teams, List <SupportData> supports = null) { if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StartButton, (UnityEngine.Object)null)) { return; } ((Selectable)this.StartButton).set_interactable(PartyUtility.ValidateOrdealTeams(quest, teams, supports, true)); }
private List <PartyEditData> LoadTeamFromPlayerPrefs() { int maxTeamCount = PartyWindow2.EditPartyTypes.Ordeal.GetMaxTeamCount(); int lastSelectionIndex; List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PartyWindow2.EditPartyTypes.Ordeal, out lastSelectionIndex, false) ?? new List <PartyEditData>(); this.ValidateTeam(this.mCurrentQuest, teams, maxTeamCount); return(teams); }
// Token: 0x06000906 RID: 2310 RVA: 0x000474A0 File Offset: 0x000458A0 protected override bool Satisfied(Pawn pawn) { if (pawn.mindState.duty == null) { return(false); } IntVec3 cell = pawn.mindState.duty.focus.Cell; return(PartyUtility.InPartyArea(pawn.Position, cell, pawn.Map)); }
private void CreateSlots() { this.DestroyPartySlotObjects(); List <PartySlotData> mainSlotData = new List <PartySlotData>(); List <PartySlotData> subSlotData = new List <PartySlotData>(); PartySlotData supportSlotData = (PartySlotData)null; PartyUtility.CreatePartySlotData(this.mCurrentQuest, out mainSlotData, out subSlotData, out supportSlotData); List <GenericSlot> genericSlotList = new List <GenericSlot>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.MainMemberHolder, (UnityEngine.Object)null) && mainSlotData.Count > 0) { using (List <PartySlotData> .Enumerator enumerator = mainSlotData.GetEnumerator()) { while (enumerator.MoveNext()) { PartySlotData current = enumerator.Current; GenericSlot genericSlot = current.Type == PartySlotType.Npc || current.Type == PartySlotType.NpcHero ? this.CreateSlotObject(current, this.NpcSlotTemplate, this.MainMemberHolder) : this.CreateSlotObject(current, this.UnitSlotTemplate, this.MainMemberHolder); genericSlotList.Add(genericSlot); } } if (supportSlotData != null) { this.FriendSlot = this.CreateSlotObject(supportSlotData, this.UnitSlotTemplate, this.MainMemberHolder); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SubMemberHolder, (UnityEngine.Object)null) && subSlotData.Count > 0) { using (List <PartySlotData> .Enumerator enumerator = subSlotData.GetEnumerator()) { while (enumerator.MoveNext()) { PartySlotData current = enumerator.Current; GenericSlot genericSlot = current.Type == PartySlotType.Npc || current.Type == PartySlotType.NpcHero ? this.CreateSlotObject(current, this.NpcSlotTemplate, this.SubMemberHolder) : this.CreateSlotObject(current, this.UnitSlotTemplate, this.SubMemberHolder); genericSlotList.Add(genericSlot); } } } this.mSlotData.AddRange((IEnumerable <PartySlotData>)mainSlotData); this.mSlotData.AddRange((IEnumerable <PartySlotData>)subSlotData); this.UnitSlots = genericSlotList.ToArray(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendSlot, (UnityEngine.Object)null) && this.mCurrentQuest != null && this.mCurrentQuest.type == QuestTypes.Tower) { TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(this.mCurrentQuest.iname); if (towerFloor != null) { ((Component)this.FriendSlot).get_gameObject().SetActive(towerFloor.can_help); ((Component)this.SupportSkill).get_gameObject().SetActive(towerFloor.can_help); } } this.mGuestUnits = new List <UnitData>(); PartyUtility.MergePartySlotWithPartyUnits(this.mCurrentQuest, this.mSlotData, this.mCurrentParty, this.mGuestUnits, this.mIsUserOwnUnits); this.ReflectionUnitSlot(); }
private void StartQuest() { List <PartyEditData> ordealParties = GlobalVars.OrdealParties; List <SupportData> ordealSupports = GlobalVars.OrdealSupports; if (!PartyUtility.ValidateOrdealTeams(this.mCurrentQuest, ordealParties, ordealSupports, false) || PartyUtility.CheckWarningForOrdealTeams(ordealParties, (Action)(() => FlowNode_GameObject.ActivateOutputLinks((Component)this, 1000)))) { return; } FlowNode_GameObject.ActivateOutputLinks((Component)this, 1000); }
private void Finished() { List <Pawn> ownedPawns = this.lord.ownedPawns; for (int i = 0; i < ownedPawns.Count; i++) { if (PartyUtility.InPartyArea(ownedPawns[i].Position, this.spot)) { ownedPawns[i].needs.mood.thoughts.memories.TryGainMemoryThought(CorruptionDefOfs.AttendedSermon, ListenedTo(ownedPawns[i], sermonSpots)); } } }
public override float VoluntaryJoinPriorityFor(Pawn p) { if (assignedPreachers.Contains(p)) { return(0f); } if (!this.IsInvited(p, spot)) { return(0f); } if (!PartyUtility.ShouldPawnKeepPartying(p)) { return(0f); } if (!this.lord.ownedPawns.Contains(p) && this.IsPartyAboutToEnd()) { return(0f); } Need_Soul soul = p.needs.TryGetNeed <Need_Soul>(); if (soul != null) { switch (soul.DevotionTrait.SDegree) { case -2: { return(0f); } case -1: { return(5f); } case 0: { return(20f); } case 1: { return(25f); } case 2: { return(30f); } } } return(20f); }
public override bool IsPossible() { pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, Helper.AnyPlayerMap); if (pawn == null) { return(false); } if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { return(false); } return(true); }
protected override Job TryGiveJob(Pawn pawn) { IntVec3 result; if (!PartyUtility.TryFindRandomCellInPartyArea(pawn, out result)) { return(null); } if (result.IsValid && result.DistanceToSquared(pawn.Position) < ReachDestDist && result.GetRoom(pawn.Map) == pawn.GetRoom()) { pawn.GetLord().Notify_ReachedDutyLocation(pawn); return(null); } return(new Job(JobDefOf.Goto, result, 500, true)); }
public bool TryStartGathering(Map map) { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, map); if (pawn == null) { Messages.Message("ElectionFail_ColonistsNotFound".Translate(), MessageSound.RejectInput); return(false); } lastElectionTick = Find.TickManager.TicksGame; allowElection = false; LordMaker.MakeNewLord(pawn.Faction, new LordJob_Joinable_LeaderElection(Position), map, null); Find.LetterStack.ReceiveLetter("Election".Translate(), "ElectionGathering".Translate(), LetterDefOf.Good, new TargetInfo(Position, map, false), null); return(true); }
public override float VoluntaryJoinPriorityFor(Pawn p) { if (!this.IsInvited(p)) { return(0f); } if (!PartyUtility.ShouldPawnKeepPartying(p)) { return(0f); } if (!this.lord.ownedPawns.Contains(p) && this.IsPartyAboutToEnd()) { return(0f); } return(20f); }
private void Awake() { this.TypePullDown.OnSelectionChangeDelegate = new ScrollablePulldownBase.SelectItemEvent(this.OnTypeItemSelect); this.ElemmentPullDown.OnSelectionChangeDelegate = new Pulldown.SelectItemEvent(this.OnElemmentItemSelect); if (GlobalVars.RecommendTeamSettingValue != null) { this.currentTypeIndex = PartyUtility.RecommendTypeToComparatorOrder(GlobalVars.RecommendTeamSettingValue.recommendedType); this.currentElemmentIndex = (int)GlobalVars.RecommendTeamSettingValue.recommendedElement; } else { this.currentTypeIndex = 0; this.currentElemmentIndex = 0; } this.Refresh(); }
public override void TryExecute() { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, Helper.AnyPlayerMap); if (pawn == null) { return; } if (!RCellFinder.TryFindPartySpot(pawn, out IntVec3 intVec)) { return; } Verse.AI.Group.LordMaker.MakeNewLord(pawn.Faction, new LordJob_Joinable_Party(intVec, pawn), Helper.AnyPlayerMap, null); string text = "LetterNewParty".Translate(pawn.LabelShort, pawn); Find.LetterStack.ReceiveLetter("LetterLabelNewParty".Translate(), text, LetterDefOf.PositiveEvent, new TargetInfo(intVec, Helper.AnyPlayerMap, false), null, null); }
private void Start() { int lastSelectionIndex; List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PlayerPartyTypes.Versus, out lastSelectionIndex, false); if (teams == null || teams.Count <= lastSelectionIndex) { return; } PartyEditData partyEditData = teams[lastSelectionIndex]; UnitData[] src = new UnitData[partyEditData.PartyData.MAX_UNIT]; for (int index = 0; index < partyEditData.Units.Length && index < partyEditData.PartyData.VSWAITMEMBER_START; ++index) { src[index] = partyEditData.Units[index]; } partyEditData.SetUnits(src); PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.Versus, lastSelectionIndex, teams, false); }
private void LoadParty() { this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest); PlayerData player = MonoSingleton <GameManager> .Instance.Player; PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest); if (type == PartyWindow2.EditPartyTypes.Auto) { type = PartyWindow2.EditPartyTypes.Normal; } PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType()); this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT]; string str = this.mCurrentQuest.units.Get(0); if (this.mIsUserOwnUnits) { for (int index = 0; index < partyOfType.MAX_UNIT; ++index) { long unitUniqueId = partyOfType.GetUnitUniqueID(index); if (unitUniqueId > 0L) { this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId); } } } else { for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index) { if (this.mUserSelectionParty[index] == null) { this.mCurrentParty[index] = (UnitData)null; } if (this.mUserSelectionParty[index] == null || !(this.mUserSelectionParty[index].UnitParam.iname == str)) { this.mCurrentParty[index] = this.mUserSelectionParty[index]; } } } }
private void LoadTeam() { GameUtility.DestroyGameObjects(this.mTeamPanels); this.mTeamPanels.Clear(); GlobalVars.OrdealParties = this.LoadTeamFromPlayerPrefs(); List <PartyEditData> ordealParties = GlobalVars.OrdealParties; List <SupportData> ordealSupports = GlobalVars.OrdealSupports; for (int index = 0; index < ordealParties.Count; ++index) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type OrdealQuestList.\u003CLoadTeam\u003Ec__AnonStorey368 teamCAnonStorey368 = new OrdealQuestList.\u003CLoadTeam\u003Ec__AnonStorey368(); // ISSUE: reference to a compiler-generated field teamCAnonStorey368.\u003C\u003Ef__this = this; OrdealTeamPanel component = (OrdealTeamPanel)((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)((Component)this.TeamPanelTemplate).get_gameObject())).GetComponent <OrdealTeamPanel>(); ((Component)component).get_gameObject().SetActive(true); foreach (UnitData unit in ordealParties[index].Units) { if (unit != null) { component.Add(unit); } } // ISSUE: reference to a compiler-generated field teamCAnonStorey368.index = index; // ISSUE: method pointer ((UnityEvent)component.Button.get_onClick()).AddListener(new UnityAction((object)teamCAnonStorey368, __methodptr(\u003C\u003Em__37A))); component.TeamName.set_text(ordealParties[index].Name); SupportData supportData = (SupportData)null; if (ordealSupports != null && index < ordealSupports.Count) { supportData = ordealSupports[index]; component.SetSupport(supportData); } int num = PartyUtility.CalcTotalAttack(ordealParties[index], MonoSingleton <GameManager> .Instance.Player.Units, supportData, (List <UnitData>)null); component.TotalAtack.set_text(num.ToString()); this.mTeamPanels.Add(((Component)component).get_gameObject()); ((Component)component).get_transform().SetParent(this.TeamPanelContainer.get_transform(), false); } this.CheckPlayableTeams(this.mCurrentQuest, ordealParties, ordealSupports); }
// Token: 0x0600078F RID: 1935 RVA: 0x0003FD88 File Offset: 0x0003E188 public override float VoluntaryJoinPriorityFor(Pawn p) { if (!this.IsInvited(p)) { return(0f); } if (!PartyUtility.ShouldPawnKeepPartying(p)) { return(0f); } if (this.spot.IsForbidden(p)) { return(0f); } if (!this.lord.ownedPawns.Contains(p) && this.IsPartyAboutToEnd()) { return(0f); } return(VoluntarilyJoinableLordJobJoinPriorities.PartyGuest); }
public static bool TryStartGathering(Map map) { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, map); if (pawn == null) { Messages.Message("ElectionFail_ColonistsNotFound".Translate(), MessageSound.RejectInput); return(false); } IntVec3 intVec; if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { Messages.Message("Couldn't find a suitable safe spot for the election.", MessageSound.RejectInput); return(false); } LordMaker.MakeNewLord(pawn.Faction, new LordJob_Joinable_LeaderElection(intVec), map, null); Find.LetterStack.ReceiveLetter("Election".Translate(), "ElectionGathering".Translate(), LetterDefOf.Good, new TargetInfo(intVec, map, false), null); return(true); }
//RCellFinder public static void TryFindPartySpot_PostFix(Pawn organizer, ref IntVec3 result, ref bool __result) { bool enjoyableOutside = JoyUtility.EnjoyableOutsideNow(organizer, null); Map map = organizer.Map; if (map.listerThings.ThingsOfDef(ThingDef.Named("LotRH_PlantPartyTree")).Any(x => x is Plant y && y.HarvestableNow)) { Predicate <IntVec3> baseValidator = delegate(IntVec3 cell) { if (!cell.Standable(map)) { return(false); } if (cell.GetDangerFor(organizer, map) != Danger.None) { return(false); } if (!enjoyableOutside && !cell.Roofed(map)) { return(false); } if (cell.IsForbidden(organizer)) { return(false); } if (!organizer.CanReserveAndReach(cell, PathEndMode.OnCell, Danger.None, 1, -1, null, false)) { return(false); } Room room = cell.GetRoom(map, RegionType.Set_Passable); bool flag = room != null && room.isPrisonCell; return(organizer.IsPrisoner == flag && PartyUtility.EnoughPotentialGuestsToStartParty(map, new IntVec3?(cell))); }; if ((from x in map.listerThings.ThingsOfDef(ThingDef.Named("LotRH_PlantPartyTree")).Where(x => x is Plant y && y.HarvestableNow) where baseValidator(x.InteractionCell) select x.InteractionCell).TryRandomElement(out result)) { __result = true; } } }
private void PostJobChange() { this.mRequestSent = false; if (this.mTargetUnit != null) { MonoSingleton <GameManager> .Instance.Player.OnJobChange(this.mTargetUnit.UnitID); this.mOriginalJobID = this.mTargetUnit.CurrentJob.JobID; if (this.UpdateValue != null) { this.UpdateValue(); } if (DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max) == PlayerPartyTypes.MultiTower) { int lastSelectionIndex = 0; List <PartyEditData> teams = PartyUtility.LoadTeamPresets(PartyWindow2.EditPartyTypes.MultiTower, out lastSelectionIndex, false); if (teams != null && lastSelectionIndex >= 0) { for (int index1 = 0; index1 < teams.Count; ++index1) { if (teams[index1] != null) { for (int index2 = 0; index2 < teams[index1].Units.Length; ++index2) { if (teams[index1].Units[index2] != null && teams[index1].Units[index2].UnitParam.iname == this.mTargetUnit.UnitParam.iname) { teams[index1].Units[index2] = this.mTargetUnit; break; } } } } PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.MultiTower, lastSelectionIndex, teams, false); GlobalEvent.Invoke("SELECT_PARTY_END", (object)null); } } } FlowNode_GameObject.ActivateOutputLinks((Component)this, 11); }
public bool TryStartEvent(Map map) { if (faction != null) { bool flag = true; foreach (int y in yearsWhenEventStarted) { if (y == Utils.CurrentYear()) { flag = false; } } if (Utils.CurrentDay() == date.day && Utils.CurrentQuadrum() == date.quadrum && Utils.CurrentHour() >= Resources.minHour && Utils.CurrentHour() <= Resources.maxHour && Utils.CurrentYear() != date.year && flag) { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, map); if (pawn == null) { return(false); } IntVec3 intVec; if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { return(false); } yearsWhenEventStarted.Add(Utils.CurrentYear()); yearsWhenEventStarted.Add(Utils.CurrentYear()); Lord lord = LordMaker.MakeNewLord(pawn.Faction, new LordJob_Joinable_Party(intVec, pawn), map, null); //Find.LetterStack.ReceiveLetter("Day of "+faction.Name+" defeat", "Your colonists are celebrating " + faction.Name + "'s defeat on \n" + date, LetterDefOf.PositiveEvent); Find.LetterStack.ReceiveLetter("DayOfVictory".Translate(faction.Name), "DayOfVictoryDesc".Translate(new object[] { faction.Name, date }), LetterDefOf.PositiveEvent); return(true); } flag = true; } return(false); }
public bool TryStartEvent(Map map) { bool flag = true; foreach (int y in yearsWhenEventStarted) { if (y == Utils.CurrentYear()) { flag = false; } } if (Utils.CurrentDay() == date.day && Utils.CurrentQuadrum() == date.quadrum && Utils.CurrentHour() >= Resources.minHour && Utils.CurrentHour() <= Resources.maxHour && Utils.CurrentYear() != date.year && flag) { Pawn pawn = PartyUtility.FindRandomPartyOrganizer(Faction.OfPlayer, map); if (pawn == null) { return(false); } IntVec3 intVec; if (!RCellFinder.TryFindPartySpot(pawn, out intVec)) { return(false); } yearsWhenEventStarted.Add(Utils.CurrentYear()); Lord lord = LordMaker.MakeNewLord(pawn.Faction, new LordJob_Joinable_Party(intVec, pawn), map, null); //Find.LetterStack.ReceiveLetter("Memorial Day", "Colonist are gathering to honor fallen colonists.", LetterDefOf.PositiveEvent); Find.LetterStack.ReceiveLetter("AMemorialDayLetter".Translate(), "AMemorialDayDesc".Translate(), LetterDefOf.PositiveEvent); return(true); } flag = true; return(false); }
private void Finished() { List <Pawn> ownedPawns = this.lord.ownedPawns; int num = 0; for (int i = 0; i < ownedPawns.Count; i++) { if (PartyUtility.InPartyArea(ownedPawns[i].Position, this.spot, base.Map)) { ownedPawns[i].needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("AttendedElection"), null); num++; } } if (num != 0) { IncidentParms parms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, IncidentDef.Named("LeaderElection").category, this.Map); IncidentDef.Named("LeaderElection").Worker.TryExecute(parms); } else { Messages.Message("ElectionNoAttendees".Translate(), MessageSound.Negative); } }