forked from WhatPumpkin/Sburb-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.js
722 lines (627 loc) · 20.4 KB
/
commands.js
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
var Sburb = (function(Sburb){
function parseParams(info){
var params = info.split(",");
for(var i=0; i<params.length; i++){
params[i] = params[i].trim();
}
return params;
}
var commands = {};
//Create a Dialog
//syntax: dialog syntax
commands.talk = function(info){
Sburb.dialoger.startDialog(info);
}
//Pick a random line of dialog
//syntax: dialog syntax
commands.randomTalk = function(info){
Sburb.dialoger.startDialog(info);
var randomNum = Math.floor(Math.random()*(Sburb.dialoger.queue.length+1));
if(randomNum){
Sburb.dialoger.queue = [Sburb.dialoger.queue[randomNum-1]];
Sburb.dialoger.nextDialog();
}else{
Sburb.dialoger.queue = [];
}
}
//Change the room and move the character to a new location in that room
//syntax: roomName, newCharacterX, newCharacterY
commands.changeRoom = function(info){
var params = parseParams(info);
Sburb.changeRoom(Sburb.rooms[params[0]],parseInt(params[1]),parseInt(params[2]));
Sburb.loadingRoom = false; // We did it!
}
//Change the focus of the camera
//syntax: spriteName
commands.changeFocus = function(info){
var params = parseParams(info);
if(params[0]=="null"){
Sburb.focus = Sburb.destFocus = null;
}else{
var sprite = parseCharacterString(params[0]);
Sburb.destFocus = sprite;
}
}
//Perform changeRoom, and also add teleport effects
//syntax: see changeRoom
commands.teleport = function(info){
commands.changeRoom(info);
Sburb.playEffect(Sburb.effects["teleportEffect"],Sburb.char.x,Sburb.char.y);
var params = parseParams(info);
Sburb.curAction.followUp = new Sburb.Action("playEffect","teleportEffect,"+params[1]+","+params[2],null,null,Sburb.curAction.followUp);
//playSound(new BGM(assets["teleportSound"],0));
}
//Set a different Character as the player
//syntax: newPlayerName
commands.changeChar = function(info){
Sburb.char.becomeNPC();
Sburb.char.walk();
Sburb.destFocus = Sburb.char = Sburb.sprites[info];
Sburb.char.becomePlayer();
Sburb.setCurRoomOf(Sburb.char);
}
//Set the given song as the new background music
//syntax: songName, loopingStartPoint (seconds)
commands.playSong = function(info){
var params = parseParams(info);
Sburb.changeBGM(new Sburb.BGM(Sburb.assets[params[0]],parseFloat(params[1])));
}
commands.becomeNPC = function(info){
Sburb.char.becomeNPC();
}
commands.becomePlayer = function(info){
Sburb.char.becomePlayer();
}
//Play the given sound
//syntax: soundName
commands.playSound = function(info){
Sburb.playSound(new Sburb.Sound(Sburb.assets[info.trim()]));
}
//Play the given effect and the given location
//syntax: effectName, x, y
commands.playEffect = function(info){
var params = parseParams(info);
Sburb.playEffect(Sburb.effects[params[0]],parseInt(params[1]),parseInt(params[2]));
}
//Have the specified sprite play the specified animation
//syntax: spriteName, animationName
commands.playAnimation = commands.startAnimation = function(info){
var params = parseParams(info);
var sprite = parseCharacterString(params[0]);
sprite.startAnimation(params[1]);
}
//Add actions to a sprite
//Syntax: spriteName, SBURBML action tags
commands.addAction = commands.addActions = function(info){
var params = parseParams(info);
var firstComma = info.indexOf(",");
var sprite = parseCharacterString(params[0]);
var actionString = info.substring(firstComma+1,info.length);
var actions = parseActionString(actionString);
for(var i=0;i<actions.length;i++){
var action = actions[i];
sprite.addAction(action);
}
}
//Remove an action from a sprite
//Syntax: spriteName, actionName
commands.removeAction = commands.removeActions = function(info){
var params = parseParams(info);
var sprite = parseCharacterString(params[0]);
for(var i=1;i<params.length;i++){
sprite.removeAction(params[i]);
}
}
//Present player with following actions to choose from
//Sytax: SBURBML action tags
commands.presentAction = commands.presentActions = function(info){
var actions = parseActionString(info);
Sburb.chooser.choices = actions;
Sburb.chooser.beginChoosing(Sburb.Stage.x+20,Sburb.Stage.y+50);
//Sburb.Stage is the true position of the view. Sburb.cam is simply the desired position
}
//Open the specified chest, revealing the specified item, and with the specified text
//Syntax: chestName, itemName, message
commands.openChest = function(info){
var params = info.split(",",2);
var chest = Sburb.sprites[params[0].trim()];
var item = Sburb.sprites[params[1].trim()];
if(chest.animations["open"]){
chest.startAnimation("open");
if(Sburb.assets["openSound"]){
commands.playSound("openSound");
}
}
chest.removeAction(Sburb.curAction.name);
var offset = params[0].length+params[1].length+2;
var speech = info.substring(offset,info.length).trim();
speech = speech.charAt(0)=="@" ? speech : "@! "+speech;
var lastAction;
var newAction = lastAction = new Sburb.Action("waitFor","played,"+chest.name,null,null);
lastAction = lastAction.followUp = new Sburb.Action("waitFor","time,13");
lastAction = lastAction.followUp = new Sburb.Action("addSprite",item.name+","+Sburb.curRoom.name,null,null,null,true);
lastAction = lastAction.followUp = new Sburb.Action("moveSprite",item.name+","+chest.x+","+(chest.y-60),null,null,null,true,true);
lastAction = lastAction.followUp = new Sburb.Action("deltaSprite",item.name+",0,-3",null,null,null,true,null,10);
if(Sburb.assets["itemGetSound"]){
lastAction = lastAction.followUp = new Sburb.Action("playSound","itemGetSound",null,null,null,true,null);
}
lastAction = lastAction.followUp = new Sburb.Action("waitFor","time,30");
lastAction = lastAction.followUp = new Sburb.Action("talk",speech);
lastAction = lastAction.followUp = new Sburb.Action("removeSprite",item.name+","+Sburb.curRoom.name);
lastAction.followUp = Sburb.curAction.followUp;
Sburb.performAction(newAction);
}
//Move the specified sprite by the specified amount
//syntax: spriteName, dx, dy
commands.deltaSprite = function(info){
var params = parseParams(info);
var sprite = null;
if(params[0]=="char"){
sprite = Sburb.char;
}else{
sprite = Sburb.sprites[params[0]];
}
var dx = parseInt(params[1]);
var dy = parseInt(params[2]);
sprite.x+=dx;
sprite.y+=dy;
}
//Move the specified sprite to the specified location
//syntax: spriteName, x, y
commands.moveSprite = function(info){
var params = parseParams(info);
var sprite = parseCharacterString(params[0]);
var newX = parseInt(params[1]);
var newY = parseInt(params[2]);
sprite.x = newX;
sprite.y = newY;
}
//Move the specified sprite to the specified depth
//syntax: spriteName, depth
commands.depthSprite = function(info){
var params = parseParams(info);
var sprite = parseCharacterString(params[0]);
var depth = parseInt(params[1]);
sprite.depthing = depth;
}
//Play the specified flash movie
//syntax: movieName
commands.playMovie = function(info){
var params = parseParams(info);
Sburb.playMovie(Sburb.assets[params[0]]);
if(params.length>0){
var interval = setInterval(function(){
var movie = window.document.getElementById("movie"+params[0]);
if(movie && (!movie.CurrentFrame || movie.CurrentFrame()>=4)){
clearInterval(interval);
commands.playSong(info.substring(info.indexOf(",")+1,info.length));
}
},10);
}
}
//Remove the specified flash movie
//syntax: movieName
commands.removeMovie = function(info){
Sburb.playingMovie = false;
Sburb.draw();
document.getElementById(info).style.display = "none";
//document.getElementById("gameDiv").style.display = "block";
}
//Prevents user from providing input to the character
//syntax: none
commands.disableControl = function(info){
Sburb.inputDisabled = info.trim().length>0 ? new Sburb.Trigger(info) : true;
}
//Undoes disableControl
//syntax: none
commands.enableControl = function(info){
Sburb.inputDisabled = false;
}
//DEPRECATED; DO NOT USE
//Block user input and main-queue progression until the specified Event
//syntax: Event syntax
commands.waitFor = function(info){
commands.disableControl(info);
return commands.sleep(info);
}
//Execute an action and wait for all followUps to finish
//syntax: SBURBML action tag
commands.macro = function(info){
var actions = parseActionString(info);
var action = actions[0];
if(!action.silent) {
action.silent = true;
}
var newQueue = Sburb.performAction(action);
if(newQueue) {
return new Sburb.Trigger("waitFor,"+newQueue.id);
}
}
//Wait for the specified event before continuing the current queue
//syntax: Event syntax
commands.sleep = function(info){
return new Sburb.Trigger(info);
}
//Pauses an actionQueue, it can be resumed with resumeActionQueue
//syntax: Id of actionQueue or list of Ids
commands.pauseActionQueue = commands.pauseActionQueues = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
var queue=Sburb.getActionQueueById(params[i]);
if(queue) {
queue.paused = true;
}
}
}
//Resumes an previously paused actionQueue
//syntax: Id of actionQueue or list of Ids
commands.resumeActionQueue = commands.resumeActionQueues = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
var queue=Sburb.getActionQueueById(params[i]);
if(queue) {
queue.paused = false;
}
}
}
//Cancels an actionQueue
//syntax: Id of actionQueue or list of Ids
commands.cancelActionQueue = commands.cancelActionQueues = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
Sburb.removeActionQueueById(params[i]);
}
}
//Pauses a group of actionQueues, they can be resumed with resumeActionQueueGroup
//syntax: group name or list of group names
commands.pauseActionQueueGroup = commands.pauseActionQueueGroups = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
Sburb.forEachActionQueueInGroup(params[i], function(queue) {
queue.paused = true;
});
}
}
//Resumes a previously paused group of actionQueues
//syntax: group name or list of group names
commands.resumeActionQueueGroup = commands.resumeActionQueueGroups = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
Sburb.forEachActionQueueInGroup(params[i], function(queue) {
queue.paused = false;
});
}
}
//Cancels a group of actionQueues
//syntax: group name or list of group names
commands.cancelActionQueueGroup = commands.cancelActionQueueGroups = function(info){
var params = parseParams(info);
for(var i=0;i<params.length;i++) {
Sburb.removeActionQueuesByGroup(params[i]);
}
}
//Add the specified sprite to the specified room
//syntax: spriteName, roomName
commands.addSprite = function(info){
var params = parseParams(info);
var sprite = Sburb.sprites[params[0]];
var room = Sburb.rooms[params[1]];
room.addSprite(sprite);
}
//Remove the specified sprite from the specified room
//syntax: spriteName, roomName
commands.removeSprite = function(info){
var params = parseParams(info);
var sprite = Sburb.sprites[params[0]];
var room = Sburb.rooms[params[1]];
room.removeSprite(sprite);
}
//Clone the specified sprite with a new name
//syntax: spriteName, newName
commands.cloneSprite = function(info){
var params = parseParams(info);
var sprite = parseCharacterString(params[0]);
var newName = params[1];
sprite.clone(newName);
}
//Add the specified path as a walkable to the specified room
//syntax: pathName, roomName
commands.addWalkable = function(info){
var params = parseParams(info);
var path = Sburb.assets[params[0]];
var room = Sburb.rooms[params[1]];
room.addWalkable(path);
}
//Add the specified path as an unwalkable to the specified room
//syntax: pathName, roomName
commands.addUnwalkable = function(info){
var params = parseParams(info);
var path = Sburb.assets[params[0]];
var room = Sburb.rooms[params[1]];
room.addUnwalkable(path);
}
//Add the specified path as a motionpath to the specified room
//syntax: pathName, xtox, xtoy, ytox, ytoy, dx, dy, roomName
commands.addMotionPath = function(info){
var params = parseParams(info);
var path = Sburb.assets[params[0]];
var room = Sburb.rooms[params[7]];
room.addMotionPath(path,
parseFloat(params[1]),parseFloat(params[2]),
parseFloat(params[3]),parseFloat(params[4]),
parseFloat(params[5]),parseFloat(params[6]));
}
//Remove the specified walkable from the specified room
//syntax: pathName, roomName
commands.removeWalkable = function(info){
var params = parseParams(info);
var path = Sburb.assets[params[0]];
var room = Sburb.rooms[params[1]];
room.removeWalkable(path);
}
//Remove the specified unwalkable from the specified room
//syntax: pathName, roomName
commands.removeUnwalkable = function(info){
var params = parseParams(info);
var path = Sburb.assets[params[0]];
var room = Sburb.rooms[params[1]];
room.removeUnwalkable(path);
}
//Toggle the volume
//syntax: none
commands.toggleVolume = function(){
if(Sburb.globalVolume>=1){
Sburb.globalVolume=0;
}else if(Sburb.globalVolume>=0.6){
Sburb.globalVolume = 1;
}else if(Sburb.globalVolume>=0.3){
Sburb.globalVolume = 0.66;
}else {
Sburb.globalVolume = 0.33;
}
if(Sburb.bgm){
Sburb.bgm.fixVolume();
}
}
//change the engine mode
//syntax: modeName
commands.changeMode = function(info){
Sburb.engineMode = info.trim();
}
//load in an additional SBURBML file
//syntax: path, keepOld
commands.loadStateFile = function(info){
var params = parseParams(info);
var path = params[0];
var keepOld = params[1]=="true";
Sburb.loadSerialFromXML(path,keepOld);
}
//fade out to black
//syntax: none
commands.fadeOut = function(info){
Sburb.fading = true;
}
//go to a room that may not have been loaded yet
//syntax: filepath, roomName, newCharacterX, newCharacterY
commands.changeRoomRemote = function(info){
if(Sburb.loadingRoom) return; Sburb.loadingRoom = true; //Only load one room at a time
var params = parseParams(info);
var lastAction;
var newAction = lastAction = new Sburb.Action("fadeOut");
lastAction = lastAction.followUp = new Sburb.Action("loadStateFile",params[0]+","+true);
lastAction = lastAction.followUp = new Sburb.Action("changeRoom",params[1]+","+params[2]+","+params[3]);
lastAction.followUp = Sburb.curAction.followUp;
Sburb.performAction(newAction);
}
//Teleport to a room which may not have been loaded yet
//syntax: filepath, roomName, newCharacterX, newCharacterY
commands.teleportRemote = function(info){
if(Sburb.loadingRoom) return; Sburb.loadingRoom = true; //Only load one room at a time
commands.changeRoomRemote(info);
Sburb.playEffect(Sburb.effects["teleportEffect"],Sburb.char.x,Sburb.char.y);
var params = parseParams(info);
Sburb.curAction.followUp.followUp.followUp = new Sburb.Action("playEffect","teleportEffect,"+params[2]+","+params[3],null,null,Sburb.curAction.followUp.followUp.followUp);
}
//Change the state of the specified button
//syntax: buttonName, state
commands.setButtonState = function(info){
var params = parseParams(info);
Sburb.buttons[params[0]].setState(params[1]);
}
//Skip the current conversation
//syntax: none
commands.skipDialog = function(info){
Sburb.dialoger.skipAll();
}
//Set a character to follow another sprite
//syntax: followerName, leaderName
commands.follow = function(info){
var params = parseParams(info);
var follower = parseCharacterString(params[0]);
var leader = parseCharacterString(params[1]);
follower.follow(leader);
}
//Set a character to stop following another sprite
//syntax: followerName
commands.unfollow = function(info){
var params = parseParams(info);
var follower = parseCharacterString(params[0]);
follower.unfollow();
}
//Overlay a sprite over the game area (below the HUD)
//syntax: spriteName
commands.addOverlay = function(info){
var params = parseParams(info);
var sprite = Sburb.sprites[params[0]];
sprite.x = Sburb.Stage.x;
sprite.y = Sburb.Stage.y;
Sburb.curRoom.addSprite(sprite);
}
//Remove an overlay
//syntax: spriteName
commands.removeOverlay = function(info){
var params = parseParams(info);
var sprite = Sburb.sprites[params[0]];
Sburb.curRoom.removeSprite(sprite);
}
//Save state to client storage
//syntax: isAuto, useLocal
commands.save = function(info){
var params = parseParams(info);
var auto = params.length>0 && params[0]=="true";
var local = params.length>1 && params[1]=="true";
Sburb.saveStateToStorage(Sburb.char.name+", "+Sburb.curRoom.name,auto,local);
}
//Load state from client storage
//syntax: isAuto, useLocal
commands.load = function(info){
var params = parseParams(info);
var auto = params.length>0 && params[0]=="true";
var local = params.length>1 && params[1]=="true";
Sburb.loadStateFromStorage(auto, local);
// Sburb.saveStateToStorage(Sburb.char.name+", "+Sburb.curRoom.name,auto,local);
}
//Display save/load options
//syntax: useLocal
commands.saveOrLoad = function(info){
var params = parseParams(info);
var local = params.length>0 && params[0]=="true";
var actions = [];
if(Sburb.isStateInStorage(false,local)){
actions.push(new Sburb.Action("load","false, "+local,"Load "+Sburb.getStateDescription(false)));
}
if(Sburb.isStateInStorage(true,local)){
actions.push(new Sburb.Action("load","true, "+local,"Load "+Sburb.getStateDescription(true)));
}
if(Sburb.tests.storage) {
actions.push(new Sburb.Action("save","false,"+local,"Save"));
}
actions.push(new Sburb.Action("cancel",null,"Cancel"));
Sburb.chooser.choices = actions;
Sburb.chooser.beginChoosing(Sburb.Stage.x+20,Sburb.Stage.y+50);
}
//Change global game state
//syntax: gameState, value
commands.setGameState = function(info) {
var params = parseParams(info);
// TODO: there should be a check to make sure the gameState key
// doesn't contain &, <, or >
Sburb.gameState[params[0]] = params[1];
}
//Move the character backwards
//syntax: charName
commands.goBack = function(info){
var params = parseParams(info);
var character = parseCharacterString(params[0]);
var vx = 0; vy = 0;
if(character.facing=="Front"){
vx = 0;
vy = -character.speed;
}else if(character.facing=="Back"){
vx = 0;
vy = character.speed;
}else if(character.facing=="Left"){
vx = character.speed;
vy = 0;
}else if(character.facing=="Right"){
vx = -character.speed;
vy = 0;
}
character.tryToMove(vx,vy,Sburb.curRoom);
}
//tryToTrigger the given triggers in order, if one succeeds, don't do the rest (they are like an else-if chain)
//syntax: Sburbml trigger syntax
commands.try = function(info){
var triggers = parseTriggerString(info);
for(var i=0; i<triggers.length; i++){
var trigger = triggers[i];
trigger.detonate = true;
if(trigger.tryToTrigger()){
return;
}
}
}
//make the character walk in the specified direction (Up, Down, Left, Right, None)
//syntax: charName, direction
commands.walk = function(info){
var params = parseParams(info);
var character = parseCharacterString(params[0]);
var dir = params[1];
if(typeof character["move"+dir] == "function"){
character["move"+dir]();
}
}
commands.openLink = function(info){
var params = parseParams(info);
console.log(params[0]);
console.log(params[1]);
var url = parseURLstring(params[0]);
var text;
if(params[1] && params[1] != ""){
text = params[1];
}else{
text = params[0];
}
var actions = [];
actions.push(new Sburb.Action("openDirect", url + "," + text, "Go To "+text));
actions.push(new Sburb.Action("cancel",null,"Cancel"));
Sburb.chooser.choices = actions;
Sburb.chooser.beginChoosing(Sburb.Stage.x+200,Sburb.Stage.y+250);
}
commands.openDirect = function(info){
var params = parseParams(info);
var url = params[0];
var text = params[1];
window.open(url, text, "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
}
//blank utlity function
//syntax: none
commands.cancel = function(){
//do nothing
}
var parseCharacterString = Sburb.parseCharacterString = function(string){
if(string=="char"){
return Sburb.char;
}else{
return Sburb.sprites[string];
}
}
function parseActionString(string){
var actions = [];
string = "<sburb>"+string+"</sburb>";
var input = Sburb.parseXML(string);
for(var i=0; i<input.childNodes.length; i++) {
var tmp = input.childNodes[i];
if(tmp.tagName=="action") {
actions.push(Sburb.parseAction(tmp));
}
}
return actions;
}
function parseTriggerString(string){
var triggers = [];
string = "<triggers>"+string+"</triggers>";
var input = Sburb.parseXML(string);
for(var i=0; i<input.childNodes.length; i++) {
var tmp = input.childNodes[i];
if(tmp.tagName=="trigger") {
triggers.push(Sburb.parseTrigger(tmp));
}
}
return triggers;
}
function parseURLstring(string){
var allowed = ["com", "net", "org", "biz", "info"];
var parts = string.split("://");
if (parts.length == 1){
var domain = string.split("/")[0];
if(domain.indexOf(".") != -1){
return "http://" + parts[0];
}
return string;
}
return string;
}
Sburb.commands = commands;
return Sburb;
})(Sburb || {});