и все таки.....как сделать тыквы? там лежит файл SquishYourSquash.java, вот он
Код:
/*
* 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 events.SquishYourSquash;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
import net.sf.l2j.gameserver.templates.item.L2Weapon;
import net.sf.l2j.util.Rnd;
public class SquishYourSquash extends Quest
{
private static final int[] SKILL_NECTAR =
{
2005,1011,1013,1015
};
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 mi 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);
}
}
public String onSpawn(L2Npc npc)
{
_numAtk = 0;
_nectar = 0;
return super.onSpawn(npc);
}
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
_numAtk = 0;
_nectar = 0;
return super.onAdvEvent(event, npc, player);
}
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);
}
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);
}
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");
}
}
Нектар себе сунул в инвентарь, нажимаю ничего не происходит, тыквы спавнятся по id... И какой ид кота, который семена и пуху дает?...
Вот содержимое scripts.cfg (отрывок)
Код:
# Events
events/SquishYourSquash/SquishYourSquash.java
events/MasterOfEnchanting/MasterOfEnchanting.java
events/l2day/__init__.py
events/CharacterBirthday/CharacterBirthday.java