-
Notifications
You must be signed in to change notification settings - Fork 1
/
HeadsetEffects.js
140 lines (99 loc) · 3.7 KB
/
HeadsetEffects.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// JavaScript source code
function HeadsetEffects() {
this.alertFrames = false;
this.positiveAlert;
this.negativeAlert;
this.noAlert;
this.damageFrames = false;
this.damageOn;
this.damageOff;
}
HeadsetEffects.prototype = {
createHealthAmmoMana: function(type, value) {
var data;
if (type == 1) { // Health
var green = (value / 100.0) * 0xff;
var red = 0xff - ((value / 100.0) * 0xff);
var color = (green) << 8 | red;
for (i = 0; i < 5; i++) {
data = color;
}
}
chromaSDK.createHeadsetEffect("CHROMA_STATIC", data);
},
createAlerts: function(type) {
if (this.alertFrames == false) {
this.positiveAlert = chromaSDK.preCreateHeadsetEffect("CHROMA_STATIC", 0xff00);
this.negativeAlert = chromaSDK.preCreateHeadsetEffect("CHROMA_STATIC", 0xff);
this.noAlert = chromaSDK.preCreateHeadsetEffect("CHROMA_NONE");
this.alertFrames = true;
}
if (type == 1) {
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.positiveAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.positiveAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.positiveAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
} else if (type == 0) {
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.negativeAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.negativeAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
sleep(200);
chromaSDK.setEffect(this.negativeAlert);
sleep(200);
chromaSDK.setEffect(this.noAlert);
}
},
createDamageTaken: function(){
if (this.damageFrames == false) {
this.damageOn = chromaSDK.preCreateHeadsetEffect("CHROMA_STATIC", 0xff);
this.damageOff = chromaSDK.preCreateHeadsetEffect("CHROMA_NONE");
this.damageFrames = true;
}
chromaSDK.setEffect(this.damageOn);
sleep(50);
chromaSDK.setEffect(this.damageOff);
},
free: function(){
if (this.loadingFrames == true) {
chromaSDK.deleteEffect(this.loadingFrame1);
chromaSDK.deleteEffect(this.loadingFrame2);
chromaSDK.deleteEffect(this.loadingFrame3);
chromaSDK.deleteEffect(this.loadingFrame4);
chromaSDK.deleteEffect(this.loadingFrame5);
chromaSDK.deleteEffect(this.loadingFrame6);
chromaSDK.deleteEffect(this.loadingFrame7);
chromaSDK.deleteEffect(this.loadingFrame8);
chromaSDK.deleteEffect(this.loadingFrame9);
chromaSDK.deleteEffect(this.loadingFrame10);
chromaSDK.deleteEffect(this.loadingFrame11);
chromaSDK.deleteEffect(this.loadingFrame12);
this.loadingFrames = false;
}
if (this.alertFrames == true) {
chromaSDK.deleteEffect(this.positiveAlert);
chromaSDK.deleteEffect(this.negativeAlert);
chromaSDK.deleteEffect(this.noAlert);
this.alertFrames = false;
}
if (this.damageFrames == true) {
chromaSDK.deleteEffect(this.damageOn);
chromaSDK.deleteEffect(this.damageOff);
this.damageFrames = false;
}
}
}