Added latest commits for todays sync.
This commit is contained in:
138
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/AdventurersGuide.java
vendored
Normal file
138
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/AdventurersGuide.java
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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 ai.npc.AdventurersGuide;
|
||||
|
||||
import ai.npc.AbstractNpcAI;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Adventurers Guide AI.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class AdventurersGuide extends AbstractNpcAI
|
||||
{
|
||||
// NPC
|
||||
private static final int ADVENTURERS_GUIDE = 32327;
|
||||
// Skills
|
||||
private static final SkillHolder BLESS_PROTECTION = new SkillHolder(5182, 1); // Blessing of Protection
|
||||
private static final SkillHolder KNIGHT = new SkillHolder(15648, 1); // Knight's Harmony (Adventurer)
|
||||
private static final SkillHolder WARRIOR = new SkillHolder(15649, 1); // Warrior's Harmony (Adventurer)
|
||||
private static final SkillHolder WIZARD = new SkillHolder(15650, 1); // Wizard's Harmony (Adventurer)
|
||||
private static final SkillHolder[] GROUP_BUFFS =
|
||||
{
|
||||
new SkillHolder(15642, 1), // Horn Melody (Adventurer)
|
||||
new SkillHolder(15643, 1), // Drum Melody (Adventurer)
|
||||
new SkillHolder(15644, 1), // Pipe Organ Melody (Adventurer)
|
||||
new SkillHolder(15645, 1), // Guitar Melody (Adventurer)
|
||||
new SkillHolder(15646, 1), // Harp Melody (Adventurer)
|
||||
new SkillHolder(15647, 1), // Lute Melody (Adventurer)
|
||||
new SkillHolder(15651, 1), // Prevailing Sonata (Adventurer)
|
||||
new SkillHolder(15652, 1), // Daring Sonata (Adventurer)
|
||||
new SkillHolder(15653, 1), // Refreshing Sonata (Adventurer)
|
||||
};
|
||||
|
||||
private AdventurersGuide()
|
||||
{
|
||||
super(AdventurersGuide.class.getSimpleName(), "ai/npc");
|
||||
addStartNpc(ADVENTURERS_GUIDE);
|
||||
addTalkId(ADVENTURERS_GUIDE);
|
||||
addFirstTalkId(ADVENTURERS_GUIDE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String htmltext = null;
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "guide-01.html":
|
||||
case "guide-02.html":
|
||||
case "guide-03.html":
|
||||
case "guide-04.html":
|
||||
{
|
||||
htmltext = event;
|
||||
break;
|
||||
}
|
||||
case "weakenBreath":
|
||||
{
|
||||
if (player.getShilensBreathDebuffLevel() < 3)
|
||||
{
|
||||
htmltext = "guide-noBreath.html";
|
||||
break;
|
||||
}
|
||||
|
||||
player.setShilensBreathDebuffLevel(2);
|
||||
htmltext = ""; // TODO: Any success html?
|
||||
break;
|
||||
}
|
||||
case "knight":
|
||||
{
|
||||
htmltext = applyBuffs(npc, player, KNIGHT.getSkill());
|
||||
break;
|
||||
}
|
||||
case "warrior":
|
||||
{
|
||||
htmltext = applyBuffs(npc, player, WARRIOR.getSkill());
|
||||
break;
|
||||
}
|
||||
case "wizard":
|
||||
{
|
||||
htmltext = applyBuffs(npc, player, WIZARD.getSkill());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
return "guide.html";
|
||||
}
|
||||
|
||||
private String applyBuffs(L2Npc npc, L2PcInstance player, Skill skill)
|
||||
{
|
||||
if (player.getLevel() > 90)
|
||||
{
|
||||
return "guide-noBuffs.html";
|
||||
}
|
||||
|
||||
for (SkillHolder holder : GROUP_BUFFS)
|
||||
{
|
||||
holder.getSkill().applyEffects(npc, player);
|
||||
}
|
||||
skill.applyEffects(npc, player);
|
||||
|
||||
if ((player.getLevel() < 40) && (player.getClassId().level() <= 1))
|
||||
{
|
||||
BLESS_PROTECTION.getSkill().applyEffects(npc, player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new AdventurersGuide();
|
||||
}
|
||||
}
|
11
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-01.html
vendored
Normal file
11
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-01.html
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<html><body>
|
||||
I can offer you the following buffs, if you're below Lv. 91. <br>
|
||||
Horn Melody / Drum Melody / Pipe Organ Melody<br1>
|
||||
Guitar Melody / Harp Melody / Lute Melody<br1>
|
||||
Prevailing Sonata / Daring Sonata / Refreshing Sonata<br1>
|
||||
You can receive the above buffs as a group.<br>
|
||||
For Knight's Harmony / Warrior's Harmony / Wizard's Harmony, you will have to choose one.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide knight">"I want the Knight's Harmony."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide warrior">"Warrior's Harmony, please."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide wizard">"Wizard's Harmony, of course!"</Button>
|
||||
</body></html>
|
6
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-02.html
vendored
Normal file
6
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-02.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Adventurers' Guide:<br>
|
||||
The Steel Door Guild tops all Dwarven guilds in power and prestige. As such, it is our duty to aid adventurers who work to restore peace unto this war-torn land. We will be happy to offer special assistance if you have Steel Door Guild Coins.<br>
|
||||
Well?<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide guide-03.html">"How do I use Steel Door Guild Coins?"</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide guide-04.html">"Here, I have some Steel Door Guild Coins..."</Button>
|
||||
</body></html>
|
5
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-03.html
vendored
Normal file
5
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-03.html
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Adventurers' Guide:<br>
|
||||
You can use Steel Door Guild Coins to purchase <font color="LEVEL">weapons, armor, and accessories of each grade</font>. These items may be restricted in terms of augmentations or attribute options, but they will be more than enough to help you on your journey.<br>
|
||||
Once you outgrow the equipment, <font color="LEVEL">you can trade them back for Steel Door Guild Coins again</font>! You can also invest in the Aden Reconstruction project if it suits your fancy, or even gamble. Don't forget that Steel Weapon Packs and Steel Armor Packs have a chance of yielding Requiem, Apocalypse, or Specter equipment!<br>
|
||||
<Button ALIGN=LEFT ICON="RETURN" action="ypass -h npc_%objectId%_Quest AdventurersGuide guide-02.html">Back</Button>
|
||||
</body></html>
|
14
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-04.html
vendored
Normal file
14
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-04.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<html><body>Adventurers' Guide:<br>
|
||||
You can use Steel Door Guild Coins to receive equipment, and trade them back for coins again. Just remember, <font color="LEVEL">you cannot bring us junk to exchange for coins!</font><br>
|
||||
So, what would you like to do?<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 893">"I'd like a weapon or a shield / Sigil."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 894">"I want to buy a top."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 895">"I am looking for some pants."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 896">"Do you have any good helmets?"</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 897">"Gloves would be nice."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 898">"Give me the best boots you got."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 899">"Can I take a look at your necklaces?"</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 900">"I'm up for a ring..."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 901">"I want some earrings."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_exc_multisell 903">"I want to return my Steel equipment."</Button>
|
||||
</body></html>
|
4
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-noBreath.html
vendored
Normal file
4
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-noBreath.html
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Adventurers' Guide<br>
|
||||
I can only weaken Shilen's Breath Lv. 3 or above.<br>
|
||||
There is nothing I can do for you.
|
||||
</body></html>
|
3
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-noBuffs.html
vendored
Normal file
3
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide-noBuffs.html
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Characters who are Lv. 91 or above cannot receive Newbie Buffs.
|
||||
</body></html>
|
9
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide.html
vendored
Normal file
9
trunk/dist/game/data/scripts/ai/npc/AdventurersGuide/guide.html
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<html><body>Adventurers' Guide:<br>
|
||||
Greetings, traveler! How may I be of assistance?<br>
|
||||
My job is to offer what little assistance I can as you charge into all this endless evil and intense fighting!<br>
|
||||
Even now, the monster attacks on this village grow stronger each day; it is only due to your tireless efforts that we have remained safe this long.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide guide-01.html"><font color="LEVEL">"Can I see the list of available buffs?"</font></Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide guide-02.html">"Here, I have some Steel Door Guild Coins..."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest AdventurersGuide weakenBreath">"I heard you could weaken Shilen's Breath Lv.3 or above."</Button>
|
||||
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button>
|
||||
</body></html>
|
@@ -130,8 +130,6 @@ import handlers.bypasshandlers.ReceivePremium;
|
||||
import handlers.bypasshandlers.ReleaseAttribute;
|
||||
import handlers.bypasshandlers.RentPet;
|
||||
import handlers.bypasshandlers.SkillList;
|
||||
import handlers.bypasshandlers.SupportBlessing;
|
||||
import handlers.bypasshandlers.SupportMagic;
|
||||
import handlers.bypasshandlers.TerritoryStatus;
|
||||
import handlers.bypasshandlers.TutorialClose;
|
||||
import handlers.bypasshandlers.VoiceCommand;
|
||||
@@ -426,8 +424,6 @@ public class MasterHandler
|
||||
ReleaseAttribute.class,
|
||||
RentPet.class,
|
||||
SkillList.class,
|
||||
SupportBlessing.class,
|
||||
SupportMagic.class,
|
||||
TerritoryStatus.class,
|
||||
TutorialClose.class,
|
||||
VoiceCommand.class,
|
||||
|
@@ -18,19 +18,15 @@
|
||||
*/
|
||||
package handlers.bypasshandlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.handler.IBypassHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.QuestManager;
|
||||
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.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.events.EventType;
|
||||
import com.l2jserver.gameserver.model.events.listeners.AbstractEventListener;
|
||||
import com.l2jserver.gameserver.model.quest.Quest;
|
||||
@@ -85,24 +81,28 @@ public class QuestLink implements IBypassHandler
|
||||
* @param npc The table containing quests of the L2NpcInstance
|
||||
* @param quests
|
||||
*/
|
||||
public static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Quest[] quests)
|
||||
public static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Collection<Quest> quests)
|
||||
{
|
||||
final StringBuilder sb = StringUtil.startAppend(150, "<html><body>");
|
||||
String state = "";
|
||||
String color = "";
|
||||
int questId = -1;
|
||||
|
||||
//@formatter:off
|
||||
final Set<Quest> startingQuests = npc.getListeners(EventType.ON_NPC_QUEST_START).stream()
|
||||
.map(AbstractEventListener::getOwner)
|
||||
.filter(Quest.class::isInstance)
|
||||
.map(Quest.class::cast)
|
||||
.distinct()
|
||||
.collect(Collectors.toSet());
|
||||
//@formatter:on
|
||||
|
||||
for (Quest quest : quests)
|
||||
{
|
||||
if (quest == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final QuestState qs = player.getQuestState(quest.getScriptName());
|
||||
if ((qs == null) || qs.isCreated())
|
||||
{
|
||||
state = quest.isCustomQuest() ? "" : "01";
|
||||
if (quest.canStartQuest(player))
|
||||
if (startingQuests.contains(quest) && quest.canStartQuest(player))
|
||||
{
|
||||
color = "bbaa88";
|
||||
}
|
||||
@@ -130,16 +130,7 @@ public class QuestLink implements IBypassHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
questId = quest.getId();
|
||||
if (quest.getId() > 10000)
|
||||
{
|
||||
questId -= 5000;
|
||||
}
|
||||
else if (questId == 146)
|
||||
{
|
||||
questId = 640;
|
||||
}
|
||||
StringUtil.append(sb, "<fstring>", String.valueOf(questId), state, "</fstring>");
|
||||
StringUtil.append(sb, "<fstring>", String.valueOf(quest.getId()), state, "</fstring>");
|
||||
}
|
||||
sb.append("</button></font><br>");
|
||||
}
|
||||
@@ -210,101 +201,30 @@ public class QuestLink implements IBypassHandler
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param npcId The Identifier of the NPC
|
||||
* @return a table containing all QuestState from the table _quests in which the L2PcInstance must talk to the NPC.
|
||||
*/
|
||||
private static List<QuestState> getQuestsForTalk(final L2PcInstance player, int npcId)
|
||||
{
|
||||
// Create a QuestState table that will contain all QuestState to modify
|
||||
final List<QuestState> states = new ArrayList<>();
|
||||
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template == null)
|
||||
{
|
||||
_log.log(Level.WARNING, QuestLink.class.getSimpleName() + ": " + player.getName() + " requested quests for talk on non existing npc " + npcId);
|
||||
return states;
|
||||
}
|
||||
|
||||
// Go through the QuestState of the L2PcInstance quests
|
||||
for (AbstractEventListener listener : template.getListeners(EventType.ON_NPC_TALK))
|
||||
{
|
||||
if (listener.getOwner() instanceof Quest)
|
||||
{
|
||||
final Quest quest = (Quest) listener.getOwner();
|
||||
|
||||
// Copy the current L2PcInstance QuestState in the QuestState table
|
||||
final QuestState st = player.getQuestState(quest.getName());
|
||||
if (st != null)
|
||||
{
|
||||
states.add(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return a table containing all QuestState to modify
|
||||
return states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect awaiting quests/start points and display a QuestChooseWindow (if several available) or QuestWindow.
|
||||
* @param player the L2PcInstance that talk with the {@code npc}.
|
||||
* @param npc the L2NpcInstance that chats with the {@code player}.
|
||||
*/
|
||||
public static void showQuestWindow(L2PcInstance player, L2Npc npc)
|
||||
private static void showQuestWindow(final L2PcInstance player, L2Npc npc)
|
||||
{
|
||||
boolean conditionMeet = false;
|
||||
// collect awaiting quests and start points
|
||||
final Set<Quest> options = new HashSet<>();
|
||||
//@formatter:off
|
||||
final Set<Quest> quests = npc.getListeners(EventType.ON_NPC_TALK).stream()
|
||||
.map(AbstractEventListener::getOwner)
|
||||
.filter(Quest.class::isInstance)
|
||||
.map(Quest.class::cast)
|
||||
.filter(quest -> (quest.getId() > 0) && (quest.getId() < 20000))
|
||||
.distinct()
|
||||
.collect(Collectors.toSet());
|
||||
//@formatter:on
|
||||
|
||||
// Quests are limited between 1 and 999 because those are the quests that are supported by the client.
|
||||
// By limiting them there, we are allowed to create custom quests at higher IDs without interfering
|
||||
for (QuestState state : getQuestsForTalk(player, npc.getId()))
|
||||
if (quests.size() > 1)
|
||||
{
|
||||
final Quest quest = state.getQuest();
|
||||
if (quest == null)
|
||||
{
|
||||
_log.log(Level.WARNING, player + " Requested incorrect quest state for non existing quest: " + state.getQuestName());
|
||||
continue;
|
||||
}
|
||||
if ((quest.getId() > 0) && (quest.getId() < 20000))
|
||||
{
|
||||
options.add(quest);
|
||||
if (quest.canStartQuest(player))
|
||||
{
|
||||
conditionMeet = true;
|
||||
}
|
||||
}
|
||||
showQuestChooseWindow(player, npc, quests);
|
||||
}
|
||||
|
||||
for (AbstractEventListener listener : npc.getListeners(EventType.ON_NPC_QUEST_START))
|
||||
else if (quests.size() == 1)
|
||||
{
|
||||
if (listener.getOwner() instanceof Quest)
|
||||
{
|
||||
final Quest quest = (Quest) listener.getOwner();
|
||||
if ((quest.getId() > 0) && (quest.getId() < 20000))
|
||||
{
|
||||
options.add(quest);
|
||||
if (quest.canStartQuest(player))
|
||||
{
|
||||
conditionMeet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!conditionMeet)
|
||||
{
|
||||
showQuestWindow(player, npc, "");
|
||||
}
|
||||
else if (options.size() > 1)
|
||||
{
|
||||
showQuestChooseWindow(player, npc, options.toArray(new Quest[options.size()]));
|
||||
}
|
||||
else if (options.size() == 1)
|
||||
{
|
||||
showQuestWindow(player, npc, options.stream().findFirst().get().getName());
|
||||
showQuestWindow(player, npc, quests.stream().findFirst().get().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 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 handlers.bypasshandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IBypassHandler;
|
||||
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.skills.CommonSkill;
|
||||
|
||||
public class SupportBlessing implements IBypassHandler
|
||||
{
|
||||
private static final String[] COMMANDS =
|
||||
{
|
||||
"GiveBlessing"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
|
||||
{
|
||||
if (!target.isNpc())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2Npc npc = (L2Npc) target;
|
||||
|
||||
// If the player is too high level, display a message and return
|
||||
if ((activeChar.getLevel() > 39) || (activeChar.getClassId().level() >= 2))
|
||||
{
|
||||
npc.showChatWindow(activeChar, "data/html/default/SupportBlessingHighLevel.htm");
|
||||
return true;
|
||||
}
|
||||
npc.setTarget(activeChar);
|
||||
npc.doCast(CommonSkill.BLESSING_OF_PROTECTION.getSkill());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBypassList()
|
||||
{
|
||||
return COMMANDS;
|
||||
}
|
||||
}
|
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 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 handlers.bypasshandlers;
|
||||
|
||||
import com.l2jserver.gameserver.enums.CategoryType;
|
||||
import com.l2jserver.gameserver.handler.IBypassHandler;
|
||||
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.holders.SkillHolder;
|
||||
|
||||
public class SupportMagic implements IBypassHandler
|
||||
{
|
||||
private static final String[] COMMANDS =
|
||||
{
|
||||
"supportmagicservitor",
|
||||
"supportmagic"
|
||||
};
|
||||
|
||||
// Buffs
|
||||
private static final SkillHolder HASTE_1 = new SkillHolder(4327, 1);
|
||||
private static final SkillHolder HASTE_2 = new SkillHolder(5632, 1);
|
||||
private static final SkillHolder CUBIC = new SkillHolder(4338, 1);
|
||||
private static final SkillHolder[] FIGHTER_BUFFS =
|
||||
{
|
||||
new SkillHolder(4322, 1), // Wind Walk
|
||||
new SkillHolder(4323, 1), // Shield
|
||||
new SkillHolder(5637, 1), // Magic Barrier
|
||||
new SkillHolder(4324, 1), // Bless the Body
|
||||
new SkillHolder(4325, 1), // Vampiric Rage
|
||||
new SkillHolder(4326, 1), // Regeneration
|
||||
};
|
||||
private static final SkillHolder[] MAGE_BUFFS =
|
||||
{
|
||||
new SkillHolder(4322, 1), // Wind Walk
|
||||
new SkillHolder(4323, 1), // Shield
|
||||
new SkillHolder(5637, 1), // Magic Barrier
|
||||
new SkillHolder(4328, 1), // Bless the Soul
|
||||
new SkillHolder(4329, 1), // Acumen
|
||||
new SkillHolder(4330, 1), // Concentration
|
||||
new SkillHolder(4331, 1), // Empower
|
||||
};
|
||||
private static final SkillHolder[] SUMMON_BUFFS =
|
||||
{
|
||||
new SkillHolder(4322, 1), // Wind Walk
|
||||
new SkillHolder(4323, 1), // Shield
|
||||
new SkillHolder(5637, 1), // Magic Barrier
|
||||
new SkillHolder(4324, 1), // Bless the Body
|
||||
new SkillHolder(4325, 1), // Vampiric Rage
|
||||
new SkillHolder(4326, 1), // Regeneration
|
||||
new SkillHolder(4328, 1), // Bless the Soul
|
||||
new SkillHolder(4329, 1), // Acumen
|
||||
new SkillHolder(4330, 1), // Concentration
|
||||
new SkillHolder(4331, 1), // Empower
|
||||
};
|
||||
|
||||
// Levels
|
||||
private static final int LOWEST_LEVEL = 6;
|
||||
private static final int HIGHEST_LEVEL = 75;
|
||||
private static final int CUBIC_LOWEST = 16;
|
||||
private static final int CUBIC_HIGHEST = 34;
|
||||
private static final int HASTE_LEVEL_2 = 40;
|
||||
|
||||
@Override
|
||||
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
|
||||
{
|
||||
if (!target.isNpc() || activeChar.isCursedWeaponEquipped())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (command.equalsIgnoreCase(COMMANDS[0]))
|
||||
{
|
||||
makeSupportMagic(activeChar, (L2Npc) target, true);
|
||||
}
|
||||
else if (command.equalsIgnoreCase(COMMANDS[1]))
|
||||
{
|
||||
makeSupportMagic(activeChar, (L2Npc) target, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void makeSupportMagic(L2PcInstance player, L2Npc npc, boolean isSummon)
|
||||
{
|
||||
final int level = player.getLevel();
|
||||
if (isSummon && !player.hasServitors())
|
||||
{
|
||||
npc.showChatWindow(player, "data/html/default/SupportMagicNoSummon.htm");
|
||||
return;
|
||||
}
|
||||
else if (level > HIGHEST_LEVEL)
|
||||
{
|
||||
npc.showChatWindow(player, "data/html/default/SupportMagicHighLevel.htm");
|
||||
return;
|
||||
}
|
||||
else if (level < LOWEST_LEVEL)
|
||||
{
|
||||
npc.showChatWindow(player, "data/html/default/SupportMagicLowLevel.htm");
|
||||
return;
|
||||
}
|
||||
else if (player.getClassId().level() == 3)
|
||||
{
|
||||
player.sendMessage("Only adventurers who have not completed their 3rd class transfer may receive these buffs."); // Custom message
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSummon)
|
||||
{
|
||||
player.getServitors().values().forEach(s ->
|
||||
{
|
||||
npc.setTarget(s);
|
||||
for (SkillHolder skill : SUMMON_BUFFS)
|
||||
{
|
||||
npc.doCast(skill.getSkill());
|
||||
}
|
||||
|
||||
if (level >= HASTE_LEVEL_2)
|
||||
{
|
||||
npc.doCast(HASTE_2.getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.doCast(HASTE_1.getSkill());
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setTarget(player);
|
||||
if (player.isInCategory(CategoryType.BEGINNER_MAGE))
|
||||
{
|
||||
for (SkillHolder skill : MAGE_BUFFS)
|
||||
{
|
||||
npc.doCast(skill.getSkill());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (SkillHolder skill : FIGHTER_BUFFS)
|
||||
{
|
||||
npc.doCast(skill.getSkill());
|
||||
}
|
||||
|
||||
if (level >= HASTE_LEVEL_2)
|
||||
{
|
||||
npc.doCast(HASTE_2.getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.doCast(HASTE_1.getSkill());
|
||||
}
|
||||
}
|
||||
|
||||
if ((level >= CUBIC_LOWEST) && (level <= CUBIC_HIGHEST))
|
||||
{
|
||||
player.doSimultaneousCast(CUBIC.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBypassList()
|
||||
{
|
||||
return COMMANDS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user