예제 #1
0
		/// <summary>
		/// Creates a new GameObject with the given parameters
		/// </summary>
		public static GameObject Create(GOEntry entry, IWorldLocation where, GOSpawnEntry spawnEntry = null, GOSpawnPoint spawnPoint = null)
		{
			var go = entry.GOCreator();
			var handlerCreator = entry.HandlerCreator;
			go.Init(entry, spawnEntry, spawnPoint);
			if (handlerCreator != null)
			{
				go.Handler = handlerCreator();
			}
			else
			{
				log.Warn("GOEntry {0} did not have a HandlerCreator set - Type: {1}", entry, entry.Type);
				go.Delete();
				return null;
			}
			go.Phase = where.Phase;
			var pos = where.Position;
			if (spawnPoint == null)
			{
				pos.Z = where.Map.Terrain.GetGroundHeightUnderneath(pos);
			}
			where.Map.AddObject(go, ref pos);

			go.MarkUpdate(GameObjectFields.DYNAMIC);
			return go;
		}
예제 #2
0
		internal override void Init(GOEntry entry, GOSpawnEntry spawnEntry, GOSpawnPoint spawnPoint)
		{
			base.Init(entry, spawnEntry, spawnPoint);

			m_goTransportEntry = Entry as GOMOTransportEntry;
			TransportMgr.TransportEntries.TryGetValue(m_entry.GOId, out m_transportEntry);
			m_isMOTransport = m_goTransportEntry != null && m_transportEntry != null;
		}
예제 #3
0
        protected ArathiBase(ArathiBasin instance, GOEntry flagstand)
        {
            Instance = instance;

            Instance.RegisterUpdatableLater(StartScoreTimer);
            Instance.RegisterUpdatableLater(CaptureTimer);

            SpawnNeutral();
        }
예제 #4
0
파일: AVTower.cs 프로젝트: NVN/WCell
        protected AlteracTower(AlteracValley instance, GOEntry flagstand)
        {
            Instance = instance;
            FlagStand = flagstand;
            if (WarmasterEntry != null) WarmasterEntry.Activated += (warmaster) =>
                                                                        {
                                                                            Warmaster = warmaster;
                                                                        };

        }
예제 #5
0
		public GOTemplate(GOEntry entry, GameObjectState state, 
			MapId mapId, ref Vector3 pos, float orientation, float scale, float[] rotations)
		{
			//Id = id;
			Entry = entry;
			EntryId = entry.GOId;
			State = state;
			MapId = mapId;
			Pos = pos;
			Orientation = orientation;
			Scale = scale;
			Rotations = rotations;
		}
예제 #6
0
#pragma warning restore 0649

		#endregion

		protected WSGFaction(WarsongGulch instance,
			SpellId flagSpell,
			SpellId flagDropSpell,
			SpellId flagDropDebuff,
			SpellId flagCarrierDebuffSpellId,
			GOEntryId flagStand,
			GOEntryId flagDropId)
		{
			Instance = instance;
			_flagSpell = SpellHandler.Get(flagSpell);
			_flagDropSpell = SpellHandler.Get(flagDropSpell);
			_flagDropDebuff = SpellHandler.Get(flagDropDebuff);
			_flagCarrierDebuffSpell = SpellHandler.Get(flagCarrierDebuffSpellId);
			FlagStandEntry = GOMgr.GetEntry(flagStand);
			DroppedFlagEntry = GOMgr.GetEntry(flagDropId);

			_flagRespawn = WarsongGulch.FlagRespawnTime;
			Score = 0;
		}
예제 #7
0
파일: ArathiBase.cs 프로젝트: NVN/WCell
		protected ArathiBase(ArathiBasin instance, GOEntry flagstand)
		{
			Instance = instance;

			// init timers
			CaptureTimer = new TimerEntry(dt =>
			{
				Capture();
			});

			StartScoreTimer = new TimerEntry(dt =>
			{
				GivesScore = true;
			});

			Instance.RegisterUpdatableLater(StartScoreTimer);
			Instance.RegisterUpdatableLater(CaptureTimer);

			// TODO: flagstand?
			SpawnNeutral();
		}
예제 #8
0
        public static void SendGameObjectInfo(IRealmClient client, GOEntry entry)
        {
            var name = entry.Names.Localize(client);
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_QUERY_RESPONSE,
                                                   13 + 6 + name.Length + (24 * 4)))
            {
                packet.Write(entry.Id);
                packet.Write((uint)entry.Type);
                packet.Write(entry.DisplayId);
                packet.Write(name);
                packet.Write((byte)0); // Name2
                packet.Write((byte)0); // Name3
                packet.Write((byte)0); // Name4
                packet.Write((byte)0); // string IconName
                packet.Write((byte)0); // string. Casting bar text
                packet.Write((byte)0); // string

                int i = 0;
                for (; i < entry.Fields.Length; i++)
                {
                    packet.Write(entry.Fields[i]);
                }

                // must be 24 fields
                while (i < GOConstants.EntryFieldCount)
                {
                    packet.Write(0);
                    i++;
                }

                packet.Write(entry.Scale); // size

                for (i = 0; i < 4; i++)
                {
                    packet.Write(0); // new 3.1
                }

                client.Send(packet);
            }
        }
예제 #9
0
파일: GameObject.cs 프로젝트: ray2006/WCell
		/// <summary>
		/// Initialize the GO
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="templ"></param>
		internal virtual void Init(GOEntry entry, GOTemplate templ)
		{
			EntityId = EntityId.GetGameObjectId((uint)Interlocked.Increment(ref _lastGOUID), entry.GOId);
			Type |= ObjectTypes.GameObject;
			//DynamicFlagsLow = GameObjectDynamicFlagsLow.Activated;
			m_entry = entry;
			m_template = templ;

			DisplayId = entry.DisplayId;
			EntryId = entry.Id;
			GOType = entry.Type;
			Flags = m_entry.Flags;
			m_faction = m_entry.Faction ?? Faction.NullFaction;
			ScaleX = m_entry.DefaultScale;

			if (templ != null)
			{
				Phase = templ.PhaseMask;
				State = templ.State;
				if (templ.Scale != 1)
				{
					ScaleX = templ.Scale;
				}
				Orientation = templ.Orientation;
				AnimationProgress = templ.AnimProgress;
				SetRotationFields(templ.Rotations);
			}

			m_entry.InitGO(this);
		}
예제 #10
0
파일: GameObject.cs 프로젝트: ray2006/WCell
		/// <summary>
		/// Creates a new GameObject with the given parameters
		/// </summary>
		public static GameObject Create(GOEntry entry, GOTemplate templ)
		{
			var go = entry.GOCreator();
			var handlerCreator = entry.HandlerCreator;
			go.Init(entry, templ); 
			if (handlerCreator != null)
			{
				go.Handler = handlerCreator();
			}
			else
			{
				log.Warn("GOEntry {0} did not have a HandlerCreator set - Type: {1}", entry, entry.Type);
				go.Delete();
				return null;
			}
			return go;
		}
예제 #11
0
		public static GameObject Create(GOEntry entry, Map map, GOSpawnEntry spawnEntry = null, GOSpawnPoint spawnPoint = null)
		{
			return Create(entry, new WorldLocation(map, Vector3.Zero), spawnEntry, spawnPoint);
		}
예제 #12
0
		/// <summary>
		/// Initialize the GO
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="templ"></param>
		internal virtual void Init(GOEntry entry, GOSpawnEntry spawnEntry, GOSpawnPoint spawnPoint)
		{
			EntityId = EntityId.GetGameObjectId((uint)Interlocked.Increment(ref _lastGOUID), entry.GOId);
			Type |= ObjectTypes.GameObject;
			//DynamicFlagsLow = GameObjectDynamicFlagsLow.Activated;
			m_entry = entry;
			m_spawnPoint = spawnPoint;

			DisplayId = entry.DisplayId;
			EntryId = entry.Id;
			GOType = entry.Type;
			Flags = m_entry.Flags;
			m_faction = m_entry.Faction ?? Faction.NullFaction;
			ScaleX = m_entry.Scale;
			GossipMenu = entry.DefaultGossip;

			if (QuestHolderInfo != null && GossipMenu == null)
			{
				// make sure, there is a GossipMenu that allows the player to start/finish quests
				GossipMenu = new GossipMenu();
			}

			spawnEntry = spawnEntry ?? entry.FirstSpawnEntry;
			if (spawnEntry != null)
			{
				Phase = spawnEntry.Phase;
				State = spawnEntry.State;
				if (spawnEntry.Scale != 1)
				{
					ScaleX = spawnEntry.Scale;
				}
				Orientation = spawnEntry.Orientation;
				AnimationProgress = spawnEntry.AnimProgress;
				SetRotationFields(spawnEntry.Rotations);
			}

			m_entry.InitGO(this);
		}
예제 #13
0
		public static void InitGOs()
		{
			GOEntry rhahkzorDoorEntry = GOMgr.GetEntry(GOEntryId.FactoryDoor);		// 13965

			if (rhahkzorDoorEntry != null)
			{
				rhahkzorDoorEntry.Activated += go =>
				{
					var instance = go.Map as Deadmines;
					if (instance != null && instance.rhahkzorDoor == null)
					{
						// set the instance's Door object after the Door spawned
						instance.rhahkzorDoor = go;
					}
				};
			}

			GOEntry sneedDoorEntry = GOMgr.GetEntry(GOEntryId.HeavyDoor);
			var sneedDoorCord = new Vector3(-290.294f, -536.96f, 49.4353f);
			if (sneedDoorEntry != null)
			{
				sneedDoorEntry.Activated += go =>
				{
					var instance = go.Map as Deadmines;
					if (instance != null)
					{
						// set the instance's Door object after the Door spawned
						instance.sneedDoor = go.Map.GetNearestGameObject(sneedDoorCord, (GOEntryId)sneedDoorEntry.Id);
					}
				};
			}

			GOEntry gilnidDoorEntry = GOMgr.GetEntry(GOEntryId.HeavyDoor);
			var gilnidDoorCord = new Vector3(-168.514f, -579.861f, 19.3159f);
			if (gilnidDoorEntry != null)
			{
				gilnidDoorEntry.Activated += go =>
				{
					var instance = go.Map as Deadmines;
					if (instance != null)
					{
						// set the instance's Door object after the Door spawned
						instance.gilnidDoor = go.Map.GetNearestGameObject(gilnidDoorCord, (GOEntryId)gilnidEntry.Id);
					}
				};
			}

			// Cannon
			defiasCannonEntry = GOMgr.GetEntry(GOEntryId.DefiasCannon);

			defiasCannonEntry.Used += (cannon, user) =>
			{
				GameObject door = cannon.GetNearbyGO(GOEntryId.IronCladDoor);
				if (door != null && door.IsInWorld)
				{
					// the cannon destroys the door
					door.State = GameObjectState.Destroyed;
					door.CallDelayed(5000, obj => obj.Delete());	// delete the actual object a little later
					return true;
				}
				return false;
			};
		}
예제 #14
0
파일: GameObject.cs 프로젝트: MeaNone/WCell
		/// <summary>
		/// Initialize the GO
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="templ"></param>
		internal virtual void Init(GOEntry entry, GOSpawnEntry spawnEntry, GOSpawnPoint spawnPoint)
		{
			EntityId = EntityId.GetGameObjectId((uint)Interlocked.Increment(ref _lastGOUID), entry.GOId);
			Type |= ObjectTypes.GameObject;
			//DynamicFlagsLow = GameObjectDynamicFlagsLow.Activated;
			m_entry = entry;
			m_spawnPoint = spawnPoint;

			DisplayId = entry.DisplayId;
			EntryId = entry.Id;
			GOType = entry.Type;
			Flags = m_entry.Flags;
			m_faction = m_entry.Faction ?? Faction.NullFaction;
			ScaleX = m_entry.Scale;

			spawnEntry = spawnEntry ?? entry.FirstSpawnEntry;
			if (spawnEntry != null)
			{
				Phase = spawnEntry.Phase;
				State = spawnEntry.State;
				if (spawnEntry.Scale != 1)
				{
					ScaleX = spawnEntry.Scale;
				}
				Orientation = spawnEntry.Orientation;
				AnimationProgress = spawnEntry.AnimProgress;
				SetRotationFields(spawnEntry.Rotations);
			}

			m_entry.InitGO(this);
		}
예제 #15
0
파일: GameObject.cs 프로젝트: MeaNone/WCell
		/// <summary>
		/// Creates a new GameObject with the given parameters
		/// </summary>
		public static GameObject Create(GOEntry entry, IWorldLocation where, GOSpawnEntry spawnEntry = null, GOSpawnPoint spawnPoint = null)
		{
			var go = entry.GOCreator();
			var handlerCreator = entry.HandlerCreator;
			go.Init(entry, spawnEntry, spawnPoint);
			if (handlerCreator != null)
			{
				go.Handler = handlerCreator();
			}
			else
			{
				log.Warn("GOEntry {0} did not have a HandlerCreator set - Type: {1}", entry, entry.Type);
				go.Delete();
				return null;
			}
			go.Phase = where.Phase;
			var pos = where.Position;
			where.Map.AddObject(go, ref pos);
			return go;
		}