-
Notifications
You must be signed in to change notification settings - Fork 404
feat(examples): pokemon fight simulator game at r/leo/pokemon
#4072
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
base: master
Are you sure you want to change the base?
feat(examples): pokemon fight simulator game at r/leo/pokemon
#4072
Conversation
🛠 PR Checks Summary🔴 Pending initial approval by a review team member, or review from tech-staff Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
14b4c01
to
6be7a81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is quite small, i suggest you deploy this permissionlessly :)
pokemonPath = map[RenderPage]func(map[string]string) string{ | ||
pokemonLogin: renderPokemonLogin, | ||
pokemonLobby: renderPokemonLobby, | ||
pokemonTeamSelector: renderPokemonTeam, | ||
pokemonFight: renderPokemonFight, | ||
pokemonShop: renderPokemonShop, | ||
pokemonRank: renderPokemonRank, | ||
} | ||
) | ||
|
||
func Render(path string) (rend string) { | ||
rend += md.H1("Pokémon") | ||
path, params := utils.ParsePath(path) | ||
|
||
if pathRenderer := pokemonPath[RenderPage(path)]; pathRenderer != nil && pokemonDAO.IsMember(std.Address(params["user"])) { | ||
rend += pathRenderer(params) | ||
} else { | ||
rend += renderPokemonLogin(params) | ||
} | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cool approach, but I suggest using one of the libraries we have for routing, such as the p/demo/mux
library, which is more go-like :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this library also provides a simple way to get query parameters. check out https://gno.land/r/docs/routing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
var ( | ||
rand = randomizer.NewRandomizer() | ||
nl = "\n\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be const as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ! a6ca485
for i, e := range pokemonDAO.userData { | ||
link := atm_path + ":" + string(pokemonLobby) + "?user=" + string(pokemonDAO.GetMembers()[i]) | ||
rend += " - " + md.Link(string(pokemonDAO.GetMembers()[i]), link) | ||
rend += " : " + renderPokedollar(int(e.pokedollar)) + nl | ||
} | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be nice to use r/sys/users
:)
check out https://gno.land/r/docs/use_rsysusers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please check the CI! |
…m-pokemon-game-for-demo
Added
Realms:
r/leo/pokemon
A small Pokémon fight simulator game to showcase what a ranked game could look like using blockchain.
p/leo/randomizer
bymath/rand
p/leo/renderer
byp/moul/md
andp/moul/mdtable
r/leo/home
idk
Pures:
p/leo/randomizer
– A simplifiedmath/rand
. This is a temporary solution and will be removed once its issues are resolved.p/leo/utils
– A collection of useful functions for Gno development.p/leo/dao
– A basic and easily reusable dao system.p/leo/renderer
– A markdown library for features not implemented byp/moul/md
, such as parameterized headers or table rendering.