Committed old RPGGame.cs for historic bookkeeping.

This commit is contained in:
Robert MacGregor 2016-03-17 02:16:49 -04:00
parent 4507d4a810
commit 503c692b53

626
scripts/RPGGame.cs Normal file → Executable file
View file

@ -12,9 +12,7 @@
//exec the AI scripts //exec the AI scripts
exec("scripts/aiRPG.cs"); exec("scripts/aiRPG.cs");
// exec a bunch of dependencies $RequiresClient[RPG] = true;
exec("scripts/modScripts/server/RPG/initialise.cs");
$InvBanList[RPG, "C4Charge"] = 1; $InvBanList[RPG, "C4Charge"] = 1;
//-- tracking --- //-- tracking ---
@ -25,30 +23,15 @@ function RPGGame::initGameVars(%game)
package RPGGame package RPGGame
{ {
function notifyMatchStart(%time){} function blah(){} //Eh..
function notifyMatchEnd(%time){}
// FIXME: I have no idea where to find this serverCmd so here's quick hack
function serverCmdResetControlObject(%client)
{
parent::serverCmdResetControlObject(%client);
if ($CurrentMissionType $= "RPG" && isObject(%client.player) && %client.player.getState() $= "move")
%client.setControlObject(%client.player);
}
}; };
function RPGGame::timeLimitReached(%game){}
function RPGGame::scoreLimitReached(%game){}
function RPGGame::gameOver(%game){}
function RPGGame::checkTimeLimit(%game, %forced){}
function RPGGame::leaveMissionArea(%game, %playerData, %player){}
function RPGGame::enterMissionArea(%game, %playerData, %player){}
function RPGGame::setUpTeams(%game) function RPGGame::setUpTeams(%game)
{ {
defaultGame::setUpTeams(%game); defaultGame::setUpTeams(%game);
%game.numTeams = 1; %game.numTeams = 1;
setSensorGroupCount(4); setSensorGroupCount(4);
$TeamDamage = true; //Allow team Damage $TeamDamage = true; //Allow team Damage
} }
function RPGGame::getTeamSkin(%game, %team) function RPGGame::getTeamSkin(%game, %team)
@ -151,11 +134,32 @@ function RPGGame::showStalemateTargets(%game)
%game.stalemateSchedule = %game.schedule(%game.stalemateDurationMS, hideStalemateTargets); %game.stalemateSchedule = %game.schedule(%game.stalemateDurationMS, hideStalemateTargets);
} }
function RPGGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function RPGGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function RPGGame::gameOver(%game)
{
//call the default
DefaultGame::gameOver(%game);
messageAll('MsgClearObjHud', "");
}
function RPGGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) function RPGGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc)
{ {
if(%clVictim.headshot && %damageType == $DamageType::Laser && %clVictim.team != %clAttacker.team) if(%clVictim.headshot && %damageType == $DamageType::Laser && %clVictim.team != %clAttacker.team)
{ {
%clAttacker.scoreHeadshot++; %clAttacker.scoreHeadshot++;
if (%game.SCORE_PER_HEADSHOT != 0) if (%game.SCORE_PER_HEADSHOT != 0)
{ {
messageClient(%clAttacker, 'msgHeadshot', '\c0You received a %1 point bonus for a successful headshot.', %game.SCORE_PER_HEADSHOT); messageClient(%clAttacker, 'msgHeadshot', '\c0You received a %1 point bonus for a successful headshot.', %game.SCORE_PER_HEADSHOT);
@ -201,15 +205,12 @@ function RPGGame::clientMissionDropReady(%game, %client)
DefaultGame::clientMissionDropReady(%game, %client); DefaultGame::clientMissionDropReady(%game, %client);
//Force client Spawn since we're ready now //Force client Spawn since we're ready now
%client.schedule(100,"spawn"); schedule(1000,0,"forceClientSpawn",%client,true);
//%client.setControlObject(%client.player);
%client.setControlObject(%client.player);
commandToClient(%client,'bottomPrint',"Try not to die.",3); commandToClient(%client,'bottomPrint',"Try not to die.",3);
// FIXME: Always assigns radio access for now //Since this is an RPG gamemode, be sure some things are correct. (May have been a mission switch from CTF or some other gamemode)
%client.hasRadio = 1;
%client.radioFrequency = 1;
// Since this is an RPG gamemode, be sure some things are correct. (May have been a mission switch from CTF or some other gamemode)
commandToClient(%client,'SetScoreText',"PDA - Personal Data Assistant"); commandToClient(%client,'SetScoreText',"PDA - Personal Data Assistant");
//Make sure the data hud is working. //Make sure the data hud is working.
messageClient(%client,'MsgSPCurrentObjective1',"",'Location: Unknown.'); messageClient(%client,'MsgSPCurrentObjective1',"",'Location: Unknown.');
@ -218,9 +219,9 @@ function RPGGame::clientMissionDropReady(%game, %client)
function RPGGame::assignClientTeam(%game, %client, %respawn) function RPGGame::assignClientTeam(%game, %client, %respawn)
{ {
DefaultGame::assignClientTeam(%game, %client, %respawn); DefaultGame::assignClientTeam(%game, %client, %respawn);
// if player's team is not on top of objective hud, switch lines // if player's team is not on top of objective hud, switch lines
messageClient(%client, 'MsgCheckTeamLines', "", %client.team); messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
} }
function RPGGame::applyConcussion(%game, %player) function RPGGame::applyConcussion(%game, %player)
@ -233,92 +234,493 @@ function RPGGame::vehicleDestroyed(%game, %vehicle, %destroyer)
function RPGGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) function RPGGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation)
{ {
defaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); defaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation);
commandToClient(%clVictim,'HandleScriptedCommand',2); commandToClient(%clVictim,'HandleScriptedCommand',2);
//No, play this epic audio: //commandToClient(%clVictim,'alxPlayMusic',"T2BOL/Music/TribesHymn.mp3"); //Add a little music that becomes audible if the player idles in death for a bit..
schedule(2000,0,"messageClient",%clVictim,'MsgDeath',"~wfx/Lose.wav"); //No, play this epic audio:
forceScoreScreenOpen(%clVictim,"DEATH"); schedule(2000,0,"messageClient",%clVictim,'MsgDeath',"~wfx/Lose.wav");
$Data::ShouldApply[%clVictim.GUID] = false; forceScoreScreenOpen(%clVictim,"DEATH");
$Data::ShouldApply[%clVictim.GUID] = false;
if (%clVictim.isAIControlled()) if (%clVictim.isAIControlled())
%clVictim.drop(); %clVictim.drop();
} }
//...very very messy PDA code below!!
function RPGGame::updateScoreHud(%game, %client, %tag) //This is just here for when the PDA is first opened.
{
if (%client.PDAPage $= "")
{
messageClient( %client, 'ClearHud', "", 'scoreScreen', 0 );
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Main Page');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Please select a command.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Command List:");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tSLFSTS\t1>-Self Statistics</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tEMAIL\t1>-Electronic Mail</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tINVENTORY\t1>-View Inventory</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tCLNMG\t1>-Clan Management</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tSAVE\t1>-Save Game</a>");
%client.PDAPage = "MAIN";
}
}
function RPGGame::createPlayer(%game, %client, %spawnLoc, %respawn) function RPGGame::createPlayer(%game, %client, %spawnLoc, %respawn)
{ {
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn); DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
%client.observerMode = ""; commandToClient(%client,'HandleScriptedCommand',9,formatTimeString("HHnn") SPC "Hrs.");
commandToClient(%client, 'setHudMode', 'Standard');
%client.setControlObject(%client.player);
} }
function RPGGame::startMatch(%game) function RPGGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5)
{ {
echo("START MATCH"); messageClient( %client, 'ClearHud', "", 'scoreScreen', 0 );
//the match has been started, clear the team rank array, and repopulate it...
for (%i = 0; %i < 32; %i++)
%game.clearTeamRankArray(%i);
//used in BountyGame, prolly in a few others as well... //Special handles here..
$matchStarted = true; if (getSubStr(%arg1,0,5) $= "EMAIL" && getSubStr(%arg1,5,1) !$= "" && isNumber(getSubStr(%arg1,5,1)))
{
%id = getSubStr(%arg1,5,strLen(%arg1));
%client.email = %id;
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:left><a:gamelink\tDELETE\t1>Delete E-Mail</a> "@$Data::EMail::Date[%client.GUID,%i]@"<just:right><a:gamelink\tREPLY\t1>Reply</a>");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>From %1:',$Data::EMail::Sender[%client.GUID,%i]);
%index++;
%count = getSubStrOccurance($Data::EMail::Content[%client.GUID,%id],"\t");
echo(%count);
%game.clearDeployableMaxes(); if (%count != 0)
for (%i = 0; %i < %count; %i++)
$missionStartTime = getSimTime(); {
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000); messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>%1',getField($Data::EMail::Contents[%client.GUID,%id],%i));
%index++;
// schedule first timeLimit check for 20 seconds
if(%game.class !$= "SiegeGame")
{
%game.timeCheck = %game.schedule(20000, "checkTimeLimit");
}
//schedule the end of match countdown
EndCountdown($Host::TimeLimit * 60 * 1000);
//reset everyone's score and add them to the team rank array
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
%game.resetScore(%cl);
%game.populateTeamRankArray(%cl);
}
// set all clients control to their player
%count = ClientGroup.getCount();
for( %i = 0; %i < %count; %i++ )
{
%cl = ClientGroup.getObject(%i);
// Siege game will set the clock differently
if(%game.class !$= "SiegeGame")
messageClient(%cl, 'MsgSystemClock', "", $Host::TimeLimit, %curTimeLeftMS);
if( !$Host::TournamentMode && %cl.matchStartReady && %cl.camera.mode $= "pre-game")
{
commandToClient(%cl, 'setHudMode', 'Standard');
%cl.setControlObject( %cl.player );
}
else
{
if( %cl.matchStartReady )
{
if(%cl.camera.mode $= "pre-game")
{
%cl.observerMode = "";
commandToClient(%cl, 'setHudMode', 'Standard');
if(isObject(%cl.player))
%cl.setControlObject( %cl.player );
else
echo("can't set control for client: " @ %cl @ ", no player object found!");
}
else
%cl.observerMode = "observerFly";
}
}
}
// on with the show this is it!
AISystemEnabled( true );
} }
else
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>%1',$Data::EMail::Contents[%client.GUID,%id]);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tEMAIL\t1>Back To Listing</a>");
return;
}
else if (getSubStr(%arg1,0,7) $= "EMAILID" && isNumber(getSubStr(%arg1,7,strLen(%arg1))))
{
%id = getSubStr(%arg1,7,strLen(%arg1));
%guid = $Data::Client[%id];
%count = $Data::EMail::Count[%guid];
%name = $Data::ClientName[%id];
%clid = plNameToCid(%name);
if (checkEmails(%guid,%client.emailTitle))
return;
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail sent to %1.',%name);
messageClient( %client, 'SetLineHud', "", 'scoreScreen', 1, '<just:center><a:gamelink\tEMAIL\t1>Back to Listing</a>');
$Data::EMail::Title[%guid,%count] = %client.emailTitle;
$Data::EMail::Sender[%guid,%count] = %client.namebase;
$Data::EMail::Contents[%guid,%count] = %client.emailCont;
$Data::EMail::Date[%guid,%count] = formatTimeString("DD, MM dd, yy @ hh:nn A");
$Data::EMail::Count[%guid]++;
if (IsObject(%clid))
messageClient(%clid,'msgClient','\c3Received an E-Mail from %1. ~wfx/misc/warning_beep.wav',%client.namebase);
return;
}
switch$ (%arg1)
{
case "CLOSE":
closeScoreScreen(%client);
case "BACK": //Resets you to the main menu
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Main Page<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Please select a command.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Command List:");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tSLFSTS\t1>-Self Statistics</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tEMAIL\t1>-Electronic Mail</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tINVENTORY\t1>-View Inventory</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tCLNMG\t1>-Clan Management</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tSAVE\t1>-Save Game</a>");
%client.PDAPage = "MAIN";
case "CLNSTP":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Clan Management<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing clan setup.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Clan Name: %1 <a:input\tClanN\tClan Name\tClan Name>[Change]</a>',%client.clanN);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Clan Tag: %1 <a:input\tClanT\tClan Tag\tClan Tag>[Change]</a>',%client.clanT);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Short Description: %1 <a:input\tDesc\tShort Description\tDescription>[Change]</a>',%client.description);
%index++;
if (%client.clanN !$= "" && %client.clanT !$= "")
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tCLNFN>Done</a>');
%index++;
%client.PDAPage = "CLNSTP";
case "EMAIL":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing E-Mails in sequential order.");
%index = 0;
%count = $Data::EMail::Count[%client.GUID];
for (%i = 0; %i <= %count; %i++)
{
if ($Data::EMail::Title[%client.GUID,%i] !$= "")
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tEMAIL%1\t1>%2 - %3</a>',%i,$Data::EMail::Sender[%client.GUID,%i],$Data::EMail::Title[%client.GUID,%i]);
%index++;
}
}
if (%index == 0)
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>There are no E-Mails to show.");
%index++;
}
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tEMAILSEND\t1>[Compose an E-Mail]</a>");
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
%index++;
case "EMAILSEND":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>New E-Mail");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Title: %1 <a:input\temailTitle\tTitle\tE-Mail Title>[Change]</a>',%client.emailTitle);
%index++;
%count = getSubStrOccurance(%client.emailCont,"\t");
if (%count != 0)
for (%i = 0; %i < %count; %i++)
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Contents: %1 <a:input\temailCont\tContents\tContents>[Change]</a>',%client.emailCont);
}
else
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Contents: %1 <a:input\temailCont\tContents\tContents>[Change]</a>',%client.emailCont);
%index++;
if (%client.emailTitle !$= "" && %client.emailcont !$= "")
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tRECPT>Select Receptiant</a>');
case "RECPT":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Select Receptiant");
%count = $Data::ClientCount;
%index = 0;
for (%i = 0; %i < %count; %i++)
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tEMAILID%1\t1>%2</a>',%i,$Data::ClientName[%i]);
%index++;
}
case "CLNFN":
if ($Data::IsInClan[%client.GUID])
{
%ID = $Data::ClanID[%client.GUID];
if ($Data::ClanLeaderGUID[%ID] == %client.GUID)
{
$Data::ClanName[%ID] = %client.clanN;
$Data::ClanTag[%ID] = %client.clanT;
$Data::ClanDesc[%ID] = %client.description;
forceScoreScreenOpen(%client,"CLNMG");
}
}
else
{
$Data::IsInCLan[%client.GUID] = true;
if ($Data::ClanCount $= "")
$Data::ClanCount = 0;
$Data::ClanName[$Data::ClanCount] = %client.clanN;
$Data::ClanTag[$Data::ClanCount] = %client.clanT;
$Data::ClanDesc[$Data::ClanCount] = %client.desc;
$Data::ClanLeader[$Data::ClanCount] = %client.namebase;
$Data::ClanLeaderGUID[$Data::ClanCount] = %client.GUID;
$Data::ClanMember[$Data::ClanCount, 0] = %client.GUID;
$Data::ClanID[%client.GUID] = $Data::ClanCount;
$Data::ClanCount++;
setName(%client,"\cp\c7" @ %client.clanT @ "\c6" @ %client.namebase @ "\co");
saveGame();
forceScoreScreenOpen(%client,"CLNMG");
}
%client.PDAPage = "MAIN";
case "CLNMG":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Clan Management<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing clan management.");
%index = 0;
if (!$Data::IsInClan[%client.GUID])
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>You are not in a clan. Try creating a <a:gamelink\tCLNSTP>[New Clan]</a>.');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Or view the <a:gamelink\tCLNLST>[List]</a> of clans.');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
}
else
{
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Clan Name: %1',$Data::ClanName[$Data::ClanID[%client.GUID]]);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Clan Tag: %1', $Data::ClanTag[$Data::ClanID[%client.GUID]]);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Short Description: %1',%client.description);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tCLNMBR>[View]</a> member list.');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tCLNLST>[View]</a> other clans.');
if ($Data::IsInClan[%client.GUID] && $Data::ClanLeaderGUID[$Data::ClanID[%client.GUID]] == %client.GUID)
{
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tCLNSTP>[Edit]</a> Clan.');
}
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
}
%client.PDAPage = "CLNMG";
case "CLNMBR":
%client.PDAPage = "CLNMBR";
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Clan Management<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing member list.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Name: %1',%client.namebase);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tBACK\t1>Back To Previous Page</a>');
%index++;
case "SLFSTS": //Self Statistics
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Self Statistics<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing your stats.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Name: %1',%client.namebase);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Race: %1',%client.race);
%index++;
if (%client.money $= "")
%client.money = 0; //You got zilch.
%trans = %client.player.getTransform();
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Cash: $%1',%client.money);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>GPS Coordinates: %1 %2 %3',getWord(%trans,0),getWord(%trans,1),getWord(%trans,2));
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tSLFSTS\t1>Refresh</a>');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
%client.PDAPage = "SLFSTS";
case "INVENTORY": //View Inventory
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Show Inventory<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing your inventory.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Minerals--');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Steel: %1 units.', %client.units["Steel"]);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
%client.PDAPage = "INVENTORY";
case "DEATH":
if (isObject(%client.player) && %client.player.getState() $= "Move")
return;
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Death<just:right>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>You have died.");
messageClient( %client, 'SetLineHud', "", 'scoreScreen', 0, "<just:center><a:gamelink\tRESPAWN\t1>Respawn</a>");
%client.PDAPage = "DEATH";
case "DELETE":
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Electronic Mail<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>E-Mail deleted.");
messageClient( %client, 'SetLineHud', "", 'scoreScreen', 0, '<just:center><a:gamelink\tEMAIL\t1>Back to Listing</a>');
$Data::EMail::Title[%client.GUID,%client.email] = "";
case "SAVE":
saveGame();
closeScoreScreen(%client);
messageClient(%client,'msgSaveSuccess',"\c3Game successfully saved.");
case "RESPAWN":
if (isObject(%client.player) && %client.player.getState() $= "Move")
return;
%client.PDAPage = "MAIN";
forceClientSpawn(%client);
case "SLFSTS": //Self Statistics
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Self Statistics<just:right><a:gamelink\tCLOSE\t1>Close</a>');
messageClient( %client, 'SetScoreHudSubheader', "", "<just:center>Showing your stats.");
%index = 0;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Name: %1',%client.namebase);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Race: %1',%client.race);
%index++;
if (%client.race $= "Draakan")
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Type: %1',%client.sex);
else
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Sex: %1',%client.sex);
%index++;
if (%client.money $= "")
%client.money = 0; //You got zilch.
%trans = %client.player.getTransform();
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>Cash: $%1',%client.money);
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center>GPS Coordinates: %1 %2 %3',getWord(%trans,0),getWord(%trans,1),getWord(%trans,2));
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '<just:center><a:gamelink\tSLFSTS\t1>Refresh</a>');
%index++;
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\tBACK\t1>Back To Main Menu</a>");
%client.PDAPage = "SLFSTS";
default: //If something fails, return to the main menu.
serverCmdProcessGameLink(%client,"BACK");
}
}
function checkEmails(%guid,%title)
{
for (%i = 0; %i < $Data::EMail::Count[%GUID]; %i++)
{
if ($Data::EMail::Title[%guid,%i] $= %title)
return true;
}
return false;
}
function plnametocid(%name)
{
%count = ClientGroup.getCount(); //counts total clients
for(%i = 0; %i < %count; %i++) //loops till all clients are accounted for
{
%obj = ClientGroup.getObject(%i); //gets the clientid based on the ordering hes in on the list
%nametest=%obj.namebase; //pointless step but i didnt feel like removing it....
%nametest=strlwr(%nametest); //make name lowercase
%name=strlwr(%name); //same as above, for the other name
if(strstr(%nametest,%name) != -1) //is all of name test used in name
return %obj; //if so return the clientid and stop the function
}
return 0; //if none fits return 0 and end function
}
function RPGGame::onEnterTrigger(%game, %name, %data, %obj, %colObj)
{
switch$(%obj.type)
{
case "Transport": if (%obj.targetTransform $= "") return;
%Colobj.setTransform(%obj.targetTransform);
if (%Colobj.Usewhiteout) %Obj.setWhiteout(0.8);
case "Territory": if (%obj.race $= "") return;
%obj.client.isOnTerritory[%Colobj.race] = true;
setClientTeam(%Colobj.client,getRaceTeam(%Obj.race));
if (%obj.location $= "")
{
messageClient(%Colobj.client,'MsgSPCurrentObjective1',"",'Location: %1.', %obj.race SPC "Territory");
messageClient(%colObj.client,'msgEnteredRaceTerritory','\c3You have entered %1 territory.',%obj.race);
}
else
{
messageClient(%colObj.client,'msgEnteredRaceTerritory','\c3You have entered %1.',%obj.location);
messageClient(%Colobj.client,'MsgSPCurrentObjective1',"",'Location: %1.', %obj.location);
}
case "Damage": //Will add lots o' vars onto it..
%obj.damage[%colobj] = true;
%colObj.isinLava = true;
}
if (%Colobj.message $= "" && %Colobj.type !$= "Territory")
messageClient(%Colobj.client,'MsgTrigger',%obj.message);
}
function RPGGame::onLeaveTrigger(%game, %name, %data, %obj, %colObj)
{
switch$(%obj.type)
{
case "Territory": if (%obj.race $= "") return;
if (%obj.location $= "")
messageClient(%Colobj.client,'MsgExitedRaceTerritory',"\c3You have exited "@%obj.race@" territory. Your sensor data is now undetectable.");
else
messageClient(%Colobj.client,'MsgExitedRaceTerritory',"\c3You have exited "@%obj.location@".");
%Colobj.client.isOnTerritory[%obj.race] = false;
messageClient(%colObj.client,'MsgSPCurrentObjective1',"",'Location: Unknown.');
setClientTeam(%Colobj.client,0); //Not on the sensor, I think
case "Damage":
%obj.damage[%obj] = false;
%colObj.isInLava = true;
}
}
function RPGGame::onTickTrigger(%game, %name, %data, %obj)
{
switch(%obj.type)
{
case "Damage":
for (%i = 0; %i < MissionCleanup.getCount(); %i++)
{
%objT = MissionCleanup.getObject(%i);
if (%objt.getClassName() $= "Player" && %objt.getState() $= "move")
{
if (%obj.damage[%objT] && %objT.isInLava)
%objT.damage(0, %objT.getPosition(), %obj.damage, %obj,damageType);
}
}
}
}
function serverCmdShowHud(%client, %tag)
{
%tagName = getWord(%tag, 1);
%tag = getWord(%tag, 0);
if (%tag $= 'scoreScreen')
serverCmdProcessGameLink(%client,%client.PDAPage);
messageClient(%client, 'OpenHud', "", %tag);
switch$ (%tagname)
{
case "vehicleHud":
vehicleHud::updateHud(1,%client,%tag);
case "scoreScreen":
updateScoreHudThread(%client, %tag);
}
}