|
||
|
|||||||
| Other Cant find a category above, use this one! Core mods not listed above go here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
This tutorial is no longer applicable to the supported version of RunUO (2.0 RC1 at the time of this writing). It will continue to be supported for RunUO 1.0.0, but at this time, I will not be making an updated version for 2.0 or any future versions of the RunUO package.
Note: This requires core modification. If you are uncomfortable with this, turn back now. This is written using the most recent build of SharpDevelop, and does not address anything in Visual Studio .NET or any other compiler/project manager. Forewarning: this tutorial is written using the RunUO 1.0.0 release and SharpDevelop 1.1 on the .NET Framework 1.1. Since RunUO 2.0 and the .NET Framework 2.0 have since been released, this tutorial is outdated. If you want to try to adapt some of the information provided, read on. Note that the screenshots may not apply to your version of SharpDevelop. Applications you need:
1) Extract the core source to a directory you will remember. Move the project creator to the base directory, and run it for SharpDevelop. ![]() 2) Now open the new RunUO_Core.prjx file (or the Server.prjx file, depending on the project creator you used). Once it's loaded into SharpDevelop, the first step is to make sure that you have the Projects tab open. You can do this by pressing Ctrl + Alt + L or by going to the menu bar, clicking View, and then Projects. 3) Next, we'll set the output type to Release, instead of Debug. On the second toolbar, the last tool is a combo box. By default it is set to Debug, but you'll want it as a Release. ![]() 5) Before we begin coding, you have to set some project options. Right click the project name, which is the second category and is in bold, and go to Project options. Please note that the Project name may be different on your current set up. ![]() 5a) Under the General tab, make sure the side arrow is at Project options. Change the 'Name' value to Server, and the 'Standard Namespace' to Server as well. 5b) Click on the Configurations tab folder. Select the Release folder. Double-check to make sure the first value in the window, "Allow 'unsafe' code", is set to true. 5c) Click on Output. Change the 'Compile target' value to 'Exe'. The Assembly name should be Server. I recommend setting the output path to ..\-core source-\bin\Release. Here's an example of my own setup: ![]() 6) Now for the coding. In the project files list on the left hand side, double-click Mobile.cs. Locate the following around line 417: Code:
public enum AccessLevel
{
Player = 0,
Counselor = 1,
GameMaster = 2,
Seer = 3,
Administrator = 4
}
One top-level accesslevel Code:
public enum AccessLevel
{
Player = 0,
Counselor = 1,
GameMaster = 2,
Seer = 3,
Administrator = 4,
Patriarch = 5
}
Code:
public enum AccessLevel
{
Player = 0,
Counselor = 1,
GameMaster = 2,
Seer = 3,
Protectorate = 4,
Administrator = 5,
Patriarch = 6
}
Code:
private static string[] m_AccessLevelNames = new string[]
{
"a player",
"a counselor",
"a game master",
"a seer",
"the protectorate",
"an administrator",
"the patriarch"
};
8) Save and close Mobile.cs. Now you're done editing. This step is to build the project and make the executable. There are several ways to do this.
9) All that done, move your new Server.exe to your normal RunUO directory, overwriting the previous Server executable. 10) Download the attached file, AccessLevelConversion.cs, and move it to your RunUO\Scripts directory. Open the file in your usual editor, and go to line 17. 11) Now, looking at the AccessLevel enumeration that you changed in the core Mobile.cs (around line 417 if you need to reopen the file), adjust the m_Offsets array to reflect your changes to the default accesslevels. You will need to add your new accesslevels to this list. For example, if you added one accesslevel above Player, then Counselor, GameMaster, Seer, and Administrator are going to be 2, 3, 4, and 5 respectively (instead of the default 1, 2, 3, and 4). Your new level will be 1. Therefore, inside the AccessLevelConversion file, you would change the m_Offsets to be 0 (player), 1 (new level), 2 (counselor), 3 (gamemaster), 4 (seer), 5 (administrator). 12) When you have figured that out, save and close the file. 13) Boot your server as usual. Use the command FixAccessLevels to restore everyone's AccessLevels. If you are not an Administrator (because you added a new level under it, for example), create a new (temporary) character on your Administrator account and run the command with that character instead. End Notes:
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales Last edited by Khaz; 12-13-2006 at 05:22 PM. |
|
|
|
|
|
#2 (permalink) |
|
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
|
Nice tutorial, but you forgot an important point. If you wish to do this on an existing shard, with an existing world, you need to take care of this in the serialization of the Mobile class.
If an Administrator is saved (as a byte of value 4 by defaut), once you implement your mod the same mobile will no longer be loaded as an admin but as a Protectorare (in your second example), so you pretty much need to add a new version to Mobile that handles your change.
__________________
Oxygen should be regarded as a drug. |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
*nods* That's true. I don't know exactly how to do that, so I just dealt with it (and forgot) on my end. Please accept my apology, but I am rather timid around serializations.
I see the de/serialization of the access level in Mobile.cs. Would it be as simple as to just up the version on serialization and deserialization?
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
|
|
|
#4 (permalink) |
|
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
|
Well it's not difficult, but you need to introduce a new version in the Mobile class which will make it tricky to upgrade when a new core is released.
Another solution would be to write an ad-hoc script that performs a one time conversion... in other words, load the world and allow access levels to be wrong. Then run a script that looks at each accesslevel and adjusts it (so any Protectorate will be converted to Administrator). Of course none of this applies if you add accesslevels with values < 0 or > 4.
__________________
Oxygen should be regarded as a drug. |
|
|
|
|
|
#5 (permalink) |
|
Join Date: Oct 2002
Age: 22
Posts: 4,689
|
The easiest thing to do is to append serialization and go through all serializations of accesslevel (not just Mobiles... basesuit has it too), and use a conversion method to convert it from the old to the new. Basically would say, if its a (AccessLevel)4, its now AccessLevel.Administrator (whatever that is now).
You can do this by editing all serializations of accesslevel, or you can make a script to cycle through the world items/mobiles/multis and check every property... either way its pretty sticky. |
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
I see what you both mean. I think when someone goes looking for a walkthrough they want the easiest methods, so it might be best to make an external script to cycle through. Hrm...I'll put a note to clear up any confusion for the time being, until I or someone else can develop the serialization fix.
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
Join Date: Dec 2002
Posts: 730
|
You should also add info about deleting/renaming existing accesslevels, and tell people to substitute all old instances of the old name on all scripts if they want to do this. I'm just saying this because I see this questions coming soon, but otherwise it is a pretty well written tutorial.
|
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
Added a couple notes there. I may have missed some of what you said, Atomic, so let me know if I understood it wrong.
I'll see about doing something for the serializations, but...I am no krrios.
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
|
|
|
#13 (permalink) |
|
Forum Expert
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
|
try a command that uses an int[] array to hold the new int values of the access levels. Ex:
Code:
RunUO Default:
public enum AccessLevel
{
Player = 0,
Counselor = 1,
GameMaster = 2,
Seer = 3,
Administrator = 4,
}
Code:
New enum:
public enum AccessLevel
{
Player = 0,
Counselor = 1,
GameMaster = 2,
Seer = 3,
Protectorate = 4,
Administrator = 5,
Patriarch = 6
}
Code:
private static int[] AccessOffsets = new int[]
{
0, // AccessLevel.Player remains zero
1, // AccessLevel.Counselor remains 1
2, // AccessLevel.GameMaster remains 2
3, // AccessLevel.Seer remains 3
5, // AccessLevel.Administrator changed to 5
};
public static void Initialize()
{
Commands.Register( "FixAccess" .... );
}
private static void FixAcces_OnCommand( CommandEventArgs e )
{
ArrayList mobiles = new ArrayList( World.Mobiles.Values );
for( int i = 0; i < mobiles.Count; ++i )
{
Mobile m = mobiles[i] as Mobile;
int newOffset = AccessOffsets[m.AccessLevel];
m.AccessLevel = (AccessLevel)newOffset;
}
}
|
|
|
|
|
|
#14 (permalink) |
|
Join Date: Sep 2004
Location: UK
Age: 37
Posts: 115
|
I`m reading this topic with great intrest, but one thing is bugging me, on the official OSI servers, they brought in the companions, as you will well know... but when they brought this in, they had a great number of levels.. this being Companion, Senior companion, Regional senior companion, and Arch companion.. they had a simular structure with the counselors as well, what confuses me here, is that we have 0-4 for access levels, but everyone of the above had different access commands determined by there rank... so am I right in persuming that re-wrote the entire structure and "added" in the companion ranks... or was it a case of a "check" to see what rank they were at and then allowed/dis-allowed certain commands...
Im only curious, about how you would persume they went about this, as I cannot see OSI re-writing the entire structure to add all the above said ranks... and now im going to ask about something I openly admit not knowing anything about, but is it possible for one rank to be "added" and then a check made to see what "tag" is attached to said mobile to allow/dis-allow certain commands... To elaborate on this abit, my idea would be to have one custom "level" that has a max of "blah commands" then a check is made on said mobile to see what "Tag" is attached to mobile, if "Tag" is 1.. then give blah commands.. if "Tag" is 2.. give a few extra commands.. and so on untill the max commands have been reached.. only an idea, and I don`t know if its do`able or not, but it would certainly be easier then adding 4 or 5 new levels no..? As I said before I have no idea how this advanced stuff works yet, so I may be as far of track as Mars... LOL but as me name states, I am trying... |
|
|
|
|
|
#15 (permalink) |
|
Forum Expert
Join Date: Dec 2002
Posts: 730
|
Yeah you can do that, just add a new property to PlayerMobile, serialize it properly and on each command you check like this:
Code:
if ( mobile.AccessRank <= 2 )
{
mobile.SendMessage( "You can't use this command");
return;
}
|
|
|
|
|
|
#16 (permalink) |
|
Join Date: Sep 2004
Location: UK
Age: 37
Posts: 115
|
So logically then you would only need to "add" one new accesslevel lets say for arguement sake, same access as GM, or perhaps even use the accesslevel of GM and then write up a script to check for "tags" each of which has a "sub level" which has defined commands that are allowed to be used... then I guess it would be a case of Admin/GM to do say a [promote1..2...3...4....5 or something to place the "tag" on said mobile.... thus giving them access to that "sub level" commands...
Sounds easy does it not.... !! Yeah Right, I bet... hehehee |
|
|
|
|
|
#18 (permalink) |
|
Join Date: Oct 2002
Age: 22
Posts: 4,689
|
If all you wanted to do was chop up the accesslevels that were already there... then it would make sense (for example)
Player - Guest - Normal - Veteran Counselor - Trial - Normal - Senior GameMaster - Apprentice - Normal - Elder (Lead) Seer - Assistant - Normal - Dev (Lead) Administrator - Assistant - Normal - Owner (Lead?) But other than that.. no matter what you do (since Accesslevel is serialized on items too) you wouldneed to do a conversion of some sort. |
|
|
|
|
|
#19 (permalink) |
|
Join Date: Sep 2004
Location: UK
Age: 37
Posts: 115
|
So the big question is... how hard is it to achive.... ? is it a simple script or is further modding into major scripts... ? (and yes spider I know you have the wolves at your door at the moment, so this question is general.... lol )
could be a nice script... if its not to hard to do... |
|
|
|
|
|
#21 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
Trying, I don't think what you suggest would be gods-awfully hard to do, but if I understand your goal correctly, you want to tag the PlayerMobile, no? I'd say go for it, and I'll see if I can pull up anything my end but please don't hold me to it (lots of stuff on the ToDo list).
I didn't know about the project creator from the Third Party Program forum either. I think it was one of the Announcement topics that I found out about it in. =/ Anyway, that and Project Generation are very promising. Hopefully I can get that guide updated with some more promising ways of updating the access levels. ![]()
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
|
|
|
#23 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Posts: 1,754
|
Ha...ha...
Actually, I'm adapting Outkast's example code and will be testing that later tonight.
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
|
|
|
#24 (permalink) |
|
Join Date: Sep 2004
Location: UK
Age: 37
Posts: 115
|
Heyyyyyyy now... LOL...! as I said earlier I would`nt have a clue where to start, Sure I can throw in some suggestions, but thats about my limit, though today I must confess I have bent over backwards to help many out on the forums with connection issues etc.. but scripting is something which seems to me takes a life time to learn and one is never able to master... :P
Curiousity and all of that led me to watch this topic with intrest to see where it was going... but as far as scripting anything.. still out of my depth at the moment im afraid... But to try perhaps cut a corner or two, the idea of having "Tags" rather than altering everything was one of them flash bangs that just pops into our heads from time to time... not sure if it was even do`able and to be honest I expected to be laughed at... :P Just an idea that may or may not be of any use to anyone that was thinking about perhaps looking at adding levels.... |
|
|
|
|
|
#25 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 32
Posts: 957
|
I followed the steps to a tee, only modified a skillname and added Developer over Administrator as an access level.
it builds fine, however when i try to start the .exe, it runs through most of the way, but then exits with a windows error. I assume that its because when i installed the Sharp application, it dropped a 1.0.3705 version of .NET over my 1.1 installation. Did anyone else have this happen, and should i be able to just remove the 1.0.3705, then reinstall 1.1 without any negative side effects? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|