@xmobitea/gn-server 2.4.14 → 2.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCurrencyLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetFriendStatisticsLeaderboardAroundPlayerRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetFriendStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLeaderboardAroundPlayerRequestHandler.d.ts +2 -0
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/dashboard/GetAnalyticsRequestHandler.d.ts +4 -0
- package/dist/GN-app-api/handler/controller/handler/dashboard/ResetStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetFriendStatisticsLeaderboardAroundPlayerRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetFriendStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetStatisticsLeaderboardAroundPlayerRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/group/GetCurrencyLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/group/GetStatisticsLeaderboardAroundGroupRequestHandler.d.ts +2 -0
- package/dist/GN-app-api/handler/controller/handler/group/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/inventory/GetStatisticsLeaderboardAroundItemRequestHandler.d.ts +2 -0
- package/dist/GN-app-api/handler/controller/handler/inventory/GetStatisticsLeaderboardRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetStatisticsLeaderboardAroundPlayerRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/service/AnalyticsService.d.ts +2 -0
- package/dist/GN-app-api/service/EventCallbackService.d.ts +7 -0
- package/dist/GN-app-api/service/IAnalyticsService.d.ts +18 -6
- package/dist/GN-common/constant/enumType/ItemType.d.ts +2 -2
- package/dist/GN-common/constant/errorCode/GNErrorCode.d.ts +1 -1
- package/dist/GN-common/constant/parameterCode/GNParameterCode.d.ts +7 -0
- package/dist/GN-library/xcachedata/lib/xCacheData.d.ts +1 -0
- package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +12 -12
- package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +35 -15
- package/dist/GN-startup/cloudScript/templateCloudScript.ts +31 -1
- package/dist/GN-startup/cloudScript/templateEventCallback.ts +95 -3
- package/dist/GNServer.d.ts +1 -0
- package/dist/index.js +1342 -419
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5157,6 +5157,10 @@ __decorate([
|
|
|
5157
5157
|
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
5158
5158
|
__metadata("design:type", Boolean)
|
|
5159
5159
|
], GetCurrencyLeaderboardOperationRequest.prototype, "loadFromCache", void 0);
|
|
5160
|
+
__decorate([
|
|
5161
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
5162
|
+
__metadata("design:type", String)
|
|
5163
|
+
], GetCurrencyLeaderboardOperationRequest.prototype, "catalogId", void 0);
|
|
5160
5164
|
class ServerGetCurrencyLeaderboardOperationRequest extends GetCurrencyLeaderboardOperationRequest {
|
|
5161
5165
|
isValidRequest() {
|
|
5162
5166
|
if (!super.isValidRequest())
|
|
@@ -5197,6 +5201,7 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5197
5201
|
limit: request.limit,
|
|
5198
5202
|
infoRequestParam: request.infoRequestParam,
|
|
5199
5203
|
loadFromCache: request.loadFromCache,
|
|
5204
|
+
catalogId: request.catalogId,
|
|
5200
5205
|
}, secretInfo, operationRequest);
|
|
5201
5206
|
});
|
|
5202
5207
|
}
|
|
@@ -5216,6 +5221,7 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5216
5221
|
limit: request.limit,
|
|
5217
5222
|
infoRequestParam: request.infoRequestParam,
|
|
5218
5223
|
loadFromCache: request.loadFromCache,
|
|
5224
|
+
catalogId: request.catalogId,
|
|
5219
5225
|
}, secretInfo, operationRequest);
|
|
5220
5226
|
});
|
|
5221
5227
|
}
|
|
@@ -5235,6 +5241,7 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5235
5241
|
limit: request.limit,
|
|
5236
5242
|
infoRequestParam: request.infoRequestParam,
|
|
5237
5243
|
loadFromCache: request.loadFromCache,
|
|
5244
|
+
catalogId: request.catalogId,
|
|
5238
5245
|
}, secretInfo, operationRequest);
|
|
5239
5246
|
});
|
|
5240
5247
|
}
|
|
@@ -5246,14 +5253,15 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5246
5253
|
}
|
|
5247
5254
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
5248
5255
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
5249
|
-
let
|
|
5250
|
-
let
|
|
5251
|
-
let playerCurrencySettingsItem = masterPlayerSettings.playerCurrencySettings.find(x => x.key == request.key);
|
|
5256
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
5257
|
+
let playerCurrencySettingsItem = characterPlayerSettings.playerCurrencySettings.find(x => x.key == request.key);
|
|
5252
5258
|
if (playerCurrencySettingsItem == null) {
|
|
5253
5259
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
5254
5260
|
return operationResponse;
|
|
5255
5261
|
}
|
|
5256
5262
|
let cacheKey = "characterPlayerCurrencyLeaderboard_" + request.key;
|
|
5263
|
+
if (request.catalogId)
|
|
5264
|
+
cacheKey += "_" + request.catalogId;
|
|
5257
5265
|
if (request.loadFromCache) {
|
|
5258
5266
|
if (request.skip + request.limit > 100) {
|
|
5259
5267
|
request.loadFromCache = false;
|
|
@@ -5280,9 +5288,10 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5280
5288
|
}
|
|
5281
5289
|
}
|
|
5282
5290
|
else {
|
|
5291
|
+
let characterPlayerFindOptions = this.convertToCharacterPlayerFindOptions(request.infoRequestParam);
|
|
5283
5292
|
if (request.skip + request.limit <= 100) {
|
|
5284
5293
|
characterPlayerFindOptions = null;
|
|
5285
|
-
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithCurrenciesAsync(request.key, 0, 100, secretInfo.getGameId(), characterPlayerFindOptions);
|
|
5294
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithCurrenciesAsync(request.key, 0, 100, request.catalogId, secretInfo.getGameId(), characterPlayerFindOptions);
|
|
5286
5295
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
5287
5296
|
if (i >= characterPlayers.length)
|
|
5288
5297
|
break;
|
|
@@ -5296,7 +5305,7 @@ class GetCurrencyLeaderboardRequestHandler extends CharacterPlayerBaseRequestHan
|
|
|
5296
5305
|
this.gnServer.getCacheData().setData(cacheKey, characterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
5297
5306
|
}
|
|
5298
5307
|
else {
|
|
5299
|
-
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithCurrenciesAsync(request.key, request.skip, request.limit, secretInfo.getGameId(), characterPlayerFindOptions);
|
|
5308
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithCurrenciesAsync(request.key, request.skip, request.limit, request.catalogId, secretInfo.getGameId(), characterPlayerFindOptions);
|
|
5300
5309
|
for (let i = 0; i < characterPlayers.length; i++) {
|
|
5301
5310
|
let characterPlayer = characterPlayers[i];
|
|
5302
5311
|
let gnResult = new GNData_1.GNHashtable();
|
|
@@ -5459,11 +5468,11 @@ class GetCurrencyLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
5459
5468
|
}
|
|
5460
5469
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
5461
5470
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
5462
|
-
let
|
|
5471
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
5463
5472
|
let keys = [];
|
|
5464
5473
|
if (request.keys) {
|
|
5465
5474
|
for (let i = 0; i < request.keys.length; i++) {
|
|
5466
|
-
let playerCurrencySettingsItem =
|
|
5475
|
+
let playerCurrencySettingsItem = characterPlayerSettings.playerCurrencySettings.find(x => x.key == request.keys[i]);
|
|
5467
5476
|
if (playerCurrencySettingsItem != null) {
|
|
5468
5477
|
keys.push(playerCurrencySettingsItem.key);
|
|
5469
5478
|
}
|
|
@@ -5838,6 +5847,7 @@ const InfoRequestParam_1 = __webpack_require__(21803);
|
|
|
5838
5847
|
const FriendStatus_1 = __webpack_require__(11259);
|
|
5839
5848
|
const GetFriendStatisticsLeaderboardRequestHandler_1 = __webpack_require__(31378);
|
|
5840
5849
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
5850
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
5841
5851
|
class GetFriendStatisticsLeaderboardAroundPlayerOperationRequest extends OperationRequest_1.OperationRequest {
|
|
5842
5852
|
isValidRequest() {
|
|
5843
5853
|
if (!super.isValidRequest())
|
|
@@ -5865,6 +5875,10 @@ __decorate([
|
|
|
5865
5875
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
5866
5876
|
__metadata("design:type", Number)
|
|
5867
5877
|
], GetFriendStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "limit", void 0);
|
|
5878
|
+
__decorate([
|
|
5879
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
5880
|
+
__metadata("design:type", Boolean)
|
|
5881
|
+
], GetFriendStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "loadFromCache", void 0);
|
|
5868
5882
|
class ServerGetFriendStatisticsLeaderboardAroundPlayerOperationRequest extends GetFriendStatisticsLeaderboardAroundPlayerOperationRequest {
|
|
5869
5883
|
isValidRequest() {
|
|
5870
5884
|
if (!super.isValidRequest())
|
|
@@ -5902,7 +5916,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends Character
|
|
|
5902
5916
|
key: request.key,
|
|
5903
5917
|
skip: request.skip,
|
|
5904
5918
|
limit: request.limit,
|
|
5905
|
-
infoRequestParam: request.infoRequestParam
|
|
5919
|
+
infoRequestParam: request.infoRequestParam,
|
|
5920
|
+
loadFromCache: request.loadFromCache,
|
|
5906
5921
|
}, secretInfo, operationRequest);
|
|
5907
5922
|
});
|
|
5908
5923
|
}
|
|
@@ -5921,7 +5936,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends Character
|
|
|
5921
5936
|
key: request.key,
|
|
5922
5937
|
skip: request.skip,
|
|
5923
5938
|
limit: request.limit,
|
|
5924
|
-
infoRequestParam: request.infoRequestParam
|
|
5939
|
+
infoRequestParam: request.infoRequestParam,
|
|
5940
|
+
loadFromCache: request.loadFromCache,
|
|
5925
5941
|
}, secretInfo, operationRequest);
|
|
5926
5942
|
});
|
|
5927
5943
|
}
|
|
@@ -5940,7 +5956,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends Character
|
|
|
5940
5956
|
key: request.key,
|
|
5941
5957
|
skip: request.skip,
|
|
5942
5958
|
limit: request.limit,
|
|
5943
|
-
infoRequestParam: request.infoRequestParam
|
|
5959
|
+
infoRequestParam: request.infoRequestParam,
|
|
5960
|
+
loadFromCache: request.loadFromCache,
|
|
5944
5961
|
}, secretInfo, operationRequest);
|
|
5945
5962
|
});
|
|
5946
5963
|
}
|
|
@@ -5952,33 +5969,46 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends Character
|
|
|
5952
5969
|
}
|
|
5953
5970
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
5954
5971
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
5955
|
-
let
|
|
5956
|
-
let
|
|
5957
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
5972
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
5973
|
+
let playerStatisticsSettingsItem = characterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
5958
5974
|
if (playerStatisticsSettingsItem == null) {
|
|
5959
5975
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
5960
5976
|
return operationResponse;
|
|
5961
5977
|
}
|
|
5962
|
-
let
|
|
5963
|
-
if (
|
|
5964
|
-
|
|
5965
|
-
|
|
5978
|
+
let cacheKey = "characterPlayerStatisticsLeaderboardFriendAround_" + request.characterId;
|
|
5979
|
+
if (request.loadFromCache) {
|
|
5980
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey)) {
|
|
5981
|
+
request.loadFromCache = false;
|
|
5982
|
+
}
|
|
5966
5983
|
}
|
|
5967
5984
|
let gnResults = new GNData_1.GNArray();
|
|
5968
|
-
let
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5985
|
+
let characterPlayers;
|
|
5986
|
+
if (request.loadFromCache) {
|
|
5987
|
+
characterPlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
5988
|
+
}
|
|
5989
|
+
else {
|
|
5990
|
+
let characterPlayer = yield this.gnServer.getDatabase().loadCharacterPlayerAsync(request.characterId, secretInfo.getGameId(), null);
|
|
5991
|
+
if (characterPlayer == null) {
|
|
5992
|
+
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.CharacterPlayerNotFound);
|
|
5993
|
+
return operationResponse;
|
|
5994
|
+
}
|
|
5995
|
+
let friendIds = [];
|
|
5996
|
+
let allPlayerFriends = characterPlayer.getAllPlayerFriends();
|
|
5997
|
+
for (let i = 0; i < allPlayerFriends.length; i++) {
|
|
5998
|
+
let playerFriendItem = allPlayerFriends[i];
|
|
5999
|
+
if (playerFriendItem.status == FriendStatus_1.FriendStatus.Friend) {
|
|
6000
|
+
friendIds.push(playerFriendItem.friendId);
|
|
6001
|
+
}
|
|
6002
|
+
}
|
|
6003
|
+
let allCharacterPlayers = yield this.gnServer.getDatabase().loadFriendCharacterPlayersLeaderboardWithStatisticsAsync(friendIds, secretInfo.getGameId(), null);
|
|
6004
|
+
allCharacterPlayers.push(characterPlayer);
|
|
6005
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
6006
|
+
characterPlayers = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum
|
|
6007
|
+
? GetFriendStatisticsLeaderboardRequestHandler_1.GetFriendStatisticsLeaderboardRequestHandler.quickSortAsc(request.key, allCharacterPlayers, playerStatisticsSettingsItem.initialValue)
|
|
6008
|
+
: GetFriendStatisticsLeaderboardRequestHandler_1.GetFriendStatisticsLeaderboardRequestHandler.quickSort(request.key, allCharacterPlayers, playerStatisticsSettingsItem.initialValue);
|
|
6009
|
+
this.gnServer.getCacheData().setData(cacheKey, characterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
6010
|
+
}
|
|
6011
|
+
let characterPlayer = characterPlayers.find(x => x.getCharacterId() == request.characterId);
|
|
5982
6012
|
let thisPosition = characterPlayers.indexOf(characterPlayer);
|
|
5983
6013
|
for (let i = request.skip + thisPosition; i < request.skip + thisPosition + request.limit; i++) {
|
|
5984
6014
|
if (i >= characterPlayers.length)
|
|
@@ -5992,6 +6022,7 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends Character
|
|
|
5992
6022
|
}
|
|
5993
6023
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
5994
6024
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
6025
|
+
yield this.gnServer.getPostEventCallbackService().onEvent("characterPlayer_GetFriendStatisticsLeaderboardAroundPlayer", request, secretInfo, operationRequest, operationResponse);
|
|
5995
6026
|
return operationResponse;
|
|
5996
6027
|
});
|
|
5997
6028
|
}
|
|
@@ -6066,6 +6097,10 @@ __decorate([
|
|
|
6066
6097
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
6067
6098
|
__metadata("design:type", Number)
|
|
6068
6099
|
], GetFriendStatisticsLeaderboardOperationRequest.prototype, "limit", void 0);
|
|
6100
|
+
__decorate([
|
|
6101
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
6102
|
+
__metadata("design:type", Boolean)
|
|
6103
|
+
], GetFriendStatisticsLeaderboardOperationRequest.prototype, "loadFromCache", void 0);
|
|
6069
6104
|
class ServerGetFriendStatisticsLeaderboardOperationRequest extends GetFriendStatisticsLeaderboardOperationRequest {
|
|
6070
6105
|
isValidRequest() {
|
|
6071
6106
|
if (!super.isValidRequest())
|
|
@@ -6102,7 +6137,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRe
|
|
|
6102
6137
|
characterId: request.characterId,
|
|
6103
6138
|
skip: request.skip,
|
|
6104
6139
|
limit: request.limit,
|
|
6105
|
-
infoRequestParam: request.infoRequestParam
|
|
6140
|
+
infoRequestParam: request.infoRequestParam,
|
|
6141
|
+
loadFromCache: request.loadFromCache,
|
|
6106
6142
|
}, secretInfo, operationRequest);
|
|
6107
6143
|
});
|
|
6108
6144
|
}
|
|
@@ -6121,7 +6157,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRe
|
|
|
6121
6157
|
characterId: request.characterId,
|
|
6122
6158
|
skip: request.skip,
|
|
6123
6159
|
limit: request.limit,
|
|
6124
|
-
infoRequestParam: request.infoRequestParam
|
|
6160
|
+
infoRequestParam: request.infoRequestParam,
|
|
6161
|
+
loadFromCache: request.loadFromCache,
|
|
6125
6162
|
}, secretInfo, operationRequest);
|
|
6126
6163
|
});
|
|
6127
6164
|
}
|
|
@@ -6140,7 +6177,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRe
|
|
|
6140
6177
|
characterId: request.characterId,
|
|
6141
6178
|
skip: request.skip,
|
|
6142
6179
|
limit: request.limit,
|
|
6143
|
-
infoRequestParam: request.infoRequestParam
|
|
6180
|
+
infoRequestParam: request.infoRequestParam,
|
|
6181
|
+
loadFromCache: request.loadFromCache,
|
|
6144
6182
|
}, secretInfo, operationRequest);
|
|
6145
6183
|
});
|
|
6146
6184
|
}
|
|
@@ -6152,35 +6190,45 @@ class GetFriendStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRe
|
|
|
6152
6190
|
}
|
|
6153
6191
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
6154
6192
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
6155
|
-
let
|
|
6156
|
-
|
|
6157
|
-
characterPlayerFindOptions.playerStatistics = true;
|
|
6158
|
-
let masterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
6159
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
6193
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
6194
|
+
let playerStatisticsSettingsItem = characterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
6160
6195
|
if (playerStatisticsSettingsItem == null) {
|
|
6161
6196
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
6162
6197
|
return operationResponse;
|
|
6163
6198
|
}
|
|
6164
|
-
let
|
|
6165
|
-
if (
|
|
6166
|
-
|
|
6167
|
-
|
|
6199
|
+
let cacheKey = "characterPlayerStatisticsLeaderboardFriend_" + request.characterId;
|
|
6200
|
+
if (request.loadFromCache) {
|
|
6201
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey)) {
|
|
6202
|
+
request.loadFromCache = false;
|
|
6203
|
+
}
|
|
6168
6204
|
}
|
|
6169
6205
|
let gnResults = new GNData_1.GNArray();
|
|
6170
|
-
let
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6206
|
+
let characterPlayers;
|
|
6207
|
+
if (request.loadFromCache) {
|
|
6208
|
+
characterPlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
6209
|
+
}
|
|
6210
|
+
else {
|
|
6211
|
+
let characterPlayer = yield this.gnServer.getDatabase().loadCharacterPlayerAsync(request.characterId, secretInfo.getGameId(), null);
|
|
6212
|
+
if (characterPlayer == null) {
|
|
6213
|
+
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.CharacterPlayerNotFound);
|
|
6214
|
+
return operationResponse;
|
|
6215
|
+
}
|
|
6216
|
+
let friendIds = [];
|
|
6217
|
+
let allPlayerFriends = characterPlayer.getAllPlayerFriends();
|
|
6218
|
+
for (let i = 0; i < allPlayerFriends.length; i++) {
|
|
6219
|
+
let playerFriendItem = allPlayerFriends[i];
|
|
6220
|
+
if (playerFriendItem.status == FriendStatus_1.FriendStatus.Friend) {
|
|
6221
|
+
friendIds.push(playerFriendItem.friendId);
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6224
|
+
let allCharacterPlayers = yield this.gnServer.getDatabase().loadFriendCharacterPlayersLeaderboardWithStatisticsAsync(friendIds, secretInfo.getGameId(), null);
|
|
6225
|
+
allCharacterPlayers.push(characterPlayer);
|
|
6226
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
6227
|
+
characterPlayers = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum
|
|
6228
|
+
? GetFriendStatisticsLeaderboardRequestHandler.quickSortAsc(request.key, allCharacterPlayers, playerStatisticsSettingsItem.initialValue)
|
|
6229
|
+
: GetFriendStatisticsLeaderboardRequestHandler.quickSort(request.key, allCharacterPlayers, playerStatisticsSettingsItem.initialValue);
|
|
6230
|
+
this.gnServer.getCacheData().setData(cacheKey, characterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
6231
|
+
}
|
|
6184
6232
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
6185
6233
|
if (i >= characterPlayers.length)
|
|
6186
6234
|
break;
|
|
@@ -6193,6 +6241,7 @@ class GetFriendStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRe
|
|
|
6193
6241
|
}
|
|
6194
6242
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
6195
6243
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
6244
|
+
yield this.gnServer.getPostEventCallbackService().onEvent("characterPlayer_GetFriendStatisticsLeaderboard", request, secretInfo, operationRequest, operationResponse);
|
|
6196
6245
|
return operationResponse;
|
|
6197
6246
|
});
|
|
6198
6247
|
}
|
|
@@ -8572,6 +8621,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
8572
8621
|
const CharacterPlayerBaseRequestHandler_1 = __webpack_require__(91203);
|
|
8573
8622
|
const InfoRequestParam_1 = __webpack_require__(21803);
|
|
8574
8623
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
8624
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
8575
8625
|
class GetStatisticsLeaderboardAroundPlayerOperationRequest extends OperationRequest_1.OperationRequest {
|
|
8576
8626
|
isValidRequest() {
|
|
8577
8627
|
if (!super.isValidRequest())
|
|
@@ -8599,6 +8649,14 @@ __decorate([
|
|
|
8599
8649
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
8600
8650
|
__metadata("design:type", Number)
|
|
8601
8651
|
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "limit", void 0);
|
|
8652
|
+
__decorate([
|
|
8653
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
8654
|
+
__metadata("design:type", Boolean)
|
|
8655
|
+
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "loadFromCache", void 0);
|
|
8656
|
+
__decorate([
|
|
8657
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
8658
|
+
__metadata("design:type", String)
|
|
8659
|
+
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "catalogId", void 0);
|
|
8602
8660
|
class ServerGetStatisticsLeaderboardAroundPlayerOperationRequest extends GetStatisticsLeaderboardAroundPlayerOperationRequest {
|
|
8603
8661
|
isValidRequest() {
|
|
8604
8662
|
if (!super.isValidRequest())
|
|
@@ -8636,7 +8694,9 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends CharacterPlayer
|
|
|
8636
8694
|
key: request.key,
|
|
8637
8695
|
skip: request.skip,
|
|
8638
8696
|
limit: request.limit,
|
|
8639
|
-
infoRequestParam: request.infoRequestParam
|
|
8697
|
+
infoRequestParam: request.infoRequestParam,
|
|
8698
|
+
loadFromCache: request.loadFromCache,
|
|
8699
|
+
catalogId: request.catalogId,
|
|
8640
8700
|
}, secretInfo, operationRequest);
|
|
8641
8701
|
});
|
|
8642
8702
|
}
|
|
@@ -8655,7 +8715,9 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends CharacterPlayer
|
|
|
8655
8715
|
key: request.key,
|
|
8656
8716
|
skip: request.skip,
|
|
8657
8717
|
limit: request.limit,
|
|
8658
|
-
infoRequestParam: request.infoRequestParam
|
|
8718
|
+
infoRequestParam: request.infoRequestParam,
|
|
8719
|
+
loadFromCache: request.loadFromCache,
|
|
8720
|
+
catalogId: request.catalogId,
|
|
8659
8721
|
}, secretInfo, operationRequest);
|
|
8660
8722
|
});
|
|
8661
8723
|
}
|
|
@@ -8674,7 +8736,9 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends CharacterPlayer
|
|
|
8674
8736
|
key: request.key,
|
|
8675
8737
|
skip: request.skip,
|
|
8676
8738
|
limit: request.limit,
|
|
8677
|
-
infoRequestParam: request.infoRequestParam
|
|
8739
|
+
infoRequestParam: request.infoRequestParam,
|
|
8740
|
+
loadFromCache: request.loadFromCache,
|
|
8741
|
+
catalogId: request.catalogId,
|
|
8678
8742
|
}, secretInfo, operationRequest);
|
|
8679
8743
|
});
|
|
8680
8744
|
}
|
|
@@ -8686,25 +8750,79 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends CharacterPlayer
|
|
|
8686
8750
|
}
|
|
8687
8751
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
8688
8752
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
8689
|
-
let
|
|
8690
|
-
let
|
|
8691
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
8753
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
8754
|
+
let playerStatisticsSettingsItem = characterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
8692
8755
|
if (playerStatisticsSettingsItem == null) {
|
|
8693
8756
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
8694
8757
|
return operationResponse;
|
|
8695
8758
|
}
|
|
8696
|
-
let
|
|
8697
|
-
let
|
|
8759
|
+
let positionCacheKey = "characterPlayerStatisticsLeaderboardAroundPosition_" + request.characterId + "_" + request.key;
|
|
8760
|
+
let cacheKey = "characterPlayerStatisticsLeaderboardAround_" + request.characterId + "_" + request.key;
|
|
8761
|
+
if (request.catalogId) {
|
|
8762
|
+
cacheKey += "_" + request.catalogId;
|
|
8763
|
+
positionCacheKey += "_" + request.catalogId;
|
|
8764
|
+
}
|
|
8765
|
+
if (request.loadFromCache) {
|
|
8766
|
+
if (request.skip + request.limit > 100) {
|
|
8767
|
+
request.loadFromCache = false;
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
if (request.loadFromCache) {
|
|
8771
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey) || !this.gnServer.getCacheData().isValid(positionCacheKey)) {
|
|
8772
|
+
request.loadFromCache = false;
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8698
8775
|
let gnResults = new GNData_1.GNArray();
|
|
8699
|
-
let thisPosition
|
|
8700
|
-
let characterPlayers
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8776
|
+
let thisPosition;
|
|
8777
|
+
let characterPlayers;
|
|
8778
|
+
if (request.loadFromCache) {
|
|
8779
|
+
thisPosition = this.gnServer.getCacheData().getData(positionCacheKey);
|
|
8780
|
+
characterPlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
8781
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
8782
|
+
if (i >= characterPlayers.length)
|
|
8783
|
+
break;
|
|
8784
|
+
let characterPlayer = characterPlayers[i];
|
|
8785
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
8786
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
8787
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.CharacterId, characterPlayer.getCharacterId());
|
|
8788
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(characterPlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
8789
|
+
gnResults.add(gnResult);
|
|
8790
|
+
}
|
|
8791
|
+
}
|
|
8792
|
+
else {
|
|
8793
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
8794
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
8795
|
+
thisPosition = yield this.gnServer.getDatabase().loadPositionCharacterPlayerLeaderboardWithStatisticsAsync(request.key, request.characterId, request.catalogId, secretInfo.getGameId(), playerStatisticsSettingsItem.initialValue, direction);
|
|
8796
|
+
if (thisPosition != -1) {
|
|
8797
|
+
this.gnServer.getCacheData().setData(positionCacheKey, thisPosition, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
8798
|
+
let characterPlayerFindOptions = this.convertToCharacterPlayerFindOptions(request.infoRequestParam);
|
|
8799
|
+
if (request.skip + request.limit <= 100) {
|
|
8800
|
+
characterPlayerFindOptions = null;
|
|
8801
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, thisPosition, 100, request.catalogId, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
8802
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
8803
|
+
if (i >= characterPlayers.length)
|
|
8804
|
+
break;
|
|
8805
|
+
let characterPlayer = characterPlayers[i];
|
|
8806
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
8807
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
8808
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.CharacterId, characterPlayer.getCharacterId());
|
|
8809
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(characterPlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
8810
|
+
gnResults.add(gnResult);
|
|
8811
|
+
}
|
|
8812
|
+
this.gnServer.getCacheData().setData(cacheKey, characterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
8813
|
+
}
|
|
8814
|
+
else {
|
|
8815
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
8816
|
+
for (let i = 0; i < characterPlayers.length; i++) {
|
|
8817
|
+
let characterPlayer = characterPlayers[i];
|
|
8818
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
8819
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition + request.skip);
|
|
8820
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.CharacterId, characterPlayer.getCharacterId());
|
|
8821
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(characterPlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
8822
|
+
gnResults.add(gnResult);
|
|
8823
|
+
}
|
|
8824
|
+
}
|
|
8825
|
+
}
|
|
8708
8826
|
}
|
|
8709
8827
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
8710
8828
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
@@ -8786,6 +8904,10 @@ __decorate([
|
|
|
8786
8904
|
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.Version, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
8787
8905
|
__metadata("design:type", String)
|
|
8788
8906
|
], GetStatisticsLeaderboardOperationRequest.prototype, "version", void 0);
|
|
8907
|
+
__decorate([
|
|
8908
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
8909
|
+
__metadata("design:type", String)
|
|
8910
|
+
], GetStatisticsLeaderboardOperationRequest.prototype, "catalogId", void 0);
|
|
8789
8911
|
class ServerGetStatisticsLeaderboardOperationRequest extends GetStatisticsLeaderboardOperationRequest {
|
|
8790
8912
|
isValidRequest() {
|
|
8791
8913
|
if (!super.isValidRequest())
|
|
@@ -8827,6 +8949,7 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8827
8949
|
infoRequestParam: request.infoRequestParam,
|
|
8828
8950
|
loadFromCache: request.loadFromCache,
|
|
8829
8951
|
version: request.version,
|
|
8952
|
+
catalogId: request.catalogId,
|
|
8830
8953
|
}, secretInfo, operationRequest);
|
|
8831
8954
|
});
|
|
8832
8955
|
}
|
|
@@ -8847,6 +8970,7 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8847
8970
|
infoRequestParam: request.infoRequestParam,
|
|
8848
8971
|
loadFromCache: request.loadFromCache,
|
|
8849
8972
|
version: request.version,
|
|
8973
|
+
catalogId: request.catalogId,
|
|
8850
8974
|
}, secretInfo, operationRequest);
|
|
8851
8975
|
});
|
|
8852
8976
|
}
|
|
@@ -8867,6 +8991,7 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8867
8991
|
infoRequestParam: request.infoRequestParam,
|
|
8868
8992
|
loadFromCache: request.loadFromCache,
|
|
8869
8993
|
version: request.version,
|
|
8994
|
+
catalogId: request.catalogId,
|
|
8870
8995
|
}, secretInfo, operationRequest);
|
|
8871
8996
|
});
|
|
8872
8997
|
}
|
|
@@ -8878,15 +9003,16 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8878
9003
|
}
|
|
8879
9004
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
8880
9005
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
8881
|
-
let
|
|
8882
|
-
let
|
|
8883
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
9006
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
9007
|
+
let playerStatisticsSettingsItem = characterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
8884
9008
|
if (playerStatisticsSettingsItem == null) {
|
|
8885
9009
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
8886
9010
|
return operationResponse;
|
|
8887
9011
|
}
|
|
8888
9012
|
if (!request.version) {
|
|
8889
9013
|
let cacheKey = "characterPlayerStatisticsLeaderboard_" + request.key;
|
|
9014
|
+
if (request.catalogId)
|
|
9015
|
+
cacheKey += "_" + request.catalogId;
|
|
8890
9016
|
if (request.loadFromCache) {
|
|
8891
9017
|
if (request.skip + request.limit > 100) {
|
|
8892
9018
|
request.loadFromCache = false;
|
|
@@ -8897,8 +9023,6 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8897
9023
|
request.loadFromCache = false;
|
|
8898
9024
|
}
|
|
8899
9025
|
}
|
|
8900
|
-
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
8901
|
-
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
8902
9026
|
let gnResults = new GNData_1.GNArray();
|
|
8903
9027
|
let characterPlayers;
|
|
8904
9028
|
if (request.loadFromCache) {
|
|
@@ -8915,9 +9039,12 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8915
9039
|
}
|
|
8916
9040
|
}
|
|
8917
9041
|
else {
|
|
9042
|
+
let characterPlayerFindOptions = this.convertToCharacterPlayerFindOptions(request.infoRequestParam);
|
|
9043
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
9044
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
8918
9045
|
if (request.skip + request.limit <= 100) {
|
|
8919
9046
|
characterPlayerFindOptions = null;
|
|
8920
|
-
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, 0, 100, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
9047
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, 0, 100, request.catalogId, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
8921
9048
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
8922
9049
|
if (i >= characterPlayers.length)
|
|
8923
9050
|
break;
|
|
@@ -8931,7 +9058,7 @@ class GetStatisticsLeaderboardRequestHandler extends CharacterPlayerBaseRequestH
|
|
|
8931
9058
|
this.gnServer.getCacheData().setData(cacheKey, characterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
8932
9059
|
}
|
|
8933
9060
|
else {
|
|
8934
|
-
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
9061
|
+
characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, characterPlayerFindOptions);
|
|
8935
9062
|
for (let i = 0; i < characterPlayers.length; i++) {
|
|
8936
9063
|
let characterPlayer = characterPlayers[i];
|
|
8937
9064
|
let gnResult = new GNData_1.GNHashtable();
|
|
@@ -9131,11 +9258,11 @@ class GetStatisticsLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
9131
9258
|
}
|
|
9132
9259
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
9133
9260
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
9134
|
-
let
|
|
9261
|
+
let characterPlayerSettings = this.gnServer.getGNSettings().getCharacterPlayerSettings(secretInfo.getGameId());
|
|
9135
9262
|
let keys = [];
|
|
9136
9263
|
if (request.keys) {
|
|
9137
9264
|
for (let i = 0; i < request.keys.length; i++) {
|
|
9138
|
-
let playerStatisticsSettingsItem =
|
|
9265
|
+
let playerStatisticsSettingsItem = characterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.keys[i]);
|
|
9139
9266
|
if (playerStatisticsSettingsItem != null) {
|
|
9140
9267
|
keys.push(playerStatisticsSettingsItem.key);
|
|
9141
9268
|
}
|
|
@@ -9888,7 +10015,7 @@ __decorate([
|
|
|
9888
10015
|
__metadata("design:type", String)
|
|
9889
10016
|
], GrantPlayerItemOperationRequest.prototype, "displayName", void 0);
|
|
9890
10017
|
__decorate([
|
|
9891
|
-
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, isOptional: true }),
|
|
10018
|
+
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, mustInt: true, isOptional: true }),
|
|
9892
10019
|
__metadata("design:type", Number)
|
|
9893
10020
|
], GrantPlayerItemOperationRequest.prototype, "amount", void 0);
|
|
9894
10021
|
class ServerGrantPlayerItemOperationRequest extends GrantPlayerItemOperationRequest {
|
|
@@ -9995,7 +10122,7 @@ class GrantPlayerItemRequestHandler extends CharacterPlayerBaseRequestHandler_1.
|
|
|
9995
10122
|
return operationResponse;
|
|
9996
10123
|
}
|
|
9997
10124
|
let amount = request.amount;
|
|
9998
|
-
if (playerItemCatalogSettingsItem.itemType == ItemType_1.ItemType.
|
|
10125
|
+
if (playerItemCatalogSettingsItem.itemType == ItemType_1.ItemType.NonStackable) {
|
|
9999
10126
|
amount = 1;
|
|
10000
10127
|
}
|
|
10001
10128
|
let itemId = StringUtility_1.StringUtility.generateRandomString(12, this.gnServer.getIdTypeCase());
|
|
@@ -14822,6 +14949,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
14822
14949
|
const GNParameterCode_1 = __webpack_require__(38343);
|
|
14823
14950
|
const Md5Generate_1 = __webpack_require__(38632);
|
|
14824
14951
|
const StringUtility_1 = __webpack_require__(77468);
|
|
14952
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
14825
14953
|
class RequestDownloadFileUploadInfoOperationRequest extends OperationRequest_1.OperationRequest {
|
|
14826
14954
|
isValidRequest() {
|
|
14827
14955
|
if (!super.isValidRequest())
|
|
@@ -14922,7 +15050,7 @@ class RequestDownloadFileUploadInfoRequestHandler extends RequestHandler_1.Reque
|
|
|
14922
15050
|
let collection = this.gnServer.getDatabase().systemCollection("DownloadFileSession");
|
|
14923
15051
|
collection.insertOne({
|
|
14924
15052
|
fileId: request.fileId,
|
|
14925
|
-
createdAt:
|
|
15053
|
+
createdAt: xDatetime_1.xDatetime.getCurrentDate(),
|
|
14926
15054
|
downloadToken: downloadToken,
|
|
14927
15055
|
isValid: true,
|
|
14928
15056
|
});
|
|
@@ -16124,6 +16252,14 @@ __decorate([
|
|
|
16124
16252
|
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.DatabaseSystem, isOptional: true }),
|
|
16125
16253
|
__metadata("design:type", Boolean)
|
|
16126
16254
|
], GetAnalyticsOperationRequest.prototype, "databaseSystem", void 0);
|
|
16255
|
+
__decorate([
|
|
16256
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.Cost, isOptional: true }),
|
|
16257
|
+
__metadata("design:type", Boolean)
|
|
16258
|
+
], GetAnalyticsOperationRequest.prototype, "cost", void 0);
|
|
16259
|
+
__decorate([
|
|
16260
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.MonthlyCost, isOptional: true }),
|
|
16261
|
+
__metadata("design:type", Boolean)
|
|
16262
|
+
], GetAnalyticsOperationRequest.prototype, "monthlyCost", void 0);
|
|
16127
16263
|
class GetAnalyticsRequestHandler extends RequestHandler_1.RequestHandler {
|
|
16128
16264
|
getCode() {
|
|
16129
16265
|
return OperationCode_1.OperationCode.GetAnalytics;
|
|
@@ -16148,6 +16284,8 @@ class GetAnalyticsRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
16148
16284
|
operationSystem: request.operationSystem,
|
|
16149
16285
|
requestComplete: request.requestComplete,
|
|
16150
16286
|
databaseSystem: request.databaseSystem,
|
|
16287
|
+
cost: request.cost,
|
|
16288
|
+
monthlyCost: request.monthlyCost,
|
|
16151
16289
|
}
|
|
16152
16290
|
}, secretInfo, operationRequest);
|
|
16153
16291
|
});
|
|
@@ -16268,6 +16406,28 @@ class GetAnalyticsRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
16268
16406
|
}
|
|
16269
16407
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.RequestComplete, gnRequestComplete);
|
|
16270
16408
|
}
|
|
16409
|
+
if (request.requestParams.cost) {
|
|
16410
|
+
let gnCost = new GNData_1.GNHashtable();
|
|
16411
|
+
if (bigAnalyticsItem.cost) {
|
|
16412
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.RequestCount, bigAnalyticsItem.cost.requestCount);
|
|
16413
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.MatchmakingRequestCount, bigAnalyticsItem.cost.matchmakingRequestCount);
|
|
16414
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.CloudScriptGBs, bigAnalyticsItem.cost.cloudScriptGBs);
|
|
16415
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.StorageSizeInBytes, bigAnalyticsItem.cost.storageSizeInBytes);
|
|
16416
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.DataTransferSizeInBytes, bigAnalyticsItem.cost.dataTransferSizeInBytes);
|
|
16417
|
+
}
|
|
16418
|
+
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Cost, gnCost);
|
|
16419
|
+
}
|
|
16420
|
+
if (request.requestParams.monthlyCost) {
|
|
16421
|
+
let gnCost = new GNData_1.GNHashtable();
|
|
16422
|
+
if (bigAnalyticsItem.monthlyCost) {
|
|
16423
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.RequestCount, bigAnalyticsItem.monthlyCost.requestCount);
|
|
16424
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.MatchmakingRequestCount, bigAnalyticsItem.monthlyCost.matchmakingRequestCount);
|
|
16425
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.CloudScriptGBs, bigAnalyticsItem.monthlyCost.cloudScriptGBs);
|
|
16426
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.StorageSizeInBytes, bigAnalyticsItem.monthlyCost.storageSizeInBytes);
|
|
16427
|
+
gnCost.add(GNParameterCode_1.GNParameterCode.DataTransferSizeInBytes, bigAnalyticsItem.monthlyCost.dataTransferSizeInBytes);
|
|
16428
|
+
}
|
|
16429
|
+
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.MonthlyCost, gnCost);
|
|
16430
|
+
}
|
|
16271
16431
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
16272
16432
|
yield this.gnServer.getPostEventCallbackService().onEvent("dashboard_GetAnalytics", request, secretInfo, operationRequest, operationResponse);
|
|
16273
16433
|
return operationResponse;
|
|
@@ -23641,6 +23801,10 @@ __decorate([
|
|
|
23641
23801
|
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.Log, minLength: 1, maxLength: 256, mustNonNull: true, isOptional: true }),
|
|
23642
23802
|
__metadata("design:type", String)
|
|
23643
23803
|
], ResetStatisticsLeaderboardOperationRequest.prototype, "log", void 0);
|
|
23804
|
+
__decorate([
|
|
23805
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
23806
|
+
__metadata("design:type", String)
|
|
23807
|
+
], ResetStatisticsLeaderboardOperationRequest.prototype, "catalogId", void 0);
|
|
23644
23808
|
class ResetStatisticsLeaderboardRequestHandler extends RequestHandler_1.RequestHandler {
|
|
23645
23809
|
getCode() {
|
|
23646
23810
|
return OperationCode_1.OperationCode.ResetStatisticsLeaderboard;
|
|
@@ -23663,6 +23827,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler_1.RequestH
|
|
|
23663
23827
|
version: request.version,
|
|
23664
23828
|
gameId: request.gameId,
|
|
23665
23829
|
log: request.log,
|
|
23830
|
+
catalogId: request.catalogId,
|
|
23666
23831
|
}, secretInfo, operationRequest);
|
|
23667
23832
|
});
|
|
23668
23833
|
}
|
|
@@ -23838,7 +24003,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler_1.RequestH
|
|
|
23838
24003
|
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
23839
24004
|
let characterPlayerCollection = yield this.gnServer.getDatabase().systemGameCollection("CharacterPlayer", gameId);
|
|
23840
24005
|
xDebug_1.Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + characterPlayerCollection.collectionName + " starting");
|
|
23841
|
-
let characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key, gameId, direction, characterPlayerFindOptions);
|
|
24006
|
+
let characterPlayers = yield this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, characterPlayerFindOptions);
|
|
23842
24007
|
let backupData = {
|
|
23843
24008
|
key: key,
|
|
23844
24009
|
version: version,
|
|
@@ -23906,7 +24071,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler_1.RequestH
|
|
|
23906
24071
|
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
23907
24072
|
let groupCollection = yield this.gnServer.getDatabase().systemGameCollection("Group", gameId);
|
|
23908
24073
|
xDebug_1.Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + groupCollection.collectionName + " starting");
|
|
23909
|
-
let groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAllAsync(key, gameId, direction, groupFindOptions);
|
|
24074
|
+
let groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, groupFindOptions);
|
|
23910
24075
|
let backupData = {
|
|
23911
24076
|
key: key,
|
|
23912
24077
|
version: version,
|
|
@@ -23969,7 +24134,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler_1.RequestH
|
|
|
23969
24134
|
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
23970
24135
|
let inventoryCollection = yield this.gnServer.getDatabase().systemGameCollection("Inventory", gameId);
|
|
23971
24136
|
xDebug_1.Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + inventoryCollection.collectionName + " starting");
|
|
23972
|
-
let inventories = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAllAsync(key, gameId, direction, inventoryFindOptions);
|
|
24137
|
+
let inventories = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, inventoryFindOptions);
|
|
23973
24138
|
let backupData = {
|
|
23974
24139
|
key: key,
|
|
23975
24140
|
version: version,
|
|
@@ -24549,17 +24714,34 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
24549
24714
|
}
|
|
24550
24715
|
for (let i = 0; i < removeKeyLst.length; i++) {
|
|
24551
24716
|
let key = removeKeyLst[i];
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24717
|
+
{
|
|
24718
|
+
let indexName = "playerCurrencies." + key + ".value_-1";
|
|
24719
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24720
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24721
|
+
}
|
|
24722
|
+
{
|
|
24723
|
+
let indexName = "catalogId_1_" + "playerCurrencies." + key + ".value_-1";
|
|
24724
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24725
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24726
|
+
}
|
|
24555
24727
|
}
|
|
24556
24728
|
for (let i = 0; i < addKeyLst.length; i++) {
|
|
24557
24729
|
let key = addKeyLst[i];
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24730
|
+
{
|
|
24731
|
+
let indexDoc = {};
|
|
24732
|
+
indexDoc["playerCurrencies." + key + ".value"] = -1;
|
|
24733
|
+
let indexName = "playerCurrencies." + key + ".value_-1";
|
|
24734
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24735
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24736
|
+
}
|
|
24737
|
+
{
|
|
24738
|
+
let indexDoc = {};
|
|
24739
|
+
indexDoc["catalogId"] = 1;
|
|
24740
|
+
indexDoc["playerCurrencies." + key + ".value"] = -1;
|
|
24741
|
+
let indexName = "catalogId_1_" + "playerCurrencies." + key + ".value_-1";
|
|
24742
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24743
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24744
|
+
}
|
|
24563
24745
|
}
|
|
24564
24746
|
}
|
|
24565
24747
|
if (request.gameSettings.characterPlayerSettings.playerStatisticsSettings != null) {
|
|
@@ -24609,18 +24791,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
24609
24791
|
}
|
|
24610
24792
|
for (let i = 0; i < removeKeyLst.length; i++) {
|
|
24611
24793
|
let key = removeKeyLst[i];
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24794
|
+
{
|
|
24795
|
+
let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24796
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24797
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24798
|
+
}
|
|
24799
|
+
{
|
|
24800
|
+
let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24801
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24802
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24803
|
+
}
|
|
24615
24804
|
}
|
|
24616
24805
|
for (let i = 0; i < addKeyLst.length; i++) {
|
|
24617
24806
|
let key = addKeyLst[i];
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24807
|
+
{
|
|
24808
|
+
let indexDoc = {};
|
|
24809
|
+
indexDoc["playerStatistics." + key + ".value"] = -1;
|
|
24810
|
+
indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
24811
|
+
let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24812
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24813
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24814
|
+
}
|
|
24815
|
+
{
|
|
24816
|
+
let indexDoc = {};
|
|
24817
|
+
indexDoc["catalogId"] = 1;
|
|
24818
|
+
indexDoc["playerStatistics." + key + ".value"] = -1;
|
|
24819
|
+
indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
24820
|
+
let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24821
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24822
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24823
|
+
}
|
|
24624
24824
|
}
|
|
24625
24825
|
}
|
|
24626
24826
|
{
|
|
@@ -24635,18 +24835,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
24635
24835
|
}
|
|
24636
24836
|
for (let i = 0; i < removeKeyAscLst.length; i++) {
|
|
24637
24837
|
let key = removeKeyAscLst[i];
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24838
|
+
{
|
|
24839
|
+
let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24840
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24841
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24842
|
+
}
|
|
24843
|
+
{
|
|
24844
|
+
let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24845
|
+
characterPlayerCollection.dropIndex(indexName);
|
|
24846
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24847
|
+
}
|
|
24641
24848
|
}
|
|
24642
24849
|
for (let i = 0; i < addKeyAscLst.length; i++) {
|
|
24643
24850
|
let key = addKeyAscLst[i];
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
24851
|
+
{
|
|
24852
|
+
let indexDoc = {};
|
|
24853
|
+
indexDoc["playerStatistics." + key + ".value"] = 1;
|
|
24854
|
+
indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
24855
|
+
let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24856
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24857
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24858
|
+
}
|
|
24859
|
+
{
|
|
24860
|
+
let indexDoc = {};
|
|
24861
|
+
indexDoc["catalogId"] = 1;
|
|
24862
|
+
indexDoc["playerStatistics." + key + ".value"] = 1;
|
|
24863
|
+
indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
24864
|
+
let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
|
|
24865
|
+
characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
24866
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
|
|
24867
|
+
}
|
|
24650
24868
|
}
|
|
24651
24869
|
}
|
|
24652
24870
|
}
|
|
@@ -25053,17 +25271,34 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
25053
25271
|
}
|
|
25054
25272
|
for (let i = 0; i < removeKeyLst.length; i++) {
|
|
25055
25273
|
let key = removeKeyLst[i];
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25274
|
+
{
|
|
25275
|
+
let indexName = "groupCurrencies." + key + ".value_-1";
|
|
25276
|
+
groupCollection.dropIndex(indexName);
|
|
25277
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25278
|
+
}
|
|
25279
|
+
{
|
|
25280
|
+
let indexName = "catalogId_1_" + "groupCurrencies." + key + ".value_-1";
|
|
25281
|
+
groupCollection.dropIndex(indexName);
|
|
25282
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25283
|
+
}
|
|
25059
25284
|
}
|
|
25060
25285
|
for (let i = 0; i < addKeyLst.length; i++) {
|
|
25061
25286
|
let key = addKeyLst[i];
|
|
25062
|
-
|
|
25063
|
-
|
|
25064
|
-
|
|
25065
|
-
|
|
25066
|
-
|
|
25287
|
+
{
|
|
25288
|
+
let indexDoc = {};
|
|
25289
|
+
indexDoc["groupCurrencies." + key + ".value"] = -1;
|
|
25290
|
+
let indexName = "groupCurrencies." + key + ".value_-1";
|
|
25291
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25292
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25293
|
+
}
|
|
25294
|
+
{
|
|
25295
|
+
let indexDoc = {};
|
|
25296
|
+
indexDoc["catalogId"] = 1;
|
|
25297
|
+
indexDoc["groupCurrencies." + key + ".value"] = -1;
|
|
25298
|
+
let indexName = "catalogId_1_" + "groupCurrencies." + key + ".value_-1";
|
|
25299
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25300
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25301
|
+
}
|
|
25067
25302
|
}
|
|
25068
25303
|
}
|
|
25069
25304
|
if (request.gameSettings.groupSettings.groupStatisticsSettings != null) {
|
|
@@ -25113,18 +25348,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
25113
25348
|
}
|
|
25114
25349
|
for (let i = 0; i < removeKeyLst.length; i++) {
|
|
25115
25350
|
let key = removeKeyLst[i];
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25351
|
+
{
|
|
25352
|
+
let indexName = "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25353
|
+
groupCollection.dropIndex(indexName);
|
|
25354
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25355
|
+
}
|
|
25356
|
+
{
|
|
25357
|
+
let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25358
|
+
groupCollection.dropIndex(indexName);
|
|
25359
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25360
|
+
}
|
|
25119
25361
|
}
|
|
25120
25362
|
for (let i = 0; i < addKeyLst.length; i++) {
|
|
25121
25363
|
let key = addKeyLst[i];
|
|
25122
|
-
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25364
|
+
{
|
|
25365
|
+
let indexDoc = {};
|
|
25366
|
+
indexDoc["groupStatistics." + key + ".value"] = -1;
|
|
25367
|
+
indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25368
|
+
let indexName = "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25369
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25370
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25371
|
+
}
|
|
25372
|
+
{
|
|
25373
|
+
let indexDoc = {};
|
|
25374
|
+
indexDoc["catalogId"] = 1;
|
|
25375
|
+
indexDoc["groupStatistics." + key + ".value"] = -1;
|
|
25376
|
+
indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25377
|
+
let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25378
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25379
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25380
|
+
}
|
|
25128
25381
|
}
|
|
25129
25382
|
}
|
|
25130
25383
|
{
|
|
@@ -25139,18 +25392,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
25139
25392
|
}
|
|
25140
25393
|
for (let i = 0; i < removeKeyAscLst.length; i++) {
|
|
25141
25394
|
let key = removeKeyAscLst[i];
|
|
25142
|
-
|
|
25143
|
-
|
|
25144
|
-
|
|
25395
|
+
{
|
|
25396
|
+
let indexName = "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25397
|
+
groupCollection.dropIndex(indexName);
|
|
25398
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25399
|
+
}
|
|
25400
|
+
{
|
|
25401
|
+
let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25402
|
+
groupCollection.dropIndex(indexName);
|
|
25403
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
|
|
25404
|
+
}
|
|
25145
25405
|
}
|
|
25146
25406
|
for (let i = 0; i < addKeyAscLst.length; i++) {
|
|
25147
25407
|
let key = addKeyAscLst[i];
|
|
25148
|
-
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
|
|
25152
|
-
|
|
25153
|
-
|
|
25408
|
+
{
|
|
25409
|
+
let indexDoc = {};
|
|
25410
|
+
indexDoc["groupStatistics." + key + ".value"] = 1;
|
|
25411
|
+
indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25412
|
+
let indexName = "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25413
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25414
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25415
|
+
}
|
|
25416
|
+
{
|
|
25417
|
+
let indexDoc = {};
|
|
25418
|
+
indexDoc["catalogId"] = 1;
|
|
25419
|
+
indexDoc["groupStatistics." + key + ".value"] = 1;
|
|
25420
|
+
indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25421
|
+
let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
|
|
25422
|
+
groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25423
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
|
|
25424
|
+
}
|
|
25154
25425
|
}
|
|
25155
25426
|
}
|
|
25156
25427
|
}
|
|
@@ -25290,18 +25561,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
25290
25561
|
}
|
|
25291
25562
|
for (let i = 0; i < removeKeyLst.length; i++) {
|
|
25292
25563
|
let key = removeKeyLst[i];
|
|
25293
|
-
|
|
25294
|
-
|
|
25295
|
-
|
|
25564
|
+
{
|
|
25565
|
+
let indexName = "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25566
|
+
inventoryCollection.dropIndex(indexName);
|
|
25567
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25568
|
+
}
|
|
25569
|
+
{
|
|
25570
|
+
let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25571
|
+
inventoryCollection.dropIndex(indexName);
|
|
25572
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25573
|
+
}
|
|
25296
25574
|
}
|
|
25297
25575
|
for (let i = 0; i < addKeyLst.length; i++) {
|
|
25298
25576
|
let key = addKeyLst[i];
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25577
|
+
{
|
|
25578
|
+
let indexDoc = {};
|
|
25579
|
+
indexDoc["itemStatistics." + key + ".value"] = -1;
|
|
25580
|
+
indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25581
|
+
let indexName = "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25582
|
+
inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25583
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25584
|
+
}
|
|
25585
|
+
{
|
|
25586
|
+
let indexDoc = {};
|
|
25587
|
+
indexDoc["catalogId"] = 1;
|
|
25588
|
+
indexDoc["itemStatistics." + key + ".value"] = -1;
|
|
25589
|
+
indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25590
|
+
let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25591
|
+
inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25592
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25593
|
+
}
|
|
25305
25594
|
}
|
|
25306
25595
|
}
|
|
25307
25596
|
{
|
|
@@ -25316,18 +25605,36 @@ class SetGameInformationRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
25316
25605
|
}
|
|
25317
25606
|
for (let i = 0; i < removeKeyAscLst.length; i++) {
|
|
25318
25607
|
let key = removeKeyAscLst[i];
|
|
25319
|
-
|
|
25320
|
-
|
|
25321
|
-
|
|
25608
|
+
{
|
|
25609
|
+
let indexName = "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25610
|
+
inventoryCollection.dropIndex(indexName);
|
|
25611
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25612
|
+
}
|
|
25613
|
+
{
|
|
25614
|
+
let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25615
|
+
inventoryCollection.dropIndex(indexName);
|
|
25616
|
+
xDebug_1.Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25617
|
+
}
|
|
25322
25618
|
}
|
|
25323
25619
|
for (let i = 0; i < addKeyAscLst.length; i++) {
|
|
25324
25620
|
let key = addKeyAscLst[i];
|
|
25325
|
-
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25621
|
+
{
|
|
25622
|
+
let indexDoc = {};
|
|
25623
|
+
indexDoc["itemStatistics." + key + ".value"] = 1;
|
|
25624
|
+
indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25625
|
+
let indexName = "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25626
|
+
inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25627
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25628
|
+
}
|
|
25629
|
+
{
|
|
25630
|
+
let indexDoc = {};
|
|
25631
|
+
indexDoc["catalogId"] = 1;
|
|
25632
|
+
indexDoc["itemStatistics." + key + ".value"] = 1;
|
|
25633
|
+
indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
25634
|
+
let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
|
|
25635
|
+
inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
|
|
25636
|
+
xDebug_1.Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
|
|
25637
|
+
}
|
|
25331
25638
|
}
|
|
25332
25639
|
}
|
|
25333
25640
|
}
|
|
@@ -31112,9 +31419,8 @@ class GetCurrencyLeaderboardRequestHandler extends GamePlayerBaseRequestHandler_
|
|
|
31112
31419
|
}
|
|
31113
31420
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
31114
31421
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
31115
|
-
let
|
|
31116
|
-
let
|
|
31117
|
-
let playerCurrencySettingsItem = masterPlayerSettings.playerCurrencySettings.find(x => x.key == request.key);
|
|
31422
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
31423
|
+
let playerCurrencySettingsItem = gamePlayerSettings.playerCurrencySettings.find(x => x.key == request.key);
|
|
31118
31424
|
if (playerCurrencySettingsItem == null) {
|
|
31119
31425
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
31120
31426
|
return operationResponse;
|
|
@@ -31146,6 +31452,7 @@ class GetCurrencyLeaderboardRequestHandler extends GamePlayerBaseRequestHandler_
|
|
|
31146
31452
|
}
|
|
31147
31453
|
}
|
|
31148
31454
|
else {
|
|
31455
|
+
let gamePlayerFindOptions = this.convertToGamePlayerFindOptions(request.infoRequestParam);
|
|
31149
31456
|
if (request.skip + request.limit <= 100) {
|
|
31150
31457
|
gamePlayerFindOptions = null;
|
|
31151
31458
|
gamePlayers = yield this.gnServer.getDatabase().loadGamePlayersLeaderboardWithCurrenciesAsync(request.key, 0, 100, secretInfo.getGameId(), gamePlayerFindOptions);
|
|
@@ -31325,11 +31632,11 @@ class GetCurrencyLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
31325
31632
|
}
|
|
31326
31633
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
31327
31634
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
31328
|
-
let
|
|
31635
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
31329
31636
|
let keys = [];
|
|
31330
31637
|
if (request.keys) {
|
|
31331
31638
|
for (let i = 0; i < request.keys.length; i++) {
|
|
31332
|
-
let playerCurrencySettingsItem =
|
|
31639
|
+
let playerCurrencySettingsItem = gamePlayerSettings.playerCurrencySettings.find(x => x.key == request.keys[i]);
|
|
31333
31640
|
if (playerCurrencySettingsItem != null) {
|
|
31334
31641
|
keys.push(playerCurrencySettingsItem.key);
|
|
31335
31642
|
}
|
|
@@ -31734,6 +32041,7 @@ const InfoRequestParam_1 = __webpack_require__(68350);
|
|
|
31734
32041
|
const GetFriendStatisticsLeaderboardRequestHandler_1 = __webpack_require__(28199);
|
|
31735
32042
|
const FriendStatus_1 = __webpack_require__(11259);
|
|
31736
32043
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
32044
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
31737
32045
|
class GetFriendStatisticsLeaderboardAroundPlayerOperationRequest extends OperationRequest_1.OperationRequest {
|
|
31738
32046
|
isValidRequest() {
|
|
31739
32047
|
if (!super.isValidRequest())
|
|
@@ -31761,6 +32069,10 @@ __decorate([
|
|
|
31761
32069
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
31762
32070
|
__metadata("design:type", Number)
|
|
31763
32071
|
], GetFriendStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "limit", void 0);
|
|
32072
|
+
__decorate([
|
|
32073
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
32074
|
+
__metadata("design:type", Boolean)
|
|
32075
|
+
], GetFriendStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "loadFromCache", void 0);
|
|
31764
32076
|
class ServerGetFriendStatisticsLeaderboardAroundPlayerOperationRequest extends GetFriendStatisticsLeaderboardAroundPlayerOperationRequest {
|
|
31765
32077
|
isValidRequest() {
|
|
31766
32078
|
if (!super.isValidRequest())
|
|
@@ -31814,7 +32126,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlaye
|
|
|
31814
32126
|
key: request.key,
|
|
31815
32127
|
skip: request.skip,
|
|
31816
32128
|
limit: request.limit,
|
|
31817
|
-
infoRequestParam: request.infoRequestParam
|
|
32129
|
+
infoRequestParam: request.infoRequestParam,
|
|
32130
|
+
loadFromCache: request.loadFromCache,
|
|
31818
32131
|
}, secretInfo, operationRequest);
|
|
31819
32132
|
});
|
|
31820
32133
|
}
|
|
@@ -31833,7 +32146,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlaye
|
|
|
31833
32146
|
key: request.key,
|
|
31834
32147
|
skip: request.skip,
|
|
31835
32148
|
limit: request.limit,
|
|
31836
|
-
infoRequestParam: request.infoRequestParam
|
|
32149
|
+
infoRequestParam: request.infoRequestParam,
|
|
32150
|
+
loadFromCache: request.loadFromCache,
|
|
31837
32151
|
}, secretInfo, operationRequest);
|
|
31838
32152
|
});
|
|
31839
32153
|
}
|
|
@@ -31852,7 +32166,8 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlaye
|
|
|
31852
32166
|
key: request.key,
|
|
31853
32167
|
skip: request.skip,
|
|
31854
32168
|
limit: request.limit,
|
|
31855
|
-
infoRequestParam: request.infoRequestParam
|
|
32169
|
+
infoRequestParam: request.infoRequestParam,
|
|
32170
|
+
loadFromCache: request.loadFromCache,
|
|
31856
32171
|
}, secretInfo, operationRequest);
|
|
31857
32172
|
});
|
|
31858
32173
|
}
|
|
@@ -31864,33 +32179,46 @@ class GetFriendStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlaye
|
|
|
31864
32179
|
}
|
|
31865
32180
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
31866
32181
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
31867
|
-
let
|
|
31868
|
-
let
|
|
31869
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
32182
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
32183
|
+
let playerStatisticsSettingsItem = gamePlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
31870
32184
|
if (playerStatisticsSettingsItem == null) {
|
|
31871
32185
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
31872
32186
|
return operationResponse;
|
|
31873
32187
|
}
|
|
31874
|
-
let
|
|
31875
|
-
if (
|
|
31876
|
-
|
|
31877
|
-
|
|
32188
|
+
let cacheKey = "gamePlayerStatisticsLeaderboardFriendAround_" + request.userId;
|
|
32189
|
+
if (request.loadFromCache) {
|
|
32190
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey)) {
|
|
32191
|
+
request.loadFromCache = false;
|
|
32192
|
+
}
|
|
31878
32193
|
}
|
|
31879
32194
|
let gnResults = new GNData_1.GNArray();
|
|
31880
|
-
let
|
|
31881
|
-
|
|
31882
|
-
|
|
31883
|
-
|
|
31884
|
-
|
|
31885
|
-
|
|
31886
|
-
|
|
31887
|
-
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
31891
|
-
|
|
31892
|
-
|
|
31893
|
-
|
|
32195
|
+
let gamePlayers;
|
|
32196
|
+
if (request.loadFromCache) {
|
|
32197
|
+
gamePlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
32198
|
+
}
|
|
32199
|
+
else {
|
|
32200
|
+
let gamePlayer = yield this.gnServer.getDatabase().loadGamePlayerAsync(request.userId, secretInfo.getGameId(), null);
|
|
32201
|
+
if (gamePlayer == null) {
|
|
32202
|
+
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.GamePlayerNotFound);
|
|
32203
|
+
return operationResponse;
|
|
32204
|
+
}
|
|
32205
|
+
let friendIds = [];
|
|
32206
|
+
let allPlayerFriends = gamePlayer.getAllPlayerFriends();
|
|
32207
|
+
for (let i = 0; i < allPlayerFriends.length; i++) {
|
|
32208
|
+
let playerFriendItem = allPlayerFriends[i];
|
|
32209
|
+
if (playerFriendItem.status == FriendStatus_1.FriendStatus.Friend) {
|
|
32210
|
+
friendIds.push(playerFriendItem.friendId);
|
|
32211
|
+
}
|
|
32212
|
+
}
|
|
32213
|
+
let allGamePlayers = yield this.gnServer.getDatabase().loadFriendGamePlayersLeaderboardWithStatisticsAsync(friendIds, secretInfo.getGameId(), null);
|
|
32214
|
+
allGamePlayers.push(gamePlayer);
|
|
32215
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
32216
|
+
gamePlayers = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum
|
|
32217
|
+
? GetFriendStatisticsLeaderboardRequestHandler_1.GetFriendStatisticsLeaderboardRequestHandler.quickSortAsc(request.key, allGamePlayers, playerStatisticsSettingsItem.initialValue)
|
|
32218
|
+
: GetFriendStatisticsLeaderboardRequestHandler_1.GetFriendStatisticsLeaderboardRequestHandler.quickSort(request.key, allGamePlayers, playerStatisticsSettingsItem.initialValue);
|
|
32219
|
+
this.gnServer.getCacheData().setData(cacheKey, gamePlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
32220
|
+
}
|
|
32221
|
+
let gamePlayer = gamePlayers.find(x => x.getUserId() == request.userId);
|
|
31894
32222
|
let thisPosition = gamePlayers.indexOf(gamePlayer);
|
|
31895
32223
|
for (let i = request.skip + thisPosition; i < request.skip + thisPosition + request.limit; i++) {
|
|
31896
32224
|
if (i >= gamePlayers.length)
|
|
@@ -31979,6 +32307,10 @@ __decorate([
|
|
|
31979
32307
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
31980
32308
|
__metadata("design:type", Number)
|
|
31981
32309
|
], GetFriendStatisticsLeaderboardOperationRequest.prototype, "limit", void 0);
|
|
32310
|
+
__decorate([
|
|
32311
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
32312
|
+
__metadata("design:type", Boolean)
|
|
32313
|
+
], GetFriendStatisticsLeaderboardOperationRequest.prototype, "loadFromCache", void 0);
|
|
31982
32314
|
class ServerGetFriendStatisticsLeaderboardOperationRequest extends GetFriendStatisticsLeaderboardOperationRequest {
|
|
31983
32315
|
isValidRequest() {
|
|
31984
32316
|
if (!super.isValidRequest())
|
|
@@ -32032,7 +32364,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequest
|
|
|
32032
32364
|
key: request.key,
|
|
32033
32365
|
skip: request.skip,
|
|
32034
32366
|
limit: request.limit,
|
|
32035
|
-
infoRequestParam: request.infoRequestParam
|
|
32367
|
+
infoRequestParam: request.infoRequestParam,
|
|
32368
|
+
loadFromCache: request.loadFromCache,
|
|
32036
32369
|
}, secretInfo, operationRequest);
|
|
32037
32370
|
});
|
|
32038
32371
|
}
|
|
@@ -32051,7 +32384,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequest
|
|
|
32051
32384
|
key: request.key,
|
|
32052
32385
|
skip: request.skip,
|
|
32053
32386
|
limit: request.limit,
|
|
32054
|
-
infoRequestParam: request.infoRequestParam
|
|
32387
|
+
infoRequestParam: request.infoRequestParam,
|
|
32388
|
+
loadFromCache: request.loadFromCache,
|
|
32055
32389
|
}, secretInfo, operationRequest);
|
|
32056
32390
|
});
|
|
32057
32391
|
}
|
|
@@ -32070,7 +32404,8 @@ class GetFriendStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequest
|
|
|
32070
32404
|
key: request.key,
|
|
32071
32405
|
skip: request.skip,
|
|
32072
32406
|
limit: request.limit,
|
|
32073
|
-
infoRequestParam: request.infoRequestParam
|
|
32407
|
+
infoRequestParam: request.infoRequestParam,
|
|
32408
|
+
loadFromCache: request.loadFromCache,
|
|
32074
32409
|
}, secretInfo, operationRequest);
|
|
32075
32410
|
});
|
|
32076
32411
|
}
|
|
@@ -32082,35 +32417,45 @@ class GetFriendStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequest
|
|
|
32082
32417
|
}
|
|
32083
32418
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
32084
32419
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
32085
|
-
let
|
|
32086
|
-
|
|
32087
|
-
gamePlayerFindOptions.playerStatistics = true;
|
|
32088
|
-
let masterPlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
32089
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
32420
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
32421
|
+
let playerStatisticsSettingsItem = gamePlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
32090
32422
|
if (playerStatisticsSettingsItem == null) {
|
|
32091
32423
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
32092
32424
|
return operationResponse;
|
|
32093
32425
|
}
|
|
32094
|
-
let
|
|
32095
|
-
if (
|
|
32096
|
-
|
|
32097
|
-
|
|
32426
|
+
let cacheKey = "gamePlayerStatisticsLeaderboardFriend_" + request.userId;
|
|
32427
|
+
if (request.loadFromCache) {
|
|
32428
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey)) {
|
|
32429
|
+
request.loadFromCache = false;
|
|
32430
|
+
}
|
|
32098
32431
|
}
|
|
32099
32432
|
let gnResults = new GNData_1.GNArray();
|
|
32100
|
-
let
|
|
32101
|
-
|
|
32102
|
-
|
|
32103
|
-
|
|
32104
|
-
|
|
32105
|
-
|
|
32106
|
-
|
|
32107
|
-
|
|
32108
|
-
|
|
32109
|
-
|
|
32110
|
-
|
|
32111
|
-
|
|
32112
|
-
|
|
32113
|
-
|
|
32433
|
+
let gamePlayers;
|
|
32434
|
+
if (request.loadFromCache) {
|
|
32435
|
+
gamePlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
32436
|
+
}
|
|
32437
|
+
else {
|
|
32438
|
+
let gamePlayer = yield this.gnServer.getDatabase().loadGamePlayerAsync(request.userId, secretInfo.getGameId(), null);
|
|
32439
|
+
if (gamePlayer == null) {
|
|
32440
|
+
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.GamePlayerNotFound);
|
|
32441
|
+
return operationResponse;
|
|
32442
|
+
}
|
|
32443
|
+
let friendIds = [];
|
|
32444
|
+
let allPlayerFriends = gamePlayer.getAllPlayerFriends();
|
|
32445
|
+
for (let i = 0; i < allPlayerFriends.length; i++) {
|
|
32446
|
+
let playerFriendItem = allPlayerFriends[i];
|
|
32447
|
+
if (playerFriendItem.status == FriendStatus_1.FriendStatus.Friend) {
|
|
32448
|
+
friendIds.push(playerFriendItem.friendId);
|
|
32449
|
+
}
|
|
32450
|
+
}
|
|
32451
|
+
let allGamePlayers = yield this.gnServer.getDatabase().loadFriendGamePlayersLeaderboardWithStatisticsAsync(friendIds, secretInfo.getGameId(), null);
|
|
32452
|
+
allGamePlayers.push(gamePlayer);
|
|
32453
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
32454
|
+
gamePlayers = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum
|
|
32455
|
+
? GetFriendStatisticsLeaderboardRequestHandler.quickSortAsc(request.key, allGamePlayers, playerStatisticsSettingsItem.initialValue)
|
|
32456
|
+
: GetFriendStatisticsLeaderboardRequestHandler.quickSort(request.key, allGamePlayers, playerStatisticsSettingsItem.initialValue);
|
|
32457
|
+
this.gnServer.getCacheData().setData(cacheKey, gamePlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
32458
|
+
}
|
|
32114
32459
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
32115
32460
|
if (i >= gamePlayers.length)
|
|
32116
32461
|
break;
|
|
@@ -34955,6 +35300,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
34955
35300
|
const GamePlayerBaseRequestHandler_1 = __webpack_require__(67811);
|
|
34956
35301
|
const InfoRequestParam_1 = __webpack_require__(68350);
|
|
34957
35302
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
35303
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
34958
35304
|
class GetStatisticsLeaderboardAroundPlayerOperationRequest extends OperationRequest_1.OperationRequest {
|
|
34959
35305
|
isValidRequest() {
|
|
34960
35306
|
if (!super.isValidRequest())
|
|
@@ -34982,6 +35328,10 @@ __decorate([
|
|
|
34982
35328
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
34983
35329
|
__metadata("design:type", Number)
|
|
34984
35330
|
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "limit", void 0);
|
|
35331
|
+
__decorate([
|
|
35332
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
35333
|
+
__metadata("design:type", Boolean)
|
|
35334
|
+
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "loadFromCache", void 0);
|
|
34985
35335
|
class ServerGetStatisticsLeaderboardAroundPlayerOperationRequest extends GetStatisticsLeaderboardAroundPlayerOperationRequest {
|
|
34986
35336
|
isValidRequest() {
|
|
34987
35337
|
if (!super.isValidRequest())
|
|
@@ -35035,7 +35385,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlayerBaseR
|
|
|
35035
35385
|
key: request.key,
|
|
35036
35386
|
skip: request.skip,
|
|
35037
35387
|
limit: request.limit,
|
|
35038
|
-
infoRequestParam: request.infoRequestParam
|
|
35388
|
+
infoRequestParam: request.infoRequestParam,
|
|
35389
|
+
loadFromCache: request.loadFromCache,
|
|
35039
35390
|
}, secretInfo, operationRequest);
|
|
35040
35391
|
});
|
|
35041
35392
|
}
|
|
@@ -35054,7 +35405,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlayerBaseR
|
|
|
35054
35405
|
key: request.key,
|
|
35055
35406
|
skip: request.skip,
|
|
35056
35407
|
limit: request.limit,
|
|
35057
|
-
infoRequestParam: request.infoRequestParam
|
|
35408
|
+
infoRequestParam: request.infoRequestParam,
|
|
35409
|
+
loadFromCache: request.loadFromCache,
|
|
35058
35410
|
}, secretInfo, operationRequest);
|
|
35059
35411
|
});
|
|
35060
35412
|
}
|
|
@@ -35073,7 +35425,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlayerBaseR
|
|
|
35073
35425
|
key: request.key,
|
|
35074
35426
|
skip: request.skip,
|
|
35075
35427
|
limit: request.limit,
|
|
35076
|
-
infoRequestParam: request.infoRequestParam
|
|
35428
|
+
infoRequestParam: request.infoRequestParam,
|
|
35429
|
+
loadFromCache: request.loadFromCache,
|
|
35077
35430
|
}, secretInfo, operationRequest);
|
|
35078
35431
|
});
|
|
35079
35432
|
}
|
|
@@ -35085,25 +35438,75 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends GamePlayerBaseR
|
|
|
35085
35438
|
}
|
|
35086
35439
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
35087
35440
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
35088
|
-
let
|
|
35089
|
-
let
|
|
35090
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
35441
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
35442
|
+
let playerStatisticsSettingsItem = gamePlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
35091
35443
|
if (playerStatisticsSettingsItem == null) {
|
|
35092
35444
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
35093
35445
|
return operationResponse;
|
|
35094
35446
|
}
|
|
35095
|
-
let
|
|
35096
|
-
let
|
|
35447
|
+
let positionCacheKey = "gamePlayerStatisticsLeaderboardAroundPosition_" + request.userId + "_" + request.key;
|
|
35448
|
+
let cacheKey = "gamePlayerStatisticsLeaderboardAround_" + request.userId + "_" + request.key;
|
|
35449
|
+
if (request.loadFromCache) {
|
|
35450
|
+
if (request.skip + request.limit > 100) {
|
|
35451
|
+
request.loadFromCache = false;
|
|
35452
|
+
}
|
|
35453
|
+
}
|
|
35454
|
+
if (request.loadFromCache) {
|
|
35455
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey) || !this.gnServer.getCacheData().isValid(positionCacheKey)) {
|
|
35456
|
+
request.loadFromCache = false;
|
|
35457
|
+
}
|
|
35458
|
+
}
|
|
35097
35459
|
let gnResults = new GNData_1.GNArray();
|
|
35098
|
-
let thisPosition
|
|
35099
|
-
let gamePlayers
|
|
35100
|
-
|
|
35101
|
-
|
|
35102
|
-
|
|
35103
|
-
|
|
35104
|
-
|
|
35105
|
-
|
|
35106
|
-
|
|
35460
|
+
let thisPosition;
|
|
35461
|
+
let gamePlayers;
|
|
35462
|
+
if (request.loadFromCache) {
|
|
35463
|
+
thisPosition = this.gnServer.getCacheData().getData(positionCacheKey);
|
|
35464
|
+
gamePlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
35465
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
35466
|
+
if (i >= gamePlayers.length)
|
|
35467
|
+
break;
|
|
35468
|
+
let gamePlayer = gamePlayers[i];
|
|
35469
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
35470
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
35471
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, gamePlayer.getUserId());
|
|
35472
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(gamePlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
35473
|
+
gnResults.add(gnResult);
|
|
35474
|
+
}
|
|
35475
|
+
}
|
|
35476
|
+
else {
|
|
35477
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
35478
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
35479
|
+
thisPosition = yield this.gnServer.getDatabase().loadPositionGamePlayerLeaderboardWithStatisticsAsync(request.key, request.userId, secretInfo.getGameId(), playerStatisticsSettingsItem.initialValue, direction);
|
|
35480
|
+
if (thisPosition != -1) {
|
|
35481
|
+
this.gnServer.getCacheData().setData(positionCacheKey, thisPosition, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
35482
|
+
let gamePlayerFindOptions = this.convertToGamePlayerFindOptions(request.infoRequestParam);
|
|
35483
|
+
if (request.skip + request.limit <= 100) {
|
|
35484
|
+
gamePlayerFindOptions = null;
|
|
35485
|
+
gamePlayers = yield this.gnServer.getDatabase().loadGamePlayersLeaderboardWithStatisticsAsync(request.key, thisPosition, 100, secretInfo.getGameId(), direction, gamePlayerFindOptions);
|
|
35486
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
35487
|
+
if (i >= gamePlayers.length)
|
|
35488
|
+
break;
|
|
35489
|
+
let gamePlayer = gamePlayers[i];
|
|
35490
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
35491
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
35492
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, gamePlayer.getUserId());
|
|
35493
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(gamePlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
35494
|
+
gnResults.add(gnResult);
|
|
35495
|
+
}
|
|
35496
|
+
this.gnServer.getCacheData().setData(cacheKey, gamePlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
35497
|
+
}
|
|
35498
|
+
else {
|
|
35499
|
+
gamePlayers = yield this.gnServer.getDatabase().loadGamePlayersLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, secretInfo.getGameId(), direction, gamePlayerFindOptions);
|
|
35500
|
+
for (let i = 0; i < gamePlayers.length; i++) {
|
|
35501
|
+
let gamePlayer = gamePlayers[i];
|
|
35502
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
35503
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition + request.skip);
|
|
35504
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, gamePlayer.getUserId());
|
|
35505
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(gamePlayer, request.infoRequestParam, secretInfo.getGameId()));
|
|
35506
|
+
gnResults.add(gnResult);
|
|
35507
|
+
}
|
|
35508
|
+
}
|
|
35509
|
+
}
|
|
35107
35510
|
}
|
|
35108
35511
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
35109
35512
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
@@ -35274,9 +35677,8 @@ class GetStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequestHandle
|
|
|
35274
35677
|
}
|
|
35275
35678
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
35276
35679
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
35277
|
-
let
|
|
35278
|
-
let
|
|
35279
|
-
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
35680
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
35681
|
+
let playerStatisticsSettingsItem = gamePlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
35280
35682
|
if (playerStatisticsSettingsItem == null) {
|
|
35281
35683
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
35282
35684
|
return operationResponse;
|
|
@@ -35293,8 +35695,6 @@ class GetStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequestHandle
|
|
|
35293
35695
|
request.loadFromCache = false;
|
|
35294
35696
|
}
|
|
35295
35697
|
}
|
|
35296
|
-
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
35297
|
-
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
35298
35698
|
let gnResults = new GNData_1.GNArray();
|
|
35299
35699
|
let gamePlayers;
|
|
35300
35700
|
if (request.loadFromCache) {
|
|
@@ -35311,6 +35711,9 @@ class GetStatisticsLeaderboardRequestHandler extends GamePlayerBaseRequestHandle
|
|
|
35311
35711
|
}
|
|
35312
35712
|
}
|
|
35313
35713
|
else {
|
|
35714
|
+
let gamePlayerFindOptions = this.convertToGamePlayerFindOptions(request.infoRequestParam);
|
|
35715
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
35716
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
35314
35717
|
if (request.skip + request.limit <= 100) {
|
|
35315
35718
|
gamePlayerFindOptions = null;
|
|
35316
35719
|
gamePlayers = yield this.gnServer.getDatabase().loadGamePlayersLeaderboardWithStatisticsAsync(request.key, 0, 100, secretInfo.getGameId(), direction, gamePlayerFindOptions);
|
|
@@ -35527,11 +35930,11 @@ class GetStatisticsLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
35527
35930
|
}
|
|
35528
35931
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
35529
35932
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
35530
|
-
let
|
|
35933
|
+
let gamePlayerSettings = this.gnServer.getGNSettings().getGamePlayerSettings(secretInfo.getGameId());
|
|
35531
35934
|
let keys = [];
|
|
35532
35935
|
if (request.keys) {
|
|
35533
35936
|
for (let i = 0; i < request.keys.length; i++) {
|
|
35534
|
-
let playerStatisticsSettingsItem =
|
|
35937
|
+
let playerStatisticsSettingsItem = gamePlayerSettings.playerStatisticsSettings.find(x => x.key == request.keys[i]);
|
|
35535
35938
|
if (playerStatisticsSettingsItem != null) {
|
|
35536
35939
|
keys.push(playerStatisticsSettingsItem.key);
|
|
35537
35940
|
}
|
|
@@ -36570,7 +36973,7 @@ __decorate([
|
|
|
36570
36973
|
__metadata("design:type", String)
|
|
36571
36974
|
], GrantPlayerItemOperationRequest.prototype, "displayName", void 0);
|
|
36572
36975
|
__decorate([
|
|
36573
|
-
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, isOptional: true }),
|
|
36976
|
+
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, mustInt: true, isOptional: true }),
|
|
36574
36977
|
__metadata("design:type", Number)
|
|
36575
36978
|
], GrantPlayerItemOperationRequest.prototype, "amount", void 0);
|
|
36576
36979
|
class ServerGrantPlayerItemOperationRequest extends GrantPlayerItemOperationRequest {
|
|
@@ -36693,7 +37096,7 @@ class GrantPlayerItemRequestHandler extends GamePlayerBaseRequestHandler_1.GameP
|
|
|
36693
37096
|
return operationResponse;
|
|
36694
37097
|
}
|
|
36695
37098
|
let amount = request.amount;
|
|
36696
|
-
if (playerItemCatalogSettingsItem.itemType == ItemType_1.ItemType.
|
|
37099
|
+
if (playerItemCatalogSettingsItem.itemType == ItemType_1.ItemType.NonStackable) {
|
|
36697
37100
|
amount = 1;
|
|
36698
37101
|
}
|
|
36699
37102
|
let itemId = StringUtility_1.StringUtility.generateRandomString(12, this.gnServer.getIdTypeCase());
|
|
@@ -41236,11 +41639,11 @@ class GetCurrencyLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
41236
41639
|
}
|
|
41237
41640
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
41238
41641
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
41239
|
-
let
|
|
41642
|
+
let groupSettings = this.gnServer.getGNSettings().getGroupSettings(secretInfo.getGameId());
|
|
41240
41643
|
let keys = [];
|
|
41241
41644
|
if (request.keys) {
|
|
41242
41645
|
for (let i = 0; i < request.keys.length; i++) {
|
|
41243
|
-
let playerCurrencySettingsItem =
|
|
41646
|
+
let playerCurrencySettingsItem = groupSettings.groupCurrencySettings.find(x => x.key == request.keys[i]);
|
|
41244
41647
|
if (playerCurrencySettingsItem != null) {
|
|
41245
41648
|
keys.push(playerCurrencySettingsItem.key);
|
|
41246
41649
|
}
|
|
@@ -43487,6 +43890,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
43487
43890
|
const GroupBaseRequestHandler_1 = __webpack_require__(93655);
|
|
43488
43891
|
const InfoRequestParam_1 = __webpack_require__(23228);
|
|
43489
43892
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
43893
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
43490
43894
|
class GetStatisticsLeaderboardAroundGroupOperationRequest extends OperationRequest_1.OperationRequest {
|
|
43491
43895
|
isValidRequest() {
|
|
43492
43896
|
if (!super.isValidRequest())
|
|
@@ -43514,6 +43918,14 @@ __decorate([
|
|
|
43514
43918
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
43515
43919
|
__metadata("design:type", Number)
|
|
43516
43920
|
], GetStatisticsLeaderboardAroundGroupOperationRequest.prototype, "limit", void 0);
|
|
43921
|
+
__decorate([
|
|
43922
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
43923
|
+
__metadata("design:type", Boolean)
|
|
43924
|
+
], GetStatisticsLeaderboardAroundGroupOperationRequest.prototype, "loadFromCache", void 0);
|
|
43925
|
+
__decorate([
|
|
43926
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
43927
|
+
__metadata("design:type", String)
|
|
43928
|
+
], GetStatisticsLeaderboardAroundGroupOperationRequest.prototype, "catalogId", void 0);
|
|
43517
43929
|
class ServerGetStatisticsLeaderboardAroundGroupOperationRequest extends GetStatisticsLeaderboardAroundGroupOperationRequest {
|
|
43518
43930
|
isValidRequest() {
|
|
43519
43931
|
if (!super.isValidRequest())
|
|
@@ -43551,7 +43963,9 @@ class GetStatisticsLeaderboardAroundGroupRequestHandler extends GroupBaseRequest
|
|
|
43551
43963
|
key: request.key,
|
|
43552
43964
|
skip: request.skip,
|
|
43553
43965
|
limit: request.limit,
|
|
43554
|
-
infoRequestParam: request.infoRequestParam
|
|
43966
|
+
infoRequestParam: request.infoRequestParam,
|
|
43967
|
+
loadFromCache: request.loadFromCache,
|
|
43968
|
+
catalogId: request.catalogId,
|
|
43555
43969
|
}, secretInfo, operationRequest);
|
|
43556
43970
|
});
|
|
43557
43971
|
}
|
|
@@ -43570,7 +43984,9 @@ class GetStatisticsLeaderboardAroundGroupRequestHandler extends GroupBaseRequest
|
|
|
43570
43984
|
key: request.key,
|
|
43571
43985
|
skip: request.skip,
|
|
43572
43986
|
limit: request.limit,
|
|
43573
|
-
infoRequestParam: request.infoRequestParam
|
|
43987
|
+
infoRequestParam: request.infoRequestParam,
|
|
43988
|
+
loadFromCache: request.loadFromCache,
|
|
43989
|
+
catalogId: request.catalogId,
|
|
43574
43990
|
}, secretInfo, operationRequest);
|
|
43575
43991
|
});
|
|
43576
43992
|
}
|
|
@@ -43589,7 +44005,9 @@ class GetStatisticsLeaderboardAroundGroupRequestHandler extends GroupBaseRequest
|
|
|
43589
44005
|
key: request.key,
|
|
43590
44006
|
skip: request.skip,
|
|
43591
44007
|
limit: request.limit,
|
|
43592
|
-
infoRequestParam: request.infoRequestParam
|
|
44008
|
+
infoRequestParam: request.infoRequestParam,
|
|
44009
|
+
loadFromCache: request.loadFromCache,
|
|
44010
|
+
catalogId: request.catalogId,
|
|
43593
44011
|
}, secretInfo, operationRequest);
|
|
43594
44012
|
});
|
|
43595
44013
|
}
|
|
@@ -43601,25 +44019,79 @@ class GetStatisticsLeaderboardAroundGroupRequestHandler extends GroupBaseRequest
|
|
|
43601
44019
|
}
|
|
43602
44020
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
43603
44021
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
43604
|
-
let
|
|
43605
|
-
let
|
|
43606
|
-
let groupStatisticsSettingsItem = masterGroupSettings.groupStatisticsSettings.find(x => x.key == request.key);
|
|
44022
|
+
let groupSettings = this.gnServer.getGNSettings().getGroupSettings(secretInfo.getGameId());
|
|
44023
|
+
let groupStatisticsSettingsItem = groupSettings.groupStatisticsSettings.find(x => x.key == request.key);
|
|
43607
44024
|
if (groupStatisticsSettingsItem == null) {
|
|
43608
44025
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
43609
44026
|
return operationResponse;
|
|
43610
44027
|
}
|
|
44028
|
+
let positionCacheKey = "groupStatisticsLeaderboardAroundPosition_" + request.groupId + "_" + request.key;
|
|
44029
|
+
let cacheKey = "groupStatisticsLeaderboardAround_" + request.groupId + "_" + request.key;
|
|
44030
|
+
if (request.catalogId) {
|
|
44031
|
+
cacheKey += "_" + request.catalogId;
|
|
44032
|
+
positionCacheKey += "_" + request.catalogId;
|
|
44033
|
+
}
|
|
44034
|
+
if (request.loadFromCache) {
|
|
44035
|
+
if (request.skip + request.limit > 100) {
|
|
44036
|
+
request.loadFromCache = false;
|
|
44037
|
+
}
|
|
44038
|
+
}
|
|
44039
|
+
if (request.loadFromCache) {
|
|
44040
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey) || !this.gnServer.getCacheData().isValid(positionCacheKey)) {
|
|
44041
|
+
request.loadFromCache = false;
|
|
44042
|
+
}
|
|
44043
|
+
}
|
|
43611
44044
|
let gnResults = new GNData_1.GNArray();
|
|
43612
|
-
let
|
|
43613
|
-
let
|
|
43614
|
-
|
|
43615
|
-
|
|
43616
|
-
|
|
43617
|
-
let
|
|
43618
|
-
|
|
43619
|
-
|
|
43620
|
-
|
|
43621
|
-
|
|
43622
|
-
|
|
44045
|
+
let thisPosition;
|
|
44046
|
+
let groups;
|
|
44047
|
+
if (request.loadFromCache) {
|
|
44048
|
+
thisPosition = this.gnServer.getCacheData().getData(positionCacheKey);
|
|
44049
|
+
groups = this.gnServer.getCacheData().getData(cacheKey);
|
|
44050
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
44051
|
+
if (i >= groups.length)
|
|
44052
|
+
break;
|
|
44053
|
+
let group = groups[i];
|
|
44054
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
44055
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
44056
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.GroupId, group.getGroupId());
|
|
44057
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(group, request.infoRequestParam, secretInfo.getGameId()));
|
|
44058
|
+
gnResults.add(gnResult);
|
|
44059
|
+
}
|
|
44060
|
+
}
|
|
44061
|
+
else {
|
|
44062
|
+
let statisticsAggregationMethod = groupStatisticsSettingsItem.statisticsAggregationMethod;
|
|
44063
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
44064
|
+
thisPosition = yield this.gnServer.getDatabase().loadPositionGroupLeaderboardWithStatisticsAsync(request.key, request.groupId, request.catalogId, secretInfo.getGameId(), groupStatisticsSettingsItem.initialValue, direction);
|
|
44065
|
+
if (thisPosition != -1) {
|
|
44066
|
+
this.gnServer.getCacheData().setData(positionCacheKey, thisPosition, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
44067
|
+
let groupFindOptions = this.convertToGroupFindOptions(request.infoRequestParam);
|
|
44068
|
+
if (request.skip + request.limit <= 100) {
|
|
44069
|
+
groupFindOptions = null;
|
|
44070
|
+
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, thisPosition, 100, request.catalogId, secretInfo.getGameId(), direction, groupFindOptions);
|
|
44071
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
44072
|
+
if (i >= groups.length)
|
|
44073
|
+
break;
|
|
44074
|
+
let group = groups[i];
|
|
44075
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
44076
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
44077
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.GroupId, group.getGroupId());
|
|
44078
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(group, request.infoRequestParam, secretInfo.getGameId()));
|
|
44079
|
+
gnResults.add(gnResult);
|
|
44080
|
+
}
|
|
44081
|
+
this.gnServer.getCacheData().setData(cacheKey, groups, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
44082
|
+
}
|
|
44083
|
+
else {
|
|
44084
|
+
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, groupFindOptions);
|
|
44085
|
+
for (let i = 0; i < groups.length; i++) {
|
|
44086
|
+
let group = groups[i];
|
|
44087
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
44088
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition + request.skip);
|
|
44089
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.GroupId, group.getGroupId());
|
|
44090
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(group, request.infoRequestParam, secretInfo.getGameId()));
|
|
44091
|
+
gnResults.add(gnResult);
|
|
44092
|
+
}
|
|
44093
|
+
}
|
|
44094
|
+
}
|
|
43623
44095
|
}
|
|
43624
44096
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
43625
44097
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
@@ -43701,6 +44173,10 @@ __decorate([
|
|
|
43701
44173
|
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.Version, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
43702
44174
|
__metadata("design:type", String)
|
|
43703
44175
|
], GetStatisticsLeaderboardOperationRequest.prototype, "version", void 0);
|
|
44176
|
+
__decorate([
|
|
44177
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
44178
|
+
__metadata("design:type", String)
|
|
44179
|
+
], GetStatisticsLeaderboardOperationRequest.prototype, "catalogId", void 0);
|
|
43704
44180
|
class ServerGetStatisticsLeaderboardOperationRequest extends GetStatisticsLeaderboardOperationRequest {
|
|
43705
44181
|
isValidRequest() {
|
|
43706
44182
|
if (!super.isValidRequest())
|
|
@@ -43739,6 +44215,7 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43739
44215
|
infoRequestParam: request.infoRequestParam,
|
|
43740
44216
|
loadFromCache: request.loadFromCache,
|
|
43741
44217
|
version: request.version,
|
|
44218
|
+
catalogId: request.catalogId,
|
|
43742
44219
|
}, secretInfo, operationRequest);
|
|
43743
44220
|
});
|
|
43744
44221
|
}
|
|
@@ -43759,6 +44236,7 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43759
44236
|
infoRequestParam: request.infoRequestParam,
|
|
43760
44237
|
loadFromCache: request.loadFromCache,
|
|
43761
44238
|
version: request.version,
|
|
44239
|
+
catalogId: request.catalogId,
|
|
43762
44240
|
}, secretInfo, operationRequest);
|
|
43763
44241
|
});
|
|
43764
44242
|
}
|
|
@@ -43779,6 +44257,7 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43779
44257
|
infoRequestParam: request.infoRequestParam,
|
|
43780
44258
|
loadFromCache: request.loadFromCache,
|
|
43781
44259
|
version: request.version,
|
|
44260
|
+
catalogId: request.catalogId,
|
|
43782
44261
|
}, secretInfo, operationRequest);
|
|
43783
44262
|
});
|
|
43784
44263
|
}
|
|
@@ -43790,15 +44269,16 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43790
44269
|
}
|
|
43791
44270
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
43792
44271
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
43793
|
-
let
|
|
43794
|
-
let
|
|
43795
|
-
let groupStatisticsSettingsItem = masterGroupSettings.groupStatisticsSettings.find(x => x.key == request.key);
|
|
44272
|
+
let groupSettings = this.gnServer.getGNSettings().getGroupSettings(secretInfo.getGameId());
|
|
44273
|
+
let groupStatisticsSettingsItem = groupSettings.groupStatisticsSettings.find(x => x.key == request.key);
|
|
43796
44274
|
if (groupStatisticsSettingsItem == null) {
|
|
43797
44275
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
43798
44276
|
return operationResponse;
|
|
43799
44277
|
}
|
|
43800
44278
|
if (!request.version) {
|
|
43801
44279
|
let cacheKey = "groupStatisticsLeaderboard_" + request.key;
|
|
44280
|
+
if (request.catalogId)
|
|
44281
|
+
cacheKey += "_" + request.catalogId;
|
|
43802
44282
|
if (request.loadFromCache) {
|
|
43803
44283
|
if (request.skip + request.limit > 100) {
|
|
43804
44284
|
request.loadFromCache = false;
|
|
@@ -43809,8 +44289,6 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43809
44289
|
request.loadFromCache = false;
|
|
43810
44290
|
}
|
|
43811
44291
|
}
|
|
43812
|
-
let statisticsAggregationMethod = groupStatisticsSettingsItem.statisticsAggregationMethod;
|
|
43813
|
-
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
43814
44292
|
let gnResults = new GNData_1.GNArray();
|
|
43815
44293
|
let groups;
|
|
43816
44294
|
if (request.loadFromCache) {
|
|
@@ -43827,9 +44305,12 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43827
44305
|
}
|
|
43828
44306
|
}
|
|
43829
44307
|
else {
|
|
44308
|
+
let groupFindOptions = this.convertToGroupFindOptions(request.infoRequestParam);
|
|
44309
|
+
let statisticsAggregationMethod = groupStatisticsSettingsItem.statisticsAggregationMethod;
|
|
44310
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
43830
44311
|
if (request.skip + request.limit <= 100) {
|
|
43831
44312
|
groupFindOptions = null;
|
|
43832
|
-
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, 0, 100, secretInfo.getGameId(), direction, groupFindOptions);
|
|
44313
|
+
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, 0, 100, request.catalogId, secretInfo.getGameId(), direction, groupFindOptions);
|
|
43833
44314
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
43834
44315
|
if (i >= groups.length)
|
|
43835
44316
|
break;
|
|
@@ -43843,7 +44324,7 @@ class GetStatisticsLeaderboardRequestHandler extends GroupBaseRequestHandler_1.G
|
|
|
43843
44324
|
this.gnServer.getCacheData().setData(cacheKey, groups, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
43844
44325
|
}
|
|
43845
44326
|
else {
|
|
43846
|
-
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, secretInfo.getGameId(), direction, groupFindOptions);
|
|
44327
|
+
groups = yield this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, groupFindOptions);
|
|
43847
44328
|
for (let i = 0; i < groups.length; i++) {
|
|
43848
44329
|
let group = groups[i];
|
|
43849
44330
|
let gnResult = new GNData_1.GNHashtable();
|
|
@@ -44043,11 +44524,11 @@ class GetStatisticsLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
44043
44524
|
}
|
|
44044
44525
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
44045
44526
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
44046
|
-
let
|
|
44527
|
+
let groupSettings = this.gnServer.getGNSettings().getGroupSettings(secretInfo.getGameId());
|
|
44047
44528
|
let keys = [];
|
|
44048
44529
|
if (request.keys) {
|
|
44049
44530
|
for (let i = 0; i < request.keys.length; i++) {
|
|
44050
|
-
let playerStatisticsSettingsItem =
|
|
44531
|
+
let playerStatisticsSettingsItem = groupSettings.groupStatisticsSettings.find(x => x.key == request.keys[i]);
|
|
44051
44532
|
if (playerStatisticsSettingsItem != null) {
|
|
44052
44533
|
keys.push(playerStatisticsSettingsItem.key);
|
|
44053
44534
|
}
|
|
@@ -44445,7 +44926,7 @@ __decorate([
|
|
|
44445
44926
|
__metadata("design:type", String)
|
|
44446
44927
|
], GrantGroupItemOperationRequest.prototype, "displayName", void 0);
|
|
44447
44928
|
__decorate([
|
|
44448
|
-
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, isOptional: true }),
|
|
44929
|
+
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Amount, defaultValue: 1, mustInt: true, isOptional: true }),
|
|
44449
44930
|
__metadata("design:type", Number)
|
|
44450
44931
|
], GrantGroupItemOperationRequest.prototype, "amount", void 0);
|
|
44451
44932
|
class ServerGrantGroupItemOperationRequest extends GrantGroupItemOperationRequest {
|
|
@@ -44552,7 +45033,7 @@ class GrantGroupItemRequestHandler extends GroupBaseRequestHandler_1.GroupBaseRe
|
|
|
44552
45033
|
return operationResponse;
|
|
44553
45034
|
}
|
|
44554
45035
|
let amount = request.amount;
|
|
44555
|
-
if (groupItemCatalogSettingsItem.itemType == ItemType_1.ItemType.
|
|
45036
|
+
if (groupItemCatalogSettingsItem.itemType == ItemType_1.ItemType.NonStackable) {
|
|
44556
45037
|
amount = 1;
|
|
44557
45038
|
}
|
|
44558
45039
|
let itemId = StringUtility_1.StringUtility.generateRandomString(12, this.gnServer.getIdTypeCase());
|
|
@@ -50489,6 +50970,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
50489
50970
|
const ItemBaseRequestHandler_1 = __webpack_require__(72916);
|
|
50490
50971
|
const InfoRequestParam_1 = __webpack_require__(55389);
|
|
50491
50972
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
50973
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
50492
50974
|
class GetStatisticsLeaderboardAroundItemOperationRequest extends OperationRequest_1.OperationRequest {
|
|
50493
50975
|
isValidRequest() {
|
|
50494
50976
|
if (!super.isValidRequest())
|
|
@@ -50516,6 +50998,14 @@ __decorate([
|
|
|
50516
50998
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
50517
50999
|
__metadata("design:type", Number)
|
|
50518
51000
|
], GetStatisticsLeaderboardAroundItemOperationRequest.prototype, "limit", void 0);
|
|
51001
|
+
__decorate([
|
|
51002
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
51003
|
+
__metadata("design:type", Boolean)
|
|
51004
|
+
], GetStatisticsLeaderboardAroundItemOperationRequest.prototype, "loadFromCache", void 0);
|
|
51005
|
+
__decorate([
|
|
51006
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
51007
|
+
__metadata("design:type", String)
|
|
51008
|
+
], GetStatisticsLeaderboardAroundItemOperationRequest.prototype, "catalogId", void 0);
|
|
50519
51009
|
class ServerGetStatisticsLeaderboardAroundItemOperationRequest extends GetStatisticsLeaderboardAroundItemOperationRequest {
|
|
50520
51010
|
isValidRequest() {
|
|
50521
51011
|
if (!super.isValidRequest())
|
|
@@ -50553,7 +51043,9 @@ class GetStatisticsLeaderboardAroundItemRequestHandler extends ItemBaseRequestHa
|
|
|
50553
51043
|
key: request.key,
|
|
50554
51044
|
skip: request.skip,
|
|
50555
51045
|
limit: request.limit,
|
|
50556
|
-
infoRequestParam: request.infoRequestParam
|
|
51046
|
+
infoRequestParam: request.infoRequestParam,
|
|
51047
|
+
loadFromCache: request.loadFromCache,
|
|
51048
|
+
catalogId: request.catalogId,
|
|
50557
51049
|
}, secretInfo, operationRequest);
|
|
50558
51050
|
});
|
|
50559
51051
|
}
|
|
@@ -50572,7 +51064,9 @@ class GetStatisticsLeaderboardAroundItemRequestHandler extends ItemBaseRequestHa
|
|
|
50572
51064
|
key: request.key,
|
|
50573
51065
|
skip: request.skip,
|
|
50574
51066
|
limit: request.limit,
|
|
50575
|
-
infoRequestParam: request.infoRequestParam
|
|
51067
|
+
infoRequestParam: request.infoRequestParam,
|
|
51068
|
+
loadFromCache: request.loadFromCache,
|
|
51069
|
+
catalogId: request.catalogId,
|
|
50576
51070
|
}, secretInfo, operationRequest);
|
|
50577
51071
|
});
|
|
50578
51072
|
}
|
|
@@ -50591,7 +51085,9 @@ class GetStatisticsLeaderboardAroundItemRequestHandler extends ItemBaseRequestHa
|
|
|
50591
51085
|
key: request.key,
|
|
50592
51086
|
skip: request.skip,
|
|
50593
51087
|
limit: request.limit,
|
|
50594
|
-
infoRequestParam: request.infoRequestParam
|
|
51088
|
+
infoRequestParam: request.infoRequestParam,
|
|
51089
|
+
loadFromCache: request.loadFromCache,
|
|
51090
|
+
catalogId: request.catalogId,
|
|
50595
51091
|
}, secretInfo, operationRequest);
|
|
50596
51092
|
});
|
|
50597
51093
|
}
|
|
@@ -50603,25 +51099,79 @@ class GetStatisticsLeaderboardAroundItemRequestHandler extends ItemBaseRequestHa
|
|
|
50603
51099
|
}
|
|
50604
51100
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
50605
51101
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
50606
|
-
let
|
|
50607
|
-
let
|
|
50608
|
-
let inventoryStatisticsSettingsItem = masterItemSettings.inventoryStatisticsSettings.find(x => x.key == request.key);
|
|
51102
|
+
let inventorySettings = this.gnServer.getGNSettings().getInventorySettings(secretInfo.getGameId());
|
|
51103
|
+
let inventoryStatisticsSettingsItem = inventorySettings.inventoryStatisticsSettings.find(x => x.key == request.key);
|
|
50609
51104
|
if (inventoryStatisticsSettingsItem == null) {
|
|
50610
51105
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
50611
51106
|
return operationResponse;
|
|
50612
51107
|
}
|
|
51108
|
+
let positionCacheKey = "inventoryStatisticsLeaderboardAroundPosition_" + request.itemId + "_" + request.key;
|
|
51109
|
+
let cacheKey = "inventoryStatisticsLeaderboardAround_" + request.itemId + "_" + request.key;
|
|
51110
|
+
if (request.catalogId) {
|
|
51111
|
+
cacheKey += "_" + request.catalogId;
|
|
51112
|
+
positionCacheKey += "_" + request.catalogId;
|
|
51113
|
+
}
|
|
51114
|
+
if (request.loadFromCache) {
|
|
51115
|
+
if (request.skip + request.limit > 100) {
|
|
51116
|
+
request.loadFromCache = false;
|
|
51117
|
+
}
|
|
51118
|
+
}
|
|
51119
|
+
if (request.loadFromCache) {
|
|
51120
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey) || !this.gnServer.getCacheData().isValid(positionCacheKey)) {
|
|
51121
|
+
request.loadFromCache = false;
|
|
51122
|
+
}
|
|
51123
|
+
}
|
|
50613
51124
|
let gnResults = new GNData_1.GNArray();
|
|
50614
|
-
let
|
|
50615
|
-
let
|
|
50616
|
-
|
|
50617
|
-
|
|
50618
|
-
|
|
50619
|
-
let
|
|
50620
|
-
|
|
50621
|
-
|
|
50622
|
-
|
|
50623
|
-
|
|
50624
|
-
|
|
51125
|
+
let thisPosition;
|
|
51126
|
+
let inventories;
|
|
51127
|
+
if (request.loadFromCache) {
|
|
51128
|
+
thisPosition = this.gnServer.getCacheData().getData(positionCacheKey);
|
|
51129
|
+
inventories = this.gnServer.getCacheData().getData(cacheKey);
|
|
51130
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
51131
|
+
if (i >= inventories.length)
|
|
51132
|
+
break;
|
|
51133
|
+
let inventory = inventories[i];
|
|
51134
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
51135
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
51136
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.ItemId, inventory.getItemId());
|
|
51137
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(inventory, request.infoRequestParam, secretInfo.getGameId()));
|
|
51138
|
+
gnResults.add(gnResult);
|
|
51139
|
+
}
|
|
51140
|
+
}
|
|
51141
|
+
else {
|
|
51142
|
+
let statisticsAggregationMethod = inventoryStatisticsSettingsItem.statisticsAggregationMethod;
|
|
51143
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
51144
|
+
thisPosition = yield this.gnServer.getDatabase().loadPositionInventoryLeaderboardWithStatisticsAsync(request.key, request.itemId, request.catalogId, secretInfo.getGameId(), inventoryStatisticsSettingsItem.initialValue, direction);
|
|
51145
|
+
if (thisPosition != -1) {
|
|
51146
|
+
this.gnServer.getCacheData().setData(positionCacheKey, thisPosition, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
51147
|
+
let inventoryFindOptions = this.convertToInventoryFindOptions(request.infoRequestParam);
|
|
51148
|
+
if (request.skip + request.limit <= 100) {
|
|
51149
|
+
inventoryFindOptions = null;
|
|
51150
|
+
inventories = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
51151
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
51152
|
+
if (i >= inventories.length)
|
|
51153
|
+
break;
|
|
51154
|
+
let inventory = inventories[i];
|
|
51155
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
51156
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
51157
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.ItemId, inventory.getItemId());
|
|
51158
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(inventory, request.infoRequestParam, secretInfo.getGameId()));
|
|
51159
|
+
gnResults.add(gnResult);
|
|
51160
|
+
}
|
|
51161
|
+
this.gnServer.getCacheData().setData(cacheKey, inventories, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
51162
|
+
}
|
|
51163
|
+
else {
|
|
51164
|
+
inventories = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
51165
|
+
for (let i = 0; i < inventories.length; i++) {
|
|
51166
|
+
let inventory = inventories[i];
|
|
51167
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
51168
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition + request.skip);
|
|
51169
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.ItemId, inventory.getItemId());
|
|
51170
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(inventory, request.infoRequestParam, secretInfo.getGameId()));
|
|
51171
|
+
gnResults.add(gnResult);
|
|
51172
|
+
}
|
|
51173
|
+
}
|
|
51174
|
+
}
|
|
50625
51175
|
}
|
|
50626
51176
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
50627
51177
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
@@ -50703,6 +51253,10 @@ __decorate([
|
|
|
50703
51253
|
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.Version, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
50704
51254
|
__metadata("design:type", String)
|
|
50705
51255
|
], GetStatisticsLeaderboardOperationRequest.prototype, "version", void 0);
|
|
51256
|
+
__decorate([
|
|
51257
|
+
(0, DataMember_1.StringDataMember)({ code: GNParameterCode_1.GNParameterCode.CatalogId, minLength: 2, maxLength: 32, mustNonNull: true, isOptional: true }),
|
|
51258
|
+
__metadata("design:type", String)
|
|
51259
|
+
], GetStatisticsLeaderboardOperationRequest.prototype, "catalogId", void 0);
|
|
50706
51260
|
class ServerGetStatisticsLeaderboardOperationRequest extends GetStatisticsLeaderboardOperationRequest {
|
|
50707
51261
|
isValidRequest() {
|
|
50708
51262
|
if (!super.isValidRequest())
|
|
@@ -50741,6 +51295,7 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50741
51295
|
infoRequestParam: request.infoRequestParam,
|
|
50742
51296
|
loadFromCache: request.loadFromCache,
|
|
50743
51297
|
version: request.version,
|
|
51298
|
+
catalogId: request.catalogId,
|
|
50744
51299
|
}, secretInfo, operationRequest);
|
|
50745
51300
|
});
|
|
50746
51301
|
}
|
|
@@ -50761,6 +51316,7 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50761
51316
|
infoRequestParam: request.infoRequestParam,
|
|
50762
51317
|
loadFromCache: request.loadFromCache,
|
|
50763
51318
|
version: request.version,
|
|
51319
|
+
catalogId: request.catalogId,
|
|
50764
51320
|
}, secretInfo, operationRequest);
|
|
50765
51321
|
});
|
|
50766
51322
|
}
|
|
@@ -50781,6 +51337,7 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50781
51337
|
infoRequestParam: request.infoRequestParam,
|
|
50782
51338
|
loadFromCache: request.loadFromCache,
|
|
50783
51339
|
version: request.version,
|
|
51340
|
+
catalogId: request.catalogId,
|
|
50784
51341
|
}, secretInfo, operationRequest);
|
|
50785
51342
|
});
|
|
50786
51343
|
}
|
|
@@ -50792,15 +51349,16 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50792
51349
|
}
|
|
50793
51350
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
50794
51351
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
50795
|
-
let
|
|
50796
|
-
let
|
|
50797
|
-
let inventoryStatisticsSettingsItem = masterItemSettings.inventoryStatisticsSettings.find(x => x.key == request.key);
|
|
51352
|
+
let inventorySettings = this.gnServer.getGNSettings().getInventorySettings(secretInfo.getGameId());
|
|
51353
|
+
let inventoryStatisticsSettingsItem = inventorySettings.inventoryStatisticsSettings.find(x => x.key == request.key);
|
|
50798
51354
|
if (inventoryStatisticsSettingsItem == null) {
|
|
50799
51355
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
50800
51356
|
return operationResponse;
|
|
50801
51357
|
}
|
|
50802
51358
|
if (!request.version) {
|
|
50803
51359
|
let cacheKey = "inventoryStatisticsLeaderboard_" + request.key;
|
|
51360
|
+
if (request.catalogId)
|
|
51361
|
+
cacheKey += "_" + request.catalogId;
|
|
50804
51362
|
if (request.loadFromCache) {
|
|
50805
51363
|
if (request.skip + request.limit > 100) {
|
|
50806
51364
|
request.loadFromCache = false;
|
|
@@ -50811,8 +51369,6 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50811
51369
|
request.loadFromCache = false;
|
|
50812
51370
|
}
|
|
50813
51371
|
}
|
|
50814
|
-
let statisticsAggregationMethod = inventoryStatisticsSettingsItem.statisticsAggregationMethod;
|
|
50815
|
-
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
50816
51372
|
let gnResults = new GNData_1.GNArray();
|
|
50817
51373
|
let inventorys;
|
|
50818
51374
|
if (request.loadFromCache) {
|
|
@@ -50829,9 +51385,12 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50829
51385
|
}
|
|
50830
51386
|
}
|
|
50831
51387
|
else {
|
|
51388
|
+
let inventoryFindOptions = this.convertToInventoryFindOptions(request.infoRequestParam);
|
|
51389
|
+
let statisticsAggregationMethod = inventoryStatisticsSettingsItem.statisticsAggregationMethod;
|
|
51390
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
50832
51391
|
if (request.skip + request.limit <= 100) {
|
|
50833
51392
|
inventoryFindOptions = null;
|
|
50834
|
-
inventorys = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, 0, 100, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
51393
|
+
inventorys = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, 0, 100, request.catalogId, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
50835
51394
|
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
50836
51395
|
if (i >= inventorys.length)
|
|
50837
51396
|
break;
|
|
@@ -50845,7 +51404,7 @@ class GetStatisticsLeaderboardRequestHandler extends ItemBaseRequestHandler_1.It
|
|
|
50845
51404
|
this.gnServer.getCacheData().setData(cacheKey, inventorys, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
50846
51405
|
}
|
|
50847
51406
|
else {
|
|
50848
|
-
inventorys = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
51407
|
+
inventorys = yield this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAsync(request.key, request.skip, request.limit, request.catalogId, secretInfo.getGameId(), direction, inventoryFindOptions);
|
|
50849
51408
|
for (let i = 0; i < inventorys.length; i++) {
|
|
50850
51409
|
let inventory = inventorys[i];
|
|
50851
51410
|
let gnResult = new GNData_1.GNHashtable();
|
|
@@ -51045,11 +51604,11 @@ class GetStatisticsLogRequestHandler extends RequestHandler_1.RequestHandler {
|
|
|
51045
51604
|
}
|
|
51046
51605
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
51047
51606
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
51048
|
-
let
|
|
51607
|
+
let inventorySettings = this.gnServer.getGNSettings().getInventorySettings(secretInfo.getGameId());
|
|
51049
51608
|
let keys = [];
|
|
51050
51609
|
if (request.keys) {
|
|
51051
51610
|
for (let i = 0; i < request.keys.length; i++) {
|
|
51052
|
-
let playerStatisticsSettingsItem =
|
|
51611
|
+
let playerStatisticsSettingsItem = inventorySettings.inventoryStatisticsSettings.find(x => x.key == request.keys[i]);
|
|
51053
51612
|
if (playerStatisticsSettingsItem != null) {
|
|
51054
51613
|
keys.push(playerStatisticsSettingsItem.key);
|
|
51055
51614
|
}
|
|
@@ -52252,8 +52811,8 @@ class SetAmountRequestHandler extends ItemBaseRequestHandler_1.ItemBaseRequestHa
|
|
|
52252
52811
|
return operationResponse;
|
|
52253
52812
|
}
|
|
52254
52813
|
let itemType = inventory.getItemType();
|
|
52255
|
-
if (itemType == ItemType_1.ItemType.
|
|
52256
|
-
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.
|
|
52814
|
+
if (itemType == ItemType_1.ItemType.NonStackable) {
|
|
52815
|
+
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.ItemNotStackable);
|
|
52257
52816
|
return operationResponse;
|
|
52258
52817
|
}
|
|
52259
52818
|
inventory.setAmount(inventory.getAmount() + request.amount);
|
|
@@ -55109,7 +55668,6 @@ class GetCurrencyLeaderboardRequestHandler extends MasterPlayerBaseRequestHandle
|
|
|
55109
55668
|
}
|
|
55110
55669
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
55111
55670
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
55112
|
-
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
55113
55671
|
let masterPlayerSettings = this.gnServer.getGNSettings().getMasterPlayerSettings();
|
|
55114
55672
|
let playerCurrencySettingsItem = masterPlayerSettings.playerCurrencySettings.find(x => x.key == request.key);
|
|
55115
55673
|
if (playerCurrencySettingsItem == null) {
|
|
@@ -55143,6 +55701,7 @@ class GetCurrencyLeaderboardRequestHandler extends MasterPlayerBaseRequestHandle
|
|
|
55143
55701
|
}
|
|
55144
55702
|
}
|
|
55145
55703
|
else {
|
|
55704
|
+
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
55146
55705
|
if (request.skip + request.limit <= 100) {
|
|
55147
55706
|
masterPlayerFindOptions = null;
|
|
55148
55707
|
masterPlayers = yield this.gnServer.getDatabase().loadMasterPlayersLeaderboardWithCurrenciesAsync(request.key, 0, 100, masterPlayerFindOptions);
|
|
@@ -58939,6 +59498,7 @@ const GNErrorCode_1 = __webpack_require__(94559);
|
|
|
58939
59498
|
const MasterPlayerBaseRequestHandler_1 = __webpack_require__(28575);
|
|
58940
59499
|
const InfoRequestParam_1 = __webpack_require__(17818);
|
|
58941
59500
|
const xStatisticsAggregationMethod_1 = __webpack_require__(21554);
|
|
59501
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
58942
59502
|
class GetStatisticsLeaderboardAroundPlayerOperationRequest extends OperationRequest_1.OperationRequest {
|
|
58943
59503
|
isValidRequest() {
|
|
58944
59504
|
if (!super.isValidRequest())
|
|
@@ -58966,6 +59526,10 @@ __decorate([
|
|
|
58966
59526
|
(0, DataMember_1.NumberDataMember)({ code: GNParameterCode_1.GNParameterCode.Limit, defaultValue: 10, minValue: 1, maxValue: 100, mustInt: true, isOptional: true }),
|
|
58967
59527
|
__metadata("design:type", Number)
|
|
58968
59528
|
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "limit", void 0);
|
|
59529
|
+
__decorate([
|
|
59530
|
+
(0, DataMember_1.BooleanDataMember)({ code: GNParameterCode_1.GNParameterCode.LoadFromCache, defaultValue: true, isOptional: true }),
|
|
59531
|
+
__metadata("design:type", Boolean)
|
|
59532
|
+
], GetStatisticsLeaderboardAroundPlayerOperationRequest.prototype, "loadFromCache", void 0);
|
|
58969
59533
|
class ServerGetStatisticsLeaderboardAroundPlayerOperationRequest extends GetStatisticsLeaderboardAroundPlayerOperationRequest {
|
|
58970
59534
|
isValidRequest() {
|
|
58971
59535
|
if (!super.isValidRequest())
|
|
@@ -59019,7 +59583,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends MasterPlayerBas
|
|
|
59019
59583
|
key: request.key,
|
|
59020
59584
|
skip: request.skip,
|
|
59021
59585
|
limit: request.limit,
|
|
59022
|
-
infoRequestParam: request.infoRequestParam
|
|
59586
|
+
infoRequestParam: request.infoRequestParam,
|
|
59587
|
+
loadFromCache: request.loadFromCache,
|
|
59023
59588
|
}, secretInfo, operationRequest);
|
|
59024
59589
|
});
|
|
59025
59590
|
}
|
|
@@ -59038,7 +59603,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends MasterPlayerBas
|
|
|
59038
59603
|
key: request.key,
|
|
59039
59604
|
skip: request.skip,
|
|
59040
59605
|
limit: request.limit,
|
|
59041
|
-
infoRequestParam: request.infoRequestParam
|
|
59606
|
+
infoRequestParam: request.infoRequestParam,
|
|
59607
|
+
loadFromCache: request.loadFromCache,
|
|
59042
59608
|
}, secretInfo, operationRequest);
|
|
59043
59609
|
});
|
|
59044
59610
|
}
|
|
@@ -59057,7 +59623,8 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends MasterPlayerBas
|
|
|
59057
59623
|
key: request.key,
|
|
59058
59624
|
skip: request.skip,
|
|
59059
59625
|
limit: request.limit,
|
|
59060
|
-
infoRequestParam: request.infoRequestParam
|
|
59626
|
+
infoRequestParam: request.infoRequestParam,
|
|
59627
|
+
loadFromCache: request.loadFromCache,
|
|
59061
59628
|
}, secretInfo, operationRequest);
|
|
59062
59629
|
});
|
|
59063
59630
|
}
|
|
@@ -59069,25 +59636,75 @@ class GetStatisticsLeaderboardAroundPlayerRequestHandler extends MasterPlayerBas
|
|
|
59069
59636
|
}
|
|
59070
59637
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
59071
59638
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
59072
|
-
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
59073
59639
|
let masterPlayerSettings = this.gnServer.getGNSettings().getMasterPlayerSettings();
|
|
59074
59640
|
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
59075
59641
|
if (playerStatisticsSettingsItem == null) {
|
|
59076
59642
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.KeyNotFound);
|
|
59077
59643
|
return operationResponse;
|
|
59078
59644
|
}
|
|
59079
|
-
let
|
|
59080
|
-
let
|
|
59645
|
+
let positionCacheKey = "masterPlayerStatisticsLeaderboardAroundPosition_" + request.userId + "_" + request.key;
|
|
59646
|
+
let cacheKey = "masterPlayerStatisticsLeaderboardAround_" + request.userId + "_" + request.key;
|
|
59647
|
+
if (request.loadFromCache) {
|
|
59648
|
+
if (request.skip + request.limit > 100) {
|
|
59649
|
+
request.loadFromCache = false;
|
|
59650
|
+
}
|
|
59651
|
+
}
|
|
59652
|
+
if (request.loadFromCache) {
|
|
59653
|
+
if (!this.gnServer.getCacheData().isValid(cacheKey) || !this.gnServer.getCacheData().isValid(positionCacheKey)) {
|
|
59654
|
+
request.loadFromCache = false;
|
|
59655
|
+
}
|
|
59656
|
+
}
|
|
59081
59657
|
let gnResults = new GNData_1.GNArray();
|
|
59082
|
-
let thisPosition
|
|
59083
|
-
let masterPlayers
|
|
59084
|
-
|
|
59085
|
-
|
|
59086
|
-
|
|
59087
|
-
|
|
59088
|
-
|
|
59089
|
-
|
|
59090
|
-
|
|
59658
|
+
let thisPosition;
|
|
59659
|
+
let masterPlayers;
|
|
59660
|
+
if (request.loadFromCache) {
|
|
59661
|
+
thisPosition = this.gnServer.getCacheData().getData(positionCacheKey);
|
|
59662
|
+
masterPlayers = this.gnServer.getCacheData().getData(cacheKey);
|
|
59663
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
59664
|
+
if (i >= masterPlayers.length)
|
|
59665
|
+
break;
|
|
59666
|
+
let masterPlayer = masterPlayers[i];
|
|
59667
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
59668
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
59669
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, masterPlayer.getUserId());
|
|
59670
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
59671
|
+
gnResults.add(gnResult);
|
|
59672
|
+
}
|
|
59673
|
+
}
|
|
59674
|
+
else {
|
|
59675
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
59676
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
59677
|
+
thisPosition = yield this.gnServer.getDatabase().loadPositionMasterPlayerLeaderboardWithStatisticsAsync(request.key, request.userId, playerStatisticsSettingsItem.initialValue, direction);
|
|
59678
|
+
if (thisPosition != -1) {
|
|
59679
|
+
this.gnServer.getCacheData().setData(positionCacheKey, thisPosition, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
59680
|
+
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
59681
|
+
if (request.skip + request.limit <= 100) {
|
|
59682
|
+
masterPlayerFindOptions = null;
|
|
59683
|
+
masterPlayers = yield this.gnServer.getDatabase().loadMasterPlayersLeaderboardWithStatisticsAsync(request.key, thisPosition, 100, direction, masterPlayerFindOptions);
|
|
59684
|
+
for (let i = request.skip; i < request.skip + request.limit; i++) {
|
|
59685
|
+
if (i >= masterPlayers.length)
|
|
59686
|
+
break;
|
|
59687
|
+
let masterPlayer = masterPlayers[i];
|
|
59688
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
59689
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition);
|
|
59690
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, masterPlayer.getUserId());
|
|
59691
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
59692
|
+
gnResults.add(gnResult);
|
|
59693
|
+
}
|
|
59694
|
+
this.gnServer.getCacheData().setData(cacheKey, masterPlayers, xDatetime_1.xDatetime.ONE_MINUTE_MILLISECOND * 5);
|
|
59695
|
+
}
|
|
59696
|
+
else {
|
|
59697
|
+
masterPlayers = yield this.gnServer.getDatabase().loadMasterPlayersLeaderboardWithStatisticsAsync(request.key, thisPosition + request.skip, request.limit, direction, masterPlayerFindOptions);
|
|
59698
|
+
for (let i = 0; i < masterPlayers.length; i++) {
|
|
59699
|
+
let masterPlayer = masterPlayers[i];
|
|
59700
|
+
let gnResult = new GNData_1.GNHashtable();
|
|
59701
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.Position, i + thisPosition + request.skip);
|
|
59702
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.UserId, masterPlayer.getUserId());
|
|
59703
|
+
gnResult.add(GNParameterCode_1.GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
59704
|
+
gnResults.add(gnResult);
|
|
59705
|
+
}
|
|
59706
|
+
}
|
|
59707
|
+
}
|
|
59091
59708
|
}
|
|
59092
59709
|
operationResponse.setParameter(GNParameterCode_1.GNParameterCode.Results, gnResults);
|
|
59093
59710
|
operationResponse.setParameter(ParameterCode_1.ParameterCode.ErrorCode, GNErrorCode_1.GNErrorCode.Ok);
|
|
@@ -59258,7 +59875,6 @@ class GetStatisticsLeaderboardRequestHandler extends MasterPlayerBaseRequestHand
|
|
|
59258
59875
|
}
|
|
59259
59876
|
operationResponse = new OperationResponse_1.OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
|
|
59260
59877
|
operationResponse.setReturnCode(ReturnCode_1.ReturnCode.Ok);
|
|
59261
|
-
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
59262
59878
|
let masterPlayerSettings = this.gnServer.getGNSettings().getMasterPlayerSettings();
|
|
59263
59879
|
let playerStatisticsSettingsItem = masterPlayerSettings.playerStatisticsSettings.find(x => x.key == request.key);
|
|
59264
59880
|
if (playerStatisticsSettingsItem == null) {
|
|
@@ -59277,8 +59893,6 @@ class GetStatisticsLeaderboardRequestHandler extends MasterPlayerBaseRequestHand
|
|
|
59277
59893
|
request.loadFromCache = false;
|
|
59278
59894
|
}
|
|
59279
59895
|
}
|
|
59280
|
-
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
59281
|
-
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
59282
59896
|
let gnResults = new GNData_1.GNArray();
|
|
59283
59897
|
let masterPlayers;
|
|
59284
59898
|
if (request.loadFromCache) {
|
|
@@ -59295,6 +59909,9 @@ class GetStatisticsLeaderboardRequestHandler extends MasterPlayerBaseRequestHand
|
|
|
59295
59909
|
}
|
|
59296
59910
|
}
|
|
59297
59911
|
else {
|
|
59912
|
+
let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
|
|
59913
|
+
let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
|
|
59914
|
+
let direction = statisticsAggregationMethod == xStatisticsAggregationMethod_1.xStatisticsAggregationMethod.Minimum ? 1 : -1;
|
|
59298
59915
|
if (request.skip + request.limit <= 100) {
|
|
59299
59916
|
masterPlayerFindOptions = null;
|
|
59300
59917
|
masterPlayers = yield this.gnServer.getDatabase().loadMasterPlayersLeaderboardWithStatisticsAsync(request.key, 0, 100, direction, masterPlayerFindOptions);
|
|
@@ -76964,6 +77581,8 @@ class AnalyticsService {
|
|
|
76964
77581
|
operationSystem: this.currentOperationSystem,
|
|
76965
77582
|
requestComplete: this.currentRequestComplete,
|
|
76966
77583
|
databaseSystem: this.currentDatabaseSystem,
|
|
77584
|
+
cost: this.currentCost,
|
|
77585
|
+
monthlyCost: this.currentMonthlyCost,
|
|
76967
77586
|
};
|
|
76968
77587
|
}
|
|
76969
77588
|
else {
|
|
@@ -76989,6 +77608,8 @@ class AnalyticsService {
|
|
|
76989
77608
|
operationSystem: null,
|
|
76990
77609
|
requestComplete: null,
|
|
76991
77610
|
databaseSystem: null,
|
|
77611
|
+
cost: null,
|
|
77612
|
+
monthlyCost: null,
|
|
76992
77613
|
};
|
|
76993
77614
|
}
|
|
76994
77615
|
else {
|
|
@@ -77011,6 +77632,8 @@ class AnalyticsService {
|
|
|
77011
77632
|
operationSystem: result["operationSystem"],
|
|
77012
77633
|
requestComplete: result["requestComplete"],
|
|
77013
77634
|
databaseSystem: result["databaseSystem"],
|
|
77635
|
+
cost: result["cost"],
|
|
77636
|
+
monthlyCost: result["monthlyCost"],
|
|
77014
77637
|
};
|
|
77015
77638
|
}
|
|
77016
77639
|
}
|
|
@@ -77037,6 +77660,7 @@ class AnalyticsService {
|
|
|
77037
77660
|
}
|
|
77038
77661
|
getAnalytics() {
|
|
77039
77662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77663
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
77040
77664
|
let currentMilliseconds = xDatetime_1.xDatetime.getCurrentMilliseconds();
|
|
77041
77665
|
let millisecondsSince0h = xDatetime_1.xDatetime.getToday0hMilliseconds();
|
|
77042
77666
|
let playerCollection = this.gnServer.getDatabase().systemCollection("MasterPlayer");
|
|
@@ -77208,41 +77832,41 @@ class AnalyticsService {
|
|
|
77208
77832
|
storageUsage: storageUsage
|
|
77209
77833
|
};
|
|
77210
77834
|
}
|
|
77211
|
-
{
|
|
77212
|
-
|
|
77213
|
-
|
|
77214
|
-
|
|
77215
|
-
|
|
77216
|
-
|
|
77217
|
-
|
|
77218
|
-
|
|
77219
|
-
|
|
77220
|
-
|
|
77221
|
-
|
|
77222
|
-
|
|
77223
|
-
|
|
77224
|
-
|
|
77225
|
-
|
|
77226
|
-
|
|
77227
|
-
|
|
77228
|
-
|
|
77229
|
-
|
|
77230
|
-
|
|
77231
|
-
|
|
77232
|
-
|
|
77233
|
-
|
|
77234
|
-
|
|
77235
|
-
|
|
77236
|
-
|
|
77237
|
-
|
|
77238
|
-
|
|
77239
|
-
|
|
77240
|
-
|
|
77241
|
-
|
|
77242
|
-
|
|
77243
|
-
|
|
77244
|
-
|
|
77245
|
-
}
|
|
77835
|
+
// {
|
|
77836
|
+
// let eventCallbackPostCollection = this.gnServer.getDatabase().systemCollection("EventCallback.Post");
|
|
77837
|
+
// let results = await eventCallbackPostCollection.aggregate([
|
|
77838
|
+
// {
|
|
77839
|
+
// $match: {
|
|
77840
|
+
// _id: { $gt: mongoDB.ObjectId.createFromTime(millisecondsAt15MinutesAgo / 1000 - 1) }
|
|
77841
|
+
// }
|
|
77842
|
+
// },
|
|
77843
|
+
// {
|
|
77844
|
+
// $group: {
|
|
77845
|
+
// _id: { eventName: "$eventName", E: "$operationResponse.parameters.E" },
|
|
77846
|
+
// count: { $sum: 1 } // Đếm số lần xuất hiện
|
|
77847
|
+
// }
|
|
77848
|
+
// },
|
|
77849
|
+
// {
|
|
77850
|
+
// $group: {
|
|
77851
|
+
// _id: "$_id.eventName",
|
|
77852
|
+
// results: {
|
|
77853
|
+
// $push: {
|
|
77854
|
+
// errorCode: "$_id.E",
|
|
77855
|
+
// count: "$count"
|
|
77856
|
+
// }
|
|
77857
|
+
// }
|
|
77858
|
+
// }
|
|
77859
|
+
// }
|
|
77860
|
+
// ]);
|
|
77861
|
+
// this.currentRequestComplete = [];
|
|
77862
|
+
// while (await results.hasNext()) {
|
|
77863
|
+
// let result = await results.next();
|
|
77864
|
+
// this.currentRequestComplete.push({
|
|
77865
|
+
// eventName: result["_id"],
|
|
77866
|
+
// results: result.results,
|
|
77867
|
+
// });
|
|
77868
|
+
// }
|
|
77869
|
+
// }
|
|
77246
77870
|
{
|
|
77247
77871
|
let stats = yield this.gnServer.getDatabase().getDb().stats();
|
|
77248
77872
|
if (stats.ok == 1) {
|
|
@@ -77256,6 +77880,101 @@ class AnalyticsService {
|
|
|
77256
77880
|
};
|
|
77257
77881
|
}
|
|
77258
77882
|
}
|
|
77883
|
+
{
|
|
77884
|
+
let eventCallbackPostCollection = this.gnServer.getDatabase().systemCollection("EventCallback.Post");
|
|
77885
|
+
let now = xDatetime_1.xDatetime.getCurrentDate();
|
|
77886
|
+
let month0h = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
77887
|
+
let results = yield eventCallbackPostCollection.find({ _id: { $gt: mongoDB.ObjectId.createFromTime(month0h.getTime() / 1000 - 1) } });
|
|
77888
|
+
this.currentCost = {
|
|
77889
|
+
requestCount: 0,
|
|
77890
|
+
matchmakingRequestCount: 0,
|
|
77891
|
+
cloudScriptGBs: 0,
|
|
77892
|
+
storageSizeInBytes: (_b = (_a = this.currentDatabaseSystem) === null || _a === void 0 ? void 0 : _a.totalSizeInBytes) !== null && _b !== void 0 ? _b : 0,
|
|
77893
|
+
dataTransferSizeInBytes: 0,
|
|
77894
|
+
};
|
|
77895
|
+
this.currentMonthlyCost = {
|
|
77896
|
+
requestCount: 0,
|
|
77897
|
+
matchmakingRequestCount: 0,
|
|
77898
|
+
cloudScriptGBs: 0,
|
|
77899
|
+
storageSizeInBytes: (_d = (_c = this.currentDatabaseSystem) === null || _c === void 0 ? void 0 : _c.totalSizeInBytes) !== null && _d !== void 0 ? _d : 0,
|
|
77900
|
+
dataTransferSizeInBytes: 0,
|
|
77901
|
+
};
|
|
77902
|
+
this.currentRequestComplete = [];
|
|
77903
|
+
while (yield results.hasNext()) {
|
|
77904
|
+
let result = yield results.next();
|
|
77905
|
+
let tsCreate = result["tsCreate"];
|
|
77906
|
+
let eventName = result["eventName"];
|
|
77907
|
+
let operationResponse = result["operationResponse"];
|
|
77908
|
+
if (tsCreate > millisecondsAt15MinutesAgo) {
|
|
77909
|
+
let thisCurrentRequestComplete = this.currentRequestComplete.find(x => x.eventName == eventName);
|
|
77910
|
+
if (thisCurrentRequestComplete == null) {
|
|
77911
|
+
thisCurrentRequestComplete = {
|
|
77912
|
+
eventName: eventName,
|
|
77913
|
+
results: [],
|
|
77914
|
+
};
|
|
77915
|
+
this.currentRequestComplete.push(thisCurrentRequestComplete);
|
|
77916
|
+
}
|
|
77917
|
+
let errorCode = (_e = operationResponse === null || operationResponse === void 0 ? void 0 : operationResponse.parameters) === null || _e === void 0 ? void 0 : _e.E;
|
|
77918
|
+
if (errorCode) {
|
|
77919
|
+
let thisCurrentRequestCompleteErrorCode = thisCurrentRequestComplete.results.find(x => x.errorCode == errorCode);
|
|
77920
|
+
if (thisCurrentRequestCompleteErrorCode == null) {
|
|
77921
|
+
thisCurrentRequestCompleteErrorCode = {
|
|
77922
|
+
errorCode: errorCode,
|
|
77923
|
+
count: 0,
|
|
77924
|
+
};
|
|
77925
|
+
thisCurrentRequestComplete.results.push(thisCurrentRequestCompleteErrorCode);
|
|
77926
|
+
}
|
|
77927
|
+
thisCurrentRequestCompleteErrorCode.count += 1;
|
|
77928
|
+
}
|
|
77929
|
+
if (!eventName.startsWith("dashboard_")) {
|
|
77930
|
+
if (!eventName.startsWith("system_")) {
|
|
77931
|
+
this.currentCost.requestCount += 1;
|
|
77932
|
+
this.currentMonthlyCost.requestCount += 1;
|
|
77933
|
+
if (eventName.startsWith("multiplayer_")) {
|
|
77934
|
+
this.currentCost.matchmakingRequestCount += 1;
|
|
77935
|
+
this.currentMonthlyCost.matchmakingRequestCount += 1;
|
|
77936
|
+
}
|
|
77937
|
+
else if (eventName.startsWith("cloudScript_")) {
|
|
77938
|
+
let parameters = operationResponse === null || operationResponse === void 0 ? void 0 : operationResponse.parameters;
|
|
77939
|
+
if (parameters) {
|
|
77940
|
+
let executionTimeInMs = parameters.executionTimeInMs;
|
|
77941
|
+
let memoryUsedInBytes = parameters.memoryUsedInBytes;
|
|
77942
|
+
if (executionTimeInMs != null && memoryUsedInBytes != null) {
|
|
77943
|
+
let cloudScriptGBs = (executionTimeInMs / 1000) * (memoryUsedInBytes / 1024 / 1024 / 1024);
|
|
77944
|
+
this.currentCost.cloudScriptGBs += cloudScriptGBs;
|
|
77945
|
+
this.currentMonthlyCost.cloudScriptGBs += cloudScriptGBs;
|
|
77946
|
+
}
|
|
77947
|
+
}
|
|
77948
|
+
}
|
|
77949
|
+
}
|
|
77950
|
+
this.currentCost.dataTransferSizeInBytes += (_f = result.responseSize) !== null && _f !== void 0 ? _f : 0;
|
|
77951
|
+
this.currentMonthlyCost.dataTransferSizeInBytes += (_g = result.responseSize) !== null && _g !== void 0 ? _g : 0;
|
|
77952
|
+
}
|
|
77953
|
+
}
|
|
77954
|
+
else {
|
|
77955
|
+
if (!eventName.startsWith("dashboard_")) {
|
|
77956
|
+
if (!eventName.startsWith("system_")) {
|
|
77957
|
+
this.currentMonthlyCost.requestCount += 1;
|
|
77958
|
+
if (eventName.startsWith("multiplayer_")) {
|
|
77959
|
+
this.currentMonthlyCost.matchmakingRequestCount += 1;
|
|
77960
|
+
}
|
|
77961
|
+
else if (eventName.startsWith("cloudScript_")) {
|
|
77962
|
+
let parameters = operationResponse === null || operationResponse === void 0 ? void 0 : operationResponse.parameters;
|
|
77963
|
+
if (parameters) {
|
|
77964
|
+
let executionTimeInMs = parameters.executionTimeInMs;
|
|
77965
|
+
let memoryUsedInBytes = parameters.memoryUsedInBytes;
|
|
77966
|
+
if (executionTimeInMs != null && memoryUsedInBytes != null) {
|
|
77967
|
+
let cloudScriptGBs = (executionTimeInMs / 1000) * (memoryUsedInBytes / 1024 / 1024 / 1024);
|
|
77968
|
+
this.currentMonthlyCost.cloudScriptGBs += cloudScriptGBs;
|
|
77969
|
+
}
|
|
77970
|
+
}
|
|
77971
|
+
}
|
|
77972
|
+
}
|
|
77973
|
+
this.currentMonthlyCost.dataTransferSizeInBytes += (_h = result.responseSize) !== null && _h !== void 0 ? _h : 0;
|
|
77974
|
+
}
|
|
77975
|
+
}
|
|
77976
|
+
}
|
|
77977
|
+
}
|
|
77259
77978
|
});
|
|
77260
77979
|
}
|
|
77261
77980
|
saveAnalytics() {
|
|
@@ -77284,6 +78003,8 @@ class AnalyticsService {
|
|
|
77284
78003
|
operationSystem: this.currentOperationSystem,
|
|
77285
78004
|
requestComplete: this.currentRequestComplete,
|
|
77286
78005
|
databaseSystem: this.currentDatabaseSystem,
|
|
78006
|
+
cost: this.currentCost,
|
|
78007
|
+
monthlyCost: this.currentMonthlyCost,
|
|
77287
78008
|
tsCreate: currentDate.getTime()
|
|
77288
78009
|
});
|
|
77289
78010
|
});
|
|
@@ -78056,6 +78777,7 @@ var EventCallbackType;
|
|
|
78056
78777
|
EventCallbackType[EventCallbackType["Pre"] = 0] = "Pre";
|
|
78057
78778
|
EventCallbackType[EventCallbackType["Post"] = 1] = "Post";
|
|
78058
78779
|
EventCallbackType[EventCallbackType["System"] = 2] = "System";
|
|
78780
|
+
EventCallbackType[EventCallbackType["Event"] = 3] = "Event";
|
|
78059
78781
|
})(EventCallbackType || (EventCallbackType = {}));
|
|
78060
78782
|
var CloudScriptEventType;
|
|
78061
78783
|
(function (CloudScriptEventType) {
|
|
@@ -78252,6 +78974,76 @@ class EventCallbackCloudScriptService {
|
|
|
78252
78974
|
};
|
|
78253
78975
|
});
|
|
78254
78976
|
}
|
|
78977
|
+
executeEvent(eventName, request, operationEvent) {
|
|
78978
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78979
|
+
let cloudFunction = this.cloudScriptFunctionDict.get("system");
|
|
78980
|
+
if (cloudFunction == null) {
|
|
78981
|
+
xDebug_1.Debug.logError("[GN] [SystemEventCallback] system not found");
|
|
78982
|
+
return;
|
|
78983
|
+
}
|
|
78984
|
+
let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(cloudFunction.type, eventName);
|
|
78985
|
+
if (cloudScriptWorker == null) {
|
|
78986
|
+
xDebug_1.Debug.logError("[GN] [SystemEventCallback] worker not found at " + cloudFunction.type);
|
|
78987
|
+
return;
|
|
78988
|
+
}
|
|
78989
|
+
let requestId = StringUtility_1.StringUtility.generateRandomString(10, 0);
|
|
78990
|
+
let cloudScriptRequest = {
|
|
78991
|
+
requestId: requestId,
|
|
78992
|
+
eventName: eventName,
|
|
78993
|
+
eventType: EventCallbackType.Event,
|
|
78994
|
+
operationRequest: {
|
|
78995
|
+
operationCode: operationEvent.getEventCode(),
|
|
78996
|
+
encrypted: operationEvent.isEncrypted(),
|
|
78997
|
+
parameters: operationEvent.getParameters(),
|
|
78998
|
+
requestId: 0,
|
|
78999
|
+
},
|
|
79000
|
+
request: request,
|
|
79001
|
+
secretInfo: null,
|
|
79002
|
+
};
|
|
79003
|
+
cloudScriptWorker.postMessage(cloudScriptRequest);
|
|
79004
|
+
let thiz = this;
|
|
79005
|
+
let isResolved = false;
|
|
79006
|
+
let cloudScriptResponse = yield new Promise((resolve) => {
|
|
79007
|
+
let timeout = setTimeout(() => {
|
|
79008
|
+
if (isResolved)
|
|
79009
|
+
return;
|
|
79010
|
+
isResolved = true;
|
|
79011
|
+
resolve({
|
|
79012
|
+
responseId: requestId,
|
|
79013
|
+
response: {
|
|
79014
|
+
status: ICloudScriptService_1.ExecuteResponseStatus.Timeout,
|
|
79015
|
+
errorMessage: "function execute timeout",
|
|
79016
|
+
result: null,
|
|
79017
|
+
request: null,
|
|
79018
|
+
},
|
|
79019
|
+
stats: null,
|
|
79020
|
+
logs: [],
|
|
79021
|
+
});
|
|
79022
|
+
}, EventCallbackCloudScriptService.SystemExecuteTimeoutInMs);
|
|
79023
|
+
thiz.cloudScriptWaitingResponseCallbackDict.set(requestId, (cloudScriptResponse) => {
|
|
79024
|
+
if (isResolved)
|
|
79025
|
+
return;
|
|
79026
|
+
isResolved = true;
|
|
79027
|
+
clearTimeout(timeout);
|
|
79028
|
+
resolve(cloudScriptResponse);
|
|
79029
|
+
});
|
|
79030
|
+
});
|
|
79031
|
+
this.cloudScriptWaitingResponseCallbackDict.delete(requestId);
|
|
79032
|
+
if (cloudScriptResponse.logs.length != 0)
|
|
79033
|
+
xDebug_1.Debug.log(JSON.stringify(cloudScriptResponse.logs));
|
|
79034
|
+
if (cloudScriptResponse.response.status == ICloudScriptService_1.ExecuteResponseStatus.Ok) {
|
|
79035
|
+
operationEvent.setParameters(cloudScriptResponse.response.result.parameters ? GNData_1.GNHashtable.builder().addAll(cloudScriptResponse.response.result.parameters).build() : null);
|
|
79036
|
+
operationEvent.setEncrypted(cloudScriptResponse.response.result.encrypted);
|
|
79037
|
+
operationEvent.eventCode = cloudScriptResponse.response.result.returnCode;
|
|
79038
|
+
if (cloudScriptResponse.response.request.userId)
|
|
79039
|
+
request.userId = cloudScriptResponse.response.request.userId;
|
|
79040
|
+
if (cloudScriptResponse.response.request.userIds)
|
|
79041
|
+
request.userIds = cloudScriptResponse.response.request.userIds;
|
|
79042
|
+
if (cloudScriptResponse.response.request.roomId)
|
|
79043
|
+
request.roomId = cloudScriptResponse.response.request.roomId;
|
|
79044
|
+
}
|
|
79045
|
+
});
|
|
79046
|
+
}
|
|
78255
79047
|
executePre(eventName, request, secretInfo, operationRequest) {
|
|
78256
79048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78257
79049
|
var _a;
|
|
@@ -78646,14 +79438,16 @@ class PostEventCallbackService {
|
|
|
78646
79438
|
if (this.cloudScriptService) {
|
|
78647
79439
|
this.cloudScriptService.executePost(eventName, request, secretInfo, operationRequest, operationResponse);
|
|
78648
79440
|
}
|
|
79441
|
+
let operationResponseToData = OperationHelper_1.OperationHelper.toDataOperationResponse(operationResponse);
|
|
78649
79442
|
this.eventCallbackCollection.insertOne({
|
|
78650
79443
|
eventName: eventName,
|
|
78651
79444
|
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
78652
79445
|
request: request,
|
|
78653
79446
|
operationRequest: OperationHelper_1.OperationHelper.toDataOperationRequest(operationRequest),
|
|
78654
79447
|
originRequest: OperationHelper_1.OperationHelper.toDataFromRequest(operationRequest.originRequest),
|
|
78655
|
-
operationResponse:
|
|
79448
|
+
operationResponse: operationResponseToData,
|
|
78656
79449
|
customTags: operationRequest.getParameters().getGNHashtable("CustomTags"),
|
|
79450
|
+
responseSize: Buffer.byteLength(JSON.stringify(operationResponseToData), "utf-8"),
|
|
78657
79451
|
});
|
|
78658
79452
|
if (!this.eventLstDict.has(eventName)) {
|
|
78659
79453
|
return;
|
|
@@ -80808,12 +81602,13 @@ exports.RequestConverterService = RequestConverterService;
|
|
|
80808
81602
|
|
|
80809
81603
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80810
81604
|
exports.TimerService = void 0;
|
|
81605
|
+
const xDatetime_1 = __webpack_require__(21817);
|
|
80811
81606
|
const xDebug_1 = __webpack_require__(32501);
|
|
80812
81607
|
class TimerService {
|
|
80813
81608
|
run() {
|
|
80814
81609
|
setInterval(() => {
|
|
80815
81610
|
this.onEverySecond();
|
|
80816
|
-
let now =
|
|
81611
|
+
let now = xDatetime_1.xDatetime.getCurrentDate();
|
|
80817
81612
|
if (now.getSeconds() == 0) {
|
|
80818
81613
|
this.onEveryMinute();
|
|
80819
81614
|
if (now.getMinutes() == 0) {
|
|
@@ -81522,8 +82317,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
81522
82317
|
exports.ItemType = void 0;
|
|
81523
82318
|
var ItemType;
|
|
81524
82319
|
(function (ItemType) {
|
|
81525
|
-
ItemType[ItemType["
|
|
81526
|
-
ItemType[ItemType["
|
|
82320
|
+
ItemType[ItemType["NonStackable"] = 1] = "NonStackable";
|
|
82321
|
+
ItemType[ItemType["Stackable"] = 2] = "Stackable";
|
|
81527
82322
|
})(ItemType || (exports.ItemType = ItemType = {}));
|
|
81528
82323
|
|
|
81529
82324
|
|
|
@@ -81699,7 +82494,7 @@ GNErrorCode.GamePlayerNotFound = 17;
|
|
|
81699
82494
|
GNErrorCode.FileNotFound = 18;
|
|
81700
82495
|
GNErrorCode.FileNotUpload = 19;
|
|
81701
82496
|
GNErrorCode.OwnerTypeNotSupport = 20;
|
|
81702
|
-
GNErrorCode.
|
|
82497
|
+
GNErrorCode.ItemNotStackable = 21;
|
|
81703
82498
|
GNErrorCode.GameNotFound = 22;
|
|
81704
82499
|
GNErrorCode.GameIsExists = 23;
|
|
81705
82500
|
GNErrorCode.SecretInfoNotFound = 24;
|
|
@@ -82320,6 +83115,13 @@ GNParameterCode.Collections = "collections";
|
|
|
82320
83115
|
GNParameterCode.Objects = "objects";
|
|
82321
83116
|
GNParameterCode.Indexes = "indexes";
|
|
82322
83117
|
GNParameterCode.DatabaseSystem = "databaseSystem";
|
|
83118
|
+
GNParameterCode.Cost = "cost";
|
|
83119
|
+
GNParameterCode.MonthlyCost = "monthlyCost";
|
|
83120
|
+
GNParameterCode.RequestCount = "requestCount";
|
|
83121
|
+
GNParameterCode.MatchmakingRequestCount = "matchmakingRequestCount";
|
|
83122
|
+
GNParameterCode.CloudScriptGBs = "cloudScriptGBs";
|
|
83123
|
+
GNParameterCode.StorageSizeInBytes = "storageSizeInBytes";
|
|
83124
|
+
GNParameterCode.DataTransferSizeInBytes = "dataTransferSizeInBytes";
|
|
82323
83125
|
|
|
82324
83126
|
|
|
82325
83127
|
/***/ }),
|
|
@@ -83655,6 +84457,18 @@ class xCacheData {
|
|
|
83655
84457
|
return false;
|
|
83656
84458
|
return true;
|
|
83657
84459
|
}
|
|
84460
|
+
removeInvalidData() {
|
|
84461
|
+
let removeCount = 0;
|
|
84462
|
+
let keys = this.dataDic.keys();
|
|
84463
|
+
for (let key in keys) {
|
|
84464
|
+
let cacheItem = this.dataDic.get(key);
|
|
84465
|
+
if (cacheItem == null || cacheItem.isExpired()) {
|
|
84466
|
+
this.dataDic.delete(key);
|
|
84467
|
+
removeCount++;
|
|
84468
|
+
}
|
|
84469
|
+
}
|
|
84470
|
+
return removeCount;
|
|
84471
|
+
}
|
|
83658
84472
|
constructor() {
|
|
83659
84473
|
this.dataDic = new Map();
|
|
83660
84474
|
}
|
|
@@ -86114,9 +86928,9 @@ class xDatabase {
|
|
|
86114
86928
|
loadMasterPlayersWithGenericServiceAsync(genericService, genericIds, masterPlayerFindOptions) {
|
|
86115
86929
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86116
86930
|
let collection = this.systemCollection("MasterPlayer");
|
|
86117
|
-
let filter = {};
|
|
86118
|
-
filter["external.genericService.genericServices." + genericService] = { $in: { "genericId": genericIds } };
|
|
86119
|
-
let results = yield collection.find(filter, {
|
|
86931
|
+
let $filter = {};
|
|
86932
|
+
$filter["external.genericService.genericServices." + genericService] = { $in: { "genericId": genericIds } };
|
|
86933
|
+
let results = yield collection.find($filter, {
|
|
86120
86934
|
projection: this.getFindOptions(masterPlayerFindOptions)
|
|
86121
86935
|
});
|
|
86122
86936
|
return this.convertToMasterPlayers(results, collection);
|
|
@@ -86237,14 +87051,14 @@ class xDatabase {
|
|
|
86237
87051
|
score = playerStatistics.value;
|
|
86238
87052
|
tsLastUpdate = playerStatistics.tsLastUpdate;
|
|
86239
87053
|
}
|
|
86240
|
-
let filter = {};
|
|
87054
|
+
let $filter = {};
|
|
86241
87055
|
if (direction == -1) {
|
|
86242
87056
|
let condition1 = {};
|
|
86243
87057
|
let condition2 = {};
|
|
86244
87058
|
condition1["playerStatistics." + key + ".value"] = { $gt: score };
|
|
86245
87059
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86246
87060
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86247
|
-
filter.$or = [condition1, condition2];
|
|
87061
|
+
$filter.$or = [condition1, condition2];
|
|
86248
87062
|
}
|
|
86249
87063
|
else {
|
|
86250
87064
|
let condition1 = {};
|
|
@@ -86252,9 +87066,9 @@ class xDatabase {
|
|
|
86252
87066
|
condition1["playerStatistics." + key + ".value"] = { $lt: score };
|
|
86253
87067
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86254
87068
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86255
|
-
filter.$or = [condition1, condition2];
|
|
87069
|
+
$filter.$or = [condition1, condition2];
|
|
86256
87070
|
}
|
|
86257
|
-
return yield collection.countDocuments(filter);
|
|
87071
|
+
return yield collection.countDocuments($filter);
|
|
86258
87072
|
});
|
|
86259
87073
|
}
|
|
86260
87074
|
loadPositionMasterPlayerLeaderboardWithCurrencies(key, userId) {
|
|
@@ -86271,13 +87085,13 @@ class xDatabase {
|
|
|
86271
87085
|
if (playerCurrencies != null) {
|
|
86272
87086
|
score = playerCurrencies.value;
|
|
86273
87087
|
}
|
|
86274
|
-
let filter = {};
|
|
86275
|
-
filter["playerCurrencies." + key] = {
|
|
87088
|
+
let $filter = {};
|
|
87089
|
+
$filter["playerCurrencies." + key] = {
|
|
86276
87090
|
$gt: {
|
|
86277
87091
|
value: score,
|
|
86278
87092
|
}
|
|
86279
87093
|
};
|
|
86280
|
-
return yield collection.countDocuments(filter);
|
|
87094
|
+
return yield collection.countDocuments($filter);
|
|
86281
87095
|
});
|
|
86282
87096
|
}
|
|
86283
87097
|
loadMasterPlayerAsync(userId, masterPlayerFindOptions) {
|
|
@@ -86476,9 +87290,9 @@ class xDatabase {
|
|
|
86476
87290
|
loadMasterPlayerByGenericServiceAsync(serviceName, serviceId, masterPlayerFindOptions) {
|
|
86477
87291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86478
87292
|
let collection = this.systemCollection("MasterPlayer");
|
|
86479
|
-
let filter = {};
|
|
86480
|
-
filter["external.genericService.genericServices." + serviceName + ".serviceId"] = serviceId;
|
|
86481
|
-
let result = yield collection.findOne(filter, {
|
|
87293
|
+
let $filter = {};
|
|
87294
|
+
$filter["external.genericService.genericServices." + serviceName + ".serviceId"] = serviceId;
|
|
87295
|
+
let result = yield collection.findOne($filter, {
|
|
86482
87296
|
projection: this.getFindOptions(masterPlayerFindOptions)
|
|
86483
87297
|
});
|
|
86484
87298
|
if (result) {
|
|
@@ -86632,14 +87446,14 @@ class xDatabase {
|
|
|
86632
87446
|
score = playerStatistics.value;
|
|
86633
87447
|
tsLastUpdate = playerStatistics.tsLastUpdate;
|
|
86634
87448
|
}
|
|
86635
|
-
let filter = {};
|
|
87449
|
+
let $filter = {};
|
|
86636
87450
|
if (direction == -1) {
|
|
86637
87451
|
let condition1 = {};
|
|
86638
87452
|
let condition2 = {};
|
|
86639
87453
|
condition1["playerStatistics." + key + ".value"] = { $gt: score };
|
|
86640
87454
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86641
87455
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86642
|
-
filter.$or = [condition1, condition2];
|
|
87456
|
+
$filter.$or = [condition1, condition2];
|
|
86643
87457
|
}
|
|
86644
87458
|
else {
|
|
86645
87459
|
let condition1 = {};
|
|
@@ -86647,9 +87461,9 @@ class xDatabase {
|
|
|
86647
87461
|
condition1["playerStatistics." + key + ".value"] = { $lt: score };
|
|
86648
87462
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86649
87463
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86650
|
-
filter.$or = [condition1, condition2];
|
|
87464
|
+
$filter.$or = [condition1, condition2];
|
|
86651
87465
|
}
|
|
86652
|
-
return yield collection.countDocuments(filter);
|
|
87466
|
+
return yield collection.countDocuments($filter);
|
|
86653
87467
|
});
|
|
86654
87468
|
}
|
|
86655
87469
|
loadPositionGamePlayerLeaderboardWithCurrenciesAsync(key, userId, gameId) {
|
|
@@ -86666,13 +87480,13 @@ class xDatabase {
|
|
|
86666
87480
|
if (playerCurrencies != null) {
|
|
86667
87481
|
score = playerCurrencies.value;
|
|
86668
87482
|
}
|
|
86669
|
-
let filter = {};
|
|
86670
|
-
filter["playerCurrencies." + key] = {
|
|
87483
|
+
let $filter = {};
|
|
87484
|
+
$filter["playerCurrencies." + key] = {
|
|
86671
87485
|
$gt: {
|
|
86672
87486
|
value: score,
|
|
86673
87487
|
}
|
|
86674
87488
|
};
|
|
86675
|
-
return yield collection.countDocuments(filter);
|
|
87489
|
+
return yield collection.countDocuments($filter);
|
|
86676
87490
|
});
|
|
86677
87491
|
}
|
|
86678
87492
|
loadGamePlayerAsync(userId, gameId, gamePlayerFindOptions) {
|
|
@@ -86824,23 +87638,29 @@ class xDatabase {
|
|
|
86824
87638
|
return this.convertToCharacterPlayers(results, collection);
|
|
86825
87639
|
});
|
|
86826
87640
|
}
|
|
86827
|
-
loadCharacterPlayersLeaderboardWithStatisticsAsync(key, skip, limit, gameId, direction, characterPlayerFindOptions) {
|
|
87641
|
+
loadCharacterPlayersLeaderboardWithStatisticsAsync(key, skip, limit, catalogId, gameId, direction, characterPlayerFindOptions) {
|
|
86828
87642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86829
87643
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86830
87644
|
let $sort = {};
|
|
86831
87645
|
$sort["playerStatistics." + key + ".value"] = direction;
|
|
86832
87646
|
$sort["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
86833
|
-
let
|
|
87647
|
+
let $filter = {};
|
|
87648
|
+
if (catalogId) {
|
|
87649
|
+
$filter["catalogId"] = catalogId;
|
|
87650
|
+
}
|
|
87651
|
+
let results = yield collection.find($filter, {
|
|
86834
87652
|
projection: this.getFindOptions(characterPlayerFindOptions)
|
|
86835
87653
|
}).sort($sort).skip(skip).limit(limit);
|
|
86836
87654
|
return this.convertToCharacterPlayers(results, collection);
|
|
86837
87655
|
});
|
|
86838
87656
|
}
|
|
86839
|
-
loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key, gameId, direction, characterPlayerFindOptions) {
|
|
87657
|
+
loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key, catalogId, gameId, direction, characterPlayerFindOptions) {
|
|
86840
87658
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86841
87659
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86842
87660
|
let $filter = {};
|
|
86843
87661
|
$filter["playerStatistics." + key + ".value"] = { $ne: null };
|
|
87662
|
+
if (catalogId)
|
|
87663
|
+
$filter["catalogId"] = catalogId;
|
|
86844
87664
|
let $sort = {};
|
|
86845
87665
|
$sort["playerStatistics." + key + ".value"] = direction;
|
|
86846
87666
|
$sort["playerStatistics." + key + ".tsLastUpdate"] = 1;
|
|
@@ -86861,26 +87681,33 @@ class xDatabase {
|
|
|
86861
87681
|
return this.convertToCharacterPlayers(results, collection);
|
|
86862
87682
|
});
|
|
86863
87683
|
}
|
|
86864
|
-
loadCharacterPlayersLeaderboardWithCurrenciesAsync(key, skip, limit, gameId, characterPlayerFindOptions) {
|
|
87684
|
+
loadCharacterPlayersLeaderboardWithCurrenciesAsync(key, skip, limit, catalogId, gameId, characterPlayerFindOptions) {
|
|
86865
87685
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86866
87686
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86867
87687
|
let $sort = {};
|
|
86868
87688
|
$sort["playerCurrencies." + key + ".value"] = -1;
|
|
86869
|
-
let
|
|
87689
|
+
let $filter = {};
|
|
87690
|
+
if (catalogId) {
|
|
87691
|
+
$filter["catalogId"] = catalogId;
|
|
87692
|
+
}
|
|
87693
|
+
let results = yield collection.find($filter, {
|
|
86870
87694
|
projection: this.getFindOptions(characterPlayerFindOptions)
|
|
86871
87695
|
}).sort($sort).skip(skip).limit(limit);
|
|
86872
87696
|
return this.convertToCharacterPlayers(results, collection);
|
|
86873
87697
|
});
|
|
86874
87698
|
}
|
|
86875
|
-
loadPositionCharacterPlayerLeaderboardWithStatisticsAsync(key,
|
|
87699
|
+
loadPositionCharacterPlayerLeaderboardWithStatisticsAsync(key, characterId, catalogId, gameId, initialValue, direction) {
|
|
86876
87700
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86877
87701
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86878
87702
|
let characterPlayerFindOptions = {
|
|
86879
|
-
|
|
87703
|
+
catalogId: true,
|
|
87704
|
+
playerStatistics: true,
|
|
86880
87705
|
};
|
|
86881
|
-
let thisPlayer = yield this.loadCharacterPlayerAsync(
|
|
87706
|
+
let thisPlayer = yield this.loadCharacterPlayerAsync(characterId, gameId, characterPlayerFindOptions);
|
|
86882
87707
|
if (thisPlayer == null)
|
|
86883
87708
|
return -1;
|
|
87709
|
+
if (catalogId && thisPlayer.getCatalogId() != catalogId)
|
|
87710
|
+
return -1;
|
|
86884
87711
|
let score = initialValue;
|
|
86885
87712
|
let tsLastUpdate = xDatetime_1.xDatetime.getCurrentMilliseconds();
|
|
86886
87713
|
let playerStatistics = thisPlayer.getPlayerStatistics(key);
|
|
@@ -86888,14 +87715,17 @@ class xDatabase {
|
|
|
86888
87715
|
score = playerStatistics.value;
|
|
86889
87716
|
tsLastUpdate = playerStatistics.tsLastUpdate;
|
|
86890
87717
|
}
|
|
86891
|
-
let filter = {};
|
|
87718
|
+
let $filter = {};
|
|
87719
|
+
if (catalogId) {
|
|
87720
|
+
$filter["catalogId"] = catalogId;
|
|
87721
|
+
}
|
|
86892
87722
|
if (direction == -1) {
|
|
86893
87723
|
let condition1 = {};
|
|
86894
87724
|
let condition2 = {};
|
|
86895
87725
|
condition1["playerStatistics." + key + ".value"] = { $gt: score };
|
|
86896
87726
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86897
87727
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86898
|
-
filter.$or = [condition1, condition2];
|
|
87728
|
+
$filter.$or = [condition1, condition2];
|
|
86899
87729
|
}
|
|
86900
87730
|
else {
|
|
86901
87731
|
let condition1 = {};
|
|
@@ -86903,38 +87733,41 @@ class xDatabase {
|
|
|
86903
87733
|
condition1["playerStatistics." + key + ".value"] = { $lt: score };
|
|
86904
87734
|
condition2["playerStatistics." + key + ".value"] = score;
|
|
86905
87735
|
condition2["playerStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
86906
|
-
filter.$or = [condition1, condition2];
|
|
87736
|
+
$filter.$or = [condition1, condition2];
|
|
86907
87737
|
}
|
|
86908
|
-
return yield collection.countDocuments(filter);
|
|
87738
|
+
return yield collection.countDocuments($filter);
|
|
86909
87739
|
});
|
|
86910
87740
|
}
|
|
86911
|
-
loadPositionCharacterPlayerLeaderboardWithCurrenciesAsync(key, userId, gameId) {
|
|
87741
|
+
loadPositionCharacterPlayerLeaderboardWithCurrenciesAsync(key, userId, catalogId, gameId) {
|
|
86912
87742
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86913
87743
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86914
87744
|
let characterPlayerFindOptions = {
|
|
86915
|
-
playerCurrencies: true
|
|
87745
|
+
playerCurrencies: true,
|
|
87746
|
+
catalogId: true,
|
|
86916
87747
|
};
|
|
86917
87748
|
let thisPlayer = yield this.loadCharacterPlayerAsync(userId, gameId, characterPlayerFindOptions);
|
|
86918
87749
|
if (thisPlayer == null)
|
|
86919
87750
|
return -1;
|
|
87751
|
+
if (catalogId && thisPlayer.getCatalogId() != catalogId)
|
|
87752
|
+
return -1;
|
|
86920
87753
|
let score = 0;
|
|
86921
87754
|
let playerCurrencies = thisPlayer.getPlayerCurrency(key);
|
|
86922
87755
|
if (playerCurrencies != null) {
|
|
86923
87756
|
score = playerCurrencies.value;
|
|
86924
87757
|
}
|
|
86925
|
-
let filter = {};
|
|
86926
|
-
filter["playerCurrencies." + key] = {
|
|
87758
|
+
let $filter = {};
|
|
87759
|
+
$filter["playerCurrencies." + key] = {
|
|
86927
87760
|
$gt: {
|
|
86928
87761
|
value: score,
|
|
86929
87762
|
}
|
|
86930
87763
|
};
|
|
86931
|
-
return yield collection.countDocuments(filter);
|
|
87764
|
+
return yield collection.countDocuments($filter);
|
|
86932
87765
|
});
|
|
86933
87766
|
}
|
|
86934
87767
|
loadFriendCharacterPlayersLeaderboardWithStatisticsAsync(friendIds, gameId, characterPlayerFindOptions) {
|
|
86935
87768
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86936
87769
|
let collection = this.systemGameCollection("CharacterPlayer", gameId);
|
|
86937
|
-
let results = yield collection.find({
|
|
87770
|
+
let results = yield collection.find({ characterId: { $in: friendIds } }, {
|
|
86938
87771
|
projection: this.getFindOptions(characterPlayerFindOptions)
|
|
86939
87772
|
});
|
|
86940
87773
|
let answer = [];
|
|
@@ -87075,23 +87908,28 @@ class xDatabase {
|
|
|
87075
87908
|
return this.convertToGroups(results, collection);
|
|
87076
87909
|
});
|
|
87077
87910
|
}
|
|
87078
|
-
loadGroupsLeaderboardWithStatisticsAsync(key, skip, limit, gameId, direction, groupFindOptions) {
|
|
87911
|
+
loadGroupsLeaderboardWithStatisticsAsync(key, skip, limit, catalogId, gameId, direction, groupFindOptions) {
|
|
87079
87912
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87080
87913
|
let collection = this.systemGameCollection("Group", gameId);
|
|
87081
87914
|
let $sort = {};
|
|
87082
87915
|
$sort["groupStatistics." + key + ".value"] = direction;
|
|
87083
87916
|
$sort["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
87084
|
-
let
|
|
87917
|
+
let $filter = {};
|
|
87918
|
+
if (catalogId)
|
|
87919
|
+
$filter["catalogId"] = catalogId;
|
|
87920
|
+
let results = yield collection.find($filter, {
|
|
87085
87921
|
projection: this.getFindOptions(groupFindOptions)
|
|
87086
87922
|
}).sort($sort).skip(skip).limit(limit);
|
|
87087
87923
|
return this.convertToGroups(results, collection);
|
|
87088
87924
|
});
|
|
87089
87925
|
}
|
|
87090
|
-
loadGroupsLeaderboardWithStatisticsAllAsync(key, gameId, direction, groupFindOptions) {
|
|
87926
|
+
loadGroupsLeaderboardWithStatisticsAllAsync(key, catalogId, gameId, direction, groupFindOptions) {
|
|
87091
87927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87092
87928
|
let collection = this.systemGameCollection("Group", gameId);
|
|
87093
87929
|
let $filter = {};
|
|
87094
87930
|
$filter["groupStatistics." + key + ".value"] = { $ne: null };
|
|
87931
|
+
if (catalogId)
|
|
87932
|
+
$filter["catalogId"] = catalogId;
|
|
87095
87933
|
let $sort = {};
|
|
87096
87934
|
$sort["groupStatistics." + key + ".value"] = direction;
|
|
87097
87935
|
$sort["groupStatistics." + key + ".tsLastUpdate"] = 1;
|
|
@@ -87112,26 +87950,32 @@ class xDatabase {
|
|
|
87112
87950
|
return this.convertToGroups(results, collection);
|
|
87113
87951
|
});
|
|
87114
87952
|
}
|
|
87115
|
-
loadGroupsLeaderboardWithCurrenciesAsync(key, skip, limit, gameId, groupFindOptions) {
|
|
87953
|
+
loadGroupsLeaderboardWithCurrenciesAsync(key, skip, limit, catalogId, gameId, groupFindOptions) {
|
|
87116
87954
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87117
87955
|
let collection = this.systemGameCollection("Group", gameId);
|
|
87118
87956
|
let $sort = {};
|
|
87119
87957
|
$sort["groupCurrencies." + key + ".value"] = -1;
|
|
87120
|
-
let
|
|
87958
|
+
let $filter = {};
|
|
87959
|
+
if (catalogId)
|
|
87960
|
+
$filter["catalogId"] = catalogId;
|
|
87961
|
+
let results = yield collection.find($filter, {
|
|
87121
87962
|
projection: this.getFindOptions(groupFindOptions)
|
|
87122
87963
|
}).sort($sort).skip(skip).limit(limit);
|
|
87123
87964
|
return this.convertToGroups(results, collection);
|
|
87124
87965
|
});
|
|
87125
87966
|
}
|
|
87126
|
-
loadPositionGroupLeaderboardWithStatisticsAsync(key, groupId, gameId, initialValue, direction) {
|
|
87967
|
+
loadPositionGroupLeaderboardWithStatisticsAsync(key, groupId, catalogId, gameId, initialValue, direction) {
|
|
87127
87968
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87128
87969
|
let collection = this.systemGameCollection("Group", gameId);
|
|
87129
87970
|
let groupFindOptions = {
|
|
87130
|
-
groupStatistics: true
|
|
87971
|
+
groupStatistics: true,
|
|
87972
|
+
catalogId: true,
|
|
87131
87973
|
};
|
|
87132
87974
|
let thisGroup = yield this.loadGroupAsync(groupId, gameId, groupFindOptions);
|
|
87133
87975
|
if (thisGroup == null)
|
|
87134
87976
|
return -1;
|
|
87977
|
+
if (catalogId && thisGroup.getCatalogId() != catalogId)
|
|
87978
|
+
return -1;
|
|
87135
87979
|
let score = initialValue;
|
|
87136
87980
|
let tsLastUpdate = xDatetime_1.xDatetime.getCurrentMilliseconds();
|
|
87137
87981
|
let groupStatistics = thisGroup.getGroupStatistics(key);
|
|
@@ -87139,14 +87983,16 @@ class xDatabase {
|
|
|
87139
87983
|
score = groupStatistics.value;
|
|
87140
87984
|
tsLastUpdate = groupStatistics.tsLastUpdate;
|
|
87141
87985
|
}
|
|
87142
|
-
let filter = {};
|
|
87986
|
+
let $filter = {};
|
|
87987
|
+
if (catalogId)
|
|
87988
|
+
$filter["catalogId"] = catalogId;
|
|
87143
87989
|
if (direction == -1) {
|
|
87144
87990
|
let condition1 = {};
|
|
87145
87991
|
let condition2 = {};
|
|
87146
87992
|
condition1["groupStatistics." + key + ".value"] = { $gt: score };
|
|
87147
87993
|
condition2["groupStatistics." + key + ".value"] = score;
|
|
87148
87994
|
condition2["groupStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
87149
|
-
filter.$or = [condition1, condition2];
|
|
87995
|
+
$filter.$or = [condition1, condition2];
|
|
87150
87996
|
}
|
|
87151
87997
|
else {
|
|
87152
87998
|
let condition1 = {};
|
|
@@ -87154,9 +88000,9 @@ class xDatabase {
|
|
|
87154
88000
|
condition1["groupStatistics." + key + ".value"] = { $lt: score };
|
|
87155
88001
|
condition2["groupStatistics." + key + ".value"] = score;
|
|
87156
88002
|
condition2["groupStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
87157
|
-
filter.$or = [condition1, condition2];
|
|
88003
|
+
$filter.$or = [condition1, condition2];
|
|
87158
88004
|
}
|
|
87159
|
-
return yield collection.countDocuments(filter);
|
|
88005
|
+
return yield collection.countDocuments($filter);
|
|
87160
88006
|
});
|
|
87161
88007
|
}
|
|
87162
88008
|
loadPositionGroupLeaderboardWithCurrenciesAsync(key, groupId, gameId) {
|
|
@@ -87173,13 +88019,13 @@ class xDatabase {
|
|
|
87173
88019
|
if (groupCurrency != null) {
|
|
87174
88020
|
score = groupCurrency.value;
|
|
87175
88021
|
}
|
|
87176
|
-
let filter = {};
|
|
87177
|
-
filter["groupCurrencies." + key] = {
|
|
88022
|
+
let $filter = {};
|
|
88023
|
+
$filter["groupCurrencies." + key] = {
|
|
87178
88024
|
$gt: {
|
|
87179
88025
|
value: score,
|
|
87180
88026
|
}
|
|
87181
88027
|
};
|
|
87182
|
-
return yield collection.countDocuments(filter);
|
|
88028
|
+
return yield collection.countDocuments($filter);
|
|
87183
88029
|
});
|
|
87184
88030
|
}
|
|
87185
88031
|
loadGroupAsync(groupId, gameId, groupFindOptions) {
|
|
@@ -87239,23 +88085,27 @@ class xDatabase {
|
|
|
87239
88085
|
return this.convertToInventories(results, collection);
|
|
87240
88086
|
});
|
|
87241
88087
|
}
|
|
87242
|
-
loadInventoriesLeaderboardWithStatisticsAsync(key, skip, limit, gameId, direction, inventoryFindOptions) {
|
|
88088
|
+
loadInventoriesLeaderboardWithStatisticsAsync(key, skip, limit, catalogId, gameId, direction, inventoryFindOptions) {
|
|
87243
88089
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87244
88090
|
let collection = this.systemGameCollection("Inventory", gameId);
|
|
87245
88091
|
let $sort = {};
|
|
87246
88092
|
$sort["itemStatistics." + key + ".value"] = direction;
|
|
87247
88093
|
$sort["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
87248
|
-
let
|
|
88094
|
+
let $filter = {};
|
|
88095
|
+
$filter["catalogId"] = catalogId;
|
|
88096
|
+
let results = yield collection.find($filter, {
|
|
87249
88097
|
projection: this.getFindOptions(inventoryFindOptions)
|
|
87250
88098
|
}).sort($sort).skip(skip).limit(limit);
|
|
87251
88099
|
return this.convertToInventories(results, collection);
|
|
87252
88100
|
});
|
|
87253
88101
|
}
|
|
87254
|
-
loadInventoriesLeaderboardWithStatisticsAllAsync(key, gameId, direction, inventoryFindOptions) {
|
|
88102
|
+
loadInventoriesLeaderboardWithStatisticsAllAsync(key, catalogId, gameId, direction, inventoryFindOptions) {
|
|
87255
88103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87256
88104
|
let collection = this.systemGameCollection("Inventory", gameId);
|
|
87257
88105
|
let $filter = {};
|
|
87258
88106
|
$filter["itemStatistics." + key + ".value"] = { $ne: null };
|
|
88107
|
+
if (catalogId)
|
|
88108
|
+
$filter["catalogId"] = catalogId;
|
|
87259
88109
|
let $sort = {};
|
|
87260
88110
|
$sort["itemStatistics." + key + ".value"] = direction;
|
|
87261
88111
|
$sort["itemStatistics." + key + ".tsLastUpdate"] = 1;
|
|
@@ -87276,15 +88126,18 @@ class xDatabase {
|
|
|
87276
88126
|
return this.convertToInventories(results, collection);
|
|
87277
88127
|
});
|
|
87278
88128
|
}
|
|
87279
|
-
loadPositionInventoryLeaderboardWithStatisticsAsync(key, itemId, gameId, initialValue, direction) {
|
|
88129
|
+
loadPositionInventoryLeaderboardWithStatisticsAsync(key, itemId, catalogId, gameId, initialValue, direction) {
|
|
87280
88130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87281
88131
|
let collection = this.systemGameCollection("Inventory", gameId);
|
|
87282
88132
|
let inventoryFindOptions = {
|
|
87283
|
-
itemStatistics: true
|
|
88133
|
+
itemStatistics: true,
|
|
88134
|
+
catalogId: true,
|
|
87284
88135
|
};
|
|
87285
88136
|
let thisInventory = yield this.loadInventoryAsync(itemId, gameId, inventoryFindOptions);
|
|
87286
88137
|
if (thisInventory == null)
|
|
87287
88138
|
return -1;
|
|
88139
|
+
if (catalogId && thisInventory.getCatalogId() != catalogId)
|
|
88140
|
+
return -1;
|
|
87288
88141
|
let score = initialValue;
|
|
87289
88142
|
let tsLastUpdate = xDatetime_1.xDatetime.getCurrentMilliseconds();
|
|
87290
88143
|
let itemStatistics = thisInventory.getItemStatistics(key);
|
|
@@ -87292,14 +88145,16 @@ class xDatabase {
|
|
|
87292
88145
|
score = itemStatistics.value;
|
|
87293
88146
|
tsLastUpdate = itemStatistics.tsLastUpdate;
|
|
87294
88147
|
}
|
|
87295
|
-
let filter = {};
|
|
88148
|
+
let $filter = {};
|
|
88149
|
+
if (catalogId)
|
|
88150
|
+
$filter["catalogId"] = catalogId;
|
|
87296
88151
|
if (direction == -1) {
|
|
87297
88152
|
let condition1 = {};
|
|
87298
88153
|
let condition2 = {};
|
|
87299
88154
|
condition1["itemStatistics." + key + ".value"] = { $gt: score };
|
|
87300
88155
|
condition2["itemStatistics." + key + ".value"] = score;
|
|
87301
88156
|
condition2["itemStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
87302
|
-
filter.$or = [condition1, condition2];
|
|
88157
|
+
$filter.$or = [condition1, condition2];
|
|
87303
88158
|
}
|
|
87304
88159
|
else {
|
|
87305
88160
|
let condition1 = {};
|
|
@@ -87307,9 +88162,9 @@ class xDatabase {
|
|
|
87307
88162
|
condition1["itemStatistics." + key + ".value"] = { $lt: score };
|
|
87308
88163
|
condition2["itemStatistics." + key + ".value"] = score;
|
|
87309
88164
|
condition2["itemStatistics." + key + ".tsLastUpdate"] = { $lt: tsLastUpdate };
|
|
87310
|
-
filter.$or = [condition1, condition2];
|
|
88165
|
+
$filter.$or = [condition1, condition2];
|
|
87311
88166
|
}
|
|
87312
|
-
return yield collection.countDocuments(filter);
|
|
88167
|
+
return yield collection.countDocuments($filter);
|
|
87313
88168
|
});
|
|
87314
88169
|
}
|
|
87315
88170
|
loadInventoryAsync(itemId, gameId, inventoryFindOptions) {
|
|
@@ -93197,9 +94052,14 @@ class GNServer {
|
|
|
93197
94052
|
let thiz = this;
|
|
93198
94053
|
this.timerService.subscriberEverySecond(() => {
|
|
93199
94054
|
let currentDate = xDatetime_1.xDatetime.getCurrentDate();
|
|
93200
|
-
if (currentDate.getSeconds() %
|
|
94055
|
+
if (currentDate.getSeconds() % 10 == 0)
|
|
93201
94056
|
thiz.handleMatchmaking();
|
|
93202
94057
|
});
|
|
94058
|
+
this.timerService.subscriberEveryMinute(() => {
|
|
94059
|
+
let currentDate = xDatetime_1.xDatetime.getCurrentDate();
|
|
94060
|
+
if (currentDate.getMinutes() % 10 == 0)
|
|
94061
|
+
thiz.xCacheData.removeInvalidData();
|
|
94062
|
+
});
|
|
93203
94063
|
}
|
|
93204
94064
|
init() {
|
|
93205
94065
|
{
|
|
@@ -93592,6 +94452,7 @@ class GNServer {
|
|
|
93592
94452
|
tempAnalyticsService.setGNServer(this);
|
|
93593
94453
|
tempAnalyticsService.run();
|
|
93594
94454
|
this.analyticsService = tempAnalyticsService;
|
|
94455
|
+
this.postEventCallbackCollection = this.xDatabase.systemCollection("EventCallback.Post");
|
|
93595
94456
|
if (onRunSuccess != null)
|
|
93596
94457
|
onRunSuccess();
|
|
93597
94458
|
}
|
|
@@ -93705,21 +94566,83 @@ class GNServer {
|
|
|
93705
94566
|
}
|
|
93706
94567
|
sendEventTo(userId, operationEvent) {
|
|
93707
94568
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94569
|
+
var _a;
|
|
94570
|
+
yield this.eventCallbackCloudScriptService.executeEvent("system_SendEventTo", { userId: userId }, operationEvent);
|
|
94571
|
+
let operationEventToData = {
|
|
94572
|
+
eventCode: operationEvent.getEventCode(),
|
|
94573
|
+
encrypted: operationEvent.isEncrypted(),
|
|
94574
|
+
parameters: (_a = operationEvent.getParameters()) === null || _a === void 0 ? void 0 : _a.toData()
|
|
94575
|
+
};
|
|
94576
|
+
this.postEventCallbackCollection.insertOne({
|
|
94577
|
+
eventName: "system_SendEventTo",
|
|
94578
|
+
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
94579
|
+
request: {
|
|
94580
|
+
userId: userId
|
|
94581
|
+
},
|
|
94582
|
+
operationEvent: operationEventToData,
|
|
94583
|
+
responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
|
|
94584
|
+
});
|
|
93708
94585
|
return yield this.socketApp.getSocketAppHandler().sendEventTo(userId, operationEvent);
|
|
93709
94586
|
});
|
|
93710
94587
|
}
|
|
93711
94588
|
sendEventToRoom(roomId, operationEvent) {
|
|
93712
94589
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94590
|
+
var _a;
|
|
94591
|
+
yield this.eventCallbackCloudScriptService.executeEvent("system_SendEventToRoom", { roomId: roomId }, operationEvent);
|
|
94592
|
+
let operationEventToData = {
|
|
94593
|
+
eventCode: operationEvent.getEventCode(),
|
|
94594
|
+
encrypted: operationEvent.isEncrypted(),
|
|
94595
|
+
parameters: (_a = operationEvent.getParameters()) === null || _a === void 0 ? void 0 : _a.toData()
|
|
94596
|
+
};
|
|
94597
|
+
this.postEventCallbackCollection.insertOne({
|
|
94598
|
+
eventName: "system_SendEventToRoom",
|
|
94599
|
+
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
94600
|
+
request: {
|
|
94601
|
+
roomId: roomId
|
|
94602
|
+
},
|
|
94603
|
+
operationEvent: operationEventToData,
|
|
94604
|
+
responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
|
|
94605
|
+
});
|
|
93713
94606
|
return yield this.socketApp.getSocketAppHandler().sendEventToRoom(roomId, operationEvent);
|
|
93714
94607
|
});
|
|
93715
94608
|
}
|
|
93716
94609
|
sendEventToMoreUser(userIds, operationEvent) {
|
|
93717
94610
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94611
|
+
var _a;
|
|
94612
|
+
yield this.eventCallbackCloudScriptService.executeEvent("system_SendEventToMoreUser", { userIds: userIds }, operationEvent);
|
|
94613
|
+
let operationEventToData = {
|
|
94614
|
+
eventCode: operationEvent.getEventCode(),
|
|
94615
|
+
encrypted: operationEvent.isEncrypted(),
|
|
94616
|
+
parameters: (_a = operationEvent.getParameters()) === null || _a === void 0 ? void 0 : _a.toData()
|
|
94617
|
+
};
|
|
94618
|
+
this.postEventCallbackCollection.insertOne({
|
|
94619
|
+
eventName: "system_SendEventToMoreUser",
|
|
94620
|
+
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
94621
|
+
request: {
|
|
94622
|
+
userIds: userIds
|
|
94623
|
+
},
|
|
94624
|
+
operationEvent: operationEventToData,
|
|
94625
|
+
responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8") * userIds.length,
|
|
94626
|
+
});
|
|
93718
94627
|
return yield this.socketApp.getSocketAppHandler().sendEventToMoreUser(userIds, operationEvent);
|
|
93719
94628
|
});
|
|
93720
94629
|
}
|
|
93721
94630
|
sendEventToAllPlayer(operationEvent) {
|
|
93722
94631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94632
|
+
var _a;
|
|
94633
|
+
yield this.eventCallbackCloudScriptService.executeEvent("system_SendEventToAllPlayer", {}, operationEvent);
|
|
94634
|
+
let operationEventToData = {
|
|
94635
|
+
eventCode: operationEvent.getEventCode(),
|
|
94636
|
+
encrypted: operationEvent.isEncrypted(),
|
|
94637
|
+
parameters: (_a = operationEvent.getParameters()) === null || _a === void 0 ? void 0 : _a.toData()
|
|
94638
|
+
};
|
|
94639
|
+
this.postEventCallbackCollection.insertOne({
|
|
94640
|
+
eventName: "system_SendEventToAllPlayer",
|
|
94641
|
+
tsCreate: xDatetime_1.xDatetime.getCurrentMilliseconds(),
|
|
94642
|
+
request: {},
|
|
94643
|
+
operationEvent: operationEventToData,
|
|
94644
|
+
responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
|
|
94645
|
+
});
|
|
93723
94646
|
return yield this.socketApp.getSocketAppHandler().sendEventToAllPlayer(operationEvent);
|
|
93724
94647
|
});
|
|
93725
94648
|
}
|