Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Sep 28, 2023
1 parent bafdbbc commit 5a1d0a2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CGAssistant/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ int main(int argc, char *argv[])

QCommandLineOption consolemaxlines("consolemaxlines", "", "consolemaxlines", "100");

QCommandLineOption scriptfreezeduration("scriptfreezeduration", "", "scriptfreezeduration", "60");

QCommandLineOption chatmaxlines("chatmaxlines", "", "chatmaxlines", "100");

QCommandLineParser parser;
Expand Down Expand Up @@ -147,6 +149,7 @@ int main(int argc, char *argv[])
parser.addOption(loadsettings);
parser.addOption(killfreeze);
parser.addOption(consolemaxlines);
parser.addOption(scriptfreezeduration);
parser.addOption(chatmaxlines);
parser.process(a);

Expand Down Expand Up @@ -287,7 +290,8 @@ int main(int argc, char *argv[])
parser.isSet(scriptfreezestop) ? true : false,
parser.isSet(injuryprotect) ? true : false,
parser.isSet(soulprotect) ? true : false,
parser.value(consolemaxlines).toInt() );
parser.value(consolemaxlines).toInt(),
parser.value(scriptfreezeduration).toInt() );

w.NotifyFillLoadSettings(parser.value(loadsettings));

Expand Down
2 changes: 1 addition & 1 deletion CGAssistant/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MainWindow : public QMainWindow
bool autologin, bool skipupdate, bool autochangeserver,bool autokillgame,
bool create_chara, int create_chara_chara, int create_chara_eye, int create_chara_mou, int create_chara_color,
QString create_chara_points, QString create_chara_elements, QString create_chara_name);
void NotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines);
void NotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration);
void NotifyFillLoadSettings(QString path);
void NotifyFillStaticSettings(int freezetime, int chatmaxlines);
void HttpGetGameProcInfo(QJsonDocument* doc);
Expand Down
17 changes: 16 additions & 1 deletion CGAssistant/scriptform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ void ScriptForm::OnNotifyAttachProcessOk(quint32 ProcessId, quint32 ThreadId, qu
qputenv("CGA_GAME_PORT", qportString);
}

void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines)
void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration)
{
if(!path.isEmpty())
{
Expand Down Expand Up @@ -572,7 +572,10 @@ void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool free
if(freezestop)
ui->checkBox_freezestop->setChecked(true);

ui->horizontalSlider_freezeDuration->setValue(scriptfreezeduration);

m_ConsoleMaxLines = consolemaxlines;

m_output->setMaximumBlockCount(m_ConsoleMaxLines);
}

Expand Down Expand Up @@ -692,6 +695,18 @@ void ScriptForm::OnHttpLoadScript(QString query, QByteArray postdata, QJsonDocum
ui->checkBox_soulProt->setChecked(qsoulprot.toBool());
}
}
if(newobj.contains("freezestop")){
auto freezestop = newobj.take("freezestop");
if(freezestop.isBool()){
ui->checkBox_freezestop->setChecked(freezestop.toBool());
}
}
if(newobj.contains("freezeduration")){
auto scriptfreezeduration = newobj.take("scriptfreezeduration");
if(scriptfreezeduration.toInt() >= 10 && scriptfreezeduration.toInt() <= 600 ){
ui->horizontalSlider_freezeDuration->setValue(scriptfreezeduration.toInt());
}
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion CGAssistant/scriptform.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public slots:
void on_pushButton_run_clicked();
void on_pushButton_debug_clicked();
void on_pushButton_term_clicked();
void OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines);
void OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration);
void RunNavigatorScript(int x, int y, int enter, QString *result);
void StopNavigatorScript();
void OnHttpLoadScript(QString query, QByteArray postdata, QJsonDocument* doc);
Expand Down

0 comments on commit 5a1d0a2

Please sign in to comment.