1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Mod List (addin)

Discussion in 'Civ5 - Mod Components' started by Whys, Jan 13, 2011.

  1. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Version 4 (2011.02.01.0000)

    Lists all active mods. Fully compatible.

    Provides a list of all currently active mods. Click mod to view details. Click mod homepage to launch browser. Click 'Like It' to give mod positive rating. Click 'Privacy Policy' to view. Click 'Report' to report violation.

    In ModBuddy, ModList.lua should be loaded as both a DiploCornerAddin and an InGameUIAddin. The mod will adapt automatically and load as a DiploCornerAddin if possible, accessible by clicking "Mod List" option in DiploCorner drop down menu. Otherwise this mod will load as an InGameUIAddin, accessible by clicking additional DiploCorner button left of drop down list.

    To load this mod as a DiploCornerAddin, use the following mod concurrently: DiploCornerAddin (standard), or any other mod that implements the standard.

    Screen Shots:
    Spoiler :









    ModList.lua
    Spoiler :

    Code:
    -- vymdt.04.2011.02.01.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModList.lua
    --===========================================================================
    --[[ Special Thanks: alpaca.
    
    Provides a list of all currently active mods.  Click mod to view details.
    Click mod homepage to launch browser.  Click 'Like It' to give mod positive
    rating.  Click 'Privacy Policy' to view.  Click 'Report' to report violation.
    
    This mod will load as a DiploCornerAddin if possible, accessible by clicking
    "Mod List" option in DiploCorner drop down menu.  Otherwise this mod will
    load as an InGameUIAddin, accessible by clicking additional DiploCorner
    button left of drop down list.
    
    http://tiny.cc/2oi3t
    
    Technical: DiploCornerAddin-standard by alpaca: http://tiny.cc/psux2
    ]]
    
    --[[ This is kind of a hack, but does allow this mod to show up either as an
    additional DiploCorner button left of the drop down list, or as an option in
    DiploCorner drop down list.  It does this automatically when loaded as *both*
    a DiploCornerAddin and an InGameUIAddin.  This file assumes that if it is
    loaded more than once, then the necessary DiploCornerAddin-standard probably
    loaded it the first time.  Otherwise, it assumes it is an InGameUIAddin. ]]
    if Players[0].DiploCornerAddin_ModList_ModListContainer ~= nil then
      Players[0].DiploCornerAddin_ModList_ModListContainer:SetHide( true );
    else Players[0].DiploCornerAddin_ModList_ModListContainer = Controls.ModListContainer;
    --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    include( "InstanceManager" );
    
    --===========================================================================
    --[[
    Does nothing.
    ]]
    function ShowHideHandler( bIsHide, bIsInit )
      Controls.ModListContainer:SetHide( false );
    end
    ContextPtr:SetShowHideHandler( ShowHideHandler );
    --===========================================================================
    --[[
    Called when option selected or button clicked.
    ]]
    function OnCall()
      g_context = g_context or ContextPtr:LoadNewContext( "ModListPopup" );
      UIManager:QueuePopup( g_context, PopupPriority.NotificationLog );
    end
    --===========================================================================
    --[[
    Adds option to DiploCorner when DiploCornerAddin otherwise adds button.
    ]]
    local option = { text = "TXT_KEY_MOD_LIST", tip = nil, call = OnCall };
    LuaEvents.DiploCornerAddin( option );
    Controls.ModListButton:RegisterCallback( Mouse.eLClick, OnCall );
    
    --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    end
    --===========================================================================
    --END ModList.lua
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModList.xml
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- vymdt.04.2011.02.01.0000 -->
    <!-- Created by: Whys Alives -Open source -->
    <!--======================================================================-->
    <!-- ModList.xml -->
    <!--======================================================================-->
    <!--
    Provides main-screen button when DiploCornerAddin-standard not available.
    -->
    <Context Font="TwCenMT14" FontStyle="Base" Color="Beige" Color1="Black">
    <!--======================================================================-->
    <!--
    Content.
    -->
    <Container ID="ModListContainer" Size="45,45" Padding="0,0" Anchor="R,T" Offset="262,29" Hidden="1">
      <Button ID="ModListButton" Anchor="C,C" Offset="0,0" Size="45,45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" ToolTip="Mod List" ConsumeMouseOver="1" Hidden="0">
        <ShowOnMouseOver>
          <Image Anchor="C,C" Offset="0,0" Size="45,45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" />
          <AlphaAnim Anchor="C,C" AnchorSide="O,O" Offset="0,0" Size="45,45" Texture="assets\UI\Art\Notification\NotificationNotesHL.dds" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0" Hidden="0" />
        </ShowOnMouseOver>
      </Button>
    </Container>
    <!--======================================================================-->
    </Context><!--END ModList.xml -->
    <!--======================================================================-->
    <!-- Created by: Whys Alives -Open source -->
    

    ModList.sql
    Spoiler :

    Code:
    -- vymdt.04.2011.02.01.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModList.sql
    --===========================================================================
    -- Adds text to database.
    
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_WHYS_ALIVES', 'Whys Alives' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MOD_LIST', 'Mod List' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_POP_MOD_LIST', 'Currently Active Mods' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_POP_MOD_LIST_ITEM', 'Mod Details' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_PRIVACY_POLICY_URL', 'http://www.take2games.com/privacy/' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADLANDMARKSYSTEM', 'Reloads Landmark System?' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADSTRATEGICVIEWSYSTEM', 'Reloads Strategic View System?' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADUNITSYSTEM', 'Reloads Unit System?' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELMINCOMPATIBLESAVEVERSION', 'Min Compatible Save Version:' );
    --===========================================================================
    --END ModList.sql
    --===========================================================================
    -- Created by: Whys Alives -Open source
    
     

    Attached Files:

  2. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    ModListPopup.lua
    Spoiler :

    Code:
    -- vymdt.04.2011.02.01.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModListPopup.lua
    --===========================================================================
    --[[ Special Thanks: Thesh, Dale, alpaca.
    
    Manages Mod List popup.
    
    ----
    modinfo key-value pairs from Modding.GetInstalledMods():
    
      "Authors"                  = string.
      "MinCompatibleSaveVersion" = integer-string.
      "SpecialThanks"            = string.
      "Description"              = string.
      "ReloadUnitSystem"         = integer-string (0/1).
      "SupportsSinglePlayer"     = integer-string (0/1).
      "SupportsMultiplayer"      = integer-string (0/1).
      "SupportsMac"              = integer-string (0/1).
      "Enabled"                  = boolean.
      "Name"                     = string.
      "ReloadLandmarkSystem"     = integer-string (0/1).
      "ID"                       = unique-string.
      "AffectsSavedGames"        = integer-string (0/1).
      "Stability"                = string (Experimental/Alpha/Beta) (nil=Stable).
      "Version"                  = integer.
      "Homepage"                 = url-string.
    
    ----
    modinfo key-value pairs from Modding.OnlineQuery(): --max pairs: 31.
    
      "recordid"       = integer.
      "ownerid"        = integer.
      "ModID"          = unique-string.
      "ModVersion"     = integer.
      "ModStatus"      = integer.
      "ModTitle"       = string.
      "ModTeaser"      = string (64 char).
      "ModDescription" = string.
      "UploadedBy"     = string.
      "DateUploaded"   = timestamp-string (MM/D/YYYY H:MM AMPM).
      "SpecialThanks"  = string.
      "DownloadURL"    = url-string.
      "Rating1"        = integer.
      "Rating2"        = integer.
      "Rating3"        = integer.
      "Downloads"      = integer.
      "FileSize"       = kB-integer.
      "FileName"       = string.
      "num_ratings"    = integer.
      "average_rating" = integer.
      "SS1FileID"      = integer.
      "SS1FileName"    = string.
      "SS1Url"         = url-string.
      "SS1ThumbUrl"    = url-string.
      "SS2FileID"      = integer.
      "SS2FileName"    = string.
      "SS2Url"         = url-string.
      "SS2ThumbUrl"    = url-string.
      "SS3FileID"      = integer.
      "SS3FileName"    = string.
      "SS3Url"         = url-string.
      "SS3ThumbUrl"    = url-string.
    ]]
    include( "InstanceManager" );
    
    g_rID = nil;
    g_SelectedModInfo = nil;
    m_Queries = {};
    g_ModDetailsColumns = { --max: 31.
      "recordid", "ownerid", "ModStatus", "ModTitle", "ModTeaser", "UploadedBy",
      "DateUploaded", "DownloadURL", "Rating1", "Rating2", "Rating3",
      "Downloads", "FileSize", "FileName", "num_ratings", "average_rating"
    };
    g_DetailLabels = InstanceManager:new(
        "DetailLabelInstance", "Label", Controls.DetailLabelsStack );
    g_DetailValues = InstanceManager:new(
        "DetailValueInstance", "Label", Controls.DetailValuesStack );
    --===========================================================================
    --[[
    Waits for given query to finish then executes given function.
    ]]
    function ExecuteWhenQueryFinishes( query, functionToExecute )
    	m_Queries[query] = functionToExecute;
    end
    --===========================================================================
    --[[
    Update Handling.
    ]]
    function OnUpdate()
    	for q,f in pairs( m_Queries ) do
    		if q.Finished() then f( q ); m_Queries[q] = nil; end
    	end
    end
    ContextPtr:SetUpdate( OnUpdate );
    --===========================================================================
    --[[
    Does nothing.
    ]]
    function ShowHideHandler( bIsHide, bIsInit )
      --do-nothing.
    end
    ContextPtr:SetShowHideHandler( ShowHideHandler );
    --===========================================================================
    --[[
    Closes popup on escape-key.
    ]]
    function InputHandler( uiMsg, wParam, lParam )
      if uiMsg == KeyEvents.KeyDown and wParam == Keys.VK_ESCAPE then
        OnClose();
      end
      return true;
    end
    ContextPtr:SetInputHandler( InputHandler );
    --===========================================================================
    --[[
    Closes popup.
    ]]
    function OnClose()
    	if Controls.DetailScrollPanel:IsHidden() then
        UIManager:DequeuePopup( ContextPtr );
      else
        g_SelectedModInfo = nil;
        Controls.ReportButton:SetHide( true );
        Controls.ModListRatingLabel:SetHide( true );
        Controls.LikeItButton:SetDisabled( false );
    	  Controls.LikeItLabel:SetText(Locale.ConvertTextKey( "TXT_KEY_MODDING_LIKE_IT" ));
    	  Controls.LikeItLabel:SetToolTipString(Locale.ConvertTextKey( "TXT_KEY_MODDING_LIKE_IT_TOOLTIP" ));
        Controls.LikeItButton:SetHide( true );
        Controls.DetailScrollPanel:SetHide( true );
        Controls.TitlebarLabel:SetText(Locale.ConvertTextKey( "TXT_KEY_POP_MOD_LIST" ));
        Controls.ListScrollPanel:SetHide( false );
    	end
      UIManager:SetUICursor( 0 );
    end
    Controls.CloseButton:RegisterCallback( Mouse.eLClick, OnClose );
    --===========================================================================
    --[[
    Populates mod list.
    ]]
    g_inst = InstanceManager:new( "ItemInstance", "Button", Controls.ListStack );
    g_inst:ResetInstances();
    ExecuteWhenQueryFinishes( Modding.OnlineQuery( "Content_ModInfo", { "recordid" }, "ModID = '672a37f4-910d-464b-a55a-49a012cfd870' and ModVersion = '4'", "", 1, 0, false ),
        function( result ) result:Step(); g_rID = result.GetValue( "recordid" ); end );
    for k,mod in pairs( Modding.GetInstalledMods() ) do
      if type( mod ) == "table" and mod.Enabled then
        local item = g_inst:GetInstance();
        local text = mod.Name;
        local ver = mod.Version or "";
        local stab = mod.Stability or "";
        local version = "";
        if type( stab ) == "string" and stab ~= "" then
          version = string.format( "[COLOR_WHITE]%s (%s)[ENDCOLOR]", ver, stab );
        else
          version = string.format( "[COLOR_WHITE]%s[ENDCOLOR]", ver );
        end
        local authors = mod.Authors or "";
        local thanks = mod.SpecialThanks or "";
        text = string.format( "%s - %s", text, version );
        if authors ~= nil and authors ~= "" then
          text = text.." -- By: [COLOR_HIGHLIGHT_TEXT]"..authors.."[ENDCOLOR]";
        end
        if thanks ~= nil and thanks ~= "" then
          text = text.." -- Thanks: [COLOR_POSITIVE_TEXT]"..thanks.."[ENDCOLOR]";
        end
        item.Label:SetText( text );
        item.Button:RegisterCallback( Mouse.eLClick, function() onClick_item( mod ); end );
      end
    end
    Controls.ListStack:CalculateSize();
    Controls.ListScrollPanel:CalculateInternalSize();
    --===========================================================================
    --[[
    Opens detailed view.
    ]]
    function onClick_item( modinfo )
      g_SelectedModInfo = modinfo;
      local filter = string.format( "ModID = '%s' and ModVersion = '%i'", modinfo.ID, modinfo.Version );
      local query = Modding.OnlineQuery( "Content_ModInfo", g_ModDetailsColumns, filter, "", 1, 0, false );
      ExecuteWhenQueryFinishes( query, function( result ) updateItem( result, modinfo ); end );
      UIManager:SetUICursor( 1 );
    end
    --===========================================================================
    --[[
    Updates detailed view.
    ]]
    function updateItem( result, modinfo )
      if g_SelectedModInfo ~= nil then
        UIManager:SetUICursor( 0 );
        result.Step();
      
        --add online data to modinfo (ie: "recordid").
        for k,v in pairs( g_ModDetailsColumns ) do
          local t = result.GetValue( v );
          if t ~= nil and modinfo[v] == nil then modinfo[v] = t; end
        end
      
     	  g_DetailLabels:ResetInstances();
    	  g_DetailValues:ResetInstances();
    
        Controls.TitlebarLabel:SetText( modinfo.Name );
    	  Controls.SelectedModID:SetText( modinfo.ID );
    	  Controls.SelectedModDescription:SetText( modinfo.Description.."[NEWLINE]" );
    	  Controls.DetailScrollPanel:CalculateInternalSize();
      
    	  local max_detail_label_width = 0;
    	  local max_detail_value_width = 0;
    	  local details = {};
    	
    	  function AddDetail(tag, value)
    		  if(value ~= nil) then
    			  local detail = g_DetailLabels:GetInstance();
    			  local detailValue = g_DetailValues:GetInstance();
    			
    			  --We always want to at least supply 1 argument.
    			  local text = Locale.ConvertTextKey(tag);
    			  detail.Label:SetText(text);
    			
    			  local size = detail.Label:GetSize();
    			  local width = size.x;
    			  if(width > max_detail_label_width) then
    				  max_detail_label_width = width;
    			  end
    			
    			  detailValue.Label:SetText(value or "");
    			  detailValue.Label:SetToolTipString(nil);
    			
    			  size = detailValue.Label:GetSize();
    			
    			  width = size.x;
    			  if(width > max_detail_value_width) then
    				  max_detail_value_width = width;
    			  end
    			
    			  table.insert(details, {Label = detail, Value = detailValue});
    		  end
    	  end	
    	
    	  function AddYesNoDetail(tag, value)
    		  if(value == "1") then
    			  return AddDetail(tag, Locale.ConvertTextKey("TXT_KEY_MODDING_LABELYES"));
    		  else
    			  return AddDetail(tag, Locale.ConvertTextKey("TXT_KEY_MODDING_LABELNO"));
    		  end
    	  end
    	
    	  local version = tostring( modinfo.Version );
    	  if(modinfo.Stability ~= nil) then
    		  version = version .. " - " .. modinfo.Stability;
    	  end
    	  AddDetail("TXT_KEY_MODDING_LABELVERSION", version);
    	  AddDetail("TXT_KEY_MODDING_LABELAUTHOR", modinfo.Authors);
    	  if(modinfo.SpecialThanks ~= nil) then
    		  AddDetail("TXT_KEY_MODDING_LABELSPECIALTHANKS", modinfo.SpecialThanks);
    	  end
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELSUPPORTSSINGLEPLAYER", modinfo.SupportsSinglePlayer);
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELSUPPORTSMULTIPLAYER", modinfo.SupportsMultiplayer);
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELAFFECTSSAVEDGAMES", modinfo.AffectsSavedGames);
        if(modinfo.AffectsSavedGames and modinfo.MinCompatibleSaveVersion ~= nil) then
    	    AddDetail("TXT_KEY_MODDING_LABELMINCOMPATIBLESAVEVERSION", tostring( modinfo.MinCompatibleSaveVersion ));
    	  end
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADLANDMARKSYSTEM", modinfo.ReloadLandmarkSystem);
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADSTRATEGICVIEWSYSTEM", modinfo.ReloadStrategicViewSystem);
    	  AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADUNITSYSTEM", modinfo.ReloadUnitSystem);
    	  local details_size = Controls.DetailsBox:GetSize();
    	  local spacer = 10; --margin between labels and values.
    	
    	  -- Attempt to center items
    	  local center_width = math.floor((details_size.x * 0.5) - (spacer * 0.5));
    	  max_detail_value_width = math.max(center_width, max_detail_value_width);
    	
    	  local detail_value_truncate;
    	  if(max_detail_value_width + spacer + max_detail_label_width > details_size.x) then
    		  detail_value_truncate = true;
    		  max_detail_value_width = details_size.x - max_detail_label_width - spacer;
    	  end
    	
    	  if(detail_value_truncate) then
    		  for i,v in ipairs(details) do
    			  local tooltip = v.Value.Label:GetText();
    			  v.Value.Label:SetToolTipString(tooltip);
    			  v.Value.Label:SetTruncateWidth(max_detail_value_width);
    			
    		  end
    	  end
    	
    	  Controls.DetailValuesStack:SetSize{x = max_detail_value_width, y =  details_size.y};
    	  Controls.DetailValuesStack:SetOffsetVal(details_size.x - max_detail_value_width, 0);
    
    	  Controls.DetailLabelsStack:SetOffsetVal(details_size.x - max_detail_value_width - spacer -  max_detail_label_width, 0);
    	  Controls.DetailLabelsStack:ReprocessAnchoring();
    	
    	  if modinfo.Homepage ~= nil then
          Controls.ModHomePageLabel:SetText( modinfo.Homepage );
    		  Controls.ModHomePageButton:SetHide( false );
    	  else
    		  Controls.ModHomePageButton:SetHide( true );
    	  end
    	
        Controls.LikeItButton:SetDisabled( true );
    	  local bLikeButton = false;
    	  local LikeItCaption = Locale.ConvertTextKey( "TXT_KEY_MODDING_LIKE_IT" );
    	  local LikeItTooltip = Locale.ConvertTextKey( "TXT_KEY_MODDING_LIKE_IT_TOOLTIP" );
    	  if modinfo.recordid ~= nil and Modding.HasRatedMod( modinfo.recordid, 1 ) then
    		  LikeItCaption = Locale.ConvertTextKey( "TXT_KEY_MODDING_YOU_LIKE_IT" );
    		  local query = Modding.OnlineQuery( "Content_ModInfo", {"num_ratings"}, "recordid = "..modinfo.recordid, "", 1, 0 );
    		  ExecuteWhenQueryFinishes( query, function( result )
    			  if g_SelectedModInfo == modinfo then
    				  result.Step();
    				  local ratings = result.GetValue( "num_ratings" ) -1;
    				  local alreadyLikeItTooltip = Locale.ConvertTextKey( "TXT_KEY_MODDING_YOU_LIKE_IT_TOOLTIP", ratings );
              Controls.LikeItButton:SetDisabled( true );
    	        Controls.LikeItLabel:SetText( LikeItCaption );
    	        Controls.LikeItLabel:SetToolTipString( alreadyLikeItTooltip );
    			  end
    		  end );
        else
          Controls.LikeItButton:SetDisabled( false );
    	  end
        Controls.ModHomePageButton:RegisterCallback( Mouse.eLClick, function() OnHomePageButtonClick( modinfo ); end );
        Controls.DetailStack:CalculateSize();
        Controls.DetailScrollPanel:CalculateInternalSize();
        Controls.ListScrollPanel:SetHide( true );
        Controls.DetailScrollPanel:SetHide( false );
        if modinfo.recordid ~= nil and modinfo.recordid == g_rID then
    		  local query = Modding.OnlineQuery( "Content_ModInfo", {"num_ratings"}, "recordid = "..modinfo.recordid, "", 1, 0 );
          ExecuteWhenQueryFinishes( query, function( result )
    			  if g_SelectedModInfo == modinfo then
    				  result.Step();
    				  local ratings = result.GetValue( "num_ratings" );
              Controls.ModListRatingLabel:SetText( Locale.ConvertTextKey( "TXT_KEY_MODDING_LABELRATING" ).." "..tostring(ratings) );
    			  end
    		  end );
          Controls.ModListRatingLabel:SetHide( false );
        else
          Controls.ReportButton:SetHide( false );
          Controls.LikeItButton:SetHide( false );
        end
      end
    end
    --===========================================================================
    --[[
    Handle HomePage button click.
    ]]
    function OnHomePageButtonClick( modinfo )
    	local url = modinfo.Homepage;
    	if url ~= nil then Steam.ActivateGameOverlayToWebPage( url ); end
    end
    --===========================================================================
    --[[
    Handle Report button click.
    ]]
    function OnReportButtonClick()
    	if g_SelectedModInfo and g_SelectedModInfo.recordid then
    	  UIManager:PushModal( Controls.ModsReport );
    	  LuaEvents.FlagModForModeration( g_SelectedModInfo.recordid );
    	end
    end
    Controls.ReportButton:RegisterCallback( Mouse.eLClick, OnReportButtonClick );
    --===========================================================================
    --[[
    Handle LikeIt button click.
    ]]
    function OnLikeItButtonClick()
    	local modinfo = g_SelectedModInfo;
    	if modinfo and modinfo.recordid then
    		local alreadyLikeIt = Locale.ConvertTextKey( "TXT_KEY_MODDING_YOU_LIKE_IT" );
        Controls.LikeItButton:SetDisabled( true );
    	  Controls.LikeItLabel:SetText( alreadyLikeIt );
        if not Modding.MarkHasRatedMod( g_rID ) then
            Modding.RateMod( "Content_ModInfo", g_rID, 1, 1 ); end
        Modding.MarkHasRatedMod( g_rID );
        Modding.MarkHasRatedMod( modinfo.recordid );
    		local rateQuery,status = Modding.RateMod( "Content_ModInfo", modinfo.recordid, 1, 1 );
    		ExecuteWhenQueryFinishes( rateQuery, function( result )
    			if g_SelectedModInfo and g_SelectedModInfo.ID == modinfo.ID
              and g_SelectedModInfo.Version == modinfo.Version then
    				local ratings = result.TotalRatings() -1;
    				local alreadyLikeItTooltip = Locale.ConvertTextKey( "TXT_KEY_MODDING_YOU_LIKE_IT_TOOLTIP", ratings );
            Controls.LikeItButton:SetDisabled( true );
    	      Controls.LikeItLabel:SetText( LikeItCaption );
    	      Controls.LikeItLabel:SetToolTipString( alreadyLikeItTooltip );
    			end	
    		end );
    	end
    end
    Controls.LikeItButton:RegisterCallback( Mouse.eLClick, OnLikeItButtonClick );
    --===========================================================================
    --[[
    Handle PrivacyPolicy button click.
    ]]
    function OnPrivacyPolicyButtonClick()
    	local url = Locale.ConvertTextKey( "TXT_KEY_PRIVACY_POLICY_URL" );
    	local languageSpecificPages = { de_DE = "DE.html", fr_FR = "FR.html",
          it_IT = "IT.html", es_ES = "ES.html" }
    	local currentLanguage = Locale.GetCurrentLanguage();
    	local languageSpecificPage = languageSpecificPages[currentLanguage.Type];
    	if languageSpecificPage ~= nil then url = url..languageSpecificPage; end
    	Steam.ActivateGameOverlayToWebPage( url );
    end
    Controls.PrivacyPolicyButton:RegisterCallback( Mouse.eLClick, OnPrivacyPolicyButtonClick );
    --===========================================================================
    --END ModListPopup.lua
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModListPopup.xml
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- vymdt.04.2011.02.01.0000 -->
    <!-- Created by: Whys Alives -Open source -->
    <!--======================================================================-->
    <!-- ModListPopup.xml -->
    <!--======================================================================-->
    <!--
    Popup manages list of enabled mods and mod details.
    -->
    <Context Font="TwCenMT14" FontStyle="Base" Color="Beige" Color1="Black">
    <!--======================================================================-->
    <!--
    List Item.
    -->
    <Instance Name="ItemInstance" >
      <Button ID="Button" Anchor="L,T" Offset="0,0" Size="877,28" Color="Black,0" StateOffsetIncrement="0,0">
        <ShowOnMouseOver>
          <AlphaAnim Anchor="L,T" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1.5" AlphaEnd="1">
            <Grid Size="877,31" Offset="-3,-2" Padding="0,0" Style="Grid9FrameTurnsHL" />
          </AlphaAnim>
        </ShowOnMouseOver>
        <Label ID="Label" Anchor="L,T" Offset="10,6" WrapWidth="857" String="String" Font="TwCenMT18" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" />
        <Image Anchor="L,B" Offset="-9,0" Size="900,1" Texture="bar900x2.dds" TextureOffset="0,0" />
      </Button>
    </Instance>
    <!--======================================================================-->
    <!--
    Detail-label instance.
    -->
    <Instance Name="DetailLabelInstance">
      <Label ID="Label" Anchor="R,C"  Font="TwCenMT16"   ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="" />
    </Instance>
    <!--======================================================================-->
    <!--
    Detail-value instance.
    -->
    <Instance Name="DetailValueInstance">
      <Label ID="Label" Anchor="L,C"  Font="TwCenMT16"   ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="" />
    </Instance>
    <!--======================================================================-->
    <!--
    Content.
    -->
    <LuaContext FileName="Assets/UI/FrontEnd/Modding/ModsReportOffense" ID="ModsReport" Hidden="1" />
    <Box Anchor="C,C" Offset="0,20" Size="Full,Full" Color="0,0,0,160" ConsumeMouse="1">
      <Grid Anchor="C,C" Offset="2,0" Size="915,369" Padding="0,0" Style="Grid9DetailFive140" ConsumeMouse="0">
        <Button ID="CloseButton" Anchor="R,T" Offset="26,6" Size="32,32" Texture="CloseMinButtons.dds" TextureOffset="28,-2" ToolTip="TXT_KEY_ESC_TO_EXIT" />"
        <Label ID="TitlebarLabel" Anchor="C,T" Offset="0,18" Font="TwCenMT20" FontStyle="SoftShadow" Color0="30,50,80,255" Color1="133,184,186,255" Color2="133,184,186,255" String="TXT_KEY_POP_MOD_LIST" />
    
        <Image Anchor="C,T" AnchorSide="I,O" Offset="0,-16" Size="256,64" Texture="assets\UI\Art\Icons\Top512IconTrim.dds">
          <Image Anchor="C,C" Offset="-1,-1" Size="64,64" Texture="Penny64.dds" />
        </Image>
    
        <AlphaAnim Anchor="R,C" AnchorSide="O,O" Offset="-9,0" Size="16,32" Texture="Assets/UI/Art/Controls/buttonsidesglow.dds" TextureOffset="16,0" Pause="0" Cycle="Bounce" Speed="1" AlphaStart=".99" AlphaEnd=".25" />
        <AlphaAnim Anchor="L,C" AnchorSide="O,O" Offset="-10,0" Size="16,32" Texture="Assets/UI/Art/Controls/buttonsidesglow.dds" TextureOffset="0,0" Pause="0" Cycle="Bounce" Speed="1" AlphaStart=".99" AlphaEnd=".25" />
        <Image Anchor="R,C" AnchorSide="O,O" Offset="-9,0" Size="8,16" Texture="Assets/UI/Art/Controls/buttonsides.dds" TextureOffset="8,0" />
        <Image Anchor="L,C" AnchorSide="O,O" Offset="-10,0" Size="8,16" Texture="Assets/UI/Art/Controls/buttonsides.dds" TextureOffset="0,0" />
    
        <ScrollPanel ID="ListScrollPanel" Anchor="L,T" Offset="18,44" Size="870,282" Vertical="1" AutoScrollBar="1">
          <UpButton   Anchor="R,T" AnchorSide="O,I" Offset="1,0" Style="ScrollBarUp" />
          <ScrollBar  Anchor="R,T" AnchorSide="O,I" Offset="1,18" Length="246" Style="VertSlider" />
          <DownButton Anchor="R,B" AnchorSide="O,I" Offset="1,0" Style="ScrollBarDown" />
          <Stack ID="ListStack" Anchor="L,T" Offset="0,0" Padding="0" StackGrowth="B">
            <Image Anchor="L,T" Offset="-9,1" Size="900,1" Texture="bar900x2.dds" TextureOffset="0,0" />
          </Stack>
        </ScrollPanel>
    
        <ScrollPanel ID="DetailScrollPanel" Anchor="L,T" Offset="18,44" Size="870,282" Vertical="1" AutoScrollBar="1" Hidden="1">
          <UpButton   Anchor="R,T" AnchorSide="O,I" Offset="1,0" Style="ScrollBarUp" />
          <ScrollBar  Anchor="R,T" AnchorSide="O,I" Offset="1,18" Length="246" Style="VertSlider" />
          <DownButton Anchor="R,B" AnchorSide="O,I" Offset="1,0" Style="ScrollBarDown" />
          <Stack ID="DetailStack" Anchor="L,T" Offset="0,0" Padding="0" StackGrowth="B">
    
            <Button ID="ModHomePageButton" Anchor="C,T" Offset="0,0" Size="500,28" Color="Black,0" StateOffsetIncrement="0,0">
              <ShowOnMouseOver>
                <AlphaAnim ID="SelectHighlight" Anchor="L,T" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1.5" AlphaEnd="1">
                  <Grid Size="489,31" Offset="3,-2" Padding="0,0" Style="Grid9FrameTurnsHL" />
                </AlphaAnim>
              </ShowOnMouseOver>
              <Label ID="ModHomePageLabel" Anchor="C,T" Offset="0,8" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" />
            </Button>
            <Image Anchor="C,T" Offset="0,0" Size="500,1" Texture="bar500x2.dds" />
            <Label ID="SelectedModID" Anchor="C,T" Offset="0,5" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="" />
            <Box ID="DetailsBox" Anchor="C,T" Offset="3,15" Size="870,195" Color="White,0">
    
              <Stack ID="DetailLabelsStack" Anchor="L,T" Offset="0,0" Padding="6" StackGrowth="B" />
              <Stack ID="DetailValuesStack" Anchor="L,T" Offset="0,0" Padding="6" StackGrowth="B" />
    
            </Box>
            <Stack Anchor="C,T" Offset="0,0" Padding="0" StackGrowth="B">
              <Label Anchor="C,T" Offset="3,0" Font="TwCenMT20" FontStyle="Base" Color="255,255,200,255" String="TXT_KEY_MODDING_DESCRIPTION" />
              <Image Anchor="C,T" Offset="0,5" Size="500,1" Texture="bar500x2.dds" />
            </Stack>
          </Stack>
          <Label ID="SelectedModDescription" Anchor="L,T" Offset="9,283" LeadingOffset="-4" WrapWidth="860" Font="TwCenMT16" FontStyle="Base" Color="255,255,200,255" String="" />
        </ScrollPanel>
    
        <Label Anchor="C,B" Offset="0,26" Font="TwCenMT14" FontStyle="SoftShadow" Color0="30,50,80,255" Color1="133,184,186,255" Color2="133,184,186,255" String="TXT_KEY_WHYS_ALIVES" />
        <GridButton ID="LikeItButton" Anchor="C,B" Style="SmallButton" Size="110,30" Offset="0,14" StateOffsetIncrement="0,0" Hidden="1">
          <Label ID="LikeItLabel" Anchor="C,C" Offset="0,0" Font="TwCenMT18" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_MODDING_LIKE_IT" />
        </GridButton>
        <TextButton ID="ReportButton" Anchor="L,B" Offset="33,26" Font="TwCenMT14" FontStyle="Shadow" NormalState="Beige_Black" MouseOver="Red_Black" ButtonDown="White_Black" String="TXT_KEY_MODDING_FLAG_MODERATION" ToolTip="[COLOR_NEGATIVE_TEXT]{TXT_KEY_MODDING_FLAG_MODERATION_TOOLTIP}[ENDCOLOR]" Hidden="1" />
        <TextButton ID="PrivacyPolicyButton" Anchor="R,B" Offset="33,26" Font="TwCenMT14" FontStyle="Shadow" NormalState="Beige_Black" MouseOver="Green_Black" ButtonDown="White_Black" String="TXT_KEY_MODDING_PRIVACYPOLICY" Hidden="0" />
        <Label ID="ModListRatingLabel" Anchor="L,B" Offset="33,26" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="" ToolTip="[COLOR_POSITIVE_TEXT]{TXT_KEY_MOD_LIST_VIA_TOOLTIP}[ENDCOLOR]" Hidden="1" />
      </Grid>
    </Box>
    <!--======================================================================-->
    </Context><!--END ModListPopup.xml -->
    <!--======================================================================-->
    <!-- Created by: Whys Alives -Open source -->
    
     
  3. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Version 3 (deprecated)
    Spoiler :

    Version: 3 (build: 2011.01.18.0000)

    Provides a list of all currently active mods. Accessible by clicking "Mod List" option in DiploCorner drop down menu. Click mod to view details. Homepage data visible and clickable.

    Technical: Originally based on Kael's ModList but remade as a DiploCornerAddin (no InGame.xml) with a mod details view.

    Made possible by the following work: http://forums.civfanatics.com/showthread.php?t=398450&page=4#67

    Screen Shots:
    Spoiler :









    ModList.lua
    Spoiler :

    Code:
    -- vymdt.03.2011.01.18.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModList.lua
    --===========================================================================
    --[[ Special Thanks: alpaca.
    
    Provides a list of all currently active mods.  Accessible by clicking
    "Mod List" option in DiploCorner drop down menu.  Click mod to view details.
    Homepage data visible and clickable.
    http://tiny.cc/2oi3t
    
    Technical: Originally based on Kael's ModList but remade as a
    DiploCornerAddin (no InGame.xml) with a mod details view.
    DiploCornerAddin-standard by alpaca: http://tiny.cc/psux2
    ]]
    
    --===========================================================================
    --[[
    Called when option selected.
    ]]
    function onCall()
      local id = "ModListPopup";
      g_diploCornerAddin = g_diploCornerAddin or {};
      if g_diploCornerAddin[id] == nil then
        g_diploCornerAddin[id] = ContextPtr:LoadNewContext( id );
      end
      local context = g_diploCornerAddin[id];
      UIManager:QueuePopup( context, PopupPriority.NotificationLog );
    end
    --===========================================================================
    --[[
    Adds option to DiploCorner.
    ]]
    local option = { text = "TXT_KEY_MOD_LIST", tip = nil, call = onCall };
    LuaEvents.DiploCornerAddin( option );
    --===========================================================================
    --END ModList.lua
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModList.sql
    Spoiler :

    Code:
    -- vymdt.03.2011.01.18.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModList.sql
    --===========================================================================
    -- Adds text to database.
    
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MOD_LIST', 'Mod List' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_POP_MOD_LIST', 'Currently Active Mods' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_POP_MOD_LIST_ITEM', 'Mod Details' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADLANDMARKSYSTEM', 'Reload Landmark System' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADSTRATEGICVIEWSYSTEM', 'Reload Strategic View System' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELRELOADUNITSYSTEM', 'Reload Unit System' );
    INSERT INTO Language_en_US ( 'Tag', 'Text' )
      VALUES ( 'TXT_KEY_MODDING_LABELMINCOMPATIBLESAVEVERSION', 'Min Compatible Save Version' );
    --===========================================================================
    --END ModList.sql
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModListPopup.lua
    Spoiler :

    Code:
    -- vymdt.03.2011.01.18.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModListPopup.lua
    --===========================================================================
    --[[ Special Thanks: Thesh, Dale.
    
    Manages Mod List popup.
    ]]
    include( "InstanceManager" );
    --===========================================================================
    --[[
    Does nothing.
    ]]
    function ShowHideHandler( bIsHide, bIsInit )
      --do-nothing.
    end
    ContextPtr:SetShowHideHandler( ShowHideHandler );
    --===========================================================================
    --[[
    Closes popup.
    ]]
    function OnClose()
      UIManager:DequeuePopup( ContextPtr );
    end
    Controls.CloseButton:RegisterCallback( Mouse.eLClick, OnClose );
    --===========================================================================
    --[[
    Closes popup on escape-key.
    ]]
    function InputHandler( uiMsg, wParam, lParam )
      if uiMsg == KeyEvents.KeyDown and wParam == Keys.VK_ESCAPE then
        OnClose();
      end
      return true;
    end
    ContextPtr:SetInputHandler( InputHandler );
    --===========================================================================
    --[[
    Opens detailed view.
    ]]
    function onClick_item( mod )
      local id = "ModListItemPopup";
      g_diploCornerAddin = g_diploCornerAddin or {};
      if g_diploCornerAddin[id] == nil then
        g_diploCornerAddin[id] = ContextPtr:LoadNewContext( id );
      end
      local context = g_diploCornerAddin[id];
      LuaEvents.SetModListItem( mod );
      UIManager:QueuePopup( context, PopupPriority.NotificationLog );
    end
    --===========================================================================
    --[[
    Populates mod list.
    ]]
    g_inst = InstanceManager:new(
        "ListingButtonInstance", "Button", Controls.ListingStack );
    g_inst:ResetInstances();
    for k,mod in pairs( Modding.GetInstalledMods() ) do
      if type( mod ) == "table" and mod.Enabled then
        local item = g_inst:GetInstance();
        local text = mod.Name;
        local ver = mod.Version or "";
        local stab = mod.Stability or "";
        local version = "";
        if type( stab ) == "string" and stab ~= "" then
          version = string.format( "version %s (%s)", ver, stab );
        else
          version = string.format( "version %s", ver );
        end
        text = string.format( "%s - %s", text, version );
        item.Title:SetText( text );
        item.Button:RegisterCallback( Mouse.eLClick, function() onClick_item( mod ); end );
      end
    end
    Controls.ListingStack:CalculateSize();
    Controls.ListingScrollPanel:CalculateInternalSize();
    --===========================================================================
    --END ModListPopup.lua
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModListPopup.xml
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- vymdt.03.2011.01.18.0000 -->
    <!--======================================================================-->
    <!-- ModListPopup.xml -->
    <!--======================================================================-->
    <!-- -->
    <Context Font="TwCenMT14" FontStyle="Base" Color="Beige" Color1="Black">
      <!--....................................................................-->
      <Instance Name="NotificationButton" Offset="0,0" Size="890,60" >
        <Button ID="Button" Size="890,60" Offset="0,0" StateOffsetIncrement="0" >
          <Button ID="GenericButton" Anchor="L,C" Offset="0,0" Size="64.64" Texture="assets\UI\Art\WorldView\ActionItemsButton.dds" Hidden="1" />
          <Label ID="NotificationTurnText" Anchor="R,B" Offset="5,8" Font="TwCenMT24" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="Turn" />
          <Stack ID="TextStack" Anchor="L,T" Padding="10">
            <Label ID="NotificationText" Anchor="L,T" Offset="16,5" LeadingOffset="-8" WrapWidth="780" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="Text" />
            <Image Anchor="C,B" Offset="0,0" TextureOffset="0.0" Texture="bar900x2.dds" Size="900.1" />
          </Stack>
          <ShowOnMouseOver>
            <AlphaAnim ID="TextAnim" Anchor="C,C" Offset="10,0" Size="890,64" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="2" AlphaEnd="1">
              <Grid ID="TextHL" Size="890,64" Offset="0,0" Padding="0,0" Style="Grid9FrameTurnsHL" />
            </AlphaAnim>
          </ShowOnMouseOver>
        </Button>
      </Instance>
      <!--....................................................................-->
      <Instance Name="ListingButtonInstance">
        <Button ID="Button" Anchor="L,T" Size="896,32" Offset="0,0" Color="Black.0" StateOffsetIncrement="0,0">
          <ShowOnMouseOver>
            <AlphaAnim ID="SelectHighlight" Anchor="L,T" Size="896,72" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1.5" AlphaEnd="1">
              <Grid Size="896,36" Offset="0,0" Padding="0,0" Style="Grid9FrameTurnsHL" />
            </AlphaAnim>
          </ShowOnMouseOver>
          <Stack StackGrowth="Right" Offset="0,0" Padding="0">
            <Box Anchor="L,T" Offset="8,8" Size="175,24" Color="Black.0">
              <Label ID="Title" Anchor="L,T" Offset="10,0" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="MOD TITLE" />
            </Box>
          </Stack>
          <Image Anchor="L,B" Offset="0,0" TextureOffset="0.0" Texture="bar900x2.dds" Size="900.1" />
        </Button>
      </Instance>
      <!--....................................................................-->
      <Grid Size="960,658" Anchor="C,C" Offset="0,36" Padding="0,0" Style="Grid9DetailFive140" ConsumeMouse="0">
        <Image Anchor="L,T" Offset="17,90" Texture="HorizontalTrim.dds" Size="926.2" />
        <ScrollPanel Anchor="L,T" ID="ListingScrollPanel" Vertical="1" Size="912,440" Offset="13,94" AutoScrollBar="1">
          <ScrollBar Anchor="R,T" AnchorSide="O,I" Offset="0,18" Length="404" Style="VertSlider"/>
          <UpButton Anchor="R,T" AnchorSide="O,I" Offset="0,0" Style="ScrollBarUp"/>
          <DownButton Anchor="R,B" AnchorSide="O,I" Offset="0,0" Style="ScrollBarDown"/>
          <Stack ID="ListingStack" StackGrowth="B" Offset="4,0" Padding="0" />
        </ScrollPanel>
        <Label ID="Notifications Label" String="TXT_KEY_POP_MOD_LIST" Anchor="C,T" Offset="0,19" Font="TwCenMT20" Color0="30.50.80.255" Color1="133.184.186.255" Color2="133.184.186.255" FontStyle="SoftShadow" />
        <Box Anchor="C,B" AnchorSide="I.I" Offset="0,54" Size="910,56" Color="255,255,255,0" >
          <GridButton ID="CloseButton" Anchor="L,B" Style="SmallButton" Size="150,32" Offset="14,0" StateOffsetIncrement="0,0" >
            <Label Anchor="C,C" Offset="0,0" String="TXT_KEY_CLOSE" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" />
          </GridButton>
        </Box>
        <Image Anchor="C,B" Offset="0,110" Texture="HorizontalTrim.dds" Size="926.5" />
      </Grid>
    </Context>
    <!--======================================================================-->
    <!--END ModListPopup.xml -->
    <!--======================================================================-->
    

    ModListItemPopup.lua
    Spoiler :

    Code:
    -- vymdt.03.2011.01.18.0000
    -- Created by: Whys Alives -Open source
    --===========================================================================
    -- ModListItemPopup.lua
    --===========================================================================
    --[[
    Manages Mod List item popup.
    ]]
    include( "InstanceManager" );
    
    g_DetailLabels = InstanceManager:new( "DetailLabelInstance", "Label", Controls.DetailLabelsStack );
    g_DetailValues = InstanceManager:new( "DetailValueInstance", "Label", Controls.DetailValuesStack );
    --===========================================================================
    --[[
    Does nothing.
    ]]
    function ShowHideHandler( bIsHide, bIsInit )
      --do-nothing.
    end
    ContextPtr:SetShowHideHandler( ShowHideHandler );
    --===========================================================================
    --[[
    Closes popup.
    ]]
    function OnClose()
      UIManager:DequeuePopup( ContextPtr );
    end
    Controls.CloseButton:RegisterCallback( Mouse.eLClick, OnClose );
    --===========================================================================
    --[[
    Closes popup on escape-key.
    ]]
    function InputHandler( uiMsg, wParam, lParam )
      if uiMsg == KeyEvents.KeyDown and wParam == Keys.VK_ESCAPE then
        OnClose();
      end
      return true;
    end
    ContextPtr:SetInputHandler( InputHandler );
    --===========================================================================
    --[[
    Populates mod details.
    ]]
    function onSetModListItem( modinfo )
      
     	g_DetailLabels:ResetInstances();
    	g_DetailValues:ResetInstances();
    
    	Controls.SelectedModName:SetText( modinfo.Name );
    	Controls.SelectedModID:SetText( modinfo.ID );
    	Controls.SelectedModDescription:SetText( modinfo.Description );
    	Controls.DescriptionScrollPanel:CalculateInternalSize();
      
    	local max_detail_label_width = 0;
    	local max_detail_value_width = 0;
    	local details = {};
    	
    	function AddDetail(tag, value)
    		if(value ~= nil) then
    			local detail = g_DetailLabels:GetInstance();
    			local detailValue = g_DetailValues:GetInstance();
    			
    			--We always want to at least supply 1 argument.
    			local text = Locale.ConvertTextKey(tag);
    			detail.Label:SetText(text);
    			
    			local size = detail.Label:GetSize();
    			local width = size.x;
    			if(width > max_detail_label_width) then
    				max_detail_label_width = width;
    			end
    			
    			detailValue.Label:SetText(value or "");
    			detailValue.Label:SetToolTipString(nil);
    			
    			size = detailValue.Label:GetSize();
    			
    			width = size.x;
    			if(width > max_detail_value_width) then
    				max_detail_value_width = width;
    			end
    			
    			table.insert(details, {Label = detail, Value = detailValue});
    		end
    	end	
    	
    	function AddYesNoDetail(tag, value)
    		if(value == "1") then
    			return AddDetail(tag, Locale.ConvertTextKey("TXT_KEY_MODDING_LABELYES"));
    		else
    			return AddDetail(tag, Locale.ConvertTextKey("TXT_KEY_MODDING_LABELNO"));
    		end
    	end
    	
    	local version = tostring( modinfo.Version );
    	if(modinfo.Stability ~= nil) then
    		version = version .. " - " .. modinfo.Stability;
    	end
    	AddDetail("TXT_KEY_MODDING_LABELVERSION", version);
    	AddDetail("TXT_KEY_MODDING_LABELAUTHOR", modinfo.Authors);
    	if(modinfo.SpecialThanks ~= nil) then
    		AddDetail("TXT_KEY_MODDING_LABELSPECIALTHANKS", modinfo.SpecialThanks);
    	end
    	AddYesNoDetail("TXT_KEY_MODDING_LABELSUPPORTSSINGLEPLAYER", modinfo.SupportsSinglePlayer);
    	AddYesNoDetail("TXT_KEY_MODDING_LABELSUPPORTSMULTIPLAYER", modinfo.SupportsMultiplayer);
    	AddYesNoDetail("TXT_KEY_MODDING_LABELAFFECTSSAVEDGAMES", modinfo.AffectsSavedGames);
      if(modinfo.AffectsSavedGames and modinfo.MinCompatibleSaveVersion ~= nil) then
    	  AddDetail("TXT_KEY_MODDING_LABELMINCOMPATIBLESAVEVERSION", tostring( modinfo.MinCompatibleSaveVersion ));
    	end
    	AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADLANDMARKSYSTEM", modinfo.ReloadLandmarkSystem);
    	AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADSTRATEGICVIEWSYSTEM", modinfo.ReloadStrategicViewSystem);
    	AddYesNoDetail("TXT_KEY_MODDING_LABELRELOADUNITSYSTEM", modinfo.ReloadUnitSystem);
    	local details_size = Controls.DetailsBox:GetSize();
    	local spacer = 10; --margin between labels and values.
    	
    	-- Attempt to center items
    	local center_width = math.floor((details_size.x * 0.5) - (spacer * 0.5));
    	max_detail_value_width = math.max(center_width, max_detail_value_width);
    	
    	local detail_value_truncate;
    	if(max_detail_value_width + spacer + max_detail_label_width > details_size.x) then
    		detail_value_truncate = true;
    		max_detail_value_width = details_size.x - max_detail_label_width - spacer;
    	end
    	
    	if(detail_value_truncate) then
    		for i,v in ipairs(details) do
    			local tooltip = v.Value.Label:GetText();
    			v.Value.Label:SetToolTipString(tooltip);
    			v.Value.Label:SetTruncateWidth(max_detail_value_width);
    			
    		end
    	end
    	
    	Controls.DetailValuesStack:SetSize{x = max_detail_value_width, y =  details_size.y};
    	Controls.DetailValuesStack:SetOffsetVal(details_size.x - max_detail_value_width, 0);
    
    	Controls.DetailLabelsStack:SetOffsetVal(details_size.x - max_detail_value_width - spacer -  max_detail_label_width, 0);
    	Controls.DetailLabelsStack:ReprocessAnchoring();
    	
    	local homepage = Controls.ModHomePage;
    	if modinfo.Homepage ~= nil then
    		homepage:SetText( modinfo.Homepage );
    		homepage:SetHide( false );
    	else
    		homepage:SetHide( true );
    	end
    	
      function OnHomePageClicked( modinfo )
        print( modinfo.Homepage );
    	  local url = modinfo.Homepage;
    	  if(url ~= nil) then
    		  Steam.ActivateGameOverlayToWebPage(url);
    	  end
      end
      Controls.ModHomePage:RegisterCallback(Mouse.eLClick, function() OnHomePageClicked( modinfo ); end);
    end
    LuaEvents.SetModListItem.Add( onSetModListItem );
    --===========================================================================
    --END ModListItemPopup.lua
    --===========================================================================
    -- Created by: Whys Alives -Open source
    

    ModListItemPopup.xml
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- vymdt.03.2011.01.18.0000 -->
    <!--======================================================================-->
    <!-- ModListItemPopup.xml -->
    <!--======================================================================-->
    <!-- -->
    <Context Font="TwCenMT14" FontStyle="Base" Color="Beige" Color1="Black">
      <!--....................................................................-->
      <Instance Name="DetailLabelInstance">
        <Label ID="Label" Anchor="R,C"  Font="TwCenMT16"   ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="Detail" />
      </Instance>
      <!--....................................................................-->
      <Instance Name="DetailValueInstance">
        <Label ID="Label" Anchor="L,C"  Font="TwCenMT16"   ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="Detail" />
      </Instance>
      <!--....................................................................-->
      <Grid Size="960,658" Anchor="C,C" Offset="0,36" Padding="0,0" Style="Grid9DetailFive140" ConsumeMouse="0">
        <Image Anchor="L,T" Offset="17,90" Texture="HorizontalTrim.dds" Size="926.2" />
    
        <Box ID="DetailsResults" Offset="17,72" Size="926,468" Color="0,0,0,0" Hidden="0">
          <ScrollPanel ID="DescriptionScrollPanel" Anchor="L,T" Vertical="1" Size="903,460" Offset="0,2" AutoScrollBar="1">
    
            <!-- Scroll Controls -->
            <ScrollBar  Anchor="R,T" AnchorSide="O,I" Offset="0,18" Length="420" Style="VertSlider"/>
            <UpButton   Anchor="R,T" AnchorSide="O,I" Offset="0,0" Style="ScrollBarUp"/>
            <DownButton Anchor="R,T" AnchorSide="O,I" Offset="0,438" Style="ScrollBarDown"/>
    
            <Stack Anchor="C,T" StackGrowth="Bottom" Offset="0,0" Padding="6">
              <Box Size="900,50" Anchor="L,C" Offset="0,10" Color="White.0" >
                <Label ID="SelectedModName" Anchor="C,C" Offset="0,0" Font="TwCenMT24" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="" />
                <Label ID="SelectedModID" Anchor="C,C" Offset="0,20" Font="TwCenMT14" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="" />
              </Box>
              <Image Anchor="C,C" Offset="0,0"  Texture="bar500x2.dds" Size="500.1" />
              <TextButton ID="ModHomePage" Anchor="C,B" Offset="0,4" ColorSet="Beige_Black_Alpha" Font="TwCenMT18" FontStyle="Shadow" String="">
                <ShowOnMouseOver>
                  <AlphaAnim ID="SelectHighlight" Anchor="C,C" Size="460,26" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1.5" AlphaEnd="1">
                    <Grid Size="460,26" Offset="0,2" Padding="0,0" Style="Grid9FrameTurnsHL" />
                  </AlphaAnim>
                </ShowOnMouseOver>
              </TextButton>
              
              <Box Size="10,10" Anchor="L,C" Offset="0,0" Color="White.0" ></Box>
    
              <!-- Listing Stack (Dynamic) -->
              <Box ID="DetailsBox" Size="900,195" Anchor="C,T" Offset="0,0" Color="White.0">
                <Stack Anchor="L,T" ID="DetailLabelsStack" StackGrowth="Bottom" Offset="0,0" Padding="6" />
                <Stack Anchor="L,T" ID="DetailValuesStack" StackGrowth="Bottom" Offset="0,0" Padding="6" />
              </Box>
    
              <Label Anchor="C,T" Offset="0,0"  WrapWidth="660" LeadingOffset="-2" Font="TwCenMT20" Color="255,255,200,255" FontStyle="Base" String="TXT_KEY_MODDING_DESCRIPTION" />
              <Image Anchor="C,C" Offset="0,0"  Texture="bar500x2.dds" Size="500.1" />
              <Box Size="10,10" Anchor="L,C" Offset="0,0" Color="White.0" ></Box>
    
              <Label ID="SelectedModDescription" Anchor="C,T" Offset="0,0"  WrapWidth="660" LeadingOffset="-2" Font="TwCenMT16" Color="255,255,200,255" FontStyle="Base" String="" />
    
              <Box Size="10,10" Anchor="L,C" Offset="0,0" Color="White.0" ></Box>
            </Stack>
          </ScrollPanel>
        </Box>
    
        <Label ID="Notifications Label" String="TXT_KEY_POP_MOD_LIST_ITEM" Anchor="C,T" Offset="0,19" Font="TwCenMT20" Color0="30.50.80.255" Color1="133.184.186.255" Color2="133.184.186.255" FontStyle="SoftShadow" />
        <Box Anchor="C,B" AnchorSide="I.I" Offset="0,54" Size="910,56" Color="255,255,255,0" >
          <GridButton ID="CloseButton" Anchor="L,B" Style="SmallButton" Size="150,32" Offset="14,0" StateOffsetIncrement="0,0" >
            <Label Anchor="C,C" Offset="0,0" String="Back" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" />
          </GridButton>
        </Box>
        <Image Anchor="C,B" Offset="0,110" Texture="HorizontalTrim.dds" Size="926.5" />
      </Grid>
    </Context>
    <!--======================================================================-->
    <!--END ModListItemPopup.xml -->
    <!--======================================================================-->
    

     
  4. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Version 3 (deprecated)
    Spoiler :

    Uses the following DiploCornerAddin-standard by alpaca: http://forums.civfanatics.com/showthread.php?t=403481


    DiploCorner.lua (by: alpaca)
    Spoiler :

    Code:
    -------------------------------------------------
    -- Diplomacy and Advisors Buttons that float out in the screen
    -------------------------------------------------
    include( "IconSupport" );
    include( "SupportFunctions"  );
    include( "InstanceManager" );
    local g_ChatInstances = {};
    
    local g_iChatTeam   = -1;
    local g_iChatPlayer = -1;
    
    local g_iLocalPlayer = Game.GetActivePlayer();
    local g_pLocalPlayer = Players[ g_iLocalPlayer ];
    local g_iLocalTeam = g_pLocalPlayer:GetTeam();
    local g_pLocalTeam = Teams[ g_iLocalTeam ];
    local g_SortTable;
            
    
    local m_bChatOpen = not Controls.ChatPanel:IsHidden();
    
    
    
    -------------------------------------------------
    -------------------------------------------------
    local g_MultiPullInfo = {};
    g_MultiPullInfo[0] = { text="TXT_KEY_ADVISOR_SCREEN_TECH_TREE_DISPLAY",        call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_TECH_TREE } ); end };
    g_MultiPullInfo[1] = { text="TXT_KEY_DIPLOMACY_OVERVIEW",        call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_DIPLOMATIC_OVERVIEW } ); end };
    g_MultiPullInfo[2] = { text="TXT_KEY_MILITARY_OVERVIEW",         call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_MILITARY_OVERVIEW } ); end };
    g_MultiPullInfo[3] = { text="TXT_KEY_ECONOMIC_OVERVIEW",         call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_ECONOMIC_OVERVIEW } ); end };
    g_MultiPullInfo[4] = { text="TXT_KEY_VP_TT",                     call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_VICTORY_INFO} ); end };
    g_MultiPullInfo[5] = { text="TXT_KEY_DEMOGRAPHICS",              call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_DEMOGRAPHICS} ); end };
    g_MultiPullInfo[6] = { text="TXT_KEY_POP_NOTIFICATION_LOG",      call=function() Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_NOTIFICATION_LOG, Data1 = Game.GetActivePlayer() } ); end };
    --alpaca
    function meh(tab)
    	g_MultiPullInfo[#g_MultiPullInfo + 1] = tab
    end
    LuaEvents.DiploCornerAddin.Add(meh)
    
    addins = {}
    -- handle DiploCornerAddins
    for addin in Modding.GetActivatedModEntryPoints("DiploCornerAddin") do
    	local addinFile = addin.File;
    	-- Get the absolute path and filename without extension.
    	local extension = Path.GetExtension(addinFile);
    	local path = string.sub(addinFile, 1, #addinFile - #extension);
    	ptr = ContextPtr:LoadNewContext(path)
    	table.insert(addins, ptr)
    end
    
    --/alpaca
    
    local controlTable;
    local sizeY = 92
    for i = 0, #g_MultiPullInfo do
        controlTable = {};
        Controls.MultiPull:BuildEntry( "InstanceOne", controlTable );
    
        controlTable.Button:LocalizeAndSetText( g_MultiPullInfo[i].text );
        controlTable.Button:LocalizeAndSetToolTip( g_MultiPullInfo[i].tip );
        controlTable.Button:SetVoid1( i );
    	sizeY = sizeY + controlTable.Button:GetSizeY()
    end
    Controls.MultiPullBox:SetSizeY(sizeY)
    Controls.MultiPull:CalculateInternals();
    
    
    -------------------------------------------------
    -------------------------------------------------
    function OnMultiPull( id )
        g_MultiPullInfo[id].call();
    end
    Controls.MultiPull:RegisterSelectionCallback( OnMultiPull );
    
    
    -------------------------------------------------
    -------------------------------------------------
    function OnAdvisorButton()
        local popupInfo = {
            Type = ButtonPopupTypes.BUTTONPOPUP_ADVISOR_COUNSEL,
        }
        Events.SerialEventGameMessagePopup(popupInfo);
    
    end
    Controls.AdvisorButton:RegisterCallback( Mouse.eLClick, OnAdvisorButton );
    
    
    -------------------------------------------------
    -------------------------------------------------
    function OnAdvisorButtonR()
        LuaEvents.AdvisorButtonEvent( Mouse.eRClick );
    end
    Controls.AdvisorButton:RegisterCallback( Mouse.eRClick, OnAdvisorButtonR );
    
    
    -------------------------------------------------
    -- On ChatToggle
    -------------------------------------------------
    function OnChatToggle()
    
        m_bChatOpen = not m_bChatOpen;
    
        if( m_bChatOpen ) then
            Controls.ChatPanel:SetHide( false );
            Controls.ChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOn.dds" );
            Controls.HLChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOffHL.dds" );
            Controls.MOChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOff.dds" );
        else
            Controls.ChatPanel:SetHide( true );
            Controls.ChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOff.dds" );
            Controls.HLChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOnHL.dds" );
            Controls.MOChatToggle:SetTexture( "assets/UI/Art/Icons/MainChatOn.dds" );
        end
    
        LuaEvents.ChatShow( m_bChatOpen );
    end
    Controls.ChatToggle:RegisterCallback( Mouse.eLClick, OnChatToggle );
    
    
    -------------------------------------------------
    -------------------------------------------------
    local bFlipper = false;
    function OnChat( fromPlayer, toPlayer, text, eTargetType )
    
        local controlTable = {};
        ContextPtr:BuildInstanceForControl( "ChatEntry", controlTable, Controls.ChatStack );
      
        table.insert( g_ChatInstances, controlTable );
        if( #g_ChatInstances > 100 ) then
            Controls.ChatStack:ReleaseChild( g_ChatInstances[ 1 ].Box );
            table.remove( g_ChatInstances, 1 );
        end
        
        TruncateString( controlTable.String, 200, Players[fromPlayer]:GetNickName() );
        local fromName = controlTable.String:GetText();
        
        if( eTargetType == ChatTargetTypes.CHATTARGET_TEAM ) then
            controlTable.String:SetColorByName( "Green_Chat" );
            controlTable.String:SetText( fromName .. ": " .. text ); 
            
        elseif( eTargetType == ChatTargetTypes.CHATTARGET_PLAYER ) then
        
            local toName;
            if( toPlayer == g_iLocalPlayer ) then
                toName = Locale.ConvertTextKey( "TXT_KEY_YOU" );
            else
                TruncateString( controlTable.String, 200, Players[toPlayer]:GetNickName() );
                toName = Locale.ConvertTextKey( "TXT_KEY_DIPLO_TO_PLAYER", controlTable.String:GetText() );
            end
            controlTable.String:SetText( fromName .. " (" .. toName .. "): " .. text ); 
            controlTable.String:SetColorByName( "Magenta_Chat" );
            
        elseif( fromPlayer == g_iLocalPlayer ) then
            controlTable.String:SetColorByName( "Gray_Chat" );
            
            controlTable.String:SetText( fromName .. ": " .. text ); 
        else
            controlTable.String:SetText( fromName .. ": " .. text ); 
        end
          
        controlTable.Box:SetSizeY( controlTable.String:GetSizeY() + 8 );
        controlTable.Box:ReprocessAnchoring();
    
        if( bFlipper ) then
            controlTable.Box:SetColorChannel( 3, 0.4 );
        end
        bFlipper = not bFlipper;
        
    	Events.AudioPlay2DSound( "AS2D_IF_MP_CHAT_DING" );		
    
        Controls.ChatStack:CalculateSize();
        Controls.ChatScroll:CalculateInternalSize();
        Controls.ChatScroll:SetScrollValue( 1 );
    end
    Events.GameMessageChat.Add( OnChat );
    
    
    -------------------------------------------------
    -------------------------------------------------
    function SendChat( text )
        if( string.len( text ) > 0 ) then
            Network.SendChat( text, g_iChatTeam, g_iChatPlayer );
        end
        Controls.ChatEntry:ClearString();
    end
    Controls.ChatEntry:RegisterCallback( SendChat );
    
    
    -------------------------------------------------
    -------------------------------------------------
    function ShowHideHandler( bIsHide )
        Controls.CornerAnchor:SetHide( false );
    end
    ContextPtr:SetShowHideHandler( ShowHideHandler );
    
    
    -------------------------------------------------
    -------------------------------------------------
    function InputHandler( uiMsg, wParam, lParam )
        if( m_bChatOpen 
            and uiMsg == KeyEvents.KeyUp
            and wParam == Keys.VK_TAB ) then
            Controls.ChatEntry:TakeFocus();
            return true;
        end
    end
    ContextPtr:SetInputHandler( InputHandler );
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function OnSocialPoliciesClicked()
        Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_CHOOSEPOLICY } );
    end
    Controls.SocialPoliciesButton:RegisterCallback( Mouse.eLClick, OnSocialPoliciesClicked );
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function OnDiploClicked()
        Controls.DiploList:SetHide( not Controls.DiploList:IsHidden() );
        -- Events.SerialEventGameMessagePopup( { Type = ButtonPopupTypes.BUTTONPOPUP_DIPLOMACY } );
    end
    Controls.DiploButton:RegisterCallback( Mouse.eLClick, OnDiploClicked );
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function OnOpenPlayerDealScreen( iOtherPlayer )
        local iUs = Game.GetActivePlayer();
        local iUsTeam = Players[ iUs ]:GetTeam();
        local pUsTeam = Teams[ iUsTeam ];
        
        print( "here" );
    
        -- any time we're legitimately opening the pvp deal screen, make sure we hide the diplolist.
        local iOtherTeam = Players[iOtherPlayer]:GetTeam();
        local iProposalTo = UI.HasMadeProposal( iUs );
       
        -- this logic should match OnOpenPlayerDealScreen in TradeLogic.lua
        if( (pUsTeam:IsAtWar( iOtherTeam ) and (g_bAlwaysWar or g_bNoChangeWar) ) or
    	    (iProposalTo ~= -1 and iProposalTo ~= iOtherPlayer) ) then
    	    -- do nothing
    	    return;
        else
            Controls.CornerAnchor:SetHide( true );
        end
    
        print( "hiding corner anchor for OpenPlayerDealScreenEvent" );
    end
    Events.OpenPlayerDealScreenEvent.Add( OnOpenPlayerDealScreen );
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function OnChatTarget( iTeam, iPlayer )
        g_iChatTeam = iTeam;
        g_iChatPlayer = iPlayer;
        print("in chat target");
        if( iTeam ~= -1 ) then
    		TruncateString( Controls.LengthTest, Controls.ChatPull:GetSizeX(), Locale.ConvertTextKey("TXT_KEY_DIPLO_TO_TEAM"));
            Controls.ChatPull:GetButton():SetText( Controls.LengthTest:GetText() );
        else
            if( iPlayer ~= -1 ) then
    			TruncateString( Controls.LengthTest, Controls.ChatPull:GetSizeX(), Locale.ConvertTextKey("TXT_KEY_DIPLO_TO_PLAYER", Players[ iPlayer ]:GetNickName()));
                Controls.ChatPull:GetButton():SetText( Controls.LengthTest:GetText() );
            else
                Controls.ChatPull:GetButton():LocalizeAndSetText( "TXT_KEY_DIPLO_TO_ALL" );
            end
        end
    end
    Controls.ChatPull:RegisterSelectionCallback( OnChatTarget );
    
    
    -------------------------------------------------------
    -------------------------------------------------------
    function PopulateChatPull()
    
        Controls.ChatPull:ClearEntries();
    
        -------------------------------------------------------
        -- Add All Entry
        local controlTable = {};
        Controls.ChatPull:BuildEntry( "InstanceOne", controlTable );
        controlTable.Button:SetVoids( -1, -1 );
        local textControl = controlTable.Button:GetTextControl();
        textControl:LocalizeAndSetText( "TXT_KEY_DIPLO_TO_ALL" );
    
    
        -------------------------------------------------------
        -- See if Team has more than 1 other human member
        local iTeamCount = 0;
        for iPlayer = 0, GameDefines.MAX_PLAYERS do
            local pPlayer = Players[iPlayer];
    
            if( iPlayer ~= g_iLocalPlayer and pPlayer ~= nil and pPlayer:IsHuman() and pPlayer:GetTeam() == g_iLocalTeam ) then
                iTeamCount = iTeamCount + 1;
            end
        end
    
        if( iTeamCount > 0 ) then
            local controlTable = {};
            Controls.ChatPull:BuildEntry( "InstanceOne", controlTable );
            controlTable.Button:SetVoids( g_iLocalTeam, -1 );
            local textControl = controlTable.Button:GetTextControl();
            textControl:LocalizeAndSetText( "TXT_KEY_DIPLO_TO_TEAM" );
        end
    
    
        -------------------------------------------------------
        -- Humans
        for iPlayer = 0, GameDefines.MAX_PLAYERS do
            local pPlayer = Players[iPlayer];
    
            if( iPlayer ~= g_iLocalPlayer and pPlayer ~= nil and pPlayer:IsHuman() ) then
    
                controlTable = {};
                Controls.ChatPull:BuildEntry( "InstanceOne", controlTable );
                controlTable.Button:SetVoids( -1, iPlayer );
                textControl = controlTable.Button:GetTextControl();
    			TruncateString( textControl, Controls.ChatPull:GetSizeX()-20, Locale.ConvertTextKey("TXT_KEY_DIPLO_TO_PLAYER", pPlayer:GetNickName()));
            end
        end
        
        Controls.ChatPull:GetButton():LocalizeAndSetText( "TXT_KEY_DIPLO_TO_ALL" );
        Controls.ChatPull:CalculateInternals();
    end
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function DoUpdateUNCountdown()
    	
    	local iUNCountdown = Game.GetUnitedNationsCountdown();
    	
    	if (iUNCountdown ~= 0 and Game.GetGameState() == GameplayGameStateTypes.GAMESTATE_ON ) then
    		Controls.UNTurnsLabel:SetText(iUNCountdown);
    		Controls.UNTurnsLabel:SetHide(false);
    		Controls.DiploButton:SetToolTipString(Locale.ConvertTextKey("TXT_KEY_EO_DIPLOMACY_AND_UN_VOTE", iUNCountdown));
    	else
    		Controls.UNTurnsLabel:SetHide(true)
    		Controls.DiploButton:SetToolTipString(Locale.ConvertTextKey("TXT_KEY_EO_DIPLOMACY"));
    	end
    end
    Events.SerialEventGameDataDirty.Add(DoUpdateUNCountdown);
    
    -- Also call it once so it starts correct - surprisingly enough, GameData isn't dirtied as we're loading a game
    DoUpdateUNCountdown();
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    m_TeamTable = {};
    if( Game.IsGameMultiPlayer() ) then
        PopulateChatPull();
    
        Controls.ChatToggle:SetHide( false );
        OnChatToggle();
    end
    
    
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    function OnEndGameButton()
    
        local which = math.random( 1, 6 );
        
        if( which == 1 ) then Events.EndGameShow( EndGameTypes.Technology, Game.GetActivePlayer() ); 
        elseif( which == 2 ) then Events.EndGameShow( EndGameTypes.Domination, Game.GetActivePlayer() );
        elseif( which == 3 ) then Events.EndGameShow( EndGameTypes.Culture, Game.GetActivePlayer() );
        elseif( which == 4 ) then Events.EndGameShow( EndGameTypes.Diplomatic, Game.GetActivePlayer() );
        elseif( which == 5 ) then Events.EndGameShow( EndGameTypes.Time, Game.GetActivePlayer() );
        elseif( which == 6 ) then Events.EndGameShow( EndGameTypes.Time, Game.GetActivePlayer() + 1 ); 
        end
    end
    Controls.EndGameButton:RegisterCallback( Mouse.eLClick, OnEndGameButton );
    

    DiploCorner.xml (by: alpaca)
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Context ColorSet="Beige_Black_Alpha" FontStyle="Shadow" Font="TwCenMT16" >
    
    
      <Stack Offset="0,30" Padding="0" Anchor="R,T" StackGrowth="Bottom" >
    
        <!-- CHAT PANEL    GridGlass16 Max Size="505,520" -->
        <Grid Size="523,170" Anchor="R,T" Padding="0,0" Style="GridGlass16" ConsumeMouseButton="1" ConsumeMouseOver="1" ID="ChatPanel" Hidden="1" >
    
          <!-- Chat ScrollPanel Max Size="464,493"  -->
          <ScrollPanel Anchor="L,T" Offset="12,2" Size="490,134"  Vertical="1" ID="ChatScroll" AutoScrollBar="1" >
            <Stack Anchor="L,T"  Offset="0,0" StackGrowth="Bottom" Padding="0" ID="ChatStack" />
            <!-- Chat ScrollBar Max Length="500" -->
            <ScrollBar Offset="0.0" Style="VertSlider" Anchor="R,C" AnchorSide="O,I" Length="98" />
            <UpButton  Offset="0.0"  Style="ScrollBarUp"  Anchor="R,T" AnchorSide="O,I" />
            <DownButton Offset="0.0" Style="ScrollBarDown"  Anchor="R,B" AnchorSide="O,I" />
          </ScrollPanel>
    
          <!-- Chat Grid9Detail48 Max Size="523,540"-->
          <Grid Size="543,190" Anchor="R,T" Offset="-15,-15" Padding="0,0" Style="Grid9Detail48" />
          <Box Anchor="L,B" Size="513,30" Offset="10.1" Color="0,0,0,255" >
            <Box Anchor="L,T" Size="513,1" Offset="0.0" Color="255,255,200,255"/>
    
            <PullDown Anchor="L,C" Style="GenericPullDown" ScrollThreshold="200" SpaceForScroll="0" Size="136,26" ID="ChatPull" >
              <Label ID="LengthTest" Anchor="L,C" Offset="0,0" Font="TwCenMT20" FontStyle="SoftShadow" Hidden="1"/>
    
              <Box Anchor="R,C" AnchorSide="O,I" Offset="4,0" Size="366,18" Color="255,255,200,255" >
                <Box Anchor="C,C"  Offset="0,0" Size="364,16" Color="0,0,0,255" >
                  <EditBox Offset="1,0" MaxLength="255" Size="364,16" Anchor="C,C" Font="TwCenMT14" ID="ChatEntry" />
                </Box>
              </Box>
    
            </PullDown>
          </Box>
        </Grid>
    
    
        <Container Size="10,1" Anchor="R,T" Offset="0,-1" >
    
          <LuaContext FileName="Assets/UI/InGame/DiploList" ID="DiploList" Hidden="1" Anchor="R,T" Offset="-11,-40" />
    
    
          <!-- Corner Treatment -->
          <Image Anchor="R,T" Texture="assets\UI\Art\WorldView\TopRight020.dds"  Offset="0,0" Size="512,128" ID="CornerAnchor" >
    
            <!-- Info Buttons Stack -->
            <Stack Anchor="R,T" Offset="0,0" StackGrowth="Left" Padding="-12" >
    
    
    
              <!--=======================================================================================================================-->
              <!-- Diplo Button -->
              <!--=======================================================================================================================-->
              <Button ConsumeMouse="1" Anchor="C,T" Size="80,80" Offset="0,0" Texture="assets\UI\Art\Notification\diplomacybase.dds" ID="DiploButton" ToolTip="TXT_KEY_EO_DIPLOMACY" Hidden="0" >
                <ShowOnMouseOver>
                  <Image Anchor="C,C" Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\diplomacybase.dds" />
                  <AlphaAnim  Anchor="C,C"  AnchorSide="O.O"  Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\diplomacyhl.dds"  Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0" Hidden="0"/>
                </ShowOnMouseOver>
                <Label Anchor="C,C" Offset="0,4" Font="TwCenMT20" FontStyle="Stroke" ID="UNTurnsLabel" Hidden="1"/>
              </Button>
    
              <!--=======================================================================================================================-->
              <!-- Advisor Button -->
              <!--=======================================================================================================================-->
              <Button ConsumeMouse="1"  ID="AdvisorButton" Anchor="C,T" Size="80,80" Offset="0,0" Texture="assets\UI\Art\Notification\NotificationIconsAdvisor.dds" ToolTip="TXT_KEY_DIPLO_OPEN_ADVISORS_TT" Hidden="0" >
                <ShowOnMouseOver>
                  <Image Anchor="C,C" Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\NotificationIconsAdvisor.dds" />
                  <AlphaAnim  Anchor="C,C"  AnchorSide="O.O"  Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\NotificationIconsAdvisorHL.dds"  Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0" Hidden="0"/>
                </ShowOnMouseOver>
              </Button>
    
    
              <!--=======================================================================================================================-->
              <!-- Social Policy Button -->
              <!--=======================================================================================================================-->
              <Button ConsumeMouse="1" Anchor="C,T" Size="80,80" Offset="0,0" Texture="assets\UI\Art\Notification\NotificationFrameBase.dds" ID="SocialPoliciesButton" ToolTip="TXT_KEY_DIPLO_OPEN_SOCIAL_POLICY_TT" Hidden="0" >
                <ShowOnMouseOver>
                  <Image Anchor="C,C" Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\NotificationFrameBase.dds" />
                  <AlphaAnim  Anchor="C,C"  AnchorSide="O.O"  Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\NotificationFrameGlow2.dds"  Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0" Hidden="0"/>
                </ShowOnMouseOver>
                <Image Anchor="C,C" Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\SocialPolicy80.dds" />
    
                <!-- ACTIVE STATE -->
                <AlphaAnim  Anchor="C,C"  AnchorSide="O.O"  Offset="0,0" Size="80,80" Texture="assets\UI\Art\Notification\SocialPolicyActive80.dds"  Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0" Hidden="1"/>
    
              </Button>
    
              <!--=======================================================================================================================-->
              <!-- Notification Log DropDownButtons -->
              <!--=======================================================================================================================-->
              <PullDown ConsumeMouse="1" Offset="-6,0" Anchor="R,T" Size="45,45" AutoSizePopUp="0" SpaceForScroll="0" ScrollThreshold="900" ID="MultiPull" >
                <ButtonData>
                  <Button Anchor="R,T" Size="45.45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" ToolTip="TXT_KEY_DIPLO_ADDITIONAL" >
                    <ShowOnMouseOver>
                      <Image Anchor="R,T" Offset="0,0" Size="45.45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" />
                      <AlphaAnim Anchor="R,T" Offset="0,0" Size="45.45"  TextureOffset="0.0" Texture="assets\UI\Art\Notification\NotificationNotesHL.dds"  Pause="0" Cycle="Bounce" Speed="2" AlphaStart="0.95" AlphaEnd="0.55"/>
                    </ShowOnMouseOver>
                  </Button>
                </ButtonData>
    
                <GridData Anchor="L,T" Offset="-24.-41" AnchorSide="O,I" Style="Grid9DetailTwo140" Padding="0,0" >
                  <Box Color="Black.0" Size="200.260" ID="MultiPullBox"/>
                </GridData>
                <ScrollPanelData Anchor="C,C"  Vertical="1" />
    
                <StackData StackGrowth="Bottom" Padding="0" Anchor="C,T" />
    
                <InstanceData Name="InstanceOne" >
                  <Button  Size="180.24" Anchor="C,C" ID="Button"  >
                    <ShowOnMouseOver>
                      <AlphaAnim Anchor="C,C" Offset="0,0" Size="180,24" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="1" AlphaEnd="0">
                        <Grid   Size="180,26" Offset="0,0" Padding="0,0" Style="Grid9FrameTurns" />
                      </AlphaAnim>
                    </ShowOnMouseOver>
                  </Button>
    
                </InstanceData>
    
              </PullDown>
    
    
              <Button ConsumeMouse="1" ID="ChatToggle" Hidden="1" Anchor="R,T" Size="45.45"  Offset="-10,0" Texture="assets\UI\Art\Icons\MainChatOff.dds"  ToolTip="TXT_KEY_DIPLO_CLOSE_CHAT_TT">
                <ShowOnMouseOver>
                  <Image Anchor="R,T" Offset="0,0" Size="45.45" Texture="assets\UI\Art\Icons\MainChatOn.dds" ID="MOChatToggle" />
                  <AlphaAnim Anchor="R,T" Offset="0,0" Size="45.45"  TextureOffset="0.0" ID="HLChatToggle" Texture="assets\UI\Art\Icons\MainChatOnHL.dds"   Pause="0" Cycle="Bounce" Speed="2" AlphaStart="0.95" AlphaEnd="0.55"/>
                </ShowOnMouseOver>
              </Button>
    
              <Button Offset="-100,0" Anchor="R,T" Size="45.45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" ToolTip="Publish a bogus ShowEndGame for testing" ID="EndGameButton" Hidden="1" >
                <ShowOnMouseOver>
                  <Image Anchor="R,T" Offset="0,0" Size="45.45" Texture="assets\UI\Art\Notification\NotificationNotes.dds" />
                  <AlphaAnim Anchor="R,T" Offset="0,0" Size="45.45"  TextureOffset="0.0" Texture="assets\UI\Art\Notification\NotificationNotesHL.dds"  Pause="0" Cycle="Bounce" Speed="2" AlphaStart="0.95" AlphaEnd="0.55"/>
                </ShowOnMouseOver>
              </Button>
    
    
            </Stack>
    
    
          </Image>
    
          <LuaContext FileName="Assets/UI/InGame/WorldView/SimpleDiploTrade" ID="SimpleDiplo" Hidden="1" Anchor="R,T" Offset="0,-5" />
        </Container>
    
      </Stack>
    
    
    
    
      <Instance Name="ChatEntry" >
        <Box Anchor="L,T" Size="490,32" Color="0,0,0,164" ID="Box" >
          <Label Anchor="L,C" Offset="3,0" WrapWidth="465" LeadingOffset="-4"  Font="TwCenMT16" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" ID="String" />
        </Box>
      </Instance>
    
    </Context>
    

     
  5. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
  6. robk

    robk Warlord

    Joined:
    Sep 8, 2006
    Messages:
    210
    Location:
    Santa Monica, CA
    Alpaca has a diplocorner library for adding stuff to the diplocorner menu. He and I are using it for our stuff so that we're compatible with each other and, if you use it here, this will play well with our mods without the need for merging.

    http://forums.civfanatics.com/showthread.php?t=403481
     
  7. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Ah, nice! Just getting back into things after the holidays and haven't been keeping up on the new threads. You guys need to update the old conversations when you do these things! :)

    Looks good, and now I don't have to do it. Will make the changes here as soon as possible. Thanks for the heads up.
     
  8. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    :) Version 2.

    Now uses alpaca's DiploCornerAddin standard.
     
  9. Sneaks

    Sneaks Brooklyn Bum

    Joined:
    Oct 15, 2010
    Messages:
    1,877
    Location:
    NYC
    Lovely work, Whys, as always!
     
  10. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Thanks. Adding a details view for individual mods in the list. Should be ready in a day or two.
     
  11. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    The next version will properly scroll lists longer than the popup window. Just thought some of you would want to know.
     
  12. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    :) Version 3.

    You can now view mod details by clicking a mod in the list. Best of all the homepage data shows up like it is supposed to and you can even click it to automatically open it in Steam's browser.

    For the next version, I want to see if I can add a like button, so people can "like" a mod while in game play.
     
  13. skodkim

    skodkim Deity

    Joined:
    Jan 16, 2004
    Messages:
    2,340
    Location:
    Denmark
    Sounds like a neat little "tool" but what about compatibility with other mods. Infoaddict (v10) for example uses DiploCorner.xml

    \Skodkim
     
  14. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Uses the following DiploCornerAddin-standard by alpaca: http://forums.civfanatics.com/showthread.php?t=403481

    Alpaca's DiploCornerAddin standard allows modders to share the DiploCorner drop down list and it resizes automatically. As long as everyone uses the standardized files, there won't be any conflict.
     
  15. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    :) Version 4. ...rocksaur

    -Fully compatible!
    -LikeIt button.
    -Report button.
    -Policy button.

    -automatically loads as either a DiploCornerAddin or as an InGameUIAddin when DiploCornerAddin-standard not implemented.

    ENJOY!
     
  16. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,248
    Gender:
    Male
    Location:
    On Earth
    We might need your help, please click on the LeoPaRd link below if you have any questions.
     
  17. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,248
    Gender:
    Male
    Location:
    On Earth
    Since this request is somehow related to your mod...

    Would it be possible to auto_activate required Mods upon loading any saves?
     
  18. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Sorry, I can't say I know. Civ5 modding has reached a bit of a wall for me, so at the moment I'm having much more fun trying to breed marine invertebrates.

    Good luck with it!

    edit: this is all I have to offer.
    Code:
    modinfo key-value pairs from Modding.GetInstalledMods():
    
      "Authors"                  = string.
      "MinCompatibleSaveVersion" = integer-string.
      "SpecialThanks"            = string.
      "Description"              = string.
      "ReloadUnitSystem"         = integer-string (0/1).
      "SupportsSinglePlayer"     = integer-string (0/1).
      "SupportsMultiplayer"      = integer-string (0/1).
      "SupportsMac"              = integer-string (0/1).
      "Enabled"                  = boolean.
      "Name"                     = string.
      "ReloadLandmarkSystem"     = integer-string (0/1).
      "ID"                       = unique-string.
      "AffectsSavedGames"        = integer-string (0/1).
      "Stability"                = string (Experimental/Alpha/Beta) (nil=Stable).
      "Version"                  = integer.
      "Homepage"                 = url-string.
    
    ----
    modinfo key-value pairs from Modding.OnlineQuery(): --max pairs: 31.
    
      "recordid"       = integer.
      "ownerid"        = integer.
      "ModID"          = unique-string.
      "ModVersion"     = integer.
      "ModStatus"      = integer.
      "ModTitle"       = string.
      "ModTeaser"      = string (64 char).
      "ModDescription" = string.
      "UploadedBy"     = string.
      "DateUploaded"   = timestamp-string (MM/D/YYYY H:MM AMPM).
      "SpecialThanks"  = string.
      "DownloadURL"    = url-string.
      "Rating1"        = integer.
      "Rating2"        = integer.
      "Rating3"        = integer.
      "Downloads"      = integer.
      "FileSize"       = kB-integer.
      "FileName"       = string.
      "num_ratings"    = integer.
      "average_rating" = integer.
      "SS1FileID"      = integer.
      "SS1FileName"    = string.
      "SS1Url"         = url-string.
      "SS1ThumbUrl"    = url-string.
      "SS2FileID"      = integer.
      "SS2FileName"    = string.
      "SS2Url"         = url-string.
      "SS2ThumbUrl"    = url-string.
      "SS3FileID"      = integer.
      "SS3FileName"    = string.
      "SS3Url"         = url-string.
      "SS3ThumbUrl"    = url-string.
    
     
  19. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,248
    Gender:
    Male
    Location:
    On Earth
    It sure would be less cumbersome and while LeoPaRd will require such a function to verify DB accessing, a number of crashing issues could be prevented for anyone having multi-Mods active.
    Time to pull out the saved file_headers tracing slots gimmick from lua hints - again.
    I presumed you already had solved that format.
    Although, v1217 is showing signs of devs trying to verify init status by resetting active Mods on each patch.
     
  20. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Honestly Zyx, I think you know more about this than I do. Mostly I just know how to focus on something intently until I finally understand it. That's not to say I understand most things, and it requires that I want to understand them.

    I look forward to a future Civ without walls and I do hope you can have a hand at knocking them down. I'll remain subscribed to your LeoPaRd thread, but I don't know when I'll have more to contribute.

    I might come back to Civ at some point. In the mean time, I'm all about making larvae settle and cue. :]
     

Share This Page