[Release]pokenet+pokemonium (server+client)

Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 51
  1. #31
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,608Posts

    Re: [Release]pokenet+pokemonium (server+client)

    Quote Originally Posted by SniperOmicron View Post
    Am I allowed to share the source code of the server Lucila?
    Why you need his permissions? Make some people happy and release it.

  2. #32

    Re: [Release]pokenet+pokemonium (server+client)

    @sniperOmicron indeed you have it?

    @hillbill go to habbo forum , fan..

  3. #33
    urvoice.info andsnake is offline
    MemberRank
    Feb 2005 Join Date
    NicosiaLocation
    398Posts

    Re: [Release]pokenet+pokemonium (server+client)

    guys chill out ... we are all part of the same community... if Lucila decides to release the source then so be it( i dont deem it right for any of us who Lucila shared the source with, to released it as it is not ours in the first place..). I agree that having the source could help in improving the files as the community has really good coders as members, but it is up to the person who bought it in the end.

    We could however( if there is enough response from the members and if Lucila agrees to it) create a team that works on the files and have a git/svn where normal users can download newest updates the team does on the files or/and contribute with their own fixes to the git/svn, but that it's only my personal opinion...

  4. #34
    Apprentice SniperOmicron is offline
    MemberRank
    Jun 2013 Join Date
    9Posts

    Re: [Release]pokenet+pokemonium (server+client)

    Quote Originally Posted by HillBilly View Post
    Why you need his permissions? Make some people happy and release it.
    It is because I know how it feels if your source codes get released without permissions.

    Quote Originally Posted by Lucila View Post
    @sniperOmicron indeed you have it?
    Yes, I do have it. I got the .jar file reversed.

    Quick example:
    Spoiler:

    Code:
    package org.pokenet.server;
    
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.PrintStream;
    import java.io.PrintWriter;
    import java.util.Scanner;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    import org.apache.commons.cli.CommandLine;
    import org.apache.commons.cli.CommandLineParser;
    import org.apache.commons.cli.GnuParser;
    import org.apache.commons.cli.HelpFormatter;
    import org.apache.commons.cli.Options;
    import org.apache.commons.cli.ParseException;
    import org.ini4j.Ini;
    import org.ini4j.Ini.Section;
    import org.ini4j.InvalidIniFormatException;
    import org.pokenet.server.connections.ActiveConnections;
    import org.pokenet.server.network.MySqlManager;
    
    
    public class GameServer {
    
    
        private static final int SERVER_REVISION = 1910;
        private static boolean m_boolGui = false;
        private static String m_dbServer;
        private static String m_dbName;
        private static String m_dbUsername;
        private static String m_dbPassword;
        private static String m_serverName;
        private static GameServer m_instance;
        private static int m_maxPlayers = 500;
        private static ServiceManager m_serviceManager;
        private static int m_port = 7002;
        private JFrame m_gui;
        private JLabel m_pAmount;
        private JLabel m_pHighest;
        private JButton m_start;
        private JButton m_stop;
        private JButton m_set;
        private JButton m_exit;
        private JPasswordField m_dbP;
        private JTextField m_dbS;
        private JTextField m_dbN;
        private JTextField m_dbU;
        private JTextField m_name;
        private int m_highest;
        public static double RATE_GOLD = 1.0D;
        public static double RATE_EXP_POKE = 1.0D;
        public static double RATE_EXP_TRAINER = 1.0D;
        public static final int MOVEMENT_THREADS = 12;
    
    
        public GameServer(boolean autorun) {
            if (autorun) {
                if (m_boolGui) {
                    createGui();
                }
                loadSettings();
            } else if (m_boolGui) {
                loadSettings();
                createGui();
            } else {
                ConsoleReader r = new ConsoleReader();
                System.out.println("Load Settings? Y/N");
                String answer = r.readToken();
                if ((answer.contains("y")) || (answer.contains("Y"))) {
                    loadSettings();
                } else {
                    getConsoleSettings();
                }
            }
            start();
        }
    
    
        public void updatePlayerCount() {
            if (m_boolGui) {
                int amount = ActiveConnections.getActiveConnections();
                this.m_pAmount.setText(amount + " players online");
                if (amount > this.m_highest) {
                    this.m_highest = amount;
                    this.m_pHighest.setText("Highest: " + amount);
                }
            } else {
                int amount = ActiveConnections.getActiveConnections();
                System.out.println(amount + " players online");
                if (amount > this.m_highest) {
                    this.m_highest = amount;
                    System.out.println("Highest: " + amount);
                }
            }
        }
    
    
        public static String getDatabaseHost() {
            return m_dbServer;
        }
    
    
        public static String getDatabaseName() {
            return m_dbName;
        }
    
    
        public static String getDatabasePassword() {
            return m_dbPassword;
        }
    
    
        public static String getDatabaseUsername() {
            return m_dbUsername;
        }
    
    
        public static GameServer getInstance() {
            return m_instance;
        }
    
    
        public static void initGameServer(boolean autorun) {
            m_instance = new GameServer(autorun);
        }
    
    
        public static int getMaxPlayers() {
            return m_maxPlayers;
        }
    
    
        public static int getPort() {
            return m_port;
        }
    
    
        public static String getServerName() {
            return m_serverName;
        }
    
    
        public static ServiceManager getServiceManager() {
            return m_serviceManager;
        }
    
    
        public static void main(String[] args) {
            try {
                PrintStream p = new PrintStream(new File("./errors.txt"));
                System.setErr(p);
            } catch (Exception e) {
                e.printStackTrace();
            }
    
    
            Options options = new Options();
            options.addOption("p", "players", true, "Sets the max number of players.");
            options.addOption("port", "port", true, "Sets the serverport.");
            options.addOption("ng", "nogui", false, "Starts server in headless mode.");
            options.addOption("ar", "autorun", false, "Runs without asking a single question.");
            options.addOption("h", "help", false, "Shows this menu.");
            options.addOption("rates", "serverrates", true, "Gives the file to be used for server rates config");
            if (args.length > 0) {
                CommandLineParser parser = new GnuParser();
                try {
                    CommandLine line = parser.parse(options, args);
                    if (line.hasOption("players")) {
                        m_maxPlayers = Integer.parseInt(line.getOptionValue("players"));
                        if (m_maxPlayers < 1) {
                            m_maxPlayers = 500;
                        }
                    }
                    if (line.hasOption("port")) {
                        m_port = Integer.parseInt(line.getOptionValue("port"));
                    }
                    if (line.hasOption("help")) {
                        HelpFormatter formatter = new HelpFormatter();
                        System.err.println("Server requires a settings parameter");
                        formatter.printHelp("java GameServer [param] <args>", options);
                    }
    
    
                    if (!line.hasOption("nogui")) {
                        m_boolGui = true;
                    }
    
    
                    if (line.hasOption("rates")) {
                        String rates = line.getOptionValue("rates");
                        Ini ratesIni = new Ini(new FileInputStream(rates));
                        Ini.Section s = (Ini.Section) ratesIni.get("RATES");
                        RATE_GOLD = Double.parseDouble((String) s.get("GOLD"));
                        RATE_EXP_POKE = Double.parseDouble((String) s.get("EXP_POKE"));
                        RATE_EXP_TRAINER = Double.parseDouble((String) s.get("EXP_TRAINER"));
                    }
    
    
                    boolean autorun = line.hasOption("autorun");
                    initGameServer(autorun);
                } catch (ParseException exp) {
                    System.err.println("Parsing failed.  Reason: " + exp.getMessage());
    
    
                    HelpFormatter formatter = new HelpFormatter();
                    formatter.printHelp("java GameServer [param] <args>", options);
                } catch (InvalidIniFormatException e) {
                    e.printStackTrace();
                    System.err.println("Error in server rates format, using default 1.0");
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
    
    
            } else {
                HelpFormatter formatter = new HelpFormatter();
                System.err.println("Server requires a settings parameter");
                formatter.printHelp("java GameServer [param] <args>", options);
            }
        }
    
    
        public void start() {
            if (m_boolGui) {
                m_dbServer = this.m_dbS.getText();
                m_dbName = this.m_dbN.getText();
                m_dbUsername = this.m_dbU.getText();
                m_dbPassword = new String(this.m_dbP.getPassword());
                m_serverName = this.m_name.getText();
    
    
                this.m_start.setEnabled(false);
                this.m_stop.setEnabled(true);
            }
    
    
            MySqlManager.getInstance();
            m_serviceManager = new ServiceManager();
            m_serviceManager.start();
        }
    
    
        public void stop() {
            m_serviceManager.stop();
            if (m_boolGui) {
                this.m_start.setEnabled(true);
                this.m_stop.setEnabled(false);
            } else {
                try {
                    Thread.sleep(10000L);
                    System.out.println("Exiting server...");
                    MySqlManager.getInstance().close();
                    System.exit(0);
                } catch (InterruptedException localInterruptedException) {
                }
            }
        }
    
    
        private void createGui() {
            this.m_gui = new JFrame();
            this.m_gui.setTitle("Pokenet Server");
            this.m_gui.setSize(148, 340);
            this.m_gui.setDefaultCloseOperation(0);
            this.m_gui.getContentPane().setLayout(null);
            this.m_gui.setResizable(false);
            this.m_gui.setLocation(32, 32);
    
    
            this.m_pAmount = new JLabel("0 players online");
            this.m_pAmount.setSize(160, 16);
            this.m_pAmount.setLocation(4, 4);
            this.m_pAmount.setVisible(true);
            this.m_gui.getContentPane().add(this.m_pAmount);
    
    
            this.m_pHighest = new JLabel("[No record]");
            this.m_pHighest.setSize(160, 16);
            this.m_pHighest.setLocation(4, 24);
            this.m_pHighest.setVisible(true);
            this.m_gui.getContentPane().add(this.m_pHighest);
    
    
            this.m_start = new JButton("Start Server");
            this.m_start.setSize(128, 24);
            this.m_start.setLocation(4, 48);
            this.m_start.addActionListener(new ActionListener() {
    
    
                public void actionPerformed(ActionEvent arg0) {
                    GameServer.this.start();
                }
            });
            this.m_gui.getContentPane().add(this.m_start);
            this.m_stop = new JButton("Stop Server");
            this.m_stop.setSize(128, 24);
            this.m_stop.setLocation(4, 74);
            this.m_stop.setEnabled(false);
            this.m_stop.addActionListener(new ActionListener() {
    
    
                public void actionPerformed(ActionEvent arg0) {
                    GameServer.this.stop();
                }
            });
            this.m_gui.getContentPane().add(this.m_stop);
            this.m_set = new JButton("Save Settings");
            this.m_set.setSize(128, 24);
            this.m_set.setLocation(4, 100);
            this.m_set.addActionListener(new ActionListener() {
    
    
                public void actionPerformed(ActionEvent arg0) {
                    GameServer.this.saveSettings();
                }
            });
            this.m_gui.getContentPane().add(this.m_set);
            this.m_exit = new JButton("Quit");
            this.m_exit.setSize(128, 24);
            this.m_exit.setLocation(4, 290);
            this.m_exit.addActionListener(new ActionListener() {
    
    
                public void actionPerformed(ActionEvent arg0) {
                    GameServer.this.exit();
                }
            });
            this.m_gui.getContentPane().add(this.m_exit);
    
    
            this.m_dbS = new JTextField();
            this.m_dbS.setSize(128, 24);
            this.m_dbS.setText("MySQL Host");
            this.m_dbS.setLocation(4, 128);
            this.m_gui.getContentPane().add(this.m_dbS);
    
    
            this.m_dbN = new JTextField();
            this.m_dbN.setSize(128, 24);
            this.m_dbN.setText("MySQL Database Name");
            this.m_dbN.setLocation(4, 160);
            this.m_gui.getContentPane().add(this.m_dbN);
    
    
            this.m_dbU = new JTextField();
            this.m_dbU.setSize(128, 24);
            this.m_dbU.setText("MySQL Username");
            this.m_dbU.setLocation(4, 192);
            this.m_gui.getContentPane().add(this.m_dbU);
    
    
            this.m_dbP = new JPasswordField();
            this.m_dbP.setSize(128, 24);
            this.m_dbP.setText("Pass");
            this.m_dbP.setLocation(4, 224);
            this.m_gui.getContentPane().add(this.m_dbP);
    
    
            this.m_name = new JTextField();
            this.m_name.setSize(128, 24);
            this.m_name.setText("Your Server Name");
            this.m_name.setLocation(4, 260);
            this.m_gui.getContentPane().add(this.m_name);
    
    
            File f = new File("res/settings.txt");
            if (f.exists()) {
                try {
                    Scanner s = new Scanner(f);
                    this.m_dbS.setText(s.nextLine());
                    this.m_dbN.setText(s.nextLine());
                    this.m_dbU.setText(s.nextLine());
                    this.m_dbP.setText(s.nextLine());
                    this.m_name.setText(s.nextLine());
                    s.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            this.m_gui.setVisible(true);
        }
    
    
        private void exit() {
            if ((m_boolGui) && (this.m_stop.isEnabled())) {
                JOptionPane.showMessageDialog(null, "You must stop the server before exiting.");
            } else {
                MySqlManager.getInstance().close();
                System.exit(0);
            }
        }
    
    
        private void getConsoleSettings() {
            ConsoleReader r = new ConsoleReader();
            System.out.println("Please enter the required information.");
            System.out.println("Database Server: ");
            m_dbServer = r.readToken();
            System.out.println("Database Name:");
            m_dbName = r.readToken();
            System.out.println("Database Username:");
            m_dbUsername = r.readToken();
            System.out.println("Database Password:");
            m_dbPassword = r.readToken();
            System.out.println("This server's IP or hostname:");
            m_serverName = r.readToken();
            System.out.println("Save info? (Y/N)");
            String answer = r.readToken();
            if ((answer.contains("y")) || (answer.contains("Y"))) {
                saveSettings();
            }
            System.out.println();
            System.err.println("WARNING: When using -nogui, the server should only be shut down using a master client");
        }
    
    
        private void loadSettings() {
            File settings = new File("res/settings.txt");
            if (settings.exists()) {
                try {
                    Scanner s = new Scanner(settings);
                    m_dbServer = s.nextLine();
                    m_dbName = s.nextLine();
                    m_dbUsername = s.nextLine();
                    m_dbPassword = s.nextLine();
                    m_serverName = s.nextLine();
                    s.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    
    
        private void saveSettings() {
            try {
                if (m_boolGui) {
                    m_dbServer = this.m_dbS.getText();
                    m_dbName = this.m_dbN.getText();
                    m_dbUsername = this.m_dbU.getText();
                    m_dbPassword = new String(this.m_dbP.getPassword());
                    m_serverName = this.m_name.getText();
                }
    
    
                File settings = new File("res/settings.txt");
                if (settings.exists()) {
                    settings.delete();
                }
                PrintWriter settingsWriter = new PrintWriter(settings);
                settingsWriter.println(m_dbServer);
                settingsWriter.println(m_dbName);
                settingsWriter.println(m_dbUsername);
                settingsWriter.println(m_serverName);
                settingsWriter.println(" ");
                settingsWriter.flush();
                settingsWriter.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    Last edited by SniperOmicron; 11-09-13 at 06:14 PM.

  5. #35
    Apprentice joshyb123 is offline
    MemberRank
    Nov 2009 Join Date
    21Posts

    Re: [Release]pokenet+pokemonium (server+client)

    Tried jre6 and jre7, giving me the same issue....
    Still can't launch this client at all.

  6. #36

    Re: [Release]pokenet+pokemonium (server+client)

    @sniper: dont share the source , thanks :)

    @joshyb: addme skype: wolf.-91@hotmail.com

  7. #37
    Red like a Tomato! tomad is offline
    MemberRank
    Nov 2007 Join Date
    NetherlandsLocation
    358Posts

    Re: [Release]pokenet+pokemonium (server+client)

    I can't launch the client either.

  8. #38
    Account Upgraded | Title Enabled! xkl is offline
    MemberRank
    Dec 2011 Join Date
    285Posts

    Re: [Release]pokenet+pokemonium (server+client)

    I could get/share that source... Might do it when I'm home.

  9. #39

    Re: [Release]pokenet+pokemonium (server+client)

    try this .bat
    Attached Files Attached Files

  10. #40

    Re: [Release]pokenet+pokemonium (server+client)

    Quote Originally Posted by xkl View Post
    I could get/share that source... Might do it when I'm home.
    please! get the client source and share !!

  11. #41
    Account Upgraded | Title Enabled! xkl is offline
    MemberRank
    Dec 2011 Join Date
    285Posts

    Re: [Release]pokenet+pokemonium (server+client)


  12. #42
    Account Upgraded | Title Enabled! asianking is offline
    MemberRank
    Aug 2009 Join Date
    273Posts

    Re: [Release]pokenet+pokemonium (server+client)

    link dead. Pls upload to mediafire.

  13. #43
    Apprentice joshyb123 is offline
    MemberRank
    Nov 2009 Join Date
    21Posts

    Re: [Release]pokenet+pokemonium (server+client)

    Quote Originally Posted by Lucila View Post
    try this .bat
    That one worked, thanks :)

  14. #44
    Account Upgraded | Title Enabled! viperpray is offline
    MemberRank
    Apr 2007 Join Date
    87Posts

    Re: [Release]pokenet+pokemonium (server+client)

    this source is at the vary beginning of our conversion to 1.7 so no matter what one you use your going to run into issues with the source. Not working with one or the other.

  15. #45
    Pemuja Setan Iblis ElectricShock is offline
    MemberRank
    Aug 2012 Join Date
    Tempat NgeweLocation
    221Posts

    Re: [Release]pokenet+pokemonium (server+client)

    pokeballs?



Page 3 of 4 FirstFirst 1234 LastLast

Advertisement