02-08-2011, 09:59 PM
Здравствуйте , скажите есть ли у кого нибудь нормальные скрипты по сборку EMU для этого эвента ? а то я столько уже вожусь и не понимаю в чём дело . Вначале не работали скилы 2003 2004 2005 , тк они были типа NOTDONE потом я решил сделать тыкву суммоном но в итоге она просто появлялась а нектары не давали никакого эффекта. скажите какой способ решения этой проблемы ??
скиллы пока так
а нельзя ли сделать может на питоне вобще ?
Код:
package events.SquishYourSquash;
import com.l2emu.gameserver.model.L2Object;
import com.l2emu.gameserver.model.L2Skill;
import com.l2emu.gameserver.model.actor.L2Npc;
import com.l2emu.gameserver.model.actor.instance.L2PcInstance;
import com.l2emu.gameserver.model.quest.Quest;
import com.l2emu.gameserver.network.serverpackets.NpcSay;
import com.l2emu.gameserver.templates.item.L2Weapon;
import com.l2emu.util.Rnd;
public class SquishYourSquash extends Quest
{
private static final int[] SKILL_NECTAR = {
2005,2004,2003
};
private static final int[] CHRONOWEAPONS = {
4202, 5133, 5817, 7058, 8350
};
private static final int[] SQUASHLIST = {
12774, 12775, 12776, 12777, 12778, 12779
};
private static final int[] CANNOTGROW = {
13016, 13017
};
private static final String[] EAT_TEXT = {
"More... I need more...", "Yummy, what a great nectar.", "I'm growing...", "Give me more!", "I need moooreee."
};
private static final String[] CHRONO_TEXT = {
"Arghhh... You have chrono weapon.", "My end is coming...", "I feel chrono....", "No.. No.. please don't kill me."
};
private static final String[] NOCHRONO_TEXT = {
"Haha, you can't kill me.", "It's impossible to kill me without chrono weapon.", "I can be defeated only with special chrono weapon!", "Hahaha.... Keep trying..."
};
private int _numAtk = 0;
private int _nectar = 0;
public SquishYourSquash(int questId, String name, String descr)
{
super(questId, name, descr);
for (int i : SQUASHLIST)
{
addSkillSeeId(i);
addAttackId(i);
addKillId(i);
addSpawnId(i);
}
}
@Override
public String onSpawn(L2Npc npc)
{
_numAtk = 0;
_nectar = 0;
return super.onSpawn(npc);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
_numAtk = 0;
_nectar = 0;
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
{
int npcId = npc.getNpcId();
if (!contains(targets, npc))
return super.onSkillSee(npc, caster, skill, targets, isPet);
if (!contains(SKILL_NECTAR, skill.getId()))
return super.onSkillSee(npc, caster, skill, targets, isPet);
if (!contains(CANNOTGROW, npc.getNpcId()))
return super.onSkillSee(npc, caster, skill, targets, isPet);
if (_nectar == 0 && _nectar <= 3)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), EAT_TEXT[Rnd.get(EAT_TEXT.length)]));
_nectar++;
}
else if (_nectar == 4)
{
if (npcId == 12774)
{
addSpawn(12776, npc);
npc.deleteMe();
_nectar = 0;
}
else if (npcId == 12777)
{
addSpawn(12779, npc);
npc.deleteMe();
_nectar = 0;
}
else
_nectar++;
}
else if (_nectar == 9)
{
if (npcId == 12776)
{
addSpawn(12775, npc);
npc.deleteMe();
_nectar = 0;
}
else if (npcId == 12779)
{
addSpawn(12778, npc);
npc.deleteMe();
_nectar = 0;
}
else
_nectar++;
}
else if (_nectar == 19)
{
if (npcId == 12775)
{
addSpawn(13016, npc);
npc.deleteMe();
_nectar = 0;
}
else if (npcId == 12778)
{
addSpawn(13017, npc);
npc.deleteMe();
_nectar = 0;
}
else
_nectar++;
}
return super.onSkillSee(npc, caster, skill, targets, isPet);
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
{
L2Weapon weapon = attacker.getActiveWeaponItem();
if (weapon == null)
{
npc.setIsInvul(true);
if (Rnd.get(4) == 1)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), NOCHRONO_TEXT[Rnd.get(NOCHRONO_TEXT.length)]));
}
else if (isPet)
{
npc.setIsInvul(true);
if (Rnd.get(4) == 1)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), NOCHRONO_TEXT[Rnd.get(NOCHRONO_TEXT.length)]));
}
else
{
if (contains(SQUASHLIST, npc.getNpcId()))
{
if (contains(CHRONOWEAPONS, weapon.getItemId()))
{
npc.setIsInvul(false);
if (_numAtk < 1)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), CHRONO_TEXT[Rnd.get(CHRONO_TEXT.length)]));
_numAtk++;
}
else
{
npc.setIsInvul(true);
if (Rnd.get(4) == 1)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), NOCHRONO_TEXT[Rnd.get(NOCHRONO_TEXT.length)]));
}
}
else
npc.setIsInvul(false);
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "Rewards !!"));
_numAtk = 0;
_nectar = 0;
return super.onKill(npc, killer, isPet);
}
private static boolean contains(int[] array, int obj)
{
for (int i = 0; i < array.length; i++)
{
if (array[i] == obj)
return true;
}
return false;
}
public static <T> boolean contains(T[] array, T obj)
{
for (int i = 0; i < array.length; i++)
{
if (array[i] == obj)
return true;
}
return false;
}
public static void main(String[] args)
{
new SquishYourSquash(-1, "SquishYourSquash", "events");
}
}
скиллы пока так
Код:
<skill id="2003" levels="1" name="Squash Seed">
<!-- Summer Squash Event Skill (http://www.lineage2.com/archive/2006/11/fall_harvest.html) -->
<set name="target" val="TARGET_SELF"/>
<set name="skillType" val="SUMMON"/>
<set name="operateType" val="OP_PASSIVE"/>
<set name="hitTime" val="1500"/>
<set name="interruptTime" val="1500"/>
<set name="staticHitTime" val="true"/>
</skill>
<skill id="2004" levels="1" name="Large Squash Seed">
<!-- Summer Squash Event Skill (http://www.lineage2.com/archive/2006/11/fall_harvest.html) -->
<set name="target" val="TARGET_SELF"/>
<set name="skillType" val="SUMMON"/>
<set name="operateType" val="OP_PASSIVE"/>
<set name="hitTime" val="1500"/>
<set name="interruptTime" val="1500"/>
<set name="staticHitTime" val="true"/>
</skill>
<skill id="2005" levels="1" name="Nectar">
<!-- Summer Squash Event Skill (http://www.lineage2.com/archive/2006/11/fall_harvest.html) -->
<set name="itemConsumeId" val="6391"/>
<set name="itemConsumeCount" val="1"/>
<set name="target" val="TARGET_ONE"/>
<set name="hitTime" val="1000"/>
<set name="skillType" val="BEAST_FEED"/>
<set name="operateType" val="OP_ACTIVE"/>
<set name="castRange" val="40"/>
<set name="effectRange" val="400"/>
<cond msgId="109">
<target npcId="12774 12777"/>
</cond>
</skill>