Browse Source

Itembase removed from interface

combat-2
MagicBot 8 months ago
parent
commit
2e05ba243f
  1. 38
      src/engine/db/handlers/dbContractHandler.java
  2. 6
      src/engine/objects/MobEquipment.java

38
src/engine/db/handlers/dbContractHandler.java

@ -12,7 +12,7 @@ package engine.db.handlers;
import engine.Enum; import engine.Enum;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.Contract; import engine.objects.Contract;
import engine.objects.ItemBase; import engine.objects.ItemTemplate;
import engine.objects.MobEquipment; import engine.objects.MobEquipment;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -63,33 +63,29 @@ public class dbContractHandler extends dbHandlerBase {
while (rs.next()) { while (rs.next()) {
//handle item base int templateID = rs.getInt("itembaseID");
int itemBaseID = rs.getInt("itembaseID");
ItemBase ib = ItemBase.getItemBase(itemBaseID); MobEquipment me = new MobEquipment(ItemTemplate.templates.get(templateID), Enum.EquipSlotType.NONE, 0);
contract.getSellInventory().add(me);
if (ib != null) { //handle magic effects
MobEquipment me = new MobEquipment(ib, Enum.EquipSlotType.NONE, 0); String prefix = rs.getString("prefix");
contract.getSellInventory().add(me); int pRank = rs.getInt("pRank");
//handle magic effects String suffix = rs.getString("suffix");
String prefix = rs.getString("prefix"); int sRank = rs.getInt("sRank");
int pRank = rs.getInt("pRank");
String suffix = rs.getString("suffix");
int sRank = rs.getInt("sRank");
if (prefix != null) { if (prefix != null) {
me.setPrefix(prefix, pRank); me.setPrefix(prefix, pRank);
me.setIsID(true); me.setIsID(true);
} }
if (suffix != null) {
me.setSuffix(suffix, sRank);
me.setIsID(true);
}
if (suffix != null) {
me.setSuffix(suffix, sRank);
me.setIsID(true);
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Logger.error(e); Logger.error(e);

6
src/engine/objects/MobEquipment.java

@ -41,11 +41,11 @@ public class MobEquipment extends AbstractGameObject {
/** /**
* No Id Constructor * No Id Constructor
*/ */
public MobEquipment(ItemBase itemBase, Enum.EquipSlotType slot, int parentID) { public MobEquipment(ItemTemplate template, Enum.EquipSlotType slot, int parentID) {
super(MobEquipment.getNewID()); super(MobEquipment.getNewID());
this.itemBase = itemBase; this.templateID = template.template_id;
this.templateID = this.itemBase.getUUID();
this.template = ItemTemplate.templates.get(templateID); this.template = ItemTemplate.templates.get(templateID);
this.itemBase = ItemBase.getItemBase(templateID);
this.slot = slot; this.slot = slot;
this.parentID = parentID; this.parentID = parentID;
this.enchanted = false; this.enchanted = false;

Loading…
Cancel
Save