#####################################################################
#                COMPUTER CAPTAIN
#####################################################################

### OhWee Mod bot valuation difficulty adjustments ###

default value_multiplier = 1.0
default earnings_multiplier = 1.0     
default earnings_diff_factor = 1.0
default earnings_value_offset = 0

screen bot_value_earnings_diff:

    frame xycenter 0.5, 0.5 xysize 800, 800:
        padding (20,30)
        text "Bot Economy Difficulty Adjustments" xcenter 0.5 size 40 color "#0cf"
            
        hbox pos 400, 60 spacing 20:
        
            button xysize 150, 40 background Solid ("#06a") hover_background Solid ("#0ac")xcenter 0.5 yalign 1.0:
                action (SetVariable("value_multiplier", 1.0),SetVariable("earnings_multiplier", 1.0),SetVariable("earnings_diff_factor", 1.0),SetVariable("earnings_value_offset", 0) )
                text "Default" size 30 xalign 0.5
                
            button xysize 150, 40 background Solid ("#06a") hover_background Solid ("#0ac")xcenter 0.5 yalign 1.0:
                action (SetVariable("value_multiplier", 0.5),SetVariable("earnings_multiplier", 2.0),SetVariable("earnings_diff_factor", 0.5),SetVariable("earnings_value_offset", 2000) )
                text "Suggested" size 30 xalign 0.5
        
        vbox spacing 10 xycenter 0.5, 0.5 yoffset 20:
        
            text "Bot Value" xoffset -25
            bar id "arcade" value VariableValue("value_multiplier", min=0.1, max=1.0, step=.05, force_step=True):
                xsize 500
                ysize 30
                base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
                thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=False, xsize=12)
            text "{size=30}[value_multiplier:.2f]x{/size}   Base Value Multiplier\n" size 22
        
            text "Arcade Earnings -" xoffset -25
        
            bar id "arcade" value VariableValue("earnings_multiplier", min=.1, max=5.0, step=.05, force_step=True):
                xsize 500
                ysize 30
                base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
                thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=False, xsize=12)
            text "{size=30}[earnings_multiplier:.2f]x{/size}  Earnings Mulitplier{color=#5f5}\n   Adjusts nightly earnings for each bot{size=20}\n   (Note: Earnings are also multiplied by a 8-12x 'random roll'){/size}{/color}" size 22
            
            
            text "Arcade Baseline Bot Value Adjustments" size 30 xoffset -10
            bar id "arcade" value VariableValue("earnings_diff_factor", min=0.5, max=1.0, step=.01, force_step=True):
                xsize 500
                ysize 30
                base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
                thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=False, xsize=12)
            text "{size=30}[earnings_diff_factor:.2f]x{/size}  Exponent Base Value Adjustment\n{color=#5f5}   0.5 = Square Root of Base Value, 1.0 = No adjustment{/color}" size 22
        
            bar id "arcade" value VariableValue("earnings_value_offset", min=0, max=5000, step=100, force_step=True):
                xsize 500
                ysize 30
                base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
                thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=False, xsize=12)
            $ botvalue_offset = earnings_value_offset*10
            text "{size=30}+[botvalue_offset:,] Cr{/size}  Base Value Offset {size=20}{color=#5f5}(10x 'average' roll applied){/color}{/size}\n{color=#5f5}   Helps lower value bots\n   More effective when exponent value is lower{/color}" size 22
            
        button xysize 150, 40 background Solid ("#06a") hover_background Solid ("#0ac")xcenter 0.5 yalign 1.0:
            action Function(renpy.hide_screen, "bot_value_earnings_diff", layer="top")
            text "Accept" size 30 xalign 0.5
            
### End OhWee mod stuff
            
#####################################################################
#					SUB FUNCTIONS		
#####################################################################
screen investment_manager_scr(*args):

    #image "05_gui/mask 50.png"
    $ investData = args[0]

    frame xsize 350 ysize 64 pos 0,936  background Solid("#00000000") padding 0,0:
        image "05_gui/gui_menu_option.png" yalign 0.5
        button action Return(False)xpos 20
        textbutton "Exit (X)" yalign 0.5 action Return(False) xpos 20
        key "x" action Return(False)
        key "K_SPACE" action Return(False)


    #####################################################################
    #                LISTING
    #####################################################################
    text "INVESTMENT OPPORTUNITIES" size FSIZE_LARGE pos 960,100 xalign 0.5 outlines [ (absolute(5), "#0099cc", absolute(0), absolute(0)) ]

    vbox xpos 40 ypos 240 spacing 5:
        for i in investData:
            if GAME.mc.lvl >= i["level"]:
                frame xsize 1000 ysize 60 background  Solid("#00000088"):
                    text "{mu_b}{title}{mu_e}".format(mu_b=C_HI_B, mu_e=C_HI_E,title=i["title"].title())  size FSIZE yalign 0.5
                    text "{:,} Cr".format(i["cost"]) size FSIZE xpos 700 xalign 1.0 yalign 0.5
                    button action NullAction() tooltip i
                    if i["ID"] not in GAME.investments:
                        frame xsize 100 ysize 30 background Solid("#0099cc") xpos 800  yalign 0.5:
                            text "Invest" size FSIZE_MED xalign 0.5 yalign 0.5
                            button action Return(["invest", i]) tooltip i
                    else:
                        frame xsize 100 ysize 30 background Solid("#cc9900") xpos 800 yalign 0.5:
                            text "Divest" size FSIZE_MED xalign 0.5 yalign 0.5
                            button action Return(["divest", i]) tooltip i

                        
    $ tooltip = GetTooltip()
    if tooltip and tooltip in investData:
        frame xsize 760 ysize 400 pos 1080, 240 background  Solid("#00000000"):
            text "{company}\n\n{mu_b}Investor Benefit:{mu_e}{benefit}\n\nInvestment is retrievable.".format(
                company=tooltip["desc"], 
                benefit=tooltip["benefit"], 
                mu_b=C_HI_B, mu_e=C_HI_E, 
                mu1_b=C_GO_B, mu1_e= C_GO_E,) xpos 20 yalign 0 size FSIZE                               


label investment_manager():
    queue sound "audio/beep.wav"
    scene expression("11_backgrounds/backdrop_menu_01.jpg") 

    $ investData = [

        { "ID": "INV_NEWS", 
            "title": "Hyperion News Inc.".upper(), 
            "desc": "Hyperion News provides the latest market information from all major Star System Trading Networks.",
            "benefit": "Receive trade opportunities faster than your competition.", # CR-0860
            "cost": 120000,
            "level": 2
        },

        { "ID": "INV_MINING", 
            "title": "Starburst Prospecting Inc.".upper(), 
            "desc": "Starburst Prospecting Inc. is a Mining Equipment and Prospecting Enterprise providing Best-In-Class Cartography and Mining Equipment Expertise.",
            "benefit": "Our valuable Investor Newsletter enables you to increase mining output for your enterprise significantly", # CR-0860
            "cost": 350000,
            "level": 2
        },

        { "ID": "INV_ENTERTAINMENT", 
            "title": "Nebula Entertainment Inc.".upper(), 
            "desc": "Nebula Entertainment streams the best entertainment programs with lowest latency into all Systems of the Sector.",
            "benefit": "Our investors enjoy free onboard entertainment uplinks. Proven to reduce crew stress",
            "cost": 380000,
            "level": 3
        },

        {   "ID": "INV_ARCADE",
            "title": "Dynamic Arcade Solutions Inc.".upper(), 
            "desc": "As leading supplier of Arcade Operations Solutions, D.A.S. Inc. provides top tier arcade management services, ranging from planning to  construction and operation of Arcade Facilities.",
            "benefit": "Our investors enjoy free onsite bot repair services",
            "cost": 750000,
            "level": 4
        },

        {   "ID": "INV_WEAPON",
            "title": "Quothon Torpedoes Inc.".upper(), 
            "desc": "Quothon is a leading manufacturer of ranged weapons, drones and torpedoes of all tiers.",
            "benefit": "Our investors enjoy preferred torpedo allotments at docks and space wharfs.",
            "cost": 2120000,
            "level": 5
        },

        {   "ID": "INV_EXPLORE", 
            "title": "Carnelian Deep Space Inc.".upper(), 
            "desc": "Carnelian is a Deep Space Exploration Conglomerate, dedicated to map and explore distant and unassessed Star Systems.",
            "benefit": "Our members receive a random high value find every 5 days.",
            "cost": 2400000,
            "level": 6
        },

        {   "ID": "INV_YUTANI", 
            "title": "Yutani Bot and Automation Systems.".upper(), 
            "desc": "Yutani Corporation is the leading manufacturer of Bots and special purpose AI machinery.",
            "benefit": "Our members gain access to bot prototype analyzing tech in their labs.",
            "cost": 9500000,
            "level": 7
        }   

        ]

    while True:
        call screen investment_manager_scr(investData)
        queue sound "audio/click.wav"
        if _return == False :
            return()
        elif "invest" in _return:
            if GAME.money < _return[1]["cost"]:
                queue sound "audio/tech_fail.wav"
            else:
                $ GAME.investments.append(_return[1]["ID"])
                call transaction("Investments", -_return[1]["cost"], True) from _call_transaction_35 

        elif "divest" in _return:
            $ GAME.investments.remove(_return[1]["ID"])
            call transaction("Divestments", _return[1]["cost"], True) from _call_transaction_36 
    return()

label novel_creator():

    # create titles 
    $ nTitles = [
        "Cosmic <Corsair|Captain|Knave> of the <Crimson|Forbidden|Rapacious> <Suns|Stars|Nebula>",
        "Plundered <Hearts|Damsels|Maidens> Among the Stars",
        "<Nebula|Sun|Galaxy>'s Naughty <Buccaneer|Raider|Corsair>",
        "Galaxy's Greatest Rogue and His Radiant Rebel Bride",
        "Starry Skies and <Sinful|Wicked|Devilish> Smiles",
        "Pirates of the <Pulsar|Forbidden> Planet",
        "Interstellar Infatuation: A Pirate's <Passion|Harem|Adventures>",
        "Astro Adoration: The <Galactic Raider’s|Brave Buccaneer's> <Romance|Dalliance>",
        "Meteor Misfits and their Midnight <Adventures|Maidens|Damsels|Dalliances|Pleasures>",
        "Celestial <Captains|Corsairs|Rogues> and Cosmic <Crushes|Beauties|Romance>"
    ]
    $ nTitle = vary(random.choice(nTitles))
    return(nTitle)

#####################################################################
#					MAIN INTERFACE		
#####################################################################
label mg_computer_captain():

    # prepare background and init
    play sound "audio/beep.wav"
    scene expression ("11_backgrounds/backdrop_galaxy.jpg")
    show image "05_gui/mask 50.png"

    $ mCondOptions = [ "Exit/x", "True"]

    $ mActiveElem = []
    # possible active elements
    $ mActiveElem.append(ActiveElem("05_gui/ico_HoloNet", "Watch HoloNet", [40,100], None,
        "True", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_SectorNet", "SectorNet", [40,300], None,
        "True", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_Cam", "Monitoring", [40,500], None,
        "'bb2_shower_talk' in GAME.mc.done or GAME.questSys.inProgress('QID_BOT_OBSERVE') or GAME.questSys.isActive('QID_NIMHE_LABOVERHEAR')", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_Missions", "Missions", [240,100], None,
        "'map talk' in tris.done", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_Business", "Investments", [240,300], None,
        "'invest_info' in GAME.mc.done", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_Comms", "Comms", [240,500], None,
        "GAME.questSys.isActive('QID_KRELL_VORON_LOM')", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_InfReport", "Infraction Report", [440,100], None,
        "'infraction_expo' in vee.done", ["icon"] ))
    $ mActiveElem.append(ActiveElem("05_gui/ico_GameTweaks", "{size=18}{color=#AAA}Gameplay Settings{/color}{/size}", [1750,900], None,
        "True", ["icon"] ))

    while True:
        call screen  menu_interactive_scr("", mCondOptions, mActiveElem)
        play sound "audio/click.wav"

        #####################################################################
        #					EXIT		
        #####################################################################
        if _return == "Exit":
            scene intermission
            hide image "05_gui/mask 50.png"
            #call sandbox_interior_prepare_scene()
            return()
        #####################################################################
        #              INFRACTION REPORT
        #####################################################################
        elif _return == "Infraction Report":
            if "assess_infractions" in vee.doneToday:
                mc "\"I received that report already today.\""
            elif GAME.hour < 18:
                mc "\"I better wait until the evening with that...\"" 
            else:
                mc "\"Vee, report to Captain for Infraction Reports...\""
                "Vee" "\"On my way...\""
                hide image "05_gui/mask 50.png"
                scene room_captain_smart with fade 
                call assess_infractions() from _call_assess_infractions 
                call report_infraction(_return) from _call_report_infraction 
                return()
        #####################################################################
        #					COMMS		
        #####################################################################
        elif _return == "Comms":
            $ comOptions = [
                "Ylyee/y", "'convoy_talk' in ylyee.done",
                "Verity/v", "GAME.questSys.isDone('QID_KRELL_YLYEE_BONUS') and GAME.getSpaceLoc().ID == 'LIDStationIltari' and GAME.ship.status =='docked'",
                "Exit/x", "True" 
            ]
            queue sound "audio/beep.wav"
            call screen menu_interactive_scr("COMMUNICATION UPLINK ESTABLISHED...", comOptions, [])
            if _return == "Exit":
                pass 
            elif _return == "Ylyee":
                "Pinging Ylyee..."
                call cutscene("ylyee_report") from _call_cutscene_40 
            elif _return == "Verity":
                if GAME.hour >= 20:
                    mc "\"I better contact her tomorrow...\""
                elif 'invited' in verity.doneToday:
                    mc "\"I've already invited Verity over.\""
                    mc "\"I should meet her a 20:00 in the Mess Room...\""
                    mc "\"I hope she'll be coming over...\""
                else:
                    "Pinging Verity..."
                    vet  "\"Hello, what's up?\""
                    mc "\"Nothing special...\""
                    $ renpy.say (mc, vary("\"<I'm in the vicinity...|I'm in Iltari Station...|I dropped by in the Station...>\""))
                    $ renpy.say (vet, vary("\"<Nice...|Great!|Good to hear!>\""))
                    mc "\"Want to meet up?\""
                    vet "\"Sure.\""
                    if not verity.hasDone("ship_invite"):
                        mc "\"Say, at...\""
                        vet "\"8 pm?\""
                        mc "\"Exactly!\""
                        vet "\"I'll come to your ship!\""
                        vet "\"Meet you at the Mess Room...\""
                        mc "\"Until later...\""
                    else:
                        mc "\"See you at the Ship then...\""
                    queue sound "audio/beep.wav"
                    $ verity.hasDoneToday("invited")

        #####################################################################
        #					INVESTMENTS		
        #####################################################################
        elif _return == "Investments":
            # mc "\"There are no interesting business opportunities currently... (Future Version)\""
            call investment_manager() from _call_investment_manager 

        #####################################################################
        #					MISSIONS		
        #####################################################################

        elif _return == "Missions":

            $ mStarSysOptions = [x for x in GAME.starSys.values() if x.ID in GAME.mc.done]
            $ mStarSys = GAME.getStarSys()

            # shift StarSysuntil current system is pos 0:
            python:
                while mStarSysOptions[0] != mStarSys and mStarSys in mStarSysOptions:
                    mStarSysOptions = mStarSysOptions[1:]+ mStarSysOptions[:1] 

            $ mSelect = True
            $ mFilter = {"transport": True, "smuggling": True, "bounty":True}
            queue sound "audio/beep.wav"

            #####################################################################
            #					MISSION SELECT	
            #####################################################################
            while mSelect:
                call screen mission_selector_scr(mStarSysOptions, mFilter)
                queue sound "audio/click.wav"
                if _return == False:
                    $ mSelect = False
                            
                elif "abandon" in _return:
                    queue sound "audio/notify.wav"
                    "You abandon the mission... [C_RE_B](REP -1)[C_RE_E]"
                    $ GAME.mc.attr["REP"] = max(0, GAME.mc.attr["REP"]-1)
                    $ GAME.missionSys.purgeMission(_return[1])

                elif "sign" in _return:
                    $ mission = _return[1]
                    $ fee = int(mission.reward * 0.05)
                    if fee > GAME.money:
                        queue sound "audio/tech_fail.wav"
                    elif len(GAME.missionSys.missions) >= 3: # CR-0443
                        queue sound "audio/drone_beep.wav"
                        bb2 "\"I recommend to first complete some of the missions we have already contracted.\""
                        bb2 "\"It would be not good if we lost track of them.\""
                    else:
                        # check ware exclusivity and issue warning 
                        $ accept = True
                        if mission.kind == "transport":
                            if "wareID" in mission.attr.keys():
                                $ ware = GAME.items[mission.attr["wareID"]]
                                if "exclusive" in ware.attr.keys(): 
                                    if ware.attr["exclusive"] != GAME.getStarSys().ID:
                                        queue sound "audio/notify.wav"
                                        call large_notify("MISSION CONFIRMATION", "{} are not available for purchase in {} System\n\nAre you sure you want to sign this transport mission?".format(ware.getName(["col", "cap", "noArt"]), GAME.getStarSys().name), ["Sign", "Abort"], "08_items/ico {}.png".format(ware.ID)) from _call_large_notify_61 
                                        if _return == "Abort":
                                            $ accept = False
                        
                        #####################################################################
                        #					CONTRACT		
                        #####################################################################
                        if accept:
                            queue sound "audio/coin.wav"  
                            call transaction("Signing Fees", -fee, True) from _call_transaction_37 
                            $ GAME.missionSys.acceptMission(mission)
                            $ GAME.starSys[mission.starSysID].missions.remove(mission)
                            #####################################################################
                            #					TUTORIAL BB2		
                            #####################################################################
                            if mission.kind == "transport":
                                if not GAME.mc.hasDone("mission_tut_transport"): # CR-0304
                                    queue sound "audio/drone_beep.wav" # CR-0304
                                    bb2 "\"Excellent, your first Delivery Mission!\"" # CR-0304
                                    bb2 "\"It will help you to increase your reputation around here.\"" # CR-0304
                                    bb2 "\"This is how it is done:...\"" # CR-0304
                                    bb2 "\"First, collect enough of the ware you have to deliver in your Cargo Bay.\"" # CR-0304
                                    bb2 "\"Then, anytime prior to the due date fly to the delivery nav location.\"" # CR-0304
                                    bb2 "\"You will find the location marked on your nav screen.\"" # CR-0304
                                    bb2 "\"Then click on the nav location to confirm your arrival and have the ware unloaded.\"" # CR-0304
                                    bb2 "\"Don't be too late, or the mission is forfeit and your reputation will suffer.\"" # CR-0304
                                    mc "\"Understood\"" # CR-0304
                            elif mission.kind == "smuggling":
                                if not GAME.mc.hasDone("mission_tut_smuggling"): 
                                    queue sound "audio/drone_beep.wav" 
                                    bb2 "\"Excellent, your first smuggling mission!\"" 
                                    bb2 "\"It will help you to increase your notoriety.\"" 
                                    bb2 "\"This is how it is done:...\"" 
                                    bb2 "\"First, collect enough of the ware you have to deliver in your Cargo Bay.\"" 
                                    bb2 "\"Then, anytime prior to the due date of the delivery fly to the delivery nav location.\"" 
                                    bb2 "\"Make sure to either cloak your cargo or avoid Space Patrol!\"" 
                                    bb2 "\"Don't be too late, or the mission is forfeit and your notoriety will suffer.\"" 
                                    mc "\"Understood\"" 
                            elif mission.kind == "bounty":
                                if not GAME.mc.hasDone("mission_tut_bounty"): 
                                    queue sound "audio/drone_beep.wav" 
                                    bb2 "\"Excellent, your first bounty mission!\"" 
                                    bb2 "\"It will help you to increase your notoriety.\"" 
                                    bb2 "\"This is how it is done:...\"" 
                                    bb2 "\"Check your shields and arms and load torpedoes.\"" 
                                    bb2 "\"Make sure you have good enough gear for the bounty you are taking on.\"" 
                                    bb2 "\"You best start with level 1 or 2 bounties.\"" 
                                    bb2 "\"You can keep and sell the loot you might find on the mission.\"" 
                                    mc "\"Understood\"" 

                        else:
                            queue sound "audio/click.wav"
                elif "filter" in _return:
                    $ mFilter[_return[1]] = not mFilter[_return[1]] 
                elif _return == "left":
                    $ mStarSysOptions = mStarSysOptions[1:]+ mStarSysOptions[:1]
                elif _return == "right":
                    $ mStarSysOptions = mStarSysOptions[-1:]+ mStarSysOptions[:-1]

        #####################################################################
        #					HOLONET		
        #####################################################################
        elif _return == "Watch HoloNet":
            call mg_galaxina() from _call_mg_galaxina 

        #####################################################################
        #              SECTORNET
        #####################################################################
        elif _return == "SectorNet":
            if GAME.hour == 22:
                mc "\"I am tired...\""
            else:
                $ snOptions = ["Odd Jobs/o", "True", 
                        "Pirate Novel/p", "GAME.questSys.isActive('QID_MOIRA_T2_NOVEL')",
                        "Exit/x", "True"
                    ] 
                $ snLoop = True
                while snLoop:
                    call screen menu_interactive_scr("SECTOR NET", snOptions, [])
                    if _return == "Exit":
                        $ snLoop = False

                    elif _return == "Odd Jobs":
                        if not GAME.mc.hasDoneToday("odd_job"): 
                            "You find an odd job offer..." with fade
                            $ job = vary("<You cross-reference data|You catalogue stars|You correct cargo charts> and are paid 500 Cr for your efforts.")
                            "[job]" with fade
                            $ amount = 500
                            call transaction("SectorNet Odd Jobs", amount, True) from _call_transaction_38 
                            mc "\"Shouldn't they let AI do such boring work?\""
                            mc "\"I need to find better ways to earn money...\""
                            mc "\"Mining asteroids is much more profitable.\""
                            $ GAME.mc.tallyUp("Odd Jobs (Cr)",amount)
                        else:
                            "You find nothing of interest." with fade

                        call hour_passes() from _call_hour_passes_89 

                    elif _return == "Research Novel" and "novel" in GAME.mc.doneToday:
                            mc "\"I can not focus on another one today I think...\""

                    elif _return == "Pirate Novel":
                        if not GAME.mc.hasDone("novel"):
                            mc "{i}\"Well, let's see whether we can find one of those Novels Moira likes...\"{/i}"
                            "You search for a while without success..."
                            mc "{i}\"Nothing that matches what I need...\"{/i}"
                            "You are about to give up..."
                            queue sound "audio/notify.wav"
                            mc "{i}\"'Custom Novels Inc.'...\"{/i}"
                            mc "{i}\"Interesting...\"{/i}"
                            mc "{i}\"It seems you can compile your own stories here...\"{/i}"
                            mc "{i}\"Let's see...\"{/i}"
                            "You get to work with the helpful AI..."
                            "Your profound knowledge of cheesy Earth Movies pays off..."
                            queue sound "audio/scribble.wav"
                            "{i}\"...Captain Blaze 'Starlust' sailed through the glittering void, his heart yearning for adventure and romance...\"{/i}"
                            queue sound "audio/scribble.wav"
                            "{i}\"...When the fiery and fearless Princess Astra was taken aboard his ship, the stars themselves couldn't contain the passion that ignited between them...\"{/i}"
                            "One hour later..." with fade 
                            queue sound "audio/scribble.wav"
                            "{i}\"...With a final, dramatic kiss under the glow of countless stars, Blaze and Astra vowed to navigate the Galaxy side by side...\"{/i}"
                            queue sound "audio/scribble.wav"
                            "{i}\"...Their love, as boundless as the cosmos, would forever shine brightly in the annals of space pirate legend. THE END.\"{/i}"
                            mc "{i}\"Not bad for a first...\"{/i}"
                            mc "\"Now let's give it a proper title...\""
                        else:
                            mc "{i}\"Let's see...\"{/i}"
                            "You get to work with the helpful AI..."
                            "Your profound knowledge of cheesy Earth Movies pays off again..."
                            "One hour later..."
                            mc "{i}\"That was not bad...\"{/i}"

                        call novel_creator() from _call_novel_creator 
                        $ nTitle = _return
                        queue sound "audio/notify.wav"
                        mc "{i}\"Let's call it [C_HI_B]'[nTitle]'[C_HI_E].\"{/i}"
                        mc "{i}\"That should do nicely...\"{/i}"
                        mc "{i}\"Aaaand a physical copy real quick...\"{/i}"
                        
                        $ item = GAME.items["ITMPirateMagazine"]
                        queue sound "audio/notify.wav"
                        call find_notify(item, "ITEM CREATED") from _call_find_notify_40 
                        $ GAME.addItemSmart(item.ID)
                        $ GAME.mc.tallyUp("Novels 'Written'",1)
                        $ GAME.mc.hasDoneToday("novel")
                        call hour_passes() from _call_hour_passes_90 
                        $ snLoop = False                    


        #####################################################################
        #					MONITORING		
        #####################################################################
        elif _return == "Monitoring":
            if GAME.hour > 22:
                mc "\"I am tired...\""
                mc "\"I should resume that tomorrow...\""
                
            # Lab Monitoring 
            elif GAME.questSys.inProgress("QID_TRIS_SEXTRAIN_PEEK") and GAME.hour==20:
                mc "\"Let's have a look what is going on in the lab...\""
                show image "ani_tris_auto" with fade 
                window hide
                pause  
                mc "\"Interesting...\""
                mc "\"I wonder how BB-2 gets her to do that...?\""
                if not GAME.mc.hasDone("tris_train_peek"):
                    mc "\"It seems BB-2 acquired some training knowledge...\""
                    queue sound "audio/shutter.wav" 
                    mc "\"I better save that recording...\""
                    $ GAME.timerSet("T_TRIS_AUTO",1)
                hide image "ani_tris_auto" with fade     
                $ GAME.mc.hasDone("tris_train_peek")
                $ GAME.galleryAdd(45)
                call hour_passes() from _call_hour_passes_91 
                call quest_updater() from _call_quest_updater_176 
                if GAME.hour >= 23:
                    mc "\"It's late, I should go to bed now...\""         
                    return()           

            elif GAME.questSys.inProgress("QID_BOT_OBSERVE") and GAME.hour==10:
                show image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade
                mc "\"Hmmm... nothing out of the ordinary.\""                    
                mc "\"Wait, something's moving...\""
                show image "06_cutscenes/cutscene_lab_cam_one.jpg" with dissolve
                show image "06_cutscenes/cutscene_lab_cam_two.jpg" with dissolve
                mc "\"Now that is unusual...\""
                mc "\"What's BB-2 doing in there?\""
                hide image "06_cutscenes/cutscene_lab_cam_two.jpg" with dissolve
                show image "06_cutscenes/cutscene_lab_cam_one.jpg" with dissolve
                mc "\"Maybe he was assisting Nimhe in some capacity?\""
                mc "\"I better talk to her about that...\""
                $ GAME.mc.hasDone("bb2_observed")
                call hour_passes() from _call_hour_passes_92 
                call quest_updater() from _call_quest_updater_177 
                hide image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade

            elif GAME.questSys.inProgress("QID_BOT_OBSERVE") and GAME.hour!=10:    
                show image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade
                mc "\"Hmmm... nothing out of the ordinary.\""
                hide image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade
                call hour_passes() from _call_hour_passes_93 

            elif GAME.questSys.isActive("QID_NIMHE_LABCHECK1") and GAME.hour==15:
                mc "\"Now let's see what is going on in the lab...\""
                show image "ani_nimhe_auto_one" with fade 
                window hide
                pause  
                if not GAME.mc.hasDone("lab_seen_nimhe"):
                    mc "\"Wow...!\""
                    queue sound "audio/shutter.wav" 
                    mc "\"I better save that recording...\""
                    $ GAME.galleryAdd(33)
                else:
                    mc "\"I wonder, why she's doing that...\""
                hide image "ani_nimhe_auto_one" with fade
                call hour_passes() from _call_hour_passes_94 
                call quest_updater() from _call_quest_updater_178 

            elif GAME.questSys.inProgress("QID_NIMHE_LABCHECK1") and GAME.hour!=15:
                show image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade
                mc "\"Hmmm... nothing out of the ordinary.\""
                hide image "06_cutscenes/cutscene_lab_cam_one.jpg" with fade
                call hour_passes() from _call_hour_passes_95 

            # Khelara 
            elif GAME.hour == 20 and "shower seen" not in GAME.mc.doneToday and khelara in GAME.crew:
                # KHELARA
                play sound "audio/click.wav"
                $ img = random.choice(["00", "01"])
                show image "06_cutscenes/cutscene_shower_cam03_{}.png".format(img) with fade
                window hide
                pause
                $ GAME.mc.hasDoneToday("shower seen")
                if img != "00" and "cam_{}".format(img) not in khelara.done:
                    $ khelara.hasDone("cam_{}".format(img))
                    queue sound "audio/notify.wav"
                    mc "\"Nice...\""
                    mc "\"I don't have that one yet...\""
                    play sound "audio/shutter.wav"
                    mc "\"I better save that recording...\"" with whiteflash
                elif img != "00":
                    mc "\"I've seen that already...\""
                else:
                    mc "\"No luck today...\""
                hide image "06_cutscenes/cutscene_shower_cam03_{}.png".format(img) with fade
                if img == "01":
                    $ GAME.galleryAdd(35)

            # Nimhe 
            elif GAME.hour == 21 and "shower seen" not in GAME.mc.doneToday and nimhe in GAME.crew:
                # NIMHE
                play sound "audio/click.wav"
                $ img = random.choice(["00", "01", "02"])
                show image "06_cutscenes/cutscene_shower_cam02_{}.png".format(img) with fade
                window hide
                pause
                $ GAME.mc.hasDoneToday("shower seen")
                if img != "00" and "cam_{}".format(img) not in nimhe.done:
                    $ nimhe.hasDone("cam_{}".format(img))
                    queue sound "audio/notify.wav"
                    mc "\"Nice...\""
                    mc "\"I don't have that one yet...\""
                    play sound "audio/shutter.wav"
                    mc "\"I better save that recording...\"" with whiteflash
                elif img != "00":
                    mc "\"I've seen that already...\""
                else:
                    mc "\"No luck today...\""
                hide image "06_cutscenes/cutscene_shower_cam02_{}.png".format(img) with fade
                if img == "01":
                    $ GAME.galleryAdd(11)
                elif img == "02":
                    $ GAME.galleryAdd(12)

            # T'Ris
            elif GAME.hour == 22 and "shower seen" not in GAME.mc.doneToday:
                # TRIS SHOWER
                play sound "audio/click.wav"
                $ img = random.choice(["00", "01", "02", "03"])
                show image "06_cutscenes/cutscene_shower_cam01_{}.png".format(img) with fade
                window hide
                pause
                $ GAME.mc.hasDoneToday("shower seen")
                if img != "00" and "cam_{}".format(img) not in tris.done:
                    $ tris.hasDone("cam_{}".format(img))
                    mc "\"Nice...\""
                    play sound "audio/shutter.wav"
                    mc "\"I better save that recording...\"" with whiteflash
                    if not GAME.mc.hasItem("ITMFlyboy01") and "favour_idea" in GAME.mc.done:
                        mc "\"I wish I had more explicit material to 'study'...\""
                        mc "\"I should look around in my cabin...\""
                elif img != "00":
                    mc "\"I've seen that already...\""
                else:
                    mc "\"No luck today...\""                
                hide image "06_cutscenes/cutscene_shower_cam01_{}.png".format(img) with fade
                if img == "01":
                    $ GAME.galleryAdd(1)
                elif img == "02":
                    $ GAME.galleryAdd(2)
                elif img == "03":
                    $ GAME.galleryAdd(3)

            else:
                "You do not see anything interesting..."
                
                
        #OhWeeMod bot value/income adjustments
        
        elif "Gameplay Settings" in _return:
            menu:
                "Would you like to adjust the baseline 'Value' multiplier settings\nas it relates to Bot Values and Arcade Earnings?"
                "Yes, please!":
                    show screen bot_value_earnings_diff onlayer top
                "Not at this time...":
                    pass

    return()


#####################################################################
#              GALAXINA
#####################################################################
label mg_galaxina(mode="play_next"): # plays rerun if maxed
    
    # base data
    $ result = None
    $ epNames = ["Nymphos Of The Nexus", "Mistress Of Orion", "Amazons From Outer Space", "Queen Arachnia's Revenge","Space Slugs From The Fifth Plane","Attack From Planet Nine", "The Thing From The Depths", "The Blob From The Fourth Dimension", "Robots From The Void", "Depraved Drones Of Denos", "Lecherous Lizards Of Zebulon"]    

    # checks
    if GAME.hour == 22:
        mc "\"I am tired...\""
        return(False)
    elif GAME.hour < 18:
        mc "\"I should get something done today first...\""
        return(False)
    elif "holonet" in GAME.mc.doneToday:
        mc "\"I should save some episodes for later...\""
        mc "\"Who knows for how long I'll be on this ship...\""
        return(False)

    play music "audio/music_galaxina_01.mp3"
    $ GAME.mc.hasDoneToday("holonet")

    # play episode 
    if GAME.mc.getTally("Galaxina Episodes") < len(REGISTRY.ENTRIES["galaxina"]): 
        $ GAME.mc.tallyUp("Galaxina Episodes",1)
        $ episode = GAME.galaxinaData[GAME.mc.getTally("Galaxina Episodes")]
        $ GAME.galleryAdd(episode[2])
        # play episode 
        $ epImg = "20_gallery/gallery {}.jpg".format(episode[2])
        show image epImg with Fade(0.0, 1.0, 1.0) 
        window hide
        pause
        $ renpy.say(None, "You watch Galaxina Episode Nr. {} - {}'{}'{}".format(GAME.mc.getTally("Galaxina Episodes"), C_GO_B, episode[0], C_GO_E))
        mc "\"Awesome episode...\""
        $ renpy.say(mc, "\"{}\"".format(episode[1]))
        
         
    else:
        # select and play rerun
        $ n = random.choice(range(1,GAME.mc.getTally("Galaxina Episodes")+1))
        $ episode = GAME.galaxinaData[n]

        $ epImg = "20_gallery/gallery {}.jpg".format(episode[2])
        show image epImg with Fade(0.0, 1.0, 1.0) 
        window hide
        pause
        $ renpy.say(None, "You watch Galaxina Rerun {}'{}'{}".format(C_GO_B, episode[0], C_GO_E))
        mc "\"Awesome episode, even as rerun...\""
        $ renpy.say(mc, "\"{}\"".format(episode[1]))

    # clean up
    hide image epImg with fade
    call hour_passes() from _call_hour_passes_96 
    stop music fadeout 1.0
    show screen header()
    return(GAME.mc.getTally("Galaxina Episodes"))