CashShop_Functions.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. //===== rAthena Script =======================================
  2. //= Cash Shop Functions
  3. //===== By: ==================================================
  4. //= L0ne_W0lf
  5. //===== Current Version: =====================================
  6. //= 1.8
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Used for Cash shop items:
  11. //= - Kafra Card
  12. //= - Giant Fly Wing
  13. //= - Neuralizer
  14. //= - Dungeon Teleport Scroll
  15. //= Also included are functions related to the VIP system.
  16. //===== Additional Comments: =================================
  17. //= 1.0 First version. [L0ne_W0lf]
  18. //= F_CashPartyCall Optimized by Trancid.
  19. //= 1.1 Updated Dungeon Teleport Scroll. [L0ne_W0lf]
  20. //= Added Town Teleport Scroll Function
  21. //= Added Seige Teleport Scroll Function
  22. //= 1.2 Updated the dungeon teleport scroll menu. [L0ne_w0lf]
  23. //= 1.3 Implemented Aozi Giant Flywing Fix. (bugreport:4242) [L0ne_w0lf]
  24. //= 1.4 Simplified Giant Flywing function using warpparty. [L0ne_w0lf]
  25. //= 1.5 Neuralizer is no longer consumed upon failure. [Euphy]
  26. //= 1.6 Updated Teleport functions and added Curious_Snowball. [Euphy]
  27. //= 1.7 Added Dungeon Teleport Scroll II maps. [Euphy]
  28. //= 1.8 Added VIP function. [Euphy]
  29. //= 1.9 Added checkdragon() in F_CashReset. [Capuche]
  30. //= 2.0 Moved VIP_Third_Class function into other/re/CashShop_Functions. [Capuche]
  31. //============================================================
  32. // Kafra Card
  33. //============================================================
  34. // - Open player's storage.
  35. // - No arguments.
  36. function script F_CashStore {
  37. cutin "kafra_01",2;
  38. mes "[Kafra Employee]";
  39. mes "Welcome to the Kafra Corporation.";
  40. mes "Here, let me open your Storage for you.";
  41. close2;
  42. openstorage;
  43. cutin "",255;
  44. return;
  45. }
  46. // Giant Fly Wing
  47. //============================================================
  48. // - Warp party leader to random spot on the map.
  49. // - Summon Party members on party leader map to a 3x3 location around the leader.
  50. // - No arguments.
  51. function script F_CashPartyCall {
  52. itemskill "AL_TELEPORT",1;
  53. sleep2 1; // a slight delay seems necessary after itemskill
  54. if (is_party_leader() == true)
  55. warpparty "Leader", 0, 0, getcharid(1), strcharinfo(3), 3, 3;
  56. return;
  57. }
  58. // Neuralizer
  59. //============================================================
  60. // - Reset players skills. Weight must be 0, options must be off.
  61. // - No arguments.
  62. function script F_CashReset {
  63. if (Class != Job_Novice && Weight == 0 && !checkriding() && !checkfalcon() && !checkcart() && !ismounting() && !checkdragon()) {
  64. resetskill;
  65. sc_end SC_ALL;
  66. if (countitem(12213)) delitem 12213,1;
  67. }
  68. return;
  69. }
  70. // Dungeon Teleport Scroll
  71. //============================================================
  72. // - Warp player to the selected dungeon.
  73. // - Arg(0) = type of scroll.
  74. function script F_CashDungeon {
  75. switch(getarg(0)) {
  76. case 1:
  77. switch(select("Nogg Road:Mjolnir Dead Pit:"+((checkre(0))?"":"Umbala Dungeon")+":Einbroch Mine Dungeon:Payon Dungeon:Toy Dungeon:Glast Heim Underprison:Luoyang Dungeon:Hermit's Checkers:Izlude Dungeon:Turtle Island Dungeon:Clock Tower B3f:Clock Tower 3f:Glast Heim Culvert 2f:Sphinx Dungeon 4f:Inside Pyramid 4f:Prontera Culvert 3f:Amatsu Dungeon 1f (Tatami Maze):Somatology Laboratory 1st floor:Ayothya Ancient Shrine 2nd floor")) {
  78. case 1: warp "mag_dun01",125,71; end; // Nogg Road
  79. case 2: warp "mjo_dun02",80,297; end; // Mjolnir Dead Pit
  80. case 3: warp "um_dun02",125,122; end; // Umbala Dungeon (Pre-Renewal only)
  81. case 4: warp "ein_dun01",261,262; end; // Einbroch Dungeon
  82. case 5: warp "pay_dun03",155,150; end; // Payon Caves
  83. case 6: warp "xmas_dun01",133,130; end; // Toy Factory
  84. case 7: warp "gl_prison",140,15; end; // Glast Heim Prison
  85. case 8: warp "lou_dun03",165,38; end; // Luoyang Dungeon
  86. case 9: warp "gon_dun02",251,263; end; // Kunlun Dungeon
  87. case 10: warp "iz_dun02",350,335; end; // Izlude Undersea Tunnel
  88. case 11: warp "tur_dun02",165,30; end; // Turtle Island
  89. case 12: warp "alde_dun03",275,180; end; // Clocktower 3F
  90. case 13: warp "c_tower3",34,42; end; // Clocktower B3F
  91. case 14: warp "gl_sew02",292,295; end; // Glast Heim Sewers 2F
  92. case 15: warp "in_sphinx4",120,120; end; // Sphinx Dungeon 4F
  93. case 16: warp "moc_pryd04",195,4; end; // Pyramid Dungeon 4F
  94. case 17: warp "prt_sewb3",20,175; end; // Prontera Culverts 3F
  95. case 18: warp "ama_dun01",222,144; end; // Amatsu Dungeon 1F
  96. case 19: warp "lhz_dun01",19,153; end; // Somatology Laboratory 1F
  97. case 20: warp "ayo_dun02",70,240; end; // Ayothaya Dungeon 2F
  98. }
  99. case 2: // Menu names are not official.
  100. switch(select("Thor Volcano 2f:Ice Dungeon Entrance:Nameless Island Entrance:Niflheim:Labyrinth Forest 2f:Ruins of Juperos Entrance:Ant Hell 2f:Kiel Hyre's Academy Entrance:Thanatos Tower Entrance:Abyss Lake Entrance:Rachel Sanctuary Entrance:Odin Temple 2f")) {
  101. case 1: warp "thor_v02",77,208; end; // Thor Volcano 2F
  102. case 2: warp "ra_fild01",237,333; end; // Ice Dungeon
  103. case 3: warp "ve_fild07",127,131; end; // Nameless Island
  104. case 4: warp "niflheim",206,179; end; // Niflheim
  105. case 5: warp "prt_maze02",100,174; end; // Labyrinth Forest F2
  106. case 6: warp "jupe_cave",36,54; end; // Juperos
  107. case 7: warp "anthell02",36,265; end; // Ant Hell F2
  108. case 8: warp "yuno_fild08",70,171; end; // Kiel Hyre's Academy
  109. case 9: warp "hu_fild01",140,160; end; // Thanatos Tower
  110. case 10: warp "hu_fild05",168,302; end; // Abyss Lake
  111. case 11: warp "ra_temple",117,173; end; // Rachel Sanctuary
  112. case 12: warp "odin_tem02",257,374; end; // Odin Temple F2
  113. }
  114. case 3:
  115. switch(select("Bio Lab (2nd Floor):Ice Dungeon (3rd Floor):Odin Temple (3rd Floor):Thor Volcano (3rd Floor):Abyss Lake (3rd Floor):Juperos Ruins (2nd Floor)")) {
  116. case 1: warp "lhz_dun02",145,149; end; // Somatology Laboratory 2F
  117. case 2: warp "ice_dun03",150,176; end; // Ice Dungeon 3F
  118. case 3: warp "odin_tem03",278,235; end; // Odin Temple 3F
  119. case 4: warp "thor_v03",144,170; end; // Thor Volcano 3F
  120. case 5: warp "abyss_03",97,104; end; // Abyss Lakes 3F
  121. case 6: warp "juperos_02",130,159; end; // Juperos Dungeon 2F
  122. }
  123. }
  124. return;
  125. }
  126. // Coloured Butterly Wings
  127. //============================================================
  128. // - Warp player to different cities acording to the scroll.
  129. // - Arg(0) = type of scroll.
  130. function script F_CashCity {
  131. switch(getarg(0)) {
  132. case 1: // Yellow - Rune-Midgarts
  133. switch(select("Prontera:Izlude:Geffen:Payon:Morocc:Alberta:Al de Baran")) {
  134. case 1: warp "prontera",122,87; end;
  135. case 2: if (checkre(0)) warp "izlude",130,90; else warp "izlude",91,105; end;
  136. case 3: warp "geffen",128,48; end;
  137. case 4: warp "payon",164,123; end;
  138. case 5: warp "morocc",160,100; end;
  139. case 6: warp "alberta",117,50; end;
  140. case 7: warp "aldebaran",140,110; end;
  141. }
  142. case 2: // Green - Schwarzwald
  143. switch(select("Juno:Lighthalzen:Einbroch:Einbech:Hugel")) {
  144. case 1: warp "yuno",160,170; end;
  145. case 2: warp "lighthalzen",190,310; end;
  146. case 3: warp "einbroch",230,190; end;
  147. case 4: warp "einbech",187,120; end;
  148. case 5: warp "hugel",92,165; end;
  149. }
  150. case 3: // Red - Arunafeltz
  151. switch(select("Rachel:Veins")) {
  152. case 1: warp "rachel",120,125; end;
  153. case 2: warp "veins",215,105; end;
  154. }
  155. case 4: // Blue - Islands
  156. switch(select("Amatsu:Kunlun:Ayothaya:Luoyang")) {
  157. case 1: warp "amatsu",110,140; end;
  158. case 2: warp "gonryun",160,115; end;
  159. case 3: warp "ayothaya",220,170; end;
  160. case 4: warp "louyang",217,95; end;
  161. }
  162. case 5: // Blue - Islands (Renewal)
  163. switch(select("Amatsu:Kunlun:Ayothaya:Luoyang:Moscovia:Dewata:Brasilis")) {
  164. case 1: warp "amatsu",110,140; end;
  165. case 2: warp "gonryun",160,115; end;
  166. case 3: warp "ayothaya",220,170; end;
  167. case 4: warp "louyang",217,95; end;
  168. case 5: warp "moscovia",224,195; end;
  169. case 6: warp "dewata",200,107; end;
  170. case 7: warp "brasilis",196,181; end;
  171. }
  172. }
  173. return;
  174. }
  175. // Teleport Scrolls
  176. //============================================================
  177. // - Warp player to save point or city acording to the scroll.
  178. // - Arg(0) = type of scroll.
  179. function script F_CashTele {
  180. switch(getarg(0)) {
  181. case 1:
  182. switch(select("Prontera:Geffen:Al de Baran:Izlude:Savepoint")) {
  183. case 1: warp "prontera",119,77; end;
  184. case 2: warp "geffen",119,39; end;
  185. case 3: warp "aldebaran",165,107; end;
  186. case 4: if (checkre(0)) warp "izlude",128,105; else warp "izlude",91,105; end;
  187. case 5: warp "SavePoint",0,0; end;
  188. }
  189. case 2:
  190. switch(select("Payon:Alberta:Morocc:Comodo:Savepoint")) {
  191. case 1: warp "payon",158,55; end;
  192. case 2: warp "alberta",115,57; end;
  193. case 3: warp "morocc",158,48; end;
  194. case 4: warp "comodo",217,148; end;
  195. case 5: warp "SavePoint",0,0; end;
  196. }
  197. case 3:
  198. switch(select("Luoyang:Amatsu:Kunlun Field:Ayothaya:Savepoint")) {
  199. case 1: warp "louyang",214,101; end;
  200. case 2: warp "amatsu",112,145; end;
  201. case 3: warp "gonryun",160,118; end;
  202. case 4: warp "ayothaya",216,175; end;
  203. case 5: warp "SavePoint",0,0; end;
  204. }
  205. case 4:
  206. switch(select("Lutie Field:Umbala:Niflheim:Savepoint")) {
  207. case 1: warp "xmas",148,131; end;
  208. case 2: warp "umbala",93,154; end;
  209. case 3: warp "niflheim",187,189; end;
  210. case 4: warp "SavePoint",0,0; end;
  211. }
  212. case 5:
  213. switch(select("Juno:Einbroch:Lighthalzen:Hugel:Savepoint")) {
  214. case 1: warp "yuno",157,124; end;
  215. case 2: warp "einbroch",230,192; end;
  216. case 3: warp "lighthalzen",158,94; end;
  217. case 4: warp "hugel",93,159; end;
  218. case 5: warp "SavePoint",0,0; end;
  219. }
  220. case 6:
  221. switch(select("Rachel:Veins:Savepoint")) {
  222. case 1: warp "rachel",118,132; end;
  223. case 2: warp "veins",214,125; end;
  224. case 3: warp "SavePoint",0,0; end;
  225. }
  226. }
  227. return;
  228. }
  229. // Siege Teleport Scroll
  230. //============================================================
  231. // - Warp player to selected guild castle.
  232. // - No arguments.
  233. function script F_CashSiegeTele {
  234. switch(select("Neuschwanstein (aldeg_cas01):Hohenschwangau (aldeg_cas02):Nuernberg (aldeg_cas03):Wuerzburg (aldeg_cas04):Rothenburg (aldeg_cas05):Repherion (gefg_cas01):Eeyorbriggar (gefg_cas02):Yesnelph (gefg_cas03):Bergel (gefg_cas04):Mersetzdeitz (gefg_cas05):Bright Arbor (payg_cas01):Sacred Altar (payg_cas02):Holy Shadow (payg_cas03):Scarlet Palace (payg_cas04):Bamboo Grove Hill (payg_cas05):Kriemhild (prtg_cas01):Swanhild (prtg_cas02):Fadhgridh (prtg_cas03):Skoegul (prtg_cas04):Gondul (prtg_cas05)")) {
  235. case 1: warp "alde_gld",48,91; end;
  236. case 2: warp "alde_gld",103,245; end;
  237. case 3: warp "alde_gld",142,87; end;
  238. case 4: warp "alde_gld",236,243; end;
  239. case 5: warp "alde_gld",269,90; end;
  240. case 6: warp "gef_fild13",217,75; end;
  241. case 7: warp "gef_fild13",307,237; end;
  242. case 8: warp "gef_fild13",77,297; end;
  243. case 9: warp "gef_fild13",190,276; end;
  244. case 10: warp "gef_fild13",312,91; end;
  245. case 11: warp "pay_gld",121,232; end;
  246. case 12: warp "pay_gld",297,116; end;
  247. case 13: warp "pay_gld",318,293; end;
  248. case 14: warp "pay_gld",140,164; end;
  249. case 15: warp "pay_gld",202,264; end;
  250. case 16: warp "prt_gld",141,64; end;
  251. case 17: warp "prt_gld",240,131; end;
  252. case 18: warp "prt_gld",153,133; end;
  253. case 19: warp "prt_gld",126,240; end;
  254. case 20: warp "prt_gld",195,240; end;
  255. }
  256. return;
  257. }
  258. // Curious Snowball
  259. //============================================================
  260. // - You can get an effect of Restore, Endure, or Wing of Butterfly.
  261. // - No arguments.
  262. function script F_Snowball {
  263. cutin "rutie_snownow03",2;
  264. mes "[Snowman]";
  265. mes "Merry Christmas!";
  266. switch(select("Restore Some HP/SP:Strengthen My Body!:Restore My SP Fully.:Return to Savepoint")) {
  267. case 1:
  268. mes "Aha!";
  269. mes "Quiet night~";
  270. percentheal 70,70;
  271. close2;
  272. cutin "",255;
  273. break;
  274. case 2:
  275. mes "Blessings.";
  276. mes "Holy night~";
  277. unitskilluseid getcharid(3),"SM_ENDURE",10;
  278. close2;
  279. cutin "",255;
  280. break;
  281. case 3:
  282. mes "Hey!";
  283. mes "White Christmas~";
  284. percentheal 0,100;
  285. close2;
  286. cutin "",255;
  287. break;
  288. case 4:
  289. mes "Jingle Bells~";
  290. mes "Jingle Bells~ Jingle Bells!";
  291. close2;
  292. cutin "",255;
  293. warp "SavePoint",0,0;
  294. break;
  295. }
  296. end;
  297. }
  298. // Status reduction potion
  299. //============================================================
  300. // - Permanently reduces base stat <type> by <val>.
  301. // - Returns status points equals to points needed to raise
  302. // that stat to original value.
  303. // - Doesn't work if base status <type> would become lower than 1 after reduction.
  304. // * callfunc("F_CashReduceStat",<type>{,<val>,<itemid>});
  305. function script F_CashReduceStat {
  306. .@type = getarg(0);
  307. .@amount = getarg(1, -1);
  308. .@itemid = getarg(2, 0);
  309. if((readparam(.@type) + .@amount) < 1) return;
  310. if(.@itemid) {
  311. if(countitem(.@itemid))
  312. delitem .@itemid,1;
  313. else
  314. return;
  315. }
  316. StatusPoint += needed_status_point(.@type, .@amount);
  317. statusup2 .@type,.@amount;
  318. return;
  319. }
  320. // Trait Status reduction potion
  321. //============================================================
  322. // - Permanently reduces base trait stat <type> by <val>.
  323. // - Returns trait status points equals to points needed to raise
  324. // that trait stat to original value.
  325. // - Doesn't work if base trait status <type> would become lower than 0 after reduction.
  326. // * callfunc("F_CashReduceTraitStat",<type>{,<val>,<itemid>});
  327. function script F_CashReduceTraitStat {
  328. .@type = getarg(0);
  329. .@amount = getarg(1, -1);
  330. .@itemid = getarg(2, 0);
  331. if((readparam(.@type) + .@amount) < 0) return;
  332. if(.@itemid) {
  333. if(countitem(.@itemid))
  334. delitem .@itemid,1;
  335. else
  336. return;
  337. }
  338. TraitPoint += needed_trait_point(.@type, .@amount);
  339. traitstatusup2 .@type,.@amount;
  340. return;
  341. }