This commit is contained in:
aozhiwei 2023-05-22 12:08:59 +08:00
parent 9402eeef84
commit 43582a94e3
3 changed files with 14 additions and 0 deletions

View File

@ -297,6 +297,7 @@ void Weapon::ToPB(Creature* c, cs::MFWeapon* pb_obj)
pb_obj->set_weapon_lv(std::max(1, weapon_lv));
pb_obj->set_ammo(ammo);
pb_obj->set_volume(GetClipVolume(c));
pb_obj->set_weapon_battle_lv(GetWeaponBattleLv(c));
}
void Buff::FillMFBuff(cs::MFBuff* buff_pb)

View File

@ -5,6 +5,7 @@
#include "netdata.h"
#include "pbutils.h"
#include "human.h"
#include "compose.h"
#include "mt/Equip.h"
@ -54,3 +55,14 @@ int Weapon::GetReloadTime(Creature* c)
return meta ? meta->reload_time() :0;
}
}
int Weapon::GetWeaponBattleLv(Creature* c)
{
if (c) {
if (c->GetCurrWeapon() == this) {
return c->GetCompose()->GetNum() + 1;
}
} else {
return 1;
}
}

View File

@ -27,6 +27,7 @@ class Weapon
int GetClipVolume(Creature* c);
int GetFireRate(Creature* c);
int GetReloadTime(Creature* c);
int GetWeaponBattleLv(Creature* c);
private: