mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Time to go, gumballs and nano potions (#113)
* set up "go to the time machine" button working * warping to the past now sets PayZoneFlag and removes all active missions * added gumballs functionality * added nano potions functionality * formatting fix
This commit is contained in:
parent
e5a24bcb70
commit
d4f1515f5d
@ -2,6 +2,7 @@
|
|||||||
#include "CNStructs.hpp"
|
#include "CNStructs.hpp"
|
||||||
#include "ItemManager.hpp"
|
#include "ItemManager.hpp"
|
||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
|
#include "NanoManager.hpp"
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
|
|
||||||
#include <string.h> // for memset() and memcmp()
|
#include <string.h> // for memset() and memcmp()
|
||||||
@ -15,6 +16,8 @@ void ItemManager::init() {
|
|||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_ITEM_MOVE, itemMoveHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_ITEM_MOVE, itemMoveHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_ITEM_DELETE, itemDeleteHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_ITEM_DELETE, itemDeleteHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_GIVE_ITEM, itemGMGiveHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_GIVE_ITEM, itemGMGiveHandler);
|
||||||
|
//this one is for gumballs
|
||||||
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_ITEM_USE, itemUseHandler);
|
||||||
// Bank
|
// Bank
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_BANK_OPEN, itemBankOpenHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_BANK_OPEN, itemBankOpenHandler);
|
||||||
// Trade handlers
|
// Trade handlers
|
||||||
@ -186,6 +189,60 @@ void ItemManager::itemGMGiveHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
|
if (data->size != sizeof(sP_CL2FE_REQ_ITEM_USE))
|
||||||
|
return; // ignore the malformed packet
|
||||||
|
sP_CL2FE_REQ_ITEM_USE* request = (sP_CL2FE_REQ_ITEM_USE*)data->buf;
|
||||||
|
Player* player = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
|
//gumball can only be used from inventory, so we ignore eIL
|
||||||
|
sItemBase gumball = player->Inven[request->iSlotNum];
|
||||||
|
sNano nano = player->Nanos[player->equippedNanos[request->iNanoSlot]];
|
||||||
|
|
||||||
|
//sanity check, check if gumball exists
|
||||||
|
if (!(gumball.iOpt > 0 && gumball.iType == 7 && gumball.iID>=119 && gumball.iID<=121)) {
|
||||||
|
std::cout << "[WARN] Gumball not found" << std::endl;
|
||||||
|
INITSTRUCT(sP_FE2CL_REP_PC_ITEM_USE_FAIL, response);
|
||||||
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_ITEM_USE_FAIL, sizeof(sP_FE2CL_REP_PC_ITEM_USE_FAIL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//sanity check, check if gumball type matches nano style
|
||||||
|
int nanoStyle = NanoManager::nanoStyle(nano.iID);
|
||||||
|
if (!((gumball.iID == 119 && nanoStyle == 0) ||
|
||||||
|
( gumball.iID == 120 && nanoStyle == 1) ||
|
||||||
|
( gumball.iID == 121 && nanoStyle == 2))) {
|
||||||
|
std::cout << "[WARN] Gumball type doesn't match nano type" << std::endl;
|
||||||
|
INITSTRUCT(sP_FE2CL_REP_PC_ITEM_USE_FAIL, response);
|
||||||
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_ITEM_USE_FAIL, sizeof(sP_FE2CL_REP_PC_ITEM_USE_FAIL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gumball.iOpt -= 1;
|
||||||
|
if (gumball.iOpt == 0)
|
||||||
|
gumball = {};
|
||||||
|
|
||||||
|
INITSTRUCT(sP_FE2CL_REP_PC_ITEM_USE_SUCC, response);
|
||||||
|
response.iPC_ID = player->iID;
|
||||||
|
response.eIL = 1;
|
||||||
|
response.iSlotNum = request->iSlotNum;
|
||||||
|
response.RemainItem = gumball;
|
||||||
|
// response.iTargetCnt = ?
|
||||||
|
// response.eST = ?
|
||||||
|
// response.iSkillID = ?
|
||||||
|
|
||||||
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_ITEM_USE_SUCC, sizeof(sP_FE2CL_REP_PC_ITEM_USE_SUCC));
|
||||||
|
//update inventory serverside
|
||||||
|
player->Inven[response.iSlotNum] = response.RemainItem;
|
||||||
|
|
||||||
|
//this is a temporary way of calling buff efect
|
||||||
|
//TODO: send buff data via response packet
|
||||||
|
int value1 = CSB_BIT_STIMPAKSLOT1 << request->iNanoSlot;
|
||||||
|
int value2 = ECSB_STIMPAKSLOT1 + request->iNanoSlot;
|
||||||
|
|
||||||
|
NanoManager::nanoBuff(sock, nano.iID, 144, EST_NANOSTIMPAK, value1, value2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void ItemManager::itemBankOpenHandler(CNSocket* sock, CNPacketData* data) {
|
void ItemManager::itemBankOpenHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
if (data->size != sizeof(sP_CL2FE_REQ_PC_BANK_OPEN))
|
if (data->size != sizeof(sP_CL2FE_REQ_PC_BANK_OPEN))
|
||||||
return; // ignore the malformed packet
|
return; // ignore the malformed packet
|
||||||
|
@ -31,6 +31,7 @@ namespace ItemManager {
|
|||||||
void itemMoveHandler(CNSocket* sock, CNPacketData* data);
|
void itemMoveHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void itemDeleteHandler(CNSocket* sock, CNPacketData* data);
|
void itemDeleteHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void itemGMGiveHandler(CNSocket* sock, CNPacketData* data);
|
void itemGMGiveHandler(CNSocket* sock, CNPacketData* data);
|
||||||
|
void itemUseHandler(CNSocket* sock, CNPacketData* data);
|
||||||
// Bank
|
// Bank
|
||||||
void itemBankOpenHandler(CNSocket* sock, CNPacketData* data);
|
void itemBankOpenHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void itemTradeOfferHandler(CNSocket* sock, CNPacketData* data);
|
void itemTradeOfferHandler(CNSocket* sock, CNPacketData* data);
|
||||||
|
@ -157,13 +157,17 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
|
|||||||
return; // malformed packet
|
return; // malformed packet
|
||||||
|
|
||||||
sP_CL2FE_REQ_PC_TASK_STOP* missionData = (sP_CL2FE_REQ_PC_TASK_STOP*)data->buf;
|
sP_CL2FE_REQ_PC_TASK_STOP* missionData = (sP_CL2FE_REQ_PC_TASK_STOP*)data->buf;
|
||||||
|
quitTask(sock, missionData->iTaskNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MissionManager::quitTask(CNSocket* sock, int32_t taskNum) {
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_TASK_STOP_SUCC, response);
|
INITSTRUCT(sP_FE2CL_REP_PC_TASK_STOP_SUCC, response);
|
||||||
Player *plr = PlayerManager::getPlayer(sock);
|
Player* plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
// update player
|
// update player
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ACTIVE_MISSION_COUNT; i++) {
|
for (i = 0; i < ACTIVE_MISSION_COUNT; i++) {
|
||||||
if (plr->tasks[i] == missionData->iTaskNum)
|
if (plr->tasks[i] == taskNum)
|
||||||
{
|
{
|
||||||
plr->tasks[i] = 0;
|
plr->tasks[i] = 0;
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
@ -177,7 +181,7 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
|
|||||||
// remove current mission
|
// remove current mission
|
||||||
plr->CurrentMissionID = 0;
|
plr->CurrentMissionID = 0;
|
||||||
|
|
||||||
TaskData& task = *Tasks[missionData->iTaskNum];
|
TaskData& task = *Tasks[taskNum];
|
||||||
|
|
||||||
// clean up quest items
|
// clean up quest items
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
@ -193,7 +197,7 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
|
|||||||
memset(&plr->QInven[j], 0, sizeof(sItemBase));
|
memset(&plr->QInven[j], 0, sizeof(sItemBase));
|
||||||
}
|
}
|
||||||
|
|
||||||
response.iTaskNum = missionData->iTaskNum;
|
response.iTaskNum = taskNum;
|
||||||
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_STOP_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_STOP_SUCC));
|
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_TASK_STOP_SUCC, sizeof(sP_FE2CL_REP_PC_TASK_STOP_SUCC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,4 +56,5 @@ namespace MissionManager {
|
|||||||
void mobKilled(CNSocket *sock, int mobid);
|
void mobKilled(CNSocket *sock, int mobid);
|
||||||
|
|
||||||
void saveMission(Player* player, int missionId);
|
void saveMission(Player* player, int missionId);
|
||||||
|
void quitTask(CNSocket* sock, int32_t taskNum);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ int32_t NPCManager::nextId;
|
|||||||
|
|
||||||
void NPCManager::init() {
|
void NPCManager::init() {
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_WARP_USE_NPC, npcWarpHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_WARP_USE_NPC, npcWarpHandler);
|
||||||
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_TIME_TO_GO_WARP, npcWarpTimeMachine);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NPC_SUMMON, npcSummonHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NPC_SUMMON, npcSummonHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NPC_UNSUMMON, npcUnsummonHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NPC_UNSUMMON, npcUnsummonHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_BARKER, npcBarkHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_BARKER, npcBarkHandler);
|
||||||
@ -537,17 +538,28 @@ void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
return; // malformed packet
|
return; // malformed packet
|
||||||
|
|
||||||
sP_CL2FE_REQ_PC_WARP_USE_NPC* warpNpc = (sP_CL2FE_REQ_PC_WARP_USE_NPC*)data->buf;
|
sP_CL2FE_REQ_PC_WARP_USE_NPC* warpNpc = (sP_CL2FE_REQ_PC_WARP_USE_NPC*)data->buf;
|
||||||
PlayerView& plrv = PlayerManager::players[sock];
|
handleWarp(sock, warpNpc->iWarpID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPCManager::npcWarpTimeMachine(CNSocket* sock, CNPacketData* data) {
|
||||||
|
if (data->size != sizeof(sP_CL2FE_REQ_PC_TIME_TO_GO_WARP))
|
||||||
|
return; // malformed packet
|
||||||
|
// this is just a warp request
|
||||||
|
handleWarp(sock, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
|
||||||
// sanity check
|
// sanity check
|
||||||
if (Warps.find(warpNpc->iWarpID) == Warps.end())
|
if (Warps.find(warpId) == Warps.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
PlayerView& plrv = PlayerManager::players[sock];
|
||||||
|
|
||||||
// send to client
|
// send to client
|
||||||
INITSTRUCT(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC, resp);
|
INITSTRUCT(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC, resp);
|
||||||
resp.iX = Warps[warpNpc->iWarpID].x;
|
resp.iX = Warps[warpId].x;
|
||||||
resp.iY = Warps[warpNpc->iWarpID].y;
|
resp.iY = Warps[warpId].y;
|
||||||
resp.iZ = Warps[warpNpc->iWarpID].z;
|
resp.iZ = Warps[warpId].z;
|
||||||
|
|
||||||
// force player & NPC reload
|
// force player & NPC reload
|
||||||
PlayerManager::removePlayerFromChunks(plrv.currentChunks, sock);
|
PlayerManager::removePlayerFromChunks(plrv.currentChunks, sock);
|
||||||
|
@ -35,6 +35,7 @@ namespace NPCManager {
|
|||||||
void npcSummonHandler(CNSocket* sock, CNPacketData* data);
|
void npcSummonHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void npcUnsummonHandler(CNSocket* sock, CNPacketData* data);
|
void npcUnsummonHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void npcWarpHandler(CNSocket* sock, CNPacketData* data);
|
void npcWarpHandler(CNSocket* sock, CNPacketData* data);
|
||||||
|
void npcWarpTimeMachine(CNSocket* sock, CNPacketData* data);
|
||||||
|
|
||||||
void npcVendorStart(CNSocket* sock, CNPacketData* data);
|
void npcVendorStart(CNSocket* sock, CNPacketData* data);
|
||||||
void npcVendorTable(CNSocket* sock, CNPacketData* data);
|
void npcVendorTable(CNSocket* sock, CNPacketData* data);
|
||||||
@ -43,4 +44,6 @@ namespace NPCManager {
|
|||||||
void npcVendorBuyback(CNSocket* sock, CNPacketData* data);
|
void npcVendorBuyback(CNSocket* sock, CNPacketData* data);
|
||||||
void npcVendorBuyBattery(CNSocket* sock, CNPacketData* data);
|
void npcVendorBuyBattery(CNSocket* sock, CNPacketData* data);
|
||||||
void npcCombineItems(CNSocket* sock, CNPacketData* data);
|
void npcCombineItems(CNSocket* sock, CNPacketData* data);
|
||||||
|
|
||||||
|
void handleWarp(CNSocket* sock, int32_t warpId);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ std::set<int> TreasureFinderPowers = {26, 40, 74};
|
|||||||
* worker functions so we don't have to have unsightly function declarations.
|
* worker functions so we don't have to have unsightly function declarations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
std::map<int32_t, NanoData> NanoManager::NanoTable;
|
||||||
|
|
||||||
}; // namespace
|
}; // namespace
|
||||||
|
|
||||||
void NanoManager::init() {
|
void NanoManager::init() {
|
||||||
@ -47,6 +49,7 @@ void NanoManager::init() {
|
|||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_GIVE_NANO_SKILL, nanoSkillSetGMHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_GIVE_NANO_SKILL, nanoSkillSetGMHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NANO_SKILL_USE, nanoSkillUseHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_NANO_SKILL_USE, nanoSkillUseHandler);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_WARP_USE_RECALL, nanoRecallHandler);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_WARP_USE_RECALL, nanoRecallHandler);
|
||||||
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_CHARGE_NANO_STAMINA, nanoPotionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NanoManager::nanoEquipHandler(CNSocket* sock, CNPacketData* data) {
|
void NanoManager::nanoEquipHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
@ -169,6 +172,35 @@ void NanoManager::nanoRecallHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
// stubbed for now
|
// stubbed for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NanoManager::nanoPotionHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
|
if (data->size != sizeof(sP_CL2FE_REQ_CHARGE_NANO_STAMINA))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player* player = PlayerManager::getPlayer(sock);
|
||||||
|
//sanity check
|
||||||
|
if (player->activeNano == -1 || player->batteryN == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sNano nano = player->Nanos[player->activeNano];
|
||||||
|
int difference = 150 - nano.iStamina;
|
||||||
|
if (player->batteryN < difference)
|
||||||
|
difference = player->batteryN;
|
||||||
|
|
||||||
|
if (difference == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
INITSTRUCT(sP_FE2CL_REP_CHARGE_NANO_STAMINA, response);
|
||||||
|
response.iNanoID = nano.iID;
|
||||||
|
response.iNanoStamina = nano.iStamina + difference;
|
||||||
|
response.iBatteryN = player->batteryN - difference;
|
||||||
|
|
||||||
|
sock->sendPacket((void*)&response, P_FE2CL_REP_CHARGE_NANO_STAMINA, sizeof(sP_FE2CL_REP_CHARGE_NANO_STAMINA));
|
||||||
|
//now update serverside
|
||||||
|
player->batteryN -= difference;
|
||||||
|
player->Nanos[nano.iID].iStamina += difference;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#pragma region Helper methods
|
#pragma region Helper methods
|
||||||
void NanoManager::addNano(CNSocket* sock, int16_t nanoId, int16_t slot) {
|
void NanoManager::addNano(CNSocket* sock, int16_t nanoId, int16_t slot) {
|
||||||
if (nanoId > 36)
|
if (nanoId > 36)
|
||||||
@ -578,6 +610,13 @@ void NanoManager::nanoUnbuff(CNSocket* sock, int32_t iCBFlag, int16_t eCharStatu
|
|||||||
sock->sendPacket((void*)&resp1, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
sock->sendPacket((void*)&resp1, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0=A 1=B 2=C -1=Not found
|
||||||
|
int NanoManager::nanoStyle(int nanoId) {
|
||||||
|
if (nanoId < 0 || nanoId >= NanoTable.size())
|
||||||
|
return -1;
|
||||||
|
return NanoTable[nanoId].style;
|
||||||
|
}
|
||||||
|
|
||||||
namespace NanoManager {
|
namespace NanoManager {
|
||||||
|
|
||||||
std::vector<PassivePower> PassivePowers = {
|
std::vector<PassivePower> PassivePowers = {
|
||||||
|
@ -34,9 +34,14 @@ struct PassivePower {
|
|||||||
PassivePower(std::set<int> p, int16_t t, int32_t f, int16_t b, int16_t a) : powers(p), eSkillType(t), iCBFlag(f), eCharStatusTimeBuffID(b), iValue(a) {}
|
PassivePower(std::set<int> p, int16_t t, int32_t f, int16_t b, int16_t a) : powers(p), eSkillType(t), iCBFlag(f), eCharStatusTimeBuffID(b), iValue(a) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NanoData {
|
||||||
|
int style;
|
||||||
|
};
|
||||||
|
|
||||||
namespace NanoManager {
|
namespace NanoManager {
|
||||||
extern std::vector<ActivePower> ActivePowers;
|
extern std::vector<ActivePower> ActivePowers;
|
||||||
extern std::vector<PassivePower> PassivePowers;
|
extern std::vector<PassivePower> PassivePowers;
|
||||||
|
extern std::map<int32_t, NanoData> NanoTable;
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void nanoSummonHandler(CNSocket* sock, CNPacketData* data);
|
void nanoSummonHandler(CNSocket* sock, CNPacketData* data);
|
||||||
@ -47,6 +52,7 @@ namespace NanoManager {
|
|||||||
void nanoSkillSetHandler(CNSocket* sock, CNPacketData* data);
|
void nanoSkillSetHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void nanoSkillSetGMHandler(CNSocket* sock, CNPacketData* data);
|
void nanoSkillSetGMHandler(CNSocket* sock, CNPacketData* data);
|
||||||
void nanoRecallHandler(CNSocket* sock, CNPacketData* data);
|
void nanoRecallHandler(CNSocket* sock, CNPacketData* data);
|
||||||
|
void nanoPotionHandler(CNSocket* sock, CNPacketData* data);
|
||||||
|
|
||||||
// Helper methods
|
// Helper methods
|
||||||
void addNano(CNSocket* sock, int16_t nanoId, int16_t slot);
|
void addNano(CNSocket* sock, int16_t nanoId, int16_t slot);
|
||||||
@ -56,4 +62,6 @@ namespace NanoManager {
|
|||||||
|
|
||||||
void nanoBuff(CNSocket* sock, int16_t nanoId, int skillId, int16_t eSkillType, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
void nanoBuff(CNSocket* sock, int16_t nanoId, int skillId, int16_t eSkillType, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
||||||
void nanoUnbuff(CNSocket* sock, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
void nanoUnbuff(CNSocket* sock, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
||||||
|
|
||||||
|
int nanoStyle(int nanoId);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ void PlayerManager::init() {
|
|||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_SPECIAL_STATE_SWITCH, PlayerManager::setSpecialSwitchPlayer);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_SPECIAL_STATE_SWITCH, PlayerManager::setSpecialSwitchPlayer);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VEHICLE_ON, PlayerManager::enterPlayerVehicle);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VEHICLE_ON, PlayerManager::enterPlayerVehicle);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VEHICLE_OFF, PlayerManager::exitPlayerVehicle);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VEHICLE_OFF, PlayerManager::exitPlayerVehicle);
|
||||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_CHANGE_MENTOR, PlayerManager::changePlayerGuide);
|
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_CHANGE_MENTOR, PlayerManager::changePlayerGuide);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerManager::addPlayer(CNSocket* key, Player plr) {
|
void PlayerManager::addPlayer(CNSocket* key, Player plr) {
|
||||||
@ -819,7 +819,17 @@ void PlayerManager::changePlayerGuide(CNSocket *sock, CNPacketData *data) {
|
|||||||
resp.iFusionMatter = plr->fusionmatter; // no cost
|
resp.iFusionMatter = plr->fusionmatter; // no cost
|
||||||
|
|
||||||
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_CHANGE_MENTOR_SUCC, sizeof(sP_FE2CL_REP_PC_CHANGE_MENTOR_SUCC));
|
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_CHANGE_MENTOR_SUCC, sizeof(sP_FE2CL_REP_PC_CHANGE_MENTOR_SUCC));
|
||||||
//save it on player
|
// if it's changed from computress
|
||||||
|
if (plr->mentor == 5) {
|
||||||
|
// we're warping to the past
|
||||||
|
plr->PCStyle2.iPayzoneFlag = 1;
|
||||||
|
// remove all active missions
|
||||||
|
for (int i = 0; i < ACTIVE_MISSION_COUNT; i++) {
|
||||||
|
if (plr->tasks[i] != 0)
|
||||||
|
MissionManager::quitTask(sock, plr->tasks[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// save it on player
|
||||||
plr->mentor = pkt->iMentor;
|
plr->mentor = pkt->iMentor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "MissionManager.hpp"
|
#include "MissionManager.hpp"
|
||||||
#include "MobManager.hpp"
|
#include "MobManager.hpp"
|
||||||
#include "ChunkManager.hpp"
|
#include "ChunkManager.hpp"
|
||||||
|
#include "NanoManager.hpp"
|
||||||
|
|
||||||
#include "contrib/JSON.hpp"
|
#include "contrib/JSON.hpp"
|
||||||
|
|
||||||
@ -152,6 +153,17 @@ void TableData::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "[INFO] Loaded " << ItemManager::CrocPotTable.size() << " croc pot value sets" << std::endl;
|
std::cout << "[INFO] Loaded " << ItemManager::CrocPotTable.size() << " croc pot value sets" << std::endl;
|
||||||
|
|
||||||
|
//load nano info
|
||||||
|
nlohmann::json nanoInfo = xdtData["m_pNanoTable"]["m_pNanoData"];
|
||||||
|
for (nlohmann::json::iterator _nano = nanoInfo.begin(); _nano != nanoInfo.end(); _nano++) {
|
||||||
|
auto nano = _nano.value();
|
||||||
|
NanoData nanoData;
|
||||||
|
nanoData.style = nano["m_iStyle"];
|
||||||
|
NanoManager::NanoTable[nano["m_iNanoNumber"]] = nanoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "[INFO] Loaded " << NanoManager::NanoTable.size() << " nanos" << std::endl;
|
||||||
}
|
}
|
||||||
catch (const std::exception& err) {
|
catch (const std::exception& err) {
|
||||||
std::cerr << "[WARN] Malformed xdt.json file! Reason:" << err.what() << std::endl;
|
std::cerr << "[WARN] Malformed xdt.json file! Reason:" << err.what() << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user