forked from honvl/Majsoul-to-NAGA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
57 lines (49 loc) · 7.8 KB
/
index.js
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
myObj = {"log":[[[0,0,0],[25000,25000,25000,25000],[11],[41],[11,16,18,21,22,26,27,29,29,33,36,37,42],[46,23,28,24,33],[42,11,46,29,18],[12,51,15,15,16,18,22,22,23,27,37,38,42],[46,17,45,38,12],[42,46,60,22,38],[11,17,17,23,24,25,28,29,32,34,36,37,45],[25,27,33,39],[11,45,"r25",60],[13,13,19,19,22,24,26,32,34,38,43,45,47],[46,14,18,52],[43,38,45,46],["和了",[0,-2000,3000,0],[2,1,2,"30符2飜2000点","平和(1飜)","立直(1飜)","裏ドラ(0飜)"]]],[[1,0,0],[25000,23000,27000,25000],[11],[29],[17,17,18,19,19,21,21,24,28,33,34,43,45],[43,27,42,52,35,31],[43,43,60,45,19,60],[13,13,14,15,16,22,23,28,32,34,43,44,45],[46,24,15,11,46,18,44],[43,44,45,60,28,46,46],[13,17,23,26,31,32,36,37,39,42,44,46,47],[26,51,28,14,25,36,18],[44,47,46,42,28,32,31],[12,12,14,15,16,19,23,24,29,33,34,37,38],[53,32,28,22,22,41,36],[19,60,60,"r29",60,60],["和了",[-3000,-6000,-3000,13000],[3,3,3,"跳満3000-6000点","断幺九(1飜)","門前清自摸和(1飜)","平和(1飜)","立直(1飜)","ドラ(2飜)","赤ドラ(1飜)","裏ドラ(0飜)"]]],[[2,0,0],[22000,17000,24000,37000],[46],[23],[11,13,15,18,18,23,23,32,36,37,41,42,44],[35,53,41,34,14,43,36],[44,42,11,32,23,60,"r23"],[11,14,16,23,24,28,29,33,35,39,39,45,46],[45,35,34,16,12,12,17],[11,46,28,29,35,16,45],[11,13,14,17,19,22,52,25,26,34,38,41,46],[47,28,21,34,16,15,36,15],[11,46,38,47,19,22,21,41],[11,51,19,22,25,26,29,31,32,36,37,37,45],[29,22,47,29,12,19,19],[45,19,11,47,60,60,32],["和了",[9000,0,-8000,0],[0,2,0,"満貫8000点","役牌:場風牌(1飜)","立直(1飜)","一発(1飜)","赤ドラ(1飜)","裏ドラ(0飜)"]]],[[3,0,0],[30000,17000,16000,37000],[42],[34],[11,14,18,24,26,27,27,27,34,39,41,44,45],[12,16,37,23,21,18,28,18,13,41,29,32,44,16,16],[44,11,41,45,60,39,18,60,37,16,18,29,60,41,12],[11,13,21,25,26,27,32,33,33,37,38,42,43],[41,15,47,47,15,35,14,32,25,29,35,36,36,12,46],[42,21,41,43,11,60,15,32,25,60,60,"r32",60,60,60],[12,19,19,22,24,52,28,28,29,29,39,43,44],[31,31,32,38,46,"3131p31",14,17,17,13,"p292929",34,26,43,51,13],[44,12,60,22,24,52,60,60,60,46,13,60,43,60,39,19],[14,15,21,23,23,24,25,26,31,37,42,44,45],[47,17,34,41,39,17,12,53,45,22,18,16,45,39,33,11],[42,44,45,47,41,31,60,21,60,37,39,17,22,45,"r39",60],["和了",[0,0,-11600,13600],[3,2,3,"30符4飜11600点","平和(1飜)","立直(1飜)","赤ドラ(1飜)","裏ドラ(1飜)"]]],[[3,1,0],[30000,16000,4400,49600],[13],[],[11,14,22,22,26,28,29,29,36,37,37,42,47],[26,45,16,39,15,11,43,13,"c272628",12],[11,60,47,60,29,60,60,29,26,42],[51,15,17,31,33,33,36,36,38,39,41,43,47],[21,16,44,45,11,28,44,35,16,46],[60,43,47,60,60,44,60,41,28,31],[18,18,19,21,23,26,31,33,34,43,45,46,47],[36,41,16,18,41,27,46,"p414141","c282627",32],[43,31,47,45,46,36,19,46,23,21],[11,12,13,19,21,23,24,52,25,25,27,32,39],[44,31,34,44,27,45,15,14,17,27,22],[60,39,19,60,21,31,45,27,27,60,17],["和了",[0,0,1300,-1300],[2,3,2,"30符1飜1000点","役牌:場風牌(1飜)"]]],[[4,0,0],[30000,16000,5700,48300],[29],[],[11,11,16,16,17,22,27,31,35,36,37,38,43],[45,23,19,15,18,43,52,14,14,28],[43,31,60,45,35,60,27,"r52",60,60],[12,13,21,24,26,28,29,32,36,41,42,42,47],[12,45,46,27,11,16,"c522426",18],[47,41,45,46,12,32,27,29],[18,22,22,23,24,27,31,33,34,34,43,43,44],["43p4343",29,53,21,44,34,14,26,39],[44,18,31,22,60,24,60,29,60],[12,14,16,19,23,27,32,36,37,38,38,39,47],[26,23,17,18,39,25,19,39,15],[47,19,32,38,39,39,60,60,27],["和了",[-3900,0,4900,0],[2,0,2,"30符3飜3900点","役牌:自風牌(1飜)","ドラ(1飜)","赤ドラ(1飜)"]]],[[5,0,0],[25100,16000,10600,48300],[11],[12],[14,17,23,25,26,29,31,33,36,38,41,43,44],[53,28,47,31,42,46,16,34,37,42,33],[43,41,60,38,60,60,29,44,14,28,42],[13,15,16,18,24,26,29,29,36,36,41,42,46],[47,28,41,22,17,24,26,37,"c141315",35,21],[42,46,47,41,41,29,29,28,22,36,60],[14,18,19,23,24,27,32,32,33,38,41,44,45],[34,27,13,38,"38p3838",42,25,34,45,32,44],[41,44,45,32,18,19,42,34,60,32,60],[11,12,12,12,19,22,23,52,25,26,33,34,46],[19,14,27,28,47,31,18,32,13,31,16],[46,11,25,60,60,60,60,"r14",60,60,60],["和了",[0,-8000,0,9000],[3,1,3,"満貫8000点","立直(1飜)","ドラ(3飜)","赤ドラ(1飜)","裏ドラ(0飜)"]]],[[6,0,0],[25100,8000,10600,56300],[29],[],[13,19,22,23,23,31,32,32,33,37,37,39,43],[36,27,27,13,28,45,33,31,38,35,41,52,31,44,47],[19,60,60,32,60,60,39,43,13,13,60,31,60,60,60],[11,51,15,21,24,26,35,42,44,44,45,46,46],["4444p44",43,36,38,"4646p46",43,13,22,39,14,24,28,16,18,47,29,37],[11,42,43,60,45,60,60,26,24,60,60,60,60,60,60,60,39],[14,18,21,22,23,28,32,33,36,41,42,44,46],[47,28,12,26,21,19,34,12,39,27,18,45,37,19,"p181818",15,26,"1212p12",22],[44,42,47,41,46,21,26,36,60,60,14,60,28,28,19,19,60,15,60],[11,11,14,17,18,19,21,27,32,34,38,38,41],[31,29,34,12,24,26,25,34,17,16,13,14,46,35,12,25,36],[21,41,14,11,60,29,38,38,60,19,31,11,60,32,12,25],["和了",[-700,-700,-1300,2700],[3,3,3,"20符3飜700-1300点","断幺九(1飜)","門前清自摸和(1飜)","平和(1飜)"]]],[[7,0,0],[24400,7300,9300,59000],[16],[],[11,12,13,19,22,31,31,31,33,37,42,42,46],[13,27,37,39,35,41,44,45,37,26,39,33,47,45,23,24,53,11],[60,46,27,37,60,60,60,60,42,42,33,60,60,60,39,39,60,60],[12,12,18,19,52,28,31,34,36,38,38,43,47],[34,14,44,47,39,11,45,17,38,13,34,42,39,25,21,47,11],[31,43,60,28,60,60,60,14,47,47,13,60,60,36,60,60,60],[16,17,18,24,24,24,27,29,32,36,42,43,45],[29,46,41,18,15,33,22,18,44,14,28,21,13,32,22,19,12],[43,60,60,42,45,36,29,33,15,29,32,60,14,13,32,28,44],[14,16,17,22,23,25,26,26,26,29,33,36,44],[46,38,37,21,43,17,23,41,15,35,32,21,32,16,15,28,35,27],[44,46,29,14,33,43,"r16",60,60,60,60,60,60,60,60,60,60,60],["流局",[-1500,1500,-1500,1500]]]],"rule":{"disp":"玉の間南喰赤","aka":1},"name":["永远亭のNEET","云影、","Honver","69のプロ"],"title":["玉の間南喰赤","12/21/2021, 1:35:11 AM"]};
var winnerIdx = 0;
//console.log(myObj.log[0][0][0]);
for (x in myObj.log) {
//find winner e=0 s=1 w=2 n=3
for (z in myObj.log[x][myObj.log[x].length-1][1]){
if (myObj.log[x][myObj.log[x].length-1][1][z] > 0){
winnerIdx = z;
}
}
//console.log(myObj.log[x][myObj.log[x].length-1][2])
for (z in myObj.log[x][myObj.log[x].length-1][2]){
if (typeof(myObj.log[x][myObj.log[x].length-1][2][z]) === 'string'){
//replace round wind yakuhai names
if (myObj.log[x][0][0] <=3){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:場風牌','場風 東');
}
else if (myObj.log[x][0][0] <= 7){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:場風牌','場風 南');
}
else {
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:場風牌','場風 西');
}
//replace seat wind yakuhai names
if (winnerIdx == 0){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:自風牌','自風 東')
}
else if (winnerIdx == 1){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:自風牌','自風 南')
}
else if (winnerIdx == 2){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:自風牌','自風 西')
}
else if (winnerIdx == 3){
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('役牌:自風牌','自風 北')
}
//replace double riichi
myObj.log[x][myObj.log[x].length-1][2][z] = myObj.log[x][myObj.log[x].length-1][2][z].replace('ダブル立直','両立直')
}
}
//console.log(myObj.log[x][myObj.log[x].length-1][2])
formattedObj = {};
formattedObj.title = myObj.title;
formattedObj.name = myObj.name;
formattedObj.rule = myObj.rule;
formattedObj.log = [myObj.log[x]];
// console.log(formattedObj);
console.log('https://tenhou.net/5/#json=' + JSON.stringify(formattedObj));
}