Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CHOICE_TABLE = {
- -- TYPES:
- -- 1: Spell
- -- 2: Item
- -- Each set of values must contain at least 3 unique values
- -- level = { number of types, type1, set of values for type1, ... }
- [2] = {2, 1, {5, 11, 1908}, 2, {50055, 23368, 26029}},
- [3] = {2, 1, {5, 11, 1908}, 2, {50055, 23368, 26029}},
- [4] = {2, 1, {5, 11, 1908}, 2, {50055, 23368, 26029}},
- [5] = {2, 1, {5, 11, 1908}, 2, {50055, 23368, 26029}},
- [6] = {2, 1, {5, 11, 1908}, 2, {50055, 23368, 26029}}
- }
- local function PLAYER_EVENT_ON_LEVEL_CHANGE(event, player, oldLevel)
- local t = CHOICE_TABLE[oldLevel + 1]
- if not t then
- return
- end
- local numTypes = t[1];
- local results = {}
- for i=1,3 do
- local _type = math.random(1, t[2])
- local values = t[(_type * 2) + 1]
- while #results ~= i do
- local val = math.random(1, #values)
- results[val] = {_type, val}
- end
- end
- local message = "LEVELUP-" .. string.format("%02d", oldLevel + 1)
- for i=1,3 do
- message = message .. "-" .. string.format("%01d", results[i][1])
- message = message .. "-" .. string.format("%06d", results[i][2])
- end
- sendAddonMessage(player, message, 1)
- end
- RegisterPlayerEvent(13, PLAYER_EVENT_ON_LEVEL_CHANGE)
Advertisement
Add Comment
Please, Sign In to add comment