[Client] Improve debug for received ActorAI packets

This commit is contained in:
David Cernat 2018-07-11 19:54:56 +03:00
parent ceea65f666
commit 25f7a55495
2 changed files with 15 additions and 10 deletions

View file

@ -216,15 +216,18 @@ void DedicatedActor::setAI()
MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr);
ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0); ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0);
LOG_APPEND(Log::LOG_VERBOSE, "- actor cellRef: %s %i-%i",
ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum());
if (aiAction == mwmp::BaseActorList::CANCEL) if (aiAction == mwmp::BaseActorList::CANCEL)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Cancelling AI sequence"); LOG_APPEND(Log::LOG_VERBOSE, "-- Cancelling AI sequence");
ptrCreatureStats->getAiSequence().clear(); ptrCreatureStats->getAiSequence().clear();
} }
else if (aiAction == mwmp::BaseActorList::TRAVEL) else if (aiAction == mwmp::BaseActorList::TRAVEL)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Travelling to %f, %f, %f", LOG_APPEND(Log::LOG_VERBOSE, "-- Travelling to %f, %f, %f",
aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]);
MWMechanics::AiTravel package(aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); MWMechanics::AiTravel package(aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]);
@ -232,7 +235,7 @@ void DedicatedActor::setAI()
} }
else if (aiAction == mwmp::BaseActorList::WANDER) else if (aiAction == mwmp::BaseActorList::WANDER)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Wandering for distance %i and duration %i, repetition is %s", LOG_APPEND(Log::LOG_VERBOSE, "-- Wandering for distance %i and duration %i, repetition is %s",
aiDistance, aiDuration, aiShouldRepeat ? "true" : "false"); aiDistance, aiDuration, aiShouldRepeat ? "true" : "false");
std::vector<unsigned char> idleList; std::vector<unsigned char> idleList;
@ -248,7 +251,7 @@ void DedicatedActor::setAI()
{ {
targetPtr = MechanicsHelper::getPlayerPtr(aiTarget); targetPtr = MechanicsHelper::getPlayerPtr(aiTarget);
LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has player target %s", LOG_APPEND(Log::LOG_VERBOSE, "-- Has player target %s",
ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(),
targetPtr.getClass().getName(targetPtr).c_str()); targetPtr.getClass().getName(targetPtr).c_str());
} }
@ -263,13 +266,13 @@ void DedicatedActor::setAI()
if (targetPtr) if (targetPtr)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has AI target %s %i-%i", LOG_APPEND(Log::LOG_VERBOSE, "-- Has AI target %s %i-%i",
ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(),
targetPtr.getCellRef().getRefId().c_str(), aiTarget.refNumIndex, aiTarget.mpNum); targetPtr.getCellRef().getRefId().c_str(), aiTarget.refNumIndex, aiTarget.mpNum);
} }
else else
{ {
LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has invalid target AI target %i-%i", LOG_APPEND(Log::LOG_VERBOSE, "-- Has invalid target AI target %i-%i",
ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(),
aiTarget.refNumIndex, aiTarget.mpNum); aiTarget.refNumIndex, aiTarget.mpNum);
} }
@ -280,7 +283,7 @@ void DedicatedActor::setAI()
{ {
if (aiAction == mwmp::BaseActorList::ACTIVATE) if (aiAction == mwmp::BaseActorList::ACTIVATE)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Activating target"); LOG_APPEND(Log::LOG_VERBOSE, "-- Activating target");
MWMechanics::AiActivate package(targetPtr); MWMechanics::AiActivate package(targetPtr);
ptrCreatureStats->getAiSequence().stack(package, ptr, true); ptrCreatureStats->getAiSequence().stack(package, ptr, true);
@ -288,14 +291,14 @@ void DedicatedActor::setAI()
if (aiAction == mwmp::BaseActorList::COMBAT) if (aiAction == mwmp::BaseActorList::COMBAT)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Starting combat with target"); LOG_APPEND(Log::LOG_VERBOSE, "-- Starting combat with target");
MWMechanics::AiCombat package(targetPtr); MWMechanics::AiCombat package(targetPtr);
ptrCreatureStats->getAiSequence().stack(package, ptr, true); ptrCreatureStats->getAiSequence().stack(package, ptr, true);
} }
else if (aiAction == mwmp::BaseActorList::ESCORT) else if (aiAction == mwmp::BaseActorList::ESCORT)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Being escorted by target, for duration %i, to coordinates %f, %f, %f", LOG_APPEND(Log::LOG_VERBOSE, "-- Being escorted by target, for duration %i, to coordinates %f, %f, %f",
aiDuration, aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); aiDuration, aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]);
MWMechanics::AiEscort package(targetPtr.getCellRef().getRefId(), aiDuration, MWMechanics::AiEscort package(targetPtr.getCellRef().getRefId(), aiDuration,
@ -304,7 +307,7 @@ void DedicatedActor::setAI()
} }
else if (aiAction == mwmp::BaseActorList::FOLLOW) else if (aiAction == mwmp::BaseActorList::FOLLOW)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "--- Following target"); LOG_APPEND(Log::LOG_VERBOSE, "-- Following target");
MWMechanics::AiFollow package(targetPtr); MWMechanics::AiFollow package(targetPtr);
package.allowAnyDistance(true); package.allowAnyDistance(true);

View file

@ -17,6 +17,8 @@ namespace mwmp
virtual void Do(ActorPacket &packet, ActorList &actorList) virtual void Do(ActorPacket &packet, ActorList &actorList)
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
Main::get().getCellController()->readAI(actorList); Main::get().getCellController()->readAI(actorList);
} }
}; };