|
|
| actor_role (const actor_role &)=delete |
|
actor_role & | operator= (const actor_role &)=delete |
| | actor_role (i16_area aarea, i32_actordataid aroleid, const np_actorswitch_process_role *adata) |
| | 构造函数
|
|
virtual | ~actor_role () |
| | 析构函数
|
| virtual void | init () |
| | 初始化角色Actor组件
|
| virtual void | loaddb_finish (pbdb::ENUM_DB atype, enum_dbstat astat) |
| | 数据库加载完成后的回调
|
|
void | login_finish () |
| | 所有数据加载和同步完成后完成登录流程
|
| virtual i32_serverid | get_getwayserverid () |
| | 获取该角色的网关服务器ID
|
| virtual void | handle_after (handle_pram &) |
| | 执行消息处理后的逻辑,同步背包和属性变更到客户端
|
| virtual void | erase_actor_before () |
| | Actor被移除前调用的清理钩子
|
| i64_actorid | roleid () |
| | 获取角色ID
|
| drop< actor_role > & | get_drop () |
| | 获取掉落系统引用
|
|
void | update_attribute (EnumModule amodule, attribute_value &avalue) |
| | 设置指定模块的角色属性
|
|
void | sync_data_client () |
| | 同步所有数据到客户端
|
|
template<typename T> |
| ecross | forward_type (const T &adata) |
| | 消息的默认转发类型
|
|
ecross | forward_type (const pbnet::PROBUFF_NET_CHAT &adata) |
| | 聊天消息转发类型
|
|
ecross | forward_type (const pbnet::PROBUFF_NET_RANKLIST &adata) |
| | 排行榜转发类型
|
|
ecross | forward_type (const pbexample::PROBUFF_EXAMPLE_PLAY_JOIN &adata) |
| | 加入副本转发类型
|
|
ecross | forward_type (const pbexample::PROBUFF_EXAMPLE_PLAY_ENTER_EXAMPLE &adata) |
|
ecross | example_type () |
| | 获取副本转发类型
|
|
ecross | forward_type (const pbexample::PROBUFF_EXAMPLE_GUESS_NUMBER &adata) |
|
template<typename T> |
| bool | forward_before (const T &adata) |
| | 特定消息类型的转发前钩子
|
|
bool | forward_before (const pbnet::PROBUFF_NET_FAMIL_CREATE &adata) |
| | 创建公会前的转发前检查
|
|
template<typename T> |
| int32_t | forward_dataid (const T &adata) |
| | 获取消息的转发目标数据ID
|
|
int32_t | forward_dataid (const pbexample::PROBUFF_EXAMPLE_DEMO01_ENTER &adata) |
| | demo01进入地图:按地图ID路由到对应actor_demo01实例
|
|
int32_t | forward_dataid (const pbnet::PROBUFF_NET_PLAYER_INPUT &adata) |
| | 玩家输入:按地图ID路由到对应actor_demo01实例
|
|
int32_t | forward_dataid (const pbexample::PROBUFF_EXAMPLE_DEMO03_ENTER &adata) |
| | demo03进入地图:按地图ID路由到对应actor_demo03实例
|
|
int32_t | forward_dataid (const pbexample::PROBUFF_EXAMPLE_DEMO03_INPUT &adata) |
| | demo03玩家输入:按地图ID路由到对应actor_demo03实例
|
|
template<typename T> |
| nguid | forward_guid (ENUM_ACTOR aactor, ecross atype, nguid &aguid, const T &adata) |
|
template<ENUM_ACTOR ACTOR, typename T> |
| bool | handle_forward (const message< T > &adata) |
|
void | reset_logintime () |
| | 重置并更新每日登录时间
|
|
void | echo_msg (const char *amsg) |
| | 向客户端发送字符串消息
|
| int32_t | rechange (std::string &aorderid, int32_t arechargeid, bool agm, bool areporting) |
| | 执行充值
|
|
void | loginpay () |
| | 登录时请求待处理的支付
|
|
void | createorder (std::string &aorder, int32_t arechargeid) |
| | 创建充值订单
|
|
bool | is_first_recharge (int32_t arechargeid) |
| | 检查是否为首次充值
|
|
void | create_init (const std::string &aname) |
| | 初始化新创建的角色
|
|
bool | handle (const message< mforward< np_gm > > &adata) |
| | 处理GM消息转发
|
|
bool | handle (const message< mforward< np_operator_task > > &adata) |
| | 处理任务操作消息转发
|
|
bool | handle (const message< np_actor_disconnect_close > &adata) |
| | 处理断开连接关闭消息
|
|
bool | handle (const message< np_actor_senditem > &adata) |
| | 处理发送物品消息
|
|
bool | handle (const message< np_eevents_logic_rolelogin > &adata) |
| | 处理角色登录事件
|
|
bool | handle (const message< np_example_actorid > &adata) |
| | 处理副本ActorID消息
|
|
bool | handle (const message< pbnet::PROBUFF_NET_BAG_SYNC > &adata) |
| | 处理背包同步请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_CMD > &adata) |
| | 处理CMD协议消息
|
|
bool | handle (const message< pbnet::PROBUFF_NET_GET_TIME > &adata) |
| | 处理获取时间请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_RECHARGE > &adata) |
| | 处理充值请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_ROLE_CREATE > &adata) |
| | 处理角色创建请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_ROLE_SYNC > &adata) |
| | 处理角色同步请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_SWITCH_LINE > &adata) |
| | 处理切换线路请求
|
|
bool | handle (const message< pbnet::PROBUFF_NET_TASK_RECEIVE_AWARD > &adata) |
| | 处理任务领奖请求
|
|
bool | handle (const message< prorechange > &adata) |
| | 处理充值结果回调(由curl工作线程投递回本actor线程执行,避免悬垂this)
|
| template<typename TDerived> |
| void | init_rfun () |
| | 初始化消息分发器。
|
| | actor (const actorparm &aparm) |
| | 构造函数。
|
| actor_stat | activity_stat () final |
| | 获取调度器可见的生命周期状态。
|
| void | set_activity_stat (actor_stat astat) final |
| | 更新调度器可见的生命周期状态。
|
| void | release () final |
| | 停止actor,排空队列中的工作,并持久化DB支持的状态。
|
| bool | list_empty () final |
| | 检查普通队列和优先级队列是否都为空。
|
| bool | pending_empty () final |
| | 检查高优先级队列是否为空
|
| bool | high_empty () final |
| | 检查优先级队列是否为空。
|
| std::optional< int32_t > | hight_value () |
| | 获取当前最高优先级值。
|
| bool | push (handle_pram &apram) final |
| | 将传入任务入队到相应的优先级队列。
|
| bool | actor_handle (i32_threadid athreadid) final |
| | 在指定的工作线程上运行一个调度切片。
|
| template<typename T> |
| bool | ahandle (const std::shared_ptr< T > &aparm) |
| | 处理类型化消息。
|
| bool | ahandle (i32_threadid athreadid, handle_pram &aparm) |
| | 处理消息队列中的消息。
|
| virtual void | broadcast () |
| | 广播消息处理钩子。
|
| bool | handle_broadcast (const message< np_actor_broadcast > &adata) |
| | 合成广播消息的内部入口点。
|
| bool | handle_close (const message< np_actor_close > &) |
| | 合成关闭消息的内部入口点。
|
| template<typename TMESSAGE> |
| bool | handle_script (const message< TMESSAGE > &adata) |
| | 将类型化消息转发到附加的脚本运行时。
|
| | actor_base (const actorparmbase &aparm) |
| | Actor基类构造函数
|
|
nready & | ready () |
|
std::unique_ptr< nmanage_dbclient > & | manage_dbclient () |
|
void | set_db_component (ndb_component *acomponent) |
|
void | db_component_init_data () |
|
void | init_db_component (bool acreate) |
|
void | add_dbclient (ndbclient_base *adbclient, i64_actorid aid) |
|
template<pbdb::ENUM_DB DBTYPE, typename TDBTAB, typename TACTOR> |
| bool | handle_db (const message< np_actordb_load_response< DBTYPE, TDBTAB > > &adata) |
|
virtual void | save () |
|
bool | is_single () const |
|
const nguid & | guid () const |
|
i64_actorid | id_guid () const |
|
i32_actordataid | id () const |
|
i16_area | area () const |
|
ENUM_ACTOR | type () const |
|
virtual void | erase_actor () |
| | 从actor_manage中注销并销毁此Actor
|
|
bool | nscript_using () const |
|
bool | nscript_db_loadfinish () const |
|
template<typename T> |
| bool | nscript_data_push (const char *asource, const T &adata, bool aedit) |
|
template<typename T> |
| bool | nscript_data_del (int64_t adataid) |
|
template<typename T> |
| bool | nscript_data_checkout (int64_t adataid, T &adata) |
|
template<typename T> |
| bool | nscript_data_checkout (std::map< int64_t, T > &adata) |
|
template<typename T> |
| bool | nscript_data_checkdel (int64_t adataid) |
|
template<typename T> |
| bool | nscript_data_checkdel (std::vector< int64_t > &adeldata) |
|
template<typename T> |
| bool | nscript_handle (const T &adata) |
|
void | kcp_setindex (i32_serverid aserverid, pbnet::ENUM_KCP aenum, i16_port akcpindex) |
|
std::optional< i16_port > | kcp_index (i32_serverid aserverid, pbnet::ENUM_KCP aenum) |
|
std::optional< i16_port > | kcp_index (int16_t aservertid, int16_t atcount, pbnet::ENUM_KCP aenum) |
|
bool | kcp_connect (i16_port auport, const std::string &aip, i16_port aprot, i64_actorid aactoridserver, std::string &akcpsession) const |
| int64_t | set_timer (const np_timerparm &aparm) |
| | 为当前Actor设置定时器
|
|
bool | isbroadcast () const |
|
void | set_broadcast (bool aisbroadcast) |
|
template<typename T> |
| void | handle_print (const message< T > &adata) const |
|
| static ENUM_ACTOR | actor_type () |
| | 获取角色Actor的类型
|
| static i64_actorid | actorid (int32_t adata, i16_area aarea) |
| | 根据角色数据ID生成完整的ActorID
|
|
static void | nregister () |
| | 注册actor_role的消息处理器
|
| static void | requestgm (const char *aurl, const std::string &aparm, const std::function< void(int32_t, tools::http_parm &)> &acall) |
| | 发送GM操作的HTTP GET请求
|
| template<typename TDerived> |
| static void | register_timer (Tfun< TDerived, np_timerparm > afun=&TDerived::timer_handle) |
| | 注册定时器回调函数。
|
| template<typename TDerived, typename T> |
| static void | register_actor_s (const std::function< void(TDerived *, const message< T > &)> &afun) |
| | 注册基于std::function的消息处理器。
|
| template<typename TDerived, typename ... ARG> |
| static void | register_actor (ARG... afun) |
| | 注册一个或多个强类型消息处理器。
|
| template<typename TDerived, typename T> |
| static void | register_actornonet (const Tfun< TDerived, T > afun) |
| | 注册本地专用消息处理器(不来自网络协议分发)。
|
| template<typename TDerived, typename ... ARG> |
| static void | register_handle () |
| | 注册TDerived::handle作为消息处理器。
|
| template<typename TDerived, typename ... ARG> |
| static void | register_script_handle () |
| | 注册脚本支持的消息处理器。
|
| template<typename TDerived, typename ... ARG> |
| static void | register_forward_c2g () |
| | 注册客户端到网关的转发处理器。
|
| template<typename TDerived, typename ... ARG> |
| static void | register_forward_g2c () |
| | 注册网关到客户端的转发处理器。
|
| template<typename TDerived, ENUM_ACTOR ACTOR, typename ... ARG> |
| static void | register_secondary_forward_c2g () |
| | 注册中继actor的二级转发辅助器。
|
|
static void | erase_actor (const nguid &aguid) |
|
static std::shared_ptr< pack > | jsonpack (const std::string &apbname, const std::string &ajson, i64_actorid aactorid, i64_actorid arequestactorid, bool ahead=false) |
|
template<typename T> |
| static std::shared_ptr< pack > | net_pack (T &adata, i64_actorid aactorid, i64_actorid arequestactorid, bool ahead=false) |
|
static bool | send_pack (i32_sessionid asession, std::shared_ptr< pack > &apack) |
|
template<typename T> |
| static bool | send (i32_sessionid asession, const T &adata, i64_actorid aactorid, i64_actorid arequestactorid) |
|
template<typename T> |
| static bool | send_server (i32_serverid aserverid, const T &adata, i64_actorid aactorid, i64_actorid arequestactorid) |
|
template<typename T> |
| static bool | send_server (const std::set< i32_serverid > &aserverids, const T &adata, i64_actorid aactorid, i64_actorid arequestactorid) |
|
static bool | send_server (i32_serverid aserverid, std::shared_ptr< pack > &apack) |
|
static bool | kcp_sendpack (i64_actorid aactorid, std::shared_ptr< pack > &adata, i16_port auport=0) |
|
static bool | kcp_sendpack (const std::set< i64_actorid > &aactorids, std::shared_ptr< pack > &adata, i16_port auport=0) |
| template<typename T> |
| static bool | kcp_send (i64_actorid aactorid, const T &adata, i16_port auport=0) |
| | 向单个Actor发送KCP数据(actor_base模板实现)。
|
| template<typename T> |
| static bool | kcp_send (const std::set< i64_actorid > &aactorids, const T &adata, i16_port auport=0) |
| | 向一组Actor广播KCP数据(actor_base模板实现)。
|
|
static i64_actorid | actorclient_guid () |
|
template<typename T> |
| static void | send_client (const std::set< i64_actorid > &aids, const T &adata, ENET_PROTOCOL aprotocol=ENET_TCP) |
|
template<typename T> |
| static void | send_client (i64_actorid aid, const T &adata, ENET_PROTOCOL aprotocol=ENET_TCP) |
|
template<typename T> |
| static void | send_client (const std::vector< i64_actorid > &aids, const T &adata, ENET_PROTOCOL aprotocol=ENET_TCP) |
|
template<typename T> |
| static void | send_client (const T &adata, ENET_PROTOCOL aprotocol=ENET_TCP) |
|
template<typename T> |
| static void | send_clientbyarea (i16_area aarea, const T &adata, ENET_PROTOCOL aprotocol=ENET_TCP) |
| static void | send_actor (const nguid &aguid, const std::shared_ptr< pack > &adata) |
| | 向指定Actor发送消息包
|
|
template<typename T, bool IS_SEND = true> |
| static void | send_actor (ENUM_ACTOR atype, const std::shared_ptr< T > &adata) |
|
template<typename T, bool IS_SEND = true> |
| static void | send_actor (const nguid &aguid, const nguid &arequestguid, const std::shared_ptr< T > &adata) |
|
template<typename T, bool IS_SEND = true> |
| static void | send_actor (const nguid &aguid, const nguid &arequestguid, const std::shared_ptr< T > &adata, const std::function< void()> &afailfun) |
|
template<typename T, bool IS_SEND = true> |
| static void | send_actor (const std::set< i64_actorid > &asetguid, const nguid &arequestguid, const std::shared_ptr< T > &adata) |
| static void | start_broadcast () |
| | 启动全局广播定时器
|
|
template<typename TDerived> |
| static void | first_nregister (ENUM_ACTOR atype) |
| template<typename TACTOR, typename ... ARG> |
| static std::shared_ptr< actor_base > | create (i16_area aarea, i32_actordataid aid, ARG &&... args) |
| | actor工厂方法(编译期类型)
|
|
template<typename ... ARG> |
| static std::map< ENUM_ACTOR, create_fun< ARG... > > & | creators () |
|
template<ENUM_ACTOR EACTOR, typename TACTOR, typename ... ARG> |
| static void | cregister () |
| template<typename ... ARG> |
| static std::shared_ptr< actor_base > | create (ENUM_ACTOR atype, i16_area aarea, i32_actordataid aid, ARG &&... args) |
| | actor工厂方法(运行时类型,查分桶表转调编译期create<TACTOR>)
|
玩家角色Actor
每个在线玩家一个实例,拥有所有玩家状态和逻辑子模块,包括背包、任务、属性等系统