From 503c692b53a37f38be2b384bb08633260cf7224e Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 17 Mar 2016 02:16:49 -0400 Subject: [PATCH] Committed old RPGGame.cs for historic bookkeeping. --- scripts/RPGGame.cs | 1050 ++++++++++++++++++++++++++++++-------------- 1 file changed, 726 insertions(+), 324 deletions(-) mode change 100644 => 100755 scripts/RPGGame.cs diff --git a/scripts/RPGGame.cs b/scripts/RPGGame.cs old mode 100644 new mode 100755 index 6668332..d223c64 --- a/scripts/RPGGame.cs +++ b/scripts/RPGGame.cs @@ -1,324 +1,726 @@ -// DisplayName = Birth of Legend - -//--- GAME RULES BEGIN --- -// There are none, the gameMode conforms itself towards what you do. -//--- GAME RULES END --- - -// Notes: -// In Role Playing, you select your race (at the warrior pane), join an RPG server and your -// character is setup (specifically to that server). From there, you can start clans, build -// bases, and war with each other. Basically, it's a freeMode sort of thing. - -//exec the AI scripts -exec("scripts/aiRPG.cs"); - -// exec a bunch of dependencies -exec("scripts/modScripts/server/RPG/initialise.cs"); - -$InvBanList[RPG, "C4Charge"] = 1; - -//-- tracking --- -function RPGGame::initGameVars(%game) -{ - //%game. = ""; //I guess I'll eventually set some, but most are loaded via BASIC files -} - -package RPGGame -{ - function notifyMatchStart(%time){} - 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) -{ - defaultGame::setUpTeams(%game); - %game.numTeams = 1; - setSensorGroupCount(4); - $TeamDamage = true; //Allow team Damage -} - -function RPGGame::getTeamSkin(%game, %team) -{ - if($host::tournamentMode) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - { - return $teamSkin[%team]; - } - - else - { - //error("CTFGame::getTeamSkin"); - if(!$host::useCustomSkins) - { - %terrain = MissionGroup.musicTrack; - //error("Terrain type is: " SPC %terrain); - switch$(%terrain) - { - case "lush": - if(%team == 1) - %skin = 'beagle'; - else if(%team == 2) - %skin = 'dsword'; - else %skin = 'base'; - - case "badlands": - if(%team == 1) - %skin = 'swolf'; - else if(%team == 2) - %skin = 'dsword'; - else %skin = 'base'; - - case "ice": - if(%team == 1) - %skin = 'swolf'; - else if(%team == 2) - %skin = 'beagle'; - else %skin = 'base'; - - case "desert": - if(%team == 1) - %skin = 'cotp'; - else if(%team == 2) - %skin = 'beagle'; - else %skin = 'base'; - - case "Volcanic": - if(%team == 1) - %skin = 'dsword'; - else if(%team == 2) - %skin = 'cotp'; - else %skin = 'base'; - - default: - if(%team == 2) - %skin = 'baseb'; - else %skin = 'base'; - } - } - else %skin = $teamSkin[%team]; - - //error("%skin = " SPC getTaggedString(%skin)); - return %skin; -} -} - -function RPGGame::getTeamName(%game, %team) -{ - // --------------------------------------------------- - // z0dd - ZOD 3/30/02. Only display default team names - //if ( isDemo() || $host::tournamentMode) - return $TeamName[%team]; - // --------------------------------------------------- -} - -//-------------------------------------------------------------------------- -function RPGGame::missionLoadDone(%game) -{ - //default version sets up teams - must be called first... - DefaultGame::missionLoadDone(%game); -} - -function RPGGame::showStalemateTargets(%game) -{ - cancel(%game.stalemateSchedule); - - //show the targets - for (%i = 1; %i <= 2; %i++) - { - %flag = $TeamFlag[%i]; - - //find the object to scope/waypoint.... - //render the target hud icon for slot 1 (a centermass flag) - //if we just set him as always sensor vis, it'll work fine. - if (isObject(%flag.carrier)) - setTargetAlwaysVisMask(%flag.carrier.getTarget(), 0x7); - } - //schedule the targets to hide - %game.stalemateObjsVisible = true; - %game.stalemateSchedule = %game.schedule(%game.stalemateDurationMS, hideStalemateTargets); -} - -function RPGGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) -{ - if(%clVictim.headshot && %damageType == $DamageType::Laser && %clVictim.team != %clAttacker.team) - { - %clAttacker.scoreHeadshot++; - if (%game.SCORE_PER_HEADSHOT != 0) - { - messageClient(%clAttacker, 'msgHeadshot', '\c0You received a %1 point bonus for a successful headshot.', %game.SCORE_PER_HEADSHOT); - messageTeamExcept(%clAttacker, 'msgHeadshot', '\c5%1 hit a sniper rifle headshot.', %clAttacker.name); // z0dd - ZOD, 8/15/02. Tell team - } - %game.recalcScore(%clAttacker); - } - - // ----------------------------------------------- - // z0dd - ZOD, 8/25/02. Rear Lance hits - if(%clVictim.rearshot && %damageType == $DamageType::ShockLance && %clVictim.team != %clAttacker.team) - { - %clAttacker.scoreRearshot++; - if (%game.SCORE_PER_REARSHOT != 0) - { - messageClient(%clAttacker, 'msgRearshot', '\c0You received a %1 point bonus for a successful rearshot.', %game.SCORE_PER_REARSHOT); - messageTeamExcept(%clAttacker, 'msgRearshot', '\c5%1 hit a shocklance rearshot.', %clAttacker.name); - } - %game.recalcScore(%clAttacker); - } - // ----------------------------------------------- - - //the DefaultGame will set some vars - DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); - - //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) - if ((%clVictim.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) - { - %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer - %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT, %clAttacker.dmgdFlagCarrier = false); - } -} - -//////////////////////////////////////////////////////////////////////////////////////// -function RPGGame::clientMissionDropReady(%game, %client) -{ - messageClient(%client, 'MsgClientReady',"", "SinglePlayerGame"); //Force the SP game objective hud to setup - %game.resetScore(%client); - - messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); - - DefaultGame::clientMissionDropReady(%game, %client); - - //Force client Spawn since we're ready now - %client.schedule(100,"spawn"); - //%client.setControlObject(%client.player); - commandToClient(%client,'bottomPrint',"Try not to die.",3); - - // FIXME: Always assigns radio access for now - %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"); - //Make sure the data hud is working. - messageClient(%client,'MsgSPCurrentObjective1',"",'Location: Unknown.'); - messageClient(%client,'MsgSPCurrentObjective2',"",'Money: $%1.',%client.money); -} - -function RPGGame::assignClientTeam(%game, %client, %respawn) -{ - DefaultGame::assignClientTeam(%game, %client, %respawn); - // if player's team is not on top of objective hud, switch lines - messageClient(%client, 'MsgCheckTeamLines', "", %client.team); -} - -function RPGGame::applyConcussion(%game, %player) -{ -} - -function RPGGame::vehicleDestroyed(%game, %vehicle, %destroyer) -{ -} - -function RPGGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) -{ - defaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); - commandToClient(%clVictim,'HandleScriptedCommand',2); - //No, play this epic audio: - schedule(2000,0,"messageClient",%clVictim,'MsgDeath',"~wfx/Lose.wav"); - forceScoreScreenOpen(%clVictim,"DEATH"); - $Data::ShouldApply[%clVictim.GUID] = false; - - if (%clVictim.isAIControlled()) - %clVictim.drop(); -} - -function RPGGame::createPlayer(%game, %client, %spawnLoc, %respawn) -{ - DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn); - %client.observerMode = ""; - commandToClient(%client, 'setHudMode', 'Standard'); - %client.setControlObject(%client.player); -} - -function RPGGame::startMatch(%game) -{ - echo("START MATCH"); - //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... - $matchStarted = true; - - %game.clearDeployableMaxes(); - - $missionStartTime = getSimTime(); - %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000); - - // 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 ); -} \ No newline at end of file +// DisplayName = Birth of Legend + +//--- GAME RULES BEGIN --- +// There are none, the gameMode conforms itself towards what you do. +//--- GAME RULES END --- + +// Notes: +// In Role Playing, you select your race (at the warrior pane), join an RPG server and your +// character is setup (specifically to that server). From there, you can start clans, build +// bases, and war with each other. Basically, it's a freeMode sort of thing. + +//exec the AI scripts +exec("scripts/aiRPG.cs"); + +$RequiresClient[RPG] = true; +$InvBanList[RPG, "C4Charge"] = 1; + +//-- tracking --- +function RPGGame::initGameVars(%game) +{ + //%game. = ""; //I guess I'll eventually set some, but most are loaded via BASIC files +} + +package RPGGame +{ +function blah(){} //Eh.. +}; + +function RPGGame::setUpTeams(%game) +{ + defaultGame::setUpTeams(%game); + %game.numTeams = 1; + setSensorGroupCount(4); + $TeamDamage = true; //Allow team Damage +} + +function RPGGame::getTeamSkin(%game, %team) +{ + if($host::tournamentMode) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here + { + return $teamSkin[%team]; + } + + else + { + //error("CTFGame::getTeamSkin"); + if(!$host::useCustomSkins) + { + %terrain = MissionGroup.musicTrack; + //error("Terrain type is: " SPC %terrain); + switch$(%terrain) + { + case "lush": + if(%team == 1) + %skin = 'beagle'; + else if(%team == 2) + %skin = 'dsword'; + else %skin = 'base'; + + case "badlands": + if(%team == 1) + %skin = 'swolf'; + else if(%team == 2) + %skin = 'dsword'; + else %skin = 'base'; + + case "ice": + if(%team == 1) + %skin = 'swolf'; + else if(%team == 2) + %skin = 'beagle'; + else %skin = 'base'; + + case "desert": + if(%team == 1) + %skin = 'cotp'; + else if(%team == 2) + %skin = 'beagle'; + else %skin = 'base'; + + case "Volcanic": + if(%team == 1) + %skin = 'dsword'; + else if(%team == 2) + %skin = 'cotp'; + else %skin = 'base'; + + default: + if(%team == 2) + %skin = 'baseb'; + else %skin = 'base'; + } + } + else %skin = $teamSkin[%team]; + + //error("%skin = " SPC getTaggedString(%skin)); + return %skin; +} +} + +function RPGGame::getTeamName(%game, %team) +{ + // --------------------------------------------------- + // z0dd - ZOD 3/30/02. Only display default team names + //if ( isDemo() || $host::tournamentMode) + return $TeamName[%team]; + // --------------------------------------------------- +} + +//-------------------------------------------------------------------------- +function RPGGame::missionLoadDone(%game) +{ + //default version sets up teams - must be called first... + DefaultGame::missionLoadDone(%game); +} + +function RPGGame::showStalemateTargets(%game) +{ + cancel(%game.stalemateSchedule); + + //show the targets + for (%i = 1; %i <= 2; %i++) + { + %flag = $TeamFlag[%i]; + + //find the object to scope/waypoint.... + //render the target hud icon for slot 1 (a centermass flag) + //if we just set him as always sensor vis, it'll work fine. + if (isObject(%flag.carrier)) + setTargetAlwaysVisMask(%flag.carrier.getTarget(), 0x7); + } + //schedule the targets to hide + %game.stalemateObjsVisible = true; + %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) +{ + if(%clVictim.headshot && %damageType == $DamageType::Laser && %clVictim.team != %clAttacker.team) + { + %clAttacker.scoreHeadshot++; + if (%game.SCORE_PER_HEADSHOT != 0) + { + messageClient(%clAttacker, 'msgHeadshot', '\c0You received a %1 point bonus for a successful headshot.', %game.SCORE_PER_HEADSHOT); + messageTeamExcept(%clAttacker, 'msgHeadshot', '\c5%1 hit a sniper rifle headshot.', %clAttacker.name); // z0dd - ZOD, 8/15/02. Tell team + } + %game.recalcScore(%clAttacker); + } + + // ----------------------------------------------- + // z0dd - ZOD, 8/25/02. Rear Lance hits + if(%clVictim.rearshot && %damageType == $DamageType::ShockLance && %clVictim.team != %clAttacker.team) + { + %clAttacker.scoreRearshot++; + if (%game.SCORE_PER_REARSHOT != 0) + { + messageClient(%clAttacker, 'msgRearshot', '\c0You received a %1 point bonus for a successful rearshot.', %game.SCORE_PER_REARSHOT); + messageTeamExcept(%clAttacker, 'msgRearshot', '\c5%1 hit a shocklance rearshot.', %clAttacker.name); + } + %game.recalcScore(%clAttacker); + } + // ----------------------------------------------- + + //the DefaultGame will set some vars + DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); + + //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) + if ((%clVictim.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) + { + %clAttacker.dmgdFlagCarrier = true; + cancel(%clAttacker.threatTimer); //restart timer + %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT, %clAttacker.dmgdFlagCarrier = false); + } +} + +//////////////////////////////////////////////////////////////////////////////////////// +function RPGGame::clientMissionDropReady(%game, %client) +{ + messageClient(%client, 'MsgClientReady',"", "SinglePlayerGame"); //Force the SP game objective hud to setup + %game.resetScore(%client); + + messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); + + DefaultGame::clientMissionDropReady(%game, %client); + + //Force client Spawn since we're ready now + schedule(1000,0,"forceClientSpawn",%client,true); + + %client.setControlObject(%client.player); + commandToClient(%client,'bottomPrint',"Try not to die.",3); + + //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"); + //Make sure the data hud is working. + messageClient(%client,'MsgSPCurrentObjective1',"",'Location: Unknown.'); + messageClient(%client,'MsgSPCurrentObjective2',"",'Money: $%1.',%client.money); +} + +function RPGGame::assignClientTeam(%game, %client, %respawn) +{ + DefaultGame::assignClientTeam(%game, %client, %respawn); + // if player's team is not on top of objective hud, switch lines + messageClient(%client, 'MsgCheckTeamLines', "", %client.team); +} + +function RPGGame::applyConcussion(%game, %player) +{ +} + +function RPGGame::vehicleDestroyed(%game, %vehicle, %destroyer) +{ +} + +function RPGGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) +{ + defaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); + commandToClient(%clVictim,'HandleScriptedCommand',2); + //commandToClient(%clVictim,'alxPlayMusic',"T2BOL/Music/TribesHymn.mp3"); //Add a little music that becomes audible if the player idles in death for a bit.. + //No, play this epic audio: + schedule(2000,0,"messageClient",%clVictim,'MsgDeath',"~wfx/Lose.wav"); + forceScoreScreenOpen(%clVictim,"DEATH"); + $Data::ShouldApply[%clVictim.GUID] = false; + + if (%clVictim.isAIControlled()) + %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', "", 'Main Page'); + messageClient( %client, 'SetScoreHudSubheader', "", "Please select a command."); + + %index = 0; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Command List:"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Self Statistics"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Electronic Mail"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-View Inventory"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Clan Management"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Save Game"); + + %client.PDAPage = "MAIN"; + } +} +function RPGGame::createPlayer(%game, %client, %spawnLoc, %respawn) +{ +DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn); +commandToClient(%client,'HandleScriptedCommand',9,formatTimeString("HHnn") SPC "Hrs."); +} + +function RPGGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5) +{ +messageClient( %client, 'ClearHud', "", 'scoreScreen', 0 ); + +//Special handles here.. +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', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Delete E-Mail "@$Data::EMail::Date[%client.GUID,%i]@"Reply"); +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'From %1:',$Data::EMail::Sender[%client.GUID,%i]); +%index++; +%count = getSubStrOccurance($Data::EMail::Content[%client.GUID,%id],"\t"); +echo(%count); + +if (%count != 0) +for (%i = 0; %i < %count; %i++) +{ +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '%1',getField($Data::EMail::Contents[%client.GUID,%id],%i)); +%index++; +} +else +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '%1',$Data::EMail::Contents[%client.GUID,%id]); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Listing"); +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', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", 'E-Mail sent to %1.',%name); +messageClient( %client, 'SetLineHud', "", 'scoreScreen', 1, 'Back to Listing'); +$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', "", 'Main PageClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Please select a command."); + + %index = 0; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Command List:"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Self Statistics"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Electronic Mail"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-View Inventory"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Clan Management"); + %index++; + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "-Save Game"); + +%client.PDAPage = "MAIN"; + +case "CLNSTP": +messageClient( %client, 'SetScoreHudHeader', "", 'Clan ManagementClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Showing clan setup."); +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Clan Name: %1 [Change]',%client.clanN); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Clan Tag: %1 [Change]',%client.clanT); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Short Description: %1 [Change]',%client.description); +%index++; + +if (%client.clanN !$= "" && %client.clanT !$= "") +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Done'); +%index++; + +%client.PDAPage = "CLNSTP"; + +case "EMAIL": +messageClient( %client, 'SetScoreHudHeader', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "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, '%2 - %3',%i,$Data::EMail::Sender[%client.GUID,%i],$Data::EMail::Title[%client.GUID,%i]); + %index++; + } +} + +if (%index == 0) +{ +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "There are no E-Mails to show."); +%index++; +} + +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "[Compose an E-Mail]"); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Main Menu"); +%index++; + +case "EMAILSEND": +messageClient( %client, 'SetScoreHudHeader', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "New E-Mail"); + +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Title: %1 [Change]',%client.emailTitle); +%index++; + +%count = getSubStrOccurance(%client.emailCont,"\t"); + +if (%count != 0) +for (%i = 0; %i < %count; %i++) +{ +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Contents: %1 [Change]',%client.emailCont); +} +else +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Contents: %1 [Change]',%client.emailCont); +%index++; +if (%client.emailTitle !$= "" && %client.emailcont !$= "") +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Select Receptiant'); + +case "RECPT": +messageClient( %client, 'SetScoreHudHeader', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Select Receptiant"); + +%count = $Data::ClientCount; +%index = 0; +for (%i = 0; %i < %count; %i++) +{ + messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '%2',%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', "", 'Clan ManagementClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Showing clan management."); +%index = 0; + +if (!$Data::IsInClan[%client.GUID]) +{ +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'You are not in a clan. Try creating a [New Clan].'); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Or view the [List] of clans.'); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Main Menu"); +} +else +{ +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Clan Name: %1',$Data::ClanName[$Data::ClanID[%client.GUID]]); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Clan Tag: %1', $Data::ClanTag[$Data::ClanID[%client.GUID]]); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Short Description: %1',%client.description); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, ''); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '[View] member list.'); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '[View] other clans.'); +if ($Data::IsInClan[%client.GUID] && $Data::ClanLeaderGUID[$Data::ClanID[%client.GUID]] == %client.GUID) +{ +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '[Edit] Clan.'); +} +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Main Menu"); +} + +%client.PDAPage = "CLNMG"; + +case "CLNMBR": +%client.PDAPage = "CLNMBR"; + +messageClient( %client, 'SetScoreHudHeader', "", 'Clan ManagementClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Showing member list."); +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Name: %1',%client.namebase); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Back To Previous Page'); +%index++; + + +case "SLFSTS": //Self Statistics +messageClient( %client, 'SetScoreHudHeader', "", 'Self StatisticsClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Showing your stats."); +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Name: %1',%client.namebase); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Race: %1',%client.race); +%index++; + +if (%client.money $= "") +%client.money = 0; //You got zilch. + +%trans = %client.player.getTransform(); +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Cash: $%1',%client.money); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '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, 'Refresh'); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Main Menu"); +%client.PDAPage = "SLFSTS"; + +case "INVENTORY": //View Inventory +messageClient( %client, 'SetScoreHudHeader', "", 'Show InventoryClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "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, "Back To Main Menu"); +%client.PDAPage = "INVENTORY"; + +case "DEATH": +if (isObject(%client.player) && %client.player.getState() $= "Move") +return; + +messageClient( %client, 'SetScoreHudHeader', "", 'Death'); +messageClient( %client, 'SetScoreHudSubheader', "", "You have died."); + +messageClient( %client, 'SetLineHud', "", 'scoreScreen', 0, "Respawn"); +%client.PDAPage = "DEATH"; + +case "DELETE": +messageClient( %client, 'SetScoreHudHeader', "", 'Electronic MailClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "E-Mail deleted."); +messageClient( %client, 'SetLineHud', "", 'scoreScreen', 0, 'Back to Listing'); +$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', "", 'Self StatisticsClose'); +messageClient( %client, 'SetScoreHudSubheader', "", "Showing your stats."); +%index = 0; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Name: %1',%client.namebase); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Race: %1',%client.race); +%index++; + +if (%client.race $= "Draakan") +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Type: %1',%client.sex); +else +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Sex: %1',%client.sex); +%index++; + +if (%client.money $= "") +%client.money = 0; //You got zilch. + +%trans = %client.player.getTransform(); +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, 'Cash: $%1',%client.money); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, '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, 'Refresh'); +%index++; +messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "Back To Main Menu"); +%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); + + } +} +