07-17-2012, 06:38 AM
У меня грация финал. Блин не могу понять в чем дело, квест берется в инсту пускает РБ убиваю появляется финальный нпс который дает награду и портует, но диалога у него нет!!!!
скрипт квеста:
скрипт инсты:
Сервер от команды l2wt.
скрипт квеста:
import sys
from com.l2emu.gameserver.datatables import SkillTable
from com.l2emu.gameserver.model.quest import State
from com.l2emu.gameserver.model.quest import QuestState
from com.l2emu.gameserver.model.quest.jython import QuestJython as JQuest
qn = "694_BreakThroughtheHallofSuffering"
#NPCs
Keucereus = 32548
Tepios = 32530
Tepiosinst = 32603
Mouthofekimus=32537
Klodekus = 25665
Klanikus = 25666
#items
Mark = 13691
class Quest (JQuest) :
def __init__(self,id,name,descr):
JQuest.__init__(self,id,name,descr)
self.questItemIds = [Mark]
def onAdvEvent (self,event,npc, player) :
htmltext = event
st = player.getQuestState(qn)
if not st : return
if event == "32530-02.htm" :
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
return htmltext
def onTalk (self,npc,player):
htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if id == State.COMPLETED :
htmltext = "32530-03.htm"
elif id == State.CREATED and npcId == Tepios:
if player.getLevel() >= 75 and player.getLevel() <= 82:
htmltext = "32530-01.htm"
elif player.getLevel() > 82 and st.getQuestItemsCount(Mark) == 0:
st.giveItems(13691,1)
st.playSound("ItemSound.quest_middle")
st.setState(State.COMPLETED)
htmltext = "32530-05.htm"
else :
htmltext = "32530-00.htm"
elif id == State.STARTED and npcId == Mouthofekimus:
htmltext = "32537-01.htm"
elif id == State.STARTED and npcId == Tepiosinst:
htmltext = "32603-1.htm"
st.set("cond","1")
elif id == State.STARTED and npcId == Tepios and cond == 1:
htmltext = "32530-04.htm"
st.exitQuest(True)
if st.getQuestItemsCount(Mark) == 0:
st.giveItems(13691,1)
st.giveItems(736,1)
st.unset("cond")
st.playSound("ItemSound.quest_finish")
return htmltext
QUEST = Quest(694,qn,"Break Through the Hall of Suffering")
QUEST.addStartNpc(Tepios)
QUEST.addTalkId(Tepios)
QUEST.addStartNpc(Tepiosinst)
QUEST.addTalkId(Tepiosinst)
QUEST.addStartNpc(Mouthofekimus)
QUEST.addTalkId(Mouthofekimus)
скрипт инсты:
package instances.SeedOfInfinity;
import java.util.Calendar;
import java.util.Map;
import javolution.util.FastMap;
import com.l2emu.gameserver.ai.CtrlEvent;
import com.l2emu.gameserver.ai.CtrlIntention;
import com.l2emu.gameserver.datatables.SkillTable;
import com.l2emu.gameserver.instancemanager.InstanceManager;
import com.l2emu.gameserver.instancemanager.InstanceManager.InstanceWorld;
import com.l2emu.gameserver.model.L2Object;
import com.l2emu.gameserver.model.L2Party;
import com.l2emu.gameserver.model.L2Skill;
import com.l2emu.gameserver.model.L2World;
import com.l2emu.gameserver.model.actor.L2Attackable;
import com.l2emu.gameserver.model.actor.L2Character;
import com.l2emu.gameserver.model.actor.L2Npc;
import com.l2emu.gameserver.model.L2Effect;
import com.l2emu.gameserver.model.actor.L2Summon;
import com.l2emu.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2emu.gameserver.model.actor.instance.L2PcInstance;
import com.l2emu.gameserver.model.quest.Quest;
import com.l2emu.gameserver.model.quest.QuestState;
import com.l2emu.gameserver.network.SystemMessageId;
import com.l2emu.gameserver.network.serverpackets.SystemMessage;
import com.l2emu.gameserver.templates.skills.L2SkillType;
import com.l2emu.gameserver.util.Util;
import com.l2emu.util.Rnd;
public class HallOfSuffering extends Quest
{
private class HSWorld extends InstanceWorld
{
public Map<L2Npc,Boolean> npcList = new FastMap<L2Npc,Boolean>();
public L2Npc klodekus = null;
public L2Npc klanikus = null;
public boolean isBossesAttacked = false;
public long[] storeTime = {0,0};
public HSWorld()
{
InstanceManager.getInstance().super();
}
}
private static final String qn = "HallOfSuffering";
private static final int INSTANCEID = 115; // this is the client number
private static final boolean debug = false;
//Items
//NPCs
private static final int MOUTHOFEKIMUS = 32537;
private static final int TEPIOS = 32603;
//mobs
private static final int KLODEKUS = 25665;
private static final int KLANIKUS = 25666;
private static final int TUMOR_ALIVE = 18704;
// private static final int TUMOR_DEAD = 0;
private static final int[] TUMOR_MOBIDS = {22509,22510,22511,22512,22513,22514,22515};
private static final int[] TWIN_MOBIDS = {22509,22510,22511,22512,22513};
// Doors/Walls/Zones
// Doors/Walls/Zones
private static final int[][] ROOM_1_MOBS =
{
{22509, -186296, 208200, -9544}, {22509, -186161, 208345, -9544}, {22509, -186296, 208403, -9544},
{22510, -186107, 208113, -9528}, {22510, -186350, 208200, -9544}
};
private static final int[][] ROOM_2_MOBS =
{
{22511, -184433, 210953, -9536}, {22511, -184406, 211301, -9536}, {22509, -184541, 211272, -9544},
{22510, -184244, 211098, -9536}, {22510, -184352, 211243, -9536}, {22510, -184298, 211330, -9528}
};
private static final int[][] ROOM_3_MOBS =
{
{22512, -182611, 213984, -9520}, {22512, -182908, 214071, -9520}, {22512, -182962, 213868, -9512},
{22509, -182881, 213955, -9512}, {22511, -182827, 213781, -9504}, {22511, -182530, 213984, -9528},
{22510, -182935, 213723, -9512}, {22510, -182557, 213868, -9520}
};
private static final int[][] ROOM_4_MOBS =
{
{22514, -180958, 216860, -9544}, {22514, -181012, 216628, -9536}, {22514, -181120, 216715, -9536},
{22513, -180661, 216599, -9536}, {22513, -181039, 216599, -9536}, {22511, -180715, 216599, -9536},
{22511, -181012, 216889, -9536}, {22512, -180931, 216918, -9536}, {22512, -180742, 216628, -9536}
};
private static final int[][] ROOM_5_MOBS =
{
{22512, -177372, 217854, -9536}, {22512, -177237, 218140, -9536}, {22512, -177021, 217647, -9528},
{22513, -177372, 217792, -9544}, {22513, -177372, 218053, -9536}, {22514, -177291, 217734, -9544},
{22514, -177264, 217792, -9544}, {22514, -177264, 218053, -9536}, {22515, -177156, 217792, -9536},
{22515, -177075, 217647, -9528}
};
private static final int[][] TUMOR_SPAWNS =
{
{-186327,208286,-9544},{-184429,211155,-9544},{-182811,213871,-9496},
{-181039,216633,-9528},{-177264,217760,-9544}
};
private static final int[][] TWIN_SPAWNS = {{25665,-173727,218169,-9536},{25666,-173727,218049,-9536}};
private static final int[] TEPIOS_SPAWN = {-173727,218109,-9536};
//etc
private static final int BOSS_INVUL_TIME = 30000; // in milisex
private static final int BOSS_MINION_SPAWN_TIME = 60000; // in milisex
private static final int BOSS_RESSURECT_TIME = 20000; // in milisex
// Instance reenter time
// default: 24h
private static final int INSTANCEPENALTY = 1;
private class teleCoord {int instanceId; int x; int y; int z;}
private boolean checkConditions(L2PcInstance player)
{
if (debug)
{
return true;
}
else
{
L2Party party = player.getParty();
if (party == null)
{
player.sendPacket(new SystemMessage(2101));
return false;
}
if (party.getLeader() != player)
{
player.sendPacket(new SystemMessage(2185));
return false;
}
for (L2PcInstance partyMember : party.getPartyMembers())
{
if (partyMember.getLevel() < 75)
{
SystemMessage sm = new SystemMessage(2097);
sm.addPcName(partyMember);
party.broadcastToPartyMembers(sm);
return false;
}
if (!Util.checkIfInRange(1000, player, partyMember, true))
{
SystemMessage sm = new SystemMessage(2096);
sm.addPcName(partyMember);
party.broadcastToPartyMembers(sm);
return false;
}
Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
if (System.currentTimeMillis() < reentertime)
{
SystemMessage sm = new SystemMessage(2100);
sm.addPcName(partyMember);
party.broadcastToPartyMembers(sm);
return false;
}
}
return true;
}
}
private void teleportplayer(L2PcInstance player, teleCoord teleto)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.setInstanceId(teleto.instanceId);
player.teleToLocation(teleto.x, teleto.y, teleto.z);
return;
}
private static final void removeBuffs(L2Character ch)
{
for (L2Effect e : ch.getAllEffects())
{
if (e == null)
continue;
L2Skill skill = e.getSkill();
if (skill.isDebuff() || skill.isStayAfterDeath())
continue;
e.exit();
}
if (ch.getPet() != null)
{
for (L2Effect e : ch.getPet().getAllEffects())
{
if (e == null)
continue;
L2Skill skill = e.getSkill();
if (skill.isDebuff() || skill.isStayAfterDeath())
continue;
e.exit();
}
}
}
protected int enterInstance(L2PcInstance player, String template, teleCoord teleto)
{
int instanceId = 0;
//check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
//existing instance
if (world != null)
{
if (!(world instanceof HSWorld))
{
player.sendPacket(new SystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER));
return 0;
}
teleto.instanceId = world.instanceId;
teleportplayer(player,teleto);
return instanceId;
}
//New instance
else
{
if (!checkConditions(player))
return 0;
L2Party party = player.getParty();
instanceId = InstanceManager.getInstance().createDynamicInstance(template);
world = new HSWorld();
world.instanceId = instanceId;
world.templateId = INSTANCEID;
world.status = 0;
((HSWorld)world).storeTime[0] = System.currentTimeMillis();
InstanceManager.getInstance().addWorld(world);
_log.info("Hall Of Suffering started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
runTumors((HSWorld)world);
// teleport players
teleto.instanceId = instanceId;
if (player.getParty() == null)
{
teleportplayer(player,teleto);
removeBuffs(player);
world.allowed.add(player.getObjectId());
}
else
{
for (L2PcInstance partyMember : party.getPartyMembers())
{
teleportplayer(partyMember,teleto);
removeBuffs(partyMember);
world.allowed.add(partyMember.getObjectId());
}
}
return instanceId;
}
}
protected void exitInstance(L2PcInstance player, teleCoord tele)
{
player.setInstanceId(0);
player.teleToLocation(tele.x, tele.y, tele.z);
L2Summon pet = player.getPet();
if (pet != null)
{
pet.setInstanceId(0);
pet.teleToLocation(tele.x, tele.y, tele.z);
}
}
protected boolean checkKillProgress(L2Npc mob, HSWorld world)
{
if (world.npcList.containsKey(mob))
world.npcList.put(mob, true);
for(boolean isDead: world.npcList.values())
if (!isDead)
return false;
return true;
}
protected int[][] getRoomSpawns(int room)
{
switch(room)
{
case 0:
return ROOM_1_MOBS;
case 1:
return ROOM_2_MOBS;
case 2:
return ROOM_3_MOBS;
case 3:
return ROOM_4_MOBS;
case 4:
return ROOM_5_MOBS;
}
//_log.warning("");
return new int[][]{};
}
protected void runTumors(HSWorld world)
{
for (int[] mob : getRoomSpawns(world.status))
{
L2Npc npc = addSpawn(mob[0], mob[1], mob[2], mob[3], 0, false,0,false,world.instanceId);
world.npcList.put(npc, false);
}
L2Npc mob = addSpawn(TUMOR_ALIVE, TUMOR_SPAWNS[world.status][0], TUMOR_SPAWNS[world.status][1], TUMOR_SPAWNS[world.status][2], 0, false,0,false,world.instanceId);
mob.disableCoreAI(true);
mob.setIsImmobilized(true);
mob.setCurrentHp(mob.getMaxHp()*0.5);
world.npcList.put(mob, false);
world.status++;
}
protected void runTwins(HSWorld world)
{
world.status++;
world.klodekus = addSpawn(TWIN_SPAWNS[0][0], TWIN_SPAWNS[0][1], TWIN_SPAWNS[0][2], TWIN_SPAWNS[0][3], 0, false,0,false,world.instanceId);
world.klanikus = addSpawn(TWIN_SPAWNS[1][0], TWIN_SPAWNS[1][1], TWIN_SPAWNS[1][2], TWIN_SPAWNS[1][3], 0, false,0,false,world.instanceId);
//world.klanikus.setIsMortal(false);
//world.klodekus.setIsMortal(false);
}
protected void bossSimpleDie(L2Npc boss)
{
// killing is only possible one time
synchronized (this)
{
if (boss.isDead()) return;
// now reset currentHp to zero
boss.setCurrentHp(0);
boss.setIsDead(true);
}
// Set target to null and cancel Attack or Cast
boss.setTarget(null);
// Stop movement
boss.stopMove(null);
// Stop HP/MP/CP Regeneration task
boss.getStatus().stopHpMpRegeneration();
boss.stopAllEffectsExceptThoseThatLastThroughDeath();
// Send the Server->Client packet StatusUpdate with current HP and MP to all other L2PcInstance to inform
boss.broadcastStatusUpdate();
// Notify L2Character AI
boss.getAI().notifyEvent(CtrlEvent.EVT_DEAD);
if (boss.getWorldRegion() != null)
boss.getWorldRegion().onDeath(boss);
}
@Override
public String onSkillSee (L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
{
if (skill.getSkillType() == L2SkillType.BALANCE_LIFE || skill.getSkillType() == L2SkillType.HEAL
|| skill.getSkillType() == L2SkillType.HEAL_PERCENT || skill.getSkillType() == L2SkillType.HEAL_STATIC)
{
int hate = 2 * skill.getAggroPoints();
if (hate < 2)
hate = 1000;
((L2Attackable)npc).addDamageHate(caster,0,hate);
}
return super.onSkillSee(npc, caster, skill, targets, isPet);
}
public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld instanceof HSWorld)
{
HSWorld world = (HSWorld) tmpworld;
if (event.equalsIgnoreCase("spawnBossGuards"))
{
L2Npc mob = addSpawn(TWIN_MOBIDS[Rnd.get(TWIN_MOBIDS.length)], TWIN_SPAWNS[0][1], TWIN_SPAWNS[0][2], TWIN_SPAWNS[0][3], 0, false,0,false,npc.getInstanceId());
((L2Attackable)mob).addDamageHate(((L2Attackable)npc).getMostHated(),0,1);
if (Rnd.get(100) < 33)
{
mob = addSpawn(TWIN_MOBIDS[Rnd.get(TWIN_MOBIDS.length)], TWIN_SPAWNS[1][1], TWIN_SPAWNS[1][2], TWIN_SPAWNS[1][3], 0, false,0,false,npc.getInstanceId());
((L2Attackable)mob).addDamageHate(((L2Attackable)npc).getMostHated(),0,1);
}
startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null);
}
else if (event.equalsIgnoreCase("isTwinSeparated"))
{
if (Util.checkIfInRange(500, world.klanikus, world.klodekus, false))
{
world.klanikus.setIsInvul(false);
world.klodekus.setIsInvul(false);
}
else
{
world.klanikus.setIsInvul(true);
world.klodekus.setIsInvul(true);
}
startQuestTimer("isTwinSeparated", 10000, npc, null);
}
else if (event.equalsIgnoreCase("ressurectTwin"))
{
L2Skill skill = SkillTable.getInstance().getInfo(5824, 1);
L2Npc aliveTwin = (world.klanikus == npc ? world.klodekus : world.klanikus);
npc.doRevive();
npc.doCast(skill);
npc.setCurrentHp(aliveTwin.getCurrentHp());
// get most hated of other boss
L2Character hated = ((L2MonsterInstance)aliveTwin).getMostHated();
if(hated != null) //to prevent revived idling
npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, hated, 1000);
aliveTwin.setIsInvul(true); //make other boss invul
startQuestTimer("uninvul", BOSS_INVUL_TIME, aliveTwin, null);
}
else if(event.equals("uninvul"))
npc.setIsInvul(false);
}
return "";
}
public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, L2Skill skill)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld instanceof HSWorld)
{
if (!((HSWorld)tmpworld).isBossesAttacked)
{
((HSWorld) tmpworld).isBossesAttacked = true;
Calendar reenter = Calendar.getInstance();
reenter.add(Calendar.HOUR, INSTANCEPENALTY);
SystemMessage sm = new SystemMessage(SystemMessageId.INSTANT_ZONE_RESTRICTED);
sm.addString(InstanceManager.getInstance().getInstanceIdName(tmpworld.templateId));
// set instance reenter time for all allowed players
for (int objectId : tmpworld.allowed)
{
L2PcInstance player = L2World.getInstance().getPlayer(objectId);
if (player != null && player.isOnline() > 0)
{
InstanceManager.getInstance().setInstanceTime(objectId, tmpworld.templateId, reenter.getTimeInMillis());
player.sendPacket(sm);
}
}
startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null);
startQuestTimer("isTwinSeparated", 10000, npc, null);
}
else if (damage >= npc.getCurrentHp())
{
if (((HSWorld)tmpworld).klanikus.isDead())
{
((HSWorld)tmpworld).klanikus.setIsDead(false);
((HSWorld)tmpworld).klanikus.doDie(attacker);
((HSWorld)tmpworld).klodekus.doDie(attacker);
}
else if (((HSWorld)tmpworld).klodekus.isDead())
{
((HSWorld)tmpworld).klodekus.setIsDead(false);
((HSWorld)tmpworld).klodekus.doDie(attacker);
((HSWorld)tmpworld).klanikus.doDie(attacker);
}
else
{
bossSimpleDie(npc);
startQuestTimer("ressurectTwin", BOSS_RESSURECT_TIME, npc, null);
}
}
}
return null;
}
public String onKill( L2Npc npc, L2PcInstance player, boolean isPet)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld instanceof HSWorld)
{
HSWorld world = (HSWorld) tmpworld;
if (world.status < 5)
{
if (checkKillProgress(npc, world))
runTumors(world);
}
else if (world.status == 5)
{
if (checkKillProgress(npc, world))
runTwins(world);
}
else if (world.status == 6 && (npc.getNpcId() == KLODEKUS || npc.getNpcId() == KLANIKUS))
{
if (world.klanikus.isDead() && world.klodekus.isDead())
{
world.status++;
// instance end
world.storeTime[1] = System.currentTimeMillis();
world.klanikus = null;
world.klodekus = null;
this.cancelQuestTimers("ressurectTwin");
this.cancelQuestTimers("spawnBossGuards");
this.cancelQuestTimers("isTwinSeparated");
addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false,0,false,world.instanceId);
}
}
}
return "";
}
public String onTalk (L2Npc npc, L2PcInstance player)
{
int npcId = npc.getNpcId();
QuestState st = player.getQuestState(qn);
if (st == null)
st = newQuestState(player);
if (npcId == MOUTHOFEKIMUS)
{
teleCoord tele = new teleCoord();
tele.x = -187567;
tele.y = 205570;
tele.z = -9538;
enterInstance(player, "hallofsuffering.xml", tele);
}
else if (npcId == TEPIOS)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
Long finishDiff = ((HSWorld)world).storeTime[1] - ((HSWorld)world).storeTime[0];
if (finishDiff < 1260000)
{
st.giveItems(13777, 1);
}
else if (finishDiff < 1380000)
{
st.giveItems(13778, 1);
}
else if (finishDiff < 1500000)
{
st.giveItems(13779, 1);
}
else if (finishDiff < 1620000)
{
st.giveItems(13780, 1);
}
else if (finishDiff < 1740000)
{
st.giveItems(13781, 1);
}
else if (finishDiff < 1860000)
{
st.giveItems(13782, 1);
}
else if (finishDiff < 1980000)
{
st.giveItems(13783, 1);
}
else if (finishDiff < 2100000)
{
st.giveItems(13784, 1);
}
else if (finishDiff < 2220000)
{
st.giveItems(13785, 1);
}
else
{
st.giveItems(13786, 1);
}
world.allowed.remove(world.allowed.indexOf(player.getObjectId()));
teleCoord tele = new teleCoord();
tele.instanceId = 0;
tele.x = -183292;
tele.y = 206063;
tele.z = -12888;
exitInstance(player,tele);
}
return "";
}
public HallOfSuffering(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(MOUTHOFEKIMUS);
addTalkId(MOUTHOFEKIMUS);
addStartNpc(TEPIOS);
addTalkId(TEPIOS);
addKillId(TUMOR_ALIVE);
addKillId(KLODEKUS);
addKillId(KLANIKUS);
addAttackId(KLODEKUS);
addAttackId(KLANIKUS);
for(int mobId : TUMOR_MOBIDS)
{
addSkillSeeId(mobId);
addKillId(mobId);
}
}
public static void main(String[] args)
{
new HallOfSuffering(-1,qn,"instances");
}
}
Сервер от команды l2wt.