本文整理汇总了C++中PSendSysMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ PSendSysMessage函数的具体用法?C++ PSendSysMessage怎么用?C++ PSendSysMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PSendSysMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PSendSysMessage
bool ChatHandler::HandleServerRevCommand(const char* /*args*/)
{
PSendSysMessage(_REVISION);
return true;
}
示例2: PSendSysMessage
/// Display the 'Message of the day' for the realm
bool ChatHandler::HandleServerMotdCommand(char* /*args*/)
{
PSendSysMessage(LANG_MOTD_CURRENT, sWorld.GetMotd());
return true;
}
示例3: getSelectedCreature
bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
{
Player *player = m_session->GetPlayer();
Creature *creatureTarget = getSelectedCreature();
if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
{
PSendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
// Creatures with family 0 crashes the server
if (cInfo->family == 0)
{
PSendSysMessage("This creature cannot be tamed. (family id: 0).");
SetSentErrorMessage(true);
return false;
}
if (player->GetPetGUID())
{
PSendSysMessage("You already have a pet");
SetSentErrorMessage(true);
return false;
}
// Everything looks OK, create new pet
Pet* pet = new Pet(player, HUNTER_PET);
if (!pet)
return false;
if (!pet->CreateBaseAtCreature(creatureTarget))
{
delete pet;
PSendSysMessage("Error 1");
return false;
}
creatureTarget->setDeathState(JUST_DIED);
creatureTarget->RemoveCorpse();
creatureTarget->SetHealth(0); // just for nice GM-mode view
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
{
sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
PSendSysMessage("Error 2");
delete pet;
return false;
}
// prepare visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
// this enables pet details window (Shift+P)
pet->InitPetCreateSpells();
pet->SetFullHealth();
pet->GetMap()->Add(pet->ToCreature());
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
player->SetMinion(pet, true);
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
player->PetSpellInitialize();
return true;
}
示例4: extractOptFirstArg
//mute player for some times
bool ChatHandler::HandleMuteCommand(const char* args)
{
std::string announce;
char* nameStr;
char* delayStr;
extractOptFirstArg((char*)args, &nameStr, &delayStr);
if (!delayStr)
return false;
char *mutereason = strtok(NULL, "\r");
std::string mutereasonstr = "No reason";
if (mutereason != NULL)
mutereasonstr = mutereason;
if(!mutereason)
{
PSendSysMessage("You must enter a reason of mute");
SetSentErrorMessage(true);
return false;
}
Player* target;
uint64 target_guid;
std::string target_name;
if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);
// find only player from same account if any
if (!target)
if (WorldSession* session = sWorld->FindSession(accountId))
target = session->GetPlayer();
uint32 notspeaktime = (uint32) atoi(delayStr);
// must have strong lesser security level
if (HasLowerSecurity (target, target_guid, true))
return false;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
if (target)
{
// Target is online, mute will be in effect right away.
int64 muteTime = time(NULL) + notspeaktime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str());
}
else
{
// Target is offline, mute will be in effect starting from the next login.
int32 muteTime = -int32(notspeaktime * MINUTE);
stmt->setInt64(0, muteTime);
}
stmt->setUInt32(1, accountId);
LoginDatabase.Execute(stmt);
std::string nameLink = playerLink(target_name);
PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notspeaktime, mutereasonstr.c_str());
announce = "The character '";
announce += nameStr;
announce += "' was muted for ";
announce += delayStr;
announce += " minutes by the character '";
announce += m_session->GetPlayerName();
announce += "'. The reason is: ";
announce += mutereason;
HandleAnnounceCommand(announce.c_str());
return true;
}
示例5: strtok
bool ChatHandler::HandleBanAutoCommand(char *args)
{
if (!*args)
return false;
char* cname = strtok ((char*)args, " ");
if (!cname)
return false;
std::string name = cname;
char* creason = strtok (NULL,"");
std::string banreason = creason ? creason : "";
QueryResult *result;
Field *fields;
result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'",name.c_str());
if(!result)
{
PSendSysMessage(LANG_BAN_NOTFOUND,"character",name.c_str());
return true;
}
fields = result->Fetch();
uint32 accId = fields->GetUInt32();
delete result;
std::string oldreason;
uint32 bandate, unbandate;
int32 bandiff;
uint32 max_banid = 0;
uint32 counted_extra_bans = 0;
result = LoginDatabase.PQuery("SELECT bandate,unbandate,banreason FROM account_banned WHERE id=%u", accId);
if(result)
{
do
{
fields = result->Fetch();
bandate = fields[0].GetUInt32();
unbandate = fields[1].GetUInt32();
oldreason = fields[2].GetCppString();
bandiff = unbandate - bandate;
if(oldreason.size() > 10 && oldreason.substr(0,10) == "[AutoBan #")
{
uint32 banid = atoi(oldreason.c_str() + 10);
max_banid = std::max(max_banid, banid);
}
else if(bandiff >= (int32)sWorld.getConfig(CONFIG_UINT32_AUTOBAN_MIN_COUNTED_BANTIME) || bandiff == 0)
{
++counted_extra_bans;
}
}
while (result->NextRow());
delete result;
}
max_banid = std::max(max_banid, counted_extra_bans);
std::string duration = sWorld.GetAutoBanTime(max_banid);
std::stringstream reason;
reason << "[AutoBan #" << (max_banid + 1) << "; " << duration << "] " << banreason;
uint32 duration_secs = TimeStringToSecs(duration);
switch(sWorld.BanAccount(BAN_CHARACTER, name, duration_secs, reason.str().c_str(), m_session ? m_session->GetPlayerName() : ""))
{
case BAN_SUCCESS:
if(atoi(duration.c_str())>0)
PSendSysMessage(LANG_BAN_YOUBANNED,name.c_str(),secsToTimeString(TimeStringToSecs(duration),true).c_str(),reason.str().c_str());
else
PSendSysMessage(LANG_BAN_YOUPERMBANNED,name.c_str(),reason.str().c_str());
break;
case BAN_SYNTAX_ERROR:
return false;
case BAN_NOTFOUND:
PSendSysMessage(LANG_BAN_NOTFOUND,"character",name.c_str());
SetSentErrorMessage(true);
return false;
}
return true;
}
示例6: PSendSysMessage
bool ChatHandler::HandlePlayerbotCommand(char* args)
{
if (sWorld.getConfig(CONFIG_BOOL_PLAYERBOT_DISABLE))
{
PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
SetSentErrorMessage(true);
return false;
}
if (!m_session)
{
PSendSysMessage("|cffff0000You may only add bots from an active session");
SetSentErrorMessage(true);
return false;
}
if (!*args)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
char *cmd = strtok ((char *) args, " ");
char *charname = strtok (NULL, " ");
if (!cmd || !charname)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
std::string cmdStr = cmd;
std::string charnameStr = charname;
if (!normalizePlayerName(charnameStr))
return false;
uint64 guid = sObjectMgr.GetPlayerGUIDByName(charnameStr.c_str());
if (guid == 0 || (guid == m_session->GetPlayer()->GetGUID()))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid);
if (accountId != m_session->GetAccountId())
{
PSendSysMessage("|cffff0000You may only add bots from the same account.");
SetSentErrorMessage(true);
return false;
}
// create the playerbot manager if it doesn't already exist
PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
if (!mgr)
{
mgr = new PlayerbotMgr(m_session->GetPlayer());
m_session->GetPlayer()->SetPlayerbotMgr(mgr);
}
QueryResult *resultchar = CharacterDatabase.PQuery("SELECT COUNT(*) FROM characters WHERE online = '1' AND account = '%u'", m_session->GetAccountId());
if (resultchar)
{
Field *fields = resultchar->Fetch();
int acctcharcount = fields[0].GetUInt32();
int maxnum = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_MAXBOTS);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (acctcharcount > maxnum && (cmdStr == "add" || cmdStr == "login"))
{
PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)", maxnum);
SetSentErrorMessage(true);
delete resultchar;
return false;
}
}
delete resultchar;
QueryResult *resultlvl = CharacterDatabase.PQuery("SELECT level,name FROM characters WHERE guid = '%lu'", guid);
if (resultlvl)
{
Field *fields = resultlvl->Fetch();
int charlvl = fields[0].GetUInt32();
int maxlvl = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_RESTRICTLEVEL);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (charlvl > maxlvl)
{
PSendSysMessage("|cffff0000You cannot summon |cffffffff[%s]|cffff0000, it's level is too high.(Current Max:lvl |cffffffff%u)", fields[1].GetString(), maxlvl);
SetSentErrorMessage(true);
delete resultlvl;
return false;
}
}
delete resultlvl;
// end of gmconfig patch
if (cmdStr == "add" || cmdStr == "login")
{
if (mgr->GetPlayerBot(guid))
{
//.........这里部分代码省略.........
示例7: PSendSysMessage
bool ChatHandler::HandlePlayerbotCommand(char* args)
{
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (botConfig.GetBoolDefault("PlayerbotAI.DisableBots", false))
{
PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
SetSentErrorMessage(true);
return false;
}
if (!m_session)
{
PSendSysMessage("|cffff0000You may only add bots from an active session");
SetSentErrorMessage(true);
return false;
}
if (!*args)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
char* cmd = strtok((char*) args, " ");
char* charname = strtok(nullptr, " ");
if (!cmd || !charname)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
std::string cmdStr = cmd;
std::string charnameStr = charname;
if (!normalizePlayerName(charnameStr))
return false;
ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(charnameStr.c_str());
if (guid == ObjectGuid() || (guid == m_session->GetPlayer()->GetObjectGuid()))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid);
if (accountId != m_session->GetAccountId())
{
PSendSysMessage("|cffff0000You may only add bots from the same account.");
SetSentErrorMessage(true);
return false;
}
// create the playerbot manager if it doesn't already exist
PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
if (!mgr)
{
mgr = new PlayerbotMgr(m_session->GetPlayer());
m_session->GetPlayer()->SetPlayerbotMgr(mgr);
}
QueryResult* resultchar = CharacterDatabase.PQuery("SELECT COUNT(*) FROM characters WHERE online = '1' AND account = '%u'", m_session->GetAccountId());
if (resultchar)
{
Field* fields = resultchar->Fetch();
int acctcharcount = fields[0].GetUInt32();
int maxnum = botConfig.GetIntDefault("PlayerbotAI.MaxNumBots", 9);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (acctcharcount > maxnum && (cmdStr == "add" || cmdStr == "login"))
{
PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)", maxnum);
SetSentErrorMessage(true);
delete resultchar;
return false;
}
delete resultchar;
}
QueryResult* resultlvl = CharacterDatabase.PQuery("SELECT level,name FROM characters WHERE guid = '%u'", guid.GetCounter());
if (resultlvl)
{
Field* fields = resultlvl->Fetch();
int charlvl = fields[0].GetUInt32();
int maxlvl = botConfig.GetIntDefault("PlayerbotAI.RestrictBotLevel", 60);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (charlvl > maxlvl)
{
PSendSysMessage("|cffff0000You cannot summon |cffffffff[%s]|cffff0000, it's level is too high.(Current Max:lvl |cffffffff%u)", fields[1].GetString(), maxlvl);
SetSentErrorMessage(true);
delete resultlvl;
return false;
}
delete resultlvl;
}
// end of gmconfig patch
if (cmdStr == "add" || cmdStr == "login")
//.........这里部分代码省略.........
示例8: GetAccessLevel
bool ChatHandler::HandleAccountCommand(const char* /*args*/)
{
AccountTypes gmlevel = GetAccessLevel();
PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
return true;
}
示例9: secsToTimeString
bool ChatHandler::HandleServerUptimeCommand(const char* /*args*/)
{
std::string str = secsToTimeString(sWorld.GetUptime());
PSendSysMessage("%s", str.c_str());
return true;
}
示例10: pname_esc
bool ChatHandler::HandlePunishCommand(char *args)
{
Player *plr = NULL;
std::string pname;
uint64 plr_guid = 0;
uint32 accid = 0;
if(!ExtractPlayerTarget(&args, &plr, NULL, &pname))
return false;
if(plr)
accid = plr->GetSession()->GetAccountId();
else
{
std::string pname_esc(pname);
CharacterDatabase.escape_string(pname_esc);
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", pname_esc.c_str());
if(!result)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
Field *fields = result->Fetch();
accid = fields[0].GetUInt32();
delete result;
}
// extra check, not sure if really necessary, but we better be on the safe side!
if(!accid)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
// find only player from same account if any
if (!plr)
{
if (WorldSession* session = sWorld.FindSession(accid))
{
plr = session->GetPlayer();
pname = plr->GetName();
}
}
char *what = ExtractArg(&args);
char *reason = ExtractArg(&args);
std::string strWhat(what ? what : "");
bool handled = sPunishMgr.Handle(accid, plr, m_session->GetPlayer(), pname, strWhat, reason ? reason : GetMangosString(LANG_NO_REASON_GIVEN));
if(!handled)
{
PSendSysMessage(LANG_NO_RECORD_IN_DB, strWhat.c_str());
SetSentErrorMessage(true);
return false;
}
return true;
}
示例11: atoi
bool ChatHandler::HandleTargetAndDeleteObjectCommand(char *args)
{
QueryResult *result;
if(*args)
{
int32 id = atoi((char*)args);
if(id)
result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` FROM `gameobject` WHERE `map` = %i AND `id` = '%u' ORDER BY `order` ASC LIMIT 1", m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),id);
else
result = WorldDatabase.PQuery(
"SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` "
"FROM `gameobject`,`gameobject_template` WHERE `gameobject_template`.`entry` = `gameobject`.`id` AND `map` = %i AND `name` LIKE '%%%s%%' ORDER BY `order` ASC LIMIT 1",
m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),args);
}
else
result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` FROM `gameobject` WHERE `map` = %i ORDER BY `order` ASC LIMIT 1", m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId());
if (!result)
{
SendSysMessage("Nothing found!");
return true;
}
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 id = fields[1].GetUInt32();
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
float z = fields[4].GetFloat();
float o = fields[5].GetFloat();
int mapid = fields[6].GetUInt16();
delete result;
const GameObjectInfo *goI = sObjectMgr.GetGameObjectInfo(id);
if (!goI)
{
PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id);
return false;
}
GameObject* obj = m_session->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, guid, id));
if(!obj)
{
PSendSysMessage("Game Object (GUID: %u) not found", GUID_LOPART(guid));
return true;
}
uint64 owner_guid = obj->GetOwnerGUID();
if(owner_guid)
{
Unit* owner = ObjectAccessor::Instance().GetUnit(*m_session->GetPlayer(),owner_guid);
if(!owner && GUID_HIPART(owner_guid)!=HIGHGUID_PLAYER)
{
PSendSysMessage("Game Object (GUID: %u) have references in not found creature %u GO list, can't be deleted.", GUID_LOPART(owner_guid), obj->GetGUIDLow());
return true;
}
owner->RemoveGameObject(obj,false);
}
obj->Delete();
obj->DeleteFromDB();
PSendSysMessage("Game Object (GUID: %u) [%s] removed", obj->GetGUIDLow(),goI->name);
return true;
}
示例12: strtok
bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
{
if (!*args)
return false;
char* tguid = strtok((char*)args, " ");
uint64 ticketGuid = atoi(tguid);
char* targetgm = strtok(NULL, " ");
if (!targetgm)
return false;
std::string targm = targetgm;
if (!normalizePlayerName(targm))
return false;
Player *cplr = m_session->GetPlayer();
GM_Ticket *ticket = sTicketMgr->GetGMTicket(ticketGuid);
if (!ticket || ticket->closed != 0)
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
uint64 tarGUID = sObjectMgr->GetPlayerGUIDByName(targm.c_str());
uint64 accid = sObjectMgr->GetPlayerAccountIdByGUID(tarGUID);
uint32 gmlevel = sAccountMgr->GetSecurity(accid, realmID);
if (!tarGUID || gmlevel == SEC_PLAYER)
{
SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
return true;
}
if (ticket->assignedToGM == tarGUID)
{
PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid);
return true;
}
std::string gmname;
sObjectMgr->GetPlayerNameByGUID(tarGUID, gmname);
if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
{
PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str());
return true;
}
ticket->assignedToGM = tarGUID;
if (gmlevel == SEC_ADMINISTRATOR && ticket->escalated == TICKET_IN_ESCALATION_QUEUE)
ticket->escalated = TICKET_ESCALATED_ASSIGNED;
else if (ticket->escalated == TICKET_UNASSIGNED)
ticket->escalated = TICKET_ASSIGNED;
sTicketMgr->AddOrUpdateGMTicket(*ticket);
std::stringstream ss;
ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid);
ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
SendGlobalGMSysMessage(ss.str().c_str());
sTicketMgr->UpdateLastChange();
return true;
}
示例13: playerLink
bool ChatHandler::HandlePartyInfoCommand(const char* args)
{
Player* target;
uint64 target_guid;
std::string target_name;
if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
return false;
uint32 accId = 0;
std::string username = "";
std::string status = "";
uint32 security = 0;
// get additional information from Player object
if (target)
{
std::string nameLink = playerLink(target_name);
if (Group *grp = target->GetGroup())
{
if (grp->isRaidGroup())
SendSysMessage("----------------Raid Group----------------");
else if (grp->isBGGroup())
SendSysMessage("----------------BG Group-----------------");
else if (grp->isLFGGroup())
SendSysMessage("----------------LFG Group----------------");
else
SendSysMessage("------------------Group------------------");
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
continue;
accId = pl->GetSession()->GetAccountId();
nameLink = playerLink(pl->GetName());
QueryResult result = LoginDatabase.PQuery("SELECT aa.gmlevel, a.username "
"FROM account a "
"LEFT JOIN account_access aa "
"ON (a.id = aa.id) "
"WHERE a.id = '%u'",accId);
if (result)
{
Field* fields = result->Fetch();
security = fields[0].GetUInt32();
username = fields[1].GetString();
}
if (grp->IsLeader(pl->GetGUID()))
{
status = "[Leader]";
}
else if (grp->IsAssistant(pl->GetGUID()))
{
status = "[Assistant]";
}
PSendSysMessage(LANG_PARTYINFO_PLAYER, (pl?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), username.c_str(), accId, security, status.c_str());
}
SendSysMessage("----------------------------------------");
}
else
{
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
SetSentErrorMessage(true);
return false;
}
}
return true;
}
示例14: PSendSysMessage
// Delete a user account and all associated characters in this realm
// todo - This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
bool ChatHandler::HandleAccountDeleteCommand(const char* args)
{
if (!*args)
return false;
///- Get the account name from the command line
char *account_name_str=strtok ((char*)args," ");
if (!account_name_str)
return false;
std::string account_name = account_name_str;
if (!AccountMgr::normalizeString(account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
uint32 account_id = accmgr.GetId(account_name);
if (!account_id)
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
// Commands not recommended call from chat, but support anyway
if (m_session)
{
uint32 targetSecurity = accmgr.GetSecurity(account_id);
// can delete only for account with less security
// This is also reject self apply in fact
if (targetSecurity >= m_session->GetSecurity())
{
SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage (true);
return false;
}
}
AccountOpResult result = accmgr.DeleteAccount(account_id);
switch(result)
{
case AOR_OK:
PSendSysMessage(LANG_ACCOUNT_DELETED,account_name.c_str());
break;
case AOR_NAME_NOT_EXIST:
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
case AOR_DB_INTERNAL_ERROR:
PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR,account_name.c_str());
SetSentErrorMessage(true);
return false;
default:
PSendSysMessage(LANG_ACCOUNT_NOT_DELETED,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
return true;
}
示例15: PSendSysMessage
bool ChatHandler::HandleAcctCommand(const char* args)
{
uint32 gmlevel = m_session->GetSecurity();
PSendSysMessage(LANG_ACCOUNT_LEVEL, gmlevel);
return true;
}