Skip to content

Commit

Permalink
Progress update
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Sep 27, 2024
1 parent 0629449 commit c9d30dc
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 57 deletions.
24 changes: 17 additions & 7 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4380,13 +4380,15 @@ void SpawnSmith(int lvl)
constexpr int PinnedItemCount = 0;

int maxValue = 140000;
int maxItems = 19;
int maxItems = NumSmithBasicItems;

if (gbIsHellfire) {
maxValue = 200000;
maxItems = 24;
maxItems = NumSmithBasicItemsHf;
}

int iCnt = RandomIntBetween(10, maxItems);

for (int i = 0; i < iCnt; i++) {
Item &newItem = Blacksmith.basicItems[i];

Expand All @@ -4401,7 +4403,10 @@ void SpawnSmith(int lvl)
newItem._iCreateInfo = lvl | CF_SMITH;
newItem._iIdentified = true;
}
for (int i = iCnt; i < NumSmithItemsHf; i++)

Blacksmith.basicItemCount = iCnt;

for (int i = iCnt; i < NumSmithBasicItems; i++)
Blacksmith.basicItems[i].clear();

SortVendor(Blacksmith.basicItems, PinnedItemCount);
Expand Down Expand Up @@ -4449,10 +4454,10 @@ void SpawnWitch(int lvl)

int bookCount = 0;
const int pinnedBookCount = gbIsHellfire ? RandomIntLessThan(MaxPinnedBookCount) : 0;
const int itemCount = RandomIntBetween(10, gbIsHellfire ? 24 : 17);
const int itemCount = RandomIntBetween(10, gbIsHellfire ? NumWitchItemsHf : NumWitchItems);
const int maxValue = gbIsHellfire ? 200000 : 140000;

for (int i = 0; i < NumWitchItems; i++) {
for (int i = 0; i < itemCount; i++) {
Item &item = Witch.items[i];
item = {};

Expand Down Expand Up @@ -4503,6 +4508,7 @@ void SpawnWitch(int lvl)
item._iCreateInfo = lvl | CF_WITCH;
item._iIdentified = true;
}
Witch.itemCount = itemCount;

SortVendor(Witch.items, PinnedItemCount);
}
Expand Down Expand Up @@ -4616,6 +4622,9 @@ void SpawnBoy(int lvl)
|| Boy.items[0]._iMinDex > dexterity
|| Boy.items[0]._iIvalue < ivalue)
&& count < 250));

Boy.itemCount = 1; // FIXME: Magic number

Boy.items[0]._iCreateInfo = lvl | CF_BOY;
Boy.items[0]._iIdentified = true;
Boy.itemLevel = lvl / 2;
Expand All @@ -4625,9 +4634,9 @@ void SpawnHealer(int lvl)
{
constexpr size_t PinnedItemCount = 2;
constexpr std::array<_item_indexes, PinnedItemCount + 1> PinnedItemTypes = { IDI_HEAL, IDI_FULLHEAL, IDI_RESURRECT };
const auto itemCount = static_cast<size_t>(RandomIntBetween(10, gbIsHellfire ? 19 : 17));
const auto itemCount = static_cast<size_t>(RandomIntBetween(10, gbIsHellfire ? NumHealerItemsHf : NumHealerItems));

for (size_t i = 0; i < sizeof(Healer.items) / sizeof(Healer.items[0]); ++i) {
for (size_t i = 0; i < itemCount; i++) {
Item &item = Healer.items[i];
item = {};

Expand All @@ -4651,6 +4660,7 @@ void SpawnHealer(int lvl)
item._iCreateInfo = lvl | CF_HEALER;
item._iIdentified = true;
}
Healer.itemCount = itemCount;

Check warning on line 4663 in Source/items.cpp

View workflow job for this annotation

GitHub Actions / build

'=': conversion from 'size_t' to 'int', possible loss of data

SortVendor(Healer.items, PinnedItemCount);
}
Expand Down
Loading

0 comments on commit c9d30dc

Please sign in to comment.