66 lines
2.0 KiB
PHP
66 lines
2.0 KiB
PHP
<?php
|
||
|
||
namespace mt;
|
||
|
||
use phpcommon;
|
||
|
||
class StakingVip {
|
||
|
||
const GAIN_GOLD = 1; //类型 = 1,Gold模式额外获数量(具体指,不是比例)
|
||
const HERO_UP = 2; //类型 = 2,英雄升阶金币消耗减少比例
|
||
const ACCOUNT_TIMES = 3; //类型 = 3,账号总打金次数增加场次
|
||
const GOLD_CUT_DOWN = 4; //类型 = 4,购买特殊道具所需金币数量减少比例,此处特殊道具包括-Bounty门票、恢复道具、封装道具
|
||
const DIAMOND_CUT_DOWN = 5; //类型 = 5,购买特殊道具所需钻石数量减少比例,此处特殊道具包括-英雄升阶概率提升道具
|
||
const ACCOUNT_LUCKY_INC = 6; //类型 = 6,账号总有效幸运值增加数值
|
||
|
||
public static function find($lv)
|
||
{
|
||
foreach (self::getMetaList() as $meta){
|
||
if ($meta['rank'] == $lv){
|
||
return $meta;
|
||
}
|
||
}
|
||
return array();
|
||
}
|
||
|
||
public static function exportRights($lv){
|
||
$meta = self::find($lv);
|
||
if (!$meta || empty($meta['rights'])){
|
||
return array();
|
||
}
|
||
$rightList = array();
|
||
$rights = explode('|',$meta['rights']);
|
||
foreach ($rights as $right){
|
||
$arr = explode(':',$right);
|
||
array_push($rightList,array(
|
||
'type' => $arr[0],
|
||
'val' => $arr[1],
|
||
));
|
||
}
|
||
return $rightList;
|
||
}
|
||
|
||
public static function getValByLv($lv,$type){
|
||
$rights = self::exportRights($lv);
|
||
$rightsHash = array();
|
||
array_walk($rights, function ($row) use(&$rightsHash) {
|
||
$rightsHash[$row['type']] = $row;
|
||
});
|
||
if (isset($rightsHash[$type])){
|
||
return $rightsHash[$type]['val'];
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
protected static function getMetaList()
|
||
{
|
||
if (!self::$metaList) {
|
||
self::$metaList = getMetaTable('stakingVip@stakingVip.php');
|
||
}
|
||
return self::$metaList;
|
||
}
|
||
|
||
protected static $metaList;
|
||
|
||
}
|