mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-13 19:58:21 +00:00
add rocket tests
This commit is contained in:
parent
43768a5d86
commit
500d146a99
@ -356,7 +356,6 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
|||||||
|
|
||||||
character->LinkEndChild(zoneStatistics);
|
character->LinkEndChild(zoneStatistics);
|
||||||
|
|
||||||
// Tests have been written up to here
|
|
||||||
if (!m_LastRocketConfig.empty()) {
|
if (!m_LastRocketConfig.empty()) {
|
||||||
std::string config = GeneralUtils::UTF16ToWTF8(m_LastRocketConfig);
|
std::string config = GeneralUtils::UTF16ToWTF8(m_LastRocketConfig);
|
||||||
character->SetAttribute("lcbp", config.c_str());
|
character->SetAttribute("lcbp", config.c_str());
|
||||||
|
@ -313,6 +313,10 @@ public:
|
|||||||
|
|
||||||
const std::map<LWOMAPID, ZoneStatistics>& GetZoneStatistics() const { return m_ZoneStatistics; };
|
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.
|
* Character info regarding this character, including clothing styles, etc.
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,6 @@ protected:
|
|||||||
character->_doQuickXMLDataParse();
|
character->_doQuickXMLDataParse();
|
||||||
character->LoadXmlRespawnCheckpoints();
|
character->LoadXmlRespawnCheckpoints();
|
||||||
|
|
||||||
entity->AddComponent<BuffComponent>()->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
|
||||||
entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS)->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>();
|
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
|
// Update the xml document so its been run through the saver
|
||||||
character->SaveXMLToDatabase();
|
character->SaveXMLToDatabase();
|
||||||
|
|
||||||
// Reload the component and character from the now updated xml data
|
// Reload the component and character from the now updated xml data
|
||||||
|
const auto prevTotalTime = characterComponent->GetTotalTimePlayed();
|
||||||
character->_doQuickXMLDataParse();
|
character->_doQuickXMLDataParse();
|
||||||
characterComponent = entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
|
entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
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
|
// 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
|
// Should the value be fixed, this test will fail and will match the above
|
||||||
// only then will this comment be removed.
|
// only then will this comment be removed.
|
||||||
ASSERT_NE(27, characterComponent->m_Character->GetShirtStyle());
|
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);
|
// character->GetXMLDoc().Print(&printer);
|
||||||
// std::string xmlDataModified(printer.CStr());
|
// std::string xmlDataModified(printer.CStr());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<obj v="1">
|
<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"/>
|
<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>
|
<ue>
|
||||||
<e id="115"/>
|
<e id="115"/>
|
||||||
<e id="383"/>
|
<e id="383"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user