Spaces:
Runtime error
Runtime error
$(function(){ | |
tabFlagMap["randomBag"] = false; | |
tabFuncMap.randomBag = function(){ | |
var index = 1 ; | |
$.each(itemrandombag,function(itemId,randombagId){ | |
var itemMap = itemtable[itemId]; | |
//实在没有,直接返回 | |
if(!itemMap){ | |
console.log("缺少数据,直接返回,ID:"+itemId); | |
return ; | |
} | |
var randomMap = randombagodds[randombagId]; | |
var randomIndex = -1; | |
if(!randomMap){ | |
console.log("宝箱ID不存在:"+randombagId); | |
return ; | |
} | |
var tr = $("<tr align='center'></tr>"); | |
$("#randomBagTable tbody").append(tr); | |
var x = parseInt(itemMap.ICON%15); | |
var y = parseInt(itemMap.ICON/15); | |
var icon = $("<div style='margin-bottom:1rem;'><div class='item quality_"+itemMap["品质"]+"' style='background:url(images/itemIcon.bmp) -"+(x*40+2)+"px -"+(y*40+2)+"px no-repeat;margin:0 25px 0 25px;' ></div></div>"); | |
var mtpis=getMtpis(itemMap.DESCRIPT); | |
mtpisListener(icon,mtpis); | |
icon.append("<span style='display:none;'>"+itemMap["PY"]+"</span>"); | |
var indexTd = $("<td>"+index+"</td>"); | |
var equipLevelDiv = $("<div style='color:#ff6600;'>Lv:"+itemMap["Level"]+"</div>"); | |
var randomName = $("<td><span style='color:brown;font-size:2rem;'>" + itemMap.NAME+"</span></td>").append(equipLevelDiv); | |
randomName.prepend(icon); | |
tr.append($("<td>"+randomMap.INDEX+"</td>")); | |
tr.append(indexTd); | |
//tr.append(icon); | |
tr.append(randomName); | |
icon.append("<span style='display:none;'>"+randomMap["PY"]+"</span>"); | |
var headArr = ["物品Id1","物品ID2","物品ID3","物品ID4","物品Id5","物品ID6","物品Id7","物品Id8"]; | |
var itemTd = $("<td></td>"); | |
tr.append(itemTd); | |
//去掉重复物品显示 | |
var hasArr = {}; | |
for(var i=0;i<headArr.length;i++){ | |
var itemIdHas = randomMap[headArr[i]]; | |
var item = itemtable[itemIdHas]; | |
if(hasArr[itemIdHas] == null){ | |
hasArr[itemIdHas] = ""; | |
var itemDiv = $("<div></div>"); | |
itemTd.append(itemDiv); | |
if(item && item.type1 == "203"){ | |
itemDiv.append(item203Tips(item)); | |
}else{ | |
itemDiv.append(findMapTips(itemIdHas)); | |
} | |
} | |
} | |
//来源 | |
var itemFrom = $("<td></td>"); | |
$.each(itemMap.SOURCE_FROM,function(key,sourceId){ | |
//是否有隐藏产物的配方来源 | |
if(hideProduct[sourceId]){ | |
return; | |
} | |
itemFrom.append($("<div></div>").append(findMapTips(sourceId))); | |
}); | |
tr.append(itemFrom); | |
index++; | |
}); | |
/*randomBag*/ | |
$('#randomBagTable').dataTable( { | |
"pagingType": "full_numbers", | |
"language": { | |
"lengthMenu": "每页 _MENU_ 条记录", | |
"zeroRecords": "没有找到法宝技能,难道我遗漏了?!", | |
"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 | |
}, | |
] | |
}); | |
$('#randomBagTable th').css("text-align","center"); | |
} | |
}); |