Tuned various values.

* The player no longer receives the Blossom nano mission until they've
left the future
* As a temporary measure for the sake of the public server, Fusions in
respawn in their lairs after 2.5 minutes
* Changed default player damage value to 150
* Mobs now drop the correct amount of FM, as well as a close
approximation of the correct amount of taros
* You can no longer break the FM cap in the Future zone
* Fixed the updateFusionMatter() bug the right way this time
* Completing a nano mission now subtracts FM as it should
* Setting a Nano's power no longer reports 0 FM to the client
This commit is contained in:
dongresource 2020-09-26 03:48:45 +02:00
parent dccd92aff9
commit 9657aaf202
8 changed files with 38 additions and 15 deletions

View File

@ -9,7 +9,7 @@
std::map<int32_t, Reward*> MissionManager::Rewards;
std::map<int32_t, TaskData*> MissionManager::Tasks;
nlohmann::json MissionManager::AvatarGrowth[36];
nlohmann::json MissionManager::AvatarGrowth[37];
void MissionManager::init() {
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_TASK_START, taskStart);
@ -162,7 +162,7 @@ bool MissionManager::endTask(CNSocket *sock, int32_t taskNum) {
// if it's a nano mission, reward the nano.
if (task["m_iSTNanoID"] != 0) {
NanoManager::addNano(sock, task["m_iSTNanoID"], 0);
NanoManager::addNano(sock, task["m_iSTNanoID"], 0, true);
// check if the player already has enough fm for the next mission
updateFusionMatter(sock, 0);
}
@ -369,12 +369,18 @@ void MissionManager::updateFusionMatter(CNSocket* sock, int fusion) {
plr->fusionmatter += fusion;
// sanity check
if (plr->level >= 36)
// there's a much lower FM cap in the Future
if (plr->fusionmatter > AvatarGrowth[plr->level]["m_iFMLimit"])
plr->fusionmatter = AvatarGrowth[plr->level]["m_iFMLimit"];
else if (plr->fusionmatter < 0) // if somehow lowered too far
plr->fusionmatter = 0;
// check if it is enough for the nano mission
if (plr->fusionmatter <= AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"])
return;
// check if it is over the limit
if (plr->fusionmatter <= AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"])
// don't give the Blossom nano mission until the player's in the Past
if (plr->level == 4 && plr->PCStyle2.iPayzoneFlag == 0)
return;
// check if the nano task is already started

View File

@ -38,7 +38,7 @@ struct TaskData {
namespace MissionManager {
extern std::map<int32_t, Reward*> Rewards;
extern std::map<int32_t, TaskData*> Tasks;
extern nlohmann::json AvatarGrowth[36];
extern nlohmann::json AvatarGrowth[37];
void init();
void taskStart(CNSocket* sock, CNPacketData* data);

View File

@ -60,7 +60,7 @@ void MobManager::pcAttackNpcs(CNSocket *sock, CNPacketData *data) {
}
Mob *mob = Mobs[pktdata[i]];
int damage = hitMob(sock, mob, 100);
int damage = hitMob(sock, mob, 150);
respdata[i].iID = mob->appearanceData.iNPC_ID;
respdata[i].iDamage = damage;
@ -129,9 +129,9 @@ void MobManager::giveReward(CNSocket *sock) {
// don't forget to zero the buffer!
memset(respbuf, 0, resplen);
// update player
plr->money += 50;
MissionManager::updateFusionMatter(sock, 70);
// NOTE: these will need to be scaled according to the player/mob level difference
plr->money += (int)MissionManager::AvatarGrowth[plr->level]["m_iMobFM"]; // this one's innacurate, but close enough for now
MissionManager::updateFusionMatter(sock, MissionManager::AvatarGrowth[plr->level]["m_iMobFM"]);
// simple rewards
reward->m_iCandy = plr->money;

View File

@ -51,6 +51,10 @@ struct Mob : public BaseNPC {
regenTime = data["m_iRegenTime"];
idleRange = data["m_iIdleRange"];
// XXX: temporarily force respawns for Fusions until we implement instancing
if (regenTime >= 300000000)
regenTime = 1500;
spawnX = appearanceData.iX;
spawnY = appearanceData.iY;
spawnZ = appearanceData.iZ;

View File

@ -4,6 +4,7 @@
#include "PlayerManager.hpp"
#include "NPCManager.hpp"
#include "MobManager.hpp"
#include "MissionManager.hpp"
namespace NanoManager {
@ -202,7 +203,7 @@ void NanoManager::nanoPotionHandler(CNSocket* sock, CNPacketData* data) {
}
#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, bool spendfm) {
if (nanoId > 36)
return;
@ -210,13 +211,21 @@ void NanoManager::addNano(CNSocket* sock, int16_t nanoId, int16_t slot) {
int level = nanoId < plr->level ? plr->level : nanoId;
/*
* Spend the necessary Fusion Matter.
* Note the use of the not-yet-incremented plr->level as opposed to level.
* Doing it the other way always leaves the FM at 0. Jade totally called it.
*/
if (spendfm)
MissionManager::updateFusionMatter(sock, -(int)MissionManager::AvatarGrowth[plr->level]["m_iReqBlob_NanoCreate"]);
// Send to client
INITSTRUCT(sP_FE2CL_REP_PC_NANO_CREATE_SUCC, resp);
resp.Nano.iID = nanoId;
resp.Nano.iStamina = 150;
resp.iQuestItemSlotNum = slot;
resp.iPC_Level = level;
resp.iPC_FusionMatter = plr->fusionmatter; // will decrease in actual nano missions
resp.iPC_FusionMatter = plr->fusionmatter;
// Update player
plr->Nanos[nanoId] = resp.Nano;
@ -307,6 +316,7 @@ void NanoManager::setNanoSkill(CNSocket* sock, int16_t nanoId, int16_t skillId)
INITSTRUCT(sP_FE2CL_REP_NANO_TUNE_SUCC, resp);
resp.iNanoID = nanoId;
resp.iSkillID = skillId;
resp.iPC_FusionMatter = plr->fusionmatter;
resp.aItem[9] = plr->Inven[0]; // temp fix for a bug TODO: Use this for nano power changing later
sock->sendPacket((void*)&resp, P_FE2CL_REP_NANO_TUNE_SUCC, sizeof(sP_FE2CL_REP_NANO_TUNE_SUCC));

View File

@ -55,7 +55,7 @@ namespace NanoManager {
void nanoPotionHandler(CNSocket* sock, CNPacketData* data);
// Helper methods
void addNano(CNSocket* sock, int16_t nanoId, int16_t slot);
void addNano(CNSocket* sock, int16_t nanoId, int16_t slot, bool spendfm=false);
void summonNano(CNSocket* sock, int slot);
void setNanoSkill(CNSocket* sock, int16_t nanoId, int16_t skillId);
void resetNanoSkill(CNSocket* sock, int16_t nanoId);

View File

@ -832,6 +832,9 @@ void PlayerManager::changePlayerGuide(CNSocket *sock, CNPacketData *data) {
if (plr->tasks[i] != 0)
MissionManager::quitTask(sock, plr->tasks[i]);
}
// start Blossom nano mission if applicable
MissionManager::updateFusionMatter(sock, 0);
}
// save it on player
plr->mentor = pkt->iMentor;

View File

@ -128,7 +128,7 @@ void TableData::init() {
nlohmann::json growth = xdtData["m_pAvatarTable"]["m_pAvatarGrowData"];
for (int i = 0; i < 36; i++) {
for (int i = 0; i < 37; i++) {
MissionManager::AvatarGrowth[i] = growth[i];
}