Addition of Ranking Power system.
Contributed by Serenitty.
This commit is contained in:
parent
21ad2477c8
commit
596851c7e8
@ -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);
|
||||
|
@ -88,7 +88,36 @@
|
||||
<skill id="52018" toLevel="1" name="Leader Power">
|
||||
<!-- STR +1 INT +1 P. Evasion +20 HP Recovery Potions' Effect +10 -->
|
||||
<icon>icon.skill0000</icon>
|
||||
<operateType>A1</operateType>
|
||||
<abnormalTime>14600</abnormalTime>
|
||||
<stayAfterDeath>true</stayAfterDeath>
|
||||
<castRange>300</castRange>
|
||||
<effectRange>315</effectRange>
|
||||
<isMagic>2</isMagic>
|
||||
<operateType>A2</operateType>
|
||||
<targetType>SELF</targetType>
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>STR</stat>
|
||||
</effect>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>INT</stat>
|
||||
</effect>
|
||||
<effect name="PhysicalEvasion">
|
||||
<amount>20</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
<effect name="SkillEvasion">
|
||||
<magicType>0</magicType>
|
||||
<amount>20</amount>
|
||||
</effect>
|
||||
<effect name="AdditionalPotionHp">
|
||||
<amount>10</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
</effects>
|
||||
</skill>
|
||||
<skill id="52019" toLevel="1" name="PvP Ranking">
|
||||
<!-- Bonus for the 1st-3rd places in PvP Ranking. When you have killed, you can see a special visual effect for a short period of time. -->
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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();
|
||||
}
|
||||
}
|
@ -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<GameClient>
|
||||
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),
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 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;
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -88,7 +88,36 @@
|
||||
<skill id="52018" toLevel="1" name="Leader Power">
|
||||
<!-- STR +1 INT +1 P. Evasion +20 HP Recovery Potions' Effect +10 -->
|
||||
<icon>icon.skill0000</icon>
|
||||
<operateType>A1</operateType>
|
||||
<abnormalTime>14600</abnormalTime>
|
||||
<stayAfterDeath>true</stayAfterDeath>
|
||||
<castRange>300</castRange>
|
||||
<effectRange>315</effectRange>
|
||||
<isMagic>2</isMagic>
|
||||
<operateType>A2</operateType>
|
||||
<targetType>SELF</targetType>
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>STR</stat>
|
||||
</effect>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>INT</stat>
|
||||
</effect>
|
||||
<effect name="PhysicalEvasion">
|
||||
<amount>20</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
<effect name="SkillEvasion">
|
||||
<magicType>0</magicType>
|
||||
<amount>20</amount>
|
||||
</effect>
|
||||
<effect name="AdditionalPotionHp">
|
||||
<amount>10</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
</effects>
|
||||
</skill>
|
||||
<skill id="52019" toLevel="1" name="PvP Ranking">
|
||||
<!-- Bonus for the 1st-3rd places in PvP Ranking. When you have killed, you can see a special visual effect for a short period of time. -->
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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();
|
||||
}
|
||||
}
|
@ -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<GameClient>
|
||||
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),
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 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;
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -88,7 +88,36 @@
|
||||
<skill id="52018" toLevel="1" name="Leader Power">
|
||||
<!-- STR +1 INT +1 P. Evasion +20 HP Recovery Potions' Effect +10 -->
|
||||
<icon>icon.skill0000</icon>
|
||||
<operateType>A1</operateType>
|
||||
<abnormalTime>14600</abnormalTime>
|
||||
<stayAfterDeath>true</stayAfterDeath>
|
||||
<castRange>300</castRange>
|
||||
<effectRange>315</effectRange>
|
||||
<isMagic>2</isMagic>
|
||||
<operateType>A2</operateType>
|
||||
<targetType>SELF</targetType>
|
||||
<affectScope>SINGLE</affectScope>
|
||||
<effects>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>STR</stat>
|
||||
</effect>
|
||||
<effect name="StatUp">
|
||||
<amount>1</amount>
|
||||
<stat>INT</stat>
|
||||
</effect>
|
||||
<effect name="PhysicalEvasion">
|
||||
<amount>20</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
<effect name="SkillEvasion">
|
||||
<magicType>0</magicType>
|
||||
<amount>20</amount>
|
||||
</effect>
|
||||
<effect name="AdditionalPotionHp">
|
||||
<amount>10</amount>
|
||||
<mode>DIFF</mode>
|
||||
</effect>
|
||||
</effects>
|
||||
</skill>
|
||||
<skill id="52019" toLevel="1" name="PvP Ranking">
|
||||
<!-- Bonus for the 1st-3rd places in PvP Ranking. When you have killed, you can see a special visual effect for a short period of time. -->
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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();
|
||||
}
|
||||
}
|
@ -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<GameClient>
|
||||
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),
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
@ -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 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;
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer> 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user