本文整理汇总了C++中LPITEM::SetSocket方法的典型用法代码示例。如果您正苦于以下问题:C++ LPITEM::SetSocket方法的具体用法?C++ LPITEM::SetSocket怎么用?C++ LPITEM::SetSocket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPITEM
的用法示例。
在下文中一共展示了LPITEM::SetSocket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DragonSoul_Initialize
// 캐릭터의 affect, quest가 load 되기 전에 DragonSoul_Initialize를 호출하면 안된다.
// affect가 가장 마지막에 로드되어 LoadAffect에서 호출함.
void CHARACTER::DragonSoul_Initialize()
{
for (int i = INVENTORY_MAX_NUM + WEAR_MAX_NUM; i < DRAGON_SOUL_EQUIP_SLOT_END; i++)
{
LPITEM pItem = GetItem(TItemPos(INVENTORY, i));
if (NULL != pItem)
pItem->SetSocket(ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX, 0);
}
if (FindAffect(AFFECT_DRAGON_SOUL_DECK_0))
{
DragonSoul_ActivateDeck(DRAGON_SOUL_DECK_0);
}
else if (FindAffect(AFFECT_DRAGON_SOUL_DECK_1))
{
DragonSoul_ActivateDeck(DRAGON_SOUL_DECK_1);
}
}
示例2: ExtractDragonHeart
// їлИҐј®А» №ЮѕЖј їлЅЙА» ГЯГвЗПґВ ЗФјц
bool DSManager::ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtractor)
{
if (NULL == ch || NULL == pItem)
return false;
if (pItem->IsEquipped())
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Вшїл БЯАО їлИҐј®Ає ГЯГвЗТ јц ѕшЅАґПґЩ."));
return false;
}
DWORD dwVnum = pItem->GetVnum();
BYTE ds_type, grade_idx, step_idx, strength_idx;
GetDragonSoulInfo(dwVnum, ds_type, grade_idx, step_idx, strength_idx);
int iBonus = 0;
if (NULL != pExtractor)
{
iBonus = pExtractor->GetValue(0);
}
std::vector <float> vec_chargings;
std::vector <float> vec_probs;
if (!m_pTable->GetDragonHeartExtValues(ds_type, grade_idx, vec_chargings, vec_probs))
{
return false;
}
int idx = Gamble(vec_probs);
float sum = 0.f;
if (-1 == idx)
{
sys_err ("Gamble is failed. ds_type(%d), grade_idx(%d)", ds_type, grade_idx);
return false;
}
float fCharge = vec_chargings[idx] * (100 + iBonus) / 100.f;
fCharge = std::MINMAX <float> (0.f, fCharge, 100.f);
if (fCharge < FLT_EPSILON)
{
pItem->SetCount(pItem->GetCount() - 1);
if (NULL != pExtractor)
{
pExtractor->SetCount(pExtractor->GetCount() - 1);
}
LogManager::instance().ItemLog(ch, pItem, "DS_HEART_EXTRACT_FAIL", "");
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлЅЙ ГЯГвїЎ ЅЗЖРЗПїґЅАґПґЩ."));
return false;
}
else
{
LPITEM pDH = ITEM_MANAGER::instance().CreateItem(DRAGON_HEART_VNUM);
if (NULL == pDH)
{
sys_err ("Cannot create DRAGON_HEART(%d).", DRAGON_HEART_VNUM);
return NULL;
}
pItem->SetCount(pItem->GetCount() - 1);
if (NULL != pExtractor)
{
pExtractor->SetCount(pExtractor->GetCount() - 1);
}
int iCharge = (int)(fCharge + 0.5f);
pDH->SetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX, iCharge);
ch->AutoGiveItem(pDH, true);
std::string s = boost::lexical_cast <std::string> (iCharge);
s += "%s";
LogManager::instance().ItemLog(ch, pItem, "DS_HEART_EXTRACT_SUCCESS", s.c_str());
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлЅЙ ГЯГвїЎ јє°шЗПїґЅАґПґЩ."));
return true;
}
}