nitrpg: use is_ack
authorJean Privat <jean@pryen.org>
Fri, 8 May 2015 18:21:10 +0000 (14:21 -0400)
committerJean Privat <jean@pryen.org>
Fri, 8 May 2015 18:21:10 +0000 (14:21 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/nitrpg/src/achievements.nit
contrib/nitrpg/src/reactors.nit
contrib/nitrpg/src/statistics.nit

index 99cc0c2..c799b86 100644 (file)
@@ -490,7 +490,7 @@ class PlayerFirstReview
        redef fun react_event(game, event) do
                if not event isa IssueCommentEvent then return
                # FIXME use a more precise way to locate reviews
-               if event.comment.has_ok_review then
+               if event.comment.is_ack then
                        var player = event.comment.user.player(game)
                        var a = new_achievement(game)
                        player.unlock_achievement(a, event)
index 79a3682..2424d86 100644 (file)
@@ -88,12 +88,9 @@ redef class IssueCommentEvent
 
        # Rewards player for review comments.
        #
-       # Actuallty we look if the comment contains the string `"+1"`.
-       #
        # TODO only give nitcoins if reviewers < 2
        redef fun react_player_event(r, game) do
-               # FIXME use a more precise way to locate reviews
-               if comment.body.has("\\+1\\b".to_re) then
+               if comment.is_ack then
                        react_player_review(r, game)
                end
        end
index e8afccc..b7d3530 100644 (file)
@@ -273,7 +273,7 @@ redef class IssueCommentEvent
                        game.stats.inc("comments")
                        player.stats.inc("comments")
                        # FIXME use a more precise way to locate reviews
-                       if comment.has_ok_review then
+                       if comment.is_ack then
                                game.stats.inc("reviews")
                                player.stats.inc("reviews")
                        end
@@ -282,8 +282,3 @@ redef class IssueCommentEvent
                end
        end
 end
-
-redef class IssueComment
-       # Does this comment contain a "+1"?
-       fun has_ok_review: Bool do return body.has("\\+1\\b".to_re)
-end