private void Handler_C_REQUEST_PLAYER_STATUS(IPacket packet) { C_REQUEST_PLAYER_STATUS receivePacket = (C_REQUEST_PLAYER_STATUS)packet; int requestGameId = receivePacket.GameId; User user = MachingRoom.GetUser(requestGameId); if (user == null) { return; } S_PLAYER_STATUS sendPacket = new S_PLAYER_STATUS(); sendPacket.GameId = user.SessionId; sendPacket.CharacterId = user.Character.Index; sendPacket.ShipId = 0; sendPacket.Hp = (int)CommonDatasheet.GetValue(CommonType.Hp) + user.Character.HpBouns; sendPacket.Battle = (int)CommonDatasheet.GetValue(CommonType.Battle) + user.Character.BattleBouns; sendPacket.Hit = (int)CommonDatasheet.GetValue(CommonType.Hit) + user.Character.HitBouns; sendPacket.Move = (int)CommonDatasheet.GetValue(CommonType.Move) + user.Character.MoveBouns; sendPacket.Range = (int)CommonDatasheet.GetValue(CommonType.Range) + user.Character.RangeBouns; if (Ship != null) { sendPacket.ShipId = user.Ship.Index; sendPacket.Hp += user.Ship.HpBouns; sendPacket.Battle += user.Ship.BattleBouns; sendPacket.Hit += user.Ship.HitBouns; sendPacket.Move += user.Ship.MoveBouns; sendPacket.Range += user.Ship.RangeBouns; } MachingRoom.Broadcast(sendPacket); }
private void Handler_C_START_ATTACK(IPacket packet) { if (status != UserStatus.InGame) { return; } if (MachingRoom.CurrentUser != null) { return; } C_START_ATTACK attackInfo = (C_START_ATTACK)packet; if (attackInfo.AttackterId != SessionId) { return; } User attacker = MachingRoom.GetUser(attackInfo.AttackterId); MachingRoom.AttackerId = attackInfo.AttackterId; MachingRoom.AttackerValue = 0; MachingRoom.AttackCount = (int)CommonDatasheet.GetValue(CommonType.Battle) + attacker.Character.BattleBouns + attacker.Ship.BattleBouns; User defender = MachingRoom.GetUser(attackInfo.DefenderId); MachingRoom.DefenderId = attackInfo.DefenderId; MachingRoom.DefenderValue = attackInfo.DefenderId; MachingRoom.DefenceCount = (int)CommonDatasheet.GetValue(CommonType.Battle) + defender.Character.BattleBouns + defender.Ship.BattleBouns; S_START_FIGHT fight = new S_START_FIGHT(); fight.AttackerId = attackInfo.AttackterId; fight.DefenderId = attackInfo.DefenderId; MachingRoom.Broadcast(fight); }