Siege skill related additions.
Thanks to dontknowdontcare.
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -60,7 +61,7 @@ public class FortSiegeManager
|
||||
private int _siegeLength = 60; // Time in minute. Changeable in fortsiege.properties
|
||||
private int _countDownLength = 10; // Time in minute. Changeable in fortsiege.properties
|
||||
private int _suspiciousMerchantRespawnDelay = 180; // Time in minute. Changeable in fortsiege.properties
|
||||
private List<FortSiege> _sieges;
|
||||
private final Map<Integer, FortSiege> _sieges = new ConcurrentHashMap<>();
|
||||
|
||||
protected FortSiegeManager()
|
||||
{
|
||||
@@ -255,18 +256,19 @@ public class FortSiegeManager
|
||||
return _countDownLength;
|
||||
}
|
||||
|
||||
public List<FortSiege> getSieges()
|
||||
public Collection<FortSiege> getSieges()
|
||||
{
|
||||
if (_sieges == null)
|
||||
{
|
||||
_sieges = new CopyOnWriteArrayList<>();
|
||||
}
|
||||
return _sieges;
|
||||
return _sieges.values();
|
||||
}
|
||||
|
||||
public FortSiege getSiege(int fortId)
|
||||
{
|
||||
return _sieges.get(fortId);
|
||||
}
|
||||
|
||||
public void addSiege(FortSiege fortSiege)
|
||||
{
|
||||
getSieges().add(fortSiege);
|
||||
_sieges.put(fortSiege.getFort().getResidenceId(), fortSiege);
|
||||
}
|
||||
|
||||
public boolean isCombat(int itemId)
|
||||
|
@@ -20,6 +20,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -263,7 +264,7 @@ public class SiegeManager
|
||||
return _bloodAllianceReward;
|
||||
}
|
||||
|
||||
public List<Siege> getSieges()
|
||||
public Collection<Siege> getSieges()
|
||||
{
|
||||
final List<Siege> sieges = new LinkedList<>();
|
||||
for (Castle castle : CastleManager.getInstance().getCastles())
|
||||
@@ -273,6 +274,18 @@ public class SiegeManager
|
||||
return sieges;
|
||||
}
|
||||
|
||||
public Siege getSiege(int castleId)
|
||||
{
|
||||
for (Castle castle : CastleManager.getInstance().getCastles())
|
||||
{
|
||||
if (castle.getResidenceId() == castleId)
|
||||
{
|
||||
return castle.getSiege();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void loadTrapUpgrade(int castleId)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
|
Reference in New Issue
Block a user