1
This commit is contained in:
parent
4364686621
commit
e791e453f9
@ -336,34 +336,21 @@ class Gun extends BaseModel {
|
||||
return $finalyAddGold;
|
||||
}
|
||||
|
||||
public static function pveGainGold($gunDto, $count)
|
||||
public static function gainGoldPve($gunDto, $count)
|
||||
{
|
||||
if ($count <= 0) {
|
||||
return 0;
|
||||
}
|
||||
$finalyAddGold = self::calcPveGainGold($gunDto, $count);
|
||||
$newGold = min($gunDto['pve_ceg_uplimit'],
|
||||
$gunDto['current_pve_get_ceg'] + $addGold);
|
||||
$finalyAddGold = max(0, $newGold - $gunDto['current_pve_get_ceg']);
|
||||
if ($finalyAddGold > 0) {
|
||||
self::update($gunDto['gun_uniid'],
|
||||
array(
|
||||
'today_pve_get_ceg' => $gunDto['today_pve_get_ceg'] + $finalyAddGold,
|
||||
'current_pve_get_ceg' => $newGold,
|
||||
'last_pve_get_ceg_time' => myself()->_getNowTime()
|
||||
));
|
||||
}
|
||||
return $finalyAddGold;
|
||||
}
|
||||
|
||||
public static function calcPveGainGold($gunDto, $count)
|
||||
{
|
||||
if ($count <= 0) {
|
||||
return 0;
|
||||
}
|
||||
$newGold = min($gunDto['pve_ceg_uplimit'],
|
||||
$gunDto['today_pve_get_ceg'] +
|
||||
round($gunDto['pve_ceg_uplimit'] / $count));
|
||||
$finalyAddGold = max(0, $newGold - $gunDto['today_pve_get_ceg']);
|
||||
return $finalyAddGold;
|
||||
}
|
||||
|
||||
private static function getAttrProByLevel($row,$baseAttr,$attr){
|
||||
$attrPro1 = [];
|
||||
$itemMeta = mt\Item::get($row['gun_id']);
|
||||
|
@ -391,16 +391,15 @@ class Hero extends BaseModel {
|
||||
return $finalyAddGold;
|
||||
}
|
||||
|
||||
public static function pveGainGold($heroDto, $count)
|
||||
public static function gainGoldPve($heroDto, $count)
|
||||
{
|
||||
if ($count <= 0) {
|
||||
return 0;
|
||||
}
|
||||
$finalyAddGold = self::calcPveGainGold($heroDto, $count);
|
||||
$newGold = min($heroDto['pve_ceg_uplimit'],
|
||||
$heroDto['current_pve_get_ceg'] + $addGold);
|
||||
$finalyAddGold = max(0, $newGold - $heroDto['current_pve_get_ceg']);
|
||||
if ($finalyAddGold > 0) {
|
||||
self::update($heroDto['hero_uniid'],
|
||||
array(
|
||||
'today_pve_get_ceg' => $heroDto['today_pve_get_ceg'] + $finalyAddGold,
|
||||
'current_pve_get_ceg' => $newGold,
|
||||
'last_pve_get_ceg_time' => myself()->_getNowTime()
|
||||
));
|
||||
}
|
||||
|
@ -608,13 +608,13 @@ class BattleDataService extends BaseService {
|
||||
'weaponPveCeg2' => $weaponPveCeg2,
|
||||
)));
|
||||
if ($heroPveCeg > 0) {
|
||||
$heroPveCeg = Hero::gainGoldPvp($this->heroDto, $heroPveCeg);
|
||||
$heroPveCeg = Hero::gainGoldPve($this->heroDto, $heroPveCeg);
|
||||
}
|
||||
if ($weaponPveCeg1 > 0) {
|
||||
$weaponPveCeg1 = Gun::gainGoldPvp($this->weapon1Dto, $weaponPveCeg1);
|
||||
$weaponPveCeg1 = Gun::gainGoldPve($this->weapon1Dto, $weaponPveCeg1);
|
||||
}
|
||||
if ($weaponPveCeg2 > 0) {
|
||||
$weaponPveCeg2 = Gun::gainGoldPvp($this->weapon1Dto, $weaponPveCeg2);
|
||||
$weaponPveCeg2 = Gun::gainGoldPve($this->weapon1Dto, $weaponPveCeg2);
|
||||
}
|
||||
error_log(json_encode(array(
|
||||
'new_heroPveCeg' => $heroPveCeg,
|
||||
|
Loading…
x
Reference in New Issue
Block a user