1
This commit is contained in:
parent
ac8bb968bf
commit
d26cd19ac7
@ -424,25 +424,34 @@ void BattleDataContext::GetHeroLvQuality(long long& hero_uniid, int& hero_lv, in
|
||||
}
|
||||
}
|
||||
|
||||
void BattleDataContext::GetWeaponLvQuality(long long& weapon_uniid, int& weapon_lv, int& quality)
|
||||
void BattleDataContext::GetWeaponLvQuality(long long weapon_uniid, int& weapon_lv, int& quality)
|
||||
{
|
||||
weapon_uniid = 0;
|
||||
weapon_lv = 1;
|
||||
quality = 1;
|
||||
if (owner_.Get()->IsPlayer()) {
|
||||
if (weapon1_ability_) {
|
||||
weapon_uniid = weapon_dto1->Get("gun_uniid", 0).GetInt64();
|
||||
if (weapon1_ability_ && weapon_uniid == weapon_dto1->Get("gun_uniid", 0).GetInt64()) {
|
||||
weapon_lv = weapon_dto1->Get("gun_lv", 0).GetInt();
|
||||
quality = weapon_dto1->Get("quality", 0).GetInt();
|
||||
}
|
||||
if (weapon2_ability_) {
|
||||
weapon_uniid = weapon_dto2->Get("gun_uniid", 0).GetInt64();
|
||||
if (weapon2_ability_ && weapon_uniid == weapon_dto2->Get("gun_uniid", 0).GetInt64()) {
|
||||
weapon_lv = weapon_dto2->Get("gun_lv", 0).GetInt();
|
||||
quality = weapon_dto2->Get("quality", 0).GetInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int BattleDataContext::GetWeaponMaxLv()
|
||||
{
|
||||
int max_weapon_lv = 1;
|
||||
if (weapon1_ability_) {
|
||||
max_weapon_lv = std::max(max_weapon_lv, weapon_dto1->Get("gun_lv", 0).GetInt());
|
||||
}
|
||||
if (weapon2_ability_) {
|
||||
max_weapon_lv = std::max(max_weapon_lv, weapon_dto2->Get("gun_lv", 0).GetInt());
|
||||
}
|
||||
return std::max(1, max_weapon_lv);
|
||||
}
|
||||
|
||||
void BattleDataContext::CalcBattleStat(struct PlayerStats* stats)
|
||||
{
|
||||
if (!owner_.Get()->IsPlayer()) {
|
||||
|
@ -42,7 +42,8 @@ struct BattleDataContext
|
||||
BattleDataContext();
|
||||
|
||||
void GetHeroLvQuality(long long& hero_uniid, int& hero_lv, int& quality);
|
||||
void GetWeaponLvQuality(long long& weapon_uniid, int& weapon_lv, int& quality);
|
||||
void GetWeaponLvQuality(long long weapon_uniid, int& weapon_lv, int& quality);
|
||||
int GetWeaponMaxLv();
|
||||
|
||||
void ParseResult(a8::XObject& obj);
|
||||
|
||||
|
@ -285,10 +285,9 @@ void Weapon::ToPB(Creature* c, cs::MFWeapon* pb_obj)
|
||||
pb_obj->set_weapon_uniid(a8::XValue(weapon_uniid).GetString());
|
||||
pb_obj->set_weapon_id(weapon_id);
|
||||
if (weapon_uniid && weapon_lv == 0) {
|
||||
long long p_weapon_uniid = 0;
|
||||
int p_weapon_lv = 1;
|
||||
int p_quality = 1;
|
||||
c->GetBattleContext()->GetWeaponLvQuality(p_weapon_uniid, p_weapon_lv, p_quality);
|
||||
c->GetBattleContext()->GetWeaponLvQuality(weapon_uniid, p_weapon_lv, p_quality);
|
||||
weapon_lv = p_weapon_lv;
|
||||
}
|
||||
pb_obj->set_weapon_lv(std::max(1, weapon_lv));
|
||||
|
Loading…
x
Reference in New Issue
Block a user