From 4f8f0258127ed44f4600949314740c4f04857f31 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Sat, 5 Nov 2022 17:09:56 -0300
Subject: Reduce scope of a variable to prevent possible exploits.

---
 src/map/pc.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index dc34c96..a414857 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3124,7 +3124,10 @@ int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp,
     }
 
     // Double Xp Weekends
-    base_exp = (base_exp * static_cast<double>(battle_config.base_exp_rate) / 100.);
+    if (reason != PC_GAINEXP_REASON::SCRIPT)
+        base_exp = (base_exp * static_cast<double>(battle_config.base_exp_rate) / 100.);
+
+    // Sanitization
     if (base_exp <= 0)
         base_exp = 0;
     else if (base_exp > 1000000000)
-- 
cgit v1.2.3-70-g09d2