Back to Index Page generated: Jan 7, 2025, 2:02:46 AM

Expansion Equipment Expensive Item Color

Content

Warnings

  1. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0
  2. No version in dependency reference to oolite.oxp.phkb.EquipmentRemoveItemColor:null
  3. Optional Expansions mismatch between OXP Manifest and Expansion Manager at character position 0074 (DIGIT ZERO vs LATIN SMALL LETTER N)
  4. Dependency with illegal key 'title'

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Gray color for expensive equipment in F3 Ship Outfitting screen. Press \"i\" for more. Best with phkb \"Equipment 'Sell Item' Color\" 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. wiki page https://wiki.alioth.net/index.php/Equipment_Expensive_Item_Color (contain download link too) Gray color for expensive equipment in F3 Ship Outfitting screen. Press \"i\" for more. Best with phkb \"Equipment 'Sell Item' Color\" 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. wiki page https://wiki.alioth.net/index.php/Equipment_Expensive_Item_Color (contain download link too)
Identifier oolite.oxp.Gilhad.EquipmentExpensiveItemColor oolite.oxp.Gilhad.EquipmentExpensiveItemColor
Title Equipment Expensive Item Color Equipment Expensive Item Color
Category Miscellaneous Miscellaneous
Author gilhad gilhad
Version 1.5 1.5
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
  • oolite.oxp.phkb.EquipmentRemoveItemColor:0
  • oolite.oxp.phkb.EquipmentRemoveItemColor:
  • Conflict Expansions
    Information URL n/a
    Download URL https://wiki.alioth.net/img_auth.php/c/c6/Oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz n/a
    License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
    File Size n/a
    Upload date 1734570695

    Documentation

    Also read http://wiki.alioth.net/index.php/Equipment%20Expensive%20Item%20Color

    readme.txt

    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.
    It is best use together with [[Equipment 'Sell Item' Color]] that show entries for removing equipment in red.
    
    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?t=21756
    
    It originated here: https://bb.oolite.space/viewtopic.php?p=297992#p297992
    
    Use with
    =========
    [[Equipment 'Sell Item' Color]] - show entries for removing equipment in red
    
    Use from other modules
    ======================
    Call this.$updateColors() to get expensive items grayed, call this.$revertColors() to revert it back.
    
    Oolite version
    ==============
    So far tested only with Oolite 1.90, but may work with much more versions too
    
    Download
    ========
    Download [[Media:oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz|oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz]] (downloaded {{#downloads:oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz}} times).
    
    ([[File:Oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz]])
    
    
    on wiki https://wiki.alioth.net/index.php/Equipment_Expensive_Item_Color
    
    https://wiki.alioth.net/img_auth.php/4/41/EquipmentExpensiveItemColor.oxz
    https://wiki.alioth.net/index.php/File:EquipmentExpensiveItemColor.oxz
    
    Gameplay and Balance indicator
    ==============================
    [[Image:tag-colour-green.png]] Does not affect gameplay at all.
    
    Version History
    ===============
    
    * 1.5 - 2024.12.19 00:28:06 - Improved readme/wiki, hope to publish
    * 1.4 - 2024.12.18 17:07:04 - improving compatibility (names etc.)
    * 1.3 - 2024.11.02 20:29:55 - cosmetical changes (comments ...)
    * 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.
    

    readme.wiki

    [[image:EquipmentExpensiveItemColor.png|right]]
    === 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.
    
    It is best use together with [[Equipment 'Sell Item' Color]] that show entries for removing equipment in red.
    
    === 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
    
    === Use with ===
    [[Equipment 'Sell Item' Color]] - show entries for removing equipment in red
    
    === Use from other modules ===
    Call this.$updateColors() to get expensive items grayed, call this.$revertColors() to revert it back.
    
    === Oolite version ===
    So far tested only with Oolite 1.90, but may work with much more versions too
    
    
    === Download ===
    Download [[Media:oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz|oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz]] (downloaded {{#downloads:oolite.oxp.Gilhad.EquipmentExpensiveItemColor.oxz}} times).
    
    === Gameplay and Balance indicator ===
    [[Image:tag-colour-green.png]] Does not affect gameplay at all.
    
    === Version History ===
    
    * 1.5 - 2024.12.19 00:28:06 - Improved readme/wiki, hope to publish
    * 1.4 - 2024.12.18 17:07:04 - improving compatibility (names etc.)
    * 1.3 - 2024.11.02 20:29:55 - cosmetical changes (comments ...)
    * 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.
    
    
    
    
    [[Category:Oolite expansion packs]][[Category:Misc OXPs]]
    
    
    

    Equipment

    This expansion declares no equipment. This may be related to warnings.

    Ships

    This expansion declares no ships. This may be related to warnings.

    Models

    This expansion declares no models. This may be related to warnings.

    Scripts

    Path
    Config/script.js
    "use strict";
    this.name                   = "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" ) {
    //		log(this.name,from+" --> "+to);
    		this.$updateColors();
    	} else if (( to == "GUI_SCREEN_STATUS") && this.$needRevert ) {
    //		log(this.name,from+" --> "+to);
    		this.$revertColors();
    	};
    }
    
    this.playerBoughtEquipment = function(equipment, paid) {
    //	log(this.name,"playerBoughtEquipment: "+equipment+" ["+paid+" Cr] ;");
    	this.$updateColors();
    }
    
    this.startUpComplete = function() {
    	this.$needRevert = 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.$needRevert = false;		// F5 do not need fix
    
    this.$updateColors = function() {	// set expensive to gray, cheap to yellow
    	this.$needRevert = 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.$needRevert = false;		// F5 do not need fix
    	var eq = EquipmentInfo.allEquipment;
    //	log(this.name,"$revertColors ;");
    	for (var i = 0; i < eq.length; i++) {
    		var itm = eq[i];
    		if ( (itm.displayColor != null ) && (itm.displayColor.toString() == this.$grayColor) ) {
    			itm.displayColor = null;
    		}
    	}
    }