Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+73 -78
View File
@@ -16,91 +16,86 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
public class NPCProfits {
public class NPCProfits {
public int npcUID;
public float buyNormal;
public float buyGuild;
public float buyNation;
public float sellNormal;
public float sellGuild;
public float sellNation;
public static NPCProfits defaultProfits = new NPCProfits(0,.33f,.33f,.33f,1,1,1);
public static NPCProfits defaultProfits = new NPCProfits(0, .33f, .33f, .33f, 1, 1, 1);
public static HashMap<Integer, NPCProfits> ProfitCache = new HashMap<>();
public int npcUID;
public float buyNormal;
public float buyGuild;
public float buyNation;
public float sellNormal;
public float sellGuild;
public float sellNation;
public static HashMap <Integer,NPCProfits> ProfitCache = new HashMap<>();
/**
* ResultSet Constructor
*/
/**
* ResultSet Constructor
*/
public NPCProfits(ResultSet rs) throws SQLException {
public NPCProfits(ResultSet rs) throws SQLException {
npcUID = rs.getInt("npcUID");
buyNormal = rs.getFloat("buy_normal");
buyGuild = rs.getFloat("buy_guild");
buyNation = rs.getFloat("buy_nation");
sellNormal = rs.getFloat("sell_normal");
sellGuild = rs.getFloat("sell_guild");
sellNation = rs.getFloat("sell_nation");
npcUID = rs.getInt("npcUID");
buyNormal = rs.getFloat("buy_normal");
buyGuild = rs.getFloat("buy_guild");
buyNation = rs.getFloat("buy_nation");
sellNormal = rs.getFloat("sell_normal");
sellGuild = rs.getFloat("sell_guild");
sellNation = rs.getFloat("sell_nation");
}
}
public NPCProfits(int npcUID, float buyNormal, float buyGuild, float buyNation, float sellNormal,
float sellGuild, float sellNation) {
super();
this.npcUID = npcUID;
this.buyNormal = buyNormal;
this.buyGuild = buyGuild;
this.buyNation = buyNation;
this.sellNormal = sellNormal;
this.sellGuild = sellGuild;
this.sellNation = sellNation;
}
public static boolean UpdateProfits(NPC npc, NPCProfits profit, ProfitType profitType, float value){
try {
if (!DbManager.NPCQueries.UPDATE_PROFITS(npc, profitType, value))
return false;
}catch(Exception e){
e.printStackTrace();
}
switch (profitType){
case BuyNormal:
profit.buyNormal = value;
break;
case BuyGuild:
profit.buyGuild = value;
break;
case BuyNation:
profit.buyNation = value;
break;
case SellNormal:
profit.sellNormal = value;
break;
case SellGuild:
profit.sellGuild = value;
break;
case SellNation:
profit.sellNation = value;
break;
}
return true;
}
public NPCProfits(int npcUID, float buyNormal, float buyGuild, float buyNation, float sellNormal,
float sellGuild, float sellNation) {
super();
this.npcUID = npcUID;
this.buyNormal = buyNormal;
this.buyGuild = buyGuild;
this.buyNation = buyNation;
this.sellNormal = sellNormal;
this.sellGuild = sellGuild;
this.sellNation = sellNation;
}
public static boolean UpdateProfits(NPC npc, NPCProfits profit, ProfitType profitType, float value) {
try {
if (!DbManager.NPCQueries.UPDATE_PROFITS(npc, profitType, value))
return false;
} catch (Exception e) {
e.printStackTrace();
}
switch (profitType) {
case BuyNormal:
profit.buyNormal = value;
break;
case BuyGuild:
profit.buyGuild = value;
break;
case BuyNation:
profit.buyNation = value;
break;
case SellNormal:
profit.sellNormal = value;
break;
case SellGuild:
profit.sellGuild = value;
break;
case SellNation:
profit.sellNation = value;
break;
}
return true;
}
public static boolean CreateProfits(NPC npc){
DbManager.NPCQueries.CREATE_PROFITS(npc);
NPCProfits profits = new NPCProfits(npc.getObjectUUID(),.33f,.33f,.33f,1,1,1);
NPCProfits.ProfitCache.put(npc.getObjectUUID(), profits);
return true;
}
public static boolean CreateProfits(NPC npc) {
DbManager.NPCQueries.CREATE_PROFITS(npc);
NPCProfits profits = new NPCProfits(npc.getObjectUUID(), .33f, .33f, .33f, 1, 1, 1);
NPCProfits.ProfitCache.put(npc.getObjectUUID(), profits);
return true;
}
}