Browse Source

Introduce GetItemBLevel

pull/5745/head^2
obligaron 3 years ago committed by Anders Jenbo
parent
commit
f65152c556
  1. 32
      Source/items.cpp

32
Source/items.cpp

@ -1484,6 +1484,20 @@ void ItemRndDur(Item &item)
item._iDurability = GenerateRnd(item._iMaxDur / 2) + (item._iMaxDur / 4) + 1;
}
int GetItemBLevel(int lvl, item_misc_id miscId, bool onlygood, bool uper15)
{
int iblvl = -1;
if (GenerateRnd(100) <= 10
|| GenerateRnd(100) <= lvl
|| onlygood
|| IsAnyOf(miscId, IMISC_STAFF, IMISC_RING, IMISC_AMULET)) {
iblvl = lvl;
}
if (uper15)
iblvl = lvl + 4;
return iblvl;
}
void SetupAllItems(const Player &player, Item &item, _item_indexes idx, int iseed, int lvl, int uper, bool onlygood, bool recreate, bool pregen)
{
item._iSeed = iseed;
@ -1502,23 +1516,7 @@ void SetupAllItems(const Player &player, Item &item, _item_indexes idx, int isee
item._iCreateInfo |= CF_UPER1;
if (item._iMiscId != IMISC_UNIQUE) {
int iblvl = -1;
if (GenerateRnd(100) <= 10 || GenerateRnd(100) <= lvl) {
iblvl = lvl;
}
if (iblvl == -1 && item._iMiscId == IMISC_STAFF) {
iblvl = lvl;
}
if (iblvl == -1 && item._iMiscId == IMISC_RING) {
iblvl = lvl;
}
if (iblvl == -1 && item._iMiscId == IMISC_AMULET) {
iblvl = lvl;
}
if (onlygood)
iblvl = lvl;
if (uper == 15)
iblvl = lvl + 4;
int iblvl = GetItemBLevel(lvl, item._iMiscId, onlygood, uper == 15);
if (iblvl != -1) {
_unique_items uid = CheckUnique(item, iblvl, uper, recreate);
if (uid == UITEM_INVALID) {

Loading…
Cancel
Save