1
This commit is contained in:
parent
53a71ab594
commit
44d06654ce
@ -293,4 +293,19 @@ class Gun extends BaseModel {
|
|||||||
return $finalyAddGold;
|
return $finalyAddGold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function newGainGold($gunDto, $addGold)
|
||||||
|
{
|
||||||
|
$newGold = min($gunDto['ceg_uplimit'],
|
||||||
|
$gunDto['today_get_gold'] + $addGold);
|
||||||
|
$finalyAddGold = max(0, $newGold - $gunDto['today_get_gold']);
|
||||||
|
if ($finalyAddGold > 0) {
|
||||||
|
self::update($gunDto['gun_uniid'],
|
||||||
|
array(
|
||||||
|
'today_get_gold' => $newGold,
|
||||||
|
'last_get_gold_time' => myself()->_getNowTime()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return $finalyAddGold;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -332,4 +332,19 @@ class Hero extends BaseModel {
|
|||||||
return $finalyAddGold;
|
return $finalyAddGold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function newGainGold($heroDto, $addGold)
|
||||||
|
{
|
||||||
|
$newGold = min($heroDto['ceg_uplimit'],
|
||||||
|
$heroDto['today_get_gold'] + $addGold);
|
||||||
|
$finalyAddGold = max(0, $newGold - $heroDto['today_get_gold']);
|
||||||
|
if ($finalyAddGold > 0) {
|
||||||
|
self::update($heroDto['hero_uniid'],
|
||||||
|
array(
|
||||||
|
'today_get_gold' => $newGold,
|
||||||
|
'last_get_gold_time' => myself()->_getNowTime()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return $finalyAddGold;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,42 @@ class BattleDataService extends BaseService {
|
|||||||
if (!$heroMeta) {
|
if (!$heroMeta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$pvpCeg = FormulaService::calcHeroPvpCeg($heroDto, $_REQUEST);
|
$heroPvpCeg = FormulaService::calcHeroPvpCeg($heroDto, $_REQUEST);
|
||||||
|
$weaponPvpCeg1 = 0;
|
||||||
|
$weaponPvpCeg2 = 0;
|
||||||
|
$weaponDb1 = Gun::find(getReqVal('weapon_uuid1', 0));
|
||||||
|
if ($weaponDb1) {
|
||||||
|
$weaponDto1 = Gun::toDto($weaponDb1);
|
||||||
|
$weaponPvpCeg1 = FormulaService::calcWeaponPvpCeg($weaponDto1, $_REQUEST);
|
||||||
|
}
|
||||||
|
$weaponDb2 = Gun::find(getReqVal('weapon_uuid2', 0));
|
||||||
|
if ($weaponDb2) {
|
||||||
|
$weaponDto2 = Gun::toDto($weaponDb2);
|
||||||
|
$weaponPvpCeg2 = FormulaService::calcWeaponPvpCeg($weaponDto2, $_REQUEST);
|
||||||
|
}
|
||||||
|
error_log(json_encode(array(
|
||||||
|
'heroPvpCeg' => $heroPvpCeg,
|
||||||
|
'weaponPvpCeg1' => $weaponPvpCeg1,
|
||||||
|
'weaponPvpCeg2' => $weaponPvpCeg2,
|
||||||
|
)));
|
||||||
|
if ($heroPvpCeg > 0) {
|
||||||
|
$heroPvpCeg = Hero::newGainGold($heroDto, $heroPvpCeg);
|
||||||
|
}
|
||||||
|
if ($weaponPvpCeg1 > 0) {
|
||||||
|
$weaponPvpCeg1 = Gun::newGainGold($weaponDto1, $weaponPvpCeg1);
|
||||||
|
}
|
||||||
|
if ($weaponPvpCeg2 > 0) {
|
||||||
|
$weaponPvpCeg2 = Gun::newGainGold($weaponDto2, $weaponPvpCeg2);
|
||||||
|
}
|
||||||
|
error_log(json_encode(array(
|
||||||
|
'new_heroPvpCeg' => $heroPvpCeg,
|
||||||
|
'new_weaponPvpCeg1' => $weaponPvpCeg1,
|
||||||
|
'new_weaponPvpCeg2' => $weaponPvpCeg2,
|
||||||
|
)));
|
||||||
|
$gold = $heroPvpCeg + $weaponPvpCeg1 + $weaponPvpCeg2;
|
||||||
|
if ($gold > 0) {
|
||||||
|
myself()->_addVirtualItem(V_ITEM_GOLD, $gold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function oldRewardGold($heroDb)
|
private function oldRewardGold($heroDb)
|
||||||
|
@ -72,13 +72,13 @@ class FormulaService extends BaseService {
|
|||||||
}
|
}
|
||||||
$ceg = $upLimit *
|
$ceg = $upLimit *
|
||||||
(
|
(
|
||||||
(0.5 * $rankedTopx * $meta['ranked_topx']) +
|
(0.5 * $rankedTopX * $meta['ranked_topx']) +
|
||||||
(0.25 * $killsTopx * $meta['kills_topx']) +
|
(0.25 * $killsTopX * $meta['kills_topx']) +
|
||||||
(0.15 * $killsTopx * $meta['hero_topx']) +
|
(0.15 * $killsTopX * $meta['hero_topx']) +
|
||||||
(0.5 * $weaponTopx * $meta['weapon_topx']) +
|
(0.5 * $weaponTopX * $meta['weapon_topx']) +
|
||||||
(0.5 * $survivalTopx * $meta['survival_topx'])
|
(0.5 * $survivalTopX * $meta['survival_topx'])
|
||||||
);
|
);
|
||||||
return $ceg;
|
return round($ceg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function calcHeroPveCeg($heroDb, $uplimit)
|
public static function calcHeroPveCeg($heroDb, $uplimit)
|
||||||
@ -131,10 +131,10 @@ class FormulaService extends BaseService {
|
|||||||
return $upLimit;
|
return $upLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function calcWeaponPvpCeg($weaponDb)
|
public static function calcWeaponPvpCeg($weaponDto, $params)
|
||||||
{
|
{
|
||||||
//PVP武器NFT每日获得极限*(50%*[每局排名TopX%对应比例]+25%*[每局PK人数排名TopX%对应比例]+15%*[每局英雄属性排名TopX%对应比例]+5%*[每局武器属性排名TopX%对应比例]+5%*[每局存活时间排名TopX%对应比例])
|
//PVP武器NFT每日获得极限*(50%*[每局排名TopX%对应比例]+25%*[每局PK人数排名TopX%对应比例]+15%*[每局英雄属性排名TopX%对应比例]+5%*[每局武器属性排名TopX%对应比例]+5%*[每局存活时间排名TopX%对应比例])
|
||||||
$upLimit = getXVal($params, 'uplimit');
|
$upLimit = $weaponDto['ceg_uplimit'];
|
||||||
$rankedTopX= getXVal($params, 'ranked_topx');
|
$rankedTopX= getXVal($params, 'ranked_topx');
|
||||||
$killsTopX = getXVal($params, 'kills_topx');
|
$killsTopX = getXVal($params, 'kills_topx');
|
||||||
$heroTopX = getXVal($params, 'hero_topx');
|
$heroTopX = getXVal($params, 'hero_topx');
|
||||||
@ -146,13 +146,13 @@ class FormulaService extends BaseService {
|
|||||||
}
|
}
|
||||||
$ceg = $upLimit *
|
$ceg = $upLimit *
|
||||||
(
|
(
|
||||||
(0.5 * $rankedTopx * $meta['ranked_topx']) +
|
(0.5 * $rankedTopX * $meta['ranked_topx']) +
|
||||||
(0.25 * $killsTopx * $meta['kills_topx']) +
|
(0.25 * $killsTopX * $meta['kills_topx']) +
|
||||||
(0.15 * $killsTopx * $meta['hero_topx']) +
|
(0.15 * $killsTopX * $meta['hero_topx']) +
|
||||||
(0.5 * $weaponTopx * $meta['weapon_topx']) +
|
(0.5 * $weaponTopX * $meta['weapon_topx']) +
|
||||||
(0.5 * $survivalTopx * $meta['survival_topx'])
|
(0.5 * $survivalTopX * $meta['survival_topx'])
|
||||||
);
|
);
|
||||||
return $ceg;
|
return round($ceg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function calcWeaponPveCeg($weaponDb)
|
public static function calcWeaponPveCeg($weaponDb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user