Exemplo n.º 1
0
        // Token: 0x0600008D RID: 141 RVA: 0x00004E7C File Offset: 0x0000307C
        private static void DoAreaSelector(Rect rect, Building_Bell b, Area area, Func <Area, string> getLabel)
        {
            rect = GenUI.ContractedBy(rect, 1f);
            GUI.DrawTexture(rect, (area == null) ? BaseContent.GreyTex : area.ColorTexture);
            Text.Anchor = TextAnchor.MiddleLeft;
            string text  = getLabel(area);
            Rect   rect2 = rect;

            rect2.xMin += 3f;
            rect2.yMin += 2f;
            Widgets.Label(rect2, text);
            bool flag = b.FightingArea == area;

            if (flag)
            {
                Widgets.DrawBox(rect, 2);
            }
            bool flag2 = Mouse.IsOver(rect);

            if (flag2)
            {
                if (area != null)
                {
                    area.MarkForDraw();
                }
                bool flag3 = Input.GetMouseButton(0) && b.FightingArea != area;
                if (flag3)
                {
                    b.FightingArea = area;
                    SoundDefOf.Designate_DragStandard_Changed.PlayOneShotOnCamera(null);
                }
            }
            Text.Anchor = 0;
            TooltipHandler.TipRegion(rect, text);
        }
Exemplo n.º 2
0
        // Token: 0x0600008B RID: 139 RVA: 0x00004D34 File Offset: 0x00002F34
        public void DoAllowedAreaSelectors(Rect rect, Building_Bell b, Func <Area, string> getLabel)
        {
            bool flag = Find.CurrentMap == null;

            if (!flag)
            {
                Area[] areas = ITab_BellManager.GetAreas().ToArray <Area>();
                int    num   = areas.Length + 1;
                float  num2  = rect.width / (float)num;
                Text.WordWrap = false;
                Text.Font     = GameFont.Tiny;
                Rect rect2 = new Rect(rect.x, rect.y, num2, rect.height);
                ITab_BellManager.DoAreaSelector(rect2, b, null, getLabel);
                int num3 = 1;
                foreach (Area a in areas)
                {
                    bool flag2 = a == this.SelectBell.Map.areaManager.Home;
                    if (!flag2)
                    {
                        float num4  = (float)num3 * num2;
                        Rect  rect3 = new Rect(rect.x + num4, rect.y, num2, rect.height);
                        ITab_BellManager.DoAreaSelector(rect3, b, a, getLabel);
                        num3++;
                    }
                }
                Text.WordWrap = true;
                Text.Font     = GameFont.Small;
            }
        }
Exemplo n.º 3
0
        // Token: 0x06000073 RID: 115 RVA: 0x00004124 File Offset: 0x00002324
        public static string FighterLabel(int index, Building_Bell bell)
        {
            bool   flag = bell.fighter1.p == null;
            string result;

            if (flag)
            {
                result = "Select";
            }
            else
            {
                bool flag2 = index == 0;
                if (flag2)
                {
                    result = bell.fighter1.p.Name.ToStringShort;
                }
                else
                {
                    bool flag3 = index == 1;
                    if (flag3)
                    {
                        result = bell.fighter2.p.Name.ToStringShort;
                    }
                    else
                    {
                        result = "error";
                    }
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        // Token: 0x06000070 RID: 112 RVA: 0x00003F88 File Offset: 0x00002188
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_Bell building = t as Building_Bell;
            bool          flag     = t.Faction != pawn.Faction;
            bool          result;

            if (flag)
            {
                result = false;
            }
            else
            {
                bool flag2 = building == null;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = building.IsForbidden(pawn);
                    if (flag3)
                    {
                        result = false;
                    }
                    else
                    {
                        bool flag4 = building.currentState == Building_Bell.State.rest;
                        if (flag4)
                        {
                            result = false;
                        }
                        else
                        {
                            bool flag5 = building.currentState != Building_Bell.State.scheduled;
                            if (flag5)
                            {
                                bool flag6 = building.fighter1.isInFight && building.fighter1.isInFight;
                                if (flag6)
                                {
                                    return(false);
                                }
                            }
                            LocalTargetInfo target = building;
                            bool            flag7  = !pawn.CanReserve(building.fighter1.p, 1, -1, null, forced);
                            if (flag7)
                            {
                                result = false;
                            }
                            else
                            {
                                bool flag8 = !pawn.CanReserve(building.fighter2.p, 1, -1, null, forced);
                                result = !flag8;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        // Token: 0x06000074 RID: 116 RVA: 0x00004198 File Offset: 0x00002398
        public static void OpenActor1SelectMenu(Building_Bell bell)
        {
            List <Pawn>   actorList = new List <Pawn>();
            StringBuilder s         = new StringBuilder();

            if (bell.Map.mapPawns.PrisonersOfColonySpawned == null || bell.Map.mapPawns.PrisonersOfColonySpawnedCount <= 0)
            {
                Messages.Message("No prisoners available.", MessageTypeDefOf.RejectInput, true);
            }
            else
            {
                foreach (Pawn candidate in bell.Map.mapPawns.PrisonersOfColonySpawned)
                {
                    actorList.Add(candidate);
                }

                foreach (Pawn candidate in bell.Map.mapPawns.AllPawns)
                {
                    if (candidate.Faction != null && candidate.Faction.IsPlayer && candidate.RaceProps.Animal)
                    {
                        actorList.Add(candidate);
                    }
                }

                if (actorList != null)
                {
                    if (actorList.Count <= 0)
                    {
                        Messages.Message("No prisoners available.", MessageTypeDefOf.RejectInput, true);
                        return;
                    }
                }
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (Pawn actor in actorList)
                {
                    Pawn   localCol = actor;
                    Action action   = delegate()
                    {
                        if (localCol.health.capacities.CapableOf(PawnCapacityDefOf.Moving))
                        {
                            bell.fighter1.p = localCol;
                        }
                        else
                        {
                            Messages.Message(localCol.Name.ToStringShort + " can't move and won't be a good fighter.", MessageTypeDefOf.RejectInput, true);
                        }
                    };
                    list.Add(new FloatMenuOption(localCol.LabelShort, action, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
        }
Exemplo n.º 6
0
        public static void OpenFightTypeMenu(Building_Bell bell)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();
            Action deathAction          = delegate()
            {
                bell.toDeath = true;
            };
            Action downedAction = delegate()
            {
                bell.toDeath = false;
            };

            list.Add(new FloatMenuOption("No killing!", downedAction));
            list.Add(new FloatMenuOption("To the Death!", deathAction));
            Find.WindowStack.Add(new FloatMenu(list));
        }
Exemplo n.º 7
0
        public static void OpenRewardTypeMenu(Building_Bell bell)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();
            Action gloryAction          = delegate()
            {
                bell.winnerGetsFreedom = false;
            };
            Action freedomAction = delegate()
            {
                bell.winnerGetsFreedom = true;
            };

            list.Add(new FloatMenuOption("For Glory!", gloryAction));
            list.Add(new FloatMenuOption("For Freedom!", freedomAction));
            Find.WindowStack.Add(new FloatMenu(list));
        }
Exemplo n.º 8
0
        public static void OpenFightTypeMenu(Building_Bell bell)
        {
            var list = new List <FloatMenuOption>();

            void DeathAction()
            {
                bell.toDeath = true;
            }

            void DownedAction()
            {
                bell.toDeath = false;
            }

            list.Add(new FloatMenuOption("No killing!", DownedAction));
            list.Add(new FloatMenuOption("To the Death!", DeathAction));
            Find.WindowStack.Add(new FloatMenu(list));
        }
Exemplo n.º 9
0
        public static void OpenRewardTypeMenu(Building_Bell bell)
        {
            var list = new List <FloatMenuOption>();

            void GloryAction()
            {
                bell.winnerGetsFreedom = false;
            }

            void FreedomAction()
            {
                bell.winnerGetsFreedom = true;
            }

            list.Add(new FloatMenuOption("For Glory!", GloryAction));
            list.Add(new FloatMenuOption("For Freedom!", FreedomAction));
            Find.WindowStack.Add(new FloatMenu(list));
        }
Exemplo n.º 10
0
        // Token: 0x06000071 RID: 113 RVA: 0x00004090 File Offset: 0x00002290
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_Bell building = t as Building_Bell;
            bool          flag     = building.currentState != Building_Bell.State.scheduled;

            if (flag)
            {
                bool flag2 = building.fighter1.isInFight && building.fighter1.isInFight;
                if (flag2)
                {
                    return(null);
                }
            }
            Building_Bell bell = t as Building_Bell;

            return(new Job(JobDefOfArena.HaulingPrisoner, bell.getPrisonerForHaul(), bell, bell.getFighterStandPoint())
            {
                count = 1
            });
        }
Exemplo n.º 11
0
        // Token: 0x06000073 RID: 115 RVA: 0x00004124 File Offset: 0x00002324
        public static string FighterLabel(int index, Building_Bell bell)
        {
            var    flag = bell.fighter1.p == null;
            string result;

            if (flag)
            {
                result = "Select";
            }
            else
            {
                var flag2 = index == 0;
                if (flag2)
                {
                    result = bell.fighter1.p.Name.ToStringShort;
                    if (bell.fighter1.p.AnimalOrWildMan())
                    {
                        result += $" ({bell.fighter1.p.def.race.AnyPawnKind.label})";
                    }
                }
                else
                {
                    var flag3 = index == 1;
                    if (flag3)
                    {
                        result = bell.fighter2.p.Name.ToStringShort;
                        if (bell.fighter2.p.AnimalOrWildMan())
                        {
                            result += $" ({bell.fighter2.p.def.race.AnyPawnKind.label})";
                        }
                    }
                    else
                    {
                        result = "error";
                    }
                }
            }

            return(result);
        }
Exemplo n.º 12
0
        // Token: 0x0600007C RID: 124 RVA: 0x000045D4 File Offset: 0x000027D4
        private static string FighterLabel(Building_Bell bell, int index)
        {
            bool flag = index == 0;

            if (flag)
            {
                bool flag2 = bell.fighter1.p != null;
                if (flag2)
                {
                    return(bell.fighter1.p.Name.ToStringShort);
                }
            }
            bool flag3 = index == 1;

            if (flag3)
            {
                bool flag4 = bell.fighter2.p != null;
                if (flag4)
                {
                    return(bell.fighter2.p.Name.ToStringShort);
                }
            }
            return("Select");
        }
Exemplo n.º 13
0
        // Token: 0x06000031 RID: 49 RVA: 0x00002C44 File Offset: 0x00000E44
        protected override Job TryGiveJob(Pawn pawn)
        {
            MentalState_Fighter state = (MentalState_Fighter)pawn.MentalState;
            Pawn          pawnTarget  = state.otherPawn;
            Building_Bell bellRef     = state.bellRef;
            Job           result;
            Fighter       fighterTarget = bellRef.getFighter(pawnTarget);

            if (!fighterTarget.isInFight || (double)Rand.Value < 0.5)
            {
                result = new Job(JobDefOf.Wait_Combat)
                {
                    expiryInterval = 10
                };
            }
            else
            {
                if (pawn.TryGetAttackVerb(null, false) == null)
                {
                    result = null;
                }
                else
                {
                    ThingWithComps primary = pawn.equipment != null ? pawn.equipment.Primary : null;
                    if (bellRef.currentState == Building_Bell.State.fight && pawn.equipment != null && primary == null)
                    {
                        List <Thing> suitableWeapons = new List <Thing>();
                        foreach (IntVec3 c in bellRef.GetComp <CompBell>().ValidCells)
                        {
                            List <Thing> thingList = c.GetThingList(bellRef.Map);
                            for (int i = 0; i < thingList.Count; i++)
                            {
                                Thing t     = thingList[i];
                                bool  flag8 = t.def.IsWeapon && !suitableWeapons.Contains(t) && t.Spawned && pawn.CanReserve(t, 1, -1, null, false);
                                if (flag8)
                                {
                                    suitableWeapons.Add(t);
                                }
                            }
                        }
                        Thing weapon      = null;
                        int   maxDistance = 9999;
                        foreach (Thing t2 in suitableWeapons)
                        {
                            if ((t2.Position - pawn.Position).LengthManhattan < maxDistance)
                            {
                                weapon      = t2;
                                maxDistance = (t2.Position - pawn.Position).LengthManhattan;
                            }
                        }
                        if (weapon != null)
                        {
                            return(new Job(JobDefOf.Equip, weapon));
                        }
                    }
                    if (pawnTarget == null || !pawn.CanReach(pawnTarget, PathEndMode.ClosestTouch, Danger.Deadly, false, TraverseMode.ByPawn))
                    {
                        result = new Job(JobDefOf.Wait);
                    }
                    else
                    {
                        pawn.mindState.enemyTarget = pawnTarget;
                        pawn.mindState.enemyTarget = pawnTarget;
                        this.UpdateEnemyTarget(pawn);
                        Thing enemyTarget = pawn.mindState.enemyTarget;

                        if (enemyTarget == null)
                        {
                            result = null;
                        }
                        else
                        {
                            bool allowManualCastWeapons = !pawn.IsColonist;
                            Verb verb = pawn.TryGetAttackVerb(enemyTarget, allowManualCastWeapons);
                            if (verb == null)
                            {
                                result = null;
                            }
                            else
                            {
                                bool isMeleeAttack = verb.verbProps.IsMeleeAttack;
                                if (isMeleeAttack || pawnTarget.Downed)
                                {
                                    result = this.MeleeAttackJob(enemyTarget);
                                    result.killIncappedTarget = bellRef.toDeath;
                                }
                                else
                                {
                                    if ((
                                            CoverUtility.CalculateOverallBlockChance(pawn, enemyTarget.Position, pawn.Map) > 0.01f &&
                                            pawn.Position.Standable(pawn.Map) &&
                                            verb.CanHitTarget(enemyTarget)
                                            ) || (
                                            (pawn.Position - enemyTarget.Position).LengthHorizontalSquared < 25 &&
                                            verb.CanHitTarget(enemyTarget)
                                            ))
                                    {
                                        result = new Job(JobDefOf.AttackStatic, pawnTarget)
                                        {
                                            maxNumMeleeAttacks = 1,
                                            expiryInterval     = Rand.Range(420, 900),
                                            canBash            = true
                                        };
                                    }
                                    else
                                    {
                                        IntVec3 intVec;
                                        if (!this.TryFindShootingPosition(pawn, out intVec))
                                        {
                                            result = null;
                                        }
                                        else
                                        {
                                            if (intVec == pawn.Position)
                                            {
                                                result = new Job(JobDefOf.AttackStatic, pawnTarget)
                                                {
                                                    maxNumMeleeAttacks = 1,
                                                    expiryInterval     = Rand.Range(420, 900),
                                                    canBash            = true
                                                };
                                            }
                                            else
                                            {
                                                result = new Job(JobDefOf.Goto, intVec)
                                                {
                                                    expiryInterval        = JobGiver_AIFightEnemy.ExpiryInterval_ShooterSucceeded.RandomInRange,
                                                    checkOverrideOnExpire = true
                                                };
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 14
0
 // Token: 0x06000078 RID: 120 RVA: 0x00003A42 File Offset: 0x00001C42
 public static void DrawArenaTab(Rect rect, Building_Bell bell)
 {
 }
Exemplo n.º 15
0
 // Token: 0x06000040 RID: 64 RVA: 0x0000335E File Offset: 0x0000155E
 public LordJob_Joinable_FightingMatch(IntVec3 spot, Building_Bell bell)
 {
     this.spot = spot;
     this.bell = bell;
 }
Exemplo n.º 16
0
        // Token: 0x06000074 RID: 116 RVA: 0x00004198 File Offset: 0x00002398
        public static void OpenActor1SelectMenu(Building_Bell bell)
        {
            var actorList = new List <Pawn>();

            if (bell.Map.mapPawns.PrisonersOfColonySpawned == null ||
                bell.Map.mapPawns.PrisonersOfColonySpawnedCount <= 0)
            {
                Messages.Message("No prisoners available.", MessageTypeDefOf.RejectInput);
            }
            else
            {
                foreach (var candidate in bell.Map.mapPawns.PrisonersOfColonySpawned)
                {
                    actorList.Add(candidate);
                }

                foreach (var candidate in bell.Map.mapPawns.AllPawns)
                {
                    if (candidate.Faction != null && candidate.Faction.IsPlayer && candidate.RaceProps.Animal)
                    {
                        actorList.Add(candidate);
                    }
                }

                if (actorList.Count <= 0)
                {
                    Messages.Message("No prisoners available.", MessageTypeDefOf.RejectInput);
                    return;
                }

                var list = new List <FloatMenuOption>();
                foreach (var actor in actorList)
                {
                    var localCol = actor;

                    void Action()
                    {
                        if (localCol.health.capacities.CapableOf(PawnCapacityDefOf.Moving))
                        {
                            bell.fighter1.p = localCol;
                        }
                        else
                        {
                            Messages.Message(localCol.Name.ToStringShort + " can't move and won't be a good fighter.",
                                             MessageTypeDefOf.RejectInput);
                        }
                    }

                    var label = localCol.LabelShort;

                    if (localCol.AnimalOrWildMan())
                    {
                        label += $" ({localCol.def.race.AnyPawnKind.label})";
                    }

                    list.Add(new FloatMenuOption(label, Action));
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }
        }
Exemplo n.º 17
0
 // Token: 0x06000039 RID: 57 RVA: 0x00003255 File Offset: 0x00001455
 public LordToil_FightingMatch(IntVec3 spot, Building_Bell _bell)
 {
     this.spot    = spot;
     this.bellRef = _bell;
 }