GameConfig.php 19 KB

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