item_signer.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //===== rAthena Script =======================================
  2. //= Sign Your Items
  3. //===== By: ==================================================
  4. //= Lupus
  5. //===== Current Version: =====================================
  6. //= 1.1a
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Write you name on your rare equipment or weapon ^_-
  11. //===== Additional Comments: =================================
  12. //= 1.1 Cleaned and edited for general use. [Euphy]
  13. //= 1.1a Added 'disable_items' command. [Euphy]
  14. //============================================================
  15. prt_in,24,61,7 script Perchik 47,{
  16. setarray .@Item[0],644,3; // Item requirements: <ID>,<Count>{,...} (0 to disable)
  17. setarray .@Cost[0],0,5000; // Zeny requirements: <base price>,<price per refine>
  18. disable_items;
  19. mes "[Perchik]";
  20. mes "I can ^0055FFsign your name^000000 on almost any rare item you hold.";
  21. next;
  22. if(select("Tell me more...:Sign my items, please!") == 1) {
  23. mes "[Perchik]";
  24. mes "I can put your name on any slotless equipment or weapon.";
  25. emotion ET_AHA;
  26. next;
  27. mes "[Perchik]";
  28. if (getarraysize(.@Item) || getarraysize(.@Cost)) {
  29. mes "For my work I accept:";
  30. if (getarraysize(.@Item)) for(set .@i,0; .@i<getarraysize(.@Item); set .@i,.@i+2)
  31. mes " ~ "+.@Item[.@i+1]+"x "+getitemname(.@Item[.@i]);
  32. if (.@Cost[0]) mes " ~ "+callfunc("F_InsertComma",.@Cost[0])+" Zeny";
  33. if (.@Cost[1]) mes " ~ "+callfunc("F_InsertComma",.@Cost[1])+" Zeny per refine";
  34. }
  35. else mes "I work for free, but...";
  36. next;
  37. emotion ET_CRY;
  38. mes "[Perchik]";
  39. mes "Alas, I have 12 hungry children";
  40. mes "and a very angry wife.";
  41. next;
  42. mes "[Perchik]";
  43. mes "Or it was 12 angry children";
  44. mes "and a very hungry wife...";
  45. emotion ET_SCRATCH;
  46. close;
  47. }
  48. mes "[Perchik]";
  49. mes "Show me your items to sign...";
  50. next;
  51. setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
  52. for (set .@i,1; .@i<=10; set .@i,.@i+1) {
  53. if (getequipisequiped(.@indices[.@i]))
  54. set .@menu$, .@menu$ + F_getpositionname(.@indices[.@i]) +" [^0055FF"+getequipname(.@indices[.@i])+"^000000]";
  55. set .@menu$, .@menu$+":";
  56. }
  57. set .@part, .@indices[ select(.@menu$) ];
  58. set .@id, getequipid(.@part);
  59. set .@ref, getequiprefinerycnt(.@part);
  60. mes "[Perchik]";
  61. if (!getequipisequiped(.@part)) {
  62. mes "Nothing is equipped there!";
  63. emotion ET_KEK;
  64. close;
  65. }
  66. for(set .@i,0; .@i<4; set .@i,.@i+1)
  67. set .@slot[.@i], getequipcardid(.@part,.@i);
  68. if (.@slot[0]==255 || .@slot[0]==254 || .@slot[0]<0) {
  69. mes "Alas, this item's already signed.";
  70. mes "I would never touch a master's work.";
  71. emotion ET_SCRATCH;
  72. close;
  73. }
  74. if (.@slot[0]>4000 && .@slot[0]<5000) {
  75. mes "A card? Here?!";
  76. mes "As I said before, I don't sign items with cards.";
  77. emotion ET_SCRATCH;
  78. close;
  79. }
  80. if (getiteminfo(.@id,10)) {
  81. mes "Sorry, I don't sign slotted items.";
  82. emotion ET_SORRY;
  83. close;
  84. }
  85. getinventorylist;
  86. for(set .@i,0; .@i<@inventorylist_count; set .@i,.@i+1)
  87. if (@inventorylist_expire[.@i] != 0) {
  88. mes "Sorry, I don't sign rental items!";
  89. emotion ET_SCRATCH;
  90. close;
  91. }
  92. set .@price, .@Cost[0]+(.@Cost[1]*.@ref);
  93. if (getarraysize(.@Item) || .@price) {
  94. mes "I will need:";
  95. if (getarraysize(.@Item)) for(set .@i,0; .@i<getarraysize(.@Item); set .@i,.@i+2) {
  96. mes " ~ "+.@Item[.@i+1]+"x "+getitemname(.@Item[.@i]);
  97. if (countitem(.@Item[.@i]) < .@Item[.@i+1]) set .@nr,1;
  98. }
  99. if (.@price) mes " ~ "+.@price+" Zeny";
  100. }
  101. mes "Shall I sign your ^0055FF"+getitemname(.@id)+"^000000?";
  102. next;
  103. if(select("Ok!:Leave")==2) {
  104. mes "[Perchik]";
  105. mes "See you...";
  106. emotion ET_SLEEPY;
  107. close;
  108. }
  109. mes "[Perchik]";
  110. if (Zeny < .@price || .@nr) {
  111. mes "I don't work for 'thanks'.";
  112. emotion ET_SORRY;
  113. close;
  114. }
  115. if (!countitem2(.@id,1,.@ref,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3])) {
  116. mes "Where is "+getitemname(@id)+"...?";
  117. npctalk "Perchik : You're a snoozy cheater!";
  118. logmes "Hack: Tried to sign an item not having it: "+getitemname(@id);
  119. emotion ET_KEK;
  120. close;
  121. }
  122. if (.@price) set Zeny, Zeny-.@price;
  123. if (getarraysize(.@Item)) for(set .@i,0; .@i<getarraysize(.@Item); set .@i,.@i+2)
  124. delitem .@Item[.@i], .@Item[.@i+1];
  125. delitem2 .@id,1,1,.@ref,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3];
  126. mes "Done!";
  127. emotion ET_OK;
  128. getitem2 .@id,1,1,.@ref,0,254,0,getcharid(0)&0xffff,(getcharid(0)>>16)&0xffff;
  129. equip .@id;
  130. close;
  131. }