public static void Postfix(Pawn_HealthTracker __instance) { var traverse = Traverse.Create(__instance); var pp = traverse.Field("pawn").GetValue <Pawn>(); if (!pp.IsWarframe()) { return; } if (!pp.Spawned) { return; } if (!WarframeStaticMethods.PawnInControlCell(pp)) { var job = new Job(DefDatabase <JobDef> .GetNamed("WFWait")); pp.jobs.TryTakeOrderedJob(job, JobTag.Misc); } else { if (pp.jobs.curJob.def == DefDatabase <JobDef> .GetNamed("WFWait")) { pp.jobs.EndCurrentJob(JobCondition.None); } } }
private static IEnumerable <Gizmo> GetTeleGizmos(Pawn pawn) { if (ShouldUseSquadTeleGizmo()) { yield return(WarframeStaticMethods.GetMulJump(pawn)); } }
private void healWarframe() { foreach (var thing in Map.thingGrid.ThingsAt(Position)) { if (thing is not Pawn pawn) { continue; } if (!pawn.IsWarframe()) { continue; } if ((from x in pawn.health.hediffSet.GetHediffs <Hediff_Injury>() where x.CanHealNaturally() || x.CanHealFromTending() select x).TryRandomElement(out var hediff_Injury)) { hediff_Injury.Heal(10f); WarframeStaticMethods.ShowColorText(pawn, "HP+10", new Color(0.2f, 1, 0.1f), GameFont.Medium); } break; } }
// Token: 0x0600004F RID: 79 RVA: 0x00004428 File Offset: 0x00002628 protected override void DoListingItems() { base.DoListingItems(); if (Current.ProgramState != ProgramState.Playing) { return; } var map = Find.CurrentMap; if (map == null) { return; } DoGap(); DoLabel("Tools - Warframe"); DebugToolMap("Apply: Warframe 30Level", GiveLevel, false); DebugToolMap("Apply: Max Sp", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { if (thing is not Pawn pawn || !pawn.IsWarframe()) { continue; } var wb = WarframeStaticMethods.GetBelt(pawn); wb.SP += 9999; } }, false);
public static void Postfix(Pawn_HealthTracker __instance, ref bool __result) { var traverse = Traverse.Create(__instance); var pawn = traverse.Field("pawn").GetValue <Pawn>(); if (!pawn.IsWarframe()) { return; } var num = WarframeStaticMethods.GetHP(pawn); __result = WarframeStaticMethods.ShouldDie(num, pawn); }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 public override void DoEffect(Pawn usedBy) { base.DoEffect(usedBy); var pk = WarframeStaticMethods.GetAllWarframeKind().RandomElement(); if (pk != null) { var wf = WarframeStaticMethods.GetWarframePawn(pk); GenSpawn.Spawn(wf, usedBy.Position, usedBy.Map); } usedBy.story.traits.GainTrait(new Trait(TraitDef.Named("Warframe_Trait"))); FinishInstantly(); }
public static void Postfix(Pawn_DraftController __instance, ref IEnumerable <Gizmo> __result) { var tv = Traverse.Create(__instance); var pawn = tv.Field("pawn").GetValue <Pawn>(); if (!pawn.kindDef.defName.StartsWith("Warframe_")) { return; } if (WarframeStaticMethods.PawnInControlCell(pawn)) { return; } var list = __result.ToList(); list[0].disabled = !WarframeStaticMethods.PawnInControlCell(pawn); list[0].disabledReason = "OnlyControlCell".Translate(); __result = list.AsEnumerable(); }
public override void Tick() { base.Tick(); if (cooldownTime1 > 0f) { cooldownTime1 -= 1f / 60f; } if (cooldownTime2 > 0f) { cooldownTime2 -= 1f / 60f; } if (cooldownTime3 > 0f) { cooldownTime3 -= 1f / 60f; } if (cooldownTime4 > 0f) { cooldownTime4 -= 1f / 60f; } if (tillSkillOpen <= 0) { return; } if (WarframeStaticMethods.ConsumeSP(Wearer, tillSkillMul, tillSkillOpen)) { return; } WarframeStaticMethods.GetSkillEndAction(Wearer, tillSkillOpen); tillSkillOpen = 0; tillSkillMul = 1; }
public override void Tick() { base.Tick(); if (curState == CraftState.Crafting && this.TryGetComp <CompPowerTrader>().PowerOn) { if (this.TryGetComp <CompRefuelable>().Fuel >= fuelCost) { ticks++; if (ticks % 120 == 0) { FleckMaker.ThrowMicroSparks(Position.ToVector3(), Map); //SoundDefOf.FloatMenu_Open.PlayOneShot(this); } if (ticks >= oneDayTicks) { curState = CraftState.Done; } } } if (curState != CraftState.Done) { return; } ticks = 0; var pawn = WarframeStaticMethods.GetWarframePawn(nowCraftKind); var loc = CellFinder.RandomClosewalkCellNear(Position, Map, 2); var unused = (Pawn)GenSpawn.Spawn(pawn, loc, Map); SoundDefOf.TinyBell.PlayOneShotOnCamera(); this.TryGetComp <CompRefuelable>().ConsumeFuel(fuelCost); nowCraftKind = null; curState = CraftState.Stop; Head = null; Body = null; Inside = null; }
public override IEnumerable <Gizmo> GetWornGizmos() { if (Find.Selector.SingleSelectedThing != Wearer) { yield break; } var pawn = Wearer; if (pawn == null || !pawn.IsWarframe()) { yield break; } var replace = pawn.kindDef.defName.Replace("Warframe_", ""); var ck1 = WarframeStaticMethods.GetSkillCommand(replace, 1); ck1.self = Wearer; ck1.defaultDesc = (replace + "Skill1.desc").Translate() + "\n" + "SP:" + WarframeStaticMethods.GetArmor(Wearer).TryGetComp <CompWarframeSkill>().skill1mana; ck1.disabled = (!Wearer.Drafted || cooldownTime1 > 0 || Wearer.stances.stunner.Stunned || WarframeStaticMethods.GetBelt(Wearer).SP < getSkillComp().skill1mana) && tillSkillOpen != 1; yield return(ck1); var ck2 = WarframeStaticMethods.GetSkillCommand(replace, 2); ck2.self = Wearer; ck2.defaultDesc = (replace + "Skill2.desc").Translate() + "\n" + "SP:" + WarframeStaticMethods.GetArmor(Wearer).TryGetComp <CompWarframeSkill>().skill2mana; ck2.disabled = (!Wearer.Drafted || cooldownTime2 > 0 || Wearer.stances.stunner.Stunned || WarframeStaticMethods.GetBelt(Wearer).SP < getSkillComp().skill2mana) && tillSkillOpen != 2; yield return(ck2); var ck3 = WarframeStaticMethods.GetSkillCommand(replace, 3); ck3.self = Wearer; ck3.defaultDesc = (replace + "Skill3.desc").Translate() + "\n" + "SP:" + WarframeStaticMethods.GetArmor(Wearer).TryGetComp <CompWarframeSkill>().skill3mana; ck3.disabled = (!Wearer.Drafted || cooldownTime3 > 0 || Wearer.stances.stunner.Stunned || WarframeStaticMethods.GetBelt(Wearer).SP < getSkillComp().skill3mana) && tillSkillOpen != 3; yield return(ck3); var ck4 = WarframeStaticMethods.GetSkillCommand(replace, 4); ck4.self = Wearer; ck4.defaultDesc = (replace + "Skill4.desc").Translate() + "\n" + "SP:" + WarframeStaticMethods.GetArmor(Wearer).TryGetComp <CompWarframeSkill>().skill4mana; ck4.disabled = (!Wearer.Drafted || cooldownTime4 > 0 || Wearer.stances.stunner.Stunned || WarframeStaticMethods.GetBelt(Wearer).SP < getSkillComp().skill4mana) && tillSkillOpen != 4; yield return(ck4); }
public override void DoWindowContents(Rect inRect) { if (refreshWarframePortrait) { // this.newWF.Drawer.renderer.graphics.ResolveAllGraphics(); // PortraitsCache.SetDirty(this.newWF); // PortraitsCache.PortraitsCacheUpdate(); refreshWarframePortrait = false; } var rect27 = new Rect(inRect) { width = 240f + 16f, height = 200f + 16f }; rect27 = rect27.CenteredOnXIn(inRect); rect27 = rect27.CenteredOnYIn(inRect); rect27.x -= 88f; rect27.y -= 32f; if (newWF != null) { //picture GUI.DrawTexture(rect27, ContentFinder <Texture2D> .Get("WFPicture/" + nowWarframeKind.defName.Replace("Warframe_", "")), ScaleMode.ScaleToFit); // Widgets.InfoCardButton(position.xMax - 16f, position.y, this.newWF); var rectsk = new Rect(rect27.x + rect27.width + 16, rect27.y, 50, 50); var recttx = new Rect(rectsk.x + 56, rectsk.y + 6, 160, 50); for (var i = 0; i < 4; i++) { var arect = new Rect(rectsk.x, rectsk.y + (i * 54f), 50, 50); Widgets.ButtonImage(arect, ContentFinder <Texture2D> .Get("Skills/" + nowWarframeKind.defName.Replace("Warframe_", "") + "Skill" + (i + 1))); var trect = new Rect(recttx.x, recttx.y + (i * 54f), 160, 50); Text.Font = GameFont.Medium; Widgets.Label(trect, (nowWarframeKind.defName.Replace("Warframe_", "") + "Skill" + (i + 1) + ".name").Translate()); Text.Font = GameFont.Small; TooltipHandler.TipRegion(arect, (nowWarframeKind.defName.Replace("Warframe_", "") + "Skill" + (i + 1) + ".desc").Translate()); } //title Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, inRect.width, 32f), "CraftWarframe".Translate()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; var rect10 = new Rect(0 + 120, inRect.height * 0.75f, 240f, 24f); if (Widgets.ButtonText(rect10, nowWarframeKind.label, true, false)) { FloatMenuUtility.MakeMenu(WarframeStaticMethods.GetAllWarframeKind(), Kind => Kind.label, Kind => delegate { nowWarframeKind = Kind; newWF = getNewWF(); RefreshCosts(); }); } Text.Anchor = TextAnchor.UpperLeft; //click craft //float num2 = rect27.x + rect27.width + 16f + (inRect.width - 1); var rect9 = new Rect((inRect.width / 2) - 60, inRect.height - 32, 120, 32); Text.Font = GameFont.Medium; // Text.Anchor = TextAnchor.LowerCenter; if (Widgets.ButtonText(rect9, "WarframeStartCraft".Translate(), true, false)) { WFCraft.nowCraftKind = nowWarframeKind; WFCraft.tryDropAllParts(); WFCraft.fuelCost = fuelCost; WFCraft.curState = Building_WarframeCrafter.CraftState.Filling; Close(); } var recttime = new Rect(rect9.x, rect9.y - 60, 30, 30); Widgets.ButtonImage(recttime, ContentFinder <Texture2D> .Get("UI/Icons/ColonistBar/Idle")); var recttimec = new Rect(recttime.x + 30, recttime.y, 30, 30); Text.Font = GameFont.Small; Widgets.Label(recttimec, timeCost + "DaysLower".Translate()); TooltipHandler.TipRegion(recttime, "Time Cost"); var rectcostbase = new Rect(recttimec.x + 30, recttime.y, 30, 30); for (var j = 0; j < 3; j++) { var rrrect = new Rect(rectcostbase.x + (j * 30), rectcostbase.y, 30, 30); var nowpart = ""; switch (j) { case 0: nowpart = "_Head"; break; case 1: nowpart = "_Body"; break; case 2: nowpart = "_Inside"; break; } var apartDef = ThingDef.Named("WFPart_" + nowWarframeKind.defName.Replace("Warframe_", "") + nowpart); Widgets.ButtonImage(rrrect, apartDef.uiIcon); TooltipHandler.TipRegion(rrrect, apartDef.label + "\n" + apartDef.description); } //orokin cell icon draw var fuelRect = new Rect(rectcostbase.x + (3 * 30), rectcostbase.y, 30, 30); var ocpartDef = ThingDef.Named("WFItem_OrokinCell"); Widgets.ButtonImage(fuelRect, ocpartDef.uiIcon); TooltipHandler.TipRegion(fuelRect, ocpartDef.label + "\n" + ocpartDef.description); Text.Font = GameFont.Small; var costRect = new Rect(fuelRect.x + 30, fuelRect.y, 30, 30); Widgets.Label(costRect, fuelCost + ""); TooltipHandler.TipRegion(costRect, ocpartDef.label + "\n" + ocpartDef.description); if (Widgets.CloseButtonFor(new Rect(inRect.width - 30, 0, 30, 30))) { Close(); } } Text.Anchor = TextAnchor.UpperLeft; }
private Pawn getNewWF() { return(WarframeStaticMethods.GetWarframePawn(nowWarframeKind)); }
public void RefreshCosts() { timeCost = 1; fuelCost = WarframeStaticMethods.GetCraftCost(nowWarframeKind); }
public override IEnumerable <Gizmo> GetWornGizmos() { if (Find.Selector.SingleSelectedThing != Wearer) { yield break; } var pawn = Wearer; if (pawn == null || !pawn.IsWarframe()) { yield break; } var ck1 = new Command_CastSkillTargetingFloor { self = Wearer, targetingParams = WarframeStaticMethods.JumpTP(), defaultLabel = "WarframeJumpGizmo.name".Translate(), defaultDesc = "WarframeJumpGizmo.desc".Translate(), range = 14f, icon = ContentFinder <Texture2D> .Get("Skills/Jump"), cooldownTime = 60, hotKey = KeyBindingDefOf.Command_ItemForbid, disabled = !Wearer.Drafted || jumpCD > 0 || Wearer.stances.stunner.Stunned }; ck1.action = delegate(Pawn self, LocalTargetInfo target) { if (WarframeStaticMethods.OutRange(ck1.range, self, target.Cell.ToVector3())) { SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } if (!target.Cell.Walkable(self.Map)) { Messages.Message("WFCantJumpToThere".Translate(), MessageTypeDefOf.RejectInput, false); return; } var jtype = WarframeStaticMethods.GetJumpType(self, target.Cell); if (jtype == 0) { var wfroof = self.Map.roofGrid.RoofAt(self.Position); if (wfroof != null) { if (wfroof != RoofDefOf.RoofConstructed) { Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false); return; } if (!wfroof.soundPunchThrough.NullOrUndefined()) { wfroof.soundPunchThrough.PlayOneShot(new TargetInfo(self.Position, self.Map)); var iterator = CellRect.CenteredOn(self.Position, 1).GetIterator(); while (!iterator.Done()) { Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null); iterator.MoveNext(); } } } var locroof = self.Map.roofGrid.RoofAt(target.Cell); if (locroof != null) { if (locroof != RoofDefOf.RoofConstructed) { Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false); return; } if (!locroof.soundPunchThrough.NullOrUndefined()) { locroof.soundPunchThrough.PlayOneShot(new TargetInfo(self.Position, self.Map)); var iterator = CellRect.CenteredOn(target.Cell, 1).GetIterator(); while (!iterator.Done()) { Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null); iterator.MoveNext(); } } } } self.pather.StartPath(target, PathEndMode.Touch); self.Position = target.Cell; self.pather.StopDead(); if (self.jobs.curJob != null) { self.jobs.curDriver.Notify_PatherArrived(); } SoundDef.Named("Warframe_Jump").PlayOneShot(self); jumpCD = ck1.cooldownTime; }; ck1.finishAction = delegate { GenDraw.DrawRadiusRing(ck1.self.Position, ck1.range); //DrawFieldEdges(WarframeStaticMethods.getCellsAround(ck1.self.Position, ck1.self.Map, ck1.range)); }; yield return(ck1); }