/** * 是否启用codegen */ private static function isCG() { return defined('CodeGen_Enabled') && CodeGen_Enabled; } /** * @var bool 分区是否使用独立的常量配置数据 */ private static $useZoneId = false; /** * 追加分区列表字符串 * @return string */ private static function zoneid() { global $zoneid; return self::$useZoneId ? "-zone$zoneid" : ""; } /** * 初始化指定变量, 非null的情况下直接跳出 * 可能从文件中或者redis中获取原始数据对变量进行初始化 * @param mixed $a 变量 * @param string $modelName 用来初始化变量的资源名称 * @param bool $isHash 数据是否采用hash结构(否:普通字符串) */ static private function initValue(&$a, $modelName, $isHash = true) { $key = 'gamecfg-' . $modelName . self::zoneid(); if (is_null($a)) { if (self::isCG()) { $a = include $key . '.php'; } else { $a = $isHash ? gMem()->hgetall($key) : gMem()->get($key); } } return $a; } /** * 获取hash结构的一个item * @param string $modelName 模块名称 * @param mixed/string/int $itemId 索引 * @return mixed */ private static function get_hash_item($modelName, $itemId) { if (self::isCG()) { $data = self::$modelName(); if (property_exists($data, $itemId)) { return $data->$itemId; } } else { $key = 'gamecfg-' . $modelName . self::zoneid(); return gMem()->hget($key, $itemId); } return null; } // /** * 全局参数 * @return \globalsettings */ public static function globalsettings() { static $a = null; return self::initValue($a, 'globalsettings'); } /** * @return \globalsettings globalsettingsitem数据 */ public static function globalsettings_getItem($itemid) { return self::get_hash_item('globalsettings', $itemid); } /** * 英雄模块 * @return \hero */ public static function hero() { static $a = null; return self::initValue($a, 'hero'); } /** * @return \sm_hero heroitem数据 */ public static function hero_getItem($itemid) { return self::get_hash_item('hero', $itemid); } /** * 英雄的升级(属性加成) * @return \heroextra_level */ public static function heroextra_level() { static $a = null; return self::initValue($a, 'heroextra_level'); } /** * @return \sm_heroextra_level heroextra_levelitem数据 */ public static function heroextra_level_getItem($itemid) { return self::get_hash_item('heroextra_level', $itemid); } /** * 开服七天活动 * @return \day7 */ public static function day7() { static $a = null; return self::initValue($a, 'day7'); } /** * @return \sm_day7 day7item数据 */ public static function day7_getItem($itemid) { return self::get_hash_item('day7', $itemid); } /** * * @return \item */ public static function item() { static $a = null; return self::initValue($a, 'item'); } /** * @return \sm_item itemitem数据 */ public static function item_getItem($itemid) { return self::get_hash_item('item', $itemid); } /** * * @return \itemlevel */ public static function itemlevel() { static $a = null; return self::initValue($a, 'itemlevel'); } /** * @return \sm_itemlevel itemlevelitem数据 */ public static function itemlevel_getItem($itemid) { return self::get_hash_item('itemlevel', $itemid); } /** * 英雄的好感度提升(消耗金币) * @return \heroextra_favor */ public static function heroextra_favor() { static $a = null; return self::initValue($a, 'heroextra_favor'); } /** * @return \sm_heroextra_favor heroextra_favoritem数据 */ public static function heroextra_favor_getItem($itemid) { return self::get_hash_item('heroextra_favor', $itemid); } /** * 英雄的升级——每级成长消耗经验需求表 * @return \hero_levelexp */ public static function hero_levelexp() { static $a = null; return self::initValue($a, 'hero_levelexp'); } /** * @return \sm_hero_levelexp hero_levelexpitem数据 */ public static function hero_levelexp_getItem($itemid) { return self::get_hash_item('hero_levelexp', $itemid); } /** * 英雄的升星(消耗金币+ 属性加成) * @return \heroextra_star */ public static function heroextra_star() { static $a = null; return self::initValue($a, 'heroextra_star'); } /** * @return \sm_heroextra_star heroextra_staritem数据 */ public static function heroextra_star_getItem($itemid) { return self::get_hash_item('heroextra_star', $itemid); } /** * 英雄的升阶(消耗金币+ 属性加成) * @return \heroextra_dengjie */ public static function heroextra_dengjie() { static $a = null; return self::initValue($a, 'heroextra_dengjie'); } /** * @return \sm_heroextra_dengjie heroextra_dengjieitem数据 */ public static function heroextra_dengjie_getItem($itemid) { return self::get_hash_item('heroextra_dengjie', $itemid); } /** * 关卡 * @return \gate */ public static function gate() { static $a = null; return self::initValue($a, 'gate'); } /** * @return \sm_gate gateitem数据 */ public static function gate_getItem($itemid) { return self::get_hash_item('gate', $itemid); } /** * 关卡波茨数据 * @return \gatelevel */ public static function gatelevel() { static $a = null; return self::initValue($a, 'gatelevel'); } /** * @return \sm_gatelevel gatelevelitem数据 */ public static function gatelevel_getItem($itemid) { return self::get_hash_item('gatelevel', $itemid); } /** * 关卡—— 星级奖励 * @return \gate_starreward */ public static function gate_starreward() { static $a = null; return self::initValue($a, 'gate_starreward'); } /** * @return \sm_gate_starreward gate_starrewarditem数据 */ public static function gate_starreward_getItem($itemid) { return self::get_hash_item('gate_starreward', $itemid); } /** * 任务 * @return \task */ public static function task() { static $a = null; return self::initValue($a, 'task'); } /** * @return \sm_task taskitem数据 */ public static function task_getItem($itemid) { return self::get_hash_item('task', $itemid); } /** * * @return \playerlevel */ public static function playerlevel() { static $a = null; return self::initValue($a, 'playerlevel'); } /** * @return \sm_playerlevel playerlevelitem数据 */ public static function playerlevel_getItem($itemid) { return self::get_hash_item('playerlevel', $itemid); } /** * 技能升级消耗金币 * @return \skill_shengji */ public static function skill_shengji() { static $a = null; return self::initValue($a, 'skill_shengji'); } /** * @return \sm_skill_shengji skill_shengjiitem数据 */ public static function skill_shengji_getItem($itemid) { return self::get_hash_item('skill_shengji', $itemid); } /** * 商城 * @return \shop */ public static function shop() { static $a = null; return self::initValue($a, 'shop'); } /** * @return \sm_shop shopitem数据 */ public static function shop_getItem($itemid) { return self::get_hash_item('shop', $itemid); } /** * 停服计划 * @return \service_schedule */ public static function service_schedule() { static $a = null; return self::initValue($a, 'service_schedule'); } /** * @return \sm_service_schedule service_scheduleitem数据 */ public static function service_schedule_getItem($itemid) { return self::get_hash_item('service_schedule', $itemid); } /** * 抽奖数据 * @return \choujiang */ public static function choujiang() { static $a = null; return self::initValue($a, 'choujiang'); } /** * @return \sm_choujiang choujiangitem数据 */ public static function choujiang_getItem($itemid) { return self::get_hash_item('choujiang', $itemid); } /** * 无穷无尽关卡模式 * @return \gate_forever */ public static function gate_forever() { static $a = null; return self::initValue($a, 'gate_forever'); } /** * @return \sm_gate_forever gate_foreveritem数据 */ public static function gate_forever_getItem($itemid) { return self::get_hash_item('gate_forever', $itemid); } /** * 系统邮件 * @return \sysmail */ public static function sysmail() { static $a = null; return self::initValue($a, 'sysmail'); } /** * @return \sm_sysmail sysmailitem数据 */ public static function sysmail_getItem($itemid) { return self::get_hash_item('sysmail', $itemid); } /** * 关卡【副本】 * @return \gate_carbon */ public static function gate_carbon() { static $a = null; return self::initValue($a, 'gate_carbon'); } /** * @return \sm_gate_carbon gate_carbonitem数据 */ public static function gate_carbon_getItem($itemid) { return self::get_hash_item('gate_carbon', $itemid); } /** * pvp分段奖励 * @return \pvp_leaguereward */ public static function pvp_leaguereward() { static $a = null; return self::initValue($a, 'pvp_leaguereward'); } /** * @return \sm_pvp_leaguereward pvp_leaguerewarditem数据 */ public static function pvp_leaguereward_getItem($itemid) { return self::get_hash_item('pvp_leaguereward', $itemid); } /** * pvp 百名榜单奖励 * @return \pvp_rankreward */ public static function pvp_rankreward() { static $a = null; return self::initValue($a, 'pvp_rankreward'); } /** * @return \sm_pvp_rankreward pvp_rankrewarditem数据 */ public static function pvp_rankreward_getItem($itemid) { return self::get_hash_item('pvp_rankreward', $itemid); } /** * pvp_ 分数段 * @return \pvp_leaguescore */ public static function pvp_leaguescore() { static $a = null; return self::initValue($a, 'pvp_leaguescore'); } /** * @return \sm_pvp_leaguescore pvp_leaguescoreitem数据 */ public static function pvp_leaguescore_getItem($itemid) { return self::get_hash_item('pvp_leaguescore', $itemid); } /** * 熔炼实验室 * @return \smelting */ public static function smelting() { static $a = null; return self::initValue($a, 'smelting'); } /** * @return \sm_smelting smeltingitem数据 */ public static function smelting_getItem($itemid) { return self::get_hash_item('smelting', $itemid); } /** * 配置的关卡相关的战斗数据 * @return \gate_combat */ public static function gate_combat() { static $a = null; return self::initValue($a, 'gate_combat'); } /** * @return \sm_gate_combat gate_combatitem数据 */ public static function gate_combat_getItem($itemid) { return self::get_hash_item('gate_combat', $itemid); } /** * * @return \gate_carbon_content */ public static function gate_carbon_content() { static $a = null; return self::initValue($a, 'gate_carbon_content'); } /** * @return \sm_gate_carbon_content gate_carbon_contentitem数据 */ public static function gate_carbon_content_getItem($itemid) { return self::get_hash_item('gate_carbon_content', $itemid); } /** * pvp活跃奖励数据 * @return \pvp_activityreward */ public static function pvp_activityreward() { static $a = null; return self::initValue($a, 'pvp_activityreward'); } /** * @return \sm_pvp_activityreward pvp_activityrewarditem数据 */ public static function pvp_activityreward_getItem($itemid) { return self::get_hash_item('pvp_activityreward', $itemid); } /** * 抽奖保底数据 * @return \choujiang_baodi */ public static function choujiang_baodi() { static $a = null; return self::initValue($a, 'choujiang_baodi'); } /** * @return \sm_choujiang_baodi choujiang_baodiitem数据 */ public static function choujiang_baodi_getItem($typeId, $cishu) { return self::get_hash_item('choujiang_baodi', "$typeId-$cishu"); } /** * 英雄的升级——成长可消耗的道具表 * @return \hero_levelexp_costitem */ public static function hero_levelexp_costitem() { static $a = null; return self::initValue($a, 'hero_levelexp_costitem'); } /** * @return \sm_hero_levelexp_costitem hero_levelexp_costitemitem数据 */ public static function hero_levelexp_costitem_getItem($itemid) { return self::get_hash_item('hero_levelexp_costitem', $itemid); } /** * 抽奖设置数据 * @return \choujiang_settings */ public static function choujiang_settings() { static $a = null; return self::initValue($a, 'choujiang_settings'); } /** * @return \sm_choujiang_settings choujiang_settingsitem数据 */ public static function choujiang_settings_getItem($itemid) { return self::get_hash_item('choujiang_settings', $itemid); } /** * 成就任务 * @return \task_achi */ public static function task_achi() { static $a = null; return self::initValue($a, 'task_achi'); } /** * @return \sm_task_achi task_achiitem数据 */ public static function task_achi_getItem($itemid) { return self::get_hash_item('task_achi', $itemid); } /** * 宝箱 * @return \box */ public static function box() { static $a = null; return self::initValue($a, 'box'); } /** * @return \sm_box boxitem数据 */ public static function box_getItem($itemid) { return self::get_hash_item('box', $itemid); } /** * 宝箱的奖池 * @return \boxpool */ public static function boxpool() { static $a = null; return self::initValue($a, 'boxpool'); } /** * @return \sm_boxpool boxpoolitem数据 */ public static function boxpool_getItem($itemid) { return self::get_hash_item('boxpool', $itemid); } /** * 英雄————神血系统 * @return \heroextra_godblood */ public static function heroextra_godblood() { static $a = null; return self::initValue($a, 'heroextra_godblood'); } /** * @return \sm_heroextra_godblood heroextra_godblooditem数据 */ public static function heroextra_godblood_getItem($itemid) { return self::get_hash_item('heroextra_godblood', $itemid); } /** * 碎片 * @return \segment */ public static function segment() { static $a = null; return self::initValue($a, 'segment'); } /** * @return \sm_segment segmentitem数据 */ public static function segment_getItem($itemid) { return self::get_hash_item('segment', $itemid); } /** * * @return \gate_world */ public static function gate_world() { static $a = null; return self::initValue($a, 'gate_world'); } /** * @return \sm_gate_world gate_worlditem数据 */ public static function gate_world_getItem($itemid) { return self::get_hash_item('gate_world', $itemid); } /** * * @return \gate_city */ public static function gate_city() { static $a = null; return self::initValue($a, 'gate_city'); } /** * @return \sm_gate_city gate_cityitem数据 */ public static function gate_city_getItem($itemid) { return self::get_hash_item('gate_city', $itemid); } /** * 神秘商城道具表-by goodstype * @return \secretshop_goodsType */ public static function secretshop_goodsType() { static $a = null; return self::initValue($a, 'secretshop_goodsType'); } /** * @return \sm_secretshop_goodsType secretshop_goodsTypeitem数据 */ public static function secretshop_goodsType_getItem($itemid) { return self::get_hash_item('secretshop_goodsType', $itemid); } /** * 神秘商城刷新价格表 * @return \secretshop_refresh */ public static function secretshop_refresh() { static $a = null; return self::initValue($a, 'secretshop_refresh'); } /** * @return \sm_secretshop_refresh secretshop_refreshitem数据 */ public static function secretshop_refresh_getItem($itemid) { return self::get_hash_item('secretshop_refresh', $itemid); } /** * 神秘商城道具表-by typeId * @return \secretshop_typeId */ public static function secretshop_typeId() { static $a = null; return self::initValue($a, 'secretshop_typeId'); } /** * @return \sm_secretshop_typeId secretshop_typeIditem数据 */ public static function secretshop_typeId_getItem($itemid) { return self::get_hash_item('secretshop_typeId', $itemid); } /** * 客户端版本信息 * @return \clientVersionHistory */ public static function clientVersionHistory() { static $a = null; return self::initValue($a, 'clientVersionHistory'); } /** * @return \sm_clientVersionHistory clientVersionHistoryitem数据 */ public static function clientVersionHistory_getItem($itemid) { return self::get_hash_item('clientVersionHistory', $itemid); } /** * 分区列表 * @return \zonelist */ public static function zonelist() { static $a = null; return self::initValue($a, 'zonelist'); } /** * @return \sm_zonelist zonelistitem数据 */ public static function zonelist_getItem($itemid) { return self::get_hash_item('zonelist', $itemid); } /** * 兑换码礼包 * @return \tokenGift */ public static function tokenGift() { static $a = null; return self::initValue($a, 'tokenGift'); } /** * @return \sm_tokenGift tokenGiftitem数据 */ public static function tokenGift_getItem($itemid) { return self::get_hash_item('tokenGift', $itemid); } /** * 活动配置 * @return \activity */ public static function activity() { static $a = null; return self::initValue($a, 'activity'); } /** * @return \sm_activity activityitem数据 */ public static function activity_getItem($itemid) { return self::get_hash_item('activity', $itemid); } /** * 碎片融合的概率表 * @return \segment_ronghe */ public static function segment_ronghe() { static $a = null; return self::initValue($a, 'segment_ronghe'); } /** * @return \sm_segment_ronghe segment_rongheitem数据 */ public static function segment_ronghe_getItem($itemid) { return self::get_hash_item('segment_ronghe', $itemid); } /** * 碎片_按品质索引 * @return \segment_byPinzhi */ public static function segment_byPinzhi() { static $a = null; return self::initValue($a, 'segment_byPinzhi'); } /** * @return \sm_segment_byPinzhi segment_byPinzhiitem数据 */ public static function segment_byPinzhi_getItem($quailty, $itemType) { return self::get_hash_item('segment_byPinzhi', $quailty)->$itemType; } /** * 宝箱经验卡掉落数据 * @return \boxJingYanCards */ public static function boxJingYanCards() { static $a = null; return self::initValue($a, 'boxJingYanCards'); } /** * @return \sm_boxJingYanCards boxJingYanCardsitem数据 */ public static function boxJingYanCards_getItem($itemid) { return self::get_hash_item('boxJingYanCards', $itemid); } /** * 活动: 在线礼包 * @return \activity_onlinegift */ public static function activity_onlinegift() { static $a = null; return self::initValue($a, 'activity_onlinegift'); } /** * @return \sm_activity_onlinegift activity_onlinegiftitem数据 */ public static function activity_onlinegift_getItem($itemid) { return self::get_hash_item('activity_onlinegift', $itemid); } /** * GM号的UID * @return \GM_uids */ public static function GM_uids() { static $a = null; return self::initValue($a, 'GM_uids'); } /** * @return \GM_uids GM_uidsitem数据 */ public static function GM_uids_getItem($itemid) { return self::get_hash_item('GM_uids', $itemid); } /** * 活动, 全服注册礼包 * @return \activity_reggift */ public static function activity_reggift() { static $a = null; return self::initValue($a, 'activity_reggift'); } /** * @return \sm_activity_reggift activity_reggiftitem数据 */ public static function activity_reggift_getItem($itemid) { return self::get_hash_item('activity_reggift', $itemid); } /** * 公会捐献卡牌奖励 * @return \guilddonatereward */ public static function guilddonatereward() { static $a = null; return self::initValue($a, 'guilddonatereward'); } /** * @return \sm_guilddonatereward guilddonaterewarditem数据 */ public static function guilddonatereward_getItem($itemid) { return self::get_hash_item('guilddonatereward', $itemid); } /** * 公会等级相关数据 * @return \guildlevel */ public static function guildlevel() { static $a = null; return self::initValue($a, 'guildlevel'); } /** * @return \sm_guildlevel guildlevelitem数据 */ public static function guildlevel_getItem($itemid) { return self::get_hash_item('guildlevel', $itemid); } /** * 公会礼包 * @return \guildlibao */ public static function guildlibao() { static $a = null; return self::initValue($a, 'guildlibao'); } /** * @return \sm_guildlibao guildlibaoitem数据 */ public static function guildlibao_getItem($itemid) { return self::get_hash_item('guildlibao', $itemid); } /** * 玩家初始化数据 * @return \primordial_data */ public static function primordial_data() { static $a = null; return self::initValue($a, 'primordial_data'); } /** * @return \primordial_data primordial_dataitem数据 */ public static function primordial_data_getItem($itemid) { return self::get_hash_item('primordial_data', $itemid); } /** * 英雄技能升级的限定 * @return \heroextra_jinengshengji */ public static function heroextra_jinengshengji() { static $a = null; return self::initValue($a, 'heroextra_jinengshengji'); } /** * @return \sm_heroextra_jinengshengji heroextra_jinengshengjiitem数据 */ public static function heroextra_jinengshengji_getItem($itemid) { return self::get_hash_item('heroextra_jinengshengji', $itemid); } /** * 当前版本(时间戳) * @return \ver */ public static function ver() { static $a = null; return self::initValue($a, 'ver', false); } /** * 客户端配置数据 * @return \client */ public static function client() { static $a = null; return self::initValue($a, 'client', false); } }