Config/script.js |
this.name = "ooCheat";
this.author = "Thargoid";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "Cheat menu";
this.version = "1.11";
this.startUp = function()
{
log("Cheat screen enabled");
missionVariables.ooCheat_recharge = "Activate";
missionVariables.ooCheat_missile = "Activate";
missionVariables.ooCheat_fuel = "Activate";
missionVariables.ooCheat_ecm = "Activate";
missionVariables.ooCheat_invuln = "Activate";
this.shipDockedWithStation();
}
this.shipDockedWithStation = function(station)
{
if(player.ship.docked)
{
player.ship.dockedStation.setInterface("ooCheat",
{ title: "Cheat Screen",
category: "Game",
summary: "Displays the ooCheat menu.",
callback: this.displayMenu.bind(this) });
}
}
this.displayMenu = function()
{
mission.runScreen({title:"Cheat Menu", choicesKey:"ooCheat_choices"}, this.choice);
mission.addMessageText("Name : " + player.name);
mission.addMessageText("Credits : " + player.credits);
mission.addMessageText("Legal Status : " + player.legalStatus);
mission.addMessageText("Rank : " + player.rank + " (" + player.score + " kills)");
if(missionVariables.ooCheat_recharge === "Activate")
{ mission.addMessageText("\nEnhanced recharge rate is deactivated."); }
else
{ mission.addMessageText("\nEnhanced recharge rate is activated."); }
if(missionVariables.ooCheat_missile === "Activate")
{ mission.addMessageText("Incoming missile prevention is deactivated."); }
else
{ mission.addMessageText("Incoming missile prevention is activated."); }
if(missionVariables.ooCheat_fuel === "Activate")
{ mission.addMessageText("Auto jump refuelling is deactivated."); }
else
{ mission.addMessageText("Auto jump refuelling is activated."); }
if(missionVariables.ooCheat_ecm === "Activate")
{ mission.addMessageText("Target ECM suppression is deactivated."); }
else
{ mission.addMessageText("Target ECM suppression is activated."); }
if(missionVariables.ooCheat_invuln === "Activate")
{ mission.addMessageText("Limited invulnerability is deactivated."); }
else
{ mission.addMessageText("Limited invulnerability is activated."); }
}
this.choice = function(choice)
{
switch(choice)
{
case "OOCHEAT_1_CREDITS":
{
player.credits += 1000;
this.displayMenu();
break;
}
case "OOCHEAT_2_RANK":
{
this.increaseRank();
this.displayMenu();
break;
}
case "OOCHEAT_3_LEGAL":
{
player.bounty = 0;
this.displayMenu();
break;
}
case "OOCHEAT_4_REPAIR":
{
var eqCounter = 0 ;
for(eqCounter = 0;eqCounter<player.ship.equipment.length;eqCounter++)
{
if(player.ship.equipmentStatus(player.ship.equipment[eqCounter].equipmentKey) == "EQUIPMENT_DAMAGED")
{ player.ship.setEquipmentStatus(player.ship.equipment[eqCounter].equipmentKey, "EQUIPMENT_OK"); }
}
this.displayMenu();
break;
}
case "OOCHEAT_5_RECHARGE":
{
if(missionVariables.ooCheat_recharge === "Activate")
{ missionVariables.ooCheat_recharge = "Deactivate"; }
else
{ missionVariables.ooCheat_recharge = "Activate"; }
this.displayMenu();
break;
}
case "OOCHEAT_6_MISSILE":
{
if(missionVariables.ooCheat_missile === "Activate")
{ missionVariables.ooCheat_missile = "Deactivate"; }
else
{ missionVariables.ooCheat_missile = "Activate"; }
this.displayMenu();
break;
}
case "OOCHEAT_7_FUEL":
{
if(missionVariables.ooCheat_fuel === "Activate")
{ missionVariables.ooCheat_fuel = "Deactivate"; }
else
{ missionVariables.ooCheat_fuel = "Activate"; }
this.displayMenu();
break;
}
case "OOCHEAT_8_ECM":
{
if(missionVariables.ooCheat_ecm === "Activate")
{ missionVariables.ooCheat_ecm = "Deactivate"; }
else
{ missionVariables.ooCheat_ecm = "Activate"; }
this.displayMenu();
break;
}
case "OOCHEAT_9_INVULN":
{
if(missionVariables.ooCheat_invuln === "Activate")
{ missionVariables.ooCheat_invuln = "Deactivate"; }
else
{ missionVariables.ooCheat_invuln = "Activate"; }
this.displayMenu();
break;
}
}
}
this.increaseRank = function()
{
switch(true)
{
case (player.score < 8):
{
player.score = 8;
break;
}
case (player.score >= 8 && player.score < 16):
{
player.score = 16;
break;
}
case (player.score >= 16 && player.score < 32):
{
player.score = 32;
break;
}
case (player.score >= 32 && player.score < 64):
{
player.score = 64;
break;
}
case (player.score >= 64 && player.score < 128):
{
player.score = 128;
break;
}
case (player.score >= 128 && player.score < 512):
{
player.score = 512;
break;
}
case (player.score >= 512 && player.score < 2560):
{
player.score = 2560;
break;
}
case (player.score >= 2560 && player.score < 6400):
{
player.score = 6400;
break;
}
case (player.score >= 6400):
{
player.score += 100;
break;
}
}
}
this.shipWillLaunchFromStation = function(station)
{
if(missionVariables.ooCheat_recharge === "Deactivate")
{ this.rechargeTimer = new Timer(this, this.recharge, 0, 0.25); }
}
this.shipWillDockWithStation = this.shipDied = function()
{
if(this.rechargeTimer && this.rechargeTimer.isRunning)
{
this.rechargeTimer.stop();
delete this.rechargeTimer;
}
}
this.recharge = function()
{ player.ship.energy += 10; }
this.shipAttackedWithMissile = function(missile, whom)
{
if(missionVariables.ooCheat_missile === "Deactivate" && missile.primaryRole != "thargon" && missile.primaryRole != "tharglet")
{ missile.remove(); }
}
this.shipFiredMissile = function(missile, target)
{
if(missionVariables.ooCheat_ecm === "Deactivate" && target && target.equipmentStatus("EQ_ECM") === "EQUIPMENT_OK")
{ target.removeEquipment("EQ_ECM"); }
}
this.shipWillExitWitchspace = function()
{
if(missionVariables.ooCheat_fuel === "Deactivate")
{ player.ship.fuel = 7; }
}
this.shipTakingDamage = function(amount, fromEntity, damageType)
{
if(amount && amount > 0 && missionVariables.ooCheat_invuln === "Deactivate")
{ player.ship.energy += amount; }
} |