|
|
|
@ -115,95 +115,18 @@ public class Mine extends AbstractGameObject {
@@ -115,95 +115,18 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
this.lastClaimer = null; |
|
|
|
|
this.liveHour = rs.getInt("mineLiveHour"); |
|
|
|
|
this.liveMinute = rs.getInt("mineLiveMinute"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void SetTimes(){ |
|
|
|
|
|
|
|
|
|
int count = 1; |
|
|
|
|
for(Mine mine : EuroMines){ |
|
|
|
|
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) { |
|
|
|
|
mineTower.setMaxHitPoints(5000 * mine.capSize); |
|
|
|
|
mineTower.setCurrentHitPoints((float) 5000 * mine.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; |
|
|
|
|
this.capSize = rs.getInt("capSize"); |
|
|
|
|
|
|
|
|
|
if(BuildingManager.getBuilding(mine.buildingID) != null) { |
|
|
|
|
Building mineTower = BuildingManager.getBuilding(mine.buildingID); |
|
|
|
|
if(BuildingManager.getBuilding(this.buildingID) != null) { |
|
|
|
|
Building mineTower = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
if (mineTower != null) { |
|
|
|
|
mineTower.setMaxHitPoints(5000 * mine.capSize); |
|
|
|
|
mineTower.setCurrentHitPoints((float) 5000 * mine.capSize); |
|
|
|
|
mineTower.setMaxHitPoints(5000 * this.capSize); |
|
|
|
|
mineTower.setCurrentHitPoints((float) 5000 * this.capSize); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void releaseMineClaims(PlayerCharacter playerCharacter) { |
|
|
|
|
|
|
|
|
|
if (playerCharacter == null) |
|
|
|
@ -272,20 +195,30 @@ public class Mine extends AbstractGameObject {
@@ -272,20 +195,30 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
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) { |
|
|
|
|
writer.putInt(mine.getObjectType().ordinal()); |
|
|
|
|
writer.putInt(mine.getObjectUUID()); |
|
|
|
|
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
|
|
|
|
writer.putString(mine.mineType.name); |
|
|
|
|
if(ChinaMines.contains((mine))) { |
|
|
|
|
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.putString(Mine.getMineNationality(mine.liveHour) + " {" + mine.capSize + " Man}"); |
|
|
|
|
writer.putInt(mine.production.hash); |
|
|
|
|
writer.putInt(mine.getModifiedProductionAmount()); |
|
|
|
|
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
|
|
|
|