Kamras
Member
This is a code snippet in distro accounthandler.cs, it is called after a toon is deleted, and creates another toon in its place. Works great, however when an owner level account deletes a toon, it does work however the toon is not owner level, its player level.
I tried creating a reference to check for account level however i'm having a hard time, this is the code I currently have trying to reference account level and its failing. Error Posted below.
I'm likely over thinking this...
I tried creating a reference to check for account level however i'm having a hard time, this is the code I currently have trying to reference account level and its failing. Error Posted below.
Code:
private static Mobile CreateMobile(int i)
{
Mobile from;
Account acct = from.Account as Account;
Mobile newChar = new PlayerMobile();
newChar.Name = "New Character "+i.ToString();
newChar.Player = true;
var levelaccess = acct.AccessLevel.Owner;
if (newChar == levelaccess)
{
newChar.AccessLevel = AccessLevel.Owner;
}
else
newChar.AccessLevel = AccessLevel.Player;
newChar.Female = false;
newChar.Race = Race.Ivory;
newChar.Hue = 1002;
newChar.Hunger = 20;
newChar.HairItemID = 0x203B;
newChar.HairHue = 1102;
newChar.FacialHairItemID = 0;
newChar.FacialHairHue = 1102;
newChar.Skills.Cap = 100000;
newChar.StatCap = 950;
newChar.LogoutMap = Map.Alfheim;
newChar.LogoutLocation = new Point3D(5399, 2770, 25);
newChar.Location = new Point3D(0,0,0);
newChar.Map = Map.Internal;
AddBackpack( newChar );
//currently this makes owner and gm to normal player access levels.
bool young = false;
if (newChar is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)newChar;
pm.ToLevell = 150;
young = pm.Young = false;
}
return newChar;
}
Code:
Errors:
+ Accounting/AccountHandler.cs:
CS0176: Line 506: Member 'Server.AccessLevel.Owner' cannot be accessed with an instance reference; qualify it with a type name instead
CS0019: Line 508: Operator '==' cannot be applied to operands of type 'Server.Mobile' and 'Server.AccessLevel'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
I'm likely over thinking this...