TokenEnchant Formulae Help

Discussion in 'Spigot Plugin Help' started by 1Legend, Mar 30, 2020.

  1. I am helping my friend with a prisons server and I cant figure out how to make the prices in tokenenchant go up only a percentage and not double. Currently my prices double for everything everytime I purchase an enchant the price double. i woud like it to go up just a small percentage each time of the original price. Please help.
     
  2. Or can someone show me how to make a custom formula in the javascript costformula.js file. My desired formula is:

    price*level^exponent
     
  3. Thanks! but that isnt what im looking for. This is the costformulae.js file from the plugin:
    Code (Text):
    /*
    base: base price set in price: option,
    current: current level,
    next: target level,
    */

    function constant(base, current, next) {
        return base;
    }

    function constant_diff(base, current, next) {
        return base * (next - current);
    }

    function linear_diff(base, current, next) {
        var ret = 0;
        current++;
        next++;
        for (var i = current; i < next; i++) {
            ret += (i * base);
        }
        return ret;
    }

    function exponential1(base, current, next) {
        var ret = 0;
        for (var i = current; i < next; i++) {
            ret += base * Math.pow(i, 0.1);
        }
        return ret;
    }

    function power2(base, current, next) {
        var ret = 0;
        for (var i = current; i < next; i++) {
            ret += base * Math.pow(2, i);
        }
        return ret;
    }

    function step(base, current, next) {
        var unit_cost;
        if (next < 5)        // level 0 - 4
            unit_cost = 10;
        else if (next < 10)  // level 5 - 9
            unit_cost = 20;
        else                 // level 10 and above
            unit_cost = 50;
        return (next - current) * unit_cost;
    }
    I need to change the exponential function from (price + price * level ^ exponent) to (price * level ^ exponent)
     
    #4 1Legend, Mar 31, 2020
    Last edited: Mar 31, 2020
  4. You should be more clear next time that you make an help request lol. We cannot guess what costformula.js is. What plugin is this? what is the config file? There's already a exponential1 method
     
  5. this plugin is tokenenchant and i think my problem may be with the plugin and not the code. It just doesnt seem to change from linear to exponential when i change it in the config.