// 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);
                        }
                    }
                }
            }
        }
    // Use this for initialization
    void Start()
    {
        dtc     = GetComponent <DialogueTreeController>();
        dialogs = dtc.blackboard.GetVariableNames();

        foreach (string dialog in dialogs)
        {
            try
            {
                dtc.blackboard.SetValue(dialog, TranslatorManager.instance.GetDialogTranslationById(dialog));
            }catch (KeyNotFoundException e)
            {
                Debug.LogWarning(" Not found the translation of the id '" + dialog + "' on the excel file.");
            }
        }
    }
        protected override void OnExecute()
        {
            instance = isPrefab ? GameObject.Instantiate(dialogueTreeController.value) : dialogueTreeController.value;

            if (waitActionFinish)
            {
                instance.StartDialogue(agent, (success) => { if (isPrefab)
                                                             {
                                                                 Object.Destroy(instance.gameObject);
                                                             }
                                                             EndAction(success); });
            }
            else
            {
                instance.StartDialogue(agent, (success) => { if (isPrefab)
                                                             {
                                                                 Object.Destroy(instance.gameObject);
                                                             }
                                       });
                EndAction();
            }
        }
        // Token: 0x0600001B RID: 27 RVA: 0x000033B0 File Offset: 0x000015B0
        public static void SetupRufusInteraction()
        {
            GameObject gameObject = GameObject.Find("Dialogue_Rufus/NPC/DialogueTree_1_Initial");
            bool       flag       = gameObject != null;

            if (flag)
            {
                DialogueTreeController component = gameObject.GetComponent <DialogueTreeController>();
                bool flag2 = component != null;
                if (flag2)
                {
                    Graph            graph            = component.graph;
                    List <Node>      allNodes         = graph.allNodes;
                    StatementNodeExt statementNodeExt = allNodes.FirstOrDefault((Node n) => n != null && n is StatementNodeExt && ((StatementNodeExt)n).statement.text.Contains("Elatt however... I’ve had the honor to speak with him. He is very real. Having a god that was once man is comforting.")) as StatementNodeExt;
                    bool             flag3            = statementNodeExt != null;
                    if (flag3)
                    {
                        ActionNode actionNode = graph.AddNode <ActionNode>();
                        GiveReward giveReward = new GiveReward();
                        actionNode.action         = giveReward;
                        giveReward.RewardReceiver = GiveReward.Receiver.Instigator;
                        NodeCanvas.Tasks.Actions.ItemQuantity itemQuantity = new NodeCanvas.Tasks.Actions.ItemQuantity();
                        itemQuantity.Item = new BBParameter <ItemReference>(new ItemReference
                        {
                            ItemID = Templar.Instance.prayerInstance.ItemID
                        });
                        itemQuantity.Quantity = 1;
                        giveReward.ItemReward = new List <NodeCanvas.Tasks.Actions.ItemQuantity>
                        {
                            itemQuantity
                        };
                        statementNodeExt.outConnections[0] = Connection.Create(statementNodeExt, actionNode, -1, -1);
                        FinishNode finishNode = graph.AddNode <FinishNode>();
                        allNodes.Add(finishNode);
                        graph.ConnectNodes(actionNode, finishNode, -1, -1);
                    }
                }
            }
        }
示例#5
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);
        }