mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
parent
a6ad71c19f
commit
1556da2f13
|
@ -110,7 +110,7 @@ Item {
|
|||
}
|
||||
|
||||
function load() {
|
||||
let packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
packs.forEach((name) => packages.append({ name: name }));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,13 +97,13 @@ Flickable {
|
|||
screenName.text = "";
|
||||
skillDesc.text = "";
|
||||
|
||||
let id = extra_data.photo.playerid;
|
||||
const id = extra_data.photo.playerid;
|
||||
if (id == 0) return;
|
||||
root.pid = id;
|
||||
|
||||
screenName.text = extra_data.photo.screenName;
|
||||
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id]));
|
||||
data.forEach(t => {
|
||||
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ ListView {
|
|||
}
|
||||
|
||||
function append(text) {
|
||||
let autoScroll = root.currentIndex === logModel.count - 1;
|
||||
const autoScroll = root.currentIndex === logModel.count - 1;
|
||||
logModel.append({ logText: text });
|
||||
if (autoScroll) {
|
||||
root.currentIndex = logModel.count - 1;
|
||||
|
|
|
@ -57,7 +57,7 @@ Flickable {
|
|||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
let data = gameModeList.get(currentIndex);
|
||||
const data = gameModeList.get(currentIndex);
|
||||
playerNum.from = data.minPlayer;
|
||||
playerNum.to = data.maxPlayer;
|
||||
|
||||
|
@ -188,7 +188,7 @@ Flickable {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
const mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
let i = 0;
|
||||
for (let d of mode_data) {
|
||||
gameModeList.append(d);
|
||||
|
|
|
@ -45,9 +45,9 @@ Flickable {
|
|||
enabled: orig_name !== "test_p_0"
|
||||
|
||||
onCheckedChanged: {
|
||||
let packs = config.disabledPack;
|
||||
const packs = config.disabledPack;
|
||||
if (checked) {
|
||||
let idx = packs.indexOf(orig_name);
|
||||
const idx = packs.indexOf(orig_name);
|
||||
if (idx !== -1) packs.splice(idx, 1);
|
||||
} else {
|
||||
packs.push(orig_name);
|
||||
|
@ -76,9 +76,9 @@ Flickable {
|
|||
checked: pkg_enabled
|
||||
|
||||
onCheckedChanged: {
|
||||
let packs = config.disabledPack;
|
||||
const packs = config.disabledPack;
|
||||
if (checked) {
|
||||
let idx = packs.indexOf(orig_name);
|
||||
const idx = packs.indexOf(orig_name);
|
||||
if (idx !== -1) packs.splice(idx, 1);
|
||||
} else {
|
||||
packs.push(orig_name);
|
||||
|
@ -90,7 +90,7 @@ Flickable {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
const g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
for (let orig of g) {
|
||||
gpacklist.append({
|
||||
name: Backend.translate(orig),
|
||||
|
@ -99,7 +99,7 @@ Flickable {
|
|||
});
|
||||
}
|
||||
|
||||
let c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
const c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
for (let orig of c) {
|
||||
cpacklist.append({
|
||||
name: Backend.translate(orig),
|
||||
|
|
|
@ -105,7 +105,7 @@ callbacks["EnterRoom"] = (jsonData) => {
|
|||
|
||||
callbacks["UpdateRoomList"] = (jsonData) => {
|
||||
const current = mainStack.currentItem; // should be lobby
|
||||
if (mainStack.currentItem === lobby) {
|
||||
if (mainStack.depth === 2) {
|
||||
current.roomModel.clear();
|
||||
JSON.parse(jsonData).forEach(function (room) {
|
||||
current.roomModel.append({
|
||||
|
@ -122,7 +122,7 @@ callbacks["UpdateRoomList"] = (jsonData) => {
|
|||
|
||||
callbacks["UpdatePlayerNum"] = (j) => {
|
||||
const current = mainStack.currentItem; // should be lobby
|
||||
if (mainStack.currentItem === lobby) {
|
||||
if (mainStack.depth === 2) {
|
||||
const data = JSON.parse(j);
|
||||
const l = data[0];
|
||||
const s = data[1];
|
||||
|
|
|
@ -72,7 +72,7 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let data = modelData;
|
||||
const data = modelData;
|
||||
if (!data.cards) {
|
||||
name = data.name;
|
||||
suit = data.suit;
|
||||
|
@ -113,15 +113,15 @@ Item {
|
|||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
onFinished: {
|
||||
let pkg = [listView.model.get(listView.currentIndex).name];
|
||||
let idList = JSON.parse(Backend.callLuaFunction("GetCards", pkg));
|
||||
let cardList = idList.map(id => JSON.parse(Backend.callLuaFunction
|
||||
const pkg = [listView.model.get(listView.currentIndex).name];
|
||||
const idList = JSON.parse(Backend.callLuaFunction("GetCards", pkg));
|
||||
const cardList = idList.map(id => JSON.parse(Backend.callLuaFunction
|
||||
("GetCardData",[id])));
|
||||
|
||||
let groupedCardList = [];
|
||||
const groupedCardList = [];
|
||||
let groupedCards = {};
|
||||
cardList.forEach(c => {
|
||||
let name = c.name;
|
||||
const name = c.name;
|
||||
if (!groupedCards[name]) {
|
||||
groupedCardList.push(name);
|
||||
groupedCards[name] = [];
|
||||
|
@ -133,9 +133,9 @@ Item {
|
|||
});
|
||||
});
|
||||
|
||||
let model = [];
|
||||
const model = [];
|
||||
groupedCardList.forEach(name => {
|
||||
let cards = groupedCards[name];
|
||||
const cards = groupedCards[name];
|
||||
if (cards.length === 1) {
|
||||
model.push({
|
||||
name: name,
|
||||
|
@ -192,7 +192,7 @@ Item {
|
|||
property int cid: 1
|
||||
property var cards
|
||||
function updateCard() {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const suitTable = {
|
||||
spade: "♠", heart: '<font color="red">♥</font>',
|
||||
club: "♣", diamond: '<font color="red">♦</font>',
|
||||
|
@ -226,7 +226,7 @@ Item {
|
|||
cardText.clear();
|
||||
cardText.append(Backend.translate(":" + data.name));
|
||||
|
||||
let skills = JSON.parse(Backend.callLuaFunction
|
||||
const skills = JSON.parse(Backend.callLuaFunction
|
||||
("GetCardSpecialSkills", [cid]));
|
||||
if (skills.length > 0) {
|
||||
cardText.append("<br/>" + Backend.translate("Special card skills:"));
|
||||
|
@ -299,7 +299,7 @@ Item {
|
|||
|
||||
function loadPackages() {
|
||||
if (loaded) return;
|
||||
let packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
packs.forEach((name) => packages.append({ name: name }));
|
||||
loaded = true;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ Item {
|
|||
if (!newTxtAvailable || stashedTxt.length === 0) {
|
||||
return;
|
||||
}
|
||||
let t = stashedTxt.splice(0, 1)[0];
|
||||
let obj = txtComponent.createObject(root, { text: t });
|
||||
const t = stashedTxt.splice(0, 1)[0];
|
||||
const obj = txtComponent.createObject(root, { text: t });
|
||||
obj.finished.connect(() => obj.destroy());
|
||||
obj.start();
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ Item {
|
|||
property string general: "caocao"
|
||||
function updateGeneral() {
|
||||
detailGeneralCard.name = general;
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
generalText.clear();
|
||||
data.skill.forEach(t => {
|
||||
generalText.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
||||
|
@ -233,7 +233,7 @@ Item {
|
|||
|
||||
function loadPackages() {
|
||||
if (loaded) return;
|
||||
let packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
packs.forEach((name) => packages.append({ name: name }));
|
||||
generalDetail.updateGeneral();
|
||||
loaded = true;
|
||||
|
|
|
@ -71,7 +71,7 @@ Item {
|
|||
if (model.indexOf(editText) === -1) {
|
||||
passwordEdit.text = "";
|
||||
} else {
|
||||
let data = config.savedPassword[editText];
|
||||
const data = config.savedPassword[editText];
|
||||
screenNameEdit.text = data.username;
|
||||
passwordEdit.text = data.shorten_password;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ Item {
|
|||
text: ""
|
||||
onTextChanged: {
|
||||
passwordEdit.text = "";
|
||||
let data = config.savedPassword[server_addr.editText];
|
||||
const data = config.savedPassword[server_addr.editText];
|
||||
if (data) {
|
||||
if (text === data.username) {
|
||||
passwordEdit.text = data.shorten_password;
|
||||
|
@ -207,7 +207,7 @@ Item {
|
|||
server_addr.onModelChanged();
|
||||
server_addr.currentIndex = server_addr.model.indexOf(config.lastLoginServer);
|
||||
|
||||
let data = config.savedPassword[config.lastLoginServer];
|
||||
const data = config.savedPassword[config.lastLoginServer];
|
||||
if (data) {
|
||||
screenNameEdit.text = data.username;
|
||||
passwordEdit.text = data.shorten_password;
|
||||
|
|
|
@ -67,7 +67,7 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
const mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
for (let d of mode_data) {
|
||||
modeList.append(d);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ Item {
|
|||
text: qsTr("Enable All")
|
||||
onTriggered: {
|
||||
for (let i = 0; i < packageModel.count; i++) {
|
||||
let name = packageModel.get(i).pkgName;
|
||||
const name = packageModel.get(i).pkgName;
|
||||
Pacman.enablePack(name);
|
||||
}
|
||||
updatePackageList();
|
||||
|
@ -43,7 +43,7 @@ Item {
|
|||
text: qsTr("Disable All")
|
||||
onTriggered: {
|
||||
for (let i = 0; i < packageModel.count; i++) {
|
||||
let name = packageModel.get(i).pkgName;
|
||||
const name = packageModel.get(i).pkgName;
|
||||
Pacman.disablePack(name);
|
||||
}
|
||||
updatePackageList();
|
||||
|
@ -53,7 +53,7 @@ Item {
|
|||
text: qsTr("Upgrade All")
|
||||
onTriggered: {
|
||||
for (let i = 0; i < packageModel.count; i++) {
|
||||
let name = packageModel.get(i).pkgName;
|
||||
const name = packageModel.get(i).pkgName;
|
||||
Pacman.upgradePack(name);
|
||||
}
|
||||
updatePackageList();
|
||||
|
@ -162,7 +162,7 @@ Item {
|
|||
text: qsTr("Install From URL")
|
||||
enabled: urlEdit.text !== ""
|
||||
onClicked: {
|
||||
let url = urlEdit.text;
|
||||
const url = urlEdit.text;
|
||||
mainWindow.busy = true;
|
||||
Pacman.downloadNewPack(url, true);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ Item {
|
|||
|
||||
function updatePackageList() {
|
||||
packageModel.clear();
|
||||
let data = JSON.parse(Pacman.listPackages());
|
||||
const data = JSON.parse(Pacman.listPackages());
|
||||
data.forEach(e => packageModel.append({
|
||||
pkgName: e.name,
|
||||
pkgURL: e.url,
|
||||
|
@ -182,7 +182,7 @@ Item {
|
|||
}
|
||||
|
||||
function downloadComplete() {
|
||||
let idx = packageList.currentIndex;
|
||||
const idx = packageList.currentIndex;
|
||||
updatePackageList();
|
||||
packageList.currentIndex = idx;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ Item {
|
|||
Text {
|
||||
x: 8; y: 8
|
||||
Component.onCompleted: {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetRoomConfig", []));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetRoomConfig", []));
|
||||
text = "手气卡次数:" + data.luckTime + "<br />出手时间:" + config.roomTimeout
|
||||
+ "<br />选将框数:" + data.generalNum
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ Item {
|
|||
Logic.enableTargets(card);
|
||||
|
||||
if (typeof card === "number" && card !== -1 && roomScene.state === "playing") {
|
||||
let skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [card]));
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [card]));
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]))) {
|
||||
skills.unshift("_normal_use");
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ Item {
|
|||
|
||||
function activateSkill(skill_name, pressed) {
|
||||
if (pressed) {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetInteractionOfSkill", [skill_name]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetInteractionOfSkill", [skill_name]));
|
||||
if (data) {
|
||||
Backend.callLuaFunction("SetInteractionDataOfSkill", [skill_name, "null"]);
|
||||
switch (data.type) {
|
||||
|
@ -735,9 +735,9 @@ Item {
|
|||
}
|
||||
|
||||
for (let i = 1; i < specialCardSkills.count; i++) {
|
||||
let item = specialCardSkills.itemAt(i);
|
||||
const item = specialCardSkills.itemAt(i);
|
||||
if (item.checked) {
|
||||
let ret = item.orig_text;
|
||||
const ret = item.orig_text;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -753,10 +753,10 @@ Item {
|
|||
if (specialChat(pid, raw, raw.msg.slice(1))) return;
|
||||
}
|
||||
chat.append(msg);
|
||||
let photo = Logic.getPhoto(pid);
|
||||
const photo = Logic.getPhoto(pid);
|
||||
if (photo === undefined) {
|
||||
let user = raw.userName;
|
||||
let m = raw.msg;
|
||||
const user = raw.userName;
|
||||
const m = raw.msg;
|
||||
danmaku.sendLog(`${user}: ${m}`);
|
||||
return;
|
||||
}
|
||||
|
@ -768,13 +768,13 @@ Item {
|
|||
// death audio: ~%s
|
||||
// something special: !%s:...
|
||||
|
||||
let time = data.time;
|
||||
let userName = data.userName;
|
||||
let general = Backend.translate(data.general);
|
||||
const time = data.time;
|
||||
const userName = data.userName;
|
||||
const general = Backend.translate(data.general);
|
||||
|
||||
if (msg.startsWith("!")) {
|
||||
let splited = msg.split(":");
|
||||
let type = splited[0].slice(1);
|
||||
const splited = msg.split(":");
|
||||
const type = splited[0].slice(1);
|
||||
switch (type) {
|
||||
case "Egg":
|
||||
case "GiantEgg":
|
||||
|
@ -800,18 +800,18 @@ Item {
|
|||
return false;
|
||||
}
|
||||
} else if (msg.startsWith("~")) {
|
||||
let g = msg.slice(1);
|
||||
let extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [g])).extension;
|
||||
const g = msg.slice(1);
|
||||
const extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [g])).extension;
|
||||
if (!config.disableMsgAudio)
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/" + g);
|
||||
|
||||
let m = Backend.translate("~" + g);
|
||||
const m = Backend.translate("~" + g);
|
||||
if (general === "")
|
||||
chat.append(`[${time}] ${userName}: ${m}`);
|
||||
else
|
||||
chat.append(`[${time}] ${userName}(${general}): ${m}`);
|
||||
|
||||
let photo = Logic.getPhoto(pid);
|
||||
const photo = Logic.getPhoto(pid);
|
||||
if (photo === undefined) {
|
||||
danmaku.sendLog(`${userName}: ${m}`);
|
||||
return true;
|
||||
|
@ -820,24 +820,24 @@ Item {
|
|||
|
||||
return true;
|
||||
} else {
|
||||
let splited = msg.split(":");
|
||||
const splited = msg.split(":");
|
||||
if (splited.length < 2) return false;
|
||||
let skill = splited[0];
|
||||
let idx = parseInt(splited[1]);
|
||||
const skill = splited[0];
|
||||
const idx = parseInt(splited[1]);
|
||||
|
||||
let data2 = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill]));
|
||||
const data2 = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill]));
|
||||
if (!data2) return false;
|
||||
let extension = data2.extension;
|
||||
const extension = data2.extension;
|
||||
if (!config.disableMsgAudio)
|
||||
Backend.playSound("./packages/" + extension + "/audio/skill/" + skill, idx);
|
||||
|
||||
let m = Backend.translate("$" + skill + idx.toString());
|
||||
const m = Backend.translate("$" + skill + idx.toString());
|
||||
if (general === "")
|
||||
chat.append(`[${time}] ${userName}: ${m}`);
|
||||
else
|
||||
chat.append(`[${time}] ${userName}(${general}): ${m}`);
|
||||
|
||||
let photo = Logic.getPhoto(pid);
|
||||
const photo = Logic.getPhoto(pid);
|
||||
if (photo === undefined) {
|
||||
danmaku.sendLog(`${userName}: ${m}`);
|
||||
return true;
|
||||
|
@ -861,9 +861,9 @@ Item {
|
|||
|
||||
function showDistance(show) {
|
||||
for (let i = 0; i < photoModel.count; i++) {
|
||||
let item = photos.itemAt(i);
|
||||
const item = photos.itemAt(i);
|
||||
if (show) {
|
||||
let dis = Backend.callLuaFunction("DistanceTo",[Self.id, item.playerid]);
|
||||
const dis = Backend.callLuaFunction("DistanceTo",[Self.id, item.playerid]);
|
||||
item.distance = parseInt(dis);
|
||||
} else {
|
||||
item.distance = 0;
|
||||
|
@ -878,9 +878,9 @@ Item {
|
|||
}
|
||||
|
||||
function resetToInit() {
|
||||
let datalist = [];
|
||||
const datalist = [];
|
||||
for (let i = 0; i < photoModel.count; i++) {
|
||||
let item = photoModel.get(i);
|
||||
const item = photoModel.get(i);
|
||||
if (item.id > 0) {
|
||||
datalist.push({
|
||||
id: item.id,
|
||||
|
|
|
@ -288,8 +288,8 @@ function doIndicate(from, tos) {
|
|||
for (let i = 0; i < tos.length; i++) {
|
||||
if (from === tos[i])
|
||||
continue;
|
||||
let toItem = getPhotoOrDashboard(tos[i]);
|
||||
let toPos = mapFromItem(toItem, toItem.width / 2, toItem.height / 2);
|
||||
const toItem = getPhotoOrDashboard(tos[i]);
|
||||
const toPos = mapFromItem(toItem, toItem.width / 2, toItem.height / 2);
|
||||
end.push(toPos);
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ function changeSelf(id) {
|
|||
// move new selfPhoto to dashboard
|
||||
let order = new Array(photoModel.count);
|
||||
for (let i = 0; i < photoModel.count; i++) {
|
||||
let item = photoModel.get(i);
|
||||
const item = photoModel.get(i);
|
||||
order[item.seatNumber - 1] = item.id;
|
||||
if (item.id === Self.id) {
|
||||
dashboard.self = photos.itemAt(i);
|
||||
|
@ -389,7 +389,7 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
}
|
||||
|
||||
if (candidate) {
|
||||
let data = {
|
||||
const data = {
|
||||
ok_enabled: false,
|
||||
enabled_targets: []
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ callbacks["AskForMoveCardInBoard"] = (jsonData) => {
|
|||
|
||||
const boxCards = [];
|
||||
cards.forEach(id => {
|
||||
let d = Backend.callLuaFunction("GetCardData", [id]);
|
||||
const d = Backend.callLuaFunction("GetCardData", [id]);
|
||||
boxCards.push(JSON.parse(d));
|
||||
});
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ callbacks["SetPlayerMark"] = (jsonData) => {
|
|||
const player = getPhoto(data[0]);
|
||||
const mark = data[1];
|
||||
const value = data[2] instanceof Array ? data[2] : data[2].toString();
|
||||
if (value === 0) {
|
||||
if (data[2] === 0) {
|
||||
player.markArea.removeMark(mark);
|
||||
} else {
|
||||
player.markArea.setMark(mark, mark.startsWith("@@") ? "" : value);
|
||||
|
|
|
@ -37,7 +37,7 @@ Item {
|
|||
inputs = [inputs];
|
||||
}
|
||||
inputs.forEach(card => {
|
||||
let v = JSON.parse(Backend.callLuaFunction("GetVirtualEquip", [parent.playerid, card.cid]));
|
||||
const v = JSON.parse(Backend.callLuaFunction("GetVirtualEquip", [parent.playerid, card.cid]));
|
||||
if (v !== null) {
|
||||
cards.append(v);
|
||||
} else {
|
||||
|
@ -51,11 +51,11 @@ Item {
|
|||
|
||||
function remove(outputs)
|
||||
{
|
||||
let result = area.remove(outputs);
|
||||
const result = area.remove(outputs);
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let item = result[i];
|
||||
const item = result[i];
|
||||
for (let j = 0; j < cards.count; j++) {
|
||||
let icon = cards.get(j);
|
||||
const icon = cards.get(j);
|
||||
if (icon.cid === item.cid) {
|
||||
cards.remove(j, 1);
|
||||
break;
|
||||
|
|
|
@ -100,11 +100,11 @@ Column {
|
|||
|
||||
function remove(outputs)
|
||||
{
|
||||
let result = area.remove(outputs);
|
||||
const result = area.remove(outputs);
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let card = result[i];
|
||||
const card = result[i];
|
||||
for (let j = 0; j < items.length; j++) {
|
||||
let item = items[j];
|
||||
const item = items[j];
|
||||
if (item.cid === card.cid) {
|
||||
item.reset();
|
||||
item.hide();
|
||||
|
|
|
@ -19,7 +19,7 @@ ColumnLayout {
|
|||
|
||||
function update(skill, times) {
|
||||
for (let i = 0; i < rep.count; i++) {
|
||||
let data = skills.get(i);
|
||||
const data = skills.get(i);
|
||||
if (data.skillname_ === skill) {
|
||||
data.times = times;
|
||||
return;
|
||||
|
|
|
@ -120,17 +120,17 @@ Item {
|
|||
let x = 0;
|
||||
let y = 0;
|
||||
let i;
|
||||
let marks = [];
|
||||
let long_marks = [];
|
||||
const marks = [];
|
||||
const long_marks = [];
|
||||
for (i = 0; i < markRepeater.count; i++) {
|
||||
let item = markRepeater.itemAt(i);
|
||||
let w = item.width;
|
||||
const item = markRepeater.itemAt(i);
|
||||
const w = item.width;
|
||||
if (w < width / 2) marks.push(item);
|
||||
else long_marks.push(item);
|
||||
}
|
||||
|
||||
marks.concat(long_marks).forEach(item => {
|
||||
let w = item.width;
|
||||
const w = item.width;
|
||||
if (x === 0) {
|
||||
item.x = x; item.y = y;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ GraphicsBox {
|
|||
|
||||
function takeAG(g, cid) {
|
||||
for (let i = 0; i < cards.count; i++) {
|
||||
let item = cards.get(i);
|
||||
const item = cards.get(i);
|
||||
if (item.cid !== cid) continue;
|
||||
item.footnote = g;
|
||||
item.selectable = false;
|
||||
|
|
|
@ -26,7 +26,7 @@ Item {
|
|||
for (let i = 0; i < cards.length; i++) {
|
||||
for (let j = 0; j < outputs.length; j++) {
|
||||
if (outputs[j] === cards[i].cid) {
|
||||
let state = JSON.parse(Backend.callLuaFunction("GetCardData", [cards[i].cid]));
|
||||
const state = JSON.parse(Backend.callLuaFunction("GetCardData", [cards[i].cid]));
|
||||
cards[i].setData(state);
|
||||
result.push(cards[i]);
|
||||
cards.splice(i, 1);
|
||||
|
@ -56,8 +56,8 @@ Item {
|
|||
|
||||
if (overflow) {
|
||||
// TODO: Adjust cards in multiple lines if there are too many cards
|
||||
let xLimit = root.width - card.width;
|
||||
let spacing = xLimit / (cards.length - 1);
|
||||
const xLimit = root.width - card.width;
|
||||
const spacing = xLimit / (cards.length - 1);
|
||||
for (i = 0; i < cards.length; i++) {
|
||||
card = cards[i];
|
||||
card.origX = i * spacing;
|
||||
|
@ -65,7 +65,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
let parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
const parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
for (i = 0; i < cards.length; i++) {
|
||||
card = cards[i];
|
||||
card.origX += parentPos.x;
|
||||
|
|
|
@ -257,7 +257,7 @@ Item {
|
|||
|
||||
function toData()
|
||||
{
|
||||
let data = {
|
||||
const data = {
|
||||
cid: cid,
|
||||
name: name,
|
||||
suit: suit,
|
||||
|
|
|
@ -69,32 +69,32 @@ RowLayout {
|
|||
}
|
||||
|
||||
function expandPile(pile) {
|
||||
let expanded_pile_names = Object.keys(expanded_piles);
|
||||
const expanded_pile_names = Object.keys(expanded_piles);
|
||||
if (expanded_pile_names.indexOf(pile) !== -1)
|
||||
return;
|
||||
|
||||
let component = Qt.createComponent("../RoomElement/CardItem.qml");
|
||||
let parentPos = roomScene.mapFromItem(self, 0, 0);
|
||||
const component = Qt.createComponent("../RoomElement/CardItem.qml");
|
||||
const parentPos = roomScene.mapFromItem(self, 0, 0);
|
||||
|
||||
expanded_piles[pile] = [];
|
||||
if (pile === "_equip") {
|
||||
let equips = self.equipArea.getAllCards();
|
||||
const equips = self.equipArea.getAllCards();
|
||||
equips.forEach(data => {
|
||||
data.x = parentPos.x;
|
||||
data.y = parentPos.y;
|
||||
let card = component.createObject(roomScene, data);
|
||||
const card = component.createObject(roomScene, data);
|
||||
card.footnoteVisible = true;
|
||||
card.footnote = Backend.translate("$Equip");
|
||||
handcardAreaItem.add(card);
|
||||
})
|
||||
handcardAreaItem.updateCardPosition();
|
||||
} else {
|
||||
let ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
const ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
ids.forEach(id => {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
data.x = parentPos.x;
|
||||
data.y = parentPos.y;
|
||||
let card = component.createObject(roomScene, data);
|
||||
const card = component.createObject(roomScene, data);
|
||||
card.footnoteVisible = true;
|
||||
card.footnote = Backend.translate(pile);
|
||||
handcardAreaItem.add(card);
|
||||
|
@ -104,17 +104,17 @@ RowLayout {
|
|||
}
|
||||
|
||||
function retractPile(pile) {
|
||||
let expanded_pile_names = Object.keys(expanded_piles);
|
||||
const expanded_pile_names = Object.keys(expanded_piles);
|
||||
if (expanded_pile_names.indexOf(pile) === -1)
|
||||
return;
|
||||
|
||||
let parentPos = roomScene.mapFromItem(self, 0, 0);
|
||||
const parentPos = roomScene.mapFromItem(self, 0, 0);
|
||||
|
||||
delete expanded_piles[pile];
|
||||
if (pile === "_equip") {
|
||||
let equips = self.equipArea.getAllCards();
|
||||
const equips = self.equipArea.getAllCards();
|
||||
equips.forEach(data => {
|
||||
let card = handcardAreaItem.remove([data.cid])[0];
|
||||
const card = handcardAreaItem.remove([data.cid])[0];
|
||||
card.origX = parentPos.x;
|
||||
card.origY = parentPos.y;
|
||||
card.destroyOnStop();
|
||||
|
@ -122,9 +122,9 @@ RowLayout {
|
|||
})
|
||||
handcardAreaItem.updateCardPosition();
|
||||
} else {
|
||||
let ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
const ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
ids.forEach(id => {
|
||||
let card = handcardAreaItem.remove([id])[0];
|
||||
const card = handcardAreaItem.remove([id])[0];
|
||||
card.origX = parentPos.x;
|
||||
card.origY = parentPos.y;
|
||||
card.destroyOnStop();
|
||||
|
@ -159,7 +159,8 @@ RowLayout {
|
|||
return ret;
|
||||
}
|
||||
if (cname) {
|
||||
let ids = [], cards = handcardAreaItem.cards;
|
||||
const ids = [];
|
||||
let cards = handcardAreaItem.cards;
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
if (cardValid(cards[i].cid, cname)) {
|
||||
ids.push(cards[i].cid);
|
||||
|
@ -177,7 +178,7 @@ RowLayout {
|
|||
|
||||
// Must manually analyze pattern here
|
||||
let pile_list = cname.split("|")[4];
|
||||
let pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
const pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
if (pile_list && pile_list !== "." && !(pile_data instanceof Array)) {
|
||||
pile_list = pile_list.split(",");
|
||||
for (let pile_name of pile_list) {
|
||||
|
@ -196,15 +197,15 @@ RowLayout {
|
|||
return;
|
||||
}
|
||||
|
||||
let ids = [], cards = handcardAreaItem.cards;
|
||||
const ids = [], cards = handcardAreaItem.cards;
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [cards[i].cid, Self.id]))) {
|
||||
ids.push(cards[i].cid);
|
||||
} else {
|
||||
// cannot use? considering special_skills
|
||||
let skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [cards[i].cid]));
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [cards[i].cid]));
|
||||
for (let j = 0; j < skills.length; j++) {
|
||||
let s = skills[j];
|
||||
const s = skills[j];
|
||||
if (JSON.parse(Backend.callLuaFunction("ActiveCanUse", [s]))) {
|
||||
ids.push(cards[i].cid);
|
||||
break;
|
||||
|
@ -253,8 +254,8 @@ RowLayout {
|
|||
function updatePending() {
|
||||
if (pending_skill === "") return;
|
||||
|
||||
let enabled_cards = [];
|
||||
let targets = roomScene.selected_targets;
|
||||
const enabled_cards = [];
|
||||
const targets = roomScene.selected_targets;
|
||||
|
||||
handcardAreaItem.cards.forEach((card) => {
|
||||
if (card.selected || JSON.parse(Backend.callLuaFunction(
|
||||
|
@ -264,7 +265,7 @@ RowLayout {
|
|||
enabled_cards.push(card.cid);
|
||||
});
|
||||
|
||||
let cards = self.equipArea.getAllCards();
|
||||
const cards = self.equipArea.getAllCards();
|
||||
cards.forEach(c => {
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveCardFilter",
|
||||
|
@ -277,8 +278,8 @@ RowLayout {
|
|||
}
|
||||
})
|
||||
|
||||
let pile = Backend.callLuaFunction("GetExpandPileOfSkill", [pending_skill]);
|
||||
let pile_ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
const pile = Backend.callLuaFunction("GetExpandPileOfSkill", [pending_skill]);
|
||||
const pile_ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
pile_ids.forEach(cid => {
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveCardFilter",
|
||||
|
@ -313,7 +314,7 @@ RowLayout {
|
|||
pendings = [];
|
||||
handcardAreaItem.unselectAll();
|
||||
for (let i = 0; i < skillButtons.count; i++) {
|
||||
let item = skillButtons.itemAt(i);
|
||||
const item = skillButtons.itemAt(i);
|
||||
item.enabled = item.pressed;
|
||||
}
|
||||
|
||||
|
@ -347,9 +348,9 @@ RowLayout {
|
|||
}
|
||||
|
||||
function prelightSkill(skill_name, prelight) {
|
||||
let btns = skillPanel.prelight_buttons;
|
||||
const btns = skillPanel.prelight_buttons;
|
||||
for (let i = 0; i < btns.count; i++) {
|
||||
let btn = btns.itemAt(i);
|
||||
const btn = btns.itemAt(i);
|
||||
if (btn.orig === skill_name) {
|
||||
btn.prelighted = prelight;
|
||||
btn.enabled = true;
|
||||
|
@ -361,15 +362,15 @@ RowLayout {
|
|||
if (cname) {
|
||||
// if cname is presented, we are responding use or play.
|
||||
for (let i = 0; i < skillButtons.count; i++) {
|
||||
let item = skillButtons.itemAt(i);
|
||||
let fitpattern = JSON.parse(Backend.callLuaFunction("SkillFitPattern", [item.orig, cname]));
|
||||
let canresp = JSON.parse(Backend.callLuaFunction("SkillCanResponse", [item.orig, cardResponsing]));
|
||||
const item = skillButtons.itemAt(i);
|
||||
const fitpattern = JSON.parse(Backend.callLuaFunction("SkillFitPattern", [item.orig, cname]));
|
||||
const canresp = JSON.parse(Backend.callLuaFunction("SkillCanResponse", [item.orig, cardResponsing]));
|
||||
item.enabled = fitpattern && canresp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < skillButtons.count; i++) {
|
||||
let item = skillButtons.itemAt(i);
|
||||
const item = skillButtons.itemAt(i);
|
||||
item.enabled = JSON.parse(Backend.callLuaFunction("ActiveCanUse", [item.orig]));
|
||||
}
|
||||
}
|
||||
|
@ -387,8 +388,8 @@ RowLayout {
|
|||
unSelectAll();
|
||||
disableSkills();
|
||||
|
||||
let cards = handcardAreaItem.cards;
|
||||
let toRemove = [];
|
||||
const cards = handcardAreaItem.cards;
|
||||
const toRemove = [];
|
||||
for (let c of cards) {
|
||||
toRemove.push(c.cid);
|
||||
c.origY += 30;
|
||||
|
@ -400,7 +401,7 @@ RowLayout {
|
|||
|
||||
skillPanel.clearSkills();
|
||||
|
||||
let skills = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [Self.id]));
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [Self.id]));
|
||||
for (let s of skills) {
|
||||
addSkill(s.name);
|
||||
}
|
||||
|
|
|
@ -155,14 +155,14 @@ CardItem {
|
|||
}
|
||||
|
||||
onNameChanged: {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
kingdom = data.kingdom;
|
||||
subkingdom = (data.subkingdom !== kingdom && data.subkingdom) || "";
|
||||
hp = data.hp;
|
||||
maxHp = data.maxHp;
|
||||
shieldNum = data.shield;
|
||||
|
||||
let splited = name.split("__");
|
||||
const splited = name.split("__");
|
||||
if (splited.length > 1) {
|
||||
pkgName = splited[0];
|
||||
} else {
|
||||
|
|
|
@ -144,9 +144,9 @@ GraphicsBox {
|
|||
}
|
||||
|
||||
function getResult() {
|
||||
let ret = [];
|
||||
const ret = [];
|
||||
result.forEach(t => {
|
||||
let t2 = [];
|
||||
const t2 = [];
|
||||
t.forEach(v => t2.push(v.cid));
|
||||
ret.push(t2);
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ Item {
|
|||
|
||||
function remove(outputs)
|
||||
{
|
||||
let result = cardArea.remove(outputs);
|
||||
const result = cardArea.remove(outputs);
|
||||
let card;
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
card = result[i];
|
||||
|
@ -87,7 +87,7 @@ Item {
|
|||
area.updateCardPosition(true);
|
||||
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
let card = cards[i];
|
||||
const card = cards[i];
|
||||
if (card.selected) {
|
||||
if (!selectedCards.contains(card))
|
||||
selectCard(card);
|
||||
|
|
|
@ -50,16 +50,16 @@ Item {
|
|||
|
||||
function remove(outputs)
|
||||
{
|
||||
let component = Qt.createComponent("CardItem.qml");
|
||||
const component = Qt.createComponent("CardItem.qml");
|
||||
if (component.status !== Component.Ready)
|
||||
return [];
|
||||
|
||||
let parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
const parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
let card;
|
||||
let items = [];
|
||||
const items = [];
|
||||
for (let i = 0; i < outputs.length; i++) {
|
||||
if (_contains(outputs[i])) {
|
||||
let state = JSON.parse(Backend.callLuaFunction("GetCardData", [outputs[i]]))
|
||||
const state = JSON.parse(Backend.callLuaFunction("GetCardData", [outputs[i]]))
|
||||
state.x = parentPos.x;
|
||||
state.y = parentPos.y;
|
||||
state.opacity = 0;
|
||||
|
@ -90,7 +90,7 @@ Item {
|
|||
let i, card;
|
||||
|
||||
if (animated) {
|
||||
let parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
const parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
for (i = 0; i < pendingInput.length; i++) {
|
||||
card = pendingInput[i];
|
||||
card.origX = parentPos.x - card.width / 2 + ((i - pendingInput.length / 2) * 15);
|
||||
|
|
|
@ -9,9 +9,9 @@ Item {
|
|||
visible: roundNum || pileNum
|
||||
|
||||
function getTimeString(time) {
|
||||
let s = time % 60;
|
||||
let m = (time - s) / 60;
|
||||
let h = (time - s - m * 60) / 3600;
|
||||
const s = time % 60;
|
||||
const m = (time - s) / 60;
|
||||
const h = (time - s - m * 60) / 3600;
|
||||
return h ? `${h}:${m}:${s}` : `${m}:${s}`;
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ Item {
|
|||
}
|
||||
|
||||
function updatePileInfo(areaName) {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.playerid, areaName]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetPile", [root.playerid, areaName]));
|
||||
if (data.length === 0) {
|
||||
root.markArea.removeMark(areaName);
|
||||
} else {
|
||||
|
@ -576,7 +576,7 @@ Item {
|
|||
|
||||
onGeneralChanged: {
|
||||
if (!roomScene.isStarted) return;
|
||||
let text = Backend.translate(general);
|
||||
const text = Backend.translate(general);
|
||||
if (text.length > 6) {
|
||||
generalName.text = "";
|
||||
longGeneralName.text = text;
|
||||
|
|
|
@ -111,7 +111,7 @@ Flickable {
|
|||
return false;
|
||||
};
|
||||
|
||||
let data = JSON.parse(Backend.callLuaFunction(
|
||||
const data = JSON.parse(Backend.callLuaFunction(
|
||||
"GetSkillData",
|
||||
[skill_name]
|
||||
));
|
||||
|
@ -133,7 +133,7 @@ Flickable {
|
|||
function loseSkill(skill_name, prelight) {
|
||||
if (prelight) {
|
||||
for (let i = 0; i < prelight_skills.count; i++) {
|
||||
let item = prelight_skills.get(i);
|
||||
const item = prelight_skills.get(i);
|
||||
if (item.orig_skill == skill_name) {
|
||||
prelight_skills.remove(i);
|
||||
}
|
||||
|
@ -142,13 +142,13 @@ Flickable {
|
|||
}
|
||||
|
||||
for (let i = 0; i < active_skills.count; i++) {
|
||||
let item = active_skills.get(i);
|
||||
const item = active_skills.get(i);
|
||||
if (item.orig_skill == skill_name) {
|
||||
active_skills.remove(i);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < not_active_skills.count; i++) {
|
||||
let item = not_active_skills.get(i);
|
||||
const item = not_active_skills.get(i);
|
||||
if (item.orig_skill == skill_name) {
|
||||
not_active_skills.remove(i);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ Item {
|
|||
area.add(inputs);
|
||||
// if (!inputs instanceof Array)
|
||||
for (let i = 0; i < inputs.length; i++) {
|
||||
let c = inputs[i];
|
||||
const c = inputs[i];
|
||||
c.footnoteVisible = true;
|
||||
c.selectable = true;
|
||||
c.height = c.height * 0.8;
|
||||
|
@ -76,14 +76,14 @@ Item {
|
|||
|
||||
let result = area.remove(outputs);
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let c = result[i];
|
||||
const c = result[i];
|
||||
c.footnoteVisible = false;
|
||||
c.selectable = false;
|
||||
c.height = c.height / 0.8;
|
||||
c.width = c.width / 0.8;
|
||||
c.rotation = 0;
|
||||
}
|
||||
let vanished = [];
|
||||
const vanished = [];
|
||||
if (result.length < outputs.length) {
|
||||
for (i = 0; i < outputs.length; i++) {
|
||||
let exists = false;
|
||||
|
@ -131,8 +131,8 @@ Item {
|
|||
|
||||
if (overflow) {
|
||||
//@to-do: Adjust cards in multiple lines if there are too many cards
|
||||
let xLimit = root.width - card.width;
|
||||
let spacing = xLimit / (cards.length - 1);
|
||||
const xLimit = root.width - card.width;
|
||||
const spacing = xLimit / (cards.length - 1);
|
||||
for (i = 0; i < cards.length; i++) {
|
||||
card = cards[i];
|
||||
card.origX = i * spacing;
|
||||
|
@ -140,8 +140,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
let offsetX = Math.max(0, (root.width - cards.length * card.width) / 2);
|
||||
let parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
const offsetX = Math.max(0, (root.width - cards.length * card.width) / 2);
|
||||
const parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
for (i = 0; i < cards.length; i++) {
|
||||
card = cards[i];
|
||||
card.origX += parentPos.x + offsetX;
|
||||
|
|
|
@ -35,7 +35,7 @@ MetroButton {
|
|||
|
||||
onClicked: {
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/ChoiceBox.qml");
|
||||
let box = roomScene.popupBox.item;
|
||||
const box = roomScene.popupBox.item;
|
||||
box.options = choices;
|
||||
box.accepted.connect(() => {
|
||||
answer = choices[box.result];
|
||||
|
|
|
@ -168,7 +168,7 @@ Window {
|
|||
}
|
||||
|
||||
function fetchMessage() {
|
||||
let ret = pending_message.splice(0, 1)[0];
|
||||
const ret = pending_message.splice(0, 1)[0];
|
||||
if (pending_message.length === 0) {
|
||||
is_pending = false;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ Window {
|
|||
}
|
||||
|
||||
function handleMessage(command, jsonData) {
|
||||
let cb = callbacks[command]
|
||||
const cb = callbacks[command]
|
||||
if (typeof(cb) === "function") {
|
||||
cb(jsonData);
|
||||
} else {
|
||||
|
|
|
@ -20,9 +20,9 @@ var TILE_ICON_DIR = AppPath + "/image/button/tileicon/"
|
|||
var LOBBY_IMG_DIR = AppPath + "/image/lobby/";
|
||||
|
||||
function getGeneralPicture(name) {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
let extension = data.extension;
|
||||
let path = AppPath + "/packages/" + extension + "/image/generals/" + name + ".jpg";
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const extension = data.extension;
|
||||
const path = AppPath + "/packages/" + extension + "/image/generals/" + name + ".jpg";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ function getCardPicture(cidOrName) {
|
|||
}
|
||||
|
||||
function getDelayedTrickPicture(name) {
|
||||
let extension = Backend.callLuaFunction("GetCardExtensionByName", [name]);
|
||||
const extension = Backend.callLuaFunction("GetCardExtensionByName", [name]);
|
||||
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/delayedTrick/" + name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
|
@ -70,9 +70,9 @@ function getDelayedTrickPicture(name) {
|
|||
|
||||
|
||||
function getEquipIcon(cid, icon) {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
let extension = data.extension;
|
||||
let name = icon || data.name;
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const extension = data.extension;
|
||||
const name = icon || data.name;
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/equipIcon/" + name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
|
|
|
@ -1307,8 +1307,8 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif
|
|||
bottom = d[2]
|
||||
end
|
||||
else
|
||||
top = table.random(cards, top_limit and top_limit[2] or #cards)
|
||||
bottom = table.shuffle(table.filter(cards, function(id) return not table.contains(top, id) end))
|
||||
top = table.random(cards, top_limit and top_limit[2] or #cards) or {}
|
||||
bottom = table.shuffle(table.filter(cards, function(id) return not table.contains(top, id) end)) or {}
|
||||
end
|
||||
|
||||
if not noPut then
|
||||
|
|
Loading…
Reference in New Issue
Block a user