-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrape.js
More file actions
49 lines (40 loc) · 1.43 KB
/
scrape.js
File metadata and controls
49 lines (40 loc) · 1.43 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
/**
* @method scrape
* @description Hit T1 NPC project page, check levels of script locations,
* format them for user.sh, and return the list of locations
* @param {Object} h hackmud script context
* @param {Object} a arguments for script
* - t: {Scriptor} hackmud user.loc to hit: #s.user.loc
* - a: {Object} arguments for T1 NPC Corp directory page
* - [nav]: {String} this key may be a number of possible strings
* - [pass]: {String} this key may be a number of possible strings
* - [proj]: {String} this key may be a number of possible strings
*/
function(h, { t, a }) { //t: #s.user.loc, a: {}
// security_level: 4
// chars: 197
// NOTE: Should remove JSDoc Comments to upload
let
r, //response
// logging array
l = [],
// security level
g = [4]
;
// call target with passed arguments
r = t.call(a)
// if we were not given an array, die
if (!Array.isArray(r)) return { ok: !!0 }
// iterate through response array
r.forEach(u => {
// if the user loc has a FULLSEC script level
// NOTE: we ignore any corrupted locations because there are generally enough
// results without them when paired with our user.harvest script
if (g.includes(#s.scripts.get_level({ name: `${u}`}))) {
// push user info into our logging array, formatted for user.sh script
l.push(`user.sh {t: #s.${u} }`)
}
})
//return success and array of user locs
return { ok: !!1, l }
}