예제 #1
0
        private string FindActivityIdentifier()
        {
            if (ActivityKey_ItemId > 0)
            {
                return(DoWhenUseItemActivity.CreateActivityIdentifier(ActivityKey_ItemId));
            }

            if (ActivityKey_SpellId > 0)
            {
                return(DoWhenCastSpellActivity.CreateActivityIdentifier(ActivityKey_SpellId));
            }

            if (!string.IsNullOrEmpty(ActivityKey_Name))
            {
                return(DoWhenNamedActivity.CreateActivityIdentifier(ActivityKey_Name));
            }

            QBCLog.MaintenanceError("Unable to find ActivityIdentifier for ItemId, SpellId, or ActivityName--none were specified.");
            return(string.Empty);
        }
예제 #2
0
        private void ActionUpdate(IUseWhenPredicate useWhenPredicate, bool isMovementStopRequired)
        {
            var activityIdentifier = FindActivityIdentifier();
            var existingActivity   = FindActivity(activityIdentifier);

            // If activity already exists, remove it...
            if (existingActivity != null)
            {
                s_persistedActivities.Remove(existingActivity);
            }

            // Install new activity...
            IDoWhenActivity doWhenActivity = null;

            if (ActivityKey_ItemId > 0)
            {
                doWhenActivity = new DoWhenUseItemActivity(ActivityKey_ItemId, useWhenPredicate, isMovementStopRequired);
            }

            else if (ActivityKey_SpellId > 0)
            {
                doWhenActivity = new DoWhenCastSpellActivity(ActivityKey_SpellId, useWhenPredicate, isMovementStopRequired);
            }

            else if (!string.IsNullOrEmpty(ActivityKey_Name))
            {
                doWhenActivity = new DoWhenNamedActivity(ActivityKey_Name, useWhenPredicate, Nodes, isMovementStopRequired);
            }

            if (doWhenActivity != null)
            {
                s_persistedActivities.Add(doWhenActivity);
                QBCLog.DeveloperInfo("DoWhenActivity '{0}' created:{1}",
                                     doWhenActivity.ActivityIdentifier,
                                     doWhenActivity.BuildDebugInfo("    "));
            }
        }