mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Group related fixes
- Group adding is not leader only now - Group buffs work now
This commit is contained in:
parent
d4eaf83354
commit
6baa0c5b07
@ -33,11 +33,14 @@ void GroupManager::requestGroup(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
otherPlr = PlayerManager::getPlayerFromID(otherPlr->iIDGroup);
|
otherPlr = PlayerManager::getPlayerFromID(otherPlr->iIDGroup);
|
||||||
|
|
||||||
|
if (otherPlr == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
if (otherPlr == nullptr)
|
if (otherPlr == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fail if the group is full or the other player is already in a group
|
// fail if the group is full or the other player is already in a group
|
||||||
if (plr->groupCnt >= 4 || otherPlr->groupCnt > 1) {
|
if (plr->groupCnt >= 4 || otherPlr->iIDGroup != otherPlr->iID || otherPlr->groupCnt > 1) {
|
||||||
INITSTRUCT(sP_FE2CL_PC_GROUP_INVITE_FAIL, resp);
|
INITSTRUCT(sP_FE2CL_PC_GROUP_INVITE_FAIL, resp);
|
||||||
sock->sendPacket((void*)&resp, P_FE2CL_PC_GROUP_INVITE_FAIL, sizeof(sP_FE2CL_PC_GROUP_INVITE_FAIL));
|
sock->sendPacket((void*)&resp, P_FE2CL_PC_GROUP_INVITE_FAIL, sizeof(sP_FE2CL_PC_GROUP_INVITE_FAIL));
|
||||||
return;
|
return;
|
||||||
@ -50,7 +53,7 @@ void GroupManager::requestGroup(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
INITSTRUCT(sP_FE2CL_PC_GROUP_INVITE, resp);
|
INITSTRUCT(sP_FE2CL_PC_GROUP_INVITE, resp);
|
||||||
|
|
||||||
resp.iHostID = plr->iIDGroup;
|
resp.iHostID = plr->iID;
|
||||||
|
|
||||||
otherSock->sendPacket((void*)&resp, P_FE2CL_PC_GROUP_INVITE, sizeof(sP_FE2CL_PC_GROUP_INVITE));
|
otherSock->sendPacket((void*)&resp, P_FE2CL_PC_GROUP_INVITE, sizeof(sP_FE2CL_PC_GROUP_INVITE));
|
||||||
}
|
}
|
||||||
|
@ -600,16 +600,18 @@ bool doDebuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t target
|
|||||||
|
|
||||||
bool doBuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t targetID, int32_t bitFlag, int16_t timeBuffID, int16_t duration, int16_t amount) {
|
bool doBuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t targetID, int32_t bitFlag, int16_t timeBuffID, int16_t duration, int16_t amount) {
|
||||||
Player *plr = nullptr;
|
Player *plr = nullptr;
|
||||||
|
CNSocket *sockTo = nullptr;
|
||||||
|
|
||||||
for (auto& pair : PlayerManager::players) {
|
for (auto& pair : PlayerManager::players) {
|
||||||
if (pair.second->iID == targetID) {
|
if (pair.second->iID == targetID) {
|
||||||
|
sockTo = pair.first;
|
||||||
plr = pair.second;
|
plr = pair.second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// player not found
|
// player not found
|
||||||
if (plr == nullptr) {
|
if (sockTo == nullptr || plr == nullptr) {
|
||||||
std::cout << "[WARN] doBuff: player ID not found" << std::endl;
|
std::cout << "[WARN] doBuff: player ID not found" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -631,7 +633,7 @@ bool doBuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t targetID
|
|||||||
if (amount > 0)
|
if (amount > 0)
|
||||||
pkt.TimeBuff.iValue = amount;
|
pkt.TimeBuff.iValue = amount;
|
||||||
|
|
||||||
sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
sockTo->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user