Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points system rework #28

Merged
merged 6 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cstrike/addons/amxmodx/configs/regg/regg-levels.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,52 @@ weapon=weapon_glock18
title=Deagle
weapon=weapon_deagle
points=2
mod=100
ratio=100

[LEVEL]
title=USP
weapon=weapon_usp
points=2
mod=100
ratio=100

[LEVEL]
title=Glock-18
weapon=weapon_glock18
points=2
mod=100
ratio=100

[LEVEL]
title=M4A1
weapon=weapon_m4a1
points=3
mod=100
ratio=100

[LEVEL]
title=AK-47
weapon=weapon_ak47
points=3
mod=100
ratio=100

[LEVEL]
title=Scout
weapon=weapon_scout
points=2
mod=100
ratio=100

[LEVEL]
title=AWP
weapon=weapon_awp
points=2
mod=100
ratio=100

[LEVEL]
title=Hegrenade
weapon=weapon_hegrenade
points=1
mod=50
ratio=50

[LEVEL]
title=Knife
weapon=weapon_knife
points=1
mod=33
ratio=33
16 changes: 11 additions & 5 deletions cstrike/addons/amxmodx/configs/regg/regg-main.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ regg_mode "0"

// Режим Knife Pro позволяет украсть посредством
// убийства с ножа уровень либо очки
// Настройка не распространяется на режим командной игры
// 0 - отключено
// 1 - кража уровня
// 2 - кража очков
// 1 - кража количества уровней, указанных в настройке regg_steal_value
// 2 - кража количества очков, указанных в настройке regg_steal_value
// 3 - кража количества очков, необходимых для уровня из настроек regg-level.ini (points)
regg_steal_mode "1"

// Количество украденных очков или уровня (Режим Knife Pro)
regg_steal_value "1"

// Количество украденных очков (Knife Pro) в режиме командной игры
regg_team_steal_value "3"
// Очки полученные в ходе убийства с ножа
// при включенном regg_steal_mode, переходят на следующий уровень
// например у вас 3/4, вы украли очки у соперника 3 очка,
// на новом уровне у вас будет 2/4, если отключено 0/4
// ОТКЛЮЧЕНО НА УРОВНЕ НОЖА И ГРАНАТЫ, ВСЕГДА БУДЕТ ПРИ ПЕРЕХОДЕ 0
// 0 - отключено
// 1 - включено
regg_rolling_points "1"

// Смена карты, какой плагин использовать
// 0 - ReGG Map Manager, a random map from the maplist (maps.ini or mapcycle.txt)
Expand Down
17 changes: 9 additions & 8 deletions cstrike/addons/amxmodx/scripting/regg/config.inl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
enum _:config_s {
CfgStealMode,
CfgStealValue,
CfgTeamStealValue,
CfgRollingPoints,
CfgAWPOneShot,
CfgAmmoAmount,
CfgRefillOnKill,
Expand Down Expand Up @@ -52,13 +52,12 @@ new Config[config_s];
new GameCvars[game_cvars_s];

registerCvars() {
// 0 - off, 1 - steal level, 2 - steal points
bind_pcvar_num(create_cvar(
"regg_steal_mode", "1",
.has_min = true,
.min_val = 0.0,
.has_max = true,
.max_val = 2.0
.max_val = 3.0
), Config[CfgStealMode]);

bind_pcvar_num(create_cvar(
Expand All @@ -68,10 +67,12 @@ registerCvars() {
), Config[CfgStealValue]);

bind_pcvar_num(create_cvar(
"regg_team_steal_value", "3",
"regg_rolling_points", "1",
.has_min = true,
.min_val = 1.0
), Config[CfgTeamStealValue]);
.min_val = 0.0,
.has_max = true,
.max_val = 1.0
), Config[CfgRollingPoints]);

bind_pcvar_num(create_cvar(
"regg_awp_oneshot", "1",
Expand Down Expand Up @@ -328,8 +329,8 @@ public bool:ConfigOnKeyValue(const INIParser:handle, const key[], const value[])
Levels[LevelsNum][LevelWeaponID] = WeaponIdType:rg_get_weapon_info(value, WI_ID);
} else if (strcmp(key, "points") == 0) {
Levels[LevelsNum][LevelPoints] = str_to_num(value);
} else if (strcmp(key, "mod") == 0) {
Levels[LevelsNum][LevelMod] = str_to_num(value);
} else if (strcmp(key, "ratio") == 0) {
Levels[LevelsNum][LevelRatio] = str_to_num(value);
}
}
}
Expand Down
80 changes: 63 additions & 17 deletions cstrike/addons/amxmodx/scripting/regg/functions.inl
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,24 @@ bool:suicide(const id) {
}

ReGG_Result:steal(const killer, const victim) {
if(Mode == ReGG_ModeTeam) {
return stealPoints(killer, victim, Config[CfgTeamStealValue]);
} else {
switch(Config[CfgStealMode]) {
case 1: {
return stealLevels(killer, victim, Config[CfgStealValue]);
}
case 2: {
return stealPoints(killer, victim, Config[CfgStealValue]);
switch(Config[CfgStealMode]) {
case 1: {
return stealLevels(killer, victim, Config[CfgStealValue]);
}
case 2: {
return stealPoints(killer, victim, Config[CfgStealValue]);
}
case 3: {
new level;
if(Mode == ReGG_ModeTeam) {
new slot = getTeamSlot(victim);
level = Teams[slot][TeamLevel];
} else {
level = Players[victim][PlayerLevel];
}
return stealPoints(killer, victim, Levels[level][LevelPoints]);
}
}
}
return addPoints(killer, 1);
}

Expand Down Expand Up @@ -334,9 +340,29 @@ ReGG_Result:addPlayerPoints(const id, const value, const bool:forwards = true) {
break;
}

points -= needPoints;
needPoints = Levels[level][LevelPoints];
result = ReGG_ResultLevelUp;
switch(Levels[level][LevelWeaponID]) {
case WEAPON_KNIFE: {
points = 0;
needPoints = Levels[level][LevelPoints];
result = ReGG_ResultLevelUp;
}

case WEAPON_HEGRENADE: {
points = 0;
needPoints = Levels[level][LevelPoints];
result = ReGG_ResultLevelUp;
}

default: {
if(Config[CfgRollingPoints] > 0) {
points -= needPoints;
} else {
points = 0;
}
needPoints = Levels[level][LevelPoints];
result = ReGG_ResultLevelUp;
}
}
}

if(result != ReGG_ResultPointsUp && !setPlayerLevel(id, level, forwards)) {
Expand Down Expand Up @@ -364,9 +390,29 @@ ReGG_Result:addTeamPoints(const slot, const value, const bool:forwards = true) {
break;
}

points -= needPoints;
needPoints = getTeamLevelPoints(slot, level);
result = ReGG_ResultLevelUp;
switch(Levels[level][LevelWeaponID]) {
case WEAPON_KNIFE: {
points = 0;
needPoints = getTeamLevelPoints(slot, level);
result = ReGG_ResultLevelUp;
}

case WEAPON_HEGRENADE: {
points = 0;
needPoints = getTeamLevelPoints(slot, level);
result = ReGG_ResultLevelUp;
}

default: {
if(Config[CfgRollingPoints] > 0) {
points -= needPoints;
} else {
points = 0;
}
needPoints = getTeamLevelPoints(slot, level);
result = ReGG_ResultLevelUp;
}
}
}

if(result != ReGG_ResultPointsUp && !setTeamLevel(slot, level, forwards)) {
Expand Down Expand Up @@ -613,7 +659,7 @@ getTeamSlot(const id) {
getTeamLevelPoints(const slot, const level) {
new points;
new point_s = getTeamPlayers(slot) * Levels[level][LevelPoints];
new lvlmod = Levels[level][LevelMod];
new lvlmod = Levels[level][LevelRatio];
if(lvlmod != 100) {
points = roundPoints(lvlmod, point_s);
} else {
Expand Down
2 changes: 1 addition & 1 deletion cstrike/addons/amxmodx/scripting/regg_core.sma
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum _:level_s {
WeaponIdType:LevelWeaponID,
LevelPoints,
LevelTitle[MAX_LEVEL_TITLE_LENGTH],
LevelMod,
LevelRatio,
};

enum _:player_s {
Expand Down
Loading