yuhsing

Untitled

Nov 26th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1.  
  2. /*
  3.  
  4. # Advance Breaker Room
  5. # Not yet started SQL stuffs...
  6.  
  7. DROP TABLE `ragnarok`.`E-Breakers`;
  8.  
  9. CREATE TABLE IF NOT EXISTS `E-Breakers` (
  10. `no` mediumint(9) unsigned NOT NULL auto_increment,
  11. `char_id` int(11) unsigned NOT NULL default '0',
  12. `name` varchar(30) NOT NULL DEFAULT '',
  13. `time` bigint(11) NOT NULL default '0',
  14. `mob_id` mediumint(9) unsigned NOT NULL default '0',
  15.  
  16. PRIMARY KEY ( `no` )
  17. ) ENGINE=MyISAM;
  18.  
  19. # Random Sample Data for viewing the Data in Games / SQL
  20. # =============================================================
  21. INSERT INTO `E-Breakers` ( `char_id`,`name`,`time`,`mob_id` ) VALUES ( 10000'Amistry','12411',3000 );
  22. INSERT INTO `E-Breakers` ( `char_id`,`name`,`time`,`mob_id` ) VALUES ( 20000,'Emistry1','28211',3000 );
  23. INSERT INTO `E-Breakers` ( `char_id`,`name`,`time`,`mob_id` ) VALUES ( 10000,'Amistry','32511',1899 );
  24. INSERT INTO `E-Breakers` ( `char_id`,`name`,`time`,`mob_id` ) VALUES ( 20000,'Emistry1','42161',1899 );
  25.  
  26. */
  27.  
  28.  
  29. // === MOB DB ====
  30. // 3000,EMPELIUM,Emperium,Emperium,90,700,1,0,0,1,60,73,64,50,1,17,80,50,26,20,10,12,0,8,26,0x160,300,1288,288,384,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
  31.  
  32.  
  33. sec_in02,172,162,4 script Adv Breaker Room Manager 100,{
  34. if( select( "Rent a Room","View Ladder" ) == 1 ){
  35.  
  36. if( !instance_id(1) ){
  37.  
  38. if( .Cost ){
  39. mes "it cost ^0055FF"+.Cost+" Zeny^000000 to rent a Breaker Room for "+.Minute+" Minutes.";
  40. if( select("Confirm:Cancel") == 2 ) close;
  41. }
  42.  
  43. if( !getcharid(1) || !instance_check_party( getcharid(1),1,90,150 ) ){
  44. mes "Required a Party which have at least 1 Member with at least level 90 ~ 150";
  45. close;
  46. }
  47.  
  48. set .@instance,instance_create( " Adv. Breaker Room ",getcharid(1));
  49.  
  50. if( .@instance < 0 ){
  51. switch( .@instance ){
  52. Case -2: mes "Invalid Party ID"; break;
  53. Case -3: mes "Max Instances Exceed."; break;
  54. Case -4: warpparty has_instance( "1@room" ),25,25,getcharid(1); break;
  55. Case -1:
  56. default:
  57. mes "Failed to Create an Instances.";
  58. }
  59.  
  60. }else{
  61. set Zeny,Zeny - .Cost;
  62. instance_attachmap( "1@room",.@instance );
  63. instance_set_timeout ( .Minute * 60 ),( .Timeout * 60 ),.@instance;
  64. instance_init .@instance;
  65. instance_attach .@instance;
  66. warpparty has_instance( "1@room" ),25,25,getcharid(1);
  67. donpcevent instance_npcname( "Helper#Breaker Room",instance_id() )+"::OnInstanceInit";
  68. end;
  69. }
  70.  
  71. }else{
  72. warpparty has_instance( "1@room" ),25,25,getcharid(1);
  73. }
  74.  
  75. }else{
  76. switch( select( "Own Ladder","Overall Top Breaker","^FF0000Remove Records^000000" ) ){
  77. default:
  78. Case 1:
  79. .@query_size = query_sql( "SELECT `mob_id`,`time` FROM `E-Breakers` WHERE `char_id`='"+getcharid(0)+"' GROUP BY `mob_id` ORDER BY `time` ASC LIMIT "+.size,.@MobID,.@Time );
  80.  
  81. if( !.@query_size ){
  82. mes "No Records found !";
  83. }else{
  84. mes "^0055FF[ "+strcharinfo(0)+"'s Record ]^000000";
  85. for( .@i = 0; .@i < .@query_size; .@i++ ){
  86. mes "^DDBB00"+getmonsterinfo( .@MobID[.@i],MOB_NAME )+" : ^FF0000"+( .@Time[.@i] / 1000 )+"."+( .@Time[.@i] % 1000 )+" sec^000000";
  87. }
  88. }
  89. break;
  90. Case 2:
  91. for( .@i = 0; .@i < .size; .@i++ )
  92. .@Menu$ = .@Menu$ + getmonsterinfo( .MonsterList[.@i],MOB_NAME )+":";
  93.  
  94. do{
  95. .@mob = select( .@Menu$ ) - 1;
  96.  
  97. do{
  98. .@query_size = query_sql( "SELECT `name`,`time`,`mob_id` FROM `E-Breakers` WHERE `mob_id`='"+.MonsterList[.@mob]+"' GROUP BY `name` ORDER BY `time` ASC LIMIT 10 OFFSET "+.@Offset+" ",.@Name$,.@Time,.@MobID );
  99.  
  100. mes "Monster : ^FF0000"+getmonsterinfo( .MonsterList[.@mob],MOB_NAME )+"^000000";
  101. if( !.@query_size ){
  102. mes "No extra Records found !";
  103. }else{
  104. for( .@i = 0; .@i < .@query_size; .@i++ )
  105. mes "^0055FF[ "+( .@Offset + .@i + 1 )+"th : "+.@Name$[.@i]+" ] : ^FF0000"+( .@Time[.@i] / 1000 )+"."+( .@Time[.@i] % 1000 )+"sec^000000";
  106. .@Offset += 10;
  107. }
  108. next;
  109. }while( select( ( .@query_size )?"Next 10 Rank":"","Back" ) == 1 );
  110. mes "Please choose your option...";
  111. }while( select( "View Breaker Rank","Back" ) == 1 );
  112. break;
  113. Case 3:
  114. mes "What Record you want to clear ?";
  115. if( select( "Personal Record",( getgmlevel() < .GMLevel )?"":"[ GM ] All Record" ) == 1 ){
  116. query_sql( "DELETE FROM `E-Breakers` WHERE `char_id`='"+getcharid(0)+"'" );
  117. mes "^FF0000Removed All "+strcharinfo(0)+"'s Breaker Records.^000000";
  118. }else{
  119. query_sql( "TRUNCATE `E-Breakers`" );
  120. mes "^FF0000Removed All Records.^000000";
  121. }
  122. break;
  123. }
  124.  
  125. }
  126. close;
  127.  
  128.  
  129. OnInit:
  130. // GM Level
  131. .GMLevel = 90;
  132. // Cost to Rent Room
  133. .Cost = 1000000;
  134. // Room Duration
  135. .Minute = 30;
  136. // Room Timeout
  137. .Timeout = 5;
  138.  
  139. // Edit Monster Lists
  140. setarray .MonsterList[0],3000,1899,1900,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915;
  141.  
  142. .size = getarraysize( .MonsterList );
  143. end;
  144. }
  145.  
  146.  
  147.  
  148. 1@room,32,30,4 script Helper#Breaker Room 100,{
  149. if( !instance_id(1) ) end;
  150.  
  151. .@mobcount = mobcount( "1@room",instance_npcname( "Helper#Breaker Room",instance_id(1) )+"::OnMyMobDead" );
  152.  
  153. switch( select( "^0055FFHeal^000000",
  154. ( getcharid(0) != getpartyleader( getcharid(1),2 ) )? "":( .@mobcount )? "Remove Monster":"Summon Monster",
  155. "Go out",
  156. ( getcharid(0) == getpartyleader( getcharid(1),2 ) )?"^FF0000Terminate Room^000000":"" )){
  157. default:
  158. Case 1:
  159. percentheal 100,100;
  160. skilleffect 28,MaxHP;
  161. specialeffect2 313;
  162. break;
  163. Case 2:
  164. if( .@mobcount ){
  165. stopnpctimer;
  166. npctalk "All monster has been removed by Party Leader.";
  167. killmonsterall "1@room";
  168. close;
  169. }else{
  170. mes "Please select a Monster...";
  171. 'selected = getelementofarray( getvariableofnpc( .MonsterList, "Adv Breaker Room Manager" ),( select( 'Menu$ ) - 1 ) );
  172. close2;
  173. monster "1@room",-1,-1,"--ja--",'selected,1,instance_npcname("Helper#Breaker Room", instance_id())+"::OnMyMobDead";
  174. initnpctimer;
  175. end;
  176. }
  177. break;
  178. Case 3:
  179. warp "SavePoint",0,0;
  180. dispbottom "You may enter this Room anytime as long as it's not terminated or timeout";
  181. break;
  182. Case 4:
  183. mes "Are you sure ?";
  184. mes "If you terminate this Room, you will never able to come in again.";
  185. if( select("Confirm:Cancel") == 1 ){
  186. instance_destroy instance_id(1);
  187. }
  188. break;
  189. }
  190. close;
  191.  
  192. OnInstanceInit:
  193. 'Menu$ = "";
  194. for( .@i = 0; .@i < getvariableofnpc( .size,"Adv Breaker Room Manager" ); .@i++ )
  195. 'Menu$ = 'Menu$ +getmonsterinfo( getelementofarray( getvariableofnpc( .MonsterList, "Adv Breaker Room Manager" ),.@i ),0 ) +":";
  196.  
  197. sleep 2000;
  198. npctalk "Please get yourself ready...";
  199. instance_announce 0,"Welcome to Adv. Breaker Room",0;
  200. sleep 3000;
  201. npctalk "Select a monster ... and Break it into pieces...and Skills are Disabled.";
  202. end;
  203.  
  204. OnMyMobDead:
  205. stopnpctimer;
  206. .@timer = getnpctimer(0);
  207. instance_announce 0,"========== [ "+getmonsterinfo( 'selected,MOB_NAME )+" ] ==========",0;
  208. instance_announce 0,"Average Damage Per Seconds : "+( getmonsterinfo( 'selected,MOB_MAXHP ) / ( .@timer / 1000 ) ),0;
  209.  
  210. instance_announce 0,"Total Time Spent : "+( .@timer / 1000 )+"."+( .@timer % 1000 )+" seconds.",0;
  211.  
  212. if( getmapusers( has_instance("1@room") ) == 1 ){
  213. emotion e_heh;
  214. mes "Not bad, i would like to save / update your record into the Database.";
  215.  
  216. query_sql(" SELECT `time` FROM `E-Breakers` WHERE `char_id`='"+getcharid(0)+"' AND `mob_id`='"+'selected+"' ORDER BY `time` ASC",.@Record );
  217. mes "Best Record : ^0055FF"+( .@Record / 1000 )+"."+( .@Record % 1000 )+" seconds^000000";
  218. mes " ";
  219. mes "Current Record : ^0055FF"+( .@timer / 1000 )+"."+( .@timer % 1000 )+" seconds^000000";
  220.  
  221. if( select("Record ^0055FF"+( .@timer / 1000 )+"."+( .@timer % 1000 )+" seconds^000000:Nope") == 1 ){
  222. query_sql( "DELETE FROM `E-Breakers` WHERE `char_id`='"+getcharid(0)+"' AND `mob_id`='"+'selected+"' AND `time` > '"+.@timer+"'" );
  223. query_sql( "INSERT INTO `E-Breakers` ( `char_id`,`name`,`time`,`mob_id` ) VALUES ( '"+getcharid(0)+"','"+strcharinfo(0)+"','"+.@timer+"','"+'selected+"' )" );
  224. }
  225. close;
  226. }else{
  227. emotion e_sry;
  228. npctalk "Not bad, but Record will not store for Grouped Team. Only for Solo Player will store the records.";
  229. }
  230. end;
  231.  
  232. }
  233.  
  234.  
  235. // ==== MAP FLAGS ====
  236. 1@room mapflag nogo
  237. 1@room mapflag nomemo
  238. 1@room mapflag nosave
  239. 1@room mapflag nobranch
  240. 1@room mapflag nowarp
  241. 1@room mapflag nobaseexp
  242. 1@room mapflag nojobexp
  243. 1@room mapflag nomobloot
  244. 1@room mapflag nomvploot
  245. 1@room mapflag nowarpto
  246. 1@room mapflag noskill
Advertisement
Add Comment
Please, Sign In to add comment