//=================================================================
//**** 变量 ------------------------------------------------------------------
OnNotifyUserInfo : void
{
    nikname = OR(reference0 , reference1 , "username")
    fullname = OR(reference1 , reference0 , "username")
    if !zitai ; zitai = "default"
    if !mamuzitaiNn ; mamuzitaiNn = zitai
    if !mamuzitaiNa ; mamuzitaiNa = "default"
    username = "\f[name,%(mamuzitaiNa)]%(nikname)\f[name,%(mamuzitaiNn)]"
    userFullname = "\f[name,%(mamuzitaiNa)]%(fullname)\f[name,%(mamuzitaiNn)]"
    userbirthday = SPLIT(reference2,',') //用户生日
    case reference3 {
        when "male" { usersex = "♂男" ; userimg = "cnuser1" }
        when "female" { usersex = "♀女" ; userimg = "cnuser2" }
        when "undef" { usersex = "⚲卡针人 (其他性别) " ; userimg = "cnuser3" }
    }
}
OnNotifyShellInfo : void
{ shellkeilo = reference1 }
aoi
{
    //系统变量
    aitalkinterval = 0    //说话频率
    zitai = "default"  //字体
    mamuzitaiNa = "default"  //名字字体·前
    mamuzitaiNn = zitai  //名字字体·后
    pakeilo = GETSETTING(2)    //人格ghost路径
    aoiexe = "音乐播放器"
    nieexe = "视频播放器"
    saoexe = "第三程序"
    lediokeilo = "D:\uewis\qiqiue\TTPlayer.exe"   //音乐打开路径
    fodeiakeilo = "D:\fodeia\暴风影音\StormPlayer9\StormPlayer9.exe"   //视频打开路径
    saokeilo = "F:\NeatReader\NeatReader.exe"   //打开路径
    palvol = 50    //音量
    sqloridllpath = "saori\sqlori.dll"   //sqlori路径
    
    bsus = 0    //bosrc表情
    gsus = 20   //gent表情
}
kawaii
{
    //状态
    san = TOREAL(100.0)
    hasa = 0    //光玉
    Pulosu = RAND(51)+50    //抑郁
    Puwasn = RAND(51)+50    //焦虑
    Pulosa = RAND(51)+50    //躁狂
    Puoleij = RAND(51)+50    //疼痛
    Pusozn = RAND(51)+50    //耐受
    f9pluslis = (0,0,0,0,0)    //吃药增加的状况图标
    oudata = (Pulosu,Puwasn,Pulosa,Puoleij,Pusozn)    //用于图表
    
    //剧情
    gentsue = 0    //了解gent
    bosrcsue = 0    //了解bosrc
    pont = 0    //剧情计数
    
    //信物
    monolist = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
    
    //好感度
    intimacy = 0
    intimacy2 = 0
}
//=================================================================
//**** 启动文本 ------------------------------------------------------------------
sasa
{ 
    void SAORI('saori\lunar.dll',year,month,day)
    void reNului
    if wisjikan(month) == userbirthday[1] && wisjikan(day) == userbirthday[2] 
    {   "\![sound,play,mp3\0225.ogg,--volume=%(palvol)]/
        祝你生日快乐♫，祝你生日快乐♪，祝你生日快~乐♭~，祝你生日快乐！/
        生日快乐！%(username)~" }
    elseif "除夕" _in_ TOSTR(valueex1) || "春节" _in_ TOSTR(valueex1) { "新年快乐，%(username)放假了吗？祝%(username)万事顺利！心想事成！" }
    elseif "端午节" _in_ TOSTR(valueex1) { "粽子？没有吃过，听说还分为咸的、甜的，这是在指中间的陷呢，还是外面的糯米呢？" }
    elseif "中秋节" _in_ TOSTR(valueex1) { "听说这时候是月亮最圆的时候，但是厄尔科斯很少能看到月亮……" }
    elseif "元旦" _in_ TOSTR(valueex1) { "新年快乐！又踏进新的一年了，感觉时间过得很慢，但是身边的事物却变得很快。" }
    elseif "世界精神卫生日" _in_ TOSTR(valueex1) { "%(username)节日快乐！身体好点了吗？很想和你到处去走走呢。" }
    elseif "万圣节" _in_ TOSTR(valueex1) { "%(username)喜欢吃糖吗？今年的万圣节就由我来给你糖吧~" }
    elseif "圣诞节" _in_ TOSTR(valueex1) { "今年的商场也很努力呢~接下来去哪里吃？" }
    else { if RAND(2) ; boottime ; else ; boottia }
}
boottime
{
    if hour == 7 ; "明けまし (⑅˃◡˂⑅) 黎明来了"
    elseif 12 > hour && hour > 7 ; "おはよう ヾ(❀╹◡╹)ﾉ~ 早上好"
    elseif hour == 12 ; "こんにちは ヾ(❀╹◡╹)ﾉ~ 中午好"
    elseif 17 > hour && hour >12 ; "こんにちは ヾ(❀╹◡╹)ﾉ~ 下午好"
    elseif hour == 17 ; "夕暮 ꒰ঌ( ' ')໒꒱ 黄昏到了"
    elseif 22 > hour && hour > 17 ; "こんばんは (づ◡ど) 晚上好"
    elseif 4 > hour && hour >= 0 ; "クカオフェリア ⸜(๑'ᵕ'๑)⸝⋆* 深夜好"
    elseif 6 >hour && hour >= 3 ; "ドゥダフェリア (づ◡ど) 重夜好"
    else ; "おやすみ (¦3[▓▓] 晚安"
}
boottia
{
    if hour == 6 ; "abulu ieo! ✧*｡٩(ˊᗜˋ*)و✧* 空间震安好！"
    elseif 13 > hour && hour > 6 ; "sa salia ヾ(❀╹◡╹)ﾉ~ 安加利亚，早上好"
    elseif 19 > hour && hour >= 13 ; "sa setolia (,,•́ . •̀,,) 瑟多维娜，下午好"
    elseif 21 > hour && hour >= 19 ; "felia (⑅˃◡˂⑅) 晚上好"
    elseif 4 > hour && hour >= 0 ; "sa kukaufelia ⸜(๑'ᵕ'๑)⸝⋆* 深夜好"
    elseif 6 >hour && hour >= 3 ; "sa dudafelia \f[name,%(zitai)](づ◡ど) 重夜好"
    else ; "wajalia~ (¦3[▓▓] 瓦加利亚，晚安。"
}
baibai
{
    "\0\s[%(bsus+4)]"
    --
    "那么……晚安。"
    "明天见~"
    "さよらな~"
    "バイバイ"
    "%(username)不要勉强自己。"
    "晚安。"
    "晚安……"
    "ba nei ~"
}
OnWindowStateRestore
{
    "\0\s[%(bsus+4)]"
    --
    "那我们继续。"
    "\s[%(bsus+7)]发生了什么事吗？"
    "lepa"
    "\s[%(bsus+2)]%(username)身体还好吗？"
    "\s[%(bsus+2)]%(username)没事吧……"
}

//**** 启动函数 ------------------------------------------------------------------
OnFirstBoot
{ aoi ; kawaii ; Naoiboot }
OnBoot
{ OnMenu(sasa) }
OnClose
{ baibai+"\-\e" }
OnCloseAll
{ baibai+"\-\e" }
//=================================================================
//**** 刷新 ------------------------------------------------------------------
OnSurfaceRestore
{ Onuesueiapa }
Onuesueiapa
{
    if gentsue == 4 && pont >=3 { "\0\s[0]\1\s[20]\e" }
    else { "\1\s[10]\0\s[0]\e" }
}
OnMinuteChange
{ Onuesueiapa }




//=================================================================
//**** 沟通框 ------------------------------------------------------------------
OnCommunicate
{
    "\0\s[%(bsus)]\f[name,%(zitai)]"
    --
    if reference0 == "user" || reference0 == "User"
    {    
        if reference1 == ""
        {}
        elseif reference1 == "rd" { "\![reload,ghost]" }
        elseif "我问" _in_ reference1 && "你答"  _in_  reference1 { QosInsert("%(reference1)") }
        elseif "看看我问" == reference1 { QosSelectAll }
        elseif "删除我问" _in_ reference1 && reference1 != "删除我问" { _delqos = SPLIT(reference1,"删除我问") ; QosDelete("%(_delqos[1])") }
        elseif (_sus = QosSelect("%(reference1)")) { _sus }
        elseif (_dt=SPLIT(reference1,"dt "))[1] && Chkdt(reference1) { "\![raise,Oncountchange,%(EVAL(_dt[1]))]" }
        elseif (_n=SPLIT(reference1,"n "))[1] && CHRCODE(reference1)==110 { delokfolos(_n[1]) }
        elseif !RE_GREP(reference1,"\D")
        { if reference1 == 0 ; "关闭随机对话\e%(aitalkinterval = reference1)" ; else ; "随机说话时长：%(aitalkinterval = reference1)秒" }
        elseif RE_GREP(reference1,"\d+(小时|天|日|星期|月|年)+(前|后)+$") {
            _a = RE_GETSTR()
            _a = TOSTR(_a)
            _b = RE_SPLIT(_a,'\D')
            _num = TOINT(_b[0])
            _unit = ""
            _dir = ""
            _target = 0
            _seconds = 0
            if "小时" _in_ _a { _unit = "小时" }
            if "天" _in_ _a || "日" _in_ _a { _unit = "天" }
            if "星期" _in_ _a { _unit = "星期" }
            if "月" _in_ _a { _unit = "月" }
            if "年" _in_ _a { _unit = "年" }
            if "前" _in_ _a { _dir = "前" }
            if "后" _in_ _a { _dir = "后" }
            _now = GETSECCOUNT(year, month, day, 0, hour)
            if _unit == "小时" { _seconds = _num * 3600 }
            if _unit == "天" { _seconds = _num * 86400 }
            if _unit == "星期" { _seconds = _num * 604800 }
            if _unit == "月" { _seconds = _num * 2592000 }
            if _unit == "年" { _seconds = _num * 31536000 }
            if _dir == "前" ; _target = _now - _seconds ; else ; _target = _now + _seconds ;
            _target_time = GETTIME(_target)
            "%(_target_time[0])年%(_target_time[1])月%(_target_time[2])日%(_target_time[4])点" }
        elseif ((_lem = ARRAYSIZE(_tmp = SPLIT(reference1,"，"))) > 1) {
            "从（"+TOSTR(_tmp)+"）中选择的是："+EXIF(_tmp[RAND(_lem)],,'""') }
        else{ if ISEVALUABLE(reference1) ; EXIF((_sus = EVAL(reference1)),_sus,reference1) ; else ; reference1 ; }
    }else{ AYATEMPLATE.ExecuteReplyToTalk(reference0) }
}
StartCommunicate
{
    //---- 決定對話的對象人格
    if ghostexcount > 0
    {
        // res_reference0 指定人格清單中的對話對象 一定要是这个变量名
        res_reference0 = ghostexlist[RAND(ghostexcount)]
        _name = SPLIT(res_reference0,'')[0]    //将要对话的人格名
        "\0\s[%(bsus)]"+srsasa
	}else{
        "\0\s[%(bsus)]没人在呢。真安静呀。"
    }
}



//=================================================================
//**** 双击 ------------------------------------------------------------------
OnMouseDoubleClick
{
    if reference3 == 0 
    {   case reference4 {
            when "脸" { "\0\s[%(bsus+1)]怎么样？舒服点了吗？" }
            when "脖子" { "\0\s[%(bsus+2)]我脖子上没东西吧" }
            when "头" { "\0\s[%(bsus+4)]想摸摸我的头吗？来吧！" }
            when "右手" { "\0\s[%(bsus+4)]嗯，我会牵住你的手的" }
            when "左手" { "\0\s[%(bsus+4)]手指被人摆来摆去，很奇妙的感觉" } 
            other { tea = 0 ; OpenMenu }
    }}else{   case reference4 {
                when "左手" { "\1\s[%(gsus+2)]啊……左手很早之前就不能用了，所以就截了" }
                when "右手" { "\1\s[%(gsus+1)]想和我握手吗？我的手温度可能不是很高" }
                when "欧派" { "\1\s[%(gsus+1)]呀，那是垫的……你信吗？" }
                when "脸" { "\1\s[%(gsus+4)]我的脸可没波斯尔泰那么柔软哦" }
                when "头" { "\1\s[%(gsus+4)]嗯，我也摸摸你的头吧，大家都应该被好好对待" }
                when "脖子" { "\1\s[%(gsus)]呃……这里或许会比较敏感一点" }
                other { tea = 1 ; OpenMenu }
    }}
}



//=================================================================
//**** 按键 ------------------------------------------------------------------
OnKeyPress
{
    //——————————————————F1-F12————————————————————
    if reference0 == "f1" 
    { OnOpenfile(pakeilo+'img/f1.png')+"\![open,readme]" } //打开说明文档
    if reference0 == "f2" 
    { OnOpenfile(pakeilo+'img/f2.png')" } //打开说明文档
    elseif reference0 == "f9" 
    { "\![open,aigraph]" } //開啟AI圖表
    elseif reference0 == "f11" 
    { if SAORI("saori\screencatch.dll") ; "\0\f[name,%(zitai)]\s[%(bsus)]截图成功！请使用Photoshop粘贴图片" } //截图到粘贴板
    elseif reference0 == "f12" 
    { void MKDIR("var") ; _today = REPLACE(TOSTR(GETTIME(GETSECCOUNT())),',','') ;
    if 'OK' _in_ SAORI("saori\screenshot.dll","%(GETSETTING(2))var\%(_today).bmp") ;
    "\0\f[name,%(zitai)]\s[%(bsus)]截图成功！\![open,file,%(GETSETTING(2))var\%(_today).bmp]" ; 
    else ; "\0\f[name,%(zitai)]\s[%(bsus)]截图失败："+valueex0 } //截图到本地文件
    //——————————————————z、x、o、c、v、t————————————————————
    elseif reference0 == "z" 
    { playerbody }
    elseif reference0 == "x" 
    { OpenMenu }
    elseif reference0 == "o" 
    { OpenClock }
    elseif reference0 == "c" 
    { if !sca ; "\0\![set,scaling,-100,100]\e%(sca=1)" ; else ; "\0\![set,scaling,100,100]\e%(sca=0)" }  //反转
    elseif reference0 == "v" 
    { if !scb ; "\1\![set,scaling,-100,100]\e%(scb=1)" ; else ; "\1\![set,scaling,100,100]\e%(scb=0)" }  //反转
    elseif reference0 == "t" 
    { if !tor ; "\![set,windowstate,stayontop]\e%(tor=1)" ; else ; "\![set,windowstate,!stayontop]\e%(tor=0)" }  //总是在前
    elseif reference0 == "r" 
    { void FDEL("%(shellkeilo)profile/shell.dat") ; void FDEL("%(shellkeilo)profile/shell.dat.bak") ;
    void RMDIR("%(shellkeilo)profile") ; "\![reload,descript,shell]\![reload,shell]" }  //总是在前
    //——————————————————空格、回车、esc、+、-、[、]————————————————————
    elseif reference0 == "return"
    { "\__c" }
    elseif reference0 == "space"
    { Onuesueiapa }
    elseif reference0 == "escape"
    { "\![close,communicatebox]" }
    elseif reference0 == "=" 
    { void Onmusicvol(1) ; "音量加1；%(palvol)/100" }
    elseif reference0 == "-" 
    { void Onmusicvol(-1) ; "音量减1；%(palvol)/100" }
    elseif reference0 == "]" 
    { OnBrightness(10) }
    elseif reference0 == "["
    { OnBrightness(-10) }
}



//=================================================================
//**** 図表 ------------------------------------------------------------------
//---------------AI図表配置
//On_getaistateex    支持多页
//reference0 = 0 ; 不是最后一页的情况 13组数据 是最后一页的情况 9组数据
//reference0 = 1 ; 第一页 不是最后一页的情况 15组数据 是最后一页的情况 11组数据 reference0 = 2以下相同
//正确用法：    "(初始值)(显示名)(增加值)(最大值)"
On_getaistate
{ "/
    %(TOSTR(oudata))/
    抑郁,焦虑,躁狂,疼痛,耐受/
    %(TOSTR(f9pluslis))/
    100,100,100,100,100/
" }



