本文整理汇总了C++中GetSkyFireString函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSkyFireString函数的具体用法?C++ GetSkyFireString怎么用?C++ GetSkyFireString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSkyFireString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendNotification
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(GetSkyFireString(LANGUAGE_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}
GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
GmTicket* ticket = new GmTicket(GetPlayer(), recvData);
sTicketMgr->AddTicket(ticket);
sTicketMgr->UpdateLastChange();
sWorld->SendGMText(LANGUAGE_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
data << uint32(response);
SendPacket(&data);
}
示例2: GetSkyFireString
void ChatHandler::PSendSysMessage(int32 entry, ...)
{
const char *format = GetSkyFireString(entry);
va_list ap;
char str [2048];
va_start(ap, entry);
vsnprintf(str, 2048, format, ap);
va_end(ap);
SendSysMessage(str);
}
示例3: sprintf
// global announce
bool ChatHandler::HandleAnnounceCommand(const char* args)
{
if (!*args)
return false;
char buff[2048];
sprintf(buff, GetSkyFireString(LANG_SYSTEMMESSAGE), args);
sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
return true;
}
示例4: wstrToLower
bool ChatHandler::HandleLookupEventCommand(const char* args)
{
if (!*args)
return false;
std::string namepart = args;
std::wstring wnamepart;
// converting string that we try to find to lower case
if (!Utf8toWStr(namepart, wnamepart))
return false;
wstrToLower(wnamepart);
bool found = false;
uint32 count = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
for (uint32 id = 0; id < events.size(); ++id)
{
GameEventData const& eventData = events[id];
std::string descr = eventData.description;
if (descr.empty())
continue;
if (Utf8FitTo(descr, wnamepart))
{
if (maxResults && count++ == maxResults)
{
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
return true;
}
char const* active = activeEvents.find(id) != activeEvents.end() ? GetSkyFireString(LANG_ACTIVE) : "";
if (m_session)
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
else
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
if (!found)
found = true;
}
}
if (!found)
SendSysMessage(LANG_NOEVENTFOUND);
return true;
}
示例5: GetSessionDbcLocale
bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
{
if (!*args)
return false;
Player* target;
if (!extractPlayerTarget((char*)args, &target))
return false;
LocaleConstant loc = GetSessionDbcLocale();
char const* targetName = target->GetName();
char const* knownStr = GetSkyFireString(LANG_KNOWN);
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
if (titleInfo && target->HasTitle(titleInfo))
{
std::string name = titleInfo->name;
if (name.empty())
continue;
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
? GetSkyFireString(LANG_ACTIVE)
: "";
char titleNameStr[80];
snprintf(titleNameStr, 80, name.c_str(), targetName);
// send title in "id (idx:idx) - [namedlink locale]" format
if (m_session)
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
else
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
}
}
return true;
}
示例6: GetSkyFireString
//notification player at the screen
bool ChatHandler::HandleNotifyCommand(const char* args)
{
if (!*args)
return false;
std::string str = GetSkyFireString(LANG_GLOBAL_NOTIFY);
str += args;
WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
data << str;
sWorld->SendGlobalMessage(&data);
return true;
}
示例7: GetSkyFireString
void WorldSession::SendNotification(uint32 string_id, ...)
{
char const* format = GetSkyFireString(string_id);
if (format)
{
va_list ap;
char szStr [1024];
szStr[0] = '\0';
va_start(ap, string_id);
vsnprintf(szStr, 1024, format, ap);
va_end(ap);
WorldPacket data(SMSG_NOTIFICATION, (strlen(szStr)+1));
data << szStr;
SendPacket(&data);
}
}
示例8: SendNotification
//this void causes that auction window is opened
void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
{
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
{
SendNotification(GetSkyFireString(LANG_AUCTION_REQ), sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ));
return;
}
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
if (!ahEntry)
return;
WorldPacket data(MSG_AUCTION_HELLO, 12);
data << uint64(guid);
data << uint32(ahEntry->houseId);
data << uint8(1); // 3.3.3: 1 - AH enabled, 0 - AH disabled
SendPacket(&data);
}
示例9: data
void WorldSession::SendNameQueryOpcode(uint64 guid)
{
Player* player = NULL;
const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
if (nameData)
player = ObjectAccessor::FindPlayer(guid);
// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
data.appendPackGUID(guid);
data << uint8(0); // added in 3.1
if (nameData)
{
data << nameData->m_name; // played name
data << uint8(0); // realm name for cross realm BG usage
data << uint8(nameData->m_race);
data << uint8(nameData->m_gender);
data << uint8(nameData->m_class);
}
else
{
data << std::string(GetSkyFireString(LANG_NON_EXIST_CHARACTER));
data << uint32(0);
}
if (player)
{
if (DeclinedName const* names = player->GetDeclinedNames())
{
data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << names->name[i];
}
else
data << uint8(0); // is not declined
}
else //TODO: decline names may also need to be stored in char name data
data << uint8(0);
SendPacket(&data);
}
示例10: GetSkyFireString
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult result)
{
if (!result)
return;
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
std::string name = fields[1].GetString();
uint8 pRace = 0, pGender = 0, pClass = 0;
if (name == "")
name = GetSkyFireString(LANG_NON_EXIST_CHARACTER);
else
{
pRace = fields[2].GetUInt8();
pGender = fields[3].GetUInt8();
pClass = fields[4].GetUInt8();
}
// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10));
data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
data << uint8(0); // added in 3.1
data << name;
data << uint8(0); // realm name for cross realm BG usage
data << uint8(pRace); // race
data << uint8(pGender); // gender
data << uint8(pClass); // class
// if the first declined name field (5) is empty, the rest must be too
if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetString() != "")
{
data << uint8(1); // is declined
for (int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
data << fields[i].GetString();
}
else
data << uint8(0); // is not declined
SendPacket(&data);
}
示例11: SendTradeStatus
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
{
ObjectGuid guid;
guid[5] = recvPacket.ReadBit();
guid[1] = recvPacket.ReadBit();
guid[4] = recvPacket.ReadBit();
guid[2] = recvPacket.ReadBit();
guid[3] = recvPacket.ReadBit();
guid[7] = recvPacket.ReadBit();
guid[0] = recvPacket.ReadBit();
guid[6] = recvPacket.ReadBit();
recvPacket.ReadByteSeq(guid[4]);
recvPacket.ReadByteSeq(guid[6]);
recvPacket.ReadByteSeq(guid[2]);
recvPacket.ReadByteSeq(guid[0]);
recvPacket.ReadByteSeq(guid[3]);
recvPacket.ReadByteSeq(guid[7]);
recvPacket.ReadByteSeq(guid[5]);
recvPacket.ReadByteSeq(guid[1]);
if (GetPlayer()->m_trade)
return;
if (!GetPlayer()->IsAlive())
{
SendTradeStatus(TRADE_STATUS_DEAD);
return;
}
if (GetPlayer()->HasUnitState(UNIT_STATE_STUNNED))
{
SendTradeStatus(TRADE_STATUS_STUNNED);
return;
}
if (isLogingOut())
{
SendTradeStatus(TRADE_STATUS_LOGGING_OUT);
return;
}
if (GetPlayer()->IsInFlight())
{
SendTradeStatus(TRADE_STATUS_TOO_FAR_AWAY);
return;
}
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ))
{
SendNotification(GetSkyFireString(LANG_TRADE_REQ), sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
return;
}
Player* pOther = ObjectAccessor::FindPlayer(guid);
if (!pOther)
{
SendTradeStatus(TRADE_STATUS_PLAYER_NOT_FOUND);
return;
}
if (pOther == GetPlayer() || pOther->m_trade)
{
SendTradeStatus(TRADE_STATUS_ALREADY_TRADING);
return;
}
if (!pOther->IsAlive())
{
SendTradeStatus(TRADE_STATUS_TARGET_DEAD);
return;
}
if (pOther->IsInFlight())
{
SendTradeStatus(TRADE_STATUS_TOO_FAR_AWAY);
return;
}
if (pOther->HasUnitState(UNIT_STATE_STUNNED))
{
SendTradeStatus(TRADE_STATUS_TARGET_STUNNED);
return;
}
if (pOther->GetSession()->isLogingOut())
{
SendTradeStatus(TRADE_STATUS_TARGET_LOGGING_OUT);
return;
}
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
{
SendTradeStatus(TRADE_STATUS_PLAYER_IGNORED);
return;
}
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam())
//.........这里部分代码省略.........
示例12: PSendSysMessage
//Enable\Dissable accept whispers (for GM)
bool ChatHandler::HandleWhispersCommand(const char* args)
{
if (!*args)
{
PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetSkyFireString(LANG_ON) : GetSkyFireString(LANG_OFF));
return true;
}
std::string argstr = (char*)args;
// whisper on
if (argstr == "on")
{
m_session->GetPlayer()->SetAcceptWhispers(true);
SendSysMessage(LANG_COMMAND_WHISPERON);
return true;
}
// whisper off
if (argstr == "off")
{
// Remove all players from the Gamemaster's whisper whitelist
m_session->GetPlayer()->ClearWhisperWhiteList();
m_session->GetPlayer()->SetAcceptWhispers(false);
SendSysMessage(LANG_COMMAND_WHISPEROFF);
return true;
}
SendSysMessage(LANG_USE_BOL);
SetSentErrorMessage(true);
return false;
}
示例13: MAKE_NEW_GUID
//show info of player
bool ChatHandler::HandlePInfoCommand(const char* args)
{
Player* target;
uint64 target_guid;
std::string target_name;
uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, target_name))
{
target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
target_guid = parseGUID;
}
else if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
return false;
uint32 accId = 0;
uint32 money = 0;
uint32 total_player_time = 0;
uint8 level = 0;
uint32 latency = 0;
uint8 race;
uint8 Class;
int64 muteTime = 0;
int64 banTime = -1;
uint32 mapId;
uint32 areaId;
uint32 phase = 0;
// get additional information from Player object
if (target)
{
// check online security
if (HasLowerSecurity(target, 0))
return false;
accId = target->GetSession()->GetAccountId();
money = target->GetMoney();
total_player_time = target->GetTotalPlayedTime();
level = target->getLevel();
latency = target->GetSession()->GetLatency();
race = target->getRace();
Class = target->getClass();
muteTime = target->GetSession()->m_muteTime;
mapId = target->GetMapId();
areaId = target->GetAreaId();
phase = target->GetPhaseMask();
}
// get additional information from DB
else
{
// check offline security
if (HasLowerSecurity(NULL, target_guid))
return false;
// 0 1 2 3 4 5 6 7
QueryResult result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class, map, zone FROM characters "
"WHERE guid = '%u'", GUID_LOPART(target_guid));
if (!result)
return false;
Field *fields = result->Fetch();
total_player_time = fields[0].GetUInt32();
level = fields[1].GetUInt32();
money = fields[2].GetUInt32();
accId = fields[3].GetUInt32();
race = fields[4].GetUInt8();
Class = fields[5].GetUInt8();
mapId = fields[6].GetUInt16();
areaId = fields[7].GetUInt16();
}
std::string username = GetSkyFireString(LANG_ERROR);
std::string email = GetSkyFireString(LANG_ERROR);
std::string last_ip = GetSkyFireString(LANG_ERROR);
uint32 security = 0;
std::string last_login = GetSkyFireString(LANG_ERROR);
QueryResult result = LoginDatabase.PQuery("SELECT a.username, af.Security, a.email, a.last_ip, a.last_login, a.mutetime "
"FROM account a "
"LEFT JOIN account_forcepermission af "
"ON (a.id = af.AccountID AND (af.realmID = -1 OR af.realmID = %u)) "
"WHERE a.id = '%u'", realmID, accId);
if (result)
{
Field* fields = result->Fetch();
username = fields[0].GetString();
security = fields[1].GetUInt32();
email = fields[2].GetString();
muteTime = fields[5].GetUInt64();
if (email.empty())
email = "-";
if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
{
last_ip = fields[3].GetString();
last_login = fields[4].GetString();
}
//.........这里部分代码省略.........
示例14: getSelectedPlayer
bool ChatHandler::HandleLookupTitleCommand(const char* args)
{
if (!*args)
return false;
// can be NULL in console call
Player* target = getSelectedPlayer();
// title name have single string arg for player name
char const* targetName = target ? target->GetName() : "NAME";
std::string namepart = args;
std::wstring wnamepart;
if (!Utf8toWStr(namepart, wnamepart))
return false;
// converting string that we try to find to lower case
wstrToLower(wnamepart);
uint32 counter = 0; // Counter for figure out that we found smth.
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
{
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
if (titleInfo)
{
int loc = GetSessionDbcLocale();
std::string name = titleInfo->name;
if (name.empty())
continue;
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
for (; loc < TOTAL_LOCALES; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
name = titleInfo->name[loc];
if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
break;
}
}
if (loc < TOTAL_LOCALES)
{
if (maxResults && counter == maxResults)
{
PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
return true;
}
char const* knownStr = target && target->HasTitle(titleInfo) ? GetSkyFireString(LANG_KNOWN) : "";
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
? GetSkyFireString(LANG_ACTIVE)
: "";
char titleNameStr[80];
snprintf(titleNameStr, 80, name.c_str(), targetName);
// send title in "id (idx:idx) - [namedlink locale]" format
if (m_session)
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
else
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
++counter;
}
}
}
if (counter == 0) // if counter == 0 then we found nth
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
return true;
}
示例15: switch
void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
{
uint32 type = 0;
uint32 lang;
// Les types sont maintenant ger�s par opcode, un opcode par type
// Changement en place depuis la 4.0.1 13164
switch(recv_data.GetOpcode())
{
case CMSG_MESSAGECHAT_SAY:
type = CHAT_MSG_SAY;
break;
case CMSG_MESSAGECHAT_YELL:
type = CHAT_MSG_YELL;
break;
case CMSG_MESSAGECHAT_CHANNEL:
type = CHAT_MSG_CHANNEL;
break;
case CMSG_MESSAGECHAT_WHISPER:
type = CHAT_MSG_WHISPER;
break;
case CMSG_MESSAGECHAT_GUILD:
type = CHAT_MSG_GUILD;
break;
case CMSG_MESSAGECHAT_OFFICER:
type = CHAT_MSG_OFFICER;
break;
case CMSG_MESSAGECHAT_AFK:
type = CHAT_MSG_AFK;
break;
case CMSG_MESSAGECHAT_DND:
type = CHAT_MSG_DND;
break;
case CMSG_MESSAGECHAT_EMOTE:
type = CHAT_MSG_EMOTE;
break;
case CMSG_MESSAGECHAT_PARTY:
type = CHAT_MSG_PARTY;
break;
case CMSG_MESSAGECHAT_PARTY_LEADER:
type = CHAT_MSG_PARTY_LEADER;
break;
case CMSG_MESSAGECHAT_RAID:
type = CHAT_MSG_RAID;
break;
case CMSG_MESSAGECHAT_RAID_LEADER:
type = CHAT_MSG_RAID_LEADER;
break;
case CMSG_MESSAGECHAT_BATTLEGROUND:
type = CHAT_MSG_BATTLEGROUND;
break;
case CMSG_MESSAGECHAT_BATTLEGROUND_LEADER:
type = CHAT_MSG_BATTLEGROUND_LEADER;
break;
case CMSG_MESSAGECHAT_RAID_WARNING:
type = CHAT_MSG_RAID_WARNING;
break;
default:
sLog->outDetail("HandleMessagechatOpcode : Unknown chat opcode (%u)", recv_data.GetOpcode());
recv_data.hexlike();
return;
}
// no language for AFK and DND messages
if (type == CHAT_MSG_AFK)
{
std::string msg;
recv_data >> msg;
if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat())
{
if (!_player->isAFK())
{
if (msg.empty())
msg = GetSkyFireString(LANG_PLAYER_AFK_DEFAULT);
_player->afkMsg = msg;
}
sScriptMgr->OnPlayerChat(_player, type, LANG_UNIVERSAL, msg);
_player->ToggleAFK();
if (_player->isAFK() && _player->isDND())
_player->ToggleDND();
}
return;
}