示例#1
0
        public static void Handle_DrawItem(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 1A 03 51 34 00 00 00 00 00 00 01 00 FF FF FF FF FF FF FF FF 02
            //FF C0 02 FF 1A 03 85 1F 00 00 C9 00 00 00 01 00 FF FF FF FF FF FF FF FF 02
            //FF C0 02 FF 1A 03 13 A5 00 00 CE 00 00 00 01 01 1F 00 00 00 FF FF FF FF 10
            Account    User      = Client.CurrentAccount;
            int        time      = reader.ReadLEInt32(); //random?
            int        CapsuleID = reader.ReadLEInt32(); //00 00 00 00 Capsule id?
            byte       rank      = reader.ReadByte();    //01
            byte       flag      = reader.ReadByte();
            int        fixitem   = reader.ReadLEInt32(); //固定道具?
            int        unk4      = reader.ReadLEInt32();
            NormalRoom room      = Rooms.GetRoom(User.CurrentRoomId);

            //int getitem = fixitem == -1 ? RandItem(room, rank) : fixitem;
            if (room.RegCapsule.TryGetValue(CapsuleID, out var regitemid))
            {
                Console.WriteLine("DrawRegItem - CapsuleID: {0}, itemid: {1}, unk4: {2}", CapsuleID, regitemid, unk4);
                room.BroadcastToAll(new GameRoom_DrawItem(User.RoomPos, time, CapsuleID, regitemid, 0, flag, last));
                room.RegCapsule.Remove(CapsuleID);
            }
            else
            {
                Console.WriteLine("DrawItem - CapsuleID: {0}, Fixitem: {1}, unk4: {2}", CapsuleID, fixitem, unk4);
                int getitem = fixitem == -1 ? RandItem(room, rank) : fixitem;
                room.BroadcastToAll(new GameRoom_DrawItem(User.RoomPos, time, CapsuleID, getitem, room.CapsuleNum, flag, last));
                room.CapsuleNum++;
            }
        }
示例#2
0
        public static void Anubis_SetObjectBoss(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 72 04 03 00 00 00 90 89 1D 01 00 00 00 00 96 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 01 00 00 00 96 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 02 00 00 00 96 00 00 00 01 00 00 00 00 00 00 00 40
            //FF C0 02 FF 72 04 08 00 00 00 90 89 1D 01 03 00 00 00 FA 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 04 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 05 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 06 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 09 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 0A 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 0B 00 00 00 FA 00 00 00 01 00 00 00 00 00 00 00 90 89 1D 01 10 00 00 00 78 00 00 00 01 00 00 00 00 00 00 00 04
            Account    User      = Client.CurrentAccount;
            NormalRoom room      = Rooms.GetRoom(User.CurrentRoomId);
            int        bosscount = reader.ReadLEInt32();

            for (int i = 1; i <= bosscount; i++)
            {
                int unk3   = reader.ReadLEInt32();
                int bossid = reader.ReadLEInt32();
                int hp     = reader.ReadLEInt32();
                int unk    = reader.ReadLEInt32();
                int unk2   = reader.ReadLEInt32();

                ObjectBoss objectBoss = new ObjectBoss();
                objectBoss.HP    = hp;
                objectBoss.MaxHP = hp;

                room.AnubisObjectBoss.TryAdd(bossid, objectBoss);
            }
            room.BroadcastToAll(new AnubisObjectBossInit(room, last));
            //room.BroadcastToAll(new AnubisObjectBossInitFail(room, last));
        }
示例#3
0
        public static void Handle_jw_Loading(ClientConnection Client, byte last)
        {
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            room.BroadcastToAll(new GameRoom_jw_Loading(last));
        }
示例#4
0
        public static void CorunMode_TriggerObjectEvent(ClientConnection Client, PacketReader reader, byte last)
        {
            //eRoom_CORUN_MODE_TRIGGER_OBJECT_EVENT_REQ RideCattle
            //FF C0 02 FF 5E 03 14 00 00 00 01 00 00 00 00 00 00 40
            //FF C0 02 FF 5E 03 08 00 00 00 01 02 DB 00 00 00 00 40
            int        unk     = reader.ReadLEInt32();
            byte       unk2    = reader.ReadByte();
            byte       isLeave = reader.ReadByte();
            int        unk3    = reader.ReadLEInt32();
            Account    User    = Client.CurrentAccount;
            NormalRoom room    = Rooms.GetRoom(User.CurrentRoomId);

            if (isLeave == 0)
            {
                room.RideCattlePlayer.Add(User);
            }
            else if (isLeave == 1)
            {
                room.RideCattlePlayer.Remove(User);
            }
            if (room.RideCattlePlayer.Count == room.PlayerCount() || isLeave == 2)
            {
                room.BroadcastToAll(new TriggerObjectEvent_Ack(unk, isLeave, unk3, last));
                room.RideCattlePlayer.Clear();
            }
        }
示例#5
0
        public static void Handle_ChangeSetting(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            bool isRoomMaster = User.RoomPos == room.RoomMasterIndex;

            if (isRoomMaster || room.RoomKindID != 0x4A)
            {
                int    namelength     = reader.ReadLEInt32();
                string name           = reader.ReadBig5StringSafe(namelength);
                int    passwordlength = reader.ReadLEInt32();
                string password       = string.Empty;
                if (passwordlength > 0)
                {
                    password = reader.ReadBig5StringSafe(passwordlength);
                }
                bool isStepOn = reader.ReadBoolean();
                int  itemtype = reader.ReadLEInt32();

                room.setName(name);
                room.setPassword(password);
                room.setItemType(itemtype);
                room.setIsStepOn(isStepOn);

                room.BroadcastToAll(new GameRoom_ChangeSetting(room, last));
            }
        }
示例#6
0
        public static void RunQuizMode_RequestQuizList(ClientConnection Client, byte last)
        {
            //eRoom_RUN_QUIZMODE_REQUEST_QUIZ_LIST_REQ
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            room.BroadcastToAll(new RequestQuizList_Ack(last));
        }
示例#7
0
        public static void Handle_WaitPassBaton2(ClientConnection Client, byte last)
        {
            //FF C0 02 FF F8 02 01
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            room.BroadcastToAll(new GameRoom_WaitPassBaton2(User, last));
        }
示例#8
0
        public static void Anubis_GetPlayerHP(ClientConnection Client, byte last)
        {
            //FF C0 02 FF 75 04 01 00 00 00 10
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            room.BroadcastToAll(new SendPlayerHP(room, last));
        }
示例#9
0
        public static void Handle_StepOnButton(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            byte[] unk = reader.ReadByteArray(12);
            room.BroadcastToAll(new GameRoom_StepOnButton(unk, last));
        }
示例#10
0
        public static void GameMode_Amsan_StepButton_Push(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 39 03 27 00 00 00 08
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            //Console.WriteLine("Amsan_Step_Button_Push");
            room.BroadcastToAll(new Amsan_Step_Button_Push(last));
        }
示例#11
0
        public static void Handle_StartPassBaton(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF FA 02 0A 22 01 00 01
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            int        unk  = reader.ReadLEInt32();

            room.BroadcastToAll(new GameRoom_StartPassBaton(User, last));
        }
示例#12
0
        public static void Handle_PassBaton(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User    = Client.CurrentAccount;
            NormalRoom room    = Rooms.GetRoom(User.CurrentRoomId);
            byte       teampos = reader.ReadByte();
            int        unk     = reader.ReadLEInt32();

            room.BroadcastToAll(new GameRoom_PassBaton(User, teampos, unk, last));
        }
示例#13
0
        public static void Handle_GameStart(ClientConnection Client, PacketReader reader, byte last)
        {
            Account User = Client.CurrentAccount;
            //.sendStartGame(65), currentTick=0
            //FF C0 02 FF 13 03 41 00 00 00 60 6C 32 48 3B 04 00 00 C8 00 00 00 6E 00 00 00 80
            int iGameStartTick = reader.ReadLEInt32();

            reader.ReadLEInt32(); //unk1
            reader.ReadLEInt32(); //unk2
            int iNumberOfItem = reader.ReadLEInt32();

            reader.ReadLEInt32(); //unk3

            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            //onRecvStartGame: iGameStartTick=65, iNumberOfItem=200 (CurTick=2)
            //room.StartTime = Utility.CurrentTimeMilliseconds();
            room.Survival   = (byte)room.PlayerCount();
            room.CapsuleNum = iNumberOfItem;
            room.StartGame();
            room.Players.ForEach((RoomPlayer) => {
                RoomPlayer.Connection.SendAsync(new GameRoom_START_GAME_RES(RoomPlayer, iGameStartTick, iNumberOfItem, last));
                RoomPlayer.Connection.SendAsync(new GameRoom_Hex("FFA80500000000", last));
                RoomPlayer.GameEndType = 0;
                RoomPlayer.GameOver    = false;
            });
            if (room.PlayingMapNum == 1606)
            {
                for (byte i = 0; i <= 7; i++)
                {
                    Account Hare = room.Players.Find(p => p.RoomPos == i);
                    if (Hare.Partner > 7)
                    {
                        Account Tortoise = room.Players.Where(p => p.Team == Hare.Team && p.Partner > 7 && p.RoomPos != i).OrderBy(_ => Guid.NewGuid()).Take(1).ToArray()[0];
                        Hare.Animal         = 0;
                        Hare.Partner        = Tortoise.RoomPos;
                        Hare.TeamLeader     = true;
                        Tortoise.Animal     = 1;
                        Tortoise.Partner    = Hare.RoomPos;
                        Tortoise.TeamLeader = false;
                    }
                }
                room.BroadcastToAll(new AllocatePartner(room, last));
                room.StartHareAndTortoiseThread();
            }

            if (room.RuleType == 8)
            {
                int startlaptime = 100 * 1000;
                room.Players.ForEach((RoomPlayer) => {
                    RoomPlayer.CurrentLapTime = startlaptime;
                    RoomPlayer.LastLapTime    = 0;
                    RoomPlayer.Connection.SendAsync(new Amsan_LapTimeControl(0, startlaptime, startlaptime, false, last));
                });
            }
        }
示例#14
0
        public static void GameMode_CatchFish(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            int        time = reader.ReadLEInt32();
            int        fish = reader.ReadLEInt32();//0x1C 銀色魚,0x1D 銅色魚

            room.BroadcastToAll(new GameRoom_CatchFish(User, room, time, fish, last));
            room.CatchTime++;
        }
示例#15
0
        public static void Handle_EndLoading(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            User.EndLoading = true;
            Log.Debug("{0} EndLoading", User.NickName);
            //send 自己end loading
            room.BroadcastToAll(new GameRoom_EndLoading(User.RoomPos, last));
        }
示例#16
0
        public static void CorunMode_SetClearLimitTime(ClientConnection Client, PacketReader reader, byte last)
        {
            //eRoom_CORUN_MODE_SET_CLEAR_LIMIT_TIME_REQ
            //FF C0 02 FF 64 03 64 00 00 00 10
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            int        sec  = reader.ReadLEInt32();

            room.BroadcastToAll(new SetClearLimitTime_Ack(sec, last));
        }
示例#17
0
        public static void Handle_ChangeSlotStateRelay(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF F3 02 02 01 20
            Account    User   = Client.CurrentAccount;
            NormalRoom room   = Rooms.GetRoom(User.CurrentRoomId);
            byte       slotid = reader.ReadByte();
            bool       isOFF  = reader.ReadBoolean();

            room.setRelayPosWeight(slotid, isOFF);
            room.BroadcastToAll(new GameRoom_RelayChangeSlotState(slotid, isOFF, last));
        }
示例#18
0
        public static void GameMode_Amsan_LapTime(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF C1 02 00 00 00 00 00 20
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            //Console.WriteLine(" GameMode_Amsan_2C1: {0}", Utility.ByteArrayToString(reader.Buffer));
            int  unk   = reader.ReadLEInt32();
            byte round = reader.ReadByte(); //round?

            room.BroadcastToAll(new Amsan_LapTime(unk, round, User.RoomPos, last));
        }
示例#19
0
        public static void Handle_MapControl(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF CA 02 14 00 44 00 00 00 00 91 EE 01 00 00 00 00 00 00 EE 01 00 00 00 00 01
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            short      len  = reader.ReadLEInt16(); //0C 00

            byte[] unk = reader.ReadByteArray(len); //39 8C F0 01 01 00 EB 00 05 00 04 00
            //Console.WriteLine("MapControl: {0}", Utility.ByteArrayToString(reader.Buffer));
            room.BroadcastToAll(new GameRoom_MapControl(len, unk, last));
        }
示例#20
0
        public static void GameMode_MiniGame_GetPoint(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 5B 05 00 14 00 00 00 80
            Account    User     = Client.CurrentAccount;
            byte       pos      = reader.ReadByte();
            int        point    = reader.ReadLEInt32();
            NormalRoom room     = Rooms.GetRoom(User.CurrentRoomId);
            int        nowpoint = room.DropItem.Find(f => f.UserNum == User.UserNum).MiniGamePoint += point;

            room.BroadcastToAll(new GameRoom_MiniGame_UpdatePoint(room, last));
            Client.SendAsync(new GameRoom_MiniGame_GetPoint(User, nowpoint, point, last));
        }
示例#21
0
        public static void Handle_TriggerMapEvent(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 5C 03 00 01 D0 78 02 00 04
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            reader.Offset += 1; //00
            byte eventnum     = reader.ReadByte();
            int  eventlaptime = reader.ReadLEInt32();

            room.BroadcastToAll(new GameRoom_TriggerMapEvent(eventnum, eventlaptime, last));
        }
示例#22
0
        public static void CorunMode_SetBossEnergy(ClientConnection Client, PacketReader reader, byte last)
        {
            //eRoom_CORUN_MODE_SET_BOSS_ENERGY_REQ[%d]
            //FF C0 02 FF 6A 03 10 27 00 00 FF FF FF FF 40
            int        bosshp = reader.ReadLEInt32();
            int        boss   = reader.ReadLEInt32();
            Account    User   = Client.CurrentAccount;
            NormalRoom room   = Rooms.GetRoom(User.CurrentRoomId);

            room.CorunBossHP = bosshp / ServerSettingHolder.ServerSettings.corunModeDecreaseEnergyRatio;
            room.BroadcastToAll(new CorunMode_SetBossEnergy_Ack(boss, last));
        }
示例#23
0
        public static void Anubis_Rebirth(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 8D 04 01 01 00 00 00 01
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            //TODO: 扣減復活石數量

            User.HP = User.MaxHP;
            Client.SendAsync(new AnubisRemainRebirthStone(User, last));
            room.BroadcastToAll(new AnubisRebirth(User, last));
        }
示例#24
0
        public static void Handle_ChangeStatus(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF C9 02 0A 00 00 00 02
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            int        code = reader.ReadLEInt32();

            if (User.InGame)
            {
                room.BroadcastToAll(new GameRoom_ChangeStatus(User.RoomPos, code, last));
            }
        }
示例#25
0
        public static void Anubis_DecreaseMyHP(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 77 04 02 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 04
            Account    User     = Client.CurrentAccount;
            NormalRoom room     = Rooms.GetRoom(User.CurrentRoomId);
            int        unk      = reader.ReadLEInt32();
            int        reducehp = reader.ReadLEInt32();
            int        remainhp = User.HP - reducehp;

            User.HP = remainhp < 0 ? 0 : remainhp;
            room.BroadcastToAll(new AnubisDecreaseMyHP(User, last));
        }
示例#26
0
        public static void Handle_ChangeTeam(ClientConnection Client, PacketReader reader, byte last)
        {
            Account    User    = Client.CurrentAccount;
            byte       team    = reader.ReadByte();
            NormalRoom room    = Rooms.GetRoom(User.CurrentRoomId);
            bool       isReady = User.RoomPos == room.RoomMasterIndex ? false : User.IsReady;

            if (!isReady && User.Team != team)
            {
                User.Team = team;
                room.BroadcastToAll(new GameRoom_RoomPosTeam(User, last));
            }
        }
示例#27
0
        public static void GameMode_Amsan_FinalButton(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 7F 03 40
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);

            //Console.WriteLine("Amsan_Goal_Button");
            //User.LapTime = laptime;

            /*User.ServerLapTime = (int)(Utility.CurrentTimeMilliseconds() - room.StartTime);
             * User.LapTime = User.LapTime;*/
            room.BroadcastToAll(new Amsan_Goal_Button(last));
        }
示例#28
0
        public static void CorunMode_TriggerCheckInObjectEvent(ClientConnection Client, PacketReader reader, byte last)
        {
            //eRoom_CORUN_MODE_TRIGGER_CHECK_IN_OBJECT_EVENT_REQ takecar
            //FF C0 02 FF 60 03 08 00 00 00 01 00 00 00 00 00 DB 00 00 00 40
            Account    User      = Client.CurrentAccount;
            NormalRoom room      = Rooms.GetRoom(User.CurrentRoomId);
            int        needcount = reader.ReadLEInt32();
            int        tookcount = reader.ReadLEInt32();
            short      unk       = reader.ReadLEInt16();
            int        unk2      = reader.ReadLEInt32();

            room.BroadcastToAll(new TriggerCheckInObjectEvent_Ack(User.RoomPos, needcount, tookcount, unk2, last));
        }
示例#29
0
        public static void CorunMode_DecreaseBossEnergy(ClientConnection Client, PacketReader reader, byte last)
        {
            //eRoom_CORUN_MODE_DECREASE_BOSS_ENERGY_REQ
            //FF C0 02 FF 6D 03 64 00 00 00 FF FF FF FF 02
            int        reducehp = reader.ReadLEInt32();
            int        boss     = reader.ReadLEInt32();
            Account    User     = Client.CurrentAccount;
            NormalRoom room     = Rooms.GetRoom(User.CurrentRoomId);
            int        remainhp = room.CorunBossHP - reducehp;

            room.CorunBossHP = remainhp < 0 ? 0 : remainhp;
            room.BroadcastToAll(new CorunMode_DecreaseBossEnergy_Ack(boss, room.CorunBossHP, last));
        }
示例#30
0
        public static void GameMode_LapTimeCountdwon(ClientConnection Client, PacketReader reader, byte last)
        {
            //FF C0 02 FF 15 03 06 00 00 01 01
            //FF C0 02 FF 15 03 06 00 01 01 20
            //FF C0 02 FF 15 03 06 00 02 01 20
            Account    User = Client.CurrentAccount;
            NormalRoom room = Rooms.GetRoom(User.CurrentRoomId);
            //Console.WriteLine("LapTimeCountdwon: {0}", Utility.ByteArrayToString(reader.Buffer));
            short second = reader.ReadLEInt16();
            byte  round  = reader.ReadByte(); //round?

            room.BroadcastToAll(new GameRoom_LapTimeCountdwon(second, round, last));
            if (room.GameMode == 38) //小遊戲
            {
                Task.Run(() => Task.Delay(second * 1000))
                .ContinueWith((t) =>
                {
                    room.Players.ForEach((RoomPlayer) => {
                        RoomPlayer.Connection.SendAsync(new GameRoom_LapTimeCountdwon2(second, round, last));
                        RoomPlayer.GameEndType = 0;
                    });
                    room.Round = round;
                    if (room.Round == 0)     //init pointlist
                    {
                        foreach (Account Player in room.Players)
                        {
                            DropList dropList = new DropList
                            {
                                UserNum       = Player.UserNum,
                                RaceDistance  = Player.RaceDistance,
                                ServerLapTime = Player.ServerLapTime,
                                LapTime       = Player.LapTime,
                                Pos           = Player.RoomPos,
                                Team          = Player.Team,
                                BounsTR       = 0,
                                BounsEXP      = 0,
                                TR            = 0,
                                EXP           = 0,
                                Rank          = 0,
                                CardID        = new List <int> {
                                    0
                                },
                                MiniGamePoint     = 0,
                                MiniGameStarPoint = 0
                            };
                            room.DropItem.Add(dropList);
                        }
                    }
                });
            }
        }