Generic Classroom #129

Parent #118Owner #36Flags read, fertileSource QuestCore.db

Aliases: school

8 verbs · 71 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
init_for_corethis none thisrxd#12912
learnthis none thisrxd#12958
enterfuncthis none thisrxd#12987
paymethis none thisrxd#12919
o*ut exit leavenone none nonerd#1295
withdraw collectany none nonerd#1297
clearthis none thisrxd#1292
match_langthis none thisrxd#12911

Properties

PropertyDefinerFlagsOwnerValue
level#129rc#361
skill#129rc#36""
steps#129rc#36
list of 4{" The professor begins the lecture with a quick review of the prerequisite material.", " He soon advances into ponderous theories and mind-bending facts, advocating the material with sincere gusto.", " You absorb as much as you can, hoping to remember enough for a clearer understanding later.", " The course ends with a quick overview, and you leave the class feeling mentally stimulated."}
currency#129rc#36"gold"
trapped#129r#36{}
student#129r#360
cash#129r#360.0
trustees#129rc#36{#2}
alumni#129r#36{}
skill_cutoff_mod#129rc#360.5
virtual_exit_task#118r#2<clear>
defaulting_exit_oleave_msg#118rc#36<clear>
blessed_entrances#118rc#36<clear>
virtual_exits#118rc#36{}
give_short_alias#118rc#36<clear>
virtual_exit_to_use#118r#2{}
lit_from_outside#118rc#36<clear>
bot_locked#104rc#36<clear>
fakes#104r#36{"instructor", "teacher"}
retail#104rc#36<clear>
seat#104r#36<clear>
pool#104r#36<clear>
seat_desc#104r#36<clear>
pool_desc#104r#36<clear>
sit_phrase#104rc#36<clear>
stand_phrase#104rc#36<clear>
swim_phrase#104rc#36<clear>
dry_phrase#104rc#36<clear>
push_phrase#104rc#36<clear>
seat_aliai#104r#36<clear>
pool_aliai#104r#36<clear>
seat_contents#104r#36<clear>
pool_contents#104r#36<clear>
seat_max#104r#36<clear>
pool_max#104r#36<clear>
details#104rc#36<clear>
temp_detail_index#104rc#36<clear>
temp_detail_desc#104rc#36<clear>
outdoors#104r#36<clear>
attack_queue#104r#2<clear>
battle_on#104r#2<clear>
stop_msg#104rc#36<clear>
remove_msg#104rc#36<clear>
dump_msg#104rc#36<clear>
dump_loc#104rc#36<clear>
sanctuary#104rc#36<clear>
ansi_title#104r#36<clear>
dark_desc#104rc#36<clear>
title_style#104rc#36<clear>
build_help#104rc#36
list of 22{"Information specific to the generic school:", "", "* @chparent the room outside the classroom to $lobby.", "* Dig a room and name it whatever the name of your class is.", "* There should only be one exit from it and that exit needs to have the aliases out, o, leave and exit.", "* Describe the room and set the following props:", " .currency to the currency you wish to use.", " ex: @set here.currency to \"dollars\"", "", " .steps is set to the announcements you wish the room to make as the student is learning. @notedit here.steps and put each step on a separate line. There are defaults steps for every skill & stat on $edu_stds, so this is not necessary.", "", " .trustees is set to a list of the persons who are permitted to retrieve the money from the room.", " ex: @set here.trustees to {#622, #1276}", "", " .level is set to the level of the room on a scale of from 1 to 8. The room will potentially raise intelligence up to 17.5, but it will require a sequence of classes to achieve this. Level 1 goes up to 10.5, level 2 to 11.5, level 3 to 12.5, and level 4 to 13.5, etc.", " ex: @set here.level to 2", "", " @set here.skill to the name of a player skill or statistic. Be aware that the player statistic filters out candidates, so use discretion on choosing skills that are compatible with the statistic.", " @set here.skill to \"language~\", replacing \"language\" with a language name if you want to teach a specific language instead of a skill. Don't forget the tilde (~) at the end!", "", " @set here.skill_cutoff_mod to a floating point number between 0.1 and 1.0, default is 0.5. This number * here.level equals the maximum level of here.skill that can be learned from the class.", " @set here.skill_cutoff_mod to 0.25 or less for languages."}
battle_task#104r#2<clear>
dig_level#104rc#36<clear>
holes#104r#2<clear>
help_msg#104rc#36
list of 1{"This room works in a fairly self-explanatory method for the student. The trustees of the room may remove the money collected with the use of the command 'withdraw/collect cash/money'."}
who_location_msg#3rc#36<clear>
free_home#3rc#36<clear>
victim_ejection_msg#3rc#36<clear>
ejection_msg#3rc#36<clear>
oejection_msg#3rc#36<clear>
residents#3rc#36<clear>
free_entry#3rc#36<clear>
entrances#3c#36<clear>
blessed_object#3rc#36<clear>
blessed_task#3rc#36<clear>
exits#3c#36<clear>
dark#3rc#36<clear>
ctype#3rc#36<clear>
key#1c#360
aliases#1rc#36{"school"}
description#1rc#36" The instructor stands at the end of the classroom."
object_size#1r#36{14049, -1090650497}

Ancestry

Ancestors (nearest first): #118 virtual exit room#104 RPG room#3 generic room#1 Root Class

Children: none

Call graph

calls n129_0 #129:init_for_core n118_19 #118:init_for_core n129_0->n118_19 n129_1 #129:learn n99_17 #99:schedule n129_1->n99_17 n129_7 #129:match_lang n129_1->n129_7 n55_16 #55:slice n129_1->n55_16 n26_36 #26:round n129_1->n26_36 n125_6 #125:advance_level n129_1->n125_6 n129_7->n55_16 n6_18 #6:tell n129_7->n6_18 n129_2 #129:enterfunc n129_2->n129_1 n129_2->n129_7 n129_2->n26_36 n118_20 #118:enterfunc n129_2->n118_20 n129_2->n6_18 n129_3 #129:payme n129_2->n129_3 n129_3->n6_18 n103_1 #103:_from_to n129_3->n103_1 n56_4 #56:yes_or_no n129_3->n56_4 n103_0 #103:_has_currency n129_3->n103_0 n35_1 #35:say_action n129_3->n35_1 n129_4 #129:o*ut n129_4->n6_18 n118_7 #118:here_huh n129_4->n118_7 n129_5 #129:withdraw n129_5->n6_18

Source

init_for_core

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

none

Source

1if (caller_perms().wizard)
2if (this == $school)
3this.fakes == {"instructor", "teacher"};
4else
5for p in (properties($school))
6if ((!p) in {"build_help", "help_msg"})
7clear_property(this, p);
8endif
9endfor
10endif
11return pass(@args);
12endif

learn

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

Source

1cost = tofloat(random(2) + 1);
2if (!this.skill)
3stat = 3;
4else
5stat = this.skill in player.stats[1];
6endif
7boost = stat ? cost | (cost * 0.5);
8this.alumni = setadd(this.alumni, player);
9$scheduler:schedule(9000, this, "clear", player);
10if (!stat)
11if (this.skill[$] != "~")
12prop = this.skill;
13sktso = $edu_stds.(prop)[6];
14skts = {prop, prop, @sktso};
15adjlist = $edu_stds.(tostr(prop, "_adjust"));
16else
17skts = {@$edu_stds.language[6], "language"};
18adjlist = $edu_stds.language_adjust;
19lang = this:match_lang(this.skill);
20if (valid(lang))
21iter = player:roll_against("language") ? 20 | 10;
22if (la = player.race in $list_utils:slice(adjlist))
23iter = $math_utils:round(adjlist[la][2] * tofloat(iter));
24endif
25if (!(lang in player.languages[1]))
26player.languages[1] = {@player.languages[1], lang};
27player.languages[2] = {@player.languages[2], 0.0};
28endif
29for z in [1..iter]
30$lang_utils:advance_level(player, lang);
31endfor
32endif
33endif
34dilute = tofloat(length(skts));
35player.stats[2][4] = player.stats[2][4] - (sqrt(cost) * 0.0125);
36player.stats_current[2][4] = player.stats_current[2][4] - (sqrt(cost) * 0.1);
37for skt in (skts)
38adjlist = $edu_stds.(tostr(skt, "_adjust"));
39tweak = (la = player.race in $list_utils:slice(adjlist)) ? adjlist[la][2] | 1.0;
40if (s = skt in player.skills[1])
41denom = ((player.skills[2][s] + 0.9) * dilute) * 5.0;
42player.skills[2][s] = player.skills[2][s] + ((boost * tweak) / denom);
43elseif (s = skt in player.stats[1])
44denom = (player.stats_current[2][s] + 0.1) * dilute;
45player.stats[2][s] = player.stats[2][s] + ((boost * tweak) / denom);
46player.stats_current[2][s] = player.stats_current[2][s] + ((boost * tweak) / denom);
47endif
48endfor
49else
50player.stats[2][4] = player.stats[2][4] - (sqrt(cost) * 0.025);
51player.stats_current[2][4] = player.stats_current[2][4] - (sqrt(cost) * 0.1);
52adjlist = $edu_stds.(tostr(player.stats[1][stat], "_adjust"));
53if (la = player.race in $list_utils:slice(adjlist))
54cost = adjlist[la][2] * cost;
55endif
56player.stats[2][stat] = player.stats[2][stat] + (cost * 0.1);
57player.stats_current[2][stat] = player.stats_current[2][stat] + (cost * 0.1);
58endif

enterfunc

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

none

Source

1"WIZ PERMS...need to be able alter props on this room and player.";
2pass(@args);
3object = args[1];
4suspend(2);
5"Test for qualifications and collect money.";
6if (player != object)
7return;
8endif
9if (this.student)
10return object:tell("The class is already in progress. Come back later.");
11endif
12if (this.level > 8)
13this.level = 8;
14endif
15if (!this.skill)
16"general intelligence";
17under = (($edu_stds.intelligence[1] + tofloat(this.level)) > object.stats_current[2][3]) ? 1 | 0;
18over = (($edu_stds.intelligence[2] + tofloat(this.level)) < object.stats_current[2][3]) ? 1 | 0;
19elseif (si = this.skill in player.stats[1])
20"a stat";
21under = (($edu_stds.(this.skill)[1] + tofloat(this.level)) > object.stats_current[2][si]) ? 1 | 0;
22over = (($edu_stds.(this.skill)[2] + tofloat(this.level)) < object.stats_current[2][si]) ? 1 | 0;
23elseif ((this.skill[$] == "~") && valid(lang = this:match_lang(this.skill)))
24"a language";
25if (!(lin = lang in object.languages[1]))
26under = ((this.level > 1) || ($math_utils:round(object.skills[2]["language" in object.skills[1]]) < (length(object.languages[1]) - 2))) ? 1 | 0;
27under && object:tell("(((Language skill too low to learn additional languages)))");
28else
29under = (object.languages[2][lin] < ((tofloat(this.level) - 0.01) / 4.0)) ? 1 | 0;
30under && object:tell("(((", lang.lang_name, " ability too low for this class)))");
31endif
32if (!under)
33over = (object.languages[2][lin] > ((tofloat(this.level) / 4.0) + 0.24)) ? 1 | 0;
34endif
35else
36"a skill";
37level = (this.level + 1) / 2;
38over = (object.skills[2][this.skill in object.skills[1]] >= (tofloat(this.level) / 2.0)) ? 1 | 0;
39under = (object.skills[2][this.skill in object.skills[1]] < ((tofloat(this.level) / 2.0) - 0.5)) ? 1 | 0;
40if (!under)
41for n in [1..4]
42under = ($edu_stds.(this.skill)[level][n] > object.stats_current[2][n]) ? 1 | 0;
43if (under)
44object:tell("(((", $rpgamer.stats[1][n], " too low)))");
45break;
46endif
47endfor
48else
49object:tell("(((", this.skill, " too low)))");
50endif
51endif
52player:tell("DEBUG - over:", over);
53player:tell("DEBUG - under:", under);
54if (under)
55object:tell("This class seems to be too advanced for you.");
56elseif ((((this.skill && (this.skill[$] == "~")) && valid(lang = this:match_lang(this.skill))) && (s = lang in object.languages[1])) && (object.languages[2][s] >= (tofloat(this.level) * this.skill_cutoff_mod)))
57object:tell("Your ", lang.lang_name, " language skill exceeds the level of this class.");
58elseif ((s = this.skill in object.skills[1]) && (object.skills[2][s] >= (tofloat(this.level) * this.skill_cutoff_mod)))
59object:tell("Your ", object.skills[1][s], " skill exceeds the level of this class.");
60elseif (over && (!s))
61object:tell("Unfortunately, this class can teach you nothing new.");
62elseif (object in this.alumni)
63object:tell("There's much for you to learn here, but studying has taken its toll on your health. You need to rest a couple of hours before returning.");
64else
65this:payme();
66endif
67if (this.student)
68this.trapped = {@this.trapped, object};
69this:learn();
70"Do the roleplay sequence.";
71if (this.steps != $school.steps)
72steps = this.steps;
73else
74skeel = (this.skill && (this.skill[$] == "~")) ? "language" | this.skill;
75steps = (!skeel) ? this.steps | $edu_stds.(tostr(skeel, "_steps"));
76steps = ((length(steps) == 1) && (steps[1][1] == "*")) ? $edu_stds.(steps[1][2..$]) | steps;
77endif
78skeel = (this.skill && (this.skill[$] == "~")) ? tostr(this.skill[1..$ - 1], " language") | this.skill;
79skeel = skeel ? skeel | "subject";
80for line in (steps)
81suspend(10);
82object:tell($string_utils:substitute(line, {{"%<skill>", skeel}}));
83endfor
84"unlock the door.";
85this.trapped = setremove(this.trapped, object);
86this.student = 0;
87endif

payme

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

Source

1"This rate formula assumes a gold piece is worth about a dollar. Increase the last number of the next line if inflation gets out of hand.";
2skmod = (this.skill in player.stats[1]) ? $edu_stds.(this.skill)[3] | `$edu_stds.(this.skill)[5] ! ANY => $edu_stds.intelligence[3]';
3rate = $money_utils:_from_to("gold", this.currency, $edu_stds.gold_price_basis) * skmod;
4stat = (si = this.skill in player.stats[1]) ? si | 3;
5price = (tofloat(this.level + 1) * rate) * (player.stats_current[2][stat] / 10.0);
6player:tell("It will cost ", floatstr(price, 2), " ", this.currency, " to train here.");
7if (!$command_utils:yes_or_no("Do you wish to proceed?"))
8return player:tell("You are free to leave.");
9endif
10if (!$money_utils:_has_currency(this.currency))
11return player:tell("You don't have any ", this.currency, ".");
12endif
13left = player:_rem_money(this.currency, tofloat(price));
14if (left != 0)
15return player:tell("You don't have enough ", this.currency, ".");
16endif
17$you:say_action("%N %<pays> %p fee and %<waits> for instruction.");
18this.student = 1;
19this.cash = this.cash + tofloat(price);

o*ut exit leave

Spec none none noneFlags rdOwner #2Definer #129

Referenced by

none

Source

1if (player in this.trapped)
2player:tell("\"Relax...there's more to learn.\"");
3else
4this:here_huh(verb, args);
5endif

withdraw collect

Spec any none noneFlags rdOwner #2Definer #129

Referenced by

none

Source

1if ((player in this.trustees) && (dobjstr in {"cash", "money"}))
2player:_add_money(this.currency, tofloat(this.cash));
3player:tell("You receive ", tofloat(this.cash), " ", this.currency, " from the classroom depository.");
4this.cash = 0.0;
5else
6player:tell("I don't understand that.");
7endif

clear

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

none

Source

1p = args[1];
2this.alumni = setremove(this.alumni, p);

match_lang

Spec this none thisFlags rxdOwner #2Definer #129

Referenced by

Source

1langname = args[1][1..$ - 1];
2player:tell("DEBUG match_lang langname=>", langname);
3targets = {};
4for l in (children($lang))
5targets = {@targets, {l, l.lang_name}};
6endfor
7if (x = langname in $list_utils:slice(targets, 2))
8return targets[x][1];
9else
10return $failed_match;
11endif