1
This commit is contained in:
parent
650b9ba773
commit
8963e9d982
@ -14,6 +14,7 @@
|
|||||||
#include "synchelper.h"
|
#include "synchelper.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "gamelog.h"
|
#include "gamelog.h"
|
||||||
|
#include "metamgr.h"
|
||||||
|
|
||||||
#include "framework/cpp/httpclientpool.h"
|
#include "framework/cpp/httpclientpool.h"
|
||||||
|
|
||||||
@ -403,6 +404,24 @@ void Guild::_CMGuildAgree(f8::MsgHdr& hdr, const cs::CMGuildAgree& msg)
|
|||||||
void Guild::_CMGuildGainExp(f8::MsgHdr& hdr, const cs::CMGuildGainExp& msg)
|
void Guild::_CMGuildGainExp(f8::MsgHdr& hdr, const cs::CMGuildGainExp& msg)
|
||||||
{
|
{
|
||||||
ss::SS_IM_ForwardGuildCMMsg *forward_msg = (ss::SS_IM_ForwardGuildCMMsg*)hdr.user_data;
|
ss::SS_IM_ForwardGuildCMMsg *forward_msg = (ss::SS_IM_ForwardGuildCMMsg*)hdr.user_data;
|
||||||
|
|
||||||
|
int exp = msg.exp();
|
||||||
|
if (exp > 0) {
|
||||||
|
MetaData::Guild* next_guild_meta = nullptr;
|
||||||
|
do {
|
||||||
|
MetaData::Guild* curr_guild_meta = MetaMgr::Instance()->GetGuild(GuildLv());
|
||||||
|
next_guild_meta = MetaMgr::Instance()->GetGuild(GuildLv() + 1);
|
||||||
|
if (!next_guild_meta || !curr_guild_meta) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int add_exp = std::max(curr_guild_meta->i->experience(), 0);
|
||||||
|
} while (next_guild_meta && exp > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
cs::SMGuildGainExp respmsg;
|
||||||
|
GuildMgr::Instance()->ForwardGuildSMMsg(hdr.socket_handle,
|
||||||
|
forward_msg->context(),
|
||||||
|
respmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::_CMGuildRefuse(f8::MsgHdr& hdr, const cs::CMGuildRefuse& msg)
|
void Guild::_CMGuildRefuse(f8::MsgHdr& hdr, const cs::CMGuildRefuse& msg)
|
||||||
|
@ -94,3 +94,13 @@ void MetaMgr::Reload()
|
|||||||
loader_ = new MetaDataLoader();
|
loader_ = new MetaDataLoader();
|
||||||
loader_->Load();
|
loader_->Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaData::Guild* MetaMgr::GetGuild(int guild_lv)
|
||||||
|
{
|
||||||
|
auto itr = loader_->guild_hash.find(guild_lv);
|
||||||
|
if (itr != loader_->guild_hash.end()) {
|
||||||
|
return itr->second;
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -16,6 +16,8 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
|||||||
void UnInit();
|
void UnInit();
|
||||||
void Reload();
|
void Reload();
|
||||||
|
|
||||||
|
MetaData::Guild* GetGuild(int guild_lv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MetaDataLoader* loader_ = nullptr;
|
MetaDataLoader* loader_ = nullptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user