1
This commit is contained in:
parent
4ca93f2f97
commit
6a64ee20c6
@ -20,9 +20,11 @@ int BagItem::GetCdTime(Human* hum)
|
|||||||
(potion_meta->cooldown() * SERVER_FRAME_RATE - (hum->room->GetFrameNo() - last_use_tick)) * FRAME_RATE_MS);
|
(potion_meta->cooldown() * SERVER_FRAME_RATE - (hum->room->GetFrameNo() - last_use_tick)) * FRAME_RATE_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bag::Parse(const std::list<int>& items)
|
void Bag::Parse(const std::list<std::tuple<int, int>>& items)
|
||||||
{
|
{
|
||||||
for (auto item_id : items) {
|
for (auto tuple : items) {
|
||||||
|
auto item_id = std::get<0>(tuple);
|
||||||
|
auto item_num = std::get<1>(tuple);
|
||||||
auto item_meta = mt::Item::GetById(item_id);
|
auto item_meta = mt::Item::GetById(item_id);
|
||||||
if (item_meta) {
|
if (item_meta) {
|
||||||
auto potion_meta = mt::BattlePotion::GetById(item_id);
|
auto potion_meta = mt::BattlePotion::GetById(item_id);
|
||||||
@ -30,7 +32,7 @@ void Bag::Parse(const std::list<int>& items)
|
|||||||
if (potion_meta && equip_meta) {
|
if (potion_meta && equip_meta) {
|
||||||
auto p = std::make_shared<BagItem>();
|
auto p = std::make_shared<BagItem>();
|
||||||
p->equip_id = equip_meta->id();
|
p->equip_id = equip_meta->id();
|
||||||
p->equip_num = 10;
|
p->equip_num = item_num;
|
||||||
p->item_meta = item_meta;
|
p->item_meta = item_meta;
|
||||||
p->potion_meta = potion_meta;
|
p->potion_meta = potion_meta;
|
||||||
p->equip_meta = equip_meta;
|
p->equip_meta = equip_meta;
|
||||||
|
@ -26,7 +26,7 @@ class Bag
|
|||||||
Bag(Human* owner) { owner_ = owner; };
|
Bag(Human* owner) { owner_ = owner; };
|
||||||
void UseItem(int equip_id);
|
void UseItem(int equip_id);
|
||||||
void PushBagInfo();
|
void PushBagInfo();
|
||||||
void Parse(const std::list<int>& items);
|
void Parse(const std::list<std::tuple<int, int>>& items);
|
||||||
std::shared_ptr<BagItem> GetItemById(int equip_id);
|
std::shared_ptr<BagItem> GetItemById(int equip_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -546,11 +546,13 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
|||||||
avatars_.push_back(290001);
|
avatars_.push_back(290001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if (hero_dto->HasKey("items") && hero_dto->At("items")->IsArray()) {
|
if (hero_dto->HasKey("items") && hero_dto->At("items")->IsArray()) {
|
||||||
for (int i = 0; i < hero_dto->At("items")->Size(); ++i) {
|
for (int i = 0; i < hero_dto->At("items")->Size(); ++i) {
|
||||||
items_.push_back(hero_dto->At("items")->At(i)->AsXValue());
|
items_.push_back(hero_dto->At("items")->At(i)->AsXValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (obj.HasKey("honor_info") && obj.At("honor_info")->IsArray()) {
|
if (obj.HasKey("honor_info") && obj.At("honor_info")->IsArray()) {
|
||||||
auto honor_info = obj.At("honor_info");
|
auto honor_info = obj.At("honor_info");
|
||||||
|
@ -100,7 +100,7 @@ struct BattleDataContext
|
|||||||
int GetHonor();
|
int GetHonor();
|
||||||
int GetElo() { return elo_; }
|
int GetElo() { return elo_; }
|
||||||
const std::list<int>& GetAvatars() { return avatars_; }
|
const std::list<int>& GetAvatars() { return avatars_; }
|
||||||
const std::list<int>& GetItems() { return items_; }
|
const std::list<std::tuple<int, int>>& GetItems() { return items_; }
|
||||||
std::shared_ptr<HeroAbility> GetHeroAbility() { return hero_ability_; }
|
std::shared_ptr<HeroAbility> GetHeroAbility() { return hero_ability_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -131,7 +131,7 @@ private:
|
|||||||
int battle_times_ = 0;
|
int battle_times_ = 0;
|
||||||
|
|
||||||
std::list<int> avatars_;
|
std::list<int> avatars_;
|
||||||
std::list<int> items_;
|
std::list<std::tuple<int, int>> items_;
|
||||||
|
|
||||||
int skill1_lv = 1;
|
int skill1_lv = 1;
|
||||||
int skill2_lv = 1;
|
int skill2_lv = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user