Module:PoE

From Path of Exile Wiki
Jump to navigation Jump to search
Module documentation[view] [edit] [history] [purge]


This is a meta module.

This module is meant to be used only by other modules. It should not be invoked in wikitext.

Overview

This module holds some constants and functions related to path of exile in general.


--
-- Module for certain Path of Exile specific helper and utility functions
--

--local m_util = require('Module:Util')
--local getArgs = require('Module:Arguments').getArgs

-- ----------------------------------------------------------------------------
-- Strings
-- ----------------------------------------------------------------------------

local i18n = {
}

-- ----------------------------------------------------------------------------
-- Helper functions and globals
-- ----------------------------------------------------------------------------

-- ----------------------------------------------------------------------------
-- Page functions
-- ----------------------------------------------------------------------------

local poe = {}

poe.stat = {}
poe.stat.quantifier = {}

poe.stat.quantifier['30%_of_value'] = function (value)
    return value * 0.3
end

poe.stat.quantifier['60%_of_value'] = function (value)
    return value * 0.6
end

poe.stat.quantifier['deciseconds_to_seconds'] = function (value)
    return value / 10
end

poe.stat.quantifier['divide_by_one_hundred'] = function (value)
    return value / 100
end

poe.stat.quantifier['divide_by_one_hundred_and_negate'] = function (value)
    return value / 100 * -1
end

poe.stat.quantifier['divide_by_one_hundred_2dp'] = function (value)
    return math.round(value / 1000, 2)
end

poe.stat.quantifier['milliseconds_to_seconds'] = function (value)
    return value / 1000
end

poe.stat.quantifier['milliseconds_to_seconds_0dp'] = function (value)
    return math.round(value / 1000, 0)
end

poe.stat.quantifier['milliseconds_to_seconds_2dp'] = function (value)
    return math.round(value / 1000, 2)
end

poe.stat.quantifier['milliseconds_to_seconds_2dp_if_required'] = function (value)
    return math.round(value / 1000, 2)
end

poe.stat.quantifier['multiplicative_damage_modifier'] = function (value)
    return value + 100
end

poe.stat.quantifier['multiplicative_permyriad_damage_modifier'] = function (value)
    return value / 100 + 100
end

poe.stat.quantifier['negate'] = function (value)
    return value * -1
end

poe.stat.quantifier['old_leech_percent'] = function (value)
    return value / 5
end

poe.stat.quantifier['old_leech_permyriad'] = function (value)
    return value / 500
end

poe.stat.quantifier['per_minute_to_per_second'] = function (value)
    return math.round(value / 60, 1)
end

poe.stat.quantifier['per_minute_to_per_second_0dp'] = function (value)
    return math.round(value / 60, 0)
end

poe.stat.quantifier['per_minute_to_per_second_1dp'] = function (value)
    return math.round(value / 60, 1)
end

poe.stat.quantifier['per_minute_to_per_second_2dp'] = function (value)
    return math.round(value / 60, 2)
end

poe.stat.quantifier['per_minute_to_per_second_2dp_if_required'] = function (value)
    if value % 60 ~= 0 then
        return value / 60
    else
        return math.round(value / 60, 2)
    end
end

poe.stat.quantifier['divide_by_ten_0dp'] = function (value)
    return math.round(value / 10, 0)
end

poe.stat.quantifier['divide_by_two_0dp'] = function (value)
    return math.round(value / 2, 0)
end

poe.stat.quantifier['divide_by_fifteen_0dp'] = function (value)
    return math.round(value / 15, 0)
end

poe.stat.quantifier['divide_by_twenty_then_double_0dp'] = function (value)
    return math.round(value / 20, 0) * 2
end

poe.stat.quantifier['times_twenty'] = function (value)
    return value * 20
end


-- ----------------------------------------------------------------------------
-- End
-- ----------------------------------------------------------------------------

return poe