public void CalculateChoices(ConversationStage s)
        {
            ChoicesColumn1.Clear();
            ChoicesColumn2.Clear();
            ChoicesColumn3.Clear();
            int current = 0;

            foreach (var choice in s.Choices)
            {
                var script = new ScriptWrapper(choice.ChoiceVisibility);
                var result = script.Execute();
                if (result == null || result == true)
                {
                    if (current == 0)
                    {
                        ChoicesColumn1.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText));
                    }
                    if (current == 1)
                    {
                        ChoicesColumn2.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText));
                    }
                    if (current == 2)
                    {
                        ChoicesColumn3.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText));
                    }
                    current = (current + 1) % 3;
                }
            }
        }
        public void GoToStage(int stage)
        {
            var stageInstance = Convo.Stages.Where(a => a.StageId == stage).FirstOrDefault();

            if (stageInstance != null)
            {
                var script = new ScriptWrapper(stageInstance.StageAction);
                var result = script.Execute();
                if (result != true)
                {
                    CalculateChoices(stageInstance);
                    if (ChoicesColumn1.Count() == 0)
                    {
                        ConversationFinished = true;
                    }
                }
            }
            else
            {
                ConversationFinished = true;
            }
            MainViewModel.GetMainViewModelStatic().CurrentGame.RefreshAll();
            if (ConversationFinished && MainViewModel.GetMainViewModelStatic().CurrentConversation == this)
            {
                MainViewModel.GetMainViewModelStatic().SetExploreMode();
            }
        }
        public void UseItem()
        {
            ScriptWrapper s = new ScriptWrapper(item.OnUse)
            {
                ItemBase = this
            };

            s.Execute();
        }
        public List <object> GetDescription()
        {
            ScriptWrapper s = new ScriptWrapper(item.Description)
            {
                ItemBase = this
            };

            s.Execute();
            return(s.TextResult);
        }
        public void RunOnMove()
        {
            ScriptWrapper sw = new ScriptWrapper(LinkedEffect.Value.OnMove);

            foreach (var local in TempVariables)
            {
                sw.localVars.Add(local.VariableBase.Id, local);
                sw.localVarsByName.Add(local.VariableBase.Name, local);
            }
            sw.CurrentStatusEffect = this;
            sw.Execute(true);
        }
        public bool RunCheckIfResolved()
        {
            ScriptWrapper sw = new ScriptWrapper(LinkedEffect.Value.CheckIfCleared);

            foreach (var local in TempVariables)
            {
                sw.localVars.Add(local.VariableBase.Id, local);
                sw.localVarsByName.Add(local.VariableBase.Name, local);
            }
            sw.CurrentStatusEffect = this;
            bool?result = sw.Execute(true);

            return(result == true);
        }