diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 88ed21ebf..0b9808c3b 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -22,21 +22,21 @@ ArenaTeam::ArenaTeam() { - Id = 0; - Type = 0; - Name = ""; - CaptainGuid = 0; - BackgroundColor = 0; // background - EmblemStyle = 0; // icon - EmblemColor = 0; // icon color - BorderStyle = 0; // border - BorderColor = 0; // border color - stats.games = 0; - stats.played = 0; - stats.rank = 0; - stats.rating = 1500; - stats.wins = 0; - stats.wins2 = 0; + Id = 0; + Type = 0; + Name = ""; + CaptainGuid = 0; + BackgroundColor = 0; // background + EmblemStyle = 0; // icon + EmblemColor = 0; // icon color + BorderStyle = 0; // border + BorderColor = 0; // border color + stats.games_week = 0; + stats.games_season = 0; + stats.rank = 0; + stats.rating = 1500; + stats.wins_week = 0; + stats.wins_season = 0; } ArenaTeam::~ArenaTeam() @@ -51,7 +51,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist return false; - sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid)); + sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid)); CaptainGuid = captainGuid; Name = ArenaTeamName; @@ -69,7 +69,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam "VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')", Id, ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid), Type, BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor); CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES " - "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", Id,stats.rating,stats.games,stats.wins,stats.played,stats.wins2,stats.rank); + "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", Id,stats.rating,stats.games_week,stats.wins_week,stats.games_season,stats.wins_season,stats.rank); CharacterDatabase.CommitTransaction(); @@ -122,13 +122,14 @@ bool ArenaTeam::AddMember(uint64 PlayerGuid) Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); ArenaTeamMember newmember; - newmember.name = plName; - newmember.guid = PlayerGuid; - newmember.Class = plClass; - newmember.played_season = 0; - newmember.played_week = 0; - newmember.wons_season = 0; - newmember.wons_week = 0; + newmember.name = plName; + newmember.guid = PlayerGuid; + newmember.Class = plClass; + newmember.games_season = 0; + newmember.games_week = 0; + newmember.wins_season = 0; + newmember.wins_week = 0; + newmember.personal_rating = 1500; members.push_back(newmember); CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid,guid) VALUES ('%u', '%u')", Id, GUID_LOPART(newmember.guid)); @@ -192,12 +193,12 @@ void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId) Field *fields = result->Fetch(); - stats.rating = fields[0].GetUInt32(); - stats.games = fields[1].GetUInt32(); - stats.wins = fields[2].GetUInt32(); - stats.played = fields[3].GetUInt32(); - stats.wins2 = fields[4].GetUInt32(); - stats.rank = fields[5].GetUInt32(); + stats.rating = fields[0].GetUInt32(); + stats.games_week = fields[1].GetUInt32(); + stats.wins_week = fields[2].GetUInt32(); + stats.games_season = fields[3].GetUInt32(); + stats.wins_season = fields[4].GetUInt32(); + stats.rank = fields[5].GetUInt32(); delete result; } @@ -206,7 +207,7 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) { Field *fields; - QueryResult *result = CharacterDatabase.PQuery("SELECT guid,played_week,wons_week,played_season,wons_season FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); + QueryResult *result = CharacterDatabase.PQuery("SELECT guid,games_week,wins_week,games_season,wins_season FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); if(!result) return; @@ -216,10 +217,10 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) ArenaTeamMember newmember; newmember.guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); LoadPlayerStats(&newmember); - newmember.played_week = fields[1].GetUInt32(); - newmember.wons_week = fields[2].GetUInt32(); - newmember.played_season = fields[3].GetUInt32(); - newmember.wons_season = fields[4].GetUInt32(); + newmember.games_week = fields[1].GetUInt32(); + newmember.wins_week = fields[2].GetUInt32(); + newmember.games_season = fields[3].GetUInt32(); + newmember.wins_season = fields[4].GetUInt32(); members.push_back(newmember); }while( result->NextRow() ); delete result; @@ -337,11 +338,11 @@ void ArenaTeam::Roster(WorldSession *session) data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint8(pl->getLevel()); // unknown, probably level data << uint8(pl->getClass()); // class - data << uint32(itr->played_week); // played this week - data << uint32(itr->wons_week); // wins this week - data << uint32(itr->played_season); // played this season - data << uint32(itr->wons_season); // wins this season - data << uint32(0); // personal rating? + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating } else { @@ -351,11 +352,11 @@ void ArenaTeam::Roster(WorldSession *session) data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint8(0); // unknown, level? data << uint8(itr->Class); // class - data << uint32(itr->played_week); // played this week - data << uint32(itr->wons_week); // wins this week - data << uint32(itr->played_season); // played this season - data << uint32(itr->wons_season); // wins this season - data << uint32(0); // personal rating? + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating } } session->SendPacket(&data); @@ -382,25 +383,29 @@ void ArenaTeam::Stats(WorldSession *session) WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); data << uint32(GetId()); // arena team id data << uint32(stats.rating); // rating - data << uint32(stats.games); // games - data << uint32(stats.wins); // wins - data << uint32(stats.played); // played - data << uint32(stats.wins2); // wins(again o_O) + data << uint32(stats.games_week); // games this week + data << uint32(stats.wins_week); // wins this week + data << uint32(stats.games_season); // played this season + data << uint32(stats.wins_season); // wins this season data << uint32(stats.rank); // rank session->SendPacket(&data); } void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) { + ArenaTeamMember* member = GetMember(guid); + if(!member) + return; + WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << uint64(guid); // player guid data << uint8(GetSlot()); // slot (0...2) data << uint32(GetId()); // arena team id data << uint32(stats.rating); // rating - data << uint32(stats.games); // games - data << uint32(stats.wins); // wins - data << uint32(stats.played); // played (count of all games, that played...) - data << uint32(0); // 2.3.3 personal rating? + data << uint32(stats.games_season); // season played + data << uint32(stats.wins_season); // season wins + data << member->games_season; // played (count of all games, that the inspected member participated...) + data << member->personal_rating; // personal rating session->SendPacket(&data); } @@ -423,20 +428,20 @@ void ArenaTeam::SetStats(uint32 stat_type, uint32 value) stats.rating = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_GAMES: - stats.games = value; + case STAT_TYPE_GAMES_WEEK: + stats.games_week = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET games = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_WINS: - stats.wins = value; + case STAT_TYPE_WINS_WEEK: + stats.wins_week = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_PLAYED: - stats.played = value; + case STAT_TYPE_GAMES_SEASON: + stats.games_season = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET played = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_WINS2: - stats.wins2 = value; + case STAT_TYPE_WINS_SEASON: + stats.wins_season = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins2 = '%u' WHERE arenateamid = '%u'", value, GetId()); break; case STAT_TYPE_RANK: @@ -493,24 +498,35 @@ bool ArenaTeam::HaveMember( uint64 guid ) const return false; } +void ArenaTeam::FinishWeek() +{ + stats.games_week = 0; // played this week + stats.wins_week = 0; // wins this week + for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + { + itr->games_week = 0; + itr->wins_week = 0; + } +} + /* arenateam fields (id from 2.3.3 client): 1414 - arena team id 2v2 1415 - 0=captain, 1=member -1416 - played this season -1417 - played this week +1416 - played this week +1417 - played this season 1418 - unk -1419 - unk +1419 - personal arena rating 1420 - arena team id 3v3 1421 - 0=captain, 1=member -1422 - played this season -1423 - played this week +1422 - played this week +1423 - played this season 1424 - unk -1425 - unk +1425 - personal arena rating 1426 - arena team id 5v5 1427 - 0=captain, 1=member -1428 - played this season -1429 - played this week +1428 - played this week +1429 - played this season 1430 - unk -1431 - unk +1431 - personal arena rating */ diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index 0d26b00cf..b12b759a8 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -66,12 +66,12 @@ ERR_ARENA_TEAM_LEVEL_TOO_LOW_I enum ArenaTeamStatTypes { - STAT_TYPE_RATING = 0, - STAT_TYPE_GAMES = 1, - STAT_TYPE_WINS = 2, - STAT_TYPE_PLAYED = 3, - STAT_TYPE_WINS2 = 4, - STAT_TYPE_RANK = 5 + STAT_TYPE_RATING = 0, + STAT_TYPE_GAMES_WEEK = 1, + STAT_TYPE_WINS_WEEK = 2, + STAT_TYPE_GAMES_SEASON = 3, + STAT_TYPE_WINS_SEASON = 4, + STAT_TYPE_RANK = 5 }; enum ArenaTeamTypes @@ -88,19 +88,20 @@ struct ArenaTeamMember //uint32 unk2; //uint8 unk1; uint8 Class; - uint32 played_week; - uint32 wons_week; - uint32 played_season; - uint32 wons_season; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; + uint32 personal_rating; }; struct ArenaTeamStats { uint32 rating; - uint32 games; - uint32 wins; - uint32 played; - uint32 wins2; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; uint32 rank; }; @@ -123,7 +124,7 @@ class ArenaTeam static uint8 GetSlotByType(uint32 type); const uint64& GetCaptain() const { return CaptainGuid; } std::string GetName() const { return Name; } - ArenaTeamStats GetStats() const { return stats; } + const ArenaTeamStats& GetStats() const { return stats; } void SetStats(uint32 stat_type, uint32 value); uint32 GetRating() const { return stats.rating; } @@ -143,6 +144,14 @@ class ArenaTeam MemberList::iterator membersbegin(){ return members.begin(); } MemberList::iterator membersEnd(){ return members.end(); } bool HaveMember(uint64 guid) const; + ArenaTeamMember* GetMember(uint64 guid) + { + for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + if(itr->guid==guid) + return &(*itr); + + return NULL; + } bool LoadArenaTeamFromDB(uint32 ArenaTeamId); void LoadMembersFromDB(uint32 ArenaTeamId); @@ -156,6 +165,8 @@ class ArenaTeam void Stats(WorldSession *session); void InspectStats(WorldSession *session, uint64 guid); + void FinishWeek(); + protected: uint32 Id; diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 2781ef6e2..7e84a3065 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -709,14 +709,21 @@ void BattleGround::AddPlayer(Player *plr) plr->RemoveArenaSpellCooldowns(); //plr->RemoveArenaAuras(); plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT); - if(team == ALLIANCE && plr->GetTeam() == ALLIANCE) - plr->CastSpell(plr,SPELL_ALLIANCE_GOLD_FLAG,true); - else if(team == HORDE && plr->GetTeam() == ALLIANCE) - plr->CastSpell(plr,SPELL_ALLIANCE_GREEN_FLAG,true); - else if(team == ALLIANCE && plr->GetTeam() == HORDE) - plr->CastSpell(plr,SPELL_HORDE_GOLD_FLAG,true); + if(team == ALLIANCE) // gold + { + if(plr->GetTeam() == HORDE) + plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true); + } else - plr->CastSpell(plr,SPELL_HORDE_GREEN_FLAG,true); + { + if(plr->GetTeam() == HORDE) // green + plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true); + } + plr->DestroyConjuredItems(true); if(GetStatus() == STATUS_WAIT_JOIN) // not started yet diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 5c038759f..2949ceb11 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -655,6 +655,10 @@ void WorldSession::HandleCorpseReclaimOpcode(WorldPacket &recv_data) if (GetPlayer()->isAlive()) return; + // do not allow corpse reclaim in arena + if (GetPlayer()->InArena()) + return; + // body not released yet if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f7574b06f..9b4733429 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5910,6 +5910,18 @@ void Player::UpdateHonorFields() ///An exact honor value can also be given (overriding the calcs) bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor) { + // do not reward honor in arenas, but enable onkill spellproc + if(InArena()) + { + if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER) + return false; + + if( GetBGTeam() == ((Player*)uVictim)->GetBGTeam() ) + return false; + + return true; + } + // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) return false; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 55347926a..dd5528e2c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6862" + #define REVISION_NR "6863" #endif // __REVISION_NR_H__