public void OnEvent(ref TNetMsg Msg)
        {
            var kind = GSocket.GetBufToByte(ref Msg.Value);

            switch (kind)
            {
            case SUCCESS:
                // 關閉效能監測工具,並儲存此次紀錄結果
                _monitorUnit.StopAndSaveToMonitorManager(true, "禮包碼兌換成功");
                Console.WriteLine($"{_monitorUnit.GetTag()}禮包碼兌換成功");
                break;

            case HTTP_FAILED:
                _monitorUnit.StopAndSaveToMonitorManager(false, "禮包碼兌換失敗");
                Console.WriteLine($"{_monitorUnit.GetTag()}禮包碼兌換失敗");
                break;

            case BAG_IS_FULL:
                _monitorUnit.StopAndSaveToMonitorManager(false, "背包已滿");
                Console.WriteLine($"{_monitorUnit.GetTag()}背包已滿");
                break;

            case ADD_PRIZE_FAILED:
                _monitorUnit.StopAndSaveToMonitorManager(false, "新增禮包碼到背包中失敗");
                Console.WriteLine($"{_monitorUnit.GetTag()}新增禮包碼到背包中失敗");
                break;
            }
        }
Beispiel #2
0
        public void OnEvent(ref TNetMsg Msg)
        {
            byte      kind     = GSocket.GetBufToByte(ref Msg.Value);
            ushort    itemIdx  = GSocket.GetBufToWord(ref Msg.Value);
            byte      refresh  = GSocket.GetBufToByte(ref Msg.Value);
            sSaveItem saveItem = new sSaveItem();

            switch (kind)
            {
            case 1:
                if (GSocket.GetBufToType(ref Msg.Value, ref saveItem))
                {
                    //Console.WriteLine("背包新增物品");
                    //Console.WriteLine($"Item索引:{itemIdx}, 物品ID:{saveItem.ID}");
                }
                break;

            case 2:
                //Console.WriteLine("背包刪除物品");
                //Console.WriteLine($"Item索引:{itemIdx}");
                break;
            }

            if (refresh == 1)
            {
                //Console.WriteLine("刷新背包");
            }
        }
Beispiel #3
0
        public void OnEvent(ref TNetMsg Msg)
        {
            byte kind = GSocket.GetBufToByte(ref Msg.Value);
            //Console.WriteLine("登入結果(kind):" + kind);
            byte sex     = 0;
            byte armType = 0;

            switch (kind)
            {
            case 1:
                // 登入成功
                var        gsid      = GSocket.GetBufToWord(ref Msg.Value);
                int        timeRange = GSocket.GetBufToInt(ref Msg.Value);
                sLoginType role      = new sLoginType(true);
                if (GSocket.GetBufToType <sLoginType>(ref Msg.Value, ref role))
                {
                    // 啟動效能監測工具
                    _monitorUnit.StartMonitor();
                    _monitorUnit.SetTag(role.Account);

                    Console.WriteLine($"{role.Account}發送 註冊禮包碼");
                    _socket.PushDWord(10);
                    _socket.PushString("sayhello2you");
                    _socket.SendMsg(1, 111);
                }
                break;

            case 3:
                // 創角帳號
                Thread.Sleep(2000);
                Console.WriteLine("創角帳號(kind):" + kind);
                var randomGenerator = new RandomStringGenerator();
                _socket.PushString(randomGenerator.RandomCreateCharacterName());
                _socket.PushByte(sex);
                _socket.PushByte(armType);
                _socket.SendMsg(1, 72);
                break;
            }
        }
Beispiel #4
0
        public void OnEvent(ref TNetMsg Msg)
        {
            byte kind = GSocket.GetBufToByte(ref Msg.Value);
            byte Num  = GSocket.GetBufToByte(ref Msg.Value);

            sPrizeReward[] prizeAy = new sPrizeReward[Num];

            for (int i = 0; i < Num; i++)
            {
                ushort ID      = GSocket.GetBufToWord(ref Msg.Value);
                uint   ItemNum = GSocket.GetBufToDWord(ref Msg.Value);
                Console.WriteLine("Award ID : " + ID.ToString() + "  ItemNum : " + ItemNum.ToString());
                prizeAy[i].ItemID = ID;
                prizeAy[i].Num    = ItemNum;
            }

            switch (kind)
            {
            case 1:
                // 戰鬥獎勵
                break;

            case 2:
                // 副本獎勵
                break;

            case 3:
                //掃蕩獎勵
                break;

            case 5:     //野怪 中央訊息
                break;

            case 11:    // 尋訪武將
                break;

            case 12:
            case 33:
                // 使用物品
                break;

            case 13:     // 使用物品
            case 14:     // 活動、成就獎勵
            case 15:     // 活躍值獎勵
            case 23:     // 邊境巡邏隊兌換
            case 25:     // 合成獎勵
            case 26:     // 副本全制霸獎勵(物品)
            case 27:     // 物品信件獎勵
            case 28:     // 限時購買
            case 34:     // 內政收益
            case 35:     // 內政(幫助獎勵)
            case 36:     // 內政(掠奪獎勵)
                         //中央訊息 訊息連跳
                //foreach(var prize in prizeAy)
                //{
                //    Console.WriteLine($"中央訊息:恭喜獲得 物品ID:{prize.ItemID}, 物品數量:{prize.Num}");
                //}
                break;

            case 17:        // 酒館武將回禮,錄用
                break;

            case 18:        // 七星續命燈獎勵
                break;

            case 19:        // 熔爐獲得
                break;

            case 20:        // 關卡全制霸獎勵
                break;

            case 21:        // 武列全制霸獎勵(必定是武將)
                break;

            case 22:        // 地牢錄用獎勵
                break;

            case 24:        // 神來一翻翻牌獎勵
                break;

            case 29:        // 首儲活動
                break;

            case 30:    //採集  中央訊息
                break;

            case 31:     // 虛寶兌換
                break;

            case 32:     // 轉轉樂
                break;

            default:
                break;
            }
        }
        public void OnEvent(ref TNetMsg Msg)
        {
            byte kind = GSocket.GetBufToByte(ref Msg.Value);

            Console.WriteLine("創角結果(kind):" + kind);
        }