mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
Add documentation for getItemType()
This commit is contained in:
parent
d1c5e272a8
commit
c6ec1c46c2
@ -316,7 +316,7 @@ void NPCManager::npcCombineItems(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
CrocPotEntry* recipe = &ItemManager::CrocPotTable[abs(itemStatsDat->level - itemLooksDat->level)];
|
CrocPotEntry* recipe = &ItemManager::CrocPotTable[abs(itemStatsDat->level - itemLooksDat->level)];
|
||||||
int cost = itemStatsDat->buyPrice * recipe->multStats + itemLooksDat->buyPrice * recipe->multLooks;
|
int cost = itemStatsDat->buyPrice * recipe->multStats + itemLooksDat->buyPrice * recipe->multLooks;
|
||||||
float successChance = recipe->base / 100.0f;
|
float successChance = recipe->base / 100.0f; // base success chance
|
||||||
|
|
||||||
// rarity gap multiplier
|
// rarity gap multiplier
|
||||||
switch(abs(itemStatsDat->rarity - itemLooksDat->rarity))
|
switch(abs(itemStatsDat->rarity - itemLooksDat->rarity))
|
||||||
@ -337,8 +337,8 @@ void NPCManager::npcCombineItems(CNSocket* sock, CNPacketData* data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
float rolled = (rand() * 1.0f / RAND_MAX) * 100.0f;
|
float rolled = (rand() * 1.0f / RAND_MAX) * 100.0f; // success chance out of 100
|
||||||
std::cout << rolled << " vs " << successChance << std::endl;
|
//std::cout << rolled << " vs " << successChance << std::endl;
|
||||||
plr->money -= cost;
|
plr->money -= cost;
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void TableData::init() {
|
|||||||
itemSet = xdtData[setNames[i]]["m_pItemData"];
|
itemSet = xdtData[setNames[i]]["m_pItemData"];
|
||||||
for (nlohmann::json::iterator _item = itemSet.begin(); _item != itemSet.end(); _item++) {
|
for (nlohmann::json::iterator _item = itemSet.begin(); _item != itemSet.end(); _item++) {
|
||||||
auto item = _item.value();
|
auto item = _item.value();
|
||||||
int typeOverride = getItemType(i);
|
int typeOverride = getItemType(i); // used for special cases where iEquipLoc doesn't indicate item type
|
||||||
ItemManager::ItemData[std::pair<int32_t, int32_t>(item["m_iItemNumber"], typeOverride != -1 ? typeOverride : (int)item["m_iEquipLoc"])]
|
ItemManager::ItemData[std::pair<int32_t, int32_t>(item["m_iItemNumber"], typeOverride != -1 ? typeOverride : (int)item["m_iEquipLoc"])]
|
||||||
= { item["m_iTradeAble"] == 1, item["m_iSellAble"] == 1, item["m_iItemPrice"], item["m_iItemSellPrice"], item["m_iStackNumber"], i > 9 ? 0 : (int)item["m_iMinReqLev"],
|
= { item["m_iTradeAble"] == 1, item["m_iSellAble"] == 1, item["m_iItemPrice"], item["m_iItemSellPrice"], item["m_iStackNumber"], i > 9 ? 0 : (int)item["m_iMinReqLev"],
|
||||||
i > 9 ? 1 : (int)item["m_iRarity"] };
|
i > 9 ? 1 : (int)item["m_iRarity"] };
|
||||||
@ -192,17 +192,20 @@ void TableData::cleanup() {
|
|||||||
delete pair.second;
|
delete pair.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some item categories either don't possess iEquipLoc or use a different value for item type.
|
||||||
|
*/
|
||||||
int TableData::getItemType(int itemSet) {
|
int TableData::getItemType(int itemSet) {
|
||||||
int overriden;
|
int overriden;
|
||||||
switch (itemSet)
|
switch (itemSet)
|
||||||
{
|
{
|
||||||
case 11:
|
case 11: // Chest items don't have iEquipLoc and are type 9.
|
||||||
overriden = 9;
|
overriden = 9;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10: // General items don't have iEquipLoc and are type 7.
|
||||||
overriden = 7;
|
overriden = 7;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9: // Vehicles have iEquipLoc 8, but type 10.
|
||||||
overriden = 10;
|
overriden = 10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user