warc222

Bonus EXP/SP Day

Dec 25th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. diff --git a/game/src/main/java/com/l2jfrozen/configuration/GameServerConfig.java b/game/src/main/java/com/l2jfrozen/configuration/GameServerConfig.java
  2. index 34a7c87..549089c 100644
  3. --- a/game/src/main/java/com/l2jfrozen/configuration/GameServerConfig.java
  4. +++ b/game/src/main/java/com/l2jfrozen/configuration/GameServerConfig.java
  5. @@ -239,6 +239,10 @@
  6. //============================================================
  7. public static float RATE_XP;
  8. public static float RATE_SP;
  9. + public static boolean BONUS_DAY_ENABLED;
  10. + public static float BONUS_RATE_XP;
  11. + public static float BONUS_RATE_SP;
  12. + public static int BONUS_DAY;
  13. public static float RATE_PARTY_XP;
  14. public static float RATE_PARTY_SP;
  15. public static float RATE_QUESTS_REWARD;
  16. @@ -1511,6 +1515,10 @@
  17.  
  18. RATE_XP = configManager.getFloat("RateXp");
  19. RATE_SP = configManager.getFloat("RateSp");
  20. + BONUS_DAY_ENABLED = configManager.getBoolean("BonusDayEnabled");
  21. + BONUS_RATE_XP = configManager.getFloat("BonusDayXp");
  22. + BONUS_RATE_SP = configManager.getFloat("BonusDaySp");
  23. + BONUS_DAY = configManager.getInteger("BonusDay");
  24. RATE_PARTY_XP = configManager.getFloat("RatePartyXp");
  25. RATE_PARTY_SP = configManager.getFloat("RatePartySp");
  26. RATE_QUESTS_REWARD = configManager.getFloat("RateQuestsReward");
  27. diff --git a/game/src/main/java/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java b/game/src/main/java/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
  28. index 105e864..efa5b57 100644
  29. --- a/game/src/main/java/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
  30. +++ b/game/src/main/java/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
  31. @@ -61,6 +61,7 @@
  32. import org.omg.PortableServer.POAManagerPackage.State;
  33.  
  34. import java.text.DateFormat;
  35. +import java.util.Calendar;
  36. import java.util.List;
  37.  
  38. import static com.l2jfrozen.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE;
  39. @@ -2582,6 +2583,39 @@
  40. player.sendPacket(ActionFailed.STATIC_PACKET);
  41. }
  42.  
  43. + private int isBonusDay(){
  44. + boolean bonusEnabled = GameServerConfig.BONUS_DAY_ENABLED;
  45. + int day = GameServerConfig.BONUS_DAY;
  46. + int isDay = 0;
  47. +
  48. + if(bonusEnabled){
  49. + switch(day){
  50. + case 0:
  51. + isDay = Calendar.SUNDAY;
  52. + break;
  53. + case 1:
  54. + isDay = Calendar.MONDAY;
  55. + break;
  56. + case 2:
  57. + isDay = Calendar.TUESDAY;
  58. + break;
  59. + case 3:
  60. + isDay = Calendar.WEDNESDAY;
  61. + break;
  62. + case 4:
  63. + isDay = Calendar.THURSDAY;
  64. + break;
  65. + case 5:
  66. + isDay = Calendar.FRIDAY;
  67. + break;
  68. + case 6:
  69. + isDay = Calendar.SATURDAY;
  70. + break;
  71. + }
  72. + }
  73. + return isDay;
  74. + }
  75. +
  76. /**
  77. * Return the Exp Reward of this L2NpcInstance contained in the L2NpcTemplate (modified by RATE_XP).<BR>
  78. * <BR>
  79. @@ -2590,7 +2624,10 @@
  80. */
  81. public int getExpReward() {
  82. double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  83. - return (int) (getTemplate().rewardExp * rateXp * GameServerConfig.RATE_XP);
  84. + if(isBonusDay() == 0)
  85. + return (int) (getTemplate().rewardExp * rateXp * GameServerConfig.RATE_XP);
  86. + else
  87. + return (int) (getTemplate().rewardExp * rateXp * GameServerConfig.BONUS_RATE_XP);
  88. }
  89.  
  90. /**
  91. @@ -2601,7 +2638,10 @@
  92. */
  93. public int getSpReward() {
  94. double rateSp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
  95. - return (int) (getTemplate().rewardSp * rateSp * GameServerConfig.RATE_SP);
  96. + if(isBonusDay() == 0)
  97. + return (int) (getTemplate().rewardSp * rateSp * GameServerConfig.RATE_SP);
  98. + else
  99. + return (int) (getTemplate().rewardSp * rateSp * GameServerConfig.BONUS_RATE_SP);
  100. }
  101.  
  102. /**
  103. diff --git a/game/src/main/resources/config/head/rates.properties b/game/src/main/resources/config/head/rates.properties
  104. index 2c43a23..3673a6e 100644
  105. --- a/game/src/main/resources/config/head/rates.properties
  106. +++ b/game/src/main/resources/config/head/rates.properties
  107. @@ -18,6 +18,17 @@
  108. RateDropManor = 1
  109.  
  110. # ----------------------
  111. +# Bonus Day
  112. +# ----------------------
  113. +# Players will get extra exp/sp on a specific day if set to True
  114. +BonusDayEnabled = False
  115. +BonusDayXp = 2.00
  116. +BonusDaySp = 2.00
  117. +# Set the day that the bonus will be applied
  118. +# Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6
  119. +BonusDay = 0
  120. +
  121. +# ----------------------
  122. # Other Rates -
  123. # ----------------------
  124. RateDropQuest = 1.00
Advertisement
Add Comment
Please, Sign In to add comment