Addition of HomunculusKillCount script.
Thanks to CostyKiller.
This commit is contained in:
parent
5eb5b313ab
commit
4b6882cd01
60
L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/HomunculusKillCount.java
vendored
Normal file
60
L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/ai/others/HomunculusKillCount.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 HomunculusKillCount 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)
|
||||
{
|
||||
final 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 HomunculusKillCount();
|
||||
}
|
||||
}
|
60
L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/others/HomunculusKillCount.java
vendored
Normal file
60
L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/others/HomunculusKillCount.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 HomunculusKillCount 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)
|
||||
{
|
||||
final 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 HomunculusKillCount();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user