Ejemplo n.º 1
0
void ShowInventoryMenu(edict_t *ent, int lastline, qboolean selling)
{
	int i;

	//Usual menu stuff
	 if (!ShowMenu(ent))
        return;
	clearmenu(ent);

	//Print header
	addlinetomenu(ent, va("%s's items", ent->client->pers.netname), MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	//Print each item
	for (i = 0; i < MAX_VRXITEMS; ++i)
	{
		item_t *item;
		item = &ent->myskills.items[i];

		//Print equip slot (if required)
		switch(i)
		{
		case 0:	addlinetomenu(ent, " Hand", MENU_GREEN_LEFT); break;
		case 1:	addlinetomenu(ent, " Neck", MENU_GREEN_LEFT); break;
		case 2:	addlinetomenu(ent, " Belt", MENU_GREEN_LEFT); break;
		case 3:	addlinetomenu(ent, " Stash", MENU_GREEN_LEFT);break;
		}
		addlinetomenu(ent, va("%s", V_MenuItemString(item, ' ')), i+1);
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, " Exit", 666);

	//Set handler
	setmenuhandler(ent, ShowInventoryMenu_handler);

	//Where are we in the menu?
	if (lastline)
	{
		switch(lastline)
		{
		case 1:		ent->client->menustorage.currentline = 4; break;
		case 2:		ent->client->menustorage.currentline = 6; break;
		case 3:		ent->client->menustorage.currentline = 8; break;
		default:	ent->client->menustorage.currentline = 6 + lastline; break;	//start at line 10
		}
	}
	else ent->client->menustorage.currentline = 18;

	//Display the menu (don't show it if this menu was loaded from the armory!)
	if (!selling) showmenu(ent);
}
Ejemplo n.º 2
0
void OpenBuyRuneMenu(edict_t *ent, int page_num, int lastline)
{
	int i;
	armoryRune_t *firstItem;

	//Usual menu stuff
	if (!ShowMenu(ent))
        return;
	clearmenu(ent);

	//Header
	addlinetomenu(ent, va("You have %d credits", ent->myskills.credits), MENU_GREEN_CENTERED);
	addlinetomenu(ent, "Please make a selection:", MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	switch(page_num)
	{
	case 1: firstItem = WeaponRunes;	break;
	case 2: firstItem = AbilityRunes;	break;
	case 3: firstItem = ComboRunes;		break;
	default: 
		gi.dprintf("Error in OpenBuyRuneMenu(). Invalid page number: %d\n", page_num);
		return;
	}

	//Print this page's items
    for (i = 0; i < ARMORY_MAX_RUNES; ++i)
	{
		item_t *rune = &((firstItem + i)->rune);
		if (rune->itemtype != ITEM_NONE)
		{
			char buf[32];
			strcpy(buf, V_MenuItemString(rune, ' '));
			padRight(buf, 18);
			addlinetomenu(ent, va("%s%d", buf, getBuyValue(rune)), (page_num * 1000) + i + 1);
		}
		else 
		{
			switch(page_num)
			{
			case 1: addlinetomenu(ent, "    <Empty Weapon Slot>", 0); break;
			case 2: addlinetomenu(ent, "    <Empty Ability Slot>", 0); break;
			case 3: addlinetomenu(ent, "    <Empty Combo Slot>", 0); break;
			}
		}
	}

	//Footer
	addlinetomenu(ent, " ", 0);
	if (page_num < 3) addlinetomenu(ent, "Next", (page_num*10)+2);
	addlinetomenu(ent, "Back", (page_num*10)+1);
	addlinetomenu(ent, "Exit", 99);

	//Menu handler
	setmenuhandler(ent, BuyRuneMenu_handler);

	//Set the menu cursor
	if (lastline)	ent->client->menustorage.currentline = 4 + lastline;
	else			ent->client->menustorage.currentline = 15;
	
	//Show the menu
	showmenu(ent);
}
Ejemplo n.º 3
0
void StartShowInventoryMenu(edict_t *ent, item_t *item)
{
	int type = item->itemtype;
	int linecount = 1;
	int i;

	if (!ShowMenu(ent))
		return;
	clearmenu(ent);

	//If item has a name, use that instead
	if (strlen(item->name) > 0)
	{
		if (item->setCode == 0)
			addlinetomenu(ent, va(" %s", item->name), MENU_GREEN_LEFT);
		else addlinetomenu(ent, va(" %s (set item)", item->name), MENU_GREEN_LEFT);
	}
	else
	{
		//Print header, depending on the item type
		addlinetomenu(ent, va("%s", V_MenuItemString(item, ' ')), MENU_GREEN_LEFT); 
	}

	//Unique runes need to display stats too
	if (type & ITEM_UNIQUE)
		type ^= ITEM_UNIQUE;

	//Item's stats
	switch(type)
	{
	case ITEM_WEAPON:
		{
			int wIndex = (item->modifiers[0].index / 100) - 10;

			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, va(" %s", GetWeaponString(wIndex)), 0);
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 4;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int mIndex;
				char buf[30];

				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				mIndex = item->modifiers[i].index % 100;
				strcpy(buf, GetModString(wIndex, mIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				++linecount;
			}
			addlinetomenu(ent, " ", 0);
			++linecount;
		}
		break;
	case ITEM_ABILITY:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int aIndex;
				char buf[30];

				aIndex = item->modifiers[i].index;
				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				strcpy(buf, GetAbilityString(aIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				linecount++;
			}
		}
		break;
	case ITEM_COMBO:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				char buf[30];
				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				switch(item->modifiers[i].type)
				{
				case TYPE_ABILITY:
					{
						int aIndex;
						aIndex = item->modifiers[i].index;

						strcpy(buf, GetAbilityString(aIndex));
						padRight(buf, 20);
						addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
						linecount++;
					}
					break;
				case TYPE_WEAPON:
					{
						int wIndex = (item->modifiers[i].index / 100) - 10;
						int mIndex = item->modifiers[i].index % 100;

						strcpy(buf, GetShortWeaponString(wIndex));
						strcat(buf, va(" %s", GetModString(wIndex, mIndex)));
						padRight(buf, 20);
						addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
						linecount++;
					}
					break;
				}
			}
		}
		break;
	case ITEM_CLASSRUNE:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int aIndex;
				char buf[30];

				aIndex = item->modifiers[i].index;

				if (item->modifiers[i].type == TYPE_NONE)
					continue;

				strcpy(buf, GetAbilityString(aIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				linecount++;
			}
		}
		break;
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);

	//Items such as Gravity boots need to show the number of charges left
	if ((item->itemtype & ITEM_GRAVBOOTS) || (item->itemtype & ITEM_FIRE_RESIST) || (item->itemtype & ITEM_AUTO_TBALL))
	{
		addlinetomenu(ent, va(" Charges left: %d", item->quantity), 0);
		addlinetomenu(ent, " ", 0);
		linecount += 2;
	}

	ent->client->menustorage.currentline = linecount;
}