void GmailSettings::load() { loadAccount(); loadImapResource(); loadMailtransportResource(); loadIdentity(); }
/* TAccount: Load/Save Account */ void TAccount::reset() { if (!accountName.isEmpty()) { CString acc(accountName); loadAccount("defaultaccount"); accountName = acc; saveAccount(); } }
optional<TxInfo> ensureAccountIsLoadedCreated(size_t i) { if (!mAccounts[i]) { auto newAccount = createAccount(i); mAccounts[i] = newAccount; if (!loadAccount(*newAccount)) { newAccount->mSeq = LedgerHeaderFrame(mApp->getLedgerManager() .getCurrentLedgerHeader()) .getStartingSequenceNumber(); return make_optional<TxInfo>(newAccount->creationTransaction()); } } return nullopt<TxInfo>(); }
void TransactionWidget::loadQuery() { ThreadControl *tc = qobject_cast<ThreadControl *>( sender() ); if( !tc ) return; int i = tc->getIndexOfLastQuery( qList ); if( i < 0 ) return; QString str = tc->getData(); switch(i) { case 0: { loadHeader( str ); break; } case 1: case 4: case 5: { loadTransactions( str ); break; } case 2: { clearTransaction( str ); break; } case 3: { loadAccount( str ); break; } case 6: case 7: { loadAccountSaldo( str ); break; } } }
void AccountWidget::chooseQuery() { ThreadControl *tc = qobject_cast<ThreadControl *>( sender() ); if( !tc ) return; int i = tc->getIndexOfLastQuery( qList ); if( i < 0 ) return; QString str = tc->getData(); info->showProgressBar( false ); switch(i) { case 0: { loadCurency( str ); break; } case 1: { disconnect( tableWidget, SIGNAL( rowSelected(int) ), this, SLOT( selectRow(int) ) ); loadAccount(str); tableWidget->SetFocus(lastRow); connect( tableWidget, SIGNAL( rowSelected(int) ), this, SLOT( selectRow(int) ) ); break; } case 2: { loadStats( str ); break; } case 3: { checkDeleteAnswer( str ); break; } } }
void resizeAccounts(size_t n) { loadAccount(*mAccounts.front()); mAccounts.resize(n); }
bool IOLoginData::loadPlayer(Player* player, DBResult_ptr result) { if (!result) { return false; } Database* db = Database::getInstance(); uint32_t accno = result->getDataInt("account_id"); Account acc = loadAccount(accno); player->setGUID(result->getDataInt("id")); player->name = result->getDataString("name"); player->accountNumber = accno; player->accountType = acc.accountType; if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) { player->premiumDays = std::numeric_limits<uint16_t>::max(); } else { player->premiumDays = acc.premiumDays; } Group* group = g_game.getGroup(result->getDataInt("group_id")); if (!group) { std::cout << "[Error - IOLoginData::loadPlayer] " << player->name << " has Group ID " << result->getDataInt("group_id") << " which doesn't exist." << std::endl; return false; } player->setGroup(group); player->bankBalance = result->getNumber<uint64_t>("balance"); player->setSex(static_cast<PlayerSex_t>(result->getDataInt("sex"))); player->level = std::max<uint32_t>(1, result->getDataInt("level")); uint64_t experience = result->getNumber<uint64_t>("experience"); uint64_t currExpCount = Player::getExpForLevel(player->level); uint64_t nextExpCount = Player::getExpForLevel(player->level + 1); if (experience < currExpCount || experience > nextExpCount) { experience = currExpCount; } player->experience = experience; if (currExpCount < nextExpCount) { player->levelPercent = Player::getPercentLevel(player->experience - currExpCount, nextExpCount - currExpCount); } else { player->levelPercent = 0; } player->soul = result->getDataInt("soul"); player->capacity = result->getDataInt("cap") * 100; player->blessings = result->getDataInt("blessings"); unsigned long conditionsSize; const char* conditions = result->getDataStream("conditions", conditionsSize); PropStream propStream; propStream.init(conditions, conditionsSize); Condition* condition = Condition::createCondition(propStream); while (condition) { if (condition->unserialize(propStream)) { player->storedConditionList.push_front(condition); } else { delete condition; } condition = Condition::createCondition(propStream); } if (!player->setVocation(result->getDataInt("vocation"))) { std::cout << "[Error - IOLoginData::loadPlayer] " << player->name << " has Vocation ID " << result->getDataInt("vocation") << " which doesn't exist." << std::endl; return false; } player->mana = result->getDataInt("mana"); player->manaMax = result->getDataInt("manamax"); player->magLevel = result->getDataInt("maglevel"); uint64_t nextManaCount = player->vocation->getReqMana(player->magLevel + 1); uint64_t manaSpent = result->getNumber<uint64_t>("manaspent"); if (manaSpent > nextManaCount) { manaSpent = 0; } player->manaSpent = manaSpent; player->magLevelPercent = Player::getPercentLevel(player->manaSpent, nextManaCount); player->health = result->getDataInt("health"); player->healthMax = result->getDataInt("healthmax"); player->defaultOutfit.lookType = result->getDataInt("looktype"); player->defaultOutfit.lookHead = result->getDataInt("lookhead"); player->defaultOutfit.lookBody = result->getDataInt("lookbody"); player->defaultOutfit.lookLegs = result->getDataInt("looklegs"); player->defaultOutfit.lookFeet = result->getDataInt("lookfeet"); player->defaultOutfit.lookAddons = result->getDataInt("lookaddons"); player->currentOutfit = player->defaultOutfit; if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) { const int32_t skullSeconds = result->getDataInt("skulltime") - time(nullptr); if (skullSeconds > 0) { //ensure that we round up the number of ticks player->skullTicks = (skullSeconds + 2) * 1000; int32_t skull = result->getDataInt("skull"); if (skull == SKULL_RED) { player->skull = SKULL_RED; } else if (skull == SKULL_BLACK) { player->skull = SKULL_BLACK; } } } player->loginPosition.x = result->getDataInt("posx"); player->loginPosition.y = result->getDataInt("posy"); player->loginPosition.z = result->getDataInt("posz"); player->lastLoginSaved = result->getNumber<uint64_t>("lastlogin"); player->lastLogout = result->getNumber<uint64_t>("lastlogout"); player->offlineTrainingTime = result->getDataInt("offlinetraining_time") * 1000; player->offlineTrainingSkill = result->getDataInt("offlinetraining_skill"); Town* town = Towns::getInstance().getTown(result->getDataInt("town_id")); if (!town) { std::cout << "[Error - IOLoginData::loadPlayer] " << player->name << " has Town ID " << result->getDataInt("town_id") << " which doesn't exist." << std::endl; return false; } player->town = town; const Position& loginPos = player->loginPosition; if (loginPos.x == 0 && loginPos.y == 0 && loginPos.z == 0) { player->loginPosition = player->getTemplePosition(); } player->staminaMinutes = result->getDataInt("stamina"); static const std::string skillNames[] = {"skill_fist", "skill_club", "skill_sword", "skill_axe", "skill_dist", "skill_shielding", "skill_fishing"}; static const std::string skillNameTries[] = {"skill_fist_tries", "skill_club_tries", "skill_sword_tries", "skill_axe_tries", "skill_dist_tries", "skill_shielding_tries", "skill_fishing_tries"}; static const size_t size = sizeof(skillNames) / sizeof(std::string); for (uint8_t i = 0; i < size; ++i) { uint16_t skillLevel = result->getNumber<uint16_t>(skillNames[i]); uint64_t skillTries = result->getNumber<uint64_t>(skillNameTries[i]); uint64_t nextSkillTries = player->vocation->getReqSkillTries(i, skillLevel + 1); if (skillTries > nextSkillTries) { skillTries = 0; } player->skills[i].level = skillLevel; player->skills[i].tries = skillTries; player->skills[i].percent = Player::getPercentLevel(skillTries, nextSkillTries); } std::ostringstream query; query << "SELECT `guild_id`, `rank_id`, `nick` FROM `guild_membership` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { uint32_t guildId = result->getDataInt("guild_id"); uint32_t playerRankId = result->getDataInt("rank_id"); player->guildNick = result->getDataString("nick"); Guild* guild = g_game.getGuild(guildId); if (!guild) { query.str(""); query << "SELECT `name` FROM `guilds` WHERE `id` = " << guildId; if ((result = db->storeQuery(query.str()))) { guild = new Guild(guildId, result->getDataString("name")); g_game.addGuild(guild); query.str(""); query << "SELECT `id`, `name`, `level` FROM `guild_ranks` WHERE `guild_id` = " << guildId << " LIMIT 3"; if ((result = db->storeQuery(query.str()))) { do { guild->addRank(result->getDataInt("id"), result->getDataString("name"), result->getDataInt("level")); } while (result->next()); } } } if (guild) { player->guild = guild; GuildRank* rank = guild->getRankById(playerRankId); if (rank) { player->guildLevel = rank->level; } else { player->guildLevel = 1; } IOGuild::getWarList(guildId, player->guildWarList); query.str(""); query << "SELECT COUNT(*) AS `members` FROM `guild_membership` WHERE `guild_id` = " << guildId; if ((result = db->storeQuery(query.str()))) { guild->setMemberCount(result->getDataInt("members")); } } } query.str(""); query << "SELECT `player_id`, `name` FROM `player_spells` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { do { player->learnedInstantSpellList.emplace_front(result->getDataString("name")); } while (result->next()); } //load inventory items ItemMap itemMap; query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_items` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 1 && pid <= 10) { player->__internalAddThing(pid, item); } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load depot items itemMap.clear(); query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_depotitems` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 0 && pid < 100) { if (pid == 98) { DepotChest* depotChest = player->getPokeStorage(pid, true); if (depotChest) { depotChest->__internalAddThing(item); } } else { DepotChest* depotChest = player->getDepotChest(pid, true); if (depotChest) { depotChest->__internalAddThing(item); } } } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load inbox items itemMap.clear(); query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_inboxitems` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 0 && pid < 100) { player->getInbox()->__internalAddThing(item); } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load storage map query.str(""); query << "SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { do { player->addStorageValue(result->getDataInt("key"), result->getDataInt("value"), true); } while (result->next()); } //load vip query.str(""); query << "SELECT `player_id` FROM `account_viplist` WHERE `account_id` = " << player->getAccount(); if ((result = db->storeQuery(query.str()))) { do { player->addVIPInternal(result->getDataInt("player_id")); } while (result->next()); } player->updateBaseSpeed(); player->updateInventoryWeight(); player->updateItemsLight(true); return true; }
void Ui::start() { std::cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; std::string next = mainMenu(); std::string username = ""; Account* account = nullptr; while (next != "quit") { std::cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; if (next == "mainMenu") { next = mainMenu(); } else if (next == "accountMenu") { next = accountMenu(); } else if (next == "createAccount") { username = createAccount(); next = "mainMenu"; if (username.length() != 0) { next = "loadAccount"; } } else if (next == "deleteAccount") { deleteAccount(); next = "mainMenu"; } else if (next == "loadAccount") { account = loadAccount(username); username = ""; next = "accountMenu"; if (account == nullptr) { next = "loadAccount"; } } else if (next == "updateAccount") { updateAccount(account); next = "accountMenu"; } else if (next == "getWithdrawals") { getWithdrawals(account); next = "accountMenu"; } else if (next == "getDeposits") { getDeposits(account); next = "accountMenu"; } else if (next == "withdraw") { withdraw(account); next = "accountMenu"; } else if (next == "deposit") { deposit(account); next = "accountMenu"; } else if (next == "quitAccountMenu") { delete account; account = nullptr; next = "mainMenu"; } } }
bool IOLoginData::loadPlayer(Player* player, const std::string& name, bool preload /*= false*/) { Database* db = Database::getInstance(); std::ostringstream query; query << "SELECT `id`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina` FROM `players` WHERE `name` = " << db->escapeString(name); DBResult* result = db->storeQuery(query.str()); if (!result) { return false; } uint32_t accno = result->getDataInt("account_id"); Account acc = loadAccount(accno); player->setGUID(result->getDataInt("id")); player->accountNumber = accno; player->accountType = acc.accountType; if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) { player->premiumDays = 0xFFFF; } else { player->premiumDays = acc.premiumDays; } player->setGroupId(result->getDataInt("group_id")); if (preload) { //only loading basic info db->freeResult(result); return true; } player->bankBalance = (uint64_t)result->getDataLong("balance"); player->setSex((PlayerSex_t)result->getDataInt("sex")); player->level = std::max<uint32_t>(1, result->getDataInt("level")); uint64_t currExpCount = Player::getExpForLevel(player->level); uint64_t nextExpCount = Player::getExpForLevel(player->level + 1); uint64_t experience = (uint64_t)result->getDataLong("experience"); if (experience < currExpCount || experience > nextExpCount) { experience = currExpCount; } player->experience = experience; if (currExpCount < nextExpCount) { player->levelPercent = Player::getPercentLevel(player->experience - currExpCount, nextExpCount - currExpCount); } else { player->levelPercent = 0; } player->soul = result->getDataInt("soul"); player->capacity = result->getDataInt("cap"); player->blessings = result->getDataInt("blessings"); unsigned long conditionsSize = 0; const char* conditions = result->getDataStream("conditions", conditionsSize); PropStream propStream; propStream.init(conditions, conditionsSize); Condition* condition = Condition::createCondition(propStream); while (condition) { if (condition->unserialize(propStream)) { player->storedConditionList.push_back(condition); } else { delete condition; } condition = Condition::createCondition(propStream); } player->setVocation(result->getDataInt("vocation")); player->mana = result->getDataInt("mana"); player->manaMax = result->getDataInt("manamax"); player->magLevel = result->getDataInt("maglevel"); uint64_t nextManaCount = player->vocation->getReqMana(player->magLevel + 1); uint64_t manaSpent = result->getDataLong("manaspent"); if (manaSpent > nextManaCount) { manaSpent = 0; } player->manaSpent = manaSpent; player->magLevelPercent = Player::getPercentLevel(player->manaSpent, nextManaCount); player->health = result->getDataInt("health"); player->healthMax = result->getDataInt("healthmax"); player->defaultOutfit.lookType = result->getDataInt("looktype"); player->defaultOutfit.lookHead = result->getDataInt("lookhead"); player->defaultOutfit.lookBody = result->getDataInt("lookbody"); player->defaultOutfit.lookLegs = result->getDataInt("looklegs"); player->defaultOutfit.lookFeet = result->getDataInt("lookfeet"); player->defaultOutfit.lookAddons = result->getDataInt("lookaddons"); player->currentOutfit = player->defaultOutfit; if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) { int32_t skullSeconds = result->getDataInt("skulltime") - time(NULL); if (skullSeconds > 0) { //ensure that we round up the number of ticks player->skullTicks = (skullSeconds + 2) * 1000; int32_t skull = result->getDataInt("skull"); if (skull == SKULL_RED) { player->skull = SKULL_RED; } else if (skull == SKULL_BLACK) { player->skull = SKULL_BLACK; } } } player->loginPosition.x = result->getDataInt("posx"); player->loginPosition.y = result->getDataInt("posy"); player->loginPosition.z = result->getDataInt("posz"); player->lastLoginSaved = result->getDataLong("lastlogin"); player->lastLogout = result->getDataLong("lastlogout"); player->offlineTrainingTime = result->getDataInt("offlinetraining_time") * 1000; player->offlineTrainingSkill = result->getDataInt("offlinetraining_skill"); player->town = result->getDataInt("town_id"); Town* town = Towns::getInstance().getTown(player->town); if (town) { player->masterPos = town->getTemplePosition(); } Position loginPos = player->loginPosition; if (loginPos.x == 0 && loginPos.y == 0 && loginPos.z == 0) { player->loginPosition = player->masterPos; } player->staminaMinutes = result->getDataInt("stamina"); db->freeResult(result); query.str(""); query << "SELECT `guild_id`, `rank_id`, `nick` FROM `guild_membership` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { uint32_t guildId = result->getDataInt("guild_id"); uint32_t playerRankId = result->getDataInt("rank_id"); player->guildNick = result->getDataString("nick"); db->freeResult(result); Guild* guild = g_game.getGuild(guildId); if (!guild) { query.str(""); query << "SELECT `name` FROM `guilds` WHERE `id` = " << guildId; if ((result = db->storeQuery(query.str()))) { guild = new Guild(guildId, result->getDataString("name")); db->freeResult(result); g_game.addGuild(guild); query.str(""); query << "SELECT `id`, `name`, `level` FROM `guild_ranks` WHERE `guild_id` = " << guildId << " LIMIT 3"; if ((result = db->storeQuery(query.str()))) { do { guild->addRank(result->getDataInt("id"), result->getDataString("name"), result->getDataInt("level")); } while (result->next()); db->freeResult(result); } } } if (guild) { player->guild = guild; GuildRank* rank = guild->getRankById(playerRankId); if (rank) { player->guildLevel = rank->level; } else { player->guildLevel = 1; } IOGuild::getInstance()->getWarList(guildId, player->guildWarList); query.str(""); query << "SELECT COUNT(*) AS `members` FROM `guild_membership` WHERE `guild_id` = " << guildId; if ((result = db->storeQuery(query.str()))) { guild->setMemberCount(result->getDataInt("members")); db->freeResult(result); } } } //get password query.str(""); query << "SELECT `password` FROM `accounts` WHERE `id` = " << accno; result = db->storeQuery(query.str()); if (!result) { return false; } player->password = result->getDataString("password"); db->freeResult(result); // we need to find out our skills // so we query the skill table query.str(""); query << "SELECT `skillid`, `value`, `count` FROM `player_skills` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { //now iterate over the skills do { int32_t skillid = result->getDataInt("skillid"); if (skillid >= SKILL_FIRST && skillid <= SKILL_LAST) { uint32_t skillLevel = result->getDataInt("value"); uint64_t skillCount = result->getDataLong("count"); uint64_t nextSkillCount = player->vocation->getReqSkillTries(skillid, skillLevel + 1); if (skillCount > nextSkillCount) { skillCount = 0; } player->skills[skillid][SKILL_LEVEL] = skillLevel; player->skills[skillid][SKILL_TRIES] = skillCount; player->skills[skillid][SKILL_PERCENT] = Player::getPercentLevel(skillCount, nextSkillCount); } } while (result->next()); db->freeResult(result); } query.str(""); query << "SELECT `player_id`, `name` FROM `player_spells` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { do { std::string spellName = result->getDataString("name"); player->learnedInstantSpellList.push_back(spellName); } while (result->next()); db->freeResult(result); } //load inventory items ItemMap itemMap; query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_items` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); db->freeResult(result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 1 && pid <= 10) { player->__internalAddThing(pid, item); } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load depot items itemMap.clear(); query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_depotitems` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); db->freeResult(result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 0 && pid < 100) { DepotChest* depotChest = player->getDepotChest(pid, true); if (depotChest) { depotChest->__internalAddThing(item); } } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load inbox items itemMap.clear(); query.str(""); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_inboxitems` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); db->freeResult(result); for (ItemMap::reverse_iterator it = itemMap.rbegin(); it != itemMap.rend(); ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 0 && pid < 100) { player->getInbox()->__internalAddThing(item); } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->__internalAddThing(item); } } } } //load storage map query.str(""); query << "SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = " << player->getGUID(); if ((result = db->storeQuery(query.str()))) { do { player->addStorageValue(result->getDataInt("key"), result->getDataLong("value"), true); } while (result->next()); db->freeResult(result); } //load vip query.str(""); query << "SELECT `player_id` FROM `account_viplist` WHERE `account_id` = " << player->getAccount(); if ((result = db->storeQuery(query.str()))) { do { player->addVIPInternal(result->getDataInt("player_id")); } while (result->next()); db->freeResult(result); } player->updateBaseSpeed(); player->updateInventoryWeight(); player->updateItemsLight(true); return true; }