Advertisement
johnlol

Training System v1.0

Jul 2nd, 2020
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 101.94 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Status & Weapon Mastery System
  3. //===== By ===================================================
  4. //= llchrisll
  5. //===== Version ==============================================
  6. //= 1.0 - Initial Release
  7. //===== Compatible With ======================================
  8. //= Every Athena SQL SVN
  9. //===== Tested With ==========================================
  10. //= rAthena 17267 SQL Trunk
  11. //===== Description ==========================================
  12. //= Handles a mastery system, which gives you extra bonuses
  13. //  depending on the mastery level.
  14. //= There are Status and Weapon Mastery:
  15. //   - Each Status Mastery has it's own training program
  16. //   - Weapon Mastery is about killing Monsters
  17. //===== Comments =============================================
  18. //= ...
  19. //===== SQL Table ============================================
  20. /*
  21.  CREATE TABLE IF NOT EXISTS `trainsystem` (
  22.  `id` INT(10) UNSIGNED NOT NULL,
  23.  `str` INT(8) UNSIGNED DEFAULT '0',
  24.  `agi` INT(8) UNSIGNED DEFAULT '0',
  25.  `vit` INT(8) UNSIGNED DEFAULT '0',
  26.  `int` INT(8) UNSIGNED DEFAULT '0',
  27.  `dex` INT(8) UNSIGNED DEFAULT '0',
  28.  `luk` INT(8) UNSIGNED DEFAULT '0',
  29.  `dagger` INT(8) UNSIGNED DEFAULT '0',
  30.  `one-sword` INT(8) UNSIGNED DEFAULT '0',
  31.  `two-sword` INT(8) UNSIGNED DEFAULT '0',
  32.  `one-spear` INT(8) UNSIGNED DEFAULT '0',
  33.  `two-spear` INT(8) UNSIGNED DEFAULT '0',
  34.  `one-axe` INT(8) UNSIGNED DEFAULT '0',
  35.  `two-axe` INT(8) UNSIGNED DEFAULT '0',
  36.  `mace` INT(8) UNSIGNED DEFAULT '0',
  37.  `unused` INT(8) UNSIGNED DEFAULT '0',
  38.  `stave` INT(8) UNSIGNED DEFAULT '0',
  39.  `bow` INT(8) UNSIGNED DEFAULT '0',
  40.  `knuck` INT(8) UNSIGNED DEFAULT '0',
  41.  `music` INT(8) UNSIGNED DEFAULT '0',
  42.  `whip` INT(8) UNSIGNED DEFAULT '0',
  43.  `book` INT(8) UNSIGNED DEFAULT '0',
  44.  `katar` INT(8) UNSIGNED DEFAULT '0',
  45.  `revol` INT(8) UNSIGNED DEFAULT '0',
  46.  `rifle` INT(8) UNSIGNED DEFAULT '0',
  47.  `gatl` INT(8) UNSIGNED DEFAULT '0',
  48.  `shotg` INT(8) UNSIGNED DEFAULT '0',
  49.  `grenade` INT(8) UNSIGNED DEFAULT '0',
  50.  `fuuma` INT(8) UNSIGNED DEFAULT '0',
  51.   PRIMARY KEY (`id`)
  52. ) ENGINE=MyISAM;
  53. */
  54. //==================== db/mob_db2.txt =======================
  55. /*
  56. // Training System - STR Mastery
  57. 2901,BARRICADE_,STR Training,STR Training,10,100,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  58. 2902,BARRICADE_,STR Training,STR Training,20,200,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  59. 2903,BARRICADE_,STR Training,STR Training,30,300,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  60. 2904,BARRICADE_,STR Training,STR Training,40,400,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  61. 2905,BARRICADE_,STR Training,STR Training,50,500,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  62. 2906,BARRICADE_,STR Training,STR Training,60,600,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  63. 2907,BARRICADE_,STR Training,STR Training,70,700,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  64. 2908,BARRICADE_,STR Training,STR Training,80,800,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  65. 2909,BARRICADE_,STR Training,STR Training,90,900,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  66. 2910,BARRICADE_,STR Training,STR Training,100,1000,0,0,0,1,1,2,100,99,0,0,0,0,0,0,7,12,0,0,22,0x40,2000,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  67. */
  68. //===========================================================
  69. sec_in02.gat,178,178,2  script  Mastery Trainer 110,{
  70.     mes .n$;
  71.     mes "Welcome, "+strcharinfo(0)+"!";
  72.     if(getgmlevel() >= .gm)
  73.         switch(select("- GM Panel:- Player Menu:- Reset Training Delay:- Reset Mastery Levels")) {
  74.             case 1:
  75.             goto GM_Panel;
  76.             break;
  77.            
  78.             case 3:
  79.             callfunc "DATA_D-M",1,.train_b,.delay_type,1,0,1;
  80.             break;
  81.            
  82.             case 4:
  83.             // Resetting Status
  84.             for ( set .@st,0; .@st < 6; set .@st,.@st + 1)
  85.                 callfunc("DATA_D-M",2,.train_b,1,.@st,1,0,2);
  86.            
  87.             // Resetting Weapons
  88.             for ( set .@w,1; .@w < getarraysize(.eq_n$); set .@w,.@w + 1)
  89.                 if(.@w != 9) callfunc("DATA_D-M",2,.train_b,2,.@w,1,0,2);
  90.                
  91.             mes "Reset completed.";
  92.             next;
  93.             mes .n$;
  94.             break;
  95.            
  96.             default:
  97.             break;
  98.         }
  99.        
  100.     mes "You can improve your mastery levels by 1 every "+ ( (.delay_time < 86400)?(.delay_time/3600)+" Hour(s)":(.delay_time/3600)/24+" Day(s)")+".";
  101.     mes " ";
  102.     mes "So what do you want to do?";
  103.     next;
  104.     switch(select("- Improve my Masteries:- Information"+ ( (.equip_b == 1)?":- Apply Equip Bonus":"")+":- Nothing")) {
  105.    
  106.         case 1:
  107.         mes .n$;
  108.         if(#TrainSys == 2) {
  109.             mes "I'm sorry, but you didn't wanted to copy your mastery level via the change of the bounding type.";
  110.             mes "So I can't let you improve your mastery levels.";
  111.             close;
  112.         }
  113.         if(#TrainSys == 0) {
  114.             mes "Ahah a newcomer, welcome!!";
  115.             mes "Do you want to participate in my training programs?";
  116.             next;
  117.             if(select("- Yes:- No") - 1) {
  118.                 mes .n$;
  119.                 mes "That's too bad, if you should change your mind by any chance, don't hesitate to come back.";
  120.                 close;
  121.             }
  122.             mes .n$;
  123.             mes "Which Mastery do you want to start with?";
  124.             set #TrainSys,1;
  125.             set #b_info,.train_b;
  126.                
  127.             if(.train_mode == 1) {
  128.                 if(.train_b == 0)
  129.                     set .@id,getcharid(3);
  130.                 else if(.train_b == 1)
  131.                     set .@id,getcharid(0);
  132.                
  133.                 query_sql "INSERT INTO `trainsystem` ( `id` ) VALUES ( '"+.@id+"' )";
  134.             }
  135.         } else {
  136.             if(.train_mode == 1 && query_sql("SHOW TABLES LIKE 'trainsystem'",.@db_ck) == -1) {
  137.                 mes "I'm sorry, but the database wasn't added to the system yet.";
  138.                 mes "Please contact the GM Team.";
  139.                 close;
  140.             }
  141.             mes "Which mastery do you want to try to improve this time?";
  142.             mes "These are your current levels:";
  143.             mes "[ === Status Mastery === ]";
  144.             setarray .@st_txt$[0],"STR","AGI","VIT","INT","DEX","LUK";
  145.             for ( set @st,0; @st < getarraysize(.@st_txt$); set @st,@st + 1)
  146.                 mes .@st_txt$[@st]+" = "+callfunc("DATA_D-M",2,.train_b,1,@st,2);
  147.             mes " ";
  148.             mes "[ === Weapon Mastery === ]";
  149.             for ( set @w,1; @w < getarraysize(.eq_n$); set @w,@w + 1)
  150.                 if(@w != 9) mes .eq_n$[@w]+" = "+callfunc("DATA_D-M",2,.train_b,2,@w,2);
  151.         }
  152.         next;
  153.         switch( set(@mastery,select("- Status Mastery:- Weapon Mastery")) ) {
  154.    
  155.             case 1:
  156.             mes .n$;
  157.             if(callfunc("DATA_D-M",1,.train_b,.delay_type,1,0,2) > gettimetick(2)) {
  158.                 mes "I'm sorry, but you are still exhausted from your previous training.";
  159.                 close;
  160.             }
  161.             mes "What do you like to train?";
  162.             if(.solo) {
  163.                 mes "^FF0000Note: The status mastery limit is active, so you can only train one status at once,";
  164.                 mes "if you want to train an another one you will lose the other ones.^000000";
  165.                 for ( set @s,0; @s < 6; set @s,@s + 1)
  166.                     if(set(.@s_c,callfunc("DATA_D-M",2,.train_b,1,@s,2) > 0) )
  167.                         setarray .@s_ct[@s],.@s_c;
  168.                    
  169.                 if(getarraysize(.@s_ct) > 1) {
  170.                     mes "You have more than one mastery training running.";
  171.                     mes "Please select the one you want to continue the training.";
  172.                     mes "Any other will be reseted afterwards.";
  173.                 }
  174.             }
  175.             if(.class) {
  176.                 mes "^FF0000Note: The status mastery class limit is active, therefore you only have up to 2 status masteries available.^000000";
  177.                 switch(BaseClass) {
  178.                     case Job_Swordman: 
  179.                     set @p,select("- STR:- DEX");
  180.                     if(@p == 1) set @p,0;
  181.                     else set @p,4;
  182.                     break;
  183.                    
  184.                     case Job_Mage: 
  185.                     set @p,select("- INT:- DEX") + 2;
  186.                     break;
  187.                    
  188.                     case Job_Archer:   
  189.                     set @p,select("- AGI:- DEX");  
  190.                     if(@p == 2) set @p,4;
  191.                     break;
  192.                    
  193.                     case Job_Acolyte:  
  194.                     set @p,select("- VIT:- INT");
  195.                     if(@p == 1) set @p,2;
  196.                     else set @p,3;
  197.                     break;
  198.                    
  199.                     case Job_Merchant: 
  200.                     set @p,select("- STR:- LUK");  
  201.                     if(@p == 1) set @p,0;
  202.                     else set @p,5;
  203.                     break;
  204.  
  205.                     case Job_Thief:
  206.                     set @p,select("- STR:- AGI") - 1;
  207.                     break;
  208.                 }
  209.             } else
  210.                 set @p,select("- STR:- AGI:- VIT:- INT:- DEX:- LUK") - 1;
  211.                
  212.             if(.solo) {
  213.                 mes "Chosen Status Mastery:";
  214.                 switch(@p) {
  215.                     case 0: mes "STR";  break;
  216.                     case 1: mes "AGI";  break;
  217.                     case 2: mes "VIT";  break;
  218.                     case 3: mes "INT";  break;
  219.                     case 4: mes "DEX";  break;
  220.                     case 5: mes "LUK";  break;
  221.                 }
  222.                 mes "Is that correct?";
  223.                 if(select("- Yes:- No") - 1) close;
  224.                 set .@p,.@s_ct[@p];
  225.                 for ( set .@o,0; .@o < 6; set .@o,.@o + 1)
  226.                     if(.@o == .@p) callfunc "DATA_D-M",2,.train_b,1,@p,1,.@p,2;
  227.                     else callfunc "DATA_D-M",2,.train_b,1,@p,1,0,2;
  228.             }
  229.             next;
  230.             set @stat,callfunc("DATA_D-M",2,.train_b,1,@p,2);
  231.             if(@stat >= .s_level) {
  232.                 mes .n$;
  233.                 mes "I'm sorry, but you have achieved the max level for this mastery already.";
  234.                 close;
  235.             }
  236.             switch(@p) {
  237.            
  238.                 // ========= STR Training =========
  239.                 case 0:
  240.                 mes .n$;
  241.                 if(getmapusers(.map$) != 0) {
  242.                     mes "I'm sorry, but there is someone practicing already.";
  243.                     mes "Please be patient.";
  244.                     close;
  245.                 }
  246.                 // Deciding Mob ID and Mob Name
  247.                 if(@stat <= 10) set .@lvl,10;
  248.                 else if(@stat > 10 && @stat <= 20) set .@lvl,20;
  249.                 else if(@stat > 20 && @stat <= 30) set .@lvl,30;
  250.                 else if(@stat > 30 && @stat <= 40) set .@lvl,40;
  251.                 else if(@stat > 40 && @stat <= 50) set .@lvl,50;
  252.                 else if(@stat > 50 && @stat <= 60) set .@lvl,60;
  253.                 else if(@stat > 60 && @stat <= 70) set .@lvl,70;
  254.                 else if(@stat > 70 && @stat <= 80) set .@lvl,80;
  255.                 else if(@stat > 80 && @stat <= 90) set .@lvl,90;
  256.                 else if(@stat > 90 && @stat <= 100) set .@lvl,100;
  257.                 set .str_mn$,getmonsterinfo(.str_mid+(.@lvl/10),0 )+" Level "+(@stat+1);
  258.                 mes "[ === STR Training === ]";
  259.                 mes "This will be done by hitting on a single mob which always recieves 1 damage per attack, like a Plant would.";
  260.                 mes "The mob's HP for this training is "+getmonsterinfo((.str_mid+(.@lvl/10)),2)+".";
  261.                 mes "There is just one thing you'll have to do:";
  262.                 mes " - You will have to unequip everything.";
  263.                 next;
  264.                 mes .n$;
  265.                 mes "I will now warp you to the practice map.";
  266.                 mes "Good luck.";
  267.                 close2;
  268.                 set @train,1;
  269.                
  270.                 // Unequipping everything and preventing from re-equipping
  271.                 sc_start SC_STRIPWEAPON,3600000,5;
  272.                 sc_start SC_STRIPSHIELD,3600000,5;
  273.                 sc_start SC_STRIPARMOR,3600000,5;
  274.                 sc_start SC_STRIPHELM,3600000,5;
  275.                 nude;
  276.                 monster .map$,.str_mx,.str_my,.str_mn$,.str_mid+(.@lvl/10),1,strnpcinfo(1)+"::OnStrMobDead";
  277.                 warp .map$,.str_cx,.str_cy;
  278.                 end;
  279.                
  280.                 // ========= AGI Training =========
  281.                 case 1:
  282.                 mes .n$;
  283.                 // Setting countdown
  284.                 set @time,.agi_b_time - (@stat/.agi_x_red);
  285.                 // Getting random array index
  286.                 set @txt,rand(getarraysize(.agi_txt$));
  287.                 mes "[ === AGI Training === ]";
  288.                 mes "This will be done by typing an random text in "+@time+" seconds.";
  289.                 mes "The text is case-sensitive, be sure to write it correctly.";
  290.                 mes "^FF0000Note: You won't get a second chance until the next training.";
  291.                 next;
  292.                 mes .n$;
  293.                 mes "Here is the text you need to type:";
  294.                 mes .agi_txt$[@txt];
  295.                 mes "The countdown will start after you press \"next\".";
  296.                 next;
  297.                 set @a_t,0; // Resetting Counter
  298.                 attachnpctimer;
  299.                 initnpctimer;
  300.                 input @i_txt$;
  301.                 if(@i_txt$ != .agi_txt$[@txt]) {
  302.                     mes .n$;
  303.                     mes "The text you have input is wrong.";
  304.                     stopnpctimer;
  305.                     callfunc "DATA_D-M",1,.train_b,.delay_type,1,.delay_time,1;
  306.                     close;
  307.                 }
  308.                 stopnpctimer;
  309.                 break;
  310.                
  311.                 // ========= VIT Training =========
  312.                 case 2:
  313.                 mes .n$;
  314.                 if(getmapusers(.map$) != 0) {
  315.                     mes "I'm sorry, but there is someone practicing already.";
  316.                     mes "Please be patient.";
  317.                     close;
  318.                 }
  319.                 // Calculating countdown
  320.                 if(@stat >= 10)
  321.                     set .@calc,.vit_inc*(@stat/10);    
  322.                 set .cd,.vit_cd+.@calc;
  323.                
  324.                 mes "[ === VIT Training === ]";
  325.                 mes "This will be done by staying alive for "+.cd+" seconds.";
  326.                 mes "Also you are not allowed to kill any mob while the training is running.";
  327.                 mes "If you try you will not recieve any EXP and items, also you will be warped back to your savepoint.";
  328.                 mes "I will now warp you to the practice map.";
  329.                 mes "Good luck.";
  330.                 close2;
  331.                
  332.                 // Calculation which adds the VIT Mastery Level
  333.                 if( @stat/5 < 1)
  334.                     set .@m_b,1;
  335.                 else if( @stat%10 == 0)
  336.                     set .@m_b,@stat;
  337.                 else if( @stat/5 > 0)
  338.                     set .@m_b,@stat/5;
  339.                    
  340.                 // Setting Mob ID's and Base Spawn Amount depending on your Level
  341.                 if(BaseLevel <= 99) {
  342.                                 // High Orc, Goblin Archer, Leib Olmai, Shinobi, Teddy Bear
  343.                     setarray .@mob[0],1213,1258,1306,1401,1622;
  344.                     set .@add,5;
  345.                 } else if(BaseLevel > 99 && BaseLevel <= 255) {
  346.                             // Archdam, Shelter, Skeggiold, Aliot, Incarnation of Morroc (Randgris Sprite)
  347.                     setarray .@mob[0],1668,1701,1754,1736,1918;
  348.                     set .@add,10;
  349.                    
  350.                 } else if(BaseLevel > 255) {
  351.                             // Necromancer, Thorn of Magic, Tendrilrion, Lord Knight Seyren (MvP Slave), Whitesmith Howard (MvP Slave)
  352.                     setarray .@mob[0],1870,1960,1991,1640,1642;
  353.                     set .@add,15;
  354.                 }
  355.                 // Result
  356.                 set .@m_q,.@m_b + .@add;
  357.                
  358.                 addtimer(.cd*1000),strnpcinfo(0)+"::OnVitEnd";
  359.                 if(.vit_mob_s == 1)
  360.                     for ( set .@i,0; .@i < getarraysize(.@mob); set .@i,.@i + 1)
  361.                         monster .map$,rand(.vit_mx[0],.vit_mx[1]),rand(.vit_my[0],.vit_my[1]),getmonsterinfo(.@mob[.@i],0),.@mob[.@i],.@m_q,strnpcinfo(1)+"::OnVitMobKill";
  362.                 else {
  363.                     set .@i,rand(getarraysize(.@mob));
  364.                     monster .map$,rand(.vit_mx[0],.vit_mx[1]),rand(.vit_my[0],.vit_my[1]),getmonsterinfo(.@mob[.@i],0),.@mob[.@i],.@m_q,strnpcinfo(1)+"::OnVitMobKill";
  365.                 }
  366.                 setmapflag .map$,mf_nobaseexp;
  367.                 setmapflag .map$,mf_nojobexp;
  368.                 warp .map$,.vit_cx,.vit_cy;
  369.                 end;
  370.                
  371.                 // ========= INT Training =========
  372.                 case 3:
  373.                 mes .n$;
  374.                 mes "[ === INT Training === ]";
  375.                 mes "This will be done via a quiz about Ragnarok Online.";
  376.                 mes "The quiz contains "+set(.@f,.int_base+(@stat/10))+" questions.";
  377.                 mes "You always have four answers available.";
  378.                 mes "Let's get started, should we?";
  379.                 mes "Good luck.";
  380.                 set @int,0; // Reseting points
  381.                 // Every 10th level you need one more question to answer
  382.                 set @req,.int_pt + (@stat/10);
  383.                 // Creating question catalog & Counter
  384.                 set .@q,0;
  385.                 set .@f,getarraysize(.int_quest$);
  386.                 while(.@g != .@f) {
  387.                     // Random question order?
  388.                     if(.int_rquest)
  389.                         set .@x,rand(getarraysize(.int_quest$));
  390.                     else
  391.                         set .@x,.@g; // array starts with 0 so -1
  392.                        
  393.                    
  394.                     for ( set .@c,0; .@c < getarraysize(.@q_id); set .@c,.@c + 1)
  395.                         // Checking if the question has been put already
  396.                         if(.@q_id[.@c] == .@x) {
  397.                             set .@rep,1;
  398.                             break;
  399.                         }
  400.                     if(.@rep == 0) {
  401.                         setarray .@q_id[getarraysize(.@q_id)],.@x;
  402.                         set .@g,.@g + 1;
  403.                     }
  404.                 }
  405.                 // Question Counter
  406.                 set .@d,0;
  407.                 while(.@d != .@f) {
  408.                     next;
  409.                     set .@ans$,"";
  410.                     set .@a,1;
  411.                     // Answers Counter
  412.                     while(.@a < 5) {
  413.                         sleep2 100;
  414.                         set .@rep,0;
  415.                         if(.int_rans) // Random answer order?
  416.                             set .@q,rand(1,4);
  417.                         else
  418.                             set .@q,.@a;
  419.                            
  420.                         for ( set .@c,0; .@c < getarraysize(.@a_id); set .@c,.@c + 1)
  421.                             // Checking if the answer has been put already
  422.                             if(.@a_id[.@c] == .@q) {
  423.                                 set .@rep,1;
  424.                                 break;
  425.                             }
  426.                         if(.@rep == 0) {
  427.                             setarray .@a_id[getarraysize(.@a_id)],.@q;
  428.                             // Current answer is the right answer
  429.                             if(.@q == .int_right[.@d])
  430.                                 set .@cor,.@q;
  431.                                
  432.                             set .@a,.@a + 1;
  433.                         }
  434.                     }
  435.                     // Creating Answers
  436.                     for ( set .@a,0; .@a < getarraysize(.@a_id); set .@a,.@a + 1)
  437.                         set .@ans$,.@ans$ + "- "+getd(".int_ans"+.@a_id[.@a]+"$["+.@d+"]")+ ( (.@a < 4)?":":"");
  438.                     mes "Question #"+(.@d+1);
  439.                     mes "------------------";
  440.                     mes .int_quest$[.@q_id[.@d]];
  441.                     // Selecting Answer
  442.                     set .@sel,select(.@ans$);          
  443.                     // Correct Answer
  444.                     if(.@a_id[.@sel] == .@cor) {
  445.                         next;
  446.                         set @int,@int + 1;
  447.                         mes .n$;
  448.                         mes "Correct Answer!!! +1 Point!!!";
  449.                         mes "Current Points: "+@int;
  450.                         mes "Required Points: "+@req;
  451.                     }
  452.                     // Enough points to pass
  453.                     if(@int == @req) break;
  454.                     set .@d,.@d + 1;
  455.                     cleararray .@a_id[0],0,128;
  456.                 }
  457.                 break;
  458.                
  459.                 // ========= DEX Training =========
  460.                 case 4:
  461.                 if(getmapusers(.map$) != 0) {
  462.                     mes "I'm sorry, but there is someone practicing already.";
  463.                     mes "Please be patient.";
  464.                     close;
  465.                 }
  466.                 mes "[ === DEX Training === ]";
  467.                 mes "This will be done by clicking on the NPC,";
  468.                 mes "which moves to random spots around you.";
  469.                 mes "You won't be able to move during the training.";
  470.                 mes "I will now warp you to the practice map.";
  471.                 mes "Good luck.";
  472.                 close2;
  473.                 warp .map$,.dex_cx,.dex_cy;
  474.                 doevent "DEX Training::OnPrepare";
  475.                 enablenpc "DEX Training";
  476.                 end;
  477.                
  478.                 // ========= LUK Training =========            
  479.                 case 5:
  480.                 mes .n$;
  481.                 mes "[ === LUK Training === ]";
  482.                 mes "This will be done by guessing 10 numbers,";
  483.                 set .@no,(@stat/10) + 1; // Numbers required
  484.                 mes "where "+ .@no+" have to be correct.";
  485.                 mes "Good luck.";
  486.                 while( set(.@c_t,.@c_t + 1) != .luk_gue) {
  487.                     next;
  488.                     set .@c_no,rand(1,9); // Randomize
  489.                     input @g_no;
  490.                     if(@g_no == .@c_no)
  491.                         set .@ct,.@ct + 1; // Guessed number is the same as the randomed one, increase this counter
  492.                     mes .n$;
  493.                     mes "Number #"+.@c_t+":";
  494.                     mes "Chosen number: "+@g_no;
  495.                     mes "Required number: "+.@c_no;
  496.                     mes "Correct numbers so far: "+.@ct;
  497.                     mes "Chances left: "+(.luk_gue-.@c_t);
  498.                     if(.@ct == .@no) break; // If the quantity of the corrected guesses is the same as the required one, continue
  499.                 }
  500.                 if(.@c_t == .luk_gue && .@ct != .@no) {
  501.                     mes "I'm sorry, but you have failed this training.";
  502.                     close;
  503.                 }
  504.                 break; 
  505.             }
  506.             next;
  507.             OnComplete:
  508.             callfunc "DATA_D-M",2,.train_b,1,@p,1,1,1;
  509.             callfunc "DATA_D-M",1,.train_b,.delay_type,1,.delay_time,1;
  510.             mes .n$;
  511.             mes "The training has been completed, your mastery level has increased by 1.";
  512.             set @p,0;
  513.             close;
  514.        
  515.             case 2:
  516.             mes .n$;
  517.             if(callfunc("DATA_D-M",1,.train_b,.delay_type,2,0,2) > gettimetick(2)) {
  518.                 mes "I'm sorry, but you are still exhausted from your previous training.";
  519.                 close;
  520.             }
  521.             if(getmapusers(.map$) != 0) {
  522.                 mes "I'm sorry, but there is someone practicing already.";
  523.                 mes "Please be patient.";
  524.                 close;
  525.             }
  526.             if(getequipid(4) == -1) {
  527.                 mes "Hmm, I can't train your weapon since you don't have any equipped.";
  528.                 mes "Please make sure you have a weapon equipped before coming back.";
  529.                 close;
  530.             }
  531.  
  532.             mes "Let's see, which weapon you have.";
  533.             next;
  534.             mes .n$;
  535.             mes "\""+getequipname(4)+"\" is your current weapon.";
  536.             mes "Do you want to train with it?";
  537.             if(select("- Yes:- No") - 1) close;
  538.             next;          
  539.             mes .n$;
  540.             for ( set .@e,0; .@e < getarraysize(.kill_weap); set .@e,.@e + 1)
  541.                 if(getiteminfo(getequipid(4),11) == .kill_weap[.@e]) {
  542.                     mes "I'm sorry, but I can't train your weapon, since it's forbidden.";
  543.                     close;
  544.                 }
  545.             mes "Okay, I will now take a closer look at your weapon and then I will decide your enemies.";
  546.             next;
  547.             set @e,getiteminfo(getequipid(4),11);
  548.             set .@m_lvl,callfunc("DATA_D-M",2,.train_b,2,@e,2);
  549.             if(.@m_lvl >= .w_level) {
  550.                 mes .n$;
  551.                 mes "I'm sorry, but you already achieved the max level of this mastery.";
  552.                 close;
  553.             }
  554.             while(1) {
  555.                 sleep2 100;
  556.                 set .@rep,0;
  557.                 // Setting mob ID
  558.                 set @mid,rand(1002,.l_mob);
  559.                 // Mob found, continue else repeat
  560.                 if(getmonsterinfo(@mid,0) == "null") continue;
  561.                 // Checking if the Mob is an WoE Castle Treasure Chest
  562.                 if(compare(getmonsterinfo(@mid,0),"Treasure") == 1) continue;
  563.                 // Checking if the Mob ID is 1288 (Emperium)
  564.                 if(@mid == 1288) continue;
  565.                 // Checking if the Mob Mode contains "PLANT" (0x0040)
  566.                 if(getmonsterinfo(@mid,MOB_MODE) & 64) continue;
  567.                 // Checking if the Mob is an MvP and if MvP's are allowed, if not repeat
  568.                 for ( set .@m,0; .@m < getarraysize(.wm_mvp_id); set .@m,.@m + 1)
  569.                     if(@mid == .wm_mvp_id[.@m]) {
  570.                         if(!.wm_mvp) set .@rep,1;
  571.                         else set .@mvp_use,1;
  572.                         break;
  573.                     }
  574.                
  575.                 if(.@rep == 1) continue;
  576.                 // Deciding the weap level and so the difficulty of training via the mob levels:
  577.                 if(getmonsterinfo(@mid,1) <= 30) set .@e_lvl,1;
  578.                 else if(getmonsterinfo(@mid,1) > 30 && getmonsterinfo(@mid,1) <= 60) set .@e_lvl,2;
  579.                 else if(getmonsterinfo(@mid,1) > 60 && getmonsterinfo(@mid,1) <= 90) set .@e_lvl,3;
  580.                 else if(getmonsterinfo(@mid,1) > 90) set .@e_lvl,4;
  581.                
  582.                 // Mob's difficulty doesn't meet the Weapon Level
  583.                 if(getequipweaponlv(4) != .@e_lvl) continue;
  584.                 // Setting Spawn Amount
  585.                 if(!.@mvp_use) set @mob_am,rand(.wm_mmi,.wm_mma);
  586.                 else set @mob_am,rand(.wm_mvp_min,.wm_mvp_max);
  587.                 break;
  588.             }
  589.             mes .n$;
  590.             mes "Your enemies will be "+@mob_am+"x "+getmonsterinfo(@mid,0);
  591.             mes "Do you want to accept this challenge?";
  592.             if(select("- Yes:- No") - 1) close;
  593.             next;
  594.             mes .n$;
  595.             mes "Then I will warp you to the practice map.";
  596.             close2;
  597.             set @m_lvl,.@m_lvl;
  598.             // Cleaning map in case mobs are still on it ( DEBUG LOL :) )
  599.             if(mobcount(.map$,strnpcinfo(1)+"::OnMobTrainDead") > 0 && getmapusers(.map$) == 0) killmonsterall .map$;
  600.             monster .map$,.wm_msp_x,.wm_msp_y,"Weapon Training Lv. "+(@m_lvl+1),@mid,@mob_am,strnpcinfo(1)+"::OnMobTrainDead";
  601.             announce .n$+": ["+strcharinfo(0)+"] is practicing to increase "+( (Sex)?"his":"her")+" "+$@eq_n$[@e]+" Mastery from "+@m_lvl+" to "+(@m_lvl + 1)+"!",bc_all;
  602.             announce .n$+": "+( (Sex)?"He":"She")+" will be fighting against "+@mob_am+"x "+getmonsterinfo(@mid,0)+", good luck ["+strcharinfo(0)+"]!!!",bc_all;
  603.             set @train,1;
  604.             // Preventing that the player changes weapon
  605.             // type while training the wanted one.
  606.             set .e,@e;
  607.             set @k_total,0; // Resetting Total Kills for Mob Counter
  608.             warp .map$,.wm_cx,.wm_cy;
  609.             end;
  610.        
  611.         }
  612.         // ========== Information ============
  613.         case 2:
  614.         mes .n$;
  615.         mes "I will now explain you about this training system.";
  616.         mes "Let's start with \"Weapon Mastery\".";
  617.         next;
  618.         mes "[ === Weapon Mastery === ]";
  619.         mes "There are "+(getarraysize($@eq_n$) - 1)+" weapons you can master, which are:";
  620.         for ( set .@w,1; .@w < getarraysize($@eq_n$); set .@w,.@w + 1)
  621.             if(.@w != 9) mes "- "+$@eq_n$[.@w];
  622.         next;
  623.         mes "[ === Weapon Mastery === ]";
  624.         mes "The maximum level you can achieve with each weapon is "+.w_level+".";
  625.         mes "The benefit of this training is that you gain an atk/matk boost depending on your class.";
  626.         mes "This boost can increase by the refine level of the weapon.";
  627.         mes "The calculation of the boost is: mastery level * (refine/2)";
  628.         mes "In case the refine is below 2 no multiplitation will be done.";
  629.         mes "^FF0000Note: The Weapon Bonus will only be calculated using the Main Weapon (Right Hand).";
  630.         mes "The Weapon in the left hand (Affects Assassin Classes) will be ignored.";
  631.         next;
  632.         mes "[ === Weapon Mastery === ]";
  633.         mes "The training itself is killing monsters on the practice map.";
  634.         mes "The monsters will be decided depending on your weapon level (1-4):";
  635.         mes "Weapon Level 1: Monsters till Level 30";
  636.         mes "Weapon Level 2: Monsters till Level 60";
  637.         mes "Weapon Level 3: Monsters till Level 90";
  638.         mes "Weapon Level 4: Monsters above Level 90";
  639.         mes " ";
  640.         mes "The spawn amount will be a random value between "+.wm_mmi+" and "+.wm_mma+".";
  641.         if(.wm_mvp == 1) {
  642.             mes "MvP Usage is active so there is a chance that MvP's are included also.";
  643.             mes "But there the Spawn Amount is between "+.wm_mvp_min+" and "+.wm_mvp_max+".";
  644.         }
  645.         next;
  646.         mes .n$;
  647.         mes "So that was the Weapon Mastery, let's move straight to the \"Status Mastery\".";
  648.         next;
  649.         mes "[ === Status Mastery === ]";
  650.         mes "Each Status Training has it own program:";
  651.         mes " ";
  652.         mes "STR: Defeating a Mob which recieves always 1 damage like a plant does.";
  653.         mes "AGI: Typing an random text in a calculated time.";
  654.         mes "VIT: Survival Mode.";
  655.         mes "INT: Quiz about the world of Ragnarok Online.";
  656.         mes "DEX: Clicking an NPC which moves to random spots around you in a limited time.";
  657.         mes "LUK: Guessing numbers, every 10th level you need to have one number more correct than before.";
  658.         mes " ";
  659.         mes "The training progams for STR, VIT and DEX will take place on the practice map.";
  660.         mes "The Status Bonus activates itself on login and you gain it by typing in the WhisperBox \"NPC:StatusBonus\" and as text anything you like.";
  661.         next;
  662.         mes .n$;
  663.         mes "Also there is an Equip Bonus, which formular for the boost is equip-refine/2.";
  664.         mes "This bonus depends on your class and only your highest refine will be used.";
  665.         mes "Examples:";
  666.         mes "+4 Muffler[1] > 4/2 = 2 > Swordman Class > +% DEF Bonus > +2% DEF";
  667.         mes "+4 Muffler[1] > 4/2 = 2 > Mage Class > +% MDEF Bonus > +2% MDEF";
  668.         mes "For this Bonus to become active, you need to "+ ( (.equip_req == 0)?"only ":"pay "+.equip_r_am+"x "+ ( (.equip_req == 1)?"Zeny":"Cash Points") +" and ")+"talk to me, also you must have joined my training program.";
  669.         mes "The Equip Bonus will be usable for exactly 1 day after payment. After that you have to pay again to use it, the boosts have an duration of "+(.eq_dur/1000/60)+" Minutes, after that you have to talk to me again to re-apply them.";
  670.         break;
  671.            
  672.         case 3:
  673.         if(.equip_b == 0) break;
  674.         if(.equip_req == 0) set #eq_pay,1;
  675.                
  676.         if( #eq_pay == 1 && #eq_timer >= gettimetick(2) ) {
  677.             OnEquipBonus:
  678.             // Stats Applying from Equip
  679.             for ( set @i,1; @i < 11; set @i,@i + 1) {
  680.                 // Equipment slot is empty, skip it obviously.
  681.                 if(getequipid(@i) == 0) continue;
  682.                
  683.                 // Accessories don't have refines, skip 'em..., well except for GM Command xX
  684.                 if(@i == 7 || @i == 8) continue;
  685.  
  686.                 // Weapon Bonus, happens just once so no need to put it below this loop
  687.                 if(@i == 4) {
  688.                     set @e,getiteminfo(getequipid(4),11);
  689.                     if( set(@w_m,callfunc("DATA_D-M",2,.train_b,2,@e,2) ) == 0) {
  690.                         mes .n$;
  691.                         mes "You didn't any training with this weapon yet, so no Bonus for you ;(.";
  692.                         next;
  693.                         continue;
  694.                     }
  695.                     if(getequiprefinerycnt(4) > 1)
  696.                         set .@ref_b,getequiprefinerycnt(4)/2;
  697.                     else
  698.                         set .@ref_b,1;
  699.                     set @atk,@w_m*.@ref_b;
  700.                    
  701.                     switch(BaseClass) {
  702.                         case Job_Swordman: sc_end SC_INCATKRATE;    sc_start SC_INCATKRATE,.eq_dur,@atk;    dispbottom .n$+": + "+@atk+"% ATK Boost applied."; break;
  703.                         case Job_Mage:  sc_end SC_INCMATKRATE;  sc_start SC_INCMATKRATE,.eq_dur,@atk;   dispbottom .n$+": + "+@atk+"% MATK Boost applied."; break;
  704.                         case Job_Archer:    sc_end SC_INCATKRATE;   sc_start SC_INCATKRATE,.eq_dur,@atk;    dispbottom .n$+": + "+@atk+"% ATK Boost applied."; break;
  705.                         case Job_Acolyte:   sc_end SC_INCMATKRATE;  sc_start SC_INCMATKRATE,.eq_dur,@atk;   dispbottom .n$+": + "+@atk+"% MATK Boost applied."; break;
  706.                         case Job_Merchant:  sc_end SC_INCATKRATE;   sc_start SC_INCATKRATE,.eq_dur,@atk;    dispbottom .n$+": + "+@atk+"% ATK Boost applied."; break;
  707.                         case Job_Thief: sc_end SC_INCATKRATE;   sc_start SC_INCATKRATE,.eq_dur,@atk;    dispbottom .n$+": + "+@atk+"% ATK Boost applied."; break;
  708.                     }
  709.                     specialeffect2 EF_POTION_BERSERK;
  710.                     continue;
  711.                 }
  712.                 if(getequiprefinerycnt(@i) > @ref) // When an refine is higher than the previous one,
  713.                     set @ref,getequiprefinerycnt(@i);   //  set it to the new one
  714.             }
  715.             if(!@ref) {
  716.                 mes .n$;
  717.                 mes "Either you don't have any equip upgraded or you don't wear anything.";
  718.                 close;
  719.             }
  720.             switch(BaseClass) {
  721.                 case Job_Swordman:  sc_end SC_DEF_RATE; sc_start SC_DEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% DEF Equip-Boost applied."; break;
  722.                 case Job_Mage:  sc_end SC_MDEF_RATE;    sc_start SC_MDEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% MDEF Equip-Boost applied."; break;
  723.                 case Job_Archer:    sc_end SC_MDEF_RATE;    sc_start SC_MDEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% MDEF Equip-Boost applied."; break;
  724.                 case Job_Acolyte:   sc_end SC_DEF_RATE; sc_end SC_MDEF_RATE;    sc_start SC_DEF_RATE,.eq_dur,@ref/2; sc_start SC_MDEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% DEF/MDEF Equip-Boost applied."; break;
  725.                 case Job_Merchant:  sc_end SC_DEF_RATE; sc_start SC_DEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% DEF Equip-Boost applied."; break;
  726.                 case Job_Thief: sc_end SC_DEF_RATE; sc_start SC_DEF_RATE,.eq_dur,@ref/2; dispbottom .n$+": + "+@ref/2+"% DEF Equip-Boost applied."; break;
  727.             }
  728.             specialeffect2 EF_GUARD;
  729.             mes .n$;
  730.             mes "This Boosts will be active for "+(.eq_dur/1000/60)+" Minutes, if you want to re-apply the boost talk to me again.";
  731.            
  732.         } else {
  733.             mes .n$;
  734.             mes "To use the Equip Bonus, you have to pay for it:";
  735.             mes "Costs: "+.equip_r_am+"x "+( (.equip_req == 1)?"Zeny":"Cash Points");
  736.             mes "You have "+((.equip_req == 1)?Zeny:#CASHPOINTS)+"x "+( (.equip_req == 1)?"Zeny":"Cash Points");
  737.             mes "Do you want to use the Equip Bonus?";
  738.             mes "^FF0000Note: Only your highest refine will be used.^000000";
  739.             next;
  740.             if(select("- Yes:- No") - 1) close;
  741.             mes .n$;
  742.             if( ((.equip_req == 1)?Zeny:#CASHPOINTS) < .equip_r_am) {
  743.                 mes "Seems like you don't have enough "+( (.equip_req == 1)?"Zeny":"Cash Points");
  744.                 close;
  745.             }
  746.             mes "Thank you for your time and enjoy your bonus.";
  747.             close2;
  748.             doevent strnpcinfo(0)+"::OnEquipBonus";
  749.             set #eq_pay,1;
  750.             set #eq_timer,gettimetick(2)+86400;
  751.             set ((.equip_req == 1)?Zeny:#CASHPOINTS),((.equip_req == 1)?Zeny:#CASHPOINTS) - .equip_r_am;
  752.             end;
  753.         }
  754.         break;
  755.        
  756.         case 4:
  757.         break;
  758.     }
  759.     close;
  760.    
  761. // ======== STR Training ========
  762. OnStrMobDead:
  763. dispbottom .n$+": You have completed the STR Training successfully, I will now warp you back to your Save Point.";
  764. warp "SavePoint",0,0;
  765. sc_end SC_STRIPWEAPON;
  766. sc_end SC_STRIPSHIELD;
  767. sc_end SC_STRIPARMOR;
  768. sc_end SC_STRIPHELM;
  769. sleep2 2500;
  770. doevent strnpcinfo(1)+"::OnComplete";
  771. end;
  772. // ======== AGI Training ========
  773. OnTimer1000:
  774. stopnpctimer;
  775. set @a_t,@a_t + 1;
  776. if(@a_t == @time) {
  777.     announce .n$+": You have failed to type the given text in "+@time+" seconds. The practice will end now.",bc_self;
  778.     set @a_t,0;
  779.     end;
  780. }
  781. initnpctimer;
  782. end;
  783. // ======== VIT Training ========
  784. OnVitMobKill:
  785. set @f,1;
  786.  
  787. OnVitEnd:
  788. if(@f) {
  789.     dispbottom .n$+": You have killed an monster, so you failed the training. See you next time.";
  790.     callfunc("DATA_D-M",1,.train_b,.delay_type,1,.delay_time,1);
  791. }
  792. sleep2 1000;
  793. warp "SavePoint",0,0;
  794. removemapflag .map$,mf_nobaseexp;
  795. removemapflag .map$,mf_nojobexp;
  796. removemapflag .map$,mf_noskill;
  797. killmonsterall .map$;
  798. if(!@f) goto OnComplete;
  799. end;
  800.  
  801. // ==============================
  802. OnPCLogoutEvent:
  803. if(!@p && !@train) end;
  804. if(strcharinfo(3) == .map$) killmonsterall .map$;
  805. warp "SavePoint",0,0;
  806. callfunc("DATA_D-M",1,.train_b,.delay_type,1,.delay_time,1);
  807. end;
  808.  
  809. OnPCDieEvent:
  810. if(!@p && !@train) end;
  811. killmonsterall .map$;
  812. warp "SavePoint",0,0;
  813. sleep2 1500;
  814. if(HP == 0) atcommand "@alive";
  815. set @p,0;
  816. set @train,0;
  817. if(@e)
  818.     announce .n$+": ["+strcharinfo(0)+"] has failed the "+$@eq_n$[@e]+" Training! Good Luck next time.",bc_all;
  819. dispbottom .n$+": You have failed the training. See you next time.";
  820. callfunc("DATA_D-M",1,.train_b,.delay_type,1,.delay_time,1);
  821. end;
  822.  
  823. // ======= Weapon Mastery =======
  824. OnMobTrainDead:
  825. // Using @killmonster or like that doesn't have an RID attached so,...
  826. // preventing "no rid attached error" cuz of player variables > @
  827. if(playerattached() == 0) end;
  828. set @k_total,@k_total + 1;
  829. dispbottom .n$+": "+@k_total+"/"+@mob_am+" "+getmonsterinfo(@mid,0)+" killed so far!!!!";
  830. set @e,getiteminfo(getequipid(4),11);
  831. if(.e != @e) {
  832.     dispbottom .n$+": Since you have changed your weapon type to a another one, I'll abort your training.";
  833.     killmonsterall .map$;
  834. }
  835. if(@k_total == @mob_am) {
  836.     dispbottom .n$+": Congratulation!!! You have defeated all enemies, therefore your training was successfull.";
  837.     announce .n$+": ["+strcharinfo(0)+"] has successfully defeated all "+@mob_am+"x "+getmonsterinfo(@mid,0)+", "+( (Sex)?"his":"her")+" "+$@eq_n$[@e]+" Mastery have been increased from "+@m_lvl+" to "+(@m_lvl + 1)+"!",bc_all;
  838.     callfunc("DATA_D-M",2,.train_b,2,@e,1,1,1);
  839. } else end;
  840. set @train,0;
  841. callfunc("DATA_D-M",1,.train_b,.delay_type,2,.delay_time,1);
  842. sleep2 2000;
  843. warp "SavePoint",0,0;
  844. end;
  845.  
  846. OnPCLoadMapEvent:
  847. if( @p || @train) end;
  848. dispbottom .n$+": You are NOT allowed to be here, unless you're participating in an training.";
  849. warp "SavePoint",0,0;
  850. end;
  851.  
  852. GM_Panel:
  853. next;
  854. mes .n$;
  855. mes "Here you can change the Settings,";
  856. mes "but note, that once the server restarts or the script will be reloaded,";
  857. mes "any change will be reseted to it old setting.";
  858. next;
  859. switch(select("- Initial Settings:- Delay Settings:- Mastery Settings")) {
  860.  
  861.     case 1:
  862.     mes .n$;
  863.     mes "Please choose which setting you want to change:";
  864.     next;
  865.     switch(select("- Server Mode:- Global Coordinates:- Practice Map:- Bounding Type")) {
  866.        
  867.         // ============ Server Mode ============
  868.         case 1:
  869.         mes .n$;
  870.         mes "The current setting is "+ ( (.train_mode == 0)?"TxT":"SQL");
  871.         next;
  872.         if(select("- Change to "+ ( (.train_mode == 0)?"SQL":"TxT")+":- Nothing") - 1) break;
  873.         mes .n$;
  874.         mes "The Server Mode has been changed to "+ ( (.train_mode == 0)?"SQL":"TxT")+".";
  875.         set .train_mode,!.train_mode;
  876.         if(.train_mode == 1 && query_sql("SHOW TABLES LIKE 'trainsystem'",.@db_ck) == -1)
  877.             query_sql "CREATE TABLE IF NOT EXISTS `trainsystem` ( `id` INT(10) UNSIGNED NOT NULL, `str` INT(8) UNSIGNED DEFAULT '0', `agi` INT(8) UNSIGNED DEFAULT '0', `vit` INT(8) UNSIGNED DEFAULT '0', `int` INT(8) UNSIGNED DEFAULT '0', `dex` INT(8) UNSIGNED DEFAULT '0', `luk` INT(8) UNSIGNED DEFAULT '0', `dagger` INT(8) UNSIGNED DEFAULT '0', `one-sword` INT(8) UNSIGNED DEFAULT '0', `two-sword` INT(8) UNSIGNED DEFAULT '0', `one-spear` INT(8) UNSIGNED DEFAULT '0', `two-spear` INT(8) UNSIGNED DEFAULT '0', `one-axe` INT(8) UNSIGNED DEFAULT '0', `two-axe` INT(8) UNSIGNED DEFAULT '0', `mace` INT(8) UNSIGNED DEFAULT '0', `unused` INT(8) UNSIGNED DEFAULT '0', `stave` INT(8) UNSIGNED DEFAULT '0', `bow` INT(8) UNSIGNED DEFAULT '0', `knuck` INT(8) UNSIGNED DEFAULT '0', `music` INT(8) UNSIGNED DEFAULT '0', `whip` INT(8) UNSIGNED DEFAULT '0', `book` INT(8) UNSIGNED DEFAULT '0', `katar` INT(8) UNSIGNED DEFAULT '0', `revol` INT(8) UNSIGNED DEFAULT '0', `rifle` INT(8) UNSIGNED DEFAULT '0', `gatl` INT(8) UNSIGNED DEFAULT '0', `shotg` INT(8) UNSIGNED DEFAULT '0', `grenade` INT(8) UNSIGNED DEFAULT '0', `fuuma` INT(8) UNSIGNED DEFAULT '0')";
  878.         break;
  879.        
  880.         // ============ Global Coordinates ============
  881.         case 2:
  882.         mes .n$;
  883.         mes "The current global cooardinates are X:"+.coord_x+", Y:"+.coord_y+".";
  884.         next;
  885.         switch(select("- Change Coordinates:- Enable/Disable Global Cooardinates:- Nothing")) {
  886.            
  887.             case 1:
  888.             mes .n$;
  889.             mes "Please type the X Cooardinate, then the Y Cooardinate.";
  890.             mes "Afterwards I will check if these are passable.";
  891.             next;
  892.             input .@x_new;
  893.             input .@y_new;
  894.             mes .n$;
  895.             if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  896.                 mes "Seems like these coordinates are not passable.";
  897.                 mes "Please type valid coordinates.";
  898.                 close;
  899.             }
  900.             mes "The new coordinates have been saved successfully.";
  901.             set .coord_x,.@x_new;
  902.             set .coord_y,.@y_new;
  903.             break;
  904.            
  905.             case 2:
  906.             mes .n$;
  907.             mes "Using Global Cooardinates will "+( (.use_glob == 1)?"":"not")+" be used.";
  908.             if(select("- Change it:- Nothing") - 1) break;
  909.             next;
  910.             mes .n$;
  911.             mes "Usage of Global Coordinates has been changed to "+( (.use_glob == 1)?"Deactive":"Active")+".";
  912.             set .use_glob,!.use_glob;
  913.            
  914.             case 3:
  915.             break;
  916.         }
  917.         break;
  918.        
  919.         // ============ Practice Map ============
  920.         case 3:
  921.         mes .n$;
  922.         mes "The current practice map is "+ .map$+".";
  923.         next;
  924.         if(select("- Change Practice Map:- Nothing") - 1) break;
  925.         mes .n$;
  926.         mes "Please type the new Practice Map:";
  927.         next;
  928.         input .@m_new$;
  929.         mes .n$;
  930.         if(getmapusers(.@m_new$) == -1) {
  931.             mes "This map doesn't exists.";
  932.             mes "Please type a valid map.";
  933.             close;
  934.         }
  935.         mes "The Practice Map has been successfully changed.";
  936.         mes "I also will check if the global coordinates are still valid.";
  937.         set .map$,.@m_new$;
  938.         if(!checkcell(.map$,.coord_x,.coord_y,cell_chkpass) )
  939.             mes "It seems like they are not valid anymore, please change them else some bug may appear.";
  940.         break;
  941.        
  942.         // ============ Bounding Type ============
  943.         case 4:
  944.         mes .n$;
  945.         mes "The current Bounding Type is "+( (.train_b == 0)?"Account":"Per Character")+".";
  946.         mes "Do you want to change it?";
  947.         if(select("- Yes:- No") - 1) close;
  948.         next;
  949.         mes .n$;
  950.         mes "The Bounding Type has been changed to "+( (.train_b == 1)?"Account":"Per Character")+".";
  951.         set .train_b,!.train_b;
  952.     }
  953.     break;
  954.    
  955.     // ============ Delay Settings ============
  956.     case 2:
  957.     mes .n$;
  958.     mes "Please choose what you want to change:";
  959.     next;
  960.     switch(select("- Delay Type:- Delay Time:- Nothing")) {
  961.         case 1:
  962.         mes .n$;
  963.         mes "The current delay type setting is "+.delay_type+".";
  964.         mes "Values:";
  965.         mes "- 0 = Off";
  966.         mes "- 1 = Counts for all Mastery (Weapon & Status)";
  967.         mes "- 2 = Each status mastery has it own Delay, Weapon mastery has a general delay.";
  968.         mes " ";
  969.         mes "Please type the new value:";
  970.         next;
  971.         input .@del_type;
  972.         mes .n$;
  973.         if(.@del_type > 2) {
  974.             mes "Invalid Value, please type a valid one.";
  975.             close;
  976.         }
  977.         mes "The delay type has been successfully changed.";
  978.         set .delay_type,.@del_type;
  979.         break;
  980.    
  981.         case 2:
  982.         mes .n$;
  983.         if(.delay_type == 0) {
  984.             mes "The delay type is 0, so it isn't necessary to put a delay time.";
  985.             close;
  986.         }
  987.         mes "The current delay time is "+.delay_time +" seconds.";
  988.         mes "Please the new value:";
  989.         mes "Recommended Value: 3600 (1 Hour) and above, since it's in seconds.";
  990.         next;
  991.         input .@del_time;
  992.         mes .n$;
  993.         if(.@del_time < 1) {
  994.             mes "Invalid Time, please type a valid one.";
  995.             mes "Recommended Value: 3600 (1 Hour) and above, since it's in seconds.";
  996.             close;
  997.         }
  998.         mes "The delay time has been successfully changed.";
  999.         set .delay_time,.@del_time;
  1000.         break;
  1001.        
  1002.         case 3:
  1003.         break;
  1004.     }
  1005.    
  1006.     // ============ Mastery Settings ============
  1007.     case 3:
  1008.     mes .n$;
  1009.     mes "Which setting category do you want to change?";
  1010.     mes "Note: Main is like mastery max level, and so on.";
  1011.     next;
  1012.     switch(select("- Main:- Specific:- Equipment Bonus:- Nothing")) {
  1013.        
  1014.         // ============ Main Mastery Settings ============
  1015.         case 1:
  1016.         mes .n$;
  1017.         mes "Which Mastery?";
  1018.         next;
  1019.         if(select("- Status Mastery:- Weapon Mastery") == 1) {
  1020.        
  1021.             // ============ Status Mastery Main Settings ============
  1022.             mes .n$;
  1023.             mes "Which setting?";
  1024.             next;
  1025.             switch(select("- Max Level:- Training Restriction:- Class Restriction")) {
  1026.                
  1027.                 case 1:
  1028.                 mes .n$;
  1029.                 mes "Current Level: "+.s_level;
  1030.                 mes " ";
  1031.                 mes "Suggested values for:";
  1032.                 mes "- Low Rate: 20";
  1033.                 mes "- Mid Rate: 45";
  1034.                 mes "- High Rate: 100";
  1035.                 mes "- And higher: 500";
  1036.                 mes " ";
  1037.                 mes "This is up to you to decide which value suits your server";
  1038.                 mes "the best, you can put more than these values.";
  1039.                 mes " ";
  1040.                 mes "Please type the new max level:";
  1041.                 next;
  1042.                 input .@lvl_n;
  1043.                 mes .n$;
  1044.                 if(.@lvl_n < 1) {
  1045.                     mes "This can't be 0.";
  1046.                     close;
  1047.                 }
  1048.                 mes "The Max Level of the Status Mastery has been successfully changed to "+.@lvl_n+".";
  1049.                 set .s_level,.@lvl_n;
  1050.                 break;
  1051.                
  1052.                 case 2:
  1053.                 mes .n$;
  1054.                 mes "The current setting is "+ ( (.solo == 0)?"Offline":"Online")+".";
  1055.                 mes "Do you want to change it?";
  1056.                 next;
  1057.                 if(select("- Yes:- No") - 1) break;
  1058.                 mes .n$;
  1059.                 mes "The Training Restriction has been changed to "+ ( (.solo == 0)?"Online":"Offline")+".";
  1060.                 set .solo,!.solo;
  1061.                 break;
  1062.                
  1063.                 case 3:
  1064.                 mes .n$;
  1065.                 mes "The current setting is "+ ( (.class == 0)?"Offline":"Online")+".";
  1066.                 mes "Do you want to change it?";
  1067.                 next;
  1068.                 if(select("- Yes:- No") - 1) break;
  1069.                 mes .n$;
  1070.                 mes "The Class Restriction has been changed to "+ ( (.class == 0)?"Online":"Offline")+".";
  1071.                 set .class,!.class;
  1072.                 break;
  1073.             }
  1074.             break;
  1075.        
  1076.         // ============ Weapon Mastery Main Settings ============
  1077.         } else {
  1078.             mes .n$;
  1079.             mes "Which setting:";
  1080.             next;
  1081.             if(select("- Max Level:- Warp Coordinates") == 1) {
  1082.                 mes .n$;
  1083.                 mes "Current Level: "+.w_level;
  1084.                 mes " ";
  1085.                 mes "Suggested values for:";
  1086.                 mes "- Low Rate: 20";
  1087.                 mes "- Mid Rate: 45";
  1088.                 mes "- High Rate: 100";
  1089.                 mes "- And higher: 500";
  1090.                 mes " ";
  1091.                 mes "This is up to you to decide which value suits your server";
  1092.                 mes "the best, you can put more than these values.";
  1093.                 mes " ";
  1094.                 mes "Please type the new max level:";
  1095.                 next;
  1096.                 input .@lvl_n;
  1097.                 mes .n$;
  1098.                 if(.@lvl_n < 1) {
  1099.                     mes "This can't be 0.";
  1100.                     close;
  1101.                 }
  1102.                 mes "The Max Level of the Weapon Mastery has been successfully changed to "+.@lvl_n+".";
  1103.                 set .w_level,.@lvl_n;
  1104.                
  1105.             // ============ Weapon Mastery Warp Coordinates ============
  1106.             } else {
  1107.                 mes .n$;
  1108.                 if(.use_glob == 1) {
  1109.                     mes "Currently the Global Coordinates will be used, so there is no need to change them.";
  1110.                     close;
  1111.                 }
  1112.                 mes .n$;
  1113.                 mes "These are the current coordinates, X: "+.wm_cx+", Y: "+.wm_cy+".";
  1114.                 mes "Change it?";
  1115.                 next;
  1116.                 if(select("- Yes:- No") - 1) close;
  1117.                 mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1118.                 mes "Afterwards I will check if these are passable.";
  1119.                 next;
  1120.                 input .@x_new;
  1121.                 input .@y_new;
  1122.                 mes .n$;
  1123.                 if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1124.                     mes "Seems like these coordinates are not passable.";
  1125.                     mes "Please type valid coordinates.";
  1126.                     close;
  1127.                 }
  1128.                 mes "The new coordinates have been saved successfully.";
  1129.                 set .wm_cx,.@x_new;
  1130.                 set .wm_cy,.@y_new;
  1131.             }
  1132.             break;
  1133.         }
  1134.         break;
  1135.        
  1136.         // ============ Specific Mastery Settings ============
  1137.         case 2:
  1138.         mes .n$;
  1139.         mes "Which Mastery?";
  1140.         next;
  1141.         if(select("- Status Mastery:- Weapon Mastery") == 1) {
  1142.             // ============ Specific Status Mastery Settings ============
  1143.             mes .n$;
  1144.             mes "Now choose which Status Mastery you want to change the settings of:";
  1145.             next;
  1146.             switch(select("- STR:- AGI:- VIT:- INT:- DEX:- LUK")) {
  1147.                
  1148.                 // ============ STR Status Mastery Settings ============
  1149.                 case 1:
  1150.                 mes .n$;
  1151.                 mes "What do you want to edit?";
  1152.                 next;
  1153.                 switch(select("- Base Mob ID:- Mob Spawn Coordinates:- Warp Coordinates")) {
  1154.                    
  1155.                     // ============ STR - Mob ID ============
  1156.                     case 1:
  1157.                     mes .n$;
  1158.                     mes "The current Mob ID is "+.str_mid+", change it?";
  1159.                     next;
  1160.                     if(select("- Yes:- No") - 1) break;
  1161.                     mes .n$;
  1162.                     mes "Please type the new Mob ID:";
  1163.                     mes "Note: The Mob ID + 1 should have the name \"STR Training\" in it.";
  1164.                     next;
  1165.                     input .@mid_n;
  1166.                     mes .n$;
  1167.                     if(compare(getmonsterinfo(.@mid_n+1,0),"STR Training") == 0) {
  1168.                         mes "This mob doesn't have the in the name \"STR Training\".";
  1169.                         close;
  1170.                     }
  1171.                     mes "The Mob ID has been successfully changed to "+.@mid_n+".";
  1172.                     set .str_mid,.@mid_n;
  1173.                     break;
  1174.                    
  1175.                     // ============ STR - Mob Spawn Coordinates  ============
  1176.                     case 2:
  1177.                     mes .n$;
  1178.                     mes "These are the current coordinates, X: "+.str_mx+", Y: "+.str_my+".";
  1179.                     mes "Change it?";
  1180.                     next;
  1181.                     if(select("- Yes:- No") - 1) close;
  1182.                     mes .n$;
  1183.                     mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1184.                     mes "Afterwards I will check if these are passable.";
  1185.                     next;
  1186.                     input .@x_new;
  1187.                     input .@y_new;
  1188.                     mes .n$;
  1189.                     if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1190.                         mes "Seems like these coordinates are not passable.";
  1191.                         mes "Please type valid coordinates.";
  1192.                         close;
  1193.                     }
  1194.                     mes "The new coordinates have been saved successfully.";
  1195.                     set .str_mx,.@x_new;
  1196.                     set .str_my,.@y_new;
  1197.                     break;
  1198.                    
  1199.                     // ============ STR - Warp Coordinates ============
  1200.                     case 3:
  1201.                     mes .n$;
  1202.                     if(.use_glob == 1) {
  1203.                         mes "Currently the Global Coordinates will be used, so there is no need to change them.";
  1204.                         close;
  1205.                     }
  1206.                     mes .n$;
  1207.                     mes "These are the current coordinates, X: "+.str_cx+", Y: "+.str_cy+".";
  1208.                     mes "Change it?";
  1209.                     next;
  1210.                     if(select("- Yes:- No") - 1) close;
  1211.                     mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1212.                     mes "Afterwards I will check if these are passable.";
  1213.                     next;
  1214.                     input .@x_new;
  1215.                     input .@y_new;
  1216.                     mes .n$;
  1217.                     if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1218.                         mes "Seems like these coordinates are not passable.";
  1219.                         mes "Please type valid coordinates.";
  1220.                         close;
  1221.                     }
  1222.                     mes "The new coordinates have been saved successfully.";
  1223.                     set .str_cx,.@x_new;
  1224.                     set .str_cy,.@y_new;
  1225.                     break;
  1226.                 }
  1227.                
  1228.                 // ============ AGI Status Mastery Settings ============
  1229.                 case 2:
  1230.                 mes .n$;
  1231.                 mes "Which setting do you want to change?";
  1232.                 next;
  1233.                 switch(select("- Messages to type:- Base Timer:- Reduction Counter")) {
  1234.                    
  1235.                     // ============ AGI - Messages to type ============
  1236.                     case 1:
  1237.                     mes .n$;
  1238.                     mes "These are the current messages to type:";
  1239.                     for ( set .@a,0; .@a < getarraysize(.agi_txt$); set .@a,.@a + 1)
  1240.                         mes "- "+.agi_txt$[.@a];
  1241.                    
  1242.                     mes "What do you want to do?";
  1243.                     next;
  1244.                     if(select("- Add Text:- Remove Text") - 1) {
  1245.                         mes .n$;
  1246.                         mes "Please select which text you want to remove:";
  1247.                         next;
  1248.                         for ( set .@t,0; .@t < getarraysize(.agi_txt$); set .@t,.@t + 1)
  1249.                             set .@agi_m$,.@agi_m$ + "- \""+.agi_txt$[.@t]+"\" "+( ( .agi_txt$[.@t+1] != "")?":":"");
  1250.                        
  1251.                         set .@del,select(.@agi_m$) - 1;
  1252.                         mes .n$;
  1253.                         mes "You have chosen \""+.agi_txt$[.@del]+"\".";
  1254.                         mes "Is that correct?";
  1255.                         next;
  1256.                         if(select("- Yes:- No") - 1) close;
  1257.                         deletearray .agi_txt$[.@del],1;
  1258.                         mes .n$;
  1259.                         mes "Entry removed.";
  1260.                        
  1261.                     } else {
  1262.                         mes .n$;
  1263.                         mes "Type any text you want, but it can't be shorter than 5 letters and longer than 20 letters.";
  1264.                         mes "By typing \"Cancel\", you will cancel the input.";
  1265.                         while(input(.@txt_n$,5,20) == 0 && getarraysize(.agi_txt$) != 128) {
  1266.                             next;
  1267.                             setarray .agi_txt$[getarraysize(.agi_txt$)],.@txt_n$;
  1268.                             mes .n$;
  1269.                             mes .@txt_n$+" has been added.";
  1270.                         }
  1271.                     }
  1272.                     break;
  1273.                    
  1274.                     // ============ AGI - Base Timer ============
  1275.                     case 2:
  1276.                     mes .n$;
  1277.                     mes "The current Base Timer is "+.agi_b_time+" seconds, change it?";
  1278.                     next;
  1279.                     if(select("- Yes:- No") - 1) close;
  1280.                     mes .n$;
  1281.                     mes "Please type the new time, but be realistic please.";
  1282.                     mes "Recommended: Minimum 5, Maximum 30.";
  1283.                     next;
  1284.                     if(input(.@time_n,5,30) != 0) {
  1285.                         mes .n$;
  1286.                         mes "Invalid Value, recommended: Minimum 5, Maximum 30.";
  1287.                         close;
  1288.                     }
  1289.                     mes .n$;
  1290.                     mes "The Base Timer has been changed to "+.@time_n+" seconds.";
  1291.                     set .agi_b_time,.@time_n;
  1292.                     break;
  1293.                    
  1294.                     // ============ AGI - Reduction Counter ============
  1295.                     case 3:
  1296.                     mes .n$;
  1297.                     mes "The Reduction Counter is currently at "+.agi_x_red+" seconds, change it?";
  1298.                     next;
  1299.                     if(select("- Yes:- No") - 1) close;
  1300.                     mes .n$;
  1301.                     mes "Please type the new timer, but be realistic please.";
  1302.                     mes "Recommended: Minimum 2, Maximum 15";
  1303.                     next;
  1304.                     if(input(.@time_n,2,15) != 0) {
  1305.                         mes .n$;
  1306.                         mes "Invalid Value, recommended: Minimum 2, Maximum 15.";
  1307.                         close;
  1308.                     }
  1309.                     mes .n$;
  1310.                     mes "The Reduction Counter has been changed to "+.@time_n+" seconds.";
  1311.                     set .agi_x_red,.@time_n;
  1312.                     break;
  1313.                 }
  1314.                 break;
  1315.                
  1316.                 // ============ VIT Status Mastery Settings ============
  1317.                 case 3:
  1318.                 mes .n$;
  1319.                 mes "Which setting do you want to change?";
  1320.                 next;
  1321.                 switch(select("- Mob Spawn Type:- Starting Countdown:- Countdown Increaser:- Warp Coordinates:- Nothing")) {
  1322.                    
  1323.                     // ============ VIT - Mob Spawn Type ============
  1324.                     case 1:
  1325.                     mes .n$;
  1326.                     mes "The Mob Spawn Type is currently on "+( (.vit_mob_s == 1)?"Multiply Mobs":"One Mob")+", change it?";
  1327.                     next;
  1328.                     if(select("- Yes:- No") - 1) close;
  1329.                     mes .n$;
  1330.                     mes "Mob Spawn Type has been changed to "+( (.vit_mob_s == 0)?"Multiply Mobs":"One Mob")+".";
  1331.                     set .vit_mob_s,!.vit_mob_s;
  1332.                     break;
  1333.                    
  1334.                     // ============ VIT - Starting Countdown ============
  1335.                     case 2:
  1336.                     mes .n$;
  1337.                     mes "The current starting countdown is "+.vit_cd+" seconds, change it?";
  1338.                     next;
  1339.                     if(select("- Yes:- No") - 1) close;
  1340.                     mes .n$;
  1341.                     mes "Please type the new countdown, but be realistic please.";
  1342.                     mes "Recommended: Minimum 10, Maximum 60";
  1343.                     next;
  1344.                     if(input(.@v_cd_n,10,60) != 0) {
  1345.                         mes .n$;
  1346.                         mes "Invalid Value, Recommended: Minimum 10, Maximum 60";
  1347.                         close;
  1348.                     }
  1349.                     mes .n$;
  1350.                     mes "The starting countdown has been changed to "+.@v_cd_n+" seconds.";
  1351.                     set .vit_cd,.@v_cd_n;
  1352.                     break;
  1353.                    
  1354.                     // ============ VIT - Countdown Increaser ============
  1355.                     case 3:
  1356.                     mes .n$;
  1357.                     mes "The current countdown increaser each 10th level is at "+.vit_inc+" seconds, change it?";
  1358.                     next;
  1359.                     if(select("- Yes:- No") - 1) close;
  1360.                     mes .n$;
  1361.                     mes "Please type the new countdown increaser, but be realistic please.";
  1362.                     mes "Recommended: Minimum 5, Maximum 30.";
  1363.                     next;
  1364.                     if(input(.@v_inc,5,30) != 0) {
  1365.                         mes .n$;
  1366.                         mes "Invalid Value, Recommended: Minimum 5, Maximum 30.";
  1367.                         close;
  1368.                     }
  1369.                     mes .n$;
  1370.                     mes "The countdown inreaser has been changed to "+.@v_inc+" seconds.";
  1371.                     set .vit_inc,.@v_inc;
  1372.                     break;
  1373.                    
  1374.                     // ============ VIT - Warp Coordinates ============
  1375.                     case 4:
  1376.                     mes .n$;
  1377.                     if(.use_glob == 1) {
  1378.                         mes "Currently the Global Coordinates will be used, so there is no need to change them.";
  1379.                         close;
  1380.                     }
  1381.                     mes .n$;
  1382.                     mes "These are the current coordinates, X: "+.vit_cx+", Y: "+.vit_cy+".";
  1383.                     mes "Change it?";
  1384.                     next;
  1385.                     if(select("- Yes:- No") - 1) close;
  1386.                     mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1387.                     mes "Afterwards I will check if these are passable.";
  1388.                     next;
  1389.                     input .@x_new;
  1390.                     input .@y_new;
  1391.                     mes .n$;
  1392.                     if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1393.                         mes "Seems like these coordinates are not passable.";
  1394.                         mes "Please type valid coordinates.";
  1395.                         close;
  1396.                     }
  1397.                     mes "The new coordinates have been saved successfully.";
  1398.                     set .vit_cx,.@x_new;
  1399.                     set .vit_cy,.@y_new;
  1400.                     break;
  1401.                    
  1402.                     case 5:
  1403.                 }
  1404.                 break;
  1405.                
  1406.                 // ============ INT Status Mastery Settings ============
  1407.                 case 4:
  1408.                 mes .n$;
  1409.                 mes "Which settings do you want to change?";
  1410.                 next;
  1411.                 switch(select("- Questions&Answers:- Minimum Questions:- Minimum Points to Pass:- Random Question Order:- Random Answer Order")) {
  1412.                    
  1413.                     // ============ INT - Questions & Answers ============
  1414.                     case 1:
  1415.                     mes .n$;
  1416.                     mes "What do you want to do?";
  1417.                     next;
  1418.                     if(select("- Add Question:- Remove Question") == 2) {
  1419.                        
  1420.                         // ============ INT - Questions & Answers  - REMOVE ============
  1421.                         mes .n$;
  1422.                         if(getarraysize(.int_quest$) < 2) {
  1423.                             mes "I'm sorry, but you can't delete the only question which is stored at the moment.";
  1424.                             mes "Please add another question first.";
  1425.                             close;
  1426.                         }
  1427.                         mes "Please choose from the menu below, which question you want to remove:";
  1428.                         mes "^FF0000Note: By removing an Question, you automatically remove the answers also.";
  1429.                         next;
  1430.                        
  1431.                         for ( set .@q,0; .@q < getarraysize(.int_quest$); set .@q,.@q + 1)
  1432.                             set .@rem_quest$,.@rem_quest$ + "- "+.int_quest$[.@q] + ( (.int_quest$[.@q+1] != 0)?":":"");
  1433.                        
  1434.                         set .@r_q,select(.@rem_quest$);
  1435.                        
  1436.                         mes .n$;
  1437.                         mes "You have chosen the following question:";
  1438.                         mes .int_quest$[.@r_q];
  1439.                         mes "Is that correct?";
  1440.                         if(select("- Yes:- No") - 1) close;
  1441.                         next;
  1442.                         mes .n$;
  1443.                         mes "I will now remove the question and the answers belonging to it.";
  1444.                         next;
  1445.                        
  1446.                         deletearray .int_quest$[.@r_q],1;
  1447.                         deletearray .int_ans1$[.@r_q],1;
  1448.                         deletearray .int_ans2$[.@r_q],1;
  1449.                         deletearray .int_ans3$[.@r_q],1;
  1450.                         deletearray .int_ans4$[.@r_q],1;
  1451.                         deletearray .int_right[.@r_q],1;
  1452.                        
  1453.                         mes .n$;
  1454.                         mes "Deletion completed.";
  1455.                        
  1456.                     // ============ INT - Questions & Answers - ADD ============
  1457.                     } else {
  1458.                         mes .n$;
  1459.                         if(getarraysize(.int_quest$) >= 128) {
  1460.                             mes "The Question Catalog is full already.";
  1461.                             close;
  1462.                         }
  1463.                         mes "[Question]";
  1464.                         mes "Please type the question:";
  1465.                         input .@add_q$;
  1466.                         next;
  1467.                         mes .n$;
  1468.                         mes "Now please type the answers.";
  1469.                         mes "Note: Remember which is the correct answer.";
  1470.                         set .@a,0;
  1471.                         while ( set(.@a,.@a + 1) < 4) {
  1472.                             next;
  1473.                             dispbottom .n$+": Answer Counter: "+.@a;
  1474.                             if(.@a == 0) set .@a,1;
  1475.                             mes .n$;
  1476.                             mes "[Answer#"+.@a+"]";
  1477.                             input getd(".@add_a"+.@a+"$");
  1478.                         }
  1479.            
  1480.                         mes " ";
  1481.                         mes "[Correct Answer]";
  1482.                         mes "Please type now the number of the correct Answer.";
  1483.                         mes "If you forgot which it is, type '0' and I will tell you the answers you put in, but only once.";
  1484.                         mes "If you put a number higher than 4, you'll have to start again.";
  1485.                         input .@add_r;
  1486.                         if(.@add_r == 0) { 
  1487.                             mes "[Answer#1]";
  1488.                             mes .@add_a1$;
  1489.                             mes " ";
  1490.                             mes "[Answer#2]";
  1491.                             mes .@add_a2$;
  1492.                             mes " ";
  1493.                             mes "[Answer#3]";
  1494.                             mes .@add_a3$;
  1495.                             mes " ";
  1496.                             mes "[Answer#4]";
  1497.                             mes .@add_a4$;
  1498.                             mes " ";
  1499.                             mes "Please type the number of the correct Answer:";
  1500.                             mes "If you should type again a '0' or a number higher than 4, you'll have to start again also.";
  1501.                             input .@add_r;
  1502.                             if(.@add_r == 0 || .@add_r > 4) close;
  1503.                         } else if(.@add_r > 4) {
  1504.                             mes "Invalid number.";
  1505.                             close;
  1506.                         }
  1507.                         next;
  1508.                         mes .n$;
  1509.                         mes "Thank you for hard work, I will now add this question and answers to the catalog.";
  1510.                         mes "See ya again.";
  1511.                         close2;
  1512.                         setarray .int_quest$[getarraysize(.int_quest$)],.add_q$;
  1513.                         setarray .int_ans1$[getarraysize(.int_ans1$)],.add_a1$;
  1514.                         setarray .int_ans2$[getarraysize(.int_ans2$)],.add_a2$;
  1515.                         setarray .int_ans3$[getarraysize(.int_ans3$)],.add_a3$;
  1516.                         setarray .int_ans4$[getarraysize(.int_ans4$)],.add_a4$;
  1517.                         setarray .int_right[getarraysize(.int_right)],.add_r;
  1518.                     }
  1519.                     break;
  1520.                    
  1521.                     // ============ INT - Minimum Questions ============
  1522.                     case 2:
  1523.                     mes .n$;
  1524.                     mes "Currently the minimum questions is "+.int_base+".";
  1525.                     mes "Do you want to change it?";
  1526.                     if(select("- Yes:- No") - 1) close;
  1527.                     next;
  1528.                     mes .n$;
  1529.                     mes "Please type the new value:";
  1530.                     mes "^FF0000Note: Minimum - 5, Maximum - 30^000000";
  1531.                     next;
  1532.                     if(input(.@int_b_n,5,30) != 0) {
  1533.                         mes .n$;
  1534.                         mes "Invalid Value, Minimum - 5, Maximum - 30";
  1535.                         close;
  1536.                     }
  1537.                     mes .n$;
  1538.                     mes "The minimum questions has been changed to "+.@int_b_n+".";
  1539.                     set .int_base,.@int_b_n;
  1540.                     break;
  1541.                    
  1542.                     // ============ INT - Minimum Points to Pass ============
  1543.                     case 3:
  1544.                     mes .n$;
  1545.                     mes "Currently the minimum points to pass is "+.int_pt+".";
  1546.                     mes "Do you want to change it?";
  1547.                     if(select("- Yes:- No") - 1) close;
  1548.                     next;
  1549.                     mes .n$;
  1550.                     mes "Please type the new value:";
  1551.                     mes "^FF0000Note: Minimum - 3, Maximum - 26^000000";
  1552.                     next;
  1553.                     if(input(.@int_pt_n,3,26) != 0) {
  1554.                         mes .n$;
  1555.                         mes "Invalid Value, Minimum - 3, Maximum - 26";
  1556.                         close;
  1557.                     }
  1558.                     mes .n$;
  1559.                     mes "The minimum points to pass has been changed to "+.@int_pt_n+".";
  1560.                     set .int_pt,.@int_pt_n;
  1561.                     break;
  1562.                    
  1563.                     // ============ INT - Random Question Order ============
  1564.                     case 4:
  1565.                     mes .n$;
  1566.                     mes "Random Question Order is "+ ( (.int_rquest == 1)?"Active":"Deactive")+".";
  1567.                     mes "Change it?";
  1568.                     if(select("- Yes:- No") - 1) break;
  1569.                     next;
  1570.                     mes .n$;
  1571.                     mes "The Random Question Order has been changed to "+ ( (.int_rquest == 1)?"Deactive":"Active")+".";
  1572.                     set .int_rquest,!.int_rquest;
  1573.                     break;
  1574.                    
  1575.                     // ============ INT - Random Answer Order ============
  1576.                     case 5:
  1577.                     mes .n$;
  1578.                     mes "Random Answer Order is "+ ( (.int_rans == 1)?"Active":"Deactive")+".";
  1579.                     mes "Change it?";
  1580.                     if(select("- Yes:- No") - 1) break;
  1581.                     next;
  1582.                     mes .n$;
  1583.                     mes "The Random Answer Order has been changed to "+ ( (.int_rans == 1)?"Deactive":"Active")+".";
  1584.                     set .int_rans,!.int_rans;
  1585.                     break;
  1586.                 }
  1587.                 break;
  1588.                
  1589.                 // ============ DEX Status Mastery Settings ============
  1590.                 case 5:
  1591.                 mes .n$;
  1592.                 mes "Which kind of setting do you want to change?";
  1593.                 next;
  1594.                 switch(select("- Timer to click the NPC:- Times to click the NPC:- Points required to pass:- Warp Coordinate")) {
  1595.  
  1596.                     // ============ DEX - Timer to click the NPC ============
  1597.                     case 1:
  1598.                     mes .n$;
  1599.                     mes "Current setting is "+.dex_time+" seconds to click the NPC.";
  1600.                     mes "Change it?";
  1601.                     if(select("- Yes:- No") - 1) close;
  1602.                     next;
  1603.                     mes .n$;
  1604.                     mes "Please type the new time:";
  1605.                     mes "^FF0000Note: Minimum - 5, Maximum - 30^000000";
  1606.                     next;
  1607.                     if(input(.@dt,5,30) != 0) {
  1608.                         mes .n$;
  1609.                         mes "Invalid Value, Minimum - 5, Maximum - 30.";
  1610.                         close;
  1611.                     }
  1612.                     mes .n$;
  1613.                     mes "The Time to click the NPC has been changed to "+.@dt+".";
  1614.                     set .dex_time,.@dt;
  1615.                     break;
  1616.  
  1617.                     // ============ DEX - Clicks Needed ============
  1618.                     case 2:
  1619.                     mes .n$;
  1620.                     mes "Current setting is "+.dex_npc+" times to click the NPC.";
  1621.                     mes "Change it?";
  1622.                     if(select("- Yes:- No") - 1) close;
  1623.                     next;
  1624.                     mes .n$;
  1625.                     mes "Please type the new value:";
  1626.                     mes "^FF0000Note: Minimum - 5, Maximum - 30^000000";
  1627.                     next;
  1628.                     if(input(.@dts,5,30) != 0) {
  1629.                         mes .n$;
  1630.                         mes "Invalid Value, Minimum - 5, Maximum - 30.";
  1631.                         close;
  1632.                     }
  1633.                     mes .n$;
  1634.                     mes "The Times to click the NPC has been changed to "+.@dts+".";
  1635.                     set .dex_npc,.@dts;
  1636.                     break;                 
  1637.                    
  1638.                     // ============ DEX - Points required to pass ============
  1639.                     case 3:
  1640.                     mes .n$;
  1641.                     mes "Current setting is "+.dex_pt+" times to click the NPC.";
  1642.                     mes "Change it?";
  1643.                     if(select("- Yes:- No") - 1) close;
  1644.                     next;
  1645.                     mes .n$;
  1646.                     mes "Please type the new value:";
  1647.                     mes "^FF0000Note: Minimum - 3, Maximum - 26^000000";
  1648.                     next;
  1649.                     if(input(.@dts,3,26) != 0) {
  1650.                         mes .n$;
  1651.                         mes "Invalid Value, Minimum - 3, Maximum - 26.";
  1652.                         close;
  1653.                     }
  1654.                     mes .n$;
  1655.                     mes "The Points required to Pass has been changed to "+.@dpt+".";
  1656.                     set .dex_pt,.@dpt;
  1657.                     break;
  1658.                    
  1659.                     // ============ DEX - Warp Coordinates ============
  1660.                     case 4:
  1661.                     mes .n$;
  1662.                     if(.use_glob == 1) {
  1663.                         mes "Currently the Global Coordinates will be used, so there is no need to change them.";
  1664.                         close;
  1665.                     }
  1666.                     mes .n$;
  1667.                     mes "These are the current coordinates, X: "+.dex_cx+", Y: "+.dex_cy+".";
  1668.                     mes "Change it?";
  1669.                     next;
  1670.                     if(select("- Yes:- No") - 1) close;
  1671.                     mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1672.                     mes "Afterwards I will check if these are passable.";
  1673.                     next;
  1674.                     input .@x_new;
  1675.                     input .@y_new;
  1676.                     mes .n$;
  1677.                     if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1678.                         mes "Seems like these coordinates are not passable.";
  1679.                         mes "Please type valid coordinates.";
  1680.                         close;
  1681.                     }
  1682.                     mes "The new coordinates have been saved successfully.";
  1683.                     set .dex_cx,.@x_new;
  1684.                     set .dex_cy,.@y_new;
  1685.                     break;
  1686.                 }
  1687.                 break;
  1688.                
  1689.                 // ============ LUK Status Mastery Settings ============
  1690.                 case 6:
  1691.                 mes .n$;
  1692.                 mes "Which setting do you want to change?";
  1693.                 next;
  1694.                 switch(select("- Guess Chances:- Nothing")) {
  1695.                    
  1696.                     // ============ LUK - Chances to guess ============
  1697.                     case 1:
  1698.                     mes .n$;
  1699.                     mes "The current chances to guess are "+.luk_gue+", change it?";
  1700.                     next;
  1701.                     if(select("- Yes:- No") - 1) close;
  1702.                     mes .n$;
  1703.                     mes "Please type the new value, but be realistic please.";
  1704.                     mes "Recommended: Minimum 5, Maximum 15.";
  1705.                     next;
  1706.                     if(input(.@luk_c,5,15) != 0) {
  1707.                         mes .n$;
  1708.                         mes "Invalid Value, Recommended: Minimum 5, Maximum 15.";
  1709.                         close;
  1710.                     }
  1711.                     mes .n$;
  1712.                     mes "The chances to guess have been changed to "+.@luk_c+".";
  1713.                     set .luk_gue,.@luk_c;
  1714.                     break;
  1715.                    
  1716.                     case 2:
  1717.                 }
  1718.                 break;
  1719.             }
  1720.             break;
  1721.            
  1722.         } else {
  1723.             // ============ Specific Weapon Mastery Settings ============
  1724.             mes .n$;
  1725.             mes "Which setting do you want to change?";
  1726.             next;
  1727.             switch(select("- Forbidden Weapon Types:- Monster Settings:- Uncustomized Weapon Feature:- Nothing")) {
  1728.                
  1729.                 // ============ Forbidden Weapon Types ============
  1730.                 case 1:
  1731.                 mes .n$;
  1732.                 mes "Currently there are "+getarraysize(.kill_weap)+" weapon types on the forbidden list.";
  1733.                 next;
  1734.                 switch(select("- Add Weapon Type:- Empty List:- Nothing")) {
  1735.                    
  1736.                     case 1:
  1737.                     mes .n$;
  1738.                     mes "Here is the list of the weapon types:";
  1739.                     for ( set .@l,1; .@l < getarraysize($@eq_n$); set .@l,.@l + 1)
  1740.                         if(.@l != 9) mes $@eq_n$[.@l]+" = "+.@l;
  1741.                    
  1742.                     mes " ";
  1743.                     mes "Please input the types you want to be forbidden:";
  1744.                     mes "By putting any number above the last weapon type or a '0', you will cancel the input.";
  1745.                     while(input(.@w_for,1,getarraysize($@eq_n$)-1) == 0) {
  1746.                         next;
  1747.                         set .@er,0;
  1748.                         for ( set .@q,0; .@q < getarraysize(.kill_weap); set .@q,@q + 1) {
  1749.                             if(.@w_for == .kill_weap[.@q]) {
  1750.                                 mes .n$;
  1751.                                 mes "CAUTION: Duplicate Entry, try again";
  1752.                                 set .@er,1;
  1753.                                 break;
  1754.                             }
  1755.                         }
  1756.                         if(.@er == 1) continue;
  1757.                         setarray .kill_weap[getarraysize(.kill_weap)],.@w_for;
  1758.                         mes .n$;
  1759.                         mes $@eq_n$[.@w_for]+" has been added.";
  1760.                     }
  1761.                     next;
  1762.                     mes .n$;
  1763.                     mes "There are now "+getarraysize($@eq_n$)+" weapon types forbidden.";
  1764.                     break;
  1765.                
  1766.                     case 2:
  1767.                     mes .n$;
  1768.                     mes "Do you really want to empty the list?";
  1769.                     next;
  1770.                     if(select("- Yes:- No") - 1) break;
  1771.                     deletearray .kill_weap[0],128;
  1772.                     mes .n$;
  1773.                     mes "List has been cleared.";
  1774.                    
  1775.                     case 3:
  1776.                 }
  1777.                 break;
  1778.                
  1779.                 // ============ Monster Settings ============
  1780.                 case 2:
  1781.                 mes .n$;
  1782.                 mes "Please choose which setting you want to change:";
  1783.                 next;
  1784.                 switch(select("- Last Mob ID:- Mob Spawn Cooardinates:- Minimum Mob Amount:- Maximum Mob Amount:- MVP Settings:- Nothing")) {
  1785.                    
  1786.                     // ============ Last Mob ID ============
  1787.                     case 1:
  1788.                     mes .n$;
  1789.                     mes "The last mob ID is currently "+.l_mob+".";
  1790.                     mes "Change it?";
  1791.                     if(select("- Yes:- No") - 1) break;
  1792.                     next;
  1793.                     mes .n$;
  1794.                     if(getmonsterinfo(input(.@m_id),0) == "null") {
  1795.                         mes "This mob doesn't exist.";
  1796.                         mes "Please type a valid ID.";
  1797.                         close;
  1798.                     }
  1799.                     mes "Last Mob ID has been changed to "+.@m_id+".";
  1800.                     set .l_mob,.@m_id;
  1801.                     break;
  1802.                    
  1803.                     // ============ Weapon - Mob Spawn Coordinates  ============
  1804.                     case 2:
  1805.                     mes .n$;
  1806.                     mes "These are the current coordinates, X: "+.wm_msp_x+", Y: "+.wm_msp_y+".";
  1807.                     mes "Change it?";
  1808.                     next;
  1809.                     if(select("- Yes:- No") - 1) close;
  1810.                     mes .n$;
  1811.                     mes "Please type the X Cooardinate, then the Y Cooardinate.";
  1812.                     mes "Afterwards I will check if these are passable.";
  1813.                     next;
  1814.                     input .@x_new;
  1815.                     input .@y_new;
  1816.                     mes .n$;
  1817.                     if(!checkcell(.map$,.@x_new,.@y_new,cell_chkpass) ) {
  1818.                         mes "Seems like these coordinates are not passable.";
  1819.                         mes "Please type valid coordinates.";
  1820.                         close;
  1821.                     }
  1822.                     mes "The new coordinates have been saved successfully.";
  1823.                     set .wm_msp_x,.@x_new;
  1824.                     set .wm_msp_y,.@y_new;
  1825.                     break;
  1826.                    
  1827.                     // ============ Minimum Mob Amount ============
  1828.                     case 3:
  1829.                     mes .n$;
  1830.                     mes "The current minimum mob amount is "+.wm_mmi+".";
  1831.                     mes "Change it?";
  1832.                     if(select("- Yes:- No") - 1) break;
  1833.                     next;
  1834.                     mes .n$;
  1835.                     if(input(.@m_mmi,1,.wm_mma) != 0) {
  1836.                         mes "Invalid Value, minimum 1, maximum "+.wm_mma+".";
  1837.                         mes "If you want to raise it above "+.wm_mma+".";
  1838.                         mes "Raise the Maximum Mob Amount then.";
  1839.                         close;
  1840.                     }
  1841.                     mes "Minimum Mob Amount has been changed to "+.@m_mmi+".";
  1842.                     set .wm_mmi,.@m_mmi;
  1843.                     break;
  1844.                    
  1845.                     // ============ Maximum Mob Amount ============
  1846.                     case 4:
  1847.                     mes .n$;
  1848.                     mes "The current maximum mob amount is "+.wm_mma+".";
  1849.                     mes "Change it?";
  1850.                     if(select("- Yes:- No") - 1) break;
  1851.                     next;
  1852.                     mes .n$;
  1853.                     if(input(.@m_mma,.wm_mmi,10000) != 0) {
  1854.                         mes "Invalid Value, minimum "+.wm_mmi+", maximum 10000.";
  1855.                         mes "If you want to lower it below "+.wm_mmi+".";
  1856.                         mes "Lower the Minimum Mob Amount then.";
  1857.                         close;
  1858.                     }
  1859.                     mes "Maximum Mob Amount has been changed to "+.@m_mma+".";
  1860.                     set .wm_mma,.@m_mma;
  1861.                     break;
  1862.                    
  1863.                     // ============ MvP Settings ============
  1864.                     case 5:
  1865.                     mes .n$;
  1866.                     mes "What do you want to change?";
  1867.                     next;
  1868.                     switch(select("- MvP Usage:- MvP ID's:- MvP Minimum Quantity:- MvP Maximum Quantity")) {
  1869.                    
  1870.                         // ============ MvP Usage ============
  1871.                         case 1:
  1872.                         mes .n$;
  1873.                         mes "MvP Usage is "+ ( (.wm_mvp == 1)?"Active":"Deactive")+".";
  1874.                         mes "Change it?";
  1875.                         if(select("- Yes:- No") - 1) break;
  1876.                         next;
  1877.                         mes .n$;
  1878.                         mes "The MvP Usage has been changed to "+ ( (.wm_mvp == 1)?"Deactive":"Active")+".";
  1879.                         set .wm_mvp,!.wm_mvp;
  1880.                         break;
  1881.                        
  1882.                         // ============ MvP ID's ============
  1883.                         case 2:
  1884.                         mes .n$;
  1885.                         if(.wm_mvp == 0) {
  1886.                             mes "Since MvP Usage isn't active, there is no need to edit the MVP ID's.";
  1887.                             close;
  1888.                         }
  1889.                         mes "Currently there are "+getarraysize(.wm_mvp_id)+" MvP's in the list,";
  1890.                         mes "which are:";
  1891.                         for ( set .@mvp,0; .@mvp < getarraysize(.wm_mvp_id); set .@mvp,.@mvp + 1)
  1892.                             mes "- "+getmonsterinfo(.wm_mvp_id[.@mvp],0);
  1893.                            
  1894.                         mes " ";
  1895.                         mes "So what do you want to do?";
  1896.                         next;
  1897.                         switch(select("- Add an MvP:- Remove an MvP:- Nothing")) {
  1898.                            
  1899.                             case 1:
  1900.                             mes .n$;
  1901.                             if(getarraysize(.wm_mvp_id) == 128) {
  1902.                                 mes "I'm sorry, but you can't add any MvP anymore.";
  1903.                                 close;
  1904.                             }
  1905.                             mes "You can cancel the input by typing a '0'.";
  1906.                             mes "Note: I won't be able to check if the Mob you've put is an MvP or not, so be sure to type the correct ID.";
  1907.                             while(input(.@m_add,1,.l_mob) != 0) {
  1908.                                 next;
  1909.                                 set .@er,0;
  1910.                                 for ( set .@q,0; .@q < getarraysize(.wm_mvp_id); set .@q,@q + 1) {
  1911.                                     if(.@m_add == .wm_mvp_id[.@q]) {
  1912.                                         mes .n$;
  1913.                                         mes "CAUTION: Duplicate Entry, try again";
  1914.                                         set .@er,1;
  1915.                                         break;
  1916.                                     }
  1917.                                 }
  1918.                                 if(.@er == 1) continue;
  1919.                                 setarray .wm_mvp_id[getarraysize(.wm_mvp_id)],.@m_add;
  1920.                                 mes .n$;
  1921.                                 mes getmonsterinfo(.@m_add,0)+" has been added.";
  1922.                             }
  1923.                             break;
  1924.                            
  1925.                             case 2:
  1926.                             mes .n$;
  1927.                             if(getarraysize(.wm_mvp_id) < 1) {
  1928.                                 mes "I'm sorry, but there are no MvPs you could remove.";
  1929.                                 close;
  1930.                             }
  1931.                             mes "Please choose which MvP you want to remove:";
  1932.                             mes "Format: Name (Mob ID)";
  1933.                             next;
  1934.                             for ( set .@r,0; .@r < getarraysize(.wm_mvp_id); set .@r,.@r + 1)
  1935.                                 set .@rem_mvp$,.@rem_mvp$ + "- "+getmonsterinfo(.wm_mvp_id[.@r],0)+" ("+.wm_mvp_id[.@r]+")"+ ( (.wm_mvp_id[.@r+1] != 0)?":":"");
  1936.                            
  1937.                             set .@del,select(.@rem_mvp$) - 1;
  1938.                             mes .n$;
  1939.                             mes "You have chosen "+getmonsterinfo(.wm_mvp_id[.@del],0)+" ("+.wm_mvp_id[.@del]+").";
  1940.                             mes "Is that correct?";
  1941.                             next;
  1942.                             if(select("- Yes:- No") - 1) close;
  1943.                             deletearray .wm_mvp_id[.@del],1;
  1944.                             mes .n$;
  1945.                             mes "Entry removed.";
  1946.                             break;
  1947.                         }
  1948.                         break;
  1949.                        
  1950.                         // ============ Minimum MvP Amount ============
  1951.                         case 3:
  1952.                         mes .n$;
  1953.                         mes "The current minimum MvP amount is "+.wm_mvp_min+".";
  1954.                         mes "Change it?";
  1955.                         if(select("- Yes:- No") - 1) break;
  1956.                         next;
  1957.                         mes .n$;
  1958.                         if(input(.@m_mmi,1,.wm_mvp_max) != 0) {
  1959.                             mes "Invalid Value, minimum 1, maximum "+.wm_mvp_max+".";
  1960.                             mes "If you want to raise it above "+.wm_mvp_max+".";
  1961.                             mes "Raise the Maximum MvP Amount then.";
  1962.                             close;
  1963.                         }
  1964.                         mes "Minimum MvP Amount has been changed to "+.@m_mmi+".";
  1965.                         set .wm_mvp_min,.@m_mmi;
  1966.                         break;
  1967.                        
  1968.                         // ============ Maximum MvP Amount ============
  1969.                         case 4:
  1970.                         mes .n$;
  1971.                         mes "The current maximum MvP amount is "+.wm_mvp_max+".";
  1972.                         mes "Change it?";
  1973.                         if(select("- Yes:- No") - 1) break;
  1974.                         next;
  1975.                         mes .n$;
  1976.                         if(input(.@m_mma,.wm_mvp_min,10) != 0) {
  1977.                             mes "Invalid Value, minimum "+.wm_mmi+", maximum 10.";
  1978.                             mes "If you want to lower it below "+.wm_mvp_min+".";
  1979.                             mes "Lower the Minimum MvP Amount then.";
  1980.                             close;
  1981.                         }
  1982.                         mes "Maximum MvP Amount has been changed to "+.@m_mma+".";
  1983.                         set .wm_mvp_max,.@m_mma;
  1984.                         break;
  1985.                        
  1986.                     }
  1987.                     break;
  1988.                    
  1989.                     case 6:
  1990.                 }
  1991.                 break;
  1992.                
  1993.                 case 3:
  1994.                 mes .n$;
  1995.                 mes "Uncustomized Weapon Feature is "+ ( (.wm_weap == 1)?"Active":"Deactive")+".";
  1996.                 mes "Change it?";
  1997.                 if(select("- Yes:- No") - 1) break;
  1998.                 next;
  1999.                 mes .n$;
  2000.                 mes "The Uncustomized Weapon Feature has been changed to "+ ( (.wm_weap == 1)?"Deactive":"Active")+".";
  2001.                 set .wm_weap,!.wm_weap;
  2002.                 break;
  2003.                
  2004.                 case 4:
  2005.                 break;
  2006.             }
  2007.         }
  2008.         break;
  2009.        
  2010.         // Equipment Bonus Settings
  2011.         case 3:
  2012.         mes .n$;
  2013.         mes "Please choose which setting you want to change:";
  2014.         next;
  2015.         switch(select("- Equip Bonus State:- Payment Method:- Payment Amount")) {
  2016.            
  2017.             case 1:
  2018.             mes .n$;
  2019.             mes "Currently the Equip Bonus is "+ ( (.equip_b == 1)?"Online":"Offline")+".";
  2020.             mes "Do you want to change it?";
  2021.             if(select("- Yes:- No") - 1) close;
  2022.             next;
  2023.             mes .n$;
  2024.             mes "Equip Bonus State has been changed to "+ ( (.equip_b == 0)?"Online":"Offline")+".";
  2025.             set .equip_b,!.equip_b;
  2026.             break;
  2027.        
  2028.             case 2:
  2029.             mes .n$;
  2030.             mes "Currently the Payment Method is "+( (.equip_req == 0)?"None":( (.equip_req == 1)?"Zeny":"Cash Points") )+".";
  2031.             mes "To what do you want to change it?";
  2032.             next;
  2033.             switch(select("- None:- Zeny:- Cash Points")) {
  2034.                
  2035.                 case 1:
  2036.                 mes .n$;
  2037.                 mes "The Payment Method has been changed to \"None\".";
  2038.                 set .equip_req,0;
  2039.                 break;
  2040.                
  2041.                 case 2:
  2042.                 mes .n$;
  2043.                 mes "The Payment Method has been changed to \"Zeny\".";
  2044.                 set .equip_req,1;
  2045.                 break;
  2046.  
  2047.                 case 3:
  2048.                 mes .n$;
  2049.                 mes "The Payment Method has been changed to \"Cash Points\".";
  2050.                 set .equip_req,2;
  2051.                 break;
  2052.             }
  2053.            
  2054.             case 3:
  2055.             mes .n$;
  2056.             if(.equip_req == 0) {
  2057.                 mes "Since the Payment Method is \"None\", you don't have to put an amount.";
  2058.                 close;
  2059.             }
  2060.             mes "Currently the Payment Amount is "+.equip_r_am+" "+( (.equip_req == 1)?"Zeny":"Cash Points")+".";
  2061.             mes "To what do you want to change it?";
  2062.             switch(.equip_req) {
  2063.                 case 1:
  2064.                 mes "^FF0000Note: Minimum 10000, Maximum 1,000,000.^000000";
  2065.                 next;
  2066.                 if(input(.@eq_r_am,10000,1000000) != 0) {
  2067.                     mes .n$;
  2068.                     mes "Invalid Value. Minimum 10000, Maximum 1,000,000.";
  2069.                     close;
  2070.                 }
  2071.                 set .equip_r_am,.@eq_r_am;
  2072.                 mes "The Payment Amount has been changed to "+.equip_r_am+" Zeny.";
  2073.                 break;
  2074.                
  2075.                 case 2:
  2076.                 mes "^FF0000Note: Minimum 10, Maximum 10,000.^000000";
  2077.                 next;
  2078.                 if(input(.@eq_r_am,10,10000) != 0) {
  2079.                     mes .n$;
  2080.                     mes "Invalid Value. Minimum 10, Maximum 10,000.";
  2081.                     close;
  2082.                 }
  2083.                 set .equip_r_am,.@eq_r_am;
  2084.                 mes "The Payment Amount has been changed to "+.equip_r_am+" Cash Points.";
  2085.                 break;
  2086.             }
  2087.             break;
  2088.         }
  2089.         break;
  2090.        
  2091.         case 4:
  2092.         break;
  2093.     }
  2094. }
  2095. close;
  2096.  
  2097. OnPCLoginEvent:
  2098. if(#TrainSys == 0) end; // No Mastery started yet
  2099. announce .n$+": Your mastery will be saved "+( (.train_b == 0)?"global on your account":"on each character seperatly")+".",bc_self;
  2100. announce .n$+": This may change anytime, if it does your mastery will be copied, if you agree you have either to start from 0 or from the old level you had at that time.",bc_self;
  2101. // Mastery Saving has changed
  2102. if(#db_save != .train_mode) {
  2103.     for ( set @s,1; @s < 6; set @s,@s + 1) {
  2104.         set @db_c,1;
  2105.         set .@val,callfunc("DATA_D-M",2,.train_b,1,@s,2);
  2106.         set @db_c,2;
  2107.         callfunc "DATA_D-M",2,.train_b,1,@s,1,.@val,2;
  2108.     }
  2109.     // Equip Update
  2110.     for ( set @w,1; @w <= 22; set @w,@w + 1) {
  2111.         set @db_c,1;
  2112.         set .@val,callfunc("DATA_D-M",2,.train_b,2,@w,2);
  2113.         set @db_c,2;
  2114.         callfunc "DATA_D-M",2,.train_b,2,@w,1,.@val,2;
  2115.     }  
  2116.     set #db_save,.train_mode;
  2117. }
  2118.  
  2119. if(.train_b != #b_info) { // Bound Type has changed
  2120.     mes .n$;
  2121.     mes "The bounding type has changed, do you want to copy your mastery level from your current character?";
  2122.     mes "Any level on the other characters will be overwritten.";
  2123.     mes "If you press \"No\", you can't continue your training neither you gain any effects until you choose to do that by an relogin.";
  2124.     if(set(#Train_Sys,select("- Yes:- No") ) == 2) close;
  2125.     close2;
  2126.     if(.train_mode == 1)       
  2127.         query_sql "UPDATE `trainsystem` SET `id` = '"+( (.train_b)?getcharid(0):getcharid(3))+"' WHERE `id` = '"+( (#b_info)?getcharid(0):getcharid(3))+"'";
  2128.    
  2129.     else {
  2130.         // Copying Status Mastery
  2131.         for ( set @c,0; @c < 6; set @c,@c + 1) {
  2132.             set .@cs,callfunc("DATA_D-M",2,#b_info,1,@c,2);
  2133.             debugmes .n$+":Status "+@c+", Value: "+.@cs;
  2134.             callfunc "DATA_D-M",2,.train_b,1,@c,1,.@cs,2;
  2135.             callfunc "DATA_D-M",2,#b_info,1,@c,1,0,2;
  2136.         }
  2137.         // Copying Weapon Mastery
  2138.         for ( set @w,1; @w < getarraysize(.eq_n$); set @w,@w + 1) {
  2139.             if(@w != 9) {
  2140.                 set .@ws,callfunc("DATA_D-M",2,#b_info,2,@w,2);
  2141.                 debugmes .n$+":Weapon "+@w+", Value: "+.@ws;
  2142.                 callfunc "DATA_D-M",2,.train_b,2,@w,1,.@ws,2;
  2143.                 callfunc "DATA_D-M",2,#b_info,2,@w,1,0,2;
  2144.             }
  2145.         }
  2146.     }
  2147.     set #b_info,.train_b;
  2148. }
  2149. if(.equip_b == 1)
  2150.     if(#eq_timer <= gettimetick(2) && #eq_pay == 1) {
  2151.         announce .n$+": The Payment for the Equip Bonus has worn out. To use the Bonus again, you have to pay once again.",bc_self;
  2152.         set #eq_pay,0;
  2153.         set #eq_timer,0;
  2154.     }
  2155. end;
  2156.  
  2157. OnInit:
  2158.  // NPC Name
  2159. set .n$,"["+strnpcinfo(1)+"]";
  2160. // Server Mode:
  2161. // 0 - TxT
  2162. // 1 - SQL
  2163. // How should the saving be done?
  2164. // TxT = via server temporar variables > $@<name>
  2165. // SQL = obviously via SQL Database
  2166. set .train_mode,0;
  2167. if(.train_mode == 1 && query_sql("SHOW TABLES LIKE 'trainsystem'",.@sys_ck) == -1)
  2168.     query_sql "CREATE TABLE IF NOT EXISTS `trainsystem` ( `id` INT(10) UNSIGNED NOT NULL, `str` INT(8) UNSIGNED DEFAULT '0', `agi` INT(8) UNSIGNED DEFAULT '0', `vit` INT(8) UNSIGNED DEFAULT '0', `int` INT(8) UNSIGNED DEFAULT '0', `dex` INT(8) UNSIGNED DEFAULT '0', `luk` INT(8) UNSIGNED DEFAULT '0', `dagger` INT(8) UNSIGNED DEFAULT '0', `one-sword` INT(8) UNSIGNED DEFAULT '0', `two-sword` INT(8) UNSIGNED DEFAULT '0', `one-spear` INT(8) UNSIGNED DEFAULT '0', `two-spear` INT(8) UNSIGNED DEFAULT '0', `one-axe` INT(8) UNSIGNED DEFAULT '0', `two-axe` INT(8) UNSIGNED DEFAULT '0', `mace` INT(8) UNSIGNED DEFAULT '0', `unused` INT(8) UNSIGNED DEFAULT '0', `stave` INT(8) UNSIGNED DEFAULT '0', `bow` INT(8) UNSIGNED DEFAULT '0', `knuck` INT(8) UNSIGNED DEFAULT '0', `music` INT(8) UNSIGNED DEFAULT '0', `whip` INT(8) UNSIGNED DEFAULT '0', `book` INT(8) UNSIGNED DEFAULT '0', `katar` INT(8) UNSIGNED DEFAULT '0', `revol` INT(8) UNSIGNED DEFAULT '0', `rifle` INT(8) UNSIGNED DEFAULT '0', `gatl` INT(8) UNSIGNED DEFAULT '0', `shotg` INT(8) UNSIGNED DEFAULT '0', `grenade` INT(8) UNSIGNED DEFAULT '0', `fuuma` INT(8) UNSIGNED DEFAULT '0')";
  2169. set .map$,"new_zone04.gat"; // Map for Practice
  2170. // Use Global Cooardinates? Default: 1
  2171. // - 1 = Yes
  2172. // - 0 = No
  2173. // If "No" then each training which requires the
  2174. // training map will use their own Warp cooardinates
  2175. set .use_glob,1;
  2176. set .coord_x,180; // Global X Cooardinate for the warp
  2177. set .coord_y,180; // Global Y Cooardinate for the warp
  2178. // =========== Mapflags ===========
  2179. setmapflag .map$,mf_noreturn;
  2180. setmapflag .map$,mf_nosave;
  2181. setmapflag .map$,mf_nowarpto;
  2182. setmapflag .map$,mf_nowarp;
  2183. setmapflag .map$,mf_nobranch;
  2184. setmapflag .map$,mf_noteleport;
  2185. setmapflag .map$,mf_loadevent;
  2186. setmapflag .map$,mf_nomvploot;
  2187. setmapflag .map$,mf_nomobloot;
  2188. setmapflag .map$,mf_monster_noteleport;
  2189. // Delay and Mastery Bounding:
  2190. // 0 = Account
  2191. // 1 = Character
  2192. set .train_b,0;
  2193. // ======== Training Delay Settings ======
  2194. // Type:
  2195. // - 0 = Off
  2196. // - 1 = Counts for all Mastery (Weapon & Status)
  2197. // - 2 = Each status mastery has it own Delay, Weapon mastery has a general delay
  2198. set .delay_type,1;
  2199. // Delay Time:
  2200. if(.delay_type)
  2201.     set .delay_time,86400; // Delay in seconds, Default: 86400 = 1 Day
  2202. // ======= Status Mastery Settings =======
  2203. // Max Level
  2204. // Suggested values for:
  2205. // - Low Rate: 20
  2206. // - Mid Rate: 45
  2207. // - High Rate: 100
  2208. // - And higher: 500
  2209. set .s_level,20;
  2210. // Status Training Restriction
  2211. // 1 = On
  2212. // 0 = Off
  2213. // When "1" only one status can be trained at once.
  2214. // Any other will be reseted.
  2215. set .solo,0;
  2216. // Class Restricted
  2217. // 1 = On
  2218. // 0 = Off
  2219. // If "1" training is class depended.
  2220. // Like Swordman Class is Str and Dex only
  2221. set .class,0;
  2222.  
  2223. // Status Bonus Duration is in the NPC "StatusBonus"
  2224.  
  2225. // ====== Str Mastery ======
  2226. // = Training Mob ID
  2227. // Put in .str_mid the Base Mob ID, like 2900.
  2228. // Afterwards the scripts calcuates the Mob ID itself.
  2229. // Just look around at line 191.
  2230. set .str_mid,2900;
  2231. set .str_mx,180; // X Cooardinate for the mob
  2232. set .str_my,184; // Y Cooardinate for the mob
  2233. // Warp Coordinate
  2234. if(.use_glob) { // Global Coordinates
  2235.     set .str_cx,.coord_x;
  2236.     set .str_cy,.coord_y;
  2237. } else { // Put here your coordinates
  2238.     set .str_cx,0;
  2239.     set .str_cy,0;
  2240. }
  2241. // ====== Agi Mastery - Fast Typing ======
  2242. setarray .agi_txt$[0],"Train me","Moar Speed","Agi r0ckz","I wanna be faster";
  2243. set .agi_b_time,15; // x seconds to type the text
  2244. set .agi_x_red,10; // Every x lvl the duration to type will be reduced by 1
  2245.  
  2246. // ====== Vit Mastery - Survival ======
  2247. // - Mob Spawn Type at once:
  2248. // 0 = One Mob
  2249. // 1 = Multiply Mobs
  2250. set .vit_mob_s,1;
  2251. set .vit_cd,30; // x seconds for the first level
  2252. set .vit_inc,10; // x seconds the countdown increases by every 10th level
  2253. // ======== Monster Spawn Coordinates ===========
  2254. // Randomly chosen spawn coordinates in a specified area:
  2255. // [0] = left-down corner
  2256. // [1] = right-upper corner
  2257. setarray .vit_mx[0],171,188;
  2258. setarray .vit_my[0],171,189;
  2259.  
  2260. // Warp Coordinate
  2261. if(.use_glob) { // Global Coordinates
  2262.     set .vit_cx,.coord_x;
  2263.     set .vit_cy,.coord_y;
  2264. } else { // Put here your coordinates
  2265.     set .vit_cx,0;
  2266.     set .vit_cy,0;
  2267. }
  2268. // ====== Int Mastery - Quiz ======
  2269. set .int_base,10; // Minium quantity of questions
  2270. set .int_pt,8; // Minimum points required to pass
  2271. set .int_rquest,1; // Random question order - 1 = On / 0 = Off
  2272. set .int_rans,1; // Random answer order - 1 = On / 0 = Off
  2273. setarray .int_quest$[0],"What is the name of this Server?","Which Card gives +100% HP, -50% DEF?";
  2274. setarray .int_ans1$[0],"Dumbass Ro","Tao Gunka Card";
  2275. setarray .int_ans2$[0],"Summon Ro","Fabre Card";
  2276. setarray .int_ans3$[0],"Pwnage Ro","Acidus Card";
  2277. setarray .int_ans4$[0],"Holy Ro","Mimic Card";
  2278. setarray .int_right[0],2,1;
  2279. // ====== Dex Mastery - Reaction ======
  2280. // =============== Note ====================
  2281. // There are two coordinate usages available:
  2282. // - Fixed
  2283. // - Random selected on an specified area
  2284. // = See the "OnInit" in the "DEX Training" NPC for more info.
  2285. // =========================================
  2286. set .dex_time,15; // x seconds to click the npc
  2287. set .dex_npc,10; // x times the NPC have to be clicked
  2288. set .dex_pt,8; // x Points required to pass the test
  2289. // Warp Coordinate
  2290. if(.use_glob) { // Global Coordinates
  2291.     set .dex_cx,.coord_x;
  2292.     set .dex_cy,.coord_y;
  2293. } else { // Put here your coordinates
  2294.     set .dex_cx,0;
  2295.     set .dex_cy,0;
  2296. }
  2297. // ====== Luk Mastery - Number guessing ======
  2298. set .luk_gue,20; // Chances to guess
  2299.  
  2300. // ========= Weapon Mastery Settings ========
  2301. // Max Level:
  2302. // Suggested values for:
  2303. // - Low Rate: 20
  2304. // - Mid Rate: 45
  2305. // - High Rate: 100
  2306. // - And higher: 500
  2307. set .w_level,20;
  2308.  
  2309. // Warp Coordinate
  2310. if(.use_glob) { // Global Coordinates
  2311.     set .wm_cx,.coord_x;
  2312.     set .wm_cy,.coord_y;
  2313. } else { // Put here your coordinates
  2314.     set .wm_cx,0;
  2315.     set .wm_cy,0;
  2316. }
  2317. // Weapon Types:
  2318. // 1: Daggers
  2319. // 2: One-handed swords
  2320. // 3: Two-handed swords
  2321. // 4: One-handed spears
  2322. // 5: Two-handed spears
  2323. // 6: One-handed axes
  2324. // 7: Two-handed axes
  2325. // 8: Maces
  2326. // 10: Staves
  2327. // 11: Bows
  2328. // 12: Knuckles
  2329. // 13: Musical Instruments
  2330. // 14: Whips
  2331. // 15: Books
  2332. // 16: Katars
  2333. // 17: Revolvers
  2334. // 18: Rifles
  2335. // 19: Gatling guns
  2336. // 20: Shotguns
  2337. // 21: Grenade launchers
  2338. // 22: Fuuma Shurikens
  2339. setarray .eq_n$[1],"Dagger","One-Handed Sword","Two-Handed Sword","One-Handed Spear","Two-Handed Spear","One-Handed Axe","Two-Handed Axe","Mace","Unused","Staff","Bow","Knuckle/Fist","Musical Instrument","Whip","Book","Katar","Revolver","Rifle","Gatling Gun","Shotgun","Grenade Launcher","Fuuma Shuriken";
  2340. // Requires to SQL Mode (.train_mode == 1)
  2341. // Sets the SQL Table names for the weapon types
  2342. setarray .sql_wn$[1],"dagger","one-sword","two-sword","one-spear","two-spear","one-axe","two-axe","mace","unused","stave","bow","knuck","music","whip","book","katar","revol","rifle","gatl","shotg","grenade","fuuma";
  2343. // Insert the numbers of the weapons, which are forbidden to be trained with.
  2344. setarray .kill_weap[0],0;
  2345. // Equip Bonus:
  2346. // 0 = Off
  2347. // 1 = On
  2348. // Note: Equip bonus will be done via the refine level/2
  2349. // and increases the ATK/MATK and DEF/MDEF depending on the Class
  2350. set .equip_b,1;
  2351. // Equip Bonus Payment:
  2352. // 0 = None
  2353. // 1 = Zeny
  2354. // 2 = Cash Points
  2355. set .equip_req,1;
  2356. set .equip_r_am,100000; // 100k
  2357. // Setting Equip Bonus Duration in Milliseconds (Seconds*1000)
  2358. set .eq_dur,3600000; // 1 Hour
  2359. // ====== Monster Settings for Weapon Mastery ======
  2360. set .l_mob,3500; // Last Mob ID in DB
  2361. // Mob Spawn Cooardinates
  2362. set .wm_mvar,1; // Use spawn variables for Mob Spawning or random spawn? - 1 = Yes/ 0 = No
  2363. if(.wm_mvar) {
  2364.     set .wm_msp_x,180;
  2365.     set .wm_msp_y,180;
  2366. } else {
  2367.     set .wm_msp_x,0;
  2368.     set .wm_msp_y,0;
  2369. }
  2370. set .wm_mmi,10; // Min Mob Quantity
  2371. set .wm_mma,100; // Max Mob Quantity
  2372. // Allow usage of MvP's?
  2373. // 0 - No
  2374. // 1 - Yes
  2375. set .wm_mvp,0;
  2376. // MVP IDs
  2377. setarray .wm_mvp_id[0],1511,1647,1785,1630,1039,1874,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159,1623,1650,1583,1708,1312,1751,1648,1658,1916,1929,1956,1957,1990,2022,2068;
  2378. set .wm_mvp_min,1; // MvP Minimum Quantity
  2379. set .wm_mvp_max,5; // MvP Maximum Quantity
  2380. // ============ Debug ==============================
  2381. // = Don't touch this!!
  2382. // =================================================
  2383. if(.train_mode > 1) { // If .train_mode is over 1 (0 = TxT / 1 = SQL)
  2384.     set .train_mode,0;
  2385.     debugmes .n$+": Training System Save Mode is over 1, set to 0.";
  2386. }
  2387. if(.map$ == "" || getmapusers(.map$) == -1) { // If the .map$ is empty or map doesn' exists
  2388.     set .map$,"";
  2389.     debugmes .n$+": Either .map$ is empty or the map doesn't exists, default to <Map>.";
  2390. }
  2391. if(.use_glob > 1) { // If .use_glob is over 1
  2392.     set .use_glob,1;
  2393.     debugmes .n$+": .use_glob is over 1, defaulting to 1.";
  2394. }
  2395. if(.train_b > 1) { // If .train_b is over 1
  2396.     set .train_b,0;
  2397.     debugmes .n$+": .train_b is over 1, defaulting to 0.";
  2398. }
  2399. if(.delay_type > 2) { // If .delay_type is over 2
  2400.     set .delay_type,1;
  2401.     debugmes .n$+": .delay_type is over 2, defaulting to 1.";
  2402. }
  2403. if(.delay_time < 3600) { // If .delay_time is below 3600 seconds > 1 hour
  2404.     set .delay_time,86400; // default it to 86400 > 1 day
  2405.     debugmes .n$+": .delay_time is below 3600 (1 hour), defaulting to 86400 (1 day).";
  2406. }
  2407. if(.solo > 1) { // If .solo is over 1
  2408.     set .solo,0;
  2409.     debugmes .n$+": .solo is over 1, defaulting to 0.";
  2410. }
  2411. if(.class > 1) { // If .class is over 1
  2412.     set .class,0;
  2413.     debugmes .n$+": .class is over 1, defaulting to 0.";
  2414. }
  2415. // If the base mob id in .str_mid is incorrect cause there weren't 10 mobs afterwards
  2416. for ( set .@m,1; .@m < 10; set .@m,.@m + 1)
  2417.     if(getmonsterinfo(.str_mid+.@m,0) == "null") {
  2418.         set .str_mid,4000; // Defaulting to 4000
  2419.         debugmes .n$+": The base mob id in .str_mid is incorrect cause there weren't 10 mobs afterwards, defaulting to 4000.";
  2420.     }
  2421. // ====== Agi Mastery - Fast Typing ======
  2422. if(getarraysize(.agi_txt$) < 1) {
  2423.     setarray .agi_txt$[0],"Train me","Moar Speed","Agi r0ckz","I wanna be faster";
  2424.     debugmes .n$+": .agi_txt$ array was empty, default to \"Train me,Moar Speed,Agi r0ckz,I wanna be faster\".";
  2425. }
  2426. if(.agi_b_time < 1) { // If .agi_b_time is be below 1, default to 15.
  2427.     set .agi_b_time,15;
  2428.     debugmes .n$+": .agi_b_time is below 1, defaulting to 15.";
  2429. }
  2430. if(.agi_x_red < 1) { // If .agi_x_red is be below 1, default to 10.
  2431.     set .agi_x_red,10;
  2432.     debugmes .n$+": .agi_x_red is below 1, defaulting to 10.";
  2433. }
  2434. // ====== Vit Mastery - Survival ======
  2435. if(.vit_mob_s > 1) { // If .vit_mob_s is higher than 1, default to 1.
  2436.     set .vit_mob_s,1;
  2437.     debugmes .n$+": .vit_mob_s is higher than 1, defaulting to 1.";
  2438. }
  2439. if(.vit_cd < 10) { // If .vit_cd is below 10, default to 30.
  2440.     set .vit_cd,30;
  2441.     debugmes .n$+": .vit_cd is below 10, defaulting to 30.";
  2442. }
  2443. if(.vit_inc < 1) { // If .vit_inc is below 1, default to 10.
  2444.     set .vit_inc,10;
  2445.     debugmes .n$+": .vit_inc is below 1, defaulting to 10.";
  2446. }
  2447. if(.vit_cx == 0 || .vit_cy == 0) { // If .vit_cx or .vit_cy is 0, use global coordinates.
  2448.     set .vit_cx,.coord_x;
  2449.     set .vit_cy,.coord_y;
  2450.     debugmes .n$+": .vit_cx or .vit_cy is 0, using to global cooardinates.";
  2451. }
  2452. // ====== Int Mastery - Reading Books in random order ======
  2453. if(.int_base < 5) { // If .int_base is below 5, default to 10
  2454.     set .int_base,10;
  2455.     debugmes .n$+": .int_base is below 5, defaulting to 10.";
  2456. }
  2457. if(.int_pt < 1) { // If .int_pt is below 1, default to 8.
  2458.     set .int_pt,8;
  2459.     debugmes .n$+": .int_pt is below 1, defaulting to 8.";
  2460. }
  2461. if(.int_rquest > 1) { // If .int_rquest is higher than 1, default to 1.
  2462.     set .int_rquest,1;
  2463.     debugmes .n$+": .int_rquest is higher than 1, defaulting to 1.";
  2464. }
  2465. if(.int_rquest > 1) { // If .int_rans is higher than 1, default to 1.
  2466.     set .int_rans,1;
  2467.     debugmes .n$+": .int_rans is higher than 1, defaulting to 1.";
  2468. }
  2469. // If .int_quest$, .int_ans1$, .int_ans2$, .int_ans3$, .int_ans4$ or .int_right is empty, use these lines:
  2470. if(getarraysize(.int_quest$) < 1 || getarraysize(.int_ans1$) < 1 || getarraysize(.int_ans2$) < 1 || getarraysize(.int_ans3$) < 1 || getarraysize(.int_ans4$) < 1 || getarraysize(.int_right) < 1) {
  2471.     setarray .int_quest$[0],"What is the name of this Server?";
  2472.     setarray .int_ans1$[0],"Dumbass Ro";
  2473.     setarray .int_ans2$[0],"Summon Ro";
  2474.     setarray .int_ans3$[0],"Pwnage Ro";
  2475.     setarray .int_ans4$[0],"Holy Ro";
  2476.     setarray .int_right[0],2;
  2477.     debugmes .n$+": .int_quest$, .int_ans1$, .int_ans2$, .int_ans3$, .int_ans4$ or .int_right is empty, reseted everything.";
  2478. }
  2479. // ====== Dex Mastery - Concentration ======
  2480. if(.dex_time < 5) { // If .dex_time is below 5, default to 15.
  2481.     set .dex_time,15;
  2482.     debugmes .n$+": .dex_time is below 5, defaulting to 15.";
  2483. }
  2484. if(.dex_npc < 1) { // If .dex_npc is below 1, default to 10.
  2485.     set .dex_npc,10;
  2486.     debugmes .n$+": .dex_npc is below 1, defaulting to 10.";
  2487. }
  2488. if(.dex_pt < 1) { // If .dex_pt is below 1, default to 8.
  2489.     set .dex_pt,8;
  2490.     debugmes .n$+": .dex_pt is below 1, defaulting to 8.";
  2491. }
  2492. if(.dex_cx == 0 || .dex_cy == 0) { // If .dex_cx or .dex_cy is 0, use global coordinates.
  2493.     set .dex_cx,.coord_x;
  2494.     set .dex_cy,.coord_y;
  2495.     debugmes .n$+": .dex_cx or .dex_cy is 0, using to global cooardinates.";
  2496. }
  2497. // ====== Luk Mastery - Number guessing ======
  2498. if(.luk_gue < 5) { // If .luk_gue is below 5, default to 20.
  2499.     set .luk_gue,20;
  2500.     debugmes .n$+": .luk_gue is below 5, defaulting to 20.";
  2501. }
  2502. // ========= Weapon Mastery Settings ========
  2503. if(.w_level < 20 || .w_level > 500) { // If .w_level is below 20 or higher than 500, default to 20.
  2504.     set .w_level,20;
  2505.     debugmes .n$+": .w_level is either below 20 or higher than 500, defaulting to 20.";
  2506. }
  2507. if(.wm_cx == 0 || .wm_cy == 0) { // If .wm_cx or .wm_cy is 0, use global coordinates.
  2508.     set .wm_cx,.coord_x;
  2509.     set .wm_cy,.coord_y;
  2510.     debugmes .n$+": .wm_cx or .wm_cy is 0, using to global cooardinates.";
  2511. }
  2512. // Looping through the .kill_weap array to check if there is an value higher than 22, if yes default to 0.
  2513. for ( set .@w,0; .@w < getarraysize(.kill_weap); set .@w,.@w + 1)
  2514.     if(.kill_weap[.@w] > 22) {
  2515.         debugmes .n$+": .kill_weap["+.@w+"] was holding an invalid value, reseting to 0.";
  2516.         deletearray .killweap[0],128;
  2517.         break;
  2518.     }
  2519. if(getarraysize(.eq_n$) < 1) { // If $@eq_n$ is empty, default to these entries:
  2520.     setarray .eq_n$[1],"Dagger","One-Handed Sword","Two-Handed Sword","One-Handed Spear","Two-Handed Spear","One-Handed Axe","Two-Handed Axe","Mace","Unused","Staff","Bow","Knuckle/Fist","Musical Instrument","Whip","Book","Katar","Revolver","Rifle","Gatling Gun","Shotgun","Grenade Launcher","Fuuma Shuriken";
  2521.     debugmes .n$+": $@eq_n$ is empty, defaulting.....";
  2522. }
  2523. if(getarraysize(.sql_wn$) < 1) { // If .sql_wn$ is empty, default to these entries:
  2524.     setarray .sql_wn$[1],"dagger","one-sword","two-sword","one-spear","two-spear","one-axe","two-axe","mace","unused","stave","bow","knuck","music","whip","book","katar","revol","rifle","gatl","shotg","grenade","fuuma";
  2525.     debugmes .n$+": .sql_wn$ is empty, defaulting.....";
  2526. }
  2527. if(.equip_b > 1) { // If .equip_b is higher than 1, default to 0.
  2528.     set .equip_b,0;
  2529.     debugmes .n$+": .equip_b is higher than 1, defaulting to 0.";
  2530. }
  2531. if(.equip_req > 2) { // If .equip_req is higher than 2, default to 1.
  2532.     set .equip_req,1;
  2533.     debugmes .n$+": .equip_req is higher than 2, defaulting to 1.";
  2534. }
  2535. // If .equip_req is not 0 and .equip_r_am is below 1 or higher than 1.000.000, default to 100.000.
  2536. if( .equip_req != 0 && (.equip_r_am < 1 || .equip_r_am > 1000000) ) {
  2537.     set .equip_r_am,100000; // 100k
  2538.     debugmes .n$+": .equip_r_am is either below 1 or higher than 1.000.000 while .equip_req is not 0, defaulting to 100.000.";
  2539.    
  2540.     // .equip_req is 0 while .equip_r_am is not, setting .equip_r_am to 0.
  2541.     if(.equip_req == 0 && .equip_r_am != 0) {
  2542.         set .equip_r_am,0;
  2543.         debugmes .n$+": .equip_req is 0 while .equip_r_am is not, setting .equip_r_am to 0.";
  2544.     }
  2545. }
  2546. // ====== Monster Settings for Weapon Mastery ======
  2547. if(.l_mob < 1002 || .l_mob > 3500) { // If .l_mob is below 1002 (Poring) or higher than 3500, default to 3500
  2548.     set .l_mob,3500;
  2549.     debugmes .n$+": .l_mob is below 1002 or higher than 3500, defaulting to 3500.";
  2550. }
  2551. if(.wm_mvar > 1) { // If .wm_mvar is over 1, reset to 1
  2552.     set .wm_mvar,1;
  2553.     debugmes .n$+": .wm_mvar is over 1, defaulting to 1.";
  2554.     if(.wm_mvar == 1 && (.wm_msp_x == 0 || .wm_msp_y == 0) ) { // If .wm_msp_x or .wm_msp_y is 0, set .wm_mvar to 0.
  2555.         set .wm_mvar,0;
  2556.         debugmes .n$+": .wm_msp_x or .wm_msp_y is 0, setting .wm_mvar to 0.";
  2557.     }
  2558. }
  2559. if(.wm_mmi < 1) { // If .wm_mmi is below 1, default to 10.
  2560.     set .wm_mmi,10;
  2561.     debugmes .n$+": .wm_mmi is below 1, defaulting to 10.";
  2562. }
  2563. if(.wm_mma < 10) { // If .wm_mma is below 10, default to 100.
  2564.     set .wm_mma,100;
  2565.     debugmes .n$+": .wm_mma is below 10, defaulting to 100.";
  2566. }
  2567. if(.wm_mvp > 1) { // If .wm_mvp is higher than 1, default to 0.
  2568.     set .wm_mvp,0;
  2569.     debugmes .n$+": .wm_mvp is higher than 1, defaulting to 0.";
  2570. }
  2571. if(.wm_mvp && getarraysize(.wm_mvp_id) < 1) {  // If .wm_mvp is 1 and .wm_mvp_id is empty, defaulting it these ID's.
  2572.     setarray .wm_mvp_id[0],1511,1647,1785,1630,1039,1874,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159,1623,1650,1583,1708,1312,1751,1648,1658;
  2573.     debugmes .n$+": .wm_mvp_id is empty though .wm_mvp is On, defaulting.....";
  2574.     // If .wm_mvp_min is higher than .wm_mvp_max, default to 1.
  2575.     if(.wm_mvp_min > .wm_mvp_max) {
  2576.         set .wm_mvp_min,1;
  2577.         debugmes .n$+": .wm_mvp_min is higher than .wm_mvp_max, defaulting to 1.";
  2578.     }
  2579.     // If .wm_mvp_max is lower than .wm_mvp_min, default to 5.
  2580.     if(.wm_mvp_max < .wm_mvp_min) {
  2581.         set .wm_mvp_max,5;
  2582.         debugmes .n$+": .wm_mvp_max is lower than .wm_mvp_min, defaulting to 5.";
  2583.     }
  2584. }
  2585. // ============ Debug End ==============================
  2586. // ========== Showing Practice Map Usage ===============
  2587. while(1) {
  2588.     waitingroom "Practice Map: "+( (getmapusers(.map$) == 0)?"Free":"In usage"),0;
  2589.     sleep 5000;
  2590.     delwaitingroom;
  2591. }
  2592. end;
  2593.     }
  2594. -   script  StatusBonus -1,{
  2595. end;
  2596.  
  2597. OnPCLoginEvent:
  2598. OnWhisperGlobal:
  2599. if(#TrainSys == 0 || #TrainSys == 2 || #db_save != .train_b) end; // No Mastery started yet, Bounding Type has changed
  2600. set .@n$,"Mastery Trainer";
  2601. // Setting Status Bonus Duration in Milliseconds (Seconds*1000)
  2602. set .@dur,3600000; // 1 Hour
  2603. // Stat Applying from Status Training
  2604. for ( set @s,0; @s < 6; set @s,@s + 1) {
  2605.     if( set(.@s_c,callfunc("DATA_D-M",2,.train_b,1,@s,2) ) == 0) continue;
  2606.         set @s_up,.@s_c; // Use the level itself
  2607.  
  2608. if(!@s_up) // Skipping current mastery, when no training was done yet
  2609.     continue;
  2610.  
  2611.     switch(@s) {
  2612.         case 0: sc_end SC_STRFOOD;  sc_start SC_STRFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" STR Mastery-Boost applied."; break;
  2613.         case 1: sc_end SC_AGIFOOD;  sc_start SC_AGIFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" AGI Mastery-Boost applied."; break;
  2614.         case 2: sc_end SC_VITFOOD;  sc_start SC_VITFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" VIT Mastery-Boost applied."; break;
  2615.         case 3: sc_end SC_INTFOOD;  sc_start SC_INTFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" INT Mastery-Boost applied."; break;
  2616.         case 4: sc_end SC_DEXFOOD;  sc_start SC_DEXFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" DEX Mastery-Boost applied."; break;
  2617.         case 5: sc_end SC_LUKFOOD;  sc_start SC_LUKFOOD,.@dur,@s_up;    dispbottom .@n$+": + "+@s_up+" LUK Mastery-Boost applied."; break;
  2618.    
  2619.     set .@i,1;
  2620.     }
  2621. }
  2622. if(.@i) dispbottom .@n$+": This Boost will be active for "+(.@dur/1000/60)+" Minutes, if you want to re-apply the boost whisper to me via \"NPC:StatusBonus\" with any text.";
  2623. end;
  2624. }
  2625.  
  2626. // ===== Function to save/read the Delay and Level =====    //
  2627. function    script  DATA_D-M    {                   //
  2628. // getarg(0): Categorie                             //
  2629. //      - 1 = Delay                                 //
  2630. //      - 2 = Mastery                               //
  2631. //                                                  //
  2632. // getarg(1): Bounding Type                         //
  2633. //      - 0 = Account                               //
  2634. //      - 1 = Character                             //
  2635. //                                                  //
  2636. //      ================ Delay ================     //
  2637. // getarg(2): Type                                  //
  2638. //      - 0 = Off                                   //
  2639. //      - 1 = Counts for all Mastery                //
  2640. //           (Weapon & Status)                      //
  2641. //      - 2 = Each status mastery has it own Delay, //
  2642. //            Weapon mastery has a general delay    //
  2643. //                                                  //
  2644. // getarg(3): Section                               //
  2645. //      - 1 = Status                                //
  2646. //      - 2 = Weapon                                //
  2647. //                                                  //
  2648. // getarg(4): Delay Duration                        //
  2649. //                                                  //
  2650. // getarg(5): Write/Read                            //
  2651. //      - 1 = Write                                 //
  2652. //      - 2 = Read                                  //
  2653. //                                                  //
  2654. // Example: callfunc "DATA_D-M"                     //
  2655. //   Categorie,Bound,Type,Section,Time,Write/Read;  //
  2656. //   1,.train_b,.delay_type,@mastery,.delay_time,1/2;//
  2657. //                                                  //
  2658. //      =============== Mastery ===============     //
  2659. // getarg(2): Section                               //
  2660. //      - 1 = Status                                //
  2661. //      - 2 = Weapon                                //
  2662. //                                                  //
  2663. // getarg(3): Mastery Type                          //
  2664. //      - When getarg(2) = 1: Status                //
  2665. //          - 0 = STR                               //
  2666. //          - 1 = AGI                               //
  2667. //          - 2 = VIT                               //
  2668. //          - 3 = INT                               //
  2669. //          - 4 = DEX                               //
  2670. //          - 5 = LUK                               //
  2671. //      - When getarg(2) = 2: Weapon                //
  2672. //          - See 'Weapon Types' above              //
  2673. //          Don't wanna repeat 22 lines, duh!!      //
  2674. //                                                  //
  2675. // getarg(4): Write/Read                            //
  2676. //      - 1 = Write                                 //
  2677. //      - 2 = Read                                  //
  2678. //                                                  //  
  2679. // getarg(5): Used as Value when getarg(4) is 1     //
  2680. //                                                  //
  2681. // getarg(6): Used as identifier for getarg(5)      //
  2682. //      - 1 = Add                                   //
  2683. //      - 2 = Set                                   //
  2684. //                                                  //
  2685. // Example: callfunc "DATA_D-M"                     //
  2686. //   Categorie,Bound,Section,Mastery Type,Write/Read,Value,Add/Set;//
  2687. //   2,.train_b,@mastery,@e/@p,1/2,<value>,1/2;     //
  2688. //                                                  //
  2689. // ================================================ //
  2690. //debugmes getarg(0,0)+","+getarg(1,0)+","+getarg(2,0)+","+getarg(3,0)+","+getarg(4,0)+","+getarg(5,0)+","+getarg(6,0);
  2691. // ============ Delay ===============
  2692. if(getarg(0) == 1) {
  2693.     if(getarg(2) == 0) return; // Off = No Delay
  2694.     // Type of Delay
  2695.     if(getarg(2) == 1)  // Counts for all Mastery
  2696.         set .@mast$,"Train";
  2697.        
  2698.     // Each mastery has it own Delay,
  2699.     else if(getarg(2) == 2) {
  2700.    
  2701.         // Status Mastery
  2702.         if(getarg(3) == 1) {
  2703.             switch(@p) {
  2704.                 case 0: set .@mast$,"STR"; break;
  2705.                 case 1: set .@mast$,"AGI"; break;
  2706.                 case 2: set .@mast$,"VIT"; break;
  2707.                 case 3: set .@mast$,"INT"; break;
  2708.                 case 4: set .@mast$,"DEX"; break;
  2709.                 case 5: set .@mast$,"LUK"; break;
  2710.             }
  2711.         // Weapon mastery has a general delay
  2712.         } else if(getarg(3) == 2)
  2713.             set .@mast$,"Weapon";
  2714.     }
  2715.     // Save or Read
  2716.     if(getarg(5) == 1) // Save new data
  2717.         setd(""+ ( (getarg(1) == 0)?"#":"")+.@mast$+"Delay"),gettimetick(2)+getarg(4);
  2718.     else if(getarg(5) == 2) // Read current data
  2719.         return getd(""+ ( (getarg(1) == 0)?"#":"")+.@mast$+"Delay");
  2720.    
  2721. // ========= Mastery ================  
  2722. } else if(getarg(0) == 2) {
  2723.    
  2724. // === Server Mode has changed === //
  2725.     if(@db_c == 1)
  2726.         // Reading data from the previous mode
  2727.         set .@sm,#db_save;
  2728.     // Copying data in the new mode
  2729.     else if(@db_c == 2)
  2730.         set .@sm,!#db_save;
  2731. // =============================== //
  2732.     // Server Mode hasn't changed
  2733.     else
  2734.         set .@sm,getvariableofnpc(.train_mode,"Mastery Trainer");
  2735.        
  2736.     // Bounding Type
  2737.     if(getarg(1) == 0)
  2738.         set .@id,getcharid(3);
  2739.     else if(getarg(1) == 1)
  2740.         set .@id,getcharid(0);
  2741.    
  2742.     if(.@sm == 1) {
  2743.         if(getarg(2) == 1)  { // Status Mastery
  2744.             switch(getarg(3)) {
  2745.                 case 0: set .@sql_t$,"str"; break;
  2746.                 case 1: set .@sql_t$,"agi"; break;
  2747.                 case 2: set .@sql_t$,"vit"; break;
  2748.                 case 3: set .@sql_t$,"int"; break;
  2749.                 case 4: set .@sql_t$,"dex"; break;
  2750.                 case 5: set .@sql_t$,"luk"; break;
  2751.             }
  2752.         } else if(getarg(2) == 2)   { // Weapon Mastery
  2753.             setarray .@sql_wn$[1],"dagger","one-sword","two-sword","one-spear","two-spear","one-axe","two-axe","mace","unused","stave","bow","knuck","music","whip","book","katar","revol","rifle","gatl","shotg","grenade","fuuma";
  2754.             set .@sql_t$,.@sql_wn$[getarg(3)];
  2755.             if(.@sql_t$ == "") {
  2756.                 debugmes .n$+": SQL Table identifing failed. Bug detected - Fix required.";
  2757.                 return -1;
  2758.             }
  2759.         }
  2760.        
  2761.         // Checking if the entry in the database even exists
  2762.         if(query_sql("SELECT `id` FROM `trainsystem` WHERE `id` = '"+.@id+"'",.@sql_res) == -1)
  2763.             query_sql "INSERT INTO `trainsystem` ( `id` ) VALUES ( '"+.@id+"' )";
  2764.        
  2765.         // Save or Read
  2766.         if(getarg(4) == 1) { // Save new data
  2767.        
  2768.             // Identifier
  2769.             if(getarg(6) == 1) // "Add"
  2770.                 query_sql "UPDATE `trainsystem` SET `"+.@sql_t$+"` = `"+.@sql_t$+"` + '"+getarg(5)+"' WHERE `id` = '"+.@id+"'";
  2771.                        
  2772.             else if(getarg(6) == 2)// "Set"
  2773.                 query_sql "UPDATE `trainsystem` SET `"+.@sql_t$+"` = '"+getarg(5)+"' WHERE `id` = '"+.@id+"'";
  2774.  
  2775.         } else if(getarg(4) == 2) {
  2776.             // Read current data
  2777.             query_sql "SELECT `"+.@sql_t$+"` FROM `trainsystem` WHERE `id` = '"+.@id+"'",.@sql_res;
  2778.             return .@sql_res;
  2779.         }
  2780.            
  2781.     } else {
  2782.    
  2783.         if(getarg(2) == 1)  // Status Mastery
  2784.             set .@mast$,"stats";
  2785.         else if(getarg(2) == 2) // Weapon Mastery
  2786.             set .@mast$,"weap";
  2787.            
  2788.         // Save or Read
  2789.         if(getarg(4) == 1)  { // Save new data
  2790.        
  2791.             // Identifier
  2792.             if(getarg(6) == 1) // "Add"
  2793.                 setarray getd("$"+.@mast$+"_"+.@id+"["+getarg(3)+"]"),getd("$"+.@mast$+"_"+.@id+"["+getarg(3)+"]") + getarg(5);
  2794.            
  2795.             else if(getarg(6) == 2)// "Set"
  2796.                 setarray getd("$"+.@mast$+"_"+.@id+"["+getarg(3)+"]"),getarg(5);
  2797.  
  2798.         } else if(getarg(4) == 2) // Read current data
  2799.             return getd("$"+.@mast$+"_"+.@id+"["+getarg(3)+"]");
  2800.     }
  2801. }
  2802. return;
  2803. }
  2804.  
  2805. new_zone04.gat,182,180,4    script  DEX Training    110,{
  2806. if(.dex_t) {
  2807.     set @d_pt,@d_pt + 1;
  2808.     set .sec,.sl-1;
  2809.     goto OnTimer1000;
  2810. }
  2811. end;
  2812.  
  2813. OnPrepare:
  2814. set .t_id,getcharid(3);
  2815. set .@st_calc,@stat/10 + ( (@stat >= 10)?"":( (@stat == 0)?"+1":"") );
  2816. set .@timer,getvariableofnpc(.dex_time,"Mastery Trainer");
  2817. set .sl,.@timer-.@st_calc; // Time till next move of NPC
  2818. pcblockmove .t_id,1; // Blocking Movement of the Character
  2819. enablenpc strnpcinfo(0);
  2820. if(.dex_coord == 0) {
  2821.     set .@co,rand(getarraysize(.x));
  2822.     set .@x_c,.x[.@co];
  2823.     set .@y_c,.y[.@co];
  2824. } else {
  2825.     set .@x_c,rand(.x[0],.x[1]);
  2826.     set .@y_c,rand(.y[0],.y[1]);
  2827. }
  2828. movenpc strnpcinfo(1),.@x_c,.@y_c;
  2829. set .npc,1; // Times the NPC has been moved
  2830. set .dex_t,1; // Training Activated
  2831. set @d_pt,0; // Reseting Points
  2832. set .sec,0;
  2833. initnpctimer;
  2834. end;
  2835.  
  2836. OnTimer1000:
  2837. set .sec,.sec + 1;
  2838. if(.sec == .sl) {
  2839.     stopnpctimer;
  2840.     if(.npc == getvariableofnpc(.dex_npc,"Mastery Trainer") ) goto OnEnd;
  2841.     if(.dex_coord == 0) {
  2842.         set .@co,rand(getarraysize(.x));
  2843.         set .@x_c,.x[.@co];
  2844.         set .@y_c,.y[.@co];
  2845.     } else {
  2846.         set .@x_c,rand(.x[0],.x[1]);
  2847.         set .@y_c,rand(.y[0],.y[1]);
  2848.     }
  2849.     movenpc strnpcinfo(1),.@x_c,.@y_c;
  2850.     set .npc,.npc + 1; // Times the NPC has been moved
  2851.     set .sec,0;
  2852.     initnpctimer;
  2853. }
  2854. end;
  2855.  
  2856. OnEnd:
  2857. if(playerattached() == 0)  // If no player is attached
  2858.     if(isloggedin(.t_id) == 1)   // Check if the character is still online
  2859.         attachrid(.t_id);
  2860.     else goto OnTrainDisable;
  2861. pcblockmove getcharid(3),0;
  2862. warp "SavePoint",0,0;
  2863. sleep2 2000; // Delay required to finish warping ;O
  2864. if(@d_pt >= getvariableofnpc(.dex_pt,"Mastery Trainer") )
  2865.     doevent "Mastery Trainer::OnComplete";
  2866. else {
  2867.     dispbottom getvariableofnpc(.n$,"Mastery Trainer")+": You have failed this training.";
  2868.     dispbottom getvariableofnpc(.n$,"Mastery Trainer")+": Your points: "+@d_pt+", required: "+getvariableofnpc(.dex_pt,"Mastery Trainer")+".";
  2869. }
  2870. OnTrainDisable:
  2871. set .dex_t,0;
  2872. disablenpc strnpcinfo(0);
  2873. end;
  2874.    
  2875. OnInit:
  2876. disablenpc strnpcinfo(0);
  2877. // Cooardinate Usage:
  2878. // 0 = Fixed, use the next two arrays for this.
  2879. // 1 = Area, use the two arrays below, which only holds two numbers.
  2880. set .dex_coord,0;
  2881. // Fixed single cooardinates
  2882. if(.dex_coord == 0) {
  2883.     setarray .x[0],175,172,179,185,183,186,188,183,176,181;
  2884.     setarray .y[0],180,174,173,172,176,181,187,187,172,175;
  2885. } else {
  2886. // Randomly chosen coordinates in a specified area:
  2887. // [0] = left-down corner
  2888. // [1] = right-upper corner
  2889.     setarray .x[0],171,188;
  2890.     setarray .y[0],171,189;
  2891. }
  2892. end;
  2893. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement