本文整理汇总了C++中PreparedStatement::setInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ PreparedStatement::setInt32方法的具体用法?C++ PreparedStatement::setInt32怎么用?C++ PreparedStatement::setInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreparedStatement
的用法示例。
在下文中一共展示了PreparedStatement::setInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToDB
void AuctionEntry::SaveToDB(SQLTransaction& trans) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION);
stmt->setUInt32(0, Id);
stmt->setUInt32(1, auctioneer);
stmt->setUInt32(2, itemGUIDLow);
stmt->setUInt32(3, owner);
stmt->setUInt64 (4, buyout);
stmt->setUInt64(5, uint64(expire_time));
stmt->setUInt32(6, bidder);
stmt->setUInt64 (7, bid);
stmt->setUInt64 (8, startbid);
stmt->setInt32 (9, int32(deposit));
trans->Append(stmt);
}
示例2: UpdateEvent
void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
stmt->setUInt64(0, calendarEvent->GetEventId());
stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
stmt->setString(2, calendarEvent->GetTitle());
stmt->setString(3, calendarEvent->GetDescription());
stmt->setUInt8(4, calendarEvent->GetType());
stmt->setInt32(5, calendarEvent->GetDungeonId());
stmt->setUInt32(6, uint32(calendarEvent->GetEventTime()));
stmt->setUInt32(7, calendarEvent->GetFlags());
stmt->setUInt32(8, calendarEvent->GetTimeZoneTime()); // correct?
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
示例3: outDB
void Log::outDB(LogTypes type, const char * str)
{
if (!str || type >= MAX_LOG_TYPES)
return;
std::string logStr(str);
if (logStr.empty())
return;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
stmt->setInt32(0, realm);
stmt->setUInt8(1, uint8(type));
stmt->setString(2, logStr);
LoginDatabase.Execute(stmt);
}
示例4: HandleTicketCreate
static bool HandleTicketCreate(ChatHandler* handler, char const* args)
{
Player* player = handler->GetSession()->GetPlayer();;
if (!player)
return false;
//
if (*args)
{
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET);
stmt->setUInt32(index, sTicketMgr->GenerateTicketId());
stmt->setUInt32(++index, GUID_LOPART(handler->GetSession()->GetPlayer()->GetGUID()));
stmt->setString(++index, handler->GetSession()->GetPlayer()->GetName());
stmt->setString(++index, args);
stmt->setUInt32(++index, uint32(000));
stmt->setUInt16(++index, 1);
stmt->setFloat(++index, 1.0f);
stmt->setFloat(++index, 1.0f);
stmt->setFloat(++index, 1.0f);
stmt->setUInt32(++index, uint32(000));
stmt->setInt32(++index, GUID_LOPART(0));
stmt->setUInt32(++index, GUID_LOPART(0));
stmt->setString(++index, "NO COMMENT");
stmt->setBool(++index, false);
stmt->setUInt8(++index, uint8(0));
stmt->setBool(++index, false);
stmt->setBool(++index, true);
CharacterDatabase.Execute(stmt);
return true;
ChatHandler(player->GetSession()).PSendSysMessage("You have created a new ticket, and it'll soon be addressed by one of our staff members, please, be patient.");
}
else
{
ChatHandler(player->GetSession()).PSendSysMessage("You must include some content of text in your ticket, the way of doing is by writing like in the following example: .pticket create my warrior is stuck, please help me gm!");
return false;
}
}
示例5: AddGroup
RBACCommandResult RBACData::AddGroup(uint32 groupId, int32 realmId /* = 0 */)
{
// Check if group Id exists
RBACGroup const* group = sAccountMgr->GetRBACGroup(groupId);
if (!group)
{
TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::AddGroup [Id: %u Name: %s] (Group %u, RealmId %d). Group does not exists",
GetId(), GetName().c_str(), groupId, realmId);
return RBAC_ID_DOES_NOT_EXISTS;
}
// Already added?
std::pair<std::set<uint32>::iterator, bool> ret = _groups.insert(groupId);
if (!ret.second)
{
TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::AddGroup [Id: %u Name: %s] (Group %u, RealmId %d). Group Already added",
GetId(), GetName().c_str(), groupId, realmId);
return RBAC_CANT_ADD_ALREADY_ADDED;
}
// Do not save to db when loading data from DB (realmId = 0)
if (realmId)
{
TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::AddGroup [Id: %u Name: %s] (Group %u, RealmId %d). Added and DB updated",
GetId(), GetName().c_str(), groupId, realmId);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_GROUP);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, groupId);
stmt->setInt32(2, realmId);
LoginDatabase.Execute(stmt);
CalculateNewPermissions();
}
else
TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::AddGroup [Id: %u Name: %s] (Group %u, RealmId %d). Added",
GetId(), GetName().c_str(), groupId, realmId);
return RBAC_OK;
}
示例6: SaveToDB
void ReputationMgr::SaveToDB(SQLTransaction& trans)
{
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
{
if (itr->second.needSave)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt16(1, uint16(itr->second.ID));
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt16(1, uint16(itr->second.ID));
stmt->setInt32(2, itr->second.Standing);
stmt->setUInt16(3, uint16(itr->second.Flags));
trans->Append(stmt);
itr->second.needSave = false;
}
}
}
示例7: SaveToDB
void GmTicket::SaveToDB(SQLTransaction& trans) const
{
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_GM_TICKET);
stmt->setUInt32( index, _id);
stmt->setUInt32(++index, GUID_LOPART(_playerGuid));
stmt->setString(++index, _playerName);
stmt->setString(++index, _message);
stmt->setUInt32(++index, uint32(_createTime));
stmt->setUInt16(++index, _mapId);
stmt->setFloat (++index, _posX);
stmt->setFloat (++index, _posY);
stmt->setFloat (++index, _posZ);
stmt->setUInt32(++index, uint32(_lastModifiedTime));
stmt->setInt32 (++index, GUID_LOPART(_closedBy));
stmt->setUInt32(++index, GUID_LOPART(_assignedTo));
stmt->setString(++index, _comment);
stmt->setBool (++index, _completed);
stmt->setUInt8 (++index, uint8(_escalatedStatus));
stmt->setBool (++index, _viewed);
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
示例8: HandleActivateCommand
static bool HandleActivateCommand(ChatHandler * handler, const char * args)
{
Player* player = handler->GetSession()->GetPlayer();
if(player->GetSession()->GetSecurity() >= 1)
{
handler->PSendSysMessage("You already got VIP rank.");
handler->SetSentErrorMessage(true);
return false;
}
if(player->HasItemCount(313370, 1, false)) // Token ID, Count.
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);
stmt->setUInt32(0, player->GetSession()->GetAccountId());
stmt->setUInt8(1, 1);
stmt->setInt32(2, 1);
LoginDatabase.Execute(stmt);
player->DestroyItemCount(313370, 1, true, false); // Token ID, Count.
handler->PSendSysMessage("Your VIP rank has been updated.Login to get it active");
return true;
}
return true;
}
示例9: HandleAccountSetGmLevelCommand
//.........这里部分代码省略.........
// Check for account
if (isAccountNameGiven)
{
targetAccountName = arg1;
if (!AccountMgr::normalizeString(targetAccountName))
{
handler->PSendSysMessage(LANGUAGE_ACCOUNT_NOT_EXIST, targetAccountName.c_str());
handler->SetSentErrorMessage(true);
return false;
}
}
// Check for invalid specified GM level.
gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1);
if (gm > SEC_CONSOLE)
{
handler->SendSysMessage(LANGUAGE_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
// handler->getSession() == NULL only for console
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
uint32 playerSecurity;
if (handler->GetSession())
playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
else
playerSecurity = SEC_CONSOLE;
// can set security level only for target with less security and to less security that we have
// This is also reject self apply in fact
targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID);
if (targetSecurity >= playerSecurity || gm >= playerSecurity)
{
handler->SendSysMessage(LANGUAGE_YOURS_SECURITY_IS_LOW);
handler->SetSentErrorMessage(true);
return false;
}
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity))
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SELECT_ACCOUNT_ACCESS_GMLEVEL_TEST);
stmt->setUInt32(0, targetAccountId);
stmt->setUInt8(1, uint8(gm));
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
handler->SendSysMessage(LANGUAGE_YOURS_SECURITY_IS_LOW);
handler->SetSentErrorMessage(true);
return false;
}
}
// Check if provided realmID has a negative value other than -1
if (gmRealmID < -1)
{
handler->SendSysMessage(LANGUAGE_INVALID_REALMID);
handler->SetSentErrorMessage(true);
return false;
}
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
PreparedStatement* stmt;
if (gmRealmID == -1)
{
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DELETE_ACCOUNT_ACCESS);
stmt->setUInt32(0, targetAccountId);
}
else
{
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DELETE_ACCOUNT_ACCESS_BY_REALM);
stmt->setUInt32(0, targetAccountId);
stmt->setUInt32(1, realmID);
}
LoginDatabase.Execute(stmt);
if (gm != 0)
{
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INSERT_ACCOUNT_ACCESS);
stmt->setUInt32(0, targetAccountId);
stmt->setUInt8(1, uint8(gm));
stmt->setInt32(2, gmRealmID);
LoginDatabase.Execute(stmt);
}
handler->PSendSysMessage(LANGUAGE_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
return true;
}
示例10: HandleAuthSession
//.........这里部分代码省略.........
{
SendAuthResponseError(AUTH_FAILED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
sScriptMgr->OnFailedAccountLogin(id);
DelayedCloseSocket();
return;
}
}
int64 mutetime = fields[5].GetInt64();
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
if (mutetime < 0)
{
mutetime = time(NULL) + llabs(mutetime);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
stmt->setInt64(0, mutetime);
stmt->setUInt32(1, id);
LoginDatabase.Execute(stmt);
}
locale = LocaleConstant(fields[6].GetUInt8());
if (locale >= TOTAL_LOCALES)
locale = LOCALE_enUS;
uint32 recruiter = fields[7].GetUInt32();
// Checks gmlevel per Realm
stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID);
stmt->setUInt32(0, id);
stmt->setInt32(1, int32(realmID));
result = LoginDatabase.Query(stmt);
if (!result)
security = 0;
else
{
fields = result->Fetch();
security = fields[0].GetUInt8();
}
// Re-check account ban (same check as in auth)
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS);
stmt->setUInt32(0, id);
stmt->setString(1, address);
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
if (banresult) // if account banned
{
SendAuthResponseError(AUTH_BANNED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
sScriptMgr->OnFailedAccountLogin(id);
DelayedCloseSocket();
return;
}
// Check premium
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PREMIUM);
stmt->setUInt32(0, id);
PreparedQueryResult premresult = LoginDatabase.Query(stmt);
示例11: HandleNpcAddCommand
//add spawn of creature
static bool HandleNpcAddCommand(ChatHandler* handler, const char* args)
{
if (!*args)
return false;
char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
if (!charID)
return false;
char* team = strtok(NULL, " ");
int32 teamval = 0;
if (team) { teamval = atoi(team); }
if (teamval < 0) { teamval = 0; }
uint32 id = atoi(charID);
Player* chr = handler->GetSession()->GetPlayer();
float x = chr->GetPositionX();
float y = chr->GetPositionY();
float z = chr->GetPositionZ();
float o = chr->GetOrientation();
Map* map = chr->GetMap();
if (chr->GetTransport())
{
uint32 tguid = chr->GetTransport()->AddNPCPassenger(0, id, chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO());
if (tguid > 0)
{
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_TRANSPORT);
stmt->setInt32(0, int32(tguid));
stmt->setInt32(1, int32(id));
stmt->setInt32(2, int32(chr->GetTransport()->GetEntry()));
stmt->setFloat(3, chr->GetTransOffsetX());
stmt->setFloat(4, chr->GetTransOffsetY());
stmt->setFloat(5, chr->GetTransOffsetZ());
stmt->setFloat(6, chr->GetTransOffsetO());
WorldDatabase.Execute(stmt);
}
return true;
}
Creature* creature = new Creature();
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o))
{
delete creature;
return false;
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
uint32 db_guid = creature->GetDBTableGUIDLow();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
if (!creature->LoadCreatureFromDB(db_guid, map))
{
delete creature;
return false;
}
sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid));
return true;
}
示例12: LoadGuilds
//.........这里部分代码省略.........
Field* fields = result->Fetch();
uint32 guildId = fields[0].GetUInt32();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankTabFromDB(fields);
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 8. Fill all guild bank tabs
sLog->outInfo(LOG_FILTER_GUILD, "Filling bank tabs with items...");
{
uint32 oldMSTime = getMSTime();
// Delete orphan guild bank items
CharacterDatabase.DirectExecute("DELETE gbi FROM guild_bank_item gbi LEFT JOIN guild g ON gbi.guildId = g.guildId WHERE g.guildId IS NULL");
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = CharacterDatabase.Query("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, "
// 11 12 13 14 15
"guildid, TabId, SlotId, item_guid, itemEntry FROM guild_bank_item gbi INNER JOIN item_instance ii ON gbi.item_guid = ii.guid");
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
}
else
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 guildId = fields[11].GetUInt32();
if (Guild* guild = GetGuildById(guildId))
guild->LoadBankItemFromDB(fields);
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 9. Load guild achievements
{
PreparedQueryResult achievementResult;
PreparedQueryResult criteriaResult;
for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_ACHIEVEMENT);
stmt->setUInt32(0, itr->first);
achievementResult = CharacterDatabase.Query(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_ACHIEVEMENT_CRITERIA);
stmt->setUInt32(0, itr->first);
criteriaResult = CharacterDatabase.Query(stmt);
itr->second->GetAchievementMgr().LoadFromDB(achievementResult, criteriaResult);
}
}
// 10. Deleting old Guild News (older than one week)
sLog->outInfo(LOG_FILTER_GENERAL, "Deleting old Guild News");
{
CharacterDatabase.PQuery("DELETE FROM guild_news_log WHERE date < %u;", uint32(time(NULL) - DAY * 7));
}
// 11. Loading Guild news
sLog->outInfo(LOG_FILTER_GENERAL, "Loading Guild News");
{
for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GUILD_NEWS);
stmt->setInt32(0, itr->first);
itr->second->GetNewsLog().LoadFromDB(CharacterDatabase.Query(stmt));
}
}
// 11. Validate loaded guild data
sLog->outInfo(LOG_FILTER_GENERAL, "Validating data of loaded guilds...");
{
uint32 oldMSTime = getMSTime();
for (GuildContainer::iterator itr = GuildStore.begin(); itr != GuildStore.end();)
{
Guild* guild = itr->second;
++itr;
if (guild && !guild->Validate())
delete guild;
}
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
}
示例13: HandlePInfoCommand
//.........这里部分代码省略.........
QueryResult row = CharacterDatabase.PQuery("SELECT * FROM `jail` WHERE `guid`='%u' LIMIT 1", GUID_LOPART(target_guid));
if (!row)
{
p_jail_isjailed = false;
}
else
{
Field *data = row->Fetch();
p_jail_isjailed = true;
p_jail_guid = data[0].GetUInt32();
p_jail_char = data[1].GetString();
p_jail_release = data[2].GetUInt32();
p_jail_amnestietime = data[3].GetUInt32();
p_jail_reason = data[4].GetString();
p_jail_times = data[5].GetUInt32();
p_jail_gmacc = data[6].GetUInt32();
p_jail_gmchar = data[7].GetString();
p_jail_lasttime = data[8].GetString();
p_jail_duration = data[9].GetUInt32();
gmname = "";
}
}
std::string username = GetTrinityString(LANG_ERROR);
std::string email = GetTrinityString(LANG_ERROR);
std::string last_ip = GetTrinityString(LANG_ERROR);
uint32 security = 0;
std::string last_login = GetTrinityString(LANG_ERROR);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
stmt->setInt32(0, int32(realmID));
stmt->setUInt32(1, accId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
username = fields[0].GetString();
security = fields[1].GetUInt8();
email = fields[2].GetString();
muteTime = fields[5].GetUInt64();
if (email.empty())
email = "-";
if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
{
last_ip = fields[3].GetString();
last_login = fields[4].GetString();
uint32 ip = inet_addr(last_ip.c_str());
#if TRINITY_ENDIAN == BIGENDIAN
EndianConvertReverse(ip);
#endif
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
stmt->setUInt32(0, ip);
PreparedQueryResult result2 = WorldDatabase.Query(stmt);
if (result2)
{
示例14: UpdateAccountAccess
void AccountMgr::UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId)
{
int32 serverRealmId = realmId != -1 ? realmId : ConfigMgr::GetIntDefault("RealmID", 0);
bool needDelete = false;
if (!rbac)
{
needDelete = true;
rbac = new RBACData(accountId, "", serverRealmId);
rbac->LoadFromDB();
}
// Get max security level and realm (checking current realm and -1)
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_BY_ID);
stmt->setUInt32(0, accountId);
stmt->setInt32(1, serverRealmId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
do
{
Field* field = result->Fetch();
uint8 secLevel = field[0].GetUInt8();
int32 realmId = field[1].GetUInt32();
RBACGroupContainer const& groupsToRemove = _defaultSecGroups[secLevel];
for (RBACGroupContainer::const_iterator it = groupsToRemove.begin(); it != groupsToRemove.end(); ++it)
rbac->RemoveGroup(*it, realmId);
}
while (result->NextRow());
}
// Add new groups depending on the new security Level
RBACGroupContainer const& groupsToAdd = _defaultSecGroups[securityLevel];
for (RBACGroupContainer::const_iterator it = groupsToAdd.begin(); it != groupsToAdd.end(); ++it)
rbac->AddGroup(*it, realmId);
if (needDelete)
delete rbac;
// Delete old security level from DB
if (realmId == -1)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
stmt->setUInt32(0, accountId);
LoginDatabase.Execute(stmt);
}
else
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM);
stmt->setUInt32(0, accountId);
stmt->setUInt32(1, realmId);
LoginDatabase.Execute(stmt);
}
// Add new security level
if (securityLevel)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);
stmt->setUInt32(0, accountId);
stmt->setUInt8(1, securityLevel);
stmt->setInt32(2, realmId);
LoginDatabase.Execute(stmt);
}
}
示例15: HandleWpShowCommand
//.........这里部分代码省略.........
if (hasError)
{
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR1);
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR2);
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR3);
}
}
do
{
Field* fields = result->Fetch();
uint32 point = fields[0].GetUInt32();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
float z = fields[3].GetFloat();
uint32 id = VISUAL_WAYPOINT;
Player* chr = handler->GetSession()->GetPlayer();
Map* map = chr->GetMap();
float o = chr->GetOrientation();
Creature* wpCreature = new Creature;
if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
return false;
}
// Set "wpguid" column to the visual waypoint
PreparedStatement* 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());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
return false;
}
if (target)
{
wpCreature->SetDisplayId(target->GetDisplayId());
wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point);
}
}
while (result->NextRow());
handler->SendSysMessage("|cff00ff00Showing the current creature's path.|r");
return true;
}
if (show == "first")
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid);
QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z FROM waypoint_data WHERE point='1' AND id = '%u'", pathid);