Browse Source

Introduce iteminfo debug command and remove ItemInfo Keybinding

pull/2891/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
3368ff5a3b
  1. 21
      Source/debug.cpp
  2. 24
      Source/diablo.cpp

21
Source/debug.cpp

@ -631,6 +631,26 @@ std::string DebugCmdScrollView(const string_view parameter)
return "If you want to see the world, you need to explore it yourself.";
}
std::string DebugCmdItemInfo(const string_view parameter)
{
auto &myPlayer = Players[MyPlayerId];
Item *pItem = nullptr;
if (pcurs >= CURSOR_FIRSTITEM) {
pItem = &myPlayer.HoldItem;
} else if (pcursinvitem != -1) {
if (pcursinvitem <= INVITEM_INV_LAST)
pItem = &myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST];
else
pItem = &myPlayer.SpdList[pcursinvitem - INVITEM_BELT_FIRST];
} else if (pcursitem != -1) {
pItem = &Items[pcursitem];
}
if (pItem != nullptr) {
return fmt::format("Name: {}\nIDidx: {}\nSeed: {}\nCreateInfo: {}", pItem->_iIName, pItem->IDidx, pItem->_iSeed, pItem->_iCreateInfo);
}
return fmt::format("Numitems: {}", ActiveItemCount);
}
std::vector<DebugCmdItem> DebugCmdList = {
{ "help", "Prints help overview or help for a specific command.", "({command})", &DebugCmdHelp },
{ "give gold", "Fills the inventory with gold.", "", &DebugCmdGiveGoldCheat },
@ -657,6 +677,7 @@ std::vector<DebugCmdItem> DebugCmdList = {
{ "spawn", "Spawns monster {name}.", "({count}) {name}", &DebugCmdSpawnMonster },
{ "tiledata", "Toggles showing tile data {name} (leave name empty to see a list).", "{name}", &DebugCmdShowTileData },
{ "scrollview", "Toggles scroll view feature (with shift+mouse).", "", &DebugCmdScrollView },
{ "iteminfo", "Shows info of currently selected item.", "", &DebugCmdItemInfo },
};
} // namespace

24
Source/diablo.cpp

@ -1258,24 +1258,6 @@ void HelpKeyPressed()
}
}
#ifdef _DEBUG
void ItemInfoKeyPressed()
{
auto &item = Items[pcursitem];
if (pcursitem != -1) {
sprintf(
tempstr,
"IDX = %i : Seed = %i : CF = %i",
item.IDidx,
item._iSeed,
item._iCreateInfo);
NetSendCmdString(1 << MyPlayerId, tempstr);
}
sprintf(tempstr, "Numitems : %i", ActiveItemCount);
NetSendCmdString(1 << MyPlayerId, tempstr);
}
#endif
void InventoryKeyPressed()
{
if (stextflag != STORE_NONE)
@ -1386,12 +1368,6 @@ void InitKeymapActions()
[&]() { return !IsPlayerDead(); },
});
#ifdef _DEBUG
keymapper.AddAction({
"ItemInfo",
DVL_VK_INVALID,
ItemInfoKeyPressed,
[&]() { return !IsPlayerDead(); },
});
keymapper.AddAction({
"QuestDebug",
DVL_VK_INVALID,

Loading…
Cancel
Save