本文整理汇总了C++中LPITEM::IsDragonSoul方法的典型用法代码示例。如果您正苦于以下问题:C++ LPITEM::IsDragonSoul方法的具体用法?C++ LPITEM::IsDragonSoul怎么用?C++ LPITEM::IsDragonSoul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPITEM
的用法示例。
在下文中一共展示了LPITEM::IsDragonSoul方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DragonSoulItemInitialize
bool DSManager::DragonSoulItemInitialize(LPITEM pItem)
{
if (NULL == pItem || !pItem->IsDragonSoul())
return false;
PutAttributes(pItem);
int time = DSManager::instance().GetDuration(pItem);
if (time > 0)
pItem->SetSocket(ITEM_SOCKET_REMAIN_SEC, time);
return true;
}
示例2: Buy
int CShopEx::Buy(LPCHARACTER ch, BYTE pos)
{
BYTE tabIdx = pos / SHOP_HOST_ITEM_MAX_NUM;
BYTE slotPos = pos % SHOP_HOST_ITEM_MAX_NUM;
if (tabIdx >= GetTabCount())
{
sys_log(0, "ShopEx::Buy : invalid position %d : %s", pos, ch->GetName());
return SHOP_SUBHEADER_GC_INVALID_POS;
}
sys_log(0, "ShopEx::Buy : name %s pos %d", ch->GetName(), pos);
GuestMapType::iterator it = m_map_guest.find(ch);
if (it == m_map_guest.end())
return SHOP_SUBHEADER_GC_END;
TShopTableEx& shopTab = m_vec_shopTabs[tabIdx];
TShopItemTable& r_item = shopTab.items[slotPos];
if (r_item.price <= 0)
{
LogManager::instance().HackLog("SHOP_BUY_GOLD_OVERFLOW", ch);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
}
DWORD dwPrice = r_item.price;
switch (shopTab.coinType)
{
case SHOP_COIN_TYPE_GOLD:
if (it->second) // if other empire, price is triple
dwPrice *= 3;
if (ch->GetGold() < (int) dwPrice)
{
sys_log(1, "ShopEx::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
}
break;
case SHOP_COIN_TYPE_SECONDARY_COIN:
{
int count = ch->CountSpecifyTypeItem(ITEM_SECONDARY_COIN);
if (count < dwPrice)
{
sys_log(1, "ShopEx::Buy : Not enough myeongdojun : %s has %d, price %d", ch->GetName(), count, dwPrice);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX;
}
}
break;
}
LPITEM item;
item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);
if (!item)
return SHOP_SUBHEADER_GC_SOLD_OUT;
int iEmptyPos;
if (item->IsDragonSoul())
{
iEmptyPos = ch->GetEmptyDragonSoulInventory(item);
}
else
{
iEmptyPos = ch->GetEmptyInventory(item->GetSize());
}
if (iEmptyPos < 0)
{
sys_log(1, "ShopEx::Buy : Inventory full : %s size %d", ch->GetName(), item->GetSize());
M2_DESTROY_ITEM(item);
return SHOP_SUBHEADER_GC_INVENTORY_FULL;
}
switch (shopTab.coinType)
{
case SHOP_COIN_TYPE_GOLD:
ch->PointChange(POINT_GOLD, -dwPrice, false);
break;
case SHOP_COIN_TYPE_SECONDARY_COIN:
ch->RemoveSpecifyTypeItem(ITEM_SECONDARY_COIN, dwPrice);
break;
}
if (item->IsDragonSoul())
item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
else
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
ITEM_MANAGER::instance().FlushDelayedSave(item);
LogManager::instance().ItemLog(ch, item, "BUY", item->GetName());
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
{
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), PERSONAL_SHOP_BUY, "");
}
//.........这里部分代码省略.........
示例3: DoRefineStrength
bool DSManager::DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE])
{
if (NULL == ch)
return false;
if (NULL == aItemPoses)
{
return false;
}
if (!ch->DragonSoul_RefineWindow_CanRefine())
{
sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName());
ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window.");
return false;
}
// И¤ЅГіЄ ёрё¦ БЯє№µЗґВ item pointer ѕшѕЦ±в А§ЗШј set »зїл
// АМ»уЗС ЖРЕ¶А» єёіѕ °жїм, БЯє№µИ TItemPos°Ў АЦА» јцµµ АЦ°н, АЯёшµИ TItemPos°Ў АЦА» јцµµ АЦґЩ.
std::set <LPITEM> set_items;
for (int i = 0; i < DRAGON_SOUL_REFINE_GRID_SIZE; i++)
{
LPITEM pItem = ch->GetItem(aItemPoses[i]);
if (pItem)
{
set_items.insert(pItem);
}
}
if (set_items.size() == 0)
{
return false;
}
int fee;
LPITEM pRefineStone = NULL;
LPITEM pDragonSoul = NULL;
for (std::set <LPITEM>::iterator it = set_items.begin(); it != set_items.end(); it++)
{
LPITEM pItem = *it;
// Е¬¶у uiїЎј АеВшЗС ѕЖАМЕЫАє °і·®ГўїЎ їГё± јц ѕшµµ·П ё·ѕТ±в ¶§№®їЎ,
// є°µµАЗ ѕЛёІ Гіё®ґВ ѕИЗФ.
if (pItem->IsEquipped())
{
return false;
}
// їлИҐј®°ъ °Иј®ёёАМ °і·®ГўїЎ АЦА» јц АЦґЩ.
// ±Чё®°н ЗПіЄѕїёё АЦѕоѕЯЗСґЩ.
if (pItem->IsDragonSoul())
{
if (pDragonSoul != NULL)
{
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
pDragonSoul = pItem;
}
else if(IsDragonSoulRefineMaterial(pItem))
{
if (pRefineStone != NULL)
{
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
pRefineStone = pItem;
}
else
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ИїЎ ЗКїдЗС Аз·б°Ў ѕЖґХґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
}
BYTE bType, bGrade, bStep, bStrength;
if (!pDragonSoul || !pRefineStone)
{
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL, NPOS);
return false;
}
if (NULL != pDragonSoul)
{
GetDragonSoulInfo(pDragonSoul->GetVnum(), bType, bGrade, bStep, bStrength);
float fWeight = 0.f;
// °ЎБЯДЎ °ЄАМ ѕшґЩёй °ИЗТ јц ѕшґВ їлИҐј®
if (!m_pTable->GetWeight(bType, bGrade, bStep, bStrength + 1, fWeight))
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ИЗТ јц ѕшґВ їлИҐј®АФґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE, TItemPos(pDragonSoul->GetWindow(), pDragonSoul->GetCell()));
return false;
}
// °ИЗЯА» ¶§ °ЎБЯДЎ°Ў 0АМ¶уёй ґх АМ»у °ИµЗјґВ ѕИµИґЩ.
if (fWeight < FLT_EPSILON)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ИЗТ јц ѕшґВ їлИҐј®АФґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE, TItemPos(pDragonSoul->GetWindow(), pDragonSoul->GetCell()));
//.........这里部分代码省略.........
示例4: DoRefineStep
bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_REFINE_GRID_SIZE])
{
if (NULL == ch)
return false;
if (NULL == aItemPoses)
{
return false;
}
if (!ch->DragonSoul_RefineWindow_CanRefine())
{
sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName());
ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window.");
return false;
}
// И¤ЅГіЄ ёрё¦ БЯє№µЗґВ item pointer ѕшѕЦ±в А§ЗШј set »зїл
// АМ»уЗС ЖРЕ¶А» єёіѕ °жїм, БЯє№µИ TItemPos°Ў АЦА» јцµµ АЦ°н, АЯёшµИ TItemPos°Ў АЦА» јцµµ АЦґЩ.
std::set <LPITEM> set_items;
for (int i = 0; i < DRAGON_SOUL_REFINE_GRID_SIZE; i++)
{
LPITEM pItem = ch->GetItem(aItemPoses[i]);
if (NULL != pItem)
{
// їлИҐј®АМ ѕЖґС ѕЖАМЕЫАМ °і·®ГўїЎ АЦА» јц ѕшґЩ.
if (!pItem->IsDragonSoul())
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ґЬ°и °і·®їЎ ЗКїдЗС Аз·б°Ў ѕЖґХґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
set_items.insert(pItem);
}
}
if (set_items.size() == 0)
{
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL, NPOS);
return false;
}
std::string stGroupName;
int count = set_items.size();
int need_count = 0;
int fee = 0;
std::vector <float> vec_probs;
BYTE ds_type, grade_idx, step_idx, strength_idx;
int result_step;
// °ЎАе ГіАЅ °НА» °ИАЗ ±вБШАё·О »пґВґЩ.
std::set <LPITEM>::iterator it = set_items.begin();
{
LPITEM pItem = *it;
GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx);
if (!m_pTable->GetRefineStepValues(ds_type, step_idx, need_count, fee, vec_probs))
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ґЬ°и °і·®ЗТ јц ѕшґВ їлИҐј®АФґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
}
while(++it != set_items.end())
{
LPITEM pItem = *it;
// Е¬¶у uiїЎј АеВшЗС ѕЖАМЕЫАє °і·®ГўїЎ їГё± јц ѕшµµ·П ё·ѕТ±в ¶§№®їЎ,
// є°µµАЗ ѕЛёІ Гіё®ґВ ѕИЗФ.
if (pItem->IsEquipped())
{
return false;
}
if (ds_type != GetType(pItem->GetVnum()) || grade_idx != GetGradeIdx(pItem->GetVnum()) || step_idx != GetStepIdx(pItem->GetVnum()))
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ґЬ°и °і·®їЎ ЗКїдЗС Аз·б°Ў ѕЖґХґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL, TItemPos(pItem->GetWindow(), pItem->GetCell()));
return false;
}
}
// Е¬¶уїЎј ЗС№ш °№јц ГјЕ©ё¦ ЗП±в ¶§№®їЎ count != need_count¶уёй invalid Е¬¶уАП °ЎґЙјєАМ Е©ґЩ.
if (count != need_count)
{
sys_err ("Possiblity of invalid client. Name %s", ch->GetName());
BYTE bSubHeader = count < need_count? DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL : DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL;
SendRefineResultPacket(ch, bSubHeader, NPOS);
return false;
}
if (ch->GetGold() < fee)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°і·®А» ЗП±в А§ЗС µ·АМ єОБ·ЗХґПґЩ."));
SendRefineResultPacket(ch, DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY, NPOS);
return false;
}
float sum = 0.f;
if (-1 == (result_step = Gamble(vec_probs)))
//.........这里部分代码省略.........
示例5: PutAttributes
bool DSManager::PutAttributes(LPITEM pDS)
{
if (!pDS->IsDragonSoul())
{
sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID());
return false;
}
BYTE ds_type, grade_idx, step_idx, strength_idx;
GetDragonSoulInfo(pDS->GetVnum(), ds_type, grade_idx, step_idx, strength_idx);
DragonSoulTable::TVecApplys vec_basic_applys;
DragonSoulTable::TVecApplys vec_addtional_applys;
if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys))
{
sys_err ("There is no BasicApply about %d type dragon soul.", ds_type);
return false;
}
if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys))
{
sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type);
return false;
}
int basic_apply_num, add_min, add_max;
if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max))
{
sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx);
return false;
}
float fWeight = 0.f;
if (!m_pTable->GetWeight(ds_type, grade_idx, step_idx, strength_idx, fWeight))
{
return false;
}
fWeight /= 100.f;
int n = MIN(basic_apply_num, vec_basic_applys.size());
for (int i = 0; i < n; i++)
{
const SApply& basic_apply = vec_basic_applys[i];
BYTE bType = basic_apply.apply_type;
short sValue = (short)(ceil((float)basic_apply.apply_value * fWeight - 0.01f));
pDS->SetForceAttribute(i, bType, sValue);
}
BYTE additional_attr_num = MIN(number (add_min, add_max), 3);
std::vector <int> random_set;
if (additional_attr_num > 0)
{
random_set.resize(additional_attr_num);
std::list <float> list_probs;
for (int i = 0; i < vec_addtional_applys.size(); i++)
{
list_probs.push_back(vec_addtional_applys[i].prob);
}
if (!MakeDistinctRandomNumberSet(list_probs, random_set))
{
sys_err ("MakeDistinctRandomNumberSet error.");
return false;
}
for (int i = 0; i < additional_attr_num; i++)
{
int r = random_set[i];
const SApply& additional_attr = vec_addtional_applys[r];
BYTE bType = additional_attr.apply_type;
short sValue = (short)(ceil((float)additional_attr.apply_value * fWeight - 0.01f));
pDS->SetForceAttribute(DRAGON_SOUL_ADDITIONAL_ATTR_START_IDX + i, bType, sValue);
}
}
return true;
}
示例6: RefreshItemAttributes
bool DSManager::RefreshItemAttributes(LPITEM pDS)
{
if (!pDS->IsDragonSoul())
{
sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID());
return false;
}
BYTE ds_type, grade_idx, step_idx, strength_idx;
GetDragonSoulInfo(pDS->GetVnum(), ds_type, grade_idx, step_idx, strength_idx);
DragonSoulTable::TVecApplys vec_basic_applys;
DragonSoulTable::TVecApplys vec_addtional_applys;
if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys))
{
sys_err ("There is no BasicApply about %d type dragon soul.", ds_type);
return false;
}
if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys))
{
sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type);
return false;
}
// add_min°ъ add_maxґВ ґх№М·О АРАЅ.
int basic_apply_num, add_min, add_max;
if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max))
{
sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx);
return false;
}
float fWeight = 0.f;
if (!m_pTable->GetWeight(ds_type, grade_idx, step_idx, strength_idx, fWeight))
{
return false;
}
fWeight /= 100.f;
int n = MIN(basic_apply_num, vec_basic_applys.size());
for (int i = 0; i < n; i++)
{
const SApply& basic_apply = vec_basic_applys[i];
BYTE bType = basic_apply.apply_type;
short sValue = (short)(ceil((float)basic_apply.apply_value * fWeight - 0.01f));
pDS->SetForceAttribute(i, bType, sValue);
}
for (int i = DRAGON_SOUL_ADDITIONAL_ATTR_START_IDX; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
{
BYTE bType = pDS->GetAttributeType(i);
short sValue = 0;
if (APPLY_NONE == bType)
continue;
for (int j = 0; j < vec_addtional_applys.size(); j++)
{
if (vec_addtional_applys[j].apply_type == bType)
{
sValue = vec_addtional_applys[j].apply_value;
break;
}
}
pDS->SetForceAttribute(i, bType, (short)(ceil((float)sValue * fWeight - 0.01f)));
}
return true;
}