aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitm-gnd <m.goumrhar@tuta.io>2025-09-20 18:05:22 +0000
committerGitHub <noreply@github.com>2025-09-20 20:05:22 +0200
commitafd6900b10601061cb6cbc36ed22cd5e16c68305 (patch)
tree8f9932793bae0f2081e0c4a56b3c526ede5c0398
parentb64567f98fc217c670416a3bfebefecef288a314 (diff)
Scripts/Commands: Use localized names for .additem (#31270)
-rw-r--r--src/server/database/Database/Implementation/WorldDatabase.cpp1
-rw-r--r--src/server/database/Database/Implementation/WorldDatabase.h1
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp14
3 files changed, 16 insertions, 0 deletions
diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp
index b28abd0e7fc..9f866ebf8d6 100644
--- a/src/server/database/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/database/Database/Implementation/WorldDatabase.cpp
@@ -80,6 +80,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, type, type_flags, lootid, pickpocketloot, skinloot, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName, StringId FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId WHERE entry = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME, "SELECT ID FROM item_template_locale WHERE Name = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH);
diff --git a/src/server/database/Database/Implementation/WorldDatabase.h b/src/server/database/Database/Implementation/WorldDatabase.h
index 7b009320716..d1b865aa9bf 100644
--- a/src/server/database/Database/Implementation/WorldDatabase.h
+++ b/src/server/database/Database/Implementation/WorldDatabase.h
@@ -85,6 +85,7 @@ enum WorldDatabaseStatements : uint32
WORLD_SEL_CREATURE_TEMPLATE,
WORLD_SEL_WAYPOINT_SCRIPT_BY_ID,
WORLD_SEL_ITEM_TEMPLATE_BY_NAME,
+ WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME,
WORLD_SEL_CREATURE_BY_ID,
WORLD_SEL_GAMEOBJECT_NEAREST,
WORLD_SEL_CREATURE_NEAREST,
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index a2f085b4596..2f64f2b8f9d 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1177,6 +1177,13 @@ public:
if (!result)
{
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME);
+ stmt->setString(0, itemName);
+ result = WorldDatabase.Query(stmt);
+ }
+
+ if (!result)
+ {
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
handler->SetSentErrorMessage(true);
return false;
@@ -1317,6 +1324,13 @@ public:
if (!result)
{
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME);
+ stmt->setString(0, itemName);
+ result = WorldDatabase.Query(stmt);
+ }
+
+ if (!result)
+ {
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr + 1);
handler->SetSentErrorMessage(true);
return false;