Jump to content

pinyinhuo

Members
  • Posts

    54
  • Joined

  • Last visited

Posts posted by pinyinhuo

  1. 14 hours ago, Freya said:

    Hello, look at this

    Remove this 

    
    killmonsterall "quiz_01";
    announce "Event Manager: No Player win the Event, due to all participant die.",0,0x00FF00; <---- This
    mapannounce "quiz_01","Event Manager: You survive the zombie waves, talk to the Prize NPC to get the reward.",0,0x00FF00;
    enablenpc "Prize";
    end;

    or you can make it like Poring Catcher script system where they have to talk to the NPC and confirm their name and it will announce it to the server.

    Hi @Freya,

     

    Should i delete the whole line? <3

  2. Hello,

    I have a custom script made by someone else, the problem is, it says no player win due all participants died, but one was left alive and all the zombie died. can you help me fix it? that when only one remaining, it will announce that person wins and will not say no player win due to all participants died?

    prontera,145,167,5	script	Novice vs. Zombie	1015,{
    if ( BaseLevel != 1 || Class != 0){
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "You must be a level 1 Novice.";
    close;
    }
    if(Weight > 0) {
    mes "Lower your weight, Remove all your items.";
    close;
    }
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "You want to join the Event?";
    next;
    switch(select("Yes","No")) {
    case 1:
    npctalk ""+strcharinfo(0)+" has registered for the Zombie v.s. Novice.";
    sc_end SC_ALL;
    sc_start SC_DECREASEAGI,1200000,10;
    percentheal 100,100;
    sc_start SC_STRIPSHIELD,1200000,5;
    sc_start SC_STRIPWEAPON,1200000,5;
    sc_start SC_STRIPARMOR,1200000,5;
    sc_start SC_STRIPHELM,1200000,5;
    statusup2 bStr,-999;
    statusup2 bAgi,-999;
    statusup2 bVit,-999;
    statusup2 bInt,-999;
    statusup2 bDex,-999;
    statusup2 bLuk,-999;
    warp "quiz_01",42,369;
    end;
    case 2:
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "Come Again, if you want to join.";
    break;
    }
    close;
     
    OnInit:
    disablenpc "Novice vs. Zombie";
    disablenpc "Prize";
    end;
    
    OnClock1649:
    OnClock0100:
    OnClock0300:
    OnClock0500:
    OnClock0700:
    OnClock0900:
    OnClock1100:
    OnClock1300:
    OnClock1500:
    OnClock1700:
    OnClock1900:
    OnClock2100:
    OnClock2300:
    announce "Event Manager: Zombie Vs. Novice Event Registration is now Open, 1 minutes",0,0x00CCFF;
    killmonsterall "quiz_01";
    sleep 5000;
    announce "Event Manager: NPC Appeared at Prontera Town' Register Now!",0,0x00CCFF;
    enablenpc "Novice vs. Zombie";
    sleep 55000;
    announce "Event Manager: Zombie Vs. Novice Registration will be closed in 1 minute!",0,0x00CCFF;
    sleep 50000;
    mapannounce "quiz_01","Registration Closed!! in 10 seconds the Event will Start!",0,0x00CCFF;
    disablenpc "Novice vs. Zombie";
    sleep 5000;
    for( set .@a,5; .@a > 0; set .@a,.@a - 1 ){
    announce "Event Manager: Monster will spawn in ~"+.@a+"~",0,0x00CCFF;
    sleep 1000;
    }
    if(getmapusers("guild_vs5") == 1){
    mapannounce "guild_vs5","Event Manager: Event Ended 1 Participant Only..",0,0x00CCFF;
    disablenpc "Prize";
    announce "Event Manager: Event Ended 1 Participant Only",0,0x00CCFF;
    disablenpc "Novice vs. Zombie";
    sleep 1000;
    }
    for( set .@a,3; .@a > 0; set .@a,.@a - 1 ){
    monster "quiz_01",42,369,"Zombie",1015,2;
    sleep 10000;
    }
    while( getmapusers("quiz_01") > 1 ){
    mapannounce "quiz_01",getmapusers("quiz_01") +" players still alive in the Event.",0,0x00FF00;
    sleep 2000;
    }
    killmonsterall "quiz_01";
    announce "Event Manager: No Player win the Event, due to all participant die.",0,0x00FF00;
    mapannounce "quiz_01","Event Manager: You survive the zombie waves, talk to the Prize NPC to get the reward.",0,0x00FF00;
    enablenpc "Prize";
    end;
     
    OnPCDieEvent:
    getmapxy .@mapnvz$,.@xnvz,.@ynvz,0;
    if ( .@mapnvz$ == "quiz_01") {
    sleep2 100;
    warp "prontera",156,180;
    atcommand "@alive "+ strcharinfo(0);
    dispbottom "Sorry, but you were killed.";
    }
    sleep2 100;
    if (.@mapnvz$ == "sec_pri" && getmapusers("quiz_01") == 1 ) {
    killmonsterall "sec_pri";
    sc_start SC_BASILICA,30000,1;
    mapannounce "sec_pri","You have won, approach the R.F.Y.L. Banker NPC please.",0,0x00FF00;
    enablenpc "Prize";
    stopnpctimer;
    end;
    }
    end;
    }
     
    quiz_01,42,369,3	script	Prize	72,{
    if(getmapusers("quiz_01") > 1){
    npctalk "Only the last Survivor can talk with me.";
    end;
    }
    announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate "+(( Sex )? "HIM":"HER")+"!",0,0x00FF00;
    getitem 7977,1;
    warp "prontera",156,180;
    disablenpc "Prize";
    end;
    }
     
    // == Mapflags
    quiz_01	mapflag	gvg
    quiz_01	mapflag	nowarp
    quiz_01	mapflag	nowarpto
    quiz_01	mapflag	noteleport
    quiz_01	mapflag	nosave
    quiz_01	mapflag	nomemo
    quiz_01	mapflag	nobranch
    quiz_01	mapflag	pvp_noparty
    quiz_01	mapflag	nocommand	80
    //quiz_01	mapflag	restricted	5

     

  3. 2 hours ago, hakuren said:

    here ya go bro

    Thank you so much Hakuren! <3

    Well it works perfectly fine, i just need them to turn to novice aswell? which command should i put? Set Job 0?

  4.  

    Hello Everyone,

    can you help me with my custom warper where when they get warped, all their zeny and items and equipped deleted and turns them to lvl 1 novice & job lvl 1.

     

    prontera,150,192,5    script    Test   410,{
            warp "turbo_room" ,100,109;
        end;
    OnInit:
        waitingroom "Test",0;
        end;
    }

  5. 11 hours ago, Cyro said:

    there is existing ranking system in fluxcp, you can see ranking based on exp of the player too

    check it out once 

    Hello Cyro

    i was hoping to find an NPC, same with MVP Ladder/PVP Ladder. 

    but didnt manage to find it.

    does it still exist in rathena?

  6. Hi, How can i separate this shop to 3 Different shops? thanks!

     

    Quote
    //===== rAthena Script =======================================
      //= Euphy's Quest Shop
      //===== By: ==================================================
      //= Euphy
      //===== Current Version: =====================================
      //= 1.6c
      //===== Compatible With: =====================================
      //= rAthena Project
      //===== Description: =========================================
      //= A dynamic quest shop based on Lunar's, with easier config.
      //= Includes support for multiple shops & cashpoints.
      //= Item Preview script by ToastOfDoom.
      //===== Additional Comments: =================================
      //= 1.0 Initial script.
      //= 1.2 Added category support.
      //= 1.3 More options and fixes.
      //= 1.4 Added debug settings.
      //= 1.5 Replaced categories with shop IDs.
      //= 1.6 Added support for purchasing stackables.
      //= 1.6a Added support for previewing costumes and robes.
      //= 1.6b Added 'disable_items' command.
      //= 1.6c Replaced function 'A_An' with "F_InsertArticle".
      //============================================================
       
      // Shop NPCs -- supplying no argument displays entire menu.
      // callfunc "qshop"{,<shop ID>{,<shop ID>{,...}}};
      //============================================================
      prontera,164,203,6 script Quest Shop#1 998,{ callfunc "qshop"; }
       
       
      // Script Core
      //============================================================
      - script quest_shop -1,{
      function Add; function Chk; function Slot;
      OnInit:
      freeloop(1);
       
      // -----------------------------------------------------------
      // Basic shop settings.
      // -----------------------------------------------------------
       
      set .Announce,1; // Announce quest completion? (1: yes / 0: no)
      set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
      set .ShowID,0; // Show item IDs? (1: yes / 0: no)
      set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
      set .MaxStack,100; // Max number of quest items purchased at one time.
       
      // -----------------------------------------------------------
      // Points variable -- optional quest requirement.
      // setarray .Points$[0],"<variable name>","<display name>";
      // -----------------------------------------------------------
       
      setarray .Points$[0],"#CASHPOINTS","Cash Points";
       
      // -----------------------------------------------------------
      // Shop IDs -- to add shops, copy dummy data at bottom of file.
      // setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...};
      // -----------------------------------------------------------
       
      setarray .Shops$[1],"Headgears","Weapons","Other";
       
      // -----------------------------------------------------------
      // Quest items -- do NOT use a reward item more than once!
      // Add(<shop ID>,<reward ID>,<reward amount>,
      // <Zeny cost>,<point cost>,
      // <required item ID>,<required item amount>{,...});
      // -----------------------------------------------------------
       
      Add(1,5022,1,0,0,7086,1,969,10,999,40,1003,50,984,2);
      Add(1,5032,1,0,0,1059,250,2221,1,2227,1,7063,600);
      Add(1,5027,1,0,0,2252,1,1036,400,7001,50,4052,1);
      Add(1,5045,1,0,0,2252,1,1054,450,943,1200);
       
      Add(2,1224,1,0,0,7297,30,969,10,999,50,714,10);
      Add(2,1225,1,0,0,7292,30,969,10,999,50,714,10);
       
      Add(3,531,1,3,0,512,1,713,1);
      Add(3,532,1,3,0,513,1,713,1);
      Add(3,533,1,3,0,514,1,713,1);
      Add(3,534,1,3,0,515,1,713,1);
       
      // -----------------------------------------------------------
       
      freeloop(0);
      set .menu$,"";
      for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
      set .menu$, .menu$+.Shops$[.@i]+":";
      npcshopdelitem "qshop"+.@i,909;
      }
      end;
       
      OnMenu:
      set .@size, getarraysize(@i);
      if (!.@size) set @shop_index, select(.menu$);
      else if (.@size == 1) set @shop_index, @i[0];
      else {
      for(set .@j,0; .@j<.@size; set .@j,.@j+1)
      set .@menu$, .@menu$+.Shops$[@i[.@j]]+":";
      set @shop_index, @i[select(.@menu$)-1];
      }
      deletearray @i[0],getarraysize(@i);
      if (.Shops$[@shop_index] == "") {
      message strcharinfo(0),"An error has occurred.";
      end;
      }
      dispbottom "Select one item at a time.";
      callshop "qshop"+@shop_index,1;
      npcshopattach "qshop"+@shop_index;
      end;
       
      OnBuyItem:
      // .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... }
      setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]);
      copyarray .@q[3],getd(".q_"+@shop_index+"_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+@shop_index+"_"+.@q[0]));
      set .@q[2],.@q[1]*.@q[3];
      if (!.@q[2] || .@q[2] > 30000) {
      message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+".";
      end;
      }
      mes "[Quest Shop]";
      mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000";
      mes "Requirements:";
      disable_items;
      if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000";
      if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000";
      if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
      mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000";
      next;
      setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11);
      if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT)))
      set .@preview,1;
      addtimer 1000, strnpcinfo(0)+"::OnEnd";
      while(1) {
      switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
      case 1:
      if (@qe[0]) {
      mes "[Quest Shop]";
      mes "You're missing one or more quest requirements.";
      close;
      }
      if (!checkweight(.@q[0],.@q[2])) {
      mes "[Quest Shop]";
      mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
      close;
      }
      if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]);
      if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]);
      if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
      delitem .@q[.@i],.@q[.@i+1]*.@q[1];
      getitem .@q[0],.@q[2];
      if (.Announce) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):callfunc("F_InsertArticle",getitemname(.@q[0])))+"!",0;
      specialeffect2 EF_FLOWERLEAF;
      close;
      case 2:
      setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1;
      if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2];
      else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2];
      else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2];
      else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2];
      break;
      case 3:
      close;
      }
      }
       
      OnEnd:
      if (@qe[7]) {
      changelook LOOK_HEAD_BOTTOM, @qe[3];
      changelook LOOK_HEAD_TOP, @qe[4];
      changelook LOOK_HEAD_MID, @qe[5];
      changelook LOOK_ROBE, @qe[6];
      }
      deletearray @qe[0],8;
      end;
       
      function Add {
      if (getitemname(getarg(1)) == "null") {
      debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
      return;
      }
      setarray .@j[0],getarg(2),getarg(3),getarg(4);
      for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) {
      if (getitemname(getarg(.@i)) == "null") {
      debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped).";
      return;
      } else
      setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1);
      }
      copyarray getd(".q_"+getarg(0)+"_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j);
      npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
      return;
      }
       
      function Chk {
      if (getarg(0) < getarg(1)) {
      set @qe[0],1;
      return "^FF0000";
      } else
      return "^00FF00";
      }
       
      function Slot {
      set .@s$,getitemname(getarg(0));
      switch(.ShowSlot) {
      case 1: if (!getitemslots(getarg(0))) return .@s$;
      case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
      default: return .@s$;
      }
      }
      }
       
      function script qshop {
      deletearray @i[0],getarraysize(@i);
      for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
      set @i[.@i],getarg(.@i);
      doevent "quest_shop::OnMenu";
      end;
      }
       
       
      // Dummy shop data -- copy as needed.
      //============================================================
      - shop qshop1 -1,909:-1
      - shop qshop2 -1,909:-1
      - shop qshop3 -1,909:-1
      - shop qshop4 -1,909:-1
      - shop qshop5 -1,909:-1

     

  7. Hello,

    I am currently Using a Kafra points to Pods shop, is it possible i could get like the same? wherein i could change kafra pts to pods and pods to kafra pts? and also, will shout their name Globally and how much they change in the npc? thank youuuu! <3 <3 <3

     

    turbo_room,135,85,4    script    Wertern Union    563,{
        mes .NPC$;
        mes "Can exchange your " +getitemname(.ID)+ " for kafra points. Want to exchange?";
        next;
        if (select("Yes:No") - 1) close;
        mes .NPC$;
        mes "Okay how many " +getitemname(.ID)+ " will you exchange?";
        next;
        input .@amount;
        if (.@amount == 0) {
            mes .NPC$;
            mes "Cannot trade 0 amount";
            close;
        }
        mes .NPC$;
        mes "So you want to exchange " +.@amount+ "x " +getitemname(.ID);
        next;
        if (select("Yes:No") - 1) close;
        mes .NPC$;
        mes "Let me check if you have that amount of requirements";
        next;
        if (countitem(.ID) < .@amount) {
            mes .NPC$;
            mes "Seems like you put an invalid amount";
            close;
        }
        mes .NPC$;
        mes "Ohh that's nice here you go!";
        delitem .ID,.@amount;
        set #KAFRAPOINTS,#KAFRAPOINTS+1;
        dispbottom "You now have " +#KAFRAPOINTS+ " kafra credit points";
        next;
        mes .NPC$;
        mes "Success trading";
        close;
        
        OnInit:
            set .NPC$,"[ " +strnpcinfo(1)+ " ]"; // NPC Name
            set .ID,7179; // Requirement
            end;
    }

     

     

  8. Hello,
    
    I used Euphy and Emistry's shop, i find them complicated for me. as some people can use the shop and buy stuffs w/o pods/tcgs, i really cant help seeing buggers buying stuffs. =(  instead i use this, the problem is, my character moves even im already inside the shop and also i want to use an specific currency/badges to buy in the shop, that i can easily put more shop but different items in it. please help me guys!!!
    
    
    
    //===== rAthena Script =======================================
    //= Dynamical Shop 
    //===== By ===================================================
    //= lllchrislll
    //===== Version ==============================================
    //= 1.0 - Script Created
    //        - Nearly forgot the "OnBuyItem" part (Q.Q)
    //        - Added the possibility to edit the price limit.
    //= 1.1 - Added more Currency options
    //      - Added possiblity to use pre-defined items + prices,
    //        which are always in the shop, see 'OnInit:' > $cash_pre_it and $cash_pre_p
    //      - Fixed an bug about the price limit
    //      - Changed all $cash variables to .cash
    //===== Compatible With ======================================
    //= Every rAthena SVN 
    //===== Tested With ==========================================
    //= rAthena SQL 11.06.2015 - Updated Revision
    //===== Description ==========================================
    //= This Shop can be changed dynamically ingame and has four
    //  payment methods, to choose from: Zeny, Cash Points, Custom Variable and Item.
    //= Also you can edit the Price Limit as long it doesn't exceed
    //    the server's default settings in the conf/script_athena.conf
    //    > input_max_value. By default I put it on 10,000,000, near
    //    line 76 you can find a small hint, which value is the max,
    //    if it isn't noted inside of that file already.
    //===== Comments =============================================
    //= Thanks to Elysium:
    //  > Bug about the price limit
    //  > Modification request about more currency options
    //===========================================================
    itemmall,175,76,4    script    Cash Shop    100,{
    function ShopStuff;
    
    // Reading Currency Display Name
    switch(.CR) {
        case 0: set .Cur_N$,"None"; break;
        case 1: set .Cur_N$,"Zeny"; set @Cur_O$,"Zeny"; break;
        case 2: set .Cur_N$,"Cash Points"; set @Cur_O$,"#CASHPOINTS"; break;
        case 3: set .Cur_N$,.CR_Name$; set @Cur_O$,""+.CR_Var$; break;
        case 4: set .Cur_N$,getitemname(.CR_Item); break;
    }
    
    if(.first) ShopStuff(5);
    
    if(getgmlevel() >= .gm) {
        set @shop,0;
        mes .n$;
        mes "Hello, "+strcharinfo(0)+".";
        mes "Current Currency: "+.Cur_N$;
        while(1) {
            if(@shop) {
                close2;
                break;
            }
            // Reading Currency Display Name
            switch(.CR) {
                case 0: set .Cur_N$,"None"; break;
                case 1: set .Cur_N$,"Zeny"; set @Cur_O$,"Zeny"; break;
                case 2: set .Cur_N$,"Cash Points"; set @Cur_O$,"#CASHPOINTS"; break;
                case 3: set .Cur_N$,.CR_Name$; set @Cur_O$,""+.CR_Var$; break;
                case 4: set .Cur_N$,getitemname(.CR_Item); break;
            }
            next;
            mes .n$;
            mes "How can I help you?";
            next;
            switch(select("- Shop Settings:- Reset Shop:- Open Shop:- Nothing")) {
    
                case 1:
                mes .n$;
                mes "What do you want view?";
                next;
                if(select("- Shop Managment:- Currency Setting") - 1) {
                    mes .n$;
                    mes "What now?";
                    mes "^FF0000Note: On currency change I will delete every entry in the shop you have made so far.^000000";
                    switch(select("- Change currency (Current - "+.Cur_N$+"):- Set Price Limit:- Nothing")) {
                        case 1:
                        next;
                        mes .n$;
                        mes "Please choose from the menu below, which currency I should use:";
                        switch(select("- Zeny:- Cash Points:- Custom Variable:- Items")) {
                            
                            default: set .CR,@menu; break;
                            
                            case 3:
                            next;
                            mes .n$;
                            mes "Please write the name of the Custom Variable and the display name for the players:";
                            mes "^FF0000Note: You have to be aware of the variable name itself, like PvPPoints.^000000";
                            mes "^FF0000Note: Max letters for variable name: 10, 20 for display name!^000000";
                            next;
                            if(input(.@CR_Var$,1,10) != 0) {
                                mes .n$;
                                mes "Error: Either the variable name is too long or too short. Please try again.";
                                continue;
                            }
                            if(input(.@CR_Name$,1,20) != 0) {
                                mes .n$;
                                mes "Error: Either the display name is too long or too short. Please try again.";
                                continue;
                            }
                            mes .n$;
                            mes "Variable Name: "+.@CR_Var$;
                            mes "Variable Display Name: "+.@CR_Name$;
                            mes "Is this correct?";
                            if(select("- Yes:- No") - 1) continue;
                            next;
                            mes .n$;
                            mes "Custom Variable will now be used as currency.";
                            set .CR_Var$,.@CR_Var$;
                            set .CR_Name$,.@CR_Name$;
                            set .CR,3;
                            break;
                            
                            case 4:
                            next;
                            mes .n$;
                            mes "Please write the id of the item you want to use:";
                            next;
                            if(input(.@item,501,.last_id) != 0) {
                                mes .n$;
                                mes "The id you have put is either too low or too high.";
                                continue;
                            }
                            if(getitemname(.@item) == "null" || getitemname(.@item) == "") {
                                mes .n$;
                                mes "The item you requested doesn't exist.";
                                continue;
                            }
                            mes .n$;
                            mes "Chosen Item: "+getitemname(.@item);
                            mes "Is that correct?";
                            if(select("- Yes:- No") - 1) continue;
                            set .CR_Item,.@item;
                            set .CR,4;
                            break;
                        }
                        deletearray .cash_it[0],128;
                        deletearray .cash_p[0],128;
                        ShopStuff(4);
                        continue;
                        break;
                    
                        case 2:
                        next;
                        mes .n$;
                        mes "Current Setting: "+.limit;
                        mes "Change?";
                        if(select("- Yes:- No") - 1) continue;
                        next;
                        mes .n$;
                        mes "Please type the new value:";        
                        
                        // ========= Changing Max Limit of 10,000,000 ============ //
                        // 10,000,000 is the default setting for the max input.
                        // To change that open the conf/script_athena.conf and 
                        // edit the value of "input_max_value:" to "2147483647",
                        // which is the highest value possible.
                        // Then you only need to change it here :D.
                        // ======================================================= //
                        
                        mes "Note: But you can't go higher than the server setting of 10,000,000.";
                        next;
                        if(input(@n_lim,1,10000000) != 0) {
                            mes .n$;
                            mes "Invalid Value, max 10,000,000.";
                            continue;
                        }
                        mes .n$;
                        mes "New Limit has been set.";
                        set .limit,@n_lim;
                        continue;
                        break;
                        
                        case 3:
                        continue;
                        break;
                    }
                }
                if(!.CR) {
                    mes .n$;
                    mes "I'm sorry, but I don't know with which Currency I should trade yet.";
                    mes "Please choose an currency first.";
                    continue;
                }
                if(!.limit) {
                    mes .n$;
                    mes "You haven't set an price limit yet.";
                    continue;
                }
                mes .n$;
                if(getarraysize(.cash_it) < 1) {
                    mes "There is no item in the Shop yet.";
                } else {
                    mes "There are currently the following "+getarraysize(.cash_it)+" Items in the Shop:";
                    mes "============================";
                    for ( set .@i,0; .@i < getarraysize(.cash_it); set .@i,.@i + 1) {
                        mes getitemname(.cash_it[.@i])+" (ID: "+.cash_it[.@i]+")";
                        mes "Price:"+.cash_p[.@i]+" "+.Cur_N$;
                        mes ( (.cash_it[.@i+1] != 0)?"---------------------------------":"============================");
                    }
                }
                next;
                switch(select("- Add Items:- Edit Items:- Delete Items:- Nothing")) {
                    case 1:
                    mes .n$;
                    if(getarraysize(.cash_it) >= 128) {
                        mes "The Shop is full, please remove an item first.";
                        continue;
                    }
                    mes "Please type the Item ID you want to add:";
                    mes "Max is 128 Items.";
                    next;
                    if(input(.@item,501,.last_id) != 0) {
                        mes .n$;
                        mes "The id you have put is either too low or too high.";
                        continue;
                    }
                    if(getitemname(.@item) == "null" || getitemname(.@item) == "") {
                        mes .n$;
                        mes "The item you requested doesn't exist.";
                        continue;
                    }
                    mes .n$;
                    mes "Chosen Item: "+getitemname(.@item);
                    mes " ";
                    mes "Now input the price it should have, the current currency is \""+.Cur_N$+"\".";
                    mes "Maximum is "+.limit;
                    next;
                    if(input(.@price,1,.limit) != 0) {
                        mes .n$;
                        mes "You have put an invalid price.";
                        mes "Maximum is "+.limit;
                        continue;
                    }
                    mes .n$;
                    mes "Price: "+.@price+" "+.Cur_N$;
                    mes "Is that correct?";
                    if(select("- Yes:- No") - 1) continue;
                    ShopStuff(1,0,.@item,.@price);
                    continue;
                    break;
                    
                    case 2:
                    mes .n$;
                    if(getarraysize(.cash_it) < 1) {
                        mes "There is no Item to edit.";
                        mes "Please add one first :D.";
                        continue;
                    }
                    mes "Please choose the item you want to edit:";
                    mes "Format: Name (Current Price)";
                    next;
                    set @ed_list$,"";
                    for ( set .@e,0; .@e < getarraysize(.cash_it); set .@e,.@e + 1)
                        set @ed_list$,@ed_list$ + "- "+getitemname(.cash_it[.@e])+" ("+.cash_p[.@e]+")" + ( (.cash_it[.@e+1])?":":"");
                        
                    set @ed,select(@ed_list$) - 1;
                    
                    mes .n$;
                    mes "Chosen Item: "+ getitemname(.cash_it[@ed]);
                    mes "Price: "+ .cash_p[@ed]+" "+.Cur_N$;
                    mes "Correct?";
                    if(select("- Yes:- No") - 1) continue;
                    next;
                    mes .n$;
                    mes "What do you want to edit?";
                    next;
                    if(select("- Item ID:- Price") - 1) {
                        mes .n$;
                        mes "Input the new price:";
                        next;
                        if(input(.@price,1,.limit) != 0) {
                            mes .n$;
                            mes "You have put an invalid price.";
                            mes "Maximum is "+.limit;
                            continue;
                        }
                        mes .n$;
                        mes "Chosen Price: "+.@price+" "+.Cur_N$;
                        mes "Correct?";
                        if(select("- Yes:- No") - 1) continue;
                        ShopStuff(3,@ed,.cash_it[@ed],.@price);
                        
                    } else {
                        mes .n$;
                        mes "Input the new item id:";
                        next;
                        if(input(.@item,501,.last_id) != 0) {
                            mes .n$;
                            mes "The id you have put is either too low or too high.";
                            continue;
                        }
                        if(getitemname(.@item) == "null" || getitemname(.@item) == "") {
                            mes .n$;
                            mes "The item you requested doesn't exist.";
                            continue;
                        }
                        mes .n$;
                        mes "Chosen Item: "+getitemname(.@item);
                        mes "Correct?";
                        if(select("- Yes:- No") - 1) continue;
                        ShopStuff(3,@ed,.@item,.cash_p[@ed]);
                    }    
                    continue;
                    break;
                    
                    case 3:
                    mes .n$;
                    if(getarraysize(.cash_it) < 1) {
                        mes "There is no Item to remove.";
                        mes "Please add one first :D.";
                        continue;
                    }
                    mes "Please choose the item you want to remove:";
                    mes "Format: Name (Current Price)";
                    next;
                    set @r_list$,"";
                    for ( set .@e,0; .@e < getarraysize(.cash_it); set .@e,.@e + 1)
                        set @r_list$,@r_list$ + "- "+getitemname(.cash_it[.@e])+" ("+.cash_p[.@e]+")" + ( (.cash_it[.@e+1])?":":"");
                        
                    set @re,select(@r_list$) - 1;
                    
                    mes .n$;
                    mes "Chosen Item: "+ getitemname(.cash_it[@re]);
                    mes "Price: "+ .cash_p[@re]+" "+.Cur_N$;
                    mes "Correct?";
                    if(select("- Yes:- No") - 1) continue;
                    ShopStuff(2,@ed);
                    continue;
                    break;
                    
                    case 4:
                    continue;
                    break;
                }
                
                case 2:
                mes .n$;
                mes "Do you really want to reset the shop?";
                if(select("- Yes:- No") - 1) continue;
                ShopStuff(4);
                continue;
                break;
                
                case 3:
                set @shop,1;
                break;
                
                case 4:
                close;
            }
        }
    }
    if(!.CR) {
        mes .n$;
        mes "I'm sorry, but I don't know with which Currency I should trade yet.";
        close;
    }
    if(getarraysize(.cash_it) < 1) {
        mes .n$;
        mes "There are no items to purchase yet.";
        mes "Please come back as soon as I have some.";
        close;
    }
    dispbottom strnpcinfo(1)+": Accepted Payment Method: "+.Cur_N$;
    if(.CR < 4)
        dispbottom strnpcinfo(1)+": You have "+getd(""+@Cur_O$)+" "+.Cur_N$;
    else 
        dispbottom strnpcinfo(1)+": You have "+countitem(.CR_Item)+" "+.Cur_N$;
    dispbottom strnpcinfo(1)+": Notice: Discount Skill won't work at me, you'll have to pay the full price.";
    callshop "Dynam_Shop",1;
    npcshopattach "Dynam_Shop";
    end;
    
    OnBuyItem:
    for ( set .@b,0; .@b < getarraysize(@bought_nameid); set .@b,.@b + 1) {
        for ( set .@l,0; .@l < getarraysize(.cash_it); set .@l,.@l + 1) {
            if(@bought_nameid[.@b] == .cash_it[.@l]) {
                if(checkweight(.cash_it[.@l],@bought_quantity[.@b]) == 1) {
                    set @cost,.cash_p[.@l]*@bought_quantity[.@b];
                    set @total,@total+@cost;
                } else {
                    dispbottom "Cash Shop: You would be overweight, please remove some items or buy less.";
                    set @cost,0;
                    set @total,0;
                    deletearray @bought_nameid[0],128;
                    deletearray @bought_quantity[0],128;
                    end;
                }
            }
        }
    }
    if(.CR < 4 && (@total > getd(""+@Cur_O$) ) ) set .@f,1;
    if(.CR == 4 && (@total > countitem(.CR_Item) ) ) set .@f,1;
    if(.@f) {
        dispbottom strnpcinfo(1)+": You don't have the required "+.Cur_N$;
        dispbottom strnpcinfo(1)+": You need "+@total +" "+.Cur_N$+".";
        set @cost,0;
        set @total,0;
        deletearray @bought_nameid[0],128;
        deletearray @bought_quantity[0],128;
        end;
    }
    
    if(.CR < 4)
        setd(""+@Cur_O$),getd(""+@Cur_O$)  - @total;
    else 
        delitem .CR_Item,@total;
    
    for ( set .@s,0; .@s < getarraysize(@bought_nameid); set .@s,.@s + 1) {
        getitem @bought_nameid[.@s],@bought_quantity[.@s];
        dispbottom strnpcinfo(1)+": You have succesfully purchased "+@bought_quantity[.@s]+"x "+getitemname(@bought_nameid[.@s])+".";
    }
    dispbottom strnpcinfo(1)+": You have paied "+@total+"x "+.Cur_N$+".";
        
    set @cost,0;
    set @total,0;
    deletearray @bought_nameid[0],128;
    deletearray @bought_quantity[0],128;
    end;
    
    function    ShopStuff    {
    // ==================================================== //
    // getarg(0):
    //    * 1 - Add
    //    * 2 - Remove
    //    * 3 - Edit
    //    * 4 - Delete Shop
    //    * 5 - Shop Creation
    // getarg(1): Array Position for Edit & Remove
    // getarg(2): Item ID
    // getarg(3): Price
    // ==================================================== //
    //debugmes "getarg(0): "+getarg(0,0)+", getarg(1): "+getarg(1,0)+", getarg(2): "+getarg(2,0)+", getarg(3): "+getarg(3,0);
        // =========== Item Adding ============ //
        if(getarg(0) == 1) {
            npcshopadditem "Dynam_Shop",getarg(2),getarg(3);
            setarray .cash_it[getarraysize(.cash_it)],getarg(2);
            setarray .cash_p[getarraysize(.cash_p)],getarg(3);
            
        // =========== Item Removal ============ //    
        } else if(getarg(0) == 2) {
            npcshopdelitem "Dynam_Shop",.cash_it[getarg(1)];
            deletearray .cash_it[getarg(1)],1;
            deletearray .cash_p[getarg(1)],1;
            
        // =========== Item Edit ============ //
        } else if(getarg(0) == 3) {
            setarray .cash_it[getarg(1)],getarg(2);
            setarray .cash_p[getarg(1)],getarg(3);
            // Re-Create Shop after Edit
            npcshopitem "Dynam_Shop",.cash_it[0],.cash_p[0];
            for ( set .@s,1; .@s < getarraysize(.cash_it); set .@s,.@s + 1) 
                    npcshopadditem "Dynam_Shop",.cash_it[.@s],.cash_p[.@s];
                    
        // =========== Reset Shop ============ //                
        } else if(getarg(0) == 4) {
            npcshopitem "Dynam_Shop",512,10;
            set .first,1;
    
        // =========== Shop Creation ============ //        
        } else if(getarg(0) == 5) {
            ShopStuff(4);
            npcshopdelitem "Dynam_Shop",512;
            // Adding pre-defined items to the shop array
            for ( set .@s,0; .@s < getarraysize(.cash_pre_it); set .@s,.@s + 1) {
                setarray .cash_it[getarraysize(.cash_it)],.cash_pre_it[.@s];
                setarray .cash_p[getarraysize(.cash_p)],.cash_pre_p[.@s];        
            }
            // Adding items to the shop
            for ( set .@s,0; .@s < getarraysize(.cash_it); set .@s,.@s + 1) 
                npcshopadditem "Dynam_Shop",.cash_it[.@s],.cash_p[.@s];
            set .first,0;
        }
        return;
    }
    
    OnInit:
    set .n$,"["+strnpcinfo(1)+"]";
    set .gm,80; // General Access Level
    set .first,1; // First Shop Creation
    set .last_id,30000; // Highest Item ID
    if(getarraysize($cash_it) > 0) {
        deletearray $cash_it,128;
        deletearray $cash_p,128;
        deletearray $cash_pre_it,128;
        deletearray $cash_pre_p,128;
    }
    // Pre-Defined Items in the Shop, they are always in it!
    setarray .cash_pre_it[0],2792,2793,2374,2375,2357,2524,2421,2115,2729;
    setarray .cash_pre_p[0],100,100,100,100,100,100,100,100,100;
    end;
    }
    -    shop    Dynam_Shop    -1,512:-1

     

×
×
  • Create New...