Exemple #1
0
        // Token: 0x06000005 RID: 5 RVA: 0x000021B0 File Offset: 0x000003B0
        public static GameObject SetupTrainerServerSide()
        {
            string     text       = UID.Generate().ToString();
            int        num        = PhotonNetwork.AllocateSceneViewID();
            GameObject gameObject = CustomCharacters.CreateCharacter(JuggernautTrainer.TrainerLocation, text, "SL_Character", false, null);
            Character  component  = gameObject.GetComponent <Character>();

            At.SetValue <CharacterManager.CharacterInstantiationTypes>(CharacterManager.CharacterInstantiationTypes.Item, typeof(Character), component, "m_instantiationType");
            foreach (int itemID in JuggernautTrainer.TrainerEquipment)
            {
                component.Inventory.Equipment.EquipInstantiate(ResourcesPrefabManager.Instance.GetItemPrefab(itemID) as Equipment);
            }
            component.ChangeFaction(Character.Factions.NONE, true);
            gameObject.SetActive(true);
            bool offlineMode = PhotonNetwork.offlineMode;

            if (offlineMode)
            {
                JuggernautTrainer.SetupTrainerClientSide(gameObject, num);
            }
            else
            {
                RPCManager.Instance.photonView.RPC("GetJuggernautTrainerFromServer", 0, new object[]
                {
                    text.ToString(),
                    num,
                    0
                });
            }
            return(gameObject);
        }
        // Token: 0x0600001C RID: 28 RVA: 0x000034EC File Offset: 0x000016EC
        public static void SetupAltarInteraction(ref Trainer altarTrainer, ref SkillSchool templarTreeInstance)
        {
            GameObject gameObject = GameObject.Find("DialogueAltar/NPC/InteractionActivatorSettings");
            bool       flag       = gameObject != null;

            if (flag)
            {
                NPCInteraction componentInChildren = gameObject.GetComponentInChildren <NPCInteraction>();
                bool           flag2 = componentInChildren != null;
                if (flag2)
                {
                    bool flag3 = componentInChildren.ActorLocKey == "name_unpc_altar_01";
                    if (flag3)
                    {
                        DialogueTreeController dialogueController = componentInChildren.NPCDialogue.DialogueController;
                        Graph                 graph    = dialogueController.graph;
                        List <Node>           allNodes = graph.allNodes;
                        MultipleChoiceNodeExt multipleChoiceNodeExt = allNodes.FirstOrDefault(delegate(Node n)
                        {
                            bool result;
                            if (n != null && n is MultipleChoiceNodeExt)
                            {
                                result = ((from m in ((MultipleChoiceNodeExt)n).availableChoices
                                           where m.statement.text == "(Offer a prayer to Elatt)"
                                           select m).ToList <MultipleChoiceNodeExt.Choice>().Count > 0);
                            }
                            else
                            {
                                result = false;
                            }
                            return(result);
                        }) as MultipleChoiceNodeExt;
                        bool flag4 = multipleChoiceNodeExt == null;
                        if (!flag4)
                        {
                            string text = "(Swear an oath to Elatt.)";
                            MultipleChoiceNodeExt.Choice choice = new MultipleChoiceNodeExt.Choice();
                            choice.statement      = new Statement();
                            choice.statement.text = text;
                            choice.isUnfolded     = true;
                            multipleChoiceNodeExt.availableChoices.Insert(0, choice);
                            ActionNode actionNode = graph.AddNode <ActionNode>();
                            allNodes.Add(actionNode);
                            altarTrainer = new Trainer();
                            At.SetValue <UID>(UID.Generate(), typeof(Trainer), altarTrainer, "m_uid");
                            At.SetValue <UID>(templarTreeInstance.UID, typeof(Trainer), altarTrainer, "m_skillTreeUID");
                            actionNode.action = new TrainDialogueAction();
                            ((TrainDialogueAction)actionNode.action).Trainer = new BBParameter <Trainer>(altarTrainer);
                            BBParameter <Character> bbparameter = new BBParameter <Character>();
                            bbparameter.name = "gInstigator";
                            ((TrainDialogueAction)actionNode.action).PlayerCharacter = bbparameter;
                            graph.ConnectNodes(multipleChoiceNodeExt, actionNode, 0, -1);
                            FinishNode finishNode = graph.AddNode <FinishNode>();
                            allNodes.Add(finishNode);
                            graph.ConnectNodes(actionNode, finishNode, -1, -1);
                        }
                    }
                }
            }
        }
        // Token: 0x06000017 RID: 23 RVA: 0x00002A34 File Offset: 0x00000C34
        public static void StaticActivate(Character character, object[] _infos, Effect instance)
        {
            Trainer trainer = new Trainer();

            At.SetValue <UID>(UID.Generate(), typeof(Trainer), trainer, "m_uid");
            At.SetValue <UID>(JuggernautMod.juggernautTreeInstance.UID, typeof(Trainer), trainer, "m_skillTreeUID");
            trainer.StartTraining(character);
        }
        protected override void OnRefreshPotency()
        {
            base.OnRefreshPotency();

            if (!this.OwnerCharacter)
            {
                return;
            }

            // update max protection
            var prot  = this.OwnerCharacter.Stats.GetDamageProtection(DamageType.Types.Physical);
            var ratio = (float)ProtectionBubbleMod.config.GetValue(Settings.ShieldRatio) / 100f;

            m_maxProtection = prot * ratio;

            // active shield value regen
            if (m_activeProtection < m_maxProtection && Time.time - this.OwnerCharacter.LastHurtTime > (float)ProtectionBubbleMod.config.GetValue(Settings.RegenDelay))
            {
                var regen = (float)ProtectionBubbleMod.config.GetValue(Settings.RegenRate);

                m_activeProtection += regen;
            }

            // linked status icon / description / etc
            if (this.LinkedStatus)
            {
                var remaining = Mathf.Clamp(Mathf.Round(m_activeProtection), 0f, m_maxProtection);

                if (remaining > 0f)
                {
                    OnShow();

                    // update desc
                    At.SetValue($"Your Protection is shielding you from the next {remaining:#.0} damage.",
                                typeof(StatusEffect),
                                LinkedStatus,
                                "m_description"
                                );

                    // set icon alpha
                    if (this.LinkedIcon)
                    {
                        var color = this.LinkedIcon.color;
                        var alpha = (float)((decimal)m_activeProtection / (decimal)m_maxProtection);

                        this.LinkedIcon.color = new Color(color.r, color.g, color.b, alpha);
                    }
                }
                else
                {
                    OnHide();
                }
            }
        }
Exemple #5
0
        public static void Postfix(CharacterEquipment __instance, Tuple <float?, Stat, Character> __state)
        {
            bool flag = __state != null;

            if (flag)
            {
                float?item  = __state.Item1;
                float num   = __state.Item2.CurrentValue / JuggernautFormulas.GetUnyieldingMovementSpeedForgivenes(__state.Item3);
                bool  flag2 = !(item.GetValueOrDefault() == num & item != null);
                if (flag2)
                {
                    Debug.Log("Logic error at CharacterEquipment_GetTotalMovementModifier in Juggernaut class. m_equipementPenalties changed during call!");
                }
                At.SetValue <float>(__state.Item1.Value, typeof(Stat), __state.Item2, "m_currentValue");
            }
        }
Exemple #6
0
        public static void Prefix(CharacterEquipment __instance, out Tuple <float?, Stat, Character> __state)
        {
            __state = null;
            Character character = At.GetValue(typeof(CharacterEquipment), __instance, "m_character") as Character;
            bool      flag      = character != null && SkillRequirements.CanReduceMoveSpeedArmorPenalty(character);

            if (flag)
            {
                CharacterStats stats = character.Stats;
                Stat           stat  = At.GetValue(typeof(CharacterStats), stats, "m_equipementPenalties") as Stat;
                bool           flag2 = stat != null;
                if (flag2)
                {
                    __state = new Tuple <float?, Stat, Character>(new float?(stat.CurrentValue), stat, character);
                    At.SetValue <float>(__state.Item1.Value * JuggernautFormulas.GetUnyieldingMovementSpeedForgivenes(character), typeof(Stat), stat, "m_currentValue");
                }
            }
        }
        private static void ToggleDummyPanel(Character cha, bool show)
        {
            if (cha.CharacterUI.PendingDemoCharSelectionScreen is Panel panel)
            {
                if (show)
                {
                    panel.Show();
                }
                else
                {
                    panel.Hide();
                }
            }
            else if (show)
            {
                GameObject obj = new GameObject();
                obj.transform.parent = cha.transform;
                obj.SetActive(true);

                Panel newPanel = obj.AddComponent <Panel>();
                At.SetValue(newPanel, typeof(CharacterUI), cha.CharacterUI, "PendingDemoCharSelectionScreen");
                newPanel.Show();
            }
        }
Exemple #8
0
        public static void Prefix(Skill __instance, bool _tryingToActivate)
        {
            bool flag;

            if (_tryingToActivate)
            {
                MeleeSkill meleeSkill = __instance as MeleeSkill;
                if (meleeSkill != null && __instance.OwnerCharacter.NextAtkAllowed == 2)
                {
                    flag = meleeSkill.HasAllRequirements(false);
                    goto IL_26;
                }
            }
            flag = false;
IL_26:
            bool flag2 = flag;

            if (flag2)
            {
                __instance.OwnerCharacter.ForceCancel(true, true);
                At.SetValue <bool>(true, typeof(Character), __instance.OwnerCharacter, "m_inLocomotion");
                At.SetValue <bool>(true, typeof(Character), __instance.OwnerCharacter, "m_nextIsLocomotion");
            }
        }
Exemple #9
0
        // Token: 0x0600001E RID: 30 RVA: 0x000036BC File Offset: 0x000018BC
        protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
        {
            bool         flag = false;
            StatusEffect parentStatusEffect = this.m_parentStatusEffect;
            bool         flag2 = parentStatusEffect != null;

            if (flag2)
            {
                bool flag3 = parentStatusEffect.Age > 10f && !this.buffsWereReceived;
                if (flag3)
                {
                    bool flag4 = !_affectedCharacter.StatusEffectMngr.HasStatusEffect(Templar.Instance.prayerCooldownStatusEffectInstance.IdentifierName);
                    if (flag4)
                    {
                        _affectedCharacter.StatusEffectMngr.AddStatusEffect(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Bless"), _affectedCharacter);
                        _affectedCharacter.StatusEffectMngr.AddStatusEffect(Templar.Instance.prayerCooldownStatusEffectInstance, _affectedCharacter);
                        bool flag5 = _affectedCharacter.Inventory.SkillKnowledge.IsItemLearned(2502002);
                        if (flag5)
                        {
                            _affectedCharacter.StatusEffectMngr.AddStatusEffect(Templar.Instance.burstOfDivinityInstance, _affectedCharacter);
                        }
                    }
                    else
                    {
                        bool isLocalPlayer = _affectedCharacter.IsLocalPlayer;
                        if (isLocalPlayer)
                        {
                            _affectedCharacter.CharacterUI.ShowInfoNotification(Templar.Instance.prayerCooldownStatusEffectInstance.Description);
                        }
                    }
                    this.buffsWereReceived = true;
                }
                bool flag6 = parentStatusEffect.Age > 10f && !this.trainerWasOpened;
                if (flag6)
                {
                    bool isLocalPlayer2 = _affectedCharacter.IsLocalPlayer;
                    if (isLocalPlayer2)
                    {
                        bool    flag7           = false;
                        Vector3 position        = _affectedCharacter.transform.position;
                        Vector3 eulerAngles     = _affectedCharacter.transform.rotation.eulerAngles;
                        string  activeSceneName = SceneManagerHelper.ActiveSceneName;
                        string  text            = activeSceneName;
                        if (text != null)
                        {
                            if (!(text == "Chersonese_Dungeon4_HolyMission"))
                            {
                                if (text == "Monsoon")
                                {
                                    bool flag8 = position.x <-174f && (double)position.x> -176.5 && position.z <755f && position.z> 753f;
                                    if (flag8)
                                    {
                                        bool flag9 = eulerAngles.y <24f || eulerAngles.y> 330f;
                                        if (flag9)
                                        {
                                            flag7 = true;
                                        }
                                    }
                                    bool flag10 = position.x <-374f && (double)position.x> -375.8 && (double)position.z <766.5 && (double)position.z> 764.5;
                                    if (flag10)
                                    {
                                        bool flag11 = eulerAngles.y <190f && eulerAngles.y> 140f;
                                        if (flag11)
                                        {
                                            flag7 = true;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                bool flag12 = position.x <-12.5f && (double)position.x> -16.5 && position.z <-18f && position.z> -20f;
                                if (flag12)
                                {
                                    bool flag13 = eulerAngles.y <10f || eulerAngles.y> 320f;
                                    if (flag13)
                                    {
                                        flag7 = true;
                                    }
                                }
                            }
                        }
                        bool flag14 = flag7;
                        if (flag14)
                        {
                            Trainer trainer = new Trainer();
                            At.SetValue <UID>(UID.Generate(), typeof(Trainer), trainer, "m_uid");
                            At.SetValue <UID>(Templar.templarTreeInstance.UID, typeof(Trainer), trainer, "m_skillTreeUID");
                            trainer.StartTraining(_affectedCharacter);
                            this.trainerWasOpened = true;
                        }
                    }
                }
                bool flag15 = (double)((_affectedCharacter != null) ? _affectedCharacter.AnimMoveSqMagnitude : 0f) > 0.1 && parentStatusEffect.Age > 0.5f;
                if (flag15)
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            bool flag16 = flag;

            if (flag16)
            {
                StatusEffectManager statusEffectMngr = _affectedCharacter.StatusEffectMngr;
                if (statusEffectMngr != null)
                {
                    statusEffectMngr.CleanseStatusEffect("Prayer");
                }
                _affectedCharacter.ForceCancel(true, true);
            }
        }
Exemple #10
0
        private static Item NewHellstone(int baseItemID, int newItemId, String name, String desc)
        {
            int totalWeight = CurrencyEffects.ALL[newItemId].Sum(x => x.GetWeight());

            desc += "\n";

            CurrencyEffects.ALL[newItemId].ForEach(x =>
            {
                float chance = (float)x.GetWeight() / (float)totalWeight * 100;

                desc += "\n" + chance + "% to: " + x.Get().GetDescription() + "\n";
            });

            desc += "\n Use when your desired gear is in your pouch (and no other gear there).";

            if (HELLSTONE_OF_ARCANA_ID != newItemId) // this hellstone is used on non magical items, unlike others
            {
                desc += "\n Only works on Magical items.";
            }
            else
            {
                desc += "\n Only works on Non Magical items.";
            }

            var template = new SL_Item()
            {
                Name          = name,
                Description   = desc,
                Target_ItemID = baseItemID,
                New_ItemID    = newItemId,
                Tags          = new string[]

                {
                    TagSourceManager.Valuable.TagName
                },
                IsUsable = true
            };

            var item = CustomItems.CreateCustomItem(template);

            var effects = item.transform.Find("Effects");

            if (effects == null)
            {
                // If the item doesn't have "Effects", just add it.
                effects = new GameObject("Effects").transform;
                effects.transform.parent = item.transform;
                // If you didn't use CreateCustomItem, you'd need to call DontDestroyOnLoad(gaberries.gameObject);
            }
            CurrencyEffectComponent eff = effects.gameObject.AddComponent <CurrencyEffectComponent>();

            UnityEngine.Object.DontDestroyOnLoad(eff);

            var png    = CustomTextures.LoadTexture(@"BepInEx\plugins\Grindward\Icons\" + newItemId + ".png", false, false);
            var sprite = CustomTextures.CreateSprite(png, CustomTextures.SpriteBorderTypes.ItemIcon);

            CustomItemVisuals.SetSpriteLink(item, sprite);

            At.SetValue(sprite, typeof(Item), item, "m_itemIcon");

            return(item);
        }
Exemple #11
0
        // Token: 0x06000006 RID: 6 RVA: 0x000022B4 File Offset: 0x000004B4
        public static void SetupTrainerClientSide(GameObject juggernautGameObject, int trainerViewID)
        {
            GameObject gameObject = new GameObject("UNPC_The Juggernaut");

            gameObject.transform.position             = JuggernautTrainer.TrainerLocation;
            juggernautGameObject.transform.parent     = gameObject.transform;
            juggernautGameObject.transform.position   = gameObject.transform.position;
            juggernautGameObject.transform.rotation   = Quaternion.Euler(0f, 220.5518f, 0f);
            juggernautGameObject.transform.localScale = new Vector3(1.15f, 1.15f, 1.15f);
            UnityEngine.Object.DestroyImmediate(juggernautGameObject.GetComponent <StartingEquipment>());
            Character component = juggernautGameObject.GetComponent <Character>();

            component.Stats.enabled = false;
            Weapon currentWeapon = component.CurrentWeapon;
            bool   flag          = currentWeapon != null && currentWeapon.TwoHanded;

            if (flag)
            {
                component.LeftHandEquipment = component.CurrentWeapon;
                component.LeftHandChanged();
            }
            component.Sheathed = false;
            GameObject gameObject2 = UnityEngine.Object.Instantiate(Resources.Load("editor/templates/TrainerTemplate")) as GameObject;

            gameObject2.transform.parent   = juggernautGameObject.transform;
            gameObject2.transform.position = juggernautGameObject.transform.position;
            gameObject2.transform.rotation = juggernautGameObject.transform.rotation;
            DialogueActor componentInChildren = gameObject2.GetComponentInChildren <DialogueActor>();

            componentInChildren.SetName("The Juggernaut");
            Trainer componentInChildren2 = gameObject2.GetComponentInChildren <Trainer>();

            At.SetValue <UID>(JuggernautMod.juggernautTreeInstance.UID, typeof(Trainer), componentInChildren2, "m_skillTreeUID");
            DialogueTreeController componentInChildren3 = gameObject2.GetComponentInChildren <DialogueTreeController>();
            Graph graph = componentInChildren3.graph;
            List <DialogueTree.ActorParameter> list = At.GetValue(typeof(DialogueTree), graph as DialogueTree, "_actorParameters") as List <DialogueTree.ActorParameter>;

            list[0].actor = componentInChildren;
            list[0].name  = componentInChildren.name;
            List <Node>      list2            = At.GetValue(typeof(Graph), graph, "_nodes") as List <Node>;
            StatementNodeExt statementNodeExt = graph.AddNode <StatementNodeExt>();

            statementNodeExt.statement = new Statement("What do you want, peasant?");
            statementNodeExt.SetActorName(componentInChildren.name);
            MultipleChoiceNodeExt multipleChoiceNodeExt = graph.AddNode <MultipleChoiceNodeExt>();

            multipleChoiceNodeExt.availableChoices.Add(new MultipleChoiceNodeExt.Choice
            {
                statement = new Statement
                {
                    text = "I wish to become a legend like you!"
                }
            });
            multipleChoiceNodeExt.availableChoices.Add(new MultipleChoiceNodeExt.Choice
            {
                statement = new Statement
                {
                    text = "Who are you?"
                }
            });
            ActionNode actionNode = list2[1] as ActionNode;

            (actionNode.action as TrainDialogueAction).Trainer = new BBParameter <Trainer>(componentInChildren2);
            StatementNodeExt statementNodeExt2 = graph.AddNode <StatementNodeExt>();

            statementNodeExt2.statement = new Statement("Hah! Like you don't know... Everyone knows me, I'm a living legend known as \"The Juggernaut\"!");
            statementNodeExt2.SetActorName(componentInChildren.name);
            list2.Clear();
            list2.Add(statementNodeExt);
            list2.Add(multipleChoiceNodeExt);
            list2.Add(actionNode);
            list2.Add(statementNodeExt2);
            graph.primeNode = statementNodeExt;
            graph.ConnectNodes(statementNodeExt, multipleChoiceNodeExt, -1, -1);
            graph.ConnectNodes(multipleChoiceNodeExt, actionNode, 0, -1);
            graph.ConnectNodes(multipleChoiceNodeExt, statementNodeExt2, 1, -1);
            graph.ConnectNodes(statementNodeExt2, statementNodeExt, -1, -1);
            gameObject.SetActive(true);
        }