@program #44867 1 1000 d i ( cmd-@newpassword command for Proto MUCK Implements a new permissions system: W2 flag or PLAYER_CREATE power required. Can only @newpassword lower priority players. Will not run unless trigger is named '@newpassword'. Program is entirely self-contained to prevent someone with access to libraries hacking the priority function. Instructions: @action @newpassword=#0,cmd-@newpassword.muf @set @newpassword=W4 @chown cmd-@newpassword.muf=One Requirements: W4 Permissions [c]2002 Moritz Voss zalthers@furscape.com [Mods by Alynna] remove priority, use inserver mlevel function. permissions based on >= mlevel 6 (W2) [More mods] Published under the GPL. **************************************************************************************** This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or [at your option] any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Alternatively, you can receive it from http://www.fsf.org/licenses/gpl.txt **************************************************************************************** ) lvar param : displayerror (d -- ) dup case #-2 dbcmp when me @ "^RED^Ambiguous player name." ansi_notify end #-1 dbcmp when me @ "^RED^Unknown player name." ansi_notify end #1 dbcmp when me @ "^RED^Can't @newpassword #1 with MUF. Use @password." ansi_notify end default me @ "^RED^Error, password not changed." end endcase ; : displayhelp ( -- ) { "@newpassword =[] " "-----------------------------------" "Permissions: W2 Wizard, (:p) PLAYER_CREATE" " " "Changes 's password, informing that you changed it. Must" "be typed in full. Only passwords of players of lesser priority may be changed." "Password of #1 cannot be changed with this program." " " "Note that is possible to @newpassword a character to have no password by" "leaving the space after the = sign blank. If a character has no password," "then anything typed at the login screen will work to connect to that " "character. Useful for Guests." " " "^red^This is a program overloading the inserver command." } array_make foreach me @ swap ansi_notify repeat ; : displaypermissiondenied ( -- ) me @ "^RED^" "noperm_mesg" sysparm strcat ansi_notify ; : checkpermission (d -- b) dup me @ dbcmp not if mlevel me @ mlevel < else pop 1 then ; : main (s -- ) var lname var passwd var target param ! ( Command not @newpassword fails ) command @ "@newpassword" smatch not if displaypermissiondenied exit then ( No parameters get help ) param @ not if displayhelp exit then ( anything other than 2 parameters gets help ) param @ "=" explode 2 = not if displayhelp exit then ( store what we got ) lname ! passwd ! ( Do we have permission? ) me @ "PLAYER_CREATE" power? me @ mlevel 6 >= or not if displaypermissiondenied exit then ( Look the player up ) lname @ pmatch target ! ( Dont do #1 ) target @ #1 dbcmp if target @ displayerror exit then ( Handle not found or ambiguous - probably wont happen with pmatch ) target @ int 0 < if target @ displayerror exit then ( Lets find out if I am newpasswording someone under my wizlevel ) target @ checkpermission not if displaypermissiondenied exit then ( After all this is checked, lets do the newpasswording, were good to go ) target @ passwd @ newpassword me @ "^green^Password changed." ansi_notify ; . c q