mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Gumball Handling and Bugfixes
* Gumballs now run out of timer. * Reverted a regression, (gumballs with 0 iOpt do not get emptied). * Nano matchups now work correctly.
This commit is contained in:
parent
f7c0596a4c
commit
2b25b17bd8
@ -3,6 +3,7 @@
|
|||||||
#include "ItemManager.hpp"
|
#include "ItemManager.hpp"
|
||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
#include "NanoManager.hpp"
|
#include "NanoManager.hpp"
|
||||||
|
#include "NPCManager.hpp"
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
|
|
||||||
#include <string.h> // for memset()
|
#include <string.h> // for memset()
|
||||||
@ -271,6 +272,9 @@ void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gumball.iOpt == 0)
|
||||||
|
gumball = {};
|
||||||
|
|
||||||
uint8_t respbuf[CN_PACKET_BUFFER_SIZE];
|
uint8_t respbuf[CN_PACKET_BUFFER_SIZE];
|
||||||
memset(respbuf, 0, resplen);
|
memset(respbuf, 0, resplen);
|
||||||
|
|
||||||
@ -282,7 +286,13 @@ void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
resp->RemainItem = gumball;
|
resp->RemainItem = gumball;
|
||||||
resp->iTargetCnt = 1;
|
resp->iTargetCnt = 1;
|
||||||
resp->eST = EST_NANOSTIMPAK;
|
resp->eST = EST_NANOSTIMPAK;
|
||||||
resp->iSkillID = 144;
|
|
||||||
|
if (request->iNanoSlot == 1)
|
||||||
|
resp->iSkillID = 191;
|
||||||
|
else if (request->iNanoSlot == 2)
|
||||||
|
resp->iSkillID = 197;
|
||||||
|
else
|
||||||
|
resp->iSkillID = 144;
|
||||||
|
|
||||||
int value1 = CSB_BIT_STIMPAKSLOT1 << request->iNanoSlot;
|
int value1 = CSB_BIT_STIMPAKSLOT1 << request->iNanoSlot;
|
||||||
int value2 = ECSB_STIMPAKSLOT1 + request->iNanoSlot;
|
int value2 = ECSB_STIMPAKSLOT1 + request->iNanoSlot;
|
||||||
@ -301,6 +311,10 @@ void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
sock->sendPacket((void*)&respbuf, P_FE2CL_REP_PC_ITEM_USE_SUCC, resplen);
|
sock->sendPacket((void*)&respbuf, P_FE2CL_REP_PC_ITEM_USE_SUCC, resplen);
|
||||||
// update inventory serverside
|
// update inventory serverside
|
||||||
player->Inven[resp->iSlotNum] = resp->RemainItem;
|
player->Inven[resp->iSlotNum] = resp->RemainItem;
|
||||||
|
|
||||||
|
std::pair<CNSocket*, int32_t> key = std::make_pair(sock, resp->iSkillID);
|
||||||
|
time_t until = getTime() + (time_t)NanoManager::SkillTable[resp->iSkillID].durationTime[0] * 10;
|
||||||
|
NPCManager::EggBuffs[key] = until;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemManager::itemBankOpenHandler(CNSocket* sock, CNPacketData* data) {
|
void ItemManager::itemBankOpenHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
|
@ -986,7 +986,11 @@ std::pair<int,int> MobManager::getDamage(int attackPower, int defensePower, bool
|
|||||||
|
|
||||||
// Adaptium/Blastons/Cosmix
|
// Adaptium/Blastons/Cosmix
|
||||||
if (attackerStyle != -1 && defenderStyle != -1 && attackerStyle != defenderStyle) {
|
if (attackerStyle != -1 && defenderStyle != -1 && attackerStyle != defenderStyle) {
|
||||||
if (attackerStyle < defenderStyle || attackerStyle - defenderStyle == 2)
|
if (attackerStyle - defenderStyle == 2)
|
||||||
|
defenderStyle += 3;
|
||||||
|
if (defenderStyle - attackerStyle == 2)
|
||||||
|
defenderStyle -= 3;
|
||||||
|
if (attackerStyle < defenderStyle)
|
||||||
damage = damage * 3 / 2;
|
damage = damage * 3 / 2;
|
||||||
else
|
else
|
||||||
damage = damage * 2 / 3;
|
damage = damage * 2 / 3;
|
||||||
|
@ -582,7 +582,7 @@ int NPCManager::eggBuffPlayer(CNSocket* sock, int skillId, int eggId) {
|
|||||||
int bitFlag = GroupManager::getGroupFlags(otherPlr);
|
int bitFlag = GroupManager::getGroupFlags(otherPlr);
|
||||||
|
|
||||||
if (EggBuffs.find(key) == EggBuffs.end())
|
if (EggBuffs.find(key) == EggBuffs.end())
|
||||||
if (!NanoManager::applyBuff(sock, skillId, 1, 3, bitFlag, true))
|
if (!NanoManager::applyBuff(sock, skillId, 1, 3, bitFlag))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// save the buff serverside;
|
// save the buff serverside;
|
||||||
@ -719,7 +719,7 @@ void NPCManager::eggPickup(CNSocket* sock, CNPacketData* data) {
|
|||||||
sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK* pkt = (sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK*)respbuf;
|
sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK* pkt = (sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK*)respbuf;
|
||||||
sSkillResult_Damage* dmg = (sSkillResult_Damage*)(respbuf + sizeof(sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK));
|
sSkillResult_Damage* dmg = (sSkillResult_Damage*)(respbuf + sizeof(sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK));
|
||||||
|
|
||||||
dmg->iDamage = PC_MAXHEALTH(plr->level) * 6 / 10;
|
dmg->iDamage = PC_MAXHEALTH(plr->level) * 73 / 100;
|
||||||
|
|
||||||
plr->HP -= dmg->iDamage;
|
plr->HP -= dmg->iDamage;
|
||||||
|
|
||||||
|
@ -469,7 +469,8 @@ void NanoManager::nanoUnbuff(CNSocket* sock, int targetData[], int32_t bitFlag,
|
|||||||
resp.eCSTB = timeBuffID; // eCharStatusTimeBuffID
|
resp.eCSTB = timeBuffID; // eCharStatusTimeBuffID
|
||||||
resp.eTBU = 2; // eTimeBuffUpdate
|
resp.eTBU = 2; // eTimeBuffUpdate
|
||||||
resp.eTBT = 1; // eTimeBuffType 1 means nano
|
resp.eTBT = 1; // eTimeBuffType 1 means nano
|
||||||
resp.iConditionBitFlag = varPlr->iConditionBitFlag = groupFlags | varPlr->iSelfConditionBitFlag;
|
varPlr->iConditionBitFlag &= ~bitFlag;
|
||||||
|
resp.iConditionBitFlag = varPlr->iConditionBitFlag |= groupFlags | varPlr->iSelfConditionBitFlag;
|
||||||
|
|
||||||
if (amount > 0)
|
if (amount > 0)
|
||||||
resp.TimeBuff.iValue = amount;
|
resp.TimeBuff.iValue = amount;
|
||||||
@ -479,7 +480,7 @@ void NanoManager::nanoUnbuff(CNSocket* sock, int targetData[], int32_t bitFlag,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NanoManager::applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags, bool eggBuff) {
|
bool NanoManager::applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags) {
|
||||||
if (SkillTable[skillID].drainType == 1)
|
if (SkillTable[skillID].drainType == 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -494,9 +495,22 @@ bool NanoManager::applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int
|
|||||||
resp.eCSTB = pwr.timeBuffID;
|
resp.eCSTB = pwr.timeBuffID;
|
||||||
resp.eTBU = eTBU;
|
resp.eTBU = eTBU;
|
||||||
resp.eTBT = eTBT;
|
resp.eTBT = eTBT;
|
||||||
resp.iConditionBitFlag = plr->iConditionBitFlag = groupFlags | plr->iSelfConditionBitFlag;
|
|
||||||
if (eggBuff)
|
if (skillID == 191) { // dealing with gumballs
|
||||||
resp.iConditionBitFlag = plr->iConditionBitFlag |= bitFlag;
|
resp.eCSTB = pwr.timeBuffID + 1;
|
||||||
|
bitFlag = bitFlag << 1;
|
||||||
|
} else if (skillID == 197) {
|
||||||
|
resp.eCSTB = pwr.timeBuffID + 2;
|
||||||
|
bitFlag = bitFlag << 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eTBU == 1)
|
||||||
|
plr->iConditionBitFlag |= bitFlag;
|
||||||
|
else
|
||||||
|
plr->iConditionBitFlag &= ~bitFlag;
|
||||||
|
|
||||||
|
resp.iConditionBitFlag = plr->iConditionBitFlag |= groupFlags | plr->iSelfConditionBitFlag;
|
||||||
|
|
||||||
resp.TimeBuff.iValue = SkillTable[skillID].powerIntensity[0];
|
resp.TimeBuff.iValue = SkillTable[skillID].powerIntensity[0];
|
||||||
|
|
||||||
sock->sendPacket((void*)&resp, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
sock->sendPacket((void*)&resp, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
||||||
@ -864,7 +878,7 @@ void nanoPower(CNSocket *sock, int targetData[],
|
|||||||
// nano power dispatch table
|
// nano power dispatch table
|
||||||
std::vector<NanoPower> NanoPowers = {
|
std::vector<NanoPower> NanoPowers = {
|
||||||
NanoPower(EST_STUN, CSB_BIT_STUN, ECSB_STUN, nanoPower<sSkillResult_Damage_N_Debuff, doDamageNDebuff>),
|
NanoPower(EST_STUN, CSB_BIT_STUN, ECSB_STUN, nanoPower<sSkillResult_Damage_N_Debuff, doDamageNDebuff>),
|
||||||
NanoPower(EST_HEAL_HP, CSB_BIT_HEAL, ECSB_HEAL, nanoPower<sSkillResult_Heal_HP, doHeal>),
|
NanoPower(EST_HEAL_HP, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Heal_HP, doHeal>),
|
||||||
NanoPower(EST_BOUNDINGBALL, CSB_BIT_BOUNDINGBALL, ECSB_BOUNDINGBALL, nanoPower<sSkillResult_Buff, doDebuff>),
|
NanoPower(EST_BOUNDINGBALL, CSB_BIT_BOUNDINGBALL, ECSB_BOUNDINGBALL, nanoPower<sSkillResult_Buff, doDebuff>),
|
||||||
NanoPower(EST_SNARE, CSB_BIT_DN_MOVE_SPEED, ECSB_DN_MOVE_SPEED, nanoPower<sSkillResult_Damage_N_Debuff, doDamageNDebuff>),
|
NanoPower(EST_SNARE, CSB_BIT_DN_MOVE_SPEED, ECSB_DN_MOVE_SPEED, nanoPower<sSkillResult_Damage_N_Debuff, doDamageNDebuff>),
|
||||||
NanoPower(EST_DAMAGE, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Damage, doDamage>),
|
NanoPower(EST_DAMAGE, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Damage, doDamage>),
|
||||||
@ -884,7 +898,8 @@ std::vector<NanoPower> NanoPowers = {
|
|||||||
NanoPower(EST_RECALL, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Move, doMove>),
|
NanoPower(EST_RECALL, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Move, doMove>),
|
||||||
NanoPower(EST_RECALL_GROUP, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Move, doMove>),
|
NanoPower(EST_RECALL_GROUP, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Move, doMove>),
|
||||||
NanoPower(EST_RETROROCKET_SELF, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Buff, doBuff>),
|
NanoPower(EST_RETROROCKET_SELF, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Buff, doBuff>),
|
||||||
NanoPower(EST_PHOENIX_GROUP, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Resurrect, doResurrect>)
|
NanoPower(EST_PHOENIX_GROUP, CSB_BIT_NONE, ECSB_NONE, nanoPower<sSkillResult_Resurrect, doResurrect>),
|
||||||
|
NanoPower(EST_NANOSTIMPAK, CSB_BIT_STIMPAKSLOT1, ECSB_STIMPAKSLOT1, nanoPower<sSkillResult_Buff, doBuff>)
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace
|
}; // namespace
|
||||||
|
@ -65,7 +65,7 @@ namespace NanoManager {
|
|||||||
void setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill);
|
void setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill);
|
||||||
void resetNanoSkill(CNSocket* sock, int16_t nanoID);
|
void resetNanoSkill(CNSocket* sock, int16_t nanoID);
|
||||||
void nanoUnbuff(CNSocket* sock, int* targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);
|
void nanoUnbuff(CNSocket* sock, int* targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);
|
||||||
bool applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags, bool eggBuff=false);
|
bool applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags);
|
||||||
int nanoStyle(int nanoID);
|
int nanoStyle(int nanoID);
|
||||||
int* findTargets(Player* plr, int skillID, CNPacketData* data = nullptr);
|
int* findTargets(Player* plr, int skillID, CNPacketData* data = nullptr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user