Maxim Sokhatsky 11 лет назад
Родитель
Сommit
3edaffa9b0

+ 2 - 2
apps/server/src/game_manager.erl

@@ -429,7 +429,7 @@ start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,
 
  if NumberOfPlayers - length(RealPlayersUnsorted) > 300 ->
            nsm_db:put(Tournament#tournament{status=canceled}),
-           nsx_msg:notify([tournament, TrnId, cancel], {TrnId}),
+           wf:send([tournament, TrnId, cancel], {TrnId}),
            error;
        true ->
 
@@ -467,7 +467,7 @@ start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,
                        {awards, GiftIds}],
              {ok,GameId,A} = create_elimination_trn(GameType, Params, Registrants),
              nsm_db:put(Tournament#tournament{status=activated,start_time=time()}),
-             nsx_msg:notify([tournament, TrnId, activate], {TrnId}),
+             wf:send([tournament, TrnId, activate], {TrnId}),
              {ok,GameId,A}
          end || _ <-lists:seq(1,NumberOfTournaments)],
     [{ok,OP1,_}|_] = OkeyTournaments,

+ 6 - 5
apps/server/src/game_session.erl

@@ -105,7 +105,7 @@ handle_info({delivery, ["user_action", Action, Who, Whom], _} = Notification,
                                              type = Type
                                             },
                     % TODO: put real db change notification from users:343 module here
-                    %       nsx_msg:notify_db_subscription_change
+                    %       wf:send_db_subscription_change
                     %       should be additionaly subscribed in bg feed worker binded to USER_EXCHANGE
 
                     ok = send_message_to_player(RPC, Msg);
@@ -231,11 +231,11 @@ handle_client_request(#social_action_msg{type=Type, initiator=P1, recipient=P2},
             {reply, ok, State};
         ?SOCIAL_ACTION_BLOCK ->
             Subject = binary_to_list(P2),
-            nsx_msg:notify(["subscription", "user", UserId, "block_user"], {Subject}),
+            wf:send(["subscription", "user", UserId, "block_user"], {Subject}),
             {reply, ok, State};
         ?SOCIAL_ACTION_UNBLOCK ->
             Subject = binary_to_list(P2),
-            nsx_msg:notify(["subscription", "user", UserId, "unblock_user"], {Subject}),
+            wf:send(["subscription", "user", UserId, "unblock_user"], {Subject}),
             {reply, ok, State};
         ?SOCIAL_ACTION_LOVE ->
             {reply, ok, State};
@@ -273,8 +273,9 @@ handle_client_request(#subscribe_player_rels{players = Players}, _From,
     %% Create subscription if we need
     NewRelsChannel =
         if RelsChannel == undefined ->
-               {ok, Channel} = nsx_msg:subscribe_for_user_actions(UserIdStr, self()),
-               Channel;
+%               {ok, Channel} = nsx_msg:subscribe_for_user_actions(UserIdStr, self()),
+%               Channel;
+                ResChannel;
            true ->
                RelsChannel
         end,

+ 3 - 3
apps/server/src/game_stats.erl

@@ -172,12 +172,12 @@ assign_points(RawResults, GameInfo) ->
                                      timestamp = erlang:now()
                                     },
                 Route = [feed, user, UserId, scores, 0, add],  % maybe it would require separate worker for this
-                nsx_msg:notify(Route, [SR]),
+                wf:send(Route, [SR]),
                 {Wins, Loses} = if Winner-> {1, 0};
                                    true -> {0, 1}
                                 end,
                 % haven't found a way to properly get average time
-                nsx_msg:notify([personal_score, user, UserId, add],
+                wf:send([personal_score, user, UserId, add],
                                {_Games = 1, Wins, Loses, _Disconnects = 0, GamePoints, 0});
             true -> do_nothing  % no statistics for robots
          end,
@@ -203,7 +203,7 @@ assign_points(RawResults, GameInfo) ->
                   || #result{player_id = UserId, robot = Robot, pos = Pos,
                              kakush_points = KPoints, game_points = GPoints} <- Results],
     ?INFO("GAME_STATS <~p> Notificaton: ~p", [GameId, {{GameName, GameType}, GameEndRes}]),
-    nsx_msg:notify(["system", "game_ends_note"], {{GameName, GameType}, GameEndRes}).
+    wf:send(["system", "game_ends_note"], {{GameName, GameType}, GameEndRes}).
 
 is_bot(UserId, Players) ->
     case lists:keyfind(UserId, #'PlayerInfo'.id, Players) of

+ 3 - 3
apps/server/src/nsg_trn_elimination.erl

@@ -646,7 +646,7 @@ process_tour_result(#state{game_id = GameId, tournament_table = TTable, tours =
        || {TableId, TableResultWithPos} <- TablesResultsWithPos],
     TourResultWithStrUserId = [{user_id_to_string(UserId), Position, Points, Status}
                                || {UserId, Position, Points, Status} <- TourResultWithUserId],
-    nsx_msg:notify(["system", "tournament_tour_note"], {TrnId, Tour, Tours, TourType, TourResultWithStrUserId}),
+    wf:send(["system", "tournament_tour_note"], {TrnId, Tour, Tours, TourType, TourResultWithStrUserId}),
     {TRef, Magic} = start_timer(?SHOW_SERIES_RESULT_TIMEOUT),
     ?INFO("TRN_ELIMINATION <~p> Results processing of tour <~p> is finished. "
           "Waiting some time (~p secs) before continue...",
@@ -661,11 +661,11 @@ finalize_tournament(#state{game_id = GameId, awards = Awards, tournament_table =
     AwardsDistrib = awards_distribution(TTable, Awards),
     AwardsDistribUserId = [{user_id_to_string(get_user_id(PlayerId, Players)), Pos, GiftId}
                            || {PlayerId, Pos, GiftId} <- AwardsDistrib],
-    [nsx_msg:notify(["gifts", "user", UserId, "give_gift"], {GiftId})
+    [wf:send(["gifts", "user", UserId, "give_gift"], {GiftId})
        || {UserId, _Pos, GiftId} <- AwardsDistribUserId],
     %% TODO: Do we need advertise the prizes to game clients?
     ?INFO("TRN_ELIMINATION <~p> Awards distribution: ~p", [GameId, AwardsDistribUserId]),
-    nsx_msg:notify(["system", "tournament_ends_note"], {TrnId, AwardsDistribUserId}),
+    wf:send(["system", "tournament_ends_note"], {TrnId, AwardsDistribUserId}),
     {TRef, Magic} = start_timer(?SHOW_TOURNAMENT_RESULT_TIMEOUT),
     ?INFO("TRN_ELIMINATION <~p> The tournament is finalized. "
           "Waiting some time (~p secs) before continue...",

+ 1 - 1
apps/server/src/nsg_trn_standalone.erl

@@ -1072,7 +1072,7 @@ add_points_to_accounts(Points, GameId, GameType, GameMode, MulFactor) ->
     ok.
 
 send_ends_note(GameName, GameType, EndsNotePoints) ->
-    nsx_msg:notify(["system", "game_ends_note"], {{GameName, GameType}, EndsNotePoints}).
+    wf:send(["system", "game_ends_note"], {{GameName, GameType}, EndsNotePoints}).
 
 shuffle(List) -> deck:to_list(deck:shuffle(deck:from_list(List))).