# UnitStatisticsDefines.py
# Unit Statistics Mod by Teg_Navanis

#######SD Tool Kit#######

import SdToolKitAdvanced
sdEntityInit   = SdToolKitAdvanced.sdEntityInit
sdEntityExists = SdToolKitAdvanced.sdEntityExists
sdEntityWipe   = SdToolKitAdvanced.sdEntityWipe
sdGetVal       = SdToolKitAdvanced.sdGetVal
sdSetVal       = SdToolKitAdvanced.sdSetVal

sdObjectInit      = SdToolKitAdvanced.sdObjectInit
sdObjectWipe      = SdToolKitAdvanced.sdObjectWipe
sdObjectExists    = SdToolKitAdvanced.sdObjectExists
sdObjectGetVal    = SdToolKitAdvanced.sdObjectGetVal
sdObjectSetVal    = SdToolKitAdvanced.sdObjectSetVal
sdObjectGetAll    = SdToolKitAdvanced.sdObjectGetAll
sdObjectSetAll    = SdToolKitAdvanced.sdObjectSetAll
sdObjectGetDictVal    = SdToolKitAdvanced.sdObjectGetDictVal
sdObjectSetDictVal    = SdToolKitAdvanced.sdObjectSetDictVal

#############################


from CvPythonExtensions import *
import CvUtil
import PyHelpers
import CvConfigParser

gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
localText = CyTranslator()
ArtFileMgr = CyArtFileMgr()

config = CvConfigParser.CvConfigParser("Unit Statistics Mod Config.ini")


# Change this to either enable or disable unit promotion tracking.
# Default value is True
g_bTrackUnitPromotions = True

# Change this to either enable or disable tracking of your currently best units.
# Default value is True
g_bTrackHighScore = True

# Change this to either enable or disable goody received tracking.
# Default value is True
g_bTrackGoodyReceived = True


# Change this to either enable or disable turn information tracking (amount of turns fortified)
# Default value is True
g_bTrackTurnInformation = True

# Change this to show or hide the number of combats, units killed, units lost and retreats.
# Default value is True
g_bShowCombatCount = True

# Change this to show or hide the unit creation date.
# 0 = no service information
# 1 = "Turns in service: 8 (320 years)"
# 2 = "Years in service: 320 (8 turns)"
# 3 = "Turns in service: 8
# 4 = "Years in service: 320
# Default value is 1
g_iUnitServiceInformation = 1

# Change this to track the distance a unit has moved.
# Default value is True
g_bTrackMovement = True

# Change this to show or hide the unit event log
# Default value is True
g_bShowUnitEventLog = True

# Change this to display the turn information in the unit events log
# Default value is True
g_bShowLogTurnInformation = True

# Change this to display the year information in the unit events log
# Default value is True
g_bShowLogDateInformation = True

# Change this to switch the order that the turn and year for the logged event 
# are displayed. For example if set to False then a unit that was created in 
# turn 0 and year 4000BC would be displayed as "Turn 0 (4000BC): <Unit type> 
# created".
# Default value is True
g_bShowLogTurnInformationFirst = True

# Change this to display the damage your unit has inflicted/suffered.
# Default value is True
g_bShowDamageInformation = True

# Change this to show or hide combat odds statistics.
# Default value is True
g_bShowOdds = True

# Change this to show or hide unit experience.
# Default value is True
g_bShowExperience = True

# Change this to either enable or disable unit statistics for non-combatants (settlers, workers, missionaries, great people)
# Default value is True
g_bTrackNonCombatants = True

# Change this to either enable or disable unit statistics for all players.
# Default value is False
g_bTrackAllPlayers = False

# Change this to either enable or disable the display of other players' unit statistics 
# Leave disabled if you don't want any additional information about enemy units
# Default value is False
g_bShowAllPlayers = False

# If this is enabled, all players share one high score list (g_bTrackAllPlayers required for this to have effect)
# Default value is False
g_bGlobalHighScore = False

# Change this for different name generators.
# 0 = no unit naming (use this only when you also use the Unit Statistics CvGameCoreDLL!)
# 1 = Warrior 1, Warrior 2, Axeman 1, Axeman 2
# 2 = Random Name Generator by TheLopez
# 3 = Nexus naming 1st Army 1st Corp 1st Div
# Default value is 1
g_iUnitNaming = 0

# Change this to enable or disable the recycling of dead unit's names.
# Default value is True
g_bUnitNameRecycling = True

# Change this to either enable or disable help panes in the unit statistics screens
# Default value is True
g_bShowHelp = True

# If we actually were able to open the "Unit Statistics Mod Config.ini" file then read in the values.
# otherwise we'll keep the default values that were set at the top of this file.
if(config != None):
    g_bTrackUnitPromotions = config.getboolean("Unit Statistics Mod", "Track Unit Promotions", True)
    g_bTrackHighScore = config.getboolean("Unit Statistics Mod", "Track Unit High Score", True)
    g_bTrackTurnInformation = config.getboolean("Unit Statistics Mod", "Track Turn Information", True)
    g_bTrackGoodyReceived = config.getboolean("Unit Statistics Mod", "Track Goody Received", True)
    g_bShowCombatCount = config.getboolean("Unit Statistics Mod", "Show Combat Count", True)
    g_iUnitServiceInformation = config.getint("Unit Statistics Mod", "Show Unit Service Information", 1)
    g_bTrackMovement = config.getboolean("Unit Statistics Mod", "Track Unit Movement", True)
    g_bShowUnitEventLog = config.getboolean("Unit Statistics Mod", "Show Unit Event Log", True)
    g_bShowLogTurnInformation = config.getboolean("Unit Statistics Mod", "Show Log Turn Information", True)
    g_bShowLogDateInformation = config.getboolean("Unit Statistics Mod", "Show Log Date Information", True)
    g_bShowLogTurnInformationFirst = config.getboolean("Unit Statistics Mod", "Show Log Turn Information First", True)            
    g_bShowDamageInformation = config.getboolean("Unit Statistics Mod", "Show Damage Information", True)
    g_bShowOdds = config.getboolean("Unit Statistics Mod", "Show Odds", True)
    g_iUnitNaming = config.getint("Unit Statistics Mod", "Unit Naming", 0)
    g_bUnitNameRecycling = config.getboolean("Unit Statistics Mod", "Unit Name Recycling", True)
    g_bTrackNonCombatants = config.getboolean("Unit Statistics Mod", "Track Non-Combat Units", True)
    g_bTrackAllPlayers = config.getboolean("Unit Statistics Mod", "Track All Players", False)
    g_bShowExperience = config.getboolean("Unit Statistics Mod", "Show Experience", True)
    g_bShowAllPlayers = config.getboolean("Unit Statistics Mod", "Show All Players", False)
    g_bGlobalHighScore = config.getboolean("Unit Statistics Mod", "Global High Score", False)
    g_bShowHelp = config.getboolean("Unit Statistics Mod", "Show Help", True)

COMBATCOUNT = "CombatCount"
BODYCOUNT = "BodyCount"
BATTLECOUNT = "BattleCount"
ATTACK = "Attack"
DEFENCE = "Defence"
AIRATTACK = "AirAttack"
AIRDEFENCE = "AirDefence"
AIRSTRIKE = "AirStrike"
LIST = "List"
TYPENUMBER = "TypeNumber"
STARTTURN = "StartTurn"
MOVEMENT_COUNTER = "MoveCounter"
CARGO_COUNTER = "CargoCounter"
MOVEMENT_COUNTER_ENEMY = "MoveCounterEnemy"
PLOT= "Plot"
WARP = "Warp"
TRANSPORT = "Transport"
DAMAGETYPE = ["DamageInflicted", 
              "DamageInflictedAttacking", 
              "DamageInflictedDefending", 
              "DamageSuffered", 
              "DamageSufferedAttacking", 
              "DamageSufferedDefending",
              "CollateralDamageInflicted",
              "CollateralDamageSuffered",
              "AirStrikeDamageInflicted",
              "AirStrikeDamageSuffered"]
DAMAGESTATS = "DamageStats"
EXPERIENCE = "Experience"
LOSTNAMESLIST = "LostNamesList"
BESTODDS = "BestOdds"
ODDSDATA = "OddsData"
AVERAGEODDS = "AverageOdds"
AVERAGEODDSHIGHEST = "AverageOddsHighest"
AVERAGEODDSLOWEST = "AverageOddsLowest"
LIFEODDS = "LifeOdds"
GOODIES = "Goodies"
TURNINFORMATION = "TurnInformation"
TOTALTURNSFORTIFIED = "TotalTurnsFortified"
MAXTURNSFORTIFIED = "MaxTurnsFortified"
CAPTURECOUNT = "CaptureCount"
GRAVEYARD = "GraveYard"
GRAVEYARDLIST = "GraveYardList"
UNITTYPE = "UnitType"
UNITID = "UnitID"
UNITAGE = "UnitAge"
COMMANDO = "Commando"
PROMOTION_LIST = "Promotion_List"
HIGHEST_DEFEAT_ODDS = "HIGHEST_DEFEAT_ODDS"

HighScoreTypes = {                
                                  BODYCOUNT: 0, 
                                  BATTLECOUNT: 0,
                                DAMAGETYPE[0]: 0,
                                DAMAGETYPE[1]: 0,
                                DAMAGETYPE[2]: 0,
                                DAMAGETYPE[3]: 0,
                                DAMAGETYPE[4]: 0,
                                DAMAGETYPE[5]: 0,
                                DAMAGETYPE[6]: 0,
                                DAMAGETYPE[7]: 0,
                                DAMAGETYPE[8]: 0,
                                DAMAGETYPE[9]: 0,
                                MOVEMENT_COUNTER: 0, 
                                CARGO_COUNTER: 0,
                                  WARP: 0,
                                  UNITAGE: 0, 
                                  BESTODDS: 101,
                                  AVERAGEODDSHIGHEST: -1,
                                  AVERAGEODDSLOWEST: 101,
                                  LIFEODDS: 101,
                                  EXPERIENCE: 0,
                                  TOTALTURNSFORTIFIED: 0,
                                  MAXTURNSFORTIFIED: 0,
                                  COMMANDO: 0
                                  }
                          
            
UnitStatsData = {
                            COMBATCOUNT: {ATTACK: [0, 0, 0, 0], DEFENCE: [0, 0, 0, 0], AIRATTACK: [0, 0, 0], AIRDEFENCE: [0, 0, 0], AIRSTRIKE: [0, 0]},
                            TURNINFORMATION: [0, 0, 0, 0],
                            STARTTURN: 0,
                            UNITAGE: 0,
                            CARGO_COUNTER: 0,
                            MOVEMENT_COUNTER: 0,
                            PLOT: [0, 0],
                            WARP: 0,
                            TRANSPORT: 0,
                            DAMAGESTATS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                            BESTODDS: -1,
                            EXPERIENCE: 0,
                            AVERAGEODDS: -1,
                            LIFEODDS: 101,
                            ODDSDATA: [0, 0, "", 101, ""],
                             CAPTURECOUNT: 0,
                             GRAVEYARD: 0,
                             UNITTYPE: 0,
                             UNITID: 0,
                             PROMOTION_LIST: [],
                            LIST: "" }

PlayerStatsData = {
                            COMBATCOUNT: {ATTACK: [0, 0, 0, 0], DEFENCE: [0, 0, 0, 0], AIRATTACK: [0, 0, 0], AIRDEFENCE: [0, 0, 0], AIRSTRIKE: [0, 0]},
                            TURNINFORMATION: [0, 0, 0],
                            CARGO_COUNTER: 0,
                            MOVEMENT_COUNTER: 0,
                            WARP: 0,
                            TRANSPORT: 0,
                            DAMAGESTATS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                            EXPERIENCE: 0,
                            CAPTURECOUNT: 0,
                            GOODIES: 0,
                            HIGHEST_DEFEAT_ODDS: 0,
                            GRAVEYARDLIST: []
                                           }

