mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-25 22:40:16 +00:00
Implemented buddy warping
Buddy warping now works, if anything else needs to be added/redone in regards to this feel free to let me know ^
This commit is contained in:
parent
90134cd1fa
commit
e0e474924d
@ -16,6 +16,7 @@ void BuddyManager::init() {
|
|||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_GET_BUDDY_STATE, reqPktGetBuddyState);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_GET_BUDDY_STATE, reqPktGetBuddyState);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_SET_BUDDY_BLOCK, reqBuddyBlock);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_SET_BUDDY_BLOCK, reqBuddyBlock);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_REMOVE_BUDDY, reqBuddyDelete);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_REMOVE_BUDDY, reqBuddyDelete);
|
||||||
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_BUDDY_WARP, reqBuddyWarp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Buddy request
|
//Buddy request
|
||||||
@ -310,6 +311,32 @@ void BuddyManager::reqBuddyDelete(CNSocket* sock, CNPacketData* data) {
|
|||||||
sock->sendPacket((void*)&resp, P_FE2CL_REP_REMOVE_BUDDY_SUCC, sizeof(sP_FE2CL_REP_REMOVE_BUDDY_SUCC));
|
sock->sendPacket((void*)&resp, P_FE2CL_REP_REMOVE_BUDDY_SUCC, sizeof(sP_FE2CL_REP_REMOVE_BUDDY_SUCC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Warping to buddy
|
||||||
|
void BuddyManager::reqBuddyWarp(CNSocket* sock, CNPacketData* data) {
|
||||||
|
if (data->size != sizeof(sP_CL2FE_REQ_PC_BUDDY_WARP))
|
||||||
|
return; //malformed packet
|
||||||
|
|
||||||
|
sP_CL2FE_REQ_PC_BUDDY_WARP* pkt = (sP_CL2FE_REQ_PC_BUDDY_WARP*)data->buf;
|
||||||
|
|
||||||
|
INITSTRUCT(sP_FE2CL_REP_PC_BUDDY_WARP_OTHER_SHARD_SUCC, resp);
|
||||||
|
resp.iBuddyPCUID = pkt->iBuddyPCUID;
|
||||||
|
|
||||||
|
CNSocket* otherSock = sock;
|
||||||
|
|
||||||
|
for (auto pair : PlayerManager::players) {
|
||||||
|
if (pair.second.plr->PCStyle.iPC_UID == pkt->iBuddyPCUID) {
|
||||||
|
otherSock = pair.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Player* buddy = PlayerManager::getPlayer(otherSock);
|
||||||
|
|
||||||
|
PlayerManager::updatePlayerPosition(sock, buddy->x, buddy->y, buddy->z);
|
||||||
|
|
||||||
|
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_BUDDY_WARP_OTHER_SHARD_SUCC, sizeof(sP_FE2CL_REP_PC_BUDDY_WARP_OTHER_SHARD_SUCC));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#pragma region Helper methods
|
#pragma region Helper methods
|
||||||
|
|
||||||
void BuddyManager::requestedBuddy(CNSocket* sock, Player* plrReq, PlayerView& plr) {
|
void BuddyManager::requestedBuddy(CNSocket* sock, Player* plrReq, PlayerView& plr) {
|
||||||
|
@ -30,6 +30,9 @@ namespace BuddyManager {
|
|||||||
void reqBuddyBlock(CNSocket* sock, CNPacketData* data);
|
void reqBuddyBlock(CNSocket* sock, CNPacketData* data);
|
||||||
void reqBuddyDelete(CNSocket* sock, CNPacketData* data);
|
void reqBuddyDelete(CNSocket* sock, CNPacketData* data);
|
||||||
|
|
||||||
|
//Buddy warping
|
||||||
|
void reqBuddyWarp(CNSocket* sock, CNPacketData* data);
|
||||||
|
|
||||||
//helper methods
|
//helper methods
|
||||||
void requestedBuddy(CNSocket* sock, Player* plrReq, PlayerView& plr);
|
void requestedBuddy(CNSocket* sock, Player* plrReq, PlayerView& plr);
|
||||||
void buddyList(CNSocket* sock, sBuddyBaseInfo BuddyInfo); //updates the buddylist
|
void buddyList(CNSocket* sock, sBuddyBaseInfo BuddyInfo); //updates the buddylist
|
||||||
|
Loading…
Reference in New Issue
Block a user