From 596851c7e886b32148bbcbe3375e973470a51c81 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Wed, 21 Sep 2022 02:49:48 +0000
Subject: [PATCH] Addition of Ranking Power system. Contributed by Serenitty.
---
.../ai/others/RankingSkillBonuses.java | 2 +
.../game/data/stats/skills/52000-52099.xml | 31 +++-
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../GlobalVariablesManager.java | 2 +
.../instancemanager/RankingPowerManager.java | 135 ++++++++++++++++++
.../gameserver/network/ExIncomingPackets.java | 6 +-
...questExRankingCharBuffzoneNpcPosition.java | 54 +++++++
.../RequestExRankingCharSpawnBuffzoneNpc.java | 76 ++++++++++
.../ranking/ExRankingBuffZoneNpcInfo.java | 52 +++++++
.../ranking/ExRankingBuffZoneNpcPosition.java | 56 ++++++++
.../ai/others/RankingSkillBonuses.java | 2 +
.../game/data/stats/skills/52000-52099.xml | 31 +++-
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../GlobalVariablesManager.java | 2 +
.../instancemanager/RankingPowerManager.java | 135 ++++++++++++++++++
.../gameserver/network/ExIncomingPackets.java | 6 +-
...questExRankingCharBuffzoneNpcPosition.java | 54 +++++++
.../RequestExRankingCharSpawnBuffzoneNpc.java | 76 ++++++++++
.../ranking/ExRankingBuffZoneNpcInfo.java | 52 +++++++
.../ranking/ExRankingBuffZoneNpcPosition.java | 56 ++++++++
.../ai/others/RankingSkillBonuses.java | 2 +
.../game/data/stats/skills/52000-52099.xml | 31 +++-
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../GlobalVariablesManager.java | 2 +
.../instancemanager/RankingPowerManager.java | 135 ++++++++++++++++++
.../gameserver/network/ExIncomingPackets.java | 6 +-
...questExRankingCharBuffzoneNpcPosition.java | 54 +++++++
.../RequestExRankingCharSpawnBuffzoneNpc.java | 76 ++++++++++
.../ranking/ExRankingBuffZoneNpcInfo.java | 52 +++++++
.../ranking/ExRankingBuffZoneNpcPosition.java | 56 ++++++++
30 files changed, 1239 insertions(+), 9 deletions(-)
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/ai/others/RankingSkillBonuses.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
index a83f59c13e..b48058764e 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.skill.Skill;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
import ai.AbstractNpcAI;
@@ -92,6 +93,7 @@ public class RankingSkillBonuses extends AbstractNpcAI
{
if (rank <= 1)
{
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
SERVER_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_1, false);
player.addSkill(SERVER_RANKING_BENEFIT_2, false);
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/52000-52099.xml b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/52000-52099.xml
index 228c34579c..881e0c3f0c 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/52000-52099.xml
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/52000-52099.xml
@@ -88,7 +88,36 @@
icon.skill0000
- A1
+ 14600
+ true
+ 300
+ 315
+ 2
+ A2
+ SELF
+ SINGLE
+
+
+ 1
+ STR
+
+
+ 1
+ INT
+
+
+ 20
+ DIFF
+
+
+ 0
+ 20
+
+
+ 10
+ DIFF
+
+
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java
index b9567a8db1..a31c0bfb4c 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java
@@ -139,6 +139,7 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -264,6 +265,7 @@ public class GameServer
DailyMissionHandler.getInstance().executeScript();
DailyMissionData.getInstance();
ElementalSpiritData.getInstance();
+ RankingPowerManager.getInstance();
printSection("Skills");
SkillConditionHandler.getInstance().executeScript();
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index 5b69f1db60..71f72babb7 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -44,6 +44,8 @@ public class GlobalVariablesManager extends AbstractVariables
// Public variable names
public static final String DAILY_TASK_RESET = "DAILY_TASK_RESET";
public static final String MONSTER_ARENA_VARIABLE = "MA_C";
+ public static final String RANKING_POWER_COOLDOWN = "RANKING_POWER_COOLDOWN";
+ public static final String RANKING_POWER_LOCATION = "RANKING_POWER_LOCATION";
protected GlobalVariablesManager()
{
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
new file mode 100644
index 0000000000..28859d54ae
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
@@ -0,0 +1,135 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledFuture;
+
+import org.l2jmobius.commons.threads.ThreadPool;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.data.xml.NpcData;
+import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.instance.Decoy;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.events.AbstractScript;
+import org.l2jmobius.gameserver.model.holders.SkillHolder;
+import org.l2jmobius.gameserver.model.skill.BuffInfo;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+import org.l2jmobius.gameserver.util.Broadcast;
+
+/**
+ * @author Serenitty
+ */
+public class RankingPowerManager
+{
+ private static final int COOLDOWN = 43200000;
+ private static final int LEADER_STATUE = 18485;
+ private static final SkillHolder LEADER_POWER = new SkillHolder(52018, 1);
+
+ private Decoy _decoyInstance;
+ private ScheduledFuture> _decoyTask;
+
+ protected RankingPowerManager()
+ {
+ reset();
+ }
+
+ public void activatePower(Player player)
+ {
+ final Location location = player.getLocation();
+ final List array = new ArrayList<>(3);
+ array.add(location.getX());
+ array.add(location.getY());
+ array.add(location.getZ());
+ GlobalVariablesManager.getInstance().setIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION, array);
+ GlobalVariablesManager.getInstance().set(GlobalVariablesManager.RANKING_POWER_COOLDOWN, System.currentTimeMillis() + COOLDOWN);
+ createClone(player);
+ cloneTask();
+ final SystemMessage msg = new SystemMessage(SystemMessageId.IN_C1_SERVER_S2_NO_1_CHARACTER_USED_RANKING_POWER);
+ msg.addZoneName(location.getX(), location.getY(), location.getZ()).toString();
+ msg.addString(player.getName());
+ Broadcast.toAllOnlinePlayers(msg);
+ }
+
+ private void createClone(Player player)
+ {
+ final Location location = player.getLocation();
+
+ final NpcTemplate template = NpcData.getInstance().getTemplate(LEADER_STATUE);
+ _decoyInstance = new Decoy(template, player, COOLDOWN, false);
+ _decoyInstance.setTargetable(false);
+ _decoyInstance.setImmobilized(true);
+ _decoyInstance.setInvul(true);
+ _decoyInstance.spawnMe(location.getX(), location.getY(), location.getZ());
+ _decoyInstance.setHeading(location.getHeading());
+ _decoyInstance.broadcastStatusUpdate();
+
+ AbstractScript.addSpawn(null, LEADER_STATUE, location, false, COOLDOWN);
+ }
+
+ private void cloneTask()
+ {
+ _decoyTask = ThreadPool.scheduleAtFixedRate(() ->
+ {
+ World.getInstance().forEachVisibleObjectInRange(_decoyInstance, Player.class, 300, nearby ->
+ {
+ final BuffInfo info = nearby.getEffectList().getBuffInfoBySkillId(LEADER_POWER.getSkillId());
+ if ((info == null) || (info.getTime() < (LEADER_POWER.getSkill().getAbnormalTime() - 60)))
+ {
+ nearby.sendPacket(new MagicSkillUse(_decoyInstance, nearby, LEADER_POWER.getSkillId(), LEADER_POWER.getSkillLevel(), 0, 0));
+ LEADER_POWER.getSkill().applyEffects(_decoyInstance, nearby);
+ }
+ });
+ if (Rnd.nextBoolean()) // Add some randomness?
+ {
+ ThreadPool.schedule(() -> _decoyInstance.broadcastSocialAction(2), 4500);
+ }
+ }, 1000, 10000);
+
+ ThreadPool.schedule(this::reset, COOLDOWN);
+ }
+
+ public void reset()
+ {
+ if (_decoyTask != null)
+ {
+ _decoyTask.cancel(false);
+ _decoyTask = null;
+ }
+ if (_decoyInstance != null)
+ {
+ _decoyInstance.deleteMe();
+ }
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_COOLDOWN);
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ }
+
+ public static RankingPowerManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final RankingPowerManager INSTANCE = new RankingPowerManager();
+ }
+}
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index b523b7a8f9..bd38e6dca5 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -118,6 +118,8 @@ import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRando
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftLockSlot;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftMake;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftRefresh;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharBuffzoneNpcPosition;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharSpawnBuffzoneNpc;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
@@ -543,8 +545,8 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_RANKING_CHAR_INFO(0x181, RequestRankingCharInfo::new, ConnectionState.IN_GAME),
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_RANKERS(0x183, RequestRankingCharRankers::new, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, null, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, null, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, RequestExRankingCharSpawnBuffzoneNpc::new, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, RequestExRankingCharBuffzoneNpcPosition::new, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_INFO(0x187, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x188, null, ConnectionState.IN_GAME),
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
new file mode 100644
index 0000000000..72cc95be26
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.RankManager;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharBuffzoneNpcPosition implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final int ranker = RankManager.getInstance().getPlayerGlobalRank(player);
+ if (ranker == 1)
+ {
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ }
+}
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
new file mode 100644
index 0000000000..5711f32069
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
@@ -0,0 +1,76 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharSpawnBuffzoneNpc implements IClientIncomingPacket
+{
+ private static final int COST = 20000000;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ player.sendPacket(SystemMessageId.RANKING_POWER_COOLDOWN);
+ return;
+ }
+
+ if (!player.destroyItemByItemId("Adena", 57, COST, player, true))
+ {
+ player.sendPacket(SystemMessageId.NOT_ENOUGH_MONEY_TO_USE_THE_FUNCTION);
+ return;
+ }
+
+ if (!player.isInsideZone(ZoneId.PEACE) || player.isInStoreMode() || !World.getInstance().getVisibleObjectsInRange(player, Creature.class, 50).isEmpty())
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_USE_RANKING_POWER_HERE);
+ return;
+ }
+
+ RankingPowerManager.getInstance().activatePower(player);
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+}
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
new file mode 100644
index 0000000000..ab9cc539fb
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
@@ -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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.concurrent.TimeUnit;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcInfo implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcInfo()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_INFO.writeId(packet);
+ final long cooldown = GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0);
+ final long currentTime = System.currentTimeMillis();
+ if (cooldown > currentTime)
+ {
+ final long reuseTime = TimeUnit.MILLISECONDS.toSeconds(cooldown - currentTime);
+ packet.writeD((int) reuseTime);
+ }
+ else
+ {
+ packet.writeD(0);
+ }
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
new file mode 100644
index 0000000000..9439ddb93f
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.List;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcPosition implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcPosition()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_POSITION.writeId(packet);
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ final List location = GlobalVariablesManager.getInstance().getIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ packet.writeC(1);
+ packet.writeD(location.get(0));
+ packet.writeD(location.get(1));
+ packet.writeD(location.get(2));
+ }
+ else
+ {
+ packet.writeC(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ }
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/ai/others/RankingSkillBonuses.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
index 33d441e812..dbb22ca2f0 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.skill.Skill;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
import ai.AbstractNpcAI;
@@ -95,6 +96,7 @@ public class RankingSkillBonuses extends AbstractNpcAI
{
if (rank <= 1)
{
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
SERVER_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_1, false);
player.addSkill(SERVER_RANKING_BENEFIT_2, false);
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/52000-52099.xml b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/52000-52099.xml
index 1b76d7488c..b3acfa5df3 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/52000-52099.xml
+++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/52000-52099.xml
@@ -88,7 +88,36 @@
icon.skill0000
- A1
+ 14600
+ true
+ 300
+ 315
+ 2
+ A2
+ SELF
+ SINGLE
+
+
+ 1
+ STR
+
+
+ 1
+ INT
+
+
+ 20
+ DIFF
+
+
+ 0
+ 20
+
+
+ 10
+ DIFF
+
+
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java
index fa746880e4..b787f2b957 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java
@@ -143,6 +143,7 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -269,6 +270,7 @@ public class GameServer
DailyMissionHandler.getInstance().executeScript();
DailyMissionData.getInstance();
ElementalSpiritData.getInstance();
+ RankingPowerManager.getInstance();
SubjugationData.getInstance();
SubjugationGacha.getInstance();
PurgeRankingManager.getInstance();
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index 83b4adefbc..895c315971 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -44,6 +44,8 @@ public class GlobalVariablesManager extends AbstractVariables
// Public variable names
public static final String DAILY_TASK_RESET = "DAILY_TASK_RESET";
public static final String MONSTER_ARENA_VARIABLE = "MA_C";
+ public static final String RANKING_POWER_COOLDOWN = "RANKING_POWER_COOLDOWN";
+ public static final String RANKING_POWER_LOCATION = "RANKING_POWER_LOCATION";
public static final String PURGE_REWARD_TIME = "PURGE_REWARD_TIME";
protected GlobalVariablesManager()
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
new file mode 100644
index 0000000000..69757847b1
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
@@ -0,0 +1,135 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledFuture;
+
+import org.l2jmobius.commons.threads.ThreadPool;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.data.xml.NpcData;
+import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.instance.Decoy;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.events.AbstractScript;
+import org.l2jmobius.gameserver.model.holders.SkillHolder;
+import org.l2jmobius.gameserver.model.skill.BuffInfo;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+import org.l2jmobius.gameserver.util.Broadcast;
+
+/**
+ * @author Serenitty
+ */
+public class RankingPowerManager
+{
+ private static final int COOLDOWN = 43200000;
+ private static final int LEADER_STATUE = 18485;
+ private static final SkillHolder LEADER_POWER = new SkillHolder(52018, 1);
+
+ private Decoy _decoyInstance;
+ private ScheduledFuture> _decoyTask;
+
+ protected RankingPowerManager()
+ {
+ reset();
+ }
+
+ public void activatePower(Player player)
+ {
+ final Location location = player.getLocation();
+ final List array = new ArrayList<>(3);
+ array.add(location.getX());
+ array.add(location.getY());
+ array.add(location.getZ());
+ GlobalVariablesManager.getInstance().setIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION, array);
+ GlobalVariablesManager.getInstance().set(GlobalVariablesManager.RANKING_POWER_COOLDOWN, System.currentTimeMillis() + COOLDOWN);
+ createClone(player);
+ cloneTask();
+ final SystemMessage msg = new SystemMessage(SystemMessageId.A_RANKING_LEADER_C1_USED_LEADER_POWER_IN_S2);
+ msg.addString(player.getName());
+ msg.addZoneName(location.getX(), location.getY(), location.getZ()).toString();
+ Broadcast.toAllOnlinePlayers(msg);
+ }
+
+ private void createClone(Player player)
+ {
+ final Location location = player.getLocation();
+
+ final NpcTemplate template = NpcData.getInstance().getTemplate(LEADER_STATUE);
+ _decoyInstance = new Decoy(template, player, COOLDOWN, false);
+ _decoyInstance.setTargetable(false);
+ _decoyInstance.setImmobilized(true);
+ _decoyInstance.setInvul(true);
+ _decoyInstance.spawnMe(location.getX(), location.getY(), location.getZ());
+ _decoyInstance.setHeading(location.getHeading());
+ _decoyInstance.broadcastStatusUpdate();
+
+ AbstractScript.addSpawn(null, LEADER_STATUE, location, false, COOLDOWN);
+ }
+
+ private void cloneTask()
+ {
+ _decoyTask = ThreadPool.scheduleAtFixedRate(() ->
+ {
+ World.getInstance().forEachVisibleObjectInRange(_decoyInstance, Player.class, 300, nearby ->
+ {
+ final BuffInfo info = nearby.getEffectList().getBuffInfoBySkillId(LEADER_POWER.getSkillId());
+ if ((info == null) || (info.getTime() < (LEADER_POWER.getSkill().getAbnormalTime() - 60)))
+ {
+ nearby.sendPacket(new MagicSkillUse(_decoyInstance, nearby, LEADER_POWER.getSkillId(), LEADER_POWER.getSkillLevel(), 0, 0));
+ LEADER_POWER.getSkill().applyEffects(_decoyInstance, nearby);
+ }
+ });
+ if (Rnd.nextBoolean()) // Add some randomness?
+ {
+ ThreadPool.schedule(() -> _decoyInstance.broadcastSocialAction(2), 4500);
+ }
+ }, 1000, 10000);
+
+ ThreadPool.schedule(this::reset, COOLDOWN);
+ }
+
+ public void reset()
+ {
+ if (_decoyTask != null)
+ {
+ _decoyTask.cancel(false);
+ _decoyTask = null;
+ }
+ if (_decoyInstance != null)
+ {
+ _decoyInstance.deleteMe();
+ }
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_COOLDOWN);
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ }
+
+ public static RankingPowerManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final RankingPowerManager INSTANCE = new RankingPowerManager();
+ }
+}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index 5f14114817..00db6a8ff6 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -128,6 +128,8 @@ import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRando
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftLockSlot;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftMake;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftRefresh;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharBuffzoneNpcPosition;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharSpawnBuffzoneNpc;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
@@ -561,8 +563,8 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_RANKING_CHAR_INFO(0x181, RequestRankingCharInfo::new, ConnectionState.IN_GAME),
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_RANKERS(0x183, RequestRankingCharRankers::new, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, null, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, null, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, RequestExRankingCharSpawnBuffzoneNpc::new, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, RequestExRankingCharBuffzoneNpcPosition::new, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_INFO(0x187, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x188, null, ConnectionState.IN_GAME),
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
new file mode 100644
index 0000000000..72cc95be26
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.RankManager;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharBuffzoneNpcPosition implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final int ranker = RankManager.getInstance().getPlayerGlobalRank(player);
+ if (ranker == 1)
+ {
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ }
+}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
new file mode 100644
index 0000000000..8736aafb13
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
@@ -0,0 +1,76 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharSpawnBuffzoneNpc implements IClientIncomingPacket
+{
+ private static final int COST = 20000000;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ player.sendPacket(SystemMessageId.LEADER_POWER_COOLDOWN);
+ return;
+ }
+
+ if (!player.destroyItemByItemId("Adena", 57, COST, player, true))
+ {
+ player.sendPacket(SystemMessageId.NOT_ENOUGH_MONEY_TO_USE_THE_FUNCTION);
+ return;
+ }
+
+ if (!player.isInsideZone(ZoneId.PEACE) || player.isInStoreMode() || !World.getInstance().getVisibleObjectsInRange(player, Creature.class, 50).isEmpty())
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_USE_LEADER_POWER_HERE);
+ return;
+ }
+
+ RankingPowerManager.getInstance().activatePower(player);
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
new file mode 100644
index 0000000000..ab9cc539fb
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
@@ -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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.concurrent.TimeUnit;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcInfo implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcInfo()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_INFO.writeId(packet);
+ final long cooldown = GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0);
+ final long currentTime = System.currentTimeMillis();
+ if (cooldown > currentTime)
+ {
+ final long reuseTime = TimeUnit.MILLISECONDS.toSeconds(cooldown - currentTime);
+ packet.writeD((int) reuseTime);
+ }
+ else
+ {
+ packet.writeD(0);
+ }
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
new file mode 100644
index 0000000000..9439ddb93f
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.List;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcPosition implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcPosition()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_POSITION.writeId(packet);
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ final List location = GlobalVariablesManager.getInstance().getIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ packet.writeC(1);
+ packet.writeD(location.get(0));
+ packet.writeD(location.get(1));
+ packet.writeD(location.get(2));
+ }
+ else
+ {
+ packet.writeC(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ }
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/RankingSkillBonuses.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
index 33d441e812..dbb22ca2f0 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/RankingSkillBonuses.java
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.skill.Skill;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
import ai.AbstractNpcAI;
@@ -95,6 +96,7 @@ public class RankingSkillBonuses extends AbstractNpcAI
{
if (rank <= 1)
{
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
SERVER_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_1, false);
player.addSkill(SERVER_RANKING_BENEFIT_2, false);
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/52000-52099.xml b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/52000-52099.xml
index c8af45f443..d75a68e7ff 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/52000-52099.xml
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/52000-52099.xml
@@ -88,7 +88,36 @@
icon.skill0000
- A1
+ 14600
+ true
+ 300
+ 315
+ 2
+ A2
+ SELF
+ SINGLE
+
+
+ 1
+ STR
+
+
+ 1
+ INT
+
+
+ 20
+ DIFF
+
+
+ 0
+ 20
+
+
+ 10
+ DIFF
+
+
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java
index d39860e3b7..d06cdae717 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java
@@ -146,6 +146,7 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -273,6 +274,7 @@ public class GameServer
DailyMissionHandler.getInstance().executeScript();
DailyMissionData.getInstance();
ElementalSpiritData.getInstance();
+ RankingPowerManager.getInstance();
SubjugationData.getInstance();
SubjugationGacha.getInstance();
PurgeRankingManager.getInstance();
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index 83b4adefbc..895c315971 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -44,6 +44,8 @@ public class GlobalVariablesManager extends AbstractVariables
// Public variable names
public static final String DAILY_TASK_RESET = "DAILY_TASK_RESET";
public static final String MONSTER_ARENA_VARIABLE = "MA_C";
+ public static final String RANKING_POWER_COOLDOWN = "RANKING_POWER_COOLDOWN";
+ public static final String RANKING_POWER_LOCATION = "RANKING_POWER_LOCATION";
public static final String PURGE_REWARD_TIME = "PURGE_REWARD_TIME";
protected GlobalVariablesManager()
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
new file mode 100644
index 0000000000..69757847b1
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/RankingPowerManager.java
@@ -0,0 +1,135 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledFuture;
+
+import org.l2jmobius.commons.threads.ThreadPool;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.data.xml.NpcData;
+import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.instance.Decoy;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.events.AbstractScript;
+import org.l2jmobius.gameserver.model.holders.SkillHolder;
+import org.l2jmobius.gameserver.model.skill.BuffInfo;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+import org.l2jmobius.gameserver.util.Broadcast;
+
+/**
+ * @author Serenitty
+ */
+public class RankingPowerManager
+{
+ private static final int COOLDOWN = 43200000;
+ private static final int LEADER_STATUE = 18485;
+ private static final SkillHolder LEADER_POWER = new SkillHolder(52018, 1);
+
+ private Decoy _decoyInstance;
+ private ScheduledFuture> _decoyTask;
+
+ protected RankingPowerManager()
+ {
+ reset();
+ }
+
+ public void activatePower(Player player)
+ {
+ final Location location = player.getLocation();
+ final List array = new ArrayList<>(3);
+ array.add(location.getX());
+ array.add(location.getY());
+ array.add(location.getZ());
+ GlobalVariablesManager.getInstance().setIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION, array);
+ GlobalVariablesManager.getInstance().set(GlobalVariablesManager.RANKING_POWER_COOLDOWN, System.currentTimeMillis() + COOLDOWN);
+ createClone(player);
+ cloneTask();
+ final SystemMessage msg = new SystemMessage(SystemMessageId.A_RANKING_LEADER_C1_USED_LEADER_POWER_IN_S2);
+ msg.addString(player.getName());
+ msg.addZoneName(location.getX(), location.getY(), location.getZ()).toString();
+ Broadcast.toAllOnlinePlayers(msg);
+ }
+
+ private void createClone(Player player)
+ {
+ final Location location = player.getLocation();
+
+ final NpcTemplate template = NpcData.getInstance().getTemplate(LEADER_STATUE);
+ _decoyInstance = new Decoy(template, player, COOLDOWN, false);
+ _decoyInstance.setTargetable(false);
+ _decoyInstance.setImmobilized(true);
+ _decoyInstance.setInvul(true);
+ _decoyInstance.spawnMe(location.getX(), location.getY(), location.getZ());
+ _decoyInstance.setHeading(location.getHeading());
+ _decoyInstance.broadcastStatusUpdate();
+
+ AbstractScript.addSpawn(null, LEADER_STATUE, location, false, COOLDOWN);
+ }
+
+ private void cloneTask()
+ {
+ _decoyTask = ThreadPool.scheduleAtFixedRate(() ->
+ {
+ World.getInstance().forEachVisibleObjectInRange(_decoyInstance, Player.class, 300, nearby ->
+ {
+ final BuffInfo info = nearby.getEffectList().getBuffInfoBySkillId(LEADER_POWER.getSkillId());
+ if ((info == null) || (info.getTime() < (LEADER_POWER.getSkill().getAbnormalTime() - 60)))
+ {
+ nearby.sendPacket(new MagicSkillUse(_decoyInstance, nearby, LEADER_POWER.getSkillId(), LEADER_POWER.getSkillLevel(), 0, 0));
+ LEADER_POWER.getSkill().applyEffects(_decoyInstance, nearby);
+ }
+ });
+ if (Rnd.nextBoolean()) // Add some randomness?
+ {
+ ThreadPool.schedule(() -> _decoyInstance.broadcastSocialAction(2), 4500);
+ }
+ }, 1000, 10000);
+
+ ThreadPool.schedule(this::reset, COOLDOWN);
+ }
+
+ public void reset()
+ {
+ if (_decoyTask != null)
+ {
+ _decoyTask.cancel(false);
+ _decoyTask = null;
+ }
+ if (_decoyInstance != null)
+ {
+ _decoyInstance.deleteMe();
+ }
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_COOLDOWN);
+ GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ }
+
+ public static RankingPowerManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final RankingPowerManager INSTANCE = new RankingPowerManager();
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index 9090c44ef3..a8b488b6c4 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -153,6 +153,8 @@ import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRando
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftLockSlot;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftMake;
import org.l2jmobius.gameserver.network.clientpackets.randomcraft.ExRequestRandomCraftRefresh;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharBuffzoneNpcPosition;
+import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestExRankingCharSpawnBuffzoneNpc;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
@@ -597,8 +599,8 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_RANKING_CHAR_INFO(0x181, RequestRankingCharInfo::new, ConnectionState.IN_GAME),
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_RANKERS(0x183, RequestRankingCharRankers::new, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, null, ConnectionState.IN_GAME),
- EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, null, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, RequestExRankingCharSpawnBuffzoneNpc::new, ConnectionState.IN_GAME),
+ EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, RequestExRankingCharBuffzoneNpcPosition::new, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_INFO(0x187, ExMCWCastleInfo::new, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x188, null, ConnectionState.IN_GAME),
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
new file mode 100644
index 0000000000..72cc95be26
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharBuffzoneNpcPosition.java
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.RankManager;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharBuffzoneNpcPosition implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final int ranker = RankManager.getInstance().getPlayerGlobalRank(player);
+ if (ranker == 1)
+ {
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
new file mode 100644
index 0000000000..8736aafb13
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/ranking/RequestExRankingCharSpawnBuffzoneNpc.java
@@ -0,0 +1,76 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.ranking;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingBuffZoneNpcPosition;
+
+/**
+ * @author Serenitty
+ */
+public class RequestExRankingCharSpawnBuffzoneNpc implements IClientIncomingPacket
+{
+ private static final int COST = 20000000;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ player.sendPacket(SystemMessageId.LEADER_POWER_COOLDOWN);
+ return;
+ }
+
+ if (!player.destroyItemByItemId("Adena", 57, COST, player, true))
+ {
+ player.sendPacket(SystemMessageId.NOT_ENOUGH_MONEY_TO_USE_THE_FUNCTION);
+ return;
+ }
+
+ if (!player.isInsideZone(ZoneId.PEACE) || player.isInStoreMode() || !World.getInstance().getVisibleObjectsInRange(player, Creature.class, 50).isEmpty())
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_USE_LEADER_POWER_HERE);
+ return;
+ }
+
+ RankingPowerManager.getInstance().activatePower(player);
+ player.sendPacket(new ExRankingBuffZoneNpcPosition());
+ player.sendPacket(new ExRankingBuffZoneNpcInfo());
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
new file mode 100644
index 0000000000..ab9cc539fb
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcInfo.java
@@ -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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.concurrent.TimeUnit;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcInfo implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcInfo()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_INFO.writeId(packet);
+ final long cooldown = GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0);
+ final long currentTime = System.currentTimeMillis();
+ if (cooldown > currentTime)
+ {
+ final long reuseTime = TimeUnit.MILLISECONDS.toSeconds(cooldown - currentTime);
+ packet.writeD((int) reuseTime);
+ }
+ else
+ {
+ packet.writeD(0);
+ }
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
new file mode 100644
index 0000000000..9439ddb93f
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ranking/ExRankingBuffZoneNpcPosition.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.network.serverpackets.ranking;
+
+import java.util.List;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Serenitty
+ */
+public class ExRankingBuffZoneNpcPosition implements IClientOutgoingPacket
+{
+ public ExRankingBuffZoneNpcPosition()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RANKING_CHAR_BUFFZONE_NPC_POSITION.writeId(packet);
+ if (GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.RANKING_POWER_COOLDOWN, 0) > System.currentTimeMillis())
+ {
+ final List location = GlobalVariablesManager.getInstance().getIntegerList(GlobalVariablesManager.RANKING_POWER_LOCATION);
+ packet.writeC(1);
+ packet.writeD(location.get(0));
+ packet.writeD(location.get(1));
+ packet.writeD(location.get(2));
+ }
+ else
+ {
+ packet.writeC(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ packet.writeD(0);
+ }
+ return true;
+ }
+}