Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	src/server/game/Battlegrounds/ArenaScore.h
	src/server/game/Battlegrounds/Battleground.cpp
	src/server/game/Battlegrounds/BattlegroundScore.h
	src/server/game/Handlers/MailHandler.cpp
This commit is contained in:
Vincent-Michael
2014-06-29 17:32:12 +02:00
7 changed files with 178 additions and 67 deletions

View File

@@ -0,0 +1,94 @@
-- Lunaraa/
DELETE FROM `gossip_menu_option` WHERE `menu_id`=4824;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(4824, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4824;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4824, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Mi'irku Farstep 8433
DELETE FROM `gossip_menu_option` WHERE `menu_id`=8433;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(8433, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=8433;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 8433, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Ursyn Ghull
DELETE FROM `gossip_menu_option` WHERE `menu_id`=4536;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(4536, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4536;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4536, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Theridran
DELETE FROM `gossip_menu_option` WHERE `menu_id`=21228;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(21228, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=21228;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 21228, 0, 0, 0, 15, 0, 1024, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a druid');
-- Larimaine Purdue
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4822;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4822, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Elissa Dumas
DELETE FROM `gossip_menu_option` WHERE `menu_id`=4821;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(4821, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4821;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4821, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Iorioa
DELETE FROM `gossip_menu_option` WHERE `menu_id`=8268;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(8268, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=8268;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 8268, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Vindicator Aesom
DELETE FROM `gossip_menu_option` WHERE `menu_id`=7517;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(7517, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=7517;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 7517, 0, 0, 0, 15, 0, 2, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a paladin');
-- Lexington Mortaim
DELETE FROM `gossip_menu_option` WHERE `menu_id`=7517;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(7517, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=7517;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 7517, 0, 0, 0, 15, 0, 2, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a paladin');
-- Lexington Mortaim
DELETE FROM `gossip_menu_option` WHERE `menu_id`=4827;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(4827, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4827;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4827, 0, 0, 0, 15, 0, 128, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a mage');
-- Brother Sammuel
DELETE FROM `gossip_menu_option` WHERE `menu_id`=4663;
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES
(4663, 0, 3, 'Please teach me.', 8442, 5, 16, 0, 0, 0, 0, '', 0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4663;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 4663, 0, 0, 0, 15, 0, 2, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a paladin');

View File

@@ -0,0 +1,2 @@
--
UPDATE `quest_template` SET `SpecialFlags`=2 WHERE `Id` = 12274;

View File

@@ -77,7 +77,7 @@ struct ArenaScore : public BattlegroundScore
content << int32(primaryTree);
data.WriteBits(0, 24); // Objectives Count
BuildObjectivesBlock(data, content);
data.WriteBit(PlayerGuid[4]);
@@ -91,6 +91,11 @@ struct ArenaScore : public BattlegroundScore
content.WriteByteSeq(PlayerGuid[2]);
}
void BuildObjectivesBlock(WorldPacket& data, ByteBuffer& /*content*/) final
{
data.WriteBits(0, 24); // Objectives Count
}
// For Logging purpose
std::string ToString() const override
{
@@ -99,48 +104,7 @@ struct ArenaScore : public BattlegroundScore
return stream.str();
}
uint8 TeamId; // TEAM_ALLIANCE or TEAM_HORDE
};
struct ArenaTeamScore
{
friend class Battleground;
protected:
ArenaTeamScore() : RatingChange(0), MatchmakerRating(0) { }
virtual ~ArenaTeamScore() { }
void Assign(int32 ratingChange, uint32 matchMakerRating, std::string const& teamName)
{
RatingChange = ratingChange;
MatchmakerRating = matchMakerRating;
TeamName = teamName;
}
void BuildRatingInfoBlock(WorldPacket& data)
{
uint32 ratingLost = std::abs(std::min(RatingChange, 0));
uint32 ratingWon = std::max(RatingChange, 0);
data << uint32(MatchmakerRating);
data << uint32(ratingLost);
data << uint32(ratingWon);
}
void BuildTeamInfoLengthBlock(WorldPacket& data)
{
data.WriteBits(TeamName.length(), 8);
}
void BuildTeamInfoBlock(WorldPacket& data)
{
data.WriteString(TeamName);
}
int32 RatingChange;
uint32 MatchmakerRating;
std::string TeamName;
uint8 TeamId; // bgTeamId
};
#endif // TRINITY_ARENA_SCORE_H

View File

@@ -174,10 +174,6 @@ Battleground::Battleground()
m_ArenaTeamMMR[TEAM_ALLIANCE] = 0;
m_ArenaTeamMMR[TEAM_HORDE] = 0;
// Iterate this way for consistency's sake - client expects it to be sent in this order
for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
_arenaTeamScores[i] = new ArenaTeamScore();
m_BgRaids[TEAM_ALLIANCE] = NULL;
m_BgRaids[TEAM_HORDE] = NULL;
@@ -229,10 +225,6 @@ Battleground::~Battleground()
for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr)
delete itr->second;
// Iterate this way for consistency's sake - client expects it to be sent in this order
for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
delete _arenaTeamScores[i];
}
void Battleground::Update(uint32 diff)
@@ -798,7 +790,7 @@ void Battleground::EndBattleground(uint32 winner)
}
else
{
SetWinner(3);
SetWinner(3); // weird
}
SetStatus(STATUS_WAIT_LEAVE);
@@ -827,11 +819,13 @@ void Battleground::EndBattleground(uint32 winner)
SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);
SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);
uint8 winnerId = GetWinner();
uint8 loserId = winnerId == WINNER_ALLIANCE ? uint8(WINNER_HORDE) : winnerId;
// bg team that the client expects is different to TeamId
// alliance 1, horde 0
uint8 winnerTeam = winner == ALLIANCE ? WINNER_ALLIANCE : WINNER_HORDE;
uint8 loserTeam = winner == ALLIANCE ? WINNER_HORDE : WINNER_ALLIANCE;
_arenaTeamScores[winnerId]->Assign(winnerChange, winnerMatchmakerRating + winnerMatchmakerChange, winnerArenaTeam->GetName());
_arenaTeamScores[loserId]->Assign(loserChange, loserMatchmakerRating + loserMatchmakerChange, loserArenaTeam->GetName());
_arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName());
_arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName());
TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
@@ -846,8 +840,8 @@ void Battleground::EndBattleground(uint32 winner)
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
{
_arenaTeamScores[WINNER_ALLIANCE]->Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating + winnerMatchmakerChange, winnerArenaTeam->GetName());
_arenaTeamScores[WINNER_HORDE]->Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating + loserMatchmakerChange, loserArenaTeam->GetName());
_arenaTeamScores[WINNER_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());
_arenaTeamScores[WINNER_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
@@ -1165,6 +1159,9 @@ void Battleground::Reset()
delete itr->second;
PlayerScores.clear();
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].Reset();
ResetBGSubclass();
}
@@ -1445,8 +1442,8 @@ void Battleground::BuildPvPLogDataPacket(WorldPacket& data)
if (isArena())
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
_arenaTeamScores[i]->BuildTeamInfoLengthBlock(data);
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].BuildTeamInfoLengthBlock(data);
}
size_t countPos = data.bitwpos();
@@ -1460,8 +1457,8 @@ void Battleground::BuildPvPLogDataPacket(WorldPacket& data)
if (isRated())
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
_arenaTeamScores[i]->BuildRatingInfoBlock(data);
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].BuildRatingInfoBlock(data);
}
data.FlushBits();
@@ -1470,8 +1467,8 @@ void Battleground::BuildPvPLogDataPacket(WorldPacket& data)
if (isArena())
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
_arenaTeamScores[i]->BuildTeamInfoBlock(data);
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].BuildTeamInfoBlock(data);
}
data << uint8(GetPlayersCountByTeam(HORDE));

View File

@@ -22,6 +22,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "DBCEnums.h"
#include "WorldPacket.h"
class Creature;
class GameObject;
@@ -32,7 +33,6 @@ class WorldObject;
class WorldPacket;
class BattlegroundMap;
struct ArenaTeamScore;
struct BattlegroundScore;
struct Position;
struct PvPDifficultyEntry;
@@ -618,7 +618,57 @@ class Battleground
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
ArenaTeamScore* _arenaTeamScores[BG_TEAMS_COUNT];
struct ArenaTeamScore
{
friend class Battleground;
protected:
ArenaTeamScore() : RatingChange(0), MatchmakerRating(0) { }
virtual ~ArenaTeamScore() { }
void Assign(int32 ratingChange, uint32 matchMakerRating, std::string const& teamName)
{
RatingChange = ratingChange;
MatchmakerRating = matchMakerRating;
TeamName = teamName;
}
void BuildRatingInfoBlock(WorldPacket& data)
{
uint32 ratingLost = std::abs(std::min(RatingChange, 0));
uint32 ratingWon = std::max(RatingChange, 0);
// should be old rating, new rating, and client will calculate rating change itself
data << uint32(MatchmakerRating);
data << uint32(ratingLost);
data << uint32(ratingWon);
}
void BuildTeamInfoLengthBlock(WorldPacket& data)
{
data.WriteBits(TeamName.length(), 8);
}
void BuildTeamInfoBlock(WorldPacket& data)
{
data.WriteString(TeamName);
}
void Reset()
{
RatingChange = 0;
MatchmakerRating = 0;
TeamName.clear();
}
int32 RatingChange;
uint32 MatchmakerRating;
std::string TeamName;
};
ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT];
// Limits
uint32 m_LevelMin;

View File

@@ -153,7 +153,7 @@ struct BattlegroundScore
content.WriteByteSeq(PlayerGuid[2]);
}
virtual void BuildObjectivesBlock(WorldPacket& /*data*/, ByteBuffer& /*content*/) { }
virtual void BuildObjectivesBlock(WorldPacket& /*data*/, ByteBuffer& /*content*/) = 0;
// For Logging purpose
virtual std::string ToString() const { return ""; }

View File

@@ -383,6 +383,10 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (guild->GetLevel() >= 17 && guild->IsMember(receiverGuid))
deliver_delay = 0;
// don't ask for COD if there are no items
if (items_count == 0)
COD = 0;
// will delete item or place to receiver mail list
draft
.AddMoney(money)