I am beginner. I am looking for the simple way to make:
- specific item disabled from add/dupe command (depending on access level)
- adding new account and playermobile property (how to?)
- additionally for the acc property is it possible to make it restricted? changable for specific access level and visible for specific access level?
i have never messed with serialization...
 
- specific item disabled from add/dupe command (depending on access level)

Not sure what you are trying to do/avoid here. When you say "depending on access level" do you mean you want certain people to be able to add or dupe a particular item, but nobody else can? Add/Dupe are staff commands. You need to prevent staff from creating certain items? I am not aware of a way to do that, except if the item does not have a zero parameter constructor, it will prevent adding. Perhaps that will help you.

adding new account and playermobile property (how to?)

To create a new property, first add a private and public variable to store the property:

Code:
        private bool p_showWarning;
	
        [CommandProperty( AccessLevel.GameMaster )]
        public bool ShowWarning { get { return p_showWarning; } set { p_showWarning = value; } }

Next, if you need the property saved and loaded, you will need to modify Serialization and Deserialization methods.

In the Serialize method, change the version number by incrementing it, so if it used to be 28, you would CHANGE it to this:

Code:
    writer.Write( (int) 29 ); // version

Next, below that, before you start writing any other values, you write out the new variable, like this:

Code:
    writer.Write( p_showWarning );

Last, in the Deserialize method, in the "switch (version)" section, you add a new "case". It would look something like this:

Code:
                case 29:
                {
                    p_showWarning = reader.ReadBool();
                    goto case 28;
                }
                case 28: // This used to be the start of the case statements....
                {

- additionally for the acc property is it possible to make it restricted?

To have a property have different view and edit restrictions, you can do this:

Code:
        [CommandProperty( AccessLevel.GameMaster, AccessLevel.Owner)]

The preceding code makes the property readable by GameMaster level and above, but writable by only Owner level.
 
Not sure what you are trying to do/avoid here. When you say "depending on access level" do you mean you want certain people to be able to add or dupe a particular item, but nobody else can? Add/Dupe are staff commands. You need to prevent staff from creating certain items? I am not aware of a way to do that, except if the item does not have a zero parameter constructor, it will prevent adding. Perhaps that will help you.

i need gm access level and possibility to create items for them, but i have some items that should be restricted for admins to create/dupe. Maybe i could use arg with access level to create item and inside item code it could be checked? It makes sense only for one, two items...

To create a new property, first add a private and public variable to store the property:

Code:
        private bool p_showWarning;
	
        [CommandProperty( AccessLevel.GameMaster )]
        public bool ShowWarning { get { return p_showWarning; } set { p_showWarning = value; } }

Next, if you need the property saved and loaded, you will need to modify Serialization and Deserialization methods.

In the Serialize method, change the version number by incrementing it, so if it used to be 28, you would CHANGE it to this:

Code:
    writer.Write( (int) 29 ); // version

Next, below that, before you start writing any other values, you write out the new variable, like this:

Code:
    writer.Write( p_showWarning );

Last, in the Deserialize method, in the "switch (version)" section, you add a new "case". It would look something like this:

Code:
                case 29:
                {
                    p_showWarning = reader.ReadBool();
                    goto case 28;
                }
                case 28: // This used to be the start of the case statements....
                {
Thx, looks clear, will try. But... Accounts are stored in the same way as playermobiles? I am interested in adding props to playermobile (character) but also different for the whole account. And accounts properties arent stored in xml file? If yes, how can i add property to whole acc?
To have a property have different view and edit restrictions, you can do this:

Code:
        [CommandProperty( AccessLevel.GameMaster, AccessLevel.Owner)]

The preceding code makes the property readable by GameMaster level and above, but writable by only Owner level.

Oh. Tell me... this will take effect on [get/[set command, but also for [props? props gump is created automaticly from this data? If yes, is there a way to hide it?

Thx for your tutorial :)
 
Back