MCPcopy Create free account
hub / github.com/diasurgical/devilution / SetupAllItems

Function SetupAllItems

Source/items.cpp:2035–2088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2033}
2034
2035void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, int onlygood, BOOL recreate, BOOL pregen)
2036{
2037 int iblvl, uid;
2038
2039 item[ii]._iSeed = iseed;
2040 SetRndSeed(iseed);
2041 GetItemAttrs(ii, idx, lvl >> 1);
2042 item[ii]._iCreateInfo = lvl;
2043
2044 if (pregen)
2045 item[ii]._iCreateInfo = lvl | 0x8000;
2046 if (onlygood)
2047 item[ii]._iCreateInfo |= 0x40;
2048
2049 if (uper == 15)
2050 item[ii]._iCreateInfo |= 0x80;
2051 else if (uper == 1)
2052 item[ii]._iCreateInfo |= 0x0100;
2053
2054 if (item[ii]._iMiscId != IMISC_UNIQUE) {
2055 iblvl = -1;
2056 if (random_(32, 100) <= 10 || random_(33, 100) <= lvl) {
2057 iblvl = lvl;
2058 }
2059 if (iblvl == -1 && item[ii]._iMiscId == IMISC_STAFF) {
2060 iblvl = lvl;
2061 }
2062 if (iblvl == -1 && item[ii]._iMiscId == IMISC_RING) {
2063 iblvl = lvl;
2064 }
2065 if (iblvl == -1 && item[ii]._iMiscId == IMISC_AMULET) {
2066 iblvl = lvl;
2067 }
2068 if (onlygood)
2069 iblvl = lvl;
2070 if (uper == 15)
2071 iblvl = lvl + 4;
2072 if (iblvl != -1) {
2073 uid = CheckUnique(ii, iblvl, uper, recreate);
2074 if (uid == UITYPE_INVALID) {
2075 GetItemBonus(ii, idx, iblvl >> 1, iblvl, onlygood);
2076 } else {
2077 GetUniqueItem(ii, uid);
2078 item[ii]._iCreateInfo |= 0x0200;
2079 }
2080 }
2081 if (item[ii]._iMagical != ITEM_QUALITY_UNIQUE)
2082 ItemRndDur(ii);
2083 } else {
2084 if (item[ii]._iLoc != ILOC_UNEQUIPABLE)
2085 GetUniqueItem(ii, iseed);
2086 }
2087 SetupItem(ii);
2088}
2089
2090void SpawnItem(int m, int x, int y, BOOL sendmsg)
2091{

Callers 7

SpawnItemFunction · 0.85
CreateRndItemFunction · 0.85
CreateTypeItemFunction · 0.85
RecreateItemFunction · 0.85
CreateSpellBookFunction · 0.85
CreateMagicArmorFunction · 0.85
CreateMagicWeaponFunction · 0.85

Calls 8

SetRndSeedFunction · 0.85
GetItemAttrsFunction · 0.85
random_Function · 0.85
CheckUniqueFunction · 0.85
GetItemBonusFunction · 0.85
GetUniqueItemFunction · 0.85
ItemRndDurFunction · 0.85
SetupItemFunction · 0.85

Tested by

no test coverage detected