forked from Rainzye/extended-scripts-po
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
2521 lines (2318 loc) · 110 KB
/
Copy pathscripts.js
File metadata and controls
2521 lines (2318 loc) · 110 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This is the official Pokemon Online Scripts
// These scripts will only work on 2.0.00 or newer.
/*jshint laxbreak:true,shadow:true,undef:true,evil:true,trailing:true,proto:true,withstmt:true*/
// You may change these variables as long as you keep the same type
var Config = {
base_url: "https://raw.githubusercontent.com/NeonLightPWO/po-next-gen/master/",
dataDir: "scriptdata/",
bot: "Dratini",
kickbot: "Blaziken",
capsbot: "Exploud",
channelbot: "Chatot",
checkbot: "Snorlax",
coinbot: "Meowth",
countbot: "CountBot",
tourneybot: "Typhlosion",
rankingbot: "Porygon",
battlebot: "Blastoise",
commandbot: "CommandBot",
querybot: "QueryBot",
hangbot: "Unown",
bfbot: "Goomy",
safaribot: "Tauros",
teamsbot: "Minun",
// suspectvoting.js available, but not in use
Plugins: ["mafia.js", "amoebagame.js", "tourstats.js", "trivia.js", "tours.js", "newtourstats.js", "auto_smute.js", "battlefactory.js", "hangman.js", "blackjack.js", "mafiastats.js", "mafiachecker.js", "safari.js", "youtube.js", "autoteams.js"],
Mafia: {
bot: "Murkrow",
norepeat: 5,
stats_file: "scriptdata/mafia_stats.json",
max_name_length: 16,
notPlayingMsg: "±Game: A game is in progress. Please type /join to join the next mafia game."
},
DreamWorldTiers: ["All Gen Hackmons", "ORAS Hackmons", "ORAS Balanced Hackmons", "No Preview OU", "No Preview Ubers", "DW LC", "DW UU", "DW LU", "Gen 5 1v1 Ubers", "Gen 5 1v1", "Challenge Cup", "CC 1v1", "DW Uber Triples", "No Preview OU Triples", "No Preview Uber Doubles", "No Preview OU Doubles", "Shanai Cup", "Shanai Cup 1.5", "Shanai Cup STAT", "Original Shanai Cup TEST", "Monocolour", "Clear Skies DW"],
canJoinStaffChannel: [],
disallowStaffChannel: [],
topic_delimiter: " | ",
registeredLimit: 30
};
// Don't touch anything here if you don't know what you do.
/*global print, script, sys, SESSION*/
var require_cache = typeof require != 'undefined' ? require.cache : {};
require = function require(module_name, retry) {
if (require.cache[module_name])
return require.cache[module_name];
var module = {};
module.module = module;
module.exports = {};
module.source = module_name;
with (module) {
var content = sys.getFileContent("scripts/"+module_name);
if (content) {
try {
eval(sys.getFileContent("scripts/"+module_name));
sys.writeToFile("scripts/" + module_name + "-b", sys.getFileContent("scripts/" + module_name));
} catch(e) {
if (staffchannel)
sys.sendAll("Error loading module " + module_name + ": " + e + (e.lineNumber ? " on line: " + e.lineNumber : ""), staffchannel);
else
sys.sendAll("Error loading module " + module_name + ": " + e);
sys.writeToFile("scripts/"+module_name, sys.getFileContent("scripts/" + module_name + "-b"));
if (!retry) {
require(module_name, true); //prevent loops
}
}
}
}
require.cache[module_name] = module.exports;
return module.exports;
};
require.cache = require_cache;
var updateModule = function updateModule(module_name, callback) {
var base_url = Config.base_url;
var url;
if (/^https?:\/\//.test(module_name))
url = module_name;
else
url = base_url + "scripts/"+ module_name;
var fname = module_name.split(/\//).pop();
if (!callback) {
var resp = sys.synchronousWebCall(url);
if (resp === "") return {};
sys.writeToFile("scripts/"+fname, resp);
delete require.cache[fname];
var module = require(fname);
return module;
} else {
sys.webCall(url, function updateModule_callback(resp) {
if (resp === "") return;
sys.writeToFile("scripts/"+fname, resp);
delete require.cache[fname];
var module = require(fname);
callback(module);
});
}
};
var channel, contributors, mutes, mbans, safbans, smutes, detained, hmutes, mafiaSuperAdmins, hangmanAdmins, hangmanSuperAdmins, staffchannel, channelbot, normalbot, bot, mafiabot, kickbot, capsbot, checkbot, coinbot, countbot, tourneybot, battlebot, commandbot, querybot, rankingbot, hangbot, bfbot, scriptChecks, lastMemUpdate, bannedUrls, mafiachan, sachannel, tourchannel, rangebans, proxy_ips, mafiaAdmins, authStats, nameBans, chanNameBans, isSuperAdmin, cmp, key, battlesStopped, lineCount, maxPlayersOnline, pastebin_api_key, pastebin_user_key, getSeconds, getTimeString, sendChanMessage, sendChanAll, sendMainTour, VarsCreated, authChangingTeam, usingBannedWords, repeatingOneself, capsName, CAPSLOCKDAYALLOW, nameWarns, poScript, revchan, triviachan, watchchannel, lcmoves, hangmanchan, ipbans, battlesFought, lastCleared, blackjackchan, namesToWatch, allowedRangeNames, reverseTohjo, safaribot, safarichan, tourconfig, teamsbot, autoteamsAuth;
var pokeDir = "db/pokes/";
var moveDir = "db/moves/6G/";
var abilityDir = "db/abilities/";
var itemDir = "db/items/";
sys.makeDir("scripts");
/* we need to make sure the scripts exist */
var commandfiles = ['commands.js', 'channelcommands.js','ownercommands.js', 'modcommands.js', 'usercommands.js', "admincommands.js"];
var deps = ['crc32.js', 'utilities.js', 'bot.js', 'memoryhash.js', 'tierchecks.js', "globalfunctions.js", "userfunctions.js", "channelfunctions.js", "channelmanager.js", "pokedex.js"].concat(commandfiles).concat(Config.Plugins);
var missing = 0;
for (var i = 0; i < deps.length; ++i) {
if (!sys.getFileContent("scripts/"+deps[i])) {
if (missing++ === 0) sys.sendAll('Server is updating its script modules, it might take a while...');
var module = updateModule(deps[i]);
module.source = deps[i];
}
}
if (missing) sys.sendAll('Done. Updated ' + missing + ' modules.');
/* To avoid a load of warning for new users of the script,
create all the files that will be read further on*/
var cleanFile = function(filename) {
if (typeof sys != 'undefined')
sys.appendToFile(filename, "");
};
[Config.dataDir+"mafia_stats.json", Config.dataDir+"suspectvoting.json", Config.dataDir+"mafiathemes/metadata.json", Config.dataDir+"channelData.json", Config.dataDir+"mutes.txt", Config.dataDir+"mbans.txt", Config.dataDir+"safbans.txt", Config.dataDir+"hmutes.txt", Config.dataDir+"smutes.txt", Config.dataDir+"rangebans.txt", Config.dataDir+"contributors.txt", Config.dataDir+"ipbans.txt", Config.dataDir+"namesToWatch.txt", Config.dataDir+"watchNamesLog.txt", Config.dataDir+"hangmanadmins.txt", Config.dataDir+"hangmansuperadmins.txt", Config.dataDir+"pastebin_user_key", Config.dataDir+"secretsmute.txt", Config.dataDir+"ipApi.txt", Config.dataDir + "notice.html", Config.dataDir + "rangewhitelist.txt", Config.dataDir + "idbans.txt", Config.dataDir+"league.json", Config.dataDir + "autoteamsauth.txt"].forEach(cleanFile);
var autosmute = sys.getFileContent(Config.dataDir+"secretsmute.txt").split(':::');
var crc32 = require('crc32.js').crc32;
var MemoryHash = require('memoryhash.js').MemoryHash;
var POChannelManager = require('channelmanager.js').POChannelManager;
var POChannel = require('channelfunctions.js').POChannel;
var POUser = require('userfunctions.js').POUser;
var POGlobal = require('globalfunctions.js').POGlobal;
delete require.cache['tierchecks.js'];
var tier_checker = require('tierchecks.js');
delete require.cache['pokedex.js'];
var pokedex = require('pokedex.js');
// declare prototypes
Object.defineProperty(Array.prototype, "contains", {
configurable: true,
enumerable: false,
value: function (value) {
return this.indexOf(value) > -1;
}
});
Object.defineProperty(Array.prototype, "random", {
configurable: true,
enumerable: false,
value: function () {
return this[sys.rand(0, this.length)];
}
});
Object.defineProperty(Array.prototype, "shuffle", {
configurable: true,
enumerable: false,
value: function () {
for (var i = this.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = this[i];
this[i] = this[j];
this[j] = temp;
}
return this;
}
});
/* stolen from here: http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format */
String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
var regexp = new RegExp('\\{'+i+'\\}', 'gi');
formatted = formatted.replace(regexp, arguments[i]);
}
return formatted;
};
String.prototype.htmlEscape = function () {
return this.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
};
String.prototype.htmlStrip = function () {
return this.replace(/(<([^>]+)>)/gi, "");
};
String.prototype.toCorrectCase = function() {
if (isNaN(this) && sys.id(this) !== undefined) {
return sys.name(sys.id(this));
} else {
return this;
}
};
var utilities = require('utilities.js');
var isNonNegative = utilities.is_non_negative;
var Lazy = utilities.Lazy;
var nonFlashing = utilities.non_flashing;
var getSeconds = utilities.getSeconds;
var getTimeString = utilities.getTimeString;
var is_command = utilities.is_command;
var commands = require('commands.js');
/* Useful for evalp purposes */
function printObject(o) {
var out = '';
for (var p in o) {
if (o.hasOwnProperty(p)) {
out += p + ': ' + o[p] + '\n';
}
}
sys.sendAll(out);
}
/* Functions using the implicit variable 'channel' set on various events */
// TODO: remove the possibility for implictit channel
// TODO: REMOVE THESE FUNCTIONS THAT LIKE BREAKING AT RANDOM TIMES
function sendChanMessage(id, message, channel) {
sys.sendMessage(id, message, channel);
}
function sendChanAll(message, chan_id, channel) {
if((chan_id === undefined && channel === undefined) || chan_id == -1)
{
sys.sendAll(message);
} else if(chan_id === undefined && channel !== undefined)
{
sys.sendAll(message, channel);
} else if(chan_id !== undefined)
{
sys.sendAll(message, chan_id);
}
}
function sendChanHtmlMessage(id, message) {
sys.sendHtmlMessage(id, message, channel);
}
function sendChanHtmlAll(message, chan_id) {
if((chan_id === undefined && channel === undefined) || chan_id == -1)
{
sys.sendHtmlAll(message);
} else if(chan_id === undefined && channel !== undefined)
{
sys.sendHtmlAll(message, channel);
} else if(chan_id !== undefined)
{
sys.sendHtmlAll(message, chan_id);
}
}
/*function updateNotice(silent) {
var url = Config.base_url + "notice.html";
sys.webCall(url, function (resp){
sys.writeToFile(Config.dataDir + "notice.html", resp);
});
sendNotice(silent);
}*/
function sendNotice(silent) {
var notice = sys.getFileContent(Config.dataDir + "notice.html");
if (notice && !silent) {
["Tohjo Falls", "Trivia", "Tournaments", "Indigo Plateau", "Victory Road", "Mafia", "Hangman", "Safari"].forEach(function(c) {
sys.sendHtmlAll(notice, sys.channelId(c));
});
}
}
function isAndroid(id) {
if (sys.os) {
return sys.os(id) === "android";
} else {
return sys.info(id) === "Android player." && sys.avatar(id) === 72;
}
}
function clearTeamFiles() {
var files = sys.filesForDirectory("usage_stats/formatted/team");
for (var x = 0; x < files.length; x++) {
var time = files[x].split("-")[0];
if (sys.time() - time > 86400) {
sys.deleteFile("usage_stats/formatted/team/" + files[x]);
}
}
}
var POKEMON_CLEFFA = typeof sys != 'undefined' ? sys.pokeNum("Cleffa") : 173;
function callplugins() {
return SESSION.global().callplugins.apply(SESSION.global(), arguments);
}
function getplugins() {
return SESSION.global().getplugins.apply(SESSION.global(), arguments);
}
SESSION.identifyScriptAs("PO Scripts v0.991");
SESSION.registerChannelFactory(POChannel);
SESSION.registerUserFactory(POUser);
SESSION.registerGlobalFactory(POGlobal);
if (typeof SESSION.global() != 'undefined') {
SESSION.global().channelManager = new POChannelManager('scriptdata/channelHash.txt');
SESSION.global().__proto__ = POGlobal.prototype;
var plugin_files = Config.Plugins;
var plugins = [];
for (var i = 0; i < plugin_files.length; ++i) {
var plugin = require(plugin_files[i]);
plugin.source = plugin_files[i];
plugins.push(plugin);
}
SESSION.global().plugins = plugins;
// uncomment to update either Channel or User
sys.channelIds().forEach(function(id) {
if (!SESSION.channels(id))
sys.sendAll("ScriptUpdate: SESSION storage broken for channel: " + sys.channel(id), staffchannel);
else
SESSION.channels(id).__proto__ = POChannel.prototype;
});
sys.playerIds().forEach(function(id) {
if (sys.loggedIn(id)) {
var user = SESSION.users(id);
if (!user) {
sys.sendAll("ScriptUpdate: SESSION storage broken for user: " + sys.name(id), staffchannel);
} else {
user.__proto__ = POUser.prototype;
user.battles = user.battles || {};
}
}
});
}
// Bot.js binds the global variable 'channel' so we cannot re-use it
// since the binding will to the old variable.
delete require.cache['bot.js'];
var Bot = require('bot.js').Bot;
normalbot = bot = new Bot(Config.bot);
mafiabot = new Bot(Config.Mafia.bot);
channelbot = new Bot(Config.channelbot);
kickbot = new Bot(Config.kickbot);
capsbot = new Bot(Config.capsbot);
checkbot = new Bot(Config.checkbot);
coinbot = new Bot(Config.coinbot);
countbot = new Bot(Config.countbot);
tourneybot = new Bot(Config.tourneybot);
rankingbot = new Bot(Config.rankingbot);
battlebot = new Bot(Config.battlebot);
commandbot = new Bot(Config.commandbot);
querybot = new Bot(Config.querybot);
hangbot = new Bot(Config.hangbot);
bfbot = new Bot(Config.bfbot);
safaribot = new Bot(Config.safaribot);
teamsbot = new Bot(Config.teamsbot);
/* Start script-object
*
* All the events are defined here
*/
var lastStatUpdate = new Date();
poScript=({
/* Executed every second */
step: function() {
if (typeof callplugins == "function") callplugins("stepEvent");
var date = new Date();
if (date.getUTCMinutes() === 10 && date.getUTCSeconds() === 0 && sys.os() !== "windows") {
/*sys.get_output("nc -z server.pokemon-online.eu 10508", function callback(exit_code) {
if (exit_code !== 0) {
sys.sendAll("±NetCat: Cannot reach Webclient Proxy - it may be down.", sys.channelId("Indigo Plateau"));
}
}, function errback(error) {
sys.sendAll("±NetCat: Cannot reach Webclient Proxy - it may be down: " + error, sys.channelId("Indigo Plateau"));
});*/
clearTeamFiles();
}
if (date.getUTCHours() % 3 === 0 && date.getUTCMinutes() === 0 && date.getUTCSeconds() === 0) {
sendNotice();
}
if (date.getUTCHours() % 1 === 0 && date.getUTCMinutes() === 0 && date.getUTCSeconds() === 0) {
print("CURRENT SERVER TIME: " + date.toUTCString()); //helps when looking through logs
}
// Reset stats monthly
var JSONP_FILE = "usage_stats/formatted/stats.jsonp";
if (lastCleared != date.getUTCMonth()) {
lastCleared = date.getUTCMonth();
battlesFought = 0;
sys.saveVal("Stats/BattlesFought", 0);
sys.saveVal("Stats/LastCleared", lastCleared);
sys.saveVal("Stats/MafiaGamesPlayed", 0);
sys.saveVal("Stats/TriviaGamesPlayed", 0);
sys.saveVal("Stats/HangmanGamesPlayed", 0);
}
if (date - lastStatUpdate > 60) {
lastStatUpdate = date;
// QtScript is able to JSON.stringify dates
var stats = {
lastUpdate: date,
usercount: sys.playerIds().filter(sys.loggedIn).length,
battlesFought: battlesFought,
mafiaPlayed: +sys.getVal("Stats/MafiaGamesPlayed"),
triviaPlayed: +sys.getVal("Stats/TriviaGamesPlayed"),
hangmanPlayed: + sys.getVal("Stats/HangmanGamesPlayed")
};
sys.writeToFile(JSONP_FILE, "setServerStats(" + JSON.stringify(stats) + ");");
}
},
serverStartUp : function() {
SESSION.global().startUpTime = +sys.time();
scriptChecks = 0;
this.init();
},
init : function() {
script.superAdmins = ["Mahnmut"];
script.rules = {
"1": {
"english": [
"1. Pokémon Online is an international server:",
"- Respect other peoples' cultures and do not demand they speak English. Everyone is welcome at Pokemon Online, as long as they follow the rules. However, if your username is in a language that reads text from right-to-left, we ask that you do not speak in the main chat, as this can reverse the entire chatroom. We may mute you or ask you to change your name if this happens."
],
"spanish": [
"1. Pokémon Online es un servidor internacional:",
"- Respeta las culturas ajenas y no demandes que hablen inglés o algun otro idioma que entiendas. Todos estan bienvenidos en Pokémon Online, siempre y cuando sigan las reglas, si tu nombre de usuario esta en un idioma que se lee de derecha a izquierda, te sugerimos que no hables en el chat, ya que esto puede revertir todo el cuadro de chat. Te silenciaremos o te pediremos que cambies de nombre si esto llega a pasar."
],
"chinese": [
"1.PO官服是一个国际服务器:",
"尊重其他民族的文化,不要歧视其他的语种。PO欢迎每一个遵守相关规定的玩家,无论他们来自何方,说着何种语言。但请注意,如果您的语言系统是自右向左读取文本,我们要求您不要在主频道聊天,因为这可能使整个聊天室混乱。如果发生这种情况,我们可能会对您禁言或要求您改变您的名字。"
],
"french": [
"1. Pokémon est un serveur international:",
"Il faut respecter la culture des autres et ne pas demander s'ils parlent Anglais. Tout le monde est bienvenue à Pokémon Online, tant que vous respectez les règles. Cependant, si votre nom d'utilisateur est un nom qui se lit de droite à gauche, on vous demandera de le changer parce qu'il amène la discussion entière à se renverser. On peut vous rendre muet ou vous demander de changer de nom si cela arrive."
]
},
"2": {
"english": [
"2. No advertising, excessive messages or caps, or inappropriate/obscene content:",
"- Do not post links unless they are to notable sites (Youtube, Smogon, Serebii, etc). Do not monopolize the chat with large amounts of messages, or short ones in rapid succession. You may advertise private channels provided you do not do it excessively. Posting pornographic or obscene content is punishable with a ban. Posting social media (Twitter/Facebook/kik) accounts is also punishable."
],
"spanish": [
"2. Nada de publicidad, mensajes excesivamente largos y sin sentido o abuso de mayusculas, nada de contenido inapropiado u obsceno:",
"- No publiques ningun enlace a menos que haga referencia a sitios conocidos y seguros (Youtube, Smogon, Serebii, etc). No trates de invadir el chat con mensajes extremadamente largos, o con mensajes cortos publicados de forma muy rápida. Puedes publicar tu canal siempre y cuando no lo hagas en exceso. Publicar contenido pornográfico o contenido obsceno se castiga con un ban. Publicar páginas de redes sociales que no sean de Pokémon Online (Facebook/Twitter/Kik) también esta prohibido y se castiga con un ban."
],
"chinese": [
"2. 不要发送广告、冗余信息、大写刷屏、淫秽信息:",
"不要在主聊天频道内发送链接,除非他们来自著名的网站(YouTube,Smogon,Serebii等)。不要试图以自我为中心,左右整个聊天室的话题;不要发送无意义的信息如连续发送省略号和无规则无意义的一串字母(测试网络情使用一个小写字母t 不要使用多个ttt也不是大写的T)你可以适当的宣传PO的某个频道,让大家参与其中,但要有度。发布色情或淫秽内容的将会被封禁。发布社交媒体账号/服务器地址(微博/ Facebook/QQ群号等/其他PO服务器地址 )也将受到处理。"
],
"french": [
"2. Pas de publicité , des messages ou des lettres capitales excessives, ou du contenu inapproprié/obscène:",
"Ne pas publier des liens à moins qu'ils soient notables (Youtube, Smogon, Serebii, etc). Ne pas prendre le monopole de la discussion avec beaucoup de messages, ou de courts messages rapidement. Vous pouvez faire la publicité à votre chaîne tant que ce n'est pas excessif. Tout contenu pornographique ou obscène peut vous faire banir. Partager des réseaux sociaux (Twitter/Facebook/kik) est également interdit."
]
},
"3": {
"english": [
"3. Use Find Battle, or join tournaments instead of asking in the main chat:",
"- The official channels on Pokemon Online have too much activity to allow battle requests in the chat. Use Find Battle or go join the tournaments channel and participate. The only exception is if you are unable to find a battle for a low-played tier, then asking once every 5 minutes or so is acceptable."
],
"spanish": [
"3. Usa el botón de buscar batalla, unete a los torneos en lugar de estar constantemente solicitando batallas en el chat:",
"- Los canales oficiales en Pokémon Online tienen demasiada actividad como para permitir que cualquiera solicite batallas en el chat. Utiliza el boton de buscar batallas o únete a los torneos en el canal oficial de torneos. La única excepción es si no eres capaz de encontrar una batalla a través del buscador debido a estar en una categoria poco jugada, entonces se te permite solicitar batallas una vez cada 5 minutos, y de forma educada."
],
"chinese": [
"3. 使用寻找对战按钮,或加入Tournaments频道的比赛,而不要问在主聊天频道求战:",
"出于PO主聊天频道的聊天内容繁杂,求战不被允许;请使用find battle寻找对战按钮,或者参与Tournaments频道的比赛;不过,如果你在一个没什么人的分级(如LC)可以允许每隔5分钟左右求战一下。"
],
"french": [
"3. Utilisez Find Battle, ou rejoignez les tournois au lieu de demander dans la discussion:",
"Les chaînes officielles de Pokémon Online ont beaucoup d'activités pour autoriser de faire ces demandes dans la discussion. Utilisez Find Battle ou rejoignez la chaîne des tournois et participer. La seule exception est si vous jouez un tiers peu joué, à ce moment là demander chaque 5 minutes est acceptable."
]
},
"4": {
"english": [
"4. Do not ask for authority:",
"- By asking, you may have eliminated your chances of becoming one in the future. If you are genuinely interested in becoming a staff member, a good way to get noticed is to become an active member of the community. Engaging others in intelligent chats and offering to help with graphics, programming, or tiering (among others) is a good way to get noticed. Repeated harrasment for auth will be punished."
],
"spanish": [
"4. No solicites autoridad:",
"- Al preguntar, es posible que hayas eliminado completamente tus oportunidades de ser una autoridad en el futuro. Si estas interesado en volverte parte del Staff, entonces una buena forma de empezar es ser un miembro activo en la comunidad. Motiva a otros a tener conversaciones inteligentes o productivas, ofrece tu ayuda si tienes habilidad con el arte, programación, las tiers (entre otras cosas) es lo que puedes hacer para que te tomemos en cuenta. El constante acoso a las autoridades para pedir ser tal será sancionado."
],
"chinese": [
"4.不要索取权限:",
"向管理索取权限很可能将让你失去未来成为权限的机会。如果你对成为一名PO管理真正感兴趣的话,最好的方式是积极的帮助他人,让管理们注意到你对他人的帮助。活跃聊天气氛、帮助PO客户端的编程或者参与平衡分级的讨论等等,是得到注意的好方法。不断地索要权限将会被处罚。"
],
"french": [
"4. Ne pas demander à recevoir l'autorité:",
"En demandant, vous perdez vos chances d'en devenir un dans le future. Si vous êtes vraiment interessés de faire parti de l'équipe, une bonne façon de se faire remarquer est devenir un membre actif dans la communauté. Lancer des discussions intelligentes et offrir des aides graphiques, de programmation, ou encore nous aider à rendre nos tiers meilleurs est une bonne façon de se faire remarquer. L'harcèlement continue aux autorités sera punie."
]
},
"5": {
"english": [
"5. No trolling, flaming, or harassing other players. Do not complain about hax in the chat, beyond a one line comment:",
"- Inciting responses with inflammatory comments, using verbal abuse against other players, or spamming them via chat/PM/challenges will not be tolerated. Harassing other players by constantly aggravating them or revealing personal information will be severely punished. A one line comment regarding hax after a loss to vent is fine, but excessive bemoaning is not acceptable. Excessive vulgarity will not be tolerated. Wasting the time of the authority will also result in punishment."
],
"spanish": [
"5. Nada de Trollear, insultar o acosar a otros jugadores. No te quejes constantemente del hax en el chat, no más allá de una linea:",
"- Incitar a otros jugadores con comentarios provocativos, usar el abuso verbal contra otros jugadores, o spammearlos a traves del chat/Mensajes Privados/Solicitudes de batalla no será tolerado. Acosar a otros jugadores al revelar su información personal será severamente penalizado. Una linea de comentario concerniente al hax luego de perder para deshagoarte esta bien, pero las quejas constantes no son aceptadas. La vulgaridad excesiva tampoco sera tolerada. Desperdiciar el tiempo de las autoridades también resultará en una sanción."
],
"chinese": [
"5.禁止钓鱼,恶言相向,或骚扰其他玩家。在主聊天室抱怨被Hax时,最多不要超出一句话:",
"通过煽动性的言语激起他人的回复、对他人进行辱骂等人身攻击、持续对他人发出不受欢迎的评论/挑战/私信都是禁止的行为。持续骚扰、恶意激怒、甚至人肉其他玩家将遭到严厉惩处;在被因为脸黑被hax以后发送一句抱怨的话是可以理解的,但是持续不断的抱怨和过分粗鲁的行为是不被允许的;恶意浪费管理的时间同样会受到处理。"
],
"french": [
"5. Ne pas troller, provoquer ou harceler les autres joueurs. Ne vous plaignez pas dans la discussion générale, à part une ligne:",
"Les réponses provocatives, les insultes à l'égard d'autres joueurs, ou le spammage par discussion/message privé/challenges ne sera pas accepter. Harceler les autres de façon exagérée ou réveler des informations personelles sera sévèrement puni. Une ligne pour se plaindre de la malchance est passable, mais ne pas en abuser. Trop de vulgarités ne sera pas permis. Ne faites pas perdre le temps des autorités."
]
},
"6": {
"english": [
"6. Do not misuse the server nor its guidelines:",
"- Stealing accounts or channels is prohibited. Any attempt to undermine the legitimacy of ladder rankings or tournaments (server or forum) counts as misuse. DDoS and other \"cyber attacks\" will not be tolerated. Evading and trying to find loop-holes for malicious intent both violate the guidelines. All ban appeals should be made directly in the Disciplinary Committee on the forums. Use of the server as a dating service or other various web services that it is not may also count as abuse."
],
"spanish": [
"6. No hagas un uso inadecuado de las reglas o las normativas:",
"- Robar cuentas o canales esta prohibido. Cualquier intento de alterar los rankings del servidor en general o los rankings del torneo, o los del foro también cuenta como un uso inadecuado. DDoS o cualquier otro \"ataque cibernético\" no será tolerado. Evadir las sanciones y tratar de buscar cualquier hueco o excusa dentro de las mismas reglas para fines maliciosos también violan las normativas. Todas las apelaciones para remover un ban se deben hacer directamente en el Comité Disciplinario (Disciplinary Committee) en el foro. El uso del servidor como un sitio de citas o cualquier otro servicio web también cuenta como un abuso de las reglas."
],
"chinese": [
"6. 其他常规的禁止事项:",
"严禁盗取他人账号和频道;禁止任何试图通过不公平的手段进行ladder刷分或赚取Tournaments积分;DDoS以及其他任何对服务器的网络攻击都将遭到严惩;通过改变IP等手段避开封禁、禁言将遭到进一步处罚;所有对于封禁的申诉请直接反馈到论坛专门的帖子里;将PO视作约会工具或是其他并非PO本意的功能也是被禁止的。"
],
"french": [
"6. Ne pas mal utiliser le serveur ni ses règles:",
"Voler des comptes ou des chaînes est interdit. Toute tentatives de devier la légitimité du rang ou des tournois (serveur et forum) compte comme mal utilisation. DDos et autres \"cyber attaques\" ne sont pas tolérées. Ne pas contourner un ban et ne pas tenter de trouver des échapatoires pour mal utiliser et violer les règles. Pour demander à être débanni, vous devez le faire sur les forums dans l'espace Disciplinary Committee. Le serveur n'est pas un site de rencontre ou autre services alors ne pas abuser de ceci."
]
}
};
lastMemUpdate = 0;
bannedUrls = [];
battlesFought = +sys.getVal("Stats/BattlesFought");
lastCleared = +sys.getVal("Stats/LastCleared");
mafiachan = SESSION.global().channelManager.createPermChannel("Mafia", "Use /help to get started!");
staffchannel = SESSION.global().channelManager.createPermChannel("Indigo Plateau", "Welcome to the main staff channel! Discuss things that other users shouldn't hear here!");
sachannel = SESSION.global().channelManager.createPermChannel("Victory Road", "Welcome to all channel staff!");
tourchannel = SESSION.global().channelManager.createPermChannel("Tournaments", 'Useful commands are "/join" (to join a tournament), "/unjoin" (to leave a tournament), "/viewround" (to view the status of matches) and "/megausers" (for a list of users who manage tournaments). Please read the full Tournament Guidelines: http://pokemon-online.eu/forums/showthread.php?2079-Tour-Rules');
watchchannel = SESSION.global().channelManager.createPermChannel("Watch", "Alerts are displayed here.");
triviachan = SESSION.global().channelManager.createPermChannel("Trivia", "Play trivia here!");
revchan = SESSION.global().channelManager.createPermChannel("TrivReview", "For Trivia Admins to review questions");
//mafiarev = SESSION.global().channelManager.createPermChannel("Mafia Review", "For Mafia Admins to review themes");
hangmanchan = SESSION.global().channelManager.createPermChannel("Hangman", "Type /help to see how to play!");
blackjackchan = SESSION.global().channelManager.createPermChannel("Blackjack", "Play Blackjack here!");
safarichan = SESSION.global().channelManager.createPermChannel("Safari", "Type /help to see how to play!");
/* restore mutes, smutes, mafiabans, rangebans, megausers */
script.mutes = new MemoryHash(Config.dataDir+"mutes.txt");
script.mbans = new MemoryHash(Config.dataDir+"mbans.txt");
script.smutes = new MemoryHash(Config.dataDir+"smutes.txt");
script.rangebans = new MemoryHash(Config.dataDir+"rangebans.txt");
script.contributors = new MemoryHash(Config.dataDir+"contributors.txt");
script.mafiaAdmins = new MemoryHash(Config.dataDir+"mafiaadmins.txt");
script.mafiaSuperAdmins = new MemoryHash(Config.dataDir+"mafiasuperadmins.txt");
script.hangmanAdmins = new MemoryHash(Config.dataDir+"hangmanadmins.txt");
script.hangmanSuperAdmins = new MemoryHash(Config.dataDir+"hangmansuperadmins.txt");
script.safbans = new MemoryHash(Config.dataDir+"safbans.txt");
script.ipbans = new MemoryHash(Config.dataDir+"ipbans.txt");
script.detained = new MemoryHash(Config.dataDir+"detained.txt");
script.hmutes = new MemoryHash(Config.dataDir+"hmutes.txt");
script.namesToWatch = new MemoryHash(Config.dataDir+"namesToWatch.txt");
script.namesToUnban = new MemoryHash(Config.dataDir+"namesToCookieUnban.txt");
script.idBans = new MemoryHash(Config.dataDir+"idbans.txt");
script.autoteamsAuth = new MemoryHash(Config.dataDir + "autoteamsauth.txt");
try {
script.league = JSON.parse(sys.read(Config.dataDir+"league.json")).league;
} catch (e) {
script.league = {};
}
var announceChan = (typeof staffchannel == "number") ? staffchannel : 0;
proxy_ips = {};
function addProxybans(content) {
var lines = content.split(/\n/);
for (var k = 0; k < lines.length; ++k) {
var proxy_ip = lines[k].split(":")[0];
if (proxy_ip !== 0) proxy_ips[proxy_ip] = true;
}
}
var PROXY_FILE = "proxy_list.txt";
var content = sys.getFileContent(PROXY_FILE);
if (content) { addProxybans(content); }
else sys.webCall(Config.base_url + PROXY_FILE, addProxybans);
if (typeof script.authStats == 'undefined')
script.authStats = {};
if (typeof nameBans == 'undefined') {
script.refreshNamebans();
}
if (typeof nameWarns == 'undefined') {
nameWarns = [];
try {
var serialized = JSON.parse(sys.getFileContent("scriptdata/nameWarns.json"));
for (var i = 0; i < serialized.nameWarns.length; ++i) {
nameWarns.push(new RegExp(serialized.nameWarns[i], "i"));
}
} catch (e) {
// ignore
}
}
if (SESSION.global().battleinfo === undefined) {
SESSION.global().battleinfo = {};
}
if (SESSION.global().BannedUrls === undefined) {
SESSION.global().BannedUrls = [];
sys.webCall(Config.base_url + "bansites.txt", function(resp) {
SESSION.global().BannedUrls = resp.toLowerCase().split(/\n/);
});
}
if (typeof VarsCreated != 'undefined')
return;
key = function(a,b) {
return a + "*" + sys.ip(b);
};
script.saveKey = function(thing, id, val) {
sys.saveVal(key(thing,id), val);
};
script.getKey = function(thing, id) {
var temp = key(thing,id);
if (temp) {
return sys.getVal(temp);
} else {
return false;
}
};
script.cmp = function(a, b) {
return a.toLowerCase() == b.toLowerCase();
};
//script.isMafiaAdmin = require('mafia.js').isMafiaAdmin;
//script.isMafiaSuperAdmin = require('mafia.js').isMafiaSuperAdmin;
//script.isSafariAdmin = require('safari.js').isChannelAdmin;
isSuperAdmin = function(id) {
if (typeof script.superAdmins != "object" || script.superAdmins.length === undefined) return false;
if (sys.auth(id) != 2) return false;
var name = sys.name(id);
for (var i = 0; i < script.superAdmins.length; ++i) {
if (script.cmp(name, script.superAdmins[i]))
return true;
}
return false;
};
script.battlesStopped = false;
maxPlayersOnline = 0;
lineCount = 0;
if (typeof script.chanNameBans == 'undefined') {
script.chanNameBans = [];
try {
var serialized = JSON.parse(sys.getFileContent(Config.dataDir+"chanNameBans.json"));
for (var i = 0; i < serialized.chanNameBans.length; ++i) {
script.chanNameBans.push(new RegExp(serialized.chanNameBans[i], "i"));
}
} catch (e) {
// ignore
}
}
try {
pastebin_api_key = sys.getFileContent(Config.dataDir+"pastebin_api_key").replace("\n", "");
pastebin_user_key = sys.getFileContent(Config.dataDir+"pastebin_user_key").replace("\n", "");
} catch(e) {
normalbot.sendAll("Couldn't load api keys: " + e, staffchannel);
}
sendMainTour = function(message) {
sys.sendAll(message, 0);
sys.sendAll(message, tourchannel);
};
script.allowedRangeNames = sys.getFileContent(Config.dataDir + "rangewhitelist.txt").split("\n");
callplugins("init");
VarsCreated = true;
}, /* end of init */
issueBan : function(type, src, tar, commandData, maxTime) {
var memoryhash = {"mute": script.mutes, "mban": script.mbans, "smute": script.smutes, "hmute": script.hmutes, "safban": script.safbans}[type];
var banbot;
if (type == "mban") {
banbot = mafiabot;
}
else if (type == "hmute") {
banbot = hangbot;
}
else if (type == "safban") {
banbot = safaribot;
}
else {
banbot = normalbot;
}
var verb = {"mute": "muted", "mban": "banned from Mafia", "smute": "secretly muted", "hmute": "banned from Hangman", "safban": "banned from Safari"}[type];
var nomi = {"mute": "mute", "mban": "mafia ban", "smute": "secret mute", "hmute": "hangman ban", "safban": "safari ban"}[type];
var sendAll = {
"smute": function(line) {
sys.dbAuths().map(sys.id).filter(function(uid) { return uid !== undefined; }).forEach(function(uid) {
banbot.sendMessage(uid, line);
});
},
"mban": function(line) {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, mafiachan);
banbot.sendAll(line, sachannel);
},
"mute": function(line) {
banbot.sendAll(line);
},
"hmute" : function(line) {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, hangmanchan);
banbot.sendAll(line, sachannel);
},
"safban" : function(line) {
banbot.sendAll(line, safarichan);
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, sachannel);
}
}[type];
var expires = 0;
var defaultTime = {"mute": "1d", "mban": "1d", "smute": "1d", "hmute": "1d", "safban": "1d"}[type];
var reason = "";
var timeString = "";
var data = commandData;
var ip;
var i = -1, j = -1, time = "";
if (data !== undefined) {
i = data.indexOf(":");
j = data.lastIndexOf(":");
time = data.substring(j + 1, data.length);
}
if (tar === undefined) {
if (i !== -1) {
commandData = data.substring(0, i);
tar = sys.id(commandData);
if (time === "" || isNaN(time.replace(/s\s|m\s|h\s|d\s|w\s|s|m|h|d|w/gi, ""))) {
time = defaultTime;
reason = data.slice(i + 1);
} else if (i !== j) {
reason = data.substring(i + 1, j);
}
}
}
var secs = getSeconds(time !== "" ? time : defaultTime);
// limit it!
if (typeof maxTime == "number") secs = (secs > maxTime || secs === 0 || isNaN(secs)) ? maxTime : secs;
if (secs > 0) {
timeString = getTimeString(secs);
expires = secs + parseInt(sys.time(), 10);
}
if (reason === "" && sys.auth(src) < 3) {
banbot.sendMessage(src, "You need to give a reason for the " + nomi + "!", channel);
return;
}
var tarip = tar !== undefined ? sys.ip(tar) : sys.dbIp(commandData);
if (tarip === undefined) {
banbot.sendMessage(src, "Couldn't find " + commandData, channel);
return;
}
var maxAuth = (tar ? sys.auth(tar) : sys.maxAuth(tarip));
if ((maxAuth>=sys.auth(src) && maxAuth > 0) || (type === "smute" && script.getMaxAuth(tar) > 0)) {
banbot.sendMessage(src, "You don't have sufficient auth to " + nomi + " " + commandData + ".", channel);
return;
}
var active = false;
if (memoryhash.get(tarip)) {
if (sys.time() - memoryhash.get(tarip).split(":")[0] < 15) {
banbot.sendMessage(src, "This person was recently " + verb, channel);
return;
}
active = true;
}
if (sys.loggedIn(tar)) {
if (SESSION.users(tar)[type].active) {
active = true;
}
}
sendAll((active ? nonFlashing(sys.name(src)) + " changed " + commandData + "'s " + nomi + " time to " + (timeString === "" ? "forever!" : timeString + " from now!") : commandData + " was " + verb + " by " + nonFlashing(sys.name(src)) + (timeString === "" ? "" : " for ") + timeString + "!") + (reason.length > 0 ? " [Reason: " + reason + "]" : "") + " [Channel: "+sys.channel(channel) + "]");
sys.playerIds().forEach(function(id) {
if (sys.loggedIn(id) && sys.ip(id) === tarip)
SESSION.users(id).activate(type, sys.name(src), expires, reason, true);
});
if (!sys.loggedIn(tar)) {
memoryhash.add(tarip, sys.time() + ":" + sys.name(src) + ":" + expires + ":" + commandData + ":" + reason);
}
var authority= sys.name(src).toLowerCase();
script.authStats[authority] = script.authStats[authority] || {};
script.authStats[authority]["latest" + type] = [commandData, parseInt(sys.time(), 10)];
},
unban: function(type, src, tar, commandData) {
var memoryhash = {"mute": script.mutes, "mban": script.mbans, "smute": script.smutes, "hmute": script.hmutes, "safban": script.safbans}[type];
var banbot;
if (type == "mban") {
banbot = mafiabot;
}
else if (type == "hmute") {
banbot = hangbot;
}
else if (type == "safban") {
banbot = safaribot;
}
else {
banbot = normalbot;
}
var verb = {"mute": "unmuted", "mban": "unbanned from Mafia", "smute": "secretly unmuted", "hmute": "unbanned from Hangman", "safban": "unbanned from Safari"}[type];
var nomi = {"mute": "unmute", "mban": "mafia unban", "smute": "secret unmute", "hmute": "hangman unban", "safban": "safari unban"}[type];
var past = {"mute": "muted", "mban": "mafia banned", "smute": "secretly muted", "hmute": "hangman banned", "safban": "safari banned"}[type];
var sendAll = {
"smute": function(line) {
banbot.sendAll(line, staffchannel);
},
"mban": function(line, ip) {
if (ip) {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, sachannel);
} else {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, mafiachan);
banbot.sendAll(line, sachannel);
}
},
"mute": function(line, ip) {
if (ip) {
banbot.sendAll(line, staffchannel);
} else {
banbot.sendAll(line);
}
},
"hmute" : function(line, ip) {
if (ip) {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, sachannel);
} else {
banbot.sendAll(line, hangmanchan);
banbot.sendAll(line, sachannel);
banbot.sendAll(line, staffchannel);
}
},
"safban" : function(line, ip) {
if (ip) {
banbot.sendAll(line, staffchannel);
banbot.sendAll(line, sachannel);
} else {
banbot.sendAll(line, safarichan);
banbot.sendAll(line, sachannel);
banbot.sendAll(line, staffchannel);
}
}
}[type];
if (tar === undefined) {
if (memoryhash.get(commandData)) {
sendAll("IP address " + commandData + " was " + verb + " by " + nonFlashing(sys.name(src)) + "!", true);
memoryhash.remove(commandData);
return;
}
var ip = sys.dbIp(commandData);
if (ip !== undefined && memoryhash.get(ip)) {
sendAll("" + commandData + " was " + verb + " by " + nonFlashing(sys.name(src)) + "!");
memoryhash.remove(ip);
return;
}
banbot.sendMessage(src, "He/she's not " + past, channel);
return;
}
if (!SESSION.users(sys.id(commandData))[type].active) {
banbot.sendMessage(src, "He/she's not " + past, channel);
return;
}
if (SESSION.users(src)[type].active && tar == src) {
banbot.sendMessage(src, "You may not " + nomi + " yourself!", channel);
return;
}
sys.playerIds().forEach(function(id) {
if (sys.loggedIn(id) && sys.ip(id) === sys.ip(tar) && SESSION.users(id)[type].active) {
SESSION.users(id).un(type);
}
});
sendAll("" + commandData + " was " + verb + " by " + nonFlashing(sys.name(src)) + "!");
},
banList: function (src, command, commandData) {
var mh;
var name;
if (command == "mutes" || command == "mutelist") {
mh = script.mutes;
name = "Muted list";
} else if (command == "smutelist") {
mh = script.smutes;
name = "Secretly muted list";
} else if (command == "mafiabans") {
mh = script.mbans;
name = "Mafiabans";
} else if (command == "hangmanmutes" || command == "hangmanbans") {
mh = script.hmutes;
name = "Hangman Bans";
} else if (command == "safaribans") {
mh = script.safbans;
name = "Safari Bans";
}
var width=5;
var max_message_length = 30000;
var tmp = [];
var t = parseInt(sys.time(), 10);
var toDelete = [];
for (var ip in mh.hash) {
if (mh.hash.hasOwnProperty(ip)) {
var values = mh.hash[ip].split(":");
var banTime = 0;
var by = "";
var expires = 0;
var banned_name;
var reason = "";
if (values.length >= 5) {
banTime = parseInt(values[0], 10);
by = values[1];
expires = parseInt(values[2], 10);
banned_name = values[3];
reason = values.slice(4);
if (expires !== 0 && expires < t) {
toDelete.push(ip);
continue;
}
} else if (command == "smutelist") {
var aliases = sys.aliases(ip);
if (aliases[0] !== undefined) {
banned_name = aliases[0];
} else {
banned_name = "~Unknown~";
}
} else {
banTime = parseInt(values[0], 10);
}
if(typeof commandData != 'undefined' && (!banned_name || banned_name.toLowerCase().indexOf(commandData.toLowerCase()) == -1))
continue;
tmp.push([ip, banned_name, by, (banTime === 0 ? "unknown" : getTimeString(t-banTime)), (expires === 0 ? "never" : getTimeString(expires-t)), utilities.html_escape(reason)]);
}
}
for (var k = 0; k < toDelete.length; ++k)
delete mh.hash[toDelete[k]];
if (toDelete.length > 0)
mh.save();
tmp.sort(function(a,b) { return a[3] - b[3];});
// generate HTML
var table_header = '<table border="1" cellpadding="5" cellspacing="0"><tr><td colspan="' + width + '"><center><strong>' + utilities.html_escape(name) + '</strong></center></td></tr><tr><th>IP</th><th>Name</th><th>By</th><th>Issued ago</th><th>Expires in</th><th>Reason</th>';
var table_footer = '</table>';
var table = table_header;
var line;
var send_rows = 0;
while(tmp.length > 0) {
line = '<tr><td>'+tmp[0].join('</td><td>')+'</td></tr>';
tmp.splice(0,1);
if (table.length + line.length + table_footer.length > max_message_length) {
if (send_rows === 0) continue; // Can't send this line!
table += table_footer;
sys.sendHtmlMessage(src, table, channel);
table = table_header;
send_rows = 0;
}
table += line;
++send_rows;
}
table += table_footer;
if (send_rows > 0) {
sys.sendHtmlMessage(src, table, channel);
} else {
normalbot.sendMessage(src, "There are no active " + name + ".", channel);
}
return;
},
refreshNamebans: function() {
nameBans = [];
try {
var serialized = JSON.parse(sys.getFileContent("scriptdata/nameBans.json"));
for (var i = 0; i < serialized.nameBans.length; ++i) {
nameBans.push(new RegExp(serialized.nameBans[i], "i"));
}
} catch (e) {
// ignore
}
},
importable : function(id, team, compactible, extras) {
/*
Tyranitar (M) @ Choice Scarf
Lvl: 100
Trait: Sand Stream
IVs: 0 Spd