Ok, some people were asking if I could update SpecialDomesticAdvisor for patch 1.52.
So, here it is. Unfortunately, there are some issues with it (for example city selection goes rather slow and I don't use the new city jump search), but since people have asked for it, here' s one that will work ok with 1.52.
README:
So, here it is. Unfortunately, there are some issues with it (for example city selection goes rather slow and I don't use the new city jump search), but since people have asked for it, here' s one that will work ok with 1.52.
README:
Code:
Special Domestic Advisor
________________________
This advisor came about as an offshoot of the New Domestic Advisor I created. Take a look at the readme for that file for more information.
Credits: Homegrown - for the original idea of the Better Domestic Advisor and the basis of a lot of the code changes (including combining Happiness/Unhappiness, Health/Unhealth, Food/Food Used, adding City Maintenance, and Garrison Strength, for full list see below)
terrasol - for the changes to the color of the text to indicate problem values and for changes which fix the non-English language problems and additional small changes
Arkeide - for the base code to jumping to a city on the list.
rendermad - for the suggestion of making garrison colored when < 1
=DOCTOR= - for the suggestion of putting in Culture and GP Thresholds
Tubby Rower - for the unfortunately unimplementable mouseover idea
eotinb - for the suggestion of putting in the city automation information and for some general comments and ideas
sportybrian - for the suggestion of highlighting with different colors for the 0, and very positive levels.
Features
________
Columns and symbol meaning (also column order from left to right). Note: symbolsand words might be different depending on any mods you might have installed or your language.
Automation = Is the City automated in citizens and/or production and is there an emphasis on anything?
Name = Name
Buildings = Landmarks
POP = Population
Arm Flexing = Garrison
Happy Face = Net Happiness (Happy faces - Unhappy faces)
Red Cross = Net Health (Health - Unhealth)
Red Bread Slice = Turns Until City Growth
Bread Slice = Net Food (Food - Food Used)
Hammer = Net Production (including any bonuses)
Red Gold Piece = Maintenance Cost
Arrow Triangle = Trade (from all trade routes)
Commerce = Commerce (Total Commerce gained in city)
Gold = Total Gold
Beaker = Total Research
Musical Note = Culture gained per turn
TOT = Total Culture
Figurehead = Great Person points gained per turn
TOT = Great Person points accumulated toward next Great Person
Producing = (How many turns until production is done) What the city is producing
Founded = Date Founded
Religions = Religions in city
Specialists = Specialists in city
Citizen Button = Toggle from Specialist/Default Viewing Mode
Exit = Allows you to exit the Domestic Advisor
View = Allows you to view a selected city from the Domestic Advisor screen with a caveat (see Known Problem #2
Redraw = Allows you to get the table back to the "original" state
Features from the NewDomesticAdvisor
1. Removed the Capital Star from the Date
2. Add a Religions column
3. Add a City Garrison column
4. Combine Happy/Unhappy/Angry into "Net Happiness"
5. Combine Food produced/eaten into "Food Turns until Growth"
6. Combine Healthy/Unhealthy into "Net Healthiness"
7. Add City Maintenance Cost
8. Add Turns til Production Complete
9. Institute Landmarks
Landmarks are to visually represent which cities contain special buildings or special situations. Examples are Versaille/Forbidden Palace, National Wonders, Power Plants, Revolt, Occupation.
Landmarks are represented as following:
Gold Star = Palace
Silver Star = Versailles/Forbidden Palace
Bullet Point = One National Wonder
Lightning Bolt = Power Available
Fist = Occupation
Rebel = Revolt
Additional Features (including work by terrasol and Arkeide):
10. Added coloring of text to problem values (e.g., starvation, unhealthy city, angry citizens, etc.).
11. Added code to allow jumping to the city screen of a city on the list according to where it is on the ORIGINAL list.
12. Added a Net Food Column in addition to the Turns Until Food Growth
13. Actually calculated how many turns until the city will lose a person to starvation and added it to the Turns Until Food Growth column if the Net Food is negative.
14. Added a Trade Column which lists the total trade a city takes in
15. Separated out the Commerce and Gold columns (and changed the icons to reflect this) so that you can tell how much of each you're actually making.
16. Removed Net Gold as it didn't really indicate how much a city was contributing.
17. Combined the Producing and # of rounds until production is complete into one column (and instead of having it at the end like in patch 1.09, added the # of rounds to the front so that you won't miss how many turns you have left).
18. Fixed problems with the Production column not showing the complete amount of production.
19. Re-wrote a lot of the code so that it is easily integratable with other mods.
20. Stretched out the Advisor so that there's a little more space for information.
21. Added in code so that updates work (somewhat) when changing production items while in the Domestic Advisor.
22. Re-wrote code so that it is easier to change in case of future new ideas or better access to data in cIV.
23. Documented a LOT of the class so that it is easier for others to change.
Additional Features of Special Domestic Advisor
24. Added in Culture and GP thresholds onto the base screen
25. Added in a SECOND screen to allow more data to be viewed including...
26. Added Religion back in
27. Added Specialists and the ability to CHANGE specialists from the Domestic Advisor screen and the ability to see the RESULTS from those changes.
28. Added in keyboard shortcuts ("V" for View city and "R" for Redraw screen)
29. Added in documentation for the changes in CvScreensInterface so that it is easier to figure out the differences for modding.
30. Re-wrote a LOT of code so that changing it becomes MUCH easier (yes, even more than the New Domestic Advisor).
31. Added in city automation.
32. Added in code so that specialists are not shown individually but grouped together.
33. Added in coloring of neutral and great values.
34. Added in other language support.
Installation
____________
Special Domestic Advisor should NOT be installed in your main Civ IV location, as it will overwrite one necessary file.
Instead, it should be installed at: "My Documents\My Games\Civilization 4\.
Prior to installation make sure you have upgraded to patch 1.09 as the compatibility changed when Civ IV upgraded (some functions were renamed).
Please note that you MAY have to clear your cache once or twice before the installation/uninstallation will be complete. To do this, hold down the SHIFT button right after you launch Civ IV (i.e., double click the icon). Or go to your cache folder (for me it's My Documents\TempSettings\(UserName)\AppData\My Games\Civilization 4\cache) and delete everything from the directory (this is the recommended method).
To install: Just unzip the zip file with the target being the above indicated directory (may be different for different languages).
Installation will create four new files (CvSpecialDomesticAdvisor.py in subdirectory CustomAssets\python\screen, DomPyHelpers.py in subdirectory CustomAssets\python, CvReqScreensInterface.py in subdirectory CustomAssets\python\entrypoints, and Civ4AdvisorInfo in subdirectory CustomAssets\xml\text) and will create a new copy of CvScreensInterface.py in CustomAssets\python\entrypoints. To uninstall, all that is needed is to move, remove, or rename the CvScreensInterface.py from the My Documents\My Games\Civilization 4\ directory AND ANY SUBDIRECTORIES OF IT.
Note: If you have BOTH the Special Domestic Advisor and the Exotic Foreign Advisor, install the CvReqScreensInterface.py AS CvScreensInterface.py in the aforementioned directory.
To combine this mod to another mod, just add the new files CvSpecialDomesticAdvisor.py, DomPyHelpers.py, and Civ4AdvisorInfo to the aforementioned My Documents directory (or your mod directory) and make the changes documented in CvScreensInterface.py if you have changed it in your mod.
Known Problems
______________
1. If you choose another production item for a city to make while in the Domestic Advisor, and then you attempt to sort by Net Food, Growth, or Production, the sorting will be alphanumerically rather than by Number (i.e., "123" will be before "98" when sorting ascending). This occurs because 1) Sorting is ubiquitous to the Python modder and 2) the interface doesn't allow the Python modder access to data being displayed. As such, you need to use a key to change the correct fields. However, the only way to update using a key is through CyGInterfaceScreen's setTableTextKey method. There is NO equivalent for Ints. Therefore the sorting is by text.
Workaround: Basically, if you want to sort using those columns, exit the Domestic Advisor and come back in again. Sorting will work fine, then.
NEW: Okay, this might be fixed depending on what the response is. It should be trivial to fix what with the new behavior, but there MAY be a performance hit for it.
2. Because of the limitations specified in KP #1 above, after you sort your cities by any criteria except Date Founded ascending, you will NOT be able to correct jump to a City Screen from the Domestic Advisor.
Workaround: To jump to the City Screen. Click on the Redraw word in the lower part of the Domestic Advisor. This should set the table back to the order that the Python code can know about. After that, select the city you want to jump to and click on View, you should be able to jump to the correct city screen.
NEW: Ok, this should be feasible to implement as you just need to keep track of what sorting is being run. This is NOT trivial, however, and for now, I'm holding off on actually implementing this.
3. Clicking on one of the automation buttons or the emphasize buttons does NOT cause ANY update function to be called. I'm not sure how to update the code so that it's updated immediately when a new automation button is clicked.
Workaround: Press 'R' or the Redraw button and all the information should be updated.
Future TODO
___________
1) Create a table to keep track of sorting and keep updated with the sorts.
2) Handle updates so that each line is targeted specifically if it's updated (IOW, we don't have to modify the whole table). This requires being able to sort the cities manually or getting the information from the C++ part of the code.
History
_______
v0.93
- Made it so that it can run with patch 1.52.
v0.92
- Added in Color coding of neutral and great values
- Added in other language support
- Added in documentation in the code so it's easier to follow and modify.
v0.91
- Added in the automation for cities into the information
- Added in the counting up and grouping of specialists.
- Switched Date Founded to the Specialist View
- Cleaned up the update code in CvScreensInterface so that there's no exception just for the Domestic Advisor
- Changed the update code so that it will stop when the changed information is actually on the right number of specialists instead of if there's a change AT ALL for specialist
- Improved the speed of the update and update screen code so that the lag between a user action and the update is minimized.
v0.9
- beta version of release (might add in one more feature before final v1.0).