Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: dist/game/data/scripts/ai/others/HomunculusKilledMobsCounter.java
- ===================================================================
- --- dist/game/data/scripts/ai/others/HomunculusKilledMobsCounter.java (nonexistent)
- +++ dist/game/data/scripts/ai/others/HomunculusKilledMobsCounter.java (working copy)
- @@ -0,0 +1,61 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package ai.others;
- +
- +import org.l2jmobius.gameserver.model.actor.Creature;
- +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.events.EventType;
- +import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
- +import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
- +import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
- +import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnAttackableKill;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- +
- +import ai.AbstractNpcAI;
- +
- +/**
- + * @author CostyKiller
- + */
- +public class HomunculusKilledMobsCounter extends AbstractNpcAI
- +{
- +
- + @RegisterEvent(EventType.ON_ATTACKABLE_KILL)
- + @RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
- + public void onAttackableKill(OnAttackableKill event)
- + {
- + final Creature creature = event.getTarget();
- + if ((creature != null) && creature.isMonster())
- + {
- + final PlayerInstance player = event.getAttacker().getActingPlayer();
- + if (player != null)
- + {
- + int killedMobs = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
- + if (killedMobs < 500)
- + {
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_KILLED_MOBS, killedMobs + 1);
- + player.sendPacket(new ExHomunculusPointInfo(player));
- + }
- + }
- + }
- + }
- +
- + public static void main(String[] args)
- + {
- + new HomunculusKilledMobsCounter();
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement