Turn npc id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 12:36:00 +01:00
parent 8d10e3d1b0
commit c022c3595f
24 changed files with 119 additions and 55 deletions

View File

@@ -29,6 +29,7 @@ import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.id.ItemId;
import constants.id.NpcId;
import constants.inventory.ItemConstants;
import net.server.Server;
import net.server.guild.Guild;
@@ -444,7 +445,7 @@ public class AbstractPlayerInteraction {
}
public boolean forceStartQuest(int id) {
return forceStartQuest(id, 9010000);
return forceStartQuest(id, NpcId.MAPLE_ADMINISTRATOR);
}
public boolean forceStartQuest(int id, int npc) {
@@ -452,7 +453,7 @@ public class AbstractPlayerInteraction {
}
public boolean forceCompleteQuest(int id) {
return forceCompleteQuest(id, 9010000);
return forceCompleteQuest(id, NpcId.MAPLE_ADMINISTRATOR);
}
public boolean forceCompleteQuest(int id, int npc) {
@@ -468,11 +469,11 @@ public class AbstractPlayerInteraction {
}
public boolean startQuest(int id) {
return startQuest(id, 9010000);
return startQuest(id, NpcId.MAPLE_ADMINISTRATOR);
}
public boolean completeQuest(int id) {
return completeQuest(id, 9010000);
return completeQuest(id, NpcId.MAPLE_ADMINISTRATOR);
}
public boolean startQuest(short id, int npc) {

View File

@@ -28,6 +28,7 @@ import client.inventory.ItemFactory;
import client.inventory.Pet;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.id.NpcId;
import constants.inventory.ItemConstants;
import constants.string.LanguageConstants;
import net.server.Server;
@@ -400,15 +401,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
}
public void doGachapon() {
int[] maps = {100000000, 101000000, 102000000, 103000000, 105040300, 800000000, 809000101, 809000201, 600000000, 120000000};
GachaponItem item = Gachapon.getInstance().process(npc);
Item itemGained = gainItem(item.getId(), (short) (item.getId() / 10000 == 200 ? 100 : 1), true, true); // For normal potions, make it give 100.
sendNext("You have obtained a #b#t" + item.getId() + "##k.");
String map = c.getChannelServer().getMapFactory().getMap(maps[(getNpc() != 9100117 && getNpc() != 9100109) ? (getNpc() - 9100100) : getNpc() == 9100109 ? 8 : 9]).getMapName();
int[] maps = {100000000, 101000000, 102000000, 103000000, 105040300, 800000000, 809000101, 809000201, 600000000, 120000000};
final int mapId = maps[(getNpc() != NpcId.GACHAPON_NAUTILUS && getNpc() != NpcId.GACHAPON_NLC) ?
(getNpc() - NpcId.GACHAPON_HENESYS) : getNpc() == NpcId.GACHAPON_NLC ? 8 : 9];
String map = c.getChannelServer().getMapFactory().getMap(mapId).getMapName();
LogHelper.logGacha(getPlayer(), item.getId(), map);