当前位置: 首页>>代码示例>>C#>>正文


C# Entities.NPC类代码示例

本文整理汇总了C#中WCell.RealmServer.Entities.NPC的典型用法代码示例。如果您正苦于以下问题:C# NPC类的具体用法?C# NPC怎么用?C# NPC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NPC类属于WCell.RealmServer.Entities命名空间,在下文中一共展示了NPC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveMob

		public void RemoveMob(NPC npc)
		{
			if (m_Mobs.Remove(npc))
			{
				npc.Group = null;
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:7,代码来源:AIGroup.cs

示例2: SendBattlegroundWindow

        /// <summary>
        /// Sends the packet to show the battleground window
        /// </summary>
        /// <param name="client"></param>
        /// <param name="speaker"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
            {
                packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0);
                packet.WriteUInt((uint)m_bgqueue.Template.BgID);
                packet.WriteByte(m_battlegroupId); //Battle group
				// TODO: Add sync'ing?
                //m_syncLock.EnterReadLock();
                try
                {
                    packet.WriteUInt(m_battlegrounds.Count); //Count

                    foreach (var bg in m_battlegrounds.Values)
                    {
                        packet.WriteUInt(bg.InstanceId);
                    }
                }
                finally
                {
                    //m_syncLock.ExitReadLock();
                }
                client.Send(packet);
                return true;
            }
        }
开发者ID:pallmall,项目名称:WCell,代码行数:33,代码来源:BattleRange.cs

示例3: RepairItem

		public static void RepairItem(IRealmClient client, NPC armorer, EntityId itemId, bool useGuildFunds)
		{
			var curChar = client.ActiveCharacter;

			uint totalCost = 0;
			if (itemId.Low != 0)
			{
				// Repairing an individual item.
				var item = GetItemByEntityId(curChar, itemId);
				if (item == null)
					return;
				if (!ArmorerCheatChecks(curChar, armorer, item))
					return;
				totalCost += RepairItem(curChar, armorer, item, useGuildFunds);
			}
			else
			{
				// Case Repair all
				if (!ArmorerCheatChecks(curChar, armorer))
					return;
				totalCost += RepairAllItems(curChar, armorer, useGuildFunds);
			}

			if (useGuildFunds)
			{
				/****************************
				 * TODO: record the funds usage in the guild log
				 ****************************/
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:30,代码来源:ArmorerMgr.cs

示例4: Apply

		protected internal override void Apply()
		{
			npc = (NPC)m_aura.Auras.Owner;
			if (caster != null && caster.IsInWorld)
			{
				npc.ThreatCollection.Taunter = caster;
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:8,代码来源:ModTaunt.cs

示例5: UnworthyInitiateActivated

		private static void UnworthyInitiateActivated(NPC npc)
		{
			npc.StandState = StandState.Kneeling;
			npc.AddMessage(
				() =>
					{
						var nearest = npc.GetNearbyNPC(NPCId.UnworthyInitiateAnchor, 7);
						if (nearest == null) return;
						nearest.SpellCast.Trigger(SpellId.ChainedPeasantChest, npc);
					});
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:11,代码来源:DKAcherusCorrections.cs

示例6: RepairAllItems

		private static uint RepairAllItems(Character curChar, NPC armorer, bool useGuildFunds)
		{
			uint totalCost = 0;

			// Repair all items in the Backpack and Bags
			curChar.Inventory.Iterate(false, invItem => {
				if (invItem.MaxDurability > 0)
					totalCost += RepairItem(curChar, armorer, invItem, useGuildFunds);
				return true;
			});
			return totalCost;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:12,代码来源:ArmorerMgr.cs

示例7: PrepareEncounter

		/// <summary>
		/// Prepare Svala and Artha's Mirror
		/// </summary>
		void PrepareEncounter(NPC svala)
		{
			m_svala = svala;

			m_arthasMirror = arthasMirrorEntry.Create(DifficultyIndex);
			m_arthasMirror.Orientation = 1.58825f;
			AddObject(m_arthasMirror, arthasPosition);

			// big bosses are idle
			m_arthasMirror.Brain.State = BrainState.Idle;
			svala.Brain.State = BrainState.Idle;
		}
开发者ID:Zerant,项目名称:WCell,代码行数:15,代码来源:UtgardePinnacle.cs

示例8: TestBrain

		public TestBrain(NPC owner) : base(owner)
		{
			var spawn = owner.SpawnPoint;
			if (spawn != null)
			{
				var spawnEntry = spawn.SpawnEntry;

				if (spawnEntry != null)
				{
					m_waypoints = spawnEntry.Waypoints;
				}
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:13,代码来源:TestBrain.cs

示例9: SendMirrorImageData

		public static void SendMirrorImageData(IRealmClient client, NPC mirrorimage)
		{
			var owner = mirrorimage.PlayerOwner;

			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MIRRORIMAGE_DATA, 68))
			{
				packet.Write(mirrorimage.EntityId);
				packet.Write(owner.DisplayId);
				if (owner != null) //player
				{
					packet.Write((byte)owner.Race);
					packet.Write((byte)owner.Gender);
					packet.Write((byte)owner.Class);
					packet.Write(owner.Skin);
					packet.Write(owner.Facial);
					packet.Write(owner.HairStyle);
					packet.Write(owner.HairColor);
					packet.Write(owner.FacialHair);
					packet.Write(owner.GuildId);

					foreach(VisibleEquipmentSlot slot in Enum.GetValues(typeof(VisibleEquipmentSlot)))
					{
						var item = owner.Inventory.Equipment[(EquipmentSlot)slot];
						if (slot == VisibleEquipmentSlot.Head && ((owner.PlayerFlags & PlayerFlags.HideHelm) != 0))
						{
							packet.Write(0);
						}
						else if (slot == VisibleEquipmentSlot.Back && ((owner.PlayerFlags & PlayerFlags.HideCloak) != 0))
						{
							packet.Write(0);
						}
						else if (item != null)
						{
							packet.Write(item.Template.DisplayId);
						}
						else
							packet.Write(0);
					}
					
				}
				else //creature
				{
					for (int i = 0; i < 14; i++)
					{
						packet.Write(0);
					}

				}
				client.Send(packet);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:51,代码来源:MirrorImageHandler.cs

示例10: NPCSpellCollection

		public NPCSpellCollection(NPC owner)
			: base(owner, false)
		{
			m_byId = owner.Entry.Spells;
			m_readySpells = new List<Spell>();
			if (m_byId != null)
			{
				m_defaultSpells = true;
				foreach (var spell in m_byId.Values)
				{
					AddReadySpell(spell);
					OnNewSpell(spell);
				}
			}
			else
			{
				m_defaultSpells = false;
				m_byId = new Dictionary<uint, Spell>(5);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:20,代码来源:NPCSpellCollection.cs

示例11: VendorEntry

        public VendorEntry(NPC npc, List<VendorItemEntry> items)
        {
            NPC = npc;

            if (items != null)
            {
                foreach (var item in items)
                {
                    ItemsForSale.Add(new VendorItemEntry
                    {
                        BuyStackSize = item.BuyStackSize,
                        RemainingStockAmount = item.RemainingStockAmount,
                        ExtendedCostEntry = NPCMgr.ItemExtendedCostEntries[(int)item.ExtendedCostId],
                        StockAmount = item.StockAmount,
                        StockRefillDelay = item.StockRefillDelay,
                        Template = item.Template
                    });
                }
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:20,代码来源:VendorEntry.cs

示例12: GetSkeletonIndex

		/// <summary>
		/// Returns the index of the given skeleton for the skeleton arrays
		/// </summary>
		static int GetSkeletonIndex(NPC skel)
		{
			if (skel.SpawnPoint == null)
			{
				// unrelated Skeleton
				return -1;
			}

			for (var i = 0; i < PrinceSkeletonSpawnEntries.Length; i++)
			{
				var spawn = PrinceSkeletonSpawnEntries[i];
				if (spawn == skel.SpawnPoint.SpawnEntry)
				{
					return i;
				}
			}

			// unrelated Skeleton
			return -1;
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:23,代码来源:UtgardeKeep.cs

示例13: OnBeforeAmbusherDeath

		private static bool OnBeforeAmbusherDeath(NPC ambusher)
		{
			if (ambusher.FirstAttacker is Character)
			{
				var killer = (Character)ambusher.FirstAttacker;
				if (!killer.QuestLog.HasActiveQuest(AmbusherQuest))
				{
					// quest isn't active
					return true;
				}

				// say something
				ambusher.Say("Oh kind sir, please don't kill me!");

				// discarded the idea of the backstabber:
				//ambusher.MoveBehindThenExecute(killer,
				//    attacker => attacker.SpellCast.Start(SpellId.ClassSkillBackstabRank1, false, killer));

				// cast some AoE spell (ignoring all restrictions)
				ambusher.SpellCast.Trigger(SpellId.ClassSkillFrostNovaRank6);

				// Is now friendly with everyone
				ambusher.FactionId = FactionId.Friendly;

				// more health than ever before (not necessary here)
				ambusher.BaseHealth = ambusher.Health = 100000;

				// won't do anything stupid anymore
				ambusher.Brain.DefaultState = BrainState.Idle;
				ambusher.Brain.EnterDefaultState();

				// never leave the killer alone: Approach again and again...
				ambusher.CallPeriodically(2000,
					obj => SeekForgiveness(ambusher, killer));

				return false; 		// return false to indicate that the guy didn't die
			}
			return true;			// die
		}
开发者ID:remixod,项目名称:netServer,代码行数:39,代码来源:AmbusherQuestSample.cs

示例14: OnMinionDied

		internal protected virtual void OnMinionDied(NPC minion)
		{
		}
开发者ID:ray2006,项目名称:WCell,代码行数:3,代码来源:Unit.cs

示例15: Enslave

		public void Enslave(NPC minion, int durationMillis)
		{
			//Enslave(minion, durationMillis != 0 ? DateTime.Now.AddMilliseconds(durationMillis) : (DateTime?)null);

			minion.Phase = Phase;
			minion.Master = this;

			var type = minion.Entry.Type;
			if (type != CreatureType.None && type != CreatureType.NotSpecified)
			{
				if (type == CreatureType.NonCombatPet)
				{
					minion.Brain.DefaultState = BrainState.Follow;
				}
				else if (type == CreatureType.Totem)
				{
					// can't move
					minion.Brain.DefaultState = BrainState.Roam;
				}
				else
				{
					minion.Brain.DefaultState = BrainState.Guard;
				}

				minion.Brain.EnterDefaultState();
			}

			if (durationMillis != 0)
			{
				// ReSharper disable PossibleLossOfFraction
				minion.RemainingDecayDelay = durationMillis / 1000;
				// ReSharper restore PossibleLossOfFraction
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:34,代码来源:Unit.cs


注:本文中的WCell.RealmServer.Entities.NPC类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。