|
@@ -16,68 +16,70 @@
|
|
|
* 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.group_template;
|
|
|
+package ai.individual;
|
|
|
|
|
|
import ai.npc.AbstractNpcAI;
|
|
|
|
|
|
+import com.l2jserver.gameserver.datatables.SpawnTable;
|
|
|
+import com.l2jserver.gameserver.model.L2Spawn;
|
|
|
+import com.l2jserver.gameserver.model.actor.L2Attackable;
|
|
|
import com.l2jserver.gameserver.model.actor.L2Npc;
|
|
|
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
|
|
+import com.l2jserver.gameserver.model.holders.ItemHolder;
|
|
|
|
|
|
/**
|
|
|
- * Evas Gift Boxes AI.
|
|
|
- * @author Gigiikun
|
|
|
+ * Eva's Gift Box AI.
|
|
|
+ * @author St3eT
|
|
|
*/
|
|
|
-public class EvasGiftBoxes extends AbstractNpcAI
|
|
|
+public final class EvasGiftBox extends AbstractNpcAI
|
|
|
{
|
|
|
- // Monster
|
|
|
- private static final int GIFTBOX = 32342;
|
|
|
+ // NPC
|
|
|
+ private static final int BOX = 32342; // Eva's Gift Box
|
|
|
// Skill
|
|
|
- private static final int KISSOFEVA = 1073;
|
|
|
- // @formatter:off
|
|
|
- private static final int[][] CHANCES =
|
|
|
- {
|
|
|
- // chance,itemId,...
|
|
|
- { 2, 9692, 1, 9693 }, // without kiss of eva
|
|
|
- { 100, 9692, 50, 9693 } // with kiss of eva
|
|
|
- };
|
|
|
- // @formatter:on
|
|
|
- private EvasGiftBoxes()
|
|
|
- {
|
|
|
- super(EvasGiftBoxes.class.getSimpleName(), "ai/group_template");
|
|
|
- addKillId(GIFTBOX);
|
|
|
- addSpawnId(GIFTBOX);
|
|
|
- }
|
|
|
+ private static final int BUFF = 1073; // Kiss of Eva
|
|
|
+ // Items
|
|
|
+ private static final ItemHolder CORAL = new ItemHolder(9692, 1); // Red Coral
|
|
|
+ private static final ItemHolder CRYSTAL = new ItemHolder(9693, 1); // Crystal Fragment
|
|
|
|
|
|
- @Override
|
|
|
- public String onSpawn(L2Npc npc)
|
|
|
+ private EvasGiftBox()
|
|
|
{
|
|
|
- npc.setIsNoRndWalk(true);
|
|
|
- return super.onSpawn(npc);
|
|
|
+ super(EvasGiftBox.class.getSimpleName(), "ai/individual");
|
|
|
+ addKillId(BOX);
|
|
|
+ addSpawnId(BOX);
|
|
|
+
|
|
|
+ for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(BOX))
|
|
|
+ {
|
|
|
+ onSpawn(spawn.getLastSpawn());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
|
|
{
|
|
|
- if (npc.getId() == GIFTBOX)
|
|
|
+ if (killer.isAffectedBySkill(BUFF))
|
|
|
{
|
|
|
- int isKissOfEvaBuffed = 0;
|
|
|
- if (killer.isAffectedBySkill(KISSOFEVA))
|
|
|
+ if (getRandomBoolean())
|
|
|
{
|
|
|
- isKissOfEvaBuffed = 1;
|
|
|
+ npc.dropItem(killer, CRYSTAL);
|
|
|
}
|
|
|
- for (int i = 0; i < CHANCES[isKissOfEvaBuffed].length; i += 2)
|
|
|
+ else if (getRandom(100) < 33)
|
|
|
{
|
|
|
- if (getRandom(100) < CHANCES[isKissOfEvaBuffed][i])
|
|
|
- {
|
|
|
- giveItems(killer, CHANCES[isKissOfEvaBuffed][i + 1], 1);
|
|
|
- }
|
|
|
+ npc.dropItem(killer, CORAL);
|
|
|
}
|
|
|
}
|
|
|
return super.onKill(npc, killer, isSummon);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String onSpawn(L2Npc npc)
|
|
|
+ {
|
|
|
+ npc.setIsNoRndWalk(true);
|
|
|
+ ((L2Attackable) npc).setOnKillDelay(0);
|
|
|
+ return super.onSpawn(npc);
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args)
|
|
|
{
|
|
|
- new EvasGiftBoxes();
|
|
|
+ new EvasGiftBox();
|
|
|
}
|
|
|
}
|