├── public ├── favicon.ico ├── images │ ├── 11.jpg │ ├── logo.png │ ├── tan.gif │ ├── wen.gif │ ├── first.png │ ├── favicon-16x16.png │ └── favicon-32x32.png └── js │ └── footer.js ├── .gitignore ├── game ├── DisplayException.php ├── RedirectException.php ├── bootstrap.php ├── EncoderInterface.php ├── Combat │ ├── EffectInterface.php │ ├── Shortcuts.php │ ├── Item.php │ ├── Skill.php │ ├── PetAttacker.php │ ├── MonsterAttacker.php │ ├── PlayerAttacker.php │ └── Shortcut.php ├── Handlers │ ├── VIP.php │ ├── Im.php │ ├── Yaopin.php │ ├── Admin │ │ ├── Condition.php │ │ └── Area.php │ ├── Guaiwu.php │ ├── Relationship.php │ └── Rank.php ├── Job │ ├── Cron │ │ ├── TruncateCmdHistory.php │ │ └── DeleteCombat.php │ ├── BaseJob.php │ ├── LootExpAndMoney.php │ ├── CheckTaskMonsterCondition.php │ ├── CheckPlayerOnlineStatus.php │ └── LootItem.php ├── Task │ ├── DeleteCombatTask.php │ ├── TruncateCmdHistoryTask.php │ ├── Heap.php │ ├── AbstractTask.php │ └── Runner.php ├── resque.php ├── DB │ ├── RedisPool.php │ └── MedooPool.php ├── Lock.php ├── Player │ ├── Effects.php │ └── PrivateItem.php ├── Layer.php ├── Object │ ├── FromArrayTrait.php │ ├── PlayerParty.php │ ├── CombatStatus.php │ ├── PlayerPartyMember.php │ └── Location.php ├── TimeCost.php ├── Condition.php ├── Collection.php ├── SessionHandler.php ├── SessionEncoder.php └── rr_worker.php ├── README.md ├── templates ├── includes │ ├── club.php │ ├── pvp.php │ ├── footer.php │ ├── tupo.php │ ├── gonowmid.php │ ├── resources.php │ └── message.php ├── maintenance.php ├── locked.php ├── npc │ ├── heal.php │ ├── fuzhuan.php │ ├── yaopin.php │ ├── menpai.php │ ├── peifang.php │ └── conversation.php ├── boss_info.php ├── rank.php ├── about.php ├── cj.php ├── club_list.php ├── pvp_log.php ├── zbinfo_sys.php ├── party │ ├── creation_form.php │ ├── party.php │ └── member.php ├── ornament.php ├── ranks │ ├── level.php │ └── fortune.php ├── shortcuts │ ├── select_item.php │ ├── select_skill.php │ └── show_combat_condition.php ├── activity │ ├── list.php │ ├── qiandao.php │ └── redeem_code.php ├── duihuan.php ├── map.php ├── bag │ ├── peifang.php │ ├── yaopin.php │ └── zhuangbei.php ├── fangshi_zhuangbei.php ├── vip_advantage.php ├── show_shengxing_material.php ├── fangshi_daoju.php ├── liaotian.php ├── zhuangtai.php ├── tutorial.php ├── jninfo.php ├── qianghua_list.php ├── shengxing_list.php ├── select_equip.php ├── player_skill_info.php ├── player_task.php ├── show_qianghua_material.php ├── allmap.php ├── admin │ ├── show_connections.php │ ├── area_list.php │ ├── show_create_loc.php │ ├── show_update_loc.php │ ├── condition_list.php │ ├── npc_list.php │ ├── ornament_list.php │ ├── monster_list.php │ ├── operation_list.php │ ├── show_create_npc.php │ ├── show_create_condition.php │ ├── ornament.php │ └── show_create_area.php ├── chongwu │ └── ronghe.php ├── friends.php ├── npc.php ├── index.php ├── pfinfo.php ├── pve_log.php ├── register.php ├── cwinfo.php ├── layout.php ├── ginfo.php ├── show_equips.php ├── player_skills.php ├── search.php ├── tupo.php ├── chongwu.php ├── combat │ ├── select_item.php │ └── select_skill.php ├── xiulian.php ├── ypinfo.php ├── shortcuts.php ├── market │ └── item_list.php ├── other_zhuangtai.php ├── pvp_bak.php ├── club.php ├── djinfo.php ├── zbinfo.php └── sys_djinfo.php ├── bin ├── leak.sh └── resque ├── configs ├── supervisor.conf ├── config-example.json ├── rr.yaml └── resque-example.yml ├── LICENSE_zh-CN ├── composer.json ├── third └── Workerman │ ├── Db │ ├── MysqlPool.php │ ├── RedisPool.php │ └── MedooPool.php │ ├── Protocols │ ├── Http │ │ ├── Chunk.php │ │ └── ServerSentEvents.php │ ├── Frame.php │ ├── ProtocolInterface.php │ └── Text.php │ └── Autoloader.php └── LICENSE /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | configs/config.json 2 | configs/resque.yml 3 | vendor/ 4 | .idea/ 5 | storage/ 6 | -------------------------------------------------------------------------------- /public/images/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/11.jpg -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/logo.png -------------------------------------------------------------------------------- /public/images/tan.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/tan.gif -------------------------------------------------------------------------------- /public/images/wen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/wen.gif -------------------------------------------------------------------------------- /public/images/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/first.png -------------------------------------------------------------------------------- /public/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/favicon-16x16.png -------------------------------------------------------------------------------- /public/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zither/opencq/HEAD/public/images/favicon-32x32.png -------------------------------------------------------------------------------- /game/DisplayException.php: -------------------------------------------------------------------------------- 1 | 2 | 天地不仁  修道即修盗
3 | 大道不止  大盗路不止
4 | 想要盗出仙路  一人..太难..
-------------------------------------------------------------------------------- /templates/includes/pvp.php: -------------------------------------------------------------------------------- 1 |
2 | 正在攻击你:还击 3 |
4 | -------------------------------------------------------------------------------- /templates/includes/footer.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /bin/leak.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | USE_ZEND_ALLOC=0 valgrind --leak-check=full --show-reachable=yes --track-origins=yes --log-file=/tmp/leak.log php -d extension=swow game/swow_worker.php 4 | -------------------------------------------------------------------------------- /game/bootstrap.php: -------------------------------------------------------------------------------- 1 | 2 | 你感觉修炼遇到了瓶颈,需要尝试突破,否则不能继续获得修为: 3 | 4 | 突破 5 | 6 | -------------------------------------------------------------------------------- /game/EncoderInterface.php: -------------------------------------------------------------------------------- 1 | display('vip_advantage'); 11 | } 12 | } -------------------------------------------------------------------------------- /game/Job/Cron/TruncateCmdHistory.php: -------------------------------------------------------------------------------- 1 | db->query('truncate cmd_history'); 11 | } 12 | } -------------------------------------------------------------------------------- /bin/resque: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -f "bin/resque" ]; then 3 | if [ -z "$1" ]; then 4 | vendor/bin/resque work:start -c configs/resque.yml 5 | else 6 | vendor/bin/resque "$1" -c configs/resque.yml 7 | fi 8 | else 9 | echo "Please run in ROOT directory" 10 | fi -------------------------------------------------------------------------------- /configs/supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:resque] 2 | directory=/www/newcq 3 | command=/www/newcq/vendor/bin/resque worker:start -c /www/newcq/configs/resque.yml 4 | user=www-data 5 | autostart=true 6 | autorestart=true 7 | stderr_logfile=/var/log/resque.err.log 8 | stdout_logfile=/var/log/resque.out.log 9 | -------------------------------------------------------------------------------- /game/Task/DeleteCombatTask.php: -------------------------------------------------------------------------------- 1 | push(DeleteCombat::class, []); 12 | } 13 | } -------------------------------------------------------------------------------- /game/Task/TruncateCmdHistoryTask.php: -------------------------------------------------------------------------------- 1 | push(TruncateCmdHistory::class, []); 12 | } 13 | } -------------------------------------------------------------------------------- /game/Combat/Shortcuts.php: -------------------------------------------------------------------------------- 1 | type === Attacker::TYPE_PLAYER) { 15 | 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /templates/includes/gonowmid.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 返回上级
4 | 5 | 6 | 返回游戏 7 | 8 |
-------------------------------------------------------------------------------- /LICENSE_zh-CN: -------------------------------------------------------------------------------- 1 | GLWT(Good Luck With That,祝你好运)公共许可证 2 | 版权所有© 每个人,除了作者 3 | 4 | 任何人都被允许复制、分发、修改、合并、销售、出版、再授权或 5 | 任何其它操作,但风险自负。 6 | 7 | 作者对这个项目中的代码一无所知。 8 | 代码处于可用或不可用状态,没有第三种情况。 9 | 10 | 11 | 祝你好运公共许可证 12 | 复制、分发和修改的条款和条件 13 | 14 | 0 :在不导致作者被指责或承担责任的情况下,你可以做任何你想 15 | 要做的事情。 16 | 17 | 无论是在合同行为、侵权行为或其它因使用本软件产生的情形,作 18 | 者不对任何索赔、损害承担责任。 19 | 20 | 祖宗保佑。 21 | -------------------------------------------------------------------------------- /game/Task/Heap.php: -------------------------------------------------------------------------------- 1 | timestamp < $value2->timestamp) { 11 | return 1; 12 | } 13 | if ($value1->timestamp == $value2->timestamp) { 14 | return 0; 15 | } 16 | return -1; 17 | } 18 | } -------------------------------------------------------------------------------- /templates/maintenance.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 | 3 |
4 |
5 | [通知] 6 |
7 |
8 | 13 |
14 |
-------------------------------------------------------------------------------- /configs/config-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_server": "php-fpm", 3 | "db_host": "localhost", 4 | "db_database": "game", 5 | "db_user": "root", 6 | "db_password": "root", 7 | "redis_host": "127.0.0.1", 8 | "redis_port": 6379, 9 | "redis_password": "123456", 10 | "debug": 0, 11 | "link_encoder": "session", 12 | "link_encoder_secret": "REPLACE_THIS_WITH_RANDOM_CHARS_IN_PRODUCTION_ENV", 13 | "is_under_maintenance": 0, 14 | "admin_id": 1 15 | } -------------------------------------------------------------------------------- /templates/locked.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [错误] 8 |
9 |
10 |

刷新过快,请设置至少1秒延时。

11 | 继续操作 12 |
13 | 14 |
-------------------------------------------------------------------------------- /templates/npc/heal.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |

name?>

7 |

性别: sex?>

8 |

info?>

9 |
10 | 生命恢复需要金币(没有金币不收费)
11 |
12 | insert('includes/gonowmid');?> 13 |
14 | 15 | -------------------------------------------------------------------------------- /game/Job/Cron/DeleteCombat.php: -------------------------------------------------------------------------------- 1 | db->delete('pve_logs', ['created_at[<]' => $timestamp]); 14 | $this->db->delete('combat', ['is_end' => true, 'updated_at[<]' => $timestamp]); 15 | } 16 | } -------------------------------------------------------------------------------- /templates/includes/resources.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

你认真的搜寻了下周围,找到了:

4 | 5 | 6 | getMessage('message');?> 7 | 8 | 9 |

什么也没有找到,空手而归。

10 | 11 |
12 | -------------------------------------------------------------------------------- /templates/boss_info.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
[ bossname?> ]
5 | bossinfo?>
6 |
7 | 战斗 8 |
9 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 10 |
11 | 12 | -------------------------------------------------------------------------------- /game/resque.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ 排行榜 ]
7 | -
8 | 9 |
10 | 等级榜 . 财富榜 11 |
12 | -
13 | insert('includes/gonowmid', ['show_prev' => false]);?> 14 |
-------------------------------------------------------------------------------- /templates/about.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [联系] 8 |
9 |
10 | 15 |
16 | insert('includes/gonowmid', ['show_prev' => false]);?> 17 |
-------------------------------------------------------------------------------- /templates/cj.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 | 角色名称: 7 |

8 |

9 | 10 |

11 | 12 |
13 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "autoload": { 3 | "psr-4": { 4 | "Xian\\": "game", 5 | "Workerman\\": "third/Workerman" 6 | } 7 | }, 8 | "require": { 9 | "league/plates": "^3.3", 10 | "catfan/medoo": "^1.7", 11 | "mjphaynes/php-resque": "2.1.*", 12 | "ext-json": "*", 13 | "ext-mbstring": "*", 14 | "ext-openssl": "*", 15 | "ext-pdo": "*", 16 | "spiral/roadrunner": "^1.8", 17 | "hansott/psr7-cookies": "^3.0", 18 | "uma/redis-session-handler": "^0.9.7", 19 | "ext-redis": "*", 20 | "swow/swow": "dev-develop" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /templates/club_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | 门派天榜 7 | ] 8 |
9 | 14 | insert('includes/message'); ?> 15 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 16 |
-------------------------------------------------------------------------------- /templates/npc/fuzhuan.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |

昵称:name?>

5 |

性别:sex?>

6 |

信息:info?>

7 |
8 |
========兑换列表========
9 | $v): ?> 10 |
11 | [] 12 |
13 | 14 |
15 | insert('includes/message'); ?> 16 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 17 |
-------------------------------------------------------------------------------- /templates/pvp_log.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 | 战斗结果
5 | name?> 攻击了 name?>
6 | resultType == 1): ?> 7 | 成功击杀 8 | resultType == 2) :?> 9 | 被反杀了 10 | resultType == 3) :?> 11 | 自己却逃跑了 12 | resultType == 4) :?> 13 | 对方却逃跑了 14 | 15 | insert('includes/message'); ?> 16 |
17 | 返回游戏 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /templates/zbinfo_sys.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | zbname?> 7 | ] 8 |
9 | 装备攻击:zbgj?>
10 | 装备防御:zbfy?>
11 | 增加气血:zbhp?>
12 | 装备暴击:zbbj?>%
13 | 装备吸血:zbxx?>%
14 | 装备信息:zbinfo?>

15 | 提示:装备不限制种类!

16 | insert('includes/message'); ?> 17 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 18 |
-------------------------------------------------------------------------------- /templates/party/creation_form.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [创建队伍] 8 |
9 |
10 |
" method="POST"> 11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 | insert('includes/gonowmid', ['show_prev' => false]);?> 19 |
-------------------------------------------------------------------------------- /game/Task/AbstractTask.php: -------------------------------------------------------------------------------- 1 | duration = $duration; 29 | $this->timestamp = $timestamp; 30 | $this->isOnce = $isOnce; 31 | } 32 | 33 | abstract public function run(ResqueClient $client); 34 | } -------------------------------------------------------------------------------- /templates/npc/yaopin.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |

name?>

7 |

性别:sex?>

8 |

info?>

9 |
10 | 11 |
12 | ">(金币) 13 | ">购买 14 |
15 | 16 |
17 | insert('includes/gonowmid');?> 18 |
-------------------------------------------------------------------------------- /templates/ornament.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | 7 | ] 8 |
9 |
10 | 11 |
12 | 17 | 18 | insert('includes/message'); ?> 19 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 20 |
21 | 22 | -------------------------------------------------------------------------------- /templates/ranks/level.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 等级排行 ] 8 |
9 |
10 | 17 |
18 | insert('includes/gonowmid');?> 19 |
-------------------------------------------------------------------------------- /templates/shortcuts/select_item.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 物品选择 ] 6 |
7 |
8 | -
9 | 16 | -
17 |
18 | insert('includes/message'); ?> 19 | insert('includes/gonowmid');?> 20 |
-------------------------------------------------------------------------------- /templates/activity/list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ 礼包 ]
7 |
8 | 13 |
14 | insert('includes/gonowmid', ['show_prev' => false]);?> 15 |
-------------------------------------------------------------------------------- /third/Workerman/Db/MysqlPool.php: -------------------------------------------------------------------------------- 1 | config['host'], $this->config['port'], $this->config['username'], $this->config['password'], $this->config['db_name']); 12 | // if ($db->connected == false) { 13 | // dd("createDb error : " . $db->connect_error); 14 | // return false; 15 | // } 16 | return $db; 17 | } 18 | 19 | protected function checkDb($db) 20 | { 21 | return true; 22 | // return $db->connected; 23 | } 24 | 25 | protected function closeDb($db) 26 | { 27 | $db->closeConnection(); 28 | // return $db->connected; 29 | } 30 | } -------------------------------------------------------------------------------- /templates/shortcuts/select_skill.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 技能选择 ] 6 |
7 |
8 | -
9 | 16 | -
17 |
18 | insert('includes/message'); ?> 19 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 20 |
-------------------------------------------------------------------------------- /templates/npc/menpai.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |

昵称:name?>

5 |

性别:sex?>

6 |

信息:info?>

7 |
8 |
9 |
门派大名:
10 |
11 | 12 |
13 |
14 | insert('includes/message'); ?> 15 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 16 |
-------------------------------------------------------------------------------- /game/DB/RedisPool.php: -------------------------------------------------------------------------------- 1 | $this->config['scheme'], 12 | 'host' => $this->config['host'], 13 | 'port' => $this->config['port'], 14 | 'password' => $this->config['auth'], 15 | ]; 16 | $redis = new Client($params); 17 | $redis->connect(); 18 | return $redis; 19 | } 20 | 21 | protected function checkDb($db) 22 | { 23 | /** @var Client $db */ 24 | return $db->isConnected(); 25 | } 26 | 27 | protected function closeDb($db) 28 | { 29 | /** @var Client $db */ 30 | $db->disconnect(); 31 | unset($db); 32 | } 33 | } -------------------------------------------------------------------------------- /templates/ranks/fortune.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 财富排行 ] 8 |
9 |
10 | 18 |
19 | insert('includes/gonowmid');?> 20 |
-------------------------------------------------------------------------------- /game/Lock.php: -------------------------------------------------------------------------------- 1 | session = $session; 14 | } 15 | 16 | public function acquire() 17 | { 18 | $releaseTime = empty($this->session['vip']) ? 0.7 : 0.5; 19 | $now = microtime(true); 20 | if (empty($this->session['lock']) || ($now + $this->session['lock'] >= $releaseTime)) { 21 | $this->session['lock'] = -$now; 22 | return false; 23 | } 24 | return true; 25 | } 26 | 27 | public function release() 28 | { 29 | $this->session->remove('lock'); 30 | } 31 | 32 | public function __destruct() 33 | { 34 | unset($this->session); 35 | } 36 | } -------------------------------------------------------------------------------- /templates/duihuan.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | ==========兑换页面========== 4 |
5 | 6 | 兑换码:
7 |

8 |
9 | 10 | 11 | 12 | 13 |
兑换兑换码成功,获得:
14 | 15 |
x
16 | 17 | 18 | 19 | 20 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 21 | -------------------------------------------------------------------------------- /templates/map.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? []]) ?> 2 |
3 |
4 | [区域地图]
5 |
6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 |
11 | 12 | 13 | 14 |
19 |
20 | insert('includes/gonowmid');?> 21 |
-------------------------------------------------------------------------------- /templates/bag/peifang.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 装备 | 道具 | 药品 | 配方 8 |
9 |
10 | 11 | -
12 | 19 | -
20 | 21 |
22 | insert('includes/gonowmid');?> 23 |
-------------------------------------------------------------------------------- /third/Workerman/Db/RedisPool.php: -------------------------------------------------------------------------------- 1 | $this->config['scheme'], 12 | 'host' => $this->config['host'], 13 | 'port' => $this->config['port'], 14 | 'password' => $this->config['auth'], 15 | ]; 16 | $redis = new Client($params); 17 | $redis->connect(); 18 | return $redis; 19 | } 20 | 21 | protected function checkDb($db) 22 | { 23 | /** @var Client $db */ 24 | return $db->isConnected(); 25 | } 26 | 27 | protected function closeDb($db) 28 | { 29 | /** @var Client $db */ 30 | $db->disconnect(); 31 | unset($db); 32 | } 33 | } -------------------------------------------------------------------------------- /templates/fangshi_zhuangbei.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 坊市 ] 6 |
7 |
8 |
道具|装备】
9 | 10 |
11 | 0 ? "+{$v['qianghua']}" : ''?>价格:购买 12 |
13 | 14 |
15 | insert('includes/message'); ?> 16 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 17 |
-------------------------------------------------------------------------------- /game/Player/Effects.php: -------------------------------------------------------------------------------- 1 | db = new Medoo([ 18 | 'database_type' => 'mysql', 19 | 'database_name' => $configs['db_database'], 20 | 'server' => $configs['db_host'], 21 | 'username' => $configs['db_user'], 22 | 'password' => $configs['db_password'], 23 | 'charset' => 'utf8mb4', 24 | 'collation' => 'utf8mb4_general_ci', 25 | 'option' => [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION], 26 | // 时区设置,避免出现 timestamp 转换错误 27 | 'command' => ["SET time_zone='+8:00'"], 28 | ]); 29 | } 30 | } -------------------------------------------------------------------------------- /templates/vip_advantage.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [会员权益] 8 |
9 |
10 | 20 | 申请会员 21 |
22 | insert('includes/gonowmid', ['show_prev' => false]);?> 23 |
-------------------------------------------------------------------------------- /game/Layer.php: -------------------------------------------------------------------------------- 1 | '凡人期', 18 | self::TYPE_LIANQI => '炼气期', 19 | self::TYPE_ZHUJI=> '筑基期', 20 | self::TYPE_JINDAN=> '金丹期', 21 | self::TYPE_YUANSHEN=> '元神期', 22 | self::TYPE_ZHENXIAN=> '真仙期', 23 | ]; 24 | 25 | /** 26 | * 获取境界名称 27 | * @param int $type 28 | * @return string 29 | */ 30 | public static function name(int $type): string 31 | { 32 | return isset(self::$layerNames[$type]) ? self::$layerNames[$type] : self::$layerNames[self::TYPE_FANREN]; 33 | } 34 | } -------------------------------------------------------------------------------- /templates/show_shengxing_material.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [确认升星] 8 |
9 |
10 |
shengxing > 0 ? "{$equip->shengxing}星" : ''?>uiName ?: $equip->name?>
11 |
12 | 材料:name?> x 13 |
14 |
15 | 金币: 16 |
17 |
18 | 确认选择 19 |
20 |
21 |
22 | 23 |
24 | 返回上级 25 |
-------------------------------------------------------------------------------- /game/Combat/Item.php: -------------------------------------------------------------------------------- 1 | id = $tiem['id']; 32 | $this->name = $tiem['name']; 33 | $this->effects = new SplObjectStorage(); 34 | foreach ($effects as $v) { 35 | if (!$v['is_combat']) { 36 | continue; 37 | } 38 | $this->effects->attach(new BaseEffect($v, BaseEffect::ORIGIN_TYPE_ITEM)); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /templates/fangshi_daoju.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 坊市 ] 6 |
7 |
8 |
【道具|装备
9 | 10 |
11 | x单价:购买1购买5 购买10 12 |
13 | 14 |
15 | insert('includes/message'); ?> 16 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 17 |
-------------------------------------------------------------------------------- /game/Object/FromArrayTrait.php: -------------------------------------------------------------------------------- 1 | $v) { 20 | $formattedColumns[Helper::littleCamelCase($k)] = $v; 21 | } 22 | $vars = (new \ReflectionObject($mid))->getProperties(\ReflectionProperty::IS_PUBLIC); 23 | foreach ($vars as $v) { 24 | $key = $v->name; 25 | if (isset($formattedColumns[$key])) { 26 | $mid->$key = $formattedColumns[$key]; 27 | } 28 | } 29 | return $mid; 30 | } 31 | 32 | public function withDatabase(Medoo $db) 33 | { 34 | $this->db = $db; 35 | return $this; 36 | } 37 | } -------------------------------------------------------------------------------- /templates/npc/peifang.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |

昵称:name?>

5 |

性别:sex?>

6 |

信息:info?>

7 |
8 |
========配方列表========
9 | $v): ?> 10 |
11 | [] '> 12 | 13 | (已学习) 14 | 15 | '>学习 16 | 17 |
18 | 19 |
20 | insert('includes/message'); ?> 21 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 22 |
-------------------------------------------------------------------------------- /templates/liaotian.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [消息] '>刷新 8 |
9 |
10 | 11 | 12 | [系统]
13 | 14 | [消息]
15 | 16 | [队伍]
17 | 18 | 19 |
20 | insert('includes/gonowmid', ['show_prev' => false]);?> 21 |
-------------------------------------------------------------------------------- /templates/zhuangtai.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | getVipName($player)?>
8 | 等级: level?>
9 | 职业: sex == 1? '男' : '女'?> . playerManualName?>
10 | 经验: exp?>/maxExp?>
11 | 生命值: hp?>/maxhp?>
12 | 魔法值: mp?>/maxmp?>
13 | 神力: baqi?>
14 | 物攻: wugong?>
15 | 法攻: fagong?>
16 | 物防: wufang?>
17 | 法防: fafang?>
18 | 命中: mingzhong?>
19 | 闪避: shanbi?>
20 | 暴击: baoji?>
21 | 抗暴: shenming?>
22 |
23 | insert('includes/gonowmid');?> 24 |
-------------------------------------------------------------------------------- /templates/tutorial.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [新手入门] 8 |
9 |
10 |

1.进入游戏后背包中会有三种职业的入职道具,点击使用可以加入对应的职业。

11 |

2.先在银杏村长处领取新手宝石和新手勋章,然后去银杏书店购买学习初级技能。

12 |

3.最低级的武器和衣服可以在银杏野外打鸡获得,新手装备爆率非常高,可以挑选品质高的装备。

13 |

4.穿戴武器和衣服后不要直接打牛(5级),15级前进入战斗都可以自动满血,推荐直接挂机打猪到10级左右,囤积金创药和练级技能。

14 |

5.在10级左右时把背包中不需要的道具直接卖掉,然后看坊市有没有便宜的高品质10级装备买来穿上,然后可以尝试打牛,把全身装备都提升到10级。

15 |

6.10级装备穿满后可以考虑挂机稻草人和鹿到15级左右,然后转战比奇矿区第一格,依靠战斗回血打蝙蝠获取15级装备,没血了直接逃跑后再进入会自动回满。

16 |

7.15级装备穿满后就可以再回银杏野外挂机毒蜘蛛、食人花等怪物升级。

17 |

提示:挂机升级请选择比人物装备低一阶的怪物,多逛逛坊市。

18 |
19 | insert('includes/gonowmid', ['show_prev' => false]);?> 20 |
-------------------------------------------------------------------------------- /templates/includes/message.php: -------------------------------------------------------------------------------- 1 | hasMessage('message')): ?> 2 | getMessage('message') as $message): ?> 3 |
[消息]
4 | 5 | 6 | hasMessage('success')): ?> 7 | getMessage('success') as $message): ?> 8 |
[消息]
9 | 10 | 11 | hasMessage('error')): ?> 12 | getMessage('error') as $message): ?> 13 |
[消息]
14 | 15 | 16 | hasMessage('tips')): ?> 17 | getMessage('tips') as $message): ?> 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /templates/bag/yaopin.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
我的背包
7 |
元宝: uczb?>
8 |
金币: uyxb?>
9 |
负重: /liftingCapacity?>
10 |
11 | 装备 | 道具 | 药品 12 |
13 |
14 | 15 | -
16 | 24 | -
25 | 26 |
27 | insert('includes/gonowmid');?> 28 |
-------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GLWT(Good Luck With That) Public License 2 | Copyright (c) Everyone, except Author 3 | 4 | Everyone is permitted to copy, distribute, modify, merge, sell, publish, 5 | sublicense or whatever they want with this software but at their OWN RISK. 6 | 7 | Preamble 8 | 9 | The author has absolutely no clue what the code in this project does. 10 | It might just work or not, there is no third option. 11 | 12 | 13 | GOOD LUCK WITH THAT PUBLIC LICENSE 14 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION 15 | 16 | 0. You just DO WHATEVER YOU WANT TO as long as you NEVER LEAVE A 17 | TRACE TO TRACK THE AUTHOR of the original product to blame for or hold 18 | responsible. 19 | 20 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | Good luck and Godspeed. 26 | -------------------------------------------------------------------------------- /game/Job/LootExpAndMoney.php: -------------------------------------------------------------------------------- 1 | db, $uid, $totalExp); 20 | } 21 | if ($totalMoney) { 22 | \player\changeyxb($this->db, 1, $totalMoney, $uid); 23 | } 24 | if ($totalPetScore && $skillId) { 25 | $skill = $this->db->get('player_skill', [ 26 | 'id', 27 | 'level', 28 | 'score', 29 | 'max_score' 30 | ], ['id' => $skillId]); 31 | $r = $this->upSkillExp($skill, $totalPetScore); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /game/TimeCost.php: -------------------------------------------------------------------------------- 1 | db(), $this->uid(), true); 14 | $type = $this->params['type'] ?? 1; 15 | $types = [ 16 | 'AND #system' => ['tid' => 0, 'type' => 1], 17 | 'AND #system-player' => ['tid' => $player->id, 'type' => 1], 18 | 'AND #player' => ['tid' => $this->uid(),'type' => 2], 19 | ]; 20 | if ($player->partyId) { 21 | $types['AND #party'] = ['tid' => $player->partyId, 'type' => 3]; 22 | } 23 | $messages = $this->db()->select('im', '*', [ 24 | 'OR' => $types, 25 | 'ORDER' => ['id' => 'DESC'], 26 | 'LIMIT' => 10 27 | ]); 28 | $data = [ 29 | 'type'=> $type, 30 | 'messages' => $messages, 31 | ]; 32 | $this->display('liaotian', $data); 33 | } 34 | } -------------------------------------------------------------------------------- /templates/jninfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | jnname?> 7 | ] 8 |
9 | 攻击加成:jngj; ?>%
10 | 防御加成:jnfy; ?>%
11 | 暴击加成:jnbj; ?>%
12 | 吸血加成:jnxx; ?>%
13 | 兑换需要:djname?>(/djcount?>) 14 |
15 | 兑换 16 |
17 | 18 | 19 | 装备符篆1. 20 | 装备符篆2. 21 | 装备符篆3.
22 | 23 | 24 | insert('includes/message'); ?> 25 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 26 |
-------------------------------------------------------------------------------- /templates/qianghua_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [选择强化装备] 8 |
9 |
10 | 11 | -
12 | 20 | -
21 | 22 |
23 |
24 | 返回上一页 25 |
26 |
-------------------------------------------------------------------------------- /templates/shengxing_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [选择升星装备] 8 |
9 |
10 | 11 | -
12 | 20 | -
21 | 22 |
23 |
24 | 返回上一页 25 |
26 |
-------------------------------------------------------------------------------- /templates/select_equip.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [选择装备] 6 |
7 |
8 | 9 | -
10 | 18 | -
19 | 20 |
21 | insert('includes/message'); ?> 22 |
23 | 返回上一页 24 |
25 |
-------------------------------------------------------------------------------- /templates/player_skill_info.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [] 8 |
9 | 等级:
10 | 熟练度: (/)
11 |
12 | 13 | -
14 | 战斗效果:
15 | 20 | -
21 | 22 | 23 | 24 | 使用技能 25 | 26 | 27 | insert('includes/gonowmid');?> 28 |
-------------------------------------------------------------------------------- /templates/npc/conversation.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |

name?>

7 |

性别:sex?>

8 |

info?>

9 |
10 |
11 |
    12 |
  • 打听
  • 13 | 14 |
  • 15 | 16 |
17 |
18 | hasMessage('conversation')): ?> 19 | getMessage('conversation') as $message): ?> 20 |
21 | name?>: 22 |
23 | 24 | 25 |
26 | insert('includes/gonowmid');?> 27 |
-------------------------------------------------------------------------------- /templates/player_task.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 | 3 |
4 |
5 | 我的任务 6 |
7 | 8 | 未完成 | 已完成 9 | 10 | 未完成 | 已完成 11 | 12 |
13 |
14 | -
15 | 16 |
[] 17 | 18 | 19 | 20 | 21 |
22 | 23 | -
24 |
25 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]); ?> 26 |
27 | -------------------------------------------------------------------------------- /templates/show_qianghua_material.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [确认强化] 8 |
9 |
10 |
getPlayerEquipName($equip)?>
11 | 12 |
13 | 需要材料:
14 | 15 | x
16 | 17 | 金币 x
18 | 成功率: %
19 |
20 |
21 | 确认选择 22 |
23 | 24 |
25 |
26 | 27 |
28 | 返回上级 29 |
-------------------------------------------------------------------------------- /templates/allmap.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [地图传送] 8 |
9 |
10 | 安全区:
11 | $map):?> 12 | 13 | 14 | . 15 | 16 | 17 |
18 | - 19 |
20 | 危险区:
21 | 22 |
23 | 24 |
25 | 26 |
27 | - 28 | insert('includes/gonowmid', ['show_prev' => false]);?> 29 |
-------------------------------------------------------------------------------- /templates/admin/show_connections.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 连接地图 ] 8 |
9 |
10 | 11 | 12 | $v):?> 13 | 14 | 17 | 20 | 21 | 22 | 23 |
15 | () 16 | 18 | 连接 19 |
24 |
25 |
26 | 返回地图 27 |
28 |
29 | -------------------------------------------------------------------------------- /templates/chongwu/ronghe.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | 灵兽蛋 7 | ] 8 |
9 |
一个奇怪的蛋,从内部发出一股淡淡的color?>色柔光。
10 |
11 |
12 | 18 | 19 |
20 |
21 | 22 | insert('includes/message'); ?> 23 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 24 |
-------------------------------------------------------------------------------- /templates/friends.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 | 好友 9 | 10 | 好友 11 | 12 | - 13 | 14 | 仇人 15 | 16 | 仇人 17 | 18 | - 19 | 20 | 黑名单 21 | 22 | 黑名单 23 | 24 |
25 |
26 | - 27 |
    28 | $v): ?> 29 |
  • [] '>
  • 30 | 31 |
32 | - 33 |
34 | insert('includes/gonowmid', ['show_prev' => false]);?> 35 |
-------------------------------------------------------------------------------- /templates/npc.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |

name?>

5 |

性别:sex?>

6 |

info?>

7 | 8 |
9 | 10 |
11 | () 12 |
13 | 14 |
15 | 16 | 17 |
18 | -
19 | 20 | 21 |
insert($f['insert']); ?>
22 | 23 |
24 | 25 | -
26 |
27 | 28 | insert('includes/gonowmid');?> 29 |
30 | 31 | -------------------------------------------------------------------------------- /third/Workerman/Protocols/Http/Chunk.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols\Http; 15 | 16 | 17 | /** 18 | * Class Chunk 19 | * @package Workerman\Protocols\Http 20 | */ 21 | class Chunk 22 | { 23 | /** 24 | * Chunk buffer. 25 | * 26 | * @var string 27 | */ 28 | protected $_buffer = null; 29 | 30 | /** 31 | * Chunk constructor. 32 | * @param $buffer 33 | */ 34 | public function __construct($buffer) 35 | { 36 | $this->_buffer = $buffer; 37 | } 38 | 39 | /** 40 | * __toString 41 | * 42 | * @return string 43 | */ 44 | public function __toString() 45 | { 46 | return \dechex(\strlen($this->_buffer))."\r\n$this->_buffer\r\n"; 47 | } 48 | } -------------------------------------------------------------------------------- /templates/index.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | 6 |
7 | insert('includes/message'); ?> 8 |
9 |
10 | 13 | 14 |
15 |
16 | 19 | 20 |
21 |
22 | 25 |
26 |
27 |
28 | 29 | 注册帐号 30 | . 开源代码 . 讨论群:39387037 31 |
32 |
33 | -------------------------------------------------------------------------------- /third/Workerman/Db/MedooPool.php: -------------------------------------------------------------------------------- 1 | 'mysql', 15 | 'database_name' => $this->config['db_name'], 16 | 'server' => $this->config['host'], 17 | 'username' => $this->config['username'], 18 | 'password' => $this->config['password'], 19 | 'port' => $this->config['port'] ?? 3306, 20 | 'charset' => 'utf8mb4', 21 | 'collation' => 'utf8mb4_general_ci', 22 | 'option' => [ 23 | \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, 24 | \PDO::ATTR_EMULATE_PREPARES => false 25 | ], 26 | 'command' => ["SET time_zone='+8:00'"], 27 | ]); 28 | 29 | return $db; 30 | } 31 | 32 | protected function checkDb($db) 33 | { 34 | return true; 35 | } 36 | 37 | protected function closeDb($db) 38 | { 39 | /** @var Medoo $db */ 40 | $db->pdo = null; 41 | unset($db); 42 | } 43 | } -------------------------------------------------------------------------------- /templates/pfinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message');?> 4 | 5 |

[ ]

6 |
7 |
8 | 配方材料:
9 | 10 |
11 | - x 12 |
13 | 14 |
15 | 16 |
17 | 炼制物品: 18 |
19 | - x1 20 |
21 |
22 | 23 | 24 | 25 |
name?>的配方熟练度:%
26 | 27 | 28 | 29 | insert('includes/gonowmid');?> 30 | -------------------------------------------------------------------------------- /game/Combat/Skill.php: -------------------------------------------------------------------------------- 1 | id = $skill['id']; 53 | $this->name = $skill['name']; 54 | $this->equipType = $skill['equip_type']; 55 | $this->cd = $skill['tiaoxi']; 56 | $this->effects = new SplObjectStorage(); 57 | foreach ($effects as $v) { 58 | $this->effects->attach(new BaseEffect($v, BaseEffect::ORIGIN_TYPE_SKILL)); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /templates/activity/qiandao.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ 每日签到 ]
7 |
8 | 9 | 10 |

你已连续签到日。

11 | 12 |

你已连续签到日,今日签到可获得:

13 |
    14 | 15 |
  • x
  • 16 | 17 |
18 | 19 |

签到

20 | 21 |

你已连续签到日。

22 |

已签到

23 | 24 |
25 | 返回上级
26 | insert('includes/gonowmid', ['show_prev' => false]);?> 27 |
-------------------------------------------------------------------------------- /game/DB/MedooPool.php: -------------------------------------------------------------------------------- 1 | 'mysql', 15 | 'database_name' => $this->config['db_name'], 16 | 'server' => $this->config['host'], 17 | 'username' => $this->config['username'], 18 | 'password' => $this->config['password'], 19 | 'port' => $this->config['port'] ?? 3306, 20 | 'charset' => 'utf8mb4', 21 | 'collation' => 'utf8mb4_general_ci', 22 | 'option' => [ 23 | \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, 24 | \PDO::ATTR_EMULATE_PREPARES => false 25 | ], 26 | 'command' => ["SET time_zone='+8:00'"], 27 | ]); 28 | $db->startedAt = time(); 29 | 30 | return $db; 31 | } 32 | 33 | protected function checkDb($db) 34 | { 35 | return isset($db->startedAt) && time() - $db->startedAt < 600 ; 36 | } 37 | 38 | protected function closeDb($db) 39 | { 40 | /** @var Medoo $db */ 41 | $db->pdo = null; 42 | unset($db); 43 | } 44 | } -------------------------------------------------------------------------------- /templates/shortcuts/show_combat_condition.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [战斗策略] 8 |
9 | 10 |
帐号未认证,入群认证后即可使用策略功能。
11 | 12 |
13 |
    14 | $v):?> 15 |
  • 16 | : 17 | 0) :?> 18 | 上移 19 | 20 | 删除 21 |
  • 22 | 23 |
24 |
25 |
26 | 新增策略 27 |
28 | 29 | insert('includes/gonowmid', ['show_prev' => false]);?> 30 |
-------------------------------------------------------------------------------- /templates/pve_log.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 | 7 | 怪物已经被其他人攻击了!
8 | 请少侠练习一下手速哦 9 | 10 | 对方无法跟上你逃跑的脚步,愤怒的咆哮
11 | 12 | 你获得了胜利。
13 | $v): ?> 14 |
15 | 战败了。
16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 你战败了。
26 | 请少侠重来。 27 | 28 | 你已经趟地上了,再来过吧。 29 | 30 |
31 | 返回游戏 32 |
33 |
34 | 35 | -------------------------------------------------------------------------------- /templates/party/party.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [组队大厅] 刷新 8 |
9 |
10 | 11 | -
12 | 暂时没有队伍。
13 | -
14 | 15 | -
16 |
    17 | $v): ?> 18 |
  • 19 | [] name?> 20 | (队长:leaderName?>) 21 | isClosed && !$player->partyId):?> 22 | 申请入队 23 | 24 |
  • 25 | 26 |
27 | -
28 | 29 | partyId):?> 30 |

创建队伍

31 | 32 |
33 | insert('includes/gonowmid', ['show_prev' => false]);?> 34 |
-------------------------------------------------------------------------------- /templates/register.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | 6 |
7 | insert('includes/message'); ?> 8 |
9 |
10 | 13 | 14 |
15 |
16 | 19 | 20 |
21 |
22 | 25 | 26 |
27 |
28 | 31 |
32 |
33 |
34 | 35 | 登录游戏 36 | . 讨论群:39387037 37 |
38 |
39 | -------------------------------------------------------------------------------- /game/Condition.php: -------------------------------------------------------------------------------- 1 | db = $db; 39 | $this->lua = new Lua(); 40 | $this->matcher = new Matcher($this->db, $this->lua, $uid); 41 | } 42 | 43 | public function __call(string $method, array $args) 44 | { 45 | if (method_exists($this->matcher, $method)) { 46 | return call_user_func_array([$this->matcher, $method], $args); 47 | } 48 | throw new \BadMethodCallException(); 49 | } 50 | 51 | /** 52 | * @Notice 这里必须手动释放 lua 和 matcher 53 | */ 54 | public function __destruct() 55 | { 56 | $this->matcher->__destruct(); 57 | unset($this->db, $this->lua, $this->matcher); 58 | } 59 | } -------------------------------------------------------------------------------- /templates/cwinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 8 | isBorn ? $chongwu->name : '灵兽蛋'?> 9 | ] 10 |
11 | isBorn) : ?> 12 | 等级: level?>
13 | 生命值: hp?>/maxhp?>
14 | 魔法值: mp?>/maxmp?>
15 | 神力: baqi?>
16 | 物攻: wugong?>
17 | 物防: wufang?>
18 | 法攻: fagong?>
19 | 法防: fafang?>
20 | 命中: mingzhong?>
21 | 闪避: shanbi?>
22 | 暴击: baoji?>
23 | 抗暴: shenming?>
24 | 25 |
一个奇怪的蛋,从内部发出一股淡淡的color?>色柔光。
26 |
27 | 融合元魂 28 | 孵化灵兽 29 |
30 | 31 | 32 | insert('includes/gonowmid');?> 33 |
-------------------------------------------------------------------------------- /game/Handlers/Yaopin.php: -------------------------------------------------------------------------------- 1 | game->db; 12 | $player = \player\getPlayerById($db, $this->uid(), true); 13 | 14 | $ypid = $this->params['ypid'] ?? 0; 15 | $gonowmid = $this->encode("cmd=gomid&newmid=$player->nowmid"); 16 | 17 | $yaopin = \player\getMedicine($this->db(), $ypid); 18 | $playeryp = \player\getPlayerMedicineByItemId($this->db(), $ypid, $player->id); 19 | $data = []; 20 | $data['useyp'] = $this->encode("cmd=useyp&ypid=$ypid"); 21 | $data['yaopin'] = $yaopin; 22 | $data['gonowmid'] = $gonowmid; 23 | $data['has_it'] = $playeryp && $playeryp->amount > 0; 24 | $data['playerYaopin'] = $playeryp; 25 | $this->display('ypinfo', $data); 26 | } 27 | 28 | public function useYaopin() 29 | { 30 | $db = $this->game->db; 31 | $ypid = $this->params['ypid'] ?? 0; 32 | $back = $this->encode(sprintf('cmd=ypinfo&ypid=%d', $ypid)); 33 | $userypret = \player\useyaopin($ypid,1, $this->uid(), $db); 34 | if ($userypret){ 35 | $this->flash->set('success', '使用药品成功'); 36 | }else{ 37 | $this->flash->set('error', '使用药品失败'); 38 | } 39 | $this->doCmd($back); 40 | } 41 | } -------------------------------------------------------------------------------- /templates/layout.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 王者归来 - Wap文字游戏 9 | 10 | 11 | 12 |
13 |
14 | 15 |
16 | 17 | 18 | [系统]
19 | 20 | [消息]
21 | 22 | [队伍]
23 | 24 | 25 |
26 | 27 | section('content')?> 28 |
29 |
30 | section('scripts')?> 31 | 32 | -------------------------------------------------------------------------------- /templates/admin/area_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 区域列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 22 | 25 | 26 | 27 | 28 |
14 | +创建区域 15 |
20 | () 21 | 23 | 删除 24 |
29 |
30 |
31 | 返回地图 32 |
33 |
-------------------------------------------------------------------------------- /templates/activity/redeem_code.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ ]
7 |
8 |
9 |
10 |

11 | 12 |
13 |
14 | 15 |
16 |
17 | 18 |
19 |

可获得

20 |
    21 | 22 |
  • x
  • 23 | 24 |
25 |
26 | 27 |
28 | 返回上级
29 | insert('includes/gonowmid', ['show_prev' => false]);?> 30 |
-------------------------------------------------------------------------------- /templates/ginfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ name?> ]
7 | 等级: level?>
8 | 生命: hp?>/maxhp?>
9 | info?>
10 | 11 |
12 | id)?>">攻击name?> 13 |
14 | 15 |
16 | 攻击: wugong?> 防御: wufang?>
17 | 法攻: fagong?> 法御: fafang?>
18 |
19 | 20 |
21 |
-
22 | 掉落: 23 | $v):?> 24 | 25 | 26 | , 27 | 28 | 29 |
-
30 |
31 | 32 | insert('includes/gonowmid');?> 33 |
34 | 35 | -------------------------------------------------------------------------------- /game/Job/CheckTaskMonsterCondition.php: -------------------------------------------------------------------------------- 1 | db, $uid); 20 | if (!empty($tasks)) { 21 | $taskIds = []; 22 | foreach ($tasks as $v) { 23 | $taskIds[] = $v['task_id']; 24 | } 25 | \player\changeTaskMonsterCondition($this->db, $taskIds, $gid, $uid); 26 | $conArr = \player\getPlayerUnfinishedTasksConditions($this->db, $uid, $gid, 2); 27 | foreach ($conArr as $v) { 28 | $messages[] = [ 29 | 'uid' => 0, 30 | 'tid' => $uid, 31 | 'type' => 2, 32 | 'content' => sprintf('%s/%s(%d/%d)', $v['task_name'], $v['target_name'], $v['amount'], $v['required_amount']), 33 | ]; 34 | } 35 | } 36 | 37 | // 发出通知 38 | if (!empty($messages)) { 39 | $this->db->insert('im', $messages); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /game/Object/PlayerParty.php: -------------------------------------------------------------------------------- 1 | $id]; 45 | if (!empty($conditions)) { 46 | $where = array_merge($where, $conditions); 47 | } 48 | 49 | $arr = $db->get('player_party', '*', $where); 50 | if (empty($arr)) { 51 | return new self(); 52 | } 53 | $pet = self::fromArray($arr)->withDatabase($db); 54 | return $pet; 55 | } 56 | 57 | public static function add(Medoo $db, array $data) 58 | { 59 | $db->insert('player_party', $data); 60 | return $db->id(); 61 | } 62 | 63 | public static function update(Medoo $db, int $id, array $data) 64 | { 65 | $db->update('player_party', $data, ['id' => $id]); 66 | } 67 | } -------------------------------------------------------------------------------- /templates/admin/show_create_loc.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 |
3 | insert('includes/message'); ?> 4 |
5 |
6 | 9 | 10 |
11 |
12 | 15 | 16 |
17 |
18 | 21 |
22 |
23 |
24 | 25 |
26 | 返回地图 27 |
28 | -------------------------------------------------------------------------------- /templates/show_equips.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [我的装备] 8 |
9 |
10 | 升星 . 11 | 强化 12 |
13 |
14 | -
15 | $v) : ?> 16 |
17 | : 18 | 19 | getPlayerEquipName($v)?> 20 | 更换 21 | 卸下 22 | 23 | 选择 24 | 25 |
26 | 27 | -
28 |
29 |
30 | 31 |
32 | 返回游戏 33 |
-------------------------------------------------------------------------------- /game/Job/CheckPlayerOnlineStatus.php: -------------------------------------------------------------------------------- 1 | db->get('game1', '*', ['id' => $args['uid']]); 13 | $now = time(); 14 | $difference = $now - strtotime($player['endtime']); 15 | if ($difference < $time) { 16 | // 时间未达到,以差值作为延迟再次检查,直到离线为止 17 | $later = $time - $difference; 18 | Resque::later($later, CheckPlayerOnlineStatus::class, ['uid' => $player['id'], 'time' => $time]); 19 | return; 20 | } 21 | // 标记为下线 22 | $data = ['sfzx' => 0]; 23 | if ($player['party_id']) { 24 | $res = $this->db->update('player_party_member', [ 25 | 'status' => 1, 26 | ], [ 27 | 'uid' => $player['id'], 28 | 'party_id' => $player['party_id'], 29 | 'is_leader' => 0, 30 | ]); 31 | if ($res->rowCount()) { 32 | $name = Helper::getVipName($player); 33 | $this->db->insert('im', [ 34 | 'uid' => 0, 35 | 'tid' => $player['party_id'], 36 | 'type' => 3, 37 | 'content' => "{$name}已离线,自动取消跟随模式", 38 | ]); 39 | } 40 | } 41 | $this->db->update('game1', $data, ['id' => $args['uid']]); 42 | } 43 | } -------------------------------------------------------------------------------- /templates/player_skills.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 | 全部 9 | 10 | 全部 11 | 12 | - 13 | 14 | 物攻 15 | 16 | 物攻 17 | 18 | - 19 | 20 | 法攻 21 | 22 | 法攻 23 | 24 | - 25 | 26 | 辅助 27 | 28 | 辅助 29 | 30 |
31 |
32 | -
33 |
    34 | $v):?> 35 |
  • 36 | [] () 37 |
  • 38 | 39 |
40 | -
41 |
42 | 43 | insert('includes/gonowmid', ['show_prev' => false]);?> 44 |
-------------------------------------------------------------------------------- /templates/search.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | mname?> 6 |
7 | midinfo?>
8 |
9 | 10 |
11 | 你正在探索中,还需要等待 秒。 12 |
13 | 14 | insert('includes/resources', ['resources' => $resources]);?> 15 |
16 | 继续搜寻 17 | 返回游戏 18 |
19 | 20 |
21 | 22 | push('scripts'); ?> 23 | 34 | end();?> 35 | 36 |
-------------------------------------------------------------------------------- /game/Combat/PetAttacker.php: -------------------------------------------------------------------------------- 1 | 'name', 11 | 'level' => 'level', 12 | 'hp' => 'hp', 13 | 'maxHp' => 'maxhp', 14 | 'mp' => 'mp', 15 | 'maxMp' => 'maxmp', 16 | 'baqi' => 'baqi', 17 | 'wugong' => 'wugong', 18 | 'wufang' => 'wufang', 19 | 'fagong' => 'fagong', 20 | 'fafang' => 'fafang', 21 | 'baoji' => 'baoji', 22 | 'shenming' => 'shenming', 23 | 'mingzhong' => 'mingzhong', 24 | 'shanbi' => 'shanbi', 25 | ]; 26 | 27 | /** 28 | * @var Pet 29 | */ 30 | public $pet; 31 | 32 | /** 33 | * @param Pet $pet 34 | */ 35 | public static function fromPet(Pet $pet) 36 | { 37 | $attacker = new PetAttacker(); 38 | $attacker->id = $pet->id; 39 | $attacker->type = self::TYPE_PET; 40 | $attacker->pet = $pet; 41 | // 设置属性 42 | foreach (self::$map as $k1 => $k2) { 43 | $attacker->$k1 = $pet->$k2 ?? 0; 44 | } 45 | return $attacker; 46 | } 47 | 48 | /** 49 | * 保存属性 50 | */ 51 | public function saveStatus() 52 | { 53 | foreach (self::$map as $k1 => $k2) { 54 | $this->pet->$k2 = $this->$k1; 55 | } 56 | } 57 | 58 | /** 59 | * @return Pet 60 | */ 61 | public function getRawObject(): Pet 62 | { 63 | return $this->pet; 64 | } 65 | } -------------------------------------------------------------------------------- /templates/tupo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | ======突破====== 7 | ] 8 |
9 |
10 | 当前境界:jingjie?>
11 | 当前功法:playerManualName?> - cengci?>
12 |
当前瓶颈:
13 |
所在地点:
14 |
15 | 16 |
环境:+
17 |
悟性:+
18 |
心境:+
19 |
境界:+
20 | 21 |
神魂不稳:
22 | 23 | 24 |
:+
25 | 26 |
突破成功率:%
27 |
28 | 突破 29 |
30 | 31 | insert('includes/message'); ?> 32 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 33 |
-------------------------------------------------------------------------------- /game/Collection.php: -------------------------------------------------------------------------------- 1 | data[$key]); 15 | } 16 | 17 | public function get($key, $default = null) 18 | { 19 | return $this->has($key) ? $this->data[$key] : $default; 20 | } 21 | 22 | public function set($key, $value) 23 | { 24 | $this->data[$key] = $value; 25 | } 26 | 27 | public function remove($key) 28 | { 29 | unset($this->data[$key]); 30 | } 31 | 32 | public function all() 33 | { 34 | return $this->data; 35 | } 36 | 37 | public function clear() 38 | { 39 | $this->data = []; 40 | } 41 | 42 | public function offsetExists($key) 43 | { 44 | return $this->has($key); 45 | } 46 | 47 | public function offsetGet($key) 48 | { 49 | return $this->get($key); 50 | } 51 | 52 | public function offsetSet($key, $value) 53 | { 54 | $this->set($key, $value); 55 | } 56 | 57 | public function offsetUnset($key) 58 | { 59 | return $this->remove($key); 60 | } 61 | 62 | public function count() 63 | { 64 | return count($this->data); 65 | } 66 | 67 | public function getIterator() 68 | { 69 | return new \ArrayIterator($this->data); 70 | } 71 | 72 | public function __destruct() 73 | { 74 | unset($this->data); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /templates/chongwu.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [宝宝] 8 |
9 |
10 | 11 | 当前没有宝宝 12 | 13 | -
14 |
    15 | 16 |
  • 17 | name?> 18 | isOut): ?> 19 | (已出战) 20 | 21 | isOut): ?> 22 | 出战 23 | vip): ?> 24 | 放生 25 | 26 | 27 | 召回 28 | 29 |
  • 30 | 31 |
32 | -
33 | 34 |
35 | insert('includes/gonowmid', ['show_prev' => false]);?> 36 |
-------------------------------------------------------------------------------- /templates/combat/select_item.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 物品选择 ] 6 |
7 |
8 |
    9 | $v):?> 10 |
  • 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
  • 23 | 24 |
25 |
26 | insert('includes/message'); ?> 27 | 28 | insert('includes/gonowmid', ['show_return' => false]); ?> 29 |
-------------------------------------------------------------------------------- /templates/combat/select_skill.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 技能选择 ] 6 |
7 |
8 |
    9 | $v):?> 10 |
  • 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
  • 23 | 24 |
25 |
26 | insert('includes/message'); ?> 27 | 28 | insert('includes/gonowmid', ['show_return' => false]); ?> 29 |
-------------------------------------------------------------------------------- /third/Workerman/Protocols/Frame.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | use Workerman\Connection\TcpConnection; 17 | 18 | /** 19 | * Frame Protocol. 20 | */ 21 | class Frame 22 | { 23 | /** 24 | * Check the integrity of the package. 25 | * 26 | * @param string $buffer 27 | * @param TcpConnection $connection 28 | * @return int 29 | */ 30 | public static function input($buffer, TcpConnection $connection) 31 | { 32 | if (\strlen($buffer) < 4) { 33 | return 0; 34 | } 35 | $unpack_data = \unpack('Ntotal_length', $buffer); 36 | return $unpack_data['total_length']; 37 | } 38 | 39 | /** 40 | * Decode. 41 | * 42 | * @param string $buffer 43 | * @return string 44 | */ 45 | public static function decode($buffer) 46 | { 47 | return \substr($buffer, 4); 48 | } 49 | 50 | /** 51 | * Encode. 52 | * 53 | * @param string $buffer 54 | * @return string 55 | */ 56 | public static function encode($buffer) 57 | { 58 | $total_length = 4 + \strlen($buffer); 59 | return \pack('N', $total_length) . $buffer; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /templates/admin/show_update_loc.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 |
3 | insert('includes/message'); ?> 4 |
5 | 6 |
7 | 10 | 11 |
12 |
13 | 16 | 17 |
18 |
19 | 22 |
23 |
24 |
25 | 26 |
27 | 返回地图 28 |
29 | -------------------------------------------------------------------------------- /templates/admin/condition_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 条件列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 29 | 32 | 33 | 34 | 35 |
14 | +创建新条件 15 |
20 | 21 | 22 | 23 | 24 | 条件 25 | 26 | () 27 | 28 | 30 | 删除 31 |
36 |
37 |
38 | 返回上页 39 |
40 |
-------------------------------------------------------------------------------- /templates/xiulian.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 修炼 ] 8 |
9 |
10 | 当前境界: jingjie?>
11 | 当前功法: playerManualName?> - cengci?>
12 | 13 | 修为瓶颈: 当前 14 | 15 | -> 16 | 17 |
18 | 瓶颈进度: %
19 |
所在地点:
20 | 修炼速度: 修为/分钟
21 | 22 | isMaxManualLevel): ?> 23 | 修炼状态: 已达到功法最高等级,无法继续修炼
24 | 25 | ===============
26 | 修炼时间: 分钟
27 | 修炼收益: 修为
28 | ===============
29 | 注:单次最多修炼8小时,480分钟 30 | sfxl == 1): ?> 31 |
修炼中
32 | 结束修炼 33 | 34 |
35 | 开始修炼 36 | 37 | 38 |
39 | sfxl != 1): ?> 40 | insert('includes/gonowmid');?> 41 | 42 |
-------------------------------------------------------------------------------- /game/Handlers/Admin/Condition.php: -------------------------------------------------------------------------------- 1 | db()->select('condition', '*'); 13 | $data = []; 14 | $data['conditions'] = $conditions; 15 | $this->display('admin/condition_list', $data); 16 | } 17 | 18 | public function showCreate() 19 | { 20 | $id = $this->params['id'] ?? 0; 21 | $condition = []; 22 | if ($id) { 23 | $condition = $this->db()->get('condition', '*', ['id' => $id]); 24 | } 25 | $data = []; 26 | $data['condition'] = $condition; 27 | $this->display('admin/show_create_condition', $data); 28 | } 29 | 30 | public function save() 31 | { 32 | $id = Helper::filterVar($this->postParam('id'), 'INT'); 33 | $notes = Helper::filterVar($this->postParam('notes'), 'STRING'); 34 | $successInfo = Helper::filterVar($this->postParam('success_info'), 'STRING'); 35 | $failureInfo = Helper::filterVar($this->postParam('failure_info'), 'STRING'); 36 | $matchers = $this->postParam('matchers'); 37 | 38 | $arr = [ 39 | 'notes' => $notes, 40 | 'success_info' => $successInfo, 41 | 'failure_info' => $failureInfo, 42 | 'matchers' => $matchers, 43 | ]; 44 | if (empty($id)) { 45 | $this->db()->insert('condition', $arr); 46 | $id = $this->db()->id(); 47 | } else { 48 | $this->db()->update('condition', $arr, ['id' => $id]); 49 | } 50 | $this->flash->success('操作成功'); 51 | $this->doRawCmd('cmd=admin-condition-list'); 52 | } 53 | } -------------------------------------------------------------------------------- /templates/ypinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 8 | name?> 9 | ] 10 |
11 | amount > 0):?> 12 | 数量:amount?: 0?>
13 | 14 | isBound):?> 15 | 价格:price?>金币
16 | 17 | 绑定:isBound ? '是' : '否'?>
18 |
    19 | effects as $effect): ?> 20 | isColumn): ?> 21 |
  • 22 | desc, $effect->amount)?> 23 | turns > 1):?> 24 | ,持续turns?>回合 25 | 26 | isRaw || $effect->turns > 1): ?> 27 | (仅在战斗中生效) 28 | 29 |
  • 30 | isCustom): ?> 31 |
  • 32 | 使用后获得「info?>」效果 33 | isTemporary):?> 34 | ,持续时间duration?>秒 35 | 36 |
  • 37 | 38 | 39 |
40 | 41 | -
42 | 使用name?>
43 | -
44 | 45 | 46 | insert('includes/gonowmid');?> 47 |
-------------------------------------------------------------------------------- /templates/admin/npc_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ NPC 列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 22 | 29 | 32 | 33 | 34 | 35 |
14 | +创建NPC 15 |
20 | () 21 | 23 | 24 | 移除 25 | 26 | 放置 27 | 28 | 30 | 删除 31 |
36 |
37 |
38 | 返回编辑 39 |
40 |
-------------------------------------------------------------------------------- /third/Workerman/Protocols/ProtocolInterface.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | use Workerman\Connection\ConnectionInterface; 17 | 18 | /** 19 | * Protocol interface 20 | */ 21 | interface ProtocolInterface 22 | { 23 | /** 24 | * Check the integrity of the package. 25 | * Please return the length of package. 26 | * If length is unknow please return 0 that mean wating more data. 27 | * If the package has something wrong please return false the connection will be closed. 28 | * 29 | * @param string $recv_buffer 30 | * @param ConnectionInterface $connection 31 | * @return int|false 32 | */ 33 | public static function input($recv_buffer, ConnectionInterface $connection); 34 | 35 | /** 36 | * Decode package and emit onMessage($message) callback, $message is the result that decode returned. 37 | * 38 | * @param string $recv_buffer 39 | * @param ConnectionInterface $connection 40 | * @return mixed 41 | */ 42 | public static function decode($recv_buffer, ConnectionInterface $connection); 43 | 44 | /** 45 | * Encode package brefore sending to client. 46 | * 47 | * @param mixed $data 48 | * @param ConnectionInterface $connection 49 | * @return string 50 | */ 51 | public static function encode($data, ConnectionInterface $connection); 52 | } 53 | -------------------------------------------------------------------------------- /game/Combat/MonsterAttacker.php: -------------------------------------------------------------------------------- 1 | 'name', 11 | 'level' => 'level', 12 | 'hp' => 'hp', 13 | 'maxHp' => 'maxhp', 14 | 'baqi' => 'baqi', 15 | 'wugong' => 'wugong', 16 | 'wufang' => 'wufang', 17 | 'fagong' => 'fagong', 18 | 'fafang' => 'fafang', 19 | 'baoji' => 'baoji', 20 | 'shenming' => 'shenming', 21 | 'mingzhong' => 'mingzhong', 22 | 'shanbi' => 'shanbi', 23 | ]; 24 | 25 | /** 26 | * @var int 怪物种类 27 | */ 28 | public $monsterType; 29 | 30 | /** 31 | * @var \player\MidGuaiwu 32 | */ 33 | protected $monster; 34 | 35 | /** 36 | * @param array $columns 37 | * @param array $shortCuts 38 | */ 39 | public static function fromMonster(MidGuaiwu $monster, array $shortCuts = []) 40 | { 41 | $attacker = new MonsterAttacker(); 42 | $attacker->id = $monster->id; 43 | $attacker->type = self::TYPE_MONSTER; 44 | $attacker->monster = $monster; 45 | $attacker->monsterType = $monster->type; 46 | // 设置属性 47 | foreach (self::$map as $k1 => $k2) { 48 | $attacker->$k1 = $monster->$k2 ?? 0; 49 | } 50 | // 设置快捷键 51 | foreach ($shortCuts as $k => $v) { 52 | $attacker->shortcuts->attach(new Shortcut($v), $k + 1) ; 53 | } 54 | 55 | return $attacker; 56 | } 57 | 58 | /** 59 | * 保存属性 60 | */ 61 | public function saveStatus() 62 | { 63 | foreach (self::$map as $k1 => $k2) { 64 | $this->monster->$k2 = $this->$k1; 65 | } 66 | } 67 | 68 | public function getRawObject() 69 | { 70 | return $this->monster; 71 | } 72 | } -------------------------------------------------------------------------------- /game/Player/PrivateItem.php: -------------------------------------------------------------------------------- 1 | db = $db; 42 | $this->uid = $uid; 43 | $this->type = $type; 44 | } 45 | 46 | public function getByKey(string $key): array 47 | { 48 | $item = $this->db->get('player_private_items', '*', [ 49 | 'uid' => $this->uid, 50 | 'type' => $this->type, 51 | 'k' => $key, 52 | ]); 53 | return empty($item) ? [] : $item; 54 | } 55 | 56 | public function updateByKey(string $key, $value): bool 57 | { 58 | $res = $this->db->update('player_private_items', [ 59 | 'v' => $value, 60 | 'updated_at' => date('Y-m-d H:i:s'), 61 | ], [ 62 | 'uid' => $this->uid, 63 | 'type' => $this->type, 64 | 'k' => $key, 65 | ]); 66 | return $res->rowCount() > 0; 67 | } 68 | 69 | public function add(string $key, $value, int $type): bool 70 | { 71 | $res = $this->db->insert('player_private_items', [ 72 | 'uid' => $this->uid, 73 | 'type' => $type, 74 | 'k' => $key, 75 | 'v' => $value 76 | ]); 77 | return $res->rowCount() > 0; 78 | } 79 | } -------------------------------------------------------------------------------- /templates/shortcuts.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [设置] 8 |
9 |
10 | 23 | 36 |
37 | 38 |
39 |

退出登录

40 |
41 | insert('includes/gonowmid', ['show_prev' => false]);?> 42 |
-------------------------------------------------------------------------------- /game/SessionHandler.php: -------------------------------------------------------------------------------- 1 | redis = $redis; 17 | session_set_save_handler( 18 | array($this, "open"), 19 | array($this, "close"), 20 | array($this, "read"), 21 | array($this, "write"), 22 | array($this, "destroy"), 23 | array($this, "gc") 24 | ); 25 | } 26 | 27 | public function open($path, $name) 28 | { 29 | return true; 30 | } 31 | 32 | public function close() 33 | { 34 | return true; 35 | } 36 | 37 | public function read($id) 38 | { 39 | // Get the specified record in redis 40 | $value = $this->redis->get($id); 41 | if ($value) { 42 | return $value; 43 | } else { 44 | return ''; 45 | } 46 | } 47 | 48 | public function write($id, $data) 49 | { 50 | // stored with session ID as the key 51 | if ($this->redis->set($id, $data)) { 52 | // Set the expiration time of data in redis, that is, session expiration time 53 | $this->redis->expire($id, $this->session_expiretime); 54 | return true; 55 | } 56 | 57 | return false; 58 | } 59 | 60 | public function destroy($id) 61 | { 62 | // delete the specified record in redis 63 | if ($this->redis->del($id)) { 64 | return true; 65 | } 66 | return false; 67 | } 68 | 69 | public function gc($maxlifetime) 70 | { 71 | return true; 72 | } 73 | 74 | public function cleanUp() 75 | { 76 | unset($this->redis); 77 | } 78 | } -------------------------------------------------------------------------------- /third/Workerman/Protocols/Http/ServerSentEvents.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols\Http; 15 | 16 | /** 17 | * Class ServerSentEvents 18 | * @package Workerman\Protocols\Http 19 | */ 20 | class ServerSentEvents 21 | { 22 | /** 23 | * Data. 24 | * @var array 25 | */ 26 | protected $_data = null; 27 | 28 | /** 29 | * ServerSentEvents constructor. 30 | * $data for example ['event'=>'ping', 'data' => 'some thing', 'id' => 1000, 'retry' => 5000] 31 | * @param array $data 32 | */ 33 | public function __construct(array $data) 34 | { 35 | $this->_data = $data; 36 | } 37 | 38 | /** 39 | * __toString. 40 | * 41 | * @return string 42 | */ 43 | public function __toString() 44 | { 45 | $buffer = ''; 46 | $data = $this->_data; 47 | if (isset($data[''])) { 48 | $buffer = ": {$data['']}\n"; 49 | } 50 | if (isset($data['event'])) { 51 | $buffer .= "event: {$data['event']}\n"; 52 | } 53 | if (isset($data['data'])) { 54 | $buffer .= 'data: ' . \str_replace("\n", "\ndata: ", $data['data']) . "\n\n"; 55 | } 56 | if (isset($data['id'])) { 57 | $buffer .= "id: {$data['id']}\n"; 58 | } 59 | if (isset($data['retry'])) { 60 | $buffer .= "retry: {$data['retry']}\n"; 61 | } 62 | return $buffer; 63 | } 64 | } -------------------------------------------------------------------------------- /third/Workerman/Protocols/Text.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | /** 17 | * Text Protocol. 18 | */ 19 | class Text { 20 | 21 | /** 22 | * Check the integrity of the package. 23 | * 24 | * @param string $buffer 25 | * @param ConnectionInterface $connection 26 | * @return int 27 | */ 28 | public static function input($buffer = NULL, $connection = NULL) { 29 | var_dump("input"); 30 | return strlen($buffer); 31 | // Judge whether the package length exceeds the limit. 32 | if (isset($connection->maxPackageSize) && \strlen($buffer) >= $connection->maxPackageSize) { 33 | $connection->close(); 34 | return 0; 35 | } 36 | // Find the position of "\n". 37 | $pos = \strpos($buffer, "\n"); 38 | // No "\n", packet length is unknown, continue to wait for the data so return 0. 39 | if ($pos === false) { 40 | return 0; 41 | } 42 | // Return the current package length. 43 | return $pos + 1; 44 | } 45 | 46 | /** 47 | * Encode. 48 | * 49 | * @param string $buffer 50 | * @return string 51 | */ 52 | public static function encode($buffer) { 53 | var_dump("encode"); 54 | // Add "\n" 55 | return $buffer . "\n"; 56 | } 57 | 58 | /** 59 | * Decode. 60 | * 61 | * @param string $buffer 62 | * @return string 63 | */ 64 | public static function decode($buffer) { 65 | var_dump("decode"); 66 | // Remove "\n" 67 | return \rtrim($buffer, "\r\n"); 68 | } 69 | } -------------------------------------------------------------------------------- /templates/admin/ornament_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 摆件列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 22 | 23 | 26 | 27 | 30 | 31 | 34 | 35 | 36 | 37 |
14 | +创建新摆件 15 |
20 | () 21 | 24 | 放置 25 | 28 | 移除 29 | 32 | 删除 33 |
38 |
39 |
40 | 返回地图 41 |
42 |
-------------------------------------------------------------------------------- /third/Workerman/Autoloader.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman; 15 | 16 | /** 17 | * Autoload. 18 | */ 19 | class Autoloader { 20 | 21 | /** 22 | * Autoload root path. 23 | * 24 | * @var string 25 | */ 26 | protected static $_autoloadRootPath = ''; 27 | 28 | /** 29 | * Set autoload root path. 30 | * 31 | * @param string $root_path 32 | * @return void 33 | */ 34 | public static function setRootPath($root_path) { 35 | self::$_autoloadRootPath = $root_path; 36 | } 37 | 38 | /** 39 | * Load files by namespace. 40 | * 41 | * @param string $name 42 | * @return boolean 43 | */ 44 | public static function loadByNamespace($name) { 45 | $class_path = \str_replace('\\', \DIRECTORY_SEPARATOR, $name); 46 | if (\strpos($name, 'Workerman\\') === 0) { 47 | $class_file = __DIR__ . \substr($class_path, \strlen('Workerman')) . '.php'; 48 | } else { 49 | if (self::$_autoloadRootPath) { 50 | $class_file = self::$_autoloadRootPath . \DIRECTORY_SEPARATOR . $class_path . '.php'; 51 | } 52 | if (empty($class_file) || ! \is_file($class_file)) { 53 | $class_file = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . "$class_path.php"; 54 | } 55 | } 56 | 57 | if (\is_file($class_file)) { 58 | require_once ($class_file); 59 | if (\class_exists($name, false)) { 60 | return true; 61 | } 62 | } 63 | return false; 64 | } 65 | } 66 | 67 | \spl_autoload_register('\Workerman\Autoloader::loadByNamespace'); -------------------------------------------------------------------------------- /game/Handlers/Guaiwu.php: -------------------------------------------------------------------------------- 1 | game->db; 16 | $player = \player\getPlayerById($db, $this->uid(), true); 17 | $nowmid = $this->params['nowmid'] ?? 0; 18 | $gid = $this->params['gid'] ?? 0; 19 | $gyid = $this->params['gyid'] ?? 0; 20 | $data = []; 21 | $guaiwu = \player\getMidGuaiwu($this->db(), $gid); 22 | $yguaiwu = \player\getGuaiwu($gyid,$db); 23 | $level = []; 24 | if ($yguaiwu->manualLevelId > 0) { 25 | $manualLevel = $db->get('manual_level', '*', ['id' => $yguaiwu->manualLevelId]); 26 | $level['jingjie'] = Layer::name($manualLevel['layer']); 27 | } 28 | 29 | $pvecmd = $this->encode("cmd=do-pve&gid=$gid&begin=1&nowmid=$nowmid"); 30 | 31 | $area = $this->getAreaInfoByMid($guaiwu->mid); 32 | $daojuArr = $this->db()->select('loot', '*', [ 33 | 'OR' => [ 34 | 'loot.monster_id' => $yguaiwu->id, 35 | 'AND' => [ 36 | 'loot.area_id' => $area['area_id'], 37 | 'loot.monster_id' => 0, 38 | ] 39 | ], 40 | 'ORDER' => ['loot.monster_id' => 'DESC'], 41 | ]); 42 | 43 | $daoju = []; 44 | foreach ($daojuArr as $v) { 45 | $id = $v['item_id']; 46 | if (!isset($daoju[$id])) { 47 | $daoju[$id] = $v; 48 | } 49 | } 50 | 51 | $data['daoju'] = array_values($daoju); 52 | $data['pvecmd'] = $pvecmd; 53 | $data['yguaiwu'] = $yguaiwu; 54 | $data['guaiwu'] = $guaiwu; 55 | $data['levelInfo'] = $level; 56 | $data['canBattle'] = $nowmid == $player->nowmid; 57 | 58 | $this->display('ginfo', $data); 59 | } 60 | } -------------------------------------------------------------------------------- /templates/market/item_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 | 全部 9 | 10 | 全部 11 | 12 | - 13 | 14 | 装备 15 | 16 | 装备 17 | 18 | - 19 | 20 | 药品 21 | 22 | 药品 23 | 24 | - 25 | 26 | 道具 27 | 28 | 道具 29 | 30 |
31 |
32 |
    33 | $v):?> 34 |
  • 35 | [] x(单价:) 36 |
  • 37 | 38 |
39 |
40 | 41 | 上一页 42 | 43 | 44 | 下一页 45 | 46 |
47 |
48 | insert('includes/gonowmid', ['show_prev' => false]);?> 49 |
-------------------------------------------------------------------------------- /templates/admin/monster_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 怪物 列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 25 | 28 | 29 | 32 | 33 | 36 | 37 | 38 | 39 |
14 | +创建新怪物 15 |
20 | () - lvl. 21 | 22 | - 23 | 24 | 26 | 放置 27 | 30 | 减少 31 | 34 | 删除 35 |
40 |
41 |
42 | 返回编辑 43 |
44 |
-------------------------------------------------------------------------------- /templates/bag/zhuangbei.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
我的背包
7 |
元宝: uczb?>
8 |
金币: uyxb?>
9 |
负重: /liftingCapacity?>
10 |
11 | 装备 | 道具 | 药品 12 |
13 |
14 | 15 | -
16 | 31 | -
32 | 33 |
34 | 35 |
36 | 37 | 上一页 38 | 39 | 40 | 下一页 41 | 42 |
43 | 44 | insert('includes/gonowmid');?> 45 |
-------------------------------------------------------------------------------- /templates/admin/operation_list.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 操作列表 ] 8 |
9 |
10 | 11 | 12 | 13 | 16 | 17 | $v):?> 18 | 19 | 26 | 27 | 30 | 31 | 34 | 35 | 38 | 39 | 40 | 41 |
14 | +创建新操作 15 |
20 | 21 | 22 | () 23 | 24 | () 25 | 28 | 添加 29 | 32 | 移除 33 | 36 | 删除 37 |
42 |
43 |
44 | 返回上页 45 |
46 |
-------------------------------------------------------------------------------- /game/SessionEncoder.php: -------------------------------------------------------------------------------- 1 | session = $session; 19 | if (!isset($this->session[self::CMD_NEXT_STORAGE_KEY])) { 20 | $this->session[self::CMD_NEXT_STORAGE_KEY] = []; 21 | } 22 | $this->session[self::CMD_CURRENT_STORAGE_KEY] = $this->session[self::CMD_NEXT_STORAGE_KEY]; 23 | $this->session[self::CMD_NEXT_STORAGE_KEY] = []; 24 | if (!isset($this->session[self::CMD_MAX_KEY])) { 25 | $this->session[self::CMD_MAX_KEY] = 1; 26 | } 27 | } 28 | 29 | protected function getMaxCmd() 30 | { 31 | if ($this->session[self::CMD_MAX_KEY] >= 999) { 32 | $this->session[self::CMD_MAX_KEY] = 1; 33 | } 34 | $max = $this->session[self::CMD_MAX_KEY]; 35 | $this->session[self::CMD_MAX_KEY] = $max + 1; 36 | return $max; 37 | } 38 | 39 | /** 40 | * @param string $string 41 | * @return string 42 | */ 43 | public function encode(string $string): string 44 | { 45 | $cmd = $this->getMaxCmd(); 46 | $storage = $this->session[self::CMD_NEXT_STORAGE_KEY]; 47 | $storage[$cmd] = $string; 48 | $this->session[self::CMD_NEXT_STORAGE_KEY] = $storage; 49 | return $cmd; 50 | } 51 | 52 | /** 53 | * @param string $string 54 | * @return string 55 | */ 56 | public function decode(string $string): string 57 | { 58 | $cmd = (int)$string; 59 | if (!isset($this->session[self::CMD_CURRENT_STORAGE_KEY][$cmd])) { 60 | return 'cmd=gomid'; 61 | } 62 | return $this->session[self::CMD_CURRENT_STORAGE_KEY][$cmd]; 63 | } 64 | 65 | /** 66 | * 释放资源 67 | */ 68 | public function __destruct() 69 | { 70 | unset($this->session); 71 | } 72 | } -------------------------------------------------------------------------------- /game/Object/CombatStatus.php: -------------------------------------------------------------------------------- 1 | data); 73 | if (empty($combat)) { 74 | throw new \RuntimeException('Get combat object failed'); 75 | } 76 | return $combat; 77 | } 78 | 79 | /** 80 | * @return bool 删除战斗记录 81 | */ 82 | public function delCombat(): bool 83 | { 84 | $stmt = $this->db->delete('combat', ['id' => $this->id]); 85 | return $stmt->rowCount() > 0; 86 | } 87 | 88 | /** 89 | * @param int $id 90 | * @return CombatStatus 91 | */ 92 | public static function get(Medoo $db, int $id): CombatStatus 93 | { 94 | $arr = $db->get('combat', '*', ['id' => $id]); 95 | if (empty($arr)) { 96 | return new static(); 97 | } 98 | return static::fromArray($arr)->withDatabase($db); 99 | } 100 | } -------------------------------------------------------------------------------- /game/Object/PlayerPartyMember.php: -------------------------------------------------------------------------------- 1 | $id]; 45 | if (!empty($conditions)) { 46 | $where = array_merge($where, $conditions); 47 | } 48 | 49 | $arr = $db->get('player_party_member', '*', $where); 50 | if (empty($arr)) { 51 | return new self(); 52 | } 53 | $pet = self::fromArray($arr)->withDatabase($db); 54 | return $pet; 55 | } 56 | 57 | public static function add(Medoo $db, array $data) 58 | { 59 | $db->insert('player_party_member', $data); 60 | return $db->id(); 61 | } 62 | 63 | public static function update(Medoo $db, int $id, array $data) 64 | { 65 | $db->update('player_party_member', $data, ['id' => $id]); 66 | } 67 | 68 | public static function delete(Medoo $db, array $condition): bool 69 | { 70 | $res = $db->delete('player_party_member', $condition); 71 | if ($res->rowCount()) { 72 | return true; 73 | } 74 | return false; 75 | } 76 | 77 | public static function getMembersByPartyId(Medoo $db, int $partyId, array $status = []) 78 | { 79 | if (!empty($status)) { 80 | $arr = $db->select('player_party_member', [ 81 | 'party_id' => $partyId, 82 | 'status' => $status 83 | ]); 84 | } else { 85 | $arr = $db->select('player_party_member', [ 86 | 'party_id' => $partyId, 87 | ]); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /game/Handlers/Relationship.php: -------------------------------------------------------------------------------- 1 | params['type'] ?? 1; 16 | $players = $this->db()->select('player_relationship', ['[>]game1' => ['tid' => 'id']], [ 17 | 'game1.id', 18 | 'game1.name', 19 | ], [ 20 | 'uid' => $this->uid(), 21 | 'type' => $type, 22 | ]); 23 | $data = []; 24 | $data['players'] = $players; 25 | $data['type'] = $type; 26 | $this->display('friends', $data); 27 | } 28 | 29 | /** 30 | * 添加好友 31 | */ 32 | public function addRelationship() 33 | { 34 | $tid = $this->params['tid'] ?? null; 35 | $type = $this->params['type'] ?? null; 36 | if (!$tid || !$type) { 37 | $this->flash->error('无效参数'); 38 | $this->doRawCmd($this->lastAction()); 39 | } 40 | $exists = $this->db()->count('player_relationship', [ 41 | 'uid' => $this->uid(), 42 | 'tid' => $tid, 43 | 'type' => $type, 44 | ]); 45 | if ($exists) { 46 | $this->flash->error('玩家已在关系列表'); 47 | $this->doRawCmd($this->lastAction()); 48 | } 49 | $this->db()->insert('player_relationship', [ 50 | 'uid' => $this->uid(), 51 | 'tid' => $tid, 52 | 'type' => $type 53 | ]); 54 | 55 | $this->flash->success('添加成功'); 56 | $this->doRawCmd($this->lastAction()); 57 | } 58 | 59 | /** 60 | * 移除关系 61 | */ 62 | public function deleteRelationship() 63 | { 64 | $tid = $this->params['tid'] ?? null; 65 | $type = $this->params['type'] ?? null; 66 | if (!$tid || !$type) { 67 | $this->flash->error('无效参数'); 68 | $this->doRawCmd($this->lastAction()); 69 | } 70 | $this->db()->delete('player_relationship', [ 71 | 'uid' => $this->uid(), 72 | 'tid' => $tid, 73 | 'type' => $type 74 | ]); 75 | $this->flash->success('删除成功'); 76 | $this->doRawCmd($this->lastAction()); 77 | } 78 | } -------------------------------------------------------------------------------- /game/Job/LootItem.php: -------------------------------------------------------------------------------- 1 | db, $itemId); 25 | $player = getPlayerById($this->db, $uid); 26 | $mid = $mid ?: $player->nowmid; 27 | $loc = Location::get($this->db, $mid); 28 | 29 | $v = ['id' => $item->id, 'type' => $item->type]; 30 | if ($item->type == 2) { 31 | $amount = 1; 32 | $source = [ 33 | 'location' => $loc->name, 34 | 'monster' => $monsterName, 35 | 'player' => $player->name, 36 | ]; 37 | // 开启随机属性 38 | $status = \player\addPlayerEquip($this->db, $player->id, $v, $source, true); 39 | } else { 40 | $status = \player\addPlayerStackableItem($this->db, $player->id, $v, $amount); 41 | } 42 | 43 | $messages = []; 44 | $tasks = \player\getUnfinishedTasks($this->db, $player->id); 45 | if (!empty($tasks)) { 46 | //$taskIds = []; 47 | //\player\changeTaskItemCondition($this->db, $taskIds, $itemId, $amount, $player->id); 48 | $conArr = \player\getPlayerUnfinishedTasksConditions($this->db, $player->id, $itemId, 1); 49 | foreach ($conArr as $v) { 50 | $messages[] = [ 51 | 'uid' => 0, 52 | 'tid' => $uid, 53 | 'type' => 2, 54 | 'content' => sprintf('%s/%s(%d/%d)', $v['task_name'], $v['target_name'], $v['amount'], $v['required_amount']), 55 | ]; 56 | } 57 | } 58 | 59 | // 发出通知 60 | if (!empty($messages)) { 61 | $this->db->insert('im', $messages); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /templates/other_zhuangtai.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | getVipName($player)?>
8 | 职业: sex == 1? '男' : '女'?>playerManualName?>
9 | 等级: level?>级
10 | $v) : ?> 11 | 17 | 18 | 19 |
20 | 宝宝: name?> 21 |
22 | 23 | 24 |
25 | 技能: 26 | $v): ?> 27 | () 28 | 29 | . 30 | 31 | 32 |
33 | 34 | partyId):?> 35 |
36 | 队伍: 37 | name?> 38 | 39 | (队长) 40 | 41 |
42 | 43 | 44 | -
45 |
46 | 攻击 47 | 48 | id)?>'>加为好友 49 | 50 | id)?>'>删除好友 51 | 52 |
53 | -
54 | 55 | 56 |
57 | insert('includes/gonowmid');?> 58 |
-------------------------------------------------------------------------------- /templates/pvp_bak.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 | =====战斗=====
5 | uname?> [lv:ulv?>]
6 |
气血:(
uhp?>
/
umaxhp?>
)getMessage('pvperhurt')?> hasMessage('pvpbj') ? '(暴击)' : ''?>
7 | 攻击:(ugj?>)
8 | 防御:(ufy?>)
9 | ===================
10 | uname?> [lv:ulv?>]
11 |
气血:(
uhp?>
/
umaxhp?>
)getMessage('phurt')?> getMessage('pvpxx')?>
12 | 攻击:(ugj?>)
13 | 防御:(ufy?>)
14 |
15 | 20 |
21 |
22 |
23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 |
33 | insert('includes/message'); ?> 34 |
-------------------------------------------------------------------------------- /templates/admin/show_create_npc.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 |
9 | 12 | 13 |
14 |
15 | 18 | 19 |
20 |
21 | 24 | 25 |
26 |
27 | 30 | 31 |
32 |
33 | 36 |
37 |
38 |
39 | 40 |
41 | 返回列表 42 |
43 | -------------------------------------------------------------------------------- /game/Combat/PlayerAttacker.php: -------------------------------------------------------------------------------- 1 | 'name', 11 | 'level' => 'level', 12 | 'hp' => 'hp', 13 | 'maxHp' => 'maxhp', 14 | 'baqi' => 'baqi', 15 | 'wugong' => 'wugong', 16 | 'wufang' => 'wufang', 17 | 'fagong' => 'fagong', 18 | 'fafang' => 'fafang', 19 | 'baoji' => 'baoji', 20 | 'shenming' => 'shenming', 21 | 'mingzhong' => 'mingzhong', 22 | 'shanbi' => 'shanbi', 23 | ]; 24 | 25 | /** 26 | * @var Player 27 | */ 28 | public $player; 29 | 30 | /** 31 | * @var array 32 | */ 33 | public $skillStatus = []; 34 | 35 | /** 36 | * @var array 37 | */ 38 | public $itemStatus = []; 39 | 40 | /** 41 | * @param Player $player 42 | * @param array $shortCuts 43 | */ 44 | public static function fromPlayer(Player $player, array $shortCuts = []) 45 | { 46 | $attacker = new PlayerAttacker(); 47 | $attacker->id = $player->id; 48 | $attacker->type = self::TYPE_PLAYER; 49 | $attacker->player = $player; 50 | // 设置属性 51 | foreach (self::$map as $k1 => $k2) { 52 | $attacker->$k1 = $player->$k2 ?? 0; 53 | } 54 | if (empty($shortCuts)) { 55 | for ($i = 0; $i < 6; $i++) { 56 | $attacker->shortcuts->attach(new Shortcut(['index' => $i + 1, 'name' => sprintf('快捷键%d', $i + 1)]), $i + 1); 57 | } 58 | } else { 59 | // 设置快捷键 60 | foreach ($shortCuts as $k => $v) { 61 | $attacker->shortcuts->attach(new Shortcut($v), $k + 1); 62 | } 63 | } 64 | return $attacker; 65 | } 66 | 67 | /** 68 | * 保存属性 69 | */ 70 | public function saveStatus() 71 | { 72 | foreach (self::$map as $k1 => $k2) { 73 | $this->player->$k2 = $this->$k1; 74 | } 75 | } 76 | 77 | public function getRawObject() 78 | { 79 | return $this->player; 80 | } 81 | 82 | public function setSkillStatus(int $playerSkillId, int $round) 83 | { 84 | $this->skillStatus[$playerSkillId] = $round; 85 | } 86 | 87 | public function setItemStatus(int $playerItemId, int $round) 88 | { 89 | $this->itemStatus[$playerItemId] = $round; 90 | } 91 | } -------------------------------------------------------------------------------- /game/Task/Runner.php: -------------------------------------------------------------------------------- 1 | redisPool = $redisPool; 32 | $this->resqueConfigs = $resqueConfigs; 33 | $this->heap = new Heap(); 34 | } 35 | 36 | /** 37 | * @param AbstractTask $task 38 | */ 39 | public function addTask(AbstractTask $task) 40 | { 41 | $this->heap->insert($task); 42 | } 43 | 44 | public function execute() 45 | { 46 | while (!$this->stop) { 47 | do { 48 | // 没有要执行的任务 49 | if ($this->heap->isEmpty()) { 50 | break; 51 | } 52 | // 获取 redis 实例 53 | $redis = $this->redisPool->get(); 54 | if (!$redis) { 55 | break; 56 | } 57 | $client = new ResqueClient($redis, $this->resqueConfigs); 58 | $now = time(); 59 | /** @var AbstractTask $task */ 60 | while ($task = $this->heap->top()){ 61 | // 检查对顶的时间戳 62 | if ($task->timestamp > $now) { 63 | break; 64 | } 65 | // 弹出任务 66 | $task = $this->heap->extract(); 67 | try { 68 | $task->run($client); 69 | // 更新下次执行时间 70 | if (!$task->isOnce) { 71 | $task->timestamp = $now + $task->duration; 72 | $this->heap->insert($task); 73 | } 74 | } catch (\Exception $e) { 75 | if (DEBUG) { 76 | error_log($e->getMessage()); 77 | } 78 | } 79 | } 80 | } while (0); 81 | isset($redis) && $redis && $this->redisPool->put($redis); 82 | sleep(1); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /game/Combat/Shortcut.php: -------------------------------------------------------------------------------- 1 | effects = new SplObjectStorage(); 55 | foreach ($columns as $k => $v) { 56 | if (isset($this->$k)) { 57 | $this->$k = $v; 58 | continue; 59 | } 60 | if (strpos($k, 'e_') === false) { 61 | continue; 62 | } 63 | $effectColumn = $this->format($k); 64 | $this->effects->attach(new BaseEffect($effectColumn, $v)); 65 | } 66 | } 67 | 68 | public function trigger(Attacker $attacker) 69 | { 70 | $logs = []; 71 | /** @var EffectInterface $effect */ 72 | foreach ($this->effects as $effect) { 73 | $logs[] = $effect->addTo($attacker); 74 | } 75 | $attacker->currentShortcut = 0; 76 | return $logs; 77 | } 78 | 79 | /** 80 | * @param string $key 81 | * @return string 82 | */ 83 | protected function format(string $key): string 84 | { 85 | $key = substr($key, 2); 86 | $words = explode('_', $key); 87 | if (count($words) === 1) { 88 | return $words[0]; 89 | } 90 | $key = array_shift($words); 91 | foreach ($words as $word) { 92 | $key .= ucfirst($word); 93 | } 94 | return $key; 95 | } 96 | 97 | /** 98 | * @return bool 是否定义 99 | */ 100 | public function isDefined() 101 | { 102 | return $this->type !== self::TYPE_UNDEFINED; 103 | } 104 | } -------------------------------------------------------------------------------- /templates/admin/show_create_condition.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 |
9 | 12 | 13 |
14 |
15 | 18 | 19 |
20 |
21 | 24 | 25 |
26 |
27 | 30 | 31 |
32 |
33 | 36 |
37 |
38 |
39 |
40 | 返回列表 41 |
42 | -------------------------------------------------------------------------------- /templates/club.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 |
4 |
5 | [ 6 | 门派 clubname ?? ''?> 7 | ] 8 |
9 |
10 | 11 | =========选择任职人员=========
12 | 13 | '>
14 | 15 | 16 | 创建者:name?>
17 | 门派资金:金币[clubyxb?>] 元宝[clubczb?>]
18 | 建设度:clubexp?>
19 | 门派介绍:
clubinfo?>
20 | uid && $is_member) :?> 21 |
22 | uclv == 1): ?> 23 | 任职 24 | 解散
25 | 26 | 判出
27 | 28 |
29 | 30 |
31 | 32 | 申请加入
33 | 34 |
35 | 36 | 37 |
38 | 39 | '>任职
40 | 41 |
42 | 43 | 44 | 门派成员:
45 | 46 | '>[]
47 | 48 | 49 | 你现在还没有门派呢!
50 | 加入门派 51 | 52 |
53 | 54 | insert('includes/message'); ?> 55 | insert('includes/gonowmid', ['gonowmid' => $gonowmid]);?> 56 |
-------------------------------------------------------------------------------- /game/Object/Location.php: -------------------------------------------------------------------------------- 1 | get('mid', [ 103 | 'mid(id)', 104 | 'mname(name)', 105 | 'midinfo(info)', 106 | 'mgid(monsterIds)', 107 | 'mnpc(npcIds)', 108 | 'mup(up)', 109 | 'mdown(down)', 110 | 'mleft(left)', 111 | 'mright(right)', 112 | 'mqy(areaId)', 113 | 'mgtime(lastRefreshTime)', 114 | 'ms(refreshDuration)', 115 | 'playerinfo(playerInfo)', 116 | 'ispvp', 117 | 'resources', 118 | 'lingqi', 119 | 'enter_condition', 120 | 'ornaments' 121 | ], ['mid' => $id]); 122 | if (empty($arr)) { 123 | return new self(); 124 | } 125 | return self::fromArray($arr)->withDatabase($db); 126 | } 127 | } -------------------------------------------------------------------------------- /templates/djinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ uiName?> ]
7 | amount > 0):?> 8 | 数量:amount?: 0?>
9 | 10 | 价格:price?>金币
11 | 绑定:
12 | info?> 13 |
14 | amount > 0):?> 15 | 16 |

17 | 18 | 19 | 20 | 21 |

使用后可获得:

22 | 23 |
-
24 | 25 | 26 | 27 | 28 | type ==1 && $item->subType == 1 && $playerItem->amount > 0):?> 29 | -
30 |

使用后加入职业:

31 | 32 | -
33 | 34 | 35 | type ==1 && $item->subType == 2 && $playerItem->amount > 0):?> 36 | -
37 |

使用后学习技能: (级)

38 | 39 | -
40 | 41 | 42 | amount > 0 && !$is_bound && $item->isSellable): ?> 43 | -
44 |
id)?>" method="POST"> 45 | 寄售数量:
46 |
47 | 寄售单价:
48 | 49 |
50 | 51 |
52 |
53 | -
54 | 55 | insert('includes/gonowmid');?> 56 |
-------------------------------------------------------------------------------- /configs/resque-example.yml: -------------------------------------------------------------------------------- 1 | # //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ 2 | # 3 | # php-resque configuration file 4 | # 5 | # This is the default configuration for your php-resque application 6 | # Most of these settings can be overriden through their corresponding 7 | # option flag when running a command 8 | # 9 | # //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ 10 | 11 | 12 | include: game/resque.php # A file to include on each command 13 | 14 | 15 | redis: 16 | scheme: tcp # The connection scheme 17 | host: 127.0.0.1 # The hostname to connect to 18 | port: 6379 # The port to connect to 19 | password: 123456 20 | namespace: resque # The key prefix in Redis 21 | rw_timeout: 60 # Redis read/write timeout 22 | phpiredis: false # Should use phpiredis php extension (must be installed) 23 | 24 | 25 | # default: 26 | # expiry_time: 604800 # Default expiry time of Redis keys 27 | # verbose: 1 # quiet=0, normal=1, verbose=2, very_verbose=3, debug=4 28 | # jobs: 29 | # queue: default # Defalt queue to add a job to 30 | # delay: false # Default delay to add to jobs false=no delay 31 | # workers: 32 | # queue: "*" # Default queue to watch, *=all queues 33 | # blocking: true # Use Redis blocking 34 | # interval: 10 # Worker interval (seconds) 35 | # timeout: 60 # Job timeout (seconds) 36 | # memory: 128 # Max worker memory 37 | 38 | 39 | log: 40 | #console: true # Output log to console 41 | #off: true # Don't log 42 | #stream: output.log # Log to file 43 | rotate: 5:storage/resque.log # Log to file and rotate files 44 | #redis: 127.0.0.1:6379/resque # Store in Redis 45 | #mongodb: 127.0.0.1:27017/dbname/resque # Store in MongoDB 46 | #couchdb: 127.0.0.1:27017/dbname # Store in CouchDB 47 | #amqp: 127.0.0.1:5763/name # Send to AMQP 48 | #socket: udp://127.0.0.1:80 # Send to socket 49 | #syslog: myfacility/local6 # Send to Syslog 50 | #errorlog: 0 # Send to error_log 51 | #cube: udp://localhost:5000 # Send to cube server 52 | 53 | 54 | # socket: 55 | # listen: 56 | # host: 0.0.0.0 # 57 | # port: 7370 # 58 | # timeout: 10 # 59 | # retry: 10 # 60 | # connect: 61 | # host: 127.0.0.1 # 62 | # port: 7370 # 63 | # timeout: 10 # 64 | # json: false # 65 | 66 | 67 | # That's all folks! \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ -------------------------------------------------------------------------------- /templates/party/member.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [我的队友] 刷新 8 |
9 |
10 | -
11 | 12 | 你暂时还没有加入小队。
13 | 14 |
    15 | $v): ?> 16 |
  • 17 | [] name?> 18 | (uid != $party->uid ? $v->statusText : '队长'?>) 19 | 20 | status && $v->uid != $party->uid):?> 21 | 移除 22 | status == 0):?> 23 | 通过 24 | 拒绝 25 | 26 | uid == $player->id):?> 27 | status == 2):?> 28 | 取消跟随 29 | 30 | status == 1):?> 31 | 跟随 32 | 33 | 退出 34 | 35 | 36 |
  • 37 | 38 |
39 | 40 | -
41 | 42 | isClosed):?> 43 | 开启申请 44 | 45 | 关闭申请 46 | 47 | 解散队伍 48 | 49 | 组队大厅 50 |
51 | insert('includes/gonowmid', ['show_prev' => false]);?> 52 |
-------------------------------------------------------------------------------- /game/Handlers/Rank.php: -------------------------------------------------------------------------------- 1 | display('rank'); 14 | } 15 | 16 | public function showLevelRank() 17 | { 18 | $db = $this->game->db; 19 | $player = \player\getPlayerById($db, $this->uid(), true); 20 | 21 | $ret = $db->select('game1', '*', [ 22 | 'ORDER' => ['level' => 'DESC', 'exp' => 'ASC'], 23 | 'LIMIT' => 10] 24 | ); 25 | $gonowmid = $this->encode("cmd=gomid&newmid=$player->nowmid"); 26 | 27 | $top = []; 28 | for ($i = 0; $i < count($ret); $i++) { 29 | $clubName = ''; 30 | $uname = $ret[$i]['name']; 31 | $ulv = $ret[$i]['level']; 32 | $uid = $ret[$i]['id']; 33 | $vip = $ret[$i]['vip']; 34 | $clubp = \player\getclubplayer_once($this->db(), $uid); 35 | if ($clubp) { 36 | $club = \player\getclub($clubp->clubid, $db); 37 | $clubName = $club->clubname; 38 | } 39 | $top[] = [ 40 | 'lv' => $ulv, 41 | 'info_link' => $this->encode("cmd=getplayerinfo&uid=$uid"), 42 | 'club' => $clubName ?: '', 43 | 'name' => $uname, 44 | 'vip' => $vip, 45 | ]; 46 | } 47 | $data = []; 48 | $data['top'] = $top; 49 | $data['gonowmid'] = $gonowmid; 50 | $this->display('ranks/level', $data); 51 | } 52 | 53 | public function showFortuneRank() 54 | { 55 | $db = $this->game->db; 56 | $ret = $db->select('game1', ['id', 'name', 'uyxb', 'vip'], [ 57 | 'uyxb[>]' => 10000, 58 | 'ORDER' => ['uyxb' => 'DESC', 'id' => 'ASC'], 59 | 'LIMIT' => 10 60 | ]); 61 | 62 | $top = []; 63 | for ($i = 0; $i < count($ret); $i++) { 64 | $clubName = ''; 65 | $uname = $ret[$i]['name']; 66 | $uid = $ret[$i]['id']; 67 | $vip = $ret[$i]['vip']; 68 | $clubp = \player\getclubplayer_once($this->db(), $uid); 69 | if ($clubp) { 70 | $club = \player\getclub($clubp->clubid, $db); 71 | $clubName = $club->clubname; 72 | } 73 | $top[] = [ 74 | 'info_link' => $this->encode("cmd=getplayerinfo&uid=$uid"), 75 | 'club' => $clubName ?: '', 76 | 'name' => $uname, 77 | 'money' => floor($ret[$i]['uyxb'] / 10000), 78 | 'vip' => $vip, 79 | ]; 80 | } 81 | $data = []; 82 | $data['top'] = $top; 83 | $this->display('ranks/fortune', $data); 84 | } 85 | } -------------------------------------------------------------------------------- /templates/admin/ornament.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | [ 8 | 9 | ] 10 |
11 |
12 | 13 |
14 | 15 |
16 | 操作列表: 17 | 18 | 19 | $v):?> 20 | 21 | 24 | 27 | 28 | 29 | 30 |
22 | () 23 | 25 | 移除 26 |
31 |
32 | 33 |
34 |
35 |
36 |
37 | 显示条件: 38 |
39 | 40 | 41 | 42 | 51 | 54 | 55 | 56 |
43 | 44 | 45 | 46 | 47 | 条件() 48 | 49 | 50 | 52 | 移除 53 |
57 | 58 |
59 |
60 |
61 |
62 | [编辑摆件] - 63 | [添加操作] 64 |
65 | 66 | 70 |
71 | 72 | -------------------------------------------------------------------------------- /game/Handlers/Admin/Area.php: -------------------------------------------------------------------------------- 1 | db()->select('qy', [ 16 | 'qyid(id)', 17 | 'qyname(name)', 18 | 'mid', 19 | 'teleport', 20 | 'type', 21 | ]); 22 | $data = []; 23 | $data['areas'] = $areas; 24 | $this->display('admin/area_list', $data); 25 | } 26 | 27 | public function showCreate() 28 | { 29 | $id = $this->params['id'] ?? 0; 30 | $area = []; 31 | if ($id) { 32 | $area = $this->db()->get('qy', [ 33 | 'qyid(id)', 34 | 'qyname(name)', 35 | 'mid', 36 | 'teleport', 37 | 'type', 38 | ], ['qyid' => $id]); 39 | } 40 | $data = []; 41 | $data['area'] = $area; 42 | $this->display('admin/show_create_area', $data); 43 | } 44 | 45 | public function save() 46 | { 47 | $id = Helper::filterVar($this->postParam('id'), 'INT'); 48 | $create = empty($id); 49 | $arr = [ 50 | 'qyname' => Helper::filterVar($this->postParam('name'), 'STRING'), 51 | 'mid' => Helper::filterVar($this->postParam('mid'), 'INT'), 52 | 'teleport' => Helper::filterVar($this->postParam('teleport'), 'INT'), 53 | 'type' => Helper::filterVar($this->postParam('type'), 'INT'), 54 | ]; 55 | if (empty($id) && $arr['teleport']) { 56 | $arr['teleport'] = 0; 57 | } 58 | if ($id && $arr['teleport'] == 0) { 59 | $this->flash->error('必须设置传送点'); 60 | $this->doRawCmd($this->lastAction()); 61 | } 62 | if (empty($id)) { 63 | $this->db()->insert('qy', $arr); 64 | $id = $this->db()->id(); 65 | } else { 66 | $this->db()->update('qy', $arr, ['qyid' => $id]); 67 | } 68 | if ($create) { 69 | $this->db()->insert('mid', [ 70 | 'mname' => $arr['qyname'] . '_传送点', 71 | 'mqy' => $id, 72 | ]); 73 | $teleportId = $this->db()->id(); 74 | $this->db()->update('qy', ['teleport' => $teleportId], ['qyid' => $id]); 75 | } 76 | $this->flash->success('操作成功'); 77 | $this->doRawCmd('cmd=admin-area-list'); 78 | } 79 | 80 | public function delete() 81 | { 82 | $id = $this->params['id'] ?? 0; 83 | $this->db()->delete('qy', ['qyid' => $id]); 84 | $this->flash->success('删除成功'); 85 | $this->doRawCmd('cmd=admin-area-list'); 86 | } 87 | } -------------------------------------------------------------------------------- /templates/admin/show_create_area.php: -------------------------------------------------------------------------------- 1 | layout('layout') ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | 8 |
9 | 12 | 13 |
14 |
15 | 18 | 27 |
28 |
29 | 32 | 33 |
34 |
35 | 38 | 39 |
40 |
41 | 44 |
45 |
46 |
47 | 48 |
49 | 返回列表 50 |
51 | -------------------------------------------------------------------------------- /templates/zbinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
7 | getPlayerEquipName($zhuangbei)?> 8 |
9 | 等级: level?>
10 | 价格: price?>
11 | sex)):?> 12 | 性别: sex == 1 ? '男': '女'?>
13 | 14 | 类型:
15 | manualId)):?> 16 | 职业: manualId]?>
17 | 18 | 绑定:
19 | info)):?> 20 | info?>
21 | 22 | 基础属性:
23 | $v): ?> 24 | $k) && ($zhuangbei->$k > 0 || $zhuangbei->{"quality" . ucfirst($k)} > 0)) :?> 25 |
26 | : $k + $zhuangbei->{"quality" . ucfirst($k)}) * (1 + 0.1 * $zhuangbei->qianghua))?> 27 |
28 | 29 | 30 | quality)):?> 31 | 品质加成:
32 | $v): ?> 33 | {"quality" . ucfirst($k)})) :?> 34 |
: {"quality" . ucfirst($k)}?>
35 | 36 | 37 | 38 | keywords)):?> 39 | 特殊属性:
40 | keywords as $v):?> 41 |
42 | 43 | 44 | 装备来源:
45 |
46 | 地图: sourceLocation ?: '未知'?>
47 | 对象: sourceMonster ?: '未知'?>
48 | 玩家: sourcePlayer ?: '未知'?>
49 | 时间: sourceTimestamp?> 50 |
51 | 52 | 53 | -
54 |
id)?>" method="POST"> 55 | 56 | 寄售价格:
57 | 58 |
59 | 60 |
61 |
62 | -
63 | 64 | 65 | insert('includes/gonowmid');?> 66 |
-------------------------------------------------------------------------------- /templates/sys_djinfo.php: -------------------------------------------------------------------------------- 1 | layout('layout', ['pvp' => $pvp ?? [], 'tupo' => $tupo ?? null]) ?> 2 | 3 | insert('includes/message'); ?> 4 | 5 |
6 |
[ uiName?> ]
7 | isBound):?> 8 | 9 | type == 2):?> 10 | 等级: level?>
11 | 价格: price?>
12 | sex)):?> 13 | 性别: sex == 1 ? '男': '女'?>
14 | 15 | 类型:
16 | manualId)):?> 17 | 职业: manualId]?>
18 | 19 | 绑定: isBound ? '是' : '否'?>
20 | info)):?> 21 | info?>
22 | 23 | 基础属性:
24 | $v): ?> 25 | $k) && $zhuangbei->$k > 0) :?> 26 |
: $k?>
27 | 28 | 29 | keywords)):?> 30 | 特殊属性:
31 | keywords as $v):?> 32 |
33 | 34 | 35 | type == 3):?> 36 |
    37 | effects as $effect): ?> 38 | isColumn): ?> 39 |
  • 40 | desc, $effect->amount)?> 41 | turns > 1):?> 42 | ,持续turns?>回合 43 | 44 | isRaw || $effect->turns > 1): ?> 45 | (仅在战斗中生效) 46 | 47 |
  • 48 | isCustom): ?> 49 |
  • 50 | 使用后获得「info?>」效果 51 | isTemporary):?> 52 | ,持续时间duration?>秒 53 | 54 |
  • 55 | 56 | 57 |
58 | 59 | info?> 60 | 61 | 62 | 63 |

使用后可获得:

64 | 65 |
-
66 | 67 | 68 | 69 | insert('includes/gonowmid');?> 70 |
-------------------------------------------------------------------------------- /game/rr_worker.php: -------------------------------------------------------------------------------- 1 | acceptRequest()) { 39 | try { 40 | $container = new Collection(); 41 | // 检查请求是否携带 session 相关的 Cookie 42 | $cookies = $req->getCookieParams(); 43 | $session = new Session($redis); 44 | $cookies = $req->getCookieParams(); 45 | if ($sessionId = $cookies[$session->getName()] ?? null) { 46 | $session->setId($sessionId); 47 | } 48 | $session->start(); 49 | 50 | $container['session'] = $session; 51 | $container['db'] = Helper::$db; 52 | $container['resque'] = new ResqueClient($redis, $resqueConfigs); 53 | $container['request'] = $req; 54 | $game = new Game($container); 55 | $game->registerRouters($routers); 56 | 57 | // 处理请求 58 | $queryString = http_build_query($req->getQueryParams()); 59 | $game->setRequest($req); 60 | $response = $game->handle($queryString); 61 | if (!$sessionId) { 62 | $cookie = new SetCookie( 63 | $session->getName(), 64 | $session->getId(), 65 | time() + 3600 * 24, 66 | '/', 67 | '', 68 | false, 69 | true, 70 | 'strict' 71 | ); 72 | $response = $cookie->addToResponse($response); 73 | } 74 | $psr7->respond($response); 75 | } catch (\Throwable $e) { 76 | if (DEBUG) { 77 | $content = $e->getMessage(); 78 | } else { 79 | $content = '500 Internal Server Error'; 80 | } 81 | $response = new Response($content, 500); 82 | $psr7->respond($response); 83 | } finally { 84 | if (isset($session) && $session->isStarted()) { 85 | $session->commit(); 86 | } 87 | unset($session); 88 | unset($container); 89 | if (isset($game)) { 90 | $game->saveAction(); 91 | unset($game); 92 | } 93 | } 94 | } --------------------------------------------------------------------------------