Last active
February 21, 2020 23:00
-
-
Save blakepell/e825f2f854029b27d9ca81e01633aa4b to your computer and use it in GitHub Desktop.
Avalon Mud Client (Lua): Alias to show PKP until next level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AliasList": [ | |
{ | |
"AliasExpression": "tnl", | |
"Command": "local levels = {0, 10, 20, 45, 60, 80, 100, 125, 150, 175, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 775, 850, 925, 1000, 1075, 1150, 1225, 1300, 1375, 1450, 1550, 1650, 1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2600, 2750, 2900, 3050, 3200, 3350, 3500, 3650, 3800, 3950, 4150, 4350, 4550, 4750, 4950, 5150, 5350, 5550, 5750, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000}\r\rlocal pkp = lua:GetVariable(\"PKP\")\rlocal pkpLevel = lua:GetVariable(\"PKPLevel\")\rlocal pkpTnl = levels[pkpLevel + 2] - pkp\rlocal pkpLevelAmount = levels[pkpLevel + 2] - levels[pkpLevel + 1]\rlocal percentCompleted = ((pkpLevelAmount - pkpTnl) / pkpLevelAmount * 100)\r\rlua:Echo(\"--> \"..math.floor(pkpTnl)..\" PKP until next train. That is \".. percentCompleted ..\"% completed towards the next level.\")\rlua:Echo(\"\")\r", | |
"Enabled": true, | |
"Character": "", | |
"Group": "", | |
"IsLua": true, | |
"Count": 0 | |
} | |
], | |
"TriggerList": [ | |
{ | |
"Command": "", | |
"Pattern": "^PK Points: (?<PKP>\\w+)", | |
"Character": "", | |
"Group": "", | |
"IsSilent": false, | |
"IsLua": false, | |
"Plugin": false, | |
"VariableReplacement": false, | |
"Enabled": true, | |
"Gag": false, | |
"MoveTo": 0, | |
"HighlightLine": false, | |
"Count": 0, | |
"Identifier": "d13c7bc0-be3c-4734-945c-13f10b0d3722" | |
}, | |
{ | |
"Command": "", | |
"Pattern": "PK Level: (?<PKPLevel>\\w+)", | |
"Character": "", | |
"Group": "", | |
"IsSilent": false, | |
"IsLua": false, | |
"Plugin": false, | |
"VariableReplacement": false, | |
"Enabled": true, | |
"Gag": false, | |
"MoveTo": 0, | |
"HighlightLine": false, | |
"Count": 0, | |
"Identifier": "44537f21-14e7-49c4-ae3e-5783666f31ed" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Shows PKP till next level | |
-- Assumes a players PKP and PKPLevel have been scraped off of the score command. | |
-- This alias can be imported via the pkp.json gist below. | |
local levels = {0, 10, 20, 45, 60, 80, 100, 125, 150, 175, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 775, 850, 925, 1000, 1075, 1150, 1225, 1300, 1375, 1450, 1550, 1650, 1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2600, 2750, 2900, 3050, 3200, 3350, 3500, 3650, 3800, 3950, 4150, 4350, 4550, 4750, 4950, 5150, 5350, 5550, 5750, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000} | |
local pkp = lua:GetVariable("PKP") | |
local pkpLevel = lua:GetVariable("PKPLevel") | |
local pkpTnl = levels[pkpLevel + 2] - pkp | |
local pkpLevelAmount = levels[pkpLevel + 2] - levels[pkpLevel + 1] | |
local percentCompleted = ((pkpLevelAmount - pkpTnl) / pkpLevelAmount * 100) | |
lua:Echo("--> "..math.floor(pkpTnl).." PKP until next train. That is ".. percentCompleted .. "% completed towards the next level.") | |
lua:Echo("") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment