本文整理汇总了C++中SystemMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ SystemMessage函数的具体用法?C++ SystemMessage怎么用?C++ SystemMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SystemMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SystemMessage
bool ChatHandler::HandleWPDeleteCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
std::stringstream ss;
uint32 wpid = GUID_LOPART(guid);
if(wpid)
{
//Refresh client
//Hide all
bool show = ai->m_WayPointsShowing;
if(show == true)
ai->hideWayPoints(pPlayer);
ai->deleteWayPoint(wpid);
//Show All again after delete
if(show == true)
ai->showWayPoints(pPlayer,ai->m_WayPointsShowBackwards);
SystemMessage(m_session, "Waypoint %u deleted.", wpid);
}
else
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
return true;
}
示例2: atoi
bool ChatHandler::HandleWPMoveTypeCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
uint32 option = atoi((char*)args);
if (option != 0 && option != 1 && option != 2)
{
std::stringstream ss;
ss << "Incorrect value." << endl;
ss << "0 is Move from WP 1 -> 10 then 10 -> 1." << endl;
ss << "1 is Move from WP to a random WP." << endl;
ss << "2 is Move from WP 1 -> 10 then 1 -> 10." << endl;
SendMultilineMessage(m_session, ss.str().c_str());
return true;
}
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
Creature* pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!pCreature)
{
SystemMessage(m_session, "You should select a creature.");
return true;
}
if( pCreature->m_spawn == NULL )
{
SystemMessage(m_session, "You cannot add waypoints to a creature that is not saved.");
return true;
}
char sql[512];
snprintf(sql, 512, "UPDATE creature_spawns SET movetype = '%u' WHERE id = '%u'", (unsigned int)option, (unsigned int)pCreature-> GetSQL_id());
WorldDatabase.Execute( sql );
pCreature->GetAIInterface()->setMoveType(option);
SystemMessage(m_session, "Value saved to database.");
return true;
}
示例3: GetPlayer
void WorldSession::HandleArenaTeamPromoteOpcode(WorldPacket & recv_data)
{
uint32 teamId;
uint8 slot;
string name;
ArenaTeam * team;
PlayerInfo * inf;
recv_data >> teamId >> name;
team = objmgr.GetArenaTeamById(teamId);
if(!team)
{
GetPlayer()->SoftDisconnect();
return;
}
slot = team->m_type;
if( slot >= NUM_ARENA_TEAM_TYPES )
return;
if( (team = _player->m_playerInfo->arenaTeam[slot]) == NULL )
{
SystemMessage("You are not in an arena team of this type.");
return;
}
if(team->m_leader != _player->GetLowGUID())
{
SystemMessage("You aren't the captain of this team.");
return;
}
if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL )
{
SystemMessage("That player cannot be found.");
return;
}
if(!team->HasMember(inf->guid))
{
SystemMessage("That player is not a member of your arena team.");
return;
}
team->SetLeader(inf);
}
示例4: SystemMessage
void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
ArenaTeam* team;
if(_player->m_arenateaminviteguid == 0)
{
SystemMessage("You have not been invited into another arena team.");
return;
}
team = objmgr.GetArenaTeamById(_player->m_arenateaminviteguid);
_player->m_arenateaminviteguid = 0;
if(team == 0)
{
SystemMessage("That arena team no longer exists.");
return;
}
if(team->m_memberCount >= team->m_slots)
{
SystemMessage("That team is now full.");
return;
}
if(_player->m_arenaTeams[team->m_type] != NULL) /* shouldn't happen */
{
SystemMessage("You have already been in an arena team of that size.");
return;
}
if(team->AddMember(_player->m_playerInfo))
{
char buffer[1024];
WorldPacket* data;
snprintf(buffer, 1024, "%s joined the arena team, '%s'.", _player->GetName(), team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
}
else
{
SendNotification("Internal error.");
}
}
示例5: getSelectedCreature
bool ChatHandler::HandleItemRemoveCommand(const char* args, WorldSession *m_session)
{
if (!args)
return false;
Creature* pCreature = getSelectedCreature(m_session, false);
if(!pCreature || !(pCreature->HasNpcFlag(UNIT_NPC_FLAG_VENDOR) || pCreature->HasNpcFlag(UNIT_NPC_FLAG_ARMORER)))
{
SystemMessage(m_session, "You should select a vendor.");
return true;
}
uint32 itemguid = 0;
if(sscanf(args, "%u", &itemguid) < 1)
{
// check for item link
GetItemIDFromLink(args, &itemguid);
if(itemguid == 0)
return false;
}
if(itemguid == 0)
return false;
std::stringstream sstext;
int slot = pCreature->GetSlotByItemId(itemguid);
if(slot != -1)
{
std::stringstream ss;
ss << "DELETE FROM vendors WHERE entry = '" << pCreature->GetEntry() << "' AND vendormask = '" << pCreature->VendorMask << "' AND item = " << itemguid << " LIMIT 1;";
WorldDatabase.Execute( ss.str().c_str() );
pCreature->RemoveVendorItem(itemguid);
ItemPrototype* tmpItem = ItemPrototypeStorage.LookupEntry(itemguid);
if(tmpItem)
sstext << "Item '" << itemguid << "' '" << tmpItem->Name1 << "' Deleted from list" << '\0';
else
sstext << "Item '" << itemguid << "' Deleted from list" << '\0';
}
else
{
sstext << "Item '" << itemguid << "' Not Found in List." << '\0';
}
SystemMessage(m_session, sstext.str().c_str());
return true;
}
示例6: SystemMessage
bool ChatHandler::HandleVendorClearCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if(guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
Creature* pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!pCreature)
{
SystemMessage(m_session, "You should select a creature.");
return true;
}
if(!pCreature->m_spawn)
{
SystemMessage(m_session, "You should select a saved creature.");
return true;
}
bool first = true;
QueryBuffer* qb = new QueryBuffer();
std::map<uint32, CreatureItem>::iterator itr, itr2, begin = pCreature->GetSellItemBegin(), end = pCreature->GetSellItemEnd();
for(itr = begin; itr != end;)
{
itr2 = itr++;
if(itr2->second.vendormask < 0 || pCreature->VendorMask < 0 || itr2->second.vendormask == pCreature->VendorMask)
{
first = false;
qb->AddQuery("DELETE FROM vendors WHERE entry = '%u' AND vendormask = '%i' AND item = '%u';", pCreature->GetEntry(), pCreature->VendorMask, itr2->second.itemid);
pCreature->RemoveSellItem(itr2);
}
}
if(!first)
{
WorldDatabase.AddQueryBuffer(qb);
SystemMessage(m_session, "removed all items with vendor mask %u", pCreature->VendorMask);
sWorld.LogGM(m_session, "removed all items with vendor mask %u from vendor %u", pCreature->VendorMask, pCreature->GetEntry());
}
else
RedSystemMessage(m_session, "No items found");
return true;
}
示例7: SystemMessage
bool ChatHandler::HandleWaypointSetOrientationCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
bool showing = ai->WayPointsShowing();
uint32 wpid = GUID_LOPART(guid);
if(wpid)
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp)
{
if(showing)
ai->hideWayPoints(pPlayer);
wp->orientation = pPlayer->GetOrientation();
//save wp
ai->saveWayPoints();
}
else return false;
}
else return false;
if(showing)
ai->showWayPoints(pPlayer, ai->WayPointsShowingBackwards());
return true;
}
示例8: GetPlayer
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
ArenaTeam* team;
uint32 teamId;
recv_data >> teamId;
team = objmgr.GetArenaTeamById(teamId);
if(!team)
{
GetPlayer()->SoftDisconnect();
return;
}
if((team = _player->m_arenaTeams[team->m_type]) == NULL)
{
SystemMessage("You are not in an arena team of this type.");
return;
}
if(team->m_leader == _player->GetLowGUID() && team->m_memberCount == 1)
{
team->Destroy();
return;
}
if(team->m_leader == _player->GetLowGUID())
{
SystemMessage("You cannot leave the team yet, promote someone else to captain first.");
return;
}
if(team->RemoveMember(_player->m_playerInfo))
{
char buffer[1024];
WorldPacket* data;
snprintf(buffer, 1024, "%s left the arena team, '%s'.", _player->GetName(), team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
SystemMessage("You have left the arena team, '%s'.", team->m_name.c_str());
}
}
示例9: SystemMessage
bool ChatHandler::HandleWaypointGettextCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
std::stringstream ss;
uint32 wpid = GUID_LOPART(guid);
if((wpid > 0) && (wpid <= ai->GetWayPointsCount()))
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp)
{
ss << "Waypoint Number " << wp->id << ":\n";
ss << "Backward:\n";
ss << wp->backwardSayText << "\n";
ss << "Forward:\n";
ss << wp->forwardSayText << "\n";
SendMultilineMessage(m_session, ss.str().c_str());
}
}
else
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
return true;
}
示例10: va_start
void ChatHandler::SystemMessageToPlr(Player *plr, const char* message, ...)
{
if( !message || !plr->GetSession() ) return;
va_list ap;
va_start(ap, message);
char msg1[1024];
vsnprintf(msg1,1024,message,ap);
SystemMessage(plr->GetSession(), msg1);
}
示例11: GetItemIDFromLink
bool ChatHandler::HandleAddInvItemCommand(const char* args, WorldSession* m_session)
{
uint32 itemid, count = 1;
int32 randomprop = 0;
int32 numadded = 0;
if(strlen(args) < 1)
return false;
if(sscanf(args, "%u %u %d", &itemid, &count, &randomprop) < 1)
{
// check for item link
uint16 ofs = GetItemIDFromLink(args, &itemid);
if(!itemid)
return false;
sscanf(args + ofs, "%u %d", &count, &randomprop); // these may be empty
}
Player* chr = getSelectedChar(m_session, false);
if(!chr)
chr = m_session->GetPlayer();
ItemPrototype* it = ItemPrototypeStorage.LookupEntry(itemid);
if(it)
{
numadded -= chr->GetItemInterface()->GetItemCount(itemid);
bool result = false;
result = chr->GetItemInterface()->AddItemById(itemid, count, randomprop);
numadded += chr->GetItemInterface()->GetItemCount(itemid);
if(result == true)
{
if(count == 0)
sGMLog.writefromsession(m_session, "used add item command, item id %u [%s], quantity %u, to %s", it->ItemId, it->Name1, numadded, chr->GetName());
else
sGMLog.writefromsession(m_session, "used add item command, item id %u [%s], quantity %u (only %lu added due to full inventory), to %s", it->ItemId, it->Name1, numadded, numadded, chr->GetName());
char messagetext[512];
snprintf(messagetext, 512, "Added item %s (id: %d), quantity %u, to %s's inventory.", GetItemLinkByProto(it, m_session->language).c_str(), (unsigned int)it->ItemId, numadded, chr->GetName());
SystemMessage(m_session, messagetext);
//snprintf(messagetext, 128, "%s added item %d (%s) to your inventory.", m_session->GetPlayer()->GetName(), (unsigned int)itemid, it->Name1);
snprintf(messagetext, 512, "%s added item %s, quantity %u, to your inventory.", m_session->GetPlayer()->GetName(), GetItemLinkByProto(it, chr->GetSession()->language).c_str(), numadded);
SystemMessageToPlr(chr, messagetext);
}
else
SystemMessageToPlr(chr, "Failed to add item.");
return true;
}
else
{
RedSystemMessage(m_session, "Item %d is not a valid item!", itemid);
return false;
}
}
示例12: SystemMessage
//.event list
bool ChatHandler::HandleEventListEvents(const char* /*args*/, WorldSession* m_session)
{
SystemMessage(m_session, "--- Current Active Events ---");
auto eventList = sGameEventMgr.mGameEvents;
for (auto gameEventPair : eventList)
{
auto gameEvent = gameEventPair.second;
if (gameEvent->GetState() == GAMEEVENT_ACTIVE)
{
SystemMessage(m_session, "%u - %s", gameEvent->event_id, gameEvent->description.c_str());
}
else if (gameEvent->GetState() == GAMEEVENT_ACTIVE_FORCED)
{
SystemMessage(m_session, "[Force Activated] %u - %s", gameEvent->event_id, gameEvent->description.c_str());
}
}
SystemMessage(m_session, "--- End List ---");
return true;
}
示例13: Error
/*---------------------------------------------------------------------------*\
* NAME: HandleDefaultLaunchOption *
* --------------------------------------------------------------------------*
* DESCRIPTION:
\*---------------------------------------------------------------------------*/
void Error (
LPTSTR tszErrorMessage,
DWORD dwErrorCode
)
{
TCHAR tszMessageBuffer [SIZE_MSG_BUFFER] = {0};
_tprintf (_T("%s\n%s"), tszErrorMessage, SystemMessage (tszMessageBuffer, RTL_NUMBER_OF(tszMessageBuffer), dwErrorCode));
exit (0);
}
示例14: SystemMessage
bool ChatHandler::HandleBattlegroundExitCommand(const char* args, WorldSession* m_session)
{
if(!m_session->GetPlayer()->m_bg)
{
SystemMessage(m_session,"You're not in a battleground!");
return true;
}
m_session->GetPlayer()->m_bg->Close();
return true;
}
示例15: getSelectedChar
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
Player* ptarget = getSelectedChar(m_session);
if(ptarget == NULL)
return true;
if(strlen((char*)args)>75)
{
// send message to user
char buf[256];
snprintf((char*)buf,256,"The name was too long by %i", (unsigned int)strlen((char*)args)-75);
SystemMessage(m_session, buf);
return true;
}
for (uint32 i = 0; i < strlen(args); i++)
{
if(!isalpha(args[i]) && args[i]!=' ')
{
SystemMessage(m_session, "Error, name can only contain chars A-Z and a-z.");
return true;
}
}
GuildInfo* pGuild = guildmgr.GetGuildByGuildName(string(args));
if(pGuild)
{
RedSystemMessage(m_session, "Guild name is already taken.");
return true;
}
Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount = 0;
tempCharter.GuildName = string(args);
guildmgr.CreateGuildFromCharter(&tempCharter);
SystemMessage(m_session, "Guild created");
return true;
}