Pirate name related code moved to NPCmanager.
This commit is contained in:
@@ -12,10 +12,7 @@ package engine.devcmd.cmds;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -66,7 +63,7 @@ public class AddNPCCmd extends AbstractDevCmd {
|
||||
|
||||
// Pick a random name
|
||||
if (name.isEmpty())
|
||||
name = NPC.getPirateName(contract.getMobbaseID());
|
||||
name = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ public enum BuildingManager {
|
||||
|
||||
public static final synchronized boolean addHirelingForWorld(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract NpcID, int rank) {
|
||||
|
||||
String pirateName = NPC.getPirateName(NpcID.getMobbaseID());
|
||||
String pirateName = NPCManager.getPirateName(NpcID.getMobbaseID());
|
||||
|
||||
NPC npc = null;
|
||||
|
||||
@@ -497,7 +497,7 @@ public enum BuildingManager {
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
|
||||
String pirateName = NPC.getPirateName(contract.getMobbaseID());
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
if (item.getChargesRemaining() > 0)
|
||||
rank = item.getChargesRemaining() * 10;
|
||||
|
||||
@@ -2,17 +2,16 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public enum NPCManager {
|
||||
|
||||
@@ -271,4 +270,29 @@ public enum NPCManager {
|
||||
WorldGrid.removeObject(mobile);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void loadAllPirateNames() {
|
||||
|
||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||
}
|
||||
|
||||
public static String getPirateName(int mobBaseID) {
|
||||
|
||||
ArrayList<String> nameList = null;
|
||||
|
||||
// If we cannot find name for this mobbase then
|
||||
// fallback to human male
|
||||
|
||||
if (NPC._pirateNames.containsKey(mobBaseID))
|
||||
nameList = NPC._pirateNames.get(mobBaseID);
|
||||
else
|
||||
nameList = NPC._pirateNames.get(2111);
|
||||
|
||||
if (nameList == null) {
|
||||
Logger.error("Null name list for 2111!");
|
||||
}
|
||||
|
||||
return nameList.get(ThreadLocalRandom.current().nextInt(nameList.size()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (mobBase == 0)
|
||||
return true;
|
||||
|
||||
String pirateName = NPC.getPirateName(mobBase);
|
||||
String pirateName = NPCManager.getPirateName(mobBase);
|
||||
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
return true;
|
||||
|
||||
@@ -752,7 +752,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
else
|
||||
rank = MBServerStatics.ELITE;
|
||||
|
||||
mob.firstName = NPC.getPirateName(mob.getMobBaseID());
|
||||
mob.firstName = NPCManager.getPirateName(mob.getMobBaseID());
|
||||
mob.lastName = rank + " " + minionType.getRace() + " " + minionType.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
||||
@@ -1264,33 +1263,6 @@ public class NPC extends AbstractCharacter {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void loadAllPirateNames() {
|
||||
|
||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||
}
|
||||
|
||||
public static String getPirateName(int mobBaseID) {
|
||||
|
||||
ArrayList<String> nameList = null;
|
||||
|
||||
// If we cannot find name for this mobbase then
|
||||
// fallback to human male
|
||||
|
||||
if (_pirateNames.containsKey(mobBaseID))
|
||||
nameList = _pirateNames.get(mobBaseID);
|
||||
else
|
||||
nameList = _pirateNames.get(2111);
|
||||
|
||||
if (nameList == null) {
|
||||
Logger.error("Null name list for 2111!");
|
||||
}
|
||||
|
||||
return nameList.get(ThreadLocalRandom.current().nextInt(nameList.size()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getUpgradeCost() {
|
||||
|
||||
int upgradeCost;
|
||||
|
||||
@@ -382,7 +382,7 @@ public class WorldServer {
|
||||
Runegate.loadAllRunegates();
|
||||
|
||||
Logger.info("Loading Pirate Names.");
|
||||
NPC.loadAllPirateNames();
|
||||
NPCManager.loadAllPirateNames();
|
||||
|
||||
Logger.info("Loading Max Skills for Trainers");
|
||||
DbManager.SkillsBaseQueries.LOAD_ALL_MAX_SKILLS_FOR_CONTRACT();
|
||||
|
||||
Reference in New Issue
Block a user