void OpenSellMenu (edict_t *ent, int lastline) { //Use the item select menu and change the menu handler ShowInventoryMenu(ent, lastline, true); setmenuhandler(ent, SellMenu_handler); showmenu(ent); }
void ShowItemMenu_handler(edict_t *ent, int option) { if (option - 9999 > 0) { //Delete item menu ItemDeleteMenu(ent, option - 10000); } else if (option - 7777 > 0) { //Previous menu ShowInventoryMenu(ent, option - 7777, false); return; } else if (option - 4444 > 0) { //Equip/Unequip item V_EquipItem(ent, option - 4445); } else { //Closing menu closemenu(ent); return; } }
void DeleteMenu_handler(edict_t *ent, int option) { if (option - 777 > 0) { int i; //Delete item memset(&ent->myskills.items[option - 778], 0, sizeof(item_t)); //Re-apply equipment V_ResetAllStats(ent); for (i = 0; i < 3; ++i) V_ApplyRune(ent, &ent->myskills.items[i]); safe_cprintf(ent, PRINT_HIGH, "Item deleted.\n"); } else if (option - 666 > 0) { //Back to main ShowInventoryMenu(ent, option - 666, false); return; } else { //Closing menu closemenu(ent); return; } }
void ShowInventoryMenu_handler(edict_t *ent, int option) { if ((option > 0) && (option-1 < MAX_VRXITEMS) && (ent->myskills.items[option-1].itemtype != ITEM_NONE)) { //Use the consumable items (health potions, holy water) if ((ent->myskills.items[option-1].itemtype == ITEM_POTION) || (ent->myskills.items[option-1].itemtype == ITEM_ANTIDOTE)) { cmd_Drink(ent, ent->myskills.items[option-1].itemtype, option); return; } //View selected item ShowItemMenu(ent, option-1); } else if (option == 666) { closemenu(ent); return; } //refresh the menu ShowInventoryMenu(ent, option, false); }