Skip to content

Commit

Permalink
fixing some misconceptions about achivement bit
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherGlick committed May 19, 2024
1 parent 31db759 commit d874564
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 55 deletions.
49 changes: 41 additions & 8 deletions xml_converter/doc/acheivement/achievement_bitmask.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
---
name: Achievement Bitmask
type: Fixed32
name: Achievement Bit Index
type: Int32
applies_to: [Icon, Trail]
xml_fields: ["AchievementBit"]
protobuf_field: achievement_bit
xml_fields: ["AchievementBit", "AchievementBitIndex"]
protobuf_field: achievement_bit_index
examples: ["0", "1", "2", "14"]
---
A portion of an achievement that, if completed, will hide this marker.
A portion of the achievement that will hide this marker if it is completed.

This value corrisponds to an `index` of a "bit" of an achivment. For example we can look at the achivement "RGB" which has the id `2655`.

[https://api.guildwars2.com/v2/achievements?ids=2655](https://api.guildwars2.com/v2/achievements?ids=2655)

```json
[
{
"id": 2655,
"name": "RGB",
"description": "",
"requirement": "Obtain each pylon attunement once, and defeat the Vale Guardian.",
"locked_text": "",
"type": "Default",
"flags": ["Permanent"],
"bits": [
{"type": "Text", "text": "Red Attunement"},
{"type": "Text", "text": "Green Attunement"},
{"type": "Text", "text": "Blue Attunement"}
],
"tiers": [{"count": 3, "points": 1}]
}
]
```
`Red Attunement` is the first one, so because we start with 0 it has the index **"0"**
`Green Attunement` is the second, so it has the index **"1"**
`Blue Attunement` is the third, so it has the index **"2"**

If we wanted to hide this marker when "Green Attunment" had been completed we would set the Achievement Bit Index to `1`



External Resources
--------------------------------------------------------------------------------
* [https://gw2pathing.com/docs/marker-dev/attributes/achievement/](https://gw2pathing.com/docs/marker-dev/attributes/achievement/)

Notes
=====

https://blishhud.com/docs/markers/attributes/achievement
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
<POI AchievementBit="5" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI AchievementBit="2147483647" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<Trail AchievementBit="5" Type="mycategory" />

<!-- TODO: textproto seems to think a fixed32 is a uint32, but we support negative values for this currently. We should probably adjust that -->
<POI AchievementBit="-2147483648" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
<POI AchievementBit="-5" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />

<!-- TODO: These throw errors and crash but probably should not if this were a uint32 -->
<!-- <POI AchievementBit="4294967295" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" /> -->
<!-- <POI AchievementBit="2147483648" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" /> -->
<POI AchievementBit="2147483647" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" />
</POIs>
</OverlayData>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<POI AchievementBit="5" Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI AchievementBit="2147483647" Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<Trail AchievementBit="5" Type="mycategory"/>
<POI AchievementBit="-2147483648" Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI AchievementBit="-5" Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI AchievementBit="2147483647" Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

�
My Category 2B\�)Cf�RC{�WC 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC����� 2B\�)Cf�RC{�WC���������� 2B\�)Cf�RC{�WC����������"�B(��“^�
My Category 2B\�)Cf�RC{�WC 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC� 2B\�)Cf�RC{�WC����� 2B\�)Cf�RC{�WC���������� 2B\�)Cf�RC{�WC����������"�B(��“^�
Expand Down
10 changes: 6 additions & 4 deletions xml_converter/proto/waypoint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ message Icon {
Trigger trigger = 9;
EulerRotation euler_rotation = 10;

fixed32 achievement_bit = 16;
int32 achievement_id = 17;
int32 achievement_id = 16;
int32 achievement_bit_index = 17;

bool disable_player_cutout = 19;
int32 minimum_size_on_screen = 20;
int32 map_display_size = 21;
Expand Down Expand Up @@ -75,8 +76,9 @@ message Trail {
TrailData trail_data = 7;
float animation_speed = 8;

fixed32 achievement_bit = 16;
int32 achievement_id = 17;
int32 achievement_id = 16;
int32 achievement_bit_index = 17;

bool disable_player_cutout = 19;
bool is_wall = 20;
float scale = 21;
Expand Down
31 changes: 17 additions & 14 deletions xml_converter/src/icon_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<XMLEr
string attributename;
attributename = normalize(get_attribute_name(attribute));
if (attributename == "achievementbit") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bitmask), &(this->achievement_bitmask_is_set));
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
else if (attributename == "achievementbitindex") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
else if (attributename == "achievementid") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_id), &(this->achievement_id_is_set));
Expand Down Expand Up @@ -255,8 +258,8 @@ bool Icon::validate_attributes_of_type_marker_category() {
vector<string> Icon::as_xml(XMLWriterState* state) const {
vector<string> xml_node_contents;
xml_node_contents.push_back("<POI ");
if (this->achievement_bitmask_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", state, &this->achievement_bitmask));
if (this->achievement_bit_index_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", state, &this->achievement_bit_index));
}
if (this->achievement_id_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementId", state, &this->achievement_id));
Expand Down Expand Up @@ -408,9 +411,9 @@ vector<string> Icon::as_xml(XMLWriterState* state) const {

waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const {
waypoint::Icon proto_icon;
if (this->achievement_bitmask_is_set) {
std::function<void(int)> setter = [&proto_icon](int val) { proto_icon.set_achievement_bit(val); };
int_to_proto(this->achievement_bitmask, state, setter);
if (this->achievement_bit_index_is_set) {
std::function<void(int)> setter = [&proto_icon](int val) { proto_icon.set_achievement_bit_index(val); };
int_to_proto(this->achievement_bit_index, state, setter);
}
if (this->achievement_id_is_set) {
std::function<void(int)> setter = [&proto_icon](int val) { proto_icon.set_achievement_id(val); };
Expand Down Expand Up @@ -600,8 +603,8 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const {
}

void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) {
if (proto_icon.achievement_bit() != 0) {
proto_to_int(proto_icon.achievement_bit(), state, &(this->achievement_bitmask), &(this->achievement_bitmask_is_set));
if (proto_icon.achievement_bit_index() != 0) {
proto_to_int(proto_icon.achievement_bit_index(), state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
if (proto_icon.achievement_id() != 0) {
proto_to_int(proto_icon.achievement_id(), state, &(this->achievement_id), &(this->achievement_id_is_set));
Expand Down Expand Up @@ -750,9 +753,9 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) {
// underlay argument.
////////////////////////////////////////////////////////////////////////////////
void Icon::apply_underlay(const Icon& underlay) {
if (!this->achievement_bitmask_is_set && underlay.achievement_bitmask_is_set) {
this->achievement_bitmask = underlay.achievement_bitmask;
this->achievement_bitmask_is_set = true;
if (!this->achievement_bit_index_is_set && underlay.achievement_bit_index_is_set) {
this->achievement_bit_index = underlay.achievement_bit_index;
this->achievement_bit_index_is_set = true;
}
if (!this->achievement_id_is_set && underlay.achievement_id_is_set) {
this->achievement_id = underlay.achievement_id;
Expand Down Expand Up @@ -947,9 +950,9 @@ void Icon::apply_underlay(const Icon& underlay) {
// top of this class.
////////////////////////////////////////////////////////////////////////////////
void Icon::apply_overlay(const Icon& overlay) {
if (overlay.achievement_bitmask_is_set) {
this->achievement_bitmask = overlay.achievement_bitmask;
this->achievement_bitmask_is_set = true;
if (overlay.achievement_bit_index_is_set) {
this->achievement_bit_index = overlay.achievement_bit_index;
this->achievement_bit_index_is_set = true;
}
if (overlay.achievement_id_is_set) {
this->achievement_id = overlay.achievement_id;
Expand Down
4 changes: 2 additions & 2 deletions xml_converter/src/icon_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class XMLError;

class Icon : public Parseable {
public:
int achievement_bitmask;
int achievement_bit_index;
int achievement_id;
bool auto_trigger;
float bounce_delay;
Expand Down Expand Up @@ -74,7 +74,7 @@ class Icon : public Parseable {
std::string tooltip_description;
std::string tooltip_name;
float trigger_range;
bool achievement_bitmask_is_set = false;
bool achievement_bit_index_is_set = false;
bool achievement_id_is_set = false;
bool auto_trigger_is_set = false;
bool bounce_delay_is_set = false;
Expand Down
31 changes: 17 additions & 14 deletions xml_converter/src/trail_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ bool Trail::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vector<XMLE
string attributename;
attributename = normalize(get_attribute_name(attribute));
if (attributename == "achievementbit") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bitmask), &(this->achievement_bitmask_is_set));
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
else if (attributename == "achievementbitindex") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
else if (attributename == "achievementid") {
xml_attribute_to_int(attribute, errors, state, &(this->achievement_id), &(this->achievement_id_is_set));
Expand Down Expand Up @@ -156,8 +159,8 @@ bool Trail::validate_attributes_of_type_marker_category() {
vector<string> Trail::as_xml(XMLWriterState* state) const {
vector<string> xml_node_contents;
xml_node_contents.push_back("<Trail ");
if (this->achievement_bitmask_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", state, &this->achievement_bitmask));
if (this->achievement_bit_index_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", state, &this->achievement_bit_index));
}
if (this->achievement_id_is_set) {
xml_node_contents.push_back(int_to_xml_attribute("AchievementId", state, &this->achievement_id));
Expand Down Expand Up @@ -246,9 +249,9 @@ vector<string> Trail::as_xml(XMLWriterState* state) const {

waypoint::Trail Trail::as_protobuf(ProtoWriterState* state) const {
waypoint::Trail proto_trail;
if (this->achievement_bitmask_is_set) {
std::function<void(int)> setter = [&proto_trail](int val) { proto_trail.set_achievement_bit(val); };
int_to_proto(this->achievement_bitmask, state, setter);
if (this->achievement_bit_index_is_set) {
std::function<void(int)> setter = [&proto_trail](int val) { proto_trail.set_achievement_bit_index(val); };
int_to_proto(this->achievement_bit_index, state, setter);
}
if (this->achievement_id_is_set) {
std::function<void(int)> setter = [&proto_trail](int val) { proto_trail.set_achievement_id(val); };
Expand Down Expand Up @@ -358,8 +361,8 @@ waypoint::Trail Trail::as_protobuf(ProtoWriterState* state) const {
}

void Trail::parse_protobuf(waypoint::Trail proto_trail, ProtoReaderState* state) {
if (proto_trail.achievement_bit() != 0) {
proto_to_int(proto_trail.achievement_bit(), state, &(this->achievement_bitmask), &(this->achievement_bitmask_is_set));
if (proto_trail.achievement_bit_index() != 0) {
proto_to_int(proto_trail.achievement_bit_index(), state, &(this->achievement_bit_index), &(this->achievement_bit_index_is_set));
}
if (proto_trail.achievement_id() != 0) {
proto_to_int(proto_trail.achievement_id(), state, &(this->achievement_id), &(this->achievement_id_is_set));
Expand Down Expand Up @@ -448,9 +451,9 @@ void Trail::parse_protobuf(waypoint::Trail proto_trail, ProtoReaderState* state)
// underlay argument.
////////////////////////////////////////////////////////////////////////////////
void Trail::apply_underlay(const Trail& underlay) {
if (!this->achievement_bitmask_is_set && underlay.achievement_bitmask_is_set) {
this->achievement_bitmask = underlay.achievement_bitmask;
this->achievement_bitmask_is_set = true;
if (!this->achievement_bit_index_is_set && underlay.achievement_bit_index_is_set) {
this->achievement_bit_index = underlay.achievement_bit_index;
this->achievement_bit_index_is_set = true;
}
if (!this->achievement_id_is_set && underlay.achievement_id_is_set) {
this->achievement_id = underlay.achievement_id;
Expand Down Expand Up @@ -565,9 +568,9 @@ void Trail::apply_underlay(const Trail& underlay) {
// top of this class.
////////////////////////////////////////////////////////////////////////////////
void Trail::apply_overlay(const Trail& overlay) {
if (overlay.achievement_bitmask_is_set) {
this->achievement_bitmask = overlay.achievement_bitmask;
this->achievement_bitmask_is_set = true;
if (overlay.achievement_bit_index_is_set) {
this->achievement_bit_index = overlay.achievement_bit_index;
this->achievement_bit_index_is_set = true;
}
if (overlay.achievement_id_is_set) {
this->achievement_id = overlay.achievement_id;
Expand Down
4 changes: 2 additions & 2 deletions xml_converter/src/trail_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class XMLError;

class Trail : public Parseable {
public:
int achievement_bitmask;
int achievement_bit_index;
int achievement_id;
float animation_speed;
MarkerCategory category;
Expand All @@ -52,7 +52,7 @@ class Trail : public Parseable {
Image texture;
TrailData trail_data;
float trail_scale;
bool achievement_bitmask_is_set = false;
bool achievement_bit_index_is_set = false;
bool achievement_id_is_set = false;
bool animation_speed_is_set = false;
bool category_is_set = false;
Expand Down

0 comments on commit d874564

Please sign in to comment.