Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 06-02-2007, 07:09 AM   #1 (permalink)
Newbie
 
Join Date: Nov 2004
Posts: 16
Default Region.getPlayerCount()

If possible, could there be a change to the Region.GetPlayerCount() method so that it will only count players, not staff. It is a problem that when a staff member goes to the gauntlet, he will often trigger an increased spawn count. This is quite annoying for players, but it also effectively notifies the players that a staff member is watching them.

If there is ever a need to count staff and player together in a regions, could this method take a boolean or could a second method be added so you could count both with/without staff.

Since core modifications are discouraged for support reasons, it would be very handy for the RUNUO team fix this in the region code.
syznow is offline   Reply With Quote
Old 06-02-2007, 01:22 PM   #2 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Just make a RegionUtility class, and it it write this method yourself. It'd be pretty simple.

something like
Code:
public static int CountPlayersInRegion(Region region, bool countStaff)
{
     int count = 0;
     foreach( Mobile m in World.Mobiles.Values )
     {
           if( m != null && m.Player && m.Region == region )
           {
                if(((PlayerMobile)m).AccessLevel != AccessLevel.Player && !countStaff)
                      continue;
                 
                count++;
           }
     }

      return count;
}
I havent coded RunUO Stuff for over a year so some of this API could be wrong, but you should get the Idea.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 06-03-2007, 01:42 PM   #3 (permalink)
Newbie
 
Join Date: Nov 2004
Posts: 16
Default

Jeff, thanks for the post. I do realize it can be worked around, however depending on the player count and the slice interval I can see this iteration could be pretty inefficient compared to having this change made in the core Region.cs code.

I just wanted to enter it as a suggestion for to consideration, since hidden staff should probably not trigger spawn count increases whenever they enter the Gauntlet.
syznow is offline   Reply With Quote
Old 06-04-2007, 12:58 PM   #4 (permalink)
Forum Expert
 
TheOutkastDev's Avatar
 
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
Default

Quote:
Originally Posted by syznow View Post
Jeff, thanks for the post. I do realize it can be worked around, however depending on the player count and the slice interval I can see this iteration could be pretty inefficient compared to having this change made in the core Region.cs code.
Just call GetMobiles and iterate over that list instead of using World.Mobiles.Values if you're really concerned about efficiency.

Last edited by TheOutkastDev; 06-04-2007 at 02:01 PM.
TheOutkastDev is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5