Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Restringir skills en olimpiadas

Iniciado por Swarlog, Sep 01, 2022, 12:23 AM

Tema anterior - Siguiente tema

Swarlog

Index: java/com/it/br/Config.java
=============================================
--- java/com/it/br/Config.java (revision 306)
+++ java/com/it/br/Config.java (revision 307)
public static boolean ALLOW_SKILL_AUGMENTS_IN_OLYM;
+ public static boolean OLY_SKILL_PROTECT;
+ public static List<Integer> OLY_SKILL_LIST = new FastList<Integer>();

ALLOW_SKILL_AUGMENTS_IN_OLYM = Boolean.parseBoolean(Olym.getProperty("AllowSkillAugmentInOlym", "True"));
+ OLY_SKILL_PROTECT = Boolean.parseBoolean(Olym.getProperty("OlySkillProtect", "True"));
+ for (String id : Olym.getProperty("OllySkillId","0").split(","))
+ {
+ OLY_SKILL_LIST.add(Integer.parseInt(id));
+ }
Index: Config/event/Olympiad.properties;
==============================================================
--- Config/event/Olympiad.properties; (revision 306)
+++ Config/event/Olympiad.properties; (revision 307)

+# Skill protection before the control
+OlySkillProtect = True
+OllySkillId = 176,139,406,420
Index: java/com/it/br/gameserver/model/OlympiadGame;
==============================================================
--- java/com/it/br/gameserver/model/OlympiadGame; (revision 306)
+++ java/com/it/br/gameserver/model/OlympiadGame; (revision 307)
protected void removals()
{
if(_aborted)
return;

for(L2PcInstance player : _players)
{
try
{
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.disableSkill(skill.getId());
+ player.sendPacket(new ExShowScreenMessage ("This skill can not be used", 4000));
+ }
+ }

protected void PlayersStatusBack()
{
for(L2PcInstance player : _players)
{
try
{
player.setCurrentCp(player.getMaxCp());
player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp());

+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ player.sendPacket(new ExShowScreenMessage ("His skill can be used normally", 5000));
+ }
+ }

protected void additions()
{
for(L2PcInstance player : _players)
{
try
{
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ player.sendPacket(new ExShowScreenMessage ("You can use your skill", 3000));
+ }
+ }

protected boolean makeCompetitionStart()
{
if(_aborted)
return false;

try
{
for(L2PcInstance player : _players)
{
player.setIsOlympiadStart(true);
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ }
+ }



CitarAdaptación ACIS:

Index: java/com/it/br/Config.java
=============================================
--- java/com/it/br/Config.java (revision 306)
+++ java/com/it/br/Config.java (revision 307)
  public static boolean ALLOW_SKILL_AUGMENTS_IN_OLYM;
+ public static boolean OLY_SKILL_PROTECT;
+ public static List<Integer> OLY_SKILL_LIST = new FastList<Integer>();

  ALLOW_SKILL_AUGMENTS_IN_OLYM = Boolean.parseBoolean(Olym.getProperty("AllowSkillAugmentInOlym", "True"));
+ OLY_SKILL_PROTECT = Boolean.parseBoolean(Olym.getProperty("OlySkillProtect", "True"));
+ for (String id : Olym.getProperty("OllySkillId","0").split(","))
+     {
+ OLY_SKILL_LIST.add(Integer.parseInt(id));
+     }
Index: java/com/it/br/gameserver/model/OlympiadGame;
==============================================================
--- java/com/it/br/gameserver/model/OlympiadGame; (revision 306)
+++ java/com/it/br/gameserver/model/OlympiadGame; (revision 307)
  protected void removals()
  {
  if(_aborted)
  return;
 
  for(L2PcInstance player : _players)
  {
  try
  {
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.disableSkill(skill.getId());
+ player.sendPacket(new ExShowScreenMessage ("This skill can not be used", 4000));
+ }
+ }

  protected void PlayersStatusBack()
  {
  for(L2PcInstance player : _players)
  {
  try
  {
  player.setCurrentCp(player.getMaxCp());
  player.setCurrentHp(player.getMaxHp());
  player.setCurrentMp(player.getMaxMp());
 
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ player.sendPacket(new ExShowScreenMessage ("His skill can be used normally", 5000));
+ }
+ }

  protected void additions()
  {
  for(L2PcInstance player : _players)
  {
  try
  {
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ player.sendPacket(new ExShowScreenMessage ("You can use your skill", 3000));
+ }
+ }

  protected boolean makeCompetitionStart()
  {
  if(_aborted)
  return false;

  try
  {
  for(L2PcInstance player : _players)
  {
  player.setIsOlympiadStart(true);
+ if (Config.OLY_SKILL_PROTECT)
+ {
+ for(L2Skill skill : player.getAllSkills())
+ {
+ if (Config.OLY_SKILL_LIST.contains(skill.getId()))
+ player.enableSkill(skill.getId());
+ player.updateEffectIcons();
+ }
+ }

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: D:\Packs\aCis\trunk\aCis_gameserver
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: config/events.properties
--- config/events.properties Base (BASE)
+++ config/events.properties Locally Modified (Based On LOCAL)
@@ -83,6 +83,11 @@
 # Olympiad Managers announce each start of fight, default: True.
 AltOlyAnnounceGames = True
 
+#Enable skill protection
+OlySkillProtect = True
+#If true, then protect against these skills: (id1,id2,...)
+OllySkillId = 0
+
\ No newline at end of file
 # Divider for points in classed and non-classed games, default: 3, 5.
 AltOlyDividerClassed = 3
 AltOlyDividerNonClassed = 5
Index: java/net/sf/l2j/Config.java
--- java/net/sf/l2j/Config.java Base (BASE)
+++ java/net/sf/l2j/Config.java Locally Modified (Based On LOCAL)
@@ -28,6 +28,7 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.logging.Logger;
+import javolution.util.FastList;
 
 import net.sf.l2j.commons.config.ExProperties;
 import net.sf.l2j.gameserver.util.FloodProtectorConfig;
@@ -164,6 +165,8 @@
  public static int ALT_OLY_DIVIDER_CLASSED;
  public static int ALT_OLY_DIVIDER_NON_CLASSED;
  public static boolean ALT_OLY_ANNOUNCE_GAMES;
+ public static boolean OLY_SKILL_PROTECT;
+ public static List<Integer> OLY_SKILL_LIST = new FastList<>();
 
  /** SevenSigns Festival */
  public static boolean ALT_GAME_REQUIRE_CLAN_CASTLE;
@@ -815,6 +818,10 @@
  ALT_OLY_DIVIDER_CLASSED = events.getProperty("AltOlyDividerClassed", 3);
  ALT_OLY_DIVIDER_NON_CLASSED = events.getProperty("AltOlyDividerNonClassed", 3);
  ALT_OLY_ANNOUNCE_GAMES = events.getProperty("AltOlyAnnounceGames", true);
+                        OLY_SKILL_PROTECT = Boolean.parseBoolean(events.getProperty("OlySkillProtect", "True"));
+                        for (String id : events.getProperty("OllySkillId", "0").split(",")) {
+                            OLY_SKILL_LIST.add(Integer.parseInt(id));
+                        }
\ No newline at end of file
 
  ALT_GAME_REQUIRE_CLAN_CASTLE = events.getProperty("AltRequireClanCastle", false);
  ALT_GAME_CASTLE_DAWN = events.getProperty("AltCastleForDawn", true);
Index: java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java
--- java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java Base (BASE)
+++ java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java Locally Modified (Based On LOCAL)
@@ -17,6 +17,7 @@
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import net.sf.l2j.Config;
 
 import net.sf.l2j.gameserver.ai.CtrlIntention;
 import net.sf.l2j.gameserver.datatables.SkillTable;
@@ -31,6 +32,7 @@
 import net.sf.l2j.gameserver.model.zone.type.L2OlympiadStadiumZone;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
+import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
 import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
 import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
@@ -170,6 +172,15 @@
  if (player == null)
  return;
 
+                        if (Config.OLY_SKILL_PROTECT) {
+                            for (L2Skill skill : player.getAllSkills()) {
+                                if (Config.OLY_SKILL_LIST.contains(skill.getId())) {
+                                    player.removeSkill(skill, false);
+                                }
+                                player.sendPacket(new ExShowScreenMessage("This skill can not be used", 4000));
+                            }
+                        }
+
  // Remove Buffs
  player.stopAllEffectsExceptThoseThatLastThroughDeath();
 
@@ -333,6 +344,16 @@
  player.setCurrentMp(player.getMaxMp());
  }
 
+                        if (Config.OLY_SKILL_PROTECT) {
+                            for (L2Skill skill : player.getAllSkills()) {
+                                if (Config.OLY_SKILL_LIST.contains(skill.getId())) {
+                                    player.enableSkill(skill);
+                                }
+                                player.updateEffectIcons();
+                                player.sendPacket(new ExShowScreenMessage("His skill can be used normally", 5000));
+                            }
+                        }
+
\ No newline at end of file
  // Add Hero Skills
  if (player.isHero())
  {
Index: java/net/sf/l2j/gameserver/model/olympiad/OlympiadGameNormal.java
--- java/net/sf/l2j/gameserver/model/olympiad/OlympiadGameNormal.java Base (BASE)
+++ java/net/sf/l2j/gameserver/model/olympiad/OlympiadGameNormal.java Locally Modified (Based On LOCAL)
@@ -22,6 +22,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.Location;
 import net.sf.l2j.gameserver.model.actor.L2Character;
@@ -178,7 +179,23 @@
  return false;
 
  _playerOne.player.setIsOlympiadStart(true);
+                if (Config.OLY_SKILL_PROTECT) {
+                    for (L2Skill skill : _playerOne.player.getAllSkills()) {
+                        if (Config.OLY_SKILL_LIST.contains(skill.getId())) {
+                            _playerOne.player.enableSkill(skill);
+                        }
+                        _playerOne.player.updateEffectIcons();
+                    }
+                }
  _playerTwo.player.setIsOlympiadStart(true);
+                if (Config.OLY_SKILL_PROTECT) {
+                    for (L2Skill skill : _playerTwo.player.getAllSkills()) {
+                        if (Config.OLY_SKILL_LIST.contains(skill.getId())) {
+                            _playerTwo.player.enableSkill(skill);
+                        }
+                        _playerTwo.player.updateEffectIcons();
+                    }
+                }
\ No newline at end of file
  return true;
  }