nguild_treas.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //===== rAthena Script =======================================
  2. //= War of Emperium Treasure Rooms for NGuild Guild Castles
  3. //===== By: ==================================================
  4. //= kobra_k88
  5. //===== Current Version: =====================================
  6. //= 1.3b
  7. //===== Compatible With: =====================================
  8. //= rAthena Project; RO Episode 4+
  9. //===== Description: =========================================
  10. //=
  11. //===== Additional Comments: =================================
  12. //= Based off existing guild scripts. Do not know if it is accurate.[kobra_k88]
  13. //= 1.2 Official treasure spawn [Lupus]
  14. //= 1.3 Added F_GldTreas function. (bugreport:1788) [L0ne_W0lf]
  15. //= 1.3b Added F_GldTreasSw function. (bugreport:3292) [brianluau]
  16. //============================================================
  17. //================================================
  18. // Treasure Spawning Function
  19. //================================================
  20. function script F_GldTreas {
  21. .@map$ = getarg(0);
  22. if(getarg(10) != 1) {
  23. setcastledata .@map$,4,0;
  24. setcastledata .@map$,5,0;
  25. // Why on earth are we killing old treasure chest spawns?
  26. //killmonster .@map$,"Treasure_"+getarg(1)+"::OnDied";
  27. // Don't spawn treasures if Castle is empty, or Eco is greater than 100
  28. if(getcastledata(.@map$,2) > 100 || getcastledata(.@map$,1) == 0) return;
  29. // Only spawn one treasure chest for novice castles.
  30. if (compare(.@map$,"nguild"))
  31. set getarg(2),1;
  32. else
  33. set getarg(2),getcastledata(.@map$,2)/5+4;
  34. if (getarg(2) <= 0) return;
  35. //sets the counter variable = to the box number amount
  36. set getarg(3), getarg(2);
  37. }
  38. for (set .@i,1; .@i <= getarg(3) ; set .@i,.@i+1) {
  39. // set treasure box ID
  40. set getarg(4), getarg(5) + (.@i+1) % 2;
  41. areamonster .@map$,getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  42. }
  43. return;
  44. }
  45. //==============================================================
  46. // Treasure Room Switch
  47. //===============================================================
  48. function script F_GldTreasSw {
  49. mes " ";
  50. mes "There's a small lever. Will you pull it?";
  51. next;
  52. if (select("Pull.:Do not.") == 1) {
  53. warp getarg(0),getarg(1),getarg(2);
  54. return;
  55. }
  56. close;
  57. }
  58. //<=============================== Castle 1 =================================>\\
  59. // Treasure Spawn -----------------------
  60. nguild_alde,1,1,1 script Treasure_N01 -1,{
  61. OnRecvCastleN01:
  62. end;
  63. OnInit:
  64. if($boxNumN01 == 0) end;
  65. set $@bxN01, $boxNumN01;
  66. callfunc "F_GldTreas","nguild_alde","N01",$boxNumN01,$@bxN01,$@boxIdN01,1324+rand(10),114,218,123,227,1;
  67. end;
  68. OnDied:
  69. mapannounce "nguild_alde","Treasure Chest Broken Open",17;
  70. set $boxNumN01, $boxNumN01 -1;
  71. if($boxNumN01 == 0) mapannounce "nguild_alde", "All of the treasure boxes have been opened. You must wait untill the next day for them to appear again.",0;
  72. end;
  73. }
  74. // Treasure Room Switch --------------------
  75. nguild_alde,123,223,0 script Switch#TresN01 111,{
  76. callfunc "F_GldTreasSw", "nguild_alde",218,176;
  77. end;
  78. }
  79. //<================================ Castle 2 ================================>\\
  80. // Treasure Spawn ----------------------------
  81. nguild_gef,1,1,1 script Treasure_N02 -1,{
  82. OnRecvCastleN02:
  83. end;
  84. OnInit:
  85. if($boxNumN02 == 0) end;
  86. set $@bxN02, $boxNumN02;
  87. callfunc "F_GldTreas","nguild_gef","N02",$boxNumN02,$@bxN02,$@boxIdN02,1334+rand(10),150,108,158,114,1;
  88. end;
  89. OnDied:
  90. mapannounce "nguild_gef","Treasure Chest Broken Open",17;
  91. set $boxNumN02, $boxNumN02 -1;
  92. if($boxNumN02 == 0) mapannounce "nguild_gef", "All of the treasure boxes have been opened. You must wait untill the next day for them to appear again.",0;
  93. end;
  94. }
  95. // Room Switch ---------------------------------------------------------
  96. nguild_gef,152,117,0 script Switch#TresN02 111,{
  97. callfunc "F_GldTreasSw","nguild_gef",40,49;
  98. end;
  99. }
  100. //<================================ Castle 3 ================================>\\
  101. // Treasure Spawn ---------------------------
  102. nguild_pay,1,1,0 script Treasure_N03 -1,{
  103. OnRecvCastleN03:
  104. end;
  105. OnInit:
  106. if($boxNumN03 == 0) end;
  107. set $@bxN03, $boxNumN03;
  108. callfunc "F_GldTreas","nguild_pay","N03",$boxNumN03,$@bxN03,$@boxIdN03,1344+rand(10),286,4,295,13,1;
  109. end;
  110. OnDied:
  111. mapannounce "nguild_pay","Treasure Chest Broken Open",17;
  112. set $boxNumN03, $boxNumN03 -1;
  113. if($boxNumN03 == 0) mapannounce "nguild_pay", "All of the treasure boxes have been opened. You must wait untill the next day for them to appear again.",0;
  114. end;
  115. }
  116. // Treasure Room Switch ---------------------------------------------------
  117. nguild_pay,295,8,0 script Switch#TresN03 111,{
  118. callfunc "F_GldTreasSw", "nguild_pay",120,59;
  119. end;
  120. }
  121. //<================================ Castle 4 ================================>\\
  122. // Treasure Spawn -------------------------------
  123. nguild_prt,1,1,0 script Treasure_N04 -1,{
  124. OnRecvCastleN04:
  125. end;
  126. OnInit:
  127. if($boxNumN04 == 0) end;
  128. set $@bxN04, $boxNumN04;
  129. callfunc "F_GldTreas","nguild_prt","N04",$boxNumN04,$@bxN04,$@boxIdN04,1354+rand(10),6,204,15,213,1;
  130. end;
  131. OnDied:
  132. mapannounce "nguild_prt","Treasure Chest Broken Open",17;
  133. set $boxNumN04, $boxNumN04 -1;
  134. if($boxNumN04 == 0) mapannounce "nguild_prt", "All of the treasure boxes have been opened. You must wait untill the next day for them to appear again.",0;
  135. end;
  136. }
  137. // Treasure Room Switch ----------------------------------------------------
  138. nguild_prt,15,209,0 script Switch#TresN04 111,{
  139. callfunc "F_GldTreasSw", "nguild_prt",109,179;
  140. end;
  141. }