diff --git a/CHANGELOG.md b/CHANGELOG.md
index 298e230d..b00cdc37 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
___
+## v0.3.0
+
+修复了测试版的诸多bug,更换了一些素材。
+
+___
+
## v0.2.11
新测试版
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7d6f16f..820c012f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.16)
-project(FreeKill VERSION 0.2.11)
+project(FreeKill VERSION 0.3.0)
add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\")
find_package(Qt6 REQUIRED COMPONENTS
diff --git a/Fk/Config.qml b/Fk/Config.qml
index 933891c8..f869aaa3 100644
--- a/Fk/Config.qml
+++ b/Fk/Config.qml
@@ -38,6 +38,8 @@ QtObject {
property string aeskey
// Client data
+ property string serverMotd: ""
+ property var serverHiddenPacks: []
property int roomCapacity: 0
property int roomTimeout: 0
property bool enableFreeAssign: false
diff --git a/Fk/LobbyElement/BanGeneralSetting.qml b/Fk/LobbyElement/BanGeneralSetting.qml
index 6a617cd3..31e5cd21 100644
--- a/Fk/LobbyElement/BanGeneralSetting.qml
+++ b/Fk/LobbyElement/BanGeneralSetting.qml
@@ -14,7 +14,7 @@ Item {
anchors.rightMargin: 8
spacing: 16
Text {
- text: "禁将方案"
+ text: Backend.translate("Ban List")
}
ComboBox {
id: banCombo
@@ -30,18 +30,18 @@ Item {
}
Button {
- text: "新建"
+ text: Backend.translate("New")
onClicked: {
const i = config.disableGeneralSchemes.length;
banComboList.append({
- name: "方案" + (i + 1),
+ name: Backend.translate("List") + (i + 1),
});
config.disableGeneralSchemes.push([]);
}
}
Button {
- text: "清空"
+ text: Backend.translate("Clear")
onClicked: {
config.disabledGenerals = [];
}
@@ -52,42 +52,41 @@ Item {
Layout.fillWidth: true
Layout.margins: 8
wrapMode: Text.WrapAnywhere
- text: "导出键会将这个方案的内容复制到剪贴板中;" +
- "导入键会自动读取剪贴板,若可以导入则导入,不能导入则报错。"
+ text: Backend.translate("Help_Ban_List")
}
RowLayout {
Button {
- text: "导出"
+ text: Backend.translate("Export")
onClicked: {
Backend.copyToClipboard(JSON.stringify(config.disabledGenerals));
- toast.show("该禁将方案已经复制到剪贴板。");
+ toast.show(Backend.translate("Export Success"));
}
}
Button {
- text: "导入"
+ text: Backend.translate("Import")
onClicked: {
const str = Backend.readClipboard();
let data;
try {
data = JSON.parse(str);
} catch (e) {
- toast.show("导入失败:不是合法的JSON字符串。");
+ toast.show(Backend.translate("Not Legal"));
return;
}
if (!data instanceof Array) {
- toast.show("导入失败:数据格式不对。");
+ toast.show(Backend.translate("Not JSON"));
return;
}
+ let d = [];
for (let e of data) {
- if (!(typeof e === "string" && Backend.translate(e) !== e)) {
- toast.show("导入失败:含有未知的武将。");
- return;
+ if (typeof e === "string" && Backend.translate(e) !== e) {
+ d.push(e);
}
}
- config.disabledGenerals = data;
- toast.show("导入禁将方案成功。");
+ config.disabledGenerals = d;
+ toast.show(Backend.translate("Import Success"));
}
}
}
@@ -118,7 +117,7 @@ Item {
Component.onCompleted: {
for (let i = 0; i < config.disableGeneralSchemes.length; i++) {
banComboList.append({
- name: "方案" + (i + 1),
+ name: Backend.translate("List") + (i + 1),
});
}
banCombo.currentIndex = config.disableSchemeIdx;
diff --git a/Fk/LobbyElement/CreateRoom.qml b/Fk/LobbyElement/CreateRoom.qml
index 525ecbbd..071edff5 100644
--- a/Fk/LobbyElement/CreateRoom.qml
+++ b/Fk/LobbyElement/CreateRoom.qml
@@ -22,6 +22,9 @@ Item {
TabButton {
text: Backend.translate("Package Settings")
}
+ TabButton {
+ text: Backend.translate("Ban General Settings")
+ }
}
SwipeView {
@@ -37,5 +40,6 @@ Item {
anchors.fill: parent
}
}
+ BanGeneralSetting {}
}
}
diff --git a/Fk/LobbyElement/EditProfile.qml b/Fk/LobbyElement/EditProfile.qml
index 0acbeab0..2fb36e18 100644
--- a/Fk/LobbyElement/EditProfile.qml
+++ b/Fk/LobbyElement/EditProfile.qml
@@ -24,9 +24,6 @@ Item {
TabButton {
text: Backend.translate("Audio Settings")
}
- TabButton {
- text: Backend.translate("Ban General Settings")
- }
}
SwipeView {
@@ -39,6 +36,5 @@ Item {
UserInfo {}
BGSetting {}
AudioSetting {}
- BanGeneralSetting {}
}
}
diff --git a/Fk/LobbyElement/PersonalSettings.qml b/Fk/LobbyElement/PersonalSettings.qml
index 523a96d1..ea3515d7 100644
--- a/Fk/LobbyElement/PersonalSettings.qml
+++ b/Fk/LobbyElement/PersonalSettings.qml
@@ -48,6 +48,8 @@ Item {
}
TapHandler {
+ gesturePolicy: TapHandler.WithinBounds
+
onTapped: {
lobby_dialog.sourceComponent = Qt.createComponent("EditProfile.qml");
lobby_drawer.open();
diff --git a/Fk/LobbyElement/RoomGeneralSettings.qml b/Fk/LobbyElement/RoomGeneralSettings.qml
index 7a52d713..f2086805 100644
--- a/Fk/LobbyElement/RoomGeneralSettings.qml
+++ b/Fk/LobbyElement/RoomGeneralSettings.qml
@@ -179,13 +179,30 @@ Flickable {
disabledGenerals = Array.from(new Set(disabledGenerals));
}
+ let disabledPack = config.disabledPack.slice();
+ config.serverHiddenPacks.forEach(p => {
+ if (!disabledPack.includes(p)) {
+ disabledPack.push(p);
+ }
+ });
+ const generalPacks = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
+ for (let pk of generalPacks) {
+ if (disabledPack.includes(pk)) continue;
+ let generals = JSON.parse(Backend.callLuaFunction("GetGenerals", [pk]));
+ let t = generals.filter(g => !disabledGenerals.includes(g));
+ if (t.length === 0) {
+ disabledPack.push(pk);
+ disabledGenerals = disabledGenerals.filter(g1 => !generals.includes(g1));
+ }
+ }
+
ClientInstance.notifyServer(
"CreateRoom",
JSON.stringify([roomName.text, playerNum.value, config.preferredTimeout, {
enableFreeAssign: freeAssignCheck.checked,
enableDeputy: deputyCheck.checked,
gameMode: config.preferedMode,
- disabledPack: config.disabledPack,
+ disabledPack: disabledPack,
generalNum: config.preferredGeneralNum,
luckTime: config.preferredLuckTime,
password: roomPassword.text,
diff --git a/Fk/LobbyElement/RoomPackageSettings.qml b/Fk/LobbyElement/RoomPackageSettings.qml
index 2e2c648f..d4b711f6 100644
--- a/Fk/LobbyElement/RoomPackageSettings.qml
+++ b/Fk/LobbyElement/RoomPackageSettings.qml
@@ -22,7 +22,7 @@ Flickable {
anchors.topMargin: 8
Switch {
- text: "禁用Lua拓展 (重启后生效)"
+ text: Backend.translate("Disable Extension")
}
RowLayout {
@@ -132,19 +132,25 @@ Flickable {
Component.onCompleted: {
const g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
for (let orig of g) {
+ if (config.serverHiddenPacks.includes(orig)) {
+ continue;
+ }
gpacklist.append({
name: Backend.translate(orig),
orig_name: orig,
- pkg_enabled: config.disabledPack.indexOf(orig) === -1,
+ pkg_enabled: !config.disabledPack.includes(orig),
});
}
const c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
for (let orig of c) {
+ if (config.serverHiddenPacks.includes(orig)) {
+ continue;
+ }
cpacklist.append({
name: Backend.translate(orig),
orig_name: orig,
- pkg_enabled: config.disabledPack.indexOf(orig) === -1,
+ pkg_enabled: !config.disabledPack.includes(orig),
});
}
}
diff --git a/Fk/Logic.js b/Fk/Logic.js
index 2639edc1..39fabeb3 100644
--- a/Fk/Logic.js
+++ b/Fk/Logic.js
@@ -98,6 +98,13 @@ callbacks["BackToStart"] = (jsonData) => {
}
}
+callbacks["SetServerSettings"] = (j) => {
+ const data = JSON.parse(j);
+ const [ motd, hiddenPacks ] = data;
+ config.serverMotd = motd;
+ config.serverHiddenPacks = hiddenPacks;
+};
+
callbacks["EnterLobby"] = (jsonData) => {
// depth == 1 means the lobby page is not present in mainStack
// createClientPages();
diff --git a/Fk/Pages/CardsOverview.qml b/Fk/Pages/CardsOverview.qml
index 68ef35b9..fb435f74 100644
--- a/Fk/Pages/CardsOverview.qml
+++ b/Fk/Pages/CardsOverview.qml
@@ -302,7 +302,11 @@ Item {
function loadPackages() {
if (loaded) return;
const packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
- packs.forEach((name) => packages.append({ name: name }));
+ packs.forEach(name => {
+ if (!config.serverHiddenPacks.includes(name)) {
+ packages.append({ name: name });
+ }
+ });
loaded = true;
}
}
diff --git a/Fk/Pages/GeneralsOverview.qml b/Fk/Pages/GeneralsOverview.qml
index 98e30390..09d4bab8 100644
--- a/Fk/Pages/GeneralsOverview.qml
+++ b/Fk/Pages/GeneralsOverview.qml
@@ -359,7 +359,11 @@ Item {
function loadPackages() {
if (loaded) return;
const packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
- packs.forEach((name) => packages.append({ name: name }));
+ packs.forEach(name => {
+ if (!config.serverHiddenPacks.includes(name)) {
+ packages.append({ name: name });
+ }
+ });
generalDetail.updateGeneral();
loaded = true;
}
diff --git a/Fk/Pages/Lobby.qml b/Fk/Pages/Lobby.qml
index 1cf33337..7d4fd364 100644
--- a/Fk/Pages/Lobby.qml
+++ b/Fk/Pages/Lobby.qml
@@ -41,7 +41,7 @@ Item {
width: parent.width
wrapMode: TextEdit.WordWrap
textFormat: Text.MarkdownText
- text: Backend.translate('Bulletin Info')
+ text: config.serverMotd + "\n___\n" + Backend.translate('Bulletin Info')
}
}
}
diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml
index 05e8c534..7e6d5993 100644
--- a/Fk/Pages/Room.qml
+++ b/Fk/Pages/Room.qml
@@ -223,9 +223,9 @@ Item {
x: 8; y: 8
Component.onCompleted: {
const data = JSON.parse(Backend.callLuaFunction("GetRoomConfig", []));
- text = "手气卡次数:" + data.luckTime + "
出手时间:" + config.roomTimeout
- + "
选将框数:" + data.generalNum + (data.enableFreeAssign ? "
可自由点将" : "")
- + (data.enableDeputy ? "
启用副将机制" : "")
+ text = Backend.translate("LuckCardNum") + data.luckTime + "
" + Backend.translate("ResponseTime") + config.roomTimeout
+ + "
" + Backend.translate("GeneralBoxNum") + data.generalNum + (data.enableFreeAssign ? "
" + Backend.translate("IncludeFreeAssign") : "")
+ + (data.enableDeputy ? "
" + Backend.translate("IncludeDeputy") : "")
}
}
}
@@ -478,13 +478,13 @@ Item {
}
Switch {
- text: "匀速"
+ text: Backend.translate("Speed Resume")
checked: false
onCheckedChanged: Backend.controlReplayer("uniform");
}
Button {
- text: "减速"
+ text: Backend.translate("Speed Down")
onClicked: Backend.controlReplayer("slowdown");
}
@@ -495,13 +495,13 @@ Item {
}
Button {
- text: "加速"
+ text: Backend.translate("Speed Up")
onClicked: Backend.controlReplayer("speedup");
}
Button {
property bool running: true
- text: running ? "暂停" : "继续"
+ text: Backend.translate(running ? "Pause" : "Resume")
onClicked: {
running = !running;
Backend.controlReplayer("toggle");
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 12a26e6a..a3b43d0b 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -3,8 +3,8 @@
+ android:versionCode="300"
+ android:versionName="0.3.0">
diff --git a/freekill.server.config.json.example b/freekill.server.config.json.example
index 6e8e0e31..0f89beea 100644
--- a/freekill.server.config.json.example
+++ b/freekill.server.config.json.example
@@ -3,5 +3,7 @@
"description": "FreeKill Server",
"iconUrl": "https://img1.imgtp.com/2023/07/01/DGUdj8eu.png",
"capacity": 100,
- "tempBanTime": 20
+ "tempBanTime": 20,
+ "motd": "Welcome!",
+ "hiddenPacks": []
}
diff --git a/image/icon.ico b/image/icon.ico
index a2fb4649..ee54f682 100644
Binary files a/image/icon.ico and b/image/icon.ico differ
diff --git a/image/icon.png b/image/icon.png
index 53f9e066..e19280f5 100644
Binary files a/image/icon.png and b/image/icon.png differ
diff --git a/image/logo/freekill.png b/image/logo/freekill.png
index 53f9e066..e19280f5 100644
Binary files a/image/logo/freekill.png and b/image/logo/freekill.png differ
diff --git a/image/splash.jpg b/image/splash.jpg
index f385629c..287635cd 100644
Binary files a/image/splash.jpg and b/image/splash.jpg differ
diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua
index 69d5be51..88898147 100644
--- a/lua/client/i18n/zh_CN.lua
+++ b/lua/client/i18n/zh_CN.lua
@@ -29,6 +29,7 @@ Fk:loadTranslationTable{
["Refresh Room List"] = "刷新房间列表",
+ ["Disable Extension"] = "禁用Lua拓展 (重启后生效)",
["Create Room"] = "创建房间",
["Room Name"] = "房间名字",
["$RoomName"] = "%1的房间",
@@ -65,6 +66,19 @@ Fk:loadTranslationTable{
["Win=%1 Run=%2 Total=%3"] = "胜率%1% 逃率%2% 总场次%3",
["Win=%1\nRun=%2\nTotal=%3"] = "胜率: %1%\n逃率: %2%\n总场次: %3",
+ ["Ban List"] = "禁将方案",
+ ["List"] = "方案",
+ ["New"] = "新建",
+ ["Clear"] = "清空",
+ ["Help_Ban_List"] = "导出键会将这个方案的内容复制到剪贴板中;" ..
+ "导入键会自动读取剪贴板,若可以导入则导入,不能导入则报错。",
+ ["Export"] = "导出",
+ ["Export Success"] = "禁将方案已经复制到剪贴板。",
+ ["Import"] = "导入",
+ ["Not Legal"] = "导入失败:不是合法的JSON字符串。",
+ ["Not JSON"] = "导入失败:数据格式不对。",
+ ["Import Success"] = "从剪贴板导入禁将方案成功。",
+
["$OnlineInfo"] = "大厅人数:%1,总在线人数:%2",
["Generals Overview"] = "武将一览",
@@ -164,6 +178,11 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
["Death audio"] = "阵亡",
["$WelcomeToLobby"] = "欢迎进入新月杀游戏大厅!",
+ ["LuckCardNum"] = "手气卡次数:",
+ ["ResponseTime"] = "出手时间:",
+ ["GeneralBoxNum"] = "选将框数:",
+ ["IncludeFreeAssign"] = "可自由点将",
+ ["IncludeDeputy"] = "启用副将机制",
-- Room
["$EnterRoom"] = "成功加入房间。",
@@ -256,12 +275,18 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
["Back To Lobby"] = "返回大厅",
["Save Replay"] = "保存录像",
+ ["Speed Resume"] = "匀速",
+ ["Speed Up"] = "加速",
+ ["Speed Down"] = "减速",
+ ["Pause"] = "暂停",
+ ["Resume"] = "继续",
+
["Bulletin Info"] = [==[
- ## v0.2.10
+ ## v0.3.0
- 测试用版本,主要的新功能是录像功能。
+ 0.3.0版本,新增录像和禁将方案切换功能,同时修复不少bug。
- 这种东西小范围传播就行了,大家还是先玩0.2.9
+ 加强谋徐盛。
]==],
}
@@ -300,6 +325,7 @@ Fk:loadTranslationTable{
["pile_draw"] = "牌堆",
["pile_discard"] = "弃牌堆",
["processing_area"] = "处理区",
+ ["Pile"] = "牌堆",
["Top"] = "牌堆顶",
["Bottom"] = "牌堆底",
["Shuffle"] = "洗牌",
diff --git a/lua/core/skill_type/usable_skill.lua b/lua/core/skill_type/usable_skill.lua
index 84374b55..7612d947 100644
--- a/lua/core/skill_type/usable_skill.lua
+++ b/lua/core/skill_type/usable_skill.lua
@@ -59,7 +59,7 @@ function UsableSkill:withinDistanceLimit(player, isattack, card, to)
end
local temp_suf = table.simpleClone(MarkEnum.TempMarkSuffix)
table.insert(temp_suf, "-tmp")
- return isattack and player:inMyAttackRange(to, self:getDistanceLimit(player, card, to)) or player:distanceTo(to) <= self:getDistanceLimit(player, card, to) or
+ return isattack and player:inMyAttackRange(to) or player:distanceTo(to) <= self:getDistanceLimit(player, card, to) or
(player:getMark(MarkEnum.BypassDistancesLimit) ~= 0 or
table.find(temp_suf, function(s)
return player:getMark(MarkEnum.BypassDistancesLimit .. s) ~= 0
diff --git a/lua/server/serverplayer.lua b/lua/server/serverplayer.lua
index c098d1ff..dbe2cdf1 100644
--- a/lua/server/serverplayer.lua
+++ b/lua/server/serverplayer.lua
@@ -121,10 +121,13 @@ local function _waitForReply(player, timeout)
end
local rest = timeout * 1000 - (os.getms() - start) / 1000
if timeout and rest <= 0 then
- player._timewaste_count = player._timewaste_count + 1
+ if timeout >= 15 then
+ player._timewaste_count = player._timewaste_count + 1
+ end
player.serverplayer:setThinking(false)
if player._timewaste_count >= 3 then
+ player._timewaste_count = 0
player.serverplayer:emitKick()
end
diff --git a/packages/standard_cards/init.lua b/packages/standard_cards/init.lua
index c37b6a8f..695bcfdd 100644
--- a/packages/standard_cards/init.lua
+++ b/packages/standard_cards/init.lua
@@ -213,7 +213,7 @@ local snatchSkill = fk.CreateActiveSkill{
mod_target_filter = function(self, to_select, selected, user, card, distance_limited)
local player = Fk:currentRoom():getPlayerById(to_select)
local from = Fk:currentRoom():getPlayerById(user)
- return from ~= player and not (player:isAllNude() or (distance_limited and not self:withinDistanceLimit(from, true, card, player)))
+ return from ~= player and not (player:isAllNude() or (distance_limited and not self:withinDistanceLimit(from, false, card, player)))
end,
target_filter = function(self, to_select, selected, _, card)
if #selected == 0 then
diff --git a/src/server/server.cpp b/src/server/server.cpp
index 28fefab1..ea5971a6 100644
--- a/src/server/server.cpp
+++ b/src/server/server.cpp
@@ -508,6 +508,11 @@ void Server::handleNameAndPassword(ClientSocket *client, const QString &name,
arr << player->getAvatar();
player->doNotify("Setup", JsonArray2Bytes(arr));
+ player->doNotify("SetServerSettings", JsonArray2Bytes({
+ getConfig("motd"),
+ getConfig("hiddenPacks"),
+ }));
+
lobby()->addPlayer(player);
} else {
qInfo() << client->peerAddress() << "lost connection:" << error_msg;
@@ -613,6 +618,8 @@ void Server::readConfig() {
SET_DEFAULT_CONFIG("iconUrl", "https://img1.imgtp.com/2023/07/01/DGUdj8eu.png");
SET_DEFAULT_CONFIG("capacity", 100);
SET_DEFAULT_CONFIG("tempBanTime", 20);
+ SET_DEFAULT_CONFIG("motd", "Welcome!");
+ SET_DEFAULT_CONFIG("hiddenPacks", QJsonArray());
}
QJsonValue Server::getConfig(const QString &key) { return config.value(key); }