Sid Meier's Civilization 4 - Beyond the Sword - anyfunmod

Python API

下面写出来的函数都是C++内定义,输出Python用的,大部份可以搜索Python目录来找到其在使用的例子。

这里列出的是部分,详细请参考我提供的SDK。

CyCity()

   
  void upCityProductionOrder(int i)
向上提升一格城市生项目,int i是城市的要调整的目标项目
   
  void downCityProductionOrder(int i)
向下降低一格城市生项目,int i是城市的要调整的目标项目
   
  int getUniqueBuildings(int i) const
取城市的某个建筑类型的建筑
   
  void setUniqueBuildings(int i, int iB)
设城市的某个建筑类型的默认建筑,int i就是建筑类型,int iB就是建筑。
启用“保持原来建造体系”时才有需要。
   
  int getUniqueUnits(int i) const
取城市的某个单位类型的单位
   
  void setUniqueUnits(int i, int iU)
设城市的某个单位类型的默认单位,int i就是单位类型,int iU就是单位。
启用“保持原来建造体系”时才有需要。
   

CyEnumsInterface

   
  CityTabTypes.CITYTAB_DESTORY_CITY
   
  ControlTypes.CONTROL_CHANGE_CIV
  ControlTypes.CONTROL_AI_AUTO_PLAY
  ControlTypes.CONTROL_DIPLO_DO_NOT_DISTURB
  ControlTypes.CONTROL_ANYFUN_LOG
   
  FontSymbols.ATTITUDE0_CHAR
  FontSymbols.ATTITUDE1_CHAR
  FontSymbols.ATTITUDE2_CHAR
  FontSymbols.ATTITUDE3_CHAR
  FontSymbols.ATTITUDE4_CHAR
   
  WidgetTypes.WIDGET_HURRY_SINGEL_CITY
   

CyGame()

   
  int getCutLosersCounter() const
ASSIMILATION 用来取cut掉最低分玩家的回合
   
  int getHighToLowCounter() const
ASSIMILATION 用来取高分转最低分的回合
   
  void setVictoryValid(int /*VictoryTypes*/ eIndex, bool bValid)
设置胜利条件是否启用
   
  void setMPOption(int /*MultiplayerOptionTypes*/ eIndex, bool bEnabled)
设置多人游戏选项是否启用
   
  void setGameSpeed(int /*GameSpeedTypes*/ i)
设置游戏速度
   
  void setHandicapType(int /*HandicapTypes*/ i)
设置游戏难度
   

CyGameTextMgr()

   
  std::wstring parseCustomPlayerTraits(int /*PlayerTypes*/ iPlayer, bool bDawnOfMan)
anyfun的玩家的Traits都是单独储放的,不像是原版那样直接取基本数据,所以要写新函数代替parseLeaderTraits,python就直接用str
   
  std::wstring parseCustomPlayerInfos(int /*PlayerTypes*/ iPlayer, bool bDawnOfMan)
anyfun的玩家单位类型,建筑类型都是单独储放的,不像是原版那样直接取基本数据,所以要写新函数代替parseCivInfos,python就直接用str
   

CyPlayer()

   
  bool isHumanDisabled()
AI AUTO PLAY执行时用来判断玩家是否“关闭了的人类”
   
  void setLH(int value)
设置玩家的领导人
   
  void setTrait(int value, bool onoff)
设置玩家的Trait是否启用
   
  int getUniqueBuildings(int i) const
取玩家的某个建筑类型的建筑,如果程序语句有该玩家的“城市”,请使用“城市”的getUniqueBuildings
   
  int getUniqueUnits(int i) const
取玩家的某个单位类型的单位,如果程序语句有该玩家的“城市”,请使用“城市”的getUniqueUnits
   
  void setUniqueBuildings(int i, int iB)
设玩家的某个建筑类型的默认建筑,int i就是建筑类型,int iB就是建筑。
会同步更新玩家所有城市的该类型,启用“保持原来建造体系”时才有需要。
   
  void setUniqueUnits(int i, int iU)
设玩家的某个单位类型的默认单位,int i就是单位类型,int iU就是单位。
会同步更新玩家所有城市的该类型,启用“保持原来建造体系”时才有需要。
   
  bool AI_isWillingToTalk(int /*PlayerTypes*/ ePlayer)
玩家是否可以和某个玩家交淡
   
  void AI_chooseChangeTrait()
未有用
   
  int getUnitsLastIndex()
取得玩家单位槽的最尾是多少
   
  bool AI_isPlotThreatened(CyPlot* pPlot, int iRange, bool bTestMoves)
玩家判断某个地块是否危险
   

CyUnit()

   
  float getExperienceFloat()
取单位的浮点经验值
   
  int AFMcombatLimit(CyUnit* pDefender)
代替原版的combatLimit(),取得真正的伤害上限。
   
  int AFMairCombatLimit(CyUnit* pDefender)
代替原版的airCombatLimit(),取得真正的伤害上限。
   

CyAnyFunMod()

   
  const char* getModName(bool bFullPath) const
取得mod的路径,bool bFullPath是否用全路径或者相对路径,python就直接用str
   
   
  int afmIniReadValue(const char* cSection, const char* cKey, const int iValue) const
从AnyFunMod.cfg上读某个值,const int iValue是找不到时就返回的值
   
  void afmIniWriteValue(const char* cSection, const char* cKey, const int iValue)
向AnyFunMod.cfg写入某个值
   
  std::string getCivilizationIViniSTR(const char* cSection, const char* cKey, const char* strValue) const
从CivilizationIV.ini上读某个值,const char* strValue是找不到时就返回的值,python直接用str
   
  void setCivilizationIViniVALUE(const char* cSection, const char* cKey, const char* strValue)
向CivilizationIV.ini写入某个值
   
   
  std::string getPMI() const
取内存信息,返回值是一段string,python直接用str
   
  int getAFM_CITY_PLOTS_RADIUS() const
取城市工作范围
   
   
 

bool getAFMCheckBox(const char* cIniSection, const char* cIniOption)
从map内返回某个anyfun选项的值

   
  int getAFMDropdown(const char* cIniSection, const char* cIniOption)
从map内返回某个anyfun选项的值
   
  int getAFMEdit(const char* cIniSection, const char* cIniOption)
从map内返回某个anyfun选项的值
   
  int getNumAFMArray()
从map返回anyfun选项的总数
   
  bool updateAFMoption(const char* cIniSection, const char* cIniOption, int iValue)
更新map内某个anyfun选项的值
   
  bool StartHookMouse()
开始hook鼠标操作,返回是否成功
   
  bool isHookMouse()
当前是否正在hook鼠标操作
   
  bool StopHookMouse()
停止hook鼠标操作,返回是否成功
   
  std::wstring getAdminPassword() const
取当前管理密码,其实没什么用,因为是MD5值,debug时用,python直接用str
   
  void setAdminPassword(const char* szChar, bool bEncrypt)
设当前的管理密码
   
  bool DisabledSC_CLOSE()
使关闭按钮失效,返回是否成功
   
  bool EnabledSC_CLOSE()
使关闭按钮生效,返回是否成功
   
  int getSC_CLOSEstate()
取得关闭按钮的状态,1为生效,2为失效,0为其它状态并调用ResetIniSC_CLOSE()重置
   
  bool ResetIniSC_CLOSE()
根据AnyFunMod.cfg文件的设置,重置关闭按钮,返回是否成功
   
   
  还有一些其它的函数,不过玩家用不到的,就不写了。