浏览代码

BETA: Pailaka - Song Of Ice And Fire (128) update/cleanup. Also separated Quest and Instance scripts.
* Thanks to: Pandragon

St3eT 11 年之前
父节点
当前提交
d83eb7d65c
共有 37 个文件被更改,包括 621 次插入592 次删除
  1. 0 0
      L2J_DataPack_BETA/dist/game/data/html/default/32497.htm
  2. 0 0
      L2J_DataPack_BETA/dist/game/data/html/default/32500.htm
  3. 0 0
      L2J_DataPack_BETA/dist/game/data/html/default/32507.htm
  4. 0 0
      L2J_DataPack_BETA/dist/game/data/html/default/32510.htm
  5. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts.cfg
  6. 0 577
      L2J_DataPack_BETA/dist/game/data/scripts/instances/Pailaka/PailakaSongOfIceAndFire.java
  7. 226 0
      L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
  8. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-00.htm
  9. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-01.htm
  10. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-02.htm
  11. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-03.htm
  12. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-04.htm
  13. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-05.htm
  14. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-06.htm
  15. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-07.htm
  16. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-00.htm
  17. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-01.htm
  18. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-02.htm
  19. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-03.htm
  20. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-04.htm
  21. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-05.htm
  22. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-06.htm
  23. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-01.htm
  24. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-02.htm
  25. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-03.htm
  26. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-04.htm
  27. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-05.htm
  28. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-06.htm
  29. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-07.htm
  30. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-08.htm
  31. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-09.htm
  32. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-00.htm
  33. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-01.htm
  34. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-02.htm
  35. 377 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java
  36. 2 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/QuestMasterHandler.java
  37. 1 0
      L2J_DataPack_BETA/dist/sql/game/updates/20140618update.sql

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497.htm → L2J_DataPack_BETA/dist/game/data/html/default/32497.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500.htm → L2J_DataPack_BETA/dist/game/data/html/default/32500.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507.htm → L2J_DataPack_BETA/dist/game/data/html/default/32507.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32510.htm → L2J_DataPack_BETA/dist/game/data/html/default/32510.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -201,7 +201,7 @@ instances/MithrilMine/MithrilMine.java
 instances/MonasteryOfSilence1/MonasteryOfSilence1.java
 instances/NornilsGarden/NornilsGarden.java
 instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
-instances/Pailaka/PailakaSongOfIceAndFire.java
+instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
 instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
 instances/SecretArea/SecretArea.java
 instances/SeedOfDestruction/Stage1.java

+ 0 - 577
L2J_DataPack_BETA/dist/game/data/scripts/instances/Pailaka/PailakaSongOfIceAndFire.java

@@ -1,577 +0,0 @@
-/*
- * Copyright (C) 2004-2014 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 instances.Pailaka;
-
-import com.l2jserver.gameserver.ThreadPoolManager;
-import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.enums.QuestSound;
-import com.l2jserver.gameserver.instancemanager.InstanceManager;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.entity.Instance;
-import com.l2jserver.gameserver.model.holders.SkillHolder;
-import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
-import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.model.quest.State;
-import com.l2jserver.gameserver.model.zone.L2ZoneType;
-import com.l2jserver.gameserver.network.NpcStringId;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.clientpackets.Say2;
-import com.l2jserver.gameserver.network.serverpackets.NpcSay;
-import com.l2jserver.gameserver.util.Broadcast;
-
-/**
- * Pailaka (Forgotten Temple) instance zone.
- */
-public final class PailakaSongOfIceAndFire extends Quest
-{
-	private static final int MIN_LEVEL = 36;
-	private static final int MAX_LEVEL = 42;
-	private static final int EXIT_TIME = 5;
-	private static final int INSTANCE_ID = 43;
-	protected static final int[] TELEPORT =
-	{
-		-52875,
-		188232,
-		-4696
-	};
-	private static final int ZONE = 20108;
-	
-	private static final int ADLER1 = 32497;
-	private static final int ADLER2 = 32510;
-	private static final int SINAI = 32500;
-	private static final int INSPECTOR = 32507;
-	
-	private static final int HILLAS = 18610;
-	private static final int PAPION = 18609;
-	private static final int KINSUS = 18608;
-	private static final int GARGOS = 18607;
-	private static final int ADIANTUM = 18620;
-	private static final int BLOOM = 18616;
-	private static final int BOTTLE = 32492;
-	private static final int BRAZIER = 32493;
-	private static final int[] MONSTERS =
-	{
-		HILLAS,
-		PAPION,
-		KINSUS,
-		GARGOS,
-		ADIANTUM,
-		BLOOM,
-		BOTTLE,
-		BRAZIER,
-		18611,
-		18612,
-		18613,
-		18614,
-		18615
-	};
-	
-	private static final int SWORD = 13034;
-	private static final int ENH_SWORD1 = 13035;
-	private static final int ENH_SWORD2 = 13036;
-	private static final int BOOK1 = 13130;
-	private static final int BOOK2 = 13131;
-	private static final int BOOK3 = 13132;
-	private static final int BOOK4 = 13133;
-	private static final int BOOK5 = 13134;
-	private static final int BOOK6 = 13135;
-	private static final int BOOK7 = 13136;
-	private static final int WATER_ESSENCE = 13038;
-	private static final int FIRE_ESSENCE = 13039;
-	private static final int SHIELD_POTION = 13032;
-	private static final int HEAL_POTION = 13033;
-	private static final int FIRE_ENHANCER = 13040;
-	private static final int WATER_ENHANCER = 13041;
-	private static final int[] ITEMS =
-	{
-		SWORD,
-		ENH_SWORD1,
-		ENH_SWORD2,
-		BOOK1,
-		BOOK2,
-		BOOK3,
-		BOOK4,
-		BOOK5,
-		BOOK6,
-		BOOK7,
-		WATER_ESSENCE,
-		FIRE_ESSENCE,
-		SHIELD_POTION,
-		HEAL_POTION,
-		FIRE_ENHANCER,
-		WATER_ENHANCER
-	};
-	
-	// @formatter:off
-	private static final int[][] DROPLIST =
-	{
-		// must be sorted by npcId !
-		// npcId, itemId, chance
-		{
-			BLOOM, SHIELD_POTION, 30
-		},
-		{
-			BLOOM, HEAL_POTION, 80
-		},
-		{
-			BOTTLE, SHIELD_POTION, 10
-		},
-		{
-			BOTTLE, WATER_ENHANCER, 40
-		},
-		{
-			BOTTLE, HEAL_POTION, 80
-		},
-		{
-			BRAZIER, SHIELD_POTION, 10
-		},
-		{
-			BRAZIER, FIRE_ENHANCER, 40
-		},
-		{
-			BRAZIER, HEAL_POTION, 80
-		}
-	};
-	
-	/**
-	 * itemId, count, chance
-	 */
-	private static final int[][] HP_HERBS_DROPLIST =
-	{
-		{
-			8602, 1, 10
-		},
-		{
-			8601, 1, 40
-		},
-		{
-			8600, 1, 70
-		}
-	};
-	
-	/**
-	 * itemId, count, chance
-	 */
-	private static final int[][] MP_HERBS_DROPLIST =
-	{
-		{
-			8605, 1, 10
-		},
-		{
-			8604, 1, 40
-		},
-		{
-			8603, 1, 70
-		}
-	};
-	// @formatter:on
-	
-	private static final int[] REWARDS =
-	{
-		13294,
-		13293,
-		736
-	};
-	
-	// Skills
-	private static SkillHolder VITALITY_REPLENISHING = new SkillHolder(5774, 1);
-	
-	private PailakaSongOfIceAndFire()
-	{
-		// TODO change the script to use the actual class name
-		super(128, "128_PailakaSongOfIceAndFire", "Pailaka - Song of Ice and Fire");
-		addStartNpc(ADLER1);
-		addFirstTalkId(ADLER1, ADLER2, SINAI, INSPECTOR);
-		addTalkId(ADLER1, ADLER2, SINAI, INSPECTOR);
-		addAttackId(BOTTLE, BRAZIER);
-		addKillId(MONSTERS);
-		addExitZoneId(ZONE);
-		addSeeCreatureId(GARGOS);
-		registerQuestItems(ITEMS);
-	}
-	
-	private static final void dropHerb(L2Npc mob, L2PcInstance player, int[][] drop)
-	{
-		final int chance = getRandom(100);
-		for (int[] element : drop)
-		{
-			if (chance < element[2])
-			{
-				mob.dropItem(player, element[0], element[1]);
-				return;
-			}
-		}
-	}
-	
-	private static final void dropItem(L2Npc mob, L2PcInstance player)
-	{
-		final int npcId = mob.getId();
-		final int chance = getRandom(100);
-		for (int[] drop : DROPLIST)
-		{
-			if (npcId == drop[0])
-			{
-				if (chance < drop[2])
-				{
-					mob.dropItem(player, drop[1], getRandom(1, 6));
-					return;
-				}
-			}
-			if (npcId < drop[0])
-			{
-				return; // not found
-			}
-		}
-	}
-	
-	protected static final void teleportPlayer(L2PcInstance player, int[] coords, int instanceId)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(instanceId);
-		player.teleToLocation(coords[0], coords[1], coords[2], true);
-	}
-	
-	private final synchronized void enterInstance(L2PcInstance player)
-	{
-		// check for existing instances for this player
-		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-		if (world != null)
-		{
-			if (world.getTemplateId() != INSTANCE_ID)
-			{
-				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return;
-			}
-			Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
-			if (inst != null)
-			{
-				teleportPlayer(player, TELEPORT, world.getInstanceId());
-			}
-			return;
-		}
-		// New instance
-		final int instanceId = InstanceManager.getInstance().createDynamicInstance("PailakaSongOfIceAndFire.xml");
-		
-		world = new InstanceWorld();
-		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCE_ID);
-		InstanceManager.getInstance().addWorld(world);
-		
-		world.addAllowed(player.getObjectId());
-		teleportPlayer(player, TELEPORT, instanceId);
-		
-	}
-	
-	@Override
-	public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
-	{
-		final QuestState st = player.getQuestState(getName());
-		if (st == null)
-		{
-			return getNoQuestMsg(player);
-		}
-		
-		switch (event)
-		{
-			case "enter":
-				enterInstance(player);
-				return null;
-			case "32497-03.htm":
-				if (!st.isStarted())
-				{
-					st.startQuest();
-				}
-				break;
-			case "32500-06.htm":
-				if (st.isCond(1))
-				{
-					st.setCond(2, true);
-					giveItems(player, SWORD, 1);
-					giveItems(player, BOOK1, 1);
-				}
-				break;
-			case "32507-04.htm":
-				if (st.isCond(3))
-				{
-					st.setCond(4, true);
-					takeItems(player, SWORD, -1);
-					takeItems(player, WATER_ESSENCE, -1);
-					takeItems(player, BOOK2, -1);
-					giveItems(player, BOOK3, 1);
-					giveItems(player, ENH_SWORD1, 1);
-				}
-				break;
-			case "32507-08.htm":
-				if (st.isCond(6))
-				{
-					st.setCond(7, true);
-					takeItems(player, ENH_SWORD1, -1);
-					takeItems(player, BOOK5, -1);
-					takeItems(player, FIRE_ESSENCE, -1);
-					giveItems(player, ENH_SWORD2, 1);
-					giveItems(player, BOOK6, 1);
-				}
-				break;
-			case "32510-02.htm":
-				st.exitQuest(false, true);
-				
-				Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId());
-				inst.setDuration(EXIT_TIME * 60000);
-				inst.setEmptyDestroyTime(0);
-				
-				if (inst.containsPlayer(player.getObjectId()))
-				{
-					npc.setTarget(player);
-					npc.doCast(VITALITY_REPLENISHING.getSkill());
-					addExpAndSp(player, 810000, 50000);
-					for (int id : REWARDS)
-					{
-						giveItems(player, id, 1);
-					}
-				}
-				break;
-			case "GARGOS_LAUGH":
-			{
-				Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getTemplate().getDisplayId(), NpcStringId.OHHOHOH));
-				break;
-			}
-		}
-		return event;
-	}
-	
-	@Override
-	public final String onFirstTalk(L2Npc npc, L2PcInstance player)
-	{
-		return npc.getId() + ".htm";
-	}
-	
-	@Override
-	public final String onTalk(L2Npc npc, L2PcInstance player)
-	{
-		final QuestState st = player.getQuestState(getName());
-		if (st == null)
-		{
-			return getNoQuestMsg(player);
-		}
-		
-		switch (npc.getId())
-		{
-			case ADLER1:
-				switch (st.getState())
-				{
-					case State.CREATED:
-						if (player.getLevel() < MIN_LEVEL)
-						{
-							return "32497-05.htm";
-						}
-						if (player.getLevel() > MAX_LEVEL)
-						{
-							return "32497-06.htm";
-						}
-						return "32497-01.htm";
-					case State.STARTED:
-						if (st.getCond() > 1)
-						{
-							return "32497-00.htm";
-						}
-						return "32497-03.htm";
-					case State.COMPLETED:
-						return "32497-07.htm";
-					default:
-						return "32497-01.htm";
-				}
-			case SINAI:
-				if (st.getCond() > 1)
-				{
-					return "32500-00.htm";
-				}
-				return "32500-01.htm";
-			case INSPECTOR:
-				switch (st.getCond())
-				{
-					case 1:
-						return "32507-01.htm";
-					case 2:
-						return "32507-02.htm";
-					case 3:
-						return "32507-03.htm";
-					case 4:
-					case 5:
-						return "32507-05.htm";
-					case 6:
-						return "32507-06.htm";
-					default:
-						return "32507-09.htm";
-				}
-			case ADLER2:
-				if (st.isCompleted())
-				{
-					return "32510-00.htm";
-				}
-				else if (st.isCond(9))
-				{
-					return "32510-01.htm";
-				}
-		}
-		return getNoQuestMsg(player);
-	}
-	
-	@Override
-	public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
-	{
-		if (!npc.isDead())
-		{
-			npc.doDie(attacker);
-		}
-		
-		return super.onAttack(npc, attacker, damage, isSummon);
-	}
-	
-	@Override
-	public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
-	{
-		final QuestState st = player.getQuestState(getName());
-		if ((st != null) && st.isStarted())
-		{
-			switch (npc.getId())
-			{
-				case HILLAS:
-					if (st.isCond(2))
-					{
-						st.setCond(3);
-						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
-						takeItems(player, BOOK1, -1);
-						giveItems(player, BOOK2, 1);
-						giveItems(player, WATER_ESSENCE, 1);
-					}
-					addSpawn(PAPION, -53903, 181484, -4555, 30456, false, 0, false, npc.getInstanceId());
-					break;
-				case PAPION:
-					if (st.isCond(4))
-					{
-						st.setCond(5);
-						takeItems(player, BOOK3, -1);
-						giveItems(player, BOOK4, 1);
-						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
-					}
-					addSpawn(KINSUS, -61415, 181418, -4818, 63852, false, 0, false, npc.getInstanceId());
-					break;
-				case KINSUS:
-					if (st.isCond(5))
-					{
-						st.setCond(6);
-						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
-						takeItems(player, BOOK4, -1);
-						giveItems(player, BOOK5, 1);
-						giveItems(player, FIRE_ESSENCE, 1);
-					}
-					addSpawn(GARGOS, -61354, 183624, -4821, 63613, false, 0, false, npc.getInstanceId());
-					break;
-				case GARGOS:
-					if (st.isCond(7))
-					{
-						st.setCond(8);
-						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
-						takeItems(player, BOOK6, -1);
-						giveItems(player, BOOK7, 1);
-					}
-					addSpawn(ADIANTUM, -53297, 185027, -4617, 1512, false, 0, false, npc.getInstanceId());
-					break;
-				case ADIANTUM:
-					if (st.isCond(8))
-					{
-						st.setCond(9);
-						playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
-						takeItems(player, BOOK7, -1);
-						addSpawn(ADLER2, -53297, 185027, -4617, 33486, false, 0, false, npc.getInstanceId());
-					}
-					break;
-				case BOTTLE:
-				case BRAZIER:
-				case BLOOM:
-					dropItem(npc, player);
-					break;
-				default:
-					// hardcoded herb drops
-					dropHerb(npc, player, HP_HERBS_DROPLIST);
-					dropHerb(npc, player, MP_HERBS_DROPLIST);
-					break;
-			}
-		}
-		return super.onKill(npc, player, isSummon);
-	}
-	
-	@Override
-	public String onExitZone(L2Character character, L2ZoneType zone)
-	{
-		if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
-		{
-			InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
-			if ((world != null) && (world.getTemplateId() == INSTANCE_ID))
-			{
-				ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(character, world.getInstanceId()), 1000);
-			}
-		}
-		return super.onExitZone(character, zone);
-	}
-	
-	@Override
-	public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
-	{
-		if (npc.isScriptValue(0) && creature.isPlayer())
-		{
-			npc.setScriptValue(1);
-			startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer());
-		}
-		return super.onSeeCreature(npc, creature, isSummon);
-	}
-	
-	static final class Teleport implements Runnable
-	{
-		private final L2Character _char;
-		private final int _instanceId;
-		
-		public Teleport(L2Character c, int id)
-		{
-			_char = c;
-			_instanceId = id;
-		}
-		
-		@Override
-		public void run()
-		{
-			try
-			{
-				teleportPlayer((L2PcInstance) _char, TELEPORT, _instanceId);
-			}
-			catch (Exception e)
-			{
-				e.printStackTrace();
-			}
-		}
-	}
-	
-	public static void main(String[] args)
-	{
-		new PailakaSongOfIceAndFire();
-	}
-}

+ 226 - 0
L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java

@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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 instances.PailakaSongOfIceAndFire;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
+import com.l2jserver.gameserver.model.zone.L2ZoneType;
+import com.l2jserver.gameserver.network.NpcStringId;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+
+/**
+ * Pailaka Song of Ice and Fire Instance zone.
+ * @author Gnacik, St3eT
+ */
+public final class PailakaSongOfIceAndFire extends AbstractNpcAI
+{
+	protected class PSoIWorld extends InstanceWorld
+	{
+		
+	}
+	
+	// NPCs
+	private static final int ADLER1 = 32497;
+	private static final int GARGOS = 18607;
+	private static final int BLOOM = 18616;
+	private static final int BOTTLE = 32492;
+	private static final int BRAZIER = 32493;
+	// Items
+	private static final int FIRE_ENHANCER = 13040;
+	private static final int WATER_ENHANCER = 13041;
+	private static final int SHIELD_POTION = 13032;
+	private static final int HEAL_POTION = 13033;
+	// Location
+	private static final Location TELEPORT = new Location(-52875, 188232, -4696);
+	// Misc
+	private static final int INSTANCE_ID = 43;
+	private static final int ZONE = 20108;
+	
+	private PailakaSongOfIceAndFire()
+	{
+		super(PailakaSongOfIceAndFire.class.getSimpleName(), "instances");
+		addStartNpc(ADLER1);
+		addTalkId(ADLER1);
+		addAttackId(BOTTLE, BRAZIER);
+		addExitZoneId(ZONE);
+		addSeeCreatureId(GARGOS);
+		addSpawnId(BLOOM);
+		addKillId(BLOOM);
+	}
+	
+	private void enterInstance(L2PcInstance player, String template)
+	{
+		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
+		
+		if (world != null)
+		{
+			if (world instanceof PSoIWorld)
+			{
+				teleportPlayer(player, TELEPORT, world.getInstanceId());
+				return;
+			}
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
+		}
+		world = new PSoIWorld();
+		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+		world.setTemplateId(INSTANCE_ID);
+		InstanceManager.getInstance().addWorld(world);
+		world.addAllowed(player.getObjectId());
+		teleportPlayer(player, TELEPORT, world.getInstanceId());
+		_log.info("Pailaka Song of Ice and Fire" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
+	}
+	
+	@Override
+	public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		switch (event)
+		{
+			case "enter":
+			{
+				enterInstance(player, "PailakaSongOfIceAndFire.xml");
+				break;
+			}
+			case "GARGOS_LAUGH":
+			{
+				broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.OHHOHOH);
+				break;
+			}
+			case "TELEPORT":
+			{
+				teleportPlayer(player, TELEPORT, player.getInstanceId());
+				break;
+			}
+			case "DELETE":
+			{
+				if (npc != null)
+				{
+					npc.deleteMe();
+				}
+				break;
+			}
+			case "BLOOM_TIMER":
+			{
+				startQuestTimer("BLOOM_TIMER2", getRandom(2, 4) * 60 * 1000, npc, null);
+				break;
+			}
+			case "BLOOM_TIMER2":
+			{
+				npc.setInvisible(!npc.isInvisible());
+				startQuestTimer("BLOOM_TIMER", 5000, npc, null);
+				break;
+			}
+		}
+		return super.onAdvEvent(event, npc, player);
+	}
+	
+	@Override
+	public final String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon)
+	{
+		if ((damage > 0) && npc.isScriptValue(0))
+		{
+			switch (getRandom(6))
+			{
+				case 0:
+				{
+					if (npc.getId() == BOTTLE)
+					{
+						npc.dropItem(player, WATER_ENHANCER, getRandom(1, 6));
+					}
+					break;
+				}
+				case 1:
+				{
+					if (npc.getId() == BRAZIER)
+					{
+						npc.dropItem(player, FIRE_ENHANCER, getRandom(1, 6));
+					}
+					break;
+				}
+				case 2:
+				case 3:
+				{
+					npc.dropItem(player, SHIELD_POTION, getRandom(1, 10));
+					break;
+				}
+				case 4:
+				case 5:
+				{
+					npc.dropItem(player, HEAL_POTION, getRandom(1, 10));
+					break;
+				}
+			}
+			npc.setScriptValue(1);
+			startQuestTimer("DELETE", 3000, npc, null);
+		}
+		return super.onAttack(npc, player, damage, isSummon);
+	}
+	
+	@Override
+	public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+	{
+		npc.dropItem(player, getRandomBoolean() ? SHIELD_POTION : HEAL_POTION, getRandom(1, 7));
+		return super.onKill(npc, player, isSummon);
+	}
+	
+	@Override
+	public String onExitZone(L2Character character, L2ZoneType zone)
+	{
+		if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
+		{
+			final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
+			if ((world != null) && (world.getTemplateId() == INSTANCE_ID))
+			{
+				startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character);
+			}
+		}
+		return super.onExitZone(character, zone);
+	}
+	
+	@Override
+	public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+	{
+		if (npc.isScriptValue(0) && creature.isPlayer())
+		{
+			npc.setScriptValue(1);
+			startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer());
+		}
+		return super.onSeeCreature(npc, creature, isSummon);
+	}
+	
+	@Override
+	public String onSpawn(L2Npc npc)
+	{
+		npc.setInvisible(true);
+		startQuestTimer("BLOOM_TIMER", 1000, npc, null);
+		return super.onSpawn(npc);
+	}
+	
+	public static void main(String[] args)
+	{
+		new PailakaSongOfIceAndFire();
+	}
+}

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-00.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-00.htm

@@ -1,4 +1,4 @@
 <html><body>Inspector Adler:<br>
 Ah, we meet again! Apparently the chaos caused by Pailaka has still not been resolved. If you are willing, I can send you to Pailaka again.  What would you like to do?<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire enter">Enter Pailaka.</a>
+<a action="bypass -h Quest PailakaSongOfIceAndFire enter">Enter Pailaka.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-01.htm

@@ -2,5 +2,5 @@
 What do you know about Pailaka? The Ivory Tower discovered it shortly after Kamaloka.<br>
 Apparently, it's a kind of "pocket reality" created by Kamaloka's energy acting on places that are filled with a high degree of chaos: old battlefields or the sites of powerful magical experiments, for example.<br>
 Although Pailaka is not part of our reality, what happens there can affect our world...<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32497-02.htm">Keep listening.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32497-02.htm">Keep listening.</a>
 </body></html>

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-02.htm

@@ -4,6 +4,6 @@ We followed the flow of mana and traced the energy of Kamaloka to find likely sp
 At present, Pailaka has not affected our reality, but who knows what may happen in time? It may even impact next year's harvest.<br>
 We discovered Pailaka in the Forgotten Temple close to here. If you are willing, I would like you to enter Pailaka and restore order. Will you do it?<br>
 <font color="LEVEL">(You will be rewarded for your efforts. Vitality points will be granted to you immediately upon completing the quest. If you receive the reward while your Vitality Level is high, though, you may notice a slight reduction.)</font><br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32497-03.htm">Say yes.</a><br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32497-04.htm">Say no.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32497-03.htm">Say yes.</a><br>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32497-04.htm">Say no.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-03.htm

@@ -2,5 +2,5 @@
 We really don't know what you will encounter when you open the gateway to Pailaka. But as with Kamaloka, I suspect you will find an ally there willing to share information.<br>
 You should have no difficulty learning what you must do.<br>
 Good luck!<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire enter">Accept the challenge of Pailaka.</a>
+<a action="bypass -h Quest PailakaSongOfIceAndFire enter">Accept the challenge of Pailaka.</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-04.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-05.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-06.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32497-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32497-07.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-00.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-00.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-01.htm

@@ -2,5 +2,5 @@
 Are you an adventurer? Hmm, finding an adventurer in a dangerous place like this...<br>
 I suppose I shouldn't be surprised! Still, I must admit I didn't expect to find you here.<br>
 Were you sent by the Adventurers Association? Or perhaps you found your way here on your own? Ah, you look puzzled, my friend!<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32500-02.htm">Ask for an explanation.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32500-02.htm">Ask for an explanation.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-02.htm

@@ -2,5 +2,5 @@
 Hmm... Let's see if I can make this brief... Once there was a balance here between the power of the Water and Fire Sprites, but now those two have become increasingly aggressive.<br>
 Worse, I've received a report that some of the Sprites have embraced the chaos and are changing into fearsome monsters.<br>
 We have crafted a weapon to fight them, but we need someone who can wield it...<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32500-03.htm">Ask how to use the weapon.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32500-03.htm">Ask how to use the weapon.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-03.htm

@@ -3,5 +3,5 @@ First, of course, you must be able to enter the temple itself.<br>
 We can magically protect ourselves, but others...<br>
 Wait -- you really believe you can do this, don't you? Perhaps you're right! I don't know how, but your aura seems immune to the chaos that has infected this place. It's even better than our magic!<br>
 Who are you, adventurer?<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32500-04.htm">Explain how you got here.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32500-04.htm">Explain how you got here.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-04.htm

@@ -3,5 +3,5 @@ If what you say is true, then you really did come here from another dimension!<b
 There has been much speculation about other dimensions at our Ivory Tower, but it seems your Ivory Tower is even more advanced... <br>
 If the cause of our troubles lies in the fissure of power in this dimension, you should be able to return to your dimension by stabilizing that fissure. What I mean is that if you can restore the balance of the Sprites' power here, you will be able to return to your world.<br>
 In any case, as an otherworlder you will surely be less affected by their power than we are. I place this task on your shoulders, my friend.<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32500-05.htm">Accept</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32500-05.htm">Accept</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-05.htm

@@ -2,5 +2,5 @@
 Please defeat those chaotic Sprites in the temple and restore stability.<br>
 You may use this Sprite's Sword, forged with both the power of water and fire. I know you will use it well.<br>
 Also, take this book written by the Elves who built this place -- it will tell you if something is wrong with the temple. When you enter the temple, follow the book's instructions.<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32500-06.htm">Accept the sword and the book.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32500-06.htm">Accept the sword and the book.</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32500-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32500-06.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-01.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-02.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-03.htm

@@ -3,5 +3,5 @@ The Sprite's Sword... Under normal circumstances, that sword can stabilize the p
 However, combined with the Essence of Water you have, we may have a chance. According to legend, when the sword can't stabilize the temple itself, the temple will actually find a way to strengthen the sword. I suppose the legend must be true!<br>
 Will you use the Essence of Water to strengthen the sword?<br>
 <br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32507-04.htm">Strengthen the sword.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32507-04.htm">Strengthen the sword.</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-04.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-05.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-06.htm

@@ -2,5 +2,5 @@
 Hmm, the chaos seems more serious that I first thought.<br>
 Fire magic in particular seems an issue...<br>
 Tell me, has your weapon already absorbed the Essence of Water? Ah, then it's simple! We have never before tried to combine the Essences of Water and Fire at this level, but it should be possible...at least in theory. Now, give me your sword and the Essence of Fire.<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32507-07.htm">Hand over the sword and the Essence of Fire.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32507-07.htm">Hand over the sword and the Essence of Fire.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-07.htm

@@ -1,5 +1,5 @@
 <html><body>Temple Inspector:<br>
 Permissum incendia successio!<br>
 May even greater power descend on this sword!<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32507-08.htm">Watch</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32507-08.htm">Watch</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-08.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-08.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32507-09.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32507-09.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32510-00.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-00.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32510-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-01.htm

@@ -2,5 +2,5 @@
 The Spirite's power is flowing smoothly. You have certainly justfield my trust in you!<br>
 Thanks to you, we are rapidy restoring stability. Of course, that means the dimensional portal that connects your world to ours is also quickly closing.<br>
 Hurry and take my hand! That sword belongs to this dimension, so you'd best leave it behind. Ah, I can see you'd rather keep it -- but such a powerful item may desrupt travel between dimensions!<br>
-<a action="bypass -h Quest 128_PailakaSongOfIceAndFire 32510-02.htm">Take his hand.</a>
+<a action="bypass -h Quest Q00128_PailakaSongOfIceAndFire 32510-02.htm">Take his hand.</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/128_PailakaSongOfIceAndFire/32510-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/32510-02.htm


+ 377 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java

@@ -0,0 +1,377 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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 quests.Q00128_PailakaSongOfIceAndFire;
+
+import com.l2jserver.gameserver.enums.QuestSound;
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.Instance;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * Pailaka - Song of Ice and Fire (128)
+ * @author Gnacik, St3eT
+ */
+public final class Q00128_PailakaSongOfIceAndFire extends Quest
+{
+	// NPCs
+	private static final int ADLER1 = 32497;
+	private static final int ADLER2 = 32510;
+	private static final int SINAI = 32500;
+	private static final int INSPECTOR = 32507;
+	private static final int HILLAS = 18610;
+	private static final int PAPION = 18609;
+	private static final int KINSUS = 18608;
+	private static final int GARGOS = 18607;
+	private static final int ADIANTUM = 18620;
+	// Items
+	private static final int SWORD = 13034;
+	private static final int ENH_SWORD1 = 13035;
+	private static final int ENH_SWORD2 = 13036;
+	private static final int BOOK1 = 13130;
+	private static final int BOOK2 = 13131;
+	private static final int BOOK3 = 13132;
+	private static final int BOOK4 = 13133;
+	private static final int BOOK5 = 13134;
+	private static final int BOOK6 = 13135;
+	private static final int BOOK7 = 13136;
+	private static final int WATER_ESSENCE = 13038;
+	private static final int FIRE_ESSENCE = 13039;
+	private static final int SHIELD_POTION = 13032;
+	private static final int HEAL_POTION = 13033;
+	private static final int FIRE_ENHANCER = 13040;
+	private static final int WATER_ENHANCER = 13041;
+	private static final int[] REWARDS =
+	{
+		13294, // Pailaka Ring
+		13293, // Pailaka Earring
+		736, // Scroll of Escape
+	};
+	// Skills
+	private static SkillHolder VITALITY_REPLENISHING = new SkillHolder(5774, 1);
+	// Misc
+	private static final int MIN_LEVEL = 36;
+	private static final int MAX_LEVEL = 42;
+	private static final int EXIT_TIME = 5;
+	
+	public Q00128_PailakaSongOfIceAndFire()
+	{
+		super(128, Q00128_PailakaSongOfIceAndFire.class.getSimpleName(), "Pailaka - Song of Ice and Fire");
+		addStartNpc(ADLER1);
+		addTalkId(ADLER1, ADLER2, SINAI, INSPECTOR);
+		addKillId(HILLAS, PAPION, KINSUS, GARGOS, ADIANTUM);
+		registerQuestItems(SWORD, ENH_SWORD1, ENH_SWORD2, BOOK1, BOOK2, BOOK3, BOOK4, BOOK5, BOOK6, BOOK7, WATER_ESSENCE, FIRE_ESSENCE, SHIELD_POTION, HEAL_POTION, FIRE_ENHANCER, WATER_ENHANCER);
+	}
+	
+	@Override
+	public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		final QuestState st = player.getQuestState(getName());
+		if (st == null)
+		{
+			return getNoQuestMsg(player);
+		}
+		
+		switch (event)
+		{
+			case "32500-02.htm":
+			case "32500-03.htm":
+			case "32500-04.htm":
+			case "32500-05.htm":
+			case "32497-02.htm":
+			case "32507-07.htm":
+			case "32497-04.htm":
+			{
+				htmltext = event;
+			}
+			case "32497-03.htm":
+			{
+				if (!st.isStarted())
+				{
+					st.startQuest();
+					htmltext = event;
+				}
+				break;
+			}
+			case "32500-06.htm":
+			{
+				if (st.isCond(1))
+				{
+					st.setCond(2, true);
+					giveItems(player, SWORD, 1);
+					giveItems(player, BOOK1, 1);
+					htmltext = event;
+				}
+				break;
+			}
+			case "32507-04.htm":
+			{
+				if (st.isCond(3))
+				{
+					st.setCond(4, true);
+					takeItems(player, SWORD, -1);
+					takeItems(player, WATER_ESSENCE, -1);
+					takeItems(player, BOOK2, -1);
+					giveItems(player, BOOK3, 1);
+					giveItems(player, ENH_SWORD1, 1);
+					htmltext = event;
+				}
+				break;
+			}
+			case "32507-08.htm":
+			{
+				if (st.isCond(6))
+				{
+					st.setCond(7, true);
+					takeItems(player, ENH_SWORD1, -1);
+					takeItems(player, BOOK5, -1);
+					takeItems(player, FIRE_ESSENCE, -1);
+					giveItems(player, ENH_SWORD2, 1);
+					giveItems(player, BOOK6, 1);
+					htmltext = event;
+				}
+				break;
+			}
+			case "32510-02.htm":
+			{
+				st.exitQuest(false, true);
+				
+				Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId());
+				inst.setDuration(EXIT_TIME * 60000);
+				inst.setEmptyDestroyTime(0);
+				
+				if (inst.containsPlayer(player.getObjectId()))
+				{
+					npc.setTarget(player);
+					npc.doCast(VITALITY_REPLENISHING.getSkill());
+					addExpAndSp(player, 810000, 50000);
+					for (int id : REWARDS)
+					{
+						giveItems(player, id, 1);
+					}
+				}
+				htmltext = event;
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public final String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		final QuestState st = player.getQuestState(getName());
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (npc.getId())
+		{
+			case ADLER1:
+			{
+				switch (st.getState())
+				{
+					case State.CREATED:
+					{
+						if (player.getLevel() < MIN_LEVEL)
+						{
+							htmltext = "32497-05.htm";
+						}
+						else if (player.getLevel() > MAX_LEVEL)
+						{
+							htmltext = "32497-06.htm";
+						}
+						else
+						{
+							htmltext = "32497-01.htm";
+						}
+						break;
+					}
+					case State.STARTED:
+					{
+						if (st.getCond() > 1)
+						{
+							htmltext = "32497-00.htm";
+						}
+						else
+						{
+							htmltext = "32497-03.htm";
+						}
+						break;
+					}
+					case State.COMPLETED:
+					{
+						htmltext = "32497-07.htm";
+						break;
+					}
+					default:
+					{
+						htmltext = "32497-01.htm";
+						break;
+					}
+				}
+				break;
+			}
+			case SINAI:
+			{
+				if (st.getCond() > 1)
+				{
+					htmltext = "32500-00.htm";
+				}
+				else
+				{
+					htmltext = "32500-01.htm";
+				}
+				break;
+			}
+			case INSPECTOR:
+			{
+				switch (st.getCond())
+				{
+					case 1:
+					{
+						htmltext = "32507-01.htm";
+						break;
+					}
+					case 2:
+					{
+						htmltext = "32507-02.htm";
+						break;
+					}
+					case 3:
+					{
+						htmltext = "32507-03.htm";
+						break;
+					}
+					case 4:
+					case 5:
+					{
+						htmltext = "32507-05.htm";
+						break;
+					}
+					case 6:
+					{
+						htmltext = "32507-06.htm";
+						break;
+					}
+					default:
+					{
+						htmltext = "32507-09.htm";
+						break;
+					}
+				}
+				break;
+			}
+			case ADLER2:
+			{
+				if (st.isCompleted())
+				{
+					htmltext = "32510-00.htm";
+				}
+				else if (st.isCond(9))
+				{
+					htmltext = "32510-01.htm";
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+	{
+		final QuestState st = player.getQuestState(getName());
+		if ((st != null) && st.isStarted())
+		{
+			switch (npc.getId())
+			{
+				case HILLAS:
+				{
+					if (st.isCond(2))
+					{
+						st.setCond(3);
+						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
+						takeItems(player, BOOK1, -1);
+						giveItems(player, BOOK2, 1);
+						giveItems(player, WATER_ESSENCE, 1);
+					}
+					addSpawn(PAPION, -53903, 181484, -4555, 30456, false, 0, false, npc.getInstanceId());
+					break;
+				}
+				case PAPION:
+				{
+					if (st.isCond(4))
+					{
+						st.setCond(5);
+						takeItems(player, BOOK3, -1);
+						giveItems(player, BOOK4, 1);
+						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
+					}
+					addSpawn(KINSUS, -61415, 181418, -4818, 63852, false, 0, false, npc.getInstanceId());
+					break;
+				}
+				case KINSUS:
+				{
+					if (st.isCond(5))
+					{
+						st.setCond(6);
+						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
+						takeItems(player, BOOK4, -1);
+						giveItems(player, BOOK5, 1);
+						giveItems(player, FIRE_ESSENCE, 1);
+					}
+					addSpawn(GARGOS, -61354, 183624, -4821, 63613, false, 0, false, npc.getInstanceId());
+					break;
+				}
+				case GARGOS:
+				{
+					if (st.isCond(7))
+					{
+						st.setCond(8);
+						playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
+						takeItems(player, BOOK6, -1);
+						giveItems(player, BOOK7, 1);
+					}
+					addSpawn(ADIANTUM, -53297, 185027, -4617, 1512, false, 0, false, npc.getInstanceId());
+					break;
+				}
+				case ADIANTUM:
+				{
+					if (st.isCond(8))
+					{
+						st.setCond(9);
+						playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
+						takeItems(player, BOOK7, -1);
+						addSpawn(ADLER2, -53297, 185027, -4617, 33486, false, 0, false, npc.getInstanceId());
+					}
+					break;
+				}
+			}
+		}
+		return super.onKill(npc, player, isSummon);
+	}
+}

+ 2 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/QuestMasterHandler.java

@@ -92,6 +92,7 @@ import quests.Q00122_OminousNews.Q00122_OminousNews;
 import quests.Q00124_MeetingTheElroki.Q00124_MeetingTheElroki;
 import quests.Q00125_TheNameOfEvil1.Q00125_TheNameOfEvil1;
 import quests.Q00126_TheNameOfEvil2.Q00126_TheNameOfEvil2;
+import quests.Q00128_PailakaSongOfIceAndFire.Q00128_PailakaSongOfIceAndFire;
 import quests.Q00129_PailakaDevilsLegacy.Q00129_PailakaDevilsLegacy;
 import quests.Q00131_BirdInACage.Q00131_BirdInACage;
 import quests.Q00132_MatrasCuriosity.Q00132_MatrasCuriosity;
@@ -456,6 +457,7 @@ public class QuestMasterHandler
 		Q00124_MeetingTheElroki.class,
 		Q00125_TheNameOfEvil1.class,
 		Q00126_TheNameOfEvil2.class,
+		Q00128_PailakaSongOfIceAndFire.class,
 		Q00129_PailakaDevilsLegacy.class,
 		Q00131_BirdInACage.class,
 		Q00132_MatrasCuriosity.class,

+ 1 - 0
L2J_DataPack_BETA/dist/sql/game/updates/20140618update.sql

@@ -0,0 +1 @@
+UPDATE character_quests SET name='Q00128_PailakaSongOfIceAndFire' WHERE name='128_PailakaSongOfIceAndFire';