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

Platypedia

Discussion in 'Civ4 - Mod Components' started by platyping, Nov 18, 2013.

  1. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Platypedia 4.0

    Features:
    1) Ability to Sort Items
    2) Various New Pages
    3) Fit to User Resolution
    4) Movie Player
    5) Left/Right View
    6) Displays Hidden Items during Debug Mode

    Techs, Tech Tree
    Spoiler :




    Units, Unit Groups
    Spoiler :




    Promotions
    Spoiler :


    Buildings, Wonders, Building Chart, Projects, Processes
    Spoiler :








    Terrains, Features, Resources, Improvements, Routes
    Spoiler :










    Civilizations, Leaders, Traits
    Spoiler :






    Specialists, Religions, Corporations, Civics
    Spoiler :








    Culture Level, Game Speed, Handicap, Era
    Spoiler :








    Index
    Spoiler :


    Movies
    Spoiler :
     
    raen likes this.
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Adding New Screens

    Natural Wonders Example

    CvPediaMain
    (I) Initialisation of Pages
    Spoiler :
    Code:
    	def __init__(self):
    		self.PLATYPEDIA_TECH		= 0
    		self.PLATYPEDIA_UNIT		= self.PLATYPEDIA_TECH + 1
    		self.PLATYPEDIA_UNIT_GROUP	= self.PLATYPEDIA_UNIT + 1
    		self.PLATYPEDIA_PROMOTION	= self.PLATYPEDIA_UNIT_GROUP + 1
    		self.PLATYPEDIA_BUILDING	= self.PLATYPEDIA_PROMOTION + 1
    		self.PLATYPEDIA_WONDER		= self.PLATYPEDIA_BUILDING + 1
    		self.PLATYPEDIA_B_CHART		= self.PLATYPEDIA_WONDER + 1
    		self.PLATYPEDIA_PROJECT		= self.PLATYPEDIA_B_CHART + 1
    		self.PLATYPEDIA_PROCESS		= self.PLATYPEDIA_PROJECT + 1
    		self.PLATYPEDIA_TERRAIN		= self.PLATYPEDIA_PROCESS + 1
    		self.PLATYPEDIA_FEATURE		= self.PLATYPEDIA_TERRAIN + 1
    ## Natural Wonders ##
    		self.PLATYPEDIA_NATURAL		= self.PLATYPEDIA_FEATURE + 1
    		self.PLATYPEDIA_BONUS		= self.PLATYPEDIA_NATURAL + 1
    ## Natural Wonders ##
    		self.PLATYPEDIA_IMPROVEMENT	= self.PLATYPEDIA_BONUS + 1
    		self.PLATYPEDIA_ROUTE		= self.PLATYPEDIA_IMPROVEMENT + 1
    		self.PLATYPEDIA_TREE		= self.PLATYPEDIA_ROUTE + 1
    		self.PLATYPEDIA_CIV		= self.PLATYPEDIA_TREE + 1
    		self.PLATYPEDIA_LEADER		= self.PLATYPEDIA_CIV + 1
    		self.PLATYPEDIA_TRAIT		= self.PLATYPEDIA_LEADER + 1
    		self.PLATYPEDIA_SPECIALIST	= self.PLATYPEDIA_TRAIT + 1
    		self.PLATYPEDIA_RELIGION	= self.PLATYPEDIA_SPECIALIST + 1
    		self.PLATYPEDIA_CORPORATION	= self.PLATYPEDIA_RELIGION + 1
    		self.PLATYPEDIA_CIVIC		= self.PLATYPEDIA_CORPORATION + 1
    		self.PLATYPEDIA_GAME_INFO	= self.PLATYPEDIA_CIVIC + 1
    		self.PLATYPEDIA_CONCEPT		= self.PLATYPEDIA_GAME_INFO + 1
    		self.PLATYPEDIA_GAMEOPTION	= self.PLATYPEDIA_CONCEPT + 1
    		self.PLATYPEDIA_HINTS		= self.PLATYPEDIA_GAMEOPTION + 1
    		self.PLATYPEDIA_INDEX		= self.PLATYPEDIA_HINTS + 1
    		self.PLATYPEDIA_MOVIE		= self.PLATYPEDIA_INDEX + 1


    Spoiler :
    Code:
    		self.mapCategories = { 
    			self.PLATYPEDIA_TECH		: self.placeTechs, 
    			self.PLATYPEDIA_UNIT		: self.placeUnits, 
    			self.PLATYPEDIA_BUILDING	: self.placeBuildings, 
    			self.PLATYPEDIA_WONDER		: self.placeWonders, 
    			self.PLATYPEDIA_TERRAIN		: self.placeTerrains,
    			self.PLATYPEDIA_FEATURE		: self.placeFeatures,
    			self.PLATYPEDIA_BONUS		: self.placeBoni, 
    			self.PLATYPEDIA_IMPROVEMENT	: self.placeImprovements,
    			self.PLATYPEDIA_SPECIALIST	: self.placeSpecialists,
    			self.PLATYPEDIA_PROMOTION	: self.placePromotions,
    			self.PLATYPEDIA_UNIT_GROUP	: self.placeUnitGroups,
    			self.PLATYPEDIA_CIV		: self.placeCivs,
    			self.PLATYPEDIA_LEADER		: self.placeLeaders,
    			self.PLATYPEDIA_RELIGION	: self.placeReligions,
    			self.PLATYPEDIA_CORPORATION	: self.placeCorporations,
    			self.PLATYPEDIA_CIVIC		: self.placeCivics,
    			self.PLATYPEDIA_PROJECT		: self.placeProjects,
    			self.PLATYPEDIA_CONCEPT		: self.placeConcepts,
    			self.PLATYPEDIA_HINTS		: self.placeHints,
    			self.PLATYPEDIA_TRAIT		: self.placeTraits,
    			self.PLATYPEDIA_ROUTE		: self.placeRoutes,
    			self.PLATYPEDIA_PROCESS		: self.placeProcesses,
    			self.PLATYPEDIA_GAME_INFO	: self.placeGameInfos,
    			self.PLATYPEDIA_MOVIE		: self.placeMovies,
    			self.PLATYPEDIA_INDEX		: self.placeIndex,
    			self.PLATYPEDIA_GAMEOPTION	: self.placeGameOptions,
    			self.PLATYPEDIA_B_CHART		: self.placeBuildingChart,
    			self.PLATYPEDIA_TREE		: self.placeUpgradeTree,
    ## Natural Wonders ##
    			self.PLATYPEDIA_NATURAL		: self.placeNaturalWonders,
    ## Natural Wonders ##
    			}


    (II) Optional: Assigning an Icon to it
    Spoiler :
    Code:
    ## Icons ##
    		self.sTechIcon = "[ICON_RESEARCH] "
    		self.sUnitIcon = "[ICON_STRENGTH] "
    		self.sBuildingIcon = "[ICON_PRODUCTION] "
    		self.sWonderIcon = "[ICON_CULTURE] "
    		self.sBonusIcon = "[ICON_HAPPY] "
    		self.sTerrainIcon = "[ICON_FOOD] "
    		self.sFeatureIcon = "[ICON_DEFENSE] "
    		self.sImprovementIcon = "[ICON_COMMERCE] "
    		self.sSpecialistIcon = "[ICON_GREATPEOPLE] "
    		self.sPromotionIcon = "[ICON_STAR] "
    		self.sUnitCombatIcon = "[ICON_SILVER_STAR] "
    		self.sCivIcon = "[ICON_MAP] "
    		self.sLeaderIcon = "[ICON_ANGRYPOP] "
    		self.sReligionIcon = "[ICON_RELIGION] "
    		self.sCorporationIcon = "[ICON_GOLD] "
    		self.sCivicIcon = "[ICON_BAD_GOLD] "
    		self.sProjectIcon = "[ICON_POWER] "
    		self.sHelpIcon = "[ICON_DEFENSIVEPACT] "
    		self.sBTSHelpIcon = "[ICON_OPENBORDERS] "
    		self.sTraitIcon = "[ICON_OCCUPATION] "
    		self.sRouteIcon = "[ICON_MOVES] "
    		self.sProcessIcon = "[ICON_TRADE] "
    		self.sGameInfoIcon = "[ICON_GOLDENAGE] "
    		self.sUpgradeIcon = "[ICON_HEALTHY] "
    		self.sMovieIcon = "[ICON_CULTURE] "
    		self.sIndexIcon = "[ICON_ESPIONAGE] "
    ## Natural Wonders ##
    		self.sNaturalIcon = "[ICON_MAP] "
    ## Natural Wonders ##


    (III) Adding it into the List Box on the right
    Spoiler :
    Code:
    		self.listCategories = [	CyTranslator().getText(self.sTechIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_TECH", ()),
    					CyTranslator().getText(self.sUnitIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT", ()),
    					CyTranslator().getText(self.sUnitCombatIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT_COMBAT", ()),
    					CyTranslator().getText(self.sPromotionIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROMOTION", ()),
    					CyTranslator().getText(self.sBuildingIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BUILDING", ()),
    					CyTranslator().getText(self.sWonderIcon, ()) + CyTranslator().getText("TXT_KEY_CONCEPT_WONDERS", ()),
    					CyTranslator().getText(self.sUnitCombatIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BCHART", ()),
    					CyTranslator().getText(self.sProjectIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROJECT", ()),
    					CyTranslator().getText(self.sProcessIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROCESS", ()),
    					CyTranslator().getText(self.sTerrainIcon, ()) + CyTranslator().getText("TXT_KEY_CONCEPT_TERRAIN", ()),
    					CyTranslator().getText(self.sFeatureIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_FEATURE", ()),
    ## Natural Wonders ##
    					CyTranslator().getText(self.sNaturalIcon, ()) + CyTranslator().getText("TXT_KEY_NATURAL_WONDERS", ()),
    ## Natural Wonders ##
    					CyTranslator().getText(self.sBonusIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BONUS", ()),
    					CyTranslator().getText(self.sImprovementIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_IMPROVEMENT", ()),
    					CyTranslator().getText(self.sRouteIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_ROUTE", ()),
    					CyTranslator().getText(self.sUpgradeIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_TREE", ()),
    					CyTranslator().getText(self.sCivIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_CIV", ()),
    					CyTranslator().getText(self.sLeaderIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_LEADER", ()),
    					CyTranslator().getText(self.sTraitIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_TRAITS", ()),
    					CyTranslator().getText(self.sSpecialistIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_SPECIALIST", ()),
    					CyTranslator().getText(self.sReligionIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_RELIGION", ()),
    					CyTranslator().getText(self.sCorporationIcon, ()) + CyTranslator().getText("TXT_KEY_CONCEPT_CORPORATIONS", ()),
    					CyTranslator().getText(self.sCivicIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_CIVIC", ()),
    					CyTranslator().getText(self.sGameInfoIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_GAME_INFO", ()),
    					CyTranslator().getText(self.sHelpIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_CONCEPT", ()),
    					CyTranslator().getText(self.sHelpIcon, ()) + CyTranslator().getText("TXT_KEY_PITBOSS_GAME_OPTIONS", ()),
    					CyTranslator().getText(self.sHelpIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_HINTS", ()),
    					CyTranslator().getText(self.sIndexIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_INDEX", ()),
    					CyTranslator().getText(self.sMovieIcon, ()) + CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_MOVIES", ())]


    (IV) Placement Codes
    Since Natural Wonders are just Features, make use of it and simply assign a new Type Number (1).
    Spoiler :
    Code:
    ## Natural Wonders ##						
    	def placeNaturalWonders(self):
    		screen = self.getScreen()
    		listSorted = self.sortFeatures(1)
    		self.setTable(0, listSorted)
    
    		iCount = 0
    		for item in listSorted[0]:
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			ItemInfo = gc.getFeatureInfo(item[1])
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getFeatureInfo(item[1]).getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_FEATURE, item[1], 1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    ## Natural Wonders ##


    (V) Change the Sort Method
    Minor Adjustments to sortFeatures to filter which are Natural Wonders and which are not.
    Spoiler :
    Code:
    ## Natural Wonders ##
    	def sortFeatures(self, iType):
    		lItem = []
    		lNatural = []
    		for iItem in xrange(gc.getNumFeatureInfos()):
    			ItemInfo = gc.getFeatureInfo(iItem)
    			if ItemInfo.isGraphicalOnly(): continue
    			if ItemInfo.getType().find("FEATURE_PLATY_") == -1:
    				lItem.append([ItemInfo.getDescription(), iItem])
    			else:
    				lNatural.append([ItemInfo.getDescription(), iItem])
    		if iType == 1:
    			lNatural.sort()
    			return [lNatural]
    		lItem.sort()
    		return [lItem]
    ## Natural Wonders ##


    When you are done with this, the main screen itself is done.


    CvPediaFeature
    (VI) Setting Up the List Table
    Spoiler :
    Code:
    	def placeLinks(self):
    		screen = self.top.getScreen()
    		self.sTableName = self.top.getNextWidgetName()
    		screen.addTableControlGFC(self.sTableName, 1, self.top.X_PANEL, 55, self.top.W_PANEL, screen.getYResolution() - 110, False, False, 24, 24, TableStyles.TABLE_STYLE_STANDARD);
    		screen.enableSelect(self.sTableName, True)
    		screen.setTableColumnHeader(self.sTableName, 0, "", self.top.W_PANEL)
    ## Natural Wonders ##
    		if self.bNatural:
    			listSorted = self.top.sortFeatures(1)
    		else:
    			listSorted = self.top.sortFeatures(0)
    ## Natural Wonders ##


    (VII) Adjusting the Page for different details
    I don't want the NW Page to display identical stuff to the Feature Page itself, so I did more adjustments than necessary.

    Spoiler :
    Code:
    ## Natural Wonders Start ##
    		self.bNatural = gc.getFeatureInfo(iFeature).getType().find("FEATURE_PLATY_") > -1
    
    		self.W_HISTORY = self.W_BONUS
    		self.Y_HISTORY = self.Y_BONUS + self.H_TERRAIN + 10
    		self.H_HISTORY = screen.getYResolution() - self.Y_HISTORY - self.top.Y_ITEMS_PANE
    
    		self.W_BUILDING = (self.top.X_PANEL - self.top.X_ITEMS_PANE * 2 - 20) /2
    		self.H_BUILDING = screen.getYResolution() - self.top.Y_ITEMS_PANE - self.Y_IMPROVEMENT
    
    		link = self.top.PLATYPEDIA_FEATURE
    		sIcon = self.top.sFeatureIcon
    		if self.bNatural:
    			link = self.top.PLATYPEDIA_NATURAL
    			sIcon = self.top.sNaturalIcon
    			self.W_HISTORY = self.W_BUILDING
    			self.Y_HISTORY = self.Y_IMPROVEMENT
    			self.H_HISTORY = self.H_BUILDING
    
    		szHeader = gc.getFeatureInfo(self.iFeature).getDescription().upper()
    		szHeader = u"<font=4b>" + self.top.color4 + CyTranslator().getText(sIcon, ()) + szHeader + " " + CyTranslator().getText(sIcon, ()) + "</color></font>"
    		screen.setLabel(self.top.getNextWidgetName(), "Background", szHeader, CvUtil.FONT_CENTER_JUSTIFY, screen.getXResolution()/2, self.top.Y_TITLE, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    		
    		screen.setText(self.top.getNextWidgetName(), "Background", self.top.MENU_TEXT, CvUtil.FONT_CENTER_JUSTIFY, screen.getXResolution()/2, screen.getYResolution() - 42, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_PEDIA_MAIN, link, -1)
    		self.top.iLastScreen = CvScreenEnums.PEDIA_FEATURE
    						
    		screen.addPanel( self.top.getNextWidgetName(), "", "", False, False, self.top.X_ITEMS_PANE, self.top.Y_ITEMS_PANE, self.W_MAIN_PANE, self.H_MAIN_PANE, PanelStyles.PANEL_STYLE_BLUE50)
    		screen.addPanel(self.top.getNextWidgetName(), "", "", false, false, self.X_ICON, self.Y_ICON, self.H_ICON, self.H_ICON, PanelStyles.PANEL_STYLE_MAIN)
    		screen.addDDSGFC(self.top.getNextWidgetName(), gc.getFeatureInfo(self.iFeature).getButton(), self.X_ICON + self.H_ICON/2 - 64/2, self.Y_ICON + self.H_ICON/2 - 64/2, 64, 64, WidgetTypes.WIDGET_GENERAL, -1, -1 )
    
    		self.placeStats()
    		self.placeSpecial()
    		self.placeHistory()
    		self.placeLinks()
    		if self.bNatural:
    			self.placeBuilding()
    		else:
    			self.placeTerrain()
    			self.placeBonus()
    			self.placeImprovements()
    
    	def placeBuilding(self):
    		screen = self.top.getScreen()
    		panelName = self.top.getNextWidgetName()
    		screen.addPanel( panelName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BUILDING", ()), "", True, True, self.X_SPECIAL, self.Y_IMPROVEMENT, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50 )
    		
    		textName = self.top.getNextWidgetName()
    		sType = gc.getFeatureInfo(self.iFeature).getType()
    		sNature = sType[sType.find("_PLATY_") + 7:]
    		sBuildingType = "BUILDING_" + sNature
    		iBuilding = gc.getInfoTypeForString(sBuildingType)
    		if iBuilding > -1:
    			BuildingInfo = gc.getBuildingInfo(iBuilding)
    			szText = ""
    			for k in xrange(YieldTypes.NUM_YIELD_TYPES):
    				iYieldChange = BuildingInfo.getYieldChange(k)
    				if iYieldChange != 0:
    					szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), iYieldChange, gc.getYieldInfo(k).getChar())
    			
    			for k in xrange(CommerceTypes.NUM_COMMERCE_TYPES):
    				iTotalCommerce = BuildingInfo.getObsoleteSafeCommerceChange(k) + BuildingInfo.getCommerceChange(k)
    				if iTotalCommerce != 0:
    					szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), iTotalCommerce, gc.getCommerceInfo(k).getChar())
    
    			iHappiness = BuildingInfo.getHappiness()			
    			if iHappiness > 0:
    				szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), iHappiness, CyGame().getSymbolID(FontSymbols.HAPPY_CHAR))
    			elif iHappiness < 0:
    				szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), -iHappiness, CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR))
    
    			iHealth = BuildingInfo.getHealth()
    			if iHealth > 0:
    				szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), iHealth, CyGame().getSymbolID(FontSymbols.HEALTHY_CHAR))
    			elif iHealth < 0:
    				szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), -iHealth, CyGame().getSymbolID(FontSymbols.UNHEALTHY_CHAR))
    
    			iGPChange = BuildingInfo.getGreatPeopleRateChange()
    			if iGPChange != 0:
    				szText += u"%c%+d%c\n" % (CyGame().getSymbolID(FontSymbols.BULLET_CHAR), iGPChange, CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR))
    			szText += CyGameTextMgr().getBuildingHelp(iBuilding, True, False, False, None)[1:]
    			screen.addMultilineText(textName,szText, self.X_SPECIAL + 15, self.Y_IMPROVEMENT + 40, self.W_BUILDING - 30, self.H_BUILDING - 55, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    ## Natural Wonders End ##






    Optionals
    (VIII) Adding to Index
    Spoiler :
    Code:
    	def placeIndex(self):
    		screen = self.getScreen()
    		listSorted = []
    ## Natural Wonders ##
    		for item in self.sortFeatures(1)[0]:
    			listSorted.append([item[0], item[1], gc.getFeatureInfo(item[1]).getButton(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_FEATURE, item[1], 1])
    ## Natural Wonders ##


    (IX) Adding to Movies
    Natural Wonders have Movies, so additional stuff to do for Movie Player.
    CvPediaMain
    Spoiler :
    Code:
    	def placeMovies(self):
    		screen = self.getScreen()
    ## Natural Wonders ##
    		listSorted = [self.sortWonders(3), self.sortProjects(3), self.sortReligions(1)[0], self.sortCorporations(1)[0], self.sortVictories(), self.sortFeatures(1)[0]]
    		self.setTable(1, listSorted)
    
    		iCount = 0
    		if len(listSorted[0]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_CONCEPT_WONDERS", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText(self.sWonderIcon, ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[0]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getBuildingInfo(item[1]).getButton(), WidgetTypes.WIDGET_HELP_BUILDING, item[1], 6784, CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    			iRow = iCount % self.iNumRows
    			if iRow == 0:
    				self.iExtraSpace += 1
    			else:
    				iCount += 1
    
    		if len(listSorted[1]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROJECT", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText(self.sProjectIcon, ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[1]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getProjectInfo(item[1]).getButton(), WidgetTypes.WIDGET_PYTHON, 6785, item[1], CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    			iRow = iCount % self.iNumRows
    			if iRow == 0:
    				self.iExtraSpace += 1
    			else:
    				iCount += 1
    		
    		if len(listSorted[2]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_RELIGION", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText(self.sReligionIcon, ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[2]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getReligionInfo(item[1]).getButton(), WidgetTypes.WIDGET_HELP_RELIGION, item[1], 6783, CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    			iRow = iCount % self.iNumRows
    			if iRow == 0:
    				self.iExtraSpace += 1
    			else:
    				iCount += 1
    		
    		if len(listSorted[3]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_CONCEPT_CORPORATIONS", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText(self.sCorporationIcon, ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[3]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getCorporationInfo(item[1]).getButton(), WidgetTypes.WIDGET_PYTHON, 6782, item[1], CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    			iRow = iCount % self.iNumRows
    			if iRow == 0:
    				self.iExtraSpace += 1
    			else:
    				iCount += 1
    
    		if len(listSorted[4]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_CONCEPT_VICTORY", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText("[ICON_OCCUPATION] ", ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[4]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ CyTranslator().getText("[ICON_OCCUPATION] ", ()) + item[0] + u"</color></font>", "", WidgetTypes.WIDGET_PYTHON, 6786, item[1], CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    			iRow = iCount % self.iNumRows
    			if iRow == 0:
    				self.iExtraSpace += 1
    			else:
    				iCount += 1
    
    		if len(listSorted[5]):
    			iRow = iCount % self.iNumRows
    			if iRow == self.iNumRows - 1:
    				if self.iExtraSpace > 0:
    					iCount += 1
    					self.iExtraSpace -= 1
    				else:
    					self.iExtraRow += 1
    					self.showScreen(self.iCategory)
    					return
    			iRow = iCount % self.iNumRows
    			iColumn = iCount / self.iNumRows
    			sList = CyTranslator().getText("TXT_KEY_NATURAL_WONDERS", ())
    			screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color+ CyTranslator().getText(self.sNaturalIcon, ()) + sList + u"</color></font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    			iCount += 1
    			for item in listSorted[5]:
    				iRow = iCount % self.iNumRows
    				iColumn = iCount / self.iNumRows
    				screen.setTableText(self.sTableName, iColumn, iRow, u"<font=3>" + self.color2+ item[0] + u"</color></font>", gc.getFeatureInfo(item[1]).getButton(), WidgetTypes.WIDGET_PYTHON, 6780, item[1], CvUtil.FONT_LEFT_JUSTIFY)
    				iCount += 1
    		self.iExtraRow = 0
    ## Natural Wonders ##


    (X) Handle Input portion to Link to Movies
    Spoiler :
    Code:
    	def handleInput (self, inputClass):
    		if inputClass.getFunctionName().find("PlatySort") > -1:
    			self.handlePlatySort(inputClass.getFunctionName())
    			return
    ## Sort Choices End ##
    		if inputClass.getButtonType() == WidgetTypes.WIDGET_PYTHON:
    			if inputClass.getData1() == 6781:
    				return self.pediaJump(CvScreenEnums.PEDIA_UNIT_CHART, inputClass.getData2(), True)
    ## Natural Wonders ##
    			elif inputClass.getData1() == 6782 or inputClass.getData1() == 6785 or inputClass.getData1() == 6786 or  inputClass.getData1() == 6780:
    				return self.pediaJump(self.PLATYPEDIA_MOVIE, inputClass.getData1() * 10000 + inputClass.getData2(), True)
    ## Natural Wonders ##


    CvGameUtils
    Adding Hover Text for the Movie Widget
    Spoiler :
    Code:
    	def getWidgetHelp(self, argsList):
    		eWidgetType, iData1, iData2, bOption = argsList
    ## Platypedia ##
    		if eWidgetType == WidgetTypes.WIDGET_PYTHON:
    ## Natural Wonders ##
    			if iData1 == 6780:
    				return gc.getFeatureInfo(iData2).getDescription()
    ## Natural Wonders ##
    			elif iData1 == 6781:
    				if iData2 == gc.getNumUnitCombatInfos() + 1:
    					return CyTranslator().getText("TXT_PEDIA_NON_COMBAT", ())
    				elif iData2 == gc.getNumUnitCombatInfos():
    					return CyTranslator().getText("TXT_KEY_PEDIA_ALL_GROUPS", ())


    CvPediaMovie
    Spoiler :
    Code:
    ## Natural Wonders ##
    		elif self.iType == 6780:
    			sDescription = gc.getFeatureInfo(iEntry).getDescription()
    			sType = gc.getFeatureInfo(iEntry).getType()
    			szArtDef = CyArtFileMgr().getMovieArtInfo("ART_DEF_MOVIE_" + sType[sType.find("_PLATY_") +7:])
    			if szArtDef:
    				self.szMovieFile = szArtDef.getPath()
    				screen.playMovie(self.szMovieFile, self.X_MOVIE, self.Y_MOVIE, self.W_MOVIE, self.H_MOVIE, -2.3 )
    ## Natural Wonders ##




     
    raen likes this.
  3. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Version 2.14
    1) Specialist Page Overhaul
    2) Bonus Page: Added Corporations
    3) Index: Fix a bug

    Spoiler :
    Version 2.13
    1) New Page: Game Options

    2) Resources Page:
    Replace most benefits in words into icons
    Added No access info
    Added % Yield modifiers to buildings
    Added Routes to Allow Section
    Modified Allow and Faster Production Section from displaying full list of units, to just the unit of that unit class for the active civ, or default unit in main menu. For instance, instead of displaying Axeman, and Axeman UUs, it now just display whichever Axeman is relevant to the active civ.

    3) Improvements Page:
    Replace most benefits in words into icons
    Added Time required to build

    4) Routes Page:
    Added Time to Build
    Replace movement and yield changes in words into icons

    Version 2.10
    1) Added Cost to Routes and Improvements
    2) Added World Size to GameInfos

    Version 2.9
    1) Added ability to toggle "Hide Inactive Civs"

    Version 2.8
    1) Fix Art Define in Ultrapack for upgrade charts
    2) Renamed all files as PlatyPedia instead of CvPedia so that BTS Pedia will never be loaded regardless of location
    3) Added a section for Unit AI in Game Infos for modders to check their work

    Version 2.7
    1) Fix Leader Screen in Left Hand View

    Version 2.6
    1) Fixed a Bug with Tech Tree

    Version 2.5
    1) Fixed a Bug when entering Pedia Screens without going through main Pedia Screen

    Version 2.4
    New Sort Functions
    1) Resources: Era, Domain
    2) Improvements: Era
    3) Routes: Era
    4) Civics: Era, Upkeep
    5) Leaders: Trait
    6) Religions: Era
    7) Corporations: Era
    8) Processes: Era

    Game Info, Era
    1) Added Techs

    New Page
    1) Building Data Chart

    Version 2.3
    1) Added Function to Alter between Left/Right View
    2) Fix a bug in UnitUpgradesGraph which can occur when there are no upgradable items at all

    Promotion Upgrade Tree
    1) Added Function to Filter by Combat Class

    Unit Upgrade Tree
    1) Added Function to Filter by Domain Type

    Version 2.2
    General
    1) Added Strategy Text for All History Sections
    2) For Quotes, Strategies and Pedia entries, they will no longer display as "TXT_KEY_XXX" if there isn't a corresponding translated text.
    It will just be blank.
    3) Added Pedia Text Files for Traits, Improvements, Terrains, Features, provided by Roamty

    Traits
    1) Special Pedia Section for Traits to read directly from Text File if any

    Improvements
    1) Added History Section

    Leader
    1) Added Personality Section

    Tech
    1) Separated Quotes from History Section
    2) Added Civs with this Starting Tech

    Version 2.1
    1) Added Index Page

    Version 2.0
    General
    1) Screen size adjusted to fit any resolution
    2) Standardization of variables across all screens
    3) Added missing headers for every section such as History
    4) Added Link Ability for all new pages. [LINK=GAMESPEED_NORMAL]abc[\LINK] for instance will go to Pedia Page for Normal GameSpeed

    Tech
    1) Added Era Display

    Units
    1) Bigger Combat Type Font
    2) Can display both Strength and Air Strength if unit has both
    3) Unit Cost shifted below Range
    4) Merged Units and Limited Units into same page
    5) Added Sort by Limit Class

    Promotions
    1) Bigger Combat Type Font and Button

    Buildings
    1) Merged all Yields together
    2) Merged all Commerce together
    3) Merged Happiness, Health and Great People together

    Terrain
    1) Added Pedia Section

    Feature
    1) Added Pedia Section

    Resources
    1) Added Obsolete Section

    Improvements
    1) Resource Icons and Font reduced to be similar to others
    2) Resource placed in orderly manner regardless of number of resources
    3) Yield reordered so that all similar types are listed together

    Routes
    1) Changed to Display Move Cost rather than Moves

    Traits
    1) Can Display up to 3 Rows of Leaders (or more at higher Resolution) before the need of scrollbar

    Specialists
    1) Added Sources with Slots for Specialists, (Civics and Buildings)
    2) Added Sources with GP Points for Great Specialists, (Specialists and Buildings)
    3) Added Leads to Section (GP Generated)
    4) Added Yields from Sources (Civics and Buildings)
    Notes: Sistine Chapel one is read directly from file. No python function

    Corporations
    1) Added Resources to Require Section (For Players who cannot recognize that mini icons... and Allows Links to Resource Page)

    Civics
    1) Added "No Upkeep" for Civics with no upkeep

    Game Info
    1) Removed some of them
    2) Beautified the rest of them

    Movies
    1) Movie will now play regardless of whether No Movie Option is set
     
  4. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Great job and good idea to have its separate page :goodjob:

    (but I don't see a link).
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Simple.
    Because the change log is getting long, so time to write somewhere.
    Left some functions to do.
     
  6. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Updated Ultrapack and Standalone 2.0 Released
     
  7. Cybah

    Cybah Emperor

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Holy crap, nice! Merging this with BUG's Sevopedia - anyone? I need the Techtree, Game Speed, Handicap, Starting Era, ... :D
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Sevo is history :D
     
  9. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Index



    Just an Index of all stuff.
    If you find it too much, you can even filter off.

     
  10. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Added Tutorial to add new page.
    Natural Wonders Updated with Pedia
     
  11. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,329
    Gender:
    Male
    Location:
    Canberra, Australia
    I maybe but not straight away I am working in the dreaded main interface code. There again a break may be a good idea.

    Sevo still has better layout:p
     
  12. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Never liked the layout, or I would have worked on it directly.
    Half the page is used by 2 columns for table when 1 can do the job and leave more space to display more important stuff.

    Then you are left with just 1 column to display all the items where BTS Pedia can display multi columns so that all items can be displayed at once.
    Well, C2C is an exception, even 10 columns may not be enough...
     
  13. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,329
    Gender:
    Male
    Location:
    Canberra, Australia
    It may be a left handed verses right handed thing. "Down with the tyranny of the right handers!"
     
  14. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Not a big issue.
    Can always write codes to allow user to change it from right to left
     
  15. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    The Tech Tree does not display anymore in Platypedia after v.2.1.

    Python error: CvPediaTechTree l.338 in interfaceScreen

    Attribute Error: CvPediaTechTree instance has no attribute 'placeTechUpgrades'
     
  16. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Tried and Tested.
    Platypedia, Ultrapack and Natural Wonders all have no issues with it. :D

    Edit:
    Updated Baddies, Artifacts with Pedia
     
  17. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    What could go wrong then?

    Where is the self.placeTechUpgrades() then?
     
  18. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    CvPediaMain file.

    If the standalone somehow does not work for you, try any of the other packs and see how it goes.
     
  19. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Version 2.2

    1) Added Personality Section for Leaders, suggested by Roamty


    2) Added History Section for Improvements, suggested by Roamty


    3) Added Special Pedia Text for Traits, suggested by Roamty
    There is no Pedia XML Tag for Traits, but it will read directly if there is a corresponding TXT_KEY_TRAIT_XXX_PEDIA



    4) Separated Quotes from History for Tech, suggested by Roamty
    5) Added Civs with Starting Tech for Tech


    5) Added Strategy Section for All History Sections to display Strategy if there is one.

    When there is no strategy section, only the pedia will be displayed.


    6) For Quotes, Strategies and Pedia entries in All Pages, it will no longer display TXT_KEY_XXX if there is no corresponding translated text.
    It will just be blank.

    7) Added additional text file with various Pedia entries for Improvements, Traits, Terrains and Features, provided by Roamty
     
  20. RPG

    RPG King

    Joined:
    Jan 17, 2007
    Messages:
    658
    Location:
    Cambridge
    Nice additions!
     

Share This Page