/// <summary> /// Creates a new instance of the <see cref="Gameobject"/> class. /// </summary> public Gameobject(MmoZone zone, int objectId, GameObjectType goType, short familyId, GameObjectData goInfo) : base(zone, ObjectType.Gameobject, objectId, familyId, new Bounds(), null) { this.goType = goType; this.lootGroupId = goInfo.LootGroupId; this.BuildProperties(Properties, PropertyFlags.GameobjectAll); this.Revision = this.Properties.Count; if (Properties.Count > 0) { this.Flags |= MmoObjectFlags.HasProperties; } switch (goType) { case GameObjectType.Chest: // chest can be looted by a single person this.lootRestriction = LootRestriction.SingleLooter; break; case GameObjectType.Plant: case GameObjectType.Vein: // plants and veins can be looted by multiple this.lootRestriction = LootRestriction.MultipleLooter; break; default: this.lootRestriction = LootRestriction.None; break; } this.lootGeneration = 0; }
/// <summary> /// Creates a new instance of the <see cref="Npc"/> class. /// </summary> public Npc(MmoZone zone, int objectId, short groupId, NpcType npcType, NpcData npcData) : base(zone, ObjectType.Npc, objectId, groupId, new Bounds(), npcData) { this.npcType = npcType; this.alignment = (SocialAlignment)npcData.Alignment; this.lootGroupId = npcData.LootGroupId; this.startableQuestIds = npcData.StartQuests; this.completableQuestIds = npcData.CompleteQuests; this.BuildProperties(Properties, PropertyFlags.NpcAll); this.Revision = this.Properties.Count; if (Properties.Count > 0) { this.Flags |= MmoObjectFlags.HasProperties; } this.SetBaseStat(Stats.Health, (short)npcData.MaxHealth); this.SetHealth(MaximumHealth); this.SetBaseStat(Stats.Power, (short)npcData.MaxMana); this.SetPower(MaximumPower); this.threatTable = new Dictionary <MmoGuid, float>(); this.CurrentAggroState = AggroState.Idle; this.visibleCharacters = new Dictionary <Character, IDisposable>(); this.radarEnterRadius = ServerGameSettings.BASE_AGGRO_RADIUS; this.radarExitRadius = ServerGameSettings.BASE_AGGRO_DROP_RADIUS; this.ai = npcType == NpcType.Enemy ? (NpcAI) new NpcAggressiveAI(this) : new NpcDefensiveAI(this); this.inventory = npcData.Items; }
/// <summary> /// Creates a new instance of the <see cref="Character"/> class. /// </summary> protected Character(MmoZone zone, ObjectType type, int objectId, short familyId, Bounds bounds, CharacterData characterData) : base(zone, type, objectId, familyId, bounds, null) { this.name = characterData.Name; this.race = (Race) characterData.Race; this.species = (Species) characterData.Species; this.level = characterData.Level; this.state = UnitState.Alive; this.baseStats = new short[Stats.eLastStat - Stats.eFirstStat + 1]; }
/// <summary> /// Creates a new instance of the <see cref = "MmoObject" /> class. /// </summary> /// <param name="zone"> The <see cref="MmoZone"/> the <see cref="MmoObject"/> belongs to. </param> /// <param name="objectId"> A unique identifier used to distinguish between other <see cref="MmoObject"/>s of this type. </param> /// <param name="type"> The type of the object. </param> /// <param name="familyId"> The family id. This will be the same for all the objects of the same kind. For example, every wolves is of the family wolf. /// Used in quests and combat groups. </param> /// <param name="bounds"> The character bounds </param> /// <param name="properties"> The initial builtProperties. If it is <value>NULL</value> an empty <see cref="Hashtable"/> will be created. </param> /// <remarks> /// <paramref name="objectId"/>, <paramref name="type"/>, and <paramref name="familyId"/> will be compressed into a single <see cref="Guid"/> value. /// This value will (have to) be globally unique accross all <see cref="MmoObject"/>s across all <see cref="MmoZone"/>s, otherwise conflicts will occur. /// </remarks> protected MmoObject(MmoZone zone, ObjectType type, int objectId, short familyId, Bounds bounds, Hashtable properties) { this.eventChannel = new MessageChannel <MmoObjectEventMessage>(); this.disposeChannel = new MessageChannel <MmoObjectDisposedMessage>(); this.positionUpdateChannel = new MessageChannel <MmoObjectPositionMessage>(); this.guid = new MmoGuid((byte)type, objectId, familyId); this.zone = zone; this.transform = new Transform(bounds); this.properties = properties ?? new Hashtable(); this.Revision = this.properties.Count; this.DirtyProperties = PropertyFlags.None; this.Flags = MmoObjectFlags.None; this.hiddenPlayers = new HashSet <MmoGuid>(); }
/// <summary> /// Creates a new instance of the <see cref="QuantumPhysicsWorld"/> class. /// </summary> /// <param name="bounds"></param> /// <param name="world"></param> public QuantumPhysicsWorld(Bounds bounds, MmoZone world) { this.world = world; this.bounds = bounds; this.gravity = new Vector3(0, -9.81f, 0); }
public QuantumCharacterController(MmoZone world, Vector3 position) { this.world = world; this.Position = position; this.Orientation = Quaternion.Identity; }
/// <summary> /// Creates a new <see cref="Dynamic"/> or gets one from the pool /// </summary> public static Dynamic CreateNew(MmoZone world, short familyId) { return(world.DynamicObjectPool.Take(familyId, () => new Dynamic(world, Utils.NewGuidInt32(GuidCreationCulture.Utc), familyId, null))); }
/// <summary> /// Creates a new instance of the <see cref="Dynamic"/> class. /// </summary> public Dynamic(MmoZone zone, int objectId, short familyId, Hashtable properties) : base(zone, ObjectType.Dynamic, objectId, familyId, new Bounds(), properties) { this.Flags = MmoObjectFlags.SendPropertiesOnSubscribe; }