feat(parity): implement skill cooldown end, server emotions, target packets and render target parity (pass31)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "ava2_text_file.h"
|
||||
#include "shared/common/PythonUtils.h"
|
||||
#include "NetworkActorManager.h"
|
||||
#include "eter_render/RaceData.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@@ -186,22 +188,109 @@ void PythonNetworkStream::ServerCommand(const std::string& command) {
|
||||
m_bComboSkillFlag = atoi(arg(1)) != 0;
|
||||
} else if (!strcasecmp(szCmd, "setblockmode")) {
|
||||
call("OnBlockMode", Py_BuildValue("(i)", atoi(arg(1))));
|
||||
// Emotion Start
|
||||
} else if (!strcasecmp(szCmd, "french_kiss")) {
|
||||
if (TokenVector.size() >= 3) {
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_FRENCH_KISS_START, CRaceMotionData::NAME_FRENCH_KISS_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "kiss")) {
|
||||
if (TokenVector.size() >= 3) {
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_KISS_START, CRaceMotionData::NAME_KISS_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "slap")) {
|
||||
if (TokenVector.size() >= 3) {
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_SLAP_HURT_START, CRaceMotionData::NAME_SLAP_HIT_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "clap")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CLAP);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "cheer1")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CHEERS_1);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "cheer2")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CHEERS_2);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "dance1")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DANCE_1);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "dance2")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DANCE_2);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "dig_motion")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DIG);
|
||||
}
|
||||
// Emotion End
|
||||
} else {
|
||||
// french_kiss..dig_motion are strcmpi branches; the rest is s_emotionDict (case sensitive).
|
||||
static const char* const namedEmotions[] = {
|
||||
"french_kiss", "kiss", "slap", "clap", "cheer1", "cheer2", "dance1", "dance2", "dig_motion",
|
||||
};
|
||||
static const char* const dictEmotions[] = {
|
||||
"dance3", "dance4", "dance5", "dance6", "congratulation", "forgive", "angry", "attractive",
|
||||
"sad", "shy", "cheerup", "banter", "joy",
|
||||
};
|
||||
bool isEmotion = false;
|
||||
for (const char* emotion : namedEmotions) isEmotion = isEmotion || !strcasecmp(szCmd, emotion);
|
||||
for (const char* emotion : dictEmotions) isEmotion = isEmotion || TokenVector[0] == emotion;
|
||||
if (isEmotion)
|
||||
TraceError("ServerCommand emotion not ported (CInstanceBase::ActEmotion): " + command);
|
||||
else
|
||||
TraceError("Unknown Server Command " + command + " | " + TokenVector[0]);
|
||||
static std::map<std::string, int> s_emotionDict;
|
||||
static bool s_isFirst = true;
|
||||
if (s_isFirst) {
|
||||
s_isFirst = false;
|
||||
s_emotionDict["dance3"] = CRaceMotionData::NAME_DANCE_3;
|
||||
s_emotionDict["dance4"] = CRaceMotionData::NAME_DANCE_4;
|
||||
s_emotionDict["dance5"] = CRaceMotionData::NAME_DANCE_5;
|
||||
s_emotionDict["dance6"] = CRaceMotionData::NAME_DANCE_6;
|
||||
s_emotionDict["congratulation"] = CRaceMotionData::NAME_CONGRATULATION;
|
||||
s_emotionDict["forgive"] = CRaceMotionData::NAME_FORGIVE;
|
||||
s_emotionDict["angry"] = CRaceMotionData::NAME_ANGRY;
|
||||
s_emotionDict["attractive"] = CRaceMotionData::NAME_ATTRACTIVE;
|
||||
s_emotionDict["sad"] = CRaceMotionData::NAME_SAD;
|
||||
s_emotionDict["shy"] = CRaceMotionData::NAME_SHY;
|
||||
s_emotionDict["cheerup"] = CRaceMotionData::NAME_CHEERUP;
|
||||
s_emotionDict["banter"] = CRaceMotionData::NAME_BANTER;
|
||||
s_emotionDict["joy"] = CRaceMotionData::NAME_JOY;
|
||||
}
|
||||
|
||||
auto f = s_emotionDict.find(szCmd);
|
||||
if (f == s_emotionDict.end()) {
|
||||
TraceError("Unknown Server Command " + command + " | " + szCmd);
|
||||
} else {
|
||||
int emotionIndex = f->second;
|
||||
if (TokenVector.size() >= 2) {
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
auto pInstance = NetworkActorManager::Instance().GetActorInstance(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(emotionIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user