本文整理汇总了C++中CGString::FormatVal方法的典型用法代码示例。如果您正苦于以下问题:C++ CGString::FormatVal方法的具体用法?C++ CGString::FormatVal怎么用?C++ CGString::FormatVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGString
的用法示例。
在下文中一共展示了CGString::FormatVal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_WriteVal
bool CWebPageDef::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CWebPageDef::r_WriteVal");
EXC_TRY("WriteVal");
switch ( FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case WC_PLEVEL:
sVal.FormatVal( m_privlevel );
break;
case WC_WEBPAGEFILE:
sVal = m_sDstFilePath;
break;
case WC_WEBPAGELOG:
sVal.FormatVal( m_iUpdateLog );
break;
case WC_WEBPAGESRC:
sVal = m_sSrcFilePath;
break;
case WC_WEBPAGEUPDATE: // (seconds)
sVal.FormatVal( m_iUpdatePeriod / TICK_PER_SEC );
break;
default:
return( g_Serv.r_WriteVal( pszKey, sVal, pSrc ));
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_KEYRET(pSrc);
EXC_DEBUG_END;
return false;
}
示例2: r_WriteVal
bool CItemSpawn::r_WriteVal(LPCTSTR pszKey, CGString & sVal, CTextConsole *pSrc)
{
ADDTOCALLSTACK("CitemSpawn:r_WriteVal");
EXC_TRY("WriteVal");
if (!strnicmp(pszKey, "amount", 6))
{
sVal.FormatVal(GetAmount());
return true;
}
else if ( !strnicmp(pszKey, "at.", 3) )
{
pszKey += 3;
int objIndex = Exp_GetVal(pszKey);
if ( m_obj[objIndex].ItemFind() )
return m_obj[objIndex].ItemFind()->r_WriteVal(pszKey, sVal, pSrc);
else if ( m_obj[objIndex].CharFind() )
return m_obj[objIndex].CharFind()->r_WriteVal(pszKey, sVal, pSrc);
return true;
}
else if ( !strnicmp(pszKey, "count", 5) )
{
sVal.FormatVal(GetCount());
return true;
}
EXC_CATCH;
return CItem::r_WriteVal(pszKey, sVal, pSrc);
}
示例3: r_WriteVal
bool CItemMulti::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
if ( !strnicmp(pszKey, "COMP", 4) )
{
const CItemBaseMulti *pMultiDef = Multi_GetDef();
pszKey += 4;
// no component uid
if ( !*pszKey ) sVal.FormatVal(pMultiDef->m_Components.GetCount());
else if ( *pszKey == '.' )
{
CMultiComponentItem item;
SKIP_SEPERATORS(pszKey);
int iQty = Exp_GetVal(pszKey);
if (( iQty < 0 ) || ( iQty >= pMultiDef->m_Components.GetCount())) return false;
SKIP_SEPERATORS(pszKey);
item = pMultiDef->m_Components.GetAt(iQty);
if ( !strnicmp(pszKey, "ID", 2) ) sVal.FormatVal(item.m_id);
else if ( !strnicmp(pszKey, "DX", 2) ) sVal.FormatVal(item.m_dx);
else if ( !strnicmp(pszKey, "DY", 2) ) sVal.FormatVal(item.m_dy);
else if ( !strnicmp(pszKey, "DZ", 2) ) sVal.FormatVal(item.m_dz);
else if ( !strnicmp(pszKey, "D", 1) ) sVal.Format("%i,%i,%i", item.m_dx, item.m_dy, item.m_dz);
else sVal.Format("%i,%i,%i,%i", item.m_id, item.m_dx, item.m_dy, item.m_dz);
}
else return false;
return true;
}
return( CItem::r_WriteVal(pszKey, sVal, pSrc));
}
示例4: r_WriteValContainer
bool CContainer::r_WriteValContainer(LPCTSTR pszKey, CGString & sVal, CTextConsole *pSrc)
{
ADDTOCALLSTACK("CContainer::r_WriteValContainer");
EXC_TRY("WriteVal");
static LPCTSTR const sm_szParams[] =
{
"count",
"fcount",
"rescount",
"restest"
};
int i = FindTableHeadSorted(pszKey, sm_szParams, COUNTOF(sm_szParams));
if ( i < 0 )
return false;
LPCTSTR pKey = pszKey + strlen(sm_szParams[i]);
SKIP_SEPARATORS(pKey);
switch ( i )
{
case 0: // count
{
int iTotal = 0;
for ( CItem* pItem = GetContentHead(); pItem != NULL; pItem = pItem->GetNext() )
iTotal++;
sVal.FormatVal(iTotal);
} break;
case 1: // fcount
sVal.FormatVal(ContentCountAll());
break;
case 2: // rescount
sVal.FormatVal(*pKey ? ContentCount(g_Cfg.ResourceGetID(RES_ITEMDEF, pKey)) : GetCount());
break;
case 3: // restest
{
CResourceQtyArray Resources;
sVal.FormatVal(Resources.Load(pKey) ? ResourceConsume(&Resources, 1, true) : 0);
} break;
default:
return false;
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_KEYRET(pSrc);
EXC_DEBUG_END;
return false;
}
示例5: r_WriteVal
bool CItemMessage::r_WriteVal( LPCTSTR pszKey, CGString &sVal, CTextConsole * pSrc )
{
EXC_TRY(("r_WriteVal('%s',,%x)", pszKey, pSrc));
// Load the message body for a book or a bboard message.
if ( ! strnicmp( pszKey, "BODY", 4 ))
{
pszKey += 4;
int iPage = Exp_GetVal(pszKey);
if ( iPage < 0 || iPage >= m_sBodyLines.GetCount())
return( false );
sVal = *m_sBodyLines[iPage];
return( true );
}
switch ( FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case CIC_AUTHOR:
sVal = m_sAuthor;
return( true );
case CIC_BODY: // handled above.
return( false );
case CIC_PAGES: // not settable. (used for resource stuff)
sVal.FormatVal( m_sBodyLines.GetCount());
return( true );
case CIC_TITLE:
sVal = GetName();
return( true );
}
return CItemVendable::r_WriteVal(pszKey, sVal, pSrc);
EXC_CATCH("CItemMessage");
return false;
}
示例6: r_WriteVal
bool CSkillClassDef::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CSkillClassDef::r_WriteVal");
EXC_TRY("WriteVal");
switch ( FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case SCC_NAME: // "NAME"
sVal = m_sName;
break;
case SCC_SKILLSUM:
sVal.FormatVal( m_SkillSumMax );
break;
case SCC_STATSUM:
sVal.FormatVal( m_StatSumMax );
break;
default:
{
int i = g_Cfg.FindSkillKey( pszKey);
if ( i != SKILL_NONE )
{
ASSERT( i >= 0 && static_cast<size_t>(i) < COUNTOF(m_SkillLevelMax));
sVal.FormatVal( m_SkillLevelMax[i] );
break;
}
i = g_Cfg.FindStatKey( pszKey);
if ( i >= 0 )
{
ASSERT( static_cast<size_t>(i) < COUNTOF(m_StatMax));
sVal.FormatVal( m_StatMax[i] );
break;
}
}
return( CResourceDef::r_WriteVal( pszKey, sVal, pSrc ));
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_KEYRET(pSrc);
EXC_DEBUG_END;
return false;
}
示例7: r_WriteVal
bool CItemVendable::r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc)
{
ADDTOCALLSTACK("CItemVendable::r_WriteVal");
EXC_TRY("WriteVal");
switch ( FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case IVC_PRICE: // PRICE
sVal.FormatVal( m_price );
return true;
case IVC_QUALITY: // QUALITY
sVal.FormatVal( GetQuality());
return true;
default:
return CItem::r_WriteVal( pszKey, sVal, pSrc );
}
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_KEYRET(pSrc);
EXC_DEBUG_END;
return false;
}
示例8: r_WriteVal
bool CRegionWorld::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CRegionWorld::r_WriteVal");
EXC_TRY("WriteVal");
//bool fZero = false;
switch ( FindTableHeadSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case RWC_DEFNAME: // "DEFNAME" = for the speech system.
sVal = GetResourceName();
break;
case RWC_RESOURCES:
m_Events.WriteResourceRefList( sVal );
break;
case RWC_REGION:
{
// Check that the syntax is correct.
if ( pszKey[6] && pszKey[6] != '.' )
return false;
CRegionWorld * pRegionTemp = dynamic_cast <CRegionWorld*>(m_pt.GetRegion( REGION_TYPE_AREA ));
if ( !pszKey[6] )
{
// We're just checking if the reference is valid.
sVal.FormatVal( pRegionTemp? 1:0 );
return true;
}
// ELSE - We're trying to retrieve a property from the region.
pszKey += 7;
if ( pRegionTemp && m_pt.GetRegion( REGION_TYPE_MULTI ) )
return pRegionTemp->r_WriteVal( pszKey, sVal, pSrc );
return( this->r_WriteVal( pszKey, sVal, pSrc ));
}
default:
return( CRegionBase::r_WriteVal( pszKey, sVal, pSrc ));
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
g_Log.EventDebug("command '%s' ret '%s' [%p]\n", pszKey, static_cast<LPCTSTR>(sVal), static_cast<void *>(pSrc));
EXC_DEBUG_END;
return false;
}
示例9: r_WriteVal
bool CStoneMember::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CStoneMember::r_WriteVal");
EXC_TRY("WriteVal");
STMM_TYPE iIndex = (STMM_TYPE) FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 );
if ( GetLinkUID().IsChar() )
{
switch ( iIndex )
{
case STMM_ACCOUNTGOLD:
sVal.FormatVal(GetAccountGold());
break;
case STMM_ISMASTER:
sVal.FormatVal(IsPrivMaster());
break;
case STMM_ISMEMBER:
sVal.FormatVal(IsPrivMember());
break;
case STMM_LOYALTO:
sVal.FormatHex(GetLoyalToUID());
break;
case STMM_PRIV:
sVal.FormatVal(GetPriv());
break;
case STMM_PRIVNAME:
sVal = GetPrivName();
break;
case STMM_TITLE:
sVal = GetTitle();
break;
case STMM_SHOWABBREV:
sVal.FormatVal(IsAbbrevOn());
break;
case STMM_ISCANDIDATE:
sVal.FormatVal((GetPriv() == STONEPRIV_CANDIDATE) ? 1 : 0);
break;
default:
{
CScriptObj *pRef = GetLinkUID().CharFind();
return pRef->r_WriteVal(pszKey,sVal,pSrc);
}
}
}
else if ( GetLinkUID().IsItem() )
{
switch ( iIndex )
{
case STMM_GUILD_ISENEMY:
sVal.FormatVal(GetWeDeclared() && GetTheyDeclared());
break;
case STMM_GUILD_THEYWAR:
sVal.FormatVal(GetTheyDeclared());
break;
case STMM_GUILD_WEWAR:
sVal.FormatVal(GetWeDeclared());
break;
case STMM_GUILD_WEALLIANCE:
sVal.FormatVal(0);
break;
case STMM_GUILD_THEYALLIANCE:
sVal.FormatVal(0);
break;
default:
{
CScriptObj *pRef = GetLinkUID().ItemFind();
return pRef->r_WriteVal(pszKey,sVal,pSrc);
}
}
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
EXC_ADD_KEYRET(pSrc);
EXC_DEBUG_END;
return false;
}
示例10: r_WriteVal
bool CDataBase::r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc)
{
ADDTOCALLSTACK("CDataBase::r_WriteVal");
EXC_TRY("WriteVal");
if ( !g_Cfg.m_bMySql )
{
sVal.FormatVal(0);
return true;
}
int index = FindTableHeadSorted(pszKey, sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1);
switch ( index )
{
case DBO_AEXECUTE:
case DBO_AQUERY:
{
pszKey += strlen(sm_szLoadKeys[index]);
GETNONWHITESPACE(pszKey);
TCHAR *ppArgs[2];
if ( (pszKey[0] != '\0') && (Str_ParseCmds(const_cast<TCHAR *>(pszKey), ppArgs, COUNTOF(ppArgs)) == 2) )
sVal.FormatVal(AsyncQueue((index == DBO_AQUERY), ppArgs[0], ppArgs[1]));
else
{
g_Log.EventError("Invalid %s arguments\n", CDataBase::sm_szLoadKeys[index]);
sVal.FormatVal(0);
}
break;
}
case DBO_CONNECTED:
{
sVal.FormatVal(m_connected);
break;
}
case DBO_ESCAPEDATA:
{
pszKey += strlen(sm_szLoadKeys[index]);
GETNONWHITESPACE(pszKey);
sVal = "";
if ( pszKey[0] != '\0' )
{
TCHAR *escapedString = Str_GetTemp();
SimpleThreadLock lock(m_connectionMutex);
if ( m_connected && mysql_real_escape_string(m_socket, escapedString, pszKey, static_cast<unsigned long>(strlen(pszKey))) )
sVal = escapedString;
}
break;
}
case DBO_ROW:
{
pszKey += strlen(sm_szLoadKeys[index]);
SKIP_SEPARATORS(pszKey);
sVal = m_QueryResult.GetKeyStr(pszKey);
break;
}
default:
return false;
}
return true;
EXC_CATCH;
EXC_DEBUG_START;
g_Log.EventDebug("command '%s' [%p]\n", pszKey, static_cast<void *>(pSrc));
EXC_DEBUG_END;
return false;
}
示例11: r_WriteVal
//.........这里部分代码省略.........
}
} break;
case OBC_DAM:
{
pszKey += strlen(sm_szLoadKeys[index]); // 9;
if ( *pszKey == '.' )
{
SKIP_SEPARATORS( pszKey );
if ( !strnicmp( pszKey, "LO", 2 ) )
{
sVal.Format( "%d", m_attackBase );
}
else if ( !strnicmp( pszKey, "HI", 2 ) )
{
sVal.Format( "%d", m_attackBase+m_attackRange );
}
}
else
{
sVal.Format( "%d,%d", m_attackBase, m_attackBase+m_attackRange );
}
} break;
case OBC_BASEID:
sVal = g_Cfg.ResourceGetName( GetResourceID());
break;
case OBC_CAN:
sVal.FormatHex( m_Can );
break;
case OBC_HEIGHT:
{
//CBaseBaseDef * pBaseBaseDef = dynamic_cast<CBaseBaseDef*>(this);
//DEBUG_ERR(("OBC_HEIGHT - m_dwDispIndex %d GetHeight() %d pBaseBaseDef->GetHeight() %d pBaseBaseDef 0x%x\n",m_wDispIndex,GetHeight(),pBaseBaseDef->GetHeight(),pBaseBaseDef));
sVal.FormatVal( GetHeight() );
}
break;
case OBC_INSTANCES:
sVal.FormatVal( GetRefInstances());
break;
case OBC_NAME:
sVal = GetName();
break;
case OBC_RANGE:
if ( RangeH() == 0 ) sVal.Format( "%d", RangeL() );
else sVal.Format( "%d,%d", RangeH(), RangeL() );
break;
case OBC_RANGEL: // internally: rangel seems to be Range Highest value
sVal.FormatVal( RangeH() );
break;
case OBC_RANGEH: // but rangeh seems to be the Range Lowest value.
sVal.FormatVal( RangeL() );
break;
case OBC_RESOURCES: // Print the resources
{
pszKey += strlen(sm_szLoadKeys[index]); // 9;
if ( *pszKey == '.' )
{
SKIP_SEPARATORS( pszKey );
if ( !strnicmp( pszKey, "COUNT", 5 ))
{
sVal.FormatVal(m_BaseResources.GetCount());
}
else
示例12: r_WriteVal
bool CServerDef::r_WriteVal( LPCTSTR pszKey, CGString &sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CServerDef::r_WriteVal");
EXC_TRY("WriteVal");
switch ( FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 ))
{
case SC_ACCAPP:
sVal.FormatVal( m_eAccApp );
break;
case SC_ACCAPPS:
// enum string
ASSERT( m_eAccApp >= 0 && m_eAccApp < ACCAPP_QTY );
sVal = sm_AccAppTable[ m_eAccApp ];
break;
case SC_ADMINEMAIL:
sVal = m_sEMail;
break;
case SC_AGE:
// display the age in days.
sVal.FormatLLVal( GetAgeHours()/24 );
break;
case SC_CLIENTVERSION:
{
TCHAR szVersion[ 128 ];
sVal = m_ClientVersion.WriteClientVer( szVersion );
}
break;
case SC_CREATE:
sVal.FormatLLVal( -( g_World.GetTimeDiff(m_timeCreate) / TICK_PER_SEC ));
break;
case SC_LANG:
sVal = m_sLang;
break;
case SC_LASTVALIDDATE:
if ( m_timeLastValid.IsTimeValid() )
sVal.FormatLLVal( GetTimeSinceLastValid() / ( TICK_PER_SEC * 60 ));
else
sVal = "NA";
break;
case SC_LASTVALIDTIME:
// How many seconds ago.
sVal.FormatLLVal( m_timeLastValid.IsTimeValid() ? ( GetTimeSinceLastValid() / TICK_PER_SEC ) : -1 );
break;
case SC_SERVIP:
sVal = m_ip.GetAddrStr();
break;
case SC_NAME:
case SC_SERVNAME:
sVal = GetName(); // What the name should be. Fill in from ping.
break;
case SC_SERVPORT:
sVal.FormatVal( m_ip.GetPort());
break;
case SC_ACCOUNTS:
sVal.FormatVal( StatGet( SERV_STAT_ACCOUNTS ));
break;
case SC_CLIENTS:
sVal.FormatVal( StatGet( SERV_STAT_CLIENTS ));
break;
case SC_ITEMS:
sVal.FormatVal( StatGet( SERV_STAT_ITEMS ));
break;
case SC_MEM:
sVal.FormatVal( StatGet( SERV_STAT_MEM ) );
break;
case SC_CHARS:
sVal.FormatVal( StatGet( SERV_STAT_CHARS ));
break;
case SC_TIMEZONE:
sVal.FormatVal( m_TimeZone );
break;
case SC_URL:
sVal = m_sURL;
break;
case SC_URLLINK:
// try to make a link of it.
if ( m_sURL.IsEmpty())
{
sVal = GetName();
break;
}
sVal.Format("<a href=\"http://%s\">%s</a>", static_cast<LPCTSTR>(m_sURL), GetName());
break;
case SC_VERSION:
sVal = GRAY_VERSION;
break;
default:
{
LPCTSTR pszArgs = strchr(pszKey, ' ');
if (pszArgs != NULL)
GETNONWHITESPACE(pszArgs);
CScriptTriggerArgs Args( pszArgs ? pszArgs : "" );
if ( r_Call( pszKey, pSrc, &Args, &sVal ) )
return true;
return( CScriptObj::r_WriteVal( pszKey, sVal, pSrc ));
}
}
//.........这里部分代码省略.........
示例13: r_WriteVal
bool CPartyDef::r_WriteVal( LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc )
{
ADDTOCALLSTACK("CPartyDef::r_WriteVal");
EXC_TRY("WriteVal");
CScriptObj *pRef;
if ( r_GetRef(pszKey, pRef) )
{
if ( pRef == NULL ) // good command but bad link.
{
sVal = "0";
return true;
}
if ( pszKey[0] == '\0' ) // we where just testing the ref.
{
CObjBase *pObj = dynamic_cast<CObjBase *>(pRef);
if ( pObj )
sVal.FormatHex(static_cast<DWORD>(pObj->GetUID()));
else
sVal.FormatVal(1);
return true;
}
return pRef->r_WriteVal(pszKey, sVal, pSrc);
}
bool fZero = false;
switch ( FindTableHeadSorted(pszKey, sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1) )
{
case PDC_ISSAMEPARTYOF:
{
pszKey += 13;
GETNONWHITESPACE(pszKey);
if ( pszKey[0] != '\0' )
{
CGrayUID uidToCheck = static_cast<CGrayUID>(Exp_GetVal(pszKey));
CChar *pCharToCheck = uidToCheck.CharFind();
sVal.FormatVal(pCharToCheck && (pCharToCheck->m_pParty == this));
}
else
return false;
} break;
case PDC_MEMBERS:
sVal.FormatVal(m_Chars.GetCharCount());
break;
case PDC_SPEECHFILTER:
sVal = m_pSpeechFunction.IsEmpty() ? "" : m_pSpeechFunction;
break;
case PDC_TAG0:
fZero = true;
pszKey++;
case PDC_TAG:
{
if ( pszKey[3] != '.' )
return false;
pszKey += 4;
sVal = m_TagDefs.GetKeyStr(pszKey, fZero);
} break;
case PDC_TAGAT:
{
pszKey += 5; // eat the 'TAGAT'
if ( *pszKey == '.' ) // do we have an argument?
{
SKIP_SEPARATORS(pszKey);
size_t iQty = static_cast<size_t>(Exp_GetVal(pszKey));
if ( iQty >= m_TagDefs.GetCount() )
return false; // trying to get non-existant tag
CVarDefCont *pTagAt = m_TagDefs.GetAt(iQty);
if ( !pTagAt )
return false; // trying to get non-existant tag
SKIP_SEPARATORS(pszKey);
if ( !*pszKey )
{
sVal.Format("%s=%s", pTagAt->GetKey(), pTagAt->GetValStr());
return true;
}
else if ( !strnicmp(pszKey, "KEY", 3) )
{
sVal = pTagAt->GetKey();
return true;
}
else if ( !strnicmp(pszKey, "VAL", 3) )
{
sVal = pTagAt->GetValStr();
return true;
}
}
return false;
}
case PDC_TAGCOUNT:
sVal.FormatVal(m_TagDefs.GetCount());
break;
//.........这里部分代码省略.........
示例14: r_WriteVal
bool CPointBase::r_WriteVal( LPCTSTR pszKey, CGString & sVal ) const
{
ADDTOCALLSTACK("CPointBase::r_WriteVal");
if ( !strnicmp( pszKey, "STATICS", 7 ) )
{
pszKey += 7;
const CGrayMapBlock * pBlock = g_World.GetMapBlock( *(this) );
if ( !pBlock ) return false;
if ( *pszKey == '\0' )
{
int iStaticQty = 0;
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); i++ )
{
const CUOStaticItemRec * pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map );
if ( this->GetDist( ptTest ) > 0 )
continue;
iStaticQty++;
}
sVal.FormatVal( iStaticQty );
return true;
}
SKIP_SEPARATORS( pszKey );
const CUOStaticItemRec * pStatic = NULL;
int iStatic = 0;
int type = 0;
if ( !strnicmp( pszKey, "FINDID", 6 ) )
{
pszKey += 6;
SKIP_SEPARATORS( pszKey );
iStatic = Exp_GetVal( pszKey );
type = RES_GET_TYPE( iStatic );
if ( type == 0 )
type = RES_ITEMDEF;
SKIP_SEPARATORS( pszKey );
}
else
{
iStatic = Exp_GetVal( pszKey );
type = RES_GET_TYPE( iStatic );
}
if ( type == RES_ITEMDEF )
{
const CItemBase * pItemDef = CItemBase::FindItemBase(static_cast<ITEMID_TYPE>(RES_GET_INDEX(iStatic)));
if ( !pItemDef )
{
sVal.FormatVal( 0 );
return false;
}
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); pStatic = NULL, i++ )
{
pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map);
if ( this->GetDist( ptTest ) > 0 )
continue;
if ( pStatic->GetDispID() == pItemDef->GetDispID() )
break;
}
}
else
{
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); pStatic = NULL, i++ )
{
pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map);
if ( this->GetDist( ptTest ) > 0 )
continue;
if ( iStatic == 0 )
break;
iStatic--;
}
}
if ( !pStatic )
{
sVal.FormatHex(0);
return true;
}
SKIP_SEPARATORS( pszKey );
if ( !*pszKey )
pszKey = "ID";
ITEMID_TYPE idTile = pStatic->GetDispID();
if ( !strnicmp( pszKey, "COLOR", 5 ) )
{
sVal.FormatHex( pStatic->m_wHue );
return true;
}
else if ( !strnicmp( pszKey, "ID", 2 ) )
{
sVal.FormatHex( idTile );
return true;
//.........这里部分代码省略.........
示例15: r_WriteVal
bool CClient::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CClient::r_WriteVal");
EXC_TRY("WriteVal");
int index;
if ( !strnicmp("CTAG.", pszKey, 5) ) // CTAG.xxx - client tag
{
if ( pszKey[4] != '.' )
return( false );
pszKey += 5;
CVarDefCont *vardef = m_TagDefs.GetKey(pszKey);
sVal = vardef ? vardef->GetValStr() : "";
return true;
}
if ( !strnicmp("CTAG0.", pszKey, 6) ) // CTAG0.xxx - client tag
{
if ( pszKey[5] != '.' )
return( false );
pszKey += 6;
CVarDefCont *vardef = m_TagDefs.GetKey(pszKey);
sVal = vardef ? vardef->GetValStr() : "0";
return true;
}
if ( !strnicmp( "TARGP", pszKey, 5 ) && ( pszKey[5] == '\0' || pszKey[5] == '.' ) )
index = CC_TARGP;
else if ( !strnicmp( "SCREENSIZE", pszKey, 10 ) && ( pszKey[10] == '\0' || pszKey[10] == '.' ) )
index = CC_SCREENSIZE;
else if ( !strnicmp( "REPORTEDCLIVER", pszKey, 14 ) && ( pszKey[14] == '\0' || pszKey[14] == '.' ) )
index = CC_REPORTEDCLIVER;
else
index = FindTableSorted( pszKey, sm_szLoadKeys, COUNTOF(sm_szLoadKeys)-1 );
switch (index)
{
case CC_ALLMOVE:
sVal.FormatVal( IsPriv( PRIV_ALLMOVE ));
break;
case CC_ALLSHOW:
sVal.FormatVal( IsPriv( PRIV_ALLSHOW ));
break;
case CC_CLIENTIS3D:
sVal.FormatVal( GetNetState()->isClient3D() );
break;
case CC_CLIENTISKR:
sVal.FormatVal( GetNetState()->isClientKR() );
break;
case CC_CLIENTISSA:
sVal.FormatVal( GetNetState()->isClientSA() );
break;
case CC_CLIENTVERSION:
{
TCHAR szVersion[ 128 ];
sVal = m_Crypt.WriteClientVer( szVersion );
}
break;
case CC_DEBUG:
sVal.FormatVal( IsPriv( PRIV_DEBUG ));
break;
case CC_DETAIL:
sVal.FormatVal( IsPriv( PRIV_DETAIL ));
break;
case CC_GM: // toggle your GM status on/off
sVal.FormatVal( IsPriv( PRIV_GM ));
break;
case CC_HEARALL:
sVal.FormatVal( IsPriv( PRIV_HEARALL ));
break;
case CC_LASTEVENT:
sVal.FormatLLVal( m_timeLastEvent.GetTimeRaw() );
break;
case CC_PRIVSHOW:
// Show my priv title.
sVal.FormatVal( ! IsPriv( PRIV_PRIV_NOSHOW ));
break;
case CC_REPORTEDCLIVER:
{
pszKey += strlen(sm_szLoadKeys[index]);
GETNONWHITESPACE( pszKey );
int iCliVer = (GetNetState()->getReportedVersion() & 0xFFFFFF0);
if ( pszKey[0] != '\0' )
iCliVer = GetNetState()->getReportedVersion();
TCHAR szVersion[128];
sVal = CCrypt::WriteClientVerString( iCliVer, szVersion );
}
break;
case CC_SCREENSIZE:
{
if ( pszKey[10] == '.' )
{
pszKey += strlen(sm_szLoadKeys[index]);
SKIP_SEPARATORS(pszKey);
if ( !strnicmp("X", pszKey, 1) )
sVal.Format( "%lu", m_ScreenSize.x );
else if ( !strnicmp("Y", pszKey, 1) )
//.........这里部分代码省略.........