本文整理汇总了C++中CClient::GetChar方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::GetChar方法的具体用法?C++ CClient::GetChar怎么用?C++ CClient::GetChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::GetChar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_Verb
bool CRegionBase::r_Verb( CScript & s, CTextConsole * pSrc ) // Execute command from script
{
ADDTOCALLSTACK("CRegionBase::r_Verb");
EXC_TRY("Verb");
LPCTSTR pszKey = s.GetKey();
if ( !strnicmp(pszKey, "CLEARTAGS", 9) )
{
pszKey = s.GetArgStr();
SKIP_SEPARATORS(pszKey);
m_TagDefs.ClearKeys(pszKey);
return true;
}
int index = FindTableSorted(pszKey, sm_szVerbKeys, COUNTOF(sm_szVerbKeys) - 1);
if ( index < 0 )
{
index = FindTableSorted(s.GetKey(), CSector::sm_szVerbKeys, SEV_QTY);
if ( index >= 0 )
return SendSectorsVerb(s.GetKey(), s.GetArgRaw(), pSrc);
}
switch ( static_cast<RV_TYPE>(index) )
{
case RV_ALLCLIENTS:
{
ClientIterator it;
for (CClient* pClient = it.next(); pClient != NULL; pClient = it.next())
{
CChar * pChar = pClient->GetChar();
if ( !pChar || (pChar->m_pArea != this) )
continue;
CScript script( s.GetArgStr() );
pChar->r_Verb(script, pSrc);
}
return true;
}
case RV_TAGLIST:
{
m_TagDefs.DumpKeys( pSrc, "TAG." );
return true;
}
default:
break;
}
return CScriptObj::r_Verb(s, pSrc);
EXC_CATCH;
EXC_DEBUG_START;
g_Log.EventDebug("command '%s' args '%s' [%p]\n", s.GetKey(), s.GetArgRaw(), static_cast<void *>(pSrc));
EXC_DEBUG_END;
return false;
}
示例2: GetChatName
LPCTSTR CChatMember::GetChatName()
{
ADDTOCALLSTACK("CChatMember::GetChatName");
CClient *pClient = GetClient();
if ( pClient )
{
if ( !pClient->m_UseNewChatSystem && (g_Cfg.m_iChatFlags & CHATF_CUSTOMNAMES) )
return pClient->m_pAccount->m_sChatName;
CChar *pChar = pClient->GetChar();
if ( pChar )
return pChar->GetName();
}
return "<NA>";
}
示例3: r_LoadVal
bool CCharPlayer::r_LoadVal( CChar * pChar, CScript &s )
{
ADDTOCALLSTACK("CCharPlayer::r_LoadVal");
EXC_TRY("LoadVal");
LPCTSTR pszKey = s.GetKey();
if ( !strnicmp(pszKey, "GMPAGE", 6) ) // GM pages
{
pszKey += 6;
if ( *pszKey == '.' ) // GMPAGE.*
{
SKIP_SEPARATORS(pszKey);
size_t index = Exp_GetVal(pszKey);
if ( index >= g_World.m_GMPages.GetCount() )
return false;
CGMPage* pPage = STATIC_CAST <CGMPage*> (g_World.m_GMPages.GetAt(index));
if ( pPage == NULL )
return false;
SKIP_SEPARATORS(pszKey);
if ( !strcmpi(pszKey, "HANDLE") )
{
CChar *ppChar = pChar;
LPCTSTR pszArgs = s.GetArgStr(); //Moved here because of error with quoted strings!?!?
if ( *pszArgs )
ppChar = dynamic_cast<CChar*>(g_World.FindUID(s.GetArgVal()));
if ( ppChar == NULL )
return false;
CClient *pClient = ppChar->GetClient();
if ( pClient == NULL )
return false;
pPage->SetGMHandler(pClient);
}
else if ( !strcmpi(pszKey, "DELETE") )
{
delete pPage;
}
else if ( pPage->FindGMHandler() )
{
CClient* pClient = pChar->GetClient();
if ( pClient != NULL && pClient->GetChar() != NULL )
pClient->Cmd_GM_PageCmd(pszKey);
}
else
{
return false;
}
return true;
}
return false;
}
else if ( ( !strnicmp(pszKey, "GUILD", 5) ) || ( !strnicmp(pszKey, "TOWN", 4) ) )
{
bool bIsGuild = !strnicmp(pszKey, "GUILD", 5);
pszKey += bIsGuild ? 5 : 4;
if ( *pszKey == '.' )
{
pszKey += 1;
CItemStone *pMyGuild = pChar->Guild_Find(bIsGuild ? MEMORY_GUILD : MEMORY_TOWN);
if ( pMyGuild ) return pMyGuild->r_SetVal(pszKey, s.GetArgRaw());
}
return false;
}
switch ( FindTableHeadSorted( s.GetKey(), sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case CPC_DEATHS:
m_wDeaths = static_cast<WORD>(s.GetArgVal());
return true;
case CPC_DSPEECH:
return( m_Speech.r_LoadVal( s, RES_SPEECH ));
case CPC_KILLS:
m_wMurders = static_cast<WORD>(s.GetArgVal());
pChar->NotoSave_Update();
return true;
case CPC_KRTOOLBARSTATUS:
m_bKrToolbarEnabled = ( s.GetArgVal() != 0 );
if ( pChar->IsClient() )
pChar->GetClient()->addKRToolbar( m_bKrToolbarEnabled );
return true;
case CPC_LASTUSED:
m_timeLastUsed = CServTime::GetCurrentTime() - ( s.GetArgVal() * TICK_PER_SEC );
return( true );
case CPC_PFLAG:
{
m_pflag = s.GetArgVal();
} return( true );
case CPC_PROFILE:
m_sProfile = Str_MakeFiltered( s.GetArgStr());
return( true );
case CPC_REFUSETRADES:
pChar->SetDefNum(s.GetKey(), s.GetArgVal() > 0 ? 1 : 0, false);
return( true );
case CPC_SKILLCLASS:
//.........这里部分代码省略.........
示例4: r_Verb
bool CWebPageDef::r_Verb( CScript & s, CTextConsole * pSrc ) // some command on this object as a target
{
ADDTOCALLSTACK("CWebPageDef::r_Verb");
EXC_TRY("Verb");
ASSERT(pSrc);
sm_iListIndex = 0;
TCHAR *pszTmp2 = Str_GetTemp();
WV_TYPE iHeadKey = (WV_TYPE) FindTableSorted( s.GetKey(), sm_szVerbKeys, COUNTOF(sm_szVerbKeys)-1 );
switch ( iHeadKey )
{
case WV_WEBPAGE:
{
// serv a web page to the pSrc
CClient *pClient = dynamic_cast<CClient *>(pSrc);
if ( !pClient )
return false;
return ServPage(pClient, s.GetArgStr(), NULL);
}
case WV_CLIENTLIST:
{
ClientIterator it;
for ( CClient *pClient = it.next(); pClient != NULL; pClient = it.next() )
{
CChar *pChar = pClient->GetChar();
if ( !pChar )
continue;
if ( pChar->IsStatFlag(STATF_Insubstantial) && (pClient->GetPrivLevel() > PLEVEL_Player) )
continue;
sm_iListIndex++;
LPCTSTR pszArgs = s.GetArgStr();
if ( pszArgs[0] == '\0' )
pszArgs = "<tr><td>%NAME%</td><td>%REGION.NAME%</td></tr>\n";
strcpy(pszTmp2, pszArgs);
pChar->ParseText(Str_MakeFiltered(pszTmp2), &g_Serv, 1);
pSrc->SysMessage(pszTmp2);
}
break;
}
case WV_GUILDLIST:
case WV_TOWNLIST:
{
if ( !s.HasArgs() )
return false;
IT_TYPE needtype = (iHeadKey == WV_GUILDLIST) ? IT_STONE_GUILD : IT_STONE_TOWN;
for ( size_t i = 0; i < g_World.m_Stones.GetCount(); i++ )
{
CItemStone *pStone = g_World.m_Stones[i];
if ( !pStone || !pStone->IsType(needtype) )
continue;
sm_iListIndex++;
strcpy(pszTmp2, s.GetArgStr());
pStone->ParseText(Str_MakeFiltered(pszTmp2), &g_Serv, 1);
pSrc->SysMessage(pszTmp2);
}
break;
}
case WV_GMPAGELIST:
{
if ( !s.HasArgs() )
return false;
CGMPage *pPage = static_cast<CGMPage *>(g_World.m_GMPages.GetHead());
for ( ; pPage != NULL; pPage = pPage->GetNext() )
{
sm_iListIndex++;
strcpy(pszTmp2, s.GetArgStr());
pPage->ParseText(Str_MakeFiltered(pszTmp2), &g_Serv, 1);
pSrc->SysMessage(pszTmp2);
}
break;
}
default:
return CResourceLink::r_Verb(s, pSrc);
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_SCRIPTSRC;
EXC_DEBUG_END;
return false;
}