Advertisement
Skorm

Spoilbox v2.1

May 1st, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.74 KB | None | 0 0
  1. //Spoilbox v2.1
  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.         for (set .@i,0; .@i < getarraysize(.party); set .@i,.@i+1){
  56.             detachrid; attachrid(.party[.@i]);
  57.             getmapxy .@map$, .@x, .@y, 0;
  58.             warp .@map$,.@x,.@y;
  59.         }
  60.         while(.b<getarraysize(.drops)){
  61.             setd ".partyroll"+.b+"["+.a+"]",0;
  62.             set .b,.b+1;
  63.         }
  64.         goto restart;
  65.     }
  66.     end;
  67.    
  68.     OnTimer1000:
  69.         while(.a<.count){
  70.             detachrid; attachrid(.party[.a]);
  71.             set .b,0;
  72.             mes "[^0000FFRoyal Chest^000000]"; mes "Select from the menu below to distribute the item.";
  73.             while(.b<getarraysize(.drops)){
  74.                 if((playerattached())&&strcharinfo(3)==.map$) {
  75.                     L_lo: if(.droprs[.b]>.ratelimit&&.ratelimit>0) { setd ".partyroll"+.b+"["+.a+"]",0; }
  76.                     else { select("============(^0000FF"+getitemname(.drops[.b])+"^000000)===============:-Roll:-Pass"); if(!((@menu)-1)||@menu>3) goto L_lo;
  77.                     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])+"."; } }
  78.                     set .loop, 60;
  79.                 }
  80.                 set .b,.b+1;
  81.                 if(.b>=getarraysize(.drops)) close2;
  82.             }
  83.             set .a,.a+1;
  84.         }
  85.    
  86.     //Find Highest Bawler.
  87.     for (set .@i,0; .@i < getarraysize(.party); set .@i,.@i+1){
  88.         for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  89.             if(getd(".partyroll"+.@s+"["+.@i+"]")>getd(".wpartyroll"+.@s)) { setd ".wpartyroll"+.@s,getd(".partyroll"+.@s+"["+.@i+"]"); setd ".wrid"+.@s,.party[.@i];  }
  90.         }
  91.     }
  92.    
  93.     //Distribute Prize.
  94.     for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  95.         detachrid; attachrid(getd(".wrid"+.@s));
  96.         if(getd(".wpartyroll"+.@s)){
  97.             npctalk strcharinfo(0)+" won ["+getitemname(.drops[.@s])+"].";
  98.             getitem .drops[.@s],1;
  99.         } else { makeitem .drops[.@s],1,.map$,.x,.y; }
  100.     }
  101.    
  102.     stopnpctimer;
  103.     delwaitingroom strnpcinfo(0);
  104.     movenpc strnpcinfo(0), 0,0;
  105.     end;
  106.    
  107. Alone:
  108.     for(set .@s,0; .@s < getarraysize(.drops); set .@s,.@s+1){
  109.         getitem .drops[.@s],1;
  110.     }
  111.     delwaitingroom strnpcinfo(0);
  112.     movenpc strnpcinfo(0), 0,0;
  113.     end;
  114.    
  115. OnInit:
  116.     if ( strnpcinfo(2) == "" ) {
  117.         //=-=-=-=-=-=Configuration=-=-=-=-=-=-=
  118.         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.
  119.         set .srate,(getbattleflag("item_rate_common")/10000); // MVP Server Drop rates
  120.         set .scardrate,(getbattleflag("item_rate_card_boss")/10000); // MVP Server card rate
  121.         set .tlimit,60; // In seconds
  122.         set .ratelimit,0; // Ignores items dropped with rates higher then this value. 0 = off
  123.         //=-=-=-=-=-=-=Skorm=-=-=-=-=-=-=-=-=-=
  124.     }
  125.     setmapflag strnpcinfo(4),mf_nomvploot;
  126.     end;
  127. }
  128.  
  129. prt_fild08,50,50,1,1    monster Metaling    1613,1,360000,360000,"Royal Chest#51_mvp::OnMVPKilled"
  130.    
  131. prt_fild08,0,0,0    duplicate(Royal_Chest)  Royal Chest#51_mvp  801
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement