Re: Maintenance upon demmand
Posted: Thu Jul 18, 2019 10:24 am
It seemed appropriate to include the code in the actual OXP, so here it is, v0.3, with maintenance emails: MaintenanceTuneUp.oxz.
For the really keen, here's what I did:
First, the startupComplete event, I added this code:Essentially, this tells the GalCop Admin Services worldscript to ignore any purchase of the tune up equipment item. That's so we only get one email, not two.
Next, I added the following event handlerThis grabs a copy of the players current renovation cost, so we can apply it to the email if required.
Finally, in the "playerBoughtEquipment" routine, I added this code:All this does is applies the cost value we recorded earlier to GalCop Admin Servers, forces the rep names to be defined, and then sends the maintenance email.
Hope that makes sense!
For the really keen, here's what I did:
First, the startupComplete event, I added this code:
Code: Select all
if (worldScripts.GalCopAdminServices) {
var ga = worldScripts.GalCopAdminServices;
ga._purchase_ignore_equip.push("EQ_MAINTENANCE_TUNEUP"); // don't sent a normal purchase email for this one
}
Next, I added the following event handler
Code: Select all
this.guiScreenChanged = function(to, from) {
if (to === "GUI_SCREEN_EQUIP_SHIP") {
this._cost = player.ship.renovationCost;
}
}
Finally, in the "playerBoughtEquipment" routine, I added this code:
Code: Select all
if (worldScripts.GalCopAdminServices) {
var ga = worldScripts.GalCopAdminServices;
ga._maintCost = this._cost / 10;
ga.$setupRepNames();
ga.$sendMaintenanceEmail();
}
Hope that makes sense!