Skip to content

Commit

Permalink
fix(ri): init const
Browse files Browse the repository at this point in the history
恢复ri允许录入常数先攻值
  • Loading branch information
mystringEmpty committed May 1, 2024
1 parent 5176288 commit 900e5d4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
run: ctest -C $BUILD_TYPE

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ matrix.triplet }}
Expand Down Expand Up @@ -147,6 +147,9 @@ jobs:
-name "GitHub"
-username "Dice-Developer-Team"
-password "${{ secrets.GITHUB_TOKEN }}"
- name: Automake
run: brew install autoconf automake autoconf-archive

- name: Configure CMake
working-directory: ${{github.workspace}}/build
Expand All @@ -167,7 +170,7 @@ jobs:
run: ctest -C $BUILD_TYPE

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ matrix.triplet }}
Expand Down Expand Up @@ -254,7 +257,7 @@ jobs:
-password "${{ secrets.GITHUB_TOKEN }}"
- name: Add linux-headers
run: sudo apt install linux-libc-dev
run: sudo apt-get install linux-libc-dev

- name: Automake
run: sudo apt-get install autoconf automake autoconf-archive
Expand Down Expand Up @@ -283,7 +286,7 @@ jobs:
run: ctest -C $BUILD_TYPE

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ matrix.triplet }}
Expand Down Expand Up @@ -367,7 +370,7 @@ jobs:
run: ctest -C $BUILD_TYPE

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ matrix.triplet }}
Expand Down
2 changes: 1 addition & 1 deletion Dice/DiceEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4725,7 +4725,7 @@ string DiceEvent::readXDY()
strDice += strMsg[intMsgCnt];
intMsgCnt++;
}
if (!isNumeric(strDice))return strDice;
if (!isNumeric(strDice) || isspace(static_cast<unsigned char>(strLowerMessage[intMsgCnt])))return strDice;
else intMsgCnt -= strDice.length();
return {};
}
Expand Down
15 changes: 8 additions & 7 deletions Dice/DicePython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ static string py_to_gbstring(PyObject* o) {
: empty;
}
static string py_to_native_string(PyObject* o) {
auto t{ Py_TYPE(o) };
#ifdef _WIN32
return Py_IS_TYPE(o, &PyUnicode_Type) ? UtoGBK(PyUnicode_AsUnicode(o)) : empty;
return t == &PyUnicode_Type ? UtoGBK(PyUnicode_AsUnicode(o)) : empty;
#else
return Py_IS_TYPE(o, &PyUnicode_Type) ? PyUnicode_AsUTF8(o) : empty;
return t == &PyUnicode_Type ? PyUnicode_AsUTF8(o) : empty;
#endif
}
AttrVar py_to_attr(PyObject* o);
Expand Down Expand Up @@ -564,7 +565,7 @@ PyObject* py_newContext(const AttrObject& obj) {
}
AttrVar py_to_attr(PyObject* o) {
if (!o)return {};
else if (auto t{ Py_TYPE(o) }; t == &PyBool_Type)return bool(Py_IsTrue(o));
else if (auto t{ Py_TYPE(o) }; t == &PyBool_Type)return bool(PyObject_IsTrue(o));
else if (t == &PyLong_Type) {
auto i{ PyLong_AsLongLong(o) };
return (i == (int)i) ? (int)i : i;
Expand Down Expand Up @@ -744,7 +745,7 @@ static PyObject* PySelfData_set(PyObject* self, PyObject* args) {
auto data{ ((PySelfDataObject*)self)->p };
PyObject* item{ nullptr }, * val{ nullptr };
if (PyArg_ParseTuple(args, "O|O", &item, &val)) {
if (Py_IS_TYPE(item, &PyUnicode_Type) && data->data.is_table()) {
if (auto t{ Py_TYPE(item) }; t != &PyUnicode_Type && data->data.is_table()) {
data->data.table->set(py_to_gbstring(item), py_to_attr(val));
data->save();
}
Expand Down Expand Up @@ -846,7 +847,7 @@ PYDEFKEY(getGroupAttr) {
}
if (item.empty()) return py_newContext(chat(gid).shared_from_this());
else if (item == "members") {
if (Py_IS_TYPE(sub, &PyUnicode_Type)) {
if (auto t{ Py_TYPE(sub) }; t == &PyUnicode_Type) {
string subitem{ py_to_gbstring(sub)};
auto items{ PyDict_New() };
if (subitem == "card") {
Expand Down Expand Up @@ -1063,7 +1064,7 @@ PYDEFKEY(sendMsg) {
/* Parse arguments */
if (!PyArg_ParseTupleAndKeywords(args, keys, "O|LLL", (char**)kwlist, &msg, &uid, &gid, &chid))return NULL;
AttrObject chat;
if (Py_IS_TYPE(msg, &PyUnicode_Type)) {
if (auto t{ Py_TYPE(msg) }; t != &PyUnicode_Type) {
chat = py_to_obj(msg);
AddMsgToQueue(fmt->format(chat->get_str("fwdMsg"), chat), chatInfo{ chat->get_ll("uid") ,chat->get_ll("gid") ,chat->get_ll("chid") });
}
Expand All @@ -1090,7 +1091,7 @@ PYDEFKEY(eventMsg) {
return NULL;
}
AttrObject eve;
if (Py_IS_TYPE(msg, &PyUnicode_Type)) {
if (auto t{ Py_TYPE(msg) }; t != &PyUnicode_Type) {
eve = py_to_obj(msg);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Dice/GlobalVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ const dict_ci<> HelpDoc = {
{ "全牌堆列表","{list_all_deck}" },
{ "扩展指令","{list_extern_order}" },
{"先攻", "&ri"},
{"ri", "先攻(群聊限定):.ri([加值])([昵称])\n.ri-1 某pc //自动记入先攻列表\n.ri+5 3#木乃伊 //生成复数先攻值"},
{"ri", "先攻(群聊限定):.ri(加值)(昵称)\n.ri-1 某pc //自动记入先攻列表\n.ri 17 boss //录入常数作为先攻值\n.ri+5 3#木乃伊 //生成复数先攻值"},
{"先攻列表", "&init"},
{"init", "先攻列表:\n.init list\t//查看先攻列表\n.init clr\t//清除先攻列表\n.init del [项目名]\t//从先攻列表移除项目"},
{"骰池", "&ww"},
Expand Down
2 changes: 1 addition & 1 deletion vcpkg
Submodule vcpkg updated 1238 files

0 comments on commit 900e5d4

Please sign in to comment.