-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
457 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#[derive(Copy, Clone)] | ||
pub(crate) enum Charm { | ||
Cursed, | ||
Epic, | ||
Legendary, | ||
Lost, | ||
Nineball, | ||
Rare, | ||
Reinscription, | ||
Unbound, | ||
Uncommon, | ||
} | ||
|
||
impl Charm { | ||
pub(crate) const ALL: [Charm; 9] = [ | ||
Charm::Uncommon, | ||
Charm::Rare, | ||
Charm::Epic, | ||
Charm::Legendary, | ||
Charm::Nineball, | ||
Charm::Reinscription, | ||
Charm::Cursed, | ||
Charm::Unbound, | ||
Charm::Lost, | ||
]; | ||
|
||
fn flag(self) -> u16 { | ||
1 << self as u16 | ||
} | ||
|
||
pub(crate) fn set(self, charms: &mut u16) { | ||
*charms |= self.flag(); | ||
} | ||
|
||
pub(crate) fn is_set(self, charms: u16) -> bool { | ||
charms & self.flag() != 0 | ||
} | ||
|
||
pub(crate) fn icon(self) -> &'static str { | ||
match self { | ||
Charm::Cursed => "👹", | ||
Charm::Epic => "🪻", | ||
Charm::Legendary => "🌝", | ||
Charm::Lost => "🤔", | ||
Charm::Nineball => "9️⃣", | ||
Charm::Rare => "🧿", | ||
Charm::Reinscription => "♻️", | ||
Charm::Unbound => "🔓", | ||
Charm::Uncommon => "🌱", | ||
} | ||
} | ||
|
||
pub(crate) fn title(self) -> &'static str { | ||
match self { | ||
Charm::Cursed => "cursed", | ||
Charm::Epic => "epic", | ||
Charm::Legendary => "legendary", | ||
Charm::Lost => "lost", | ||
Charm::Nineball => "nineball", | ||
Charm::Rare => "rare", | ||
Charm::Reinscription => "reinscription", | ||
Charm::Unbound => "unbound", | ||
Charm::Uncommon => "uncommon", | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I believe this doesn't handle the reinscriptions that are created when a sat is inscribed multiple times at once (in 1 txn). inscribed_offsets gets inscriptions from previous transactions only is my guess, and not the current txn which might have both the first inscription of that sat and subsequent reinscriptions.