Store last level that mentee was rewarded.

This commit is contained in:
MobiusDevelopment 2021-01-01 11:47:07 +00:00
parent 6c8e271323
commit 658da7c898
9 changed files with 27 additions and 9 deletions

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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<Integer, Integer> 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);
}
}