Browse Source

🚩 Add ini toggle for auto-equipping jewelry. Disabled by default.

pull/1148/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
eef97eaabb
  1. 2
      Source/diablo.cpp
  2. 3
      Source/diablo.h
  3. 4
      Source/inv.cpp
  4. 20
      Source/items.h

2
Source/diablo.cpp

@ -436,6 +436,7 @@ static void SaveOptions()
setIniInt("Game", "Auto Equip Armor on Pickup", sgOptions.bAutoEquipArmor);
setIniInt("Game", "Auto Equip Helms on Pickup", sgOptions.bAutoEquipHelms);
setIniInt("Game", "Auto Equip Shields on Pickup", sgOptions.bAutoEquipShields);
setIniInt("Game", "Auto Equip Jewelry on Pickup", sgOptions.bAutoEquipJewelry);
setIniValue("Network", "Bind Address", sgOptions.szBindAddress);
}
@ -486,6 +487,7 @@ static void LoadOptions()
sgOptions.bAutoEquipArmor = getIniBool("Game", "Auto Equip Armor on Pickup", false);
sgOptions.bAutoEquipHelms = getIniBool("Game", "Auto Equip Helms on Pickup", false);
sgOptions.bAutoEquipShields = getIniBool("Game", "Auto Equip Shields on Pickup", false);
sgOptions.bAutoEquipJewelry = getIniBool("Game", "Auto Equip Jewelry on Pickup", false);
getIniValue("Network", "Bind Address", sgOptions.szBindAddress, sizeof(sgOptions.szBindAddress), "0.0.0.0");
}

3
Source/diablo.h

@ -110,6 +110,9 @@ typedef struct Options {
/** @brief Automatically attempt to equip shield-type items when picking them up. */
bool bAutoEquipShields;
/** @brief Automatically attempt to equip jewelry-type items when picking them up. */
bool bAutoEquipJewelry;
/** @brief Optionally bind to a specific network interface. */
char szBindAddress[129];
} Options;

4
Source/inv.cpp

@ -824,6 +824,10 @@ bool AutoEquipEnabled(const ItemStruct &item)
return sgOptions.bAutoEquipShields;
}
if (item.isJewelry()) {
return sgOptions.bAutoEquipJewelry;
}
return true;
}

20
Source/items.h

@ -218,6 +218,26 @@ typedef struct ItemStruct {
return !this->isEmpty() && this->_itype == ITYPE_SHIELD;
}
/**
* @brief Checks whether this item is a jewelry.
* @return 'True' in case the item is a jewelry and 'False' otherwise.
*/
bool isJewelry() const
{
if (this->isEmpty()) {
return false;
}
switch (this->_itype) {
case ITYPE_AMULET:
case ITYPE_RING:
return true;
default:
return false;
}
}
} ItemStruct;
typedef struct ItemGetRecordStruct {

Loading…
Cancel
Save