[Release]Save Haloes

02/03/2010 05:28 Arcо#1
I made a new easier way of saving halos.
I took what Korvacs said into effect.
First we're going to define. Lets go to Character.cs and search for:
Code:
public PKMode PKMode = PKMode.Capture;
Atop of that place this
Code:
        public int Top = 0;
Now let's go to Database.cs and search for this:
Code:
        public static Game.Character LoadCharacter(string Name, ref string Account)
In the bottom of that you will see:
Code:
                            C.Spouse = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
                            C.UniversityPoints = BR.ReadUInt32();
Under that insert this:
Code:
C.Top = BR.ReadInt32();
Then a little lower you will see:
Code:
C.UniversityPoints = 0;
Under that insert this:
Code:
C.Top = 0;
Now a little bit lower of that you will see
Code:
C.Loaded = true;
Under that put this:
Code:
                    if (C.Top == 1) 
                    {

                    }
Her is how you will use this.
You can place that under C.Loaded = true; as many times as you want, just change the number to what you want and put the effect into the brackets.
EX:
Code:
                    if (C.Top == 1) 
                    {
                        C.StatEff.Add(StatusEffectEn.WeeklyPKChampion);
                    }
Like that.
Now lets go down a little to
Code:
        public static Game.Robot LoadAsRobot(string Name, ref string Account)
and repeat everything you just did.
Next go to
Code:
        public static void SaveCharacter(Game.Character C, string Acc)
And towards the bottom go to:
Code:
                BW.Write(C.UniversityPoints);
And under that put
Code:
                BW.Write(C.Top);
Now go to:
Code:
        public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
And go towards the bottom to
Code:
                        BW.Write((uint)0);//Quiz Pts
And under that put
Code:
                        BW.Write((int)0);//TopEffect
The way I loaded the effects was this:
Code:
                    #region Tops
                    if (C.Top == 1) 
                    {
                        C.StatEff.Add(StatusEffectEn.TopGuildLeader);
                    }
                    if (C.Top == 2)
                    {
                        C.StatEff.Add(StatusEffectEn.TopDeputyLeader);
                    }
                    if (C.Top == 3)
                    {
                        C.StatEff.Add(StatusEffectEn.TopNinja);
                    }
                    if (C.Top == 4)
                    {
                        C.StatEff.Add(StatusEffectEn.TopTrojan);
                    }
                    if (C.Top == 5)
                    {
                        C.StatEff.Add(StatusEffectEn.TopArcher);
                    }
                    if (C.Top == 6)
                    {
                        C.StatEff.Add(StatusEffectEn.TopWarrior);
                    }
                    if (C.Top == 7)
                    {
                        C.StatEff.Add(StatusEffectEn.TopFireTaoist);
                    }
                    if (C.Top == 8)
                    {
                        C.StatEff.Add(StatusEffectEn.TopWaterTaoist);
                    }
                    if (C.Top == 9)
                    {
                        C.StatEff.Add(StatusEffectEn.MonthlyPKChampion);
                    }
                    if (C.Top == 10)
                    {
                        C.StatEff.Add(StatusEffectEn.WeeklyPKChampion);
                    }
#endregion
And just used an npc doing this:
Code:
                            #region GWArenaNPC
                            case 380:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Do you want enter the guild arena?"));
                                        GC.AddSend(Packets.NPCLink("Yes.", 1));
                                        GC.AddSend(Packets.NPCLink("I won the GuildWar and would like to claim my TopGuildLEader halo.", 2));
                                        GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        GC.MyChar.Teleport(1038, 350, 350); 
                                    }
                                    else if (Control == 2)
                                    {
                                        if (GC.MyChar.MyGuild == Features.GuildWars.LastWinner && (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader))
                                        {
                                            GC.MyChar.Top = 1;
                                            GC.MyChar.StatEff.Add(StatusEffectEn.TopGuildLeader);
                                        }
                                    }
                                        break;
                                }
                            #endregion
There you go, this is way better than my other one.
02/03/2010 07:07 WHITELIONX#2
I have no problems with your old way so I shall not be changing it lol
02/03/2010 13:22 .Ocularis#3
Nice dude. wicked job
I think i may switch this one out with the other one... just for the sake of deleting the tops folder and to give me something to do like add this to the character panel so you can add or remove a halo from someone since you won't be able to do it manually without a command.

Maybe I'll make that and release it here in a few days :D who knows

Btw Acro! Check your pms please bro. I sent you a message like 2 days ago


Halo edit added to character form. Grab it from [Only registered and activated users can see links. Click Here To Register...]!
02/03/2010 13:56 ramix#4
good release bro :D

but this code can delete halo if othe person get?

for exemple.. some one win gw get halo guildleader and the next gw he lose, and the winner get that halo... the person lose the halo is deleted? :S
02/03/2010 14:42 Metapod#5
Good job Arco!
02/03/2010 14:50 .Ocularis#6
Quote:
Originally Posted by ramix View Post
good release bro :D

but this code can delete halo if othe person get?

for exemple.. some one win gw get halo guildleader and the next gw he lose, and the winner get that halo... the person lose the halo is deleted? :S

check the release section! I just made a release for this. But it doesn't do it automatically of course, you would have to add that on your own unless someone releases it. I don't think it would be too hard.

I'm not even using this. I like his old halo save system better :P

But, I think if you add new functions to endgw that will remove the halo from any character who is not a member of the winning guild...

And when disbanding a guild I think the "easy" way to remove the GL and dep halos would be making a check for all characters in the guild, to see if they have a value of (GL number) or (Dep number) for C.Tops and if so it should set it to 0.



To make this halo system full... C.Tops would have to broken down into all halo classes.
C.TopArcher
C.TopTrojan
C.TopGLeader
C.TopDLeader
.... and so on with switches of 1 or 0/true or false... I think switches of 1 or 0 would be better.

If Acro does this I'll update my character form for it.

Lol. I just noticed what glover said while I was editing my post.... Oh well xD
02/03/2010 15:24 glover#7
Hello .Arco.
On your code any accounts can get multiple effects like GW winner and Top player and others ? if not you can reorganize your C.Top for use bits for multiple effects.
Like:
bit 0 = TopGuildLeader
bit 1 = TopDeputyLeader
bit 2 = TopNinja
...
...
...
02/03/2010 15:36 .Ocularis#8
Quote:
Originally Posted by glover View Post
Hello .Arco.
On your code any accounts can get multiple effects like GW winner and Top player and others ? if not you can reorganize your C.Top for use bits for multiple effects.
Like:
bit 0 = TopGuildLeader
bit 1 = TopDeputyLeader
bit 2 = TopNinja
...
...
...

Thats pretty much the way it is.
You gotta add them yourself.

Thing is you can't do 2 halos at one time unless you add a massive list... like


bit 301 = TopGL + Top Ninja + Monthly pk champ
bit 403 = Topdl + Top Trojan + weekly pk champ

If C.Tops was broken down you could have all those

[Only registered and activated users can see links. Click Here To Register...]
02/03/2010 15:51 glover#9
Quote:
Originally Posted by Mentalis View Post
Thats pretty much the way it is.
You gotta add them yourself.

Thing is you can't do 2 halos at one time unless you add a massive list... like


bit 301 = TopGL + Top Ninja + Monthly pk champ
bit 403 = Topdl + Top Trojan + weekly pk champ

If C.Tops was broken down you could have all those

[Only registered and activated users can see links. Click Here To Register...]
Lol you wrong Mentalis.
You need to check only 10 bits ;)
And this is added once like when player are login into server, and when get win this stat.

there is a simple code:

Code:
                    int Top = 7;
                    if ((Top & 0x1) != 0)
                        C.StatEff.Add(StatusEffectEn.TopGuildLeader);
                    if ((Top & 0x2) != 0)
                        C.StatEff.Add(StatusEffectEn.TopDeputyLeader);
                    if ((Top & 0x4) != 0)
                        C.StatEff.Add(StatusEffectEn.TopNinja);
02/03/2010 15:57 .Ocularis#10
But then you still have to remove the effects at some point...
I'm working on splitting C.Tops up

It would be easier to remove effects if someone else wins the same effect unless your a DL...

At least for me....

And yea I figured I was wrong. :P My very first look at visual studio was 3-4 weeks ago...

Still a nub :)
02/03/2010 16:04 glover#11
yea you can ^^.
But GW stats are in this source and are writen and loaded when server begin and ending.
Btw. i got C# language from January ^^ i broke programming from 2000 year.
02/20/2010 02:45 memo1340#12
plz man can upload your file Database.cs
because i have Error from (StatusEffectEn)
and i will complete
02/20/2010 02:54 Arcо#13
Quote:
Originally Posted by memo1340 View Post
plz man can upload your file Database.cs
because i have Error from (StatusEffectEn)
and i will complete
Search for
using System;
And add this under it:
using NewestCOServer.Game;
02/20/2010 03:55 memo1340#14
man can U upload your Source plz
02/20/2010 03:57 memo1340#15
Quote:
Originally Posted by .Arco View Post
Search for
using System;
And add this under it:
using NewestCOServer.Game;
where me search