초기커밋
This commit is contained in:
116
GameServer/Contents/Shop/ShopCheat.cs
Normal file
116
GameServer/Contents/Shop/ShopCheat.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
[ChatCommandAttribute("storereset", typeof(ChatCommandStoreReset), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
||||
internal class ChatCommandStoreReset : ChatCommandBase
|
||||
{
|
||||
public override async Task invoke(Player player, string token, string[] args)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
Log.getLogger().info($"HandleStoreReset");
|
||||
var shop_action = player.getEntityAction<ShopAction>();
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var fn_transaction_runner = async delegate ()
|
||||
{
|
||||
var result = new Result();
|
||||
await shop_action.cheatInitResetTime();
|
||||
|
||||
var batch = new QueryBatchEx<QueryRunnerWithDocument>( player, LogActionType.CheatCommandShopProductInit
|
||||
, server_logic.getDynamoDbClient());
|
||||
{
|
||||
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
|
||||
}
|
||||
|
||||
result = await QueryHelper.sendQueryAndBusinessLog(batch);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to sendQueryAndBusinessLog() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
result = await player.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "Cheat.ShopProductInit", fn_transaction_runner);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[ChatCommandAttribute("storerenewal", typeof(ChatCommandStoreRenewal), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
||||
internal class ChatCommandStoreRenewal : ChatCommandBase
|
||||
{
|
||||
public override async Task invoke(Player player, string token, string[] args)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var shop_action = player.getEntityAction<ShopAction>();
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
int shop_id = 0;
|
||||
try
|
||||
{
|
||||
var arg = args[0];
|
||||
shop_id = int.Parse(args[0]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.getLogger().error($"storerenewal parameter parse error {e.StackTrace}");
|
||||
return;
|
||||
}
|
||||
|
||||
var fn_transaction_runner = async delegate ()
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
await shop_action.cheatInitShopRenewalCount(shop_id);
|
||||
|
||||
var batch = new QueryBatchEx<QueryRunnerWithDocument>(player, LogActionType.CheatCommandShopProductRenewal
|
||||
, server_logic.getDynamoDbClient());
|
||||
{
|
||||
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
|
||||
}
|
||||
|
||||
//로그 추가
|
||||
batch.appendBusinessLog(new CheatRenewalShopProductBusinessLog(shop_id));
|
||||
result = await QueryHelper.sendQueryAndBusinessLog(batch);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to sendQueryAndBusinessLog() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
result = await player.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "Cheat.ShopProductRenewal", fn_transaction_runner);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user