本文整理汇总了C++中CItemContainer::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemContainer::GetCount方法的具体用法?C++ CItemContainer::GetCount怎么用?C++ CItemContainer::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemContainer
的用法示例。
在下文中一共展示了CItemContainer::GetCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NPC_OnHearPetCmd
//.........这里部分代码省略.........
}
case PC_DROP_ALL:
DropAll(NULL, ATTR_OWNED);
break;
case PC_SPEAK:
NPC_OnPetCommand(true, pSrc);
return true;
case PC_EQUIP:
ItemEquipWeapon(false);
ItemEquipArmor(false);
break;
case PC_STATUS:
{
if ( !NPC_CanSpeak() )
break;
unsigned int iWage = pCharDef->GetHireDayWage();
CItemContainer *pBank = GetBank();
TCHAR *pszMsg = Str_GetTemp();
if ( NPC_IsVendor() )
{
CItemContainer *pCont = GetBank(LAYER_VENDOR_STOCK);
TCHAR *pszTemp1 = Str_GetTemp();
TCHAR *pszTemp2 = Str_GetTemp();
TCHAR *pszTemp3 = Str_GetTemp();
if ( iWage )
{
sprintf(pszTemp1, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_1), pBank->m_itEqBankBox.m_Check_Amount);
sprintf(pszTemp2, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_2), pBank->m_itEqBankBox.m_Check_Amount / iWage);
sprintf(pszTemp3, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_3), static_cast<int>(pCont->GetCount()));
}
else
{
sprintf(pszTemp1, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_1), pBank->m_itEqBankBox.m_Check_Amount);
sprintf(pszTemp2, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_4), pBank->m_itEqBankBox.m_Check_Restock, pBank->GetTimerAdjusted() / 60);
sprintf(pszTemp3, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_3), static_cast<int>(pCont->GetCount()));
}
sprintf(pszMsg, "%s %s %s", pszTemp1, pszTemp2, pszTemp3);
}
else if ( iWage )
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_DAYS_LEFT), pBank->m_itEqBankBox.m_Check_Amount / iWage);
}
Speak(pszMsg);
return true;
}
case PC_CASH:
{
// Give up my cash total.
if ( !NPC_IsVendor() )
return false;
CItemContainer *pBank = GetBank();
if ( pBank )
{
unsigned int iWage = pCharDef->GetHireDayWage();
TCHAR *pszMsg = Str_GetTemp();
if ( pBank->m_itEqBankBox.m_Check_Amount > iWage )
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_GETGOLD_1), pBank->m_itEqBankBox.m_Check_Amount - iWage);
pSrc->AddGoldToPack(pBank->m_itEqBankBox.m_Check_Amount - iWage);
示例2: NPC_StablePetSelect
bool CChar::NPC_StablePetSelect( CChar * pCharPlayer )
{
ADDTOCALLSTACK("CChar::NPC_StablePetSelect");
// I am a stable master.
// I will stable a pet for the player.
if ( pCharPlayer == NULL )
return false;
if ( ! pCharPlayer->IsClient())
return false;
// Might have too many pets already ?
int iCount = 0;
CItemContainer * pBank = GetBank();
if ( pBank->GetCount() >= MAX_ITEMS_CONT )
{
Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_FULL ) );
return false;
}
// Calculate the max limit of pets that the NPC can hold for the player
double iSkillTaming = pCharPlayer->Skill_GetAdjusted(SKILL_TAMING);
double iSkillAnimalLore = pCharPlayer->Skill_GetAdjusted(SKILL_ANIMALLORE);
double iSkillVeterinary = pCharPlayer->Skill_GetAdjusted(SKILL_VETERINARY);
double iSkillSum = iSkillTaming + iSkillAnimalLore + iSkillVeterinary;
int iPetMax;
if ( iSkillSum >= 240.0 )
iPetMax = 5;
else if ( iSkillSum >= 200.0 )
iPetMax = 4;
else if ( iSkillSum >= 160.0 )
iPetMax = 3;
else
iPetMax = 2;
if ( iSkillTaming >= 100.0 )
iPetMax += (int)((iSkillTaming - 90.0) / 10);
if ( iSkillAnimalLore >= 100.0 )
iPetMax += (int)((iSkillAnimalLore - 90.0) / 10);
if ( iSkillVeterinary >= 100.0 )
iPetMax += (int)((iSkillVeterinary - 90.0) / 10);
if ( m_TagDefs.GetKey("MAXPLAYERPETS") )
iPetMax = (int)(m_TagDefs.GetKeyNum("MAXPLAYERPETS"));
for ( CItem *pItem = pBank->GetContentHead(); pItem != NULL; pItem = pItem->GetNext() )
{
if ( pItem->IsType(IT_FIGURINE) && pItem->m_uidLink == pCharPlayer->GetUID() )
iCount++;
}
if ( iCount >= iPetMax )
{
Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_TOOMANY ) );
return false;
}
pCharPlayer->m_pClient->m_Targ_PrvUID = GetUID();
pCharPlayer->m_pClient->addTarget( CLIMODE_TARG_PET_STABLE, g_Cfg.GetDefaultMsg( DEFMSG_NPC_STABLEMASTER_TARG ) );
return true;
}
示例3: NPC_OnHearPetCmd
//.........这里部分代码省略.........
return true;
}
case PC_DROP_ALL:
DropAll(NULL, ATTR_OWNED);
break;
case PC_SPEAK:
NPC_PetConfirmCommand(true, pSrc);
return true;
case PC_EQUIP:
ItemEquipWeapon(false);
ItemEquipArmor(false);
break;
case PC_STATUS:
{
if ( !NPC_CanSpeak() )
break;
CItemContainer *pBank = GetContainerCreate(LAYER_BANKBOX);
TCHAR *pszMsg = Str_GetTemp();
if ( NPC_IsVendor() )
{
CItemContainer *pCont = GetContainerCreate(LAYER_VENDOR_STOCK);
TCHAR *pszTemp1 = Str_GetTemp();
TCHAR *pszTemp2 = Str_GetTemp();
TCHAR *pszTemp3 = Str_GetTemp();
if ( pCharDef->m_iHireDayWage )
{
sprintf(pszTemp1, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_1), pBank->m_itEqBankBox.m_Check_Amount);
sprintf(pszTemp2, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_2), pBank->m_itEqBankBox.m_Check_Amount / pCharDef->m_iHireDayWage);
sprintf(pszTemp3, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_3), static_cast<int>(pCont->GetCount()));
}
else
{
sprintf(pszTemp1, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_1), pBank->m_itEqBankBox.m_Check_Amount);
sprintf(pszTemp2, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_4), pBank->m_itEqBankBox.m_Check_Restock, pBank->GetTimerAdjusted() / 60);
sprintf(pszTemp3, g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_STAT_GOLD_3), static_cast<int>(pCont->GetCount()));
}
sprintf(pszMsg, "%s %s %s", pszTemp1, pszTemp2, pszTemp3);
}
else if ( pCharDef->m_iHireDayWage )
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_DAYS_LEFT), pBank->m_itEqBankBox.m_Check_Amount / pCharDef->m_iHireDayWage);
}
Speak(pszMsg);
return true;
}
case PC_CASH:
{
// Give up my cash total.
if ( !NPC_IsVendor() )
return false;
CItemContainer *pBank = GetContainerCreate(LAYER_BANKBOX);
if ( pBank )
{
TCHAR *pszMsg = Str_GetTemp();
if ( pBank->m_itEqBankBox.m_Check_Amount > pCharDef->m_iHireDayWage )
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_GETGOLD_1), pBank->m_itEqBankBox.m_Check_Amount - pCharDef->m_iHireDayWage);
pSrc->AddGoldToPack(pBank->m_itEqBankBox.m_Check_Amount - pCharDef->m_iHireDayWage);
pBank->m_itEqBankBox.m_Check_Amount = pCharDef->m_iHireDayWage;