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!

[RUO 2.0] Shard Voting

Vorspire

Knight
[RUO 2.0] Shard Voting

Shard Voting
----------
PACKAGE:
----------
namsepace Server.Voting
----------

OVERVIEW:
----------
----------

  1. The ability to specify multiple vote websites and track each one seperately.
  2. The ability to choose standard options for each vote site.
  3. Capturing vote requests and invoking a special event to broaden system functionality.
Almost everything within the scripts for this system is summarized, giving you (hopefully) some simple and easily understandable information on how each part works.
- The XML documentation summaries will provide pop-up information to VS users.
----------

----------
FUNCTIONALITY:
----------
----------

When the system is running, it will allow players to vote for your shard in 2 different ways;
  1. Using the [Vote command (See: COMMANDS)
  2. Using an ingame VoteItem object.
Using an ingame VoteItem object enables you to provide multiple voting sites, one per VoteItem.

This system supplies you with a VoteStone which can be added ingame by using one of these commands:
  • [Add VoteStone - Creates an instance of VoteStone.
  • [Add VoteStone <string name> - Creates an instance of VoteStone with custom name.
  • [Add VoteStone <string name> <int hue> - Creates an instance of VoteStone with custom name and hue.
VSPropsList.jpg

When you have added the VoteStone, it will automatically use the default options provided by the VoteConfig object, which can be configured by using the [VoteConfig command (See: COMMANDS).

VSPropsMenu.jpg

When the VoteSite' Valid property is false, this means that the URL you have entered is Invalid and voting from this stone will be Unavailable.

VSUnavailable.jpg

Unavailability will prevent anyone from attempting to vote for this vote site.

When a vote request is invoked, the system determines whether they are allowed to vote based on Account Tags (as sugested by David) to keep track of the last time the player invoked a vote request that was successful.

AccountTags.jpg

As you can see, each VoteSite profile has it's own tag.

The system will not let the player vote until the time of the Account Tag plus the CoolDown time for that VoteSite is less than the current time (DateTime.Now).

Restriction.jpg

The system can very easily be modified to give rewards upon voting too, you can simply override the OnVote( Mobile m, VoteStatus status ) method provided by the base VoteItem to have it drop an item in the players' backpack if the vote was successful or not.
The VoteStatus variable argument can determine the status of the vote request at that point. The standard values are:
  • Invalid - The request was rejected because something went wrong. This can happen when a VoteItem is not set up properly.
  • Success - The request was successful.
  • TooEarly - The request was rejected because it was made before the CoolDown delay reached zero.
  • Custom - The request was rejected because the VoteItem.OnBeforeVote method returned false.
That is the basics of this system, I will let you personally look at the code and comments to learn more about the functionality of this system.
----------

----------
COMMANDS:
----------
----------

The system comes with 3 standard commands:
  • [Vote - Cast a vote for your shard. (Player)
  • [VoteInstance - Gets the props menu for the internal VoteItem instance. (GameMaster)
  • [VoteConfig - Gets the props menu for the internal vote system configuration. (GameMaster)
[Vote:
This command does not support multiple vote sites, however, it does make use of the internal VoteItem instance to allow players to cast a vote.

[VoteInstance:
This command allows you to configure the internal VoteItem instance for use with the [Vote command.

[VoteConfig:
This command allows you to change the overall default settings of the vote system. These settings are typically used whenever a new VoteItem object is created.
----------

----------
INSTALLATION:
----------
----------

  1. Extract the archive.
  2. Drag & Drop the 'Voting' folder into your 'Scripts' directory.
  3. Check and configure the base options in 'VoteConfig.cs' to make sure they suit your shard.
  4. Start RunUO, log-in and add your 'VoteStone'.
  5. Finished, unless you wish to configure your 'VoteStone' more, use the [Props command.
----------

----------
REGARDS:
----------
----------

Thank you for taking the time to read this post, I hope this system was of use to you and that it may benefit your shard greatly.

-Vorspire
 

Attachments

  • Voting 2.0 - RunUO 2.0.rar
    7 KB · Views: 392

Vorspire

Knight
animalcrackers;815629 said:
what about rewards?

Vorspire;815511 said:
The system can very easily be modified to give rewards upon voting too, you can simply override the OnVote( Mobile m, VoteStatus status ) method provided by the base VoteItem to have it drop an item in the players' backpack if the vote was successful or not.

See if you can do this :) The system does not come with rewards, but can be easily edited to supply them.

For example, in VoteStone.cs:

PHP:
public override void OnVote( Mobile m, VoteStatus status )
{
    base.OnVote( m, status );

    if( status == VoteStatus.Success )
        m.AddToBackpack( new Gold( 1000 ) );
}
 

old_school

Wanderer
Just a minor suggestion. Id make a more presentable Gump. I mean to those who plan to use it on a live server. This is a great system it looks like to set up a base voting system. But Id suggest you guys get gump studio and edit the gumps. Just a suggestion.
 

Vorspire

Knight
old_school;815667 said:
Just a minor suggestion. Id make a more presentable Gump. I mean to those who plan to use it on a live server. This is a great system it looks like to set up a base voting system. But Id suggest you guys get gump studio and edit the gumps. Just a suggestion.

There really is no need for fancy gumps here, the only people intended to access the interface are GM's, to configure the VoteStone, so there's no need to fix what's not broken :p
 

GhostRiderGrey

Sorceror
Vorspire;815634 said:
See if you can do this :) The system does not come with rewards, but can be easily edited to supply them.

For example, in VoteStone.cs:

PHP:
public override void OnVote( Mobile m, VoteStatus status )
{
    base.OnVote( m );

    if( status == VoteStatus.Success )
        m.AddToBackpack( new Gold( 1000 ) );
}


Vorspire, thank you for taking the time to create these scripts. We are in the process of implementing them now. When I try your code shown above to add a gold drop, I get the following error:

Code:
Errors:
 + Customs/ZZZ Works in progress/ZZZ Webstone Voting 1.0/Voting/VoteStone.cs:
    CS1501: Line 75: No overload for method 'OnVote' takes '1' arguments
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

My line 75 is the base.OnVote( m ); line. But I am unsure how to correct the error.

Any input would be appreciated.
:D GhostRiderGrey
 
GhostRiderGrey;815877 said:
Vorspire, thank you for taking the time to create these scripts. We are in the process of implementing them now. When I try your code shown above to add a gold drop, I get the following error:

Code:
Errors:
 + Customs/ZZZ Works in progress/ZZZ Webstone Voting 1.0/Voting/VoteStone.cs:
    CS1501: Line 75: No overload for method 'OnVote' takes '1' arguments
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

My line 75 is the base.OnVote( m ); line. But I am unsure how to correct the error.

Any input would be appreciated.
:D GhostRiderGrey

base.OnVote( m, status );
 

JamzeMcC

Squire
Just wanted to say thank you! Post is a bit old but you deserved the appraise. Truly appreciate the work you did on this one! Sure helps me from having to write my own or modifying another lol :D
 

Iomega0318

Sorceror
JamzeMcC;825744 said:
Just wanted to say thank you! Post is a bit old but you deserved the appraise. Truly appreciate the work you did on this one! Sure helps me from having to write my own or modifying another lol :D
I fully agree, great job!
 

Ice19999

Sorceror
i droped it in and got these errors (RUO2.0final)
Code:
Errors:
 + Customs/Voting/VoteCommand.cs:
    CS0234: Line 11: The type or namespace name 'Comands' does not exist in the
namespace 'Server' (are you missing an assembly reference?)
    CS0246: Line 26: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
    CS0246: Line 36: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
    CS0246: Line 46: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

easy fix should have looked b4 i posted but any ways heres the change
Code:
using System;
using System.Collections;
using System.Collections.Generic;

using Server;
using Server.Misc;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
[COLOR="Red"]using Server.Comands;[/COLOR]

namespace Server.Voting
{
change the red to the blue
Code:
[COLOR="Red"]using Server.Comands[/COLOR];   
[COLOR="Blue"]using Server.Commands[/COLOR];
 

Vorspire

Knight
Ice19999;830004 said:
i droped it in and got these errors (RUO2.0final)
Rich (BB code):
Errors:
 + Customs/Voting/VoteCommand.cs:
    CS0234: Line 11: The type or namespace name 'Comands' does not exist in the
namespace 'Server' (are you missing an assembly reference?)
    CS0246: Line 26: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
    CS0246: Line 36: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
    CS0246: Line 46: The type or namespace name 'CommandEventArgs' could not be
found (are you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

easy fix should have looked b4 i posted but any ways heres the change
Rich (BB code):
using System;
using System.Collections;
using System.Collections.Generic;

using Server;
using Server.Misc;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
using Server.Comands;

namespace Server.Voting
{
change the red to the blue
Rich (BB code):
using Server.Comands;
using Server.Commands;

Thanks for the update :D It's funny that no one else has posted this before hehe.
 
Top