Sync with L2jServer HighFive Mar 25th 2015.

This commit is contained in:
MobiusDev
2015-03-25 06:48:51 +00:00
parent e0c66b1412
commit 82606870c0
194 changed files with 2619 additions and 2869 deletions

View File

@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import quests.Q00020_BringUpWithLove.Q00020_BringUpWithLove;
import ai.npc.AbstractNpcAI;
@@ -104,8 +105,8 @@ public final class BeastFarm extends AbstractNpcAI
18900
};
private static Map<Integer, Integer> _FeedInfo = new HashMap<>();
private static Map<Integer, GrowthCapableMob> _GrowthCapableMobs = new HashMap<>();
private static final Map<Integer, Integer> FEED_INFO = new ConcurrentHashMap<>();
private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>();
private static List<TamedBeast> TAMED_BEAST_DATA = new ArrayList<>();
private BeastFarm()
@@ -124,23 +125,23 @@ public final class BeastFarm extends AbstractNpcAI
temp.addNpcIdForSkillId(SKILL_BLESSED_CRYSTAL_SPICE, 18869);
temp.addNpcIdForSkillId(SKILL_SGRADE_GOLDEN_SPICE, 18878);
temp.addNpcIdForSkillId(SKILL_SGRADE_CRYSTAL_SPICE, 18879);
_GrowthCapableMobs.put(18873, temp);
GROWTH_CAPABLE_MONSTERS.put(18873, temp);
temp = new GrowthCapableMob(40, 1, 18869);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18876);
_GrowthCapableMobs.put(18874, temp);
GROWTH_CAPABLE_MONSTERS.put(18874, temp);
temp = new GrowthCapableMob(40, 1, 18869);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18877);
_GrowthCapableMobs.put(18875, temp);
GROWTH_CAPABLE_MONSTERS.put(18875, temp);
temp = new GrowthCapableMob(25, 2, 18869);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18878);
_GrowthCapableMobs.put(18876, temp);
GROWTH_CAPABLE_MONSTERS.put(18876, temp);
temp = new GrowthCapableMob(25, 2, 18869);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18879);
_GrowthCapableMobs.put(18877, temp);
GROWTH_CAPABLE_MONSTERS.put(18877, temp);
// Cougar
temp = new GrowthCapableMob(100, 0, 18870);
@@ -150,23 +151,23 @@ public final class BeastFarm extends AbstractNpcAI
temp.addNpcIdForSkillId(SKILL_BLESSED_CRYSTAL_SPICE, 18870);
temp.addNpcIdForSkillId(SKILL_SGRADE_GOLDEN_SPICE, 18885);
temp.addNpcIdForSkillId(SKILL_SGRADE_CRYSTAL_SPICE, 18886);
_GrowthCapableMobs.put(18880, temp);
GROWTH_CAPABLE_MONSTERS.put(18880, temp);
temp = new GrowthCapableMob(40, 1, 18870);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18883);
_GrowthCapableMobs.put(18881, temp);
GROWTH_CAPABLE_MONSTERS.put(18881, temp);
temp = new GrowthCapableMob(40, 1, 18870);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18884);
_GrowthCapableMobs.put(18882, temp);
GROWTH_CAPABLE_MONSTERS.put(18882, temp);
temp = new GrowthCapableMob(25, 2, 18870);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18885);
_GrowthCapableMobs.put(18883, temp);
GROWTH_CAPABLE_MONSTERS.put(18883, temp);
temp = new GrowthCapableMob(25, 2, 18870);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18886);
_GrowthCapableMobs.put(18884, temp);
GROWTH_CAPABLE_MONSTERS.put(18884, temp);
// Buffalo
temp = new GrowthCapableMob(100, 0, 18871);
@@ -176,23 +177,23 @@ public final class BeastFarm extends AbstractNpcAI
temp.addNpcIdForSkillId(SKILL_BLESSED_CRYSTAL_SPICE, 18871);
temp.addNpcIdForSkillId(SKILL_SGRADE_GOLDEN_SPICE, 18892);
temp.addNpcIdForSkillId(SKILL_SGRADE_CRYSTAL_SPICE, 18893);
_GrowthCapableMobs.put(18887, temp);
GROWTH_CAPABLE_MONSTERS.put(18887, temp);
temp = new GrowthCapableMob(40, 1, 18871);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18890);
_GrowthCapableMobs.put(18888, temp);
GROWTH_CAPABLE_MONSTERS.put(18888, temp);
temp = new GrowthCapableMob(40, 1, 18871);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18891);
_GrowthCapableMobs.put(18889, temp);
GROWTH_CAPABLE_MONSTERS.put(18889, temp);
temp = new GrowthCapableMob(25, 2, 18871);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18892);
_GrowthCapableMobs.put(18890, temp);
GROWTH_CAPABLE_MONSTERS.put(18890, temp);
temp = new GrowthCapableMob(25, 2, 18871);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18893);
_GrowthCapableMobs.put(18891, temp);
GROWTH_CAPABLE_MONSTERS.put(18891, temp);
// Grendel
temp = new GrowthCapableMob(100, 0, 18872);
@@ -202,23 +203,23 @@ public final class BeastFarm extends AbstractNpcAI
temp.addNpcIdForSkillId(SKILL_BLESSED_CRYSTAL_SPICE, 18872);
temp.addNpcIdForSkillId(SKILL_SGRADE_GOLDEN_SPICE, 18899);
temp.addNpcIdForSkillId(SKILL_SGRADE_CRYSTAL_SPICE, 18900);
_GrowthCapableMobs.put(18894, temp);
GROWTH_CAPABLE_MONSTERS.put(18894, temp);
temp = new GrowthCapableMob(40, 1, 18872);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18897);
_GrowthCapableMobs.put(18895, temp);
GROWTH_CAPABLE_MONSTERS.put(18895, temp);
temp = new GrowthCapableMob(40, 1, 18872);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18898);
_GrowthCapableMobs.put(18896, temp);
GROWTH_CAPABLE_MONSTERS.put(18896, temp);
temp = new GrowthCapableMob(25, 2, 18872);
temp.addNpcIdForSkillId(SKILL_GOLDEN_SPICE, 18899);
_GrowthCapableMobs.put(18897, temp);
GROWTH_CAPABLE_MONSTERS.put(18897, temp);
temp = new GrowthCapableMob(25, 2, 18872);
temp.addNpcIdForSkillId(SKILL_CRYSTAL_SPICE, 18900);
_GrowthCapableMobs.put(18898, temp);
GROWTH_CAPABLE_MONSTERS.put(18898, temp);
// Tamed beasts data
TAMED_BEAST_DATA.add(new TamedBeast("%name% of Focus", new SkillHolder(6432, 1), new SkillHolder(6668, 1)));
@@ -232,11 +233,11 @@ public final class BeastFarm extends AbstractNpcAI
public void spawnNext(L2Npc npc, L2PcInstance player, int nextNpcId, int food)
{
// remove the feedinfo of the mob that got despawned, if any
if (_FeedInfo.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()))
{
if (_FeedInfo.get(npc.getObjectId()) == player.getObjectId())
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
_FeedInfo.remove(npc.getObjectId());
FEED_INFO.remove(npc.getObjectId());
}
}
// despawn the old mob
@@ -289,7 +290,7 @@ public final class BeastFarm extends AbstractNpcAI
L2Attackable nextNpc = (L2Attackable) addSpawn(nextNpcId, npc);
// register the player in the feedinfo for the mob that just spawned
_FeedInfo.put(nextNpc.getObjectId(), player.getObjectId());
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -319,19 +320,19 @@ public final class BeastFarm extends AbstractNpcAI
// first gather some values on local variables
int objectId = npc.getObjectId();
int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in _GrowthCapableMobs, then it's at max growth (3)
if (_GrowthCapableMobs.containsKey(npcId))
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
{
growthLevel = _GrowthCapableMobs.get(npcId).getGrowthLevel();
growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel();
}
// prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast
// If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder!
if ((growthLevel == 0) && _FeedInfo.containsKey(objectId))
if ((growthLevel == 0) && FEED_INFO.containsKey(objectId))
{
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
_FeedInfo.put(objectId, caster.getObjectId());
FEED_INFO.put(objectId, caster.getObjectId());
// display the social action of the beast eating the food.
npc.broadcastSocialAction(2);
@@ -347,22 +348,22 @@ public final class BeastFarm extends AbstractNpcAI
}
// if this pet can't grow, it's all done.
if (_GrowthCapableMobs.containsKey(npcId))
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
{
// do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
int newNpcId = _GrowthCapableMobs.get(npcId).getLeveledNpcId(skillId);
int newNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getLeveledNpcId(skillId);
if (newNpcId == -1)
{
if (growthLevel == 0)
{
_FeedInfo.remove(objectId);
FEED_INFO.remove(objectId);
npc.setRunning();
((L2Attackable) npc).addDamageHate(caster, 0, 1);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
else if ((growthLevel > 0) && (_FeedInfo.get(objectId) != caster.getObjectId()))
else if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId()))
{
// check if this is the same player as the one who raised it from growth 0.
// if no, then do not allow a chance to raise the pet (food gets consumed but has no effect).
@@ -382,9 +383,9 @@ public final class BeastFarm extends AbstractNpcAI
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
// remove the feedinfo of the mob that got killed, if any
if (_FeedInfo.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()))
{
_FeedInfo.remove(npc.getObjectId());
FEED_INFO.remove(npc.getObjectId());
}
return super.onKill(npc, killer, isSummon);
}

View File

@@ -20,6 +20,7 @@ package ai.group_template;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import quests.Q00020_BringUpWithLove.Q00020_BringUpWithLove;
import quests.Q00655_AGrandPlanForTamingWildBeasts.Q00655_AGrandPlanForTamingWildBeasts;
@@ -129,8 +130,8 @@ public final class FeedableBeasts extends AbstractNpcAI
NpcStringId.ANIMALS_NEED_LOVE_TOO
};
private static Map<Integer, Integer> _FeedInfo = new HashMap<>();
private static Map<Integer, GrowthCapableMob> _GrowthCapableMobs = new HashMap<>();
private static final Map<Integer, Integer> FEED_INFO = new ConcurrentHashMap<>();
private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>();
// all mobs that grow by eating
private static class GrowthCapableMob
@@ -221,139 +222,139 @@ public final class FeedableBeasts extends AbstractNpcAI
temp = new GrowthCapableMob(0, 100);
temp.addMobs(GOLDEN_SPICE, Kookabura_0_Gold);
temp.addMobs(CRYSTAL_SPICE, Kookabura_0_Crystal);
_GrowthCapableMobs.put(21451, temp);
GROWTH_CAPABLE_MONSTERS.put(21451, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_1);
_GrowthCapableMobs.put(21452, temp);
_GrowthCapableMobs.put(21454, temp);
GROWTH_CAPABLE_MONSTERS.put(21452, temp);
GROWTH_CAPABLE_MONSTERS.put(21454, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_2);
_GrowthCapableMobs.put(21453, temp);
_GrowthCapableMobs.put(21455, temp);
GROWTH_CAPABLE_MONSTERS.put(21453, temp);
GROWTH_CAPABLE_MONSTERS.put(21455, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_1);
_GrowthCapableMobs.put(21456, temp);
_GrowthCapableMobs.put(21458, temp);
GROWTH_CAPABLE_MONSTERS.put(21456, temp);
GROWTH_CAPABLE_MONSTERS.put(21458, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_2);
_GrowthCapableMobs.put(21457, temp);
_GrowthCapableMobs.put(21459, temp);
GROWTH_CAPABLE_MONSTERS.put(21457, temp);
GROWTH_CAPABLE_MONSTERS.put(21459, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Kookabura_2_1);
_GrowthCapableMobs.put(21460, temp);
_GrowthCapableMobs.put(21462, temp);
GROWTH_CAPABLE_MONSTERS.put(21460, temp);
GROWTH_CAPABLE_MONSTERS.put(21462, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Kookabura_2_2);
_GrowthCapableMobs.put(21461, temp);
_GrowthCapableMobs.put(21463, temp);
GROWTH_CAPABLE_MONSTERS.put(21461, temp);
GROWTH_CAPABLE_MONSTERS.put(21463, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_1);
_GrowthCapableMobs.put(21464, temp);
_GrowthCapableMobs.put(21466, temp);
GROWTH_CAPABLE_MONSTERS.put(21464, temp);
GROWTH_CAPABLE_MONSTERS.put(21466, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_2);
_GrowthCapableMobs.put(21465, temp);
_GrowthCapableMobs.put(21467, temp);
GROWTH_CAPABLE_MONSTERS.put(21465, temp);
GROWTH_CAPABLE_MONSTERS.put(21467, temp);
// Alpen Buffalo
temp = new GrowthCapableMob(0, 100);
temp.addMobs(GOLDEN_SPICE, Buffalo_0_Gold);
temp.addMobs(CRYSTAL_SPICE, Buffalo_0_Crystal);
_GrowthCapableMobs.put(21470, temp);
GROWTH_CAPABLE_MONSTERS.put(21470, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_1);
_GrowthCapableMobs.put(21471, temp);
_GrowthCapableMobs.put(21473, temp);
GROWTH_CAPABLE_MONSTERS.put(21471, temp);
GROWTH_CAPABLE_MONSTERS.put(21473, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_2);
_GrowthCapableMobs.put(21472, temp);
_GrowthCapableMobs.put(21474, temp);
GROWTH_CAPABLE_MONSTERS.put(21472, temp);
GROWTH_CAPABLE_MONSTERS.put(21474, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_1);
_GrowthCapableMobs.put(21475, temp);
_GrowthCapableMobs.put(21477, temp);
GROWTH_CAPABLE_MONSTERS.put(21475, temp);
GROWTH_CAPABLE_MONSTERS.put(21477, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_2);
_GrowthCapableMobs.put(21476, temp);
_GrowthCapableMobs.put(21478, temp);
GROWTH_CAPABLE_MONSTERS.put(21476, temp);
GROWTH_CAPABLE_MONSTERS.put(21478, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Buffalo_2_1);
_GrowthCapableMobs.put(21479, temp);
_GrowthCapableMobs.put(21481, temp);
GROWTH_CAPABLE_MONSTERS.put(21479, temp);
GROWTH_CAPABLE_MONSTERS.put(21481, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Buffalo_2_2);
_GrowthCapableMobs.put(21480, temp);
_GrowthCapableMobs.put(21482, temp);
GROWTH_CAPABLE_MONSTERS.put(21480, temp);
GROWTH_CAPABLE_MONSTERS.put(21482, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_1);
_GrowthCapableMobs.put(21483, temp);
_GrowthCapableMobs.put(21485, temp);
GROWTH_CAPABLE_MONSTERS.put(21483, temp);
GROWTH_CAPABLE_MONSTERS.put(21485, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_2);
_GrowthCapableMobs.put(21484, temp);
_GrowthCapableMobs.put(21486, temp);
GROWTH_CAPABLE_MONSTERS.put(21484, temp);
GROWTH_CAPABLE_MONSTERS.put(21486, temp);
// Alpen Cougar
temp = new GrowthCapableMob(0, 100);
temp.addMobs(GOLDEN_SPICE, Cougar_0_Gold);
temp.addMobs(CRYSTAL_SPICE, Cougar_0_Crystal);
_GrowthCapableMobs.put(21489, temp);
GROWTH_CAPABLE_MONSTERS.put(21489, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_1);
_GrowthCapableMobs.put(21490, temp);
_GrowthCapableMobs.put(21492, temp);
GROWTH_CAPABLE_MONSTERS.put(21490, temp);
GROWTH_CAPABLE_MONSTERS.put(21492, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_2);
_GrowthCapableMobs.put(21491, temp);
_GrowthCapableMobs.put(21493, temp);
GROWTH_CAPABLE_MONSTERS.put(21491, temp);
GROWTH_CAPABLE_MONSTERS.put(21493, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_1);
_GrowthCapableMobs.put(21494, temp);
_GrowthCapableMobs.put(21496, temp);
GROWTH_CAPABLE_MONSTERS.put(21494, temp);
GROWTH_CAPABLE_MONSTERS.put(21496, temp);
temp = new GrowthCapableMob(1, 40);
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_2);
_GrowthCapableMobs.put(21495, temp);
_GrowthCapableMobs.put(21497, temp);
GROWTH_CAPABLE_MONSTERS.put(21495, temp);
GROWTH_CAPABLE_MONSTERS.put(21497, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Cougar_2_1);
_GrowthCapableMobs.put(21498, temp);
_GrowthCapableMobs.put(21500, temp);
GROWTH_CAPABLE_MONSTERS.put(21498, temp);
GROWTH_CAPABLE_MONSTERS.put(21500, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(GOLDEN_SPICE, Cougar_2_2);
_GrowthCapableMobs.put(21499, temp);
_GrowthCapableMobs.put(21501, temp);
GROWTH_CAPABLE_MONSTERS.put(21499, temp);
GROWTH_CAPABLE_MONSTERS.put(21501, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Cougar_2_1);
_GrowthCapableMobs.put(21502, temp);
_GrowthCapableMobs.put(21504, temp);
GROWTH_CAPABLE_MONSTERS.put(21502, temp);
GROWTH_CAPABLE_MONSTERS.put(21504, temp);
temp = new GrowthCapableMob(2, 25);
temp.addMobs(CRYSTAL_SPICE, Cougar_2_2);
_GrowthCapableMobs.put(21503, temp);
_GrowthCapableMobs.put(21505, temp);
GROWTH_CAPABLE_MONSTERS.put(21503, temp);
GROWTH_CAPABLE_MONSTERS.put(21505, temp);
}
private void spawnNext(L2Npc npc, int growthLevel, L2PcInstance player, int food)
@@ -369,11 +370,11 @@ public final class FeedableBeasts extends AbstractNpcAI
{
if (player.getClassId().isMage())
{
nextNpcId = _GrowthCapableMobs.get(npcId).getMob(food, 1, 1);
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 1);
}
else
{
nextNpcId = _GrowthCapableMobs.get(npcId).getMob(food, 1, 0);
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 0);
}
}
else
@@ -382,26 +383,26 @@ public final class FeedableBeasts extends AbstractNpcAI
// that is a stronger-than-normal animal that attacks its feeder
if (getRandom(5) == 0)
{
nextNpcId = _GrowthCapableMobs.get(npcId).getMob(food, 0, 1);
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1);
}
else
{
nextNpcId = _GrowthCapableMobs.get(npcId).getMob(food, 0, 0);
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0);
}
}
}
else
{
// all other levels of growth are straight-forward
nextNpcId = _GrowthCapableMobs.get(npcId).getRandomMob(food);
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getRandomMob(food);
}
// remove the feedinfo of the mob that got despawned, if any
if (_FeedInfo.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()))
{
if (_FeedInfo.get(npc.getObjectId()) == player.getObjectId())
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
_FeedInfo.remove(npc.getObjectId());
FEED_INFO.remove(npc.getObjectId());
}
}
// despawn the old mob
@@ -476,7 +477,7 @@ public final class FeedableBeasts extends AbstractNpcAI
}
// register the player in the feedinfo for the mob that just spawned
_FeedInfo.put(nextNpc.getObjectId(), player.getObjectId());
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -491,9 +492,9 @@ public final class FeedableBeasts extends AbstractNpcAI
if (MAD_COW_POLYMORPH.containsKey(npc.getId()))
{
// remove the feed info from the previous mob
if (_FeedInfo.get(npc.getObjectId()) == player.getObjectId())
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
_FeedInfo.remove(npc.getObjectId());
FEED_INFO.remove(npc.getObjectId());
}
// despawn the mad cow
npc.deleteMe();
@@ -501,7 +502,7 @@ public final class FeedableBeasts extends AbstractNpcAI
L2Attackable nextNpc = (L2Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
// register the player in the feedinfo for the mob that just spawned
_FeedInfo.put(nextNpc.getObjectId(), player.getObjectId());
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -531,19 +532,19 @@ public final class FeedableBeasts extends AbstractNpcAI
// first gather some values on local variables
int objectId = npc.getObjectId();
int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in _GrowthCapableMobs, then it's at max growth (3)
if (_GrowthCapableMobs.containsKey(npcId))
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
{
growthLevel = _GrowthCapableMobs.get(npcId).getGrowthLevel();
growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel();
}
// prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast
// If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder!
if ((growthLevel == 0) && _FeedInfo.containsKey(objectId))
if ((growthLevel == 0) && FEED_INFO.containsKey(objectId))
{
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
_FeedInfo.put(objectId, caster.getObjectId());
FEED_INFO.put(objectId, caster.getObjectId());
int food = 0;
if (skillId == SKILL_GOLDEN_SPICE)
@@ -559,10 +560,10 @@ public final class FeedableBeasts extends AbstractNpcAI
npc.broadcastSocialAction(2);
// if this pet can't grow, it's all done.
if (_GrowthCapableMobs.containsKey(npcId))
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
{
// do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
if (_GrowthCapableMobs.get(npcId).getMob(food, 0, 0) == null)
if (GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0) == null)
{
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
@@ -579,7 +580,7 @@ public final class FeedableBeasts extends AbstractNpcAI
npc.broadcastPacket(packet);
}
if ((growthLevel > 0) && (_FeedInfo.get(objectId) != caster.getObjectId()))
if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId()))
{
// check if this is the same player as the one who raised it from growth 0.
// if no, then do not allow a chance to raise the pet (food gets consumed but has no effect).
@@ -587,7 +588,7 @@ public final class FeedableBeasts extends AbstractNpcAI
}
// Polymorph the mob, with a certain chance, given its current growth level
if (getRandom(100) < _GrowthCapableMobs.get(npcId).getChance())
if (getRandom(100) < GROWTH_CAPABLE_MONSTERS.get(npcId).getChance())
{
spawnNext(npc, growthLevel, caster, food);
}
@@ -614,9 +615,9 @@ public final class FeedableBeasts extends AbstractNpcAI
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
// remove the feedinfo of the mob that got killed, if any
if (_FeedInfo.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()))
{
_FeedInfo.remove(npc.getObjectId());
FEED_INFO.remove(npc.getObjectId());
}
return super.onKill(npc, killer, isSummon);
}

View File

@@ -33,7 +33,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
*/
public final class RandomSpawn extends AbstractNpcAI
{
private static Map<Integer, Location[]> SPAWN_POINTS = new HashMap<>();
private static final Map<Integer, Location[]> SPAWN_POINTS = new HashMap<>();
static
{
// Keltas