قديم 2020-04-20, 06:29 PM
المشاركة 2
ElSaher
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
المشكلة في كلاس اسكرين

قديم 2020-04-20, 09:48 PM
المشاركة 3
AliNasser
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
دورت في سكرين كلو مش عارف المشكله منين


كود:
using System;
using System.Linq;
using MohamedAyman.Client;
using System.Threading;
using System.Diagnostics;
using MohamedAyman.Interfaces;
using System.Threading.Generic;
using System.Collections.Generic;
using MohamedAyman.Network.GamePackets;
using System.Collections.Concurrent;
using MohamedAyman.Poker.Structures;

namespace 
MohamedAyman.Game
{
    public 
unsafe class Screen
    
{
        private static 
TimerRule<GameStateMonsterBuffersGuardsAliveMonstersItemsFloorSpells;
        public static 
void CreateTimerFactories()
        {
            
MonsterBuffers = new TimerRule<GameState>(monsterBuffersCallback500);
            
Guards = new TimerRule<GameState>(guardsCallback700);
            
AliveMonsters = new TimerRule<GameState>(aliveMonstersCallback500);
            
Items = new TimerRule<GameState>(itemsCallback1000);
            
FloorSpells = new TimerRule<GameState>(FloorSpellsCallBack100);
        }
        private static 
void FloorSpellsCallBack(GameState clientint time)
        {
            if (!
client.Socket.Alive)
            {
                
client.Screen.DisposeTimers();
                return;
            }
            if (
client.Entity == null) return;
            if (
client.Map == null) return;
            
Time32 Now = new Time32(time);
            if (
client.Entity.FloorSpells.Count != 0)
            {
                foreach (var 
ID in client.Entity.FloorSpells)
                {
                    switch (
ID.Key)
                    {

                        
#region Habilidad AuroraLotus
                        
case 12370://AuroraLouts:
                            
{
                                var 
spellclient ID.Value;
                                
Queue<Game.Attacking.FloorSpellRemoveSpells = new Queue<Game.Attacking.FloorSpell>();
                                foreach (var 
spell in spellclient.Spells)
                                {
                                    if (
spellclient.CheckInvocke(Nowspell))
                                    {
                                        
RemoveSpells.Enqueue(spell);
                                        
spellclient.CreateMsgSpell(100);
                                        var 
attack = new Attack(true);
                                        
attack.Attacker client.Entity.UID;
                                        
attack.AttackType Attack.Melee;
                                        foreach (
Interfaces.IMapObject _obj in client.Screen.Objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.MapObjType == MapObjectType.Player)
                                            {
                                                var 
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(spell.FloorPacket.Xspell.FloorPacket.Yattacked.Xattacked.Y) <= 15)
                                                {
                                                    
attacked.BringToLifeLotus();

                                                }
                                            }
                                        }
                                        
spellclient.SendView(client);

                                        
spell.FloorPacket.Type FloorItem.RemoveEffect;
                                        
client.SendScreen(spell.FloorPackettrue);
                                    }
                                }
                                while (
RemoveSpells.Count 0)
                                    
spellclient.RemoveItem(RemoveSpells.Dequeue());
                                if (
spellclient.Spells.Count == 0)
                                {
                                    
Game.Attacking.FloorSpell.ClientFloorSpells FloorSpell;
                                    
client.Entity.FloorSpells.TryRemove(spellclient.DBSkill.IDout FloorSpell);
                                }
                                break;
                            }
                        
#endregion

                        #region Habilidad FlameLotus
                        
case 12380://FlameLouts:
                            
{
                                var 
spellclient ID.Value;
                                
Queue<Game.Attacking.FloorSpellRemoveSpells = new Queue<Game.Attacking.FloorSpell>();
                                foreach (var 
spell in spellclient.Spells)
                                {
                                    if (
spellclient.CheckInvocke(Nowspell))
                                    {
                                        
RemoveSpells.Enqueue(spell);
                                        
spellclient.CreateMsgSpell(100);
                                        var 
attack = new Attack(true);
                                        
attack.Attacker client.Entity.UID;
                                        
attack.AttackType Attack.Melee;
                                        foreach (
Interfaces.IMapObject _obj in client.Screen.Objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.MapObjType == MapObjectType.Monster)
                                            {
                                                var 
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(spell.FloorPacket.Xspell.FloorPacket.Yattacked.Xattacked.Y) <= 15)
                                                {
                                                    if (!
Game.Attacking.Handle.CanAttack(client.Entityattackedspell.DBSkillfalse)) continue;
                                                    
attack.Effect Attack.AttackEffects.None;
                                                    
uint damage Game.Attacking.Calculate.Magic(client.Entityattackedspell.DBSkillref attack);
                                                    
attack.Damage damage 2;
                                                    
#region Ataque Montruos & Boss
                                                    /*   if (attacked.EntityFlag == EntityFlag.Boss)
                                                    {
                                                        damage = 1;
                                                    }*/
                                                    
if (attacked.EntityFlag == EntityFlag.Monster)
                                                    {
                                                        
damage = (damage 3);
                                                    }
                                                    
#endregion
                                                    
spellclient.SpellPacket.Effect attack.Effect;
                                                    
Game.Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell.DBSkill);
                                                    
spellclient.SpellPacket.AddTarget(attacked.UIDdamageattack);
                                                }
                                            }
                                            if (
_obj.MapObjType == MapObjectType.Player)
                                            {
                                                var 
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(spell.FloorPacket.Xspell.FloorPacket.Yattacked.Xattacked.Y) <= 15)
                                                {
                                                    if (!
Game.Attacking.Handle.CanAttack(client.Entityattackedspell.DBSkillfalse)) continue;
                                                    
attack.Effect Attack.AttackEffects.None;
                                                    
uint damage Game.Attacking.Calculate.Magic(client.Entityattacked,spell.DBSkillref attack);
                                                    
attack.Damage damage 2;
                                                    
spellclient.SpellPacket.Effect attack.Effect;
                                                    
Game.Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell.DBSkill);
                                                    
spellclient.SpellPacket.AddTarget(attacked.UIDdamageattack);
                                                }
                                            }
                                        }
                                        
spellclient.SendView(client);

                                        
spell.FloorPacket.Type FloorItem.RemoveEffect;
                                        
client.SendScreen(spell.FloorPackettrue);
                                    }
                                }
                                while (
RemoveSpells.Count 0)
                                    
spellclient.RemoveItem(RemoveSpells.Dequeue());
                                if (
spellclient.Spells.Count == 0)
                                {
                                    
Game.Attacking.FloorSpell.ClientFloorSpells FloorSpell;
                                    
client.Entity.FloorSpells.TryRemove(spellclient.DBSkill.IDout FloorSpell);
                                }
                                break;
                            }
                        
#endregion

                    
}
                }
            }
            foreach (var 
Cloud in client.Map.Clouds.Values)
            {
                if (
Cloud == null) continue;
                if (
Kernel.GetDistance(Cloud.XCloud.Yclient.Entity.Xclient.Entity.Y) > 16) continue;
                if (
DateTime.Now Cloud.EndTime || Cloud.Owner == null)
                {
                    
Cloud.DisposeCloud(client);
                    return;
                }
                
#region ThunderCloud
                
if (!Cloud.Dead && Time32.Now Cloud.LastCloudAttack.AddSeconds(1))
                {
                    var 
spell Database.SpellTable.GetSpell(12970client);
                    
SpellUse suse = new SpellUse(true);
                    
////suse.Attacker = client.Player.Cloud.UID;
                    
suse.SpellID 13190;
                    
suse.SpellLevel 0;
                    
suse.client.Entity.Cloud.X;
                    
suse.client.Entity.Cloud.Y;
                    
Entity attacked null;
                    foreach (
Interfaces.IMapObject _obj in client.Screen.Objects)
                    {
                        if (
_obj == null) continue;
                        if (
_obj.MapObjType == MapObjectType.Monster )
                        {
                            
Cloud.LastCloudAttack Time32.Now;
                            
attacked _obj as Entity;
                            if (
Kernel.GetDistance(Cloud.XCloud.Yattacked.Xattacked.Y) <= 15)
                            {
                                
Attack attack = new Attack(true);
                                if (
Game.Attacking.Handle.CanAttack(Cloud.Owner.Entityattackedspellattack.AttackType == Attack.Melee))
                                {
                                    
attack.Effect Attack.AttackEffects.None;
                                    
uint damage Game.Attacking.Calculate.Melee(Cloud.Owner.Entityattackedspellref attack);
                                    if (
Cloud.ThunderBolt)
                                        
damage += Game.Attacking.Calculate.Melee(Cloud.Owner.EntityattackedDatabase.SpellTable.GetSpell(12970client), ref attack);
                                    
suse.Effect attack.Effect;
                                    
Game.Attacking.Handle.ReceiveAttack(Cloud.Owner.Entityattackedattackref damagespell);
                                    
suse.AddTarget(attacked.UIDdamageattack);
                                    break;
                                }
                            }
                        }
                        if (
_obj == null) continue;
                        if (
_obj.MapObjType == MapObjectType.Player)
                        {
                            
Cloud.LastCloudAttack Time32.Now;
                            
attacked _obj as Entity;
                            if (
Kernel.GetDistance(Cloud.XCloud.Yattacked.Xattacked.Y) <= 15)
                            {
                                
Attack attack = new Attack(true);
                                if (
Game.Attacking.Handle.CanAttack(Cloud.Owner.Entityattackedspellattack.AttackType == Attack.Melee))
                                {
                                    
attack.Effect Attack.AttackEffects.None;
                                    
uint damage Game.Attacking.Calculate.Melee(Cloud.Owner.Entityattackedspellref attack)/5;
                                    
damage = (uint)(damage 1.3);
                                    if (
Cloud.ThunderBolt)
                                        
damage += Game.Attacking.Calculate.Melee(Cloud.Owner.EntityattackedDatabase.SpellTable.GetSpell(12970client), ref attack)/5;                                    
                                    
suse.Effect attack.Effect;
                                    
Game.Attacking.Handle.ReceiveAttack(Cloud.Owner.Entityattackedattackref damagespell);
                                    
suse.AddTarget(attacked.UIDdamageattack);
                                    break;
                                }
                            }
                        }
                    }
                    
client.SendScreen(susetrue);
                }
                
#endregion
            
}
        }
        private static 
ConcurrentDictionary<uintNetwork.GamePackets.FloorItemFloorItems;
        private static 
void monsterBuffersCallback(GameState clientint time)
        {
            if (!
client.Socket.Alive)
            {
                
client.Screen.DisposeTimers(); return;
            }
            if (
client.Entity == null) return;
            if (
client.Map == null) return;
            if (
client.Map.FreezeMonsters) return;
            
#region Stamina
            
if (client.Entity.StaminaStamp.Next(500timetime))
            {
                if (
client.Vigor client.MaxVigor)
                {
                    
ushort amount = (ushort)(+ (client.Entity.Action == Game.Enums.ConquerAction.Sit 0));
                    if (
client.Vigor amount client.MaxVigor)
                    {
                        
amount client.MaxVigor;
                        
client.Vigor amount;
                    }
                    else
                    {
                        
client.Vigor += amount;
                    }
                    
Vigor vigor = new Vigor(true);
                    
vigor.Amount client.Vigor;
                    
vigor.Send(client);
                }
                if (
client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.FrostArrows))
                    return;
                if (!
client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Ride) && !client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Fly) || client.Equipment.TryGetItem(18) != null)
                {
                    
int limit 0;
                    if (
client.Entity.HeavenBlessing 0)
                        
limit 60;
                    if (
client.Entity.Stamina != 100 limit)
                    {
                        if (
client.Entity.Action == Enums.ConquerAction.Sit)
                        {
                            if (
client.Entity.Stamina <= 90 limit)
                            {
                                
client.Entity.Stamina += 10;
                            }
                            else
                            {
                                if (
client.Entity.Stamina != 100 limit)
                                    
client.Entity.Stamina = (byte)(100 limit);
                            }
                        }
                        else
                        {
                            if (
client.Entity.Stamina <= 95 limit)
                            {
                                
client.Entity.Stamina += 90;
                            }
                            else
                            {
                                if (
client.Entity.Stamina != 100 limit)
                                    
client.Entity.Stamina = (byte)(100 limit);
                            }
                        }
                    }
                    
client.Entity.StaminaStamp = new Time32(time);
                }
            }
            
#endregion
            #region Flooritems
            
foreach (var f in Database.FloorItemTable.FloorItems)
            {
                if (
== null) continue;
                if (
Kernel.GetDistance(f.Xf.Yclient.Entity.Xclient.Entity.Y) <= Constants.pScreenDistance)
                {
                    if (
f.MapID == client.Entity.MapID)
                    {
                        if (!
FloorItems.ContainsKey(f.UID))
                        {
                            
FloorItems.Add(f.UIDf);
                            
f.Send(client);
                        }
                    }
                    else { 
FloorItems.Remove(f.UID); }
                }
                else { 
FloorItems.Remove(f.UID); }
            }
            
#endregion
            #region Energia Epica Taoista Agua/Fuego
            
if (Database.DataHolder.IsTaoist(client.Entity.Class))
            {
                var 
Date DateTime.Now;
                if (
client.Entity.LastGetEnergy.AddSeconds(1) <= Date)
                {
                    if (
client.Entity.EpicTaoist())
                    {
                        if (
client.Entity.Class >= 130 && client.Entity.Class <= 135)
                        {
                            if (
220 client.Entity.Energy)
                            {
                                
client.Entity.Energy += 4;
                            }
                        }
                        else
                        {
                            if (
client.Entity.Energy 330)
                            {
                                
client.Entity.Energy += 7;
                            }
                        }
                        
client.Entity.LastGetEnergy Date;
                    }
                    else
                    {
                        if (
client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.AuroraLotus))
                        {
                            
client.Entity.RemoveFlag((ulong)FlagsUpdate.Flags.AuroraLotus);
                        }
                        if (
client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.FlameLotus))
                        {
                            
client.Entity.RemoveFlag((ulong)FlagsUpdate.Flags.FlameLotus);
                        }
                        if (
client.Entity.Energy 0)
                        {
                            
client.Entity.Energy 0;
                        }
                    }
                }
            }
            
#endregion
            #region Sistema AutoCps Libres
            
if (Time32.Now client.CpsStamp.AddSeconds(3))
            {
                if (
client.Entity.MapID == 19989)
                {
                    if (
client.Entity.Hitpoints != 0)
                    {
                        if (
client.Entity.BoundCps <= 2000000000)
                        {
                            
client.Entity.BoundCps += 2;
                            
client.CpsStamp Time32.Now;
                            
client.Send(new Message("Ha obtenido 2 Cps por estar aqui!."System.Drawing.Color.RedMessage.TopLeft));
                        }
                        else
                        {
                            
client.Send(new Message("Ya tienes 2.000.000.000 Cps, no puedes obtener más!."System.Drawing.Color.RedMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            
foreach (IMapObject obj in client.Screen.Objects)
            {
                if (
obj != null)
                {
                    if (
obj.MapObjType == MapObjectType.Monster)
                    {
                        
Entity monster obj as Entity;
                        if (
monster == null) continue;

                        if (
monster.ContainsFlag((ulong)FlagsUpdate.Flags.Stigma))
                        {
                            if (
monster.StigmaStamp.AddSeconds(monster.StigmaTime).Next(timetime) || monster.Dead)
                            {
                                
monster.StigmaTime 0;
                                
monster.StigmaIncrease 0;
                                
monster.RemoveFlag((ulong)FlagsUpdate.Flags.Stigma);
                            }
                        }
                        if (
monster.ContainsFlag((ulong)FlagsUpdate.Flags.Dodge))
                        {
                            if (
monster.DodgeStamp.AddSeconds(monster.DodgeTime).Next(timetime) || monster.Dead)
                            {
                                
monster.DodgeTime 0;
                                
monster.DodgeIncrease 0;
                                
monster.RemoveFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.Dodge);
                            }
                        }
                        if (
monster.ContainsFlag((ulong)FlagsUpdate.Flags.Invisibility))
                        {
                            if (
monster.InvisibilityStamp.AddSeconds(monster.InvisibilityTime).Next(timetime) || monster.Dead)
                            {
                                
monster.RemoveFlag((ulong)FlagsUpdate.Flags.Invisibility);
                            }
                        }
                        if (
monster.ContainsFlag((ulong)FlagsUpdate.Flags.StarOfAccuracy))
                        {
                            if (
monster.StarOfAccuracyTime != 0)
                            {
                                if (
monster.StarOfAccuracyStamp.AddSeconds(monster.StarOfAccuracyTime).Next(timetime) || monster.Dead)
                                {
                                    
monster.RemoveFlag((ulong)FlagsUpdate.Flags.StarOfAccuracy);
                                }
                            }
                            else
                            {
                                if (
monster.AccuracyStamp.AddSeconds(monster.AccuracyTime).Next(timetime) || monster.Dead)
                                {
                                    
monster.RemoveFlag((ulong)FlagsUpdate.Flags.StarOfAccuracy);
                                }
                            }
                        }
                        if (
monster.ContainsFlag((ulong)FlagsUpdate.Flags.MagicShield))
                        {
                            if (
monster.MagicShieldTime != 0)
                            {
                                if (
monster.MagicShieldStamp.AddSeconds(monster.MagicShieldTime).Next(timetime) || monster.Dead)
                                {
                                    
monster.MagicShieldIncrease 0;
                                    
monster.MagicShieldTime 0;
                                    
monster.RemoveFlag((ulong)FlagsUpdate.Flags.MagicShield);
                                }
                            }
                            else
                            {
                                if (
monster.ShieldStamp.AddSeconds(monster.ShieldTime).Next(timetime) || monster.Dead)
                                {
                                    
monster.ShieldIncrease 0;
                                    
monster.ShieldTime 0;
                                    
monster.RemoveFlag((ulong)FlagsUpdate.Flags.MagicShield);
                                }
                            }
                        }
                        if (
monster.Dead || monster.Killed)
                        {
                            if (!
monster.ContainsFlag((ulong)FlagsUpdate.Flags.Ghost) || monster.Killed)
                            {
                                
monster.Killed false;
                                
monster.MonsterInfo.InSight 0;
                                
monster.AddFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.Ghost,StatusFlagsBigVector32.PermanentFlag,false);
                                
monster.AddFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.DeadStatusFlagsBigVector32.PermanentFlagfalse);
                                
monster.AddFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.FadeAwayStatusFlagsBigVector32.PermanentFlagfalse);
                                
Network.GamePackets.Attack attack = new Network.GamePackets.Attack(true);
                                
attack.Attacker monster.Killer.UID;
                                
attack.Attacked monster.UID;
                                
attack.AttackType Network.GamePackets.Attack.Kill;
                                
attack.monster.X;
                                
attack.monster.Y;
                                
client.Map.Floor[monster.Xmonster.YMapObjectType.Monstermonster] = true;
                                
attack.KOCount = ++monster.Killer.KOCount;
                                if (
monster.Killer.EntityFlag == EntityFlag.Player)
                                {
                                    
monster.MonsterInfo.ExcludeFromSend monster.Killer.UID;
                                    
monster.Killer.Owner.Send(attack);
                                }
                                
monster.MonsterInfo.SendScreen(attack);
                                
monster.MonsterInfo.ExcludeFromSend 0;
                            }
                            if (
monster.DeathStamp.AddSeconds(4).Next(timetime))
                            {
                                
Data data = new Data(true);
                                
data.UID monster.UID;
                                
data.ID Network.GamePackets.Data.RemoveEntity;
                                
monster.MonsterInfo.SendScreen(data);
                            }
                        }
                    }
                }
            }
        }
        private static 
void guardsCallback(GameState clientint time)
        {
            if (!
client.Socket.Alive)
            {
                
client.Screen.DisposeTimers(); return;
            }
            if (
client.Entity == null) return;
            if (
client.Map == null) return;
            if (
client.Map.FreezeMonsters) return;
            
Time32 Now = new Time32(time);
            foreach (
IMapObject obj in client.Screen.Objects)
            {
                if (
obj != null)
                {
                    if (
obj.MapObjType == MapObjectType.Monster)
                    {
                        
Entity monster obj as Entity;
                        if (!
monster.Companion && !monster.Dead && !monster.Killed && monster.MonsterInfo.Guard && !monster.MonsterInfo.Boss && monster.Name != "NemesisTirano" && monster.Name != "SwordMaster" && monster.Name != "ThrillingSpook" && monster.Name != "LavaBeast" && monster.Name != "SnowBanshee" && monster.Name != "PurpleBanshee" && monster.Name != "SnowBansheeSoul" && monster.Name != "TeratoDragon" && Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MinimumSpeed))
                        {
                            if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MinimumSpeed))
                            {
                                if (
monster.MonsterInfo.InSight == 0)
                                {
                                    if (
monster.!= monster.MonsterInfo.BoundX || monster.!= monster.MonsterInfo.BoundY)
                                    {
                                        
monster.monster.MonsterInfo.BoundX;
                                        
monster.monster.MonsterInfo.BoundY;
                                        
TwoMovements jump = new TwoMovements();
                                        
jump.monster.MonsterInfo.BoundX;
                                        
jump.monster.MonsterInfo.BoundY;
                                        
jump.EntityCount 1;
                                        
jump.FirstEntity monster.UID;
                                        
jump.MovementType TwoMovements.Jump;
                                        
client.SendScreen(jumptrue);
                                    }
                                    if (
client.Entity.ContainsFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.FlashingName))
                                        
monster.MonsterInfo.InSight client.Entity.UID;
                                }
                                else
                                {
                                    if (
client.Entity.ContainsFlag((ulong)Network.GamePackets.FlagsUpdate.Flags.FlashingName))
                                    {
                                        if (
monster.MonsterInfo.InSight == client.Entity.UID)
                                        {
                                            if (!
client.Entity.Dead)
                                            {
                                                if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed))
                                                {
                                                    
short distance Kernel.GetDistance(monster.Xmonster.Yclient.Entity.Xclient.Entity.Y);

                                                    if (
distance <= monster.MonsterInfo.AttackRange)
                                                    {
                                                        
monster.MonsterInfo.LastMove Time32.Now;
                                                        new 
Game.Attacking.Handle(nullmonsterclient.Entity);
                                                    }
                                                    else
                                                    {
                                                        if (
distance <= monster.MonsterInfo.ViewRange)
                                                        {
                                                            
TwoMovements jump = new TwoMovements();
                                                            
jump.client.Entity.X;
                                                            
jump.client.Entity.Y;
                                                            
monster.client.Entity.X;
                                                            
monster.client.Entity.Y;
                                                            
jump.EntityCount 1;
                                                            
jump.FirstEntity monster.UID;
                                                            
jump.MovementType TwoMovements.Jump;
                                                            
client.SendScreen(jumptrue);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (
monster.MonsterInfo.InSight == client.Entity.UID)
                                        {
                                            
monster.MonsterInfo.InSight 0;
                                        }
                                    }
                                }

                                foreach (
IMapObject obj2 in client.Screen.Objects)
                                {
                                    if (
obj2 == null) continue;
                                    if (
obj2.MapObjType == MapObjectType.Monster)
                                    {
                                        
Entity monster2 obj2 as Entity;

                                        if (
monster2 == null) continue;
                                        if (
monster2.Dead) continue;

                                        if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed))
                                        {
                                            if (!
monster2.MonsterInfo.Guard && (!monster2.Companion || monster2.Owner.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.FlashingName)))
                                            {
                                                
short distance Kernel.GetDistance(monster.Xmonster.Ymonster2.Xmonster2.Y);

                                                if (
distance <= monster.MonsterInfo.AttackRange)
                                                {
                                                    
monster.MonsterInfo.LastMove Time32.Now;
                                                    new 
Game.Attacking.Handle(nullmonstermonster2);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private static 
void aliveMonstersCallback(GameState clientint time)
        {
            if (!
client.Socket.Alive)
            {
                
client.Screen.DisposeTimers();
                return;
            }
            if (
client.Entity == null) return;
            if (
client.Map == null) return;
            if (
client.Map.FreezeMonsters) return;
            
Time32 Now = new Time32(time);
            foreach (
IMapObject obj in client.Screen.Objects)
            {
                if (
obj != null)
                {
                    if (
obj.MapObjType == MapObjectType.Monster)
                    {
                        
Entity monster obj as Entity;
                        if (
monster == null) continue;
                        if (
monster.MonsterInfo.Guard || monster.Companion || monster.Dead) continue;
                        if (
monster.MonsterInfo.Reviver)
                        {
                            if (
client.Entity.Dead && Now client.Entity.DeathStamp.AddSeconds(5))
                            {
                                
client.Entity.BringToLife();
                                
SpellUse use = new SpellUse(true);
                                use.
Attacker monster.UID;
                                use.
client.Entity.X;
                                use.
client.Entity.Y;
                                use.
SpellID 1100;
                                use.
AddTarget(client.Entity.UID0null);
                                
Kernel.SendWorldMessage(use, Server.GamePoolmonster.MapID);
                            }
                            return;
                        }
                        
short distance Kernel.GetDistance(monster.Xmonster.Yclient.Entity.Xclient.Entity.Y);
                        if (
distance Constants.pScreenDistance)
                        {
                            
client.Screen.Remove(obj);
                            continue;
                        }
                        if (
monster.MonsterInfo.InSight != && monster.MonsterInfo.InSight != client.Entity.UID)
                        {
                            if (
monster.MonsterInfo.InSight 1000000)
                            {
                                
GameState cl;
                                if (
Kernel.GamePool.TryGetValue(monster.MonsterInfo.InSightout cl))
                                {
                                    
short dst Kernel.GetDistance(monster.Xmonster.Ycl.Entity.Xcl.Entity.Y);
                                    if (
dst Constants.pScreenDistance)
                                        
monster.MonsterInfo.InSight 0;
                                }
                                else
                                    
monster.MonsterInfo.InSight 0;
                            }
                            else
                            {
                                
Entity companion client.Map.Companions[monster.MonsterInfo.InSight];
                                if (
companion != null)
                                {
                                    
short dst Kernel.GetDistance(monster.Xmonster.Ycompanion.Xcompanion.Y);
                                    if (
dst Constants.pScreenDistance)
                                        
monster.MonsterInfo.InSight 0;
                                }
                                else
                                    
monster.MonsterInfo.InSight 0;
                            }
                        }
                        if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MinimumSpeed))
                        {
                            if (
distance <= Constants.pScreenDistance)
                            {
                                
#region Companions
                                
if (client.Pet != null)
                                {
                                    if (
client.Pet.Pets != null)
                                    {
                                        foreach (var 
pet in client.Pet.Pets.Values)
                                        {
                                            if (
pet != null)
                                            {
                                                
#region Pets
                                                
if (pet.Entity.Companion && !pet.Entity.Dead)
                                                {
                                                    
short distance2 Kernel.GetDistance(monster.Xmonster.Ypet.Entity.Xpet.Entity.Y);
                                                    if (
distance distance2 || client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Invisibility) || client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Fly))
                                                    {
                                                        if (
monster.MonsterInfo.InSight == 0)
                                                        {
                                                            
monster.MonsterInfo.InSight pet.Entity.UID;
                                                        }
                                                        else
                                                        {
                                                            if (
monster.MonsterInfo.InSight == pet.Entity.UID)
                                                            {
                                                                if (
distance2 Constants.pScreenDistance)
                                                                {
                                                                    
monster.MonsterInfo.InSight 0;
                                                                }
                                                                else
                                                                {
                                                                    if (
distance2 <= monster.MonsterInfo.AttackRange)
                                                                    {
                                                                        if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed))
                                                                        {
                                                                            
monster.MonsterInfo.LastMove Time32.Now;
                                                                            new 
Game.Attacking.Handle(nullmonsterpet.Entity);
                                                                            if (
Time32.Now >= monster.MonsterInfo.Lastpop.AddSeconds(30))
                                                                            {
                                                                                
monster.MonsterInfo.Lastpop Time32.Now;

                                                                                continue;
                                                                            }
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (
distance2 monster.MonsterInfo.ViewRange 2)
                                                                        {
                                                                            if (
distance2 Constants.pScreenDistance)
                                                                            {
                                                                                if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed))
                                                                                {
                                                                                    
monster.MonsterInfo.LastMove Time32.Now;

                                                                                    
Enums.ConquerAngle facing Kernel.GetAngle(monster.Xmonster.Ypet.Entity.Xpet.Entity.Y);
                                                                                    if (!
monster.Move(facing))
                                                                                    {
                                                                                        
facing = (Enums.ConquerAngle)Kernel.Random.Next(7);
                                                                                        if (
monster.Move(facing))
                                                                                        {
                                                                                            
monster.Facing facing;
                                                                                            
GroundMovement move = new GroundMovement(true);
                                                                                            
move.Direction facing;
                                                                                            
move.UID monster.UID;
                                                                                            
move.GroundMovementType GroundMovement.Run;
                                                                                            
monster.MonsterInfo.SendScreen(move);
                                                                                            continue;
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        
monster.Facing facing;
                                                                                        
GroundMovement move = new GroundMovement(true);
                                                                                        
move.Direction facing;
                                                                                        
move.UID monster.UID;
                                                                                        
move.GroundMovementType GroundMovement.Run;
                                                                                        
monster.MonsterInfo.SendScreen(move);
                                                                                        continue;
                                                                                    }
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                
monster.MonsterInfo.InSight 0;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed))
                                                                            {
                                                                                
monster.MonsterInfo.LastMove Time32.Now;
                                                                                
Enums.ConquerAngle facing Kernel.GetAngle(monster.Xmonster.Ypet.Entity.Xpet.Entity.Y);
                                                                                if (!
monster.Move(facing))
                                                                                {
                                                                                    
facing = (Enums.ConquerAngle)Kernel.Random.Next(7);
                                                                                    if (
monster.Move(facing))
                                                                                    {
                                                                                        
monster.Facing facing;
                                                                                        
GroundMovement move = new GroundMovement(true);
                                                                                        
move.Direction facing;
                                                                                        
move.UID monster.UID;
                                                                                        
monster.MonsterInfo.SendScreen(move);
                                                                                        continue;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    
monster.Facing facing;
                                                                                    
GroundMovement move = new GroundMovement(true);
                                                                                    
move.Direction facing;
                                                                                    
move.UID monster.UID;
                                                                                    
monster.MonsterInfo.SendScreen(move);
                                                                                    continue;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                
#endregion
                                            
}

                                        }
                                    }
                                }
                                
#endregion
                                #region Player
                                
if (monster.MonsterInfo.InSight == 0)
                                {
                                    if (
distance <= monster.MonsterInfo.ViewRange)
                                    {
                                        if (!
client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Invisibility))
                                        {
                                            if (
monster.MonsterInfo.SpellID != || !client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Fly))
                                            {
                                                
monster.MonsterInfo.InSight client.Entity.UID;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (
monster.MonsterInfo.InSight == client.Entity.UID)
                                    {
                                        if (
monster.MonsterInfo.SpellID == && client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Fly))
                                        {
                                            
monster.MonsterInfo.InSight 0;
                                            return;
                                        }

                                        if (
client.Entity.Dead)
                                        {
                                            
monster.MonsterInfo.InSight 0;
                                            return;
                                        }
                                        if (
distance Constants.pScreenDistance)
                                        {
                                            
monster.MonsterInfo.InSight 0;
                                        }
                                        else
                                        {
                                            if (
distance <= monster.MonsterInfo.AttackRange)
                                            {
                                                if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed))
                                                {
                                                    
monster.MonsterInfo.LastMove Time32.Now;
                                                    new 
Game.Attacking.Handle(nullmonsterclient.Entity);
                                                }
                                            }
                                            else
                                            {
                                                if (
distance monster.MonsterInfo.ViewRange 2)
                                                {
                                                    if (
distance Constants.pScreenDistance)
                                                    {
                                                        if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed))
                                                        {
                                                            
monster.MonsterInfo.LastMove Time32.Now;

                                                            
Enums.ConquerAngle facing Kernel.GetAngle(monster.Xmonster.Yclient.Entity.Xclient.Entity.Y);
                                                            if (!
monster.Move(facing))
                                                            {
                                                                
facing = (Enums.ConquerAngle)Kernel.Random.Next(7);
                                                                if (
monster.Move(facing))
                                                                {
                                                                    
monster.Facing facing;
                                                                    
GroundMovement move = new GroundMovement(true);
                                                                    
move.Direction facing;
                                                                    
move.UID monster.UID;
                                                                    
move.GroundMovementType Network.GamePackets.GroundMovement.Run;
                                                                    
monster.MonsterInfo.SendScreen(move);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                
monster.Facing facing;
                                                                
GroundMovement move = new GroundMovement(true);
                                                                
move.Direction facing;
                                                                
move.UID monster.UID;
                                                                
move.GroundMovementType Network.GamePackets.GroundMovement.Run;
                                                                
monster.MonsterInfo.SendScreen(move);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        
monster.MonsterInfo.InSight 0;
                                                    }
                                                }
                                                else
                                                {
                                                    if (
Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed))
                                                    {
                                                        
monster.MonsterInfo.LastMove Time32.Now;
                                                        
Enums.ConquerAngle facing Kernel.GetAngle(monster.Xmonster.Yclient.Entity.Xclient.Entity.Y);
                                                        if (!
monster.Move(facing))
                                                        {
                                                            
facing = (Enums.ConquerAngle)Kernel.Random.Next(7);
                                                            if (
monster.Move(facing))
                                                            {
                                                                
monster.Facing facing;
                                                                
GroundMovement move = new GroundMovement(true);
                                                                
move.Direction facing;
                                                                
move.UID monster.UID;
                                                                
monster.MonsterInfo.SendScreen(move);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            
monster.Facing facing;
                                                            
GroundMovement move = new GroundMovement(true);
                                                            
move.Direction facing;
                                                            
move.UID monster.UID;
                                                            
monster.MonsterInfo.SendScreen(move);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                
#endregion
                            
}
                        }
                    }
                    else if (
obj.MapObjType == MapObjectType.Item)
                    {
                        
FloorItem item obj as FloorItem;
                        if (
item == null) continue;

                        if (
item.Type == FloorItem.Effect)
                        {
                            
#region RageOfWar
                            
if (item.ItemID == FloorItem.RageOfWarTrap)
                            {
                                if (
item.Owner == client)
                                {
                                    if (
item.OnFloor.AddSeconds(2).Next(timetime))
                                    {
                                        var 
spell Database.SpellTable.GetSpell(12930client);
                                        if (
spell == null) return;
                                        var 
attack = new Attack(true);
                                        
attack.Attacker client.Entity.UID;
                                        
attack.AttackType Attack.Melee;

                                        foreach (var 
obj1 in client.Screen.Objects)
                                        {
                                            if (
obj1 == null)
                                                continue;
                                            var 
attacked obj1 as Entity;
                                            if (
attacked == null) continue;
                                            if (
Kernel.GetDistance(obj1.Xobj1.Yobj.Xobj.Y) <= 3)
                                            {
                                                if (
Attacking.Handle.CanAttack(client.Entityattackedspellattack.AttackType == Attack.Melee))
                                                {
                                                    
Attacking.Handle.RageOfWarTrap(item);

                                                }

                                            }
                                        }
                                    }
                                }
                            }
                            
#endregion
                            
if (item.ItemID == FloorItem.DaggerStorm || item.ItemID == FloorItem.FuryofEgg || item.ItemID == FloorItem.ShacklingIce || item.ItemID == 31)
                            {
                                if (
item.Owner == client)
                                {
                                    if (
Time32.Now item.UseTime.AddSeconds(1))
                                    {
                                        
item.UseTime Time32.Now;
                                        var 
spell Database.SpellTable.GetSpell(11600client);
                                        var 
attack = new Attack(true);
                                        
attack.Attacker item.Owner.Entity.UID;
                                        
attack.AttackType Attack.Melee;
                                        foreach (var 
obj1 in client.Screen.Objects)
                                        {
                                            if (
Kernel.GetDistance(obj1.Xobj1.Yobj.Xobj.Y) <= 3)
                                            {
                                                if (
obj1.MapObjType == MapObjectType.Monster || obj1.MapObjType == MapObjectType.Player)
                                                {
                                                    var 
attacked obj1 as Entity;
                                                    if (
Attacking.Handle.CanAttack(client.Entityattackedspellfalse))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(client.Entityattackedspellref attack);
                                                        
damage = (uint)((damage) / 12);
                                                        
attack.Damage damage;
                                                        
attack.Attacked attacked.UID;
                                                        
attack.attacked.X;
                                                        
attack.attacked.Y;
                                                        
Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell);
                                                    }
                                                }
                                                else if (
obj1.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    var 
attacked obj1 as SobNpcSpawn;
                                                    if (
Attacking.Handle.CanAttack(client.Entityattackedspell))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(client.Entityattackedref attack);
                                                        
damage = (uint)(damage spell.PowerPercent);
                                                        
attack.Damage damage;
                                                        
attack.Attacked attacked.UID;
                                                        
attack.attacked.X;
                                                        
attack.attacked.Y;
                                                        
Attacking.Handle.ReceiveAttack(client.Entityattackedattackdamagespell);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if (
item.ItemID == FloorItem.FlameLotus)
                            {
                                if (
item.Owner == client)
                                {
                                    if (
item.OnFloor.AddSeconds(8).Next(timetime))
                                    {
                                        
item.UseTime Time32.Now;
                                        var 
spell Database.SpellTable.GetSpell(12380client);

                                        var 
attack = new Attack(true);
                                        
attack.Attacker item.Owner.Entity.UID;
                                        
attack.AttackType Attack.Melee;

                                        foreach (var 
obj1 in client.Screen.Objects)
                                        {
                                            if (
Kernel.GetDistance(obj1.Xobj1.Yobj.Xobj.Y) <= 3)
                                            {
                                                if (
obj1.MapObjType == MapObjectType.Player)
                                                {
                                                    var 
attacked obj1 as Entity;
                                                    if (
Attacking.Handle.CanAttack(client.Entityattackedspellfalse))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(client.Entityattacked,spellref attack) / 2;
                                                        
damage = (damage * (uint)1.2);
                                                        
attack.Damage damage;
                                                        
attack.Attacked attacked.UID;
                                                        
attack.attacked.X;
                                                        
attack.attacked.Y;

                                                        
Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell);
                                                    }
                                                }
                                                if (
obj1.MapObjType == MapObjectType.Monster)
                                                {
                                                    var 
attacked obj1 as Entity;
                                                    if (
Attacking.Handle.CanAttack(client.Entityattackedspellfalse))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(client.Entityattackedspell,ref attack);
                                                        
damage = (damage * (uint)1.2);
                                                        
attack.Damage damage;
                                                        
attack.Attacked attacked.UID;
                                                        
attack.attacked.X;
                                                        
attack.attacked.Y;

                                                        
Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (
item.ItemID == FloorItem.ShadowOfChaser)
                            {
                                if (
item.Owner == client)
                                {
                                    var 
spell Database.SpellTable.GetSpell(13090client);
                                    var 
attack = new Attack(true);
                                    
attack.Attacker item.Owner.Entity.UID;
                                    
attack.AttackType Attack.Melee;
                                    foreach (var 
obj1 in client.Screen.Objects)
                                    {
                                        if (
Kernel.GetDistance(obj1.Xobj1.Yobj.Xobj.Y) <= spell.Range)
                                        {
                                            if (
obj1.MapObjType == MapObjectType.Monster || obj1.MapObjType == MapObjectType.Player)
                                            {
                                                var 
attacked obj1 as Entity;
                                                if (
Attacking.Handle.CanAttack(client.Entityattackedspellfalse))
                                                {
                                                    
uint damage Attacking.Calculate.Melee(client.Entityattackedspellref attack);
                                                    
damage = (uint)(damage 0.6);
                                                    
attack.Damage damage;
                                                    
attack.Attacked attacked.UID;
                                                    
attack.attacked.X;
                                                    
attack.attacked.Y;
                                                    
Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell);
                                                }
                                            }
                                            else if (
obj1.MapObjType == MapObjectType.SobNpc)
                                            {
                                                var 
attacked obj1 as SobNpcSpawn;
                                                if (
Attacking.Handle.CanAttack(client.Entityattackedspell))
                                                {
                                                    
uint damage Game.Attacking.Calculate.Melee(client.Entityattackedref attack);
                                                    
damage = (uint)(damage 0.3);
                                                    
attack.Damage damage;
                                                    
attack.Attacked attacked.UID;
                                                    
attack.attacked.X;
                                                    
attack.attacked.Y;
                                                    
Attacking.Handle.ReceiveAttack(client.Entityattackedattackdamagespell);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private static 
void itemsCallback(GameState clientint time)
        {
            if (!
client.Socket.Alive)
            {
                
client.Screen.DisposeTimers(); return;
            }
            if (
client.Entity == null) return;
            if (
client.Map == null) return;
            if (
client.Map.FreezeMonsters) return;
            
Time32 Now = new Time32(time);
            foreach (
IMapObject obj in client.Screen.Objects)
            {
                if (
obj != null)
                {
                    if (
obj.MapObjType == MapObjectType.Item)
                    {
                        
FloorItem item obj as FloorItem;
                        if (
item == null) continue;
                        if (
item.Type == FloorItem.Effect)
                        {
                            if (
item.ItemID == FloorItem.RageOfWarTrap)
                            {
                                if (
item.OnFloor.AddSeconds(2).Next(timetime))
                                {
                                    
item.Type Network.GamePackets.FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.DaggerStorm || item.ItemID == FloorItem.FuryofEgg || item.ItemID == FloorItem.ShacklingIce || item.ItemID == 31)
                            {
                                if (
item.OnFloor.AddSeconds(4).Next(timetime))
                                {
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.FlameLotus ||
                          
item.ItemID == FloorItem.AuroraLotus)
                            {
                                if (
item.OnFloor.AddSeconds(8).Next(timetime))
                                {
                                    
IEnumerable<Client.GameState> array = null;
                                    
Database.SpellInformation Spell null;
                                    if (
item.ItemID == FloorItem.FlameLotus)
                                    {
                                        
Spell Database.SpellTable.GetSpell(123806);
                                        if (
item.Owner.Team != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true &&
                                            
item.Owner.Team.IsTeammate(x.Entity.UID)
                                            );
                                        }
                                        else if (
item.Owner.Guild != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true && x.Entity.GuildID == item.Owner.Entity.GuildID
                                            
);
                                        }
                                        else if (
item.Owner.Entity.GetClan != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true && x.Entity.ClanId == item.Owner.Entity.ClanId
                                            
);
                                        }
                                        else
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true
                                            
);
                                        }
                                    }

                                    if (
item.ItemID == FloorItem.AuroraLotus)
                                    {
                                        
Spell Database.SpellTable.GetSpell(123706);
                                        if (
item.Owner.Team != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true &&
                                            
item.Owner.Team.IsTeammate(x.Entity.UID)
                                            );
                                        }
                                        else if (
item.Owner.Guild != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true && x.Entity.GuildID == item.Owner.Entity.GuildID
                                            
);
                                        }
                                        else if (
item.Owner.Entity.GetClan != null)
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true && x.Entity.ClanId == item.Owner.Entity.ClanId
                                            
);
                                        }
                                        else
                                        {
                                            array = 
Kernel.GamePool.Values.Where
                                            
(=>
                                            
Kernel.GetDistance(x.Entity.Xx.Entity.Yitem.Xitem.Y) <= Spell.Range &&
                                            
x.Entity.Dead == true
                                            
);
                                        }
                                    }
                                    foreach (
GameState pClient in array)
                                    {
                                        
Database.SpellInformation spell null;
                                        if (
pClient == null) return;
                                        if (
pClient.Entity == null) return;
                                        if (
pClient.Entity.UID != item.Owner.Entity.UID)
                                        {
                                            if (
Spell.ID == 12370)
                                            {
                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker item.Owner.Entity.UID;
                                                
suse.SpellID 1100;
                                                
suse.SpellLevel 0;
                                                
suse.pClient.Entity.X;
                                                
suse.pClient.Entity.Y;
                                                
suse.AddTarget(pClient.Entity.UID0null);
                                                
pClient.Entity.Action =
                                                
MohamedAyman.Game.Enums.ConquerAction.None;
                                                
pClient.ReviveStamp Time32.Now;
                                                
pClient.Attackable false;
                                                
pClient.Entity.TransformationID 0;
                                                
pClient.Entity.RemoveFlag((ulong)FlagsUpdate.Flags.Dead);
                                                
pClient.Entity.RemoveFlag((ulong)FlagsUpdate.Flags.Ghost);
                                                
pClient.Entity.Hitpoints pClient.Entity.MaxHitpoints;
                                                
pClient.Entity.Ressurect();
                                                
pClient.SendScreen(susetrue);
                                                
pClient.Entity.AddFlag((ulong)FlagsUpdate.Flags.Stigma25true);
                                                
pClient.Entity.AddFlag((ulong)FlagsUpdate.Flags.MagicShield,25,true);
                                                
pClient.Entity.AddFlag((ulong)FlagsUpdate.Flags.StarOfAccuracy,25,true);
                                                
pClient.Entity.StigmaStamp Time32.Now;
                                                
pClient.Entity.StarOfAccuracyTime 25;
                                                
pClient.Entity.StigmaTime 25;
                                                
pClient.Entity.MagicShieldTime 25;
                                                
pClient.Entity.StigmaIncrease 15;
                                                
pClient.Entity.MagicShieldIncrease 15;
                                                
pClient.Entity.ShieldTime 0;
                                                
pClient.Entity.ShieldTime 0;
                                                
pClient.Entity.AccuracyTime 0;
                                                
pClient.Entity.AccuracyStamp Time32.Now;
                                                
pClient.Entity.StarOfAccuracyStamp Time32.Now;
                                                
pClient.Entity.ShieldStamp Time32.Now;
                                                
pClient.Entity.MagicShieldStamp Time32.Now;
                                                if (
pClient.Entity.EntityFlag == EntityFlag.Player)
                                                    
pClient.Entity.Owner.Send(Constants.Shield(spell.PowerPercentspell.Duration));
                                                    
pClient.Entity.Owner.Send(Constants.Accuracy(spell.Duration));
                                                
pClient.Entity.Owner.Send(Constants.Stigma(spell.PowerPercentspell.Duration));
                                            }
                                        }
                                    }
                                    
item.Type Network.GamePackets.FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            else
                                if (
item.ItemID == FloorItem.AuroraLotus || item.ItemID == FloorItem.FlameLotus) return;
                            if (
item.ItemID == 1397)
                            {
                                if (
item.OnFloor.AddSeconds(3).Next(timetime))
                                {
                                    
Attacking.Handle.InfroEcho(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.ShadowOfChaser)
                            {
                                if (
item.OnFloor.AddMilliseconds(900).Next(timetime))
                                {
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.InfernalEcho)
                            {
                                if (
item.OnFloor.AddSeconds(3).Next(timetime))
                                {
                                    
Attacking.Handle.InfroEcho(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.ActOfTarget)
                            {
                                if (
item.OnFloor.AddSeconds(3).Next(timetime))
                                {
                                    
Attacking.Handle.InfroEcho(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.ActOfTarget2)
                            {
                                if (
item.OnFloor.AddSeconds(3).Next(timetime))
                                {
                                    
Attacking.Handle.InfroEcho(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            
                            if (
item.ItemID == FloorItem.TwilightDance)
                            {
                                if (
item.OnFloor.AddMilliseconds(500).Next(timetime))
                                {
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.TideTrap)
                            {
                                if (
item.OnFloor.AddMilliseconds(1500).Next(timetime))
                                {
                                    
Attacking.Handle.TideTrap(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            if (
item.ItemID == FloorItem.SeaBurial)
                            {
                                if (
item.OnFloor.AddMilliseconds(500).Next(timetime))
                                {
                                    
Attacking.Handle.SeaBurial(item);
                                    
item.Type FloorItem.RemoveEffect;
                                    
client.Map.RemoveFloorItem(item);
                                    
client.RemoveScreenSpawn(itemtrue);
                                }
                            }
                            else
                            {
                                if (
item.OnFloor.AddSeconds(Constants.FloorItemSeconds).Next(timetime))
                                {
                                    
item.Type FloorItem.Remove;
                                    foreach (
IMapObject _obj in client.Screen.Objects)
                                        if (
_obj != null)
                                            if (
_obj.MapObjType == MapObjectType.Player)
                                                (
_obj as Entity).Owner.Send(item);
                                    
client.Map.RemoveFloorItem(item);
                                    
client.Screen.Remove(item);
                                }
                            }
                        }
                    }
                }
            }
        }
        private 
IDisposable[] TimerSubscriptions;
        private 
object DisposalSyncRoot;
        public 
ConcurrentDictionary<uintGame.StatueStatue = new ConcurrentDictionary<uintStatue>();
        private 
Interfaces.IMapObject[] _objects;
        public 
Interfaces.IMapObject[] Objects
        
{
            
get { return _objects; }
        }
        private 
ConcurrentDictionary<uintInterfaces.IMapObject_objectDictionary;
        public 
Client.GameState Owner;
        public 
Screen(Client.GameState client)
        {
            
Owner client;
            
_objects = new Interfaces.IMapObject[0];
            
_objectDictionary = new ConcurrentDictionary<uintIMapObject>();
            
FloorItems = new ConcurrentDictionary<uintFloorItem>();
            
TimerSubscriptions = new IDisposable[] 
            {
                
MonsterBuffers.Add(client),
                
Guards.Add(client),
                
AliveMonsters.Add(client),
                
Items.Add(client),
                
FloorSpells.Add(client)
            };
            
DisposalSyncRoot = new object();
        }
        ~
Screen()
        {
            
DisposeTimers();
            
Clear();
            
_objects null;
            
_objectDictionary null;
            
Owner null;
        }
        public 
void DisposeTimers()
        {
            
lock (DisposalSyncRoot)
            {
                if (
TimerSubscriptions == null) return;
                for (
int i 0TimerSubscriptions.Lengthi++)
                {
                    if (
TimerSubscriptions[i] != null)
                    {
                        
TimerSubscriptions[i].Dispose();
                        
TimerSubscriptions[i] = null;
                    }
                }
            }
        }
        private 
void updateBase()
        {
            
_objects _objectDictionary.Values.ToArray();
        }
        public 
bool Add(Interfaces.IMapObject _object)
        {
            if (
_object == null) return false;
            if (
_objectDictionary.ContainsKey(_object.UID))
                if (
_objectDictionary[_object.UID] == null)
                    
_objectDictionary.Remove(_object.UID);
            if (!
_objectDictionary.ContainsKey(_object.UID))
            {
                if (
Kernel.GetDistance(_object.X_object.YOwner.Entity.XOwner.Entity.Y) <= Constants.pScreenDistance)
                {
                    
_objectDictionary[_object.UID] = _object;
                    
updateBase();
                    return 
true;
                }
            }
            return 
false;
        }
        public 
bool Remove(Interfaces.IMapObject _object)
        {
            if (
_object == null) return false;
            if (
_objectDictionary.Remove(_object.UID))
            {
                
updateBase();
                if (
_object.MapObjType == MapObjectType.Item)
                {
                    
FloorItem item _object as FloorItem;
                    if (
item.Type >= FloorItem.Effect)
                    {
                        
item.Type FloorItem.RemoveEffect;
                        
Owner.Send(item);
                    }
                    else
                    {
                        
item.Type FloorItem.Remove;
                        
Owner.Send(item);
                        
item.Type FloorItem.Drop;
                    }
                }
                else if (
_object.MapObjType == MapObjectType.Player)
                {
                    
Owner.Send(new Data(true)
                    {
                        
UID _object.UID,
                        
ID Network.GamePackets.Data.RemoveEntity
                    
});
                }
                else if (
_object.MapObjType == MapObjectType.StaticEntity)
                {
                    
Owner.Send(new Data(true)
                    {
                        
UID _object.UID,
                        
ID Network.GamePackets.Data.RemoveEntity
                    
});
                }
                return 
true;
            }
            return 
false;
        }
        public 
bool TryGetValue(uint uidout Entity entity)
        {
            
entity null;
            
Interfaces.IMapObject imo null;
            if (
_objectDictionary.TryGetValue(uidout imo))
            {
                if (
imo == null)
                {
                    
_objectDictionary.Remove(uid);
                    
updateBase();
                    return 
false;
                }
                if (
imo is Entity)
                {
                    
entity imo as Entity;
                    return 
true;
                }
            }
            return 
false;
        }
        public 
bool GetRaceObject(Func<IMapObjectboolpredicateout StaticEntity entity)
        {
            
entity null;
            foreach (var 
obj in Objects)
                if (
obj is StaticEntity)
                    if (
predicate(obj))
                        
entity obj as StaticEntity;
            return 
entity != null;
        }
        public 
bool TryGetSob(uint uidout SobNpcSpawn sob)
        {
            
sob null;
            
Interfaces.IMapObject imo null;
            if (
_objectDictionary.TryGetValue(uidout imo))
            {
                if (
imo == null)
                {
                    
_objectDictionary.Remove(uid);
                    
updateBase();
                    return 
false;
                }
                if (
imo is SobNpcSpawn)
                {
                    
sob imo as SobNpcSpawn;
                    return 
true;
                }
            }
            return 
false;
        }
        public 
bool TryGetFloorItem(uint uidout FloorItem item)
        {
            
item null;
            
Interfaces.IMapObject imo null;
            if (
_objectDictionary.TryGetValue(uidout imo))
            {
                if (
imo == null)
                {
                    
_objectDictionary.Remove(uid);
                    
updateBase();
                    return 
false;
                }
                if (
imo is FloorItem)
                {
                    
item imo as FloorItem;
                    return 
true;
                }
            }
            return 
false;
        }
        public 
IEnumerable<TSelect<T>(MapObjectType typewhere T : class
        {
            foreach (var 
obj in Objects)
                if (
obj != null)
                    if (
obj.MapObjType == type)
                        yield return 
obj as T;
        }
        public 
IEnumerable<TWhere<T>(Func<IMapObjectboolpredicatewhere T : class
        {
            foreach (var 
obj in Objects)
                if (
obj != null)
                    if (
predicate(obj))
                        yield return 
obj as T;
        }
        public 
IEnumerable<TSelectWhere<T>(MapObjectType typeFunc<Tboolpredicatewhere T : class
        {
            foreach (var 
obj in Objects)
                if (
obj != null)
                    if (
obj.MapObjType == type)
                        if (
predicate(obj as T))
                            yield return 
obj as T;
        }
        public 
bool Contains(Interfaces.IMapObject _object)
        {
            if (
_object == null) return false;
            return 
_objectDictionary.ContainsKey(_object.UID);
        }
        public 
bool Contains(uint uid)
        {
            return 
_objectDictionary.ContainsKey(uid);
        }
        public 
void FullWipe()
        {
            foreach (
IMapObject Base in Objects)
            {
                if (
Base == null) continue;
                
Data data = new Data(true);
                
data.UID Base.UID;
                
data.ID Data.RemoveEntity;
                
Owner.Send(data);
                if (
Base.MapObjType == Game.MapObjectType.Player)
                {
                    
GameState pPlayer Base.Owner as GameState;
                    
pPlayer.Screen.Remove(Owner.Entity);
                }
            }
            
Clear();
        }
        public 
void Clear()
        {
            
_objectDictionary.Clear();
            
_objects = new IMapObject[0];
            
#region Poker
            
if (this.Owner.Map.ID == 3053 || this.Owner.Map.ID == 3053)
            {
                foreach (
Poker.Structures.PokerTable p in Poker.Database.Tables.Values)
                {
                    if (
p.MapId == this.Owner.Map.ID)
                    {
                        if (
p.OnScreen == null)
                        {
                            
p.OnScreen = new ConcurrentDictionary<uintuint>();
                        }
                        if (
p.OnScreen.ContainsKey(this.Owner.Entity.UID))
                        {
                            
p.OnScreen.Remove(this.Owner.Entity.UID);
                        }
                    }
                }
            }
            
#endregion
        
}
        public 
void Reload(Interfaces.IPacket spawnWith)
        {
            
CleanUp(spawnWith);
            
#region Poker
            
if (this.Owner.Map.ID == 3053 || this.Owner.Map.ID == 3053)
            {
                foreach (
Poker.Structures.PokerTable p in Poker.Database.Tables.Values)
                {
                    if (
p.MapId == this.Owner.Map.ID)
                    {
                        if (
p.OnScreen == null)
                        {
                            
p.OnScreen = new ConcurrentDictionary<uintuint>();
                        }
                        if (
Kernel.GetDistance(p.Xp.Ythis.Owner.Entity.Xthis.Owner.Entity.Y) > Constants.nScreenDistance && p.OnScreen.ContainsKey(this.Owner.Entity.UID))
                        {
                            
p.OnScreen.Remove(this.Owner.Entity.UID);
                        }
                        if (
Kernel.GetDistance(p.Xp.Ythis.Owner.Entity.Xthis.Owner.Entity.Y) <= Constants.nScreenDistance && !p.OnScreen.ContainsKey(this.Owner.Entity.UID))
                        {
                            
this.Owner.Send(p.ToArray());
                            if (!
p.OnScreen.ContainsKey(this.Owner.Entity.UID))
                                
p.OnScreen.Add(this.Owner.Entity.UIDthis.Owner.Entity.UID);
                        }
                    }
                }
            }
            
#endregion
            
if (Owner.Entity.MapID == 1002)
            {
                foreach (var 
statue in Game.Statue.Statues.Values)
                {
                    if (
statue Owner)
                    {
                        
Statue.TryAdd(statue.UIDstatue);
                    }
                    else if (
statue Owner)
                    {
                        
Game.Statue astatue;
                        
Statue.TryRemove(statue.UIDout astatue);
                    }
                }
            }
            else
            {
                if (
Statue.Count 0)
                    
Statue.Clear();
            }
            try
            {
                foreach (
GameState pClient in Kernel.GamePool.Values)
                {
                    if (
pClient == null) return;
                    if (
pClient.Entity == null) return;
                    if (
Owner == null) return;
                    if (
Owner.Entity == null) return;
                    if (
pClient.Entity.UID != Owner.Entity.UID)
                    {
                        if (
pClient.Map.ID == Owner.Map.ID)
                        {
                            
short dist Kernel.GetDistance(pClient.Entity.XpClient.Entity.YOwner.Entity.XOwner.Entity.Y);
                            if (
dist <= Constants.pScreenDistance && !Contains(pClient.Entity))
                            {
                                if (
pClient.Guild != null)
                                    
pClient.Guild.SendName(Owner);
                                if (
Owner.Guild != null)
                                    
Owner.Guild.SendName(pClient);
                                if (
pClient.Entity.InteractionInProgress && pClient.Entity.InteractionWith != Owner.Entity.UID && pClient.Entity.InteractionSet)
                                {
                                    if (
pClient.Entity.Body == 2005 || pClient.Entity.Body == 1006)
                                    {
                                        if (
pClient.Entity.InteractionX == pClient.Entity.&& pClient.Entity.== pClient.Entity.InteractionY)
                                        {
                                            
Attack atak = new Attack(true);
                                            
atak.Attacker pClient.Entity.UID;
                                            
atak.Attacked pClient.Entity.InteractionWith;
                                            
atak.pClient.Entity.X;
                                            
atak.pClient.Entity.Y;
                                            
atak.AttackType 49;
                                            
atak.Damage pClient.Entity.InteractionType;
                                            
Owner.Send(atak);
                                        }
                                    }
                                    else
                                    {
                                        if (
Kernel.GamePool.ContainsKey(pClient.Entity.InteractionWith))
                                        {
                                            
Client.GameState Cs Kernel.GamePool[pClient.Entity.InteractionWith] as Client.GameState;
                                            if (
Cs.Entity.== pClient.Entity.InteractionX && pClient.Entity.== pClient.Entity.InteractionY)
                                            {
                                                
Attack atak = new Attack(true);
                                                
atak.Attacker pClient.Entity.UID;
                                                
atak.Attacked pClient.Entity.InteractionWith;
                                                
atak.pClient.Entity.X;
                                                
atak.pClient.Entity.Y;
                                                
atak.AttackType 49;
                                                
atak.Damage pClient.Entity.InteractionType;
                                                
Owner.Send(atak);
                                            }
                                        }
                                    }
                                }
                                if (
pClient.Pet.Pets.Count 0)
                                {
                                    foreach (var 
pet in pClient.Pet.Pets.Values)
                                    {
                                        if (
pet == null) continue;
                                        if (
pet.Entity == null) continue;
                                        if (
Kernel.GetDistance(pet.Entity.Xpet.Entity.YOwner.Entity.XOwner.Entity.Y) <= 18 && !Contains(pet.Entity.UID))
                                        {
                                            if (!
pet.Entity.Dead)
                                                
pet.Entity.SendSpawn(Owner);
                                        }
                                    }
                                }
                                if (
pClient.Map.BaseID == 700)
                                {
                                    if (
Owner.InQualifier())
                                    {
                                        if (
pClient.InQualifier())
                                        {
                                            
Owner.Entity.SendSpawn(pClient);
                                            
pClient.Entity.SendSpawn(Owner);
                                            if (
pClient.Guild != null)
                                                
Owner.Entity.SendSpawn(pClientfalse);
                                            if (
Owner.Guild != null)
                                                
pClient.Entity.SendSpawn(Ownerfalse);
                                            if (
spawnWith != null)
                                                
pClient.Send(spawnWith);
                                        }
                                        else
                                        {
                                            
Owner.Entity.SendSpawn(pClient);
                                            if (
pClient.Guild != null)
                                                
Owner.Entity.SendSpawn(pClientfalse);
                                            
Add(pClient.Entity);
                                            if (
spawnWith != null)
                                                
pClient.Send(spawnWith);
                                        }
                                    }
                                    else
                                    {
                                        if (
pClient.InQualifier())
                                        {
                                            
pClient.Entity.SendSpawn(Owner);
                                            if (
Owner.Guild != null)
                                                
pClient.Entity.SendSpawn(Ownerfalse);
                                            
pClient.Screen.Add(Owner.Entity);
                                            if (
spawnWith != null)
                                                
Owner.Send(spawnWith);
                                        }
                                        else
                                        {
                                            
Owner.Entity.SendSpawn(pClient);
                                            
pClient.Entity.SendSpawn(Owner);
                                            if (
pClient.Guild != null)
                                                
Owner.Entity.SendSpawn(pClientfalse);
                                            if (
Owner.Guild != null)
                                                
pClient.Entity.SendSpawn(Ownerfalse);
                                            if (
spawnWith != null)
                                                
pClient.Send(spawnWith);
                                        }
                                    }
                                }
                                else
                                {
                                    
Owner.Entity.SendSpawn(pClient);
                                    
pClient.Entity.SendSpawn(Owner);
                                    if (
pClient.Guild != null)
                                        
Owner.Entity.SendSpawn(pClientfalse);
                                    if (
Owner.Guild != null)
                                        
pClient.Entity.SendSpawn(Ownerfalse);
                                    if (
spawnWith != null)
                                        
pClient.Send(spawnWith);
                                }
                            }
                        }
                    }
                }
                var 
Map Owner.Map;
                
#region Npcs
                
foreach (Interfaces.INpc npc in Map.Npcs.Values)
                {
                    if (
npc == null) continue;
                    if (
Kernel.GetDistance(npc.Xnpc.YOwner.Entity.XOwner.Entity.Y) > 16) continue;
                    if (
Contains(npc.UID)) continue;
                    
npc.SendSpawn(Ownerfalse);
                }
                
#endregion
                #region ThunderCloud
                
foreach (var Cloud in Map.Clouds.Values)
                {
                    if (
Cloud == null) continue;
                    if (
Kernel.GetDistance(Cloud.XCloud.YOwner.Entity.XOwner.Entity.Y) > 16) continue;
                    
Cloud.SendSpawn(Ownerfalse);
                }
                
#endregion
                #region Items + map effects
                
foreach (var item in Map.FloorItems.Values)
                {
                    if (
item == null) continue;
                    if (
Kernel.GetDistance(item.Xitem.YOwner.Entity.XOwner.Entity.Y) > 16) continue;
                    if (
Contains(item.UID)) continue;
                    if (
item.Type == FloorItem.Effect)
                    {
                        
#region Taoista Agua/Fuego
                        
if (item.ItemID == FloorItem.FlameLotus || item.ItemID == FloorItem.AuroraLotus)
                        {
                            if (
item.OnFloor.AddSeconds(8).Next(timeTime32.Now.AllMilliseconds()))
                            {
                                
item.Type Network.GamePackets.FloorItem.RemoveEffect;
                                foreach (
Interfaces.IMapObject _obj in Objects)
                                    if (
_obj != null)
                                        if (
_obj.MapObjType == MapObjectType.Player)
                                            (
_obj as Entity).Owner.Send(item);
                                
Map.RemoveFloorItem(item);
                            }
                            else
                                
item.SendSpawn(Ownerfalse);
                        }
                        else
                        
#endregion
                                #region TwilightDance
                                
if (item.ItemID == FloorItem.TwilightDance)
                                {
                                    if (
item.OnFloor.AddSeconds(1).Next(timeTime32.Now.AllMilliseconds()))
                                    {
                                        
item.Type Network.GamePackets.FloorItem.RemoveEffect;
                                        foreach (
Interfaces.IMapObject _obj in Objects)
                                            if (
_obj != null)
                                                if (
_obj.MapObjType == MapObjectType.Player)
                                                    (
_obj as Entity).Owner.Send(item);
                                        
Map.RemoveFloorItem(item);
                                    }
                                    else
                                        
item.SendSpawn(Ownerfalse);
                                }
                                else
                                
#endregion
                                    
if (item.ItemID == FloorItem.DaggerStorm || item.ItemID == FloorItem.FuryofEgg || item.ItemID == FloorItem.ShacklingIce || item.ItemID == 31)
                                    {
                                        if (
item.OnFloor.AddSeconds(4).Next(timeTime32.Now.AllMilliseconds()))
                                        {
                                            
item.Type FloorItem.RemoveEffect;
                                            foreach (
Interfaces.IMapObject _obj in Objects)
                                                if (
_obj != null)
                                                    if (
_obj.MapObjType == MapObjectType.Player)
                                                        (
_obj as Entity).Owner.Send(item);
                                            
Map.RemoveFloorItem(item);
                                        }
                                        else
                                            
item.SendSpawn(Ownerfalse);
                                    }
                                    else
                                        
item.SendSpawn(Ownerfalse);
                    }
                    else
                    {
                        if ((
Time32.Now item.OnFloor.AddSeconds(Constants.FloorItemSeconds)) || item.PickedUpAlready)
                        {
                            
item.Type Network.GamePackets.FloorItem.Remove;
                            
Map.RemoveFloorItem(item);
                        }
                    }
                    
item.SendSpawn(Owner);
                }
                
#endregion
                
foreach (Game.Entity monster in Map.Entities.Values)
                {
                    if (
monster == null) continue;
                    if (
Kernel.GetDistance(monster.Xmonster.YOwner.Entity.XOwner.Entity.Y) <= 16 && !Contains(monster.UID))
                    {
                        if (!
monster.Dead)
                        {
                            
monster.SendSpawn(Ownerfalse);
                            if (
monster.MaxHitpoints 65535)
                            {
                                
FlagsUpdate upd = new FlagsUpdate(true)
                                {
                                    
UID monster.UID
                                
};
                                
upd.Append((byte)FlagsUpdate.DataType.Hitpointsmonster.Hitpoints);
                                
Owner.Send(upd);
                            }
                        }
                    }
                }
                
#region RaceItems
                
if (Owner.Map.StaticEntities.Count != 0)
                {
                    foreach (var 
item in Owner.Map.StaticEntities.Values)
                    {
                        if (
item == null) continue;
                        if (!
item.Viable) continue;
                        if (
Kernel.GetDistance(item.Xitem.YOwner.Entity.XOwner.Entity.Y) > 16) continue;
                        if (
Contains(item.UID)) continue;
                        
item.SendSpawn(Owner);
                    }
                }
                
#endregion
                
foreach (Game.Entity monster in Map.Companions.Values)
                {
                    if (
monster == null) continue;
                    if (
Kernel.GetDistance(monster.Xmonster.YOwner.Entity.XOwner.Entity.Y) <= 18 && !Contains(monster.UID))
                    {
                        if (!
monster.Dead)
                        {
                            
monster.SendSpawn(Owner);
                        }
                    }
                }
                if (
Owner.Map.ID == Roulette.Database.Roulettes.RouletteTable.MapID)
                {
                    foreach (var 
R in Roulette.Database.Roulettes.RoulettesPoll.Values)
                    {
                        if (
Kernel.GetDistance(R.SpawnPacket.XR.SpawnPacket.YOwner.Entity.XOwner.Entity.Y) <= Constants.nScreenDistance )
                        {
                            
Owner.Send(R.SpawnPacket);
                        }
                    }
                }
            }
            catch (
Exception e)
            {
                
Server.SaveException(e);
            }
        }
        public 
void CleanUp(Interfaces.IPacket spawnWith)
        {
            
bool remove;
            try
            {
                foreach (
IMapObject Base in Objects)
                {
                    if (
Base == null) continue;
                    if (
this.Owner.Map.ID == 3053 || this.Owner.Map.ID == 3053)
                    {
                        foreach (
PokerTable pokerTable in Poker.Database.Tables.Values)
                        {
                            if ((int)
pokerTable.MapId == (int)this.Owner.Map.ID)
                            {
                                if (
pokerTable.OnScreen == null)
                                    
pokerTable.OnScreen = new ConcurrentDictionary<uintuint>();
                                if ((int)
Kernel.GetDistance(pokerTable.XpokerTable.Ythis.Owner.Entity.Xthis.Owner.Entity.Y) > 19 && pokerTable.OnScreen.ContainsKey(this.Owner.Entity.UID))
                                    
pokerTable.OnScreen.Remove(this.Owner.Entity.UID);
                                if ((int)
Kernel.GetDistance(pokerTable.XpokerTable.Ythis.Owner.Entity.Xthis.Owner.Entity.Y) <= 19 && !pokerTable.OnScreen.ContainsKey(this.Owner.Entity.UID))
                                {
                                    
this.Owner.Send(pokerTable.ToArray());
                                    
this.Owner.Send(pokerTable.Update(Poker.Enums.TableUpdate.PlayerCount0uL));
                                    
this.Owner.Send(pokerTable.Update(Poker.Enums.TableUpdate.Statue0uL));
                                    
this.Owner.Send(pokerTable.Update(Poker.Enums.TableUpdate.Chips0uL));
                                    
pokerTable.OnScreen.Add(this.Owner.Entity.UIDthis.Owner.Entity.UID);
                                    foreach (var 
p in pokerTable.PlayersOnTable())
                                    {
                                        if (
Kernel.GamePool.ContainsKey(p.Uid))
                                        {
                                            var 
client2 Kernel.GamePool[p.Uid];
                                            
this.Owner.Send(this.Owner.Entity.CharBuffer.ToConquerPacket(10014));
                                        }
                                    }
                                }
                            }
                        }
                    }
                    
remove false;
                    if (
Base.MapObjType == MapObjectType.Monster)
                    {
                        if ((
Base as Entity).Dead)
                        {
                            if (
Time32.Now > (Base as Entity).DeathStamp.AddSeconds(8))
                                
remove true;
                            else 
remove false;
                        }
                        if (
Kernel.GetDistance(Owner.Entity.XOwner.Entity.YBase.XBase.Y) >= Constants.remScreenDistance)
                            
remove true;
                        if (
remove)
                        {
                            if ((
Base as Entity).MonsterInfo.InSight == Owner.Entity.UID)
                                (
Base as Entity).MonsterInfo.InSight 0;
                        }
                    }
                    else if (
Base.MapObjType == MapObjectType.Player)
                    {
                        if (
remove = (Kernel.GetDistance(Owner.Entity.XOwner.Entity.YBase.XBase.Y) >= Constants.pScreenDistance))
                        {
                            
GameState pPlayer Base.Owner as GameState;
                            
pPlayer.Screen.Remove(Owner.Entity);
                        }
                    }
                    else if (
Base.MapObjType == MapObjectType.Item)
                    {
                        
remove = (Kernel.GetDistance(Owner.Entity.XOwner.Entity.YBase.XBase.Y) >= 22);
                    }
                    else
                    {
                        
remove = (Kernel.GetDistance(Owner.Entity.XOwner.Entity.YBase.XBase.Y) >= Constants.remScreenDistance);
                    }
                    if (
Base.MapID != Owner.Map.ID)
                        
remove true;
                    if (
remove)
                    {
                        
Remove(Base);
                    }
                }
            }
            catch (
Exception e)
            {
                
Server.SaveException(e);
            }
        }
    }



قديم 2020-04-21, 12:05 PM
المشاركة 4
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
uint damage = Game.Attacking.Calculate.Magic(client.Entity, attacked, spell.DBSkill, ref attack);
attack.Damage = damage / 2;
#region Ataque Montruos & Boss
/* if (attacked.EntityFlag == EntityFlag.Boss)
{
damage = 1;
}*/
if (attacked.EntityFlag == EntityFlag.Monster)
{
damage = (damage * 3);
}
#endregion
spellclient.SpellPacket.Effect = attack.Effect;
Game.Attacking.Handle.ReceiveAttack(client.Entity, attacked, attack, ref damage, spell.DBSkill);
spellclient.SpellPacket.AddTarget(attacked.UID, damage, attack);
=========

المشكله في الاتاك

لما اضرب مثلا اكونت بيظهر انو جبت فيه دمج وليكن مثلا 50 الف

اجي ابص علي كميه الدم النقصت من الاكونت الاقيها 30 الف




-----------------------------------------------------------------------------------------
uint damage = Game.Attacking.Calculate.Magic(client.Entity, attacked, spell.DBSkill, ref attack);
attack.Damage = damage / 2;
#region Ataque Montruos & Boss
/* if (attacked.EntityFlag == EntityFlag.Boss)
{
damage = 1;
}*/
if (attacked.EntityFlag == EntityFlag.Monster)
{
damage = (damage * 3);
}
#endregion
//
attack.Damage = damage ;
//
spellclient.SpellPacket.Effect = attack.Effect;
Game.Attacking.Handle.ReceiveAttack(client.Entity, attacked, attack, ref damage, spell.DBSkill);
spellclient.SpellPacket.AddTarget(attacked.UID, damage, attack);
==============
لما اضرب مثلا اكونت بيظهر انو جبت فيه دمج وليكن مثلا 50 الف

اجي ابص علي كميه الدم النقصت من الاكونت الاقيها 50 الف

قديم 2020-04-21, 05:03 PM
المشاركة 5
AliNasser
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
للاسف انا عدلت علي الاكواد دي كلها ومفيش حاجه حصلت



الضربه سعات تيجي بالرقم كامل وسعات تيجي بالنص وسعات يجي 5 في الميه منو

قديم 2020-04-21, 06:00 PM
المشاركة 6
Uchiha T3Alo
.:: مشرف قسم المشاكل ::.
  • غير متواجد
Distinctive رد: مشكله في سورس سلاير المنزلو ميدو عزوز
uint damage = game.attacking.calculate.magic(client.entity, attacked, spell.dbskill, ref attack);
attack.damage = damage / 2;
#region ataque montruos & boss
/* if (attacked.entityflag == entityflag.boss)
{
damage = 1;
}*/
if (attacked.entityflag == entityflag.monster)
{
damage = (damage * 3);
}
#endregion
spellclient.spellpacket.effect = attack.effect;
game.attacking.handle.receiveattack(client.entity, attacked, attack, ref damage, spell.dbskill);
spellclient.spellpacket.addtarget(attacked.uid, damage, attack);
=========

المشكله في الاتاك

لما اضرب مثلا اكونت بيظهر انو جبت فيه دمج وليكن مثلا 50 الف

اجي ابص علي كميه الدم النقصت من الاكونت الاقيها 30 الف




-----------------------------------------------------------------------------------------
uint damage = game.attacking.calculate.magic(client.entity, attacked, spell.dbskill, ref attack);
attack.damage = damage / 2;
#region ataque montruos & boss
/* if (attacked.entityflag == entityflag.boss)
{
damage = 1;
}*/
if (attacked.entityflag == entityflag.monster)
{
damage = (damage * 3);
}
#endregion
//
attack.damage = damage ;
//
spellclient.spellpacket.effect = attack.effect;
game.attacking.handle.receiveattack(client.entity, attacked, attack, ref damage, spell.dbskill);
spellclient.spellpacket.addtarget(attacked.uid, damage, attack);
==============
لما اضرب مثلا اكونت بيظهر انو جبت فيه دمج وليكن مثلا 50 الف

اجي ابص علي كميه الدم النقصت من الاكونت الاقيها 50 الف
مش منها يا ريدر ده العيب فى باكت ال1022 مش مظبوط محتاج الى يراجع اصلا على الباكت بالكامل لان فيه غلط فى الميمبر بتاع البروتو هو الى عامل المشكله ده ويمكن كمان يعملك مشكله انك لو جيت تضرب فى الوحوش تلقى الوحوش اتحسبت عدد غير العدد الى قتلتوا اصلا

قديم 2020-04-22, 07:04 AM
المشاركة 7
AliNasser
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
دا الباكت كلو عشان مليش في موضوع الباكتات اوي

انا قارنت proto member مع سورس رايزو ومش لاقي فرق



كود:
using ProtoBuf;
using System;

namespace 
MohamedAyman.Network.GamePackets
{
    public 
unsafe class Attack Interfaces.IPacket
    
{
        [
ProtoContract]
        public class 
AttackProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint TimeSpam1 0;
            [
ProtoMember(2IsRequired true)]
            public 
uint TimeSpam2 0;
            [
ProtoMember(4IsRequired true)]
            public 
uint Attacker 0;
            [
ProtoMember(5IsRequired true)]
            public 
uint Attacked 0;
            [
ProtoMember(7IsRequired true)]
            public 
ushort X 0;
            [
ProtoMember(8IsRequired true)]
            public 
ushort Y 0;
            [
ProtoMember(13IsRequired true)]
            public 
uint AttackType 0;
            [
ProtoMember(15IsRequired true)]
            public 
uint SpellIDandDamage 0;
            [
ProtoMember(16IsRequired true)]
            public 
uint SpellLevel 0;
            [
ProtoMember(19IsRequired true)]
            public 
uint SkillID 0;
            [
ProtoMember(17IsRequired true)]
            public 
uint KOCount 0;
            [
ProtoMember(25IsRequired true)]
            public 
uint Effect1 0;
            [
ProtoMember(26IsRequired true)]
            public 
uint Effect2 0;
        }
        public const 
uint

        Melee 
2,
        
MarriageRequest 8,
        
MarriageAccept 9,
        
Kill 14,
        
Magic 24,
        
Reflect 26,
        
Dash 27,
        
Ranged 28,
        
MonkMelee 34,
        
CloudSaints 36,
        
ClaimCP 37,
        
Obtained 39,
        
MerchantAccept 40,
        
MerchantRefuse 41,
        
MerchantProgress 42,
        
Scapegoat 43,
        
CounterKillSwitch 44,
        
FatalStrike 45,
        
InteractionRequest 46,
        
InteractionAccept 47,
        
InteractionRefuse 48,
        
InteractionEffect 49,
        
InteractionStopEffect 50,
        
ShowUseSpell 52,
        
SkillMove 53,
        
BlueDamage 55,
        
BackFire 57;

        
AttackProto Buffer;
        
ushort packetID 1022;
        public 
Attack(bool Create)
        {
            if (
Create)
            {
                
Buffer = new AttackProto();
                
TimeStamp = (uint)Time32.Now.GetHashCode();
            }
        }
        public 
uint TimeStamp
        
{
            
get { return (uint)Buffer.TimeSpam1; }
            
set Buffer.TimeSpam1 value; }
        }
        public 
uint Attacker
        
{
            
get { return Buffer.Attacker; }
            
set Buffer.Attacker value; }
        }
        public 
ushort MagicType
        
{
            
get { return (ushort)Damage; }
            
set Damage = (uint)((MagicLevel << 16) | value); }
        }
        public 
ushort MagicLevel
        
{
            
get { return (ushort)(Damage >> 16); }
            
set Damage = (uint)((value << 16) | MagicType); }
        }
        public 
uint Attacked
        
{
            
get { return Buffer.Attacked; }
            
set Buffer.Attacked value; }
        }
        public 
ushort X
        
{
            
get { return (ushort)Buffer.X; }
            
set Buffer.value; }
        }
        public 
ushort Y
        
{
            
get { return (ushort)Buffer.Y; }
            
set Buffer.value; }
        }
        public 
uint AttackType
        
{
            
get { return Buffer.AttackType; }
            
set Buffer.AttackType value; }
        }
        public 
uint Damage
        
{
            
get { return Buffer.SpellIDandDamage; }
            
set Buffer.SpellIDandDamage value; }
        }
        public 
ushort SpellID
        
{
            
get { return (ushort)Buffer.SkillID; }
            
set Buffer.SkillID value; }
        }
        public 
uint MonsterSpellID
        
{
            
get { return Buffer.SpellIDandDamage; }
            
set Buffer.SpellIDandDamage value; }
        }
        public 
ushort KOCount
        
{
            
get { return (ushort)Buffer.KOCount; }
            
set Buffer.KOCount value; }
        }
        public 
uint ResponseDamage
        
{
            
get { return Buffer.SpellIDandDamage; }
            
set Buffer.SpellIDandDamage value; }
        }
        public 
uint EncodingSpellID get { return Buffer.SkillID; } }
        public 
bool weaponspell false;
        public 
AttackEffects Effect
        
{
            
get { return (AttackEffects)Buffer.Effect1; }
            
set Buffer.Effect1 = (uint)value; }
        }
        public 
AttackEffects2 Effect2
        
{
            
get { return (AttackEffects2)Buffer.Effect2; }
            
set Buffer.Effect2 = (uint)value; }
        }
        [
Flags]
        public 
enum AttackEffects
        
{
            
None 0,
            
Block << 0,
            
Penetration << 1,
            
CriticalStrike << 2,
            
Unknown << 3,
            
MetalResist << 4,
            
Immu 8,
            Break = 
10,
            
WoodResist << 5,
            
WaterResist << 6,
            
FireResist << 7,
            
EarthResist << 8,
            
AddStudyPoint << 9,
            
//Runes
            
TortoiseBreaker << 12,
            
Acalanatha << 13,
            
Assassin << 14,
            
BurningSky << 15,
            
FireCurse << 16
        
}
        [
Flags]
        public 
enum AttackEffects2
        
{
            
None 0,
            
EarthResist << 0,
            
StudyPoints << 1
        
}
        public 
bool Decoded false;
        public 
bool CheckWeponSpell false;
        public 
void Send(Client.GameState client)
        {
            
client.Send(ToArray());
        }

        public 
byte[] ToArray()
        {
            return 
Buffer.ToConquerPacket(packetID);
        }
        public 
void Deserialize(byte[] buffer)
        {
            
this.Buffer buffer.ConvertToProto<AttackProto>();
        }
        public static 
void Process(byte[] packetClient.GameState client)
        {
            if (
client.Action != 2) return;
            
client.LastAttack Time32.Now;
            
Attack attack = new Attack(false);
            
attack.Deserialize(packet);
            
Writer.WriteUInt32(08attack.ToArray());
            
HandleAttack(attackclient);
            switch (
attack.AttackType)
            {
                case 
Attack.CloudSaints:
                    {
                        
CloudSaintsJar.Calculate(clientattack);
                        break;
                    }
                case 
Attack.Obtained:
                    {
                        
client.Entity.ConquerPoints += client.TQPoint;
                        
attack.ResponseDamage client.TQPoint;
                        
client.TQPoint -= client.TQPoint;
                        
client.Send(packet);
                        break;
                    }
                case 
Attack.MerchantAccept:
                    {
                        
client.Entity.Merchant 255;
                        
client.Entity.Update((byte)FlagsUpdate.DataType.Merchant2550);
                        
client.Send(packet);
                        break;
                    }
                case 
Attack.MerchantRefuse:
                    {
                        
client.Entity.Update((byte)FlagsUpdate.DataType.Merchant00);
                        
Database.MerchantTable.Cancel(client);
                        
client.Send(packet);
                        break;
                    }
                
//default: Console.WriteLine("[Attack] Unknown Type: " + attack.AttackType + ""); break;
            
}
        }
        public static 
void HandleAttack(Attack attackClient.GameState client)
        {
            
#region Absolution
            
if (client.Entity.ContainsFlag((ulong)FlagsUpdate.Flags.Absolution))
            {
                
client.Entity.RemoveFlag((ulong)FlagsUpdate.Flags.Absolution);
                
FlagsUpdate upgrade2 = new FlagsUpdate(true);
                
upgrade2.UID client.Entity.UID;
                
upgrade2.Append(1060000);
                
client.Send(upgrade2.ToArray());
            }
            
#endregion
            
client.Entity.SpiritFocus false;
            
client.Entity.OnCheckGuard false;
            
client.Entity.OnCheckSaqueo false;
            
DialyQuestsEffect.CheckCancelGuard(client);
            
client.Entity.RemoveMagicDefender();
            
client.Entity.AttackPacket attack;
            new 
Game.Attacking.Handle(attackclient.Entitynull);
        }
    }



قديم 2020-04-22, 11:40 AM
المشاركة 8
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
مش منها يا ريدر ده العيب فى باكت ال1022 مش مظبوط محتاج الى يراجع اصلا على الباكت بالكامل لان فيه غلط فى الميمبر بتاع البروتو هو الى عامل المشكله ده ويمكن كمان يعملك مشكله انك لو جيت تضرب فى الوحوش تلقى الوحوش اتحسبت عدد غير العدد الى قتلتوا اصلا
اها انا افتكرته سورس عادي و مفروض بين damage و receive بتاع دمج

قديم 2020-04-22, 10:58 PM
المشاركة 9
AliNasser
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
ماشي طب والحل يارايدر

قديم 2020-04-23, 08:12 AM
المشاركة 10
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكله في سورس سلاير المنزلو ميدو عزوز
راجع بالبريك بوينت علي الدمج الفعلي و الدمج الي بيعمل فيو للاكونت و شوف مشكله منين سي شارب 2012 و انته طالع


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: مشكله في سورس سلاير المنزلو ميدو عزوز
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
كيفيت تركيب لودر ميجو في سورس ال3دي بتاع الاجنبي ElSaher تطوير سيرفرات كونكر 21 2024-09-29 06:04 PM
مشاكل سورس سلاير الاسباني neno2052 مشكلات السيرفيرات كونكر الشخصيه 1 2020-05-15 10:28 PM
عاوز لودر يشغل سورس البرتو بس ميفتحليش موقع علي النت مش زي ميجو Mawdo3jded مشكلات السيرفيرات كونكر الشخصيه 1 2020-03-26 11:15 AM
شكر خاص لل rider و ميجو megokarika قسم الاقتراحات والابداع 5 2020-03-17 05:03 AM
بخصوص سورس ميدو عزوز او DarkWay midoazoz تطوير سيرفرات كونكر 0 2019-11-06 12:42 PM


الساعة الآن 01:36 AM

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.