Собственно говоря по названию темы понятно о чем пойдет речь. В принципе почти у всех хоть сколько-то пряморуких думаю данный инстанс реализован давным давно, так или иначе.
Так что просто хочу расшарить свою реализацию - может все же кому и пригодится.
Писалось очень давно, сейчас бы может и написал по другому, но - "работает - не трогай".
Класс инстанса:
[SRC="java"]package instances;
import l2p.commons.threading.RunnableImpl;
import l2p.gameserver.ThreadPoolManager;
import l2p.gameserver.data.holder.SkillHolder;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.network.serverpackets.ExSendUIEvent;
import l2p.gameserver.network.serverpackets.components.NpcString;
/**
* @author Gaikotsu
*/
public class Nursery extends Reflection
{
public static final Skill[] EnergyRegeneration = new Skill[] {
SkillHolder.getInstance().getInfo(14228, 1),
SkillHolder.getInstance().getInfo(14229, 1),
SkillHolder.getInstance().getInfo(14230, 1) };
private static final int BattleLength = 25 * 60;
private int _stage;
private int _score;
private int _endingTime;
public Nursery()
{
super();
_stage = 0;
_score = 0;
}
public void startBattle()
{
if (_stage != 0)
return;
_stage = 1;
_score = 0;
_endingTime = (int) (System.currentTimeMillis() / 1000) + BattleLength;
spawnByGroup("nursery");
ThreadPoolManager.getInstance().schedule(new CheckBattleTask(), 1000L);
}
public void incScore(int count)
{
_score += count;
}
public void decScore(int count)
{
_score -= count;
}
public int getScore()
{
return _score;
}
public void setStage(int stage)
{
_stage = stage;
}
public int getStage()
{
return _stage;
}
private class CheckBattleTask extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
int remainingTime = _endingTime - (int) (System.currentTimeMillis() / 1000);
if (remainingTime <= 0)
{
despawnByGroup("nursery");
_stage = 2;
return;
}
broadcastPacket(new ExSendUIEvent(null, ExSendUIEvent.STYLE_COUNTER, remainingTime, _score * 60, 1000, NpcString.NONE));
ThreadPoolManager.getInstance().schedule(new CheckBattleTask(), 1000L);
}
}
}[/SRC]
Листенер для зон, перемещающих в инстанс:
[SRC="java"]package listeners.zones;
import instances.Nursery;
import l2p.gameserver.listener.zone.OnZoneEnterLeaveListener;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Zone;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.scripts.ScriptFile;
import l2p.gameserver.utils.ReflectionUtils;
/*
* Зона, автоматически переносящая в инстанс Nursery (171)
*
* @author Gaikotsu
*/
public class NurseryEnter implements ScriptFile
{
private static final int _instanceId = 171;
private static String[] zones = { "[nursery_enter_1]", "[nursery_enter_2]" };
private static ZoneListener _zoneListener;
@Override
public void onLoad()
{
_zoneListener = new ZoneListener();
for (String name : zones)
{
Zone zone = ReflectionUtils.getZone(name);
if (zone != null)
zone.addListener(_zoneListener);
}
}
@Override
public void onReload()
{}
@Override
public void onShutdown()
{}
public class ZoneListener implements OnZoneEnterLeaveListener
{
@Override
public void onZoneEnter(Zone zone, Creature cha)
{
if (cha == null || !cha.isPlayer())
return;
Player player = cha.getPlayer();
if (player.isEntering())
return;
Reflection r = player.getActiveReflection();
if (r != null && r instanceof Nursery)
{
if (player.canReenterInstance(_instanceId))
player.teleToLocation(r.getTeleportLoc(), r);
}
else if (player.canEnterInstance(_instanceId))
ReflectionUtils.enterReflection(player, new Nursery(), _instanceId);
}
@Override
public void onZoneLeave(Zone zone, Creature cha)
{}
}
}[/SRC]
Инстанс неписи внутри рефлекшна:
[SRC="java"]package npc.model;
import instances.Nursery;
import l2p.gameserver.model.Effect;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.templates.npc.NpcTemplate;
import l2p.gameserver.utils.ItemUtils;
public class TieInstance extends NpcInstance
{
public TieInstance(int objectId, NpcTemplate template)
{
super(objectId, template);
}
private Nursery getNursery()
{
if (getReflection() != null && getReflection() instanceof Nursery)
return (Nursery) getReflection();
return null;
}
@Override
public void showChatWindow(Player player, int val, Object... arg)
{
Nursery nursery = getNursery();
if (nursery == null)
return;
super.showChatWindow(player, nursery.getStage(), arg);
}
@Override
public void onBypassFeedback(Player player, String command)
{
if (!canBypassCheck(player, this))
return;
Nursery nursery = getNursery();
if (nursery == null)
return;
if (command.equals("start_battle") && nursery.getStage() == 0)
{
nursery.startBattle();
}
else if (command.equals("check_buff") && nursery.getStage() == 1)
{
Effect ef = player.getEffectList().getEffectByStackType("life_force_orc");
if (ef == null)
{
super.showChatWindow(player, 3);
return;
}
if (ef.getSkill().getId() == Nursery.EnergyRegeneration[0].getId())
nursery.incScore(40);
else if (ef.getSkill().getId() == Nursery.EnergyRegeneration[1].getId())
nursery.incScore(60);
else if (ef.getSkill().getId() == Nursery.EnergyRegeneration[2].getId())
nursery.incScore(80);
ef.exit();
}
else if (command.equals("exchange") && nursery.getStage() == 2)
{
int score = nursery.getScore();
int count = 0;
if (score >= 1 && score <= 800)
count = 10;
else if (score >= 801 && score <= 1600)
count = 60;
else if (score >= 1601 && score <= 2000)
count = 160;
else if (score >= 2001 && score <= 2400)
count = 200;
else if (score >= 2401 && score <= 2800)
count = 240;
else if (score >= 2801 && score <= 3200)
count = 280;
else if (score >= 3201 && score <= 3600)
count = 320;
else if (score >= 3601 && score <= 4000)
count = 360;
else if (score >= 4001)
count = 400;
if (count > 0)
ItemUtils.addItem(player, 17602, count, true);
nursery.clearReflection(1, true);
player.teleToLocation(nursery.getReturnLoc(), 0);
}
else
super.onBypassFeedback(player, command);
}
}[/SRC]
AI мобов для рефлекшна и AI магвена, появляющегося там же:
[SRC="java"]package ai.Nursery;
import instances.Nursery;
import l2p.commons.util.Rnd;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage.ScreenMessageAlign;
public class Monster extends Fighter
{
private static final int BuffChance = 5;
private static final int MaguenChance = 5;
public Monster(NpcInstance actor)
{
super(actor);
}
@Override
protected void onEvtDead(Creature killer)
{
NpcInstance actor = getActor();
if (killer != null && actor != null && actor.getReflection() != null && actor.getReflection() instanceof Nursery)
{
Nursery nursery = (Nursery) actor.getReflection();
nursery.incScore(Rnd.get(3, 8));
if (Rnd.chance(BuffChance))
{
nursery.broadcastPacket(new ExShowScreenMessage(1811179, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true)); // Пополнение живительных сил!
Nursery.EnergyRegeneration[Rnd.get(3)].getEffects(killer, killer);
}
if (Rnd.chance(MaguenChance))
{
nursery.broadcastPacket(new ExShowScreenMessage(1801149, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true)); // Магвен!
nursery.addSpawnWithoutRespawn(19037, actor.getLoc(), 0);
}
}
super.onEvtDead(killer);
}
}
package ai.Nursery;
import instances.Nursery;
import l2p.commons.util.Rnd;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.data.holder.SkillHolder;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage.ScreenMessageAlign;
import l2p.gameserver.utils.ChatUtils;
public class Maguen extends Fighter
{
private static final Skill MaguenSteal = SkillHolder.getInstance().getInfo(14235, 1);
private int _stealedCount;
public Maguen(NpcInstance actor)
{
super(actor);
}
private Nursery getNursery()
{
NpcInstance actor = getActor();
if (actor != null && actor.getReflection() != null && actor.getReflection() instanceof Nursery)
return (Nursery) actor.getReflection();
return null;
}
@Override
protected void onEvtSpawn()
{
super.onEvtSpawn();
Nursery nursery = getNursery();
if (nursery != null)
{
_stealedCount = 0;
getActor().setTargetable(false);
addTimer(1, 2000);
}
}
@Override
protected void onEvtTimer(int timerId, Object arg1, Object arg2)
{
super.onEvtTimer(timerId, arg1, arg2);
Nursery nursery = getNursery();
if (nursery != null)
{
switch (timerId)
{
case 1:
addTaskBuff(getActor(), MaguenSteal);
doTask();
addTimer(2, 1000);
break;
case 2:
_stealedCount = Math.min(Rnd.get(50, 100), nursery.getScore());
nursery.decScore(_stealedCount);
nursery.broadcastPacket(new ExShowScreenMessage(1811145, 2000, ScreenMessageAlign.MIDDLE_CENTER, true, true, new String[] { Integer.toString(_stealedCount) })); // Магвен похитил остатки живой энергии ($s1 шт.).
getActor().setTargetable(true);
addTimer(3, 4000);
break;
case 3:
getActor().deleteMe();
break;
}
}
}
@Override
protected void onEvtAttacked(Creature attacker, int damage)
{
super.onEvtAttacked(attacker, damage);
Nursery nursery = getNursery();
if (_stealedCount > 0 && attacker != null && nursery != null)
{
if (getActor().isCastingNow())
getActor().abortCast(true, false);
int count = _stealedCount + Rnd.get(_stealedCount / 6, _stealedCount / 3);
_stealedCount = 0;
nursery.broadcastPacket(new ExShowScreenMessage(1811147, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true, new String[] { Integer.toString(count) })); // Ошеломленный Магвен отдал остатки живой энергии ($s1 шт.).
nursery.incScore(count);
ChatUtils.npcSay(getActor(), 1811295); // Ну все! Посмотрели - и хватит...
}
}
}[/SRC]
XML описывающая инстанс:
[SRC="xml"]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE list SYSTEM "instances.dtd">
<list>
<instance id="171" name="Nursery">
<params>
<param name="levels" value="85;89" />
<param name="players" value="1;1" />
<param name="timeLimit" value="30" />
<param name="maxChannels" value="50" />
<param name="collapseIfEmpty" value="10" />
<param name="resetReuse" value="* */12 * * *" />
<param name="setReuseUponEntry" value="true" />
<param name="sharedReuseGroup" value="0" />
</params>
<return loc="-178465 153685 2488" />
<teleport loc="-185853 147878 -15313" />
<spawns>
<spawn id="33152" type="point" respawn="0">
<coords loc="-185857 147420 -15296 11632" />
</spawn>
<group name="nursery" spawned="false" />
</spawns>
</instance>
</list>[/SRC]
Спавн мобов внутри инстанса:
[SRC="xml"]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE list SYSTEM "../spawn.dtd">
<list>
<territory name="nursery_territory">
<add x="-185848" y="145944" zmin="-15454" zmax="-15154" />
<add x="-186584" y="146088" zmin="-15454" zmax="-15154" />
<add x="-187224" y="146504" zmin="-15454" zmax="-15154" />
<add x="-187640" y="147128" zmin="-15454" zmax="-15154" />
<add x="-187800" y="147880" zmin="-15454" zmax="-15154" />
<add x="-187640" y="148632" zmin="-15454" zmax="-15154" />
<add x="-187240" y="149240" zmin="-15454" zmax="-15154" />
<add x="-186600" y="149672" zmin="-15454" zmax="-15154" />
<add x="-185848" y="149832" zmin="-15454" zmax="-15154" />
<add x="-185112" y="149688" zmin="-15454" zmax="-15154" />
<add x="-184488" y="149256" zmin="-15454" zmax="-15154" />
<add x="-184072" y="148632" zmin="-15454" zmax="-15154" />
<add x="-183912" y="147880" zmin="-15454" zmax="-15154" />
<add x="-184056" y="147144" zmin="-15454" zmax="-15154" />
<add x="-184472" y="146520" zmin="-15454" zmax="-15154" />
<add x="-185112" y="146104" zmin="-15454" zmax="-15154" />
<banned_territory>
<add x="-185032" y="147048" zmin="-15454" zmax="-15154" />
<add x="-184776" y="147448" zmin="-15454" zmax="-15154" />
<add x="-184680" y="147896" zmin="-15454" zmax="-15154" />
<add x="-184776" y="148328" zmin="-15454" zmax="-15154" />
<add x="-185032" y="148712" zmin="-15454" zmax="-15154" />
<add x="-185400" y="148952" zmin="-15454" zmax="-15154" />
<add x="-185864" y="149048" zmin="-15454" zmax="-15154" />
<add x="-186312" y="148952" zmin="-15454" zmax="-15154" />
<add x="-186664" y="148712" zmin="-15454" zmax="-15154" />
<add x="-186936" y="148328" zmin="-15454" zmax="-15154" />
<add x="-187016" y="147880" zmin="-15454" zmax="-15154" />
<add x="-186936" y="147448" zmin="-15454" zmax="-15154" />
<add x="-186680" y="147080" zmin="-15454" zmax="-15154" />
<add x="-186376" y="146936" zmin="-15454" zmax="-15154" />
<add x="-185320" y="146936" zmin="-15454" zmax="-15154" />
</banned_territory>
</territory>
<spawn count="10" respawn="30" respawn_random="15" group="nursery">
<npc id="23033" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23034" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23035" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23036" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23037" /> <!-- Failed Creation / Неудачное Создание -->
<territory name="nursery_territory" />
</spawn>
</list>[/SRC]
Добавлено через 5 минут
Странно, куда-то исчезла возможность прикреплять файлы к сообщению...
Ну вобещм тогда вот если диалоги для Tie - http://rgho.st/6QB2VrVDs
Так что просто хочу расшарить свою реализацию - может все же кому и пригодится.
Писалось очень давно, сейчас бы может и написал по другому, но - "работает - не трогай".
Класс инстанса:
[SRC="java"]package instances;
import l2p.commons.threading.RunnableImpl;
import l2p.gameserver.ThreadPoolManager;
import l2p.gameserver.data.holder.SkillHolder;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.network.serverpackets.ExSendUIEvent;
import l2p.gameserver.network.serverpackets.components.NpcString;
/**
* @author Gaikotsu
*/
public class Nursery extends Reflection
{
public static final Skill[] EnergyRegeneration = new Skill[] {
SkillHolder.getInstance().getInfo(14228, 1),
SkillHolder.getInstance().getInfo(14229, 1),
SkillHolder.getInstance().getInfo(14230, 1) };
private static final int BattleLength = 25 * 60;
private int _stage;
private int _score;
private int _endingTime;
public Nursery()
{
super();
_stage = 0;
_score = 0;
}
public void startBattle()
{
if (_stage != 0)
return;
_stage = 1;
_score = 0;
_endingTime = (int) (System.currentTimeMillis() / 1000) + BattleLength;
spawnByGroup("nursery");
ThreadPoolManager.getInstance().schedule(new CheckBattleTask(), 1000L);
}
public void incScore(int count)
{
_score += count;
}
public void decScore(int count)
{
_score -= count;
}
public int getScore()
{
return _score;
}
public void setStage(int stage)
{
_stage = stage;
}
public int getStage()
{
return _stage;
}
private class CheckBattleTask extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
int remainingTime = _endingTime - (int) (System.currentTimeMillis() / 1000);
if (remainingTime <= 0)
{
despawnByGroup("nursery");
_stage = 2;
return;
}
broadcastPacket(new ExSendUIEvent(null, ExSendUIEvent.STYLE_COUNTER, remainingTime, _score * 60, 1000, NpcString.NONE));
ThreadPoolManager.getInstance().schedule(new CheckBattleTask(), 1000L);
}
}
}[/SRC]
Листенер для зон, перемещающих в инстанс:
[SRC="java"]package listeners.zones;
import instances.Nursery;
import l2p.gameserver.listener.zone.OnZoneEnterLeaveListener;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Zone;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.scripts.ScriptFile;
import l2p.gameserver.utils.ReflectionUtils;
/*
* Зона, автоматически переносящая в инстанс Nursery (171)
*
* @author Gaikotsu
*/
public class NurseryEnter implements ScriptFile
{
private static final int _instanceId = 171;
private static String[] zones = { "[nursery_enter_1]", "[nursery_enter_2]" };
private static ZoneListener _zoneListener;
@Override
public void onLoad()
{
_zoneListener = new ZoneListener();
for (String name : zones)
{
Zone zone = ReflectionUtils.getZone(name);
if (zone != null)
zone.addListener(_zoneListener);
}
}
@Override
public void onReload()
{}
@Override
public void onShutdown()
{}
public class ZoneListener implements OnZoneEnterLeaveListener
{
@Override
public void onZoneEnter(Zone zone, Creature cha)
{
if (cha == null || !cha.isPlayer())
return;
Player player = cha.getPlayer();
if (player.isEntering())
return;
Reflection r = player.getActiveReflection();
if (r != null && r instanceof Nursery)
{
if (player.canReenterInstance(_instanceId))
player.teleToLocation(r.getTeleportLoc(), r);
}
else if (player.canEnterInstance(_instanceId))
ReflectionUtils.enterReflection(player, new Nursery(), _instanceId);
}
@Override
public void onZoneLeave(Zone zone, Creature cha)
{}
}
}[/SRC]
Инстанс неписи внутри рефлекшна:
[SRC="java"]package npc.model;
import instances.Nursery;
import l2p.gameserver.model.Effect;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.templates.npc.NpcTemplate;
import l2p.gameserver.utils.ItemUtils;
public class TieInstance extends NpcInstance
{
public TieInstance(int objectId, NpcTemplate template)
{
super(objectId, template);
}
private Nursery getNursery()
{
if (getReflection() != null && getReflection() instanceof Nursery)
return (Nursery) getReflection();
return null;
}
@Override
public void showChatWindow(Player player, int val, Object... arg)
{
Nursery nursery = getNursery();
if (nursery == null)
return;
super.showChatWindow(player, nursery.getStage(), arg);
}
@Override
public void onBypassFeedback(Player player, String command)
{
if (!canBypassCheck(player, this))
return;
Nursery nursery = getNursery();
if (nursery == null)
return;
if (command.equals("start_battle") && nursery.getStage() == 0)
{
nursery.startBattle();
}
else if (command.equals("check_buff") && nursery.getStage() == 1)
{
Effect ef = player.getEffectList().getEffectByStackType("life_force_orc");
if (ef == null)
{
super.showChatWindow(player, 3);
return;
}
if (ef.getSkill().getId() == Nursery.EnergyRegeneration[0].getId())
nursery.incScore(40);
else if (ef.getSkill().getId() == Nursery.EnergyRegeneration[1].getId())
nursery.incScore(60);
else if (ef.getSkill().getId() == Nursery.EnergyRegeneration[2].getId())
nursery.incScore(80);
ef.exit();
}
else if (command.equals("exchange") && nursery.getStage() == 2)
{
int score = nursery.getScore();
int count = 0;
if (score >= 1 && score <= 800)
count = 10;
else if (score >= 801 && score <= 1600)
count = 60;
else if (score >= 1601 && score <= 2000)
count = 160;
else if (score >= 2001 && score <= 2400)
count = 200;
else if (score >= 2401 && score <= 2800)
count = 240;
else if (score >= 2801 && score <= 3200)
count = 280;
else if (score >= 3201 && score <= 3600)
count = 320;
else if (score >= 3601 && score <= 4000)
count = 360;
else if (score >= 4001)
count = 400;
if (count > 0)
ItemUtils.addItem(player, 17602, count, true);
nursery.clearReflection(1, true);
player.teleToLocation(nursery.getReturnLoc(), 0);
}
else
super.onBypassFeedback(player, command);
}
}[/SRC]
AI мобов для рефлекшна и AI магвена, появляющегося там же:
[SRC="java"]package ai.Nursery;
import instances.Nursery;
import l2p.commons.util.Rnd;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage.ScreenMessageAlign;
public class Monster extends Fighter
{
private static final int BuffChance = 5;
private static final int MaguenChance = 5;
public Monster(NpcInstance actor)
{
super(actor);
}
@Override
protected void onEvtDead(Creature killer)
{
NpcInstance actor = getActor();
if (killer != null && actor != null && actor.getReflection() != null && actor.getReflection() instanceof Nursery)
{
Nursery nursery = (Nursery) actor.getReflection();
nursery.incScore(Rnd.get(3, 8));
if (Rnd.chance(BuffChance))
{
nursery.broadcastPacket(new ExShowScreenMessage(1811179, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true)); // Пополнение живительных сил!
Nursery.EnergyRegeneration[Rnd.get(3)].getEffects(killer, killer);
}
if (Rnd.chance(MaguenChance))
{
nursery.broadcastPacket(new ExShowScreenMessage(1801149, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true)); // Магвен!
nursery.addSpawnWithoutRespawn(19037, actor.getLoc(), 0);
}
}
super.onEvtDead(killer);
}
}
package ai.Nursery;
import instances.Nursery;
import l2p.commons.util.Rnd;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.data.holder.SkillHolder;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage;
import l2p.gameserver.network.serverpackets.ExShowScreenMessage.ScreenMessageAlign;
import l2p.gameserver.utils.ChatUtils;
public class Maguen extends Fighter
{
private static final Skill MaguenSteal = SkillHolder.getInstance().getInfo(14235, 1);
private int _stealedCount;
public Maguen(NpcInstance actor)
{
super(actor);
}
private Nursery getNursery()
{
NpcInstance actor = getActor();
if (actor != null && actor.getReflection() != null && actor.getReflection() instanceof Nursery)
return (Nursery) actor.getReflection();
return null;
}
@Override
protected void onEvtSpawn()
{
super.onEvtSpawn();
Nursery nursery = getNursery();
if (nursery != null)
{
_stealedCount = 0;
getActor().setTargetable(false);
addTimer(1, 2000);
}
}
@Override
protected void onEvtTimer(int timerId, Object arg1, Object arg2)
{
super.onEvtTimer(timerId, arg1, arg2);
Nursery nursery = getNursery();
if (nursery != null)
{
switch (timerId)
{
case 1:
addTaskBuff(getActor(), MaguenSteal);
doTask();
addTimer(2, 1000);
break;
case 2:
_stealedCount = Math.min(Rnd.get(50, 100), nursery.getScore());
nursery.decScore(_stealedCount);
nursery.broadcastPacket(new ExShowScreenMessage(1811145, 2000, ScreenMessageAlign.MIDDLE_CENTER, true, true, new String[] { Integer.toString(_stealedCount) })); // Магвен похитил остатки живой энергии ($s1 шт.).
getActor().setTargetable(true);
addTimer(3, 4000);
break;
case 3:
getActor().deleteMe();
break;
}
}
}
@Override
protected void onEvtAttacked(Creature attacker, int damage)
{
super.onEvtAttacked(attacker, damage);
Nursery nursery = getNursery();
if (_stealedCount > 0 && attacker != null && nursery != null)
{
if (getActor().isCastingNow())
getActor().abortCast(true, false);
int count = _stealedCount + Rnd.get(_stealedCount / 6, _stealedCount / 3);
_stealedCount = 0;
nursery.broadcastPacket(new ExShowScreenMessage(1811147, 3000, ScreenMessageAlign.MIDDLE_CENTER, true, true, new String[] { Integer.toString(count) })); // Ошеломленный Магвен отдал остатки живой энергии ($s1 шт.).
nursery.incScore(count);
ChatUtils.npcSay(getActor(), 1811295); // Ну все! Посмотрели - и хватит...
}
}
}[/SRC]
XML описывающая инстанс:
[SRC="xml"]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE list SYSTEM "instances.dtd">
<list>
<instance id="171" name="Nursery">
<params>
<param name="levels" value="85;89" />
<param name="players" value="1;1" />
<param name="timeLimit" value="30" />
<param name="maxChannels" value="50" />
<param name="collapseIfEmpty" value="10" />
<param name="resetReuse" value="* */12 * * *" />
<param name="setReuseUponEntry" value="true" />
<param name="sharedReuseGroup" value="0" />
</params>
<return loc="-178465 153685 2488" />
<teleport loc="-185853 147878 -15313" />
<spawns>
<spawn id="33152" type="point" respawn="0">
<coords loc="-185857 147420 -15296 11632" />
</spawn>
<group name="nursery" spawned="false" />
</spawns>
</instance>
</list>[/SRC]
Спавн мобов внутри инстанса:
[SRC="xml"]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE list SYSTEM "../spawn.dtd">
<list>
<territory name="nursery_territory">
<add x="-185848" y="145944" zmin="-15454" zmax="-15154" />
<add x="-186584" y="146088" zmin="-15454" zmax="-15154" />
<add x="-187224" y="146504" zmin="-15454" zmax="-15154" />
<add x="-187640" y="147128" zmin="-15454" zmax="-15154" />
<add x="-187800" y="147880" zmin="-15454" zmax="-15154" />
<add x="-187640" y="148632" zmin="-15454" zmax="-15154" />
<add x="-187240" y="149240" zmin="-15454" zmax="-15154" />
<add x="-186600" y="149672" zmin="-15454" zmax="-15154" />
<add x="-185848" y="149832" zmin="-15454" zmax="-15154" />
<add x="-185112" y="149688" zmin="-15454" zmax="-15154" />
<add x="-184488" y="149256" zmin="-15454" zmax="-15154" />
<add x="-184072" y="148632" zmin="-15454" zmax="-15154" />
<add x="-183912" y="147880" zmin="-15454" zmax="-15154" />
<add x="-184056" y="147144" zmin="-15454" zmax="-15154" />
<add x="-184472" y="146520" zmin="-15454" zmax="-15154" />
<add x="-185112" y="146104" zmin="-15454" zmax="-15154" />
<banned_territory>
<add x="-185032" y="147048" zmin="-15454" zmax="-15154" />
<add x="-184776" y="147448" zmin="-15454" zmax="-15154" />
<add x="-184680" y="147896" zmin="-15454" zmax="-15154" />
<add x="-184776" y="148328" zmin="-15454" zmax="-15154" />
<add x="-185032" y="148712" zmin="-15454" zmax="-15154" />
<add x="-185400" y="148952" zmin="-15454" zmax="-15154" />
<add x="-185864" y="149048" zmin="-15454" zmax="-15154" />
<add x="-186312" y="148952" zmin="-15454" zmax="-15154" />
<add x="-186664" y="148712" zmin="-15454" zmax="-15154" />
<add x="-186936" y="148328" zmin="-15454" zmax="-15154" />
<add x="-187016" y="147880" zmin="-15454" zmax="-15154" />
<add x="-186936" y="147448" zmin="-15454" zmax="-15154" />
<add x="-186680" y="147080" zmin="-15454" zmax="-15154" />
<add x="-186376" y="146936" zmin="-15454" zmax="-15154" />
<add x="-185320" y="146936" zmin="-15454" zmax="-15154" />
</banned_territory>
</territory>
<spawn count="10" respawn="30" respawn_random="15" group="nursery">
<npc id="23033" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23034" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23035" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23036" /> <!-- Failed Creation / Неудачное Создание -->
<npc id="23037" /> <!-- Failed Creation / Неудачное Создание -->
<territory name="nursery_territory" />
</spawn>
</list>[/SRC]
Добавлено через 5 минут
Странно, куда-то исчезла возможность прикреплять файлы к сообщению...
Ну вобещм тогда вот если диалоги для Tie - http://rgho.st/6QB2VrVDs