nguild_treas.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 0.1+; 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. if(getarg(10) != 1) {
  22. setcastledata getarg(0),4,0;
  23. setcastledata getarg(0),5,0;
  24. // Why on earth are we killing old treasure chest spawns?
  25. //killmonster getarg(0),"Treasure_"+getarg(1)+"::OnDied";
  26. // Don't spawn treasures if Castle is empty, or Eco is greater than 100
  27. if(GetCastleData(getarg(0),2) > 100 || GetCastleData(getarg(0),1) == 0) return;
  28. // Only spawn one treasure chest for novice castles.
  29. if (compare(getarg(0),"nguild"))
  30. set getarg(2),1;
  31. else
  32. set getarg(2),GetCastleData(getarg(0),2)/5+4;
  33. if (getarg(2) <= 0) return;
  34. //sets the counter variable = to the box number amount
  35. set getarg(3), getarg(2);
  36. }
  37. for (set .@i,1; .@i <= getarg(3) ; set .@i,.@i+1) {
  38. // set treasure box ID
  39. set getarg(4), getarg(5) + (.@i+1) % 2;
  40. areamonster getarg(0),getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  41. }
  42. return;
  43. }
  44. //==============================================================
  45. // Treasure Room Switch
  46. //===============================================================
  47. function script F_GldTreasSw {
  48. mes " ";
  49. mes "There's a small lever. Will you pull it?";
  50. next;
  51. if (select("Pull.:Do not.") == 1) {
  52. warp getarg(0),getarg(1),getarg(2);
  53. return;
  54. }
  55. close;
  56. }
  57. //<=============================== Castle 1 =================================>\\
  58. // Treasure Spawn -----------------------
  59. nguild_alde,1,1,1 script Treasure_N01 -1,{
  60. OnRecvCastleN01:
  61. end;
  62. OnInit:
  63. if($boxNumN01 == 0) end;
  64. set $@bxN01, $boxNumN01;
  65. callfunc "F_GldTreas","nguild_alde","N01",$boxNumN01,$@bxN01,$@boxIdN01,1324+rand(10),114,218,123,227,1;
  66. end;
  67. OnDied:
  68. mapannounce "nguild_alde","Treasure Chest Broken Open",17;
  69. set $boxNumN01, $boxNumN01 -1;
  70. 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;
  71. end;
  72. }
  73. // Treasure Room Switch --------------------
  74. nguild_alde,123,223,0 script Switch#TresN01 111,{
  75. callfunc "F_GldTreasSw", "nguild_alde",218,176;
  76. end;
  77. }
  78. //<================================ Castle 2 ================================>\\
  79. // Treasure Spawn ----------------------------
  80. nguild_gef,1,1,1 script Treasure_N02 -1,{
  81. OnRecvCastleN02:
  82. end;
  83. OnInit:
  84. if($boxNumN02 == 0) end;
  85. set $@bxN02, $boxNumN02;
  86. callfunc "F_GldTreas","nguild_gef","N02",$boxNumN02,$@bxN02,$@boxIdN02,1334+rand(10),150,108,158,114,1;
  87. end;
  88. OnDied:
  89. mapannounce "nguild_gef","Treasure Chest Broken Open",17;
  90. set $boxNumN02, $boxNumN02 -1;
  91. 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;
  92. end;
  93. }
  94. // Room Switch ---------------------------------------------------------
  95. nguild_gef,152,117,0 script Switch#TresN02 111,{
  96. callfunc "F_GldTreasSw","nguild_gef",40,49;
  97. end;
  98. }
  99. //<================================ Castle 3 ================================>\\
  100. // Treasure Spawn ---------------------------
  101. nguild_pay,1,1,0 script Treasure_N03 -1,{
  102. OnRecvCastleN03:
  103. end;
  104. OnInit:
  105. if($boxNumN03 == 0) end;
  106. set $@bxN03, $boxNumN03;
  107. callfunc "F_GldTreas","nguild_pay","N03",$boxNumN03,$@bxN03,$@boxIdN03,1344+rand(10),286,4,295,13,1;
  108. end;
  109. OnDied:
  110. mapannounce "nguild_pay","Treasure Chest Broken Open",17;
  111. set $boxNumN03, $boxNumN03 -1;
  112. 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;
  113. end;
  114. }
  115. // Treasure Room Switch ---------------------------------------------------
  116. nguild_pay,295,8,0 script Switch#TresN03 111,{
  117. callfunc "F_GldTreasSw", "nguild_pay",120,59;
  118. end;
  119. }
  120. //<================================ Castle 4 ================================>\\
  121. // Treasure Spawn -------------------------------
  122. nguild_prt,1,1,0 script Treasure_N04 -1,{
  123. OnRecvCastleN04:
  124. end;
  125. OnInit:
  126. if($boxNumN04 == 0) end;
  127. set $@bxN04, $boxNumN04;
  128. callfunc "F_GldTreas","nguild_prt","N04",$boxNumN04,$@bxN04,$@boxIdN04,1354+rand(10),6,204,15,213,1;
  129. end;
  130. OnDied:
  131. mapannounce "nguild_prt","Treasure Chest Broken Open",17;
  132. set $boxNumN04, $boxNumN04 -1;
  133. 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;
  134. end;
  135. }
  136. // Treasure Room Switch ----------------------------------------------------
  137. nguild_prt,15,209,0 script Switch#TresN04 111,{
  138. callfunc "F_GldTreasSw", "nguild_prt",109,179;
  139. end;
  140. }