Commit 4e120a6a authored by Mikleo's avatar Mikleo

Minor labelling (commander/captain) fix to legacy captain vote mode.

parent 6cdb4885
Pipeline #12552 passed with stages
in 41 seconds
......@@ -8,7 +8,7 @@
#include <empstats>
#include <updater>
#define PluginVersion "1.13"
#define PluginVersion "1.14"
#define UPDATE_URL "https://sourcemod.docs.empiresmod.com/DraftPick/dist/updater.txt"
......@@ -51,7 +51,7 @@ int stage = STAGE_DISABLED;
#define TEAM_BE 1;
ConVar mp_autoteambalance,mp_autoteambalance_skilldifference,cv_autoassign,cv_allowspectators,dp_default_draftmode, dp_default_draftmode_min_players,dp_captain_vote_time,dp_pick_wait_time,dp_pick_initial_multiplier,dp_time_increment,dp_in_draft,dp_maxpick,dp_squadlimitdefault,dp_autopick_randomizer,dp_autodraft_display_pick,dp_forceauto_max_imbalance,dp_overlay,dp_autodraft_comms,dp_captainvote_playerratio;
ConVar mp_autoteambalance,mp_autoteambalance_skilldifference,cv_autoassign,cv_allowspectators,dp_default_draftmode, dp_default_draftmode_min_players,dp_captain_vote_time,dp_captain_pick_wait_time,dp_autodraft_wait_time,dp_pick_initial_multiplier,dp_time_increment,dp_in_draft,dp_maxpick,dp_squadlimitdefault,dp_autopick_randomizer,dp_autodraft_display_pick,dp_forceauto_max_imbalance,dp_overlay,dp_autodraft_comms,dp_captainvote_playerratio;
int mp_autoteambalance_default = 1;
int cv_autoassign_default = 0;
......@@ -253,7 +253,8 @@ public void OnPluginStart()
dp_min_players = CreateConVar("dp_minplayers", "10", "The minimum number of players after which draft mode is disabled.");
dp_captain_vote_time = CreateConVar("dp_captain_vote_time", "100", "The time set in the captain vote stage");
dp_pick_wait_time = CreateConVar("dp_pick_wait_time", "90", "The time set in the pick wait stage");
dp_captain_pick_wait_time = CreateConVar("dp_captain_pick_wait_time", "20", "The time set in the captain pick wait stage");
dp_autodraft_wait_time = CreateConVar("dp_autodraft_wait_time", "100", "The time set in the automatic pick wait stage");
dp_pick_initial_multiplier = CreateConVar("dp_pick_initial_multiplier", "2", "Amount of initial time given to each captain per player");
dp_time_increment = CreateConVar("dp_time_increment", "3", "The time increment given to each captain per player in the pick phase");
dp_in_draft = CreateConVar("dp_in_draft", "0", "Notification of drafting. ignore");
......@@ -325,7 +326,7 @@ PlayWaitMusic()
{
any musicData[musicdataenum];
waitMusic.GetArray(waitMusicIndex,musicData);
PlayMusic(musicData[md_path],musicData[md_duration]);
PlayMusic(musicData[md_path],musicData[md_duration] + 10);
waitMusicPlayed = true;
}
......@@ -1080,7 +1081,12 @@ public Action Timer_Tick(Handle timer,client)
tickTime --;
}
char CaptainOrCommander[32];
if(IsCaptainDraft(draftMode))
strcopy(CaptainOrCommander,sizeof(CaptainOrCommander),"Captain");
else
strcopy(CaptainOrCommander,sizeof(CaptainOrCommander),"Commander");
if(stage == STAGE_CAPTAINVOTE || stage == STAGE_AUTOPICKWAIT && dp_autodraft_comms.IntValue == 1)
......@@ -1109,15 +1115,17 @@ public Action Timer_Tick(Handle timer,client)
int leader1,leader2,leader1votes,leader2votes = -1;
captainsInVote = NumCaptains() + GetVoteLeaders(captainVoteLimit,leader1,leader2,leader1votes,leader2votes);
// display hint box.
if(IsHintTextAvailable())
{
char hintMsg[256];
char clientName[32];
if(leader1 != -1)
Format(hintMsg,sizeof(hintMsg),"Commander Vote Leaders");
Format(hintMsg,sizeof(hintMsg),"%s Vote Leaders",CaptainOrCommander);
else
Format(hintMsg,sizeof(hintMsg),"Requesting Commander Candidates");
Format(hintMsg,sizeof(hintMsg),"Requesting %s Candidates",CaptainOrCommander);
if(leader1 != -1)
{
GetClientName(leader1,clientName,sizeof(clientName));
......@@ -1131,13 +1139,14 @@ public Action Timer_Tick(Handle timer,client)
Format(hintMsg,sizeof(hintMsg),"%s\n%s: %d",hintMsg,clientName,leader2votes);
}
Format(hintMsg,sizeof(hintMsg),"%s\nEach Commander Needs %d Votes ",hintMsg,captainVoteLimit);
Format(hintMsg,sizeof(hintMsg),"%s\nEach %s Needs %d Votes ",hintMsg,CaptainOrCommander,captainVoteLimit);
PrintHintTextToAll(hintMsg);
}
}
......@@ -1173,7 +1182,24 @@ public Action Timer_Tick(Handle timer,client)
}
else
{
if(stage == STAGE_CAPTAINVOTE)
if(tickTime == 0 && (stage == STAGE_CAPTAINVOTE || stage == STAGE_AUTOPICKWAIT && dp_autodraft_comms.IntValue == 1))
{
int interval = time % 4;
if(interval == 0)
Format(text,sizeof(text)," - Waiting for %ss - ",CaptainOrCommander);
else if(interval == 1 || interval == 3 )
Format(text,sizeof(text)," - Waiting for %ss - ",CaptainOrCommander);
else if(interval == 2 )
Format(text,sizeof(text),"- Waiting for %ss -",CaptainOrCommander);
if((time % 10) == 0)
PrintToChatAll("\x07b30000[Votes Required]\x01 Please open the commander vote menu and vote for a %s" ,CaptainOrCommander);
}
else if(stage == STAGE_AUTOPICKWAIT)
{
Format(text,sizeof(text),"Team Selection in %d secs",tickTime);
}
else if(stage == STAGE_CAPTAINVOTE)
{
Format(text,sizeof(text),"Captain Vote ends in %d secs",tickTime);
}
......@@ -1181,27 +1207,6 @@ public Action Timer_Tick(Handle timer,client)
{
Format(text,sizeof(text),"Draft begins in %d secs",tickTime);
}
else if(stage == STAGE_AUTOPICKWAIT)
{
if(tickTime == 0 && dp_autodraft_comms.IntValue == 1)
{
int interval = time % 4;
if(interval == 0)
Format(text,sizeof(text)," - Waiting for Commanders - ");
else if(interval == 1 || interval == 3 )
Format(text,sizeof(text)," - Waiting for Commanders - ");
else if(interval == 2 )
Format(text,sizeof(text),"- Waiting for Commanders -");
}
else
{
Format(text,sizeof(text),"Team Selection in %d secs",tickTime);
}
}
float yPos = 0.92;
......@@ -1219,26 +1224,47 @@ public Action Timer_Tick(Handle timer,client)
{
Format(teamText,sizeof(teamText),"%s",text);
}
if(dp_autodraft_comms.IntValue == 1)
if(stage == STAGE_CAPTAINVOTE || stage == STAGE_AUTOPICKWAIT && dp_autodraft_comms.IntValue == 1)
{
yPos -= 0.02;
Format(teamText,sizeof(teamText),"Vote for Commanders %d/2\n%s",captainsInVote,teamText);
Format(teamText,sizeof(teamText),"Vote for %ss %d/2\n%s",CaptainOrCommander,captainsInVote,teamText);
}
else if(stage == STAGE_PICKWAIT)
{
yPos -= 0.02;
Format(teamText,sizeof(teamText),"Get Ready Captains\n%s",teamText);
}
SetHudTextParams(-1.0,yPos, 1.0, 255, 255, 255, 255);
ShowHudTextTeams(4,teamText);
SetHudTextParams(-1.0,0.9, 1.0, 255, 75, 75, 255);
Format(text,sizeof(text),"Join NF to take part!\n %s",text,tickTime);
ShowHudTextSpec(4,text);
if(tickTime == 19 && stage == STAGE_PICKWAIT)
{
WarnSpectatorsOfDraft();
}
}
}
bool IsCaptainDraft(int mode)
{
return mode == MODE_DRAFT || mode == MODE_SQUADDRAFT;
}
bool IsAutoDraft(int mode)
{
return mode == MODE_AUTODRAFT || mode == MODE_AUTOSQUADDRAFT || mode == MODE_RANKEDMATCH;
}
bool IsHintTextAvailable()
{
ConVar sm_vote_progress_hintbox = FindConVar("sm_vote_progress_hintbox");
......@@ -1449,11 +1475,6 @@ bool TryAssignCaptains()
if(!AreCaptainsFull())
{
if(draftMode == MODE_DRAFT || draftMode == MODE_SQUADDRAFT)
{
PrintToChatAll("\x04[DP] \x01Not all captains assigned. Resetting vote.");
tickTime = dp_captain_vote_time.IntValue;
}
return false;
}
else
......@@ -1685,7 +1706,7 @@ void BeginPick()
if(draftMode == MODE_DRAFT || draftMode == MODE_SQUADDRAFT)
if(IsCaptainDraft(draftMode))
{
OptOutAll();
......@@ -1783,7 +1804,7 @@ void Pick(int client,int target)
cName = "AutoPick";
}
bool displayText = draftMode == MODE_DRAFT || draftMode == MODE_SQUADDRAFT || dp_autodraft_display_pick.IntValue == 1;
bool displayText = IsCaptainDraft(draftMode) || dp_autodraft_display_pick.IntValue == 1;
char targetName[64];
GetClientName(target,targetName,sizeof(targetName));
......@@ -2766,10 +2787,10 @@ int OppTeam(int team)
AdjustPrefix(int client)
{
// dont adjust prefixs in automatic pick modes.
if(draftMode != MODE_DRAFT && draftMode != MODE_SQUADDRAFT)
if(IsAutoDraft(draftMode))
return;
char clientName[64];
char clientName[128];
GetClientName(client,clientName,sizeof(clientName));
// find the first
......@@ -2914,6 +2935,7 @@ public Hook_OnThinkPost(iEnt) {
Stage_CaptainVote_Start()
{
PlayWaitMusic();
tickTime = dp_captain_vote_time.IntValue;
PrintToChatAll("\x04[DP] \x01Captain Vote started ");
captainVoteNotifyHandle = CreateTimer(30.0, Timer_CaptainNotify, _, TIMER_REPEAT);
......@@ -2931,11 +2953,16 @@ Stage_CaptainVote_End()
KillTimer(captainVoteNotifyHandle);
captainVoteNotifyHandle = INVALID_HANDLE;
}
StopMusic();
// clear the hint box.
PrintHintTextToAll("");
}
// short interval stage.
Stage_Pickwait_Start()
{
PlayWaitMusic();
int time = dp_pick_wait_time.IntValue;
int time = dp_captain_pick_wait_time.IntValue;
PrintToChatAll("\x04[DP] \x01Both captains have been assigned, Picking begins in \x073399ff%d\x01 seconds",time);
if(!draftBegun)
......@@ -2993,7 +3020,6 @@ Stage_Pickwait_End()
KillTimer(pickWaitNotifyHandle);
pickWaitNotifyHandle = INVALID_HANDLE;
}
StopMusic();
}
Stage_Autopickwait_Start()
......@@ -3001,7 +3027,7 @@ Stage_Autopickwait_Start()
PlayWaitMusic();
teamToPick = GetStartingTeam();
int time = dp_pick_wait_time.IntValue;
int time = dp_autodraft_wait_time.IntValue;
if(squadLimit >0)
time += 10;
......@@ -3095,7 +3121,10 @@ int GetStartingTeam()
Stage_Pick_Start()
{
ServerCommand("es_showoptin 0");
if(!draftBegun)
{
BeginNewDraft();
......@@ -3120,7 +3149,7 @@ Stage_Pick_Start()
BeginPick();
if(draftMode == MODE_DRAFT || draftMode == MODE_SQUADDRAFT)
if(IsCaptainDraft(draftMode))
{
PrintToChatAll("\x04[DP] \x01Pick your players using the Commander Vote GUI");
PlayMusic(sound_pick_music,dp_pick_music_repeat.FloatValue);
......@@ -4911,3 +4940,17 @@ RefreshTeamBalanceCvars()
}
}
WarnSpectatorsOfDraft()
{
SetHudTextParams(-1.0,0.6, 15.0, 255, 120, 120, 255);
ShowHudTextSpec(2,"JOIN NF TO TAKE PART IN THE DRAFT\nDO IT NOW!");
PrecacheSound("vo/tutorial/tutorial_spawn_1.wav");
for (int i=1; i<=MaxClients; i++)
{
if(IsClientInGame(i) && GetClientTeam(i) < 2)
{
EmitSoundToClient(i,"vo/tutorial/tutorial_spawn_1.wav");
}
}
}
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "1.13"
"Latest" "1.14"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment