Browse Source

Mobtype work related to ForgeManager

combat-2
MagicBot 9 months ago
parent
commit
ea555be08e
  1. 16
      src/engine/gameManager/ForgeManager.java
  2. 5
      src/engine/mbEnums.java
  3. 8
      src/engine/net/client/msg/ManageNPCMsg.java
  4. 6
      src/engine/objects/Contract.java
  5. 2
      src/engine/objects/ItemFactory.java
  6. 4
      src/engine/objects/NPC.java

16
src/engine/gameManager/ForgeManager.java

@ -10,10 +10,7 @@ package engine.gameManager; @@ -10,10 +10,7 @@ package engine.gameManager;
import engine.loot.WorkOrder;
import engine.mbEnums;
import engine.objects.Item;
import engine.objects.ItemTemplate;
import engine.objects.MobLoot;
import engine.objects.Warehouse;
import engine.objects.*;
import engine.powers.EffectsBase;
import org.pmw.tinylog.Logger;
@ -284,4 +281,15 @@ public enum ForgeManager implements Runnable { @@ -284,4 +281,15 @@ public enum ForgeManager implements Runnable {
Logger.info("Forging item: " + forged_item.objectUUID + " (" + forged_item.templateID + ") " + forged_item.template.item_base_name);
}
}
public static void calsRandomModType(NPC vendor, mbEnums.ItemModType itemModType, Item item) {
int modifier;
if (itemModType.equals(mbEnums.ItemModType.PREFIX))
modifier = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(item.template.modTable));
else
modifier = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(item.template.modTable));
}
}

5
src/engine/mbEnums.java

@ -3039,5 +3039,10 @@ public class mbEnums { @@ -3039,5 +3039,10 @@ public class mbEnums {
CONFIRM_DEPOSIT,
CONFIRM_TAKE;
}
public enum ItemModType {
PREFIX,
SUFFIX;
}
}

8
src/engine/net/client/msg/ManageNPCMsg.java

@ -523,10 +523,10 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -523,10 +523,10 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(2);
writer.putInt(0);
writer.putInt(1);
writer.put(npc.getItemModTable().get(imt));
writer.put(npc.getItemModTable().get(imt));
writer.put(npc.getItemModTable().get(imt));
writer.put(npc.getItemModTable().get(imt));//writer.putInt(-916801465); effectItemType
writer.put(npc.getItemModTable().get(imt).byteValue());
writer.put(npc.getItemModTable().get(imt).byteValue());
writer.put(npc.getItemModTable().get(imt).byteValue());
writer.put(npc.getItemModTable().get(imt).byteValue());//writer.putInt(-916801465); effectItemType
writer.putInt(mtp); //prefix
int mts = modPrefixList.indexOf(mtp);
writer.putInt(npc.getModSuffixTable().get(mts)); //suffix

6
src/engine/objects/Contract.java

@ -34,7 +34,7 @@ public class Contract extends AbstractGameObject { @@ -34,7 +34,7 @@ public class Contract extends AbstractGameObject {
private ArrayList<Integer> npcMenuOptions = new ArrayList<>();
private ArrayList<Integer> npcModTypeTable = new ArrayList<>();
private ArrayList<Integer> npcModSuffixTable = new ArrayList<>();
private ArrayList<Byte> itemModTable = new ArrayList<>();
private ArrayList<Integer> itemModTable = new ArrayList<>();
private ArrayList<Item> sellInventory = new ArrayList<>();
public EnumSet<mbEnums.BuildingGroup> allowedBuildings;
private ArrayList<Integer> buyItemType = new ArrayList<>();
@ -122,7 +122,7 @@ public class Contract extends AbstractGameObject { @@ -122,7 +122,7 @@ public class Contract extends AbstractGameObject {
if (!itemMod.isEmpty()) {
String[] data2 = itemMod.split(" ");
for (byte i = 0; i < data2.length; i++) {
this.itemModTable.add(Byte.parseByte(data2[i]));
this.itemModTable.add(Integer.parseInt(data2[i]));
}
}
@ -193,7 +193,7 @@ public class Contract extends AbstractGameObject { @@ -193,7 +193,7 @@ public class Contract extends AbstractGameObject {
return npcModSuffixTable;
}
public ArrayList<Byte> getItemModTable() {
public ArrayList<Integer> getItemModTable() {
return itemModTable;
}

2
src/engine/objects/ItemFactory.java

@ -663,7 +663,7 @@ public class ItemFactory { @@ -663,7 +663,7 @@ public class ItemFactory {
return null;
}
for (byte temp : vendor.getItemModTable()) {
for (int temp : vendor.getItemModTable()) {
if (itemModTable != temp)
continue;

4
src/engine/objects/NPC.java

@ -70,7 +70,7 @@ public class NPC extends AbstractCharacter { @@ -70,7 +70,7 @@ public class NPC extends AbstractCharacter {
protected int vendorID;
protected ArrayList<Integer> modTypeTable;
protected ArrayList<Integer> modSuffixTable;
protected ArrayList<Byte> itemModTable;
protected ArrayList<Integer> itemModTable;
protected int symbol;
// Variables NOT to be stored in db
protected boolean isStatic = false;
@ -805,7 +805,7 @@ public class NPC extends AbstractCharacter { @@ -805,7 +805,7 @@ public class NPC extends AbstractCharacter {
return modSuffixTable;
}
public ArrayList<Byte> getItemModTable() {
public ArrayList<Integer> getItemModTable() {
return itemModTable;
}

Loading…
Cancel
Save