MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getStatsText

Method getStatsText

source/entities/Creature.cpp:1913–1969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1911}
1912
1913std::string Creature::getStatsText()
1914{
1915 // The creatures are not refreshed at each turn so this information is relevant in the server
1916 // GameMap only
1917 const std::string formatTitleOn = "[font='MedievalSharp-12'][colour='CCBBBBFF']";
1918 const std::string formatTitleOff = "[font='MedievalSharp-10'][colour='FFFFFFFF']";
1919
1920 std::stringstream tempSS;
1921 tempSS << formatTitleOn << "Characteristics" << formatTitleOff << std::endl;
1922 tempSS << "Level: " << getLevel() << std::endl;
1923 tempSS << "Experience: " << mExp << std::endl;
1924 tempSS << "HP: " << getHP() << " / " << mMaxHP << std::endl;
1925 tempSS << "Gold: " << mGoldCarried << std::endl;
1926 if (!getDefinition()->isWorker())
1927 {
1928 tempSS << "Wakefulness: " << mWakefulness << std::endl;
1929 tempSS << "Hunger: " << mHunger << std::endl;
1930 }
1931 tempSS << "Move speed (G/W/L): " << getMoveSpeedGround() << " / "
1932 << getMoveSpeedWater() << " / " << getMoveSpeedLava() << std::endl;
1933 tempSS << "Weapons:" << std::endl;
1934 if(mWeaponL == nullptr)
1935 tempSS << " - Left: none" << std::endl;
1936 else
1937 tempSS << " - Left: " << mWeaponL->getName() << " | Damage (P/M/E): " << mWeaponL->getPhysicalDamage()
1938 << " / " << mWeaponL->getMagicalDamage() << " / " << mWeaponL->getElementDamage() << std::endl;
1939 if(mWeaponR == nullptr)
1940 tempSS << " - Right: none" << std::endl;
1941 else
1942 tempSS << " - Right: " << mWeaponR->getName() << " | Damage (P/M/E): " << mWeaponR->getPhysicalDamage()
1943 << " / " << mWeaponR->getMagicalDamage() << " / " << mWeaponR->getElementDamage() << std::endl;
1944 tempSS << "Defense (P/M/E): " << getPhysicalDefense() << " / " << getMagicalDefense() << " / " << getElementDefense() << std::endl;
1945 if (getDefinition()->isWorker())
1946 {
1947 tempSS << "Dig rate: " << getDigRate() << std::endl;
1948 tempSS << "Dance rate: " << mClaimRate << std::endl;
1949 }
1950
1951 tempSS << formatTitleOn << "\nDebugging information" << formatTitleOff << std::endl;
1952 tempSS << "Seat and team IDs: " << getSeat()->getId() << " / " << getSeat()->getTeamId() << std::endl;
1953 tempSS << "Position: " << Helper::toString(getPosition()) << std::endl;
1954 tempSS << "Actions:";
1955 for(const std::unique_ptr<CreatureAction>& ca : mActions)
1956 {
1957 tempSS << " " << CreatureAction::toString(ca.get()->getType());
1958 }
1959 tempSS << std::endl;
1960 tempSS << "Destinations:";
1961 for(const Ogre::Vector3& dest : mWalkQueue)
1962 {
1963 tempSS << " " << Helper::toStringWithoutZ(dest);
1964 }
1965 tempSS << std::endl;
1966 tempSS << "Mood: " << CreatureMood::toString(mMoodValue) << std::endl;
1967 tempSS << "Mood points: " << Helper::toString(mMoodPoints) << std::endl;
1968 return tempSS.str();
1969}
1970

Callers 1

startNewTurnMethod · 0.80

Calls 9

toStringWithoutZFunction · 0.85
isWorkerMethod · 0.80
getPhysicalDamageMethod · 0.80
getMagicalDamageMethod · 0.80
getElementDamageMethod · 0.80
getTeamIdMethod · 0.80
toStringFunction · 0.50
getIdMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected