123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- <?php
- /**
- * Role.php UTF-8
- * 角色信息
- *
- * @date : 2018/1/19 15:44
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @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;
- }
- }
|