yuhsing

Untitled

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