Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@@ -1,122 +1,122 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.CharacterBirthday;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.util.Util;
/**
* Character Birthday event AI.<br>
* Updated to H5 by Nyaran.
* @author Gnacik
*/
final class CharacterBirthday extends Quest
{
private static final int ALEGRIA = 32600;
private static int SPAWNS = 0;
private static final int[] GK =
{
30006,
30059,
30080,
30134,
30146,
30177,
30233,
30256,
30320,
30540,
30576,
30836,
30848,
30878,
30899,
31275,
31320,
31964,
32163
};
private CharacterBirthday()
{
super(-1, CharacterBirthday.class.getSimpleName(), "events");
addStartNpc(ALEGRIA);
addStartNpc(GK);
addTalkId(ALEGRIA);
addTalkId(GK);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
if (event.equalsIgnoreCase("despawn_npc"))
{
npc.doDie(player);
SPAWNS--;
htmltext = null;
}
else if (event.equalsIgnoreCase("change"))
{
// Change Hat
if (hasQuestItems(player, 10250))
{
takeItems(player, 10250, 1); // Adventurer Hat (Event)
giveItems(player, 21594, 1); // Birthday Hat
htmltext = null; // FIXME: Probably has html
// Despawn npc
npc.doDie(player);
SPAWNS--;
}
else
{
htmltext = "32600-nohat.htm";
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
if (SPAWNS >= 3)
{
return "busy.htm";
}
if (!Util.checkIfInRange(10, npc, player, true))
{
final L2Npc spawned = addSpawn(32600, player.getX() + 10, player.getY() + 10, player.getZ() + 10, 0, false, 0, true);
startQuestTimer("despawn_npc", 180000, spawned, player);
SPAWNS++;
}
else
{
return "tooclose.htm";
}
return null;
}
public static void main(String[] args)
{
new CharacterBirthday();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.CharacterBirthday;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Character Birthday event AI.<br>
* Updated to H5 by Nyaran.
* @author Gnacik
*/
public final class CharacterBirthday extends AbstractNpcAI
{
private static final int ALEGRIA = 32600;
private static int SPAWNS = 0;
private final static int[] GK =
{
30006,
30059,
30080,
30134,
30146,
30177,
30233,
30256,
30320,
30540,
30576,
30836,
30848,
30878,
30899,
31275,
31320,
31964,
32163
};
private CharacterBirthday()
{
addStartNpc(ALEGRIA);
addStartNpc(GK);
addTalkId(ALEGRIA);
addTalkId(GK);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
if (event.equalsIgnoreCase("despawn_npc"))
{
npc.doDie(player);
SPAWNS--;
htmltext = null;
}
else if (event.equalsIgnoreCase("change"))
{
// Change Hat
if (hasQuestItems(player, 10250))
{
takeItems(player, 10250, 1); // Adventurer Hat (Event)
giveItems(player, 21594, 1); // Birthday Hat
htmltext = null; // FIXME: Probably has html
// Despawn npc
npc.doDie(player);
SPAWNS--;
}
else
{
htmltext = "32600-nohat.htm";
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
if (SPAWNS >= 3)
{
return "busy.htm";
}
if (!Util.checkIfInRange(10, npc, player, true))
{
final L2Npc spawned = addSpawn(32600, player.getX() + 10, player.getY() + 10, player.getZ() + 10, 0, false, 0, true);
startQuestTimer("despawn_npc", 180000, spawned, player);
SPAWNS++;
}
else
{
return "tooclose.htm";
}
return null;
}
public static void main(String[] args)
{
new CharacterBirthday();
}
}

View File

@@ -20,7 +20,7 @@ import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
import com.l2jmobius.gameserver.network.serverpackets.luckygame.ExStartLuckyGame;
@@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.util.Broadcast;
* Info - http://www.lineage2.com/en/news/events/11182015-eve-the-fortune-teller-returns.php
* @author Mobius
*/
final class EveTheFortuneTeller extends LongTimeEvent
public final class EveTheFortuneTeller extends LongTimeEvent
{
// NPCs
private static final int EVE = 8542;
@@ -47,7 +47,6 @@ final class EveTheFortuneTeller extends LongTimeEvent
private EveTheFortuneTeller()
{
super(EveTheFortuneTeller.class.getSimpleName(), "events");
addStartNpc(EVE);
addFirstTalkId(EVE);
addTalkId(EVE);
@@ -72,12 +71,12 @@ final class EveTheFortuneTeller extends LongTimeEvent
}
case "FortuneReadingGame":
{
player.sendPacket(new ExStartLuckyGame(1));
player.sendPacket(new ExStartLuckyGame(player, 1));
break;
}
case "LuxuryFortuneReadingGame":
{
player.sendPacket(new ExStartLuckyGame(2));
player.sendPacket(new ExStartLuckyGame(player, 2));
break;
}
case "JAYCE_SHOUT":

View File

@@ -1,152 +1,154 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.FreyaCelebration;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.util.Util;
/**
* Freya Celebration event AI.
* @author Gnacik
*/
final class FreyaCelebration extends LongTimeEvent
{
// NPC
private static final int FREYA = 13296;
// Items
private static final int FREYA_POTION = 15440;
private static final int FREYA_GIFT = 17138;
// Misc
private static final int HOURS = 20;
private static final int[] SKILLS =
{
9150,
9151,
9152,
9153,
9154,
9155,
9156
};
private static final NpcStringId[] FREYA_TEXT =
{
NpcStringId.EVEN_THOUGH_YOU_BRING_SOMETHING_CALLED_A_GIFT_AMONG_YOUR_HUMANS_IT_WOULD_JUST_BE_PROBLEMATIC_FOR_ME,
NpcStringId.I_JUST_DON_T_KNOW_WHAT_EXPRESSION_I_SHOULD_HAVE_IT_APPEARED_ON_ME_ARE_HUMAN_S_EMOTIONS_LIKE_THIS_FEELING,
NpcStringId.THE_FEELING_OF_THANKS_IS_JUST_TOO_MUCH_DISTANT_MEMORY_FOR_ME,
NpcStringId.BUT_I_KIND_OF_MISS_IT_LIKE_I_HAD_FELT_THIS_FEELING_BEFORE,
NpcStringId.I_AM_ICE_QUEEN_FREYA_THIS_FEELING_AND_EMOTION_ARE_NOTHING_BUT_A_PART_OF_MALISS_A_MEMORIES
};
private FreyaCelebration()
{
super(FreyaCelebration.class.getSimpleName(), "events");
addStartNpc(FREYA);
addFirstTalkId(FREYA);
addTalkId(FREYA);
addSkillSeeId(FREYA);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("give_potion"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
final String value = loadGlobalQuestVar(player.getAccountName());
final long _reuse_time = value.equals("") ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
}
else
{
final long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addItemName(FREYA_POTION);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
}
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
sm.addItemName(Inventory.ADENA_ID);
sm.addInt(1);
player.sendPacket(sm);
}
}
return null;
}
@Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
{
if ((caster == null) || (npc == null))
{
return null;
}
if ((npc.getId() == FREYA) && Util.contains(targets, npc) && Util.contains(SKILLS, skill.getId()))
{
if (getRandom(100) < 5)
{
final CreatureSay cs = new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), NpcStringId.DEAR_S1_THINK_OF_THIS_AS_MY_APPRECIATION_FOR_THE_GIFT_TAKE_THIS_WITH_YOU_THERE_S_NOTHING_STRANGE_ABOUT_IT_IT_S_JUST_A_BIT_OF_MY_CAPRICIOUSNESS);
cs.addStringParameter(caster.getName());
npc.broadcastPacket(cs);
caster.addItem("FreyaCelebration", FREYA_GIFT, 1, npc, true);
}
else if (getRandom(10) < 2)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
}
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "13296.htm";
}
public static void main(String[] args)
{
new FreyaCelebration();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.FreyaCelebration;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Freya Celebration event AI.
* @author Gnacik
*/
public final class FreyaCelebration extends LongTimeEvent
{
// NPC
private static final int FREYA = 13296;
// Items
private static final int FREYA_POTION = 15440;
private static final int FREYA_GIFT = 17138;
// Misc
private static final int HOURS = 20;
private static final int[] SKILLS =
{
9150,
9151,
9152,
9153,
9154,
9155,
9156
};
private static final NpcStringId[] FREYA_TEXT =
{
NpcStringId.EVEN_THOUGH_YOU_BRING_SOMETHING_CALLED_A_GIFT_AMONG_YOUR_HUMANS_IT_WOULD_JUST_BE_PROBLEMATIC_FOR_ME,
NpcStringId.I_JUST_DON_T_KNOW_WHAT_EXPRESSION_I_SHOULD_HAVE_IT_APPEARED_ON_ME_ARE_HUMAN_S_EMOTIONS_LIKE_THIS_FEELING,
NpcStringId.THE_FEELING_OF_THANKS_IS_JUST_TOO_MUCH_DISTANT_MEMORY_FOR_ME,
NpcStringId.BUT_I_KIND_OF_MISS_IT_LIKE_I_HAD_FELT_THIS_FEELING_BEFORE,
NpcStringId.I_AM_ICE_QUEEN_FREYA_THIS_FEELING_AND_EMOTION_ARE_NOTHING_BUT_A_PART_OF_MALISS_A_MEMORIES
};
private FreyaCelebration()
{
addStartNpc(FREYA);
addFirstTalkId(FREYA);
addTalkId(FREYA);
addSkillSeeId(FREYA);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("give_potion"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
final String value = loadGlobalQuestVar(player.getAccountName());
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
}
else
{
final long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addItemName(FREYA_POTION);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
}
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
sm.addItemName(Inventory.ADENA_ID);
sm.addInt(1);
player.sendPacket(sm);
}
}
return null;
}
@Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
{
if ((caster == null) || (npc == null))
{
return null;
}
if ((npc.getId() == FREYA) && CommonUtil.contains(targets, npc) && CommonUtil.contains(SKILLS, skill.getId()))
{
if (getRandom(100) < 5)
{
final CreatureSay cs = new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), NpcStringId.DEAR_S1_THINK_OF_THIS_AS_MY_APPRECIATION_FOR_THE_GIFT_TAKE_THIS_WITH_YOU_THERE_S_NOTHING_STRANGE_ABOUT_IT_IT_S_JUST_A_BIT_OF_MY_CAPRICIOUSNESS);
cs.addStringParameter(caster.getName());
npc.broadcastPacket(cs);
caster.addItem("FreyaCelebration", FREYA_GIFT, 1, npc, true);
}
else
{
if (getRandom(10) < 2)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
}
}
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "13296.htm";
}
public static void main(String[] args)
{
new FreyaCelebration();
}
}

View File

@@ -1,174 +1,174 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.GiftOfVitality;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Gift of Vitality event AI.
* @author Gnacik, Adry_85
*/
final class GiftOfVitality extends LongTimeEvent
{
// NPC
private static final int STEVE_SHYAGEL = 4306;
// Skills
private static final SkillHolder GIFT_OF_VITALITY = new SkillHolder(23179, 1);
private static final SkillHolder JOY_OF_VITALITY = new SkillHolder(23180, 1);
private static SkillHolder[] FIGHTER_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5629, 1), // Bless the Body
new SkillHolder(5630, 1), // Vampiric Rage
new SkillHolder(5631, 1), // Regeneration
new SkillHolder(5632, 1), // Haste
};
private static SkillHolder[] MAGE_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5633, 1), // Bless the Soul
new SkillHolder(5634, 1), // Acumen
new SkillHolder(5635, 1), // Concentration
new SkillHolder(5636, 1), // Empower
};
private static SkillHolder[] SERVITOR_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5629, 1), // Bless the Body
new SkillHolder(5633, 1), // Bless the Soul
new SkillHolder(5630, 1), // Vampiric Rage
new SkillHolder(5634, 1), // Acumen
new SkillHolder(5631, 1), // Regeneration
new SkillHolder(5635, 1), // Concentration
new SkillHolder(5632, 1), // Haste
new SkillHolder(5636, 1), // Empower
};
// Misc
private static final int HOURS = 5; // Reuse between buffs
private static final int MIN_LEVEL = 75;
private static final String REUSE = GiftOfVitality.class.getSimpleName() + "_reuse";
private GiftOfVitality()
{
super(GiftOfVitality.class.getSimpleName(), "events");
addStartNpc(STEVE_SHYAGEL);
addFirstTalkId(STEVE_SHYAGEL);
addTalkId(STEVE_SHYAGEL);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
switch (event)
{
case "vitality":
{
final long reuse = player.getVariables().getLong(REUSE, 0);
if (reuse > System.currentTimeMillis())
{
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addSkillName(23179);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "4306-notime.htm";
}
else
{
player.doCast(GIFT_OF_VITALITY.getSkill());
player.doSimultaneousCast(JOY_OF_VITALITY.getSkill());
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
htmltext = "4306-okvitality.htm";
}
break;
}
case "memories_player":
{
if (player.getLevel() <= MIN_LEVEL)
{
htmltext = "4306-nolevel.htm";
}
else
{
final SkillHolder[] skills = player.isMageClass() ? MAGE_SKILLS : FIGHTER_SKILLS;
npc.setTarget(player);
for (SkillHolder sk : skills)
{
npc.doCast(sk.getSkill());
}
htmltext = "4306-okbuff.htm";
}
break;
}
case "memories_summon":
{
if (player.getLevel() <= MIN_LEVEL)
{
htmltext = "4306-nolevel.htm";
}
else if (!player.hasServitors())
{
htmltext = "4306-nosummon.htm";
}
else
{
player.getServitors().values().forEach(s ->
{
npc.setTarget(s);
for (SkillHolder sk : SERVITOR_SKILLS)
{
npc.doCast(sk.getSkill());
}
});
htmltext = "4306-okbuff.htm";
}
break;
}
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "4306.htm";
}
public static void main(String[] args)
{
new GiftOfVitality();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.GiftOfVitality;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Gift of Vitality event AI.
* @author Gnacik, Adry_85
*/
public final class GiftOfVitality extends LongTimeEvent
{
// NPC
private static final int STEVE_SHYAGEL = 4306;
// Skills
private static final SkillHolder GIFT_OF_VITALITY = new SkillHolder(23179, 1);
private static final SkillHolder JOY_OF_VITALITY = new SkillHolder(23180, 1);
private static SkillHolder[] FIGHTER_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5629, 1), // Bless the Body
new SkillHolder(5630, 1), // Vampiric Rage
new SkillHolder(5631, 1), // Regeneration
new SkillHolder(5632, 1), // Haste
};
private static SkillHolder[] MAGE_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5633, 1), // Bless the Soul
new SkillHolder(5634, 1), // Acumen
new SkillHolder(5635, 1), // Concentration
new SkillHolder(5636, 1), // Empower
};
private static SkillHolder[] SERVITOR_SKILLS =
{
new SkillHolder(5627, 1), // Wind Walk
new SkillHolder(5628, 1), // Shield
new SkillHolder(5637, 1), // Magic Barrier
new SkillHolder(5629, 1), // Bless the Body
new SkillHolder(5633, 1), // Bless the Soul
new SkillHolder(5630, 1), // Vampiric Rage
new SkillHolder(5634, 1), // Acumen
new SkillHolder(5631, 1), // Regeneration
new SkillHolder(5635, 1), // Concentration
new SkillHolder(5632, 1), // Haste
new SkillHolder(5636, 1), // Empower
};
// Misc
private static final int HOURS = 5; // Reuse between buffs
private static final int MIN_LEVEL = 75;
private static final String REUSE = GiftOfVitality.class.getSimpleName() + "_reuse";
private GiftOfVitality()
{
addStartNpc(STEVE_SHYAGEL);
addFirstTalkId(STEVE_SHYAGEL);
addTalkId(STEVE_SHYAGEL);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
switch (event)
{
case "vitality":
{
final long reuse = player.getVariables().getLong(REUSE, 0);
if (reuse > System.currentTimeMillis())
{
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addSkillName(23179);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "4306-notime.htm";
}
else
{
SkillCaster.triggerCast(player, player, GIFT_OF_VITALITY.getSkill());
SkillCaster.triggerCast(player, player, JOY_OF_VITALITY.getSkill());
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
htmltext = "4306-okvitality.htm";
}
break;
}
case "memories_player":
{
if (player.getLevel() <= MIN_LEVEL)
{
htmltext = "4306-nolevel.htm";
}
else
{
final SkillHolder[] skills = (player.isMageClass()) ? MAGE_SKILLS : FIGHTER_SKILLS;
npc.setTarget(player);
for (SkillHolder sk : skills)
{
npc.doCast(sk.getSkill());
}
htmltext = "4306-okbuff.htm";
}
break;
}
case "memories_summon":
{
if (player.getLevel() <= MIN_LEVEL)
{
htmltext = "4306-nolevel.htm";
}
else if (!player.hasServitors())
{
htmltext = "4306-nosummon.htm";
}
else
{
player.getServitors().values().forEach(s ->
{
npc.setTarget(s);
for (SkillHolder sk : SERVITOR_SKILLS)
{
npc.doCast(sk.getSkill());
}
});
htmltext = "4306-okbuff.htm";
}
break;
}
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "4306.htm";
}
public static void main(String[] args)
{
new GiftOfVitality();
}
}

View File

@@ -1,142 +1,141 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.HeavyMedal;
import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
/**
* Heavy Medals event AI.
* @author Gnacik
*/
final class HeavyMedal extends LongTimeEvent
{
private static final int CAT_ROY = 31228;
private static final int CAT_WINNIE = 31229;
private static final int GLITTERING_MEDAL = 6393;
private static final int WIN_CHANCE = 50;
private static final int[] MEDALS =
{
5,
10,
20,
40
};
private static final int[] BADGES =
{
6399,
6400,
6401,
6402
};
private HeavyMedal()
{
super(HeavyMedal.class.getSimpleName(), "events");
addStartNpc(CAT_ROY);
addStartNpc(CAT_WINNIE);
addTalkId(CAT_ROY);
addTalkId(CAT_WINNIE);
addFirstTalkId(CAT_ROY);
addFirstTalkId(CAT_WINNIE);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
int level = checkLevel(player);
if (event.equalsIgnoreCase("game"))
{
htmltext = getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level] ? "31229-no.htm" : "31229-game.htm";
}
else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails"))
{
if (getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level])
{
htmltext = "31229-" + event.toLowerCase() + "-10.htm";
}
else
{
takeItems(player, GLITTERING_MEDAL, MEDALS[level]);
if (getRandom(100) > WIN_CHANCE)
{
level = 0;
}
else
{
if (level > 0)
{
takeItems(player, BADGES[level - 1], -1);
}
giveItems(player, BADGES[level], 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
level++;
}
htmltext = "31229-" + event.toLowerCase() + "-" + String.valueOf(level) + ".htm";
}
}
else if (event.equalsIgnoreCase("talk"))
{
htmltext = String.valueOf(npc.getId()) + "-lvl-" + String.valueOf(level) + ".htm";
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (player.getQuestState(getName()) == null)
{
newQuestState(player);
}
return npc.getId() + ".htm";
}
public int checkLevel(L2PcInstance player)
{
int _lev = 0;
if (hasQuestItems(player, 6402))
{
_lev = 4;
}
else if (hasQuestItems(player, 6401))
{
_lev = 3;
}
else if (hasQuestItems(player, 6400))
{
_lev = 2;
}
else if (hasQuestItems(player, 6399))
{
_lev = 1;
}
return _lev;
}
public static void main(String[] args)
{
new HeavyMedal();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.HeavyMedal;
import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* Heavy Medals event AI.
* @author Gnacik
*/
public final class HeavyMedal extends LongTimeEvent
{
private final static int CAT_ROY = 31228;
private final static int CAT_WINNIE = 31229;
private final static int GLITTERING_MEDAL = 6393;
private final static int WIN_CHANCE = 50;
private final static int[] MEDALS =
{
5,
10,
20,
40
};
private final static int[] BADGES =
{
6399,
6400,
6401,
6402
};
private HeavyMedal()
{
addStartNpc(CAT_ROY);
addStartNpc(CAT_WINNIE);
addTalkId(CAT_ROY);
addTalkId(CAT_WINNIE);
addFirstTalkId(CAT_ROY);
addFirstTalkId(CAT_WINNIE);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
int level = checkLevel(player);
if (event.equalsIgnoreCase("game"))
{
htmltext = getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level] ? "31229-no.htm" : "31229-game.htm";
}
else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails"))
{
if (getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level])
{
htmltext = "31229-" + event.toLowerCase() + "-10.htm";
}
else
{
takeItems(player, GLITTERING_MEDAL, MEDALS[level]);
if (getRandom(100) > WIN_CHANCE)
{
level = 0;
}
else
{
if (level > 0)
{
takeItems(player, BADGES[level - 1], -1);
}
giveItems(player, BADGES[level], 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
level++;
}
htmltext = "31229-" + event.toLowerCase() + "-" + String.valueOf(level) + ".htm";
}
}
else if (event.equalsIgnoreCase("talk"))
{
htmltext = String.valueOf(npc.getId()) + "-lvl-" + String.valueOf(level) + ".htm";
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (player.getQuestState(getName()) == null)
{
newQuestState(player);
}
return npc.getId() + ".htm";
}
public int checkLevel(L2PcInstance player)
{
int _lev = 0;
if (hasQuestItems(player, 6402))
{
_lev = 4;
}
else if (hasQuestItems(player, 6401))
{
_lev = 3;
}
else if (hasQuestItems(player, 6400))
{
_lev = 2;
}
else if (hasQuestItems(player, 6399))
{
_lev = 1;
}
return _lev;
}
public static void main(String[] args)
{
new HeavyMedal();
}
}

View File

@@ -18,8 +18,8 @@ package events.HuntForSanta;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
@@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.util.Util;
* Info - http://www.lineage2.com/en/news/events/hunt-for-santa.php
* @author Mobius
*/
final class HuntForSanta extends LongTimeEvent
public final class HuntForSanta extends LongTimeEvent
{
// NPC
private static final int NOELLE = 34008;
@@ -41,7 +41,6 @@ final class HuntForSanta extends LongTimeEvent
private HuntForSanta()
{
super(HuntForSanta.class.getSimpleName(), "events");
addStartNpc(NOELLE);
addFirstTalkId(NOELLE);
addTalkId(NOELLE);
@@ -134,15 +133,15 @@ final class HuntForSanta extends LongTimeEvent
final BuffInfo buffSnowman = player.getEffectList().getBuffInfoBySkillId(BUFF_SNOWMAN.getSkillId());
if (buffStocking != null)
{
player.getEffectList().remove(true, buffStocking);
player.getEffectList().remove(true, buffStocking, null);
}
if (buffTree != null)
{
player.getEffectList().remove(true, buffTree);
player.getEffectList().remove(true, buffTree, null);
}
if (buffSnowman != null)
{
player.getEffectList().remove(true, buffSnowman);
player.getEffectList().remove(true, buffSnowman, null);
}
}

View File

@@ -18,14 +18,14 @@ package events.LetterCollector;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* Event: Letter Collector
* @URL http://www.lineage2.com/en/news/events/letter-collector-event-05112016.php
* @author Gigi
*/
final class LetterCollector extends LongTimeEvent
public final class LetterCollector extends LongTimeEvent
{
// NPC
private static final int ANGEL_CAT = 33873;
@@ -115,7 +115,6 @@ final class LetterCollector extends LongTimeEvent
private LetterCollector()
{
super(LetterCollector.class.getSimpleName(), "events");
addStartNpc(ANGEL_CAT);
addFirstTalkId(ANGEL_CAT);
addTalkId(ANGEL_CAT);

View File

@@ -1,105 +1,107 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.LoveYourGatekeeper;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Love Your Gatekeeper event.
* @author Gladicek
*/
final class LoveYourGatekeeper extends LongTimeEvent
{
// NPC
private static final int GATEKEEPER = 32477;
// Item
private static final int GATEKEEPER_TRANSFORMATION_STICK = 12814;
// Skills
private static SkillHolder TELEPORTER_TRANSFORM = new SkillHolder(5655, 1);
// Misc
private static final int HOURS = 24;
private static final int PRICE = 10000;
private static final String REUSE = LoveYourGatekeeper.class.getSimpleName() + "_reuse";
private LoveYourGatekeeper()
{
super(LoveYourGatekeeper.class.getSimpleName(), "events");
addStartNpc(GATEKEEPER);
addFirstTalkId(GATEKEEPER);
addTalkId(GATEKEEPER);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "transform_stick":
{
if (player.getAdena() < PRICE)
{
return "32477-3.htm";
}
final long reuse = player.getVariables().getLong(REUSE, 0);
if (reuse > System.currentTimeMillis())
{
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addItemName(GATEKEEPER_TRANSFORMATION_STICK);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
}
else
{
takeItems(player, Inventory.ADENA_ID, PRICE);
giveItems(player, GATEKEEPER_TRANSFORMATION_STICK, 1);
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
}
return null;
}
case "transform":
{
if (!player.isTransformed())
{
player.doCast(TELEPORTER_TRANSFORM.getSkill());
}
return null;
}
}
return event;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "32477.htm";
}
public static void main(String[] args)
{
new LoveYourGatekeeper();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.LoveYourGatekeeper;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Love Your Gatekeeper event.
* @author Gladicek
*/
public final class LoveYourGatekeeper extends LongTimeEvent
{
// NPC
private static final int GATEKEEPER = 32477;
// Item
private static final int GATEKEEPER_TRANSFORMATION_STICK = 12814;
// Skills
private static SkillHolder TELEPORTER_TRANSFORM = new SkillHolder(5655, 1);
// Misc
private static final int HOURS = 24;
private static final int PRICE = 10000;
private static final String REUSE = LoveYourGatekeeper.class.getSimpleName() + "_reuse";
private LoveYourGatekeeper()
{
addStartNpc(GATEKEEPER);
addFirstTalkId(GATEKEEPER);
addTalkId(GATEKEEPER);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "transform_stick":
{
if (player.getAdena() >= PRICE)
{
final long reuse = player.getVariables().getLong(REUSE, 0);
if (reuse > System.currentTimeMillis())
{
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
sm.addItemName(GATEKEEPER_TRANSFORMATION_STICK);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
}
else
{
takeItems(player, Inventory.ADENA_ID, PRICE);
giveItems(player, GATEKEEPER_TRANSFORMATION_STICK, 1);
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
}
}
else
{
return "32477-3.htm";
}
return null;
}
case "transform":
{
if (!player.isTransformed())
{
player.doCast(TELEPORTER_TRANSFORM.getSkill());
}
return null;
}
}
return event;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "32477.htm";
}
public static void main(String[] args)
{
new LoveYourGatekeeper();
}
}

View File

@@ -1,319 +1,318 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.MasterOfEnchanting;
import java.util.Date;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Master of Enchanting event AI.
* @author Gnacik
*/
final class MasterOfEnchanting extends LongTimeEvent
{
// NPC
private static final int MASTER_YOGI = 32599;
// Items
private static final int MASTER_YOGI_STAFF = 13539;
private static final int MASTER_YOGI_SCROLL = 13540;
// Misc
private static final int STAFF_PRICE = 1000000;
private static final int SCROLL_24_PRICE = 5000000;
private static final int SCROLL_24_TIME = 6;
private static final int SCROLL_1_PRICE = 500000;
private static final int SCROLL_10_PRICE = 5000000;
private static final int[] HAT_SHADOW_REWARD =
{
13074,
13075,
13076
};
private static final int[] HAT_EVENT_REWARD =
{
13518,
13519,
13522
};
private static final int[] CRYSTAL_REWARD =
{
9570,
9571,
9572
};
@SuppressWarnings("deprecation")
private static final Date EVENT_START = new Date(2011, 7, 1);
private MasterOfEnchanting()
{
super(MasterOfEnchanting.class.getSimpleName(), "events");
addStartNpc(MASTER_YOGI);
addFirstTalkId(MASTER_YOGI);
addTalkId(MASTER_YOGI);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
if (event.equalsIgnoreCase("buy_staff"))
{
if (!hasQuestItems(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE))
{
takeItems(player, Inventory.ADENA_ID, STAFF_PRICE);
giveItems(player, MASTER_YOGI_STAFF, 1);
htmltext = "32599-staffbuyed.htm";
}
else
{
htmltext = "32599-staffcant.htm";
}
}
else if (event.equalsIgnoreCase("buy_scroll_24"))
{
final long curTime = System.currentTimeMillis();
final String value = loadGlobalQuestVar(player.getAccountName());
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
{
return "32599-bidth.htm";
}
if (curTime > reuse)
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
{
htmltext = "32599-s24-no.htm";
}
}
else
{
final long remainingTime = (reuse - curTime) / 1000;
final int hours = (int) remainingTime / 3600;
final int minutes = ((int) remainingTime % 3600) / 60;
if (hours > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_S1_HOUR_S_AND_S2_MINUTE_S_REMAINING_UNTIL_THE_ITEM_CAN_BE_PURCHASED_AGAIN);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "32599-scroll24.htm";
}
else if (minutes > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_S1_MINUTE_S_REMAINING_UNTIL_THE_ITEM_CAN_BE_PURCHASED_AGAIN);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "32599-scroll24.htm";
}
// Little glitch. There is no SystemMessage with seconds only.
// If time is less than 1 minute player can buy scrolls
else if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
{
htmltext = "32599-s24-no.htm";
}
}
}
else if (event.equalsIgnoreCase("buy_scroll_1"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_1_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_1_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 1);
htmltext = "32599-scroll-ok.htm";
}
else
{
htmltext = "32599-s1-no.htm";
}
}
else if (event.equalsIgnoreCase("buy_scroll_10"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_10_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_10_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 10);
htmltext = "32599-scroll-ok.htm";
}
else
{
htmltext = "32599-s10-no.htm";
}
}
else if (event.equalsIgnoreCase("receive_reward"))
{
if ((getItemEquipped(player, Inventory.PAPERDOLL_RHAND) == MASTER_YOGI_STAFF) && (getEnchantLevel(player, MASTER_YOGI_STAFF) > 3))
{
switch (getEnchantLevel(player, MASTER_YOGI_STAFF))
{
case 4:
{
giveItems(player, 6406, 1); // Firework
break;
}
case 5:
{
giveItems(player, 6406, 2); // Firework
giveItems(player, 6407, 1); // Large Firework
break;
}
case 6:
{
giveItems(player, 6406, 3); // Firework
giveItems(player, 6407, 2); // Large Firework
break;
}
case 7:
{
giveItems(player, HAT_SHADOW_REWARD[getRandom(3)], 1);
break;
}
case 8:
{
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
break;
}
case 9:
{
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
giveItems(player, 956, 1); // Scroll: Enchant Armor (D)
break;
}
case 10:
{
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
break;
}
case 11:
{
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
giveItems(player, 952, 1); // Scroll: Enchant Armor (C)
break;
}
case 12:
{
giveItems(player, 948, 1); // Scroll: Enchant Armor (B)
break;
}
case 13:
{
giveItems(player, 729, 1); // Scroll: Enchant Weapon (A)
break;
}
case 14:
{
giveItems(player, HAT_EVENT_REWARD[getRandom(3)], 1);
break;
}
case 15:
{
giveItems(player, 13992, 1); // Grade S Accessory Chest (Event)
break;
}
case 16:
{
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
break;
}
case 17:
{
giveItems(player, 959, 1); // Scroll: Enchant Weapon (S)
break;
}
case 18:
{
giveItems(player, 13991, 1); // Grade S Armor Chest (Event)
break;
}
case 19:
{
giveItems(player, 13990, 1); // Grade S Weapon Chest (Event)
break;
}
case 20:
{
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
}
case 21:
{
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
giveItems(player, 8752, 1); // High-Grade Life Stone: level 76
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
}
case 22:
{
giveItems(player, 13989, 1); // S80 Grade Armor Chest (Event)
break;
}
case 23:
{
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
break;
}
default:
{
if (getEnchantLevel(player, MASTER_YOGI_STAFF) > 23)
{
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
}
}
}
takeItems(player, MASTER_YOGI_STAFF, 1);
htmltext = "32599-rewardok.htm";
}
else
{
htmltext = "32599-rewardnostaff.htm";
}
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return npc.getId() + ".htm";
}
public static void main(String[] args)
{
new MasterOfEnchanting();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 events.MasterOfEnchanting;
import java.util.Date;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Master of Enchanting event AI.
* @author Gnacik
*/
public final class MasterOfEnchanting extends LongTimeEvent
{
// NPC
private static final int MASTER_YOGI = 32599;
// Items
private static final int MASTER_YOGI_STAFF = 13539;
private static final int MASTER_YOGI_SCROLL = 13540;
// Misc
private static final int STAFF_PRICE = 1000000;
private static final int SCROLL_24_PRICE = 5000000;
private static final int SCROLL_24_TIME = 6;
private static final int SCROLL_1_PRICE = 500000;
private static final int SCROLL_10_PRICE = 5000000;
private static final int[] HAT_SHADOW_REWARD =
{
13074,
13075,
13076
};
private static final int[] HAT_EVENT_REWARD =
{
13518,
13519,
13522
};
private static final int[] CRYSTAL_REWARD =
{
9570,
9571,
9572
};
@SuppressWarnings("deprecation")
private static final Date EVENT_START = new Date(2011, 7, 1);
private MasterOfEnchanting()
{
addStartNpc(MASTER_YOGI);
addFirstTalkId(MASTER_YOGI);
addTalkId(MASTER_YOGI);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
if (event.equalsIgnoreCase("buy_staff"))
{
if (!hasQuestItems(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE))
{
takeItems(player, Inventory.ADENA_ID, STAFF_PRICE);
giveItems(player, MASTER_YOGI_STAFF, 1);
htmltext = "32599-staffbuyed.htm";
}
else
{
htmltext = "32599-staffcant.htm";
}
}
else if (event.equalsIgnoreCase("buy_scroll_24"))
{
final long curTime = System.currentTimeMillis();
final String value = loadGlobalQuestVar(player.getAccountName());
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
{
return "32599-bidth.htm";
}
if (curTime > reuse)
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
{
htmltext = "32599-s24-no.htm";
}
}
else
{
final long remainingTime = (reuse - curTime) / 1000;
final int hours = (int) remainingTime / 3600;
final int minutes = ((int) remainingTime % 3600) / 60;
if (hours > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_S1_HOUR_S_AND_S2_MINUTE_S_REMAINING_UNTIL_THE_ITEM_CAN_BE_PURCHASED_AGAIN);
sm.addInt(hours);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "32599-scroll24.htm";
}
else if (minutes > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_S1_MINUTE_S_REMAINING_UNTIL_THE_ITEM_CAN_BE_PURCHASED_AGAIN);
sm.addInt(minutes);
player.sendPacket(sm);
htmltext = "32599-scroll24.htm";
}
// Little glitch. There is no SystemMessage with seconds only.
// If time is less than 1 minute player can buy scrolls
else if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
{
htmltext = "32599-s24-no.htm";
}
}
}
else if (event.equalsIgnoreCase("buy_scroll_1"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_1_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_1_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 1);
htmltext = "32599-scroll-ok.htm";
}
else
{
htmltext = "32599-s1-no.htm";
}
}
else if (event.equalsIgnoreCase("buy_scroll_10"))
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_10_PRICE)
{
takeItems(player, Inventory.ADENA_ID, SCROLL_10_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 10);
htmltext = "32599-scroll-ok.htm";
}
else
{
htmltext = "32599-s10-no.htm";
}
}
else if (event.equalsIgnoreCase("receive_reward"))
{
if ((getItemEquipped(player, Inventory.PAPERDOLL_RHAND) == MASTER_YOGI_STAFF) && (getEnchantLevel(player, MASTER_YOGI_STAFF) > 3))
{
switch (getEnchantLevel(player, MASTER_YOGI_STAFF))
{
case 4:
{
giveItems(player, 6406, 1); // Firework
break;
}
case 5:
{
giveItems(player, 6406, 2); // Firework
giveItems(player, 6407, 1); // Large Firework
break;
}
case 6:
{
giveItems(player, 6406, 3); // Firework
giveItems(player, 6407, 2); // Large Firework
break;
}
case 7:
{
giveItems(player, HAT_SHADOW_REWARD[getRandom(3)], 1);
break;
}
case 8:
{
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
break;
}
case 9:
{
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
giveItems(player, 956, 1); // Scroll: Enchant Armor (D)
break;
}
case 10:
{
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
break;
}
case 11:
{
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
giveItems(player, 952, 1); // Scroll: Enchant Armor (C)
break;
}
case 12:
{
giveItems(player, 948, 1); // Scroll: Enchant Armor (B)
break;
}
case 13:
{
giveItems(player, 729, 1); // Scroll: Enchant Weapon (A)
break;
}
case 14:
{
giveItems(player, HAT_EVENT_REWARD[getRandom(3)], 1);
break;
}
case 15:
{
giveItems(player, 13992, 1); // Grade S Accessory Chest (Event)
break;
}
case 16:
{
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
break;
}
case 17:
{
giveItems(player, 959, 1); // Scroll: Enchant Weapon (S)
break;
}
case 18:
{
giveItems(player, 13991, 1); // Grade S Armor Chest (Event)
break;
}
case 19:
{
giveItems(player, 13990, 1); // Grade S Weapon Chest (Event)
break;
}
case 20:
{
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
}
case 21:
{
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
giveItems(player, 8752, 1); // High-Grade Life Stone: level 76
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
}
case 22:
{
giveItems(player, 13989, 1); // S80 Grade Armor Chest (Event)
break;
}
case 23:
{
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
break;
}
default:
{
if (getEnchantLevel(player, MASTER_YOGI_STAFF) > 23)
{
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
}
}
}
takeItems(player, MASTER_YOGI_STAFF, 1);
htmltext = "32599-rewardok.htm";
}
else
{
htmltext = "32599-rewardnostaff.htm";
}
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return npc.getId() + ".htm";
}
public static void main(String[] args)
{
new MasterOfEnchanting();
}
}

View File

@@ -18,14 +18,14 @@ package events.RedLibra;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* Red Libra<br>
* Info - http://www.lineage2.com/en/news/events/01202016-red-libra.php
* @author Mobius
*/
final class RedLibra extends LongTimeEvent
public final class RedLibra extends LongTimeEvent
{
// NPCs
private static final int RED = 34210;
@@ -36,7 +36,6 @@ final class RedLibra extends LongTimeEvent
private RedLibra()
{
super(RedLibra.class.getSimpleName(), "events");
addStartNpc(RED, GREEN, BLACK, PINK, BLUE);
addFirstTalkId(RED, GREEN, BLACK, PINK, BLUE);
addTalkId(RED, GREEN, BLACK, PINK, BLUE);

View File

@@ -18,15 +18,15 @@ package events.ThePowerOfLove;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.event.LongTimeEvent;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* The Power Of Love
* @URL http://www.lineage2.com/en/news/events/02102016-the-power-of-love-part-iii.php
* @author hlwrave
*/
final class ThePowerOfLove extends LongTimeEvent
public final class ThePowerOfLove extends LongTimeEvent
{
// NPC
private static final int COCO = 33893;
@@ -45,7 +45,6 @@ final class ThePowerOfLove extends LongTimeEvent
private ThePowerOfLove()
{
super(ThePowerOfLove.class.getSimpleName(), "events");
addStartNpc(COCO);
addFirstTalkId(COCO);
addTalkId(COCO);