File size: 3,107 Bytes
3b8d454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
$(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");
	}
	
});