Esempio n. 1
0
        public void BeginDialog(QuestCondition questCondition, InteractiveObjectMono dialogObject = null)
        {
            dialogQuestCondition = questCondition;

            if (questCondition.ConditionType == ConditionType.Interact)
            {
                BeginDialog((questCondition as InteractCondition).InteractionNodeTreeID, dialogObject);
            }
            else if (questCondition.ConditionType == ConditionType.Deliver)
            {
                //todo: deliverInteraction
                BeginDialog((questCondition as DeliverCondition).InteractionNodeTreeID, dialogObject);
            }
        }
Esempio n. 2
0
 public Quest()
 {
     ID   = Guid.NewGuid().ToString();
     Name = "" +
            "New Quest";
     QuestChainId   = "";
     ConditionMode  = QuestConditionMode.AllAtOnce;
     Requirements   = new QuestRequirements();
     Rewards        = new QuestReward();
     Conditions     = new List <QuestCondition>();
     BonusCondition = new KillCondition();
     BonusRewards   = new QuestReward();
     FinalCondition = new KillCondition();
     Image          = new ImageContainer();
     IsAccepted     = TurnedIn = false;
     TrackSteps     = true;
     TimeLimit      = 0;
     Repeatable     = false;
     CanAbandon     = true;
     SetCustomVariablesOnCompletion = new List <Rm_CustomVariableGetSet>();
 }
Esempio n. 3
0
        public void EndDialog()
        {
            var cam = GetObject.RPGCamera;

            cam.cameraMode = Rm_RPGHandler.Instance.DefaultSettings.DefaultCameraMode;
            if (cam.cameraMode != CameraMode.Manual)
            {
                cam.transform.position = cam.desiredPosition;
            }

            DialogNpc = null;

            if (EvaluatingQuestDialog)
            {
                //todo: is this the right place?!
                if (!string.IsNullOrEmpty(PostQuestEvaluationNodeID))
                {
                    DialogNodeChain = OldNodeChain;
                    if (DialogNodeChain != null)
                    {
                        DialogNodeChain.Goto(PostQuestEvaluationNodeID);
                    }
                }
                else
                {
                    DialogNodeChain = null;
                    GetObject.PlayerMono.Controller.Interacting = false;
                }

                OldNodeChain          = null;
                EvaluatingQuestDialog = false;
            }
            else if (EvaluatingQuestCompleteDialog)
            {
                //todo: is this the right place?!
                QuestHandler.Instance.CompleteQuest(EvaluatingQuestID);
                if (!string.IsNullOrEmpty(PostQuestEvaluationNodeID))
                {
                    DialogNodeChain = OldNodeChain;
                    if (DialogNodeChain != null)
                    {
                        DialogNodeChain.Goto(PostQuestEvaluationNodeID);
                    }
                }
                else
                {
                    DialogNodeChain = null;
                    GetObject.PlayerMono.Controller.Interacting = false;
                }
                OldNodeChain = null;
                EvaluatingQuestCompleteDialog = false;
            }
            else
            {
                if (dialogQuestCondition != null)
                {
                    dialogQuestCondition.IsDone = true;
                    RPG.Events.OnQuestStatusUpdate();
                    var deliverCondition = dialogQuestCondition as DeliverCondition;
                    if (deliverCondition != null)
                    {
                        GetObject.PlayerCharacter.Inventory.RemoveItem(deliverCondition.ItemToDeliverID);
                    }
                    dialogQuestCondition = null;
                }

                DialogNodeChain = null;
                GetObject.PlayerMono.Controller.Interacting = false;
            }

            CheckForUpdate();
        }
Esempio n. 4
0
        public string TrackerDetailsForCondition(QuestCondition activeCondition)
        {
            var text = "";

            switch (activeCondition.ConditionType)
            {
            case ConditionType.Kill:
                var killCondition = (KillCondition)activeCondition;
                var mobName       = killCondition.IsNPC ? RPG.Npc.GetNpcName(killCondition.CombatantID) : RPG.Npc.GetEnemyName(killCondition.CombatantID);
                if (killCondition.UseCustomText)
                {
                    text += string.Format("{0}", (killCondition.IsDone ? killCondition.CustomCompletedText : killCondition.CustomText)) + "\n";
                }
                else
                {
                    text += string.Format("Kill {0}: {1}/{2}", mobName, killCondition.NumberKilled, killCondition.NumberToKill) + "\n";
                }
                break;

            case ConditionType.Item:
                var itemCondition = (ItemCondition)activeCondition;
                var itemName      = RPG.Items.GetItemName(itemCondition.ItemToCollectID);
                if (itemCondition.UseCustomText)
                {
                    text += string.Format("{0}", (itemCondition.IsDone ? itemCondition.CustomCompletedText : itemCondition.CustomText)) + "\n";
                }
                else
                {
                    text += string.Format("{0}: {1}/{2}", itemName, itemCondition.NumberObtained, itemCondition.NumberToObtain) + "\n";
                }
                break;

            case ConditionType.Interact:
                var interactCondition = (InteractCondition)activeCondition;
                var interactNpcName   = interactCondition.IsNpc ? RPG.Npc.GetNpcName(interactCondition.InteractableID) : RPG.Npc.GetInteractableName(interactCondition.InteractableID);
                if (interactCondition.UseCustomText)
                {
                    text += string.Format("{0}", (interactCondition.IsDone ? interactCondition.CustomCompletedText : interactCondition.CustomText)) + "\n";
                }
                else
                {
                    text += string.Format("Interact with {0}: {1}", interactNpcName, (interactCondition.IsDone ? "Done" : "Not Done")) + "\n";
                }
                break;

            case ConditionType.Deliver:
                var deliverCondition = (DeliverCondition)activeCondition;
                var deliverItemName  = RPG.Items.GetItemName(deliverCondition.ItemToDeliverID);
                var deliverNpcName   = deliverCondition.DeliverToNPC ? RPG.Npc.GetNpcName(deliverCondition.InteractableToDeliverToID) : RPG.Npc.GetInteractableName(deliverCondition.InteractableToDeliverToID);
                if (deliverCondition.UseCustomText)
                {
                    text += string.Format("{0}", (deliverCondition.IsDone ? deliverCondition.CustomCompletedText : deliverCondition.CustomText)) + "\n";
                }
                else
                {
                    text += string.Format("Deliver {0} to {1}: {2}", deliverItemName, deliverNpcName, (deliverCondition.IsDone ? "Done" : "Not Done")) + "\n";
                }
                break;

            case ConditionType.Custom:
                var condition = (CustomCondition)activeCondition;
                text += string.Format("{0}", (condition.IsDone ? condition.CustomCompletedText : condition.CustomText)) + "\n";
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(text);
        }