handle unsealable items on BB
This commit is contained in:
+10
-2
@@ -262,9 +262,17 @@ void ItemData::add_mag_photon_blast(uint8_t pb_num) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t ItemData::get_sealed_item_kill_count() const {
|
||||||
|
return ((this->data1[10] << 8) | this->data1[11]) & 0x7FFF;
|
||||||
|
}
|
||||||
|
|
||||||
void ItemData::set_sealed_item_kill_count(uint16_t v) {
|
void ItemData::set_sealed_item_kill_count(uint16_t v) {
|
||||||
this->data1[10] = (v >> 8) | 0x80;
|
if (v > 0x7FFF) {
|
||||||
this->data1[11] = v;
|
this->data1w[5] = 0xFFFF;
|
||||||
|
} else {
|
||||||
|
this->data1[10] = (v >> 8) | 0x80;
|
||||||
|
this->data1[11] = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ItemData::get_tool_item_amount() const {
|
uint8_t ItemData::get_tool_item_amount() const {
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ struct ItemData { // 0x14 bytes
|
|||||||
bool mag_has_photon_blast_in_any_slot(uint8_t pb_num) const;
|
bool mag_has_photon_blast_in_any_slot(uint8_t pb_num) const;
|
||||||
void add_mag_photon_blast(uint8_t pb_num);
|
void add_mag_photon_blast(uint8_t pb_num);
|
||||||
|
|
||||||
|
uint16_t get_sealed_item_kill_count() const;
|
||||||
void set_sealed_item_kill_count(uint16_t v);
|
void set_sealed_item_kill_count(uint16_t v);
|
||||||
uint8_t get_tool_item_amount() const;
|
uint8_t get_tool_item_amount() const;
|
||||||
void set_tool_item_amount(uint8_t amount);
|
void set_tool_item_amount(uint8_t amount);
|
||||||
|
|||||||
@@ -1497,8 +1497,16 @@ static void on_enemy_killed_bb(shared_ptr<ServerState> s,
|
|||||||
if (leveled_up) {
|
if (leveled_up) {
|
||||||
send_level_up(l, other_c);
|
send_level_up(l, other_c);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Update kill counts on unsealable items
|
// Update kill counts on unsealable items
|
||||||
|
auto& inventory = c->game_data.player()->inventory;
|
||||||
|
for (size_t z = 0; z < inventory.num_items; z++) {
|
||||||
|
auto& item = inventory.items[z];
|
||||||
|
if ((item.flags & 0x08) &&
|
||||||
|
s->item_parameter_table->is_unsealable_item(item.data)) {
|
||||||
|
item.data.set_sealed_item_kill_count(item.data.get_sealed_item_kill_count() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user