Jump to content
Denis

Rainbow Quest

Recommended Posts

I know it isn't anything special but maybe someone find it usefull :)

 

quest denic begin
	state start begin
		function numtomoney(num)
			local num,out,x = tostring(num),'',0
			while string.len(num)-3 > 0 do
				out = string.gsub(num,'.-(%d%d%d)$','.%1')..out
				num = string.sub(num,0,string.len(num)-3)
			end
			return num..out
		end	
		when 50512.use begin
			local data = {
				["Skills"]={
					[0] = {
						[1] = {1,2,3,4,5},
						[2] = {16,17,18,19,20},
					},
					[1] = {
						[3] = {31,32,33,34,35},
						[4] = {46,47,48,49,50},
					},
					[2] = {
						[5] = {76,77,78,79,80,81},
						[6] = {61,62,63,64,65,66},
					},
					[3] = {
						[7] = {106,107,108,109,110,111},
						[8] = {91,92,93,94,95,96},
					},
				},
			}
			local s = data["Skills"][pc.get_job()][pc.get_skill_group()]
			local choise = {
				[1] = {"Master",20,table.getn(s*10000000)}, --[[Calculates skill price for each skill.Example 5 skills * 10000000]]
				[2] = {"Grand Master",30,table.getn(s*20000000)},
				[3] = {"Perfect Master",40,table.getn(s*50000000)},
			}
			local y = {}
			for i = 1, table.getn(choise), 1 do --[[I know it's ugly but I didn't know how to do it by other way ^^]]
				y[i] = choise[i][1] 
			end
			table.insert(y,"Close")	
			say_title("Rainbow Stone:")
			for i = 1, table.getn(choise), 1 do
				say("To upgrade all skills to "..choise[i][1].." you need to have "..denic.numtomoney(choise[i][3]).." Yang.")
			end
			local epilogh = select_table(y)
			if epilogh >= table.getn(y) then
				return
			else
				local gold = pc.get_gold()
				if gold >= choise[epilogh][3] then			
					for i = 1,table.getn(s),1 do
						pc.set_skill_level(s[i],choise[epilogh][2])
						pc.changegold(-choise[epilogh][3] / table.getn(s))
					end
					pc.remove_item(50512,1)
				else
					say("You don't have enough Yang!")
				end				
			end	
		end
	end
end

 

Regards,

Denic

  • Love 6

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.