Downloads containing STVweaponlist.mut

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Weapon List Spaz Electro Mutator N/A Download file

File preview

  1. #pragma name "Weapon List"
  2. #pragma require "STVweaponlist_constants.asc"
  3. #include "STVweaponlist_constants.asc"
  4.  
  5. funcdef void TimerVDictionaryFunction(dictionary@);
  6. class TimerV : jjBEHAVIORINTERFACE {
  7.   TimerV(int time, jjVOIDFUNC@ callback) {
  8.     @_callback = @callback;
  9.     _start(time);
  10.   }
  11.   TimerV(int time, TimerVDictionaryFunction@ callback, dictionary@ arguments) {
  12.     @_callbackWithArguments = @callback;
  13.     @_arguments = @arguments;
  14.     _start(time);
  15.   }
  16.   bool get_Active() const {
  17.     return cast<jjBEHAVIORINTERFACE@>(_object.behavior) is this;
  18.   }
  19.   int get_Elapsed() const {
  20.     if (Active) return _object.age;
  21.     return -1;
  22.   }
  23.   int get_Total() const {
  24.     if (Active) return _object.counter;
  25.     return -1;
  26.   }
  27.   int get_Remaining() const {
  28.     if (Active) return _object.counter - _object.age;
  29.     return -1;
  30.   }
  31.   bool Stop() {
  32.     if (Active && _object.age < _object.counter) {
  33.       _object.delete();
  34.       return true;
  35.     }
  36.     return false;
  37.   }
  38.   bool Paused = false;
  39.  
  40.  
  41.  
  42.  
  43.  
  44.   private jjVOIDFUNC@ _callback = null;
  45.   private TimerVDictionaryFunction@ _callbackWithArguments;
  46.   private dictionary@ _arguments;
  47.   private jjOBJ@ _object;
  48.   private int _startTime;
  49.   private void _start(int time) {
  50.     if (time > 0) {
  51.       @_object = jjObjects[jjAddObject(OBJECT::BEES, -1000, -1000, 0, CREATOR::OBJECT, BEHAVIOR::BEES)];
  52.       _object.behavior = this;
  53.       _object.counter = time;
  54.       _object.age = 0;
  55.       _object.playerHandling = HANDLING::PARTICLE;
  56.       _object.deactivates = false;
  57.       _startTime = jjGameTicks;
  58.     } else {
  59.       @_object = jjObjects[0]; //avoid null pointer access
  60.       _pickCallback();
  61.     }
  62.   }
  63.   private void onBehave(jjOBJ@ obj) {
  64.     if (!Paused && jjGameTicks > _startTime && obj is _object && ++_object.age >= _object.counter) {
  65.       _pickCallback();
  66.       _object.delete();
  67.     }
  68.   }
  69.   private void _pickCallback() {
  70.     if (_callback !is null)
  71.       _callback();
  72.     else
  73.       _callbackWithArguments(_arguments);
  74.   }
  75. }
  76.  
  77. class AnimatedSprite
  78. {
  79.     int id;
  80.     float frame;
  81.     int frame_count;
  82.     int x;
  83.     int y;
  84.     float anim_speed;
  85.     bool can_reverse;
  86.     bool reverse = false;
  87.     bool visible = true;
  88.     ANIM::Set animSet = ANIM::AMMO;
  89.  
  90.     AnimatedSprite(int id, int frame, int frame_count, int x, int y, float anim_speed, bool can_reverse)
  91.     {
  92.         this.id = id;
  93.         this.frame = frame;
  94.         this.frame_count = frame_count;
  95.         this.x = x;
  96.         this.y = y;
  97.         this.anim_speed = anim_speed;
  98.         this.can_reverse = can_reverse;
  99.     }
  100.  
  101.     void setVisible(bool visible)
  102.     {
  103.         this.visible = visible;
  104.     }
  105.  
  106.     void setAnimSet(ANIM::Set animSet)
  107.     {
  108.         this.animSet = animSet;
  109.     }
  110.  
  111.     void setId(int id)
  112.     {
  113.         this.id = id;
  114.     }
  115.  
  116.     void setFrameCount(int frame_count)
  117.     {
  118.         this.frame_count = frame_count;
  119.     }
  120.  
  121.     void update()
  122.     {
  123.         if(this.reverse == false) {
  124.             this.frame += this.anim_speed;
  125.         } else {
  126.             this.frame -= this.anim_speed;
  127.         }
  128.  
  129.         if (this.frame > this.frame_count)
  130.         {
  131.             if(this.can_reverse == true) {
  132.                 this.reverse = not this.reverse;
  133.             } else {
  134.                 this.frame = 0;
  135.             }
  136.         }
  137.  
  138.         if(this.frame <= 0)
  139.         {
  140.             if(this.can_reverse == true) {
  141.                 this.reverse = not this.reverse;
  142.             } else {
  143.                 this.frame = 0;
  144.             }
  145.         }
  146.     }
  147.  
  148.     void draw(jjCANVAS@ canvas)
  149.     {
  150.         if(this.visible) {
  151.             canvas.drawSprite(this.x, this.y, this.animSet, this.id, int(this.frame), 0, SPRITE::NORMAL, 123);
  152.         }
  153.     }
  154. }
  155.  
  156.  
  157. funcdef void ButtonCallback(Button@);
  158. class Button
  159. {
  160.         MenuButton@ mainButton;
  161.         int horizontalId = 0;
  162.     int xOffset = 0;
  163.     int yOffset = 0;
  164.     string hoverText;
  165.         bool debounce = false;
  166.         bool value = false;
  167.         bool visible = true;
  168.         ButtonCallback@ callback;
  169.  
  170.         Button(int horizontalId, ButtonCallback@ callback)
  171.         {
  172.                 this.horizontalId = horizontalId;
  173.                 @this.callback = @callback;
  174.         }
  175.  
  176.         void setValue(bool value)
  177.         {
  178.                 this.value = value;
  179.         }
  180.  
  181.         bool checkCollision(int sourceX, int sourceY, int sourceWidth, int sourceHeight, int targetX, int targetY, int targetWidth, int targetHeight)
  182.         {
  183.                 if(sourceX + sourceWidth > targetX && sourceX < targetX + targetWidth && sourceY + sourceHeight > targetY && sourceY < targetY + targetHeight)
  184.                 {
  185.                         return true;
  186.                 } else { return false; }
  187.         }
  188.  
  189.         void input(jjPLAYER@ player) {
  190.                 if(jjKey[0x01] && this.debounce == false) {
  191.                         if(checkCollision(
  192.                                 jjResolutionWidth / 2 + 100 + (horizontalId * 50) + xOffset,
  193.                                 jjResolutionHeight / 2 - 165 + ((this.mainButton.id + 1) * 50) + yOffset,
  194.                                 50, 50,
  195.                                 jjMouseX, jjMouseY,
  196.                                 1, 1
  197.                         )) {
  198.                                 this.debounce = true;
  199.                                 dictionary dict = {{"main", @this}};
  200.  
  201.                                 this.callback(this);
  202.  
  203.                                 TimerV(10, function(this) {
  204.                                         Button@ t;
  205.                                         this.get("main", @t);
  206.                                         t.debounce = false;
  207.                                 }, dict);
  208.                         }
  209.                 }
  210.         }
  211.  
  212.         void draw(jjCANVAS@ canvas) {
  213.         if(this.visible) {
  214.                     canvas.drawRectangle(jjResolutionWidth / 2 + 100 + (horizontalId * 50) + xOffset, jjResolutionHeight / 2 - 165 + ((this.mainButton.id + 1) * 50) + yOffset, 25, 25, 0, SPRITE::NORMAL, 0);
  215.                     canvas.drawRectangle(jjResolutionWidth / 2 + 6 + 100 + (horizontalId * 50) + xOffset, jjResolutionHeight / 2 - 159 + ((this.mainButton.id + 1) * 50) + yOffset, 12, 12, getColorValue(this.value), SPRITE::NORMAL, 0);
  216.  
  217.             if(checkCollision(
  218.                                 jjResolutionWidth / 2 + 100 + (horizontalId * 50) + xOffset,
  219.                                 jjResolutionHeight / 2 - 165 + ((this.mainButton.id + 1) * 50) + yOffset,
  220.                                 50, 50,
  221.                                 jjMouseX, jjMouseY,
  222.                                 1, 1
  223.                         ) && this.hoverText != "") {
  224.                 canvas.drawString(jjResolutionWidth / 2 + 100 + (horizontalId * 50) + xOffset, jjResolutionHeight / 2 - 165 + ((this.mainButton.id + 1) * 50) + yOffset, this.hoverText, STRING::SMALL, STRING::NORMAL, 0);
  225.             }
  226.         }
  227.         }
  228. }
  229.  
  230. class MenuButton
  231. {
  232.         string text;
  233.         int x;
  234.         int y;
  235.         int width;
  236.         int height;
  237.         int id;
  238.     int xOffset;
  239.     int yOffset;
  240.         bool debounce;
  241.         bool visible = true;
  242.     bool showText = true;
  243.     string size = "medium";
  244.         array<Button@> buttons;
  245.  
  246.         MenuButton(string text, int id, array<Button@> buttons)
  247.         {
  248.                 this.text = text;
  249.                 this.id = id;
  250.                 this.buttons = buttons;
  251.  
  252.                 for(uint i = 0; i < this.buttons.length(); i++) {
  253.                         @this.buttons[i].mainButton = @this;
  254.                 }
  255.         }
  256.  
  257.         MenuButton(string text, int id, Button@ button)
  258.         {
  259.                 this.text = text;
  260.                 this.id = id;
  261.                 this.buttons = buttons;
  262.                 this.buttons.insertLast(button);
  263.                 @this.buttons[0].mainButton = @this;
  264.         }
  265.  
  266.         void draw(jjCANVAS@ canvas) {
  267.                 if(visible and showMenu) {
  268.                         for(uint i = 0; i < this.buttons.length(); i++) {
  269.                                 this.buttons[i].draw(canvas);
  270.                         }
  271.  
  272.             if(this.showText) canvas.drawString(jjResolutionWidth / 2 - 275 + this.xOffset, jjResolutionHeight / 2 - 150 + ((this.id + 1) * 50) + this.yOffset, this.text, string_size_to_size(this.size), STRING::NORMAL, 0);
  273.                 }
  274.         }
  275.  
  276.         void input(jjPLAYER@ player) {
  277.                 if(visible and showMenu) {
  278.                         for(uint i = 0; i < this.buttons.length(); i++) {
  279.                                 this.buttons[i].input(player);
  280.                         }
  281.                 }
  282.         }
  283. }
  284.  
  285. int menu_page = 1;
  286.  
  287. MenuButton@ getButton(int index) { return menu_buttons[index]; }
  288.  
  289. array<Button@> indexFontSizes = {Button(1, function(button) {
  290.         button.setValue(true);
  291.         button.mainButton.buttons[1].setValue(false);
  292.         index_fontsize = "small";
  293.         save();
  294. }), Button(2, function(button) {
  295.         button.setValue(true);
  296.         button.mainButton.buttons[0].setValue(false);
  297.         index_fontsize = "medium";
  298.         save();
  299. })};
  300.  
  301. array<Button@> ammoFontSizes = {Button(1, function(button) {
  302.     button.mainButton.buttons[1].setValue(false);
  303.     button.setValue(true);
  304.         ammo_fontsize = "small";
  305.         save();
  306. }), Button(2, function(button) {
  307.     button.mainButton.buttons[0].setValue(false);
  308.     button.setValue(true);
  309.         ammo_fontsize = "medium";
  310.         save();
  311. })};
  312.  
  313. array<Button@> pageButtons = {Button(1, function(button) {
  314.     button.setValue(true);
  315.     button.mainButton.buttons[1].setValue(false);
  316.  
  317.     menu_page = 1;
  318.  
  319.     getButton(1).visible = true;
  320.     getButton(2).visible = true;
  321.     getButton(3).visible = true;
  322.     getButton(4).visible = true;
  323.     getButton(5).visible = true;
  324.     getButton(6).visible = true;
  325.     getButton(7).visible = false;
  326.     getButton(8).visible = false;
  327.     getButton(9).visible = false;
  328.     getButton(10).visible = false;
  329.     // getButton(11).visible = false;
  330. }), Button(2, function(button) {
  331.     button.setValue(true);
  332.     button.mainButton.buttons[0].setValue(false);
  333.  
  334.     menu_page = 2;
  335.  
  336.     getButton(1).visible = false;
  337.     getButton(2).visible = false;
  338.     getButton(3).visible = false;
  339.     getButton(4).visible = false;
  340.     getButton(5).visible = false;
  341.     getButton(6).visible = false;
  342.     getButton(7).visible = true;
  343.     getButton(8).visible = true;
  344.     getButton(9).visible = true;
  345.     getButton(10).visible = true;
  346.     // getButton(11).visible = true;
  347. })};
  348.  
  349. array<Button@> bindModes = {Button(1, function(button) {
  350.     button.setValue(true);
  351.     button.mainButton.buttons[1].setValue(false);
  352.     mode = "toggle";
  353.     show = true;
  354.  
  355.     save();
  356. }), Button(2, function(button) {
  357.     button.setValue(true);
  358.     button.mainButton.buttons[0].setValue(false);
  359.     mode = "hold";
  360.  
  361.     save();
  362. })};
  363.  
  364. array<Button@> positions = {Button(1, function(button) {
  365.     button.setValue(false);
  366.  
  367.     string direction;
  368.  
  369.     if(not horizontal and not horizontal2) {
  370.         horizontal = true;
  371.         horizontal2 = false;
  372.         direction = "bottom";
  373.     } else if(horizontal and not horizontal2) {
  374.         horizontal = false;
  375.         horizontal2 = true;
  376.         direction = "left";
  377.     } else if(not horizontal and horizontal2) {
  378.         horizontal = true;
  379.         horizontal2 = true;
  380.         direction = "top";
  381.     } else if(horizontal and horizontal2) {
  382.         horizontal = false;
  383.         horizontal2 = false;
  384.         direction = "right";
  385.     }
  386.  
  387.     jjConsole("[WL] The weapons' list is now at the " + direction + " of your screen.");
  388.  
  389.         save();
  390. })};
  391.  
  392. array<Button@> colorUpgradedButtons = {Button(1, function(button) {
  393.     button.setValue(not button.value);
  394.     color_upgraded_ammo = not color_upgraded_ammo;
  395.     save();
  396. }), Button(2, function(button) {
  397.     button.setValue(not button.value);
  398.     color_upgraded_index = not color_upgraded_index;
  399.     save();
  400. })};
  401.  
  402. array<MenuButton@> menu_buttons = {
  403.     MenuButton("Page", -1, pageButtons),
  404.         MenuButton("Show Index", 1, Button(1, function(button) {
  405.         button.setValue(not button.value);
  406.                 showIndex = not showIndex;
  407.                 save();
  408.         })),
  409.         MenuButton("Position", 0, positions),
  410.         MenuButton("Color Index", 2, Button(1, function(button) {
  411.         button.setValue(not button.value);
  412.                 index_color = not index_color;
  413.                 save();
  414.         })),
  415.         MenuButton("Color Ammo", 3, Button(1, function(button) {
  416.         button.setValue(not button.value);
  417.                 ammo_color = not ammo_color;
  418.                 save();
  419.         })),
  420.         MenuButton("Show Empty Ammo", 4, Button(1, function(button) {
  421.         button.setValue(not button.value);
  422.                 show_empty_ammo = not show_empty_ammo;
  423.                 save();
  424.         })),
  425.         MenuButton("Index font size", 5, indexFontSizes),
  426.         MenuButton("Ammo font size", 0, ammoFontSizes),
  427.     MenuButton("Bind Mode", 1, bindModes),
  428.     MenuButton("Bind Key", 2, Button(1, function(button) {
  429.         getButton(9).buttons[0].setValue(false);
  430.         binding = true;
  431.         showMenu = false;
  432.     })),
  433.     MenuButton("Color On Upgrade", 3, colorUpgradedButtons)
  434.     // })), // unfinished profiles
  435.     // MenuButton("Profiles", 5, Button(1, function(button) {
  436.     //     button.setValue(false);
  437.  
  438.     //     for(uint i = 0; i < menu_buttons.length(); i++) {
  439.     //         getButton(i).visible = false;
  440.     //     }
  441.  
  442.     //     menu_buttons.insertLast(MenuButton("Back", -1, Button(1, function(button) {
  443.     //         button.debounce = false;
  444.     //         getButton(0).visible = true;
  445.     //         getButton(0).buttons[0].debounce = true;
  446.  
  447.     //         TimerV(35, function() {
  448.     //             getButton(0).buttons[0].debounce = false;
  449.     //         });
  450.  
  451.     //         for(uint i = 7; i < menu_buttons.length(); i++) {
  452.     //             getButton(i).visible = true;
  453.     //         }
  454.  
  455.     //         menu_buttons.resize(12);
  456.  
  457.     // save();
  458.  
  459.     // jjSTREAM file(profile + "_" + data_filename);
  460.     // file.pop(mode);
  461.     // file.pop(showIndex);
  462.     // file.pop(horizontal);
  463.     // file.pop(index_color);
  464.     // file.pop(ammo_color);
  465.     // file.pop(show_empty_ammo);
  466.     // file.pop(bind_open);
  467.     // file.pop(index_fontsize);
  468.     // file.pop(ammo_fontsize);
  469.     // file.pop(horizontal2);
  470.     // file.pop(color_upgraded_ammo);
  471.     // file.pop(color_upgraded_index);
  472.  
  473.     //         menu_buttons[0].buttons[0].setValue(false);
  474.     //         menu_buttons[1].buttons[0].setValue(showIndex);
  475.     //         menu_buttons[2].buttons[0].setValue(false);
  476.     //         menu_buttons[3].buttons[0].setValue(index_color);
  477.     //         menu_buttons[4].buttons[0].setValue(ammo_color);
  478.     //         menu_buttons[5].buttons[0].setValue(show_empty_ammo);
  479.            
  480.         // if(index_fontsize == "small") {
  481.         //     menu_buttons[6].buttons[0].setValue(true);
  482.         //     menu_buttons[6].buttons[1].setValue(false);
  483.         // } else {
  484.         //     menu_buttons[6].buttons[0].setValue(false);
  485.         //     menu_buttons[6].buttons[1].setValue(true);
  486.         // }
  487.  
  488.         // if(ammo_fontsize == "small") {
  489.         //     menu_buttons[7].buttons[0].setValue(true);
  490.         //     menu_buttons[7].buttons[1].setValue(false);
  491.         // } else {
  492.         //     menu_buttons[7].buttons[0].setValue(false);
  493.         //     menu_buttons[7].buttons[1].setValue(true);
  494.         // }
  495.  
  496.         // if(mode == "toggle") {
  497.         //     menu_buttons[8].buttons[0].setValue(true);
  498.         //     menu_buttons[8].buttons[1].setValue(false);
  499.         // } else {
  500.         //     menu_buttons[8].buttons[0].setValue(false);
  501.         //     menu_buttons[8].buttons[1].setValue(true);
  502.         // }
  503.    //     })));
  504.  
  505.     //     menu_buttons.insertLast(MenuButton("(create a new profile by doing !wl newprofile)", 5, Button(1, function(button) {})));
  506.     //     menu_buttons[12].size = "small";
  507.     //     menu_buttons[12].buttons[0].visible = false;
  508.     //     menu_buttons[12].xOffset = -10;
  509.     //     menu_buttons[12].yOffset = 20;
  510.     //     menu_buttons[12].buttons[0].xOffset = -10;
  511.     //     menu_buttons[12].buttons[0].yOffset = 20;
  512.  
  513.     //     createProfileButtons();
  514.         // }))
  515. };
  516.  
  517. string data_filename = "WLdata_data.asdat";
  518. string profiles_filename = "WLdata_profiles.asdat";
  519.  
  520. int originX = jjResolutionWidth;
  521. int originY = jjResolutionHeight - 15;
  522.  
  523. int verticalX = jjResolutionWidth - 85;
  524. int horizontalY = jjResolutionHeight - 15;
  525.  
  526. int verticalX2 = 85;
  527. int horizontalY2 = 15;
  528.  
  529. string profile = "default";
  530. string version = "0.1";
  531.  
  532. array<string> profiles;
  533.  
  534. AnimatedSprite@ bouncer = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  535. AnimatedSprite@ ice = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  536. AnimatedSprite@ seeker = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  537. AnimatedSprite@ rf = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  538. AnimatedSprite@ toaster = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  539. AnimatedSprite@ tnt = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  540. AnimatedSprite@ fireball = AnimatedSprite(0, 0, 9, 0, 0, 0.25, false);
  541. AnimatedSprite@ electroblaster = AnimatedSprite(0, 0, 10, 0, 0, 0.25, false);
  542.  
  543. bool horizontal = false;
  544. bool horizontal2 = true;
  545.  
  546. bool show = true;
  547. bool showIndex = true;
  548. bool showMenu = false;
  549. bool showMenuDebounce = false;
  550.  
  551. bool showSplitscreenWarning = false;
  552. bool splitscreenWarning_triggered = false;
  553.  
  554. bool holdingBind = false;
  555.  
  556. bool ammo_color = true;
  557. bool index_color = true;
  558. bool color_upgraded_ammo = false;
  559. bool color_upgraded_index = false;
  560.  
  561. bool show_empty_ammo = true;
  562.  
  563. bool binding = false;
  564. int bind_open = 192;
  565. string mode = "hold";
  566. string index_fontsize = "small";
  567. string ammo_fontsize = "small";
  568.  
  569. array<int> unupgradedIds;
  570. array<int> upgradedIds;
  571.  
  572. void createProfileButtons() {
  573.     createProfileButton(-1, 0, "default");
  574.  
  575.     if(profile == "default") {
  576.         menu_buttons[13].buttons[0].setValue(true);
  577.     }
  578.  
  579.     for(uint i = 0; i < profiles.length(); i++) {
  580.         createProfileButton(i, i + 1);
  581.     }
  582. }
  583.  
  584. void createProfileButton(int i, int position = 0, string prfName = "3dkwkvmwlvnelvmekfmek2nglwnfl3nvfkenc") {
  585.     array<Button@> buttons = {Button(1, function(button) {
  586.         for(uint ia = 0; ia < menu_buttons.length(); ia++) {
  587.             getButton(ia).buttons[0].setValue(false);
  588.         }
  589.  
  590.         button.setValue(true);
  591.        
  592.         profile = button.mainButton.text;
  593.  
  594.         jjSTREAM file(profile + "_" + data_filename);
  595.         file.pop(mode);
  596.         file.pop(showIndex);
  597.         file.pop(horizontal);
  598.         file.pop(index_color);
  599.         file.pop(ammo_color);
  600.         file.pop(show_empty_ammo);
  601.         file.pop(bind_open);
  602.         file.pop(index_fontsize);
  603.         file.pop(ammo_fontsize);
  604.         file.pop(horizontal2);
  605.        
  606.         jjConsole("[WL] Now using the profile " + profile + ".");
  607.  
  608.         save();
  609.     }), Button(2, function(button) {
  610.         if(button.mainButton.text == profile) { jjConsole("[WL] You can't delete the profile you're using."); return; }
  611.         if(button.value == false) {
  612.             button.hoverText = "Confirm Delete";
  613.             button.value = true;
  614.             return;
  615.         }
  616.        
  617.         for(uint iq = 0; iq < menu_buttons.length(); iq++) {
  618.             getButton(iq).buttons[0].setValue(false);
  619.         }
  620.  
  621.         button.setValue(false);
  622.  
  623.         for(uint iz = 0; iz < profiles.length(); iz++) {
  624.             if(profiles[iz] == button.mainButton.text) {
  625.                 jjConsole("[WL] Deleted the " + button.mainButton.text + " profile.");
  626.  
  627.                 button.mainButton.text = "";
  628.                 button.mainButton.visible = false;
  629.                
  630.                 profiles.removeAt(iz);
  631.  
  632.                 createProfileButtons();
  633.                
  634.                 break;
  635.             }
  636.         }
  637.  
  638.         save();
  639.     })};
  640.  
  641.     buttons[0].hoverText = "Use";
  642.     buttons[1].hoverText = "Delete";
  643.  
  644.     if(prfName == "default") {
  645.         buttons.removeLast();
  646.     }
  647.    
  648.     if(prfName == "3dkwkvmwlvnelvmekfmek2nglwnfl3nvfkenc") {
  649.         if(profiles[i] == profile) {
  650.             buttons[0].setValue(true);
  651.         }
  652.     }
  653.  
  654.     if(prfName == "3dkwkvmwlvnelvmekfmek2nglwnfl3nvfkenc") {
  655.         menu_buttons.insertLast(MenuButton(profiles[i], position, buttons));
  656.     } else {
  657.         menu_buttons.insertLast(MenuButton(prfName, position, buttons));
  658.     }
  659.  
  660.     menu_buttons[i+14].buttons[0].debounce = true;
  661.  
  662.     if(prfName == "3dkwkvmwlvnelvmekfmek2nglwnfl3nvfkenc") {
  663.         menu_buttons[i+14].buttons[1].debounce = true;
  664.     }
  665.  
  666.     dictionary d = {{"index", i}, {"prfname", prfName}};
  667.  
  668.     TimerV(35, function(index) {
  669.         int t;
  670.         index.get("index", t);
  671.         string prfName;
  672.         index.get("prfname", prfName);
  673.         menu_buttons[t+14].buttons[0].debounce = false;
  674.         if(prfName == "3dkwkvmwlvnelvmekfmek2nglwnfl3nvfkenc") menu_buttons[t+14].buttons[1].debounce = false;
  675.     }, d);
  676. }
  677.  
  678. STRING::Size string_size_to_size(string str) {
  679.         if(str == "small" or str == "tiny") {
  680.                 return STRING::SMALL;
  681.         } else if(str == "medium") {
  682.                 return STRING::MEDIUM;
  683.         } else if(str == "large" or str == "big") {
  684.                 return STRING::LARGE;
  685.         }
  686.         return STRING::MEDIUM;
  687. }
  688.  
  689. void save() {
  690.     jjSTREAM file();
  691.     file.push(mode);
  692.     file.push(showIndex);
  693.     file.push(horizontal);
  694.     file.push(index_color);
  695.     file.push(ammo_color);
  696.     file.push(show_empty_ammo);
  697.     file.push(bind_open);
  698.         file.push(index_fontsize);
  699.         file.push(ammo_fontsize);
  700.     file.push(horizontal2);
  701.     file.push(color_upgraded_ammo);
  702.     file.push(color_upgraded_index);
  703.     file.save(profile + "_" + data_filename);
  704.  
  705.     jjSTREAM profilesFile();
  706.     profilesFile.push(profile); // default profile
  707.     profilesFile.push(profiles.length());
  708.  
  709.     for(uint i = 0; i < profiles.length(); i++) {
  710.         profilesFile.push(profiles[i]);
  711.     }
  712.  
  713.     profilesFile.save(profiles_filename);
  714. }
  715.  
  716. void onLevelBegin() {
  717.     uint profileAmount;
  718.     jjSTREAM profilesFile("WLdata_profiles.asdat");
  719.     profilesFile.pop(profile);
  720.     profilesFile.pop(profileAmount);
  721.  
  722.     for(uint i = 0; i < profileAmount; i++) {
  723.         string profileName;
  724.         profilesFile.pop(profileName);
  725.         profiles.insertLast(profileName);
  726.     }
  727.  
  728.     reload();
  729.  
  730.     menu_buttons[7].visible = false;
  731.     menu_buttons[8].buttons[0].hoverText = "TOGGLE";
  732.     menu_buttons[8].buttons[1].hoverText = "HOLD";
  733.     menu_buttons[8].visible = false;
  734.     menu_buttons[9].visible = false;
  735.     menu_buttons[10].visible = false;
  736.     // menu_buttons[11].visible = false; // unfinished profiles
  737.     menu_buttons[6].buttons[0].hoverText = "SMALL";
  738.     menu_buttons[6].buttons[1].hoverText = "MEDIUM";
  739.     menu_buttons[7].buttons[0].hoverText = "SMALL";
  740.     menu_buttons[7].buttons[1].hoverText = "MEDIUM";
  741.     menu_buttons[10].buttons[0].hoverText = "AMMO";
  742.     menu_buttons[10].buttons[1].hoverText = "INDEX";
  743.    
  744.     jjConsole("[WL] Type ! wl help for a list of commands.");
  745.     jjConsole("[WL] Press F1 to open the settings menu.");
  746.  
  747.     // hardcoded stuff
  748.     unupgradedIds.insertLast(25); // bouncer
  749.     unupgradedIds.insertLast(29); // ice
  750.     unupgradedIds.insertLast(34); // seeker
  751.     unupgradedIds.insertLast(49); // rf
  752.     unupgradedIds.insertLast(57); // toaster
  753.     unupgradedIds.insertLast(59); // tnt
  754.     unupgradedIds.insertLast(62); // fireball
  755.     unupgradedIds.insertLast(68); // electroblaster
  756.  
  757.     upgradedIds.insertLast(24); // bouncer
  758.     upgradedIds.insertLast(28); // ice
  759.     upgradedIds.insertLast(33); // seeker
  760.     upgradedIds.insertLast(48); // rf
  761.     upgradedIds.insertLast(56); // toaster
  762.     upgradedIds.insertLast(59); // tnt
  763.     upgradedIds.insertLast(61); // fireball
  764.     upgradedIds.insertLast(67); // electroblaster
  765.  
  766.         if(jjLocalPlayerCount > 1) {
  767.                 show = false;
  768.  
  769.         showSplitscreenWarning = true;
  770.         splitscreenWarning_triggered = true;
  771.  
  772.         TimerV(300, function() {
  773.                 showSplitscreenWarning = false;
  774.         });
  775.         }
  776.  
  777.     for (int i = 2; i < 10; i++)
  778.     {
  779.         AnimatedSprite@ weapon = idToWeapon(i);
  780.         weapon.x = 0;
  781.         weapon.y = 0;
  782.        
  783.         if(horizontal) {
  784.             weapon.x = (originX - (i * 75));
  785.             weapon.y = horizontalY;
  786.         } else {
  787.             weapon.x = verticalX;
  788.             weapon.y = (originY - (i * 35)) + 25;
  789.         }
  790.     }
  791. }
  792.  
  793. bool upgraded(jjPLAYER@ player, int id) {
  794.     return player.powerup[id];
  795. }
  796.  
  797. void reload() {
  798.     jjSTREAM file(profile + "_" + data_filename);
  799.     file.pop(mode);
  800.     file.pop(showIndex);
  801.     file.pop(horizontal);
  802.     file.pop(index_color);
  803.     file.pop(ammo_color);
  804.     file.pop(show_empty_ammo);
  805.     file.pop(bind_open);
  806.     file.pop(index_fontsize);
  807.     file.pop(ammo_fontsize);
  808.     file.pop(horizontal2);
  809.     file.pop(color_upgraded_ammo);
  810.     file.pop(color_upgraded_index);
  811.  
  812.     if(mode == "") {
  813.         mode = "toggle";
  814.         bind_open = 192;
  815.         index_fontsize = "small";
  816.         ammo_fontsize = "small";
  817.         show_empty_ammo = true;
  818.         profile = "default";
  819.     }
  820.  
  821.     menu_buttons[0].buttons[0].setValue(true);
  822.     menu_buttons[1].buttons[0].setValue(showIndex);
  823.     menu_buttons[2].buttons[0].setValue(false);
  824.     menu_buttons[3].buttons[0].setValue(index_color);
  825.     menu_buttons[4].buttons[0].setValue(ammo_color);
  826.     menu_buttons[5].buttons[0].setValue(show_empty_ammo);
  827.        
  828.     if(index_fontsize == "small") {
  829.         menu_buttons[6].buttons[0].setValue(true);
  830.         menu_buttons[6].buttons[1].setValue(false);
  831.     } else {
  832.         menu_buttons[6].buttons[0].setValue(false);
  833.         menu_buttons[6].buttons[1].setValue(true);
  834.     }
  835.  
  836.     if(ammo_fontsize == "small") {
  837.         menu_buttons[7].buttons[0].setValue(true);
  838.         menu_buttons[7].buttons[1].setValue(false);
  839.     } else {
  840.         menu_buttons[7].buttons[0].setValue(false);
  841.         menu_buttons[7].buttons[1].setValue(true);
  842.     }
  843.  
  844.     if(mode == "toggle") {
  845.         menu_buttons[8].buttons[0].setValue(true);
  846.         menu_buttons[8].buttons[1].setValue(false);
  847.     } else {
  848.         menu_buttons[8].buttons[0].setValue(false);
  849.         menu_buttons[8].buttons[1].setValue(true);
  850.     }
  851.  
  852.     menu_buttons[10].buttons[0].setValue(false);
  853.     menu_buttons[10].buttons[1].setValue(false);
  854.  
  855.     if(color_upgraded_ammo) {
  856.         menu_buttons[10].buttons[0].setValue(true);
  857.     }
  858.     if(color_upgraded_index) {
  859.         menu_buttons[10].buttons[1].setValue(true);
  860.     }
  861. }
  862.  
  863. AnimatedSprite@ idToWeapon(int id) {
  864.     if(id == 3) return ice;
  865.     if(id == 4) return seeker;
  866.     if(id == 5) return rf;
  867.     if(id == 6) return toaster;
  868.     if(id == 7) return tnt;
  869.     if(id == 8) return fireball;
  870.     if(id == 9) return electroblaster;
  871.  
  872.     return bouncer;
  873. }
  874.  
  875. void onPlayer(jjPLAYER@ player) {
  876.     for (uint i = 2; i < 10; i++)
  877.     {
  878.         if(upgraded(player, i)) {
  879.             idToWeapon(i).setId(upgradedIds[i - 2]);
  880.         } else {
  881.             idToWeapon(i).setId(unupgradedIds[i - 2]);
  882.         }
  883.     }
  884. }
  885.  
  886. void onPlayerInput(jjPLAYER@ player) {
  887.         mouseInput(player);
  888.  
  889.     if(binding) {
  890.                 if(jjKey[0x1B]) { // ESC
  891.                         binding = false;
  892.                         jjConsole("[WL] Cancelled binding.");
  893.                 }
  894.  
  895.         for (uint i = 0; i < KEYS.length() - 1; i++)
  896.         {
  897.             Key@ key = KEYS[i];
  898.  
  899.             if(jjKey[key.code]) {
  900.                 bind_open = key.code;
  901.  
  902.                 jjConsole("[WL] Binded to \"" + key.id + "\".");
  903.                
  904.                 binding = false;
  905.                 save();
  906.             }
  907.  
  908.         }
  909.     }
  910.  
  911.         if(jjKey[0x70] && not showMenuDebounce) { // f1
  912.                 showMenu = not showMenu;
  913.                 showMenuDebounce = true;
  914.  
  915.                 TimerV(15, function() {
  916.             showMenuDebounce = false;
  917.         });
  918.         }
  919.  
  920.     if(mode == "toggle") {
  921.         if(jjKey[bind_open] && not holdingBind) {
  922.             show = not show;
  923.             holdingBind = true;
  924.  
  925.             TimerV(15, function() {
  926.                 holdingBind = false;
  927.             });
  928.         }
  929.     } else if(mode == "hold") {
  930.         if(jjKey[bind_open]) {
  931.             show = true;
  932.         } else {
  933.             show = false;
  934.         }
  935.     } else {
  936.         // unknown mode, so we'll set it to true always
  937.         show = true;
  938.     }
  939. }
  940.  
  941. Key@ getKey(int code) {
  942.     for (uint i = 0; i < KEYS.length() - 1; i++)
  943.     {
  944.         Key@ key = KEYS[i];
  945.  
  946.         if(key.code == code) {
  947.             return @key;
  948.         }
  949.     }
  950.  
  951.     return Key("Backquote", 0xC0);
  952. }
  953.  
  954. void onMain() {
  955.     menu_buttons[9].text = "Bind Key                 " + getKey(bind_open).id;
  956.  
  957.         originX = jjResolutionWidth;
  958.         originY = jjResolutionHeight - 15;
  959.  
  960.         verticalX = jjResolutionWidth - 85;
  961.         horizontalY = jjResolutionHeight - 15;
  962.  
  963.     for (int i = 2; i < 10; i++)
  964.     {
  965.        
  966.         AnimatedSprite@ weapon = idToWeapon(i);
  967.         weapon.x = 0;
  968.         weapon.y = 0;
  969.        
  970.         if(horizontal) {
  971.             weapon.x = (originX - (i * 75));
  972.             weapon.y = horizontalY;
  973.         } else {
  974.             weapon.x = verticalX;
  975.             weapon.y = (originY - (i * 35)) + 25;
  976.         }
  977.  
  978.         if(horizontal and horizontal2) {
  979.             weapon.x = (originX - (i * 75)) + 25;
  980.             weapon.y = horizontalY2;
  981.         } else if(not horizontal and horizontal2) {
  982.             weapon.x = verticalX2;
  983.             weapon.y = (originY - (i * 35)) + 25;
  984.         }
  985.     }
  986.  
  987.     bouncer.update();
  988.     ice.update();
  989.     seeker.update();
  990.     rf.update();
  991.     toaster.update();
  992.     tnt.update();
  993.     fireball.update();
  994.     electroblaster.update();
  995. }
  996.  
  997. bool onLocalChat(string &in stringReceived, CHAT::Type chatType) {    
  998.     if(chatType != CHAT::NORMAL) return false;
  999.  
  1000.     if(stringReceived.findFirst("!wl help 2") == 0) {
  1001.         jjConsole("-----------------------------------------------------");
  1002.         jjConsole("! wl index - Show the weapons' index");
  1003.         jjConsole("! wl color ammo - Changes the ammo color");
  1004.         jjConsole("! wl color index - Changes the index color");
  1005.         jjConsole("! wl bind - Binds the weapon list to a key");
  1006.         // jjConsole("! wl mode - Shows the current weapon list mode"); // useless
  1007.         jjConsole("-----------------------------------------------------");
  1008.         return true;
  1009.     }
  1010.  
  1011.     if(stringReceived.findFirst("!wl help 3") == 0) {
  1012.         jjConsole("-----------------------------------------------------");
  1013.         jjConsole("! wl emptyammo - Toggles whether to show empty ammo or show all ammo");
  1014.                 jjConsole("! wl size index - Switch between small and medium sizes");
  1015.                 jjConsole("! wl size ammo - Switch between small and medium sizes");
  1016.         jjConsole("! wl newprofile - Creates a new profile that you input in.");
  1017.         jjConsole("-----------------------------------------------------");
  1018.         return true;
  1019.     }
  1020.  
  1021.     if(stringReceived.findFirst("!wl help 4") == 0) {
  1022.         jjConsole("-----------------------------------------------------");
  1023.         jjConsole("! wl deleteprofile - Deletes a profile that you input in.");
  1024.         jjConsole("! wl profile - Uses a profile that you input in.");
  1025.         jjConsole("! wl profiles - Shows all the profiles.");
  1026.         jjConsole("! wl colorupgrade ammo - Toggles whether to make the weapons' color to be orange when they're upgraded");
  1027.         jjConsole("-----------------------------------------------------");
  1028.         return true;
  1029.     }
  1030.  
  1031.     if(stringReceived.findFirst("!wl help 5") == 0) {
  1032.         jjConsole("-----------------------------------------------------");
  1033.         jjConsole("! wl colorupgrade index - Toggles whether to make the weapons' indexes color to be orange when they're upgraded");
  1034.         jjConsole("-----------------------------------------------------");
  1035.         return true;
  1036.     }
  1037.  
  1038.     if(stringReceived.findFirst("!wl help") == 0) {
  1039.         jjConsole("-----------------------------------------------------");
  1040.         jjConsole("! wl help 1-5 - Shows a help message");
  1041.         jjConsole("! wl position - Changes the position of the weapon list");
  1042.         jjConsole("! wl toggle - Sets the weapon list to Toggle mode");
  1043.         jjConsole("! wl hold - Sets the weapon list to Hold mode");
  1044.         jjConsole("-----------------------------------------------------");
  1045.         return true;
  1046.     }
  1047.  
  1048.         if(stringReceived.findFirst("!wl size index") == 0) {
  1049.                 if(index_fontsize == "small") {
  1050.                         index_fontsize = "medium";
  1051.                         jjConsole("[WL] Index font size set to medium.");
  1052.                 } else {
  1053.                         index_fontsize = "small";
  1054.                         jjConsole("[WL] Index font size set to small.");
  1055.                 }
  1056.                
  1057.                 save();
  1058.                 return true;
  1059.         }
  1060.  
  1061.         if(stringReceived.findFirst("!wl size ammo") == 0) {
  1062.                 if(ammo_fontsize == "small") {
  1063.                         ammo_fontsize = "medium";
  1064.                         jjConsole("[WL] Ammo font size set to medium.");
  1065.                 } else {
  1066.                         ammo_fontsize = "small";
  1067.                         jjConsole("[WL] Ammo font size set to small.");
  1068.                 }
  1069.                
  1070.                 save();
  1071.                 return true;
  1072.         }
  1073.  
  1074.     if(stringReceived.findFirst("!wl emptyammo") == 0) {
  1075.         show_empty_ammo = not show_empty_ammo;
  1076.  
  1077.         jjConsole("[WL] Showing " + (show_empty_ammo ? "empty" : "all") + " ammo.");
  1078.  
  1079.         save();
  1080.  
  1081.         return true;
  1082.     }
  1083.  
  1084.     if(stringReceived.findFirst("!wl bind") == 0) {
  1085.         binding = true;
  1086.         jjConsole("[WL] Press a key to bind the weapon list to it.");
  1087.         return true;
  1088.     }
  1089.  
  1090.     // if(stringReceived.findFirst("!wl mode") == 0) { // useless
  1091.     //     jjConsole("[WL] Weapon list mode is currently " + (mode == "toggle" ? "Toggle" : "Hold"));
  1092.     //     return true;
  1093.     // }
  1094.  
  1095.     if(stringReceived.findFirst("!wl toggle") == 0) {
  1096.         mode = "toggle";
  1097.         show = true;
  1098.         jjConsole("[WL] Set the weapon mode to Toggle");
  1099.  
  1100.                 save();
  1101.  
  1102.         return true;
  1103.     }
  1104.  
  1105.     if(stringReceived.findFirst("!wl hold") == 0) {
  1106.         mode = "hold";
  1107.         jjConsole("[WL] Set the weapon mode to Hold");
  1108.         save();
  1109.         return true;
  1110.     }
  1111.  
  1112.     if(stringReceived.findFirst("!wl index") == 0) {
  1113.         showIndex = not showIndex;
  1114.         jjConsole("[WL] " + (showIndex ? "Showing" : "Hiding") + " the weapons' index");
  1115.        
  1116.         save();
  1117.         return true;
  1118.     }
  1119.  
  1120.     if(stringReceived.findFirst("!wl position") == 0) {
  1121.         string direction;
  1122.  
  1123.         if(not horizontal and not horizontal2) {
  1124.             horizontal = true;
  1125.             horizontal2 = false;
  1126.             direction = "bottom";
  1127.         } else if(horizontal and not horizontal2) {
  1128.             horizontal = false;
  1129.             horizontal2 = true;
  1130.             direction = "left";
  1131.         } else if(not horizontal and horizontal2) {
  1132.             horizontal = true;
  1133.             horizontal2 = true;
  1134.             direction = "top";
  1135.         } else if(horizontal and horizontal2) {
  1136.             horizontal = false;
  1137.             horizontal2 = false;
  1138.             direction = "right";
  1139.         }
  1140.  
  1141.         jjConsole("[WL] The weapons' list is now at the " + direction + " of your screen.");
  1142.        
  1143.         save();
  1144.         return true;
  1145.     }
  1146.  
  1147.     if(stringReceived.findFirst("!wl color index") == 0) {
  1148.         index_color = not index_color;
  1149.         jjConsole("[WL] Changed the weapons' index color to " + (index_color ? "colorful" : "normal"));
  1150.  
  1151.         save();
  1152.         return true;
  1153.     }
  1154.  
  1155.     if(stringReceived.findFirst("!wl color ammo") == 0) {
  1156.         ammo_color = not ammo_color;
  1157.         jjConsole("[WL] Changed the weapons' ammo color to " + (ammo_color ? "colorful" : "normal"));
  1158.  
  1159.         save();
  1160.         return true;
  1161.     }
  1162.  
  1163.     if(stringReceived.findFirst("!wl colorupgrade ammo") == 0) {
  1164.         color_upgraded_ammo = not color_upgraded_ammo;
  1165.  
  1166.         jjConsole("[WL] Now the weapons are " + (color_upgraded_ammo ? "colorful" : "normal") + " when they are upgraded.");
  1167.  
  1168.         save();
  1169.         return true;
  1170.     }
  1171.  
  1172.     if(stringReceived.findFirst("!wl colorupgrade index") == 0) {
  1173.         color_upgraded_index = not color_upgraded_index;
  1174.  
  1175.         jjConsole("[WL] Now the weapons' indexes are " + (color_upgraded_index ? "colorful" : "normal") + " when the weapons are upgraded.");
  1176.  
  1177.         save();
  1178.         return true;
  1179.     }
  1180.  
  1181.     if(stringReceived.findFirst("!wl profiles") == 0) {
  1182.         string profilesString = "";
  1183.  
  1184.         for(uint i = 0; i < profiles.length; i++) {
  1185.             profilesString += profiles[i] + ", ";
  1186.         }
  1187.  
  1188.         jjConsole("[WL] Available profiles: default, " + profilesString);
  1189.  
  1190.         return true;
  1191.     }
  1192.  
  1193.     if(stringReceived.findFirst("!wl newprofile") == 0) {
  1194.         string profileName = stringReceived.substr(15);
  1195.  
  1196.         if(stringReceived.findFirst("!wl newprofile ") != 0) {
  1197.             jjConsole("[WL] The newprofile command must be followed by a profile name.");
  1198.             return true;
  1199.         }
  1200.  
  1201.         if(profileName == "") {
  1202.             jjConsole("[WL] Please specify a profile name.");
  1203.             return true;
  1204.         }
  1205.  
  1206.         if(profileName == "default") {
  1207.             jjConsole("[WL] The profile name 'default' is reserved.");
  1208.             return true;
  1209.         }
  1210.  
  1211.         if(profiles.length() == 5) {
  1212.             jjConsole("[WL] You can't create more than 5 profiles.");
  1213.             return true;
  1214.         }
  1215.  
  1216.         if(profileName == "default") {
  1217.             jjConsole("[WL] You can't create a profile named 'default'.");
  1218.             return true;
  1219.         }
  1220.  
  1221.         for(uint i = 0; i < profiles.length; i++) {
  1222.             if(profiles[i] == profileName) {
  1223.                 jjConsole("[WL] A profile with that name already exists.");
  1224.                 return true;
  1225.             }
  1226.         }
  1227.  
  1228.         jjConsole("[WL] Creating a new profile named " + profileName);
  1229.  
  1230.         profiles.insertLast(profileName);
  1231.  
  1232.         jjConsole("[WL] Created profile " + profileName + ".");
  1233.  
  1234.         save();
  1235.         return true;
  1236.     }
  1237.  
  1238.     if(stringReceived.findFirst("!wl profile") == 0) {
  1239.         string profileName = stringReceived.substr(12);
  1240.  
  1241.         if(stringReceived.findFirst("!wl profile ") != 0) {
  1242.             jjConsole("[WL] The profile command must be followed by a profile name.");
  1243.             return true;
  1244.         }
  1245.  
  1246.         if(profileName == "") {
  1247.             jjConsole("[WL] Please specify a profile name.");
  1248.             return true;
  1249.         }
  1250.  
  1251.         bool exists = false;
  1252.  
  1253.         for(uint i = 0; i < profiles.length; i++) {
  1254.             if(profiles[i] == profileName) {
  1255.                 exists = true;
  1256.                 break;
  1257.             }
  1258.         }
  1259.  
  1260.         if(!exists && profileName != "default") {
  1261.             jjConsole("[WL] A profile with that name does not exist.");
  1262.             return true;
  1263.         }
  1264.  
  1265.         save();
  1266.  
  1267.         profile = profileName;
  1268.  
  1269.         reload();
  1270.  
  1271.         jjConsole("[WL] Now using the profile " + profileName + ".");
  1272.  
  1273.         return true;
  1274.     }
  1275.  
  1276.     if(stringReceived.findFirst("!wl deleteprofile") == 0) {
  1277.         string profileName = stringReceived.substr(18);
  1278.  
  1279.         if(stringReceived.findFirst("!wl deleteprofile ") != 0) {
  1280.             jjConsole("[WL] The deleteprofile command must be followed by a profile name.");
  1281.             return true;
  1282.         }
  1283.  
  1284.         if(profileName == "") {
  1285.             jjConsole("[WL] Please specify a profile name.");
  1286.             return true;
  1287.         }
  1288.  
  1289.         bool exists = false;
  1290.  
  1291.         for(uint i = 0; i < profiles.length; i++) {
  1292.             if(profiles[i] == profileName) {
  1293.                 exists = true;
  1294.                 break;
  1295.             }
  1296.         }
  1297.  
  1298.         if(profileName == "default") {
  1299.             jjConsole("[WL] You can't delete the profile 'default'.");
  1300.             return true;
  1301.         }
  1302.  
  1303.         if(profileName == profile) {
  1304.             jjConsole("[WL] You can't delete the profile you're using.");
  1305.             return true;
  1306.         }
  1307.  
  1308.         for(uint i = 0; i < profiles.length; i++) {
  1309.             if(profiles[i] == profileName) {
  1310.                 profiles.removeAt(i);
  1311.                 break;
  1312.             }
  1313.         }
  1314.  
  1315.         jjConsole("[WL] Deleted the profile " + profileName + ".");
  1316.  
  1317.         save();
  1318.         return true;
  1319.     }
  1320.  
  1321.     if(stringReceived.findFirst("!wl") == 0) {
  1322.         jjConsole("[WL] Invalid command."); return true;
  1323.     }
  1324.  
  1325.     return false;
  1326. }
  1327.  
  1328. int getColorValue(string mode) {
  1329.     if(jjColorDepth == 16) {
  1330.         if(mode == "hold") {
  1331.             return 0;
  1332.         } else { return 255; }
  1333.     } else {
  1334.         if(mode == "hold") {
  1335.             return 0;
  1336.         } else { return 255; }
  1337.     }
  1338. }
  1339.  
  1340. int getColorValue(bool boolean) {
  1341.     if(jjColorDepth == 16) {
  1342.         if(boolean) {
  1343.             return 255;
  1344.         } else { return 0; }
  1345.     } else {
  1346.         if(boolean) {
  1347.             return 255;
  1348.         } else { return 0; }
  1349.     }
  1350. }
  1351.  
  1352. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas)
  1353. {
  1354.     if(show) {
  1355.         if(player.ammo[2] > 0 or show_empty_ammo) bouncer.draw(canvas);
  1356.         if(player.ammo[3] > 0 or show_empty_ammo) ice.draw(canvas);
  1357.         if(player.ammo[4] > 0 or show_empty_ammo) seeker.draw(canvas);
  1358.         if(player.ammo[5] > 0 or show_empty_ammo) rf.draw(canvas);
  1359.         if(player.ammo[6] > 0 or show_empty_ammo) toaster.draw(canvas);
  1360.         if(player.ammo[7] > 0 or show_empty_ammo) tnt.draw(canvas);
  1361.         if(player.ammo[8] > 0 or show_empty_ammo) fireball.draw(canvas);
  1362.         if(player.ammo[9] > 0 or show_empty_ammo) electroblaster.draw(canvas);
  1363.         string coloring = "";
  1364.         string coloring2 = "";
  1365.  
  1366.         for (uint i = 2; i < 10; i++)
  1367.         {
  1368.             if(player.ammo[i] <= 0 and !show_empty_ammo) continue;
  1369.  
  1370.             int x = 0;
  1371.             int y = 0;
  1372.             int indexX = 0;
  1373.             int indexY = 0;
  1374.  
  1375.             if(index_color) coloring = coloring + "|";
  1376.             if(ammo_color) coloring2 = coloring2 + "|";
  1377.  
  1378.             if(horizontal) {
  1379.                 x = (originX - (i * 75)) + 15;
  1380.                 y = horizontalY;
  1381.                 indexX = (originX - (i * 75)) - 20;
  1382.                 indexY = horizontalY - 5;
  1383.             } else {
  1384.                 x = verticalX;
  1385.                 y = (originY - (i * 35)) + 35;
  1386.                 indexX = verticalX - 20;
  1387.                 indexY = (originY - (i * 35)) + 25 - 5;
  1388.             }
  1389.  
  1390.             if(horizontal and horizontal2) {
  1391.                 x = (originX - (i * 75)) + 30;
  1392.                 y = horizontalY2 + 5;
  1393.                 indexX = (originX - (i * 75)) + 3;
  1394.                 indexY = horizontalY2 - 5;
  1395.             } else if(not horizontal and horizontal2) {
  1396.                 x = verticalX2;
  1397.                 y = (originY - (i * 35)) + 35;
  1398.                 indexX = verticalX2 - 20;
  1399.                 indexY = (originY - (i * 35)) + 25 - 5;
  1400.             }
  1401.  
  1402.             if(color_upgraded_index && upgraded(player, i))
  1403.                 coloring = "||||";
  1404.  
  1405.             if(color_upgraded_ammo && upgraded(player, i))
  1406.                 coloring2 = "||||";    
  1407.  
  1408.             if(showIndex)
  1409.                 canvas.drawString(indexX, indexY, coloring + i, string_size_to_size(index_fontsize), STRING::NORMAL, 0);
  1410.  
  1411.             canvas.drawString(x, y, coloring2 + "x" + player.ammo[i], string_size_to_size(ammo_fontsize), STRING::NORMAL, 0);
  1412.            
  1413.             if(color_upgraded_index && upgraded(player, i))
  1414.                 coloring = "";
  1415.  
  1416.             if(color_upgraded_ammo && upgraded(player, i))
  1417.                 coloring2 = "";  
  1418.         }
  1419.  
  1420.     }
  1421.  
  1422.         // menu
  1423.         if(showMenu) {
  1424.         int BACKGROUND_COLOR = 255;
  1425.        
  1426.         if(jjColorDepth == 8) {
  1427.             BACKGROUND_COLOR = 15;
  1428.         }
  1429.  
  1430.                 canvas.drawRectangle(jjResolutionWidth / 2 - 300, jjResolutionHeight / 2 - 200, 600, 400, BACKGROUND_COLOR, SPRITE::BLEND_NORMAL, 128);
  1431.                 canvas.drawString(jjResolutionWidth / 2 - 300 + 10, jjResolutionHeight / 2 - 200 + 10, "Weapon List", string_size_to_size("medium"), STRING::NORMAL, 0);
  1432.         canvas.drawString(jjResolutionWidth / 2 - 300 + 10, jjResolutionHeight / 2 - 200 + 390, "Weapon List, Made by Spaz Electro, Version: v" + version, string_size_to_size("small"), STRING::NORMAL, 0);
  1433.  
  1434.                 for(uint i = 0; i < menu_buttons.length(); i++) {
  1435.                         MenuButton@ button = menu_buttons[i];
  1436.                         button.draw(canvas);
  1437.                 }
  1438.  
  1439.         // cursor
  1440.                 canvas.drawRectangle(jjMouseX - 10, jjMouseY - 10, 10, 10, 18, SPRITE::NORMAL, 0);
  1441.         }
  1442.  
  1443.     if(binding) canvas.drawString(jjResolutionWidth / 3, jjResolutionHeight / 2, "Binding... (press a key)", STRING::SMALL, STRING::NORMAL, 0);
  1444.     if(showSplitscreenWarning) canvas.drawString(jjResolutionWidth / 6, jjResolutionHeight / 8, "Splitscreen is not compatible with the weapon list mutator", STRING::SMALL, STRING::NORMAL, 0);
  1445.  
  1446.     return false;
  1447. }
  1448.  
  1449. void mouseInput(jjPLAYER@ player) {
  1450.         for(uint i = 0; i < menu_buttons.length(); i++) {
  1451.                 MenuButton@ button = menu_buttons[i];
  1452.                 button.input(player);
  1453.         }
  1454. }