Browse Source

NPCManager class created.

master
MagicBot 2 years ago
parent
commit
33334ed13c
  1. 13
      src/engine/gameManager/NPCManager.java
  2. 7
      src/engine/objects/EquipmentSetEntry.java
  3. 3
      src/engine/objects/MobBase.java
  4. 2
      src/engine/objects/NPC.java

13
src/engine/gameManager/NPCManager.java

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
package engine.gameManager;
import engine.objects.EquipmentSetEntry;
import java.util.ArrayList;
import java.util.HashMap;
public enum NPCManager {
NPC_MANAGER;
public static HashMap<Integer, ArrayList<EquipmentSetEntry>> EquipmentSetMap = new HashMap<>();
}

7
src/engine/objects/EquipmentSetEntry.java

@ -10,19 +10,16 @@ @@ -10,19 +10,16 @@
package engine.objects;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class EquipmentSetEntry {
private float dropChance;
private int itemID;
static HashMap<Integer, ArrayList<EquipmentSetEntry>> EquipmentSetMap = new HashMap<>();
/**
* ResultSet Constructor
*/
@ -33,7 +30,7 @@ public class EquipmentSetEntry { @@ -33,7 +30,7 @@ public class EquipmentSetEntry {
}
public static void LoadAllEquipmentSets() {
EquipmentSetMap = DbManager.ItemBaseQueries.LOAD_EQUIPMENT_FOR_NPC_AND_MOBS();
NPCManager.EquipmentSetMap = DbManager.ItemBaseQueries.LOAD_EQUIPMENT_FOR_NPC_AND_MOBS();
}
float getDropChance() {

3
src/engine/objects/MobBase.java

@ -12,6 +12,7 @@ package engine.objects; @@ -12,6 +12,7 @@ package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.server.MBServerStatics;
import java.sql.ResultSet;
@ -144,7 +145,7 @@ public class MobBase extends AbstractGameObject { @@ -144,7 +145,7 @@ public class MobBase extends AbstractGameObject {
if (equipmentSetID == 0)
return equip;
equipList = EquipmentSetEntry.EquipmentSetMap.get(equipmentSetID);
equipList = NPCManager.EquipmentSetMap.get(equipmentSetID);
if (equipList == null)
return equip;

2
src/engine/objects/NPC.java

@ -1681,7 +1681,7 @@ public class NPC extends AbstractCharacter { @@ -1681,7 +1681,7 @@ public class NPC extends AbstractCharacter {
public static boolean UpdateEquipSetID(NPC npc, int equipSetID){
if (!EquipmentSetEntry.EquipmentSetMap.containsKey(equipSetID))
if (!NPCManager.EquipmentSetMap.containsKey(equipSetID))
return false;
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))

Loading…
Cancel
Save