Jump to content
  • Sign Up
×
×
  • Create New...

Hondata

Moderator
  • Posts

    5
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Hondata's Achievements

  1. Saves all active toggle skills from player and it restores them back on revive. Ideal for a pvp zone or in general if u want to. Preview: Video //To save player effects (onDie) RestoreEffectsManager.getInstance().savePlayerEffects(player); //To Restore player effects (onRevive) RestoreEffectsManager.getInstance().restorePlayerEffects(player); Code for source: diff --git a/java/net/sf/l2j/gameserver/mods/RestoreEffects.java b/java/net/sf/l2j/gameserver/mods/RestoreEffects.java new file mode 100644 index 0000000..6b7ef6f --- /dev/null +++ a/java/net/sf/l2j/gameserver/mods/RestoreEffects.java @@ -0,0 +1,98 @@ +package net.sf.l2j.gameserver.mods.returneffects; + +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; +import net.sf.l2j.gameserver.model.actor.Player; +import net.sf.l2j.gameserver.skills.AbstractEffect; + +public class RestoreEffects +{ + final Map<Integer, AbstractEffect> _effects = new ConcurrentHashMap<>(); + Player _player = null; + private final AtomicInteger _intcounter = new AtomicInteger(); + + public RestoreEffects(Player player) + { + this._player = player; + } + + public void startSavingEffects() + { + for (AbstractEffect effect : _player.getAllEffects()) + { + final int counter = _intcounter.incrementAndGet(); + if (effect.getSkill().isToggle()) + _effects.put(counter, effect); + } + } + + public void restoreEffects() + { + for (AbstractEffect effect : getModEffects()) + { + _player.getCast().doToggleCast(effect.getSkill(), _player); + } + } + + public int effectsSize() + { + return _effects.size(); + } + + public Collection<AbstractEffect> getModEffects() + { + return _effects.values(); + } +} diff --git a/java/net/sf/l2j/gameserver/mods/RestoreEffectsManager.java b/java/net/sf/l2j/gameserver/mods/RestoreEffectsManager.java new file mode 100644 index 0000000..6b7ef6f --- /dev/null +++ a/java/net/sf/l2j/gameserver/mods/RestoreEffectsManager.java +package net.sf.l2j.gameserver.mods.returneffects; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import net.sf.l2j.gameserver.model.actor.Player; + +public class RestoreEffectsManager +{ + final Map<Integer, RestoreEffects> _effects = new ConcurrentHashMap<>(); + + public void savePlayerEffects(Player player) + { + if (player.getAllEffects() == null) + return; + + RestoreEffects modEffects = new RestoreEffects(player); + modEffects.startSavingEffects(); + _effects.put(player.getObjectId(), modEffects); + } + + public void restorePlayerEffects(Player player) + { + RestoreEffects rEffects = getPlayerEffects(player.getObjectId()); + + if (rEffects == null) + return; + + rEffects.restoreEffects(); + } + + public RestoreEffects getPlayerEffects(int plrObjId) + { + return _effects.get(plrObjId); + } + + public static final RestoreEffectsManager getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final RestoreEffectsManager _instance = new RestoreEffectsManager(); + } +} Credits for this mod: LordPanic (I have been approved to upload his codes)
  2. As title says. Note: You can change the colors etc from xml. code for source: diff --git a/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java b/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java new file mode 100644 index 0000000..6b7ef6f --- /dev/null +++ a/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java @@ -0,0 +1,98 @@ +package net.sf.l2j.gameserver.data.xml; + +import java.nio.file.Path; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import net.sf.l2j.commons.data.xml.IXmlReader; + +import net.sf.l2j.gameserver.model.actor.Player; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; + + +public class PvPColorSystem implements IXmlReader +{ + final Map<Integer, Integer> _nameColors = new ConcurrentHashMap<>(); + final Map<Integer, Integer> _titleColors = new ConcurrentHashMap<>(); + + public static PvPColorSystem getInstance() + { + return PvPColorSystem.SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final PvPColorSystem _instance = new PvPColorSystem(); + } + + public PvPColorSystem() + { + load(); + } + + @Override + public void load() + { + parseFile("./data/xml/pvpColors.xml"); + LOGGER.info("PvpColorSystem: loaded " + _nameColors.size() + " [Name] colors and " + _titleColors.size() + " [Title] colors."); + } + + public void setNameColors(int pvps, int color) + { + _nameColors.put(pvps, color); + } + + public void setTitleColors(int pvps, int color) + { + _titleColors.put(pvps, color); + } + + public void updateNameColor(Player player) + { + _nameColors.forEach((kills, color) -> + { + if (player.getPkKills() >= kills) + + player.getAppearance().setTitleColor(color); + }); + } + + public void updateTitleColor(Player player) + { + _titleColors.forEach((kills, color) -> + { + if (player.getPvpKills() >= kills) + + player.getAppearance().setNameColor(color); + }); + } + + @Override + public void parseDocument(Document doc, Path path) + { + forEach(doc, "list", listNode -> forEach(listNode, "pvpcolors", pvpColors -> + { + forEach(pvpColors, "pvp", pVp -> + { + forEach(pVp, "title", titleColors -> + { + final NamedNodeMap pvpCls = titleColors.getAttributes(); + setTitleColors(parseInteger(pvpCls, "pvpKills"), Integer.decode("0x" + parseString(pvpCls, "color"))); + + }); + }); + + forEach(pvpColors, "pk", pK -> + { + forEach(pK, "name", nameColors -> + { + final NamedNodeMap pkCls = nameColors.getAttributes(); + setNameColors(parseInteger(pkCls, "pkKills"), Integer.decode("0x" + parseString(pkCls, "color"))); + }); + }); + + })); + } +} diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java index a707ce5..d247e2e 100644 --- a/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java +++ b/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java import net.sf.l2j.gameserver.data.xml.MultisellData; import net.sf.l2j.gameserver.data.xml.NewbieBuffData; import net.sf.l2j.gameserver.data.xml.NpcData; import net.sf.l2j.gameserver.data.xml.PlayerData; import net.sf.l2j.gameserver.data.xml.PlayerLevelData; +import net.sf.l2j.gameserver.data.xml.PvPColorSystem; import net.sf.l2j.gameserver.data.xml.RecipeData; import net.sf.l2j.gameserver.data.xml.ScriptData; import net.sf.l2j.gameserver.data.xml.SkillTreeData; StringUtil.printSection("Four Sepulchers"); FourSepulchersManager.getInstance(); StringUtil.printSection("Quests & Scripts"); ScriptData.getInstance(); + PvPColorSystem.getInstance(); if (Config.ALLOW_BOAT) { BoatManager.getInstance(); diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java index a707ce5..d247e2e 100644 --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java import net.sf.l2j.gameserver.data.xml.AdminData; import net.sf.l2j.gameserver.data.xml.AnnouncementData; import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType; +import net.sf.l2j.gameserver.data.xml.PvPColorSystem; import net.sf.l2j.gameserver.enums.CabalType; import net.sf.l2j.gameserver.enums.SealType; import net.sf.l2j.gameserver.enums.SiegeSide; // Tutorial final QuestState qs = player.getQuestList().getQuestState("Tutorial"); if (qs != null) qs.getQuest().notifyEvent("UC", null, player); + PvpColorSystem.getInstance().updateNameColor(player); + PvpColorSystem.getInstance().updateTitleColor(player); player.sendPacket(ActionFailed.STATIC_PACKET); } @Override protected boolean triggersOnActionRequest() { return false; } diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java index a707ce5..d247e2e 100644 --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType; import net.sf.l2j.gameserver.data.xml.NpcData; import net.sf.l2j.gameserver.data.xml.PlayerData; import net.sf.l2j.gameserver.data.xml.PlayerLevelData; +import net.sf.l2j.gameserver.data.xml.PvPColorSystem; import net.sf.l2j.gameserver.enums.AiEventType; import net.sf.l2j.gameserver.enums.CabalType; import net.sf.l2j.gameserver.enums.GaugeColor; import net.sf.l2j.gameserver.enums.LootRule; // Check if it's pvp (cases : regular, wars, victim is PKer) if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != Clan.SUBUNIT_ACADEMY && getPledgeType() != Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL)) { if (target instanceof Player) { // Add PvP point to attacker. setPvpKills(getPvpKills() + 1); + PvPColorSystem.getInstance().updateNameColor(this); // Send UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); } } // Otherwise, killer is considered as a PKer. else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0) { // PK Points are increased only if you kill a player. if (target instanceof Player) setPkKills(getPkKills() + 1); // Calculate new karma. + PvPColorSystem.getInstance().updateTitleColor(this); setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof Summon)); // Unequip adventurer items. checkItemRestriction(); // Stop Pvp task if running. PvpFlagTaskManager.getInstance().remove(this, true); } } code for xml: diff --git a/aCis_datapack/data/xml/events.xml b/aCis_datapack/data/xml/pvpColors.xml new file mode 100644 index 0000000..6b7ef6f --- /dev/null +++ b/aCis_datapack/data/xml/pvpColors.xml +<?xml version="1.0" encoding="UTF-8"?> +<list> + <pvpcolors> + <pvp> + <title pvpKills = "1" color = "D4E9AA"/> + <title pvpKills = "2" color = "BDDB81"/> + <title pvpKills = "3" color = "A8CD5D"/> + <title pvpKills = "4" color = "91BD3A"/> + <title pvpKills = "5" color = "a4e8f9"/> + <title pvpKills = "6" color = "7bdaf2"/> + <title pvpKills = "7" color = "60ceea"/> + <title pvpKills = "8" color = "48b3ce"/> + <title pvpKills = "9" color = "F6ACDD"/> + <title pvpKills = "10" color = "F098D3"/> + <title pvpKills = "11" color = "DA75B8"/> + <title pvpKills = "12" color = "AF8BEE"/> + <title pvpKills = "13" color = "A276EF"/> + <title pvpKills = "14" color = "8A65CB"/> + <title pvpKills = "15" color = "A09CA6"/> + <title pvpKills = "16" color = "807C86"/> + <title pvpKills = "17" color = "544868"/> + </pvp> + <pk> + <name pkKills = "1" color = "D4E9AA"/> + <name pkKills = "2" color = "BDDB81"/> + <name pkKills = "3" color = "A8CD5D"/> + <name pkKills = "4" color = "91BD3A"/> + <name pkKills = "5" color = "a4e8f9"/> + <name pkKills = "6" color = "7bdaf2"/> + <name pkKills = "7" color = "60ceea"/> + <name pkKills = "8" color = "48b3ce"/> + <name pkKills = "9" color = "F6ACDD"/> + <name pkKills = "10" color = "F098D3"/> + <name pkKills = "11" color = "DA75B8"/> + <name pkKills = "12" color = "AF8BEE"/> + <name pkKills = "13" color = "A276EF"/> + <name pkKills = "14" color = "8A65CB"/> + <name pkKills = "15" color = "A09CA6"/> + <name pkKills = "16" color = "807C86"/> + <name pkKills = "17" color = "544868"/> + </pk> + </pvpcolors> +</list> Credits for this mod: LordPanic (I have been approved to upload his codes)
  3. As title says, simulating the damage u make vs the target. Currently works only for players (self too) . It's up to you if u want to add more creature instances. By default all simulations use ss/bss except bare hand hits. Known Issues* Simulation for chargeable physical (ex.tyrant,duelist) skills is not precise (auto hits,magical skills work fine). +else if(command.startsWith("_menuSimulation") || command.startsWith("_menuSelectSkill") || +command.startsWith("_menuDoSim")){ + DamageSimulator.getInstance().parseCmd(command, activeChar); +} DamageSimulation.java DimSim.java SimManager.java simulation.html Video with normal hits Video with skills Credits for this mod: LordPanic (I have been approved to upload his codes)
  4. thanks for share and welcome i edit your topic (letters color) because in dark theme i cant read. [Hidden Content]

Important Information

Privacy Notice: We utilize cookies to optimize your browsing experience and analyze website traffic. By consenting, you acknowledge and agree to our Cookie Policy, ensuring your privacy preferences are respected.