MediaWiki:Dbck.js:修订间差异
无编辑摘要 |
无编辑摘要 |
||
第277行: | 第277行: | ||
var url_xs = "./role_xs/ChrTX_Chd_Ply_" + str_xs + "_N.png"; | var url_xs = "./role_xs/ChrTX_Chd_Ply_" + str_xs + "_N.png"; | ||
console.log(url_xs); | console.log(url_xs); | ||
str_html = str_html + "</div>" + "< | str_html = str_html + "</div>" + "<img src='" + "https://wiki.17173.com/octopathsp/thumb.php?f=%E3%83%AA%E3%83%B3%E3%83%A6%E3%82%A6Ex.png&width=100x" + "'/>" + "<img class='img_xs' src='" + url_xs + "' />" + "</div>" | ||
} | } | ||
// var obj_result_area = document.getElementsByClassName("result_area")[0]; | // var obj_result_area = document.getElementsByClassName("result_area")[0]; |
2024年9月4日 (三) 16:50的版本
var percent_up_50 = 0.8;
var percent_up_45 = 0.4;
var percent_other_50 = 1.2;
var percent_other_45 = 1.6;
var percent_40 = 18;
var percent_35 = 40;
var percent_30 = 38;
var arr_star_3 = [
{ name:'马努埃尔',img:"./role/3/UiTX_Ply_0064_J08_1024.png" ,star:3},
{ name:'伊布林',img:"./role/3/UiTX_Ply_0063_J08_1024.png" ,star:3},
{ name:'哈利',img:"./role/3/UiTX_Ply_0062_J08_1024.png" ,star:3},
{ name:'霍尔赫',img:"./role/3/UiTX_Ply_0061_J02_1024.png" ,star:3},
{ name:'萨莉亚',img:"./role/3/UiTX_Ply_0060_J02_1024.png" ,star:3},
{ name:'佩妮',img:"./role/3/UiTX_Ply_0059_J02_1024.png" ,star:3},
{ name:'迪艾格',img:"./role/3/UiTX_Ply_0058_J03_1024.png" ,star:3},
{ name:'费丽妮',img:"./role/3/UiTX_Ply_0057_J03_1024.png" ,star:3},
{ name:'比利',img:"./role/3/UiTX_Ply_0056_J03_1024.png" ,star:3},
{ name:'赫塞',img:"./role/3/UiTX_Ply_0055_J05_1024.png" ,star:3},
{ name:'帕尔',img:"./role/3/UiTX_Ply_0054_J05_1024.png" ,star:3},
{ name:'特利',img:"./role/3/UiTX_Ply_0053_J05_1024.png" ,star:3},
{ name:'弗昂',img:"./role/3/UiTX_Ply_0052_J07_1024.png" ,star:3},
{ name:'卡萝尔',img:"./role/3/UiTX_Ply_0051_J07_1024.png" ,star:3},
{ name:'科妮',img:"./role/3/UiTX_Ply_0050_J07_1024.png" ,star:3},
{ name:'古提',img:"./role/3/UiTX_Ply_0049_J06_1024.png" ,star:3},
{ name:'薇薇安',img:"./role/3/UiTX_Ply_0048_J06_1024.png" ,star:3},
{ name:'萨妮',img:"./role/3/UiTX_Ply_0047_J06_1024.png" ,star:3},
{ name:'伍格',img:"./role/3/UiTX_Ply_0046_J01_1024.png" ,star:3},
{ name:'南娜',img:"./role/3/UiTX_Ply_0045_J01_1024.png" ,star:3},
{ name:'梅妮',img:"./role/3/UiTX_Ply_0044_J01_1024.png" ,star:3},
{ name:'弗利欧',img:"./role/3/UiTX_Ply_0043_J04_1024.png" ,star:3},
{ name:'尤妮丝',img:"./role/3/UiTX_Ply_0042_J04_1024.png" ,star:3},
{ name:'多利',img:"./role/3/UiTX_Ply_0041_J04_1024.png" ,star:3},
];
var arr_star_4 = [
{ name:'普利基特',img:"./role/4/UiTX_Ply_0090_J05_1024.png",star:4 },
{ name:'洛洛',img:"./role/4/UiTX_Ply_0110_J06_1024.png",star:4 },
{ name:'雪娜',img:"./role/4/UiTX_Ply_0120_J07_1024.png",star:4 },
{ name:'约伦',img:"./role/4/UiTX_Ply_0137_J01_1024.png",star:4 },
{ name:'勒凡',img:"./role/4/UiTX_Ply_0104_J04_1024.png",star:4 },
{ name:'波拉',img:"./role/4/UiTX_Ply_0101_J08_1024.png",star:4 },
{ name:'艾弗伦',img:"./role/4/UiTX_Ply_0115_J05_1024.png",star:4 },
{ name:'肯尼斯',img:"./role/4/UiTX_Ply_0119_J04_1024.png",star:4 },
{ name:'科尔尼利亚',img:"./role/4/UiTX_Ply_0065_J02_1024.png",star:4 },
{ name:'杜兰',img:"./role/4/UiTX_Ply_0096_J03_1024.png",star:4 },
{ name:'纳尔',img:"./role/4/UiTX_Ply_0095_J06_1024.png",star:4 },
{ name:'梅贝儿',img:"./role/4/UiTX_Ply_0039_J08_1024.png",star:4 },
{ name:'伊利斯',img:"./role/4/UiTX_Ply_0038_J08_1024.png",star:4 },
{ name:'法维欧',img:"./role/4/UiTX_Ply_0037_J08_1024.png",star:4 },
{ name:'莉塔',img:"./role/4/UiTX_Ply_0036_J02_1024.png",star:4 },
{ name:'歇尔薇',img:"./role/4/UiTX_Ply_0035_J02_1024.png",star:4 },
{ name:'罗迪恩',img:"./role/4/UiTX_Ply_0034_J02_1024.png",star:4 },
{ name:'玛德蕾妮',img:"./role/4/UiTX_Ply_0032_J05_1024.png",star:4 },
{ name:'诺艾尔',img:"./role/4/UiTX_Ply_0031_J04_1024.png",star:4 },
{ name:'塞德里克',img:"./role/4/UiTX_Ply_0030_J05_1024.png",star:4 },
{ name:'梅诺',img:"./role/4/UiTX_Ply_0029_J05_1024.png",star:4 },
{ name:'巴拉德',img:"./role/4/UiTX_Ply_0028_J07_1024.png",star:4 },
{ name:'贝尔加',img:"./role/4/UiTX_Ply_0026_J07_1024.png",star:4 },
{ name:'阿孜莱特',img:"./role/4/UiTX_Ply_0025_J03_1024.png",star:4 },
{ name:'卡米拉',img:"./role/4/UiTX_Ply_0024_J06_1024.png",star:4 },
{ name:'迈尔斯',img:"./role/4/UiTX_Ply_0022_J01_1024.png",star:4 },
{ name:'贝尔特朗',img:"./role/4/UiTX_Ply_0021_J06_1024.png",star:4 },
{ name:'洁卡莉特',img:"./role/4/UiTX_Ply_0019_J01_1024.png",star:4 },
{ name:'塔希尔',img:"./role/4/UiTX_Ply_0018_J01_1024.png",star:4 },
{ name:'特里休',img:"./role/4/UiTX_Ply_0017_J01_1024.png",star:4 },
{ name:'阿什兰',img:"./role/4/UiTX_Ply_0016_J06_1024.png",star:4 },
{ name:'劳拉',img:"./role/4/UiTX_Ply_0015_J04_1024.png",star:4 },
{ name:'佩雷迪尔',img:"./role/4/UiTX_Ply_0014_J04_1024.png",star:4 },
{ name:'米娜',img:"./role/4/UiTX_Ply_0040_J08_1024.png",star:4 },
{ name:'卢塞塔',img:"./role/4/UiTX_Ply_0023_J06_1024.png",star:4 },
{ name:'拉莫纳',img:"./role/4/UiTX_Ply_0020_J05_1024.png",star:4 },
{ name:'梅蕾特',img:"./role/4/UiTX_Ply_0033_J02_1024.png",star:4 },
{ name:'皮雅',img:"./role/4/UiTX_Ply_0027_J07_1024.png",star:4 },
{ name:'哈因茨',img:"./role/4/UiTX_Ply_0013_J04_1024.png",star:4 },
{ name:'德文',img:"./role/4/UiTX_Ply_0012_J07_1024.png",star:4 },
{ name:'克雷斯',img:"./role/4/UiTX_Ply_0010_J03_1024.png",star:4 },
{ name:'卡尔茨',img:"./role/4/UiTX_Ply_0011_J03_1024.png",star:4 },
{ name:'温格特',img:"./role/4/UiTX_Ply_0009_J03_1024.png",star:4 }
];
var arr_star_5_up = [
{ name:'艾丽莎',img:"./role/5/UiTX_Ply_0099_J01_1024.png",num:0.075 * 16,star:5 },
];
var arr_star_5_other = [
{ name:'洁卡莉特',img:"./role/5/UiTX_Ply_10201_J07_1024.png",num:0.8,star:5 },
{ name:'亚芬',img:"./role/5/UiTX_Ply_0071_J02_1024.png",num:0.8,star:5 },
{ name:'乌·鲁代',img:"./role/5//UiTX_Ply_0116_J07_1024.png",num:0.8,star:5 },
{ name:'泰蕾兹',img:"./role/5/UiTX_Ply_0081_J04_1024.png",num:0.8,star:5 },
{ name:'莱欧尼尔',img:"./role/5/UiTX_Ply_0066_J01_1024.png",num:0.8,star:5 },
{ name:'海茵特',img:"./role/5/UiTX_Ply_0072_J06_1024.png",num:0.8,star:5 },
{ name:'普里姆萝洁',img:"./role/5/UiTX_Ply_0068_J08_1024.png",num:0.8,star:5 },
{ name:'赛拉斯',img:"./role/5/UiTX_Ply_0073_J04_1024.png",num:0.8,star:5 },
{ name:'斯凯亚克罗',img:"./role/5/UiTX_Ply_0003_J06_1024.png",num:0.8,star:5 },
{ name:'菲欧儿',img:"./role/5/UiTX_Ply_0002_J01_1024.png",num:0.8,star:5 },
{ name:'米罗德',img:"./role/5/UiTX_Ply_0005_J05_1024.png",num:0.8,star:5 },
{ name:'薇欧拉',img:"./role/5/UiTX_Ply_0006_J03_1024.png",num:0.8,star:5 },
{ name:'莉妮特',img:"./role/5/UiTX_Ply_0008_J08_1024.png",num:0.8,star:5 },
{ name:'吉尔德罗伊',img:"./role/5/UiTX_Ply_0004_J07_1024.png",num:0.8,star:5 },
{ name:'特欧',img:"./role/5/UiTX_Ply_0007_J02_1024.png",num:0.8,star:5 },
{ name:'索菲亚',img:"./role/5/UiTX_Ply_0001_J04_1024.png",num:0.8,star:5 },
];
var arr_result = [];
var max_result_level = 3;
var step = 0;
var total_num = 0;
var up_num = 0;
var up_half_num = 0;
var other_num = 0;
var other_half_num = 0;
// 截取字符串
function extractContentBetweenStrings(text, start, end) {
var pattern = new RegExp(start + '((.*?)(?=' + end + '))', 'gm');
var matches = text.match(pattern);
if (matches) {
return matches[0].replace(start, '');
}
return null;
}
function ringMoveIn(count = 1) {
var obj_ring = document.getElementById("ring");
obj_ring.style = "display: block;"
setTimeout(()=>{
getRoles(count);
},3500)
}
function getRoles(count = 1) {
for (var i = 0; i < count; i++) {
cardResult();
}
// var obj_ring = document.getElementById("ring");
// obj_ring.style = "display:none;"
$("#ring").css("display","none");
if (max_result_level == 5) {
// var obj_ring_2 = document.getElementById("ring_2");
// obj_ring_2.style = "display:block;"
$("#ring_2").css("display","block")
} else if (max_result_level == 4) {
// var obj_ring_1 = document.getElementById("ring_1");
// obj_ring_1.style = "display:block;"
$("#ring_1").css("display","block")
} else {
// var obj_ring_0 = document.getElementById("ring_0");
// obj_ring_0.style = "display:block;"
$("#ring_0").css("display","block")
}
step = 2;
}
function cardResult() {
var result_num = Math.floor(Math.random() * 1000)/10.0;
var result_role = {};
var star_curr_num = 3;
if(result_num < percent_up_50) {
result_role = getRole("up_50");
} else if(result_num < percent_up_50 + percent_up_45) {
result_role = getRole("up_45");
} else if(result_num < percent_up_50 + percent_up_45 + percent_other_50) {
result_role = getRole("other_50");
} else if(result_num < percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45) {
result_role = getRole("other_45");
} else if(result_num < percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45 + percent_40) {
result_role = getRole("40");
} else if(result_num < percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45 + percent_40 + percent_35) {
result_role = getRole("35");
} else {
result_role = getRole("30");
}
if(max_result_level < result_role.star) {
max_result_level = result_role.star;
}
arr_result.push(result_role);
}
function getRole( str_star = "30") {
var thisArr = [];
var star_num = 3;
var half = false;
if(str_star == "30") {
thisArr = arr_star_3;
star_num = 3;
half = false;
} else if(str_star == "35") {
thisArr = arr_star_4;
star_num = 3;
half = true;
} else if( str_star == "40") {
thisArr = arr_star_4;
star_num = 4;
half = false;
} else if(str_star == "other_45") {
thisArr = arr_star_5_other;
other_half_num ++;
star_num = 4;
half = true;
} else if(str_star == "other_50") {
thisArr = arr_star_5_other;
other_num ++;
star_num = 5;
half = false;
} else if(str_star == "up_45") {
thisArr = arr_star_5_up;
up_half_num ++;
star_num = 4;
half = true;
} else if(str_star == "up_50") {
thisArr = arr_star_5_up;
up_num ++;
star_num = 5;
half = false;
} else {
return { name:"",img:"" }
}
var arr_length = thisArr.length;
var random_num = Math.floor(Math.random() * arr_length);
var result = thisArr[random_num];
result.star = star_num;
result.half = half;
return result;
}
function clickWindow() {
if(step != 2) return;
step = 3;
var obj_result_area = document.getElementsByClassName("result_area")[0];
obj_result_area.style = "display:flex;"
// 正常流程
setTimeout(()=>{
obj_result_area.style = "display:flex;background-image: url(./img/bg.png);"
var obj_all_result = document.getElementsByClassName("all_Result")[0];
obj_all_result.innerHTML = "<div>" + "本次抽卡" + total_num + "次,消费" + total_num * 30 + "钻石" + "</div><div>" + "抽到5星当期UP角色" + up_num + "次,4.5星当期UP角色" + up_half_num + "次</div><div>其他5星角色" + other_num + '次,其他4.5星角色' + other_half_num + '次' + "</div>";
showResults();
},2500)
// 非正常流程
// setTimeout(()=> {
// var obj_result_area = document.getElementsByClassName("result_area")[0];
// obj_result_area.innerHTML = "原神";
// },2500)
}
function showResults() {
var str_html = "";
for (var i = 0; i < arr_result.length; i++) {
var objThis = arr_result[i];
str_html = str_html + "<div class='role_area'>"
+ "<div class='text'>" + objThis.name + "</div>"
+ "<div class='text'>";
for(var j = 0; j < objThis.star ; j ++) {
str_html = str_html + "★"
}
if(objThis.half) {
str_html = str_html + "☆"
}
var str_xs = extractContentBetweenStrings(objThis.img,"UiTX_Ply_","_1024.png")
var url_xs = "./role_xs/ChrTX_Chd_Ply_" + str_xs + "_N.png";
console.log(url_xs);
str_html = str_html + "</div>" + "<img src='" + "https://wiki.17173.com/octopathsp/thumb.php?f=%E3%83%AA%E3%83%B3%E3%83%A6%E3%82%A6Ex.png&width=100x" + "'/>" + "<img class='img_xs' src='" + url_xs + "' />" + "</div>"
}
// var obj_result_area = document.getElementsByClassName("result_area")[0];
// obj_result_area.innerHTML = str_html;
$(".result_area").each(function(){
$(this).html(str_html).load()
})
setTimeout(()=>{
step = 0;
},1000)
}
function clickStart( count = 1) {
console.log(count)
if(step != 0) return
step = 1;
max_result_level = 3;
arr_result = [];
total_num = total_num + count;
var rings = document.getElementsByClassName("img_ring");
for(var i = 0;i < rings.length;i++) {
var obj_this = rings[i];
obj_this.style = "display:none;";
}
var obj_result_area = document.getElementsByClassName("result_area")[0];
obj_result_area.style = "display:none;"
obj_result_area.innerHTML = "";
getRoles(count);
}
function initFunc() {
console.log('initFunc');
$(document).ready(function() {
$('#btn_start_1').on("click",function() {
console.log('clickStart(1)');
clickStart(1)
});
$('#btn_start_2').on("click",()=>{
console.log('clickStart(10)');
clickStart(10)
});
$('#window_area').on("click",()=>{
clickWindow()
});
});
}
initFunc()