Turn map id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 14:26:34 +01:00
parent c022c3595f
commit b15a7e61d4
51 changed files with 615 additions and 341 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.MapId;
import constants.id.NpcId;
import constants.inventory.ItemConstants;
import net.server.Server;
@@ -680,27 +681,15 @@ public class AbstractPlayerInteraction {
}
public void displayAranIntro() {
String intro = "";
switch (c.getPlayer().getMapId()) {
case 914090010:
intro = "Effect/Direction1.img/aranTutorial/Scene0";
break;
case 914090011:
intro = "Effect/Direction1.img/aranTutorial/Scene1" + (c.getPlayer().getGender() == 0 ? "0" : "1");
break;
case 914090012:
intro = "Effect/Direction1.img/aranTutorial/Scene2" + (c.getPlayer().getGender() == 0 ? "0" : "1");
break;
case 914090013:
intro = "Effect/Direction1.img/aranTutorial/Scene3";
break;
case 914090100:
intro = "Effect/Direction1.img/aranTutorial/HandedPoleArm" + (c.getPlayer().getGender() == 0 ? "0" : "1");
break;
case 914090200:
intro = "Effect/Direction1.img/aranTutorial/Maha";
break;
}
String intro = switch (c.getPlayer().getMapId()) {
case MapId.ARAN_TUTO_1 -> "Effect/Direction1.img/aranTutorial/Scene0";
case MapId.ARAN_TUTO_2 -> "Effect/Direction1.img/aranTutorial/Scene1" + (c.getPlayer().getGender() == 0 ? "0" : "1");
case MapId.ARAN_TUTO_3 -> "Effect/Direction1.img/aranTutorial/Scene2" + (c.getPlayer().getGender() == 0 ? "0" : "1");
case MapId.ARAN_TUTO_4 -> "Effect/Direction1.img/aranTutorial/Scene3";
case MapId.ARAN_POLEARM -> "Effect/Direction1.img/aranTutorial/HandedPoleArm" + (c.getPlayer().getGender() == 0 ? "0" : "1");
case MapId.ARAN_MAHA -> "Effect/Direction1.img/aranTutorial/Maha";
default -> "";
};
showIntro(intro);
}

View File

@@ -24,6 +24,7 @@ package scripting.map;
import client.Character.DelayedQuestUpdate;
import client.Client;
import client.QuestStatus;
import constants.id.MapId;
import scripting.AbstractPlayerInteraction;
import server.quest.Quest;
import tools.PacketCreator;
@@ -38,51 +39,35 @@ public class MapScriptMethods extends AbstractPlayerInteraction {
public void displayCygnusIntro() {
switch (c.getPlayer().getMapId()) {
case 913040100:
case MapId.CYGNUS_INTRO_LEAD -> {
lockUI();
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene0"));
break;
case 913040101:
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene1"));
break;
case 913040102:
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene2"));
break;
case 913040103:
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene3"));
break;
case 913040104:
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene4"));
break;
case 913040105:
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene5"));
break;
case 913040106:
}
case MapId.CYGNUS_INTRO_WARRIOR -> c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene1"));
case MapId.CYGNUS_INTRO_BOWMAN -> c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene2"));
case MapId.CYGNUS_INTRO_MAGE -> c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene3"));
case MapId.CYGNUS_INTRO_PIRATE -> c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene4"));
case MapId.CYGNUS_INTRO_THIEF -> c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene5"));
case MapId.CYGNUS_INTRO_CONCLUSION -> {
lockUI();
c.sendPacket(PacketCreator.showIntro("Effect/Direction.img/cygnusJobTutorial/Scene6"));
break;
}
}
}
public void displayAranIntro() {
switch (c.getPlayer().getMapId()) {
case 914090010:
case MapId.ARAN_TUTO_1 -> {
lockUI();
c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene0"));
break;
case 914090011:
c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene1" + c.getPlayer().getGender()));
break;
case 914090012:
c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene2" + c.getPlayer().getGender()));
break;
case 914090013:
c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene3"));
break;
case 914090100:
}
case MapId.ARAN_TUTO_2 -> c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene1" + c.getPlayer().getGender()));
case MapId.ARAN_TUTO_3 -> c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene2" + c.getPlayer().getGender()));
case MapId.ARAN_TUTO_4 -> c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/Scene3"));
case MapId.ARAN_POLEARM -> {
lockUI();
c.sendPacket(PacketCreator.showIntro("Effect/Direction1.img/aranTutorial/HandedPoleArm" + c.getPlayer().getGender()));
break;
}
}
}

View File

@@ -28,6 +28,7 @@ import client.inventory.ItemFactory;
import client.inventory.Pet;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.id.MapId;
import constants.id.NpcId;
import constants.inventory.ItemConstants;
import constants.string.LanguageConstants;
@@ -406,7 +407,8 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
sendNext("You have obtained a #b#t" + item.getId() + "##k.");
int[] maps = {100000000, 101000000, 102000000, 103000000, 105040300, 800000000, 809000101, 809000201, 600000000, 120000000};
int[] maps = {MapId.HENESYS, MapId.ELLINIA, MapId.PERION, MapId.KERNING_CITY, MapId.SLEEPYWOOD, MapId.MUSHROOM_SHRINE,
MapId.SHOWA_SPA_M, MapId.SHOWA_SPA_F, MapId.NEW_LEAF_CITY, MapId.NAUTILUS_HARBOR};
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();
@@ -500,7 +502,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
MapManager mapManager = c.getChannelServer().getMapFactory();
MapleMap map = null;
int mapid = 926010100;
int mapid = MapId.NETTS_PYRAMID_SOLO_BASE;
if (party) {
mapid += 10000;
}