Created
December 24, 2011 08:37
-
-
Save walkline/1516825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp | |
index 3449d9e..cd7ef2c 100755 | |
--- a/src/server/game/Chat/Commands/Level0.cpp | |
+++ b/src/server/game/Chat/Commands/Level0.cpp | |
@@ -28,6 +28,7 @@ | |
#include "SystemConfig.h" | |
#include "revision.h" | |
#include "Util.h" | |
+#include "ArenaTeamMgr.h" | |
bool ChatHandler::HandleHelpCommand(const char* args) | |
{ | |
@@ -228,8 +229,6 @@ bool ChatHandler::HandleSpectateCommand(const char *args) | |
return false; | |
} | |
- PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); | |
- | |
// stop flight if need | |
if (_player->isInFlight()) | |
{ | |
@@ -240,6 +239,47 @@ bool ChatHandler::HandleSpectateCommand(const char *args) | |
else | |
_player->SaveRecallPosition(); | |
+ //search for two teams | |
+ Battleground *bGround = target->GetBattleground(); | |
+ if (bGround->isRated()) | |
+ { | |
+ uint32 slot = bGround->GetArenaType() - 2; | |
+ if (bGround->GetArenaType() > 3) | |
+ slot = 2; | |
+ uint32 firstTeamID = target->GetArenaTeamId(slot); | |
+ uint32 secondTeamID = 0; | |
+ Player *firstTeamMember = target; | |
+ Player *secondTeamMember = NULL; | |
+ for (Battleground::BattlegroundPlayerMap::const_iterator itr = bGround->GetPlayers().begin(); itr != bGround->GetPlayers().end(); ++itr) | |
+ if (Player* tmpPlayer = ObjectAccessor::FindPlayer(itr->first)) | |
+ { | |
+ if (tmpPlayer->isSpectator()) | |
+ continue; | |
+ | |
+ uint32 tmpID = tmpPlayer->GetArenaTeamId(slot); | |
+ if (tmpID != firstTeamID && tmpID > 0) | |
+ { | |
+ secondTeamID = tmpID; | |
+ secondTeamMember = tmpPlayer; | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (firstTeamID > 0 && secondTeamID > 0 && secondTeamMember) | |
+ { | |
+ ArenaTeam *firstTeam = sArenaTeamMgr->GetArenaTeamById(firstTeamID); | |
+ ArenaTeam *secondTeam = sArenaTeamMgr->GetArenaTeamById(secondTeamID); | |
+ if (firstTeam && secondTeam) | |
+ { | |
+ PSendSysMessage("You entered to rated arena."); | |
+ PSendSysMessage("Teams:"); | |
+ PSendSysMessage("%s - %s", firstTeam->GetName().c_str(), secondTeam->GetName().c_str()); | |
+ PSendSysMessage("%u(%u) - %u(%u)", firstTeam->GetRating(), firstTeam->GetAverageMMR(firstTeamMember->GetGroup()), | |
+ secondTeam->GetRating(), secondTeam->GetAverageMMR(secondTeamMember->GetGroup())); | |
+ } | |
+ } | |
+ } | |
+ | |
// to point to see at target with same orientation | |
float x, y, z; | |
target->GetContactPoint(_player, x, y, z); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment