-
Notifications
You must be signed in to change notification settings - Fork 1
/
worker.js
67 lines (67 loc) · 2.53 KB
/
worker.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
57
58
59
60
61
62
63
64
65
66
67
on('sheet:opened',function(){
// **** Gestion transition de version
getAttrs(["VERSION"], function(values) {
var verfdp = parseFloat(values.VERSION) || 0.0;
if (verfdp == 0.0) {
// Version 1.6 vers 1.7
getAttrs(["FOR_SUP","DEX_SUP","CON_SUP","INT_SUP","SAG_SUP","CHA_SUP"], function(jets) {
var sfor, sdex, scon, sint, ssag, scha = "";
if ( jets.FOR_SUP == "2" ){
sfor = "@{JETSUP}";
} else {
sfor = "@{JETNORMAL}";
}
if ( jets.DEX_SUP == "2" ){
sdex = "@{JETSUP}";
} else {
sdex = "@{JETNORMAL}";
}
if ( jets.CON_SUP == "2" ){
scon = "@{JETSUP}";
} else {
scon = "@{JETNORMAL}";
}
if ( jets.INT_SUP == "2" ){
sint = "@{JETSUP}";
} else {
sint = "@{JETNORMAL}";
}
if ( jets.SAG_SUP == "2" ){
ssag = "@{JETSUP}";
} else {
ssag = "@{JETNORMAL}";
}
if ( jets.CHA_SUP == "2" ){
scha = "@{JETSUP}";
} else {
scha = "@{JETNORMAL}";
}
setAttrs({
FOR_SUP: sfor,
DEX_SUP: sdex,
CON_SUP: scon,
INT_SUP: sint,
SAG_SUP: ssag,
CHA_SUP: scha,
VERSION: "1.7"
});
});
}
if (verfdp < 1.8) {
getAttrs(["cha"], function(values) {
setAttrs({
pc_max: 3+(parseInt(values.cha) || 0),
VERSION: "1.8"
});
});
}
});
});
on("change:cha",function(eventinfo){
if (eventinfo.sourceType == 'player'){
getAttrs(["pc_max"], function(values) {
var newpc = (parseInt(values.pc_max) || 0) - (parseInt(eventinfo.previousValue) || 0) + (parseInt(eventinfo.newValue) || 0);
setAttrs({pc_max: newpc});
});
}
});