Skip to content

Commit

Permalink
Merge pull request #20 from astog/fall-2017-update
Browse files Browse the repository at this point in the history
Fall 2017 update
  • Loading branch information
astog authored Oct 29, 2017
2 parents 0aaae6d + bf23734 commit ad9dcd9
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 153 deletions.
122 changes: 61 additions & 61 deletions MoreLenses.modinfo
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Mod id="35f33319-ad93-4d6b-bf27-406fac382d06" version="1.0">
<Properties>
<Name>LOC_MORELENSES_NAME</Name>
<Stability>LOC_MORELENSES_STABILITY</Stability>
<Teaser>LOC_MORELENSES_TEASER</Teaser>
<Description>LOC_MORELENSES_DESCRIPTION</Description>
<Authors>LOC_MORELENSES_AUTHORS</Authors>
</Properties>
<Mod id="35f33319-ad93-4d6b-bf27-406fac382d06" version="2.1">
<Properties>
<Name>LOC_MORELENSES_NAME</Name>
<Stability>LOC_MORELENSES_STABILITY</Stability>
<Teaser>LOC_MORELENSES_TEASER</Teaser>
<Description>LOC_MORELENSES_DESCRIPTION</Description>
<Authors>LOC_MORELENSES_AUTHORS</Authors>
</Properties>

<Components>
<ImportFiles id="MORELENSES_IMPORT_FILES">
<Items>
<File>UI/MinimapPanel.lua</File>
<File>UI/MinimapPanel.xml</File>
<File>UI/Panels/ModalLensPanel.lua</File>
<File>UI/Panels/ModalLensPanel.xml</File>
</Items>
</ImportFiles>
<Components>
<ImportFiles id="MORELENSES_IMPORT_FILES">
<Items>
<File>UI/MinimapPanel.lua</File>
<File>UI/MinimapPanel.xml</File>
<File>UI/Panels/ModalLensPanel.lua</File>
<File>UI/Panels/ModalLensPanel.xml</File>
</Items>
</ImportFiles>

<UpdateDatabase id="MORELENSES_DATABASE">
<Items>
<File>MoreLenses_Colors.sql</File>
</Items>
</UpdateDatabase>
<UpdateDatabase id="MORELENSES_DATABASE">
<Items>
<File>MoreLenses_Colors.sql</File>
</Items>
</UpdateDatabase>

<LocalizedText id="MORELENSES_TEXT">
<Items>
<File>Text/MoreLenses_Text.xml</File>
<File>Text/MoreLenses_Text_de.xml</File>
<File>Text/MoreLenses_Text_fr.xml</File>
<File>Text/MoreLenses_Text_it.xml</File>
<File>Text/MoreLenses_Text_ko.xml</File>
<File>Text/MoreLenses_Text_pl.xml</File>
<File>Text/MoreLenses_Text_ru.xml</File>
<File>Text/MoreLenses_Text_zh.xml</File>
<File>Text/MoreLenses_Text_es.xml</File>
</Items>
</LocalizedText>
</Components>
<LocalizedText id="MORELENSES_TEXT">
<Items>
<File>Text/MoreLenses_Text.xml</File>
<File>Text/MoreLenses_Text_de.xml</File>
<File>Text/MoreLenses_Text_fr.xml</File>
<File>Text/MoreLenses_Text_it.xml</File>
<File>Text/MoreLenses_Text_ko.xml</File>
<File>Text/MoreLenses_Text_pl.xml</File>
<File>Text/MoreLenses_Text_ru.xml</File>
<File>Text/MoreLenses_Text_zh.xml</File>
<File>Text/MoreLenses_Text_es.xml</File>
</Items>
</LocalizedText>
</Components>

<LocalizedText>
<Text id="LOC_MORELENSES_NAME">
<en_US>More Lenses</en_US>
</Text>
<Text id="LOC_MORELENSES_STABILITY">
<en_US>Alpha</en_US>
</Text>
<Text id="LOC_MORELENSES_TEASER">
<en_US>Adds more lenses to the game.</en_US>
</Text>
<Text id="LOC_MORELENSES_DESCRIPTION">
<en_US>Adds more lenses to the game.</en_US>
</Text>
<Text id="LOC_MORELENSES_AUTHORS">
<en_US>astog</en_US>
</Text>
</LocalizedText>
<LocalizedText>
<Text id="LOC_MORELENSES_NAME">
<en_US>More Lenses</en_US>
</Text>
<Text id="LOC_MORELENSES_STABILITY">
<en_US>Alpha</en_US>
</Text>
<Text id="LOC_MORELENSES_TEASER">
<en_US>Adds more lenses to the game.</en_US>
</Text>
<Text id="LOC_MORELENSES_DESCRIPTION">
<en_US>Adds more lenses to the game.</en_US>
</Text>
<Text id="LOC_MORELENSES_AUTHORS">
<en_US>astog</en_US>
</Text>
</LocalizedText>

<Files>
<Files>
<File>Text/MoreLenses_Text.xml</File>
<File>Text/MoreLenses_Text_de.xml</File>
<File>Text/MoreLenses_Text_fr.xml</File>
Expand All @@ -67,11 +67,11 @@
<File>Text/MoreLenses_Text_ru.xml</File>
<File>Text/MoreLenses_Text_zh.xml</File>
<File>Text/MoreLenses_Text_es.xml</File>
<File>UI/MinimapPanel.lua</File>
<File>UI/MinimapPanel.xml</File>
<File>UI/Panels/ModalLensPanel.lua</File>
<File>UI/Panels/ModalLensPanel.xml</File>
<File>MoreLenses_Colors.sql</File>
<File>Text/MoreLenses_Text.xml</File>
</Files>
<File>UI/MinimapPanel.lua</File>
<File>UI/MinimapPanel.xml</File>
<File>UI/Panels/ModalLensPanel.lua</File>
<File>UI/Panels/ModalLensPanel.xml</File>
<File>MoreLenses_Colors.sql</File>
<File>Text/MoreLenses_Text.xml</File>
</Files>
</Mod>
142 changes: 64 additions & 78 deletions UI/MinimapPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
include( "InstanceManager" );
include( "Civ6Common.lua" ); -- GetCivilizationUniqueTraits, GetLeaderUniqueTraits
include( "SupportFunctions" );
include( "TradeSupport" )

-- ===========================================================================
-- CONSTANTS
Expand Down Expand Up @@ -647,6 +648,13 @@ end
-- ===========================================================================
function ResizeBacking()
Controls.MinimapBacking:SetSizeY(Controls.MinimapImage:GetSizeY() + MINIMAP_BACKING_PADDING_SIZEY);

-- if the minimap is collapsed, shift it accordingly
if ( m_isCollapsed ) then
Controls.Pause:Play();
Controls.CollapseAnim:SetEndVal(0, Controls.MinimapContainer:GetOffsetY() + Controls.MinimapContainer:GetSizeY());
Controls.CollapseAnim:SetToEnd();
end
end

-- ===========================================================================
Expand All @@ -663,6 +671,7 @@ end
function OnLensLayerOn( layerNum:number )
if layerNum == LensLayers.HEX_COLORING_RELIGION then
UI.PlaySound("UI_Lens_Overlay_On");
UILens.SetDesaturation(1.0);
elseif layerNum == LensLayers.HEX_COLORING_APPEAL_LEVEL then
if m_CurrentModdedLensOn == MODDED_LENS_ID.APPEAL then
SetAppealHexes();
Expand Down Expand Up @@ -710,8 +719,10 @@ end

-- ===========================================================================
function OnLensLayerOff( layerNum:number )
if (layerNum == LensLayers.HEX_COLORING_RELIGION or
layerNum == LensLayers.HEX_COLORING_CONTINENT or
if layerNum == LensLayers.HEX_COLORING_RELIGION then
UILens.SetDesaturation(0.0);

elseif (layerNum == LensLayers.HEX_COLORING_CONTINENT or
layerNum == LensLayers.HEX_COLORING_OWING_CIV) then
UI.PlaySound("UI_Lens_Overlay_Off");

Expand Down Expand Up @@ -2611,24 +2622,20 @@ function playerCanHave(playerID, xmlEntry)
end

for traitInfo in GameInfo.CivilizationTraits() do
if traitInfo.TraitType == xmlEntry.TraitType then
if traitInfo.CivilizationType ~= nil then
if civilizationType ~= traitInfo.CivilizationType then
-- print(civilizationType .. " ~= " .. traitInfo.CivilizationType)
return false
end
end
if traitInfo.TraitType == xmlEntry.TraitType and
traitInfo.CivilizationType ~= nil and
civilizationType ~= traitInfo.CivilizationType then
-- print(civilizationType .. " ~= " .. traitInfo.CivilizationType)
return false
end
end

for traitInfo in GameInfo.LeaderTraits() do
if traitInfo.TraitType == xmlEntry.TraitType then
if traitInfo.LeaderType ~= nil then
if leaderType ~= traitInfo.LeaderType then
-- print(civilizationType .. " ~= " .. traitInfo.LeaderType)
return false
end
end
if traitInfo.TraitType == xmlEntry.TraitType and
traitInfo.LeaderType ~= nil and
leaderType ~= traitInfo.LeaderType then
-- print(civilizationType .. " ~= " .. traitInfo.LeaderType)
return false
end
end

Expand All @@ -2638,49 +2645,14 @@ function playerCanHave(playerID, xmlEntry)
end

function playerHasBuilderWonderModifier(playerID)
-- Get civ, and leader type name
local civTypeName = PlayerConfigurations[playerID]:GetCivilizationTypeName();
local leaderTypeName = PlayerConfigurations[playerID]:GetLeaderTypeName();

local civUA = GetCivilizationUniqueTraits(civTypeName);
local leaderUA = GetLeaderUniqueTraits(leaderTypeName);

for _, item in ipairs(civUA) do
local traitModifier = GameInfo.TraitModifiers[item.Hash];
-- dump(traitModifier);

-- Not hashed, so find the modifier id
for row in GameInfo.Modifiers() do
if row.ModifierId == GameInfo.TraitModifiers[item.Hash].ModifierId then
-- dump(row);

if row.ModifierType == "MODIFIER_PLAYER_ADJUST_UNIT_WONDER_PERCENT" then
-- print("Player has a modifier for wonder")
return true;
end
end
end
end

for _, item in ipairs(leaderUA) do
local traitModifier = GameInfo.TraitModifiers[item.Hash];
-- dump(traitModifier);

-- Not hashed, so find the modifier id
for row in GameInfo.Modifiers() do
if row.ModifierId == GameInfo.TraitModifiers[item.Hash].ModifierId then
-- dump(row);

if row.ModifierType == "MODIFIER_PLAYER_ADJUST_UNIT_WONDER_PERCENT" then
-- print("Player has a modifier for wonder")
return true;
end
end
end
end
return playerHasModifier(playerID, "MODIFIER_PLAYER_ADJUST_UNIT_WONDER_PERCENT");
end

function playerHasBuilderDistrictModifier(playerID)
return playerHasModifier(playerID, "MODIFIER_PLAYER_ADJUST_UNIT_DISTRICT_PERCENT");
end

function playerHasModifier(playerID, modifierType)
-- Get civ, and leader
local civTypeName = PlayerConfigurations[playerID]:GetCivilizationTypeName();
local leaderTypeName = PlayerConfigurations[playerID]:GetLeaderTypeName();
Expand All @@ -2689,34 +2661,48 @@ function playerHasBuilderDistrictModifier(playerID)
local leaderUA = GetLeaderUniqueTraits(leaderTypeName);

for _, item in ipairs(civUA) do
local traitModifier = GameInfo.TraitModifiers[item.Hash];
-- dump(traitModifier);

-- Not hashed, so find the modifier id
for row in GameInfo.Modifiers() do
if row.ModifierId == GameInfo.TraitModifiers[item.Hash].ModifierId then
-- dump(row);

if row.ModifierType == "MODIFIER_PLAYER_ADJUST_UNIT_DISTRICT_PERCENT" then
-- print("Player has a modifier for district")
return true;
local traitType = civUA[1].TraitType
-- print("Trait type: " .. traitType)

-- Find the modifier ID
local modifierID;
for row in GameInfo.TraitModifiers() do
if row.TraitType == traitType then
local modifierID = row.ModifierId;

-- Find the matching modifier type
if modifierID ~= nil then
-- print("Modifier ID: " .. modifierID)
for row in GameInfo.Modifiers() do
if row.ModifierId == modifierID and row.ModifierType == modifierType then
-- print("Player has a modifier for district")
return true;
end
end
end
end
end
end

for _, item in ipairs(leaderUA) do
local traitModifier = GameInfo.TraitModifiers[item.Hash];
-- dump(traitModifier);

-- Not hashed, so find the modifier id
for row in GameInfo.Modifiers() do
if row.ModifierId == GameInfo.TraitModifiers[item.Hash].ModifierId then
-- dump(row);

if row.ModifierType == "MODIFIER_PLAYER_ADJUST_UNIT_DISTRICT_PERCENT" then
-- print("Player has a modifier for district")
return true;
local traitType = leaderUA[1].TraitType
-- print("Trait type: " .. traitType)

-- Find the modifier ID
local modifierID;
for row in GameInfo.TraitModifiers() do
if row.TraitType == traitType then
local modifierID = row.ModifierId;

-- Find the matching modifier type
if modifierID ~= nil then
-- print("Modifier ID: " .. modifierID)
for row in GameInfo.Modifiers() do
if row.ModifierId == modifierID and row.ModifierType == modifierType then
-- print("Player has a modifier for district")
return true;
end
end
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion UI/MinimapPanel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<Image Anchor="L,C" Size="7,7" Texture="LaunchBar_TrackPip" Color="255,255,255,200" Offset="0,-2"/>
<CheckBox ID="MapPinListButton" UseSelectedTextures="1" Anchor="L,C" ButtonSize="40,40" ButtonTexture="LaunchBar_Hook_ButtonSmall" Style="ButtonNormalText" ToolTip="LOC_HUD_MAP_TOGGLE_MAP_PIN_LIST" CheckTexture="Controls_Bolt" CheckColor="0,0,0,0">
<Image Texture="MiniMap_MapPins" Size="24,24" Anchor="C,C"/>
<Container ID="MapPinListPanel" Anchor="L,T" AnchorSide="I,O" Offset="-9,-5" Size="320,219" Hidden="1" AutoSize="1">
<Container ID="MapPinListPanel" Anchor="L,T" Offset="-9,-35" Size="auto,auto" Hidden="1">
<LuaContext FileName="MapPinListPanel"/>
</Container>
</CheckBox>
Expand All @@ -138,4 +138,8 @@
</Container>
</Instance>

<Instance Name="LensButtonInstance">
<RadioButton ID="LensButton" RadioGroup="ActiveLens" TextOffset="-5,0" String="$LensName$" AllowClickOff="1" Style="WhiteSemiBold14" Offset="10,4" ButtonTexture="Controls_RadioButtonLarge.dds" ButtonSize="35,35" CheckTexture="Controls_RadioButtonLarge.dds" CheckSize="35,35" CheckTextureOffset="0,35" Anchor="L,T" BoxOnLeft="1"/>
</Instance>

</Context>
Loading

0 comments on commit ad9dcd9

Please sign in to comment.