@create $feature named skill maintenance FO:skill maintenance FO,smfo,@add-skill ;;#22023.("feature_verbs") = {"@addskill", "@sgs", "@ags", "@rgs"} "#22023.("key") => E_PERM (Permission denied) ;;#22023.("aliases") = {"skill maintenance FO", "smfo", "@add-skill"} ;;#22023.("description") = "The power to be your best." ;;#22023.("object_size") = {7485, 1141286561} @verb #22023:"@sgs @show-governing-stats" any none none rxd @program #22023:@sgs "@sgs -- List stats which govern the success of this skill."; if (valid(skill = $local.rpg:match_skill(dobjstr))) dep = skill.dependant; attstr = (att = dep[1]) ? " the attributes " + $string_utils:name_and_number_list(att) | ""; sklstr = (skl = dep[2]) ? ((attstr ? " and " | "") + " the skills ") + $string_utils:name_and_number_list(skl) | ""; player:tell(tostr("Stats which affect the success of ", $string_utils:nn(skill), " include", attstr, sklstr, ".")); else player:tell(tostr("\"", dobjstr, "\" does not refer to an RPG skill.")); endif . @verb #22023:"@ags @add-governing-stat @addstat" any to any rxd @program #22023:@ags "@ags -- adds a stat as one that affects given skill's use"; " Syntax:"; "@ags stat to skill"; "@ags stat,stat,stat to skill"; {rpg, s_u} = {$local.rpg, $string_utils}; if ((player != caller_perms()) && (caller != this)) player:tell("Permission denied."); return E_PERM; elseif (!valid(skill = rpg:match_skill(iobjstr))) player:tell(tostr("\"", dobjstr, "\" does not refer to any RPG skill.")); return E_INVARG; elseif (!rpg:is_grandmaster(player)) player:tell(tostr("If you have a suggestion for this skill, please contact ", s_u:title_list(rpg.grand_masters, "nobody", "or"), ".")); return E_PERM; elseif (!dobjstr) player:tell(tostr("usage: ", verb, " stat[, stat ...] to ", skill.name)); return E_ARGS; endif good = bad = {}; attributes = rpg.attributes; for try_ in (s_u:explode(dobjstr, ",")) match = s_u:trim(try_); if (valid(object = rpg:match_skill(match))) i = (object in attributes) ? 1 | 2; skill.dependant[i] = object.dependant[2] ? listinsert(skill.dependant[i], object) | listappend(skill.dependant[i], object); good = {@good, object}; else bad = {@bad, ("\"" + try_) + "\""}; endif rpg:s_i_f_i_n(); endfor player:tell(good ? ((s_u:name_and_number_list(good) + " added as governing stats of ") + s_u:nn(skill)) + ". " | "", bad ? (s_u:english_list(bad) + ((length(bad) == 1) ? " does" | " do")) + " not match any known RPG skills." | ""); this:("@sgs")(dobjstr = skill.name); if (good && (caller != this)) rpg.skills:update_skills(); endif "Irin Fri Sep 6 18:19:09 1996 PDT -- added call to :update_skills()"; . @verb #22023:"@rgs @remove-governing-stat @rmstat" any from any rxd @program #22023:@rgs "@rgs -- removes a stat as one that affects given skill's use"; " Syntax:"; "@rgs stat from skill"; "@rgs stat,stat,stat from skill"; if ((player != caller_perms()) && (caller != this)) return E_PERM; elseif (!valid(skill = $local.rpg:match_skill(iobjstr))) player:tell(tostr("\"", dobjstr, "\" does not refer to any RPG skill.")); return E_INVARG; elseif (!$local.rpg:is_grandmaster(player)) player:tell(tostr("If you have a suggestion for this skill, please contact ", $string_utils:title_list($local.rpg.grand_masters, "nobody", "or"), ".")); return E_PERM; endif attributes = $local.rpg.attributes; for try_ in ($string_utils:explode(dobjstr, ",")) match = $string_utils:trim(try_); if (valid(object = $local.rpg:match_skill(match))) if (object in $list_utils:flatten(skill.dependant)) i = (object in attributes) ? 1 | 2; skill.dependant[i] = setremove(skill.dependant[i], object); player:tell(tostr($string_utils:nn(object), " removed as a governing stat of ", $string_utils:nn(skill), ".")); else player:tell(tostr($string_utils:nn(object), " isn't a governing stat of ", $string_utils:nn(skill), ".")); endif else player:tell(tostr("\"", match, "\" isn't an RPG stat.")); endif $command_utils:suspend_if_needed(random(3) - 1); endfor this:("@sgs")(dobjstr = skill.name); $local.rpg.skills:update_skills(); . @verb #22023:"@addskill" any any any rx @program #22023:@addskill "@addskill name,propname[,alias ... ] with gov-stat[,gov-stat, ...] inj-pen,ins-pen,enc-pen,lrn-diff"; usage = tostr("Usage: @addskill name,propname[,alias ... ] with gov-stat[,gov-stat, ...] inj-pen,ins-pen,enc-pen,lrn-diff"); {rpg, s_u, l_u} = {$local.rpg, $string_utils, $list_utils}; if (player != caller_perms()) return E_PERM; elseif (!rpg:is_grandmaster(player)) player:tell(tostr("You aren't allowed to create skills. If you have a suggestion for a new skill, please contact ", s_u:title_list(rpg.grand_masters, "nobody", "or"), ".")); return E_PERM; elseif (!(names = s_u:explode(dobjstr, ","))) player:tell(usage); player:tell("You must specify a standard name and a property-name for the new skill."); elseif ((la = length(args)) < 3) player:tell(usage); player:tell("You must give at least one governing stat."); elseif (la < 4) player:tell(usage); player:tell("You must give the penalties/learn difficulty as shown above."); elseif (typeof(object = $recycler:_create(rpg.skill_object, rpg.owner)) == OBJ) names = l_u:map_arg(s_u, "trim", names); name = names[1]; aliases = listdelete(names, 1); object:set_name(name); object:set_aliases(aliases = setadd(aliases, name)); propname = aliases[1]; doll = rpg.doll; if (typeof(adp = $add_property(doll, propname, 0, {doll.owner, ""})) == ERR) player:tell(tostr("Error adding attribute property \"", propname, "\" to ", s_u:nn(doll), ": ", adp)); rpg.recycler:_recycle(object); return adp; endif skilldb = rpg.skills; if (typeof(adp = $add_property(skilldb, propname, object, {skilldb.owner, "r"})) == ERR) player:tell(tostr("Error adding attribute property \"", propname, "\" to ", s_u:nn(skilldb), ": ", adp)); rpg.recycler:_recycle(object); return adp; endif pvals = s_u:explode(args[4], ","); pvals = l_u:map_arg(s_u, "trim", pvals); pnames = {"injury", "insanity", "encumbrance", "learn"}; for p in [1..min(length(pvals), 4)] pn = pnames[p]; pv = tonum(pvals[p]); player:tell(tostr(s_u:nn(object), ".\"", pn, "\" set to ", pv, ".")); object.(pn) = pv; endfor this:("@ags")(dobjstr = args[3], iobjstr = object.name); player:tell(tostr(s_u:nn(object), " created.")); else player:tell(tostr("Error creating skill object: ", object)); endif rpg.skills:update_skills(); "Irin Fri Sep 6 18:56:27 1996 PDT -- added call to update_skills."; . @verb #22023:"feature_ok" this none this @program #22023:feature_ok return $local.rpg:is_grandmaster(args[1]); . "***finished***