… | |
… | |
770 | sub cf::player::exists($) { |
770 | sub cf::player::exists($) { |
771 | cf::player::find $_[0] |
771 | cf::player::find $_[0] |
772 | or -f sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($_[0]) x 2; |
772 | or -f sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($_[0]) x 2; |
773 | } |
773 | } |
774 | |
774 | |
775 | =item $player->reply ($npc, $msg[, $flags]) |
775 | =item $object->reply ($npc, $msg[, $flags]) |
776 | |
776 | |
777 | Sends a message to the player, as if the npc C<$npc> replied. C<$npc> |
777 | Sends a message to the player, as if the npc C<$npc> replied. C<$npc> |
778 | can be C<undef>. Does the right thing when the player is currently in a |
778 | can be C<undef>. Does the right thing when the player is currently in a |
779 | dialogue with the given NPC character. |
779 | dialogue with the given NPC character. |
780 | |
780 | |
… | |
… | |
1029 | } |
1029 | } |
1030 | |
1030 | |
1031 | ############################################################################# |
1031 | ############################################################################# |
1032 | # the server's main() |
1032 | # the server's main() |
1033 | |
1033 | |
1034 | sub load_cfg { |
1034 | sub cfg_load { |
1035 | open my $fh, "<:utf8", cf::confdir . "/config" |
1035 | open my $fh, "<:utf8", cf::confdir . "/config" |
1036 | or return; |
1036 | or return; |
1037 | |
1037 | |
1038 | local $/; |
1038 | local $/; |
1039 | *CFG = YAML::Syck::Load <$fh>; |
1039 | *CFG = YAML::Syck::Load <$fh>; |
1040 | |
|
|
1041 | use Data::Dumper; warn Dumper \%CFG; |
|
|
1042 | } |
1040 | } |
1043 | |
1041 | |
1044 | sub main { |
1042 | sub main { |
1045 | load_cfg; |
1043 | cfg_load; |
1046 | db_load; |
1044 | db_load; |
1047 | load_extensions; |
1045 | load_extensions; |
1048 | Event::loop; |
1046 | Event::loop; |
1049 | } |
1047 | } |
1050 | |
1048 | |
… | |
… | |
1102 | |
1100 | |
1103 | # reload cf.pm |
1101 | # reload cf.pm |
1104 | $msg->("reloading cf.pm"); |
1102 | $msg->("reloading cf.pm"); |
1105 | require cf; |
1103 | require cf; |
1106 | |
1104 | |
1107 | # load database again |
1105 | # load config and database again |
|
|
1106 | cf::cfg_load; |
1108 | cf::db_load; |
1107 | cf::db_load; |
1109 | |
1108 | |
1110 | # load extensions |
1109 | # load extensions |
1111 | $msg->("load extensions"); |
1110 | $msg->("load extensions"); |
1112 | cf::load_extensions; |
1111 | cf::load_extensions; |