mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-15 08:04:39 +00:00
Vote% Logging
This commit is contained in:
parent
0941841a18
commit
73ee6d7072
2 changed files with 83 additions and 1 deletions
|
|
@ -85,6 +85,34 @@ function voteLog(%client, %typeName, %arg1, %arg2, %arg3, %arg4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// votePercentLog(%client, %typeName, %key, %game.votesFor[%game.kickTeam], %game.votesAgainst[%game.kickTeam], %totalVotes, %game.totalVotesNone)
|
||||||
|
// Info: Logs voting percent events
|
||||||
|
function votePercentLog(%display, %typeName, %key, %voteYay, %voteNay, %voteTotal, %voteNone) //%voteNone = Did Not Vote (DNV)
|
||||||
|
{
|
||||||
|
if($Host::ClassicVoteLog)
|
||||||
|
{
|
||||||
|
// Dif calc for "VoteKickPlayer"
|
||||||
|
if(%typeName $= "VoteKickPlayer")
|
||||||
|
{
|
||||||
|
%percent = mFloor((%voteYay/ClientGroup.getCount()) * 100);
|
||||||
|
%voteNone = "N/A";
|
||||||
|
%display = %typeName SPC "[" @ %display.nameBase @ "]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%percent = mFloor((%voteYay/(ClientGroup.getCount() - %voteNone)) * 100);
|
||||||
|
%display = %typeName SPC "[" @ %display @ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
$VoteLog = "[" @ %key @ "]" SPC %display SPC "Yay[" @ %voteYay @ "] Nay[" @ %voteNay @ "] Total[" @ %voteTotal @ "] Vote%[" @ %percent @ "] DNV[" @ %voteNone @ "]";
|
||||||
|
|
||||||
|
// this is the info that will be logged
|
||||||
|
%logpath = $Host::ClassicVoteLogPath;
|
||||||
|
export("$VoteLog", %logpath, true);
|
||||||
|
logEcho($VoteLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// From Goon
|
// From Goon
|
||||||
// Slightly more elegant solution rather than spamming console
|
// Slightly more elegant solution rather than spamming console
|
||||||
function ClassicChatLog(%client, %id, %team, %msg)
|
function ClassicChatLog(%client, %id, %team, %msg)
|
||||||
|
|
|
||||||
|
|
@ -704,6 +704,7 @@ function DefaultGame::cancelMatchStart(%game, %admin)
|
||||||
function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
||||||
{
|
{
|
||||||
%cause = "";
|
%cause = "";
|
||||||
|
%typeName = "VoteKickPlayer";
|
||||||
|
|
||||||
if(isObject(%admin))
|
if(isObject(%admin))
|
||||||
{
|
{
|
||||||
|
|
@ -718,6 +719,8 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
||||||
{
|
{
|
||||||
kick(%client, %admin, %game.kickGuid);
|
kick(%client, %admin, %game.kickGuid);
|
||||||
%cause = "(vote)";
|
%cause = "(vote)";
|
||||||
|
|
||||||
|
%key = "Passed";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -728,9 +731,13 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
||||||
if (%cl.team == %game.kickTeam && !%cl.isAIControlled())
|
if (%cl.team == %game.kickTeam && !%cl.isAIControlled())
|
||||||
messageClient( %cl, 'MsgVoteFailed', '\c2Kick player vote did not pass.' );
|
messageClient( %cl, 'MsgVoteFailed', '\c2Kick player vote did not pass.' );
|
||||||
}
|
}
|
||||||
|
%key = "Failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Log Vote %
|
||||||
|
votePercentLog(%client, %typeName, %key, %game.votesFor[%game.kickTeam], %game.votesAgainst[%game.kickTeam], %totalVotes, %game.totalVotesNone);
|
||||||
|
|
||||||
%game.kickTeam = "";
|
%game.kickTeam = "";
|
||||||
%game.kickGuid = "";
|
%game.kickGuid = "";
|
||||||
%game.kickClientName = "";
|
%game.kickClientName = "";
|
||||||
|
|
@ -742,6 +749,8 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId)
|
function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId)
|
||||||
{
|
{
|
||||||
|
%typeName = "VoteChangeMission";
|
||||||
|
|
||||||
%mission = $HostMissionFile[%missionId];
|
%mission = $HostMissionFile[%missionId];
|
||||||
if ( %mission $= "" )
|
if ( %mission $= "" )
|
||||||
{
|
{
|
||||||
|
|
@ -770,17 +779,30 @@ function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typ
|
||||||
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
||||||
{
|
{
|
||||||
messageAll('MsgVotePassed', '\c2The mission was changed to %1 (%2) by vote.', %missionDisplayName, %typeDisplayName );
|
messageAll('MsgVotePassed', '\c2The mission was changed to %1 (%2) by vote.', %missionDisplayName, %typeDisplayName );
|
||||||
|
|
||||||
|
//Log Vote % - Must be before Game Over
|
||||||
|
%key = "Passed";
|
||||||
|
votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
|
||||||
%game.gameOver();
|
%game.gameOver();
|
||||||
loadMission( %mission, %missionType, false );
|
loadMission( %mission, %missionType, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
messageAll('MsgVoteFailed', '\c2Change mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
messageAll('MsgVoteFailed', '\c2Change mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
|
|
||||||
|
//Log Vote %
|
||||||
|
%key = "Failed";
|
||||||
|
votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId )
|
function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId )
|
||||||
{
|
{
|
||||||
|
%typeName = "VoteTournamentMode";
|
||||||
|
|
||||||
%mission = $HostMissionFile[%missionId];
|
%mission = $HostMissionFile[%missionId];
|
||||||
if ( %mission $= "" )
|
if ( %mission $= "" )
|
||||||
{
|
{
|
||||||
|
|
@ -808,10 +830,21 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t
|
||||||
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
||||||
{
|
{
|
||||||
messageAll('MsgVotePassed', '\c2Server switched to Tournament mode by vote (%1): %2 percent.', %missionDisplayName, mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
messageAll('MsgVotePassed', '\c2Server switched to Tournament mode by vote (%1): %2 percent.', %missionDisplayName, mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
|
|
||||||
|
//Log Vote % - Must be before Game Over
|
||||||
|
%key = "Passed";
|
||||||
|
votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
|
||||||
setModeTournament( %mission, %missionType );
|
setModeTournament( %mission, %missionType );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
messageAll('MsgVoteFailed', '\c2Tournament mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
{
|
||||||
|
//Log Vote %
|
||||||
|
%key = "Failed";
|
||||||
|
votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
|
||||||
|
messageAll('MsgVoteFailed', '\c2Tournament mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%cause !$= "")
|
if(%cause !$= "")
|
||||||
|
|
@ -821,6 +854,8 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit )
|
function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit )
|
||||||
{
|
{
|
||||||
|
%typeName = "VoteChangeTimeLimit";
|
||||||
|
|
||||||
if( %newLimit == 999 )
|
if( %newLimit == 999 )
|
||||||
%display = "unlimited";
|
%display = "unlimited";
|
||||||
else
|
else
|
||||||
|
|
@ -844,13 +879,19 @@ function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit )
|
||||||
ResetVOTimeChanged(%game);
|
ResetVOTimeChanged(%game);
|
||||||
// Reset the voted time limit when changing mission
|
// Reset the voted time limit when changing mission
|
||||||
$TimeLimitChanged = 1;
|
$TimeLimitChanged = 1;
|
||||||
|
|
||||||
|
%key = "Passed";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
// VoteOvertime
|
// VoteOvertime
|
||||||
ResetVOall(%game);
|
ResetVOall(%game);
|
||||||
|
|
||||||
|
%key = "Failed";
|
||||||
}
|
}
|
||||||
|
//Log Vote %
|
||||||
|
votePercentLog(%newLimit, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the match has been started, reset the end of match countdown
|
//if the match has been started, reset the end of match countdown
|
||||||
|
|
@ -894,6 +935,8 @@ function DefaultGame::voteFFAMode( %game, %admin, %client )
|
||||||
|
|
||||||
function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4)
|
function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4)
|
||||||
{
|
{
|
||||||
|
%typeName = "VoteSkipMission";
|
||||||
|
|
||||||
if(isObject(%admin))
|
if(isObject(%admin))
|
||||||
{
|
{
|
||||||
messageAll('MsgAdminForce', '\c2The Admin %1 has skipped to the next mission.',%admin.name );
|
messageAll('MsgAdminForce', '\c2The Admin %1 has skipped to the next mission.',%admin.name );
|
||||||
|
|
@ -908,13 +951,24 @@ function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4)
|
||||||
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100))
|
||||||
{
|
{
|
||||||
messageAll('MsgVotePassed', '\c2The mission was skipped to next by vote.');
|
messageAll('MsgVotePassed', '\c2The mission was skipped to next by vote.');
|
||||||
|
|
||||||
|
//Log Vote % - Must be before Game Over
|
||||||
|
%key = "Passed";
|
||||||
|
votePercentLog("N/A", %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
|
||||||
echo("mission skipped (vote)");
|
echo("mission skipped (vote)");
|
||||||
%game.gameOver();
|
%game.gameOver();
|
||||||
//loadMission( findNextCycleMission(), $CurrentMissionType, false );
|
//loadMission( findNextCycleMission(), $CurrentMissionType, false );
|
||||||
cycleMissions();
|
cycleMissions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
messageAll('MsgVoteFailed', '\c2Skip mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
messageAll('MsgVoteFailed', '\c2Skip mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
|
|
||||||
|
//Log Vote %
|
||||||
|
%key = "Failed";
|
||||||
|
votePercentLog("N/A", %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue