Advertisement
Guest User

Code

a guest
Jan 13th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.93 KB | None | 0 0
  1. - shop quest_shop_1 -1,501:50
  2. quiz_test,314,134,5, script Coupon Shop 1 899,{
  3. set @i,0;
  4. mes "[Shop Quest NPC]";
  5. mes "Which item do you wish to obtain?";
  6. mes "Select only one.";
  7. callshop "quest_shop",1;
  8. npcshopattach "quest_shop";
  9. end;
  10.  
  11. OnBuyItem:
  12. if(.BuildQuest) {
  13. for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
  14. npcshopadditem "quest_shop",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"SZeny");
  15. setarray .Shop[.i],getarg(.e+2);
  16. set .i,.i+1;
  17. goto Quest_Setup;
  18. }
  19. if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
  20. for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
  21. mes "[Shop Quest NPC]";
  22. mes "I require the following:";
  23. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
  24. if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
  25. mes "^000000In exchange, I will give you:^0000FF";
  26. for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
  27. switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
  28. case 1:
  29. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
  30. next;
  31. mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
  32. mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
  33. close;
  34. }
  35. if(Zeny < getarg(@i)) {
  36. next;
  37. mes "You do not have enough Zeny.";
  38. mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
  39. close;
  40. }
  41. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
  42. set Zeny,Zeny-getarg(@i);
  43. for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
  44. if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all;
  45. close;
  46. case 2:
  47. set @bottomview, getlook(3);
  48. set @topview, getlook(4);
  49. set @midview, getlook(5);
  50. addtimer 1000, strnpcinfo(3)+"::On_Leave";
  51. set @equip,getiteminfo(@bought_nameid, 5);
  52. set @view, getiteminfo(@bought_nameid, 11);
  53. if(@equip != -1 && @view > 0) {
  54. if(@equip & 1) atcommand "@changelook 3 " + @view;
  55. if(@equip & 256) atcommand "@changelook 1 " + @view;
  56. if(@equip & 512) atcommand "@changelook 2 " + @view;
  57. }
  58. next;
  59. goto OnBuyItem;
  60. case 3:
  61. close;
  62. }
  63. On_Leave:
  64. atcommand "@changelook 1 " + @topview;
  65. atcommand "@changelook 2 " + @midview;
  66. atcommand "@changelook 3 " + @bottomview;
  67. set @equip,0;
  68. set @view,0;
  69. set @topview,0;
  70. set @midview,0;
  71. set @bottomview,0;
  72. end;
  73. OnInit:
  74. npcshopitem "quest_shop",0,0;
  75. set .BuildQuest,1;
  76. set .i,1;
  77. Quest_Setup:
  78. switch(.i) {
  79. default: set .BuildQuest,0; set .e,0; set .i,0; end;
  80. case 1: callsub OnBuyItem,7199,25,0,"Zeny",5301,1;
  81. case 2: callsub OnBuyItem,7199,25,0,"Zeny",5306,1;
  82. case 3: callsub OnBuyItem,7199,25,0,"Zeny",5307,1;
  83. case 4: callsub OnBuyItem,7199,25,0,"Zeny",5308,1;
  84. case 5: callsub OnBuyItem,7199,25,0,"Zeny",5310,1;
  85. case 6: callsub OnBuyItem,7199,25,0,"Zeny",5311,1;
  86. case 7: callsub OnBuyItem,7199,25,0,"Zeny",5312,1;
  87. case 8: callsub OnBuyItem,7199,25,0,"Zeny",5313,1;
  88. case 9: callsub OnBuyItem,7199,25,0,"Zeny",5314,1;
  89. case 10: callsub OnBuyItem,7199,25,0,"Zeny",5315,1;
  90. case 11: callsub OnBuyItem,7199,25,0,"Zeny",5316,1;
  91. case 12: callsub OnBuyItem,7199,25,0,"Zeny",5317,1;
  92. case 13: callsub OnBuyItem,7199,25,0,"Zeny",5318,1;
  93. case 14: callsub OnBuyItem,7199,25,0,"Zeny",5319,1;
  94. case 15: callsub OnBuyItem,7199,25,0,"Zeny",5320,1;
  95. case 16: callsub OnBuyItem,7199,25,0,"Zeny",5321,1;
  96. case 17: callsub OnBuyItem,7199,25,0,"Zeny",5322,1;
  97. case 18: callsub OnBuyItem,7199,25,0,"Zeny",5324,1;
  98. case 19: callsub OnBuyItem,7199,25,0,"Zeny",5333,1;
  99. case 20: callsub OnBuyItem,7199,25,0,"Zeny",5334,1;
  100. case 21: callsub OnBuyItem,7199,25,0,"Zeny",5335,1;
  101. case 22: callsub OnBuyItem,7199,25,0,"Zeny",5336,1;
  102. case 23: callsub OnBuyItem,7199,25,0,"Zeny",5337,1;
  103. case 24: callsub OnBuyItem,7199,25,0,"Zeny",5338,1;
  104. case 25: callsub OnBuyItem,7199,25,0,"Zeny",5339,1;
  105. case 26: callsub OnBuyItem,7199,25,0,"Zeny",5340,1;
  106. case 27: callsub OnBuyItem,7199,25,0,"Zeny",5341,1;
  107. case 28: callsub OnBuyItem,7199,25,0,"Zeny",5342,1;
  108. case 29: callsub OnBuyItem,7199,25,0,"Zeny",5343,1;
  109. case 30: callsub OnBuyItem,7199,25,0,"Zeny",5344,1;
  110. case 31: callsub OnBuyItem,7199,25,0,"Zeny",5345,1;
  111. case 32: callsub OnBuyItem,7199,25,0,"Zeny",5346,1;
  112. case 33: callsub OnBuyItem,7199,25,0,"Zeny",5354,1;
  113. case 34: callsub OnBuyItem,7199,25,0,"Zeny",5355,1;
  114. case 35: callsub OnBuyItem,7199,25,0,"Zeny",5357,1;
  115. case 36: callsub OnBuyItem,7199,25,0,"Zeny",5358,1;
  116. case 37: callsub OnBuyItem,7199,25,0,"Zeny",5359,1;
  117. case 38: callsub OnBuyItem,7199,25,0,"Zeny",5360,1;
  118. case 39: callsub OnBuyItem,7199,25,0,"Zeny",5361,1;
  119. case 40: callsub OnBuyItem,7199,25,0,"Zeny",5362,1;
  120. case 41: callsub OnBuyItem,7199,25,0,"Zeny",5363,1;
  121. case 42: callsub OnBuyItem,7199,25,0,"Zeny",5364,1;
  122. case 43: callsub OnBuyItem,7199,25,0,"Zeny",5365,1;
  123. case 44: callsub OnBuyItem,7199,25,0,"Zeny",5366,1;
  124. case 45: callsub OnBuyItem,7199,25,0,"Zeny",5367,1;
  125. case 46: callsub OnBuyItem,7199,25,0,"Zeny",5370,1;
  126. case 47: callsub OnBuyItem,7199,25,0,"Zeny",5371,1;
  127. case 48: callsub OnBuyItem,7199,25,0,"Zeny",5372,1;
  128. case 49: callsub OnBuyItem,7199,25,0,"Zeny",5373,1;
  129. case 50: callsub OnBuyItem,7199,25,0,"Zeny",5374,1;
  130. }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement