mirror of
https://github.com/Ragora/T2-BoL.git
synced 2026-04-21 18:05:03 +00:00
Brought up to date with the newest T2BoL I've located
This commit is contained in:
parent
8c96cba3e1
commit
accd31895e
287 changed files with 108557 additions and 107608 deletions
49
scripts/modscripts/server/RPG/ClientFunctions.cs
Normal file
49
scripts/modscripts/server/RPG/ClientFunctions.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// BoLFunctions.cs
|
||||
// T2BoL Specific Functions
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function GameConnection::saveState(%this)
|
||||
{
|
||||
if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
error("Not running the BoL gamemode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function GameConnection::loadState(%this, %file)
|
||||
{
|
||||
if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
error("Not running the BoL gamemode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AIConnection::saveState(%this)
|
||||
{
|
||||
if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
error("Not running the BoL gamemode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AIConnection::loadState(%this, %file)
|
||||
{
|
||||
if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
error("Not running the BoL gamemode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
31
scripts/modscripts/server/RPG/GameTriggers.cs
Normal file
31
scripts/modscripts/server/RPG/GameTriggers.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// GameTriggers.cs
|
||||
// Trigger code for RPG Gamemode
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//==============================================================================
|
||||
|
||||
$BOL::Triggers::Territory = 0;
|
||||
$BOL::Triggers::Damage = 1;
|
||||
$BOL::Triggers::TeleportStart = 2;
|
||||
$PDA::Triggers::TeleportEnd = 3;
|
||||
|
||||
function RPGGame::onEnterTrigger(%game, %name, %data, %obj, %colObj)
|
||||
{
|
||||
switch (%obj.Type)
|
||||
{
|
||||
case $BOL::Triggers::Territory:
|
||||
echo("LOL");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function RPGGame::onLeaveTrigger(%game, %name, %data, %obj, %colObj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function RPGGame::onTickTrigger(%game, %name, %data, %obj)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
63
scripts/modscripts/server/RPG/Interact.cs
Normal file
63
scripts/modscripts/server/RPG/Interact.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//--$BOL::PDA::Page::Interact----------------------------------------------------------------------------
|
||||
// Interact.cs
|
||||
// Functions for object interaction in T2BoL
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$BOL::Interact::Type::General = 0; // Generic; jus makes conversation
|
||||
|
||||
$BOL::Interact::Range = 50; // In Meters
|
||||
function serverCmdInteractWithObject(%client)
|
||||
{
|
||||
if (!IsObject(%client.player) || %client.player.getState() !$= "Move")
|
||||
{
|
||||
messageClient(%client, 'MsgClient', "\c3Sorry, you appear to be dead.");
|
||||
return false;
|
||||
}
|
||||
|
||||
%player = %client.player;
|
||||
%pos = getWords(%player.getEyeTransform(), 0, 2);
|
||||
%vec = %player.getMuzzleVector($WeaponSlot);
|
||||
%targetpos=vectoradd(%pos,vectorscale(%vec,5000));
|
||||
|
||||
%object = getWord(containerRayCast(%pos,%targetpos,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType,%player),0);
|
||||
echo(%object);
|
||||
if (!isObject(%object) || !%object.isInteractive)
|
||||
return false;
|
||||
|
||||
%client.pdaPage = $BOL::PDA::Page::Interacted;
|
||||
serverCmdShowHud(%client, 'scoreScreen');
|
||||
return true;
|
||||
}
|
||||
|
||||
function Player::interactListUpdate(%this)
|
||||
{
|
||||
if (!isObject(%this.interactList))
|
||||
%this.interactList = Array.create();
|
||||
|
||||
// We don't want to run multiple threads ...
|
||||
cancel(%this.interactListUpdateThread);
|
||||
// We also don't need dead people or bots to be doing this either
|
||||
if ((%this.getState() !$= "Move" && %this.getState() !$= "Mounted") || %this.client.isAIControlled())
|
||||
return;
|
||||
|
||||
%found = Array.create(); // This takes up one objID per call, but objID's go up to 2^32, so this shouldn't matter as it helps make cleaner code here
|
||||
%found_anything = false;
|
||||
InitContainerRadiusSearch(%this.getWorldBoxCenter(), $BOL::Interact::Range, $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
|
||||
while ((%target = containerSearchNext()) != 0)
|
||||
{
|
||||
//if (!calcExplosionCoverage(%this.getWorldBoxCenter(), %target,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType))
|
||||
// continue;
|
||||
%found.setElement(%found.count(), %target);
|
||||
if(isObject(%target) && %target !$= %this && !%this.interactList.hasElementValue(%target))
|
||||
%this.interactList.setElement(%this.interactList.count(), %target);
|
||||
}
|
||||
|
||||
// Remove any non-found elements from the interact list
|
||||
for (%i = %this.interactList.count(); %i > -1; %i--)
|
||||
if (!%found.hasElementValue(%this.interactList.element(%i)))
|
||||
%this.interactList.removeElement(%i);
|
||||
|
||||
%found.delete();
|
||||
%this.interactListUpdateThread = %this.schedule(100, "interactListUpdate");
|
||||
}
|
||||
268
scripts/modscripts/server/RPG/PDA.cs
Normal file
268
scripts/modscripts/server/RPG/PDA.cs
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// PDA.cs
|
||||
// PDA code for T2BoL
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//==============================================================================
|
||||
|
||||
// 0-100
|
||||
$BOL::PDA::Page::Main = 0;
|
||||
|
||||
$BOL::PDA::Page::Applications = 1;
|
||||
$BOL::PDA::Page::Close = 2; // Not even necessarily a page but it's used to signal the client wants to close
|
||||
$BOL::PDA::Page::Stats = 3;
|
||||
$BOL::PDA::Page::Save = 4;
|
||||
$BOL::PDA::Page::FactionManagement = 5;
|
||||
|
||||
$BOL::PDA::Page::Radio = 6;
|
||||
$BOL::PDA::Page::Voice = 7;
|
||||
|
||||
$BOL::PDA::Function::Increment = 1;
|
||||
$BOL::PDA::Function::Decrement = 2;
|
||||
|
||||
$BOL::PDA::Page::EMail = 8;
|
||||
$BOL::PDA::Page::Inbox = 9;
|
||||
$BOL::PDA::Page::Outbox = 10;
|
||||
$BOL::PDA::Page::Compose = 11;
|
||||
|
||||
$BOL::PDA::Page::Wiki = 12;
|
||||
|
||||
// 101-201
|
||||
$BOL::PDA::Page::Interact = 101;
|
||||
$BOL::PDA::Page::Interacted = 102;
|
||||
$BOL::PDA::Page::Hack = 103;
|
||||
$BOL::PDA::Page::Information = 104;
|
||||
|
||||
function RPGGame::updateScoreHud(%game, %client, %tag)
|
||||
{
|
||||
if (%client.PDAPage == $BOL::PDA::Page::Main || %client.PDAPage == $BOL::PDA::Page::Interact)
|
||||
Game.processGameLink(%client, %client.PDAPage);
|
||||
}
|
||||
|
||||
function RPGGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5)
|
||||
{
|
||||
%index = 0;
|
||||
if (%arg1 != $BOL::PDA::Page::Close)
|
||||
%client.PDAPage = %arg1;
|
||||
messageClient( %client, 'ClearHud', "", 'scoreScreen', 0 );
|
||||
|
||||
switch(%arg1)
|
||||
{
|
||||
//------------------------------------------------------------------------------
|
||||
// PDA Applications
|
||||
//------------------------------------------------------------------------------
|
||||
case $BOL::PDA::Page::Applications:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Main');
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <color:FF0000>Applications<color:66EEEE> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t0>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Command List:");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Stats @ "\t1>- Self Diagnosis</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Interact @ "\t0>- Interact with Object</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t0>- Radio</a>");
|
||||
%index++;
|
||||
if (!$Host::GlobalChat)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t0>- Voice Settings</a>");
|
||||
%index++;
|
||||
}
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::FactionManagement @ "\t1>- Faction Management</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Save @ "\t1>- Save State</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Stats:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>Automated Self Diagnosis Systems v1.2<just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Copyright (c) 3030 S.G.S. Corporation');
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Name: " @ %client.namebase);
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Species: " @ %client.race);
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Subject Condition: " @ 100 - mfloor(100*%client.player.getDamageLevel()) @ "%");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Stats @ "\t1>REFRESH</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Radio:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Radio');
|
||||
|
||||
if (!%client.hasRadio)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- You do not have a radio to manage --");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (%arg2)
|
||||
{
|
||||
case $BOL::PDA::Function::Increment:
|
||||
ServerCmdIncreaseRadioFrequency(%client, true);
|
||||
case $BOL::PDA::Function::Decrement:
|
||||
ServerCmdDecreaseRadioFrequency(%client, true);
|
||||
}
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Radio Status: Normal");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Current Frequency: " @ %client.radioFrequency @ "MHz");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t" @ $BOL::PDA::Function::Increment @ ">[Increment Frequency</a> - <a:gamelink\t" @ $BOL::PDA::Page::Radio @ "\t" @ $BOL::PDA::Function::Decrement @ ">Decrement Frequency]</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Voice:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Voice Settings');
|
||||
|
||||
switch (%arg2)
|
||||
{
|
||||
case $BOL::PDA::Function::Increment:
|
||||
serverCmdIncreaseVoiceRange(%client, true);
|
||||
case $BOL::PDA::Function::Decrement:
|
||||
serverCmdDecreaseVoiceRange(%client, true);
|
||||
}
|
||||
|
||||
%voice = %client.voiceMode;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Voice Status: Normal");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Current Voice: \x22" @ $BOL::Voice::Display[%voice] @ "\x22 (" @ $BOL::Voice::Range[%voice] @ " meters)");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t" @ $BOL::PDA::Function::Increment @ ">[Increment Range</a> - <a:gamelink\t" @ $BOL::PDA::Page::Voice @ "\t" @ $BOL::PDA::Function::Decrement @ ">Decrement Range]</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Interact:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Interact with Object');
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- Objects within Range --");
|
||||
%index++;
|
||||
|
||||
%client_team = getTargetSensorGroup(%client.target);
|
||||
%object_count = %client.player.interactList.count();
|
||||
if (%object_count > 0)
|
||||
for (%i = 0; %i < %object_count; %i++)
|
||||
{
|
||||
%object = %client.player.interactList.element(%i);
|
||||
if (isObject(%object))
|
||||
{
|
||||
%object_target = %object.target;
|
||||
if (%object_target != -1)
|
||||
{
|
||||
%object_team = getTargetSensorGroup(%object_target);
|
||||
%object_friendly = %client_team == %object_team;
|
||||
%object_friend_text = %object_friendly ? "Friendly" : "Enemy";
|
||||
%display = %object_friend_text SPC %object.getClassName() SPC "\x22" @ getTaggedString(getTargetName(%object_target)) @ "\x22";
|
||||
}
|
||||
else
|
||||
%display = "Unknown" SPC %object.getClassName() SPC "(" @ %object @ ")";
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>" @ %display);
|
||||
%index++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>There are no objects in range.");
|
||||
%index++;
|
||||
}
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
|
||||
case $BOL::PDA::Page::FactionManagement:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Applications | Faction Management');
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications@ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Save:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", '<just:center>Save State<just:right><a:gamelink\tCLOSE\t1>Close</a>');
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Save function is not supported as of now!");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>RETURN TO MAIN</a>");
|
||||
return;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// PDA E-Mail System
|
||||
//------------------------------------------------------------------------------
|
||||
case $BOL::PDA::Page::Inbox:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Your Inbox');
|
||||
return;
|
||||
case $BOL::PDA::Page::Outbox:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Your Outbox');
|
||||
return;
|
||||
case $BOL::PDA::Page::Compose:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Compose a New Mail');
|
||||
return;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Interaction Commands
|
||||
//------------------------------------------------------------------------------
|
||||
case $BOL::PDA::Page::Interact:
|
||||
return;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Handle for Normal PDA functions
|
||||
//------------------------------------------------------------------------------
|
||||
case $BOL::PDA::Page::Main:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Welcome to the PDA');
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Welcome to the PDA, this is where you will accomplish some daily tasks.");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Click any of the text in the subheader to begin exploring your PDA.");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::EMail:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>E-Mail | Main');
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <color:FF0000>E-Mail<color:66EEEE> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>E-Mail Functions:");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Inbox @ "\t1>Your Inbox (?)</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Outbox @ "\t1>Your Outbox (?)</a>");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center> - <a:gamelink\t" @ $BOL::PDA::Page::Compose @ "\t1>Compose a New Mail</a>");
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Close:
|
||||
serverCmdHideHud(%client, 'scoreScreen');
|
||||
commandToClient(%client, 'DisplayHuds');
|
||||
return;
|
||||
|
||||
case $BOL::PDA::Page::Wiki:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| <color:FF0000>Wiki<color:66EEEE> | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Wiki | Main');
|
||||
return;
|
||||
|
||||
default: // In case something stupid happens
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "<just:center>| Information | <a:gamelink\t" @ $BOL::PDA::Page::Applications @ "\t1>Applications</a> | <a:gamelink\t" @ $BOL::PDA::Page::EMail @ "\t1>E-Mail</a> | <a:gamelink\t" @ $BOL::PDA::Page::Wiki @ "\t1>Wiki</a> | <just:right><a:gamelink\t" @ $BOL::PDA::Page::Close @ "\t1>Close</a>");
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<just:center>Error | Main');
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- An ERROR has occurred in the PDA Subsystem code --");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>-- Please report this error to DarkDragonDX --");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center>Unknown PDA page: " @ %arg1);
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, " ");
|
||||
%index++;
|
||||
messageClient( %client, 'SetLineHud', "", 'scoreScreen', %index, "<just:center><a:gamelink\t" @ $BOL::PDA::Page::Main @ "\t1>-- RETURN TO MAIN --</a>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
32
scripts/modscripts/server/RPG/PDAApplication.cs
Normal file
32
scripts/modscripts/server/RPG/PDAApplication.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// PDAApplication.cs
|
||||
// Application SDK for the PDA. (to make my life easier)
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//==============================================================================
|
||||
|
||||
function PDAApplication::main(%this, %client)
|
||||
{
|
||||
}
|
||||
|
||||
function PDAApplication::action(%this, %client, %page)
|
||||
{
|
||||
}
|
||||
|
||||
function PDAApplication::exit(%this, %client, %page)
|
||||
{
|
||||
}
|
||||
|
||||
// API Functions
|
||||
function PDAApplication::setTitle(%this, %title)
|
||||
{
|
||||
// Won't do anything for now because the title is a clientside thing, actually.
|
||||
}
|
||||
|
||||
function PDAApplication::cls(%this)
|
||||
{
|
||||
}
|
||||
|
||||
// The script parses <URL=
|
||||
function PDAApplication::setLine(%this, %lineNo, %columnStart, %data)
|
||||
{
|
||||
}
|
||||
1
scripts/modscripts/server/RPG/RadioChat.cs
Normal file
1
scripts/modscripts/server/RPG/RadioChat.cs
Normal file
|
|
@ -0,0 +1 @@
|
|||
//------------------------------------------------------------------------------
// radioChat.cs
// Functions for radio voice in T2BoL
// Copyright (c) 2012 Robert MacGregor
//------------------------------------------------------------------------------
$BOL::Radio::Max = 10;
$BOL::Radio::Min = 1;
$BOL::Radio::Units = "MHz";
function ServerCmdIncreaseRadioFrequency(%client, %noDisplay)
{
if (!%client.hasRadio)
{
messageClient(%client, 'msgClient', "\c3You have no radio to tune.");
return;
}
else if ($CurrentMissionType !$= "RPG")
{
messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently.");
return;
}
if (%client.radioFrequency == 0)
%client.radioFrequency = 1;
if (%client.radioFrequency >= $BOL::Radio::Max)
%client.radioFrequency = $BOL::Radio::Min;
else
%client.radioFrequency++;
if (!%noDisplay)
messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ ".");
}
function ServerCmdDecreaseRadioFrequency(%client, %noDisplay)
{
if (!%client.hasRadio)
{
messageClient(%client, 'msgClient', "\c3You have no radio to tune.");
return;
}
if (%client.radioFrequency == 0)
%client.radioFrequency = 1;
if (%client.radioFrequency <= $BOL::Radio::Min)
%client.radioFrequency = $BOL::Radio::Max;
else
%client.radioFrequency--;
if (!%noDisplay)
messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ ".");
}
function radioBroadcast( %text, %frequency )
{
%units = $BOL::Radio::Units;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%client = ClientGroup.getObject( %i );
if ( %client.hasRadio && %client.radioFrequency == %frequency )
messageClient(%client,'msgClient',"\c3(" @ %frequency @ %units @ "): " @ %text @ "~wfx/misc/static.wav");
}
}
function radioChatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
if (!%sender.hasRadio)
{
messageClient(%sender,'msgNoRadio',"\c3You must have a radio.");
return;
}
%frequency = %sender.radioFrequency;
if (%frequency < $BOL::Radio::Min || %frequency > $BOL::Radio::Max)
{
%sender.radioFrequency = $BOL::Radio::Min;
messageClient(%sender,'msgClient',"\c3Your radio appears to be in dire need of retuning.");
return;
}
%units = $BOL::Radio::Units;
%count = ClientGroup.getCount();
for ( %i = 0; %i < %count; %i++ )
{
%client = ClientGroup.getObject(%i);
if ( %client.hasRadio && %client.radioFrequency == %sender.radioFrequency )
messageClient(%client,'msgClient',"\c3"@ %sender.namebase@ " (" @ %frequency @ %units @ "): "@%a2@" ~wfx/misc/static.wav");
}
}
|
||||
98
scripts/modscripts/server/RPG/RangedVoice.cs
Normal file
98
scripts/modscripts/server/RPG/RangedVoice.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// rangedVoice.cs
|
||||
// Functions for ranged voice in T2BoL
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$BOL::Voice::Whisper = 0;
|
||||
$BOL::Voice::Range[0] = 15;
|
||||
$BOL::Voice::Display[0] = "Whispering";
|
||||
|
||||
$BOL::Voice::Speak = 1;
|
||||
$BOL::voice::Range[1] = 25;
|
||||
$BOL::Voice::Display[1] = "Speaking";
|
||||
|
||||
$BOL::Voice::Yell = 2;
|
||||
$BOL::Voice::Range[2] = 50;
|
||||
$BOL::Voice::Display[2] = "Yelling";
|
||||
|
||||
$BOL::Voice::Scream = 3;
|
||||
$BOL::Voice::Range[3] = 100;
|
||||
$BOL::Voice::Display[3] = "Screaming";
|
||||
|
||||
$BOL::Voice::Total = 4;
|
||||
|
||||
function serverCmdIncreaseVoiceRange(%client, %noDisplay)
|
||||
{
|
||||
if ($CurrentMissionType $= "RPG" && $Host::GlobalChat)
|
||||
{
|
||||
messageClient(%client, 'msgClient', "\c3Server has global chat enabled.");
|
||||
return;
|
||||
}
|
||||
else if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (%client.voiceMode >= $BOL::Voice::Total-1)
|
||||
%client.voiceMode = 0;
|
||||
else
|
||||
%client.voiceMode++;
|
||||
%display = $BOL::Voice::Display[%client.voiceMode];
|
||||
%range = $BOL::Voice::Range[%client.voiceMode];
|
||||
if (!%noDisplay)
|
||||
messageClient(%client, 'msgClient',"\c3Voice mode set to \"" @ %display @ "\" (" @ %range @ "m)");
|
||||
}
|
||||
|
||||
function serverCmdDecreaseVoiceRange(%client, %noDisplay)
|
||||
{
|
||||
if ($CurrentMissionType $= "RPG" && $Host::GlobalChat)
|
||||
{
|
||||
messageClient(%client, 'msgClient', "\c3Server has global chat enabled.");
|
||||
return;
|
||||
}
|
||||
else if ($CurrentMissionType !$= "RPG")
|
||||
{
|
||||
messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (%client.voiceMode <= 0)
|
||||
%client.voiceMode = $BOL::Voice::Total-1;
|
||||
else
|
||||
%client.voiceMode--;
|
||||
%display = $BOL::Voice::Display[%client.voiceMode];
|
||||
%range = $BOL::Voice::Range[%client.voiceMode];
|
||||
if (!%noDisplay)
|
||||
messageClient(%client, 'msgClient',"\c3Voice mode set to \"" @ %display @ "\" (" @ %range @ "m)");
|
||||
}
|
||||
|
||||
function rangedchatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
%mode = %sender.voiceMode;
|
||||
|
||||
if (%mode < 0 || %mode >= $BOL::Voice::Total)
|
||||
{
|
||||
%sender.voiceMode = 0;
|
||||
%mode = 0;
|
||||
messageClient(%sender,'msgClient',"\c3Your throat feels agitated.");
|
||||
}
|
||||
%voicedist = $BOL::Voice::Range[%sender.voiceMode];
|
||||
%display = $BOL::Voice::Display[%sender.voiceMode];
|
||||
%count = MissionCleanup.getCount();
|
||||
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = MissionCleanup.getObject(%i);
|
||||
if (%obj.getClassName() $= "Player")
|
||||
{
|
||||
%dist = vectorDist(%sender.player.getPosition(),%obj.getPosition());
|
||||
if (%dist <= %voicedist)
|
||||
{
|
||||
%string = addTaggedString("(" @ %display @ " - " @ %voicedist @ "m) " @ getTaggedString(%a1));
|
||||
chatMessageClient( %obj.client, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %string, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
302
scripts/modscripts/server/RPG/dataImport.cs
Normal file
302
scripts/modscripts/server/RPG/dataImport.cs
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// scripts/modScripts/server/dataImport.cs
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function gameConnection::writeSaveFile(%this)
|
||||
{
|
||||
//Compile Main Variable List
|
||||
%mission = $CurrentMission;
|
||||
%player = %this.player;
|
||||
%transform = %player.getTransform();
|
||||
%velocity = %player.getVelocity();
|
||||
%damage = %player.getDamageLevel();
|
||||
%race = %this.race;
|
||||
%armor = %this.armor;
|
||||
%energy = %player.getEnergyLevel();
|
||||
%whiteout = %player.getWhiteout();
|
||||
%damageFlash = %player.getDamageFlash();
|
||||
%cash = %this.cash;
|
||||
%hasRadio = %this.hasRadio;
|
||||
%underStandsHuman = %this.underStandsHuman;
|
||||
%underStandsBioderm = %this.underStandsBioderm;
|
||||
%underStandsDraakan = %this.underStandsDraakan;
|
||||
%underStandsCriollos = %this.underStandsCriollos;
|
||||
|
||||
%time = formatTimeString("hh:nn A");
|
||||
%date = formatTimeString("mm/dd/yy");
|
||||
|
||||
%file = "data/game/saves/" @ %mission @ "/" @ %this.guid @ ".txt";
|
||||
%fileObj = new fileObject();
|
||||
%fileObj.openForWrite(%file);
|
||||
%fileObj.writeLine(";Saved by" SPC %this.nameBase SPC "on" SPC %date SPC "at" SPC %time);
|
||||
%fileObj.writeLine("");
|
||||
|
||||
//Todo: Make this writing method more efficient ...
|
||||
%fileObj.writeLine("[Character]");
|
||||
%fileObj.writeLine("transform = \x22" @ %transform @ "\x22;");
|
||||
%fileObj.writeLine("velocity = \x22" @ %velocity @ "\x22;");
|
||||
%fileObj.writeLine("damage = \x22" @ %damage @ "\x22;");
|
||||
%fileObj.writeLine("race = \x22" @ %race @ "\x22;");
|
||||
%fileObj.writeLine("armor = \x22" @ %armor @ "\x22;");
|
||||
%fileObj.writeLine("energy = \x22" @ %energy @ "\x22;");
|
||||
%fileObj.writeLine("whiteOut = \x22" @ %whiteout @ "\x22;");
|
||||
%fileObj.writeLine("damageFlash = \x22" @ %damageFlash @ "\x22;");
|
||||
%fileObj.writeLine("cash = \x22" @ %cash @ "\x22;");
|
||||
%fileObj.writeLine("hasRadio = \x22" @ %hasRadio @ "\x22;");
|
||||
%fileObj.writeLine("underStandsHuman = \x22" @ %underStandsHuman @ "\x22;");
|
||||
%fileObj.writeLine("underStandsBioderm = \x22" @ %underStandsBioderm @ "\x22;");
|
||||
%fileObj.writeLine("underStandsDraakan = \x22" @ %underStandsDraakan @ "\x22;");
|
||||
%fileObj.writeLine("underStandsCriollos = \x22" @ %underStandsCriollos @ "\x22;");
|
||||
%fileObj.writeLine("");
|
||||
|
||||
//Compile Inventory List
|
||||
%slotCount = %player.weaponSlotCount;
|
||||
%healthKits = %player.invRepairKit;
|
||||
%fileObj.writeLine("[Inventory]");
|
||||
%fileObj.writeLine("slotCount = \x22" @ %slotCount @ "\x22;");
|
||||
|
||||
for (%i = 0; %i < %slotCount; %i++)
|
||||
{
|
||||
%weaponName = %player.weaponSlot[%i];
|
||||
%weaponAmmo = eval("%weaponAmmo = %player.inv" @ %weaponName @ "Ammo" @ ";");
|
||||
%fileObj.writeLine("slot" @ %i SPC "= \x22" @ %weaponName @ "\x22;");
|
||||
%fileObj.writeLine("slot" @ %i @ "Ammo" SPC "= \x22" @ %weaponAmmo @ "\x22;");
|
||||
}
|
||||
|
||||
%fileObj.writeLine("healthKits = \x22" @ %healthKits @ "\x22;");
|
||||
%fileObj.detach();
|
||||
logEcho(" -- Save File Written for Player:" SPC %this.namebase SPC "--");
|
||||
return true;
|
||||
}
|
||||
|
||||
function gameConnection::applySaveFile(%this)
|
||||
{
|
||||
//Compile Main Variable List
|
||||
%mission = $CurrentMission;
|
||||
%file = "data/game/saves/" @ %mission @ "/" @ %this.guid @ ".txt";
|
||||
|
||||
if (!isFile(%file))
|
||||
return false;
|
||||
|
||||
%transform = getBlockData(%file,"Character",1,"transform");
|
||||
%velocity = getBlockData(%file,"Character",1,"velocity");
|
||||
%damage = getBlockData(%file,"Character",1,"damage");
|
||||
%race = getBlockData(%file,"Character",1,"race");
|
||||
%armor = getBlockData(%file,"Character",1,"armor");
|
||||
%energy = getBlockData(%file,"Character",1,"energyLevel");
|
||||
%whiteout = getBlockData(%file,"Character",1,"whiteOut");
|
||||
%damageFlash = getBlockData(%file,"Character",1,"damageFlash");
|
||||
%cash = getBlockData(%file,"Character",1,"cash");
|
||||
%hasRadio = getBlockData(%file,"Character",1,"hasRadio");
|
||||
%underStandsHuman = getBlockData(%file,"Character",1,"underStandsHuman");
|
||||
%underStandsBioderm = getBlockData(%file,"Character",1,"underStandsBioderm");
|
||||
%underStandsDraakan = getBlockData(%file,"Character",1,"underStandsDraakan");
|
||||
%underStandsCriollos = getBlockData(%file,"Character",1,"underStandsCriollos");
|
||||
|
||||
%player = %this.player;
|
||||
%player.setTransform(%transform);
|
||||
%player.setVelocity(%velocity);
|
||||
%player.applyDamage(%damage);
|
||||
%player.setArmor(%armor);
|
||||
%player.setEnergyLevel(%energy);
|
||||
%player.setWhiteout(%whiteOut);
|
||||
%player.setDamageFlash(%damageFlash);
|
||||
%this.cash = %cash;
|
||||
%this.underStandsHuman = %underStandsHuman;
|
||||
%this.underStandsBioderm = %underStandsBioderm;
|
||||
%this.underStandsDraakan = %underStandsDraakan;
|
||||
%this.underStandsCriollos = %underStandsCriollos;
|
||||
|
||||
return true;
|
||||
for (%i = 0; %i < %slotCount; %i++)
|
||||
{
|
||||
%weaponName = %player.weaponSlot[%i];
|
||||
%weaponAmmo = eval("%weaponAmmo = %player.inv" @ %weaponName @ "Ammo" @ ";");
|
||||
%fileObj.writeLine("slot" @ %i SPC "= \x22" @ %weaponName @ "\x22;");
|
||||
%fileObj.writeLine("slot" @ %i @ "Ammo" SPC "= \x22" @ %weaponAmmo @ "\x22;");
|
||||
}
|
||||
|
||||
%fileObj.writeLine("healthKits = \x22" @ %healthKits @ "\x22;");
|
||||
return;
|
||||
}
|
||||
|
||||
// Generic Import Functions
|
||||
function importGameData()
|
||||
{
|
||||
importGems();
|
||||
importOres();
|
||||
importCharacters();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Gem Import Functions
|
||||
function importGems()
|
||||
{
|
||||
if (!IsObject(GemData))
|
||||
{
|
||||
new ScriptObject(GemData);
|
||||
|
||||
if (!IsObject(GameData))
|
||||
new simGroup(GameData);
|
||||
|
||||
GameData.add(GemData);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
%file = "data/game/gems.txt";
|
||||
%count = getBlockCount(%file,"Gem") + 1;
|
||||
|
||||
for (%i = 1; %i < %count; %i++)
|
||||
{
|
||||
%name = getBlockData(%file,"Gem",%i,"Name");
|
||||
%price = getBlockData(%file,"Gem",%i,"Price");
|
||||
%sellPrice = getBlockData(%file,"Gem",%i,"SellPrice");
|
||||
|
||||
GemData.gem[%i] = %name;
|
||||
GemData.price[%name] = %price;
|
||||
GemData.sellPrice[%name] = %sellPrice;
|
||||
warn("Imported gem:" SPC %name);
|
||||
|
||||
GemData.gemCount = %count--;
|
||||
}
|
||||
|
||||
// Ore Import Functions
|
||||
function importOres()
|
||||
{
|
||||
if (!IsObject(OreData))
|
||||
{
|
||||
new ScriptObject(OreData);
|
||||
|
||||
if (!IsObject(GameData))
|
||||
new simGroup(GameData);
|
||||
|
||||
GameData.add(OreData);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
%file = "data/game/ores.txt";
|
||||
%count = getBlockCount(%file,"Ore") + 1;
|
||||
|
||||
for (%i = 1; %i < %count; %i++)
|
||||
{
|
||||
%name = getBlockData(%file,"Ore",%i,"Name");
|
||||
%price = getBlockData(%file,"Ore",%i,"Price");
|
||||
%sellPrice = getBlockData(%file,"Ore",%i,"SellPrice");
|
||||
|
||||
OreData.ore[%i] = %name;
|
||||
OreData.price[%name] = %price;
|
||||
OreData.sellPrice[%name] = %sellPrice;
|
||||
warn("Imported ore:" SPC %name);
|
||||
}
|
||||
OreData.oreCount = %count--;
|
||||
}
|
||||
|
||||
// Character Import Functions
|
||||
function spawnCharacter(%name,%trans,%aimPos,%team)
|
||||
{
|
||||
%object = "Character" @ %name;
|
||||
|
||||
if (!IsObject(%object))
|
||||
return false;
|
||||
|
||||
%Bname = %object.name;
|
||||
%race = %object.race;
|
||||
%skin = %object.skin;
|
||||
%voice = %object.voice;
|
||||
%voicePitch = %object.voicePitch;
|
||||
%sex = %object.sex;
|
||||
|
||||
%bot = aiConnectByName(%Bname,%team);
|
||||
%bot.race = %race;
|
||||
%bot.skin = addTaggedString(%skin);
|
||||
%bot.voice = %voice;
|
||||
%bot.voiceTag = addTaggedString(%voice);
|
||||
%bot.voicePitch = %voicePitch;
|
||||
%bot.sex = %sex;
|
||||
setVoice(%bot,%voice, %voicePitch);
|
||||
setSkin(%bot,%skin);
|
||||
setSkin(%bot,%skin);
|
||||
setTeam(%bot, %team);
|
||||
%bot.player.setArmor("light");
|
||||
%bot.player.setTransform(%trans);
|
||||
%bot.aimAt(%aimPos);
|
||||
warn("Spawned Character:" SPC %name);
|
||||
}
|
||||
|
||||
function importCharacters()
|
||||
{
|
||||
%path = "data/game/characters/*.txt";
|
||||
for( %file = findFirstFile( %path ); %file !$= ""; %file = findNextFile( %path ) )
|
||||
{
|
||||
%name = getFileNameFromString(%file);
|
||||
%pos = strStr(%name,".");
|
||||
%character = getSubStr(%name,0,%pos);
|
||||
importCharacter(%character);
|
||||
}
|
||||
}
|
||||
|
||||
function importCharacter(%character)
|
||||
{
|
||||
%prefix = "data/game/characters/";
|
||||
%file = %prefix @ %character @ ".txt";
|
||||
%charName = %character;
|
||||
%character = strReplace("Character" @ %character," ","_");
|
||||
|
||||
if (!IsFile(%file))
|
||||
return false;
|
||||
|
||||
if (!IsObject(%character))
|
||||
{
|
||||
new scriptObject(%character);
|
||||
if (!IsObject(GameData))
|
||||
new simGroup(GameData);
|
||||
|
||||
GameData.add(%character);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
//Get our variable values ...
|
||||
%name = getBlockData(%file,"Character",1,"Name");
|
||||
%race = getBlockData(%file,"Character",1,"Race");
|
||||
%sex = getBlockData(%file,"Character",1,"Sex");
|
||||
%skin = getBlockData(%file,"Character",1,"Skin");
|
||||
%voice = getBlockData(%file,"Character",1,"Voice");
|
||||
%voicePitch = getBlockData(%file,"Character",1,"VoicePitch");
|
||||
|
||||
//Import Message Arrays ... and assign them
|
||||
%arrayName[0] = "Death";
|
||||
%arrayName[1] = "Kill";
|
||||
%arrayName[2] = "Healed";
|
||||
%arrayCount = 3;
|
||||
|
||||
for (%i = 0; %i < %arrayCount; %i++)
|
||||
{
|
||||
%arrayVariableName[%i] = %arrayName[%i] @ "MessageArray";
|
||||
for (%j = 0; %j < 100; %j++)
|
||||
{
|
||||
%arrayTest = getArrayData(%file,%arrayName[%i],%j);
|
||||
if (%arrayTest !$= "}")
|
||||
{
|
||||
if (%j == 0)
|
||||
%arrayData[%i] = %arrayData[%i] @ %arrayTest;
|
||||
else
|
||||
%arrayData[%i] = %arrayData[%i] @ "\t" @ %arrayTest;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
eval(%character @ "." @ %arrayVariableName[%i] SPC "= \x22" @ %arrayData[%i] @ "\x22;");
|
||||
}
|
||||
//Assign the variables now ...
|
||||
%character.name = %name;
|
||||
%character.race = %race;
|
||||
%character.sex = %sex;
|
||||
%character.skin = %skin;
|
||||
%character.voice = %voice;
|
||||
%character.voicePitch = %voicePitch;
|
||||
warn("Imported Character:" SPC %charname);
|
||||
}
|
||||
1
scripts/modscripts/server/RPG/initialise.cs
Normal file
1
scripts/modscripts/server/RPG/initialise.cs
Normal file
|
|
@ -0,0 +1 @@
|
|||
//------------------------------------------------------------------------------
// initialise.cs
// Code executed by scripts/RPGGame.cs to load up any BoL specific components.
// Copyright (c) 2012 Robert MacGregor
//==============================================================================
exec("scripts/ModScripts/Server/RPG/ClientFunctions.cs");
exec("scripts/ModScripts/Server/RPG/GameTriggers.cs");
exec("scripts/ModScripts/Server/RPG/PDA.cs");
exec("scripts/ModScripts/Server/RPG/RangedVoice.cs");
exec("scripts/ModScripts/Server/RPG/RadioChat.cs");
exec("scripts/ModScripts/Server/RPG/Interact.cs");
|
||||
106
scripts/modscripts/server/RPG/looting.cs
Normal file
106
scripts/modscripts/server/RPG/looting.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
//Component: Lootage
|
||||
//Description: You can loot corpses. (w00t)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// DATABLOCKS
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ItemData(Lootbag)
|
||||
{
|
||||
className = Weapon;
|
||||
catagory = "Misc";
|
||||
shapeFile = "moneybag.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 50;
|
||||
pickupRadius = 2;
|
||||
pickUpPrefix = "a bag of items";
|
||||
alwaysAmbient = true;
|
||||
description = "lootbag_model";
|
||||
|
||||
computeCRC = false;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// BOUND FUNCTIONS
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//Realized this isn't required..
|
||||
//function LootBag::onAdd(%this,%obj) //Force a loot check on creation.
|
||||
//{
|
||||
//LootBagCheckForPickUp(%obj);
|
||||
//parent::onAdd(%this,%obj);
|
||||
//}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// FUNCTIONS
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function LootBagCheckForPickUp(%this) //Not sure why, loot bags won't do a T2 system pickup..
|
||||
{
|
||||
cancel(%this.loop);
|
||||
|
||||
if (!IsObject(%this))
|
||||
return;
|
||||
|
||||
%count = MissionCleanUp.getCount();
|
||||
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%test = MissionCleanUp.getObject(%i);
|
||||
|
||||
if (%test.getClassName() $= "Player" && %test.getState() !$= "dead" && !%test.client.isAIControlled())
|
||||
{
|
||||
%dist = vectorDist(%this.getPosition(),%test.getPosition());
|
||||
|
||||
if (%dist < %this.getDatablock().pickUpRadius)
|
||||
{
|
||||
LootBagPickedUp(%this,%test.client);
|
||||
return;
|
||||
}
|
||||
|
||||
%this.loop = schedule(100,0,"LootBagCheckForPickup",%this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function LootBagPickedUp(%this,%client)
|
||||
{
|
||||
%db = %client.player.getDatablock(); //The player's datablock
|
||||
%money = %this.money; //Monies?
|
||||
%numItems = %this.numItems; //Giving out items.
|
||||
%numAmmo = %this.numAmmo; //..Ammo too!
|
||||
//Does the bag have money?
|
||||
if (%money $= "")
|
||||
%hasMoney = false;
|
||||
else
|
||||
%hasMoney = true;
|
||||
|
||||
if (%money !$= "")
|
||||
%client.money = %client.money + %money; //Give some monies.
|
||||
|
||||
for (%i = 0; %i < %numItems; %i++)
|
||||
{
|
||||
if (%db.max[%this.item[%i]] != 0) //Don't want people in light armor running around with mortars, do we?
|
||||
{
|
||||
%client.player.setInventory(%this.item[%i],1);
|
||||
%client.player.setInventory(%this.ammo[%i],%this.ammoNum[%i]);
|
||||
}
|
||||
}
|
||||
%this.delete(); //Delete the bag.
|
||||
|
||||
//Let the player know.
|
||||
switch (%hasMoney)
|
||||
{
|
||||
case 0:
|
||||
if (%numItems > 1)
|
||||
messageClient(%client,'MsgClient','You picked up a bag of items that contained %1 items.',%numitems);
|
||||
else
|
||||
messageClient(%client,'MsgClient','You picked up a bag of items that contained 1 item.');
|
||||
case 1:
|
||||
if (%numItems > 1)
|
||||
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and %2 items.',%money,%numitems);
|
||||
else
|
||||
messageClient(%client,'MsgClient','You picked up a bag of items that contained $%1 and 1 item.',%money);
|
||||
}
|
||||
}
|
||||
39
scripts/modscripts/server/RPG/mining.cs
Normal file
39
scripts/modscripts/server/RPG/mining.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -----------------------------------------------------
|
||||
// Datablocks
|
||||
// Note: You can't actually target interiors with beams,
|
||||
// so make an interior and put this box around it.
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
// -----------------------------------------------------
|
||||
datablock StaticShapeData(MiningBox) : StaticShapeDamageProfile {
|
||||
className = "MineBox";
|
||||
shapeFile = "Pmiscf.dts";
|
||||
|
||||
maxDamage = 5000;
|
||||
destroyedLevel = 0;
|
||||
disabledLevel = 0;
|
||||
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 240;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Mining Detection Box';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = false;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Code
|
||||
// Note: Weapon code is in weapons/miningTool.cs
|
||||
// -----------------------------------------------------
|
||||
function MiningBox::onAdd(%this, %obj)
|
||||
{
|
||||
%obj.startFade(1,0,1);
|
||||
%obj.applyDamage(%obj.getDataBlock().maxDamage); //Start the rock off
|
||||
}
|
||||
193
scripts/modscripts/server/RPG/propertyOwning.cs
Normal file
193
scripts/modscripts/server/RPG/propertyOwning.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
// --------------------------------------------------------
|
||||
// A script that allows one to buy property.
|
||||
// The script is in a BETA state, so it may have bugs.
|
||||
//
|
||||
// TODO:
|
||||
// Make the script take rotation into consideration..
|
||||
// Find a way to 'purchase' interiors
|
||||
// --------------------------------------------------------
|
||||
|
||||
function InteriorInstance::buyObject(%this,%objectID,%client,%team)
|
||||
{
|
||||
if (%this.generatorCount $= "")
|
||||
%this.generatorCount = 0;
|
||||
if (%this.inventoryCount $= "")
|
||||
%this.inventoryCount = 0;
|
||||
if (%this.sensorCount $= "")
|
||||
%this.sensorCount = 0;
|
||||
if (%this.sentryCount $= "")
|
||||
%this.sentryCount = 0;
|
||||
if (%this.bannerCount $= "")
|
||||
%this.bannerCount = 0;
|
||||
if (%this.turretBaseCount $= "")
|
||||
%this.turretBaseCount = 0;
|
||||
|
||||
switch(%objectID)
|
||||
{
|
||||
case 0: //Generator
|
||||
if (%this.generatorCount == $Property::Max[%this.interiorFile,0])
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = GeneratorLarge;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,0,%this.generatorCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,0,%this.generatorCount];
|
||||
Team = %team;
|
||||
};
|
||||
|
||||
GeneratorLarge.gainPower(%shape);
|
||||
%this.generatorCount++;
|
||||
|
||||
case 1: //Inventory
|
||||
if (%this.generatorCount == 0 || %this.inventoryCount == $Property::Max[%this.interiorFile,1]) //Don't create if there's no generators
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = StationInventory;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,1,%this.inventoryCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,1,%this.inventoryCount];
|
||||
Team = %team;
|
||||
};
|
||||
|
||||
StationInventory.gainPower(%shape);
|
||||
%this.inventoryCount++;
|
||||
|
||||
case 2: //Sensor (Medium)
|
||||
if (%this.generatorCount == 0 || %this.sensorCount == $Property::Max[%this.interiorFile,2])
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = SensorMediumPulse;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,2,%this.sensorCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,2,%this.sensorCount];
|
||||
Team = %team;
|
||||
};
|
||||
SensorMediumPulse.gainPower(%shape);
|
||||
%this.sensorCount++;
|
||||
|
||||
case 3: //Sensor (Large)
|
||||
if (%this.generatorCount == 0 || %this.sensorCount == $Property::Max[%this.interiorFile,2])
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = SensorLargePulse;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,3,%this.sensorCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,3,%this.sensorCount];
|
||||
Team = %team;
|
||||
};
|
||||
|
||||
SensorLargePulse.gainPower(%shape);
|
||||
%this.sensorCount++;
|
||||
|
||||
case 4: //Sentry Turrets
|
||||
if (%this.generatorCount == 0 || %this.sentryCount == $Property::Max[%this.interiorFile,4])
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = SentryTurret;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,4,%this.sentryCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,4,%this.sentryCount];
|
||||
Team = %team;
|
||||
};
|
||||
SentryTurret.gainPower(%shape);
|
||||
%this.sentryCount++;
|
||||
|
||||
case 5: //Banner (Strength)
|
||||
if (%this.bannerCount == $Property::Max[%this.interiorFile,5])
|
||||
return false;
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = Banner_Strength;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,5,%this.bannerCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,5,%this.bannerCount];
|
||||
Team = %team;
|
||||
};
|
||||
%this.bannerCount++;
|
||||
|
||||
case 6: //Large Turret Base
|
||||
if (%this.generatorCount == 0 || %this.turretBaseCount == $Property::Max[%this.interiorFile,6])
|
||||
return false;
|
||||
|
||||
%shape = new StaticShape()
|
||||
{
|
||||
DataBlock = TurretBaseLarge;
|
||||
Position = vectorAdd($Property::Offset[%this.interiorFile,6,%this.turretBaseCount],%this.getPosition());
|
||||
Rotation = $Property::Rotation[%this.interiorFile,6,%this.turretBaseCount];
|
||||
Team = %team;
|
||||
};
|
||||
|
||||
%this.turretBaseCount++;
|
||||
}
|
||||
|
||||
%this.getGroup().add(%shape);
|
||||
setTargetName(%shape.target,addTaggedString(%client.namebase @ "'s"));
|
||||
setTargetSensorGroup(%shape.getTarget(), %team);
|
||||
%shape.setSelfPowered();
|
||||
return %shape;
|
||||
}
|
||||
|
||||
function staticShape::setPosition(%this,%pos)
|
||||
{
|
||||
%this.setTransform(%pos);
|
||||
return %this;
|
||||
}
|
||||
|
||||
function staticShape::getRotation(%this)
|
||||
{
|
||||
%trans = %this.getTransform();
|
||||
return getWord(%trans, 3) SPC getWord(%trans, 4) SPC getWord(%trans,5);
|
||||
}
|
||||
|
||||
function objectIDToDatablock(%objectID)
|
||||
{
|
||||
switch(%objectID)
|
||||
{
|
||||
case 0: return "GeneratorLarge";
|
||||
case 1: return 0;
|
||||
default: return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//This the array that stores all the positions and rotations for purchases of objects. I'll eventually move this to be a part of the basicFileProcessing.
|
||||
//Beagle Tower (bbunk2)
|
||||
//Generators
|
||||
$Property::Offset["bbunk2.dif",0,0] = "0.136109 6.92569 3.80877";
|
||||
$Property::Rotation["bbunk2.dif",0,0] = "1 0 0 0";
|
||||
//Inventory
|
||||
$Property::Offset["bbunk2.dif",1,0] = "-13.5045 6.57603 -6.49712";
|
||||
$Property::Rotation["bbunk2.dif",1,0] = "0 0 -1 88.8085";
|
||||
$Property::Offset["bbunk2.dif",1,1] = "13.5045 6.57603 -6.49712";
|
||||
$Property::Rotation["bbunk2.dif",1,1] = "0 0 1 88.8085";
|
||||
//Medium Sensors
|
||||
$Property::Offset["bbunk2.dif",2,0] = "-0.0187805 3.42132 30.8251";
|
||||
$Property::Rotation["bbunk2.dif",2,0] = "1 0 0 0";
|
||||
//Large Sensors
|
||||
$Property::Offset["bbunk2.dif",3,0] = "-0.0187805 3.42132 30.8251";
|
||||
$Property::Rotation["bbunk2.dif",3,0] = "1 0 0 0";
|
||||
//Sentry Turrets
|
||||
$Property::Offset["bbunk2.dif",4,0] = "0.018325 -0.513021 9.99179";
|
||||
$Property::Rotation["bbunk2.dif",4,0] = "0.706825 0.707389 0.000371874 179.92";
|
||||
$Property::Offset["bbunk2.dif",4,1] = "-0.092863 10.5404 -0.443447";
|
||||
$Property::Rotation["bbunk2.dif",4,1] = "0.577209 -0.577449 -0.577392 119.938";
|
||||
//Banners (Strength)
|
||||
$Property::Offset["bbunk2.dif",5,0] = "-0.150952 9.53516 9.82968";
|
||||
$Property::Rotation["bbunk2.dif",5,0] = "0 0 1 179.909";
|
||||
//Large Turret Base
|
||||
$Property::Offset["bbunk2.dif",6,0] = "0.0332212 11.5991 27.9961";
|
||||
$Property::Rotation["bbunk2.dif",6,0] = "1 0 0 0";
|
||||
|
||||
//Max values for each interior
|
||||
$Property::Max["bbunk2.dif",0] = 1; //Max generators
|
||||
$Property::Max["bbunk2.dif",1] = 2; //Max Inventories
|
||||
$Property::Max["bbunk2.dif",2] = 1; //Max Medium Sensors
|
||||
$Property::Max["bbunk2.dif",3] = 1; //Max Large Sensors
|
||||
$Property::Max["bbunk2.dif",4] = 2; //Max Sentry Turrets
|
||||
$Property::Max["bbunk2.dif",5] = 1; //Max Banners (Strength)
|
||||
$Property::Max["bbunk2.dif",6] = 1; //Max Turret Bases
|
||||
50
scripts/modscripts/server/RPG/serverNetworking.cs
Normal file
50
scripts/modscripts/server/RPG/serverNetworking.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// scripts/modScripts/server/serverNetworking.cs
|
||||
// Copyright (c) 2012 Robert MacGregor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
if (!IsObject(ServerNetwork))
|
||||
new TCPObject(ServerNetwork);
|
||||
|
||||
function ServerNetwork::onConnect(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::onConnectFailed(%this)
|
||||
{
|
||||
if (%this.testingServer)
|
||||
{
|
||||
error("Error: Unable to verify connection to server "@%this.testIP@" at port "@%this.testPort@"!");
|
||||
%this.testIP = "";
|
||||
%this.testPort = "";
|
||||
%this.testingServer = false;
|
||||
}
|
||||
}
|
||||
|
||||
function ServerNetwork::onDisconnect(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::onDisconnectFailed(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::listen(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::send(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::onLine(%this, %line)
|
||||
{
|
||||
}
|
||||
|
||||
function ServerNetwork::testServerIP(%this, %IP, %port)
|
||||
{
|
||||
%this.testingServer = true;
|
||||
%this.testIP = %ip;
|
||||
%this.testPort = %port;
|
||||
%this.connect(%ip @ ":" @ %port);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue