diff --git a/src/engine/mbEnums.java b/src/engine/mbEnums.java index b369a546..7b211298 100644 --- a/src/engine/mbEnums.java +++ b/src/engine/mbEnums.java @@ -2557,81 +2557,6 @@ public class mbEnums { GuildCharterType.templateLookup.put(guildCharterType.templateID, guildCharterType); } - public static GuildCharterType getGuildTypeFromCharter(Item charter) { - - GuildCharterType charterType; - - // Must be a valid charter object - - if (charter.template.item_type.equals(ItemType.CHARTER) == false) - return GuildCharterType.NONE; //No guild Type - - switch (charter.template.template_id) { - - case 559: - charterType = GuildCharterType.CATHEDRAL; - break; - case 560: - charterType = GuildCharterType.MILITARY; - break; - case 561: - charterType = GuildCharterType.TEMPLE; - break; - case 562: - charterType = GuildCharterType.BARBARIAN; - break; - case 563: - charterType = GuildCharterType.RANGER; - break; - case 564: - charterType = GuildCharterType.AMAZON; - break; - case 565: - charterType = GuildCharterType.NOBLE; - break; - case 566: - charterType = GuildCharterType.WIZARD; - break; - case 567: - charterType = GuildCharterType.MERCENARY; - break; - case 568: - charterType = GuildCharterType.THIEVES; - break; - case 569: - charterType = GuildCharterType.DWARF; - break; - case 570: - charterType = GuildCharterType.HIGHCOURT; - break; - case 571: - charterType = GuildCharterType.VIRAKT; - break; - case 572: - charterType = GuildCharterType.SCOURGE; - break; - case 573: - charterType = GuildCharterType.KHREE; - break; - case 574: - charterType = GuildCharterType.CENTAUR; - break; - case 575: - charterType = GuildCharterType.UNHOLY; - break; - case 576: - charterType = GuildCharterType.PIRATE; - break; - case 577: - charterType = GuildCharterType.BRIALIA; - break; - - default: - charterType = GuildCharterType.HERALD; - } - - return charterType; - } public static GuildCharterType getGuildTypeFromInt(int i) { return GuildCharterType.values()[i]; diff --git a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java index c9295663..ef241b6c 100644 --- a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java +++ b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java @@ -75,7 +75,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { return true; } - charterType = mbEnums.GuildCharterType.getGuildTypeFromCharter(charter); + charterType = mbEnums.GuildCharterType.templateLookup.get(charter.templateID); if (charterType == null) { ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); diff --git a/src/engine/objects/Guild.java b/src/engine/objects/Guild.java index 769a1f5d..49b4385d 100644 --- a/src/engine/objects/Guild.java +++ b/src/engine/objects/Guild.java @@ -968,7 +968,7 @@ public class Guild extends AbstractWorldObject { public GuildCharterType getGuildType() { try { - return GuildCharterType.values()[this.charter]; + return GuildCharterType.templateLookup.get(this.charter);//GuildCharterType.values()[this.charter]; } catch (Exception e) { Logger.error(e); return GuildCharterType.NONE; diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 0464098f..1b6e35e5 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -376,6 +376,9 @@ public class WorldServer { Logger.info("Loading Minion Bases."); MinionType.InitializeMinions(); + Logger.info("Loading Charter Types."); + mbEnums.GuildCharterType.init(); + Logger.info("Loading Pirate Names."); NPCManager.loadAllPirateNames();