Added group class attribute, not implemented. Capitalized all class attribute names.

This commit is contained in:
richard 2009-08-13 18:31:21 +02:00
parent 3a82d3d9b0
commit 6a14b952af
5 changed files with 423 additions and 337 deletions

View File

@ -651,8 +651,13 @@ The list below explains all available class attributes in detail:
setting must be set to "motherzombies" for this flag to take setting must be set to "motherzombies" for this flag to take
effect. effect.
Remember that these flags can be used in a combination (1 + 2), so These flags can be used in a combination (1 + 2), so it could be a
it's a mother zombie class for admins only. mother zombie class for admins only.
group text Name of a valid SourceMod group.
---------------------------------------------------------------------------
Rescrict class to members of this SourceMod group. Useful for making
VIP-only classes. Leave blank to allow everyone to use this class.
name text Unique, not empty, max 64 charact. name text Unique, not empty, max 64 charact.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@ -750,8 +755,8 @@ The list below explains all available class attributes in detail:
kill_bonus number 0 - 16 kill_bonus number 0 - 16
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Zombie classes only. How many EXTRA points to give the killer of a Zombie classes only. How many extra points to give the killer of this
zombie. If this is 0, the default value of 1 point will be given. zombie. If this is 0, the default value of 1 point will be given.
speed decimal 10.0 - 2000.0 speed decimal 10.0 - 2000.0
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@ -798,29 +803,30 @@ Attribute flags:
team 2 2 team 2 2
team_default 3 4 team_default 3 4
flags 4 8 flags 4 8
name 5 16 group 5 16
description 6 32 name 6 32
model_path 7 64 description 7 64
alpha_initial 8 128 model_path 8 128
alpha_damaged 9 256 alpha_initial 9 256
alpha_damage 10 512 alpha_damaged 10 512
overlay_path 11 1024 alpha_damage 11 1024
nvgs 12 2048 overlay_path 12 2048
fov 13 4096 nvgs 13 4096
has_napalm 14 8192 fov 14 8192
napalm_time 15 16384 has_napalm 15 16384
immunity_mode 16 32768 napalm_time 16 32768
immunity_amount 17 65536 immunity_mode 17 65536
no_fall_damage 18 131072 immunity_amount 18 131072
health 19 262144 no_fall_damage 19 262144
health_regen_interval 20 524288 health 20 524288
health_regen_amount 21 1048576 health_regen_interval 21 1048576
infect_gain 22 2097152 health_regen_amount 22 2097152
kill_bonus 23 4194304 infect_gain 23 4194304
speed 24 8388608 kill_bonus 24 8388608
knockback 25 16777216 speed 25 16777216
jump_height 26 33554432 knockback 26 33554432
jump_distance 27 67108864 jump_height 27 67108864
jump_distance 28 134217728
The error flags are stored in a bit field (explained in the log configuration The error flags are stored in a bit field (explained in the log configuration
in section 3.2). in section 3.2).

View File

@ -52,15 +52,15 @@ stock bool:ClassIsEnabled(index, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_enabled]; return ClassData[index][Class_Enabled];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_enabled]; return ClassDataCache[index][Class_Enabled];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_enabled]; return ClassPlayerCache[index][Class_Enabled];
} }
} }
return false; return false;
@ -84,15 +84,15 @@ stock ClassGetTeamID(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_team]; return ClassData[index][Class_Team];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_team]; return ClassDataCache[index][Class_Team];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_team]; return ClassPlayerCache[index][Class_Team];
} }
} }
return -1; return -1;
@ -118,15 +118,15 @@ stock bool:ClassGetTeamDefault(index, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_team_default]; return ClassData[index][Class_TeamDefault];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_team_default]; return ClassDataCache[index][Class_TeamDefault];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_team_default]; return ClassPlayerCache[index][Class_TeamDefault];
} }
} }
return false; return false;
@ -151,15 +151,15 @@ stock ClassGetFlags(index, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_flags]; return ClassData[index][Class_Flags];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_flags]; return ClassDataCache[index][Class_Flags];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_flags]; return ClassPlayerCache[index][Class_Flags];
} }
} }
return -1; return -1;
@ -185,20 +185,55 @@ stock bool:ClassHasFlags(index, flags, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return bool:(ClassData[index][class_flags] & flags); return bool:(ClassData[index][Class_Flags] & flags);
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return bool:(ClassDataCache[index][class_flags] & flags); return bool:(ClassDataCache[index][Class_Flags] & flags);
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return bool:(ClassPlayerCache[index][class_flags] & flags); return bool:(ClassPlayerCache[index][Class_Flags] & flags);
} }
} }
return false; return false;
} }
/**
* Gets the class group required to be a member of to use the class.
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param buffer The destination string buffer.
* @param maxlen The length of the destination string buffer.
* @param cachetype Optional. Specifies what class cache to read from. Options:
* ZR_CLASS_CACHE_ORIGINAL - Unchanced class data.
* ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.
* ZR_CLASS_CACHE_PLAYER (default) - Player cache. If this one
* is used, index will be used as a client index.
* @return Number of cells written. -1 on error.
*/
stock ClassGetGroup(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_PLAYER)
{
switch (cachetype)
{
case ZR_CLASS_CACHE_ORIGINAL:
{
return strcopy(buffer, maxlen, ClassData[index][Class_Group]);
}
case ZR_CLASS_CACHE_MODIFIED:
{
return strcopy(buffer, maxlen, ClassDataCache[index][Class_Group]);
}
case ZR_CLASS_CACHE_PLAYER:
{
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Group]);
}
}
return -1;
}
/** /**
* Gets the class name to be displayed in the class menu. * Gets the class name to be displayed in the class menu.
* *
@ -219,15 +254,15 @@ stock ClassGetName(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_PL
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return strcopy(buffer, maxlen, ClassData[index][class_name]); return strcopy(buffer, maxlen, ClassData[index][Class_Name]);
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return strcopy(buffer, maxlen, ClassDataCache[index][class_name]); return strcopy(buffer, maxlen, ClassDataCache[index][Class_Name]);
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return strcopy(buffer, maxlen, ClassPlayerCache[index][class_name]); return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Name]);
} }
} }
@ -254,15 +289,15 @@ stock ClassGetDescription(index, String:buffer[], maxlen, cachetype = ZR_CLASS_C
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return strcopy(buffer, maxlen, ClassData[index][class_description]); return strcopy(buffer, maxlen, ClassData[index][Class_Description]);
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return strcopy(buffer, maxlen, ClassDataCache[index][class_description]); return strcopy(buffer, maxlen, ClassDataCache[index][Class_Description]);
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return strcopy(buffer, maxlen, ClassPlayerCache[index][class_description]); return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Description]);
} }
} }
return -1; return -1;
@ -298,15 +333,15 @@ stock ClassGetModelPath(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CAC
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return strcopy(buffer, maxlen, ClassData[index][class_model_path]); return strcopy(buffer, maxlen, ClassData[index][Class_ModelPath]);
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return strcopy(buffer, maxlen, ClassDataCache[index][class_model_path]); return strcopy(buffer, maxlen, ClassDataCache[index][Class_ModelPath]);
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return strcopy(buffer, maxlen, ClassPlayerCache[index][class_model_path]); return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_ModelPath]);
} }
} }
return -1; return -1;
@ -330,15 +365,15 @@ stock ClassGetAlphaInitial(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_alpha_initial]; return ClassData[index][Class_AlphaInitial];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_alpha_initial]; return ClassDataCache[index][Class_AlphaInitial];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_alpha_initial]; return ClassPlayerCache[index][Class_AlphaInitial];
} }
} }
return -1; return -1;
@ -363,15 +398,15 @@ stock ClassGetAlphaDamaged(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_alpha_damaged]; return ClassData[index][Class_AlphaDamaged];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_alpha_damaged]; return ClassDataCache[index][Class_AlphaDamaged];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_alpha_damaged]; return ClassPlayerCache[index][Class_AlphaDamaged];
} }
} }
return -1; return -1;
@ -396,15 +431,15 @@ stock ClassGetAlphaDamage(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_alpha_damage]; return ClassData[index][Class_AlphaDamage];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_alpha_damage]; return ClassDataCache[index][Class_AlphaDamage];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_alpha_damage]; return ClassPlayerCache[index][Class_AlphaDamage];
} }
} }
return -1; return -1;
@ -440,15 +475,15 @@ stock ClassGetOverlayPath(index, String:buffer[], maxlen, cachetype = ZR_CLASS_C
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return strcopy(buffer, maxlen, ClassData[index][class_overlay_path]); return strcopy(buffer, maxlen, ClassData[index][Class_OverlayPath]);
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return strcopy(buffer, maxlen, ClassDataCache[index][class_overlay_path]); return strcopy(buffer, maxlen, ClassDataCache[index][Class_OverlayPath]);
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return strcopy(buffer, maxlen, ClassPlayerCache[index][class_overlay_path]); return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_OverlayPath]);
} }
} }
return -1; return -1;
@ -472,15 +507,15 @@ stock bool:ClassGetNvgs(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_nvgs]; return ClassData[index][Class_Nvgs];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_nvgs]; return ClassDataCache[index][Class_Nvgs];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_nvgs]; return ClassPlayerCache[index][Class_Nvgs];
} }
} }
return false; return false;
@ -504,15 +539,15 @@ stock ClassGetFOV(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_fov]; return ClassData[index][Class_Fov];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_fov]; return ClassDataCache[index][Class_Fov];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_fov]; return ClassPlayerCache[index][Class_Fov];
} }
} }
return -1; return -1;
@ -546,15 +581,15 @@ stock bool:ClassGetHasNapalm(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_has_napalm]; return ClassData[index][Class_HasNapalm];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_has_napalm]; return ClassDataCache[index][Class_HasNapalm];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_has_napalm]; return ClassPlayerCache[index][Class_HasNapalm];
} }
} }
return false; return false;
@ -580,15 +615,15 @@ stock Float:ClassGetNapalmTime(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_napalm_time]; return ClassData[index][Class_NapalmTime];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_napalm_time]; return ClassDataCache[index][Class_NapalmTime];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_napalm_time] * ClassGetAttributeMultiplier(index, ClassM_NapalmTime); return ClassPlayerCache[index][Class_NapalmTime] * ClassGetAttributeMultiplier(index, ClassM_NapalmTime);
} }
} }
return -1.0; return -1.0;
@ -622,15 +657,15 @@ stock ClassGetImmunityMode(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_immunity_mode]; return ClassData[index][Class_ImmunityMode];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_immunity_mode]; return ClassDataCache[index][Class_ImmunityMode];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_immunity_mode]; return ClassPlayerCache[index][Class_ImmunityMode];
} }
} }
return -1; return -1;
@ -654,15 +689,15 @@ stock Float:ClassGetImmunityAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_immunity_amount]; return ClassData[index][Class_ImmunityAmount];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_immunity_amount]; return ClassDataCache[index][Class_ImmunityAmount];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_immunity_amount]; return ClassPlayerCache[index][Class_ImmunityAmount];
} }
} }
return -1.0; return -1.0;
@ -687,15 +722,15 @@ stock bool:ClassGetNoFallDamage(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_no_fall_damage]; return ClassData[index][Class_NoFallDamage];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_no_fall_damage]; return ClassDataCache[index][Class_NoFallDamage];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_no_fall_damage]; return ClassPlayerCache[index][Class_NoFallDamage];
} }
} }
return false; return false;
@ -721,15 +756,15 @@ stock ClassGetHealth(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_health]; return ClassData[index][Class_Health];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_health]; return ClassDataCache[index][Class_Health];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return RoundToCeil(ClassPlayerCache[index][class_health] * ClassGetAttributeMultiplier(index, ClassM_Health)); return RoundToCeil(ClassPlayerCache[index][Class_Health] * ClassGetAttributeMultiplier(index, ClassM_Health));
} }
} }
return -1; return -1;
@ -756,15 +791,15 @@ stock Float:ClassGetHealthRegenInterval(index, cachetype = ZR_CLASS_CACHE_PLAYER
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_health_regen_interval]; return ClassData[index][Class_HealthRegenInterval];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_health_regen_interval]; return ClassDataCache[index][Class_HealthRegenInterval];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_health_regen_interval] * ClassGetAttributeMultiplier(index, ClassM_HealthRegenInterval); return ClassPlayerCache[index][Class_HealthRegenInterval] * ClassGetAttributeMultiplier(index, ClassM_HealthRegenInterval);
} }
} }
return -1.0; return -1.0;
@ -791,15 +826,15 @@ stock ClassGetHealthRegenAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_health_regen_amount]; return ClassData[index][Class_HealthRegenAmount];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_health_regen_amount]; return ClassDataCache[index][Class_HealthRegenAmount];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return RoundToCeil(ClassPlayerCache[index][class_health_regen_amount] * ClassGetAttributeMultiplier(index, ClassM_HealthRegenAmount)); return RoundToCeil(ClassPlayerCache[index][Class_HealthRegenAmount] * ClassGetAttributeMultiplier(index, ClassM_HealthRegenAmount));
} }
} }
return -1; return -1;
@ -826,15 +861,15 @@ stock ClassGetHealthInfectGain(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_health_infect_gain]; return ClassData[index][Class_HealthInfectGain];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_health_infect_gain]; return ClassDataCache[index][Class_HealthInfectGain];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return RoundToCeil(ClassPlayerCache[index][class_health_infect_gain] * ClassGetAttributeMultiplier(index, ClassM_HealthInfectGain)); return RoundToCeil(ClassPlayerCache[index][Class_HealthInfectGain] * ClassGetAttributeMultiplier(index, ClassM_HealthInfectGain));
} }
} }
return -1; return -1;
@ -858,15 +893,15 @@ stock ClassGetKillBonus(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_kill_bonus]; return ClassData[index][Class_KillBonus];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_kill_bonus]; return ClassDataCache[index][Class_KillBonus];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_kill_bonus]; return ClassPlayerCache[index][Class_KillBonus];
} }
} }
return -1; return -1;
@ -892,15 +927,15 @@ stock Float:ClassGetSpeed(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_speed]; return ClassData[index][Class_Speed];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_speed]; return ClassDataCache[index][Class_Speed];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_speed] * ClassGetAttributeMultiplier(index, ClassM_Speed); return ClassPlayerCache[index][Class_Speed] * ClassGetAttributeMultiplier(index, ClassM_Speed);
} }
} }
return -1.0; return -1.0;
@ -926,15 +961,15 @@ stock Float:ClassGetKnockback(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_knockback]; return ClassData[index][Class_KnockBack];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_knockback]; return ClassDataCache[index][Class_KnockBack];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_knockback] * ClassGetAttributeMultiplier(index, ClassM_Knockback); return ClassPlayerCache[index][Class_KnockBack] * ClassGetAttributeMultiplier(index, ClassM_Knockback);
} }
} }
return 0.0; return 0.0;
@ -960,15 +995,15 @@ stock Float:ClassGetJumpHeight(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_jump_height]; return ClassData[index][Class_JumpHeight];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_jump_height]; return ClassDataCache[index][Class_JumpHeight];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_jump_height] * ClassGetAttributeMultiplier(index, ClassM_JumpHeight); return ClassPlayerCache[index][Class_JumpHeight] * ClassGetAttributeMultiplier(index, ClassM_JumpHeight);
} }
} }
return -1.0; return -1.0;
@ -994,15 +1029,15 @@ stock Float:ClassGetJumpDistance(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
return ClassData[index][class_jump_distance]; return ClassData[index][Class_JumpDistance];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
return ClassDataCache[index][class_jump_distance]; return ClassDataCache[index][Class_JumpDistance];
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
return ClassPlayerCache[index][class_jump_distance] * ClassGetAttributeMultiplier(index, ClassM_JumpDistance); return ClassPlayerCache[index][Class_JumpDistance] * ClassGetAttributeMultiplier(index, ClassM_JumpDistance);
} }
} }
return -1.0; return -1.0;
@ -1034,6 +1069,10 @@ stock ClassAttributeNameToFlag(const String:attributename[])
{ {
return ZR_CLASS_FLAGS; return ZR_CLASS_FLAGS;
} }
else if (StrEqual(attributename, "group", false))
{
return ZR_CLASS_GROUP;
}
else if (StrEqual(attributename, "name", false)) else if (StrEqual(attributename, "name", false))
{ {
return ZR_CLASS_NAME; return ZR_CLASS_NAME;
@ -1230,7 +1269,8 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
} }
// String. // String.
case ZR_CLASS_NAME, case ZR_CLASS_GROUP,
ZR_CLASS_NAME,
ZR_CLASS_DESCRIPTION, ZR_CLASS_DESCRIPTION,
ZR_CLASS_MODEL_PATH, ZR_CLASS_MODEL_PATH,
ZR_CLASS_OVERLAY_PATH: ZR_CLASS_OVERLAY_PATH:

View File

@ -619,22 +619,22 @@ stock bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
{ {
case ZR_CLASS_ENABLED: case ZR_CLASS_ENABLED:
{ {
ClassDataCache[classindex][class_enabled] = bool:value; ClassDataCache[classindex][Class_Enabled] = bool:value;
return true; return true;
} }
case ZR_CLASS_NVGS: case ZR_CLASS_NVGS:
{ {
ClassDataCache[classindex][class_nvgs] = bool:value; ClassDataCache[classindex][Class_Nvgs] = bool:value;
return true; return true;
} }
case ZR_CLASS_NO_FALL_DAMAGE: case ZR_CLASS_NO_FALL_DAMAGE:
{ {
ClassDataCache[classindex][class_no_fall_damage] = bool:value; ClassDataCache[classindex][Class_NoFallDamage] = bool:value;
return true; return true;
} }
case ZR_CLASS_HAS_NAPALM: case ZR_CLASS_HAS_NAPALM:
{ {
ClassDataCache[classindex][class_has_napalm] = bool:value; ClassDataCache[classindex][Class_HasNapalm] = bool:value;
return true; return true;
} }
} }
@ -670,80 +670,80 @@ stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.
{ {
case ZR_CLASS_FLAGS: case ZR_CLASS_FLAGS:
{ {
ClassDataCache[classindex][class_flags] = value; ClassDataCache[classindex][Class_Flags] = value;
return true; return true;
} }
case ZR_CLASS_ALPHA_INITIAL: case ZR_CLASS_ALPHA_INITIAL:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_alpha_initial]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_AlphaInitial]) * multiplier);
} }
ClassDataCache[classindex][class_alpha_initial] = value; ClassDataCache[classindex][Class_AlphaInitial] = value;
return true; return true;
} }
case ZR_CLASS_ALPHA_DAMAGED: case ZR_CLASS_ALPHA_DAMAGED:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_alpha_damaged]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_AlphaDamaged]) * multiplier);
} }
ClassDataCache[classindex][class_alpha_damaged] = value; ClassDataCache[classindex][Class_AlphaDamaged] = value;
return true; return true;
} }
case ZR_CLASS_ALPHA_DAMAGE: case ZR_CLASS_ALPHA_DAMAGE:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_alpha_damage]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_AlphaDamage]) * multiplier);
} }
ClassDataCache[classindex][class_alpha_damage] = value; ClassDataCache[classindex][Class_AlphaDamage] = value;
return true; return true;
} }
case ZR_CLASS_FOV: case ZR_CLASS_FOV:
{ {
ClassDataCache[classindex][class_fov] = value; ClassDataCache[classindex][Class_Fov] = value;
return true; return true;
} }
case ZR_CLASS_IMMUNITY_MODE: case ZR_CLASS_IMMUNITY_MODE:
{ {
ClassDataCache[classindex][class_fov] = value; ClassDataCache[classindex][Class_ImmunityMode] = value;
return true; return true;
} }
case ZR_CLASS_HEALTH: case ZR_CLASS_HEALTH:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_health]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_Health]) * multiplier);
} }
ClassDataCache[classindex][class_health] = value; ClassDataCache[classindex][Class_Health] = value;
return true; return true;
} }
case ZR_CLASS_HEALTH_REGEN_AMOUNT: case ZR_CLASS_HEALTH_REGEN_AMOUNT:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_health_regen_amount]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_HealthRegenAmount]) * multiplier);
} }
ClassDataCache[classindex][class_health_regen_amount] = value; ClassDataCache[classindex][Class_HealthRegenAmount] = value;
return true; return true;
} }
case ZR_CLASS_HEALTH_INFECT_GAIN: case ZR_CLASS_HEALTH_INFECT_GAIN:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_health_infect_gain]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_HealthInfectGain]) * multiplier);
} }
ClassDataCache[classindex][class_health_infect_gain] = value; ClassDataCache[classindex][Class_HealthInfectGain] = value;
return true; return true;
} }
case ZR_CLASS_KILL_BONUS: case ZR_CLASS_KILL_BONUS:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = RoundToNearest(float(ClassData[classindex][class_kill_bonus]) * multiplier); value = RoundToNearest(float(ClassData[classindex][Class_KillBonus]) * multiplier);
} }
ClassDataCache[classindex][class_kill_bonus] = value; ClassDataCache[classindex][Class_KillBonus] = value;
return true; return true;
} }
} }
@ -777,63 +777,63 @@ stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_napalm_time] * value; value = ClassData[classindex][Class_NapalmTime] * value;
} }
ClassDataCache[classindex][class_napalm_time] = value; ClassDataCache[classindex][Class_NapalmTime] = value;
return true; return true;
} }
case ZR_CLASS_IMMUNITY_AMOUNT: case ZR_CLASS_IMMUNITY_AMOUNT:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_immunity_amount] * value; value = ClassData[classindex][Class_ImmunityAmount] * value;
} }
ClassDataCache[classindex][class_immunity_amount] = value; ClassDataCache[classindex][Class_ImmunityAmount] = value;
return true; return true;
} }
case ZR_CLASS_HEALTH_REGEN_INTERVAL: case ZR_CLASS_HEALTH_REGEN_INTERVAL:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_health_regen_interval] * value; value = ClassData[classindex][Class_HealthRegenInterval] * value;
} }
ClassDataCache[classindex][class_health_regen_interval] = value; ClassDataCache[classindex][Class_HealthRegenInterval] = value;
return true; return true;
} }
case ZR_CLASS_SPEED: case ZR_CLASS_SPEED:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_speed] * value; value = ClassData[classindex][Class_Speed] * value;
} }
ClassDataCache[classindex][class_speed] = value; ClassDataCache[classindex][Class_Speed] = value;
return true; return true;
} }
case ZR_CLASS_KNOCKBACK: case ZR_CLASS_KNOCKBACK:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_knockback] * value; value = ClassData[classindex][Class_KnockBack] * value;
} }
ClassDataCache[classindex][class_knockback] = value; ClassDataCache[classindex][Class_KnockBack] = value;
return true; return true;
} }
case ZR_CLASS_JUMP_HEIGHT: case ZR_CLASS_JUMP_HEIGHT:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_jump_height] * value; value = ClassData[classindex][Class_JumpHeight] * value;
} }
ClassDataCache[classindex][class_jump_height] = value; ClassDataCache[classindex][Class_JumpHeight] = value;
return true; return true;
} }
case ZR_CLASS_JUMP_DISTANCE: case ZR_CLASS_JUMP_DISTANCE:
{ {
if (ismultiplier) if (ismultiplier)
{ {
value = ClassData[classindex][class_jump_distance] * value; value = ClassData[classindex][Class_JumpDistance] * value;
} }
ClassDataCache[classindex][class_jump_distance] = value; ClassDataCache[classindex][Class_JumpDistance] = value;
return true; return true;
} }
} }
@ -860,24 +860,29 @@ stock ClassModifyString(classindex, attributeflag, const String:value[])
switch (attributeflag) switch (attributeflag)
{ {
case ZR_CLASS_GROUP:
{
strcopy(ClassDataCache[classindex][Class_Group], 64, value);
return true;
}
case ZR_CLASS_NAME: case ZR_CLASS_NAME:
{ {
strcopy(ClassDataCache[classindex][class_name], 64, value); strcopy(ClassDataCache[classindex][Class_Name], 64, value);
return true; return true;
} }
case ZR_CLASS_DESCRIPTION: case ZR_CLASS_DESCRIPTION:
{ {
strcopy(ClassDataCache[classindex][class_description], 256, value); strcopy(ClassDataCache[classindex][Class_Description], 256, value);
return true; return true;
} }
case ZR_CLASS_MODEL_PATH: case ZR_CLASS_MODEL_PATH:
{ {
strcopy(ClassDataCache[classindex][class_model_path], PLATFORM_MAX_PATH, value); strcopy(ClassDataCache[classindex][Class_ModelPath], PLATFORM_MAX_PATH, value);
return true; return true;
} }
case ZR_CLASS_OVERLAY_PATH: case ZR_CLASS_OVERLAY_PATH:
{ {
strcopy(ClassDataCache[classindex][class_overlay_path], PLATFORM_MAX_PATH, value); strcopy(ClassDataCache[classindex][Class_OverlayPath], PLATFORM_MAX_PATH, value);
return true; return true;
} }
} }

View File

@ -107,26 +107,29 @@ stock ClassValidateAttributes(classindex)
new flags; new flags;
// Team. // Team.
if (ClassData[classindex][class_team] < ZR_CLASS_TEAM_MIN || ClassData[classindex][class_team] > ZR_CLASS_TEAM_MAX) if (ClassData[classindex][Class_Team] < ZR_CLASS_TEAM_MIN || ClassData[classindex][Class_Team] > ZR_CLASS_TEAM_MAX)
{ {
flags += ZR_CLASS_TEAM; flags += ZR_CLASS_TEAM;
} }
// Class flags. // Class flags.
if (ClassData[classindex][class_flags] < ZR_CLASS_FLAGS_MIN || ClassData[classindex][class_flags] > ZR_CLASS_FLAGS_MAX) if (ClassData[classindex][Class_Flags] < ZR_CLASS_FLAGS_MIN || ClassData[classindex][Class_Flags] > ZR_CLASS_FLAGS_MAX)
{ {
flags += ZR_CLASS_FLAGS; flags += ZR_CLASS_FLAGS;
} }
// Group.
// Name. // Name.
if (strlen(ClassData[classindex][class_name]) < ZR_CLASS_NAME_MIN) if (strlen(ClassData[classindex][Class_Name]) < ZR_CLASS_NAME_MIN)
{ {
flags += ZR_CLASS_NAME; flags += ZR_CLASS_NAME;
} }
else else
{ {
decl String:name[64]; decl String:name[64];
strcopy(name, sizeof(name), ClassData[classindex][class_name]); strcopy(name, sizeof(name), ClassData[classindex][Class_Name]);
// Check for reserved name keyworks. These aren't allowed as names. // Check for reserved name keyworks. These aren't allowed as names.
if (StrEqual(name, "all", false) || if (StrEqual(name, "all", false) ||
@ -139,14 +142,14 @@ stock ClassValidateAttributes(classindex)
} }
// Description. // Description.
if (strlen(ClassData[classindex][class_description]) < ZR_CLASS_DESCRIPTION_MIN) if (strlen(ClassData[classindex][Class_Description]) < ZR_CLASS_DESCRIPTION_MIN)
{ {
flags += ZR_CLASS_DESCRIPTION; flags += ZR_CLASS_DESCRIPTION;
} }
// Model path. // Model path.
decl String:model_path[PLATFORM_MAX_PATH]; decl String:model_path[PLATFORM_MAX_PATH];
if (strcopy(model_path, sizeof(model_path), ClassData[classindex][class_model_path]) == 0) if (strcopy(model_path, sizeof(model_path), ClassData[classindex][Class_ModelPath]) == 0)
{ {
flags += ZR_CLASS_MODEL_PATH; flags += ZR_CLASS_MODEL_PATH;
} }
@ -164,21 +167,21 @@ stock ClassValidateAttributes(classindex)
} }
// Alpha, initial. // Alpha, initial.
new alpha_initial = ClassData[classindex][class_alpha_initial]; new alpha_initial = ClassData[classindex][Class_AlphaInitial];
if (!(alpha_initial >= ZR_CLASS_ALPHA_INITIAL_MIN && alpha_initial <= ZR_CLASS_ALPHA_INITIAL_MAX)) if (!(alpha_initial >= ZR_CLASS_ALPHA_INITIAL_MIN && alpha_initial <= ZR_CLASS_ALPHA_INITIAL_MAX))
{ {
flags += ZR_CLASS_ALPHA_INITIAL; flags += ZR_CLASS_ALPHA_INITIAL;
} }
// Alpha, damaged. // Alpha, damaged.
new alpha_damaged = ClassData[classindex][class_alpha_damaged]; new alpha_damaged = ClassData[classindex][Class_AlphaDamaged];
if (!(alpha_damaged >= ZR_CLASS_ALPHA_DAMAGED_MIN && alpha_damaged <= ZR_CLASS_ALPHA_DAMAGED_MAX)) if (!(alpha_damaged >= ZR_CLASS_ALPHA_DAMAGED_MIN && alpha_damaged <= ZR_CLASS_ALPHA_DAMAGED_MAX))
{ {
flags += ZR_CLASS_ALPHA_DAMAGED; flags += ZR_CLASS_ALPHA_DAMAGED;
} }
// Alpha, damage. // Alpha, damage.
new alpha_damage = ClassData[classindex][class_alpha_damage]; new alpha_damage = ClassData[classindex][Class_AlphaDamage];
if (!(alpha_damage >= ZR_CLASS_ALPHA_DAMAGE_MIN && alpha_damage <= ZR_CLASS_ALPHA_DAMAGE_MAX)) if (!(alpha_damage >= ZR_CLASS_ALPHA_DAMAGE_MIN && alpha_damage <= ZR_CLASS_ALPHA_DAMAGE_MAX))
{ {
flags += ZR_CLASS_ALPHA_DAMAGE; flags += ZR_CLASS_ALPHA_DAMAGE;
@ -187,7 +190,7 @@ stock ClassValidateAttributes(classindex)
// Overlay path. // Overlay path.
decl String:overlay_path[PLATFORM_MAX_PATH]; decl String:overlay_path[PLATFORM_MAX_PATH];
decl String:overlay[PLATFORM_MAX_PATH]; decl String:overlay[PLATFORM_MAX_PATH];
if (strcopy(overlay_path, sizeof(overlay_path), ClassData[classindex][class_overlay_path]) > 0) if (strcopy(overlay_path, sizeof(overlay_path), ClassData[classindex][Class_OverlayPath]) > 0)
{ {
// Check if the file exists. // Check if the file exists.
Format(overlay, sizeof(overlay), "materials/%s.vmt", overlay_path); Format(overlay, sizeof(overlay), "materials/%s.vmt", overlay_path);
@ -198,77 +201,80 @@ stock ClassValidateAttributes(classindex)
} }
// Field of view. // Field of view.
new fov = ClassData[classindex][class_fov]; new fov = ClassData[classindex][Class_Fov];
if (!(fov >= ZR_CLASS_FOV_MIN && fov <= ZR_CLASS_FOV_MAX)) if (!(fov >= ZR_CLASS_FOV_MIN && fov <= ZR_CLASS_FOV_MAX))
{ {
flags += ZR_CLASS_FOV; flags += ZR_CLASS_FOV;
} }
// Napalm time. // Napalm time.
new Float:napalm_time = ClassData[classindex][class_napalm_time]; new Float:napalm_time = ClassData[classindex][Class_NapalmTime];
if (!(napalm_time >= ZR_CLASS_NAPALM_TIME_MIN && napalm_time <= ZR_CLASS_NAPALM_TIME_MAX)) if (!(napalm_time >= ZR_CLASS_NAPALM_TIME_MIN && napalm_time <= ZR_CLASS_NAPALM_TIME_MAX))
{ {
flags += ZR_CLASS_NAPALM_TIME; flags += ZR_CLASS_NAPALM_TIME;
} }
// Immunity mode (not implemented).
// Health. // Health.
new health = ClassData[classindex][class_health]; new health = ClassData[classindex][Class_Health];
if (!(health >= ZR_CLASS_HEALTH_MIN && health <= ZR_CLASS_HEALTH_MAX)) if (!(health >= ZR_CLASS_HEALTH_MIN && health <= ZR_CLASS_HEALTH_MAX))
{ {
flags += ZR_CLASS_HEALTH; flags += ZR_CLASS_HEALTH;
} }
// Health regen interval. // Health regen interval.
new Float:regen_interval = ClassData[classindex][class_health_regen_interval]; new Float:regen_interval = ClassData[classindex][Class_HealthRegenInterval];
if (!(regen_interval >= ZR_CLASS_REGEN_INTERVAL_MIN && regen_interval <= ZR_CLASS_REGEN_INTERVAL_MAX)) if (!(regen_interval >= ZR_CLASS_REGEN_INTERVAL_MIN && regen_interval <= ZR_CLASS_REGEN_INTERVAL_MAX))
{ {
flags += ZR_CLASS_HEALTH_REGEN_INTERVAL; flags += ZR_CLASS_HEALTH_REGEN_INTERVAL;
} }
// Health regen amount. // Health regen amount.
new regen_amount = ClassData[classindex][class_health_regen_amount]; new regen_amount = ClassData[classindex][Class_HealthRegenAmount];
if (!(regen_amount >= ZR_CLASS_REGEN_AMOUNT_MIN && regen_amount <= ZR_CLASS_REGEN_AMOUNT_MAX)) if (!(regen_amount >= ZR_CLASS_REGEN_AMOUNT_MIN && regen_amount <= ZR_CLASS_REGEN_AMOUNT_MAX))
{ {
flags += ZR_CLASS_HEALTH_REGEN_AMOUNT; flags += ZR_CLASS_HEALTH_REGEN_AMOUNT;
} }
// Health infect gain. // Health infect gain.
new infect_gain = ClassData[classindex][class_health_infect_gain]; new infect_gain = ClassData[classindex][Class_HealthInfectGain];
if (!(infect_gain >= ZR_CLASS_HEALTH_INFECT_GAIN_MIN && infect_gain <= ZR_CLASS_HEALTH_INFECT_GAIN_MAX)) if (!(infect_gain >= ZR_CLASS_HEALTH_INFECT_GAIN_MIN && infect_gain <= ZR_CLASS_HEALTH_INFECT_GAIN_MAX))
{ {
flags += ZR_CLASS_HEALTH_INFECT_GAIN; flags += ZR_CLASS_HEALTH_INFECT_GAIN;
} }
// Kill bonus. // Kill bonus.
new kill_bonus = ClassData[classindex][class_kill_bonus]; new kill_bonus = ClassData[classindex][Class_KillBonus];
if (!(kill_bonus >= ZR_CLASS_KILL_BONUS_MIN && kill_bonus <= ZR_CLASS_KILL_BONUS_MAX)) if (!(kill_bonus >= ZR_CLASS_KILL_BONUS_MIN && kill_bonus <= ZR_CLASS_KILL_BONUS_MAX))
{ {
flags += ZR_CLASS_KILL_BONUS; flags += ZR_CLASS_KILL_BONUS;
} }
// Speed. // Speed.
new Float:speed = ClassData[classindex][class_speed]; new Float:speed = ClassData[classindex][Class_Speed];
if (!(speed >= ZR_CLASS_SPEED_MIN && speed <= ZR_CLASS_SPEED_MAX)) if (!(speed >= ZR_CLASS_SPEED_MIN && speed <= ZR_CLASS_SPEED_MAX))
{ {
flags += ZR_CLASS_SPEED; flags += ZR_CLASS_SPEED;
} }
// Knockback. // Knockback.
new Float:knockback = ClassData[classindex][class_knockback]; new Float:knockback = ClassData[classindex][Class_KnockBack];
if (!(knockback >= ZR_CLASS_KNOCKBACK_MIN && knockback <= ZR_CLASS_KNOCKBACK_MAX)) if (!(knockback >= ZR_CLASS_KNOCKBACK_MIN && knockback <= ZR_CLASS_KNOCKBACK_MAX))
{ {
flags += ZR_CLASS_KNOCKBACK; flags += ZR_CLASS_KNOCKBACK;
} }
// Jump height. // Jump height.
new Float:jump_height = ClassData[classindex][class_jump_height]; new Float:jump_height = ClassData[classindex][Class_JumpHeight];
if (!(jump_height >= ZR_CLASS_JUMP_HEIGHT_MIN && jump_height <= ZR_CLASS_JUMP_HEIGHT_MAX)) if (!(jump_height >= ZR_CLASS_JUMP_HEIGHT_MIN && jump_height <= ZR_CLASS_JUMP_HEIGHT_MAX))
{ {
flags += ZR_CLASS_JUMP_HEIGHT; flags += ZR_CLASS_JUMP_HEIGHT;
} }
// Jump distance. // Jump distance.
new Float:jump_distance = ClassData[classindex][class_jump_distance]; new Float:jump_distance = ClassData[classindex][Class_JumpDistance];
if (!(jump_distance >= ZR_CLASS_JUMP_DISTANCE_MIN && jump_distance <= ZR_CLASS_JUMP_DISTANCE_MAX)) if (!(jump_distance >= ZR_CLASS_JUMP_DISTANCE_MIN && jump_distance <= ZR_CLASS_JUMP_DISTANCE_MAX))
{ {
flags += ZR_CLASS_JUMP_DISTANCE; flags += ZR_CLASS_JUMP_DISTANCE;
@ -315,21 +321,21 @@ stock bool:ClassTeamCompare(index, teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
if (ClassData[index][class_team] == teamid) if (ClassData[index][Class_Team] == teamid)
{ {
return true; return true;
} }
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
if (ClassDataCache[index][class_team] == teamid) if (ClassDataCache[index][Class_Team] == teamid)
{ {
return true; return true;
} }
} }
case ZR_CLASS_CACHE_PLAYER: case ZR_CLASS_CACHE_PLAYER:
{ {
if (ClassPlayerCache[index][class_team] == teamid) if (ClassPlayerCache[index][Class_Team] == teamid)
{ {
return true; return true;
} }

View File

@ -31,7 +31,7 @@
- Zombies have to hurt humans so they loose hp. When the hp reach zero (or - Zombies have to hurt humans so they loose hp. When the hp reach zero (or
below) they turn into zombies. below) they turn into zombies.
- Fully imune to all damage. Can't take or give damage. Sould only be used - Fully imune to all damage. Can't take or give damage. Sould only be used
on admin classes. on admin mode classes.
TODO: Make class attributes for for changing model render mode and colors. TODO: Make class attributes for for changing model render mode and colors.
@ -104,6 +104,7 @@
#define ZR_CLASS_DEFAULT_TEAM ZR_CLASS_TEAM_ZOMBIES #define ZR_CLASS_DEFAULT_TEAM ZR_CLASS_TEAM_ZOMBIES
#define ZR_CLASS_DEFAULT_TEAM_DEFAULT true #define ZR_CLASS_DEFAULT_TEAM_DEFAULT true
#define ZR_CLASS_DEFAULT_FLAGS 0 #define ZR_CLASS_DEFAULT_FLAGS 0
#define ZR_CLASS_DEFAULT_GROUP ""
#define ZR_CLASS_DEFAULT_NAME "classic" #define ZR_CLASS_DEFAULT_NAME "classic"
#define ZR_CLASS_DEFAULT_DESCRIPTION "Need brains!!! Arrrrggghh!" #define ZR_CLASS_DEFAULT_DESCRIPTION "Need brains!!! Arrrrggghh!"
#define ZR_CLASS_DEFAULT_MODEL_PATH "models/player/zh/zh_zombie003.mdl" #define ZR_CLASS_DEFAULT_MODEL_PATH "models/player/zh/zh_zombie003.mdl"
@ -181,77 +182,94 @@
#define ZR_CLASS_TEAM (1<<1) #define ZR_CLASS_TEAM (1<<1)
#define ZR_CLASS_TEAM_DEFAULT (1<<2) #define ZR_CLASS_TEAM_DEFAULT (1<<2)
#define ZR_CLASS_FLAGS (1<<3) #define ZR_CLASS_FLAGS (1<<3)
#define ZR_CLASS_NAME (1<<4) #define ZR_CLASS_GROUP (1<<4)
#define ZR_CLASS_DESCRIPTION (1<<5) #define ZR_CLASS_NAME (1<<5)
#define ZR_CLASS_MODEL_PATH (1<<6) #define ZR_CLASS_DESCRIPTION (1<<6)
#define ZR_CLASS_ALPHA_INITIAL (1<<7) #define ZR_CLASS_MODEL_PATH (1<<7)
#define ZR_CLASS_ALPHA_DAMAGED (1<<8) #define ZR_CLASS_ALPHA_INITIAL (1<<8)
#define ZR_CLASS_ALPHA_DAMAGE (1<<9) #define ZR_CLASS_ALPHA_DAMAGED (1<<9)
#define ZR_CLASS_OVERLAY_PATH (1<<10) #define ZR_CLASS_ALPHA_DAMAGE (1<<10)
#define ZR_CLASS_NVGS (1<<11) #define ZR_CLASS_OVERLAY_PATH (1<<11)
#define ZR_CLASS_FOV (1<<12) #define ZR_CLASS_NVGS (1<<12)
#define ZR_CLASS_HAS_NAPALM (1<<13) #define ZR_CLASS_FOV (1<<13)
#define ZR_CLASS_NAPALM_TIME (1<<14) #define ZR_CLASS_HAS_NAPALM (1<<14)
#define ZR_CLASS_IMMUNITY_MODE (1<<15) #define ZR_CLASS_NAPALM_TIME (1<<15)
#define ZR_CLASS_IMMUNITY_AMOUNT (1<<16) #define ZR_CLASS_IMMUNITY_MODE (1<<16)
#define ZR_CLASS_NO_FALL_DAMAGE (1<<17) #define ZR_CLASS_IMMUNITY_AMOUNT (1<<17)
#define ZR_CLASS_HEALTH (1<<18) #define ZR_CLASS_NO_FALL_DAMAGE (1<<18)
#define ZR_CLASS_HEALTH_REGEN_INTERVAL (1<<19) #define ZR_CLASS_HEALTH (1<<19)
#define ZR_CLASS_HEALTH_REGEN_AMOUNT (1<<20) #define ZR_CLASS_HEALTH_REGEN_INTERVAL (1<<20)
#define ZR_CLASS_HEALTH_INFECT_GAIN (1<<21) #define ZR_CLASS_HEALTH_REGEN_AMOUNT (1<<21)
#define ZR_CLASS_KILL_BONUS (1<<22) #define ZR_CLASS_HEALTH_INFECT_GAIN (1<<22)
#define ZR_CLASS_SPEED (1<<23) #define ZR_CLASS_KILL_BONUS (1<<23)
#define ZR_CLASS_KNOCKBACK (1<<24) #define ZR_CLASS_SPEED (1<<24)
#define ZR_CLASS_JUMP_HEIGHT (1<<25) #define ZR_CLASS_KNOCKBACK (1<<25)
#define ZR_CLASS_JUMP_DISTANCE (1<<26) #define ZR_CLASS_JUMP_HEIGHT (1<<26)
#define ZR_CLASS_JUMP_DISTANCE (1<<27)
/** /**
* @endsection * @endsection
*/ */
/** /**
* Generic player attributes. * Generic player attributes.
*
* Stuff that must be updated when new attributes are added:
* ZR_CLASS_DEFAULT_... define
* ZR_CLASS_..._MAX/MIN defines
* ZR_CLASS_... define (place in same order as listed in ClassAttributes, bump bit numbers + update numbers in docs)
* ClassLoad
* ClassReloadDataCache
* ClassReloadPlayerCache
* ClassDumpData
* attributes.inc - Add new Get-function
* ClassAttributeNameToFlag
* ClassGetAttributeType
* ClassValidateAttributes
* ClassModify* in classcommands.inc
* Update docs with detailed attribute description
*/ */
enum ClassAttributes enum ClassAttributes
{ {
/* General */ /* General */
bool:class_enabled, bool:Class_Enabled,
class_team, Class_Team,
bool:class_team_default, bool:Class_TeamDefault,
class_flags, Class_Flags,
String:Class_Group[64],
String:class_name[64], String:Class_Name[64],
String:class_description[256], String:Class_Description[256],
/* Model */ /* Model */
String:class_model_path[PLATFORM_MAX_PATH], String:Class_ModelPath[PLATFORM_MAX_PATH],
class_alpha_initial, Class_AlphaInitial,
class_alpha_damaged, Class_AlphaDamaged,
class_alpha_damage, Class_AlphaDamage,
/* Hud */ /* Hud */
String:class_overlay_path[PLATFORM_MAX_PATH], String:Class_OverlayPath[PLATFORM_MAX_PATH],
bool:class_nvgs, bool:Class_Nvgs,
class_fov, Class_Fov,
/* Effects */ /* Effects */
bool:class_has_napalm, bool:Class_HasNapalm,
Float:class_napalm_time, Float:Class_NapalmTime,
/* Player behaviour */ /* Player behaviour */
class_immunity_mode, Class_ImmunityMode,
Float:class_immunity_amount, Float:Class_ImmunityAmount,
bool:class_no_fall_damage, bool:Class_NoFallDamage,
class_health, Class_Health,
Float:class_health_regen_interval, Float:Class_HealthRegenInterval,
class_health_regen_amount, Class_HealthRegenAmount,
class_health_infect_gain, Class_HealthInfectGain,
class_kill_bonus, Class_KillBonus,
Float:class_speed, Float:Class_Speed,
Float:class_knockback, Float:Class_KnockBack,
Float:class_jump_height, Float:Class_JumpHeight,
Float:class_jump_distance Float:Class_JumpDistance
} }
/** /**
@ -435,6 +453,7 @@ ClassLoad(bool:keepMultipliers = false)
} }
decl String:name[64]; decl String:name[64];
decl String:group[64];
decl String:description[256]; decl String:description[256];
decl String:model_path[PLATFORM_MAX_PATH]; decl String:model_path[PLATFORM_MAX_PATH];
decl String:overlay_path[PLATFORM_MAX_PATH]; decl String:overlay_path[PLATFORM_MAX_PATH];
@ -455,55 +474,58 @@ ClassLoad(bool:keepMultipliers = false)
} }
/* General */ /* General */
ClassData[ClassCount][class_enabled] = bool:KvGetNum(kvClassData, "enabled", ZR_CLASS_DEFAULT_ENABLED); ClassData[ClassCount][Class_Enabled] = bool:KvGetNum(kvClassData, "enabled", ZR_CLASS_DEFAULT_ENABLED);
ClassData[ClassCount][class_team] = KvGetNum(kvClassData, "team", ZR_CLASS_DEFAULT_TEAM); ClassData[ClassCount][Class_Team] = KvGetNum(kvClassData, "team", ZR_CLASS_DEFAULT_TEAM);
ClassData[ClassCount][class_team_default] = bool:KvGetNum(kvClassData, "team_default", ZR_CLASS_DEFAULT_TEAM_DEFAULT); ClassData[ClassCount][Class_TeamDefault] = bool:KvGetNum(kvClassData, "team_default", ZR_CLASS_DEFAULT_TEAM_DEFAULT);
ClassData[ClassCount][class_flags] = KvGetNum(kvClassData, "flags", ZR_CLASS_DEFAULT_FLAGS); ClassData[ClassCount][Class_Flags] = KvGetNum(kvClassData, "flags", ZR_CLASS_DEFAULT_FLAGS);
KvGetString(kvClassData, "group", group, sizeof(group), ZR_CLASS_DEFAULT_GROUP);
strcopy(ClassData[ClassCount][Class_Group], 64, group);
KvGetString(kvClassData, "name", name, sizeof(name), ZR_CLASS_DEFAULT_NAME); KvGetString(kvClassData, "name", name, sizeof(name), ZR_CLASS_DEFAULT_NAME);
strcopy(ClassData[ClassCount][class_name], 64, name); strcopy(ClassData[ClassCount][Class_Name], 64, name);
KvGetString(kvClassData, "description", description, sizeof(description), ZR_CLASS_DEFAULT_DESCRIPTION); KvGetString(kvClassData, "description", description, sizeof(description), ZR_CLASS_DEFAULT_DESCRIPTION);
strcopy(ClassData[ClassCount][class_description], 256, description); strcopy(ClassData[ClassCount][Class_Description], 256, description);
/* Model */ /* Model */
KvGetString(kvClassData, "model_path", model_path, sizeof(model_path), ZR_CLASS_DEFAULT_MODEL_PATH); KvGetString(kvClassData, "model_path", model_path, sizeof(model_path), ZR_CLASS_DEFAULT_MODEL_PATH);
strcopy(ClassData[ClassCount][class_model_path], PLATFORM_MAX_PATH, model_path); strcopy(ClassData[ClassCount][Class_ModelPath], PLATFORM_MAX_PATH, model_path);
ClassData[ClassCount][class_alpha_initial] = KvGetNum(kvClassData, "alpha_initial", ZR_CLASS_DEFAULT_ALPHA_INITIAL); ClassData[ClassCount][Class_AlphaInitial] = KvGetNum(kvClassData, "alpha_initial", ZR_CLASS_DEFAULT_ALPHA_INITIAL);
ClassData[ClassCount][class_alpha_damaged] = KvGetNum(kvClassData, "alpha_damaged", ZR_CLASS_DEFAULT_ALPHA_DAMAGED); ClassData[ClassCount][Class_AlphaDamaged] = KvGetNum(kvClassData, "alpha_damaged", ZR_CLASS_DEFAULT_ALPHA_DAMAGED);
ClassData[ClassCount][class_alpha_damage] = KvGetNum(kvClassData, "alpha_damage", ZR_CLASS_DEFAULT_ALPHA_DAMAGE); ClassData[ClassCount][Class_AlphaDamage] = KvGetNum(kvClassData, "alpha_damage", ZR_CLASS_DEFAULT_ALPHA_DAMAGE);
/* Hud */ /* Hud */
KvGetString(kvClassData, "overlay_path", overlay_path, sizeof(overlay_path), ZR_CLASS_DEFAULT_OVERLAY_PATH); KvGetString(kvClassData, "overlay_path", overlay_path, sizeof(overlay_path), ZR_CLASS_DEFAULT_OVERLAY_PATH);
strcopy(ClassData[ClassCount][class_overlay_path], PLATFORM_MAX_PATH, overlay_path); strcopy(ClassData[ClassCount][Class_OverlayPath], PLATFORM_MAX_PATH, overlay_path);
ClassData[ClassCount][class_nvgs] = bool:KvGetNum(kvClassData, "nvgs", ZR_CLASS_DEFAULT_NVGS); ClassData[ClassCount][Class_Nvgs] = bool:KvGetNum(kvClassData, "nvgs", ZR_CLASS_DEFAULT_NVGS);
ClassData[ClassCount][class_fov] = KvGetNum(kvClassData, "fov", ZR_CLASS_DEFAULT_FOV); ClassData[ClassCount][Class_Fov] = KvGetNum(kvClassData, "fov", ZR_CLASS_DEFAULT_FOV);
/* Effects */ /* Effects */
ClassData[ClassCount][class_has_napalm] = bool:KvGetNum(kvClassData, "have_napalm", ZR_CLASS_DEFAULT_HAS_NAPALM); ClassData[ClassCount][Class_HasNapalm] = bool:KvGetNum(kvClassData, "have_napalm", ZR_CLASS_DEFAULT_HAS_NAPALM);
ClassData[ClassCount][class_napalm_time] = KvGetFloat(kvClassData, "napalm_time", ZR_CLASS_DEFAULT_NAPALM_TIME); ClassData[ClassCount][Class_NapalmTime] = KvGetFloat(kvClassData, "napalm_time", ZR_CLASS_DEFAULT_NAPALM_TIME);
/* Player behaviour */ /* Player behaviour */
ClassData[ClassCount][class_immunity_mode] = KvGetNum(kvClassData, "immunity_mode", ZR_CLASS_DEFAULT_IMMUNITY_MODE); ClassData[ClassCount][Class_ImmunityMode] = KvGetNum(kvClassData, "immunity_mode", ZR_CLASS_DEFAULT_IMMUNITY_MODE);
ClassData[ClassCount][class_immunity_amount] = KvGetFloat(kvClassData, "immunity_amount", ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT); ClassData[ClassCount][Class_ImmunityAmount] = KvGetFloat(kvClassData, "immunity_amount", ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT);
ClassData[ClassCount][class_no_fall_damage] = bool:KvGetNum(kvClassData, "no_fall_damage", ZR_CLASS_DEFAULT_NO_FALL_DAMAGE); ClassData[ClassCount][Class_NoFallDamage] = bool:KvGetNum(kvClassData, "no_fall_damage", ZR_CLASS_DEFAULT_NO_FALL_DAMAGE);
ClassData[ClassCount][class_health] = KvGetNum(kvClassData, "health", ZR_CLASS_DEFAULT_HEALTH); ClassData[ClassCount][Class_Health] = KvGetNum(kvClassData, "health", ZR_CLASS_DEFAULT_HEALTH);
ClassData[ClassCount][class_health_regen_interval] = KvGetFloat(kvClassData, "health_regen_interval", ZR_CLASS_DEFAULT_HEALTH_REGEN_INTERVAL); ClassData[ClassCount][Class_HealthRegenInterval] = KvGetFloat(kvClassData, "health_regen_interval", ZR_CLASS_DEFAULT_HEALTH_REGEN_INTERVAL);
ClassData[ClassCount][class_health_regen_amount] = KvGetNum(kvClassData, "health_regen_amount", ZR_CLASS_DEFAULT_HEALTH_REGEN_AMOUNT); ClassData[ClassCount][Class_HealthRegenAmount] = KvGetNum(kvClassData, "health_regen_amount", ZR_CLASS_DEFAULT_HEALTH_REGEN_AMOUNT);
ClassData[ClassCount][class_health_infect_gain] = KvGetNum(kvClassData, "health_infect_gain", ZR_CLASS_DEFAULT_HEALTH_INFECT_GAIN); ClassData[ClassCount][Class_HealthInfectGain] = KvGetNum(kvClassData, "health_infect_gain", ZR_CLASS_DEFAULT_HEALTH_INFECT_GAIN);
ClassData[ClassCount][class_kill_bonus] = KvGetNum(kvClassData, "kill_bonus", ZR_CLASS_DEFAULT_KILL_BONUS); ClassData[ClassCount][Class_KillBonus] = KvGetNum(kvClassData, "kill_bonus", ZR_CLASS_DEFAULT_KILL_BONUS);
ClassData[ClassCount][class_speed] = KvGetFloat(kvClassData, "speed", ZR_CLASS_DEFAULT_SPEED); ClassData[ClassCount][Class_Speed] = KvGetFloat(kvClassData, "speed", ZR_CLASS_DEFAULT_SPEED);
ClassData[ClassCount][class_knockback] = KvGetFloat(kvClassData, "knockback", ZR_CLASS_DEFAULT_KNOCKBACK); ClassData[ClassCount][Class_KnockBack] = KvGetFloat(kvClassData, "knockback", ZR_CLASS_DEFAULT_KNOCKBACK);
ClassData[ClassCount][class_jump_height] = KvGetFloat(kvClassData, "jump_height", ZR_CLASS_DEFAULT_JUMP_HEIGHT); ClassData[ClassCount][Class_JumpHeight] = KvGetFloat(kvClassData, "jump_height", ZR_CLASS_DEFAULT_JUMP_HEIGHT);
ClassData[ClassCount][class_jump_distance] = KvGetFloat(kvClassData, "jump_distance", ZR_CLASS_DEFAULT_JUMP_DISTANCE); ClassData[ClassCount][Class_JumpDistance] = KvGetFloat(kvClassData, "jump_distance", ZR_CLASS_DEFAULT_JUMP_DISTANCE);
// Validate the class attributes. // Validate the class attributes.
ClassErrorFlags = ClassValidateAttributes(ClassCount); ClassErrorFlags = ClassValidateAttributes(ClassCount);
@ -511,7 +533,7 @@ ClassLoad(bool:keepMultipliers = false)
{ {
// There's one or more invalid class attributes. Disable the class // There's one or more invalid class attributes. Disable the class
// and log an error message. // and log an error message.
ClassData[ClassCount][class_enabled] = false; ClassData[ClassCount][Class_Enabled] = false;
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags); LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
failedcount++; failedcount++;
@ -589,41 +611,42 @@ bool:ClassReloadDataCache()
for (new classindex = 0; classindex < ClassCount; classindex++) for (new classindex = 0; classindex < ClassCount; classindex++)
{ {
/* General */ /* General */
ClassDataCache[classindex][class_enabled] = ClassData[classindex][class_enabled]; ClassDataCache[classindex][Class_Enabled] = ClassData[classindex][Class_Enabled];
ClassDataCache[classindex][class_team] = ClassData[classindex][class_team]; ClassDataCache[classindex][Class_Team] = ClassData[classindex][Class_Team];
ClassDataCache[classindex][class_team_default] = ClassData[classindex][class_team_default]; ClassDataCache[classindex][Class_TeamDefault] = ClassData[classindex][Class_TeamDefault];
ClassDataCache[classindex][class_flags] = ClassData[classindex][class_flags]; ClassDataCache[classindex][Class_Flags] = ClassData[classindex][Class_Flags];
strcopy(ClassDataCache[classindex][class_name], 64, ClassData[classindex][class_name]); strcopy(ClassDataCache[classindex][Class_Group], 64, ClassData[classindex][Class_Group]);
strcopy(ClassDataCache[classindex][class_description], 256, ClassData[classindex][class_description]); strcopy(ClassDataCache[classindex][Class_Name], 64, ClassData[classindex][Class_Name]);
strcopy(ClassDataCache[classindex][Class_Description], 256, ClassData[classindex][Class_Description]);
/* Model */ /* Model */
strcopy(ClassDataCache[classindex][class_model_path], PLATFORM_MAX_PATH, ClassData[classindex][class_model_path]); strcopy(ClassDataCache[classindex][Class_ModelPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_ModelPath]);
ClassDataCache[classindex][class_alpha_initial] = ClassData[classindex][class_alpha_initial]; ClassDataCache[classindex][Class_AlphaInitial] = ClassData[classindex][Class_AlphaInitial];
ClassDataCache[classindex][class_alpha_damaged] = ClassData[classindex][class_alpha_damaged]; ClassDataCache[classindex][Class_AlphaDamaged] = ClassData[classindex][Class_AlphaDamaged];
ClassDataCache[classindex][class_alpha_damage] = ClassData[classindex][class_alpha_damage]; ClassDataCache[classindex][Class_AlphaDamage] = ClassData[classindex][Class_AlphaDamage];
/* Hud */ /* Hud */
strcopy(ClassDataCache[classindex][class_overlay_path], PLATFORM_MAX_PATH, ClassData[classindex][class_overlay_path]); strcopy(ClassDataCache[classindex][Class_OverlayPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_OverlayPath]);
ClassDataCache[classindex][class_nvgs] = ClassData[classindex][class_nvgs]; ClassDataCache[classindex][Class_Nvgs] = ClassData[classindex][Class_Nvgs];
ClassDataCache[classindex][class_fov] = ClassData[classindex][class_fov]; ClassDataCache[classindex][Class_Fov] = ClassData[classindex][Class_Fov];
/* Effects */ /* Effects */
ClassDataCache[classindex][class_has_napalm] = ClassData[classindex][class_has_napalm]; ClassDataCache[classindex][Class_HasNapalm] = ClassData[classindex][Class_HasNapalm];
ClassDataCache[classindex][class_napalm_time] = ClassData[classindex][class_napalm_time]; ClassDataCache[classindex][Class_NapalmTime] = ClassData[classindex][Class_NapalmTime];
/* Player behaviour */ /* Player behaviour */
ClassDataCache[classindex][class_immunity_mode] = ClassData[classindex][class_immunity_mode]; ClassDataCache[classindex][Class_ImmunityMode] = ClassData[classindex][Class_ImmunityMode];
ClassDataCache[classindex][class_immunity_amount] = ClassData[classindex][class_immunity_amount]; ClassDataCache[classindex][Class_ImmunityAmount] = ClassData[classindex][Class_ImmunityAmount];
ClassDataCache[classindex][class_no_fall_damage] = ClassData[classindex][class_no_fall_damage]; ClassDataCache[classindex][Class_NoFallDamage] = ClassData[classindex][Class_NoFallDamage];
ClassDataCache[classindex][class_health] = ClassData[classindex][class_health]; ClassDataCache[classindex][Class_Health] = ClassData[classindex][Class_Health];
ClassDataCache[classindex][class_health_regen_interval] = ClassData[classindex][class_health_regen_interval]; ClassDataCache[classindex][Class_HealthRegenInterval] = ClassData[classindex][Class_HealthRegenInterval];
ClassDataCache[classindex][class_health_regen_amount] = ClassData[classindex][class_health_regen_amount]; ClassDataCache[classindex][Class_HealthRegenAmount] = ClassData[classindex][Class_HealthRegenAmount];
ClassDataCache[classindex][class_health_infect_gain] = ClassData[classindex][class_health_infect_gain]; ClassDataCache[classindex][Class_HealthInfectGain] = ClassData[classindex][Class_HealthInfectGain];
ClassDataCache[classindex][class_kill_bonus] = ClassData[classindex][class_kill_bonus]; ClassDataCache[classindex][Class_KillBonus] = ClassData[classindex][Class_KillBonus];
ClassDataCache[classindex][class_speed] = ClassData[classindex][class_speed]; ClassDataCache[classindex][Class_Speed] = ClassData[classindex][Class_Speed];
ClassDataCache[classindex][class_knockback] = ClassData[classindex][class_knockback]; ClassDataCache[classindex][Class_KnockBack] = ClassData[classindex][Class_KnockBack];
ClassDataCache[classindex][class_jump_height] = ClassData[classindex][class_jump_height]; ClassDataCache[classindex][Class_JumpHeight] = ClassData[classindex][Class_JumpHeight];
ClassDataCache[classindex][class_jump_distance] = ClassData[classindex][class_jump_distance]; ClassDataCache[classindex][Class_JumpDistance] = ClassData[classindex][Class_JumpDistance];
} }
return true; return true;
@ -653,80 +676,82 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
case ZR_CLASS_CACHE_ORIGINAL: case ZR_CLASS_CACHE_ORIGINAL:
{ {
/* General */ /* General */
ClassPlayerCache[client][class_enabled] = ClassData[classindex][class_enabled]; ClassPlayerCache[client][Class_Enabled] = ClassData[classindex][Class_Enabled];
ClassPlayerCache[client][class_team] = ClassData[classindex][class_team]; ClassPlayerCache[client][Class_Team] = ClassData[classindex][Class_Team];
ClassPlayerCache[client][class_team_default] = ClassData[classindex][class_team_default]; ClassPlayerCache[client][Class_TeamDefault] = ClassData[classindex][Class_TeamDefault];
ClassPlayerCache[client][class_flags] = ClassData[classindex][class_flags]; ClassPlayerCache[client][Class_Flags] = ClassData[classindex][Class_Flags];
strcopy(ClassPlayerCache[client][class_name], 64, ClassData[classindex][class_name]); strcopy(ClassPlayerCache[client][Class_Group], 64, ClassData[classindex][Class_Group]);
strcopy(ClassPlayerCache[client][class_description], 256, ClassData[classindex][class_description]); strcopy(ClassPlayerCache[client][Class_Name], 64, ClassData[classindex][Class_Name]);
strcopy(ClassPlayerCache[client][Class_Description], 256, ClassData[classindex][Class_Description]);
/* Model */ /* Model */
strcopy(ClassPlayerCache[client][class_model_path], PLATFORM_MAX_PATH, ClassData[classindex][class_model_path]); strcopy(ClassPlayerCache[client][Class_ModelPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_ModelPath]);
ClassPlayerCache[client][class_alpha_initial] = ClassData[classindex][class_alpha_initial]; ClassPlayerCache[client][Class_AlphaInitial] = ClassData[classindex][Class_AlphaInitial];
ClassPlayerCache[client][class_alpha_damaged] = ClassData[classindex][class_alpha_damaged]; ClassPlayerCache[client][Class_AlphaDamaged] = ClassData[classindex][Class_AlphaDamaged];
ClassPlayerCache[client][class_alpha_damage] = ClassData[classindex][class_alpha_damage]; ClassPlayerCache[client][Class_AlphaDamage] = ClassData[classindex][Class_AlphaDamage];
/* Hud */ /* Hud */
strcopy(ClassPlayerCache[client][class_overlay_path], PLATFORM_MAX_PATH, ClassData[classindex][class_overlay_path]); strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_OverlayPath]);
ClassPlayerCache[client][class_nvgs] = ClassData[classindex][class_nvgs]; ClassPlayerCache[client][Class_Nvgs] = ClassData[classindex][Class_Nvgs];
ClassPlayerCache[client][class_fov] = ClassData[classindex][class_fov]; ClassPlayerCache[client][Class_Fov] = ClassData[classindex][Class_Fov];
/* Effects */ /* Effects */
ClassPlayerCache[client][class_has_napalm] = ClassData[classindex][class_has_napalm]; ClassPlayerCache[client][Class_HasNapalm] = ClassData[classindex][Class_HasNapalm];
ClassPlayerCache[client][class_napalm_time] = ClassData[classindex][class_napalm_time]; ClassPlayerCache[client][Class_NapalmTime] = ClassData[classindex][Class_NapalmTime];
/* Player behaviour */ /* Player behaviour */
ClassPlayerCache[client][class_immunity_mode] = ClassData[classindex][class_immunity_mode]; ClassPlayerCache[client][Class_ImmunityMode] = ClassData[classindex][Class_ImmunityMode];
ClassPlayerCache[client][class_immunity_amount] = ClassData[classindex][class_immunity_amount]; ClassPlayerCache[client][Class_ImmunityAmount] = ClassData[classindex][Class_ImmunityAmount];
ClassPlayerCache[client][class_no_fall_damage] = ClassData[classindex][class_no_fall_damage]; ClassPlayerCache[client][Class_NoFallDamage] = ClassData[classindex][Class_NoFallDamage];
ClassPlayerCache[client][class_health] = ClassData[classindex][class_health]; ClassPlayerCache[client][Class_Health] = ClassData[classindex][Class_Health];
ClassPlayerCache[client][class_health_regen_interval] = ClassData[classindex][class_health_regen_interval]; ClassPlayerCache[client][Class_HealthRegenInterval] = ClassData[classindex][Class_HealthRegenInterval];
ClassPlayerCache[client][class_health_regen_amount] = ClassData[classindex][class_health_regen_amount]; ClassPlayerCache[client][Class_HealthRegenAmount] = ClassData[classindex][Class_HealthRegenAmount];
ClassPlayerCache[client][class_health_infect_gain] = ClassData[classindex][class_health_infect_gain]; ClassPlayerCache[client][Class_HealthInfectGain] = ClassData[classindex][Class_HealthInfectGain];
ClassPlayerCache[client][class_kill_bonus] = ClassData[classindex][class_kill_bonus]; ClassPlayerCache[client][Class_KillBonus] = ClassData[classindex][Class_KillBonus];
ClassPlayerCache[client][class_speed] = ClassData[classindex][class_speed]; ClassPlayerCache[client][Class_Speed] = ClassData[classindex][Class_Speed];
ClassPlayerCache[client][class_knockback] = ClassData[classindex][class_knockback]; ClassPlayerCache[client][Class_KnockBack] = ClassData[classindex][Class_KnockBack];
ClassPlayerCache[client][class_jump_height] = ClassData[classindex][class_jump_height]; ClassPlayerCache[client][Class_JumpHeight] = ClassData[classindex][Class_JumpHeight];
ClassPlayerCache[client][class_jump_distance] = ClassData[classindex][class_jump_distance]; ClassPlayerCache[client][Class_JumpDistance] = ClassData[classindex][Class_JumpDistance];
} }
case ZR_CLASS_CACHE_MODIFIED: case ZR_CLASS_CACHE_MODIFIED:
{ {
/* General */ /* General */
ClassPlayerCache[client][class_enabled] = ClassDataCache[classindex][class_enabled]; ClassPlayerCache[client][Class_Enabled] = ClassDataCache[classindex][Class_Enabled];
ClassPlayerCache[client][class_team] = ClassDataCache[classindex][class_team]; ClassPlayerCache[client][Class_Team] = ClassDataCache[classindex][Class_Team];
ClassPlayerCache[client][class_team_default] = ClassDataCache[classindex][class_team_default]; ClassPlayerCache[client][Class_TeamDefault] = ClassDataCache[classindex][Class_TeamDefault];
ClassPlayerCache[client][class_flags] = ClassDataCache[classindex][class_flags]; ClassPlayerCache[client][Class_Flags] = ClassDataCache[classindex][Class_Flags];
strcopy(ClassPlayerCache[client][class_name], 64, ClassDataCache[classindex][class_name]); strcopy(ClassPlayerCache[client][Class_Group], 64, ClassDataCache[classindex][Class_Group]);
strcopy(ClassPlayerCache[client][class_description], 256, ClassDataCache[classindex][class_description]); strcopy(ClassPlayerCache[client][Class_Name], 64, ClassDataCache[classindex][Class_Name]);
strcopy(ClassPlayerCache[client][Class_Description], 256, ClassDataCache[classindex][Class_Description]);
/* Model */ /* Model */
strcopy(ClassPlayerCache[client][class_model_path], PLATFORM_MAX_PATH, ClassDataCache[classindex][class_model_path]); strcopy(ClassPlayerCache[client][Class_ModelPath], PLATFORM_MAX_PATH, ClassDataCache[classindex][Class_ModelPath]);
ClassPlayerCache[client][class_alpha_initial] = ClassDataCache[classindex][class_alpha_initial]; ClassPlayerCache[client][Class_AlphaInitial] = ClassDataCache[classindex][Class_AlphaInitial];
ClassPlayerCache[client][class_alpha_damaged] = ClassDataCache[classindex][class_alpha_damaged]; ClassPlayerCache[client][Class_AlphaDamaged] = ClassDataCache[classindex][Class_AlphaDamaged];
ClassPlayerCache[client][class_alpha_damage] = ClassDataCache[classindex][class_alpha_damage]; ClassPlayerCache[client][Class_AlphaDamage] = ClassDataCache[classindex][Class_AlphaDamage];
/* Hud */ /* Hud */
strcopy(ClassPlayerCache[client][class_overlay_path], PLATFORM_MAX_PATH, ClassDataCache[classindex][class_overlay_path]); strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, ClassDataCache[classindex][Class_OverlayPath]);
ClassPlayerCache[client][class_nvgs] = ClassDataCache[classindex][class_nvgs]; ClassPlayerCache[client][Class_Nvgs] = ClassDataCache[classindex][Class_Nvgs];
ClassPlayerCache[client][class_fov] = ClassDataCache[classindex][class_fov]; ClassPlayerCache[client][Class_Fov] = ClassDataCache[classindex][Class_Fov];
/* Effects */ /* Effects */
ClassPlayerCache[client][class_has_napalm] = ClassDataCache[classindex][class_has_napalm]; ClassPlayerCache[client][Class_HasNapalm] = ClassDataCache[classindex][Class_HasNapalm];
ClassPlayerCache[client][class_napalm_time] = ClassDataCache[classindex][class_napalm_time]; ClassPlayerCache[client][Class_NapalmTime] = ClassDataCache[classindex][Class_NapalmTime];
/* Player behaviour */ /* Player behaviour */
ClassPlayerCache[client][class_immunity_mode] = ClassDataCache[classindex][class_immunity_mode]; ClassPlayerCache[client][Class_ImmunityMode] = ClassDataCache[classindex][Class_ImmunityMode];
ClassPlayerCache[client][class_immunity_amount] = ClassDataCache[classindex][class_immunity_amount]; ClassPlayerCache[client][Class_ImmunityAmount] = ClassDataCache[classindex][Class_ImmunityAmount];
ClassPlayerCache[client][class_no_fall_damage] = ClassDataCache[classindex][class_no_fall_damage]; ClassPlayerCache[client][Class_NoFallDamage] = ClassDataCache[classindex][Class_NoFallDamage];
ClassPlayerCache[client][class_health] = ClassDataCache[classindex][class_health]; ClassPlayerCache[client][Class_Health] = ClassDataCache[classindex][Class_Health];
ClassPlayerCache[client][class_health_regen_interval] = ClassDataCache[classindex][class_health_regen_interval]; ClassPlayerCache[client][Class_HealthRegenInterval] = ClassDataCache[classindex][Class_HealthRegenInterval];
ClassPlayerCache[client][class_health_regen_amount] = ClassDataCache[classindex][class_health_regen_amount]; ClassPlayerCache[client][Class_HealthRegenAmount] = ClassDataCache[classindex][Class_HealthRegenAmount];
ClassPlayerCache[client][class_health_infect_gain] = ClassDataCache[classindex][class_health_infect_gain]; ClassPlayerCache[client][Class_HealthInfectGain] = ClassDataCache[classindex][Class_HealthInfectGain];
ClassPlayerCache[client][class_kill_bonus] = ClassDataCache[classindex][class_kill_bonus]; ClassPlayerCache[client][Class_KillBonus] = ClassDataCache[classindex][Class_KillBonus];
ClassPlayerCache[client][class_speed] = ClassDataCache[classindex][class_speed]; ClassPlayerCache[client][Class_Speed] = ClassDataCache[classindex][Class_Speed];
ClassPlayerCache[client][class_knockback] = ClassDataCache[classindex][class_knockback]; ClassPlayerCache[client][Class_KnockBack] = ClassDataCache[classindex][Class_KnockBack];
ClassPlayerCache[client][class_jump_height] = ClassDataCache[classindex][class_jump_height]; ClassPlayerCache[client][Class_JumpHeight] = ClassDataCache[classindex][Class_JumpHeight];
ClassPlayerCache[client][class_jump_distance] = ClassDataCache[classindex][class_jump_distance]; ClassPlayerCache[client][Class_JumpDistance] = ClassDataCache[classindex][Class_JumpDistance];
} }
default: default:
{ {
@ -786,7 +811,7 @@ ClassResetMultiplierCache()
} }
/** /**
* Resets the selected class indexes for next span on one or all clients. * Resets the selected class indexes for next spawn on one or all clients.
* *
* @param client Optional. Specify client to reset. Default is all. * @param client Optional. Specify client to reset. Default is all.
*/ */
@ -818,7 +843,7 @@ ClassResetNextIndexes(client = -1)
* Note: Does not apply attributes. The classes are only marked as selected. * Note: Does not apply attributes. The classes are only marked as selected.
* *
* @param client The client index. * @param client The client index.
* @param excludeTeam Do not restore the specified team. * @param excludeTeam Optional. Do not restore the specified team.
*/ */
ClassRestoreNextIndexes(client, excludeTeam = -1) ClassRestoreNextIndexes(client, excludeTeam = -1)
{ {
@ -980,6 +1005,10 @@ ClassDumpData(index, cachetype, String:buffer[], maxlen)
Format(attribute, sizeof(attribute), "flags: \"%d\"\n", ClassGetFlags(index, cachetype)); Format(attribute, sizeof(attribute), "flags: \"%d\"\n", ClassGetFlags(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute); cellcount += StrCat(buffer, maxlen, attribute);
ClassGetGroup(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "group: \"%d\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetName(index, format_buffer, sizeof(format_buffer), cachetype); ClassGetName(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "name: \"%s\"\n", format_buffer); Format(attribute, sizeof(attribute), "name: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute); cellcount += StrCat(buffer, maxlen, attribute);