Jump to content

[Share]MMOCore


xAddytzu

Recommended Posts

I readed articles and saw that all want mmocore fixed

I decided to put my mmocore

:It's for Interlude (Used on L2J)

:L2j Server Attacker (Fixed)

 

AbstractPacket.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.ByteBuffer;


/**
* @author KenM
*
*/
public abstract class AbstractPacket<T extends MMOClient>
{
   protected ByteBuffer _buf;
   
   protected T _client;
   
   protected void setClient(T client)
   {
       _client = client;
   }
   
   public T getClient()
   {
       return _client;
   }
   
   protected void setByteBuffer(ByteBuffer buf)
   {
       _buf = buf;
   }
   
   protected ByteBuffer getByteBuffer()
   {
       return _buf;
   }
}

=====================================

IAcceptFilter.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.channels.SocketChannel;

/**
* @author KenM
*
*/
public interface IAcceptFilter
{
   public boolean accept(SocketChannel sc);
}

=====================================

IClientFactory.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

/**
* @author KenM
*
*/
public interface IClientFactory<T extends MMOClient>
{
   public T create(MMOConnection<T> con);
}

=====================================

IMMOExecutor.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;


/**
* @author KenM
*
*/
public interface IMMOExecutor<T extends MMOClient>
{
   public void execute(ReceivablePacket<T> packet);
}

=====================================

IPacketHandler.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.ByteBuffer;


/**
* @author KenM
*
*/
public interface IPacketHandler<T extends MMOClient>
{
   public ReceivablePacket<T> handlePacket(ByteBuffer buf, T client);
}

=====================================

MMOClient.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.ByteBuffer;

/**
* @author KenM
*
*/
public abstract class MMOClient<T extends MMOConnection>
{
   private T _connection;
   
   @SuppressWarnings("unchecked")
   public MMOClient(T con)
   {
       this.setConnection(con);
       con.setClient(this);
   }
   
   protected void setConnection(T con)
   {
       _connection = con;
   }
   
   public T getConnection()
   {
       return _connection;
   }
   
   public void closeNow()
   {
       this.getConnection().closeNow();
   }
   
   public void closeLater()
   {
       this.getConnection().closeLater();
   }
   
   public abstract boolean decrypt(ByteBuffer buf, int size);
   
   public abstract boolean encrypt(ByteBuffer buf, int size);
   
   protected void onDisconection()
   {
   }
   
   protected void onForcedDisconnection()
   {
   }
}

=====================================

MMOConnection.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;


import javolution.util.FastList;

/**
* @author KenM
*
*/
public class MMOConnection<T extends MMOClient>
{
   private final SelectorThread<T> _selectorThread;
   private T _client;
   
   private SocketChannel _socketChannel;
   private FastList<SendablePacket<T>> _sendQueue = new FastList<SendablePacket<T>>();
   private SelectionKey _selectionKey;
   
   private ByteBuffer _readBuffer;
   private ByteBuffer _writeBuffer;
   
   private boolean _pendingClose;
   
   public MMOConnection(SelectorThread<T> selectorThread, SocketChannel sc, SelectionKey key)
   {
       _selectorThread = selectorThread;
       this.setSocketChannel(sc);
       this.setSelectionKey(key);
   }
   
   protected void setClient(T client)
   {
       _client = client;
   }
   
   protected T getClient()
   {
       return _client;
   }
   
   public void sendPacket(SendablePacket<T> sp)
   {
       sp.setClient(this.getClient());
       synchronized (this.getSendQueue())
       {
           if (!_pendingClose)
           {
               try
               {
                   this.getSelectionKey().interestOps(this.getSelectionKey().interestOps() | SelectionKey.OP_WRITE);
                   this.getSendQueue().addLast(sp);
               }
               catch (CancelledKeyException e)
               {
                   // ignore
               }
           }
       }
   }
   
   protected SelectorThread<T> getSelectorThread()
   {
       return _selectorThread;
   }
   
   protected void setSelectionKey(SelectionKey key)
   {
       _selectionKey = key;
   }
   
   protected SelectionKey getSelectionKey()
   {
       return _selectionKey;
   }
   
   protected void enableReadInterest()
   {
       try
       {
           this.getSelectionKey().interestOps(this.getSelectionKey().interestOps() | SelectionKey.OP_READ);
       }
       catch (CancelledKeyException e)
       {
           // ignore
       }
   }
   
   protected void disableReadInterest()
   {
       try
       {
           this.getSelectionKey().interestOps(this.getSelectionKey().interestOps() & ~SelectionKey.OP_READ);
       }
       catch (CancelledKeyException e)
       {
           // ignore
       }
   }
   
   protected void enableWriteInterest()
   {
       try
       {
           this.getSelectionKey().interestOps(this.getSelectionKey().interestOps() | SelectionKey.OP_WRITE);
       }
       catch (CancelledKeyException e)
       {
           // ignore
       }
   }
   
   protected void disableWriteInterest()
   {
       try
       {
           this.getSelectionKey().interestOps(this.getSelectionKey().interestOps() & ~SelectionKey.OP_WRITE);
       }
       catch (CancelledKeyException e)
       {
           // ignore
       }
   }
   
   protected void setSocketChannel(SocketChannel sc)
   {
       _socketChannel = sc;
   }
   
   public SocketChannel getSocketChannel()
   {
       return _socketChannel;
   }
   
   protected FastList<SendablePacket<T>> getSendQueue()
   {
       return _sendQueue;
   }
   
   protected void setWriteBuffer(ByteBuffer buf)
   {
       _writeBuffer = buf;
   }
   
   protected ByteBuffer getWriteBuffer()
   {
       return _writeBuffer;
   }
   
   protected void setReadBuffer(ByteBuffer buf)
   {
       _readBuffer = buf;
   }
   
   protected ByteBuffer getReadBuffer()
   {
       return _readBuffer;
   }
   
   public boolean isClosed()
   {
       return _pendingClose;
   }
   
   protected void closeNow()
   {
       synchronized (this.getSendQueue())
       {
           _pendingClose = true;
           this.getSendQueue().clear();
           this.disableWriteInterest();
       }
       this.getSelectorThread().closeConnection(this);
   }
   
   public void close(SendablePacket<T> sp)
   {
       synchronized (this.getSendQueue())
       {
           this.getSendQueue().clear();
           this.sendPacket(sp);
           _pendingClose = true;
       }
       this.getSelectorThread().closeConnection(this);
   }
   
   protected void closeLater()
   {
       synchronized (this.getSendQueue())
       {
           _pendingClose = true;
       }
       this.getSelectorThread().closeConnection(this);
   }
   
   protected void onDisconection()
   {
       this.getClient().onDisconection();
   }
   
   protected void onForcedDisconnection()
   {
       this.getClient().onForcedDisconnection();
   }
}

=====================================

ReceivablePacket.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;


import javolution.text.TextBuilder;

/**
* @author KenM
*
*/
public abstract class ReceivablePacket<T extends MMOClient> extends AbstractPacket<T> implements Runnable
{
   protected ReceivablePacket()
   {
       
   }
   
   protected int getAvaliableBytes()
   {
       return this.getByteBuffer().remaining();
   }
   
   protected abstract boolean read();
   
   public abstract void run();
   
   protected void readB(byte[] dst)
   {
       this.getByteBuffer().get(dst);
   }
   
   protected void readB(byte[] dst, int offset, int len)
   {
       this.getByteBuffer().get(dst, offset, len);
   }
   
   protected int readC()
   {
       return this.getByteBuffer().get() & 0xFF;
   }
   
   protected int readH()
   {
       return this.getByteBuffer().getShort() & 0xFFFF;
   }
   
   protected int readD()
   {
       return this.getByteBuffer().getInt();
   }
   
   protected long readQ()
   {
       return this.getByteBuffer().getLong();
   }
   
   protected double readF()
   {
       return this.getByteBuffer().getDouble();
   }
   
   protected String readS()
   {
       TextBuilder tb = TextBuilder.newInstance();
       char ch;
       while((ch = getByteBuffer().getChar()) != 0) 
           tb.append(ch);
       String str = tb.stringValue();
       TextBuilder.recycle(tb);
       return str;
   }
}

=====================================

SelectorConfig.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.nio.ByteOrder;

/**
* @author KenM
*
*/
public class SelectorConfig
{
   
   private int READ_BUFFER_SIZE = 64*1024;
   private int WRITE_BUFFER_SIZE = 64*1024;
   private HeaderSize HEADER_TYPE = HeaderSize.SHORT_HEADER;
   private int HELPER_BUFFER_SIZE = 64*1024;
   private int HELPER_BUFFER_COUNT = 20;
   private ByteOrder BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;
   
   /**
    * BYTE_HEADER: unsigned byte, max size: 255 <BR>
    * SHORT_HEADER: unsigned short, max size: 65535<BR>
    * INT_HEADER: signed integer, max size: Integer.MAX_SIZE<BR>
    * @author KenM
    */
   public static enum HeaderSize
   { 
       BYTE_HEADER,
       SHORT_HEADER,
       INT_HEADER,
   }
   
   public SelectorConfig()
   {
   }
   
   public int getReadBufferSize()
   {
       return READ_BUFFER_SIZE;
   }
   
   public int getWriteBufferSize()
   {
       return READ_BUFFER_SIZE;
   }
   
   public int getHelperBufferSize()
   {
       return HELPER_BUFFER_SIZE;
   }
   
   public int getHelperBufferCount()
   {
       return HELPER_BUFFER_COUNT;
   }
   
   public ByteOrder getByteOrder()
   {
       return BYTE_ORDER;
   }
   
   public HeaderSize getHeaderType()
   {
       return HEADER_TYPE;
   }
}

=====================================

SelectorServerConfig.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;

import java.net.InetAddress;

/**
* @author KenM
*
*/
public class SelectorServerConfig extends SelectorConfig
{
   private final int SERVER_PORT;
   private final InetAddress SERVER_ADDRESS;
   
   public SelectorServerConfig(int port)
   {
       this(null, port);
   }
   
   public SelectorServerConfig(InetAddress address, int port)
   {
       SERVER_PORT = port;
       SERVER_ADDRESS = address;
   }
   
   public int getPort()
   {
       return SERVER_PORT;
   }
   
   public InetAddress getAddress()
   {
       return SERVER_ADDRESS;
   }
}

=====================================

SelectorThread.java

http://www.4shared.com/file/183645656/a50d2d56/SelectorThread.html

=====================================

SendablePacket.java

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jserver.mmocore.network;


import com.l2jserver.mmocore.network.SelectorConfig.HeaderSize;

/**
* @author KenM
*
*/
public abstract class SendablePacket<T extends MMOClient> extends AbstractPacket<T>
{
   protected void writeC(int data)
   {
       this.getByteBuffer().put((byte) data);
   }
   
   protected void writeF(double value)
   {
       this.getByteBuffer().putDouble(value);
   }
   
   protected void writeH(int value)
   {
       this.getByteBuffer().putShort((short) value);
   }
   
   protected void writeD(int value)
   {
       this.getByteBuffer().putInt(value);
   }
   
   protected void writeQ(long value)
   {
       this.getByteBuffer().putLong(value);
   }
   
   protected void writeB(byte[] data)
   {
       this.getByteBuffer().put(data);
   }
   
   protected void writeS(CharSequence charSequence)
   {
       if (charSequence == null)
       {
           charSequence = "";
       }
       
       int length = charSequence.length();
       for (int i = 0; i < length; i++)
       {
           this.getByteBuffer().putChar(charSequence.charAt(i));
       }
       this.getByteBuffer().putChar('\000');
   }
   
   protected abstract void write();
   
   protected void writeHeader(HeaderSize ht, int pos)
   {
       switch (ht)
       {
           case BYTE_HEADER:
               this.getByteBuffer().put(pos, (byte) this.getByteBuffer().position());
               break;
           case SHORT_HEADER:
               this.getByteBuffer().putShort(pos, (short) this.getByteBuffer().position());
               break;
           case INT_HEADER:
               this.getByteBuffer().putInt(pos, this.getByteBuffer().position());
               break;
       }
   }
}

Link to comment
Share on other sites

jeeez "learn to add a share" thats like argh...as i see you dont have a clue about diff file...

 

and btw we dont give  +1 karma for c/p karma restored.

Link to comment
Share on other sites

jeeez "learn to add a share" thats like argh...as i see you dont have a clue about diff file...

 

and btw we dont give  +1 karma for c/p karma restored.

from where he copied this ?.

Link to comment
Share on other sites

He made some modifications to avoid, L2JAttack. You idiot.

 

you idiot the fix is posted in l2j forum its just delete the result 0 content.

Link to comment
Share on other sites

you idiot the fix is posted in l2j forum its just delete the result 0 content.

Okay, it was hard to give an answer to a simple questions ?

 

@ONTopic: xAddy, i will give you +1 Karma for your all Shares, in your Next SHARE. Great Work.

Link to comment
Share on other sites

+1 Karma from me for all  of his shares that they rocking!!!

Also about Interpid why you dont share somthing and you only know to dekarma and collecting posts??

STFU NooB Interpid Is L2JMod

Try To Give +1 And I Will Dekarma You

Link to comment
Share on other sites

+1 Karma from me for all  of his shares that they rocking!!!

Also about Interpid why you dont share somthing and you only know to dekarma and collecting posts??

 

1st still i have the most shares in this section with 16 java share(own shares not c/p like you biatchs do)

2nd im mod i need to show activity and yes with that comes i need to post too.

 

PS.:i have over 900 post in the dev help section so shut your little mouth you can talk like that when you did what i did bb

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • to my store : https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore11 Whatsapp ; +212614849119
    • This is my first and last topic created on a Lineage Forum, because if there's one thing that causes headaches for a lot of people, it's the critical error, that's why I decided to share it...   I'm creating a server again and before starting configurations I started collecting dozens of customs, without realizing my system folder had 950MB of files, so I started to enter the game, every 1 to 2 hours my client was reaching the maximum limit of virtual memory of the game due to the absurd amount of customs inside the system folder, reaching the maximum limit of 2047MB virtual ram, automatically we get critical, regardless of the error that appears on your screen, "THE WORDS ARE IRRELEVANT, unless it is a critical error before the ram memory limit reaches its limit", if you are seeing "2047 MB", it means that the game's virtual memory has reached its limit, and this memory is not configurable due to the game being created on 32-bit architecture, so I significantly reduced the amount of customs within the system from 950MB to 625MB, so my client started to reach the maximum memory limit every 10 to 12h, a huge progress, but my goal was at least 24h before reaching the virtual memory limit (playing frantically), so I reduced the system's custom files from 625MB to 267MB, the result was a first virtual memory limit critical error appearing after 41h.   My client is H5, the only types of customs I added to the game were focused only on equipment, one of the main causes were these skins and cloaks, they consume a huge amount of MB's within the "system", the problem is not adding customs to the client, the problem is adapting a custom and adding it inside the system folder, the system folder was not created with the intention of storing a huge amount of files.   Adding customs to the system folder means significantly reducing the time your client can remain open before reaching the virtual ram limit and make no mistake, there are hundreds of different critical errors with a small summary of the cause of the error, but if the critical table shows 2047MB of RAM, the problem is only 1. Example: I can see 3, 5, 9 critical error with different messages, but if this table is showing 2047MB ram, the reason was the virtual memory limit, an important detail is that this 2047MB ram is not a "fixed message or information from your computer", this 2047MB only appear when the cause is the virtual ram limit, it means that when you get a critical error with random numbers of ram memory appearing, such as 358MB ram, 715MB ram, it means that the cause of this error has no connection with ram virtual memory.
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products  https://discord.gg/hoodservices https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...