*comment put *reset_stones somewhere *temp rarity_chance 0 *temp total_stones 0 *temp newstone_weight_1 0 *temp newstone_rarity_1 0 *temp newstone_weight_2 0 *temp newstone_rarity_2 0 *temp newstone_weight_3 0 *temp newstone_rarity_3 0 *temp newstone_weight_4 0 *temp newstone_rarity_4 0 *temp newstone_weight_5 0 *temp newstone_rarity_5 0 *temp newstone_weight_6 0 *temp newstone_rarity_6 0 *temp newstone_weight_7 0 *temp newstone_rarity_7 0 *temp newstone_weight_8 0 *temp newstone_rarity_8 0 *temp newstone_weight_9 0 *temp newstone_rarity_9 0 *temp newstone_weight_10 0 *temp newstone_rarity_10 0 *temp newstone_weight_11 0 *temp newstone_rarity_11 0 *temp newstone_weight_12 0 *temp newstone_rarity_12 0 *temp newstone_weight_13 0 *temp newstone_rarity_13 0 *temp newstone_weight_14 0 *temp newstone_rarity_14 0 *temp newstone_weight_15 0 *temp newstone_rarity_15 0 *temp newstone_weight_0 0 *temp newstone_rarity_0 0 *temp stone_names_1 "Enormous|Large|Big|Small|Tiny|Medium-Sized|" *temp stone_names_2 "Black|White|Orange|Red|Yellow|Green|Blue|Purple|" *temp stone_names_3 "Mineral-Rich|Ancient|Jagged|Solid|Igneous|Stratified|Sonorous|" *temp stone_names_4 "Rock|Stone|Pebble|Jade|" *gosub_scene cslib_string find history "visited_second_level|" *if cslib_ret = 0 *set history &"visited_second_level|" Second Level of the Sect is much, much more bustling with activity than the first one. If the previous level is meant for disciples to train and sharpen their skills, therefore not providing much in terms of entertainment and distraction, this is a place for already established Martial Artists, for Enforcers, Envoys and Creationists, people who have who both time and money to spend on their own amusement. Countless shops, pavilions, restaurants and other things are open here throughout the day. *gosub_scene cslib_string find history "jingguo_visited_restaurant|" *if cslib_ret > 0 The Propriety Legion would surely have a fit if they saw this place: too bad that measly Houtian-disciples have no power to close even a single establishment of this level without provoking a Xiantian. *goto where_to *else Countless shops, pavilions, restaurants and other things are open here throughout the day. *label where_to Where do you want to go? *choice *selectable_if (not_under_construction) #Alchemy Pavilion *goto_scene free_roam #Talisman Pavilion *goto_scene fr_talisman_pavilion *selectable_if (not_under_construction) #Smithing Pavilion *goto_scene free_roam #Stone Gambling. *gosub_scene cslib_string find history "visited_stone_gambling|" *if cslib_ret = 0 *set history &"visited_stone_gambling|" Stone Gambling is an ancient tradition, existing even from before the coming of the First Emperor. Only now, with the addition of resources from the Danger Zones, the scale of this activity has grown even bigger. The whole concept of stone gambling is simple: since many jadeite stones are so weathered and it's impossible to judge what mineral lies underneath, the stone sellers have come up with a genius idea to avoid losses — trade everything. The buyer purchases raw stones and then cuts them open, hoping for precious gems to be inside. If they are, the buyer makes a profit, oftentimes an enormous one — and if they aren't, then the buyer has acquired a useless rock for a very costly price. You step into 'Stone&Treasures Den', the largest Stone Gambling shop in the sect. Besides you, dozens, if not hundreds, of people stroll around the shop, inspecting various stones. A attendant girl runs up you. "Welcome, welcome!" — she cheerily greets — "I haven't seen this ${polite_address} before, I assume it's your first time?" You nod. "Alrighty, then let me explain the rules to you really quickly." — the clerk gestures to the countless rocks inside the shop — "Everything you see on display, you can buy." "There are three categories of stones, [i]Cheap[/i], [i]Average[/i], [i]Expensive[/i]. The higher the category, the higher we feel is the chance for the stone to contain something precious. Of course, it's not a guarantee, and a cheap rock may produce a priceless gem, while an expensive one may turn out a waste." "After you have bought a stone, you must cut it open. In order to maintain a bigger interest in our business, we ask all customers to do so publicly." — she points to a few stone-cutting machines — "You can use those devices free of charge." "After you cut it open, if the stone is not completely useless, you can sell it to us. The price will depend on its weight and rarity." "That's all. If you have any questions, please find me. May the Heavens smile upon you!" The clerk leaves you alone, free to explore the shop. *else Once again, you enter the 'Stone&Treasures Den', hoping to strike it rich by picking up some valuable stones. *label stone_choices *choice #Cheap stones. *label cheap_stones *temp n 1 *label cheap_creation_loop *if newstone_name[n] != "sold" *gosub create_stone n "cheap" *if (n < 5) *set n+1 *goto cheap_creation_loop You are browsing [b]cheap[/b] Stones: *gosub_scene cslib_menu build_array_filter "newstone_name" "" true "conditions" "stone_gambling_cheap" *if cslib_ret = 0 *goto stone_choices *label cheap_stone_buy [b]Stone Name:[/b] [i]${newstone_name[cslib_ret]}[/i]. *line_break [b]Stone Category:[/b] [i]Cheap[/i]. *line_break [b]Stone Weight:[/b] [i]${newstone_weight[cslib_ret]}[/i] lbs. *line_break *temp newstone_cost round((newstone_weight[cslib_ret]*1.5)-0.5) [b]Stone Cost:[/b] [i]${newstone_cost} Gold. Would you like to buy this stone? *choice *selectable_if (mc_gold >= newstone_cost) #Yes. *set bought_stones &"${cslib_ret}|" *set mc_gold -newstone_cost *set total_stones +1 [b]Congratulations. You have bought [i]${newstone_name[cslib_ret]}[/i].[/b] Do you want to buy more stones or cut open the ones you have? *goto stone_choices #No. *goto cheap_stones *selectable_if (mc_trait_4) #Use Precognition. *gosub_scene subroutines add_exhaustion_return 50 "game_over" false *if (not (stat_check)) You suddenly feel light-headed, the world around you starts to spin and, unable to stand straight, you fall down, losing consciousness — the last thing you hear is the excited steps of the disciples nearby, swarming you in their attempts to catch a glimpse at what has happened. *page_break Wake Up... You wake up in the infirmary, with a terrible headache — and one of the healers charging you 20 Points for your stay. *set mc_sect_points -20 *goto_scene fr_infirmary from_another_scene *else Using your powers to glimpse into the future, you figure out that this stone is [b] *if newstone_rarity[cslib_ret] = 1 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 2 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 3 somewhat valuable[/b]. *elseif newstone_rarity[cslib_ret] = 4 valuable[/b]. *elseif newstone_rarity[cslib_ret] = 5 quite valuable[/b]. *elseif newstone_rarity[cslib_ret] = 6 precious[/b]. *elseif newstone_rarity[cslib_ret] = 7 very precious[/b]. *elseif newstone_rarity[cslib_ret] = 8 extremely precious[/b]. *elseif newstone_rarity[cslib_ret] = 9 immensely rare[/b]. *elseif newstone_rarity[cslib_ret] = 10 inestimable rare[/b]. *page_break Amazing... *goto cheap_stone_buy #Go back. *goto stone_choices #Average stones. *label average_stones *temp n 6 *label average_creation_loop *if newstone_name[n] != "sold" *gosub create_stone n "cheap" *if (n < 10) *set n+1 *goto average_creation_loop You are browsing [b]average[/b] Stones: *gosub_scene cslib_menu build_array_filter "newstone_name" "" true "conditions" "stone_gambling_average" *if cslib_ret = 0 *goto stone_choices *label average_stone_buy [b]Stone Name:[/b] [i]${newstone_name[cslib_ret]}[/i]. *line_break [b]Stone Category:[/b] [i]Average[/i]. *line_break [b]Stone Weight:[/b] [i]${newstone_weight[cslib_ret]}[/i] lbs. *line_break *temp newstone_cost round((newstone_weight[cslib_ret]*2)-0.5) [b]Stone Cost:[/b] [i]${newstone_cost} Gold. Would you like to buy this stone? *choice *selectable_if (mc_gold >= newstone_cost) #Yes. *set bought_stones &"${cslib_ret}|" *set mc_gold -newstone_cost *set total_stones +1 [b]Congratulations. You have bought [i]${newstone_name[cslib_ret]}[/i].[/b] Do you want to buy more stones or cut open the ones you have? *goto stone_choices #No. *goto average_stones *selectable_if (mc_trait_4) #Use Precognition. *gosub_scene subroutines add_exhaustion_return 50 "game_over" false *if (not (stat_check)) You are too exhausted to use [i]Precognition[/i]. Rest and come back again. *page_break Alright... *goto average_stone_buy *else Using your powers to glimpse into the future, you figure out that this stone is [b] *if newstone_rarity[cslib_ret] = 1 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 2 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 3 somewhat valuable[/b]. *elseif newstone_rarity[cslib_ret] = 4 valuable[/b]. *elseif newstone_rarity[cslib_ret] = 5 quite valuable[/b]. *elseif newstone_rarity[cslib_ret] = 6 precious[/b]. *elseif newstone_rarity[cslib_ret] = 7 very precious[/b]. *elseif newstone_rarity[cslib_ret] = 8 extremely precious[/b]. *elseif newstone_rarity[cslib_ret] = 9 immensely rare[/b]. *elseif newstone_rarity[cslib_ret] = 10 inestimable rare[/b]. *page_break Amazing... *goto average_stone_buy #Go back. *goto stone_choices #Expensive stones. *label expensive_stones *temp n 11 *label expensive_creation_loop *if newstone_name[n] != "sold" *gosub create_stone n "cheap" *if (n < 15) *set n+1 *goto expensive_creation_loop You are browsing [b]expensive[/b] Stones: *gosub_scene cslib_menu build_array_filter "newstone_name" "" true "conditions" "stone_gambling_expensive" *if cslib_ret = 0 *goto stone_choices *label expensive_stone_buy [b]Stone Name:[/b] [i]${newstone_name[cslib_ret]}[/i]. *line_break [b]Stone Category:[/b] [i]Expensive[/i]. *line_break [b]Stone Weight:[/b] [i]${newstone_weight[cslib_ret]}[/i] lbs. *line_break *temp newstone_cost round((newstone_weight[cslib_ret]*3)-0.5) [b]Stone Cost:[/b] [i]${newstone_cost} Gold. Would you like to buy this stone? *choice *selectable_if (mc_gold >= newstone_cost) #Yes. *set bought_stones &"${cslib_ret}|" *set mc_gold -newstone_cost *set total_stones +1 [b]Congratulations. You have bought [i]${newstone_name[cslib_ret]}[/i].[/b] Do you want to buy more stones or cut open the ones you have? *goto stone_choices #No. *goto expensive_stones *selectable_if (mc_trait_4) #Use Precognition. *gosub_scene subroutines add_exhaustion_return 50 "game_over" false *if (not (stat_check)) You are too exhausted to use [i]Precognition[/i]. Rest and come back again. *page_break Alright... *goto expensive_stone_buy *else Using your powers to glimpse into the future, you figure out that this stone is [b] *if newstone_rarity[cslib_ret] = 1 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 2 worthless[/b]. *elseif newstone_rarity[cslib_ret] = 3 somewhat valuable[/b]. *elseif newstone_rarity[cslib_ret] = 4 valuable[/b]. *elseif newstone_rarity[cslib_ret] = 5 quite valuable[/b]. *elseif newstone_rarity[cslib_ret] = 6 precious[/b]. *elseif newstone_rarity[cslib_ret] = 7 very precious[/b]. *elseif newstone_rarity[cslib_ret] = 8 extremely precious[/b]. *elseif newstone_rarity[cslib_ret] = 9 immensely rare[/b]. *elseif newstone_rarity[cslib_ret] = 10 inestimable rare[/b]. *page_break Amazing... *goto expensive_stone_buy #Go back. *goto stone_choices *if (total_stones > 0) #Appraise the stones you've bought. *temp cost_mod 0 *temp rock_cost 0 *label current_stones *set cost_mod 0 *set rock_cost 0 Currently you have the following stones: *temp s 1 *label show_bought_stones *if (newstone_name[s] != "sold") and (newstone_name[s] != "none") *gosub_scene cslib_string find bought_stones "|${s}|" *if cslib_ret > 0 [i]${newstone_name[s]}[/i] *if s < newstone_name_max *line_break *if s < newstone_name_max *set s+1 *goto show_bought_stones Which stone do you want to cut open? *gosub_scene cslib_menu build_array_filter "newstone_name" "" true "conditions" "stone_gambling_all" *if cslib_ret = 0 *goto stone_choices *set total_stones -1 *temp stone cslib_ret *set newstone_name[stone] "sold" You bring the stone to a cutting machine and, with slow and measured cuts, begin to carve out the gem inside… The jade you've purchased turns out to be [b] *if newstone_rarity[stone] = 1 worthless[/b]. Unable to sell it, you can only throw it away as a piece of trash. *page_break Damn it! *goto current_stones *elseif newstone_rarity[stone] = 2 worthless[/b]. Unable to sell it, you can only throw it away as a piece of trash. *page_break Damn it! *goto current_stones *elseif newstone_rarity[stone] = 3 somewhat valuable[/b]. *set cost_mod 1 *elseif newstone_rarity[stone] = 4 valuable[/b]. *set cost_mod 1.2 *elseif newstone_rarity[stone] = 5 quite valuable[/b]. *set cost_mod 1.5 *elseif newstone_rarity[stone] = 6 precious[/b]. *set cost_mod 2 *elseif newstone_rarity[stone] = 7 very precious[/b]. *set cost_mod 3 *elseif newstone_rarity[stone] = 8 extremely precious[/b]. *set cost_mod 5 *elseif newstone_rarity[stone] = 9 immensely rare[/b]. *set cost_mod 7 *elseif newstone_rarity[stone] = 10 inestimable rare[/b]. *set cost_mod 10 You successfully sell it for *set rock_cost round((newstone_weight[stone]*cost_mod)-0.5) [b]${rock_cost}[/b] Gold. *set mc_gold +rock_cost *page_break Yay! *goto current_stones #Leave. *goto where_to #Return to First Level. *goto_scene free_roam *label create_stone *params id category *if newstone_name[id] != "none" *return *set rarity_chance 0 *temp rand_name 0 *temp rand_weight 0 *gosub_scene cslib_string extract_tokens stone_names_1 "|" "fight_option" *rand rand_name 1 fight_option_count *set newstone_name[id] "${fight_option[rand_name]}" *if (fight_option[rand_name] = "Enormous") *rand newstone_weight[id] 700 1000 *elseif (fight_option[rand_name] = "Large") *rand newstone_weight[id] 500 699 *elseif (fight_option[rand_name] = "Big") *rand newstone_weight[id] 250 399 *elseif (fight_option[rand_name] = "Medium-Sized") *rand newstone_weight[id] 100 249 *elseif (fight_option[rand_name] = "Small") *rand newstone_weight[id] 50 99 *elseif (fight_option[rand_name] = "Tiny") *rand newstone_weight[id] 1 49 *gosub_scene cslib_string extract_tokens stone_names_2 "|" "fight_option" *rand rand_name 1 fight_option_count *set newstone_name[id] &" ${fight_option[rand_name]}" *gosub_scene cslib_string extract_tokens stone_names_3 "|" "fight_option" *rand rand_name 1 fight_option_count *set newstone_name[id] &" ${fight_option[rand_name]}" *if (fight_option[rand_name] = "Mineral-Rich") *set rarity_chance +5 *elseif (fight_option[rand_name] = "Ancient") *set rarity_chance -3 *elseif (fight_option[rand_name] = "Jagged") *set rarity_chance -2 *elseif (fight_option[rand_name] = "Solid") *set rarity_chance -1 *elseif (fight_option[rand_name] = "Igneous") *set rarity_chance +1 *elseif (fight_option[rand_name] = "Stratified") *set rarity_chance +2 *elseif (fight_option[rand_name] = "Sonorous") *set rarity_chance +3 *if (mc_trait_9) *set rarity_chance +5 *gosub_scene cslib_string extract_tokens stone_names_4 "|" "fight_option" *rand rand_name 1 fight_option_count *set newstone_name[id] &" ${fight_option[rand_name]}" *if category = "expensive" *set rarity_chance +2 *elseif category = "cheap" *set rarity_chance -2 *rand newstone_rarity[id] 1 10 *set newstone_rarity[id] +rarity_chance *if newstone_rarity[id] < 1 *set newstone_rarity[id] 1 *elseif newstone_rarity[id] > 10 *set newstone_rarity[id] 10 *set fight_option_count fight_option_max *return