| 
 
    
local ids={3988,3987,3986,3985,
           3992,3991,3990,3989,           
           3996,3995,3994,3993,
           4000,3999,3998,3979,
           }
local id0={4000,3996,3992,3988,3999,3995,391,3987,3998,3994,3990,3986,3979,3993,3989,3985, }        
local ids2={3979,3980,3997}
local mid={10948,10946,10947}
local w,h=4,4
local nlc,nl=16,0
local x0,y0,z0=0,7,0
local cs={}
local i,j,k=0,0,0
local uid=0
local function check()
	local r,id=0,0
	for i=1,#id0 do
		r,id=Block:getBlockID(x0,y0+(i-1)%w,z0-math.floor((i-1)/w))
		if id~=id0[i] then
			Player:playMusic(uid,mid[2],100,1,false)
			return
		end
	end
	Player:playMusic(uid,mid[3],100,1,false)
end
Go=function(e)
	local x,y,z=math.floor(e['x']),math.floor(e['y']),math.floor(e['z'])
	local id=e['blockid']
	uid=e['eventobjid']
	local r2,item=Player:getCurToolID(uid)
	local dl=(z0-z)*w+(y-y0)+1
	local dn=math.abs(dl-nl)
	if id==ids2[2] then
		cs={}
		nl=13
		math.randomseed(os.time())
		local r,m=0,0
		for i=1,#ids-1 do
			r=math.random(1,#ids-i)
			m=0
			while r>0 do
				m=m+1
				if cs[m]==nil then
					r=r-1
				end
			end
			cs[m]=ids[i]
			Block:setBlockAll(x0,y0+(m-1)%w,z0-math.floor((m-1)/w),ids[i],2)
		end
		Block:setBlockAll(x0,y0,z0-3,ids2[1],0)
		Chat:sendSystemMsg("已重新生成")
		Player:playMusic(uid,mid[1],100,1,false)
	elseif (y>=y0)and(y<y0+w)and(x==x0)and(z<=z0)and(z>z0-h)and((dn==1)or(dn==w)) then
		Block:setBlockAll(x0,y0+(nl-1)%w,z0-math.floor((nl-1)/w),id,2)
		Block:setBlockAll(x0,y0+(dl-1)%w,z0-math.floor((dl-1)/w),ids2[1],2)
		nl=dl
		check()
	end
end
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=],Go)
 
                
                
                
        
    
 
 |