Ejemplo n.º 1
0
void G_CalcRank( gclient_t* client ) {
	int i, highestskill = 0;

	for( i = 0; i < SK_NUM_SKILLS; i++ ) {
		G_SetPlayerSkill( client, i );
		if( client->sess.skill[i] > highestskill ) {
			highestskill = client->sess.skill[i];
		}
	}

	// set rank
	client->sess.rank = highestskill;

	if( client->sess.rank >=4 ) {
		int cnt = 0;

		// Gordon: count the number of maxed out skills
		for( i = 0; i < SK_NUM_SKILLS; i++ ) {
			if( client->sess.skill[ i ] >= 4 ) {
				cnt++;
			}
		}

		client->sess.rank = cnt + 3;
		if( client->sess.rank > 10 ) {
			client->sess.rank = 10;
		}
	}
}
Ejemplo n.º 2
0
void G_LoseSkillPoints(gentity_t *ent, skillType_t skill, float points)
{
	int             oldskill;
	float           oldskillpoints;

	if (!ent->client)
	{
		return;
	}

	// no skill loss during warmup
	if (g_gamestate.integer != GS_PLAYING)
	{
		return;
	}

	if (ent->client->sess.sessionTeam != TEAM_AXIS && ent->client->sess.sessionTeam != TEAM_ALLIES)
	{
		return;
	}

	if (g_gametype.integer == GT_WOLF_LMS)
	{
		return;					// Gordon: no xp in LMS
	}

	oldskillpoints = ent->client->sess.skillpoints[skill];
	ent->client->sess.skillpoints[skill] -= points;

	// see if player increased in skill
	oldskill = ent->client->sess.skill[skill];
	G_SetPlayerSkill(ent->client, skill);

	if (oldskill != ent->client->sess.skill[skill])
	{
		ent->client->sess.skill[skill] = oldskill;
		ent->client->sess.skillpoints[skill] = skillLevels[oldskill];
	}

	G_Printf("%s just lost %f skill points for skill %s\n", ent->client->pers.netname,
	         oldskillpoints - ent->client->sess.skillpoints[skill], skillNames[skill]);

	trap_PbStat(ent - g_entities, "loseskill",
	            va("%d %d %d %f", ent->client->sess.sessionTeam, ent->client->sess.playerType,
	               skill, oldskillpoints - ent->client->sess.skillpoints[skill]));

	level.teamScores[ent->client->ps.persistant[PERS_TEAM]] -= oldskillpoints - ent->client->sess.skillpoints[skill];
	level.teamXP[skill][ent->client->sess.sessionTeam - TEAM_AXIS] -= oldskillpoints - ent->client->sess.skillpoints[skill];
}
Ejemplo n.º 3
0
void G_AddSkillPoints(gentity_t *ent, skillType_t skill, float points)
{
	int             oldskill;

	if (!ent->client)
	{
		return;
	}

	// no skill gaining during warmup
	if (g_gamestate.integer != GS_PLAYING)
	{
		return;
	}

	if (ent->client->sess.sessionTeam != TEAM_AXIS && ent->client->sess.sessionTeam != TEAM_ALLIES)
	{
		return;
	}

	if (g_gametype.integer == GT_WOLF_LMS)
	{
		return;					// Gordon: no xp in LMS
	}

	level.teamXP[skill][ent->client->sess.sessionTeam - TEAM_AXIS] += points;

	ent->client->sess.skillpoints[skill] += points;

	level.teamScores[ent->client->ps.persistant[PERS_TEAM]] += points;

//  G_Printf( "%s just got %f skill points for skill %s\n", ent->client->pers.netname, points, skillNames[skill] );

	trap_PbStat(ent - g_entities, "addskill",
	            va("%d %d %d %f", ent->client->sess.sessionTeam, ent->client->sess.playerType, skill, points));

	// see if player increased in skill
	oldskill = ent->client->sess.skill[skill];
	G_SetPlayerSkill(ent->client, skill);

	if (oldskill != ent->client->sess.skill[skill])
	{
		// TAT - call the new func that encapsulates the skill giving behavior
		G_UpgradeSkill(ent, skill);
	}
}
Ejemplo n.º 4
0
/**
 * @brief G_LoseSkillPoints
 * @param[in,out] ent
 * @param[in] skill
 * @param[in] points
 */
void G_LoseSkillPoints(gentity_t *ent, skillType_t skill, float points)
{
	int   oldskill;
	float oldskillpoints;

	if (!ent->client)
	{
		return;
	}

	// no skill loss during warmup
	if (g_gamestate.integer != GS_PLAYING)
	{
		return;
	}

	if (ent->client->sess.sessionTeam != TEAM_AXIS && ent->client->sess.sessionTeam != TEAM_ALLIES)
	{
		return;
	}

	if (g_gametype.integer == GT_WOLF_LMS)
	{
		return; // no xp in LMS
	}

	oldskillpoints                        = ent->client->sess.skillpoints[skill];
	ent->client->sess.skillpoints[skill] -= points;

	// see if player increased in skill
	oldskill = ent->client->sess.skill[skill];
	G_SetPlayerSkill(ent->client, skill);
	if (oldskill != ent->client->sess.skill[skill])
	{
		ent->client->sess.skill[skill]       = oldskill;
		ent->client->sess.skillpoints[skill] = GetSkillTableData(skill)->skillLevels[oldskill];
	}

	G_Printf("%s ^7just lost %.0f skill points for skill %s\n", ent->client->pers.netname, (double)(oldskillpoints - ent->client->sess.skillpoints[skill]), GetSkillTableData(skill)->skillNames);

	level.teamScores[ent->client->ps.persistant[PERS_TEAM]]        -= oldskillpoints - ent->client->sess.skillpoints[skill];
	level.teamXP[skill][ent->client->sess.sessionTeam - TEAM_AXIS] -= oldskillpoints - ent->client->sess.skillpoints[skill];

	// prepare scoreboard
	CalculateRanks();
}