Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
- index d63fabd..3282c6d 100644
- --- a/aCis_gameserver/java/net/sf/l2j/Config.java
- +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
- @@ -46,6 +46,16 @@
- public static final String VALORANT_RESTRICT_FILE = "./config/ValorantRestricts.properties";
- public static final String GRAND_BOSS_FILE = "./config/GrandBoss.properties";
- + /** Character Killing Monument settings */
- + public static boolean CKM_ENABLED;
- + public static long CKM_CYCLE_LENGTH;
- + public static String CKM_PVP_NPC_TITLE;
- + public static int CKM_PVP_NPC_TITLE_COLOR;
- + public static int CKM_PVP_NPC_NAME_COLOR;
- + public static String CKM_PK_NPC_TITLE;
- + public static int CKM_PK_NPC_TITLE_COLOR;
- + public static int CKM_PK_NPC_NAME_COLOR;
- +
- public static List<Integer> BOW_IDS = new ArrayList<>();
- public static List<Integer> DUAL_IDS = new ArrayList<>();
- public static List<Integer> SWORD_IDS = new ArrayList<>();
- @@ -2744,6 +2754,14 @@
- FORBIDDEN_WORDS = custom.getProperty("ForbiddenWords", "").split(",");
- ENABLE_BAN_FROM_EVENT = custom.getProperty("EnableEventBans", true);
- BANNED_EVENT_PLAYERS = custom.getProperty("BannedEventPlayers", "").split(",");
- + CKM_ENABLED = custom.getProperty("CKMEnabled", false);
- + CKM_CYCLE_LENGTH = custom.getProperty("CKMCycleLength", 86400000);
- + CKM_PVP_NPC_TITLE = custom.getProperty("CKMPvPNpcTitle", "%kills% PvPs in the last 24h");
- + CKM_PVP_NPC_TITLE_COLOR = Integer.decode("0x" + custom.getProperty("CKMPvPNpcTitleColor", "88AA88"));
- + CKM_PVP_NPC_NAME_COLOR = Integer.decode("0x" + custom.getProperty("CKMPvPNpcNameColor", "FFFFFF"));
- + CKM_PK_NPC_TITLE = custom.getProperty("CKMPKNpcTitle", "%kills% PKs in the last 24h");
- + CKM_PK_NPC_TITLE_COLOR = Integer.decode("0x" + custom.getProperty("CKMPKNpcTitleColor", "00CCFF"));
- + CKM_PK_NPC_NAME_COLOR = Integer.decode("0x" + custom.getProperty("CKMPKNpcNameColor", "FFFFFF"));
- }
- private static final void loadGrandBoss()
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- index 61483fb..f536c3a 100644
- --- a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- @@ -33,6 +33,7 @@
- import net.sf.l2j.gameserver.data.manager.BuyListManager;
- import net.sf.l2j.gameserver.data.manager.CastleManager;
- import net.sf.l2j.gameserver.data.manager.CastleManorManager;
- +import net.sf.l2j.gameserver.data.manager.CharacterKillingManager;
- import net.sf.l2j.gameserver.data.manager.ClanHallManager;
- import net.sf.l2j.gameserver.data.manager.CoupleManager;
- import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
- @@ -383,6 +384,10 @@
- System.out.println("FarmZoneScheduler class has been loaded with "+FarmZoneScheduler.getInstance().farmZones.size()+" zones.");
- }
- FakeOnline.restoreFakePlayers();
- + if (Config.CKM_ENABLED)
- + {
- + CharacterKillingManager.getInstance().init();
- + }
- StringUtil.printSection("GrandBosses");
- if(Config.ANT_QUEEN_ENABLE)
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/CharacterKillingManager.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/CharacterKillingManager.java
- new file mode 100644
- index 0000000..b622fb1
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/manager/CharacterKillingManager.java
- @@ -0,0 +1,321 @@
- +/*
- + * 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 net.sf.l2j.gameserver.data.manager;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.Statement;
- +import java.util.List;
- +import java.util.concurrent.CopyOnWriteArrayList;
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.concurrent.TimeUnit;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.commons.pool.ConnectionPool;
- +import net.sf.l2j.commons.pool.ThreadPool;
- +import net.sf.l2j.gameserver.model.CharSelectSlot;
- +import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
- +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
- +
- +/**
- + * @author paytaly
- + */
- +public final class CharacterKillingManager
- +{
- + private static final Logger _log = Logger.getLogger(CharacterKillingManager.class.getName());
- +
- + private int _cycle = 0;
- + private long _cycleStart = 0L;
- + private int _winnerPvPKills;
- + private int _winnerPvPKillsCount;
- + private int _winnerPKKills;
- + private int _winnerPKKillsCount;
- +
- + private volatile CharSelectSlot _winnerPvPKillsInfo;
- + private volatile CharSelectSlot _winnerPKKillsInfo;
- +
- + private ScheduledFuture<?> _scheduledKillingCycleTask = null;
- +
- + private List<L2PcPolymorph> pvpMorphListeners = new CopyOnWriteArrayList<>();
- + private List<L2PcPolymorph> pkMorphListeners = new CopyOnWriteArrayList<>();
- +
- + protected CharacterKillingManager()
- + {
- + }
- +
- + public synchronized void init()
- + {
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement st = con.prepareStatement("SELECT cycle, cycle_start, winner_pvpkills, winner_pvpkills_count, winner_pkkills, winner_pkkills_count FROM character_kills_info ORDER BY cycle_start DESC LIMIT 1");
- + ResultSet rs = st.executeQuery())
- + {
- + if (rs.next())
- + {
- + _cycle = rs.getInt("cycle");
- + _cycleStart = rs.getLong("cycle_start");
- + _winnerPvPKills = rs.getInt("winner_pvpkills");
- + _winnerPvPKillsCount = rs.getInt("winner_pvpkills_count");
- + _winnerPKKills = rs.getInt("winner_pkkills");
- + _winnerPKKillsCount = rs.getInt("winner_pkkills_count");
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not load characters killing cycle: " + e.getMessage(), e);
- + }
- +
- + broadcastMorphUpdate();
- +
- + if (_scheduledKillingCycleTask != null)
- + {
- + _scheduledKillingCycleTask.cancel(true);
- + }
- + long millisToNextCycle = (_cycleStart + Config.CKM_CYCLE_LENGTH) - System.currentTimeMillis();
- + _scheduledKillingCycleTask = ThreadPool.schedule(new CharacterKillingCycleTask(), millisToNextCycle);
- +
- + _log.info(getClass().getSimpleName() + ": Started! Cycle: " + _cycle + " - Next cycle in: " + _scheduledKillingCycleTask.getDelay(TimeUnit.SECONDS) + "s");
- + }
- +
- + public synchronized void newKillingCycle()
- + {
- + _cycleStart = System.currentTimeMillis();
- + computateCyclePvPWinner();
- + computateCyclePKWinner();
- + refreshKillingSnapshot();
- +
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement st = con.prepareStatement("INSERT INTO character_kills_info (cycle_start, winner_pvpkills, winner_pvpkills_count, winner_pkkills, winner_pkkills_count) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS))
- + {
- + st.setLong(1, _cycleStart);
- + st.setInt(2, _winnerPvPKills);
- + st.setInt(3, _winnerPvPKillsCount);
- + st.setInt(4, _winnerPKKills);
- + st.setInt(5, _winnerPKKillsCount);
- + st.execute();
- +
- + try (ResultSet rs = st.getGeneratedKeys())
- + {
- + if (rs.next())
- + {
- + _cycle = rs.getInt(1);
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not create characters killing cycle: " + e.getMessage(), e);
- + }
- +
- + broadcastMorphUpdate();
- +
- + if (_scheduledKillingCycleTask != null)
- + {
- + _scheduledKillingCycleTask.cancel(true);
- + }
- + _scheduledKillingCycleTask = ThreadPool.schedule(new CharacterKillingCycleTask(), Config.CKM_CYCLE_LENGTH);
- + }
- +
- + private void computateCyclePvPWinner()
- + {
- + _winnerPvPKills = 0;
- + _winnerPvPKillsCount = 0;
- + _winnerPvPKillsInfo = null;
- +
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement st = con.prepareStatement("SELECT c.obj_Id, (c.pvpkills - COALESCE(ck.pvpkills, 0)) pvpkills FROM characters c LEFT JOIN character_kills_snapshot ck ON ck.charId = c.obj_Id WHERE accesslevel = 0 ORDER BY pvpkills DESC LIMIT 1");
- + ResultSet rs = st.executeQuery();)
- + {
- + if (rs.next())
- + {
- + int kills = rs.getInt(2);
- + if (kills > 0)
- + {
- + _winnerPvPKills = rs.getInt(1);
- + _winnerPvPKillsCount = kills;
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not computate characters killing cycle winners: " + e.getMessage(), e);
- + }
- + }
- +
- + private void computateCyclePKWinner()
- + {
- + _winnerPKKills = 0;
- + _winnerPKKillsCount = 0;
- + _winnerPKKillsInfo = null;
- +
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement st = con.prepareStatement("SELECT c.obj_Id, (c.pkkills - COALESCE(ck.pkkills, 0)) pkkills FROM characters c LEFT JOIN character_kills_snapshot ck ON ck.charId = c.obj_Id WHERE accesslevel = 0 ORDER BY pkkills DESC LIMIT 1");
- + ResultSet rs = st.executeQuery();)
- + {
- + if (rs.next())
- + {
- + int kills = rs.getInt(2);
- + if (kills > 0)
- + {
- + _winnerPKKills = rs.getInt(1);
- + _winnerPKKillsCount = kills;
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not computate characters killing cycle winners: " + e.getMessage(), e);
- + }
- + }
- +
- + private static void refreshKillingSnapshot()
- + {
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement stTruncate = con.prepareStatement("TRUNCATE TABLE character_kills_snapshot");
- + PreparedStatement stRefresh = con.prepareStatement("INSERT INTO character_kills_snapshot (charId, pvpkills, pkkills) SELECT obj_Id, pvpkills, pkkills FROM characters WHERE (pvpkills > 0 OR pkkills > 0) AND accesslevel = 0"))
- + {
- + stTruncate.executeUpdate();
- + stRefresh.executeUpdate();
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not refresh characters killing snapshot: " + e.getMessage(), e);
- + }
- + }
- +
- + public void broadcastMorphUpdate()
- + {
- + final CharSelectSlot winnerPvPKillsInfo = getWinnerPvPKillsInfo();
- + for (L2PcPolymorph npc : pvpMorphListeners)
- + {
- + broadcastPvPMorphUpdate(npc, winnerPvPKillsInfo);
- + }
- +
- + final CharSelectSlot winnerPKKillsInfo = getWinnerPKKillsInfo();
- + for (L2PcPolymorph npc : pkMorphListeners)
- + {
- + broadcastPKMorphUpdate(npc, winnerPKKillsInfo);
- + }
- + }
- +
- + private void broadcastPvPMorphUpdate(L2PcPolymorph npc, CharSelectSlot winnerPvPKillsInfo)
- + {
- + if (winnerPvPKillsInfo == null)
- + {
- + npc.setPolymorphInfo(null);
- + return;
- + }
- + npc.setVisibleTitle(Config.CKM_PVP_NPC_TITLE.replaceAll("%kills%", String.valueOf(_winnerPvPKillsCount)));
- + npc.setTitleColor(Config.CKM_PVP_NPC_TITLE_COLOR);
- + npc.setNameColor(Config.CKM_PVP_NPC_NAME_COLOR);
- + npc.setPolymorphInfo(winnerPvPKillsInfo);
- + npc.broadcastPacket(new SocialAction(npc, 16));
- + }
- +
- + private void broadcastPKMorphUpdate(L2PcPolymorph npc, CharSelectSlot winnerPKKillsInfo)
- + {
- + if (winnerPKKillsInfo == null)
- + {
- + npc.setPolymorphInfo(null);
- + return;
- + }
- + npc.setVisibleTitle(Config.CKM_PK_NPC_TITLE.replaceAll("%kills%", String.valueOf(_winnerPKKillsCount)));
- + npc.setTitleColor(Config.CKM_PK_NPC_TITLE_COLOR);
- + npc.setNameColor(Config.CKM_PK_NPC_NAME_COLOR);
- + npc.setPolymorphInfo(winnerPKKillsInfo);
- + npc.broadcastPacket(new SocialAction(npc, 16));
- + }
- +
- + public boolean addPvPMorphListener(L2PcPolymorph npc)
- + {
- + if (npc == null)
- + {
- + return false;
- + }
- + broadcastPvPMorphUpdate(npc, getWinnerPvPKillsInfo());
- + return pvpMorphListeners.add(npc);
- + }
- +
- + public boolean removePvPMorphListener(L2PcPolymorph npc)
- + {
- + return pvpMorphListeners.remove(npc);
- + }
- +
- + public boolean addPKMorphListener(L2PcPolymorph npc)
- + {
- + if (npc == null)
- + {
- + return false;
- + }
- + broadcastPKMorphUpdate(npc, getWinnerPKKillsInfo());
- + return pkMorphListeners.add(npc);
- + }
- +
- + public boolean removePKMorphListener(L2PcPolymorph npc)
- + {
- + return pkMorphListeners.remove(npc);
- + }
- +
- + private CharSelectSlot getWinnerPvPKillsInfo()
- + {
- + if (_winnerPvPKills != 0 && _winnerPvPKillsInfo == null)
- + {
- + synchronized (this)
- + {
- + if (_winnerPvPKillsInfo == null)
- + {
- + _winnerPvPKillsInfo = L2PcPolymorph.loadCharInfo(_winnerPvPKills);
- + }
- + }
- + }
- + return _winnerPvPKillsInfo;
- + }
- +
- + private CharSelectSlot getWinnerPKKillsInfo()
- + {
- + if (_winnerPKKills != 0 && _winnerPKKillsInfo == null)
- + {
- + synchronized (this)
- + {
- + if (_winnerPKKillsInfo == null)
- + {
- + _winnerPKKillsInfo = L2PcPolymorph.loadCharInfo(_winnerPKKills);
- + }
- + }
- + }
- + return _winnerPKKillsInfo;
- + }
- +
- + protected static class CharacterKillingCycleTask implements Runnable
- + {
- + @Override
- + public void run()
- + {
- + CharacterKillingManager.getInstance().newKillingCycle();
- + }
- + }
- +
- + public static CharacterKillingManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final CharacterKillingManager _instance = new CharacterKillingManager();
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java
- new file mode 100644
- index 0000000..a2ae249
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java
- @@ -0,0 +1,192 @@
- +/*
- + * 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 net.sf.l2j.gameserver.model.actor;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.pool.ConnectionPool;
- +import net.sf.l2j.gameserver.enums.Paperdoll;
- +import net.sf.l2j.gameserver.model.CharSelectSlot;
- +import net.sf.l2j.gameserver.model.WorldObject;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcInfoPolymorph;
- +
- +/**
- + * @author paytaly
- + */
- +public class L2PcPolymorph extends Npc
- +{
- + private static final Logger _log = Logger.getLogger(L2PcPolymorph.class.getName());
- + private CharSelectSlot _polymorphInfo;
- + private int _nameColor = 0xFFFFFF;
- + private int _titleColor = 0xFFFF77;
- + private String _visibleTitle = "";
- +
- + public L2PcPolymorph(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + setInvul(true);
- + }
- +
- + @Override
- + public boolean hasRandomAnimation()
- + {
- + return false;
- + }
- +
- + public CharSelectSlot getPolymorphInfo()
- + {
- + return _polymorphInfo;
- + }
- +
- + public void setPolymorphInfo(CharSelectSlot polymorphInfo)
- + {
- + _polymorphInfo = polymorphInfo;
- +
- + for (WorldObject object : getKnownType(Player.class))
- + {
- + if (object instanceof Player)
- + {
- + sendInfo(object.getActingPlayer());
- + }
- + }
- + }
- +
- + public int getNameColor()
- + {
- + return _nameColor;
- + }
- +
- + public void setNameColor(int nameColor)
- + {
- + _nameColor = nameColor;
- + }
- +
- + public int getTitleColor()
- + {
- + return _titleColor;
- + }
- +
- + public void setTitleColor(int titleColor)
- + {
- + _titleColor = titleColor;
- + }
- +
- + public String getVisibleTitle()
- + {
- + return _visibleTitle;
- + }
- +
- + public void setVisibleTitle(String title)
- + {
- + _visibleTitle = title == null ? "" : title;
- + }
- +
- + @Override
- + public void sendInfo(Player activeChar)
- + {
- + if (getPolymorphInfo() == null)
- + {
- + super.sendInfo(activeChar);
- + return;
- + }
- +
- + activeChar.sendPacket(new NpcInfoPolymorph(this));
- + }
- +
- + @Override
- + public String getHtmlPath(int npcId, int val)
- + {
- + String pom = "" + npcId;
- + if (val != 0)
- + {
- + pom += "-" + val;
- + }
- + return "data/html/polymorph/" + pom + ".htm";
- + }
- +
- + @Override
- + public void showChatWindow(Player player, int val)
- + {
- + String filename = getHtmlPath(getNpcId(), val);
- +
- + // Send a Server->Client NpcHtmlMessage containing the text of the Npc to the Player
- + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile(filename);
- + html.replace("%objectId%", getObjectId());
- + html.replace("%ownername%", getPolymorphInfo() != null ? getPolymorphInfo().getName() : "");
- + player.sendPacket(html);
- +
- + // Send a Server->Client ActionFailed to the Player in order to avoid that the client wait another packet
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- +
- + public static CharSelectSlot loadCharInfo(int objectId)
- + {
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT char_name, race, base_class, classid, sex, face, hairStyle, hairColor, clanid FROM characters WHERE obj_Id = ?"))
- + {
- + statement.setInt(1, objectId);
- +
- + try (ResultSet rs = statement.executeQuery())
- + {
- + if (rs.next())
- + {
- + final CharSelectSlot charInfo = new CharSelectSlot(objectId, rs.getString("char_name"));
- + charInfo.setRace(rs.getInt("race"));
- + charInfo.setBaseClassId(rs.getInt("base_class"));
- + charInfo.setClassId(rs.getInt("classid"));
- + charInfo.setSex(rs.getInt("sex"));
- + charInfo.setFace(rs.getInt("face"));
- + charInfo.setHairStyle(rs.getInt("hairStyle"));
- + charInfo.setHairColor(rs.getInt("hairColor"));
- + charInfo.setClanId(rs.getInt("clanid"));
- +
- + // Get the augmentation id for equipped weapon
- + int weaponObjId = charInfo.getPaperdollObjectId(Paperdoll.RHAND);
- + if (weaponObjId > 0)
- + {
- + try (PreparedStatement statementAugment = con.prepareStatement("SELECT attributes FROM augmentations WHERE item_oid = ?"))
- + {
- + statementAugment.setInt(1, weaponObjId);
- + try (ResultSet rsAugment = statementAugment.executeQuery())
- + {
- + if (rsAugment.next())
- + {
- + int augment = rsAugment.getInt("attributes");
- + charInfo.setAugmentationId(augment == -1 ? 0 : augment);
- + }
- + }
- + }
- + }
- +
- + return charInfo;
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not Load characters killing snapshot: " + e.getMessage(), e);
- + }
- +
- + return null;
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java
- new file mode 100644
- index 0000000..6a6c21b
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java
- @@ -0,0 +1,51 @@
- +/*
- + * 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 net.sf.l2j.gameserver.model.actor.instance;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.manager.CharacterKillingManager;
- +import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +
- +/**
- + * @author paytaly
- + */
- +public class L2TopPKMonumentInstance extends L2PcPolymorph
- +{
- + public L2TopPKMonumentInstance(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onSpawn()
- + {
- + super.onSpawn();
- + if (Config.CKM_ENABLED)
- + {
- + CharacterKillingManager.getInstance().addPKMorphListener(this);
- + }
- + }
- +
- + @Override
- + public void deleteMe()
- + {
- + super.deleteMe();
- + if (Config.CKM_ENABLED)
- + {
- + CharacterKillingManager.getInstance().removePKMorphListener(this);
- + }
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java
- new file mode 100644
- index 0000000..6235ee7
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java
- @@ -0,0 +1,51 @@
- +/*
- + * 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 net.sf.l2j.gameserver.model.actor.instance;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.manager.CharacterKillingManager;
- +import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +
- +/**
- + * @author paytaly
- + */
- +public class L2TopPvPMonumentInstance extends L2PcPolymorph
- +{
- + public L2TopPvPMonumentInstance(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onSpawn()
- + {
- + super.onSpawn();
- + if (Config.CKM_ENABLED)
- + {
- + CharacterKillingManager.getInstance().addPvPMorphListener(this);
- + }
- + }
- +
- + @Override
- + public void deleteMe()
- + {
- + super.deleteMe();
- + if (Config.CKM_ENABLED)
- + {
- + CharacterKillingManager.getInstance().removePvPMorphListener(this);
- + }
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java
- new file mode 100644
- index 0000000..1322c34
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java
- @@ -0,0 +1,203 @@
- +/*
- + * 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 net.sf.l2j.gameserver.network.serverpackets;
- +
- +import net.sf.l2j.gameserver.data.sql.ClanTable;
- +import net.sf.l2j.gameserver.data.xml.PlayerData;
- +import net.sf.l2j.gameserver.enums.Paperdoll;
- +import net.sf.l2j.gameserver.model.CharSelectSlot;
- +import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
- +import net.sf.l2j.gameserver.model.actor.template.PlayerTemplate;
- +import net.sf.l2j.gameserver.model.pledge.Clan;
- +
- +/**
- + * @author paytaly
- + */
- +public final class NpcInfoPolymorph extends L2GameServerPacket
- +{
- + private final L2PcPolymorph _activeChar;
- + private final CharSelectSlot _morph;
- + private final PlayerTemplate _template;
- + private final Clan _clan;
- + private final int _x, _y, _z, _heading;
- + private final int _mAtkSpd, _pAtkSpd;
- + private final int _runSpd, _walkSpd;
- + private final float _moveMultiplier;
- +
- + public NpcInfoPolymorph(L2PcPolymorph cha)
- + {
- + _activeChar = cha;
- + _morph = cha.getPolymorphInfo();
- + _template = PlayerData.getInstance().getTemplate(_morph.getBaseClassId());
- + _clan = ClanTable.getInstance().getClan(_morph.getClanId());
- +
- + _x = _activeChar.getX();
- + _y = _activeChar.getY();
- + _z = _activeChar.getZ();
- + _heading = _activeChar.getHeading();
- +
- + _mAtkSpd = _activeChar.getStatus().getMAtkSpd();
- + _pAtkSpd = _activeChar.getStatus().getPAtkSpd();
- +
- + _moveMultiplier = _activeChar.getStatus().getMovementSpeedMultiplier();
- + _runSpd = (int) (_activeChar.getStatus().getMoveSpeed() / _moveMultiplier);
- + _walkSpd = (int) (_activeChar.getStatus().getBaseWalkSpeed() / _moveMultiplier);
- + }
- +
- + @Override
- + protected final void writeImpl()
- + {
- + writeC(0x03);
- + writeD(_x);
- + writeD(_y);
- + writeD(_z);
- + writeD(_heading);
- + writeD(_activeChar.getObjectId());
- + writeS(_morph.getName());
- + writeD(_morph.getRace());
- + writeD(_morph.getSex());
- +
- + writeD(_morph.getBaseClassId());
- +
- + writeD(_morph.getPaperdollItemId(Paperdoll.HAIRALL));
- + writeD(_morph.getPaperdollItemId(Paperdoll.HEAD));
- + writeD(_morph.getPaperdollItemId(Paperdoll.RHAND));
- + writeD(_morph.getPaperdollItemId(Paperdoll.LHAND));
- + writeD(_morph.getPaperdollItemId(Paperdoll.GLOVES));
- + writeD(_morph.getPaperdollItemId(Paperdoll.CHEST));
- + writeD(_morph.getPaperdollItemId(Paperdoll.LEGS));
- + writeD(_morph.getPaperdollItemId(Paperdoll.FEET));
- + writeD(_morph.getPaperdollItemId(Paperdoll.CLOAK));
- + writeD(_morph.getPaperdollItemId(Paperdoll.RHAND));
- + writeD(_morph.getPaperdollItemId(Paperdoll.HAIR));
- + writeD(_morph.getPaperdollItemId(Paperdoll.FACE));
- +
- + // c6 new h's
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeD(_morph.getAugmentationId());
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeD(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- + writeH(0x00);
- +
- + writeD(0);
- + writeD(0);
- +
- + writeD(_mAtkSpd);
- + writeD(_pAtkSpd);
- +
- + writeD(0);
- + writeD(0);
- +
- + writeD(_runSpd);
- + writeD(_walkSpd);
- + writeD(_runSpd); // swim run speed
- + writeD(_walkSpd); // swim walk speed
- + writeD(_runSpd); // fl run speed
- + writeD(_walkSpd); // fl walk speed
- + writeD(_runSpd); // fly run speed
- + writeD(_walkSpd); // fly walk speed
- + writeF(_activeChar.getStatus().getMovementSpeedMultiplier());
- + writeF(_activeChar.getStatus().getAttackSpeedMultiplier());
- +
- + writeF(_template.getCollisionRadius());
- + writeF(_template.getCollisionHeight());
- +
- + writeD(_morph.getHairStyle());
- + writeD(_morph.getHairColor());
- + writeD(_morph.getFace());
- +
- + writeS(_activeChar.getVisibleTitle());
- +
- + if (_clan != null)
- + {
- + writeD(_clan.getClanId());
- + writeD(_clan.getCrestId());
- + writeD(_clan.getAllyId());
- + writeD(_clan.getAllyCrestId());
- + }
- + else
- + {
- + writeD(0);
- + writeD(0);
- + writeD(0);
- + writeD(0);
- + }
- +
- + writeD(0);
- +
- + writeC(1); // standing = 1 sitting = 0
- + writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
- + writeC(_activeChar.isInCombat() ? 1 : 0);
- + writeC(_activeChar.isAlikeDead() ? 1 : 0);
- +
- + writeC(0); // invisible = 1 visible =0
- +
- + writeC(0); // 1 on strider 2 on wyvern 0 no mount
- + writeC(0); // 1 - sellshop
- +
- + writeH(0);
- +
- + writeC(0);
- +
- + writeD(_activeChar.getAbnormalEffect());
- +
- + writeC(0);
- + writeH(0); // Blue value for name (0 = white, 255 = pure blue)
- + writeD(_morph.getClassId());
- +
- + writeD(_activeChar.getStatus().getMaxCp());
- + writeD((int) _activeChar.getStatus().getMaxCp());
- + writeC((_morph.getEnchantEffect() > 127) ? 127 : _morph.getEnchantEffect());
- +
- + writeC(0x00); // team circle around feet 1= Blue, 2 = red
- +
- + writeD(_clan != null ? _clan.getCrestLargeId() : 0);
- + writeC(0); // Symbol on char menu ctrl+I
- + writeC(0); // Hero Aura
- +
- + writeC(0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
- + writeD(0);
- + writeD(0);
- + writeD(0);
- +
- + writeD(_activeChar.getNameColor());
- +
- + writeD(0x00); // isRunning() as in UserInfo?
- +
- + writeD(0);
- + writeD(0);
- +
- + writeD(_activeChar.getTitleColor());
- +
- + writeD(0x00);
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment