Beispiel #1
0
        public static bool CanAttack(Game.Entity attacker, SobNpcSpawn attacked, Database.SpellInformation spell)
        {
            if (attacker.MapID == 1038)
            {
                if (attacker.GuildID == 0 || !Game.ConquerStructures.Society.GuildWar.IsWar)
                {
                    if (attacked.UID == 810)
                    {
                        return false;
                    }
                }
                if (Game.ConquerStructures.Society.GuildWar.PoleKeeper != null)
                {
                    if (Game.ConquerStructures.Society.GuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (attacked.UID == 810)
                        {
                            return false;
                        }
                    }
                    else if (attacked.UID == 516075 || attacked.UID == 516074)
                    {
                        if (Game.ConquerStructures.Society.GuildWar.PoleKeeper == attacker.Owner.Guild)
                        {
                            if (attacker.PKMode == Enums.PKMode.Team)
                                return false;
                        }
                    }
                }
            }
            if (attacker.MapID == 1039)
            {
                bool stake = true;
                if (attacked.Name.ToLower().Contains("crow"))
                    stake = false;

                ushort levelbase = (ushort)(attacked.Mesh / 10);
                if (stake)
                    levelbase -= 42;
                else
                    levelbase -= 43;

                byte level = (byte)(20 + (levelbase / 3) * 5);
                if (levelbase == 108 || levelbase == 109)
                    level = 125;
                if (attacker.Level >= level)
                    return true;
                else
                {
                    attacker.AttackPacket = null;
                    attacker.Owner.Send(ServerBase.Constants.DummyLevelTooHigh());
                    return false;
                }
            }
            return true;
        }
Beispiel #2
0
 public Booth(Client.GameState client, Data data)
 {
     Owner = client;
     Owner.Booth = this;
     Owner.Entity.Action = Enums.ConquerAction.Sit;
     ItemList = new SafeDictionary<uint, BoothItem>(20);
     Base = new SobNpcSpawn();
     Base.Owner = Owner;
     Base.UID = (uint)((Owner.Entity.UID % 1000000) + ((Owner.Entity.UID / 1000000) * 100000));
     Base.Mesh = 406;
     Base.Type = Game.Enums.NpcType.Booth;
     Base.ShowName = true;
     Base.Name = Name;
     Base.X = (ushort)(Owner.Entity.X + 1);
     Base.Y = Owner.Entity.Y;
     Owner.SendScreenSpawn(Base, true);
     data.dwParam = Base.UID;
     data.wParam1 = Base.X;
     data.wParam2 = Base.Y;
     data.ID = Data.OwnBooth;
     Owner.Send(data);
 }
Beispiel #3
0
        public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked, Attack attack, uint damage, Database.SpellInformation spell)
        {
            if (attacker.EntityFlag == EntityFlag.Player)
                if (attacker.MapID == 1017)
                {
                    if (attacked.UID == 8684)
                    {
                        if (attacked.Hitpoints == 0 && attacked.MaxHitpoints == 0)

                            attacked.Hitpoints = 0;
                        attacked.MaxHitpoints = 0;

                        attacker.AddFlag2(Update.Flags2.CaryingFlag);

                        //  Game.ConquerStructures.Society.GuildWar.AddScore(damage, attacker.Owner.Guild);
                    }
                }
            if (damage > attacked.Hitpoints)
            {
                if (attacker.MapID == 1039)
                    attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
                if (spell != null)
                    attacker.Owner.IncreaseSpellExperience(Math.Min(damage, attacked.Hitpoints), spell.ID);
            }
            else
            {
                if (attacker.MapID == 1039)
                    attacker.Owner.IncreaseExperience(damage, true);
                if (spell != null)
                    attacker.Owner.IncreaseSpellExperience(damage, spell.ID);
            }
            if (attacker.MapID == 1038)
            {
                if (attacked.UID == 810)
                {
                    if (Game.ConquerStructures.Society.GuildWar.PoleKeeper == attacker.Owner.Guild)
                        return;
                    if (attacked.Hitpoints <= damage)
                        attacked.Hitpoints = 0;
                    Game.ConquerStructures.Society.GuildWar.AddScore(damage, attacker.Owner.Guild);
                }
            }

            if (attack.AttackType == Attack.Magic)
            {
                if (attacked.Hitpoints <= damage)
                {
                    attacked.Die(attacker);
                }
                else
                {
                    attacked.Hitpoints -= damage;
                }
            }
            else
            {
                attacker.Owner.SendScreen(attack, true);
                if (attacked.Hitpoints <= damage)
                {
                    attacked.Die(attacker);
                }
                else
                {
                    attacked.Hitpoints -= damage;
                    attacker.AttackPacket = attack;
                    attacker.AttackStamp = Time32.Now;
                }
            }
        }
Beispiel #4
0
 private static void UpdatePole(SobNpcSpawn pole)
 {
     new Database.MySqlCommand(Conquer_Online_Server.Database.MySqlCommandType.UPDATE)
     .Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
 }
Beispiel #5
0
 public static void Initiate()
 {
     var Map = ServerBase.Kernel.Maps[1038];
     Pole = (SobNpcSpawn)Map.Npcs[810];
     LeftGate = (SobNpcSpawn)Map.Npcs[516074];
     RightGate = (SobNpcSpawn)Map.Npcs[516075];
 }
Beispiel #6
0
 internal static uint Melee(Entity attacker, SobNpcSpawn attackedsob, ref Attack attack)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
        public static uint Ranged(Entity attacker, SobNpcSpawn attacked)
        {
            int Damage = 0;
            Durability(attacker, null, null);
            if (attacker.Transformed)
                return 0;
            if (attacked.UID == 810 && attacker.Owner.Guild != null)
            {
                if (Game.ConquerStructures.Society.GuildWar.PoleKeeper == attacker.Owner.Guild)
                {
                    return 0;
                }
            }
            Damage = ServerBase.Kernel.Random.Next(Math.Min((int)attacker.MinAttack, (int)attacker.MaxAttack), Math.Max((int)attacker.MinAttack, (int)attacker.MaxAttack) + 1);

            if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
            {
                Damage *= 2;

                attacker.OnIntensify = false;
            }

            if (ServerBase.Kernel.Rate(5))
            {
                if (attacker.EntityFlag == EntityFlag.Player)
                {
                    if (attacker.Owner.BlessTime > 0)
                    {
                        Damage *= 2;
                        _String str = new _String(true);
                        str.UID = attacker.UID;
                        str.TextsCount = 1;
                        str.Type = _String.Effect;
                        str.Texts.Add("LuckyGuy");
                        attacker.Owner.SendScreen(str, true);
                    }
                }
            }
            if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Stigma))
                if (!attacker.Transformed)
                    Damage = (int)(Damage * attacker.StigmaIncrease);

            Damage += attacker.PhysicalDamageIncrease;
            if (Damage <= 0)
                Damage = 1;
            return (uint)Damage;
        }
Beispiel #8
0
 public static uint Percent(SobNpcSpawn attacked, float percent)
 {
     return (uint)(attacked.Hitpoints * percent);
 }
Beispiel #9
0
        public static uint Magic(Entity attacker, SobNpcSpawn attacked, Database.SpellInformation spell)
        {
            if (!ServerBase.Kernel.Rate(spell.Percent))
                return 0;
            if (attacked.UID == 810 && attacker.Owner.Guild != null)
            {
                if (Game.ConquerStructures.Society.GuildWar.PoleKeeper == attacker.Owner.Guild)
                {
                    return 0;
                }
            }
            Durability(attacker, null, spell);
            if (attacker.Transformed)
                return 0;
            if (attacker.Name.Contains("Guard"))
                return 700000;
            int Damage = 0;
            Damage = (int)attacker.MagicAttack;
            Damage += spell.Power;
            if (ServerBase.Kernel.Rate(5))
            {
                if (attacker.EntityFlag == EntityFlag.Player)
                {
                    if (attacker.Owner.BlessTime > 0)
                    {
                        Damage *= 2;
                        _String str = new _String(true);
                        str.UID = attacker.UID;
                        str.TextsCount = 1;
                        str.Type = _String.Effect;
                        str.Texts.Add("LuckyGuy");
                        attacker.Owner.SendScreen(str, true);
                    }
                }
            }

            Damage += attacker.MagicDamageIncrease;

            if (Damage <= 0)
                Damage = 1;

            return (uint)Damage;
        }