Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to combine pieces required to get a specific level piece.
- talisman.make = function (piecename, level)
- -- note this can fail currently because we cant control the talisman combine type so it cant combine promo with refined, etc.
- local makinglevel = 1
- local numberToCombine = 2^(level-1)
- while makinglevel < level do
- for i = 1, numberToCombine/2 do
- send(string.format("talisman combine %s %s", piecename, makinglevel),false)
- end
- makinglevel = makinglevel+1
- numberToCombine = numberToCombine/2
- end
- return true
- end
- -- Logic to complete talismans.
- talisman.complete = function (talismanname)
- if not talisman.cancomplete(talismanname) then
- talisman.echo(string.format("Cannot complete talisman %s, pieces missing.", talismanname))
- return
- end
- for k,d in pairs(talisman.info[talismanname]) do
- local required = (math.log(d.required)/math.log(2))+1
- if math.floor(required)==required then
- talisman.make(k, required)
- talisman.remove(k,1,d.required)
- --still have to remove as singles because we keep all pieces as singles
- else
- -- if required is 3, we cant combine this, so use 3 singles (mudbomb for example)..
- talisman.remove(k, 1, d.required)
- end
- end
- send(string.format("Talisman complete %s", talismanname))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement