Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function create_demstone(level, name, mana, with_gems)
- local demgem = DemonGemStone.new()
- demgem:set_id(current_user:get_new_gem_id())
- demgem:set_type(level)
- if (name) then
- local demon = Demon.new()
- demon:set_id(current_user:get_new_demon_id())
- demon:set_name(name)
- demon:set_mana(mana)
- local lvl = mana >= 466560 and 7 or (mana >= 77760 and 6 or (mana >= 12960 and 5 or (mana >= 2160 and 4 or (mana >= 360 and 3 or (mana >= 60 and 2 or 1)))))
- demon:set_level(lvl)
- demgem:set_demon(demon)
- if (with_gems) then
- local demgems = demon:get_gemstones()
- demgems:add(create_gemstone(0, 1, math.random(0, 30000), 0))
- demgems:add(create_gemstone(1, 1, math.random(0, 30000), 0))
- demgems:add(create_gemstone(2, 1, math.random(0, 30000), 0))
- demgems:add(create_gemstone(3, 1, math.random(0, 30000), 0))
- end
- end
- return demgem
- end
- dem_stones:add(create_demstone(1))
- dem_stones:add(create_demstone(2, "Pafnutiy", 20))
- local dem_gemstone3 = create_demstone(3, "Borstch", 100, true)
- dem_stones:add(dem_gemstone3)
- ===============================
- <demon_gemstones> +
- <gemstone id="12" type="1"> +
- <demon id="198695" name="" level="3112" mana="189012314686"> +
- <gemstones /> +
- </demon> +
- </gemstone> +
- <gemstone id="13" type="2"> +
- <demon id="0" name="Pafnutiy" level="1" mana="20"> +
- <gemstones /> +
- </demon> +
- </gemstone> +
- <gemstone id="14" type="3"> +
- <demon id="1" name="Borstch" level="2" mana="100"> +
- <gemstones /> +
- </demon> +
- </gemstone> +
- </demon_gemstones>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement