| 442 | } |
| 443 | |
| 444 | void Player::notifyTeamFighting(Player* player, Tile* tile) |
| 445 | { |
| 446 | // We check if there is a fight event currently near this tile. If yes, we update |
| 447 | // the time event. If not, we create a new fight event |
| 448 | bool isFirstFight = true; |
| 449 | for(PlayerEvent* event : mEvents) |
| 450 | { |
| 451 | if(event->getType() != PlayerEventType::fight) |
| 452 | continue; |
| 453 | |
| 454 | // There is already another fight event. We check the distance |
| 455 | isFirstFight = false; |
| 456 | if(Pathfinding::squaredDistanceTile(*tile, *event->getTile()) < MIN_DIST_EVENT_SQUARED) |
| 457 | { |
| 458 | // A similar event is already on nearly. We only update it |
| 459 | event->setTimeRemain(BATTLE_TIME_COUNT); |
| 460 | return; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | if(isFirstFight) |
| 465 | { |
| 466 | ServerNotification *serverNotification = new ServerNotification( |
| 467 | ServerNotificationType::playerFighting, this); |
| 468 | serverNotification->mPacket << player->getId(); |
| 469 | ODServer::getSingleton().queueServerNotification(serverNotification); |
| 470 | |
| 471 | std::vector<Seat*> seats; |
| 472 | seats.push_back(getSeat()); |
| 473 | mGameMap->fireRelativeSound(seats, SoundRelativeKeeperStatements::WeAreUnderAttack); |
| 474 | } |
| 475 | |
| 476 | // We add the fight event |
| 477 | mEvents.push_back(new PlayerEvent(PlayerEventType::fight, tile, BATTLE_TIME_COUNT)); |
| 478 | fireEvents(); |
| 479 | } |
| 480 | |
| 481 | void Player::notifyNoSkillInQueue() |
| 482 | { |
no test coverage detected