Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ylmbtm committed Dec 18, 2020
1 parent 5837548 commit 4a8538d
Show file tree
Hide file tree
Showing 48 changed files with 765 additions and 92 deletions.
5 changes: 5 additions & 0 deletions Proto/proto_raw/Msg_Account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ message SealAccountAck {
uint32 RetCode = 1;
string AccountName = 2;
uint64 AccountID = 3; //账号ID
int32 ServerID = 4; //上次登录SvrID
}

message SealAccountNtf {
uint64 AccountID = 1; //账号ID
}

message SetLastServerNty {
Expand Down
13 changes: 13 additions & 0 deletions Proto/proto_raw/Msg_Base.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

message ItemData {
int32 ItemID = 1;
int32 ItemNum = 2;
}

message SkillItem {
uint32 SkillID = 1;
int32 Level = 2;
int32 KeyPos = 3; //强化等级
}

7 changes: 1 addition & 6 deletions Proto/proto_raw/Msg_Copy.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";

import "Msg_Base.proto";
message ResultObject{
uint64 ObjectID = 1;
int32 ActorID = 2;
Expand Down Expand Up @@ -40,11 +40,6 @@ message MainCopyAck {
uint32 RetCode = 1;
}

message ItemData {
int32 ItemID = 1;
int32 ItemNum = 2;
}

message MainCopyResultNty {
uint64 RoleID = 1; //角色ID
int32 CopyID = 2; //副本ID
Expand Down
45 changes: 33 additions & 12 deletions Proto/proto_raw/Msg_Game.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
syntax = "proto3";

message SkillItem {
uint32 SkillID = 1;
int32 Level = 2;
int32 KeyPos = 3; //强化等级
}
import "Msg_Base.proto";

message GmStopServerReq {
uint32 Data = 1;
Expand Down Expand Up @@ -237,10 +232,9 @@ message ChatMessageReq {
string SrcName = 1;
uint64 SrcID = 2;
uint64 TargetID = 3; //目标ID
int32 Channel = 4; //聊天频道
int32 ChatChl = 4; //聊天频道;
uint64 GuildID = 5; //公会ID
string Content = 6;

}

message ChatMessageAck {
Expand All @@ -250,10 +244,12 @@ message ChatMessageAck {
message ChatMessageNty {
string SrcName = 1;
uint64 SrcID = 2;
uint64 TargetID = 3; //目标ID
int32 Channel = 4;
uint64 GuildID = 5;
string Content = 6;
int32 SrcLevel = 3;
uint64 TargetID = 4; //目标ID
int32 ChatChl = 5;
uint64 GuildID = 6;
uint64 TimeStamp = 7;
string Content = 8;
}

message CommonReq {
Expand Down Expand Up @@ -284,6 +280,16 @@ message LogicRegToLoginAck {
string NewSvrName = 2;
}

message LogicRegToDbSvrReq {
int32 ServerID = 1;
string ServerName = 2;
uint32 ProcessID = 3;
}

message LogicRegToDbSvrAck {
uint32 RetCode = 1;
}

message LogicUpdateInfoReq {
int32 ServerID = 1;
string ServerName = 2;
Expand Down Expand Up @@ -320,6 +326,21 @@ message SetupEquipAck {
uint32 RetCode = 1;
}

message Msg_GiftCodeReq{
uint64 RoleID = 1;
string GiftCode = 2;
uint32 Channel = 3;
uint64 AccountID = 4;
int32 AreaID = 5;

}

message Msg_GiftCodeAck{
uint32 RetCode = 1;
uint64 RoleID = 2;
repeated ItemData items = 3;
}

message UnsetEquipReq {
uint64 EquipGuid = 1;
}
Expand Down
11 changes: 9 additions & 2 deletions Proto/proto_raw/Msg_ID.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ enum MessageID {
MSG_WATCH_HEART_BEAT_ACK = 100025;

MSG_REMOVE_CONNECT_NTY = 100026;
MSG_DISCONNECT_NTY = 100032; //断开连接

MSG_DISCONNECT_NTY = 100027; //断开连接

MSG_NETWORK_STATUS_NTY = 100028; //客户端专用网络状态通知

MSG_LOGIC_REGTO_DBSVR_REQ = 100031; //逻辑服注册到db服请求
MSG_LOGIC_REGTO_DBSVR_ACK = 100032; //逻辑服注册到db服返回

MSG_ROLE_DATA_CHANGE_NTY = 100033;

MSG_SET_LAST_SERVER_NTY = 100034;
Expand All @@ -64,6 +69,8 @@ enum MessageID {

MSG_DB_WRITE_ERROR_NTY = 100041; //DB写错误通知

MSG_SEAL_ACCOUNT_NTY = 100042; //封账号通知

MSG_NORMAL_MSGID_END = 199999;

//============================================================================================
Expand Down
2 changes: 1 addition & 1 deletion Proto/proto_raw/Msg_LoginCltData.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
import "Msg_Game.proto";
import "Msg_Base.proto";

message BagItem {
uint64 Guid = 1;
Expand Down
2 changes: 1 addition & 1 deletion Proto/proto_raw/Msg_LoginDBData.proto
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ message DBCounterData {

message DBFriendItem {
uint64 RoleID = 1; //角色ID
uint64 FriendID = 2; //好友ID
uint64 FriendID = 2; //好友ID
}

message DBFriendData {
Expand Down
3 changes: 1 addition & 2 deletions Proto/proto_raw/Msg_Move.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
syntax = "proto3";
import "Msg_Game.proto";

import "Msg_Base.proto";
//请求释放技能
message SkillCastReq
{
Expand Down
21 changes: 21 additions & 0 deletions Proto/proto_raw/Msg_Payment.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

message CreatePaymentReq
{
string OrderID = 1; //订单ID
int32 Platform = 2; //平台 1:安卓,2:ios
int32 Channel = 3; //渠道
uint64 RoleID = 4; //角色ID
int32 ServerID = 5; //区服ID
uint64 AccountID = 6; //账号ID
int32 ProductID = 7; //档位ID
int32 BuyID = 8; //购买的游戏内的商品ID
int32 ProxyID = 9; //不需要客户端传
int32 ClientID = 10; //不需要客户端传
}

message CreatePaymentAck
{
uint32 RetCode = 1;
string OrderID = 2;
}
3 changes: 3 additions & 0 deletions Proto/proto_raw/Msg_RetCode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ enum MessageRetCode {
MRC_SERVER_NOT_AVAILABLE = 316; //服务器不可用
MRC_SERVER_MAINTAIN = 317; //服务器维护中
MRC_SERVER_NO_NEW_ROLE = 318; //不允许创建新角色
MRC_SEAL_ROLE = 319; //角色己被封
MRC_SEAL_ACCOUNT = 320; //账号己被封
MRC_DELETE_ROLE = 321; //角色被删除

//礼包码
MRC_GIFTCODE_AREADY_USED = 500; //礼包码己使用
Expand Down
9 changes: 6 additions & 3 deletions Server/Src/AccountServer/AccountManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ BOOL CAccountObjectMgr::ReleaseAccountObject(UINT64 AccountID )
return Delete(AccountID);
}

BOOL CAccountObjectMgr::SealAccount(UINT64 uAccountID, const std::string& strName, UINT32 dwChannel, BOOL bSeal, UINT32 dwSealTime)
BOOL CAccountObjectMgr::SealAccount(UINT64& uAccountID, const std::string& strName, UINT32 dwChannel, BOOL bSeal, UINT32 dwSealTime, UINT32& dwLastSvrID)
{
CAccountObject* pAccObj = NULL;
if (uAccountID == 0)
Expand All @@ -113,12 +113,15 @@ BOOL CAccountObjectMgr::SealAccount(UINT64 uAccountID, const std::string& strNam

if (pAccObj == NULL)
{
CLog::GetInstancePtr()->LogError("CAccountObjectMgr::SealAccount Error Cannot find account uAccountID:%lld, strName:%s", uAccountID, strName.c_str());
return FALSE;
}

if (bSeal)
{
pAccObj->m_uSealTime = CommonFunc::GetCurrTime() + dwSealTime;
uAccountID = pAccObj->m_ID;
dwLastSvrID = pAccObj->m_dwLastSvrID[0];
}
else
{
Expand Down Expand Up @@ -264,12 +267,12 @@ BOOL CAccountObjectMgr::IsRun()

BOOL CAccountObjectMgr::CheckAccountName(const std::string& strName, bool bFromChannel)
{
if (strName.size() < 6)
if (strName.size() < 1)
{
return FALSE;
}

if (CommonConvert::HasSymbol(strName.c_str(), (const char*)"\'\" \\"))
if (CommonConvert::HasSymbol(strName.c_str(), (const char*)"\'\" \\\r\n"))
{
return FALSE;
}
Expand Down
2 changes: 1 addition & 1 deletion Server/Src/AccountServer/AccountManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CAccountObjectMgr : public AVLTree<UINT64, CAccountObject>

BOOL ReleaseAccountObject(UINT64 m_u64AccountID);

BOOL SealAccount(UINT64 uAccountID, const std::string& strName, UINT32 dwChannel, BOOL bSeal, UINT32 dwSealTime);
BOOL SealAccount(UINT64& uAccountID, const std::string& strName, UINT32 dwChannel, BOOL bSeal, UINT32 dwSealTime, UINT32& dwLastSvrID);

BOOL SetLastServer(UINT64 uAccountID, INT32 ServerID);

Expand Down
31 changes: 23 additions & 8 deletions Server/Src/AccountServer/AccountMsgHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,26 @@ BOOL CAccountMsgHandler::OnMsgAccountRegReq(NetPacket* pPacket)

AccountRegAck Ack;

if(!m_AccountManager.CheckAccountName(Req.accountname(), false))
std::string strAccountName = Req.accountname();

if(!m_AccountManager.CheckAccountName(strAccountName, false))
{
Ack.set_retcode(MRC_ACCOUNT_NAME_ERR_FMT);
ServiceBase::GetInstancePtr()->SendMsgProtoBuf(pPacket->m_dwConnID, MSG_ACCOUNT_REG_ACK, 0, pHeader->dwUserData, Ack);
return TRUE;
}

CAccountObject* pAccount = m_AccountManager.GetAccountObject(Req.accountname(), Req.channel());
CommonConvert::StringTrim(strAccountName);

CAccountObject* pAccount = m_AccountManager.GetAccountObject(strAccountName, Req.channel());
if(pAccount != NULL)
{
Ack.set_retcode(MRC_ACCOUNT_NAME_EXIST);
ServiceBase::GetInstancePtr()->SendMsgProtoBuf(pPacket->m_dwConnID, MSG_ACCOUNT_REG_ACK, 0, pHeader->dwUserData, Ack);
return TRUE;
}

pAccount = m_AccountManager.CreateAccountObject(Req.accountname(), Req.password(), Req.channel());
pAccount = m_AccountManager.CreateAccountObject(strAccountName, Req.password(), Req.channel());
if(pAccount == NULL)
{
Ack.set_retcode(MRC_UNKNOW_ERROR);
Expand Down Expand Up @@ -103,14 +107,18 @@ BOOL CAccountMsgHandler::OnMsgAccontLoginReq(NetPacket* pPacket)
AccountLoginAck Ack;
Ack.set_review(Req.review());

if (!m_AccountManager.CheckAccountName(Req.accountname(), Req.fromchannel()))
std::string strAccountName = Req.accountname();

if (!m_AccountManager.CheckAccountName(strAccountName, Req.fromchannel()))
{
Ack.set_retcode(MRC_ACCOUNT_NAME_ERR_FMT);
ServiceBase::GetInstancePtr()->SendMsgProtoBuf(pPacket->m_dwConnID, MSG_ACCOUNT_LOGIN_ACK, 0, pHeader->dwUserData, Ack);
return TRUE;
}

CAccountObject* pAccObj = m_AccountManager.GetAccountObject(Req.accountname(), Req.channel());
CommonConvert::StringTrim(strAccountName);

CAccountObject* pAccObj = m_AccountManager.GetAccountObject(strAccountName, Req.channel());
if(pAccObj != NULL)
{
ERROR_RETURN_FALSE(pAccObj->m_ID != 0);
Expand Down Expand Up @@ -150,7 +158,7 @@ BOOL CAccountMsgHandler::OnMsgAccontLoginReq(NetPacket* pPacket)
UINT64 u64ID = 0;
UINT32 dwChannel = 0;
std::string strPwd;
pAccObj = m_AccountManager.CreateAccountObject(Req.accountname(), Req.password(), Req.channel());
pAccObj = m_AccountManager.CreateAccountObject(strAccountName, Req.password(), Req.channel());
if (pAccObj == NULL)
{
Ack.set_retcode(MRC_UNKNOW_ERROR);
Expand Down Expand Up @@ -179,10 +187,17 @@ BOOL CAccountMsgHandler::OnMsgSealAccountReq(NetPacket* pPacket)
ERROR_RETURN_TRUE(pHeader->dwUserData != 0);

SealAccountAck Ack;

if (m_AccountManager.SealAccount(Req.accountid(), Req.accountname(), Req.channel(), Req.seal(), Req.sealtime()))
UINT64 uAccountID = Req.accountid();
UINT32 dwLastSvrID = 0;
if (m_AccountManager.SealAccount(uAccountID, Req.accountname(), Req.channel(), Req.seal(), Req.sealtime(), dwLastSvrID))
{
Ack.set_retcode(MRC_SUCCESSED);

if (Req.seal())
{
Ack.set_accountid(uAccountID);
Ack.set_serverid(dwLastSvrID);
}
}
else
{
Expand Down
9 changes: 7 additions & 2 deletions Server/Src/AccountServer/AccountServer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4800;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
Expand All @@ -88,7 +88,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4800</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4800;4244;</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
Expand All @@ -108,6 +108,10 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\Message\Msg_Base.pb.cc">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\Message\Msg_Game.pb.cc">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
Expand All @@ -129,6 +133,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Message\Msg_Account.pb.h" />
<ClInclude Include="..\Message\Msg_Base.pb.h" />
<ClInclude Include="..\Message\Msg_Game.pb.h" />
<ClInclude Include="..\Message\Msg_ID.pb.h" />
<ClInclude Include="..\WatcherClient\WatcherClient.h" />
Expand Down
6 changes: 6 additions & 0 deletions Server/Src/AccountServer/AccountServer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
<ClCompile Include="..\Message\Msg_ID.pb.cc">
<Filter>Proto</Filter>
</ClCompile>
<ClCompile Include="..\Message\Msg_Base.pb.cc">
<Filter>Proto</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameService.h">
Expand Down Expand Up @@ -77,6 +80,9 @@
<ClInclude Include="..\Message\Msg_ID.pb.h">
<Filter>Proto</Filter>
</ClInclude>
<ClInclude Include="..\Message\Msg_Base.pb.h">
<Filter>Proto</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
Expand Down
Loading

0 comments on commit 4a8538d

Please sign in to comment.