say ( gameforge . pre_event_heavens_cave . _20_say ) 
say ( gameforge . pre_event_heavens_cave . _30_say ) 
if pc . get_map_index ( ) == 3 then 
say ( gameforge . pre_event_heavens_cave . _40_say ) 
elseif pc . get_map_index ( ) == 23 then 
say ( gameforge . pre_event_heavens_cave . _50_say ) 
elseif pc . get_map_index ( ) == 43 then 
say ( gameforge . pre_event_heavens_cave . _60_say ) 
end 
wait ( ) 
say ( gameforge . pre_event_heavens_cave . _70_say ) 
say ( gameforge . pre_event_heavens_cave . _80_say ) 
say_item_vnum ( 30178 ) 
local maxlevel = pc . get_level ( ) 
local glyphcount = 0 
glyphcount = pc . count_item ( 30178 ) 
if glyphcount > 0 then 
local giveglyphstone = select ( gameforge . pre_event_heavens_cave . _90_1_select , gameforge . pre_event_heavens_cave . _90_2_select ) 
if giveglyphstone == 1 then 
say_pc_name ( ) 
say ( gameforge . pre_event_heavens_cave . _100_say ) 
local pickpotion = 0 
if pc . get_level ( ) < 24 and pc . get_level ( ) >= 20 then 
pickpotion = math . random ( 0 , 8 ) 
elseif pc . get_level ( ) < 20 then 
pickpotion = math . random ( 0 , 4 ) 
else 
pickpotion = math . random ( 0 , 9 ) 
end 
local potion1 = 0 
local potion2 = 0 
local potion3 = 0 
if pickpotion <= 4 then 
potion1 = pre_event_heavens_cave . getherbs ( maxlevel ) 
potion2 = pre_event_heavens_cave . getpotion ( maxlevel ) 
potion3 = pre_event_heavens_cave . getsushi ( ) 
elseif pickpotion == 5 or pickpotion == 6 then 
potion1 = pre_event_heavens_cave . getherbs ( maxlevel ) 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
while potion2 == potion1 begin 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
end 
potion3 = pre_event_heavens_cave . getpotion ( maxlevel ) 
elseif pickpotion == 7 or pickpotion == 8 then 
potion1 = pre_event_heavens_cave . getherbs ( maxlevel ) 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
while potion2 == potion1 begin 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
end 
potion3 = pre_event_heavens_cave . getsushi ( ) 
else 
potion1 = pre_event_heavens_cave . getherbs ( maxlevel ) 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
while potion2 == potion1 begin 
potion2 = pre_event_heavens_cave . getherbs ( maxlevel ) 
end 
potion3 = pre_event_heavens_cave . getherbs ( maxlevel ) 
while potion3 == potion1 or potion3 == potion2 begin 
potion3 = pre_event_heavens_cave . getherbs ( maxlevel ) 
end 
end 
local potion1amount = pc . count_item ( 30178 ) * 7 
local potion2amount = 0 
local potion3amount = 0 
if potion2 < 27200 then 
potion2amount = pc . count_item ( 30178 ) * 3 
else 
potion2amount = pc . count_item ( 30178 ) * 5 
end 
if potion3 < 27200 then 
potion3amount = pc . count_item ( 30178 ) * 2 
elseif potion3 > 50800 then 
potion3amount = pc . count_item ( 30178 ) * 6 
else 
potion3amount = pc . count_item ( 30178 ) * 3 
end 
wait ( ) 
say ( gameforge . pre_event_heavens_cave . _20_say ) 
say ( gameforge . pre_event_heavens_cave . _110_say ) 
say ( string . format ( "%dx" , potion1amount ) ) 
say_item_vnum ( potion1 ) 
say ( string . format ( "%dx" , potion2amount ) ) 
say_item_vnum ( potion2 ) 
wait ( ) 
say ( string . format ( gameforge . pre_event_heavens_cave . _120_say , potion3amount ) ) 
say_item_vnum ( potion3 ) 
local choosereward = 
select ( 
string . format ( "%d %s" , potion1amount , item_name ( potion1 ) ) , 
string . format ( "%d %s" , potion2amount , item_name ( potion2 ) ) , 
string . format ( "%d %s" , potion3amount , item_name ( potion3 ) ) , 
gameforge . pre_event_heavens_cave . _130_4_select ) 
if choosereward < 4 then 
local glyphstones = pc . count_item ( 30178 ) 
pc . remove_item ( 30178 , glyphstones ) 
local glyphcount = game . get_event_flag ( "glyphstones_collected" ) 
glyphcount = glyphcount + glyphstones 
game . set_event_flag ( "glyphstones_collected" , glyphcount ) 
if choosereward == 1 then pc . give_item2 ( potion1 , potion1amount ) 
elseif choosereward == 2 then pc . give_item2 ( potion2 , potion2amount ) 
elseif choosereward == 3 then pc . give_item2 ( potion3 , potion3amount ) 
end 
say ( gameforge . pre_event_heavens_cave . _20_say ) 
say ( string . format ( gameforge . pre_event_heavens_cave . _140_say , glyphcount ) ) 
say_pc_name ( ) 
local eventstory = select ( gameforge . pre_event_heavens_cave . _150_1_select , gameforge . pre_event_heavens_cave . _150_2_select ) 
if eventstory == 1 then 
say ( gameforge . pre_event_heavens_cave . _20_say ) 
say ( gameforge . pre_event_heavens_cave . _160_say ) 
say ( gameforge . pre_event_heavens_cave . _170_say ) 
say ( gameforge . pre_event_heavens_cave . _180_say ) 
say ( gameforge . pre_event_heavens_cave . _190_say ) 
say ( gameforge . pre_event_heavens_cave . _200_say ) 
wait ( ) 
if pc . getqf ( "goldstatus" ) == 0 then 
say ( string . format ( gameforge . pre_event_heavens_cave . _210_say , item_name ( 30180 ) ) ) 
say_item_vnum ( 30180 ) 
pc . setqf ( "goldstatus" , 2 ) 
say ( string . format ( gameforge . pre_event_heavens_cave . _220_say , mob_name ( 20009 ) , mob_name ( 9012 ) ) ) 
wait ( ) 
say ( gameforge . pre_event_heavens_cave . _230_say ) 
else 
say ( gameforge . pre_event_heavens_cave . _240_say ) 
end 
say_item_vnum ( 50626 ) 
say_item_vnum ( 80008 ) 
wait ( ) 
say ( "" ) 
say_item_vnum ( 80005 ) 
say_item_vnum ( 80006 ) 
say_item_vnum ( 80007 ) 
end 
else 
say ( gameforge . pre_event_heavens_cave . _250_say ) 
end 
else 
end 
end 
