本文整理汇总了C++中GetNameLink函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNameLink函数的具体用法?C++ GetNameLink怎么用?C++ GetNameLink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNameLink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g
bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
{
std::list< std::pair<std::string, bool> > names;
{
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
Player* player = itr->second;
AccountTypes security = player->GetSession()->GetSecurity();
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || player->IsVisibleGloballyFor(m_session->GetPlayer())))
names.push_back(std::make_pair<std::string, bool>(GetNameLink(player), player->isAcceptWhispers()));
}
}
if (!names.empty())
{
SendSysMessage(LANG_GMS_ON_SRV);
char const* accepts = GetMangosString(LANG_GM_ACCEPTS_WHISPER);
char const* not_accept = GetMangosString(LANG_GM_NO_WHISPER);
for (std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept);
}
else
SendSysMessage(LANG_GMS_NOT_LOGGED);
return true;
}
示例2: PSendSysMessage
// Teleport player to last position
bool ChatHandler::HandleRecallCommand(const char* args)
{
Player* target;
if (!extractPlayerTarget((char*)args,&target))
return false;
// check online security
if (HasLowerSecurity(target, 0))
return false;
if (target->IsBeingTeleported())
{
PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str());
SetSentErrorMessage(true);
return false;
}
// stop flight if need
if (target->isInFlight())
{
target->GetMotionMaster()->MovementExpired();
target->CleanupAfterTaxiFlight();
}
target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
return true;
}
示例3: PSendSysMessage
//rename characters
bool ChatHandler::HandleCharacterRenameCommand(const char* args)
{
Player* target;
uint64 target_guid;
std::string target_name;
if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
return false;
if (target)
{
// check online security
if (HasLowerSecurity(target, 0))
return false;
PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_RENAME);
}
else
{
// check offline security
if (HasLowerSecurity(NULL, target_guid))
return false;
std::string oldNameLink = playerLink(target_name);
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid));
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(target_guid));
}
return true;
}
示例4: SendSysMessage
bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
{
bool first = true;
HashMapHolder<Player>::MapType &m = HashMapHolder<Player>::GetContainer();
HashMapHolder<Player>::MapType::const_iterator itr = m.begin();
for(; itr != m.end(); ++itr)
{
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{
if(first)
{
SendSysMessage(LANG_GMS_ON_SRV);
first = false;
}
SendSysMessage(GetNameLink(itr->second).c_str());
}
}
if(first)
SendSysMessage(LANG_GMS_NOT_LOGGED);
return true;
}
示例5: ACE_GUARD_RETURN
bool ChatHandler::HandleGMListIngameCommand (const char* /*args*/)
{
bool first = true;
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
HashMapHolder<Player>::MapType &m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{
if (first)
{
SendSysMessage(LANG_GMS_ON_SRV);
first = false;
}
SendSysMessage(GetNameLink(itr->second).c_str());
}
}
if (first)
SendSysMessage(LANG_GMS_NOT_LOGGED);
return true;
}
示例6: PSendSysMessage
bool ChatHandler::HandleRepairitemsCommand(const char* args)
{
Player* target;
if (!extractPlayerTarget((char*)args, &target))
return false;
// check online security
if (HasLowerSecurity(target, 0))
return false;
// Repair items
target->DurabilityRepairAll(false, 0, false);
PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str());
if (needReportToTarget(target))
ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str());
return true;
}
示例7: SendSysMessage
//Enable On\OFF all taxi paths
bool ChatHandler::HandleTaxiCheatCommand(const char* args)
{
if (!*args)
{
SendSysMessage(LANG_USE_BOL);
SetSentErrorMessage(true);
return false;
}
std::string argstr = (char*)args;
Player *chr = getSelectedPlayer();
if (!chr)
{
chr=m_session->GetPlayer();
}
// check online security
else if (HasLowerSecurity(chr, 0))
return false;
if (argstr == "on")
{
chr->SetTaxiCheater(true);
PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str());
if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str());
return true;
}
if (argstr == "off")
{
chr->SetTaxiCheater(false);
PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str());
if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str());
return true;
}
SendSysMessage(LANG_USE_BOL);
SetSentErrorMessage(true);
return false;
}
示例8: HandlePvPKill
void CPlayer::HandlePvPKill()
{
// Damage
float TotalDMG = 0;
for (auto& i : GetDamagers())
TotalDMG += i.second;
for (auto& i : GetDamagers())
{
CPlayer* pAttacker = sCustom.GetCPlayer(i.first);
if (!pAttacker)
continue;
float AReward = i.second / TotalDMG;
pAttacker->AddReward(GetNameLink(true), AReward);
// Healing
float TotalHeal = 0;
for (auto& j : pAttacker->GetHealers())
TotalHeal += j.second;
for (auto& j : pAttacker->GetHealers())
{
CPlayer* pHealer = sCustom.GetCPlayer(j.first);
if (!pHealer)
continue;
float HReward = AReward * (j.second / TotalDMG) * (j.second / pAttacker->GetMaxHealth());
pHealer->AddReward(GetNameLink(true), HReward);
}
for (auto& j : pAttacker->GetHealers())
j.second *= 0.75;
}
GetDamagers().clear();
GetHealers().clear();
}
示例9: PSendSysMessage
// faction characters
bool ChatHandler::BoutiqueFaction(const char* args)
{
int points = 0;
int prix_faction = 150;
int bilan = 0;
Player* character = m_session->GetPlayer();
//TODO : faire la requete voir si l'object à 1 prix
QueryResult result = CharacterDatabase.PQuery("SELECT `points` FROM `compte` WHERE `acct` = '%u'",character->GetSession()->GetAccountId());
if(!result)
return false;
Field* fields = result->Fetch();
if(!fields)
return false;
points = fields[0].GetUInt32();
if(points < prix_faction)
{
m_session->SendNotification("Vous n'avez pas assez de points.Il vous faut %u points pour votre demande.",prix_faction);
return false;
}
Player* target = m_session->GetPlayer();
bilan = points - prix_faction;
if(target)
{
PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = %u", target->GetGUIDLow());
CharacterDatabase.PQuery("UPDATE `compte` SET `points` = '%u' WHERE acct='%u'",bilan,character->GetSession()->GetAccountId());
}
else
{
return false;
}
return true;
}
示例10: extractGuidFromLink
bool ChatHandler::HandleGPSCommand(const char* args)
{
WorldObject *obj = NULL;
if (*args)
{
uint64 guid = extractGuidFromLink((char*)args);
if (guid)
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!obj)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
}
else
{
obj = getSelectedUnit();
if (!obj)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
return false;
}
}
CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(cell_val);
uint32 zone_id, area_id;
obj->GetZoneAndAreaId(zone_id,area_id);
MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId());
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);
float zone_x = obj->GetPositionX();
float zone_y = obj->GetPositionY();
Map2ZoneCoordinates(zone_x,zone_y,zone_id);
Map const *map = obj->GetMap();
float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);
float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());
GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY());
// 63? WHY?
int gx = 63 - p.x_coord;
int gy = 63 - p.y_coord;
uint32 have_map = Map::ExistMap(obj->GetMapId(),gx,gy) ? 1 : 0;
uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0;
if(have_vmap)
{
if(map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))
PSendSysMessage("You are outdoors");
else
PSendSysMessage("You are indoors");
}
else PSendSysMessage("no VMAP available for area info");
PSendSysMessage(LANG_MAP_POSITION,
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),
zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),
area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),
obj->GetPhaseMask(),
obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
sLog->outDebug("Player %s GPS call for %s '%s' (%s: %u):",
m_session ? GetNameLink().c_str() : GetTrinityString(LANG_CONSOLE_COMMAND),
(obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(),
(obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()));
sLog->outDebug(GetTrinityString(LANG_MAP_POSITION),
obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),
zone_id, (zoneEntry ? zoneEntry->area_name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),
area_id, (areaEntry ? areaEntry->area_name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),
obj->GetPhaseMask(),
obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
LiquidData liquid_status;
ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);
if (res)
{
PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res);
}
return true;
}
示例11: GetNameLink
//Summon group of player
bool ChatHandler::HandleGroupSummonCommand(const char* args)
{
Player* target;
if (!extractPlayerTarget((char*)args, &target))
return false;
// check online security
if (HasLowerSecurity(target, 0))
return false;
Group* group = target->GetGroup();
std::string nameLink = GetNameLink(target);
if (!group)
{
PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
SetSentErrorMessage(true);
return false;
}
Map* gmMap = m_session->GetPlayer()->GetMap();
bool to_instance = gmMap->Instanceable();
// we are in instance, and can summon only player in our group with us as lead
if (to_instance && (
!m_session->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID())))
// the last check is a bit excessive, but let it be, just in case
{
SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
SetSentErrorMessage(true);
return false;
}
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* player = itr->getSource();
if (!player || player == m_session->GetPlayer() || !player->GetSession())
continue;
// check online security
if (HasLowerSecurity(player, 0))
return false;
std::string plNameLink = GetNameLink(player);
if (player->IsBeingTeleported() == true)
{
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
SetSentErrorMessage(true);
return false;
}
if (to_instance)
{
Map* plMap = player->GetMap();
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
{
// cannot summon from instance to instance
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
SetSentErrorMessage(true);
return false;
}
}
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
if (needReportToTarget(player))
ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
// stop flight if need
if (player->isInFlight())
{
player->GetMotionMaster()->MovementExpired();
player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
player->SaveRecallPosition();
// before GM
float x, y, z;
m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
}
return true;
}
示例12: GetNameLink
std::string ChatHandler::GetNameLink() const
{
return GetNameLink(m_session->GetPlayer());
}
示例13: strtol
// Mysteria Star
bool ChatHandler::HandleMarkCommand(char* args)
{
uint32 itemId = 38186;
int32 count;
// ak nieje parameter, pocet je defaultne 1
if (!*args)
count = 1;
else
count = strtol(args, NULL, 10);
// ak je vlozena hodnota chybna, vrati 0
if (count == 0)
return false;
// Ziskanie targetu hraca
Player* pl = m_session->GetPlayer();
Player* plTarget = getSelectedPlayer();
// Ak nieje target, da Eventerovi samotnemu.
//TODO: ma to vobec vyznam?
if (!plTarget)
plTarget = pl;
// Sprava do Logu (len pri detajlnom log-ovani)
sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count);
// Snaha vytvorit objekt (malo by sa podarit ale aj motyka vystreli...)
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemId);
if (!pProto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
SetSentErrorMessage(true);
return false;
}
// odobratie itemu (zaporny pocet)
if (count < 0)
{
if (!plTarget->HasItemCount(itemId, -count, false)) // itemId, count, inBankAlso
{
ChatHandler(pl->GetSession()).PSendSysMessage("You do not have enough Mysteria Star!");
pl->GetSession()->SendNotification("You do not have enough Mysteria Star!");
return false;
}
plTarget->DestroyItemCount(itemId, -count, true, false);
PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str());
return true;
}
// Pridanie itemu
uint32 noSpaceForCount = 0;
// kontrola miesta v bagu a najdenie miesta
ItemPosCountVec dest;
uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= noSpaceForCount;
if (count == 0 || dest.empty()) // can't add any
{
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
SetSentErrorMessage(true);
return false;
}
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
// Odstranenie bindovania ak gm si da item sam aby ho mohol tradeovat
//
// TODO ma to vyznam?
/*
if(pl==plTarget)
for(ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
if(Item* item1 = pl->GetItemByPos(itr->pos))
item1->SetBinding( false );
*/
// Pridanie itemu
if (count > 0 && item)
{
pl->SendNewItem(item, count, false, true);
if (pl != plTarget)
plTarget->SendNewItem(item, count, true, false);
}
// Chyba pri nedostatku miesta
if (noSpaceForCount > 0)
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
return true;
}
示例14: HandleWorldChatCommand
static bool HandleWorldChatCommand(ChatHandler * handler, const char * args)
{
if (!handler->GetSession()->GetPlayer()->CanSpeak())
return false;
std::string temp = args;
if (!args || temp.find_first_not_of(' ') == std::string::npos)
return false;
std::string msg = "";
Player * player = handler->GetSession()->GetPlayer();
switch(player->GetSession()->GetSecurity())
{
// Player
case SEC_PLAYER:
if (player->GetTeam() == ALLIANCE)
{
msg += "|cff0000ff[Alianza] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
}
else
{
msg += "|cffff0000[Horda] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
}
break;
// VIP
case 1:
msg += "|cffC400C4[Gm-R1] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// Trial GM - 2
case 2:
msg += "|cff800000[Gm-R2] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// GM - 3
case 3:
msg += "|cff0000FF[GM-R3] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// GM-4
case 4:
msg += "|CFF800080[GM-R4] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// Developer - 5
case 5:
msg += "|cff000000[Administrador] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// Admin - 6
case 6:
msg += "|cffFF0000[ADMIN] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
// CONSOLA
case 7:
msg += "|cffFF0000[SERVIDOR] ";
msg += GetNameLink(player);
msg += " |cfffaeb00";
break;
}
msg += args;
if (FACTION_SPECIFIC)
{
SessionMap sessions = sWorld->GetAllSessions();
for (SessionMap::iterator itr = sessions.begin(); itr != sessions.end(); ++itr)
if (Player* plr = itr->second->GetPlayer())
if (plr->GetTeam() == player->GetTeam())
sWorld->SendServerMessage(SERVER_MSG_STRING, msg.c_str(), plr);
}
else
sWorld->SendServerMessage(SERVER_MSG_STRING, msg.c_str(), 0);
return true;
}
示例15: GetNameLink
void CPlayer::SendWorldChatMsg(std::string msg)
{
std::string chatstring = GetNameLink(true) + MSG_COLOR_WHITE + ": " + msg;
sCustom.SendWorldChat(GetObjectGuid(), sCustom.stringReplace(chatstring, "|r", MSG_COLOR_WHITE));
}