예제 #1
0
        protected override DHJassValue Run()
        {
            trigger t = args["whichTrigger"].HandleValue as trigger;
            if (t == null) return new DHJassHandle(null, 0);

            unit u = args["whichUnit"].HandleValue as unit;
            if (u == null) return new DHJassHandle(null, 0);

            int eventId = args["whichEvent"].IntValue;
            string eventName = unitevent.getName(eventId);

            triggerevent te = new triggerevent(t, eventId);

            switch (eventName)
            {
                case "EVENT_UNIT_DEATH":
                    u.death += te.OnEvent;
                    break;

                case "EVENT_UNIT_SELL_ITEM":
                    u.sell_item += te.OnEvent;
                    break;

                default:
                    if (DHJassExecutor.ShowUnknownEvents)
                        Console.WriteLine("Unknown unitevent: '" + eventName + "'");
                    break;
            }

            return new DHJassHandle(null, te.handle);
        }
예제 #2
0
        protected override DHJassValue Run()
        {
            trigger trigger = args["whichTrigger"].HandleValue as trigger;
            if (trigger == null) return new DHJassHandle(null, 0);

            timer timer = args["timer"].HandleValue as timer;
            if (timer == null) return new DHJassHandle(null, 0);

            triggerevent tevent = new triggerevent(trigger);
            timer.SetCallback(tevent.OnEvent);

            return new DHJassHandle(null, tevent.handle);
        }
예제 #3
0
        protected override DHJassValue Run()
        {
            trigger trigger = args["whichTrigger"].HandleValue as trigger;
            if (trigger == null) return new DHJassHandle(null, 0);

            timer timer = new timer();

            triggerevent tevent = new triggerevent(trigger, timer);
            timer.SetCallback(tevent.OnEvent);

            timer.start(args["timeout"].RealValue, args["periodic"].BoolValue);

            return new DHJassHandle(null, tevent.handle);
        }
예제 #4
0
        protected override DHJassValue Run()
        {
            trigger t = args["whichTrigger"].HandleValue as trigger;
            if (t == null) return new DHJassHandle(null, 0);

            player p = args["whichPlayer"].HandleValue as player;
            if (p == null) return new DHJassHandle(null, 0);

            int eventId = args["whichPlayerUnitEvent"].IntValue;
            string eventName = playerunitevent.getName(eventId);

            triggerevent te = new triggerevent(t, eventId);

            if (t.debugInfo == null || !t.debugInfo.Contains(eventName))
                t.debugInfo += (!string.IsNullOrEmpty(t.debugInfo)? ",":string.Empty) + eventName;

            switch (eventName)
            {
                case "EVENT_PLAYER_UNIT_DEATH":
                    p.unit_death += te.OnEvent;
                    break;

                case "EVENT_PLAYER_HERO_REVIVE_FINISH":
                    break;

                case "EVENT_PLAYER_UNIT_SELL":
                    p.unit_sell += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_SELL_ITEM":
                    p.unit_sell_item += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_PICKUP_ITEM":
                    p.unit_pickup_item += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_SUMMON":
                    p.unit_summon += te.OnEvent;
                    break;

                case "EVENT_PLAYER_HERO_SKILL":
                    p.hero_skill += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_SPELL_CAST":
                    p.unit_spell_cast += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_SPELL_EFFECT":
                    p.unit_spell_effect += te.OnEvent;
                    break;

                case "EVENT_PLAYER_UNIT_ISSUED_ORDER":
                    p.unit_issued_order += te.OnEvent;
                    break;

                default:
                    if (DHJassExecutor.ShowUnknownEvents)
                        Console.WriteLine("Unknown playerunitevent: '" + eventName + "'");
                    break;
            }

            return new DHJassHandle(null, te.handle);
        }
예제 #5
0
        protected override DHJassValue Run()
        {
            trigger t = args["whichTrigger"].HandleValue as trigger;
            if (t == null) return new DHJassHandle(null, 0);

            player p = args["whichPlayer"].HandleValue as player;
            if (p == null) return new DHJassHandle(null, 0);

            int eventId = args["whichPlayerEvent"].IntValue;
            string eventName = playerevent.getName(eventId);

            triggerevent te = new triggerevent(t, eventId);

            switch (eventName)
            {
                case "EVENT_PLAYER_LEAVE":
                    break;

                default:
                    if (DHJassExecutor.ShowUnknownEvents)
                        Console.WriteLine("Unknown playerevent: '" + eventName + "'");
                    break;
            }

            return new DHJassHandle(null, te.handle);
        }
예제 #6
0
        protected override DHJassValue Run()
        {
            trigger trigger = args["whichTrigger"].HandleValue as trigger;
            if (trigger == null) return new DHJassHandle(null, 0);

            player p = args["whichPlayer"].HandleValue as player;
            if (p == null) return new DHJassHandle(null, 0);

            ChatEventHandler ceh = new ChatEventHandler(args["chatMessageToDetect"].StringValue,
                                                        args["exactMatchOnly"].BoolValue);

            triggerevent tevent = new triggerevent(trigger, ceh);
            p.chat += ceh.OnChat;
            ceh.match += tevent.OnEvent;

            return new DHJassHandle(null, tevent.handle);
        }