Turn npc id magic numbers into constants
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package server.gachapon;
|
||||
|
||||
import constants.id.NpcId;
|
||||
import server.ItemInformationProvider;
|
||||
import tools.Randomizer;
|
||||
|
||||
@@ -38,18 +39,18 @@ public class Gachapon {
|
||||
public enum GachaponType {
|
||||
|
||||
GLOBAL(-1, -1, -1, -1, new Global()),
|
||||
HENESYS(9100100, 90, 8, 2, new Henesys()),
|
||||
ELLINIA(9100101, 90, 8, 2, new Ellinia()),
|
||||
PERION(9100102, 90, 8, 2, new Perion()),
|
||||
KERNING_CITY(9100103, 90, 8, 2, new KerningCity()),
|
||||
SLEEPYWOOD(9100104, 90, 8, 2, new Sleepywood()),
|
||||
MUSHROOM_SHRINE(9100105, 90, 8, 2, new MushroomShrine()),
|
||||
SHOWA_SPA_MALE(9100106, 90, 8, 2, new ShowaSpaMale()),
|
||||
SHOWA_SPA_FEMALE(9100107, 90, 8, 2, new ShowaSpaFemale()),
|
||||
LUDIBRIUM(9100108, 90, 8, 2, new Ludibrium()),
|
||||
NEW_LEAF_CITY(9100109, 90, 8, 2, new NewLeafCity()),
|
||||
EL_NATH(9100110, 90, 8, 2, new ElNath()),
|
||||
NAUTILUS_HARBOR(9100117, 90, 8, 2, new NautilusHarbor());
|
||||
HENESYS(NpcId.GACHAPON_HENESYS, 90, 8, 2, new Henesys()),
|
||||
ELLINIA(NpcId.GACHAPON_ELLINIA, 90, 8, 2, new Ellinia()),
|
||||
PERION(NpcId.GACHAPON_PERION, 90, 8, 2, new Perion()),
|
||||
KERNING_CITY(NpcId.GACHAPON_KERNING, 90, 8, 2, new KerningCity()),
|
||||
SLEEPYWOOD(NpcId.GACHAPON_SLEEPYWOOD, 90, 8, 2, new Sleepywood()),
|
||||
MUSHROOM_SHRINE(NpcId.GACHAPON_MUSHROOM_SHRINE, 90, 8, 2, new MushroomShrine()),
|
||||
SHOWA_SPA_MALE(NpcId.GACHAPON_SHOWA_MALE, 90, 8, 2, new ShowaSpaMale()),
|
||||
SHOWA_SPA_FEMALE(NpcId.GACHAPON_SHOWA_FEMALE, 90, 8, 2, new ShowaSpaFemale()),
|
||||
LUDIBRIUM(NpcId.GACHAPON_LUDIBRIUM, 90, 8, 2, new Ludibrium()),
|
||||
NEW_LEAF_CITY(NpcId.GACHAPON_NLC, 90, 8, 2, new NewLeafCity()),
|
||||
EL_NATH(NpcId.GACHAPON_EL_NATH, 90, 8, 2, new ElNath()),
|
||||
NAUTILUS_HARBOR(NpcId.GACHAPON_NAUTILUS, 90, 8, 2, new NautilusHarbor());
|
||||
|
||||
private static final GachaponType[] values = GachaponType.values();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.world.World;
|
||||
@@ -312,7 +313,7 @@ public class PlayerNPC extends AbstractMapObject {
|
||||
private static void fetchAvailableScriptIdsFromDb(byte branch, List<Integer> list) {
|
||||
try {
|
||||
int branchLen = (branch < 26) ? 100 : 400;
|
||||
int branchSid = 9900000 + (branch * 100);
|
||||
int branchSid = NpcId.PLAYER_NPC_BASE + (branch * 100);
|
||||
int nextBranchSid = branchSid + branchLen;
|
||||
|
||||
List<Integer> availables = new ArrayList<>(20);
|
||||
@@ -556,7 +557,7 @@ public class PlayerNPC extends AbstractMapObject {
|
||||
for (MapObject pnpcObj : wserv.getChannel(1).getMapFactory().getMap(map).getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER_NPC))) {
|
||||
PlayerNPC pn = (PlayerNPC) pnpcObj;
|
||||
|
||||
if (name.contentEquals(pn.getName()) && pn.getScriptId() < 9977777) {
|
||||
if (name.contentEquals(pn.getName()) && pn.getScriptId() < NpcId.CUSTOM_DEV) {
|
||||
return pn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package server.life;
|
||||
|
||||
import constants.id.ItemId;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import provider.Data;
|
||||
import provider.DataProvider;
|
||||
@@ -46,7 +47,7 @@ public class PlayerNPCFactory {
|
||||
}
|
||||
|
||||
private static void loadDeveloperRoomMetadata(DataProvider npc) {
|
||||
Data thisData = npc.getData("9977777.img");
|
||||
Data thisData = npc.getData(NpcId.CUSTOM_DEV + ".img");
|
||||
if (thisData != null) {
|
||||
DataProvider map = DataProviderFactory.getDataProvider(WZFiles.MAP);
|
||||
|
||||
@@ -106,13 +107,13 @@ public class PlayerNPCFactory {
|
||||
runningDeveloperOid++;
|
||||
}
|
||||
} else {
|
||||
Data thisData = npc.getData("9977777.img");
|
||||
Data thisData = npc.getData(NpcId.CUSTOM_DEV + ".img");
|
||||
|
||||
if (thisData != null) {
|
||||
byte[] encData = {0x52, 0x6F, 0x6E, 0x61, 0x6E};
|
||||
String name = new String(encData);
|
||||
int face = 20104, hair = 30215, gender = 0, skin = 0, dir = 0, mapid = 777777777;
|
||||
int FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = 9977777;
|
||||
int FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = NpcId.CUSTOM_DEV;
|
||||
|
||||
Map<Short, Integer> equips = new HashMap<>();
|
||||
equips.put((short) -1, ItemId.GREEN_HEADBAND);
|
||||
|
||||
Reference in New Issue
Block a user