本文整理汇总了C++中ChatHandler类的典型用法代码示例。如果您正苦于以下问题:C++ ChatHandler类的具体用法?C++ ChatHandler怎么用?C++ ChatHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChatHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAIInformation
void GetAIInformation(ChatHandler& reader) override
{
if (m_lAssistList.empty())
reader.PSendSysMessage("Anubisath Sentinel - group not assigned, will be assigned OnAggro");
if (m_lAssistList.size() == MAX_BUDDY)
reader.PSendSysMessage("Anubisath Sentinel - proper group found");
else
reader.PSendSysMessage("Anubisath Sentinel - not correct number of mobs for group found. Number found %u, should be %u", uint32(m_lAssistList.size()), MAX_BUDDY);
}
示例2: GetAIInformation
void GetAIInformation(ChatHandler& reader)
{
reader.PSendSysMessage("Thermaplugg, currently phase %s", m_bIsPhaseTwo ? "two" : "one");
if (m_asBombFaces)
{
for (uint8 i = 0; i < MAX_GNOME_FACES; ++i)
reader.PSendSysMessage("Bomb face %u is %s ", (uint32)i, m_asBombFaces[i].m_bActivated ? "activated" : "not activated");
}
}
示例3: FormatMessageString
std::string GmTicket::FormatMessageString(ChatHandler& handler, bool detailed) const
{
time_t curTime = time(NULL);
Player* player = GetPlayer();
std::stringstream ss;
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _ticketId);
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTNAME, player ? player->GetName().c_str() : "NULL");
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(curTime - _ticketCreateTime, true, false)).c_str());
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(curTime - _lastModifiedTime, true, false)).c_str());
std::string name;
if (sObjectMgr->GetPlayerNameByGUID(_assignedTo, name))
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, name.c_str());
if (detailed)
{
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, _message.c_str());
if (!_comment.empty())
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, _comment.c_str());
if (!_response.empty())
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTRESPONSE, _response.c_str());
}
return ss.str();
}
示例4: GetAIInformation
void GetAIInformation(ChatHandler& reader) override
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_BRUTALLUS) == SPECIAL)
{ reader.PSendSysMessage("Brutallus intro event is currently %s", m_bIsIntroInProgress ? "in progress" : "completed"); }
else
{ reader.PSendSysMessage("Brutallus intro event is currently %s", m_pInstance->GetData(TYPE_BRUTALLUS) == NOT_STARTED ? "not started" : "completed"); }
if (m_pInstance->GetData(TYPE_BRUTALLUS) != NOT_STARTED)
{
if (Creature* pMadrigosa = m_pInstance->GetSingleCreatureFromStorage(NPC_MADRIGOSA, true))
{ reader.PSendSysMessage("Madrigosa guid is %s and has %u health.", pMadrigosa->GetObjectGuid().GetString().c_str(), pMadrigosa->GetHealth()); }
}
}
}
示例5: GetAIInformation
void npc_escortAI::GetAIInformation(ChatHandler& reader)
{
std::ostringstream oss;
oss << "EscortAI ";
if (m_playerGuid)
{
oss << "started for " << m_playerGuid.GetString() << " ";
}
if (m_pQuestForEscort)
{
oss << "started with quest " << m_pQuestForEscort->GetQuestId();
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
oss << "\nEscortFlags: Escorting" << (HasEscortState(STATE_ESCORT_RETURNING) ? ", Returning" : "") << (HasEscortState(STATE_ESCORT_PAUSED) ? ", Paused" : "");
if (CurrentWP != WaypointList.end())
{
oss << "\nNext Waypoint Id = " << CurrentWP->uiId << " Position: " << CurrentWP->fX << " " << CurrentWP->fY << " " << CurrentWP->fZ;
}
}
reader.PSendSysMessage(oss.str().c_str());
}
示例6: OnPlayerLeaveAll
void OnPlayerLeaveAll(Map* map, Player* player)
{
//if (GetValidDebugLevel() >= 3)
//sLog->outInfo(LOG_FILTER_TSCR, "#### VAS_AutoBalance_AllMapScript - OnPlayerLeaveAll map=%s player=%s", map->GetMapName(),player->GetName());
int instancePlayerCount = map->GetPlayersCountExceptGMs() - 1;
if (instancePlayerCount >=1)
{
if (GetValidDebugLevel() >= 2)
{
//sLog->outInfo(LOG_FILTER_TSCR, "----------------------------------------------------");
//sLog->outInfo(LOG_FILTER_TSCR, "## VAS_AutoBalance_AllMapScript - OnPlayerLeaveAll");
//sLog->outInfo(LOG_FILTER_TSCR, "## For InsatanceID %u",map->GetInstanceId());
//sLog->outInfo(LOG_FILTER_TSCR, "## IsDungeon= %u",map->GetEntry()->IsDungeon());
//sLog->outInfo(LOG_FILTER_TSCR, "## For Map %u",player->GetMapId());
//sLog->outInfo(LOG_FILTER_TSCR, "## PlayersInMap %u",instancePlayerCount);
//sLog->outInfo(LOG_FILTER_TSCR, "----------------------------------------------------\n");
}
if (sWorld->getIntConfig(VAS_PlayerChangeNotify) >= 1)
{
if ((map->GetEntry()->IsDungeon()) && !player->IsGameMaster())
{
Map::PlayerList const &playerList = map->GetPlayers();
if (!playerList.isEmpty())
{
for (Map::PlayerList::const_iterator playerIteration = playerList.begin(); playerIteration != playerList.end(); ++playerIteration)
{
if (Player* playerHandle = playerIteration->GetSource())
{
ChatHandler chatHandle = ChatHandler(playerHandle->GetSession());
chatHandle.PSendSysMessage("|cffFF0000 [VAS-AutoBalance]|r|cffFF8000 %s left the Instance %s. Auto setting player count to %u |r",player->GetName().c_str(),map->GetMapName(),instancePlayerCount);
}
}
}
}
}
}
}
示例7: OnPlayerEnterAll
void OnPlayerEnterAll(Map* map, Player* player)
{
if (GetValidDebugLevel() >= 2)
{
//sLog->outInfo(LOG_FILTER_TSCR, "----------------------------------------------------");
//sLog->outInfo(LOG_FILTER_TSCR, "## VAS_AutoBalance_AllMapScript - OnPlayerEnterAll");
//sLog->outInfo(LOG_FILTER_TSCR, "## For InsatanceID %u",map->GetInstanceId());
//sLog->outInfo(LOG_FILTER_TSCR, "## IsDungeon= %u",map->GetEntry()->IsDungeon());
//sLog->outInfo(LOG_FILTER_TSCR, "## For Map %u",player->GetMapId());
//sLog->outInfo(LOG_FILTER_TSCR, "## PlayersInMap %u",map->GetPlayersCountExceptGMs());
//sLog->outInfo(LOG_FILTER_TSCR, "## pDifficulty %u",uint32(player->GetDifficulty(player->GetMap()->IsHeroic())));
//sLog->outInfo(LOG_FILTER_TSCR, "## pGetDungeonDifficulty %u",uint32(player->GetDungeonDifficulty()));
//sLog->outInfo(LOG_FILTER_TSCR, "## pGetRaidDifficulty %u",uint32(player->GetRaidDifficulty()));
//sLog->outInfo(LOG_FILTER_TSCR, "## maxPlayers %u",((InstanceMap*)sMapMgr->FindMap(player->GetMapId(), player->GetInstanceId()))->GetMaxPlayers());
//sLog->outInfo(LOG_FILTER_TSCR, "## IsHeroic=%s IsRaid=%s IsRegularDifficulty=%s IsRaidOrHeroicDungeon=%s IsNonRaidDungeon=%s",BOOL_TO_STRING(player->GetMap()->IsHeroic()),BOOL_TO_STRING(player->GetMap()->IsRaid()),BOOL_TO_STRING(player->GetMap()->IsRegularDifficulty()),BOOL_TO_STRING(player->GetMap()->IsRaidOrHeroicDungeon()),BOOL_TO_STRING(player->GetMap()->IsNonRaidDungeon()));
//sLog->outInfo(LOG_FILTER_TSCR, "----------------------------------------------------\n");
}
if (sWorld->getIntConfig(VAS_PlayerChangeNotify) >= 1)
{
if ((map->GetEntry()->IsDungeon()) && !player->IsGameMaster() )
{
Map::PlayerList const &playerList = map->GetPlayers();
if (!playerList.isEmpty())
{
for (Map::PlayerList::const_iterator playerIteration = playerList.begin(); playerIteration != playerList.end(); ++playerIteration)
{
if (Player* playerHandle = playerIteration->GetSource())
{
ChatHandler chatHandle = ChatHandler(playerHandle->GetSession());
chatHandle.PSendSysMessage("|cffFF0000 [AutoBalance]|r|cffFF8000 %s entered the Instance %s. Auto setting player count to %u |r",player->GetName().c_str(),map->GetMapName(),map->GetPlayersCountExceptGMs());
}
}
}
}
}
}
示例8: GetAIInformation
void npc_escortAI::GetAIInformation(ChatHandler& reader)
{
std::ostringstream oss;
oss << "EscortAI ";
if (m_playerGuid)
oss << "started for " << m_playerGuid.GetString() << " ";
if (m_pQuestForEscort)
oss << "started with quest " << m_pQuestForEscort->GetQuestId();
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
oss << "\nEscortFlags: Escorting" << (HasEscortState(STATE_ESCORT_RETURNING) ? ", Returning" : "") << (HasEscortState(STATE_ESCORT_PAUSED) ? ", Paused" : "") << "\n";
m_creature->GetMotionMaster()->GetWaypointPathInformation(oss);
}
reader.PSendSysMessage("%s", oss.str().c_str());
}
示例9: FormatMessageString
std::string GmTicket::FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName, const char* szCompletedName) const
{
std::stringstream ss;
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTNAME, _playerName.c_str());
if (szClosedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETCLOSED, szClosedName);
if (szAssignedToName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, szAssignedToName);
if (szUnassignedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTUNASSIGNED, szUnassignedName);
if (szDeletedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETDELETED, szDeletedName);
if (szCompletedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETCOMPLETED, szCompletedName);
return ss.str();
}
示例10: FormatViewMessageString
std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* closedName, char const* assignedToName, char const* unassignedName, char const* deletedName) const
{
std::stringstream ss;
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTNAME, GetPlayerName().c_str());
if (closedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETCLOSED, closedName);
if (assignedToName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, assignedToName);
if (unassignedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTUNASSIGNED, unassignedName);
if (deletedName)
ss << handler.PGetParseString(LANG_COMMAND_TICKETDELETED, deletedName);
return ss.str();
}
示例11: FormatViewMessageString
std::string GmTicket::FormatViewMessageString(ChatHandler& handler, bool detailed) const
{
time_t curTime = time(nullptr);
std::stringstream ss;
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTNAME, GetPlayer()->GetName().c_str());
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(curTime - _createTime, true, false)).c_str());
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(curTime - _lastModifiedTime, true, false)).c_str());
std::string name;
if (ObjectMgr::GetPlayerNameByGUID(_assignedTo, name))
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, name.c_str());
if (detailed)
{
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, _description.c_str());
if (!_comment.empty())
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, _comment.c_str());
if (!_response.empty())
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTRESPONSE, _response.c_str());
}
return ss.str();
}
示例12: GetAIInformation
void GetAIInformation(ChatHandler& reader) override
{
reader.PSendSysMessage("Kil'jaeden is currently in phase %u", m_uiPhase);
}
示例13: GetAIInformation
void Scripted_NoMovementAI::GetAIInformation(ChatHandler& reader)
{
reader.PSendSysMessage("ScriptedAI (no movement)");
}
示例14: RagnarosEncounterStart
void RagnarosEncounterStart(ChatHandler& reader)
{
if (b_RagnarosEventStart)
reader.PSendSysMessage("Der Kampf mit Ragnaros beginnt in 10 Sekunden!");
}
示例15: Player
void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
{
uint64 playerGuid = holder->GetGuid();
Player* pCurrChar = new Player(this);
pCurrChar->GetMotionMaster()->Initialize();
// for send server info and strings (config)
ChatHandler chH = ChatHandler(pCurrChar);
// "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
{
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
delete pCurrChar; // delete it manually
delete holder; // delete all unprocessed queries
m_playerLoading = false;
return;
}
SetPlayer(pCurrChar);
pCurrChar->SendDungeonDifficulty(false);
WorldPacket data( SMSG_LOGIN_VERIFY_WORLD, 20 );
data << pCurrChar->GetMapId();
data << pCurrChar->GetPositionX();
data << pCurrChar->GetPositionY();
data << pCurrChar->GetPositionZ();
data << pCurrChar->GetOrientation();
SendPacket(&data);
data.Initialize( SMSG_ACCOUNT_DATA_TIMES, 128 );
for(int i = 0; i < 32; i++)
data << uint32(0);
SendPacket(&data);
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
data << uint8(2); // unknown value
data << uint8(0); // enable(1)/disable(0) voice chat interface in client
SendPacket(&data);
// Send MOTD
{
data.Initialize(SMSG_MOTD, 50); // new in 2.0.1
data << (uint32)0;
uint32 linecount=0;
std::string str_motd = sWorld.GetMotd();
std::string::size_type pos, nextpos;
pos = 0;
while ( (nextpos= str_motd.find('@',pos)) != std::string::npos )
{
if (nextpos != pos)
{
data << str_motd.substr(pos,nextpos-pos);
++linecount;
}
pos = nextpos+1;
}
if (pos<str_motd.length())
{
data << str_motd.substr(pos);
++linecount;
}
data.put(0, linecount);
SendPacket( &data );
DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" );
// send server info
if(sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
DEBUG_LOG( "WORLD: Sent server info" );
}
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
if(resultGuild)
{
Field *fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
pCurrChar->SetRank(fields[1].GetUInt32());
delete resultGuild;
}
else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
{
pCurrChar->SetInGuild(0);
pCurrChar->SetRank(0);
}
if(pCurrChar->GetGuildId() != 0)
{
Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId());
if(guild)
{
//.........这里部分代码省略.........