silk-road's picture
Upload 53 files
3b8d454 verified
$(function(){
tabFlagMap["recipe"] = false;
tabFuncMap.recipe = function(){
var index = 1;
$.each(makerecipedata,function(key,map){
var tr = $("<tr align='center'></tr>");
$("#recipeTable tbody").append(tr);
var recipeName = $("<td><span style='color:brown;font-size:2rem;'>"+map.NAME+"</span></td>");
var productSplit = map["产出"].split(":");
var result = $("<td></td>");
//是否有隐藏产物的配方来源
if(hideProduct[map.ID]){
result.append("隐藏产物");
}else{
result.append(findMapTips(productSplit[0]).append("×"+productSplit[1]));
}
if($(findMapTips(productSplit[0])).html() == ""){
//console.log(productSplit);
}
var material = $("<td></td>");
tr.append($("<td>"+map.INDEX+"</td>"));
tr.append("<td>"+index+"</td>");
tr.append(recipeName);
tr.append(result);
recipeName.append("<span style='display:none;'>"+map["PY"]+"</span>");
tr.append(material);
if(downloadFile[curVersionIndex].hideItemMakeRecipe && map.IGNORE){
material.append("请从游戏中获取配方详细");
return;
}
var materialMap = {};
//整理材料,将相同材料堆叠
for(var i=1;i<=9;i++){
if(map["原料"+i] != "NA"){
var materialSplit = map["原料"+i].split(":");
var materialId = materialSplit[0];
var needNum = materialSplit[1];
materialMap[materialId] = Number(materialMap[materialId]?materialMap[materialId]:0) + Number(needNum);
}
}
for(var key in materialMap){
var materialDiv = $("<div></div>");
material.append(materialDiv);
var materialId = key;
var needNum = materialMap[key];
if(map.ID >peifangLimitID){
if(needNum){
if(needNum>10){
var needStr = "";
for(var j=1;j<needNum.length;j++){
needStr += "?";
}
needNum = needStr + (needNum%10);
}else{
needNum = "?";
}
}
}
//是否隐藏配方
if(peifangNotShowIds[map.ID]){
materialDiv.append("毛哥说摸索去");
}else{
materialDiv.append(findMapTips(materialId).append("×"+needNum));
}
}
index++;
});
/*recipeTable*/
$('#recipeTable').dataTable( {
"pagingType": "full_numbers",
"language": {
"lengthMenu": "每页 _MENU_ 条记录",
"zeroRecords": "没有找到配方,一定是你没充值VIP!",
"info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
"infoEmpty": "没有配方",
"infoFiltered": "(从 _MAX_ 条配方过滤)",
"search": "搜索(可用<font color='red'>配方名称</font>首字母):",
"paginate": {
"first": "首页<font color=red>(W)</font>",
"last": "末页<font color=red>(S)</font>",
"next": "下一页<font color=red>(D)</font>",
"previous": "上一页<font color=red>(A)</font>"
},
},
// 默认按照索引排序,且隐藏索引列
"order": [[ 0, "asc" ]],
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
},
]
});
$('#recipeTable th').css("text-align","center");
}
});