-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminerTool.js
More file actions
80 lines (72 loc) · 1.73 KB
/
minerTool.js
File metadata and controls
80 lines (72 loc) · 1.73 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
const MinerToolClass = function(mod_, from_, plus_){
/**
value check
**/
if (typeof from_ === 'undefined')
from_ = 5000;
if (typeof plus_ === 'undefined')
plus_ = 5000;
/** @type {string} **/
const _mod = mod_.toString();
/** @type {number}// {uint16_t} **/
const _from = parseInt(from_);
/** @type {number}// {uint16_t} **/
const _plus = parseInt(plus_);
/**
*
* @param {?number}// {?uint16_t}
* @param {?number}// {?uint16_t}
* @private
* @return {number}// {uint16_t}
**/
const _randWait = function(from_, plus_){
if (typeof from_ === 'undefined')
from_ = _from;
if (typeof plus_ === 'undefined')
plus_ = _plus;
return (
from_ + Math.floor(Math.random() * plus_)
);
};
/**
* Easy to detect a scrapperbot
* if you searching for periodic events.
* A random number generator made it difficult.
*
* @param {function}
* @param {?number}// {?uint16_t}
* @param {?number}// {?uint16_t}
* @private
**/
const _setRandOut = function(func_, from_, plus_){
setTimeout(
func_,
_randWait(from_, plus_)
);
};
/**
*
* @param {function}
* @param {?number}// {?uint16_t}
* @param {?number}// {?uint16_t}
* @public
**/
this.setRandOut = function(func_, from_, plus_){
return _setRandOut(func_, from_, plus_);
};
/**
*
* @param {string}
* @param {string}
* @public
**/
this.log = function(proc_, msg_){
console.debug(
_mod+
' '+
proc_+
' : '+
msg_
);
}
};