Proper listeners for agathion summoning.
This commit is contained in:
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,36 +47,24 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
private static final int MIN_LEVEL = 85;
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 1; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 60;
|
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
{
|
{
|
||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1506,13 +1505,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -999,19 +999,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1494,10 +1481,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2412,11 +2395,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,36 +47,24 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
private static final int MIN_LEVEL = 85;
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 1; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 60;
|
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
{
|
{
|
||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1506,13 +1505,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1001,19 +1001,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1496,10 +1483,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2414,11 +2397,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,26 +47,12 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 5; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 85;
|
private static final int MIN_LEVEL = 85;
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
@@ -74,9 +60,11 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1507,13 +1506,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1002,19 +1002,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1497,10 +1484,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2415,11 +2398,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,26 +47,12 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 5; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 85;
|
private static final int MIN_LEVEL = 85;
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
@@ -74,9 +60,11 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1507,13 +1506,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1002,19 +1002,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1497,10 +1484,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2415,11 +2398,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,26 +47,12 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 5; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 85;
|
private static final int MIN_LEVEL = 85;
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
@@ -74,9 +60,11 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1507,13 +1506,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1002,19 +1002,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1497,10 +1484,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2415,11 +2398,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.CharEffectList;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mathael
|
* Brothers Bound in Chains (500)
|
||||||
|
* @author Mathael, Mobius
|
||||||
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/Brothers_Bound_in_Chains
|
||||||
* @version Infinite Odyssey
|
|
||||||
*/
|
*/
|
||||||
public class Q00500_BrothersBoundInChains extends Quest
|
public class Q00500_BrothersBoundInChains extends Quest
|
||||||
{
|
{
|
||||||
@@ -47,26 +47,12 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int GEMSTONE_B = 2132;
|
private static final int GEMSTONE_B = 2132;
|
||||||
private static final int PENITENT_MANACLES = 36060;
|
private static final int PENITENT_MANACLES = 36060;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 36077;
|
private static final int CRUMBS_OF_PENITENCE = 36077;
|
||||||
// Skills
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE[] =
|
private static final int HOUR_OF_PENITENCE = 15325;
|
||||||
{
|
// Agathion
|
||||||
15325,
|
private static final int SIN_EATER = 16098;
|
||||||
15326,
|
// Others
|
||||||
15327,
|
private static final int DROP_QI_CHANCE = 5;
|
||||||
15328,
|
|
||||||
15329
|
|
||||||
};
|
|
||||||
// Agathions
|
|
||||||
private static final int SIN_EATERS[] =
|
|
||||||
{
|
|
||||||
16098,
|
|
||||||
16099,
|
|
||||||
16100,
|
|
||||||
16101,
|
|
||||||
16102
|
|
||||||
};
|
|
||||||
// Misc
|
|
||||||
private static final int DROP_QI_CHANCE = 5; // in % TODO: check that value
|
|
||||||
private static final int MIN_LEVEL = 85;
|
private static final int MIN_LEVEL = 85;
|
||||||
|
|
||||||
public Q00500_BrothersBoundInChains()
|
public Q00500_BrothersBoundInChains()
|
||||||
@@ -74,9 +60,11 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
addCondMinLevel(MIN_LEVEL, "30981-nopk.htm");
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,9 +80,9 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(15325, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
startQuestTimer("buff", 270000, null, player); // Rebuff every 4min30 (retail like)
|
||||||
}
|
}
|
||||||
@@ -128,7 +116,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10)));
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 10)));
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,46 +180,67 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (IntStream.of(SIN_EATERS).anyMatch(x -> x == agathionId)) // TODO: Register IDs
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
{
|
{
|
||||||
final QuestState qs = getQuestState(event.getAttacker(), false);
|
final L2PcInstance player = event.getAttacker();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
if (qs == null)
|
if (qs == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail)
|
if (player.getEffectList().isAffectedBySkill(HOUR_OF_PENITENCE) && (getRandom(100) < DROP_QI_CHANCE))
|
||||||
boolean isAffectedByHourOfPenitence = false;
|
|
||||||
final CharEffectList effects = event.getAttacker().getEffectList();
|
|
||||||
for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++)
|
|
||||||
{
|
{
|
||||||
if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i]))
|
giveItems(player, CRUMBS_OF_PENITENCE, 1);
|
||||||
{
|
if (!qs.isCond(2) && (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 10))
|
||||||
isAffectedByHourOfPenitence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAffectedByHourOfPenitence)
|
|
||||||
{
|
|
||||||
if (Rnd.get(1, 100) <= DROP_QI_CHANCE)
|
|
||||||
{
|
|
||||||
giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1);
|
|
||||||
if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10))
|
|
||||||
{
|
{
|
||||||
qs.setCond(2, true);
|
qs.setCond(2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1282,6 +1282,7 @@
|
|||||||
<set name="weight" val="150" />
|
<set name="weight" val="150" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="9601" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="9606" level="1" /> <!-- Sealing Agathion -->
|
||||||
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
<skill id="9606" level="1" type="ON_UNEQUIP" /> <!-- Sealing Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1507,13 +1506,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -272,6 +273,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1002,19 +1002,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1497,10 +1484,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2415,11 +2398,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1481,13 +1480,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -270,6 +271,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -986,19 +986,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1473,10 +1460,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2373,11 +2356,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,23 +16,27 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Brothers Bound in Chains (500)
|
||||||
* @author Mobius (Based on GoD quest.)
|
* @author Mobius (Based on GoD quest.)
|
||||||
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
||||||
*/
|
*/
|
||||||
@@ -45,7 +49,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int PENITENT_MANACLES = 70806;
|
private static final int PENITENT_MANACLES = 70806;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 70807;
|
private static final int CRUMBS_OF_PENITENCE = 70807;
|
||||||
// Skill
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE = 15325;
|
private static final int HOUR_OF_PENITENCE = 55702;
|
||||||
// Agathion
|
// Agathion
|
||||||
private static final int SIN_EATER = 9021;
|
private static final int SIN_EATER = 9021;
|
||||||
// Other
|
// Other
|
||||||
@@ -56,8 +60,10 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +79,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
@@ -109,7 +115,8 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 3)));
|
takeItems(player, PENITENT_MANACLES, -1);
|
||||||
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 3)));
|
||||||
qs.unset(KILL_COUNT_VAR);
|
qs.unset(KILL_COUNT_VAR);
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
@@ -174,15 +181,45 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (SIN_EATER == agathionId)
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
<set name="weight" val="100" />
|
<set name="weight" val="100" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="3267" level="1" /> <!-- Seal Agathion -->
|
||||||
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1481,13 +1480,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -270,6 +271,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -986,19 +986,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1473,10 +1460,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2373,11 +2356,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,23 +16,27 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Brothers Bound in Chains (500)
|
||||||
* @author Mobius (Based on GoD quest.)
|
* @author Mobius (Based on GoD quest.)
|
||||||
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
||||||
*/
|
*/
|
||||||
@@ -45,7 +49,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int PENITENT_MANACLES = 70806;
|
private static final int PENITENT_MANACLES = 70806;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 70807;
|
private static final int CRUMBS_OF_PENITENCE = 70807;
|
||||||
// Skill
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE = 15325;
|
private static final int HOUR_OF_PENITENCE = 55702;
|
||||||
// Agathion
|
// Agathion
|
||||||
private static final int SIN_EATER = 9021;
|
private static final int SIN_EATER = 9021;
|
||||||
// Other
|
// Other
|
||||||
@@ -56,8 +60,10 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +79,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
@@ -109,7 +115,8 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 3)));
|
takeItems(player, PENITENT_MANACLES, -1);
|
||||||
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 3)));
|
||||||
qs.unset(KILL_COUNT_VAR);
|
qs.unset(KILL_COUNT_VAR);
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
@@ -174,15 +181,45 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (SIN_EATER == agathionId)
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
<set name="weight" val="100" />
|
<set name="weight" val="100" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="3267" level="1" /> <!-- Seal Agathion -->
|
||||||
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1481,13 +1480,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -270,6 +271,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -986,19 +986,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1473,10 +1460,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2373,11 +2356,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public final class SummonAgathion extends AbstractEffect
|
|||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(effector.getActingPlayer(), _npcId));
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
|||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoCubic;
|
||||||
@@ -45,10 +47,16 @@ public final class UnsummonAgathion extends AbstractEffect
|
|||||||
{
|
{
|
||||||
final L2PcInstance player = effector.getActingPlayer();
|
final L2PcInstance player = effector.getActingPlayer();
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
{
|
||||||
|
final int agathionId = player.getAgathionId();
|
||||||
|
if (agathionId > 0)
|
||||||
{
|
{
|
||||||
player.setAgathionId(0);
|
player.setAgathionId(0);
|
||||||
player.sendPacket(new ExUserInfoCubic(player));
|
player.sendPacket(new ExUserInfoCubic(player));
|
||||||
player.broadcastCharInfo();
|
player.broadcastCharInfo();
|
||||||
|
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,23 +16,27 @@
|
|||||||
*/
|
*/
|
||||||
package quests.Q00500_BrothersBoundInChains;
|
package quests.Q00500_BrothersBoundInChains;
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
|
||||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.enums.QuestType;
|
import com.l2jmobius.gameserver.enums.QuestType;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||||
import com.l2jmobius.gameserver.model.quest.State;
|
import com.l2jmobius.gameserver.model.quest.State;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Brothers Bound in Chains (500)
|
||||||
* @author Mobius (Based on GoD quest.)
|
* @author Mobius (Based on GoD quest.)
|
||||||
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
* @URL https://l2wiki.com/classic/Brothers_Bound_in_Chains
|
||||||
*/
|
*/
|
||||||
@@ -45,7 +49,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
private static final int PENITENT_MANACLES = 70806;
|
private static final int PENITENT_MANACLES = 70806;
|
||||||
private static final int CRUMBS_OF_PENITENCE = 70807;
|
private static final int CRUMBS_OF_PENITENCE = 70807;
|
||||||
// Skill
|
// Skill
|
||||||
private static final int HOUR_OF_PENITENCE = 15325;
|
private static final int HOUR_OF_PENITENCE = 55702;
|
||||||
// Agathion
|
// Agathion
|
||||||
private static final int SIN_EATER = 9021;
|
private static final int SIN_EATER = 9021;
|
||||||
// Other
|
// Other
|
||||||
@@ -56,8 +60,10 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
super(500);
|
super(500);
|
||||||
addStartNpc(DARK_JUDGE);
|
addStartNpc(DARK_JUDGE);
|
||||||
addTalkId(DARK_JUDGE);
|
addTalkId(DARK_JUDGE);
|
||||||
addSummonAgathion();
|
|
||||||
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE);
|
||||||
|
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_SUMMON_AGATHION, (OnPlayerSummonAgathion event) -> OnPlayerSummonAgathion(event), this));
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_UNSUMMON_AGATHION, (OnPlayerUnsummonAgathion event) -> OnPlayerUnsummonAgathion(event), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +79,7 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
{
|
{
|
||||||
case "buff":
|
case "buff":
|
||||||
{
|
{
|
||||||
if (player != null)
|
if ((player != null) && (player.getAgathionId() == SIN_EATER))
|
||||||
{
|
{
|
||||||
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
final Skill skill = SkillData.getInstance().getSkill(HOUR_OF_PENITENCE, 1); // Hour of Penitence
|
||||||
skill.activateSkill(player, player);
|
skill.activateSkill(player, player);
|
||||||
@@ -109,7 +115,8 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
if (getQuestItemsCount(player, CRUMBS_OF_PENITENCE) >= 35)
|
||||||
{
|
{
|
||||||
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
takeItems(player, CRUMBS_OF_PENITENCE, -1);
|
||||||
player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 3)));
|
takeItems(player, PENITENT_MANACLES, -1);
|
||||||
|
player.setPkKills(Math.max(0, player.getPkKills() - getRandom(1, 3)));
|
||||||
qs.unset(KILL_COUNT_VAR);
|
qs.unset(KILL_COUNT_VAR);
|
||||||
qs.exitQuest(QuestType.DAILY, true);
|
qs.exitQuest(QuestType.DAILY, true);
|
||||||
}
|
}
|
||||||
@@ -174,15 +181,45 @@ public class Q00500_BrothersBoundInChains extends Quest
|
|||||||
return htmltext;
|
return htmltext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void OnPlayerSummonAgathion(OnPlayerSummonAgathion event)
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
{
|
||||||
if (SIN_EATER == agathionId)
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
{
|
{
|
||||||
startQuestTimer("buff", 2500, null, player);
|
startQuestTimer("buff", 2500, null, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerUnsummonAgathion(OnPlayerUnsummonAgathion event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final QuestState qs = getQuestState(player, false);
|
||||||
|
if (qs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getAgathionId() == SIN_EATER)
|
||||||
|
{
|
||||||
|
cancelQuestTimer("buff", null, player);
|
||||||
|
player.getEffectList().stopSkillEffects(true, HOUR_OF_PENITENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
|
||||||
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
|
||||||
public void onAttackableKill(OnAttackableKill event)
|
public void onAttackableKill(OnAttackableKill event)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
<set name="weight" val="100" />
|
<set name="weight" val="100" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
<skill id="55701" level="1" /> <!-- Release Agathion's Seal - Sin Eater -->
|
||||||
|
<skill id="3267" level="1" /> <!-- Seal Agathion -->
|
||||||
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
<skill id="3267" level="1" type="ON_UNEQUIP" /> <!-- Seal Agathion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
@@ -1481,13 +1480,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
|
||||||
{
|
|
||||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||||
@@ -270,6 +271,7 @@ public enum EventType
|
|||||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||||
|
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||||
|
|
||||||
// Trap events
|
// Trap events
|
||||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _player;
|
||||||
|
private final int _agathionId;
|
||||||
|
|
||||||
|
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_agathionId = agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAgathionId()
|
||||||
|
{
|
||||||
|
return _agathionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -986,19 +986,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
onSummonAgathion(player, npcId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are methods that java calls to invoke scripts.
|
// These are methods that java calls to invoke scripts.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1473,10 +1460,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param npc
|
* @param npc
|
||||||
* @param player
|
* @param player
|
||||||
@@ -2373,11 +2356,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSummonAgathion()
|
|
||||||
{
|
|
||||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get a random party member from a player's party.<br>
|
* Use this method to get a random party member from a player's party.<br>
|
||||||
* Useful when distributing rewards after killing an NPC.
|
* Useful when distributing rewards after killing an NPC.
|
||||||
|
|||||||
Reference in New Issue
Block a user