public static void GameMode_FootStep_GoalIn(ClientConnection Client, PacketReader reader, byte last) { //FF C0 02 FF 4E 03 BA 52 02 00 01 01 Console.WriteLine("FootStep_GoalIn"); Account User = Client.CurrentAccount; if (User.GameEndType == 0) { NormalRoom room = Rooms.GetRoom(User.CurrentRoomId); int laptime = reader.ReadLEInt32(); byte unk = reader.ReadByte();//flag? User.LapTime = laptime; User.ServerLapTime = room.GetCurrentTime(); //User.Rank = room.Rank++; if (!room.isGoal) { room.isGoal = true; if (room.RuleType == 8) { foreach (Account RoomPlayer in room.Players) { RoomPlayer.Connection.SendAsync(new FootStep_GoalIn(User.RoomPos, 1, last)); RoomPlayer.Connection.SendAsync(new Amsan_LapTimeControl(room.GetCurrentTime(), 10000, 0, false, last)); RoomPlayer.LastLapTime = User.ServerLapTime; RoomPlayer.CurrentLapTime = 10000; } Client.SendAsync(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 1, last)); } else { foreach (Account RoomPlayer in room.Players) { RoomPlayer.Connection.SendAsync(new FootStep_GoalIn_CountDown(laptime, 10000, last)); RoomPlayer.Connection.SendAsync(new FootStep_GoalIn(User.RoomPos, 1, last)); RoomPlayer.Connection.SendAsync(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 1, last)); RoomPlayer.Connection.SendAsync(new GameRoom_StartTimeOutCount(User.LapTime + 2000, last)); } } long EndTime = Utility.CurrentTimeMilliseconds() + 15000; Task.Run(() => GameRoomEvent.Execute_GameEnd(room, EndTime, last)); //Task.Run(() => GameRoomEvent.Calc_DropItem(User, room, User.Rank, last)); } else { if (room.RuleType == 8) { foreach (Account RoomPlayer in room.Players) { RoomPlayer.Connection.SendAsync(new FootStep_GoalIn(User.RoomPos, 1, last)); } Client.SendAsync(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 1, last)); } else { foreach (Account RoomPlayer in room.Players) { RoomPlayer.Connection.SendAsync(new FootStep_GoalIn(User.RoomPos, 1, last)); RoomPlayer.Connection.SendAsync(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 1, last)); } } //Task.Run(() => GameRoomEvent.Calc_DropItem(User, room, User.Rank, last)); } } }
public static void Handle_GoalInData(ClientConnection Client, PacketReader reader, byte last) { Account User = Client.CurrentAccount; NormalRoom room = Rooms.GetRoom(User.CurrentRoomId); if (room.GameMode == 38) //小遊戲 { return; } int laptime = reader.ReadLEInt32(); //User.LapTime = laptime; //FF C0 02 FF 52 03 11 31 02 00 int servertime = room.GetCurrentTime(); //User.ServerLapTime = servertime; //reader.ReadLEUInt32(); //54 6A 02 00 //User.RaceDistance = reader.ReadLESingle(); //6F C3 DE 47 RaceDistance float 114054.867188 //00 00 00 00 flag? //User.Rank = room.Rank++; room.GoalIn(User, laptime, servertime, last); /* * if (!room.isGoal) * { * MapHolder.MapInfos.TryGetValue(room.PlayingMapNum, out MapInfo mapinfo); * if (room.GameMode == 5) * { * if (room.CorunBossHP > 0) * return; //hack * if (room.Players.Any(a => a.GameEndType == 1)) * return; * } * if (mapinfo.GoalInLimitTime * 1000 < servertime) * { * Console.WriteLine("GoalInOK"); * room.isGoal = true; * room.Players.ForEach((RoomPlayer) => { * RoomPlayer.Connection.SendAsync(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 0, last)); * RoomPlayer.Connection.SendAsync(new GameRoom_StartTimeOutCount(User.LapTime + 2000, last)); * //FF 7C 03 E1 38 02 00 0A * }); * if (room.GameMode == 5) * { * int i = 0; * foreach (var p in room.Players.OrderBy(o => o.RoomPos)) * { * //p.GameEndType = 1; * p.LapTime = laptime + i; * p.ServerLapTime = servertime + i; * i++; * //Console.WriteLine("p {0}, {1}, {2}, {3}", p.NickName, p.ServerLapTime, p.LapTime, p.RoomPos); * } * } * long EndTime = Utility.CurrentTimeMilliseconds() + 15000; * Task.Run(() => GameRoomEvent.Execute_GameEnd(room, EndTime, last)); * } * else * { * Console.WriteLine("GoalInError"); * Client.SendAsync(new DisconnectPacket(User, 258, last)); * } * } * else * { * room.BroadcastToAll(new GameRoom_GoalInData(User.RoomPos, User.LapTime, 0, last)); * }*/ }