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

    • Provide proofs not providing any kind of proofs i will just issue warnings
    • For the odbc you have to run the Instalador.exe and click crear dsn, but you have to rename them so the lin2clancomm.dsn for example becomes l2c4_lin2clancomm but also check if the file inside has as database value the correct file name, about the client i also wanted a clean client because i had a problem with the monsters because the character didn't have collision with the monsters and he was running through them but i fixed it with files from a normal interlude client, also my client is now c3 😛 i changed the maps, staticmeshes, systextures so now i do not have the fortresses at antharas lair for example but i also have the c3 sounds and login screen. Where is @GX-Ext
    • I really wonder if they launched the server without testing it even once. All players are creating new characters and transferring the level 20 reward to their main ones. It seems banning people is much easier than sending them a direct message in-game. If you can’t do your job properly, get in touch with people who can help you. I made 17 million in 10 minutes on a 1x Adena rate server and got an Icarus weapon. My suggestion to you — as it's written on the character you banned — is to wipe the server and run a proper OBT. Good luck with your time as administrators; although it doesn't look like it will last very long.  
    • all the reports vanished into thin air  
    • 🔥L2 INTERPRIDE - Pride Style  OPENING THIS NOVEMBER! 🔥  ✅ Grand Opening - November 15th! ✅ ❤️ Open Beta - October 08th! ❤️  🩵  The most up-to date client on the market! ▶️  Retail Pride Style Interlude with the new Client! 💡Discord: https://discord.gg/l2interpride 🌍 General Information Client: Interlude Type: Custom PvP Server Rates: High Rates Starting Level: 56 Balanced PvP Environment Unique PvP Enchant System PvP Synergy System: Support Classes earn PvP Score when assisting DDs in kills Toggle Skills → Now Passive Killing Spree: Every 25 kills grants Hero Aura + Hero Skills until death 🐉 Raid Boss System If you are within 1500 radius when a Raid Boss dies, you automatically receive 1 Raid Boss Chest in your inventory! 💫 Join the Battle ⚔️ Experience modern PvP gameplay on a classic Interlude foundation! 🔥 Build your power. Earn glory. Dominate Aden. 🧙 Custom Items Armors: 🛡️ Tier 1: Dread ⚔️ Tier 2: Titanium 👑 Tier 3: Pride Weapons: 🔱 Tier 1: Unique (PvP / PvE) ⚔️ Tier 2: Pride 💀 Tier 3: Abyssal Accessories: Up to 30 custom accessories with unique stats Legendary Dyes: +5 / -2 Belts: Various special stats ⚔️ Custom PvP Skills PvPs Name Color Reward Skill 500 Blue Firework CP Heal +800 1000 Violet Firework Cleanse 1500 Green Blessed Body 2000 Yellow MP Recharge 2500 Light Blue Special Focus 3000 Orange Death Whisper Debuff 3500 Dark Purple Might 4000 Red Empower 4500 Red Increase Weight Debuff 5000 Red Wind Walk 6000 Red Berserker Spirit 7000 Red Recall NPC 🛒 Shops & NPCs Item Store: Up to A/S grade, Potions, Consumables & more Mysterious Merchant: Custom Armors, Weapons, Accessories NPC Buffer: All Buffs + Scheme System Class Master: Free Class Change 🔥 Enchant System Safe Enchant: +7 Max Enchant: +25 Weapon Rate: Custom (higher enchant = lower rate) Armor Rate: Custom (higher enchant = lower rate) Jewel Rate: Custom (higher enchant = lower rate) ⚙️ Rates Experience: x5000 Skill Points: x5000 Drop Rate: x1 Adena: x500 🏆 Events Team vs Team (TvT) Capture the Flag (CTF) Death Match Castle Siege Hunting Grounds URF TvT 💎 Custom Features ALT + Left Click → Remove selected Buff ALT + F → Teleport System Shift + Left Click → View Monster Droplist
  • 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