Jump to content

yukselkasayka123

Banned
  • Posts

    75
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by yukselkasayka123

  1. Oute kan esi millas gia to system p iparxei gia an dinei ta no grade items stous new paixtes...Auto apo oso nomizo opos ipe kai to palikari pio pano ginete giati profanos i DP tou den itane clear kai otan kapios kanei enan kainourgio paixti to ID tou paixti tixainei na iparxei sta items.sql mesa stin db apo enan palio paixti pou tha ixe kapia items katholou apithano...Kane Wipe mono to Items.sql kai pisteuo pos tha ise mia xara gia an sigoureuteis anoiksei to items.sql kai des ti egrafes iparxoune mesa se auto

    swstos!!! 

  2. na kanw mia erwtisi? to code to pernas se poio npc mpenei auto to code?  giati voicecommand den einai.:/

    gia java-Eclipse ine auto ala an 8es mporis kai se etimo sv katevase to Eclipse kane 1 arxeio L2PasswordChangerInstance.java meta apo8ikeuse to meta eki pou apo8ike3es pare to L2PasswordChangerInstance ginomeno se L2PasswordChagerIstance.class meta pane sto pack sou gameserver/libs an exeis l2jfrozen to exei l2jfrozen-core px: an exeis l2jesios to exei l2jesios-class (ala auto to code ine gia l2jfrozen) anikse to me Winrar meta valto sto com/l2jfrozen/gameserver/model/actor/instance kai  ise etimos. :) idio kai to RequestBypassToServer.java ala 8a to valis sto com/l2jfrozen/gameserver/network/clientpackets . meta pane sto Navicat , custom_npc kane eki 1 NPC me type L2PasswordChanger pane sto in-game oti evales to id kanto //spawn kai ise etimos :)

  3. Code geia password changer manager.  [ gia l2jfrozen. ]

    L2PasswordChangerInstance.java

    package com.l2jfrozen.gameserver.model.actor.instance;
    
    import com.l2jfrozen.crypt.Base64;
    import com.l2jfrozen.gameserver.ai.CtrlIntention;
    import com.l2jfrozen.gameserver.ai.L2CharacterAI;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    import com.l2jfrozen.gameserver.network.serverpackets.LeaveWorld;
    import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
    import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
    import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
    import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    import com.l2jfrozen.util.database.L2DatabaseFactory;
    import java.security.MessageDigest;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.StringTokenizer;
    import java.util.logging.Logger;
    import javolution.text.TextBuilder;
    
    public class L2PasswordChangerInstance extends L2FolkInstance
    {
      public L2PasswordChangerInstance(int objectId, L2NpcTemplate template)
      {
        super(objectId, template);
      }
    
      public void onBypassFeedback(L2PcInstance player, String command)
      {
        if (command.startsWith("change_password"))
        {
          StringTokenizer st = new StringTokenizer(command);
          st.nextToken();
          String currPass = null;
          String newPass = null;
          String repeatNewPass = null;
          try
          {
            if (st.hasMoreTokens())
            {
              currPass = st.nextToken();
              newPass = st.nextToken();
              repeatNewPass = st.nextToken();
            }
            else
            {
              player.sendMessage("Please fill in all the blanks before requesting for a password change.");
              return;
            }
            changePassword(currPass, newPass, repeatNewPass, player);
          }
          catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException)
          {
          }
        }
      }
    
      public void onAction(L2PcInstance player)
      {
        if (!canTarget(player)) {
          return;
        }
    
        if (this != player.getTarget())
        {
          player.setTarget(this);
    
          player.sendPacket(new MyTargetSelected(getObjectId(), 0));
    
          player.sendPacket(new ValidateLocation(this));
        }
        else if (!canInteract(player))
        {
          player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
        }
        else
        {
          showHtmlWindow(player);
        }
    
        player.sendPacket(new ActionFailed());
      }
    
      private void showHtmlWindow(L2PcInstance activeChar)
      {
        NpcHtmlMessage nhm = new NpcHtmlMessage(5);
        TextBuilder replyMSG = new TextBuilder("");
    
        replyMSG.append("<html><title>L2Kasayka Account Manager</title>");
        replyMSG.append("<body><center>");
        replyMSG.append("To change your password:<br1> First fill in your current password and then your new!</font><br>");
        replyMSG.append("Current Password: <edit var=\"cur\" width=100 height=15><br>");
        replyMSG.append("New Password: <edit var=\"new\" width=100 height=15><br>");
        replyMSG.append("Repeat New Password: <edit var=\"repeatnew\" width=100 height=15><br><br>");
        replyMSG.append("<button value=\"Change Password\" action=\"bypass -h npc_" + getObjectId() + "_change_password $cur $new $repeatnew\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">");
        replyMSG.append("</center></body></html>");
    
        nhm.setHtml(replyMSG.toString());
        activeChar.sendPacket(nhm);
    
        activeChar.sendPacket(new ActionFailed());
      }
    
      public static boolean changePassword(String currPass, String newPass, String repeatNewPass, L2PcInstance activeChar)
      {
        if (newPass.length() < 5)
        {
          activeChar.sendMessage("The new password is too short!");
          return false;
        }
        if (newPass.length() > 20)
        {
          activeChar.sendMessage("The new password is too long!");
          return false;
        }
        if (!newPass.equals(repeatNewPass))
        {
          activeChar.sendMessage("Repeated password doesn't match the new password.");
          return false;
        }
    
        Connection con = null;
        String password = null;
        try
        {
          MessageDigest md = MessageDigest.getInstance("SHA");
          byte[] raw = currPass.getBytes("UTF-8");
          raw = md.digest(raw);
          String currPassEncoded = Base64.encodeBytes(raw);
    
          con = L2DatabaseFactory.getInstance().getConnection();
          PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
          statement.setString(1, activeChar.getAccountName());
          ResultSet rset = statement.executeQuery();
          while (rset.next())
          {
            password = rset.getString("password");
          }
          rset.close();
          statement.close();
          byte[] password2 = (byte[])
            null;
          if (currPassEncoded.equals(password))
          {
            password2 = newPass.getBytes("UTF-8");
            password2 = md.digest(password2);
    
            PreparedStatement statement2 = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
            statement2.setString(1, Base64.encodeBytes(password2));
            statement2.setString(2, activeChar.getAccountName());
            statement2.executeUpdate();
            statement2.close();
    
            activeChar.sendMessage("Congratulations! Your password has been changed succesfully. You will now be disconnected for security reasons. Please login again!");
            try
            {
              Thread.sleep(3000L);
            }
            catch (Exception localException1)
            {
            }
    
            activeChar.deleteMe();
    
            activeChar.sendPacket(new LeaveWorld());
          }
          else
          {
            activeChar.sendMessage("The current password you've inserted is incorrect! Please try again!");
    
            return password2 != null;
          }
        }
        catch (Exception e)
        {
          _log.warning("could not update the password of account: " + activeChar.getAccountName());
        }
        finally
        {
          try
          {
            if (con != null)
              con.close();
          }
          catch (SQLException e)
          {
            _log.warning("Failed to close database connection!");
          }
        }
        try
        {
          if (con != null)
            con.close();
        }
        catch (SQLException e)
        {
          _log.warning("Failed to close database connection!");
        }
    
        return true;
      }
    }
    

    RequestBypassToServer.java 
     

    package com.l2jfrozen.gameserver.network.clientpackets;
    
    import com.l2jfrozen.Config;
    import com.l2jfrozen.gameserver.ai.CtrlIntention;
    import com.l2jfrozen.gameserver.ai.L2CharacterAI;
    import com.l2jfrozen.gameserver.communitybbs.CommunityBoard;
    import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
    import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
    import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
    import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
    import com.l2jfrozen.gameserver.managers.CastleManager;
    import com.l2jfrozen.gameserver.model.L2Object;
    import com.l2jfrozen.gameserver.model.L2World;
    import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
    import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jfrozen.gameserver.model.actor.instance.L2SymbolMakerInstance;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PasswordChangerInstance;
    import com.l2jfrozen.gameserver.model.actor.position.L2CharPosition;
    import com.l2jfrozen.gameserver.model.entity.event.CTF;
    import com.l2jfrozen.gameserver.model.entity.event.DM;
    import com.l2jfrozen.gameserver.model.entity.event.L2Event;
    import com.l2jfrozen.gameserver.model.entity.event.TvT;
    import com.l2jfrozen.gameserver.model.entity.event.VIP;
    import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
    import com.l2jfrozen.gameserver.model.entity.siege.Castle;
    import com.l2jfrozen.gameserver.network.L2GameClient;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
    import com.l2jfrozen.gameserver.network.serverpackets.SiegeInfo;
    import com.l2jfrozen.gameserver.util.FloodProtectorAction;
    import com.l2jfrozen.gameserver.util.FloodProtectors;
    import com.l2jfrozen.gameserver.util.GMAudit;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    public final class RequestBypassToServer extends L2GameClientPacket
    {
      private static Logger _log = Logger.getLogger(RequestBypassToServer.class.getName());
      private String _command;
    
      protected void readImpl()
      {
        this._command = readS();
      }
    
      protected void runImpl()
      {
        L2PcInstance activeChar = ((L2GameClient)getClient()).getActiveChar();
    
        if (activeChar == null) {
          return;
        }
        if (!((L2GameClient)getClient()).getFloodProtectors().getServerBypass().tryPerformAction(this._command)) {
          return;
        }
    
        try
        {
          if (this._command.startsWith("admin_"))
          {
            String command;
            String command;
            if (this._command.indexOf(" ") != -1)
            {
              command = this._command.substring(0, this._command.indexOf(" "));
            }
            else
            {
              command = this._command;
            }
    
            IAdminCommandHandler ach = AdminCommandHandler.getInstance().getAdminCommandHandler(command);
    
            if (ach == null)
            {
              if (activeChar.isGM())
              {
                activeChar.sendMessage("The command " + command + " does not exists!");
              }
    
              _log.warning("No handler registered for admin command '" + command + "'");
              return;
            }
    
            if (!AdminCommandAccessRights.getInstance().hasAccess(command, activeChar.getAccessLevel()))
            {
              activeChar.sendMessage("You don't have the access right to use this command!");
              if (Config.DEBUG)
              {
                _log.warning("Character " + activeChar.getName() + " tried to use admin command " + command + ", but doesn't have access to it!");
              }
              return;
            }
    
            if (Config.GMAUDIT)
            {
              GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", command, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target", this._command.replace(command, ""));
            }
    
            ach.useAdminCommand(this._command, activeChar);
          }
          else if ((this._command.equals("come_here")) && (activeChar.isGM()))
          {
            comeHere(activeChar);
          }
          else if (this._command.startsWith("player_help "))
          {
            playerHelp(activeChar, this._command.substring(12));
          }
          else if (this._command.startsWith("siege_aden"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(5);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_giran"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(3);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_goddard"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(7);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_rune"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(8);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_shuttgart"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(9);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_oren"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(4);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_dion"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(2);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_gludio"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(1);
            if (castle != null)
              sendPacket(new SiegeInfo(castle));
          }
          else if (this._command.startsWith("siege_innadril"))
          {
            Castle castle = CastleManager.getInstance().getCastleById(6);
            if (castle != null) {
              sendPacket(new SiegeInfo(castle));
            }
          }
          else if (this._command.startsWith("npc_"))
          {
            if (!activeChar.validateBypass(this._command)) {
              return;
            }
            int endOfId = this._command.indexOf('_', 5);
            String id;
            String id;
            if (endOfId > 0)
            {
              id = this._command.substring(4, endOfId);
            }
            else
            {
              id = this._command.substring(4);
            }
    
            try
            {
              L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
    
              if (this._command.substring(endOfId + 1).startsWith("event_participate"))
              {
                L2Event.inscribePlayer(activeChar);
              }
              else if (this._command.substring(endOfId + 1).startsWith("tvt_player_join "))
              {
                String teamName = this._command.substring(endOfId + 1).substring(16);
    
                if (TvT.is_joining())
                {
                  TvT.addPlayer(activeChar, teamName);
                }
                else
                {
                  activeChar.sendMessage("The event is already started. You can not join now!");
                }
    
              }
              else if (this._command.substring(endOfId + 1).startsWith("tvt_player_leave"))
              {
                if (TvT.is_joining())
                {
                  TvT.removePlayer(activeChar);
                }
                else
                {
                  activeChar.sendMessage("The event is already started. You can not leave now!");
                }
    
              }
              else if (this._command.substring(endOfId + 1).startsWith("dmevent_player_join"))
              {
                if (DM.is_joining())
                  DM.addPlayer(activeChar);
                else {
                  activeChar.sendMessage("The event is already started. You can't join now!");
                }
              }
              else if (this._command.substring(endOfId + 1).startsWith("dmevent_player_leave"))
              {
                if (DM.is_joining())
                  DM.removePlayer(activeChar);
                else {
                  activeChar.sendMessage("The event is already started. You can't leave now!");
                }
              }
              else if (this._command.substring(endOfId + 1).startsWith("ctf_player_join "))
              {
                String teamName = this._command.substring(endOfId + 1).substring(16);
                if (CTF.is_joining())
                  CTF.addPlayer(activeChar, teamName);
                else {
                  activeChar.sendMessage("The event is already started. You can't join now!");
                }
              }
              else if (this._command.substring(endOfId + 1).startsWith("ctf_player_leave"))
              {
                if (CTF.is_joining())
                  CTF.removePlayer(activeChar);
                else {
                  activeChar.sendMessage("The event is already started. You can't leave now!");
                }
              }
              if (this._command.substring(endOfId + 1).startsWith("vip_joinVIPTeam"))
              {
                VIP.addPlayerVIP(activeChar);
              }
    
              if (this._command.substring(endOfId + 1).startsWith("vip_joinNotVIPTeam"))
              {
                VIP.addPlayerNotVIP(activeChar);
              }
    
              if (this._command.substring(endOfId + 1).startsWith("vip_finishVIP"))
              {
                VIP.vipWin(activeChar);
              }
    
              if (this._command.substring(endOfId + 1).startsWith("event_participate"))
              {
                L2Event.inscribePlayer(activeChar);
              }
              else if (((Config.ALLOW_CLASS_MASTERS) && (Config.ALLOW_REMOTE_CLASS_MASTERS) && ((object instanceof L2ClassMasterInstance))) || (
                ((object instanceof L2NpcInstance)) && (endOfId > 0) && (activeChar.isInsideRadius(object, 150, false, false))))
              {
                ((L2NpcInstance)object).onBypassFeedback(activeChar, this._command.substring(endOfId + 1));
              }
    
              activeChar.sendPacket(ActionFailed.STATIC_PACKET);
            }
            catch (NumberFormatException nfe)
            {
              if (!Config.ENABLE_ALL_EXCEPTIONS) return; 
            }nfe.printStackTrace();
          }
          else if (this._command.equals("Draw"))
          {
            L2Object object = activeChar.getTarget();
            if ((object instanceof L2NpcInstance))
            {
              ((L2SymbolMakerInstance)object).onBypassFeedback(activeChar, this._command);
            }
          }
          else if (this._command.equals("RemoveList"))
          {
            L2Object object = activeChar.getTarget();
            if ((object instanceof L2NpcInstance))
            {
              ((L2SymbolMakerInstance)object).onBypassFeedback(activeChar, this._command);
            }
          }
          else if (this._command.equals("Remove "))
          {
            L2Object object = activeChar.getTarget();
    
            if ((object instanceof L2NpcInstance))
            {
              ((L2SymbolMakerInstance)object).onBypassFeedback(activeChar, this._command);
            }
    
          }
          else if (this._command.startsWith("manor_menu_select?"))
          {
            L2Object object = activeChar.getTarget();
            if ((object instanceof L2NpcInstance))
            {
              ((L2NpcInstance)object).onBypassFeedback(activeChar, this._command);
            }
          }
          else if (this._command.startsWith("bbs_"))
          {
            CommunityBoard.getInstance().handleCommands((L2GameClient)getClient(), this._command);
          }
          else if (this._command.startsWith("_bbs"))
          {
            CommunityBoard.getInstance().handleCommands((L2GameClient)getClient(), this._command);
          }
          else if (this._command.startsWith("Quest "))
          {
            if (!activeChar.validateBypass(this._command)) {
              return;
            }
            L2PcInstance player = ((L2GameClient)getClient()).getActiveChar();
            if (player == null) {
              return;
            }
            String p = this._command.substring(6).trim();
            int idx = p.indexOf(' ');
    
            if (idx < 0)
            {
              player.processQuestEvent(p, "");
            }
            else
            {
              player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
            }
    
          }
          else if (this._command.startsWith("custom_"))
          {
            L2PcInstance player = ((L2GameClient)getClient()).getActiveChar();
            CustomBypassHandler.getInstance().handleBypass(player, this._command);
          }
          else if (this._command.startsWith("OlympiadArenaChange"))
          {
            Olympiad.bypassChangeArena(this._command, activeChar);
          }
        }
        catch (Exception e)
        {
          if (Config.ENABLE_ALL_EXCEPTIONS) {
            e.printStackTrace();
          }
          _log.log(Level.WARNING, "Bad RequestBypassToServer: ", e);
        }
      }
    
      private void comeHere(L2PcInstance activeChar)
      {
        L2Object obj = activeChar.getTarget();
        if (obj == null) {
          return;
        }
        if ((obj instanceof L2NpcInstance))
        {
          L2NpcInstance temp = (L2NpcInstance)obj;
          temp.setTarget(activeChar);
          temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0));
        }
      }
    
      private void playerHelp(L2PcInstance activeChar, String path)
      {
        if (path.indexOf("..") != -1) {
          return;
        }
        String filename = "data/html/help/" + path;
        NpcHtmlMessage html = new NpcHtmlMessage(1);
        html.setFile(filename);
        activeChar.sendPacket(html);
      }
    
      public String getType()
      {
        return "[C] 21 RequestBypassToServer";
      }
    }
    
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock