Project cleanup pre merge.
This commit is contained in:
@@ -21,216 +21,213 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
|
||||
public class ProducedItem {
|
||||
public class ProducedItem {
|
||||
|
||||
private int ID;
|
||||
private int npcUID;
|
||||
private int itemBaseID;
|
||||
private DateTime dateToUpgrade;
|
||||
private boolean isRandom;
|
||||
private int ID;
|
||||
private int npcUID;
|
||||
private int itemBaseID;
|
||||
private DateTime dateToUpgrade;
|
||||
private boolean isRandom;
|
||||
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private String name;
|
||||
private int amount;
|
||||
private int producedItemID = 0;
|
||||
private boolean inForge;
|
||||
private int value;
|
||||
|
||||
private int playerID;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private String name;
|
||||
private int amount;
|
||||
private int producedItemID = 0;
|
||||
private boolean inForge;
|
||||
private int value;
|
||||
|
||||
private int playerID;
|
||||
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
|
||||
public ProducedItem(ResultSet rs) throws SQLException {
|
||||
this.ID = rs.getInt("ID");
|
||||
this.npcUID = rs.getInt("npcUID");
|
||||
public ProducedItem(ResultSet rs) throws SQLException {
|
||||
this.ID = rs.getInt("ID");
|
||||
this.npcUID = rs.getInt("npcUID");
|
||||
this.itemBaseID = rs.getInt("itemBaseID");
|
||||
|
||||
Date sqlDateTime = rs.getTimestamp("dateToUpgrade");
|
||||
|
||||
if (sqlDateTime != null)
|
||||
this.dateToUpgrade = new DateTime(sqlDateTime);
|
||||
else
|
||||
dateToUpgrade = null;
|
||||
if (sqlDateTime != null)
|
||||
this.dateToUpgrade = new DateTime(sqlDateTime);
|
||||
else
|
||||
dateToUpgrade = null;
|
||||
this.isRandom = rs.getBoolean("isRandom");
|
||||
this.prefix = rs.getString("prefix");
|
||||
this.suffix = rs.getString("suffix");
|
||||
this.name = rs.getString("name");
|
||||
this.inForge = rs.getBoolean("inForge");
|
||||
this.value = rs.getInt("value");
|
||||
this.playerID = rs.getInt("playerID");
|
||||
}
|
||||
this.inForge = rs.getBoolean("inForge");
|
||||
this.value = rs.getInt("value");
|
||||
this.playerID = rs.getInt("playerID");
|
||||
}
|
||||
|
||||
public ProducedItem(int ID,int npcUID, int itemBaseID, DateTime dateToUpgrade, boolean isRandom, String prefix, String suffix, String name, int playerID) {
|
||||
super();
|
||||
this.ID = ID;
|
||||
this.npcUID = npcUID;
|
||||
public ProducedItem(int ID, int npcUID, int itemBaseID, DateTime dateToUpgrade, boolean isRandom, String prefix, String suffix, String name, int playerID) {
|
||||
super();
|
||||
this.ID = ID;
|
||||
this.npcUID = npcUID;
|
||||
this.itemBaseID = itemBaseID;
|
||||
this.dateToUpgrade = dateToUpgrade;
|
||||
this.isRandom = isRandom;
|
||||
this.prefix = prefix;
|
||||
this.suffix = suffix;
|
||||
this.name = name;
|
||||
this.value = 0;
|
||||
this.playerID = playerID;
|
||||
this.isRandom = isRandom;
|
||||
this.prefix = prefix;
|
||||
this.suffix = suffix;
|
||||
this.name = name;
|
||||
this.value = 0;
|
||||
this.playerID = playerID;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public int getNpcUID() {
|
||||
return npcUID;
|
||||
}
|
||||
|
||||
public int getNpcUID() {
|
||||
return npcUID;
|
||||
}
|
||||
public DateTime getDateToUpgrade() {
|
||||
return dateToUpgrade;
|
||||
}
|
||||
public DateTime getDateToUpgrade() {
|
||||
return dateToUpgrade;
|
||||
}
|
||||
|
||||
public int getItemBaseID() {
|
||||
return itemBaseID;
|
||||
}
|
||||
public int getItemBaseID() {
|
||||
return itemBaseID;
|
||||
}
|
||||
|
||||
public void setItemBaseID(int itemBaseID) {
|
||||
this.itemBaseID = itemBaseID;
|
||||
}
|
||||
public void setItemBaseID(int itemBaseID) {
|
||||
this.itemBaseID = itemBaseID;
|
||||
}
|
||||
|
||||
public boolean isRandom() {
|
||||
return isRandom;
|
||||
}
|
||||
public boolean isRandom() {
|
||||
return isRandom;
|
||||
}
|
||||
|
||||
public void setRandom(boolean isRandom) {
|
||||
this.isRandom = isRandom;
|
||||
}
|
||||
public void setRandom(boolean isRandom) {
|
||||
this.isRandom = isRandom;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public void setID(int iD) {
|
||||
ID = iD;
|
||||
}
|
||||
public void setID(int iD) {
|
||||
ID = iD;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
|
||||
public int getProducedItemID() {
|
||||
return producedItemID;
|
||||
}
|
||||
public int getProducedItemID() {
|
||||
return producedItemID;
|
||||
}
|
||||
|
||||
public void setProducedItemID(int producedItemID) {
|
||||
this.producedItemID = producedItemID;
|
||||
}
|
||||
public void setProducedItemID(int producedItemID) {
|
||||
this.producedItemID = producedItemID;
|
||||
}
|
||||
|
||||
public boolean isInForge() {
|
||||
return inForge;
|
||||
}
|
||||
public boolean isInForge() {
|
||||
return inForge;
|
||||
}
|
||||
|
||||
public void setInForge(boolean inForge) {
|
||||
this.inForge = inForge;
|
||||
}
|
||||
public void setInForge(boolean inForge) {
|
||||
this.inForge = inForge;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean finishProduction(){
|
||||
NPC npc = NPC.getFromCache(this.getNpcUID());
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
if (npc == null)
|
||||
return false;
|
||||
public boolean finishProduction() {
|
||||
NPC npc = NPC.getFromCache(this.getNpcUID());
|
||||
|
||||
if (npc == null)
|
||||
return false;
|
||||
|
||||
|
||||
//update the client to ID the item in the window when item finishes rolling.
|
||||
//If there is more than 1 item left to roll, complete the item and throw it in inventory
|
||||
//and reproduce next item.
|
||||
|
||||
try{
|
||||
//update the client to ID the item in the window when item finishes rolling.
|
||||
//If there is more than 1 item left to roll, complete the item and throw it in inventory
|
||||
//and reproduce next item.
|
||||
|
||||
if(this.getAmount() > 1){
|
||||
this.setAmount(this.getAmount() - 1);
|
||||
npc.completeItem(this.getProducedItemID());
|
||||
try {
|
||||
|
||||
int pToken = 0;
|
||||
int sToken = 0;
|
||||
if (this.getAmount() > 1) {
|
||||
this.setAmount(this.getAmount() - 1);
|
||||
npc.completeItem(this.getProducedItemID());
|
||||
|
||||
if (!this.isRandom()){
|
||||
EffectsBase eb = PowersManager.getEffectByIDString(this.getPrefix());
|
||||
if (eb != null)
|
||||
pToken = eb.getToken();
|
||||
eb = PowersManager.getEffectByIDString(this.getSuffix());
|
||||
if (eb != null)
|
||||
sToken = eb.getToken();
|
||||
int pToken = 0;
|
||||
int sToken = 0;
|
||||
|
||||
}
|
||||
if (!this.isRandom()) {
|
||||
EffectsBase eb = PowersManager.getEffectByIDString(this.getPrefix());
|
||||
if (eb != null)
|
||||
pToken = eb.getToken();
|
||||
eb = PowersManager.getEffectByIDString(this.getSuffix());
|
||||
if (eb != null)
|
||||
sToken = eb.getToken();
|
||||
|
||||
Item item = npc.produceItem(0,this.getAmount(),this.isRandom(),pToken,sToken,this.getName(),this.getItemBaseID());
|
||||
|
||||
if (item == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
//update item to complete
|
||||
MobLoot targetItem = MobLoot.getFromCache(this.getProducedItemID());
|
||||
|
||||
if (targetItem == null)
|
||||
return false;
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(npc.getBuilding(), npc, targetItem, 8, true);
|
||||
|
||||
|
||||
|
||||
DispatchMessage.dispatchMsgToInterestArea(npc, outMsg, DispatchChannel.SECONDARY, 700, false, false);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Item item = npc.produceItem(0, this.getAmount(), this.isRandom(), pToken, sToken, this.getName(), this.getItemBaseID());
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
//update item to complete
|
||||
MobLoot targetItem = MobLoot.getFromCache(this.getProducedItemID());
|
||||
|
||||
if (targetItem == null)
|
||||
return false;
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(npc.getBuilding(), npc, targetItem, 8, true);
|
||||
|
||||
|
||||
DispatchMessage.dispatchMsgToInterestArea(npc, outMsg, DispatchChannel.SECONDARY, 700, false, false);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user