本文整理汇总了C++中LPITEM::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ LPITEM::GetValue方法的具体用法?C++ LPITEM::GetValue怎么用?C++ LPITEM::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPITEM
的用法示例。
在下文中一共展示了LPITEM::GetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Item_GetDamage
void Item_GetDamage(LPITEM pkItem, int* pdamMin, int* pdamMax)
{
*pdamMin = 0;
*pdamMax = 1;
if (!pkItem)
return;
switch (pkItem->GetType())
{
case ITEM_ROD:
case ITEM_PICK:
return;
}
if (pkItem->GetType() != ITEM_WEAPON)
sys_err("Item_GetDamage - !ITEM_WEAPON vnum=%d, type=%d", pkItem->GetOriginalVnum(), pkItem->GetType());
*pdamMin = pkItem->GetValue(3);
*pdamMax = pkItem->GetValue(4);
}
示例2: CalcArrowDamage
int CalcArrowDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, LPITEM pkBow, LPITEM pkArrow, bool bIgnoreDefense)
{
if (!pkBow || pkBow->GetType() != ITEM_WEAPON || pkBow->GetSubType() != WEAPON_BOW)
return 0;
if (!pkArrow)
return 0;
// 타격치 계산부
int iDist = (int) (DISTANCE_SQRT(pkAttacker->GetX() - pkVictim->GetX(), pkAttacker->GetY() - pkVictim->GetY()));
//int iGap = (iDist / 100) - 5 - pkBow->GetValue(5) - pkAttacker->GetPoint(POINT_BOW_DISTANCE);
int iGap = (iDist / 100) - 5 - pkAttacker->GetPoint(POINT_BOW_DISTANCE);
int iPercent = 100 - (iGap * 5);
if (iPercent <= 0)
return 0;
else if (iPercent > 100)
iPercent = 100;
int iDam = 0;
float fAR = CalcAttackRating(pkAttacker, pkVictim, false);
iDam = number(pkBow->GetValue(3), pkBow->GetValue(4)) * 2 + pkArrow->GetValue(3);
int iAtk;
// level must be ignored when multiply by fAR, so subtract it before calculation.
iAtk = pkAttacker->GetPoint(POINT_ATT_GRADE) + iDam - (pkAttacker->GetLevel() * 2);
iAtk = (int) (iAtk * fAR);
iAtk += pkAttacker->GetLevel() * 2; // and add again
// Refine Grade
iAtk += pkBow->GetValue(5) * 2;
iAtk += pkAttacker->GetPoint(POINT_PARTY_ATTACKER_BONUS);
iAtk = (int) (iAtk * (100 + (pkAttacker->GetPoint(POINT_ATT_BONUS) + pkAttacker->GetPoint(POINT_MELEE_MAGIC_ATT_BONUS_PER))) / 100);
iAtk = CalcAttBonus(pkAttacker, pkVictim, iAtk);
int iDef = 0;
if (!bIgnoreDefense)
iDef = (pkVictim->GetPoint(POINT_DEF_GRADE) * (100 + pkAttacker->GetPoint(POINT_DEF_BONUS)) / 100);
if (pkAttacker->IsNPC())
iAtk = (int) (iAtk * pkAttacker->GetMobDamageMultiply());
iDam = MAX(0, iAtk - iDef);
int iPureDam = iDam;
iPureDam = (iPureDam * iPercent) / 100;
if (test_server)
{
pkAttacker->ChatPacket(CHAT_TYPE_INFO, "ARROW %s -> %s, DAM %d DIST %d GAP %d %% %d",
pkAttacker->GetName(),
pkVictim->GetName(),
iPureDam,
iDist, iGap, iPercent);
}
return iPureDam;
//return iDam;
}
示例3: CalcMeleeDamage
int CalcMeleeDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, bool bIgnoreDefense, bool bIgnoreTargetRating)
{
LPITEM pWeapon = pkAttacker->GetWear(WEAR_WEAPON);
bool bPolymorphed = pkAttacker->IsPolymorphed();
if (pWeapon && !(bPolymorphed && !pkAttacker->IsPolyMaintainStat()))
{
if (pWeapon->GetType() != ITEM_WEAPON)
return 0;
switch (pWeapon->GetSubType())
{
case WEAPON_SWORD:
case WEAPON_DAGGER:
case WEAPON_TWO_HANDED:
case WEAPON_BELL:
case WEAPON_FAN:
case WEAPON_MOUNT_SPEAR:
break;
case WEAPON_BOW:
sys_err("CalcMeleeDamage should not handle bows (name: %s)", pkAttacker->GetName());
return 0;
default:
return 0;
}
}
int iDam = 0;
float fAR = CalcAttackRating(pkAttacker, pkVictim, bIgnoreTargetRating);
int iDamMin = 0, iDamMax = 0;
// TESTSERVER_SHOW_ATTACKINFO
int DEBUG_iDamCur = 0;
int DEBUG_iDamBonus = 0;
// END_OF_TESTSERVER_SHOW_ATTACKINFO
if (bPolymorphed && !pkAttacker->IsPolyMaintainStat())
{
// MONKEY_ROD_ATTACK_BUG_FIX
Item_GetDamage(pWeapon, &iDamMin, &iDamMax);
// END_OF_MONKEY_ROD_ATTACK_BUG_FIX
DWORD dwMobVnum = pkAttacker->GetPolymorphVnum();
const CMob * pMob = CMobManager::instance().Get(dwMobVnum);
if (pMob)
{
int iPower = pkAttacker->GetPolymorphPower();
iDamMin += pMob->m_table.dwDamageRange[0] * iPower / 100;
iDamMax += pMob->m_table.dwDamageRange[1] * iPower / 100;
}
}
else if (pWeapon)
{
// MONKEY_ROD_ATTACK_BUG_FIX
Item_GetDamage(pWeapon, &iDamMin, &iDamMax);
// END_OF_MONKEY_ROD_ATTACK_BUG_FIX
}
else if (pkAttacker->IsNPC())
{
iDamMin = pkAttacker->GetMobDamageMin();
iDamMax = pkAttacker->GetMobDamageMax();
}
iDam = number(iDamMin, iDamMax) * 2;
// TESTSERVER_SHOW_ATTACKINFO
DEBUG_iDamCur = iDam;
// END_OF_TESTSERVER_SHOW_ATTACKINFO
//
int iAtk = 0;
// level must be ignored when multiply by fAR, so subtract it before calculation.
iAtk = pkAttacker->GetPoint(POINT_ATT_GRADE) + iDam - (pkAttacker->GetLevel() * 2);
iAtk = (int) (iAtk * fAR);
iAtk += pkAttacker->GetLevel() * 2; // and add again
if (pWeapon)
{
iAtk += pWeapon->GetValue(5) * 2;
// 2004.11.12.myevan.TESTSERVER_SHOW_ATTACKINFO
DEBUG_iDamBonus = pWeapon->GetValue(5) * 2;
///////////////////////////////////////////////
}
iAtk += pkAttacker->GetPoint(POINT_PARTY_ATTACKER_BONUS); // party attacker role bonus
iAtk = (int) (iAtk * (100 + (pkAttacker->GetPoint(POINT_ATT_BONUS) + pkAttacker->GetPoint(POINT_MELEE_MAGIC_ATT_BONUS_PER))) / 100);
iAtk = CalcAttBonus(pkAttacker, pkVictim, iAtk);
int iDef = 0;
if (!bIgnoreDefense)
{
iDef = (pkVictim->GetPoint(POINT_DEF_GRADE) * (100 + pkVictim->GetPoint(POINT_DEF_BONUS)) / 100);
if (!pkAttacker->IsPC())
//.........这里部分代码省略.........
示例4: PullOut
// ЖЇБ¤ їлИҐј®А» АеєсГўїЎј Б¦°ЕЗТ ¶§їЎ јє°ш ї©єОё¦ °бБ¤ЗП°н, ЅЗЖРЅГ єО»к№°А» БЦґВ ЗФјц.
bool DSManager::PullOut(LPCHARACTER ch, TItemPos DestCell, LPITEM& pItem, LPITEM pExtractor)
{
if (NULL == ch || NULL == pItem)
{
sys_err ("NULL POINTER. ch(%p) or pItem(%p)", ch, pItem);
return false;
}
// ёсЗҐ А§ДЎ°Ў validЗСБц °Л»з ИД, validЗПБц ѕКґЩёй АУАЗАЗ єу °ш°ЈА» ГЈґВґЩ.
if (!IsValidCellForThisItem(pItem, DestCell))
{
int iEmptyCell = ch->GetEmptyDragonSoulInventory(pItem);
if (iEmptyCell < 0)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("јТБцЗ°їЎ єу °ш°ЈАМ ѕшЅАґПґЩ."));
return false;
}
else
{
DestCell.window_type = DRAGON_SOUL_INVENTORY;
DestCell.cell = iEmptyCell;
}
}
if (!pItem->IsEquipped() || !pItem->RemoveFromCharacter())
return false;
bool bSuccess;
DWORD dwByProduct = 0;
int iBonus = 0;
float fProb;
float fDice;
// їлИҐј® ГЯГв јє°ш ї©єО °бБ¤.
{
DWORD dwVnum = pItem->GetVnum();
BYTE ds_type, grade_idx, step_idx, strength_idx;
GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx);
// ГЯГв Б¤єё°Ў ѕшґЩёй АПґЬ №«Б¶°З јє°шЗПґВ °НАМ¶у »э°ўЗПАЪ.
if (!m_pTable->GetDragonSoulExtValues(ds_type, grade_idx, fProb, dwByProduct))
{
pItem->AddToCharacter(ch, DestCell);
return true;
}
if (NULL != pExtractor)
{
iBonus = pExtractor->GetValue(ITEM_VALUE_DRAGON_SOUL_POLL_OUT_BONUS_IDX);
pExtractor->SetCount(pExtractor->GetCount() - 1);
}
fDice = fnumber(0.f, 100.f);
bSuccess = fDice <= (fProb * (100 + iBonus) / 100.f);
}
// ДіёЇЕНАЗ їлИҐј® ГЯГв №Ч ГЯ°Ў И¤Ає Б¦°Е. єО»к№° Б¦°ш.
{
char buf[128];
if (bSuccess)
{
if (pExtractor)
{
sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum());
}
else
{
sprintf(buf, "dice(%d) prob(%d)", fDice, fProb);
}
LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_SUCCESS", buf);
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлИҐј® ГЯГвїЎ јє°шЗПїґЅАґПґЩ."));
pItem->AddToCharacter(ch, DestCell);
return true;
}
else
{
if (pExtractor)
{
sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d) ByProd(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum(), dwByProduct);
}
else
{
sprintf(buf, "dice(%d) prob(%d) ByProd(VNUM:%d)", (int)fDice, (int)fProb, dwByProduct);
}
LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_FAILED", buf);
M2_DESTROY_ITEM(pItem);
pItem = NULL;
if (dwByProduct)
{
LPITEM pByProduct = ch->AutoGiveItem(dwByProduct, true);
if (pByProduct)
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлИҐј® ГЯГвїЎ ЅЗЖРЗПї© %sё¦ ѕтѕъЅАґПґЩ."), pByProduct->GetName());
else
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлИҐј® ГЯГвїЎ ЅЗЖРЗПїґЅАґПґЩ."));
}
else
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("їлИҐј® ГЯГвїЎ ЅЗЖРЗПїґЅАґПґЩ."));
}
//.........这里部分代码省略.........
示例5: 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;
}
}
示例6: PullOut
// 특정 용혼석을 장비창에서 제거할 때에 성공 여부를 결정하고, 실패시 부산물을 주는 함수.
bool DSManager::PullOut(LPCHARACTER ch, TItemPos DestCell, LPITEM& pItem, LPITEM pExtractor)
{
if (NULL == ch || NULL == pItem)
{
sys_err ("NULL POINTER. ch(%p) or pItem(%p)", ch, pItem);
return false;
}
// 목표 위치가 valid한지 검사 후, valid하지 않다면 임의의 빈 공간을 찾는다.
if (!IsValidCellForThisItem(pItem, DestCell))
{
int iEmptyCell = ch->GetEmptyDragonSoulInventory(pItem);
if (iEmptyCell < 0)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지품에 빈 공간이 없습니다."));
return false;
}
else
{
DestCell.window_type = DRAGON_SOUL_INVENTORY;
DestCell.cell = iEmptyCell;
}
}
if (!pItem->IsEquipped() || !pItem->RemoveFromCharacter())
return false;
bool bSuccess;
DWORD dwByProduct = 0;
int iBonus = 0;
float fProb;
float fDice;
// 용혼석 추출 성공 여부 결정.
{
DWORD dwVnum = pItem->GetVnum();
BYTE ds_type, grade_idx, step_idx, strength_idx;
GetDragonSoulInfo(pItem->GetVnum(), ds_type, grade_idx, step_idx, strength_idx);
// 추출 정보가 없다면 일단 무조건 성공하는 것이라 생각하자.
if (!m_pTable->GetDragonSoulExtValues(ds_type, grade_idx, fProb, dwByProduct))
{
pItem->AddToCharacter(ch, DestCell);
return true;
}
if (NULL != pExtractor)
{
iBonus = pExtractor->GetValue(ITEM_VALUE_DRAGON_SOUL_POLL_OUT_BONUS_IDX);
pExtractor->SetCount(pExtractor->GetCount() - 1);
}
fDice = fnumber(0.f, 100.f);
bSuccess = fDice <= (fProb * (100 + iBonus) / 100.f);
}
// 캐릭터의 용혼석 추출 및 추가 혹은 제거. 부산물 제공.
{
char buf[128];
if (bSuccess)
{
if (pExtractor)
{
sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum());
}
else
{
sprintf(buf, "dice(%d) prob(%d)", fDice, fProb);
}
LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_SUCCESS", buf);
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("용혼석 추출에 성공하였습니다."));
pItem->AddToCharacter(ch, DestCell);
return true;
}
else
{
if (pExtractor)
{
sprintf(buf, "dice(%d) prob(%d + %d) EXTR(VN:%d) ByProd(VN:%d)", (int)fDice, (int)fProb, iBonus, pExtractor->GetVnum(), dwByProduct);
}
else
{
sprintf(buf, "dice(%d) prob(%d) ByProd(VNUM:%d)", (int)fDice, (int)fProb, dwByProduct);
}
LogManager::instance().ItemLog(ch, pItem, "DS_PULL_OUT_FAILED", buf);
M2_DESTROY_ITEM(pItem);
pItem = NULL;
if (dwByProduct)
{
LPITEM pByProduct = ch->AutoGiveItem(dwByProduct, true);
if (pByProduct)
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("용혼석 추출에 실패하여 %s를 얻었습니다."), pByProduct->GetName());
else
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("용혼석 추출에 실패하였습니다."));
}
else
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("용혼석 추출에 실패하였습니다."));
}
//.........这里部分代码省略.........