Del java kodo ikelimo i serva

top pk pvp
    
  1. Atsijungęs

    mindaugas

    Pranešimai: 0

    Sweikikaip man ikeltis sita koda i java?


    ### Eclipse Workspace Patch 1.0
    #P aCis_gameserver
    Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/TopCommands.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/TopCommands.java (revision 0)
    +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/TopCommands.java (revision 0)
    @@ -0,0 +1,50 @@
    +/*
    + * 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 net.sf.l2j.gameserver.handler.usercommandhandlers;
    +
    +import net.sf.l2j.gameserver.handler.IUserCommandHandler;
    +import net.sf.l2j.gameserver.model.Top;
    +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    +
    +/**
    + * @author Lioy
    + *
    + */
    +public class TopCommands implements IUserCommandHandler
    +{
    +
    +   private static final int[] COMMAND_IDS =
    +   {
    +       114
    +   };
    +   
    +   @Override
    +   public boolean useUserCommand(int id, L2PcInstance activeChar)
    +   {
    +       if (id != COMMAND_IDS[0])
    +           return false;
    +       
    +       Top.sendMainWindow(activeChar);
    +       
    +       return true;
    +   }
    +
    +   @Override
    +   public int[] getUserCommandList()
    +   {
    +       return COMMAND_IDS;
    +   }
    +   
    +}
    Index: java/net/sf/l2j/gameserver/GameServer.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/GameServer.java  (revision 1)
    +++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
    @@ -90,6 +90,7 @@
     import net.sf.l2j.gameserver.model.L2World;
     import net.sf.l2j.gameserver.model.PartyMatchRoomList;
     import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
    +import net.sf.l2j.gameserver.model.Top;
     import net.sf.l2j.gameserver.model.entity.Castle;
     import net.sf.l2j.gameserver.model.entity.Hero;
     import net.sf.l2j.gameserver.model.olympiad.Olympiad;
    @@ -243,6 +244,7 @@
            Util.printSection("Quests & Scripts");
            QuestManager.getInstance();
            BoatManager.getInstance();
    +       Top.getInstance();
             
            if (!Config.ALT_DEV_NO_SCRIPTS)
            {
    Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (revision 1)
    +++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (working copy)
    @@ -21,6 +21,7 @@
     import net.sf.l2j.Config;
     import net.sf.l2j.gameserver.handler.ChatHandler;
     import net.sf.l2j.gameserver.handler.IChatHandler;
    +import net.sf.l2j.gameserver.model.Top;
     import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
     import net.sf.l2j.gameserver.network.SystemMessageId;
     import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
    Index: java/net/sf/l2j/gameserver/handler/UserCommandHandler.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/handler/UserCommandHandler.java  (revision 1)
    +++ java/net/sf/l2j/gameserver/handler/UserCommandHandler.java  (working copy)
    @@ -31,6 +31,7 @@
     import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
     import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
     import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
    +import net.sf.l2j.gameserver.handler.usercommandhandlers.TopCommands;
      
     public class UserCommandHandler
     {
    @@ -54,6 +55,7 @@
            registerUserCommandHandler(new Mount());
            registerUserCommandHandler(new PartyInfo());
            registerUserCommandHandler(new Time());
    +       registerUserCommandHandler(new TopCommands());
            registerUserCommandHandler(new OlympiadStat());
            registerUserCommandHandler(new ChannelLeave());
            registerUserCommandHandler(new ChannelDelete());
    Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 1)
    +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
    @@ -24,6 +24,7 @@
     import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
     import net.sf.l2j.gameserver.model.L2Object;
     import net.sf.l2j.gameserver.model.L2World;
    +import net.sf.l2j.gameserver.model.Top;
     import net.sf.l2j.gameserver.model.actor.L2Npc;
     import net.sf.l2j.gameserver.model.actor.instance.L2OlympiadManagerInstance;
     import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    @@ -129,6 +130,20 @@
                {
                    CommunityBoard.getInstance().handleCommands(getClient(), _command);
                }
    +           else if(_command.startsWith("topcom"))
    +           {
    +               String num = _command.substring(6);
    +               int type = Integer.parseInt(num);
    +               
    +               if(type==1) //pvp
    +               {
    +                   Top.sendData(activeChar, 15,true);
    +               }
    +               else //pk
    +               {
    +                   Top.sendData(activeChar, 15 , false);
    +               }
    +           }
                else if (_command.startsWith("Quest "))
                {
                    if (!activeChar.validateBypass(_command))
    Index: java/net/sf/l2j/gameserver/model/Top.java
    ===================================================================
    --- java/net/sf/l2j/gameserver/model/Top.java   (revision 0)
    +++ java/net/sf/l2j/gameserver/model/Top.java   (revision 0)
    @@ -0,0 +1,198 @@
    +/*
    + * 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 net.sf.l2j.gameserver.model;
    +
    +import java.sql.Connection;
    +import java.sql.PreparedStatement;
    +import java.sql.ResultSet;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.Comparator;
    +import java.util.LinkedHashMap;
    +import java.util.LinkedList;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.logging.Logger;
    +
    +import net.sf.l2j.L2DatabaseFactory;
    +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    +
    +/**
    + * @author Lioy
    + *
    + */
    +public class Top
    +{
    +   private static final ConcurrentHashMap playersPvpKills = new ConcurrentHashMap<>();
    +   private static final ConcurrentHashMap playersPkKills = new ConcurrentHashMap<>();
    +   protected static final Logger _log = Logger.getLogger(Top.class.getName());
    +   
    +   public static void sendData(L2PcInstance player,int topWhat,boolean pvp)
    +   {
    +       Map sortedPlayersPvpKills = sortByValue(playersPvpKills);
    +       Map sortedPlayersPkKills = sortByValue(playersPkKills);
    +
    +       NpcHtmlMessage htm = new NpcHtmlMessage(0);
    +       StringBuilder sb;
    +       if(pvp)
    +       {
    +            sb = new StringBuilder("Top Pvp");
    +           sb.append("Pvp Ranking by Lioy");
    +       }
    +       else
    +       {
    +            sb = new StringBuilder("Top Pk");
    +           sb.append("Pk Ranking by Lioy");
    +       }
    +       
    +           ArrayList names = new ArrayList<>();
    +           ArrayList pvps = new ArrayList<>();
    +           ArrayList pks = new ArrayList<>();
    +           if(pvp)
    +           {
    +            pvps = new ArrayList<>();
    +           for(String key : sortedPlayersPvpKills.keySet())
    +           {
    +               names.add(key);
    +               pvps.add(sortedPlayersPvpKills.get(key));
    +           }
    +           }
    +           else
    +           {
    +            pks = new ArrayList<>();
    +           for(String key : sortedPlayersPvpKills.keySet())
    +           {
    +               names.add(key);
    +               pks.add(sortedPlayersPkKills.get(key));
    +           }
    +           }
    +           sb.append("");
    +           sb.append(" Rank Name Kills  ");
    +           int counter=1;
    +           for(int i=names.size()-1; i>=names.size()-topWhat; i--)
    +           {
    +               try
    +               {   
    +                   if(pvp)
    +                       sb.append("  "+counter+"   "+names.get(i)+"  " +pvps.get(i) + "  ");
    +                   else
    +                       sb.append("  "+counter+"   "+names.get(i)+"  " +pks.get(i) + "  ");    
    +                   counter++;
    +               }
    +               catch(Exception e)
    +               {
    +                   sb.append("");
    +                   break;
    +               }
    +               
    +           }
    +           
    +       
    +       sb.append("");
    +       sb.append("");
    +       htm.setHtml(sb.toString());
    +       player.sendPacket(htm);
    +           
    +   }
    +   
    +   public static void addDataPvp(String charName , int pvpKills)
    +   {
    +       playersPvpKills.put(charName, pvpKills);
    +   }
    +   
    +   public static void addDataPk(String charName , int pkKills)
    +   {
    +       playersPkKills.put(charName, pkKills);
    +   }
    +   
    +   protected static <K, V extends Comparable&lt;? super V&gt;&gt; Map sortByValue(Map map)
    +   {
    +       List<Map.Entry<K, V&gt;&gt; list = new LinkedList&lt;&gt;(map.entrySet());
    +       Collections.sort(list, new Comparator<Map.Entry0;");
    +           ResultSet rset = st.executeQuery();
    +           
    +           while(rset.next())
    +           {
    +               charName = rset.getString("char_name");
    +               pvpKills = rset.getInt("pvpkills");
    +               pkKills = rset.getInt("pkkills");
    +               playersPvpKills.put(charName, pvpKills);
    +               playersPkKills.put(charName, pkKills);
    +           }
    +           rset.close();
    +           st.close();
    +           
    +       }
    +       catch(Exception e)
    +       {
    +           _log.warning("Could not store data of players kills " + e);
    +       }
    +   }
    +   
    +   public static Top getInstance()
    +   {
    +       return SingletonHolder._instance;
    +   }
    +   
    +   private static class SingletonHolder
    +   {
    +       protected static  Top _instance = new Top();
    +   }
    +   
    +   public static void sendMainWindow(L2PcInstance player)
    +   {
    +       NpcHtmlMessage nhm = new NpcHtmlMessage(0);
    +       StringBuilder sb = new StringBuilder("Pvp/Pk Ranking by Lioy");
    +       sb.append("Choose what would you like<br");
    +       sb.append("");
    +       sb.append("<button value=\"Top Pvp\" action=\"bypass -h topcom1\" width=204 height=45 ");
    +       sb.append("");
    +       sb.append("Client UserInfo packet to attacker with its Karma and PK Counter
                sendPacket(new UserInfo(this));
            }
    Paskutinį kartą redagavo: maugllis 23 Rugsėjo 2015 - 16:56
    23 Rugsėjo 2015 - 15:56 / #1
  2. 
  3. Atsijungęs

    maugllis

    Administratorius

    Pranešimai: 542

    nemoki tvarkingai forume parašyti pranešimo, o nori kodą isikelti lol ironiška.

    O isikelti kodą, jungies eclipse ir isidedi nelabai aišku kurios dalies tu nemoki ar nežinai

    Nurodomas kelias koks failas redaguojamas/kuriamas ir pan.

    --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/TopCommands.java (revision 0)
    +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/TopCommands.java (revision 0)

    tikslesnė vieta pačiame faile

    @@ -90,6 +90,7 @@

    +/- ženklai nurodo kiuria eilute reikia pridėti kuria ištrinti ar pakeisti.
    23 Rugsėjo 2015 - 17:01 / #2
  4. 
  5. Atsijungęs

    mindaugas

    Pranešimai: 0

    nu turiu parsisiuntis acis 340 rev betkaip man ikelti juos i eclipse. video gide ira parodita kaip su frozenu bet ten atsisiunciama per vps serveri
    23 Rugsėjo 2015 - 17:31 / #3
  6. 
  7. Atsijungęs

    wewewe

    Pavadinimas: L2 žaidėjas

    Narys

    Pranešimai: 727

    Vartotojo apdovanojimai: 16

    right click>team>apply patch
    23 Rugsėjo 2015 - 19:07 / #4
  8. 
  9. Atsijungęs

    mindaugas

    Pranešimai: 0

    Gal galetum aiskiau vistiek nerandu per kur atidaryti?
    23 Rugsėjo 2015 - 19:19 / #5
  10. 
  11. Atsijungęs

    wewewe

    Pavadinimas: L2 žaidėjas

    Narys

    Pranešimai: 727

    Vartotojo apdovanojimai: 16

    eclipsej, right click ant projekto. Galima ir su tortoiseMerge ar dar milijonu panasiu programu
    23 Rugsėjo 2015 - 19:31 / #6
  12. 
  13. Atsijungęs

    mindaugas

    Pranešimai: 0

    nurodik aisqkiau imesiu foto necia spaudu galas?
    23 Rugsėjo 2015 - 19:41 / #7
  14. 
  15. Atsijungęs

    wewewe

    Pavadinimas: L2 žaidėjas

    Narys

    Pranešimai: 727

    Vartotojo apdovanojimai: 16

    pirma packo koda importuok i eclipse tvarkingai. Tada kairiam sone atsiras projektas su visu failu sarasu. Tai vat an to projekto ir spausi desini peles mytuka t.y. mygtuka priesinga kairiam peles mygtukui.
    23 Rugsėjo 2015 - 19:47 / #8
  16. 
  17. Atsijungęs

    mindaugas

    Pranešimai: 0

    is kur man ta koda gaut?
    23 Rugsėjo 2015 - 20:06 / #9
  18. 
  19. Atsijungęs

    Grax

    Pranešimai: 0

    mauglis galetum pakurt video kaip tokius dalykus atlikinet :D
    24 Rugsėjo 2015 - 00:13 / #10