viewing paste Ultimate Coin Exchanger | 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
//===============================================================
//= Ultimate Coin Exchange NPC
//===============================================================
//= v1.2
//===============================================================
//= by xxJakotsuxx
//===============================================================
//= A zeny to coin exchange script created for the
//= ease of storing zeny. Created out of fustration
//= over the amount of crappy coin scripts on eAthena.
//===============================================================
//= v1.1
//= Added some special effects and "Current" to the list section.
//===============================================================
//= v1.2
//= After giving it some thought thanks to GreenFabre, I decided 
//= to change the dialogue to a more "translatable friendly"
//= version. Added a display for required zeny when you choose to
//= exchange zeny to coins.
//===============================================================
prontera,147,175,5  script  Ultimate Coin Exchange  878,{
 
//======================= Customization Area ========================================
setarray .coins[0],673,671,674,677,675; //bronze,gold,mithril,platinum,silver accordingly
setarray .coinvalue[0],1000000,50000000,150000000,300000000,25000000; //bronze,gold,mithril,platinum,silver accordingly
set .maxzeny,1000000000; // Maximum Zeny allowed to trade or maximum on server
set .minzeny,1000000; // Minimum Zeny required to trade
//======================= Do Not Edit Below =========================================
set .name$,"^FF0000[Ultimate Coin Exchange]^000000"; // NPC Name
set .plname$,"^0000FF["+strcharinfo(0)+"]^000000"; // Interacting Player Name
set .coinmenu$,"^d5be8bBronze Coins^000000:^88969bSilver Coins^000000:^ccc252Gold Coins^000000:^88969bMithril Coins^000000:^b7b7b7Platinum Coins^000000:Nevermind."; //Menu for converting coin -> zeny
set .zenymenu1$,"^d5be8bBronze Coins^000000:^88969bSilver Coins^000000:^ccc252Gold Coins^000000:^88969bMithril Coins^000000:^b7b7b7Platinum Coins^000000:Choose Coins!:Nevermind."; //1st Menu for converting zeny -> coins
set .1stmenu$,"^00FFFFCoins to Zeny.^000000:^FFFF00Zeny to Coins.^000000";
//===================================================================================
 
    mes .name$;
    mes "Hello! How are you today?";
    next;
    mes .plname$;
    mes "I am just fine, thank you!";
    next;
    mes .name$;
    mes "Would you like to exchange some things today?";
    next;
    if (select("...Yes:...No") == 2) close;
    mes .name$;
    mes "Very good. Please choose your exchange option.";
    next;
    switch(select(.1stmenu$)) {
        case 1:
            mes .name$;
            mes "I see that you have:";
            mes "^b7b7b7"+countitem(.coins[3])+" "+getitemname(.coins[3])+"s^000000,";
            mes "^88969b"+countitem(.coins[2])+" "+getitemname(.coins[2])+"s^000000,";
            mes "^ccc252"+countitem(.coins[1])+" "+getitemname(.coins[1])+"s^000000,";
            mes "^88969b"+countitem(.coins[4])+" "+getitemname(.coins[4])+"s^000000,";
            mes "And ^d5be8b"+countitem(.coins[0])+" "+getitemname(.coins[0])+"s^000000.";
            next;
            if ( countitem(.coins[3]) < 1 && countitem(.coins[2]) < 1 && countitem(.coins[1]) < 1 && countitem(.coins[4]) < 1 && countitem(.coins[0]) < 1 ) { 
            mes .name$;
            mes "You do not have enough coins to exchange.";
            close;
            }
            mes .name$;
            mes "Would you like to exchange some coins?";
            next;
            mes "^FF0000=========================^000000";
            mes "^b7b7b7"+getitemname(.coins[3])+"s^000000 = "+.coinvalue[3]+"";
            mes "^88969b"+getitemname(.coins[2])+"s^000000= "+.coinvalue[2]+"";
            mes "^ccc252"+getitemname(.coins[1])+"s^000000= "+.coinvalue[1]+"";
            mes "^88969b"+getitemname(.coins[4])+"s^000000= "+.coinvalue[4]+"";
            mes "And ^d5be8b"+getitemname(.coins[0])+"s^000000= "+.coinvalue[0]+"";
            mes "^FF0000=========================^000000";
            next;
            switch(select(.coinmenu$)) {
                case 1:
                    callsub h_coin2zeny,.coins[0],.coinvalue[0];
                case 2:
                    callsub h_coin2zeny,.coins[4],.coinvalue[4];
                case 3:
                    callsub h_coin2zeny,.coins[1],.coinvalue[1];
                case 4:
                    callsub h_coin2zeny,.coins[2],.coinvalue[2];
                case 5:
                    callsub h_coin2zeny,.coins[3],.coinvalue[3];
                case 6:
                    close;
            }
        case 2:
            if ( Zeny < .minzeny ) {
            mes .name$;
            mes "You are too poor to exchange zeny. You must have at least ^ff0000"+ .minzeny +"^000000.";
            close;
            }
            mes .name$;
            mes "Oh my, you have a lot of zeny there.";
            next;
            mes "It seems you have ^FF0000"+ Zeny +" zeny^000000.";
            next;
            mes .plname$;
            mes "Yes, I would like to exchange some of it today.";
            next;
            mes .name$;
            mes "Perfect. Which would you like to exchange today?";
            next;
            callsub h_zenylist;
            next;
            switch(select(.zenymenu1$)) {
                case 1:
                    next;
                    set Zeny,Zeny-(@bzenyc * .coinvalue[0]);
                    getitem .coins[0],@bzenyc;
                    mes .name$;
                    mes "Have a nice day.";
                    close;
                case 2:
                    set Zeny,Zeny-(@szenyc * .coinvalue[4]);
                    getitem .coins[4],@szenyc;
                    mes .name$;
                    mes "Have a nice day.";
                    close;
                case 3:
                    set Zeny,Zeny-(@gzenyc * .coinvalue[1]);
                    getitem .coins[1],@gzenyc;
                    mes .name$;
                    mes "Have a nice day.";
                    close;
                case 4:
                    set Zeny,Zeny-(@mzenyc * .coinvalue[2]);
                    getitem .coins[2],@mzenyc;
                    mes .name$;
                    mes "Have a nice day.";
                    close;
                case 5:
                    set Zeny,Zeny-(@pzenyc * .coinvalue[3]);
                    getitem .coins[3],@pzenyc;
                    mes .name$;
                    mes "Have a nice day.";
                    close;
                case 6:
                    callsub h_zeny2coinchoose;
                case 7:
                    close;
            }
    }
    end;
 
h_coin2zeny:
    next;
    mes .name$;
    mes "How many ^0000FF"+getitemname(getarg(0))+"^000000 did you wish to exchange with me?";
    next;
    input @swapamount;
    set @exchangevalue,@swapamount * getarg(1);
    if ( (@swapamount > countitem( getarg(0) )) || (@swapamount < 1) || (countitem( getarg(0) ) < 1) ) {
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    close;
    }
    if ( @exchangevalue > (.maxzeny - Zeny) ) {
    mes .name$;
    mes "You have too much zeny. If you exchange this much, you will go over the limit. Please store some zeny.";
    close;
    }
    delitem getarg(0),@swapamount;
    set Zeny,Zeny + @exchangevalue;
    specialeffect2 632;
    mes .name$;
    mes "Have a great day.";
    close;
 
 
h_zenylist:
    set @pzenyc, Zeny / .coinvalue[3];
    set @mzenyc, Zeny / .coinvalue[2];
    set @gzenyc, Zeny / .coinvalue[1];
    set @szenyc, Zeny / .coinvalue[4];
    set @bzenyc, Zeny / .coinvalue[0];
    mes .name$;
    mes "^FF0000=========================^000000";
    mes "I can currently offer you each of the following:";
    mes "^b7b7b7"+@pzenyc+" "+getitemname(.coins[3])+"s^000000,";
    mes "^88969b"+@mzenyc+" "+getitemname(.coins[2])+"s^000000,";
    mes "^ccc252"+@gzenyc+" "+getitemname(.coins[1])+"s^000000,";
    mes "^88969b"+@szenyc+" "+getitemname(.coins[4])+"s^000000,";
    mes "And ^d5be8b"+@bzenyc+" "+getitemname(.coins[0])+"s^000000.";
    mes "Or you can choose what coins you want.";
    mes "^FF0000=========================^000000";
    return;
 
h_zeny2coinchoose:
    next;
    mes .name$;
    mes "Very good choice. You wish to choose the coins to exchange?";
    next;
    goto L_platswap;
 
L_platswap:
    mes .name$;
    mes "Please tell me how many platinum coins to exchange.";
    mes "^FF0000"+ getitemname(.coins[3]) +" = "+ .coinvalue[3] +".";
    next;
    input @platswap1;
    if ( (@platswap1 > (Zeny / .coinvalue[3])) ) {
    next;
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    next;
    goto L_platswap;
    }
    set @platzenyamount,@platswap1;
    goto L_mithswap;
    
L_mithswap:
    mes .name$;
    mes "Please tell me how many mithril coins to exchange.";
    mes "^FF0000"+ getitemname(.coins[2]) +" = "+ .coinvalue[2] +".";
    mes "=========================";
    mes "Current:";
    mes ""+@platswap1+" "+getitemname(.coins[3])+".";
    mes "=========================";
    next;
    input @mithswap1;
    if ( (@mithswap1 > (Zeny / .coinvalue[2])) ) {
    next;
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    next;
    goto L_mithswap;
    }
    if ( (@mithswap1 * .coinvalue[2]) > (Zeny - (@platswap1 * .coinvalue[3])) ) {
    next;
    mes .name$;
    mes "You will not have enough to exchange that many after exchanging the coins.";
    next;
    goto L_mithswap;
    }
    set @mithzenyamount,@mithswap1;
    goto L_goldswap;
    
L_goldswap:
    mes .name$;
    mes "Please tell me how many golds to swap.";
    mes "^FF0000"+ getitemname(.coins[1]) +" = "+ .coinvalue[1] +".";
    mes "=========================";
    mes "Current:";
    mes ""+@platswap1+" "+getitemname(.coins[3])+".";
    mes ""+@mithswap1+" "+getitemname(.coins[2])+".";
    mes "=========================";
    next;
    input @goldswap1;
    if ( (@goldswap1 > (Zeny / .coinvalue[1])) ) {
    next;
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    next;
    goto L_goldswap;
    }
    if ( (@goldswap1 * .coinvalue[1]) > (Zeny - ((@platswap1 * .coinvalue[3]) + (@mithswap1 * .coinvalue[2]))) ) {
    next;
    mes .name$;
    mes "You will not have enough to exchange that many after exchanging the coins.";
    next;
    goto L_goldswap;
    }
    set @goldzenyamount,@goldswap1;
    goto L_silvswap;
    
L_silvswap:
    mes .name$;
    mes "Please tell me how many silvers to swap.";
    mes "^FF0000"+ getitemname(.coins[4]) +" = "+ .coinvalue[4] +".";
    mes "=========================";
    mes "Current:";
    mes ""+@platswap1+" "+getitemname(.coins[3])+".";
    mes ""+@mithswap1+" "+getitemname(.coins[2])+".";
    mes ""+@goldswap1+" "+getitemname(.coins[1])+".";
    mes "=========================";
    next;
    input @silvswap1;
    if ( (@silvswap1 > (Zeny / .coinvalue[4])) ) {
    next;
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    next;
    goto L_silvswap;
    }
    if ( (@silvswap1 * .coinvalue[4]) > (Zeny - ((@platswap1 * .coinvalue[3]) + (@mithswap1 * .coinvalue[2]) + (@goldswap1 * .coinvalue[1]))) ) {
    next;
    mes .name$;
    mes "You will not have enough to exchange that many after exchanging the coins.";
    next;
    goto L_silvswap;
    }
    set @silvzenyamount,@silvswap1;
    goto L_bronswap;
    
L_bronswap:
    mes .name$;
    mes "Please tell me how many bronze to swap.";
    mes "^FF0000"+ getitemname(.coins[0]) +" = "+ .coinvalue[0] +".";
    mes "=========================";
    mes "Current:";
    mes ""+@platswap1+" "+getitemname(.coins[3])+".";
    mes ""+@mithswap1+" "+getitemname(.coins[2])+".";
    mes ""+@goldswap1+" "+getitemname(.coins[1])+".";
    mes ""+@silvswap1+" "+getitemname(.coins[4])+".";
    mes "=========================";
    next;
    input @bronswap1;
    if ( (@bronswap1 > (Zeny / .coinvalue[0])) ) {
    next;
    emotion 23;
    mes .name$;
    mes "You do not have enough to exchange with.";
    next;
    goto L_bronswap;
    }
    if ( (@bronswap1 * .coinvalue[0]) > (Zeny - ((@platswap1 * .coinvalue[3]) + (@mithswap1 * .coinvalue[2]) + (@goldswap1 * .coinvalue[1]) + (@silvswap1 * .coinvalue[4]))) ) {
    next;
    mes .name$;
    mes "You will not have enough to exchange that many after exchanging the coins.";
    next;
    goto L_silvswap;
    }
    set @bronzenyamount,@bronswap1;
    next;
    mes .name$;
    mes "So before I exchange with your decision... you want:";
    mes "^b7b7b7"+@platswap1+" "+getitemname(.coins[3])+"s^000000,";
    mes "^88969b"+@mithswap1+" "+getitemname(.coins[2])+"s^000000,";
    mes "^ccc252"+@goldswap1+" "+getitemname(.coins[1])+"s^000000,";
    mes "^88969b"+@silvswap1+" "+getitemname(.coins[4])+"s^000000,";
    mes "And ^d5be8b"+@bronswap1+" "+getitemname(.coins[0])+"s^000000.";
    mes "Is this correct?";
    next;
    if (select("Yes.:No.") == 2) {
    mes .name$;
    mes "Very well. Please choose again.";
    next;
    goto h_zeny2coinchoose;
    }
    next;
    set Zeny,Zeny - (@platzenyamount * .coinvalue[3]);
    set Zeny,Zeny - (@mithzenyamount * .coinvalue[2]);
    set Zeny,Zeny - (@goldzenyamount * .coinvalue[1]);
    set Zeny,Zeny - (@silvzenyamount * .coinvalue[4]);
    set Zeny,Zeny - (@bronzenyamount * .coinvalue[0]);
    getitem .coins[3],@platzenyamount;
    getitem .coins[2],@mithzenyamount;
    getitem .coins[1],@goldzenyamount;
    getitem .coins[4],@silvzenyamount;
    getitem .coins[0],@bronzenyamount;
    specialeffect2 460;
    mes .plname$;
    mes "-With some form of magic he sticks the coins in your pockets without even seeing him move-";
    next;
    mes .name$;
    mes "There you go. Have a nice day.";
    close;
}
Viewed 799 times, submitted by Guest.