Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 08:09

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]Namechange Item

Discussion on [Release]Namechange Item within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
AfterLife-'s Avatar
 
elite*gold: 0
Join Date: Jan 2018
Posts: 44
Received Thanks: 69
[Release]Namechange Item

Add this to OpenNos.Handler.FamilyPacketHandler -> CreateFamily


Code:
else if (createFamilyPacket.CharacterName != null && Session.Character.Group == null && Session.Character.Inventory.Any(x => x.Item.VNum == 1638)) // Enter Item VNum
    if (createFamilyPacket.CharacterName.Length< 4 || createFamilyPacket.CharacterName.Length> 14)
    {
        Session.SendPacketFormat($"info {Language.Instance.GetMessageFromKey("INVALID_CHARNAME")}");
    }
    else
    {
        private Regex rg = new Regex(@"^[A-Za-z0-9_äÄöÖüÜß~*<>°+-.!_-Й¤£±†‡×ßø^\S]+$");
        if (rg.Matches(createFamilyPacket.CharacterName).Count == 1)
        {
            if (DAOFactory.CharacterDAO.LoadByName(createFamilyPacket.CharacterName) == null)
            {
                Session.Character.Name = createFamilyPacket.CharacterName;

                if (Session.Character.Miniland == Session.Character.MapInstance)
                {
                    ServerManager.Instance.JoinMiniland(Session, Session);
                }
                else
                {
                    ServerManager.Instance.ChangeMapInstance(Session.Character.CharacterId, Session.Character.MapInstanceId, Session.Character.PositionX, Session.Character.PositionY, true);
                    Session.SendPacket(StaticPacketHelper.Cancel(2));
                }

                Session.Character.Inventory.RemoveItemFromInventory(Session.Character.Inventory.LoadByVNum<ItemInstance>(1638).Id);
                Session.Character.Save();
            }
            else
            {
                Session.SendPacketFormat($"info {Language.Instance.GetMessageFromKey("ALREADY_TAKEN")}");
            }
        }
        else
        {
            Session.SendPacketFormat($"info {Language.Instance.GetMessageFromKey("INVALID_CHARNAME")}");
        }
    }
}
Then create a new Item-Case (i've used OpenNos.GameObject.SpecialItem)

Code:
//Namechange
case 1638:
    if (session.Character.Group != null && session.Character.Inventory.Any(x => x.Item.VNum == 1638)) // Enter VNum
    {
        session.SendPacket(UserInterfaceHelper.GenerateMsg("Leave your group to change your name", 0));
    }
    else
    {
        session.SendPacket(UserInterfaceHelper.GenerateInbox($"#glmk^ 14 1 Charactername Charactername"));
    }
    break;
AfterLife- is offline  
Thanks
5 Users
Old 06/18/2019, 21:12   #2

 
Blowa's Avatar
 
elite*gold: 148
Join Date: Jan 2010
Posts: 654
Received Thanks: 1,774
Thanks for your release anyway :

This should not be implemented inside the "CreateFamily" method, as its name tells, it's designed to handle family creation.
Create a designed method for the character name changements (which is already done through commands, just refactor both and merge the code properly, enjoy, you got a maintainable feature that you can plug to more things without having to again write the code somewhere else)

And stop using hardcoded values inside predicate lambdas, use configurations (struct/class configuration or App's settings through ConfigurationManager) or at least, const value with a real name so you get the compile time advantages and more maintainability...

Hope you get it right,
Blowa.
Blowa is offline  
Thanks
3 Users
Old 06/18/2019, 21:36   #3
 
AfterLife-'s Avatar
 
elite*gold: 0
Join Date: Jan 2018
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by val77 View Post
Thanks for your release anyway :

This should not be implemented inside the "CreateFamily" method, as its name tells, it's designed to handle family creation.
Create a designed method for the character name changements (which is already done through commands, just refactor both and merge the code properly, enjoy, you got a maintainable feature that you can plug to more things without having to again write the code somewhere else)

And stop using hardcoded values inside predicate lambdas, use configurations (struct/class configuration or App's settings through ConfigurationManager) or at least, const value with a real name so you get the compile time advantages and more maintainability...

Hope you get it right,
Blowa.

I totally agree that this implementation is poor structured and definitly not well done.
I was rather depressed about the fact that people try selling such poor implementations of this feature and decided to post it for good.

Will definitly look into re-doing some of my older releases "the right way" as soon as i get enough freetime to do so. Am currently not capable of spending more then 5-10 Minutes on such things.
AfterLife- is offline  
Thanks
3 Users
Old 06/19/2019, 19:49   #4
 
elite*gold: 0
Join Date: Jun 2019
Posts: 20
Received Thanks: 6
In my opinion the BasicPacketHandler could be a good spot to handle this.

But it is very usefull, thanks for sharing!
Prophecy_ is offline  
Old 06/19/2019, 23:38   #5
 
AfterLife-'s Avatar
 
elite*gold: 0
Join Date: Jan 2018
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by Prophecy_ View Post
In my opinion the BasicPacketHandler could be a good spot to handle this.

But it is very usefull, thanks for sharing!
First of all thank you for your comment.

This was done in a rush.
I've located it in the FamilyCreate Method because i wanted the InGame Pop-Up to be present. Could've used the Speaker packet as well thou. I don't know how to trigger a packet-response from the client similar to this with another packet then those two to be honest, so i've done my 5 minute job and put it in there.

Might be possible to trigger the In-Game Pop-up with another recieve packet that allows me to send an unused Packet back to the Server.
AfterLife- is offline  
Thanks
2 Users
Old 06/20/2019, 09:52   #6
 
elite*gold: 0
Join Date: Jan 2017
Posts: 36
Received Thanks: 16
Quote:
Originally Posted by AfterLife- View Post
Might be possible to trigger the In-Game Pop-up with another recieve packet that allows me to send an unused Packet back to the Server.
on SpecialItem.cs

Code:
                case 261:
                    if (!session.Character.IsVehicled && Option == 0)
                    {
                        session.SendPacket(UserInterfaceHelper.GenerateGuri(10, 5, session.Character.CharacterId, 1));
                    }
                    break;
BasicPacketHandler.cs

Code:
if (guriPacket.Argument == 5)
                    {
                     // Your code for change name
                    }
GGGGame is offline  
Thanks
1 User
Old 06/01/2020, 14:08   #7
 
elite*gold: 0
Join Date: Feb 2019
Posts: 13
Received Thanks: 0
Hi i have a small question can you contact me on discord ?
Kintsugi #3701
zazouzo is offline  
Reply


Similar Threads Similar Threads
FusionCMS Item Store Item Adden invalid item
07/27/2015 - Web Development - 4 Replies
Hallo ich habe ein kleines Problem. Ich habe mir eine Lizenz für FusionCMS v6 (World of Warcraft CMS) gekauft und installiert. Als ich alles richtig eingestellt habe wollte ich ein Item hinzufügen über das Admin Panel aber jedes mal zeigt er mir invalid item. Wäre super wenn ihr mir helfen könntet das Problem zu beseitigen. Mfg
[Release]Namechange Bypass
06/23/2014 - 4Story - 13 Replies
Hello there. since i checked some user . i saw one selling namechange fix. to be honest if it is as i think, isn't a fix. ok. so do not buy. i'm just releasing the same here. (looks like he is selling my old bypass too. stupid d..k, if don't. i don't care) There is the tables and the new TMAP service. TCreateChar (TGAME_GSP) /* CREATE CHARACTER PROCESS
[Suche] Komplette item.eix/epk, icon.eix/epk, item proto und item list
12/25/2010 - Metin2 Private Server - 6 Replies
Hey =) Wie die Überschrift schon sagt, suche ich eine komplette item.eix/epk, icon.eix/epk, item proto und item list am liebsten noch von den Waffen von .darki und den ganzen neuen Rüstungen/Schilden/Helmen, da ich überhaupt nicht weiß wie man dass zB mit der item proto macht und wenn ich sie einfach nur ersetze, wie zB durch die "Waffen" item proto von .darki sind die ganzen neuen Rüstungen weg .... Ich hoffe irgendjemand könnte das machen, weil es bestimmt nicht nur für mich hilfreich ist...
Namechange
02/24/2005 - General Gaming Discussion - 2 Replies
1. erstellt euch einen neuen Charakter mit einem nickname welcher gegen die Regeln (ToS) verstößt 2. paged einem CSR das er den namen abändern soll (muss er sowieso da es ja gegen die regeln verstößt z.B. beilidigende Namen zu tragen) wo liegt der sinn? die CSR's können euch in schon vorhandene nicknames umbenennen, stellt euch mal die scam-möglichkeiten vor ;) das ihr bei sowas n ban kassieren könnt muss ich euch nicht extra sagen, oder? ^^



All times are GMT +1. The time now is 08:09.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.