internal class VanishCommand : Command
{
public VanishCommand()
: base("vanish", 1)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (!player.isNotVisible)
{
player.isNotVisible = true;
player.Owner.PlayersCollision.Remove(player);
if (player.Pet != null)
player.Owner.LeaveWorld(player.Pet);
player.SendInfo("You're now hidden from all players!");
return true;
}
player.isNotVisible = false;
player.SendInfo("You're now visible to all players!");
return true;
}
}
public bool PvP { get; set; }
public bool isNotVisible = false;
public void Damage(int dmg, Entity chr, bool noDef, bool toSelf = false, float pvpReduction = 0.20f)
{
try
{
if (HasConditionEffect(ConditionEffects.Paused) ||
HasConditionEffect(ConditionEffects.Stasis) ||
HasConditionEffect(ConditionEffects.Invincible))
return;
dmg = (int)StatsManager.GetDefenseDamage(dmg, noDef);
if (chr is Player)
dmg = Math.Max(1, (int)(dmg * pvpReduction));
if (!HasConditionEffect(ConditionEffects.Invulnerable))
HP -= dmg;
UpdateCount++;
Owner.BroadcastPacket(new DamagePacket
{
TargetId = Id,
Effects = 0,
Damage = (ushort)dmg,
Killed = HP <= 0,
BulletId = 0,
ObjectId = chr != null ? chr.Id : -1
}, toSelf ? null : this);
SaveToCharacter();
string killerName = chr is Player
? chr.Name
: chr != null ? (chr.ObjectDesc.DisplayId ?? chr.ObjectDesc.ObjectId) : "Unknown";
if (HP <= 0)
Death(killerName);
}
catch (Exception e)
{
log.Error("Error while processing playerDamage: ", e);
}
}
}, null);
if (!isNotVisible)
Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Teleport,
TargetId = Id,
PosA = new Position
{
X = X,
Y = Y
},
Color = new ARGB(0xFFFFFFFF)
}, null);
}
private IEnumerable<int> GetRemovedEntities()
{
foreach (Entity i in clientEntities.Where(i => i is Player))
{
if ((i as Player).isNotVisible && i != this && !PvP)
{
yield return i.Id;
}
if (i is Player && i.Owner != null) continue;
if (MathsUtils.DistSqr(i.X, i.Y, X, Y) > SIGHTRADIUS * SIGHTRADIUS &&
!(i is StaticObject && (i as StaticObject).Static) &&
i != Quest)
{
if (i is Pet) continue;
yield return i.Id;
}
else if (i.Owner == null)
yield return i.Id;
if ((i as Player).isNotVisible && i != this && !PvP)
yield return i.Id;
}
}
}
}

lol I just got to my computer and I was about to convert it but gg you got to it faster then me 

there is real kids out there with that problem and the word autistic is offensive so please use the word slow or challenged 

private IEnumerable<int> GetRemovedEntities()
{
foreach (Entity i in clientEntities.Where(i => i is Player))
{
if ((i as Player).isNotVisible && i != this && !PvP)
{
yield return i.Id;
}
}
foreach (Entity i in clientEntities)
{
if (i is Player && i.Owner != null) continue;
if (MathsUtils.DistSqr(i.X, i.Y, X, Y) > SIGHTRADIUS * SIGHTRADIUS &&
!(i is StaticObject && (i as StaticObject).Static) &&
i != Quest)
yield return i.Id;
else if (i.Owner == null)
yield return i.Id;
if (i is Player)
if ((i as Player).isNotVisible && i != this && !PvP)
yield return i.Id;
}
}
