/// <summary> /// Will resend update packet of the given object /// </summary> public void InvalidateKnowledgeOf(WorldObject obj) { KnownObjects.Remove(obj); NearbyObjects.Remove(obj); obj.SendDestroyToPlayer(this); }
public void RemoveKnownObject(PhysicsObj obj, bool inversePlayer = true) { KnownObjects.Remove(obj.ID); if (PhysicsObj.IsPlayer && inversePlayer) { obj.ObjMaint.RemoveKnownPlayer(PhysicsObj); } }
/// <summary> /// Is called whenever an object leaves this Character's sight /// </summary> public void OnOutOfRange(WorldObject obj) { obj.AreaCharCount--; if (obj == Asda2DuelingOponent) { if (Asda2Duel != null) { Asda2Duel.StopPvp(); } } if (obj == m_target) { // unset current Target ClearTarget(); } if (obj == m_activePet) { ActivePet = null; } if (GossipConversation != null && obj == GossipConversation.Speaker && GossipConversation.Character == this) { // stop conversation with a vanished object GossipConversation.Dispose(); } if (!(obj is Transport)) { KnownObjects.Remove(obj); } var chr = obj as Character; if (chr != null) { if (EnemyCharacters.Contains(chr)) { EnemyCharacters.Remove(chr); CheckEnemysCount(); } GlobalHandler.SendCharacterDeleteResponse(chr, Client); } else { var loot = obj as Asda2Loot; if (loot != null) { GlobalHandler.SendRemoveLootResponse(this, loot); } } }
/// <summary> /// Is called whenever an object leaves this Character's sight /// </summary> public void OnOutOfRange(WorldObject obj) { obj.AreaCharCount--; if (obj is Character && m_observers != null) { if (m_observers.Remove((Character)obj)) { // Character was observing: Now destroy items for him for (var i = (InventorySlot)0; i < InventorySlot.Bag1; i++) { var item = m_inventory[i]; if (item != null) { item.SendDestroyToPlayer((Character)obj); } } } } if (obj == DuelOpponent && !Duel.IsActive) { // opponent vanished before Duel started: Cancel duel Duel.Dispose(); } if (obj == m_target) { // unset current Target ClearTarget(); } if (obj == m_activePet) { ActivePet = null; } if (GossipConversation != null && obj == GossipConversation.Speaker && GossipConversation.Character == this) { // stop conversation with a vanished object GossipConversation.Dispose(); } if (!(obj is Transport)) { KnownObjects.Remove(obj); // send the destroy packet //obj.SendDestroyToPlayer(this); } }
public bool RemoveKnownObject(PhysicsObj obj, bool inversePlayer = true) { rwLock.EnterWriteLock(); try { var result = KnownObjects.Remove(obj.ID, out _); if (inversePlayer && PhysicsObj.IsPlayer) { obj.ObjMaint.RemoveKnownPlayer(PhysicsObj); } return(result); } finally { rwLock.ExitWriteLock(); } }
public void RemoveKnownObject(GameObject o) { KnownObjects.Remove(o); }