Ejemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Name">Name</param>
 /// <param name="Definition">Definition</param>
 /// <param name="Type">Type</param>
 /// <param name="ParentTable">Parent table</param>
 public Trigger(string Name, string Definition, TriggerType Type, Table ParentTable)
 {
     this.Name = Name;
     this.Definition = Definition;
     this.Type = Type;
     this.ParentTable = ParentTable;
 }
Ejemplo n.º 2
0
 public ContextCommand( KeyMap keyMap, KeyMap.GameInput input, Action<float> cb, TriggerType triggerType = TriggerType.Down )
 {
     input_ = input;
     callback_ = cb;
     keyMap_ = keyMap;
     triggerType_ = triggerType;
 }
Ejemplo n.º 3
0
 public override void Reset()
 {
     trigger = TriggerType.OnTriggerEnter;
     collideTag = "Untagged";
     sendEvent = null;
     storeCollider = null;
 }
	public DamageAttackerTrigger (string name, Unit caster, int dur, PrefabLibrary el, int dmg, TriggerType TT, Sprite icon = null)
		: base(name, TT, caster, el, dur, icon)
	{
		maxTriggers = -1;
		damage = dmg;
		description = "When this unit takes damage, " + damage.ToString () + " damage is dealt back to the attacker.";
	}
Ejemplo n.º 5
0
 public Trigger( GameWorld world, Texture2D active_texture,
     Texture2D inactive_texture, Vector2 position,
     TriggerableObject triggered_object, TriggerType type,
     float cooldown, float rotation, String name = "Trigger",
     String texture_name = TNames.ground_switch_animate, SharedResourceList<TriggerableObject> t_obj_list = null,
     float scale = 1, float density = DENSITY )
     : base(world, inactive_texture, position, name: name, texture_name: texture_name, density: density)
 {
     m_texture_name = texture_name;
     m_texture_name_helper = texture_name;
     m_active_texture = active_texture;
     m_inactive_texture = inactive_texture;
     m_buffered_position = position;
     m_size_scale = scale;
     m_radius = m_size_scale * ( m_texture.Width ) / ( GameWorld.SCALE * 2 );
     if ( t_obj_list == null ) {
         m_attached_to = new SharedResourceList<TriggerableObject>( world );
     }
     else {
         m_attached_to = t_obj_list;
     }
     if ( triggered_object != null ) {
         m_attached_to.Add( triggered_object );
     }
     m_type = type;
     m_cooldown = cooldown * 60;
     m_cooldown_timer = 0;
     m_deactivated = false;
     m_active = false;
     m_rotation = rotation;
     //m_radius = 0.2f * 5;
 }
Ejemplo n.º 6
0
        public GeneralTrigger(BsonDocument doc, TriggerType triggerType) {
            TriggerOn = new List<string>();
            And = new List<string>();
            NotOn = new List<string>();
            MessageOverrideAsString = new List<string>();
            if (doc != null && doc.ElementCount > 0 && doc.Contains("TriggerOn")) {
                foreach (var on in doc["TriggerOn"].AsBsonArray) {
                    TriggerOn.Add(on.AsString);
                }
                foreach (var and in doc["And"].AsBsonArray) {
                    And.Add(and.AsString);
                }
                foreach (var not in doc["NoTriggerOn"].AsBsonArray) {
                    NotOn.Add(not.AsString);
                }
                AutoProcess = doc.Contains("AutoProcess") ? doc["AutoProcess"].AsBoolean : false;
                ChanceToTrigger = doc["ChanceToTrigger"].AsInt32;
                script = ScriptFactory.GetScript(doc["ScriptID"].AsString, triggerType.ToString());
                foreach (var overrides in doc["Overrides"].AsBsonArray) {
                    MessageOverrideAsString.Add(overrides.AsString);
                }
                Type = doc["Type"].AsString;
				TriggerId = doc["Id"].AsString;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the TriggerAttribute based on the type of trigger and response type
        /// </summary>
        /// <param name="triggerType">Type of trigger implemented by the action in question, either Push or Poll</param>
        /// <param name="responseType">Type of data sent to the Logic App from the trigger. This is used to generate the correct body schema for the Logic App designer.</param>
        public TriggerAttribute(TriggerType triggerType, Type responseType)
            : this(triggerType)
        {
            if (responseType == null) return;

            ResponseType = responseType;
        }
Ejemplo n.º 8
0
        private static BaseTrigger AddTrigger(string name, TriggerType type)
        {
            if (name == null || type.ToString() == null)
            {
                Log.Instance.Error("{0}/ChatBot (unknown trigger): Trigger not defined correctly. Not loading...", name);
                return null;
            }

            BaseTrigger trigger = triggerFactory.CreateTrigger(type, name);
            try
            {
                Log.Instance.Debug(username + "/ChatBot: Testing onload for {0} trigger {1}", type, name);
                if (trigger != null && trigger.OnLoad())
                {
                    Log.Instance.Silly(username + "/ChatBot: onload success for {0} trigger {1}", type, name);
                    triggers.Add(trigger);
                    return trigger;
                }
                else if (trigger != null)
                {
                    Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}", type, name);
                    return null;
                }
            }
            catch (Exception e)
            {
                Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}: {2}", type, name, e.StackTrace);
                return null;
            }
            return null;
        }
Ejemplo n.º 9
0
 public Trigger()
 {
     type = TriggerType.GameRule;
     conflicting = false;
     enabled = true;
     priority = 0;
 }
Ejemplo n.º 10
0
 public AntispamTrigger(TriggerType type, string name, TriggerOptionsBase options)
     : base(type, name, options)
 {
     options.AntiSpamTriggerOptions.groups = new Dictionary<SteamID, Dictionary<SteamID, int>>();
     Timer reducePenT = new Timer(options.AntiSpamTriggerOptions.ptimer.resolution);
     reducePenT.Elapsed += ReducePenT_Tick;
     reducePenT.Start();
 }
	public override void Fire(GameObject offender, TriggerType type = TriggerType.GENERAL)
	{
		Inventory possible_owner = offender.GetComponent<Inventory>();

		if(possible_owner) {
			possible_owner.Pickup(m_Item);
		}
	}
Ejemplo n.º 12
0
        public MyTriggerComponent()
        {
            m_triggerType = TriggerType.AABB;
            UpdateFrequency = 300;

            m_updateOffset = m_triggerCounter++*PRIME%UpdateFrequency;
            DoQuery = true;
        }
Ejemplo n.º 13
0
        public MyTriggerComponent(TriggerType type, uint updateFrequency = 300)
        {
            m_triggerType = type;
            UpdateFrequency = updateFrequency;

            m_updateOffset = m_triggerCounter++*PRIME%UpdateFrequency;
            DoQuery = true;
        }
Ejemplo n.º 14
0
 /**
  * Diese Methode wird vor der Startmethode aufgerufen und setzt wichtige Parameter.
  */
 void Awake()
 {
     Type = TriggerType.PermanentOpen;
     Trigger = TriggerObject.Script;
     Config = GameObject.FindWithTag( "Config" ).GetComponent<Config>();
     Ani = animation;
     NetView = networkView;
 }
Ejemplo n.º 15
0
 public Trigger(MessageInfo msg, TriggerType type)
 {
     this.OnlyOneUse = false;
     this.RunOnReceivedMsg = false;
     this.Conditions = new List<Condition>();
     this.Message = msg;
     this.Type = type;
 }
Ejemplo n.º 16
0
 public BaseTrigger CreateTrigger(TriggerType type, string name)
 {
     if(TriggerTypes.ContainsKey(type.ToString()))
     {
         return new BaseTrigger(type, name);
     }
     return null;
 }
Ejemplo n.º 17
0
 public TriggerEventNotification(string triggerName, string objectName, TriggerType triggerType, TriggerEventType eventType, int invokeCount)
 {
     InvokeCount = invokeCount;
     EventType = eventType;
     ObjectName = objectName;
     TriggerType = triggerType;
     TriggerName = triggerName;
 }
	public override void Fire(GameObject offender, TriggerType type = TriggerType.GENERAL)
	{
		Rigidbody body = offender.GetComponent<Rigidbody>();

		if(body) {
			body.AddForce(PushPower*this.transform.forward);
		}
	}
	public override void Fire(GameObject offender, TriggerType type = TriggerType.GENERAL)
	{
		/*
		WeaponInventory offenderInventory = offender.GetComponent<WeaponInventory>();

		if(offenderInventory)
			offenderInventory.PickupWeapon(m_Weapon);
		//*/
	}
Ejemplo n.º 20
0
 void ProcessMessages(TriggerType triggerType)
 {
     foreach (Message m in messages)
     {
         if(m.target && m.triggerType == triggerType)
         {
             m.target.SendMessage(m.function, m.value);
         }
     }
 }
Ejemplo n.º 21
0
 public SwitchTrigger(LampSwitch a_switch, TriggerType a_triggerType)
 {
     if (a_switch == null)
     {
         throw new ArgumentNullException();
     }
     m_switch = a_switch;
     m_triggerType = a_triggerType;
     m_lastOn = a_switch.isOn();
 }
Ejemplo n.º 22
0
		public TriggerSchema (TriggerSchema trigger)
			: base (trigger)
		{
			tableName = trigger.tableName;
			triggerType = trigger.triggerType;
			triggerFireType = trigger.triggerFireType;
			triggerEvent = trigger.triggerEvent;
			position = trigger.position;
			isActive = trigger.isActive;
			source = trigger.source;
		}
Ejemplo n.º 23
0
 public TriggerableObject( GameWorld world, Texture2D texture,
     Vector2 position, TriggerType type, float rotation = 0, bool invisible = false,
     String name = "TriggerableObject", String texture_name = TNames.bomb, int timer_set = 120 )
     : base(world, texture, position, name: name, texture_name: texture_name, density: DOOR_DENSITY)
 {
     m_timer_checkpoint_set = timer_set;
     m_invisible = invisible;
     m_type = type;
     m_is_active = false;
     m_radius = m_scale.Y * 4;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the ProxyBehavior class.
 /// </summary>
 /// <param name="action">Gives the action to take when this behavior has been selected.</param>
 /// <param name="predicate">Controls in which conditions this behavior will fire. If null, this behavior will always be selected.</param>
 /// <param name="options">Governs how many sessions the behavior should be applied to, and whether there is a expiration time for the behavior.</param>
 /// <param name="type">In conjunction with the behavior selection predicate above, controls when this behavior will fire.</param>
 public ProxyBehavior(
     Action<Session> action, 
     Func<Session, bool> predicate = null,
     BehaviorOptions options = null, 
     TriggerType type = TriggerType.All)
 {
     this.onSessionSelected = action;
     this.behaviorSelectionPredicate = predicate ?? Selectors.Always();
     this.options = options ?? new BehaviorOptions();
     this.type = type;
 }
Ejemplo n.º 25
0
 public Timer(TriggerType type)
 {
     if (!type.IsValidValue() || type == TriggerType.Unknown)
     {
         throw new ArgumentException("Not a valid trigger type", "type");
     }
     Util.GetBPSOrException();
     if (navigator_invoke_timer_registration_create(out handle, type) != BPS.BPS_SUCCESS)
     {
         Util.ThrowExceptionForLastErrno();
     }
 }
Ejemplo n.º 26
0
        protected TriggerInfo(ObjectName triggerName, TriggerType triggerType, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType)
        {
            if (triggerName == null)
                throw new ArgumentNullException("triggerName");
            if (tableName == null)
                throw new ArgumentNullException("tableName");

            TriggerName = triggerName;
            TriggerType = triggerType;
            TableName = tableName;
            EventTime = eventTime;
            EventType = eventType;
        }
Ejemplo n.º 27
0
        internal TriggerEvent(TriggerType triggerType, ObjectName triggerName, ObjectName sourceName, TriggerEventTime eventTime, TriggerEventType eventType, RowId oldRowId, Row newRow)
        {
            if (triggerName == null)
                throw new ArgumentNullException("triggerName");
            if (sourceName == null)
                throw new ArgumentNullException("sourceName");

            TriggerType = triggerType;
            TriggerName = triggerName;
            SourceName = sourceName;
            EventTime = eventTime;
            EventType = eventType;
            OldRowId = oldRowId;
            NewRow = newRow;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Constructs a new trigger information object with the given name,
        /// the name of the table on which it is attached and the event
        /// at which it should be fired.
        /// </summary>
        /// <param name="triggerName">The fully qualified name of the trigger.</param>
        /// <param name="eventType">The modification event on the given table at which to 
        /// fire the trigger.</param>
        /// <param name="triggerType">The type of trigger.</param>
        /// <param name="tableName">The fully qualified name of the table on which to attach
        /// the trigger.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="triggerName"/> is <c>null</c>
        /// </exception>
        public TriggerInfo(ObjectName triggerName, TriggerType triggerType, TriggerEventType eventType, ObjectName tableName)
        {
            if (triggerName == null)
                throw new ArgumentNullException("triggerName");

            if (triggerType == TriggerType.Callback &&
                tableName != null)
                throw new ArgumentException("A CALLBACK TRIGGER cannot define any table to be attached to.");

            TriggerName = triggerName;
            EventType = eventType;
            TableName = tableName;
            TriggerType = triggerType;

            Body = new TriggerBody(this);
        }
Ejemplo n.º 29
0
        public BaseTrigger(TriggerType type, string name, TriggerOptionsBase options)
        {
            if (options.AntiSpamTriggerOptions != null) OptionsType = OptionType.AntiSpamTrigger;
            else if (options.ChatCommand != null) OptionsType = OptionType.ChatCommand;
            else if (options.ChatCommandApi != null) OptionsType = OptionType.ChatCommandAPI;
            else if (options.ChatReply != null) OptionsType = OptionType.ChatReply;
            else if (options.DiscordOptions != null) OptionsType = OptionType.DiscordTrigger;
            else if (options.NoCommand != null) OptionsType = OptionType.NoCommand;
            else if (options.TriggerLists != null && options.TriggerNumbers != null) OptionsType = OptionType.ListsAndNumbers;
            else if (options.TriggerLists != null) OptionsType = OptionType.JustLists;
            else if (options.NoteTriggerOptions != null) OptionsType = OptionType.NoteTriggerOptions;
            else if (options.NotificationOptions != null) OptionsType = OptionType.NotificationOptions;

            Type = type;
            Name = name;
            Options = options;
        }
Ejemplo n.º 30
0
        public PolygonTrigger( GameWorld world, Texture2D active_texture,
            Texture2D inactive_texture, Vector2[] points, TriggerableObject triggered_object = null,
            TriggerType type = TriggerType.FLOOR, float cooldown = -1, float rotation = 0, String name = "Trigger",
            String texture_name = TNames.ground_switch_inactive )
            : base(world, active_texture, inactive_texture, Vector2.Zero, triggered_object, type, cooldown, rotation, name, texture_name)
        {
            Vector2 diff = points[0] - points[(int)Math.Ceiling( points.Length / 2f )];
            float multiplier = Math.Min( Math.Abs( diff.X ), Math.Abs( diff.Y ) );
            m_width_height = new Vector2( multiplier, multiplier ) * 2;

            Vector2 sum = Vector2.Zero;

            foreach ( Vector2 p in points ) {
                sum += p;
            }
            pos = sum / points.Length;
            m_position = pos;

            for ( int i = 0; i < points.Length; i++ ) {
                points[i] -= pos;

            }

            if ( texture_name == TNames.wall && m_is_destructible ) {

                m_texture_name_change = TNames.breakwall;
                //m_texture = GameScreen.GAME_CONTENT.Load<Texture2D>(m_texture_name);
            }
            else if ( texture_name == TNames.tile ) {
                m_texture_name_change = TNames.tile;
                //m_texture = GameScreen.GAME_CONTENT.Load<Texture2D>(m_texture_name);

            }
            m_points = points;

            Vertices verts = new Vertices( points );
            Vertices collinear_simplified = SimplifyTools.CollinearSimplify( verts );
            Vertices merge_simplified = SimplifyTools.MergeIdenticalPoints( collinear_simplified );
            //Since it is a concave polygon, we need to partition it into several smaller convex polygons
            //List<Vertices> vert_list = BayazitDecomposer.ConvexPartition(merge_simplified);

            verts = merge_simplified;
            verts.ForceCounterClockWise();
            m_points = verts.ToArray();
        }
Ejemplo n.º 31
0
 public static ApplicationEngine Create(TriggerType trigger, IVerifiable container, DataCache snapshot, Block persistingBlock = null, ProtocolSettings settings = null, long gas = TestModeGas)
 {
     return(applicationEngineProvider?.Create(trigger, container, snapshot, persistingBlock, settings, gas)
            ?? new ApplicationEngine(trigger, container, snapshot, persistingBlock, settings, gas));
 }
Ejemplo n.º 32
0
 internal InteropDescriptor(string method, Func <ApplicationEngine, bool> handler, long price, TriggerType allowedTriggers, CallFlags requiredCallFlags)
     : this(method, handler, allowedTriggers, requiredCallFlags)
 {
     this.Price = price;
 }
Ejemplo n.º 33
0
    void Trigger(Collider2D collision, TriggerType type)
    {
        if (collision != null)
        {
            initiator = collision.GetComponent <SquadTriggerInitiator>();
        }

        if ((collision == null || (initiator != null && initiator.Squad != null && initiator.Squad == Squad.playerSquadInstance)) && ConstraintsAreTrue())
        {
            switch (type)
            {
            case TriggerType.STAY:
                if (OnPlayerTriggerStay != null)
                {
                    if (OnPlayerTriggerStay())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.ENTER:
                if (OnPlayerTriggerEnter != null)
                {
                    if (OnPlayerTriggerEnter())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.EXIT:
                if (OnPlayerTriggerExit != null)
                {
                    if (OnPlayerTriggerExit())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.PDOWN:
                if (OnPlayerTriggerPoinderDown != null)
                {
                    if (OnPlayerTriggerPoinderDown())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.PUP:
                if (OnPlayerTriggerPoinderUp != null)
                {
                    if (OnPlayerTriggerPoinderUp())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.PCLICK:
                if (OnPlayerTriggerPointerClick != null)
                {
                    if (OnPlayerTriggerPointerClick())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.PDROP:
                if (OnPlayerTriggerPointerDrop != null)
                {
                    if (OnPlayerTriggerPointerDrop())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.DISABLE:
                if (OnPlayerTriggerDisable != null)
                {
                    if (OnPlayerTriggerDisable())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;

            case TriggerType.ENABLE:
                if (OnPlayerTriggerEnable != null)
                {
                    if (OnPlayerTriggerEnable())
                    {
                        DestroyOnTriggerActivates(type);
                    }
                }
                break;
            }
        }
    }
Ejemplo n.º 34
0
 public Trigger(TriggerType type, string parameter = null)
 {
     Type      = type;
     Parameter = parameter;
 }
Ejemplo n.º 35
0
 //破壊条件
 public bool DestTriggerCheck(TriggerType type)
 {
     return(State.trigger == type);
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Used with Delayed Effects (Trigger at the end of the delay)
        /// </summary>
        /// <param name="target"></param>
        /// <param name="dispelable"></param>
        /// <param name="trigger"></param>
        /// <param name="applyTrigger"></param>
        /// <param name="delay"></param>
        /// <returns></returns>
        protected TriggerBuff AddTriggerBuff(Fighter target, FightDispellableEnum dispelable, TriggerType trigger, TriggerBuff.TriggerBuffApplyHandler applyTrigger, short delay)
        {
            int         id          = target.BuffIdProvider.Pop();
            TriggerBuff triggerBuff = new TriggerBuff(id, target, this.Source, this.SpellLevel, this.Effect, this.SpellId, this.Critical, dispelable, trigger, applyTrigger, delay);

            target.AddAndApplyBuff(triggerBuff, true);
            return(triggerBuff);
        }
 protected virtual bool IsContainTrigger(TriggerType triggerType)
 {
     return(Trigger.Contains(triggerType));
 }
Ejemplo n.º 38
0
 public IsUpTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Ejemplo n.º 39
0
        /// <summary>
        /// Read triggers from username/triggers/
        /// </summary>
        /// <returns>A list of BaseTrigger objects</returns>
        public static List <BaseTrigger> ReadTriggers()
        {
            List <BaseTrigger>   temp  = new List <BaseTrigger>();
            IEnumerable <string> files = Directory.EnumerateFiles(Bot.username + "/triggers/");

            foreach (string file in files)
            {
                /*
                 * int start = file.IndexOf("triggers/") + "triggers/".Length;
                 * int end = file.IndexOf(".", start);
                 * string _file = file.Substring(start, end - start);
                 */

                TriggerOptionsBase options = JsonConvert.DeserializeObject <TriggerOptionsBase>(File.ReadAllText(file));
                TriggerType        type    = options.Type;
                string             name    = options.Name;

                switch (type)
                {
                case TriggerType.AcceptChatInviteTrigger:
                    temp.Add(new AcceptChatInviteTrigger(type, name, options));
                    break;

                case TriggerType.AcceptFriendRequestTrigger:
                    temp.Add(new AcceptFriendRequestTrigger(type, name, options));
                    break;

                case TriggerType.AntispamTrigger:
                    temp.Add(new AntispamTrigger(type, name, options));
                    break;

                case TriggerType.AutojoinChatTrigger:
                    temp.Add(new AutojoinChatTrigger(type, name, options));
                    break;

                case TriggerType.BanCheckTrigger:
                    temp.Add(new BanCheckTrigger(type, name, options));
                    break;

                case TriggerType.BanTrigger:
                    temp.Add(new BanTrigger(type, name, options));
                    break;

                case TriggerType.ChangeNameTrigger:
                    temp.Add(new ChangeNameTrigger(type, name, options));
                    break;

                case TriggerType.ChatReplyTrigger:
                    temp.Add(new ChatReplyTrigger(type, name, options));
                    break;

                case TriggerType.DiscordTrigger:
                    temp.Add(new DiscordTrigger(type, name, options));
                    break;

                case TriggerType.DoormatTrigger:
                    temp.Add(new DoormatTrigger(type, name, options));
                    break;

                case TriggerType.GoogleTrigger:
                    temp.Add(new GoogleTrigger(type, name, options));
                    break;

                case TriggerType.IsUpTrigger:
                    temp.Add(new IsUpTrigger(type, name, options));
                    break;

                case TriggerType.KickTrigger:
                    temp.Add(new KickTrigger(type, name, options));
                    break;

                case TriggerType.LeaveChatTrigger:
                    temp.Add(new LeaveChatTrigger(type, name, options));
                    break;

                case TriggerType.LinkNameTrigger:
                    temp.Add(new LinkNameTrigger(type, name, options));
                    break;

                case TriggerType.LockChatTrigger:
                    temp.Add(new LockChatTrigger(type, name, options));
                    break;

                case TriggerType.MessageIntervalTrigger:
                    temp.Add(new MessageIntervalTrigger(type, name, options));
                    break;

                case TriggerType.ModerateChatTrigger:
                    temp.Add(new ModerateChatTrigger(type, name, options));
                    break;

                case TriggerType.NoteTrigger:
                    temp.Add(new NoteTrigger(type, name, options));
                    break;

                case TriggerType.NotificationTrigger:
                    temp.Add(new NotificationTrigger(type, name, options));
                    break;

                case TriggerType.PlayGameTrigger:
                    temp.Add(new PlayGameTrigger(type, name, options));
                    break;

                case TriggerType.UnbanTrigger:
                    temp.Add(new UnbanTrigger(type, name, options));
                    break;

                case TriggerType.UnlockChatTrigger:
                    temp.Add(new UnlockChatTrigger(type, name, options));
                    break;

                case TriggerType.UnmoderateChatTrigger:
                    temp.Add(new UnmoderateChatTrigger(type, name, options));
                    break;

                case TriggerType.WeatherTrigger:
                    temp.Add(new WeatherTrigger(type, name, options));
                    break;

                case TriggerType.YoutubeTrigger:
                    temp.Add(new YoutubeTrigger(type, name, options));
                    break;

                default:
                    break;
                }
            }
            return(temp);
        }
 public TestEngine(TriggerType trigger, IVerifiable container, DataCache snapshot, Block persistingBlock, ProtocolSettings settings, long gas)
     : base(trigger, container, snapshot, persistingBlock, settings, gas)
 {
 }
 public ApplicationEngine Create(TriggerType trigger, IVerifiable container, DataCache snapshot, Block persistingBlock, ProtocolSettings settings, long gas)
 {
     return(new TestEngine(trigger, container, snapshot, persistingBlock, settings, gas));
 }
Ejemplo n.º 42
0
 public ShieldWithTrigger(string name, string description, int power, TriggerType type, int shield)
     : base(name, description, power, type)
 {
     Shield = new Shield(name, description, power, shield);
 }
Ejemplo n.º 43
0
 public NativeNEP5Service(ZoroService service, TriggerType trigger, Snapshot snapshot)
 {
     Service  = service;
     Trigger  = trigger;
     Snapshot = snapshot;
 }
Ejemplo n.º 44
0
        public TriggerBuff AddTriggerBuff(Fighter target, FightDispellableEnum dispelable, TriggerType trigger, TriggerBuff.TriggerBuffApplyHandler applyTrigger, Symbioz.World.Providers.Fights.Buffs.TriggerBuff.TriggerBuffRemoveHandler removeTrigger)
        {
            int         id          = target.BuffIdProvider.Pop();
            TriggerBuff triggerBuff = new TriggerBuff(id, target, this.Source, this.SpellLevel, this.Effect, this.SpellId, this.Critical, dispelable, trigger, applyTrigger, removeTrigger, -1);

            target.AddAndApplyBuff(triggerBuff, true);
            return(triggerBuff);
        }
Ejemplo n.º 45
0
 /// <summary>
 /// Adds a trigger to the table
 /// </summary>
 /// <param name="Name">Name of the trigger</param>
 /// <param name="Definition">Definition of the trigger</param>
 /// <param name="Type">Trigger type</param>
 /// <returns>The trigger specified</returns>
 public override ITrigger AddTrigger(string Name, string Definition, TriggerType Type)
 {
     return(Triggers.AddAndReturn(new Trigger(Name, Definition, Type, this)));
 }
Ejemplo n.º 46
0
 public static ApplicationEngine Create(TriggerType trigger, IVerifiable container, StoreView snapshot, long gas = TestModeGas)
 {
     return(applicationEngineProvider?.Create(trigger, container, snapshot, gas)
            ?? new ApplicationEngine(trigger, container, snapshot, gas));
 }
Ejemplo n.º 47
0
 public virtual bool SetTriggerMode(bool extTrigger, TriggerType chosenTrigger)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Neo互操作服务构造函数
        /// </summary>
        /// <param name="trigger">触发器类型</param>
        /// <param name="snapshot">数据库的快照</param>
        public NeoService(TriggerType trigger, Snapshot snapshot)
            : base(trigger, snapshot)
        {
            Register("Neo.Runtime.GetTrigger", Runtime_GetTrigger, 1);
            Register("Neo.Runtime.CheckWitness", Runtime_CheckWitness, 200);
            Register("Neo.Runtime.Notify", Runtime_Notify, 1);
            Register("Neo.Runtime.Log", Runtime_Log, 1);
            Register("Neo.Runtime.GetTime", Runtime_GetTime, 1);
            Register("Neo.Runtime.Serialize", Runtime_Serialize, 1);
            Register("Neo.Runtime.Deserialize", Runtime_Deserialize, 1);
            Register("Neo.Blockchain.GetHeight", Blockchain_GetHeight, 1);
            Register("Neo.Blockchain.GetHeader", Blockchain_GetHeader, 100);
            Register("Neo.Blockchain.GetBlock", Blockchain_GetBlock, 200);
            Register("Neo.Blockchain.GetTransaction", Blockchain_GetTransaction, 100);
            Register("Neo.Blockchain.GetTransactionHeight", Blockchain_GetTransactionHeight, 100);
            Register("Neo.Blockchain.GetAccount", Blockchain_GetAccount, 100);
            Register("Neo.Blockchain.GetValidators", Blockchain_GetValidators, 200);
            Register("Neo.Blockchain.GetAsset", Blockchain_GetAsset, 100);
            Register("Neo.Blockchain.GetContract", Blockchain_GetContract, 100);
            Register("Neo.Header.GetHash", Header_GetHash, 1);
            Register("Neo.Header.GetVersion", Header_GetVersion, 1);
            Register("Neo.Header.GetPrevHash", Header_GetPrevHash, 1);
            Register("Neo.Header.GetMerkleRoot", Header_GetMerkleRoot, 1);
            Register("Neo.Header.GetTimestamp", Header_GetTimestamp, 1);
            Register("Neo.Header.GetIndex", Header_GetIndex, 1);
            Register("Neo.Header.GetConsensusData", Header_GetConsensusData, 1);
            Register("Neo.Header.GetNextConsensus", Header_GetNextConsensus, 1);
            Register("Neo.Block.GetTransactionCount", Block_GetTransactionCount, 1);
            Register("Neo.Block.GetTransactions", Block_GetTransactions, 1);
            Register("Neo.Block.GetTransaction", Block_GetTransaction, 1);
            Register("Neo.Transaction.GetHash", Transaction_GetHash, 1);
            Register("Neo.Transaction.GetType", Transaction_GetType, 1);
            Register("Neo.Transaction.GetAttributes", Transaction_GetAttributes, 1);
            Register("Neo.Transaction.GetInputs", Transaction_GetInputs, 1);
            Register("Neo.Transaction.GetOutputs", Transaction_GetOutputs, 1);
            Register("Neo.Transaction.GetReferences", Transaction_GetReferences, 200);
            Register("Neo.Transaction.GetUnspentCoins", Transaction_GetUnspentCoins, 200);
            Register("Neo.Transaction.GetWitnesses", Transaction_GetWitnesses, 200);
            Register("Neo.InvocationTransaction.GetScript", InvocationTransaction_GetScript, 1);
            Register("Neo.Witness.GetVerificationScript", Witness_GetVerificationScript, 100);
            Register("Neo.Attribute.GetUsage", Attribute_GetUsage, 1);
            Register("Neo.Attribute.GetData", Attribute_GetData, 1);
            Register("Neo.Input.GetHash", Input_GetHash, 1);
            Register("Neo.Input.GetIndex", Input_GetIndex, 1);
            Register("Neo.Output.GetAssetId", Output_GetAssetId, 1);
            Register("Neo.Output.GetValue", Output_GetValue, 1);
            Register("Neo.Output.GetScriptHash", Output_GetScriptHash, 1);
            Register("Neo.Account.GetScriptHash", Account_GetScriptHash, 1);
            Register("Neo.Account.GetVotes", Account_GetVotes, 1);
            Register("Neo.Account.GetBalance", Account_GetBalance, 1);
            Register("Neo.Account.IsStandard", Account_IsStandard, 100);
            Register("Neo.Asset.Create", Asset_Create);
            Register("Neo.Asset.Renew", Asset_Renew);
            Register("Neo.Asset.GetAssetId", Asset_GetAssetId, 1);
            Register("Neo.Asset.GetAssetType", Asset_GetAssetType, 1);
            Register("Neo.Asset.GetAmount", Asset_GetAmount, 1);
            Register("Neo.Asset.GetAvailable", Asset_GetAvailable, 1);
            Register("Neo.Asset.GetPrecision", Asset_GetPrecision, 1);
            Register("Neo.Asset.GetOwner", Asset_GetOwner, 1);
            Register("Neo.Asset.GetAdmin", Asset_GetAdmin, 1);
            Register("Neo.Asset.GetIssuer", Asset_GetIssuer, 1);
            Register("Neo.Contract.Create", Contract_Create);
            Register("Neo.Contract.Migrate", Contract_Migrate);
            Register("Neo.Contract.Destroy", Contract_Destroy, 1);
            Register("Neo.Contract.GetScript", Contract_GetScript, 1);
            Register("Neo.Contract.IsPayable", Contract_IsPayable, 1);
            Register("Neo.Contract.GetStorageContext", Contract_GetStorageContext, 1);
            Register("Neo.Storage.GetContext", Storage_GetContext, 1);
            Register("Neo.Storage.GetReadOnlyContext", Storage_GetReadOnlyContext, 1);
            Register("Neo.Storage.Get", Storage_Get, 100);
            Register("Neo.Storage.Put", Storage_Put);
            Register("Neo.Storage.Delete", Storage_Delete, 100);
            Register("Neo.Storage.Find", Storage_Find, 1);
            Register("Neo.StorageContext.AsReadOnly", StorageContext_AsReadOnly, 1);
            Register("Neo.Enumerator.Create", Enumerator_Create, 1);
            Register("Neo.Enumerator.Next", Enumerator_Next, 1);
            Register("Neo.Enumerator.Value", Enumerator_Value, 1);
            Register("Neo.Enumerator.Concat", Enumerator_Concat, 1);
            Register("Neo.Iterator.Create", Iterator_Create, 1);
            Register("Neo.Iterator.Key", Iterator_Key, 1);
            Register("Neo.Iterator.Keys", Iterator_Keys, 1);
            Register("Neo.Iterator.Values", Iterator_Values, 1);

            #region Aliases
            Register("Neo.Iterator.Next", Enumerator_Next, 1);
            Register("Neo.Iterator.Value", Enumerator_Value, 1);
            #endregion

            #region Old APIs
            Register("AntShares.Runtime.CheckWitness", Runtime_CheckWitness, 200);
            Register("AntShares.Runtime.Notify", Runtime_Notify, 1);
            Register("AntShares.Runtime.Log", Runtime_Log, 1);
            Register("AntShares.Blockchain.GetHeight", Blockchain_GetHeight, 1);
            Register("AntShares.Blockchain.GetHeader", Blockchain_GetHeader, 100);
            Register("AntShares.Blockchain.GetBlock", Blockchain_GetBlock, 200);
            Register("AntShares.Blockchain.GetTransaction", Blockchain_GetTransaction, 100);
            Register("AntShares.Blockchain.GetAccount", Blockchain_GetAccount, 100);
            Register("AntShares.Blockchain.GetValidators", Blockchain_GetValidators, 200);
            Register("AntShares.Blockchain.GetAsset", Blockchain_GetAsset, 100);
            Register("AntShares.Blockchain.GetContract", Blockchain_GetContract, 100);
            Register("AntShares.Header.GetHash", Header_GetHash, 1);
            Register("AntShares.Header.GetVersion", Header_GetVersion, 1);
            Register("AntShares.Header.GetPrevHash", Header_GetPrevHash, 1);
            Register("AntShares.Header.GetMerkleRoot", Header_GetMerkleRoot, 1);
            Register("AntShares.Header.GetTimestamp", Header_GetTimestamp, 1);
            Register("AntShares.Header.GetConsensusData", Header_GetConsensusData, 1);
            Register("AntShares.Header.GetNextConsensus", Header_GetNextConsensus, 1);
            Register("AntShares.Block.GetTransactionCount", Block_GetTransactionCount, 1);
            Register("AntShares.Block.GetTransactions", Block_GetTransactions, 1);
            Register("AntShares.Block.GetTransaction", Block_GetTransaction, 1);
            Register("AntShares.Transaction.GetHash", Transaction_GetHash, 1);
            Register("AntShares.Transaction.GetType", Transaction_GetType, 1);
            Register("AntShares.Transaction.GetAttributes", Transaction_GetAttributes, 1);
            Register("AntShares.Transaction.GetInputs", Transaction_GetInputs, 1);
            Register("AntShares.Transaction.GetOutputs", Transaction_GetOutputs, 1);
            Register("AntShares.Transaction.GetReferences", Transaction_GetReferences, 200);
            Register("AntShares.Attribute.GetUsage", Attribute_GetUsage, 1);
            Register("AntShares.Attribute.GetData", Attribute_GetData, 1);
            Register("AntShares.Input.GetHash", Input_GetHash, 1);
            Register("AntShares.Input.GetIndex", Input_GetIndex, 1);
            Register("AntShares.Output.GetAssetId", Output_GetAssetId, 1);
            Register("AntShares.Output.GetValue", Output_GetValue, 1);
            Register("AntShares.Output.GetScriptHash", Output_GetScriptHash, 1);
            Register("AntShares.Account.GetScriptHash", Account_GetScriptHash, 1);
            Register("AntShares.Account.GetVotes", Account_GetVotes, 1);
            Register("AntShares.Account.GetBalance", Account_GetBalance, 1);
            Register("AntShares.Asset.Create", Asset_Create);
            Register("AntShares.Asset.Renew", Asset_Renew);
            Register("AntShares.Asset.GetAssetId", Asset_GetAssetId, 1);
            Register("AntShares.Asset.GetAssetType", Asset_GetAssetType, 1);
            Register("AntShares.Asset.GetAmount", Asset_GetAmount, 1);
            Register("AntShares.Asset.GetAvailable", Asset_GetAvailable, 1);
            Register("AntShares.Asset.GetPrecision", Asset_GetPrecision, 1);
            Register("AntShares.Asset.GetOwner", Asset_GetOwner, 1);
            Register("AntShares.Asset.GetAdmin", Asset_GetAdmin, 1);
            Register("AntShares.Asset.GetIssuer", Asset_GetIssuer, 1);
            Register("AntShares.Contract.Create", Contract_Create);
            Register("AntShares.Contract.Migrate", Contract_Migrate);
            Register("AntShares.Contract.Destroy", Contract_Destroy, 1);
            Register("AntShares.Contract.GetScript", Contract_GetScript, 1);
            Register("AntShares.Contract.GetStorageContext", Contract_GetStorageContext, 1);
            Register("AntShares.Storage.GetContext", Storage_GetContext, 1);
            Register("AntShares.Storage.Get", Storage_Get, 100);
            Register("AntShares.Storage.Put", Storage_Put);
            Register("AntShares.Storage.Delete", Storage_Delete, 100);
            #endregion
        }
Ejemplo n.º 49
0
        private ToolStripMenuItem WindowsAudioPatternMenu(Sound sound, Rule rule, string buildDefinitionId, TriggerType triggerType, string person)
        {
            bool patternIsMatch = false;

            if (rule != null && !string.IsNullOrEmpty(rule.WindowsAudioLocation))
            {
                patternIsMatch = sound.Location == rule.WindowsAudioLocation;
            }
            var menu = new ToolStripMenuItem(sound.DisplayName)
            {
                Checked = patternIsMatch,
                Tag     = new RuleDropDownItemTag
                {
                    AlertType            = null,
                    BuildDefinitionId    = buildDefinitionId,
                    TriggerPerson        = person,
                    TriggerType          = triggerType,
                    LedPattern           = null,
                    WindowsAudioLocation = sound.Location,
                    AudioPattern         = null,
                    Duration             = null
                }
            };

            menu.Click += RuleDropDownItemClick;
            return(menu);
        }
Ejemplo n.º 50
0
 public static void InvokeTrigger(this Entity entity, TriggerType triggerType, Type attributeType)
 {
     InvokeTrigger(entity, triggerType, attributeType.GetCustomAttributes(typeof(TriggerAttribute), false).OfType <TriggerAttribute>());
 }
Ejemplo n.º 51
0
 private bool TurnBegin(TriggerBuff buff, TriggerType trigger, object token)
 {
     return(true);
 }
Ejemplo n.º 52
0
        private ToolStripMenuItem AudioPatternMenu(AudioPattern ap, Rule rule, string buildDefinitionId, TriggerType triggerType, string person)
        {
            bool patternIsMatch = false;

            if (rule != null && !rule.InheritAudioSettings && rule.AudioPattern != null)
            {
                patternIsMatch = rule.AudioPattern.Equals(ap);
            }
            var menu = new ToolStripMenuItem(ap.Name)
            {
                Checked = patternIsMatch
            };

            AddToolStripItems(menu.DropDownItems, GetDurations(rule, null, ap, patternIsMatch, buildDefinitionId, triggerType, person));
            return(menu);
        }
Ejemplo n.º 53
0
 public TestEngine(TriggerType trigger = TriggerType.Application, IVerifiable verificable = null, StoreView snapshot = null)
     : base(trigger, verificable, snapshot ?? new TestSnapshot(), TestGas)
 {
     Scripts = new Dictionary <string, BuildScript>();
 }
Ejemplo n.º 54
0
        private IEnumerable <ToolStripMenuItem> GetDurations(Rule rule, LedPattern ledPattern, AudioPattern audioPattern, bool patternIsMatch, string buildDefinitionId, TriggerType triggerType, string person)
        {
            int?duration = null;

            if (rule != null)
            {
                duration = ledPattern == null ? rule.AudioDuration : rule.LightsDuration;
            }

            var durations = _durations.Select(d => new ToolStripMenuItem(d.Value)
            {
                Checked = patternIsMatch && duration == d.Key,
                Tag     = new RuleDropDownItemTag
                {
                    AlertType         = null,
                    BuildDefinitionId = buildDefinitionId,
                    TriggerPerson     = person,
                    TriggerType       = triggerType,
                    LedPattern        = ledPattern,
                    AudioPattern      = audioPattern,
                    Duration          = d.Key
                }
            }).ToArray();

            foreach (var toolStripMenuItem in durations)
            {
                toolStripMenuItem.Click += RuleDropDownItemClick;
            }
            return(durations);
        }
Ejemplo n.º 55
0
 public bool AcceptsTrigger(TriggerType type)
 {
     return(triggerTypes.Contains(type));
 }
Ejemplo n.º 56
0
    public void SetEffect(EffectPlayType pType, EffectType etype, int value, int turn = 0, Target target = null, int cost = 0, TriggerType trigger = TriggerType.None, GameObject animEffect = null)
    {
        if (etype == EffectType.AttackPower || etype == EffectType.SkillPower)
        {
            SetPower(etype, value);
            return;
        }
        CardEffect effect;

        switch (pType)
        {
        case EffectPlayType.triggerEffect:
            effect = new TriggerEffect()
            {
                TriggerType = trigger
            };
            break;

        case EffectPlayType.staticEffect:
            effect = new StaticEffect();
            break;

        case EffectPlayType.playEffect:
            effect = new PlayEffect();
            break;

        case EffectPlayType.activeEffect:
            effect = new ActiveEffect(cost);
            break;

        case EffectPlayType.none:
        default:
            effect = new CardEffect();
            break;
        }
        //カード効果に応じてアニメーション設定
        if (animEffect == null)
        {
            switch (etype)
            {
            case EffectType.CostAdd:
            case EffectType.UnitCostAdd:
            case EffectType.SkillDamageAdd:
            case EffectType.AttackAdd:
            case EffectType.AttackTime:
                animEffect = null;
                break;

            case EffectType.CardDest:
            case EffectType.RandCardDest: break;

            case EffectType.CardDraft:
            case EffectType.CardDraw:
            case EffectType.GetDisZoneCard:
            case EffectType.CardUnDraft:
            case EffectType.GetDispCard: break;

            case EffectType.Counter: break;

            case EffectType.Damage:
                animEffect = Resources.Load <GameObject>(Constants.CARD_EFFECT_MAGICK_FIRE);
                break;

            case EffectType.Heal:
                animEffect = Resources.Load <GameObject>(Constants.CARD_EFFECT_HEAL);
                break;
            }
        }
        effect.effectState.Add(new EffectState(etype, value, turn, target, animEffect));
        Effect.Add(effect);
    }
Ejemplo n.º 57
0
 /// <summary>
 /// Adds a trigger to the table
 /// </summary>
 /// <param name="Name">Name of the trigger</param>
 /// <param name="Definition">Definition of the trigger</param>
 /// <param name="Type">Trigger type</param>
 /// <returns>The trigger specified</returns>
 public override ITrigger AddTrigger(string Name, string Definition, TriggerType Type)
 {
     return(null);
 }
Ejemplo n.º 58
0
 public TriggerInfo(TriggerType type, TriggerValue[] triggers = null)
 {
     triggerType   = type;
     triggerValues = triggers;
 }
Ejemplo n.º 59
0
 public static void InvokeTrigger(this Entity entity, TriggerType triggerType, PropertyInfo propertyInfo)
 {
     InvokeTrigger(entity, triggerType, propertyInfo.GetCustomAttributes(typeof(TriggerAttribute), false).OfType <TriggerAttribute>());
 }
Ejemplo n.º 60
0
 public StoryScript(TriggerType type, TriggerValue[] triggers = null)
 {
     RequiredTrigger = new TriggerInfo(type, triggers);
     AccumulatedTime = 0f;
     IsCompleted     = false;
 }