I really don't want to look up into other messy public sources, so I'd like you to help me.
I cannot figure out nobility listing.. I have something in my head that goes like this..
When Somebody donates ->
Code:
[U]ulong[] Donations = new ulong[50];[/U]
for (int i = 0; i < 50; i++)
{
if (Char.Donation < Donations[i])
Char.NobleRank = i;
}
But what is next?
It's really hard for me to realize, anybody willing to help me for REAL, or willing to code a part for me please add me on my msn
It will do what array.sort will but won't have any annoying issues you might normally have with an array (non dynamic size, etc). I'd simply use a link query to pull all valid donations (above X value or w/e), sort them by donation, limit how many I want to pull (top 60 or w/e for the list) and then .ToList() the returned collection and you're good to go.
i wold do it this way though idk its just another way to do the ranking
PHP Code:
public static List<Struct.NoblilityStatus> NobilityBoard = new List<Struct.NoblilityStatus>();
PHP Code:
Monitor.Enter(Dictionary.NobilityBoard);
try
{
Struct.NoblilityStatus ID = Dictionary.NobilityBoard.Where(p => p.UID == Status.UID).FirstOrDefault();
if (ID == null) { Dictionary.NobilityBoard.Add(Status); }
else { Dictionary.NobilityBoard[Dictionary.NobilityBoard.IndexOf(ID)] = Status; }
var NobilityCount = from DV in Dictionary.ThreadSafeDictionary(Dictionary.NobilityBoard) where DV.Donation < Status.Donation && DV.UID != Status.UID select DV;
if (NobilityCount.Count() > 0)
{
int Rank = (Dictionary.NobilityBoard.Count() - NobilityCount.Count()) - 1;
if (Dictionary.NobilityBoard[Rank].UID != Status.UID)
{
Dictionary.NobilityBoard.Remove(Status);
Dictionary.NobilityBoard.Insert(Rank, Status);
/*Update the db table*/
}
}
else { /*Update the db table*/}
}
finally { Monitor.Exit(Dictionary.NobilityBoard); }
Use LINQ or grab the values straight from the database.
Code:
SELECT * FROM nobility ORDER BY donation DESC LIMIT 0, 9
Will get you the top 10 nobility donations.
Code:
var results =
(from I in NobilityRecords.Values orderby I.Donation descending select I)
.Skip((int)page * NOBILITY_PAGE_SIZE)
.Take(NOBILITY_PAGE_SIZE);
That's what I do in my source. I store all of the nobility rankings inside the source just cause I haven't bothered converting to our nhibrinate db system yet. Works perfectly and supports multiple pages.
It should be noted that using LINQ impacts performance greatly, and that while as significantly less elegant as a for loop is, they are significantly faster.
It should be noted that using LINQ impacts performance greatly, and that while as significantly less elegant as a for loop is, they are significantly faster.
yep but ... I would personally still use linq when it comes to such stuff ranking/localClients/in range mobs as it doesent really impact performance when it comes to 600/700 items (few millisec's)
When your developing for a server a few milliseconds whenever you do anything that involves the clients, rankings, mobs builds up. Its the server, you shouldn't be sacrificing time for readability, what kind of approach to server development is that?
Yes my argument is that if you can save time by improving performance through your source then you should, so use threadpooling where possible (and necessary) use code that is faster, not more elegant.
Privat server listing 02/28/2021 - Perfect World - 119 Replies If you want to post or advertise a private server for perfect world, do it here.
All other threads will be deleted.
Please post some more info than only the address, something like rates or server details.
All thanks posts, questions etc. will be deleted without a comment. (better you write a PM to the author)
Request Server Listing ? 06/22/2011 - SRO Coding Corner - 11 Replies Trying to find out hpmp update packets .. see http://www.elitepvpers.com/forum/sro-coding-corner /1221235-request-server-listing.html#post11076229
Charakter Stats listing 11/03/2010 - General Gaming Discussion - 24 Replies </span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>
QUOTE </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->
Mage
Base Attributes
Basic Attack: 60
Range Attack: 90
Special Attack: 100
Grip Attack: 100
How is top 20 listing determined? 10/13/2007 - Conquer Online 2 - 11 Replies Hi, i have 3 lvl 130 archer, however, it nvr shown in the top 20 listing of my server..
i noted those top 20 are always the same few player. anyone know how is it determined?