Sync with L2jServer HighFive Jul 3rd 2015.

This commit is contained in:
MobiusDev 2015-07-03 21:10:51 +00:00
parent 9c11f00722
commit ac006cde6a
29 changed files with 311 additions and 268 deletions

View File

@ -100,7 +100,6 @@ public final class Baium extends AbstractNpcAI
// Misc
private L2GrandBossInstance _baium = null;
private static long _lastAttack = 0;
private static L2PcInstance _standbyPlayer = null;
private Baium()
{
@ -213,6 +212,7 @@ public final class Baium extends AbstractNpcAI
_lastAttack = System.currentTimeMillis();
startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, null);
startQuestTimer("SOCIAL_ACTION", 10000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
}
break;
@ -231,7 +231,6 @@ public final class Baium extends AbstractNpcAI
{
zone.broadcastPacket(new Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 10));
zone.broadcastPacket(new PlaySound("BS02_A"));
startQuestTimer("SOCIAL_ACTION", 8000, npc, player);
}
break;
}
@ -253,10 +252,18 @@ public final class Baium extends AbstractNpcAI
player.teleToLocation(BAIUM_GIFT_LOC);
startQuestTimer("PLAYER_KILL", 3000, npc, player);
}
else if ((_standbyPlayer != null) && _standbyPlayer.isInsideRadius(npc, 16000, true, false))
else
{
_standbyPlayer.teleToLocation(BAIUM_GIFT_LOC);
startQuestTimer("PLAYER_KILL", 3000, npc, _standbyPlayer);
L2PcInstance randomPlayer = getRandomPlayer(npc);
if (randomPlayer != null)
{
randomPlayer.teleToLocation(BAIUM_GIFT_LOC);
startQuestTimer("PLAYER_KILL", 3000, npc, randomPlayer);
}
else
{
startQuestTimer("PLAYER_KILL", 3000, npc, null);
}
}
}
break;
@ -266,20 +273,20 @@ public final class Baium extends AbstractNpcAI
if ((player != null) && player.isInsideRadius(npc, 16000, true, false))
{
zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
broadcastNpcSay(npc, ChatType.NPC_GENERAL, player.getName() + ", How dare you wake me! Now you shall die!"); // TODO: replace with NpcStringId when are done core support
broadcastNpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.HOW_DARE_YOU_WAKE_ME_NOW_YOU_SHALL_DIE, player.getName());
npc.setTarget(player);
npc.doCast(BAIUM_PRESENT.getSkill());
}
for (L2PcInstance players : zone.getPlayersInside())
for (L2PcInstance insidePlayer : zone.getPlayersInside())
{
if (players.isHero())
if (insidePlayer.isHero())
{
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.NOT_EVEN_THE_GODS_THEMSELVES_COULD_TOUCH_ME_BUT_YOU_S1_YOU_DARE_CHALLENGE_ME_IGNORANT_MORTAL, 2, 4000, players.getName()));
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.NOT_EVEN_THE_GODS_THEMSELVES_COULD_TOUCH_ME_BUT_YOU_S1_YOU_DARE_CHALLENGE_ME_IGNORANT_MORTAL, 2, 4000, insidePlayer.getName()));
break;
}
}
startQuestTimer("SPAWN_ARCHANGEL", 8000, npc, null);
startQuestTimer("SPAWN_ARCHANGEL", 8000, npc, player);
break;
}
case "SPAWN_ARCHANGEL":
@ -296,19 +303,12 @@ public final class Baium extends AbstractNpcAI
{
addAttackPlayerDesire(npc, player);
}
else if ((_standbyPlayer != null) && !_standbyPlayer.isDead())
{
addAttackPlayerDesire(npc, _standbyPlayer);
}
else
{
for (L2Character creature : npc.getKnownList().getKnownCharactersInRadius(2000))
L2PcInstance randomPlayer = getRandomPlayer(npc);
if (randomPlayer != null)
{
if ((creature != null) && creature.isPlayer() && zone.isInsideZone(creature) && !creature.isDead())
{
addAttackPlayerDesire(npc, (L2Playable) creature);
break;
}
addAttackPlayerDesire(npc, randomPlayer);
}
}
break;
@ -377,6 +377,7 @@ public final class Baium extends AbstractNpcAI
{
if ((npc != null) && ((_lastAttack + 1800000) < System.currentTimeMillis()))
{
cancelQuestTimers("SELECT_TARGET");
notifyEvent("CLEAR_ZONE", null, null);
addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0);
setStatus(ALIVE);
@ -560,6 +561,7 @@ public final class Baium extends AbstractNpcAI
startQuestTimer("CLEAR_STATUS", respawnTime, null, null);
startQuestTimer("CLEAR_ZONE", 900000, null, null);
cancelQuestTimer("CHECK_ATTACK", npc, null);
cancelQuestTimers("SELECT_TARGET");
}
return super.onKill(npc, killer, isSummon);
}
@ -572,11 +574,6 @@ public final class Baium extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
if (creature.isPlayer() && !creature.isDead() && (_standbyPlayer == null))
{
_standbyPlayer = (L2PcInstance) creature;
}
if (creature.isInCategory(CategoryType.CLERIC_GROUP))
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25))
@ -785,6 +782,18 @@ public final class Baium extends AbstractNpcAI
}
}
private L2PcInstance getRandomPlayer(L2Npc npc)
{
for (L2Character creature : npc.getKnownList().getKnownCharactersInRadius(2000))
{
if ((creature != null) && creature.isPlayer() && zone.isInsideZone(creature) && !creature.isDead())
{
return (L2PcInstance) creature;
}
}
return null;
}
public static void main(String[] args)
{
new Baium();

View File

@ -3,5 +3,5 @@ I'm very impressed.<br>
No one has ever broken through this fast to the Hall of Suffering. Extraordinary! In recognition of your achievement, I will give you a <font color="LEVEL">Jeweled Battle Supply</font>.<br>
It is granted only to those who achieve an especially impressive feat in battle.<br>
Your leader may receive it on your behalf.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Mother-of-Pearl Ornamented Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Gold-Ornamented Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Silver-Ornamented Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Bronze-Ornamented Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Non-Ornamented Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Weak-Looking Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Sad-Looking Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
Unknown Text!<br>
The reward is <font color="LEVEL">Poor-Looking Duel Supplies</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -2,5 +2,5 @@
I'm very disappointed.<br>
If I had known your skills were this embarrasingly poor, I would not have assigned you this mission. You're lucky to still be alive! Still, a promise is a promise, so I will give you this <font color="LEVEL">Worthless Battle Supply</font>.<br>
I'll grant this reward to the leader who represents all of you.<br>
<a action="bypass -h npc_%objectId%_Quest SeedOfInfinity">Receive the supply.</a>
<a action="bypass -h npc_%objectId%_Quest HallOfSuffering">Receive the supply.</a>
</body></html>

View File

@ -188,7 +188,7 @@ public final class HallOfSuffering extends AbstractNpcAI
public HallOfSuffering()
{
super(HallOfSuffering.class.getSimpleName(), "gracia/instances/SeedOfInfinity/HallOfSuffering");
super(HallOfSuffering.class.getSimpleName(), "gracia/instances/SeedOfInfinity");
addStartNpc(MOUTHOFEKIMUS, TEPIOS);
addTalkId(MOUTHOFEKIMUS, TEPIOS);
addFirstTalkId(TEPIOS);
@ -449,7 +449,7 @@ public final class HallOfSuffering extends AbstractNpcAI
private String getPtLeaderText(L2PcInstance player, HSWorld world)
{
String htmltext = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "/scripts/instances/SeedOfInfinity/HallOfSuffering/32530-10.htm");
String htmltext = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/32530-10.htm");
htmltext = htmltext.replaceAll("%ptLeader%", String.valueOf(world.ptLeaderName));
return htmltext;
}

View File

@ -1355,11 +1355,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
setAttackTarget(caster.getMostHated());
}
}
L2Character attackTarget = getAttackTarget();
final L2Character attackTarget = getAttackTarget();
if (attackTarget == null)
{
return false;
}
double dist = caster.calculateDistance(attackTarget, false, false);
double dist2 = dist - attackTarget.getTemplate().getCollisionRadius();
double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
@ -1376,10 +1378,9 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (!caster.isAffectedBySkill(sk.getId()))
{
clientStopMoving(null);
// L2Object target = attackTarget;
caster.setTarget(caster);
caster.doCast(sk);
// _actor.setTarget(target);
_actor.setTarget(attackTarget);
return true;
}
// ----------------------------------------
@ -1394,20 +1395,18 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (target != null)
{
clientStopMoving(null);
L2Object targets = attackTarget;
caster.setTarget(target);
caster.doCast(sk);
caster.setTarget(targets);
caster.setTarget(attackTarget);
return true;
}
}
if (canParty(sk))
{
clientStopMoving(null);
L2Object targets = attackTarget;
caster.setTarget(caster);
caster.doCast(sk);
caster.setTarget(targets);
caster.setTarget(attackTarget);
return true;
}
}
@ -1464,10 +1463,9 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (target != null)
{
clientStopMoving(null);
L2Object targets = attackTarget;
caster.setTarget(target);
caster.doCast(sk);
caster.setTarget(targets);
caster.setTarget(attackTarget);
return true;
}
}
@ -1506,15 +1504,18 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(leader);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
}
if (Rnd.get(100) < ((100 - percentage) / 3))
{
clientStopMoving(null);
caster.setTarget(caster);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
@ -1541,6 +1542,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(obj);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
@ -1554,6 +1556,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
continue;
}
L2Npc targets = ((L2Npc) obj);
if (targets.isInMyClan(caster))
{
@ -1562,6 +1565,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(caster);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
@ -1584,10 +1588,9 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (target != null)
{
clientStopMoving(null);
L2Object targets = attackTarget;
caster.setTarget(target);
caster.doCast(sk);
caster.setTarget(targets);
caster.setTarget(attackTarget);
return true;
}
}
@ -1738,6 +1741,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(leader);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
@ -1755,6 +1759,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
continue;
}
if (Rnd.get(100) < 10)
{
if (GeoData.getInstance().canSeeTarget(caster, targets))
@ -1762,6 +1767,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(obj);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
@ -1783,6 +1789,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
clientStopMoving(null);
caster.setTarget(caster);
caster.doCast(sk);
caster.setTarget(attackTarget);
return true;
}
}
@ -1804,10 +1811,9 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (target != null)
{
clientStopMoving(null);
L2Object targets = attackTarget;
caster.setTarget(target);
caster.doCast(sk);
caster.setTarget(targets);
caster.setTarget(attackTarget);
return true;
}
}

View File

@ -112,7 +112,9 @@ public final class AnnouncementsTable
{
if (announce.isValid() && (announce.getType() == type))
{
player.sendPacket(new CreatureSay(0, ChatType.ANNOUNCEMENT, player.getName(), announce.getContent()));
player.sendPacket(new CreatureSay(0, //
type == AnnouncementType.CRITICAL ? ChatType.CRITICAL_ANNOUNCE : ChatType.ANNOUNCEMENT, //
player.getName(), announce.getContent()));
}
}
}

View File

@ -130,7 +130,7 @@ public class SummonEffectsTable
public void addPetEffect(int controlObjectId, Skill skill, int effectCurTime)
{
_petEffects.putIfAbsent(controlObjectId, new ArrayList<>()).add(new SummonEffect(skill, effectCurTime));
_petEffects.computeIfAbsent(controlObjectId, k -> new ArrayList<>()).add(new SummonEffect(skill, effectCurTime));
}
public boolean containsPetId(int controlObjectId)

View File

@ -25,6 +25,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -79,29 +80,30 @@ import com.l2jserver.util.data.xml.IXmlReader;
public final class SkillTreesData implements IXmlReader
{
// ClassId, HashMap of Skill Hash Code, L2SkillLearn
private static final Map<ClassId, Map<Integer, L2SkillLearn>> _classSkillTrees = new HashMap<>();
private static final Map<ClassId, Map<Integer, L2SkillLearn>> _transferSkillTrees = new HashMap<>();
private static final Map<Race, Map<Integer, L2SkillLearn>> _raceSkillTree = new HashMap<>();
private static final Map<SubclassType, Map<Integer, L2SkillLearn>> _revelationSkillTree = new HashMap<>();
// ClassId, Map of Skill Hash Code, L2SkillLearn
private final Map<ClassId, Map<Integer, L2SkillLearn>> _classSkillTrees = new LinkedHashMap<>();
private final Map<ClassId, Map<Integer, L2SkillLearn>> _transferSkillTrees = new LinkedHashMap<>();
private static final Map<Race, Map<Integer, L2SkillLearn>> _raceSkillTree = new LinkedHashMap<>();
private static final Map<SubclassType, Map<Integer, L2SkillLearn>> _revelationSkillTree = new LinkedHashMap<>();
// Skill Hash Code, L2SkillLearn
private static final Map<Integer, L2SkillLearn> _collectSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _fishingSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _pledgeSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _subClassSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _subPledgeSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _transformSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _commonSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _subClassChangeSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _abilitySkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _alchemySkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _dualClassSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _collectSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _fishingSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _pledgeSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _subClassSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _subPledgeSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _transformSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _commonSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _subClassChangeSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _abilitySkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _alchemySkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _dualClassSkillTree = new LinkedHashMap<>();
// Other skill trees
private static final Map<Integer, L2SkillLearn> _nobleSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _heroSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _gameMasterSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _gameMasterAuraSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _nobleSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _heroSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _gameMasterSkillTree = new LinkedHashMap<>();
private static final Map<Integer, L2SkillLearn> _gameMasterAuraSkillTree = new LinkedHashMap<>();
// Remove skill tree
private static final Map<ClassId, Set<Integer>> _removeSkillCache = new HashMap<>();
private static final Map<ClassId, Set<Integer>> _removeSkillCache = new LinkedHashMap<>();
// Checker, sorted arrays of hash codes
private Map<Integer, int[]> _skillsByClassIdHashCodes; // Occupation skills
@ -110,8 +112,8 @@ public final class SkillTreesData implements IXmlReader
private boolean _loading = true;
/** Parent class Ids are read from XML and stored in this map, to allow easy customization. */
private static final Map<ClassId, ClassId> _parentClassMap = new HashMap<>();
/** Parent class IDs are read from XML and stored in this map, to allow easy customization. */
private final Map<ClassId, ClassId> _parentClassMap = new LinkedHashMap<>();
/**
* Instantiates a new skill trees data.
@ -418,14 +420,25 @@ public final class SkillTreesData implements IXmlReader
*/
public Map<Integer, L2SkillLearn> getCompleteClassSkillTree(ClassId classId)
{
final Map<Integer, L2SkillLearn> skillTree = new HashMap<>();
final Map<Integer, L2SkillLearn> skillTree = new LinkedHashMap<>();
// Add all skills that belong to all classes.
skillTree.putAll(_commonSkillTree);
while ((classId != null) && (_classSkillTrees.get(classId) != null))
final LinkedList<ClassId> classSequence = new LinkedList<>();
while (classId != null)
{
skillTree.putAll(_classSkillTrees.get(classId));
classSequence.addFirst(classId);
classId = _parentClassMap.get(classId);
}
for (ClassId cid : classSequence)
{
final Map<Integer, L2SkillLearn> classSkillTree = _classSkillTrees.get(cid);
if (classSkillTree != null)
{
skillTree.putAll(classSkillTree);
}
}
return skillTree;
}

View File

@ -685,7 +685,7 @@ public class L2Attackable extends L2Npc
}
/**
* Add damage and hate to the attacker AggroInfo of the L2Attackable _aggroList.
* Adds damage and hate to the attacker aggression list for this character.
* @param attacker The L2Character that gave damages to this L2Attackable
* @param damage The number of damages given by the attacker L2Character
* @param aggro The hate (=damage) given by the attacker L2Character
@ -697,13 +697,14 @@ public class L2Attackable extends L2Npc
return;
}
final L2PcInstance targetPlayer = attacker.getActingPlayer();
// Get the AggroInfo of the attacker L2Character from the _aggroList of the L2Attackable
final AggroInfo ai = getAggroList().computeIfAbsent(attacker, AggroInfo::new);
ai.addDamage(damage);
// traps does not cause aggro
// Traps does not cause aggro
// making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here
final L2PcInstance targetPlayer = attacker.getActingPlayer();
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{
ai.addHate(aggro);

View File

@ -5387,7 +5387,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
if (newSkill.isPassive())
{
newSkill.applyEffects(this, null, this, false, true, false, 0);
newSkill.applyEffects(this, this, false, true, false, 0);
}
}
return oldSkill;
@ -6070,8 +6070,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
}
}
// Notify AI
if (skill.isBad() && (skill.getTargetType() != L2TargetType.SELF) && !skill.hasEffectType(L2EffectType.HATE))
if (skill.isBad() && !skill.hasEffectType(L2EffectType.HATE))
{
for (L2Object target : targets)
{
@ -6080,7 +6081,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
final L2Character creature = (L2Character) target;
if (creature.hasAI())
{
// notify target AI about the attack
// Notify target AI about the attack
creature.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, this);
}
}

View File

@ -33,7 +33,6 @@ import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.tasks.cubics.CubicAction;
import com.l2jserver.gameserver.model.actor.tasks.cubics.CubicDisappear;
@ -356,7 +355,7 @@ public final class L2CubicInstance implements IIdentifiable
{
if (_owner.isOlympiadStart())
{
if (ownerTarget instanceof L2Playable)
if (ownerTarget.isPlayable())
{
final L2PcInstance targetPlayer = ownerTarget.getActingPlayer();
if ((targetPlayer != null) && (targetPlayer.getOlympiadGameId() == _owner.getOlympiadGameId()) && (targetPlayer.getOlympiadSide() != _owner.getOlympiadSide()))
@ -372,23 +371,24 @@ public final class L2CubicInstance implements IIdentifiable
if (ownerTarget.isCharacter() && (ownerTarget != pet) && !_owner.hasServitor(ownerTarget.getObjectId()) && (ownerTarget != _owner))
{
// target mob which has aggro on you or your summon
if (ownerTarget instanceof L2Attackable)
if (ownerTarget.isAttackable())
{
if ((((L2Attackable) ownerTarget).getAggroList().get(_owner) != null) && !((L2Attackable) ownerTarget).isDead())
final L2Attackable attackable = (L2Attackable) ownerTarget;
if ((attackable.getAggroList().get(_owner) != null) && !attackable.isDead())
{
_target = (L2Character) ownerTarget;
return;
}
if (_owner.hasSummon())
{
if ((((L2Attackable) ownerTarget).getAggroList().get(pet) != null) && !((L2Attackable) ownerTarget).isDead())
if ((attackable.getAggroList().get(pet) != null) && !attackable.isDead())
{
_target = (L2Character) ownerTarget;
return;
}
for (L2Summon servitor : _owner.getServitors().values())
{
if ((((L2Attackable) ownerTarget).getAggroList().get(servitor) != null) && !((L2Attackable) ownerTarget).isDead())
if ((attackable.getAggroList().get(servitor) != null) && !attackable.isDead())
{
_target = (L2Character) ownerTarget;
return;
@ -482,21 +482,21 @@ public final class L2CubicInstance implements IIdentifiable
if (skill.isBad())
{
byte shld = Formulas.calcShldUse(getOwner(), target, skill);
byte shld = Formulas.calcShldUse(_owner, target, skill);
boolean acted = Formulas.calcCubicSkillSuccess(this, target, skill, shld);
if (!acted)
{
getOwner().sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
_owner.sendPacket(SystemMessageId.YOUR_ATTACK_HAS_FAILED);
continue;
}
}
// Apply effects
skill.applyEffects(getOwner(), this, target, false, false, true, 0);
skill.applyEffects(_owner, target, false, false, true, 0);
// If this is a bad skill notify the duel manager, so it can be removed after the duel (player & target must be in the same duel).
if (target.isPlayer() && target.getActingPlayer().isInDuel() && skill.isBad() && (getOwner().getDuelId() == target.getActingPlayer().getDuelId()))
if (target.isPlayer() && target.getActingPlayer().isInDuel() && skill.isBad() && (_owner.getDuelId() == target.getActingPlayer().getDuelId()))
{
DuelManager.getInstance().onBuff(target.getActingPlayer(), skill);
}
@ -504,11 +504,10 @@ public final class L2CubicInstance implements IIdentifiable
}
/**
* @param activeCubic
* @param skill
* @param targets
*/
public void useCubicMdam(L2CubicInstance activeCubic, Skill skill, L2Object[] targets)
public void useCubicMdam(Skill skill, L2Object[] targets)
{
for (L2Character target : (L2Character[]) targets)
{
@ -529,9 +528,9 @@ public final class L2CubicInstance implements IIdentifiable
}
}
boolean mcrit = Formulas.calcMCrit(activeCubic.getOwner().getMCriticalHit(target, skill));
byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, skill);
int damage = (int) Formulas.calcMagicDam(activeCubic, target, skill, mcrit, shld);
boolean mcrit = Formulas.calcMCrit(_owner.getMCriticalHit(target, skill));
byte shld = Formulas.calcShldUse(_owner, target, skill);
int damage = (int) Formulas.calcMagicDam(this, target, skill, mcrit, shld);
if (Config.DEBUG)
{
@ -554,14 +553,14 @@ public final class L2CubicInstance implements IIdentifiable
}
else
{
activeCubic.getOwner().sendDamageMessage(target, damage, mcrit, false, false);
target.reduceCurrentHp(damage, activeCubic.getOwner(), skill);
_owner.sendDamageMessage(target, damage, mcrit, false, false);
target.reduceCurrentHp(damage, _owner, skill);
}
}
}
}
public void useCubicDrain(L2CubicInstance activeCubic, Skill skill, L2Object[] targets)
public void useCubicDrain(Skill skill, L2Object[] targets)
{
if (Config.DEBUG)
{
@ -575,10 +574,10 @@ public final class L2CubicInstance implements IIdentifiable
continue;
}
boolean mcrit = Formulas.calcMCrit(activeCubic.getOwner().getMCriticalHit(target, skill));
byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, skill);
boolean mcrit = Formulas.calcMCrit(_owner.getMCriticalHit(target, skill));
byte shld = Formulas.calcShldUse(_owner, target, skill);
int damage = (int) Formulas.calcMagicDam(activeCubic, target, skill, mcrit, shld);
int damage = (int) Formulas.calcMagicDam(this, target, skill, mcrit, shld);
if (Config.DEBUG)
{
_log.info("L2SkillDrain: useCubicSkill() -> damage = " + damage);
@ -586,7 +585,7 @@ public final class L2CubicInstance implements IIdentifiable
// TODO: Unhardcode fixed value
double hpAdd = (0.4 * damage);
L2PcInstance owner = activeCubic.getOwner();
L2PcInstance owner = _owner;
double hp = ((owner.getCurrentHp() + hpAdd) > owner.getMaxHp() ? owner.getMaxHp() : (owner.getCurrentHp() + hpAdd));
owner.setCurrentHp(hp);
@ -594,7 +593,7 @@ public final class L2CubicInstance implements IIdentifiable
// Check to see if we should damage the target
if ((damage > 0) && !target.isDead())
{
target.reduceCurrentHp(damage, activeCubic.getOwner(), skill);
target.reduceCurrentHp(damage, _owner, skill);
// Manage attack or cast break of the target (calculating rate, sending message...)
if (!target.isRaid() && Formulas.calcAtkBreak(target, damage))
@ -621,17 +620,17 @@ public final class L2CubicInstance implements IIdentifiable
continue;
}
byte shld = Formulas.calcShldUse(getOwner(), target, skill);
byte shld = Formulas.calcShldUse(_owner, target, skill);
if (skill.hasEffectType(L2EffectType.STUN, L2EffectType.PARALYZE, L2EffectType.ROOT))
{
if (Formulas.calcCubicSkillSuccess(this, target, skill, shld))
{
// Apply effects
skill.applyEffects(getOwner(), this, target, false, false, true, 0);
skill.applyEffects(_owner, target, false, false, true, 0);
// If this is a bad skill notify the duel manager, so it can be removed after the duel (player & target must be in the same duel).
if (target.isPlayer() && target.getActingPlayer().isInDuel() && skill.isBad() && (getOwner().getDuelId() == target.getActingPlayer().getDuelId()))
if (target.isPlayer() && target.getActingPlayer().isInDuel() && skill.isBad() && (_owner.getDuelId() == target.getActingPlayer().getDuelId()))
{
DuelManager.getInstance().onBuff(target.getActingPlayer(), skill);
}
@ -656,11 +655,11 @@ public final class L2CubicInstance implements IIdentifiable
{
if (target.isAttackable())
{
target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getOwner(), (int) ((150 * skill.getPower()) / (target.getLevel() + 7)));
target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, _owner, (int) ((150 * skill.getPower()) / (target.getLevel() + 7)));
}
// Apply effects
skill.applyEffects(getOwner(), this, target, false, false, true, 0);
skill.applyEffects(_owner, target, false, false, true, 0);
if (Config.DEBUG)
{

View File

@ -121,9 +121,12 @@ public final class CubicAction implements Runnable
}
else if (Rnd.get(1, 100) < _chance)
{
Skill skill = _cubic.getSkills().get(Rnd.get(_cubic.getSkills().size()));
if (skill != null)
final Skill skill = _cubic.getSkills().get(Rnd.get(_cubic.getSkills().size()));
if (skill == null)
{
return;
}
if (skill.getId() == L2CubicInstance.SKILL_CUBIC_HEAL)
{
// friendly skill, so we look a target in owner's party
@ -164,7 +167,7 @@ public final class CubicAction implements Runnable
}
else
{
skill.activateSkill(_cubic.getOwner(), targets);
skill.activateSkill(_cubic, targets);
if (Config.DEBUG)
{
_log.info("L2CubicInstance: Action.run(); other handler");
@ -177,7 +180,7 @@ public final class CubicAction implements Runnable
{
_log.info("L2CubicInstance: Action.run() skill " + skill);
}
_cubic.useCubicMdam(_cubic, skill, targets);
_cubic.useCubicMdam(skill, targets);
}
else if (skill.hasEffectType(L2EffectType.HP_DRAIN))
{
@ -185,7 +188,7 @@ public final class CubicAction implements Runnable
{
_log.info("L2CubicInstance: Action.run() skill " + skill);
}
_cubic.useCubicDrain(_cubic, skill, targets);
_cubic.useCubicDrain(skill, targets);
}
else if (skill.hasEffectType(L2EffectType.STUN, L2EffectType.ROOT, L2EffectType.PARALYZE))
{
@ -217,7 +220,6 @@ public final class CubicAction implements Runnable
}
}
}
}
catch (Exception e)
{
_log.log(Level.SEVERE, "", e);

View File

@ -56,38 +56,27 @@ public class CubicHeal implements Runnable
_cubic.cancelDisappear();
return;
}
try
{
Skill skill = null;
for (Skill sk : _cubic.getSkills())
final Skill skill = _cubic.getSkills().stream().filter(s -> s.getId() == L2CubicInstance.SKILL_CUBIC_HEAL).findFirst().orElse(null);
if (skill == null)
{
if (sk.getId() == L2CubicInstance.SKILL_CUBIC_HEAL)
{
skill = sk;
break;
}
return;
}
if (skill != null)
{
_cubic.cubicTargetForHeal();
final L2Character target = _cubic.getTarget();
if ((target != null) && !target.isDead())
{
if ((target.getMaxHp() - target.getCurrentHp()) > skill.getPower())
{
L2Character[] targets =
{
target
};
skill.activateSkill(_cubic.getOwner(), targets);
skill.activateSkill(_cubic, target);
_cubic.getOwner().broadcastPacket(new MagicSkillUse(_cubic.getOwner(), target, skill.getId(), skill.getLevel(), 0, 0));
}
}
}
}
catch (Exception e)
{
_log.log(Level.SEVERE, "", e);

View File

@ -135,7 +135,7 @@ public class TvTEventTeam
}
/**
* Returns name and instance of all participated players in FastMap<br>
* Returns name and instance of all participated players in Map<br>
* <br>
* @return Map<String, L2PcInstance>: map of players in this team<br>
*/

View File

@ -97,7 +97,7 @@ public class LongTimeEvent extends Quest
{
long delay = _eventPeriod.getStartDate().getTime() - System.currentTimeMillis();
ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleStart(), delay);
_log.info("Event " + _eventName + " will be started at " + _eventPeriod.getEndDate());
_log.info("Event " + _eventName + " will be started at " + _eventPeriod.getStartDate());
}
else
{
@ -266,17 +266,21 @@ public class LongTimeEvent extends Quest
*/
protected void startEvent()
{
long currentTime = System.currentTimeMillis();
// Add drop
if (_dropList != null)
{
if (currentTime < _dropPeriod.getEndDate().getTime())
{
for (GeneralDropItem drop : _dropList)
{
EventDroplist.getInstance().addGlobalDrop(drop.getItemId(), drop.getMin(), drop.getMax(), (int) drop.getChance(), _dropPeriod);
}
}
}
// Add spawns
Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - currentTime;
if (_spawnList != null)
{
for (NpcSpawn spawn : _spawnList)

View File

@ -385,12 +385,7 @@ public abstract class Inventory extends ItemContainer
final Skill unequipSkill = it.getUnequipSkill();
if (unequipSkill != null)
{
L2PcInstance[] targets =
{
player
};
unequipSkill.activateSkill(player, targets);
unequipSkill.activateSkill(player, player);
}
// Remove itemEquip skill
@ -492,12 +487,7 @@ public abstract class Inventory extends ItemContainer
final Skill itemEquipSkill = it.getEquipSkill();
if (itemEquipSkill != null)
{
L2PcInstance[] targets =
{
player
};
itemEquipSkill.activateSkill(player, targets);
itemEquipSkill.activateSkill(player, player);
}
if (update)

View File

@ -365,12 +365,7 @@ public final class L2Weapon extends L2Item
return;
}
L2Character[] targets =
{
target
};
onCritSkill.activateSkill(caster, targets);
onCritSkill.activateSkill(caster, target);
}
/**
@ -429,18 +424,18 @@ public final class L2Weapon extends L2Item
return;
}
// Launch the magic skill and calculate its effects
// Get the skill handler corresponding to the skill type
onMagicSkill.activateSkill(caster, target);
// notify quests of a skill use
if (caster instanceof L2PcInstance)
{
L2Character[] targets =
{
target
};
// Launch the magic skill and calculate its effects
// Get the skill handler corresponding to the skill type
onMagicSkill.activateSkill(caster, targets);
// notify quests of a skill use
if (caster instanceof L2PcInstance)
{
//@formatter:off
caster.getKnownList().getKnownObjects().values().stream()
.filter(Objects::nonNull)

View File

@ -221,8 +221,8 @@ public final class QuestState
* <ul>
* <li>Initialize class variable "vars" if is null.</li>
* <li>Initialize parameter "val" if is null</li>
* <li>Add/Update couple (var,val) in class variable HashMap "vars"</li>
* <li>If the key represented by "var" exists in HashMap "vars", the couple (var,val) is updated in the database.<br>
* <li>Add/Update couple (var,val) in class variable Map "vars"</li>
* <li>If the key represented by "var" exists in Map "vars", the couple (var,val) is updated in the database.<br>
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>

View File

@ -886,7 +886,7 @@ public final class Skill implements IIdentifiable
public boolean useSoulShot()
{
return (hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK));
return hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK);
}
public boolean useSpiritShot()
@ -1324,18 +1324,18 @@ public final class Skill implements IIdentifiable
}
/**
* Method overload for {@link Skill#applyEffects(L2Character, L2CubicInstance, L2Character, boolean, boolean, boolean, int)}.<br>
* Method overload for {@link Skill#applyEffects(L2Character, L2Character, boolean, boolean, boolean, int)}.<br>
* Simplify the calls.
* @param effector the caster of the skill
* @param effected the target of the effect
*/
public void applyEffects(L2Character effector, L2Character effected)
{
applyEffects(effector, null, effected, false, false, true, 0);
applyEffects(effector, effected, false, false, true, 0);
}
/**
* Method overload for {@link Skill#applyEffects(L2Character, L2CubicInstance, L2Character, boolean, boolean, boolean, int)}.<br>
* Method overload for {@link Skill#applyEffects(L2Character, L2Character, boolean, boolean, boolean, int)}.<br>
* Simplify the calls, allowing abnormal time time customization.
* @param effector the caster of the skill
* @param effected the target of the effect
@ -1344,20 +1344,19 @@ public final class Skill implements IIdentifiable
*/
public void applyEffects(L2Character effector, L2Character effected, boolean instant, int abnormalTime)
{
applyEffects(effector, null, effected, false, false, instant, abnormalTime);
applyEffects(effector, effected, false, false, instant, abnormalTime);
}
/**
* Applies the effects from this skill to the target.
* @param effector the caster of the skill
* @param cubic the cubic that cast the skill, can be {@code null}
* @param effected the target of the effect
* @param self if {@code true} self-effects will be casted on the caster
* @param passive if {@code true} passive effects will be applied to the effector
* @param instant if {@code true} instant effects will be applied to the effected
* @param abnormalTime custom abnormal time, if equal or lesser than zero will be ignored
*/
public void applyEffects(L2Character effector, L2CubicInstance cubic, L2Character effected, boolean self, boolean passive, boolean instant, int abnormalTime)
public void applyEffects(L2Character effector, L2Character effected, boolean self, boolean passive, boolean instant, int abnormalTime)
{
// null targets cannot receive any effects.
if (effected == null)
@ -1449,11 +1448,32 @@ public final class Skill implements IIdentifiable
}
/**
* Activates the skill to the targets.
* Activates a skill for the given creature and targets.
* @param caster the caster
* @param targets the targets
*/
public void activateSkill(L2Character caster, L2Object[] targets)
public void activateSkill(L2Character caster, L2Object... targets)
{
activateSkill(caster, null, targets);
}
/**
* Activates a skill for the given cubic and targets.
* @param cubic the cubic
* @param targets the targets
*/
public void activateSkill(L2CubicInstance cubic, L2Object... targets)
{
activateSkill(cubic.getOwner(), cubic, targets);
}
/**
* Activates the skill to the targets.
* @param caster the caster
* @param cubic the cubic, can be {@code null}
* @param targets the targets
*/
private void activateSkill(L2Character caster, L2CubicInstance cubic, L2Object... targets)
{
switch (getId())
{
@ -1525,9 +1545,11 @@ public final class Skill implements IIdentifiable
{
caster.stopSkillEffects(true, getId());
}
applyEffects(caster, null, caster, true, false, true, 0);
applyEffects(caster, caster, true, false, true, 0);
}
if (cubic == null)
{
if (useSpiritShot())
{
caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false);
@ -1537,6 +1559,7 @@ public final class Skill implements IIdentifiable
caster.setChargedShot(ShotType.SOULSHOTS, false);
}
}
}
public void attach(FuncTemplate f)
{

View File

@ -65,7 +65,8 @@ public class DateRange
public boolean isWithinRange(Date date)
{
return date.after(_startDate) && date.before(_endDate);
return (date.equals(_startDate) || date.after(_startDate)) //
&& (date.equals(_endDate) || date.before(_endDate));
}
public Date getEndDate()

View File

@ -18,20 +18,23 @@
*/
package com.l2jserver.util;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.nio.channels.SocketChannel;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.logging.Logger;
import commons.mmocore.IAcceptFilter;
/**
* IPv4 filter.
* @author Forsaiken
* @author Forsaiken, Zoey76
*/
public class IPv4Filter implements IAcceptFilter, Runnable
{
private static final Logger LOG = Logger.getLogger(IPv4Filter.class.getName());
private final HashMap<Integer, Flood> _ipFloodMap;
private static final long SLEEP_TIME = 5000;
@ -67,9 +70,14 @@ public class IPv4Filter implements IAcceptFilter, Runnable
@Override
public boolean accept(SocketChannel sc)
{
InetAddress addr = sc.socket().getInetAddress();
int h = hash(addr.getAddress());
final InetAddress addr = sc.socket().getInetAddress();
if (!(addr instanceof Inet4Address))
{
LOG.info(IPv4Filter.class.getSimpleName() + ": Someone tried to connect from something other than IPv4: " + addr.getHostAddress());
return false;
}
final int h = hash(addr.getAddress());
long current = System.currentTimeMillis();
Flood f;
synchronized (_ipFloodMap)