Jump to content
  • 0

Color manager


Question

Posted

Hello guys. I downloaded from this site color manager npc and added to the server.

 

After characters restart don't stay name color. Just title color work perfect.

 

E.x. : You buy color: 00000, and when you do relogin after relogin your color: FF0000(white).

 

 

import sys
from com.l2jfrozen.gameserver.datatables.sql import CharNameTable
from com.l2jfrozen.gameserver.model import L2World
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.util import Util;

from java.util.regex import Pattern;

NPC = 45555
ITEM_ID = 20003
NAME_COUNT = 200
COLOR_COUNT = 200

class Quest (JQuest) :
    def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

    def onEvent(self,event,st) :
        if event == "1":
            return "1.htm"

        if event == "2":
            return "2.htm"

        if event == "3":
            return "3.htm"

        if event == "200":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x000000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "201":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x000090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need! </center></body></html>"

        if event == "202":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x0000ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "203":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x009000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "204":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x00ff00)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "205":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x900000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "206":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0xff0000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "207":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x009090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "208":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x0090ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

        if event == "209":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x00ffff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "210":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x900090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "211":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x9000ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "212":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0xff00ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "213":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0x909000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "214":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0xffff00)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "215":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setNameColor(0xffffff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "300":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x000000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "301":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x000090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "302":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x0000ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "303":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x009000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "304":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x00ff00)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "305":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x900000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "306":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0xff0000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "307":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x009090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "308":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x0090ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "309":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x00ffff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "310":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x900090)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "311":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x9000ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "312":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0xff00ff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "313":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0x909000)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "314":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0xffff00)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if event == "315":
            if st.getQuestItemsCount(ITEM_ID) >= COLOR_COUNT:
                st.takeItems(ITEM_ID,COLOR_COUNT)
                st.getPlayer().getAppearance().setTitleColor(0xffffff)
                st.getPlayer().broadcastUserInfo();
                return "4.htm"
            else:
                return u"<html><head><body><center>Check if you have all items you need\u0435\u0442\u0430!</center></body></html>"

        if not CharNameTable.getInstance().doesCharNameExist(event):
            if len(event) >= 3 and len(event) <= 16 and Pattern.matches("[A-Za-z0-9\`\~\!\@\#\$\%\^\*\(\)\_\-\=\[\]\'\.\,\:\;]*", event):
                if st.getPlayer().isClanLeader():
                    return u"<html><head><body><center>You are clan leader. Can't change the name!</center></body></html>"
                if st.getPlayer().getClan():
                    return u"<html><head><body><center>You are clan member, can't change the name!</center></body></html>"					
                if st.getQuestItemsCount(ITEM_ID) >= NAME_COUNT:
                    st.takeItems(ITEM_ID,NAME_COUNT)
                    L2World.getInstance().removeFromAllPlayers(st.getPlayer());
                    st.getPlayer().setName(event);
                    st.getPlayer().store();
                    L2World.getInstance().addToAllPlayers(st.getPlayer());
                    st.getPlayer().broadcastUserInfo();
                    return "4.htm"
                else:
                    return u"<html><head><body><center>You don't have the necesary items!</center></body></html>"
            else:
                return u"<html><head><body><center>Try again!</center></body></html>"
        else:
            return u"<html><head><body><center>Try again!</center></body></html>"
        return u"<html><head><body><center>Check if you have all items you need!</center></body></html>"

    def onTalk (self,npc,player):
        return "0.htm"

QUEST = Quest(8833, "8833_Name", "custom")
CREATED = State('Start',QUEST)

QUEST.setInitialState(CREATED)

QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)

 

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

You have to add 1 more field in characters table that is responsible for the color (varchar) .

When you are setting the new color use a dB connection to save that in the new field. Finally, handle onEnter to load the custom color and you are done. 

 

 

Drop that shit and make one from Java. If you don't know how to, noone will help you with python codes here

Edited by melron
  • 0
Posted
1 minute ago, melron said:

You have to add 1 more field on characters table that is responsible for the color (varchar) .

When you are setting the new color use a dB connection to save that in the new field. Finally, handle onEnter to load the custom color and you are done. 

 

 

Drop that shit and make one from Java. If you don't know how to, noone will help you with python codes here

 

I know this.  I must to add something in java but idk what code... l2jfrozen. characters.sql have name_color

  • 0
Posted
34 minutes ago, l2fire said:

 

I know this.  I must to add something in java but idk what code... l2jfrozen. characters.sql have name_color

What a retard script. What a retard way to get color change. You can set the color automatic in html 

bypass -h npc_%ObjectId%_255 255 255

And write 3 lines of code in java using a StringTokenizer to get thos 3 values. 

You guys are in 2018 have 200000000 tutorials and still open request topics for such a thing for f sake.

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
Answer this question...

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



  • Posts

    • Lineage 2 Interlude L2OFF Server Based on H5 Files   Are you looking to start your own Lineage 2 server? This is your chance! I’m selling a 100% functional server based on Official L2OFF H5 files, adapted to the Interlude version. Main Features: Based on official L2OFF H5 files, perfectly configured for Interlude. Includes the full source code, allowing you to fully customize the server to fit your needs. Fully working events, such as: TvT (Team vs. Team) CTF (Capture the Flag) Tons of custom content added, keeping the balance and original essence of the game. Why choose this project? The server is fully functional and optimized, ready to launch. You can test the server before purchasing, with access to a GM character to explore all features. Comes with everything you need to make your project a success, both technically and in terms of content. Interested? Feel free to contact me! If you need more information or would like to schedule a test, I’m happy to answer any questions.   Auto Create Accounts Client Test Server: DOWNLOAD Discord: Guytis#6760 Skype: gustavoorellano@hotmail.com  
    • Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum   Hello Everyone,  finally, the moment has arrived: I'm launching my own server, L2Aurum!   L2Aurum x300 Closed Beta Test - Start: 17.02.2025  [20:00 GMT+2] Grand Opening 21.02.2025 [20:00 GMT+2]     Experience Rates: x300 Skill Points Rates: x300 Adena Drop: x300 Premium Accounts: x2 Drop Rates: x1 Spoil Rates: x1 Quest Rates: x1 Only one account per player, no dualboxing allowed. Everything is earned through gameplay, no pay-to-win mechanics. No server wipes—your progress is permanent. Fair play is a priority, with no room for corruption. All players are treated equally, no special favors.     Buffs slots: 26+4, all buffs in NPC and Scheme System. Custom Armors: Aurum Apella Armor Custom Weapons: Aurum Weapon Custom Accessories: +300 P.Def & M.Def Tattoos: Mage & Fighter & Custom Shirts Custom Jewels: New Grand Bosses Auto Farm is FREE for everyone. Status Noblesse: Barakiel. Player Spawn Protection: 10 seconds. Geodata e Panthodes: ENABLED. All Commands are visible in .menu. System 2 Bishop Per Party: ENABLED. Boss Protect - Anti-Zerg: ENABLED.     Siege Duration: 2 hours (120 minutes). Siege Period: Every 7 days. Castle Reward: 100E Per Castle. Available Castles: Rune Aden Giran Giran Siege: Every Friday 20:00 GMT +2. Aden Siege: Every Saturday 20:00 GMT +2. Rune Siege: Every Sunday 20:00 GMT +2. Main Clan: 40 Members max. Royal Clan: 12 Members max. Knight Clan: 7 Members max. Alliance: You can have only 1.     Epic Boss Valakas: Monday 22:30 (GMT+2) Zaken: Tuesday | Thursday 22:30 (GMT+2) Queen Ant: Monday | Wednesday 22:30 (GMT+2) Baium: Friday 22:30 (GMT+2) Antharas: Saturday 22:30 (GMT+2) Orfen: Tuesday | Thursday | Saturday 18:30 (GMT+2) Core: Monday | Wednesday | Friday | Sunday 18:30 (GMT+2)   Raid Boss  Flame Of Splendor Barakiel Last Hit: Every Day Respawn 3-4 hours Ember: Every Day Respawn 3-4 hours Lilith: Every Day Respawn 3-4 hours Anakim: Every Day Respawn 3-4 hours Queen Shyeed: Every Day Respawn 3-4 hours Golkonda: Every Day Respawn 3-4 hours Shuriel: Every Day Respawn 3-4 hours Varka's Hero Shadith: Every Day Respawn 3-4 hours Ketra's Hero Hekaton: Every Day Respawn 3-4 hours Varka's Mos: Every Day Respawn 3-4 hours Chief Horus: Every Day Respawn 3-4 hours Ketra's Tayer: Every Day Respawn 3-4 hours Chief Brakki: Every Day Respawn 3-4 hours Sailren: Every Day Respawn 02:00   🥳🥳🥳🥳 I would like to chat personally with all of you over on our Discord and discuss any suggestions or feedback you might have.      Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...