Horizon Official Technical Documentation
NPCComponent.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
11 * Copyright (c) 2019 Horizon Dev Team.
12 *
13 * Base Author - Sagun K. (sagunxp@gmail.com)
14 *
15 * This library is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this library. If not, see <http://www.gnu.org/licenses/>.
27 **************************************************/
28
29#ifndef HORIZON_ZONE_NPC_LUA_COMPONENT_HPP
30#define HORIZON_ZONE_NPC_LUA_COMPONENT_HPP
31
35
36namespace Horizon
37{
38namespace Zone
39{
40class GameLogicProcess;
42{
43public:
45 NPCComponent(std::shared_ptr<GameLogicProcess> container) : LUAComponent(container) { }
47
48 void sync_definitions(std::shared_ptr<sol::state> state);
49 void sync_data_types(std::shared_ptr<sol::state> state);
50 void sync_functions(std::shared_ptr<sol::state> state);
51
52 void add_npc_to_db(uint32_t guid, std::shared_ptr<npc_db_data> const &data) { _npc_db.insert(guid, data); }
53 std::shared_ptr<npc_db_data> get_npc_from_db(uint32_t guid) { return _npc_db.at(guid); }
54
55 void contact_npc_for_player(std::shared_ptr<Units::Player> player, uint32_t npc_guid);
56 void continue_npc_script_for_player(std::shared_ptr<Units::Player> player, uint32_t npc_guid, uint32_t select_idx = 0);
57
58 // void send_dialog_to_player(std::shared_ptr<Units::Player> player, uint32_t npc_guid, std::string const &HLog);
59 // void send_next_dialog_to_player(std::shared_ptr<Units::Player> player, uint32_t npc_guid);
60 // void send_close_dialog_to_player(std::shared_ptr<Units::Player> player, uint32_t npc_guid);
61
63};
64}
65}
66
67#endif /* HORIZON_ZONE_NPC_LUA_COMPONENT_HPP */
Definition: LUAComponent.hpp:40
Definition: NPCComponent.hpp:42
std::shared_ptr< npc_db_data > get_npc_from_db(uint32_t guid)
Definition: NPCComponent.hpp:53
void add_npc_to_db(uint32_t guid, std::shared_ptr< npc_db_data > const &data)
Definition: NPCComponent.hpp:52
void sync_data_types(std::shared_ptr< sol::state > state)
Definition: NPCComponent.cpp:45
void sync_definitions(std::shared_ptr< sol::state > state)
Definition: NPCComponent.cpp:41
~NPCComponent()
Definition: NPCComponent.hpp:46
void sync_functions(std::shared_ptr< sol::state > state)
Definition: NPCComponent.cpp:56
NPCComponent(std::shared_ptr< GameLogicProcess > container)
Definition: NPCComponent.hpp:45
void contact_npc_for_player(std::shared_ptr< Units::Player > player, uint32_t npc_guid)
Definition: NPCComponent.cpp:202
LockedLookupTable< uint32_t, std::shared_ptr< npc_db_data > > _npc_db
Definition: NPCComponent.hpp:62
NPCComponent()
Definition: NPCComponent.hpp:44
void continue_npc_script_for_player(std::shared_ptr< Units::Player > player, uint32_t npc_guid, uint32_t select_idx=0)
Definition: NPCComponent.cpp:222
Definition: LockedLookupTable.hpp:44
void insert(const Key &key, const Value &value)
Definition: LockedLookupTable.hpp:68
Value at(Key const &key, Value const &default_value=Value()) const
Definition: LockedLookupTable.hpp:63
Definition: Element.hpp:7