コード例 #1
0
	public override void OnDoubleClick(Mobile from)
	{
		BaseHouse house = BaseHouse.FindHouseAt(this);

		if (from.InRange(this, 2))
		{
			if ((from.AccessLevel >= AccessLevel.Counselor ||
				(house != null && (house.IsOwner(from) || house.IsCoOwner(from)) && house.Contains(this))))
			{
				from.CloseGump(typeof(TourneyStoneUseGump));
				from.SendGump(new TourneyStoneUseGump(from, ((TourneyStoneAddon)Addon)));
			}
			else
				from.SendMessage("You must be the house owner to access that.");
		}
		else
			from.SendMessage("You must be closer. ");


	}
コード例 #2
0
        public bool CheckAccess(Mobile from)
        {
            if (from == null)
            {
                return(false);
            }

            if (!IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null &&
                house.IsCoOwner(from) &&
                house.Contains(this))
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        public override void OnDoubleClick(Mobile from)
        {
            // adam: please see IBlockRazorSearch for a description of ReadyState()
            if (from.InRange(GetWorldLocation(), 2))
            {
                BaseHouse house = BaseHouse.FindHouseAt(this);
                bool      owner = false;
                if (from.AccessLevel >= AccessLevel.GameMaster || (house != null && (house.IsOwner(from) ||
                                                                                     house.IsCoOwner(from)) && house.Contains(this)) ||
                    ((this.RootParent is Mobile) && ((Mobile)this.RootParent == from)))
                {
                    owner = true;
                }

                from.CloseGump(typeof(LibraryGump));
                from.SendGump(new LibraryGump(from, this, owner));
            }
        }
コード例 #4
0
            protected override void OnTarget(Mobile from, object target)
            {
                bool foundAnyone = false;

                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DetectHiddenCooldown * 1000);

                Point3D p;

                if (target is Mobile)
                {
                    p = ((Mobile)target).Location;
                }

                else if (target is Item)
                {
                    p = ((Item)target).Location;
                }

                else if (target is IPoint3D)
                {
                    p = new Point3D((IPoint3D)target);
                }

                else
                {
                    p = from.Location;
                }

                //Boat Searching: Automatic Success for Owner, Co-Owner, Owner
                BaseBoat boat = BaseBoat.FindBoatAt(p, from.Map);

                if (boat != null)
                {
                    if (!boat.Contains(from))
                    {
                        from.SendMessage("You must be onboard this boat in order to search it.");
                        return;
                    }

                    if (boat.IsFriend(from) || boat.IsCoOwner(from) || boat.IsOwner(from))
                    {
                        List <Mobile> m_MobilesOnBoard = boat.GetMobilesOnBoat(false, true);

                        foreach (Mobile mobile in m_MobilesOnBoard)
                        {
                            if (mobile == from)
                            {
                                continue;
                            }

                            if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel)
                            {
                                mobile.RevealingAction();
                                mobile.SendLocalizedMessage(500814); // You have been revealed!

                                foundAnyone = true;
                            }
                        }

                        if (foundAnyone)
                        {
                            from.SendMessage("You reveal what was hidden.");
                        }

                        else
                        {
                            from.SendMessage("You search the decks and find no one hiding onboard.");
                        }
                    }

                    return;
                }

                //House Searching: Automatic Success for Owner, Co-Owner, Owner
                BaseHouse house = BaseHouse.FindHouseAt(p, from.Map, 16);

                if (house != null)
                {
                    if (!house.Contains(from.Location))
                    {
                        from.SendMessage("You must be inside this house in order to search it.");
                        return;
                    }

                    if (house.IsFriend(from) || house.IsCoOwner(from) || house.IsOwner(from))
                    {
                        IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(p, HouseSearchRange);

                        foreach (Mobile mobile in nearbyMobiles)
                        {
                            if (mobile == from)
                            {
                                continue;
                            }

                            BaseHouse mobileHouse = BaseHouse.FindHouseAt(p, from.Map, 16);

                            if (mobile == null || mobileHouse != house)
                            {
                                continue;
                            }

                            if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel)
                            {
                                mobile.RevealingAction();
                                mobile.SendLocalizedMessage(500814); // You have been revealed!

                                foundAnyone = true;
                            }
                        }

                        nearbyMobiles.Free();

                        if (foundAnyone)
                        {
                            from.SendMessage("You reveal what was hidden.");
                        }

                        else
                        {
                            from.SendMessage("You search the home and find no one hiding within.");
                        }
                    }

                    return;
                }

                from.CheckSkill(SkillName.DetectHidden, 0.0, 100.0, 1.0);

                double successChance = (from.Skills[SkillName.DetectHidden].Value / 100);

                int searchRadius = (int)(Math.Floor(from.Skills[SkillName.DetectHidden].Value / 100) * MaxSearchRadius);

                if (Utility.RandomDouble() <= successChance)
                {
                    IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(p, searchRadius);

                    foreach (Mobile mobile in nearbyMobiles)
                    {
                        if (mobile == from)
                        {
                            continue;
                        }

                        if (mobile.Hidden && !mobile.RevealImmune && from.AccessLevel >= mobile.AccessLevel)
                        {
                            mobile.RevealingAction();
                            mobile.SendLocalizedMessage(500814); // You have been revealed!

                            foundAnyone = true;
                        }
                    }

                    nearbyMobiles.Free();

                    if (foundAnyone)
                    {
                        from.SendMessage("You reveal what was hidden.");
                    }

                    else
                    {
                        from.SendMessage("You search the area but find nothing hidden.");
                    }
                }

                else
                {
                    from.SendMessage("You are not certain what lies hidden nearby.");
                    return;
                }
            }