コード例 #1
0
ファイル: v_items.c プロジェクト: mylemans/vrxcl
void V_PrintItemProperties(edict_t *player, item_t *item)
{
	char buf[256];
	int i;

	//Did they find a unique?
	if (strlen(item->name) > 0)
	{
		gi.centerprintf(player, "WOW! It's \"%s\"!!\n", item->name);
		return;
	}

	strcpy(buf, GetRuneValString(item));
	
	switch(item->itemtype)
	{
	case ITEM_WEAPON:	strcat(buf, " weapon rune ");	break;
	case ITEM_ABILITY:	strcat(buf, " ability rune ");	break;
	case ITEM_COMBO:	strcat(buf, " combo rune ");	break;
	case ITEM_CLASSRUNE:strcpy(buf, va(" %s rune ", GetRuneValString(item)));	break;
	}

	if(item->numMods == 1) strcat(buf, "(1 mod)");
	else strcat(buf, va("(%d mods)", item->numMods));

	for (i = 0; i < MAX_VRXITEMMODS; ++i)
	{
		char temp[32];

		//skip bad mod types
		if ((item->modifiers[i].type != TYPE_ABILITY) && (item->modifiers[i].type != TYPE_WEAPON) || item->modifiers[i].value < 1)
			continue;

		switch(item->modifiers[i].type)
		{
		case TYPE_ABILITY:	strcpy(temp, va("%s:", GetAbilityString(item->modifiers[i].index)));				break;
		case TYPE_WEAPON:	strcpy(temp, va("%s %s:", 
								GetShortWeaponString((item->modifiers[i].index / 100)-10), 
								GetModString((item->modifiers[i].index / 100)-10, item->modifiers[i].index % 100)));	break;
		}
		padRight(temp, 20);
		strcat(buf, va("\n    %s(%d)", temp, item->modifiers[i].value));
	}
	
	gi.centerprintf(player, "%s\n", buf);
}
コード例 #2
0
void OpenGeneralWeaponMenu (edict_t *ent, int lastline)
{
	int WeaponIndex = (lastline / 100) - 10;
	int modIndex = (lastline % 100);
	int i;

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

	addlinetomenu(ent, va("%s\n(%d%c)", GetWeaponString(WeaponIndex), V_WeaponUpgradeVal(ent, WeaponIndex), '%'), MENU_GREEN_CENTERED);
	addlinetomenu(ent, va("Weapon points left: %d", ent->myskills.weapon_points), MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, " Select the weapon", 0);
	addlinetomenu(ent, " attribute you want to", 0);
	addlinetomenu(ent, " improve upon.", 0);
	addlinetomenu(ent, " ", 0);

	for (i = 0; i < MAX_WEAPONMODS; ++i)
	{
		char sMod[30];
		int level, cur;
		level = ent->myskills.weapons[WeaponIndex].mods[i].level;
		cur = ent->myskills.weapons[WeaponIndex].mods[i].current_level;
		strcpy(sMod, GetModString(WeaponIndex, i));
		padRight(sMod, 15);
		strcat(sMod, va("%d", level));
		padRight(sMod, 18);
		addlinetomenu(ent, va("%s[%d]", sMod, cur), ((WeaponIndex+10)*100) + i + 1);
	}
		
	setmenuhandler(ent, generalWeaponMenu_handler);

	if (modIndex)
		ent->client->menustorage.currentline = modIndex + 7;
	else
		ent->client->menustorage.currentline = 14;

	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, "Previous Menu", 7777 + WeaponIndex);
	addlinetomenu(ent, "Exit", 6666);

	showmenu(ent);
}
コード例 #3
0
void generalWeaponMenu_handler(edict_t *ent, int option)
{
	int WeaponIndex	= (option / 100)-10;
	int ModIndex	= (option % 100) - 1;
	
	//Are we just navigating?
	if (option == 6666)
	{
		closemenu(ent);
		return;
	}
	else if (option >= 7777)
	{
        int LastWeapon = option - 7777;
		OpenWeaponUpgradeMenu(ent, LastWeapon+1);
		return;
	}

    if (!(ent->myskills.weapons[WeaponIndex].mods[ModIndex].level < ent->myskills.weapons[WeaponIndex].mods[ModIndex].soft_max))
	{
		gi.cprintf(ent, PRINT_HIGH, "You have reached the maximum upgrade level in %s %s (%d).\n",
			GetWeaponString(WeaponIndex), GetModString(WeaponIndex,ModIndex), 
			ent->myskills.weapons[WeaponIndex].mods[ModIndex].soft_max);
		return;
	}

	if (ent->myskills.weapon_points < 1)
	{
		gi.cprintf(ent, PRINT_HIGH, "You are out of weapon points.\n");
		closemenu(ent);
		return;
	}

	ent->myskills.weapons[WeaponIndex].mods[ModIndex].current_level++;
	ent->myskills.weapons[WeaponIndex].mods[ModIndex].level++;
	ent->myskills.weapon_points--;

	gi.cprintf(ent, PRINT_HIGH, "%s %s upgraded to level %d.\n",	GetWeaponString(WeaponIndex),GetModString(WeaponIndex,ModIndex), 
		ent->myskills.weapons[WeaponIndex].mods[ModIndex].current_level);
    
    //Refresh the menu
	OpenGeneralWeaponMenu(ent, option);
}
コード例 #4
0
ファイル: item.c プロジェクト: emmamai/vortex-indy
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;
}