mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Compare commits
4 Commits
f9e61a61b3
...
551d4ebb8b
Author | SHA1 | Date | |
---|---|---|---|
|
551d4ebb8b | ||
c636c538eb | |||
|
613a4c58a3 | ||
|
177565dc55 |
@ -70,30 +70,36 @@ static void setValuePlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
// Handle serverside value-changes
|
// Handle serverside value-changes
|
||||||
switch (setData->iSetValueType) {
|
switch (setData->iSetValueType) {
|
||||||
case 1:
|
case 1:
|
||||||
plr->HP = setData->iSetValue;
|
response.iSetValue = plr->HP = setData->iSetValue;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
plr->batteryW = setData->iSetValue;
|
plr->batteryW = setData->iSetValue;
|
||||||
|
|
||||||
// caps
|
// caps
|
||||||
if (plr->batteryW > 9999)
|
if (plr->batteryW > 9999)
|
||||||
plr->batteryW = 9999;
|
plr->batteryW = 9999;
|
||||||
|
|
||||||
|
response.iSetValue = plr->batteryW;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
plr->batteryN = setData->iSetValue;
|
plr->batteryN = setData->iSetValue;
|
||||||
|
|
||||||
// caps
|
// caps
|
||||||
if (plr->batteryN > 9999)
|
if (plr->batteryN > 9999)
|
||||||
plr->batteryN = 9999;
|
plr->batteryN = 9999;
|
||||||
|
|
||||||
|
response.iSetValue = plr->batteryN;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Missions::updateFusionMatter(sock, setData->iSetValue - plr->fusionmatter);
|
Missions::updateFusionMatter(sock, setData->iSetValue - plr->fusionmatter);
|
||||||
|
response.iSetValue = plr->fusionmatter;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
plr->money = setData->iSetValue;
|
response.iSetValue = plr->money = setData->iSetValue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.iPC_ID = setData->iPC_ID;
|
response.iPC_ID = setData->iPC_ID;
|
||||||
response.iSetValue = setData->iSetValue;
|
|
||||||
response.iSetValueType = setData->iSetValueType;
|
response.iSetValueType = setData->iSetValueType;
|
||||||
|
|
||||||
sock->sendPacket(response, P_FE2CL_GM_REP_PC_SET_VALUE);
|
sock->sendPacket(response, P_FE2CL_GM_REP_PC_SET_VALUE);
|
||||||
|
@ -86,7 +86,10 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, ui
|
|||||||
plr->x = X;
|
plr->x = X;
|
||||||
plr->y = Y;
|
plr->y = Y;
|
||||||
plr->z = Z;
|
plr->z = Z;
|
||||||
|
if (plr->instanceID != I) {
|
||||||
plr->instanceID = I;
|
plr->instanceID = I;
|
||||||
|
plr->recallInstance = INSTANCE_OVERWORLD;
|
||||||
|
}
|
||||||
if (oldChunk == newChunk)
|
if (oldChunk == newChunk)
|
||||||
return; // didn't change chunks
|
return; // didn't change chunks
|
||||||
Chunking::updateEntityChunk({sock}, oldChunk, newChunk);
|
Chunking::updateEntityChunk({sock}, oldChunk, newChunk);
|
||||||
@ -132,24 +135,6 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I
|
|||||||
sock->sendPacket(resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC);
|
sock->sendPacket(resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I != INSTANCE_OVERWORLD) {
|
|
||||||
INITSTRUCT(sP_FE2CL_INSTANCE_MAP_INFO, pkt);
|
|
||||||
pkt.iInstanceMapNum = (int32_t)MAPNUM(I); // lower 32 bits are mapnum
|
|
||||||
if (I != fromInstance // do not retransmit MAP_INFO on recall
|
|
||||||
&& Racing::EPData.find(pkt.iInstanceMapNum) != Racing::EPData.end()) {
|
|
||||||
EPInfo* ep = &Racing::EPData[pkt.iInstanceMapNum];
|
|
||||||
pkt.iEP_ID = ep->EPID;
|
|
||||||
pkt.iMapCoordX_Min = ep->zoneX * 51200;
|
|
||||||
pkt.iMapCoordX_Max = (ep->zoneX + 1) * 51200;
|
|
||||||
pkt.iMapCoordY_Min = ep->zoneY * 51200;
|
|
||||||
pkt.iMapCoordY_Max = (ep->zoneY + 1) * 51200;
|
|
||||||
pkt.iMapCoordZ_Min = INT32_MIN;
|
|
||||||
pkt.iMapCoordZ_Max = INT32_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
sock->sendPacket(pkt, P_FE2CL_INSTANCE_MAP_INFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_GOTO_SUCC, pkt2);
|
INITSTRUCT(sP_FE2CL_REP_PC_GOTO_SUCC, pkt2);
|
||||||
pkt2.iX = X;
|
pkt2.iX = X;
|
||||||
pkt2.iY = Y;
|
pkt2.iY = Y;
|
||||||
@ -376,6 +361,24 @@ static void loadPlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
updatePlayerPosition(sock, plr->x, plr->y, plr->z, plr->instanceID, plr->angle);
|
updatePlayerPosition(sock, plr->x, plr->y, plr->z, plr->instanceID, plr->angle);
|
||||||
|
|
||||||
sock->sendPacket(response, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC);
|
sock->sendPacket(response, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC);
|
||||||
|
|
||||||
|
if (plr->instanceID != INSTANCE_OVERWORLD) {
|
||||||
|
INITSTRUCT(sP_FE2CL_INSTANCE_MAP_INFO, pkt);
|
||||||
|
pkt.iInstanceMapNum = (int32_t)MAPNUM(plr->instanceID); // lower 32 bits are mapnum
|
||||||
|
if (pkt.iInstanceMapNum != plr->recallInstance // do not retransmit MAP_INFO on recall
|
||||||
|
&& Racing::EPData.find(pkt.iInstanceMapNum) != Racing::EPData.end()) {
|
||||||
|
EPInfo* ep = &Racing::EPData[pkt.iInstanceMapNum];
|
||||||
|
pkt.iEP_ID = ep->EPID;
|
||||||
|
pkt.iMapCoordX_Min = ep->zoneX * 51200;
|
||||||
|
pkt.iMapCoordX_Max = (ep->zoneX + 1) * 51200;
|
||||||
|
pkt.iMapCoordY_Min = ep->zoneY * 51200;
|
||||||
|
pkt.iMapCoordY_Max = (ep->zoneY + 1) * 51200;
|
||||||
|
pkt.iMapCoordZ_Min = INT32_MIN;
|
||||||
|
pkt.iMapCoordZ_Max = INT32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
sock->sendPacket(pkt, P_FE2CL_INSTANCE_MAP_INFO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void heartbeatPlayer(CNSocket* sock, CNPacketData* data) {
|
static void heartbeatPlayer(CNSocket* sock, CNPacketData* data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user