<commit_before>/*
 * Copyright (c) 2013 <NAME> (<EMAIL>)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

#include <iostream>
#include <string>
#include <vector>

#include <boost/format.hpp>

#include <pkmnsim/enums.hpp>
#include <pkmnsim/item.hpp>
#include <pkmnsim/paths.hpp>
#include <pkmnsim/database/queries.hpp>

#include "item_impl.hpp"
#include "item_berryimpl.hpp"
#include "item_machineimpl.hpp"

#include "SQLiteCpp/src/SQLiteC++.h"

using namespace std;

namespace pkmnsim
{
    item::sptr item::make(unsigned int id, unsigned int game)
    {
        if(id >= Items::TM01 and id <= Items::HM08)
        {
            return sptr(new item_machineimpl(id, game));
        }
        else if((id >= Items::CHERI_BERRY and id <= Items::ROWAP_BERRY)
                or (id >= Items::BERRY and id <= Items::MYSTERYBERRY))
        {
            return sptr(new item_berryimpl(id, game));
        }
        else return sptr(new item_impl(id, game));
    }
    
    item_impl::item_impl(unsigned int id, unsigned int game): item()
    {
        _item_id = id;
        _game_id = game;
        _category_id = database::get_item_category(_item_id);
        _game_index = database::get_item_index(_item_id, _game_id);
        _description = database::get_item_description(_item_id, _game_id);
        _item_name = database::get_item_name(_item_id);
    }
    
    unsigned int item_impl::get_game_id() {return _item_id;}
    
    unsigned int item_impl::get_category_id() {return _category_id;}
    
    string item_impl::get_category_name()
    {
        SQLite::Database db(get_database_path().c_str());
        string query_string = "SELECT name FROM item_category_prose "<commit_msg>item: allowed new Gen 6 TM's to use TM/HM item implementation<commit_after>/*
 * Copyright (c) 2013 <NAME> (<EMAIL>)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

#include <iostream>
#include <string>
#include <vector>

#include <boost/format.hpp>

#include <pkmnsim/enums.hpp>
#include <pkmnsim/item.hpp>
#include <pkmnsim/paths.hpp>
#include <pkmnsim/database/queries.hpp>

#include "item_impl.hpp"
#include "item_berryimpl.hpp"
#include "item_machineimpl.hpp"

#include "SQLiteCpp/src/SQLiteC++.h"

using namespace std;

namespace pkmnsim
{
    item::sptr item::make(unsigned int id, unsigned int game)
    {
        if((id >= Items::TM01 and id <= Items::HM08)
           or (id >= Items::TM93 and id <= Items::TM95)
           or (id >= Items::TM96 and id <= Items::TM100))
        {
            return sptr(new item_machineimpl(id, game));
        }
        else if((id >= Items::CHERI_BERRY and id <= Items::ROWAP_BERRY)
                or (id >= Items::BERRY and id <= Items::MYSTERYBERRY))
        {
            return sptr(new item_berryimpl(id, game));
        }
        else return sptr(new item_impl(id, game));
    }
    
    item_impl::item_impl(unsigned int id, unsigned int game): item()
    {
        _item_id = id;
        _game_id = game;
        _category_id = database::get_item_category(_item_id);
        _game_index = database::get_item_index(_item_id, _game_id);
        _description = database::get_item_description(_item_id, _game_id);
        _item_name = database::get_item_name(_item_id);
    }
    
    unsigned int item_impl::get_game_id() {return _item_id;}
    
    unsigned int item_impl::get_category_id() {return _category_id;}
    
    string item_impl::get_category_name()
    {
        SQLite::Database db(get_database_path().c_str());
        string query_string = "SELECT name FROM item_category_prose "
{'fraction_non_alphanumeric': 0.12644917767592342, 'fraction_numerical': 0.00700997573469938, 'mean_word_length': 3.2351598173515983, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6093007', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1245, 'n_words': 276}