コード例 #1
0
ファイル: Summons.cs プロジェクト: cabarius/ToyBox
            private static void Postfix(ref UnitEntityData unit)
            {
                //if (settings.toggleSetSpeedOnSummon) {
                //    unit.Descriptor.Stats.GetStat(StatType.Speed).BaseValue = settings.setSpeedOnSummonValue;
                //}

                if (settings.toggleMakeSummmonsControllable && SummonedByPlayerFaction)
                {
                    // Main.Log($"SummonPool.Register: Unit [{unit.CharacterName}] [{unit.UniqueId}]");
                    UnitEntityDataUtils.Charm(unit);
                    //unit.Ensure<UnitPartFollowUnit>().Init(Game.Instance.Player.MainCharacter.Value, true, false);
#if false
                    if (unit.Blueprint.AssetGuid == "6fdf7a3f850a1eb48bfbf44d9d0f45dd" && StringUtils.ToToggleBool(settings.toggleDisableWarpaintedSkullAbilityForSummonedBarbarians)) // WarpaintedSkullSummonedBarbarians
                    {
                        if (unit.Body.Head.HasItem && unit.Body.Head.Item?.Blueprint?.AssetGuid == "5d343648bb8887d42b24cbadfeb36991")                                                 // WarpaintedSkullItem
                        {
                            unit.Body.Head.Item.Ability.Deactivate();
                            Common.ModLoggerDebug(unit.Body.Head.Item.Name + "'s ability active: " + unit.Body.Head.Item.Ability.Active);
                        }
                    }
#endif
                    SummonedByPlayerFaction = false;
                }

#if false
                if (StringUtils.ToToggleBool(settings.toggleRemoveSummonsGlow))
                {
                    unit.Buffs.RemoveFact(Utilities.GetBlueprintByGuid <BlueprintFact>("706c182e86d9be848b59ddccca73d13e")); // SummonedCreatureVisual
                    unit.Buffs.RemoveFact(Utilities.GetBlueprintByGuid <BlueprintFact>("e4b996b5168fe284ab3141a91895d7ea")); // NaturalAllyCreatureVisual
                }
#endif
            }
コード例 #2
0
        public static void Functions(int index)
        {
            switch (index)
            {
            case 0:
                break;

            case 1:
                GameInfo();
                break;

            case 2:
                KillFunctions();
                break;

            case 3:
                UnitEntityDataUtils.ResurrectAndFullRestore(Common.GetUnitUnderMouse());
                break;

            case 4:
                UnitEntityDataUtils.Buff(Common.GetUnitUnderMouse(), FavouritesFactory.GetFavouriteBuffs.FavouritesList[Main.settings.actionKeyBuffIndex]);
                break;

            case 5:
                editUnit = Common.GetUnitUnderMouse();
                break;

            case 6:
                teleportUnit = Common.GetUnitUnderMouse();
                if (teleportUnit != null && StringUtils.ToToggleBool(Main.settings.toggleAddToLog))
                {
                    Common.AddLogEntry(Strings.GetText("label_TeleportUnit") + $": {teleportUnit.CharacterName}", Color.black);
                }
                break;

            case 7:
                if (StringUtils.ToToggleBool(settings.toggleSpawnEnemiesFromUnitFavourites))
                {
                    try {
                        Vector3 pos = Common.MousePositionLocalMap();
                        float   x   = 0.0f;
                        float   z   = 0.0f;
                        foreach (string guid in SpawnUnits.GetStoredGUIDs)
                        {
                            Vector3 finalPos = new Vector3(pos.x + 1.5f * x, pos.y, pos.z + 1.5f * z);
                            SpawnUnits.UnitSpawner(finalPos, guid);
                            x++;
                            if (x > 10f)
                            {
                                x = 0.0f;
                                z++;
                            }
                        }
                    }
                    catch (Exception e) {
                        modLogger.Log(e.ToString());
                    }
                }
                else if (settings.actionKeySpawnRandomEnemy && StringUtils.ToToggleBool(settings.toggleActionKeyExperimental))
                {
                    try {
                        Common.SpawnHostileUnit(Common.MousePositionLocalMap(), ResourcesLibrary.GetBlueprints <BlueprintUnit>().RandomElement());
                    }
                    catch (Exception e) {
                        modLogger.Log(e.ToString());
                    }
                }
                else
                {
                    Common.SpawnHostileUnit(Common.MousePositionLocalMap(), banditsGuids[banidtCrIndex]);
                }
                break;

            case 8:
                rotateUnit = Common.GetUnitUnderMouse();
                if (rotateUnit != null && StringUtils.ToToggleBool(Main.settings.toggleAddToLog))
                {
                    Common.AddLogEntry(Strings.GetText("arrayItem_ActionKeyMain_RotateUnit") + $": {rotateUnit.CharacterName}", Color.black);
                }
                break;

            case 9:
                Common.GetUnitUnderMouse().View.AnimationManager.Execute(animationTypes[animationTypesIndex]);
                break;

            case 10:
                FxHelper.SpawnFxOnPoint(BlueprintRoot.Instance.Cheats.SillyCheatBlood, Common.MousePositionLocalMap());
                break;

            case 11:
                UnitEntityDataUtils.Charm(Common.GetUnitUnderMouse());
                break;

            case 12:
                UnitEntityDataUtils.AddToParty(Common.GetUnitUnderMouse());
                break;

            case 13:
                Common.GetUnitUnderMouse().Descriptor.Recreate = true;
                break;
            }
        }