public static bool MeetsCondition(
            SelfSwitchCondition condition,
            Player player,
            Event eventInstance,
            QuestBase questBase
            )
        {
            if (eventInstance != null)
            {
                if (eventInstance.Global)
                {
                    if (MapInstance.Get(eventInstance.MapId).GlobalEventInstances.TryGetValue(eventInstance.BaseEvent, out Event evt))
                    {
                        if (evt != null)
                        {
                            return(evt.SelfSwitch[condition.SwitchIndex] == condition.Value);
                        }
                    }
                }
                else
                {
                    return(eventInstance.SelfSwitch[condition.SwitchIndex] == condition.Value);
                }
            }

            return(false);
        }
        public static bool MeetsCondition(
            SelfSwitchCondition condition,
            Player player,
            Event eventInstance,
            QuestBase questBase
            )
        {
            if (eventInstance != null)
            {
                if (eventInstance.Global)
                {
                    var evts = MapInstance.Get(eventInstance.MapId).GlobalEventInstances.Values.ToList();
                    for (var i = 0; i < evts.Count; i++)
                    {
                        if (evts[i] != null && evts[i].BaseEvent == eventInstance.BaseEvent)
                        {
                            return(evts[i].SelfSwitch[condition.SwitchIndex] == condition.Value);
                        }
                    }
                }
                else
                {
                    return(eventInstance.SelfSwitch[condition.SwitchIndex] == condition.Value);
                }
            }

            return(false);
        }
Exemple #3
0
 private void SetupFormValues(SelfSwitchCondition condition)
 {
     cmbSelfSwitch.SelectedIndex    = condition.SwitchIndex;
     cmbSelfSwitchVal.SelectedIndex = Convert.ToInt32(condition.Value);
 }
Exemple #4
0
 private void SaveFormValues(SelfSwitchCondition condition)
 {
     condition.SwitchIndex = cmbSelfSwitch.SelectedIndex;
     condition.Value       = Convert.ToBoolean(cmbSelfSwitchVal.SelectedIndex);
 }