Register for your free account! | Forgot your password?

You last visited: Today at 01:01

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

Advertisement



[Release] RB Guard

Discussion on [Release] RB Guard within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
[Release] RB Guard

As i promissed yesterday, i have to relase my RB Guard code

Guard attack players, and give exp to user when he atack mob. I have based on PowerSource.

Ok lets begin

Start with Character.cs

Find:

Code:
        public SingleMob MobTarget = null;
Abowe add:

Code:
        public SingleMob Guard = null;
Find:

Code:
                    if (SkillAttributes[0] == 7)
                    {
Bellow add:

Code:
                        if (SkillId == 4000 && Stamina >= 100)
                        {
                            if (Guard == null)
                            {
                                if (SkillLvl == 0)
                                    
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 0);
                                if (SkillLvl == 1)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 1);
                                if (SkillLvl == 2)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 2);
                                if (SkillLvl == 3)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 3);
                               
                            }
                            else
                            {
                                Guard.Dissappear();

                                if (SkillLvl == 0)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 0);
                                if (SkillLvl == 1)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 1);
                                if (SkillLvl == 2)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 2);
                                if (SkillLvl == 3)
                                    Mobs.NewRBGuard(Convert.ToInt16(MyClient.MyChar.LocX), Convert.ToInt16(MyClient.MyChar.LocY), Convert.ToInt16(MyClient.MyChar.LocMap), MyClient.MyChar.UID, 3);
                             }
                            Stamina = 0;
;
                            MyClient.SendPacket(General.MyPackets.Vital(UID, 9, Stamina));
                        }

search for:

Code:
        public void AddSkillExp(short Type, uint Amount)
        {
            Ready = false;
            Amount *= ExternalDatabase.ProfExpRate;
and bellow add:

Code:
if (Type == 4000) Amount = 1;


Next part is in Entities.cs

Search for:

Code:
SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]));
replace it with:

Code:
SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]),0,true);
Search for:

Code:
                ExternalDatabase.Mobs = null;
                ExternalDatabase.MobSpawns = null;
                General.WriteLine("Spawned " + MobsSpawned + " mobs.");
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
and bellow add:

Code:
        public static void NewRBGuard(short x, short y, short map, uint owner,short glvl)
        {
            try
            {
                uint UID = (uint)General.Rand.Next(400000, 500000);
                while (AllMobs.Contains(UID))
                {
                    UID = (uint)General.Rand.Next(400000, 500000);
                }
                int gms=0;
                uint ghp=0;
                short gat=0, glv=0;
                string gna="";
                if (glvl == 0)
                {
                    ghp = 10000;
                    gat = 300;
                    gna = "IronGuard";
                    gms = 920;
                    glv = 60;
                }
                else if (glvl == 1)
                {
                    ghp = 20000;
                    gat = 600;
                    gna = "CopperGuard";
                    gms = 920;
                    glv = 90;
                }
                else if (glvl == 2)
                {
                    ghp = 34895;
                    gat = 900;
                    gna = "SilverGuard";
                    gms = 920;
                    glv = 110;
                 }
                else
                {
                    ghp = 60000;
                    gat = 1300;
                    gna = "GoldGuard";
                    gms = 920;
                    glv = 120;
                }
                SingleMob Mob = new SingleMob(x, y, map, ghp, ghp, 150, gat, UID, gna, gms, glv, (byte)General.Rand.Next(8), 7, owner, false);
                AllMobs.Add(UID, Mob);
                Other.Charowner(owner).Guard = Mob;
                World.SpawnMobForPlayers(Mob, true);
                
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
    }
search for:
Code:
        DateTime LastTargetting;
        DateTime LastMove;
        public DateTime Death;
        bool Revive = false;
abbowe add:
Code:
        DateTime LastAtack;
Now search for:
Code:
        public Timer MyTimer = new Timer();
        Character Target = null;
replace it with that:

Code:
        public Timer MyTimer = new Timer();
        
        Character Target = null;
        SingleMob Target2 = null;
        public uint owner = 0;
        Character owner2 = null;
        public bool frev = true;
Search:

Code:
        public SingleMob(short x, short y, short map, uint maxhp, uint curhp, short minatk, short maxatk, uint uid, string name, int mech, short lvl, byte pos, byte Type)
        {
            PosX = x;
            PosY = y;
            Map = map;
            MaxHP = maxhp;
            CurHP = curhp;
            MinAtk = minatk;
            MaxAtk = maxatk;
            UID = uid;
            Name = name;
            Mech = mech;
            Level = lvl;
            Pos = pos;
            XStart = PosX;
            YStart = PosY;
            Alive = true;
            if (Type == 2)
                BossMob = true;
            MType = Type;


            PrevX = PosX;
            PrevY = PosY;

            MyTimer.Interval = 500;
            MyTimer.Elapsed += new ElapsedEventHandler(TimerElapsed);
            MyTimer.Start();
        }
replace it with:

Code:
        public SingleMob(short x, short y, short map, uint maxhp, uint curhp, short minatk, short maxatk, uint uid, string name, int mech, short lvl, byte pos, byte Type, uint owner, bool Alive)
        {
            PosX = x;
            PosY = y;
            Map = map;
            MaxHP = maxhp;
            CurHP = curhp;
            MinAtk = minatk;
            MaxAtk = maxatk;
            UID = uid;
            Name = name;
            Mech = mech;
            Level = lvl;
            Pos = pos;
            XStart = PosX;
            YStart = PosY;
            Alive = true;
            frev = true;
            if (Type == 2)
                BossMob = true;
            MType = Type;
            if (owner != 0)
                owner2 = Other.Charowner(owner);
            PrevX = PosX;
            PrevY = PosY;
            if (MType==7)
            MyTimer.Interval = 100;
            else
            MyTimer.Interval = 500;
            MyTimer.Elapsed += new ElapsedEventHandler(TimerElapsed);
            MyTimer.Start();
        }
Search:

Code:
        public void TimerElapsed(object source, ElapsedEventArgs e)
and replace whole void with:
Code:
        public void TimerElapsed(object source, ElapsedEventArgs e)
        {
            if (MType == 7)
            {
                
                    GetTarget();
            }
            else
            {
                if (DateTime.Now > LastTargetting.AddMilliseconds(2000))
                    GetTarget();
            }
            if (Target != null)
                if (Target.MyClient == null || !Target.MyClient.There || !Target.Alive || !Alive || Target.LocMap != Map)
                    Target = null;

            if (Target != null)
                if (MType != 1 && MType != 4 && MType != 5 && MType != 6)
                    if (Target.Flying)
                        Target = null;

            if (MType == 7)
            {
                if (Target != null) 
                GuardMove(3);
                else if (Target2 != null)
                    GuardMove(2);
                else
                    GuardMove(1);
            }
            else
            {
                if (Target != null)
                    Move();
            }

            if (!Alive)
            {
                if (Revive == false)
                {
                    if (DateTime.Now > Death.AddMilliseconds(3000))
                        Dissappear();
                }
                else
                {
                    if (MType == 2)
                    {
                        if (Map == 1015)
                        {
                            if (DateTime.Now > Death.AddMilliseconds(60000))
                                ReSpawn();
                        }
                        if (Map != 1015)
                        {
                            if (DateTime.Now > Death.AddMilliseconds(600000))
                                ReSpawn();
                        }
                    }
                    if (MType == 0)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();
                    }
                    if (MType == 1)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();
                    }
                    if (MType == 4)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();
                    }
                    if (MType == 3)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();

                    }
                    if (MType == 5)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();
                    }
                    if (MType == 6)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(10000))
                            ReSpawn();
                    }
                    if (MType == 7)
                    {
                        if (DateTime.Now > Death.AddMilliseconds(100))
                            ReSpawn();
                    }
                }
            }
        }
Same thing with:

Code:
        public void GetTarget()
        {
            LastTargetting = DateTime.Now;
            if (MType != 1&&MType !=7)
                Target = Other.CharNearest((uint)PosX, (uint)PosY, (uint)Map, false);
            else if (MType == 1)
                Target = Other.CharNearest((uint)PosX, (uint)PosY, (uint)Map, true);
            else if (MType == 7)
            {
                if (owner2.MobTarget != null || owner2.PTarget != null)
                {
                    if (owner2.MobTarget != null)
                    {
                        Target2 = owner2.MobTarget;
                        Target = null;
                    }
                    if (owner2.PTarget != null)
                    {
                        Target = owner2.PTarget;
                        Target2 = null;
                    }
                }
                else
                {
                    Target = Target;
                    Target2 = Target2;
                }
            }
        }
Search:
Code:
public void Move()
Abowe add:

Code:
        public void GuardMove(short opc)
        {
            if (Alive)
            {
                if (owner2 != null && owner2.Alive && owner2.MyClient.Online&&Map==owner2.LocMap)
                {
                    if (DateTime.Now > LastMove.AddMilliseconds(500))
                    {

                        if (MyMath.PointDistance(PosX, PosY, owner2.LocX, owner2.LocY) <= 25)
                        {
                            //Created by Bisiol
                            if (opc == 1)
                            {
                                if ((MyMath.PointDistance(PosX, PosY, owner2.LocX, owner2.LocY) >= 2) && (MyMath.PointDistance(PosX, PosY, owner2.LocX, owner2.LocY) <= 25))
                                {
                                    byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(PosX, PosY, owner2.LocX, owner2.LocY) / 45 % 8)) - 1 % 8);


                                    ToDir = (byte)((int)ToDir % 8);
                                    short AddX = 0;
                                    short AddY = 0;
                                    if (ToDir == 255)
                                        ToDir = 7;
                                    Pos = ToDir;

                                    switch (ToDir)
                                    {
                                        case 0:
                                            {
                                                AddY = 1;
                                                break;
                                            }
                                        case 1:
                                            {
                                                AddX = -1;
                                                AddY = 1;
                                                break;
                                            }
                                        case 2:
                                            {
                                                AddX = -1;
                                                break;
                                            }
                                        case 3:
                                            {
                                                AddX = -1;
                                                AddY = -1;
                                                break;
                                            }
                                        case 4:
                                            {
                                                AddY = -1;
                                                break;
                                            }
                                        case 5:
                                            {
                                                AddX = 1;
                                                AddY = -1;
                                                break;
                                            }
                                        case 6:
                                            {
                                                AddX = 1;
                                                break;
                                            }
                                        case 7:
                                            {
                                                AddY = 1;
                                                AddX = 1;
                                                break;
                                            }
                                    }

                                    PrevX = PosX;
                                    PrevY = PosY;
                                    PosX += AddX;
                                    PosY += AddY;
                                    World.MobMoves(this, ToDir);
                                    World.SpawnMobForPlayers(this, true);
                                    PrevX = PosX;
                                    PrevY = PosY;
                                    PosX += AddX;
                                    PosY += AddY;
                                    World.MobMoves(this, ToDir);
                                    World.SpawnMobForPlayers(this, true);


                                }
                                else if (MyMath.PointDistance(PosX, PosY, owner2.LocX, owner2.LocY) < 2)
                                { }
                            }
                            else if (opc == 2)
                            {

                                if (DateTime.Now > LastAtack.AddMilliseconds(1000))
                                {
                                    if (MyMath.PointDistance(PosX, PosY, Target2.PosX, Target2.PosY) <= 10)
                                    {
                                        LastMove = DateTime.Now;

                                        int DMG = Convert.ToInt32(MaxAtk);

                                        if (DMG < 1)
                                            DMG = 1;

                                       
                                        uint GEXP=0;
                                        if (DMG<=Target2.CurHP)
                                            GEXP=(uint)DMG;
                                        else if(DMG>Target2.CurHP)
                                            GEXP=Target2.CurHP;
                                        Target2.GetDamage((uint)DMG);
                                        if (Target2.MType != 1 && Target2.MType != 7)
                                        { owner2.AddExp(GEXP,true); }
                                        foreach (DictionaryEntry DE in World.AllChars)
                                        {
                                            Character Charr = (Character)DE.Value;

                                            if (Charr.MyClient.Online)
                                                if (MyMath.CanSeeBig(PosX, PosY, Charr.LocX, Charr.LocY))
                                                {
                                                    Charr.MyClient.SendPacket(General.MyPackets.MobSkillUse2(this, Target2, (uint)DMG, 1002, 1));
                                                }
                                        }
                                        if (Target2.CurHP <= 0)
                                            Target2 = null;
                                        LastAtack = DateTime.Now;
                                    }
                                    else if ((MyMath.PointDistance(PosX, PosY, Target2.PosX, Target2.PosY) >= 11) && (MyMath.PointDistance(PosX, PosY, Target2.PosX, Target2.PosY) <= 25))
                                    {
                                        byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(PosX, PosY, Target2.PosX, Target2.PosY) / 45 % 8)) - 1 % 8);



                                        ToDir = (byte)((int)ToDir % 8);
                                        short AddX = 0;
                                        short AddY = 0;
                                        if (ToDir == 255)
                                            ToDir = 7;
                                        Pos = ToDir;

                                        switch (ToDir)
                                        {
                                            case 0:
                                                {
                                                    AddY = 1;
                                                    break;
                                                }
                                            case 1:
                                                {
                                                    AddX = -1;
                                                    AddY = 1;
                                                    break;
                                                }
                                            case 2:
                                                {
                                                    AddX = -1;
                                                    break;
                                                }
                                            case 3:
                                                {
                                                    AddX = -1;
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 4:
                                                {
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 5:
                                                {
                                                    AddX = 1;
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 6:
                                                {
                                                    AddX = 1;
                                                    break;
                                                }
                                            case 7:
                                                {
                                                    AddY = 1;
                                                    AddX = 1;
                                                    break;
                                                }
                                        }

                                        PrevX = PosX;
                                        PrevY = PosY;
                                        PosX += AddX;
                                        PosY += AddY;
                                        World.MobMoves(this, ToDir);
                                        World.SpawnMobForPlayers(this, true);
                                        PrevX = PosX;
                                        PrevY = PosY;
                                        PosX += AddX;
                                        PosY += AddY;
                                        World.MobMoves(this, ToDir);
                                        World.SpawnMobForPlayers(this, true);


                                    }


                                }
                            }
                            else if (opc == 3)
                            {

                                if (DateTime.Now > LastAtack.AddMilliseconds(1000))
                                {
                                    if (MyMath.PointDistance(PosX, PosY, Target.LocX, Target.LocY) <= 10)
                                    {
                                        int DMG = MaxAtk - (int)Target.MDefense;
                                        if (DMG < 1)
                                            DMG = 1;

                                        if (Target.GetHitDie((uint)DMG))
                                        {
                                            if (MType == 7)
                                            {
                                                World.MobAttacksCharSkill(this, Target, (uint)DMG, 1002, 1);

                                            }

                                        }
                                        else
                                        {
                                            if (MType == 7)
                                                World.MobAttacksCharSkill(this, Target, (uint)DMG, 1002, 1);
                                        }
                                        if (Target.CurHP <= 0)
                                            Target = null;
                                        LastAtack = DateTime.Now;
                                    }
                                    else if ((MyMath.PointDistance(PosX, PosY, Target.LocX, Target.LocY) >= 11) && (MyMath.PointDistance(PosX, PosY, Target.LocX, Target.LocY) <= 25))
                                    {
                                        byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(PosX, PosY, Target.LocX, Target.LocY) / 45 % 8)) - 1 % 8);



                                        ToDir = (byte)((int)ToDir % 8);
                                        short AddX = 0;
                                        short AddY = 0;
                                        if (ToDir == 255)
                                            ToDir = 7;
                                        Pos = ToDir;

                                        switch (ToDir)
                                        {
                                            case 0:
                                                {
                                                    AddY = 1;
                                                    break;
                                                }
                                            case 1:
                                                {
                                                    AddX = -1;
                                                    AddY = 1;
                                                    break;
                                                }
                                            case 2:
                                                {
                                                    AddX = -1;
                                                    break;
                                                }
                                            case 3:
                                                {
                                                    AddX = -1;
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 4:
                                                {
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 5:
                                                {
                                                    AddX = 1;
                                                    AddY = -1;
                                                    break;
                                                }
                                            case 6:
                                                {
                                                    AddX = 1;
                                                    break;
                                                }
                                            case 7:
                                                {
                                                    AddY = 1;
                                                    AddX = 1;
                                                    break;
                                                }
                                        }

                                        PrevX = PosX;
                                        PrevY = PosY;
                                        PosX += AddX;
                                        PosY += AddY;
                                        World.MobMoves(this, ToDir);
                                        World.SpawnMobForPlayers(this, true);
                                        PrevX = PosX;
                                        PrevY = PosY;
                                        PosX += AddX;
                                        PosY += AddY;
                                        World.MobMoves(this, ToDir);
                                        World.SpawnMobForPlayers(this, true);


                                    }


                                }
                            }
                           
                        }
                        else
                        {
                            Gjump();
                            World.SpawnMobForPlayers(this, true);
                            Target = null;
                            Target2 = null;
                        }

                        LastMove = DateTime.Now;
                    }
                }
                else
                    Dissappear();
            }
        }
Find and replace:

Code:
        public void Dissappear()
        {
            World.RemoveEntity(this);
            Revive = true;
        }
with that:

Code:
        public void Dissappear()
        {
            if (MType == 7&&frev==false)
            {                
                World.RemoveEntity(this);
                Mobs.AllMobs.Remove(this);
                Alive = false;
            }
            else if (MType == 7 && frev == true)
            {
                World.RemoveEntity(this);
                Revive = true;
                frev = false;
            }
            else
            {
                World.RemoveEntity(this);
                Revive = true;
            }
        }
find:

Code:
        public void ReSpawn()
        {
            CurHP = MaxHP;
            Alive = true;
            PosX = XStart;
            PosY = YStart;
            PrevX = PosX;
            PrevY = PosY;
            World.MobReSpawn(this);
            Revive = false;
        }
bellow add:

Code:
        public void Gjump()
        {
            PosX = (short)owner2.LocX;
            PosY = (short)owner2.LocY;            
            PrevX = PosX;
            PrevY = PosY;
            World.GuardReSpawn(this);
        }
Next: Database.cs(External one)

find:

Code:
    public static void DefineSkills()
    {
bellow add:

Code:
        SkillAttributes[4000] = new ushort[4][];
        SkillAttributes[4000][0] = new ushort[6] { 7, 0, 0, 0, 100, 0 };
        SkillAttributes[4000][1] = new ushort[6] { 7, 0, 0, 0, 100, 0 };
        SkillAttributes[4000][2] = new ushort[6] { 7, 0, 0, 0, 100, 0 };
        SkillAttributes[4000][3] = new ushort[6] { 7, 0, 0, 0, 100, 0 };
        SkillsDone.Add(4000, 3);
search:

Code:
    public static uint NeededSkillExp(short SkillId, byte Level)
    {
bellow add:

Code:
        if (SkillId == 4000)
        {
            if (Level == 0)
                return 100;
            if (Level == 1)
                return 300;
            if (Level == 2)
                return 500;
            else return 0;
        }
Next Other.cs:
search for:

Code:
public static bool CharExist(string Needle, string HayStack)
abowe add:

Code:
        public static Character Charowner(uint uid)
        {
            try
            {
                
                Character ownerchar = null;
                foreach (DictionaryEntry DE in World.AllChars)
                {
                    Character Charr = (Character)DE.Value;
                    if (uid == Charr.UID)
                     
                                ownerchar = Charr;
                                
                            

                }
                return ownerchar;
            }
            catch (Exception Exc) { General.WriteLine(Exc.ToString()); return null; }
        }
Next Packets.cs:
search for:

Code:
        public byte[] SkillUse(Character Charr, Hashtable Targets, Hashtable PTargets, Hashtable NPCTargets, short AimX, short AimY, short SkillId, byte SkillLvl, byte Switch, uint OneTarget, uint TargetDMG)
        {
abowe add:

Code:
        public byte[] MobSkillUse2(SingleMob Mob, SingleMob Attacked, uint DMG, ushort SkillId, byte SkillLevel)
        {
            ushort PacketType = 1105;
            byte[] Packet = new byte[32];

            fixed (byte* p = Packet)
            {
                *((ushort*)p) = (ushort)Packet.Length;
                *((ushort*)(p + 2)) = (ushort)PacketType;
                *((uint*)(p + 4)) = (uint)Mob.UID;
                *((ushort*)(p + 8)) = (ushort)Attacked.PosX;
                *((ushort*)(p + 10)) = (ushort)Attacked.PosY;
                *((ushort*)(p + 12)) = (ushort)SkillId;
                *((ushort*)(p + 14)) = (ushort)SkillLevel;
                *(p + 16) = 1;
                *((uint*)(p + 20)) = (uint)Attacked.UID;
                *((uint*)(p + 24)) = (uint)DMG;
            }
            return Packet;
        }
Next World.cs:
search:

Code:
public static void MobDissappear(SingleMob Mob)
abowe add:

Code:
        public static void GuardReSpawn(SingleMob Mob)
        {
            lock (AllChars)
            {
                foreach (DictionaryEntry DE in AllChars)
                {
                    Character Charr = (Character)DE.Value;

                    if (Charr.MyClient.Online)
                        if (Mob.Map == Charr.LocMap)
                            if (MyMath.CanSee(Mob.PosX, Mob.PosY, Charr.LocX, Charr.LocY))
                            {
                                Charr.MyClient.SendPacket(General.MyPackets.SpawnMob(Mob));
                            }
                }
            }
        }
I hope it will be usefull for someone
BTW post your comments positive or negative.
Bisiol


Edit1 I forget something:P
That fragment is for block you from attacking your guard

In Client.cs
search:
Code:
                            else if (Target > 400000 && Target < 500000)
                            {
                                SingleMob TargetMob = (SingleMob)Mobs.AllMobs[Target];

                                MyChar.MobTarget = null;

                                if (TargetMob != null)
                                {
                                    MyChar.AtkType = (byte)AttackType;
                                    MyChar.MobTarget = TargetMob;
                                }
                            }
and replace it with:
Code:
                            else if (Target > 400000 && Target < 500000)
                            {
                                if (MyChar.Guard != null)
                                {
                                    if (Target != MyChar.Guard.UID)
                                    {
                                        SingleMob TargetMob = (SingleMob)Mobs.AllMobs[Target];

                                        MyChar.MobTarget = null;

                                        if (TargetMob != null)
                                        {
                                            MyChar.AtkType = (byte)AttackType;
                                            MyChar.MobTarget = TargetMob;
                                        }

                                    }
                                }
                                else
                                {
                                    SingleMob TargetMob = (SingleMob)Mobs.AllMobs[Target];

                                    MyChar.MobTarget = null;

                                    if (TargetMob != null)
                                    {
                                        MyChar.AtkType = (byte)AttackType;
                                        MyChar.MobTarget = TargetMob;
                                    }


                                }
                            }
And BlueName stuffs:
Character.cs:
search(4 times) for :
Code:
if (PKMode == 0 || Mob.MType != 1)
and replace all with:
Code:
if (PKMode == 0 || Mob.MType != 1 && Mob.MType != 7)
search (3 times):
Code:
PKMode == 0 || Target.MType != 1
and replace all with:
Code:
PKMode == 0 || Target.MType != 1 && Target.MType != 7
search(3 times):
Code:
Target.MType == 1
and replace all :
Code:
Target.MType == 1 || Target.MType == 7
search(4 times):
Code:
Mob.MType == 1
replace all with:
Code:
Mob.MType == 1||Mob.MType == 7
Search(2 times):
Code:
MobTarget.MType == 1
replace with:
Code:
MobTarget.MType == 1 || MobTarget.MType == 7
bisiol is offline  
Thanks
24 Users
Old 10/21/2008, 16:40   #2
 
elite*gold: 0
Join Date: Apr 2008
Posts: 470
Received Thanks: 264
Nice Release m8, can i add it to my [All-In-1] Thread?
XxArcherMasterxX is offline  
Old 10/21/2008, 16:41   #3
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by XxArcherMasterxX View Post
Nice Release m8, can i add it to my [All-In-1] Thread?
Sure why not
bisiol is offline  
Thanks
3 Users
Old 10/21/2008, 16:43   #4
 
elite*gold: 0
Join Date: Sep 2008
Posts: 348
Received Thanks: 141
WOw Great Job Guys
!DeX! is offline  
Old 10/21/2008, 16:49   #5
 
$HaDoW's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 285
Received Thanks: 78
OMFG IF THIS WORKS THEN I"M ******* HAPPY
$HaDoW is offline  
Old 10/21/2008, 16:53   #6

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Thanks

//edit lol got around 200 errors xD so i reversed everything...
Kiyono is offline  
Old 10/21/2008, 16:56   #7
 
Eternal46's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 248
Received Thanks: 11
great
Eternal46 is offline  
Old 10/21/2008, 17:22   #8
 
$HaDoW's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 285
Received Thanks: 78
IT WORKS !!!
$HaDoW is offline  
Thanks
1 User
Old 10/21/2008, 17:30   #9
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by Djago160 View Post
Thanks

//edit lol got around 200 errors xD so i reversed everything...
so whats that errors and what source u use?
bisiol is offline  
Old 10/21/2008, 17:41   #10
 
elite*gold: 0
Join Date: Nov 2007
Posts: 35
Received Thanks: 41
Help

Im Getting alot of errors can u add me to msn and then we will talk from there email is and im useing ShadowCo source
jaker63 is offline  
Old 10/21/2008, 17:45   #11
 
elite*gold: 0
Join Date: Dec 2006
Posts: 196
Received Thanks: 35
i use the shadowco source and this are the errors i get, the other people who use shadowco prob get the same errors.

note: error 1, 2 and 3 are the same as 4 till 8.

edit: fixed 9 XD.
Attached Images
File Type: jpg error.JPG (167.9 KB, 169 views)
randomnoob is offline  
Old 10/21/2008, 18:27   #12
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
i think most of problems are here:

public static void SpawnAllMobs()
and
public static void NewRBGuard(short x, short y, short map, uint owner,short glvl)

that must be under Mobs class

like this:
Code:
    public class Mobs
    {
        public static Hashtable AllMobs = new Hashtable();

        public static void SpawnAllMobs()
        {
            try
            {
                int MobsSpawned = 0;
                int MobSpawnsToSpawn = ExternalDatabase.MobSpawns.Length;

                for (int j = 0; j < MobSpawnsToSpawn; j++)
                {
                    uint[] ThisSpawn = ExternalDatabase.MobSpawns[j];
                    string[] ThisMob = null;

                    foreach (string[] FindId in ExternalDatabase.Mobs)
                    {
                        if (FindId[0] == Convert.ToString(ThisSpawn[1]))
                        {
                            ThisMob = FindId;
                        }
                    }

                    for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++)
                    {
                        uint UID = (uint)General.Rand.Next(400000, 500000);
                        short spawn_x = (short)General.Rand.Next((ushort)Math.Min(ThisSpawn[3], ThisSpawn[5]), (ushort)Math.Max(ThisSpawn[3], ThisSpawn[5]));
                        short spawn_y = (short)General.Rand.Next((ushort)Math.Min(ThisSpawn[4], ThisSpawn[6]), (ushort)Math.Max(ThisSpawn[4], ThisSpawn[6]));
                        while (AllMobs.Contains(UID))
                        {
                            UID = (uint)General.Rand.Next(400000, 500000);
                        }
                        SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]),0,true);


                        AllMobs.Add(UID, Mob);

                        MobsSpawned++; ;
                    }
                }
                ExternalDatabase.Mobs = null;
                ExternalDatabase.MobSpawns = null;
                General.WriteLine("Spawned " + MobsSpawned + " mobs.");
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
        public static void NewRBGuard(short x, short y, short map, uint owner,short glvl)
        {
            try
            {
                uint UID = (uint)General.Rand.Next(400000, 500000);
                while (AllMobs.Contains(UID))
                {
                    UID = (uint)General.Rand.Next(400000, 500000);
                }
                int gms=0;
                uint ghp=0;
                short gat=0, glv=0;
                string gna="";
                if (glvl == 0)
                {
                    ghp = 10000;
                    gat = 300;
                    gna = "IronGuard";
                    gms = 920;
                    glv = 60;
                }
                else if (glvl == 1)
                {
                    ghp = 20000;
                    gat = 600;
                    gna = "CopperGuard";
                    gms = 920;
                    glv = 90;
                }
                else if (glvl == 2)
                {
                    ghp = 34895;
                    gat = 900;
                    gna = "SilverGuard";
                    gms = 920;
                    glv = 110;

                }
                else
                {
                    ghp = 60000;
                    gat = 1300;
                    gna = "GoldGuard";
                    gms = 920;
                    glv = 120;

                }
                SingleMob Mob = new SingleMob(x, y, map, ghp, ghp, 150, gat, UID, gna, gms, glv, (byte)General.Rand.Next(8), 7, owner, false);
                AllMobs.Add(UID, Mob);
                Other.Charowner(owner).Guard = Mob;
                World.SpawnMobForPlayers(Mob, true);
                
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
    }
so be sure u did it in right way
bisiol is offline  
Old 10/21/2008, 18:42   #13
 
elite*gold: 0
Join Date: Oct 2008
Posts: 342
Received Thanks: 66
Muhahahaha Thx a lot
µ~Xero~µ is offline  
Old 10/21/2008, 18:50   #14
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
wow, nice release man, i got an warning here:
Code:
                        Target = Target;
                        Target2 = Target2;
is it important? i think no, it just same like 1 = 1

i remove this line.
Code:
                else
                {
                    Target = Target;
                    Target2 = Target2;
                }
this the the error description.
Code:
Assignment made to same variable; did you mean to assign something else?
but it works properly, with some bug, hehe, guard hit the dead monster over and over again, and guard can hit their own self.
pauldexter is offline  
Old 10/21/2008, 19:04   #15
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by pauldexter View Post
wow, nice release man, i got an warning here:
Code:
                        Target = Target;
                        Target2 = Target2;
is it important? i think no, it just same like 1 = 1

i remove this line.
Code:
                else
                {
                    Target = Target;
                    Target2 = Target2;
                }
this the the error description.
Code:
Assignment made to same variable; did you mean to assign something else?
but it works properly, with some bug, hehe, guard hit the dead monster over and over again.
right.
i just forget to delete it

i forget add some stufs with bluename and block you from attack your own guard so i added it to my post
bisiol is offline  
Reply


Similar Threads Similar Threads
[Release]Reviver Guard[5165]
10/02/2010 - CO2 PServer Guides & Releases - 46 Replies
Sup, I have not released anything yet so I will release a reviver guard.... go into Program.cs and find foreach (Hashtable H in Game.World.H_Mobs.Values) { foreach (Mob M in H.Values) {
[RELEASE]Tutorial Game Guard Currupt fixer
04/08/2010 - Soldier Front Philippines - 5 Replies
gameguard corrupted ba ang SF nyo e2 solution 1.dowload sf manual patch ung bago 2.right click the icon of sf in your desktop and press properties the find target 3.sa baba nun main version info right click verinfo and press open with 4.choose notepad 5.mai la2bas na number dun tapos minus 2 ng number na nasa huli tapos un ang ilagay nyo ex. 10046 magi2ng ganto 10044 yan minus 2 nyo lng 6.after dat close nyo na yan tapos mai la2bas na "Do you want to save it"
[Release]5165 code to prohibit Guard attack
02/17/2010 - CO2 PServer Guides & Releases - 28 Replies
hi guys let me share you this simple code that will prohibit players from attacking the guards in most city of CO. i hope this release will be useful. here is the guide: 1. open Attack.cs in PacketHandling. 2. in Attack.cs look for this code public static void Handle(Main.GameClient GC, byte Data)
[Release] Sucrose Game Guard Fixer
08/12/2009 - Soldier Front Hacks, Bots, Cheats & Exploits - 67 Replies
edited by trane.



All times are GMT +2. The time now is 01:01.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.