コード例 #1
0
        internal override void Internal_ApplyTemplate(StatusEffect status)
        {
            base.Internal_ApplyTemplate(status);

            var comp = status as Disease;

            if (this.AutoHealTime != null)
            {
                At.SetField(comp, "m_autoHealTime", (int)this.AutoHealTime);
            }

            if (this.CanDegenerate != null)
            {
                At.SetField(comp, "m_canDegenerate", (bool)this.CanDegenerate);
            }

            if (this.DegenerateTime != null)
            {
                At.SetField(comp, "m_degenerateTime", (float)this.DegenerateTime);
            }

            if (this.DiseaseType != null)
            {
                At.SetField(comp, "m_diseasesType", (Diseases)this.DiseaseType);
            }

            if (this.SleepHealTime != null)
            {
                At.SetField(comp, "m_straightSleepHealTime", (float)this.SleepHealTime);
            }
        }
コード例 #2
0
        internal void Update() // limited to 2s update since its low priority
        {
            if (OwnerCharacter != null && Time.time - lastUpdateTime > 2f)
            {
                lastUpdateTime = Time.time;

                if (Value != OwnerCharacter.Stats.ManaPoint * NecromancerMod.settings.Transcendence_DamageBonus)
                {
                    Value = OwnerCharacter.Stats.ManaPoint * NecromancerMod.settings.Transcendence_DamageBonus;

                    if (IsRegistered)
                    {
                        OwnerCharacter.Stats.RemoveStatStack(this.AffectedStat, this.SourceID, this.IsModifier);

                        var m_statStack = OwnerCharacter.Stats.AddStatStack(
                            this.AffectedStat,
                            new StatStack(
                                this.m_sourceID,
                                this.Lifespan,
                                this.Value * ((!this.IsModifier) ? 1f : 0.01f),
                                null),
                            this.IsModifier
                            );

                        At.SetField(this as AffectStat, "m_statStack", m_statStack);
                    }
                }
            }
        }
コード例 #3
0
        public static void Prefix(Building __instance)
        {
            if (!StoreManager.Instance.IsDlcInstalled(OTWStoreAPI.DLCs.DLC2) ||
                !BuildingHelperMod.Instance.settings.AutoFinishBuildings ||
                PhotonNetwork.isNonMasterClientInRoom)
            {
                return;
            }

            int sanity = 5;

            while (sanity >= 0 && __instance.CurrentPhase.ConstructionType == Building.ConstructionPhase.Type.WIP)
            {
                int cur = (int)At.GetField(__instance, "m_currentBasicPhaseIndex");
                if (cur < 0)
                {
                    cur = 0;
                }
                else
                {
                    cur++;
                }
                At.SetField(__instance, "m_currentBasicPhaseIndex", cur);

                sanity--;
            }

            if (sanity < 0)
            {
                SL.LogWarning("Did more than 6 loops trying to auto-finish building, something went wrong!");
            }

            At.SetField(__instance, "m_remainingConstructionTime", 0f);
        }
コード例 #4
0
ファイル: DeathRitual.cs プロジェクト: Hard-Less/Outward-Mods
        protected override void ActivateLocally(Character _targetCharacter, object[] _infos)
        {
            if (SummonManager.Instance == null)
            {
                return;
            }

            if (SummonManager.Instance.FindWeakestSummon(_targetCharacter.UID) is Character summonChar &&
                summonChar.isActiveAndEnabled)
            {
                // change blast position to the summon's position
                _infos[0] = summonChar.transform.position;
                base.ActivateLocally(_targetCharacter, _infos);

                // kill the summon
                summonChar.Stats.ReceiveDamage(999f);

                // fix for cooldown not working on this skill for some reason
                var skill = this.ParentItem as Skill;
                At.SetField(skill, "m_lastActivationTime", Time.time);
                At.SetField(skill, "m_lastCooldownProgress", -1);

                // plague aura interaction
                if (PlagueAuraProximityCondition.IsInsidePlagueAura(summonChar.transform.position))
                {
                    // if you're inside a plague aura, detonate resets your Summon cooldown.
                    if (this.OwnerCharacter?.Inventory?.SkillKnowledge?.GetItemFromItemID(8890103) is Skill summonSkill)
                    {
                        summonSkill.ResetCoolDown();
                    }
                }
            }
        }
コード例 #5
0
        public static void Prefix(Shooter __instance)
        {
            if (__instance is ShootProjectile shootProjectile && shootProjectile.BaseProjectile is Projectile projectile && !projectile.gameObject.activeSelf)
            {
                At.SetField(projectile as SubEffect, "m_parentEffect", __instance);

                projectile.gameObject.SetActive(true);
            }
コード例 #6
0
        public override void ApplyToComponent <T>(T component)
        {
            var comp = component as AddAllStatusEffectBuildUp;

            comp.BuildUpValue     = this.BuildUpValue;
            comp.NoDealer         = this.NoDealer;
            comp.AffectController = this.AffectController;
            At.SetField(comp, "m_buildUpBonus", this.BuildUpBonus);
        }
コード例 #7
0
        public static void Prefix(Deployable __instance)
        {
            var item = At.GetField(__instance as ItemExtension, "m_item") as Item;

            if (!item)
            {
                item = __instance.GetComponent <Item>();
            }

            At.SetField(__instance as ItemExtension, "m_item", item);
        }
コード例 #8
0
        public override void ApplyToComponent <T>(T component)
        {
            var tag = CustomTags.GetTag(ImmunityTag, false);

            if (tag == Tag.None)
            {
                SL.LogWarning($"{this.GetType().Name}: Could not find a tag with the name '{ImmunityTag}'!");
                return;
            }

            At.SetField(component as AddStatusImmunity, "m_statusImmunity", new TagSourceSelector(tag));
        }
コード例 #9
0
            public static bool Prefix(QuickSlotPanel __instance, ref bool ___m_hideWanted, ref Character ___m_lastCharacter,
                                      ref bool ___m_initialized, QuickSlotDisplay[] ___m_quickSlotDisplays, bool ___m_active)
            {
                var self = __instance;

                if (___m_hideWanted && self.IsDisplayed)
                {
                    At.Invoke(self, "OnHide");
                }

                // check init
                if ((self.LocalCharacter == null || ___m_lastCharacter != self.LocalCharacter) && ___m_initialized)
                {
                    At.SetField(self, "m_initialized", false);
                }

                // normal update when initialized
                if (___m_initialized)
                {
                    if (self.UpdateInputVisibility)
                    {
                        for (int i = 0; i < ___m_quickSlotDisplays.Count(); i++)
                        {
                            At.Invoke(___m_quickSlotDisplays[i], "SetInputTargetAlpha", new object[] { (!___m_active) ? 0f : 1f });
                        }
                    }
                }

                // custom initialize setup
                else if (self.LocalCharacter != null)
                {
                    ___m_lastCharacter = self.LocalCharacter;
                    ___m_initialized   = true;

                    // set quickslot display refs (orig function)
                    for (int j = 0; j < ___m_quickSlotDisplays.Length; j++)
                    {
                        int refSlotID = ___m_quickSlotDisplays[j].RefSlotID;
                        ___m_quickSlotDisplays[j].SetQuickSlot(self.LocalCharacter.QuickSlotMngr.GetQuickSlot(refSlotID));
                    }

                    // if its a keyboard quickslot, set up the custom display stuff
                    if (self.name == "Keyboard" && self.transform.parent.name == "QuickSlot")
                    {
                        SetupKeyboardQuickslotDisplay(self, ___m_quickSlotDisplays);
                    }
                }

                return(false);
            }
コード例 #10
0
        public void CreateTag()
        {
            if (CustomTags.GetTag(this.TagName, false) != Tag.None)
            {
                SL.LogWarning($"Creating Tag '{this.TagName}', but it already exists!");
                return;
            }
            ;

            var tag = CustomTags.CreateTag(TagName);

            if (!string.IsNullOrEmpty(this.OptionalTagUID))
            {
                At.SetField(tag, "m_uid", new UID(this.OptionalTagUID));
            }
        }
コード例 #11
0
        public static void Postfix(Building __instance)
        {
            if (!StoreManager.Instance.IsDlcInstalled(OTWStoreAPI.DLCs.DLC2) ||
                !BuildingHelperMod.Instance.settings.AutoFinishBuildings ||
                PhotonNetwork.isNonMasterClientInRoom)
            {
                return;
            }

            At.SetField(__instance, "m_remainingConstructionTime", 0f);

            var pending = (int)At.GetField(__instance, "m_pendingUpgradePhaseIndex");

            At.SetField(__instance, "m_currentUpgradePhaseIndex", pending);
            At.SetField(__instance, "m_pendingUpgradePhaseIndex", -1);
            __instance.UpdateConstruction(0f);
        }
コード例 #12
0
        public static void SetupFrenzy()
        {
            var frenzySkill = ResourcesPrefabManager.Instance.GetItemPrefab(8890105) as Skill;

            // setup skill
            frenzySkill.CastSheathRequired = -1;

            // destroy the existing skills, but keep the rest (VFX / Sound).
            DestroyImmediate(frenzySkill.transform.Find("Lightning").gameObject);
            DestroyImmediate(frenzySkill.transform.Find("SummonSoul").gameObject);

            // set custom spellcast anim
            At.SetField(frenzySkill as Item, "m_activateEffectAnimType", Character.SpellCastType.Focus);

            var effects = new GameObject("Effects");

            effects.transform.parent = frenzySkill.transform;

            effects.AddComponent <LifeRitual>();
        }
コード例 #13
0
        public override void ApplyToItem(Item item)
        {
            base.ApplyToItem(item);

            if (this.Capacity != null)
            {
                // set container capacity
                var container = item.transform.Find("Content").GetComponent <ItemContainerStatic>();
                At.SetField <ItemContainer>(container, "m_baseContainerCapacity", (float)this.Capacity);
            }

            // set restrict dodge
            if (this.Restrict_Dodge != null)
            {
                At.SetField(item as Bag, "m_restrictDodge", (bool)this.Restrict_Dodge);
            }

            if (this.InventoryProtection != null)
            {
                // set invent prot
                At.SetField(item as Bag, "m_inventoryProtection", this.InventoryProtection);
            }
        }
コード例 #14
0
        private IEnumerator DatamineBuildings()
        {
            var player       = CharacterManager.Instance.GetFirstLocalCharacter();
            var buildingsObj = GameObject.Find("Buildings");

            var buildings = References.RPM_ITEM_PREFABS.Values.Where(it => it is Building);

            //var created = new List<Building>();
            foreach (Building prefab in buildings)
            {
                SL.Log("Checking prefab " + prefab.ItemID + ": " + prefab.Name);

                if (!(At.GetField(prefab, "m_upgradePhases") is Building.ConstructionPhase[] upgrades))
                {
                    SL.Log("m_upgradePhases was null");
                    continue;
                }

                ClearScene();
                yield return(new WaitForSeconds(1f));

                MakeBuilding(prefab);

                yield return(new WaitForSeconds(1f));

                DM_Merchant.ParseAllMerchants();
                ParseAllLoot();

                ClearScene();
                yield return(new WaitForSeconds(1f));

                if (upgrades.Length > 0)
                {
                    for (int i = 0; i < upgrades.Length; i++)
                    {
                        MakeBuilding(prefab, i);
                        yield return(new WaitForSeconds(1f));

                        DM_Merchant.ParseAllMerchants();
                        ParseAllLoot();

                        ClearScene();
                        yield return(new WaitForSeconds(1f));
                    }
                }
            }

            yield return(new WaitForSeconds(1f));

            s_doneBuildings = true;

            GameObject MakeBuilding(Building prefab, int upgradePhase = -1)
            {
                var building = ItemManager.Instance.GenerateItemNetwork(prefab.ItemID) as Building;

                At.SetField(building, "m_currentUpgradePhaseIndex", upgradePhase);

                At.SetField(building, "m_remainingConstructionTime", 0);
                At.SetField(building, "m_pendingUpgradePhaseIndex", -1);

                building.UpdateConstruction(0f);
                //At.Invoke(building, "ActivateLevelVisuals", Enumerable.Empty<Type>());

                building.transform.parent = buildingsObj.transform;
                //building.transform.position = player.transform.position;

                //created.Add(building);
                SL.LogWarning("Activated building " + building.Name + " (" + building.ItemID + "), phase: " + upgradePhase);

                return(building.gameObject);
            }
        }
コード例 #15
0
 public override void ApplyToComponent <T>(T component)
 {
     At.SetField(component as AddAbsorbHealth, "m_healthRatio", this.HealthRatio);
 }
コード例 #16
0
        private IEnumerator ParseCoroutine()
        {
            foreach (string sceneName in SceneHelper.SceneBuildNames.Keys)
            {
                /*        Load Scene        */

                if (SceneManagerHelper.ActiveSceneName != sceneName)
                {
                    SL.Log("--- Loading " + sceneName + " ---");

                    NetworkLevelLoader.Instance.RequestSwitchArea(sceneName, 0, 1.5f);

                    yield return(new WaitForSeconds(5f));

                    while (NetworkLevelLoader.Instance.IsGameplayPaused || NetworkLevelLoader.Instance.InLoading)
                    {
                        NetworkLevelLoader loader = NetworkLevelLoader.Instance;
                        At.SetField(loader, "m_continueAfterLoading", true);

                        yield return(new WaitForSeconds(1f));
                    }
                    yield return(new WaitForSeconds(2f));

                    MenuManager.Instance.HideMasterLoadingScreen();
                }

                SL.Log("Parsing scene " + sceneName + "...");

                /*        Parse Scene        */

                //// Disable the TreeBehaviour Managers while we do stuff with enemies
                //DisableCanvases();

                // Parse Enemies
                SL.Log("Parsing enemies");
                DM_Enemy.ParseAllEnemies();

                // Parse Merchants
                SL.Log("Parsing merchants");
                DM_Merchant.ParseAllMerchants();

                // Parse Loot (+ item sources)
                SL.Log("Parsing loot");
                ParseAllLoot();

                // check if New Sirocco

                if (SceneManagerHelper.ActiveSceneName == "NewSirocco")
                {
                    SL.LogWarning("NEW SIROCCO: Dumping all buildings...");

                    StartCoroutine(DatamineBuildings());

                    while (!s_doneBuildings)
                    {
                        yield return(null);
                    }

                    ClearScene();
                    yield return(new WaitForSeconds(1f));
                }

                SL.Log("--- Finished Scene: " + SceneManagerHelper.ActiveSceneName + " ---");
            }

            SL.Log("___________ Finished Scenes Parse ___________");

            SL.Log("[Dataminer] Saving lists...");
            ListManager.SaveLists();

            SL.Log("[Dataminer] Finished.");
        }
コード例 #17
0
        public void LocalTrainerSetup(Character trainer, string _)
        {
            // remove unwanted components
            DestroyImmediate(trainer.GetComponent <CharacterStats>());
            DestroyImmediate(trainer.GetComponent <StartingEquipment>());

            // add NPCLookFollow component
            trainer.gameObject.AddComponent <NPCLookFollow>();

            // =========== setup Trainer DialogueTree from the template ===========

            var trainertemplate = Instantiate(Resources.Load <GameObject>("editor/templates/TrainerTemplate"));

            trainertemplate.transform.parent   = trainer.transform;
            trainertemplate.transform.position = trainer.transform.position;

            // set Dialogue Actor name
            var necroActor = trainertemplate.GetComponentInChildren <DialogueActor>();

            necroActor.SetName(trainerTemplate.Name);

            // get "Trainer" component, and set the SkillTreeUID to our custom tree UID
            var trainerComp = trainertemplate.GetComponentInChildren <Trainer>();

            At.SetField(trainerComp, "m_skillTreeUID", SkillManager.NecromancerTree.UID);

            // setup dialogue tree
            var graphController = trainertemplate.GetComponentInChildren <DialogueTreeController>();
            var graph           = graphController.graph;

            // the template comes with an empty ActorParameter, we can use that for our NPC actor.
            var actors = At.GetField(graph as DialogueTree, "_actorParameters") as List <DialogueTree.ActorParameter>;

            actors[0].actor = necroActor;
            actors[0].name  = necroActor.name;

            // setup the actual dialogue now
            var rootStatement = graph.AddNode <StatementNodeExt>();

            rootStatement.statement = new Statement("Do you seek to harness the power of Corruption, traveler?");
            rootStatement.SetActorName(necroActor.name);

            var multiChoice1 = graph.AddNode <MultipleChoiceNodeExt>();

            multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice {
                statement = new Statement {
                    text = "I'm interested, what can you teach me?"
                }
            });
            multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice {
                statement = new Statement {
                    text = "Who are you?"
                }
            });
            multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice {
                statement = new Statement {
                    text = "What is this place?"
                }
            });

            // the template already has an action node for opening the Train menu.
            // Let's grab that and change the trainer to our custom Trainer component (setup above).
            var openTrainer = graph.allNodes[1] as ActionNode;

            (openTrainer.action as TrainDialogueAction).Trainer = new BBParameter <Trainer>(trainerComp);

            // create some custom dialogue
            var answer1 = graph.AddNode <StatementNodeExt>();

            answer1.statement = new Statement("I wish I could remember...");
            answer1.SetActorName(necroActor.name);

            var answer2 = graph.AddNode <StatementNodeExt>();

            answer2.statement = new Statement("This is the fortress of the Plague Doctor, a powerful Lich. I've learned a lot about Corruption within these walls.");
            answer2.SetActorName(necroActor.name);

            // ===== finalize nodes =====
            graph.allNodes.Clear();
            // add the nodes we want to use
            graph.allNodes.Add(rootStatement);
            graph.allNodes.Add(multiChoice1);
            graph.allNodes.Add(openTrainer);
            graph.allNodes.Add(answer1);
            graph.allNodes.Add(answer2);
            graph.primeNode = rootStatement;
            graph.ConnectNodes(rootStatement, multiChoice1);    // prime node triggers the multiple choice
            graph.ConnectNodes(multiChoice1, openTrainer, 0);   // choice1: open trainer
            graph.ConnectNodes(multiChoice1, answer1, 1);       // choice2: answer1
            graph.ConnectNodes(answer1, rootStatement);         // - choice2 goes back to root node
            graph.ConnectNodes(multiChoice1, answer2, 2);       // choice3: answer2
            graph.ConnectNodes(answer2, rootStatement);         // - choice3 goes back to root node

            // set the trainer active
            trainer.gameObject.SetActive(true);
        }