Exemplo n.º 1
0
    def apply(self):
        for name in self.context_data.parsed:
            data = self.parse_file(name)
            self.context_data.side_data[name] = data

            # Init parsed data objects
            kwargs = dict()
            if data.client is not None:
                kwargs['client'] = [FunctionData(None, None, name)]

            if data.server is not None:
                kwargs['server'] = [FunctionData(None, None, name)]

            self.context_data.parsed[name] = CompoundFunctionData(**kwargs)

        print('Functions parse complete\u001b[0m')
 FunctionData(
     signature=FunctionSignature(
         name='createWeapon',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['weapon'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='theType',
                     argument_type=FunctionType(
                         names=['string'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='x',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='y',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='z',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'Creates a Element/Weapon|custom weapon that can fire bullets. Do not confuse this with player held weapons.',
         arguments={
             "theType": """The weapon type which can be: """,
             "x": """The x position to create the weapon. """,
             "y": """The y position to create the weapon. """,
             "z": """The z position to create the weapon. """
         },
         result=
         'returns a element/weapon|custom weapon element, which represents a weapon floating at that position.',
     ),
     url='createWeapon',
 )
def function_generator_fixture() -> TypeScriptFunctionGenerator:
    data = FunctionData(
        signature=FunctionSignature(
            name='getZoneName',
            return_types=FunctionReturnTypes(
                return_types=[
                    FunctionType(
                        names=['string', 'mixed'],
                        is_optional=True,
                    ),
                    FunctionType(
                        names=['int'],
                        is_optional=False,
                    ),
                ],
                variable_length=True,
            ),
            arguments=FunctionArgumentValues(
                arguments=[[
                    FunctionArgument(
                        name='x',
                        argument_type=FunctionType(
                            names=['float'],
                            is_optional=False,
                        ),
                        default_value=None,
                    )
                ],
                           [
                               FunctionArgument(
                                   name='y',
                                   argument_type=FunctionType(
                                       names=['float'],
                                       is_optional=False,
                                   ),
                                   default_value=None,
                               )
                           ],
                           [
                               FunctionArgument(
                                   name='z',
                                   argument_type=FunctionType(
                                       names=['float'],
                                       is_optional=False,
                                   ),
                                   default_value=None,
                               ),
                               FunctionArgument(
                                   name='z_1',
                                   argument_type=FunctionType(
                                       names=['string'],
                                       is_optional=False,
                                   ),
                                   default_value=None,
                               ),
                           ],
                           [
                               FunctionArgument(
                                   name='citiesonly',
                                   argument_type=FunctionType(
                                       names=['bool'],
                                       is_optional=True,
                                   ),
                                   default_value='false',
                               )
                           ]],
                variable_length=True,
            ),
        ),
        url='getZoneName',
        docs=FunctionDoc(
            description="This function allows you to retrieve "
            "the zone name of a certain location. ",
            arguments={
                "x":
                """The X axis position """,
                "y":
                """The Y axis position """,
                "z":
                """The Z axis position """,
                "citiesonly": (": An optional argument to choose if you want "
                               "to return one of the following city names:\n"
                               "** Tierra Robada\n"
                               "** Bone County\n"
                               "** Las Venturas\n"
                               "** San Fierro\n"
                               "** Red County\n"
                               "** Whetstone\n"
                               "** Flint County\n"
                               "** Los Santos ")
            },
            result="""returns the string of the zone name """,
        ),
    )
    url = PageUrl(
        url="/wiki/GetZoneName",
        name="getZoneName",
        category="World functions",
        type=ListType.SERVER,
    )

    return TypeScriptFunctionGenerator(data=data,
                                       url=url,
                                       host_name='https://example.com')
Exemplo n.º 4
0
 FunctionData(
     signature=FunctionSignature(
         name='createExplosion',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['bool'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='x',
                     argument_type=FunctionType(
                         names=['float'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='y',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='z',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='theType',
                                argument_type=FunctionType(
                                    names=['int'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='creator',
                                argument_type=FunctionType(
                                    names=['player'],
                                    is_optional=True,
                                ),
                                default_value='nil',
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'Creates an explosion of a certain type at a specified point in the world. If creator is specified, the explosion will occur only in its dimension.',
         arguments={
             "x":
             """a float value that specifies the X world coordinate where the explosion is created at. """,
             "y":
             """a float value that specifies the Y world coordinate where the explosion is created at. """,
             "z":
             """a float value that specifies the Z world coordinate where the explosion is created at. """,
             "theType":
             """an integer specifying the explosion type. Valid types are: """,
             "creator":
             """the explosions simulated creator, the player responsible for it. """
         },
         result='',
     ),
     url='createExplosion',
 )
Exemplo n.º 5
0
 FunctionData(
     signature=FunctionSignature(
         name='addAccount',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['account'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='name',
                     argument_type=FunctionType(
                         names=['string'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='pass',
                                argument_type=FunctionType(
                                    names=['string'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='allowCaseVariations',
                                argument_type=FunctionType(
                                    names=['bool'],
                                    is_optional=True,
                                ),
                                default_value='false',
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function adds an account to the list of registered accounts of the current server.',
         arguments={
             "name":
             """The name of the account you wish to make, this normally is the players name. """,
             "pass":
             """The password to set for this account for future logins. """,
             "allowCaseVariations":
             """Whether the username is case sensitive (if this is set to true, usernames Bob and bob will refer to different accounts) """
         },
         result=
         'returns an account or false if the account already exists or an error occured.',
     ),
     url='addAccount',
 )
     FunctionData(
     signature=FunctionSignature(
         name='getBodyPartName',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['string'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='bodyPartID',
                         argument_type=FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function is used to get the name of a body part on a player.' ,
         arguments={
             "bodyPartID": """: An integer representing the body part ID you wish to retrieve the name of. """
         },
         result='this function returns a string containing the body part name if the id is valid, false otherwise.' ,
     ),
     url='getBodyPartName',
 )
                method=FunctionData(
            signature=FunctionSignature(
                name='exec',
                return_types=FunctionReturnTypes(
                    return_types=[
                        FunctionType(
                                    names=['bool'],
                                    is_optional=False,
                                )
                    ],
                    variable_length=False,
                ),
                arguments=FunctionArgumentValues(
                    arguments=[
                        [
                            FunctionArgument(
                                name='databaseConnection',
                                argument_type=FunctionType(
                                    names=['element'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='query',
                                argument_type=FunctionType(
                                    names=['string'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='param1',
                                argument_type=FunctionType(
                                    names=['var'],
                                    is_optional=True,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='param2',
                                argument_type=FunctionType(
                                    names=['var'],
                                    is_optional=True,
                                ),
                                default_value=None,
                            )
                        ]
                    ],
                    variable_length=True,
                ),
                generic_types=[
                    
                ],
            ),
            docs=FunctionDoc(
                description='This function executes a database query using the supplied connection. No result is returned.' ,
                arguments={
                    "databaseConnection": """A database connection element previously returned from dbConnect """,
                    "query": """An SQL query. Positions where parameter values will be inserted are marked with a ? """,
                    "paramX": """A variable number of parameters. These must be strings or numbers - it is important to make sure they are of the correct type. Also, the number of parameters passed must be equal to the number of ? characters in the query string.
String parameters are automatically quoted and escaped as required. (If you do not want a string quoted, use '''??''') Make sure that numbers are in number format as a string number is treated differently. """
                },
                result='returns true unless the connection is incorrect, in which case it returns false.' ,
            ),
            url='dbExec',
        ),
Exemplo n.º 8
0
 method=FunctionData(
     signature=FunctionSignature(
         name='getCounter',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='projectile',
                     argument_type=FunctionType(
                         names=['projectile'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'Get the time left before a projectile detonates.',
         arguments={
             "projectile":
             """: the projectile to get the timer of. """
         },
         result=
         'returns the the time in milliseconds to detonation which depending on the projectile type will do different things:\n* grenades will explode when it hits 0\n* teargas may be a duration timer\n* both types of rockets will explode when it hits 0\n* satchels restarts so i do not think it does anything',
     ),
     url='getProjectileCounter',
 ),
 CompoundFunctionData(
     server=[
         FunctionData(
             signature=FunctionSignature(
                 name='getGameType',
                 return_types=FunctionReturnTypes(
                     return_types=[
                         FunctionType(
                             names=['string'],
                             is_optional=False,
                         )
                     ],
                     variable_length=False,
                 ),
                 arguments=FunctionArgumentValues(
                     arguments=[],
                     variable_length=False,
                 ),
                 generic_types=[],
             ),
             docs=FunctionDoc(
                 description=
                 'This function retrieves the current gametype as set by setGameType. The game type is displayed in the server browser next to the servers name.',
                 arguments={},
                 result=
                 'returns the gametype as a string. if no gametype is set it returns nil.',
             ),
             url='getGameType',
         )
     ],
     client=[],
Exemplo n.º 10
0
     FunctionData(
     signature=FunctionSignature(
         name='getLoadedModules',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['table'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function returns all the currently loaded modules of the server.' ,
         arguments={
             
         },
         result='returns a table of all the currently loaded modules. if no modules are loaded, the table will be empty.' ,
     ),
     url='getLoadedModules',
 )
Exemplo n.º 11
0
     FunctionData(
     signature=FunctionSignature(
         name='aclCreate',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['acl'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='aclName',
                         argument_type=FunctionType(
                             names=['string'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function creates an ACL entry in the Access Control List system with the specified name.' ,
         arguments={
             "aclName": """The name of the ACL entry to add. """
         },
         result='returns the created acl object if successful. returns false if an acl of the given name could not be created.' ,
     ),
     url='aclCreate',
 )
Exemplo n.º 12
0
 FunctionData(
     signature=FunctionSignature(
         name='createLight',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['light'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='lightType',
                     argument_type=FunctionType(
                         names=['int'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='posX',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='posY',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='posZ',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='radius',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=True,
                                ),
                                default_value='3',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='r',
                                argument_type=FunctionType(
                                    names=['int'],
                                    is_optional=True,
                                ),
                                default_value='255',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='g',
                                argument_type=FunctionType(
                                    names=['int'],
                                    is_optional=True,
                                ),
                                default_value='0',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='b',
                                argument_type=FunctionType(
                                    names=['int'],
                                    is_optional=True,
                                ),
                                default_value='0',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='dirX',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=True,
                                ),
                                default_value='0',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='dirY',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=True,
                                ),
                                default_value='0',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='dirZ',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=True,
                                ),
                                default_value='0',
                            )
                        ],
                        [
                            FunctionArgument(
                                name='createsShadow',
                                argument_type=FunctionType(
                                    names=['bool'],
                                    is_optional=True,
                                ),
                                default_value='false',
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         '* The direction of the light only has any effect if the light type is spot light.\n* One light will only apply illumination effects to Element/Ped|peds, Element/Player|players, wheels and number plates (like a emergency vehicle siren light does).\n* Two or more lights will apply illumination effects to everything (excluding objects) that is in range of, at least, two of them.',
         arguments={
             "lightType":
             """An integer representing the type of light to create. """,
             "posX":
             """A floating point number representing the X coordinate on the map. """,
             "posY":
             """A floating point number representing the Y coordinate on the map. """,
             "posZ":
             """A floating point number representing the Z coordinate on the map. """,
             "radius":
             """A floating point number representing the radius of the light. """,
             "r":
             """An integer number representing the amount of red to use in the colouring of the light (0 - 255). """,
             "g":
             """An integer number representing the amount of green to use in the colouring of the light (0 - 255). """,
             "b":
             """An integer number representing the amount of blue to use in the colouring of the light (0 - 255). """,
             "dirX":
             """A floating point number representing the light directions X coordinate on the map. """,
             "dirY":
             """A floating point number representing the light directions Y coordinate on the map. """,
             "dirZ":
             """A floating point number representing the light directions Z coordinate on the map. """,
             "createsShadow":
             """A boolean representing whether or not does the light cast shadows. """
         },
         result=
         'returns the element/light|light element if creation was successful, false otherwise.',
     ),
     url='createLight',
 )
 method=FunctionData(
     signature=FunctionSignature(
         name='triggerEvent',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['bool'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='sendTo',
                     argument_type=FunctionType(
                         names=['table', 'element'],
                         is_optional=True,
                     ),
                     default_value='getRootElement()',
                 )
             ],
                        [
                            FunctionArgument(
                                name='name',
                                argument_type=FunctionType(
                                    names=['string'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='sourceElement',
                                argument_type=FunctionType(
                                    names=['element'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='arguments',
                                argument_type=None,
                                default_value=None,
                            )
                        ]],
             variable_length=True,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function triggers an event previously registered on a client. This is the primary means of passing information between the server and the client. Clients have a similar triggerServerEvent function that can do the reverse. You can treat this function as if it was an asynchronous function call, using triggerServerEvent to pass back any returned information if necessary.\nAlmost any data types can be passed as expected, including elements and complex nested tables. Non-element MTA data types like xmlNodes or resource pointers will not be able to be passed as they do not necessarily have a valid representation on the client.\nEvents are sent reliably, so clients will receive them, but there may be (but shouldnt be) a significant delay before they are received. You should take this into account when using them.\nKeep in mind the bandwidth issues when using events - dont pass a large list of arguments unless you really need to. It is marginally more efficient to pass one large event than two smaller ones.',
         arguments={
             "name":
             """The name of the event to trigger client side. You should register this event with addEvent and add at least one event handler using addEventHandler. """,
             "sourceElement":
             """The element that is the Event system#Event handlers|source of the event. """,
             "sendTo":
             """The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements. """,
             "arguments...":
             """A list of arguments to trigger with the event. You can pass any lua data type (except functions). You can also pass elements. """
         },
         result=
         'returns true if the event trigger has been sent, false if invalid arguments were specified.',
     ),
     url='triggerClientEvent',
 ),
Exemplo n.º 14
0
         method=FunctionData(
     signature=FunctionSignature(
         name='getColor',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function returns the water color of the GTA world.\nNote: The server can only return the water color, if it has actually been set by script.' ,
         arguments={
             
         },
         result='returns 4 int|ints, indicating the color of the water. (rgba)' ,
     ),
     url='getWaterColor',
 ),
     FunctionData(
     signature=FunctionSignature(
         name='getMaxPlayers',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['int'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function returns the maximum number of player slots on the server.' ,
         arguments={
             
         },
         result='returns the maximum number of players allowed on the server.' ,
     ),
     url='getMaxPlayers',
 )
Exemplo n.º 16
0
            FunctionData(
                signature=FunctionSignature(
                    name='getOriginalWeaponProperty',
                    return_types=FunctionReturnTypes(
                        return_types=[
                            FunctionType(
                                names=['int'],
                                is_optional=False,
                            )
                        ],
                        variable_length=False,
                    ),
                    arguments=FunctionArgumentValues(
                        arguments=[[
                            FunctionArgument(
                                name='weaponID',
                                argument_type=FunctionType(
                                    names=['int'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            ),
                            FunctionArgument(
                                name='weaponName',
                                argument_type=FunctionType(
                                    names=['string'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                                   [
                                       FunctionArgument(
                                           name='weaponSkill',
                                           argument_type=FunctionType(
                                               names=['string'],
                                               is_optional=False,
                                           ),
                                           default_value=None,
                                       )
                                   ],
                                   [
                                       FunctionArgument(
                                           name='property',
                                           argument_type=FunctionType(
                                               names=['string'],
                                               is_optional=False,
                                           ),
                                           default_value=None,
                                       )
                                   ]],
                        variable_length=False,
                    ),
                    generic_types=[],
                ),
                docs=FunctionDoc(
                    description=
                    'This function gets the original weapon property of the specified weapons specified weapon type.',
                    arguments={
                        "weaponID or weaponName":
                        """The ID or name of the weapon you want to get info of. Names can be: """,
                        "weaponSkill":
                        """Either: pro, std or poor """,
                        "property":
                        """The property you want to get the value of:
The following properties are get only: """
                    },
                    result=
                    'on success:\nint: the weapon property\non failure:\nbool: false if the passed arguments were invalid',
                ),
                url='getOriginalWeaponProperty',
            )
         method=FunctionData(
     signature=FunctionSignature(
         name='getEndPosition',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['float'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['float'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['float'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='theSearchLight',
                         argument_type=FunctionType(
                             names=['searchlight'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function gets the end position of a Element/Searchlight|searchlight element.' ,
         arguments={
             "theSearchLight": """: the searchlight to get the position where the searchlights light cone ends. """
         },
         result='if the specified searchlight element is valid, this function will return three float, which are the three coordinates of searchlights end position. if not, it will return false plus an error message.' ,
     ),
     url='getSearchLightEndPosition',
 ),
    def resolve_multiple_signatures(data_list: List[FunctionData],
                                    index_in_list: int) -> bool:
        """
        Example: export function fun(a?: int, b: int): int;
        Will be splitted into
        export function fun(a: int, b: int): int; // and
        export function fun(b: int): int;
        :return: Should index be saved (not incremented)
        """
        index_should_be_increased = True

        data = data_list[index_in_list]
        signature = data.signature

        first_optional_index = -1
        for index, argument_list in enumerate(signature.arguments.arguments):
            is_optional = len([
                argument
                for argument in argument_list
                if
                argument.argument_type and argument.argument_type.is_optional
            ]) != 0

            if len([argument
                    for argument in argument_list
                    if not argument.argument_type]) != 0:
                is_optional = True

            if is_optional:
                if first_optional_index == -1:
                    first_optional_index = index

                continue

            if not is_optional:
                if first_optional_index == -1:
                    continue

                # There were optional arguments.
                #   And the current is a required argument
                index_should_be_increased = False
                new_signature = deepcopy(signature)

                # Remove (index - first_optional_index - 1)
                #   arguments from the new signature
                for _ in range(first_optional_index, index):
                    new_signature.arguments.arguments.pop(first_optional_index)

                # Make arguments required in the origin signature
                for i in range(first_optional_index, index):
                    for arg in signature.arguments.arguments[i]:
                        if not arg.argument_type:
                            continue

                        arg.argument_type.is_optional = False

                # Save the new signature
                data_list.append(
                    FunctionData(
                        signature=new_signature,
                        docs=FunctionDoc(description='',
                                         arguments=dict(),
                                         result='', ),
                        url=data.url,
                    ),
                )
                first_optional_index = -1

        return index_should_be_increased
         method=FunctionData(
     signature=FunctionSignature(
         name='applyToWorldTexture',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['bool'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='shader',
                         argument_type=FunctionType(
                             names=['element'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ],
                 [
                     FunctionArgument(
                         name='textureName',
                         argument_type=FunctionType(
                             names=['string'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ],
                 [
                     FunctionArgument(
                         name='targetElement',
                         argument_type=FunctionType(
                             names=['element'],
                             is_optional=True,
                         ),
                         default_value='nil',
                     )
                 ],
                 [
                     FunctionArgument(
                         name='appendLayers',
                         argument_type=FunctionType(
                             names=['bool'],
                             is_optional=True,
                         ),
                         default_value='true',
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function applies a shader to one or more world textures.\n* The resource Shader_examples#Texture_names|shader_tex_names can help in finding the names of world textures.\n* When replacing the texture for a ped using the CJ skin, set textureName to CJ\n* The shader inherits the render states of the original when it is drawn, so texture stage 0 will already be set to the original texture.\n* When using with a ped, ensure you have set ped or all in the elementTypes when calling dxCreateShader\n* CJ body parts textures can be replaced by using: cj_ped_head, cj_ped_hat, cj_ped_torso, cj_ped_legs, cj_ped_feet, cj_ped_glasses, cj_ped_necklace, cj_ped_watch and cj_ped_extra1. Latest version of http://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names shader_tex_names will show what is being used.' ,
         arguments={
             "shader": """The shader which is to be applied """,
             "textureName": """The name of the world texture to apply the shader to. Wildcard matching e.g. ro?ds* can be used to apply to more than one texture at a time. """,
             "targetElement": """The element to restrict applying the shader to. If this is not set the shader will be applied to everything using the texture name. Valid element types for targetElement are vehicle|vehicles, Object|objects and Ped|peds. """,
             "appendLayers": """allows two or more layered shaders to be applied in the same texture. You may want to modify the DepthBias in the technique pass to avoid Z-fighting artifacts when using this. """
         },
         result='returns true if the shader was successfully applied, false otherwise.' ,
     ),
     url='engineApplyShaderToWorldTexture',
 ),
Exemplo n.º 20
0
 FunctionData(
     signature=FunctionSignature(
         name='get',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['var'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='settingName',
                     argument_type=FunctionType(
                         names=['string'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function gets a settings value, or a group of settings values, from the settings system|settings registry.',
         arguments={},
         result=
         'returns the value of the setting if a single setting was specified and found, or a table (in associative-array form) containing:\n*the list of global setting name/value pairs if . is passed as a setting name,\n*the list of resource settings if a resource name followed by a . is passed,\n*the list of the scripts resource settings if an empty string is passed.\nit returns false if the specified setting or settings group doesnt exist, or if the settings group you are trying to retrieve doesnt have any public or protected settings.',
     ),
     url='get',
 )
Exemplo n.º 21
0
 FunctionData(
     signature=FunctionSignature(
         name='createFire',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['bool'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='x',
                     argument_type=FunctionType(
                         names=['float'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='y',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='z',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ],
                        [
                            FunctionArgument(
                                name='size',
                                argument_type=FunctionType(
                                    names=['float'],
                                    is_optional=True,
                                ),
                                default_value='1.8',
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'Creates a patch of fire that will spread a bit and die out after a while. Because its a client side only function, other players wont see it, so custom events or custom objects will be needed to make a fire visible to some players.',
         arguments={
             "x, y, z":
             """the coordinates when the initial patch of fire will be created. """,
             "size":
             """a float value indicating the size of the initial patch of fire, this value also affects the duration of how long the fire remains. """
         },
         result=
         'returns true if successful, false if bad arguments were passed or the limit of active fires was reached. there can be a maximum of 60 active fires.',
     ),
     url='createFire',
 )
Exemplo n.º 22
0
dx_create_texture_function: FunctionData = FunctionData(
    url='dxCreateTexture',
    docs=FunctionDoc(
        description='This function creates a texture '
        'element that can be used in the dxDraw functions',
        arguments={},
        result='Returns a texture if successful, '
        'false if invalid arguments were passed to the function.'),
    signature=FunctionSignature(
        name='dxCreateTexture',
        return_types=FunctionReturnTypes(
            return_types=[
                FunctionType(is_optional=False, names=['DxTexture'])
            ],
            variable_length=False,
        ),
        arguments=FunctionArgumentValues(
            arguments=[
                [
                    FunctionArgument(
                        name='width',
                        argument_type=FunctionType(is_optional=False,
                                                   names=['number']),
                        default_value=None,
                    )
                ],
                [
                    FunctionArgument(
                        name='height',
                        argument_type=FunctionType(is_optional=False,
                                                   names=['number']),
                        default_value=None,
                    )
                ],
                [
                    FunctionArgument(
                        name='textureFormat',
                        argument_type=FunctionType(is_optional=True,
                                                   names=['string']),
                        default_value='"argb',
                    )
                ],
                [
                    FunctionArgument(
                        name='textureEdge',
                        argument_type=FunctionType(is_optional=True,
                                                   names=['string']),
                        default_value='"wrap',
                    )
                ],
                [
                    FunctionArgument(
                        name='textureType',
                        argument_type=FunctionType(is_optional=True,
                                                   names=['string']),
                        default_value='"2d',
                    )
                ],
                [
                    FunctionArgument(
                        name='depth',
                        argument_type=FunctionType(is_optional=True,
                                                   names=['number']),
                        default_value='1',
                    )
                ],
            ],
            variable_length=False,
        ),
    ))
 method=FunctionData(
     signature=FunctionSignature(
         name='countPlayers',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='theTeam',
                     argument_type=FunctionType(
                         names=['team'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function is for returning the number of players in the specified team.',
         arguments={
             "theTeam":
             """The team you wish to retrieve the player count of. """
         },
         result=
         'returns an integer containing the number of players in the team, false if it could not be retrieved.',
     ),
     url='countPlayersInTeam',
 ),
 method=FunctionData(
     signature=FunctionSignature(
         name='getDetails',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 ),
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 ),
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='theTimer',
                     argument_type=FunctionType(
                         names=['timer'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function is for getting the details of a running timer.',
         arguments={"theTimer": """A timer element. """},
         result=
         '* integer one represents the time left in miliseconds (1000th of a second) of the current time left in the loop.\n* integer two represents the amount of times the timer has left to execute.\n* integer three represents the time interval of timer.\n* returns false if the timer doesnt exist or stopped running. also, debugscript will say bad argument @ gettimerdetails. to prevent this, you can check if the timer exists with istimer().',
     ),
     url='getTimerDetails',
 ),
     FunctionData(
     signature=FunctionSignature(
         name='clearChatBox',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['bool'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='clearFor',
                         argument_type=FunctionType(
                             names=['element'],
                             is_optional=True,
                         ),
                         default_value='getRootElement()',
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='' ,
         arguments={
             "clearFor": """The player whose chat is to be cleared. By default, this is set to the root element, which will affect all players. """
         },
         result='returns true if the players chat was cleared successfully, false otherwise.' ,
     ),
     url='clearChatBox',
 )
Exemplo n.º 26
0
 method=FunctionData(
     signature=FunctionSignature(
         name='getColor',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 ),
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 ),
                 FunctionType(
                     names=['int'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='theLight',
                     argument_type=FunctionType(
                         names=['light'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function returns the color for a Element/Light|light element.',
         arguments={
             "theLight":
             """The Element/Light|light that you wish to retrieve the color of. """
         },
         result=
         'returns three ints corresponding to the amount of red, green and blue (respectively) of the light, false if invalid arguments were passed.',
     ),
     url='getLightColor',
 ),
            FunctionData(
                signature=FunctionSignature(
                    name='addBan',
                    return_types=FunctionReturnTypes(
                        return_types=[
                            FunctionType(
                                names=['ban'],
                                is_optional=False,
                            )
                        ],
                        variable_length=False,
                    ),
                    arguments=FunctionArgumentValues(
                        arguments=[[
                            FunctionArgument(
                                name='IP',
                                argument_type=FunctionType(
                                    names=['string'],
                                    is_optional=True,
                                ),
                                default_value=None,
                            )
                        ],
                                   [
                                       FunctionArgument(
                                           name='Username',
                                           argument_type=FunctionType(
                                               names=['string'],
                                               is_optional=True,
                                           ),
                                           default_value=None,
                                       )
                                   ],
                                   [
                                       FunctionArgument(
                                           name='Serial',
                                           argument_type=FunctionType(
                                               names=['string'],
                                               is_optional=True,
                                           ),
                                           default_value=None,
                                       )
                                   ],
                                   [
                                       FunctionArgument(
                                           name='responsibleElement',
                                           argument_type=FunctionType(
                                               names=['player'],
                                               is_optional=True,
                                           ),
                                           default_value=None,
                                       )
                                   ],
                                   [
                                       FunctionArgument(
                                           name='reason',
                                           argument_type=FunctionType(
                                               names=['string'],
                                               is_optional=True,
                                           ),
                                           default_value=None,
                                       )
                                   ],
                                   [
                                       FunctionArgument(
                                           name='seconds',
                                           argument_type=FunctionType(
                                               names=['int'],
                                               is_optional=True,
                                           ),
                                           default_value='0',
                                       )
                                   ]],
                        variable_length=False,
                    ),
                    generic_types=[],
                ),
                docs=FunctionDoc(
                    description=
                    'This function will add a ban for the specified IP/username/serial to the server.',
                    arguments={
                        "IP":
                        """The IP to be banned. If you dont want to ban by IP, set this to nil.
'''or''' """,
                        "Username":
                        """The http://community.mtasa.com/ MTA Community username to be banned (now obsolete). If you dont want to ban by username, set this to nil.
'''or''' """,
                        "Serial":
                        """The serial to be banned. If you dont want to ban by serial, set this to nil.
''' or any combination.''' """,
                        "responsibleElement":
                        """The element that is responsible for banning the IP/username/serial. This can be a player or the root (getRootElement()). """,
                        "reason":
                        """The reason the IP/username/serial will be banned from the server. """,
                        "seconds":
                        """The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time. """
                    },
                    result=
                    'returns the new ban if the ip/username/serial was banned successfully, false if invalid arguments are specified.',
                ),
                url='addBan',
            )
                method=FunctionData(
                    signature=FunctionSignature(
                        name='getProperty',
                        return_types=FunctionReturnTypes(
                            return_types=[
                                FunctionType(
                                    names=['int'],
                                    is_optional=False,
                                )
                            ],
                            variable_length=False,
                        ),
                        arguments=FunctionArgumentValues(
                            arguments=[[
                                FunctionArgument(
                                    name='weaponID',
                                    argument_type=FunctionType(
                                        names=['int'],
                                        is_optional=False,
                                    ),
                                    default_value=None,
                                ),
                                FunctionArgument(
                                    name='weaponName',
                                    argument_type=FunctionType(
                                        names=['string'],
                                        is_optional=False,
                                    ),
                                    default_value=None,
                                )
                            ],
                                       [
                                           FunctionArgument(
                                               name='weaponSkill',
                                               argument_type=FunctionType(
                                                   names=['string'],
                                                   is_optional=False,
                                               ),
                                               default_value=None,
                                           )
                                       ],
                                       [
                                           FunctionArgument(
                                               name='property',
                                               argument_type=FunctionType(
                                                   names=['string'],
                                                   is_optional=False,
                                               ),
                                               default_value=None,
                                           )
                                       ]],
                            variable_length=False,
                        ),
                        generic_types=[],
                    ),
                    docs=FunctionDoc(
                        description=
                        'This function gets a weapon property of the specified Element/Weapon|custom weapon (clientside only) or specified Weapons|player-held weapon (both client and server).',
                        arguments={
                            "weaponID or weaponName":
                            """The ID or name of the weapon you want to get info of. Names can be: """,
                            "weaponSkill":
                            """Either: pro, std or poor """,
                            "property":
                            """The property you want to get the value of:
The following properties are get only: """
                        },
                        result=
                        'on success:\nint: the weapon property\non failure:\nbool: false if the passed arguments were invalid',
                    ),
                    url='getWeaponProperty',
                ),
 FunctionData(
     signature=FunctionSignature(
         name='loadMapData',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                     names=['element'],
                     is_optional=False,
                 )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[[
                 FunctionArgument(
                     name='node',
                     argument_type=FunctionType(
                         names=['xmlnode'],
                         is_optional=False,
                     ),
                     default_value=None,
                 )
             ],
                        [
                            FunctionArgument(
                                name='parent',
                                argument_type=FunctionType(
                                    names=['element'],
                                    is_optional=False,
                                ),
                                default_value=None,
                            )
                        ]],
             variable_length=False,
         ),
         generic_types=[],
     ),
     docs=FunctionDoc(
         description=
         'This function is intended to load data from a loaded XML file into the element tree. This could be used for loading an external map, or part of another map.',
         arguments={
             "node":
             """The node that you wish to load into the element tree. """,
             "parent":
             """The node you wish to be the parent of the new map data. """
         },
         result=
         'returns an element object that corresponds to the root of the new data added, i.e. an element that represents the node xmlnode passed to the function. returns false if the arguments are invalid.',
     ),
     url='loadMapData',
 )
         method=FunctionData(
     signature=FunctionSignature(
         name='getColor',
         return_types=FunctionReturnTypes(
             return_types=[
                 FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         ),
             FunctionType(
                             names=['int'],
                             is_optional=False,
                         )
             ],
             variable_length=False,
         ),
         arguments=FunctionArgumentValues(
             arguments=[
                 [
                     FunctionArgument(
                         name='theRadararea',
                         argument_type=FunctionType(
                             names=['radararea'],
                             is_optional=False,
                         ),
                         default_value=None,
                     )
                 ]
             ],
             variable_length=False,
         ),
         generic_types=[
             
         ],
     ),
     docs=FunctionDoc(
         description='This function can be used to retrieve the current color of a radararea|radar area.' ,
         arguments={
             "theRadararea": """The radararea|radar area you wish to retrieve the colour of. """
         },
         result='returns four integers in rgba format (red, green, blue, alpha), with a maximum value of 255 for each.  alpha decides transparency where 255 is opaque and 0 is transparent.  returns false if the radararea is invalid.' ,
     ),
     url='getRadarAreaColor',
 ),