@create $feature named RPG Option FO:RPG Option FO,RPG-Option FO,RPG Option Feature Object,rpg_option_fo,rpgofo,rpgfo
@prop #69060."option_pkg" #34302 r
;;#69060.("feature_verbs") = {"@rpg-o*ptions @rpgo*ptions @lrpg-o*ptions @lrpgo*ptions"}
;;#69060.("guest_ok") = 1
"#69060.("key") => E_PERM (Permission denied)
;;#69060.("aliases") = {"RPG Option FO", "RPG-Option FO", "RPG Option Feature Object", "rpg_option_fo", "rpgofo", "rpgfo"}
;;#69060.("description") = "This is the Generic Feature Object.  It is not meant to be used as a feature object itself, but is handy for making new feature objects."
;;#69060.("object_size") = {2932, 1141286561}

@verb #69060:"help_msg" this none this
@program #69060:help_msg
return this.option_pkg:(verb)(@args);
.

@verb #69060:"@rpg-o*ptions @rpgo*ptions @lrpg-o*ptions @lrpgo*ptions" any any any rxd
@program #69060:@rpg-options
what = "rpg";
options = what + "_options";
option_pkg = (rpg = $local.rpg).(options);
set_option = ("set_" + what) + "_option";
doll = rpg:get_doll(player);
if (!valid(doll))
  return player:tell("You don't have an RPG doll; ergo you don't have any rpg options.");
elseif (!args)
  player:tell_lines({("Current " + what) + " options:", "", @option_pkg:show(doll.(options), option_pkg.names)});
  return;
elseif (typeof(presult = option_pkg:parse(args)) == STR)
  player:tell(presult);
  return;
else
  if (length(presult) > 1)
    if (typeof(sresult = this:(set_option)(doll, @presult)) == STR)
      player:tell(sresult);
      return;
    elseif (!sresult)
      player:tell("No change.");
      return;
    endif
  endif
  player:tell_lines(option_pkg:show(doll.(options), presult[1]));
endif
.

@verb #69060:"set_rpg_option" this none this
@program #69060:set_rpg_option
":set_rpg_option(oname,value)";
"Changes the value of the named option.";
"Returns a string error if something goes wrong.";
if (!((caller == this) || $perm_utils:controls(caller_perms(), this)))
  return tostr(E_PERM);
endif
doll = args[1];
verb[1..4] = "";
foo_options = verb + "s";
"...";
if (typeof(s = $local.rpg.(foo_options):set(doll.(foo_options), @listdelete(args, 1))) == STR)
  return s;
elseif (s == doll.(foo_options))
  return 0;
else
  doll.(foo_options) = s;
  return 1;
endif
.

@verb #69060:"feature_ok" none none none rxd
@program #69060:feature_ok
{who} = args;
return (who in {@$local.rpg.pcs, @$local.rpg.gms}) || $wiz_utils:is_wizard(who);
.

"***finished***