Evento Clan War Zone (config)

Iniciado por Swarlog, Jun 28, 2025, 11:43 PM

Tema anterior - Siguiente tema

Swarlog

Con este codigo, añadiras a tu servidor una zona sola y exclusiva para el pvp de clanes. Por lo que si no perteneceis a un clan sereis expulsado/teletransportado a la ciudad mas cercana. Pero si sois miembro de un clan, podreis combateir contra otros miembros de otros clanes. Si matais a un jugador de otro clan, ganaras puntos de reputacion.

    Index: dist/game/config/l2jmods.properties
    
    ===================================================================
    
    --- dist/game/config/l2jmods.properties    (revision 5761)
    
    +++ dist/game/config/l2jmods.properties    (working copy)
    
    @@ -426,3 +426,20 @@
    
    # will be 1+2=3. Use 0 or negative value for unlimited number of connections.
    
    # Default: 127.0.0.1,0 (no limits from localhost)
    
    DualboxCheckWhitelist = 127.0.0.1,0
    
    +
    
    +# --------------------------------------------------------------
    
    +# Clan War Zone System                                        -
    
    +# --------------------------------------------------------------
    
    +# Custom Item Reward
    
    +AllowClanwarSystem = False
    
    +# Item id
    
    +ClanRewardItem = 57
    
    +# Item A-beep-t
    
    +ClanRewardA-beep-t = 1
    
    +# Custom Clan Rep. Add
    
    +AllowClanwarRepSystem = False
    
    +# Rep. A-beep-t
    
    +ClanAddRepAm-beep-t = 50
    
    +# --------------------------------------------------------------
    
    +# Clan War Zone System End                                    -
    
    +# --------------------------------------------------------------
    
    \ No newline at end of file
    
    Index: java/com/l2jserver/Config.java
    
    ===================================================================
    
    --- java/com/l2jserver/Config.java    (revision 5761)
    
    +++ java/com/l2jserver/Config.java    (working copy)
    
    @@ -725,6 +725,11 @@
    
        public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
    
        public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
    
        public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
    
    +    public static boolean ALLOW_CLANWAR_REWARD;
    
    +    public static int CLANWAR_REWARD_ITEM;
    
    +    public static int CLANWAR_REWARD_COUNT;
    
    +    public static boolean ALLOW_CLANWAR_REP;
    
    +    public static int CLANWAR_ADD_REP;
    
    
    
        //--------------------------------------------------
    
        // NPC Settings
    
    @@ -2502,6 +2507,11 @@
    
                                }
    
                            }
    
                        }
    
    +                    ALLOW_CLANWAR_REWARD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowClanwarSystem", "False"));
    
    +                    CLANWAR_REWARD_ITEM = Integer.parseInt(L2JModSettings.getProperty("ClanRewardItem", "57"));
    
    +                    CLANWAR_REWARD_COUNT = Integer.parseInt(L2JModSettings.getProperty("ClanRewardA-beep-t", "1"));
    
    +                    ALLOW_CLANWAR_REP = Boolean.parseBoolean(L2JModSettings.getProperty("AllowClanwarRepSystem", "False"));
    
    +                    CLANWAR_ADD_REP = Integer.parseInt(L2JModSettings.getProperty("ClanAddRepAm-beep-t", "1"));
    
                    }
    
                    catch (Exception e)
    
                    {
    
    Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
    
    ===================================================================
    
    --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 5761)
    
    +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
    
    @@ -170,6 +170,7 @@
    
    import com.l2jserver.gameserver.model.quest.QuestState;
    
    import com.l2jserver.gameserver.model.quest.State;
    
    import com.l2jserver.gameserver.model.zone.type.L2BossZone;
    
    +import com.l2jserver.gameserver.model.zone.type.L2ClanWarZone;
    
    import com.l2jserver.gameserver.network.L2GameClient;
    
    import com.l2jserver.gameserver.network.SystemMessageId;
    
    import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
    
    @@ -5683,7 +5684,25 @@
    
            {
    
                // Add karma to attacker and increase its PK counter
    
                setPvpKills(getPvpKills() + 1);
    
    -        
    
    +            L2PcInstance targetPlayer = target.getActingPlayer();
    
    +            if(isInsideZone(ZONE_CLANWAR) & targetPlayer.isInsideZone(ZONE_CLANWAR)
    
    +            && (getClanId() != targetPlayer.getClanId())
    
    +            && getClan() != null
    
    +            && targetPlayer.getClan() != null)
    
    +            {
    
    +                if(Config.ALLOW_CLANWAR_REP)
    
    +                {
    
    +                getClan().addReputationScore(Config.CLANWAR_ADD_REP, true);
    
    +                }
    
    +                sendMessage("You killed someone from an enemy clan. Your clan gets rewarded with 50 rep points!");
    
    +            if(Config.ALLOW_CLANWAR_REWARD)
    
    +                        {
    
    +                            // Item Reward system
    
    +                            addItem("Loot", Config.CLANWAR_REWARD_ITEM, Config.CLANWAR_REWARD_COUNT, this, true);
    
    +                            sendMessage("You will be rewarded for someone from en enemy clan member kill!");
    
    +                        }
    
    +            }
    
    +
    
                // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
    
                sendPacket(new UserInfo(this));
    
                sendPacket(new ExBrExtraUserInfo(this));
    
    Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
    
    ===================================================================
    
    --- java/com/l2jserver/gameserver/model/actor/L2Character.java    (revision 5761)
    
    +++ java/com/l2jserver/gameserver/model/actor/L2Character.java    (working copy)
    
    @@ -205,8 +205,9 @@
    
        public static final byte ZONE_ALTERED = 19;
    
        public static final byte ZONE_NOBOOKMARK = 20;
    
        public static final byte ZONE_NOITEMDROP = 21;
    
    +    public static final byte ZONE_CLANWAR = 22;
    
    
    
    -    private final byte[] _zones = new byte[22];
    
    +    private final byte[] _zones = new byte[23];
    
        protected byte _zoneValidateCounter = 4;
    
    
    
        private L2Character _debugger = null;
    
    Index: java/com/l2jserver/gameserver/model/zone/type/L2ClanWarZone.java
    
    ===================================================================
    
    --- java/com/l2jserver/gameserver/model/zone/type/L2ClanWarZone.java    (revision 0)
    
    +++ java/com/l2jserver/gameserver/model/zone/type/L2ClanWarZone.java    (working copy)
    
    @@ -0,0 +1,96 @@
    
    +/*
    
    + * This program is free software: you can redistribute it and/or modify it under
    
    + * the terms of the GNU General Public License as published by the Free Software
    
    + * Foundation, either version 3 of the License, or (at your option) any later
    
    + * version.
    
    + *
    
    + * This program is distributed in the hope that it will be useful, but WITHOUT
    
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    
    + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    
    + * details.
    
    + *
    
    + * You should have received a copy of the GNU General Public License along with
    
    + * this program. If not, see .
    
    + */
    
    +package com.l2jserver.gameserver.model.zone.type;
    
    +
    
    +import com.l2jserver.gameserver.model.actor.L2Character;
    
    +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    
    +import com.l2jserver.gameserver.model.zone.L2ZoneType;
    
    +import com.l2jserver.gameserver.model.L2Skill;
    
    +import com.l2jserver.gameserver.datatables.SkillTable;
    
    +import com.l2jserver.gameserver.datatables.MapRegionTable;
    
    +
    
    +/**
    
    + *
    
    + * A Clan War Zone
    
    + *
    
    + */
    
    +public class L2ClanWarZone extends L2ZoneType
    
    +{
    
    +    public L2ClanWarZone(int id)
    
    +    {
    
    +        super(id);
    
    +    }
    
    +
    
    +    L2Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
    
    +
    
    +    @Override
    
    +    protected void onEnter(L2Character character)
    
    +    {
    
    +      if (character instanceof L2PcInstance)
    
    +      {
    
    +          L2PcInstance activeChar = ((L2PcInstance) character);
    
    +          if(((L2PcInstance)character).getClan() != null)
    
    +          {      
    
    +                  character.setInsideZone(L2Character.ZONE_CLANWAR, true);
    
    +              ((L2PcInstance)character).sendMessage("You have entered a Clan War Zone. Prepare for fight.");
    
    +                noblesse.getEffects(activeChar, activeChar);
    
    +                if(activeChar.getPvpFlag() == 0)
    
    +                activeChar.updatePvPFlag(1);
    
    +          }
    
    +    
    
    +          else
    
    +          {
    
    +              ((L2PcInstance) character).sendMessage("This is strict area for clan members ONLY. You will be teleported at the nearest town.");
    
    +                ((L2PcInstance) character).teleToLocation(MapRegionTable.TeleportWhereType.Town);
    
    +          }
    
    +        }
    
    +    }
    
    +
    
    +    @Override
    
    +    protected void onExit(L2Character character)
    
    +    {
    
    +        character.setInsideZone(L2Character.ZONE_CLANWAR, false);
    
    +        if (character instanceof L2PcInstance)
    
    +        {
    
    +            L2PcInstance activeChar = ((L2PcInstance) character);
    
    +            activeChar.stopPvPFlag();
    
    +        }
    
    +    }
    
    +
    
    +    @Override
    
    +    public void onDieInside(L2Character character)
    
    +    {
    
    +    }
    
    +
    
    +    @Override
    
    +    public void onReviveInside(L2Character character)
    
    +    {
    
    +        onEnter(character);
    
    +        if (character instanceof L2PcInstance)
    
    +        {
    
    +        L2PcInstance activeChar = ((L2PcInstance) character);
    
    +        noblesse.getEffects(activeChar, activeChar);
    
    +        heal(activeChar);
    
    +        }
    
    +    }
    
    +
    
    +    static void heal(L2PcInstance activeChar)
    
    +    {
    
    +        activeChar.setCurrentHp(activeChar.getMaxHp());
    
    +        activeChar.setCurrentCp(activeChar.getMaxCp());
    
    +        activeChar.setCurrentMp(activeChar.getMaxMp());
    
    +    }
    
    +
    
    +}
    
    \ No newline at end of file

Fuente: http://l2jtopic.foroblog.net/t22-clan-war-zone-para-freya-interlude#ixzz31wODqXvE