예제 #1
0
		/// <summary>
		/// The unit who is currently using the GO
		/// </summary>
		//public Unit User
		//{
		//    get
		//    {
		//        return m_user;
		//    }
		//}

		/// <summary>
		/// Whether this GO can be used by the given user
		/// </summary>
		/// <param name="chr"></param>
		/// <returns></returns>
		public bool CanBeUsedBy(Character chr)
		{
			if (chr.GodMode)
			{
				return true;
			}

			// must be enabled
			if (!chr.CanSee(m_go) || m_go.State == GameObjectState.Disabled)
			{
				return false;
			}

			// must have the right Faction (if limited to either side)
			if (m_go.Faction != Faction.NullFaction && m_go.Faction.Group != chr.Faction.Group)
			{
				return false;
			}

			// Check for Group-requirements
			if (m_go.Entry.IsPartyOnly && m_go.Owner != null && !m_go.Owner.IsAlliedWith(chr))
			{
				return false;
			}

			var unit = chr;
			if (!unit.IsAlive)
			{
				return false;
			}
			if (!unit.CanInteract)
			{
				return false;
			}

			return m_go.IsInRadiusSq(chr, GOMgr.DefaultInteractDistanceSq);
			// && m_go.IsInFrontOf(obj);
		}
예제 #2
0
파일: NPC.cs 프로젝트: 0xFh/Asda2-Project
        /// <summary>
        ///   Also sends a message to the Character, if not valid
        /// </summary>
        internal bool CheckVendorInteraction(Character chr)
        {
            if (chr.Map != m_Map ||
                !IsInRadiusSq(chr, NPCMgr.DefaultInteractionDistanceSq) ||
                !chr.CanSee(this))
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.TooFarAway);
                return(false);
            }

            if (!IsAlive)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.VendorDead);
                return(false);
            }

            if (chr.IsAlive == IsSpiritHealer)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.YouDead);
                return(false);
            }

            if (!chr.CanInteract || !CanInteract)
            {
                return(false);
            }

            var reputation = chr.Reputations.GetOrCreate(Faction.ReputationIndex);

            if (reputation != null && !reputation.CanInteract)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.BadRep);
                return(false);
            }

            return(true);
        }
예제 #3
0
파일: NPC.cs 프로젝트: ebakkedahl/WCell
        /// <summary>
        /// Also sends a message to the Character, if not valid
        /// </summary>
        internal bool CheckVendorInteraction(Character chr)
        {
            if (chr.Map != m_Map ||
                !IsInRadiusSq(chr, NPCMgr.DefaultInteractionDistanceSq) ||
                !chr.CanSee(this))
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.TooFarAway);
                return false;
            }

            if (!IsAlive)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.VendorDead);
                return false;
            }

            if (chr.IsAlive == IsSpiritHealer)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.YouDead);
                return false;
            }

            if (!chr.CanInteract || !CanInteract)
            {
                return false;
            }

            var reputation = chr.Reputations.GetOrCreate(Faction.ReputationIndex);
            if (reputation != null && !reputation.CanInteract)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.BadRep);
                return false;
            }

            return true;
        }
예제 #4
0
파일: NPC.cs 프로젝트: WCellFR/WCellFR
		public bool CanInteractWith(Character chr)
		{
			if (chr.Region != m_region ||
				!IsInRadiusSq(chr, NPCMgr.DefaultInteractionDistanceSq) ||
				!chr.CanSee(this))
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.TooFarAway);
				return false;
			}

			if (chr.IsAlive == IsSpiritHealer)
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.YouDead);
				return false;
			}

			if (chr.IsOnTaxi || m_isInCombat || IsOnTaxi)
			{
				return false;
			}

			if (!chr.CanInteract || !CanInteract)
			{
				return false;
			}

			var reputation = chr.Reputations.GetOrCreate(Faction.ReputationIndex);
			if (reputation != null && !reputation.CanInteract)
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.BadRep);
				return false;
			}

			return true;
		}