Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 14:22

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

Advertisement



[Release] SpecialChat for Opennos

Discussion on [Release] SpecialChat for Opennos within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2018
Posts: 14
Received Thanks: 3
[Release] SpecialChat for Opennos

I drop my chat system here is a little tutorial.

1: Order package creates a new OpenNos.GameObject/Packet/CommandPacket
Add new class.

Code:
using OpenNos.Core;
using OpenNos.Domain;

namespace OpenNos.GameObject.Packets.CommandPackets
{
    [PacketHeader("$Chat", PassNonParseablePacket = true, Authority = AuthorityType.User)]
    public class TimeSpaceSayPackets : PacketDefinition
    {
        [PacketIndex(0, SerializeToEnd = true)]
        public string Message { get; set; }
    }
}
2: Go in OpenNos.Handler/CommandPacketHandler and put this,

Code:
        /// <summary>
        /// ! Command
        /// </summary>
        /// <param name="TimeSpaceSayPacket"></param>
        public void SpecialChat(TimeSpaceSayPackets timeSpaceSayPacket)
        {
            if (Session.Account.Authority == AuthorityType.User)
            {
                if (!string.IsNullOrEmpty(timeSpaceSayPacket.Message))
                {
                    string message = $"<Canal Discussion> [{Session.Character.Name}]:{timeSpaceSayPacket.Message}";
                    ServerManager.Instance.Broadcast(Session.Character.GenerateSay(message, 11));
                    Session.SendPacket(Session.Character.GenerateSay($"La vente est interdite dans ce canal !", 10));

                }
            }
                

            if (!string.IsNullOrEmpty(timeSpaceSayPacket.Message))
            {
                if (Session.Account.Authority == AuthorityType.GameMaster)
                {
                    string message1 = $"<Canal Discussion> [{Session.Character.Name}]:{timeSpaceSayPacket.Message}";
                    ServerManager.Instance.Broadcast(Session.Character.GenerateSay(message1, 10));
                }
            }
        }
I change the code so that the players speak in pink and gm speak in yellow

Nephya is offline  
Old 12/01/2018, 17:21   #2
 
elite*gold: 0
Join Date: Mar 2016
Posts: 104
Received Thanks: 104
I think it's better if you change your class name ("TimeSpaceSayPacket"), because it's not explicit with this name

And it can be a little better like this:
Code:
        /// <summary>
        /// ! Command
        /// </summary>
        /// <param name="TimeSpaceSayPacket"></param>
        public void SpecialChat(TimeSpaceSayPackets timeSpaceSayPacket)
        {
            if (!string.IsNullOrEmpty(timeSpaceSayPacket.Message))
            {
                ServerManager.Instance.Broadcast(Session.Character.GenerateSay($"<Canal Discussion> [{Session.Character.Name}]:{timeSpaceSayPacket.Message}", Session.Account.Authority == AuthorityType.GameMaster ? 10 : 11));
		if(Session.Account.Authority != AuthorityType.GameMaster)
		    Session.SendPacket(Session.Character.GenerateSay("La vente est interdite dans ce canal !", 10));
            }
        }
NT Z0ltar is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
OpenNos "The project 'OpenNos.Login' failed to build."
06/19/2019 - Nostale - 11 Replies
Hello! When I put in update-database in Visual Studio I get the 'The project 'OpenNos.Login' failed to build.' error. I already did what was on the troubleshoot before I put it in. I've been at this for hours and I can't figure it out. Can someone help me please?
[OpenNos] ¿How to select the project OpenNos.DAL.EF?
05/04/2018 - Nostale - 4 Replies
Hello, I have a problem with my visual studio 2017, it turns out that to be able to give the update-database command I must have the project OpenNos.DAL.EF But the thing is that in my visual studio there is no option to select the project ... I need help!:D:D
[opennos]The project 'OpenNos.Login' failed to build.
08/03/2017 - Nostale - 9 Replies
Hello I have a problem with the package manager console to run the update- database command to opennos soon as I executes the command, he said: The project ' opennos.login ' failed to build What to do? I made the updates to Microsoft Visual Studio thank you ..
[Release] map db opennos
01/26/2017 - Nostale - 5 Replies
/!\If some music is not good on some map, thank you to inform me./!\ Link updated : http://www.partage-facile.com/28OYZ42SY6/map.sql.h tml Release finish : 100%
[Release] portal db opennos
02/27/2016 - Nostale - 11 Replies
Hello i release the portal http://www.partage-facile.com/KS58I4PNIT/portal.s ql.html This is not 100% complete, but it is already quite full! If you want to make changes or ask me to add portals as the official thank you for telling me. Portal estimate: 90% Note: Some portal are scripts, so I would delete some portals when scripts have been coded. ex : LoD, Act 4, arena ...



All times are GMT +1. The time now is 14:22.


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.