diff --git a/content/scripts/game/components/inventoryComponent.ws b/content/scripts/game/components/inventoryComponent.ws index 42c6935..d803fcc 100644 Binary files a/content/scripts/game/components/inventoryComponent.ws and b/content/scripts/game/components/inventoryComponent.ws differ diff --git a/content/scripts/local/achievementStatTrak/achievement_stats.ws b/content/scripts/local/achievementStatTrak/achievement_stats.ws index bdbd8c3..95be139 100644 --- a/content/scripts/local/achievementStatTrak/achievement_stats.ws +++ b/content/scripts/local/achievementStatTrak/achievement_stats.ws @@ -1,7 +1,7 @@ // TODO: Multiple functions: one returns array of stuff, another formats, and one final exec function // Function to get the stats in a formatted string -function getAchievementStats() : string +function getAchievementStats() : array { // Integer to be later used in the for loop var i : int; @@ -34,12 +34,169 @@ function getAchievementStats() : string stats.PushBack(ES_KilledCows); stats.PushBack(ES_SlideTime); + // Return the array of stats + return stats; +} + +function getAchievementStatVal(statEnum : EStatistic) : int +{ + // Get value from enum + return theGame.GetGamerProfile().GetStatValue(statEnum); +} + +function getAchievementStatNameRaw(statEnum : EStatistic) : string +{ + // Get raw name from enum + return StatisticEnumToName(statEnum); +} + +function getAchievmentStatName(rawStatName : string) : string +{ + var formattedStatName : string; + + // Set Steam/GOG achievement name from name + switch (rawStatName) + { + case "statistic_charmed_kills": + formattedStatName = "The Enemy of My Enemy"; + break; + + case "statistic_aardfall_kills": + formattedStatName = "Humpty Dumpty"; + break; + + case "statistic_environment_kills": + formattedStatName = "Environmentally Unfriendly"; + break; + + case "statistic_bleed_burn_poison": + formattedStatName = "Overkill"; + break; + + case "statistic_counterattack_chain": + formattedStatName = "Kaer Morhen Trained"; + break; + + case "statistic_burning_gas_triggers": + formattedStatName = "That Is the Evilest Thing"; + break; + + case "statistic_known_potions": + formattedStatName = "Let's Cook!"; + break; + + case "statistic_known_bombs": + formattedStatName = "Bombardier"; + break; + + case "statistic_head_shot_kills": + formattedStatName = "Master Marksman"; + break; + + case "statistic_read_books": + formattedStatName = "Bookworm"; + break; + + case "statistic_destroyed_nests": + formattedStatName = "Fire in the Hole"; + break; + + case "statistic_fundamentals_kills": + formattedStatName = ""; // Don't know what achievement this corresponds to + break; + + case "statistic_finesse_kills": + formattedStatName = ""; // Don't know what achievement this corresponds to + break; + + case "statistic_self_arrow_kills": + formattedStatName = "Return to Sender"; + break; + + case "statistic_active_potions": + formattedStatName = "Can Quit Anytime I Want"; + break; + + case "statistic_killed_cows": + formattedStatName = "Moo-rderer"; + break; + + case "statistic_slide_time": + formattedStatName = "Rad Steez, Bro!"; + break; + + default: + formattedStatName = ""; + break; + } + + // Return Steam/GOG achievement name + return formattedStatName; +} + +function getFormattedAchievementStats(statList : array) : string +{ + // Vars for formatted string + var achievementString : string; + var currentRawName : string; + var currentName : string; + var currentVal : int; + var i : int; + achievementString = ""; + // Loop through each stat to create a final string that goes in the Gwent book - for (i = 0; i < stats.Size(); i += 1) + for (i = 0; i < statList.Size(); i += 1) { - achievementString += StatisticEnumToName(stats[i]) + ": " + "" + theGame.GetGamerProfile().GetStatValue(stats[i]) + "" + "
"; + // Use other functions to get data + currentRawName = getAchievementStatNameRaw(statList[i]); + currentName = getAchievmentStatName(currentRawName); + currentVal = getAchievementStatVal(statList[i]); + + if (i != 0) + { + achievementString += "

" + currentRawName + ": " + "" + currentVal + "" + "
" + "Achievement: " + "" + currentName + ""; + } + else + { + // Don't add beginning newline for first element + achievementString += currentRawName + ": " + "" + currentVal + "" + "
" + "Achievement: " + "" + currentName + ""; + } } - - // Return the final string + + // Return final formatted string return achievementString; -} \ No newline at end of file +} + +//------------------------ +// EXEC FUNCTIONS +//------------------------ +exec function getAllAchievementStats() +{ + // Define vars for adding notification for all achievement stats + var statList : array; + var formattedStats : string; + + // Get data + statList = getAchievementStats(); + formattedStats = getFormattedAchievementStats(statList); + + // Add notification + theGame.GetGuiManager().ShowNotification(formattedStats); +} + +// TODO: Fix getting a single achievement stat +/*exec function getAchievementStat(statEnum : EStatistic) +{ + // Define vars for adding notification for specific stat + var rawName : string; + var achName : string; + var val : int; + + // Get data + rawName = getAchievementStatNameRaw(statEnum); + achName = getAchievementStatVal(statEnum); + val = getAchievementStatVal(statEnum); + + // Print to notification + theGame.GetGuiManager().ShowNotification(rawName + ": " + "" + val + "" + "
" + "Achievement: " + "" + val); +}*/ \ No newline at end of file