#####################################################################
#                TRADER / SHOP WRAPPERS
#####################################################################
label shady_trader():
    #####################################################################
    #                INTERCEPTS
    #####################################################################

    if not GAME.mc.hasDone("met_trader"):
        st "\"You look lost...\""
        st "\"Not from around here, ey?\""
        mc "\"Actually no...\""
        mc "\"You know where I can get some star charts?\""
        st "\"As it so happens, I trade in all kind of goods...\""
        st "\"Star maps included...\""
        mc "\"I'm new in this Sector...\""
        mc "\"Can I get it for free?\""
        st "\"I don't do charity.\""
        st "\"Come back when you're ready to pay for it...\""
        mc "\"Well, thanks anyway.\""
        return()

    if "intro_argus" not in GAME.mc.done and GAME.questSys.isActive( "QID_NIMHE_UPGRADE") and "intro_argus" not in shady.doneToday:
        mc "\"I need an Argus Mk II Uplink.\""
        st "\"Wow, this is for heavy hitters...\""
        st "\"You can afford that?\""
        mc "\"We'll see...\""
        st "\"Fine.\""
        st "\"Come back to me tomorrow then.\""
        st "\"I'll see what I can do.\""
        $ shady.hasDoneToday("intro_argus")
        $ GAME.mc.hasDone("intro_argus")
        return()

    if 'bought_map_one' not in GAME.mc.done:
        mc "\"I'd like to buy the Sector Map.\""
        st "\"I have one here, updated a few hours ago...\""
        st "\"Even comes with the ability to navigate to interdicted locations...\"" # CR-0539
        if not GAME.mc.hasDone("intro_map"):
            mc "\"Interdicted locations?\""
            st "\"Pirate outposts, for example.\""
            st "\"Should you need to trade in, ...ahem, drugs, weapons and slaves...\""
            mc "\"I see.\""
            mc "\"It can't hurt to keep one's options open...\""
            st "\"That's the right business sense!\""
        
    if GAME.questSys.inProgress('QID_SERAPHINE_MULTIPASS_A'):
        if not shady.hasDone("shady_forge_info"):
            mc "\"I need a specific item...\""
            st "\"What is it?\""
            mc "\"I must have misplaced my Multipass...\""
            st "\"I get that a lot...\""
            mc "\"So you can help me?\""
            st "\"Adjusting the data trail is not easy...\""
            st "\"Especially as it seems you are not from around here...\""
            mc "\"So?\""
            st "\"One Million Credits.\""
            mc "\"One Million!?\"" with vpunch 
            st "\"In advance.\""
        else:
            st "\"Do you need the Multipass or not?\""
        if GAME.money < 1000000:
            mc "\"I don't have that much...\""
            st "\"You can come back once you have the money.\""
            return()
        queue sound "audio/notify.wav"
        call large_notify("MULTIPASS ORDER", "Shady has offered to replace your 'misplaced' Multipass for the amount of 1,000,000 Cr. You have the feeling that you will need this document eventually.\n\nWhat do you want to do?", ["Pay", "Reconsider"], "08_items/ico ITMMultipass.png", "orange") from _call_large_notify_59 
        if _return == "Pay":
            call transaction("Fake Documents", -1000000, True) from _call_transaction_30 
            st "\"Excellent!\""
            st "\"Come back tomorrow to pick it up.\""
            $ GAME.mc.hasDoneToday("shady_forge") 
            $ GAME.mc.hasDone("shady_forge") 
        else:
            st "\"Another time then.\""
        call quest_updater() from _call_quest_updater_168 
        return()

    if GAME.questSys.inProgress('QID_SERAPHINE_MULTIPASS_A_PICKUP'):
        st "\"I have something for you...\"" 
        queue sound "audio/notify.wav"
        $ item = GAME.items["ITMMultipass"]
        call find_notify(item, "ITEM RECEIVED") from _call_find_notify_37 
        $ GAME.mc.addItem("ITMMultipass")
        queue sound "audio/equip.wav"
        mc "\"Much obliged.\""
        st "\"Just don't tell anyone it came from me...\""
        mc "\"Of course.\""
        return()

    if GAME.questSys.inProgress('QID_SERAPHINE_UNIFORM'):
        queue sound "audio/notify.wav"
        mc "\"I need special attire for my crew to travel through Krell Space...\""
        st "\"Ah that.\""
        st "\"I have some of them in storage.\""
        st "\"Krell occasionally buy them for their pets on this Station.\""
        st "\"Make sure your crew is willing to wear them.\""
        st "\"It would be a waste of money otherwise...\""
        mc "\"Are they unusual?\""
        st "\"Not if you are a Krell...\""
        st "\"Or a Krell pet, rather.\""
        mc "\"I see.\""

    if GAME.questSys.inProgress('QID_HOLO_CASTLE_MOD') and "holo_castle_shady" not in shady.done:
        call cutscene_seraphine("holo_castle_shady") from _call_cutscene_seraphine_28 
        return()
    #####################################################################
    #           STANDARD PURCHASE
    #####################################################################

    st "\"Have a look at my wares then...\""

    # restock trader
    if not shady.hasDoneToday("restock"):
        $ shady.inventory = []
        python:
            # quest and quest triggered items
            if 'bought_map_one' not in GAME.mc.done:
                shady.addItem("ITMMapSectorOne")
            if GAME.questSys.isDone("QID_BOT_FIRST"):
                shady.inventory += [GAME.items["ITMCrateBots"]]*random.randint(1,3)
            if GAME.questSys.isActive("QID_NIMHE_UPGRADE") and "intro_argus" not in shady.doneToday:
                shady.addItem("ITMArgus")            
            if GAME.questSys.isActive("QID_TRIS_FOCUS"):
                shady.addItem("ITMLiquorDrengar")
            if GAME.questSys.isActive("QID_INTRO_MINER"):
                subunits = [GAME.items[x] for x in ["ITMFlux", "ITMPositron", "ITMTunneling","ITMOutput"]*3] 
                shady.inventory += random.sample(subunits,3) 

            if GAME.questSys.isActive('QID_UNIFORM_REVEALING'):
                shady.inventory += [GAME.items["ITMUniformRacy"]]*4
                shady.inventory += [GAME.items["ITMUniformRevealing"]]*4
            if GAME.questSys.isActive('QID_SERAPHINE_UNIFORM'):
                shady.inventory += [GAME.items["ITMUniformKrell"]]*4
            if GAME.questSys.isActive('QID_BOT_MYSTERY'): 
                shady.addItem("ITMCamera")

            if GAME.questSys.inProgress('QID_HOLO_KICKOFF'):
                shady.addItem("ITMDiscsTellurium")
            if "holo_castle_shady" in shady.done:
                shady.addItem("ITMCardHolo1")
                shady.addItem("ITMOutfitPrincess")
                shady.addItem("ITMOutfitQueen")
            if GAME.questSys.inProgress('QID_MOIRA_PIRATE'):
                shady.addItem("ITMOutfitStarblaze")
            if GAME.questSys.isActive("QID_MOIRA_SUB_PET_CERTIFICATE"):
                shady.inventory += [GAME.items["ITMPetSupplement"]]*random.randint(1,4)
                
            #standard items
            options = ["ITMPodBio", "ITMPodEnergy", "ITMPodNano", "ITMDrugs", "ITMSpanner", "ITMDildoBasic", "ITMCandle"]
            if GAME.questSys.isDone("QID_TRIS_SURPRISE") and tris.getAttr("EXH") >= 6:
                options.append("ITMClothingKit") # CR-0940
            for i in range(12):
                shady.addItem(random.choice(options))
            shady.addItem("ITMDrugs")
            shady.addItem("ITMDrugs")
            shady.addItem("ITMDrugs")
            shady.addItem("ITMDrugs")
            shady.addItem("ITMDrugs")
              
    call item_shop(shady, GAME.adv["ACTSHADY"], "SHADY DEALS") from _call_item_shop_2 
    if GAME.mc.hasItem("ITMMapSectorOne"):
        $ GAME.mc.hasDone('bought_map_one')

    if "ship_delivery" in shady.doneToday:
        st "\"I'll have the larger items forwarded to your ship.\""
        $ shady.doneToday.remove("ship_delivery")

    call quest_updater() from _call_quest_updater_169 
    return()

label veronica():
    #####################################################################
    #                QUEST RELATED INTERCEPTS
    #####################################################################
    if "mission_veronica" in GAME.mc.done:
        $ fp = GAME.mc.done.count("mission_veronica")
        queue sound "audio/notify.wav"
        ver "\"Good job with that delivery by the way...\""
        mc "\"Thanks.\""
        call fp_notify(veronica,fp) from _call_fp_notify_14 
        call attr_mod(veronica, "APP", 1,3,100, True) from _call_attr_mod_63 
        while fp:
            $ GAME.mc.done.remove("mission_veronica")
            $ fp -= 1

    #####################################################################
    #              MENU
    #####################################################################
    $ mOptions = [  "Shop/s", "True",
                    "Missions/m", "'map talk' in tris.done", # CR-0304
                    "Favour/f", "'verity_delivered' in GAME.mc.done", 
                    "Chat/e", "True", 
                    "Exit/x", "True"]
    call screen menu_interactive_scr(False, mOptions, [])

    if _return == "Exit":
        ver "\"Until next time...\""
        return()

    #####################################################################
    #					SHOP												  #
    #####################################################################
    elif _return == "Favour":
        if "verity_delivered" in GAME.mc.doneToday:
            ver "\"I'll spend the day catching up with my sister...\""
            mc "\"Of course...\""
        elif GAME.hour < 22:
            ver "\"Ask me again at the end of my shift...\""
        else:
            call cutscene("veronica_reward") from _call_cutscene_39 
            return() 


    #####################################################################
    #					SHOP												  #
    #####################################################################
    elif _return == "Shop":
        ver "\"Have a look...\""
        # restock trader
        if not veronica.hasDoneToday("restock"):
            $ veronica.inventory = []
            python: 
                if GAME.questSys.isActive("QID_TRIS_FOCUS"):
                    veronica.addItem("ITMLiquorDrengar")
                #standard items
                # CR-2125 START
                for i in range(15):
                    veronica.addItem(random.choice(["ITMLiquorFairy", "ITMLiquorDrengar", "ITMLiquorIltari"]+[x.ID for x in GAME.items.values() if x.ID in ['ITMDrinkAstropolitan', "ITMDrinkDrengarianIceTea", "ITMDrinkPanGalactica", "ITMDrinkStarburst69", "ITMDrinkStellarShake"]]))
                # CR-2125 END


        call item_shop(veronica, GAME.adv["ACTVER"], "DRINKS & MORE", [0.8,1.2], "buy", ["liquor", "drinks", "ITMDrugs"]) from _call_item_shop_3 
        return()

    #####################################################################
    #					MISSIONS												 
    #####################################################################
    elif _return == "Missions":

        if not GAME.mc.hasDone("intro_mission_interface"):
            ver "\"Available missions are continously transmitted to your data terminal.\""
            ver "\"You best check and contract them in your Mission Manager\""
            mc "\"I see.\""
            ver "\"I might have special missions from time to time...\""
            mc "\"Legal ones?\""
            ver "\"Depends... Just check in from time to time...\""
        else:
            if random.randint(1,100) > 50 and "special_mission" not in veronica.doneToday and GAME.ship.cargoFree() >= 3:
                $ veronica.hasDoneToday("special_mission")
                queue sound "audio/notify.wav"
                ver "\"As it so happens, I have a special assignment if you're interested...\""
                mc "\"I'm listening...\""

                #####################################################################
                #					Mission Params		
                #####################################################################
                $ amount  = random.randint(1,3)            
                $ mID = "MID-Veronica-{}".format(GAME.day)
                $ mName = "'Medical' Delivery"
                $ mKind = "smuggling"
                $ mDue = GAME.day+random.randint(1,2) 
                $ mSLocID = "LIDRubbleIltari"
                $ mCond = "GAME.ship.cargo.count(GAME.items['ITMDrugs']) >= {}".format(amount)
                $ mReq = {}
                $ mAttr = {"wareID": "ITMDrugs", "amount": amount}
                $ mReward = GAME.items["ITMDrugs"].price*5*amount+1000
                # ===== CR-0817 START
                $ mStarSysID = "SSIDIltari"
                $ mission = Mission(mID, mName, mKind, mStarSysID, mSLocID, mDue, mCond, mReq, mReward, mAttr)      
                # ===== CR-0817 END              

                #####################################################################
                #					Mission Choice		
                #####################################################################
                ver "\"I need someone to transport [amount] t of 'Medical Supplies' to the nearby Debris Field...\""
                ver "\"A Rendezvous Ship will wait for you there...\""
                ver "\"Be sure to show up with the goods before Day [mDue]\""
                $ playSFX("audio/notify.wav", GAME.sfxChannels)
                call large_notify("SPECIAL DELIVERY", "Veronica has asked you to transport {} t of Drugs to the Debris Field. A ship will wait for you there.\n\nIf you are interested, purchase the goods from Shady and proceed to the Rendezvous Point.".format(amount), ["Accept", "Decline"], "05_gui/ico Ship.png", "orange") from _call_large_notify_60 
                if _return == "Decline":
                    mc "\"Maybe some other time...\""
                    ver "\"Suit yourself...\""
                else:
                    mc "\"Mission agreed.\""
                    mc "\"I'm passing by there anyway.\""
                    ver "\"Excellent.\""
                    queue sound "audio/notify.wav"
                    call simple_notify("DRUG DELIVERY", "New mission registered.", ["Continue"], "08_items/ico ITMDrugs.png") from _call_simple_notify_77 
                    $ GAME.missionSys.acceptMission(mission)

            else:
                ver "\"Check your In-Ship terminal for available standard missions...\""


    #####################################################################
    #					CHAT/ NEWS		 
    #####################################################################
    elif _return == "Chat":
        if "met_trader" not in GAME.mc.done:
            mc "\"Do you know where I can buy star maps around here?\""
            if GAME.hour < 18:
                ver "\"Shady is usually here in the evening.\""
                ver "\"Ask her.\""
            else:
                ver "\"I suggest you ask Shady over there...\""
            mc "\"Thanks...\""
            return()

        elif GAME.questSys.inProgress("QID_NIMHE_INQUIRE"):
            mc "\"You wouldn't happen to know a competent 'circumvention expert'...\""
            mc "\"I need to deal with some Interdiction Drones...\""
            ver "\"That is an ambitious plan you have there...\""
            mc "\"So, you know anyone or not?\""
            ver "\"Well, it's your funeral...\""
            ver "\"If you want a realistic shot at it, you need someone good...\""
            ver "\"Ask Nimhe, she may be out for hire...\""
            mc "\"Nimhe?\""
            ver "\"A Syrax hacker who appeared at Iltari Station a few years back...\""
            mc "\"Syrax?\""
            ver "\"A little understood race with all kinds of weird upgrades.\"" # CR-0995
            ver "\"You don't see many of those around.\""
            ver "\"They can chose any appearance they like...\""
            ver "\"Station Admin has shut down the sexbot sideline she had going...\""
            ver "\"That was some sweet business by the way...\""
            ver "\"She carried it a bit too far though.\""
            ver "\"Those Syrax are strange...\""
            mc "\"Where can I find her?\""
            ver "\"Look around the Hoverpass late at night...\""
            mc "\"What does she look like?\""
            ver "\"You can't miss her...\""
            ver "\"She has the whole cybergirl thing down to a T...\""
            ver "\"Probably good for business.\""
            if "met_nimhe" in GAME.mc.done:
                mc "\"I think I met her.\""
                mc "\"She won't talk to me.\""
                ver "\"I'll pass her a note.\""
            else:
                ver "\"I'll pass her a note, so she'll expect you.\""
            mc "\"Thanks.\""
            mc "\"Just what I need.\""
            mc "\"Drones beware, I am coming for you!\""
            ver "\"I admire your confidence...\""
            $ GAME.mc.hasDone("nimhe_talk_veronica")
            call quest_updater() from _call_quest_updater_170 
            return()

        elif GAME.questSys.inProgress('QID_KRELL_CONTACTS'):
            queue sound "audio/notify.wav"
            if not "DIATrust001" in veronica.done:
                mc "\"Just came back from Arellarti Station.\""
                mc "\"I am looking for someone by the name of Verity...\""
                ver "\"Do you think she is on Arellarti Station?\""
                mc "\"She seems to have been there.\""
                mc "\"I don't know much about her, only that she has red hair.\""
                ver "\"My sister Verity went to Arellarti Station a while ago!\""
                ver "\"She mentioned some sketchy promotion job.\""
                ver "\"As a 'Krell Pet', imagine that.\""
                ver "\"I warned her, but she wouldn't listen...\""
                ver "\"I've had no contact for a while now...\""
                mc "\"That is interesting...\""
            else:
                mc "\"I remember you mentioned your sister Verity travelling to Arellarti?\""
                ver "\"Yes, for that sketchy Pet Promotion job...\""
            mc "\"You don't happen to remember who hired your sister?\""
            ver "\"A slimy Krell merchant called Kesnor, Quaestor, ... no Quexnor, I think.\""
            ver "\"He was in the Bio Engineering Business somehow...\""
            mc "\"That information helps!\""
            mc "\"Next time in Krell Space I will look into it!\""
            ver "\"Thank you so much.\""
            ver "\"I really appreciate it.\""
            queue sound "audio/notify.wav"
            mc "{i}\"Finally I have the name! Quexnor...\"{/i}"
            $ GAME.mc.hasDone("verity_owner_info")
            call attr_mod(veronica, "APP", 1,2,100, True) from _call_attr_mod_64 
            call quest_updater() from _call_quest_updater_171 
            return()

        elif  GAME.questSys.isDone('QID_KRELL_LAB_CONTACTS') and "verity_rescued" not in GAME.mc.done:
            ver "\"Any news of my sister?\""
            mc "\"None so far.\""
            ver "\"I hope she will be found...\""
            return()

        #####################################################################
        #                GENERIC CHAT
        #####################################################################

        call get_conversations("veronica") from _call_get_conversations_1 
        call npc_talk(veronica, _return) from _call_npc_talk_23 

    return()

label shop_arellarti_pets():
    #####################################################################
    #                QUEST RELATED INTERCEPTS
    #####################################################################
    while True:
        $ mOptions = [  "Shop/s", "True",
                        "Chat/e", "True", 
                        "Exit/x", "True"]
        call screen menu_interactive_scr(False, mOptions, [])
        queue sound "audio/click.wav"
        if _return == "Exit":
            hide screen displayPresentActors
            call sandbox_interior_navigate_to("LOCArellartiStationPL") from _call_sandbox_interior_navigate_to_95 
            return()
        #####################################################################
        #					SHOP												  #
        #####################################################################

        elif _return == "Shop":
            # restock trader
            if not petTrainer.hasDoneToday("restock"):
                $ petTrainer.inventory = []
                # stock special items
                python: 
                    #standard items
                    for i in range(10):
                        petTrainer.addItem(random.choice(["ITMLiquorIltari", "ITMVoucherPet1", "ITMUniformKrell", "ITMGagKrell", "ITMCrop", "ITMPlugKrell", "ITMShaverKrell"]))
                    petTrainer.addItem("ITMVoucherPet1")    
                    # conditional items
                    if GAME.questSys.isDone('QID_TRIS_PET_CLASS'):
                        petTrainer.addItem("ITMVoucherPet2")
                    if GAME.questSys.isActive('QID_NIMHE_PONYPLAY'):
                        petTrainer.addItem("ITMOutfitPony")
                    # CR-2160 START
                    if GAME.questSys.isDone('QID_NIMHE_PONYPLAY'):
                        petTrainer.addItem(random.choice(["ITMPonyMag02", "ITMPonyMag03"]*2+["ITMPonyMag01"]*2))
                    # CR-2160 END
                    if GAME.questSys.isActive('QID_MOIRA_T3_TOY'):
                        petTrainer.addItem("ITMDildoGreen")
                    if GAME.questSys.isActive('QID_UNIFORM_TRYOUT'):
                        petTrainer.inventory += [GAME.items["ITMPetSupplement"]]*random.randint(2,5)
                    if "fetch_toy_comment" in tris.done:
                        petTrainer.addItem("ITMChewingToy")

            sp1 "\"Have a look...\""
            call item_shop(petTrainer, GAME.adv["ACTSP1"], "THE PET STORE", [0.8,1.2], "buy", ["all"]) from _call_item_shop_4 

        ##################################################################
        #					CHAT / NEWS / MISSIONS					 
        ##################################################################
        elif _return == "Chat":

            #####################################################################
            #              CHAT INTERCEPTS
            #####################################################################
            if GAME.questSys.inProgress("QID_MOIRA_SUB_PET_HOMEWORK") or "machine_talk" in GAME.debugMode:
                if "machine_talk" in GAME.debugMode:
                    $ GAME.debugMode.remove("machine_talk")
                $ GAME.mc.hasDone("machine_talk")
                queue sound "audio/notify.wav" 
                mc "\"I am looking for a particular Pet Device...\""
                sp1 "\"Can you be more specific?\""
                mc "\"A Pet Milker...\""
                queue sound "audio/notify.wav"
                ptr "\"Those are for sale to Krell only...\""
                ptr "\"Besides, the new Pet Milker Series 3000 is very unreliable...\""
                ptr "\"Rumour is they were sabotaged by Lizard Agents...\""
                mc "\"That thought also came to my mind...\""
                ptr "\"I'm about so send my whole delivery back to the manufacturer...\""
                ptr "\"Imagine the profits I lose...\""
                mc "\"That is too bad...\""
                mc "\"Maybe we can come to some kind of arrangement?\""
                ptr "\"What arrangement?\""
                mc "\"I happen to have a very qualified crew...\""
                mc "\"Engineer, Biomedical Expert, Data Analyst...\""
                ptr "\"That sounds impressive, especially the Biomedical Expert...\""
                mc "\"Exactly...\""
                mc "\"If you were to provide me with one Sample Device, I could analyze it...\""
                mc "\"After repair, you get the repair blueprints and I keep the sample...\""
                ptr "\"Hmm...\""
                mc "\"Imagine the business opportunities...\""
                mc "\"Your shop being the only one selling working 3000 Series Milkers... \""
                ptr "\"I can see the opportunities now...\""
                mc "\"And...?\""
                queue sound "audio/notify.wav"
                ptr "\"Agreed!\""
                mc "\"Excellent!\""
                ptr "\"I will have one Sample Device forwarded to your ship right away...\""
                ptr "\"It's a bit used already but should be suitable for analysis.\""
                queue sound "audio/notify.wav"
                call simple_notify("EQUIPMENT RECEIVED", "Krell Pet Milker", ["Continue"], "05_gui/ico_gui_milker.png") from _call_simple_notify_78 
                mc "\"My crew will get right to work.\""
                mc "\"I'll let you know once the equipment is fixed.\""
                # unlock cargo bay section 2 
                $ GAME.mc.hasDone("machine_talk")
                call quest_updater() from _call_quest_updater_172 
                return()

            ##############################################################
            #                GENERIC CHAT
            ##############################################################

            $ sp1Chat = [
                [["ACTSP1"],"any", "DIASp1001", {}, "True", [],
                [ "sp1", "<We have an assortment of very nice plugs on sale.|Our collars allow for special settings...|Our crops are quite efficient...>",
                "mc", "<Indeed.|You don't say.|Really?|Interesting...|Is that so?>"]
                ],

                [["ACTSP1"],"any", "DIASp1002", {}, "True", [],
                [ "mc", "<Do you have experience with any of these items?>",
                "sp1", "<I am required to...|I have been thoroughly familiarized with them...|That is a job requirement...|I know how to use all of the latest toys...>",
                "mc", "<Indeed.|You don't say.|Really?|Interesting...|Is that so?>"]
                ],

                [["ACTSP1"],"any", "DIASp1003", {}, "tris.getLocOverride()=='LOCPetwalk'", [],
                [ "sp1", "<A nice pet you have there...>",
                    "sp1", "<I have some special plugs coming in that might fit her...|I have a very strict Pony Outfit that might be right for her...|I think a gag would go nicely with her plug...>",
                "mc", "<Thanks for the offer...|I'll think about that...>"]
                ],

                [["ACTSP1"],"any", "DIASp1004", {}, "tris.getLocOverride()=='LOCPetwalk'", [],                
                [ "sp1", "<A nice pet you have there...>",
                    "sp1", "<Is she ready for advanced toys?|Is she well trained?>",
                    "mc", "<I am still training her...>",
                    "sp1", "<I see...>" ]
                ],
                ]
            call npc_talk(salesPet1, sp1Chat) from _call_npc_talk_24 

            # $ ptrChat = [
            #     [["ACTPTR"],"any", "DIAPtr001", {}, "True", [],
            #     [ "pt", "<Pet prices have come down lately...|Drengarian pets are hard to train...|Tarakian pets make the best ponygirls...|Iltarian Dew makes pets more receptive to training...>",
            #     "mc", "<Indeed.|You don't say.|Really?|Interesting...|Is that so?>"]
            #     ],
            #     [["ACTPTR"],"any", "DIAPtr002", {}, "tris.getLocOverride()=='LOCPetwalk'", [],
            #     [ "pt", "<A nice pet you have there...>",
            #         "pt", "<I have some special plugs coming in that might fit her...|I have a very strict Pony Outfit that might be right for her...|I think a gag would go nicely with her plug...>",
            #     "mc", "<Thanks for the offer...|I'll think about that...>"]
            #     ],
            #     [["ACTPTR"],"any", "DIAPtr002", {}, "tris.getLocOverride()=='LOCPetwalk'", [],                
            #     [ "pt", "<A nice pet you have there...>",
            #         "pt", "<Can she do tricks?|What tricks can she do?>",
            #         "mc", "<I am still training her...>",
            #         "pt", "<I see...>" ]
            #     ],
            #     ]
            # call npc_talk(petTrainer, ptrChat) 

    return()

#####################################################################
#              SCRAPTRADER
#####################################################################
label scrap_trader():
    # create dynamic location
    $ scrapTrader.price = 0.5
    $ scrapTrader.spread = 0.3

    if "restocked market" not in scrapTrader.doneToday:
        $ scrapTrader.restock()
    if GAME.questSys.isDone("QID_BOT_FIRST"):    
        $ scrapTrader.wares+=[ GAME.items["ITMCrateBots"] ]*random.randint(1,5)
    $ GAME.ship.status = "docked"
    call cargo_manager(scrapTrader) from _call_cargo_manager_2 
    # Cleanup
    $ GAME.ship.status = "in space"    
    return()

#####################################################################
#              BELIT TRADER
#####################################################################
label belit_trader():
    # set up location
    play music "audio/deep_impact_ambient.mp3" fadein 1.0
    scene expression("06_cutscenes/cutscene_belit.png") with fade
    "Belit" "\"How can I help you...?\""

    if GAME.questSys.inProgress('QID_MOIRA_PIRATE'):
        queue sound "audio/notify.wav"
        mc "\"I have an unusual request today...\""
        "Belit" "\"What is it?\""
        mc "\"I need a special disguise for a, ahem... mission.\""
        mc "\"A flashy Pirate Costume...\""
        "Belit" "\"I might have something of the kind...\""
        mc "\"What's the price?\""
        "Belit" "\"Consider it customer service...\""
        mc "\"Great!\""
        "Belit" "\"Here you go.\""
        $ item = GAME.items["ITMOutfitStarblaze"]
        queue sound "audio/notify.wav"
        call find_notify(item, "ITEM RECEIVED") from _call_find_notify_38 
        queue sound "audio/equip.wav"
        $ GAME.mc.addItem(item.ID)
        mc "\"Excellent, now I can proceed with that special, ahem... mission.\""
        call quest_updater() from _call_quest_updater_173 
        "Belit" "\"Glad I could be of help.\""
        "Belit" "\"Now back to business...\""

    $ mPrior = GAME.money 
    $ belitTrader.price = 0.5
    $ belitTrader.spread = 0.3
    $ GAME.ship.status = "docked" # access cargo manager in landed mode
    $ novaCount = GAME.ship.cargo.count(GAME.items["ITMNovaDisruptor"])

    if "restocked market" not in belitTrader.doneToday: 
        $ belitTrader.restock(["all_licenses"]) 

        # manual corrections
        python:
            for i in ["ITMLauncherMkII", "ITMShieldVoron", "ITMAddOnAOE", "ITMNovaDisruptor", "ITMTorpedoVoron", "ITMHyperdriveVoron", "ITMBeacon"]:
                item = GAME.items[i]
                while item in belitTrader.wares:
                    belitTrader.wares.remove(item)
            
        
        $ belitTrader.wares += [GAME.items["ITMEternium"]]*random.randint(0,2) 
        $ belitTrader.wares += [GAME.items["ITMCrateBots"]]*random.randint(0,5) 
        $ belitTrader.wares += [GAME.items["ITMCrateBotsRare"]]*random.randint(0,3) 
        $ belitTrader.wares += [GAME.items["ITMCrateBotsMil"]]*random.randint(0,2) 
        $ belitTrader.wares += random.sample([GAME.items[x] for x in ["ITMNanotubes", "ITMOreChtonium", "ITMCarbonFiberSpools"]*3], random.randint(2,5)) 

        if not "nova_sold" in belit.done:
            $ belitTrader.wares += [GAME.items["ITMNovaDisruptor"]]*random.randint(0,1) 

    # transactions
    call cargo_manager(belitTrader, [], {"title": "BELIT'S WARES"}) from _call_cargo_manager_3 

    # cleanup and tracking
    if novaCount < GAME.ship.cargo.count(GAME.items["ITMNovaDisruptor"]):
        $ belit.hasDone("nova_sold") 
    if GAME.money == mPrior:
        mc "\"Ahem, ...I can't make up my mind right now.\""
        "Belit" "\"Don't waste my time!\""
    else:
        "Belit" "\"To future business!\""

    stop music fadeout 1.0
    scene expression("room_cargo") with fade
    $ GAME.ship.status = "in space"    
    return()

#####################################################################
#              KROGNEATH
#####################################################################
label krogneath_trader():
    # set up location
    play music "audio/deep_impact_ambient.mp3" fadein 1.0
    scene expression("06_cutscenes/cutscene_krogneath.png") with fade
    if not GAME.mc.hasDone("intro_krogneath"):
        window hide
        pause 
        mc "\"Nice decoration...\""
        "Krogneath" "\"I spared no expense...\""
        "Krogneath" "\"Now to business...\""
    "Krogneath" "\"You'll find only the best weapons here...\""
    $ mPrior = GAME.money 
    $ krogTrader.price = 1.1
    $ krogTrader.spread = 0.8
    $ licenses = ["grade_1"]
    if GAME.mc.attr["NOT"] >= 5:
        $ licenses+= ["grade_2"]
    if GAME.mc.attr["NOT"] >= 10:
        $ licenses+= ["grade_3"]


    if "restocked market" not in krogTrader.doneToday: # CR-0468
        $ krogTrader.restock(licenses)
        $ krogTrader.wares += [GAME.items["ITMAddOnCloak"]]*random.randint(0,2)
        $ krogTrader.wares += [GAME.items["ITMAddOnEngine"]]*random.randint(0,2)
        $ krogTrader.wares += [GAME.items["ITMEngineMkII"]]*random.randint(0,1) 

        if GAME.mc.attr["NOT"] >= 15:
            $ krogTrader.wares += [GAME.items["ITMEternium"]]*random.randint(0,2) 

    # special bookkeeping
    if GAME.questSys.inProgress('QID_TRIS_PET_TRADE'):
        $ exclusiveGoodsStart = [x for x in krogTrader.wares if "exclusive" in x.attr.keys()] 
        $ krellGoodsStart = [x for x in exclusiveGoodsStart if x.attr["exclusive"] in ["SSIDArellarti"]]

    # transactions
    call cargo_manager(krogTrader, [], {"title": "KROGNEATHS'S EMPORIUM"}) from _call_cargo_manager_4 

    # special bookkeeping
    if GAME.questSys.inProgress('QID_TRIS_PET_TRADE'):
        $ exclusiveGoodsEnd = [x for x in krogTrader.wares if "exclusive" in x.attr.keys()] 
        $ krellGoodsEnd = [x for x in exclusiveGoodsEnd if x.attr["exclusive"] in ["SSIDArellarti"]]
        $ delta = len(krellGoodsEnd) - len(krellGoodsStart) 
        if delta > 0:
            $ GAME.mc.tallyUp("Krogneath Delivery",delta)
            if GAME.mc.getTally("Krogneath Delivery") < 100:
                $ krog_tonsleft = 100 - GAME.mc.getTally("Krogneath Delivery")
                queue sound "audio/notify.wav"
                kro "\"Excellent!\""
                kro "\"Just what I needed.\""
                kro "\"Don't forget to bring me the rest of the shipment.\""
                mc "{i}*Thinking*\nBy my count, I still need to deliver another [krog_tonsleft] tons...{/i}"
            else:
                queue sound "audio/notify.wav"
                kro "\"Excellent!\""
                kro "\"The delivery is complete.\""
                kro "\"Take that as a token of appreciation.\""
                $ item = GAME.items["ITMVoucherPet1"]
                queue sound "audio/success.wav"
                call find_notify(item, "ITEM RECEIVED") from _call_find_notify_39 
                $ GAME.mc.addItem(item.ID)    
                kro "\"It is left over from training my latest pet.\""
                kro "\"She was a quicker learner than expected...\""
                mc "\"Where can I redeem that voucher?\""
                kro "\"Show it to the Pet Trainer in Arellarti Station.\""
                kro "\"He runs the Pet Shop there.\""
                mc "\"Thank you.\""

    # cleanup
    if GAME.money == mPrior:
        mc "\"Ahem, ...I can't make up my mind right now.\""
        "Krogneath" "\"Don't waste my time, Human!\""
    else:
        "Krogneath" "\"To future business!\""

    stop music fadeout 1.0
    scene expression("room_pirate_dock") with fade
    call quest_updater() from _call_quest_updater_174 
    $ GAME.galleryAdd(39)
    return()

#####################################################################
#              TERI TRADER
#####################################################################