So I guess this is slightly more appropriate for the programming section vs the pserver section.. problem is that the only place where it would be considered anything but basic knowledge and like 5 minutes of work would be in that section >.< (yay for lazy nubs who can't code at ALL)
May as well post it here though so here goes.
I was introduced fairly recently to the Queue system that C# has built into it.
What annoyed me was the inability to remove something prematurely from this queue. Unlike a dictionary you have no simple way to just toss out data you decide you don't need anymore. You have to handle it in the order it is added (which is the entire point of queue's I admit but there are many situations where you may want both)
So I wrote up a VERY simple wrapper for this.
So far it's just a few methods and a little bit of logic but it works perfectly for my server. Basically I am using it for my ground floor. Every time I drop an item I queue it up (to handle item timeout). Then if it gets looted before that I can use the .Remove(object) method so that it is no longer being spawned to people and I don't need to wait for the item floor thread to run through disposing all the previous objects dropped.
Works rather nicely so thought I'd share incase anyone else wanted it.
It's not obfuscated so feel free to mess around with the code (what tiny bit there is!)
The methods and usage is rather simple.... Add the dll reference to your server and then do using Queueing;
Then to use it just do something like..
Queueing.Queue Items = new Queueing.Queue();
You can then use the following methods...
Count: returns number of objects in the queue currently
Peek(): returns but does NOT remove the first object in the queue (next to be processed). Use for checks
Dequeue(): returns and removes the first object in queue (next to be processed)
Queue(object): adds the specified object to the END of the queue (LAST to be processed)
Remove(object): Removes the specified object from the queue regardless of its position.
Feel free to criticize and offer suggestions/improvements.
Also keep in mind you will want to only be storing one type of value in your queue and verify it before running checks.
Eg:
if(!(Items.Peek() is GroundItem))
return;
And convert it!
GroundItem I = (GroundItem)Items.Dequeue();
or
GroundItem I = Items.Dequeue() as GroundItem;