[Release] Prestige system with npc implementation

11/16/2018 13:05 Radiv#1
[Only registered and activated users can see links. Click Here To Register...]
How it works?
1. Create random npc with Dialog 18
2. Change the case "17779" to npcid
3. Add this code to nrunhandler.cs
HTML Code:
                case 3000:
                    switch (packet.Type)
                    {
                        case 0:
                            switch (packet.Value)
                            {
                                case 2:
                                    switch (packet.NpcId)
                                    {
                                        case 17779: // npc id
                                            {
                                                if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 4) // minimal lvl and prestige lvl
                                                {
                                                    Session.Character.Level = 1; // what lvl must be set after change prestige
                                                    Session.Character.prestigeLevel = 5; // what prestige lvl must be set after change prestige
                                                    Session.Character.Compliment = 500; // rewards 
                                                    Session.Character.GiftAdd(396, 1); // rewards
                                                    Session.SendPacket(Session.Character.GenerateStat()); // refresh char stat
                                                    Session.SendPacket(Session.Character.GenerateStatChar()); // refresh char stat
                                                }
                                                else
                                                {
                                                    if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 3)
                                                    {
                                                        Session.Character.Level = 1;
                                                        Session.Character.prestigeLevel = 4;
                                                        Session.Character.Compliment = 400;
                                                        Session.Character.GiftAdd(395, 1);
                                                        Session.SendPacket(Session.Character.GenerateStat());
                                                        Session.SendPacket(Session.Character.GenerateStatChar());
                                                    }
                                                    else
                                                    {
                                                        if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 2)
                                                        {
                                                            Session.Character.Level = 1;
                                                            Session.Character.prestigeLevel = 3;
                                                            Session.Character.Compliment = 300;
                                                            Session.Character.GiftAdd(394, 1);
                                                            Session.SendPacket(Session.Character.GenerateStat());
                                                            Session.SendPacket(Session.Character.GenerateStatChar());
                                                        }
                                                        else
                                                        {
                                                            if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 1)
                                                            {
                                                                Session.Character.Level = 1;
                                                                Session.Character.prestigeLevel = 2;
                                                                Session.Character.Compliment = 200;
                                                                Session.Character.GiftAdd(393, 1);
                                                                Session.SendPacket(Session.Character.GenerateStat());
                                                                Session.SendPacket(Session.Character.GenerateStatChar());
                                                            }
                                                            else
                                                            {
                                                                if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 0)
                                                                {
                                                                    Session.Character.Level = 1;
                                                                    Session.Character.prestigeLevel = 1;
                                                                    Session.Character.Compliment = 100;
                                                                    Session.Character.GiftAdd(392, 1);
                                                                    Session.SendPacket(Session.Character.GenerateStat());
                                                                    Session.SendPacket(Session.Character.GenerateStatChar());
                                                                }
                                                                else
                                                                {
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                    break;
                            }
                            break;
                    }
                    break;
4. Add
HTML Code:
        public int prestigeLevel { get; set; }
to OpenNos.DAL.EF/CharacterDTO.cs
5. Add
HTML Code:
        public int prestigeLevel { get; set; }
to OpenNos.DAL.EF/Character.cs
6. Add
HTML Code:
             output.prestigeLevel = input.prestigeLevel;
to charactermapper.cs
7. update your database use update-database -Verobse
8. add this code
HTML Code:
        public string GenerateCInfo() => $"c_info {(Authority == AuthorityType.Moderator && !Undercover ? $"[NH]" + Name : Authority == AuthorityType.GameMaster ? $"[P{prestigelevel}]" + Name : Authority == AuthorityType.User ? $"[P{prestigelevel}]" + Name : Authority == AuthorityType.BitchNiggerFaggot ? Name + $"[BitchNiggerFaggot]" : Name)} - -1 {(Family != null && !Undercover ? $"{Family.FamilyId} {Family.Name}({Language.Instance.GetMessageFromKey(FamilyCharacter.Authority.ToString().ToUpper())})" : "-1 -")} {CharacterId} {(Invisible ? 6 : Undercover ? (byte)AuthorityType.User : Authority < AuthorityType.User ? (byte)AuthorityType.User : (byte)Authority)} {(byte)Gender} {(byte)HairStyle} {(byte)HairColor} {(byte)Class} {(GetDignityIco() == 1 ? GetReputationIco() : -GetDignityIco())} {(Authority == AuthorityType.Moderator ? 500 : Compliment)} {(UseSp || IsVehicled ? Morph : 0)} {(Invisible ? 1 : 0)} {Family?.FamilyLevel ?? 0} {(UseSp ? MorphUpgrade : 0)} {ArenaWinner}";
and this
HTML Code:
            return $"in 1 {(Authority == AuthorityType.Moderator && !Undercover ? $"[NH]" + _name : Authority == AuthorityType.GameMaster ? $"[P{prestigelevel}]" + _name : Authority == AuthorityType.User ? $"[P{prestigelevel}]" + _name : Authority == AuthorityType.BitchNiggerFaggot ? $"[BitchNiggerFaggot][P{prestigelevel}]" : _name)} - {CharacterId} {PositionX} {PositionY} {Direction} {(Undercover ? (byte)AuthorityType.User : Authority < AuthorityType.User ? (byte)AuthorityType.User : (byte)Authority)} {(byte)Gender} {(byte)HairStyle} {color} {(byte)Class} {GenerateEqListForPacket()} {Math.Ceiling(Hp / HPLoad() * 100)} {Math.Ceiling(Mp / MPLoad() * 100)} {(IsSitting ? 1 : 0)} {(Group?.GroupType == GroupType.Group ? (Group?.GroupId ?? -1) : -1)} {(fairy != null && !Undercover ? 4 : 0)} {fairy?.Item.Element ?? 0} 0 {fairy?.Item.Morph ?? 0} 0 {(UseSp || IsVehicled ? Morph : 0)} {GenerateEqRareUpgradeForPacket()} {(!Undercover ? (foe ? -1 : Family?.FamilyId ?? -1) : -1)} {(!Undercover ? (foe ? _name : Family?.Name ?? "-") : "-")} {(GetDignityIco() == 1 ? GetReputationIco() : -GetDignityIco())} {(Invisible ? 1 : 0)} {(UseSp ? MorphUpgrade : 0)} {_faction} {(UseSp ? MorphUpgrade2 : 0)} {Level} {Family?.FamilyLevel ?? 0} {ArenaWinner} {(Authority == AuthorityType.Moderator && !Undercover ? 500 : Compliment)} {Size} {HeroLevel}";
in the Gameobject.character.cs

If someone have problem tell me.
11/16/2018 13:45 Radiv#2
Quote:
Originally Posted by loulouna23 View Post
How add prestige in item

And how add p0 p1 ...
Why item? Npc is better. And what p0 and p1?
11/16/2018 17:33 Nephya#3
Code:
        public void PrestigeFunction(ItemInstance inv)
        {
            if (Session.Character.MapInstance != null)
            {
                if (Session.Character.Inventory.Any(s => s.Type == InventoryType.Wear))
                {
                    Session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("EQ_NOT_EMPTY"), 0));
                    return;
                }

                if (Session.Character.Level == 250 && Session.Character.HeroLevel == 100 && Session.Character.Prestige < 20)
                {
                    Session.Character.Prestige++;
                    ServerManager.Shout(Name + " est passé prestige " + Prestige);
                    Session.SendPacket(Session.Character.GenerateLev());
                    Session.SendPacket(Session.Character.GenerateIn());
                    Session.SendPacket(Session.Character.GenerateCInfo());
                    Session.SendPacket(Session.Character.GenerateStat());
                    Session.Character.Save();
                    Session.Character.Inventory.RemoveItemFromInventory(inv.Id);

                }
                else
                {
                    Session.SendPacket("msg 4 Tu n'as pas le niveau requis !");
                }
            }
        }
Code:
        public string GenerateCInfo() => $"c_info {(Authority == AuthorityType.Moderator && !Undercover ? $"[NH]" + Name : Authority == AuthorityType.GameMaster ? $"[P{Prestige}]" + Name : Authority == AuthorityType.User ? $"[P{Prestige}]" + Name : Authority == AuthorityType.BitchNiggerFaggot ? Name + $"[BitchNiggerFaggot]" : Name)} - -1 {(Family != null && !Undercover ? $"{Family.FamilyId} {Family.Name}({Language.Instance.GetMessageFromKey(FamilyCharacter.Authority.ToString().ToUpper())})" : "-1 -")} {CharacterId} {(Invisible ? 6 : Undercover ? (byte)AuthorityType.User : Authority < AuthorityType.User ? (byte)AuthorityType.User : (byte)Authority)} {(byte)Gender} {(byte)HairStyle} {(byte)HairColor} {(byte)Class} {(GetDignityIco() == 1 ? GetReputationIco() : -GetDignityIco())} {(Authority == AuthorityType.Moderator ? 500 : Compliment)} {(UseSp || IsVehicled ? Morph : 0)} {(Invisible ? 1 : 0)} {Family?.FamilyLevel ?? 0} {(UseSp ? MorphUpgrade : 0)} {ArenaWinner}";
Code:
            return $"in 1 {(Authority == AuthorityType.Moderator && !Undercover ? $"[NH]" + _name : Authority == AuthorityType.GameMaster ? $"[P{Prestige}]" + _name : Authority == AuthorityType.User ? $"[P{Prestige}]" + _name : Authority == AuthorityType.BitchNiggerFaggot ? $"[BitchNiggerFaggot][P{Prestige}]" : _name)} - {CharacterId} {PositionX} {PositionY} {Direction} {(Undercover ? (byte)AuthorityType.User : Authority < AuthorityType.User ? (byte)AuthorityType.User : (byte)Authority)} {(byte)Gender} {(byte)HairStyle} {color} {(byte)Class} {GenerateEqListForPacket()} {Math.Ceiling(Hp / HPLoad() * 100)} {Math.Ceiling(Mp / MPLoad() * 100)} {(IsSitting ? 1 : 0)} {(Group?.GroupType == GroupType.Group ? (Group?.GroupId ?? -1) : -1)} {(fairy != null && !Undercover ? 4 : 0)} {fairy?.Item.Element ?? 0} 0 {fairy?.Item.Morph ?? 0} 0 {(UseSp || IsVehicled ? Morph : 0)} {GenerateEqRareUpgradeForPacket()} {(!Undercover ? (foe ? -1 : Family?.FamilyId ?? -1) : -1)} {(!Undercover ? (foe ? _name : Family?.Name ?? "-") : "-")} {(GetDignityIco() == 1 ? GetReputationIco() : -GetDignityIco())} {(Invisible ? 1 : 0)} {(UseSp ? MorphUpgrade : 0)} {_faction} {(UseSp ? MorphUpgrade2 : 0)} {Level} {Family?.FamilyLevel ?? 0} {ArenaWinner} {(Authority == AuthorityType.Moderator && !Undercover ? 500 : Compliment)} {Size} {HeroLevel}";
Code:
            switch (Prestige)
            {
                case 0:
                    break;

                case 1:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;
                case 2:
                case 3:
                case 4:
                case 5:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;
                case 16:
                case 17:
                case 18:
                case 19:
                case 20:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;

                default:
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    Session.Character.AddStaticBuff(new StaticBuffDTO { CardId = 131 });
                    break;
            }
Code:
                case 8000:
                    session.Character.PrestigeFunction(inv);
                    break;
[Only registered and activated users can see links. Click Here To Register...]


xd
11/16/2018 18:35 Irelia<3#4
tutorial for NSharp please :c
11/16/2018 19:59 MarsB51#5
command prestige no work :( help me!
11/16/2018 23:56 Irelia<3#6
NosSharp or NosWings table problem get set does not exist.
11/17/2018 00:23 MarsB51#7
@[Only registered and activated users can see links. Click Here To Register...] i send you pm read
11/17/2018 02:00 0Lucifer0#8
Quote:
Originally Posted by Radiv View Post
[Only registered and activated users can see links. Click Here To Register...]
How it works?
1. Create random npc with Dialog 18
2. Change the case "17779" to npcid
3. Add this code to nrunhandler.cs
4. Add
HTML Code:
        public int prestigeLevel { get; set; }
to OpenNos.DAL.EF/CharacterDTO.cs
5. Add
HTML Code:
        public int prestigeLevel { get; set; }
to OpenNos.DAL.EF/Character.cs
6. update your database use update-database -Verobse
HTML Code:
                case 3000:
                    switch (packet.Type)
                    {
                        case 0:
                            switch (packet.Value)
                            {
                                case 2:
                                    switch (packet.NpcId)
                                    {
                                        case 17779: // npc id
                                            {
                                                if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 4) // minimal lvl and prestige lvl
                                                {
                                                    Session.Character.Level = 1; // what lvl must be set after change prestige
                                                    Session.Character.prestigeLevel = 5; // what prestige lvl must be set after change prestige
                                                    Session.Character.Compliment = 500; // rewards 
                                                    Session.Character.GiftAdd(396, 1); // rewards
                                                    Session.SendPacket(Session.Character.GenerateStat()); // refresh char stat
                                                    Session.SendPacket(Session.Character.GenerateStatChar()); // refresh char stat
                                                }
                                                else
                                                {
                                                    if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 3)
                                                    {
                                                        Session.Character.Level = 1;
                                                        Session.Character.prestigeLevel = 4;
                                                        Session.Character.Compliment = 400;
                                                        Session.Character.GiftAdd(395, 1);
                                                        Session.SendPacket(Session.Character.GenerateStat());
                                                        Session.SendPacket(Session.Character.GenerateStatChar());
                                                    }
                                                    else
                                                    {
                                                        if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 2)
                                                        {
                                                            Session.Character.Level = 1;
                                                            Session.Character.prestigeLevel = 3;
                                                            Session.Character.Compliment = 300;
                                                            Session.Character.GiftAdd(394, 1);
                                                            Session.SendPacket(Session.Character.GenerateStat());
                                                            Session.SendPacket(Session.Character.GenerateStatChar());
                                                        }
                                                        else
                                                        {
                                                            if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 1)
                                                            {
                                                                Session.Character.Level = 1;
                                                                Session.Character.prestigeLevel = 2;
                                                                Session.Character.Compliment = 200;
                                                                Session.Character.GiftAdd(393, 1);
                                                                Session.SendPacket(Session.Character.GenerateStat());
                                                                Session.SendPacket(Session.Character.GenerateStatChar());
                                                            }
                                                            else
                                                            {
                                                                if (Session.Character.Level >= 99 && Session.Character.prestigeLevel == 0)
                                                                {
                                                                    Session.Character.Level = 1;
                                                                    Session.Character.prestigeLevel = 1;
                                                                    Session.Character.Compliment = 100;
                                                                    Session.Character.GiftAdd(392, 1);
                                                                    Session.SendPacket(Session.Character.GenerateStat());
                                                                    Session.SendPacket(Session.Character.GenerateStatChar());
                                                                }
                                                                else
                                                                {
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                    Session.SendPacket("msg 5 Your Level is not high enough!"); // too small lvl
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                    break;
                            }
                            break;
                    }
                    break;
When you use switch instead of if and if instead of switch... this code deserve a medal and is a good example of what people should never do
04/11/2019 11:21 Radiv#9
Small tutorial update.

Quote:
Originally Posted by 0Lucifer0 View Post
When you use switch instead of if and if instead of switch... this code deserve a medal and is a good example of what people should never do
Bruh it's exmaple if someone want can add this code to command or after use item.
04/11/2019 11:25 0Lucifer0#10
Quote:
Originally Posted by Radiv View Post
Small tutorial update.



Bruh it's exmaple if someone want can add this code to command or after use item.
It doesn’t change anything in the fact this is ugly monkey code and this should never be used anywhere
04/11/2019 13:01 Saber none#11
Quote:
Originally Posted by Radiv View Post
Small tutorial update.



Bruh it's exmaple if someone want can add this code to command or after use item.
I mean he is right, you confused every if with every switch, you can completly exchange those if's with a switch ^^
03/15/2020 16:00 Zoro889#12
if i use your system dont save me prestige if i am prestige lvl 0 i prestige to lvl 1 i relog and i come back at p0
03/15/2020 18:24 Shitoshi#13
Quote:
Originally Posted by Zoro889 View Post
if i use your system dont save me prestige if i am prestige lvl 0 i prestige to lvl 1 i relog and i come back at p0
Add prestigeLevel = input.prestigeLevel; to Character.cs in GameObject
03/15/2020 18:37 Zoro889#14
same
03/15/2020 19:07 InnoTx#15
I would change the code with your switch instead of using so many ifs


and yeah do what shitoshi say and it should be work