@@ -71,8 +71,8 @@ window.widget.serviceModules.registerServiceModuleProvider({
71
71
"t1" : [ true , 360 ] ,
72
72
"t2" : [ true , 480 ] ,
73
73
"t3" : [ true , 600 ] ,
74
- "tip" : [ true , 600 ] ,
75
- "cheer" : [ true , 600 ] ,
74
+ "tip" : [ true , 40 ] ,
75
+ "cheer" : [ true , 20 ] ,
76
76
"follow" : [ true , 60 ] ,
77
77
78
78
} ,
@@ -200,6 +200,7 @@ window.widget.serviceModules.registerServiceModuleProvider({
200
200
201
201
// Define what happens when we receive an Activity]
202
202
async function handle_activityReceived ( { activity} ) {
203
+ if ( activity . isMock ) return ;
203
204
if ( window . widget . persistentStorage . getValue ( { key : "state" } ) != "play" ) return ; // only get events when the timer is running
204
205
let str = "" ;
205
206
// Update subathon end timestamp
@@ -225,15 +226,21 @@ window.widget.serviceModules.registerServiceModuleProvider({
225
226
break ;
226
227
case 'tip' :
227
228
str = managedData . timeAdditions . tip [ 1 ] ;
228
- if ( isInt ( str ) && managedData . timeAdditions . tip [ 0 ] ) addTime ( parseInt ( str , 10 ) ) ;
229
+ var amount = Math . floor ( parseInt ( str , 10 ) * activity . data . amount ) ;
230
+ window . widget . bindableData . setValue ( { key :"subathon_tipAddition" , value :amount } ) ;
231
+ console . log ( amount ) ;
232
+ if ( isInt ( str ) && managedData . timeAdditions . tip [ 0 ] ) addTime ( amount ) ;
229
233
break ;
230
234
case 'follow' :
231
235
str = managedData . timeAdditions . follow [ 1 ] ;
232
236
if ( isInt ( str ) && managedData . timeAdditions . follow [ 0 ] ) addTime ( parseInt ( str , 10 ) ) ;
233
237
break ;
234
238
case 'cheer' :
235
239
str = managedData . timeAdditions . cheer [ 1 ] ;
236
- if ( isInt ( str ) && managedData . timeAdditions . cheer [ 0 ] ) addTime ( parseInt ( str , 10 ) ) ;
240
+ var amount = Math . floor ( parseInt ( str , 10 ) * activity . data . amount / 500 ) ;
241
+ console . log ( amount ) ;
242
+ window . widget . bindableData . setValue ( { key :"subathon_tipAddition" , value :amount } ) ;
243
+ if ( isInt ( str ) && managedData . timeAdditions . cheer [ 0 ] ) addTime ( amount ) ;
237
244
break ;
238
245
}
239
246
}
0 commit comments