Sync with L2JServer Feb 3rd 2015.

This commit is contained in:
mobius
2015-02-03 21:11:57 +00:00
parent 9cf1a6d6e5
commit fe25f74122
169 changed files with 3379 additions and 5414 deletions

View File

@ -18,8 +18,8 @@
*/
package instances.MithrilMine;
import instances.AbstractInstance;
import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@ -32,22 +32,19 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
/**
* Mithril Mine instance zone.
* @author Adry_85
*/
public final class MithrilMine extends AbstractNpcAI
public final class MithrilMine extends AbstractInstance
{
protected class MMWorld extends InstanceWorld
{
long storeTime = 0;
int _count = 0;
protected int _count = 0;
}
private static final int TEMPLATE_ID = 138;
// NPCs
private static final int KEGOR = 18846;
private static final int MITHRIL_MILLIPEDE = 22766;
@ -68,8 +65,10 @@ public final class MithrilMine extends AbstractNpcAI
new Location(185920, -184544, -3308, -32544),
new Location(185664, -184720, -3308, 27892)
};
// Misc
private static final int TEMPLATE_ID = 138;
private MithrilMine()
public MithrilMine()
{
super(MithrilMine.class.getSimpleName(), "instances");
addFirstTalkId(KEGOR);
@ -205,7 +204,7 @@ public final class MithrilMine extends AbstractNpcAI
giveItems(talker, COLD_RESISTANCE_POTION, 1);
}
qs.setCond(4, true);
enterInstance(talker, "MithrilMine.xml", START_LOC);
enterInstance(talker, new MMWorld(), "MithrilMine.xml", TEMPLATE_ID);
}
break;
}
@ -227,37 +226,13 @@ public final class MithrilMine extends AbstractNpcAI
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof MMWorld))
{
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
return 0;
}
teleportPlayer(player, loc, world.getInstanceId(), false);
return 0;
world.addAllowed(player.getObjectId());
}
// New instance
world = new MMWorld();
world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
world.setTemplateId(TEMPLATE_ID);
world.setStatus(0);
((MMWorld) world).storeTime = System.currentTimeMillis();
InstanceManager.getInstance().addWorld(world);
_log.info("Mithril Mine started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
// teleport players
teleportPlayer(player, loc, world.getInstanceId(), false);
world.addAllowed(player.getObjectId());
return world.getInstanceId();
teleportPlayer(player, START_LOC, world.getInstanceId(), false);
}
public static void main(String[] args)
{
new MithrilMine();
}
}
}