mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 14:01:05 +00:00
Compare commits
5 Commits
b1613639f5
...
0d26ff5370
Author | SHA1 | Date | |
---|---|---|---|
|
0d26ff5370 | ||
|
d8b63a043e | ||
|
f2447cd940 | ||
|
97dca62fd0 | ||
d3bef95a7f |
@ -359,23 +359,19 @@ static void npcRotateCommand(std::string full, std::vector<std::string>& args, C
|
|||||||
int angle = (plr->angle + 180) % 360;
|
int angle = (plr->angle + 180) % 360;
|
||||||
NPCManager::updateNPCPosition(npc->id, npc->x, npc->y, npc->z, npc->instanceID, angle);
|
NPCManager::updateNPCPosition(npc->id, npc->x, npc->y, npc->z, npc->instanceID, angle);
|
||||||
|
|
||||||
// if it's a gruntwork NPC, rotate in-place
|
bool isGruntworkNpc = true;
|
||||||
if (TableData::RunningMobs.find(npc->id) != TableData::RunningMobs.end()) {
|
|
||||||
NPCManager::updateNPCPosition(npc->id, npc->x, npc->y, npc->z, npc->instanceID, angle);
|
|
||||||
|
|
||||||
Chat::sendServerMessage(sock, "[NPCR] Successfully set angle to " + std::to_string(angle) + " for gruntwork NPC "
|
// add a rotation entry to the gruntwork file, unless it's already a gruntwork NPC
|
||||||
+ std::to_string(npc->id));
|
if (TableData::RunningMobs.find(npc->id) == TableData::RunningMobs.end()) {
|
||||||
} else {
|
|
||||||
TableData::RunningNPCRotations[npc->id] = angle;
|
TableData::RunningNPCRotations[npc->id] = angle;
|
||||||
|
isGruntworkNpc = false;
|
||||||
Chat::sendServerMessage(sock, "[NPCR] Successfully set angle to " + std::to_string(angle) + " for NPC "
|
|
||||||
+ std::to_string(npc->id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update rotation clientside
|
Chat::sendServerMessage(sock, "[NPCR] Successfully set angle to " + std::to_string(angle) +
|
||||||
INITSTRUCT(sP_FE2CL_NPC_ENTER, pkt);
|
" for " + (isGruntworkNpc ? "gruntwork " : "") + "NPC " + std::to_string(npc->id));
|
||||||
pkt.NPCAppearanceData = npc->getAppearanceData();
|
|
||||||
sock->sendPacket(pkt, P_FE2CL_NPC_ENTER);
|
// update rotation clientside by refreshing the player's chunks (same as the /refresh command)
|
||||||
|
PlayerManager::updatePlayerPositionForWarp(sock, plr->x, plr->y, plr->z, plr->instanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void refreshCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
static void refreshCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||||
|
54
src/Eggs.cpp
54
src/Eggs.cpp
@ -26,6 +26,7 @@ void Eggs::eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkillResult result = SkillResult();
|
||||||
SkillData* skill = &Abilities::SkillTable[skillId];
|
SkillData* skill = &Abilities::SkillTable[skillId];
|
||||||
if(skill->drainType == SkillDrainType::PASSIVE) {
|
if(skill->drainType == SkillDrainType::PASSIVE) {
|
||||||
// apply buff
|
// apply buff
|
||||||
@ -50,12 +51,57 @@ void Eggs::eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration) {
|
|||||||
// no-op
|
// no-op
|
||||||
},
|
},
|
||||||
&eggBuff);
|
&eggBuff);
|
||||||
|
|
||||||
|
sSkillResult_Buff resultBuff{};
|
||||||
|
resultBuff.eCT = plr->getCharType();
|
||||||
|
resultBuff.iID = plr->getID();
|
||||||
|
resultBuff.bProtected = false;
|
||||||
|
resultBuff.iConditionBitFlag = plr->getCompositeCondition();
|
||||||
|
result = SkillResult(sizeof(sSkillResult_Buff), &resultBuff);
|
||||||
|
} else {
|
||||||
|
int value = plr->getMaxHP() * skill->values[0][0] / 1000;
|
||||||
|
sSkillResult_Damage resultDamage{};
|
||||||
|
sSkillResult_Heal_HP resultHeal{};
|
||||||
|
switch(skill->skillType)
|
||||||
|
{
|
||||||
|
case SkillType::DAMAGE:
|
||||||
|
resultDamage.bProtected = false;
|
||||||
|
resultDamage.eCT = plr->getCharType();
|
||||||
|
resultDamage.iID = plr->getID();
|
||||||
|
resultDamage.iDamage = plr->takeDamage(src, value);
|
||||||
|
resultDamage.iHP = plr->getCurrentHP();
|
||||||
|
result = SkillResult(sizeof(sSkillResult_Damage), &resultDamage);
|
||||||
|
break;
|
||||||
|
case SkillType::HEAL_HP:
|
||||||
|
resultHeal.eCT = plr->getCharType();
|
||||||
|
resultHeal.iID = plr->getID();
|
||||||
|
resultHeal.iHealHP = plr->heal(src, value);
|
||||||
|
resultHeal.iHP = plr->getCurrentHP();
|
||||||
|
result = SkillResult(sizeof(sSkillResult_Heal_HP), &resultHeal);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cout << "[WARN] oops, egg with active skill type " << (int)skill->skillType << " unhandled";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use skill
|
// initialize response struct
|
||||||
std::vector<ICombatant*> targets;
|
size_t resplen = sizeof(sP_FE2CL_NPC_SKILL_HIT) + result.size;
|
||||||
targets.push_back(dynamic_cast<ICombatant*>(plr));
|
uint8_t respbuf[CN_PACKET_BUFFER_SIZE];
|
||||||
Abilities::useNPCSkill(src, skillId, targets);
|
memset(respbuf, 0, resplen);
|
||||||
|
|
||||||
|
sP_FE2CL_NPC_SKILL_HIT* pkt = (sP_FE2CL_NPC_SKILL_HIT*)respbuf;
|
||||||
|
pkt->iNPC_ID = eggId;
|
||||||
|
pkt->iSkillID = skillId;
|
||||||
|
pkt->eST = (int32_t)skill->skillType;
|
||||||
|
pkt->iTargetCnt = 1;
|
||||||
|
|
||||||
|
if(result.size > 0) {
|
||||||
|
void* attached = (void*)(pkt + 1);
|
||||||
|
memcpy(attached, result.payload, result.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
NPCManager::sendToViewable(src.getEntity(), pkt, P_FE2CL_NPC_SKILL_HIT, resplen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eggStep(CNServer* serv, time_t currTime) {
|
static void eggStep(CNServer* serv, time_t currTime) {
|
||||||
|
@ -416,6 +416,7 @@ static void revivePlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
default: // plain respawn
|
default: // plain respawn
|
||||||
plr->HP = PC_MAXHEALTH(plr->level) / 2;
|
plr->HP = PC_MAXHEALTH(plr->level) / 2;
|
||||||
|
plr->clearBuffs(false);
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case ePCRegenType::Unstick: // warp away
|
case ePCRegenType::Unstick: // warp away
|
||||||
move = true;
|
move = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user