Browse Source

Refactor of signature

combat-2
MagicBot 8 months ago
parent
commit
0cf4b5416d
  1. 9
      src/engine/db/handlers/dbItemHandler.java
  2. 68
      src/engine/objects/Item.java

9
src/engine/db/handlers/dbItemHandler.java

@ -364,8 +364,8 @@ public class dbItemHandler extends dbHandlerBase { @@ -364,8 +364,8 @@ public class dbItemHandler extends dbHandlerBase {
}
//Used to transfer a single item between owners or equip or vault or bank or inventory
public boolean UPDATE_OWNER(final Item item, int newOwnerID, boolean ownerNPC, boolean ownerPlayer,
boolean ownerAccount, ItemContainerType containerType, int slot) {
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
ItemContainerType containerType, Enum.EquipSlotType slot) {
boolean worked = false;
@ -399,10 +399,11 @@ public class dbItemHandler extends dbHandlerBase { @@ -399,10 +399,11 @@ public class dbItemHandler extends dbHandlerBase {
preparedStatement.setString(3, "none"); //Shouldn't be here
break;
}
if (item.equipSlot.equals(Enum.EquipSlotType.NONE))
if (slot.equals(Enum.EquipSlotType.NONE))
preparedStatement.setString(4, "");
else
preparedStatement.setString(4, item.equipSlot.name());
preparedStatement.setString(4, slot.name());
ResultSet rs = preparedStatement.executeQuery();

68
src/engine/objects/Item.java

@ -796,7 +796,7 @@ public class Item extends AbstractWorldObject { @@ -796,7 +796,7 @@ public class Item extends AbstractWorldObject {
// Removes all ownership of item and 'orphans' it.
protected synchronized void junk() {
DbManager.ItemQueries.UPDATE_OWNER(this, 0, false, false, false, ItemContainerType.NONE, 0);
DbManager.ItemQueries.UPDATE_OWNER(this, 0, ItemContainerType.NONE, EquipSlotType.NONE);
this.zeroItem();
//cleanup item from server.
@ -808,11 +808,11 @@ public class Item extends AbstractWorldObject { @@ -808,11 +808,11 @@ public class Item extends AbstractWorldObject {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
pc.getObjectUUID(), //tableID
false, //isNPC
true, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.INVENTORY,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.ownerID = pc.getObjectUUID();
@ -824,15 +824,15 @@ public class Item extends AbstractWorldObject { @@ -824,15 +824,15 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean moveItemToInventory(NPC npc) {
if (npc.isStatic()) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this, 0, false, false, false, ItemContainerType.INVENTORY, 0))
if (!DbManager.ItemQueries.UPDATE_OWNER(this, 0, ItemContainerType.INVENTORY, EquipSlotType.NONE))
return false;
} else if (!DbManager.ItemQueries.UPDATE_OWNER(this,
npc.getObjectUUID(), //UUID
true, //isNPC
false, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.INVENTORY,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.zeroItem();
@ -846,11 +846,11 @@ public class Item extends AbstractWorldObject { @@ -846,11 +846,11 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean moveItemToInventory(Corpse corpse) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
0, //no ID for corpse
false, //isNPC
true, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.INVENTORY,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.zeroItem();
@ -864,11 +864,11 @@ public class Item extends AbstractWorldObject { @@ -864,11 +864,11 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean moveItemToBank(PlayerCharacter pc) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
pc.getObjectUUID(), //UUID
false, //isNPC
true, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.BANK,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.zeroItem();
@ -882,11 +882,11 @@ public class Item extends AbstractWorldObject { @@ -882,11 +882,11 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean moveItemToBank(NPC npc) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
npc.getObjectUUID(), //UUID
true, //isNPC
false, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.BANK,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.zeroItem();
@ -900,11 +900,11 @@ public class Item extends AbstractWorldObject { @@ -900,11 +900,11 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean moveItemToVault(Account a) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
a.getObjectUUID(), //UUID
false, //isNPC
false, //isPlayer
true, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.VAULT,
0)) //Slot
EquipSlotType.NONE)) //Slot
return false;
this.zeroItem();
@ -919,11 +919,11 @@ public class Item extends AbstractWorldObject { @@ -919,11 +919,11 @@ public class Item extends AbstractWorldObject {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
pc.getObjectUUID(), //tableID
false, //isNPC
true, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.EQUIPPED,
slot.ordinal())) //Slot
slot)) //Slot
return false;
this.zeroItem();
@ -937,11 +937,11 @@ public class Item extends AbstractWorldObject { @@ -937,11 +937,11 @@ public class Item extends AbstractWorldObject {
protected synchronized boolean equipItem(NPC npc, Enum.EquipSlotType slot) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
npc.getObjectUUID(), //UUID
true, //isNPC
false, //isPlayer
false, //isAccount
//isNPC
//isPlayer
//isAccount
ItemContainerType.EQUIPPED,
slot.ordinal())) //Slot
slot)) //Slot
return false;
this.zeroItem();

Loading…
Cancel
Save