forked from mirrors/webxoss-core
d68a3cb1b1
improve helper function set language in serve page log action and state in textarea
272 lines
7.1 KiB
HTML
272 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Server</title>
|
|
<script>
|
|
var global = window;
|
|
// function require (file) {
|
|
// return window[file.replace(/^\.[\/\\]/,'').replace(/.js$/,'')];
|
|
// }
|
|
function handleCardInfo() {
|
|
// var defaultValueMap = {
|
|
// "rarity": "LR",
|
|
// "cardType": "SIGNI",
|
|
// "color": "white",
|
|
// "level": 0,
|
|
// "limit": 0,
|
|
// "power": 0,
|
|
// "limiting": "",
|
|
// "classes": [],
|
|
// "costWhite": 0,
|
|
// "costBlack": 0,
|
|
// "costRed": 0,
|
|
// "costBlue": 0,
|
|
// "costGreen": 0,
|
|
// "costColorless": 0,
|
|
// "guardFlag": false,
|
|
// "multiEner": false,
|
|
// };
|
|
for (var x in CardInfo) {
|
|
var info = CardInfo[x];
|
|
delete info.timestamp;
|
|
delete info.kana;
|
|
delete info.imgUrl;
|
|
delete info.cardText;
|
|
delete info.cardText_zh_CN;
|
|
delete info.cardText_en;
|
|
delete info.constEffects;
|
|
delete info.actionEffects;
|
|
delete info.startUpEffects;
|
|
delete info.spellEffect;
|
|
delete info.artsEffect;
|
|
delete info.burstEffect
|
|
delete info.faqs;
|
|
delete info.cardSkills;
|
|
delete info.growCondition;
|
|
delete info.useCondition;
|
|
delete info.costChange;
|
|
delete info.costChangeBeforeUseAsyn;
|
|
delete info.resonaPhase;
|
|
delete info.resonaCondition;
|
|
delete info.resonaAsyn;
|
|
delete info.encore;
|
|
delete info.bettedCost;
|
|
if (info.rise) info.rise = true;
|
|
// for (var key in defaultValueMap) {
|
|
// if (info[key] === defaultValueMap[key]) {
|
|
// delete info[key];
|
|
// }
|
|
// }
|
|
}
|
|
// var textarea = document.createElement('textarea');
|
|
// textarea.value = JSON.stringify(CardInfo);
|
|
// document.body.appendChild(textarea);
|
|
// textarea.select();
|
|
}
|
|
|
|
function handleCardInfo_ko(min, max) {
|
|
var props = [
|
|
"name",
|
|
"actionEffectTexts",
|
|
"constEffectTexts",
|
|
"startUpEffectTexts",
|
|
"spellEffectTexts",
|
|
"artsEffectTexts",
|
|
"burstEffectTexts",
|
|
"attachedEffectTexts",
|
|
"extraTexts",
|
|
];
|
|
var suffix = [
|
|
"",
|
|
"_zh_CN",
|
|
"_en"
|
|
]
|
|
var arr = [];
|
|
for (var x in CardInfo) {
|
|
// if (x <= 1762) continue;
|
|
if (x < min || x > max) continue;
|
|
var info = CardInfo[x];
|
|
var obj = {
|
|
pid: info.pid,
|
|
wxid: info.wxid,
|
|
};
|
|
props.forEach(function(rawprop) {
|
|
// suffix.forEach(function (suf) {
|
|
// var prop = rawprop + suf;
|
|
// if (!info[prop]) return;
|
|
// obj[prop] = info[prop];
|
|
// });
|
|
obj[rawprop + "_ko"] = info[rawprop + "_en"];
|
|
});
|
|
arr.push(obj);
|
|
}
|
|
down(arr, `${min}-${max}.json`)
|
|
}
|
|
|
|
function fetchAndHandleRuJson(url) {
|
|
let CardInfo_ru = {};
|
|
fetch(url).then(res => res.json()).then(arr => {
|
|
arr.forEach(info => {
|
|
let info_ru = {};
|
|
for (let prop in info) {
|
|
if (!prop.match(/_ru$/)) continue;
|
|
info_ru[prop] = info[prop];
|
|
}
|
|
CardInfo_ru[info.pid] = info_ru;
|
|
});
|
|
window.ru = JSON.stringify(CardInfo_ru);
|
|
});
|
|
}
|
|
|
|
function getPrCards() {
|
|
let ids = [];
|
|
for (let pid in CardInfo) {
|
|
let card = CardInfo[pid];
|
|
let id = +card.wxid.replace('PR-', '');
|
|
if (id) ids.push(id);
|
|
}
|
|
ids.sort((a, b) => a - b);
|
|
let ranges = [];
|
|
let start = ids[0];
|
|
let end = ids[0];
|
|
ids.slice(1).concat(0).forEach(id => {
|
|
if ((id - end) === 1) {
|
|
end = id;
|
|
} else {
|
|
let range = `${('000'+start).slice(-3)}-${('000'+end).slice(-3)}`;
|
|
if (start === end) range = ('000' + start).slice(-3);
|
|
ranges.push(range);
|
|
start = end = id;
|
|
}
|
|
})
|
|
return ranges;
|
|
}
|
|
|
|
function getUntestedPr() {
|
|
let ids = [];
|
|
for (let pid in CardInfo) {
|
|
if (pid <= 1762) continue;
|
|
let card = CardInfo[pid];
|
|
if (card.pid !== card.cid) continue;
|
|
if (/^PR-/.test(card.wxid)) ids.push(card.wxid);
|
|
}
|
|
return ids;
|
|
}
|
|
|
|
function getNewCardNames() {
|
|
let names = [];
|
|
for (let pid in CardInfo) {
|
|
if (pid <= 1762) continue;
|
|
let card = CardInfo[pid];
|
|
if (card.pid !== card.cid) continue;
|
|
names.push(card.name_zh_CN);
|
|
}
|
|
return names;
|
|
}
|
|
|
|
function down(content, filename = 'down.txt') {
|
|
if (typeof content === 'object') {
|
|
content = JSON.stringify(content, null, ' ')
|
|
}
|
|
let blob = new Blob([content], {
|
|
type: 'application/octet-stream'
|
|
})
|
|
let url = URL.createObjectURL(blob)
|
|
let link = document.createElement('a')
|
|
link.href = url
|
|
link.download = filename
|
|
link.click()
|
|
}
|
|
</script>
|
|
<script src="util.js"></script>
|
|
<script src="random.min.js"></script>
|
|
<script src="Callback.js"></script>
|
|
<script src="Game.js"></script>
|
|
<script src="Phase.js"></script>
|
|
<script src="IO.js"></script>
|
|
<script src="Player.js"></script>
|
|
<script src="Card.js"></script>
|
|
<script src="Zone.js"></script>
|
|
<script src="CardInfo.js"></script>
|
|
<script src="Timming.js"></script>
|
|
<script src="Mask.js"></script>
|
|
<script src="ConstEffect.js"></script>
|
|
<script src="ConstEffectManager.js"></script>
|
|
<script src="Effect.js"></script>
|
|
<script src="EffectManager.js"></script>
|
|
<script src="FakeSocket.js"></script>
|
|
<script src="Client.js"></script>
|
|
<script src="Room.js"></script>
|
|
<script src="RoomManager.js"></script>
|
|
<script src="test.js"></script>
|
|
<script src="testHelper.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="float">
|
|
<div>
|
|
<span> p1 </span>
|
|
<select id="host-decks"></select>
|
|
</div>
|
|
<div>
|
|
<span> p2 </span>
|
|
<select id="ghost-decks"></select>
|
|
</div>
|
|
<div>
|
|
<button onclick="startBattle();">oben!</button>
|
|
</div>
|
|
<div> ---- Helper Function ---- </div>
|
|
<div>
|
|
<button onclick="grow();">grow!</button>
|
|
<button onclick="draw()">draw</button>
|
|
<button onclick="charge();">ener charge</button>
|
|
</div>
|
|
<div>
|
|
<input id="card-name" type="text" placeholder="wx15-001">
|
|
</div>
|
|
<button onclick="addTo('handZone');">add to hand</button>
|
|
<button onclick="addTo('lifeClothZone');">add to life cloth</button>
|
|
<button onclick="addTo('enerZone');">add to ener</button>
|
|
<button onclick="addTo('trashZone');">add to trash</button>
|
|
<div>
|
|
<button onclick="resetLrigDeck();">reset lrig deck</button>
|
|
</div>
|
|
<div>
|
|
<select id="select-language" onchange="changeLanguage();">
|
|
<option value="en">English</option>
|
|
<option value="zh_CN">简体中文</option>
|
|
<option value="zh_TW">繁體中文</option>
|
|
<option value="jp">日本語</option>
|
|
<option value="ko">한국어</option>
|
|
<option value="ru">русский</option>
|
|
<option value="it">Italiano</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<textarea id="log"></textarea>
|
|
</div>
|
|
</div>
|
|
<iframe class="float" src="../webxoss-client/DeckEditor/" width="1090px" height="690px" scrolling="no" frameborder="no" border="0"></iframe>
|
|
</body>
|
|
<style type="text/css">
|
|
a {
|
|
outline: none;
|
|
color: inherit;
|
|
text-decoration: none;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
textarea {
|
|
resize: none;
|
|
width: 270px;
|
|
height: 500px;
|
|
}
|
|
|
|
.float {
|
|
float: left;
|
|
}
|
|
</style>
|
|
|
|
</html>
|