RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

XmlPoints

ArteGordon

Wanderer
XmlPoints v1.16b

XmlPoints
v1.16b
updated 1/19/05
ArteGordon

SUMMARY
A system that supports player-vs-player kill tracking, 1-on-1 challenge dueling, multi-player challenge games, shardwide pvp ranking, and pvp rewards.


INSTALLATION:

This thread is no longer updated. GO HERE for the latest version
http://www.runuo.com/forum/showthread.php?t=49903


DESCRIPTION:

This system makes use of the XmlSpawner2 attachment system and the XmlSpawner2 package must be installed to support it. You dont need to use the xmlspawners themselves, and it doesnt matter whether you use the standard distribution spawners or any other spawning system but you do need the XmlSpawner2 package installed.

Because the attachment system neither requires nor makes any changes to serialization/deserializations of any item or mobile (including the playermobile), it can be safely added and removed at any time now or in the future without interfering with any other systems that you might have installed and that includes any existing points system.

Note, only kills by players are recognized by the system. Make sure your accesslevel is player when testing features.

Features:

Points - accumulated or lost based upon PvP kills or deaths, these are used to rank players. Individual and shard-wide standings can be displayed. Amount of Point loss or gain can be made dependent upon the relative Point difference between the players, providing additional incentives for taking on players with higher ranking, and penalties for losing to players of lower ranking. The system can also be configured for automatic point loss if the player does not engage in pvp activity over the specified time window.

Rankings - relative Points standing of players on a shard is maintained and can be displayed for individuals as well as for the entire shard (the top 20). If the Item Identification feature of the XmlSpawner2 installation is enabled (XmlSpawner2 installation step 8), the skill can be used to examine the points and standing of other players as well. Using the [leaderboardsave command, shardwide ranking information can also be periodically saved to a specified xml file.

Duels - The challenge system allows 1-on-1 consensual pvp between players for points.

Challenge Games - The challenge game system supports multi-player consensual pvp games. Current Games: Last Man Standing, Deathmatch, King of the Hill, DeathBall, Team Last Man Standing, Team Deathmatch, Team Deathball, Team King of the Hill, Capture the Flag.

Credits - accumulated through PvP kills, these are used to purchase PvP rewards.

Rewards - the PointsRewardStone allows players to exchange kill credits that are accumulated through PvP activity for rewards including items, mobiles, or attachments. These can be defined in XmlPointReward.cs. Minimum points requirements can also be specified in addition to credit requirements for each reward. To place this just do an "[add pointsrewardstone"


Commands supported:

[getatt - this is the general command from the XmlSpawner2 package for displaying/modifying/deleting attachments on a target. Just execute the command and target a player to open the attachment list. From there you can open the xmlpoints properties by finding the xmlpoints attachment on the list, and selecting the button on the left, or display the points gump by pressing the question mark button on the right. This command is available to GMs or higher only.

[addallpoints - this command will add the xmlpoints attachment to all current players that dont have it yet and can only be run by an administrator.

[removeallpoints - this command will remove the xmlpoints attachment from all current players and can only be run by an administrator.

[checkpoints - this command can be run by players to report their current points standing including rank, available credits, number of kills, number of deaths, and recent kill list (this is the same as using the item identification skill on themselves if that feature has been enabled through XmlSpawner2 installation step 8)

showpoints - when players type this it publicly displays their points overhead.

[topplayers - this command can be run by players to list the current top 20 players ranked by points. This can also be invoked through the points gump.

[challenge - this command can be run by players to allow challenge duels for points. Just issue the command and target another player. The targeted player can then accept or decline the challenge. This can also be invoked through the points gump.

[lmschallenge - this command can be run by players to create a last man standing challenge game.

[deathmatch - this command can be run by players to create a deathmatch challenge game.

[kingofthehill - this command can be run by players to create a king of the hill challenge game.

[deathball - this command can be run by players to create a death ball challenge game.

[teamlmschallenge - this command can be run by players to create a team last man standing challenge game.

[teamdeathmatch - this command can be run by players to create a teamdeathmatch challenge game.

[teamkoth - this command can be run by players to create a new Team king of the hill challenge game.

[teamdeathball - this command can be run by players to create a new Team Deathball challenge game.

[ctfchallenge - this command can be run by players to create a new Capture the Flag challenge game.


[seekills - this command can be run by players to allow them to control whether or not they see the broadcast results of pvp kills. This can also be set through the points gump.

[broadcastkill - this command can be run by players to toggle system-wide broadcasts of their pvp-kills. Broadcast is determined by the winners setting. This can also be set through the points gump.

[systembroadcastkill - this command can be run by GMs to allow system-wide GM override of player BroadcastKill settings. When set to false, no results will be broadcast. When set to true, results will again be broadcast based on players BroadcastKill settings.

[leaderboardsave - this command can be run by administrators to enable/disable the periodic saving of xml leaderboard information to a specified file.


Default settings that can be modified:

- There is a 6 hour minimum time between kills of the same player for point gain. This is set by the static variable m_KillDelay.

- There is a 60 second minimum time between deaths of a player for point loss. This is set by the static variable m_DeathDelay.

- Points gained/lost can depend upon the point difference between the players. Default setting is 5% of the point difference. The percentage gain/loss is set by the m_WinScale and m_LoseScale static variables and this can be changed to whatever you like. If it is set to zero then gain/loss will be fixed at 1 point per kill.

For example, if player1 with 500 points killed player2 with 100 points, player1 would only gain the minimum of 1 point and player2 would lose the minimum of 1 point. But if player2 killed player1, player2 would gain 20 points (5% of 400) and player1 would lose 20 points.

- Credits gained can depend upon the point difference between the players. Default setting is 5% of the point difference. Set by the m_CreditScale

- Players start off with a default of 100 points, set on m_Points.

- broadcasting of kills is on by default. This is set by the m_Broadcast (for players) and m_SystemBroadcast (for GM override) variables.

- rewards can be specified by adding/removing entries to the PointsRewardList in the Initialize method in XmlPointsReward.cs.

- leaderboard save settings can be specified on the command line to the [leaderboardsave command, with default values set in the m_LeaderboardSaveInterval (default 15 mins), m_LeaderboardSaveDirectory (default "Leaderboard"), and m_LeaderboardSaveRanks (default 20) static variables.

- for automatic point loss if the player does not engage in pvp activity the amount of loss and time period can be configured by setting the m_PointsDecay (10 points default) and m_PointsDecayTime ( 15 days default) static variables.

- receiving kill broadcasts is on by default set by the m_ReceiveBroadcasts variable.

- challenges can be cancelled by issuing another challenge and targeting another player (self-target is allowed for this purpose). There is a 15 minute timeout from the time the cancellation request is made. This default time can be changed in the static variable CancelTimeout.
 

ArteGordon

Wanderer
updated to version 1.01
11/07/04

- added the [BroadcastKill command that allows players to toggle system-wide broadcasts of their pvp-kills. Broadcast is determined by the winners setting.


- added the [SystemBroadcastKill command that allows system-wide GM override of player BroadcastKill settings. When set to false, no results will be broadcast. When set to true, results will again be broadcast based on players BroadcastKill settings.
 

ArteGordon

Wanderer
updated to version 1.02
11/08/04

- added kill Credits that are added for each kill and can be use to purchase items from the PointsRewardStone. Credits are gained for kills but not lost (like Points) on deaths. The m_CreditScale factor determines how many credits are gained per kill based on the point difference between killer and killed (works just like the m_WinScale).

- added the PointsRewardStone that can be used to purchase rewards using kill Credits. Just "[add PointsRewardStone" to place it.

- added the XmlPointsRewards class that lets you specify the rewards and their costs. Items, Mobiles, and Attachments can be specified as rewards.

- added the static methods int GetCredits(Mobile m), bool TakeCredits(Mobile m, int credits), and bool HasCredits(Mobile m, int credits) which external scripts can use to interface with the Credits system. Note, if a negative credits argument is passed to TakeCredits, it will add to the players Credit total. HasCredits and TakeCredits return a bool depending on whether player has sufficient credits.
 

ArteGordon

Wanderer
A) the class is not intended to be used outside of the XmlPoints class that it is nested in.

B) the variables in the class are intended be used within the scope of the XmlPoints.cs script alone which is how it is set up.

It works perfectly fine.
 

ArteGordon

Wanderer
I'm afraid that the fact that you aren't alone, does not make you right.

If you make the variables private, then they are not accessible outside of the class that they are defined in (that would be KillEntry in this case).
Any attempt to reference them elsewhere in the XmlPoints class would fail. That is what private means - private to the class it is defined in.

Internal makes the variables accessible outside of the defined class but restricted to within the assembly, thus they can be referenced within the rest of the XmlPoints class, which is how they were intended to be used.
 

Phantom

Knight
I wasn't informed about the public ctor in your class, which makes a small difference.

You still should not be using internal, its not required in this case.

There is no reason those variables could not be private and then add a public variable that gets and sets the value, like any other script uses.

Could even use a method if you wanted.

But the class is private and cannot be accessed outside of the class its nested within.

But having a internal and public ctor defeats the perhaps of making anything in that class internal.
 
ArteGordon said:
I'm afraid that the fact that you aren't alone, does not make you right.

If you make the variables private, then they are not accessible outside of the class that they are defined in (that would be KillEntry in this case).
Any attempt to reference them elsewhere in the XmlPoints class would fail. That is what private means - private to the class it is defined in.

Internal makes the variables accessible outside of the defined class but restricted to within the assembly, thus they can be referenced within the rest of the XmlPoints class, which is how they were intended to be used.

There's no point to marking those properties and the constructor as internal.
Nested classes can only be accessed by the parent class anyways. This includes construction, and referencing properties on them. By nesting that class inside your XmlPoints class, XmlPoints is the only class that can access, reference and create new instances of that class.
 

Phantom

Knight
ArteGordon said:
they could be made public, but not private. Internal is the same as public in this case.


But it doesn't make sense to make them internal in this case...

The variable is within a private class, and thus basicly acts like a private variable.
 

Knightshade

Wanderer
Arte, great work!

I'm writing up plans now for possible implimentation of this system into our shard. I've been a big fan of your xmlspawner2 system, and am sure the same love and care has gone into this as well. Thanks for all your hard work on this! It's greatly appreciated!
 

ArteGordon

Wanderer
thanks Knightshade,
The idea is to provide a variety of incentives for healthy pvp activity through rewards in the form of items as well as temporary bonuses such as stat and damage boosts as well as the public rankings. There is also a connection with the XmlMobFactions system if the Player faction is used. PvP in that case can improve monster factions and therefore provide additional PvM bonuses (the faction multipliers still have to be tuned for that.)
I'll be putting in a extension to the reward system that I just added that will make it multi-tiered and tied to points rankings, so higher points rankings opens up higher levels of available rewards (they still have to be purchased with Credits).
 

ArteGordon

Wanderer
updated to version 1.02a
11/09/04

- minor fix for credit scaling. I was using the same scale factor for both points and credits. Now credits are properly scaled by m_CreditScale instead of m_WinScale.
 

stormwolff

Knight
My players love this, thanks for another great script arte.

Any chance of getting a php web based version of the leaderboard? Does it store the points in a text or xml file?
 

ArteGordon

Wanderer
currently the leaderboard information is produced on the fly as a text that is displayed in the top players gump when someone issues the [topplayers command, so it doesnt get stored in a file, although thats a really good idea.

I could have it generate an xml file with leaderboard information on a timer so that you could set it to update periodically.
 

stormwolff

Knight
ArteGordon said:
currently the leaderboard information is produced on the fly as a text that is displayed in the top players gump when someone issues the [topplayers command, so it doesnt get stored in a file, although thats a really good idea.

I could have it generate an xml file with leaderboard information on a timer so that you could set it to update periodically.

That would be great.
 

AHappyAdmin

Wanderer
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Custom Scripts\XmlPoints.cs: CS0101: (line 44, column 18) The
namespace 'Server.Engines.XmlSpawner2' already contains a definition for 'XmlPoi
nts'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


Help please hehe
 

stormwolff

Knight
AHappyAdmin said:
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Custom Scripts\XmlPoints.cs: CS0101: (line 44, column 18) The
namespace 'Server.Engines.XmlSpawner2' already contains a definition for 'XmlPoi
nts'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


Help please hehe

You already have the first xml points if you installed the xmlspawner. Remove the old one or overwrite it with the new one.
 

ArteGordon

Wanderer
it may also be that there are two copies in the package. (I think when I dropped in the updated one the old one was left in). I'm going to put up a new update soon.
As stormwolff suggested, I would just make sure that you dont have multiple copies of the xmlpoints.cs file.
 
Top