aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2012-01-01 22:31:48 +0100
committerRat <gmstreetrat@gmail.com>2012-01-01 22:31:48 +0100
commit0e950d5e467a63827d1e280929a2e5bd36e6dc98 (patch)
tree41c3424fe560ee1a338140203ffdf1b1ae7b6469 /src/server/scripts/Commands
parentbff7c18251e8c16dfbe3f4484a76d8df76f05076 (diff)
parentb1e19257bcd80427986cbb670cbc69c45d6154b6 (diff)
Merge branch '4.x' of git://github.com/TrinityCore/TrinityCore into 4.x
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp35
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp10
2 files changed, 28 insertions, 17 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index ae3250ad7b7..bcef7ac9ba9 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -81,8 +81,13 @@ public:
return false;
}
- // No SQL injection
- LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, accountId);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPDATE_EXPANSION);
+
+ stmt->setUInt8(0, uint8(expansion));
+ stmt->setUInt32(1, accountId);
+
+ LoginDatabase.Execute(stmt);
+
handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion);
return true;
}
@@ -242,17 +247,25 @@ public:
}
std::string param = (char*)args;
- if (param == "on")
- {
- LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%d'", handler->GetSession()->GetAccountId());
- handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
- return true;
- }
- if (param == "off")
+ if (!param.empty())
{
- LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%d'", handler->GetSession()->GetAccountId());
- handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPDATE_ACCOUNT_LOCK);
+
+ if (param == "on")
+ {
+ stmt->setBool(0, true); // locked
+ handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
+ }
+ else if (param == "off")
+ {
+ stmt->setBool(0, false); // unlocked
+ handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
+ }
+
+ stmt->setUInt32(1, handler->GetSession()->GetAccountId());
+
+ LoginDatabase.Execute(stmt);
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index b9ac21cc040..a5aa2a516f3 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -552,15 +552,13 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask());
handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
handler->PSendSysMessage(LANG_NPCINFO_POSITION, float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ()));
+ handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
- if ((npcflags & UNIT_NPC_FLAG_VENDOR))
- {
+ if (npcflags & UNIT_NPC_FLAG_VENDOR)
handler->SendSysMessage(LANG_NPCINFO_VENDOR);
- }
- if ((npcflags & UNIT_NPC_FLAG_TRAINER))
- {
+
+ if (npcflags & UNIT_NPC_FLAG_TRAINER)
handler->SendSysMessage(LANG_NPCINFO_TRAINER);
- }
return true;
}