Skip to content
Extraits de code Groupes Projets
Valider ba2f71c0 rédigé par ElTata's avatar ElTata :ok_hand:
Parcourir les fichiers

Quests notify users with privmsgs

parent 89fbb507
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -128,18 +128,30 @@ sub quest { ...@@ -128,18 +128,30 @@ sub quest {
} }
close(Q); close(Q);
if ($quest{type} == 1) { if ($quest{type} == 1) {
Irpg::Irc::chanmsg(join(", ",(@{$quest{questers}})[0..2]).", and ". my $txt = "have been chosen by the gods to ".
"$quest{questers}->[3] have been chosen by the gods to ".
"$quest{text}. Quest to end in ".duration($quest{qtime}-time()). "$quest{text}. Quest to end in ".duration($quest{qtime}-time()).
"."); ".";
Irpg::Irc::chanmsg(join(", ",(@{$quest{questers}})[0..2]).", and ".
"$quest{questers}->[3] $txt");
for (my $i = 0 ; $i <= 3 ; $i++) {
Irpg::Irc::privmsg("You, $quest{questers}->[($i+1)%4], ".
"$quest{questers}->[($i+2)%4] and ".
"$quest{questers}->[($i+3)%4] $txt", $quest{questers}->[$i]);
}
} }
elsif ($quest{type} == 2) { elsif ($quest{type} == 2) {
Irpg::Irc::chanmsg(join(", ",(@{$quest{questers}})[0..2]).", and ". my $txt = "have been chosen by the gods to ".
"$quest{questers}->[3] have been chosen by the gods to ".
"$quest{text}. Participants must first reach [$quest{p1}->[0],". "$quest{text}. Participants must first reach [$quest{p1}->[0],".
"$quest{p1}->[1]], then [$quest{p2}->[0],$quest{p2}->[1]].". "$quest{p1}->[1]], then [$quest{p2}->[0],$quest{p2}->[1]].".
($opts->{mapurl}?" See $opts->{mapurl} to monitor their journey's ". ($opts->{mapurl}?" See $opts->{mapurl} to monitor their journey's ".
"progress.":"")); "progress.":"");
Irpg::Irc::chanmsg(join(", ",(@{$quest{questers}})[0..2]).", and ".
"$quest{questers}->[3] $txt");
for ($i = 0 ; $i <= 3 ; $i++) {
Irpg::Irc::privmsg("You, $quest{questers}->[($i+1)%4], ".
"$quest{questers}->[($i+2)%4] and ".
"$quest{questers}->[($i+3)%4] $txt", $quest{questers}->[$i]);
}
} }
writequestfile(); writequestfile();
} }
...@@ -153,14 +165,15 @@ sub questpencheck { ...@@ -153,14 +165,15 @@ sub questpencheck {
my ($quester,$player); my ($quester,$player);
for $quester (@{$quest{questers}}) { for $quester (@{$quest{questers}}) {
if ($quester eq $k) { if ($quester eq $k) {
Irpg::Irc::chanmsg(Irpg::Utils::clog( my $txt = "$k\'s prudence and self-regard has brought the ".
"$k\'s prudence and self-regard has brought the ". "wrath of the gods upon the realm. All your great ".
"wrath of the gods upon the realm. All your great ". "wickedness makes you as it were heavy with lead, ".
"wickedness makes you as it were heavy with lead, ". "and to tend downwards with great weight and ".
"and to tend downwards with great weight and ". "pressure towards hell. Therefore have you drawn ".
"pressure towards hell. Therefore have you drawn ". "yourselves 15 steps closer to that gaping maw.";
"yourselves 15 steps closer to that gaping maw.")); Irpg::Irc::chanmsg(Irpg::Utils::clog($txt));
for $player (grep { $rps->{$_}{online} } keys %$rps) { for $player (grep { $rps->{$_}{online} } keys %$rps) {
Irpg::Irc::privmsg($txt, $player);
my $gain = int(15 * ($opts->{rppenstep}**$rps->{$player}{level})); my $gain = int(15 * ($opts->{rppenstep}**$rps->{$player}{level}));
$gain = $rps->{$player}{class}->real_gain($gain); $gain = $rps->{$player}{class}->real_gain($gain);
$rps->{$player}{pen_quest} += $gain; $rps->{$player}{pen_quest} += $gain;
...@@ -195,9 +208,14 @@ sub movequesters { ...@@ -195,9 +208,14 @@ sub movequesters {
# all participants have reached point 1, now point 2 # all participants have reached point 1, now point 2
Irpg::Irc::chanmsg(Irpg::Utils::clog( Irpg::Irc::chanmsg(Irpg::Utils::clog(
join(", ",(@{$quest{questers}})[0..2]).", ". join(", ",(@{$quest{questers}})[0..2]).", ".
"and $quest{questers}->[3] have reached ". "and $quest{questers}->[3] have reached ".
"the first step of their long quest. May the ". "the first step of their long quest. May the ".
"Gods keep on smiling upon them.")); "Gods keep on smiling upon them."));
for (@{$quest{questers}}) {
Irpg::Irc::privmsg("You and your journey's companions ".
"have reached the first step of your long quest. May the ".
"Gods keep on smiling upon you.", $_);
}
$quest{stage}=2; $quest{stage}=2;
$allgo=0; # have not all reached p2 yet $allgo=0; # have not all reached p2 yet
} }
...@@ -205,11 +223,16 @@ sub movequesters { ...@@ -205,11 +223,16 @@ sub movequesters {
# all participants have reached point 2, time for reward \o/ # all participants have reached point 2, time for reward \o/
Irpg::Irc::chanmsg(Irpg::Utils::clog( Irpg::Irc::chanmsg(Irpg::Utils::clog(
join(", ",(@{$quest{questers}})[0..2]).", ". join(", ",(@{$quest{questers}})[0..2]).", ".
"and $quest{questers}->[3] have completed their ". "and $quest{questers}->[3] have completed their ".
"journey! 25% of their burden is eliminated. ". "journey! 25% of their burden is eliminated. ".
"The people can rejoice, the realm is sure a safer ". "The people can rejoice, the realm is sure a safer ".
"place now, thanks to these heroes.")); "place now, thanks to these heroes."));
for (@{$quest{questers}}) { for (@{$quest{questers}}) {
Irpg::Irc::privmsg("You and your companions ".
"have completed your ".
"journey! 25% of your burden is eliminated. ".
"The people can rejoice, the realm is sure a safer ".
"place now, thanks to the heroes you are.", $_);
$rps->{$_}{next} = int($rps->{$_}{class}->real_gain( $rps->{$_}{next} = int($rps->{$_}{class}->real_gain(
$rps->{$_}{next} * .75)); $rps->{$_}{next} * .75));
} }
...@@ -257,6 +280,10 @@ sub rpcheck { ...@@ -257,6 +280,10 @@ sub rpcheck {
"completing their quest! 25% of their burden is ". "completing their quest! 25% of their burden is ".
"eliminated.")); "eliminated."));
for (@{$quest{questers}}) { for (@{$quest{questers}}) {
Irpg::Irc::privmsg("You and your companions ".
"have blessed the realm by ".
"completing your quest! 25% of your burden is ".
"eliminated.", $_);
$rps->{$_}{next} = int($rps->{$_}{class}->real_gain( $rps->{$_}{next} = int($rps->{$_}{class}->real_gain(
$rps->{$_}{next} * .75)); $rps->{$_}{next} * .75));
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter