add rocket tests

This commit is contained in:
David Markowitz 2024-07-06 00:08:24 -07:00
parent 43768a5d86
commit 500d146a99
4 changed files with 9 additions and 20 deletions

View File

@ -356,7 +356,6 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
character->LinkEndChild(zoneStatistics);
// Tests have been written up to here
if (!m_LastRocketConfig.empty()) {
std::string config = GeneralUtils::UTF16ToWTF8(m_LastRocketConfig);
character->SetAttribute("lcbp", config.c_str());

View File

@ -313,6 +313,10 @@ public:
const std::map<LWOMAPID, ZoneStatistics>& GetZoneStatistics() const { return m_ZoneStatistics; };
const std::u16string& GetLastRocketConfig() const { return m_LastRocketConfig; };
uint64_t GetTotalTimePlayed() const { return m_TotalTimePlayed; };
/**
* Character info regarding this character, including clothing styles, etc.
*/

View File

@ -32,7 +32,6 @@ protected:
character->_doQuickXMLDataParse();
character->LoadXmlRespawnCheckpoints();
entity->AddComponent<BuffComponent>()->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS)->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
}
@ -56,28 +55,13 @@ TEST_F(SavingTest, CharacterComponentTest) {
auto* characterComponent = entity->GetComponent<CharacterComponent>();
const auto statsPrev = characterComponent->StatisticsToString();
const auto claimCodesPrev = characterComponent->GetClaimCodes();
const auto eyebrowsPrev = characterComponent->m_Character->GetEyebrows();
const auto eyesPrev = characterComponent->m_Character->GetEyes();
const auto hairColorPrev = characterComponent->m_Character->GetHairColor();
const auto hairStylePrev = characterComponent->m_Character->GetHairStyle();
const auto pantsColorPrev = characterComponent->m_Character->GetPantsColor();
const auto leftHandPrev = characterComponent->m_Character->GetLeftHand();
const auto shirtStylePrev = characterComponent->m_Character->GetShirtStyle();
const auto mouthPrev = characterComponent->m_Character->GetMouth();
const auto rightHandPrev = characterComponent->m_Character->GetRightHand();
const auto shirtColorPrev = characterComponent->m_Character->GetShirtColor();
const auto zoneStatsPrev = characterComponent->GetZoneStatistics();
const auto uscorePrev = characterComponent->GetUScore();
const auto reputationPrev = characterComponent->GetReputation();
// Update the xml document so its been run through the saver
character->SaveXMLToDatabase();
// Reload the component and character from the now updated xml data
const auto prevTotalTime = characterComponent->GetTotalTimePlayed();
character->_doQuickXMLDataParse();
characterComponent = entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
// Check that the buff component is the same as before which means resaving data and loading it back in didn't change anything
@ -114,6 +98,8 @@ TEST_F(SavingTest, CharacterComponentTest) {
// Should the value be fixed, this test will fail and will match the above
// only then will this comment be removed.
ASSERT_NE(27, characterComponent->m_Character->GetShirtStyle());
ASSERT_EQ(u"0:1:4719+1:4720+1:4721", characterComponent->GetLastRocketConfig());
ASSERT_EQ(prevTotalTime, characterComponent->GetTotalTimePlayed());
// character->GetXMLDoc().Print(&printer);
// std::string xmlDataModified(printer.CStr());

View File

@ -1,6 +1,6 @@
<obj v="1">
<mf hc="9" hs="8" hd="0" t="13" l="3" hdc="0" cd="27" lh="27634704" rh="27187396" es="1" ess="2" ms="3"/>
<char acct="628" cc="30046" gm="9" ft="0" llog="1716697644" ls="7510" lzx="-60.869003" lzy="76.865089" lzz="224.79057" lzrx="0" lzry="-0.85140967" lzrz="0" lzrw="0.5245012" stt="32114;69;343;13;163;2;181;2;388;252;146;24451;25;9022;41898;42186;42524;4404;0;0;0;0;0;0;0;0;0;" lzid="132872" lnzid="0" lwid="1800" tscene="" co="1073741968" rpt="300" lrid="1152921509279923587" time="24062">
<char acct="628" cc="30046" gm="9" ft="0" llog="1716697644" ls="7510" lzx="-60.869003" lzy="76.865089" lzz="224.79057" lzrx="0" lzry="-0.85140967" lzrz="0" lzrw="0.5245012" stt="32114;69;343;13;163;2;181;2;388;252;146;24451;25;9022;41898;42186;42524;4404;0;0;0;0;0;0;0;0;0;" lzid="132872" lnzid="0" lwid="1800" tscene="" co="1073741968" rpt="300" lrid="1152921509279923587" lcbp="0:1:4719+1:4720+1:4721" time="24062">
<ue>
<e id="115"/>
<e id="383"/>