#define LORD "newstyle" #define DOMAIN "home" int query_prevent_shadow() { return 1; } mixed members; mapping access; string query_lord() { return LORD; } void create() { int i; mapping map; members = ([ ]); access = ([ ]); seteuid( (string)"/secure/master"-> creator_file( file_name( this_object() ) ) ); restore_object( file_name( this_object() ) ); if( pointerp( members ) ) { map = ([ ]); for( i = 0; i < sizeof( members ); i++ ) map[ members[ i ] ] = "newbie"; members = map; } } void save_me() { seteuid( (string)"/secure/master"->get_root_uid() ); save_object( file_name( this_object() ) ); seteuid( (string)"/secure/master"-> creator_file( file_name( this_object() ) ) ); } int add_permission( string euid, string path, int mask ) { if((geteuid(this_player(1)) != LORD) && !("/secure/master"->high_programmer(geteuid(this_player(1)))) ) return 0; if( !access[ path ] ) access[ path ] = ([ euid: mask ]); else access[ path ][ euid ] |= mask; save_me(); return 1; } int remove_permission( string euid, string path, int mask ) { if((geteuid(this_player(1)) != LORD) && !("/secure/master"->high_programmer(geteuid(this_player(1)))) ) return 0; if( !access[ path ] ) return 0; if( !access[ path ][ euid ] ) return 0; access[ path ][ euid ] &= mask; if( !access[ path ][ euid ] ) access[path] = map_delete( access[ path ], euid ); if( !sizeof( access[ path ] ) ) access = map_delete( access, path ); save_me(); return 1; } int check_permission( string euid, string *path, int mask ) { int i; string p; if( euid == LORD ) return 1; p = "/" + path[ 0 ]; for( i = 1; i < sizeof( path ); i++ ) { p = p + "/" + path[ i ]; if( access[ p ] && ( access[ p ][ euid ] & mask ) ) return 1; } return 0; } /* ** The values from these functions are used only as ** defaults in the case of check permission not working. */ int valid_read( string *path, string euid, string funct ) { return 1; /* Universal read permission granted, Newstyle, 08/02/94 */ } int valid_write( string *path, string euid, string funct ) { if( euid == LORD ) return 1; if( sizeof(path) <= 3 ) return 0; if( "/secure/master"->query_lord( euid ) ) return 1; if( euid == "Dom: " + DOMAIN ) return 1; return 0; return (members[euid] != 0); } void dest_me() { destruct(this_object()); } /* The ({ }) is for security, apparently */ string *query_members() { return keys(members) + ({ }); } int add_member( string name ) { if((geteuid(this_player(1)) != LORD) && !("/secure/master"->high_programmer(geteuid(this_player(1)))) ) return 0; if(members[name]) return 0; members[name] = "newbie"; save_me(); return 1; } int query_member( string name ) { return !undefinedp( members[ name ] ) || name == LORD; } int remove_member( string name ) { if((geteuid(this_player(1)) != query_lord()) && !("/secure/master"->high_programmer(geteuid(this_player(1)))) ) return 0; if(!members[name]) return 0; members = m_delete( members, name ); save_me(); return 1; } int set_project( string name, string pro ) { if((geteuid(this_player(1)) != query_lord()) && !("/secure/master"->high_programmer(geteuid(this_player(1)))) ) return 0; if(!members[name]) return 0; if( !pro || pro == "" ) pro = "project unset"; members[name] = pro; save_me(); return 1; } string query_project( string name ) { if( !members[ name ] ) return "project unset"; return members[ name ]; } void smart_log( string error, string where ) { write_file( "d/" + DOMAIN + "/player_reports", error ); } string log_who( string where ) { string str; if (sscanf(where, "%sswamp%s", str, str) == 2) return "rowan"; if(sscanf(where, "%smines%s", str, str) == 2) return "nol"; if (sscanf(where, "%smountains%s", str, str) ==2) return "newstyle"; if (sscanf(where, "%scoast%s", str, str) ==2) return "coriolis"; if (sscanf(where, "%sforest%s", str, str) ==2) return "tarl"; if (sscanf(where, "%sdesert%s", str, str) == 2) return "ted"; if (sscanf(where, "%ssewers%s", str, str) ==2) return "hendrix"; if (sscanf(where, "%sguilds/wizards%s", str, str) ==2) return "manshoon"; if (sscanf(where, "%sguilds/thieves%s", str, str) == 2) return "zork"; if (sscanf(where, "%sguilds/priests%s", str, str) ==2) return "pion"; if (sscanf(where, "%sisland%s", str, str) ==2) return "fatty"; return LORD; } mapping query_access() { return access; } string query_description() { return "The main traditional fantasy role-playing domain. " +"Starting place for newbies, and location of most main " +"services. Oh, and the above isn't true. We had a lunch-" +"break not 3 weeks ago...\n"; }