gldfunc_treasure.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Treasure Room Functions
  3. //===== By: ==================================================
  4. //= holyAngelX (1.0) Akaru and ho|yAnge|X (1.1)
  5. //===== Current Version: =====================================
  6. //= 1.9
  7. //===== Compatible With: =====================================
  8. //= eAthena 1+; RO Episode 4+
  9. //===== Description: =========================================
  10. //= F_GldTreas spawns treasure chests used by the guild master.
  11. //= F_GldTreasSw allows the player to get out of the treasure room.
  12. //= F_TreasProtect removes non-guild master players from treasure room.
  13. //==============================================
  14. //= Break down of arguments used in the F_GldTreas:
  15. //= arg(0): name of guild castle
  16. //= arg(1): name of script that called the function
  17. //= arg(2): the box number amount
  18. //= arg(3): temp variable (count)
  19. //= arg(4): temp variable (box/monster id#)
  20. //= arg(5): box/monster id#
  21. //= arg(6): x1 coordinate for areamonster call
  22. //= arg(7): y1 coordinate for areamonster call
  23. //= arg(8): x2 coordinate for areamonster call
  24. //= arg(9): y1 coordinate for areamonster call
  25. //=
  26. //= Break down of arguments used in the F_GldTreasSw:
  27. //= arg(0): name of guild castle.
  28. //= arg(1): x1 coordinate for warp back to guild castle
  29. //= arg(2): y1 coordinate for warp back to guild castle
  30. //
  31. //= Break down of arguments used in the F_TreasProtect:
  32. //= arg(0): name of guild castle.
  33. //= arg(1): name of warp-to city
  34. //= arg(2): x1 coordinate for warp-to city
  35. //= arg(3): y1 coordinate for warp-to city
  36. //===== Additional Comments: =================================
  37. //= 1.2 Treasure room Spawn, and Treasure room Switch scripts now use these functions.[kobra_k88]
  38. //= 1.2a Function now returns to script that called it. Removed TreasureSpawn2.
  39. //= Changed back to using specific global variables for number of boxes and the box id. [kobra_k88]
  40. //= 1.2b Added a check to allow un broken treasure chests to respawn after map server restart.[kobra_k88]
  41. //= 1.3 Fixed treasure boxes spawn. (Unrolled one loop a bit) [Lupus]
  42. //= 1.4 New number of Treasure Boxes per castle: 25 at 100 Economic pts [Lupus]
  43. //= So you get your first chest only when your Economic Pts >= 4
  44. //= 1.5 Fixed treasure number 'round exploit' [Lupus]
  45. //= 1.6 to Aegis X.2 formula 4..24 Treasure Chests [Lupus]
  46. //= 1.7 Box Count fix by Zoc. Now it spawns 1st/2nd Treasure Chest 50%/50% [Lupus]
  47. //= 1.8 Official Treasure Spawn in Novice Castles. Had to add +1 in odd/even formula to leave correct ID of NG Treasure Box 8) [Lupus]
  48. //= 1.9 Added F_TreasProtect to remove players who are not guild master from treasure room. [L0ne_W0lf]
  49. //============================================================
  50. //================================================
  51. // Treasure Spawning Function
  52. //================================================
  53. function script F_GldTreas {
  54. if(getarg(10) == 1) goto L_SPAWN;
  55. setcastledata getarg(0),4,0;
  56. setcastledata getarg(0),5,0;
  57. killmonster getarg(0),"Treasure_"+getarg(1)+"::OnDied";
  58. if(GetCastleData(getarg(0),2) > 100 || GetCastleData(getarg(0),1) == 0) return;
  59. //sets the counter variable = to the box number amount
  60. if(getarg(0) == "nguild_prt" || getarg(0) == "nguild_alde" || getarg(0) == "nguild_gef" || getarg(0) == "nguild_pay" ) {
  61. //Novice Castles can't have more than 1 Treasure Chest
  62. set getarg(2),1;
  63. }else{
  64. set getarg(2),GetCastleData(getarg(0),2)/5+4;
  65. }
  66. if (getarg(2) <= 0) return;
  67. set getarg(3), getarg(2); //sets the counter variable = to the box number amount
  68. L_SPAWN:
  69. set getarg(4), getarg(5)+((getarg(3)+1) & 1); //sets the box id variable = to the box id
  70. areamonster getarg(0),getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
  71. set getarg(3), getarg(3) - 1;
  72. if(getarg(3) > 0) goto L_SPAWN;
  73. return;
  74. }
  75. //==============================================================
  76. // Treasure Room Switch
  77. //===============================================================
  78. function script F_GldTreasSw {
  79. mes " ";
  80. mes "There is little switch over here";
  81. mes "Would you like to pull the switch down?";
  82. next;
  83. menu "Yes",M_1,"No",-;
  84. close;
  85. M_1:
  86. warp getarg(0),getarg(1),getarg(2);
  87. return;
  88. }
  89. //==============================================================
  90. // Treasure Room Protrection
  91. //===============================================================
  92. function script F_TreasProtect {
  93. if (strcharinfo(0) != getguildmaster( GetCastleData(getarg(0),1) )) warp getarg(1),getarg(2),getarg(3);
  94. }