Introduce iteminfo debug command and remove ItemInfo Keybinding
This commit is contained in:
parent
3bd6091297
commit
3368ff5a3b
2 changed files with 21 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue