[DOKU]variables, Classes, Methods and functions

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • [DOKU]variables, Classes, Methods and functions

      hey,
      this is a mod just for admins, in this 2moons trys to document itself.
      it is made for version 1.8, but if the examples are removed it schould run with other 2moonsversions also, sinc it does not use many 2moonsfunctions. exept the examples.
      the interface is for admins only, cause it provide lot information.
      the mod shows you the variables, functions, classes and methods available to write your mods.
      it show wich are always available and wich can be included.
      this gives you the possibility to overview methods and variables and look how to call them.
      it also let you search the functions. didn't made a searchfunction, cause the one of the browser is faster and good.
      in the corner bottom right is the history. with this one you can go back. it is for a function that let you click the functions in the code, wich is not implemented jet.
      the mod is very useful to get to know 2moons.
      for the new ones
      this tool is a bit advanced, but don't be scared and ask if you don't understand something.
      to enter the mod log in your game as admin and call page "yoursite/game.php?page=basemod"



      Files
      • basemod 1.8.zip

        (5.36 kB, downloaded 64 times, last: )
    • to make it easyer i added a second basemod, this one only shows, what methods you have, without including stuff, exept global $USER.
      its much less information and better orientation.
      Files
      • basemod 1.8.zip

        (15.9 kB, downloaded 49 times, last: )
    • now the mod is somehow finished. it can also be used for other software(neural version will be published on github as php-reflection-light)
      this version is for 2moons. it will run in 1.7 but the all=1 mode won't work there due to the different names of php files(missions)

      what can it do for you?
      1.you know wich files are called, chronological(the way of signal)
      Display Spoiler

      0 => '/game.php',
      1 => '/includes/pages/game/AbstractGamePage.class.php',
      2 => '/includes/pages/game/ShowErrorPage.class.php',
      3 => '/includes/common.php',
      4 => '/includes/constants.php',
      5 => '/includes/GeneralFunctions.php',
      6 => '/includes/classes/ArrayUtil.class.php',
      7 => '/includes/classes/Cache.class.php',
      8 => '/includes/classes/cache/builder/BuildCache.interface.php',
      9 => '/includes/classes/cache/resource/CacheFile.class.php',
      10 => '/includes/classes/Database.class.php',
      11 => '/includes/classes/Config.class.php',
      12 => '/includes/classes/class.FleetFunctions.php',
      13 => '/includes/classes/HTTP.class.php',
      14 => '/includes/classes/Language.class.php',
      15 => '/includes/classes/PlayerUtil.class.php',
      16 => '/includes/classes/Session.class.php',
      17 => '/includes/classes/Universe.class.php',
      18 => '/includes/classes/class.theme.php',
      19 => '/includes/classes/class.template.php',
      20 => '/includes/libs/Smarty/Smarty.class.php',
      21 => '/includes/libs/Smarty/Autoloader.php',
      22 => '/includes/libs/Smarty/sysplugins/smarty_internal_data.php',
      23 => '/includes/libs/Smarty/sysplugins/smarty_internal_extension_handler.php',
      24 => '/includes/libs/Smarty/sysplugins/smarty_internal_templatebase.php',
      25 => '/includes/libs/Smarty/sysplugins/smarty_internal_template.php',
      26 => '/includes/libs/Smarty/sysplugins/smarty_resource.php',
      27 => '/includes/libs/Smarty/sysplugins/smarty_variable.php',
      28 => '/includes/libs/Smarty/sysplugins/smarty_template_source.php',
      29 => '/includes/libs/Smarty/sysplugins/smarty_template_resource_base.php',
      30 => '/styles/theme/nui/style.cfg',
      31 => '/styles/theme/nui/settings.cfg',
      32 => '/includes/config.php',
      33 => '/includes/dbtables.php',
      34 => '/includes/vars.php',
      35 => '/includes/classes/class.BuildFunctions.php',
      36 => '/includes/classes/class.PlanetRessUpdate.php',
      37 => '/includes/FleetHandler.php',
      38 => '/language/de/L18N.php',
      39 => '/language/de/INGAME.php',
      40 => '/language/de/TECH.php',
      41 => '/language/de/CUSTOM.php',
      42 => '/includes/pages/game/ShowMymodPage.class.php',
      43 => '/includes/classes/Cronjob.class.php',
      44 => '/includes/libs/Smarty/sysplugins/smarty_internal_resource_extends.php',
      45 => '/includes/libs/Smarty/sysplugins/smarty_internal_resource_file.php',
      46 => '/includes/libs/Smarty/sysplugins/smarty_template_cached.php',
      47 => '/includes/libs/Smarty/sysplugins/smarty_cacheresource.php',
      48 => '/includes/libs/Smarty/sysplugins/smarty_internal_cacheresource_file.php',
      49 => '/cache/templates/denui^4dbc3137a9d211b3eaeef00.page.mymod.tpl.php',
      50 => '/includes/libs/Smarty/sysplugins/smarty_internal_runtime_foreach.php',
      51 => '/includes/libs/Smarty/sysplugins/smarty_internal_runtime_updatescope.php',
      52 => '/includes/libs/Smarty/sysplugins/smarty_template_compiled.php',
      53 => '/cache/denui^dcd72e27a1f0ad5ce0e78663781_1.file.main.footer.tpl.php',


      it let you browse the global variables in detail
      Display Spoiler

      $_GET
      $_POST
      $_COOKIE
      $_FILES
      $composerAutoloader
      $_SERVER
      $_REQUEST
      $THEME
      $sql
      $dbVersion
      $dbNeedsUpgrade
      $config
      $_SESSION
      $session
      $cache
      $reslist
      $ProdGrid
      $CombatCaps
      $resource
      $pricelist
      $requeriments
      $USER
      $token
      $db
      $fleetResult
      $LNG
      $universeAmount
      $PLANET
      $page
      $mode
      $pageClass
      $path
      $pageObj
      $pageProps


      it lists the defined varibles and it also shows the constants
      ...

      you can also see wich classes get loaded and wich functions and methods they have, and how you can user them
      Display Spoiler

      normaly declared 2moonsclasses - number shows that php loaded other classes before ;)
      [135]class.AbstractGamePage.php
      [136]class.ShowErrorPage.php
      [137]class.ArrayUtil.php
      [138]class.Cache.php
      [139]class.CacheFile.php
      [140]class.Database.php
      [141]class.Config.php
      [142]class.FleetFunctions.php
      [143]class.HTTP.php
      [144]class.Language.php
      [145]class.PlayerUtil.php
      [146]class.Session.php
      [147]class.Universe.php
      [148]class.Theme.php
      [149]class.Smarty_Autoloader.php
      [150]class.Smarty_Internal_Data.php
      [151]class.Smarty_Internal_Extension_Handler.php
      [152]class.Smarty_Internal_TemplateBase.php
      [153]class.Smarty_Internal_Template.php
      [154]class.Smarty_Resource.php
      [155]class.Smarty_Variable.php
      [156]class.Smarty_Template_Source.php
      [157]class.Smarty_Template_Resource_Base.php
      [158]class.Smarty.php
      [159]class.template.php
      [160]class.BuildFunctions.php
      [161]class.ResourceUpdate.php
      [162]class.ShowMymodPage.php
      [163]class.Cronjob.php
      [164]class.Smarty_Internal_Resource_Extends.php
      [165]class.Smarty_Internal_Resource_File.php
      [166]class.Smarty_Template_Cached.php
      [167]class.Smarty_CacheResource.php
      [168]class.Smarty_Internal_CacheResource_File.php
      [169]class.Smarty_Internal_Runtime_Foreach.php
      [170]class.Smarty_Internal_Runtime_UpdateScope.php
      [171]class.Smarty_Template_Compiled.php


      also in boxview to be more comfortable you can click the classes methods files and functions throu to also see there source.




      at the beginning, when you click on switch. you see the js window object and can browse it. its bit uncomfortable, didn't finished it jet, cause the browser reflects js very well.


      you can call the basemod from any file like this(just use one of the shown ways)

      PHP Source Code

      1. register_shutdown_function(// this makes the basemod started in the end
      2. function() {
      3. $pfade = str_replace('game.php', '',$_SERVER['SCRIPT_FILENAME']);
      4. require_once $pfade . 'includes/basemod.php';
      5. }
      6. );
      7. //following 2 lines would run the basemod imidiadly and show a snapshot of the envierement at this point of the process.
      8. $pfade = str_replace('game.php', '',$_SERVER['SCRIPT_FILENAME']); require_once $pfade . 'includes/basemod.php';


      since the last version was quiet experimental, this one is useful and comfortable.
      if you copied the files, call the site game.php?page=Mymod
      if loaded click on switch. to see the interface

      if you send the parameter all=1 you will see that a set of useful 2moonsfiles like the fleetfunctions and all pages are loaded.
      this gives you the option to browser there methods and classes to find if they are useful for you.

      game.php?page=Mymod&all=1

      if you can understand this, it is the 'ultimate' 2moons mod-building-tool :)
      the mymodfile can also be used as base of an own mod, what was the inicial idea. inside the mymodfile, the structur is explained in comments.


      ps: also very interesting, it shows the declared smartyvariables in backtrace ;) this is very helpful for templateworks
      Files