Loading...   


bool ZoneDatabase::LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp){
	std::string query = StringFormat(
		"SELECT					"
		"slot_id,				"
		"`spell_id`				"
		"FROM					"
		"`character_spells`		"
		"WHERE `id` = %u ORDER BY `slot_id`", character_id);
	auto results = database.QueryDatabase(query); 
	int i = 0;
	/* Initialize Spells */
	for (i = 0; i < MAX_PP_SPELLBOOK; i++){
		pp->spell_book[i] = 0xFFFFFFFF;
	}
	for (auto row = results.begin(); row != results.end(); ++row) { 
		i = atoi(row[0]); 
		if (i < MAX_PP_SPELLBOOK){
			pp->spell_book[i] = atoi(row[1]); 
		} 
	} 
	return true;
}

Raw Paste Data