Advertisement
Skorm

MVP Spawner

Apr 14th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.01 KB | None | 0 0
  1. prontera,96,96,2    script  MVP Spawner 66,{
  2. if(getgmlevel()<.gmlevel) end;
  3. set .@MVPID,-3;
  4. L_Menu:
  5.     mes .NPC$;
  6.     mes "Select an option from the menu below and click [^0000FFSummon!^000000] when you're done.";
  7.     next;
  8.     if(.@MVPID==-3){ set .@tmp$,"Random MVP"; } else { set .@tmp$,getmonsterinfo(.@MVPID,0); }
  9.     Switch(select("MonsterID(^0000FF"+.@tmp$+"^000000):MapName(^0000FF"+.@MAPNAME$+"^000000):Amount(^0000FF"+.@AMOUNT+"^000000):AddItems(^0000FF"+.@tmp2$+"^000000):[^0000FFSummon!^000000]")){
  10.         case 1:
  11.             mes .NPC$;
  12.             mes "Input the id of the monster you'd like to spawn.";
  13.             next;
  14.             input(.@MVPID);
  15.             while(!query_sql("(SELECT `ID` from `mob_db` where `ID` = "+.@MVPID+") UNION ALL (SELECT `ID` from `mob_db2` where `ID` = "+.@MVPID+" LIMIT 1);",.@a)){
  16.                 input(.@MVPID);
  17.             } goto L_Menu;
  18.         case 2:
  19.             mes .NPC$;
  20.             mes "Input the name of the map you'd like to spawn the monster on.";
  21.             next;
  22.             input(.@MAPNAME$);
  23.             while(mobcount(.@MAPNAME$,"all")==-1){
  24.                 input(.@MAPNAME$);
  25.                 if(mobcount(.@MAPNAME$,"all")!=-1){
  26.                     mes .NPC$;
  27.                     mes "Would you like to spawn "+(.@MVPID==-3?"Random MVPs":getmonsterinfo(.@MVPID,0))+" on the map "+.@MAPNAME$+"?";
  28.                     next;
  29.                     if(select("Yes:No")-1) { set .@MAPNAME$,""; continue; } else { break; }
  30.                 }
  31.             } goto L_Menu;
  32.         case 3:
  33.             mes .NPC$;
  34.             mes "Input the amount you'd like to spawn.";
  35.             mes "(Maximum "+.Lamount+")";
  36.             next;
  37.             input(.@AMOUNT);
  38.             while(.@AMOUNT<=0||.@AMOUNT>.Lamount){
  39.                 input(.@AMOUNT);
  40.                 if(.@AMOUNT>0&&.@AMOUNT<=.Lamount){
  41.                     mes .NPC$;
  42.                     mes "Would you like to spawn "+.@AMOUNT+" monsters?";
  43.                     next;
  44.                     if(select("Yes:No")-1) { set .@AMOUNT,0; continue; } else { break; }
  45.                 }
  46.             } goto L_Menu;
  47.         case 4: L_Main:
  48.             set .@menu$,"";
  49.             for(set .@b,1; .@b <= 5; set .@b,.@b + 1) {
  50.                 set .@menu$, .@menu$ + "( " + .@b + ") " + getd("slistn"+.@b+"$") + ":";
  51.             } set .@menu$,.@menu$+":Back";
  52.             select .@menu$;
  53.             if(@menu>5) goto L_Menu;
  54.             if(getd("slistn"+@menu+"$")==""){ mes "What would you like to call this list?"; input(@name$); setd "slistn"+@menu+"$",@name$; }
  55.             set .@m,@menu;
  56.             for(set .@b,1; .@b <= 10; set .@b,.@b + 1) {
  57.                 setarray .@foobar[.@b],getd(.@m+"sitemid"+.@b);
  58.                 setarray .@foobarq[.@b],getd(.@m+"sitemq"+.@b);
  59.                 setarray .@foobarr[.@b],getd(.@m+"sitemr"+.@b);
  60.             }
  61.             L_list:
  62.             set .@menu$,"";
  63.             mes "Select to edit the list.";
  64.             for(set .@b,1; .@b <= 10; set .@b,.@b + 1) {
  65.                 set .@menu$, .@menu$ + "( " + .@b + ") " + ((getitemname(.@foobar[.@b])!="null")? getitemname(.@foobar[.@b])+ " x" + .@foobarq[.@b]+"-"+.@foobarr[.@b]+"%":"Empty!") + ":";
  66.             }
  67.             set .@menu$, .@menu$ + "Save:Rename:Pick:Delete:Back";
  68.             select(.@menu$);
  69.             if(@menu<=10){
  70.                 mes "Item ID"; input(@itemid); mes "Item Quantity"; input(@itemq); mes "Item Rate"; mes "(1=1% | 100=100%)"; set @itemr,0; while(@itemr<1||@itemr>100){input(@itemr);}
  71.                 setarray .@foobar[@menu],@itemid;
  72.                 setarray .@foobarq[@menu],@itemq;
  73.                 setarray .@foobarr[@menu],@itemr;
  74.                 next;
  75.                 goto L_list;
  76.             }
  77.             if(@menu==11){
  78.                 for(set .@b,1; .@b <= 10; set .@b,.@b + 1) {
  79.                     if(.@foobar[.@b]) setd .@m + "sitemid" + .@b, .@foobar[.@b];
  80.                     if(.@foobarq[.@b]) setd .@m + "sitemq" + .@b, .@foobarq[.@b];
  81.                     if(.@foobarr[.@b]) setd .@m + "sitemr" + .@b, .@foobarr[.@b];
  82.                 }
  83.                 next;
  84.                 goto L_list;
  85.             }
  86.             if(@menu==12){
  87.                 mes "Please input a new name.";
  88.                 input(@newn$);
  89.                 setd "slistn"+.@m+"$",@newn$;
  90.                 next;
  91.                 goto L_Main;
  92.             }
  93.             if(@menu==13){
  94.                 if(.@MAPNAME$==""){ set .@MAPNAME$,.defaultm$; }
  95.                 if(getd("."+.@MAPNAME$+"dl[1]")){
  96.                     deletearray getd("."+.@MAPNAME$+"dl[1]"),128;
  97.                     deletearray getd("."+.@MAPNAME$+"dq[1]"),128;
  98.                     deletearray getd("."+.@MAPNAME$+"dr[1]"),128;
  99.                 }
  100.                 for(set .@b,1; .@b <= 10; set .@b,.@b + 1) {
  101.                     if(.@foobar[.@b]) setd "."+.@MAPNAME$+"dl["+.@b+"]", .@foobar[.@b];
  102.                     if(.@foobarq[.@b]) setd "."+.@MAPNAME$+"dq["+.@b+"]", .@foobarq[.@b];
  103.                     if(.@foobarr[.@b]) setd "."+.@MAPNAME$+"dr["+.@b+"]", .@foobarr[.@b];
  104.                 }
  105.                 set .@tmp2$,getd("slistn"+.@m+"$");
  106.                 mes "Set as drop list.";
  107.                 next;
  108.                 goto L_Menu;
  109.             }
  110.             if(@menu==14){
  111.                 setd "slistn"+.@m+"$","";
  112.                 for(set .@b,1; .@b <= 10; set .@b,.@b + 1) {
  113.                     if(.@foobar[.@b]) setd .@m + "sitemid" + .@b, 0;
  114.                     if(.@foobarq[.@b]) setd .@m + "sitemq" + .@b, 0;
  115.                     if(.@foobarr[.@b]) setd .@m + "sitemr" + .@b, 0;
  116.                 }
  117.                 mes "List deleted!.";
  118.                 next;
  119.                 goto L_Menu;
  120.             }
  121.             if(@menu>=15){
  122.                 next;
  123.                 goto L_Main;
  124.             }
  125.         case 5:
  126.             if(mobcount(.@MAPNAME$,"all")==-1||.@AMOUNT<=0){
  127.                 if(!.fiesta){
  128.                     mes .NPC$;
  129.                     mes "I'm sorry you need to fillout all the fields before summoning a monster!";
  130.                     next;
  131.                     goto L_Menu;
  132.                 } else {
  133.                     if(mobcount(.@MAPNAME$,"all")==-1) set .@MAPNAME$,"this";
  134.                     if(.@AMOUNT<=0) set .@AMOUNT,.fiesta;
  135.                 }
  136.             }
  137.             if(.@tmp2$==""&&getd("."+.@MAPNAME$+"dl[1]")){
  138.                 deletearray("."+.@MAPNAME$+"dr[1]",128);
  139.                 deletearray("."+.@MAPNAME$+"dl[1]",128);
  140.                 deletearray("."+.@MAPNAME$+"dq[1]",128);
  141.             }
  142.             if(.Mamount){
  143.                 if(mobcount(.@MAPNAME$,"MVP Spawner::OnMVPDeath")+.@AMOUNT>.Mamount&&.Mamount>0){
  144.                     mes .NPC$;
  145.                     mes "I'm sorry but there can only be "+.Mamount+" MVPs in one map.";
  146.                     set .@tmp,.Mamount-mobcount(.@MAPNAME$,"MVP Spawner::OnMVPDeath");
  147.                     if(.@tmp>0){
  148.                         mes "Would you like to spawn "+.@tmp+" instead?";
  149.                         if(select("Yes:No")-1) { mes "Ok!"; close; }
  150.                         announce "GM-"+strcharinfo(0)+" summoned "+.@AMOUNT+" "+.@tmp$+"(s) in "+(.@MAPNAME$=="this"?strcharinfo(3):.@MAPNAME$)+".",bc_all,"0x"+.fontcolor$;
  151.                         monster .@MAPNAME$,0,0,"--ja--",.@MVPID,.@tmp,"MVP Spawner::OnMVPDeath";
  152.                         close;
  153.                     }
  154.                     next;
  155.                     goto L_Menu;
  156.                 }
  157.             }
  158.             announce "GM-"+strcharinfo(0)+" summoned "+.@AMOUNT+" "+.@tmp$+"(s) in "+(.@MAPNAME$=="this"?strcharinfo(3):.@MAPNAME$)+".",bc_all,"0x"+.fontcolor$;
  159.             monster .@MAPNAME$,0,0,"--ja--",.@MVPID,.@AMOUNT,"MVP Spawner::OnMVPDeath";
  160.             close;
  161.     }
  162. end;
  163. OnMVPDeath:
  164.     if(!playerattached()) { end; }
  165.     if(getarraysize(getd("."+strcharinfo(3)+"dl"))){
  166.         for(set .@b,1; .@b < getarraysize(getd("."+strcharinfo(3)+"dl")); set .@b,.@b + 1) {
  167.             if(getd("."+strcharinfo(3)+"dl["+.@b+"]")){
  168.                 if(!(rand(1,(100/getd("."+strcharinfo(3)+"dr["+.@b+"]")))-1)) { getitem getd("."+strcharinfo(3)+"dl["+.@b+"]"),getd("."+strcharinfo(3)+"dq["+.@b+"]"); }
  169.             }
  170.         }
  171.     }
  172. end;
  173. OnInit:
  174. //=-=-=-=-=-=Configuration=-=-=-=-=-=
  175. set .NPC$,"[^0000FFFrankie^000000]"; // Npc Name
  176. set .gmlevel,50; //Minimum Gm level allowed to spawn MVPS.
  177. set .fiesta,5; // If enabled will spawn that many random MVPs on the players map if no other information is provided! (Off=0) Will bypass Maximum amount!
  178. set .fontcolor$,"FFCE00"; // Hexi color text is announced in.
  179. set .Lamount,5; // Maximum amount of mvps that can be spawned at once.
  180. set .Mamount,5; // Maximum amount of mvps on one map at a time. (Off=0)
  181. set .defaultm$,"prontera"; // If map name is not given first and items are picked it will default to this map!
  182. //=-=-=-=-=-=-=-=Skorm=-=-=-=-=-=-=-=
  183. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement