From 658da7c898bb18586a4fdf99498c102f198fced0 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 1 Jan 2021 11:47:07 +0000 Subject: [PATCH] Store last level that mentee was rewarded. --- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- .../game/data/scripts/ai/others/MentorGuide/MentorGuide.java | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 9a88629564..d9e96bfad4 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -106,6 +106,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -517,8 +518,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 9a88629564..d9e96bfad4 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -106,6 +106,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -517,8 +518,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 9a88629564..d9e96bfad4 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -106,6 +106,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -517,8 +518,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 9a88629564..d9e96bfad4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -106,6 +106,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -517,8 +518,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 317f084224..04f5a4c307 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -104,6 +104,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -515,8 +516,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 317f084224..04f5a4c307 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -104,6 +104,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -515,8 +516,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 2c891425d6..30996949d0 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -103,6 +103,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -508,8 +509,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 2c891425d6..30996949d0 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -103,6 +103,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -508,8 +509,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } } diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java index 579e1b2489..76bc0ac69d 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/MentorGuide/MentorGuide.java @@ -104,6 +104,7 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader private static final String MENTEE_ADDED_BODY = "Greetings. This is the Mentor Guide.\n\nYou will experience a world of unlimited adventures with your mentor, Exciting, isn't it?\n\nWhen you graduate from mentee status (upon awakening at level 85), you will receive a Mentee Certificate. If you bring it to me, I will give you a Diploma that you can exchange for R-grade equipment."; private static final String MENTEE_GRADUATE_TITLE = "Congratulations on your graduation"; private static final String MENTEE_GRADUATE_BODY = "Greetings! This is the Mentor Guide.\nCongratulations! Did you enjoy the time with a mentor? Here is a Mentee Certificate for graduating.\n\nFind me in town, and I'll give you a Diploma if you show me your Mentee Certificatee. You'll also get a small graduation gift!\n\nNow, on to your next Adventure!"; + private static final String MENTEE_REWARD_LV_VAR = "MENTEE_REWARD_LV"; private static final Map MENTEE_COINS = new HashMap<>(); @Override @@ -509,8 +510,9 @@ public class MentorGuide extends AbstractNpcAI implements IXmlReader } final int amount = MENTEE_COINS.get(player.getLevel()); - if (amount > 0) + if ((amount > 0) && (player.getVariables().getInt(MENTEE_REWARD_LV_VAR, 0) < player.getLevel())) { + player.getVariables().set(MENTEE_REWARD_LV_VAR, player.getLevel()); sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount); } }