Back to Index | Page generated: Dec 20, 2024, 7:22:09 AM |
from Expansion Manager's OXP list | from Expansion Manifest | |
---|---|---|
Description | Reduces Towbar's salvaged equipment payout. | Reduces Towbar's salvaged equipment payout. |
Identifier | oolite.oxp.dybal.towbarPayout-Medium | oolite.oxp.dybal.towbarPayout-Medium |
Title | Towbar Payout - Medium | Towbar Payout - Medium |
Category | Mechanics | Mechanics |
Author | Dybal | Dybal |
Version | 1.1 | 1.1 |
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/e/eb/TowbarPayout-Medium-1.1.oxz | n/a |
License | Cc BY-NC-SA 4.0 | Cc BY-NC-SA 4.0 |
File Size | n/a | |
Upload date | 1610873505 |
Also read http://wiki.alioth.net/index.php/Towbar%20Payout%20-%20Medium
License CC-BY-NC-SA 4.0 - Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-nc-sa/4.0/) ------------------------------------------------------------ Towbar Payout - Medium This OXP changes the policies Towbar uses to calculate the value of the equipment from a salvaged ship. Its intent is reduce the payout for the expensive equipment to keep the earnings for salvaging high enoughto pay the costs and be attractive, but not so high that the salvager amasses a huge amount of credits so quicly that money loses its meaning. The salvaging price starts at 25% of the full price for the equipment; if the equipment is damaged, the salvaged price is halved to 12.5%. The damage probability of an equipment is function of its Tech Level, going from 20% for TL 1 to 95% to TL 16. After that, if the <price damage discounted> is above 500 Cr a new salvaged price is calculated using the formulae (it has to be plotted and the curve shape seen to be understood, try https://www.desmos.com/calculator): <salvaged price> = 5 * <price damage discounted> / sqrt(<price damage discounted> / 2) Finally, there is a minimum payout: if the <damage discounted price> was above 300 Cr we pay at least 50 Cr, otherwise we pay at least 10 Cr; if the <salvaged price> calcuated by the formulae above is bellow this minimun, the minimum is paid. This should reduce the equipment value for a fully kitted NPC to around 3~4k Cr, compared to the 20~50k Cr for Towbar pre 0.104, or the 4~8k of standard policy of the 0.104 version. -------------------------------------------------------------- Change log v1.0 - Initial version v1.1 - Looks for EquipmentInfo.scriptInfo.towbar_max_salvage_price
Path | |
---|---|
Scripts/payout.js | "use strict"; this.name = "towbarPayout-Medium"; this.author = "Dybal"; this.copyright = "2020 Dybal"; this.licence = "CC BY-NC-SA 4.0"; this.description = "Alternative payout policy for salvaged equipments"; this.version = "1.1"; this.$display = "Medium"; // for use by Towbar in Lib_Config //--------------------------------------------------------------------- this.startUpComplete = function _Towbar_EqPayout_Medium_startUpComplete() { var wstb = worldScripts.towbar; if (wstb) { if (wstb.$TowbarEquipmentPayoutHandlers) { // Towbar version >= 0.105 log(this.name, "Registering Towbar Equipment Payout handler '"+this.$display+"'"); wstb.$TowbarEquipmentPayoutHandlers.push(this.$Towbar_EqPayout_Medium); this.$Towbar_EqPayout_Medium.display = this.$display; } else if (wstb.$Towbar_EqSalvagePrice) { // Towbar version 0.104 log(this.name, "Overwriting Towbar Equipment Payout handler"); wstb.$Towbar_EqSalvagePrice = this.$Towbar_EqPayout_Medium; } } } //--------------------------------------------------------------------- this.$Towbar_EqPayout_Medium = function _Towbar_EqPayout_Medium(eqInfo) { if (!eqInfo || !eqInfo.equipmentKey) return 0; var price = eqInfo.price / 10; // price in credits var discounted = 0.25 * price; var damage_prob = 0.5 + ((eqInfo.techLevel<16 ? eqInfo.techLevel : Math.random()*15)-6)/20; var damaged = (Math.random() < damage_prob); var damaged_price, salvage_price; if (eqInfo.scriptInfo && eqInfo.scriptInfo.towbar_max_salvage_price) discounted = price = parseFloat(eqInfo.scriptInfo.towbar_max_salvage_price); if (discounted < 10) return 0; if (damaged) damaged_price = discounted / 2; else damaged_price = discounted; if (damaged_price > 500) // 500 Cr salvage_price = 5 * damaged_price / Math.sqrt(damaged_price/2); else if (damaged_price > 300) // 300 Cr salvage_price = Math.max(50, damaged_price); // at least 50 Cr else salvage_price = Math.max(10, damaged_price); // at least 10 Cr salvage_price = Math.round(salvage_price / 10) * 10; // get multiple of 10 number if (this.$TowbarDebug) log(this.name,"towbarPayout-Medium "+eqInfo.equipmentKey+", TL:"+eqInfo.techLevel+", price:"+(eqInfo.price/10).toFixed(0)+", damage_prob:"+damage_prob.toFixed(4)+", damaged:"+damaged+", discounted:"+discounted.toFixed(0)+", depreciated:"+damaged_price.toFixed(0)+", payout:"+salvage_price.toFixed(0)); return salvage_price; } |