Advertisement
Skorm

Spoilbox v2.0

May 1st, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.59 KB | None | 0 0
  1. //Spoilbox v2.0
  2. -   script  Royal_Chest -1,{
  3. end;
  4.  
  5. OnMVPKilled:
  6. getmapxy .map$, .x, .y, 0; set .a,0; set .b,0;
  7.     set .id,atoi(strnpcinfo(2));
  8.     if(getmobdrops(.mvpid[.id])) {
  9.         set .count, $@MobDrop_count;
  10.         copyarray .item[0],$@MobDrop_item[0],.count;
  11.         copyarray .rate[0],$@MobDrop_rate[0],.count;
  12.         for( set .@i,0; .@i < .count; set .@i,.@i +1 ) {
  13.             if(((.rate[.@i]/100)*.srate)>100){
  14.                 set .drops[.@b],.item[.@i]; set .droprs[.@b],((.rate[.@i]/100)*.srate); set .@b,.@b+1;
  15.             } else if(.rate[.@i]*.srate>99){
  16.                 if(!rand((100/((.rate[.@i]/100)*.srate))-1)){ set .drops[.@b],.item[.@i]; set .droprs[.@b],((.rate[.@i]/100)*.srate); set .@b,.@b+1; }
  17.             } else if(.rate[.@i]*.scardrate<99){
  18.                 if(!(rand((100/((.rate[.@i]*.scardrate)%100))*100)-1)){ set .drops[.@b],.item[.@i]; set .droprs[.@b],((.rate[.@i]/100)*.scardrate); set .@b,.@b+1; }
  19.             }
  20.         }
  21.     } else { end; }
  22.     if(strcharinfo(1)==""){ goto Alone; }
  23.     deletearray $@partymemberaid[0],128;
  24.     getpartymember getcharid(1),1;
  25.     getpartymember getcharid(1),2;
  26.     set .@count, $@partymembercount; set .count,0;
  27.     copyarray .@party[0],$@partymemberaid[0],.@count;
  28.     copyarray .@cparty[0],$@partymembercid[0],.@count;
  29.     for( set .@i,0; .@i < .@count; set .@i,.@i +1 ) {
  30.         getmapxy(.@map$,.@x,.@y,0,rid2name(.@party[.@i]));
  31.         if(.@map$==strcharinfo(3)) set .@p,.@p+1;
  32.        
  33.     }
  34.     if(.@p<2){ goto Alone; }
  35.     for ( set .@i, 0; .@i < .@count; set .@i, .@i +1 ){
  36.         if(isloggedin(.@party[.@i],.@cparty[.@i])){
  37.             set .party[.count],.@party[.@i];
  38.             set .count, .count +1 ;
  39.         }
  40.     }
  41.     if(.count<2) { goto Alone; }
  42.     movenpc strnpcinfo(0), .x, .y;
  43.     restart:
  44.     setnpctimer 0; attachnpctimer(strcharinfo(0)); startnpctimer;
  45.     set .loop, .tlimit;
  46.     while ( .loop ) {
  47.         delwaitingroom strnpcinfo(0);
  48.         waitingroom callfunc("timeleft__", .loop ), 0;
  49.         set .loop, .loop -1;
  50.         sleep2 1000;
  51.     }
  52.     if(.a<.count){
  53.         set .a,.a+1;
  54.         npctalk strcharinfo(0)+" has taken to long!";
  55.         getmapxy .@map$, .@x, .@y, 0;
  56.         warp .@map$,.@x,.@y;
  57.         while(.b<getarraysize(.drops)){
  58.             setd ".partyroll"+.b+"["+.a+"]",0;
  59.             set .b,.b+1;
  60.         }
  61.         goto restart;
  62.     }
  63.     end;
  64.    
  65.     OnTimer1000:
  66.         while(.a<.count){
  67.             detachrid; attachrid(.party[.a]);
  68.             set .b,0;
  69.             mes "[^0000FFRoyal Chest^000000]"; mes "Select from the menu below to distribute the item.";
  70.             while(.b<getarraysize(.drops)){
  71.                 if((playerattached())&&strcharinfo(3)==.map$) {
  72.                     L_lo: if(.droprs[.b]>.ratelimit&&.ratelimit>0) { setd ".partyroll"+.b+"["+.a+"]",0; }
  73.                     else { select("============(^0000FF"+getitemname(.drops[.b])+"^000000)===============:-Roll:-Pass"); if(!((@menu)-1)||@menu>3) goto L_lo;
  74.                     if(@menu==2){ setd ".partyroll"+.b+"["+.a+"]",rand(100); npctalk strcharinfo(0)+" rolled a ["+getd(".partyroll"+.b+"["+.a+"]")+"] on "+getitemname(.drops[.b])+"."; dispbottom "You rolled a ["+getd(".partyroll"+.b+"["+.a+"]")+"] on "+getitemname(.drops[.b])+"."; } else { setd ".partyroll"+.b+"["+.a+"]",0; npctalk strcharinfo(0)+" passed a on "+getitemname(.drops[.b])+"."; dispbottom "You passed a on "+getitemname(.drops[.b])+"."; } }
  75.                     set .loop, 60;
  76.                 }
  77.                 set .b,.b+1;
  78.                 if(.b>=getarraysize(.drops)) close2;
  79.             }
  80.             set .a,.a+1;
  81.         }
  82.    
  83.     //Find Highest Bawler.
  84.     for (set .@i,0; .@i < getarraysize(.party); set .@i,.@i+1){
  85.         for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  86.             if(getd(".partyroll"+.@s+"["+.@i+"]")>getd(".wpartyroll"+.@s)) { setd ".wpartyroll"+.@s,getd(".partyroll"+.@s+"["+.@i+"]"); setd ".wrid"+.@s,.party[.@i];  }
  87.         }
  88.     }
  89.    
  90.     //Distribute Prize.
  91.     for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  92.         detachrid; attachrid(getd(".wrid"+.@s));
  93.         if(getd(".wpartyroll"+.@s)){
  94.             npctalk strcharinfo(0)+" won ["+getitemname(.drops[.@s])+"].";
  95.             getitem .drops[.@s],1;
  96.         } else { makeitem .drops[.@s],1,.map$,.x,.y; }
  97.     }
  98.    
  99.     stopnpctimer;
  100.     delwaitingroom strnpcinfo(0);
  101.     movenpc strnpcinfo(0), 0,0;
  102.     end;
  103.    
  104. Alone:
  105.     for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  106.         getitem .drops[.@s],1;
  107.     }
  108.     delwaitingroom strnpcinfo(0);
  109.     movenpc strnpcinfo(0), 0,0;
  110.     end;
  111.    
  112. OnInit:
  113.     if ( strnpcinfo(2) == "" ) {
  114.         //=-=-=-=-=-=Configuration=-=-=-=-=-=-=
  115.         setarray .mvpid[1], 1871,1872,1719,1492,1147,1688,1583,2068,2156,2087,2165,1623,1389,1046,1272,1115,1046,1147,1272,1418,1157,2202,1685,1734,1658,1630,1038,1511,1885,1751,1150,1039,1086,1768,1832,1112,1312,1251,2131,1087,1190,1252,1059,1159,1917,1115,1785,1785,1785,1785,1613; // MVP ids make sure each id corresponds to the duplicated npcs and maps.
  116.         set .srate,getbattleflag("item_rate_mvp"); // MVP Server Drop rates
  117.         set .scardrate,getbattleflag("item_rate_card_boss"); // MVP Server card rate
  118.         set .tlimit,60; // In seconds
  119.         set .ratelimit,0; // Ignores items dropped with rates higher then this value. 0 = off
  120.         //=-=-=-=-=-=-=Skorm=-=-=-=-=-=-=-=-=-=
  121.     }
  122.     setmapflag strnpcinfo(4),mf_nomvploot;
  123.     end;
  124. }
  125.  
  126. prt_fild08,50,50,1,1    monster Metaling    1613,1,360000,360000,"Royal Chest#51_mvp::OnMVPKilled"
  127.    
  128. prt_fild08,0,0,0    duplicate(Royal_Chest)  Royal Chest#51_mvp  801
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement