Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Feb 25, 2024
1 parent 6de4384 commit 7d73072
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 102 deletions.
53 changes: 36 additions & 17 deletions CGAssistant/chatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ChatForm::ChatForm(QWidget *parent) :
ui->textEdit_chat->document()->setMaximumBlockCount(m_ChatMaxLines);

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(OnAutoChat()));
connect(timer, SIGNAL(timeout()), this, SLOT(OnTimer()));
timer->start(1000);
}

Expand All @@ -25,11 +25,22 @@ ChatForm::~ChatForm()
delete ui;
}

void ChatForm::OnAutoChat()
void ChatForm::OnTimer()
{
if(g_CGAInterface->IsConnected())
{
g_CGAInterface->SetBlockChatMsgs((int)ui->checkBox_BlockChatMsgs->checkState());
switch(ui->checkBox_BlockChatMsgs->checkState())
{
case Qt::CheckState::Checked:
g_CGAInterface->SetBlockChatMsgs(2);
break;
case Qt::CheckState::PartiallyChecked:
g_CGAInterface->SetBlockChatMsgs(1);
break;
case Qt::CheckState::Unchecked:
g_CGAInterface->SetBlockChatMsgs(0);
break;
}
}
}

Expand Down Expand Up @@ -165,20 +176,17 @@ bool ChatForm::ParseChatSettings(const QJsonValue &val)
if(obj.contains("blockchatmsgs"))
{
int val = obj.take("blockchatmsgs").toInt();
if(1)
if(val == 2)
{
if(val == 2)
{
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::Checked);
}
else if(val == 1)
{
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::PartiallyChecked);
}
else if(val == 0)
{
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::Unchecked);
}
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::Checked);
}
else if(val == 1)
{
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::PartiallyChecked);
}
else if(val == 0)
{
ui->checkBox_BlockChatMsgs->setCheckState(Qt::CheckState::Unchecked);
}
}

Expand All @@ -194,7 +202,18 @@ void ChatForm::on_checkBox_BlockAllChatMsgs_stateChanged(int state)
{
if(g_CGAInterface->IsConnected())
{
g_CGAInterface->SetBlockChatMsgs(state);
switch(state)
{
case Qt::CheckState::Checked:
g_CGAInterface->SetBlockChatMsgs(2);
break;
case Qt::CheckState::PartiallyChecked:
g_CGAInterface->SetBlockChatMsgs(1);
break;
case Qt::CheckState::Unchecked:
g_CGAInterface->SetBlockChatMsgs(0);
break;
}
}
}

2 changes: 1 addition & 1 deletion CGAssistant/chatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private slots:

void on_checkBox_BlockAllChatMsgs_stateChanged(int state);

void OnAutoChat();
void OnTimer();
private:
Ui::ChatForm *ui;
QSharedPointer<CGA_PlayerInfo_t> m_player;
Expand Down
3 changes: 3 additions & 0 deletions CGAssistant/chatform.ui
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Partially Checked: Block chat from non-teammates.&lt;/p&gt;&lt;p&gt;Fully Checked: Block chat from all players.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
Expand Down
Binary file modified CGAssistant/lang.qm
Binary file not shown.
32 changes: 24 additions & 8 deletions CGAssistant/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,15 @@ Chat database will not work properly.</source>
</message>
<message>
<source>Block all chat messages</source>
<translation type="unfinished">屏蔽所有聊天消息</translation>
<translation type="obsolete">屏蔽所有聊天消息</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Partially Checked: Block chat from non-teammates.&lt;/p&gt;&lt;p&gt;Fully Checked: Block chat from all players.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;半勾状态:屏蔽来自非队友的聊天消息。&lt;/p&gt;&lt;p&gt;完全勾选:屏蔽来自任何玩家的聊天消息。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Block chat messages</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -1013,7 +1021,7 @@ p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;SimSun&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/logo.png&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; color:#40485b; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; color:#40485b; background-color:#ffffff;&quot;&gt;当前版本:2023-09-28&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; color:#40485b; background-color:#ffffff;&quot;&gt;当前版本:2024-02-25&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; color:#40485b; background-color:#ffffff;&quot;&gt;下载最新版本:群号 300303705&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; color:#40485b; background-color:#ffffff;&quot;&gt;或 &lt;/span&gt;&lt;a href=&quot;https://github.com/hzqst/CGAssistant/&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; text-decoration: underline; color:#005980; background-color:transparent;&quot;&gt;https://github.com/hzqst/CGAssistantJS/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:160%; background-color:#ffffff;&quot;&gt;&lt;a href=&quot;https://github.com/hzqst/CGAssistantJS/issues&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; text-decoration: underline; color:#005980; background-color:transparent;&quot;&gt;或 &lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/hzqst/CGAssistant/&quot;&gt;&lt;span style=&quot; font-family:&apos;-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Liberation Sans,PingFang SC,Microsoft YaHei,Hiragino Sans GB,Wenquanyi Micro Hei,WenQuanYi Zen Hei,ST Heiti,SimHei,SimSun,WenQuanYi Zen Hei Sharp,sans-serif&apos;; font-size:16px; text-decoration: underline; color:#005980; background-color:transparent;&quot;&gt;https://gitee.com/hzqst/CGAssistantJS/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
Expand Down Expand Up @@ -1794,15 +1802,15 @@ error: %1</source>
</message>
<message>
<source>Nothing</source>
<translation type="unfinished">无</translation>
<translation>无</translation>
</message>
<message>
<source>MagicSealing</source>
<translation type="unfinished">魔法封印</translation>
<translation>魔法封印</translation>
</message>
<message>
<source>FieldStatus %1%2</source>
<translation type="unfinished"></translation>
<translation>场地状态 %1%2</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -1947,15 +1955,15 @@ Check &quot;chrome://inspect&quot; in chrome to debug the node process.</source>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Full-Checked: auto restart script no matter what.&lt;/p&gt;&lt;p&gt;Semi-Checked: auto restart script only when not in battle status.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;完全勾选:战斗和非战斗状态下均自动重启脚本。&lt;/p&gt;&lt;p&gt;半勾状态:只在非战斗状态下自动重启脚本。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;完全勾选:战斗和非战斗状态下均自动重启脚本。&lt;/p&gt;&lt;p&gt;半勾状态:只在非战斗状态下自动重启脚本。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Freeze Duration</source>
<translation>静止超时时间</translation>
</message>
<message>
<source>Freeze Duration in Seconds.</source>
<translation type="unfinished">人物静止自动停止脚本的超时时间,以秒为单位。</translation>
<translation>人物静止自动停止脚本的超时时间,以秒为单位。</translation>
</message>
<message>
<source>Stop script when injury.</source>
Expand All @@ -1967,11 +1975,19 @@ Check &quot;chrome://inspect&quot; in chrome to debug the node process.</source>
</message>
<message>
<source>Stop script when player freeze.</source>
<translation>人物一定时间超过一定时间静止不动时自动停止脚本。</translation>
<translation type="vanished">人物一定时间超过一定时间静止不动时自动停止脚本。</translation>
</message>
<message>
<source>Freeze Duration: %1 s</source>
<translation>静止超时时间:%1秒</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Full-Checked: Restart script no matter what.&lt;/p&gt;&lt;p&gt;Partially-Checked: Restart script only when current player is not in battle status.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;完全勾选:战斗和非战斗状态下均自动重启脚本。&lt;/p&gt;&lt;p&gt;半勾状态:只在非战斗状态下自动重启脚本。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Full-Checked: Stop script when current player&apos;s position stays unchanged for &amp;lt;Freeze Duration&amp;gt; seconds no matter what.&lt;/p&gt;&lt;p&gt;Partially-Checked: Stop script when current player&apos;s position stays unchanged for &amp;lt;Freeze Duration&amp;gt; seconds only if current player is not in battle state.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;当前坐标和地图在&quot;静止超时时间&quot;内没有任何变化就自动登出并停止脚本。&lt;/p&gt;&lt;p&gt;完全勾选:战斗和非战斗状态下都会自动停止脚本。&lt;/p&gt;&lt;p&gt;半勾状态:只在非战斗状态下自动停止脚本。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
</TS>
17 changes: 3 additions & 14 deletions CGAssistant/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int main(int argc, char *argv[])

QCommandLineOption scriptfreezestop("scriptfreezestop");

QCommandLineOption scriptautoterm("scriptautoterm");
QCommandLineOption scriptfreezestop2("scriptfreezestop2");

QCommandLineOption injuryprotect("injuryprotect");

Expand All @@ -116,8 +116,6 @@ int main(int argc, char *argv[])

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

QCommandLineOption blockchatmsgs("blockchatmsgs", "", "blockchatmsgs");

QCommandLineParser parser;

parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
Expand All @@ -143,17 +141,16 @@ int main(int argc, char *argv[])
parser.addOption(createcharaname);
parser.addOption(loadscript);
parser.addOption(scriptfreezestop);
parser.addOption(scriptfreezestop2);
parser.addOption(scriptautorestart);
parser.addOption(scriptautorestart2);
parser.addOption(scriptautoterm);
parser.addOption(injuryprotect);
parser.addOption(soulprotect);
parser.addOption(loadsettings);
parser.addOption(killfreeze);
parser.addOption(consolemaxlines);
parser.addOption(scriptfreezeduration);
parser.addOption(chatmaxlines);
parser.addOption(blockchatmsgs);
parser.process(a);

QTranslator translator;
Expand Down Expand Up @@ -291,20 +288,12 @@ int main(int argc, char *argv[])

w.NotifyFillLoadScript(parser.value(loadscript),
parser.isSet(scriptautorestart2) ? 2 : ( parser.isSet(scriptautorestart) ? 1 : 0 ) ,
parser.isSet(scriptfreezestop) ? true : false,
parser.isSet(scriptfreezestop2) ? 2 : ( parser.isSet(scriptfreezestop) ? 1 : 0 ),
parser.isSet(injuryprotect) ? true : false,
parser.isSet(soulprotect) ? true : false,
parser.value(consolemaxlines).toInt(),
parser.value(scriptfreezeduration).toInt() );

bool bHasBlockchatmsgs = false;
int val_blockchatmsgs = -1;
if(parser.isSet(blockchatmsgs))
{
val_blockchatmsgs = parser.value(blockchatmsgs).toInt(&bHasBlockchatmsgs);
}
w.NotifyFillChatSettings(val_blockchatmsgs);

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

return a.exec();
Expand Down
Loading

0 comments on commit 7d73072

Please sign in to comment.