Guest User

Untitled

a guest
Jan 19th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= Custom-Currency Multi-Shop
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.2
  7. //===== Description: =========================================
  8. //= Allows for better organization in a single shop call.
  9. //= Note that there are two configuration areas.
  10. //============================================================
  11.  
  12. // -------------------- Config 1 --------------------
  13. // For each shop added, copy this MSHOPX dummy data.
  14. // Write your shop names in the select() function.
  15.  
  16. - shop MSHOP1 -1,512:-1
  17. - shop MSHOP2 -1,512:-1
  18. - shop MSHOP3 -1,512:-1
  19. - shop MSHOP4 -1,512:-1
  20. - shop MSHOP5 -1,512:-1
  21. - shop MSHOP6 -1,512:-1
  22. - shop MSHOP7 -1,512:-1
  23. - shop MSHOP8 -1,512:-1
  24.  
  25. prontera,163,174,4 script A Shop 984,{
  26.  
  27. set @s, select("Weapons:Headgears:Armors:Garments:Shoes:Shields:Cards:Misc");
  28.  
  29. // --------------------------------------------------
  30.  
  31. message strcharinfo(0),"This shop only accepts "+getitemname(.Currency[@s])+".";
  32. dispbottom "You have "+countitem(.Currency[@s])+" "+getitemname(.Currency[@s])+".";
  33. callshop "MSHOP"+@s,1;
  34. npcshopattach "MSHOP"+@s;
  35. end;
  36.  
  37. OnBuyItem:
  38. set .@i,0;
  39. while (.@i < getarraysize(@bought_nameid)) {
  40. set .@j, 0;
  41. while (.@j < getarraysize(getd(".Shop"+@s))) {
  42. if(getd(".Shop"+@s+"["+.@j+"]") == @bought_nameid[.@i]) {
  43. set @itemcost, (getd(".Shop"+@s+"["+(.@j+1)+"]") * @bought_quantity[.@i]);
  44. set @totalcost, @totalcost + @itemcost;
  45. break; }
  46. set .@j, .@j+2; }
  47. set .@i, .@i+1; }
  48. if (@totalcost > countitem(.Currency[@s])) dispbottom "You don't have enough "+getitemname(.Currency[@s])+".";
  49. else {
  50. set .@i,0;
  51. while (.@i < getarraysize(@bought_nameid)) {
  52. getitem @bought_nameid[.@i], @bought_quantity[.@i];
  53. dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+".";
  54. set .@i, .@i+1; }
  55. delitem .Currency[@s], @totalcost; }
  56. set @totalcost, 0;
  57. deletearray @bought_nameid[0], 128;
  58. deletearray @bought_quantity[0], 128;
  59. end;
  60.  
  61. OnInit:
  62.  
  63. // -------------------- Config 2 --------------------
  64. // Currency: The ID of each shop currency,
  65. // in the same order as the shops.
  66. // Shop order follows that of the select() call,
  67. // and is formatted "ID1,Count1,ID2,Count2,..."
  68.  
  69. setarray .Currency[1],513,513,513,513,513,513,513,513;
  70. setarray .Shop1[0],1202,5,1229,20;
  71. setarray .Shop2[0],5116,15;
  72. setarray .Shop3[0],2302,2,2348,30;
  73. setarray .Shop4[0],2502,2,2513,15,2523,15;
  74. setarray .Shop5[0],2441,15;
  75. setarray .Shop6[0],2199,32768;
  76. setarray .Shop7[0],4051,3,4285,6;
  77. setarray .Shop8[0],513,1,532,2,634,4;
  78.  
  79. // --------------------------------------------------
  80.  
  81. set .@i,1;
  82. while (.@i <= getarraysize(.Currency)) {
  83. set .@j,0;
  84. while (.@j < getarraysize(getd(".Shop"+.@i))) {
  85. npcshopdelitem "MSHOP"+.@i,512;
  86. npcshopadditem "MSHOP"+.@i, getd(".Shop"+.@i+"["+.@j+"]"), getd(".Shop"+.@i+"["+(.@j+1)+"]");
  87. set .@j, .@j+2; }
  88. set .@i, .@i+1; }
  89. end;
  90. }
Add Comment
Please, Sign In to add comment