本文整理汇总了C++中CChar::GetPrivLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CChar::GetPrivLevel方法的具体用法?C++ CChar::GetPrivLevel怎么用?C++ CChar::GetPrivLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChar
的用法示例。
在下文中一共展示了CChar::GetPrivLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cmd_Skill_Tracking
bool CClient::Cmd_Skill_Tracking( WORD track_sel, bool bExec )
{
ADDTOCALLSTACK("CClient::Cmd_Skill_Tracking");
// look around for stuff.
ASSERT(m_pChar);
if ( track_sel == USHRT_MAX )
{
// Unlike others skills, Tracking is used during menu setup
m_pChar->Skill_Cleanup(); // clean up current skill
CMenuItem item[6];
item[0].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_TITLE);
item[1].m_id = ITEMID_TRACK_HORSE;
item[1].m_color = 0;
item[1].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_ANIMALS);
item[2].m_id = ITEMID_TRACK_OGRE;
item[2].m_color = 0;
item[2].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_MONSTERS);
item[3].m_id = ITEMID_TRACK_MAN;
item[3].m_color = 0;
item[3].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_NPCS);
item[4].m_id = ITEMID_TRACK_WOMAN;
item[4].m_color = 0;
item[4].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_PLAYERS);
m_tmMenu.m_Item[0] = 0;
addItemMenu(CLIMODE_MENU_SKILL_TRACK_SETUP, item, 4);
return true;
}
if ( track_sel > 0 ) // Not Cancelled
{
ASSERT(track_sel < COUNTOF(m_tmMenu.m_Item));
if ( bExec )
{
// Tracking menu got us here. Start tracking the selected creature.
m_pChar->SetTimeout(1 * TICK_PER_SEC);
m_pChar->m_Act_Targ = static_cast<CGrayUID>(m_tmMenu.m_Item[track_sel]);
m_pChar->Skill_Start(SKILL_TRACKING);
return true;
}
static const NPCBRAIN_TYPE sm_Track_Brain[] =
{
NPCBRAIN_QTY, // not used here
NPCBRAIN_ANIMAL,
NPCBRAIN_MONSTER,
NPCBRAIN_HUMAN,
NPCBRAIN_NONE // players
};
if ( track_sel >= COUNTOF(sm_Track_Brain) )
track_sel = COUNTOF(sm_Track_Brain) - 1;
NPCBRAIN_TYPE track_type = sm_Track_Brain[track_sel];
CMenuItem item[minimum(MAX_MENU_ITEMS, COUNTOF(m_tmMenu.m_Item))];
size_t count = 0;
item[0].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_TITLE);
m_tmMenu.m_Item[0] = track_sel;
CWorldSearch AreaChars(m_pChar->GetTopPoint(), m_pChar->Skill_GetBase(SKILL_TRACKING) / 10 + 10);
for (;;)
{
CChar *pChar = AreaChars.GetChar();
if ( !pChar )
break;
if ( pChar == m_pChar )
continue;
if ( pChar->GetNPCBrain() != track_type )
continue;
if ( pChar->IsStatFlag(STATF_DEAD) ) // can't track ghosts
continue;
if ( pChar->m_pPlayer )
{
// Prevent track hidden GMs
if ( pChar->IsStatFlag(STATF_Insubstantial) && (pChar->GetPrivLevel() > GetPrivLevel()) )
continue;
// Check action difficulty when trying to track players
int tracking = m_pChar->Skill_GetBase(SKILL_TRACKING);
int detectHidden = m_pChar->Skill_GetBase(SKILL_DETECTINGHIDDEN);
if ( (g_Cfg.m_iRacialFlags & RACIALF_ELF_DIFFTRACK) && pChar->IsElf() )
tracking /= 2; // elves are more difficult to track (Difficult to Track racial trait)
int hiding = pChar->Skill_GetBase(SKILL_HIDING);
int stealth = pChar->Skill_GetBase(SKILL_STEALTH);
int divisor = maximum(hiding + stealth, 1);
int chance;
if ( g_Cfg.m_iFeatureSE & FEATURE_SE_UPDATE )
chance = 50 * (tracking * 2 + detectHidden) / divisor;
else
chance = 50 * (tracking + detectHidden + 10 * Calc_GetRandVal(20)) / divisor;
if ( Calc_GetRandVal(100) > chance )
//.........这里部分代码省略.........