Updated class commands and class editor. Fixed a few compiler warnings.

This commit is contained in:
Richard Helgeby
2013-01-05 21:10:38 +01:00
parent 9096779f53
commit e31d867c57
5 changed files with 164 additions and 28 deletions

View File

@ -1177,6 +1177,10 @@ stock ClassAttributeNameToFlag(const String:attributename[])
{
return ZR_CLASS_IMMUNITY_AMOUNT;
}
else if (StrEqual(attributename, "immunity_cooldown", false))
{
return ZR_CLASS_IMMUNITY_COOLDOWN;
}
else if (StrEqual(attributename, "no_fall_damage", false))
{
return ZR_CLASS_NO_FALL_DAMAGE;
@ -1299,7 +1303,8 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
ZR_CLASS_ALPHA_DAMAGED,
ZR_CLASS_ALPHA_DAMAGE,
ZR_CLASS_FOV,
ZR_CLASS_IMMUNITY_MODE,
ZR_CLASS_IMMUNITY_AMOUNT,
ZR_CLASS_IMMUNITY_COOLDOWN,
ZR_CLASS_HEALTH,
ZR_CLASS_HEALTH_REGEN_AMOUNT,
ZR_CLASS_HEALTH_INFECT_GAIN,
@ -1310,7 +1315,6 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
// Float.
case ZR_CLASS_NAPALM_TIME,
ZR_CLASS_IMMUNITY_AMOUNT,
ZR_CLASS_HEALTH_REGEN_INTERVAL,
ZR_CLASS_SPEED,
ZR_CLASS_KNOCKBACK,
@ -1325,7 +1329,8 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
ZR_CLASS_NAME,
ZR_CLASS_DESCRIPTION,
ZR_CLASS_MODEL_PATH,
ZR_CLASS_OVERLAY_PATH:
ZR_CLASS_OVERLAY_PATH,
ZR_CLASS_IMMUNITY_MODE:
{
return ClassDataType_String;
}

View File

@ -290,7 +290,7 @@ public Action:ClassModifyCommand(client, argc)
StrCat(syntax, sizeof(syntax), "class: The class to modify. Can be any class name, or one of the following team names; all, humans, zombies or admins.\n");
StrCat(syntax, sizeof(syntax), "attribute: The name of the class attribute.\n");
StrCat(syntax, sizeof(syntax), "value: Value to set. Use quotes if value is a string.\n");
StrCat(syntax, sizeof(syntax), "is_multiplier: Optional. specifies wether the original value should be multiplied by the specified value. Not all attributes support multiplying. Defaults to false.\n\n");
StrCat(syntax, sizeof(syntax), "is_multiplier: Optional. specifies wether the original value should be multiplied by the specified value. Not all attributes support multipliers. Defaults to false.\n\n");
StrCat(syntax, sizeof(syntax), "Note: Original values are retrieved from the original class cache, not the modified class cache.");
ReplyToCommand(client, syntax);
@ -734,9 +734,22 @@ stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.
ClassDataCache[classindex][Class_Fov] = value;
return true;
}
case ZR_CLASS_IMMUNITY_MODE:
case ZR_CLASS_IMMUNITY_AMOUNT:
{
ClassDataCache[classindex][Class_ImmunityMode] = value;
if (ismultiplier)
{
value = ClassData[classindex][Class_ImmunityAmount] * value;
}
ClassDataCache[classindex][Class_ImmunityAmount] = value;
return true;
}
case ZR_CLASS_IMMUNITY_COOLDOWN:
{
if (ismultiplier)
{
value = ClassData[classindex][Class_ImmunityCooldown] * value;
}
ClassDataCache[classindex][Class_ImmunityCooldown] = value;
return true;
}
case ZR_CLASS_HEALTH:
@ -811,15 +824,6 @@ stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier
ClassDataCache[classindex][Class_NapalmTime] = value;
return true;
}
case ZR_CLASS_IMMUNITY_AMOUNT:
{
if (ismultiplier)
{
value = ClassData[classindex][Class_ImmunityAmount] * value;
}
ClassDataCache[classindex][Class_ImmunityAmount] = value;
return true;
}
case ZR_CLASS_HEALTH_REGEN_INTERVAL:
{
if (ismultiplier)
@ -914,6 +918,22 @@ stock ClassModifyString(classindex, attributeflag, const String:value[])
strcopy(ClassDataCache[classindex][Class_OverlayPath], PLATFORM_MAX_PATH, value);
return true;
}
case ZR_CLASS_IMMUNITY_MODE:
{
// Convert to mode.
new ImmunityMode:mode = ImmunityStringToMode(value);
// Validate.
if (mode != Immunity_Invalid)
{
ClassDataCache[classindex][Class_ImmunityMode] = mode;
return true;
}
else
{
return false;
}
}
}
// Invalid flag or multiple flags combined.