/// <summary> /// The main constructor for the ReferenceRequest class. /// </summary> /// <param name="loadIdRequested">The load ID that is being requested.</param> /// <param name="label">The label that this request can be identified with.</param> /// <param name="parent">The parent that allows this request to be tracked, comparing /// Scribe.loader.curParent with this parent.</param> public ReferenceRequest(string loadIdRequested, string label, IExposable parent) { this.loadIdRequested = loadIdRequested; this.label = label; this.parent = parent; }
private static void SyncedSetShifts(Building register, IExposable firstShift, IExposable secondShift, IExposable thirdShift, IExposable fourthShift, IExposable fifthShift) { var list = shiftsListField(register); list.Clear(); if (firstShift == null) { return; } list.Add(firstShift); if (secondShift == null) { return; } list.Add(secondShift); if (thirdShift == null) { return; } list.Add(thirdShift); if (fourthShift == null) { return; } list.Add(fourthShift); if (fifthShift == null) { return; } list.Add(fifthShift); }
public void RegisterForPostLoadInit(IExposable s) { if (Scribe.mode != LoadSaveMode.LoadingVars) { Log.Error(string.Concat(new object[] { "Registered ", s, " for post load init, but current mode is ", Scribe.mode }), false); return; } if (s == null) { Log.Warning("Trying to register null in RegisterforPostLoadInit.", false); return; } if (this.saveablesToPostLoad.Contains(s)) { Log.Warning("Tried to register in RegisterforPostLoadInit when already registered: " + s, false); return; } this.saveablesToPostLoad.Add(s); }
private static void RegisterReferencing(IExposable obj) { /* Не сработало, не понятно почему * if (Scribe.loader?.crossRefs?.crossReferencingExposables != null * && !Scribe.loader.crossRefs.crossReferencingExposables.Contains(obj)) * { * Scribe.loader.crossRefs.RegisterForCrossRefResolve(obj); * } */ /* Тоже не сработало, тоже не понятно почему * try * { * Loger.Log("Client RegisterReferencing " + obj.GetUniqueLoadID()); * var that = Traverse.Create(Scribe.loader.crossRefs); * LoadedObjectDirectory loadedObjectDirectory = that.Field("loadedObjectDirectory").GetValue<LoadedObjectDirectory>(); * * loadedObjectDirectory.RegisterLoaded(obj); * } * catch (Exception exp) * { * ExceptionUtil.ExceptionLog(exp, "Client RegisterReferencing"); * } */ if (!CrossRefHandler_ResolveAllCrossReferences_Patch.crossReferencingExposables.Contains(obj)) { CrossRefHandler_ResolveAllCrossReferences_Patch.crossReferencingExposables.Add(obj); } }
public override void OnSucessfullCast(Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState) { float exceedPower = this.totalPower; foreach (Pawn target in targets.OfType<Pawn>()) { float pawnAvailPower = this.targetPower; if (pawnAvailPower + exceedPower >= this.treatLocalInjuryPowerUse) { foreach (Hediff_Injury toTreat in target.health.hediffSet.GetInjuriesTreatable().OrderByDescending(i => i.Severity)) { pawnAvailPower -= this.treatLocalInjuryPowerUse; HediffComp_Tendable hediffComp_Treatable = toTreat.TryGetComp<HediffComp_Tendable>(); if (hediffComp_Treatable == null) Log.Error("Tried to treat " + toTreat + " which does not have a HediffComp_Tendable"); else hediffComp_Treatable.CompTreated(0.3f, 1); Brain brain = caster.pawn.GetSquadBrain(); if ((brain != null) && (!target.Downed) && (target.GetSquadBrain() == null)) brain.AddPawn(target); if (pawnAvailPower < 0) { exceedPower += pawnAvailPower; pawnAvailPower = 0; } if (pawnAvailPower + exceedPower < this.treatLocalInjuryPowerUse) break; } } if (pawnAvailPower + exceedPower >= this.healLocalInjuryPowerUse) { foreach (Hediff_Injury toHeal in target.health.hediffSet.hediffs.OfType<Hediff_Injury>() .Where(i => i.IsTendedAndHealing() && (i.Severity != 0.0f)) .OrderByDescending(i => i.Severity)) { float maximum = ((pawnAvailPower + exceedPower) / this.healLocalInjuryPowerUse); maximum = Math.Min(maximum, toHeal.Severity); toHeal.DirectHeal(maximum); pawnAvailPower -= maximum * this.healLocalInjuryPowerUse; if (pawnAvailPower < 0) { exceedPower += pawnAvailPower; pawnAvailPower = 0; } if (pawnAvailPower + exceedPower < this.healLocalInjuryPowerUse) break; } } } }
public override void OnSucessfullCast(Saveable_Caster pawn, IEnumerable<Thing> targets, IExposable effectState) { List<Pawn> newPawns = new List<Pawn>(); foreach (PawnKindDef pawnKind in this.pawnKinds) { Pawn newPawn = PawnGenerator.GeneratePawn(pawnKind, pawn.pawn.Faction); IntVec3 loc = CellFinder.RandomClosewalkCellNear(pawn.pawn.Position, this.range); GenSpawn.Spawn(newPawn, loc); newPawns.Add(newPawn); if (this.spawnedMote != null) this.spawnedMote.AbilityStarted(pawn, newPawn); } Brain brain = pawn.pawn.GetSquadBrain(); if (brain == null) { StateGraph squadBrainStateGraph = GraphMaker.AssaultColonyGraph(pawn.pawn.Faction, false, false); newPawns.Insert(0, pawn.pawn); BrainMaker.MakeNewBrain(pawn.pawn.Faction, squadBrainStateGraph, newPawns); } else foreach (Pawn newPawn in newPawns) brain.AddPawn(newPawn); }
public void InitLoading(string filePath) { if (Scribe.mode != 0) { Log.Error("Called InitLoading() but current mode is " + Scribe.mode); Scribe.ForceStop(); } if (curParent != null) { Log.Error("Current parent is not null in InitLoading"); curParent = null; } if (curPathRelToParent != null) { Log.Error("Current path relative to parent is not null in InitLoading"); curPathRelToParent = null; } try { using (StreamReader input = new StreamReader(filePath)) { using XmlTextReader reader = new XmlTextReader(input); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(reader); curXmlParent = xmlDocument.DocumentElement; } Scribe.mode = LoadSaveMode.LoadingVars; } catch (Exception ex) { Log.Error("Exception while init loading file: " + filePath + "\n" + ex); ForceStop(); throw; } }
/// <summary> /// Set vars in ScribeVars to loader vars. /// </summary> public static void Set() { mode = Scribe.mode; curParent = Scribe.loader.curParent; curXmlParent = Scribe.loader.curXmlParent; curPathRelToParent = Scribe.loader.curPathRelToParent; }
public override void Select(IExposable selecting) { MilUnitFC squad = (MilUnitFC)selecting; selectedUnit = squad; selectedText = squad.name; }
public IdRecord(string targetLoadID, Type targetType, string pathRelToParent, IExposable parent) { this.targetLoadID = targetLoadID; this.targetType = targetType; this.pathRelToParent = pathRelToParent; this.parent = parent; }
public void FinalizeLoading() { if (Scribe.mode != LoadSaveMode.LoadingVars) { Log.Error("Called FinalizeLoading() but current mode is " + Scribe.mode); } else { try { Scribe.ExitNode(); curXmlParent = null; curParent = null; curPathRelToParent = null; Scribe.mode = LoadSaveMode.Inactive; crossRefs.ResolveAllCrossReferences(); initer.DoAllPostLoadInits(); } catch (Exception arg) { Log.Error("Exception in FinalizeLoading(): " + arg); ForceStop(); throw; } } }
private HttpRequestMessage CreateRequestMessage(IExposable metrics, string job, Stream stream) { var path = string.Format("/metrics/job/{0}", WebUtility.UrlEncode(job)); if (!string.IsNullOrEmpty(instance)) { path = string.Format("{0}/instance/{1}", path, WebUtility.UrlEncode(instance)); } if (defaultLabels != null) { foreach (var pair in defaultLabels) { if (string.IsNullOrEmpty(pair?.Item1) || string.IsNullOrEmpty(pair.Item2)) { continue; } path = string.Format("{0}/{1}/{2}", path, WebUtility.UrlEncode(pair.Item1), WebUtility.UrlEncode(pair.Item2)); } } var request = new HttpRequestMessage(HttpMethod.Post, path); request.Content = new StreamContent(stream); request.Content.Headers.TryAddWithoutValidation("Content-Type", "text/plain; version=0.0.4"); return(request); }
public LVI_Ex(IExposable value) : base() { Value = value; //SubItems are always at least 1 SubItems.AddRange(value.TextValues().Select((t, i) => new LVSI_Ex(this, Value, i)).ToArray()); SubItems.RemoveAt(0); }
public string Take <T>(string pathRelToParent, IExposable parent) { for (int i = 0; i < this.idsRead.Count; i++) { if (this.idsRead[i].parent == parent && this.idsRead[i].pathRelToParent == pathRelToParent) { string targetLoadID = this.idsRead[i].targetLoadID; if (typeof(T) != this.idsRead[i].targetType) { Log.Error(string.Concat(new object[] { "Trying to get load ID of object of type ", typeof(T), ", but it was registered as ", this.idsRead[i].targetType, ". pathRelToParent=", pathRelToParent, ", parent=", parent.ToStringSafe <IExposable>() })); } this.idsRead.RemoveAt(i); return(targetLoadID); } } Log.Error("Could not get load ID. We're asking for something which was never added during LoadingVars. pathRelToParent=" + pathRelToParent + ", parent=" + parent.ToStringSafe <IExposable>()); return(null); }
/// <summary> /// Clear vars stored in ScribeVars. /// </summary> public static void Clear() { mode = LoadSaveMode.Inactive; curParent = null; curXmlParent = null; curPathRelToParent = null; }
public JobDriverHolder(AbilityEffect_Cast owner, JobDriver_AbilityEffect jobDriver, Saveable_Caster caster, IEnumerable <Thing> targets, IExposable effectState) { this.owner = owner; this.jobDriver = jobDriver; this.effectState = effectState; this.caster = caster; this.targets = targets; }
public override bool TryStart(AbilityDef ability, Saveable_Caster caster, ref List<Thing> targets, ref IExposable effectState) { AbilityEffect_RandomState state = new AbilityEffect_RandomState(); state.item = Rand.Range(0, this.items.Count); effectState = state; return this.items[state.item].TryStart(ability, caster, ref targets, ref state.effectState); }
public static byte[] WriteExposable(IExposable element, string name = RootNode, bool indent = false, Action beforeElement = null) { StartWriting(indent); Scribe.EnterNode(RootNode); beforeElement?.Invoke(); Scribe_Deep.Look(ref element, name); return(FinishWriting()); }
public void SetActive(IExposable selecting) { if (window == null) { throw new ApplicationException("Tried to set active on null"); } window?.Select(selecting); }
public PrometheusServer(IOptions <PrometheusServerOptions> options, IExposable metrics, ILogger <PrometheusServer> logger) { _prefix = $"http://*:{options.Value.Port}/"; _listener = new HttpListener { Prefixes = { _prefix } }; _metrics = metrics; _logger = logger; }
public string ToXml(IExposable t) { return(@"<?xml version=""1.0"" encoding=""utf-8""?> <" + rootElementName + @"> " + Scribe.saver.DebugOutputFor(t) + @" </" + rootElementName + ">"); }
public void NotifyCompleted(bool sucess) { foreach (Saveable_Mote mote in this.currentMotes) { mote.Completed(this, sucess, i => this.currentMotes.Remove(i)); } this.currentAbility = null; this.currentTargets = null; this.effectState = null; }
public override JobDef StartJob(IExposable effectState) { if (this.canBeInterrupted) { return(DefDatabase <JobDef> .GetNamed("AbilityEffect_JobDef_Interruptable")); } else { return(DefDatabase <JobDef> .GetNamed("AbilityEffect_JobDef")); } }
public void ForceStop() { this.curXmlParent = null; this.curParent = null; this.crossRefs.Clear(false); this.initer.Clear(); if (Scribe.mode == LoadSaveMode.LoadingVars || Scribe.mode == LoadSaveMode.ResolvingCrossRefs || Scribe.mode == LoadSaveMode.PostLoadInit) { Scribe.mode = LoadSaveMode.Inactive; } }
public void ForceStop() { curXmlParent = null; curParent = null; curPathRelToParent = null; crossRefs.Clear(errorIfNotEmpty: false); initer.Clear(); if (Scribe.mode == LoadSaveMode.LoadingVars || Scribe.mode == LoadSaveMode.ResolvingCrossRefs || Scribe.mode == LoadSaveMode.PostLoadInit) { Scribe.mode = LoadSaveMode.Inactive; } }
public static void ScribeCustomList <T>(ref List <T> list, string label, Action <T> saver, Func <T> loader, IExposable caller) { Scribe.EnterNode("events"); try { if (Scribe.mode == LoadSaveMode.Saving) { foreach (T e in list) { Scribe.EnterNode("li"); try { saver.Invoke(e); } finally { Scribe.ExitNode(); } } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { XmlNode curXmlParent = Scribe.loader.curXmlParent; list = new List <T>(); foreach (object obj in curXmlParent.ChildNodes) { XmlNode subNode = (XmlNode)obj; XmlNode oldXmlParent = Scribe.loader.curXmlParent; IExposable oldParent = Scribe.loader.curParent; string oldPathRelToParent = Scribe.loader.curPathRelToParent; Scribe.loader.curPathRelToParent = null; Scribe.loader.curParent = caller; Scribe.loader.curXmlParent = subNode; try { list.Add(loader.Invoke()); } finally { Scribe.loader.curXmlParent = oldXmlParent; Scribe.loader.curParent = oldParent; Scribe.loader.curPathRelToParent = oldPathRelToParent; } } } } finally { Scribe.ExitNode(); } }
public List <string> TakeList(string pathRelToParent, IExposable parent) { for (int i = 0; i < this.idListsRead.Count; i++) { if (this.idListsRead[i].parent == parent && this.idListsRead[i].pathRelToParent == pathRelToParent) { List <string> targetLoadIDs = this.idListsRead[i].targetLoadIDs; this.idListsRead.RemoveAt(i); return(targetLoadIDs); } } Log.Error("Could not get load IDs list. We're asking for something which was never added during LoadingVars. pathRelToParent=" + pathRelToParent + ", parent=" + parent.ToStringSafe <IExposable>()); return(new List <string>()); }
public List <T> TakeResolvedRefList <T>(string pathRelToParent, IExposable parent) { List <string> list = loadIDs.TakeList(pathRelToParent, parent); List <T> list2 = new List <T>(); if (list != null) { for (int i = 0; i < list.Count; i++) { list2.Add(loadedObjectDirectory.ObjectWithLoadID <T>(list[i])); } } return(list2); }
public override bool TryStart(AbilityDef ability, Saveable_Caster caster, ref List<Thing> target, ref IExposable effectState) { if (!base.TryStart(ability, caster, ref target, ref effectState)) return false; if ((target == null) || (this.items == null) || (!this.items.Any())) return false; target = target.OfType<Pawn>().Where(i => this.items.SelectMany(j => j.from).Contains(i.def)).OfType<Thing>().ToList(); return target.Any(); }
public void RegisterForCrossRefResolve(IExposable s) { if (Scribe.mode != LoadSaveMode.LoadingVars) { Log.Error("Registered " + s + " for cross ref resolve, but current mode is " + Scribe.mode); } else if (s != null) { if (DebugViewSettings.logMapLoad) { LogSimple.Message("RegisterForCrossRefResolve " + ((s != null) ? s.GetType().ToString() : "null")); } crossReferencingExposables.Add(s); } }
// Given a field name, deep-copies an instance of an IExposable class from a source object to a target object via reflection. // Creates a deep copy by serializing and then deserializing the IExposable instance. The class must be constructable // with no arguments. public static void CopyExposableViaReflection(string fieldName, object source, object target, object[] constructorArgs) { FieldInfo sourceField = source.GetType().GetField(fieldName); FieldInfo targetField = target.GetType().GetField(fieldName); if (sourceField != null && targetField != null) { object value = sourceField.GetValue(source); if (typeof(IExposable).IsAssignableFrom(value.GetType())) { IExposable e = (IExposable)value; IExposable copy = UtilityCopy.CopyExposable(e, constructorArgs); targetField.SetValue(target, copy); } } }
private static void Validate(IExposable metrics, string job) { if (metrics == null) { throw new ArgumentNullException(nameof(metrics)); } if (job == null) { throw new ArgumentNullException(nameof(job)); } if (!validLabel.IsMatch(job)) { throw new ArgumentException("Job name must be a valid Prometheus label"); } }
/// <summary> /// Pushes a metric to the push gateway. /// </summary> /// <param name="metrics">The metric to push.</param> /// <param name="job">The job name used by prometheus, this should be a unique name for the type of service. Must be a valid Prometheus label.</param> public void Push(IExposable metrics, string job) { Validate(metrics, job); // It would be better to have a buffered stream using (var ms = new MemoryStream()) { metrics.Expose(ms, ExposeOptions.NoTimestamp).ConfigureAwait(false).GetAwaiter().GetResult(); ms.Position = 0; var response = client.SendAsync(CreateRequestMessage(metrics, job, ms)).ConfigureAwait(false).GetAwaiter().GetResult(); if (!response.IsSuccessStatusCode) { throw new PushGatewayException($"Error pushing to gateway: {response.StatusCode}: {response.ReasonPhrase}"); } } }
/// <summary> /// Creates and starts a metric server. /// </summary> /// <param name="metrics">The metric to expose.</param> /// <param name="listener">An HttpListener instance to use.</param> /// <param name="errorHandler">Error handling callback. Can be null.</param> public PrometheusServer(IExposable metrics, HttpListener listener, Action <Exception> errorHandler) { this.listener = listener ?? throw new ArgumentNullException(nameof(listener)); this.metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); this.errorHandler = errorHandler; try { this.listener.Request += RequestHandler; listener.Start(); } catch (Exception ex) { throw new PrometheusServerException("Cannot start HTTP Listener", ex); } }
public override bool TryStart(AbilityDef ability, Saveable_Caster caster, ref List<Thing> targets, ref IExposable effectState) { if (!base.TryStart(ability, caster, ref targets, ref effectState)) return false; if (targets == null) return false; targets = targets .OfType<Pawn>() .Where(i => i.MaxHitPoints > 0) .Where(i => i.health.summaryHealth.SummaryHealthPercent < this.healthTrashHold) .Cast<Thing>() .ToList(); if (targets.Any()) return true; else return false; }
public override void OnSucessfullCast(Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState) { MapComponent_Ability component = MapComponent_Ability.GetOrCreate(); foreach (Pawn target in targets) { AbilityEffect_UtilityChangeKind evolveItem = this.items.First(i => i.from.Contains(target.def)); Brain brain = target.GetSquadBrain(); foreach (PawnKindDef kind in evolveItem.to) { Pawn newPawn = AbilityEffect_Revive.Copy(caster.pawn, kind, target.Faction); GenSpawn.Spawn(newPawn, target.Position); if (brain != null) brain.AddPawn(newPawn); } Building building = StoreUtility.StoringBuilding(target); if (building != null) ((Building_Storage)building).Notify_LostThing(target); target.Destroy(DestroyMode.Vanish); } }
private bool TryStartNextAbility(Saveable_Caster value, out AbilityDef ability, out List<Thing> targets, out IExposable effectState) { List<KeyValuePair<int, AbilityDef>> priorities = new List<KeyValuePair<int, AbilityDef>>(); foreach (Saveable_ExecutionLog log in value.executionLogs) { if ((!log.ability.races.Contains(value.pawn.def)) || (log.ability.validity == null) || (!log.ability.validity.Sucess(log.ability, value))) { log.isValid = false; continue; } log.isValid = true; if ((log.ability.requeriment != null) && (!log.ability.requeriment.Sucess(log.ability, value))) continue; priorities.Add(new KeyValuePair<int, AbilityDef>(log.ability.priority.GetPriority(log.ability, value.pawn), log.ability)); } if (priorities.Any()) { priorities.Sort((x, y) => y.Key.CompareTo(x.Key)); foreach (KeyValuePair<int, AbilityDef> itm in priorities) { effectState = null; targets = null; if (itm.Value.target != null) targets = itm.Value.target.Targets(itm.Value, value).ToList(); if (itm.Value.effect.TryStart(itm.Value, value, ref targets, ref effectState)) { ability = itm.Value; return true; } } } ability = null; effectState = null; targets = null; return false; }
public void NotifyCompleted(bool sucess) { foreach (Saveable_Mote mote in this.currentMotes) mote.Completed(this, sucess, i => this.currentMotes.Remove(i)); this.currentAbility = null; this.currentTargets = null; this.effectState = null; }
public abstract IEnumerable<Toil> MakeNewToils(JobDriver_AbilityEffect jobDriver, Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState);
public abstract void ExecuteWhileIncapacitated(Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState);
public abstract bool TryStart(AbilityDef ability, Saveable_Caster caster, ref List<Thing> targets, ref IExposable effectState);
public abstract JobDef StartJob(IExposable effectState);
public override void OnSucessfullCast(Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState) { MapComponent_Ability component = MapComponent_Ability.GetOrCreate(); Brain brain = caster.pawn.GetSquadBrain(); foreach (Corpse corpse in targets) { List<PawnKindDef> newKinds = new List<PawnKindDef>(); if (this.changes != null) { AbilityEffect_UtilityChangeKind kind = this.changes.FirstOrDefault(i => i.from.Contains(corpse.innerPawn.def)); if (kind != null) newKinds.AddRange(kind.to); else newKinds.Add(corpse.innerPawn.kindDef); } else newKinds.Add(corpse.innerPawn.kindDef); foreach (PawnKindDef kindDef in newKinds) { Pawn newPawn = AbilityEffect_Revive.Copy(caster.pawn, kindDef, this.changeFaction ? caster.pawn.Faction : corpse.innerPawn.Faction); if (corpse.innerPawn == caster.pawn) component.ReplacePawnAbility(caster, newPawn); IntVec3 position = corpse.Position; GenSpawn.Spawn(newPawn, position); if ((newPawn.Faction == caster.pawn.Faction) && (brain != null)) brain.AddPawn(newPawn); } Building building = StoreUtility.StoringBuilding(corpse); if (building != null) ((Building_Storage)building).Notify_LostThing(corpse); corpse.Destroy(DestroyMode.Vanish); //if (this.healUntil > 0) //{ // HediffSet hediffSet = newPawn.healthTracker.hediffSet; // while ((newPawn.healthTracker.summaryHealth.SummaryHealthPercent >= this.healUntil) && // (AbilityEffect_Revive.HittablePartsViolence(hediffSet).Any<BodyPartRecord>())) // { // BodyPartRecord bodyPartRecord = AbilityEffect_Revive.HittablePartsViolence(hediffSet).RandomElementByWeight((BodyPartRecord x) => x.absoluteFleshCoverage); // int amount = Rand.RangeInclusive(8, 25); // DamageDef def; // if (bodyPartRecord.depth == BodyPartDepth.Outside) // def = HealthUtility.RandomViolenceDamageType(); // else // def = DamageDefOf.Blunt; // DamageInfo dinfo = new DamageInfo(def, amount, null, new BodyPartDamageInfo?(new BodyPartDamageInfo(bodyPartRecord, false, (List<HediffDef>)null)), null); // newPawn.TakeDamage(dinfo); // } //} } }
public override bool TryStart(AbilityDef ability, Saveable_Caster caster, ref List<Thing> targets, ref IExposable effectState) { if (!base.TryStart(ability, caster, ref targets, ref effectState)) return false; if (targets == null) return false; List<Thing> corpses = AbilityEffect_Revive.SelectCorpses(targets); if (corpses.Any()) { targets = corpses; return true; } else return false; }
public override void ExecuteWhileIncapacitated(Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState) { AbilityEffect_RandomState typedState = (AbilityEffect_RandomState)effectState; this.items[typedState.item].ExecuteWhileIncapacitated(caster, targets, typedState.effectState); }
public override IEnumerable<Toil> MakeNewToils(JobDriver_AbilityEffect jobDriver, Saveable_Caster caster, IEnumerable<Thing> targets, IExposable effectState) { AbilityEffect_RandomState typedState = (AbilityEffect_RandomState)effectState; return this.items[typedState.item].MakeNewToils(jobDriver, caster, targets, typedState.effectState); }
public override JobDef StartJob(IExposable effectState) { AbilityEffect_RandomState typedState = (AbilityEffect_RandomState)effectState; return this.items[typedState.item].StartJob(typedState.effectState); }