Advertisement
Sehrentos

rAthena NPC script weekend leveling bonus

Oct 4th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Weekend level up bonus
  3. //===== By: ==================================================
  4. //= Sehrentos
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= On weekends boost base exp, job exp and drop rates.
  11. //= Can stack up to <.max_stack>
  12. //===== Additional Comments: =================================
  13. //= For Flags (bitmask) settings see: doc/script_commands.txt
  14. //= 1.0 Initial script.
  15. //============================================================
  16. - script #onpclvup -1,{
  17. OnInit:
  18. .duration = 60*60; // Duration in seconds
  19. .flags = 1024; // Flags (bitmask) 1024=Replace duplicate
  20. .type = 1; // Type 0)ignore 1)buff or 2)debuff
  21. .exp_rate = 100; // Bonus experience rates 0)disable
  22. .drop_rate = 10; // Bonus drop rates 0)disable
  23. .max_stack = 10; // Stack amount (10=1000%)
  24. .exp_icon = EFST_OVERSEAEXPUP; // Status Icon EFST_BLANK=None
  25. .drop_icon = EFST_PERIOD_RECEIVEITEM; // Status Icon EFST_BLANK=None
  26. end;
  27.  
  28. OnPCLoginEvent:
  29. // Only on specific date
  30. if (gettime(DT_DAYOFWEEK) == FRIDAY
  31. || gettime(DT_DAYOFWEEK) == SATURDAY
  32. || gettime(DT_DAYOFWEEK) == SUNDAY)
  33. {
  34. .@str$ = "";
  35. if (.exp_rate > 0) {
  36. .@str$ += " "+ .exp_rate +"% experience bonus when killing monsters" +
  37. " for "+ (.duration / 60) +" minutes!" +
  38. " This effect can stack up-to "+ (.max_stack * .exp_rate) +"% max!!";
  39. }
  40. if (.drop_rate > 0) {
  41. .@str$ += " "+ .drop_rate +"% drop rate from monsters" +
  42. " for "+ (.duration / 60) +" minutes!" +
  43. " This effect can stack up-to "+ (.max_stack * .drop_rate) +"% max!!";
  44. }
  45. // Announce player about the bonuses
  46. if (getstrlen(.@str$) > 0) {
  47. message strcharinfo(0), "Good weekend to you!"+
  48. " If you level up this weekend,"+
  49. " you will gain" + .@str$;
  50. }
  51. debugmes "Strlen: "+ getstrlen(.@str$);
  52. }
  53. end;
  54.  
  55. OnPCBaseLvUpEvent:
  56. OnPCJobLvUpEvent:
  57. // Only on specific dates
  58. if (gettime(DT_DAYOFWEEK) == FRIDAY
  59. || gettime(DT_DAYOFWEEK) == SATURDAY
  60. || gettime(DT_DAYOFWEEK) == SUNDAY)
  61. {
  62. // Max stack
  63. if (@onpclvup_active < .max_stack) {
  64. @onpclvup_active++;
  65. }
  66. // Reset if expired
  67. if (gettimetick(2) > @onpclvup_delay) {
  68. @onpclvup_active = 1;
  69. bonus_script_clear .flags;
  70. }
  71. @onpclvup_delay = gettimetick(2) + .duration;
  72. .@str$ = "";
  73. // Increase exp rates
  74. if (.exp_rate > 0) {
  75. .@min = .duration / 60;
  76. .@rate = @onpclvup_active * .exp_rate;
  77. bonus_script "{ bonus2 bExpAddRace,RC_ALL,"+ .@rate +"; }", .duration, .flags, .type, .exp_icon;
  78. .@str$ += " Your experience gained by killing monsters is now increased by "+ .@rate +"% for "+ .@min +" minutes!";
  79. }
  80. // Increase drop rates
  81. if (.drop_rate > 0) {
  82. .@min = .duration / 60;
  83. .@rate = @onpclvup_active * .drop_rate;
  84. bonus_script "{ bonus2 bDropAddRace,RC_ALL,"+ .@rate +"; }", .duration, .flags, .type, .drop_icon;
  85. .@str$ += " Your drop rate is now increased by "+ .@rate +"% for "+ .@min +" minutes!";
  86. }
  87. // Announce player untill at max stack
  88. if (@onpclvup_active < .max_stack) {
  89. message strcharinfo(0), "Congratulations!!"+ .@str$;
  90. }
  91. }
  92. end;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement