C# Class Aura.Channel.World.Region

Mostrar archivo Open project: aura-project/aura Class Usage Examples

Public Properties

Property Type Description
Limbo Region

Protected Properties

Property Type Description
_clientEvents ClientEvent>.Dictionary
_clients HashSet
_creatures Creature>.Dictionary
_creaturesRWLS System.Threading.ReaderWriterLockSlim
_items Item>.Dictionary
_props Prop>.Dictionary

Public Methods

Method Description
ActivateAis ( Creature creature, Position from, Position to ) : void

Activates AIs in range of the movement path.

AddCreature ( Creature creature ) : void

Adds creature to region, sends EntityAppears.

AddItem ( Item item ) : void

Adds item, sends EntityAppears.

Use Item's Drop method to drop items in a region, unless you know what you're doing.

AddProp ( Prop prop ) : void

Spawns prop, sends EntityAppears.

Broadcast ( Aura.Shared.Network.Packet packet ) : void

Broadcasts packet in region.

Broadcast ( Aura.Shared.Network.Packet packet, Entity source, bool sendToSource = true, int range = -1 ) : void

Broadcasts packet to all creatures in range of source.

CountAggro ( Creature target ) : int

Returns amount of creatures of race that are targetting target in this region.

CountAggro ( Creature target, int raceId ) : int

Returns amount of creatures of race that are targetting target in this region.

CountPlayers ( ) : int

Returns amount of players in region.

CreatureExists ( long entityId ) : bool

Returns true if creature with given entity id exists.

GetAllGoodNpcs ( List &list ) : void

Adds all good NPCs of region to list.

GetAllItems ( ) : List

Returns a list of all items on the floor.

GetAllPlayers ( ) : List

Returns all player creatures in region.

GetAreaId ( int x, int y ) : int

Returns id of area at the given coordinates and adjusts it if region is dynamic, or 0 if area wasn't found.

GetClientEvent ( bool>.Func predicate ) : Aura.Channel.World.Entities.ClientEvent

Returns first event that matches the predicate.

GetClientEvent ( long eventId ) : Aura.Channel.World.Entities.ClientEvent

Returns event by id or null if it doesn't exist.

GetClientEvent ( string eventName ) : Aura.Channel.World.Entities.ClientEvent

Returns event by name or null if it doesn't exist.

GetClientEvents ( bool>.Func predicate ) : Aura.Channel.World.Entities.ClientEvent[]

Returns all events that matches the predicate.

GetCreature ( long entityId ) : Creature

Returns creature by entityId, or null, if it doesn't exist.

GetCreature ( string name ) : Creature

Returns creature by name, or null, if it doesn't exist.

GetCreatureSafe ( long entityId ) : Creature

Returns creature by entity id, throws SevereViolation exception if creature doesn't exist.

GetCreatures ( bool>.Func predicate ) : ICollection

Returns list of creatures that match predicate.

GetCreaturesInPolygon ( ) : List

Returns new list of all creatures within the specified polygon.

GetCreaturesInRange ( Position pos, int range ) : List

Returns new list of all creatures within range of position.

GetEntitiesInRange ( Entity source, int range = -1 ) : List

Returns new list of all entities within range of source.

GetItem ( bool>.Func predicate ) : Item

Returns first item that matches predicate, or null if none were found.

GetItem ( long entityId ) : Item

Returns item or null.

GetMatchingEvents ( string eventPath ) : List

Returns a list of events that start with the given path, e.g. "Uladh_main/field_Tir_S_aa/fish_tircho_stream_", to get all fishing events starting with that name.

GetNpc ( long entityId ) : NPC

Returns NPC by entityId, or null, if no NPC with that id exists.

GetNpcSafe ( long entityId ) : NPC

Returns NPC by entity id, throws SevereViolation exception if NPC doesn't exist.

GetNpcs ( bool>.Func predicate ) : ICollection

Returns list of creatures that match predicate.

GetPlayer ( string name ) : Aura.Channel.World.Entities.PlayerCreature

Returns first player creature with the given name, or null.

GetPlayersInRange ( Position pos, int range = VisibleRange ) : List

Returns all player creatures in range.

GetProp ( bool>.Func predicate ) : Prop

Returns first prop that matches the predicate, or null if no matching props were found.

GetProp ( long entityId ) : Prop

Returns prop or null.

GetProps ( bool>.Func predicate ) : IList

Returns list of all props that match the predicate.

GetVisibleCreaturesInRange ( Entity entity, int range = VisibleRange ) : ICollection

Returns all visible creatures in range of entity, excluding itself.

GetVisibleEntities ( Creature creature ) : List

Returns a list of visible entities, from the view point of creature.

IsOnStreet ( Position pos ) : bool

Returns true if given position is on the street.

OnPlayerEntered ( Creature creature, int prevRegionId ) : void
RemoveCreature ( Creature creature ) : void

Removes creature from region, sends EntityDisappears.

RemoveItem ( Item item ) : void

Despawns item, sends EntityDisappears.

RemoveProp ( Prop prop ) : void

Despawns prop, sends EntityDisappears.

RemoveScriptedEntities ( ) : void

Removes all scripted entites from this region.

UpdateEntities ( ) : void

Updates all entites, removing dead ones, updating visibility, etc.

Protected Methods

Method Description
InitializeFromData ( ) : void

Adds all props found in the client for this region and creates a list of areas.

LoadClientEvents ( ) : void

Adds all props found in the client for this region.

LoadProps ( ) : void

Adds all props found in the client for this region.

Region ( int regionId ) : System

Initializes class.

Private Methods

Method Description
AddClientEvent ( Aura.Channel.World.Entities.ClientEvent clientEvent ) : void

Adds client event to region.

GetNewPropEntityId ( Prop prop ) : long

Generates entity id for prop.

RemoveOverdueEntities ( ) : void

Removes expired entities.

UpdateVisibility ( ) : void

Updates visible entities on all clients.

Method Details

ActivateAis() public method

Activates AIs in range of the movement path.
public ActivateAis ( Creature creature, Position from, Position to ) : void
creature Aura.Channel.World.Entities.Creature
from Position
to Position
return void

AddCreature() public method

Adds creature to region, sends EntityAppears.
public AddCreature ( Creature creature ) : void
creature Aura.Channel.World.Entities.Creature
return void

AddItem() public method

Adds item, sends EntityAppears.
Use Item's Drop method to drop items in a region, unless you know what you're doing.
public AddItem ( Item item ) : void
item Item
return void

AddProp() public method

Spawns prop, sends EntityAppears.
public AddProp ( Prop prop ) : void
prop Aura.Channel.World.Entities.Prop
return void

Broadcast() public method

Broadcasts packet in region.
public Broadcast ( Aura.Shared.Network.Packet packet ) : void
packet Aura.Shared.Network.Packet
return void

Broadcast() public method

Broadcasts packet to all creatures in range of source.
public Broadcast ( Aura.Shared.Network.Packet packet, Entity source, bool sendToSource = true, int range = -1 ) : void
packet Aura.Shared.Network.Packet
source Entity
sendToSource bool
range int
return void

CountAggro() public method

Returns amount of creatures of race that are targetting target in this region.
public CountAggro ( Creature target ) : int
target Aura.Channel.World.Entities.Creature
return int

CountAggro() public method

Returns amount of creatures of race that are targetting target in this region.
public CountAggro ( Creature target, int raceId ) : int
target Aura.Channel.World.Entities.Creature
raceId int
return int

CountPlayers() public method

Returns amount of players in region.
public CountPlayers ( ) : int
return int

CreatureExists() public method

Returns true if creature with given entity id exists.
public CreatureExists ( long entityId ) : bool
entityId long
return bool

GetAllGoodNpcs() public method

Adds all good NPCs of region to list.
public GetAllGoodNpcs ( List &list ) : void
list List
return void

GetAllItems() public method

Returns a list of all items on the floor.
public GetAllItems ( ) : List
return List

GetAllPlayers() public method

Returns all player creatures in region.
public GetAllPlayers ( ) : List
return List

GetAreaId() public method

Returns id of area at the given coordinates and adjusts it if region is dynamic, or 0 if area wasn't found.
public GetAreaId ( int x, int y ) : int
x int
y int
return int

GetClientEvent() public method

Returns first event that matches the predicate.
public GetClientEvent ( bool>.Func predicate ) : Aura.Channel.World.Entities.ClientEvent
predicate bool>.Func
return Aura.Channel.World.Entities.ClientEvent

GetClientEvent() public method

Returns event by id or null if it doesn't exist.
public GetClientEvent ( long eventId ) : Aura.Channel.World.Entities.ClientEvent
eventId long
return Aura.Channel.World.Entities.ClientEvent

GetClientEvent() public method

Returns event by name or null if it doesn't exist.
public GetClientEvent ( string eventName ) : Aura.Channel.World.Entities.ClientEvent
eventName string
return Aura.Channel.World.Entities.ClientEvent

GetClientEvents() public method

Returns all events that matches the predicate.
public GetClientEvents ( bool>.Func predicate ) : Aura.Channel.World.Entities.ClientEvent[]
predicate bool>.Func
return Aura.Channel.World.Entities.ClientEvent[]

GetCreature() public method

Returns creature by entityId, or null, if it doesn't exist.
public GetCreature ( long entityId ) : Creature
entityId long
return Aura.Channel.World.Entities.Creature

GetCreature() public method

Returns creature by name, or null, if it doesn't exist.
public GetCreature ( string name ) : Creature
name string
return Aura.Channel.World.Entities.Creature

GetCreatureSafe() public method

Returns creature by entity id, throws SevereViolation exception if creature doesn't exist.
public GetCreatureSafe ( long entityId ) : Creature
entityId long
return Aura.Channel.World.Entities.Creature

GetCreatures() public method

Returns list of creatures that match predicate.
public GetCreatures ( bool>.Func predicate ) : ICollection
predicate bool>.Func
return ICollection

GetCreaturesInPolygon() public method

Returns new list of all creatures within the specified polygon.
public GetCreaturesInPolygon ( ) : List
return List

GetCreaturesInRange() public method

Returns new list of all creatures within range of position.
public GetCreaturesInRange ( Position pos, int range ) : List
pos Position
range int
return List

GetEntitiesInRange() public method

Returns new list of all entities within range of source.
public GetEntitiesInRange ( Entity source, int range = -1 ) : List
source Entity
range int Leave at default for visible range.
return List

GetItem() public method

Returns first item that matches predicate, or null if none were found.
public GetItem ( bool>.Func predicate ) : Item
predicate bool>.Func
return Item

GetItem() public method

Returns item or null.
public GetItem ( long entityId ) : Item
entityId long
return Item

GetMatchingEvents() public method

Returns a list of events that start with the given path, e.g. "Uladh_main/field_Tir_S_aa/fish_tircho_stream_", to get all fishing events starting with that name.
public GetMatchingEvents ( string eventPath ) : List
eventPath string
return List

GetNpc() public method

Returns NPC by entityId, or null, if no NPC with that id exists.
public GetNpc ( long entityId ) : NPC
entityId long
return Aura.Channel.World.Entities.NPC

GetNpcSafe() public method

Returns NPC by entity id, throws SevereViolation exception if NPC doesn't exist.
public GetNpcSafe ( long entityId ) : NPC
entityId long
return Aura.Channel.World.Entities.NPC

GetNpcs() public method

Returns list of creatures that match predicate.
public GetNpcs ( bool>.Func predicate ) : ICollection
predicate bool>.Func
return ICollection

GetPlayer() public method

Returns first player creature with the given name, or null.
public GetPlayer ( string name ) : Aura.Channel.World.Entities.PlayerCreature
name string
return Aura.Channel.World.Entities.PlayerCreature

GetPlayersInRange() public method

Returns all player creatures in range.
public GetPlayersInRange ( Position pos, int range = VisibleRange ) : List
pos Position
range int
return List

GetProp() public method

Returns first prop that matches the predicate, or null if no matching props were found.
public GetProp ( bool>.Func predicate ) : Prop
predicate bool>.Func
return Aura.Channel.World.Entities.Prop

GetProp() public method

Returns prop or null.
public GetProp ( long entityId ) : Prop
entityId long
return Aura.Channel.World.Entities.Prop

GetProps() public method

Returns list of all props that match the predicate.
public GetProps ( bool>.Func predicate ) : IList
predicate bool>.Func
return IList

GetVisibleCreaturesInRange() public method

Returns all visible creatures in range of entity, excluding itself.
public GetVisibleCreaturesInRange ( Entity entity, int range = VisibleRange ) : ICollection
entity Entity
range int
return ICollection

GetVisibleEntities() public method

Returns a list of visible entities, from the view point of creature.
public GetVisibleEntities ( Creature creature ) : List
creature Aura.Channel.World.Entities.Creature
return List

InitializeFromData() protected method

Adds all props found in the client for this region and creates a list of areas.
protected InitializeFromData ( ) : void
return void

IsOnStreet() public method

Returns true if given position is on the street.
public IsOnStreet ( Position pos ) : bool
pos Position
return bool

LoadClientEvents() protected method

Adds all props found in the client for this region.
protected LoadClientEvents ( ) : void
return void

LoadProps() protected method

Adds all props found in the client for this region.
protected LoadProps ( ) : void
return void

OnPlayerEntered() public method

public OnPlayerEntered ( Creature creature, int prevRegionId ) : void
creature Aura.Channel.World.Entities.Creature
prevRegionId int
return void

Region() protected method

Initializes class.
protected Region ( int regionId ) : System
regionId int
return System

RemoveCreature() public method

Removes creature from region, sends EntityDisappears.
public RemoveCreature ( Creature creature ) : void
creature Aura.Channel.World.Entities.Creature
return void

RemoveItem() public method

Despawns item, sends EntityDisappears.
public RemoveItem ( Item item ) : void
item Item
return void

RemoveProp() public method

Despawns prop, sends EntityDisappears.
public RemoveProp ( Prop prop ) : void
prop Aura.Channel.World.Entities.Prop
return void

RemoveScriptedEntities() public method

Removes all scripted entites from this region.
public RemoveScriptedEntities ( ) : void
return void

UpdateEntities() public method

Updates all entites, removing dead ones, updating visibility, etc.
public UpdateEntities ( ) : void
return void

Property Details

Limbo public_oe static_oe property

public static Region,Aura.Channel.World Limbo
return Region

_clientEvents protected_oe property

protected Dictionary _clientEvents
return ClientEvent>.Dictionary

_clients protected_oe property

protected HashSet _clients
return HashSet

_creatures protected_oe property

protected Dictionary _creatures
return Creature>.Dictionary

_creaturesRWLS protected_oe property

protected ReaderWriterLockSlim,System.Threading _creaturesRWLS
return System.Threading.ReaderWriterLockSlim

_items protected_oe property

protected Dictionary _items
return Item>.Dictionary

_props protected_oe property

protected Dictionary _props
return Prop>.Dictionary