Exemple #1
0
 public Stealth(SkillArg arg)
     : base(arg.Caster, "Stealth", 6000)
 {
     this.arg         = arg;
     OnAdditionStart += new StartEventHandler(Stealth_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(Stealth_OnAdditionEnd);
 }
Exemple #2
0
 public Mine(SkillArg arg)
     : base(arg.Caster, "Mine", 10000)
 {
     this.arg         = arg;
     OnAdditionStart += new StartEventHandler(Mine_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(Mine_OnAdditionEnd);
 }
        /// <summary>
        /// Starts the packet diversion with the given number of threads.
        /// </summary>
        /// <param name="numThreads">
        /// The number of threads to use for diversion. If equal to or less than zero, will default
        /// to Environment.ProcessorCount.
        /// </param>
        /// <remarks>
        /// The number of threads ought not to exceed Environment.ProcessorCount but this is not
        /// enforced with a bounds check.
        /// </remarks>
        public void Start(int numThreads, StartEventHandler startHandler = null)
        {
            lock (m_startStopLock)
            {
                if (m_running)
                {
                    return;
                }

                if (numThreads <= 0)
                {
                    numThreads = Environment.ProcessorCount;
                }

                m_diversionThreads = new List <Thread>();

#if ENGINE_NO_BLOCK_TOR
                string mainFilterString = "outbound and tcp and ((ip and ip.SrcAddr != 127.0.0.1) or (ipv6 and ipv6.SrcAddr != ::1))";
#else
                string mainFilterString = "outbound and tcp";
#endif
                string QUICFilterString = "udp and (udp.DstPort == 80 || udp.DstPort == 443)";

                m_diversionHandle = WinDivert.WinDivertOpen(mainFilterString, WinDivertLayer.Network, -1000, 0);

                if (m_diversionHandle == s_InvalidHandleValue || m_diversionHandle == IntPtr.Zero)
                {
                    // Invalid handle value.
                    throw new Exception(string.Format("Failed to open main diversion handle. Got Win32 error code {0}.", Marshal.GetLastWin32Error()));
                }

                m_QUICDropHandle = WinDivert.WinDivertOpen(QUICFilterString, WinDivertLayer.Network, -999, WinDivertOpenFlags.Drop);

                if (m_QUICDropHandle == s_InvalidHandleValue || m_QUICDropHandle == IntPtr.Zero)
                {
                    // Invalid handle value.
                    throw new Exception(string.Format("Failed to open QUIC diversion handle. Got Win32 error code {0}.", Marshal.GetLastWin32Error()));
                }

                // Set everything to maximum values.
                WinDivert.WinDivertSetParam(m_diversionHandle, WinDivertParam.QueueLen, 16384);
                WinDivert.WinDivertSetParam(m_diversionHandle, WinDivertParam.QueueTime, 8000);
                WinDivert.WinDivertSetParam(m_diversionHandle, WinDivertParam.QueueSize, 33554432);

                m_running = true;

                for (int i = 0; i < numThreads; ++i)
                {
                    m_diversionThreads.Add(new Thread(() =>
                    {
                        RunDiversion();
                    }));

                    m_diversionThreads.Last().Start();
                }

                startHandler?.Invoke();
            }
        }
Exemple #4
0
 public Teleport(SkillArg arg, Dictionary <SagaBNS.Common.Item.Item, ushort> items)
     : base(arg.Caster, "Teleport", 10000)
 {
     this.arg         = arg;
     this.items       = items;
     OnAdditionStart += new StartEventHandler(Teleport_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(Teleport_OnAdditionEnd);
 }
Exemple #5
0
 public Repair(SkillArg arg, Dictionary <SagaBNS.Common.Item.Item, ushort> items)
     : base(arg.Caster, "Repair", 7500)
 {
     this.arg         = arg;
     this.items       = items;
     OnAdditionStart += new StartEventHandler(Repair_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(Repair_OnAdditionEnd);
 }
Exemple #6
0
        public Frost(SkillArg arg, ActorExt target)
            : base(target, "Frost", 6400)
        {
            this.arg    = arg;
            this.target = target;

            OnAdditionStart += new StartEventHandler(Frost_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(Frost_OnAdditionEnd);
        }
Exemple #7
0
 public ActorFrosen(SkillArg arg, ActorExt target, uint additionID, int damage = 0, int duration = 5000)
     : base(target, "ActorFrosen", duration)
 {
     this.arg         = arg;
     this.target      = target;
     this.additionID  = additionID;
     this.damage      = damage;
     OnAdditionStart += new StartEventHandler(ActorFrosen_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(ActorFrosen_OnAdditionEnd);
 }
Exemple #8
0
        public App()
        {
            currentApp       = this;
            started          = new StartEventHandler(() => { });
            stopped          = new StopEventHandler(() => { });
            restarted        = new RestartEventHandler(() => { });
            authorized       = new AuthorizedEventHandler(() => { });
            stackSettingView = new List <View>();

            activationLink = "";
            InitializeComponent();

            thisTabbedPage = new TabbedPage1();
            thisTabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetIsSwipePagingEnabled(true);

            MainPage = thisTabbedPage;

            //通知(App側で一括管理)
            DependencyService.Get <INotificationService>().Regist();

            //すでに認証しているか確認
            string aToken  = "";
            string aSecret = "";
            string path    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + accessTokenFilePath;

            if (File.Exists(path))
            {
                StreamReader readFile = new StreamReader(path, Encoding.GetEncoding("utf-16"));
                aToken  = readFile.ReadLine();
                aSecret = readFile.ReadLine();
                readFile.Close();
                t = CoreTweet.Tokens.Create(cKey, cSecret, aToken, aSecret);
                try
                {
                    UserResponse result = t.Account.VerifyCredentials();
                    t.UserId     = (long)result.Id;
                    t.ScreenName = result.ScreenName;
                }
                catch (Exception)
                {
                    t = null;
                }
            }

            if (t == null)
            {
                //認証していない場合は認証を行う。
                (getContentPage("MainBrowser") as MainBrowser).web.authorizeAPI(cKey, cSecret);
            }
            else
            {
                (getContentPage("MainBrowser") as MainBrowser).web.twitterStart();
                authorized();
            }
        }
Exemple #9
0
 public FireSelf(SkillArg arg)
     : base(arg.Caster, "FireSelf", 10000)
 {
     this.arg = arg;
     if (arg.Caster.Tasks.TryGetValue("FireSelf", out Task task))
     {
         task.Deactivate();
     }
     arg.Caster.Tasks["FireSelf"] = this;
     OnAdditionStart += new StartEventHandler(Fire_OnAdditionStart);
     OnAdditionEnd   += new EndEventHandler(Fire_OnAdditionEnd);
 }
Exemple #10
0
        public DieTask(GameSession client)
            : base(client.Character, "DieTask", 80000)
        {
            this.client      = client;
            OnAdditionStart += new StartEventHandler(DieTask_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(DieTask_OnAdditionEnd);

            if (client.Character.Tasks.TryRemove("DieTask", out Task removed))
            {
                removed.Deactivate();
            }
        }
Exemple #11
0
    //事件函数
    public void CameraMoveBegin()
    {
        isMoving         = true;
        player.isPausing = true;

        //广播并清除事件
        if (startEvent != null)
        {
            startEvent();
        }
        startEvent = null;
    }
Exemple #12
0
        public Poisening(SkillArg arg)
            : base(arg.Caster, "Poisening", 30000)
        {
            this.arg = arg;
            if (arg.Caster.Tasks.TryRemove("Poisening", out Task removed))
            {
                removed.Deactivate();
            }

            arg.Caster.Tasks["Poisening"] = this;
            OnAdditionStart += new StartEventHandler(Poisening_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(Poisening_OnAdditionEnd);
        }
Exemple #13
0
        public MovementLock(GameSession client, int lockDuration)
            : base(client.Character, "MovementLock", lockDuration)
        {
            this.client = client;
            if (client.Character.Tasks.TryGetValue("MovementLock", out Task task))
            {
                task.Deactivate();
            }

            client.Character.Tasks["MovementLock"] = this;
            OnAdditionStart += new StartEventHandler(MovementLock_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(MovementLock_OnAdditionEnd);
        }
Exemple #14
0
        public Stun(SkillArg arg, ActorExt target, int lifeTime)
            : base(target, "Stun", lifeTime)
        {
            this.arg    = arg;
            this.target = target;
            if (target.Tasks.TryGetValue("Stun", out Task task))
            {
                task.Deactivate();
            }

            target.Tasks["Stun"] = this;
            OnAdditionStart     += new StartEventHandler(ActorDown_OnAdditionStart);
            OnAdditionEnd       += new EndEventHandler(ActorDown_OnAdditionEnd);
        }
Exemple #15
0
        public WoodBlock(SkillArg arg)
            : base(arg.Caster, "WoodBlock", 1500)
        {
            this.arg = arg;
            if (arg.Caster.Tasks.TryRemove("WoodBlock", out Task removed))
            {
                removed.Deactivate();
            }

            arg.Caster.Tasks["WoodBlock"] = this;
            CounterSkillID   = 15116;
            OnAdditionStart += new StartEventHandler(WoodBlock_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(WoodBlock_OnAdditionEnd);
        }
Exemple #16
0
        public CounterSelf(SkillArg arg, int lifeTime)
            : base(arg.Caster, "CounterSelf", lifeTime)
        {
            this.arg = arg;
            if (arg.Caster.Tasks.TryGetValue("CounterSelf", out Task task))
            {
                task.Deactivate();
            }

            arg.Caster.Tasks["CounterSelf"] = this;

            OnAdditionStart += new StartEventHandler(CounterEnemy_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(CounterEnemy_OnAdditionEnd);
        }
        public ActorItemPickDropTask(ActorPC pc, ActorExt item, ActionTypes action)
            : base(pc, "ActorItemPickDropTask", 400)
        {
            this.pc          = pc;
            this.item        = item;
            this.action      = action;
            OnAdditionStart += new StartEventHandler(ActorItemPickDropTask_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(ActorItemPickDropTask_OnAdditionEnd);

            if (pc.Tasks.TryRemove("ActorItemPickDropTask", out Task removed))
            {
                removed.Deactivate();
            }
        }
Exemple #18
0
        public CounterEnemy(SkillArg arg)
            : base(arg.Caster, "CounterEnemy", arg.Skill.BaseData.Duration)
        {
            this.arg       = arg;
            CounterSkillID = 11104;
            if (arg.Caster.Tasks.TryGetValue("CounterEnemy", out Task task))
            {
                task.Deactivate();
            }

            arg.Caster.Tasks["CounterEnemy"] = this;

            OnAdditionStart += new StartEventHandler(CounterEnemy_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(CounterEnemy_OnAdditionEnd);
        }
Exemple #19
0
        public virtual void Start()
        {
            StartEventHandler?.Invoke();
            if (!isUnmovable)
            {
                this.pathFinder.maxSpeed = this.Speed;

                // pathFinder.enabled = true;
            }
            if (InitTarget != null)
            {
                // Debug.Log("GOTO!");
                Goto(InitTarget);
            }
        }
Exemple #20
0
 public Poisen(SkillArg arg, ActorExt target, uint additionID, int damage = 0, int duration = 5000)
     : base(target, "Poisen", duration, 2000)
 {
     this.arg        = arg;
     this.target     = target;
     this.additionID = additionID;
     this.damage     = damage;
     if (target.Tasks.TryGetValue("Poisen", out Task task))
     {
         task.Deactivate();
     }
     target.Tasks["Poisen"] = this;
     OnAdditionStart       += new StartEventHandler(ActorFrosen_OnAdditionStart);
     OnAdditionEnd         += new EndEventHandler(ActorFrosen_OnAdditionEnd);
     OnUpdate += new UpdateEventHandler(Poisen_OnUpdate);
 }
        public void StartHandlerSerializesCorrectly()
        {
            StartEventHandler.AddToDirectiveConverter();

            const string gameOverText = "Game over! Would you like to hear your stats?";
            var          token        = Guid.Parse("1234abcd-40bb-11e9-9527-6b98b093d166");
            var          expected     = new StartEventHandler(
                token,
                new Expiration(8000, new { gameOverSpeech = gameOverText }),
                FilterMatchAction.SendAndTerminate,
                new CombinedFilterExpression(
                    CombinationOperator.And,
                    new ComparisonFilterExpression(ComparisonOperator.Equals, "header.namespace", "Custom.Robot"),
                    new ComparisonFilterExpression(ComparisonOperator.GreaterThan, "payload.angle", 10)
                    )
                );

            //remove token due to DeepEquals Guid mismatch
            Assert.True(Utility.CompareJson(expected, "StartEventHandler.json", "token"));

            var directive = Utility.ExampleFileContent <IDirective>("StartEventHandler.json");
            var start     = Assert.IsType <StartEventHandler>(directive);

            Assert.NotNull(start.Expiration);
            Assert.Equal(token, start.Token);
            Assert.Equal(8000, start.Expiration.Milliseconds);

            var payload = Assert.IsType <JObject>(start.Expiration.Payload);

            Assert.Equal(gameOverText, payload.Value <string>("gameOverSpeech"));

            Assert.Equal(FilterMatchAction.SendAndTerminate, start.EventFilter.FilterMatchAction);

            var combined = Assert.IsType <CombinedFilterExpression>(start.EventFilter.FilterExpression);

            Assert.Equal(2, combined.Filters.Length);
            Assert.True(combined.Filters.All(f => f is ComparisonFilterExpression));
            var last = combined.Filters.Cast <ComparisonFilterExpression>().Last();

            Assert.Equal((Int64)10, last.Value);
            Assert.Equal("payload.angle", last.Variable);
        }
Exemple #22
0
        public Fire(SkillArg arg, ActorExt target)
            : base(target, "Fire", 10000)
        {
            this.arg        = arg;
            BonusAdditionID = 12000036;
            if (target.Tasks.TryGetValue("Fire", out Task task))
            {
                task.Deactivate();
                AccumulateCount = ((Fire)task).AccumulateCount;
            }
            AccumulateCount++;
            if (AccumulateCount > 5)
            {
                AccumulateCount = 5;
            }

            target.Tasks["Fire"] = this;
            OnAdditionStart     += new StartEventHandler(Fire_OnAdditionStart);
            OnAdditionEnd       += new EndEventHandler(Fire_OnAdditionEnd);
        }
Exemple #23
0
        public async Task Should_send_messages_to_participants_on_start()
        {
            _eventHandler = new StartEventHandler(EventHubContextMock.Object, ConferenceCache, LoggerMock.Object,
                                                  VideoApiClientMock.Object);

            var conference       = TestConference;
            var participantCount = conference.Participants.Count + 1; // plus one for admin
            var callbackEvent    = new CallbackEvent
            {
                EventType    = EventType.Start,
                EventId      = Guid.NewGuid().ToString(),
                ConferenceId = conference.Id,
                TimeStampUtc = DateTime.UtcNow
            };

            await _eventHandler.HandleAsync(callbackEvent);

            // Verify messages sent to event hub clients
            EventHubClientMock.Verify(x => x.ConferenceStatusMessage(conference.Id, ConferenceStatus.InSession),
                                      Times.Exactly(participantCount));
        }
Exemple #24
0
        public Frosen(SkillArg arg, ActorExt target)
            : base(target, "Frosen", 6000)
        {
            this.arg        = arg;
            this.target     = target;
            BonusAdditionID = 12000057;
            if (target.Tasks.TryGetValue("Frosen", out Task task))
            {
                task.Deactivate();
                AccumulateCount = ((Frosen)task).AccumulateCount;
            }
            AccumulateCount++;
            if (AccumulateCount > 3)
            {
                AccumulateCount = 3;
            }

            target.Tasks["Frosen"] = this;
            OnAdditionStart       += new StartEventHandler(Frosen_OnAdditionStart);
            OnAdditionEnd         += new EndEventHandler(Frosen_OnAdditionEnd);
        }
Exemple #25
0
        public PoisenCharge(SkillArg arg, ActorExt target)
            : base(target, "PoisenCharge", 5000)
        {
            this.arg        = arg;
            BonusAdditionID = 15000017;
            if (target.Tasks.TryGetValue("PoisenCharge", out Task task))
            {
                task.Deactivate();
                AccumulateCount = ((PoisenCharge)task).AccumulateCount;
            }
            AccumulateCount++;
            if (AccumulateCount > 5)
            {
                if (arg.Caster.Tasks.TryGetValue("Poisening", out task))
                {
                    task.Deactivate();
                }

                AccumulateCount = 5;
            }
            target.Tasks["PoisenCharge"] = this;
            OnAdditionStart += new StartEventHandler(Poisening_OnAdditionStart);
            OnAdditionEnd   += new EndEventHandler(Poisening_OnAdditionEnd);
        }
Exemple #26
0
 protected virtual void OnStart()
 {
     StartEventHandler?.Invoke(this, null);
 }
Exemple #27
0
 public static void registerStartEvent(StartEventHandler action)
 {
     currentApp.started += action;
 }
Exemple #28
0
    public static void Move(Vector3 startPos, Vector3 endPos, bool isReturned, float speed, StartEventHandler startEvent, EndEventHandler endEvent)
    {
        //注册事件
        instance.startEvent = startEvent;
        instance.endEvent   = endEvent;

        //设置动画播放速度
        instance.anim.speed = speed;

        instance.CameraMove(startPos, endPos, isReturned);
    }
Exemple #29
0
 public void Handle(StartEventHandler message)
 {
     base.Start();
 }