
Available in the download manager.
![[EliteWiki]](/images/elitewikismall.png)
Moderators: winston, another_commander
1) as a player, I load up on lots of equipment.oxp's (...not the ships or the weapons). I enjoy the variety and the different uses. I do find this little oxp invaluable for making sense of the F3 ship outfitting pages. Thank you!
I changed the “title” element of the manifest. But I left the “identifier” the same, so that it will continue to be identified as the same OXP and thus will upgrade successfully.Cholmondely wrote: ↑Sun Jun 06, 2021 6:22 amwhat is involved in changing the name of a published OXP? ie: Equipment Remove Item -> Equipment 'Sell Item'?
It looks like that should be possible, and I think it's a good idea.
That link does not work.gilhad wrote: ↑Tue Oct 29, 2024 7:46 pmHere is first version for testing http://cobra-mk3.gilhad.cz/Games/oolite ... mColor.oxz![]()
Other possible event listeners to try are guiScreenWillChange - fires before the page is drawn -
Code: Select all
this.guiScreenWillChange = function(to,from) {
// log(this.name,"guiScreenWillChange: "+from+" --> "+to+" ;");
if (to == "GUI_SCREEN_EQUIP_SHIP" ) {
this.$updateColors();
} else if (( to == "GUI_SCREEN_STATUS") && this.$fixF5 ) {
this.$revertColors();
};
}
Code: Select all
"use strict";
this.name = "G_EquipmentExpensiveItemColor";
this.author = "gilhad";
this.copyright = "2024 gilhad";
this.description = "Gray color for expensive equipment in F3 Ship Outfitting screen";
this.licence = "CC BY-NC-SA 4.0";
this.guiScreenWillChange = function(to,from) {
// log(this.name,"guiScreenWillChange: "+from+" --> "+to+" ;");
if (to == "GUI_SCREEN_EQUIP_SHIP" ) {
this.$updateColors();
} else if (( to == "GUI_SCREEN_STATUS") && this.$fixF5 ) {
this.$revertColors();
};
}
this.playerBoughtEquipment = function(equipment, paid) {
// log(this.name,"playerBoughtEquipment: "+equipment+" ["+paid+" Cr] ;");
this.$updateColors();
}
this.startUpComplete = function() {
this.$fixF5 = false; // F5 do not need fix
// HACK use missile to set displayColor, read it and revert it back
var missileInfo = EquipmentInfo.infoForKey("EQ_MISSILE");
var tmp = missileInfo.displayColor;
missileInfo.displayColor = "grayColor";
this.$grayColor = missileInfo.displayColor.toString();
//
// log(this.name,"startUpComplete: missileInfo.displayColor ("+missileInfo.displayColor+") ? = this.$grayColor ("+this.$grayColor+") : "+(missileInfo.displayColor.toString() == this.$grayColor));
missileInfo.displayColor = tmp;
// END HACK
}
this.$grayColor = null; // get true color for gray, filled in startUpComplete()
this.$fixF5 = false; // F5 do not need fix
this.$updateColors = function() { // set expensive to gray, cheap to yellow
this.$fixF5 = true; // we play with colors
var credits = Math.floor(player.credits*10);
log(this.name,"$updateColors ["+credits+" dCr] ;");
var eq = EquipmentInfo.allEquipment;
for (var i = 0; i < eq.length; i++) {
var itm = eq[i];
var price = itm.calculatedPrice;
if (price > credits) { // pricey - go to gray
if (itm.displayColor == null) {
itm.displayColor = "grayColor";
}
} else { // cheap - revert
if ( (itm.displayColor != null ) && (itm.displayColor.toString() == this.$grayColor) ) {
itm.displayColor = null;
}
}
}
}
this.$revertColors = function() { // revert everything to yelow
this.$fixF5 = false; // F5 do not need fix
var eq = EquipmentInfo.allEquipment;
for (var i = 0; i < eq.length; i++) {
var itm = eq[i];
if ( (itm.displayColor != null ) && (itm.displayColor.toString() == this.$grayColor) ) {
itm.displayColor = null;
}
}
}
Code: Select all
{
identifier = "oolite.oxp.Gilhad.G_EquipmentExpensiveItemColor";
required_oolite_version = "1.85";
title = "Equipment Expensive Item Color";
// description = "This OXP highlights expensive equipment in gray on the F3 Ship Outfitting screen. An item is considered expensive if its price exceeds your current credits.";
description = "Gray color for expensive equipment in F3 Ship Outfitting screen";
version = "1.2";
category = "Miscellaneous";
author = "gilhad";
license = "CC-BY-NC-SA 4.0";
}
Code: Select all
Equipment Expensive Item Color
By Gilhad
Overview
========
This OXP highlights expensive equipment in gray on the F3 Ship Outfitting screen.
An item is considered expensive if its price exceeds your current credits.
This extension recolors items that are too costly based on the player's current balance, allowing players to see at a glance which items they can't afford. However, if an item already has a "display_color" defined in its equipment.plist file, this OXP will not override it. When your credits increase, items previously marked in grey will automatically revert to yellow.
License
=======
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
Attribution and Acknowledgments
===============================
This OXP was developed as an extension to oolite.oxp.phkb.EquipmentRemoveItemColor.oxz by phkb and is intended for potential integration. Its code is partially based on that work.
Special thanks to Wildeblood for programming assistance.
Compatibility
=============
EquipmentRemoveItemColor does recoloring at startup, this OXP does it later in game, so already recolored items are not affected.
Discussion
==========
This OXP is discussed at this forum link: https://bb.oolite.space/viewtopic.php?p=297992#p297992
Version History
===============
1.2 - 2024.10.30 05:13:29 - fix F5 page colors
1.1 - 2024.10.29 22:33:14 - fix old values on first F3 page
1.0 - 2024.10.29 19:34:25 - Initial release.