mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7219] Improvements ins shift-links work.
* Implement support 'Hplayer' link type. Mostly as player name highlights in command messages. * Support shift-links parsing withoyt '|c' color prefix * Many related code cleanups.
This commit is contained in:
parent
a26f327314
commit
4039fa8a4a
6 changed files with 284 additions and 224 deletions
|
|
@ -42,10 +42,11 @@
|
||||||
// |color|Hgameobject_entry:go_id|h[name]|h|r
|
// |color|Hgameobject_entry:go_id|h[name]|h|r
|
||||||
// |color|Hitem:item_id:perm_ench_id:0:0|h[name]|h|r
|
// |color|Hitem:item_id:perm_ench_id:0:0|h[name]|h|r
|
||||||
// |color|Hitemset:itemset_id|h[name]|h|r
|
// |color|Hitemset:itemset_id|h[name]|h|r
|
||||||
|
// |color|Hplayer:name|h[name]|h|r - client, in some messages, at click copy only name instead link
|
||||||
// |color|Hquest:quest_id|h[name]|h|r
|
// |color|Hquest:quest_id|h[name]|h|r
|
||||||
// |color|Hskill:skill_id|h[name]|h|r
|
// |color|Hskill:skill_id|h[name]|h|r
|
||||||
// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click
|
// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click
|
||||||
// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
|
// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
|
||||||
// |color|Htele:id|h[name]|h|r
|
// |color|Htele:id|h[name]|h|r
|
||||||
// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
|
// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
|
||||||
|
|
||||||
|
|
@ -1164,12 +1165,23 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes,
|
||||||
// [name] Shift-click form |color|linkType:key|h[name]|h|r
|
// [name] Shift-click form |color|linkType:key|h[name]|h|r
|
||||||
// or
|
// or
|
||||||
// [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
|
// [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
|
||||||
|
// or
|
||||||
|
// [name] Shift-click form |linkType:key|h[name]|h|r
|
||||||
|
|
||||||
char* check = strtok(text, "|"); // skip color
|
char* tail;
|
||||||
if(!check)
|
|
||||||
return NULL; // end of data
|
|
||||||
|
|
||||||
char* cLinkType = strtok(NULL, ":"); // linktype
|
if(text[1]=='c')
|
||||||
|
{
|
||||||
|
char* check = strtok(text, "|"); // skip color
|
||||||
|
if(!check)
|
||||||
|
return NULL; // end of data
|
||||||
|
|
||||||
|
tail = strtok(NULL, ""); // tail
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tail = text+1; // skip first |
|
||||||
|
|
||||||
|
char* cLinkType = strtok(tail, ":"); // linktype
|
||||||
if(!cLinkType)
|
if(!cLinkType)
|
||||||
return NULL; // end of data
|
return NULL; // end of data
|
||||||
|
|
||||||
|
|
@ -1329,12 +1341,14 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
|
||||||
|
|
||||||
enum GuidLinkType
|
enum GuidLinkType
|
||||||
{
|
{
|
||||||
SPELL_LINK_CREATURE = 0,
|
SPELL_LINK_PLAYER = 0, // must be first for selection in not link case
|
||||||
SPELL_LINK_GAMEOBJECT = 1
|
SPELL_LINK_CREATURE = 1,
|
||||||
|
SPELL_LINK_GAMEOBJECT = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const* const guidKeys[] =
|
static char const* const guidKeys[] =
|
||||||
{
|
{
|
||||||
|
"Hplayer",
|
||||||
"Hcreature",
|
"Hcreature",
|
||||||
"Hgameobject",
|
"Hgameobject",
|
||||||
0
|
0
|
||||||
|
|
@ -1346,32 +1360,65 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
|
||||||
|
|
||||||
// |color|Hcreature:creature_guid|h[name]|h|r
|
// |color|Hcreature:creature_guid|h[name]|h|r
|
||||||
// |color|Hgameobject:go_guid|h[name]|h|r
|
// |color|Hgameobject:go_guid|h[name]|h|r
|
||||||
|
// |color|Hplayer:name|h[name]|h|r
|
||||||
char* idS = extractKeyFromLink(text,guidKeys,&type);
|
char* idS = extractKeyFromLink(text,guidKeys,&type);
|
||||||
if(!idS)
|
if(!idS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint32 lowguid = (uint32)atol(idS);
|
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
case SPELL_LINK_PLAYER:
|
||||||
|
{
|
||||||
|
std::string name = idS;
|
||||||
|
if(!normalizePlayerName(name))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(Player* player = objmgr.GetPlayer(name.c_str()))
|
||||||
|
return player->GetGUID();
|
||||||
|
|
||||||
|
if(uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
||||||
|
return guid;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
case SPELL_LINK_CREATURE:
|
case SPELL_LINK_CREATURE:
|
||||||
{
|
{
|
||||||
|
uint32 lowguid = (uint32)atol(idS);
|
||||||
|
|
||||||
if(CreatureData const* data = objmgr.GetCreatureData(lowguid) )
|
if(CreatureData const* data = objmgr.GetCreatureData(lowguid) )
|
||||||
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT);
|
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case SPELL_LINK_GAMEOBJECT:
|
case SPELL_LINK_GAMEOBJECT:
|
||||||
|
{
|
||||||
|
uint32 lowguid = (uint32)atol(idS);
|
||||||
|
|
||||||
if(GameObjectData const* data = objmgr.GetGOData(lowguid) )
|
if(GameObjectData const* data = objmgr.GetGOData(lowguid) )
|
||||||
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT);
|
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unknown type?
|
// unknown type?
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ChatHandler::extractPlayerNameFromLink(char* text)
|
||||||
|
{
|
||||||
|
// |color|Hplayer:name|h[name]|h|r
|
||||||
|
char* name_str = extractKeyFromLink(text,"Hplayer");
|
||||||
|
if(!name_str)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
std::string name = name_str;
|
||||||
|
if(!normalizePlayerName(name))
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
const char *ChatHandler::GetName() const
|
const char *ChatHandler::GetName() const
|
||||||
{
|
{
|
||||||
return m_session->GetPlayer()->GetName();
|
return m_session->GetPlayer()->GetName();
|
||||||
|
|
|
||||||
|
|
@ -453,6 +453,9 @@ class ChatHandler
|
||||||
uint32 extractSpellIdFromLink(char* text);
|
uint32 extractSpellIdFromLink(char* text);
|
||||||
uint64 extractGuidFromLink(char* text);
|
uint64 extractGuidFromLink(char* text);
|
||||||
GameTele const* extractGameTeleFromLink(char* text);
|
GameTele const* extractGameTeleFromLink(char* text);
|
||||||
|
std::string extractPlayerNameFromLink(char* text);
|
||||||
|
|
||||||
|
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
|
||||||
|
|
||||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry);
|
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,16 +257,9 @@ bool ChatHandler::HandleGPSCommand(const char* args)
|
||||||
WorldObject *obj = NULL;
|
WorldObject *obj = NULL;
|
||||||
if (*args)
|
if (*args)
|
||||||
{
|
{
|
||||||
std::string name = args;
|
uint64 guid = extractGuidFromLink((char*)args);
|
||||||
if(normalizePlayerName(name))
|
if(guid)
|
||||||
obj = objmgr.GetPlayer(name.c_str());
|
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||||
|
|
||||||
if(!obj)
|
|
||||||
{
|
|
||||||
uint64 guid = extractGuidFromLink((char*)args);
|
|
||||||
if(guid)
|
|
||||||
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!obj)
|
if(!obj)
|
||||||
{
|
{
|
||||||
|
|
@ -345,9 +338,8 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
if(!*args)
|
if(!*args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = args;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -357,13 +349,14 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
Player *chr = objmgr.GetPlayer(name.c_str());
|
Player *chr = objmgr.GetPlayer(name.c_str());
|
||||||
if (chr)
|
if (chr)
|
||||||
{
|
{
|
||||||
|
std::string nameLink = playerLink(chr->GetName());
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(chr, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(chr->IsBeingTeleported()==true)
|
if(chr->IsBeingTeleported()==true)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -373,7 +366,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
if(pMap->IsBattleGroundOrArena())
|
if(pMap->IsBattleGroundOrArena())
|
||||||
{
|
{
|
||||||
// cannot summon to bg
|
// cannot summon to bg
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_BG,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_BG,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +376,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() )
|
if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() )
|
||||||
{
|
{
|
||||||
// cannot summon from instance to instance
|
// cannot summon from instance to instance
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -394,15 +387,15 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) )
|
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) )
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
// the last check is a bit excessive, but let it be, just in case
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, chr->GetName(),"");
|
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),"");
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_SUMMONED_BY, GetName());
|
ChatHandler(chr).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(chr->isInFlight())
|
if(chr->isInFlight())
|
||||||
|
|
@ -425,7 +418,9 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, name.c_str(),GetMangosString(LANG_OFFLINE));
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),GetMangosString(LANG_OFFLINE));
|
||||||
|
|
||||||
// in point where GM stay
|
// in point where GM stay
|
||||||
Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(),
|
Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(),
|
||||||
|
|
@ -453,9 +448,8 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
|
|
||||||
Player* _player = m_session->GetPlayer();
|
Player* _player = m_session->GetPlayer();
|
||||||
|
|
||||||
std::string name = args;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -469,20 +463,22 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(chr, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
Map* cMap = chr->GetMap();
|
Map* cMap = chr->GetMap();
|
||||||
if(cMap->IsBattleGroundOrArena())
|
if(cMap->IsBattleGroundOrArena())
|
||||||
{
|
{
|
||||||
// only allow if gm mode is on
|
// only allow if gm mode is on
|
||||||
if (!_player->isGameMaster())
|
if (!_player->isGameMaster())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if already in a bg, don't let port to other
|
// if already in a bg, don't let port to other
|
||||||
else if (_player->GetBattleGroundId())
|
else if (_player->GetBattleGroundId())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -502,7 +498,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
// we are in group, we can go only if we are in the player group
|
// we are in group, we can go only if we are in the player group
|
||||||
if (_player->GetGroup() != chr->GetGroup())
|
if (_player->GetGroup() != chr->GetGroup())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -536,10 +532,12 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
_player->SetDifficulty(chr->GetDifficulty());
|
_player->SetDifficulty(chr->GetDifficulty());
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_APPEARING_AT, chr->GetName());
|
PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
|
||||||
|
|
||||||
|
std::string plNameLink = playerLink(_player->GetName());
|
||||||
|
|
||||||
if (_player->IsVisibleGloballyFor(chr))
|
if (_player->IsVisibleGloballyFor(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_APPEARING_TO, _player->GetName());
|
ChatHandler(chr).PSendSysMessage(LANG_APPEARING_TO, plNameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(_player->isInFlight())
|
if(_player->isInFlight())
|
||||||
|
|
@ -566,7 +564,9 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PSendSysMessage(LANG_APPEARING_AT, name.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
|
||||||
|
|
||||||
// to point where player stay (if loaded)
|
// to point where player stay (if loaded)
|
||||||
float x,y,z,o;
|
float x,y,z,o;
|
||||||
|
|
@ -612,9 +612,8 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string name = args;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -637,7 +636,8 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
||||||
|
|
||||||
if(chr->IsBeingTeleported())
|
if(chr->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
std::string nameLink = playerLink(chr->GetName());
|
||||||
|
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1989,9 +1989,13 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
|
|
||||||
// format: name "subject text" "mail text"
|
// format: name "subject text" "mail text"
|
||||||
|
|
||||||
char* pName = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if(!pName)
|
if(name.empty())
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char* tail1 = strtok(NULL, "");
|
char* tail1 = strtok(NULL, "");
|
||||||
if(!tail1)
|
if(!tail1)
|
||||||
|
|
@ -2029,18 +2033,10 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
if (!msgText)
|
if (!msgText)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
// msgSubject, msgText isn't NUL after prev. check
|
||||||
std::string name = pName;
|
|
||||||
std::string subject = msgSubject;
|
std::string subject = msgSubject;
|
||||||
std::string text = msgText;
|
std::string text = msgText;
|
||||||
|
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
if(!receiver_guid)
|
if(!receiver_guid)
|
||||||
{
|
{
|
||||||
|
|
@ -2060,7 +2056,8 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
|
|
||||||
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_NONE);
|
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_NONE);
|
||||||
|
|
||||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2070,14 +2067,8 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
||||||
if(!*args)
|
if(!*args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char* pName = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!pName)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string name = pName;
|
|
||||||
|
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2104,16 +2095,21 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(chr, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
if(chr->IsBeingTeleported()==true)
|
if(chr->IsBeingTeleported()==true)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", tele->name.c_str());
|
PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", tele->name.c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
|
{
|
||||||
|
std::string plNameLink = playerLink(GetName());
|
||||||
|
ChatHandler(chr).PSendSysMessage(LANG_TELEPORTED_TO_BY, plNameLink.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(chr->isInFlight())
|
if(chr->isInFlight())
|
||||||
|
|
@ -2127,13 +2123,15 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
||||||
|
|
||||||
chr->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation);
|
chr->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation);
|
||||||
}
|
}
|
||||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str()))
|
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
||||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
||||||
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),guid);
|
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),guid);
|
||||||
}
|
}
|
||||||
|
|
@ -2170,10 +2168,12 @@ bool ChatHandler::HandleGroupTeleCommand(const char * args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string nameLink = playerLink(player->GetName());
|
||||||
|
|
||||||
Group *grp = player->GetGroup();
|
Group *grp = player->GetGroup();
|
||||||
if(!grp)
|
if(!grp)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_NOT_IN_GROUP,player->GetName());
|
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2189,15 +2189,17 @@ bool ChatHandler::HandleGroupTeleCommand(const char * args)
|
||||||
if (HasLowerSecurity(pl, 0))
|
if (HasLowerSecurity(pl, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string plNameLink = playerLink(pl->GetName());
|
||||||
|
|
||||||
if(pl->IsBeingTeleported())
|
if(pl->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_TELEPORTING_TO, pl->GetName(),"", tele->name.c_str());
|
PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(),"", tele->name.c_str());
|
||||||
if (needReportToTarget(pl))
|
if (needReportToTarget(pl))
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
|
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(pl->isInFlight())
|
if(pl->isInFlight())
|
||||||
|
|
@ -2221,9 +2223,8 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
if(!*args)
|
if(!*args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = args;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2244,9 +2245,11 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
|
|
||||||
Group *grp = player->GetGroup();
|
Group *grp = player->GetGroup();
|
||||||
|
|
||||||
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
if(!grp)
|
if(!grp)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_NOT_IN_GROUP,player->GetName());
|
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2276,9 +2279,11 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
if (HasLowerSecurity(pl, 0))
|
if (HasLowerSecurity(pl, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string plNameLink = playerLink(name);
|
||||||
|
|
||||||
if(pl->IsBeingTeleported()==true)
|
if(pl->IsBeingTeleported()==true)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2290,15 +2295,15 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() )
|
if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() )
|
||||||
{
|
{
|
||||||
// cannot summon from instance to instance
|
// cannot summon from instance to instance
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,pl->GetName());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,plNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, pl->GetName(),"");
|
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(),"");
|
||||||
if (needReportToTarget(pl))
|
if (needReportToTarget(pl))
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetName());
|
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(pl->isInFlight())
|
if(pl->isInFlight())
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,13 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *charname = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if (!charname)
|
if(name.empty())
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
std::string cname = charname;
|
|
||||||
|
|
||||||
char *timetonotspeak = strtok(NULL, " ");
|
char *timetonotspeak = strtok(NULL, " ");
|
||||||
if(!timetonotspeak)
|
if(!timetonotspeak)
|
||||||
|
|
@ -69,14 +71,7 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
||||||
|
|
||||||
uint32 notspeaktime = (uint32) atoi(timetonotspeak);
|
uint32 notspeaktime = (uint32) atoi(timetonotspeak);
|
||||||
|
|
||||||
if(!normalizePlayerName(cname))
|
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(cname.c_str());
|
|
||||||
if(!guid)
|
if(!guid)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
|
@ -102,7 +97,9 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
||||||
if(chr)
|
if(chr)
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_DISABLE_CHAT, cname.c_str(), notspeaktime);
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), notspeaktime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -113,20 +110,15 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
||||||
if (!*args)
|
if (!*args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *charname = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if (!charname)
|
if(name.empty())
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string cname = charname;
|
|
||||||
|
|
||||||
if(!normalizePlayerName(cname))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(cname.c_str());
|
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
if(!guid)
|
if(!guid)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
|
@ -159,7 +151,9 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
||||||
if(chr)
|
if(chr)
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_ENABLE_CHAT, cname.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1662,8 +1656,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
|
||||||
//kick player
|
//kick player
|
||||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||||
{
|
{
|
||||||
char* kickName = strtok((char*)args, " ");
|
if (!args)
|
||||||
if (!kickName)
|
|
||||||
{
|
{
|
||||||
Player* player = getSelectedPlayer();
|
Player* player = getSelectedPlayer();
|
||||||
|
|
||||||
|
|
@ -1689,8 +1682,8 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string name = kickName;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -1709,12 +1702,14 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||||
if (player && HasLowerSecurity(player, 0))
|
if (player && HasLowerSecurity(player, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
if(sWorld.KickPlayer(name))
|
if(sWorld.KickPlayer(name))
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,name.c_str());
|
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,nameLink.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,name.c_str());
|
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,nameLink.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1754,12 +1749,8 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
|
|
||||||
if (px)
|
if (px)
|
||||||
{
|
{
|
||||||
name = px;
|
name = extractPlayerNameFromLink(px);
|
||||||
|
|
||||||
if(name.empty())
|
if(name.empty())
|
||||||
return false;
|
|
||||||
|
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -1871,7 +1862,9 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), name.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
||||||
|
|
||||||
std::string timeStr = secsToTimeString(total_player_time,true,true);
|
std::string timeStr = secsToTimeString(total_player_time,true,true);
|
||||||
uint32 gold = money /GOLD;
|
uint32 gold = money /GOLD;
|
||||||
|
|
@ -1928,7 +1921,9 @@ void ChatHandler::ShowTicket(uint64 guid, char const* text, char const* time)
|
||||||
if(!objmgr.GetPlayerNameByGUID(guid,name))
|
if(!objmgr.GetPlayerNameByGUID(guid,name))
|
||||||
name = GetMangosString(LANG_UNKNOWN);
|
name = GetMangosString(LANG_UNKNOWN);
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_TICKETVIEW, name.c_str(),time,text);
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_COMMAND_TICKETVIEW, nameLink.c_str(),time,text);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ticket commands
|
//ticket commands
|
||||||
|
|
@ -2008,9 +2003,8 @@ bool ChatHandler::HandleTicketCommand(const char* args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = px;
|
std::string name = extractPlayerNameFromLink(px);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2079,9 +2073,8 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = px;
|
std::string name = extractPlayerNameFromLink(px);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2100,7 +2093,9 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
||||||
if(Player* sender = objmgr.GetPlayer(guid))
|
if(Player* sender = objmgr.GetPlayer(guid))
|
||||||
sender->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
sender->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,px);
|
std::string nameLink = playerLink(name);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3333,9 +3328,8 @@ bool ChatHandler::HandleRenameCommand(const char* args)
|
||||||
|
|
||||||
if(px)
|
if(px)
|
||||||
{
|
{
|
||||||
oldname = px;
|
oldname = extractPlayerNameFromLink(px);
|
||||||
|
if(oldname.empty())
|
||||||
if(!normalizePlayerName(oldname))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -3366,7 +3360,9 @@ bool ChatHandler::HandleRenameCommand(const char* args)
|
||||||
if (HasLowerSecurity(target, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PSendSysMessage(LANG_RENAME_PLAYER, target->GetName());
|
std::string tNameLink = playerLink(target->GetName());
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_RENAME_PLAYER, tNameLink.c_str());
|
||||||
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", target->GetGUIDLow());
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", target->GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
@ -3376,7 +3372,9 @@ bool ChatHandler::HandleRenameCommand(const char* args)
|
||||||
if (HasLowerSecurity(NULL, targetGUID))
|
if (HasLowerSecurity(NULL, targetGUID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldname.c_str(), GUID_LOPART(targetGUID));
|
std::string oldNameLink = playerLink(oldname);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3394,9 +3392,8 @@ bool ChatHandler::HandleCustomizeCommand(const char* args)
|
||||||
|
|
||||||
if(px)
|
if(px)
|
||||||
{
|
{
|
||||||
oldname = px;
|
oldname = extractPlayerNameFromLink(px);
|
||||||
|
if(oldname.empty())
|
||||||
if(!normalizePlayerName(oldname))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -3423,13 +3420,17 @@ bool ChatHandler::HandleCustomizeCommand(const char* args)
|
||||||
|
|
||||||
if(target)
|
if(target)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, target->GetName());
|
std::string tNameLink = playerLink(target->GetName());
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, tNameLink.c_str());
|
||||||
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
|
target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target->GetGUIDLow());
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target->GetGUIDLow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldname.c_str(), GUID_LOPART(targetGUID));
|
std::string oldNameLink = playerLink(oldname);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3801,9 +3802,8 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
|
||||||
|
|
||||||
if(*args)
|
if(*args)
|
||||||
{
|
{
|
||||||
std::string playername = args;
|
std::string playername = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(playername.empty())
|
||||||
if(!normalizePlayerName(playername))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
|
||||||
|
|
@ -1788,13 +1788,11 @@ bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/)
|
||||||
|
|
||||||
bool ChatHandler::HandleLearnAllDefaultCommand(const char* args)
|
bool ChatHandler::HandleLearnAllDefaultCommand(const char* args)
|
||||||
{
|
{
|
||||||
char* pName = strtok((char*)args, "");
|
|
||||||
Player *player = NULL;
|
Player *player = NULL;
|
||||||
if (pName)
|
if (*args)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -1816,7 +1814,9 @@ bool ChatHandler::HandleLearnAllDefaultCommand(const char* args)
|
||||||
player->learnDefaultSpells();
|
player->learnDefaultSpells();
|
||||||
player->learnQuestRewardedSpells();
|
player->learnQuestRewardedSpells();
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_LEARN_ALL_DEFAULT_AND_QUEST,player->GetName());
|
std::string nameLink = playerLink(player->GetName());
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_COMMAND_LEARN_ALL_DEFAULT_AND_QUEST,nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3064,11 +3064,11 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
|
||||||
if (!targetGuild)
|
if (!targetGuild)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plName = par1;
|
std::string plName = extractPlayerNameFromLink(par1);
|
||||||
if (!normalizePlayerName (plName))
|
if(plName.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage (true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3076,7 +3076,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
|
||||||
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
||||||
plGuid = targetPlayer->GetGUID ();
|
plGuid = targetPlayer->GetGUID ();
|
||||||
else
|
else
|
||||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||||
|
|
||||||
if (!plGuid)
|
if (!plGuid)
|
||||||
false;
|
false;
|
||||||
|
|
@ -3097,11 +3097,11 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
|
||||||
if(!par1)
|
if(!par1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plName = par1;
|
std::string plName = extractPlayerNameFromLink(par1);
|
||||||
if (!normalizePlayerName (plName))
|
if(plName.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage (true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3114,7 +3114,7 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||||
glId = Player::GetGuildIdFromDB (plGuid);
|
glId = Player::GetGuildIdFromDB (plGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3139,14 +3139,16 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
|
||||||
char* par2 = strtok (NULL, " ");
|
char* par2 = strtok (NULL, " ");
|
||||||
if (!par1 || !par2)
|
if (!par1 || !par2)
|
||||||
return false;
|
return false;
|
||||||
std::string plName = par1;
|
|
||||||
if (!normalizePlayerName (plName))
|
std::string plName = extractPlayerNameFromLink(par1);
|
||||||
|
if(plName.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage (true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint64 plGuid = 0;
|
uint64 plGuid = 0;
|
||||||
uint32 glId = 0;
|
uint32 glId = 0;
|
||||||
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
||||||
|
|
@ -3156,7 +3158,7 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||||
glId = Player::GetGuildIdFromDB (plGuid);
|
glId = Player::GetGuildIdFromDB (plGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3405,8 +3407,8 @@ bool ChatHandler::HandleReviveCommand(const char* args)
|
||||||
|
|
||||||
if (*args)
|
if (*args)
|
||||||
{
|
{
|
||||||
std::string name = args;
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -3766,8 +3768,8 @@ bool ChatHandler::HandleLevelUpCommand(const char* args)
|
||||||
|
|
||||||
if(pname) // player by name
|
if(pname) // player by name
|
||||||
{
|
{
|
||||||
name = pname;
|
name = extractPlayerNameFromLink(pname);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -3835,7 +3837,10 @@ bool ChatHandler::HandleLevelUpCommand(const char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_session->GetPlayer() != chr) // including chr==NULL
|
if(m_session->GetPlayer() != chr) // including chr==NULL
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_LVL,name.c_str(),newlevel);
|
{
|
||||||
|
std::string nameLink = playerLink(name);
|
||||||
|
PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4293,15 +4298,15 @@ bool ChatHandler::HandleResetHonorCommand (const char * args)
|
||||||
Player *player = NULL;
|
Player *player = NULL;
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink(pName);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
player = objmgr.GetPlayer(guid);
|
player = objmgr.GetPlayer(guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4383,15 +4388,15 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
|
||||||
Player *player = NULL;
|
Player *player = NULL;
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink(pName);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
player = objmgr.GetPlayer(guid);
|
player = objmgr.GetPlayer(guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4436,15 +4441,15 @@ bool ChatHandler::HandleResetStatsCommand(const char * args)
|
||||||
Player *player = NULL;
|
Player *player = NULL;
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink(pName);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
player = objmgr.GetPlayer(guid);
|
player = objmgr.GetPlayer(guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4476,9 +4481,8 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
||||||
uint64 playerGUID = 0;
|
uint64 playerGUID = 0;
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink(pName);
|
||||||
|
if(name.empty())
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -4487,7 +4491,7 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
||||||
|
|
||||||
player = objmgr.GetPlayer(name.c_str());
|
player = objmgr.GetPlayer(name.c_str());
|
||||||
if(!player)
|
if(!player)
|
||||||
playerGUID = objmgr.GetPlayerGUIDByName(name.c_str());
|
playerGUID = objmgr.GetPlayerGUIDByName(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player = getSelectedPlayer();
|
player = getSelectedPlayer();
|
||||||
|
|
@ -4506,7 +4510,10 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
||||||
ChatHandler(player).SendSysMessage(LANG_RESET_SPELLS);
|
ChatHandler(player).SendSysMessage(LANG_RESET_SPELLS);
|
||||||
|
|
||||||
if(m_session->GetPlayer()!=player)
|
if(m_session->GetPlayer()!=player)
|
||||||
PSendSysMessage(LANG_RESET_SPELLS_ONLINE,player->GetName());
|
{
|
||||||
|
std::string nameLink = playerLink(player->GetName());
|
||||||
|
PSendSysMessage(LANG_RESET_SPELLS_ONLINE,nameLink.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -4524,8 +4531,8 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
uint64 playerGUID = 0;
|
uint64 playerGUID = 0;
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
std::string name = pName;
|
std::string name = extractPlayerNameFromLink(pName);
|
||||||
if(!normalizePlayerName(name))
|
if(name.empty())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -4534,7 +4541,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
|
|
||||||
player = objmgr.GetPlayer(name.c_str());
|
player = objmgr.GetPlayer(name.c_str());
|
||||||
if(!player)
|
if(!player)
|
||||||
playerGUID = objmgr.GetPlayerGUIDByName(name.c_str());
|
playerGUID = objmgr.GetPlayerGUIDByName(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player = getSelectedPlayer();
|
player = getSelectedPlayer();
|
||||||
|
|
@ -4546,13 +4553,17 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
||||||
|
|
||||||
if(m_session->GetPlayer()!=player)
|
if(m_session->GetPlayer()!=player)
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,player->GetName());
|
{
|
||||||
|
std::string nameLink = playerLink(player->GetName());
|
||||||
|
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,nameLink.c_str());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (playerGUID)
|
else if (playerGUID)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",uint32(AT_LOGIN_RESET_TALENTS), GUID_LOPART(playerGUID) );
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",uint32(AT_LOGIN_RESET_TALENTS), GUID_LOPART(playerGUID) );
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE,pName);
|
std::string nameLink = playerLink(pName);
|
||||||
|
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE,nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Try reset talenents as Hunter Pet
|
// Try reset talenents as Hunter Pet
|
||||||
|
|
@ -4566,7 +4577,10 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||||
player = (Player *)owner;
|
player = (Player *)owner;
|
||||||
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
||||||
if(m_session->GetPlayer()!=player)
|
if(m_session->GetPlayer()!=player)
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,player->GetName());
|
{
|
||||||
|
std::string nameLink = playerLink(player->GetName());
|
||||||
|
PSendSysMessage(LANG_RESET_TALENTS_ONLINE,nameLink.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -5130,12 +5144,8 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char* args)
|
||||||
if(!args)
|
if(!args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char* cname = strtok ((char*)args, "");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if(!cname)
|
if(name.empty())
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string name = cname;
|
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -5635,12 +5645,11 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
|
||||||
guid = atoi(p2);
|
guid = atoi(p2);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string name = p2;
|
std::string name = extractPlayerNameFromLink(p2);
|
||||||
|
if(name.empty())
|
||||||
if (!normalizePlayerName (name))
|
|
||||||
{
|
{
|
||||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
SetSentErrorMessage (true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6253,9 +6262,13 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
||||||
|
|
||||||
// format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
|
// format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
|
||||||
|
|
||||||
char* pName = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if(!pName)
|
if(name.empty())
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char* tail1 = strtok(NULL, "");
|
char* tail1 = strtok(NULL, "");
|
||||||
if(!tail1)
|
if(!tail1)
|
||||||
|
|
@ -6293,8 +6306,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
||||||
if (!msgText)
|
if (!msgText)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
// msgSubject, msgText isn't NUL after prev. check
|
||||||
std::string name = pName;
|
|
||||||
std::string subject = msgSubject;
|
std::string subject = msgSubject;
|
||||||
std::string text = msgText;
|
std::string text = msgText;
|
||||||
|
|
||||||
|
|
@ -6352,13 +6364,6 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
if(!receiver_guid)
|
if(!receiver_guid)
|
||||||
{
|
{
|
||||||
|
|
@ -6390,7 +6395,8 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
||||||
|
|
||||||
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, &mi, 0, 0, MAIL_CHECK_MASK_NONE);
|
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, &mi, 0, 0, MAIL_CHECK_MASK_NONE);
|
||||||
|
|
||||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6402,9 +6408,13 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
||||||
|
|
||||||
/// format: name "subject text" "mail text" money
|
/// format: name "subject text" "mail text" money
|
||||||
|
|
||||||
char* pName = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
if (!pName)
|
if(name.empty())
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char* tail1 = strtok(NULL, "");
|
char* tail1 = strtok(NULL, "");
|
||||||
if (!tail1)
|
if (!tail1)
|
||||||
|
|
@ -6447,18 +6457,10 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
||||||
if (money <= 0)
|
if (money <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
// msgSubject, msgText isn't NUL after prev. check
|
||||||
std::string name = pName;
|
|
||||||
std::string subject = msgSubject;
|
std::string subject = msgSubject;
|
||||||
std::string text = msgText;
|
std::string text = msgText;
|
||||||
|
|
||||||
if (!normalizePlayerName(name))
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
if (!receiver_guid)
|
if (!receiver_guid)
|
||||||
{
|
{
|
||||||
|
|
@ -6480,7 +6482,8 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
||||||
|
|
||||||
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, money, 0, MAIL_CHECK_MASK_NONE);
|
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, money, 0, MAIL_CHECK_MASK_NONE);
|
||||||
|
|
||||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
std::string nameLink = playerLink(name);
|
||||||
|
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6488,15 +6491,16 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
||||||
bool ChatHandler::HandleSendMessageCommand(const char* args)
|
bool ChatHandler::HandleSendMessageCommand(const char* args)
|
||||||
{
|
{
|
||||||
///- Get the command line arguments
|
///- Get the command line arguments
|
||||||
char* name_str = strtok((char*)args, " ");
|
std::string name = extractPlayerNameFromLink((char*)args);
|
||||||
char* msg_str = strtok(NULL, "");
|
if(name.empty())
|
||||||
|
{
|
||||||
if(!name_str || !msg_str)
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string name = name_str;
|
char* msg_str = strtok(NULL, "");
|
||||||
|
if(!msg_str)
|
||||||
if(!normalizePlayerName(name))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
///- Find the player and check that he is not logging out.
|
///- Find the player and check that he is not logging out.
|
||||||
|
|
@ -6521,7 +6525,8 @@ bool ChatHandler::HandleSendMessageCommand(const char* args)
|
||||||
rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
|
rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
|
||||||
|
|
||||||
//Confirmation message
|
//Confirmation message
|
||||||
PSendSysMessage(LANG_SENDMESSAGE,name.c_str(),msg_str);
|
std::string nameLink = playerLink(name);
|
||||||
|
PSendSysMessage(LANG_SENDMESSAGE,nameLink.c_str(),msg_str);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7218"
|
#define REVISION_NR "7219"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue