aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp15
-rw-r--r--src/server/scripts/Commands/cs_list.cpp57
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp21
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp4
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp96
5 files changed, 85 insertions, 108 deletions
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index afaf5f651bc..9d6af235298 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -377,7 +377,9 @@ public:
static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
+ PreparedStatement* stmt = NULL;
+
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
LoginDatabase.Execute(stmt);
char* filterStr = strtok((char*)args, " ");
@@ -387,12 +389,12 @@ public:
if (filter.empty())
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
result = LoginDatabase.Query(stmt);
}
else
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
stmt->setString(0, filter);
result = LoginDatabase.Query(stmt);
}
@@ -577,7 +579,8 @@ public:
static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
+ PreparedStatement* stmt = NULL;
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
LoginDatabase.Execute(stmt);
char* filterStr = strtok((char*)args, " ");
@@ -588,12 +591,12 @@ public:
if (filter.empty())
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
result = LoginDatabase.Query(stmt);
}
else
{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
stmt->setString(0, filter);
result = LoginDatabase.Query(stmt);
}
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 3c86d059ef5..6a0755b82e8 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -471,6 +471,7 @@ public:
Player* target;
uint64 targetGuid;
std::string targetName;
+ PreparedStatement* stmt = NULL;
if (!*args)
return false;
@@ -485,35 +486,38 @@ public:
else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT);
stmt->setUInt32(0, targetGuid);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (result)
+ PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
+ if (queryResult)
{
- Field* fields = result->Fetch();
- uint32 countMail = fields[0].GetUInt64();
+ Field* fields = queryResult->Fetch();
+ uint32 countMail = fields[0].GetUInt64();
+
std::string nameLink = handler->playerLink(targetName);
handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid);
handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
stmt->setUInt32(0, targetGuid);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (result)
+ PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
+
+ if (queryResult)
{
do
{
- Field* fields = result->Fetch();
- uint32 messageId = fields[0].GetUInt32();
- uint32 senderId = fields[1].GetUInt32();
- std::string sender = fields[2].GetString();
- uint32 receiverId = fields[3].GetUInt32();
- std::string receiver = fields[4].GetString();
- std::string subject = fields[5].GetString();
- uint64 deliverTime = fields[6].GetUInt32();
- uint64 expireTime = fields[7].GetUInt32();
- uint32 money = fields[8].GetUInt32();
- int hasItem = fields[9].GetUInt8();
- uint32 gold = money /GOLD;
+ Field* queryFields = queryResult->Fetch();
+ uint32 messageId = queryFields[0].GetUInt32();
+ uint32 senderId = queryFields[1].GetUInt32();
+ std::string sender = queryFields[2].GetString();
+ uint32 receiverId = queryFields[3].GetUInt32();
+ std::string receiver = queryFields[4].GetString();
+ std::string subject = queryFields[5].GetString();
+ uint64 deliverTime = queryFields[6].GetUInt32();
+ uint64 expireTime = queryFields[7].GetUInt32();
+ uint32 money = queryFields[8].GetUInt32();
+ uint8 hasItem = queryFields[9].GetUInt8();
+ uint32 gold = money / GOLD;
uint32 silv = (money % GOLD) / SILVER;
uint32 copp = (money % GOLD) % SILVER;
std::string receiverStr = handler->playerLink(receiver);
@@ -521,6 +525,7 @@ public:
handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1, messageId, subject.c_str(), gold, silv, copp);
handler->PSendSysMessage(LANG_LIST_MAIL_INFO_2, senderStr.c_str(), senderId, receiverStr.c_str(), receiverId);
handler->PSendSysMessage(LANG_LIST_MAIL_INFO_3, TimeToTimestampStr(deliverTime).c_str(), TimeToTimestampStr(expireTime).c_str());
+
if (hasItem == 1)
{
QueryResult result2;
@@ -529,17 +534,17 @@ public:
{
do
{
- uint32 item_guid = (*result2)[0].GetUInt32();
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_ITEMS);
+ uint32 item_guid = (*result2)[0].GetUInt32();
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_ITEMS);
stmt->setUInt32(0, item_guid);
PreparedQueryResult result3 = CharacterDatabase.Query(stmt);
if (result3)
{
do
{
- Field* fields = result3->Fetch();
- uint32 item_entry = fields[0].GetUInt32();
- uint32 item_count = fields[1].GetUInt32();
+ Field* fields3 = result3->Fetch();
+ uint32 item_entry = fields3[0].GetUInt32();
+ uint32 item_count = fields3[1].GetUInt32();
QueryResult result4;
result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '%u'", item_entry);
Field* fields1 = result4->Fetch();
@@ -563,7 +568,7 @@ public:
}
handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR);
}
- while (result->NextRow());
+ while (queryResult->NextRow());
}
else
handler->PSendSysMessage(LANG_LIST_MAIL_NOT_FOUND);
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 458538936fd..4dd6bee8a2b 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1383,6 +1383,7 @@ public:
Player* target;
uint64 targetGuid;
std::string targetName;
+ PreparedStatement* stmt = NULL;
// To make sure we get a target, we convert our guid to an omniversal...
uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
@@ -1512,7 +1513,7 @@ public:
return false;
// Query informations from the DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
stmt->setUInt32(0, lowguid);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -1539,7 +1540,7 @@ public:
}
// Query the prepared statement for login data
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
stmt->setInt32(0, int32(realmID));
stmt->setUInt32(1, accId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
@@ -1563,7 +1564,7 @@ public:
EndianConvertReverse(ip);
// If ip2nation table is populated, it displays the country
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY);
stmt->setUInt32(0, ip);
if (PreparedQueryResult result2 = LoginDatabase.Query(stmt))
{
@@ -1640,13 +1641,13 @@ public:
PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
if (result5)
{
- Field* fields = result5->Fetch();
- guildId = fields[0].GetUInt32();
- guildName = fields[1].GetString();
- guildRank = fields[2].GetString();
- guildRankId = fields[3].GetUInt8();
- note = fields[4].GetString();
- officeNote = fields[5].GetString();
+ Field* fields5 = result5->Fetch();
+ guildId = fields5[0].GetUInt32();
+ guildName = fields5[1].GetString();
+ guildRank = fields5[2].GetString();
+ guildRankId = fields5[3].GetUInt8();
+ note = fields5[4].GetString();
+ officeNote = fields5[5].GetString();
}
}
}
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
index 47fa01837f6..1c11ef0cd2a 100644
--- a/src/server/scripts/Commands/cs_rbac.cpp
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -369,8 +369,8 @@ public:
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMS_LINKED_HEADER));
rbac::RBACPermissionContainer const& permissions = permission->GetLinkedPermissions();
for (rbac::RBACPermissionContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
- if (rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*it))
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ if (rbac::RBACPermission const* rbacPermission = sAccountMgr->GetRBACPermission(*it))
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, rbacPermission->GetId(), rbacPermission->GetName().c_str());
}
return true;
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 94f84aaf20a..18157ba5083 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -238,6 +238,7 @@ public:
{
Creature* target = handler->getSelectedCreature();
+ PreparedStatement* stmt = NULL;
if (!target)
{
@@ -251,19 +252,15 @@ public:
{
if (target->GetCreatureAddon()->path_id != 0)
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
stmt->setUInt32(0, guildLow);
-
WorldDatabase.Execute(stmt);
target->UpdateWaypointID(0);
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
-
stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE));
stmt->setUInt32(1, guildLow);
-
WorldDatabase.Execute(stmt);
target->LoadPath(0);
@@ -271,6 +268,7 @@ public:
target->GetMotionMaster()->MoveTargetedHome();
target->GetMotionMaster()->Initialize();
target->MonsterSay("Path unloaded.", LANG_UNIVERSAL, NULL);
+
return true;
}
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path.");
@@ -285,6 +283,7 @@ public:
char* show_str = strtok((char*)args, " ");
std::string show = show_str;
+ PreparedStatement* stmt = NULL;
// Check
if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid"))
@@ -300,16 +299,14 @@ public:
if (id)
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
stmt->setUInt32(0, id);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT);
stmt->setUInt32(0, id);
-
WorldDatabase.Execute(stmt);
handler->PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id);
@@ -319,16 +316,11 @@ public:
}
else
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID);
PreparedQueryResult result = WorldDatabase.Query(stmt);
-
id = result->Fetch()->GetUInt32();
-
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT);
-
stmt->setUInt32(0, id + 1);
-
WorldDatabase.Execute(stmt);
handler->PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: |r|cff00ffff", id+1);
@@ -351,7 +343,7 @@ public:
float a8, a9, a10, a11;
char const* a7;
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID);
stmt->setUInt32(0, id);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -386,18 +378,14 @@ public:
{
id = atoi(arg_id);
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
stmt->setUInt32(0, id);
-
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (result)
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_SCRIPT);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_SCRIPT);
stmt->setUInt32(0, id);
-
WorldDatabase.Execute(stmt);
handler->PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: Waypoint script removed: ", id);
@@ -457,18 +445,16 @@ public:
uint32 newid = atoi(arg_3);
handler->PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r", "|cff00ff00", "Wp Event: Wypoint scipt guid: ", newid, " id changed: ", id);
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_ID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_ID);
stmt->setUInt32(0, newid);
stmt->setUInt32(1, id);
-
WorldDatabase.Execute(stmt);
return true;
}
else
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
stmt->setUInt32(0, id);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -480,8 +466,7 @@ public:
if (arg_str_2 == "posx")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_X);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_X);
stmt->setFloat(0, float(atof(arg_3)));
stmt->setUInt32(1, id);
@@ -492,8 +477,7 @@ public:
}
else if (arg_str_2 == "posy")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Y);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Y);
stmt->setFloat(0, float(atof(arg_3)));
stmt->setUInt32(1, id);
@@ -504,8 +488,7 @@ public:
}
else if (arg_str_2 == "posz")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Z);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Z);
stmt->setFloat(0, float(atof(arg_3)));
stmt->setUInt32(1, id);
@@ -516,8 +499,7 @@ public:
}
else if (arg_str_2 == "orientation")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_O);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_O);
stmt->setFloat(0, float(atof(arg_3)));
stmt->setUInt32(1, id);
@@ -577,6 +559,7 @@ public:
uint32 point = 0;
uint32 wpGuid = 0;
Creature* target = handler->getSelectedCreature();
+ PreparedStatement* stmt = NULL;
if (!target || target->GetEntry() != VISUAL_WAYPOINT)
{
@@ -590,7 +573,7 @@ public:
// User did select a visual waypoint?
// Check the creature
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID);
stmt->setUInt32(0, wpGuid);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -605,16 +588,16 @@ public:
// See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
std::string maxDiff = "0.01";
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_POS);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_POS);
stmt->setFloat(0, target->GetPositionX());
stmt->setString(1, maxDiff);
stmt->setFloat(2, target->GetPositionY());
stmt->setString(3, maxDiff);
stmt->setFloat(4, target->GetPositionZ());
stmt->setString(5, maxDiff);
- PreparedQueryResult result = WorldDatabase.Query(stmt);
+ PreparedQueryResult queryResult = WorldDatabase.Query(stmt);
- if (!result)
+ if (!queryResult)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid);
return true;
@@ -652,18 +635,14 @@ public:
wpCreature->AddObjectToRemoveList();
}
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
-
WorldDatabase.Execute(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POINT);
-
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
-
WorldDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_WAYPOINT_REMOVED);
@@ -711,14 +690,12 @@ public:
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
}
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POSITION);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POSITION);
stmt->setFloat(0, chr->GetPositionX());
stmt->setFloat(1, chr->GetPositionY());
stmt->setFloat(2, chr->GetPositionZ());
stmt->setUInt32(3, pathid);
stmt->setUInt32(4, point);
-
WorldDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_WAYPOINT_CHANGED);
@@ -760,6 +737,7 @@ public:
uint32 pathid = 0;
Creature* target = handler->getSelectedCreature();
+ PreparedStatement* stmt = NULL;
// Did player provide a PathID?
@@ -803,10 +781,8 @@ public:
return false;
}
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
stmt->setUInt32(0, target->GetGUIDLow());
-
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -839,10 +815,8 @@ public:
if (show == "on")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID);
stmt->setUInt32(0, pathid);
-
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -875,10 +849,8 @@ public:
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid);
hasError = true;
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
stmt->setUInt32(0, wpguid);
-
WorldDatabase.Execute(stmt);
}
else
@@ -922,12 +894,10 @@ public:
}
// Set "wpguid" column to the visual waypoint
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
stmt->setInt32(0, int32(wpCreature->GetGUIDLow()));
stmt->setUInt32(1, pathid);
stmt->setUInt32(2, point);
-
WorldDatabase.Execute(stmt);
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
@@ -956,7 +926,7 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid);
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID);
stmt->setUInt32(0, pathid);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -1006,7 +976,7 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid);
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID);
stmt->setUInt32(0, pathid);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -1053,7 +1023,7 @@ public:
if (show == "off")
{
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_BY_ID);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_BY_ID);
stmt->setUInt32(0, 1);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -1074,10 +1044,8 @@ public:
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
hasError = true;
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
-
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
stmt->setUInt32(0, guid);
-
WorldDatabase.Execute(stmt);
}
else