01-28-2014, 12:23 PM
Подскажите почему не спавнятся ёлки? сборка Rebellion High Five
Сами нпс заспавнить можно, а вот от итема не спавнятся
Сами нпс заспавнить можно, а вот от итема не спавнятся
\data\scripts\events\Christmas\Seed.java
Код:
package events.Christmas;
import handler.items.ScriptItemHandler;
import l2r.commons.threading.RunnableImpl;
import l2r.gameserver.ThreadPoolManager;
import l2r.gameserver.cache.Msg;
import l2r.gameserver.data.xml.holder.NpcHolder;
import l2r.gameserver.model.Playable;
import l2r.gameserver.model.Player;
import l2r.gameserver.model.SimpleSpawner;
import l2r.gameserver.model.World;
import l2r.gameserver.model.instances.NpcInstance;
import l2r.gameserver.model.items.ItemInstance;
import l2r.gameserver.network.serverpackets.SystemMessage2;
import l2r.gameserver.network.serverpackets.components.SystemMsg;
import l2r.gameserver.templates.npc.NpcTemplate;
public class Seed extends ScriptItemHandler
{
public class DeSpawnScheduleTimerTask extends RunnableImpl
{
SimpleSpawner spawnedTree = null;
public DeSpawnScheduleTimerTask(SimpleSpawner spawn)
{
spawnedTree = spawn;
}
@Override
public void runImpl() throws Exception
{
spawnedTree.deleteAll();
}
}
private static int[] _itemIds = { 5560, // Christmas Tree
5561 // Special Christmas Tree
};
private static int[] _npcIds = { 13006, // Christmas Tree
13007 // Special Christmas Tree
};
private static final int DESPAWN_TIME = 600000; //10 min
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean ctrl)
{
Player activeChar = (Player) playable;
NpcTemplate template = null;
int itemId = item.getItemId();
for(int i = 0; i < _itemIds.length; i++)
if(_itemIds[i] == itemId)
{
template = NpcHolder.getInstance().getTemplate(_npcIds[i]);
break;
}
for(NpcInstance npc : World.getAroundNpc(activeChar, 300, 200))
if(npc.getNpcId() == _npcIds[0] || npc.getNpcId() == _npcIds[1])
{
activeChar.sendPacket(new SystemMessage2(SystemMsg.SINCE_S1_ALREADY_EXISTS_NEARBY_YOU_CANNOT_SUMMON_IT_AGAIN).addName(npc));
return false;
}
// Запрет на саммон елок слищком близко к другим НПЦ
if(World.getAroundNpc(activeChar, 100, 200).size() > 0)
{
activeChar.sendPacket(Msg.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
return false;
}
if(template == null)
return false;
if (!activeChar.getInventory().destroyItem(item, 1L))
return false;
SimpleSpawner spawn = new SimpleSpawner(template);
spawn.setLoc(activeChar.getLoc());
NpcInstance npc = spawn.doSpawn(false);
npc.setTitle(activeChar.getName()); //FIXME Почему-то не устанавливается
spawn.respawnNpc(npc);
// АИ вещающее бафф регена устанавливается только для большой елки
if(itemId == 5561)
npc.setAI(new ctreeAI(npc));
ThreadPoolManager.getInstance().schedule(new DeSpawnScheduleTimerTask(spawn), (activeChar.isInPeaceZone() ? DESPAWN_TIME / 3 : DESPAWN_TIME));
return true;
}
@Override
public int[] getItemIds()
{
return _itemIds;
}
}
\data\items\5500-5599.xml
Код:
<etcitem id="5560" name="Christmas Tree">
<set name="class" value="CONSUMABLE"/>
<set name="crystal_type" value="NONE"/>
<set name="icon" value="icon.etc_x_mas_tree_i00"/>
<set name="price" value="1"/>
<set name="stackable" value="true"/>
<set name="type" value="POTION"/>
<cond msgId="1508">
<not>
<player olympiad="true"/>
</not>
</cond>
</etcitem>
<etcitem id="5561" name="Special Christmas Tree">
<set name="class" value="CONSUMABLE"/>
<set name="crystal_type" value="NONE"/>
<set name="icon" value="icon.etc_x_mas_tree_i00"/>
<set name="price" value="1"/>
<set name="stackable" value="true"/>
<set name="type" value="POTION"/>
<cond msgId="1508">
<not>
<player olympiad="true"/>
</not>
</cond>
</etcitem>
\data\stats\skills\2100-2199.xml
Код:
<skill id="2137" levels="1" name="Summon Regular Tree">
<!--
Descriptions:
1: During the Christmas event, summons a regular Christmas tree.
-->
<set name="magicType" val="SPECIAL" />
<set name="icon" val="icon.skill0000" />
<set name="magicLevel" val="1" />
<set name="target" val="TARGET_NONE" />
<set name="skillType" val="NOTDONE" />
<set name="operateType" val="OP_ACTIVE" />
<set name="isHandler" val="true" />
</skill>
<skill id="2138" levels="1" name="Summon Special Tree">
<!--
Descriptions:
1: During the Christmas event, summons a special Christmas tree.
-->
<set name="magicType" val="SPECIAL" />
<set name="icon" val="icon.skill0000" />
<set name="magicLevel" val="1" />
<set name="target" val="TARGET_NONE" />
<set name="skillType" val="NOTDONE" />
<set name="operateType" val="OP_ACTIVE" />
<set name="isHandler" val="true" />
</skill>
<skill id="2139" levels="1" name="Special Tree Recovery Bonus">
<!--
Last modify: 27.12.2007
Descriptions: Produces a special Christmas tree during the Christmas event. Increases HP and MP regeneration.
-->
<set name="magicType" val="SPECIAL" />
<set name="icon" val="icon.skill1044" />
<set name="target" val="TARGET_ONE" />
<set name="skillType" val="BUFF" />
<set name="operateType" val="OP_ACTIVE" />
<set name="isHandler" val="false" />
<for>
<effect count="1" name="Buff" stackType="CTreeRegen" time="10" val="0">
<mul order="0x30" stat="regHp" val="2" />
<mul order="0x30" stat="regMp" val="1.2" />
</effect>
</for>
</skill>
\data\npc\13000-13099.xml
Код:
<npc id="13006" name="Christmas Tree" title="">
<set name="aggroRange" value="0" />
<set name="ai_type" value="CharacterAI" />
<set name="baseAtkRange" value="40" />
<set name="baseCON" value="43" />
<set name="baseCritRate" value="40" />
<set name="baseDEX" value="30" />
<set name="baseHpMax" value="2444.468" />
<set name="baseHpRate" value="1" />
<set name="baseHpReg" value="7.5" />
<set name="baseINT" value="21" />
<set name="baseMAtk" value="780" />
<set name="baseMAtkSpd" value="500" />
<set name="baseMDef" value="382" />
<set name="baseMEN" value="10" />
<set name="baseMpMax" value="1345.8" />
<set name="baseMpReg" value="2.7" />
<set name="basePAtk" value="1303" />
<set name="basePAtkSpd" value="253" />
<set name="basePDef" value="471" />
<set name="baseRunSpd" value="120" />
<set name="baseSTR" value="40" />
<set name="baseShldDef" value="0" />
<set name="baseShldRate" value="0" />
<set name="baseWIT" value="20" />
<set name="baseWalkSpd" value="30" />
<set name="collision_height" value="0.01" />
<set name="collision_radius" value="0.01" />
<set name="level" value="70" />
<set name="rewardExp" value="490" />
<set name="rewardRp" value="0" />
<set name="rewardSp" value="10" />
<set name="shots" value="NONE" />
<set name="texture" value="" />
<set name="type" value="XmassTree" />
<attributes>
<defence attribute="fire" value="20" />
<defence attribute="water" value="20" />
<defence attribute="wind" value="20" />
<defence attribute="earth" value="20" />
<defence attribute="holy" value="20" />
<defence attribute="unholy" value="20" />
</attributes>
</npc>
<npc id="13007" name="Special Christmas Tree" title="">
<set name="aggroRange" value="0" />
<set name="ai_type" value="CharacterAI" />
<set name="baseAtkRange" value="40" />
<set name="baseCON" value="43" />
<set name="baseCritRate" value="40" />
<set name="baseDEX" value="30" />
<set name="baseHpMax" value="2444.468" />
<set name="baseHpRate" value="1" />
<set name="baseHpReg" value="7.5" />
<set name="baseINT" value="21" />
<set name="baseMAtk" value="780" />
<set name="baseMAtkSpd" value="500" />
<set name="baseMDef" value="382" />
<set name="baseMEN" value="10" />
<set name="baseMpMax" value="1345.8" />
<set name="baseMpReg" value="2.7" />
<set name="basePAtk" value="1303" />
<set name="basePAtkSpd" value="253" />
<set name="basePDef" value="471" />
<set name="baseRunSpd" value="120" />
<set name="baseSTR" value="40" />
<set name="baseShldDef" value="0" />
<set name="baseShldRate" value="0" />
<set name="baseWIT" value="20" />
<set name="baseWalkSpd" value="30" />
<set name="collision_height" value="0.0" />
<set name="collision_radius" value="0.0" />
<set name="level" value="70" />
<set name="rewardExp" value="490" />
<set name="rewardRp" value="0" />
<set name="rewardSp" value="10" />
<set name="shots" value="NONE" />
<set name="texture" value="" />
<set name="type" value="XmassTree" />
<attributes>
<defence attribute="fire" value="20" />
<defence attribute="water" value="20" />
<defence attribute="wind" value="20" />
<defence attribute="earth" value="20" />
<defence attribute="holy" value="20" />
<defence attribute="unholy" value="20" />
</attributes>
</npc>