Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function execCommand(ctx, args, cursor)
- local rarity = MonsterRarity:new(0)
- if #args < 1 then
- return 0
- end
- local i = 1
- while i<#args do
- local arg = args[i]
- if string.sub(arg, 1, 1) == '-'
- then
- cmd = string.sub(arg, 2)
- print("cmd:",cmd)
- if cmd == "s" or cmd == "shiny" then
- table.remove(args, i)
- local r = args[i]
- if r == "uncommon" then
- rarity = MonsterRarity:new(0, MonsterRarityColor.Uncomon)
- elseif r == "rare" then
- rarity = MonsterRarity:new(0, MonsterRarityColor.Rare)
- elseif r == "divine" then
- rarity = MonsterRarity:new(0, MonsterRarityColor.Divine)
- elseif r == "legendary" then
- rarity = MonsterRarity:new(0, MonsterRarityColor.Legendary)
- end
- elseif cmd == "r" or cmd == "rarity" then
- table.remove(args, i)
- local r = tonumber(args[i])
- rarity = MonsterRarity:new(r)
- end
- table.remove(args, i)
- else
- i = i+1
- end
- end
- if #args < 1 then
- return 0
- end
- local level = 1
- local entry = pcEntryIdFromString(args[1])
- if #args >= 2 then
- level = tonumber(args[2])
- if level > 50000 then
- level = 50000
- end
- end
- local count = 1
- if #args >= 3 then
- count = tonumber(args[3])
- end
- local dx = 0
- if #args >= 4 then
- dx = tonumber(args[4])
- end
- local spawn_attr = MonsterSpawnAttributes:new(entry.ind)
- spawn_attr:setRarity(rarity)
- spawn_attr:setLevel(level)
- local spawn_params = MonsterSpawnParam:new()
- for i=0, count do
- pcCreateMonster(ctx, spawn_attr, cursor, spawn_params)
- cursor.x = cursor.x + dx
- end
- return 0
- end
Advertisement
Add Comment
Please, Sign In to add comment