Exemplo n.º 1
0
 public override void OnMovement(Mobile from, Point3D oldLocation)
 {
     if (from.InRange(this, 3) && from is PlayerMobile)
     {
         if (!from.HasGump(typeof(PopUpGump)))
             from.SendGump(new PopUpGump(Name));
     }
     if (!from.InRange(this, 3) && from is PlayerMobile)
     {
         if (from.HasGump(typeof(PopUpGump)))
             from.CloseGump(typeof(PopUpGump));
     }
 }
Exemplo n.º 2
0
		public void TryTalkTo( Mobile from, bool fromClick )
		{
			if ( !from.Hidden && !from.HasGump( typeOfRaceChangeConfirmGump ) && !RaceChangeConfirmGump.IsPending( from.NetState ) && CanTalkTo( from ) )
				TalkTo( from as PlayerMobile );
			else if ( fromClick )
				DenyTalk( from );
		}
Exemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (this.Parent != null || !this.VerifyMove(from))
                return;

            if (!from.InRange(this, 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;
            }

            if (this.ItemID == 0xA57) // rolled
            {
                Direction dir = PlayerMobile.GetDirection4(from.Location, this.Location);

                if (dir == Direction.North || dir == Direction.South)
                    this.ItemID = 0xA55;
                else
                    this.ItemID = 0xA56;
            }
            else // unrolled
            {
                this.ItemID = 0xA57;

                if (!from.HasGump(typeof(LogoutGump)))
                {
                    CampfireEntry entry = Campfire.GetEntry(from);

                    if (entry != null && entry.Safe)
                        from.SendGump(new LogoutGump(entry, this));
                }
            }
        }
Exemplo n.º 4
0
		protected override void OnTargetFinish( Mobile from )
		{
			if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) )
			{
				if ( from.HasGump( typeof( MainPlantGump ) ) )
					from.CloseGump( typeof( MainPlantGump ) );

				from.SendGump( new MainPlantGump( m_Plant ) );
			}
		}
Exemplo n.º 5
0
 public override void OnDoubleClick(Mobile from)
 {
     //Fix for crash when 2 gumps opened simultainously
     if (from.HasGump(typeof(Suggestion)))
     {
         from.SendMessage("You already have a suggestion open, please finish with that one before opening a new one!");
         return;
     }
     //End fix for crash
     from.SendGump(new Suggestion());
 }
		public override void OnDoubleClick( Mobile from )
		{

			if ( !from.HasGump( typeof( PSCreditsGump ) ) )
				{
					from.SendGump( new PSCreditsGump());
				}
			else
				from.SendMessage ( "You already have this menu open!" );
            
		}
Exemplo n.º 7
0
		public override void OnDoubleClick( Mobile from )
		{
			Point2D start = new Point2D( from.X - 3, from.Y - 3 );
			Point2D end = new Point2D( from.X + 3, from.Y + 3 );

			m_Bounds = new Rectangle2D( start, end );

			if( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); //That must be in your pack to use it.
			}
			else if( AlreadyOwnTent( from ) )
			{
				from.SendMessage( "You already have a tent established." );
			}
			else if( from.HasGump( typeof( ConfirmTentPlacementGump ) ) )
			{
				from.CloseGump( typeof( ConfirmTentPlacementGump ) );
			}
			else if( from.Combatant != null )
			{
				from.SendMessage( "You can't place a tent while fighting!" );
			}
			else if( VerifyPlacement( from, m_Bounds ) )
			{
				TentAddon tent = new TentAddon();
				tent.MoveToWorld( new Point3D( from.X, from.Y, from.Z ), from.Map );

				TentFlap flap = new TentFlap( from, this );
				flap.MoveToWorld( new Point3D( from.X + 2, from.Y, from.Z ), from.Map );

				SecureTentChest chest = new SecureTentChest( from );
				chest.MoveToWorld( new Point3D( from.X - 1, from.Y - 2, from.Z ), from.Map );

				TentBedroll roll = new TentBedroll( from, tent, flap, chest );
				roll.MoveToWorld( new Point3D( from.X, from.Y + 1, from.Z ), from.Map );

				from.SendGump( new ConfirmTentPlacementGump( from, tent, flap, roll, chest, m_Bounds ) );

				this.Delete();
			}
			else
			{
				from.SendMessage( "You cannot place a tent in this area." );
			}
		}
Exemplo n.º 8
0
        public override bool OnMoveInto(Mobile from, Direction d, Point3D newLocation, Point3D oldLocation)
        {
            if (!base.OnMoveInto(from, d, newLocation, oldLocation))
            {
                return(false);
            }

            var bc = from as BaseCreature;

            if (bc?.NoHouseRestrictions != true)
            {
                if (bc?.Controlled == false) // Untamed creatures cannot enter public houses
                {
                    return(false);
                }

                if (bc?.IsHouseSummonable == true &&
                    !(BaseCreature.Summoning || House.IsInside(oldLocation, 16)))
                {
                    return(false);
                }
                if (bc?.Controlled == false && House.IsAosRules && !House.Public)
                {
                    return(false);
                }
                if ((House.Public || !House.IsAosRules) && House.IsBanned(from) && House.IsInside(newLocation, 16))
                {
                    from.Location = House.BanLocation;

                    if (!Core.SE)
                    {
                        from.SendLocalizedMessage(501284); // You may not enter.
                    }
                    return(false);
                }

                if (House.IsAosRules && !House.Public && !House.HasAccess(from) && House.IsInside(newLocation, 16))
                {
                    if (!Core.SE)
                    {
                        from.SendLocalizedMessage(501284); // You may not enter.
                    }
                    return(false);
                }

                if (House.IsCombatRestricted(from) && !House.IsInside(oldLocation, 16) && House.IsInside(newLocation, 16))
                {
                    from.SendLocalizedMessage(1061637); // You are not allowed to access this.
                    return(false);
                }

                if (House is HouseFoundation foundation && foundation.Customizer != null && foundation.Customizer != from &&
                    House.IsInside(newLocation, 16))
                {
                    return(false);
                }
            }

            if (House.InternalizedVendors.Count > 0 && House.IsInside(from) && !House.IsInside(oldLocation, 16) &&
                House.IsOwner(from) && from.Alive &&
                !from.HasGump <NoticeGump>())
            {
                from.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180));
            }

            return(true);
        }
Exemplo n.º 9
0
        // Use OnLocationChanged instead of OnEnter because it can be that we enter a house region even though we're not actually inside the house
        public override void OnLocationChanged(Mobile m, Point3D oldLocation)
        {
            if (m_Recursion)
            {
                return;
            }

            base.OnLocationChanged(m, oldLocation);

            m_Recursion = true;

            if (m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions)
            {
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside(oldLocation, 16)))
            {
            }
            else if (m_House.Public && m_House.IsBanned(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;
            }
            else if (!m_House.Public && !m_House.HasAccess(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;
            }
            else if (m_House.IsCombatRestricted(m) && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16))
            {
                m.Location = m_House.BanLocation;
                m.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
            else if (m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)m_House;

                if (foundation.Customizer != null && foundation.Customizer != m && m_House.IsInside(m))
                {
                    m.Location = m_House.BanLocation;
                }
            }

            // A�adido para Antihousing
            if (m_House.IsInside(m) && CheckCombat(m, TimeSpan.FromMinutes(2.0)))
            {
                for (int i = 0; i < m.Aggressors.Count; i++)
                {
                    bool found = false;

                    AggressorInfo info = (AggressorInfo)m.Aggressors[i];

                    Mobile aggressor = info.Attacker;

                    for (int j = 0; j < m.Aggressed.Count; j++)
                    {
                        AggressorInfo info2 = (AggressorInfo)m.Aggressed[j];

                        Mobile aggressed = info2.Attacker;

                        if (aggressed == m)
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        m.Aggressed.Add(AggressorInfo.Create(m, aggressor, !m.Criminal));
                    }
                }
            }

            if (m_House.InternalizedVendors.Count > 0 && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16) && m_House.IsOwner(m) && m.Alive && !m.HasGump <NoticeGump>())
            {
                /* This house has been customized recently, and vendors that work out of this
                 * house have been temporarily relocated.  You must now put your vendors back to work.
                 * To do this, walk to a location inside the house where you wish to station
                 * your vendor, then activate the context-sensitive menu on your avatar and
                 * select "Get Vendor".
                 */
                m.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            m_Recursion = false;
        }
Exemplo n.º 10
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == null || targeted == null)
                    return;

                if (targeted is Mobile && ((Mobile)targeted).Player)
                {
                    Mobile pm = targeted as Mobile;
                    
                    // test them for young status
                    if (YoungProtection(from, pm))
                    {
                        SendText(from, 100207, pm.Name); // "{0} is too inexperience to be challenged"
                        return;
                    }

                    // check the owner for existing challenges
                    XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(from, typeof(XmlPoints));

                    if (a != null && !a.Deleted)
                    {
                        // issuing a challenge when one is already in place will initiate cancellation of the current challenge
                        if (a.Challenger != null)
                        {
                            // this will initiate the challenge cancellation timer
                            if (a.m_CancelTimer != null && a.m_CancelTimer.Running)
                            {
                                // timer is running
                                a.SendText(100208, a.m_CancelEnd - DateTime.UtcNow); // "{0} mins remaining until current challenge is cancelled."
                            }
                            else
                            {
                                a.SendText(100209, XmlPoints.CancelTimeout.TotalMinutes);  // "Canceling current challenge.  Please wait {0} minutes"

                                SendText(a.Challenger, 100210, from.Name, XmlPoints.CancelTimeout.TotalMinutes); // "{0} is canceling the current challenge. {1} minutes remain"

                                // start up the cancel challenge timer
                                a.DoTimer(XmlPoints.CancelTimeout);

                                // update the points gumps on the challenger if they are open
                                if (from.HasGump(typeof(PointsGump)))
                                {
                                    a.OnIdentify(from);
                                }
                                // update the points gumps on the challenge target if they are open
                                if (a.Challenger.HasGump(typeof(PointsGump)))
                                {
                                    XmlPoints ca = (XmlPoints)XmlAttach.FindAttachment(a.Challenger, typeof(XmlPoints));
                                    if (ca != null && !ca.Deleted)
                                        ca.OnIdentify(a.Challenger);
                                }
                            }
                            return;
                        }

                        // check the target for existing challengers
                        XmlPoints xa = (XmlPoints)XmlAttach.FindAttachment(pm, typeof(XmlPoints));

                        if (xa != null && !xa.Deleted)
                        {
                            if (xa.Challenger != null)
                            {
                                from.SendMessage(String.Format(a.Text(100211), pm.Name));  // "{0} is already being challenged."
                                return;
                            }
                        }

                        if (from == targeted)
                        {
                            from.SendMessage(a.Text(100212));  // "You cannot challenge yourself."
                        }
                        else
                        {
                            // send the confirmation gump to the challenged player
                            from.SendGump(new IssueChallengeGump(this.m_challenger, pm));
                        }
                    }
                    else
                    {
                        from.SendMessage(SystemText(100213)); // "No XmlPoints support."
                    }
                }
            }
Exemplo n.º 11
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( SkillBonus <= 0 || ( Expires && DateTime.UtcNow >= m_ExpireDate ) )
			{
				if ( from.AccessLevel >= AccessLevel.GameMaster )
					from.SendGump( new PropertiesGump( from, this ) );
				SendLocalizedMessageTo( from, 1042544 ); // This item is out of charges.
			}
			else if ( !IsChildOf( from.Backpack ) )
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			else if ( !from.HasGump( typeof(MacingSkillScroll) ) )
				SendGump( from );
			else
				from.SendMessage( "You are already using a skill ball." );
		}
Exemplo n.º 12
0
        public override void OnDoubleClick( Mobile from )
        {
        	if( m_Tracks.Count < 1 )
        	{
        		from.SendMessage( "This music box is empty." );
        	}
			else if( IsOwner( from ) )
			{
				if( !IsLockedDown )
					from.SendLocalizedMessage( 502692 ); // This must be in a house and be locked down to work.
				else
				{
					if( from.HasGump( typeof(MusicGump) ) )
						from.CloseGump( typeof(MusicGump) );
					
					from.SendGump( new MusicGump( this ) );
				}
			}
			else
			{
				from.SendLocalizedMessage( 502691 ); // You must be the owner to use this.
			}
        }
Exemplo n.º 13
0
        public static bool SendGump(TriggerObject trigObject, Mobile target, string GumpFile, bool closeGump )
        {
            if (GumpFile == null || target == null) return false;

            string path;
            GumpFileMap.TryGetValue(GumpFile.ToLower(), out path);
            if (path == null)
            {
                //path = Path.GetFullPath(ScriptFile);
                path = Path.Combine(Core.BaseDirectory, "UberScripts", GumpFile);
                if (!File.Exists(path))
                {
                    throw new UberScriptException("Script file did not exist at " + path);
                }
                GumpFileMap.Add(GumpFile.ToLower(), path);
            }

            UberGumpBase parsedGump;
            XmlDocument parsedXml;
            if (!Gumps.ContainsKey(path))
            {
                parsedXml = new XmlDocument(); //* create an xml document object.
                parsedXml.Load(path); //* load the XML document from the specified file.
                if (parsedXml == null) return false;
                parsedGump = new UberGumpBase(parsedXml.FirstChild);
                Gumps.Add(path, parsedGump);
            }
            else
            {
                parsedGump = Gumps[path];
            }

            if (closeGump && target.HasGump(typeof(UberScriptGump)))
                target.CloseGump(typeof(UberScriptGump));
            target.SendGump(new UberScriptGump(target, trigObject, parsedGump, GumpFile));
            return true;
        }
Exemplo n.º 14
0
        public override bool OnMoveInto(Mobile from, Direction d, Point3D newLocation, Point3D oldLocation)
        {
            if (!base.OnMoveInto(from, d, newLocation, oldLocation))
                return false;

            if (from is BaseCreature && ((BaseCreature)from).NoHouseRestrictions)
            {
            }
            else if (from is BaseCreature && !((BaseCreature)from).Controlled) // Untamed creatures cannot enter public houses
            {
                return false;
            }
            else if (from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || this.m_House.IsInside(oldLocation, 16)))
            {
                return false;
            }
            else if (from is BaseCreature && !((BaseCreature)from).Controlled && this.m_House.IsAosRules && !this.m_House.Public)
            {
                return false;
            }
            else if ((this.m_House.Public || !this.m_House.IsAosRules) && this.m_House.IsBanned(from) && this.m_House.IsInside(newLocation, 16))
            {
                from.Location = this.m_House.BanLocation;

                if (!Core.SE)
                    from.SendLocalizedMessage(501284); // You may not enter.

                return false;
            }
            else if (this.m_House.IsAosRules && !this.m_House.Public && !this.m_House.HasAccess(from) && this.m_House.IsInside(newLocation, 16))
            {
                if (!Core.SE)
                    from.SendLocalizedMessage(501284); // You may not enter.

                return false;
            }
            else if (this.m_House.IsCombatRestricted(from) && !this.m_House.IsInside(oldLocation, 16) && this.m_House.IsInside(newLocation, 16))
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
                return false;
            }
            else if (this.m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)this.m_House;

                if (foundation.Customizer != null && foundation.Customizer != from && this.m_House.IsInside(newLocation, 16))
                    return false;
            }

            if (this.m_House.InternalizedVendors.Count > 0 && this.m_House.IsInside(from) && !this.m_House.IsInside(oldLocation, 16) && this.m_House.IsOwner(from) && from.Alive && !from.HasGump(typeof(NoticeGump)))
            {
                /* This house has been customized recently, and vendors that work out of this
                * house have been temporarily relocated.  You must now put your vendors back to work.
                * To do this, walk to a location inside the house where you wish to station
                * your vendor, then activate the context-sensitive menu on your avatar and
                * select "Get Vendor".
                */
                from.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            return true;
        }
Exemplo n.º 15
0
        public override bool OnMoveInto(Mobile from, Direction d, Point3D newLocation, Point3D oldLocation)
        {
            if (!base.OnMoveInto(from, d, newLocation, oldLocation))
            {
                return(false);
            }

            if (from is BaseCreature && ((BaseCreature)from).NoHouseRestrictions)
            {
            }
            else if (from is BaseCreature && !((BaseCreature)from).Controlled)               // Untamed creatures cannot enter public houses
            {
                return(false);
            }
            else if (from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside(oldLocation, 16)))
            {
                return(false);
            }
            else if (from is BaseCreature && !((BaseCreature)from).Controlled && m_House.IsAosRules && !m_House.Public)
            {
                return(false);
            }
            else if ((m_House.Public || !m_House.IsAosRules) && m_House.IsBanned(from) && m_House.IsInside(newLocation, 16))
            {
                from.Location = m_House.BanLocation;

                if (!Core.SE)
                {
                    from.SendLocalizedMessage(501284);                       // You may not enter.
                }
                return(false);
            }
            else if (m_House.IsAosRules && !m_House.Public && !m_House.HasAccess(from) && m_House.IsInside(newLocation, 16))
            {
                if (!Core.SE)
                {
                    from.SendLocalizedMessage(501284);                       // You may not enter.
                }
                return(false);
            }
            else if (m_House.IsCombatRestricted(from) && !m_House.IsInside(oldLocation, 16) && m_House.IsInside(newLocation, 16))
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
                return(false);
            }
            else if (m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)m_House;

                if (foundation.Customizer != null && foundation.Customizer != from && m_House.IsInside(newLocation, 16))
                {
                    return(false);
                }
            }

            if (m_House.InternalizedVendors.Count > 0 && m_House.IsInside(from) && !m_House.IsInside(oldLocation, 16) && m_House.IsOwner(from) && from.Alive && !from.HasGump(typeof(NoticeGump)))
            {
                /* This house has been customized recently, and vendors that work out of this
                 * house have been temporarily relocated.  You must now put your vendors back to work.
                 * To do this, walk to a location inside the house where you wish to station
                 * your vendor, then activate the context-sensitive menu on your avatar and
                 * select "Get Vendor".
                 */
                from.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            return(true);
        }
Exemplo n.º 16
0
        public static void MyHelpAdmin_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            from.CloseGump(typeof(SpeechGump));
            if (!from.HasGump(typeof(SpeechGump)))
            {
                string sText = ""
                               + "If this is the first time you started this server, or you want to do an overall refresh, run the command below...<br><br>"

                               + "[buildworld - This will decorate and spawn the world, along with generating gardens and stealable artifacts.<br><br>"

                               + "This does not alter any players or their belongings. Once you do this, then the world is ready for the players. There is a unique name system implemented that will force players to have a unique name. There are also 3 task managers in Lord British's castle. One runs every hour, another runs every 3 hours, and the other runs once per day.<br><br>"

                               + "Every hour, the task manager will change the appearances of the shrines. It will also remove any dungeon chests that have been opened. Lastly, it will delete the hidden traps/chests so they may then respawn in random locations again. This is done with a region spawner.<br><br>"

                               + "Every 3 hours, the task manager will replant the gardens in the world and mix up the hostile and mystical creatures that roam the land.<br><br>"

                               + "Every day, the task manager will delete the wandering healers, sea creatures, and tavern patrons. This is so the sea creatures and healers can respawn in new random locations. The tavern patrons change to new characters to give the illusion that new patrons arrived at the tavern.<br><br>"

                               + "The server allows players to macro the gathering of resources, and crafting of items. If you want to disallow this behavior, then set the AllowMacroResources to false in MyServerSettings.cs and restart the server. Players will then be presented with a captcha after randomly determined times. This captcha, that they have to respond to, will help avoid unattended macroing.<br><br>"

                               + "<br><br>"

                               + "There is a message of the day you can make use of. You simply need to edit the News.txt file in the Info folder whenever you want to notify players of anything. You can view the message of the day by typing...<br><br>"
                               + "[motd"

                               + "<br><br>"

                               + "There is a logging system built into the game that tracks where a player goes, what they kill, when they die, what traps they spring, and some other minor activities. They can turn this option off for more privacy. The town criers will use these logs to shout out various things that the players are doing in the game. One can talk to a town crier and learn about all the events. The logs are kept in the Info folder.<br><br>"

                               + "<br><br>"

                               + "There is a MyServerSettings.cs file that allows you to change some parameters of how difficult the game is. The gold monsters and containers drop is cut down to 25%, but can be changed in this file. Also, each dungeon has a difficulty level set here. Some dungeons are harder than others, but the loot is better. Be wary when changing these settings as these have been tested to work well for solo players, which is what this server was designed around.<br><br>"

                               + "<br><br>"

                               + "The game will save if you log out in an inn, tavern, home, etc. If you plan to run this in a multi-player fashion, you may want to disable this feature. To do this, find the MyServerSettings.cs file and change the SaveOnCharacterLogout to false. Either way, the game saves itself every 30 minutes.<br><br>"

                               + "<br><br>"

                               + "Here are some other commands that may interest you...<br><br>"

                               + "[adddoor - Opens the window for you to add a door.<br><br>"
                               + "[addongen - Lets you make an addon and deed for something you created in the game.<br><br>"
                               + "[addtobank - Lets you add an item to many players' bank boxes at once.<br><br>"
                               + "[addtrap - Opens the window for you to add a trap. Make sure you are standing in the spot where you want the trap before selecting one.<br><br>"
                               + "[admin - Opens the window for general server administration.<br><br>"
                               + "[findboat - Lets you find all the boats in the world.<br><br>"
                               + "[go - Opens a menu of quick locations you can travel to.<br><br>"
                               + "[scan - Quickly cycle through the players logged in and teleport to them.<br><br>"
                               + "[searchimage - Allows you to find images in UO and then add them to the world.<br><br>"
                               + "[staex - Allows you to export items into a decoration file.<br><br>"
                               + "[townhouses - Lets you build in-game player housing, and also find all the houses built in the world.<br><br>"

                               + "<br><br>"

                               + "This server is set to give players 1,000 skill points to spend. This helps for solo play and lets the player round out a decent character...while still staying within the bounds of mastering a class. Their mana, stamina, and hit points are double the associated ability...this also helps with the solo play aspect. Rejuvenation type potions, skills, and magics have been modified to accommodate these changes."

                               + "";

                from.SendGump(new SpeechGump("Help For Admins", sText));
            }
        }
Exemplo n.º 17
0
        // Use OnLocationChanged instead of OnEnter because it can be that we enter a house region even though we're not actually inside the house
        public override void OnLocationChanged(Mobile m, Point3D oldLocation)
        {
            if (m_Recursion)
            {
                return;
            }

            base.OnLocationChanged(m, oldLocation);

            m_Recursion = true;

            if (m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions)
            {
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside(oldLocation, 16)))
            {
            }
            else if ((m_House.Public || !m_House.IsAosRules) && m_House.IsBanned(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;

                if (!Core.SE)
                {
                    m.SendLocalizedMessage(501284); // You may not enter.
                }
            }
            else if (m_House.IsAosRules && !m_House.Public && !m_House.HasAccess(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;

                if (!Core.SE)
                {
                    m.SendLocalizedMessage(501284); // You may not enter.
                }
            }
            else if (m_House.IsCombatRestricted(m) && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16))
            {
                m.Location = m_House.BanLocation;
                m.SendLocalizedMessage(1061637); // You are not allowed to access
            }
            else if (m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)m_House;

                if (foundation.Customizer != null && foundation.Customizer != m && m_House.IsInside(m))
                {
                    m.Location = m_House.BanLocation;
                }
            }

            if (m_House.InternalizedVendors.Count > 0 && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16) && m_House.IsOwner(m) && m.Alive && !m.HasGump(typeof(NoticeGump)))
            {
                /* This house has been customized recently, and vendors that work out of this
                 * house have been temporarily relocated.  You must now put your vendors back to work.
                 * To do this, walk to a location inside the house where you wish to station
                 * your vendor, then activate the context-sensitive menu on your avatar and
                 * select "Get Vendor".
                 */
                m.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            m_Recursion = false;
        }
Exemplo n.º 18
0
        public static bool BuyItem(Mobile buyer, MarketEntry entry)
        {
            if (buyer == null || !buyer.Alive)
            {
                buyer.SendMessage("You cannot purchase a market order while knocked out.");
            }
            else if (buyer == entry.Seller)
            {
                buyer.SendMessage("You cannot purchase something from yourself.");
            }
            else
            {
                IEntity entity = World.FindEntity(entry.ObjectSerial);

                if (entity == null || IsSold(entry))
                {
                    buyer.SendMessage("The order has expired.");
                }
                else
                {
                    Type[]    coinTypes      = new Type[] { Curr.typeofCopper, Curr.typeofSilver, Curr.typeofGold };
                    int[]     compressedCost = Curr.Compress(entry.Cost, 0, 0);
                    Container cont           = buyer.FindBankNoCreate();

                    if (cont != null && cont.ConsumeTotal(coinTypes, compressedCost) == -1)
                    {
                        if (entity is Item)
                        {
                            Item item = (Item)entity;
                            cont = buyer.Backpack;

                            if (cont != null && !cont.TryDropItem(buyer, item, false))
                            {
                                item.MoveToWorld(buyer.Location, buyer.Map);
                            }

                            CloseOrder(entry);

                            if (buyer.HasGump(typeof(MarketGump)))
                            {
                                buyer.CloseGump(typeof(MarketGump));
                                buyer.SendGump(new MarketGump(entry.Category, 0));
                            }

                            return(true);
                        }
                        else if (entity is Mobile)
                        {
                            Mobile mob = (Mobile)entity;
                            mob.Direction = (Direction)Utility.Random(8);
                            mob.MoveToWorld(buyer.Location, buyer.Map);
                            mob.PlaySound(mob.GetIdleSound());

                            if (mob is BaseCreature)
                            {
                                ((BaseCreature)mob).SetControlMaster(buyer);
                            }

                            CloseOrder(entry);

                            if (buyer.HasGump(typeof(MarketGump)))
                            {
                                buyer.CloseGump(typeof(MarketGump));
                                buyer.SendGump(new MarketGump(entry.Category, 0));
                            }

                            return(true);
                        }
                    }
                    else
                    {
                        buyer.SendMessage("You cannot afford that item.");
                    }
                }
            }

            return(false);
        }
Exemplo n.º 19
0
        private static void Send <TGump>(
            bool local,
            Mobile m,
            string html,
            bool autoClose            = true,
            double delay              = 1.0,
            double pause              = 3.0,
            Color?color               = null,
            Action <TGump> beforeSend = null,
            Action <TGump> afterSend  = null,
            AccessLevel level         = AccessLevel.Player) where TGump : NotifyGump
        {
            if (!m.IsOnline() || m.AccessLevel < level)
            {
                return;
            }

            var t = typeof(TGump);

            if (t.IsAbstract || m.HasGump(t))
            {
                Type[] subs;

                if (!NestedTypes.TryGetValue(t, out subs) || subs == null)
                {
                    NestedTypes[t] = subs = t.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic)                     //
                                            .Where(st => st.IsChildOf <NotifyGump>()).ToArray();
                }

                var sub = subs.FirstOrDefault(st => !m.HasGump(st));

                if (sub != null)
                {
                    t = sub;
                }
            }

            if (!t.IsAbstract)
            {
                if (IsIgnored(t.IsNested ? t.DeclaringType : t, m))
                {
                    return;
                }

                if (!IsAnimated(t.IsNested ? t.DeclaringType : t, m))
                {
                    delay = 0.0;
                }

                var ng = t.CreateInstanceSafe <TGump>(m, html);

                if (ng != null)
                {
                    ng.AutoClose     = autoClose;
                    ng.AnimDuration  = TimeSpan.FromSeconds(Math.Max(0, delay));
                    ng.PauseDuration = TimeSpan.FromSeconds(Math.Max(0, pause));
                    ng.HtmlColor     = color ?? Color.White;

                    if (ng.IsDisposed)
                    {
                        return;
                    }

                    if (local && OnLocalMessage != null)
                    {
                        OnLocalMessage(ng);
                    }
                    else if (!local && OnGlobalMessage != null)
                    {
                        OnGlobalMessage(ng);
                    }

                    if (beforeSend != null)
                    {
                        beforeSend(ng);
                    }

                    if (ng.IsDisposed)
                    {
                        return;
                    }

                    ng.Send();

                    if (ng.IsDisposed)
                    {
                        return;
                    }

                    if (afterSend != null)
                    {
                        afterSend(ng);
                    }

                    return;
                }
            }

            foreach (var str in
                     html.Split(new[] { "\n", "<br>", "<BR>" }, StringSplitOptions.RemoveEmptyEntries)
                     .Select(s => Regex.Replace(s, @"<[^>]*>", String.Empty)))
            {
                m.SendMessage(str);
            }
        }
 protected override void OnTarget( Mobile from, object targeted )
 {
     BaseCreature creature = targeted as BaseCreature;
     if ( creature == null || !( creature.Controlled && creature.ControlMaster == from ) )
         from.SendMessage( "You cannot use this skill ball on that." );
     else if ( from.HasGump( typeof(SkillBall) ) )
         from.SendMessage( "You are already using a skill ball." );
     else if ( m_Ball.Expires && DateTime.Now >= m_Ball.ExpireDate )
         m_Ball.SendLocalizedMessageTo( from, 1042544 ); // This item is out of charges.
     else if ( m_Ball.ValidateUser( from ) )
         from.SendMessage( "Only the owner can use this skill ball." );
     else
         from.SendGump( new SkillBallGump( from, creature, m_Ball ) );
 }
Exemplo n.º 21
0
        // Use OnLocationChanged instead of OnEnter because it can be that we enter a house region even though we're not actually inside the house
        public override void OnLocationChanged( Mobile m, Point3D oldLocation )
        {
            if ( m_Recursion )
                return;

            base.OnLocationChanged( m, oldLocation );

            m_Recursion = true;

            if ( m is BaseCreature && ( (BaseCreature) m ).NoHouseRestrictions )
            {
            }
            else if ( m is BaseCreature && ( (BaseCreature) m ).IsHouseSummonable && !( BaseCreature.Summoning || m_House.IsInside( oldLocation, 16 ) ) )
            {
            }
            else if ( m_House.Public && m_House.IsBanned( m ) && m_House.IsInside( m ) )
            {
                m.Location = m_House.BanLocation;
            }
            else if ( !m_House.Public && !m_House.HasAccess( m ) && m_House.IsInside( m ) )
            {
                m.Location = m_House.BanLocation;

            }
            else if ( m_House.IsCombatRestricted( m ) && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) )
            {
                m.Location = m_House.BanLocation;
                m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
            }
            else if ( m_House is HouseFoundation )
            {
                HouseFoundation foundation = (HouseFoundation) m_House;

                if ( foundation.Customizer != null && foundation.Customizer != m && m_House.IsInside( m ) )
                    m.Location = m_House.BanLocation;
            }

            // Añadido para Antihousing
            if ( m_House.IsInside( m ) && CheckCombat( m, TimeSpan.FromMinutes( 2.0 ) ) )
            {
                for ( int i = 0; i < m.Aggressors.Count; i++ )
                {
                    bool found = false;

                    AggressorInfo info = (AggressorInfo) m.Aggressors[i];

                    Mobile aggressor = info.Attacker;

                    for ( int j = 0; j < m.Aggressed.Count; j++ )
                    {
                        AggressorInfo info2 = (AggressorInfo) m.Aggressed[j];

                        Mobile aggressed = info2.Attacker;

                        if ( aggressed == m )
                            found = true;
                    }

                    if ( !found )
                        m.Aggressed.Add( AggressorInfo.Create( m, aggressor, !m.Criminal ) );
                }
            }

            if ( m_House.InternalizedVendors.Count > 0 && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsOwner( m ) && m.Alive && !m.HasGump( typeof( NoticeGump ) ) )
            {
                /* This house has been customized recently, and vendors that work out of this
                 * house have been temporarily relocated.  You must now put your vendors back to work.
                 * To do this, walk to a location inside the house where you wish to station
                 * your vendor, then activate the context-sensitive menu on your avatar and
                 * select "Get Vendor".
                 */
                m.SendGump( new NoticeGump( 1060635, 30720, 1061826, 32512, 320, 180, null, null ) );
            }

            m_Recursion = false;
        }
Exemplo n.º 22
0
        // Use OnLocationChanged instead of OnEnter because it can be that we enter a house region even though we're not actually inside the house
        public override void OnLocationChanged(Mobile m, Point3D oldLocation)
        {
            if (this.m_Recursion)
                return;

            base.OnLocationChanged(m, oldLocation);

            this.m_Recursion = true;

            if (m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions)
            {
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || this.m_House.IsInside(oldLocation, 16)))
            {
            }
            else if ((this.m_House.Public || !this.m_House.IsAosRules) && this.m_House.IsBanned(m) && this.m_House.IsInside(m))
            {
                m.Location = this.m_House.BanLocation;

                if (!Core.SE)
                    m.SendLocalizedMessage(501284); // You may not enter.
            }
            else if (this.m_House.IsAosRules && !this.m_House.Public && !this.m_House.HasAccess(m) && this.m_House.IsInside(m))
            {
                m.Location = this.m_House.BanLocation;

                if (!Core.SE)
                    m.SendLocalizedMessage(501284); // You may not enter.
            }
            else if (this.m_House.IsCombatRestricted(m) && this.m_House.IsInside(m) && !this.m_House.IsInside(oldLocation, 16))
            {
                m.Location = this.m_House.BanLocation;
                m.SendLocalizedMessage(1061637); // You are not allowed to access this.
            }
            else if (this.m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)this.m_House;

                if (foundation.Customizer != null && foundation.Customizer != m && this.m_House.IsInside(m))
                    m.Location = this.m_House.BanLocation;
            }

            if (this.m_House.InternalizedVendors.Count > 0 && this.m_House.IsInside(m) && !this.m_House.IsInside(oldLocation, 16) && this.m_House.IsOwner(m) && m.Alive && !m.HasGump(typeof(NoticeGump)))
            {
                /* This house has been customized recently, and vendors that work out of this
                * house have been temporarily relocated.  You must now put your vendors back to work.
                * To do this, walk to a location inside the house where you wish to station
                * your vendor, then activate the context-sensitive menu on your avatar and
                * select "Get Vendor".
                */
                m.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            this.m_Recursion = false;
        }
Exemplo n.º 23
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from ) && !from.HasGump( typeof(EtherealRideGump) ) )
			{
				from.SendGump( new EtherealRideGump( this ) );
			}
		}
Exemplo n.º 24
0
        public override void OnDoubleClick(Mobile from)
        {
            if (null == from || 0 == this.m_Lifespan)
                return;

            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                if (from.HasGump(typeof(ClockworkStartGump)))
                    from.CloseGump(typeof(ClockworkStartGump));

                from.SendGump(new ClockworkStartGump(this));
            }
        }
Exemplo n.º 25
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that
            }
            else if (this.m_Tournament != null)
            {
                Tournament tourny = this.m_Tournament.Tournament;

                if (tourny != null)
                {
                    if (this.m_Registrar != null)
                        this.m_Registrar.Direction = this.m_Registrar.GetDirectionTo(this);

                    switch ( tourny.Stage )
                    {
                        case TournamentStage.Fighting:
                            {
                                if (this.m_Registrar != null)
                                {
                                    if (tourny.HasParticipant(from))
                                    {
                                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                            0x35, false, "Excuse me? You are already signed up.", from.NetState);
                                    }
                                    else
                                    {
                                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                            0x22, false, "The tournament has already begun. You are too late to signup now.", from.NetState);
                                    }
                                }

                                break;
                            }
                        case TournamentStage.Inactive:
                            {
                                if (this.m_Registrar != null)
                                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                        0x35, false, "The tournament is closed.", from.NetState);

                                break;
                            }
                        case TournamentStage.Signup:
                            {
                                Ladder ladder = Ladder.Instance;

                                if (ladder != null)
                                {
                                    LadderEntry entry = ladder.Find(from);

                                    if (entry != null && Ladder.GetLevel(entry.Experience) < tourny.LevelRequirement)
                                    {
                                        if (this.m_Registrar != null)
                                        {
                                            this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                                0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
                                        }

                                        break;
                                    }
                                }

                                if (from.HasGump(typeof(AcceptTeamGump)))
                                {
                                    if (this.m_Registrar != null)
                                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                            0x22, false, "You must first respond to the offer I've given you.", from.NetState);
                                }
                                else if (from.HasGump(typeof(AcceptDuelGump)))
                                {
                                    if (this.m_Registrar != null)
                                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                            0x22, false, "You must first cancel your duel offer.", from.NetState);
                                }
                                else if (from is PlayerMobile && ((PlayerMobile)from).DuelContext != null)
                                {
                                    if (this.m_Registrar != null)
                                        this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                            0x22, false, "You are already participating in a duel.", from.NetState);
                                }
                                else if (!tourny.HasParticipant(from))
                                {
                                    ArrayList players = new ArrayList();
                                    players.Add(from);
                                    from.CloseGump(typeof(ConfirmSignupGump));
                                    from.SendGump(new ConfirmSignupGump(from, this.m_Registrar, tourny, players));
                                }
                                else if (this.m_Registrar != null)
                                {
                                    this.m_Registrar.PrivateOverheadMessage(MessageType.Regular,
                                        0x35, false, "You have already entered this tournament.", from.NetState);
                                }

                                break;
                            }
                    }
                }
            }
        }
Exemplo n.º 26
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (m is PlayerMobile && Arena != null && !m.Alive && m.InRange(Location, 2) && !m.HasGump(typeof(ResurrectGump)))
            {
                m.SendGump(new ResurrectGump(m, null, ResurrectMessage.Generic, false, 0.0, mob =>
                {
                    Arena.RemovePlayer((PlayerMobile)mob);

                    if (mob.Corpse != null)
                    {
                        mob.Corpse.MoveToWorld(mob.Location, mob.Map);
                    }
                }));
            }
        }
Exemplo n.º 27
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == (int)Buttons.weaponBtn)
            {
                if (beheld is BaseWeapon)
                {
                    if (!from.HasGump(typeof(WeaponAttributeGump)))
                    {
                        WeaponAttributeGump gump = new WeaponAttributeGump(beheld, from, imbuePoints, this);
                        from.SendGump(gump);
                        child = gump;
                    }

                    from.SendGump(new BasicAttributeGump(_values, imbuePoints, beheld, from, child, tool));
                }

                else
                {
                    from.SendMessage("This is not a weapon!");
                    from.SendGump(new BasicAttributeGump(_values, imbuePoints, beheld, from, child, tool));
                }
            }

            if (info.ButtonID == (int)Buttons.applyButton)
            {
                ApplyAttributes();
                return;
            }

            //Increase
            else if (info.ButtonID >= (int)Buttons.dmgIncBtn && info.ButtonID <= (int)Buttons.manaRegenBtn)
            {
                if (imbuePoints <= 0)
                {
                    from.SendMessage("You do not have any imbue points lefts.");
                    UpdateGump(); return;
                }

                if (_values[info.ButtonID] + 1 > _caps[info.ButtonID])
                {
                    from.SendMessage("This object can not withstand more imbuement of that type.");
                    UpdateGump(); return;
                }

                imbuePoints--;
                _values[info.ButtonID]++;
                UpdateGump();

                if (child != null)
                {
                    child.imbuePoints--;
                    child.parent = this;
                    child.UpdateGump();
                }
            }

            //Decrease
            else if (info.ButtonID >= (int)Buttons.dmgDecBtn && info.ButtonID <= (int)Buttons.manaRegenDecBtn)
            {
                if (_values[(info.ButtonID - 12)] <= 0)
                {
                    from.SendMessage("You can not lower this value any further.");
                    UpdateGump(); return;
                }

                _values[(info.ButtonID - 12)]--;
                imbuePoints++; UpdateGump();

                if (child != null)
                {
                    child.imbuePoints++;
                    child.parent = this;
                    child.UpdateGump();
                }
            }
        }
Exemplo n.º 28
0
        public static void EventSink_Speech(SpeechEventArgs args)
        {
            Mobile from = args.Mobile;

            int[] keywords = args.Keywords;

            for (int i = 0; i < keywords.Length; ++i)
            {
                switch (keywords[i])
                {
                case 0x002A:                         // *i resign from my guild*
                {
                    if (from.Guild != null)
                    {
                        ((Guild)from.Guild).RemoveMember(from);
                    }

                    if (from is PlayerMobile && ((PlayerMobile)from).HasCustomRace)
                    {
                        ResetRace.DoResetRace(from);
                    }

                    break;
                }

                case 0x0032:                         // *i must consider my sins*
                {
                    if (NotorietyHandlers.IsGuardCandidate(from))
                    {
                        from.SendAsciiMessage("Thou hast done great naughty! I wouldst not show my face in town if I were thee.");
                    }
                    else
                    {
                        from.SendAsciiMessage("Fear not, thou hast not commited a criminal act.");
                    }

                    break;
                }

                case 0x0035:                         // i renounce my young player status*
                {
                    if (from is PlayerMobile && ((PlayerMobile)from).Young && !from.HasGump(typeof(RenounceYoungGump)))
                    {
                        from.SendGump(new RenounceYoungGump());
                    }

                    break;
                }
                }
            }
            if (args.Speech.ToLower().Contains("i have nothing to repent over"))
            {
                if (from is PlayerMobile && from.Kills > 4)
                {
                    PlayerMobile pm = ((PlayerMobile)from);
                    if (!pm.AlwaysMurderer)
                    {
                        pm.AlwaysMurderer = true;
                        from.SendAsciiMessage("You will no longer loose any killcounts");
                    }
                    else
                    {
                        from.SendAsciiMessage("Yes yes, I heard you the first time");
                    }
                }
                else
                {
                    from.SendAsciiMessage("You need at least 5 killcounts to do this");
                }
            }
            else if (args.Speech.ToLower().Contains("i wish to repent my sins"))
            {
                PlayerMobile pm = ((PlayerMobile)from);
                if (pm.AlwaysMurderer)
                {
                    pm.AlwaysMurderer = false;
                    from.SendAsciiMessage("You will now loose killcounts again");
                }
                else
                {
                    from.SendAsciiMessage("Your killcounts already decays");
                }
            }
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( (this.SkillBonus == 0) && (from.AccessLevel < AccessLevel.GameMaster) )
			{
				from.SendMessage("This skill ball isn't charged. Please page for a GM.");
				return;
			}
			else if ( (from.AccessLevel >= AccessLevel.GameMaster) && (this.SkillBonus == 0) )
			{
				from.SendGump( new PropertiesGump( from, this ) );
				return;
			}
			else if ( !IsChildOf( from.Backpack ) )
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            else if (!from.HasGump(typeof(TempDonationSkillBallGump)))
				from.SendGump( new TempDonationSkillBallGump( from, this ) );
			else
				from.SendMessage("You're already using a skill ball.");
		}
Exemplo n.º 30
0
 public override void OnDoubleClick(Mobile from)
 {
     if (SkillBonus <= 0)
     {
         if (from.AccessLevel >= AccessLevel.GameMaster)
         {
             from.SendGump(new PropertiesGump(from, this));
         }
         SendLocalizedMessageTo(from, 1042544); // This item is out of charges.
     }
     else if (!IsChildOf(from.Backpack))
     {
         from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
     }
     else if (!from.HasGump(typeof(SkillScroll)))
     {
         SendGump(from);
     }
 }
Exemplo n.º 31
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Counselor)
            {
                TryCreateMissingBags();

                TryMoveBags();

                if (from.HasGump(typeof(ConfigSelectionGump)))
                {
                    for (int i = 0; i < m_ItemContaiers.Length; i++)
                        m_ItemContaiers[i].DisplayTo(from);

                    from.CloseGump(typeof(ConfigSelectionGump));
                }
                else if (m_SupplyType == SupplyType.Custom)
                {
                    from.SendAsciiMessage("Double click the pad again to open all bags at once.");
                    from.SendGump(new ConfigSelectionGump(from, this));
                }
                else
                    from.SendAsciiMessage("You need to turn the pad on to custom mode to customize the gear.");
            }
        }
Exemplo n.º 32
0
        // handles point gain when the player kills someone
        public override void OnKill(Mobile killed, Mobile killer)
        {
            if (killer == null || killed == null || !(killed.Player) || killer == killed)
                return;

            bool awardpoints = true;

            // if this was a team or challenge duel then clear agressor list
            if (killed == this.m_Challenger || killer == this.m_Challenger || AreInSameGame(killed, killer))
            {
                // and remove the challenger from the aggressor list so that the res noto is not affected
                this.ClearAggression(killed, killer);
            }

            // handle challenge team kills
            if (this.ChallengeGame != null && !this.ChallengeGame.Deleted)
            {
                this.ChallengeGame.OnKillPlayer(killer, killed);
            }

            // check to see whether points can be given
            if (!(this.AttachedTo is Mobile) || !this.CanAffectPoints((Mobile)this.AttachedTo, killer, killed, false))
            {
                awardpoints = false;
            }

            // if this was a challenge duel then clear the challenger field
            if (killed == this.m_Challenger || killer == this.m_Challenger)
            {
                this.m_Challenger = null;
            }
            
            // begin the section to award points

            if (!awardpoints)
                return;

            if (LogKills)
            {
                try
                {
                    using (StreamWriter op = new StreamWriter("kills.log", true))
                    {
                        op.WriteLine("{0}: {1} killed {2}", DateTime.UtcNow, killer, killed);
                    }
                }
                catch
                {
                }
            }

            int killedpoints = 0;
            // give the killer his points, either a fixed amount or scaled by the difference with the points of the killed
            // if the killed has more points than the killed then gain more
            ArrayList list = XmlAttach.FindAttachments(killed, typeof(XmlPoints));

            if (list != null && list.Count > 0)
            {
                killedpoints = ((XmlPoints)list[0]).Points;
            }

            int val = (int)((killedpoints - this.Points) * m_WinScale);
            if (val <= 0)
                val = 1;

            this.Points += val;
            
            int cval = (int)((killedpoints - this.Points) * m_CreditScale);
            if (cval <= 0)
                cval = 1;

            this.Credits += cval;

            this.m_LastKill = DateTime.UtcNow;

            killer.SendMessage(String.Format(this.Text(100215), val, killed.Name));  // "You receive {0} points for killing {1}"
            
            if (GainHonorFromDuel)
            {
                bool gainedPath = false;
                if (VirtueHelper.Award(killer, VirtueName.Honor, val, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        killer.SendLocalizedMessage(1063226); // You have gained a path in Honor!
                    }
                    else
                    {
                        killer.SendLocalizedMessage(1063225); // You have gained in Honor.
                    }
                }
            }

            // add to the recently killed list
            //KillList.Add(new KillEntry(killed, DateTime.UtcNow));

            // add to the cumulative death count
            this.Kills++;

            // update the overall ranking list
            UpdateRanking(killer, this);

            // if broadcast is enabled then announce it
            if (this.Broadcast && m_SystemBroadcast)
            {
                BroadcastMessage(AccessLevel.Player, 0x482, String.Format(SystemText(100216), killer.Name, killed.Name));  // "{0} has defeated {1} in combat."
            }

            // update the points gump if it is open
            if (killer.HasGump(typeof(PointsGump)))
            {
                // redisplay it with the new info
                this.OnIdentify(killer);
            }

            // update the top players gump if it is open
            if (killer.HasGump(typeof(TopPlayersGump)))
            {
                killer.CloseGump(typeof(TopPlayersGump));
                killer.SendGump(new TopPlayersGump(this));
            }
        }
Exemplo n.º 33
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Context.Registered)
                {
                    return;
                }

                int index = m_Index;

                if (index < 0 || index >= m_Participant.Players.Length)
                {
                    return;
                }

                Mobile mob = targeted as Mobile;

                if (mob == null)
                {
                    from.SendMessage("That is not a player.");
                }
                else if (!mob.Player)
                {
                    if (mob.Body.IsHuman)
                    {
                        mob.SayTo(from, 1005443); // Nay, I would rather stay here and watch a nail rust.
                    }
                    else
                    {
                        mob.SayTo(from, 1005444); // The creature ignores your offer.
                    }
                }
                else if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
                {
                    from.SendMessage("They ignore your offer.");
                }
                else
                {
                    PlayerMobile pm = mob as PlayerMobile;

                    if (pm == null)
                    {
                        return;
                    }

                    if (pm.DuelContext != null)
                    {
                        from.SendMessage("{0} cannot fight because they are already assigned to another duel.", pm.Name);
                    }
                    else if (DuelContext.CheckCombat(pm))
                    {
                        from.SendMessage("{0} cannot fight because they have recently been in combat with another player.", pm.Name);
                    }
                    else if (mob.HasGump(typeof(AcceptDuelGump)))
                    {
                        from.SendMessage("{0} has already been offered a duel.");
                    }
                    else
                    {
                        from.SendMessage("You send {0} to {1}.", m_Participant.Find(from) == null ? "a challenge" : "an invitation", mob.Name);
                        mob.SendGump(new AcceptDuelGump(from, mob, m_Context, m_Participant, m_Index));
                    }
                }
            }
Exemplo n.º 34
0
        public override bool OnDragLift(Mobile from)
        {
            if (from.HasGump(typeof(RunebookGump)))
            {
                from.SendLocalizedMessage(500169); // You cannot pick that up.
                return false;
            }
			
            foreach (Mobile m in this.m_Openers)
                if (this.IsOpen(m))
                    m.CloseGump(typeof(RunebookGump));
				
            this.m_Openers.Clear();
			
            return true;
        }
Exemplo n.º 35
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from.AccessLevel < AccessLevel.Counselor)
            {
                from.SendMessage(2102, "Only staff members can use this.");
            }
            else
            {
                switch (info.ButtonID)
                {
                case 8:
                {
                    CommandToolbarEdit gump = new CommandToolbarEdit("Props", "M Tele", "Move", "M Delete", "Wipe", "Who", "Add", "Normal", "true", "true");

                    /*gump.AddTextEntry(153, 90, 445, 20, 2101, 1, @"Props" );
                     * gump.AddTextEntry(153, 130, 445, 20, 2101, 2, @"M Tele" );
                     * gump.AddTextEntry(153, 170, 445, 20, 2101, 3, @"Move" );
                     * gump.AddTextEntry(153, 210, 445, 20, 2101, 4, @"M Delete" );
                     * gump.AddTextEntry(153, 250, 445, 20, 2101, 5, @"Wipe" );
                     * gump.AddTextEntry(153, 290, 445, 20, 2101, 6, @"Who" );
                     * gump.AddTextEntry(153, 330, 445, 20, 2101, 7, @"Add" );
                     * gump.HideB = true;
                     * gump.Adv = true;
                     * gump.HideS = "Normal";
                     * gump.AddButton(287, 399, 2153, 2151, 12, GumpButtonType.Reply, 1);
                     * gump.AddLabel(374, 403, 0, gump.HideType);
                     *
                     * gump.AddPage(2);
                     *
                     * gump.AddBackground(0, 0, 273, 545, 9270);
                     * gump.AddLabel(75, 39, 2101, @"Hide Type Edit Menu");
                     *
                     * gump.AddBackground(64, 83, 131, 26, 9350);
                     * gump.AddLabel(72, 87, 0, @"Normal Hide");
                     * gump.AddButton(196, 87, 5601, 5605, 14, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 123, 131, 26, 9350);
                     * gump.AddLabel(72, 127, 0, @"Blood Oath Hide");
                     * gump.AddButton(196, 127, 5601, 5605, 15, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 163, 131, 26, 9350);
                     * gump.AddLabel(72, 167, 0, @"Divine Male Hide");
                     * gump.AddButton(196, 167, 5601, 5605, 16, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 203, 131, 26, 9350);
                     * gump.AddLabel(72, 207, 0, @"Divine Female Hide");
                     * gump.AddButton(196, 207, 5601, 5605, 17, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 243, 131, 26, 9350);
                     * gump.AddLabel(72, 247, 0, @"Explosion Hide");
                     * gump.AddButton(196, 247, 5601, 5605, 18, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 283, 131, 26, 9350);
                     * gump.AddLabel(72, 287, 0, @"Fire Hide");
                     * gump.AddButton(196, 287, 5601, 5605, 19, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 323, 131, 26, 9350);
                     * gump.AddLabel(72, 327, 0, @"Noble Hide");
                     * gump.AddButton(196, 327, 5601, 5605, 20, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 363, 131, 26, 9350);
                     * gump.AddLabel(72, 367, 0, @"Poison Hide");
                     * gump.AddButton(196, 367, 5601, 5605, 21, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 403, 131, 26, 9350);
                     * gump.AddLabel(72, 407, 0, @"Shiney Hide");
                     * gump.AddButton(196, 407, 5601, 5605, 22, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 443, 131, 26, 9350);
                     * gump.AddLabel(72, 447, 0, @"Thunder Hide");
                     * gump.AddButton(196, 447, 5601, 5605, 23, GumpButtonType.Reply, 2);
                     * gump.AddBackground(64, 483, 131, 26, 9350);
                     * gump.AddLabel(72, 487, 0, @"Wither Hide");
                     * gump.AddButton(196, 487, 5601, 5605, 24, GumpButtonType.Reply, 2);*/
                    from.SendGump(gump);
                    from.SendMessage(2102, "Settings have been changed to default.");

                    break;
                }

                case 9:
                {
                    TextRelay t1 = info.GetTextEntry(1);
                    C1 = t1.Text.Replace("|", "");
                    TextRelay t2 = info.GetTextEntry(2);
                    C2 = t2.Text.Replace("|", "");
                    TextRelay t3 = info.GetTextEntry(3);
                    C3 = t3.Text.Replace("|", "");
                    TextRelay t4 = info.GetTextEntry(4);
                    C4 = t4.Text.Replace("|", "");
                    TextRelay t5 = info.GetTextEntry(5);
                    C5 = t5.Text.Replace("|", "");
                    TextRelay t6 = info.GetTextEntry(6);
                    C6 = t6.Text.Replace("|", "");
                    TextRelay t7 = info.GetTextEntry(7);
                    C7 = t7.Text.Replace("|", "");

                    if (C1 != null && C2 != null && C3 != null && C4 != null && C5 != null && C6 != null && C7 != null)
                    {
                        Account A = from.Account as Account;
                        A.RemoveTag("CommandToolbar");
                        string ADV = "false", HIDEB = "false";
                        if (Adv)
                        {
                            ADV = "true";
                        }
                        if (HideB)
                        {
                            HIDEB = "true";
                        }
                        A.SetTag("CommandToolbar", C1 + "|" + C2 + "|" + C3 + "|" + C4 + "|" + C5 + "|" + C6 + "|" + C7 + "|" + HideS + "|" + HIDEB + "|" + ADV);
                        from.SendMessage(2102, "Your new settings have been successfully applied.");
                        if (from.HasGump(typeof(CommandToolbar)))
                        {
                            from.CloseGump(typeof(CommandToolbar));
                            ToolbarCmds.TagToolbar(from);
                        }
                    }
                    else
                    {
                        from.SendMessage(2102, "One of your text entries is invalid. Please try again.");
                    }

                    break;
                }

                case 11:
                {
                    TextRelay t1 = info.GetTextEntry(1);
                    C1 = t1.Text.Replace("|", "");
                    TextRelay t2 = info.GetTextEntry(2);
                    C2 = t2.Text.Replace("|", "");
                    TextRelay t3 = info.GetTextEntry(3);
                    C3 = t3.Text.Replace("|", "");
                    TextRelay t4 = info.GetTextEntry(4);
                    C4 = t4.Text.Replace("|", "");
                    TextRelay t5 = info.GetTextEntry(5);
                    C5 = t5.Text.Replace("|", "");
                    TextRelay t6 = info.GetTextEntry(6);
                    C6 = t6.Text.Replace("|", "");
                    TextRelay t7 = info.GetTextEntry(7);
                    C7 = t7.Text.Replace("|", "");

                    string ADV = "false", HIDEB = "false";
                    if (Adv)
                    {
                        ADV = "true";
                    }
                    if (!HideB)
                    {
                        HIDEB = "true";
                    }
                    from.SendGump(new CommandToolbarEdit(C1, C2, C3, C4, C5, C6, C7, HideS, HIDEB, ADV));

                    break;
                }
                }
            }
        }