mods/heroesmapmods/battlegroundmapmods/warcraftdata.stormmod/base.stormdata/lib7eb401de.galaxy

lib7eb401de.galaxy
include "TriggerLibs/NativeLib"
include "TriggerLibs/HeroesLib"
include "TriggerLibs/GameLib"
include "TriggerLibs/MapMechanicsLib"
include "TriggerLibs/UILib"

include "Lib7EB401DE_h"

//--------------------------------------------------------------------------------------------------
// Library: Warcraft
//--------------------------------------------------------------------------------------------------
// External Library Initialization
void lib7EB401DE_InitLibraries () {
    libNtve_InitVariables();
    libCore_InitVariables();
    libGame_InitVariables();
    libMapM_InitVariables();
    libUIUI_InitVariables();
}

// Variable Initialization
bool lib7EB401DE_InitVariables_completed = false;

void lib7EB401DE_InitVariables () {
    if (lib7EB401DE_InitVariables_completed) {
        return;
    }

    lib7EB401DE_InitVariables_completed = true;

}

// Presets
// Functions
void lib7EB401DE_gf_WarcraftSetPlayerFaction (int lp_player, int lp_faction) {
    // Automatic Variable Declarations
    // Implementation
    if ((lp_faction == lib7EB401DE_ge_WarcraftFaction_Horde)) {
        TechTreeUpgradeAddLevel(lp_player, "IsHorde", 1);
    }
    else {
        TechTreeUpgradeAddLevel(lp_player, "IsAlliance", 1);
    }
}

void lib7EB401DE_gf_InitializeSpiritHealerForTeam (unit lp_spiritHealer, int lp_team) {
    // Automatic Variable Declarations
    // Implementation
    lib7EB401DE_gv_spiritHealer[lp_team] = lp_spiritHealer;
}

void lib7EB401DE_gf_InitializeHellbatMercType (int lp_campType, fixed lp_initialSpawnDelay, fixed lp_respawnTime) {
    // Variable Declarations
    int lv_campTypeInt;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_campTypeInt = (lp_campType);

    // Implementation
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_campIsSoloable = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_defendersCoweronDeath = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_initialSpawnDelay = lp_initialSpawnDelay;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_respawnTime = lp_respawnTime;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_numberOfCreeps = 3;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_campTypeMinimapLabel = StringExternal("Param/Value/lib_7EB401DE_595DF576");
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_creepUnitTypes[1] = "TerranHellbatDefender";
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_defenderCoweringUnit[1] = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_creepUnitTypes[2] = "TerranHellbatDefender";
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_defenderCoweringUnit[2] = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_creepUnitTypes[3] = "TerranHellbatDefender";
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_defenderCoweringUnit[3] = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_xPAwardForCapture = libCore_gv_data_XP_SiegeGiantCapture_C;
    libMapM_gv_dataJungleCampMercData[lv_campTypeInt].lv_numberOfMinionsSpawned = 3;
    libMapM_gv_dataJungleCampMercData[lv_campTypeInt].lv_spawnedMinionUnitTypes[1] = "TerranHellbat";
    libMapM_gv_dataJungleCampMercData[lv_campTypeInt].lv_spawnedMinionUnitTypes[2] = "TerranHellbat";
    libMapM_gv_dataJungleCampMercData[lv_campTypeInt].lv_spawnedMinionUnitTypes[3] = "TerranHellbat";
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_numberOfRanks = MinI((CatalogFieldValueCount(c_gameCatalogBehavior, "TerranHellbatDefenderScaling", "VeterancyLevelArray", c_playerAny) - 1), libCore_gv_dataScalingMaxScalingTicks);
    libMapM_gv_dataJungleCampMercData[lv_campTypeInt].lv_numberOfRanks = MinI((CatalogFieldValueCount(c_gameCatalogBehavior, "TerranHellbatScaling", "VeterancyLevelArray", c_playerAny) - 1), libCore_gv_dataScalingMaxScalingTicks);
    libUIUI_gf_PingCreateNewPingTarget("TerranHellbatDefender", false, StringExternal("Param/Value/lib_7EB401DE_BCB4AAF1"), StringExternal("Param/Value/lib_7EB401DE_98866DCA"), StringExternal("Param/Value/lib_7EB401DE_EA08FC76"), SoundLink("UI_Game_Ping_Attack", -1), SoundLink("UI_Game_Ping_Attack", -1));
    libUIUI_gf_PingSetHumanAISourceHeroVOForPingTarget(libUIUI_gf_PingLastCreatedPingTarget(), libCore_ge_HeroVOEvents_PingAttackMercCamp, libCore_ge_HeroVOEvents_AIMercCapture);
    libUIUI_gf_PingCreateNewPingTarget("TerranHellbat", false, StringExternal("Param/Value/lib_7EB401DE_7C0258DF"), StringExternal("Param/Value/lib_7EB401DE_3E5367F1"), StringExternal("Param/Value/lib_7EB401DE_A4D4C28E"), SoundLink("UI_Game_Ping_Attack", -1), SoundLink("UI_Game_Ping_Attack", -1));
    libUIUI_gf_PingSetAllyEnemyTargetHeroVOForPingTarget(libUIUI_gf_PingLastCreatedPingTarget(), libCore_ge_HeroVOEvents_PingAttackHere, libCore_ge_HeroVOEvents_PingAttackHere);
}

void lib7EB401DE_gf_InitializeMountainGiant (int lp_campType) {
    // Variable Declarations
    int lv_campTypeInt;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_campTypeInt = (lp_campType);

    // Implementation
    libMapM_gv_dataJungleCampDefenderData[lv_campTypeInt].lv_campTypeMinimapLabel = StringExternal("Param/Value/lib_7EB401DE_1631AB5F");
    libUIUI_gf_PingCreateNewPingTarget("JungleGraveGolemLaner", false, StringExternal("Param/Value/lib_7EB401DE_619E2F27"), StringExternal("Param/Value/lib_7EB401DE_E4620B17"), StringExternal("Param/Value/lib_7EB401DE_FFBF2E84"), SoundLink("UI_Game_Ping_Attack", -1), SoundLink("UI_Game_Ping_Attack", -1));
    libUIUI_gf_PingSetAllyEnemyTargetHeroVOForPingTarget(libUIUI_gf_PingLastCreatedPingTarget(), libCore_ge_HeroVOEvents_PingAttackHere, libCore_ge_HeroVOEvents_PingAttackHere);
}

// Triggers
//--------------------------------------------------------------------------------------------------
// Trigger: Debug - Swap Factions
//--------------------------------------------------------------------------------------------------
bool lib7EB401DE_gt_DebugSwapFactions_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!((libCore_gv_dEBUGDebuggingEnabled == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TriggerDebugOutput(1, StringExternal("Param/Value/lib_7EB401DE_590D7A36"), true);
    if ((TechTreeUpgradeCount(libCore_gv_cOMPUTER_TeamOrder, "IsAlliance", c_techCountCompleteOnly) > 0)) {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_7EB401DE_839A967E"), true);
        libNtve_gf_SetUpgradeLevelForPlayer(libCore_gv_cOMPUTER_TeamChaos, "IsHorde", 0);
        TechTreeUpgradeAddLevel(libCore_gv_cOMPUTER_TeamChaos, "IsAlliance", 1);
        libNtve_gf_SetUpgradeLevelForPlayer(libCore_gv_cOMPUTER_TeamOrder, "IsAlliance", 0);
        TechTreeUpgradeAddLevel(libCore_gv_cOMPUTER_TeamOrder, "IsHorde", 1);
    }
    else {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_7EB401DE_A2550E68"), true);
        libNtve_gf_SetUpgradeLevelForPlayer(libCore_gv_cOMPUTER_TeamOrder, "IsHorde", 0);
        TechTreeUpgradeAddLevel(libCore_gv_cOMPUTER_TeamOrder, "IsAlliance", 1);
        libNtve_gf_SetUpgradeLevelForPlayer(libCore_gv_cOMPUTER_TeamChaos, "IsAlliance", 0);
        TechTreeUpgradeAddLevel(libCore_gv_cOMPUTER_TeamChaos, "IsHorde", 1);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib7EB401DE_gt_DebugSwapFactions_Init () {
    lib7EB401DE_gt_DebugSwapFactions = TriggerCreate("lib7EB401DE_gt_DebugSwapFactions_Func");
    TriggerAddEventChatMessage(lib7EB401DE_gt_DebugSwapFactions, c_playerAny, "-swapfaction", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Hero Killed - Show Team's Spirit Healer For Player
//--------------------------------------------------------------------------------------------------
bool lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer_Func (bool testConds, bool runActions) {
    // Variable Declarations
    string lv_heroKilledUnit_c;
    int lv_heroKilledPlayer_c;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_heroKilledUnit_c = UnitGetType(libGame_gf_HeroKilledUnit());
    lv_heroKilledPlayer_c = libGame_gf_HeroKilledPlayer();

    // Conditions
    if (testConds) {
        if (!((lv_heroKilledUnit_c != "HeroBaleog"))) {
            return false;
        }

        if (!((lv_heroKilledUnit_c != "HeroOlaf"))) {
            return false;
        }

        if (!((lv_heroKilledUnit_c != "HeroErik"))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    libNtve_gf_SendActorMessageToUnit(lib7EB401DE_gv_spiritHealer[libGame_gf_TeamNumberOfPlayer(lv_heroKilledPlayer_c)], "SetFilterPlayers " + IntToString(lv_heroKilledPlayer_c) + " Clear");
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer_Init () {
    lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer = TriggerCreate("lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer_Func");
    libGame_gf_HeroKilled(lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Hero Respawn - Hide Team's Spirit Healer For Player
//--------------------------------------------------------------------------------------------------
bool lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_heroRespawnPlayer_c;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_heroRespawnPlayer_c = libGame_gf_HeroRespawnPlayer();

    // Actions
    if (!runActions) {
        return true;
    }

    libNtve_gf_SendActorMessageToUnit(lib7EB401DE_gv_spiritHealer[libGame_gf_TeamNumberOfPlayer(lv_heroRespawnPlayer_c)], "SetFilterPlayers " + IntToString(lv_heroRespawnPlayer_c));
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer_Init () {
    lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer = TriggerCreate("lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer_Func");
    libGame_gf_HeroRespawn(lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer);
}

void lib7EB401DE_InitTriggers () {
    lib7EB401DE_gt_DebugSwapFactions_Init();
    lib7EB401DE_gt_HeroKilledShowTeamsSpiritHealerForPlayer_Init();
    lib7EB401DE_gt_HeroRespawnHideTeamsSpiritHealerForPlayer_Init();
}

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
bool lib7EB401DE_InitLib_completed = false;

void lib7EB401DE_InitLib () {
    if (lib7EB401DE_InitLib_completed) {
        return;
    }

    lib7EB401DE_InitLib_completed = true;

    lib7EB401DE_InitLibraries();
    lib7EB401DE_InitVariables();
    lib7EB401DE_InitTriggers();
}