Add proper death handling for Zombie:Reloaded.

Add bonuspoints feature.
Add new SteamID format fix.
This commit is contained in:
BotoX 2017-08-05 15:43:14 +02:00
parent 11cac08de8
commit 98faaa66b8
3 changed files with 48 additions and 12 deletions

View File

@ -713,6 +713,8 @@ sub doEvent_Suicide
my $player = lookupPlayer($s_addr, $playerId, $playerUniqueId); my $player = lookupPlayer($s_addr, $playerId, $playerUniqueId);
my $playerstr = &getPlayerInfoString($player, $playerId); my $playerstr = &getPlayerInfoString($player, $playerId);
$player->set("is_dead", "1");
if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers})
{ {
$desc = "(IGNORED) NOTMINPLAYERS: "; $desc = "(IGNORED) NOTMINPLAYERS: ";
@ -1355,7 +1357,9 @@ sub doEvent_Frag
} }
$killer->updateDB(); $killer->updateDB();
$victim->increment("map_deaths"); $victim->increment("map_deaths");
$victim->set("is_dead", "1"); if ($weapon ne "zombie_claws_of_death") {
$victim->set("is_dead", "0");
}
if ($victim->{auto_type} eq "kill") { if ($victim->{auto_type} eq "kill") {
&doEvent_Chat("say", &doEvent_Chat("say",
$victim->{"userid"}, $victim->{"userid"},
@ -1391,6 +1395,16 @@ sub doEvent_PlayerPlayerAction
my $victim = lookupPlayer($s_addr, $victimId, $victimUniqueId); my $victim = lookupPlayer($s_addr, $victimId, $victimUniqueId);
my $playerstr = &getPlayerInfoString($player, $playerId); my $playerstr = &getPlayerInfoString($player, $playerId);
my $victimstr = &getPlayerInfoString($victim, $victimId); my $victimstr = &getPlayerInfoString($victim, $victimId);
my $player_bonuspoints = 0;
if (defined($properties{hlx_player_bonuspoints})) {
$player_bonuspoints = $properties{hlx_player_bonuspoints};
}
my $team_bonuspoints = 0;
if (defined($properties{hlx_team_bonuspoints})) {
$team_bonuspoints = $properties{hlx_team_bonuspoints};
}
if ($playerId == $victimId) { if ($playerId == $victimId) {
$desc = "(IGNORED) PLAYER SAME AS VICTIM: "; $desc = "(IGNORED) PLAYER SAME AS VICTIM: ";
} elsif ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) { } elsif ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) {
@ -1448,8 +1462,8 @@ sub doEvent_PlayerPlayerAction
if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{ppaction}) { if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{ppaction}) {
my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr};
my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id};
my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player}; my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player} + $player_bonuspoints;
my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints;
my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team};
if (defined($properties{assister_position})) { if (defined($properties{assister_position})) {
@ -1579,6 +1593,9 @@ sub doEvent_PlayerAction
} }
$player->updateDB(); $player->updateDB();
} else { } else {
if ($action eq "player_spawn") {
$player->set("is_dead", "0");
}
if ($g_servers{$s_addr}->{play_game} == TF()) if ($g_servers{$s_addr}->{play_game} == TF())
{ {
my $objectstring = ""; my $objectstring = "";
@ -1723,6 +1740,15 @@ sub doEvent_PlayerAction
$g_servers{$s_addr}->{nextkillheadshot} = $player->{playerid} $g_servers{$s_addr}->{nextkillheadshot} = $player->{playerid}
} }
my $player_bonuspoints = 0;
if (defined($properties{hlx_player_bonuspoints})) {
$player_bonuspoints = $properties{hlx_player_bonuspoints};
}
my $team_bonuspoints = 0;
if (defined($properties{hlx_team_bonuspoints})) {
$team_bonuspoints = $properties{hlx_team_bonuspoints};
}
my $map = $g_servers{$s_addr}->get_map(); my $map = $g_servers{$s_addr}->get_map();
if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{paction}) { if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{paction}) {
&doEvent_PlayerAction( &doEvent_PlayerAction(
@ -1737,8 +1763,8 @@ sub doEvent_PlayerAction
if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{paction}) { if (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{paction}) {
my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr};
my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id};
my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player}; my $reward_player = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_player} + $player_bonuspoints;
my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints;
my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; my $team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team};
&recordEvent( &recordEvent(
@ -1817,8 +1843,14 @@ sub doEvent_PlayerAction
sub doEvent_TeamAction sub doEvent_TeamAction
{ {
$rcmd = $g_servers{$s_addr}->{broadcasting_command}; $rcmd = $g_servers{$s_addr}->{broadcasting_command};
my ($team, $action) = @_; my ($team, $action, %properties) = @_;
my $desc; my $desc;
my $team_bonuspoints = 0;
if (defined($properties{hlx_team_bonuspoints})) {
$team_bonuspoints = $properties{hlx_team_bonuspoints};
}
if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) { if ($g_servers{$s_addr}->{num_trackable_players} < $g_servers{$s_addr}->{minplayers}) {
$desc = "(IGNORED) NOTMINPLAYERS: "; $desc = "(IGNORED) NOTMINPLAYERS: ";
@ -1831,7 +1863,7 @@ sub doEvent_TeamAction
if ((defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{taction}) || (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{taction})) { if ((defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$action}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{taction}) || (defined($g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}) && $g_games{$g_servers{$s_addr}->{game}}{actions}{$map."_$action"}{taction})) {
my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr}; my $actionname = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{descr};
my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id}; my $actionid = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{id};
my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team}; my $reward_team = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{reward_team} + $team_bonuspoints;
my $actionteam = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team}; my $actionteam = $g_games{$g_servers{$s_addr}->{game}}{actions}{$action}{team};
if ($actionteam eq "") { if ($actionteam eq "") {
$actionteam = $team; $actionteam = $team;
@ -1967,7 +1999,9 @@ sub doEvent_WorldAction
$player->set("connect_time", time()); $player->set("connect_time", time());
} }
if ($action eq "Round_Start") { if ($action eq "Round_Start") {
if ($player->{team} ne "Spectator" && $player->{team} ne "Unassigned") {
$player->set("is_dead", "0", 1); $player->set("is_dead", "0", 1);
}
if ($player->{auto_type} eq "start") { if ($player->{auto_type} eq "start") {
&doEvent_Chat("say", &doEvent_Chat("say",
$player->{"userid"}, $player->{"userid"},

View File

@ -338,6 +338,7 @@ sub getPlayers
my $address = $8; my $address = $8;
my $port = $9; my $port = $9;
$uniqueid =~ s!\[U:1:(\d+)\]!($1 % 2).':'.int($1 / 2)!eg;
$uniqueid =~ s/^STEAM_[0-9]+?\://i; $uniqueid =~ s/^STEAM_[0-9]+?\://i;
# &::printEvent("DEBUG", "USERID: '$userid', NAME: '$name', UNIQUEID: '$uniqueid', TIME: '$time', PING: '$ping', LOSS: '$loss', STATE: '$state', ADDRESS:'$address', CLI_PORT: '$port'", 1); # &::printEvent("DEBUG", "USERID: '$userid', NAME: '$name', UNIQUEID: '$uniqueid', TIME: '$time', PING: '$ping', LOSS: '$loss', STATE: '$state', ADDRESS:'$address', CLI_PORT: '$port'", 1);

View File

@ -565,7 +565,7 @@ sub rewardTeam
if (($g_servers{$s_addr}->{ignore_bots} == 1) && (($player->{is_bot} == 1) || ($player->{userid} <= 0))) { if (($g_servers{$s_addr}->{ignore_bots} == 1) && (($player->{is_bot} == 1) || ($player->{userid} <= 0))) {
$desc = "(IGNORED) BOT: "; $desc = "(IGNORED) BOT: ";
} else { } else {
if ($player_team eq $team) { if (($player_team eq $team) && ($player->{is_dead} == 0)) {
if ($g_debug > 2) { if ($g_debug > 2) {
&printNotice("Rewarding " . $player->getInfoString() . " with \"$reward\" skill for action \"$actionid\""); &printNotice("Rewarding " . $player->getInfoString() . " with \"$reward\" skill for action \"$actionid\"");
} }
@ -1061,6 +1061,7 @@ sub getPlayerInfo
my $haveplayer = 0; my $haveplayer = 0;
$plainuniqueid = $uniqueid; $plainuniqueid = $uniqueid;
$uniqueid =~ s!\[U:1:(\d+)\]!'STEAM_0:'.($1 % 2).':'.int($1 / 2)!eg;
$uniqueid =~ s/^STEAM_[0-9]+?\://; $uniqueid =~ s/^STEAM_[0-9]+?\://;
if (($uniqueid eq "Console") && ($team eq "Console")) { if (($uniqueid eq "Console") && ($team eq "Console")) {