|
|
|
@ -1499,7 +1499,9 @@ bool AutoPlaceItemInInventorySlot(Player &player, int slotIndex, const Item &ite |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GoldAutoPlace(Player &player) |
|
|
|
bool GoldAutoPlaceInInventorySlot(Player &, int, Item &); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool GoldAutoPlace(Player &player, Item &goldStack) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool done = false; |
|
|
|
bool done = false; |
|
|
|
|
|
|
|
|
|
|
|
@ -1509,56 +1511,56 @@ bool GoldAutoPlace(Player &player) |
|
|
|
if (player.InvList[i]._ivalue >= MaxGold) |
|
|
|
if (player.InvList[i]._ivalue >= MaxGold) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
player.InvList[i]._ivalue += player.HoldItem._ivalue; |
|
|
|
player.InvList[i]._ivalue += goldStack._ivalue; |
|
|
|
if (player.InvList[i]._ivalue > MaxGold) { |
|
|
|
if (player.InvList[i]._ivalue > MaxGold) { |
|
|
|
player.HoldItem._ivalue = player.InvList[i]._ivalue - MaxGold; |
|
|
|
goldStack._ivalue = player.InvList[i]._ivalue - MaxGold; |
|
|
|
SetPlrHandGoldCurs(player.HoldItem); |
|
|
|
SetPlrHandGoldCurs(goldStack); |
|
|
|
player.InvList[i]._ivalue = MaxGold; |
|
|
|
player.InvList[i]._ivalue = MaxGold; |
|
|
|
if (gbIsHellfire) |
|
|
|
if (gbIsHellfire) |
|
|
|
GenerateNewSeed(player.HoldItem); |
|
|
|
GenerateNewSeed(goldStack); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
player.HoldItem._ivalue = 0; |
|
|
|
goldStack._ivalue = 0; |
|
|
|
done = true; |
|
|
|
done = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SetPlrHandGoldCurs(player.InvList[i]); |
|
|
|
SetPlrHandGoldCurs(player.InvList[i]); |
|
|
|
player._pGold = CalculateGold(player); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 39; i >= 30 && !done; i--) { |
|
|
|
for (int i = 39; i >= 30 && !done; i--) { |
|
|
|
done = GoldAutoPlaceInInventorySlot(player, i); |
|
|
|
done = GoldAutoPlaceInInventorySlot(player, i, goldStack); |
|
|
|
} |
|
|
|
} |
|
|
|
for (int x = 9; x >= 0 && !done; x--) { |
|
|
|
for (int x = 9; x >= 0 && !done; x--) { |
|
|
|
for (int y = 2; y >= 0 && !done; y--) { |
|
|
|
for (int y = 2; y >= 0 && !done; y--) { |
|
|
|
done = GoldAutoPlaceInInventorySlot(player, 10 * y + x); |
|
|
|
done = GoldAutoPlaceInInventorySlot(player, 10 * y + x, goldStack); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player._pGold = CalculateGold(player); |
|
|
|
return done; |
|
|
|
return done; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GoldAutoPlaceInInventorySlot(Player &player, int slotIndex) |
|
|
|
bool GoldAutoPlaceInInventorySlot(Player &player, int slotIndex, Item &goldStack) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (player.InvGrid[slotIndex] != 0) { |
|
|
|
if (player.InvGrid[slotIndex] != 0) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int ii = player._pNumInv; |
|
|
|
int ii = player._pNumInv; |
|
|
|
player.InvList[ii] = player.HoldItem; |
|
|
|
player.InvList[ii] = goldStack; |
|
|
|
player._pNumInv++; |
|
|
|
player._pNumInv++; |
|
|
|
player.InvGrid[slotIndex] = player._pNumInv; |
|
|
|
player.InvGrid[slotIndex] = player._pNumInv; |
|
|
|
GenerateNewSeed(player.InvList[ii]); |
|
|
|
GenerateNewSeed(player.InvList[ii]); |
|
|
|
|
|
|
|
|
|
|
|
int gold = player.HoldItem._ivalue; |
|
|
|
int gold = goldStack._ivalue; |
|
|
|
if (gold > MaxGold) { |
|
|
|
if (gold > MaxGold) { |
|
|
|
gold -= MaxGold; |
|
|
|
gold -= MaxGold; |
|
|
|
player.HoldItem._ivalue = gold; |
|
|
|
goldStack._ivalue = gold; |
|
|
|
GenerateNewSeed(player.HoldItem); |
|
|
|
GenerateNewSeed(goldStack); |
|
|
|
player.InvList[ii]._ivalue = MaxGold; |
|
|
|
player.InvList[ii]._ivalue = MaxGold; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
player.HoldItem._ivalue = 0; |
|
|
|
goldStack._ivalue = 0; |
|
|
|
player._pGold = CalculateGold(player); |
|
|
|
player._pGold = CalculateGold(player); |
|
|
|
NewCursor(CURSOR_HAND); |
|
|
|
NewCursor(CURSOR_HAND); |
|
|
|
|
|
|
|
|
|
|
|
@ -1639,7 +1641,7 @@ void InvGetItem(int pnum, int ii) |
|
|
|
CheckBookLevel(player); |
|
|
|
CheckBookLevel(player); |
|
|
|
CheckItemStats(player); |
|
|
|
CheckItemStats(player); |
|
|
|
bool cursorUpdated = false; |
|
|
|
bool cursorUpdated = false; |
|
|
|
if (player.HoldItem._itype == ItemType::Gold && GoldAutoPlace(player)) |
|
|
|
if (player.HoldItem._itype == ItemType::Gold && GoldAutoPlace(player, player.HoldItem)) |
|
|
|
cursorUpdated = true; |
|
|
|
cursorUpdated = true; |
|
|
|
CleanupItems(ii); |
|
|
|
CleanupItems(ii); |
|
|
|
pcursitem = -1; |
|
|
|
pcursitem = -1; |
|
|
|
@ -1673,7 +1675,7 @@ void AutoGetItem(int pnum, Item *item, int ii) |
|
|
|
CheckItemStats(player); |
|
|
|
CheckItemStats(player); |
|
|
|
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM); |
|
|
|
SetICursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM); |
|
|
|
if (player.HoldItem._itype == ItemType::Gold) { |
|
|
|
if (player.HoldItem._itype == ItemType::Gold) { |
|
|
|
done = GoldAutoPlace(player); |
|
|
|
done = GoldAutoPlace(player, player.HoldItem); |
|
|
|
if (!done) { |
|
|
|
if (!done) { |
|
|
|
item->_ivalue = player.HoldItem._ivalue; |
|
|
|
item->_ivalue = player.HoldItem._ivalue; |
|
|
|
SetPlrHandGoldCurs(*item); |
|
|
|
SetPlrHandGoldCurs(*item); |
|
|
|
|