Path |
Scripts/gc1_script.js |
"use strict";
this.name = "Goods Container 10 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "2.0";
this.playerBoughtEquipment = function(equipment, paid) {
var pc = player.consoleMessage;
// keep tally of pylon accessories bought
//this.$gc1Count++;
// and don't let them exceed ship's pylon-capacity
if ((equipment == "EQ_GC1_MINE")) {// && (this.$gc1Count<=this.$gc1MCap)) {
player.ship.cargoSpaceCapacity += 10;
this.$gc1Containers++;
pc("Modifying pylon hardpoints for container clamping...",9);
pc("Fitting 10 TC Class Container #"+this.$gc1Containers+"...",9);
pc("F4 'Your FE Shipyards' to check your Licence.",9);
} else
// unmount & sell cancels all container additions
if (equipment == "EQ_MISSILE_REMOVAL") {
player.ship.cargoSpaceCapacity -= this.$gc1Containers*10;
pc("Removing all 10 TC Class Containers...",9)
pc("Restoring pylon hardpoints for weapons-use...",9);
if ((this.$gc1Containers>0) && (!this.$gc1HFExempt)) {
// dismantling fee
var dft = this.$gc1Containers*this.$gc1DismantlingFee;
this.$gc1DismantlingFeeTotal += dft;
player.credits -= dft;
pc("Dismantling Fee: "+dft+" cr",9);
}
//this.$gc1Count = 0;
this.$gc1Containers = 0;
// reset system-to-system runs w/containers
this.$gc1Runs = 0;
// reset fee totals
this.$gc1HandlingFeeTotal = 0;
this.$gc1MaintenanceFeeTotal = 0;
}
}
this.playerBoughtNewShip = function(ship, price) {
// missile capacity (not exceed)
this.$gc1MCap = player.ship.missileCapacity;
//this.$gc1Count = 0;
this.$gc1Containers = 0;
}
this.equipmentRemoved = function(equipmentKey) {
if (equipmentKey == "EQ_GC1_MINE") {
player.ship.cargoSpaceCapacity -= 10;
this.$gc1Containers--;
player.consoleMessage("10 TC Goods Container removed.",5);
}
}
this.shipReleasedEquipment = function(mine) {
//this.$gc1Count--;
if (mine == "EQ_GC1_MINE") {
player.ship.cargoSpaceCapacity -= 10;
this.$gc1Containers--;
player.commsMessage("10 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 10000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.shipFiredMissile = function(missile, target) {
//this.$gc1Count--;
if (missile == "EQ_GC1_MINE") {
player.ship.cargoSpaceCapacity -= 10;
this.$gc1Containers--;
player.commsMessage("10 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 10000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.startUpComplete = function () {
var pc = player.consoleMessage;
// missile capacity (not exceed)
this.$gc1MCap = player.ship.missileCapacity;
//this.$gc1Count = player.ship.missiles.length;
// Load cargo space, missile & container counts if present
if (missionVariables.gc1Cargo != null)
player.ship.cargoSpaceCapacity = missionVariables.gc1Cargo;
//if (missionVariables.gc1Count != null)
// this.$gc1Count = missionVariables.gc1Count;
if (missionVariables.gc1Containers != null)
this.$gc1Containers = missionVariables.gc1Containers;
// Load total fees taken
if (missionVariables.gc1HandlingFeeTotal != null)
this.$gc1HandlingFeeTotal = missionVariables.gc1HandlingFeeTotal;
if (missionVariables.gc1HandlingPaid != null)
this.$gc1HandlingPaid = missionVariables.gc1HandlingPaid;
if (missionVariables.gc1MaintenanceFeeTotal != null)
this.$gc1MaintenanceFeeTotal = missionVariables.gc1MaintenanceFeeTotal;
if (missionVariables.gc1DismantlingFeeTotal != null)
this.$gc1DismantlingFeeTotal = missionVariables.gc1DismantlingFeeTotal;
// Load system-to-system runs w/container
if (missionVariables.gc1Runs != null)
this.$gc1Runs = missionVariables.gc1Runs;
// Load Handling fee count
if (missionVariables.gc1HandlingCount != null)
this.$gc1HandlingCount = missionVariables.gc1HandlingCount;
// Load handling fee exemption status
if (missionVariables.gc1HFExempt != null)
this.$gc1HFExempt = missionVariables.gc1HFExempt;
// Load Maintenance fee count
if (missionVariables.gc1MaintenanceCount != null)
this.$gc1MaintenanceCount = missionVariables.gc1MaintenanceCount;
// CHECK
log(this.name, this.name+" startup complete.");
// TEST
var sta = player.ship.dockedStation;
if ((this.$gc1Containers<this.$gc1MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account screen
this._gc1PrepAcc(sta);
// optionally, prepare handling fee waiver request
if (this.$gc1Containers>0) this._gc1PrepEx(sta);
}
this.startUp = function() {
log(this.name, "Initialising OXP " + this.name);
// check for G.E.T. presence
this.$gc1ET = false;
if (worldScripts["Elite Trader"])
this.$gc1ET = true;
// TEST
if (this.$gc1ET) log(this.name, "Finds Elite Trader present");
// check for FE Ships Player
this.$gc1FES = false;
if (worldScripts["FE Ships Player"])
this.$gc1FES = true;
// TEST
if (this.$gc1ET) log(this.name, "Finds FE Ships Player present");
// missile capacity (not exceed)
this.$gc1MCap = 0;
// pylon-use count
//this.$gc1Count = 0;
// container count
this.$gc1Containers = 0;
// purchase cost of container in cr
this.$gc1Cost = 10000;
// handling fee
this.$gc1HandlingFee = 0.005*this.$gc1Cost; // 0.005 of cost
this.$gc1HandlingFeeTotal = 0;
this.$gc1HandlingPaid = "yes"; // or "no" - easier than boolean
this.$gc1HandlingCount = 0;
this.$gc1HFExempt = "no";
// maintenance fee
this.$gc1MaintenanceFee = 0.05*this.$gc1Cost; // 0.05 of cost
this.$gc1MaintenanceFeeTotal = 0;
this.$gc1MaintenancePaid = "no" // or "yes"
this.$gc1MaintenanceInterval = 10; // in runs (according to cost)
this.$gc1MaintenanceCount = 0;
// dismantling fee
this.$gc1DismantlingFee = 0.1*this.$gc1Cost; // 0.1 of cost
this.$gc1DismantlingFeeTotal = 0.0;
// system-to-system runs w/container
this.$gc1Runs = 0;
}
this.playerWillSaveGame = function(message) {
//missionVariables.gc1Count = this.$gc1Count;
missionVariables.gc1Cargo = player.ship.cargoSpaceCapacity;
missionVariables.gc1Containers = this.$gc1Containers;
// save total fees taken
missionVariables.gc1HandlingFeeTotal = this.$gc1HandlingFeeTotal;
missionVariables.gc1MaintenanceFeeTotal = this.$gc1MaintenanceFeeTotal;
missionVariables.gc1DismantlingFeeTotal = this.$gc1DismantlingFeeTotal;
missionVariables.gc1HandlingPaid = this.$gc1HandlingPaid;
// system-to-system runs w/container
missionVariables.gc1Runs =this.$gc1Runs;
// handling fee count
missionVariables.gc1HandlingCount = this.$gc1HandlingCount;
// handling fee exemption (G.E.T.)
missionVariables.gc1HFExempt = this.$gc1HFExempt;
// maintenance fee count
missionVariables.gc1MaintenanceCount = this.$gc1MaintenanceCount;
}
this.shipDockedWithStation = function(station) {
// take handling fee (if not exempt)
var pc = player.consoleMessage;
var ex = this.$gc1HFExempt;
// check we have containers, the fee is not paid, and we're not exempt
if ((this.$gc1Containers>0) && (this.$gc1HandlingPaid==="no") && (ex==="no")) {
var fee = 0;
for (var x=1; x<= this.$gc1Containers; x++)
fee += this.$gc1HandlingFee;
// record fee and debit trader's account
this.$gc1HandlingFeeTotal += fee;
player.credits -= fee;
this.$gc1HandlingPaid = "yes";
pc("10 TC Container handling fees: "+fee+" cr",9);
this.$gc1HandlingCount++;
}
// conditionally take maintenance fee
if (this.$gc1Containers>0) this._gc1DoMaintenance();
// TEST
if ((this.$gc1Containers<this.$gc1MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account and Licence page
this._gc1PrepAcc(station);
// prepare handling fee waiver request if ET or FESP is present
if (this.$gc1Containers>0) this._gc1PrepEx(station);
}
this.shipExitedWitchspace = function() {
// set handling paid to 'no'
this.$gc1HandlingPaid = "no";
this.$gc1Runs ++;
}
/* Common helper functions */
// assess and take maintenance fee
this._gc1DoMaintenance = function() {
var pc = player.consoleMessage;
var runs = this.$gc1Runs;
var intv = this.$gc1MaintenanceInterval;
var mfee = this.$gc1MaintenanceFee;
// take maintenance fee after y runs
if ( (runs > 0) && ((runs % intv)==0) ) {
// maintenance for x containers
var fee = 0;
for (var x=1; x<= this.$gc1Containers; x++)
fee += mfee;
// maintenance fee tally & debit
this.$gc1MaintenanceFeeTotal += fee;
player.credits -= fee;
pc("10 TC Container Maintenance fees: "+fee+" cr",9);
// update Maintenance count
this.$gc1MaintenanceCount++;
}
}
/* F4 Interfaces */
// create F.E.S. 'Licence & Account' page
this._gc1PrepAcc = function(station) {
station.setInterface("gc1Acc",{
title: "Your FE Shipyards 10 TC Container Class Licence",
category: "Your FE Shipyards",
summary: "Your FE Shipyards 10 TC Goods Container account screen shows terms, fees paid, load, and other useful information.",
callback: this._gc1ShowAcc.bind(this)
});
}
// show F.E.S. 'Licence & Account' page
this._gc1ShowAcc = function() {
var hfc = this.$gc1HandlingCount;
var mfc = this.$gc1MaintenanceCount;
var mfi = this.$gc1MaintenanceInterval;
var hft = this.$gc1HandlingFeeTotal;
var mft = this.$gc1MaintenanceFeeTotal;
var dft = this.$gc1DismantlingFeeTotal;
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
if (this.$gc1Containers>0)
parameters.message +="Your Account and Licence for 10 TC Class Goods Containers x "+this.$gc1Containers+": \n\n";
else
parameters.message +="You have no 10 TC Class Containers licensed with us at this time. \n\n";
parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
parameters.message += "Our containers are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
parameters.message += "If you cancel your Container account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylons for weapons-use. \n";
parameters.choicesKey = "gc1Acknowlege";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_YES") player.commsMessage("FE Shipyards thanks you for your custom.");
}
}
// create F.E.S. handling fee waiver/restoration request
this._gc1PrepEx = function(station) {
station.setInterface("gc1Ex",{
title: "Your FE Shipyards Handling Fee Waiver Request",
category: "Your FE Shipyards",
summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 10-ton container class." ,
callback: this._gc1ShowEx.bind(this)
});
}
// show F.E.S. handling & dismantling fee waiver/restoration request
this._gc1ShowEx = function() {
var priv = ((this.$gc1ET)||(this.$gc1FES));
var privo = "";
if (this.$gc1FES) privo="FE shipowner";
if (this.$gc1ET) privo="Guilder";
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
parameters.message += "Re: your request to waive your 10 TC container fees.\n\n"
parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
if (priv)
parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
else
parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
parameters.message += "Yours attentively,\n\n";
parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
parameters.choicesKey = "gc1YesNoEx";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_AYE") {
if (priv) this.$gc1HFExempt = "yes"; else this.$gc1HFExempt = "no";
} else this.$gc1HFExempt = "no";
player.commsMessage("FE Shipyards thanks you for your attention.");
}
}
|
Scripts/gc2_script.js |
"use strict";
this.name = "Goods Container 20 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "2.0";
this.playerBoughtEquipment = function(equipment, paid) {
var pc = player.consoleMessage;
// keep tally of pylon accessories bought
//this.$gc2Count++;
// and don't let them exceed ship's pylon-capacity
if ((equipment == "EQ_GC2_MINE")) {// && (this.$gc2Count<=this.$gc2MCap)) {
player.ship.cargoSpaceCapacity += 20;
this.$gc2Containers++;
pc("Modifying pylon hardpoints for container clamping...",9);
pc("Fitting 20 TC Class Container #"+this.$gc2Containers+"...",9);
pc("F4 'Your FE Shipyards' to check your Licence.",9);
} else
// unmount & sell cancels all container additions
if (equipment == "EQ_MISSILE_REMOVAL") {
player.ship.cargoSpaceCapacity -= this.$gc2Containers*20;
pc("Removing all 20 TC Class Containers...",9)
pc("Restoring pylon hardpoints for weapons-use...",9);
if ((this.$gc2Containers>0) && (!this.$gc2HFExempt)) {
// dismantling fee
var dft = this.$gc2Containers*this.$gc2DismantlingFee;
this.$gc2DismantlingFeeTotal += dft;
player.credits -= dft;
pc("Dismantling Fee: "+dft+" cr",9);
}
//this.$gc2Count = 0;
this.$gc2Containers = 0;
// reset system-to-system runs w/containers
this.$gc2Runs = 0;
// reset fee totals
this.$gc2HandlingFeeTotal = 0;
this.$gc2MaintenanceFeeTotal = 0;
}
}
this.playerBoughtNewShip = function(ship, price) {
// missile capacity (not exceed)
this.$gc2MCap = player.ship.missileCapacity;
//this.$gc2Count = 0;
this.$gc2Containers = 0;
}
this.equipmentRemoved = function(equipmentKey) {
if (equipmentKey == "EQ_GC2_MINE") {
player.ship.cargoSpaceCapacity -= 20;
this.$gc2Containers--;
player.consoleMessage("20 TC Goods Container removed.",5);
}
}
this.shipReleasedEquipment = function(mine) {
//this.$gc2Count--;
if (mine == "EQ_GC2_MINE") {
player.ship.cargoSpaceCapacity -= 20;
this.$gc2Containers--;
player.commsMessage("20 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 20000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.shipFiredMissile = function(missile, target) {
//this.$gc2Count--;
if (missile == "EQ_GC2_MINE") {
player.ship.cargoSpaceCapacity -= 20;
this.$gc2Containers--;
player.commsMessage("20 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 20000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.startUpComplete = function () {
var pc = player.consoleMessage;
// missile capacity (not exceed)
this.$gc2MCap = player.ship.missileCapacity;
//this.$gc2Count = player.ship.missiles.length;
// Load cargo space, missile & container counts if present
if (missionVariables.gc2Cargo != null)
player.ship.cargoSpaceCapacity = missionVariables.gc2Cargo;
//if (missionVariables.gc2Count != null)
//this.$gc2Count = missionVariables.gc2Count;
if (missionVariables.gc2Containers != null)
this.$gc2Containers = missionVariables.gc2Containers;
// Load total fees taken
if (missionVariables.gc2HandlingFeeTotal != null)
this.$gc2HandlingFeeTotal = missionVariables.gc2HandlingFeeTotal;
if (missionVariables.gc2HandlingPaid != null)
this.$gc2HandlingPaid = missionVariables.gc2HandlingPaid;
if (missionVariables.gc2MaintenanceFeeTotal != null)
this.$gc2MaintenanceFeeTotal = missionVariables.gc2MaintenanceFeeTotal;
if (missionVariables.gc2DismantlingFeeTotal != null)
this.$gc2DismantlingFeeTotal = missionVariables.gc2DismantlingFeeTotal;
// Load system-to-system runs w/container
if (missionVariables.gc2Runs != null)
this.$gc2Runs = missionVariables.gc2Runs;
// Load Handling fee count
if (missionVariables.gc2HandlingCount != null)
this.$gc2HandlingCount = missionVariables.gc2HandlingCount;
// Load handling fee exemption status
if (missionVariables.gc2HFExempt != null)
this.$gc2HFExempt = missionVariables.gc2HFExempt;
// Load Maintenance fee count
if (missionVariables.gc2MaintenanceCount != null)
this.$gc2MaintenanceCount = missionVariables.gc2MaintenanceCount;
// CHECK
log(this.name, this.name+" startup complete.");
// TEST
var sta = player.ship.dockedStation;
if ((this.$gc2Containers<this.$gc2MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account screen
this._gc2PrepAcc(sta);
// optionally, prepare handling fee waiver request
if (this.$gc2Containers>0) this._gc2PrepEx(sta);
}
this.startUp = function() {
log(this.name, "Initialising OXP " + this.name);
// check for G.E.T. presence
this.$gc2ET = false;
if (worldScripts["Elite Trader"])
this.$gc2ET = true;
// TEST
if (this.$gc2ET) log(this.name, "Finds Elite Trader present");
// check for FE Ships Player
this.$gc2FES = false;
if (worldScripts["FE Ships Player"])
this.$gc2FES = true;
// TEST
if (this.$gc2ET) log(this.name, "Finds FE Ships Player present");
// missile capacity (not exceed)
this.$gc2MCap = 0;
// pylon-use count
//this.$gc2Count = 0;
// container count
this.$gc2Containers = 0;
// purchase cost of container in cr
this.$gc2Cost = 20000;
// handling fee
this.$gc2HandlingFee = 0.005*this.$gc2Cost; // 0.005 of cost
this.$gc2HandlingFeeTotal = 0;
this.$gc2HandlingPaid = "yes"; // or "no" - easier than boolean
this.$gc2HandlingCount = 0;
this.$gc2HFExempt = "no";
// maintenance fee
this.$gc2MaintenanceFee = 0.05*this.$gc2Cost; // 0.05 of cost
this.$gc2MaintenanceFeeTotal = 0;
this.$gc2MaintenancePaid = "no" // or "yes"
this.$gc2MaintenanceInterval = 20; // in runs (according to cost)
this.$gc2MaintenanceCount = 0;
// dismantling fee
this.$gc2DismantlingFee = 0.1*this.$gc2Cost; // 0.1 of cost
this.$gc2DismantlingFeeTotal = 0.0;
// system-to-system runs w/container
this.$gc2Runs = 0;
}
this.playerWillSaveGame = function(message) {
//missionVariables.gc2Count = this.$gc2Count;
missionVariables.gc2Cargo = player.ship.cargoSpaceCapacity;
missionVariables.gc2Containers = this.$gc2Containers;
// save total fees taken
missionVariables.gc2HandlingFeeTotal = this.$gc2HandlingFeeTotal;
missionVariables.gc2MaintenanceFeeTotal = this.$gc2MaintenanceFeeTotal;
missionVariables.gc2DismantlingFeeTotal = this.$gc2DismantlingFeeTotal;
missionVariables.gc2HandlingPaid = this.$gc2HandlingPaid;
// system-to-system runs w/container
missionVariables.gc2Runs =this.$gc2Runs;
// handling fee count
missionVariables.gc2HandlingCount = this.$gc2HandlingCount;
// handling fee exemption (G.E.T.)
missionVariables.gc2HFExempt = this.$gc2HFExempt;
// maintenance fee count
missionVariables.gc2MaintenanceCount = this.$gc2MaintenanceCount;
}
this.shipDockedWithStation = function(station) {
// take handling fee (if not exempt)
var pc = player.consoleMessage;
var ex = this.$gc2HFExempt;
// check we have containers, the fee is not paid, and we're not exempt
if ((this.$gc2Containers>0) && (this.$gc2HandlingPaid==="no") && (ex==="no")) {
var fee = 0;
for (var x=1; x<= this.$gc2Containers; x++)
fee += this.$gc2HandlingFee;
// record fee and debit trader's account
this.$gc2HandlingFeeTotal += fee;
player.credits -= fee;
this.$gc2HandlingPaid = "yes";
pc("20 TC Container handling fees: "+fee+" cr",9);
this.$gc2HandlingCount++;
}
// conditionally take maintenance fee
if (this.$gc2Containers>0) this._gc2DoMaintenance();
// TEST
if ((this.$gc2Containers<this.$gc2MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account and Licence page
this._gc2PrepAcc(station);
// prepare handling fee waiver request if ET or FESP is present
if (this.$gc2Containers>0) this._gc2PrepEx(station);
}
this.shipExitedWitchspace = function() {
// set handling paid to 'no'
this.$gc2HandlingPaid = "no";
this.$gc2Runs ++;
}
/* Common helper functions */
// assess and take maintenance fee
this._gc2DoMaintenance = function() {
var pc = player.consoleMessage;
var runs = this.$gc2Runs;
var intv = this.$gc2MaintenanceInterval;
var mfee = this.$gc2MaintenanceFee;
// take maintenance fee after y runs
if ( (runs > 0) && ((runs % intv)==0) ) {
// maintenance for x containers
var fee = 0;
for (var x=1; x<= this.$gc2Containers; x++)
fee += mfee;
// maintenance fee tally & debit
this.$gc2MaintenanceFeeTotal += fee;
player.credits -= fee;
pc("20 TC Container Maintenance fees: "+fee+" cr",9);
// update Maintenance count
this.$gc2MaintenanceCount++;
}
}
/* F4 Interfaces */
// create F.E.S. 'Licence & Account' page
this._gc2PrepAcc = function(station) {
station.setInterface("gc2Acc",{
title: "Your FE Shipyards 20 TC Container Class Licence",
category: "Your FE Shipyards",
summary: "Your FE Shipyards 20 TC Goods Container account screen shows terms, fees paid, load, and other useful information.",
callback: this._gc2ShowAcc.bind(this)
});
}
// show F.E.S. 'Licence & Account' page
this._gc2ShowAcc = function() {
var hfc = this.$gc2HandlingCount;
var mfc = this.$gc2MaintenanceCount;
var mfi = this.$gc2MaintenanceInterval;
var hft = this.$gc2HandlingFeeTotal;
var mft = this.$gc2MaintenanceFeeTotal;
var dft = this.$gc2DismantlingFeeTotal;
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
if (this.$gc2Containers>0)
parameters.message +="Your Account and Licence for 20 TC Class Goods Containers x "+this.$gc2Containers+": \n\n";
else
parameters.message +="You have no 20 TC Class Containers licensed with us at this time. \n\n";
parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
parameters.message += "Our containers are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
parameters.message += "If you cancel your Container account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylons for weapons-use. \n";
parameters.choicesKey = "gc2Acknowlege";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_YES") player.commsMessage("FE Shipyards thanks you for your custom.");
}
}
// create F.E.S. handling fee waiver/restoration request
this._gc2PrepEx = function(station) {
station.setInterface("gc2Ex",{
title: "Your FE Shipyards Handling Fee Waiver Request",
category: "Your FE Shipyards",
summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 20-ton container class." ,
callback: this._gc2ShowEx.bind(this)
});
}
// show F.E.S. handling & dismantling fee waiver/restoration request
this._gc2ShowEx = function() {
var priv = ((this.$gc2ET)||(this.$gc2FES));
var privo = "";
if (this.$gc2FES) privo="FE shipowner";
if (this.$gc2ET) privo="Guilder";
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
parameters.message += "Re: your request to waive your 20 TC container fees.\n\n"
parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
if (priv)
parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
else
parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
parameters.message += "Yours attentively,\n\n";
parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
parameters.choicesKey = "gc2YesNoEx";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_AYE") {
if (priv) this.$gc2HFExempt = "yes"; else this.$gc2HFExempt = "no";
} else this.$gc2HFExempt = "no";
player.commsMessage("FE Shipyards thanks you for your attention.");
}
}
|
Scripts/gc3_script.js |
"use strict";
this.name = "Goods Container 30 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "2.0";
this.playerBoughtEquipment = function(equipment, paid) {
var pc = player.consoleMessage;
// keep tally of pylon accessories bought
//this.$gc3Count++;
// and don't let them exceed ship's pylon-capacity
if ((equipment == "EQ_GC3_MINE")) {// && (this.$gc3Count<=this.$gc3MCap)) {
player.ship.cargoSpaceCapacity += 30;
this.$gc3Containers++;
pc("Modifying pylon hardpoints for container clamping...",9);
pc("Fitting 30 TC Class Container #"+this.$gc3Containers+"...",9);
pc("F4 'Your FE Shipyards' to check your Licence.",9);
} else
// unmount & sell cancels all container additions
if (equipment == "EQ_MISSILE_REMOVAL") {
player.ship.cargoSpaceCapacity -= this.$gc3Containers*30;
pc("Removing all 30 TC Class Containers...",9)
pc("Restoring pylon hardpoints for weapons-use...",9);
if ((this.$gc3Containers>0) && (!this.$gc3HFExempt)) {
// dismantling fee
var dft = this.$gc3Containers*this.$gc3DismantlingFee;
this.$gc3DismantlingFeeTotal += dft;
player.credits -= dft;
pc("Dismantling Fee: "+dft+" cr",9);
}
//this.$gc3Count = 0;
this.$gc3Containers = 0;
// reset system-to-system runs w/containers
this.$gc3Runs = 0;
// reset fee totals
this.$gc3HandlingFeeTotal = 0;
this.$gc3MaintenanceFeeTotal = 0;
}
}
this.playerBoughtNewShip = function(ship, price) {
// missile capacity (not exceed)
this.$gc3MCap = player.ship.missileCapacity;
//this.$gc3Count = 0;
this.$gc3Containers = 0;
}
this.equipmentRemoved = function(equipmentKey) {
if (equipmentKey == "EQ_GC3_MINE") {
player.ship.cargoSpaceCapacity -= 30;
this.$gc3Containers--;
player.consoleMessage("30 TC Goods Container removed.",5);
}
}
this.shipReleasedEquipment = function(mine) {
//this.$gc3Count--;
if (mine == "EQ_GC3_MINE") {
player.ship.cargoSpaceCapacity -= 30;
this.$gc3Containers--;
player.commsMessage("30 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 30000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.shipFiredMissile = function(missile, target) {
//this.$gc3Count--;
if (missile == "EQ_GC3_MINE") {
player.ship.cargoSpaceCapacity -= 30;
this.$gc3Containers--;
player.commsMessage("30 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 30000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.startUpComplete = function () {
var pc = player.consoleMessage;
// missile capacity (not exceed)
this.$gc3MCap = player.ship.missileCapacity;
//this.$gc3Count = player.ship.missiles.length;
// Load cargo space, missile & container counts if present
if (missionVariables.gc3Cargo != null)
player.ship.cargoSpaceCapacity = missionVariables.gc3Cargo;
//if (missionVariables.gc3Count != null)
//this.$gc3Count = missionVariables.gc3Count;
if (missionVariables.gc3Containers != null)
this.$gc3Containers = missionVariables.gc3Containers;
// Load total fees taken
if (missionVariables.gc3HandlingFeeTotal != null)
this.$gc3HandlingFeeTotal = missionVariables.gc3HandlingFeeTotal;
if (missionVariables.gc3HandlingPaid != null)
this.$gc3HandlingPaid = missionVariables.gc3HandlingPaid;
if (missionVariables.gc3MaintenanceFeeTotal != null)
this.$gc3MaintenanceFeeTotal = missionVariables.gc3MaintenanceFeeTotal;
if (missionVariables.gc3DismantlingFeeTotal != null)
this.$gc3DismantlingFeeTotal = missionVariables.gc3DismantlingFeeTotal;
// Load system-to-system runs w/container
if (missionVariables.gc3Runs != null)
this.$gc3Runs = missionVariables.gc3Runs;
// Load Handling fee count
if (missionVariables.gc3HandlingCount != null)
this.$gc3HandlingCount = missionVariables.gc3HandlingCount;
// Load handling fee exemption status
if (missionVariables.gc3HFExempt != null)
this.$gc3HFExempt = missionVariables.gc3HFExempt;
// Load Maintenance fee count
if (missionVariables.gc3MaintenanceCount != null)
this.$gc3MaintenanceCount = missionVariables.gc3MaintenanceCount;
// CHECK
log(this.name, this.name+" startup complete.");
// TEST
var sta = player.ship.dockedStation;
if ((this.$gc3Containers<this.$gc3MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account screen
this._gc3PrepAcc(sta);
// optionally, prepare handling fee waiver request
if (this.$gc3Containers>0) this._gc3PrepEx(sta);
}
this.startUp = function() {
log(this.name, "Initialising OXP " + this.name);
// check for G.E.T. presence
this.$gc3ET = false;
if (worldScripts["Elite Trader"])
this.$gc3ET = true;
// TEST
if (this.$gc3ET) log(this.name, "Finds Elite Trader present");
// check for FE Ships Player
this.$gc3FES = false;
if (worldScripts["FE Ships Player"])
this.$gc3FES = true;
// TEST
if (this.$gc3ET) log(this.name, "Finds FE Ships Player present");
// missile capacity (not exceed)
this.$gc3MCap = 0;
// pylon-use count
//this.$gc3Count = 0;
// container count
this.$gc3Containers = 0;
// purchase cost of container in cr
this.$gc3Cost = 30000;
// handling fee
this.$gc3HandlingFee = 0.005*this.$gc3Cost; // 0.005 of cost
this.$gc3HandlingFeeTotal = 0;
this.$gc3HandlingPaid = "yes"; // or "no" - easier than boolean
this.$gc3HandlingCount = 0;
this.$gc3HFExempt = "no";
// maintenance fee
this.$gc3MaintenanceFee = 0.05*this.$gc3Cost; // 0.05 of cost
this.$gc3MaintenanceFeeTotal = 0;
this.$gc3MaintenancePaid = "no" // or "yes"
this.$gc3MaintenanceInterval = 30; // in runs (according to cost)
this.$gc3MaintenanceCount = 0;
// dismantling fee
this.$gc3DismantlingFee = 0.1*this.$gc3Cost; // 0.1 of cost
this.$gc3DismantlingFeeTotal = 0.0;
// system-to-system runs w/container
this.$gc3Runs = 0;
}
this.playerWillSaveGame = function(message) {
//missionVariables.gc3Count = this.$gc3Count;
missionVariables.gc3Cargo = player.ship.cargoSpaceCapacity;
missionVariables.gc3Containers = this.$gc3Containers;
// save total fees taken
missionVariables.gc3HandlingFeeTotal = this.$gc3HandlingFeeTotal;
missionVariables.gc3MaintenanceFeeTotal = this.$gc3MaintenanceFeeTotal;
missionVariables.gc3DismantlingFeeTotal = this.$gc3DismantlingFeeTotal;
missionVariables.gc3HandlingPaid = this.$gc3HandlingPaid;
// system-to-system runs w/container
missionVariables.gc3Runs =this.$gc3Runs;
// handling fee count
missionVariables.gc3HandlingCount = this.$gc3HandlingCount;
// handling fee exemption (G.E.T.)
missionVariables.gc3HFExempt = this.$gc3HFExempt;
// maintenance fee count
missionVariables.gc3MaintenanceCount = this.$gc3MaintenanceCount;
}
this.shipDockedWithStation = function(station) {
// take handling fee (if not exempt)
var pc = player.consoleMessage;
var ex = this.$gc3HFExempt;
// check we have containers, the fee is not paid, and we're not exempt
if ((this.$gc3Containers>0) && (this.$gc3HandlingPaid==="no") && (ex==="no")) {
var fee = 0;
for (var x=1; x<= this.$gc3Containers; x++)
fee += this.$gc3HandlingFee;
// record fee and debit trader's account
this.$gc3HandlingFeeTotal += fee;
player.credits -= fee;
this.$gc3HandlingPaid = "yes";
pc("30 TC Container handling fees: "+fee+" cr",9);
this.$gc3HandlingCount++;
}
// conditionally take maintenance fee
if (this.$gc3Containers>0) this._gc3DoMaintenance();
// TEST
if ((this.$gc3Containers<this.$gc3MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account and Licence page
this._gc3PrepAcc(station);
// prepare handling fee waiver request if ET or FESP is present
if (this.$gc3Containers>0) this._gc3PrepEx(station);
}
this.shipExitedWitchspace = function() {
// set handling paid to 'no'
this.$gc3HandlingPaid = "no";
this.$gc3Runs ++;
}
/* Common helper functions */
// assess and take maintenance fee
this._gc3DoMaintenance = function() {
var pc = player.consoleMessage;
var runs = this.$gc3Runs;
var intv = this.$gc3MaintenanceInterval;
var mfee = this.$gc3MaintenanceFee;
// take maintenance fee after y runs
if ( (runs > 0) && ((runs % intv)==0) ) {
// maintenance for x containers
var fee = 0;
for (var x=1; x<= this.$gc3Containers; x++)
fee += mfee;
// maintenance fee tally & debit
this.$gc3MaintenanceFeeTotal += fee;
player.credits -= fee;
pc("30 TC Container Maintenance fees: "+fee+" cr",9);
// update Maintenance count
this.$gc3MaintenanceCount++;
}
}
/* F4 Interfaces */
// create F.E.S. 'Licence & Account' page
this._gc3PrepAcc = function(station) {
station.setInterface("gc3Acc",{
title: "Your FE Shipyards 30 TC Container Class Licence",
category: "Your FE Shipyards",
summary: "Your FE Shipyards 30 TC Goods Container account screen shows terms, fees paid, load, and other useful information.",
callback: this._gc3ShowAcc.bind(this)
});
}
// show F.E.S. 'Licence & Account' page
this._gc3ShowAcc = function() {
var hfc = this.$gc3HandlingCount;
var mfc = this.$gc3MaintenanceCount;
var mfi = this.$gc3MaintenanceInterval;
var hft = this.$gc3HandlingFeeTotal;
var mft = this.$gc3MaintenanceFeeTotal;
var dft = this.$gc3DismantlingFeeTotal;
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
if (this.$gc3Containers>0)
parameters.message +="Your Account and Licence for 30 TC Class Goods Containers x "+this.$gc3Containers+": \n\n";
else
parameters.message +="You have no 30 TC Class Containers licensed with us at this time. \n\n";
parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
parameters.message += "Our containers are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
parameters.message += "If you cancel your Container account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylons for weapons-use. \n";
parameters.choicesKey = "gc3Acknowlege";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_YES") player.commsMessage("FE Shipyards thanks you for your custom.");
}
}
// create F.E.S. handling fee waiver/restoration request
this._gc3PrepEx = function(station) {
station.setInterface("gc3Ex",{
title: "Your FE Shipyards Handling Fee Waiver Request",
category: "Your FE Shipyards",
summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 30-ton container class." ,
callback: this._gc3ShowEx.bind(this)
});
}
// show F.E.S. handling & dismantling fee waiver/restoration request
this._gc3ShowEx = function() {
var priv = ((this.$gc3ET)||(this.$gc3FES));
var privo = "";
if (this.$gc3FES) privo="FE shipowner";
if (this.$gc3ET) privo="Guilder";
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
parameters.message += "Re: your request to waive your 30 TC container fees.\n\n"
parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
if (priv)
parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
else
parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
parameters.message += "Yours attentively,\n\n";
parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
parameters.choicesKey = "gc3YesNoEx";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_AYE") {
if (priv) this.$gc3HFExempt = "yes"; else this.$gc3HFExempt = "no";
} else this.$gc3HFExempt = "no";
player.commsMessage("FE Shipyards thanks you for your attention.");
}
}
|
Scripts/gc4_script.js |
"use strict";
this.name = "Goods Container 40 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "2.0";
this.playerBoughtEquipment = function(equipment, paid) {
var pc = player.consoleMessage;
// keep tally of pylon accessories bought
//this.$gc4Count++;
// and don't let them exceed ship's pylon-capacity
if ((equipment == "EQ_GC4_MINE")) {// && (this.$gc4Count<=this.$gc4MCap)) {
player.ship.cargoSpaceCapacity += 40;
this.$gc4Containers++;
pc("Modifying pylon hardpoints for container clamping...",9);
pc("Fitting 40 TC Class Container #"+this.$gc4Containers+"...",9);
pc("F4 'Your FE Shipyards' to check your Licence.",9);
} else
// unmount & sell cancels all container additions
if (equipment == "EQ_MISSILE_REMOVAL") {
player.ship.cargoSpaceCapacity -= this.$gc4Containers*40;
pc("Removing all 40 TC Class Containers...",9)
pc("Restoring pylon hardpoints for weapons-use...",9);
if ((this.$gc4Containers>0) && (!this.$gc4HFExempt)) {
// dismantling fee
var dft = this.$gc4Containers*this.$gc4DismantlingFee;
this.$gc4DismantlingFeeTotal += dft;
player.credits -= dft;
pc("Dismantling Fee: "+dft+" cr",9);
}
//this.$gc4Count = 0;
this.$gc4Containers = 0;
// reset system-to-system runs w/containers
this.$gc4Runs = 0;
// reset fee totals
this.$gc4HandlingFeeTotal = 0;
this.$gc4MaintenanceFeeTotal = 0;
}
}
this.playerBoughtNewShip = function(ship, price) {
// missile capacity (not exceed)
this.$gc4MCap = player.ship.missileCapacity;
//this.$gc4Count = 0;
this.$gc4Containers = 0;
}
this.equipmentRemoved = function(equipmentKey) {
if (equipmentKey == "EQ_GC4_MINE") {
player.ship.cargoSpaceCapacity -= 40;
this.$gc4Containers--;
player.consoleMessage("40 TC Goods Container removed.",5);
}
}
this.shipReleasedEquipment = function(mine) {
//this.$gc4Count--;
if (mine == "EQ_GC4_MINE") {
player.ship.cargoSpaceCapacity -= 40;
this.$gc4Containers--;
player.commsMessage("40 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 40000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.shipFiredMissile = function(missile, target) {
//this.$gc4Count--;
if (missile == "EQ_GC4_MINE") {
player.ship.cargoSpaceCapacity -= 40;
this.$gc4Containers--;
player.commsMessage("40 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 40000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.startUpComplete = function () {
var pc = player.consoleMessage;
// missile capacity (not exceed)
this.$gc4MCap = player.ship.missileCapacity;
//this.$gc4Count = player.ship.missiles.length;
// Load cargo space, missile & container counts if present
if (missionVariables.gc4Cargo != null)
player.ship.cargoSpaceCapacity = missionVariables.gc4Cargo;
//if (missionVariables.gc4Count != null)
//this.$gc4Count = missionVariables.gc4Count;
if (missionVariables.gc4Containers != null)
this.$gc4Containers = missionVariables.gc4Containers;
// Load total fees taken
if (missionVariables.gc4HandlingFeeTotal != null)
this.$gc4HandlingFeeTotal = missionVariables.gc4HandlingFeeTotal;
if (missionVariables.gc4HandlingPaid != null)
this.$gc4HandlingPaid = missionVariables.gc4HandlingPaid;
if (missionVariables.gc4MaintenanceFeeTotal != null)
this.$gc4MaintenanceFeeTotal = missionVariables.gc4MaintenanceFeeTotal;
if (missionVariables.gc4DismantlingFeeTotal != null)
this.$gc4DismantlingFeeTotal = missionVariables.gc4DismantlingFeeTotal;
// Load system-to-system runs w/container
if (missionVariables.gc4Runs != null)
this.$gc4Runs = missionVariables.gc4Runs;
// Load Handling fee count
if (missionVariables.gc4HandlingCount != null)
this.$gc4HandlingCount = missionVariables.gc4HandlingCount;
// Load handling fee exemption status
if (missionVariables.gc4HFExempt != null)
this.$gc4HFExempt = missionVariables.gc4HFExempt;
// Load Maintenance fee count
if (missionVariables.gc4MaintenanceCount != null)
this.$gc4MaintenanceCount = missionVariables.gc4MaintenanceCount;
// CHECK
log(this.name, this.name+" startup complete.");
// TEST
var sta = player.ship.dockedStation;
if ((this.$gc4Containers<this.$gc4MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account screen
this._gc4PrepAcc(sta);
// optionally, prepare handling fee waiver request
if (this.$gc4Containers>0) this._gc4PrepEx(sta);
}
this.startUp = function() {
log(this.name, "Initialising OXP " + this.name);
// check for G.E.T. presence
this.$gc4ET = false;
if (worldScripts["Elite Trader"])
this.$gc4ET = true;
// TEST
if (this.$gc4ET) log(this.name, "Finds Elite Trader present");
// check for FE Ships Player
this.$gc4FES = false;
if (worldScripts["FE Ships Player"])
this.$gc4FES = true;
// TEST
if (this.$gc4ET) log(this.name, "Finds FE Ships Player present");
// missile capacity (not exceed)
this.$gc4MCap = 0;
// pylon-use count
//this.$gc4Count = 0;
// container count
this.$gc4Containers = 0;
// purchase cost of container in cr
this.$gc4Cost = 40000;
// handling fee
this.$gc4HandlingFee = 0.005*this.$gc4Cost; // 0.005 of cost
this.$gc4HandlingFeeTotal = 0;
this.$gc4HandlingPaid = "yes"; // or "no" - easier than boolean
this.$gc4HandlingCount = 0;
this.$gc4HFExempt = "no";
// maintenance fee
this.$gc4MaintenanceFee = 0.05*this.$gc4Cost; // 0.05 of cost
this.$gc4MaintenanceFeeTotal = 0;
this.$gc4MaintenancePaid = "no" // or "yes"
this.$gc4MaintenanceInterval = 40; // in runs (according to cost)
this.$gc4MaintenanceCount = 0;
// dismantling fee
this.$gc4DismantlingFee = 0.1*this.$gc4Cost; // 0.1 of cost
this.$gc4DismantlingFeeTotal = 0.0;
// system-to-system runs w/container
this.$gc4Runs = 0;
}
this.playerWillSaveGame = function(message) {
//missionVariables.gc4Count = this.$gc4Count;
missionVariables.gc4Cargo = player.ship.cargoSpaceCapacity;
missionVariables.gc4Containers = this.$gc4Containers;
// save total fees taken
missionVariables.gc4HandlingFeeTotal = this.$gc4HandlingFeeTotal;
missionVariables.gc4MaintenanceFeeTotal = this.$gc4MaintenanceFeeTotal;
missionVariables.gc4DismantlingFeeTotal = this.$gc4DismantlingFeeTotal;
missionVariables.gc4HandlingPaid = this.$gc4HandlingPaid;
// system-to-system runs w/container
missionVariables.gc4Runs =this.$gc4Runs;
// handling fee count
missionVariables.gc4HandlingCount = this.$gc4HandlingCount;
// handling fee exemption (G.E.T.)
missionVariables.gc4HFExempt = this.$gc4HFExempt;
// maintenance fee count
missionVariables.gc4MaintenanceCount = this.$gc4MaintenanceCount;
}
this.shipDockedWithStation = function(station) {
// take handling fee (if not exempt)
var pc = player.consoleMessage;
var ex = this.$gc4HFExempt;
// check we have containers, the fee is not paid, and we're not exempt
if ((this.$gc4Containers>0) && (this.$gc4HandlingPaid==="no") && (ex==="no")) {
var fee = 0;
for (var x=1; x<= this.$gc4Containers; x++)
fee += this.$gc4HandlingFee;
// record fee and debit trader's account
this.$gc4HandlingFeeTotal += fee;
player.credits -= fee;
this.$gc4HandlingPaid = "yes";
pc("40 TC Container handling fees: "+fee+" cr",9);
this.$gc4HandlingCount++;
}
// conditionally take maintenance fee
if (this.$gc4Containers>0) this._gc4DoMaintenance();
// TEST
if ((this.$gc4Containers<this.$gc4MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account and Licence page
this._gc4PrepAcc(station);
// prepare handling fee waiver request if ET or FESP is present
if (this.$gc4Containers>0) this._gc4PrepEx(station);
}
this.shipExitedWitchspace = function() {
// set handling paid to 'no'
this.$gc4HandlingPaid = "no";
this.$gc4Runs ++;
}
/* Common helper functions */
// assess and take maintenance fee
this._gc4DoMaintenance = function() {
var pc = player.consoleMessage;
var runs = this.$gc4Runs;
var intv = this.$gc4MaintenanceInterval;
var mfee = this.$gc4MaintenanceFee;
// take maintenance fee after y runs
if ( (runs > 0) && ((runs % intv)==0) ) {
// maintenance for x containers
var fee = 0;
for (var x=1; x<= this.$gc4Containers; x++)
fee += mfee;
// maintenance fee tally & debit
this.$gc4MaintenanceFeeTotal += fee;
player.credits -= fee;
pc("40 TC Container Maintenance fees: "+fee+" cr",9);
// update Maintenance count
this.$gc4MaintenanceCount++;
}
}
/* F4 Interfaces */
// create F.E.S. 'Licence & Account' page
this._gc4PrepAcc = function(station) {
station.setInterface("gc4Acc",{
title: "Your FE Shipyards 40 TC Container Class Licence",
category: "Your FE Shipyards",
summary: "Your FE Shipyards 40 TC Goods Container account screen shows terms, fees paid, load, and other useful information.",
callback: this._gc4ShowAcc.bind(this)
});
}
// show F.E.S. 'Licence & Account' page
this._gc4ShowAcc = function() {
var hfc = this.$gc4HandlingCount;
var mfc = this.$gc4MaintenanceCount;
var mfi = this.$gc4MaintenanceInterval;
var hft = this.$gc4HandlingFeeTotal;
var mft = this.$gc4MaintenanceFeeTotal;
var dft = this.$gc4DismantlingFeeTotal;
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
if (this.$gc4Containers>0)
parameters.message +="Your Account and Licence for 40 TC Class Goods Containers x "+this.$gc4Containers+": \n\n";
else
parameters.message +="You have no 40 TC Class Containers licensed with us at this time. \n\n";
parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
parameters.message += "Our containers are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
parameters.message += "If you cancel your Container account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylons for weapons-use. \n";
parameters.choicesKey = "gc4Acknowlege";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_YES") player.commsMessage("FE Shipyards thanks you for your custom.");
}
}
// create F.E.S. handling fee waiver/restoration request
this._gc4PrepEx = function(station) {
station.setInterface("gc4Ex",{
title: "Your FE Shipyards Handling Fee Waiver Request",
category: "Your FE Shipyards",
summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 40-ton container class." ,
callback: this._gc4ShowEx.bind(this)
});
}
// show F.E.S. handling & dismantling fee waiver/restoration request
this._gc4ShowEx = function() {
var priv = ((this.$gc4ET)||(this.$gc4FES));
var privo = "";
if (this.$gc4FES) privo="FE shipowner";
if (this.$gc4ET) privo="Guilder";
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
parameters.message += "Re: your request to waive your 40 TC container fees.\n\n"
parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
if (priv)
parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
else
parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
parameters.message += "Yours attentively,\n\n";
parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
parameters.choicesKey = "gc4YesNoEx";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_AYE") {
if (priv) this.$gc4HFExempt = "yes"; else this.$gc4HFExempt = "no";
} else this.$gc4HFExempt = "no";
player.commsMessage("FE Shipyards thanks you for your attention.");
}
}
|
Scripts/gc5_script.js |
"use strict";
this.name = "Goods Container 50 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "2.0";
this.playerBoughtEquipment = function(equipment, paid) {
var pc = player.consoleMessage;
// keep tally of pylon accessories bought
//this.$gc5Count++;
// and don't let them exceed ship's pylon-capacity
if ((equipment == "EQ_GC5_MINE")) { // && (this.$gc5Count<=this.$gc5MCap)) {
player.ship.cargoSpaceCapacity += 50;
this.$gc5Containers++;
pc("Modifying pylon hardpoints for container clamping...",9);
pc("Fitting 50 TC Class Container #"+this.$gc5Containers+"...",9);
pc("F4 'Your FE Shipyards' to check your Licence.",9);
} else
// unmount & sell cancels all container additions
if (equipment == "EQ_MISSILE_REMOVAL") {
player.ship.cargoSpaceCapacity -= this.$gc5Containers*50;
pc("Removing all 50 TC Class Containers...",9)
pc("Restoring pylon hardpoints for weapons-use...",9);
if ((this.$gc5Containers>0) && (!this.$gc5HFExempt)) {
// dismantling fee
var dft = this.$gc5Containers*this.$gc5DismantlingFee;
this.$gc5DismantlingFeeTotal += dft;
player.credits -= dft;
pc("Dismantling Fee: "+dft+" cr",9);
}
//this.$gc5Count = 0;
this.$gc5Containers = 0;
// reset system-to-system runs w/containers
this.$gc5Runs = 0;
// reset fee totals
this.$gc5HandlingFeeTotal = 0;
this.$gc5MaintenanceFeeTotal = 0;
}
}
this.playerBoughtNewShip = function(ship, price) {
// missile capacity (not exceed)
this.$gc5MCap = player.ship.missileCapacity;
//this.$gc5Count = 0;
this.$gc5Containers = 0;
}
this.equipmentRemoved = function(equipmentKey) {
if (equipmentKey == "EQ_GC5_MINE") {
player.ship.cargoSpaceCapacity -= 50;
this.$gc5Containers--;
player.consoleMessage("50 TC Goods Container removed.",5);
}
}
this.shipReleasedEquipment = function(mine) {
//this.$gc5Count--;
if (mine == "EQ_GC5_MINE") {
player.ship.cargoSpaceCapacity -= 50;
this.$gc5Containers--;
player.commsMessage("50 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 50000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.shipFiredMissile = function(missile, target) {
//this.$gc5Count--;
if (missile == "EQ_GC5_MINE") {
player.ship.cargoSpaceCapacity -= 50;
this.$gc5Containers--;
player.commsMessage("50 TC Goods Container jettisoned.",5);
// deduct container cost from credits
player.credits -= 50000.0;
player.commsMessage("Mishandling charge applied at cost.",9);
}
}
this.startUpComplete = function () {
var pc = player.consoleMessage;
// missile capacity (not exceed)
this.$gc5MCap = player.ship.missileCapacity;
//this.$gc5Count = player.ship.missiles.length;
// Load cargo space, missile & container counts if present
if (missionVariables.gc5Cargo != null)
player.ship.cargoSpaceCapacity = missionVariables.gc5Cargo;
//if (missionVariables.gc5Count != null)
//this.$gc5Count = missionVariables.gc5Count;
if (missionVariables.gc5Containers != null)
this.$gc5Containers = missionVariables.gc5Containers;
// Load total fees taken
if (missionVariables.gc5HandlingFeeTotal != null)
this.$gc5HandlingFeeTotal = missionVariables.gc5HandlingFeeTotal;
if (missionVariables.gc5HandlingPaid != null)
this.$gc5HandlingPaid = missionVariables.gc5HandlingPaid;
if (missionVariables.gc5MaintenanceFeeTotal != null)
this.$gc5MaintenanceFeeTotal = missionVariables.gc5MaintenanceFeeTotal;
if (missionVariables.gc5DismantlingFeeTotal != null)
this.$gc5DismantlingFeeTotal = missionVariables.gc5DismantlingFeeTotal;
// Load system-to-system runs w/container
if (missionVariables.gc5Runs != null)
this.$gc5Runs = missionVariables.gc5Runs;
// Load Handling fee count
if (missionVariables.gc5HandlingCount != null)
this.$gc5HandlingCount = missionVariables.gc5HandlingCount;
// Load handling fee exemption status
if (missionVariables.gc5HFExempt != null)
this.$gc5HFExempt = missionVariables.gc5HFExempt;
// Load Maintenance fee count
if (missionVariables.gc5MaintenanceCount != null)
this.$gc5MaintenanceCount = missionVariables.gc5MaintenanceCount;
// CHECK
log(this.name, this.name+" startup complete.");
// TEST
var sta = player.ship.dockedStation;
if ((this.$gc5Containers<this.$gc5MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account screen
this._gc5PrepAcc(sta);
// optionally, prepare handling fee waiver request
if (this.$gc5Containers>0) this._gc5PrepEx(sta);
}
this.startUp = function() {
log(this.name, "Initialising OXP " + this.name);
// check for G.E.T. presence
this.$gc5ET = false;
if (worldScripts["Elite Trader"])
this.$gc5ET = true;
// TEST
if (this.$gc5ET) log(this.name, "Finds Elite Trader present");
// check for FE Ships Player
this.$gc5FES = false;
if (worldScripts["FE Ships Player"])
this.$gc5FES = true;
// TEST
if (this.$gc5ET) log(this.name, "Finds FE Ships Player present");
// missile capacity (not exceed)
this.$gc5MCap = 0;
// pylon-use count
//this.$gc5Count = 0;
// container count
this.$gc5Containers = 0;
// purchase cost of container in cr
this.$gc5Cost = 50000;
// handling fee
this.$gc5HandlingFee = 0.005*this.$gc5Cost; // 0.005 of cost
this.$gc5HandlingFeeTotal = 0;
this.$gc5HandlingPaid = "yes"; // or "no" - easier than boolean
this.$gc5HandlingCount = 0;
this.$gc5HFExempt = "no";
// maintenance fee
this.$gc5MaintenanceFee = 0.05*this.$gc5Cost; // 0.05 of cost
this.$gc5MaintenanceFeeTotal = 0;
this.$gc5MaintenancePaid = "no" // or "yes"
this.$gc5MaintenanceInterval = 50; // in runs (according to cost)
this.$gc5MaintenanceCount = 0;
// dismantling fee
this.$gc5DismantlingFee = 0.1*this.$gc5Cost; // 0.1 of cost
this.$gc5DismantlingFeeTotal = 0.0;
// system-to-system runs w/container
this.$gc5Runs = 0;
}
this.playerWillSaveGame = function(message) {
//missionVariables.gc5Count = this.$gc5Count;
missionVariables.gc5Cargo = player.ship.cargoSpaceCapacity;
missionVariables.gc5Containers = this.$gc5Containers;
// save total fees taken
missionVariables.gc5HandlingFeeTotal = this.$gc5HandlingFeeTotal;
missionVariables.gc5MaintenanceFeeTotal = this.$gc5MaintenanceFeeTotal;
missionVariables.gc5DismantlingFeeTotal = this.$gc5DismantlingFeeTotal;
missionVariables.gc5HandlingPaid = this.$gc5HandlingPaid;
// system-to-system runs w/container
missionVariables.gc5Runs =this.$gc5Runs;
// handling fee count
missionVariables.gc5HandlingCount = this.$gc5HandlingCount;
// handling fee exemption (G.E.T.)
missionVariables.gc5HFExempt = this.$gc5HFExempt;
// maintenance fee count
missionVariables.gc5MaintenanceCount = this.$gc5MaintenanceCount;
}
this.shipDockedWithStation = function(station) {
// take handling fee (if not exempt)
var pc = player.consoleMessage;
var ex = this.$gc5HFExempt;
// check we have containers, the fee is not paid, and we're not exempt
if ((this.$gc5Containers>0) && (this.$gc5HandlingPaid==="no") && (ex==="no")) {
var fee = 0;
for (var x=1; x<= this.$gc5Containers; x++)
fee += this.$gc5HandlingFee;
// record fee and debit trader's account
this.$gc5HandlingFeeTotal += fee;
player.credits -= fee;
this.$gc5HandlingPaid = "yes";
pc("50 TC Container handling fees: "+fee+" cr",9);
this.$gc5HandlingCount++;
}
// conditionally take maintenance fee
if (this.$gc5Containers>0) this._gc5DoMaintenance();
// TEST
if ((this.$gc5Containers<this.$gc5MCap) && (system.techLevel>=6))
pc("Containers available in the Shipyard.");
// prepare container Account and Licence page
this._gc5PrepAcc(station);
// prepare handling fee waiver request if ET or FESP is present
if (this.$gc5Containers>0) this._gc5PrepEx(station);
}
this.shipExitedWitchspace = function() {
// set handling paid to 'no'
this.$gc5HandlingPaid = "no";
this.$gc5Runs ++;
}
/* Common helper functions */
// assess and take maintenance fee
this._gc5DoMaintenance = function() {
var pc = player.consoleMessage;
var runs = this.$gc5Runs;
var intv = this.$gc5MaintenanceInterval;
var mfee = this.$gc5MaintenanceFee;
// take maintenance fee after y runs
if ( (runs > 0) && ((runs % intv)==0) ) {
// maintenance for x containers
var fee = 0;
for (var x=1; x<= this.$gc5Containers; x++)
fee += mfee;
// maintenance fee tally & debit
this.$gc5MaintenanceFeeTotal += fee;
player.credits -= fee;
pc("50 TC Container Maintenance fees: "+fee+" cr",9);
// update Maintenance count
this.$gc5MaintenanceCount++;
}
}
/* F4 Interfaces */
// create F.E.S. 'Licence & Account' page
this._gc5PrepAcc = function(station) {
station.setInterface("gc5Acc",{
title: "Your FE Shipyards 50 TC Container Class Licence",
category: "Your FE Shipyards",
summary: "Your FE Shipyards 50 TC Goods Container account screen shows terms, fees paid, load, and other useful information.",
callback: this._gc5ShowAcc.bind(this)
});
}
// show F.E.S. 'Licence & Account' page
this._gc5ShowAcc = function() {
var hfc = this.$gc5HandlingCount;
var mfc = this.$gc5MaintenanceCount;
var mfi = this.$gc5MaintenanceInterval;
var hft = this.$gc5HandlingFeeTotal;
var mft = this.$gc5MaintenanceFeeTotal;
var dft = this.$gc5DismantlingFeeTotal;
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
if (this.$gc5Containers>0)
parameters.message +="Your Account and Licence for 50 TC Class Goods Containers x "+this.$gc5Containers+": \n\n";
else
parameters.message +="You have no 50 TC Class Containers licensed with us at this time. \n\n";
parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
parameters.message += "Our containers are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
parameters.message += "If you cancel your Container account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylons for weapons-use. \n";
parameters.choicesKey = "gc5Acknowlege";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_YES") player.commsMessage("FE Shipyards thanks you for your custom.");
}
}
// create F.E.S. handling fee waiver/restoration request
this._gc5PrepEx = function(station) {
station.setInterface("gc5Ex",{
title: "Your FE Shipyards Handling Fee Waiver Request",
category: "Your FE Shipyards",
summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 50-ton container class." ,
callback: this._gc5ShowEx.bind(this)
});
}
// show F.E.S. handling & dismantling fee waiver/restoration request
this._gc5ShowEx = function() {
var priv = ((this.$gc5ET)||(this.$gc5FES));
var privo = "";
if (this.$gc5FES) privo="FE shipowner";
if (this.$gc5ET) privo="Guilder";
var parameters = new Object();
parameters.title = "FE Shipyards";
parameters.message = "Dear customer, \n\n";
parameters.message += "Re: your request to waive your 50 TC container fees.\n\n"
parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
if (priv)
parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
else
parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
parameters.message += "Yours attentively,\n\n";
parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
parameters.choicesKey = "gc5YesNoEx";
mission.runScreen(parameters, callback);
function callback(choice) {
if (choice === "1_AYE") {
if (priv) this.$gc5HFExempt = "yes"; else this.$gc5HFExempt = "no";
} else this.$gc5HFExempt = "no";
player.commsMessage("FE Shipyards thanks you for your attention.");
}
}
|
Scripts/gc_conditions.js |
"use strict";
this.allowAwardEquipment = function(equipment, ship, context) {
return true
}
|