添加创建/申请公会次数每日限制
This commit is contained in:
parent
1a6d2eb472
commit
8bbf8cd361
@ -29,6 +29,9 @@
|
||||
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
|
||||
static const int MAX_DAILY_APPPLY_GUILD_TIMES = 100;
|
||||
static const int MAX_DAILY_CREATE_GUILD_TIMES = 20;
|
||||
|
||||
void Player::Init()
|
||||
{
|
||||
myself.hum = this;
|
||||
@ -105,6 +108,8 @@ void Player::Deserialize(const ss::MFUserDB& user_db)
|
||||
AddBlackList(friendobj);
|
||||
}
|
||||
role_data.today_apply_times = user_db.role_data().today_apply_times();
|
||||
role_data.today_apply_guild_times = user_db.role_data().today_apply_guild_times();
|
||||
role_data.today_create_guild_times = user_db.role_data().today_create_guild_times();
|
||||
role_data.save_count = user_db.role_data().save_count();
|
||||
role_data.last_save_time = user_db.role_data().last_save_time();
|
||||
}
|
||||
@ -120,6 +125,8 @@ void Player::Serialize(ss::MFUserDB& user_db)
|
||||
TypeConvert::Convert(pair.second->base_data, *(p->mutable_base_data()));
|
||||
}
|
||||
user_db.mutable_role_data()->set_today_apply_times(role_data.today_apply_times);
|
||||
user_db.mutable_role_data()->set_today_apply_guild_times(role_data.today_apply_guild_times);
|
||||
user_db.mutable_role_data()->set_today_create_guild_times(role_data.today_create_guild_times);
|
||||
user_db.mutable_role_data()->set_save_count(role_data.save_count);
|
||||
user_db.mutable_role_data()->set_last_save_time(role_data.last_save_time);
|
||||
}
|
||||
@ -651,6 +658,15 @@ void Player::_CMGuildCreate(f8::MsgHdr& hdr, const cs::CMGuildCreate& msg)
|
||||
SendMsg(respmsg);
|
||||
return;
|
||||
}
|
||||
if (role_data.today_create_guild_times >= MAX_DAILY_CREATE_GUILD_TIMES) {
|
||||
ShowErrorMsg("今日创建公会次数已达上限");
|
||||
respmsg.set_errcode(1);
|
||||
respmsg.set_errmsg("今日创建公会次数已达上限");
|
||||
SendMsg(respmsg);
|
||||
return;
|
||||
}
|
||||
++role_data.today_create_guild_times;
|
||||
|
||||
std::string ip;
|
||||
int port = 0;
|
||||
JsonDataMgr::Instance()->GetRankServerConf(ip, port);
|
||||
@ -727,6 +743,14 @@ void Player::_CMGuildJoin(f8::MsgHdr& hdr, const cs::CMGuildJoin& msg)
|
||||
SendMsg(respmsg);
|
||||
return;
|
||||
}
|
||||
if (role_data.today_apply_guild_times >= MAX_DAILY_APPPLY_GUILD_TIMES) {
|
||||
ShowErrorMsg("今日申请公会次数已达上限");
|
||||
respmsg.set_errcode(1);
|
||||
respmsg.set_errmsg("今日申请公会次数已达上限");
|
||||
SendMsg(respmsg);
|
||||
return;
|
||||
}
|
||||
++role_data.today_apply_guild_times;
|
||||
ForwardGuildCMMsg(hdr, msg.guild_id());
|
||||
}
|
||||
|
||||
@ -1774,6 +1798,8 @@ void Player::SyncRedPoint()
|
||||
void Player::OnDailyReset()
|
||||
{
|
||||
role_data.today_apply_times = 0;
|
||||
role_data.today_apply_guild_times = 0;
|
||||
role_data.today_create_guild_times = 0;
|
||||
}
|
||||
|
||||
void Player::RecalcRedPoint()
|
||||
|
@ -84,6 +84,8 @@ struct RoleData
|
||||
int today_apply_times = 0;
|
||||
int save_count = 0;
|
||||
int last_save_time = 0;
|
||||
int today_apply_guild_times = 0;
|
||||
int today_create_guild_times = 0;
|
||||
};
|
||||
|
||||
struct GuildMember
|
||||
|
@ -59,6 +59,8 @@ message MFRole
|
||||
optional int32 today_apply_times = 1;
|
||||
optional int32 save_count = 2;
|
||||
optional int32 last_save_time = 3;
|
||||
optional int32 today_apply_guild_times = 4;
|
||||
optional int32 today_create_guild_times = 5;
|
||||
}
|
||||
|
||||
message MFGroupMemberDB
|
||||
|
Loading…
x
Reference in New Issue
Block a user