viewing paste Unknown #18782 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
-   script  Ganja Runes -1,{
    mes .npc$;
    mes "I can attach or remove your Ganja Runes to/from your equipment. But I can't do it for weapons."; next;
    switch(select("> Attach Ganja Runes:> Remove Ganja Runes:> Buy Ganja Runes")) {
        case 1:
            mes .npc$;
            mes "I can do this for a small fee of ^0000FF"+.pric+"z^000000.";
            emotion e_no1,0; next;
            emotion e_swt,0;
            mes .npc$;
            mes "I must ^FF0000warn^000000 you that if this";
            mes "process fails, I don't refund money and your Ganja Runes will be consumed.";
            mes " ";
            mes "Would you still like to continue?"; next;
            if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; }
            if(Zeny<.pric) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; }
    
            mes .npc$;
            mes "Please select an equipment from the menu."; next;
            while(set(.@a,.@a+1)<=.e_len) {
                if(getequipid(.@a)>-1) {
                    if(getiteminfo(getequipid(.@a),2)!=4) {
                        set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.@a))+"^000000]:";
                        set(.@menu[getarraysize(.@menu)],.@a);
                    }
                }
            }
    
            if(.@menu$==""){ mes .npc$; mes "You don't have anything equipped!"; close; }
    
            select(.@menu$);
            set .@eq_loc, .@menu[@menu-1];
            set .@eq_itm, getequipid(.@eq_loc);
            
            if(countitem(.@eq_itm)>1)
            {
                mes .npc$;
                mes "You have more than one ^009900"+getitemname(.@eq_itm)+"^000000";
                mes "in your inventory! Please put them";
                mes "to your storage first to avoid";
                mes "^FF0000misattachment^000000!";
                close;
            }
            
            if(.@eq_itm<0){ mes .npc$; mes "Hmm, I don't think you have anything equipped there."; close; }
    
            set .@menu$, "";
            set .@a, .en_orb[0];
            while((set(.@a,.@a+1)-1)<=.en_orb[1])
                if(getiteminfo(.@a-1,2)>-1)
                    if(set(.@c,countitem(.@a-1))) {
                        set .@menu$, .@menu$+getitemname(.@a-1)+" x"+.@c+":";
                        set .@b,.@b+1; set .@item[.@b], .@a-1;
                    }
            
            if(.@menu$==""){ mes .npc$; mes "Hmm, you don't seem to have any Ganja Runes."; close; }
 
            mes .npc$;
            mes "Please select a rune from the menu."; next;
            select(.@menu$);
            set .@itm, .@item[@menu];
 
            set .@menu$, ""; set .@a, 0;
            while((set(.@a,.@a+1))<4) {
                if(getequipcardid(.@eq_loc,.@a))
                    set .@menu$, .@menu$+(.@a+1)+.crd_c$[.@a]+" Slot- [^a92435"+getitemname(getequipcardid(.@eq_loc,.@a))+"^000000]:";
                else set .@menu$, .@menu$+(.@a+1)+.crd_c$[.@a]+" Slot- [^30ad25Empty^000000]:";
            }
    
            setarray .@card, getequipcardid(.@eq_loc,0), getequipcardid(.@eq_loc,1), getequipcardid(.@eq_loc,2), getequipcardid(.@eq_loc,3);
    
            mes .npc$;
            mes "Select a slot."; next;
            set .@men, select(.@menu$);
            set .@eqrf, getequiprefinerycnt(.@eq_loc);
            if(getequipcardid(.@eq_loc,@menu)) {
                mes .npc$;
                mes "It looks like that item slot has already attachment on it.";
                mes "Please remove it and talk to me again.";
                close;
            }
 
            mes .npc$;
            mes "Succes Rate: ^FF0000"+.perc[.@men]+"^000000 percent.";
            mes " ";
            mes "Are you sure you want to do this?"; next;
            if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; }
            if(rand(100)>.perc[.@men]) {
                mes .npc$;
                mes "I'm sorry but I've failed you!";
                misceffect 155; emotion e_sob,0;
                set Zeny,Zeny-.pric;
                delitem(.@itm,1);
                close;
            }
    
            set Zeny,Zeny-.pric;
            delitem .@itm,1;
            delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@card[0], .@card[1], .@card[2], .@card[3];
            set .@card[.@men], .@itm;
            getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@card[0], .@card[1], .@card[2], .@card[3];
            misceffect .efet;
            emotion e_no1,0;
            equip .@eq_itm;
            mes .npc$;
            mes "Rune successfully attached!";
            close;
            
        case 2:
            mes .npc$;
            mes "To perform it, I will need these:";
            mes "> ^0000FF"+getitemname(.remv)+"^000000";
            mes "> ^0000FF"+.pric2+"z^000000";
            emotion e_no1,0; next;
            mes .npc$;
            mes "Please select an equipment from the menu."; next;
            while(set(.@a,.@a+1)<=.e_len) {
                if(getequipid(.@a)>-1) {
                    if(getiteminfo(getequipid(.@a),2)!=4) {
                        set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.@a))+"^000000]:";
                        set(.@menu[getarraysize(.@menu)],.@a);
                    }
                }
            }
    
            if(.@menu$==""){ mes .npc$; mes "You don't have anything equipped!"; close; }
    
            select(.@menu$);
            set .@eq_loc, .@menu[@menu-1];
            set .@eq_itm, getequipid(.@eq_loc);
            
            if(.@eq_itm<0){ mes .npc$; mes "Hmm, I don't think you have anything equipped there."; close; }
 
            set .@menu$, ""; set .@a, 0;
            while((set(.@a,.@a+1))<4) {
                if(getequipcardid(.@eq_loc,.@a))
                    set .@menu$, .@menu$+(.@a+1)+.crd_c$[.@a]+" Slot- [^a92435"+getitemname(getequipcardid(.@eq_loc,.@a))+"^000000]:";
                else set .@menu$, .@menu$+(.@a+1)+.crd_c$[.@a]+" Slot- [^30ad25Empty^000000]:";
            }
    
            setarray .@card, getequipcardid(.@eq_loc,0), getequipcardid(.@eq_loc,1), getequipcardid(.@eq_loc,2), getequipcardid(.@eq_loc,3);
    
            mes .npc$;
            mes "Select a slot."; next;
            set .@men, select(.@menu$);
            set .@eqrf, getequiprefinerycnt(.@eq_loc);
            if(getequipcardid(.@eq_loc,@menu)) {
                if(Zeny<.pric2) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; }
                if(!countitem(.remv)) { mes .npc$; mes "I'm sorry but you don't have any "+getitemname(.remv)+". Please come back when you do!"; close; }
            mes .npc$;
            mes "Are you sure you want to do this?"; next;
            if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; }
                if(rand(100)>.rper) {
                    mes .npc$;
                    mes "I failed to remove the rune";
                    mes "I'm sorry please try again!";
                    misceffect 155; emotion e_sob,0;
                    delitem(.remv,1);
                    set Zeny,Zeny-.pric2;
                    close;
                }
                set Zeny,Zeny-.pric2;
                delitem(.remv,1);
                getitem getequipcardid(.@eq_loc,.@men),1;
                unequip(.@eq_loc);
                delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@card[0], .@card[1], .@card[2], .@card[3];
                set .@card[.@men], 0;
                getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@card[0], .@card[1], .@card[2], .@card[3];
                misceffect .efet;
                emotion e_no1,0;
                mes .npc$;
                mes "Rune successfully removed!";
                close;
            } else {
                mes .npc$;
                mes "Nothing is there for me to remove.";
                close;
            }
        
        case 3:
            mes .npc$;
            mes "Please choose a rune class from the menu.";
            callfunc "gruneshop";
            end;
    
    } // end of switch
    
    OnInit:
        set .npc$,"^009900[ Ganja Runes ]^000000"// NPC Name
        set .pric,1000000;                              // Enchanting Price
        set .pric2,1000000;                             // Removing Price
        set .remv,2267;                                 // Item required to de-enchant
        set .efet,154;                                  // Effect Number
        set .rper,50;                                   // Remove Percent
        setarray .perc,0,70,50,30;                      // Enchant Percent by Slot
        setarray .crd_c$, "st", "nd", "rd", "th";       // Count
        setarray .en_orb, 4700, 4862;                   // Range of IDs selected for enchanting.
        setarray .eqp$, "Upper Headgear", "Armor", "Left Hand", "Right Hand", "Garment",
                        "Shoes", "Accessory1", "Accessory2", "Mid Headgear", "Low Headgear";
        set      .e_len ,   getarraysize(.eqp$);
}
//============================================================
-   script  ganja_runes_shop    -1,{ 
function Add; function Chk; function Slot; function A_An;
OnInit:
    freeloop(1);
 
// -----------------------------------------------------------
//  Basic shop settings.
// -----------------------------------------------------------
 
    set .Announce,0;    // 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],"D Class","C Class","B Class","A Class","S Class";
 
// -----------------------------------------------------------
//  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>{,...});
// -----------------------------------------------------------
//=================( D Class Ganja Runes )====================
    Add(1,4700,1,0,0,25538,1);
//=================( C Class Ganja Runes )====================
    Add(2,4701,1,0,0,25538,1);
//=================( B Class Ganja Runes )====================
    Add(3,4702,1,0,0,25538,1);
//=================( A Class Ganja Runes )====================
    Add(4,4703,1,0,0,25538,1);
//=================( S Class Ganja Runes )====================
    Add(5,4704,1,0,0,25538,1);
//============================================================  
    
    
// -----------------------------------------------------------
 
    freeloop(0);
    set .menu$,"";
    for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
        set .menu$, .menu$+.Shops$[.@i]+":";
        npcshopdelitem "gruneshop"+.@i,909;
    }
    end;
 
OnMenu:
    set .@size, getarraysize(@i);
    if (!.@size) set .@i, select(.menu$);
    else if (.@size == 1) set .@i, @i[0];
    else {
        for(set .@j,0; .@j<.@size; set .@j,.@j+1)
            set .@menu$, .@menu$+.Shops$[@i[.@j]]+":";
        set .@i, @i[select(.@menu$)-1];
    }
    deletearray @i[0],getarraysize(@i);
    if (.Shops$[.@i] == "") {
        message strcharinfo(0),"An error has occurred.";
        end;
    }
    dispbottom "Select one item at a time.";
    callshop "gruneshop"+.@i,1;
    npcshopattach "gruneshop"+.@i;
    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_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+.@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 .npc$;
    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] & 1) || (@qe[1] & 256) || (@qe[1] & 512) || (@qe[1] & 1024) || (@qe[1] & 2048) || (@qe[1] & 4096) || (@qe[1] & 4) || (@qe[1] & 8192)))
        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 .npc$;
                mes "You're missing one or more quest requirements.";
                close;
            }
            if (!checkweight(.@q[0],.@q[2])) {
                mes .npc$;
                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)+" just finished the quest of "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):A_An(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(1)+"[0]"),.@j[0],getarraysize(.@j);
    npcshopadditem "gruneshop"+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 A_An {
    setarray .@A$[0],"a","e","i","o","u";
    set .@B$, "_"+getarg(0);
    for(set .@i,0; .@i<5; set .@i,.@i+1)
        if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
    return "a "+getarg(0);
}
}
function    script  gruneshop   {
    deletearray @i[0],getarraysize(@i);
    for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
        set @i[.@i],getarg(.@i);
    doevent "ganja_runes_shop::OnMenu";
    end;
}
// Dummy shop data -- copy as needed.
//============================================================
-   shop    gruneshop1  -1,909:-1
-   shop    gruneshop2  -1,909:-1
-   shop    gruneshop3  -1,909:-1
-   shop    gruneshop4  -1,909:-1
-   shop    gruneshop5  -1,909:-1
// --------------------------------------------------------------------------
// Use duplicates to put your npc on different cities
// --------------------------------------------------------------------------
turbo_room,76,110,5 duplicate(Ganja Runes)  Ganja Runes#1   406
Viewed 834 times, submitted by Guest.