Weight system

The probability system of the entire plugin is controlled by weights. What are weights? A weight represents the relative chance of obtaining a particular item. For instance, if item A has a weight of 10 and item B has a weight of 30, the probability of getting A is 25%, while the chance of getting B is 75%. This is the most scientific method for calculating probabilities.

Weight operations include + (addition), - (subtraction), * (multiplication), / (division), % (modulus), and = (custom expression).

========= basic expression ========
rubbish:+10
rubbish:-5.5
rubbish:/2
rubbish:%6
rubbish:*1.7

========= advanced expression (support papi & functions) ======
rubbish:= {0} * 2 + 10          <- {0}=current weight
 
rubbish:= {0} * sin(30 * pi / 180) + 10    <- built-in functions

rubbish:= {0} + {placeholder}   <- before using the PlaceholderAPI placeholders, 
                                <- you have to register them by following the 
                                <- guide in "Placeholder" article
pagePlaceholder
Built-in functions:
    abs: absolute value
    acos: arc cosine
    asin: arc sine
    atan: arc tangent
    cbrt: cubic root
    ceil: nearest upper integer
    cos: cosine
    cosh: hyperbolic cosine
    exp: euler's number raised to the power (e^x)
    floor: nearest lower integer
    log: logarithmus naturalis (base e)
    log10: logarithm (base 10)
    log2: logarithm (base 2)
    sin: sine
    sinh: hyperbolic sine
    sqrt: square root
    tan: tangent
    tanh: hyperbolic tangent
    signum: signum function

Where can weights be used? In fact, weights are applied in many parts of the plugin. For instance, adjusting weights based on conditions for loot, weights in mini-games, and item effects (like fishing rods) that offer weight modification features. They are typically configured in a list format and adhere to this specific configuration format.

With weight modifications, we can achieve features that many other fishing plugins can't. For example, there's less trash in the ocean but it frequently appears in rivers. Players using a golden fishing rod have a higher chance to catch gold-quality loot. Or perhaps, to catch a ferocious shark, players must use shark bait. All these features can be realized through the weight system.

Weights aren't very intuitive to me. How can I convert the weights into a percentage form? The plugin has already thought of this. You simply need to use the command /customfishing debug loot-chance. It will calculate the probabilities of all potential loots based on the fishing rod, bait, and other factors you currently hold that can affect the fishing results.

Last updated