Browse Source

new mines system

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
ba9238a49a
  1. 115
      src/engine/objects/Mine.java

115
src/engine/objects/Mine.java

@ -115,95 +115,18 @@ public class Mine extends AbstractGameObject {
this.lastClaimer = null; this.lastClaimer = null;
this.liveHour = rs.getInt("mineLiveHour"); this.liveHour = rs.getInt("mineLiveHour");
this.liveMinute = rs.getInt("mineLiveMinute"); this.liveMinute = rs.getInt("mineLiveMinute");
} this.capSize = rs.getInt("capSize");
}
public static void SetTimes(){
int count = 1; if(BuildingManager.getBuilding(this.buildingID) != null) {
for(Mine mine : EuroMines){ Building mineTower = BuildingManager.getBuilding(this.buildingID);
switch(count){
case 1:
mine.capSize = 3;
break;
case 2:
mine.capSize = 3;
break;
case 3:
mine.capSize = 3;
break;
case 4:
mine.capSize = 3;
break;
}
count ++;
if(count == 5)
count = 1;
if(BuildingManager.getBuilding(mine.buildingID) != null) {
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
if (mineTower != null) { if (mineTower != null) {
mineTower.setMaxHitPoints(5000 * mine.capSize); mineTower.setMaxHitPoints(5000 * this.capSize);
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize); mineTower.setCurrentHitPoints((float) 5000 * this.capSize);
} }
} }
} }
for(Mine mine : ChinaMines){
switch(count){
case 1:
mine.capSize = 3;
break;
case 2:
mine.capSize = 5;
break;
case 3:
mine.capSize = 5;
break;
case 4:
mine.capSize = 3;
break;
} }
count ++;
if(count == 5)
count = 1;
if(BuildingManager.getBuilding(mine.buildingID) != null) {
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
if (mineTower != null) {
mineTower.setMaxHitPoints(5000 * mine.capSize);
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize);
}
}
}
for(Mine mine : AmericaMines){
switch(count){
case 1:
mine.capSize = 3;
break;
case 2:
mine.capSize = 5;
break;
case 3:
mine.capSize = 5;
break;
case 4:
mine.capSize = 3;
break;
}
count ++;
if(count == 5)
count = 1;
if(BuildingManager.getBuilding(mine.buildingID) != null) {
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
if (mineTower != null) {
mineTower.setMaxHitPoints(5000 * mine.capSize);
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize);
}
}
}
}
public static void releaseMineClaims(PlayerCharacter playerCharacter) { public static void releaseMineClaims(PlayerCharacter playerCharacter) {
if (playerCharacter == null) if (playerCharacter == null)
@ -272,20 +195,30 @@ public class Mine extends AbstractGameObject {
return Mine.towerMap.get(towerID); return Mine.towerMap.get(towerID);
} }
public static String getMineNationality(int time){
switch(time){
case 7:
case 8:
case 9:
return "CN";
case 14:
case 15:
case 16:
return "EU";
case 20:
case 21:
case 22:
return "NA";
default:
return "Unknown";
}
}
public static void serializeForClientMsg(Mine mine, ByteBufferWriter writer) { public static void serializeForClientMsg(Mine mine, ByteBufferWriter writer) {
writer.putInt(mine.getObjectType().ordinal()); writer.putInt(mine.getObjectType().ordinal());
writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID());
writer.putInt(mine.getObjectUUID()); //actually a hash of mine writer.putInt(mine.getObjectUUID()); //actually a hash of mine
writer.putString(mine.mineType.name); writer.putString(mine.mineType.name);
if(ChinaMines.contains((mine))) { writer.putString(Mine.getMineNationality(mine.liveHour) + " {" + mine.capSize + " Man}");
writer.putString("Chinese" + " {" + mine.capSize + " Man}");
} else if(AmericaMines.contains(mine)){
writer.putString("American" + " {" + mine.capSize + " Man}");
} else if(EuroMines.contains(mine)){
writer.putString("European" + " {" + mine.capSize + " Man}");
}else{
writer.putString("Unknown" + " {" + mine.capSize + " Man}");
}
writer.putInt(mine.production.hash); writer.putInt(mine.production.hash);
writer.putInt(mine.getModifiedProductionAmount()); writer.putInt(mine.getModifiedProductionAmount());
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here

Loading…
Cancel
Save