초기커밋
This commit is contained in:
109
GameServer/Contents/Quest/Action/RepeatQuestAction.cs
Normal file
109
GameServer/Contents/Quest/Action/RepeatQuestAction.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
using Amazon.DynamoDBv2.Model;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using ServerCommon;
|
||||
using ServerCore; using ServerBase;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class RepeatQuestAction : EntityActionBase
|
||||
{
|
||||
public RepeatQuestAction(EntityBase owner)
|
||||
: base(owner)
|
||||
{}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var result = new Result();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public Int32 isChecking()
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
var repeat_quest_attribute = player.getEntityAttribute<RepeatQuestAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(repeat_quest_attribute, () => $"repeat_quest_attribute is null !!!");
|
||||
|
||||
return repeat_quest_attribute.m_is_checking;
|
||||
}
|
||||
|
||||
public DateTime getNextAllocateTime()
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
var repeat_quest_attribute = player.getEntityAttribute<RepeatQuestAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(repeat_quest_attribute, () => $"repeat_quest_attribute is null !!!");
|
||||
|
||||
return repeat_quest_attribute.m_next_allocate_time;
|
||||
}
|
||||
|
||||
public void setRepeatQuestInfo(DateTime nextAllocateTime, Int32 isChecking)
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
var repeat_quest_attribute = player.getEntityAttribute<RepeatQuestAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(repeat_quest_attribute, () => $"repeat_quest_attribute is null !!!");
|
||||
repeat_quest_attribute.m_next_allocate_time = nextAllocateTime;
|
||||
repeat_quest_attribute.m_is_checking = isChecking;
|
||||
repeat_quest_attribute.modifiedEntityAttribute();
|
||||
}
|
||||
|
||||
public Result setRepeatQuestFromDoc(RepeatQuestDoc doc)
|
||||
{
|
||||
var result = new Result();
|
||||
var owner = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => $"owner is null !!!");
|
||||
|
||||
if (false == doc.getAttribWrappers().TryGetValue(typeof(RepeatQuestAttrib), out var to_copy_doc_attrib))
|
||||
{
|
||||
var err_msg = $"Fail to get QuestAttrib";
|
||||
result.setFail(ServerErrorCode.EntityAttributeNotFound, err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
var attrib_base = to_copy_doc_attrib.getAttribBase();
|
||||
var doc_attrib = attrib_base as RepeatQuestAttrib;
|
||||
if (doc_attrib is null)
|
||||
{
|
||||
var err_msg = $"Fail to get QuestAttrib";
|
||||
result.setFail(ServerErrorCode.EntityAttributeNotFound, err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
var repeat_quest_attribute = owner.getEntityAttribute<RepeatQuestAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(repeat_quest_attribute, () => $"repeat_quest_attribute is null !!!");
|
||||
|
||||
repeat_quest_attribute.m_next_allocate_time = doc_attrib.m_next_allocate_time;
|
||||
repeat_quest_attribute.m_is_checking = doc_attrib.m_is_checking;
|
||||
|
||||
repeat_quest_attribute.syncOriginDocBaseWithNewDoc<RepeatQuestAttribute>(doc);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
public void checkAndAddNormalQuestCheckPool()
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
|
||||
var repeat_quest_attribute = player.getEntityAttribute<RepeatQuestAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(repeat_quest_attribute, () => $"repeat_quest_attribute is null !!!");
|
||||
|
||||
if (repeat_quest_attribute.m_is_checking == 1)
|
||||
{
|
||||
QuestManager.It.m_normal_quest_check_users.TryAdd(player.getUserGuid(), 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user