diff --git a/server/gameserver/android.cc b/server/gameserver/android.cc index 8055b6f0..59267999 100644 --- a/server/gameserver/android.cc +++ b/server/gameserver/android.cc @@ -15,6 +15,8 @@ #include "mt/Text.h" #include "mt/Hero.h" #include "mt/Item.h" +#include "mt/Map.h" +#include "mt/BattleBasicAttribute.h" Android::Android():Human() { @@ -72,6 +74,11 @@ void Android::Initialize() AddSkill(skill_id); } } + if (GetHeroMeta()->GetBasicMeta()) { + SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id())); + } else { + SetHeroLevel(1, 0, nullptr); + } agent_->SetOwner(this); f8::BtMgr::Instance()->BtLoad(agent_, "hero/standard"); f8::BtMgr::Instance()->BtSetCurrent(agent_, "hero/standard"); diff --git a/server/gameserver/car.cc b/server/gameserver/car.cc index b57fa8ba..1628cbae 100644 --- a/server/gameserver/car.cc +++ b/server/gameserver/car.cc @@ -29,6 +29,8 @@ #include "mt/Equip.h" #include "mt/Buff.h" #include "mt/MapThing.h" +#include "mt/Map.h" +#include "mt/BattleBasicAttribute.h" Car::Car():Creature() { @@ -88,6 +90,11 @@ void Car::Initialize() AddSkill(skill_id); } } + if (GetHeroMeta()->GetBasicMeta()) { + SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id())); + } else { + SetHeroLevel(1, 0, nullptr); + } } Human* Car::GetPassengerBySeat(int seat) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 6698c391..ea405a54 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -110,11 +110,6 @@ void Human::Initialize() observers_.insert(this); SetCurrWeapon(&weapons[0]); SetOxygen(mt::Param::s().dive_oxygen_total); - if (GetHeroMeta()->GetBasicMeta()) { - SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id())); - } else { - SetHeroLevel(1, 0, nullptr); - } } float Human::GetSpeed() diff --git a/server/gameserver/mt/BattleBasicAttribute.cc b/server/gameserver/mt/BattleBasicAttribute.cc index d1b7dc15..24bc162a 100644 --- a/server/gameserver/mt/BattleBasicAttribute.cc +++ b/server/gameserver/mt/BattleBasicAttribute.cc @@ -1,6 +1,7 @@ #include "precompile.h" #include "mt/BattleBasicAttribute.h" +#include "mt/BattleHeroGrow.h" IMPL_TABLE(mt::BattleBasicAttribute) @@ -19,7 +20,7 @@ namespace mt const BattleHeroGrow* BattleBasicAttribute::GetGrowMeta(int map_id) const { - return nullptr; + return mt::BattleHeroGrow::GetByHeroIdLevel(id(), 1); } } diff --git a/server/gameserver/mt/BattleHeroGrow.cc b/server/gameserver/mt/BattleHeroGrow.cc index 33c2f1c0..d5e1595f 100644 --- a/server/gameserver/mt/BattleHeroGrow.cc +++ b/server/gameserver/mt/BattleHeroGrow.cc @@ -24,11 +24,11 @@ namespace mt for (auto& str : strings) { std::vector strings2; a8::Split(str, strings2, ':'); - if (strings.size() != 2) { + if (strings2.size() != 2) { abort(); } - int attr_id = a8::XValue(strings.at(0)); - float attr_val = a8::XValue(strings.at(1)).GetDouble(); + int attr_id = a8::XValue(strings2.at(0)); + float attr_val = a8::XValue(strings2.at(1)).GetDouble(); if (!IsValidHumanAttr(attr_id) && !IsValidHumanVirtualAttr(attr_id)) { abort(); diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index df812307..c153cbe4 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -44,6 +44,7 @@ #include "mt/Text.h" #include "mt/Map.h" #include "mt/PveGemini.h" +#include "mt/BattleBasicAttribute.h" const int kREVIVE_BUFF_ID = 1005; @@ -133,6 +134,11 @@ void Player::Initialize() }, &xtimer_attacher); } + if (GetHeroMeta()->GetBasicMeta()) { + SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id())); + } else { + SetHeroLevel(1, 0, nullptr); + } } void Player::Update(int delta_time)