Exemple #1
0
int V_GetRuneAbilityPts(edict_t *ent, item_t *rune)
{
	int i, points=0;

	for (i = 0; i < MAX_VRXITEMMODS; ++i)
	{
		//Ignore mods with no mod type
		if (rune->modifiers[i].type == TYPE_NONE)
			continue;

		//Ignore hidden mods if they don't have enough set items equipped
		if (V_HiddenMod(ent, rune, &rune->modifiers[i]))
			continue;

		if (rune->modifiers[i].type & TYPE_ABILITY)
			points += rune->modifiers[i].value;
	}
	
	if (points < 0)
		return 0;

	return points;
}
Exemple #2
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;
}
Exemple #3
0
void V_ApplyRune(edict_t *ent, item_t *rune)
{
	int i;

	if(!rune->itemtype)	//rune equipped? (double checking in some cases)
		return;
	
	for (i = 0; i < MAX_VRXITEMMODS; ++i)
	{
		//Ignore mods with no mod type
		if (rune->modifiers[i].type == TYPE_NONE)
			continue;

		//Ignore hidden mods if they don't have enough set items equipped
		if (V_HiddenMod(ent, rune, &rune->modifiers[i]))
			continue;

		//The only rune mods to worry about are weapon and ability mods
		if (rune->modifiers[i].type & TYPE_WEAPON)
		{
			int weapon, mod;

			//Which weapon mod is this?
			weapon = (rune->modifiers[i].index / 100) - 10;
			mod	= rune->modifiers[i].index % 100;

			//Better safe than sorry
			if ((mod < 0) || (weapon < 0))
				continue;

			if ((mod < MAX_WEAPONMODS) && (weapon < MAX_WEAPONS))
			{
				//Increase the player's current level
				weaponskill_t *wepmod = &(ent->myskills.weapons[weapon].mods[mod]);
				wepmod->current_level += rune->modifiers[i].value;

				//Cap current_level to the hard maximum
				if ((wepmod->hard_max) && (wepmod->current_level > wepmod->hard_max))
					wepmod->current_level = wepmod->hard_max;
			}
		}
		else if (rune->modifiers[i].type & TYPE_ABILITY)
		{
            int ability;
			ability = rune->modifiers[i].index;

			//Better safe than sorry
			if (ability < 0)
				continue;

			if (ability < MAX_ABILITIES)
			{
				//Increase the player's current level
				upgrade_t *abilitymod = &(ent->myskills.abilities[ability]);
				abilitymod->current_level += rune->modifiers[i].value;

				//Cap current_level to the hard maximum (2 * max for abilities)
				if (abilitymod->current_level > abilitymod->hard_max)
					abilitymod->current_level = abilitymod->hard_max;
			}
		}
	} 	
}