Jump to content

aonniemnoi

Members
  • Posts

    62
  • Credits

  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by aonniemnoi

  1. btw i want to change this msg announce for all player to color msg. something like RED color

    like type a SHOUT...

    Thank you for some 1 can help me

     

     

     

    // announce pvp/pk
                    if (Config.ANNOUNCE_PK_PVP && !pk.isGM())
                    {
                        String msg = "";
                        if (getPvpFlag() == 0)
                        {
                            msg = Config.ANNOUNCE_PK_MSG.replace("$killer", pk.getName()).replace("$target", getName());
                            if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)
                            {
                                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1);
                                sm.addString(msg);
                                Announcements.getInstance().announceToAll(sm);
                            }
                            else
                            {
                                Announcements.getInstance().announceToAll(msg);
                            }
                        }
                        else if (getPvpFlag() != 0)
                        {
                            msg = Config.ANNOUNCE_PVP_MSG.replace("$killer", pk.getName()).replace("$target", getName());
                            if (Config.ANNOUNCE_PK_PVP_NORMAL_MESSAGE)
                            {
                                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1);
                                sm.addString(msg);
                                Announcements.getInstance().announceToAll(sm);
                            }
                            else
                            {
                                Announcements.getInstance().announceToAll(msg);
                            }
                        }
                    }
                    
                }

  2. btw i using l2jserver6670

    ---------------------------

    pls anyone how to make a code Raidboss status show in NPC  Alive and Dead

    and how to make Show announce raidboss to spawn to all player online to know

     

    i should start from where? please.

    and Examp the code please?

    if announce to all player how to do if this code for show in NPC?

    -------------------------------

     

     

    SpawnTable.getInstance().addNewSpawn(spawnDat, false);
            
            if ((respawnTime == 0L) || (time > respawnTime))
            {
                L2RaidBossInstance raidboss = null;
                
                if (bossId == 11111,22222,33333,44444,55555)
                {
                    raidboss = (L2RaidBossInstance) spawnDat.doSpawn();
                }
                
                if (raidboss != null)
                {
                    raidboss.setCurrentHp(currentHP);
                    raidboss.setCurrentMp(currentMP);
                    raidboss.setRaidStatus(StatusEnum.ALIVE);
                    
                    _bosses.put(bossId, raidboss);
                    
                    final StatsSet info = new StatsSet();
                    info.set("currentHP", currentHP);
                    info.set("currentMP", currentMP);
                    info.set("respawnTime", 0L);
                    
                    _storedInfo.put(bossId, info);
                }
            }
            else
            {
                final long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
                _schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new SpawnSchedule(bossId), spawnTime));
            }
            
            _spawns.put(bossId, spawnDat);
            
            if (storeInDb)
            {
                try (Connection con = L2DatabaseFactory.getInstance().getConnection();
                    PreparedStatement statement = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
                {
                    statement.setInt(1, spawnDat.getId());
                    statement.setInt(2, spawnDat.getAmount());
                    statement.setInt(3, spawnDat.getX());
                    statement.setInt(4, spawnDat.getY());
                    statement.setInt(5, spawnDat.getZ());
                    statement.setInt(6, spawnDat.getHeading());
                    statement.setLong(7, respawnTime);
                    statement.setDouble(8, currentHP);
                    statement.setDouble(9, currentMP);
                    statement.execute();
                }
                catch (Exception e)
                {
                    // problem with storing spawn
                    _log.log(Level.WARNING, getClass().getSimpleName() + ": Could not store raidboss #" + bossId + " in the DB:" + e.getMessage(), e);
                }
            }

  3. On 9/8/2021 at 12:00 AM, Kara said:

    The code i gave you was handwritten. You can't just copy paste. I just gave you the idea.

    There is a missing ) in the end but still the getIP() is not existing. You need replace the getIP() with what method retrieve your char's IP.

    Like this?

     

    if (L2World.getInstance().getPlayers().stream().filter(s -> s.IP().equalsIgnoreCase(activeChar.getIP(0.0.0.0)).count() > 2)
    {
       activeChar.close(false);
       return;
    }
  4. 2 hours ago, Kara said:

    What exactly are you trying to do? Set max online users on the server?

    If that's what you want to do using login system to block access such edit the file

     

    RequestServerLogin.java

     

    and in 

     

    public void run()

     

    Before send the:

     

    getClient().setJoinedGS(true);
    getClient().sendPacket(new PlayOk(sk));

     

    You can add a check or you can do the same thing easier using

     

    EnterWorld.java

     

    and add a simple check to kick player if for example

     

    if (L2World.getInstance().getPlayersSize() > 100)
    {
       activeChar.logout(false);
    }

     

    I want to set 1 ip can play 2 char online only . If use 3 cha will get disconnect on 3nd cha  can help me please?

    want to set 1 ip can play 2 char online only . If use 3 cha will get disconnect on 3nd cha  can help me please?

     
    •  
  5. I using this code for Max_ip online but noting heppen

    I doing the code correct?

    some 1 please help. sorry for my ENG

    I using l2jserver 6670------

     

    here is the code...

     

    at    server.properties

    ------------------------

    # MAX IP
    MaxIp = 2

     

    at L2pcinstance

    ------------------------------

    public void findDualBox(L2PcInstance activeChar)
        {
            Map<String, List<L2PcInstance>> ipMap = new HashMap<>();
            String ip = "0.0.0.0";
            int multibox = Config.MAX_IP;
            
            final Map<String, Integer> dualboxIPs = new HashMap<>();
            
            for (L2PcInstance player : L2World.getInstance().getPlayers())
            {
                
                ip = player.getIP();
                
                if (ipMap.get(ip) == null)
                {
                    ipMap.put(ip, new ArrayList<L2PcInstance>());
                }
                
                ipMap.get(ip).add(player);
                
                if (ipMap.get(ip).size() >= multibox)
                {
                    Integer count = dualboxIPs.get(ip);
                    if (count == null)
                    {
                        dualboxIPs.put(ip, multibox);
                    }
                    else
                    {
                        dualboxIPs.put(ip, count++);
                    }
                }
            }
            List<String> keys = new ArrayList<>(dualboxIPs.keySet());
            Collections.sort(keys, (left, right) -> dualboxIPs.get(left).compareTo(dualboxIPs.get(right)));
            Collections.reverse(keys);
            
            for (String dualboxIP : keys)
            {
                findCharacterByIp(activeChar, dualboxIP);
            }
            
        }
        
        /**
         * @return
         */
        private String getIP()
        {
            // TODO Auto-generated method stub
            return null;
        }
        
        private void findCharacterByIp(L2PcInstance activeChar, String IpAdress) throws IllegalArgumentException
        {
            boolean findDisconnected = false;
            
            if (IpAdress.equals("disconnected"))
            {
                findDisconnected = true;
            }
            else
            {
                if (!IpAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
                {
                    throw new IllegalArgumentException("Malformed IPv4 number");
                }
            }
            
            String ip = "0.0.0.0";
            
            for (L2PcInstance player : L2World.getInstance().getPlayers())
            {
                if (findDisconnected)
                {
                    continue;
                }
                
                ip = player.getIP();
                if (!ip.equals(IpAdress))
                {
                    continue;
                }
            }
            
            stopDualbox();
            
            logout();
            
            antiDualbox();
        }
        
        public static void startAntiDualTask(L2PcInstance player)
        {
            player.antiDualbox();
            
        }
        
        public static ScheduledFuture<?> _antiDualbox;
        
        private static void stopDualbox()
        {
            if (_antiDualbox != null)
            {
                _antiDualbox.cancel(false);
                _antiDualbox = null;
            }
            
        }
        
        public void antiDualbox()
        {
            
            _antiDualbox = ThreadPoolManager.getInstance().scheduleAi(new startDualbox(), 300000);
            
        }
        
        private class startDualbox implements Runnable
        {
            public startDualbox()
            {
                
                findDualBox(_plD);
            }
            
            @Override
            public void run()
            {
                
            }
        }
        
        L2PcInstance _plD;
    }

     

     

  6. On 11/2/2014 at 7:54 PM, Tristis said:

    And this:

     

    +        if (ProtectionDualBox.check(activeChar))
    +            ProtectionDualBox.disc(activeChar);

     

    Should be changed to this:

     

    +        if (ProtectionNetwork.check(activeChar))
    +                ProtectionNetwork.disc(activeChar);

     

    Right?

    i build ok but when i login alway all disconnected from server even 1st charecter also got disconnect

    my code...

     

    /*
     * Copyright (C) 2004-2020 L2J Server
     * 
     * This file is part of L2J Server.
     * 
     * L2J Server 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.
     * 
     * L2J Server 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/>.
     */
    /**
     * @author User
     *
     */
    package com.l2jserver.gameserver.model;

    import com.l2jserver.gameserver.ThreadPoolManager;
    import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jserver.gameserver.network.clientpackets.Say2;
    import com.l2jserver.gameserver.network.serverpackets.CreatureSay;

    /**
     * @author xAddytzu
     */
    public class ProtectionNetwork
    {
        public static void disc(final L2PcInstance player)
        {
            player.sendPacket(new CreatureSay(1, Say2.HERO_VOICE, "SYSTEM", "You cannot play with dualbox."));
            ThreadPoolManager.getInstance().scheduleGeneral(() -> player.closeNetConnection(false), 20000);
        }
        
        public static boolean check(L2PcInstance player)
        {
            boolean loggedz0r = false;
            for (L2PcInstance playerz0r : L2World.getInstance().getPlayers())
            {
                String client = first(playerz0r);
                String client1 = second(player);
                if (client.equalsIgnoreCase(client1))
                {
                    loggedz0r = true;
                }
            }
            return loggedz0r;
        }
        
        private static String first(L2PcInstance player)
        {
            return second(player).toString();
        }
        
        private static String second(L2PcInstance player)
        {
            try
            {
                player.getClient().getConnection().getInetAddress().getHostAddress();
            }
            catch (Throwable t)
            {
            }
            return null;
        }
    }

  7. /*
     * Copyright (C) 2004-2020 L2J Server
     * 
     * This file is part of L2J Server.
     * 
     * L2J Server 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.
     * 
     * L2J Server 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/>.
     */
    /**
     * @author User
     *
     */
    package com.l2jserver.gameserver.model.custom;

    import com.l2jserver.gameserver.ThreadPoolManager;
    import com.l2jserver.gameserver.model.L2World;
    import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jserver.gameserver.network.clientpackets.Say2;
    import com.l2jserver.gameserver.network.serverpackets.CreatureSay;

    /**
     * @author xAddytzu
     */
    public class ProtectionNetwork
    {
        public static void disc(final L2PcInstance player)
        {
            player.sendPacket(new CreatureSay(1, Say2.HERO_VOICE, "SYSTEM", "You cannot play with dualbox."));
            ThreadPoolManager.getInstance().scheduleGeneral(() -> player.closeNetConnection(), 20000);
        }
        
        public static boolean check(L2PcInstance player)
        {
            boolean loggedz0r = false;
            for (L2PcInstance playerz0r : L2World.getInstance().getPlayers())
            {
                String client = first(playerz0r);
                String client1 = second(player);
                if (client.equalsIgnoreCase(client1))
                {
                }
                loggedz0r = true;
            }
            return loggedz0r;
        }
        
        private static String first(L2PcInstance player)
        {
            return second(player).toString();
        }
        
        private static String second(L2PcInstance player)
        {
            try
            {
                return player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress();
            }
            catch (Throwable t)
            {
            }
            return null;
        }
    }

     

     

    ---------------------------------------------------------------------------

    by the way i have no idea for this line

    (() -> player.closeNetConnection(), 20000);         ------> closeNetConnection()   this error          

    and this line

    return player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress();

    getSocketChannel ----> this error

     

    I using l2jserver Beta

    core. 6670

  8. On 9/26/2019 at 6:01 AM, kaiserxd said:

    Hello young people, Here is a simple protection.

     

    
    in -> l2jserver/gameserver/network/clientpackets/RequestMagicSkillUse.java
    
    method ->  runImpl()
    
    search for:
     	// Check the validity of the skill
         if (skill != null)
         {
    
    Add:
    		+	if (activeChar.isInSiege())
            +    {
            +        //Proibe Ress em Sieges
            +        if (skill.getId() == 1016 || skill.getId() == 1254)
            +        {
            +            activeChar.sendMessage("Não é possivel utilizar " + skill.getName() + " durante a Siege!");
            +            activeChar.sendPacket(ActionFailed.STATIC_PACKET);
            +            return;
            +        }
            +   }

     

    bro still cant use. that code still cant block

    i use l2jserver

    SV-6670

    DP-10490

×
×
  • Create New...