Jump to content

Custom Effects At Echant Armor And More..


Recommended Posts

Hello Mxc,Today Ill Show You Some Codes I think Some Off this Is Not Shared Or Is shared Before 2009.

 

 

 

 

 

 

First ill Show You Enchant armor auto get abnormal effect

When you have enchanted your armor +16 there will be show an abnormal effect if you want you can change it!

l2character.java search for abnormal effects

 

Go at inventory.java after this line 

"+armorSet.getEnchant6skillId()+".");

add this

if (armorSet.isEnchanted16(player))
{
player.startAbnormalEffect(L2Character.ABNORMAL_EFFECT_STEALTH);
 }

before this line

 if(removeSkillId1 != 0)
                        {
                                L2Skill skill = SkillTable.getInstance().getInfo(removeSkillId1,1);

add this

player.stopAbnormalEffect(L2Character.ABNORMAL_EFFECT_STEALTH);
                  

Now go to L2Armorset.java and add this

    
    public boolean isEnchanted16(L2PcInstance player)
    {
         // Player don't have full set
        if(!containAll(player))
            return false;

        Inventory inv = player.getInventory();

        L2ItemInstance chestItem  = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
        L2ItemInstance legsItem   = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
        L2ItemInstance headItem   = inv.getPaperdollItem(Inventory.PAPERDOLL_HEAD);
        L2ItemInstance glovesItem = inv.getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
        L2ItemInstance feetItem   = inv.getPaperdollItem(Inventory.PAPERDOLL_FEET);

        if(chestItem.getEnchantLevel() < 16)
            return false;
        if(_legs != 0 && legsItem.getEnchantLevel() < 16)
            return false;
        if(_gloves != 0 && glovesItem.getEnchantLevel() < 16)
            return false;
        if(_head != 0 && headItem.getEnchantLevel() < 16)
            return false;
        if(_feet != 0 && feetItem.getEnchantLevel() < 16)
            return false;

        return true;
    }

Thats all with this..

 

Then i give too one code L2Password Changer with command and without npc and nah...bored this

 

 

 

 

Create a public class ChangePassword At Com.L2jfrozen.Gameserver.Hander.VoicedCommandHandler

and then add this

/*
 * 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 <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
 
import java.security.MessageDigest;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
 
import com.l2jfrozen.crypt.Base64;
import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
 
/*
 * @Author: Abyssal
 */
 
public class ChangePassword implements IVoicedCommandHandler
{
        private static final String[] _voicedCommands =
        {
                "changepass"
        };
 
        @Override
        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
                if(command.equalsIgnoreCase("changepass") && target != null)
                {
                        StringTokenizer st = new StringTokenizer(target);
                        try
                        {
                                String curpass = null, newpass = null, repeatnewpass = null;
 
                                if(st.hasMoreTokens())
                                        curpass = st.nextToken();
                                if(st.hasMoreTokens())
                                        newpass = st.nextToken();
                                if(st.hasMoreTokens())
                                        repeatnewpass = st.nextToken();
 
                                if(!(curpass == null || newpass == null || repeatnewpass == null))
                                {
                                        if(!newpass.equals(repeatnewpass))
                                        {
                                                activeChar.sendMessage("The new password doesn't match with the repeated one!");
                                                return false;
                                        }
                                        if(newpass.length() < 4)
                                        {
                                                activeChar.sendMessage("The new password is shorter than 4 characters! Please try with a longer one.");
                                                return false;
                                        }
                                        if(newpass.length() > 25)
                                        {
                                                activeChar.sendMessage("The new password is longer than 25 characters! Please try with a shorter one.");
                                                return false;
                                        }
 
                                        MessageDigest md = MessageDigest.getInstance("SHA");
 
                                        byte[] raw = curpass.getBytes("UTF-8");
                                        raw = md.digest(raw);
                                        String curpassEnc = Base64.encodeBytes(raw);
                                        String pass = null;
                                        int passUpdated = 0;
 
                                        Connection con = null;
                                        con = L2DatabaseFactory.getInstance().getConnection();
                                        PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
                                        statement.setString(1, activeChar.getAccountName());
                                        ResultSet rset = statement.executeQuery();
 
                                        if(rset.next())
                                        {
                                                pass = rset.getString("password");
                                        }
 
                                        rset.close();
                                        statement.close();
 
                                        if(curpassEnc.equals(pass))
                                        {
                                                byte[] password = newpass.getBytes("UTF-8");
                                                password = md.digest(password);
 
                                                PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
                                                ps.setString(1, Base64.encodeBytes(password));
                                                ps.setString(2, activeChar.getAccountName());
                                                passUpdated = ps.executeUpdate();
                                                ps.close();
                                                con.close();
                                               
                                                if(passUpdated > 0)
                                                {
                                                        activeChar.sendMessage("You have successfully changed your password!");
                                                        activeChar.sendPacket(new ExShowScreenMessage("You have successfully changed your password!#Enjoy :)", 6000));
                                                }
                                                else
                                                {
                                                                activeChar.sendMessage("The password change was unsuccessful!");
                                                                activeChar.sendPacket(new ExShowScreenMessage("The password change was unsuccessful!!#U_u)", 6000));
                                                }
                                        }
                                        else
                                        {
                                                activeChar.sendMessage("CurrentPass doesn't match with your current one.");
                                                return false;
                                        }
                                }
                                else
                                {
                                        activeChar.sendMessage("Invalid pass data! Format: .changepass CurrentPass NewPass NewPass");
                                        return false;
                                }
                        }
                        catch(Exception e)
                        {
                                activeChar.sendMessage("A problem occured while changing password!");
                        }
                }
                else
                {
                        activeChar.sendMessage("To change your current password, you have to type the command in the following format(without the brackets []): [.changepass CurrentPass NewPass NewPass]. You should also know that the password is case sensitive.");
                        activeChar.sendPacket(new ExShowScreenMessage("To change your current password, you have to type the command in the following format(without the brackets []):#[.changepass CurrentPass NewPass NewPass]. You should also know that the password is case sensitive.)", 7000));
                        return false;
                }
 
                return true;
        }
 
        @Override
        public String[] getVoicedCommandList()
        {
                return _voicedCommands;
        }
 
}

Then ill show BugReport Npc.

 

 

With this X player Can Report one bug and server admin gets at server files Server\gameserver\log\BugReports

One file with bug report and the message is 

Character Info: [Character: Abyssal - Account: Abyssal - IP: 999.999.999.999]
Bug Type: General
Message: BuG With Vote Manager Fix It

Go to Com.L2jfrozen.Gameserver.Model.Actor.Instance and create a class L2BugReportInstance

and copy paste this code

/*
 * 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 <http://www.gnu.org/licenses/>.
 */
package com.l2jfrozen.gameserver.model.actor.instance;

import java.io.*;
import java.util.StringTokenizer;

import javolution.text.TextBuilder;

import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.L2GameClient;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
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;

/**
 * @author squallcs
 *
 * @Reworked Abyssal
 */
public class L2BugReportInstance extends L2FolkInstance
{
	private static String _type;
	
	public L2BugReportInstance(int objectId, L2NpcTemplate template)
	{
		super(objectId, template);
	}
	
	@Override
	public void onBypassFeedback(L2PcInstance player, String command)
	{
		if (command.startsWith("send_report"))
		{
			StringTokenizer st = new StringTokenizer(command);
			st.nextToken();
			String msg = "";
			String type = null;
			type = st.nextToken();
			st.nextToken();
			try
			{
				while (st.hasMoreTokens())
				{
					msg = msg + " " + st.nextToken();
				}
				
				sendReport(player, type, msg);
			}
			catch (StringIndexOutOfBoundsException e)
			{
			}
		}
	}
	
	static
	{
		new File("log/BugReports/").mkdirs();
	}
	
	private void sendReport(L2PcInstance player, String command, String msg)
	{
		String type = command;
		L2GameClient info = player.getClient().getConnection().getClient();
		
		if (type.equals("General"))
			_type = "General";
		if (type.equals("Fatal"))
			_type = "Fatal";
		if (type.equals("Misuse"))
			_type = "Misuse";
		if (type.equals("Balance"))
			_type = "Balance";
		if (type.equals("Other"))
			_type = "Other";
		
		try
		{
			String fname = "log/BugReports/" + player.getName() + ".txt";
			File file = new File(fname);
			boolean exist = file.createNewFile();
			if (!exist)
			{
				player.sendMessage("You have already sent a bug report, GMs must check it first.");
				return;
			}
			FileWriter fstream = new FileWriter(fname);
			BufferedWriter out = new BufferedWriter(fstream);
			out.write("Character Info: " + info + "\r\nBug Type: " + _type + "\r\nMessage: " + msg);
			player.sendMessage("Report sent. GMs will check it soon. Thanks...");
			
			for (L2PcInstance allgms : L2World.getInstance().getAllGMs())
				allgms.sendPacket(new CreatureSay(0, Say2.SHOUT, "Bug Report Manager", player.getName() + " sent a bug report."));
			
			System.out.println("Character: " + player.getName() + " sent a bug report.");
			out.close();
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	@Override
	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>Bug Report Manager</title>");
		replyMSG.append("<body><br><br><center>");
		replyMSG.append("<table border=0 height=10 bgcolor=\"444444\" width=240>");
		replyMSG.append("<tr><td align=center><font color=\"00FFFF\">Hello " + activeChar.getName() + ".</font></td></tr>");
		replyMSG.append("<tr><td align=center><font color=\"00FFFF\">There are no Gms online</font></td></tr>");
		replyMSG.append("<tr><td align=center><font color=\"00FFFF\">and you want to report something?</font></td></tr>");
		replyMSG.append("</table><br>");
		replyMSG.append("<img src=\"L2UI.SquareWhite\" width=280 height=1><br><br>");
		replyMSG.append("<table width=250><tr>");
		replyMSG.append("<td><font color=\"LEVEL\">Select Report Type:</font></td>");
		replyMSG.append("<td><combobox width=105 var=type list=General;Fatal;Misuse;Balance;Other></td>");
		replyMSG.append("</tr></table><br><br>");
		replyMSG.append("<multiedit var=\"msg\" width=250 height=50><br>");
		replyMSG.append("<br><img src=\"L2UI.SquareWhite\" width=280 height=1><br><br><br><br><br><br><br>");
		replyMSG.append("<button value=\"Send Report\" action=\"bypass -h npc_" + getObjectId() + "_send_report $type $msg\" 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());
	}
	
}

Then ill show you reputation item,This give you x reputation points to your clan.

 

Go to

Com.L2jfrozen.Gameserver.Handler.ItemHandler.java

 

Find this

import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;

bellow add this

import com.l2jfrozen.gameserver.handler.itemhandlers.ClanRepsItem;

then find this 

registerItemHandler(new ChestKey());

bellow add this

registerItemHandler(new ClanRepsItem());

Then go Com.L2jfrozen.Gamserver.Handler.ItemHander and create new ClanRepsItem.java

 

 

add this

/*
 * 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.l2jfrozen.gameserver.handler.itemhandlers;

/**
 * 
 * 
 * @author Coyote
 * Adapted by Strike
 * Reworked by Abyssal
 */


import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IItemHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;

public class ClanRepsItem implements IItemHandler
{
    private static final int ITEM_IDS[] =
    {
       Config.CR_ITEM_REPS_ITEM_ID
    };

    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
            if (!(playable instanceof L2PcInstance))
            {
                return;
            }

            L2PcInstance activeChar = (L2PcInstance)playable;

            if (!activeChar.isClanLeader())
            {
                activeChar.sendMessage("This can be used only by Clan Leaders!");
                return;
            }
           
            else if (!(activeChar.getClan().getLevel() >= Config.CR_ITEM_MIN_CLAN_LVL))
            {
               activeChar.sendMessage("Your Clan Level is not big enough to use this item!");
               return;
            }
            else
            {
               activeChar.getClan().setReputationScore(activeChar.getClan().getReputationScore()+Config.CR_ITEM_REPS_TO_BE_AWARDED, true);
               activeChar.sendMessage("Your clan has earned "+ Config.CR_ITEM_REPS_TO_BE_AWARDED +" rep points!");
               MagicSkillUser  MSU = new MagicSkillUser(activeChar, activeChar, 2024, 1, 1, 0);
               activeChar.broadcastPacket(MSU);
              playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
            }
        }

    public int[] getItemIds()
    {
        return ITEM_IDS;
    }
}

then go Config.java

 

Find this

public static String PVP2_CUSTOM_MESSAGE;

and then add this 

         /**
	 * Clan Reputation Item
	 */
	public static boolean USE_CR_ITEM;
	public static int CR_ITEM_MIN_CLAN_LVL;
	public static int CR_ITEM_REPS_TO_BE_AWARDED;
	public static int CR_ITEM_REPS_ITEM_ID;

then find this

			PVP2_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");

and bellow add this

			/** Clan reputation Item**/
			USE_CR_ITEM = Boolean.parseBoolean(L2ScoriaSettings.getProperty("EnableTheClanRepPointsItem", "False"));
			CR_ITEM_MIN_CLAN_LVL = Integer.parseInt(L2ScoriaSettings.getProperty("ClanLevelNeededForCR", "5"));
			CR_ITEM_REPS_TO_BE_AWARDED = Integer.parseInt(L2ScoriaSettings.getProperty("HowManyClanRepsToGive", "500"));
			CR_ITEM_REPS_ITEM_ID = Integer.parseInt(L2ScoriaSettings.getProperty("CRItemID", "6673"));

and the last 

 

Go To L2JFrozen.Propeties

 

Find this

# -----------------------------------------------------
# Hero Custom Item Configuration -
# -----------------------------------------------------
# When ActiveChar will use this item will gain Hero Status.
EnableHeroCustomItem = False
# Id Itemn Need's 
HeroCustomItemId = 3481
# Hero for X days, 0 forever.
HeroCustomDay = 0

and after this add this

# -------------------------------------------------------
# Clan Reputation Custom Item Configuration
# -------------------------------------------------------
# Would you like to enable the Clan Reputation points item?
# Default: False
EnableTheClanRepPointsItem = False
# What's the Min Level in which clan leaders will be able to use the item?
# Default 5
MinClanLevelNeededForCR = 5
# How many rep points will be rewarded to the clan?
# Default 500
HowManyClanRepsToGive = 500
# Set the ID of the Clan Rep Points Item
# Default = 6673 (Festival Adena)
CRItemID = 6673

And The Last Code ChangeNameNpc..

 

Com.L2jFrozen.Gamserver.Model.Actor.Instance and create L2ChangeNameInstance

 

add this

/*
 * 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 <http://www.gnu.org/licenses/>.
 */

package com.l2jfrozen.gameserver.model.actor.instance;

import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jfrozen.gameserver.datatables.sql.CharNameTable;
import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.PartySmallWindowAll;
import com.l2jfrozen.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
import com.l2jfrozen.logs.Log;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;

import javolution.text.TextBuilder;

public class L2ChangeNameInstance extends L2FolkInstance
{
	
	private static final String changeNameConfigFile = "./config/changename.properties"; // Set the config file path.
	private static boolean paymentRequired;
	private static int changeNamePrice;
	private static int itemID;
	
	// Get configurations from file.
	
	public static void loadOptionsConfig()
	{
		final String OPTIONS = L2ChangeNameInstance.changeNameConfigFile;
		
		try
		{
			Properties optionsSettings = new Properties();
			InputStream is = new FileInputStream(new File(OPTIONS));
			optionsSettings.load(is);
			is.close();
			
			changeNamePrice = Integer.parseInt(optionsSettings.getProperty("ChangeNamePrice", "0"));
			itemID = Integer.parseInt(optionsSettings.getProperty("ItemID", "57"));
			paymentRequired = Boolean.valueOf(optionsSettings.getProperty("PaymentRequired", "false"));
		}
		catch (Exception e)
		{
			e.printStackTrace();
			throw new Error("Failed to Load " + OPTIONS + " File.");
		}
	}
	
	// Load config files.
	
	static
	{
		loadOptionsConfig();
	}
	
	// Obtain item name.
	
	public static String getItemName()
	{
		String _itemName = ItemTable.getInstance().getTemplate(itemID).getName();
		return _itemName;
	}
	
	// Audit change name.
	
	static
	{
		new File("log/CHARChangeName").mkdirs();
	}
	
	private static final Logger _log = Logger.getLogger(Log.class.getName());
	
	public static void auditChangeName(String oldCharName, String newCharName)
	{
		SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy H:mm:ss");
		String today = formatter.format(new Date());
		
		FileWriter save = null;
		
		try
		{
			File file = new File("log/CHARChangeName/log.txt");
			save = new FileWriter(file, true);
			String out = "[" + today + "] --> User: " + oldCharName + " changed his name to " + newCharName + " \r\n";
			
			save.write(out);
		}
		catch (IOException e)
		{
			_log.log(Level.SEVERE, "Change name of " + oldCharName + " could not be saved: ", e);
		}
		finally
		{
			if (save != null)
				try
				{
					save.close();
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
		}
	}
	
	// Create NPC.
	
	public L2ChangeNameInstance(int objectId, L2NpcTemplate template)
	{
		super(objectId, template);
	}
	
	// Changing name action.
	
	@Override
	public void onBypassFeedback(L2PcInstance player, String command)
	{
		if (command.startsWith("change_name"))
		{
			StringTokenizer st = new StringTokenizer(command);
			st.nextToken();
			String currName = null;
			String newName = null;
			String repeatNewName = null;
			try
			{
				if (st.hasMoreTokens())
				{
					currName = st.nextToken();
					newName = st.nextToken();
					repeatNewName = st.nextToken();
				}
				else
				{
					printErrorMessage("Please fill in all the blanks before requesting for a name change.", player);
					return;
				}
				changeName(currName, newName, repeatNewName, player);
			}
			catch (StringIndexOutOfBoundsException e)
			{
			}
		}
	}
	
	// Interaction with npc.
	
	@Override
	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());
	}
	
	// Main html frame.
	
	private void showHtmlWindow(L2PcInstance activeChar)
	{
		NpcHtmlMessage nhm = new NpcHtmlMessage(5);
		TextBuilder replyMSG = new TextBuilder("");
		
		replyMSG.append("<html><title>Name Manager</title>");
		replyMSG.append("<body><center>");
		replyMSG.append("To change your name:<br1> First fill in your current name and then your new!</font><br>");
		if (paymentRequired)
		{
			replyMSG.append("Item required: " + getItemName() + "and amount: " + changeNamePrice + " <br>");
		}
		replyMSG.append("Current Name: <edit var=\"cur\" width=100 height=15><br>");
		replyMSG.append("New Name: <edit var=\"new\" width=100 height=15><br>");
		replyMSG.append("Repeat New Name: <edit var=\"repeatnew\" width=100 height=15><br><br>");
		replyMSG.append("<button value=\"Change Name\" action=\"bypass -h npc_" + getObjectId() + "_change_name $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());
	}
	
	// Print html method.
	
	private static void printErrorMessage(String msg, L2PcInstance activeChar)
	{
		
		NpcHtmlMessage nhm = new NpcHtmlMessage(5);
		TextBuilder replyMSG = new TextBuilder("");
		
		replyMSG.append("<html><title>Name Manager</title>");
		replyMSG.append("<body><center><br>Ohh no! A problem ocurred!</center><br> " + msg + " </body></html>");
		nhm.setHtml(replyMSG.toString());
		activeChar.sendPacket(nhm);
		
	}
	
	public static boolean changeName(String currName, String newName, String repeatNewName, L2PcInstance activeChar)
	{
		
		// Check player name requirements
		
		if (newName.length() < 4)
		{
			printErrorMessage("The new name is too short! You should use 4 charcaters or more", activeChar);
			return false;
		}
		if (newName.length() > 16)
		{
			printErrorMessage("The new name is too long!", activeChar);
			return false;
		}
		if (!newName.equals(repeatNewName))
		{
			printErrorMessage("Repeated name doesn't match the new name.", activeChar);
			return false;
		}
		
		String name2 = null;
		
		// Check if player name already exists if not, continue.
		
		if (CharNameTable.getInstance().doesCharNameExist(newName))
		{
			activeChar.sendMessage(newName + " already in use!");
			return false;
		}
		
		// Check if player name verifies the original.
		
		if (!currName.equals(activeChar.getName()))
		{
			printErrorMessage("Your actual name doesn't verifies yours.", activeChar);
			return false;
		}
		
		// Check player required item.
		
		if (paymentRequired && (activeChar.getInventory().getItemByItemId(itemID) == null || activeChar.getInventory().getItemByItemId(itemID).getCount() < changeNamePrice))
		{
			printErrorMessage("You dont have enough " + getItemName(), activeChar);
			return false;
		}
		
		try
		{
			name2 = newName;
			
			L2PcInstance player = null;
			String oldName = null;
			
			player = activeChar;
			oldName = player.getName();
			
			L2World.getInstance().removeFromAllPlayers(player);
			player.setName(name2);
			player.store();
			L2World.getInstance().addToAllPlayers(player);
			printErrorMessage("Your name has been changed succesfully from " + oldName + " to " + name2, player);
			player.broadcastUserInfo();
			
			if (player.isInParty())
			{
				player.getParty().broadcastToPartyMembers(player, new PartySmallWindowDeleteAll());
				for (L2PcInstance member : player.getParty().getPartyMembers())
				{
					if (member != player)
					{
						member.sendPacket(new PartySmallWindowAll(player, player.getParty()));
					}
				}
			}
			if (player.getClan() != null)
			{
				player.getClan().broadcastClanStatus();
			}
			RegionBBSManager.getInstance().changeCommunityBoard();
			
			// Audit change name for security if a char did something bad and he changes his name to hide his malevolent steps...
			
			auditChangeName(oldName, name2);
			
			// Take required item from inventory.
			
			if (paymentRequired && (changeNamePrice > 0))
			{
				player.destroyItemByItemId("ChangeNameNPC", itemID, changeNamePrice, player.getLastFolkNPC(), true);
			}
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "Change name action couldn't be performed!", e);
		}
		
		return true;
	}
}

then create a file at gamserver/config/changename.propeties

 

and add this

# Change Name settings

# PaymentRequired = Set if you need to pay in order to change your name
# Default: false
PaymentRequired = True

# ChangeNamePrice = Set the amount of adena that you have to pay.
# Default = 0
ChangeNamePrice = 1000000

# ItemID = Set the item id as payment. For example 57 = Adena
# Default = 57

ItemID = 57

and the last add sql

INSERT INTO `custom_npc` VALUES ('9991', '29047', 'ChangeName', '1', '', '1', 'Monster3.follower_of_frintessa_tran', '10.00', '110.00', '85', 'male', 'L2ChangeName', '40', '1709400', '70000', '668.78', '300.00', '60', '57', '73', '76', '70', '80', '111550355', '9525390', '50000', '4500', '8082', '2000', '270', '0', '300', '8222', '0', '0', '160', '300', 'frintezza_clan', '5000', '0', '13', 'FULL_PARTY');

Dont ask credits some is mine some is from another but i find at my pc thrown

 

Soon more Thank you ..

Link to comment
Share on other sites

find this, add this, bellow this.. ohh my head... 

I can't read more...

 

But on first part with armor effect in +16 weapon.. you have test this? is it work?

 

The next time use "+" and "-".

Edited by 'Baggos'
Link to comment
Share on other sites

find this, add this, bellow this.. ohh my head...

I can't read more...

 

But on first part with armor effect in +16 weapon.. you have test this? is it work?

 

The next time use "+" and "-".

Yep, works! ^_^

www.maxcheaters.com/topic/187044-enchant-armor-effects/#entry2437673

Link to comment
Share on other sites

Yep, works! ^_^

www.maxcheaters.com/topic/187044-enchant-armor-effects/#entry2437673

Abyssal got all this and made share? :O

Effect on enchant is good idea for that i want to do. but i will set it differently.

Link to comment
Share on other sites

Abyssal got all this and made share? :o

Effect on enchant is good idea for that i want to do. but i will set it differently.

baggos but with armor echant wwe have one prob if you find answer tell me and i fix it

the prob is if you got +16 armor getEffectAbnormal but if ArmorRemove abnormal effect stay..

Link to comment
Share on other sites

baggos but with armor echant wwe have one prob if you find answer tell me and i fix it

the prob is if you got +16 armor getEffectAbnormal but if ArmorRemove abnormal effect stay..

obviously pass a check dude

 

on if(remove

Link to comment
Share on other sites

Because I've created it on my own pack (which starts from l2jserver's rev 1433) where it works perfectly. On the public packs there may be a difference, so you should use it according to their realization. :)

Link to comment
Share on other sites

Because I've created it on my own pack (which starts from l2jserver's rev 1433) where it works perfectly. On the public packs there may be a difference, so you should use it according to their realization. :)

EDIT:

 

Here is the check for remove the effect?

 

 

player.stopAbnormalEffect(L2Character.ABNORMAL_EFFECT_STEALTH);
Edited by 'Baggos'
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...