Value set in constructor
This commit is contained in:
@@ -90,7 +90,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (!itemMan.hasRoomInventory(me.template.item_wt))
|
if (!itemMan.hasRoomInventory(me.template.item_wt))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int cost = me.getMagicValue();
|
int cost = me.magicValue;
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building != null && building.getProtectionState().equals(Enum.ProtectionState.NPC))
|
if (building != null && building.getProtectionState().equals(Enum.ProtectionState.NPC))
|
||||||
building = null;
|
building = null;
|
||||||
|
|
||||||
int buildingDeposit = cost - me.getMagicValue();
|
int buildingDeposit = cost - me.magicValue;
|
||||||
|
|
||||||
if (building != null && (building.getStrongboxValue() + buildingDeposit) > building.getMaxGold()) {
|
if (building != null && (building.getStrongboxValue() + buildingDeposit) > building.getMaxGold()) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||||
@@ -155,7 +155,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
int cost = vendorItem.template.item_value;
|
int cost = vendorItem.template.item_value;
|
||||||
|
|
||||||
if (vendorItem.flags.contains(Enum.ItemFlags.Identified) || vendorItem.isCustomValue())
|
if (vendorItem.flags.contains(Enum.ItemFlags.Identified) || vendorItem.isCustomValue())
|
||||||
cost = vendorItem.getMagicValue();
|
cost = vendorItem.magicValue;
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
|
|||||||
@@ -1477,7 +1477,7 @@ public class CharacterItemManager {
|
|||||||
if (!purchasedItem.moveItemToInventory((PlayerCharacter) this.absCharacter))
|
if (!purchasedItem.moveItemToInventory((PlayerCharacter) this.absCharacter))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (purchasedItem.getValue() != purchasedItem.getMagicValue()) {
|
if (purchasedItem.getValue() != purchasedItem.magicValue) {
|
||||||
DbManager.ItemQueries.UPDATE_VALUE(purchasedItem, 0);
|
DbManager.ItemQueries.UPDATE_VALUE(purchasedItem, 0);
|
||||||
purchasedItem.setValue(0);
|
purchasedItem.setValue(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class Item extends AbstractWorldObject {
|
|||||||
public OwnerType ownerType;
|
public OwnerType ownerType;
|
||||||
public int templateID;
|
public int templateID;
|
||||||
private long dateToUpgrade;
|
private long dateToUpgrade;
|
||||||
private int magicValue;
|
public int magicValue;
|
||||||
public ItemTemplate template;
|
public ItemTemplate template;
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class Item extends AbstractWorldObject {
|
|||||||
this.numberOfItems = 1;
|
this.numberOfItems = 1;
|
||||||
this.flags.addAll(this.template.item_flags);
|
this.flags.addAll(this.template.item_flags);
|
||||||
this.value = this.template.item_value;
|
this.value = this.template.item_value;
|
||||||
|
this.magicValue = this.value + calcMagicValue();
|
||||||
loadTemplateEnchantments();
|
loadTemplateEnchantments();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -971,10 +971,6 @@ public class Item extends AbstractWorldObject {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getMagicValue() {
|
|
||||||
return this.magicValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadTemplateEnchantments() {
|
private void loadTemplateEnchantments() {
|
||||||
|
|
||||||
EffectsBase effect;
|
EffectsBase effect;
|
||||||
@@ -1155,7 +1151,7 @@ public class Item extends AbstractWorldObject {
|
|||||||
|
|
||||||
if (this.value == 0)
|
if (this.value == 0)
|
||||||
if (this.flags.contains(ItemFlags.Identified)) {
|
if (this.flags.contains(ItemFlags.Identified)) {
|
||||||
return this.getMagicValue();
|
return this.magicValue;
|
||||||
} else
|
} else
|
||||||
return this.template.item_value;
|
return this.template.item_value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user