Jump to content
  • 0

Change gracia to interlude code


extr3me

Question

/*
* 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Logger;

import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;

/**
* <B><U>User Character .repair voicecommand - SL2 L2JEmu</U></B><BR><BR>
*
* 
* <U>NOTICE:</U> Voice command .repair that when used, allows player to
* try to repair any of characters on his account, by setting spawn
* to Floran, removing all shortcuts and moving everything equipped to
* that char warehouse.<BR><BR>
*
*
* (solving client crashes on character entering world)<BR><BR>
*
*
* @author szponiasty
* @version $Revision: 0.17.2.95.2.9 $ $Date: 2010/03/03 9:07:11 $
*/

public class Repair implements IVoicedCommandHandler
{
static final Logger _log = Logger.getLogger(Repair.class.getName());

private static final String[]	 _voicedCommands	=
	{ 
	"repair", 
	"startrepair"
	};

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{		
	if (activeChar==null)
		return false;

	String repairChar=null;

	try		
	{
		if(target != null)
			if(target.length() > 1)
			  {
			   String[] cmdParams = target.split(" ");
			   repairChar=cmdParams[0];
			  }
	}
	catch (Exception e)
	{
		repairChar = null;
	}		

	// Send activeChar HTML page
	if (command.startsWith("repair"))
	{
		String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair.htm");
		NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5);
		npcHtmlMessage.setHtml(htmContent);		
		npcHtmlMessage.replace("%acc_chars%", getCharList(activeChar));
		activeChar.sendPacket(npcHtmlMessage);	
		return true;
	}
	// Command for enter repairFunction from html
	if (command.startsWith("startrepair") && (repairChar != null))
	{
		//_log.warning("Repair Attempt: Character " + repairChar);
			if (checkAcc(activeChar,repairChar))
			{
				if (checkChar(activeChar,repairChar))
				{
					String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-self.htm");
					NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5);
					npcHtmlMessage.setHtml(htmContent);
					activeChar.sendPacket(npcHtmlMessage);
					return false;
				}
				else if (checkJail(activeChar,repairChar))
				{
					String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-jail.htm");
					NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5);
					npcHtmlMessage.setHtml(htmContent);
					activeChar.sendPacket(npcHtmlMessage);	
					return false;
				}
				else
				{
					repairBadCharacter(repairChar);
					String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-done.htm");
					NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5);
					npcHtmlMessage.setHtml(htmContent);
					activeChar.sendPacket(npcHtmlMessage);
					return true;
				}
			}
			else
			{
				String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-error.htm");
				NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5);
				npcHtmlMessage.setHtml(htmContent);
				activeChar.sendPacket(npcHtmlMessage);
				return false;
			}
	}
	//_log.warning("Repair Attempt: Failed. ");
	return false;
}

private String getCharList(L2PcInstance activeChar)
{
	String result="";
	String repCharAcc=activeChar.getAccountName();
	Connection con = null;
	try
	{
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("SELECT char_name FROM characters WHERE account_name=?");
		statement.setString(1, repCharAcc);
		ResultSet rset = statement.executeQuery();
		while (rset.next())
		{
			if (activeChar.getName().compareTo(rset.getString(1)) != 0)
				result += rset.getString(1)+";";
		}
		//_log.warning("Repair Attempt: Output Result for searching characters on account:"+result);
		rset.close();
		statement.close();
	}
	catch (SQLException e)
	{
		e.printStackTrace();
		return result;
	}
	finally
	{
		try
		{
			if (con != null)
				con.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
	return result;	
}

private boolean checkAcc(L2PcInstance activeChar,String repairChar)
{
	boolean result=false;
	String repCharAcc="";
	Connection con = null;
	try
	{
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?");
		statement.setString(1, repairChar);
		ResultSet rset = statement.executeQuery();
		if (rset.next())
		{
			repCharAcc = rset.getString(1);
		}
		rset.close();
		statement.close();

	}
	catch (SQLException e)
	{
		e.printStackTrace();
		return result;
	}
	finally
	{
		try
		{
			if (con != null)
				con.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
	if (activeChar.getAccountName().compareTo(repCharAcc)==0)
		result=true;
	return result;
}

private boolean checkJail(L2PcInstance activeChar,String repairChar)
{
	boolean result=false;
	int repCharJail = 0;
	Connection con = null;
	try
	{
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("SELECT punish_level FROM characters WHERE char_name=?");
		statement.setString(1, repairChar);
		ResultSet rset = statement.executeQuery();
		if (rset.next())
		{
			repCharJail = rset.getInt(1);
		}
		rset.close();
		statement.close();

	}
	catch (SQLException e)
	{
		e.printStackTrace();
		return result;
	}
	finally
	{
		try
		{
			if (con != null)
				con.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
	if (repCharJail > 1) // 0 norm, 1 chat ban, 2 jail, 3....
		result=true;
	return result;
}

private boolean checkChar(L2PcInstance activeChar,String repairChar)
{
	boolean result=false;
	if (activeChar.getName().compareTo(repairChar)==0)
		result=true;
	return result;
}

private void repairBadCharacter(String charName)
{
	Connection con = null;
	try
	{
		con = L2DatabaseFactory.getInstance().getConnection();

		PreparedStatement statement;
		statement = con.prepareStatement("SELECT charId FROM characters WHERE char_name=?");
		statement.setString(1, charName);
		ResultSet rset = statement.executeQuery();

		int objId = 0;
		if (rset.next())
		{
			objId = rset.getInt(1);
		}
		rset.close();
		statement.close();
		if (objId == 0)
		{
			con.close();
			return;
		}
		statement = con.prepareStatement("UPDATE characters SET x=17867, y=170259, z=-3503 WHERE charId=?");
		statement.setInt(1, objId);
		statement.execute();
		statement.close();
		statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
		statement.setInt(1, objId);
		statement.execute();
		statement.close();
		statement = con.prepareStatement("UPDATE items SET loc=\"WAREHOUSE\" WHERE owner_id=? AND loc=\"PAPERDOLL\"");
		statement.setInt(1, objId);
		statement.execute();
		statement.close();
	}
	catch (Exception e)
	{
		_log.warning("GameServer: could not repair character:" + e);
	}
	finally
	{
		try
		{
			if (con != null)
				con.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
}

public String[] getVoicedCommandList()
{
	return _voicedCommands;
}
}

 

I Change Import For Interlude but i have error with this

activeChar.getHtmlPrefix()

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

not sure but try to change this

 

String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair.htm");

 

to this

 

		String htmFile = "data/html/info.htm";
	String htmContent = HtmCache.getInstance().getHtm(htmFile);

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • +256754809279 UK/USA INSTANT REVENGE DEATH SPELLS CASTER IN CANADA, SINGAPORE, MALAYSIA, ISRAEL. +256754809279 drmama Tango, Powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece. Death spell on someone, death spells that Death Revenge Spell on wicked friends, Voodoo Death Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic death spells on ex-lover, Revenge instant death spells on toxic uncles powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, revenge spells, most powerful death spell, spell to die in your sleep, successful death spell, most powerful voodoo spell caster, voodoo spell casters in new Orleans, voodoo love spells reviews, proven authentic voodoo spell casters, most powerful voodoo priest in world, black magic tricks to destroy enemy. Results are 100% sure and guaranteed , Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. spells, guaranteed voodoo spells, spell to make someone sick and die, revenge spells that work instantly, real witches for hire, revenge spells on an ex- lover, how to put a spell on someone who hurts you, spell to make someone sick, voodoo spells to hurt someone, spells to curse someone, powerful revenge spells, most powerful death spell, spell to die in your sleep, successful death spell. +256754809279 drmama Tango Email: drmamatango@gmail.com
    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don't waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME  Don't wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don't think legitimate. Your lover has gone with someone else Don't hesitate to break them up as this ritual and prayer is very powerful and will give very good results in a few weeks only. STOP A DIVORCE NOW  Order this service now to reinforce the bonds of your relationship and save your marriage. This service will make him/her realize that a divorce would be a mistake and will strengthen love and passion. With permanent results, this service will guarantee a long lasting marriage and will make you happy. FAITHFULNESS  Your partner cheats on you? This love ritual is definitely the one you need!  LOVE CHARMS   
    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don't waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME  Don't wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don't think legitimate. Your lover has gone with someone else Don't hesitate to break them up as this ritual and prayer is very powerful and will give very good results in a few weeks only. STOP A DIVORCE NOW  Order this service now to reinforce the bonds of your relationship and save your marriage. This service will make him/her realize that a divorce would be a mistake and will strengthen love and passion. With permanent results, this service will guarantee a long lasting marriage and will make you happy. FAITHFULNESS  Your partner cheats on you? This love ritual is definitely the one you need!  LOVE CHARMS   
    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don't waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME  Don't wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don't think legitimate. Your lover has gone with someone else Don't hesitate to break them up as this ritual and prayer is very powerful and will give very good results in a few weeks only. STOP A DIVORCE NOW  Order this service now to reinforce the bonds of your relationship and save your marriage. This service will make him/her realize that a divorce would be a mistake and will strengthen love and passion. With permanent results, this service will guarantee a long lasting marriage and will make you happy. FAITHFULNESS  Your partner cheats on you? This love ritual is definitely the one you need!  LOVE CHARMS   
    • Hey Dexters! Today April 19 we start Event for Olympiad games on Open Beta server You have a unique opportunity to get 🎁 FREE TODs before the server start. All players will be in same conditions, its a Beta server, and you can get any gear you need and make any build for your class. Only your personal skills will help you win the Event.  But even if you are not chasing a prize, this is a unique opportunity to test and improve your skills at the Grand Olympiad! Don't miss this opportunity! ➡️ Start Olympiad games in 19:00 (UTC +3) April 19 ➡️ Fights will be till 23:40, then we get Heroes (after 00:00) ➡️ All who get Hero status, will receive 500 ToDs. Best 5 Hero, who will get the most PTS, will get 800 ToDs instead of 500. Tods will be added on your master account balance after event end ➡️ No class vs class fights ➡️ Enchant Level Restrictions: S gr +6, A gr + 7, C/B gr + 16, On Olympiad, all items that higher than restriction level will be removed, and you won't be able to use them or wear them ➡️ We remind - on Beta we have restrictions for skill enchant lvl: 20 max for 2nd profession, 10 for 3rd profession ➡️ ❗ Talent Tree not availble on Beta! It will be open with Hellbound after server start in 1 month Good luck to Everyone!
  • Topics

×
×
  • Create New...