-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCode.js
More file actions
125 lines (122 loc) · 4.33 KB
/
tempCode.js
File metadata and controls
125 lines (122 loc) · 4.33 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
command.add(['cs', 'changeskill'], (p1, p2, p3, p4) {
if(typeof p1 === 'string' || p1 instanceof String){
p1 = p1.replace("_", " "); // replace _ with space
p1.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // capitalize first letter of each word
let foundSkill = mod.settings.Skill[job].find(p => p.name == p1);
if(foundSkill){
if(p2){
p2.toLowerCase();
} else {
command.message("Missing 2nd argument");
changeSkillHelp();
return;
}
switch(p2){
case "targets":
let add = false;
let remove = false;
if(p3 == "add"){
add = true;
} else if(p3 == "remove"){
remove = true;
} else{
command.message("Missing 3rd argument");
changeSkillHelp();
return;
}
switch(p4){
case "enemyBuff":
case "enemyHealer":
case "enemyDps":
case "enemy":
case "boss":
case "npc":
if(foundSkill.type == "heal" || foundSkill.type == "cleanse"){
command.message("You can only target heal with heals, and cleanse with cleanse");
return;
}
let argIndex = foundSkill.targets.indexOf(p4);
if(add && argIndex == -1) foundSkill.targets.push(p4);
else if(remove && argIndex > -1) foundSkill.targets.splice(argIndex, 1);
break;
case "heal":
case "cleanse":
if(foundSkill.type != p4){
command.message("You can only target heal with heals, and cleanse with cleanse");
return;
}
let argIndex = foundSkill.targets.indexOf(p4);
if(add && argIndex == -1) foundSkill.targets.push(p4);
else if(remove && argIndex > -1) foundSkill.targets.splice(argIndex, 1);
break;
default:
command.message("Missing 4th argument");
changeSkillHelp();
return;
}
break;
case "distance":
if(isNaN(p3)) command.message("Distance must be a number");
else foundSkill.distance = p3.toString();
break;
case "maxtargetcount":
if(isNaN(p3)) command.message("maxTargetCount must be a number");
else if(p3 > -1) foundSkill.maxTargetCount = p3.toString();
break;
case "lockondelay":
if(isNaN(p3)) command.message("lockonDelay must be a number");
else if(p3 > -1) foundSkill.lockonDelay = p3.toString();
break;
case "autocastdelay":
if(isNaN(p3)) command.message("autoCastDelay must be a number");
else if(p3 > -1) foundSkill.autoCastDelay = p3.toString();
break;
case "autocast":
switch(p4){
case "on":
case "true":
foundSkill.autoCast = true;
break;
case "off":
case "false":
foundSkill.autoCast = false;
break;
default:
foundSkill.autoCast = !foundSkill.autoCast;
break;
}
default:
command.message("2nd argument is invalid");
changeSkillHelp();
return;
}
mod.saveSettings();
} else{
command.message("Couldn't find skill named " + p1);
changeSkillHelp();
}
}
});
function changeSkillHelp(){
command.message("The command changeskill format is:");
command.message("changeskill skill_name targets add/remove atarget");
command.message("changeskill skill_name distance thedistance");
command.message("changeskill skill_name maxtargetcount numtargets");
command.message("changeskill skill_name lockondelay delay");
command.message("changeskill skill_name autocastdelay delay");
command.message("changeskill skill_name autocast [on/off/true/false]");
}
command.add(['teral', 'tlockons', 'teralockons', 'terablelockons'], (p1)=> {
if(p1 == "reload"){
if(mod.proxyAuthor !== 'caali'){
const options = require('./module').options
if(options){
const settingsVersion = options.settingsVersion
if(settingsVersion){
mod.settings = require('./' + (options.settingsMigrator || 'module_settings_migrator.js'))(mod.settings._version, settingsVersion, mod.settings)
mod.settings._version = settingsVersion
}
}
} else mod.settings = require('./config.json'); // idk if this works
} else toggleOnOfSetting("enabled", 'TerableLockons is ', p1, null);
});