Ejemplo n.º 1
0
        /// <summary>
        /// Loads this door from a door table slot
        /// </summary>
        /// <param name="obj">DBDoor</param>
        public override void LoadFromDatabase(DataObject obj)
        {
            base.LoadFromDatabase(obj);
            DBDoor m_dbdoor = obj as DBDoor;
            if (m_dbdoor == null) return;
            Zone curZone = WorldMgr.GetZone((ushort)(m_dbdoor.InternalID / 1000000));
            if (curZone == null) return;
            this.CurrentRegion = curZone.ZoneRegion;
            m_name = m_dbdoor.Name;
            m_Heading = (ushort)m_dbdoor.Heading;
            m_x = m_dbdoor.X;
            m_y = m_dbdoor.Y;
            m_z = m_dbdoor.Z;
            m_level = 0;
            m_model = 0xFFFF;
            m_doorID = m_dbdoor.InternalID;
            m_guildName = m_dbdoor.Guild;
            m_Realm = (eRealm)m_dbdoor.Realm;
            m_level = m_dbdoor.Level;
            m_health = m_dbdoor.MaxHealth;
            m_maxHealth = m_dbdoor.MaxHealth;
            m_locked = m_dbdoor.Locked;
            m_flags = m_dbdoor.Flags;

            this.AddToWorld();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create dragon's lair after it was loaded from the DB.
 /// </summary>
 /// <param name="obj"></param>
 public override void LoadFromDatabase(DataObject obj)
 {
     base.LoadFromDatabase(obj);
     String[] dragonName = Name.Split(new char[] { ' ' });
     WorldMgr.GetRegion(CurrentRegionID).AddArea(new Area.Circle(String.Format("{0}'s Lair",
         dragonName[0]),
         X, Y, 0, LairRadius + 200));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Set Value to DataObject Field according to ElementBinding
        /// </summary>
        /// <param name="obj">DataObject to Fill</param>
        /// <param name="bind">ElementBinding for the targeted Member</param>
        /// <param name="value">Object Value to Fill</param>
        protected virtual void DatabaseSetValue(DataObject obj, ElementBinding bind, object value)
        {
            if (value == null || value.GetType().IsInstanceOfType(DBNull.Value))
            {
                return;
            }

            try
            {
                if (bind.ValueType == typeof(bool))
                {
                    bind.SetValue(obj, Convert.ToBoolean(value));
                }
                else if (bind.ValueType == typeof(char))
                {
                    bind.SetValue(obj, Convert.ToChar(value));
                }
                else if (bind.ValueType == typeof(sbyte))
                {
                    bind.SetValue(obj, Convert.ToSByte(value));
                }
                else if (bind.ValueType == typeof(short))
                {
                    bind.SetValue(obj, Convert.ToInt16(value));
                }
                else if (bind.ValueType == typeof(int))
                {
                    bind.SetValue(obj, Convert.ToInt32(value));
                }
                else if (bind.ValueType == typeof(long))
                {
                    bind.SetValue(obj, Convert.ToInt64(value));
                }
                else if (bind.ValueType == typeof(byte))
                {
                    bind.SetValue(obj, Convert.ToByte(value));
                }
                else if (bind.ValueType == typeof(ushort))
                {
                    bind.SetValue(obj, Convert.ToUInt16(value));
                }
                else if (bind.ValueType == typeof(uint))
                {
                    bind.SetValue(obj, Convert.ToUInt32(value));
                }
                else if (bind.ValueType == typeof(ulong))
                {
                    bind.SetValue(obj, Convert.ToUInt64(value));
                }
                else if (bind.ValueType == typeof(DateTime))
                {
                    bind.SetValue(obj, Convert.ToDateTime(value));
                }
                else if (bind.ValueType == typeof(float))
                {
                    bind.SetValue(obj, Convert.ToSingle(value));
                }
                else if (bind.ValueType == typeof(double))
                {
                    bind.SetValue(obj, Convert.ToDouble(value));
                }
                else if (bind.ValueType == typeof(string))
                {
                    bind.SetValue(obj, Convert.ToString(value));
                }
                else
                {
                    bind.SetValue(obj, value);
                }
            }
            catch (Exception e)
            {
                if (Log.IsErrorEnabled)
                {
                    Log.ErrorFormat("{0}: {1} = {2} doesnt fit to {3}\n{4}", obj.TableName, bind.ColumnName, value.GetType().FullName, bind.ValueType, e);
                }
            }
        }
Ejemplo n.º 4
0
		public void TestMultipleAddNonRegistered()
		{
			Database.RegisterDataObject(typeof(TestTable));
			var dbo = new DataObject[] { new TestTable { TestField = "Test Multiple Add with some non registered Values" }, new TableNotRegistered() };
			var added = Database.AddObject(dbo);
			Assert.IsFalse(added, "Adding Multiple non registered Object should not return success...");
			Assert.IsFalse(dbo[1].IsPersisted, "Adding a Multiple non registered Object should not have Persisted Flag on unregistered Object...");
			Assert.IsTrue(dbo[0].IsPersisted, "Adding a Multiple non registered Object should have Persisted Flag on registered Object...");
		}
Ejemplo n.º 5
0
        /// <summary>
        /// Loads this boat from a boat table
        /// </summary>
        /// <param name="obj"></param>
        public override void LoadFromDatabase(DataObject obj)
        {
            if (!(obj is DBBoat))
                return;

            m_dbBoat = (DBBoat)obj;
            m_boatID = m_dbBoat.ObjectId;
            m_boatName = m_dbBoat.BoatName;
            m_boatMaxSpeedBase = m_dbBoat.BoatMaxSpeedBase;
            m_boatModel = m_dbBoat.BoatModel;
            m_boatOwner = m_dbBoat.BoatOwner;
            switch (m_boatModel)
            {
                case 1616: m_boatType = 0; break;
                case 2648: m_boatType = 1; break;
                case 2646: m_boatType = 2; break;
                case 2647: m_boatType = 3; break;
                case 1615: m_boatType = 4; break;
                case 1595: m_boatType = 5; break;
                case 1612: m_boatType = 6; break;
                case 1613: m_boatType = 7; break;
                case 1614: m_boatType = 8; break;
            }
            theBoatDB = m_dbBoat;
            base.LoadFromDatabase(obj);
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Loads a merchant from the DB
		/// </summary>
		/// <param name="merchantobject">The merchant DB object</param>
		public override void LoadFromDatabase(DataObject merchantobject)
		{
			base.LoadFromDatabase(merchantobject);
			if (!(merchantobject is Mob)) return;
			Mob merchant = (Mob)merchantobject;
			if (merchant.ItemsListTemplateID != null && merchant.ItemsListTemplateID.Length > 0)
				m_tradeItems = new MerchantTradeItems(merchant.ItemsListTemplateID);
		}
Ejemplo n.º 7
0
		public override void LoadFromDatabase(DataObject obj)
		{
			base.LoadFromDatabase(obj);
			if (!(obj is ItemTemplate)) return;
			ItemTemplate item = (ItemTemplate)obj;
            this.TranslationId = item.TranslationId;
			this.Name = item.Name;
            this.ExamineArticle = item.ExamineArticle;
            this.MessageArticle = item.MessageArticle;
			this.Model = (ushort)item.Model;
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Load a npc from the npc template
		/// </summary>
		/// <param name="obj">template to load from</param>
		public override void LoadFromDatabase(DataObject obj)
		{
			if (obj == null) return;
			base.LoadFromDatabase(obj);
			if (!(obj is Mob)) return;
			m_loadedFromScript = false;
			Mob dbMob = (Mob)obj;
			INpcTemplate npcTemplate = NpcTemplateMgr.GetTemplate(dbMob.NPCTemplateID);
			
			if (npcTemplate != null && !npcTemplate.ReplaceMobValues)
			{
				LoadTemplate(npcTemplate);
			}

			TranslationId = dbMob.TranslationId;
			Name = dbMob.Name;
			Suffix = dbMob.Suffix;
			GuildName = dbMob.Guild;
			ExamineArticle = dbMob.ExamineArticle;
			MessageArticle = dbMob.MessageArticle;
			m_x = dbMob.X;
			m_y = dbMob.Y;
			m_z = dbMob.Z;
			m_Heading = (ushort)(dbMob.Heading & 0xFFF);
			m_maxSpeedBase = (short)dbMob.Speed;
			m_currentSpeed = 0;
			CurrentRegionID = dbMob.Region;
			Realm = (eRealm)dbMob.Realm;
			Model = dbMob.Model;
			Size = dbMob.Size;
			Level = dbMob.Level;	// health changes when GameNPC.Level changes
			Flags = (eFlags)dbMob.Flags;
			m_packageID = dbMob.PackageID;

			Strength = (short)dbMob.Strength;
			Constitution = (short)dbMob.Constitution;
			Dexterity = (short)dbMob.Dexterity;
			Quickness = (short)dbMob.Quickness;
			Intelligence = (short)dbMob.Intelligence;
			Piety = (short)dbMob.Piety;
			Charisma = (short)dbMob.Charisma;
			Empathy = (short)dbMob.Empathy;

			MeleeDamageType = (eDamageType)dbMob.MeleeDamageType;
			if (MeleeDamageType == 0)
			{
				MeleeDamageType = eDamageType.Slash;
			}
			m_activeWeaponSlot = eActiveWeaponSlot.Standard;
			ActiveQuiverSlot = eActiveQuiverSlot.None;

			m_faction = FactionMgr.GetFactionByID(dbMob.FactionID);
			LoadEquipmentTemplateFromDatabase(dbMob.EquipmentTemplateID);

			if (dbMob.RespawnInterval == -1)
			{
				dbMob.RespawnInterval = 0;
			}
			m_respawnInterval = dbMob.RespawnInterval * 1000;

			m_pathID = dbMob.PathID;

			if (dbMob.Brain != "")
			{
				try
				{
					var asms = new List<Assembly>();
					asms.Add(typeof(GameServer).Assembly);
					asms.AddRange(ScriptMgr.Scripts);
					ABrain brain = null;
					foreach (Assembly asm in asms)
					{
						brain = (ABrain)asm.CreateInstance(dbMob.Brain, false);
						if (brain != null)
							break;
					}
					if (brain != null)
						SetOwnBrain(brain);
				}
				catch
				{
					log.ErrorFormat("GameNPC error in LoadFromDatabase: can not instantiate brain of type {0} for npc {1}, name = {2}.", dbMob.Brain, dbMob.ClassType, dbMob.Name);
				}
			}

			IOldAggressiveBrain aggroBrain = Brain as IOldAggressiveBrain;
			if (aggroBrain != null)
			{
				aggroBrain.AggroLevel = dbMob.AggroLevel;
				aggroBrain.AggroRange = dbMob.AggroRange;
				if(aggroBrain.AggroRange == Constants.USE_AUTOVALUES)
				{
					if (Realm == eRealm.None)
					{
						aggroBrain.AggroRange = 400;
						if(Name != Name.ToLower())
						{
							aggroBrain.AggroRange = 500;
						}
						if(CurrentRegion.IsDungeon)
						{
							aggroBrain.AggroRange = 300;
						}
					}
					else
					{
						aggroBrain.AggroRange = 500;
					}
				}
				if(aggroBrain.AggroLevel == Constants.USE_AUTOVALUES)
				{
					aggroBrain.AggroLevel = 0;
					if(Level > 5)
					{
						aggroBrain.AggroLevel = 30;
					}
					if(Name != Name.ToLower())
					{
						aggroBrain.AggroLevel = 30;
					}
					if(Realm != eRealm.None)
					{
						aggroBrain.AggroLevel = 60;
					}
				}
			}

			m_race = (short)dbMob.Race;
			m_bodyType = (ushort)dbMob.BodyType;
			m_houseNumber = (ushort)dbMob.HouseNumber;
			m_maxdistance = dbMob.MaxDistance;
			m_roamingRange = dbMob.RoamingRange;
			m_isCloakHoodUp = dbMob.IsCloakHoodUp;
			m_visibleActiveWeaponSlots = dbMob.VisibleWeaponSlots;
			
			Gender = (eGender)dbMob.Gender;
			OwnerID = dbMob.OwnerID;

			if (npcTemplate != null && npcTemplate.ReplaceMobValues)
				LoadTemplate(npcTemplate);
/*
			if (Inventory != null)
				SwitchWeapon(ActiveWeaponSlot);
*/		}
Ejemplo n.º 9
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		public virtual void LoadFromDatabase(DataObject obj)
		{
			InternalID = obj.ObjectId;
		}
Ejemplo n.º 10
0
        public override void LoadFromDatabase(DataObject mob)
        {
            base.LoadFromDatabase(mob);
            if (GameServer.Database != null)
            {
                var tcmsg = GameServer.Database.FindObjectByKey<TownCrierMessage>(InternalID);

                if (tcmsg != null)
                {
                    m_msg = tcmsg.Message;
                }
            }
        }
Ejemplo n.º 11
0
		/// <summary>
		/// Loads the GameRelic from Database
		/// </summary>
		/// <param name="obj">The DBRelic-object for this relic</param>
		public override void LoadFromDatabase(DataObject obj)
		{
			InternalID = obj.ObjectId;
			m_dbRelic = obj as DBRelic;
			CurrentRegionID = (ushort)m_dbRelic.Region;
			X = m_dbRelic.X;
			Y = m_dbRelic.Y;
			Z = m_dbRelic.Z;
			Heading = (ushort)m_dbRelic.Heading;
			m_relicType = (eRelicType)m_dbRelic.relicType;
			Realm = (eRealm)m_dbRelic.Realm;
			m_originalRealm = (eRealm)m_dbRelic.OriginalRealm;
			m_lastRealm = (eRealm)m_dbRelic.LastRealm;


			//get constant values
			MiniTemp template = GetRelicTemplate(m_originalRealm, m_relicType);
			m_name = template.Name;
			m_model = template.Model;
			template = null;

			//set still empty fields
			Emblem = 0;
			Level = 99;

			//generate itemtemplate for inventoryitem
			ItemTemplate m_itemTemp;
			m_itemTemp = new ItemTemplate();
			m_itemTemp.Name = Name;
			m_itemTemp.Object_Type = (int)eObjectType.Magical;
			m_itemTemp.Model = Model;
			m_itemTemp.IsDropable = true;
			m_itemTemp.IsPickable = false;
			m_itemTemp.Level = 99;
			m_itemTemp.Quality = 100;
			m_itemTemp.Price = 0;
			m_itemTemp.PackSize = 1;
			m_itemTemp.AllowAdd = false;
			m_itemTemp.Weight = 1000;
			m_itemTemp.Id_nb = "GameRelic";
			m_itemTemp.IsTradable = false;
			m_itemTemp.ClassType = "DOL.GS.GameInventoryRelic";
			m_item = GameInventoryItem.Create<ItemTemplate>(m_itemTemp);
		}
Ejemplo n.º 12
0
 /// <summary>
 /// Delete a DataObject from database if deletion is allowed
 /// </summary>
 /// <param name="dataObject">DataObject to Delete from database</param>
 /// <returns>True if the DataObject was deleted.</returns>
 public bool DeleteObject(DataObject dataObject)
 {
     return(DeleteObject(new [] { dataObject }));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Populate or Refresh Object Relations
 /// </summary>
 /// <param name="dataObject">Object to Populate</param>
 public void FillObjectRelations(DataObject dataObject)
 {
     // Interface Call, force Refresh
     FillObjectRelations(new [] { dataObject }, true);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Saves a DataObject to database if saving is allowed and object is dirty
 /// </summary>
 /// <param name="dataObject">DataObject to Save in database</param>
 /// <returns>True is the DataObject was saved.</returns>
 public bool SaveObject(DataObject dataObject)
 {
     return(SaveObject(new [] { dataObject }));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Insert a new DataObject into the database and save it
 /// </summary>
 /// <param name="dataObject">DataObject to Add into database</param>
 /// <returns>True if the DataObject was added.</returns>
 public bool AddObject(DataObject dataObject)
 {
     return(AddObject(new [] { dataObject }));
 }
Ejemplo n.º 16
0
		public void TestMutipleDeleteNonRegistered()
		{
			Database.RegisterDataObject(typeof(TestTable));
			var dbo = new DataObject[] { new TestTable { TestField = "Test Multiple Delete with some non registered Values" }, new TableNotRegistered() };
			var added = Database.AddObject(dbo);
	
			var deleted = Database.DeleteObject(dbo);
			
			Assert.IsFalse(deleted, "Deleting Multiple non registered Object should not return success...");
			Assert.IsTrue(dbo[0].IsDeleted, "Deleting a Collection with non registered Object should set Deleted Flag on registered Object...");
			Assert.IsFalse(dbo[1].IsDeleted, "Deleting a Collection with non registered Object should not set Deleted Flag non-registered Object...");
		}
Ejemplo n.º 17
0
		public void TestMultipleDeleteNull()
		{
			Database.RegisterDataObject(typeof(TestTable));
			var dbo = new DataObject[] { new TestTable { TestField = "Test Multiple Delete with some null Values" }, null };
			Assert.Throws(typeof(NullReferenceException), () => Database.DeleteObject(dbo), "Deleting a Collection with Null Objects Should throw NullReferenceException...");
		}
Ejemplo n.º 18
0
		public void TestMultipleSaveNonRegistered()
		{
			Database.RegisterDataObject(typeof(TestTable));
			var dbo = new DataObject[] { new TestTable { TestField = "Test Multiple Save with some non registered Values" }, new TableNotRegistered() };
			var added = Database.AddObject(dbo);
			
			foreach (var obj in dbo)
				obj.Dirty = true;
			
			var saved = Database.SaveObject(dbo);
			
			Assert.IsFalse(saved, "Saving Multiple non registered Object should not return success...");
			Assert.IsFalse(dbo[0].Dirty, "Saving a Collection with non registered Object should not have Dirty Flag on registered Object...");
			Assert.IsTrue(dbo[1].Dirty, "Saving a Collection with non registered Object should have Dirty Flag on non-registered Object...");
		}
Ejemplo n.º 19
0
        /// <summary>
        /// load the keep door object from DB object
        /// </summary>
        /// <param name="obj"></param>
        public override void LoadFromDatabase(DataObject obj)
        {
            DBDoor door = obj as DBDoor;
            if (door == null)
                return;
            base.LoadFromDatabase(obj);

            Zone curZone = WorldMgr.GetZone((ushort)(door.InternalID / 1000000));
            if (curZone == null) return;
            this.CurrentRegion = curZone.ZoneRegion;
            m_name = door.Name;
            m_Heading = (ushort)door.Heading;
            m_x = door.X;
            m_y = door.Y;
            m_z = door.Z;
            m_level = 0;
            m_model = 0xFFFF;
            m_doorID = door.InternalID;
            m_state = eDoorState.Closed;
            this.AddToWorld();

            foreach (AbstractArea area in this.CurrentAreas)
            {
                if (area is KeepArea)
                {
                    AbstractGameKeep keep = (area as KeepArea).Keep;
                    if (!keep.Doors.Contains(door.InternalID))
                    {
                        Component = new GameKeepComponent();
                        Component.Keep = keep;
                        keep.Doors.Add(door.InternalID, this);
                    }
                    break;
                }
            }

            m_health = MaxHealth;
            StartHealthRegeneration();
            DoorMgr.RegisterDoor(this);
        }
Ejemplo n.º 20
0
		public override void LoadFromDatabase(DataObject obj)
		{
			WorldObject item = obj as WorldObject;
			base.LoadFromDatabase(obj);
			
			m_loadedFromScript = false;
			CurrentRegionID = item.Region;
            TranslationId = item.TranslationId;
			Name = item.Name;
            ExamineArticle = item.ExamineArticle;
			Model = item.Model;
			Emblem = item.Emblem;
			Realm = (eRealm)item.Realm;
			Heading = item.Heading;
			X = item.X;
			Y = item.Y;
			Z = item.Z;
			RespawnInterval = item.RespawnInterval;
		}
Ejemplo n.º 21
0
		/// <summary>
		/// load keep from DB
		/// </summary>
		/// <param name="keep"></param>
		public virtual void LoadFromDatabase(DataObject keep)
		{
			m_dbkeep = keep as DBKeep;
			InternalID = keep.ObjectId;
			m_difficultyLevel[0] = m_dbkeep.AlbionDifficultyLevel;
			m_difficultyLevel[1] = m_dbkeep.MidgardDifficultyLevel;
			m_difficultyLevel[2] = m_dbkeep.HiberniaDifficultyLevel;
			if (m_dbkeep.ClaimedGuildName != null && m_dbkeep.ClaimedGuildName != "")
			{
				Guild myguild = GuildMgr.GetGuildByName(m_dbkeep.ClaimedGuildName);
				if (myguild != null)
				{
					this.m_guild = myguild;
					this.m_guild.ClaimedKeeps.Add(this);
					StartDeductionTimer();
				}
			}
			if (Level < ServerProperties.Properties.MAX_KEEP_LEVEL && m_guild != null)
				StartChangeLevel((byte)ServerProperties.Properties.MAX_KEEP_LEVEL);
			else if (Level <= ServerProperties.Properties.MAX_KEEP_LEVEL && Level > ServerProperties.Properties.STARTING_KEEP_LEVEL && m_guild == null)
				StartChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_LEVEL);
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Set Pre-Cached Object
		/// </summary>
		/// <param name="key">The key object</param>
		/// <param name="obj">The value DataObject</param>
		public void SetPreCachedObject(object key, DataObject obj)
		{
			// Force Case insensitive Storage...
			var stringKey = key as string;
			if (stringKey != null)
				key = stringKey.ToLower();
			
			_precache.AddOrUpdate(key, obj, (k, v) => obj);
		}
Ejemplo n.º 23
0
		/// <summary>
		/// Load the guard from the database
		/// </summary>
		/// <param name="mobobject">The database mobobject</param>
		public override void LoadFromDatabase(DataObject mobobject)
		{
			base.LoadFromDatabase(mobobject);
			foreach (AbstractArea area in this.CurrentAreas)
			{
				if (area is KeepArea)
				{
					AbstractGameKeep keep = (area as KeepArea).Keep;
					Component = new GameKeepComponent();
					Component.AbstractKeep = keep;
					m_dataObjectID = mobobject.ObjectId;
					// mob reload command might be reloading guard, so check to make sure it isn't already added
					if (Component.AbstractKeep.Guards.ContainsKey(m_dataObjectID) == false)
					{
						Component.AbstractKeep.Guards.Add(m_dataObjectID, this);
					}
					break;
				}
			}

			if (Component != null && Component.AbstractKeep != null)
			{
				Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this });
			}
			else
			{
				TemplateMgr.RefreshTemplate(this);
			}
		}
Ejemplo n.º 24
0
		/// <summary>
		/// Loads this alliance from an alliance table
		/// </summary>
		/// <param name="obj"></param>
		public void LoadFromDatabase(DataObject obj)
		{
			if (!(obj is DBAlliance))
				return;

			m_dballiance = (DBAlliance)obj;
		}
Ejemplo n.º 25
0
		/// <summary>
		/// Loads the GameRelic from Database
		/// </summary>
		/// <param name="obj">The DBRelic-object for this relic</param>
		public override void LoadFromDatabase(DataObject obj)
		{
			InternalID = obj.ObjectId;
			m_dbRelic = obj as DBMinotaurRelic;
			RelicID = m_dbRelic.RelicID;

			Heading = (ushort)m_dbRelic.SpawnHeading;
			CurrentRegionID = (ushort)m_dbRelic.SpawnRegion;
			X = m_dbRelic.SpawnX;
			Y = m_dbRelic.SpawnY;
			Z = m_dbRelic.SpawnZ;

			SpawnHeading = m_dbRelic.SpawnHeading;
			SpawnRegion = m_dbRelic.SpawnRegion;
			Effect = m_dbRelic.Effect;
			SpawnX = m_dbRelic.SpawnX;
			SpawnY = m_dbRelic.SpawnY;
			SpawnZ = m_dbRelic.SpawnZ;

			RelicSpellID = m_dbRelic.relicSpell;
			RelicSpell = SkillBase.GetSpellByID(m_dbRelic.relicSpell);
			RelicTarget = m_dbRelic.relicTarget;

			Name = m_dbRelic.Name;
			Model = m_dbRelic.Model;

			XP = MinotaurRelicManager.MAX_RELIC_EXP;

            ProtectorClassType = m_dbRelic.ProtectorClassType;
            SpawnLocked = m_dbRelic.SpawnLocked;

			//set still empty fields
			Emblem = 0;
			Level = 99;
		}
Ejemplo n.º 26
0
		/// <summary>
		/// Set Pre-Cached Object
		/// </summary>
		/// <param name="key">The key object</param>
		/// <param name="obj">The value DataObject</param>
		public void SetPreCachedObject(object key, DataObject obj)
		{
			_precache[key] = obj;
		}
Ejemplo n.º 27
0
		/// <summary>
		/// load the keep door object from DB object
		/// </summary>
		/// <param name="obj"></param>
		public override void LoadFromDatabase(DataObject obj)
		{
			DBDoor door = obj as DBDoor;
			if (door == null)
				return;
			base.LoadFromDatabase(obj);

			Zone curZone = WorldMgr.GetZone((ushort)(door.InternalID / 1000000));
			if (curZone == null) return;
			this.CurrentRegion = curZone.ZoneRegion;
			m_name = door.Name;
			m_Heading = (ushort)door.Heading;
			m_x = door.X;
			m_y = door.Y;
			m_z = door.Z;
			m_level = 0;
			m_model = 0xFFFF;
			m_doorID = door.InternalID;
			m_state = eDoorState.Closed;
			this.AddToWorld();

			m_health = MaxHealth;
			StartHealthRegeneration();
		}
Ejemplo n.º 28
0
		/// <summary>
		/// Set Cache Object
		/// </summary>
		/// <param name="key">The key object</param>
		/// <param name="obj">The value DataObject</param>
		public void SetCacheObject(object key, DataObject obj)
		{
			_cache[key] = obj;
		}
Ejemplo n.º 29
0
		public override void LoadFromDatabase(DataObject obj)
		{
			base.LoadFromDatabase(obj);
			foreach (AbstractArea area in this.CurrentAreas)
			{
				if (area is KeepArea)
				{
					AbstractGameKeep keep = (area as KeepArea).Keep;
					Component = new GameKeepComponent();
					Component.AbstractKeep = keep;
					Component.AbstractKeep.Banners.Add(obj.ObjectId, this);
					if (this.Model == AlbionGuildModel || this.Model == MidgardGuildModel || this.Model == HiberniaGuildModel)
						BannerType = eBannerType.Guild;
					else BannerType = eBannerType.Realm;
					if (BannerType == eBannerType.Guild && Component.AbstractKeep.Guild != null)
						ChangeGuild();
					else ChangeRealm();
					break;
				}
			}
		}
Ejemplo n.º 30
0
		/// <summary>
		/// Load the guard from the database
		/// </summary>
		/// <param name="mobobject">The database mobobject</param>
		public override void LoadFromDatabase(DataObject mobobject)
		{
			base.LoadFromDatabase(mobobject);
			foreach (AbstractArea area in this.CurrentAreas)
			{
				if (area is KeepArea)
				{
					AbstractGameKeep keep = (area as KeepArea).Keep;
					Component = new GameKeepComponent();
					Component.Keep = keep;
					m_dataObjectID = mobobject.ObjectId;
					Component.Keep.Guards.Add(m_dataObjectID, this);
					break;
				}
			}

			if (Component != null && Component.Keep != null)
			{
				Component.Keep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this });
			}
			else
			{
				TemplateMgr.RefreshTemplate(this);
			}
		}