Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏆 Add trophies #31

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "arcade_trophy"
version = "0.0.0"
source = "git+https://github.com/cartridge-gg/arcade?tag=v1.0.0#7bc838f173278e1b0b60044e32cc7c489230de92"
dependencies = [
"dojo",
]

[[package]]
name = "beasts"
version = "0.1.0"
Expand Down Expand Up @@ -266,6 +274,7 @@ source = "git+https://github.com/Provable-Games/pragma-lib.git?branch=2.7#a6ea9f
name = "savage_summit"
version = "1.0.0"
dependencies = [
"arcade_trophy",
"combat",
"dojo",
"dojo_cairo_test",
Expand Down
9 changes: 7 additions & 2 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ sierra-replace-ids = true
[dependencies]
starknet = "2.8.4"
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0" }
arcade_trophy = { git = "https://github.com/cartridge-gg/arcade", tag = "v1.0.0" }
openzeppelin_token = { git = "https://github.com/OpenZeppelin/cairo-contracts", tag = "v0.15.1" }
combat = { git = "https://github.com/Provable-Games/loot-survivor.git", branch = "feat/savage-summit-support" }
game = { git = "https://github.com/Provable-Games/loot-survivor.git", branch = "feat/savage-summit-support" }
pixel_beasts = { git = "https://github.com/leetship/beasts.git" }

[[target.starknet-contract]]
build-external-contracts = ["dojo::world::world_contract::world"]
build-external-contracts = [
"dojo::world::world_contract::world",
"arcade_trophy::events::index::e_TrophyCreation",
"arcade_trophy::events::index::e_TrophyProgression",
]

[dev-dependencies]
openzeppelin_test_common = { git = "https://github.com/OpenZeppelin/cairo-contracts", tag = "v0.15.1" }
Expand All @@ -26,4 +31,4 @@ dojo_cairo_test = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0" }
sort-module-level-items = true
max-line-length = 120

[profile.prod]
[profile.prod]
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/attacking.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Attacking of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'ATTACKING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Attack the summit {} times", count)
}
}
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/boosting.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Boosting of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'BOOSTING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Use {} attack potions", count)
}
}
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/feeding.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Feeding of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'FEEDING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Feed your beasts {} times", count)
}
}
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/healing.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Healing of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'HEALING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Heal your beast holding the summit {} times", count)
}
}
17 changes: 17 additions & 0 deletions contracts/src/elements/tasks/hodling.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Hodling of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'HODLING'
}

#[inline]
fn description(count: u32) -> ByteArray {
if count == 1 {
"Hold the summit for 1 hour total"
} else {
format!("Hold the summit for {} hours total", count)
}
}
}
4 changes: 4 additions & 0 deletions contracts/src/elements/tasks/interface.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait TaskTrait {
fn identifier(level: u8) -> felt252;
fn description(count: u32) -> ByteArray;
}
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/reviving.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Reviving of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'REVIVING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Revive your beast {} times", count)
}
}
13 changes: 13 additions & 0 deletions contracts/src/elements/tasks/savaging.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use savage_summit::elements::tasks::interface::TaskTrait;

impl Savaging of TaskTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
'SAVAGING'
}

#[inline]
fn description(count: u32) -> ByteArray {
format!("Take the summit {} times", count)
}
}
84 changes: 84 additions & 0 deletions contracts/src/elements/trophies/alchemist.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
use savage_summit::elements::trophies::interface::{TrophyTrait, BushidoTask, Task, TaskTrait};

impl Alchemist of TrophyTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
match level {
0 => 'ALCHEMIST_I',
1 => 'ALCHEMIST_II',
2 => 'ALCHEMIST_III',
_ => '',
}
}

#[inline]
fn hidden(level: u8) -> bool {
false
}

#[inline]
fn index(level: u8) -> u8 {
level
}

#[inline]
fn points(level: u8) -> u16 {
match level {
0 => 20,
1 => 40,
2 => 80,
_ => 0,
}
}

#[inline]
fn group() -> felt252 {
'Enchanter'
}

#[inline]
fn icon(level: u8) -> felt252 {
match level {
0 => 'fa-vial',
1 => 'fa-flask',
2 => 'fa-flask-vial',
_ => '',
}
}

#[inline]
fn title(level: u8) -> felt252 {
match level {
0 => 'Alchemist I',
1 => 'Alchemist II',
2 => 'Alchemist III',
_ => '',
}
}

#[inline]
fn description(level: u8) -> ByteArray {
match level {
0 => "To the alchemist, transformation is life's highest art",
1 => "Alchemy is the journey from what is to what could be",
2 => "The alchemist sees gold not as a metal, but as the soul's final form",
_ => "",
}
}

#[inline]
fn count(level: u8) -> u32 {
match level {
0 => 100,
1 => 500,
2 => 1000,
_ => 0,
}
}

#[inline]
fn tasks(level: u8) -> Span<BushidoTask> {
let total: u32 = Self::count(level);
Task::Boosting.tasks(level, total, total)
}
}
84 changes: 84 additions & 0 deletions contracts/src/elements/trophies/apothecary.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
use savage_summit::elements::trophies::interface::{TrophyTrait, BushidoTask, Task, TaskTrait};

impl Apothecary of TrophyTrait {
#[inline]
fn identifier(level: u8) -> felt252 {
match level {
0 => 'APOTHECARY_I',
1 => 'APOTHECARY_II',
2 => 'APOTHECARY_III',
_ => '',
}
}

#[inline]
fn hidden(level: u8) -> bool {
false
}

#[inline]
fn index(level: u8) -> u8 {
level
}

#[inline]
fn points(level: u8) -> u16 {
match level {
0 => 20,
1 => 40,
2 => 80,
_ => 0,
}
}

#[inline]
fn group() -> felt252 {
'Enchanter'
}

#[inline]
fn icon(level: u8) -> felt252 {
match level {
0 => 'fa-heart-half',
1 => 'fa-heart-half-stroke',
2 => 'fa-heart-pulse',
_ => '',
}
}

#[inline]
fn title(level: u8) -> felt252 {
match level {
0 => 'Apothecary I',
1 => 'Apothecary II',
2 => 'Apothecary III',
_ => '',
}
}

#[inline]
fn description(level: u8) -> ByteArray {
match level {
0 => "The art of the apothecary lies not in curing, but in the quiet mastery of nature's secrets",
1 => "An apothecary's shelves hold not just potions, but whispered cures, quiet fears, and ancient lore",
2 => "From the right hands, a simple tincture becomes a life saved",
_ => "",
}
}

#[inline]
fn count(level: u8) -> u32 {
match level {
0 => 100,
1 => 500,
2 => 1000,
_ => 0,
}
}

#[inline]
fn tasks(level: u8) -> Span<BushidoTask> {
let total: u32 = Self::count(level);
Task::Healing.tasks(level, total, total)
}
}
Loading