* @version : HUOSDK 8.0 */ namespace huo\controller\request; class Role { private $event = 0; /* 角色上传事件类型 5 */ private $server_id = ''; /* 游戏服务器id, */ private $server_name = ''; /* 游戏服务器名称 */ private $role_id = ''; /* 玩家角色id */ private $role_name = ''; /* 玩家角色名称 */ private $role_level = 0; /* 玩家角色等级 */ private $role_vip = 0; /* 玩家vip等级 */ private $combat_num = 0; /* 玩家角色战力 */ private $onlineTime = 0; /* 本次在线时长(单位:秒) */ private $scene = ''; /* 登出场景 */ private $axis = ''; /* 登出时所在场景坐标, 应该是 (x,y,z)的形式 */ private $last_operation = ''; /* 登出前角色最后一次操作或者完成的玩法 */ private $experience = ''; /* 经验 */ private $party_name = ''; /* 工会、帮派名称 */ private $role_balance = ''; /* 用户游戏币余额 */ private $attach = ''; /* 扩展信息 */ private $rolelevel_ctime = ''; /* 角色创建时间 */ private $rolelevel_mtime = ''; /* 角色升级时间 */ private $last_login_time = 0; /* 最近登陆时间 */ public function __construct($data = []) { if (!empty($data)) { $this->setData($data); } } /** * 设置数据 * * @param array $data */ public function setData($data = []) { if (empty($data)) { return; } $this->setEvent(get_val($data, 'event', 0)); $this->setServerId(get_val($data, 'server_id')); $this->setServerName(get_val($data, 'server_name')); $this->setRoleId(get_val($data, 'role_id')); $this->setRoleName(get_val($data, 'role_name')); $this->setRoleLevel(get_val($data, 'role_level', 0)); $this->setRoleVip(get_val($data, 'role_vip', 0)); $this->setCombatNum(get_val($data, 'combat_num', 0)); $this->setLastLoginTime(get_val($data, 'list_login_time', 0)); $this->setOnlineTime(get_val($data, 'onlineTime', 0)); $this->setScene(get_val($data, 'scene')); $this->setAxis(get_val($data, 'axis')); $this->setLastOperation(get_val($data, 'last_operation')); $this->setExperience(get_val($data, 'last_operation', 0)); $this->setPartyName(get_val($data, 'party_name', 0)); $this->setRoleBalance(get_val($data, 'role_balance', 0)); $this->setAttach(get_val($data, 'attach', 0)); $this->setRolelevelCtime(get_val($data, 'rolelevel_ctime', 0)); $this->setRolelevelMtime(get_val($data, 'rolelevel_mtime', 0)); } /** * @return int */ public function getEvent() { return $this->event; } /** * @param int $event */ public function setEvent($event) { if (is_numeric($event)) { $this->event = $event; } else { switch ($event) { case 'online': /* 角色登录 */ $this->event = 1; break; case 'create': /* 创建角色 */ $this->event = 2; break; case 'levelup': /* 提升等级 */ $this->event = 3; break; case 'offline': /* 角色退出 */ $this->event = 4; break; case 'delete': /* 其他 */ $this->event = 6; break; default: /* 其他 */ $this->event = 5; } } } /** * @return string */ public function getServerId() { return $this->server_id; } /** * @param string $server_id */ public function setServerId($server_id) { $this->server_id = $server_id; } /** * @return string */ public function getServerName() { return $this->server_name; } /** * @param string $server_name */ public function setServerName($server_name) { $this->server_name = $server_name; } /** * @return string */ public function getRoleId() { return $this->role_id; } /** * @param string $role_id */ public function setRoleId($role_id) { $this->role_id = $role_id; } /** * @return string */ public function getRoleName() { return $this->role_name; } /** * @param string $role_name */ public function setRoleName($role_name) { $this->role_name = $role_name; } /** * @return int */ public function getRoleLevel() { return $this->role_level; } /** * @param int $role_level */ public function setRoleLevel($role_level) { $this->role_level = $role_level; } /** * @return int */ public function getRoleVip() { return $this->role_vip; } /** * @param int $role_vip */ public function setRoleVip($role_vip) { $this->role_vip = $role_vip; } /** * @return int */ public function getCombatNum() { return $this->combat_num; } /** * @param int $combat_num */ public function setCombatNum($combat_num) { $this->combat_num = $combat_num; } /** * @return int */ public function getLastLoginTime() { return $this->last_login_time; } /** * @param int $last_login_time */ public function setLastLoginTime($last_login_time) { $this->last_login_time = $last_login_time; } /** * @return int */ public function getOnlineTime() { return $this->onlineTime; } /** * @param int $onlineTime */ public function setOnlineTime($onlineTime) { $this->onlineTime = $onlineTime; } /** * @return string */ public function getScene() { return $this->scene; } /** * @param string $scene */ public function setScene($scene) { $this->scene = $scene; } /** * @return string */ public function getAxis() { return $this->axis; } /** * @param string $axis */ public function setAxis($axis) { $this->axis = $axis; } /** * @return string */ public function getLastOperation() { return $this->last_operation; } /** * @param string $last_operation */ public function setLastOperation($last_operation) { $this->last_operation = $last_operation; } /** * @return string */ public function getExperience() { return $this->experience; } /** * @param string $experience */ public function setExperience($experience) { $this->experience = $experience; } /** * @return string */ public function getPartyName() { return $this->party_name; } /** * @param string $party_name */ public function setPartyName($party_name) { $this->party_name = $party_name; } /** * @return string */ public function getRoleBalance() { return $this->role_balance; } /** * @param string $role_balance */ public function setRoleBalance($role_balance) { $this->role_balance = $role_balance; } /** * @return string */ public function getAttach() { return $this->attach; } /** * @param string $attach */ public function setAttach($attach) { $this->attach = $attach; } /** * @return string */ public function getRolelevelCtime() { return $this->rolelevel_ctime; } /** * @param string $rolelevel_ctime */ public function setRolelevelCtime($rolelevel_ctime) { $this->rolelevel_ctime = $rolelevel_ctime; } /** * @return string */ public function getRolelevelMtime() { return $this->rolelevel_mtime; } /** * @param string $rolelevel_mtime */ public function setRolelevelMtime($rolelevel_mtime) { $this->rolelevel_mtime = $rolelevel_mtime; } public function toArray() { $_data['server_id'] = $this->getServerId(); $_data['server_name'] = $this->getServerName(); $_data['role_id'] = $this->getRoleId(); $_data['role_name'] = $this->getRoleName(); $_data['role_level'] = $this->getRoleLevel(); $_data['role_vip'] = $this->getRoleVip(); $_data['online_time'] = $this->getOnlineTime(); $_data['scene'] = $this->getScene(); $_data['axis'] = $this->getAxis(); $_data['last_operation'] = $this->getLastOperation(); $_data['type'] = $this->getEvent(); $_data['last_operation'] = $this->getExperience(); $_data['party_name'] = $this->getPartyName(); $_data['role_balance'] = $this->getRoleBalance(); $_data['attach'] = $this->getAttach(); $_data['rolelevel_ctime'] = $this->getRolelevelCtime(); $_data['rolelevel_mtime'] = $this->getRolelevelMtime(); return $_data; } }