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,6 +42,7 @@
|
|||
// |color|Hgameobject_entry:go_id|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|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|Hskill:skill_id|h[name]|h|r
|
||||
// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell 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
|
||||
// or
|
||||
// [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* tail;
|
||||
|
||||
if(text[1]=='c')
|
||||
{
|
||||
char* check = strtok(text, "|"); // skip color
|
||||
if(!check)
|
||||
return NULL; // end of data
|
||||
|
||||
char* cLinkType = strtok(NULL, ":"); // linktype
|
||||
tail = strtok(NULL, ""); // tail
|
||||
}
|
||||
else
|
||||
tail = text+1; // skip first |
|
||||
|
||||
char* cLinkType = strtok(tail, ":"); // linktype
|
||||
if(!cLinkType)
|
||||
return NULL; // end of data
|
||||
|
||||
|
|
@ -1329,12 +1341,14 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
|
|||
|
||||
enum GuidLinkType
|
||||
{
|
||||
SPELL_LINK_CREATURE = 0,
|
||||
SPELL_LINK_GAMEOBJECT = 1
|
||||
SPELL_LINK_PLAYER = 0, // must be first for selection in not link case
|
||||
SPELL_LINK_CREATURE = 1,
|
||||
SPELL_LINK_GAMEOBJECT = 2
|
||||
};
|
||||
|
||||
static char const* const guidKeys[] =
|
||||
{
|
||||
"Hplayer",
|
||||
"Hcreature",
|
||||
"Hgameobject",
|
||||
0
|
||||
|
|
@ -1346,32 +1360,65 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
|
|||
|
||||
// |color|Hcreature:creature_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);
|
||||
if(!idS)
|
||||
return 0;
|
||||
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
|
||||
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:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
|
||||
if(CreatureData const* data = objmgr.GetCreatureData(lowguid) )
|
||||
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
case SPELL_LINK_GAMEOBJECT:
|
||||
{
|
||||
uint32 lowguid = (uint32)atol(idS);
|
||||
|
||||
if(GameObjectData const* data = objmgr.GetGOData(lowguid) )
|
||||
return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type?
|
||||
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
|
||||
{
|
||||
return m_session->GetPlayer()->GetName();
|
||||
|
|
|
|||
|
|
@ -453,6 +453,9 @@ class ChatHandler
|
|||
uint32 extractSpellIdFromLink(char* text);
|
||||
uint64 extractGuidFromLink(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);
|
||||
|
||||
|
|
|
|||
|
|
@ -256,17 +256,10 @@ bool ChatHandler::HandleGPSCommand(const char* args)
|
|||
{
|
||||
WorldObject *obj = NULL;
|
||||
if (*args)
|
||||
{
|
||||
std::string name = args;
|
||||
if(normalizePlayerName(name))
|
||||
obj = objmgr.GetPlayer(name.c_str());
|
||||
|
||||
if(!obj)
|
||||
{
|
||||
uint64 guid = extractGuidFromLink((char*)args);
|
||||
if(guid)
|
||||
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||
}
|
||||
|
||||
if(!obj)
|
||||
{
|
||||
|
|
@ -345,9 +338,8 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
if(!*args)
|
||||
return false;
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -357,13 +349,14 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
Player *chr = objmgr.GetPlayer(name.c_str());
|
||||
if (chr)
|
||||
{
|
||||
std::string nameLink = playerLink(chr->GetName());
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if(chr->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -373,7 +366,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
if(pMap->IsBattleGroundOrArena())
|
||||
{
|
||||
// cannot summon to bg
|
||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_BG,chr->GetName());
|
||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_BG,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -383,7 +376,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() )
|
||||
{
|
||||
// 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);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -394,15 +387,15 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) )
|
||||
// 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);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_SUMMONING, chr->GetName(),"");
|
||||
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),"");
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_SUMMONED_BY, GetName());
|
||||
ChatHandler(chr).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(chr->isInFlight())
|
||||
|
|
@ -425,7 +418,9 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
|||
if (HasLowerSecurity(NULL, guid))
|
||||
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
|
||||
Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(),
|
||||
|
|
@ -453,9 +448,8 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -469,20 +463,22 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
Map* cMap = chr->GetMap();
|
||||
if(cMap->IsBattleGroundOrArena())
|
||||
{
|
||||
// only allow if gm mode is on
|
||||
if (!_player->isGameMaster())
|
||||
{
|
||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,chr->GetName());
|
||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
// if already in a bg, don't let port to other
|
||||
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);
|
||||
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
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -536,10 +532,12 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
_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))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_APPEARING_TO, _player->GetName());
|
||||
ChatHandler(chr).PSendSysMessage(LANG_APPEARING_TO, plNameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(_player->isInFlight())
|
||||
|
|
@ -566,7 +564,9 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
|||
if (HasLowerSecurity(NULL, guid))
|
||||
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)
|
||||
float x,y,z,o;
|
||||
|
|
@ -612,9 +612,8 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string name = args;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -637,7 +636,8 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
|||
|
||||
if(chr->IsBeingTeleported())
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
||||
std::string nameLink = playerLink(chr->GetName());
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1989,9 +1989,13 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
|||
|
||||
// format: name "subject text" "mail text"
|
||||
|
||||
char* pName = strtok((char*)args, " ");
|
||||
if(!pName)
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* tail1 = strtok(NULL, "");
|
||||
if(!tail1)
|
||||
|
|
@ -2029,18 +2033,10 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
|||
if (!msgText)
|
||||
return false;
|
||||
|
||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
||||
std::string name = pName;
|
||||
// msgSubject, msgText isn't NUL after prev. check
|
||||
std::string subject = msgSubject;
|
||||
std::string text = msgText;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
||||
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);
|
||||
|
||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
||||
std::string nameLink = playerLink(name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2070,14 +2067,8 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
|||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* pName = strtok((char*)args, " ");
|
||||
|
||||
if(!pName)
|
||||
return false;
|
||||
|
||||
std::string name = pName;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -2104,16 +2095,21 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
|||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
if(chr->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName());
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", tele->name.c_str());
|
||||
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
|
||||
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);
|
||||
}
|
||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str()))
|
||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, guid))
|
||||
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,
|
||||
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;
|
||||
}
|
||||
|
||||
std::string nameLink = playerLink(player->GetName());
|
||||
|
||||
Group *grp = player->GetGroup();
|
||||
if(!grp)
|
||||
{
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,player->GetName());
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2189,15 +2189,17 @@ bool ChatHandler::HandleGroupTeleCommand(const char * args)
|
|||
if (HasLowerSecurity(pl, 0))
|
||||
return false;
|
||||
|
||||
std::string plNameLink = playerLink(pl->GetName());
|
||||
|
||||
if(pl->IsBeingTeleported())
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
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))
|
||||
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetName());
|
||||
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(pl->isInFlight())
|
||||
|
|
@ -2221,9 +2223,8 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
if(!*args)
|
||||
return false;
|
||||
|
||||
std::string name = args;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -2244,9 +2245,11 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
|
||||
Group *grp = player->GetGroup();
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
if(!grp)
|
||||
{
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,player->GetName());
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2276,9 +2279,11 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
if (HasLowerSecurity(pl, 0))
|
||||
return false;
|
||||
|
||||
std::string plNameLink = playerLink(name);
|
||||
|
||||
if(pl->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, pl->GetName());
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2290,15 +2295,15 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
|||
if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() )
|
||||
{
|
||||
// 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);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_SUMMONING, pl->GetName(),"");
|
||||
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(),"");
|
||||
if (needReportToTarget(pl))
|
||||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetName());
|
||||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(pl->isInFlight())
|
||||
|
|
|
|||
|
|
@ -57,11 +57,13 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char *charname = strtok((char*)args, " ");
|
||||
if (!charname)
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
|
||||
std::string cname = charname;
|
||||
}
|
||||
|
||||
char *timetonotspeak = strtok(NULL, " ");
|
||||
if(!timetonotspeak)
|
||||
|
|
@ -69,14 +71,7 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
|||
|
||||
uint32 notspeaktime = (uint32) atoi(timetonotspeak);
|
||||
|
||||
if(!normalizePlayerName(cname))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(cname.c_str());
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
if(!guid)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
|
|
@ -102,7 +97,9 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
|||
if(chr)
|
||||
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;
|
||||
}
|
||||
|
|
@ -113,20 +110,15 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char *charname = strtok((char*)args, " ");
|
||||
if (!charname)
|
||||
return false;
|
||||
|
||||
std::string cname = charname;
|
||||
|
||||
if(!normalizePlayerName(cname))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(cname.c_str());
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
if(!guid)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
|
|
@ -159,7 +151,9 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
|||
if(chr)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1662,8 +1656,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
|
|||
//kick player
|
||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
{
|
||||
char* kickName = strtok((char*)args, " ");
|
||||
if (!kickName)
|
||||
if (!args)
|
||||
{
|
||||
Player* player = getSelectedPlayer();
|
||||
|
||||
|
|
@ -1689,8 +1682,8 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string name = kickName;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1709,12 +1702,14 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
|||
if (player && HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
if(sWorld.KickPlayer(name))
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,name.c_str());
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,nameLink.c_str());
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,name.c_str());
|
||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,nameLink.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1754,12 +1749,8 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
|
||||
if (px)
|
||||
{
|
||||
name = px;
|
||||
|
||||
name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
return false;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1871,7 +1862,9 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
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);
|
||||
uint32 gold = money /GOLD;
|
||||
|
|
@ -1928,7 +1921,9 @@ void ChatHandler::ShowTicket(uint64 guid, char const* text, char const* time)
|
|||
if(!objmgr.GetPlayerNameByGUID(guid,name))
|
||||
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
|
||||
|
|
@ -2008,9 +2003,8 @@ bool ChatHandler::HandleTicketCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string name = px;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -2079,9 +2073,8 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string name = px;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -2100,7 +2093,9 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
|||
if(Player* sender = objmgr.GetPlayer(guid))
|
||||
sender->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,px);
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,nameLink.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3333,9 +3328,8 @@ bool ChatHandler::HandleRenameCommand(const char* args)
|
|||
|
||||
if(px)
|
||||
{
|
||||
oldname = px;
|
||||
|
||||
if(!normalizePlayerName(oldname))
|
||||
oldname = extractPlayerNameFromLink(px);
|
||||
if(oldname.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -3366,7 +3360,9 @@ bool ChatHandler::HandleRenameCommand(const char* args)
|
|||
if (HasLowerSecurity(target, 0))
|
||||
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);
|
||||
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))
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
@ -3394,9 +3392,8 @@ bool ChatHandler::HandleCustomizeCommand(const char* args)
|
|||
|
||||
if(px)
|
||||
{
|
||||
oldname = px;
|
||||
|
||||
if(!normalizePlayerName(oldname))
|
||||
oldname = extractPlayerNameFromLink(px);
|
||||
if(oldname.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -3423,13 +3420,17 @@ bool ChatHandler::HandleCustomizeCommand(const char* args)
|
|||
|
||||
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);
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target->GetGUIDLow());
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
@ -3801,9 +3802,8 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
|
|||
|
||||
if(*args)
|
||||
{
|
||||
std::string playername = args;
|
||||
|
||||
if(!normalizePlayerName(playername))
|
||||
std::string playername = extractPlayerNameFromLink((char*)args);
|
||||
if(playername.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
|
|
@ -1788,13 +1788,11 @@ bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleLearnAllDefaultCommand(const char* args)
|
||||
{
|
||||
char* pName = strtok((char*)args, "");
|
||||
Player *player = NULL;
|
||||
if (pName)
|
||||
if (*args)
|
||||
{
|
||||
std::string name = pName;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1816,7 +1814,9 @@ bool ChatHandler::HandleLearnAllDefaultCommand(const char* args)
|
|||
player->learnDefaultSpells();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -3064,11 +3064,11 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
|
|||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
std::string plName = par1;
|
||||
if (!normalizePlayerName (plName))
|
||||
std::string plName = extractPlayerNameFromLink(par1);
|
||||
if(plName.empty())
|
||||
{
|
||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3076,7 +3076,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
|
|||
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
||||
plGuid = targetPlayer->GetGUID ();
|
||||
else
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||
|
||||
if (!plGuid)
|
||||
false;
|
||||
|
|
@ -3097,11 +3097,11 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
|
|||
if(!par1)
|
||||
return false;
|
||||
|
||||
std::string plName = par1;
|
||||
if (!normalizePlayerName (plName))
|
||||
std::string plName = extractPlayerNameFromLink(par1);
|
||||
if(plName.empty())
|
||||
{
|
||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3114,7 +3114,7 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||
glId = Player::GetGuildIdFromDB (plGuid);
|
||||
}
|
||||
|
||||
|
|
@ -3139,14 +3139,16 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
|
|||
char* par2 = strtok (NULL, " ");
|
||||
if (!par1 || !par2)
|
||||
return false;
|
||||
std::string plName = par1;
|
||||
if (!normalizePlayerName (plName))
|
||||
|
||||
std::string plName = extractPlayerNameFromLink(par1);
|
||||
if(plName.empty())
|
||||
{
|
||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
uint64 plGuid = 0;
|
||||
uint32 glId = 0;
|
||||
if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ()))
|
||||
|
|
@ -3156,7 +3158,7 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ());
|
||||
plGuid = objmgr.GetPlayerGUIDByName (plName);
|
||||
glId = Player::GetGuildIdFromDB (plGuid);
|
||||
}
|
||||
|
||||
|
|
@ -3405,8 +3407,8 @@ bool ChatHandler::HandleReviveCommand(const char* args)
|
|||
|
||||
if (*args)
|
||||
{
|
||||
std::string name = args;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -3766,8 +3768,8 @@ bool ChatHandler::HandleLevelUpCommand(const char* args)
|
|||
|
||||
if(pname) // player by name
|
||||
{
|
||||
name = pname;
|
||||
if(!normalizePlayerName(name))
|
||||
name = extractPlayerNameFromLink(pname);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -3835,7 +3837,10 @@ bool ChatHandler::HandleLevelUpCommand(const char* args)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -4293,15 +4298,15 @@ bool ChatHandler::HandleResetHonorCommand (const char * args)
|
|||
Player *player = NULL;
|
||||
if (pName)
|
||||
{
|
||||
std::string name = pName;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(pName);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
player = objmgr.GetPlayer(guid);
|
||||
}
|
||||
else
|
||||
|
|
@ -4383,15 +4388,15 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
|
|||
Player *player = NULL;
|
||||
if (pName)
|
||||
{
|
||||
std::string name = pName;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(pName);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
player = objmgr.GetPlayer(guid);
|
||||
}
|
||||
else
|
||||
|
|
@ -4436,15 +4441,15 @@ bool ChatHandler::HandleResetStatsCommand(const char * args)
|
|||
Player *player = NULL;
|
||||
if (pName)
|
||||
{
|
||||
std::string name = pName;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(pName);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
player = objmgr.GetPlayer(guid);
|
||||
}
|
||||
else
|
||||
|
|
@ -4476,9 +4481,8 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
|||
uint64 playerGUID = 0;
|
||||
if (pName)
|
||||
{
|
||||
std::string name = pName;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(pName);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4487,7 +4491,7 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
|||
|
||||
player = objmgr.GetPlayer(name.c_str());
|
||||
if(!player)
|
||||
playerGUID = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
playerGUID = objmgr.GetPlayerGUIDByName(name);
|
||||
}
|
||||
else
|
||||
player = getSelectedPlayer();
|
||||
|
|
@ -4506,7 +4510,10 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
|
|||
ChatHandler(player).SendSysMessage(LANG_RESET_SPELLS);
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -4524,8 +4531,8 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
|||
uint64 playerGUID = 0;
|
||||
if (pName)
|
||||
{
|
||||
std::string name = pName;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink(pName);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4534,7 +4541,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
|||
|
||||
player = objmgr.GetPlayer(name.c_str());
|
||||
if(!player)
|
||||
playerGUID = objmgr.GetPlayerGUIDByName(name.c_str());
|
||||
playerGUID = objmgr.GetPlayerGUIDByName(name);
|
||||
}
|
||||
else
|
||||
player = getSelectedPlayer();
|
||||
|
|
@ -4546,13 +4553,17 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
|||
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
||||
|
||||
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;
|
||||
}
|
||||
else if (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;
|
||||
}
|
||||
// Try reset talenents as Hunter Pet
|
||||
|
|
@ -4566,7 +4577,10 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
|||
player = (Player *)owner;
|
||||
ChatHandler(player).SendSysMessage(LANG_RESET_TALENTS);
|
||||
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;
|
||||
}
|
||||
|
|
@ -5130,12 +5144,8 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char* args)
|
|||
if(!args)
|
||||
return false;
|
||||
|
||||
char* cname = strtok ((char*)args, "");
|
||||
if(!cname)
|
||||
return false;
|
||||
|
||||
std::string name = cname;
|
||||
if(!normalizePlayerName(name))
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -5635,12 +5645,11 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
|
|||
guid = atoi(p2);
|
||||
else
|
||||
{
|
||||
std::string name = p2;
|
||||
|
||||
if (!normalizePlayerName (name))
|
||||
std::string name = extractPlayerNameFromLink(p2);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -6253,9 +6262,13 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
|||
|
||||
// format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
|
||||
|
||||
char* pName = strtok((char*)args, " ");
|
||||
if(!pName)
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* tail1 = strtok(NULL, "");
|
||||
if(!tail1)
|
||||
|
|
@ -6293,8 +6306,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
|||
if (!msgText)
|
||||
return false;
|
||||
|
||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
||||
std::string name = pName;
|
||||
// msgSubject, msgText isn't NUL after prev. check
|
||||
std::string subject = msgSubject;
|
||||
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);
|
||||
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);
|
||||
|
||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
||||
std::string nameLink = playerLink(name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6402,9 +6408,13 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
|||
|
||||
/// format: name "subject text" "mail text" money
|
||||
|
||||
char* pName = strtok((char*)args, " ");
|
||||
if (!pName)
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* tail1 = strtok(NULL, "");
|
||||
if (!tail1)
|
||||
|
|
@ -6447,18 +6457,10 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
|||
if (money <= 0)
|
||||
return false;
|
||||
|
||||
// pName, msgSubject, msgText isn't NUL after prev. check
|
||||
std::string name = pName;
|
||||
// msgSubject, msgText isn't NUL after prev. check
|
||||
std::string subject = msgSubject;
|
||||
std::string text = msgText;
|
||||
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
||||
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);
|
||||
|
||||
PSendSysMessage(LANG_MAIL_SENT, name.c_str());
|
||||
std::string nameLink = playerLink(name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6488,15 +6491,16 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
|
|||
bool ChatHandler::HandleSendMessageCommand(const char* args)
|
||||
{
|
||||
///- Get the command line arguments
|
||||
char* name_str = strtok((char*)args, " ");
|
||||
char* msg_str = strtok(NULL, "");
|
||||
|
||||
if(!name_str || !msg_str)
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string name = name_str;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
char* msg_str = strtok(NULL, "");
|
||||
if(!msg_str)
|
||||
return false;
|
||||
|
||||
///- 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");
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7218"
|
||||
#define REVISION_NR "7219"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue