define persistent.whatsThisMttkMod = "mttkMod 1.3.D8-14 v1.0 /DM for - Ecchi Sensei  - D8-14 v1.0 /DM -   open source and public domain and not fit for anything"#var not to be used, just have some "comment surviving decompilation"

define mttkModLicense = """THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."""


##make show-warning selectable ; inc-mod-ver-chk
##org is in: gui/splash_screen.rpy
##is overridden
label splashscreen_mttkMod:
    if not("Ecchi Sensei "==config.name and (config.version in ["D8-14 v1.0", "D8-14 v1.0 DM"])):
        $ mttkModDefTextThIsWronGameVer()
        "...exiting game..."
        $ renpy.quit(relaunch=False, status=0, save=False)
    if persistent.mttkModBoolShowSplashScreen:
        show warning01 with fade
        pause
        play sound warning
        hide warning01
        show warning02
        pause
        hide warning02
        show warning03
        pause
        hide warning03
    if not persistent.chose_lang:
        call screen config_language(firsttime=True)
        $ persistent.chose_lang = True
    call DMcheck
    #call earlywarning#just checked, s.u., this must be v1.0
    return


init python:
    if persistent.mttkModBoolQuitConfirm==None:
        persistent.mttkModBoolQuitConfirm = True
    _confirm_quit = persistent.mttkModBoolQuitConfirm
    config.quit_action = Quit(confirm=persistent.mttkModBoolQuitConfirm)
    if persistent.mttkModBoolShowSplashScreen==None:
        persistent.mttkModBoolShowSplashScreen = True
    if persistent.mttkModStrQuickMenuStyle==None:
        persistent.mttkModStrQuickMenuStyle = "full"

    def mttkModDefTextThIsWronGameVer():#from support
        ui.frame(xalign=0.5, yalign=0.5, padding=(30, 30), background="#000000")
        ui.vbox()
        ui.text("{color=#fff}------{/color}")
        ui.text("{color=#fff}WRONG mod([persistent.mttkModdedGameName]) or version([persistent.mttkModdedVersionsList]){/color}")
        ui.text("{color=#fff}for this game([config.name]) -version([config.version])! Please close this game and{/color}")
        ui.text("{color=#fff}{size=+10}delete all *MttkMod*.*-files and -folders,{/size}{/color}")
        ui.text("{color=#fff}from the game-folder of this game([config.name]).{/color}")
        ui.text("{color=#fff}Then you can play the game without wrong mod.{/color}")
        ui.text("{color=#fff}------{/color}")
        ui.close()
        return

##std styles
style mttkModStyN_text:
    size 33##game-specific   this game:#gui.text_size = 33
style mttkModStyW_text is mttkModStyN_text:
    color "#fff"
    outlines [(2, "#000", 0, 0)]
style mttkModStyTxt_text is mttkModStyW_text:
    xalign 0.5
style mttkModStyTButt:
    xalign 0.5
style mttkModStyTButt_text is mttkModStyW_text:
    color "#ff8800"
    hover_color "#33aa33"


init offset=1

##game-specific Ecchi Sensei
##my mini-quick_menu---slim
##org is in: menu/screens.rpy
##is doubled
screen quick_menu():
    zorder 100
    if (quick_menu and persistent.mttkModStrQuickMenuStyle=="full"):
        hbox:
            style_prefix "quick"#"mttkModStyQuick"
            xalign 0.5
            yalign 1.0
            textbutton _("Back") action Rollback()
            textbutton _("History") action ShowMenu('history')
            textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
            textbutton _("Auto") action Preference("auto-forward", "toggle")
            textbutton _("Save") action ShowMenu('save')
            textbutton _("Q.Save") action QuickSave()
            textbutton _("Q.Load") action QuickLoad()
            textbutton _("Prefs") action ShowMenu('preferences')
    elif ((quick_menu and persistent.mttkModStrQuickMenuStyle=="mini-wo") or persistent.mttkModStrQuickMenuStyle=="mini-wo+"):
        hbox:
            style_prefix "quick"#"mttkModStyQuick"
            xalign 0.01
            yalign 1.0
            textbutton _("History") action ShowMenu('history')
            textbutton _("Skip") action Skip()
    #elif persistent.mttkModStrQuickMenuStyle=="off":
        #pass


##cheatMenuEntry2--> cheatMenuOptions---slim
##org is in: menu/screens.rpy
##is doubled
screen CheatMenu():
    add "menu/blueborder.png"
    if persistent.patched:
        if persistent.DM:
            textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#00FF00}ON{/color}{/b}") action [SetField(persistent, "DM",False),Hide("CheatMenu")] xalign 0.5 yalign 0.4#0.5
        if not persistent.DM:
            textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#FF0000}OFF{/color}{/b}") action [SetField(persistent, "DM",True),Hide("CheatMenu")] xalign 0.5 yalign 0.4#0.5

    else:
        textbutton "{b}{color=#ffffff}Dark Mind :{/color} {color=#FF0000}Not installed{/color}{/b}" action Hide("CheatMenu") xalign 0.5 yalign 0.4
    if persistent.mttkModBoolShowSplashScreen:
        textbutton "{b}disable{/b} showing of 18+ warning on game startup":
            style "mttkModStyTButt"
            yalign 0.5
            action SetField(persistent, "mttkModBoolShowSplashScreen", False)
    else:
        textbutton "{b}enable{/b} showing of 18+ warning on game startup":
            style "mttkModStyTButt"
            yalign 0.5
            action SetField(persistent, "mttkModBoolShowSplashScreen", True)
    if not persistent.mttkModBoolQuitConfirm:
        textbutton "re-{b}enable{/b} confirmation of quitting game":
            style "mttkModStyTButt"
            yalign 0.54
            action [SetField(persistent, "mttkModBoolQuitConfirm", True), SetVariable("_confirm_quit", True), SetField(config, "quit_action", Quit(confirm=True))]
    else:
        textbutton "{b}disable{/b} confirmation of quitting game":
            style "mttkModStyTButt"
            yalign 0.54
            action [SetField(persistent, "mttkModBoolQuitConfirm", False), SetVariable("_confirm_quit", False), SetField(config, "quit_action", Quit(confirm=False))]

    hbox:
        xalign 0.5
        yalign 0.58
        spacing 16
        text "QuickMenuStyle"+"(atm.{b}"+str(persistent.mttkModStrQuickMenuStyle)+"{/b}):" style "mttkModStyTxt_text"
        if persistent.mttkModStrQuickMenuStyle!="full":
            textbutton "Full":
                style "mttkModStyTButt"
                action [SetField(persistent, "mttkModStrQuickMenuStyle", "full"), SetVariable("quick_menu", True)]
        if persistent.mttkModStrQuickMenuStyle!="off":
            textbutton "OFF":
                style "mttkModStyTButt"
                action SetField(persistent, "mttkModStrQuickMenuStyle", "off")
        if persistent.mttkModStrQuickMenuStyle!="mini-wo":
            textbutton "mini-only":
                style "mttkModStyTButt"
                action SetField(persistent, "mttkModStrQuickMenuStyle", "mini-wo")
    textbutton "{b}BACK{/b}":
        style "mttkModStyTButt"
        yalign 0.66
        action Hide("CheatMenu")


##reenable notify...(e.g. for quicksave-feedback)
##org is in: menu/screens.rpy
##is doubled
screen notify(message):
    zorder 100
    style_prefix "notify"
    if (message=="contact" or message=="message"):
        frame at notify_appear:
            if message == "contact":
                add "notify"
            if message == "message":
                add "message_add"
    else:
        frame at notify_appear:
            xalign 0.0#xalign 1.03#would be ~ok~ .... but I prefer it left
            yalign 0.12#needs to done coz gui.notify_ypos = 68 is used up
            text "[message!tq]" color "#aaa" outlines [(1, "#000", 0, 0)]
    timer 3.5 action Hide('notify')


##added my beloved SPACE-key also 'q'&'Q' to quit ; put off the scrollbar in a normal manner ; made the contact you're just chatting with "online" ; removed the layer-statement so that "modal" now is working
##org is in: menu/gui.rpy
define gui.scrollbar_size = 13
##org is in: functions/phone/messager.rpy
##is doubled
screen messager(who, force=False):
    modal True
    #layer 'ecchi'#it is now on the layer 'screens'
    $ name = av_contacts[who]['name']
    if av_contacts[who]['online'] == True:
        $ status ="online"
    elif av_contacts[who]['online'] == False:
        if force:#I'd say this means the phone has been activated by the script not by the player from the toolbar
            $ status ="online"#and the I'd say your contact should not be "offline" (?)
        else:
            $ status ="offline"
    imagemap:
        ground "functions/images/phone/messengerphone.png"
        hover "functions/images/phone/messengerphone2.png"
        yalign 0.5 xalign 0.5
        if force:
            key "q" action [Hide('messager'),Function(t_skipall)]
            key "Q" action [Hide('messager'),Function(t_skipall)]
            hotspot (226, 1047, 142, 100) action [Hide('messager'),Function(t_skipall)]
        if not force:
            key "q" action [Hide('messager'),Function(t_skipall),Show("phone_contacts")]
            key "Q" action [Hide('messager'),Function(t_skipall),Show("phone_contacts")]
            hotspot (226, 1047, 142, 100) action [Hide('messager'),Function(t_skipall),Show("phone_contacts")]
        if not av_contacts[who]['incomming'] == []:
            if force:
                key "K_SPACE" action [Function(t_skip),Hide('messager'),Show('messager',None,who,force=True)]#I'm not senselessly mouse-clicking around...
                key "dismiss" action [Function(t_skip),Hide('messager'),Show('messager',None,who,force=True)]#s.u.
                hotspot (362, 710, 240, 367) action [Function(t_skip),Hide('messager'),Show('messager',None,who,force=True)]
                hotspot (0, 714, 232, 363) action [Function(t_skip),Hide('messager'),Show('messager',None,who,force=True)]
                hotspot (12, 711, 590, 336) action [Function(t_skip),Hide('messager'),Show('messager',None,who,force=True)]
            if not force:
                key "K_SPACE" action [Function(t_skip),Hide('messager'),Show('messager',None,who)]#s.u.
                key "dismiss" action [Function(t_skip),Hide('messager'),Show('messager',None,who)]#s.u.
                hotspot (362, 710, 240, 367) action [Function(t_skip),Hide('messager'),Show('messager',None,who)]
                hotspot (0, 714, 232, 363) action [Function(t_skip),Hide('messager'),Show('messager',None,who)]
                hotspot (12, 711, 590, 336) action [Function(t_skip),Hide('messager'),Show('messager',None,who)]
        if force:
            hotspot (36, 657, 518, 55) action [Function(t_skipall),Hide('messager'),Show('messager',None,who,force=True)]
        if not force:
            hotspot (36, 657, 518, 55) action [Function(t_skipall),Hide('messager'),Show('messager',None,who)]
    $ av_contacts[who]['incomming'] = filter(None, av_contacts[who]['incomming'])
    viewport:
        area (700,180,600,443)
        xminimum 300
        xmaximum 500
        xoffset 3
        yinitial 1.0
        draggable True
        mousewheel True
        scrollbars None#"vertical" #that easy it could have been...
        has vbox:
            first_spacing 30
            spacing 30
        text ""
        for messages in av_contacts[who]["messages"]:
            frame:
                if 0 in messages:
                    background Solid("#d9398ccd")
                if 1 in messages:
                    left_margin 200
                    background Solid("#10721dcd")
                    xsize 500
                vbox:
                    if "text" in messages:
                        $ message = messages[2]
                        text "{color=#ffffff}[message]{/color}" style "phone_message_what"
                    if "pic" in messages:
                        $ message = messages[2]
                        $ img = messages[3]
                        text "{color=#ffffff}[message]{/color}" style "phone_message_what"
                        imagebutton:
                            idle im.FactorScale(img,0.15,0.23)
                            hover im.FactorScale(img,0.15,0.23)
                            action Show('pic_view',pic=img)
        if len(av_contacts[who]["incomming"]) > 1:
            $ status ="online"##at LEAST as long as there are incoming messages(i.e. you're chatting at this very moment)...don't let her be "offline" #that'll leave out the very last message(s)...but imho better than having her "offline" all the time(?)
            frame:
                if av_contacts[who]["incomming"][0][0][1] == 0:
                    background Solid("#d9398c00")
                if av_contacts[who]["incomming"][0][0][1] == 1:
                    left_margin 390
                    background Solid("#10721d00")
                    xsize 500
                vbox:
                    add "wait2"
        else:
            pass
    $ heads_name = av_contacts[who]["profile"].split("/")[-1]
    add im.FactorScale("functions/images/heads/normal/"+heads_name,0.115) yalign 0.11 xalign 0.4
    add im.FactorScale("functions/images/phone/status_charprofile" + status +".png",0.41) yalign 0.106 xalign 0.4
    if name == "Sloth-chan":
        text "[name]" yalign 0.11 xalign 0.50 size 35
    else:
        text "[name]" yalign 0.11 xalign 0.48 size 35


##put off the scrollbar in a normal manner ; removed the layer-statement so that "modal" now is working ; btw. (imho) hiding the say-screen when showing this screen is no longer really neccesary
##org is in: functions/phone/phone.rpy
##is doubled
screen phone_contacts():
    #layer 'ecchi'#it is now on the layer 'screens'
    modal True
    imagemap:
        ground "functions/images/phone/phone1.png"
        hover "functions/images/phone/phone2.png"
        yalign 0.5 xalign 0.5
        hotspot (24, 631, 97, 47) action [Hide("phone_contacts"),Show("quick_menu")]
    vpgrid:
        area (752,268,330,520)
        xmaximum 1000
        yinitial 0.09
        cols 1
        spacing -40
        draggable True
        mousewheel True
        scrollbars None#"vertical"
        yfill False#ok...this needed 1 more Style Property
        for i in phone_contacts:
            $ head = av_contacts[i]['profile']
            $ name = av_contacts[i]['name']
            $ status = av_contacts[i]['online']
            hbox:
                spacing -35
                add "functions/images/phone/contactbar1.png" xpos 5
                add head xpos -318 ypos 37
                add "functions/images/phone/button_contactbar_" + str(status) + ".png" xpos -380 ypos 1
                textbutton "[name]" text_bold True xminimum 190 xmaximum 720 xpos -630 ypos 35 text_size 30 action [Show('messager',who = i),Hide('phone_contacts'),SetVariable("contact_name",i)]
                if not av_contacts[i]['incomming'] == []:
                    add "functions/images/phone/alert.png" xpos -818 ypos 30


##pot. not needed
init offset=0


init 11 python:
    if not hasattr(renpy.config, "label_overrides"):##extra-safety
        config.label_overrides = {}
    config.label_overrides['splashscreen']='splashscreen_mttkMod'



#eof

