Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion Equipment 'Sell Item' Color

Content

Warnings

  1. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Changes the color of all equipment items described as 'Sell' or 'Remove' Changes the color of all equipment items described as 'Sell' or 'Remove'
Identifier oolite.oxp.phkb.EquipmentRemoveItemColor oolite.oxp.phkb.EquipmentRemoveItemColor
Title Equipment 'Sell Item' Color Equipment 'Sell Item' Color
Category Miscellaneous Miscellaneous
Author phkb phkb
Version 1.4 1.4
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/9/99/EquipmentRemoveItemColor.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1622272195

Documentation

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

readme.txt

Equipment Remove Item Color
By Nick Rogers

Overview
========
A number of equipment OXP's include a "Remove" option, purchasable through the F3 Ship Outfitting screen. But, because they are the same color as other purchasable items it can be hard to quickly scan the list to find the item you want to purchase. This OXP simply recolors all items whose description starts with "Remove", "Sell" or "Unmount" to make it clear that these purchases will remove something from your ship. The recoloring will not be done on any item that already has a "display_color" defined in their equipment.plist file.

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/

Discussion
==========
This OXP is discussed at this forum link: http://aegidian.org/bb/viewtopic.php?f=4&t=18950

Version History
===============
1.4
- Expanded search criteria to include the item name as well as the item description when looking for remove items.

1.3
- Added some more inclusions and exclusions.

1.2 
- Added items described with "Undo " to the list of remove items.

1.1 
- Improved logic for catching "Remove" items.

1.0
- Initial release.

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                   = "EquipmentRemoveItemColor";
this.author                 = "phkb";
this.copyright              = "2017 phkb";
this.description            = "Changes the color of all equipment items described as 'Remove'";
this.licence                = "CC BY-NC-SA 4.0";

this._exceptions = ["EQ_TOWBAR","EQ_SHIPMINER"];
this._inclusions = [];

//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function() {
	var eq = EquipmentInfo.allEquipment;
	for (var i = 0; i < eq.length; i++) {
		var itm = eq[i];
		var desc = itm.description.toLowerCase();
		var name = itm.name.toLowerCase();
		if (itm.displayColor == null) {
			if (this._exceptions.indexOf(itm.equipmentKey) >= 0) continue; 
			if ((desc.indexOf("remove") >= 0 || name.indexOf("remove") >= 0) || 
				((desc.indexOf("sell ") >= 0 || name.indexOf("sell ") >= 0) && desc.indexOf("buy ") === -1 && name.indexOf("buy ") === -1) || 
				(desc.indexOf("unmount") >= 0 || name.indexOf("unmount") >= 0) || 
				(desc.indexOf("undo ") >= 0 || name.indexOf("undo ") >= 0) || 
				itm.equipmentKey.indexOf("REFUND") >= 0 ||
				this._inclusions.indexOf(itm.equipmentKey) >= 0) {
				itm.displayColor = "redColor";
			}
		}
	}
}