Module eva

Custom Eva header setup Copy this file to your project, comment/uncomment required libraries and dynamic libraries and use it You can use eva.eva module to use all eva modules (all modules will be included in your build)

Access for module is eva[module_name]

Functions

init(settings_path, module_settings) Call this to init Eva module
update(dt) Call this on main update loop
get_logger(logger_name) Return logger from eva.log module

modules.ads Functions

eva.ads.is_ready(ad_id) Check is ads are ready to show now
eva.ads.is_blocked(ad_id) Check is ads are blocked with network or tokens for player
eva.ads.get_time_to_ready(ad_id, The) Return seconds when placement will be ready
eva.ads.show(ad_id, success_callback, finish_callback) Show ad by placement id
eva.ads.set_enabled(state) Set enabled ads state
eva.ads.is_enabled() Check ads is enabled
eva.ads.get_watched(Total) Get total ads watched
eva.ads.get_adapter_name() Return current ads adapter name

modules.callbacks Functions

eva.callbacks.create(callback) Wrap callback It return index for callback, You can call it now via eva.callbacks.call(index, ...)
eva.callbacks.call(index, ...) Call wrapped callback
eva.callbacks.clear(index) Clear callback

modules.camera Functions

eva.camera.set_camera(cam_id, camera_box) Set the camera game object and size of the camera
eva.camera.set_control(enabled) Enable or disable camera user control
eva.camera.set_borders(border_soft, border_hard) Set the borders of the camera zone
eva.camera.set_position(x, y) Set the camera position
eva.camera.get_position() Get the camera position
eva.camera.set_target_position(x, y, callback) Set target camera position
eva.camera.set_zoom_borders(zoom_soft, zoom_hard) Set the camera game object and size of the camera
eva.camera.set_zoom(zoom) Set the camera zoom
eva.camera.set_target_zoom(zoom) Set the camera target zoom
eva.camera.get_zoom() Get the camera zoom
eva.camera.update(dt) Eva camera update should be called manually Due the it uses context go.set_position

modules.daily Functions

eva.daily.is_active() Return is active now daily system
eva.daily.set_active() Set active daily system It will reset last pick time
eva.daily.pick() Pick current prize
eva.daily.get_time() Return time until you can pickup prize
eva.daily.get_wait_time() Return time until you can lose the unpicked reward
eva.daily.get_current_state() Return current state

modules.db Functions

eva.db.get(config_name) Return config by config_name
eva.db.set_settings(settings) Can override db with custom tables (useful for tests)

modules.device Functions

eva.device.get_device_id() Return device id.
eva.device.get_uuid(except) Generate uuid
eva.device.get_region() Return device region.
eva.device.get_device_info() Return device_info
eva.device.is_android() Check if device on android
eva.device.is_ios() Check if device on iOS
eva.device.is_mobile() Check if device is native mobile (Android or iOS)
eva.device.is_desktop() Check if device is desktop (Windows/MacOS)
eva.device.is_web() Check if device is HTML5
eva.device.is_web_mobile() Check if device is HTML5 mobile

modules.events Functions

eva.events.event(event[, params={}]) Throws the game event
eva.events.screen(screen_id) Setup current game screen
eva.events.subscribe(event_name, callback, callback_context) Subscribe the callback on event
eva.events.subscribe_map(map) Subscribe the pack of events by map
eva.events.unsubscribe(event_name, callback) Unsubscribe the event from events flow
eva.events.unsubscribe_map(map) Unsubscribe the pack of events by map
eva.events.is_subscribed(event_name, callback) Check if callback is already subscribed

modules.feature Functions

eva.feature.toggle(feature_name, state) Toggle manually feature
eva.feature.start() Start eva feature system.

modules.festivals Functions

eva.festivals.is_active(festival_id) Return is festival is active now
eva.festivals.is_completed(festival_id) Return is festival is completed Return true for repeated festivals, is they are completed now
eva.festivals.get_start_time(festival_id) Return next start time for festival_id
eva.festivals.get_end_time(festival_id) Return next end time for festival_id
eva.festivals.get_current() Return current festivals
eva.festivals.get_completed() Return completed festivals
eva.festivals.debug_start_festival(festival_id) Start festival without check any condition
eva.festivals.debug_end_festival(festival_id) End festival without check any condition
eva.festivals.set_settings() Set game festivals settings.

modules.game Functions

eva.game.open_store_page() Open store page in store application
eva.game.reboot(delay) Reboot the game
eva.game.exit(code) Exit from the game
eva.game.is_debug() Check game on debug mode
eva.game.get_time() Get game time
eva.game.get_session_uid() Return unique id for local session
eva.game.get_uid() Return unique id for player profile
eva.game.get_current_time_string() Get current time in string format
eva.game.get_current_date_code() Get current date in format: YYYYMMDD
eva.game.get_seconds_until_new_day() Get time in seconds until next day from current time
eva.game.get_days_played() Get days since first game launch
eva.game.is_first_launch() Return true, if game launched first time

modules.gdpr Functions

eva.gdpr.apply_gdpr() Apply the GDPR to the game profile
eva.gdpr.is_accepted() Return if GDPR is accepted
eva.gdpr.open_policy_url() Open the policy URL

modules.grid Functions

eva.grid.get_map_params() Get map params data to work with it You can pass directly params in every method or set is as default with eva.grid.set_default_map_params Pass the map sizes to calculate correct coordinates
eva.grid.set_default_map_params(map_params) Set default map params To don`t pass it every time in transform functions
eva.grid.cell_to_pos() Transform hex to pixel position
eva.grid.pos_to_cell() Transform pixel to hex
eva.grid.get_z(y, z_layer) Get Z position from object Y position and his z_layer
eva.grid.get_object_pos() Get object position Can pass the offset to calculate it correctly (+ z coordinate)
eva.grid.get_tiled_scene_pos() Convert tiled object position to scene position
eva.grid.get_tile_pos() Get tile position.

modules.hexgrid Functions

eva.hexgrid.get_map_params(tilewidth, tileheight, tileside, width, height, invert_y) Get map params data to work with it You can pass directly params in every method or set is as default with eva.hexgrid.set_default_map_params Pass the map sizes to calculate correct coordinates
eva.hexgrid.set_default_map_params(map_params) Set default map params To dont pass it every time in transform functions
eva.hexgrid.cell_to_pos(i, j, map_params) Transform hex to pixel position.
eva.hexgrid.pos_to_cell(x, y, map_params) Transform pixel to hex.
eva.hexgrid.cell_cube_to_pos(i, j, k[, map_params]) Transform hex to pixel position.
eva.hexgrid.pos_to_cell_cube(x, y, map_params) Transform pixel to hex.
eva.hexgrid.offset_to_cube(i, j[, map_params]) Transfrom offset coordinates to cube coordinates
eva.hexgrid.cube_to_offset(i, j, k[, map_params]) Transfrom cube coordinates to offset coordinates
eva.hexgrid.rotate_offset(i, j, k, N) Rotate offset coordinate by N * 60degree
eva.hexgrid.get_z(y, z_layer) Get Z position from object Y position and his z_layer
eva.hexgrid.get_object_pos() Get object position Can pass the offset to calculate it correctly (+ z coordinate)
eva.hexgrid.get_tiled_scene_pos() Convert tiled object position to scene position
eva.hexgrid.get_tile_pos() Get tile position.

modules.iaps Functions

eva.iaps.buy(iap_id) Buy the inapp
eva.iaps.get_reward(iap_id) Get reward from iap_id
eva.iaps.get_iap(iap_id) Get iap info by iap_id
eva.iaps.get_iaps(category) Get all iaps.
eva.iaps.is_available(iap_id) Check is iap is available
eva.iaps.get_price(iap_id) Get price from iap_id
eva.iaps.get_price_string(iap_id) Get price_string from iap_id
eva.iaps.refresh_iap_list() Refresh iap list.
eva.iaps.get_ltv() Get total lifetime value (from iaps)
eva.iaps.get_max_payment() Get player max payment

modules.input Functions

eva.input.register(name, callback, priority) Register the input to handle user actions If callback return true it will stop handle next input
eva.input.unregister(name) Unregister prev.
eva.input.set_enabled(name, is_enabled) Set enabled state for input

modules.invoices Functions

eva.invoices.add(category, reward[, time[, life_time[, title[, text]]]]) Add invoice to game profile If time is not provided, add invoice instantly If time is provided, add invoice in this time Invoice should be consumed to get reward
eva.invoices.get_invoices() Return current list of invoices
eva.invoices.get_invoce() Get invoice data by id
eva.invoices.can_consume() Check is invoice can be consumed
eva.invoices.consume(invoice_id) Consume the invoice to the game profile

modules.isogrid Functions

eva.isogrid.get_map_params() Get map params data to work with it You can pass directly params in every method or set is as default with eva.isogrid.set_default_map_params Pass the map sizes to calculate correct coordinates
eva.isogrid.set_default_map_params(map_params) Set default map params To don`t pass it every time in transform functions
eva.isogrid.cell_to_pos() Transform hex to pixel position
eva.isogrid.pos_to_cell() Transform pixel to hex
eva.isogrid.get_z(y, z_layer) Get Z position from object Y position and his z_layer
eva.isogrid.get_object_pos() Get object position Can pass the offset to calculate it correctly (+ z coordinate)
eva.isogrid.get_tiled_scene_pos() Convert tiled object position to scene position
eva.isogrid.get_tile_pos() Get tile position.

modules.labels Functions

eva.labels.is_exist(label) Check label is exist in player profile

modules.lang Functions

eva.lang.time_format() Return localized time format from seconds
eva.lang.set_lang(lang) Set current language
eva.lang.get_lang() Get current language
eva.lang.txt(lang_id) Get translation for locale id
eva.lang.txr(lang_id) Get random translation for locale id, split by \n symbol
eva.lang.txp(lang_id, ...) Get translation for locale id with params
eva.lang.is_exist(lang_id) Check is translation with lang_id exist
eva.lang.get_langs() Return list of available languages

modules.migrations Functions

eva.migrations.set_migrations() Add migration to the eva system Pass the migrations list in eva.init You should directly point the migration version in migration list (array from 1 to N)
eva.migrations.get_count() Return amount of migrations
eva.migrations.apply() Apply the migrations

modules.offers Functions

eva.offers.add(offer_id) Start new offer Every offer is unique.
eva.offers.remove(offer_id) Remove offers from active list
eva.offers.get_time(offer_id) Return time till offer end.
eva.offers.is_active(offer_id) Check is offer active not
eva.offers.get_reward(offer_id) Get token group of offer reward.
eva.offers.get_price(offer_id) Get token group of offer price.
eva.offers.is_iap(offer_id) Check is offer for inapp

modules.pathfinder Functions

eva.pathfinder.init_astar(map_data, get_node_fn, options) Init astar for map, init get_tile callback get_node_fn - function to get tile: function(i, j) should return cost of node.
eva.pathfinder.path(from_x, from_y, to_x, to_y[, map_handler]) Return path between two points for map.

modules.promocode Functions

eva.promocode.get_applied_codes() Get list of all redeemed codes
eva.promocode.is_applied(code) Check if promocode is already applied
eva.promocode.redeem_code(code) Try redeem the code and get rewards
eva.promocode.is_can_redeem(code) Check if promocode can be redeem
eva.promocode.set_settings() Set promocode settings.

modules.proto Functions

eva.proto.get(proto_type) Get empty template from proto type
eva.proto.encode() Encode protobuf
eva.proto.decode() Decode protobuf
eva.proto.verify(proto_type, data) Check data to match the proto_type Return data with default values according to proto_type

modules.push Functions

eva.push.clear_old_pushes() Clear all pushes, what already should be invoked.
eva.push.schedule() Schedule notification
eva.push.schedule_list() Schedule by list Every notifications have: after, title, text, category, payload
eva.push.unschedule() Unschedule the push notification
eva.push.unschedule_all(category) Cancel all pushes with category If category is not provided, cancel all pushes
eva.push.is_enabled() Get push enabled status
eva.push.set_enabled(is_enabled) Set push enabled status

modules.quests Functions

eva.quests.get_progress(quest_id) Get current progress on quest
eva.quests.get_current(category) Get current active quests
eva.quests.get_completed() Get completed quests list
eva.quests.is_current_with_task(action[, object]) Check if there is quests in current with pointer action and object
eva.quests.is_active() Check quest is active
eva.quests.is_completed() Check quest is completed
eva.quests.is_can_start_quest() Check quest is can be started now
eva.quests.start_quest(quest_id) Start quest, if it can be started
eva.quests.is_can_complete_quest() Check quest is can be completed now
eva.quests.complete_quest(quest_id) Complete quest, if it can be completed
eva.quests.force_complete_quest(quest_id) Force complete quest
eva.quests.reset_progress(quest_id) Reset quets progress, only on current quests
eva.quests.quest_event(action, object, amount) Apply quest event to all current quests
eva.quests.start_quests() Start eva quests system.
eva.quests.update_quests() Update quests list It will start and end quests, by checking quests condition
eva.quests.add_update_quest_event() Add event, to trigger quest list update.
eva.quests.set_settings() Set game quests settings.

modules.rate Functions

eva.rate.set_never_show() Set never promt rate again
eva.rate.set_accepted() Set rate as accepted.
eva.rate.promt_rate() Try to promt rate game to the player
eva.rate.open_rate() Open store or native rating if available

modules.rating Functions

eva.rating.elo(rating_a, rating_b, game_koef) Call elo rating

modules.render Functions

eva.render.set_blur() Change render
eva.render.set_light() Change render
eva.render.set_vignette() Change render

modules.saver Functions

eva.saver.load() Load the file from save directory
eva.saver.save() Save the game file in save directory
eva.saver.save_data(data, filename) Save the data in save directory
eva.saver.get_save_data() Return save table
eva.saver.delete([filename]) Delete the save
eva.saver.reset() Reset the game profile
eva.saver.add_save_part() Add save part to the save table
eva.saver.set_autosave_timer(seconds) Set autosave timer for game.
eva.saver.get_save_version() Return current save version.

modules.server Functions

eva.server.connect(callback) Login at nakama server
eva.server.is_connected() Return is currently server connected
eva.server.get_client() Return nakama client
eva.server.get_socket() Return nakama socket

modules.share Functions

eva.share.screen(text) Share screenshot of the game

modules.skill Functions

eva.skill.use() Use skill
eva.skill.end_use() End use of channeling spell or end effect of skill with duration
eva.skill.skil_cooldown_time() Skill cooldown
eva.skill.is_active() Time between use and end_use
eva.skill.get_active_time() Return skill active time (duration)
eva.skill.get_active_time_left() Return skill active left time (until end of duration)
eva.skill.get_active_progress() Return current skill progress time
eva.skill.is_on_cooldown() Return true if skill on the cooldown
eva.skill.get_cooldown_time() Return skill cooldown time
eva.skill.get_cooldown_time_left() Return skill cooldown time left
eva.skill.get_cooldown_progress() Get cooldown progress
eva.skill.get_stack_amount() Get current skill stack amount
eva.skill.add_stack() Add amount to skill stacks
eva.skill.is_full_stack() Return true if skill on full stack
eva.skill.is_empty_stack() Return true if skill is empty now
eva.skill.is_can_use() Return true if skill can be used now
eva.skill.restore_all() Restore all skills in containers

modules.sound Functions

eva.sound.play(sound_id[, gain=1[, speed=1]]) Play the sound in the game
eva.sound.play_random(sound_ids[, gain=1[, speed=1]]) Play the random sound from sound names array
eva.sound.stop(sound_id) Stop sound playing
eva.sound.play_music(music_id[, gain=1[, callback]]) Start playing music
eva.sound.stop_music() Stop any music in the game
eva.sound.fade(sound_id, to[, time=1[, callback]]) Fade sound from one gain to another
eva.sound.fade_music(to[, time=1], callback) Slowly fade music to another one or empty
eva.sound.stop_all() Stop all sounds in the game
eva.sound.set_music_gain() Set music gain
eva.sound.set_sound_gain() Set sound gain
eva.sound.get_music_gain() Get music gain
eva.sound.get_sound_gain() Get sound gain
eva.sound.is_music_enabled() Check music gain
eva.sound.is_sound_enabled() Check sound gain

modules.storage Functions

eva.storage.get(id) Get the value from the storage.
eva.storage.set(id, value) Set the value to eva storage

modules.tiled Functions

eva.tiled.load_map(data, create_object_fn) Load map from tiled json data
eva.tiled.add_tile(layer_name, tileset_name, mapping_id, i, j[, map_data]) Add tile to the map by tile index from tiled tileset
eva.tiled.get_tile(layer_name, i, j[, map_data]) Get tile from the map by tile pos
eva.tiled.delete_tile(layer, i, j[, map_data]) Delete tile from the map by tile pos
eva.tiled.add_object(layer_name, object_full_id, x, y[, scale=1[, rotation=0[, props[, map_data]]]]) Add object to the map by object index from tiled tileset
eva.tiled.get_object(game_object_id[, map_data]) Get object to the map by game_object id
eva.tiled.get_object_data(object_name) Get mapping object info by name
eva.tiled.get_object_data(object_name) Get mapping object info by mapping_id
eva.tiled.get_property(object_info, object_name, script_name, property_name) Get object property
eva.tiled.get_property_by_name(object_info, property_name) Get object property by name
eva.tiled.set_object_id(object_info, scene_id) Set unique id for the object
eva.tiled.set_scene_name(object_info, scene_name) Set scene name for the object
eva.tiled.set_enabled(object_info, is_enabled) Set object enabled state
eva.tiled.is_enabled(object_info) Return if object is enabled
eva.tiled.delete_object(game_object_id[, map_data]) Delete object from the map by game_object id

modules.timers Functions

eva.timers.add(slot_id, timer_id, time[, auto_trigger]) Add new timer Timer with slot_id should no exist
eva.timers.get() Get timer
eva.timers.get_time(slot_id) Get time until end, in seconds
eva.timers.is_end(slot_id) Check is timer has ended
eva.timers.clear(slot_id) Clear the timer slot
eva.timers.set_pause(slot_id, is_pause) Set timer pause state

modules.token Functions

eva.token.is_exist_container(container_id) Check if token container exist
eva.token.create_container(container_id, container_type) Create new token container
eva.token.delete_container(container_id) Delete token container
eva.token.clear_container(container_id) Clear all tokens from container
eva.token.get_tokens(tokens) Return evadata.Tokens tokens format.
eva.token.get_token_group(token_group_id) Return token group by id.
eva.token.get_lot_reward(lot_id) Return lot reward by lot_id.
eva.token.get_lot_price(lot_id) Return lot price by lot_id.
eva.token.add() Add tokens to save
eva.token.add_many() Add multiply tokens
eva.token.add_group() Add multiply tokens by token_group_id
eva.token.set() Set tokens to save
eva.token.get() Get current token amount from save
eva.token.get_many(container_id) Get all tokens from container
eva.token.pay(token_id, amount, reason) Try to pay tokens from save
eva.token.pay_many(tokens, reason) Pay multiply tokens
eva.token.pay_group(token_group_id, reason) Pay multiply tokens by token_group_id
eva.token.is_enough() Check is enough to pay token
eva.token.is_enough_many(tokens) Check multiply tokens
eva.token.is_enough_group(token_group_id) Check multiply tokens by token_group_id
eva.token.is_contains(tokens, token_id) Check if tokens contains the token_id
eva.token.is_max(container_id, token_id) Return is token is maximum
eva.token.get_max(container_id, token_id) Return token maximum value
eva.token.is_empty(container_id, token_id) Return is tokens equals to 0
eva.token.add_infinity_time() Add to tokens infinity time usage
eva.token.is_infinity() Return is token is infinity now
eva.token.get_infinity_seconds() Get amount of seconds till end of infinity time
eva.token.get_seconds_to_restore() Get current time to next restore point
eva.token.sync_visual() Reset visual debt of tokens
eva.token.add_visual() Add visual debt to token
eva.token.get_visual() Get current visual debt of token
eva.token.get_total_sum(container_id, token_id) Get total amount of acquired tokens for container

modules.trucks Functions

eva.trucks.is_arrived(truck_id) Check if truck is already arrived
eva.trucks.get_time_to_arrive(truck_id) Get time for next truck arrive
eva.trucks.is_can_arrive(truck_id) Check if truck can be arrived now
eva.trucks.arrive(truck_id) Arrive truck right now, even it can't be arrived now.
eva.trucks.get_time_to_leave(truck_id) Get time for next truck leave
eva.trucks.is_can_leave(truck_id) Check if truck can leave now
eva.trucks.leave(truck_id) Leave truck right now, even it can leave now.
eva.trucks.is_enabled(truck_id) Check is truck enabled now
eva.trucks.set_enabled(truck_id) Set truck enabled state
eva.trucks.set_settings(trucks_settings) Set trucks settings with custom callbacks.

modules.utils Functions

eva.utils.after() Make after closure
eva.utils.save_json() Save json in bundled resource (desktop only)
eva.utils.load_json() Load json from bundled resource
eva.utils.hex2rgb() Convert hex color to rgb color
eva.utils.rgb2hex() Convert rgb color to hex color
eva.utils.get_days_in_month() Return days in month
eva.utils.load_image() Load image to GUI node

modules.vibrate Functions

eva.vibrate.vibrate(vibrate_pattern) Make phone vibrate
eva.vibrate.is_enabled() Return if vibrate is enabled for user
eva.vibrate.set_enabled(is_enabled) Turn on or off vibrate for user

modules.wallet Functions

eva.wallet.add() Add tokens to save
eva.wallet.add_many() Add multiply tokens
eva.wallet.add_group() Add multiply tokens by token_group_id
eva.wallet.set() Set tokens to save
eva.wallet.get() Get current token amount from save
eva.wallet.pay(token_id, amount, reason) Try to pay tokens from save
eva.wallet.pay_many(tokens, reason) Pay multiply tokens
eva.wallet.pay_group(token_group_id, reason) Pay multiply tokens by token_group_id
eva.wallet.is_enough() Check is enough to pay token
eva.wallet.is_enough_many(tokens) Check multiply tokens
eva.wallet.is_enough_group(token_group_id) Check multiply tokens by token_group_id
eva.wallet.is_max(token_id, True) Return is token is maximum
eva.wallet.get_max(token_id) Return token maximum value
eva.wallet.is_empty() Return is tokens equals to 0
eva.wallet.add_infinity_time() Add to tokens infinity time usage
eva.wallet.is_infinity() Return is token is infinity now
eva.wallet.get_infinity_seconds() Get amount of seconds till end of infinity time
eva.wallet.sync_visual() Reset visual debt of tokens
eva.wallet.add_visual() Add visual debt to token
eva.wallet.get_visual() Get current visual debt of token
eva.token.get_total_sum(token_id) Get total amount of acquired tokens for profile
eva.wallet.get_seconds_to_restore() Get current time to next restore point

modules.window Functions

eva.window.get_data() Return passed data to scene/window
eva.window.show_scene() Load the game scene
eva.window.show() Show the game window It will close current window and open new, if any opened It can be popup on popup, so don't close prev.
eva.window.preload(window_id[, callback]) Preload window via monarch
eva.window.is_open(window_id) Check is window is opened now
eva.window.close(window_id) Close window by id or last window
eva.window.msg_post(message_id, message) Send message to the last open window
eva.window.close_all() Close all windows
eva.window.appear(window_id, callback) Appear functions for all windows Need to call inside window
eva.window.disappear(window_id, callback) Disappear functions for all windows Need to call inside window
eva.window.on_message(window_id, message_id, message, sender) On message function to manage windows
eva.window.set_settings() Set game windows settings


Functions

init(settings_path, module_settings)
Call this to init Eva module

Parameters:

  • settings_path string path to eva_settings.json
  • module_settings table Settings to modules. See description on eva.lua
update(dt)
Call this on main update loop

Parameters:

  • dt number delta time
get_logger(logger_name)
Return logger from eva.log module

Parameters:

Returns:

    logger The logger instance

modules.ads Functions

eva.ads.is_ready(ad_id)
Check is ads are ready to show now

Parameters:

  • ad_id string The Ad placement id
eva.ads.is_blocked(ad_id)
Check is ads are blocked with network or tokens for player

Parameters:

  • ad_id string The Ad placement id
eva.ads.get_time_to_ready(ad_id, The)
Return seconds when placement will be ready

Parameters:

  • ad_id string The Ad placement id
  • The number amount in seconds

Returns:

    number The seconds amount until ads available
eva.ads.show(ad_id, success_callback, finish_callback)
Show ad by placement id

Parameters:

  • ad_id string The Ad placement id
  • success_callback function The success callback
  • finish_callback function The ads finish callback
eva.ads.set_enabled(state)
Set enabled ads state

Parameters:

  • state boolean ads state
eva.ads.is_enabled()
Check ads is enabled

Returns:

    bool is ads enabled
eva.ads.get_watched(Total)
Get total ads watched

Parameters:

  • Total number watched ads count
eva.ads.get_adapter_name()
Return current ads adapter name

Returns:

    string The adapter name

modules.callbacks Functions

eva.callbacks.create(callback)
Wrap callback It return index for callback, You can call it now via eva.callbacks.call(index, ...)

Parameters:

  • callback function Callback to wrap

Returns:

    number index New index of wrapped callback
eva.callbacks.call(index, ...)
Call wrapped callback

Parameters:

  • index number Index of wrapped callback
  • ... args Args of calling callback
eva.callbacks.clear(index)
Clear callback

Parameters:

  • index number Index of wrapped callback

modules.camera Functions

eva.camera.set_camera(cam_id, camera_box)
Set the camera game object and size of the camera

Parameters:

  • cam_id string url of camera game object
  • camera_box vector3 size of the camera at zoom=1
eva.camera.set_control(enabled)
Enable or disable camera user control

Parameters:

  • enabled boolean state
eva.camera.set_borders(border_soft, border_hard)
Set the borders of the camera zone

Parameters:

  • border_soft vector4 Soft zones of camera. Order is: left-top-right-bot.
  • border_hard vector4 Hard zones of camera. Order is: left-top-right-bot.
eva.camera.set_position(x, y)
Set the camera position

Parameters:

  • x number X position
  • y number Y position
eva.camera.get_position()
Get the camera position

Returns:

  1. number x X position
  2. number y Y position
eva.camera.set_target_position(x, y, callback)
Set target camera position

Parameters:

  • x number X position
  • y number Y position
  • callback function Callback function
eva.camera.set_zoom_borders(zoom_soft, zoom_hard)
Set the camera game object and size of the camera

Parameters:

  • zoom_soft vector3 Setup zoom soft values. vector3(min_value, max_value, 0)
  • zoom_hard vector3 Setup zoom hard values. vector3(min_value, max_value, 0)
eva.camera.set_zoom(zoom)
Set the camera zoom

Parameters:

  • zoom number Zoom
eva.camera.set_target_zoom(zoom)
Set the camera target zoom

Parameters:

  • zoom number Target zoom
eva.camera.get_zoom()
Get the camera zoom

Returns:

    number zoom
eva.camera.update(dt)
Eva camera update should be called manually Due the it uses context go.set_position

Parameters:

  • dt number Delta time

modules.daily Functions

eva.daily.is_active()
Return is active now daily system
eva.daily.set_active()
Set active daily system It will reset last pick time
eva.daily.pick()
Pick current prize
eva.daily.get_time()
Return time until you can pickup prize
eva.daily.get_wait_time()
Return time until you can lose the unpicked reward
eva.daily.get_current_state()
Return current state

Returns:

    table Array with booleans to show picked rewards

modules.db Functions

eva.db.get(config_name)
Return config by config_name

Parameters:

  • config_name string Config name from eva settings

Returns:

    table Config table
eva.db.set_settings(settings)
Can override db with custom tables (useful for tests)

Parameters:

  • settings table Custom db settings

modules.device Functions

eva.device.get_device_id()
Return device id. If device_id is empty, it will generate device_id with uuid library. And store it on file

Returns:

    string device_id
eva.device.get_uuid(except)
Generate uuid

Parameters:

  • except table list of uuid, what not need to be generated

Returns:

    string the uuid
eva.device.get_region()
Return device region. If region is unknown, it will return "UN".

Returns:

    string region
eva.device.get_device_info()
Return device_info
eva.device.is_android()
Check if device on android
eva.device.is_ios()
Check if device on iOS
eva.device.is_mobile()
Check if device is native mobile (Android or iOS)
eva.device.is_desktop()
Check if device is desktop (Windows/MacOS)
eva.device.is_web()
Check if device is HTML5
eva.device.is_web_mobile()
Check if device is HTML5 mobile

modules.events Functions

eva.events.event(event[, params={}])
Throws the game event

Parameters:

  • event string name of event
  • params table params (default {})
eva.events.screen(screen_id)
Setup current game screen

Parameters:

eva.events.subscribe(event_name, callback, callback_context)
Subscribe the callback on event

Parameters:

  • event_name string Event name
  • callback function Event callback
  • callback_context table The first param for callback on fire
eva.events.subscribe_map(map)
Subscribe the pack of events by map

Parameters:

  • map table {Event = Callback} map
eva.events.unsubscribe(event_name, callback)
Unsubscribe the event from events flow

Parameters:

  • event_name string Event name
  • callback function Event callback
eva.events.unsubscribe_map(map)
Unsubscribe the pack of events by map

Parameters:

  • map table {Event = Callback} map
eva.events.is_subscribed(event_name, callback)
Check if callback is already subscribed

Parameters:

  • event_name string Event name
  • callback function Event callback

modules.feature Functions

eva.feature.toggle(feature_name, state)
Toggle manually feature

Parameters:

  • feature_name string Feature name
  • state bool Feature state
eva.feature.start()
Start eva feature system. Need to call, when game is prepared for features

modules.festivals Functions

eva.festivals.is_active(festival_id)
Return is festival is active now

Parameters:

  • festival_id string Festival id from Festivals json

Returns:

    bool Current festival state
eva.festivals.is_completed(festival_id)
Return is festival is completed Return true for repeated festivals, is they are completed now

Parameters:

  • festival_id string Festival id from Festivals json

Returns:

    number Festival completed counter (For repeat festivals can be > 1)
eva.festivals.get_start_time(festival_id)
Return next start time for festival_id

Parameters:

  • festival_id string Festival id from Festivals json

Returns:

    number Time in seconds since epoch
eva.festivals.get_end_time(festival_id)
Return next end time for festival_id

Parameters:

  • festival_id string Festival id from Festivals json

Returns:

    number Time in seconds since epoch
eva.festivals.get_current()
Return current festivals

Returns:

    table array of current festivals
eva.festivals.get_completed()
Return completed festivals

Returns:

    table array of completed festivals
eva.festivals.debug_start_festival(festival_id)
Start festival without check any condition

Parameters:

  • festival_id string Festival id from Festivals json
eva.festivals.debug_end_festival(festival_id)
End festival without check any condition

Parameters:

  • festival_id string Festival id from Festivals json
eva.festivals.set_settings()
Set game festivals settings. See festivals_settings_example.lua

modules.game Functions

eva.game.open_store_page()
Open store page in store application
eva.game.reboot(delay)
Reboot the game

Parameters:

  • delay number Delay before reboot, in seconds
eva.game.exit(code)
Exit from the game

Parameters:

  • code int The exit code
eva.game.is_debug()
Check game on debug mode
eva.game.get_time()
Get game time

Returns:

    number Return game time in seconds
eva.game.get_session_uid()
Return unique id for local session

Returns:

    number Unique id in this game session
eva.game.get_uid()
Return unique id for player profile

Returns:

    number Unique id in player profile
eva.game.get_current_time_string()
Get current time in string format

Returns:

    string Time format in iso e.g. "2019-09-25T01:48:19Z"
eva.game.get_current_date_code()
Get current date in format: YYYYMMDD

Returns:

    number Current day in format YYYYMMDD
eva.game.get_seconds_until_new_day()
Get time in seconds until next day from current time

Returns:

    number Seconds until next day
eva.game.get_days_played()
Get days since first game launch

Returns:

    number Days since first game launch
eva.game.is_first_launch()
Return true, if game launched first time

Returns:

    bool True, if game first time launch

modules.gdpr Functions

eva.gdpr.apply_gdpr()
Apply the GDPR to the game profile
eva.gdpr.is_accepted()
Return if GDPR is accepted
eva.gdpr.open_policy_url()
Open the policy URL

modules.grid Functions

eva.grid.get_map_params()
Get map params data to work with it You can pass directly params in every method or set is as default with eva.grid.set_default_map_params Pass the map sizes to calculate correct coordinates

Returns:

    map_params Map params data
eva.grid.set_default_map_params(map_params)
Set default map params To don`t pass it every time in transform functions

Parameters:

  • map_params map_params Params from eva.grid.get_map_params
eva.grid.cell_to_pos()
Transform hex to pixel position
eva.grid.pos_to_cell()
Transform pixel to hex
eva.grid.get_z(y, z_layer)
Get Z position from object Y position and his z_layer

Parameters:

  • y number Object Y position
  • z_layer number Object Z layer index

Returns:

    map_params Map params data
eva.grid.get_object_pos()
Get object position Can pass the offset to calculate it correctly (+ z coordinate)

Returns:

    number, number, number Object position
eva.grid.get_tiled_scene_pos()
Convert tiled object position to scene position

Returns:

    number,number x,y Object scene position
eva.grid.get_tile_pos()
Get tile position. Convert from i, j to map position

Returns:

    number, number, number Tile position

modules.hexgrid Functions

eva.hexgrid.get_map_params(tilewidth, tileheight, tileside, width, height, invert_y)
Get map params data to work with it You can pass directly params in every method or set is as default with eva.hexgrid.set_default_map_params Pass the map sizes to calculate correct coordinates

Parameters:

  • tilewidth number Hexagon width
  • tileheight number Hexagon height
  • tileside number Hexagon side length (flat side)
  • width number Map width in tiles count
  • height number Map height in tiles count
  • invert_y boolean If true, zero pos will be at top, else on bot

Returns:

    map_params Map params data
eva.hexgrid.set_default_map_params(map_params)
Set default map params To dont pass it every time in transform functions

Parameters:

  • map_params map_params Params from eva.hexgrid.get_map_params
eva.hexgrid.cell_to_pos(i, j, map_params)
Transform hex to pixel position. Offset coordinates

Parameters:

  • i number Cell i coordinate
  • j number Cell j coordinate
  • map_params map_params Params from eva.hexgrid.get_map_params
eva.hexgrid.pos_to_cell(x, y, map_params)
Transform pixel to hex. Offset coordinates

Parameters:

  • x number World x position
  • y number World y position
  • map_params map_params Params from eva.hexgrid.get_map_params
eva.hexgrid.cell_cube_to_pos(i, j, k[, map_params])
Transform hex to pixel position. Offset coordinates

Parameters:

  • i number Cell i coordinate
  • j number Cell j coordinate
  • k number Cell k coordinate
  • map_params map_params Params from eva.hexgrid.get_map_params (optional)
eva.hexgrid.pos_to_cell_cube(x, y, map_params)
Transform pixel to hex. Cube coordinates

Parameters:

  • x number World x position
  • y number World y position
  • map_params map_params Params from eva.hexgrid.get_map_params
eva.hexgrid.offset_to_cube(i, j[, map_params])
Transfrom offset coordinates to cube coordinates

Parameters:

  • i number I coordinate
  • j number J coordinate
  • map_params map_params Params from eva.hexgrid.get_map_params (optional)
eva.hexgrid.cube_to_offset(i, j, k[, map_params])
Transfrom cube coordinates to offset coordinates

Parameters:

  • i number I coordinate
  • j number J coordinate
  • k number K coordinate
  • map_params map_params Params from eva.hexgrid.get_map_params (optional)
eva.hexgrid.rotate_offset(i, j, k, N)
Rotate offset coordinate by N * 60degree

Parameters:

  • i number I coordinate
  • j number J coordinate
  • k number K coordinate
  • N number Number, how much rotate on 60 degrees. Positive - rotate right, Negative - left

Returns:

    number, number, number Offset coordinate
eva.hexgrid.get_z(y, z_layer)
Get Z position from object Y position and his z_layer

Parameters:

  • y number Object Y position
  • z_layer number Object Z layer index

Returns:

    map_params Map params data
eva.hexgrid.get_object_pos()
Get object position Can pass the offset to calculate it correctly (+ z coordinate)

Returns:

    number, number, number Object position
eva.hexgrid.get_tiled_scene_pos()
Convert tiled object position to scene position

Returns:

    number,number x,y Object scene position
eva.hexgrid.get_tile_pos()
Get tile position. Convert from i, j to map position

Returns:

    number, number, number Tile position

modules.iaps Functions

eva.iaps.buy(iap_id)
Buy the inapp

Parameters:

  • iap_id string In-game inapp ID from iaps settings
eva.iaps.get_reward(iap_id)
Get reward from iap_id

Parameters:

eva.iaps.get_iap(iap_id)
Get iap info by iap_id

Parameters:

eva.iaps.get_iaps(category)
Get all iaps. Can be selected by category

Parameters:

  • category string Category of iap

Returns:

    list of iap products
eva.iaps.is_available(iap_id)
Check is iap is available

Parameters:

Returns:

    bool Is available
eva.iaps.get_price(iap_id)
Get price from iap_id

Parameters:

Returns:

    number Price of iap
eva.iaps.get_price_string(iap_id)
Get price_string from iap_id

Parameters:

Returns:

    string The iap price string
eva.iaps.refresh_iap_list()
Refresh iap list. It make request to stores to get new info Throw EVENT.IAP_UPDATE at end
eva.iaps.get_ltv()
Get total lifetime value (from iaps)

Returns:

    number Player's LTV
eva.iaps.get_max_payment()
Get player max payment

Returns:

    number Max player payment

modules.input Functions

eva.input.register(name, callback, priority)
Register the input to handle user actions If callback return true it will stop handle next input

Parameters:

  • name string Name of input system
  • callback function The input callback
  • priority number Priority of input. Lower first
eva.input.unregister(name)
Unregister prev. registered input

Parameters:

  • name string Name of input system
eva.input.set_enabled(name, is_enabled)
Set enabled state for input

Parameters:

  • name string Name of input system
  • is_enabled bool Enabled state

modules.invoices Functions

eva.invoices.add(category, reward[, time[, life_time[, title[, text]]]])
Add invoice to game profile If time is not provided, add invoice instantly If time is provided, add invoice in this time Invoice should be consumed to get reward

Parameters:

  • category string Category param of the invoice
  • reward evadata.Tokens Tokens reward list
  • time number Game time to add invoice (optional)
  • life_time number Time in seconds of invoice available (optional)
  • title string Text invoice title (optional)
  • text string Text invoice desc (optional)
eva.invoices.get_invoices()
Return current list of invoices
eva.invoices.get_invoce()
Get invoice data by id

Returns:

    eva.InvoiceInfo Invoice data
eva.invoices.can_consume()
Check is invoice can be consumed

Returns:

    bool Can consume invoice
eva.invoices.consume(invoice_id)
Consume the invoice to the game profile

Parameters:

  • invoice_id number The id of invoice

modules.isogrid Functions

eva.isogrid.get_map_params()
Get map params data to work with it You can pass directly params in every method or set is as default with eva.isogrid.set_default_map_params Pass the map sizes to calculate correct coordinates

Returns:

    map_params Map params data
eva.isogrid.set_default_map_params(map_params)
Set default map params To don`t pass it every time in transform functions

Parameters:

  • map_params map_params Params from eva.isogrid.get_map_params
eva.isogrid.cell_to_pos()
Transform hex to pixel position
eva.isogrid.pos_to_cell()
Transform pixel to hex
eva.isogrid.get_z(y, z_layer)
Get Z position from object Y position and his z_layer

Parameters:

  • y number Object Y position
  • z_layer number Object Z layer index

Returns:

    map_params Map params data
eva.isogrid.get_object_pos()
Get object position Can pass the offset to calculate it correctly (+ z coordinate)

Returns:

    number, number, number Object position
eva.isogrid.get_tiled_scene_pos()
Convert tiled object position to scene position

Returns:

    number,number x,y Object scene position
eva.isogrid.get_tile_pos()
Get tile position. Convert from i, j to map position

Returns:

    number, number, number Tile position

modules.labels Functions

eva.labels.is_exist(label)
Check label is exist in player profile

Parameters:

Returns:

    bool True, if label in player profile

modules.lang Functions

eva.lang.time_format()
Return localized time format from seconds
eva.lang.set_lang(lang)
Set current language

Parameters:

  • lang string current language code from eva-settings
eva.lang.get_lang()
Get current language

Returns:

    string return current language code
eva.lang.txt(lang_id)
Get translation for locale id

Parameters:

  • lang_id string locale id from your localization

Returns:

    string translated locale
eva.lang.txr(lang_id)
Get random translation for locale id, split by \n symbol

Parameters:

  • lang_id string locale id from your localization

Returns:

    string translated locale
eva.lang.txp(lang_id, ...)
Get translation for locale id with params

Parameters:

  • lang_id string Locale id from your localization
  • ... string Params for string.format for lang_id

Returns:

    string Translated locale
eva.lang.is_exist(lang_id)
Check is translation with lang_id exist

Parameters:

  • lang_id strng Locale id from your localization

Returns:

    bool Is translation exist
eva.lang.get_langs()
Return list of available languages

Returns:

    table List of available languages

modules.migrations Functions

eva.migrations.set_migrations()
Add migration to the eva system Pass the migrations list in eva.init You should directly point the migration version in migration list (array from 1 to N)
eva.migrations.get_count()
Return amount of migrations
eva.migrations.apply()
Apply the migrations

modules.offers Functions

eva.offers.add(offer_id)
Start new offer Every offer is unique. You got error, if offer_id is already started. Data pickups from Offers DB.

Parameters:

  • offer_id string offer id from db

Returns:

    eva.Offer new offer
eva.offers.remove(offer_id)
Remove offers from active list

Parameters:

  • offer_id string offer id from db
eva.offers.get_time(offer_id)
Return time till offer end. If offer is no exist now, print the error

Parameters:

  • offer_id string offer id from db

Returns:

    number time in seconds
eva.offers.is_active(offer_id)
Check is offer active not

Parameters:

  • offer_id string offer id from db

Returns:

    bool is offer active
eva.offers.get_reward(offer_id)
Get token group of offer reward.

Parameters:

  • offer_id string offer id from db

Returns:

    evadata.Tokens token list
eva.offers.get_price(offer_id)
Get token group of offer price.

Parameters:

  • offer_id string offer id from db

Returns:

    evadata.Tokens token list
eva.offers.is_iap(offer_id)
Check is offer for inapp

Parameters:

  • offer_id string offer id from db

Returns:

    bool is offer inapp

modules.pathfinder Functions

eva.pathfinder.init_astar(map_data, get_node_fn, options)
Init astar for map, init get_tile callback get_node_fn - function to get tile: function(i, j) should return cost of node. Nil if cell is unpassable

Parameters:

  • map_data map_data Map data from eva.tiled.load_map
  • get_node_fn function Get node cost function from map
  • options table Options for map handlers: - diagonal boolean, to grid and isogrid pathfinding

Returns:

    map_handler Handler for astar work
eva.pathfinder.path(from_x, from_y, to_x, to_y[, map_handler])
Return path between two points for map. Call init_astar, to make map_handler param optional

Parameters:

  • from_x Cell X from map
  • from_y Cell Y from map
  • to_x Cell X from map
  • to_y Cell Y from map
  • map_handler map_handler Map handler to handle map for astar (optional)

Returns:

    table or nil Table of points. See eva.libs.astar.path. Nil if path is not exist

modules.promocode Functions

eva.promocode.get_applied_codes()
Get list of all redeemed codes

Returns:

    string[] List of applied codes
eva.promocode.is_applied(code)
Check if promocode is already applied

Parameters:

  • code string The promocode itself

Returns:

    bool True if code is already redeemed
eva.promocode.redeem_code(code)
Try redeem the code and get rewards

Parameters:

  • code string The promocode itself

Returns:

    bool Result of success
eva.promocode.is_can_redeem(code)
Check if promocode can be redeem

Parameters:

  • code string The promocode itself

Returns:

    bool True of false
eva.promocode.set_settings()
Set promocode settings. Pass settings in eva.init function

modules.proto Functions

eva.proto.get(proto_type)
Get empty template from proto type

Parameters:

  • proto_type string name of proto message e.g. 'eva.Token'

Returns:

    table empty table with default values from proto
eva.proto.encode()
Encode protobuf
eva.proto.decode()
Decode protobuf
eva.proto.verify(proto_type, data)
Check data to match the proto_type Return data with default values according to proto_type

Parameters:

  • proto_type string The prototype name
  • data table The user data

modules.push Functions

eva.push.clear_old_pushes()
Clear all pushes, what already should be invoked.
eva.push.schedule()
Schedule notification
eva.push.schedule_list()
Schedule by list Every notifications have: after, title, text, category, payload
eva.push.unschedule()
Unschedule the push notification
eva.push.unschedule_all(category)
Cancel all pushes with category If category is not provided, cancel all pushes

Parameters:

  • category string Push category to cancel
eva.push.is_enabled()
Get push enabled status
eva.push.set_enabled(is_enabled)
Set push enabled status

Parameters:

  • is_enabled boolean

modules.quests Functions

eva.quests.get_progress(quest_id)
Get current progress on quest

Parameters:

Returns:

    table List of progress of quest tasks in task order
eva.quests.get_current(category)
Get current active quests

Parameters:

  • category string[opt] Quest category, if nil return all current quests

Returns:

    table List of active quests
eva.quests.get_completed()
Get completed quests list

Returns:

    table List of active quests
eva.quests.is_current_with_task(action[, object])
Check if there is quests in current with pointer action and object

Parameters:

  • action string Task action
  • object string Task object (optional)

Returns:

    bool True, if there is quest with similar tasks
eva.quests.is_active()
Check quest is active

Returns:

    bool Quest active state
eva.quests.is_completed()
Check quest is completed

Returns:

    bool Quest completed state
eva.quests.is_can_start_quest()
Check quest is can be started now

Returns:

    bool Quest is can start state
eva.quests.start_quest(quest_id)
Start quest, if it can be started

Parameters:

eva.quests.is_can_complete_quest()
Check quest is can be completed now

Returns:

    bool Quest is can complete quest state
eva.quests.complete_quest(quest_id)
Complete quest, if it can be completed

Parameters:

eva.quests.force_complete_quest(quest_id)
Force complete quest

Parameters:

eva.quests.reset_progress(quest_id)
Reset quets progress, only on current quests

Parameters:

eva.quests.quest_event(action, object, amount)
Apply quest event to all current quests

Parameters:

  • action string Type of event
  • object string Object of event
  • amount number Amount of event
eva.quests.start_quests()
Start eva quests system. Need to call, when game is prepared for quests Call it to activate quests
eva.quests.update_quests()
Update quests list It will start and end quests, by checking quests condition
eva.quests.add_update_quest_event()
Add event, to trigger quest list update. Example: you have a condition to start quest only if festival is enabled So add event FESTIVAL_START to update quests on this update
eva.quests.set_settings()
Set game quests settings. Pass settings in eva.init function

modules.rate Functions

eva.rate.set_never_show()
Set never promt rate again
eva.rate.set_accepted()
Set rate as accepted. It will no show more
eva.rate.promt_rate()
Try to promt rate game to the player
eva.rate.open_rate()
Open store or native rating if available

modules.rating Functions

eva.rating.elo(rating_a, rating_b, game_koef)
Call elo rating

Parameters:

  • rating_a number Player rating
  • rating_b number Opponent rating
  • game_koef number Result of game. 1 is win, 0 on loose, 0.5 is draw

modules.render Functions

eva.render.set_blur()
Change render
eva.render.set_light()
Change render
eva.render.set_vignette()
Change render

modules.saver Functions

eva.saver.load()
Load the file from save directory
eva.saver.save()
Save the game file in save directory
eva.saver.save_data(data, filename)
Save the data in save directory

Parameters:

  • data table The save data table
  • filename string The save filename
eva.saver.get_save_data()
Return save table

Returns:

    table
eva.saver.delete([filename])
Delete the save

Parameters:

  • filename string The save filename. Can be default by settings (optional)
eva.saver.reset()
Reset the game profile
eva.saver.add_save_part()
Add save part to the save table
eva.saver.set_autosave_timer(seconds)
Set autosave timer for game. Pass 0 to disable autosave

Parameters:

  • seconds number The time in seconds
eva.saver.get_save_version()
Return current save version. Useful for check which save data is newer

Returns:

    number

modules.server Functions

eva.server.connect(callback)
Login at nakama server

Parameters:

  • callback function Callback after login
eva.server.is_connected()
Return is currently server connected

Returns:

    boolean If server connected
eva.server.get_client()
Return nakama client

Returns:

    table
eva.server.get_socket()
Return nakama socket

Returns:

    table

modules.share Functions

eva.share.screen(text)
Share screenshot of the game

Parameters:

  • text string The optional text to share with screenshot

modules.skill Functions

eva.skill.use()
Use skill
eva.skill.end_use()
End use of channeling spell or end effect of skill with duration
eva.skill.skil_cooldown_time()
Skill cooldown
eva.skill.is_active()
Time between use and end_use
eva.skill.get_active_time()
Return skill active time (duration)
eva.skill.get_active_time_left()
Return skill active left time (until end of duration)
eva.skill.get_active_progress()
Return current skill progress time
eva.skill.is_on_cooldown()
Return true if skill on the cooldown
eva.skill.get_cooldown_time()
Return skill cooldown time
eva.skill.get_cooldown_time_left()
Return skill cooldown time left
eva.skill.get_cooldown_progress()
Get cooldown progress
eva.skill.get_stack_amount()
Get current skill stack amount
eva.skill.add_stack()
Add amount to skill stacks
eva.skill.is_full_stack()
Return true if skill on full stack
eva.skill.is_empty_stack()
Return true if skill is empty now
eva.skill.is_can_use()
Return true if skill can be used now
eva.skill.restore_all()
Restore all skills in containers

modules.sound Functions

eva.sound.play(sound_id[, gain=1[, speed=1]])
Play the sound in the game

Parameters:

  • sound_id string
  • gain number (default 1)
  • speed number (default 1)
eva.sound.play_random(sound_ids[, gain=1[, speed=1]])
Play the random sound from sound names array

Parameters:

  • sound_ids string[]
  • gain number (default 1)
  • speed number (default 1)
eva.sound.stop(sound_id)
Stop sound playing

Parameters:

eva.sound.play_music(music_id[, gain=1[, callback]])
Start playing music

Parameters:

  • music_id string
  • gain number (default 1)
  • callback function (optional)
eva.sound.stop_music()
Stop any music in the game
eva.sound.fade(sound_id, to[, time=1[, callback]])
Fade sound from one gain to another

Parameters:

  • sound_id string
  • to number
  • time number (default 1)
  • callback function (optional)
eva.sound.fade_music(to[, time=1], callback)
Slowly fade music to another one or empty

Parameters:

  • to number
  • time number (default 1)
  • callback function
eva.sound.stop_all()
Stop all sounds in the game
eva.sound.set_music_gain()
Set music gain
eva.sound.set_sound_gain()
Set sound gain
eva.sound.get_music_gain()
Get music gain
eva.sound.get_sound_gain()
Get sound gain
eva.sound.is_music_enabled()
Check music gain
eva.sound.is_sound_enabled()
Check sound gain

modules.storage Functions

eva.storage.get(id)
Get the value from the storage.

Parameters:

eva.storage.set(id, value)
Set the value to eva storage

Parameters:

  • id string The record id
  • value string, number or bool Value

modules.tiled Functions

eva.tiled.load_map(data, create_object_fn)
Load map from tiled json data

Parameters:

  • data table Json map data
  • create_object_fn callback Module call this with param(object_layer, object_id, position)
eva.tiled.add_tile(layer_name, tileset_name, mapping_id, i, j[, map_data])
Add tile to the map by tile index from tiled tileset

Parameters:

  • layer_name string Name of tiled layer
  • tileset_name string Name of tileset
  • mapping_id number Tile mapping_id from tileset
  • i number Cell x position
  • j number Cell y position
  • map_data map_data Map_data returned by eva.tiled.load_map. Last map by default (optional)
eva.tiled.get_tile(layer_name, i, j[, map_data])
Get tile from the map by tile pos

Parameters:

  • layer_name string Name of tiled layer
  • i number Cell x position
  • j number Cell y position
  • map_data map_data Map_data returned by eva.tiled.load_map. Last map by default (optional)
eva.tiled.delete_tile(layer, i, j[, map_data])
Delete tile from the map by tile pos

Parameters:

  • layer string Name of the tiled layer
  • i number Cell i position
  • j number Cell j position
  • map_data map_data Map_data returned by eva.tiled.load_map. Last map by default (optional)
eva.tiled.add_object(layer_name, object_full_id, x, y[, scale=1[, rotation=0[, props[, map_data]]]])
Add object to the map by object index from tiled tileset

Parameters:

  • layer_name string Name of tiled layer
  • object_full_id string Object full id
  • x number x position
  • y number y position
  • scale number Object scale (default 1)
  • rotation number Rotation in euler (default 0)
  • props table Object additional properties. Field, z_position, tiled_id, tiled_name (optional)
  • map_data map_data Map_data returned by eva.tiled.load_map. Last map by default (optional)
eva.tiled.get_object(game_object_id[, map_data])
Get object to the map by game_object id

Parameters:

  • game_object_id hash Game object id
  • map_data map_data Map_data returned by eva.tiled.load_map. Last loaded map by default (optional)

Returns:

    table Object data
eva.tiled.get_object_data(object_name)
Get mapping object info by name

Parameters:

  • object_name string The game object name
eva.tiled.get_object_data(object_name)
Get mapping object info by mapping_id

Parameters:

  • object_name string The game object name
eva.tiled.get_property(object_info, object_name, script_name, property_name)
Get object property

Parameters:

  • object_info tiled.object_info Object info
  • object_name string Object name
  • script_name string Script name
  • property_name string Property name

Returns:

    string, boolean, number or nil
eva.tiled.get_property_by_name(object_info, property_name)
Get object property by name

Parameters:

  • object_info tiled.object_info Object info
  • property_name string Property name

Returns:

    string, boolean, number or nil
eva.tiled.set_object_id(object_info, scene_id)
Set unique id for the object

Parameters:

  • object_info tiled.object_info Object info
  • scene_id string Scene id

Returns:

    tiled.object_info
eva.tiled.set_scene_name(object_info, scene_name)
Set scene name for the object

Parameters:

  • object_info tiled.object_info Object info
  • scene_name string Scene name

Returns:

    tiled.object_info
eva.tiled.set_enabled(object_info, is_enabled)
Set object enabled state

Parameters:

  • object_info tiled.object_info Object info
  • is_enabled boolean Is object enabled

Returns:

    tiled.object_info
eva.tiled.is_enabled(object_info)
Return if object is enabled

Parameters:

  • object_info tiled.object_info Object info

Returns:

    boolean
eva.tiled.delete_object(game_object_id[, map_data])
Delete object from the map by game_object id

Parameters:

  • game_object_id hash Game object id
  • map_data map_data Map_data returned by eva.tiled.load_map. Last map by default (optional)

modules.timers Functions

eva.timers.add(slot_id, timer_id, time[, auto_trigger])
Add new timer Timer with slot_id should no exist

Parameters:

  • slot_id string identificator of timer
  • timer_id string string param of timer
  • time number time of timer, in seconds
  • auto_trigger bool true, if event should fire event at end (optional)
eva.timers.get()
Get timer
eva.timers.get_time(slot_id)
Get time until end, in seconds

Parameters:

  • slot_id string identificator of timer

Returns:

    number Time until end of timer. -1 if timer is not exist
eva.timers.is_end(slot_id)
Check is timer has ended

Parameters:

  • slot_id string identificator of timer
eva.timers.clear(slot_id)
Clear the timer slot

Parameters:

  • slot_id string identificator of timer
eva.timers.set_pause(slot_id, is_pause)
Set timer pause state

Parameters:

  • slot_id string identificator of timer
  • is_pause boolean pause state

modules.token Functions

eva.token.is_exist_container(container_id)
Check if token container exist

Parameters:

  • container_id string Container id

Returns:

    bool Container exist state
eva.token.create_container(container_id, container_type)
Create new token container

Parameters:

  • container_id string Container id
  • container_type string Container type to match from token config
eva.token.delete_container(container_id)
Delete token container

Parameters:

  • container_id string Container id
eva.token.clear_container(container_id)
Clear all tokens from container

Parameters:

  • container_id string Container id
eva.token.get_tokens(tokens)
Return evadata.Tokens tokens format. Used in *_tokens methods

Parameters:

  • tokens table Map with token_id = amount
eva.token.get_token_group(token_group_id)
Return token group by id. It pickup data from DB

Parameters:

  • token_group_id string the token group id

Returns:

    evadata.Tokens the token list
eva.token.get_lot_reward(lot_id)
Return lot reward by lot_id. It pickup data from DB

Parameters:

  • lot_id string the token lot id

Returns:

    evadata.Tokens the token list
eva.token.get_lot_price(lot_id)
Return lot price by lot_id. It pickup data from DB

Parameters:

  • lot_id string the token lot id

Returns:

    evadata.Tokens the token list
eva.token.add()
Add tokens to save
eva.token.add_many()
Add multiply tokens
eva.token.add_group()
Add multiply tokens by token_group_id
eva.token.set()
Set tokens to save
eva.token.get()
Get current token amount from save
eva.token.get_many(container_id)
Get all tokens from container

Parameters:

  • container_id string Container id

Returns:

    evadata.Tokens Tokens from container
eva.token.pay(token_id, amount, reason)
Try to pay tokens from save

Parameters:

  • token_id string Token id
  • amount number Amount to pay
  • reason string The reason to pay
eva.token.pay_many(tokens, reason)
Pay multiply tokens

Parameters:

  • tokens evadata.Tokens Tokens data
  • reason string The reason to pay
eva.token.pay_group(token_group_id, reason)
Pay multiply tokens by token_group_id

Parameters:

  • token_group_id string The token group id
  • reason string The reason to pay
eva.token.is_enough()
Check is enough to pay token
eva.token.is_enough_many(tokens)
Check multiply tokens

Parameters:

  • tokens evadata.Tokens list
eva.token.is_enough_group(token_group_id)
Check multiply tokens by token_group_id

Parameters:

  • token_group_id string the token group id
eva.token.is_contains(tokens, token_id)
Check if tokens contains the token_id

Parameters:

  • tokens evadata.Tokens Tokens data
  • token_id string Token id

Returns:

    boolean True if tokens contains the token_id
eva.token.is_max(container_id, token_id)
Return is token is maximum

Parameters:

eva.token.get_max(container_id, token_id)
Return token maximum value

Parameters:

Returns:

    number or nil The token maximum value if exists
eva.token.is_empty(container_id, token_id)
Return is tokens equals to 0

Parameters:

eva.token.add_infinity_time()
Add to tokens infinity time usage
eva.token.is_infinity()
Return is token is infinity now
eva.token.get_infinity_seconds()
Get amount of seconds till end of infinity time
eva.token.get_seconds_to_restore()
Get current time to next restore point
eva.token.sync_visual()
Reset visual debt of tokens
eva.token.add_visual()
Add visual debt to token
eva.token.get_visual()
Get current visual debt of token
eva.token.get_total_sum(container_id, token_id)
Get total amount of acquired tokens for container

Parameters:

Returns:

    number The total amount of acquired tokens for container

modules.trucks Functions

eva.trucks.is_arrived(truck_id)
Check if truck is already arrived

Parameters:

Returns:

    bool Is arrived now
eva.trucks.get_time_to_arrive(truck_id)
Get time for next truck arrive

Parameters:

Returns:

    number Time in seconds
eva.trucks.is_can_arrive(truck_id)
Check if truck can be arrived now

Parameters:

Returns:

    bool Is can arrive now
eva.trucks.arrive(truck_id)
Arrive truck right now, even it can't be arrived now.

Parameters:

eva.trucks.get_time_to_leave(truck_id)
Get time for next truck leave

Parameters:

Returns:

    number Time in seconds
eva.trucks.is_can_leave(truck_id)
Check if truck can leave now

Parameters:

Returns:

    bool Is can leave now
eva.trucks.leave(truck_id)
Leave truck right now, even it can leave now.

Parameters:

eva.trucks.is_enabled(truck_id)
Check is truck enabled now

Parameters:

Returns:

    bool Is truck enabled
eva.trucks.set_enabled(truck_id)
Set truck enabled state

Parameters:

eva.trucks.set_settings(trucks_settings)
Set trucks settings with custom callbacks. See trucks_settings_example.lua

Parameters:

  • trucks_settings table Table with callbacks

modules.utils Functions

eva.utils.after()
Make after closure
eva.utils.save_json()
Save json in bundled resource (desktop only)
eva.utils.load_json()
Load json from bundled resource
eva.utils.hex2rgb()
Convert hex color to rgb color
eva.utils.rgb2hex()
Convert rgb color to hex color
eva.utils.get_days_in_month()
Return days in month
eva.utils.load_image()
Load image to GUI node

modules.vibrate Functions

eva.vibrate.vibrate(vibrate_pattern)
Make phone vibrate

Parameters:

  • vibrate_pattern number Vibrate const.VIBRATE
eva.vibrate.is_enabled()
Return if vibrate is enabled for user

Returns:

    boolean or nil Is vibrate enabled
eva.vibrate.set_enabled(is_enabled)
Turn on or off vibrate for user

Parameters:

  • is_enabled boolean Vibrate state

modules.wallet Functions

eva.wallet.add()
Add tokens to save
eva.wallet.add_many()
Add multiply tokens
eva.wallet.add_group()
Add multiply tokens by token_group_id
eva.wallet.set()
Set tokens to save
eva.wallet.get()
Get current token amount from save
eva.wallet.pay(token_id, amount, reason)
Try to pay tokens from save

Parameters:

  • token_id string Token id
  • amount number Amount to pay
  • reason string The reason to pay
eva.wallet.pay_many(tokens, reason)
Pay multiply tokens

Parameters:

  • tokens evadata.Tokens Tokens data
  • reason string The reason to pay
eva.wallet.pay_group(token_group_id, reason)
Pay multiply tokens by token_group_id

Parameters:

  • token_group_id string The token group id
  • reason string The reason to pay
eva.wallet.is_enough()
Check is enough to pay token
eva.wallet.is_enough_many(tokens)
Check multiply tokens

Parameters:

  • tokens evadata.Tokens list
eva.wallet.is_enough_group(token_group_id)
Check multiply tokens by token_group_id

Parameters:

  • token_group_id string the token group id
eva.wallet.is_max(token_id, True)
Return is token is maximum

Parameters:

  • token_id string Token id
  • True boolean , if token at maximum value
eva.wallet.get_max(token_id)
Return token maximum value

Parameters:

Returns:

    number or nil The token maximum value if exists
eva.wallet.is_empty()
Return is tokens equals to 0
eva.wallet.add_infinity_time()
Add to tokens infinity time usage
eva.wallet.is_infinity()
Return is token is infinity now
eva.wallet.get_infinity_seconds()
Get amount of seconds till end of infinity time
eva.wallet.sync_visual()
Reset visual debt of tokens
eva.wallet.add_visual()
Add visual debt to token
eva.wallet.get_visual()
Get current visual debt of token
eva.token.get_total_sum(token_id)
Get total amount of acquired tokens for profile

Parameters:

Returns:

    number The total amount of acquired tokens for profile
eva.wallet.get_seconds_to_restore()
Get current time to next restore point

modules.window Functions

eva.window.get_data()
Return passed data to scene/window
eva.window.show_scene()
Load the game scene
eva.window.show()
Show the game window It will close current window and open new, if any opened It can be popup on popup, so don't close prev. window Can add window in queue to open it after current one is closed Window callbacks will be separated module? Calling with ID
eva.window.preload(window_id[, callback])
Preload window via monarch

Parameters:

  • window_id string The window id
  • callback function The callback function (optional)
eva.window.is_open(window_id)
Check is window is opened now

Parameters:

  • window_id string The window id
eva.window.close(window_id)
Close window by id or last window

Parameters:

  • window_id string The window id
eva.window.msg_post(message_id, message)
Send message to the last open window

Parameters:

  • message_id hash
  • message table
eva.window.close_all()
Close all windows
eva.window.appear(window_id, callback)
Appear functions for all windows Need to call inside window

Parameters:

  • window_id string The window id
  • callback func Callback after window open
eva.window.disappear(window_id, callback)
Disappear functions for all windows Need to call inside window

Parameters:

  • window_id string The window id
  • callback func Callback after window close
eva.window.on_message(window_id, message_id, message, sender)
On message function to manage windows

Parameters:

  • window_id string
  • message_id hash
  • message table
  • sender url
eva.window.set_settings()
Set game windows settings
generated by LDoc 1.4.6 Last updated 2023-05-09 21:59:57