diff options
-rw-r--r-- | npc/001-2-28/plush.txt | 20 | ||||
-rw-r--r-- | npc/functions/main.txt | 23 |
2 files changed, 24 insertions, 19 deletions
diff --git a/npc/001-2-28/plush.txt b/npc/001-2-28/plush.txt index 77161d0a..f9d0960f 100644 --- a/npc/001-2-28/plush.txt +++ b/npc/001-2-28/plush.txt @@ -39,26 +39,8 @@ } } - // A somehow of BaseLevel * logn (BaseLevel * 100). - function calculate_inn_tax { - .@price = 0; - .@pc_level = BaseLevel * 100; - while (.@pc_level >>= 1) - { - ++.@price; - } - .@price *= BaseLevel; - - if (.@price <= 10) - { - .@price = 10; - } - - return .@price; - } - function register_room { - .@price = calculate_inn_tax; + .@price = lognbaselvl(100, 10); speech 5, l("That will be @@ E to set your respawn point", .@price), diff --git a/npc/functions/main.txt b/npc/functions/main.txt index 12484f11..b71fb339 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -220,3 +220,26 @@ function script npctalkonce { return true; } + +// A somehow of BaseLevel * logn (BaseLevel * alpha). +// alpha = multiplicator factor. +// min = minimum result value. +function script lognbaselvl { + .@alpha = getarg(0, 1); + .@min = getarg(1, 1); + .@ret = 0; + .@pc_level = BaseLevel * .@alpha; + + while (.@pc_level >>= 1) + { + ++.@ret; + } + .@ret *= BaseLevel; + + if (.@ret <= .@min) + { + .@ret = .@min; + } + + return .@ret; +} |