Minor rewrite of active soulshots logic.
Source L2J Ertheia branch:
5b656616ff
This commit is contained in:
@@ -40,7 +40,6 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -777,7 +776,7 @@ public final class L2PcInstance extends L2Playable
|
|||||||
/** Player's cubics. */
|
/** Player's cubics. */
|
||||||
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
|
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
|
||||||
/** Active shots. */
|
/** Active shots. */
|
||||||
protected Set<Integer> _activeSoulShots = new CopyOnWriteArraySet<>();
|
protected Set<Integer> _activeSoulShots = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public final ReentrantLock soulShotLock = new ReentrantLock();
|
public final ReentrantLock soulShotLock = new ReentrantLock();
|
||||||
|
|
||||||
@@ -9601,54 +9600,31 @@ public final class L2PcInstance extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void rechargeShots(boolean physical, boolean magic)
|
public void rechargeShots(boolean physical, boolean magic)
|
||||||
{
|
{
|
||||||
L2ItemInstance item;
|
|
||||||
IItemHandler handler;
|
|
||||||
|
|
||||||
if ((_activeSoulShots == null) || _activeSoulShots.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int itemId : _activeSoulShots)
|
for (int itemId : _activeSoulShots)
|
||||||
{
|
{
|
||||||
item = getInventory().getItemByItemId(itemId);
|
final L2ItemInstance item = getInventory().getItemByItemId(itemId);
|
||||||
|
if (item == null)
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
if (magic)
|
|
||||||
{
|
|
||||||
if (item.getItem().getDefaultAction() == ActionType.SPIRITSHOT)
|
|
||||||
{
|
|
||||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
handler.useItem(this, item, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (physical)
|
|
||||||
{
|
|
||||||
if (item.getItem().getDefaultAction() == ActionType.SOULSHOT)
|
|
||||||
{
|
|
||||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
handler.useItem(this, item, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
removeAutoSoulShot(itemId);
|
removeAutoSoulShot(itemId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IItemHandler handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
||||||
|
if (handler == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((magic && (item.getItem().getDefaultAction() == ActionType.SPIRITSHOT)) //
|
||||||
|
|| (physical && (item.getItem().getDefaultAction() == ActionType.SOULSHOT)))
|
||||||
|
{
|
||||||
|
handler.useItem(this, item, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel autoshot for all shots matching crystaltype<BR>
|
* Cancel autoshot for all shots matching crystaltype {@link L2Item#getCrystalType()}.
|
||||||
* {@link L2Item#getCrystalType()}
|
|
||||||
* @param crystalType int type to disable
|
* @param crystalType int type to disable
|
||||||
*/
|
*/
|
||||||
public void disableAutoShotByCrystalType(int crystalType)
|
public void disableAutoShotByCrystalType(int crystalType)
|
||||||
|
Reference in New Issue
Block a user