mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[6812] Implement localization of creature/gameobject name that say/yell.
Original patch deeply rewrited. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
89612654da
commit
1da8ff0043
7 changed files with 42 additions and 2 deletions
|
|
@ -2028,3 +2028,19 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
|
||||||
{
|
{
|
||||||
return objmgr.GetNpcTrainerSpells(GetEntry());
|
return objmgr.GetNpcTrainerSpells(GetEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
|
||||||
|
{
|
||||||
|
if (loc_idx >= 0)
|
||||||
|
{
|
||||||
|
CreatureLocale const *cl = objmgr.GetCreatureLocale(GetEntry());
|
||||||
|
if (cl)
|
||||||
|
{
|
||||||
|
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty())
|
||||||
|
return cl->Name[loc_idx].c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -513,6 +513,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); }
|
void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); }
|
||||||
void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); }
|
void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); }
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GetNameForLocaleIdx(int32 locale_idx) const;
|
||||||
|
|
||||||
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState
|
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState
|
||||||
|
|
||||||
bool LoadFromDB(uint32 guid, Map *map);
|
bool LoadFromDB(uint32 guid, Map *map);
|
||||||
|
|
|
||||||
|
|
@ -1245,3 +1245,19 @@ void GameObject::Use(Unit* user)
|
||||||
|
|
||||||
spell->prepare(&targets);
|
spell->prepare(&targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
|
||||||
|
{
|
||||||
|
if (loc_idx >= 0)
|
||||||
|
{
|
||||||
|
GameObjectLocale const *cl = objmgr.GetGameObjectLocale(GetEntry());
|
||||||
|
if (cl)
|
||||||
|
{
|
||||||
|
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty())
|
||||||
|
return cl->Name[loc_idx].c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -442,6 +442,9 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
||||||
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
|
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
|
||||||
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
|
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
|
||||||
|
|
||||||
|
// overwrite WorldObject function for proper name localization
|
||||||
|
const char* GetNameForLocaleIdx(int32 locale_idx) const;
|
||||||
|
|
||||||
void SaveToDB();
|
void SaveToDB();
|
||||||
void SaveToDB(uint32 mapid, uint8 spawnMask);
|
void SaveToDB(uint32 mapid, uint8 spawnMask);
|
||||||
bool LoadFromDB(uint32 guid, Map *map);
|
bool LoadFromDB(uint32 guid, Map *map);
|
||||||
|
|
|
||||||
|
|
@ -1204,7 +1204,7 @@ namespace MaNGOS
|
||||||
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
|
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
|
||||||
|
|
||||||
// TODO: i_object.GetName() also must be localized?
|
// TODO: i_object.GetName() also must be localized?
|
||||||
i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetName(),i_targetGUID);
|
i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetNameForLocaleIdx(loc_idx),i_targetGUID);
|
||||||
|
|
||||||
i_data_cache[cache_idx] = data;
|
i_data_cache[cache_idx] = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
const char* GetName() const { return m_name.c_str(); }
|
const char* GetName() const { return m_name.c_str(); }
|
||||||
void SetName(std::string newname) { m_name=newname; }
|
void SetName(std::string newname) { m_name=newname; }
|
||||||
|
|
||||||
|
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
|
||||||
|
|
||||||
float GetDistance( const WorldObject* obj ) const;
|
float GetDistance( const WorldObject* obj ) const;
|
||||||
float GetDistance(const float x, const float y, const float z) const;
|
float GetDistance(const float x, const float y, const float z) const;
|
||||||
float GetDistance2d(const WorldObject* obj) const;
|
float GetDistance2d(const WorldObject* obj) const;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6811"
|
#define REVISION_NR "6812"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue