Jump to content

Question

Posted

hello guys i would like to know if there is a command like this //titlecolor that changes the color of a character's title so i can put it in my project thanks in advance

Recommended Posts

  • 1
Posted (edited)
58 minutes ago, SweeTs said:

No. It's basically one code line. Create the command on you own. 

Fact: I'm not a chef.

Example: Basically, all you can do is cook a dish. Create the recipe on your own.

 

I don't think he got any help rather than frustration.

 

Edited by protoftw
  • 1
Posted
25 minutes ago, protoftw said:

Fact: I'm not a chef.

Example: Basically, all you can do is cook a dish. Create the recipe on your own.

Fact: you have the recipe. 

Example: as you have the recipe you can cook, at least try. 

 

Title change color npc is shared, reuse the code. Admin command set name/title color exists, reuse the code.

Voiced, command handlers exists, reuse the code.

 

At least try, take a look, think, experiment. If you don't try, you never learn to cook.

 

Saying "i can't, I won't do it" won't change anything. 

  • 1
Posted

It's easy, you just have to think and reuse existing code.

 

Okay, then.. 

 

- open any command, can be Escape

- copy the code, create new file paste it

- remove the destroy, teleport, checks and/or whatever part you think is useless

- search for "settitle" command

- copy the code, mainly the line player.setTitleColor obviously, no need further explanations what's that and other broadcast lines, hello, if those lines are there, you need them as well

- I see errors on parse something, well, replace it with static code

- but how? Search for gm color config, see how is builded the line and do the same

- register the handler, usercommandhandler

- enjoy

 

Got errors? Post em here, show that you are trying and you are willing to learn. Otherwise don't bother opening a server, even a local one. Sad but true. 

 

----

 

You said you tried, show me the code. 

  • Like 1
  • 1
Posted (edited)
24 minutes ago, l2bartdev said:

so i just have to create for ex custom_colors table? and then what inside? :P

 

I made you a quick code, is up to you how to use it e.t.c

 

package com.l2evie.gameserver;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.l2evie.L2DatabaseFactory;
import com.l2evie.gameserver.model.actor.instance.L2PcInstance;

/**
 * @author Evie Frye
 */
public class Color
{
	private static Color _instance = null;
	
	public static Color getInstance()
	{
		if (_instance == null)
		{
			_instance = new Color();
		}
		return _instance;
	}
	
	/**
	 * @param objectId
	 * @return
	 */
	public void setColor(final L2PcInstance activeChar)
	{
		Integer[] holder = null;
		
		try(Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			ResultSet result = con.prepareStatement("SELECT hexName, hexTitle FROM character_color_table WHERE objectId = " + activeChar.getObjectId()).executeQuery();
			
			if (result.next())
			{
				holder = new Integer[]{(Integer.parseInt(result.getString("hexName"))), Integer.parseInt(result.getString("hexTitle"))};
			}
		}
		catch(SQLException e)
		{
			return;
		}
		
		if (holder !=null)
		{
			activeChar.getAppearance().setNameColor(holder[0]);
			activeChar.getAppearance().setTitleColor(holder[1]);
			activeChar.broadcastUserInfo();
		}
	}
	
	/**
	 * 
	 * @param objectId
	 */
	public void storeColor(final L2PcInstance activeChar)
	{
		try(Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("INSERT INTO character_color(objectId, hexName, hexTitle) values(?,?,?) ON DUPLICATE KEY UPDATE hexColor=?");
			statement.setInt(1, activeChar.getObjectId());
			statement.setInt(2, activeChar.getAppearance().getNameColor());
			statement.setInt(3, activeChar.getAppearance().getNameColor());
			statement.execute();
		}
		catch(SQLException e)
		{
			
		}
	}
}

 

And the SQL:

 

/*
MySQL Data Transfer
Source Host: localhost
Source Database: l2jgs
Target Host: localhost
Target Database: l2jgs
Date: 4/3/2018 9:18:52 PM
*/

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for character_color
-- ----------------------------
DROP TABLE IF EXISTS `character_color`;
CREATE TABLE `character_color` (
  `objectId` int(10) NOT NULL,
  `hexName` text NOT NULL,
  `hexTitle` text NOT NULL,
  PRIMARY KEY (`objectId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

Consider those should load once upon server start and server shutdown to avoid connection everytime a player login and logout but nowadays with so fast queries and store procedures nobody cares.

 

To use the code just go on EnterWorld and write

 

Color.getInstance().setColor(activeChar);

and to store go in L2PcInstance, find cleanMe method and somewhere inside write:

 

Color.getInstance().storeColor(this);

 

Edited by Evie Frye
  • 1
Posted
5 minutes ago, l2bartdev said:

very kind of you brother thanks a bunch i already did the code i can do the command //titlecolor but when i rr it gets in the normal colors so i can just put the sql and it should work?thanks again. :D

 

Yeap and if it works come back and give me 1.000 euro, took me 2 minutes.

  • 1
Posted
59 minutes ago, Evie Frye said:

 

I made you a quick code, is up to you how to use it e.t.c

 


package com.l2evie.gameserver;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.l2evie.L2DatabaseFactory;
import com.l2evie.gameserver.model.actor.instance.L2PcInstance;

/**
 * @author Evie Frye
 */
public class Color
{
	private static Color _instance = null;
	
	public static Color getInstance()
	{
		if (_instance == null)
		{
			_instance = new Color();
		}
		return _instance;
	}
	
	/**
	 * @param objectId
	 * @return
	 */
	public void setColor(final L2PcInstance activeChar)
	{
		Integer[] holder = null;
		
		try(Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			ResultSet result = con.prepareStatement("SELECT hexName, hexTitle FROM character_color_table WHERE objectId = " + activeChar.getObjectId()).executeQuery();
			
			if (result.next())
			{
				holder = new Integer[]{(Integer.parseInt(result.getString("hexName"))), Integer.parseInt(result.getString("hexTitle"))};
			}
		}
		catch(SQLException e)
		{
			return;
		}
		
		if (holder !=null)
		{
			activeChar.getAppearance().setNameColor(holder[0]);
			activeChar.getAppearance().setTitleColor(holder[1]);
			activeChar.broadcastUserInfo();
		}
	}
	
	/**
	 * 
	 * @param objectId
	 */
	public void storeColor(final L2PcInstance activeChar)
	{
		try(Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("INSERT INTO character_color(objectId, hexName, hexTitle) values(?,?,?) ON DUPLICATE KEY UPDATE hexColor=?");
			statement.setInt(1, activeChar.getObjectId());
			statement.setInt(2, activeChar.getAppearance().getNameColor());
			statement.setInt(3, activeChar.getAppearance().getNameColor());
			statement.execute();
		}
		catch(SQLException e)
		{
			
		}
	}
}

 

And the SQL:

 


/*
MySQL Data Transfer
Source Host: localhost
Source Database: l2jgs
Target Host: localhost
Target Database: l2jgs
Date: 4/3/2018 9:18:52 PM
*/

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for character_color
-- ----------------------------
DROP TABLE IF EXISTS `character_color`;
CREATE TABLE `character_color` (
  `objectId` int(10) NOT NULL,
  `hexName` text NOT NULL,
  `hexTitle` text NOT NULL,
  PRIMARY KEY (`objectId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

Consider those should load once upon server start and server shutdown to avoid connection everytime a player login and logout but nowadays with so fast queries and store procedures nobody cares.

 

To use the code just go on EnterWorld and write

 


Color.getInstance().setColor(activeChar);

and to store go in L2PcInstance, find cleanMe method and somewhere inside write:

 


Color.getInstance().storeColor(this);

 

 

best!

  • 1
Posted
5 minutes ago, Evie Frye said:

 

And to be honest i'm done with this forum anyway so that was my last post.

 

We will really miss you!

My heart is already beating more and more every time I read your reply..

 

RIP my net friend.. :D

  • 1
Posted
2 hours ago, Evie Frye said:

judge someone's code who wrote it in 1-2 minute while playing DotA.

Excuses as always, poor code as always :(

Code properly, or don't code at all. Kisses my dear not :D

  • 0
Posted

how to do this? ;D i am not this experienced with these i know how to add a code but that is a childs game for others now creating a code line gets a bit hard ;D but thanks in advance brother 

  • 0
Posted

I'm not saying that he can't try . You are stating facts that are known to you. Without further due there is no reason to argue. It's pointless and non helpful for him.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Dear partners! At the moment we are in great need of the following positions: — Snapchat old and new accounts | With snapscores | Geo: Europe/USA | Full access via email/phone number — Reddit old (brute or hacked origin, self-registered) accounts with post and comment karma from 100 to 100,000+ | Full email access included — LinkedIn old accounts with real connections | Geo: Europe/USA | Full email access + active 2FA password — Instagram old accounts (2010–2023) | Full email access (possibly with active 2FA password) — Facebook old accounts (2010–2023) | Full email access (possibly with active 2FA password) | With friends or without friends | Geo: Europe/USA/Asia — Threads accounts | Full email access (possibly with active 2FA password) — TikTok/Facebook/Google ADS Agency advertising accounts — Email accounts: mail.ru, yahoo.com, gazeta.pl, gmx.ch / gmx.de / gmx.net (BUT NOT gmx.com) — Google ADS Manual Farm accounts (verified via email and phone number) | GEO: USA/Europe, mostly USA. — WhatsApp OLD Accounts — Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! We are also ready to consider other partnership and collaboration options. Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment we are in great need of the following positions: — Snapchat old and new accounts | With snapscores | Geo: Europe/USA | Full access via email/phone number — Reddit old (brute or hacked origin, self-registered) accounts with post and comment karma from 100 to 100,000+ | Full email access included — LinkedIn old accounts with real connections | Geo: Europe/USA | Full email access + active 2FA password — Instagram old accounts (2010–2023) | Full email access (possibly with active 2FA password) — Facebook old accounts (2010–2023) | Full email access (possibly with active 2FA password) | With friends or without friends | Geo: Europe/USA/Asia — Threads accounts | Full email access (possibly with active 2FA password) — TikTok/Facebook/Google ADS Agency advertising accounts — Email accounts: mail.ru, yahoo.com, gazeta.pl, gmx.ch / gmx.de / gmx.net (BUT NOT gmx.com) — Google ADS Manual Farm accounts (verified via email and phone number) | GEO: USA/Europe, mostly USA. — WhatsApp OLD Accounts — Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! We are also ready to consider other partnership and collaboration options. Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • 冬天是享受优惠、省钱的好时机。 首次下单时使用促销码 SOCNET 即可获得 15% 折扣 ,适用于全场商品! 前往商店(网站) 前往商店(Telegram 机器人)
    • Winter is the time to save with benefits. Activate the promo code SOCNET on your first order and get a 15% discount on the entire assortment! Go to the store (website) Go to the store (Telegram bot)
    • Winter is the time to save with benefits. Activate the promo code SOCNET on your first order and get a 15% discount on the entire assortment! Go to the store (website) Go to the store (Telegram bot)
  • Topics

×
×
  • 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