From c06f5fb5dbb1cd1e164375a6e7287b2ecc10b8dc Mon Sep 17 00:00:00 2001
From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Tue, 15 Aug 2017 16:26:18 +0000
Subject: [PATCH] Removed quest_global_data SQL table.
---
.../sql/game/global_variables.sql | 2 +-
.../sql/game/quest_global_data.sql | 12 ---
.../data/scripts/ai/bosses/Core/Core.java | 5 +-
.../Q00401_PathOfTheWarrior.java | 2 +-
.../Q00402_PathOfTheHumanKnight.java | 6 +-
.../Q00403_PathOfTheRogue.java | 2 +-
.../Q00404_PathOfTheHumanWizard.java | 2 +-
.../Q00405_PathOfTheCleric.java | 2 +-
.../Q00406_PathOfTheElvenKnight.java | 2 +-
.../Q00407_PathOfTheElvenScout.java | 2 +-
.../Q00408_PathOfTheElvenWizard.java | 2 +-
.../Q00409_PathOfTheElvenOracle.java | 2 +-
.../Q00410_PathOfThePalusKnight.java | 2 +-
.../Q00411_PathOfTheAssassin.java | 2 +-
.../Q00412_PathOfTheDarkWizard.java | 2 +-
.../Q00413_PathOfTheShillienOracle.java | 2 +-
.../Q00414_PathOfTheOrcRaider.java | 4 +-
.../Q00415_PathOfTheOrcMonk.java | 4 +-
.../Q00416_PathOfTheOrcShaman.java | 4 +-
.../Q00417_PathOfTheScavenger.java | 4 +-
.../Q00418_PathOfTheArtisan.java | 12 +--
.../gameserver/model/quest/Quest.java | 91 -------------------
.../sql/game/global_variables.sql | 2 +-
.../sql/game/quest_global_data.sql | 12 ---
.../SeedOfAnnihilation.java | 13 +--
.../data/scripts/ai/bosses/Core/Core.java | 5 +-
.../ai/bosses/QueenShyeed/QueenShyeed.java | 5 +-
.../FreyaCelebration/FreyaCelebration.java | 4 +-
.../MasterOfEnchanting.java | 6 +-
.../gameserver/model/quest/Quest.java | 91 -------------------
.../sql/game/global_variables.sql | 2 +-
.../sql/game/quest_global_data.sql | 11 ---
.../game/data/scripts/ai/individual/Core.java | 5 +-
.../scripts/ai/individual/QueenShyeed.java | 5 +-
.../scripts/ai/npc/AvantGarde/AvantGarde.java | 8 +-
.../PriestOfBlessing/PriestOfBlessing.java | 8 +-
.../SubclassCertification.java | 4 +-
.../custom/Validators/SubClassSkills.java | 2 +-
.../FreyaCelebration/FreyaCelebration.java | 11 +--
.../MasterOfEnchanting.java | 71 +++++++++++----
.../SeedOfAnnihilation.java | 29 +++---
.../Q00062_PathOfTheTrooper.java | 2 +-
.../Q00063_PathOfTheWarder.java | 2 +-
.../Q00307_ControlDeviceOfTheGiants.java | 5 +-
.../Q00401_PathOfTheWarrior.java | 2 +-
.../Q00402_PathOfTheHumanKnight.java | 6 +-
.../Q00403_PathOfTheRogue.java | 2 +-
.../Q00404_PathOfTheHumanWizard.java | 2 +-
.../Q00405_PathOfTheCleric.java | 2 +-
.../Q00406_PathOfTheElvenKnight.java | 2 +-
.../Q00407_PathOfTheElvenScout.java | 2 +-
.../Q00408_PathOfTheElvenWizard.java | 2 +-
.../Q00409_PathOfTheElvenOracle.java | 2 +-
.../Q00410_PathOfThePalusKnight.java | 2 +-
.../Q00411_PathOfTheAssassin.java | 2 +-
.../Q00412_PathOfTheDarkWizard.java | 2 +-
.../Q00413_PathOfTheShillienOracle.java | 2 +-
.../Q00414_PathOfTheOrcRaider.java | 4 +-
.../Q00415_PathOfTheOrcMonk.java | 4 +-
.../Q00416_PathOfTheOrcShaman.java | 4 +-
.../Q00417_PathOfTheScavenger.java | 4 +-
.../Q00418_PathOfTheArtisan.java | 12 +--
.../Q00610_MagicalPowerOfWaterPart2.java | 5 +-
.../Q00616_MagicalPowerOfFirePart2.java | 5 +-
.../gameserver/idfactory/IdFactory.java | 1 -
.../gameserver/model/quest/Quest.java | 91 -------------------
.../gameserver/network/L2GameClient.java | 6 --
.../clientpackets/RequestAcquireSkill.java | 4 +-
.../sql/game/global_variables.sql | 2 +-
.../sql/game/quest_global_data.sql | 12 ---
.../SeedOfAnnihilation.java | 13 +--
.../data/scripts/ai/bosses/Core/Core.java | 5 +-
.../ai/bosses/QueenShyeed/QueenShyeed.java | 5 +-
.../FreyaCelebration/FreyaCelebration.java | 4 +-
.../MasterOfEnchanting.java | 6 +-
.../Q00307_ControlDeviceOfTheGiants.java | 5 +-
.../gameserver/model/quest/Quest.java | 91 -------------------
77 files changed, 208 insertions(+), 576 deletions(-)
delete mode 100644 L2J_Mobius_Classic/dist/db_installer/sql/game/quest_global_data.sql
delete mode 100644 L2J_Mobius_Helios/dist/db_installer/sql/game/quest_global_data.sql
delete mode 100644 L2J_Mobius_HighFive/dist/db_installer/sql/game/quest_global_data.sql
delete mode 100644 L2J_Mobius_Underground/dist/db_installer/sql/game/quest_global_data.sql
diff --git a/L2J_Mobius_Classic/dist/db_installer/sql/game/global_variables.sql b/L2J_Mobius_Classic/dist/db_installer/sql/game/global_variables.sql
index ff529c8ffe..73f4685840 100644
--- a/L2J_Mobius_Classic/dist/db_installer/sql/game/global_variables.sql
+++ b/L2J_Mobius_Classic/dist/db_installer/sql/game/global_variables.sql
@@ -1,6 +1,6 @@
DROP TABLE IF EXISTS `global_variables`;
CREATE TABLE IF NOT EXISTS `global_variables` (
- `var` VARCHAR(20) NOT NULL DEFAULT '',
+ `var` VARCHAR(255) NOT NULL DEFAULT '',
`value` VARCHAR(255) ,
PRIMARY KEY (`var`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Classic/dist/db_installer/sql/game/quest_global_data.sql b/L2J_Mobius_Classic/dist/db_installer/sql/game/quest_global_data.sql
deleted file mode 100644
index 02235a5d1c..0000000000
--- a/L2J_Mobius_Classic/dist/db_installer/sql/game/quest_global_data.sql
+++ /dev/null
@@ -1,12 +0,0 @@
--- Table structure for global quest data (i.e. quest data not particular to a player)
--- Note: We had considered using character_quests with char_id = 0 for this, but decided
--- against it, primarily for aesthetic purposes, cleaningness of code, expectability, and
--- to keep char-related data purely as char-related data, global purely as global.
-
-DROP TABLE IF EXISTS `quest_global_data`;
-CREATE TABLE IF NOT EXISTS `quest_global_data` (
- `quest_name` VARCHAR(40) NOT NULL DEFAULT '',
- `var` VARCHAR(20) NOT NULL DEFAULT '',
- `value` VARCHAR(255) ,
- PRIMARY KEY (`quest_name`,`var`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Classic/dist/game/data/scripts/ai/bosses/Core/Core.java
index bd55f7825c..514373848c 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/ai/bosses/Core/Core.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/ai/bosses/Core/Core.java
@@ -21,6 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
@@ -82,7 +83,7 @@ public final class Core extends AbstractNpcAI
}
else
{
- final String test = loadGlobalQuestVar("Core_Attacked");
+ final String test = GlobalVariablesManager.getInstance().getString("Core_Attacked");
if (test.equalsIgnoreCase("true"))
{
_firstAttacked = true;
@@ -102,7 +103,7 @@ public final class Core extends AbstractNpcAI
@Override
public void onSave()
{
- saveGlobalQuestVar("Core_Attacked", Boolean.toString(_firstAttacked));
+ GlobalVariablesManager.getInstance().set("Core_Attacked", Boolean.toString(_firstAttacked));
}
public void spawnBoss(L2GrandBossInstance npc)
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
index 0c688d210e..e9787bf3f2 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
@@ -279,7 +279,7 @@ public final class Q00401_PathOfTheWarrior extends Quest
addExpAndSp(player, 6080, 0); // Player now only gets EXP Fixed rate.
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30010-13.html";
}
}
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
index c8217fe7db..f8ace42c8c 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
@@ -187,7 +187,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -232,7 +232,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -451,7 +451,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30417-12.html";
}
}
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
index ef7a4eabfa..000b188256 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
@@ -308,7 +308,7 @@ public final class Q00403_PathOfTheRogue extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30379-09.html";
}
else if (!hasQuestItems(player, HORSESHOE_OF_LIGHT) && hasQuestItems(player, BEZIQUES_LETTER))
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
index d515f7c08f..6ed3da50ff 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
@@ -224,7 +224,7 @@ public final class Q00404_PathOfTheHumanWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30391-06.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
index 574ca8de1d..598a19b34a 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
@@ -179,7 +179,7 @@ public final class Q00405_PathOfTheCleric extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30022-09.html";
}
else if (hasQuestItems(player, LETTER_OF_ORDER_1ST))
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
index 0c5d3e20f0..df1bc8a224 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
@@ -228,7 +228,7 @@ public final class Q00406_PathOfTheElvenKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30327-10.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
index da45ff8c3b..3fdb5aeb54 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
@@ -255,7 +255,7 @@ public final class Q00407_PathOfTheElvenScout extends Quest
giveAdena(player, 163800, true);
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30328-07.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
index 893d84ff80..b8ab95bdab 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
@@ -347,7 +347,7 @@ public final class Q00408_PathOfTheElvenWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30414-20.html";
}
}
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
index f7a478b6b1..6108fd88d4 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
@@ -307,7 +307,7 @@ public final class Q00409_PathOfTheElvenOracle extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30293-08.html";
}
}
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
index 342d6fca1f..5fe03be86b 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
@@ -261,7 +261,7 @@ public final class Q00410_PathOfThePalusKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30329-11.html";
}
else if (hasAtLeastOneQuestItem(player, VIRGILS_LETTER, MORTE_TALISMAN))
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
index 198ba44ef0..8122dbe718 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
@@ -226,7 +226,7 @@ public final class Q00411_PathOfTheAssassin extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30416-06.html";
}
else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER))
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
index f6fd9163b3..9e645eea77 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
@@ -285,7 +285,7 @@ public final class Q00412_PathOfTheDarkWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30421-13.html";
}
else if (hasQuestItems(player, SEEDS_OF_DESPAIR))
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
index a820687a86..4e4ae05927 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
@@ -247,7 +247,7 @@ public final class Q00413_PathOfTheShillienOracle extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30330-10.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
index 58d09d0b2d..7b93dee627 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
@@ -309,7 +309,7 @@ public final class Q00414_PathOfTheOrcRaider extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30501-03.html";
}
break;
@@ -345,7 +345,7 @@ public final class Q00414_PathOfTheOrcRaider extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "31978-05.html";
}
}
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
index 05d32acde7..d416cb5ba7 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
@@ -191,7 +191,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -562,7 +562,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30501-04.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
index 8439628a53..f31bed57d9 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
@@ -189,7 +189,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest
giveAdena(player, 163800, true);
st.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -503,7 +503,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest
giveAdena(player, 81900, true);
st.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "31979-03.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
index 3e5d946066..5a50ef0e1b 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
@@ -323,7 +323,7 @@ public final class Q00417_PathOfTheScavenger extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -670,7 +670,7 @@ public final class Q00417_PathOfTheScavenger extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30316-05.html";
}
break;
diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
index 4fe6687081..2d78627b5d 100644
--- a/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
+++ b/L2J_Mobius_Classic/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
@@ -218,7 +218,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -244,7 +244,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -270,7 +270,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -296,7 +296,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -370,7 +370,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -406,7 +406,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/quest/Quest.java
index a028478de6..5a2a52293e 100644
--- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1655,97 +1655,6 @@ public class Quest extends AbstractScript implements IIdentifiable
}
}
- /**
- * Insert (or update) in the database variables that need to stay persistent for this quest after a reboot.
- * This function is for storage of values that do not related to a specific player but are global for all characters.
- * For example, if we need to disable a quest-gatekeeper until a certain time (as is done with some grand-boss gatekeepers), we can save that time in the DB.
- * @param var the name of the variable to save
- * @param value the value of the variable
- */
- public final void saveGlobalQuestVar(String var, String value)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.setString(3, value);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not insert global quest variable:", e);
- }
- }
-
- /**
- * Read from the database a previously saved variable for this quest.
- * Due to performance considerations, this function should best be used only when the quest is first loaded.
- * Subclasses of this class can define structures into which these loaded values can be saved.
- * However, on-demand usage of this function throughout the script is not prohibited, only not recommended.
- * Values read from this function were entered by calls to "saveGlobalQuestVar".
- * @param var the name of the variable to load
- * @return the current value of the specified variable, or an empty string if the variable does not exist
- */
- public final String loadGlobalQuestVar(String var)
- {
- String result = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- try (ResultSet rs = statement.executeQuery())
- {
- if (rs.first())
- {
- result = rs.getString(1);
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not load global quest variable:", e);
- }
- return result;
- }
-
- /**
- * Permanently delete from the database a global quest variable that was previously saved for this quest.
- * @param var the name of the variable to delete
- */
- public final void deleteGlobalQuestVar(String var)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variable:", e);
- }
- }
-
- /**
- * Permanently delete from the database all global quest variables that were previously saved for this quest.
- */
- public final void deleteAllGlobalQuestVars()
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"))
- {
- statement.setString(1, getName());
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variables:", e);
- }
- }
-
/**
* Insert in the database the quest for the player.
* @param qs the {@link QuestState} object whose variable to insert
diff --git a/L2J_Mobius_Helios/dist/db_installer/sql/game/global_variables.sql b/L2J_Mobius_Helios/dist/db_installer/sql/game/global_variables.sql
index ff529c8ffe..73f4685840 100644
--- a/L2J_Mobius_Helios/dist/db_installer/sql/game/global_variables.sql
+++ b/L2J_Mobius_Helios/dist/db_installer/sql/game/global_variables.sql
@@ -1,6 +1,6 @@
DROP TABLE IF EXISTS `global_variables`;
CREATE TABLE IF NOT EXISTS `global_variables` (
- `var` VARCHAR(20) NOT NULL DEFAULT '',
+ `var` VARCHAR(255) NOT NULL DEFAULT '',
`value` VARCHAR(255) ,
PRIMARY KEY (`var`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Helios/dist/db_installer/sql/game/quest_global_data.sql b/L2J_Mobius_Helios/dist/db_installer/sql/game/quest_global_data.sql
deleted file mode 100644
index 02235a5d1c..0000000000
--- a/L2J_Mobius_Helios/dist/db_installer/sql/game/quest_global_data.sql
+++ /dev/null
@@ -1,12 +0,0 @@
--- Table structure for global quest data (i.e. quest data not particular to a player)
--- Note: We had considered using character_quests with char_id = 0 for this, but decided
--- against it, primarily for aesthetic purposes, cleaningness of code, expectability, and
--- to keep char-related data purely as char-related data, global purely as global.
-
-DROP TABLE IF EXISTS `quest_global_data`;
-CREATE TABLE IF NOT EXISTS `quest_global_data` (
- `quest_name` VARCHAR(40) NOT NULL DEFAULT '',
- `var` VARCHAR(20) NOT NULL DEFAULT '',
- `value` VARCHAR(255) ,
- PRIMARY KEY (`quest_name`,`var`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java b/L2J_Mobius_Helios/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
index fd8609e232..92dd260901 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
@@ -23,6 +23,7 @@ import java.util.Map;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
@@ -227,18 +228,18 @@ public final class SeedOfAnnihilation extends AbstractNpcAI
});
int buffsNow = 0;
- final String var = loadGlobalQuestVar("SeedNextStatusChange");
+ final String var = GlobalVariablesManager.getInstance().getString("SeedNextStatusChange");
if (var.equalsIgnoreCase("") || (Long.parseLong(var) < System.currentTimeMillis()))
{
buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
}
else
{
_seedsNextStatusChange = Long.parseLong(var);
- buffsNow = Integer.parseInt(loadGlobalQuestVar("SeedBuffsList"));
+ buffsNow = Integer.parseInt(GlobalVariablesManager.getInstance().getString("SeedBuffsList"));
}
for (int i = 0; i < _regionsData.length; i++)
{
@@ -301,9 +302,9 @@ public final class SeedOfAnnihilation extends AbstractNpcAI
if (event.equalsIgnoreCase("ChangeSeedsStatus"))
{
final int buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
for (int i = 0; i < _regionsData.length; i++)
{
_regionsData[i].activeBuff = ZONE_BUFFS_LIST[buffsNow][i];
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java
index bd55f7825c..514373848c 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java
@@ -21,6 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
@@ -82,7 +83,7 @@ public final class Core extends AbstractNpcAI
}
else
{
- final String test = loadGlobalQuestVar("Core_Attacked");
+ final String test = GlobalVariablesManager.getInstance().getString("Core_Attacked");
if (test.equalsIgnoreCase("true"))
{
_firstAttacked = true;
@@ -102,7 +103,7 @@ public final class Core extends AbstractNpcAI
@Override
public void onSave()
{
- saveGlobalQuestVar("Core_Attacked", Boolean.toString(_firstAttacked));
+ GlobalVariablesManager.getInstance().set("Core_Attacked", Boolean.toString(_firstAttacked));
}
public void spawnBoss(L2GrandBossInstance npc)
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java b/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
index 8206dcbb59..0728cea727 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
@@ -17,6 +17,7 @@
package ai.bosses.QueenShyeed;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -81,7 +82,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void spawnShyeed()
{
- final String respawn = loadGlobalQuestVar("Respawn");
+ final String respawn = GlobalVariablesManager.getInstance().getString("QueenShyeedRespawn");
final long remain = (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
if (remain > 0)
{
@@ -98,7 +99,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void startRespawn()
{
final int respawnTime = RESPAWN - getRandom(RANDOM_RESPAWN);
- saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + respawnTime));
+ GlobalVariablesManager.getInstance().set("QueenShyeedRespawn", Long.toString(System.currentTimeMillis() + respawnTime));
startQuestTimer("respawn", respawnTime, null, null);
MOB_BUFF_ZONE.setEnabled(false);
MOB_BUFF_DISPLAY_ZONE.setEnabled(false);
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java b/L2J_Mobius_Helios/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
index 025b2b1ee6..4f7c4036a3 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
@@ -79,14 +79,14 @@ public final class FreyaCelebration extends LongTimeEvent
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
- final String value = loadGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("FreyaCelebration");
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
+ player.getVariables().set("FreyaCelebration", Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
}
else
{
diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java b/L2J_Mobius_Helios/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
index 5e23a4932c..f90f95264b 100644
--- a/L2J_Mobius_Helios/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
+++ b/L2J_Mobius_Helios/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
@@ -92,7 +92,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
else if (event.equalsIgnoreCase("buy_scroll_24"))
{
final long curTime = System.currentTimeMillis();
- final String value = loadGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("MasterOfEnchanting");
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
{
@@ -105,7 +105,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
@@ -139,7 +139,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 07d10a322a..27b1975a95 100644
--- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1655,97 +1655,6 @@ public class Quest extends AbstractScript implements IIdentifiable
}
}
- /**
- * Insert (or update) in the database variables that need to stay persistent for this quest after a reboot.
- * This function is for storage of values that do not related to a specific player but are global for all characters.
- * For example, if we need to disable a quest-gatekeeper until a certain time (as is done with some grand-boss gatekeepers), we can save that time in the DB.
- * @param var the name of the variable to save
- * @param value the value of the variable
- */
- public final void saveGlobalQuestVar(String var, String value)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.setString(3, value);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not insert global quest variable:", e);
- }
- }
-
- /**
- * Read from the database a previously saved variable for this quest.
- * Due to performance considerations, this function should best be used only when the quest is first loaded.
- * Subclasses of this class can define structures into which these loaded values can be saved.
- * However, on-demand usage of this function throughout the script is not prohibited, only not recommended.
- * Values read from this function were entered by calls to "saveGlobalQuestVar".
- * @param var the name of the variable to load
- * @return the current value of the specified variable, or an empty string if the variable does not exist
- */
- public final String loadGlobalQuestVar(String var)
- {
- String result = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- try (ResultSet rs = statement.executeQuery())
- {
- if (rs.first())
- {
- result = rs.getString(1);
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not load global quest variable:", e);
- }
- return result;
- }
-
- /**
- * Permanently delete from the database a global quest variable that was previously saved for this quest.
- * @param var the name of the variable to delete
- */
- public final void deleteGlobalQuestVar(String var)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variable:", e);
- }
- }
-
- /**
- * Permanently delete from the database all global quest variables that were previously saved for this quest.
- */
- public final void deleteAllGlobalQuestVars()
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"))
- {
- statement.setString(1, getName());
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variables:", e);
- }
- }
-
/**
* Insert in the database the quest for the player.
* @param qs the {@link QuestState} object whose variable to insert
diff --git a/L2J_Mobius_HighFive/dist/db_installer/sql/game/global_variables.sql b/L2J_Mobius_HighFive/dist/db_installer/sql/game/global_variables.sql
index 6790b604c9..a59335a656 100644
--- a/L2J_Mobius_HighFive/dist/db_installer/sql/game/global_variables.sql
+++ b/L2J_Mobius_HighFive/dist/db_installer/sql/game/global_variables.sql
@@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS `global_variables` (
- `var` VARCHAR(20) NOT NULL DEFAULT '',
+ `var` VARCHAR(255) NOT NULL DEFAULT '',
`value` VARCHAR(255) ,
PRIMARY KEY (`var`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/L2J_Mobius_HighFive/dist/db_installer/sql/game/quest_global_data.sql b/L2J_Mobius_HighFive/dist/db_installer/sql/game/quest_global_data.sql
deleted file mode 100644
index 0281297cc5..0000000000
--- a/L2J_Mobius_HighFive/dist/db_installer/sql/game/quest_global_data.sql
+++ /dev/null
@@ -1,11 +0,0 @@
--- Table structure for global quest data (i.e. quest data not particular to a player)
--- Note: We had considered using character_quests with char_id = 0 for this, but decided
--- against it, primarily for aesthetic purposes, cleaningness of code, expectability, and
--- to keep char-related data purely as char-related data, global purely as global.
-
-CREATE TABLE IF NOT EXISTS `quest_global_data` (
- `quest_name` VARCHAR(40) NOT NULL DEFAULT '',
- `var` VARCHAR(20) NOT NULL DEFAULT '',
- `value` VARCHAR(255) ,
- PRIMARY KEY (`quest_name`,`var`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/Core.java b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/Core.java
index 4f2d568a61..ffbf4da767 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/Core.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/Core.java
@@ -21,6 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
@@ -79,7 +80,7 @@ public final class Core extends AbstractNpcAI
}
else
{
- final String test = getGlobalQuestVar("Core_Attacked");
+ final String test = GlobalVariablesManager.getInstance().getString("Core_Attacked");
if (test.equalsIgnoreCase("true"))
{
_firstAttacked = true;
@@ -99,7 +100,7 @@ public final class Core extends AbstractNpcAI
@Override
public void onSave()
{
- saveGlobalQuestVar("Core_Attacked", Boolean.toString(_firstAttacked));
+ GlobalVariablesManager.getInstance().set("Core_Attacked", Boolean.toString(_firstAttacked));
}
public void spawnBoss(L2GrandBossInstance npc)
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/QueenShyeed.java b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/QueenShyeed.java
index fffdb28392..ceecccca5a 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/QueenShyeed.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/individual/QueenShyeed.java
@@ -17,6 +17,7 @@
package ai.individual;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -86,7 +87,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void spawnShyeed()
{
- final String respawn = getGlobalQuestVar("Respawn");
+ final String respawn = GlobalVariablesManager.getInstance().getString("QueenShyeedRespawn");
final long remain = !respawn.isEmpty() ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
if (remain > 0)
{
@@ -103,7 +104,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void startRespawn()
{
final int respawnTime = RESPAWN - getRandom(RANDOM_RESPAWN);
- saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + respawnTime));
+ GlobalVariablesManager.getInstance().set("QueenShyeedRespawn", Long.toString(System.currentTimeMillis() + respawnTime));
startQuestTimer("respawn", respawnTime, null, null);
MOB_BUFF_ZONE.setEnabled(false);
MOB_BUFF_DISPLAY_ZONE.setEnabled(false);
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java
index d62375f968..e489ba3996 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java
@@ -195,7 +195,7 @@ public class AvantGarde extends AbstractNpcAI
{
for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
{
- final String qvar = getGlobalQuestVar(varName + i);
+ final String qvar = player.getVariables().getString(varName + i);
if (!qvar.isEmpty() && (qvar.endsWith(";") || !qvar.equals("0")))
{
activeCertifications++;
@@ -213,7 +213,7 @@ public class AvantGarde extends AbstractNpcAI
for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
{
final String qvarName = varName + i;
- final String qvar = getGlobalQuestVar(qvarName);
+ final String qvar = player.getVariables().getString(qvarName);
if (qvar.endsWith(";"))
{
final String skillIdVar = qvar.replace(";", "");
@@ -224,7 +224,7 @@ public class AvantGarde extends AbstractNpcAI
if (sk != null)
{
player.removeSkill(sk);
- saveGlobalQuestVar(qvarName, "0");
+ player.getVariables().set(qvarName, "0");
}
}
else
@@ -255,7 +255,7 @@ public class AvantGarde extends AbstractNpcAI
_log.warning("Somehow " + player.getName() + " deleted a certification book!");
}
}
- saveGlobalQuestVar(qvarName, "0");
+ player.getVariables().set(qvarName, "0");
}
else
{
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java
index 62038bdd56..de37d5a84e 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/PriestOfBlessing/PriestOfBlessing.java
@@ -109,14 +109,14 @@ public final class PriestOfBlessing extends AbstractNpcAI
{
if (player.getAdena() >= PRICE_VOICE)
{
- final String value = getGlobalQuestVar(player.getAccountName() + "_voice");
+ final String value = player.getVariables().getString("PriestOfBlessing_voice");
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (System.currentTimeMillis() > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, PRICE_VOICE);
giveItems(player, NEVIT_VOICE, 1);
- saveGlobalQuestVar(player.getAccountName() + "_voice", Long.toString(System.currentTimeMillis() + (20 * 3600000)));
+ player.getVariables().set("PriestOfBlessing_voice", Long.toString(System.currentTimeMillis() + (20 * 3600000)));
}
else
{
@@ -140,7 +140,7 @@ public final class PriestOfBlessing extends AbstractNpcAI
if (player.getAdena() >= _price_hourglass)
{
- final String value = getGlobalQuestVar(player.getAccountName() + "_hg_" + _index);
+ final String value = player.getVariables().getString("PriestOfBlessing_hg_" + _index);
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (System.currentTimeMillis() > _reuse_time)
@@ -149,7 +149,7 @@ public final class PriestOfBlessing extends AbstractNpcAI
final int _nevit_hourglass = _hg[getRandom(0, _hg.length - 1)];
takeItems(player, Inventory.ADENA_ID, _price_hourglass);
giveItems(player, _nevit_hourglass, 1);
- saveGlobalQuestVar(player.getAccountName() + "_hg_" + _index, Long.toString(System.currentTimeMillis() + (20 * 3600000)));
+ player.getVariables().set("PriestOfBlessing_hg_" + _index, Long.toString(System.currentTimeMillis() + (20 * 3600000)));
}
else
{
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/SubclassCertification/SubclassCertification.java b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/SubclassCertification/SubclassCertification.java
index ef28873781..f0affc1b04 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/SubclassCertification/SubclassCertification.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/ai/npc/SubclassCertification/SubclassCertification.java
@@ -245,7 +245,7 @@ public final class SubclassCertification extends AbstractNpcAI
String htmltext;
final String tmp = variable + level + "-" + player.getClassIndex();
- final String globalVariable = getGlobalQuestVar(tmp);
+ final String globalVariable = player.getVariables().getString(tmp);
if (!globalVariable.equals("") && !globalVariable.equals("0"))
{
@@ -268,7 +268,7 @@ public final class SubclassCertification extends AbstractNpcAI
smsg.addItemName(item);
player.sendPacket(smsg);
- saveGlobalQuestVar(tmp, String.valueOf(item.getObjectId()));
+ player.getVariables().set(tmp, String.valueOf(item.getObjectId()));
htmltext = "GetAbility.html";
}
return htmltext;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/custom/Validators/SubClassSkills.java b/L2J_Mobius_HighFive/dist/game/data/scripts/custom/Validators/SubClassSkills.java
index 7abb9f2c98..d28e6ad81c 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/custom/Validators/SubClassSkills.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/custom/Validators/SubClassSkills.java
@@ -150,7 +150,7 @@ public final class SubClassSkills extends Quest
for (int j = Config.MAX_SUBCLASS; j > 0; j--)
{
qName = VARS[i] + String.valueOf(j);
- qValue = getGlobalQuestVar(qName);
+ qValue = player.getVariables().getString(qName);
if ((qValue == null) || qValue.isEmpty())
{
continue;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java b/L2J_Mobius_HighFive/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
index 342da44efb..cecfe1e045 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
@@ -80,14 +80,14 @@ public final class FreyaCelebration extends LongTimeEvent
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
- final String value = getGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("FreyaCelebration");
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
+ player.getVariables().set("FreyaCelebration", Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
}
else
{
@@ -131,12 +131,9 @@ public final class FreyaCelebration extends LongTimeEvent
caster.addItem("FreyaCelebration", FREYA_GIFT, 1, npc, true);
}
- else
+ else if (getRandom(10) < 2)
{
- if (getRandom(10) < 2)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
- }
+ npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
}
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java b/L2J_Mobius_HighFive/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
index 40788c6174..1173172e2b 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
@@ -93,7 +93,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
else if (event.equalsIgnoreCase("buy_scroll_24"))
{
final long curTime = System.currentTimeMillis();
- final String value = getGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("MasterOfEnchanting");
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
{
@@ -106,7 +106,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
@@ -134,21 +134,18 @@ public final class MasterOfEnchanting extends LongTimeEvent
player.sendPacket(sm);
htmltext = "32599-scroll24.htm";
}
+ // Little glitch. There is no SystemMessage with seconds only.
+ // If time is less than 1 minute player can buy scrolls
+ else if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
+ {
+ takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
+ giveItems(player, MASTER_YOGI_SCROLL, 24);
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ htmltext = "32599-scroll24.htm";
+ }
else
{
- // Little glitch. There is no SystemMessage with seconds only.
- // If time is less than 1 minute player can buy scrolls
- if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE)
- {
- takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
- giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
- htmltext = "32599-scroll24.htm";
- }
- else
- {
- htmltext = "32599-s24-no.htm";
- }
+ htmltext = "32599-s24-no.htm";
}
}
}
@@ -185,76 +182,118 @@ public final class MasterOfEnchanting extends LongTimeEvent
switch (getEnchantLevel(player, MASTER_YOGI_STAFF))
{
case 4:
+ {
giveItems(player, 6406, 1); // Firework
break;
+ }
case 5:
+ {
giveItems(player, 6406, 2); // Firework
giveItems(player, 6407, 1); // Large Firework
break;
+ }
case 6:
+ {
giveItems(player, 6406, 3); // Firework
giveItems(player, 6407, 2); // Large Firework
break;
+ }
case 7:
+ {
giveItems(player, HAT_SHADOW_REWARD[getRandom(3)], 1);
break;
+ }
case 8:
+ {
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
break;
+ }
case 9:
+ {
giveItems(player, 955, 1); // Scroll: Enchant Weapon (D)
giveItems(player, 956, 1); // Scroll: Enchant Armor (D)
break;
+ }
case 10:
+ {
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
break;
+ }
case 11:
+ {
giveItems(player, 951, 1); // Scroll: Enchant Weapon (C)
giveItems(player, 952, 1); // Scroll: Enchant Armor (C)
break;
+ }
case 12:
+ {
giveItems(player, 948, 1); // Scroll: Enchant Armor (B)
break;
+ }
case 13:
+ {
giveItems(player, 729, 1); // Scroll: Enchant Weapon (A)
break;
+ }
case 14:
+ {
giveItems(player, HAT_EVENT_REWARD[getRandom(3)], 1);
break;
+ }
case 15:
+ {
giveItems(player, 13992, 1); // Grade S Accessory Chest (Event)
break;
+ }
case 16:
+ {
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
break;
+ }
case 17:
+ {
giveItems(player, 959, 1); // Scroll: Enchant Weapon (S)
break;
+ }
case 18:
+ {
giveItems(player, 13991, 1); // Grade S Armor Chest (Event)
break;
+ }
case 19:
+ {
giveItems(player, 13990, 1); // Grade S Weapon Chest (Event)
break;
+ }
case 20:
+ {
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
+ }
case 21:
+ {
giveItems(player, 8762, 1); // Top-Grade Life Stone: level 76
giveItems(player, 8752, 1); // High-Grade Life Stone: level 76
giveItems(player, CRYSTAL_REWARD[getRandom(3)], 1); // Red/Blue/Green Soul Crystal - Stage 14
break;
+ }
case 22:
+ {
giveItems(player, 13989, 1); // S80 Grade Armor Chest (Event)
break;
+ }
case 23:
+ {
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
+ break;
+ }
default:
+ {
if (getEnchantLevel(player, MASTER_YOGI_STAFF) > 23)
{
giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event)
}
- break;
+ }
}
takeItems(player, MASTER_YOGI_STAFF, 1);
htmltext = "32599-rewardok.htm";
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java b/L2J_Mobius_HighFive/dist/game/data/scripts/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java
index 94d28e902f..8f7790e257 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.datatables.SkillData;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -40,6 +41,14 @@ import ai.AbstractNpcAI;
public class SeedOfAnnihilation extends AbstractNpcAI
{
private static final Map TELEPORT_ZONES = new HashMap<>();
+ static
+ {
+ TELEPORT_ZONES.put(60002, new Location(-213175, 182648, -10992));
+ TELEPORT_ZONES.put(60003, new Location(-181217, 186711, -10528));
+ TELEPORT_ZONES.put(60004, new Location(-180211, 182984, -15152));
+ TELEPORT_ZONES.put(60005, new Location(-179275, 186802, -10720));
+ }
+
private static final int ANNIHILATION_FURNACE = 18928;
// Strength, Agility, Wisdom
@@ -67,14 +76,6 @@ public class SeedOfAnnihilation extends AbstractNpcAI
private final SeedRegion[] _regionsData = new SeedRegion[3];
private Long _seedsNextStatusChange;
- static
- {
- TELEPORT_ZONES.put(60002, new Location(-213175, 182648, -10992));
- TELEPORT_ZONES.put(60003, new Location(-181217, 186711, -10528));
- TELEPORT_ZONES.put(60004, new Location(-180211, 182984, -15152));
- TELEPORT_ZONES.put(60005, new Location(-179275, 186802, -10720));
- }
-
public SeedOfAnnihilation()
{
super(SeedOfAnnihilation.class.getSimpleName(), "gracia/AI");
@@ -226,18 +227,18 @@ public class SeedOfAnnihilation extends AbstractNpcAI
});
int buffsNow = 0;
- final String var = getGlobalQuestVar("SeedNextStatusChange");
+ final String var = GlobalVariablesManager.getInstance().getString("SeedNextStatusChange");
if (var.equalsIgnoreCase("") || (Long.parseLong(var) < System.currentTimeMillis()))
{
buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
}
else
{
_seedsNextStatusChange = Long.parseLong(var);
- buffsNow = Integer.parseInt(getGlobalQuestVar("SeedBuffsList"));
+ buffsNow = Integer.parseInt(GlobalVariablesManager.getInstance().getString("SeedBuffsList"));
}
for (int i = 0; i < _regionsData.length; i++)
{
@@ -300,9 +301,9 @@ public class SeedOfAnnihilation extends AbstractNpcAI
if (event.equalsIgnoreCase("ChangeSeedsStatus"))
{
final int buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
for (int i = 0; i < _regionsData.length; i++)
{
_regionsData[i].activeBuff = ZONE_BUFFS_LIST[buffsNow][i];
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java
index d2d2d5d474..319c4bf727 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java
@@ -231,7 +231,7 @@ public final class Q00062_PathOfTheTrooper extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "32197-10.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java
index 9accee64bb..5b426a3291 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java
@@ -465,7 +465,7 @@ public final class Q00063_PathOfTheWarder extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "32198-19.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
index 2680f14fbc..3705d37532 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
@@ -17,6 +17,7 @@
package quests.Q00307_ControlDeviceOfTheGiants;
import com.l2jmobius.gameserver.enums.QuestSound;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
@@ -100,7 +101,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
{
return "32711-09.html";
}
- final String respawn = getGlobalQuestVar("Respawn");
+ final String respawn = GlobalVariablesManager.getInstance().getString("GiantsControlDeviceRespawn");
final long remain = !respawn.isEmpty() ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
if (remain > 0)
{
@@ -170,7 +171,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
qst.setCond(2, true);
}
}
- saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY));
+ GlobalVariablesManager.getInstance().set("GiantsControlDeviceRespawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY));
}
break;
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
index af20fa9ade..5fa7edcefe 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java
@@ -291,7 +291,7 @@ public final class Q00401_PathOfTheWarrior extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30010-13.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
index 2c22032fe5..4e213cfc6e 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java
@@ -169,7 +169,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -196,7 +196,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -409,7 +409,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30417-12.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
index d040b3bc7a..0862630989 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java
@@ -308,7 +308,7 @@ public final class Q00403_PathOfTheRogue extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30379-09.html";
}
else if (!hasQuestItems(player, HORSESHOE_OF_LIGHT) && hasQuestItems(player, BEZIQUES_LETTER))
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
index ac9ac51372..cd03ae0e12 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java
@@ -224,7 +224,7 @@ public final class Q00404_PathOfTheHumanWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30391-06.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
index b84211abfe..fe3006bff9 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java
@@ -179,7 +179,7 @@ public final class Q00405_PathOfTheCleric extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30022-09.html";
}
else if (hasQuestItems(player, LETTER_OF_ORDER_1ST))
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
index 2fe310cec6..b245423a1b 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java
@@ -228,7 +228,7 @@ public final class Q00406_PathOfTheElvenKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30327-10.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
index 6ebca13474..8fa5fae48b 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java
@@ -255,7 +255,7 @@ public final class Q00407_PathOfTheElvenScout extends Quest
giveAdena(player, 163800, true);
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30328-07.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
index 3681e36cea..54e6633f38 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java
@@ -347,7 +347,7 @@ public final class Q00408_PathOfTheElvenWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30414-20.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
index 86c0f82909..8ebc23b63b 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java
@@ -307,7 +307,7 @@ public final class Q00409_PathOfTheElvenOracle extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30293-08.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
index 74f6c03f78..0edbe7e0b3 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java
@@ -261,7 +261,7 @@ public final class Q00410_PathOfThePalusKnight extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30329-11.html";
}
else if (hasAtLeastOneQuestItem(player, VIRGILS_LETTER, MORTE_TALISMAN))
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
index e2a2068e2a..cfbace79dc 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java
@@ -226,7 +226,7 @@ public final class Q00411_PathOfTheAssassin extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30416-06.html";
}
else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER))
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
index d613488d3c..7243cd9436 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java
@@ -285,7 +285,7 @@ public final class Q00412_PathOfTheDarkWizard extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30421-13.html";
}
else if (hasQuestItems(player, SEEDS_OF_DESPAIR))
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
index 3bf2818371..edabb4bb83 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java
@@ -247,7 +247,7 @@ public final class Q00413_PathOfTheShillienOracle extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30330-10.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
index fd7e93efac..e21ef4809d 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java
@@ -309,7 +309,7 @@ public final class Q00414_PathOfTheOrcRaider extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30501-03.html";
}
break;
@@ -345,7 +345,7 @@ public final class Q00414_PathOfTheOrcRaider extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "31978-05.html";
}
}
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
index da53d28236..5bca07520d 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java
@@ -191,7 +191,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -562,7 +562,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30501-04.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
index c8501f027c..dc96f7c26a 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java
@@ -189,7 +189,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest
giveAdena(player, 163800, true);
st.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -503,7 +503,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest
giveAdena(player, 81900, true);
st.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "31979-03.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
index 0a1d6350b8..21ca56c963 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java
@@ -323,7 +323,7 @@ public final class Q00417_PathOfTheScavenger extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -671,7 +671,7 @@ public final class Q00417_PathOfTheScavenger extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = "30316-05.html";
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
index 3d40e49ce4..dd4f43afbd 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java
@@ -218,7 +218,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -244,7 +244,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -270,7 +270,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -296,7 +296,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -370,7 +370,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
@@ -406,7 +406,7 @@ public final class Q00418_PathOfTheArtisan extends Quest
}
qs.exitQuest(false, true);
player.sendPacket(new SocialAction(player.getObjectId(), 3));
- saveGlobalQuestVar("1ClassQuestFinished", "1");
+ player.getVariables().set("1ClassQuestFinished", "1");
htmltext = event;
}
break;
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java
index ec19cc2ce8..75a55fc6e4 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java
@@ -18,6 +18,7 @@ package quests.Q00610_MagicalPowerOfWaterPart2;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
@@ -52,7 +53,7 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest
addKillId(ASHUTAR);
registerQuestItems(GREEN_TOTEM, ASHUTAR_HEART);
- final String test = getGlobalQuestVar("Q00610_respawn");
+ final String test = GlobalVariablesManager.getInstance().getString("Q00610_respawn");
final long remain = (!test.isEmpty()) ? (Long.parseLong(test) - System.currentTimeMillis()) : 0;
if (remain > 0)
{
@@ -146,7 +147,7 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest
final int respawnMaxDelay = (int) (129600000 * Config.RAID_MAX_RESPAWN_MULTIPLIER);
final int respawnDelay = getRandom(respawnMinDelay, respawnMaxDelay);
cancelQuestTimer("despawn_ashutar", npc, null);
- saveGlobalQuestVar("Q00610_respawn", String.valueOf(System.currentTimeMillis() + respawnDelay));
+ GlobalVariablesManager.getInstance().set("Q00610_respawn", String.valueOf(System.currentTimeMillis() + respawnDelay));
startQuestTimer("spawn_npc", respawnDelay, null, null);
executeForEachPlayer(killer, npc, isSummon, true, false);
return super.onKill(npc, killer, isSummon);
diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java
index 08202d71ae..7299816150 100644
--- a/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java
+++ b/L2J_Mobius_HighFive/dist/game/data/scripts/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java
@@ -18,6 +18,7 @@ package quests.Q00616_MagicalPowerOfFirePart2;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
@@ -52,7 +53,7 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest
addKillId(NASTRON);
registerQuestItems(RED_TOTEM, NASTRON_HEART);
- final String test = getGlobalQuestVar("Q00616_respawn");
+ final String test = GlobalVariablesManager.getInstance().getString("Q00616_respawn");
final long remain = (!test.isEmpty()) ? (Long.parseLong(test) - System.currentTimeMillis()) : 0;
if (remain > 0)
{
@@ -146,7 +147,7 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest
final int respawnMaxDelay = (int) (129600000 * Config.RAID_MAX_RESPAWN_MULTIPLIER);
final int respawnDelay = getRandom(respawnMinDelay, respawnMaxDelay);
cancelQuestTimer("despawn_nastron", npc, null);
- saveGlobalQuestVar("Q00616_respawn", String.valueOf(System.currentTimeMillis() + respawnDelay));
+ GlobalVariablesManager.getInstance().set("Q00616_respawn", String.valueOf(System.currentTimeMillis() + respawnDelay));
startQuestTimer("spawn_npc", respawnDelay, null, null);
executeForEachPlayer(killer, npc, isSummon, true, false);
return super.onKill(npc, killer, isSummon);
diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index b0bd959861..84409d8fcc 100644
--- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -264,7 +264,6 @@ public abstract class IdFactory
cleanCount += stmt.executeUpdate("DELETE FROM heroes_diary WHERE heroes_diary.charId NOT IN (SELECT charId FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_offline_trade WHERE character_offline_trade.charId NOT IN (SELECT charId FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_offline_trade_items WHERE character_offline_trade_items.charId NOT IN (SELECT charId FROM characters);");
- cleanCount += stmt.executeUpdate("DELETE FROM character_quest_global_data WHERE character_quest_global_data.charId NOT IN (SELECT charId FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_tpbookmark WHERE character_tpbookmark.charId NOT IN (SELECT charId FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_variables WHERE character_variables.charId NOT IN (SELECT charId FROM characters);");
diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 0ee2fd77fb..95733dc784 100644
--- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1536,97 +1536,6 @@ public class Quest extends AbstractScript implements IIdentifiable
}
}
- /**
- * Insert (or update) in the database variables that need to stay persistent for this quest after a reboot.
- * This function is for storage of values that do not related to a specific player but are global for all characters.
- * For example, if we need to disable a quest-gatekeeper until a certain time (as is done with some grand-boss gatekeepers), we can save that time in the DB.
- * @param var the name of the variable to save
- * @param value the value of the variable
- */
- public final void saveGlobalQuestVar(String var, String value)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"))
- {
- ps.setString(1, getName());
- ps.setString(2, var);
- ps.setString(3, value);
- ps.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not insert global quest variable:", e);
- }
- }
-
- /**
- * Read from the database a previously saved variable for this quest.
- * Due to performance considerations, this function should best be used only when the quest is first loaded.
- * Subclasses of this class can define structures into which these loaded values can be saved.
- * However, on-demand usage of this function throughout the script is not prohibited, only not recommended.
- * Values read from this function were entered by calls to "saveGlobalQuestVar".
- * @param var the name of the variable to load
- * @return the current value of the specified variable, or an empty string if the variable does not exist
- */
- public final String getGlobalQuestVar(String var)
- {
- String result = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- ps.setString(1, getName());
- ps.setString(2, var);
- try (ResultSet rs = ps.executeQuery())
- {
- if (rs.first())
- {
- result = rs.getString(1);
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not load global quest variable:", e);
- }
- return result;
- }
-
- /**
- * Permanently delete from the database a global quest variable that was previously saved for this quest.
- * @param var the name of the variable to delete
- */
- public final void deleteGlobalQuestVar(String var)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- ps.setString(1, getName());
- ps.setString(2, var);
- ps.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variable:", e);
- }
- }
-
- /**
- * Permanently delete from the database all global quest variables that were previously saved for this quest.
- */
- public final void deleteAllGlobalQuestVars()
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"))
- {
- ps.setString(1, getName());
- ps.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variables:", e);
- }
- }
-
/**
* Insert in the database the quest for the player.
* @param qs the {@link QuestState} object whose variable to insert
diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
index 7cce2b8cbb..e208ba9f54 100644
--- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -457,12 +457,6 @@ public final class L2GameClient extends MMOClient> i
ps.execute();
}
- try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_quest_global_data WHERE charId=?"))
- {
- ps.setInt(1, objid);
- ps.executeUpdate();
- }
-
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=?"))
{
ps.setInt(1, objid);
diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java
index 39c9414a86..11880aeeb7 100644
--- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java
+++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java
@@ -328,7 +328,7 @@ public final class RequestAcquireSkill extends L2GameClientPacket
{
for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
{
- final String itemOID = st.getQuest().getGlobalQuestVar(varName + i);
+ final String itemOID = activeChar.getVariables().getString(varName + i);
if (!itemOID.isEmpty() && !itemOID.endsWith(";") && !itemOID.equals("0"))
{
if (Util.isDigit(itemOID))
@@ -345,7 +345,7 @@ public final class RequestAcquireSkill extends L2GameClientPacket
{
giveSkill(activeChar, trainer, skill);
// Logging the given skill.
- st.getQuest().saveGlobalQuestVar(varName + i, skill.getId() + ";");
+ activeChar.getVariables().set(varName + i, skill.getId() + ";");
}
return;
}
diff --git a/L2J_Mobius_Underground/dist/db_installer/sql/game/global_variables.sql b/L2J_Mobius_Underground/dist/db_installer/sql/game/global_variables.sql
index ff529c8ffe..73f4685840 100644
--- a/L2J_Mobius_Underground/dist/db_installer/sql/game/global_variables.sql
+++ b/L2J_Mobius_Underground/dist/db_installer/sql/game/global_variables.sql
@@ -1,6 +1,6 @@
DROP TABLE IF EXISTS `global_variables`;
CREATE TABLE IF NOT EXISTS `global_variables` (
- `var` VARCHAR(20) NOT NULL DEFAULT '',
+ `var` VARCHAR(255) NOT NULL DEFAULT '',
`value` VARCHAR(255) ,
PRIMARY KEY (`var`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Underground/dist/db_installer/sql/game/quest_global_data.sql b/L2J_Mobius_Underground/dist/db_installer/sql/game/quest_global_data.sql
deleted file mode 100644
index 02235a5d1c..0000000000
--- a/L2J_Mobius_Underground/dist/db_installer/sql/game/quest_global_data.sql
+++ /dev/null
@@ -1,12 +0,0 @@
--- Table structure for global quest data (i.e. quest data not particular to a player)
--- Note: We had considered using character_quests with char_id = 0 for this, but decided
--- against it, primarily for aesthetic purposes, cleaningness of code, expectability, and
--- to keep char-related data purely as char-related data, global purely as global.
-
-DROP TABLE IF EXISTS `quest_global_data`;
-CREATE TABLE IF NOT EXISTS `quest_global_data` (
- `quest_name` VARCHAR(40) NOT NULL DEFAULT '',
- `var` VARCHAR(20) NOT NULL DEFAULT '',
- `value` VARCHAR(255) ,
- PRIMARY KEY (`quest_name`,`var`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java b/L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
index fd8609e232..92dd260901 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/SeedOfAnnihilation/SeedOfAnnihilation.java
@@ -23,6 +23,7 @@ import java.util.Map;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
@@ -227,18 +228,18 @@ public final class SeedOfAnnihilation extends AbstractNpcAI
});
int buffsNow = 0;
- final String var = loadGlobalQuestVar("SeedNextStatusChange");
+ final String var = GlobalVariablesManager.getInstance().getString("SeedNextStatusChange");
if (var.equalsIgnoreCase("") || (Long.parseLong(var) < System.currentTimeMillis()))
{
buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
}
else
{
_seedsNextStatusChange = Long.parseLong(var);
- buffsNow = Integer.parseInt(loadGlobalQuestVar("SeedBuffsList"));
+ buffsNow = Integer.parseInt(GlobalVariablesManager.getInstance().getString("SeedBuffsList"));
}
for (int i = 0; i < _regionsData.length; i++)
{
@@ -301,9 +302,9 @@ public final class SeedOfAnnihilation extends AbstractNpcAI
if (event.equalsIgnoreCase("ChangeSeedsStatus"))
{
final int buffsNow = getRandom(ZONE_BUFFS_LIST.length);
- saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow));
+ GlobalVariablesManager.getInstance().set("SeedBuffsList", String.valueOf(buffsNow));
_seedsNextStatusChange = getNextSeedsStatusChangeTime();
- saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
+ GlobalVariablesManager.getInstance().set("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange));
for (int i = 0; i < _regionsData.length; i++)
{
_regionsData[i].activeBuff = ZONE_BUFFS_LIST[buffsNow][i];
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java
index bd55f7825c..514373848c 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java
@@ -21,6 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
@@ -82,7 +83,7 @@ public final class Core extends AbstractNpcAI
}
else
{
- final String test = loadGlobalQuestVar("Core_Attacked");
+ final String test = GlobalVariablesManager.getInstance().getString("Core_Attacked");
if (test.equalsIgnoreCase("true"))
{
_firstAttacked = true;
@@ -102,7 +103,7 @@ public final class Core extends AbstractNpcAI
@Override
public void onSave()
{
- saveGlobalQuestVar("Core_Attacked", Boolean.toString(_firstAttacked));
+ GlobalVariablesManager.getInstance().set("Core_Attacked", Boolean.toString(_firstAttacked));
}
public void spawnBoss(L2GrandBossInstance npc)
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java b/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
index 8206dcbb59..0728cea727 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/ai/bosses/QueenShyeed/QueenShyeed.java
@@ -17,6 +17,7 @@
package ai.bosses.QueenShyeed;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -81,7 +82,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void spawnShyeed()
{
- final String respawn = loadGlobalQuestVar("Respawn");
+ final String respawn = GlobalVariablesManager.getInstance().getString("QueenShyeedRespawn");
final long remain = (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
if (remain > 0)
{
@@ -98,7 +99,7 @@ public final class QueenShyeed extends AbstractNpcAI
private void startRespawn()
{
final int respawnTime = RESPAWN - getRandom(RANDOM_RESPAWN);
- saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + respawnTime));
+ GlobalVariablesManager.getInstance().set("QueenShyeedRespawn", Long.toString(System.currentTimeMillis() + respawnTime));
startQuestTimer("respawn", respawnTime, null, null);
MOB_BUFF_ZONE.setEnabled(false);
MOB_BUFF_DISPLAY_ZONE.setEnabled(false);
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java b/L2J_Mobius_Underground/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
index 025b2b1ee6..4f7c4036a3 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
@@ -79,14 +79,14 @@ public final class FreyaCelebration extends LongTimeEvent
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
- final String value = loadGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("FreyaCelebration");
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
+ player.getVariables().set("FreyaCelebration", Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
}
else
{
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java b/L2J_Mobius_Underground/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
index 5e23a4932c..f90f95264b 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/events/MasterOfEnchanting/MasterOfEnchanting.java
@@ -92,7 +92,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
else if (event.equalsIgnoreCase("buy_scroll_24"))
{
final long curTime = System.currentTimeMillis();
- final String value = loadGlobalQuestVar(player.getAccountName());
+ final String value = player.getVariables().getString("MasterOfEnchanting");
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
{
@@ -105,7 +105,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
@@ -139,7 +139,7 @@ public final class MasterOfEnchanting extends LongTimeEvent
{
takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE);
giveItems(player, MASTER_YOGI_SCROLL, 24);
- saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
+ player.getVariables().set("MasterOfEnchanting", Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000)));
htmltext = "32599-scroll24.htm";
}
else
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java b/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
index 4b56c986ba..da5c9622ec 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
@@ -17,6 +17,7 @@
package quests.Q00307_ControlDeviceOfTheGiants;
import com.l2jmobius.gameserver.enums.QuestSound;
+import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
@@ -100,7 +101,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
{
return "32711-09.html";
}
- final String respawn = loadGlobalQuestVar("Respawn");
+ final String respawn = GlobalVariablesManager.getInstance().getString("GiantsControlDeviceRespawn");
final long remain = !respawn.isEmpty() ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
if (remain > 0)
{
@@ -170,7 +171,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
qst.setCond(2, true);
}
}
- saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY));
+ GlobalVariablesManager.getInstance().set("GiantsControlDeviceRespawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY));
}
break;
}
diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 07d10a322a..27b1975a95 100644
--- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1655,97 +1655,6 @@ public class Quest extends AbstractScript implements IIdentifiable
}
}
- /**
- * Insert (or update) in the database variables that need to stay persistent for this quest after a reboot.
- * This function is for storage of values that do not related to a specific player but are global for all characters.
- * For example, if we need to disable a quest-gatekeeper until a certain time (as is done with some grand-boss gatekeepers), we can save that time in the DB.
- * @param var the name of the variable to save
- * @param value the value of the variable
- */
- public final void saveGlobalQuestVar(String var, String value)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.setString(3, value);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not insert global quest variable:", e);
- }
- }
-
- /**
- * Read from the database a previously saved variable for this quest.
- * Due to performance considerations, this function should best be used only when the quest is first loaded.
- * Subclasses of this class can define structures into which these loaded values can be saved.
- * However, on-demand usage of this function throughout the script is not prohibited, only not recommended.
- * Values read from this function were entered by calls to "saveGlobalQuestVar".
- * @param var the name of the variable to load
- * @return the current value of the specified variable, or an empty string if the variable does not exist
- */
- public final String loadGlobalQuestVar(String var)
- {
- String result = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- try (ResultSet rs = statement.executeQuery())
- {
- if (rs.first())
- {
- result = rs.getString(1);
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not load global quest variable:", e);
- }
- return result;
- }
-
- /**
- * Permanently delete from the database a global quest variable that was previously saved for this quest.
- * @param var the name of the variable to delete
- */
- public final void deleteGlobalQuestVar(String var)
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"))
- {
- statement.setString(1, getName());
- statement.setString(2, var);
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variable:", e);
- }
- }
-
- /**
- * Permanently delete from the database all global quest variables that were previously saved for this quest.
- */
- public final void deleteAllGlobalQuestVars()
- {
- try (Connection con = DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"))
- {
- statement.setString(1, getName());
- statement.executeUpdate();
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "could not delete global quest variables:", e);
- }
- }
-
/**
* Insert in the database the quest for the player.
* @param qs the {@link QuestState} object whose variable to insert