From ced2721a4409dafb1aa10eb556586d58b9fbbd83 Mon Sep 17 00:00:00 2001
From: ElTata <eltata@firemail.cc>
Date: Wed, 26 Aug 2020 13:36:22 +0200
Subject: [PATCH] fix: quest notices are send to correct nicks

The quest notices used to be sent to user with the name of character.
This commit fix this, these notices are now sent to nick of character's
owner.
---
 Irpg/Quest.pm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Irpg/Quest.pm b/Irpg/Quest.pm
index 031b0eb..d82726a 100644
--- a/Irpg/Quest.pm
+++ b/Irpg/Quest.pm
@@ -136,7 +136,8 @@ sub quest {
         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]);
+                "$quest{questers}->[($i+3)%4] $txt",
+				$rps->{$quest{questers}->[$i]}{nick});
         }
     }
     elsif ($quest{type} == 2) {
@@ -150,7 +151,8 @@ sub quest {
         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]);
+                "$quest{questers}->[($i+3)%4] $txt",
+				$rps->{$quest{questers}->[$i]}{nick});
         }
     }
     writequestfile();
@@ -214,7 +216,7 @@ sub movequesters {
         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.", $_);
+                "Gods keep on smiling upon you.", $rps->{$_}{nick});
         }
         $quest{stage}=2;
         $allgo=0; # have not all reached p2 yet
@@ -232,7 +234,7 @@ sub movequesters {
                 "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.", $_);
+                "place now, thanks to the heroes you are.", $rps->{$_}{nick});
             $rps->{$_}{next} = int($rps->{$_}{class}->real_gain(
                                     $rps->{$_}{next} * .75));
         }
@@ -283,7 +285,7 @@ sub rpcheck {
                 Irpg::Irc::privmsg("You and your companions ".
                     "have blessed the realm by ".
                     "completing your quest! 25% of your burden is ".
-                    "eliminated.", $_);
+                    "eliminated.", $rps->{$_}{nick});
                 $rps->{$_}{next} = int($rps->{$_}{class}->real_gain(
                                         $rps->{$_}{next} * .75));
             }
-- 
GitLab