yuhsing

Untitled

Apr 3rd, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.33 KB | None | 0 0
  1.  
  2.  
  3. function script ValueConvert {
  4. set .@num, atoi(""+getarg(0));
  5. if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
  6. set .@l, getstrlen(""+.@num);
  7. for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
  8. set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
  9. if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
  10. }
  11. return .@num$;
  12. }
  13.  
  14.  
  15. prontera,155,181,5 script Party vs Party#myro 118,{
  16. // umbala,148,163,5 script Party vs Party#myro 118,{
  17. set .@gmlevel,getgmlevel();
  18. set .@partyid,getcharid(1);
  19.  
  20. callsub display_event_info;
  21. next;
  22. switch( select( ( .status == 1 )?"Register":( .status == 2 )?"Join / Quit Match":"",
  23. ( .@gmlevel < .gm_level || .status )?"":"Configurations",
  24. ( .@gmlevel < .gm_level || !.status )?"":"Stop Event" ) ){
  25.  
  26. Case 1:
  27. if( getcharid(0) != getpartyleader( .@partyid,2 ) ){
  28. mes "Only Party Leader can register.";
  29. }else if( .@partyid == .team[0] ){
  30. if( !.team[1] ){
  31. if( select("Quit Match","Cancel") == 1 ){
  32. set .team[0],0;
  33. set .status,1;
  34. stopnpctimer;
  35. if( $match_amount && $match_itemid ){
  36. message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+".";
  37. getitem $match_itemid,$match_amount;
  38. }
  39. if( $zeny ){
  40. message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $zeny )+" Zeny.";
  41. set Zeny,Zeny + $zeny;
  42. }
  43. }
  44.  
  45. }else{
  46. mes "Cant quit since team 2 already joined.";
  47. }
  48. close;
  49. }else{
  50.  
  51. set .@count,callsub( count_party_member,.@partyid );
  52. if( .@count != $party_member ){
  53. mes "Please make a party of ^FF0000"+$party_member+" online members^000000.";
  54. mes " ";
  55. mes "You have "+.@count+" members online now.";
  56.  
  57. }else{
  58.  
  59. if( $match_itemid )
  60. if( countitem( $match_itemid ) < $match_amount ){
  61. mes "You need "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid );
  62. close;
  63. }
  64.  
  65. if( $zeny )
  66. if( Zeny < $zeny ){
  67. mes "You need "+callfunc( "ValueConvert", $zeny )+" Zeny";
  68. close;
  69. }
  70.  
  71. if( $match_itemid ){
  72. set .@amount,$match_amount;
  73. message strcharinfo(0),"Paid "+callfunc( "ValueConvert", .@amount )+" x "+getitemname( $match_itemid )+".";
  74. delitem $match_itemid,.@amount;
  75. }
  76.  
  77. if( $zeny ){
  78. message strcharinfo(0),"Total of "+callfunc( "ValueConvert", $zeny )+" Zeny deducted.";
  79. set Zeny,Zeny - $zeny;
  80. }
  81.  
  82. switch( .status ){
  83. Case 1:
  84. mes "You may decide the map now.";
  85. set .map,select( .map_name_menu$ ) - 1;
  86. mes "Your team has been registered.";
  87. set .team[0],.@partyid;
  88. set .status,2;
  89. set .minute,0;
  90. initnpctimer;
  91. break;
  92. Case 2:
  93. mes "Your team has joined the match.";
  94. set .team[1],.@partyid;
  95. set .status,3;
  96. stopnpctimer;
  97. close2;
  98. donpcevent strnpcinfo(0)+"::OnEventStart";
  99. end;
  100. break;
  101. default:
  102. mes "Registration closed.";
  103. close;
  104. }
  105. }
  106. }
  107. break;
  108. Case 2:
  109. while( 1 ){
  110.  
  111. callsub display_event_info;
  112. next;
  113. switch( select( "Edit Party Member","Required Item","Required Zeny","^FF0000Start Event^000000" ) ){
  114. Case 1:
  115. mes "Enter the Amount of Party Member required.";
  116. mes "^777777( 0 ~ 10 )^000000";
  117. input $party_member,0,10;
  118. break;
  119. Case 2:
  120. mes "Enter item ID :";
  121. do{
  122. input .@input;
  123. }while( getitemname( .@input ) == "null" );
  124. mes "Enter Amount : "+getitemname( .@input );
  125. mes "^777777( 0 ~ "+callfunc( "ValueConvert", 30000 )+" )^000000";
  126. input $match_amount,0,30000;
  127. if( $match_amount ) set $match_itemid,.@input;
  128. break;
  129. Case 3:
  130. mes "Enter Zeny amount :";
  131. mes "^777777( 0 ~ "+callfunc( "ValueConvert", 10000000 )+" )^000000";
  132. input $zeny,0,10000000;
  133. break;
  134. Case 4:
  135. if( $party_member < 1 ){
  136. mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
  137. }else if( !$match_amount && !$zeny ){
  138. mes "^FF0000Invalid^000000. Required 1 item or Zeny.";
  139. }else{
  140. mes "Event started.";
  141. // announce "An Event has been started by GM, registration are now opened.",0;
  142. mapannounce "umbala","MAP ANNOUNCE: Party vs. Party event has been started by a GM, registrations are now opened.",0;
  143. mapannounce "guild_vs2-2","An Event has been started by GM, registration are now opened.",0;
  144. set .status,1;
  145. close;
  146. }
  147. break;
  148. }
  149. next;
  150. }
  151. break;
  152. Case 3:
  153. mes "Event Cancelled";
  154. close2;
  155. // announce "Event has been cancelled by GM.",0;
  156. mapannounce "umbala","MAP ANNOUNCE: The Event has been cancelled by a GM.",0;
  157. mapannounce "guild_vs2-2","Event has been cancelled by GM.",0;
  158. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  159. callsub( clear_variable );
  160. end;
  161. default: break;
  162. }
  163. close;
  164.  
  165.  
  166.  
  167. OnInit:
  168. // Minimum GM Level to access cp.
  169. set .gm_level,80;
  170. // Map Name List
  171. setarray .map_name$,"guild_vs1-3","guild_vs2-2";
  172. setarray .map_list$,"guild_vs1-3","guild_vs2-2";
  173. // Team Base Location
  174. // setarray .team_xy,<x1>,<x2>,<y1>,<y2>;
  175. // x1 + y1 = Team 1
  176. // x2 + y2 = Team 2
  177. setarray .team_xy_map1,44,54,49,50;
  178. setarray .team_xy_map2,44,54,49,50;
  179. // map flag initialize
  180. set .map_size,getarraysize( .map_list$ );
  181. for( set .@i,0; .@i < .map_size; set .@i,.@i + 1 ){
  182. set .map_name_menu$,.map_name_menu$ + .map_name$[.@i] +":";
  183. setmapflag .map_list$[.@i],mf_partylock;
  184. setmapflag .map_list$[.@i],mf_nogo;
  185. setmapflag .map_list$[.@i],mf_pvp;
  186. setmapflag .map_list$[.@i],mf_battleground,2;
  187. bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
  188. }
  189.  
  190. // npc locations
  191. getmapxy( .npc_map$,.npc_x,.npc_y,1 );
  192. if( $party_member && ( $match_amount || $zeny ) && !.status ) set .status,1;
  193. end;
  194.  
  195. display_event_info:
  196. mes "^FF0000[ PARTY MATCH EVENT ]^000000";
  197. mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
  198. if( .status || getgmlevel() >= .gm_level ){
  199. mes "Party Member : ^777777"+$party_member+"^000000";
  200. if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
  201. }
  202. mes " ";
  203. if( $match_amount ) mes "Required Item : ^777777"+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+"^000000";
  204. if( $zeny ) mes "Required Zeny : ^777777"+callfunc( "ValueConvert", $zeny )+" Zeny^000000";
  205. if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
  206. return;
  207.  
  208. count_party_member:
  209. set .@getarg,getarg(0);
  210.  
  211. getpartymember .@getarg,1;
  212. getpartymember .@getarg,2;
  213. for( set .@i,0; .@i < $@partymembercount; set .@i,.@i + 1 )
  214. if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
  215. set .@count,.@count + 1;
  216.  
  217. return .@count;
  218.  
  219. clear_variable:
  220. set .minute,0;
  221. set .status,0;
  222. deletearray .team;
  223. deletearray .score;
  224. end;
  225.  
  226. OnTimer60000:
  227. set .minute,.minute + 1;
  228. if( .minute < 15 ){
  229. // announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
  230. mapannounce "umbala","[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
  231. initnpctimer;
  232. }else{
  233. stopnpctimer;
  234. // announce "Event Cancelled, 2 Teams failed to register.",0;
  235. mapannounce "umbala","MAP ANNOUNCE: Event Cancelled, 2 Teams failed to register.",0;
  236. mapannounce "guild_vs2-2","Event Cancelled, 2 Teams failed to register.",0;
  237. callsub clear_variable;
  238. }
  239. end;
  240.  
  241. OnEventStart:
  242. // announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
  243. mapannounce "umbala","Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
  244. sleep 55000;
  245.  
  246. for( set .@i,5; .@i; set .@i,.@i - 1 ){
  247. // announce " ::: Warp within "+.@i+" seconds ::: ",0;
  248. mapannounce "umbala","MAP ANNOUNCE: ::: Warp within "+.@i+" seconds ::: ",0;
  249. mapannounce "guild_vs2-2"," ::: Warp within "+.@i+" seconds ::: ",0;
  250. sleep 1000;
  251. }
  252.  
  253. // re-count for party members..
  254. set .@count[0],callsub( count_party_member,.team[0] );
  255. set .@count[1],callsub( count_party_member,.team[1] );
  256.  
  257. // check party.
  258. if( .@count[0] != $party_member || .@count[1] != $party_member ){
  259. // announce "Event stopped, one of the registered team doesnt meet the requirements of "+$party_member+" members.",0;
  260. mapannounce "umbala","Event stopped, one of the registered teams did not meet the requirements of "+$party_member+" members.",0;
  261. }else{
  262. // announce "Event Start now......",0;
  263. mapannounce "umbala","MAP ANNOUNCE: Event Starts now......",0;
  264. mapannounce "guild_vs2-2","Event Start now......",0;
  265.  
  266. for( set .@i,0; .@i < 2; set .@i,.@i + 1 ){
  267. attachrid getpartyleader( .team[.@i],1 );
  268. warpparty .map_list$[.map],getd( ".team_xy_map"+( .map + 1 )+"["+.@i+"]" ),getd( ".team_xy_map"+( .map + 1 )+"["+( .@i + 2 )+"]" ),.team[.@i];
  269. detachrid;
  270. }
  271.  
  272. deletearray .score;
  273. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  274.  
  275. sleep 5000;
  276. mapannounce .map_list$[.map],"Kill all opponents within 15 minutes to win.",0;
  277.  
  278. sleep ( 10 * 60000 );
  279.  
  280. // check and set winner
  281. if( .score[0] > .score[1] ) set .winner,.team[0];
  282. else if( .score[0] < .score[1] ) set .winner,.team[1];
  283. else if( .score[0] == .score[1] ) set .winner,0;
  284.  
  285.  
  286. // if got winner
  287. if( .winner ){
  288. mapannounce .map_list$[.map],"WINNING PARTY : [ "+getpartyname( .winner )+" ] : Match has ended.",0;
  289.  
  290. set .@party_leader,getpartyleader( .winner,1 );
  291. if( attachrid( .@party_leader ) ){
  292. if( $zeny ){
  293. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $zeny )+" Zeny",bc_blue;
  294. set Zeny,Zeny + ( $zeny * 2 );
  295. }
  296. if( $match_amount ){
  297. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid ),bc_blue;
  298. getitem $match_itemid,( $match_amount * 2 ),.@party_leader;
  299. }
  300. detachrid;
  301.  
  302. }else{
  303. mapannounce .map_list$[.map],"Failed to claim rewards because Party Leader not found / offline.",0;
  304. }
  305.  
  306. // draw game
  307. }else{
  308. mapannounce .map_list$[.map],"This Game is a DRAW !!!",0;
  309. }
  310.  
  311. // clear map users.
  312. sleep 3500;
  313. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  314. }
  315. callsub( clear_variable );
  316.  
  317. // OnMinute00:
  318. if( $party_member && ( $match_amount || $zeny ) && !.status ){
  319. // announce "Registration are now opened.",0;
  320. mapannounce "umbala","Registrations are now opened.",0;
  321. set .status,1;
  322. }
  323. end;
  324.  
  325. OnPCKillEvent:
  326. if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
  327. set .@team,( ( getcharid(1) == .team[0] )? 0:1 );
  328. mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;
  329.  
  330. set .score[ .@team ],.score[ .@team ] + 1;
  331. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  332.  
  333. if( attachrid( killedrid ) ){
  334. sleep2 1000;
  335. atcommand "@alive";
  336. warp "Save",0,0;
  337. detachrid;
  338. }
  339.  
  340. if( .score[0] >= $party_member || !.score[1] >= $party_member )
  341. awake strnpcinfo(0);
  342. }
  343. end;
  344. }
Advertisement
Add Comment
Please, Sign In to add comment