-
Notifications
You must be signed in to change notification settings - Fork 37
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
Achievement Chain #30
Comments
YES! I came here looking for exactly this functionality. I have some workarounds going in the meanwhile, but I think this is a grand solution. Another potential thing to look at is whether an achievement is "replaceable" - that is, if an achievement higher in the chain has been unlocked, the lower ones stop displaying. Thereby "transforming" my "newcomer" achievement into a "regular commenter" achievement. |
In the way you put it, "Replaceable" seems like a good idea. I agree that sometimes it's necessary to retrieve the highest achievement unlocked in the chain. Maybe the AchievementChain could return an instance of AchievementProgress of the higher achievement unlocked in the chain? I'm thinking of something like: <?php
use App\Achievements\Newcomer; // Create 1 comment
use App\Achievements\RegularCommenter; // Create 10 comments
use App\Achievements\VeteranCommenter; // Create 100 comments
class CommentAchievements implements AchievementChain{
public function chain(){
return [Newcomer::class, RegularCommenter::class, VeteranCommenter::class];
}
}
|
Aha, now that I understand the philosophy the package was designed on, your method of returning the highest unlocked in the chain is indeed a better method of implementing, and would work exactly as needed for this situation. It does bring up the need for a method like getAchievementsOrHighest() or something like that - for when you want to get all the achievements someone has earned, but only the highest if they're in a chain? |
The feature for AchievementChain has been pushed to the master branch. It's still on development since there is no release version for it. |
Is the command "php artisan achievements:load" working with chains for you when it process the chain? |
Sometimes, there are multiple achievements that track the exact same thing, but with different points to obtain.
For example, an user can obtain a "Newcomer" achievement when creating their first comment on the site, a "Regular Commenter" achievement when they reached 10 comments and a "Regular Commenter" achievement when they reached 100 comments.
Currently, these achievements need to be tracked separately, something like this:
And this would quickly grow out of hand when there are many achievements tracking the same thing. In order to solve this problem, I propose a feature called "Achievement Chain". It would work in the following way:
AchievementChain
will be created. This class will be defined only by a list of achievements.The text was updated successfully, but these errors were encountered: