diff --git a/Dice/BlackListManager.cpp b/Dice/BlackListManager.cpp index a8f54b07..cb9d7182 100644 --- a/Dice/BlackListManager.cpp +++ b/Dice/BlackListManager.cpp @@ -1184,7 +1184,7 @@ void DDBlackManager::verify(const fifo_json& pJson, long long operatorQQ) if (mark.type == "local" || mark.type == "other" || mark.isSource(console.DiceMaid)) { if (credit > 0)console.log( getName(operatorQQ) + "已通知" + getMsg("strSelfName") + "不良记录(未采用):\n!warning" + - pJson.dump()), 1, printSTNow(); + pJson.dump(), 1, printSTNow()); return; } } @@ -1218,7 +1218,7 @@ void DDBlackManager::verify(const fifo_json& pJson, long long operatorQQ) } if (mark.fromGID.first && (groupset(mark.fromGID.first, "忽略") > 0 || groupset(mark.fromGID.first, "协议无效") > 0 || ExceptGroups.count(mark.fromGID.first)))return; insert(mark); - console.log(getName(operatorQQ) + "已通知" + getMsg("strSelfName") + "不良记录" + to_string(vBlackList.size() - 1) + ":\n!warning" + pJson.dump()), 1, printSTNow(); + console.log(getName(operatorQQ) + "已通知" + getMsg("strSelfName") + "不良记录" + to_string(vBlackList.size() - 1) + ":\n!warning" + pJson.dump(), 1, printSTNow()); } else { @@ -1249,7 +1249,7 @@ void DDBlackManager::verify(const fifo_json& pJson, long long operatorQQ) if (mark.danger != old_mark.danger && credit < 3) { mark.danger = old_mark.danger; } - if(update(mark,index,credit))console.log(getName(operatorQQ) + "已更新" + getMsg("strSelfName") + "不良记录" + to_string(index) + ":\n!warning" + pJson.dump()), 1, printSTNow(); + if(update(mark,index,credit))console.log(getName(operatorQQ) + "已更新" + getMsg("strSelfName") + "不良记录" + to_string(index) + ":\n!warning" + pJson.dump(), 1, printSTNow()); } } diff --git a/Dice/DiceAttrVar.cpp b/Dice/DiceAttrVar.cpp index 86fdcb0f..5960028b 100644 --- a/Dice/DiceAttrVar.cpp +++ b/Dice/DiceAttrVar.cpp @@ -514,6 +514,7 @@ ByteS AttrVar::to_bytes()const { case Type::Integer: case Type::Number: case Type::ID: + case Type::GBTable: case Type::Table: case Type::Set: return {}; @@ -567,6 +568,8 @@ string AttrVar::print()const { case Type::U8String: return text; break; + case Type::GBTable: + return {}; case Type::Table: return table->print(); break; @@ -785,6 +788,7 @@ fifo_json AttrVar::to_json()const { break; case Type::Set: return ::to_json(*flags); + case Type::GBTable: case Type::Function: return {}; } @@ -1070,6 +1074,7 @@ void from_json(const fifo_json& j, AttrVars& vars) { void AttrVar::writeb(std::ofstream& fout) const { switch (type) { case Type::Nil: + case Type::GBTable: fwrite(fout, (char)0); break; case Type::Boolean: diff --git a/Dice/DiceEvent.cpp b/Dice/DiceEvent.cpp index 536ebf8c..b9bc007e 100644 --- a/Dice/DiceEvent.cpp +++ b/Dice/DiceEvent.cpp @@ -4260,7 +4260,9 @@ int DiceEvent::InnerOrder() { strAttr = readAttrName(); if (pc->countExp(strAttr)) { strMainDice += pc->getExp(strAttr); - if (!pc->has("&" + strAttr) && pc->get(strAttr).type == AttrVar::Type::Integer)strMainDice += 'a'; + } + else if (auto val{ pc->get(strAttr) };val.type == AttrVar::Type::Integer) { + strMainDice += val.to_str(); } else { strReason = strAttr; diff --git a/Dice/DiceLua.cpp b/Dice/DiceLua.cpp index fe91cdb1..ac2948cc 100644 --- a/Dice/DiceLua.cpp +++ b/Dice/DiceLua.cpp @@ -462,7 +462,7 @@ bool lua_call_task(const AttrVars& task) { // 转换为UTF8 string filename(GBKtoUTF8(file)); #else - string filename(luaFile); + string filename(file); #endif if (lua_pcall(L, 0, 0, 0)) { string pErrorMsg = lua_to_u8string_from_native(L, -1); diff --git a/Dice/DiceSchedule.cpp b/Dice/DiceSchedule.cpp index 0825f88a..ab6c42ab 100644 --- a/Dice/DiceSchedule.cpp +++ b/Dice/DiceSchedule.cpp @@ -105,20 +105,20 @@ void DiceScheduler::push_job(const char* job_name, bool isSelf, const AttrVars& } //将任务加入等待队列 void DiceScheduler::add_job_for(unsigned int waited, const AttrObject& job) { - std::unique_lock lock_queue(mtJobWaited); + std::lock_guard lock_queue(mtJobWaited); queueJobWaited.emplace(time(nullptr) + waited, job); } void DiceScheduler::add_job_for(unsigned int waited, const char* job_name) { - std::unique_lock lock_queue(mtJobWaited); + std::lock_guard lock_queue(mtJobWaited); queueJobWaited.emplace(time(nullptr) + waited, AttrVars{ { "cmd" , job_name } }); } void DiceScheduler::add_job_until(time_t cloc, const AttrObject& job) { - std::unique_lock lock_queue(mtJobWaited); + std::lock_guard lock_queue(mtJobWaited); queueJobWaited.emplace(cloc, job); } void DiceScheduler::add_job_until(time_t cloc, const char* job_name) { - std::unique_lock lock_queue(mtJobWaited); + std::lock_guard lock_queue(mtJobWaited); queueJobWaited.emplace(cloc, AttrVars{ { "cmd" , job_name } }); }