Example #1
0
        static void camouflageAndMorphActions()
        {
            float oldCamouflageTimer = Camouflager.camouflageTimer;
            float oldMorphTimer      = Morphling.morphTimer;

            Camouflager.camouflageTimer -= Time.deltaTime;
            Morphling.morphTimer        -= Time.deltaTime;

            // Everyone but morphling reset
            if (oldCamouflageTimer > 0f && Camouflager.camouflageTimer <= 0f)
            {
                Camouflager.resetCamouflage();
            }

            // Morphling reset
            if (oldMorphTimer > 0f && Morphling.morphTimer <= 0f)
            {
                Morphling.resetMorph();
            }
        }
        // Token: 0x060003A4 RID: 932 RVA: 0x0001C404 File Offset: 0x0001A604
        public UnitMonitor()
        {
            Dictionary <string, Action <Unit9, bool> > dictionary = new Dictionary <string, Action <Unit9, bool> >();

            dictionary.Add("modifier_teleporting", delegate(Unit9 x, bool value)
            {
                x.IsTeleporting = value;
            });
            dictionary.Add("modifier_treant_natures_guise_invis", delegate(Unit9 x, bool value)
            {
                x.CanUseAbilitiesInInvisibility = value;
            });
            dictionary.Add("modifier_riki_permanent_invisibility", delegate(Unit9 x, bool value)
            {
                x.CanUseAbilitiesInInvisibility = value;
            });
            dictionary.Add("modifier_ice_blast", delegate(Unit9 x, bool value)
            {
                x.CanBeHealed = !value;
            });
            dictionary.Add("modifier_item_aegis", delegate(Unit9 x, bool value)
            {
                x.HasAegis = value;
            });
            dictionary.Add("modifier_necrolyte_sadist_active", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_pugna_decrepify", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_item_ethereal_blade_ethereal", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_ghost_state", delegate(Unit9 x, bool value)
            {
                x.IsEthereal = value;
            });
            dictionary.Add("modifier_item_lotus_orb_active", delegate(Unit9 x, bool value)
            {
                x.IsLotusProtected = value;
            });
            dictionary.Add("modifier_antimage_counterspell", delegate(Unit9 x, bool value)
            {
                x.IsSpellShieldProtected = value;
            });
            dictionary.Add("modifier_item_sphere_target", delegate(Unit9 x, bool value)
            {
                x.IsLinkensTargetProtected = value;
            });
            dictionary.Add("modifier_item_blade_mail_reflect", delegate(Unit9 x, bool value)
            {
                x.IsReflectingDamage = value;
            });
            dictionary.Add("modifier_item_ultimate_scepter", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_item_ultimate_scepter_consumed", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_wisp_tether_scepter", delegate(Unit9 x, bool value)
            {
                x.HasAghanimsScepter = value;
            });
            dictionary.Add("modifier_slark_dark_pact", delegate(Unit9 x, bool value)
            {
                x.IsDarkPactProtected = value;
            });
            dictionary.Add("modifier_bloodseeker_rupture", delegate(Unit9 x, bool value)
            {
                x.IsRuptured = value;
            });
            dictionary.Add("modifier_spirit_breaker_charge_of_darkness", delegate(Unit9 x, bool value)
            {
                x.IsCharging = value;
            });
            dictionary.Add("modifier_dragon_knight_dragon_form", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_terrorblade_metamorphosis", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_troll_warlord_berserkers_rage", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (!value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_lone_druid_true_form", delegate(Unit9 x, bool value)
            {
                x.IsRanged = (!value || x.BaseUnit.IsRanged);
            });
            dictionary.Add("modifier_slark_shadow_dance_visual", delegate(Unit9 x, bool value)
            {
                Slark slark = x.Owner as Slark;
                if (slark == null)
                {
                    return;
                }
                slark.ShadowDanced(value);
            });
            dictionary.Add("modifier_morphling_replicate", delegate(Unit9 x, bool value)
            {
                Morphling morphling = x as Morphling;
                if (morphling == null)
                {
                    return;
                }
                morphling.Morphed(value);
            });
            dictionary.Add("modifier_morphling_replicate_manager", delegate(Unit9 x, bool value)
            {
                Morphling morphling = x as Morphling;
                if (morphling == null)
                {
                    return;
                }
                morphling.Replicated(value);
            });
            dictionary.Add("modifier_alchemist_chemical_rage", delegate(Unit9 x, bool value)
            {
                Alchemist alchemist = x as Alchemist;
                if (alchemist == null)
                {
                    return;
                }
                alchemist.Raged(value);
            });
            this.specialModifiers = dictionary;
            base..ctor();
            this.damageFactory            = new DamageFactory();
            this.rangeFactory             = new RangeFactory();
            Entity.OnInt64PropertyChange += this.OnInt64PropertyChange;
            Entity.OnInt32PropertyChange += this.OnInt32PropertyChange;
            Entity.OnAnimationChanged    += this.OnAnimationChanged;
            Unit.OnModifierAdded         += this.OnModifierAdded;
            Unit.OnModifierRemoved       += this.OnModifierRemoved;
            Player.OnExecuteOrder        += this.OnExecuteOrder;
            Drawing.OnDraw += UnitMonitor.OnUpdate;
        }
 // Token: 0x060004CD RID: 1229 RVA: 0x00019434 File Offset: 0x00017634
 protected override void OnAbilityAdded(Ability9 entity)
 {
     try
     {
         ActiveAbility activeAbility;
         if (entity.IsControllable && entity.Owner.CanUseAbilities && entity.Owner.IsAlly(this.owner) && (activeAbility = (entity as ActiveAbility)) != null)
         {
             Unit9     abilityOwner = entity.Owner;
             Morphling morphling    = entity.Owner as Morphling;
             if (morphling != null && morphling.IsMorphed)
             {
                 ControllableUnit controllableUnit;
                 Type             type;
                 if (this.unitTypes.TryGetValue(morphling.MorphedHero.Name, out type))
                 {
                     controllableUnit = this.controllableUnits.Find((ControllableUnit x) => x.Handle == abilityOwner.Handle && x.GetType() == type);
                     if (controllableUnit == null)
                     {
                         controllableUnit = (ControllableUnit)Activator.CreateInstance(type, new object[]
                         {
                             abilityOwner,
                             this.abilitySleeper,
                             this.orbwalkSleeper[abilityOwner.Handle],
                             base.GetUnitMenu(abilityOwner)
                         });
                         controllableUnit.FailSafe        = base.BaseHero.FailSafe;
                         controllableUnit.MorphedUnitName = morphling.MorphedHero.Name;
                         foreach (ActiveAbility ability in (from x in abilityOwner.Abilities
                                                            where x.IsItem
                                                            select x).OfType <ActiveAbility>())
                         {
                             controllableUnit.AddAbility(ability, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                         }
                         this.controllableUnits.Add(controllableUnit);
                     }
                 }
                 else
                 {
                     controllableUnit = this.controllableUnits.Find((ControllableUnit x) => x.Handle == abilityOwner.Handle && x is DynamicUnit);
                     if (controllableUnit == null)
                     {
                         controllableUnit = new DynamicUnit(abilityOwner, this.abilitySleeper, this.orbwalkSleeper[abilityOwner.Handle], base.GetUnitMenu(abilityOwner), base.BaseHero)
                         {
                             FailSafe        = base.BaseHero.FailSafe,
                             MorphedUnitName = morphling.MorphedHero.Name
                         };
                         foreach (ActiveAbility ability2 in (from x in abilityOwner.Abilities
                                                             where x.IsItem
                                                             select x).OfType <ActiveAbility>())
                         {
                             controllableUnit.AddAbility(ability2, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                         }
                         this.controllableUnits.Add(controllableUnit);
                     }
                 }
                 if (activeAbility.IsItem)
                 {
                     IEnumerable <ControllableUnit> controllableUnits = this.controllableUnits;
                     Func <ControllableUnit, bool>  predicate;
                     Func <ControllableUnit, bool> < > 9__4;
                     if ((predicate = < > 9__4) == null)
                     {
                         predicate = (< > 9__4 = ((ControllableUnit x) => x.Handle == abilityOwner.Handle));
                     }
                     using (IEnumerator <ControllableUnit> enumerator2 = controllableUnits.Where(predicate).GetEnumerator())
                     {
                         while (enumerator2.MoveNext())
                         {
                             ControllableUnit controllableUnit2 = enumerator2.Current;
                             controllableUnit2.AddAbility(activeAbility, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                         }
                         goto IL_3D3;
                     }
                 }
                 controllableUnit.AddAbility(activeAbility, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                 IL_3D3 :;
             }
             else
             {
                 if (activeAbility.IsItem)
                 {
                     IEnumerable <ControllableUnit> controllableUnits2 = this.controllableUnits;
                     Func <ControllableUnit, bool>  predicate2;
                     Func <ControllableUnit, bool> < > 9__5;
                     if ((predicate2 = < > 9__5) == null)
                     {
                         predicate2 = (< > 9__5 = ((ControllableUnit x) => x.Handle == abilityOwner.Handle));
                     }
                     using (IEnumerator <ControllableUnit> enumerator2 = controllableUnits2.Where(predicate2).GetEnumerator())
                     {
                         while (enumerator2.MoveNext())
                         {
                             ControllableUnit controllableUnit3 = enumerator2.Current;
                             controllableUnit3.AddAbility(activeAbility, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                         }
                         goto IL_488;
                     }
                 }
                 ControllableUnit controllableUnit4 = this.controllableUnits.Find((ControllableUnit x) => x.Handle == entity.Owner.Handle);
                 if (controllableUnit4 != null)
                 {
                     controllableUnit4.AddAbility(activeAbility, base.BaseHero.ComboMenus, base.BaseHero.MoveComboModeMenu);
                 }
                 IL_488 :;
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Example #4
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Generate and initialize player icons
            if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
            {
                Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                {
                    GameData.PlayerInfo data   = p.Data;
                    PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                    player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
                    player.SetFlipX(true);
                    player.PetSlot.gameObject.SetActive(false);
                    player.NameText.text = p.Data.DefaultOutfit.PlayerName;
                    MapOptions.playerIcons[p.PlayerId] = player;

                    if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
                    {
                        player.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0);
                        player.transform.localScale    = Vector3.one * 0.4f;
                        player.gameObject.SetActive(false);
                    }
                    else if (PlayerControl.LocalPlayer == GM.gm)
                    {
                        player.transform.localPosition = Vector3.zero;
                        player.transform.localScale    = Vector3.one * 0.3f;
                        player.setSemiTransparent(false);
                        player.gameObject.SetActive(false);
                    }
                    else
                    {
                        player.gameObject.SetActive(false);
                    }
                }
            }

            // Force Bounty Hunter to load a new Bounty when the Intro is over
            if (BountyHunter.bounty != null && PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
            {
                BountyHunter.bountyUpdateTimer = 0f;
                if (HudManager.Instance != null)
                {
                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z) + new Vector3(-0.25f, 1f, 0);
                    BountyHunter.cooldownText           = UnityEngine.Object.Instantiate <TMPro.TextMeshPro>(HudManager.Instance.KillButton.cooldownTimerText, HudManager.Instance.transform);
                    BountyHunter.cooldownText.alignment = TMPro.TextAlignmentOptions.Center;
                    BountyHunter.cooldownText.transform.localPosition = bottomLeft + new Vector3(0f, -1f, -1f);
                    BountyHunter.cooldownText.gameObject.SetActive(true);
                }
            }

            Arsonist.updateIcons();
            Morphling.resetMorph();
            Camouflager.resetCamouflage();

            if (PlayerControl.LocalPlayer == GM.gm && !GM.hasTasks)
            {
                PlayerControl.LocalPlayer.clearAllTasks();
            }

            if (PlayerControl.LocalPlayer.isGM())
            {
                HudManager.Instance.ShadowQuad.gameObject.SetActive(false);
                HudManager.Instance.ReportButton.gameObject.SetActiveRecursively(false);
                HudManager.Instance.ReportButton.SetActive(false);
                HudManager.Instance.ReportButton.graphic.enabled         = false;
                HudManager.Instance.ReportButton.enabled                 = false;
                HudManager.Instance.ReportButton.graphic.sprite          = null;
                HudManager.Instance.ReportButton.buttonLabelText.enabled = false;
                HudManager.Instance.ReportButton.buttonLabelText.SetText("");

                HudManager.Instance.roomTracker.gameObject.SetActiveRecursively(false);
                HudManager.Instance.roomTracker.text.enabled = false;
                HudManager.Instance.roomTracker.text.SetText("");
                HudManager.Instance.roomTracker.enabled = false;
            }

            // ベントを追加する
            AdditionalVents.AddAdditionalVents();

            // スペシメンにバイタルを移動する
            SpecimenVital.moveVital();

            //タスクバグ修正
            if (PlayerControl.GameOptions.MapId == 4 && CustomOptionHolder.airshipEnableWallCheck.getBool())
            {
                var objects = UnityEngine.GameObject.FindObjectsOfType <Console>().ToList();
                objects.Find(x => x.name == "task_garbage1").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage2").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage3").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage4").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage5").checkWalls      = true;
                objects.Find(x => x.name == "task_shower").checkWalls        = true;
                objects.Find(x => x.name == "task_developphotos").checkWalls = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.Armory).checkWalls   = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.MainHall).checkWalls = true;
            }

            // 最初から一人の場合はLast Impostorになる
            if (AmongUsClient.Instance.AmHost)
            {
                LastImpostor.promoteToLastImpostor();
            }

            // タスクパネルの表示優先度を上げる
            var taskPanel = DestroyableSingleton <HudManager> ._instance.TaskStuff;
            var pos       = taskPanel.transform.position;

            taskPanel.transform.position = new Vector3(pos.x, pos.y, -20);

            // ダミー人形をスポーンさせておく
            if (PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer) && SubmergedCompatibility.isSubmerged())
            {
                var           playerId = (byte)GameData.Instance.GetAvailableId();
                MessageWriter writer   = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpawnDummy, Hazel.SendOption.Reliable, -1);
                writer.Write(playerId);
                writer.Write(PlayerControl.LocalPlayer.transform.position.x);
                writer.Write(PlayerControl.LocalPlayer.transform.position.y);
                writer.Write(PlayerControl.LocalPlayer.transform.position.z);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.spawnDummy(playerId, PlayerControl.LocalPlayer.transform.position);
            }
        }