GameConfig.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. <?php
  2. ////////////////////
  3. // 由CodeGenerator创建。
  4. // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  5. // author: gwang
  6. // 日期: 2024-08-28 17:03:02
  7. ////////////////////
  8. /**
  9. * 常量配置数据
  10. */
  11. class GameConfig {
  12. // <editor-fold defaultstate="collapsed" desc=" 基础代码 ">
  13. /**
  14. * 是否启用codegen
  15. */
  16. private static function isCG() {
  17. return defined('CodeGen_Enabled') && CodeGen_Enabled;
  18. }
  19. /**
  20. * @var bool 分区是否使用独立的常量配置数据
  21. */
  22. private static $useZoneId = false;
  23. /**
  24. * 追加分区列表字符串
  25. * @return string
  26. */
  27. private static function zoneid()
  28. {
  29. global $zoneid;
  30. return self::$useZoneId ? "-zone$zoneid" : "";
  31. }
  32. /**
  33. * @return ClientVersion
  34. */
  35. private static function CV() {
  36. return req() ? req()->CV . '-' : "";
  37. }
  38. /**
  39. * 初始化指定变量, 非null的情况下直接跳出
  40. * 可能从文件中或者redis中获取原始数据对变量进行初始化
  41. * @param mixed $a 变量
  42. * @param string $modelName 用来初始化变量的资源名称
  43. * @param bool $isHash 数据是否采用hash结构(否:普通字符串)
  44. */
  45. static private function initValue(&$a, $modelName, $isHash = true) {
  46. $key = 'gamecfg-' . self::CV() . $modelName . self::zoneid();
  47. if (is_null($a)) {
  48. if (self::isCG()) {
  49. $a = include $key . '.php';
  50. if ($isHash) {
  51. $para = is_array($a) ? $a : (array) $a; # 转关联数组
  52. foreach ($para as $name => &$value) {
  53. $value = JsonUtil::decode($value); # 取参数中的或者默认值
  54. }
  55. $a = arr2obj($para);
  56. }
  57. } else {
  58. $a = $isHash ? gMem()->hgetall($key) : gMem()->get($key);
  59. }
  60. }
  61. return $a;
  62. }
  63. /**
  64. * 获取hash结构的一个item
  65. * @param string $modelName 模块名称
  66. * @param mixed/string/int $itemId 索引
  67. * @return mixed
  68. */
  69. private static function get_hash_item($modelName, $itemId) {
  70. if (self::isCG()) {
  71. $data = self::$modelName();
  72. if (property_exists($data, $itemId)) {
  73. return $data->$itemId;
  74. }
  75. } else {
  76. $key = 'gamecfg-' . self::CV() . $modelName . self::zoneid();
  77. return gMem()->hget($key, $itemId);
  78. }
  79. return null;
  80. }
  81. // </editor-fold>
  82. /**
  83. * 全局参数
  84. * @return \globalsettings
  85. */
  86. public static function globalsettings()
  87. {
  88. static $a = null;
  89. return self::initValue($a, 'globalsettings');
  90. }
  91. /**
  92. * 停服计划
  93. * @return \service_schedule
  94. */
  95. public static function service_schedule()
  96. {
  97. static $a = null;
  98. return self::initValue($a, 'service_schedule');
  99. }
  100. /**
  101. * @return \sm_service_schedule service_schedule item数据
  102. */
  103. public static function service_schedule_getItem($itemid)
  104. {
  105. return self::get_hash_item('service_schedule', $itemid);
  106. }
  107. /**
  108. * 道具表
  109. * @return \item
  110. */
  111. public static function item()
  112. {
  113. static $a = null;
  114. return self::initValue($a, 'item');
  115. }
  116. /**
  117. * @return \sm_item item item数据
  118. */
  119. public static function item_getItem($itemid)
  120. {
  121. return self::get_hash_item('item', $itemid);
  122. }
  123. /**
  124. * 系统邮件
  125. * @return \sysmail
  126. */
  127. public static function sysmail()
  128. {
  129. static $a = null;
  130. return self::initValue($a, 'sysmail');
  131. }
  132. /**
  133. * @return \sm_sysmail sysmail item数据
  134. */
  135. public static function sysmail_getItem($itemid)
  136. {
  137. return self::get_hash_item('sysmail', $itemid);
  138. }
  139. /**
  140. * 客户端版本信息
  141. * @return \clientVersionHistory
  142. */
  143. public static function clientVersionHistory()
  144. {
  145. static $a = null;
  146. return self::initValue($a, 'clientVersionHistory');
  147. }
  148. /**
  149. * @return \sm_clientVersionHistory clientVersionHistory item数据
  150. */
  151. public static function clientVersionHistory_getItem($itemid)
  152. {
  153. return self::get_hash_item('clientVersionHistory', $itemid);
  154. }
  155. /**
  156. * 错误信息表
  157. * @return \errmsg
  158. */
  159. public static function errmsg()
  160. {
  161. static $a = null;
  162. return self::initValue($a, 'errmsg');
  163. }
  164. /**
  165. * @return \sm_errmsg errmsg item数据
  166. */
  167. public static function errmsg_getItem($itemid)
  168. {
  169. return self::get_hash_item('errmsg', $itemid);
  170. }
  171. /**
  172. * 技能表
  173. * @return \skills
  174. */
  175. public static function skills()
  176. {
  177. static $a = null;
  178. return self::initValue($a, 'skills');
  179. }
  180. /**
  181. * @return \sm_skills skills item数据
  182. */
  183. public static function skills_getItem($itemid)
  184. {
  185. return self::get_hash_item('skills', $itemid);
  186. }
  187. /**
  188. * 战斗: 波次表
  189. * @return \waves
  190. */
  191. public static function waves()
  192. {
  193. static $a = null;
  194. return self::initValue($a, 'waves');
  195. }
  196. /**
  197. * @return \sm_waves waves itemArray
  198. */
  199. public static function waves_getItemArray($key)
  200. {
  201. return self::get_hash_item('waves', $key);
  202. }
  203. /**
  204. * 活动: 七日签到
  205. * @return \activity_day7
  206. */
  207. public static function activity_day7()
  208. {
  209. static $a = null;
  210. return self::initValue($a, 'activity_day7');
  211. }
  212. /**
  213. * @return \sm_activity_day7 activity_day7 item数据
  214. */
  215. public static function activity_day7_getItem($itemid)
  216. {
  217. return self::get_hash_item('activity_day7', $itemid);
  218. }
  219. /**
  220. * 章节表
  221. * @return \gate
  222. */
  223. public static function gate()
  224. {
  225. static $a = null;
  226. return self::initValue($a, 'gate');
  227. }
  228. /**
  229. * @return \sm_gate gate item数据
  230. */
  231. public static function gate_getItem($itemid)
  232. {
  233. return self::get_hash_item('gate', $itemid);
  234. }
  235. /**
  236. * 角色
  237. * @return \hero
  238. */
  239. public static function hero()
  240. {
  241. static $a = null;
  242. return self::initValue($a, 'hero');
  243. }
  244. /**
  245. * @return \sm_hero hero item数据
  246. */
  247. public static function hero_getItem($itemid)
  248. {
  249. return self::get_hash_item('hero', $itemid);
  250. }
  251. /**
  252. * 装备表
  253. * @return \equip
  254. */
  255. public static function equip()
  256. {
  257. static $a = null;
  258. return self::initValue($a, 'equip');
  259. }
  260. /**
  261. * @return \sm_equip equip item数据
  262. */
  263. public static function equip_getItem($itemid)
  264. {
  265. return self::get_hash_item('equip', $itemid);
  266. }
  267. /**
  268. * 装备升级表
  269. * @return \equip_levelupgrade
  270. */
  271. public static function equip_levelupgrade()
  272. {
  273. static $a = null;
  274. return self::initValue($a, 'equip_levelupgrade');
  275. }
  276. /**
  277. * @return \sm_equip_levelupgrade equip_levelupgrade item数据
  278. */
  279. public static function equip_levelupgrade_getItem($itemid)
  280. {
  281. return self::get_hash_item('equip_levelupgrade', $itemid);
  282. }
  283. /**
  284. * 章节礼包表
  285. * @return \shop_gategift
  286. */
  287. public static function shop_gategift()
  288. {
  289. static $a = null;
  290. return self::initValue($a, 'shop_gategift');
  291. }
  292. /**
  293. * @return \sm_shop_gategift shop_gategift item数据
  294. */
  295. public static function shop_gategift_getItem($itemid)
  296. {
  297. return self::get_hash_item('shop_gategift', $itemid);
  298. }
  299. /**
  300. * 每日商店
  301. * @return \shop_daily
  302. */
  303. public static function shop_daily()
  304. {
  305. static $a = null;
  306. return self::initValue($a, 'shop_daily');
  307. }
  308. /**
  309. * @return \sm_shop_daily shop_daily item数据
  310. */
  311. public static function shop_daily_getItem($itemid)
  312. {
  313. return self::get_hash_item('shop_daily', $itemid);
  314. }
  315. /**
  316. * 钻石商店
  317. * @return \shop_cash
  318. */
  319. public static function shop_cash()
  320. {
  321. static $a = null;
  322. return self::initValue($a, 'shop_cash');
  323. }
  324. /**
  325. * @return \sm_shop_cash shop_cash item数据
  326. */
  327. public static function shop_cash_getItem($itemid)
  328. {
  329. return self::get_hash_item('shop_cash', $itemid);
  330. }
  331. /**
  332. * 金币商店
  333. * @return \shop_gold
  334. */
  335. public static function shop_gold()
  336. {
  337. static $a = null;
  338. return self::initValue($a, 'shop_gold');
  339. }
  340. /**
  341. * @return \sm_shop_gold shop_gold item数据
  342. */
  343. public static function shop_gold_getItem($itemid)
  344. {
  345. return self::get_hash_item('shop_gold', $itemid);
  346. }
  347. /**
  348. * 商城供给表-应该是废弃了
  349. * @return \shop_supply
  350. */
  351. public static function shop_supply()
  352. {
  353. static $a = null;
  354. return self::initValue($a, 'shop_supply');
  355. }
  356. /**
  357. * @return \sm_shop_supply shop_supply item数据
  358. */
  359. public static function shop_supply_getItem($itemid)
  360. {
  361. return self::get_hash_item('shop_supply', $itemid);
  362. }
  363. /**
  364. * 词条配置表
  365. * @return \predicate
  366. */
  367. public static function predicate()
  368. {
  369. static $a = null;
  370. return self::initValue($a, 'predicate');
  371. }
  372. /**
  373. * @return \sm_predicate predicate item数据
  374. */
  375. public static function predicate_getItem($itemid)
  376. {
  377. return self::get_hash_item('predicate', $itemid);
  378. }
  379. /**
  380. * 商城军备
  381. * @return \shop_junbei
  382. */
  383. public static function shop_junbei()
  384. {
  385. static $a = null;
  386. return self::initValue($a, 'shop_junbei');
  387. }
  388. /**
  389. * @return \sm_shop_junbei shop_junbei item数据
  390. */
  391. public static function shop_junbei_getItem($itemid)
  392. {
  393. return self::get_hash_item('shop_junbei', $itemid);
  394. }
  395. /**
  396. * 进化表
  397. * @return \evolve
  398. */
  399. public static function evolve()
  400. {
  401. static $a = null;
  402. return self::initValue($a, 'evolve');
  403. }
  404. /**
  405. * @return \sm_evolve evolve item数据
  406. */
  407. public static function evolve_getItem($itemid)
  408. {
  409. return self::get_hash_item('evolve', $itemid);
  410. }
  411. /**
  412. * 7日签到累计
  413. * @return \active_day7_accumulate
  414. */
  415. public static function active_day7_accumulate()
  416. {
  417. static $a = null;
  418. return self::initValue($a, 'active_day7_accumulate');
  419. }
  420. /**
  421. * @return \sm_active_day7_accumulate active_day7_accumulate item数据
  422. */
  423. public static function active_day7_accumulate_getItem($itemid)
  424. {
  425. return self::get_hash_item('active_day7_accumulate', $itemid);
  426. }
  427. /**
  428. * 宝石表
  429. * @return \gem
  430. */
  431. public static function gem()
  432. {
  433. static $a = null;
  434. return self::initValue($a, 'gem');
  435. }
  436. /**
  437. * @return \sm_gem gem item数据
  438. */
  439. public static function gem_getItem($itemid)
  440. {
  441. return self::get_hash_item('gem', $itemid);
  442. }
  443. /**
  444. * 秘宝表
  445. * @return \gate_sbox
  446. */
  447. public static function gate_sbox()
  448. {
  449. static $a = null;
  450. return self::initValue($a, 'gate_sbox');
  451. }
  452. /**
  453. * @return \sm_gate_sbox gate_sbox itemArray
  454. */
  455. public static function gate_sbox_getItemArray($key)
  456. {
  457. return self::get_hash_item('gate_sbox', $key);
  458. }
  459. /**
  460. * 最新的成就
  461. * @return \achieve_new
  462. */
  463. public static function achieve_new()
  464. {
  465. static $a = null;
  466. return self::initValue($a, 'achieve_new');
  467. }
  468. /**
  469. * @return \sm_achieve_new achieve_new item数据
  470. */
  471. public static function achieve_new_getItem($itemid)
  472. {
  473. return self::get_hash_item('achieve_new', $itemid);
  474. }
  475. /**
  476. * 人物属性
  477. * @return \heroattr
  478. */
  479. public static function heroattr()
  480. {
  481. static $a = null;
  482. return self::initValue($a, 'heroattr');
  483. }
  484. /**
  485. * @return \sm_heroattr heroattr item数据
  486. */
  487. public static function heroattr_getItem($itemid)
  488. {
  489. return self::get_hash_item('heroattr', $itemid);
  490. }
  491. /**
  492. * 剧情对话
  493. * @return \plots
  494. */
  495. public static function plots()
  496. {
  497. static $a = null;
  498. return self::initValue($a, 'plots');
  499. }
  500. /**
  501. * @return \sm_plots plots item数据
  502. */
  503. public static function plots_getItem($itemid)
  504. {
  505. return self::get_hash_item('plots', $itemid);
  506. }
  507. /**
  508. * 商城宝箱表
  509. * @return \shop_box
  510. */
  511. public static function shop_box()
  512. {
  513. static $a = null;
  514. return self::initValue($a, 'shop_box');
  515. }
  516. /**
  517. * @return \sm_shop_box shop_box item数据
  518. */
  519. public static function shop_box_getItem($itemid)
  520. {
  521. return self::get_hash_item('shop_box', $itemid);
  522. }
  523. /**
  524. * 商城月卡
  525. * @return \shop_monthcard
  526. */
  527. public static function shop_monthcard()
  528. {
  529. static $a = null;
  530. return self::initValue($a, 'shop_monthcard');
  531. }
  532. /**
  533. * @return \sm_shop_monthcard shop_monthcard item数据
  534. */
  535. public static function shop_monthcard_getItem($itemid)
  536. {
  537. return self::get_hash_item('shop_monthcard', $itemid);
  538. }
  539. /**
  540. * 7日狂欢活跃点奖励
  541. * @return \activepointreward
  542. */
  543. public static function activepointreward()
  544. {
  545. static $a = null;
  546. return self::initValue($a, 'activepointreward');
  547. }
  548. /**
  549. * @return \sm_activepointreward activepointreward item数据
  550. */
  551. public static function activepointreward_getItem($type, $pointId)
  552. {
  553. return self::get_hash_item('activepointreward', "$type-$pointId");
  554. }
  555. /**
  556. * 活动任务
  557. * @return \activeTask
  558. */
  559. public static function activeTask()
  560. {
  561. static $a = null;
  562. return self::initValue($a, 'activeTask');
  563. }
  564. /**
  565. * @return \sm_activeTask activeTask item数据
  566. */
  567. public static function activeTask_getItem($itemid)
  568. {
  569. return self::get_hash_item('activeTask', $itemid);
  570. }
  571. /**
  572. * 活动任务根据类型的不同分开
  573. * @return \activeTask_type
  574. */
  575. public static function activeTask_type()
  576. {
  577. static $a = null;
  578. return self::initValue($a, 'activeTask_type');
  579. }
  580. /**
  581. * @return \sm_activeTask_type activeTask_type itemArray
  582. */
  583. public static function activeTask_type_getItemArray($key)
  584. {
  585. return self::get_hash_item('activeTask_type', $key);
  586. }
  587. /**
  588. * 活动
  589. * @return \activity
  590. */
  591. public static function activity()
  592. {
  593. static $a = null;
  594. return self::initValue($a, 'activity');
  595. }
  596. /**
  597. * @return \sm_activity activity item数据
  598. */
  599. public static function activity_getItem($itemid)
  600. {
  601. return self::get_hash_item('activity', $itemid);
  602. }
  603. /**
  604. * 公告
  605. * @return \announcement
  606. */
  607. public static function announcement()
  608. {
  609. static $a = null;
  610. return self::initValue($a, 'announcement');
  611. }
  612. /**
  613. * @return \sm_announcement announcement item数据
  614. */
  615. public static function announcement_getItem($itemid)
  616. {
  617. return self::get_hash_item('announcement', $itemid);
  618. }
  619. /**
  620. * 战力荣誉榜信息
  621. * @return \rank_fightpowerreward
  622. */
  623. public static function rank_fightpowerreward()
  624. {
  625. static $a = null;
  626. return self::initValue($a, 'rank_fightpowerreward');
  627. }
  628. /**
  629. * @return \sm_rank_fightpowerreward rank_fightpowerreward item数据
  630. */
  631. public static function rank_fightpowerreward_getItem($itemid)
  632. {
  633. return self::get_hash_item('rank_fightpowerreward', $itemid);
  634. }
  635. /**
  636. * 主线荣誉榜信息
  637. * @return \rank_passgatereward
  638. */
  639. public static function rank_passgatereward()
  640. {
  641. static $a = null;
  642. return self::initValue($a, 'rank_passgatereward');
  643. }
  644. /**
  645. * @return \sm_rank_passgatereward rank_passgatereward item数据
  646. */
  647. public static function rank_passgatereward_getItem($itemid)
  648. {
  649. return self::get_hash_item('rank_passgatereward', $itemid);
  650. }
  651. /**
  652. * 玩家等级表
  653. * @return \player_level
  654. */
  655. public static function player_level()
  656. {
  657. static $a = null;
  658. return self::initValue($a, 'player_level');
  659. }
  660. /**
  661. * @return \sm_player_level player_level item数据
  662. */
  663. public static function player_level_getItem($itemid)
  664. {
  665. return self::get_hash_item('player_level', $itemid);
  666. }
  667. /**
  668. * 辅助:主线剧情解锁
  669. * @return \gate_unlock
  670. */
  671. public static function gate_unlock()
  672. {
  673. static $a = null;
  674. return self::initValue($a, 'gate_unlock');
  675. }
  676. /**
  677. * @return \sm_gate_unlock gate_unlock itemArray
  678. */
  679. public static function gate_unlock_getItemArray($key)
  680. {
  681. return self::get_hash_item('gate_unlock', $key);
  682. }
  683. /**
  684. * 辅助: 波次直查
  685. * @return \waveItem
  686. */
  687. public static function waveItem()
  688. {
  689. static $a = null;
  690. return self::initValue($a, 'waveItem');
  691. }
  692. /**
  693. * @return \sm_waveItem waveItem item数据
  694. */
  695. public static function waveItem_getItem($gateId, $waveId)
  696. {
  697. return self::get_hash_item('waveItem', "$gateId-$waveId");
  698. }
  699. /**
  700. * 道具宝箱表
  701. * @return \item_2023_box
  702. */
  703. public static function item_2023_box()
  704. {
  705. static $a = null;
  706. return self::initValue($a, 'item_2023_box');
  707. }
  708. /**
  709. * @return \sm_item_2023_box item_2023_box item数据
  710. */
  711. public static function item_2023_box_getItem($itemid)
  712. {
  713. return self::get_hash_item('item_2023_box', $itemid);
  714. }
  715. /**
  716. * 人物分类
  717. * @return \heroType_typeId
  718. */
  719. public static function heroType_typeId()
  720. {
  721. static $a = null;
  722. return self::initValue($a, 'heroType_typeId');
  723. }
  724. /**
  725. * @return \sm_heroType_typeId heroType_typeId itemArray
  726. */
  727. public static function heroType_typeId_getItemArray($key)
  728. {
  729. return self::get_hash_item('heroType_typeId', $key);
  730. }
  731. /**
  732. * 激活码表
  733. * @return \token_gift
  734. */
  735. public static function token_gift()
  736. {
  737. static $a = null;
  738. return self::initValue($a, 'token_gift');
  739. }
  740. /**
  741. * @return \sm_token_gift token_gift item数据
  742. */
  743. public static function token_gift_getItem($itemid)
  744. {
  745. return self::get_hash_item('token_gift', $itemid);
  746. }
  747. /**
  748. * 公共兑换码
  749. * @return \token_publicgift
  750. */
  751. public static function token_publicgift()
  752. {
  753. static $a = null;
  754. return self::initValue($a, 'token_publicgift');
  755. }
  756. /**
  757. * @return \sm_token_publicgift token_publicgift item数据
  758. */
  759. public static function token_publicgift_getItem($itemid)
  760. {
  761. return self::get_hash_item('token_publicgift', $itemid);
  762. }
  763. /**
  764. * 游戏功能解锁信息
  765. * @return \fun_unlock
  766. */
  767. public static function fun_unlock()
  768. {
  769. static $a = null;
  770. return self::initValue($a, 'fun_unlock');
  771. }
  772. /**
  773. * @return \sm_fun_unlock fun_unlock item数据
  774. */
  775. public static function fun_unlock_getItem($itemid)
  776. {
  777. return self::get_hash_item('fun_unlock', $itemid);
  778. }
  779. /**
  780. * 当前版本(时间戳)
  781. * @return \ver
  782. */
  783. public static function ver()
  784. {
  785. static $a = null;
  786. return self::initValue($a, 'ver', false);
  787. }
  788. /**
  789. * 客户端配置数据
  790. * @return \client
  791. */
  792. public static function client()
  793. {
  794. static $a = null;
  795. return self::initValue($a, 'client', false);
  796. }
  797. }