DarkEmu_GameServer.Systems.RandomType C# (CSharp) Метод

RandomType() публичный статический Метод

public static RandomType ( byte level, byte &Kat, bool party, byte &Agresif ) : byte
level byte
Kat byte
party bool
Agresif byte
Результат byte
        public static byte RandomType(byte level, ref byte Kat, bool party, ref byte Agresif)
        {
            try
            {
                int rnd = Global.RandomID.GetRandom(0, 100);
                if (rnd > 70 && rnd < 89)//champion
                {
                    Kat = 2;
                    Agresif = 1;
                    if (rnd > 30 && rnd < 65) if (party) { Kat = 20; return 17; } //partymob
                    return 1;
                }
                else if (rnd > 90 && level > 14)//giant
                {
                    Kat = 20;
                    Agresif = 1;
                    return 4;
                }
                else if (rnd < 70)//general
                {
                    Kat = 1;
                    if (rnd > 30 && rnd < 65) if (party) return 16; //partymob
                    return 0;
                }
                else if (rnd > 40 && rnd < 55 && level >= 14)//giant
                {
                    Kat = 20;
                    Agresif = 1;
                    if (rnd > 42 && rnd < 49)
                        if (party)
                        {
                            Kat = 210; return 20; //partymob
                        }
                    return 4;
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
            return 0;
        }

Usage Example

Пример #1
0
        private obj getMob(int id, List <string> param)
        {
            short AREA = short.Parse(param[1]);
            float x    = Convert.ToInt32(param[2]);
            float z    = Convert.ToInt32(param[3]);
            float y    = Convert.ToInt32(param[4]);
            obj   o    = new obj();

            o.AutoMovement = true;
            o.LocalType    = Data.ObjectBase[id].Type;
            o.OrgMovement  = o.AutoMovement;
            o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000));
            o.ID       = id;
            o.Ids      = new Global.ID(Global.ID.IDS.Object);
            o.UniqueID = o.Ids.GetUniqueID;

            o.xSec = Convert.ToByte((AREA).ToString("X4").Substring(2, 2), 16);
            o.ySec = Convert.ToByte((AREA).ToString("X4").Substring(0, 2), 16);
            o.x    = (o.xSec - 135) * 192 + (x) / 10;
            o.z    = z;
            o.y    = (o.ySec - 92) * 192 + (y) / 10;

            o.oX = o.x;
            o.oY = o.y;
            Systems.aRound(ref o.oX, ref o.oY, 9);
            o.State      = 1;
            o.Move       = 1;
            o.AutoSpawn  = true;
            o.State      = 2;
            o.HP         = Data.ObjectBase[id].HP;
            o.Kat        = 1;
            o.Agro       = new List <_agro>();
            o.SpeedWalk  = Data.ObjectBase[o.ID].SpeedWalk;
            o.SpeedRun   = Data.ObjectBase[o.ID].SpeedRun;
            o.SpeedZerk  = Data.ObjectBase[o.ID].SpeedZerk;
            o.oldAgresif = o.Agresif;
            if (o.Type == 1)
            {
                o.Agresif = 1;
            }
            //if (o.Type == 0) o.Agresif = 0;
            o.spawnOran = 20;
            if (id == 1979 || id == 2101 || id == 2124 || id == 2111 || id == 2112)
            {
                o.AutoMovement = false;
            }
            o.OrgMovement = o.AutoMovement;

            if (o.AutoMovement)
            {
                o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000));
            }
            o.Type = Systems.RandomType(Data.ObjectBase[id].Level, ref o.Kat, false, ref o.Agresif);
            o.HP  *= o.Kat;
            if (o.Type == 1)
            {
                o.Agresif = 1;
            }
            return(o);
        }
Systems