master
Raw Download raw file
 1// ________                                                _________
 2// \________\--------___       ___         ____----------/_________/
 3//     \_______\----\\\\\\   //_ _ \\    //////-------/________/
 4//         \______\----\\|| (( ~|~ )))  ||//------/________/
 5//             \_____\---\\ ((\ = / ))) //----/_____/
 6//                  \____\--\_)))  \ _)))---/____/
 7//                        \__/  (((     (((_/
 8// ヾღ彡                   |  -)))  -  ))
 9// =================================================================
10// _t2_name_harvester.js
11// -----------------------------------------------------------------
12// author:  @archangel
13// SEC LVL: 4
14// Chars:   760
15// Descr:   Harvests T2 names from Bunnybat_hut, World_pop, or Blackstar.
16// Syntax:  _t2_name_harvester
17// Syntax:  _t2_name_harvester {x:0-2}
18// =================================================================
19
20// This is WIP and the documentation is missing
21
22function(context, args) //0 = bunny, 1 = world, default = bunnny
23{
24    var i = 0;
25    var j = 0;
26    var log = [];
27    var m = "";
28    var p = "";
29    var  debug = ["", "The", "World", "New", "L-1", "Blackstar", "Employees", "Take", "Profits", "XT-5", "Register", "Got", "Work", "REMINDER:", "Internal", "Feral", "Anyone", "For", "Setec", " Note", "Weyland"]
30    var hits = 0;
31    var x;
32    var s;
33 
34    if(isNaN(args.x))
35    {
36        x = 0;
37    } else {
38        x = args.x
39    }
40 
41
42    switch(x) {
43        case 0:
44            //s = #s.blackcore.pub_info({open:"updates"});
45            s = #s.weyland.extern({cmd:"happening"});
46            break;
47        case 1:
48            //s = #s.tyrell.external({navigation:"updates"});
49            break;
50        case 2:
51            //s = #s.tyrell.external({navigation:"updates"});
52            break;
53        default:
54            //s = #s.setec_gas.pub_info({get:"blog"});
55            break;
56    }
57   
58    //For each item in the output:
59    while (++i < s.length) {
60        //Break the first paragraph down to the first newline
61        m = s[i].substr(s[i].search(/\n/)+1, s[i].length);
62        //Find the first word in the setence.
63        p = m.substr(0, m.search(/ /));
64        j = 0;
65        hits = 0;
66        //Check the word against known garbage
67        while(++j < debug.length) {
68            if (p === debug[j]) {
69                hits++;
70            }
71        }
72 
73        if(p === "'We've") {
74            p = m.split(" ");
75            log.push(p[9]);
76        } else if(hits === 0) {
77            log.push(p);
78        }
79   }
80 
81    return log;
82}