Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Entities/Player/Player.cpp
This commit is contained in:
commit
824ee30b7f
8 files changed
+31
-28
No files matched your search
@@ -97,13 +97,13 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui
|
||||
|
||||
/// OptionText
|
||||
if (optionBroadcastText)
|
||||
ObjectMgr::GetLocaleString(optionBroadcastText->MaleText, GetLocale(), strOptionText);
|
||||
strOptionText = optionBroadcastText->GetText(GetLocale());
|
||||
else
|
||||
strOptionText = itr->second.OptionText;
|
||||
|
||||
/// BoxText
|
||||
if (boxBroadcastText)
|
||||
ObjectMgr::GetLocaleString(boxBroadcastText->MaleText, GetLocale(), strBoxText);
|
||||
strBoxText = optionBroadcastText->GetText(GetLocale());
|
||||
else
|
||||
strBoxText = itr->second.BoxText;
|
||||
|
||||
|
||||
@@ -660,10 +660,6 @@ void KillRewarder::Reward()
|
||||
|
||||
}
|
||||
|
||||
// == Player ====================================================
|
||||
|
||||
// we can disable this warning for this since it only
|
||||
// causes undefined behavior when passed to the base class constructor
|
||||
Player::Player(WorldSession* session): Unit(true), phaseMgr(this)
|
||||
{
|
||||
m_speakTime = 0;
|
||||
@@ -14492,12 +14488,12 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||
LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
if (optionBroadcastText)
|
||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
|
||||
strOptionText = optionBroadcastText->GetText(locale, getGender());
|
||||
else
|
||||
strOptionText = itr->second.OptionText;
|
||||
|
||||
if (boxBroadcastText)
|
||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
|
||||
strBoxText = optionBroadcastText->GetText(locale, getGender());
|
||||
else
|
||||
strBoxText = itr->second.BoxText;
|
||||
|
||||
|
||||
@@ -155,8 +155,6 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget,
|
||||
_damageInfo(damageInfo), _healInfo(healInfo)
|
||||
{ }
|
||||
|
||||
// we can disable this warning for this since it only
|
||||
// causes undefined behavior when passed to the base class constructor
|
||||
Unit::Unit(bool isWorldObject) :
|
||||
WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0),
|
||||
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0),
|
||||
|
||||
@@ -8644,8 +8644,8 @@ void ObjectMgr::LoadBroadcastTexts()
|
||||
|
||||
bct.Id = fields[0].GetUInt32();
|
||||
bct.Language = fields[1].GetUInt32();
|
||||
AddLocaleString(fields[2].GetString(), DEFAULT_LOCALE, bct.MaleText);
|
||||
AddLocaleString(fields[3].GetString(), DEFAULT_LOCALE, bct.FemaleText);
|
||||
bct.MaleText[DEFAULT_LOCALE] = fields[2].GetString();
|
||||
bct.FemaleText[DEFAULT_LOCALE] = fields[3].GetString();
|
||||
bct.EmoteId0 = fields[4].GetUInt32();
|
||||
bct.EmoteId1 = fields[5].GetUInt32();
|
||||
bct.EmoteId2 = fields[6].GetUInt32();
|
||||
|
||||
@@ -413,6 +413,12 @@ struct AreaTriggerStruct
|
||||
|
||||
struct BroadcastText
|
||||
{
|
||||
BroadcastText()
|
||||
{
|
||||
MaleText.resize(DEFAULT_LOCALE + 1);
|
||||
FemaleText.resize(DEFAULT_LOCALE + 1);
|
||||
}
|
||||
|
||||
uint32 Id;
|
||||
uint32 Language;
|
||||
StringVector MaleText;
|
||||
|
||||
@@ -305,8 +305,8 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(gossip->Options[i].BroadcastTextID);
|
||||
if (bct)
|
||||
{
|
||||
ObjectMgr::GetLocaleString(bct->MaleText, locale, text0[i]);
|
||||
ObjectMgr::GetLocaleString(bct->FemaleText, locale, text1[i]);
|
||||
text0[i] = bct->GetText(locale, GENDER_MALE, true);
|
||||
text1[i] = bct->GetText(locale, GENDER_FEMALE, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,18 +28,19 @@
|
||||
class CreatureTextBuilder
|
||||
{
|
||||
public:
|
||||
CreatureTextBuilder(WorldObject const* obj, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
|
||||
CreatureTextBuilder(WorldObject const* obj, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale);
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _source, _target, text, 0, "", locale);
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* _source;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
@@ -50,12 +51,12 @@ class CreatureTextBuilder
|
||||
class PlayerTextBuilder
|
||||
{
|
||||
public:
|
||||
PlayerTextBuilder(WorldObject const* obj, WorldObject const* speaker, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _talker(speaker), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
|
||||
PlayerTextBuilder(WorldObject const* obj, WorldObject const* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale);
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
|
||||
}
|
||||
@@ -63,6 +64,7 @@ class PlayerTextBuilder
|
||||
private:
|
||||
WorldObject const* _source;
|
||||
WorldObject const* _talker;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
@@ -283,14 +285,15 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
|
||||
|
||||
if (srcPlr)
|
||||
{
|
||||
PlayerTextBuilder builder(source, finalSource, finalType, iter->group, iter->id, finalLang, whisperTarget);
|
||||
PlayerTextBuilder builder(source, finalSource, finalSource->getGender(), finalType, iter->group, iter->id, finalLang, whisperTarget);
|
||||
SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatureTextBuilder builder(finalSource, finalType, iter->group, iter->id, finalLang, whisperTarget);
|
||||
CreatureTextBuilder builder(finalSource, finalSource->getGender(), finalType, iter->group, iter->id, finalLang, whisperTarget);
|
||||
SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly);
|
||||
}
|
||||
|
||||
if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f))
|
||||
SetRepeatId(source, textGroup, iter->id);
|
||||
|
||||
@@ -452,7 +455,7 @@ bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 textGroup, uint32 id, LocaleConstant locale) const
|
||||
std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const
|
||||
{
|
||||
CreatureTextMap::const_iterator mapitr = mTextMap.find(entry);
|
||||
if (mapitr == mTextMap.end())
|
||||
@@ -477,15 +480,15 @@ std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 textGrou
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(groupItr->BroadcastTextId);
|
||||
|
||||
if (bct)
|
||||
ObjectMgr::GetLocaleString(bct->MaleText, locale, baseText);
|
||||
baseText = bct->GetText(locale, gender);
|
||||
else
|
||||
baseText = groupItr->text;
|
||||
|
||||
if (locale != DEFAULT_LOCALE && !bct)
|
||||
{
|
||||
LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id));
|
||||
if (locItr != mLocaleTextMap.end())
|
||||
ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText);
|
||||
LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id));
|
||||
if (locItr != mLocaleTextMap.end())
|
||||
ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText);
|
||||
}
|
||||
|
||||
return baseText;
|
||||
|
||||
@@ -97,7 +97,7 @@ class CreatureTextMgr
|
||||
//if sent, returns the 'duration' of the text else 0 if error
|
||||
uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = NULL, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
|
||||
bool TextExist(uint32 sourceEntry, uint8 textGroup);
|
||||
std::string GetLocalizedChatString(uint32 entry, uint8 textGroup, uint32 id, LocaleConstant locale) const;
|
||||
std::string GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const;
|
||||
|
||||
template<class Builder> void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = NULL, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user