Skip to content

Commit

Permalink
Merge pull request #845 from WALLOFJUSTICE/dev-23-q3-2
Browse files Browse the repository at this point in the history
* merge dev
  • Loading branch information
WALLOFJUSTICE authored Oct 23, 2024
2 parents 67cb416 + eb956cb commit 039e4f9
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 149 deletions.
24 changes: 22 additions & 2 deletions src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10359,7 +10359,17 @@ void Entity::attack(int pose, int charge, Entity* target)
{
increaseSkill = false;
}
players[this->skill[2]]->mechanics.enemyRaisedBlockingAgainst[hit.entity->getUID()]++;
if ( myStats->shield && itemCategory(myStats->shield) != ARMOR )
{
if ( myStats->getProficiency(PRO_SHIELD) >= SKILL_LEVEL_SKILLED )
{
increaseSkill = false;
}
}
if ( increaseSkill )
{
players[this->skill[2]]->mechanics.enemyRaisedBlockingAgainst[hit.entity->getUID()]++;
}
}
if ( increaseSkill )
{
Expand Down Expand Up @@ -11022,7 +11032,17 @@ void Entity::attack(int pose, int charge, Entity* target)
{
skillIncrease = false;
}
players[hit.entity->skill[2]]->mechanics.enemyRaisedBlockingAgainst[this->getUID()]++;
if ( hitstats->shield && itemCategory(hitstats->shield) != ARMOR )
{
if ( hitstats->getProficiency(PRO_SHIELD) >= SKILL_LEVEL_SKILLED )
{
skillIncrease = false;
}
}
if ( skillIncrease )
{
players[hit.entity->skill[2]]->mechanics.enemyRaisedBlockingAgainst[this->getUID()]++;
}
}
if ( skillIncrease )
{
Expand Down
138 changes: 69 additions & 69 deletions src/eos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3166,7 +3166,7 @@ void EOSFuncs::ingestStat(int stat_num, int value)

static void EOS_CALL OnIngestGlobalStatComplete(const EOS_Stats_IngestStatCompleteCallbackInfo* data)
{
assert(data != NULL);
/*assert(data != NULL);
if (data->ResultCode == EOS_EResult::EOS_Success)
{
EOSFuncs::logInfo("Successfully stored global stats");
Expand All @@ -3184,12 +3184,12 @@ static void EOS_CALL OnIngestGlobalStatComplete(const EOS_Stats_IngestStatComple
{
EOSFuncs::logError("OnIngestGlobalStatComplete: Callback failure: %d", static_cast<int>(data->ResultCode));
}
EOS.StatGlobalManager.bDataQueued = true;
EOS.StatGlobalManager.bDataQueued = true;*/
}

void EOSFuncs::queueGlobalStatUpdate(int stat_num, int value)
{
if (stat_num <= STEAM_GSTAT_INVALID || stat_num >= NUM_GLOBAL_STEAM_STATISTICS)
/*if (stat_num <= STEAM_GSTAT_INVALID || stat_num >= NUM_GLOBAL_STEAM_STATISTICS)
{
return;
}
Expand All @@ -3198,7 +3198,7 @@ void EOSFuncs::queueGlobalStatUpdate(int stat_num, int value)
return;
}
g_SteamGlobalStats[stat_num].m_iValue += value;
StatGlobalManager.bDataQueued = true;
StatGlobalManager.bDataQueued = true;*/
}

void EOSFuncs::StatGlobal_t::updateQueuedStats()
Expand All @@ -3218,55 +3218,55 @@ void EOSFuncs::StatGlobal_t::updateQueuedStats()

void EOSFuncs::ingestGlobalStats()
{
if (StatGlobalManager.bIsDisabled)
{
return;
}
if (!ServerPlatformHandle)
{
return;
}
//if (StatGlobalManager.bIsDisabled)
//{
// return;
//}
//if (!ServerPlatformHandle)
//{
// return;
//}

Uint32 numStats = 0;
std::vector<std::string> StatNames;
for (Uint32 i = 0; i < NUM_GLOBAL_STEAM_STATISTICS; ++i)
{
if (g_SteamGlobalStats[i].m_iValue > 0)
{
StatNames.push_back(g_SteamGlobalStats[i].m_pchStatName);
++numStats;
}
}
//Uint32 numStats = 0;
//std::vector<std::string> StatNames;
//for (Uint32 i = 0; i < NUM_GLOBAL_STEAM_STATISTICS; ++i)
//{
// if (g_SteamGlobalStats[i].m_iValue > 0)
// {
// StatNames.push_back(g_SteamGlobalStats[i].m_pchStatName);
// ++numStats;
// }
//}

if (numStats == 0)
{
return;
}
//if (numStats == 0)
//{
// return;
//}

EOS_Stats_IngestData* StatsToIngest = new EOS_Stats_IngestData[numStats];
Uint32 currentIndex = 0;
for (Uint32 i = 0; i < NUM_GLOBAL_STEAM_STATISTICS && currentIndex < StatNames.size(); ++i)
{
if (g_SteamGlobalStats[i].m_iValue > 0)
{
StatsToIngest[currentIndex].ApiVersion = EOS_STATS_INGESTDATA_API_LATEST;
StatsToIngest[currentIndex].StatName = StatNames[currentIndex].c_str();
StatsToIngest[currentIndex].IngestAmount = g_SteamGlobalStats[i].m_iValue;
//logInfo("Updated %s | %d", StatsToIngest[currentIndex].StatName, StatsToIngest[currentIndex].IngestAmount);
++currentIndex;
}
}
//EOS_Stats_IngestData* StatsToIngest = new EOS_Stats_IngestData[numStats];
//Uint32 currentIndex = 0;
//for (Uint32 i = 0; i < NUM_GLOBAL_STEAM_STATISTICS && currentIndex < StatNames.size(); ++i)
//{
// if (g_SteamGlobalStats[i].m_iValue > 0)
// {
// StatsToIngest[currentIndex].ApiVersion = EOS_STATS_INGESTDATA_API_LATEST;
// StatsToIngest[currentIndex].StatName = StatNames[currentIndex].c_str();
// StatsToIngest[currentIndex].IngestAmount = g_SteamGlobalStats[i].m_iValue;
// //logInfo("Updated %s | %d", StatsToIngest[currentIndex].StatName, StatsToIngest[currentIndex].IngestAmount);
// ++currentIndex;
// }
//}

EOS_Stats_IngestStatOptions Options{};
Options.ApiVersion = EOS_STATS_INGESTSTAT_API_LATEST;
Options.Stats = StatsToIngest;
Options.StatsCount = numStats;
Options.LocalUserId = StatGlobalManager.getProductUserIdHandle();
Options.TargetUserId = StatGlobalManager.getProductUserIdHandle();
//EOS_Stats_IngestStatOptions Options{};
//Options.ApiVersion = EOS_STATS_INGESTSTAT_API_LATEST;
//Options.Stats = StatsToIngest;
//Options.StatsCount = numStats;
//Options.LocalUserId = StatGlobalManager.getProductUserIdHandle();
//Options.TargetUserId = StatGlobalManager.getProductUserIdHandle();

EOS_Stats_IngestStat(EOS_Platform_GetStatsInterface(ServerPlatformHandle), &Options, nullptr, OnIngestGlobalStatComplete);
//EOS_Stats_IngestStat(EOS_Platform_GetStatsInterface(ServerPlatformHandle), &Options, nullptr, OnIngestGlobalStatComplete);

delete[] StatsToIngest;
//delete[] StatsToIngest;
}

void EOS_CALL EOSFuncs::OnQueryAllStatsCallback(const EOS_Stats_OnQueryStatsCompleteCallbackInfo* data)
Expand Down Expand Up @@ -4063,34 +4063,34 @@ void EOSFuncs::StatGlobal_t::init()

void EOSFuncs::StatGlobal_t::queryGlobalStatUser()
{
init();
//init();

// Query Player Stats
EOS_Stats_QueryStatsOptions StatsQueryOptions{};
StatsQueryOptions.ApiVersion = EOS_STATS_QUERYSTATS_API_LATEST;
StatsQueryOptions.LocalUserId = getProductUserIdHandle();
StatsQueryOptions.TargetUserId = getProductUserIdHandle();
//// Query Player Stats
//EOS_Stats_QueryStatsOptions StatsQueryOptions{};
//StatsQueryOptions.ApiVersion = EOS_STATS_QUERYSTATS_API_LATEST;
//StatsQueryOptions.LocalUserId = getProductUserIdHandle();
//StatsQueryOptions.TargetUserId = getProductUserIdHandle();

// Optional params
StatsQueryOptions.StartTime = EOS_STATS_TIME_UNDEFINED;
StatsQueryOptions.EndTime = EOS_STATS_TIME_UNDEFINED;
//// Optional params
//StatsQueryOptions.StartTime = EOS_STATS_TIME_UNDEFINED;
//StatsQueryOptions.EndTime = EOS_STATS_TIME_UNDEFINED;

StatsQueryOptions.StatNamesCount = NUM_GLOBAL_STEAM_STATISTICS;
StatsQueryOptions.StatNames = new const char* [NUM_GLOBAL_STEAM_STATISTICS];
//StatsQueryOptions.StatNamesCount = NUM_GLOBAL_STEAM_STATISTICS;
//StatsQueryOptions.StatNames = new const char* [NUM_GLOBAL_STEAM_STATISTICS];

for (int i = 0; i < NUM_GLOBAL_STEAM_STATISTICS; ++i)
{
StatsQueryOptions.StatNames[i] = g_SteamGlobalStats[i].m_pchStatName;
}
//for (int i = 0; i < NUM_GLOBAL_STEAM_STATISTICS; ++i)
//{
// StatsQueryOptions.StatNames[i] = g_SteamGlobalStats[i].m_pchStatName;
//}

if (EOS.ServerPlatformHandle)
{
return;
}
//if (EOS.ServerPlatformHandle)
//{
// return;
//}

EOS_Stats_QueryStats(EOS_Platform_GetStatsInterface(EOS.ServerPlatformHandle),
&StatsQueryOptions, nullptr, OnQueryGlobalStatsCallback);
delete[] StatsQueryOptions.StatNames;
//EOS_Stats_QueryStats(EOS_Platform_GetStatsInterface(EOS.ServerPlatformHandle),
// &StatsQueryOptions, nullptr, OnQueryGlobalStatsCallback);
//delete[] StatsQueryOptions.StatNames;
}

#endif //USE_EOS
1 change: 1 addition & 0 deletions src/init_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void initGameDatafiles(bool moddedReload)
CompendiumEntries.readModelLimbsFromFile("monster");
CompendiumEntries.readModelLimbsFromFile("world");
CompendiumEntries.readModelLimbsFromFile("codex");
MainMenu::MainMenuBanners_t::readFromFile();
}

void initGameDatafilesAsync(bool moddedReload)
Expand Down
1 change: 1 addition & 0 deletions src/magic/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,7 @@ Entity* spellEffectPolymorph(Entity* target, Entity* parent, bool fromMagicSpell
summonedStats->RANDOM_GOLD = 0;
summonedStats->MISC_FLAGS[STAT_FLAG_MONSTER_DISABLE_HC_SCALING] = 1;
summonedStats->leader_uid = targetStats->leader_uid;
summonedStats->monsterIsCharmed = targetStats->monsterIsCharmed;
if ( summonedStats->leader_uid != 0 && summonedStats->type != SHADOW )
{
Entity* leader = uidToEntity(summonedStats->leader_uid);
Expand Down
70 changes: 0 additions & 70 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,76 +301,6 @@ SteamStat_t g_SteamStats[NUM_STEAM_STATISTICS] =
{ 58, STEAM_STAT_INT, "STAT_SMASH_MELEE" }
};

SteamStat_t g_SteamGlobalStats[NUM_GLOBAL_STEAM_STATISTICS] =
{
{ 1, STEAM_STAT_INT, "STAT_GLOBAL_GAMES_STARTED" },
{ 2, STEAM_STAT_INT, "STAT_GLOBAL_GAMES_WON" },
{ 3, STEAM_STAT_INT, "STAT_GLOBAL_BOULDER_DEATHS" },
{ 4, STEAM_STAT_INT, "STAT_GLOBAL_HERX_SLAIN" },
{ 5, STEAM_STAT_INT, "STAT_GLOBAL_BAPHOMET_SLAIN" },
{ 6, STEAM_STAT_INT, "STAT_GLOBAL_TWINSICE_SLAIN" },
{ 7, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_HUMAN" },
{ 8, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_RAT" },
{ 9, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_GOBLIN" },
{ 10, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SLIME" },
{ 11, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_TROLL" },
{ 12, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SPIDER" },
{ 13, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_GHOUL" },
{ 14, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SKELETON" },
{ 15, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SCORPION" },
{ 16, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_IMP" },
{ 17, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_GNOME" },
{ 18, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_DEMON" },
{ 19, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SUCCUBUS" },
{ 20, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_LICH" },
{ 21, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_MINOTAUR" },
{ 22, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_DEVIL" },
{ 23, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SHOPKEEPER" },
{ 24, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_KOBOLD" },
{ 25, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SCARAB" },
{ 26, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_CRYSTALGOLEM" },
{ 27, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_INCUBUS" },
{ 28, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_VAMPIRE" },
{ 29, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SHADOW" },
{ 30, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_COCKATRICE" },
{ 31, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_INSECTOID" },
{ 32, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_GOATMAN" },
{ 33, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_AUTOMATON" },
{ 34, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_LICHICE" },
{ 35, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_LICHFIRE" },
{ 36, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SENTRYBOT" },
{ 37, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_SPELLBOT" },
{ 38, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_GYROBOT" },
{ 39, STEAM_STAT_INT, "STAT_GLOBAL_DEATHS_DUMMYBOT" },
{ 40, STEAM_STAT_INT, "STAT_GLOBAL_TWINSFIRE_SLAIN" },
{ 41, STEAM_STAT_INT, "STAT_GLOBAL_SHOPKEEPERS_SLAIN" },
{ 42, STEAM_STAT_INT, "STAT_GLOBAL_MINOTAURS_SLAIN" },
{ 43, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL_ENTERED" },
{ 44, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL1_COMPLETED" },
{ 45, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL2_COMPLETED" },
{ 46, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL3_COMPLETED" },
{ 47, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL4_COMPLETED" },
{ 48, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL5_COMPLETED" },
{ 49, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL6_COMPLETED" },
{ 50, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL7_COMPLETED" },
{ 51, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL8_COMPLETED" },
{ 52, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL9_COMPLETED" },
{ 53, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL10_COMPLETED" },
{ 54, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL1_ATTEMPTS" },
{ 55, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL2_ATTEMPTS" },
{ 56, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL3_ATTEMPTS" },
{ 57, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL4_ATTEMPTS" },
{ 58, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL5_ATTEMPTS" },
{ 59, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL6_ATTEMPTS" },
{ 60, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL7_ATTEMPTS" },
{ 61, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL8_ATTEMPTS" },
{ 62, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL9_ATTEMPTS" },
{ 63, STEAM_STAT_INT, "STAT_GLOBAL_TUTORIAL10_ATTEMPTS" },
{ 64, STEAM_STAT_INT, "STAT_GLOBAL_DISABLE" },
{ 65, STEAM_STAT_INT, "STAT_GLOBAL_PROMO" },
{ 66, STEAM_STAT_INT, "STAT_GLOBAL_PROMO_INTERACT" }
};

#ifdef STEAMWORKS
bool directConnect = false;
CSteamLeaderboards* g_SteamLeaderboards = NULL;
Expand Down
2 changes: 0 additions & 2 deletions src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,6 @@ void GO_SwapBuffers(SDL_Window* screen);

static const int NUM_STEAM_STATISTICS = 58;
extern SteamStat_t g_SteamStats[NUM_STEAM_STATISTICS];
static const int NUM_GLOBAL_STEAM_STATISTICS = 66;
extern SteamStat_t g_SteamGlobalStats[NUM_GLOBAL_STEAM_STATISTICS];

#ifdef STEAMWORKS
#include <steam/steam_api.h>
Expand Down
8 changes: 7 additions & 1 deletion src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9354,7 +9354,13 @@ void doNewGame(bool makeHighscore) {
if ( gameModeManager.getMode() == GameModeManager_t::GAME_MODE_DEFAULT && !loadingsavegame )
{
steamStatisticUpdate(STEAM_STAT_GAMES_STARTED, STEAM_STAT_INT, 1);
achievementObserver.updateGlobalStat(STEAM_GSTAT_GAMES_STARTED);
#ifdef USE_PLAYFAB
if ( !loadingsavegame )
{
playfabUser.gameBegin();
}
#endif
//achievementObserver.updateGlobalStat(STEAM_GSTAT_GAMES_STARTED);
}

// delete game data clutter
Expand Down
Loading

0 comments on commit 039e4f9

Please sign in to comment.