repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278 values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15 values |
|---|---|---|---|---|---|
m241dan/darkstar | scripts/globals/spells/bluemagic/blitzstrahl.lua | 1 | 1898 | -----------------------------------------
-- Spell: Blitzstrahl
-- Deals lightning damage to an enemy. Additional effect: "Stun"
-- Spell cost: 70 MP
-- Monster Type: Arcana
-- Spell Type: Magical (Lightning)
-- Blue Magic Points: 4
-- Stat Bonus: DEX+3
-- Level: 44
-- Casting Time: 4.5 seconds
-- Recast Time: 29.25 seconds
-- Magic Bursts on: Impaction, Fragmentation, Light
-- Combos: None
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local params = {};
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.multiplier = 1.5625;
params.tMultiplier = 1.0;
params.duppercap = 61;
params.str_wsc = 0.0;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.3;
params.mnd_wsc = 0.1;
params.chr_wsc = 0.0;
damage = BlueMagicalSpell(caster, target, spell, params, INT_BASED);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0);
if (damage > 0 and resist > 0.0625) then
local typeEffect = EFFECT_STUN;
target:delStatusEffect(typeEffect); -- Wiki says it can overwrite itself or other binds
target:addStatusEffect(typeEffect,1,0,getBlueEffectDuration(caster,resist,typeEffect));
end
return damage;
end;
| gpl-3.0 |
santssoft/darkstar | scripts/globals/weaponskills/backhand_blow.lua | 10 | 1389 | -----------------------------------
-- Backhand Blow
-- Hand-to-Hand weapon skill
-- Skill Level: 100
-- Deals params.critical damage. Chance of params.critical hit varies with TP.
-- Aligned with the Breeze Gorget.
-- Aligned with the Breeze Belt.
-- Element: None
-- Modifiers: STR:30% DEX:30%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/weaponskills")
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {}
params.numHits = 1
params.ftp100 = 1 params.ftp200 = 1 params.ftp300 = 1
params.str_wsc = 0.3 params.dex_wsc = 0.3 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0
params.crit100 = 0.4 params.crit200 = 0.6 params.crit300 = 0.8
params.canCrit = true
params.acc100 = 0.0 params.acc200= 0.0 params.acc300= 0.0
params.atk100 = 1; params.atk200 = 1; params.atk300 = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 0.5 params.dex_wsc = 0.5
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar)
return tpHits, extraHits, criticalHit, damage
end
| gpl-3.0 |
sayeed99/kali-nethunter | nethunter-installer/update/system/bin/lualibs/mf_default_keys.lua | 7 | 5016 |
local _keys = {
--[[
These keys are from the pm3 c-codebase.
--]]
'ffffffffffff', -- Default key (first key used by program if no user defined key)
'000000000000', -- Blank key
'a0a1a2a3a4a5', -- NFCForum MAD key
'b0b1b2b3b4b5',
'aabbccddeeff',
'4d3a99c351dd',
'1a982c7e459a',
'd3f7d3f7d3f7',
'714c5c886e97',
'587ee5f9350f',
'a0478cc39091',
'533cb6c723f6',
'8fd0a4f256e9',
--[[
The data below is taken form the Slurp project,
https://github.com/4ZM/slurp/blob/master/res/xml/mifare_default_keys.xml
released as GPLV3.
--]]
'000000000000', -- Default key
'ffffffffffff', -- Default key
'b0b1b2b3b4b5', -- Key from mfoc
'4d3a99c351dd', -- Key from mfoc
'1a982c7e459a', -- Key from mfoc
'aabbccddeeff', -- Key from mfoc
'714c5c886e97', -- Key from mfoc
'587ee5f9350f', -- Key from mfoc
'a0478cc39091', -- Key from mfoc
'533cb6c723f6', -- Key from mfoc
'8fd0a4f256e9', -- Key from mfoc
-- Data from: http://pastebin.com/wcTHXLZZ
'a64598a77478', -- RKF SL Key A
'26940b21ff5d', -- RKF SL Key A
'fc00018778f7', -- RKF SL Key A
'00000ffe2488', -- RKF SL Key B
'5c598c9c58b5', -- RKF SL Key B
'e4d2770a89be', -- RKF SL Key B
-- Data from: http://pastebin.com/svGjN30Q
'434f4d4d4f41', -- RKF JOJO GROUP Key A
'434f4d4d4f42', -- RKF JOJO GROUP Key B
'47524f555041', -- RKF JOJO GROUP Key A
'47524f555042', -- RKF JOJO GROUP Key B
'505249564141', -- RKF JOJO PRIVA Key A
'505249564142', -- RKF JOJO PRIVA Key B
-- Data from: http://pastebin.com/d7sSetef
'fc00018778f7', -- RKF Rejskort Danmark Key A
'00000ffe2488', -- RKF Rejskort Danmark Key B
'0297927c0f77', -- RKF Rejskort Danmark Key A
'ee0042f88840', -- RKF Rejskort Danmark Key B
'722bfcc5375f', -- RKF Rejskort Danmark Key A
'f1d83f964314', -- RKF Rejskort Danmark Key B
-- Data from: http://pastebin.com/pvJX0xVS
'54726176656C', -- Transport Key A
'776974687573', -- Transport Key B
'4AF9D7ADEBE4', -- Directory and event log Key A
'2BA9621E0A36', -- Directory and event log Key B
-- Data from: http://pastebin.com/Dnnc5dFC
-- New cards are not encrypted (MF Ultralight)
'fc00018778f7', -- Västtrafiken Key A
'00000ffe2488', -- Västtrafiken Key B
'0297927c0f77', -- Västtrafiken Key A
'ee0042f88840', -- Västtrafiken Key B
'54726176656c', -- Västtrafiken Key A
'776974687573', -- Västtrafiken Key B
-- Data from: http://pastebin.com/y3PDBWR1
'000000000001',
'a0a1a2a3a4a5',
'123456789abc',
'b127c6f41436',
'12f2ee3478c1',
'34d1df9934c5',
'55f5a5dd38c9',
'f1a97341a9fc',
'33f974b42769',
'14d446e33363',
'c934fe34d934',
'1999a3554a55',
'27dd91f1fcf1',
'a94133013401',
'99c636334433',
'43ab19ef5c31',
'a053a292a4af',
'434f4d4d4f41',
'434f4d4d4f42',
'505249565441',
'505249565442',
-- Data from,:, http://pastebin.com/TUXj17K3
'fc0001877bf7', -- RKF ÖstgötaTrafiken Key A
'00000ffe2488', -- RKF ÖstgötaTrafiken Key B
'0297927c0f77', -- RKF ÖstgötaTrafiken Key A
'ee0042f88840', -- RKF ÖstgötaTrafiken Key B
'54726176656c', -- RKF ÖstgötaTrafiken Key A
'776974687573', -- RKF ÖstgötaTrafiken Key B
--[[
The keys below are taken from from https://code.google.com/p/mifare-key-cracker/downloads/list
--]]
'bd493a3962b6',
'010203040506',
'111111111111',
'222222222222',
'333333333333',
'444444444444',
'555555555555',
'666666666666',
'777777777777',
'888888888888',
'999999999999',
'aaaaaaaaaaaa',
'bbbbbbbbbbbb',
'cccccccccccc',
'dddddddddddd',
'eeeeeeeeeeee',
'0123456789ab',
'123456789abc',
--[[
The keys below are taken from from https://github.com/4ZM/mfterm/blob/master/dictionary.txt
--]]
'abcdef123456', -- Key from ladyada.net
'000000000001',
'000000000002',
'00000000000a',
'00000000000b',
'100000000000',
'200000000000',
'a00000000000',
'b00000000000',
--[[
Should be for Mifare TNP3xxx tags A KEY.
--]]
'4b0b20107ccb',
--[[
Kiev metro cards
--]]
'8fe644038790',
'f14ee7cae863',
'632193be1c3c',
'569369c5a0e5',
'9de89e070277',
'eff603e1efe9',
'644672bd4afe',
'b5ff67cba951',
}
---
-- The keys above have just been pasted in, for completeness sake. They contain duplicates.
-- We need to weed the duplicates out before we expose the list to someone who actually wants to use them
-- @param list a list to do 'uniq' on
local function uniq(list)
local foobar = {}
--print("list length ", #list)
for _, value in pairs(list) do
value = value:lower()
if not foobar[value] then
foobar[value] = true
table.insert(foobar, value);
end
end
--print("final list length length ", #foobar)
return foobar
end
return uniq(_keys)
| gpl-2.0 |
hylthink/Sample_Lua | frameworks/cocos2d-x/cocos/scripting/lua-bindings/script/cocos2d/DeprecatedCocos2dEnum.lua | 21 | 16802 |
--Enums will be deprecated,begin
_G.kCCTextAlignmentLeft = cc.TEXT_ALIGNMENT_LEFT
_G.kCCTextAlignmentRight = cc.TEXT_ALIGNMENT_RIGHT
_G.kCCTextAlignmentCenter = cc.TEXT_ALIGNMENT_CENTER
_G.kCCVerticalTextAlignmentTop = cc.VERTICAL_TEXT_ALIGNMENT_TOP
_G.kCCVerticalTextAlignmentCenter = cc.VERTICAL_TEXT_ALIGNMENT_CENTER
_G.kCCVerticalTextAlignmentBottom = cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM
_G.kCCDirectorProjection3D = cc.DIRECTOR_PROJECTION3_D
_G.kCCDirectorProjection2D = cc.DIRECTOR_PROJECTION2_D
_G.kCCDirectorProjectionCustom = cc.DIRECTOR_PROJECTION_CUSTOM
_G.kCCDirectorProjectionDefault = cc.DIRECTOR_PROJECTION_DEFAULT
_G.kCCNodeTagInvalid = cc.NODE_TAG_INVALID
_G.kCCNodeOnEnter = cc.NODE_ON_ENTER
_G.kCCNodeOnExit = cc.NODE_ON_EXIT
_G.kCCTexture2DPixelFormat_RGBA8888 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888
_G.kCCTexture2DPixelFormat_RGB888 = cc.TEXTURE2_D_PIXEL_FORMAT_RG_B888
_G.kCCTexture2DPixelFormat_RGB565 = cc.TEXTURE2_D_PIXEL_FORMAT_RG_B565
_G.kCCTexture2DPixelFormat_A8 = cc.TEXTURE2_D_PIXEL_FORMAT_A8
_G.kCCTexture2DPixelFormat_I8 = cc.TEXTURE2_D_PIXEL_FORMAT_I8
_G.kCCTexture2DPixelFormat_AI88 = cc.TEXTURE2_D_PIXEL_FORMAT_A_I88
_G.kCCTexture2DPixelFormat_RGBA4444 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444
_G.kCCTexture2DPixelFormat_RGB5A1 = cc.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1
_G.kCCTexture2DPixelFormat_PVRTC4 = cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC4
_G.kCCTexture2DPixelFormat_PVRTC2 = cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC2
_G.kCCTexture2DPixelFormat_Default = cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT
_G.kCCImageFormatPNG = cc.IMAGE_FORMAT_PNG
_G.kCCImageFormatJPEG = cc.IMAGE_FORMAT_JPEG
_G.kCCTouchesOneByOne = cc.TOUCHES_ONE_BY_ONE
_G.kCCTouchesAllAtOnce = cc.TOUCHES_ALL_AT_ONCE
_G.kCCTransitionOrientationLeftOver = cc.TRANSITION_ORIENTATION_LEFT_OVER
_G.kCCTransitionOrientationRightOver = cc.TRANSITION_ORIENTATION_RIGHT_OVER
_G.kCCTransitionOrientationUpOver = cc.TRANSITION_ORIENTATION_UP_OVER
_G.kCCTransitionOrientationDownOver = cc.TRANSITION_ORIENTATION_DOWN_OVER
_G.kCCActionTagInvalid = cc.ACTION_TAG_INVALID
_G.kCCLabelAutomaticWidth = cc.LABEL_AUTOMATIC_WIDTH
_G.kCCMenuStateWaiting = cc.MENU_STATE_WAITING
_G.kCCMenuStateTrackingTouch = cc.MENU_STATE_TRACKING_TOUCH
_G.kCCMenuHandlerPriority = cc.MENU_HANDLER_PRIORITY
_G.kCCParticleDurationInfinity = cc.PARTICLE_DURATION_INFINITY
_G.kCCParticleStartSizeEqualToEndSize = cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE
_G.kCCParticleStartRadiusEqualToEndRadius = cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS
_G.kCCParticleModeGravity = cc.PARTICLE_MODE_GRAVITY
_G.kCCParticleModeRadius = cc.PARTICLE_MODE_RADIUS
_G.kCCPositionTypeFree = cc.POSITION_TYPE_FREE
_G.kCCPositionTypeRelative = cc.POSITION_TYPE_RELATIVE
_G.kCCPositionTypeGrouped = cc.POSITION_TYPE_GROUPED
_G.kCCProgressTimerTypeRadial = cc.PROGRESS_TIMER_TYPE_RADIAL
_G.kCCProgressTimerTypeBar = cc.PROGRESS_TIMER_TYPE_BAR
_G.kCCTMXTileHorizontalFlag = cc.TMX_TILE_HORIZONTAL_FLAG
_G.kCCTMXTileVerticalFlag = cc.TMX_TILE_VERTICAL_FLAG
_G.kCCTMXTileDiagonalFlag = cc.TMX_TILE_DIAGONAL_FLAG
_G.kCCFlipedAll = cc.FLIPED_ALL
_G.kCCFlippedMask = cc.FLIPPED_MASK
_G.kLanguageEnglish = cc.LANGUAGE_ENGLISH
_G.kLanguageChinese = cc.LANGUAGE_CHINESE
_G.kLanguageFrench = cc.LANGUAGE_FRENCH
_G.kLanguageItalian = cc.LANGUAGE_ITALIAN
_G.kLanguageGerman = cc.LANGUAGE_GERMAN
_G.kLanguageSpanish = cc.LANGUAGE_SPANISH
_G.kLanguageRussian = cc.LANGUAGE_RUSSIAN
_G.kLanguageKorean = cc.LANGUAGE_KOREAN
_G.kLanguageJapanese = cc.LANGUAGE_JAPANESE
_G.kLanguageHungarian = cc.LANGUAGE_HUNGARIAN
_G.kLanguagePortuguese = cc.LANGUAGE_PORTUGUESE
_G.kLanguageArabic = cc.LANGUAGE_ARABIC
_G.kTargetWindows = cc.PLATFORM_OS_WINDOWS
_G.kTargetLinux = cc.PLATFORM_OS_LINUX
_G.kTargetMacOS = cc.PLATFORM_OS_MAC
_G.kTargetAndroid = cc.PLATFORM_OS_ANDROID
_G.kTargetIphone = cc.PLATFORM_OS_IPHONE
_G.kTargetIpad = cc.PLATFORM_OS_IPAD
_G.kTargetBlackBerry = cc.PLATFORM_OS_BLACKBERRY
_G.GL_ZERO = gl.ZERO
_G.GL_ONE = gl.ONE
_G.GL_SRC_COLOR = gl.SRC_COLOR
_G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR
_G.GL_SRC_ALPHA = gl.SRC_ALPHA
_G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA
_G.GL_DST_ALPHA = gl.DST_ALPHA
_G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA
_G.GL_DST_COLOR = gl.DST_COLOR
_G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR
_G.GL_RENDERBUFFER_INTERNAL_FORMAT = gl.RENDERBUFFER_INTERNAL_FORMAT
_G.GL_LINE_WIDTH = gl.LINE_WIDTH
_G.GL_CONSTANT_ALPHA = gl.CONSTANT_ALPHA
_G.GL_BLEND_SRC_ALPHA = gl.BLEND_SRC_ALPHA
_G.GL_GREEN_BITS = gl.GREEN_BITS
_G.GL_STENCIL_REF = gl.STENCIL_REF
_G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA
_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
_G.GL_CCW = gl.CCW
_G.GL_MAX_TEXTURE_IMAGE_UNITS = gl.MAX_TEXTURE_IMAGE_UNITS
_G.GL_BACK = gl.BACK
_G.GL_ACTIVE_ATTRIBUTES = gl.ACTIVE_ATTRIBUTES
_G.GL_TEXTURE_CUBE_MAP_POSITIVE_X = gl.TEXTURE_CUBE_MAP_POSITIVE_X
_G.GL_STENCIL_BACK_VALUE_MASK = gl.STENCIL_BACK_VALUE_MASK
_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Z = gl.TEXTURE_CUBE_MAP_POSITIVE_Z
_G.GL_ONE = gl.ONE
_G.GL_TRUE = gl.TRUE
_G.GL_TEXTURE12 = gl.TEXTURE12
_G.GL_LINK_STATUS = gl.LINK_STATUS
_G.GL_BLEND = gl.BLEND
_G.GL_LESS = gl.LESS
_G.GL_TEXTURE16 = gl.TEXTURE16
_G.GL_BOOL_VEC2 = gl.BOOL_VEC2
_G.GL_KEEP = gl.KEEP
_G.GL_DST_COLOR = gl.DST_COLOR
_G.GL_VERTEX_ATTRIB_ARRAY_ENABLED = gl.VERTEX_ATTRIB_ARRAY_ENABLED
_G.GL_EXTENSIONS = gl.EXTENSIONS
_G.GL_FRONT = gl.FRONT
_G.GL_DST_ALPHA = gl.DST_ALPHA
_G.GL_ATTACHED_SHADERS = gl.ATTACHED_SHADERS
_G.GL_STENCIL_BACK_FUNC = gl.STENCIL_BACK_FUNC
_G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR
_G.GL_BLEND_EQUATION = gl.BLEND_EQUATION
_G.GL_RENDERBUFFER_DEPTH_SIZE = gl.RENDERBUFFER_DEPTH_SIZE
_G.GL_PACK_ALIGNMENT = gl.PACK_ALIGNMENT
_G.GL_VENDOR = gl.VENDOR
_G.GL_NEAREST_MIPMAP_LINEAR = gl.NEAREST_MIPMAP_LINEAR
_G.GL_TEXTURE_CUBE_MAP_POSITIVE_Y = gl.TEXTURE_CUBE_MAP_POSITIVE_Y
_G.GL_NEAREST = gl.NEAREST
_G.GL_RENDERBUFFER_WIDTH = gl.RENDERBUFFER_WIDTH
_G.GL_ARRAY_BUFFER_BINDING = gl.ARRAY_BUFFER_BINDING
_G.GL_ARRAY_BUFFER = gl.ARRAY_BUFFER
_G.GL_LEQUAL = gl.LEQUAL
_G.GL_VERSION = gl.VERSION
_G.GL_COLOR_CLEAR_VALUE = gl.COLOR_CLEAR_VALUE
_G.GL_RENDERER = gl.RENDERER
_G.GL_STENCIL_BACK_PASS_DEPTH_PASS = gl.STENCIL_BACK_PASS_DEPTH_PASS
_G.GL_STENCIL_BACK_PASS_DEPTH_FAIL = gl.STENCIL_BACK_PASS_DEPTH_FAIL
_G.GL_STENCIL_BACK_WRITEMASK = gl.STENCIL_BACK_WRITEMASK
_G.GL_BOOL = gl.BOOL
_G.GL_VIEWPORT = gl.VIEWPORT
_G.GL_FRAGMENT_SHADER = gl.FRAGMENT_SHADER
_G.GL_LUMINANCE = gl.LUMINANCE
_G.GL_DECR_WRAP = gl.DECR_WRAP
_G.GL_FUNC_ADD = gl.FUNC_ADD
_G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA
_G.GL_OUT_OF_MEMORY = gl.OUT_OF_MEMORY
_G.GL_BOOL_VEC4 = gl.BOOL_VEC4
_G.GL_POLYGON_OFFSET_FACTOR = gl.POLYGON_OFFSET_FACTOR
_G.GL_STATIC_DRAW = gl.STATIC_DRAW
_G.GL_DITHER = gl.DITHER
_G.GL_TEXTURE31 = gl.TEXTURE31
_G.GL_TEXTURE30 = gl.TEXTURE30
_G.GL_UNSIGNED_BYTE = gl.UNSIGNED_BYTE
_G.GL_DEPTH_COMPONENT16 = gl.DEPTH_COMPONENT16
_G.GL_TEXTURE23 = gl.TEXTURE23
_G.GL_DEPTH_TEST = gl.DEPTH_TEST
_G.GL_STENCIL_PASS_DEPTH_FAIL = gl.STENCIL_PASS_DEPTH_FAIL
_G.GL_BOOL_VEC3 = gl.BOOL_VEC3
_G.GL_POLYGON_OFFSET_UNITS = gl.POLYGON_OFFSET_UNITS
_G.GL_TEXTURE_BINDING_2D = gl.TEXTURE_BINDING_2D
_G.GL_TEXTURE21 = gl.TEXTURE21
_G.GL_UNPACK_ALIGNMENT = gl.UNPACK_ALIGNMENT
_G.GL_DONT_CARE = gl.DONT_CARE
_G.GL_BUFFER_SIZE = gl.BUFFER_SIZE
_G.GL_FLOAT_MAT3 = gl.FLOAT_MAT3
_G.GL_UNSIGNED_SHORT_5_6_5 = gl.UNSIGNED_SHORT_5_6_5
_G.GL_INT_VEC2 = gl.INT_VEC2
_G.GL_UNSIGNED_SHORT_4_4_4_4 = gl.UNSIGNED_SHORT_4_4_4_4
_G.GL_NONE = gl.NONE
_G.GL_BLEND_DST_ALPHA = gl.BLEND_DST_ALPHA
_G.GL_VERTEX_ATTRIB_ARRAY_SIZE = gl.VERTEX_ATTRIB_ARRAY_SIZE
_G.GL_SRC_COLOR = gl.SRC_COLOR
_G.GL_COMPRESSED_TEXTURE_FORMATS = gl.COMPRESSED_TEXTURE_FORMATS
_G.GL_STENCIL_ATTACHMENT = gl.STENCIL_ATTACHMENT
_G.GL_MAX_VERTEX_ATTRIBS = gl.MAX_VERTEX_ATTRIBS
_G.GL_NUM_COMPRESSED_TEXTURE_FORMATS = gl.NUM_COMPRESSED_TEXTURE_FORMATS
_G.GL_BLEND_EQUATION_RGB = gl.BLEND_EQUATION_RGB
_G.GL_TEXTURE = gl.TEXTURE
_G.GL_LINEAR_MIPMAP_LINEAR = gl.LINEAR_MIPMAP_LINEAR
_G.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
_G.GL_CURRENT_PROGRAM = gl.CURRENT_PROGRAM
_G.GL_COLOR_BUFFER_BIT = gl.COLOR_BUFFER_BIT
_G.GL_TEXTURE20 = gl.TEXTURE20
_G.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = gl.ACTIVE_ATTRIBUTE_MAX_LENGTH
_G.GL_TEXTURE28 = gl.TEXTURE28
_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
_G.GL_TEXTURE22 = gl.TEXTURE22
_G.GL_ELEMENT_ARRAY_BUFFER_BINDING = gl.ELEMENT_ARRAY_BUFFER_BINDING
_G.GL_STREAM_DRAW = gl.STREAM_DRAW
_G.GL_SCISSOR_BOX = gl.SCISSOR_BOX
_G.GL_TEXTURE26 = gl.TEXTURE26
_G.GL_TEXTURE27 = gl.TEXTURE27
_G.GL_TEXTURE24 = gl.TEXTURE24
_G.GL_TEXTURE25 = gl.TEXTURE25
_G.GL_NO_ERROR = gl.NO_ERROR
_G.GL_TEXTURE29 = gl.TEXTURE29
_G.GL_FLOAT_MAT4 = gl.FLOAT_MAT4
_G.GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = gl.VERTEX_ATTRIB_ARRAY_NORMALIZED
_G.GL_SAMPLE_COVERAGE_INVERT = gl.SAMPLE_COVERAGE_INVERT
_G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
_G.GL_FLOAT_VEC3 = gl.FLOAT_VEC3
_G.GL_STENCIL_CLEAR_VALUE = gl.STENCIL_CLEAR_VALUE
_G.GL_UNSIGNED_SHORT_5_5_5_1 = gl.UNSIGNED_SHORT_5_5_5_1
_G.GL_ACTIVE_UNIFORMS = gl.ACTIVE_UNIFORMS
_G.GL_INVALID_OPERATION = gl.INVALID_OPERATION
_G.GL_DEPTH_ATTACHMENT = gl.DEPTH_ATTACHMENT
_G.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS
_G.GL_FRAMEBUFFER_COMPLETE = gl.FRAMEBUFFER_COMPLETE
_G.GL_ONE_MINUS_CONSTANT_COLOR = gl.ONE_MINUS_CONSTANT_COLOR
_G.GL_TEXTURE2 = gl.TEXTURE2
_G.GL_TEXTURE1 = gl.TEXTURE1
_G.GL_GEQUAL = gl.GEQUAL
_G.GL_TEXTURE7 = gl.TEXTURE7
_G.GL_TEXTURE6 = gl.TEXTURE6
_G.GL_TEXTURE5 = gl.TEXTURE5
_G.GL_TEXTURE4 = gl.TEXTURE4
_G.GL_GENERATE_MIPMAP_HINT = gl.GENERATE_MIPMAP_HINT
_G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR
_G.GL_TEXTURE9 = gl.TEXTURE9
_G.GL_STENCIL_TEST = gl.STENCIL_TEST
_G.GL_COLOR_WRITEMASK = gl.COLOR_WRITEMASK
_G.GL_DEPTH_COMPONENT = gl.DEPTH_COMPONENT
_G.GL_STENCIL_INDEX8 = gl.STENCIL_INDEX8
_G.GL_VERTEX_ATTRIB_ARRAY_TYPE = gl.VERTEX_ATTRIB_ARRAY_TYPE
_G.GL_FLOAT_VEC2 = gl.FLOAT_VEC2
_G.GL_BLUE_BITS = gl.BLUE_BITS
_G.GL_VERTEX_SHADER = gl.VERTEX_SHADER
_G.GL_SUBPIXEL_BITS = gl.SUBPIXEL_BITS
_G.GL_STENCIL_WRITEMASK = gl.STENCIL_WRITEMASK
_G.GL_FLOAT_VEC4 = gl.FLOAT_VEC4
_G.GL_TEXTURE17 = gl.TEXTURE17
_G.GL_ONE_MINUS_CONSTANT_ALPHA = gl.ONE_MINUS_CONSTANT_ALPHA
_G.GL_TEXTURE15 = gl.TEXTURE15
_G.GL_TEXTURE14 = gl.TEXTURE14
_G.GL_TEXTURE13 = gl.TEXTURE13
_G.GL_SAMPLES = gl.SAMPLES
_G.GL_TEXTURE11 = gl.TEXTURE11
_G.GL_TEXTURE10 = gl.TEXTURE10
_G.GL_FUNC_SUBTRACT = gl.FUNC_SUBTRACT
_G.GL_STENCIL_BUFFER_BIT = gl.STENCIL_BUFFER_BIT
_G.GL_TEXTURE19 = gl.TEXTURE19
_G.GL_TEXTURE18 = gl.TEXTURE18
_G.GL_NEAREST_MIPMAP_NEAREST = gl.NEAREST_MIPMAP_NEAREST
_G.GL_SHORT = gl.SHORT
_G.GL_RENDERBUFFER_BINDING = gl.RENDERBUFFER_BINDING
_G.GL_REPEAT = gl.REPEAT
_G.GL_TEXTURE_MIN_FILTER = gl.TEXTURE_MIN_FILTER
_G.GL_RED_BITS = gl.RED_BITS
_G.GL_FRONT_FACE = gl.FRONT_FACE
_G.GL_BLEND_COLOR = gl.BLEND_COLOR
_G.GL_MIRRORED_REPEAT = gl.MIRRORED_REPEAT
_G.GL_INT_VEC4 = gl.INT_VEC4
_G.GL_MAX_CUBE_MAP_TEXTURE_SIZE = gl.MAX_CUBE_MAP_TEXTURE_SIZE
_G.GL_RENDERBUFFER_BLUE_SIZE = gl.RENDERBUFFER_BLUE_SIZE
_G.GL_SAMPLE_COVERAGE = gl.SAMPLE_COVERAGE
_G.GL_SRC_ALPHA = gl.SRC_ALPHA
_G.GL_FUNC_REVERSE_SUBTRACT = gl.FUNC_REVERSE_SUBTRACT
_G.GL_DEPTH_WRITEMASK = gl.DEPTH_WRITEMASK
_G.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT
_G.GL_POLYGON_OFFSET_FILL = gl.POLYGON_OFFSET_FILL
_G.GL_STENCIL_FUNC = gl.STENCIL_FUNC
_G.GL_REPLACE = gl.REPLACE
_G.GL_LUMINANCE_ALPHA = gl.LUMINANCE_ALPHA
_G.GL_DEPTH_RANGE = gl.DEPTH_RANGE
_G.GL_FASTEST = gl.FASTEST
_G.GL_STENCIL_FAIL = gl.STENCIL_FAIL
_G.GL_UNSIGNED_SHORT = gl.UNSIGNED_SHORT
_G.GL_RENDERBUFFER_HEIGHT = gl.RENDERBUFFER_HEIGHT
_G.GL_STENCIL_BACK_FAIL = gl.STENCIL_BACK_FAIL
_G.GL_BLEND_SRC_RGB = gl.BLEND_SRC_RGB
_G.GL_TEXTURE3 = gl.TEXTURE3
_G.GL_RENDERBUFFER = gl.RENDERBUFFER
_G.GL_RGB5_A1 = gl.RGB5_A1
_G.GL_RENDERBUFFER_ALPHA_SIZE = gl.RENDERBUFFER_ALPHA_SIZE
_G.GL_RENDERBUFFER_STENCIL_SIZE = gl.RENDERBUFFER_STENCIL_SIZE
_G.GL_NOTEQUAL = gl.NOTEQUAL
_G.GL_BLEND_DST_RGB = gl.BLEND_DST_RGB
_G.GL_FRONT_AND_BACK = gl.FRONT_AND_BACK
_G.GL_TEXTURE_BINDING_CUBE_MAP = gl.TEXTURE_BINDING_CUBE_MAP
_G.GL_MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE
_G.GL_ZERO = gl.ZERO
_G.GL_TEXTURE0 = gl.TEXTURE0
_G.GL_SAMPLE_ALPHA_TO_COVERAGE = gl.SAMPLE_ALPHA_TO_COVERAGE
_G.GL_BUFFER_USAGE = gl.BUFFER_USAGE
_G.GL_ACTIVE_TEXTURE = gl.ACTIVE_TEXTURE
_G.GL_BYTE = gl.BYTE
_G.GL_CW = gl.CW
_G.GL_DYNAMIC_DRAW = gl.DYNAMIC_DRAW
_G.GL_RENDERBUFFER_RED_SIZE = gl.RENDERBUFFER_RED_SIZE
_G.GL_FALSE = gl.FALSE
_G.GL_GREATER = gl.GREATER
_G.GL_RGBA4 = gl.RGBA4
_G.GL_VALIDATE_STATUS = gl.VALIDATE_STATUS
_G.GL_STENCIL_BITS = gl.STENCIL_BITS
_G.GL_RGB = gl.RGB
_G.GL_INT = gl.INT
_G.GL_DEPTH_FUNC = gl.DEPTH_FUNC
_G.GL_SAMPLER_2D = gl.SAMPLER_2D
_G.GL_NICEST = gl.NICEST
_G.GL_MAX_VIEWPORT_DIMS = gl.MAX_VIEWPORT_DIMS
_G.GL_CULL_FACE = gl.CULL_FACE
_G.GL_INT_VEC3 = gl.INT_VEC3
_G.GL_ALIASED_POINT_SIZE_RANGE = gl.ALIASED_POINT_SIZE_RANGE
_G.GL_INVALID_ENUM = gl.INVALID_ENUM
_G.GL_INVERT = gl.INVERT
_G.GL_CULL_FACE_MODE = gl.CULL_FACE_MODE
_G.GL_TEXTURE8 = gl.TEXTURE8
_G.GL_VERTEX_ATTRIB_ARRAY_POINTER = gl.VERTEX_ATTRIB_ARRAY_POINTER
_G.GL_TEXTURE_WRAP_S = gl.TEXTURE_WRAP_S
_G.GL_VERTEX_ATTRIB_ARRAY_STRIDE = gl.VERTEX_ATTRIB_ARRAY_STRIDE
_G.GL_LINES = gl.LINES
_G.GL_EQUAL = gl.EQUAL
_G.GL_LINE_LOOP = gl.LINE_LOOP
_G.GL_TEXTURE_WRAP_T = gl.TEXTURE_WRAP_T
_G.GL_DEPTH_BUFFER_BIT = gl.DEPTH_BUFFER_BIT
_G.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS
_G.GL_SHADER_TYPE = gl.SHADER_TYPE
_G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_X = gl.TEXTURE_CUBE_MAP_NEGATIVE_X
_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = gl.TEXTURE_CUBE_MAP_NEGATIVE_Y
_G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = gl.TEXTURE_CUBE_MAP_NEGATIVE_Z
_G.GL_DECR = gl.DECR
_G.GL_DELETE_STATUS = gl.DELETE_STATUS
_G.GL_DEPTH_BITS = gl.DEPTH_BITS
_G.GL_INCR = gl.INCR
_G.GL_SAMPLE_COVERAGE_VALUE = gl.SAMPLE_COVERAGE_VALUE
_G.GL_ALPHA_BITS = gl.ALPHA_BITS
_G.GL_FLOAT_MAT2 = gl.FLOAT_MAT2
_G.GL_LINE_STRIP = gl.LINE_STRIP
_G.GL_SHADER_SOURCE_LENGTH = gl.SHADER_SOURCE_LENGTH
_G.GL_INVALID_VALUE = gl.INVALID_VALUE
_G.GL_NEVER = gl.NEVER
_G.GL_INCR_WRAP = gl.INCR_WRAP
_G.GL_BLEND_EQUATION_ALPHA = gl.BLEND_EQUATION_ALPHA
_G.GL_TEXTURE_MAG_FILTER = gl.TEXTURE_MAG_FILTER
_G.GL_POINTS = gl.POINTS
_G.GL_COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0
_G.GL_RGBA = gl.RGBA
_G.GL_SRC_ALPHA_SATURATE = gl.SRC_ALPHA_SATURATE
_G.GL_SAMPLER_CUBE = gl.SAMPLER_CUBE
_G.GL_FRAMEBUFFER = gl.FRAMEBUFFER
_G.GL_TEXTURE_CUBE_MAP = gl.TEXTURE_CUBE_MAP
_G.GL_SAMPLE_BUFFERS = gl.SAMPLE_BUFFERS
_G.GL_LINEAR = gl.LINEAR
_G.GL_LINEAR_MIPMAP_NEAREST = gl.LINEAR_MIPMAP_NEAREST
_G.GL_ACTIVE_UNIFORM_MAX_LENGTH = gl.ACTIVE_UNIFORM_MAX_LENGTH
_G.GL_STENCIL_BACK_REF = gl.STENCIL_BACK_REF
_G.GL_ELEMENT_ARRAY_BUFFER = gl.ELEMENT_ARRAY_BUFFER
_G.GL_CLAMP_TO_EDGE = gl.CLAMP_TO_EDGE
_G.GL_TRIANGLE_STRIP = gl.TRIANGLE_STRIP
_G.GL_CONSTANT_COLOR = gl.CONSTANT_COLOR
_G.GL_COMPILE_STATUS = gl.COMPILE_STATUS
_G.GL_RENDERBUFFER_GREEN_SIZE = gl.RENDERBUFFER_GREEN_SIZE
_G.GL_UNSIGNED_INT = gl.UNSIGNED_INT
_G.GL_DEPTH_CLEAR_VALUE = gl.DEPTH_CLEAR_VALUE
_G.GL_ALIASED_LINE_WIDTH_RANGE = gl.ALIASED_LINE_WIDTH_RANGE
_G.GL_SHADING_LANGUAGE_VERSION = gl.SHADING_LANGUAGE_VERSION
_G.GL_FRAMEBUFFER_UNSUPPORTED = gl.FRAMEBUFFER_UNSUPPORTED
_G.GL_INFO_LOG_LENGTH = gl.INFO_LOG_LENGTH
_G.GL_STENCIL_PASS_DEPTH_PASS = gl.STENCIL_PASS_DEPTH_PASS
_G.GL_STENCIL_VALUE_MASK = gl.STENCIL_VALUE_MASK
_G.GL_ALWAYS = gl.ALWAYS
_G.GL_MAX_TEXTURE_SIZE = gl.MAX_TEXTURE_SIZE
_G.GL_FLOAT = gl.FLOAT
_G.GL_FRAMEBUFFER_BINDING = gl.FRAMEBUFFER_BINDING
_G.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
_G.GL_TRIANGLE_FAN = gl.TRIANGLE_FAN
_G.GL_INVALID_FRAMEBUFFER_OPERATION = gl.INVALID_FRAMEBUFFER_OPERATION
_G.GL_TEXTURE_2D = gl.TEXTURE_2D
_G.GL_ALPHA = gl.ALPHA
_G.GL_CURRENT_VERTEX_ATTRIB = gl.CURRENT_VERTEX_ATTRIB
_G.GL_SCISSOR_TEST = gl.SCISSOR_TEST
_G.GL_TRIANGLES = gl.TRIANGLES
| mit |
m241dan/darkstar | scripts/zones/Garlaige_Citadel/npcs/qm10.lua | 13 | 1364 | -----------------------------------
-- Area: Garlaige Citadel
-- NPC: qm10 (???)
-- Involved in Quest: Hitting the Marquisate (THF AF3)
-- @pos -139.895 -5.500 154.513 200
-----------------------------------
package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/Garlaige_Citadel/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local hittingTheMarquisateHagainCS = player:getVar("hittingTheMarquisateHagainCS");
if (hittingTheMarquisateHagainCS == 6) then
player:messageSpecial(PRESENCE_FROM_CEILING);
player:setVar("hittingTheMarquisateHagainCS",7);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
ducseb/domoticz | scripts/dzVents/runtime/TimedCommand.lua | 5 | 2481 | local scriptPath = _G.globalvariables['script_path']
package.path = package.path .. ';' .. scriptPath .. '?.lua'
local utils = require('Utils')
-- generic 'switch' class with timed options
-- supports chainging like:
-- switch(v1).for_min(v2).after_sec/min(v3)
-- switch(v1).within_min(v2).for_min(v3)
-- switch(v1).after_sec(v2).for_min(v3)
local function deprecationWarning(msg)
utils.log(msg, utils.LOG_ERROR)
end
local function TimedCommand(domoticz, name, value)
local valueValue = value
local afterValue, forValue, randomValue
local constructCommand = function()
local command = {} -- array of command parts
table.insert(command, valueValue)
if (randomValue ~= nil) then
table.insert(command, 'RANDOM ' .. tostring(randomValue))
end
if (afterValue ~= nil) then
table.insert(command, 'AFTER ' .. tostring(afterValue))
end
if (forValue ~= nil) then
table.insert(command, 'FOR ' .. tostring(forValue))
end
local sCommand = table.concat(command, " ")
utils.log('Constructed timed-command: ' .. sCommand, utils.LOG_DEBUG)
return sCommand
end
-- get a reference to the latest entry in the commandArray so we can
-- keep modifying it here.
local latest, command, sValue = domoticz.sendCommand(name, constructCommand())
return {
['_constructCommand'] = constructCommand, -- for testing purposes
['_latest'] = latest, -- for testing purposes
['afterSec'] = function(seconds)
afterValue = seconds
latest[command] = constructCommand()
return {
['forMin'] = function(minutes)
forValue = minutes
latest[command] = constructCommand()
end
}
end,
['afterMin'] = function(minutes)
afterValue = minutes * 60
latest[command] = constructCommand()
return {
['forMin'] = function(minutes)
forValue = minutes
latest[command] = constructCommand()
end
}
end,
['forMin'] = function(minutes)
forValue = minutes
latest[command] = constructCommand()
return {
['afterSec'] = function(seconds)
afterValue = seconds
latest[command] = constructCommand()
end,
['afterMin'] = function(minutes)
afterValue = minutes * 60
latest[command] = constructCommand()
end
}
end,
['withinMin'] = function(minutes)
randomValue = minutes
latest[command] = constructCommand()
return {
['forMin'] = function(minutes)
forValue = minutes
latest[command] = constructCommand()
end
}
end
}
end
return TimedCommand | gpl-3.0 |
m241dan/darkstar | scripts/zones/Cape_Teriggan/npcs/Cermet_Headstone.lua | 13 | 4123 | -----------------------------------
-- Area: Cape Teriggan
-- NPC: Cermet Headstone
-- Involved in Mission: ZM5 Headstone Pilgrimage (Wind Headstone)
-- @pos -107 -8 450 113
-----------------------------------
package.loaded["scripts/zones/Cape_Teriggan/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/titles");
require("scripts/globals/missions");
require("scripts/zones/Cape_Teriggan/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(949,1) and trade:getItemCount() == 1) then
if (player:getCurrentMission(ZILART) == HEADSTONE_PILGRIMAGE and player:hasKeyItem(WIND_FRAGMENT) and player:hasCompleteQuest(OUTLANDS,WANDERING_SOULS) == false) then
player:addQuest(OUTLANDS,WANDERING_SOULS);
player:startEvent(0x00CA,949);
elseif (player:hasCompletedMission(ZILART,HEADSTONE_PILGRIMAGE) and player:hasCompleteQuest(OUTLANDS,WANDERING_SOULS) == false) then
player:addQuest(OUTLANDS,WANDERING_SOULS);
player:startEvent(0x00CA,949);
else
player:messageSpecial(NOTHING_HAPPENS);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(ZILART) == HEADSTONE_PILGRIMAGE) then
-- if requirements are met and 15 mins have passed since mobs were last defeated, spawn them
if (player:hasKeyItem(WIND_FRAGMENT) == false and GetServerVariable("[ZM4]Wind_Headstone_Active") < os.time()) then
player:startEvent(0x00C8,WIND_FRAGMENT);
-- if 15 min window is open and requirements are met, recieve key item
elseif (player:hasKeyItem(WIND_FRAGMENT) == false and GetServerVariable("[ZM4]Wind_Headstone_Active") > os.time()) then
player:addKeyItem(WIND_FRAGMENT);
-- Check and see if all fragments have been found (no need to check wind and dark frag)
if (player:hasKeyItem(ICE_FRAGMENT) and player:hasKeyItem(EARTH_FRAGMENT) and player:hasKeyItem(WATER_FRAGMENT) and
player:hasKeyItem(FIRE_FRAGMENT) and player:hasKeyItem(LIGHTNING_FRAGMENT) and player:hasKeyItem(LIGHT_FRAGMENT)) then
player:messageSpecial(FOUND_ALL_FRAGS,WIND_FRAGMENT);
player:addTitle(BEARER_OF_THE_EIGHT_PRAYERS);
player:completeMission(ZILART,HEADSTONE_PILGRIMAGE);
player:addMission(ZILART,THROUGH_THE_QUICKSAND_CAVES);
else
player:messageSpecial(KEYITEM_OBTAINED,WIND_FRAGMENT);
end
else
player:messageSpecial(ALREADY_OBTAINED_FRAG,WIND_FRAGMENT);
end
elseif (player:hasCompletedMission(ZILART,HEADSTONE_PILGRIMAGE)) then
player:messageSpecial(ZILART_MONUMENT);
else
player:messageSpecial(CANNOT_REMOVE_FRAG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x00C8 and option == 1) then
SpawnMob(17240414,300):updateClaim(player); -- Axesarion the Wanderer
SetServerVariable("[ZM4]Wind_Headstone_Active",0);
elseif (csid == 0x00CA) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13248);
else
player:tradeComplete();
player:addItem(13248);
player:messageSpecial(ITEM_OBTAINED,13248);
player:completeQuest(OUTLANDS,WANDERING_SOULS);
player:addTitle(BEARER_OF_BONDS_BEYOND_TIME);
end
end
end; | gpl-3.0 |
camchenry/super_shooter | entities/ui/checkbox.lua | 1 | 2250 | Checkbox = class('Checkbox')
function Checkbox:initialize(text, x, y, w, h, fontSize, activated, deactivated)
self.text = text
self.font = fontSize or font[22]
self.x = x
self.y = y -- This centers it on the line
self.width = w or 32
self.height = h or 32
self.textHeight = self.font:getHeight(self.text)
self.color = {1, 1, 1}
self.active = {1, 1, 1}
self.hoverColor = {127/255, 127/255, 127/255}
self.textColor = {1, 1, 1}
self.selected = false
self.activated = activated or function() end
self.deactivated = deactivated or function() end
end
function Checkbox:update(dt)
end
function Checkbox:draw()
local r, g, b, a = love.graphics.getColor()
local oldColor = {r, g, b, a}
local oldFont = love.graphics.getFont()
love.graphics.setFont(self.font)
local x = self.x
local y = self.y - self.height/2
if self.selected then
love.graphics.setColor(self.active)
else
love.graphics.setColor(self.color)
end
love.graphics.rectangle("line", x, y, self.width, self.height)
if self.selected then
local margin = 5
love.graphics.rectangle("fill", self.x+margin, y+margin, self.width-margin*2, self.height-margin*2)
end
if self:hover() then
love.graphics.setColor(self.hoverColor)
else
love.graphics.setColor(self.textColor)
end
local textWidth = self.font:getWidth(self.text)
local textX = x + self.width + 10
local textY = self.y - self.textHeight/2
love.graphics.setFont(self.font)
textX, textY = math.floor(textX), math.floor(textY)
love.graphics.print(self.text, textX, textY)
love.graphics.setColor(oldColor)
love.graphics.setFont(oldFont)
end
function Checkbox:hover(x, y)
if x == nil then x = love.mouse.getX() end
if y == nil then y = love.mouse.getY() end
local xBoundMax = self.x + self.width + 10 + self.font:getWidth(self.text)
local xBoundMin = self.x
local yBoundMax = self.y + self.height/2
local yBoundMin = self.y - self.height/2
return x >= xBoundMin and x <= xBoundMax and y >= yBoundMin and y <= yBoundMax
end
function Checkbox:mousepressed(x, y)
if self:hover(x, y) then
-- toggle selected state
self.selected = not self.selected
if self.selected then
self.activated()
else
self.deactivated()
end
signal.emit('uiClick')
end
end
| mit |
m241dan/darkstar | scripts/zones/Quicksand_Caves/npcs/_5s8.lua | 13 | 1253 | -----------------------------------
-- Area: Quicksand Caves
-- NPC: Ornate Door
-- Door blocked by Weight system
-- @pos -334 0 659 208
-----------------------------------
package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Quicksand_Caves/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local difX = player:getXPos()-(-326);
local difZ = player:getZPos()-(660);
local Distance = math.sqrt( math.pow(difX,2) + math.pow(difZ,2) );
if (Distance < 3) then
return -1;
end
player:messageSpecial(DOOR_FIRMLY_SHUT);
return 1;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
m241dan/darkstar | scripts/zones/Abyssea-Uleguerand/Zone.lua | 33 | 1487 | -----------------------------------
--
-- Zone: Abyssea - Uleguerand
--
-----------------------------------
package.loaded["scripts/zones/Abyssea-Uleguerand/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Abyssea-Uleguerand/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-238, -40, -520.5, 0);
end
if (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_ACCEPTED
and player:getVar("1stTimeAyssea") == 0) then
player:setVar("1stTimeAyssea",1);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
hylthink/Sample_Lua | frameworks/cocos2d-x/external/lua/luajit/src/src/jit/bc.lua | 78 | 5606 | ----------------------------------------------------------------------------
-- LuaJIT bytecode listing module.
--
-- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
-- This module lists the bytecode of a Lua function. If it's loaded by -jbc
-- it hooks into the parser and lists all functions of a chunk as they
-- are parsed.
--
-- Example usage:
--
-- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)'
-- luajit -jbc=- foo.lua
-- luajit -jbc=foo.list foo.lua
--
-- Default output is to stderr. To redirect the output to a file, pass a
-- filename as an argument (use '-' for stdout) or set the environment
-- variable LUAJIT_LISTFILE. The file is overwritten every time the module
-- is started.
--
-- This module can also be used programmatically:
--
-- local bc = require("jit.bc")
--
-- local function foo() print("hello") end
--
-- bc.dump(foo) --> -- BYTECODE -- [...]
-- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello"
--
-- local out = {
-- -- Do something with each line:
-- write = function(t, ...) io.write(...) end,
-- close = function(t) end,
-- flush = function(t) end,
-- }
-- bc.dump(foo, out)
--
------------------------------------------------------------------------------
-- Cache some library functions and objects.
local jit = require("jit")
assert(jit.version_num == 20001, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local bit = require("bit")
local sub, gsub, format = string.sub, string.gsub, string.format
local byte, band, shr = string.byte, bit.band, bit.rshift
local funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck
local funcuvname = jutil.funcuvname
local bcnames = vmdef.bcnames
local stdout, stderr = io.stdout, io.stderr
------------------------------------------------------------------------------
local function ctlsub(c)
if c == "\n" then return "\\n"
elseif c == "\r" then return "\\r"
elseif c == "\t" then return "\\t"
else return format("\\%03d", byte(c))
end
end
-- Return one bytecode line.
local function bcline(func, pc, prefix)
local ins, m = funcbc(func, pc)
if not ins then return end
local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128)
local a = band(shr(ins, 8), 0xff)
local oidx = 6*band(ins, 0xff)
local op = sub(bcnames, oidx+1, oidx+6)
local s = format("%04d %s %-6s %3s ",
pc, prefix or " ", op, ma == 0 and "" or a)
local d = shr(ins, 16)
if mc == 13*128 then -- BCMjump
return format("%s=> %04d\n", s, pc+d-0x7fff)
end
if mb ~= 0 then
d = band(d, 0xff)
elseif mc == 0 then
return s.."\n"
end
local kc
if mc == 10*128 then -- BCMstr
kc = funck(func, -d-1)
kc = format(#kc > 40 and '"%.40s"~' or '"%s"', gsub(kc, "%c", ctlsub))
elseif mc == 9*128 then -- BCMnum
kc = funck(func, d)
if op == "TSETM " then kc = kc - 2^52 end
elseif mc == 12*128 then -- BCMfunc
local fi = funcinfo(funck(func, -d-1))
if fi.ffid then
kc = vmdef.ffnames[fi.ffid]
else
kc = fi.loc
end
elseif mc == 5*128 then -- BCMuv
kc = funcuvname(func, d)
end
if ma == 5 then -- BCMuv
local ka = funcuvname(func, a)
if kc then kc = ka.." ; "..kc else kc = ka end
end
if mb ~= 0 then
local b = shr(ins, 24)
if kc then return format("%s%3d %3d ; %s\n", s, b, d, kc) end
return format("%s%3d %3d\n", s, b, d)
end
if kc then return format("%s%3d ; %s\n", s, d, kc) end
if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits
return format("%s%3d\n", s, d)
end
-- Collect branch targets of a function.
local function bctargets(func)
local target = {}
for pc=1,1000000000 do
local ins, m = funcbc(func, pc)
if not ins then break end
if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end
end
return target
end
-- Dump bytecode instructions of a function.
local function bcdump(func, out, all)
if not out then out = stdout end
local fi = funcinfo(func)
if all and fi.children then
for n=-1,-1000000000,-1 do
local k = funck(func, n)
if not k then break end
if type(k) == "proto" then bcdump(k, out, true) end
end
end
out:write(format("-- BYTECODE -- %s-%d\n", fi.loc, fi.lastlinedefined))
local target = bctargets(func)
for pc=1,1000000000 do
local s = bcline(func, pc, target[pc] and "=>")
if not s then break end
out:write(s)
end
out:write("\n")
out:flush()
end
------------------------------------------------------------------------------
-- Active flag and output file handle.
local active, out
-- List handler.
local function h_list(func)
return bcdump(func, out)
end
-- Detach list handler.
local function bclistoff()
if active then
active = false
jit.attach(h_list)
if out and out ~= stdout and out ~= stderr then out:close() end
out = nil
end
end
-- Open the output file and attach list handler.
local function bcliston(outfile)
if active then bclistoff() end
if not outfile then outfile = os.getenv("LUAJIT_LISTFILE") end
if outfile then
out = outfile == "-" and stdout or assert(io.open(outfile, "w"))
else
out = stderr
end
jit.attach(h_list, "bc")
active = true
end
-- Public module functions.
module(...)
line = bcline
dump = bcdump
targets = bctargets
on = bcliston
off = bclistoff
start = bcliston -- For -j command line option.
| mit |
m241dan/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Pelftrix.lua | 13 | 1245 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Pelftrix
-- Standard Merchant NPC
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/zones/Windurst_Waters_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,PELFTRIX_SHOP_DIALOG);
stock = {0x1014,4500, -- Hi-Potion
0x1024,28000, -- Hi-Ether
0x03FC,300, -- Sickle
0x03FD,500} -- Hatchet
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
dvr333/Zero-K | LuaUI/Widgets/gfx_bloom_shader.lua | 6 | 17756 | function widget:GetInfo()
return {
name = "Bloom Shader",
desc = "Sets Spring In Bloom",
author = "Floris", -- orginal bloom shader: Kloot
date = "24-9-2016",
license = "",
layer = 9,
enabled = false,
}
end
--------------------------------------------------------------------------------
-- config
--------------------------------------------------------------------------------
local basicAlpha = 0.4
local drawHighlights = false -- apply extra bloom bright spots (note: quite costly)
local highlightsAlpha = 0.35
local dbgDraw = 0 -- debug: draw only the bloom-mask?
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local drawWorldAlpha = 0
local drawWorldPreUnitAlpha = 0
local usedBasicAlpha = basicAlpha
local camX, camY, camZ = Spring.GetCameraPosition()
local camDirX,camDirY,camDirZ = Spring.GetCameraDirection()
-- shader and texture handles
local blurShaderH71 = nil
local blurShaderV71 = nil
local brightShader = nil
local brightTexture1 = nil
local brightTexture2 = nil
local brightTexture3 = nil
local brightTexture4 = nil
local combineShader = nil
local screenTexture = nil
local screenTextureQuarter = nil
local screenTextureSixteenth = nil
-- speedups
local glCreateTexture = gl.CreateTexture
local glActiveTexture = gl.ActiveTexture
local glCopyToTexture = gl.CopyToTexture
local glRenderToTexture = gl.RenderToTexture
local glTexture = gl.Texture
local glTexRect = gl.TexRect
local glUseShader = gl.UseShader
local glUniformInt = gl.UniformInt
local glUniform = gl.Uniform
local glGetUniformLocation = gl.GetUniformLocation
local glGetActiveUniforms = gl.GetActiveUniforms
local GL_RGBA32F_ARB = 0x8814
local GL_RGB32F_ARB = 0x8815
local GL_ALPHA32F_ARB = 0x8816
local GL_INTENSITY32F_ARB = 0x8817
local GL_LUMINANCE32F_ARB = 0x8818
local GL_LUMINANCE_ALPHA32F_ARB = 0x8819
local GL_RGBA16F_ARB = 0x881A
local GL_RGB16F_ARB = 0x881B
local GL_ALPHA16F_ARB = 0x881C
local GL_INTENSITY16F_ARB = 0x881D
local GL_LUMINANCE16F_ARB = 0x881E
local GL_LUMINANCE_ALPHA16F_ARB = 0x881F
local GL_TEXTURE_RED_TYPE_ARB = 0x8C10
local GL_TEXTURE_GREEN_TYPE_ARB = 0x8C11
local GL_TEXTURE_BLUE_TYPE_ARB = 0x8C12
local GL_TEXTURE_ALPHA_TYPE_ARB = 0x8C13
local GL_TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14
local GL_TEXTURE_INTENSITY_TYPE_ARB = 0x8C15
local GL_TEXTURE_DEPTH_TYPE_ARB = 0x8C16
local GL_UNSIGNED_NORMALIZED_ARB = 0x8C17
-- shader uniform locations
local brightShaderText0Loc = nil
local brightShaderInvRXLoc = nil
local brightShaderInvRYLoc = nil
local brightShaderIllumLoc = nil
local blurShaderH51Text0Loc = nil
local blurShaderH51InvRXLoc = nil
local blurShaderH51FragLoc = nil
local blurShaderV51Text0Loc = nil
local blurShaderV51InvRYLoc = nil
local blurShaderV51FragLoc = nil
local blurShaderH71Text0Loc = nil
local blurShaderH71InvRXLoc = nil
local blurShaderH71FragLoc = nil
local blurShaderV71Text0Loc = nil
local blurShaderV71InvRYLoc = nil
local blurShaderV71FragLoc = nil
local combineShaderDebgDrawLoc = nil
local combineShaderTexture0Loc = nil
local combineShaderTexture1Loc = nil
local combineShaderIllumLoc = nil
local combineShaderFragLoc = nil
local illumThreshold = 0.33
local function SetIllumThreshold()
local ra, ga, ba = gl.GetSun("ambient")
local rd, gd, bd = gl.GetSun("diffuse")
local rs, gs, bs = gl.GetSun("specular")
local ambientIntensity = ra * 0.299 + ga * 0.587 + ba * 0.114
local diffuseIntensity = rd * 0.299 + gd * 0.587 + bd * 0.114
local specularIntensity = rs * 0.299 + gs * 0.587 + bs * 0.114
--Spring.Echo(ambientIntensity..' '..diffuseIntensity..' '..specularIntensity)
illumThreshold = (0.33 * ambientIntensity) + (0.05 * diffuseIntensity) + (0.05 * specularIntensity)
end
local function RemoveMe(msg)
Spring.Echo(msg)
--widgetHandler:RemoveWidget(self)
end
function reset()
--if not initialized then return end
if drawHighlights then
usedBasicAlpha = basicAlpha
drawWorldAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/11) + (0.018 * highlightsAlpha)
drawWorldPreUnitAlpha = 0.16 - (illumThreshold*0.4) + (usedBasicAlpha/6.2) + (0.023 * highlightsAlpha)
else
usedBasicAlpha = basicAlpha
drawWorldAlpha = 0.035 + (usedBasicAlpha/11)
drawWorldPreUnitAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/6)
end
gl.DeleteTexture(brightTexture1 or "")
gl.DeleteTexture(brightTexture2 or "")
if drawHighlights then
gl.DeleteTexture(brightTexture3 or "")
gl.DeleteTexture(brightTexture4 or "")
end
gl.DeleteTexture(screenTexture or "")
local btQuality = 4.6 -- high value creates flickering, but lower is more expensive
brightTexture1 = glCreateTexture(vsx/btQuality, vsy/btQuality, {
fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP,
})
brightTexture2 = glCreateTexture(vsx/btQuality, vsy/btQuality, {
fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP,
})
if drawHighlights then
btQuality = 3.2 -- high value creates flickering, but lower is more expensive
brightTexture3 = glCreateTexture(vsx/btQuality, vsy/btQuality, {
fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP,
})
brightTexture4 = glCreateTexture(vsx/btQuality, vsy/btQuality, {
fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP,
})
end
screenTexture = glCreateTexture(vsx, vsy, {
min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
})
screenTextureQuarter = glCreateTexture(vsx/2, vsy/2, {
min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
})
screenTextureSixteenth = glCreateTexture(vsx/4, vsy/4, {
min_filter = GL.LINEAR, mag_filter = GL.LINEAR,
})
end
function widget:ViewResize(viewSizeX, viewSizeY)
vsx,vsy = gl.GetViewSizes()
ivsx = 1.0 / vsx
ivsy = 1.0 / vsy
kernelRadius = vsy / 80.0
kernelRadius2 = vsy / 30.0
reset()
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:Update(dt)
if initialized == false then
return
end
camX, camY, camZ = Spring.GetCameraPosition()
camDirX,camDirY,camDirZ = Spring.GetCameraDirection()
end
function widget:DrawWorldPreUnit()
if initialized == false or drawWorldPreUnitAlpha <= 0.05 then
return
end
gl.PushMatrix()
gl.Color(0,0,0,drawWorldPreUnitAlpha)
gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360))
gl.Billboard()
gl.Rect(-500, -500, 500, 500)
gl.PopMatrix()
end
function widget:DrawWorld()
if initialized == false or drawWorldAlpha <= 0.05 then
return
end
gl.PushMatrix()
gl.Color(0,0,0,drawWorldAlpha)
gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360))
gl.Billboard()
gl.Rect(-500, -500, 500, 500)
gl.PopMatrix()
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local initialized = false
function widget:Initialize()
SetIllumThreshold()
WG['bloom'] = {}
WG['bloom'].getAdvBloom = function()
return drawHighlights
end
WG['bloom'].setAdvBloom = function(value)
drawHighlights = value
reset()
if initialized == false then
Spring.Echo('Bloom shader doesnt work (enable shaders: \'ForceShaders = 1\' in springsettings.cfg)')
end
end
WG['bloom'].getBrightness = function()
return basicAlpha
end
WG['bloom'].setBrightness = function(value)
basicAlpha = value
reset()
if initialized == false then
Spring.Echo('Bloom shader doesnt work (enable shaders: \'ForceShaders = 1\' in springsettings.cfg)')
end
end
if (gl.CreateShader == nil) then
RemoveMe("[BloomShader::Initialize] no shader support")
return
end
widget:ViewResize(widgetHandler:GetViewSizes())
combineShader = gl.CreateShader({
fragment = [[
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform float illuminationThreshold;
uniform float fragMaxBrightness;
uniform int debugDraw;
void main(void) {
vec2 C0 = vec2(gl_TexCoord[0]);
vec4 S0 = texture2D(texture0, C0);
vec4 S1 = texture2D(texture1, C0);
S1 = vec4(S1.rgb * fragMaxBrightness/max(1.0 - illuminationThreshold, 0.0001), 1.0);
gl_FragColor = bool(debugDraw) ? S1 : S0 + S1;
}
]],
uniformInt = { texture0 = 0, texture1 = 1, debugDraw = 0},
uniformFloat = {illuminationThreshold, fragMaxBrightness}
})
if (combineShader == nil) then
RemoveMe("[BloomShader::Initialize] combineShader compilation failed"); print(gl.GetShaderLog()); return
end
blurShaderH71 = gl.CreateShader({
fragment = [[
uniform sampler2D texture0;
uniform float inverseRX;
uniform float fragKernelRadius;
float bloomSigma = fragKernelRadius / 2.5;
void main(void) {
vec2 C0 = vec2(gl_TexCoord[0]);
vec4 S = texture2D(texture0, C0);
float weight = 1.0 / (2.50663 * bloomSigma);
float total_weight = weight;
S *= weight;
for (float r = 1.5; r < fragKernelRadius; r += 2)
{
weight = exp(-((r*r)/(2.0 * bloomSigma * bloomSigma)))/(2.50663 * bloomSigma);
S += texture2D(texture0, C0 - vec2(r * inverseRX, 0.0)) * weight;
S += texture2D(texture0, C0 + vec2(r * inverseRX, 0.0)) * weight;
total_weight += 2*weight;
}
gl_FragColor = vec4(S.rgb/total_weight, 1.0);
}
]],
uniformInt = {texture0 = 0},
uniformFloat = {inverseRX, fragKernelRadius}
})
if (blurShaderH71 == nil) then
RemoveMe("[BloomShader::Initialize] blurShaderH71 compilation failed"); print(gl.GetShaderLog()); return
end
blurShaderV71 = gl.CreateShader({
fragment = [[
uniform sampler2D texture0;
uniform float inverseRY;
uniform float fragKernelRadius;
float bloomSigma = fragKernelRadius / 2.5;
void main(void) {
vec2 C0 = vec2(gl_TexCoord[0]);
vec4 S = texture2D(texture0, C0);
float weight = 1.0 / (2.50663 * bloomSigma);
float total_weight = weight;
S *= weight;
for (float r = 1.5; r < fragKernelRadius; r += 2)
{
weight = exp(-((r*r)/(2.0 * bloomSigma * bloomSigma)))/(2.50663 * bloomSigma);
S += texture2D(texture0, C0 - vec2(0.0, r * inverseRY)) * weight;
S += texture2D(texture0, C0 + vec2(0.0, r * inverseRY)) * weight;
total_weight += 2*weight;
}
gl_FragColor = vec4(S.rgb/total_weight, 1.0);
}
]],
uniformInt = {texture0 = 0},
uniformFloat = {inverseRY, fragKernelRadius}
})
if (blurShaderV71 == nil) then
RemoveMe("[BloomShader::Initialize] blurShaderV71 compilation failed"); print(gl.GetShaderLog()); return
end
brightShader = gl.CreateShader({
fragment = [[
uniform sampler2D texture0;
uniform float illuminationThreshold;
uniform float inverseRX;
uniform float inverseRY;
void main(void) {
vec2 C0 = vec2(gl_TexCoord[0]);
vec3 color = vec3(texture2D(texture0, C0));
float illum = dot(color, vec3(0.2990, 0.5870, 0.1140));
if (illum > illuminationThreshold) {
gl_FragColor = vec4((color - color*(illuminationThreshold/max(illum, 0.00001))), 1.0);
} else {
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}
]],
uniformInt = {texture0 = 0},
uniformFloat = {illuminationThreshold, inverseRX, inverseRY}
})
if (brightShader == nil) then
RemoveMe("[BloomShader::Initialize] brightShader compilation failed"); print(gl.GetShaderLog()); return
end
brightShaderText0Loc = glGetUniformLocation(brightShader, "texture0")
brightShaderInvRXLoc = glGetUniformLocation(brightShader, "inverseRX")
brightShaderInvRYLoc = glGetUniformLocation(brightShader, "inverseRY")
brightShaderIllumLoc = glGetUniformLocation(brightShader, "illuminationThreshold")
blurShaderH71Text0Loc = glGetUniformLocation(blurShaderH71, "texture0")
blurShaderH71InvRXLoc = glGetUniformLocation(blurShaderH71, "inverseRX")
blurShaderH71FragLoc = glGetUniformLocation(blurShaderH71, "fragKernelRadius")
blurShaderV71Text0Loc = glGetUniformLocation(blurShaderV71, "texture0")
blurShaderV71InvRYLoc = glGetUniformLocation(blurShaderV71, "inverseRY")
blurShaderV71FragLoc = glGetUniformLocation(blurShaderV71, "fragKernelRadius")
combineShaderDebgDrawLoc = glGetUniformLocation(combineShader, "debugDraw")
combineShaderTexture0Loc = glGetUniformLocation(combineShader, "texture0")
combineShaderTexture1Loc = glGetUniformLocation(combineShader, "texture1")
combineShaderIllumLoc = glGetUniformLocation(combineShader, "illuminationThreshold")
combineShaderFragLoc = glGetUniformLocation(combineShader, "fragMaxBrightness")
initialized = true
end
function widget:Shutdown()
if initialized then
gl.DeleteTexture(brightTexture1 or "")
gl.DeleteTexture(brightTexture2 or "")
if drawHighlights then
gl.DeleteTexture(brightTexture3 or "")
gl.DeleteTexture(brightTexture4 or "")
end
gl.DeleteTexture(screenTexture or "")
if (gl.DeleteShader) then
gl.DeleteShader(brightShader or 0)
gl.DeleteShader(blurShaderH71 or 0)
gl.DeleteShader(blurShaderV71 or 0)
gl.DeleteShader(combineShader or 0)
end
end
WG['bloom'] = nil
end
local function mglDrawTexture(texUnit, tex, w, h, flipS, flipT)
glTexture(texUnit, tex)
glTexRect(0, 0, w, h, flipS, flipT)
glTexture(texUnit, false)
end
local function mglDrawFBOTexture(tex)
glTexture(tex)
glTexRect(-1, -1, 1, 1)
glTexture(false)
end
local function activeTextureFunc(texUnit, tex, w, h, flipS, flipT)
glTexture(texUnit, tex)
glTexRect(0, 0, w, h, flipS, flipT)
glTexture(texUnit, false)
end
local function mglActiveTexture(texUnit, tex, w, h, flipS, flipT)
glActiveTexture(texUnit, activeTextureFunc, texUnit, tex, w, h, flipS, flipT)
end
local function renderToTextureFunc(tex, s, t)
glTexture(tex)
glTexRect(-1 * s, -1 * t, 1 * s, 1 * t)
glTexture(false)
end
local function mglRenderToTexture(FBOTex, tex, s, t)
glRenderToTexture(FBOTex, renderToTextureFunc, tex, s, t)
end
local function Bloom()
gl.Color(1, 1, 1, 1)
glCopyToTexture(screenTexture, 0, 0, 0, 0, vsx, vsy)
-- global bloomin
glUseShader(brightShader)
glUniformInt(brightShaderText0Loc, 0)
glUniform( brightShaderInvRXLoc, ivsx)
glUniform( brightShaderInvRYLoc, ivsy)
glUniform( brightShaderIllumLoc, illumThreshold)
mglRenderToTexture(brightTexture1, screenTexture, 1, -1)
glUseShader(0)
for i = 1, 4 do
glUseShader(blurShaderH71)
glUniformInt(blurShaderH71Text0Loc, 0)
glUniform( blurShaderH71InvRXLoc, ivsx)
glUniform( blurShaderH71FragLoc, kernelRadius)
mglRenderToTexture(brightTexture2, brightTexture1, 1, -1)
glUseShader(0)
glUseShader(blurShaderV71)
glUniformInt(blurShaderV71Text0Loc, 0)
glUniform( blurShaderV71InvRYLoc, ivsy)
glUniform( blurShaderV71FragLoc, kernelRadius)
mglRenderToTexture(brightTexture1, brightTexture2, 1, -1)
glUseShader(0)
end
glUseShader(combineShader)
glUniformInt(combineShaderDebgDrawLoc, dbgDraw)
glUniformInt(combineShaderTexture0Loc, 0)
glUniformInt(combineShaderTexture1Loc, 1)
glUniform( combineShaderIllumLoc, illumThreshold)
glUniform( combineShaderFragLoc, usedBasicAlpha)
mglActiveTexture(0, screenTexture, vsx, vsy, false, true)
mglActiveTexture(1, brightTexture1, vsx, vsy, false, true)
glUseShader(0)
-- highlights
if drawHighlights then
glCopyToTexture(screenTexture, 0, 0, 0, 0, vsx, vsy)
glUseShader(brightShader)
glUniformInt(brightShaderText0Loc, 0)
glUniform( brightShaderInvRXLoc, ivsx)
glUniform( brightShaderInvRYLoc, ivsy)
glUniform( brightShaderIllumLoc, 0.5)
mglRenderToTexture(brightTexture3, screenTexture, 1, -1)
glUseShader(0)
for i = 1, 1 do
glUseShader(blurShaderH71)
glUniformInt(blurShaderH71Text0Loc, 0)
glUniform( blurShaderH71InvRXLoc, ivsx)
glUniform( blurShaderH71FragLoc, kernelRadius2)
mglRenderToTexture(brightTexture4, brightTexture3, 1, -1)
glUseShader(0)
glUseShader(blurShaderV71)
glUniformInt(blurShaderV71Text0Loc, 0)
glUniform( blurShaderV71InvRYLoc, ivsy)
glUniform( blurShaderV71FragLoc, kernelRadius2)
mglRenderToTexture(brightTexture3, brightTexture4, 1, -1)
glUseShader(0)
end
glUseShader(combineShader)
glUniformInt(combineShaderDebgDrawLoc, dbgDraw)
glUniformInt(combineShaderTexture0Loc, 0)
glUniformInt(combineShaderTexture1Loc, 1)
glUniform( combineShaderIllumLoc, illumThreshold*0.66)
glUniform( combineShaderFragLoc, highlightsAlpha)
mglActiveTexture(0, screenTexture, vsx, vsy, false, true)
mglActiveTexture(1, brightTexture3, vsx, vsy, false, true)
glUseShader(0)
end
end
function widget:DrawScreenEffects()
if initialized == false then return end
Bloom()
end
function widget:GetConfigData(data)
savedTable = {}
savedTable.basicAlpha = basicAlpha
savedTable.drawHighlights = drawHighlights
return savedTable
end
function widget:SetConfigData(data)
if data.basicAlpha ~= nil then
basicAlpha = data.basicAlpha
if data.highlightsAlpha ~= nil then
highlightsAlpha = data.highlightsAlpha
end
drawHighlights = data.drawHighlights
end
end
function widget:TextCommand(command)
if (string.find(command, "advbloom") == 1 and string.len(command) == 8) then
WG['bloom'].setAdvBloom(not drawHighlights)
if drawHighlights then
Spring.Echo('Adv bloom enabled')
else
Spring.Echo('Adv bloom disabled')
end
end
end
| gpl-2.0 |
dvr333/Zero-K | LuaRules/Configs/unit_category.lua | 6 | 1146 |
local hardcodedOthers = {
staticmissilesilo = true,
cloakjammer = true,
amphtele = true,
gunshiptrans = true,
gunshipheavytrans = true,
planescout = true
}
local function GetUnitCategory(unitDefID)
local ud = UnitDefs[unitDefID]
local cp = ud.customParams
local name = ud.name
if cp.dontcount or cp.is_drone then
return "dontcount"
end
if name == "staticarty" then
return "def"
end
if hardcodedOthers[name] then
return "other"
end
if cp.level then -- commander
return "other"
end
if cp.ismex or cp.income_energy or (cp.pylonrange and ((tonumber(cp.pylonrange) or 0) > 400)) or ud.energyStorage > 0 or ud.isBuilder then
return "econ"
end
if not ud.isImmobile then
return "army"
end
if string.find(name, "turret") or string.find(name, "shield") then
return "def"
end
return "other"
end
local saneCat = {
other = true,
army = true,
econ = true,
def = true,
}
local unitCategory = {}
local saneUnitCategory = {}
for i = 1, #UnitDefs do
local cat = GetUnitCategory(i)
unitCategory[i] = cat
if saneCat[cat] then
saneUnitCategory[i] = cat
end
end
return saneUnitCategory, unitCategory
| gpl-2.0 |
santssoft/darkstar | scripts/zones/Metalworks/npcs/Cid.lua | 9 | 12304 | -----------------------------------
-- Area: Metalworks
-- NPC: Cid
-- Starts & Finishes Quest: Cid's Secret, The Usual, Dark Puppet (start), Shoot First, Ask Questions Later
-- Involved in Mission: Bastok 7-1
-- !pos -12 -12 1 237
-----------------------------------
require("scripts/globals/keyitems")
require("scripts/globals/missions")
require("scripts/globals/quests")
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/titles")
require("scripts/globals/wsquest")
local ID = require("scripts/zones/Metalworks/IDs")
-----------------------------------
local wsQuest = dsp.wsquest.detonator
local function checkThreePaths(player)
if player:getCharVar("COP_Tenzen_s_Path") == 11 and player:getCharVar("COP_Ulmia_s_Path") == 8 and player:getCharVar("COP_Louverance_s_Path") == 10 then
player:completeMission(COP, dsp.mission.id.cop.THREE_PATHS)
player:addMission(COP, dsp.mission.id.cop.FOR_WHOM_THE_VERSE_IS_SUNG)
player:setCharVar("PromathiaStatus", 0)
end
end
function onTrade(player,npc,trade)
local wsQuestEvent = dsp.wsquest.getTradeEvent(wsQuest,player,trade)
if wsQuestEvent ~= nil then
player:startEvent(wsQuestEvent)
elseif (player:getCurrentMission(BASTOK) == dsp.mission.id.bastok.THE_CRYSTAL_LINE and player:getCharVar("MissionStatus") == 1) then
if (trade:getItemQty(613,1) and trade:getItemCount() == 1) then
player:startEvent(506)
end
end
end
function onTrigger(player,npc)
local wsQuestEvent = dsp.wsquest.getTriggerEvent(wsQuest,player)
local currentday = tonumber(os.date("%j"))
local CidsSecret = player:getQuestStatus(BASTOK,dsp.quest.id.bastok.CID_S_SECRET)
local LetterKeyItem = player:hasKeyItem(dsp.ki.UNFINISHED_LETTER)
local currentMission = player:getCurrentMission(BASTOK)
local currentCOPMission = player:getCurrentMission(COP)
local UlmiaPath = player:getCharVar("COP_Ulmia_s_Path")
local TenzenPath = player:getCharVar("COP_Tenzen_s_Path")
local LouverancePath = player:getCharVar("COP_Louverance_s_Path")
local TreePathAv = 0
if wsQuestEvent ~= nil then
player:startEvent(wsQuestEvent)
elseif (currentCOPMission == dsp.mission.id.cop.DAWN and player:getCharVar("PromathiaStatus")==3 and player:getCharVar("Promathia_kill_day")~=currentday and player:getCharVar("COP_tenzen_story")== 0 ) then
player:startEvent(897) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.CALM_BEFORE_THE_STORM and player:hasKeyItem(dsp.ki.LETTERS_FROM_ULMIA_AND_PRISHE) == false and player:getCharVar("COP_Dalham_KILL") == 2 and player:getCharVar("COP_Boggelmann_KILL") == 2 and player:getCharVar("Cryptonberry_Executor_KILL")==2) then
player:startEvent(892) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.FIRE_IN_THE_EYES_OF_MEN and player:getCharVar("PromathiaStatus")==2 and player:getCharVar("Promathia_CID_timer")~=VanadielDayOfTheYear()) then
player:startEvent(890) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.FIRE_IN_THE_EYES_OF_MEN and player:getCharVar("PromathiaStatus")==1) then
player:startEvent(857) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.ONE_TO_BE_FEARED and player:getCharVar("PromathiaStatus") == 0) then
player:startEvent(856) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THREE_PATHS and LouverancePath == 6 ) then
player:startEvent(852) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THREE_PATHS and LouverancePath == 9 ) then
if (TenzenPath==11 and UlmiaPath==8) then
TreePathAv=6
elseif (TenzenPath==11) then
TreePathAv=2
elseif (UlmiaPath==8) then
TreePathAv=4
else
TreePathAv=1
end
player:startEvent(853,TreePathAv) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THREE_PATHS and TenzenPath == 10 ) then
if (UlmiaPath==8 and LouverancePath==10) then
TreePathAv=5
elseif (LouverancePath==10) then
TreePathAv=3
elseif (UlmiaPath==8) then
TreePathAv=4
else
TreePathAv=1
end
player:startEvent(854,TreePathAv) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THREE_PATHS and UlmiaPath == 7 ) then
if (TenzenPath==11 and LouverancePath==10) then
TreePathAv=3
elseif (LouverancePath==10) then
TreePathAv=1
elseif (TenzenPath==11) then
TreePathAv=2
else
TreePathAv=0
end
player:startEvent(855,TreePathAv) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.DESIRES_OF_EMPTINESS and player:getCharVar("PromathiaStatus") > 8) then
player:startEvent(850) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THE_ENDURING_TUMULT_OF_WAR and player:getCharVar("PromathiaStatus")==1) then
player:startEvent(849) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THE_CALL_OF_THE_WYRMKING and player:getCharVar("PromathiaStatus")==1) then
player:startEvent(845) -- COP event
elseif (currentCOPMission == dsp.mission.id.cop.THE_ROAD_FORKS and player:getCharVar("EMERALD_WATERS_Status")== 7 and player:getCharVar("MEMORIES_OF_A_MAIDEN_Status")== 12) then --two paths are finished ?
player:startEvent(847) -- COP event 3.3
elseif (player:getMainJob() == dsp.job.DRK and player:getMainLvl() >= AF2_QUEST_LEVEL and player:getQuestStatus(BASTOK,dsp.quest.id.bastok.DARK_LEGACY) == QUEST_COMPLETED and player:getQuestStatus(BASTOK,dsp.quest.id.bastok.DARK_PUPPET) == QUEST_AVAILABLE) then
player:startEvent(760) -- Start Quest "Dark Puppet"
elseif (currentMission == dsp.mission.id.bastok.GEOLOGICAL_SURVEY) then
if (player:hasKeyItem(dsp.ki.RED_ACIDITY_TESTER)) then
player:startEvent(504)
elseif (player:hasKeyItem(dsp.ki.BLUE_ACIDITY_TESTER) == false) then
player:startEvent(503)
end
elseif (currentMission == dsp.mission.id.bastok.THE_CRYSTAL_LINE) then
if (player:hasKeyItem(dsp.ki.C_L_REPORTS)) then
player:showText(npc,ID.text.MISSION_DIALOG_CID_TO_AYAME)
else
player:startEvent(505)
end
elseif (currentMission == dsp.mission.id.bastok.THE_FINAL_IMAGE and player:getCharVar("MissionStatus") == 0) then
player:startEvent(763) -- Bastok Mission 7-1
elseif (currentMission == dsp.mission.id.bastok.THE_FINAL_IMAGE and player:getCharVar("MissionStatus") == 2) then
player:startEvent(764) -- Bastok Mission 7-1 (with Ki)
--Begin Cid's Secret
elseif (player:getFameLevel(BASTOK) >= 4 and CidsSecret == QUEST_AVAILABLE) then
player:startEvent(507)
elseif (CidsSecret == QUEST_ACCEPTED and LetterKeyItem == false and player:getCharVar("CidsSecret_Event") == 1) then
player:startEvent(508) --After talking to Hilda, Cid gives information on the item she needs
elseif (CidsSecret == QUEST_ACCEPTED and LetterKeyItem == false) then
player:startEvent(502) --Reminder dialogue from Cid if you have not spoken to Hilda
elseif (CidsSecret == QUEST_ACCEPTED and LetterKeyItem) then
player:startEvent(509)
--End Cid's Secret
else
player:startEvent(500) -- Standard Dialogue
end
end
-- 503 504 505 506 500 502 720 507 508 509 603 755 760 1010 763 764
-- 780 782 795 796 797 798 799 861 846 848 862 863 851 858 845 847
-- 849 850 852 853 854 855 856 857 868 869 883 884 890 891 892 893
-- 894 895 897 898
function onEventFinish(player,csid,option)
if (csid == 897) then
player:setCharVar("COP_tenzen_story",1)
elseif (csid == 892) then
player:addKeyItem(dsp.ki.LETTERS_FROM_ULMIA_AND_PRISHE)
player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.LETTERS_FROM_ULMIA_AND_PRISHE)
elseif (csid == 890) then
player:setCharVar("PromathiaStatus",0)
player:setCharVar("Promathia_CID_timer",0)
player:completeMission(COP,dsp.mission.id.cop.FIRE_IN_THE_EYES_OF_MEN)
player:addMission(COP,dsp.mission.id.cop.CALM_BEFORE_THE_STORM)
elseif (csid == 857) then
player:setCharVar("PromathiaStatus",2)
player:setCharVar("Promathia_CID_timer",VanadielDayOfTheYear())
elseif (csid == 855) then
player:setCharVar("COP_Ulmia_s_Path",8)
checkThreePaths(player)
elseif (csid == 854) then
player:setCharVar("COP_Tenzen_s_Path",11)
checkThreePaths(player)
elseif (csid == 853) then
player:setCharVar("COP_Louverance_s_Path",10)
if player:getCharVar("COP_Tenzen_s_Path") == 11 and player:getCharVar("COP_Ulmia_s_Path") == 8 then
player:addTitle(dsp.title.TRUE_COMPANION_OF_LOUVERANCE)
else
player:addTitle(dsp.title.COMPANION_OF_LOUVERANCE)
end
checkThreePaths(player)
elseif (csid == 852) then
player:setCharVar("COP_Louverance_s_Path",7)
elseif (csid == 850) then
player:setCharVar("PromathiaStatus",0)
player:completeMission(COP,dsp.mission.id.cop.DESIRES_OF_EMPTINESS)
player:addMission(COP,dsp.mission.id.cop.THREE_PATHS)
elseif (csid == 849) then
player:setCharVar("PromathiaStatus",2)
elseif (csid == 856) then
player:setCharVar("PromathiaStatus",1)
elseif (csid == 845) then
player:setCharVar("PromathiaStatus",0)
player:completeMission(COP,dsp.mission.id.cop.THE_CALL_OF_THE_WYRMKING)
player:addMission(COP,dsp.mission.id.cop.A_VESSEL_WITHOUT_A_CAPTAIN)
elseif (csid == 847) then
-- finishing mission 3.3 and all sub missions
player:setCharVar("EMERALD_WATERS_Status",0)
player:setCharVar("MEMORIES_OF_A_MAIDEN_Status",0)
player:completeMission(COP,dsp.mission.id.cop.THE_ROAD_FORKS)
player:addMission(COP,dsp.mission.id.cop.DESCENDANTS_OF_A_LINE_LOST)
player:completeMission(COP,dsp.mission.id.cop.DESCENDANTS_OF_A_LINE_LOST)
player:addMission(COP,dsp.mission.id.cop.COMEDY_OF_ERRORS_ACT_I)
player:completeMission(COP,dsp.mission.id.cop.COMEDY_OF_ERRORS_ACT_I)
player:addMission(COP,dsp.mission.id.cop.TENDING_AGED_WOUNDS ) --starting 3.4 COP mission
elseif (csid == 760) then
player:addQuest(BASTOK,dsp.quest.id.bastok.DARK_PUPPET)
player:setCharVar("darkPuppetCS",1)
elseif (csid == 503) then
player:addKeyItem(dsp.ki.BLUE_ACIDITY_TESTER)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.BLUE_ACIDITY_TESTER)
elseif (csid == 504 or csid == 764) then
finishMissionTimeline(player,1,csid,option)
elseif (csid == 505 and option == 0) then
if (player:getCharVar("MissionStatus") == 0) then
if (player:getFreeSlotsCount(0) >= 1) then
crystal = math.random(4096,4103)
player:addItem(crystal)
player:messageSpecial(ID.text.ITEM_OBTAINED, crystal)
player:setCharVar("MissionStatus",1)
else
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,crystal)
end
end
elseif (csid == 506 and option == 0) then
player:tradeComplete()
player:addKeyItem(dsp.ki.C_L_REPORTS)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.C_L_REPORTS)
elseif (csid == 763) then
player:setCharVar("MissionStatus",1)
elseif (csid == 507) then
player:addQuest(BASTOK,dsp.quest.id.bastok.CID_S_SECRET)
elseif (csid == 509) then
if (player:getFreeSlotsCount(0) >= 1) then
player:delKeyItem(dsp.ki.UNFINISHED_LETTER)
player:setCharVar("CidsSecret_Event",0)
player:addItem(13570)
player:messageSpecial(ID.text.ITEM_OBTAINED,13570) -- Ram Mantle
player:addFame(BASTOK,30)
player:completeQuest(BASTOK,dsp.quest.id.bastok.CID_S_SECRET)
else
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,13570)
end
else
dsp.wsquest.handleEventFinish(wsQuest,player,csid,option,ID.text.DETONATOR_LEARNED)
end
end
| gpl-3.0 |
RyUkApples/DarkRP | darkrp/server/player/login.lua | 1 | 12980 | -- Loading MySQL Class
require "resources/mysql-async/lib/MySQL"
telist = {}
local countItems = MySQL.Sync.fetchScalar("SELECT COUNT(1) FROM items")
RegisterServerEvent("darkrp:deleteTelist")
AddEventHandler("darkrp:deleteTelist", function(source)
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
tel = user:getTel()
telist[tel].IDsource = nil
else
TriggerEvent("darkrp:desyncMsg")
end
end)
end)
-- Get the status of the player, Dead or Alive
RegisterServerEvent("darkrp:updateAlivePlayer")
AddEventHandler("darkrp:updateAlivePlayer", function(alive_status)
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
user.status = alive_status
end)
end)
-- When the client dropped. It's here
AddEventHandler('playerDropped', function()
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
-- Try to alt F4 now ...
if user.status == "alive" then
user.status = nil
tel = user:getTel()
telist[tel].IDsource = nil
MySQL.Async.execute("UPDATE users SET `money`=@value WHERE identifier = @identifier",
{['@value'] = user.money, ['@identifier'] = user.identifier})
MySQL.Async.execute("UPDATE users SET `dirtymoney`=@value WHERE identifier = @identifier",
{['@value'] = user.dirtymoney, ['@identifier'] = user.identifier})
MySQL.Async.execute("UPDATE coordinates SET `x`=@valx,`y`=@valy,`z`=@valz WHERE identifier = @identifier",
{['@valx'] = user.coords.x, ['@valy'] = user.coords.y, ['@valz'] = user.coords.z, ['@identifier'] = user.identifier})
else
user.status = nil
tel = user:getTel()
telist[tel].IDsource = nil
MySQL.Async.execute("UPDATE users SET `money`=@value WHERE identifier = @identifier",
{['@value'] = 0, ['@identifier'] = user.identifier})
MySQL.Async.execute("UPDATE users SET `dirtymoney`=@value WHERE identifier = @identifier",
{['@value'] = 0, ['@identifier'] = user.identifier})
MySQL.Async.execute("UPDATE coordinates SET `x`=@valx,`y`=@valy,`z`=@valz WHERE identifier = @identifier",
{['@valx'] = config.hospital.x, ['@valy'] = config.hospital.y, ['@valz'] = config.hospital.z, ['@identifier'] = user.identifier})
end
else
TriggerEvent("darkrp:desyncMsg")
end
end)
end)
-- GET THE PHONEBOOK
RegisterServerEvent("darkrp:getPhonebook")
AddEventHandler("darkrp:getPhonebook", function(source)
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
LoadPhonebook(user.identifier, source)
else
TriggerEvent("darkrp:desyncMsg")
end
end)
end)
-- AND SEND IT TO THE CLIENT! BOIS IN THE PHONEBOOK!
function LoadPhonebook(identifier, source)
local phonebook = {}
MySQL.Async.fetchAll("SELECT * FROM phonebook JOIN users ON `phonebook`.`phonenumber` = `users`.`telephone` WHERE pidentifier = @username", { ['@username'] = identifier }, function (result)
if (result) then
for a, v in pairs(result) do
t = { ["nom"] = v.nom, ["prenom"] = v.prenom, ["identifier"] = a}
table.insert(phonebook, v.phonenumber, t)
end
end
TriggerClientEvent("tel:getPhonebook", source, phonebook)
end)
end
-- THIS IS WHERE WE LOAD THE INFO FROM THE DATABASE. IF YOU NEED IT IN THE MENU -> fivemenu
-- DON'T FORGET THE PLAYER CLASS! CREATE YOUR GETTER AND SETTER BOI!
function LoadUser(identifier, source, new)
MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @name", {['@name'] = identifier}, function (result)
MySQL.Async.fetchAll("SELECT * FROM coordinates WHERE identifier = @name", {['@name'] = identifier}, function (result1)
MySQL.Async.fetchAll("SELECT * FROM outfits WHERE identifier = @name", {['@name'] = identifier}, function (result2)
local group = groups[result[1].group]
Users[source] = Player(source, result[1].permission_level, result[1].money, result[1].identifier, group, result[1].dirtymoney, result[1].job, result[1].police, result[1].nom, result[1].prenom, result[1].telephone, { x = result1[1].x, y = result1[1].y, z = result1[1].z}, result2[1].skin)
local playerCountItems = MySQL.Sync.fetchScalar("SELECT COUNT(1) FROM user_inventory WHERE user_id = @username", { ['@username'] = identifier })
if playerCountItems ~= countItems then
for i=playerCountItems+1,countItems do
MySQL.Async.execute("INSERT INTO user_inventory (`user_id`, `item_id`, `quantity`) VALUES (@username, @item_id, '0')",
{['@username'] = identifier, ['@item_id'] = i})
end
end
-- THE ARRAY THAT WE WILL USE TO COMMUNICATE WITH CELLPHONE, OMAGGAD TECHNOLOGY
telist[result[1].telephone] = { IDsource = source }
-- LOADING THE PHONEBOOK OF THE PLAYER
LoadPhonebook(identifier, source)
-- LOADING STUFF AFTER LOADING PLAYER
TriggerEvent('darkrp:playerLoaded', source, Users[source])
TriggerClientEvent("darkrp:finishedLoading", source)
if(true)then
TriggerClientEvent('darkrp:setPlayerDecorator', source, 'rank', Users[source]:getPermissions())
end
if(true)then
TriggerEvent('darkrp:newPlayerLoaded', source, Users[source])
end
end)
end)
end)
end
function stringsplit(self, delimiter)
local a = self:Split(delimiter)
local t = {}
for i = 0, #a - 1 do
table.insert(t, a[i])
end
return t
end
-- PLEASE I HOPE WE CODED THIS FOR NOTHING.
function isIdentifierBanned(id)
local result = MySQL.Sync.fetchAll("SELECT * FROM bans WHERE banned = @name", {['@name'] = id})
if(#result > 0)then
return true
end
return false
end
AddEventHandler('darkrp:getPlayers', function(cb)
cb(Users)
end)
-- GET ONE
function hasAccount(identifier, callback)
local result = MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @name", {['@name'] = identifier}, function (result)
if(result[1] ~= nil) then
callback(true)
else
callback(false)
end
end)
end
-- YOU MUST
function isLoggedIn(source)
if(Users[GetPlayerName(source)] ~= nil)then
if(Users[GetPlayerName(source)]['isLoggedIn'] == 1) then
return true
else
return false
end
else
return false
end
end
-- REGISTER FOR LE DB
function registerUser(identifier, source)
hasAccount(identifier, function (result)
if not result then
--Telephone number
local telephone = tostring(generateTel(identifier))
-- Inserting Default User Account Stats
MySQL.Async.execute("INSERT INTO users (`identifier`, `permission_level`, `money`, `group`, `nom`, `prenom`, `telephone`) VALUES (@username, '0', @money, 'user', 'Citizen', 'Citizen', @telephone)",
{['@username'] = identifier, ['@telephone'] = telephone, ['@money'] = settings.defaultSettings.startingCash})
MySQL.Async.execute("INSERT INTO coordinates (`identifier`,`x`,`y`,`z`) VALUES (@identifier, @valx, @valy, @valz)",
{['@valx'] = settings.defaultSettings.spawnx, ['@valy'] = settings.defaultSettings.spawny, ['@valz'] = settings.defaultSettings.spawnz, ['@identifier'] = identifier})
-- SKIN PAR DÉFAUT
-- USELESS BUT NEEDED
MySQL.Async.execute("INSERT INTO outfits (`identifier`, `skin`, `face`, `face_text`, `hair`, `hair_text`, `pants`, `pants_text`, `shoes`, `shoes_text`, `torso`, `torso_text`, `shirt`, `shirt_text`, `three`, `three_text`, `seven`, `seven_text`) VALUES (@username, 'mp_m_freemode_01', '0', '0', '-1', '-1', '24', '5', '18', '0', '29', '5', '31', '0', '12', '0', '29', '2')",
{['@username'] = identifier, ['@money'] = settings.defaultSettings.startingCash})
-- INVENTAIRE VIDE
-- BUILDING AN EMPTY INVENTORY, NEED REWORK UGLY, IM DYING
for i=1,countItems do
MySQL.Async.execute("INSERT INTO user_inventory (`user_id`, `item_id`, `quantity`) VALUES (@username, @item_id, '0')",
{['@username'] = identifier, ['@item_id'] = i})
end
-- VOITURE PAR DÉFAUT
-- PLATE SYSTEM WITH SOCIAL CLUB ID TASTY AF
local L = #identifier - 4
local L1 = #identifier - 3
local L2 = #identifier - 2
local L3 = #identifier - 1
local plateveh = "CTZN" .. identifier[L] .. identifier[L1] .. identifier[L2] .. identifier[L3]
MySQL.Async.execute("INSERT INTO user_vehicle (`identifier`, `vehicle_name`, `vehicle_model`, `vehicle_price`, `vehicle_plate`, `vehicle_state`, `vehicle_colorprimary`, `vehicle_colorsecondary`, `vehicle_pearlescentcolor`, `vehicle_wheelcolor`) VALUES (@username, 'Faggio', 'faggio2', '4000',@plate, 'Rentré', '4', '0', '111', '156')",
{['@username'] = identifier, ['@plate'] = string.upper(plateveh)})
TriggerClientEvent("register:menu", source)
LoadUser(identifier, source, true)
else
LoadUser(identifier, source)
end
end)
end
AddEventHandler("darkrp:setPlayerData", function(user, k, v, cb)
if(Users[user])then
if(Users[user][k])then
if(k ~= "money") then
Users[user][k] = v
MySQL.Async.execute("UPDATE users SET @key=@value WHERE identifier = @identifier",
{['@key'] = k, ['@value'] = v, ['@identifier'] = Users[user]['identifier']})
end
if(k == "group")then
Users[user].group = groups[v]
end
cb("Player data edited.", true)
else
cb("Column does not exist!", false)
end
else
cb("User could not be found!", false)
end
end)
AddEventHandler("darkrp:setPlayerDataId", function(user, k, v, cb)
MySQL.Async.execute("UPDATE users SET @key=@value WHERE identifier = @identifier",
{['@key'] = k, ['@value'] = v, ['@identifier'] = user})
cb("Player data edited.", true)
end)
AddEventHandler("darkrp:getPlayerFromId", function(user, cb)
if(Users)then
if(Users[user])then
cb(Users[user])
else
cb(nil)
end
else
cb(nil)
end
end)
-- USELESS DOPE STUFF
AddEventHandler("darkrp:getPlayerFromIdentifier", function(identifier, cb)
MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @name", {['@name'] = identifier}, function (result)
if(result[1])then
cb(result[1])
else
cb(nil)
end
end)
end)
-- IF YOU NEED ALL THE PLAYERS
AddEventHandler("darkrp:getAllPlayers", function(cb)
MySQL.Async.fetchAll("SELECT * FROM users", {}, function (result)
if(result)then
cb(result)
else
cb(nil)
end
end)
end)
-- GENERATING A CELLPHONE NUMBER, WITH... SOCIAL CLUB ID OMGG AGAIN
function generateTel(identifier)
local tel = ""
for i = #identifier, 1, -1 do
local c = string.sub(identifier, i, i)
-- do something with c
if (#tel) < 8 then
c = tonumber(c)
if c ~= nil then
if string.len(tel) == 3 then
tel = tel .. "-"
end
c = tostring(c)
tel = tel .. c
end
end
end
return tel
end
-- GET PLATE NUMBER
RegisterServerEvent("darkrp:getVehPlate")
AddEventHandler("darkrp:getVehPlate", function()
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
TriggerClientEvent("darkrp:f_getVehPlate", source, user:getVehicle())
else
TriggerEvent("darkrp:desyncMsg")
end
end)
end)
-- GET THE PLAYER X Y Z READY TO BE SPAWNED
RegisterServerEvent("darkrp:requestingSpawnData")
AddEventHandler("darkrp:requestingSpawnData", function()
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
TriggerClientEvent("darkrp:sendingSpawnData", source, user:getCoords())
else
TriggerEvent("darkrp:desyncMsg")
end
end)
end)
-- Function to update player money every 60 seconds.
local function savePlayerMoney()
SetTimeout(600000, function()
TriggerEvent("darkrp:getPlayers", function(users)
for k,v in pairs(users)do
MySQL.Async.execute("UPDATE users SET `money`=@value WHERE identifier = @identifier",
{['@value'] = v.money, ['@identifier'] = v.identifier})
MySQL.Async.execute("UPDATE users SET `dirtymoney`=@value WHERE identifier = @identifier",
{['@value'] = v.dirtymoney, ['@identifier'] = v.identifier})
end
end)
savePlayerMoney()
end)
end
savePlayerMoney()
-- THE FUKED UP CODE THAT IS NOT SUPPOSE TO BE THERE BUT IT IS.
-- TELEPHONE -> TELIST
RegisterServerEvent("tel:sendingMsg")
AddEventHandler("tel:sendingMsg", function(msg, teldest)
local name = nil
local surname = nil
local origin = nil
TriggerEvent('darkrp:getPlayerFromId', source, function(user)
if (user) then
name = user:getNom()
surname = user:getPrenom()
origin = user:getTel()
else
TriggerEvent("darkrp:desyncMsg")
end
end)
if name ~= nil then
if telist[teldest] ~= nil then
if telist[teldest].IDsource ~= nil then
local player = telist[teldest].IDsource
local player2 = telist[origin].IDsource
TriggerClientEvent("tel:receivingMsg", player, msg, name, surname)
TriggerClientEvent("itinerance:notif", player2, "~g~ Message envoyé")
else
TriggerClientEvent("itinerance:notif", player2, "~r~ Le joueur n'est pas connecté")
end
else
TriggerClientEvent("itinerance:notif", player2, "~r~ Le joueur n'est pas connecté")
end
else
TriggerEvent("darkrp:desyncMsg")
end
end)
-- GET THE ID WITH THIS COOL FUNC
function getPlayerID(source)
local identifiers = GetPlayerIdentifiers(source)
local player = getIdentifiant(identifiers)
return player
end
function getIdentifiant(id)
for _, v in ipairs(id) do
return v
end
end
| mit |
ch3n2k/luci | modules/base/luasrc/ccache.lua | 82 | 1863 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local io = require "io"
local fs = require "nixio.fs"
local util = require "luci.util"
local nixio = require "nixio"
local debug = require "debug"
local string = require "string"
local package = require "package"
local type, loadfile = type, loadfile
module "luci.ccache"
function cache_ondemand(...)
if debug.getinfo(1, 'S').source ~= "=?" then
cache_enable(...)
end
end
function cache_enable(cachepath, mode)
cachepath = cachepath or "/tmp/luci-modulecache"
mode = mode or "r--r--r--"
local loader = package.loaders[2]
local uid = nixio.getuid()
if not fs.stat(cachepath) then
fs.mkdir(cachepath)
end
local function _encode_filename(name)
local encoded = ""
for i=1, #name do
encoded = encoded .. ("%2X" % string.byte(name, i))
end
return encoded
end
local function _load_sane(file)
local stat = fs.stat(file)
if stat and stat.uid == uid and stat.modestr == mode then
return loadfile(file)
end
end
local function _write_sane(file, func)
if nixio.getuid() == uid then
local fp = io.open(file, "w")
if fp then
fp:write(util.get_bytecode(func))
fp:close()
fs.chmod(file, mode)
end
end
end
package.loaders[2] = function(mod)
local encoded = cachepath .. "/" .. _encode_filename(mod)
local modcons = _load_sane(encoded)
if modcons then
return modcons
end
-- No cachefile
modcons = loader(mod)
if type(modcons) == "function" then
_write_sane(encoded, modcons)
end
return modcons
end
end
| apache-2.0 |
m241dan/darkstar | scripts/globals/mobskills/Dark_Wave.lua | 33 | 1185 | ---------------------------------------------
-- Dark Wave
--
-- Description: A wave of dark energy washes over targets in an area of effect. Additional effect: Bio
-- Type: Magical
-- Utsusemi/Blink absorb: Ignores shadows
-- Range: 10' radial
-- Notes: Severity of Bio effect varies by time of day, from 8/tic at midday to 20/tic at midnight.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local typeEffect = EFFECT_BIO;
local cTime = VanadielHour();
local power = 8;
if (12 <= cTime) then
local power = 8 + (cTime - 11);
end
MobStatusEffectMove(mob, target, typeEffect, power, 3, 60);
local dmgmod = 1;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*5,ELE_DARK,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_DARK,MOBPARAM_IGNORE_SHADOWS);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
dvr333/Zero-K | effects/gundam_330rlexplode.lua | 6 | 5722 | -- 330rlexplode
-- 165rlexplode
local baseExplode = {
dirt = {
count = 4,
ground = true,
properties = {
alphafalloff = 2,
color = [[0.2, 0.1, 0.05]],
pos = [[r-10 r10, 0, r-10 r10]],
size = 22,
speed = [[r1.5 r-1.5, 4, r1.5 r-1.5]],
},
},
dirtw1 = {
class = [[CSimpleParticleSystem]],
count = 1,
water = true,
properties = {
airdrag = 0.9,
alwaysvisible = true,
colormap = [[0.9 0.9 0.9 1.0 0.3 0.3 0.3 0.0]],
directional = true,
emitrot = 80,
emitrotspread = 0,
emitvector = [[0, 1, 0]],
gravity = [[0, -0.08, 0]],
numparticles = 28,
particlelife = 20,
particlelifespread = 6,
particlesize = 10,
particlesizespread = 5,
particlespeed = 10,
particlespeedspread = 12,
pos = [[r-1 r1, 1, r-1 r1]],
sizegrowth = 1.18,
sizemod = 1.0,
texture = [[randdots]],
useairlos = true,
},
},
dirtw2 = {
class = [[CSimpleParticleSystem]],
count = 1,
water = true,
properties = {
airdrag = 0.7,
alwaysvisible = true,
colormap = [[1.0 1.0 1.0 1.0 0.5 0.5 0.8 0.4 0.3 0.3 0.4 0.1 0.1 0.1 0.16 0.0]],
directional = true,
emitrot = 90,
emitrotspread = 0,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 10,
particlelife = 15,
particlelifespread = 10,
particlesize = 35,
particlesizespread = 5,
particlespeed = 10,
particlespeedspread = 10,
pos = [[r-1 r1, 1, r-1 r1]],
sizegrowth = 1.2,
sizemod = 1.0,
texture = [[dirt]],
useairlos = true,
},
},
flare = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
properties = {
airdrag = 0.8,
alwaysvisible = true,
colormap = [[1 1 1 0.01 0.9 0.8 0.7 0.04 0.9 0.5 0.2 0.01 0.5 0.1 0.1 0.01]],
directional = true,
emitrot = 45,
emitrotspread = 32,
emitvector = [[0, 1, 0]],
gravity = [[0, -0.01, 0]],
numparticles = 8,
particlelife = 14,
particlelifespread = 0,
particlesize = 70,
particlesizespread = 0,
particlespeed = 10,
particlespeedspread = 5,
pos = [[0, 2, 0]],
sizegrowth = 1,
sizemod = 1.0,
texture = [[flashside1]],
useairlos = false,
},
},
groundflash = {
air = true,
alwaysvisible = true,
circlealpha = 0.5,
circlegrowth = 8,
flashalpha = 0.9,
flashsize = 150,
ground = true,
ttl = 17,
water = true,
color = {
[1] = 1,
[2] = 0.5,
[3] = 0.20000000298023,
},
},
pop1 = {
air = true,
class = [[heatcloud]],
count = 2,
ground = true,
water = true,
properties = {
alwaysvisible = true,
heat = 10,
heatfalloff = 1.4,
maxheat = 15,
pos = [[r-2 r2, 5, r-2 r2]],
size = 5,
sizegrowth = 24,
speed = [[0, 1 0, 0]],
texture = [[redexplo]],
},
},
whiteglow = {
air = true,
class = [[heatcloud]],
count = 1,
ground = true,
water = true,
properties = {
alwaysvisible = true,
heat = 10,
heatfalloff = 1.1,
maxheat = 15,
pos = [[r-2 r2, 5, r-2 r2]],
size = 10,
sizegrowth = 25,
speed = [[0, 1 0, 0]],
texture = [[laserend]],
},
},
}
local halfExplode = Spring.Utilities.MergeTable({
dirt = {
count = 2,
properties = {
pos = [[r-5 r5, 0, r-5 r5]],
size = 14,
speed = [[r1.5 r-1.5, 4, r1.5 r-1.5]],
},
},
dirtw1 = {
properties = {
numparticles = 10,
particlesize = 6,
particlesizespread = 4,
particlespeed = 6,
particlespeedspread = 6,
},
},
dirtw2 = {
properties = {
numparticles = 6,
particlesize = 18,
particlesizespread = 5,
particlespeed = 6,
particlespeedspread = 6,
},
},
flare = {
properties = {
numparticles = 6,
particlesize = 36,
particlesizespread = 0,
particlespeed = 6,
particlespeedspread = 3,
},
},
groundflash = {
flashsize = 76,
ttl = 15,
},
pop1 = {
properties = {
size = 2.8,
sizegrowth = 12,
},
},
whiteglow = {
properties = {
size = 8,
sizegrowth = 14,
},
},
}, baseExplode)
return {
["330rlexplode"] = baseExplode,
["165rlexplode"] = halfExplode,
}
| gpl-2.0 |
grrk-bzzt/kq-fork | scripts/dville.lua | 1 | 12295 | -- dville - "Denorian village southeast of Oracle's tower"
-- /*
-- {
-- progress.denorian: Status of the stolen statue
-- (0) You just got there; statue is gone
-- (1) If you refuse after you hear their plea, you are kicked out of town
-- (2) You've agreed to help
-- (3) You found Demnas (but not the troll)
-- (4) You found the troll, too
-- (5) The broken statue is returned to the village
-- (6) The 2nd half of the statue is returned (not done)
-- }
-- */
function autoexec()
return
end
function entity_handler(en)
local CorinInParty = 0, cp
-- Anyone except head of town council kicks you out if you refuse to help
if (progress.denorian == 1 and en ~= 7) then
bubble(en, _"You're not welcome here!")
change_map("main", "dville")
return
end
if (en == 0) then
if (progress.denorian < 5) then
bubble(en, _"Who would want to steal from us?")
elseif (progress.denorian == 5) then
bubble(en, _"I thought as much.")
else
bubble(en, _"We are so happy to have the statue whole once again!")
end
elseif (en == 1) then
if (progress.denorian < 5) then
bubble(en, _"This is terrible.")
elseif (progress.denorian == 5) then
bubble(en, _"I'm glad the troll isn't a threat to us anymore.")
else
bubble(en, _"I'm glad that's over.")
end
elseif (en == 2) then
bubble(en, _"That statue was given to the village after the evil Kalatos was defeated in the Great War.")
elseif (en == 3) then
if (progress.denorian < 5) then
bubble(en, _"The village council says that it was a troll who stole the statue. What's a troll?")
elseif (progress.denorian == 5) then
bubble(en, _"Mommy told me what a troll is. That's so scary!")
else
bubble(en, _"The statue is home.")
end
elseif (en == 4) then
if (progress.denorian < 5) then
bubble(en, _"Apparently, there has not been a troll spotted in these parts since the Great War.")
elseif (progress.denorian == 5) then
bubble(en, _"I wonder if our village is really safe?")
else
bubble(en, _"I feel so much more secure now. Thank you for everything you've done!")
end
elseif (en == 5) then
if (progress.denorian < 5) then
bubble(en, _"I can't believe this has happened to us. We are a peaceful people.")
elseif (progress.denorian == 5) then
bubble(en, _"Now, what to make for supper.")
else
bubble(en, _"Thank you for restoring peace to our people.")
end
elseif (en == 6) then
if (progress.denorian < 5) then
bubble(en, _"Where did our statue go?")
elseif (progress.denorian == 5) then
bubble(en, _"Things can get back to normal now.")
else
bubble(en, _"I've lost my hat. I should go ask the statue where to look.")
end
elseif (en == 7) then
LOC_council(en)
elseif (en == 8) then
if (progress.denorian == 0) then
bubble(en, _"This fellow sitting with me is the head of the village council. You should speak with him.")
elseif (progress.denorian < 5) then
bubble(en, _"Good luck.")
elseif (progress.denorian == 5) then
bubble(en, _"We shall put the statue back as soon as it's whole again!")
else
bubble(en, _"Thanks again.")
end
elseif (en == 9) then
if (progress.denorian == 0) then
bubble(en, _"You should hear what the head of the village council has to say.")
elseif (progress.denorian < 5) then
bubble(en, _"Good luck.")
elseif (progress.denorian == 5) then
bubble(en, _"It's a relief to have our treasured statue in our hands again.")
else
bubble(en, _"Thanks again.")
end
elseif (en == 10) then
if (progress.denorian == 0) then
bubble(en, _"We hope you will help us.")
elseif (progress.denorian < 5) then
bubble(en, _"Good luck.")
elseif (progress.denorian == 5) then
bubble(en, _"Although it's broken, the statue still means everything to us.")
else
bubble(en, _"Oh, it's wonderful to have the whole statue again!")
end
elseif (en == 11) then
if (progress.denorian < 5) then
bubble(en, _"This is where the statue was taken from.")
elseif (progress.denorian == 5) then
bubble(en, _"We'll put the statue back here once we have the whole thing.")
else
bubble(en, _"Thank you for getting our statue back!")
end
elseif (en == 12) then
if (progress.denorian < 5) then
bubble(en, _"Less council meetings, more cooking!")
elseif (progress.denorian == 5) then
bubble(en, _"Food always tastes better when it's cooked. Except icecream.")
else
bubble(en, _"Let the cookfires burn!")
end
elseif (en == 13) then
if (progress.denorian < 5) then
bubble(en, _"Geez, I wish I was old enough to go after that smelly old troll! I'd show him a thing or two.")
elseif (progress.denorian == 5) then
bubble(en, _"Nerakians? Where are they from?")
else
bubble(en, _"It would be cool to control monsters with your thoughts! ZAAAP!")
end
elseif (en == 14) then
if (progress.denorian < 5) then
bubble(en, _"The council is having another meeting about what to do to get back our statue.")
elseif (progress.denorian == 5) then
bubble(en, _"I think a celebration is in order.")
else
bubble(en, _"Ah, even more reason to celebrate!")
end
elseif (en == 15) then
if (progress.denorian < 5) then
bubble(en, _"You should find the council's hut. They are looking for people to help get the statue back.")
elseif (progress.denorian == 5) then
bubble(en, _"The council can relax now. Thank you.")
else
bubble(en, _"It sure would be nice to have a little more excitement around here. It's too... boring.")
end
end
end
function postexec()
return
end
function zone_handler(zn)
if (zn == 1) then
change_map("main", "dville")
elseif (zn == 2) then
bubble(HERO1, _"Locked.")
elseif (zn == 3) then
door_in("room_1i")
elseif (zn == 4) then
door_in("room_2i")
elseif (zn == 5) then
door_in("room_3i")
elseif (zn == 6) then
door_in("room_4i")
elseif (zn == 7) then
door_in("room_5i")
elseif (zn == 8) then
door_in("room_6i")
elseif (zn == 9) then
door_out("room_1o")
elseif (zn == 10) then
door_out("room_2o")
elseif (zn == 11) then
door_out("room_3o")
elseif (zn == 12) then
door_out("room_4o")
elseif (zn == 13) then
door_out("room_5o")
elseif (zn == 14) then
door_out("room_6o")
elseif (zn == 15) then
touch_fire(party[0])
end
end
function LOC_council(en)
if (progress.denorian == 0) then
bubble(en, _"The council would like to ask for your help in retrieving our statue. We will tell you what we know.")
if (prompt(en, 2, 0, "However, I must first ask if",
"you are willing to help us?",
" yes",
" no") == 0) then
LOC_trollstory(en)
else
bubble(en, _"I see. Well, then you should be on your way then. My people will show you out.")
progress.denorian = 1
change_map("main", "dville")
end
elseif (progress.denorian == 1) then
if (prompt(en, 2, 0, "Have you changed your mind?",
" yes",
" no") == 0) then
LOC_trollstory(en)
else
bubble(en, _"I thought as much. Begone!")
change_map("main", "dville")
end
elseif (progress.denorian == 2) then
bubble(en, _"Good luck.")
elseif (progress.denorian == 3 or
progress.denorian == 4) then
bubble(en, _"This is incredible... you actually got the statue back...")
bubble(HERO1, _"...Well, hold on a second. I didn't get the WHOLE statue back; just a part of it. It looks like it had been broken before I got there.")
bubble(en, _"Regardless, this much is wonderful. I wish we had some way of paying you back.")
bubble(en, _"Unfortunately our village has next to nothing.")
bubble(HERO1, _"Don't worry... not everything we adventurers do is for a reward.")
bubble(en, _"What about the troll?")
msg(_"You tell the head of the village council what you found.", 0, 0)
bubble(en, _"Demnas... that name is familiar.")
bubble(en, _"I remember that a tribe of Narakians once lived around here somewhere. I thought they were all wiped out by Malkaron's armies.")
msg(_"You shrug.", 0, 0)
bubble(en, _"Hmm...")
bubble(en, _"Wait... I think I remember now. Demnas was the name of the Narakian's tribal leader who supposedly went crazy many years ago. It's possible that you found where he has been hiding all of this time.")
if (progress.denorian == 3) then
bubble(HERO1, _"Well, him being crazy explains why he was rambling on about someone trying to steal the statue from him.")
else
bubble(HERO1, _"He was rambling on about someone trying to seal the statue from him.")
if (progress.talk_corin == 0) then
bubble(HERO1, _"It still doesn't make any sense.")
bubble(HERO1, _"Wait a minute! I remember that CORIN was down there...")
if (get_numchrs() == 1) then
bubble(HERO1, _"I might be able to go back there and talk to him.")
else
bubble(HERO1, _"We might be able to go back there and talk to him.")
end
bubble(HERO1, _"Maybe he'd know more about it.")
else
if (party[0] == CORIN) then
CorinInParty = HERO1
cp = "I thought"
elseif (get_numchrs() == 2 and party[1] == CORIN) then
CorinInParty = HERO2
cp = "I thought"
else
CorinInParty = HERO1
cp = "He thought"
end
-- // You met with Corin, but he's not in your party
if (CorinInParty == 0) then
if (get_numchrs() == 1) then
bubble(HERO1, _"It didn't make any sense until I met up with CORIN.")
else
bubble(HERO1, _"It didn't make any sense until we met up with CORIN.")
end
end
bubble(CorinInParty, cp.." that Malkaron's armies got to Demnas and the troll first because they were able to get away with half of the statue.")
end
end
bubble(en, _"Well, I guess I'm a little relieved that we don't have a troll problem.")
bubble(HERO1, _"Well, yeah I guess that's good. And you don't have to worry about any crazed Nerakians for awhile either.")
bubble(en, _"That's good to hear. At the very least I can say that you will always be welcome in our village.")
bubble(HERO1, _"Thank you.")
progress.denorian = 5
remove_special_item(SI_DENORIANSTATUE)
elseif (progress.denorian == 5) then
bubble(en, _"Good luck in your journey. If you come across the other half of our statue...")
else
bubble(en, _"Good journey friend.")
end
end
function LOC_trollstory(en)
bubble(en, _"Oh, thank you very much! We will not forget your kindness.")
bubble(en, _"So, here is what we know. The thief is a troll. Our people have tracked the troll to a cave on the other side of the river.")
bubble(en, _"That is where he can be found.")
bubble(HERO1, _"Have your people tried to get the statue back themselves?")
bubble(en, _"Yes, we have tried, but we quickly learned that we were no match for this enemy.")
bubble(en, _"We could not even overcome the denizens of the cave, never mind the troll himself!")
bubble(HERO1, _"Are trolls common to this area? I have seen none in my travels.")
bubble(en, _"That is the strange part of all this. Trolls have not been seen in these parts for nearly a century!")
bubble(en, _"I must say that we suspect that someone is directing the troll in these matters.")
bubble(HERO1, _"Well, don't worry. We will get that statue back for you and get to the bottom of this whole thing.")
bubble(en, _"Oh, and if you haven't seen the cave yet... or even if you have, you'll need to know that there is a trick to opening the door.")
bubble(en, _"There is a set of stones off to the left of the entrance. You have to press them in the right order to gain access.")
bubble(en, _"Press the first stone, then the fourth and lastly the third. Then the door will open. Got it?")
bubble(HERO1, _"Uh... sure.")
progress.denorian = 2
end
| gpl-2.0 |
santssoft/darkstar | scripts/zones/Carpenters_Landing/mobs/Cryptonberry_Assassin.lua | 9 | 1485 | -----------------------------------
-- Area: Carpenters' Landing
-- NM: Cryptonberry Assassin
-- !pos 120.615 -5.457 -390.133 2
-----------------------------------
local ID = require("scripts/zones/Carpenters_Landing/IDs")
mixins = {require("scripts/mixins/job_special")}
require("scripts/globals/missions")
-----------------------------------
function onMobInitialize(mob)
mob:setMobMod(dsp.mobMod.IDLE_DESPAWN, 180) -- 3 minutes
end
function onMobSpawn(mob)
dsp.mix.jobSpecial.config(mob, {
specials =
{
{
id = dsp.jsa.MIJIN_GAKURE,
begCode = function(mob)
mob:messageText(mob, ID.text.CRYPTONBERRY_ASSASSIN_2HR)
end,
},
},
})
mob:setLocalVar("despawnTime", os.time() + 180)
end
function onMobEngaged(mob, target)
mob:setLocalVar("despawnTime", 0)
end
function onMobRoam(mob)
-- if not claimed within 3 minutes of spawning, despawn
local despawnTime = mob:getLocalVar("despawnTime")
if despawnTime > 0 and os.time() > despawnTime then
DespawnMob(mob:getID())
end
end
function onMobDeath(mob, player, isKiller)
if player:getCurrentMission(COP) == dsp.mission.id.cop.CALM_BEFORE_THE_STORM and player:getCharVar("Cryptonberry_Executor_KILL") < 2 then
local offset = mob:getID() - ID.mob.CRYPTONBERRY_EXECUTOR
player:setCharVar(string.format("Cryptonberry_Assassins-%i_KILL", offset), 1)
end
end | gpl-3.0 |
m241dan/darkstar | scripts/globals/items/silver_shark.lua | 18 | 1319 | -----------------------------------------
-- ID: 4451
-- Item: silver_shark
-- Food Effect: 5Min, Mithra only
-----------------------------------------
-- Dexterity 4
-- Mind -6
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:getRace() ~= 7) then
result = 247;
end
if (target:getMod(MOD_EAT_RAW_FISH) == 1) then
result = 0;
end
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,4451);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 4);
target:addMod(MOD_MND, -6);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 4);
target:delMod(MOD_MND, -6);
end;
| gpl-3.0 |
LiquidFeedbackUA/webmcp | framework/env/net/send_mail.lua | 2 | 2118 | --[[--
success = -- true, if mail has been sent successfully, otherwise false
net.send_mail{
envelope_from = envelope_from, -- envelope from address, not part of mail headers
from = from, -- From header address or table with 'name' and 'address' fields
sender = sender, -- Sender header address or table with 'name' and 'address' fields
reply_to = reply_to, -- Reply-To header address or table with 'name' and 'address' fields
to = to, -- To header address or table with 'name' and 'address' fields
cc = cc, -- Cc header address or table with 'name' and 'address' fields
bcc = bcc, -- Bcc header address or table with 'name' and 'address' fields
subject = subject, -- subject of e-mail
multipart = multipart_type, -- "alternative", "mixed", "related", or nil
content_type = content_type, -- only for multipart == nil, defaults to "text/plain"
binary = binary, -- allow full 8-bit content
content = content or { -- content as lua-string, or table in case of multipart
{
multipart = multipart_type,
...,
content = content or {
{...}, ...
}
}, {
...
},
...
}
}
This function sends a mail using the /usr/sbin/sendmail command. It returns true on success, otherwise false.
--]]--
function net.send_mail(args)
local mail
if type(args) == "string" then
mail = args
else
mail = encode.mime.mail(args)
end
local envelope_from = args.envelope_from
local command = {"/usr/sbin/sendmail", "-t", "-i"}
if
envelope_from and
string.find(envelope_from, "^[0-9A-Za-z%.-_@0-9A-Za-z%.-_]+$")
then
command[#command+1] = "-f"
command[#command+1] = envelope_from
end
local stdout, errmsg, status = extos.pfilter(mail, table.unpack(command))
if not status then
error("Error while calling sendmail: " .. errmsg)
end
if status == 0 then
return true
else
return false
end
end
| mit |
Mailaender/OpenRA | mods/d2k/maps/ordos-01b/ordos01b.lua | 4 | 5019 | --[[
Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version. For more
information, see COPYING.
]]
HarkonnenReinforcements =
{
easy =
{
{ "light_inf", "light_inf" }
},
normal =
{
{ "light_inf", "light_inf" },
{ "light_inf", "light_inf", "light_inf" },
{ "light_inf", "trike" }
},
hard =
{
{ "light_inf", "light_inf" },
{ "trike", "trike" },
{ "light_inf", "light_inf", "light_inf" },
{ "light_inf", "trike" },
{ "trike", "trike" }
}
}
HarkonnenEntryWaypoints = { HarkonnenWaypoint1.Location, HarkonnenWaypoint2.Location, HarkonnenWaypoint3.Location, HarkonnenWaypoint4.Location }
HarkonnenAttackDelay = DateTime.Seconds(30)
HarkonnenAttackWaves =
{
easy = 1,
normal = 5,
hard = 12
}
ToHarvest =
{
easy = 2500,
normal = 3000,
hard = 3500
}
OrdosReinforcements = { "light_inf", "light_inf", "light_inf", "light_inf", "raider" }
OrdosEntryPath = { OrdosWaypoint.Location, OrdosRally.Location }
Messages =
{
"Build a concrete foundation before placing your buildings.",
"Build a Wind Trap for power.",
"Build a Refinery to collect Spice.",
"Build a Silo to store additional Spice."
}
Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
end
-- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false
Media.DisplayMessage(Messages[2], "Mentat")
else
HasPower = true
end
-- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], "Mentat")
end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], "Mentat")
end
UserInterface.SetMissionText("Harvested resources: " .. player.Resources .. "/" .. SpiceToHarvest, player.Color)
end
WorldLoaded = function()
player = Player.GetPlayer("Ordos")
harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillAtreides = harkonnen.AddPrimaryObjective("Kill all Ordos units.")
GatherSpice = player.AddPrimaryObjective("Harvest " .. tostring(SpiceToHarvest) .. " Solaris worth of Spice.")
KillHarkonnen = player.AddSecondaryObjective("Eliminate all Harkonnen units and reinforcements\nin the area.")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage("We don't have enough silo space to store the required amount of Spice!", "Mentat")
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
end
end)
end
Trigger.OnRemovedFromWorld(OrdosConyard, function()
-- Mission already failed, no need to check the other conditions as well
if checkResourceCapacity() then
return
end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
if #refs == 0 then
harkonnen.MarkCompletedObjective(KillAtreides)
else
Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillAtreides)
end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
end)
Media.DisplayMessage(Messages[1], "Mentat")
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
SendReinforcements()
end
SendReinforcements = function()
local units = HarkonnenReinforcements[Difficulty]
local delay = Utils.RandomInteger(HarkonnenAttackDelay - DateTime.Seconds(2), HarkonnenAttackDelay)
HarkonnenAttackDelay = HarkonnenAttackDelay - (#units * 3 - 3 - WavesLeft) * DateTime.Seconds(1)
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1
if WavesLeft == 0 then
Trigger.AfterDelay(DateTime.Seconds(1), function() HarkonnenArrived = true end)
else
SendReinforcements()
end
end)
end
| gpl-3.0 |
emmericp/FlowScope | lua/flowscope.lua | 1 | 3278 | local lm = require "libmoon"
local device = require "device"
local ffi = require "ffi"
local log = require "log"
local flowtracker = require "flowtracker"
local qq = require "qq"
local jit = require "jit"
jit.opt.start("maxrecord=20000", "maxirconst=20000", "loopunroll=4000")
function configure(parser)
parser:argument("module", "Path to user-defined analysis module")
parser:argument("dev", "Devices to use."):args("+"):convert(tonumber)
parser:option("--size", "Storage capacity of the in-memory ring buffer in GiB."):convert(tonumber):default("8")
parser:option("--rate", "Rate of the generated traffic in buckets/s."):convert(tonumber):default("10")
parser:option("--rx-threads", "Number of rx threads per device. If --generate is given, then number of traffic generator threads."):convert(tonumber):default("1"):target("rxThreads")
parser:option("--analyze-threads", "Number of analyzer threads. No effect if mode=qq"):convert(tonumber):default("1"):target("analyzeThreads")
parser:option("--dump-threads", "Number of dump threads."):convert(tonumber):default("1"):target("dumperThreads")
parser:option("--path", "Path for output pcaps."):default(".")
parser:option("--log-level", "Log level"):default("WARN"):target("logLevel")
parser:option("--max-rules", "Maximum number of rules"):convert(tonumber):default("100"):target("maxRules")
parser:flag("--generate", "Generate traffic instead of reading from a device"):default(False)
parser:option("-p --api-port", "Port for the HTTP REST api."):convert(tonumber):default("8000"):target("apiPort")
parser:option("-b --api-bind", "Bind to a specific IP address. (for example 127.0.0.1)"):target("apiAddress")
parser:option("-t --api-token", "Token for authorization to api."):default("hardToGuess"):target("apiToken"):count("*")
local args = parser:parse()
return args
end
function master(args)
local f, err = loadfile(args.module)
if f == nil then
log:error(err)
end
local userModule = f()
-- TODO: pass more/all CLI flags to module
userModule.logLevel = args.logLevel
local tracker = flowtracker.new(userModule)
-- this part should be wrapped by flowscope and exposed via CLI arguments
for i, dev in ipairs(args.dev) do
args.dev[i] = device.config{
port = dev,
rxQueues = args.rxThreads,
rssQueues = args.rxThreads
}
-- Create analyzers
for threadId = 0, args.rxThreads - 1 do
-- get from QQ or from a device queue
if userModule.mode == "qq" then
local q = qq.createQQ(args.size)
table.insert(tracker.qq, q)
tracker:startNewInserter(args.dev[i]:getRxQueue(threadId), q)
tracker:startNewDumper(args.path, q)
tracker:startNewAnalyzer(args.module, q)
else
tracker:startNewAnalyzer(args.module, args.dev[i]:getRxQueue(threadId))
end
end
-- Start checker, has to done after the analyzers/pipes are created
tracker:startChecker(args.module)
end
device.waitForLinks()
-- end wrapped part
lm.waitForTasks()
tracker:delete()
log:info("[master]: Shutdown")
end
| mit |
m241dan/darkstar | scripts/zones/Quicksand_Caves/mobs/Princeps_IV-XLV.lua | 10 | 1350 | -----------------------------------
-- Area: Quicksand Caves
-- MOB: Princeps IV-XLV
-- Pops in Bastok mission 8-1 "The Chains that Bind Us"
-----------------------------------
package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Quicksand_Caves/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobDisengage Action
-----------------------------------
function onMobDisengage(mob)
local self = mob:getID();
DespawnMob(self, 120);
end;
-----------------------------------
-- onMobDeath Action
-----------------------------------
function onMobDeath(mob, player, isKiller)
if (player:getCurrentMission(BASTOK) == THE_CHAINS_THAT_BIND_US and player:getVar("MissionStatus") == 1) then
SetServerVariable("Bastok8-1LastClear", os.time());
end
end;
-----------------------------------
-- onMobDespawn Action
-----------------------------------
function onMobDespawn(mob)
local mobsup = GetServerVariable("BastokFight8_1");
SetServerVariable("BastokFight8_1",mobsup - 1);
if (GetServerVariable("BastokFight8_1") == 0) then
local npc = GetNPCByID(17629734); -- qm6
npc:setStatus(0); -- Reappear
end
end; | gpl-3.0 |
m241dan/darkstar | scripts/zones/Meriphataud_Mountains/npcs/Three_Steps_IM.lua | 13 | 3350 | -----------------------------------
-- Area: Meriphataud Mountains
-- NPC: Three Steps, I.M.
-- Type: Border Conquest Guards
-- @pos -120.393 -25.822 -592.604 119
-----------------------------------
package.loaded["scripts/zones/Meriphataud_Mountains/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Meriphataud_Mountains/TextIDs");
local guardnation = BASTOK; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = ARAGONEU;
local csid = 0x7ff8;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(EFFECT_SIGIL);
player:delStatusEffect(EFFECT_SANCTION);
player:delStatusEffect(EFFECT_SIGNET);
player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
m241dan/darkstar | scripts/zones/Al_Zahbi/npcs/Ugahar.lua | 13 | 1035 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Ugahar
-- Type: Standard NPC
-- @zone: 48
-- @pos 52.262 -1 123.185
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00ee);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
m241dan/darkstar | scripts/zones/Dragons_Aery/mobs/Fafnir.lua | 1 | 1718 | -----------------------------------
-- Area: Dragons Aery
-- HNM: Fafnir
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/status");
require("scripts/globals/melfnm");
-----------------------------------
-- onMobInitialize
-----------------------------------
function onMobInitialize(mob)
end;
-----------------------------------
-- onMobSpawn
-----------------------------------
function onMobSpawn(mob)
mob:addMod( MOD_SLEEPRES, 80 );
mob:addMod( MOD_MDEF, 20 );
end;
function onMobFight( mob, target )
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, player, isKiller)
player:addTitle(FAFNIR_SLAYER);
end;
-----------------------------------
-- onMobDespawn
-----------------------------------
function onMobDespawn(mob)
local Fafnir = mob:getID();
local Nidhogg = mob:getID()+1;
local ToD = GetServerVariable("[POP]Nidhogg");
local kills = GetServerVariable("[PH]Nidhogg");
local popNow = (math.random(1,5) == 3 or kills > 6);
if (LandKingSystem_HQ ~= 1 and ToD <= os.time(t) and popNow == true) then
-- 0 = timed spawn, 1 = force pop only, 2 = BOTH
if (LandKingSystem_NQ == 0) then
DeterMob(Fafnir, true);
end
DeterMob(Nidhogg, false);
UpdateNMSpawnPoint(Nidhogg);
GetMobByID(Nidhogg):setRespawnTime(math.random(75600,86400));
else
if (LandKingSystem_NQ ~= 1) then
UpdateNMSpawnPoint(Fafnir);
mob:setRespawnTime(math.random(75600,86400));
SetServerVariable("[PH]Nidhogg", kills + 1);
end
end
end;
| gpl-3.0 |
dvr333/Zero-K | Objects3d/pw_wormhole.dae.lua | 8 | 1276 | return {
--pieces = {
-- base = {
-- offset = {0.00, 0.00, 0.00},
--
-- pannel1 = {
-- offset = {18.07, 51.31, -0.00},
--
-- },
-- pannel2 = {
-- offset = {-18.07, 51.31, -0.00},
--
-- },
-- turret = {
-- offset = {0.00, 0.00, 0.00},
--
-- cylinder = {
-- offset = {0.00, 0.00, 0.00},
--
-- },
-- canonbase = {
-- offset = {0.00, 0.00, 0.00},
--
-- },
-- canon = {
-- offset = {0.00, -0.00, 0.00},
--
-- },
-- },
-- slider1 = {
-- offset = {0.00, 0.00, 0.00},
--
-- focal2 = {
-- offset = {-66.60, 58.13, -0.00},
--
-- },
-- },
-- slider2 = {
-- offset = {0.00, 0.00, 0.00},
--
-- focal1 = {
-- offset = {66.60, 58.13, -0.00},
--
-- },
-- },
-- wheel1 = {
-- offset = {-32.27, 23.47, -0.00},
--
-- },
-- wheel2 = {
-- offset = {32.27, 23.47, -0.00},
--
-- },
-- drone = {
-- offset = {0, 56, 0},
-- }
-- },
--},
radius = 70,
height = 70,
midpos = {0.00, 30, 0.00},
tex1 = "pw_wormhole_1.dds",
tex2 = "pw_wormhole_2.dds",
--numpieces = 13, -- includes the root and empty pieces
--
--globalvertexoffsets = false, -- vertices in global space?
--localpieceoffsets = true, -- offsets in local space?
}
| gpl-2.0 |
joerg-krause/luvi | samples/test.app/utils.lua | 11 | 9569 | --[[
Copyright 2014-2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
--[[lit-meta
name = "luvit/pretty-print"
version = "2.0.0"
homepage = "https://github.com/luvit/luvit/blob/master/deps/pretty-print.lua"
description = "A lua value pretty printer and colorizer for terminals."
tags = {"colors", "tty"}
license = "Apache 2"
author = { name = "Tim Caswell" }
]]
local success, uv = pcall(require, 'uv')
if not success then
success, uv = pcall(require, 'luv')
end
assert(success, uv)
local getenv = require('os').getenv
local prettyPrint, dump, strip, color, colorize, loadColors
local theme = {}
local useColors = false
local defaultTheme
local stdout, stdin, stderr, width
local quote, quote2, dquote, dquote2, obracket, cbracket, obrace, cbrace, comma, equals, controls
local themes = {
-- nice color theme using 16 ansi colors
[16] = {
property = "0;37", -- white
sep = "1;30", -- bright-black
braces = "1;30", -- bright-black
["nil"] = "1;30", -- bright-black
boolean = "0;33", -- yellow
number = "1;33", -- bright-yellow
string = "0;32", -- green
quotes = "1;32", -- bright-green
escape = "1;32", -- bright-green
["function"] = "0;35", -- purple
thread = "1;35", -- bright-purple
table = "1;34", -- bright blue
userdata = "1;36", -- bright cyan
cdata = "0;36", -- cyan
err = "1;31", -- bright red
success = "1;33;42", -- bright-yellow on green
failure = "1;33;41", -- bright-yellow on red
highlight = "1;36;44", -- bright-cyan on blue
},
-- nice color theme using ansi 256-mode colors
[256] = {
property = "38;5;253",
braces = "38;5;247",
sep = "38;5;240",
["nil"] = "38;5;244",
boolean = "38;5;220", -- yellow-orange
number = "38;5;202", -- orange
string = "38;5;34", -- darker green
quotes = "38;5;40", -- green
escape = "38;5;46", -- bright green
["function"] = "38;5;129", -- purple
thread = "38;5;199", -- pink
table = "38;5;27", -- blue
userdata = "38;5;39", -- blue2
cdata = "38;5;69", -- teal
err = "38;5;196", -- bright red
success = "38;5;120;48;5;22", -- bright green on dark green
failure = "38;5;215;48;5;52", -- bright red on dark red
highlight = "38;5;45;48;5;236", -- bright teal on dark grey
},
}
local special = {
[7] = 'a',
[8] = 'b',
[9] = 't',
[10] = 'n',
[11] = 'v',
[12] = 'f',
[13] = 'r'
}
function strip(str)
return string.gsub(str, '\027%[[^m]*m', '')
end
function loadColors(index)
if index == nil then index = defaultTheme end
-- Remove the old theme
for key in pairs(theme) do
theme[key] = nil
end
if index then
local new = themes[index]
if not new then error("Invalid theme index: " .. tostring(index)) end
-- Add the new theme
for key in pairs(new) do
theme[key] = new[key]
end
useColors = true
else
useColors = false
end
quote = colorize('quotes', "'", 'string')
quote2 = colorize('quotes', "'")
dquote = colorize('quotes', '"', 'string')
dquote2 = colorize('quotes', '"')
obrace = colorize('braces', '{ ')
cbrace = colorize('braces', '}')
obracket = colorize('property', '[')
cbracket = colorize('property', ']')
comma = colorize('sep', ', ')
equals = colorize('sep', ' = ')
controls = {}
for i = 0, 31 do
local c = special[i]
if not c then
if i < 10 then
c = "00" .. tostring(i)
else
c = "0" .. tostring(i)
end
end
controls[i] = colorize('escape', '\\' .. c, 'string')
end
controls[92] = colorize('escape', '\\\\', 'string')
controls[34] = colorize('escape', '\\"', 'string')
controls[39] = colorize('escape', "\\'", 'string')
for i = 128, 255 do
local c
if i < 100 then
c = "0" .. tostring(i)
else
c = tostring(i)
end
controls[i] = colorize('escape', '\\' .. c, 'string')
end
end
function color(colorName)
return '\27[' .. (theme[colorName] or '0') .. 'm'
end
function colorize(colorName, string, resetName)
return useColors and
(color(colorName) .. tostring(string) .. color(resetName)) or
tostring(string)
end
local function stringEscape(c)
return controls[string.byte(c, 1)]
end
function dump(value, recurse, nocolor)
local seen = {}
local output = {}
local offset = 0
local stack = {}
local function recalcOffset(index)
for i = index + 1, #output do
local m = string.match(output[i], "\n([^\n]*)$")
if m then
offset = #(strip(m))
else
offset = offset + #(strip(output[i]))
end
end
end
local function write(text, length)
if not length then length = #(strip(text)) end
-- Create room for data by opening parent blocks
-- Start at the root and go down.
local i = 1
while offset + length > width and stack[i] do
local entry = stack[i]
if not entry.opened then
entry.opened = true
table.insert(output, entry.index + 1, "\n" .. string.rep(" ", i))
-- Recalculate the offset
recalcOffset(entry.index)
-- Bump the index of all deeper entries
for j = i + 1, #stack do
stack[j].index = stack[j].index + 1
end
end
i = i + 1
end
output[#output + 1] = text
offset = offset + length
if offset > width then
return dump(stack)
end
end
local function indent()
stack[#stack + 1] = {
index = #output,
opened = false,
}
end
local function unindent()
stack[#stack] = nil
end
local function process(localValue)
local typ = type(localValue)
if typ == 'string' then
if string.match(localValue, "'") and not string.match(localValue, '"') then
write(dquote .. string.gsub(localValue, '[%c\\\128-\255]', stringEscape) .. dquote2)
else
write(quote .. string.gsub(localValue, "[%c\\'\128-\255]", stringEscape) .. quote2)
end
elseif typ == 'table' and not seen[localValue] then
if not recurse then seen[localValue] = true end
write(obrace)
local i = 1
-- Count the number of keys so we know when to stop adding commas
local total = 0
for _ in pairs(localValue) do total = total + 1 end
local nextIndex = 1
for k, v in pairs(localValue) do
indent()
if k == nextIndex then
-- if the key matches the last numerical index + 1
-- This is how lists print without keys
nextIndex = k + 1
process(v)
else
if type(k) == "string" and string.find(k,"^[%a_][%a%d_]*$") then
write(colorize("property", k) .. equals)
else
write(obracket)
process(k)
write(cbracket .. equals)
end
if type(v) == "table" then
process(v)
else
indent()
process(v)
unindent()
end
end
if i < total then
write(comma)
else
write(" ")
end
i = i + 1
unindent()
end
write(cbrace)
else
write(colorize(typ, tostring(localValue)))
end
end
process(value)
local s = table.concat(output, "")
return nocolor and strip(s) or s
end
-- Print replacement that goes through libuv. This is useful on windows
-- to use libuv's code to translate ansi escape codes to windows API calls.
function _G.print(...)
local n = select('#', ...)
local arguments = {...}
for i = 1, n do
arguments[i] = tostring(arguments[i])
end
uv.write(stdout, table.concat(arguments, "\t") .. "\n")
end
function prettyPrint(...)
local n = select('#', ...)
local arguments = { ... }
for i = 1, n do
arguments[i] = dump(arguments[i])
end
print(table.concat(arguments, "\t"))
end
function strip(str)
return string.gsub(str, '\027%[[^m]*m', '')
end
if uv.guess_handle(0) == 'tty' then
stdin = assert(uv.new_tty(0, true))
else
stdin = uv.new_pipe(false)
uv.pipe_open(stdin, 0)
end
if uv.guess_handle(1) == 'tty' then
stdout = assert(uv.new_tty(1, false))
width = uv.tty_get_winsize(stdout)
if width == 0 then width = 80 end
-- auto-detect when 16 color mode should be used
local term = getenv("TERM")
if term and (term == 'xterm' or term:match'-256color$') then
defaultTheme = 256
else
defaultTheme = 16
end
else
stdout = uv.new_pipe(false)
uv.pipe_open(stdout, 1)
width = 80
end
loadColors()
if uv.guess_handle(2) == 'tty' then
stderr = assert(uv.new_tty(2, false))
else
stderr = uv.new_pipe(false)
uv.pipe_open(stderr, 2)
end
return {
loadColors = loadColors,
theme = theme,
print = print,
prettyPrint = prettyPrint,
dump = dump,
color = color,
colorize = colorize,
stdin = stdin,
stdout = stdout,
stderr = stderr,
strip = strip,
}
| apache-2.0 |
Be1eriand/Civ-5-Big-Data-Mod | Override/LeagueProjectPopup.lua | 1 | 10110 | --------------------------------------------------------------
-- LeagueProjectPopup.lua
-- Author: Anton Strenger
-- DateCreated: 1/16/2012
--
-- Shows information about the results of a League Project
--------------------------------------------------------------
include( "InstanceManager" );
include( "IconSupport" );
include("BRDLib");
-----------------------------
-- Globals --
-----------------------------
local m_bDebug = false;
local m_PopupInfo = nil;
local m_iLeague = nil;
local m_iProject = nil;
local m_PlayerRankInstanceManager = InstanceManager:new( "PlayerEntryInstance", "PlayerEntryBox", Controls.PlayerListStack );
local m_RewardTierInstanceManager = InstanceManager:new( "RewardTierInstance", "RewardTierBox", Controls.PlayerListStack );
local m_tContributions = {}; --[iLeague][iProject][iPlayer]
-------------------------------------------------
-- General UI Handlers
-------------------------------------------------
function OnPopup( popupInfo )
if( popupInfo.Type ~= ButtonPopupTypes.BUTTONPOPUP_LEAGUE_PROJECT_COMPLETED ) or (getBRDataOption("WorldCongress")== 1) then
if (getBRDataOption("WorldCongress")== 1) and (popupInfo.Type == ButtonPopupTypes.BUTTONPOPUP_LEAGUE_PROJECT_COMPLETED) then
logger:debug("World Congress Project PopUp Suppressed");
end;
return;
end
m_PopupInfo = popupInfo;
m_iLeague = popupInfo.Data1;
m_iProject = popupInfo.Data2;
UpdateContributions();
UpdateAll();
UIManager:QueuePopup( ContextPtr, PopupPriority.WhosWinning );
end
Events.SerialEventGameMessagePopup.Add( OnPopup );
function UpdateContributions()
for iLeagueLoop = 0, Game.GetNumLeaguesEverFounded()-1, 1 do
local pLeague = Game.GetLeague(iLeagueLoop);
if (pLeague ~= nil) then
if (m_tContributions[iLeagueLoop] == nil) then
m_tContributions[iLeagueLoop] = {};
end
for tProjectLoop in GameInfo.LeagueProjects() do
local iProjectLoop = tProjectLoop.ID;
if (m_tContributions[iLeagueLoop][iProjectLoop] == nil) then
m_tContributions[iLeagueLoop][iProjectLoop] = {};
end
if (pLeague:IsProjectActive(iProjectLoop) or pLeague:IsProjectComplete(iProjectLoop)) then
for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
if (m_tContributions[iLeagueLoop][iProjectLoop][iPlayerLoop] == nil) then
m_tContributions[iLeagueLoop][iProjectLoop][iPlayerLoop] =
{
Contribution = 0,
Tier = 0,
};
end
local iContributionTimes100 = pLeague:GetMemberContribution(iPlayerLoop, iProjectLoop);
m_tContributions[iLeagueLoop][iProjectLoop][iPlayerLoop].Contribution = iContributionTimes100 / 100;
local iTier = pLeague:GetMemberContributionTier(iPlayerLoop, iProjectLoop);
m_tContributions[iLeagueLoop][iProjectLoop][iPlayerLoop].Tier = iTier;
end
else
m_tContributions[iLeagueLoop][iProjectLoop] = {};
end
end
end
end
end
function UpdateAll()
if (m_iLeague ~= nil and m_iProject ~= nil) then
local pLeague = Game.GetLeague(m_iLeague);
if (pLeague ~= nil) then
local tProject = GameInfo.LeagueProjects[m_iProject];
m_PlayerRankInstanceManager:ResetInstances();
m_RewardTierInstanceManager:ResetInstances();
-- Background image
if (tProject.ProjectSplashImage ~= nil) then
Controls.BackgroundImage:SetTextureAndResize(tProject.ProjectSplashImage);
end
-- Project Info
Controls.PresentsLabel:LocalizeAndSetText(GameInfo.Processes[tProject.Process].Description);
Controls.ListNameLabel:LocalizeAndSetText("TXT_KEY_LEAGUE_PROJECT_POPUP_COMPLETE");
local sProjectInfo = Locale.Lookup(tProject.Help);
sProjectInfo = sProjectInfo .. "[NEWLINE][NEWLINE]";
sProjectInfo = sProjectInfo .. pLeague:GetProjectDetails(tProject.ID);
Controls.ProjectInfoLabel:SetText(sProjectInfo);
-- Loop through all majors
local tRankings = {};
for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local pPlayerLoop = Players[iPlayerLoop];
local iContribution = 0;
local iTier = 0;
if (pPlayerLoop ~= nil and pPlayerLoop:IsAlive()) then
if (m_tContributions[m_iLeague] ~= nil) then
if (m_tContributions[m_iLeague][m_iProject] ~= nil) then
if (m_tContributions[m_iLeague][m_iProject][iPlayerLoop] ~= nil) then
iContribution = m_tContributions[m_iLeague][m_iProject][iPlayerLoop].Contribution;
iTier = m_tContributions[m_iLeague][m_iProject][iPlayerLoop].Tier;
end
end
end
table.insert(tRankings, {iPlayerLoop, iContribution, iTier});
end
end
-- Sort based on contribution amount
local f = function(a, b)
if (a[3] == b[3]) then
return a[2] > b[2];
else
return a[3] > b[3];
end
end
table.sort(tRankings, f);
-- Display sorted list
local iDisplayTier = 4;
for i, v in ipairs(tRankings) do
local iPlayer = v[1];
local iContribution = v[2];
local iTier = v[3];
if (m_bDebug) then print("==debug== Showing player rankings, found Player=" .. iPlayer .. ", Contribution=" .. iContribution .. ", Tier=" .. iTier); end
AddPlayerEntry(iPlayer, iContribution, iTier, i);
end
Controls.PlayerListStack:CalculateSize();
Controls.PlayerListStack:ReprocessAnchoring();
Controls.PlayerListScrollPanel:CalculateInternalSize();
end
end
end
function OnClose ()
UIManager:DequeuePopup( ContextPtr );
end
Controls.CloseButton:RegisterCallback( Mouse.eLClick, OnClose );
Events.GameplaySetActivePlayer.Add(OnClose);
function InputHandler( uiMsg, wParam, lParam )
if uiMsg == KeyEvents.KeyDown then
if wParam == Keys.VK_ESCAPE or wParam == Keys.VK_RETURN then
OnClose();
return true;
end
end
end
ContextPtr:SetInputHandler( InputHandler );
function ShowHideHandler( bIsHide, bInitState )
if( not bInitState ) then
if( not bIsHide ) then
UI.incTurnTimerSemaphore();
Events.SerialEventGameMessagePopupShown(m_PopupInfo);
else
UI.decTurnTimerSemaphore();
Events.SerialEventGameMessagePopupProcessed.CallImmediate(ButtonPopupTypes.BUTTONPOPUP_LEAGUE_PROJECT_COMPLETED, 0);
end
end
end
ContextPtr:SetShowHideHandler( ShowHideHandler );
-------------------------------------------------
-- AddRewardTier
-------------------------------------------------
function AddRewardTier (iRewardTier)
local tProject = GameInfo.LeagueProjects[m_iProject];
if (tProject ~= nil) then
local controlTable = m_RewardTierInstanceManager:GetInstance();
local sText = "";
local sTooltip = "";
if (iRewardTier > 3 or iRewardTier < 0) then
return;
elseif (iRewardTier == 0) then
sText = Locale.Lookup("TXT_KEY_LEAGUE_PROJECT_REWARD_NONE");
sTooltip = Locale.Lookup("TXT_KEY_LEAGUE_PROJECT_REWARD_NONE_HELP");
else
sText = Locale.Lookup(GameInfo.LeagueProjectRewards[tProject["RewardTier" .. iRewardTier]].Description);
sTooltip = Locale.Lookup(GameInfo.LeagueProjectRewards[tProject["RewardTier" .. iRewardTier]].Description);
-- Includes all previous tiers
for i = 1, iRewardTier, 1 do
sTooltip = sTooltip .. "[NEWLINE][ICON_BULLET]";
sTooltip = sTooltip .. Locale.Lookup(GameInfo.LeagueProjectRewards[tProject["RewardTier" .. i]].Help);
end
end
controlTable.RewardTierLabel:SetText(sText);
controlTable.RewardTierBox:SetToolTipString(sTooltip);
end
end
-------------------------------------------------
-- AddPlayerEntry
-------------------------------------------------
function AddPlayerEntry (iPlayerID, iScore, iTier, iRank)
if (m_iLeague ~= nil and m_iProject ~= nil) then
local pLeague = Game.GetLeague(m_iLeague);
if (pLeague ~= nil) then
local pPlayer = Players[iPlayerID];
local iTeam = pPlayer:GetTeam();
local pTeam = Teams[iTeam];
local controlTable = m_PlayerRankInstanceManager:GetInstance();
local leader = GameInfo.Leaders[pPlayer:GetLeaderType()];
local strName = "";
-- Active player
if (pPlayer:GetID() == Game.GetActivePlayer()) then
strName = Locale.ConvertTextKey( "TXT_KEY_POP_VOTE_RESULTS_YOU" );
CivIconHookup( iPlayerID, 32, controlTable.CivIcon, controlTable.CivIconBG, controlTable.CivIconShadow, true, true, controlTable.CivIconHighlight);
IconHookup( leader.PortraitIndex, 64, leader.IconAtlas, controlTable.Portrait );
-- Haven't yet met this player
elseif (not pTeam:IsHasMet(Game.GetActiveTeam())) then
strName = Locale.ConvertTextKey( "TXT_KEY_POP_VOTE_RESULTS_UNMET_PLAYER" );
CivIconHookup( -1, 32, controlTable.CivIcon, controlTable.CivIconBG, controlTable.CivIconShadow, true, true, controlTable.CivIconHighlight);
IconHookup( 22, 64, "LEADER_ATLAS", controlTable.Portrait );
-- Met players
else
strName = Locale.ConvertTextKey(pPlayer:GetNameKey());
CivIconHookup( iPlayerID, 32, controlTable.CivIcon, controlTable.CivIconBG, controlTable.CivIconShadow, true, true, controlTable.CivIconHighlight);
IconHookup( leader.PortraitIndex, 64, leader.IconAtlas, controlTable.Portrait );
end
controlTable.PlayerNameText:SetText(strName);
-- Formats the # and reduces it to X.XX
local strPoints = Locale.ConvertTextKey("TXT_KEY_FORMAT_NUMBER", iScore) .. "[ICON_PRODUCTION]";
controlTable.ScoreText:SetText(strPoints);
-- Reward tier icons
local strRewardIcons = "";
local strRewardTT = "";
if (iTier >= 1) then
strRewardIcons = strRewardIcons .. "[ICON_TROPHY_BRONZE]";
strRewardTT = pLeague:GetProjectRewardTierDetails(1, m_iProject) .. strRewardTT;
end
if (iTier >= 2) then
strRewardIcons = strRewardIcons .. "[ICON_TROPHY_SILVER]";
strRewardTT = pLeague:GetProjectRewardTierDetails(2, m_iProject) .. "[NEWLINE][NEWLINE]" .. strRewardTT;
end
if (iTier >= 3) then
strRewardIcons = strRewardIcons .. "[ICON_TROPHY_GOLD]";
strRewardTT = pLeague:GetProjectRewardTierDetails(3, m_iProject) .. "[NEWLINE][NEWLINE]" .. strRewardTT;
end
controlTable.RewardIconsText:SetText(strRewardIcons);
controlTable.RewardIconsText:SetToolTipString(strRewardTT);
end
end
end
| mit |
condor-the-bird/tarantool | test/box/role.test.lua | 7 | 10751 | box.schema.role.create('iddqd')
box.schema.role.create('iddqd')
box.schema.role.drop('iddqd')
box.schema.role.drop('iddqd')
box.schema.role.create('iddqd')
-- impossible to su to a role
box.session.su('iddqd')
-- test granting privilege to a role
box.schema.role.grant('iddqd', 'execute', 'universe')
box.schema.role.info('iddqd')
box.schema.role.revoke('iddqd', 'execute', 'universe')
box.schema.role.info('iddqd')
-- test granting a role to a user
box.schema.user.create('tester')
box.schema.user.info('tester')
box.schema.user.grant('tester', 'execute', 'role', 'iddqd')
box.schema.user.info('tester')
-- test granting user to a user
box.schema.user.grant('tester', 'execute', 'role', 'tester')
-- test granting a non-execute grant on a role - error
box.schema.user.grant('tester', 'write', 'role', 'iddqd')
box.schema.user.grant('tester', 'read', 'role', 'iddqd')
-- test granting role to a role
box.schema.role.grant('iddqd', 'execute', 'role', 'iddqd')
box.schema.role.grant('iddqd', 'iddqd')
box.schema.role.revoke('iddqd', 'iddqd')
box.schema.user.grant('tester', 'iddqd')
box.schema.user.revoke('tester', 'iddqd')
box.schema.role.drop('iddqd')
box.schema.user.revoke('tester', 'no-such-role')
box.schema.user.grant('tester', 'no-such-role')
box.schema.user.drop('tester')
-- check for loops in role grants
box.schema.role.create('a')
box.schema.role.create('b')
box.schema.role.create('c')
box.schema.role.create('d')
box.schema.role.grant('b', 'a')
box.schema.role.grant('c', 'a')
box.schema.role.grant('d', 'b')
box.schema.role.grant('d', 'c')
--check user restrictions
box.schema.user.grant('a', 'd')
box.schema.user.revoke('a', 'd')
box.schema.user.drop('a')
box.schema.role.grant('a', 'd')
box.schema.role.drop('d')
box.schema.role.drop('b')
box.schema.role.drop('c')
box.schema.role.drop('a')
-- check that when dropping a role, it's first revoked
-- from whoever it is granted
box.schema.role.create('a')
box.schema.role.create('b')
box.schema.role.grant('b', 'a')
box.schema.role.drop('a')
box.schema.role.info('b')
box.schema.role.drop('b')
-- check a grant received via a role
box.schema.user.create('test')
box.schema.user.create('grantee')
box.schema.role.create('liaison')
--check role restrictions
box.schema.role.grant('test', 'liaison')
box.schema.role.revoke('test', 'liaison')
box.schema.role.drop('test')
box.schema.user.grant('grantee', 'liaison')
box.schema.user.grant('test', 'read,write', 'universe')
box.session.su('test')
s = box.schema.space.create('test')
_ = s:create_index('i1')
box.schema.role.grant('liaison', 'read,write', 'space', 'test')
box.session.su('grantee')
box.space.test:insert{1}
box.space.test:select{1}
box.session.su('test')
box.schema.role.revoke('liaison', 'read,write', 'space', 'test')
box.session.su('grantee')
box.space.test:insert{1}
box.space.test:select{1}
box.session.su('admin')
box.schema.user.drop('test')
box.schema.user.drop('grantee')
box.schema.role.drop('liaison')
--
-- Test how privileges are propagated through a complex role graph.
-- Here's the graph:
--
-- role1 ->- role2 -->- role4 -->- role6 ->- user1
-- \ / \
-- \->- role5 ->-/ \->- role9 ->- role10 ->- user
-- / \ /
-- role3 ->-/ \->- role7 ->-/
--
-- Privilege checks verify that grants/revokes are propagated correctly
-- from the role1 to role10.
--
box.schema.user.create("user")
box.schema.role.create("role1")
box.schema.role.create("role2")
box.schema.role.create("role3")
box.schema.role.create("role4")
box.schema.role.create("role5")
box.schema.role.create("role6")
box.schema.role.create("role7")
box.schema.user.create("user1")
box.schema.role.create("role9")
box.schema.role.create("role10")
box.schema.role.grant("role2", "role1")
box.schema.role.grant("role4", "role2")
box.schema.role.grant("role5", "role2")
box.schema.role.grant("role5", "role3")
box.schema.role.grant("role6", "role4")
box.schema.role.grant("role6", "role5")
box.schema.role.grant("role7", "role5")
box.schema.user.grant("user1", "role6")
box.schema.role.grant("role9", "role6")
box.schema.role.grant("role9", "role7")
box.schema.role.grant("role10", "role9")
box.schema.user.grant("user", "role10")
-- try to create a cycle
box.schema.role.grant("role2", "role10")
--
-- test grant propagation
--
box.schema.role.grant("role1", "read", "universe")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.session.su("admin")
box.schema.role.revoke("role1", "read", "universe")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.session.su("admin")
--
-- space-level privileges
--
box.schema.role.grant("role1", "read", "space", "_index")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.space._index:get{288, 0}[3]
box.session.su("admin")
box.schema.role.revoke("role1", "read", "space", "_index")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.space._index:get{288, 0}[3]
box.session.su("admin")
--
-- grant to a non-leaf branch
--
box.schema.role.grant("role5", "read", "space", "_index")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.space._index:get{288, 0}[3]
box.session.su("admin")
box.schema.role.revoke("role5", "read", "space", "_index")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.space._index:get{288, 0}[3]
box.session.su("admin")
--
-- grant via two branches
--
box.schema.role.grant("role3", "read", "space", "_index")
box.schema.role.grant("role4", "read", "space", "_index")
box.schema.role.grant("role9", "read", "space", "_index")
box.session.su("user")
box.space._index:get{288, 0}[3]
box.session.su("user1")
box.space._index:get{288, 0}[3]
box.session.su("admin")
box.schema.role.revoke("role3", "read", "space", "_index")
box.session.su("user")
box.space._index:get{288, 0}[3]
box.session.su("user1")
box.space._index:get{288, 0}[3]
box.session.su("admin")
box.schema.role.revoke("role4", "read", "space", "_index")
box.session.su("user")
box.space._index:get{288, 0}[3]
box.session.su("user1")
box.space._index:get{288, 0}[3]
box.session.su("admin")
box.schema.role.revoke("role9", "read", "space", "_index")
box.session.su("user")
box.space._index:get{288, 0}[3]
box.session.su("user1")
box.space._index:get{288, 0}[3]
box.session.su("admin")
--
-- check diamond-shaped grant graph
--
box.schema.role.grant("role5", "read", "space", "_space")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.session.su("user1")
box.space._space.index.name:get{"_space"}[3]
box.session.su("admin")
box.schema.role.revoke("role5", "read", "space", "_space")
box.session.su("user")
box.space._space.index.name:get{"_space"}[3]
box.session.su("user1")
box.space._space.index.name:get{"_space"}[3]
box.session.su("admin")
box.schema.user.drop("user")
box.schema.user.drop("user1")
box.schema.role.drop("role1")
box.schema.role.drop("role2")
box.schema.role.drop("role3")
box.schema.role.drop("role4")
box.schema.role.drop("role5")
box.schema.role.drop("role6")
box.schema.role.drop("role7")
box.schema.role.drop("role9")
box.schema.role.drop("role10")
--
-- only the creator of the role can grant it (or a superuser)
-- There is no grant option.
-- the same applies for privileges
--
box.schema.user.create('user')
box.schema.user.create('grantee')
box.schema.user.grant('user', 'read,write,execute', 'universe')
box.session.su('user')
box.schema.role.create('role')
box.session.su('admin')
box.schema.user.grant('grantee', 'role')
box.schema.user.revoke('grantee', 'role')
box.schema.user.create('john')
box.session.su('john')
-- error
box.schema.user.grant('grantee', 'role')
--
box.session.su('admin')
_ = box.schema.space.create('test')
box.schema.user.grant('john', 'read,write,execute', 'universe')
box.session.su('john')
box.schema.user.grant('grantee', 'role')
box.schema.user.grant('grantee', 'read', 'space', 'test')
--
-- granting 'public' is however an exception - everyone
-- can grant 'public' role, it's implicitly granted with
-- a grant option.
--
box.schema.user.grant('grantee', 'public')
--
-- revoking role 'public' is another deal - only the
-- superuser can do that, and even that would be useless,
-- since one can still re-grant it back to oneself.
--
box.schema.user.revoke('grantee', 'public')
box.session.su('admin')
box.schema.user.drop('john')
box.schema.user.drop('user')
box.schema.user.drop('grantee')
box.schema.role.drop('role')
box.space.test:drop()
--
-- grant a privilege through a role, but
-- the user has another privilege either granted
-- natively (one case) or via another role.
-- Check that privileges actually OR, but
-- not replace each other.
--
_ = box.schema.space.create('test')
_ = box.space.test:create_index('primary')
box.schema.user.create('john')
box.schema.user.grant('john', 'read', 'space', 'test')
box.session.su('john')
box.space.test:select{}
box.space.test:insert{1}
box.session.su('admin')
box.schema.role.grant('public', 'write', 'space', 'test')
box.session.su('john')
box.space.test:select{}
box.space.test:insert{2}
box.session.su('admin')
box.schema.role.revoke('public', 'write', 'space', 'test')
box.session.su('john')
box.space.test:select{}
box.space.test:insert{1}
box.session.su('admin')
box.space.test:drop()
box.schema.user.drop('john')
-- test ER_GRANT
box.space._priv:insert{1, 0, 'universe', 0, 0}
-- role.exists()
--
-- true if the role is present
box.schema.role.exists('public')
-- for if there is no such role
box.schema.role.exists('nosuchrole')
-- false for users
box.schema.role.exists('guest')
-- false for users
box.schema.role.exists('admin')
-- role id is ok
box.schema.role.exists(3)
-- user id
box.schema.role.exists(0)
box.schema.role.create('public', { if_not_exists = true})
box.schema.user.create('admin', { if_not_exists = true})
box.schema.user.create('guest', { if_not_exists = true})
box.schema.user.create('test', { if_not_exists = true})
box.schema.user.create('test', { if_not_exists = true})
box.schema.role.drop('test', { if_not_exists = true})
box.schema.role.drop('test', { if_exists = true})
box.schema.role.create('test', { if_not_exists = true})
box.schema.role.create('test', { if_not_exists = true})
box.schema.user.drop('test', { if_not_exists = true})
-- gh-664 roles: accepting bad syntax for create
box.schema.role.create('role', 'role')
box.schema.role.drop('role', 'role')
box.schema.user.drop('test', { if_exists = true})
-- gh-663: inconsistent roles grant/revoke
box.schema.role.create('X1')
box.schema.role.create('X2')
box.schema.role.info('X1')
box.schema.role.grant('X1','read','role','X2')
box.schema.role.info('X1')
box.schema.role.revoke('X1','read','role','X2')
box.schema.role.info('X1')
| bsd-2-clause |
sigurdfdragon/wesnoth-fork | data/lua/core/sides.lua | 5 | 4720 | --[========[Sides module]========]
if wesnoth.kernel_type() == "Game Lua Kernel" then
print("Loading sides module...")
local sides_mt = {
__metatable = "sides",
__index = function(_, key)
-- Only called if the key doesn't exist, so return nil if it's not a number
if type(key) == 'number' then
return wesnoth.sides.get(key)
end
end,
__len = function(_)
return #wesnoth.sides.find{}
end
}
setmetatable(wesnoth.sides, sides_mt)
-- Iterate over sides matching a filter
---@param filter WML
---@return fun(state:table)
---@return table state
function wesnoth.sides.iter(filter)
local function f(s)
local i = s.i
while i < #wesnoth.sides do
i = i + 1
if filter == nil or wesnoth.sides.matches(i, filter) then
s.i = i
return wesnoth.sides[i], i
end
end
end
return f, { i = 0 }
end
-- Deprecated functions
function wesnoth.set_side_variable(side, var, val)
wesnoth.sides[side].variables[var] = val
end
function wesnoth.get_side_variable(side, var)
return wesnoth.sides[side].variables[var]
end
function wesnoth.get_starting_location(side_num)
local side = side_num
if type(side) == 'number' then
side = wesnoth.sides[side]
end
return side.starting_location
end
local function place_shroud(side, shroud)
if type(shroud) == 'string' then
if shroud == 'all' then
wesnoth.sides.override_shroud(side, {})
else
local ls = wesnoth.require "location_set"
shroud = ls.of_shroud_data(shroud)
wesnoth.sides.place_shroud(side, (~shroud):to_pairs())
end
else
wesnoth.sides.place_shroud(side, shroud)
end
end
local function remove_shroud(side, shroud)
if type(shroud) == 'string' then
-- This may look wrong, but it's replicating the (undocumented) behaviour in 1.14
wesnoth.place_shroud(side, shroud)
return
end
wesnoth.sides.remove_shroud(side, shroud)
end
wesnoth.get_side_variable = wesnoth.deprecate_api('wesnoth.get_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.get_side_variable)
wesnoth.set_side_variable = wesnoth.deprecate_api('wesnoth.set_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.set_side_variable)
wesnoth.get_starting_location = wesnoth.deprecate_api('wesnoth.get_starting_location', 'wesnoth.sides[].starting_location', 1, nil, wesnoth.get_starting_location)
wesnoth.is_enemy = wesnoth.deprecate_api('wesnoth.is_enemy', 'wesnoth.sides.is_enemy', 1, nil, wesnoth.sides.is_enemy)
wesnoth.match_side = wesnoth.deprecate_api('wesnoth.match_side', 'wesnoth.sides.matches', 1, nil, wesnoth.sides.matches)
wesnoth.set_side_id = wesnoth.deprecate_api('wesnoth.set_side_id', 'wesnoth.sides.set_id', 1, nil, wesnoth.sides.set_id)
wesnoth.append_ai = wesnoth.deprecate_api('wesnoth.append_ai', 'wesnoth.sides.append_ai', 1, nil, wesnoth.sides.append_ai)
wesnoth.debug_ai = wesnoth.deprecate_api('wesnoth.debug_ai', 'wesnoth.sides.debug_ai', 1, nil, wesnoth.sides.debug_ai)
wesnoth.switch_ai = wesnoth.deprecate_api('wesnoth.switch_ai', 'wesnoth.sides.switch_ai', 1, nil, wesnoth.sides.switch_ai)
wesnoth.add_ai_component = wesnoth.deprecate_api('wesnoth.add_ai_component', 'wesnoth.sides.add_ai_component', 1, nil, wesnoth.sides.add_ai_component)
wesnoth.delete_ai_component = wesnoth.deprecate_api('wesnoth.delete_ai_component', 'wesnoth.sides.delete_ai_component', 1, nil, wesnoth.sides.delete_ai_component)
wesnoth.change_ai_component = wesnoth.deprecate_api('wesnoth.change_ai_component', 'wesnoth.sides.change_ai_component', 1, nil, wesnoth.sides.change_ai_component)
wesnoth.get_sides = wesnoth.deprecate_api('wesnoth.get_sides', 'wesnoth.sides.find', 1, nil, wesnoth.sides.find)
wesnoth.create_side = wesnoth.deprecate_api('wesnoth.create_side', 'wesnoth.sides.create', 1, nil, wesnoth.sides.create)
wesnoth.modify_ai = wesnoth.deprecate_api('wesnoth.modify_ai', 'wesnoth.sides.add|delete|change_ai_component', 1, nil, wesnoth.modify_ai)
wesnoth.place_shroud = wesnoth.deprecate_api('wesnoth.place_shroud', 'wesnoth.sides.place_shroud or wesnoth.sides.override_shroud', 1, nil, place_shroud)
wesnoth.remove_shroud = wesnoth.deprecate_api('wesnoth.remove_shroud', 'wesnoth.sides.remove_shroud', 1, nil, remove_shroud)
wesnoth.is_shrouded = wesnoth.deprecate_api('wesnoth.is_shrouded', 'wesnoth.sides.is_shrouded', 1, nil, wesnoth.sides.is_shrouded)
wesnoth.add_fog = wesnoth.deprecate_api('wesnoth.add_fog', 'wesnoth.sides.place_fog', 1, nil, wesnoth.sides.place_fog)
wesnoth.remove_fog = wesnoth.deprecate_api('wesnoth.remove_fog', 'wesnoth.sides.remove_fog', 1, nil, wesnoth.sides.remove_fog)
wesnoth.is_fogged = wesnoth.deprecate_api('wesnoth.is_fogged', 'wesnoth.sides.is_fogged', 1, nil, wesnoth.sides.is_fogged)
end
| gpl-2.0 |
Telebot1/Telewild | plugins/chat.lua | 2 | 1829 | local function run(msg)
if msg.text == "hi" then
return "Hello"
end
if msg.text == "Hi" then
return "Hello honey"
end
if msg.text == "Hello" then
return "Hi"
end
if msg.text == "hello" then
return "Hi honey"
end
if msg.text == "Salam" then
return "Salam"
end
if msg.text == "salam" then
return "salam"
end
if msg.text == "ali" then
return "با بابایی من چیکار داری"
end
if msg.text == "Ali" then
return "با بابایی من چیکار داری"
end
if msg.text == "ALI" then
return "با بابایی من چیکار داری"
end
if msg.text == "Telewild" then
return "jun?"
end
if msg.text == "telewild" then
return "jun?"
end
if msg.text == "Ashrar" then
return "اه اه کس ننشون"
end
if msg.text == "ashrar" then
return "اه اه کس ننشون"
end
if msg.text == "ASHRAR" then
return "اه اه کس ننشون"
end
if msg.text == "Dark" then
return "با جیگرای من چیکار داری"
end
if msg.text == "dark" then
return "با جیگرای من چیکار داری"
end
if msg.text == "DARK" then
return "با جیگرای من چیکار داری"
end
if msg.text == "Ali Dark" then
return "هان چیکارش داری بابامو ؟"
end
if msg.text == "bot" then
return "Ha?"
end
if msg.text == "Bot" then
return "Ha?"
end
if msg.text == "?" then
return "Hum??"
end
if msg.text == "Bye" then
return "Babay"
end
if msg.text == "bye" then
return "Bye Bye"
end
end
return {
description = "Chat With Robot Server",
usage = "chat with robot",
patterns = {
"^[Hh]i$",
"^[Hh]ello$",
"^[Aa]li$",
"^[Dd]ark$",
"^[Aa]shrar$",
"^[Aa]liDark$",
"^ALI$",
"^DARK$",
"^ASHRAR$",
"^[Bb]ot$",
"^[Tt]elewild$",
"^[Bb]ye$",
"^?$",
"^[Ss]alam$",
},
run = run,
--privileged = true,
pre_process = pre_process
}
| gpl-2.0 |
dvr333/Zero-K | LuaRules/Gadgets/CAI/UnitListHandler.lua | 8 | 7353 | --[[ Handles Lists of Units
* Create as a list of unit with some local functions.
* Can get total unit cost, a random unit, units in area etc..
* Elements can have custom data.
== CreateUnitList(losCheckAllyTeamID)
losCheckAllyTeamID is the point of view that the return functions should take
regarding LOS. A non-cheating AI would always create a unit list with its
allyTeamID to ensure that the UnitList does not cheat.
=== local functions ===
== GetUnitPosition(unitID) -> {x, y, z} or false
Returns the position of the unitID obeying LOS and radar.
== GetNearestUnit(x, z, condition) -> unitID
Returns the nearest unit in the list which satisfies the condition.
The condition is a local function of the form
condition(unitID, x, z, customData, cost).
== HasUnitMoved(unitID, range) -> boolean
Returns true if the unit is range away from where it was when HasUnitMoved
was last called.
== IsPositionNearUnit(x, z, radius, condition) -> boolean
Returns true if there is a unit from the list satisfying the conditions
within the radius around the point. The condition is the same as in
GetNearestUnit.
== OverwriteUnitData(unitID, newData)
== GetUnitData(unitID) -> table
== SetUnitDataValue(unitID, key, value)
local functions which get and set the custom data attachable to units in the list.
== AddUnit(unitID, static, cost, newData)
Adds a unit to the list.
- static tells the list whether the unit can move.
- cost is just treated as a number.
- newData is a table of information to attach to the unit.
== RemoveUnit(unitID) -> boolean
Remove a unit from the list
== GetUnitCost(unitID) -> cost
== GetTotalCost() -> cost
== ValidUnitID(unitID) -> boolean
Returns true if the unit is in the list.
== Iterator() -> unitID, cost, customData
Provides a way to iterate over units in the list. It is not safe to remove units
while iterating over them. To use do this:
for unitID, cost, customData in unitList.Iterator() do
...
end
--]]
local spGetUnitPosition = Spring.GetUnitPosition
local spGetUnitLosState = Spring.GetUnitLosState
local UnitListHandler = {}
local function DisSQ(x1,z1,x2,z2)
return (x1 - x2)^2 + (z1 - z2)^2
end
local function InternalGetUnitPosition(data, losCheckAllyTeamID)
if data.static then
if data.x then
return data.x, data.y, data.z
else
local x,y,z = spGetUnitPosition(data.unitID)
data.x = x
data.y = y
data.z = z
return x, y, z
end
end
if losCheckAllyTeamID then
local los = spGetUnitLosState(data.unitID, losCheckAllyTeamID, false)
if los and (los.los or los.radar) and los.typed then
local x,y,z = spGetUnitPosition(data.unitID)
return x, y, z
end
else
local x,y,z = spGetUnitPosition(data.unitID)
return x, y, z
end
return false
end
function UnitListHandler.CreateUnitList(losCheckAllyTeamID)
local unitMap = {}
local unitList = {}
local unitCount = 0
local totalCost = 0
-- Indiviual Unit Position local functions
local function GetUnitPosition(unitID)
if unitMap[unitID] then
local index = unitMap[unitID]
return InternalGetUnitPosition(unitList[index], losCheckAllyTeamID)
end
end
local function HasUnitMoved(unitID, range)
if not unitMap[unitID] then
return false
end
local index = unitMap[unitID]
local data = unitList[index]
if data.static then
return false
end
local x,_,z = InternalGetUnitPosition(data, losCheckAllyTeamID)
if x then
if not data.oldX then
data.oldX = x
data.oldZ = z
return true
end
if DisSQ(x,z,data.oldX,data.oldZ) > range^2 then
data.oldX = x
data.oldZ = z
return true
end
return false
end
return true
end
-- Position checks over all units in the list
local function GetNearestUnit(x,z,condition)
local minDisSq = false
local closeID = false
local closeX = false
local closeZ = false
for i = 1, unitCount do
local data = unitList[i]
local ux,_,uz = InternalGetUnitPosition(data, losCheckAllyTeamID)
if ux and condition and condition(data.unitID, ux, uz, data.customData, data.cost) then
local thisDisSq = DisSQ(x,z,ux,uz)
if not minDisSq or minDisSq > thisDisSq then
minDisSq = thisDisSq
closeID = data.unitID
closeX = x
closeZ = z
end
end
end
return closeID, closeX, closeZ
end
local function IsPositionNearUnit(x, z, radius, condition)
local radiusSq = radius^2
for i = 1, unitCount do
local data = unitList[i]
local ux,_,uz = InternalGetUnitPosition(data, losCheckAllyTeamID)
if ux and condition and condition(data.unitID, ux, uz, data.customData, data.cost) then
local thisDisSq = DisSQ(x,z,ux,uz)
if thisDisSq < radiusSq then
return true
end
end
end
return false
end
-- Unit cust data handling
local function OverwriteUnitData(unitID, newData)
if unitMap[unitID] then
local index = unitMap[unitID]
unitList[index].customData = newData
end
end
local function GetUnitData(unitID)
-- returns a table but don't edit it!
if unitMap[unitID] then
local index = unitMap[unitID]
return unitList[index].customData or {}
end
end
local function SetUnitDataValue(unitID, key, value)
if unitMap[unitID] then
local index = unitMap[unitID]
if not unitList[index].customData then
unitList[index].customData = {}
end
unitList[index].customData[key] = value
end
end
-- Unit addition and removal handling
local function AddUnit(unitID, static, cost, newData)
if unitMap[unitID] then
if newData then
OverwriteUnitData(unitID, newData)
end
return false
end
cost = cost or 0
-- Add unit to list
unitCount = unitCount + 1
unitList[unitCount] = {
unitID = unitID,
static = static,
cost = cost,
customData = newData,
}
unitMap[unitID] = unitCount
totalCost = totalCost + cost
return true
end
local function RemoveUnit(unitID)
if unitMap[unitID] then
local index = unitMap[unitID]
totalCost = totalCost - unitList[index].cost
-- Copy the end of the list to this index
unitList[index] = unitList[unitCount]
unitMap[unitList[index].unitID] = index
-- Remove the end of the list
unitList[unitCount] = nil
unitCount = unitCount - 1
unitMap[unitID] = nil
return true
end
return false
end
local function ValidUnitID(unitID)
return (unitMap[unitID] and true) or false
end
-- Cost Handling
local function GetUnitCost(unitID)
if unitMap[unitID] then
local index = unitMap[unitID]
return unitList[index].cost
end
end
local function GetTotalCost()
return totalCost
end
-- To use Iterator, write "for unitID, data in unitList.Iterator() do"
local function Iterator()
local i = 0
return function ()
i = i + 1
if i <= unitCount then
return unitList[i].unitID, unitList[i].cost, unitList[i].customData
end
end
end
local newUnitList = {
GetUnitPosition = GetUnitPosition,
GetNearestUnit = GetNearestUnit,
HasUnitMoved = HasUnitMoved,
IsPositionNearUnit = IsPositionNearUnit,
OverwriteUnitData = OverwriteUnitData,
GetUnitData = GetUnitData,
SetUnitDataValue = SetUnitDataValue,
AddUnit = AddUnit,
RemoveUnit = RemoveUnit,
GetUnitCost = GetUnitCost,
GetTotalCost = GetTotalCost,
ValidUnitID = ValidUnitID,
Iterator = Iterator,
}
return newUnitList
end
return UnitListHandler
| gpl-2.0 |
m241dan/darkstar | scripts/zones/Alzadaal_Undersea_Ruins/TextIDs.lua | 22 | 1261 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory
ITEM_OBTAINED = 6384; -- Obtained: <item>
GIL_OBTAINED = 6385; -- Obtained <number> gil
KEYITEM_OBTAINED = 6387; -- Obtained key item: <keyitem>
-- Assault / Salvage
CANNOT_ENTER = 7437; -- You cannot enter at this time. Please wait a while before trying again.
AREA_FULL = 7438; -- This area is fully occupied. You were unable to enter.
MEMBER_NO_REQS = 7442; -- Not all of your party members meet the requirements for this objective. Unable to enter area.
MEMBER_TOO_FAR = 7446; -- One or more party members are too far away from the entrance. Unable to enter area.
MEMBER_IMBUED_ITEM = 7447; -- One or more party members are carrying imbued items. Unable to enter area
IMBUED_ITEM = 7448; -- You are carrying imbued items. Unable to enter area
MYTHIC_REQUIRED = 7450; -- You do not have the appropriate mythic weapon equipped. Unable to enter area.
-- Other Texts
NOTHING_HAPPENS = 119; -- Nothing happens...
RESPONSE = 7225; -- There is no response...
DEVICE_MALFUNCTIONING = 7241; -- The device appears to be malfunctioning...
| gpl-3.0 |
aqasaeed/uzzbot | plugins/face.lua | 641 | 3073 | local https = require("ssl.https")
local ltn12 = require "ltn12"
-- Edit data/mashape.lua with your Mashape API key
-- http://docs.mashape.com/api-keys
local mashape = load_from_file('data/mashape.lua', {
api_key = ''
})
local function request(imageUrl)
local api_key = mashape.api_key
if api_key:isempty() then
return nil, 'Configure your Mashape API Key'
end
local api = "https://faceplusplus-faceplusplus.p.mashape.com/detection/detect?"
local parameters = "attribute=gender%2Cage%2Crace"
parameters = parameters .. "&url="..(URL.escape(imageUrl) or "")
local url = api..parameters
local headers = {
["X-Mashape-Key"] = api_key,
["Accept"] = "Accept: application/json"
}
print(url)
local respbody = {}
local body, code = https.request{
url = url,
method = "GET",
headers = headers,
sink = ltn12.sink.table(respbody),
protocol = "tlsv1"
}
if code ~= 200 then return "", code end
local body = table.concat(respbody)
return body, code
end
local function parseData(data)
local jsonBody = json:decode(data)
local response = ""
if jsonBody.error ~= nil then
if jsonBody.error == "IMAGE_ERROR_FILE_TOO_LARGE" then
response = response .. "The image is too big. Provide a smaller image."
elseif jsonBody.error == "IMAGE_ERROR_FAILED_TO_DOWNLOAD" then
response = response .. "Is that a valid url for an image?"
else
response = response .. jsonBody.error
end
elseif jsonBody.face == nil or #jsonBody.face == 0 then
response = response .. "No faces found"
else
response = response .. #jsonBody.face .." face(s) found:\n\n"
for k,face in pairs(jsonBody.face) do
local raceP = ""
if face.attribute.race.confidence > 85.0 then
raceP = face.attribute.race.value:lower()
elseif face.attribute.race.confidence > 50.0 then
raceP = "(probably "..face.attribute.race.value:lower()..")"
else
raceP = "(posibly "..face.attribute.race.value:lower()..")"
end
if face.attribute.gender.confidence > 85.0 then
response = response .. "There is a "
else
response = response .. "There may be a "
end
response = response .. raceP .. " " .. face.attribute.gender.value:lower() .. " "
response = response .. ", " .. face.attribute.age.value .. "(±".. face.attribute.age.range ..") years old \n"
end
end
return response
end
local function run(msg, matches)
--return request('http://www.uni-regensburg.de/Fakultaeten/phil_Fak_II/Psychologie/Psy_II/beautycheck/english/durchschnittsgesichter/m(01-32)_gr.jpg')
local data, code = request(matches[1])
if code ~= 200 then return "There was an error. "..code end
return parseData(data)
end
return {
description = "Who is in that photo?",
usage = {
"!face [url]",
"!recognise [url]"
},
patterns = {
"^!face (.*)$",
"^!recognise (.*)$"
},
run = run
}
| gpl-2.0 |
tcellerier/Domoticz-LUA-scripts | script_device_telecommande.lua | 1 | 12614 | -------------------------------------------------------------
-- Script de gestion de la telecommande RF
------------------------------------------------------------
-- A parametrer dans chaque device Domoticz : Off Delay: 1 second !!!!
package.path = package.path .. ';' .. '/home/pi/domoticz/scripts/lua/?.lua'
require("library_credentials")
require("library")
idx = 66 -- identifiant domoticz de la lampe
server = '127.0.0.1'
brightness = tonumber(uservariables['Script_Lamp_brightness']) or 70 -- intensité de 1 à 100
hue = tonumber(uservariables['Script_Lamp_color_hue']) or 100 -- couleur (de 0 à 359)
iswhite = uservariables['Script_Lamp_iswhite'] or false -- couleur blanche ou pas (true / false)
frequence = tonumber(uservariables['Script_Lamp_Freq_Change']) or 1 -- Fréquence de change des couleurs / min
-- domoticzCredentials dans la library library_credentials
commandArray = {}
if (devicechanged['Telecommande On/Off'] == 'On') then
print('----- Telecommande On/Off -----')
if (otherdevices['Lampe Chambre RGBW'] == 'On' or otherdevices['Lampe Chambre RGBW'] == 'Set Level') then
-- On arrête le script de changement des couleurs s'il était démarré
commandArray['Lampe chambre Color Change'] = 'Off'
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
commandArray['Lampe Chambre RGBW'] = 'Off'
else
commandArray['Lampe Chambre RGBW'] = 'On'
end
elseif (devicechanged['Telecommande Demo'] == 'On') then
print('----- Telecommande Demo -----')
if (otherdevices['Lampe chambre Color Change'] == 'Off') then
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
commandArray['Lampe chambre Color Change'] = 'On'
tts_function('Demo On')
else
commandArray['Lampe chambre Color Change'] = 'Off'
tts_function('Demo Off')
-- Stoppe tous les changements de couleur prévus dans la minute
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
end
elseif (devicechanged['Telecommande Blanc'] == 'On') then
print('----- Telecommande Blanc -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'true'
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue..'&brightness='..brightness..'&iswhite=true" &'
os.execute(cmd)
-- On arrête le mode Démo
if (otherdevices['Lampe chambre Color Change'] == 'On') then
commandArray['Lampe chambre Color Change'] = 'Off'
tts_function('Demo Off')
end
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Rouge'] == 'On') then
print('----- Telecommande Rouge -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_rouge = '0'
commandArray['Variable:Script_Lamp_color_hue'] = hue_rouge
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_rouge..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Vert'] == 'On') then
print('----- Telecommande Vert -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_vert = '120'
commandArray['Variable:Script_Lamp_color_hue'] = hue_vert
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_vert..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Bleu'] == 'On') then
print('----- Telecommande Bleu -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_bleu = '240'
commandArray['Variable:Script_Lamp_color_hue'] = hue_bleu
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_bleu..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Jaune'] == 'On') then
print('----- Telecommande Jaune -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_jaune = '60'
commandArray['Variable:Script_Lamp_color_hue'] = hue_jaune
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_jaune..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Cyan'] == 'On') then
print('----- Telecommande Cyan -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_cyan = '180'
commandArray['Variable:Script_Lamp_color_hue'] = hue_cyan
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_cyan..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Violet'] == 'On') then
print('----- Telecommande Violet -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_violet = '300'
commandArray['Variable:Script_Lamp_color_hue'] = hue_violet
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_violet..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
-- Virtual device (pour l'interface tablette)
elseif (devicechanged['Telecommande Rose'] == 'On') then
print('----- Telecommande Rose (virutal device) -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_rose = '330'
commandArray['Variable:Script_Lamp_color_hue'] = hue_rose
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_rose..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Color-'] == 'On') then
print('----- Telecommande Color- -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_new = tostring((hue - 10) % 360)
commandArray['Variable:Script_Lamp_color_hue'] = hue_new
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_new..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Color+'] == 'On') then
print('----- Telecommande Color+ -----')
commandArray['Variable:Script_Lamp_iswhite'] = 'false'
hue_new = tostring((hue + 10) % 360)
commandArray['Variable:Script_Lamp_color_hue'] = hue_new
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue_new..'&brightness='..brightness..'&iswhite=false" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Bright-'] == 'On') then
print('----- Telecommande Bright- -----')
if (brightness < 25) then
brightness_new = tostring(math.max(1, brightness - 5))
else
brightness_new = tostring(math.max(1, brightness - 15))
end
commandArray['Variable:Script_Lamp_brightness'] = brightness_new
tts_function(brightness_new)
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue..'&brightness='..brightness_new..'&iswhite='..iswhite..'" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Bright+'] == 'On') then
print('----- Telecommande Bright+ -----')
if (brightness < 15) then
brightness_new = tostring(math.min(100, brightness + 5))
else
brightness_new = tostring(math.min(100, brightness + 15))
end
commandArray['Variable:Script_Lamp_brightness'] = brightness_new
tts_function(brightness_new)
cmd = 'curl --user '..domoticzCredentials..' "http://'..server..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..idx..'&hue='..hue..'&brightness='..brightness_new..'&iswhite='..iswhite..'" &'
os.execute(cmd)
-- On arrête tous les changements éventuels (Demo On) alors décorélés et prévus dans la minute en cours (puis reprise la minute suivante)
cmd = "for i in `ps axww | grep '^.*sleep.*curl.*setcolbrightnessvalue.*$' | awk '{ print $1 }'`; do kill -9 $i; done"
os.execute(cmd)
elseif (devicechanged['Telecommande Speed-'] == 'On') then
print('----- Telecommande Speed- -----')
frequence_new = tostring(math.max(1, (frequence - 1)))
tts_function(frequence_new)
commandArray['Variable:Script_Lamp_Freq_Change'] = frequence_new
elseif (devicechanged['Telecommande Speed+'] == 'On') then
print('----- Telecommande Speed+ -----')
frequence_new = tostring(math.min(6, (frequence + 1)))
tts_function(frequence_new)
commandArray['Variable:Script_Lamp_Freq_Change'] = frequence_new
elseif (devicechanged['Telecommande Mode-'] == 'On') then
print('----- Telecommande Mode- -----')
commandArray['Volets Chambre'] = 'Off'
elseif (devicechanged['Telecommande Mode+'] == 'On') then
print('----- Telecommande Mode+ -----')
commandArray['Volets Chambre'] = 'On'
end
return commandArray
| gpl-3.0 |
rekotc/game-engine-experimental-3 | Source/GCC4/3rdParty/luaplus51-all/Src/Modules/penlight/docs/markdown.lua | 3 | 40462 | #!/usr/bin/env lua
--[[
# markdown.lua -- version 0.32
<http://www.frykholm.se/files/markdown.lua>
**Author:** Niklas Frykholm, <niklas@frykholm.se>
**Date:** 31 May 2008
This is an implementation of the popular text markup language Markdown in pure Lua.
Markdown can convert documents written in a simple and easy to read text format
to well-formatted HTML. For a more thourough description of Markdown and the Markdown
syntax, see <http://daringfireball.net/projects/markdown>.
The original Markdown source is written in Perl and makes heavy use of advanced
regular expression techniques (such as negative look-ahead, etc) which are not available
in Lua's simple regex engine. Therefore this Lua port has been rewritten from the ground
up. It is probably not completely bug free. If you notice any bugs, please report them to
me. A unit test that exposes the error is helpful.
## Usage
require "markdown"
markdown(source)
``markdown.lua`` exposes a single global function named ``markdown(s)`` which applies the
Markdown transformation to the specified string.
``markdown.lua`` can also be used directly from the command line:
lua markdown.lua test.md
Creates a file ``test.html`` with the converted content of ``test.md``. Run:
lua markdown.lua -h
For a description of the command-line options.
``markdown.lua`` uses the same license as Lua, the MIT license.
## License
Copyright © 2008 Niklas Frykholm.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## Version history
- **0.32** -- 31 May 2008
- Fix for links containing brackets
- **0.31** -- 1 Mar 2008
- Fix for link definitions followed by spaces
- **0.30** -- 25 Feb 2008
- Consistent behavior with Markdown when the same link reference is reused
- **0.29** -- 24 Feb 2008
- Fix for <pre> blocks with spaces in them
- **0.28** -- 18 Feb 2008
- Fix for link encoding
- **0.27** -- 14 Feb 2008
- Fix for link database links with ()
- **0.26** -- 06 Feb 2008
- Fix for nested italic and bold markers
- **0.25** -- 24 Jan 2008
- Fix for encoding of naked <
- **0.24** -- 21 Jan 2008
- Fix for link behavior.
- **0.23** -- 10 Jan 2008
- Fix for a regression bug in longer expressions in italic or bold.
- **0.22** -- 27 Dec 2007
- Fix for crash when processing blocks with a percent sign in them.
- **0.21** -- 27 Dec 2007
- Fix for combined strong and emphasis tags
- **0.20** -- 13 Oct 2007
- Fix for < as well in image titles, now matches Dingus behavior
- **0.19** -- 28 Sep 2007
- Fix for quotation marks " and ampersands & in link and image titles.
- **0.18** -- 28 Jul 2007
- Does not crash on unmatched tags (behaves like standard markdown)
- **0.17** -- 12 Apr 2007
- Fix for links with %20 in them.
- **0.16** -- 12 Apr 2007
- Do not require arg global to exist.
- **0.15** -- 28 Aug 2006
- Better handling of links with underscores in them.
- **0.14** -- 22 Aug 2006
- Bug for *`foo()`*
- **0.13** -- 12 Aug 2006
- Added -l option for including stylesheet inline in document.
- Fixed bug in -s flag.
- Fixed emphasis bug.
- **0.12** -- 15 May 2006
- Fixed several bugs to comply with MarkdownTest 1.0 <http://six.pairlist.net/pipermail/markdown-discuss/2004-December/000909.html>
- **0.11** -- 12 May 2006
- Fixed bug for escaping `*` and `_` inside code spans.
- Added license terms.
- Changed join() to table.concat().
- **0.10** -- 3 May 2006
- Initial public release.
// Niklas
]]
-- Set up a table for holding local functions to avoid polluting the global namespace
local M = {}
local MT = {__index = _G}
setmetatable(M, MT)
setfenv(1, M)
----------------------------------------------------------------------
-- Utility functions
----------------------------------------------------------------------
-- Locks table t from changes, writes an error if someone attempts to change the table.
-- This is useful for detecting variables that have "accidently" been made global. Something
-- I tend to do all too much.
function lock(t)
function lock_new_index(t, k, v)
error("module has been locked -- " .. k .. " must be declared local", 2)
end
local mt = {__newindex = lock_new_index}
if getmetatable(t) then mt.__index = getmetatable(t).__index end
setmetatable(t, mt)
end
-- Returns the result of mapping the values in table t through the function f
function map(t, f)
local out = {}
for k,v in pairs(t) do out[k] = f(v,k) end
return out
end
-- The identity function, useful as a placeholder.
function identity(text) return text end
-- Functional style if statement. (NOTE: no short circuit evaluation)
function iff(t, a, b) if t then return a else return b end end
-- Splits the text into an array of separate lines.
function split(text, sep)
sep = sep or "\n"
local lines = {}
local pos = 1
while true do
local b,e = text:find(sep, pos)
if not b then table.insert(lines, text:sub(pos)) break end
table.insert(lines, text:sub(pos, b-1))
pos = e + 1
end
return lines
end
-- Converts tabs to spaces
function detab(text)
local tab_width = 4
local function rep(match)
local spaces = -match:len()
while spaces<1 do spaces = spaces + tab_width end
return match .. string.rep(" ", spaces)
end
text = text:gsub("([^\n]-)\t", rep)
return text
end
-- Applies string.find for every pattern in the list and returns the first match
function find_first(s, patterns, index)
local res = {}
for _,p in ipairs(patterns) do
local match = {s:find(p, index)}
if #match>0 and (#res==0 or match[1] < res[1]) then res = match end
end
return unpack(res)
end
-- If a replacement array is specified, the range [start, stop] in the array is replaced
-- with the replacement array and the resulting array is returned. Without a replacement
-- array the section of the array between start and stop is returned.
function splice(array, start, stop, replacement)
if replacement then
local n = stop - start + 1
while n > 0 do
table.remove(array, start)
n = n - 1
end
for i,v in ipairs(replacement) do
table.insert(array, start, v)
end
return array
else
local res = {}
for i = start,stop do
table.insert(res, array[i])
end
return res
end
end
-- Outdents the text one step.
function outdent(text)
text = "\n" .. text
text = text:gsub("\n ? ? ?", "\n")
text = text:sub(2)
return text
end
-- Indents the text one step.
function indent(text)
text = text:gsub("\n", "\n ")
return text
end
-- Does a simple tokenization of html data. Returns the data as a list of tokens.
-- Each token is a table with a type field (which is either "tag" or "text") and
-- a text field (which contains the original token data).
function tokenize_html(html)
local tokens = {}
local pos = 1
while true do
local start = find_first(html, {"<!%-%-", "<[a-z/!$]", "<%?"}, pos)
if not start then
table.insert(tokens, {type="text", text=html:sub(pos)})
break
end
if start ~= pos then table.insert(tokens, {type="text", text = html:sub(pos, start-1)}) end
local _, stop
if html:match("^<!%-%-", start) then
_,stop = html:find("%-%->", start)
elseif html:match("^<%?", start) then
_,stop = html:find("?>", start)
else
_,stop = html:find("%b<>", start)
end
if not stop then
-- error("Could not match html tag " .. html:sub(start,start+30))
table.insert(tokens, {type="text", text=html:sub(start, start)})
pos = start + 1
else
table.insert(tokens, {type="tag", text=html:sub(start, stop)})
pos = stop + 1
end
end
return tokens
end
----------------------------------------------------------------------
-- Hash
----------------------------------------------------------------------
-- This is used to "hash" data into alphanumeric strings that are unique
-- in the document. (Note that this is not cryptographic hash, the hash
-- function is not one-way.) The hash procedure is used to protect parts
-- of the document from further processing.
local HASH = {
-- Has the hash been inited.
inited = false,
-- The unique string prepended to all hash values. This is to ensure
-- that hash values do not accidently coincide with an actual existing
-- string in the document.
identifier = "",
-- Counter that counts up for each new hash instance.
counter = 0,
-- Hash table.
table = {}
}
-- Inits hashing. Creates a hash_identifier that doesn't occur anywhere
-- in the text.
function init_hash(text)
HASH.inited = true
HASH.identifier = ""
HASH.counter = 0
HASH.table = {}
local s = "HASH"
local counter = 0
local id
while true do
id = s .. counter
if not text:find(id, 1, true) then break end
counter = counter + 1
end
HASH.identifier = id
end
-- Returns the hashed value for s.
function hash(s)
assert(HASH.inited)
if not HASH.table[s] then
HASH.counter = HASH.counter + 1
local id = HASH.identifier .. HASH.counter .. "X"
HASH.table[s] = id
end
return HASH.table[s]
end
----------------------------------------------------------------------
-- Protection
----------------------------------------------------------------------
-- The protection module is used to "protect" parts of a document
-- so that they are not modified by subsequent processing steps.
-- Protected parts are saved in a table for later unprotection
-- Protection data
local PD = {
-- Saved blocks that have been converted
blocks = {},
-- Block level tags that will be protected
tags = {"p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote",
"pre", "table", "dl", "ol", "ul", "script", "noscript", "form", "fieldset",
"iframe", "math", "ins", "del"}
}
-- Pattern for matching a block tag that begins and ends in the leftmost
-- column and may contain indented subtags, i.e.
-- <div>
-- A nested block.
-- <div>
-- Nested data.
-- </div>
-- </div>
function block_pattern(tag)
return "\n<" .. tag .. ".-\n</" .. tag .. ">[ \t]*\n"
end
-- Pattern for matching a block tag that begins and ends with a newline
function line_pattern(tag)
return "\n<" .. tag .. ".-</" .. tag .. ">[ \t]*\n"
end
-- Protects the range of characters from start to stop in the text and
-- returns the protected string.
function protect_range(text, start, stop)
local s = text:sub(start, stop)
local h = hash(s)
PD.blocks[h] = s
text = text:sub(1,start) .. h .. text:sub(stop)
return text
end
-- Protect every part of the text that matches any of the patterns. The first
-- matching pattern is protected first, etc.
function protect_matches(text, patterns)
while true do
local start, stop = find_first(text, patterns)
if not start then break end
text = protect_range(text, start, stop)
end
return text
end
-- Protects blocklevel tags in the specified text
function protect(text)
-- First protect potentially nested block tags
text = protect_matches(text, map(PD.tags, block_pattern))
-- Then protect block tags at the line level.
text = protect_matches(text, map(PD.tags, line_pattern))
-- Protect <hr> and comment tags
text = protect_matches(text, {"\n<hr[^>]->[ \t]*\n"})
text = protect_matches(text, {"\n<!%-%-.-%-%->[ \t]*\n"})
return text
end
-- Returns true if the string s is a hash resulting from protection
function is_protected(s)
return PD.blocks[s]
end
-- Unprotects the specified text by expanding all the nonces
function unprotect(text)
for k,v in pairs(PD.blocks) do
v = v:gsub("%%", "%%%%")
text = text:gsub(k, v)
end
return text
end
----------------------------------------------------------------------
-- Block transform
----------------------------------------------------------------------
-- The block transform functions transform the text on the block level.
-- They work with the text as an array of lines rather than as individual
-- characters.
-- Returns true if the line is a ruler of (char) characters.
-- The line must contain at least three char characters and contain only spaces and
-- char characters.
function is_ruler_of(line, char)
if not line:match("^[ %" .. char .. "]*$") then return false end
if not line:match("%" .. char .. ".*%" .. char .. ".*%" .. char) then return false end
return true
end
-- Identifies the block level formatting present in the line
function classify(line)
local info = {line = line, text = line}
if line:match("^ ") then
info.type = "indented"
info.outdented = line:sub(5)
return info
end
for _,c in ipairs({'*', '-', '_', '='}) do
if is_ruler_of(line, c) then
info.type = "ruler"
info.ruler_char = c
return info
end
end
if line == "" then
info.type = "blank"
return info
end
if line:match("^(#+)[ \t]*(.-)[ \t]*#*[ \t]*$") then
local m1, m2 = line:match("^(#+)[ \t]*(.-)[ \t]*#*[ \t]*$")
info.type = "header"
info.level = m1:len()
info.text = m2
return info
end
if line:match("^ ? ? ?(%d+)%.[ \t]+(.+)") then
local number, text = line:match("^ ? ? ?(%d+)%.[ \t]+(.+)")
info.type = "list_item"
info.list_type = "numeric"
info.number = 0 + number
info.text = text
return info
end
if line:match("^ ? ? ?([%*%+%-])[ \t]+(.+)") then
local bullet, text = line:match("^ ? ? ?([%*%+%-])[ \t]+(.+)")
info.type = "list_item"
info.list_type = "bullet"
info.bullet = bullet
info.text= text
return info
end
if line:match("^>[ \t]?(.*)") then
info.type = "blockquote"
info.text = line:match("^>[ \t]?(.*)")
return info
end
if is_protected(line) then
info.type = "raw"
info.html = unprotect(line)
return info
end
info.type = "normal"
return info
end
-- Find headers constisting of a normal line followed by a ruler and converts them to
-- header entries.
function headers(array)
local i = 1
while i <= #array - 1 do
if array[i].type == "normal" and array[i+1].type == "ruler" and
(array[i+1].ruler_char == "-" or array[i+1].ruler_char == "=") then
local info = {line = array[i].line}
info.text = info.line
info.type = "header"
info.level = iff(array[i+1].ruler_char == "=", 1, 2)
table.remove(array, i+1)
array[i] = info
end
i = i + 1
end
return array
end
-- Find list blocks and convert them to protected data blocks
function lists(array, sublist)
local function process_list(arr)
local function any_blanks(arr)
for i = 1, #arr do
if arr[i].type == "blank" then return true end
end
return false
end
local function split_list_items(arr)
local acc = {arr[1]}
local res = {}
for i=2,#arr do
if arr[i].type == "list_item" then
table.insert(res, acc)
acc = {arr[i]}
else
table.insert(acc, arr[i])
end
end
table.insert(res, acc)
return res
end
local function process_list_item(lines, block)
while lines[#lines].type == "blank" do
table.remove(lines)
end
local itemtext = lines[1].text
for i=2,#lines do
itemtext = itemtext .. "\n" .. outdent(lines[i].line)
end
if block then
itemtext = block_transform(itemtext, true)
if not itemtext:find("<pre>") then itemtext = indent(itemtext) end
return " <li>" .. itemtext .. "</li>"
else
local lines = split(itemtext)
lines = map(lines, classify)
lines = lists(lines, true)
lines = blocks_to_html(lines, true)
itemtext = table.concat(lines, "\n")
if not itemtext:find("<pre>") then itemtext = indent(itemtext) end
return " <li>" .. itemtext .. "</li>"
end
end
local block_list = any_blanks(arr)
local items = split_list_items(arr)
local out = ""
for _, item in ipairs(items) do
out = out .. process_list_item(item, block_list) .. "\n"
end
if arr[1].list_type == "numeric" then
return "<ol>\n" .. out .. "</ol>"
else
return "<ul>\n" .. out .. "</ul>"
end
end
-- Finds the range of lines composing the first list in the array. A list
-- starts with (^ list_item) or (blank list_item) and ends with
-- (blank* $) or (blank normal).
--
-- A sublist can start with just (list_item) does not need a blank...
local function find_list(array, sublist)
local function find_list_start(array, sublist)
if array[1].type == "list_item" then return 1 end
if sublist then
for i = 1,#array do
if array[i].type == "list_item" then return i end
end
else
for i = 1, #array-1 do
if array[i].type == "blank" and array[i+1].type == "list_item" then
return i+1
end
end
end
return nil
end
local function find_list_end(array, start)
local pos = #array
for i = start, #array-1 do
if array[i].type == "blank" and array[i+1].type ~= "list_item"
and array[i+1].type ~= "indented" and array[i+1].type ~= "blank" then
pos = i-1
break
end
end
while pos > start and array[pos].type == "blank" do
pos = pos - 1
end
return pos
end
local start = find_list_start(array, sublist)
if not start then return nil end
return start, find_list_end(array, start)
end
while true do
local start, stop = find_list(array, sublist)
if not start then break end
local text = process_list(splice(array, start, stop))
local info = {
line = text,
type = "raw",
html = text
}
array = splice(array, start, stop, {info})
end
-- Convert any remaining list items to normal
for _,line in ipairs(array) do
if line.type == "list_item" then line.type = "normal" end
end
return array
end
-- Find and convert blockquote markers.
function blockquotes(lines)
local function find_blockquote(lines)
local start
for i,line in ipairs(lines) do
if line.type == "blockquote" then
start = i
break
end
end
if not start then return nil end
local stop = #lines
for i = start+1, #lines do
if lines[i].type == "blank" or lines[i].type == "blockquote" then
elseif lines[i].type == "normal" then
if lines[i-1].type == "blank" then stop = i-1 break end
else
stop = i-1 break
end
end
while lines[stop].type == "blank" do stop = stop - 1 end
return start, stop
end
local function process_blockquote(lines)
local raw = lines[1].text
for i = 2,#lines do
raw = raw .. "\n" .. lines[i].text
end
local bt = block_transform(raw)
if not bt:find("<pre>") then bt = indent(bt) end
return "<blockquote>\n " .. bt ..
"\n</blockquote>"
end
while true do
local start, stop = find_blockquote(lines)
if not start then break end
local text = process_blockquote(splice(lines, start, stop))
local info = {
line = text,
type = "raw",
html = text
}
lines = splice(lines, start, stop, {info})
end
return lines
end
-- Find and convert codeblocks.
function codeblocks(lines)
local function find_codeblock(lines)
local start
for i,line in ipairs(lines) do
if line.type == "indented" then start = i break end
end
if not start then return nil end
local stop = #lines
for i = start+1, #lines do
if lines[i].type ~= "indented" and lines[i].type ~= "blank" then
stop = i-1
break
end
end
while lines[stop].type == "blank" do stop = stop - 1 end
return start, stop
end
local function process_codeblock(lines)
local raw = detab(encode_code(outdent(lines[1].line)))
for i = 2,#lines do
raw = raw .. "\n" .. detab(encode_code(outdent(lines[i].line)))
end
return "<pre><code>" .. raw .. "\n</code></pre>"
end
while true do
local start, stop = find_codeblock(lines)
if not start then break end
local text = process_codeblock(splice(lines, start, stop))
local info = {
line = text,
type = "raw",
html = text
}
lines = splice(lines, start, stop, {info})
end
return lines
end
local idcount = 1
local list_of_headers = {}
local first_header
-- Convert lines to html code
function blocks_to_html(lines, no_paragraphs)
local out = {}
local i = 1
while i <= #lines do
local line = lines[i]
if line.type == "ruler" then
table.insert(out, "<hr/>")
elseif line.type == "raw" then
table.insert(out, line.html)
elseif line.type == "normal" then
local s = line.line
while i+1 <= #lines and lines[i+1].type == "normal" do
i = i + 1
s = s .. "\n" .. lines[i].line
end
if no_paragraphs then
table.insert(out, span_transform(s))
else
table.insert(out, "<p>" .. span_transform(s) .. "</p>")
end
elseif line.type == "header" then
local txt = span_transform(line.text)
local id = "T" .. idcount
local s = "<h" .. line.level .. ' id="'.. id .. '">' .. txt .. "</h" .. line.level .. ">"
if not first_header then
first_header = {line=s,text=txt}
else
table.insert(out, s)
table.insert(list_of_headers, {level=line.level,text=txt,id=id})
end
idcount = idcount + 1
else
table.insert(out, line.line)
end
i = i + 1
end
return out
end
-- Perform all the block level transforms
function block_transform(text, sublist)
local lines = split(text)
lines = map(lines, classify)
lines = headers(lines)
lines = lists(lines, sublist)
lines = codeblocks(lines)
lines = blockquotes(lines)
lines = blocks_to_html(lines)
local text = table.concat(lines, "\n")
return text
end
-- Debug function for printing a line array to see the result
-- of partial transforms.
function print_lines(lines)
for i, line in ipairs(lines) do
print(i, line.type, line.text or line.line)
end
end
----------------------------------------------------------------------
-- Span transform
----------------------------------------------------------------------
-- Functions for transforming the text at the span level.
-- These characters may need to be escaped because they have a special
-- meaning in markdown.
escape_chars = "'\\`*_{}[]()>#+-.!'"
escape_table = {}
function init_escape_table()
escape_table = {}
for i = 1,#escape_chars do
local c = escape_chars:sub(i,i)
escape_table[c] = hash(c)
end
end
-- Adds a new escape to the escape table.
function add_escape(text)
if not escape_table[text] then
escape_table[text] = hash(text)
end
return escape_table[text]
end
-- Escape characters that should not be disturbed by markdown.
function escape_special_chars(text)
local tokens = tokenize_html(text)
local out = ""
for _, token in ipairs(tokens) do
local t = token.text
if token.type == "tag" then
-- In tags, encode * and _ so they don't conflict with their use in markdown.
t = t:gsub("%*", escape_table["*"])
t = t:gsub("%_", escape_table["_"])
else
t = encode_backslash_escapes(t)
end
out = out .. t
end
return out
end
-- Encode backspace-escaped characters in the markdown source.
function encode_backslash_escapes(t)
for i=1,escape_chars:len() do
local c = escape_chars:sub(i,i)
t = t:gsub("\\%" .. c, escape_table[c])
end
return t
end
-- Unescape characters that have been encoded.
function unescape_special_chars(t)
local tin = t
for k,v in pairs(escape_table) do
k = k:gsub("%%", "%%%%")
t = t:gsub(v,k)
end
if t ~= tin then t = unescape_special_chars(t) end
return t
end
-- Encode/escape certain characters inside Markdown code runs.
-- The point is that in code, these characters are literals,
-- and lose their special Markdown meanings.
function encode_code(s)
s = s:gsub("%&", "&")
s = s:gsub("<", "<")
s = s:gsub(">", ">")
for k,v in pairs(escape_table) do
s = s:gsub("%"..k, v)
end
return s
end
-- Handle backtick blocks.
function code_spans(s)
s = s:gsub("\\\\", escape_table["\\"])
s = s:gsub("\\`", escape_table["`"])
local pos = 1
while true do
local start, stop = s:find("`+", pos)
if not start then return s end
local count = stop - start + 1
-- Find a matching numbert of backticks
local estart, estop = s:find(string.rep("`", count), stop+1)
local brstart = s:find("\n", stop+1)
if estart and (not brstart or estart < brstart) then
local code = s:sub(stop+1, estart-1)
code = code:gsub("^[ \t]+", "")
code = code:gsub("[ \t]+$", "")
code = code:gsub(escape_table["\\"], escape_table["\\"] .. escape_table["\\"])
code = code:gsub(escape_table["`"], escape_table["\\"] .. escape_table["`"])
code = "<code>" .. encode_code(code) .. "</code>"
code = add_escape(code)
s = s:sub(1, start-1) .. code .. s:sub(estop+1)
pos = start + code:len()
else
pos = stop + 1
end
end
return s
end
-- Encode alt text... enodes &, and ".
function encode_alt(s)
if not s then return s end
s = s:gsub('&', '&')
s = s:gsub('"', '"')
s = s:gsub('<', '<')
return s
end
-- Handle image references
function images(text)
local function reference_link(alt, id)
alt = encode_alt(alt:match("%b[]"):sub(2,-2))
id = id:match("%[(.*)%]"):lower()
if id == "" then id = text:lower() end
link_database[id] = link_database[id] or {}
if not link_database[id].url then return nil end
local url = link_database[id].url or id
url = encode_alt(url)
local title = encode_alt(link_database[id].title)
if title then title = " title=\"" .. title .. "\"" else title = "" end
return add_escape ('<img src="' .. url .. '" alt="' .. alt .. '"' .. title .. "/>")
end
local function inline_link(alt, link)
alt = encode_alt(alt:match("%b[]"):sub(2,-2))
local url, title = link:match("%(<?(.-)>?[ \t]*['\"](.+)['\"]")
url = url or link:match("%(<?(.-)>?%)")
url = encode_alt(url)
title = encode_alt(title)
if title then
return add_escape('<img src="' .. url .. '" alt="' .. alt .. '" title="' .. title .. '"/>')
else
return add_escape('<img src="' .. url .. '" alt="' .. alt .. '"/>')
end
end
text = text:gsub("!(%b[])[ \t]*\n?[ \t]*(%b[])", reference_link)
text = text:gsub("!(%b[])(%b())", inline_link)
return text
end
-- Handle anchor references
function anchors(text)
local function reference_link(text, id)
text = text:match("%b[]"):sub(2,-2)
id = id:match("%b[]"):sub(2,-2):lower()
if id == "" then id = text:lower() end
link_database[id] = link_database[id] or {}
if not link_database[id].url then return nil end
local url = link_database[id].url or id
url = encode_alt(url)
local title = encode_alt(link_database[id].title)
if title then title = " title=\"" .. title .. "\"" else title = "" end
return add_escape("<a href=\"" .. url .. "\"" .. title .. ">") .. text .. add_escape("</a>")
end
local function inline_link(text, link)
text = text:match("%b[]"):sub(2,-2)
local url, title = link:match("%(<?(.-)>?[ \t]*['\"](.+)['\"]")
title = encode_alt(title)
url = url or link:match("%(<?(.-)>?%)") or ""
url = encode_alt(url)
if title then
return add_escape("<a href=\"" .. url .. "\" title=\"" .. title .. "\">") .. text .. "</a>"
else
return add_escape("<a href=\"" .. url .. "\">") .. text .. add_escape("</a>")
end
end
text = text:gsub("(%b[])[ \t]*\n?[ \t]*(%b[])", reference_link)
text = text:gsub("(%b[])(%b())", inline_link)
return text
end
-- Handle auto links, i.e. <http://www.google.com/>.
function auto_links(text)
local function link(s)
return add_escape("<a href=\"" .. s .. "\">") .. s .. "</a>"
end
-- Encode chars as a mix of dec and hex entitites to (perhaps) fool
-- spambots.
local function encode_email_address(s)
-- Use a deterministic encoding to make unit testing possible.
-- Code 45% hex, 45% dec, 10% plain.
local hex = {code = function(c) return "&#x" .. string.format("%x", c:byte()) .. ";" end, count = 1, rate = 0.45}
local dec = {code = function(c) return "&#" .. c:byte() .. ";" end, count = 0, rate = 0.45}
local plain = {code = function(c) return c end, count = 0, rate = 0.1}
local codes = {hex, dec, plain}
local function swap(t,k1,k2) local temp = t[k2] t[k2] = t[k1] t[k1] = temp end
local out = ""
for i = 1,s:len() do
for _,code in ipairs(codes) do code.count = code.count + code.rate end
if codes[1].count < codes[2].count then swap(codes,1,2) end
if codes[2].count < codes[3].count then swap(codes,2,3) end
if codes[1].count < codes[2].count then swap(codes,1,2) end
local code = codes[1]
local c = s:sub(i,i)
-- Force encoding of "@" to make email address more invisible.
if c == "@" and code == plain then code = codes[2] end
out = out .. code.code(c)
code.count = code.count - 1
end
return out
end
local function mail(s)
s = unescape_special_chars(s)
local address = encode_email_address("mailto:" .. s)
local text = encode_email_address(s)
return add_escape("<a href=\"" .. address .. "\">") .. text .. "</a>"
end
-- links
text = text:gsub("<(https?:[^'\">%s]+)>", link)
text = text:gsub("<(ftp:[^'\">%s]+)>", link)
-- mail
text = text:gsub("<mailto:([^'\">%s]+)>", mail)
text = text:gsub("<([-.%w]+%@[-.%w]+)>", mail)
return text
end
-- Encode free standing amps (&) and angles (<)... note that this does not
-- encode free >.
function amps_and_angles(s)
-- encode amps not part of &..; expression
local pos = 1
while true do
local amp = s:find("&", pos)
if not amp then break end
local semi = s:find(";", amp+1)
local stop = s:find("[ \t\n&]", amp+1)
if not semi or (stop and stop < semi) or (semi - amp) > 15 then
s = s:sub(1,amp-1) .. "&" .. s:sub(amp+1)
pos = amp+1
else
pos = amp+1
end
end
-- encode naked <'s
s = s:gsub("<([^a-zA-Z/?$!])", "<%1")
s = s:gsub("<$", "<")
-- what about >, nothing done in the original markdown source to handle them
return s
end
-- Handles emphasis markers (* and _) in the text.
function emphasis(text)
for _, s in ipairs {"%*%*", "%_%_"} do
text = text:gsub(s .. "([^%s][%*%_]?)" .. s, "<strong>%1</strong>")
text = text:gsub(s .. "([^%s][^<>]-[^%s][%*%_]?)" .. s, "<strong>%1</strong>")
end
for _, s in ipairs {"%*", "%_"} do
text = text:gsub(s .. "([^%s_])" .. s, "<em>%1</em>")
text = text:gsub(s .. "(<strong>[^%s_]</strong>)" .. s, "<em>%1</em>")
text = text:gsub(s .. "([^%s_][^<>_]-[^%s_])" .. s, "<em>%1</em>")
text = text:gsub(s .. "([^<>_]-<strong>[^<>_]-</strong>[^<>_]-)" .. s, "<em>%1</em>")
end
return text
end
-- Handles line break markers in the text.
function line_breaks(text)
return text:gsub(" +\n", " <br/>\n")
end
-- Perform all span level transforms.
function span_transform(text)
text = code_spans(text)
text = escape_special_chars(text)
text = images(text)
text = anchors(text)
text = auto_links(text)
text = amps_and_angles(text)
text = emphasis(text)
text = line_breaks(text)
return text
end
----------------------------------------------------------------------
-- Markdown
----------------------------------------------------------------------
-- Cleanup the text by normalizing some possible variations to make further
-- processing easier.
function cleanup(text)
-- Standardize line endings
text = text:gsub("\r\n", "\n") -- DOS to UNIX
text = text:gsub("\r", "\n") -- Mac to UNIX
-- Convert all tabs to spaces
text = detab(text)
-- Strip lines with only spaces and tabs
while true do
local subs
text, subs = text:gsub("\n[ \t]+\n", "\n\n")
if subs == 0 then break end
end
return "\n" .. text .. "\n"
end
-- Strips link definitions from the text and stores the data in a lookup table.
function strip_link_definitions(text)
local linkdb = {}
local function link_def(id, url, title)
id = id:match("%[(.+)%]"):lower()
linkdb[id] = linkdb[id] or {}
linkdb[id].url = url or linkdb[id].url
linkdb[id].title = title or linkdb[id].title
return ""
end
local def_no_title = "\n ? ? ?(%b[]):[ \t]*\n?[ \t]*<?([^%s>]+)>?[ \t]*"
local def_title1 = def_no_title .. "[ \t]+\n?[ \t]*[\"'(]([^\n]+)[\"')][ \t]*"
local def_title2 = def_no_title .. "[ \t]*\n[ \t]*[\"'(]([^\n]+)[\"')][ \t]*"
local def_title3 = def_no_title .. "[ \t]*\n?[ \t]+[\"'(]([^\n]+)[\"')][ \t]*"
text = text:gsub(def_title1, link_def)
text = text:gsub(def_title2, link_def)
text = text:gsub(def_title3, link_def)
text = text:gsub(def_no_title, link_def)
return text, linkdb
end
link_database = {}
-- Main markdown processing function
function markdown(text)
init_hash(text)
init_escape_table()
text = cleanup(text)
text = protect(text)
text, link_database = strip_link_definitions(text)
text = block_transform(text)
text = unescape_special_chars(text)
return text
end
----------------------------------------------------------------------
-- End of module
----------------------------------------------------------------------
setfenv(1, _G)
M.lock(M)
-- Expose markdown function to the world
markdown = M.markdown
-- Class for parsing command-line options
local OptionParser = {}
OptionParser.__index = OptionParser
-- Creates a new option parser
function OptionParser:new()
local o = {short = {}, long = {}}
setmetatable(o, self)
return o
end
-- Calls f() whenever a flag with specified short and long name is encountered
function OptionParser:flag(short, long, f)
local info = {type = "flag", f = f}
if short then self.short[short] = info end
if long then self.long[long] = info end
end
-- Calls f(param) whenever a parameter flag with specified short and long name is encountered
function OptionParser:param(short, long, f)
local info = {type = "param", f = f}
if short then self.short[short] = info end
if long then self.long[long] = info end
end
-- Calls f(v) for each non-flag argument
function OptionParser:arg(f)
self.arg = f
end
-- Runs the option parser for the specified set of arguments. Returns true if all arguments
-- where successfully parsed and false otherwise.
function OptionParser:run(args)
local pos = 1
while pos <= #args do
local arg = args[pos]
if arg == "--" then
for i=pos+1,#args do
if self.arg then self.arg(args[i]) end
return true
end
end
if arg:match("^%-%-") then
local info = self.long[arg:sub(3)]
if not info then print("Unknown flag: " .. arg) return false end
if info.type == "flag" then
info.f()
pos = pos + 1
else
param = args[pos+1]
if not param then print("No parameter for flag: " .. arg) return false end
info.f(param)
pos = pos+2
end
elseif arg:match("^%-") then
for i=2,arg:len() do
local c = arg:sub(i,i)
local info = self.short[c]
if not info then print("Unknown flag: -" .. c) return false end
if info.type == "flag" then
info.f()
else
if i == arg:len() then
param = args[pos+1]
if not param then print("No parameter for flag: -" .. c) return false end
info.f(param)
pos = pos + 1
else
param = arg:sub(i+1)
info.f(param)
end
break
end
end
pos = pos + 1
else
if self.arg then self.arg(arg) end
pos = pos + 1
end
end
return true
end
-- Handles the case when markdown is run from the command line
local function run_command_line(arg)
-- Generate output for input s given options
local function run(s, options)
s = markdown(s)
if not options.wrap_header then return s end
local header = ""
if options.header then
local f = io.open(options.header) or error("Could not open file: " .. options.header)
header = f:read("*a")
f:close()
else
header = [[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=CHARSET" />
<title>TITLE</title>
<link rel="stylesheet" type="text/css" href="STYLESHEET" />
</head>
<body>
]]
local title = options.title or (first_header and first_header.text) or "Untitled"
header = header:gsub("TITLE", title)
if options.inline_style then
local style = ""
local f = io.open(options.stylesheet)
if f then
style = f:read("*a") f:close()
else
error("Could not include style sheet " .. options.stylesheet .. ": File not found")
end
header = header:gsub('<link rel="stylesheet" type="text/css" href="STYLESHEET" />',
"<style type=\"text/css\"><!--\n" .. style .. "\n--></style>")
else
header = header:gsub("STYLESHEET", options.stylesheet)
end
header = header:gsub("CHARSET", options.charset)
end
local footer = "</body></html>"
if options.footer then
local f = io.open(options.footer) or error("Could not open file: " .. options.footer)
footer = f:read("*a")
f:close()
end
if first_header then
header = header .. first_header.line ..'\n'
-- Build TOC if required!
local txt = ''
local indent = 0
local last_level
for i,h in ipairs(list_of_headers) do
if i > 1 then
local diff = h.level - last_level
if diff > 0 then indent = indent + 1
elseif diff < 0 then indent = indent - 1
end
end
txt = txt..string.rep('\t',indent)..'* ['..h.text..'](#'..h.id..')\n'
last_level = h.level
end
header = header .. markdown(txt)
end
return header .. s .. footer
end
-- Generate output path name from input path name given options.
local function outpath(path, options)
if options.append then return path .. ".html" end
local m = path:match("^(.+%.html)[^/\\]+$") if m then return m end
m = path:match("^(.+%.)[^/\\]*$") if m and path ~= m .. "html" then return m .. "html" end
return path .. ".html"
end
-- Default commandline options
local options = {
wrap_header = true,
header = nil,
footer = nil,
charset = "utf-8",
title = nil,
stylesheet = "default.css",
inline_style = false
}
local help = [[
Usage: markdown.lua [OPTION] [FILE]
Runs the markdown text markup to HTML converter on each file specified on the
command line. If no files are specified, runs on standard input.
No header:
-n, --no-wrap Don't wrap the output in <html>... tags.
Custom header:
-e, --header FILE Use content of FILE for header.
-f, --footer FILE Use content of FILE for footer.
Generated header:
-c, --charset SET Specifies charset (default utf-8).
-i, --title TITLE Specifies title (default from first <h1> tag).
-s, --style STYLE Specifies style sheet file (default default.css).
-l, --inline-style Include the style sheet file inline in the header.
Generated files:
-a, --append Append .html extension (instead of replacing).
Other options:
-h, --help Print this help text.
-t, --test Run the unit tests.
]]
local run_stdin = true
local op = OptionParser:new()
op:flag("n", "no-wrap", function () options.wrap_header = false end)
op:param("e", "header", function (x) options.header = x end)
op:param("f", "footer", function (x) options.footer = x end)
op:param("c", "charset", function (x) options.charset = x end)
op:param("i", "title", function(x) options.title = x end)
op:param("s", "style", function(x) options.stylesheet = x end)
op:flag("l", "inline-style", function(x) options.inline_style = true end)
op:flag("a", "append", function() options.append = true end)
op:flag("t", "test", function()
local n = arg[0]:gsub("markdown.lua", "markdown-tests.lua")
local f = io.open(n)
if f then
f:close() dofile(n)
else
error("Cannot find markdown-tests.lua")
end
run_stdin = false
end)
op:flag("h", "help", function() print(help) run_stdin = false end)
op:arg(function(path)
local file = io.open(path) or error("Could not open file: " .. path)
local s = file:read("*a")
file:close()
s = run(s, options)
file = io.open(outpath(path, options), "w") or error("Could not open output file: " .. outpath(path, options))
file:write(s)
file:close()
run_stdin = false
end
)
if not op:run(arg) then
print(help)
run_stdin = false
end
if run_stdin then
local s = io.read("*a")
s = run(s, options)
io.write(s)
end
end
-- If we are being run from the command-line, act accordingly
if arg and arg[0]:find("markdown%.lua$") then
run_command_line(arg)
else
return markdown
end
| lgpl-3.0 |
yuanfengyun/mj_server | mjlib/base/auto_table.lua | 2 | 4144 | return {[1114113]=true,[3]=true,[411141]=true,[2223111]=true,[112111113]=true,[111114]=true,[13323]=true,[222222]=true,[112143]=true,[1122321]=true,[1221141]=true,[1113111]=true,[1113114]=true,[111112221]=true,[12321]=true,[3122211]=true,[12324]=true,[111141]=true,[14211111]=true,[111144]=true,[1411113]=true,[1121322]=true,[311111211]=true,[114222]=true,[4143]=true,[1113141]=true,[111111222]=true,["collect"]=true,[2221113]=true,[11322]=true,[412221]=true,[3141]=true,[113223]=true,[3144]=true,[1111113]=true,[32331]=true,[1222221]=true,[411222]=true,[1113]=true,[11141211]=true,[112221]=true,[3222111]=true,[112224]=true,[141411]=true,[31332]=true,[1221222]=true,[1111143]=true,[3311211]=true,[1114221]=true,[111]=true,[114]=true,[112111221]=true,[111222]=true,[1143]=true,[4121211]=true,[4221]=true,[3114111]=true,[4224]=true,[33411]=true,[1113222]=true,[114111111]=true,[22211211]=true,[141]=true,[144]=true,[11211411]=true,[1411221]=true,[3222]=true,[11241111]=true,[1112223]=true,[2221221]=true,[3411111]=true,[11433]=true,[41111211]=true,[41133]=true,[2223]=true,[3112113]=true,[44211]=true,[31413]=true,[4221111]=true,[1111224]=true,[133311]=true,[11222211]=true,[1221]=true,[3111111]=true,[1224]=true,[3111114]=true,[222411]=true,[112332]=true,[4113111]=true,[22233]=true,[341211]=true,[11111133]=true,[222]=true,[11114211]=true,[3111141]=true,[41211111]=true,[11131113]=true,[114411]=true,[4332]=true,[144111]=true,[111111411]=true,[111141111]=true,[41211]=true,[41214]=true,[11322111]=true,[3333]=true,[322311]=true,[4111113]=true,[1112331]=true,[23313]=true,[411411]=true,[122133]=true,[1132311]=true,[41241]=true,[2331]=true,[112413]=true,[2334]=true,[11214111]=true,[142113]=true,[1221411]=true,[1111332]=true,[22311]=true,[22314]=true,[11111211]=true,[11111214]=true,[111411]=true,[1332]=true,[14133]=true,[111414]=true,[333111]=true,[141114]=true,[31121211]=true,[4413]=true,[34113]=true,[1113411]=true,[22341]=true,[1143111]=true,[11111241]=true,[123213]=true,[111441]=true,[1232211]=true,[141141]=true,[3414]=true,[33111]=true,[33114]=true,[311133]=true,[111222111]=true,[314211]=true,[122214]=true,[11211111]=true,[331113]=true,[41322]=true,[111311211]=true,[1121133]=true,[3441]=true,[1124211]=true,[4111221]=true,[31221111]=true,[1141113]=true,[112121211]=true,[11133]=true,[111114111]=true,[122241]=true,[11411211]=true,[14211]=true,[111122211]=true,[1413]=true,[14214]=true,[222111111]=true,[11112321]=true,[223113]=true,[2442]=true,[11122311]=true,[422211]=true,[142221]=true,[11212221]=true,[1332111]=true,[311322]=true,[122111211]=true,[12211221]=true,[122211111]=true,[12221211]=true,[312213]=true,[22422]=true,[31113111]=true,[12321111]=true,[22311111]=true,[11111322]=true,[1421211]=true,[3111222]=true,[31111113]=true,[414]=true,[222111]=true,[111111141]=true,[14241]=true,[222114]=true,[1443]=true,[11112213]=true,[1122213]=true,[141222]=true,[31143]=true,[11211114]=true,[12211113]=true,[11212113]=true,[311211]=true,[312321]=true,[34221]=true,[311214]=true,[1224111]=true,[11211141]=true,[111112113]=true,[4113]=true,[11131221]=true,[441111]=true,[12213]=true,[12213111]=true,[112221111]=true,[3112221]=true,[441]=true,[111411111]=true,[1121211]=true,[444]=true,[222141]=true,[1121214]=true,[114111]=true,[33]=true,[3111]=true,[114114]=true,[3114]=true,[11133111]=true,[23421]=true,[33222]=true,[111111111]=true,[141111111]=true,[311241]=true,[111111114]=true,[11211]=true,[141111]=true,[223221]=true,[11214]=true,[31111221]=true,[311211111]=true,[412113]=true,[122322]=true,[12243]=true,[411111111]=true,[331221]=true,[11211222]=true,[112113111]=true,[333]=true,[1121241]=true,[33111111]=true,[42321]=true,[3411]=true,[114141]=true,[113331]=true,[32223]=true,[122211]=true,[1222113]=true,[123321]=true,[12432]=true,[13431]=true,[1141221]=true,[33141]=true,[411111]=true,[2231211]=true,[11241]=true,[411114]=true,[14111211]=true,[11244]=true,[2331111]=true,[233211]=true,[1111221]=true,[31113]=true,[112113]=true,[14322]=true,[3111411]=true,[1221111]=true,[31221]=true,[111111]=true,[3141111]=true,[31224]=true,[411]=true,[1221114]=true,[414111]=true,[1111413]=true,[111333]=true,[1413111]=true,[42213]=true,} | mit |
m241dan/darkstar | scripts/globals/mobskills/Polar_Blast.lua | 33 | 1412 | ---------------------------------------------
-- Polar Blast
--
-- Description: Deals Ice damage to enemies within a fan-shaped area. Additional effect: Paralyze
-- Type: Breath
-- Ignores Shadows
-- Range: Unknown Cone
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if(mob:getFamily() == 316) then
local mobSkin = mob:getModelId();
if (mobSkin == 1796) then
return 0;
else
return 1;
end
end
if (mob:AnimationSub() <= 1) then
return 0;
else
return 1;
end
end;
function onMobWeaponSkill(target, mob, skill)
local dmgmod = MobBreathMove(mob, target, 0.01, 0.1, ELE_ICE, 700);
local dmg = MobFinalAdjustments(dmgmod,mob,skill,target,MOBSKILL_BREATH,MOBPARAM_ICE,MOBPARAM_IGNORE_SHADOWS);
MobStatusEffectMove(mob, target, EFFECT_PARALYSIS, 15, 0, 60);
target:delHP(dmg);
if (mob:getFamily() == 313 and bit.band(mob:getBehaviour(),BEHAVIOUR_NO_TURN) == 0 and mob:AnimationSub() == 1) then -- re-enable no turn if third head is dead (Tinnin), else it's re-enabled after the upcoming Pyric Blast
mob:setBehaviour(bit.bor(mob:getBehaviour(), BEHAVIOUR_NO_TURN))
end
return dmg;
end;
| gpl-3.0 |
m241dan/darkstar | scripts/globals/events/harvest_festivals.lua | 13 | 11508 | ---------------------------------------------------------
---------------------------------------------------------
------------ Harvest Festivals --------------------
---------------------------------------------------------
---------------------------------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
---------------------------------------------------------
---------------------------------------------------------
function isHalloweenEnabled()
local option = 0;
local month = tonumber(os.date("%m"));
local day = tonumber(os.date("%d"));
if (month == 10 and day >= 20 or month == 11 and day == 1 or HALLOWEEN_YEAR_ROUND ~= 0) then -- According to wiki Harvest Fest is Oct 20 - Nov 1.
if (HALLOWEEN_2005 == 1) then
option = 1;
elseif (HALLOWEEN_2008 == 1) then
option = 2;
elseif (HALLOWEEN_2009 == 1) then
option = 3;
elseif (HALLOWEEN_2010 == 1) then
option = 4;
end
end
return option;
end;
function halloweenItemsCheck(player)
local headSlot = player:getEquipID(SLOT_HEAD);
local mainHand = player:getEquipID(SLOT_MAIN);
local reward = 0;
-- Normal Quality Rewards
local pumpkinHead = 13916
local pumpkinHead2 = 15176;
local trickStaff = 17565;
local trickStaff2 = 17587;
reward_list = {pumpkinHead,pumpkinHead2,trickStaff,trickStaff2};
-- Checks for HQ Upgrade
for ri = 1, table.getn(reward_list) do
if (headSlot == reward_list[ri] or mainHand == reward_list[ri]) then
if (headSlot == pumpkinHead and player:hasItem(13917) == false) then
reward = 13917; -- Horror Head
elseif (headSlot == pumpkinHead2 and player:hasItem(15177) == false) then
reward = 15177; -- Horror Head II
elseif (mainHand == trickStaff and player:hasItem(17566) == false) then
reward = 17566; -- Treat Staff
elseif (mainHand == trickStaff2 and player:hasItem(17588) == false) then
reward = 17588; -- Treat Staff II
end
return reward;
end
end
-- Checks the possible item rewards to ensure player doesnt already have the item we are about to give them
local cnt = table.getn(reward_list);
while cnt ~= 0 do
local picked = reward_list[math.random(1,table.getn(reward_list))];
if (player:hasItem(picked) == false) then
reward = picked;
cnt = 0;
else
table.remove(reward_list,picked);
cnt = cnt - 1;
end
return reward;
end;
end;
function onHalloweenTrade(player,trade,npc)
local zone = player:getZoneName();
local TextIDs = "scripts/zones/" .. zone .. "/TextIDs";
package.loaded[TextIDs] = nil;
require(TextIDs);
local contentEnabled = isHalloweenEnabled();
local item = trade:getItem();
-------------------
-- 2005 edition ---
-------------------
if (contentEnabled == 1) then
-----------------------------------
-- Treats allowed
-----------------------------------
treats_table = {4510, -- Acorn Cookie
5646, -- Bloody Chocolate
4496, -- Bubble Chocolate
4397, -- Cinna-cookie
4394, -- Ginger Cookie
4495, -- Goblin Chocolate
4413, -- Apple Pie
4488, -- Jack-o'-Pie
4421, -- Melon Pie
4563, -- Pamama Tart
4446, -- Pumpkin Pie
4414, -- Rolanberry Pie
4406, -- Baked Apple
5729, -- Bavarois
5745, -- Cherry Bavarois
5653, -- Cherry Muffin
5655, -- Coffee Muffin
5718, -- Cream Puff
5144, -- Crimson Jelly
5681, -- Cupid Chocolate
5672, -- Dried Berry
5567, -- Dried Date
4556, -- Icecap Rolanberry
5614, -- Konigskuchen
5230, -- Love Chocolate
4502, -- Marron Glace
4393, -- Orange Kuchen
5147, -- Snoll Gelato
4270, -- Sweet Rice Cake
5645, -- Witch Nougat
5552, -- Black Pudding --safe
5550, -- Buche au Chocolat -- safe @ 43 items
5616, -- Lebkuchen House --breaks
5633, -- Chocolate Cake
5542, -- Gateau aux Fraises
5572, -- Irmik Helvasi
5625, -- Maple Cake
5559, -- Mille Feuille
5557, -- Mont Blanc
5629, -- Orange Cake
5631, -- Pumpkin Cake
5577, -- Sutlac
5627}; -- Yogurt Cake
for itemInList = 1, table.getn(treats_table) do
if (item == treats_table[itemInList]) then
local itemReward = halloweenItemsCheck(player);
local varName = "harvestFestTreats";
local harvestFestTreats;
if (itemInList < 32) then -- The size of the list is too big for int 32 used that stores the bit mask, as such there are two lists
harvestFestTreats = player:getVar(varName);
else
varName = "harvestFestTreats2";
harvestFestTreats = player:getVar(varName); -- this is the second list
itemInList = itemInList - 32;
end
local AlreadyTradedChk = player:getMaskBit(harvestFestTreats,itemInList);
if (itemReward ~= 0 and player:getFreeSlotsCount() >= 1 and math.random(1,3) < 2) then -- Math.random added so you have 33% chance on getting item
player:messageSpecial(HERE_TAKE_THIS);
player:addItem(itemReward);
player:messageSpecial(ITEM_OBTAINED,itemReward);
elseif (player:canUseCostume() and AlreadyTradedChk == false) then
-- Other neat looking halloween type costumes
-- two dragon skins: @420/421
-- @422 dancing weapon
-- @ 433/432 golem
-- 265 dark eye, 266 Giant version
-- 290 dark bombs
-- 301 dark mandy
-- 313 black spiders
-- 488 gob
-- 531 - 548 shade
-- 564/579 skele
-- Possible costume values:
Yagudo = math.random(580,607);
Quadav = math.random(644,671);
Shade = math.random(535,538);
Orc = math.random(612,639);
Ghost = 368;
Hound = 365;
Skeleton = 564;
Dark_Stalker = math.random(531,534);
halloween_costume_list = {Quadav,Orc,Yagudo,Shade,Ghost,Hound,Skeleton,Dark_Stalker};
local costumePicked = halloween_costume_list[math.random(1,table.getn(halloween_costume_list))]; -- will randomly pick one of the costumes in the list
player:addStatusEffect(EFFECT_COSTUME,costumePicked,0,3600);
-- pitchForkCostumeList defines the special costumes per zone that can trigger the pitch fork requirement
-- zone, costumeID
pitchForkCostumeList = {234,Shade,Skeleton, -- Bastok mines
235,Hound,Ghost, -- Bastok Markets
230,Ghost,Skeleton, -- Southern Sandoria
231,Hound,Skeleton, -- Northern Sandoria
241,Ghost,Shade, -- Windurst Woods
238,Shade,Hound}; -- Windurst Woods
for zi = 1, table.getn(pitchForkCostumeList), 3 do
if (zone == pitchForkCostumeList[zi] and (costumePicked == pitchForkCostumeList[zi + 1] or zone == pitchForkCostumeList[zi] and costumePicked == pitchForkCostumeList[zi + 2])) then -- Gives special hint for pitch fork costume
player:messageSpecial(IF_YOU_WEAR_THIS);
elseif (zi == 16) then
player:messageSpecial(THANK_YOU_TREAT);
end
end
else
player:messageSpecial(THANK_YOU);
end
if (AlreadyTradedChk == false) then
player:setMaskBit(harvestFestTreats,varName,itemInList,true);
end
player:tradeComplete();
break;
end
end
end
end;
function applyHalloweenNpcCostumes(zoneid)
if (isHalloweenEnabled() ~= 0) then
-- npcID, skinID (skin ID can be found in mob_change_skin Sql table)
local npc_costume_map = {
[234] = {
[17735787] = 40, -- Proud_Beard - Bastok Mines
[17735742] = 41, -- Faustin - Bastok Mines
[17814119] = 42, -- Aulavia - Bastok Mines
[17735744] = 43, -- Mille - Bastok Mines
[17735810] = 44 -- Emaliveulaux - Bastok Mines
},
[235] = {
[17739805] = 45 -- Olwyn - Bastok Markets
},
[230] = {
[17719306] = 46, -- Apairemant - Southern Sandoria
[17719303] = 47, -- Machielle - Southern Sandoria
[17719305] = 48, -- Phamelise - Southern Sandoria
[17719485] = 49, -- Pourette - Southern Sandoria
[17719304] = 50 -- Corua -- Southern Sandoria
},
[231] = {
[17723497] = 51, -- Attarena - Northern Sandoria
[17723492] = 52, -- Antonian - Northern Sandoria
[17723487] = 53 -- Vichuel - Northern Sandoria
},
[241] = {
[17764401] = 54, -- Kuzah_Hpirohpon - Windurst Woods
[17764400] = 55, -- Meriri - Windurst Woods
[17764464] = 56, -- Nhobi_Zalkia - Windurst Woods
[17764465] = 57, -- Millerovieunet - Windurst Woods
[17764462] = 58 -- Taraihi-Perunhi - Windurst Woods
},
[238] = {
[17752101] = 59, -- Ness_Rugetomal - Windurst Waters
[17752098] = 60, -- Upih_Khachla - Windurst Waters
[17752097] = 61, -- Ensasa - Windurst Waters
[17752103] = 62, -- Ahyeekih - Windurst Waters
[17752102] = 63 -- Maqu_Molpih - Windurst Waters
}
};
for id,skin in pairs(npc_costume_map[zoneid]) do
local hfNpc = GetNPCByID(id);
if (hfNpc ~= nil) then
hfNpc:changeSkin(skin);
end
end
end
end;
| gpl-3.0 |
ignacio/sailor | test/dev-app/tests/functional/category.lua | 4 | 1500 | local form = require "sailor.form"('category')
local test = require "sailor.test"
describe("Testing #CategoryController", function()
local Category = sailor.model('category')
local fixtures = require "tests.fixtures.category"
setup(function()
test.load_fixtures('category')
end)
it("should open index", function()
local res = test.request('category')
assert.same(200,res.status)
assert.truthy(res.body:match('View all'))
end)
it("should create new category", function()
local count_before = Category:count()
local res = test.request('category/create', {post = form.ify(fixtures[1])})
assert.same(Category:count(), count_before + 1)
assert.is_true(res:redirected('category/index'))
end)
it("should update category", function()
local res = test.request('category/update', {get = {id = 1}, post = form.ify(fixtures[2])})
assert.same(fixtures[2].name, Category:find_by_id(1).name)
assert.is_true(res:redirected('category/index'))
end)
it("should get category", function()
local res = test.request('category/view', {get = {id = 2}})
assert.same(200,res.status)
assert.truthy(res.body:match(fixtures[2].name))
end)
it("should delete category", function()
local count_before = Category:count()
local res = test.request('category/delete', {get = {id = 1}})
assert.same(Category:count(), count_before - 1)
assert.falsy(Category:find_by_id(1))
assert.is_true(res:redirected('category/index'))
end)
end) | mit |
m241dan/darkstar | scripts/globals/items/bowl_of_witch_stew.lua | 18 | 1449 | -----------------------------------------
-- ID: 4344
-- Item: witch_stew
-- Food Effect: 4hours, All Races
-----------------------------------------
-- Magic Points 45
-- Strength -1
-- Mind 4
-- MP Recovered While Healing 4
-- Enmity -4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,4344);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 45);
target:addMod(MOD_STR, -1);
target:addMod(MOD_MND, 4);
target:addMod(MOD_MPHEAL, 4);
target:addMod(MOD_ENMITY, -4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 45);
target:delMod(MOD_STR, -1);
target:delMod(MOD_MND, 4);
target:delMod(MOD_MPHEAL, 4);
target:delMod(MOD_ENMITY, -4);
end;
| gpl-3.0 |
santssoft/darkstar | scripts/zones/QuBia_Arena/IDs.lua | 8 | 2178 | -----------------------------------
-- Area: QuBia_Arena
-----------------------------------
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[dsp.zone.QUBIA_ARENA] =
{
text =
{
ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6388, -- Obtained: <item>.
GIL_OBTAINED = 6389, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>.
CONQUEST_BASE = 7049, -- Tallying conquest results...
FLAT_PREPARE = 7622, -- I am Trion, of San d'Oria!
FLAT_LAND = 7623, -- Feel the fire of my forefathers!
RLB_PREPARE = 7624, -- The darkness before me that shrouds the light of good...
RLB_LAND = 7625, -- ...Return to the hell you crawled out from!
SAVAGE_PREPARE = 7626, -- The anger, the pain, and the will to survive... Let the spirit of San d'Oria converge within this blade.
SAVAGE_LAND = 7627, -- And with this blade I will return the glory to my kingdom's people!
YOU_DECIDED_TO_SHOW_UP = 7628, -- So, you decided to show up. Now it's time to see what you're really made of, heh heh heh.
LOOKS_LIKE_YOU_WERENT_READY = 7629, -- Looks like you weren't ready for me, were you? Now go home, wash your face, and come back when you think you've got what it takes.
YOUVE_COME_A_LONG_WAY = 7630, -- Hm. That was a mighty fine display of skill there, <name>. You've come a long way...
TEACH_YOU_TO_RESPECT_ELDERS = 7631, -- I'll teach you to respect your elders!
TAKE_THAT_YOU_WHIPPERSNAPPER = 7632, -- Take that, you whippersnapper!
NOW_THAT_IM_WARMED_UP = 7633, -- Now that I'm warmed up...
THAT_LL_HURT_IN_THE_MORNING = 7634, -- Ungh... That'll hurt in the morning...
},
mob =
{
HEIR_TO_THE_LIGHT_OFFSET = 17621014,
},
npc =
{
},
}
return zones[dsp.zone.QUBIA_ARENA] | gpl-3.0 |
dvr333/Zero-K | LuaRules/Configs/MetalSpots/Altair_Crossing_v3.lua | 6 | 1135 | return {
spots = {
{x = 3864, z = 2136, metal = 2.2},
{x = 888, z = 4024, metal = 1.0},
{x = 3944, z = 184, metal = 1.0},
{x = 568, z = 1928, metal = 2.2},
{x = 1528, z = 1560, metal = 2.6},
{x = 3640, z = 2056, metal = 2.2},
{x = 568, z = 3144, metal = 2.2},
{x = 1912, z = 4040, metal = 2.6},
{x = 1592, z = 4024, metal = 1.0},
{x = 360, z = 1800, metal = 2.2},
{x = 3240, z = 3992, metal = 1.0},
{x = 120, z = 3992, metal = 1.0},
{x = 3720, z = 904, metal = 2.2},
{x = 552, z = 872, metal = 2.2},
{x = 2360, z = 4024, metal = 1.0},
{x = 1784, z = 184, metal = 1.0},
{x = 2392, z = 152, metal = 1.0},
{x = 3736, z = 3096, metal = 2.2},
{x = 360, z = 3016, metal = 2.2},
{x = 1992, z = 120, metal = 2.6},
{x = 88, z = 152, metal = 1.0},
{x = 2392, z = 2376, metal = 2.6},
{x = 360, z = 2024, metal = 2.2},
{x = 936, z = 280, metal = 1.0},
{x = 3960, z = 3992, metal = 1.0},
{x = 376, z = 968, metal = 2.2},
{x = 3096, z = 152, metal = 1.0},
{x = 3544, z = 3288, metal = 2.2},
{x = 3800, z = 1848, metal = 2.2},
{x = 3528, z = 776, metal = 2.2},
}
}
| gpl-2.0 |
m241dan/darkstar | scripts/globals/mobskills/Heavy_Stomp.lua | 33 | 1070 | ---------------------------------------------
-- Heavy Stomp
--
-- Description: Deals heavy damage to targets within an area of effect. Additional effect: Paralysis
-- Type: Physical
-- Utsusemi/Blink absorb: 2-3 shadows
-- Range: Unknown radial
-- Notes: Paralysis effect has a very long duration.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local numhits = math.random(2,3);
local accmod = 1;
local dmgmod = .7;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded);
local typeEffect = EFFECT_PARALYSIS;
MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 15, 0, 360);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
dvr333/Zero-K | units/jumpblackhole.lua | 1 | 4336 | return { jumpblackhole = {
unitname = [[jumpblackhole]],
name = [[Placeholder]],
description = [[Black Hole Launcher]],
acceleration = 1.2,
brakeRate = 7.2,
buildCostMetal = 250,
builder = false,
buildPic = [[jumpblackhole.png]],
canGuard = true,
canMove = true,
canPatrol = true,
category = [[LAND]],
collisionVolumeOffsets = [[0 0 0]],
collisionVolumeScales = [[30 48 30]],
collisionVolumeType = [[cylY]],
corpse = [[DEAD]],
customParams = {
bait_level_default = 0,
can_target_allies = 1,
midposoffset = [[0 10 0]],
},
explodeAs = [[BIG_UNITEX]],
footprintX = 2,
footprintZ = 2,
iconType = [[kbotwideriot]],
idleAutoHeal = 5,
idleTime = 1800,
leaveTracks = true,
losEmitHeight = 40,
maxDamage = 900,
maxSlope = 36,
maxVelocity = 2,
maxWaterDepth = 22,
movementClass = [[KBOT2]],
noAutoFire = false,
noChaseCategory = [[FIXEDWING SATELLITE GUNSHIP SUB TURRET UNARMED]],
objectName = [[freaker.s3o]],
script = [[jumpblackhole.lua]],
selfDestructAs = [[BIG_UNITEX]],
selfDestructCountdown = 5,
sfxtypes = {
explosiongenerators = {
[[custom:PILOT]],
[[custom:PILOT2]],
[[custom:RAIDMUZZLE]],
[[custom:VINDIBACK]],
},
},
sightDistance = 605,
trackOffset = 0,
trackStrength = 8,
trackStretch = 1,
trackType = [[ComTrack]],
trackWidth = 22,
turnRate = 1680,
upright = true,
workerTime = 0,
weapons = {
{
def = [[BLACK_HOLE]],
badTargetCategory = [[FIXEDWING]],
onlyTargetCategory = [[FIXEDWING HOVER SWIM LAND SHIP GUNSHIP]],
},
},
weaponDefs = {
BLACK_HOLE = {
name = [[Black Hole Launcher]],
accuracy = 350,
areaOfEffect = 300,
avoidFeature = false,
avoidFriendly = false,
burnblow = true,
collideFeature = false,
collideFriendly = false,
craterBoost = 100,
craterMult = 2,
customParams = {
falldamageimmunity = [[120]],
area_damage = 1,
area_damage_radius = 70,
area_damage_dps = 5600,
area_damage_is_impulse = 1,
area_damage_duration = 13.3,
area_damage_range_falloff = 0.4,
area_damage_time_falloff = 0.6,
area_damage_height_max = 1200,
area_damage_height_int = 400,
area_damage_height_reduce = 160,
light_color = [[1 1 1]],
light_radius = 500,
},
damage = {
default = 0,
},
explosionGenerator = [[custom:black_hole_long]],
explosionSpeed = 50,
impulseBoost = 150,
impulseFactor = -2.5,
intensity = 0.9,
interceptedByShieldType = 1,
myGravity = 0.1,
projectiles = 1,
range = 475,
reloadtime = 14,
rgbColor = [[0.05 0.05 0.05]],
size = 16,
soundHit = [[weapon/blackhole_impact]],
soundStart = [[weapon/blackhole_fire]],
soundStartVolume = 6000,
soundHitVolume = 6000,
turret = true,
weaponType = [[Cannon]],
weaponVelocity = 550,
},
},
featureDefs = {
DEAD = {
blocking = false,
featureDead = [[HEAP]],
footprintX = 2,
footprintZ = 2,
object = [[freaker_dead.s3o]],
},
HEAP = {
blocking = false,
footprintX = 2,
footprintZ = 2,
object = [[debris2x2c.s3o]],
},
},
} }
| gpl-2.0 |
dvr333/Zero-K | LuaUI/i18nlib/i18n/variants.lua | 36 | 1195 | local variants = {}
local function reverse(arr, length)
local result = {}
for i=1, length do result[i] = arr[length-i+1] end
return result, length
end
local function concat(arr1, len1, arr2, len2)
for i = 1, len2 do
arr1[len1 + i] = arr2[i]
end
return arr1, len1 + len2
end
function variants.ancestry(locale)
local result, length, accum = {},0,nil
locale:gsub("[^%-]+", function(c)
length = length + 1
accum = accum and (accum .. '-' .. c) or c
result[length] = accum
end)
return reverse(result, length)
end
function variants.isParent(parent, child)
return not not child:match("^".. parent .. "%-")
end
function variants.root(locale)
return locale:match("[^%-]+")
end
function variants.fallbacks(locale, fallbackLocale)
if locale == fallbackLocale or
variants.isParent(fallbackLocale, locale) then
return variants.ancestry(locale)
end
if variants.isParent(locale, fallbackLocale) then
return variants.ancestry(fallbackLocale)
end
local ancestry1, length1 = variants.ancestry(locale)
local ancestry2, length2 = variants.ancestry(fallbackLocale)
return concat(ancestry1, length1, ancestry2, length2)
end
return variants
| gpl-2.0 |
hylthink/Sample_Lua | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/Animation.lua | 10 | 4139 |
--------------------------------
-- @module Animation
-- @extend Ref
-- @parent_module cc
--------------------------------
-- Gets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ...
-- @function [parent=#Animation] getLoops
-- @param self
-- @return unsigned int#unsigned int ret (return value: unsigned int)
--------------------------------
-- Adds a SpriteFrame to a Animation.<br>
-- The frame will be added with one "delay unit".
-- @function [parent=#Animation] addSpriteFrame
-- @param self
-- @param #cc.SpriteFrame frame
--------------------------------
-- Sets whether to restore the original frame when animation finishes
-- @function [parent=#Animation] setRestoreOriginalFrame
-- @param self
-- @param #bool restoreOriginalFrame
--------------------------------
--
-- @function [parent=#Animation] clone
-- @param self
-- @return Animation#Animation ret (return value: cc.Animation)
--------------------------------
-- Gets the duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit
-- @function [parent=#Animation] getDuration
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Sets the array of AnimationFrames
-- @function [parent=#Animation] setFrames
-- @param self
-- @param #array_table frames
--------------------------------
-- Gets the array of AnimationFrames
-- @function [parent=#Animation] getFrames
-- @param self
-- @return array_table#array_table ret (return value: array_table)
--------------------------------
-- Sets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ...
-- @function [parent=#Animation] setLoops
-- @param self
-- @param #unsigned int loops
--------------------------------
-- Sets the delay in seconds of the "delay unit"
-- @function [parent=#Animation] setDelayPerUnit
-- @param self
-- @param #float delayPerUnit
--------------------------------
-- Adds a frame with an image filename. Internally it will create a SpriteFrame and it will add it.<br>
-- The frame will be added with one "delay unit".<br>
-- Added to facilitate the migration from v0.8 to v0.9.
-- @function [parent=#Animation] addSpriteFrameWithFile
-- @param self
-- @param #string filename
--------------------------------
-- Gets the total Delay units of the Animation.
-- @function [parent=#Animation] getTotalDelayUnits
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Gets the delay in seconds of the "delay unit"
-- @function [parent=#Animation] getDelayPerUnit
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Checks whether to restore the original frame when animation finishes.
-- @function [parent=#Animation] getRestoreOriginalFrame
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.<br>
-- The frame will be added with one "delay unit".<br>
-- Added to facilitate the migration from v0.8 to v0.9.
-- @function [parent=#Animation] addSpriteFrameWithTexture
-- @param self
-- @param #cc.Texture2D pobTexture
-- @param #rect_table rect
--------------------------------
-- @overload self, array_table, float, unsigned int
-- @overload self
-- @function [parent=#Animation] create
-- @param self
-- @param #array_table arrayOfAnimationFrameNames
-- @param #float delayPerUnit
-- @param #unsigned int loops
-- @return Animation#Animation ret (return value: cc.Animation)
--------------------------------
--
-- @function [parent=#Animation] createWithSpriteFrames
-- @param self
-- @param #array_table arrayOfSpriteFrameNames
-- @param #float delay
-- @param #unsigned int loops
-- @return Animation#Animation ret (return value: cc.Animation)
return nil
| mit |
dvr333/Zero-K | LuaUI/Widgets/chili_old/Controls/LayoutPanel.lua | 5 | 27186 | --//=============================================================================
--// This control is the base of any auto-layout panel, this includes:
--// grid, stackpanel, tables, itemlistview, listbox, radiogroups, ...
--//
--// Internal all childrens/items are handled via cells, which can be
--// freely aligned (table-grid, free movable like in imagelistviews, ...).
--//
--// Also most subclasses should use an items table to create their child
--// objects, so the user just define the captions, filenames, ... instead
--// of creating checkboxes, images, ... directly.
--// This doesn't affect simple containers like grids & stackcontrols, which
--// don't create any controls themselves (instead they just align their children).
LayoutPanel = Control:Inherit{
classname = "layoutpanel",
itemMargin = {5, 5, 5, 5},
itemPadding = {5, 5, 5, 5},
minItemWidth = 1,
maxItemWidth = 0,
minItemHeight = 1,
maxItemHeight = 0,
autosize = false,
rows = nil,
columns = nil,
orientation = "horizontal", --// "horizontal" or "vertical"
autoArrangeH = false, --FIXME rename
autoArrangeV = false, --FIXME rename
grid = false, --FIXME not implemented yet // if true, each row should have the same number of columns (table layout)
resizeItems = false,
centerItems = true,
--[[ takes weights into account when resizing items (instead of same size for all)
- e.g. "component1.weight = 1, component2.weight = 2" => component2 will be 2 times larger than component1
- if all components have same weight -> same layout as without weightedResize
- default value is 1 (nil interpreted as 1)
]]
weightedResize = false,
selectable = false,
multiSelect = true,
selectedItems = {},
OnSelectItem = {},
OnDrawItem = {}, --FIXME
OnDblClickItem = {},
_rows = nil,
_columns = nil,
_cells = nil,
}
local this = LayoutPanel
local inherited = this.inherited
--//=============================================================================
function LayoutPanel:New(obj)
obj = inherited.New(self,obj)
if (obj.selectable) then
obj.selectedItems = {[1]=true}
end
return obj
end
--//=============================================================================
function LayoutPanel:SetOrientation(orientation)
self.orientation = orientation
inherited.UpdateClientArea(self)
end
--//=============================================================================
local tsort = table.sort
--//=============================================================================
local function compareSizes(a,b)
return a[2] < b[2]
end
function LayoutPanel:_JustCenterItemsH(startCell,endCell,freeSpace)
local _cells = self._cells
local perItemAlloc = freeSpace / ((endCell - startCell) + 1)
local n=0
for i=startCell,endCell do
local cell = _cells[i]
--if (self.orientation == "horizontal") then
cell[1] = cell[1] + n * perItemAlloc
cell[3] = cell[3] + perItemAlloc
--else
-- cell[2] = cell[2] + n * perItemHalfAlloc
-- cell[4] = cell[4] + perItemHalfAlloc
--end
n = n+1
end
end
function LayoutPanel:_JustCenterItemsV(startCell,endCell,freeSpace)
local _cells = self._cells
local perItemAlloc = freeSpace / ((endCell - startCell) + 1)
local n=0
for i=startCell,endCell do
local cell = _cells[i]
--if (self.orientation == "horizontal") then
cell[2] = cell[2] + n * perItemAlloc
cell[4] = cell[4] + perItemAlloc
--else
-- cell[1] = cell[1] + n * perItemHalfAlloc
-- cell[3] = cell[3] + perItemHalfAlloc
--end
n = n+1
end
end
function LayoutPanel:_EnlargeToLineHeight(startCell, endCell, lineHeight)
local _cells = self._cells
local _cellPaddings = self._cellPaddings
for i=startCell,endCell do
local cell = _cells[i]
local padding = _cellPaddings[i]
--if (self.orientation == "horizontal") then
cell[4] = lineHeight - padding[2] - padding[4]
--else
-- cell[3] = lineHeight
--end
end
end
function LayoutPanel:_AutoArrangeAbscissa(startCell,endCell,freeSpace)
if (startCell > endCell) then
return
end
if (not self.autoArrangeH) then
if (self.centerItems) then
self:_JustCenterItemsH(startCell,endCell,freeSpace)
end
return
end
local _cells = self._cells
if (startCell == endCell) then
local cell = self._cells[startCell]
if (self.orientation == "horizontal") then
cell[1] = cell[1] + freeSpace/2
else
cell[2] = cell[2] + freeSpace/2
end
return
end
--// create a sorted table with the cell sizes
local cellSizesCount = 0
local cellSizes = {}
for i=startCell,endCell do
cellSizesCount = cellSizesCount + 1
if (self.orientation == "horizontal") then
cellSizes[cellSizesCount] = {i,_cells[i][3]}
else
cellSizes[cellSizesCount] = {i,_cells[i][4]}
end
end
tsort(cellSizes,compareSizes)
--// upto this index all cells have the same size (in the cellSizes table)
local sameSizeIdx = 1
local shortestCellSize = cellSizes[1][2]
while (freeSpace>0)and(sameSizeIdx<cellSizesCount) do
--// detect the cells, which have the same size
for i=sameSizeIdx+1,cellSizesCount do
if (cellSizes[i][2] ~= shortestCellSize) then
break
end
sameSizeIdx = sameSizeIdx + 1
end
--// detect 2. shortest cellsize
local nextCellSize = 0
if (sameSizeIdx >= cellSizesCount) then
nextCellSize = self.maxItemWidth --FIXME orientation
else
nextCellSize = cellSizes[sameSizeIdx+1][2]
end
--// try to fillup the shorest cells to the 2. shortest cellsize (so we can repeat the process on n+1 cells)
--// (if all/multiple cells have the same size share the freespace between them)
local spaceToAlloc = shortestCellSize - nextCellSize
if (spaceToAlloc > freeSpace) then
spaceToAlloc = freeSpace
freeSpace = 0
else
freeSpace = freeSpace - spaceToAlloc
end
local perItemAlloc = (spaceToAlloc / sameSizeIdx)
--// set the cellsizes/share the free space between cells
for i=1,sameSizeIdx do
local celli = cellSizes[i]
celli[2] = celli[2] + perItemAlloc --FIXME orientation
local cell = _cells[ celli[1] ]
cell[3] = cell[3] + perItemAlloc --FIXME orientation
--// adjust the top/left startcoord of all following cells (in the line)
for j=celli[1]+1,endCell do
local cell = _cells[j]
cell[1] = cell[1] + perItemAlloc --FIXME orientation
end
end
shortestCellSize = nextCellSize
end
end
function LayoutPanel:_AutoArrangeOrdinate(freeSpace)
if (not self.autoArrangeV) then
if (self.centerItems) then
local startCell = 1
local endCell = 1
for i=2,#self._lines do
endCell = self._lines[i] - 1
self:_JustCenterItemsV(startCell,endCell,freeSpace)
startCell = endCell + 1
end
end
return
end
local _lines = self._lines
local _cells = self._cells
--// create a sorted table with the line sizes
local lineSizes = {}
for i=1,#_lines do
local first_cell_in_line = _cells[ _lines[i] ]
if not first_cell_in_line then
Spring.Log(widget:GetInfo().name, LOG.WARNING, "(StackPanel) failed to find first_cell_in_line")
return
end
if (self.orientation == "horizontal") then --FIXME
lineSizes[i] = {i,first_cell_in_line[4]}
else
lineSizes[i] = {i,first_cell_in_line[3]}
end
end
tsort(lineSizes,compareSizes)
local lineSizesCount = #lineSizes
--// upto this index all cells have the same size (in the cellSizes table)
local sameSizeIdx = 1
local shortestLineSize = lineSizes[1][2]
while (freeSpace>0)and(sameSizeIdx<lineSizesCount) do
--// detect the lines, which have the same size
for i=sameSizeIdx+1,lineSizesCount do
if (lineSizes[i][2] ~= shortestLineSize) then
break
end
sameSizeIdx = sameSizeIdx + 1
end
--// detect 2. shortest linesize
local nextLineSize = 0
if (sameSizeIdx >= lineSizesCount) then
nextLineSize = self.maxItemHeight --FIXME orientation
else
nextLineSize = lineSizes[sameSizeIdx+1][2]
end
--// try to fillup the shorest lines to the 2. shortest linesize (so we can repeat the process on n+1 lines)
--// (if all/multiple have the same size share the freespace between them)
local spaceToAlloc = shortestLineSize - nextLineSize
if (spaceToAlloc > freeSpace) then
spaceToAlloc = freeSpace
freeSpace = 0
else
freeSpace = freeSpace - spaceToAlloc
end
local perItemAlloc = (spaceToAlloc / sameSizeIdx)
--// set the linesizes
for i=1,sameSizeIdx do
local linei = lineSizes[i]
linei[2] = linei[2] + perItemAlloc --FIXME orientation
--// adjust the top/left startcoord of all following lines (in the line)
local nextLineIdx = linei[1]+1
local nextLine = ((nextLineIdx <= #_lines) and _lines[ nextLineIdx ]) or #_cells+1
for j=_lines[ linei[1] ],nextLine-1 do
local cell = _cells[j]
cell[4] = cell[4] + perItemAlloc --FIXME orientation
end
for j=nextLine,#_cells do
local cell = _cells[j]
cell[2] = cell[2] + perItemAlloc --FIXME orientation
end
end
shortestLineSize = nextLineSize
end
end
--//=============================================================================
function LayoutPanel:GetMaxWeight()
--// calculate max weights for each column and row
local mweightx = {}
local mweighty = {}
local cn = self.children
local dir1,dir2
if (self.orientation == "vertical") then
dir1,dir2 = self._columns,self._rows
else
dir1,dir2 = self._rows,self._columns
end
local n,x,y = 1
for i=1, dir1 do
for j=1, dir2 do
local child = cn[n]
if not child then break end
if (self.orientation == "vertical") then
x,y = i,j
else
x,y = j,i
end
local we = child.weight or 1
if ((mweightx[x] or 0.001) < we) then
mweightx[x] = we
end
if ((mweighty[y] or 0.001) < we) then
mweighty[y] = we
end
n = n + 1
end
end
local weightx = table.sum(mweightx)
local weighty = table.sum(mweighty)
return mweightx,mweighty,weightx, weighty
end
function LayoutPanel:_GetMaxChildConstraints(child)
local children = self.children
if (self._cells and not self._inUpdateLayout) then
for i=1, #children do
if CompareLinks(children[i], child) then
local cell = self._cells[i]
if (cell) then
return unpack4(cell)
end
end
end
end
local itemPadding = self.itemPadding
local margin = child.margin or self.itemMargin
local maxChildWidth = -margin[1] - itemPadding[1] + self.clientWidth - itemPadding[3] - margin[3]
local maxChildHeight = -margin[2] - itemPadding[2] + self.clientHeight - itemPadding[4] - margin[4]
return margin[1] + itemPadding[1], margin[2] + itemPadding[2], maxChildWidth, maxChildHeight
end
--//=============================================================================
function LayoutPanel:GetMinimumExtents()
--[[
local old = self.autosize
self.autosize = false
local right, bottom = inherited.GetMinimumExtents(self)
self.autosize = old
return right, bottom
--]]
if (not self.autosize) then
local right = self.x + self.width
local bottom = self.y + self.height
return right, bottom
else
--FIXME!!!
local right = self.x + self.width
local bottom = self.y + self.height
return right, bottom
end
end
--//=============================================================================
--// Note: there are two different layput functions depending on resizeItems
function LayoutPanel:_LayoutChildrenResizeItems()
local cn = self.children
local cn_count = #cn
local max_ix = math.floor(self.clientArea[3] / self.minItemWidth)
local max_iy = math.floor(self.clientArea[4] / self.minItemHeight)
if (max_ix * max_iy < cn_count) or
(max_ix < (self.columns or 0)) or
(max_iy < (self.rows or 0))
then
--FIXME add autoEnlarge/autoAdjustSize?
--error"LayoutPanel: not enough space"
end
--FIXME take minWidth/height maxWidth/Height into account! (and try to reach a 1:1 pixel ratio)
if self.columns and self.rows then
self._columns = self.columns
self._rows = self.rows
elseif (not self.columns) and self.rows then
self._columns = math.ceil(cn_count/self.rows)
self._rows = self.rows
elseif (not self.rows) and self.columns then
self._columns = self.columns
self._rows = math.ceil(cn_count/self.columns)
else
local size = math.ceil(cn_count^0.5)
self._columns = size
self._rows = math.ceil(cn_count/size)
end
local childWidth = self.clientArea[3]/self._columns
local childHeight = self.clientArea[4]/self._rows
local childPosx = 0
local childPosy = 0
self._cells = {}
local _cells = self._cells
local weightsx,weightsy, maxweightx, maxweighty
if (self.weightedResize) then
weightsx,weightsy, maxweightx, maxweighty = self:GetMaxWeight()
--// special setup for weightedResize
childWidth = 0
childHeight = 0
end
local dir1,dir2
if (self.orientation == "vertical") then
dir1,dir2 = self._columns,self._rows
else
dir1,dir2 = self._rows,self._columns
end
local n,x,y = 1
for i=1, dir1 do
for j=1, dir2 do
local child = cn[n]
if not child then break end
local margin = child.margin or self.itemMargin
if (self.orientation == "vertical") then
x,y = i,j
else
x,y = j,i
end
if (self.weightedResize) then
--// weighted Position
if dir1 == 1 then
childPosx = 0
else
childPosx = childPosx + childWidth
end
if dir2 == 1 then
childPosy = 0
else
childPosy = childPosy + childHeight
end
childWidth = (self.clientArea[3]) * weightsx[x]/maxweightx
childHeight = (self.clientArea[4]) * weightsy[y]/maxweighty
else
--// position without weightedResize
childPosx = childWidth * (x-1)
childPosy = childHeight * (y-1)
end
local childBox = {
childPosx + margin[1],
childPosy + margin[2],
childWidth - margin[1] - margin[3],
childHeight - margin[2] - margin[4]
}
child:_UpdateConstraints(unpack4(childBox))
_cells[n] = childBox
n = n+1
end
end
end
function LayoutPanel:_LayoutChildren()
local cn = self.children
local cn_count = #cn
self._lines = {1}
local _lines = self._lines
self._cells = {}
local _cells = self._cells
self._cellPaddings = {}
local _cellPaddings = self._cellPaddings
local itemMargin = self.itemMargin
local itemPadding = self.itemPadding
local cur_x,cur_y = 0,0
local curLine, curLineSize = 1,self.minItemHeight
local totalChildWidth,totalChildHeight = 0
local lineHeights = {}
local lineWidths = {}
--// Handle orientations
local X,Y,W,H = "x","y","width","height"
local LEFT,TOP,RIGHT,BOTTOM = 1,2,3,4
local WIDTH, HEIGHT = 3,4
local minItemWidth, minItemHeight = self.minItemWidth, self.minItemHeight
local clientAreaWidth,clientAreaHeight = self.clientArea[3],self.clientArea[4]
--// FIXME: finish me (use those vars in the loops below!)
--[[
if (self.orientation ~= "horizontal") then
X,Y,W,H = "y","x","height","width"
LEFT,TOP,RIGHT,BOTTOM = 2,1,4,3
WIDTH, HEIGHT = 4,3
curLineSize = minItemWidth
minItemWidth, minItemHeight = minItemHeight, minItemWidth
clientAreaWidth,clientAreaHeight = clientAreaHeight, clientAreaWidth
end
--]]
--[[FIXME breaks ListImageView!
if (self.autosize) then
local maxChildWidth = minItemWidth
for i=1, cn_count do
local child = cn[i]
local childWidth = math.max(child[W], minItemWidth)
if (child.GetMinimumExtents) then
local extents = {child:GetMinimumExtents()}
childWidth = math.max(extents[LEFT], childWidth)
end
maxChildWidth = math.max(childWidth, maxChildWidth)
end
totalMaxChildWidth = itemPadding[LEFT] + maxChildWidth + itemPadding[RIGHT]
if (self.orientation == "horizontal") then
self:Resize(nil, totalMaxChildWidth, true, true)
clientAreaWidth,clientAreaHeight = self.clientArea[4],self.clientArea[3]
else
self:Resize(totalMaxChildWidth, nil, true, true)
clientAreaWidth,clientAreaHeight = self.clientArea[3],self.clientArea[4]
end
end
--]]
for i=1, cn_count do
local child = cn[i]
if not child then break end
local margin = child.margin or itemMargin
local childWidth = math.max(child[W],minItemWidth)
local childHeight = math.max(child[H],minItemHeight)
local itemMarginL = margin[LEFT]
local itemMarginT = (curLine > 1) and margin[TOP] or 0
local itemMarginR = margin[RIGHT]
local itemMarginB = (i < cn_count) and margin[BOTTOM] or 0
totalChildWidth = margin[LEFT] + itemPadding[LEFT] + childWidth + itemPadding[RIGHT] + margin[RIGHT] --// FIXME add margin just for non-border controls
totalChildHeight = itemMarginT + itemPadding[TOP] + childHeight + itemPadding[BOTTOM] + itemMarginB
local cell_top = cur_y + itemPadding[TOP] + itemMarginT
local cell_left = cur_x + itemPadding[LEFT] + itemMarginL
local cell_width = childWidth
local cell_height = childHeight
cur_x = cur_x + totalChildWidth
if
(i>1)and
(self.columns and (((i - 1) % self.columns) < 1))or
((not self.columns) and (cur_x > clientAreaWidth))
then
lineHeights[curLine] = curLineSize
lineWidths[curLine] = cur_x - totalChildWidth
--// start a new line
cur_x = totalChildWidth
cur_y = cur_y + curLineSize
curLine = curLine+1
curLineSize = math.max(minItemHeight, totalChildHeight)
cell_top = cur_y + itemMarginT + itemPadding[TOP]
cell_left = itemMarginL + itemPadding[LEFT]
_lines[curLine] = i
end
_cells[i] = {cell_left, cell_top, cell_width, cell_height}
_cellPaddings[i] = {itemMarginL + itemPadding[LEFT], itemMarginT + itemPadding[TOP], itemMarginR + itemPadding[RIGHT], itemMarginB + itemPadding[BOTTOM]}
if (totalChildHeight > curLineSize) then
curLineSize = totalChildHeight
end
end
lineHeights[curLine] = curLineSize
lineWidths[curLine] = cur_x
--// Move cur_y to the bottom of the new ClientArea/ContentArea
cur_y = cur_y + curLineSize
--// Share remaining free space between items
if (self.centerItems or self.autoArrangeH or self.autoArrangeV) then
for i=1,#lineWidths do
local startcell = _lines[i]
local endcell = (_lines[i+1] or (#cn+1)) - 1
local freespace = clientAreaWidth - lineWidths[i]
self:_AutoArrangeAbscissa(startcell, endcell, freespace)
end
for i=1,#lineHeights do
local lineHeight = lineHeights[i]
local startcell = _lines[i]
local endcell = (_lines[i+1] or (#cn+1)) - 1
self:_EnlargeToLineHeight(startcell, endcell, lineHeight)
end
self:_AutoArrangeOrdinate(clientAreaHeight - cur_y)
end
--// Resize the LayoutPanel if needed
--FIXME do this in resize too!
if (self.autosize) then
--if (self.orientation == "horizontal") then
self:Resize(nil, cur_y, true, true)
--else
-- self:Resize(nil, cur_y, true, true)
--end
elseif (cur_y > clientAreaHeight) then
--Spring.Echo(debug.traceback())
end
--// Update the Children constraints
for i=1, cn_count do
local child = cn[i]
if not child then break end
local cell = _cells[i]
local cposx,cposy = cell[LEFT],cell[TOP]
if (self.centerItems) then
cposx = cposx + (cell[WIDTH] - child[W]) * 0.5
cposy = cposy + (cell[HEIGHT] - child[H]) * 0.5
end
--if (self.orientation == "horizontal") then
--FIXME use child:Resize or something like that
child:_UpdateConstraints(cposx,cposy)
--else
-- child:_UpdateConstraints(cposy,cposx)
--end
end
end
--//=============================================================================
function LayoutPanel:UpdateLayout()
if (not self.children[1]) then
--FIXME redundant?
if (self.autosize) then
if (self.orientation == "horizontal") then
self:Resize(0, nil, false)
else
self:Resize(nil, 0, false)
end
end
return
end
self._inUpdateLayout = true
self:RealignChildren()
--FIXME add check if any item.width > maxItemWidth (+Height) & add a new autosize tag for it
if (self.resizeItems) then
self:_LayoutChildrenResizeItems()
else
self:_LayoutChildren()
end
self._inUpdateLayout = false
self:RealignChildren() --FIXME split SetPos from AlignControl!!!
return true
end
--//=============================================================================
function LayoutPanel:DrawBackground()
end
function LayoutPanel:DrawItemBkGnd(index)
end
function LayoutPanel:DrawControl()
self:DrawBackground(self)
end
function LayoutPanel:DrawChildren()
local cn = self.children
if (not cn[1]) then return end
gl.PushMatrix()
gl.Translate(math.floor(self.x + self.clientArea[1]),math.floor(self.y + self.clientArea[2]),0)
for i=1,#cn do
self:DrawItemBkGnd(i)
end
if (self.debug) then
gl.Color(1,0,0,0.5)
for i=1,#self._cells do
local x,y,w,h = unpack4(self._cells[i])
gl.Rect(x,y,x+w,y+h)
end
end
gl.PopMatrix()
self:_DrawChildrenInClientArea('Draw')
end
function LayoutPanel:DrawChildrenForList()
local cn = self.children
if (not cn[1]) then return end
if (self.debug) then
gl.Color(0,1,0,0.5)
gl.PolygonMode(GL.FRONT_AND_BACK,GL.LINE)
gl.LineWidth(2)
gl.Rect(self.x,self.y,self.x+self.width,self.y+self.height)
gl.LineWidth(1)
gl.PolygonMode(GL.FRONT_AND_BACK,GL.FILL)
end
gl.PushMatrix()
gl.Translate(math.floor(self.x + self.clientArea[1]),math.floor(self.y + self.clientArea[2]),0)
for i=1,#cn do
self:DrawItemBkGnd(i)
end
if (self.debug) then
gl.Color(1,0,0,0.5)
for i=1,#self._cells do
local x,y,w,h = unpack4(self._cells[i])
gl.Rect(x,y,x+w,y+h)
end
end
gl.PopMatrix()
self:_DrawChildrenInClientArea('DrawForList')
end
--//=============================================================================
function LayoutPanel:GetItemIndexAt(cx,cy)
local cells = self._cells
local itemPadding = self.itemPadding
for i=1,#cells do
local cell = cells[i]
local cellbox = ExpandRect(cell,itemPadding)
if (InRect(cellbox, cx,cy)) then
return i
end
end
return -1
end
function LayoutPanel:GetItemXY(itemIdx)
local cell = self._cells[itemIdx]
if (cell) then
return unpack4(cell)
end
end
--//=============================================================================
function LayoutPanel:MultiRectSelect(item1,item2,append)
--// note: this functions does NOT update self._lastSelected!
--// select all items in the convex hull of those 2 items
local cells = self._cells
local itemPadding = self.itemPadding
local cell1,cell2 = cells[item1],cells[item2]
local hullX = math.min(cell1[1], cell2[1])
local hullY = math.min(cell1[2], cell2[2])
local hullW = math.max(cell1[1] + cell1[3], cell2[1] + cell2[3]) - hullX
local hullH = math.max(cell1[2] + cell1[4], cell2[2] + cell2[4]) - hullY
local newSelected = self.selectedItems
if (not append) then
newSelected = {}
end
for i=1,#cells do
local cell = cells[i]
local cellbox = ExpandRect(cell,itemPadding)
if (AreRectsOverlapping(hullX, hullY, hullW, hullH, cellbox[1], cellbox[2], cellbox[3], cellbox[4])) then
newSelected[i] = true
end
end
if (not append) then
local oldSelected = self.selectedItems
self.selectedItems = newSelected
for itemIdx,selected in pairs(oldSelected) do
if (selected)and(not newSelected[itemIdx]) then
self:CallListeners(self.OnSelectItem, itemIdx, false)
end
end
for itemIdx,selected in pairs(newSelected) do
if (selected)and(not oldSelected[itemIdx]) then
self:CallListeners(self.OnSelectItem, itemIdx, true)
end
end
end
self:Invalidate()
end
function LayoutPanel:ToggleItem(itemIdx)
local newstate = not self.selectedItems[itemIdx]
self.selectedItems[itemIdx] = newstate
self._lastSelected = itemIdx
self:CallListeners(self.OnSelectItem, itemIdx, newstate)
self:Invalidate()
end
function LayoutPanel:SelectItem(itemIdx, append)
if (self.selectedItems[itemIdx]) then
return
end
if (append) then
self.selectedItems[itemIdx] = true
else
local oldItems = self.selectedItems
self.selectedItems = {[itemIdx]=true}
for oldItemIdx in pairs(oldItems) do
if (oldItemIdx ~= itemIdx) then
self:CallListeners(self.OnSelectItem, oldItemIdx, false)
end
end
end
self._lastSelected = itemIdx
self:CallListeners(self.OnSelectItem, itemIdx, true)
self:Invalidate()
end
function LayoutPanel:DeselectItem(itemIdx)
if (not self.selectedItems[itemIdx]) then
return
end
self.selectedItems[itemIdx] = false
self._lastSelected = itemIdx
self:CallListeners(self.OnSelectItem, itemIdx, false)
self:Invalidate()
end
function LayoutPanel:SelectAll()
for i=1,#self.children do
self:SelectItem(i, append)
end
end
function LayoutPanel:DeselectAll()
for idx in pairs(self.selectedItems) do
self:DeselectItem(idx)
end
end
--//=============================================================================
function LayoutPanel:MouseDown(x,y,button,mods)
local clickedChild = inherited.MouseDown(self,x,y,button,mods)
if (clickedChild) then
return clickedChild
end
if (not self.selectable) then return end
--//FIXME HitTest just returns true when we hover a children -> this won't get called when you hit on in empty space!
if (button==3) then
self:DeselectAll()
return self
end
local cx,cy = self:LocalToClient(x,y)
local itemIdx = self:GetItemIndexAt(cx,cy)
if (itemIdx>0) then
if (self.multiSelect) then
if (mods.shift and mods.ctrl) then
self:MultiRectSelect(itemIdx,self._lastSelected or 1, true)
elseif (mods.shift) then
self:MultiRectSelect(itemIdx,self._lastSelected or 1)
elseif (mods.ctrl) then
self:ToggleItem(itemIdx)
else
self:SelectItem(itemIdx)
end
else
self:SelectItem(itemIdx)
end
return self
end
end
function LayoutPanel:MouseDblClick(x,y,button,mods)
local clickedChild = inherited.MouseDown(self,x,y,button,mods)
if (clickedChild) then
return clickedChild
end
if (not self.selectable) then return end
local cx,cy = self:LocalToClient(x,y)
local itemIdx = self:GetItemIndexAt(cx,cy)
if (itemIdx>0) then
self:CallListeners(self.OnDblClickItem, itemIdx)
return self
end
end
--//=============================================================================
| gpl-2.0 |
m241dan/darkstar | scripts/zones/Meriphataud_Mountains_[S]/Zone.lua | 12 | 1788 | -----------------------------------
--
-- Zone: Meriphataud_Mountains_[S] (97)
--
-----------------------------------
package.loaded["scripts/zones/Meriphataud_Mountains_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Meriphataud_Mountains_[S]/TextIDs");
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-454.135,28.409,657.79,49);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onGameHour
-----------------------------------
function onGameHour()
local GameHour = 150; -- Seconds per VanadielHour
local npc = GetNPCByID(17175338); -- Indescript Markings
if (npc ~= nil) then
if (VanadielHour() == 17) then
npc:setStatus(STATUS_DISAPPEAR);
end
if (VanadielHour() == 7) then
npc:setStatus(STATUS_NORMAL);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
m241dan/darkstar | scripts/zones/Beaucedine_Glacier/mobs/Tundra_Tiger.lua | 4 | 1399 | -----------------------------------
-- Area: Beaucedine Glacier
-- MOB: Tundra Tiger
-- Note: PH for Nue, Kirata
-----------------------------------
require("scripts/globals/fieldsofvalor");
require("scripts/zones/Beaucedine_Glacier/MobIDs");
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, player, isKiller)
checkRegime(player,mob,46,1);
checkRegime(player,mob,47,1);
-- Kirata
local mobID = mob:getID();
if (Kirata_PH[mobID] ~= nil) then
local ToD = GetServerVariable("[POP]Kirata");
if (ToD <= os.time(t) and GetMobAction(Kirata) == 0) then
if (math.random(1,15) == 5) then
UpdateNMSpawnPoint(Kirata);
GetMobByID(Kirata):setRespawnTime(GetMobRespawnTime(mobID));
SetServerVariable("[PH]Kirata", mobID);
DeterMob(mobID, true);
end
end
end
-- Nue
if (Nue_PH[mobID] ~= nil) then
local ToD = GetServerVariable("[POP]Nue");
if (ToD <= os.time(t) and GetMobAction(Nue) == 0) then
if (math.random(1,15) == 5) then
UpdateNMSpawnPoint(Nue);
GetMobByID(Nue):setRespawnTime(GetMobRespawnTime(mobID));
SetServerVariable("[PH]Nue", mobID);
DeterMob(mobID, true);
end
end
end
end;
| gpl-3.0 |
m241dan/darkstar | scripts/zones/Valkurm_Dunes/npcs/qm3.lua | 13 | 1960 | -----------------------------------
-- Area: Valkurm Dunes
-- NPC: qm3 (???)
-- Involved In Quest: Yomi Okuri
-- @pos -767 -4 192 103
-----------------------------------
package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/zones/Valkurm_Dunes/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local cstime = VanadielHour();
if (player:hasKeyItem(YOMOTSU_HIRASAKA) and (cstime > 18 or cstime < 5) and GetMobAction(17199567) == 0 and GetMobAction(17199568) == 0) then
if (player:getVar("OkuriNMKilled") >= 1 and player:needToZone()) then
player:delKeyItem(YOMOTSU_HIRASAKA);
player:addKeyItem(FADED_YOMOTSU_HIRASAKA);
player:messageSpecial(KEYITEM_OBTAINED,FADED_YOMOTSU_HIRASAKA);
player:setVar("OkuriNMKilled",0);
else
player:startEvent(0x000a);
end
else
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x000a and option == 1) then
player:needToZone(true); -- If you zone, you will need to repeat the fight.
player:setVar("OkuriNMKilled",0);
SpawnMob(17199567,300):updateClaim(player); -- Doman
SpawnMob(17199568,300):updateClaim(player); -- Onryo
end
end; | gpl-3.0 |
santssoft/darkstar | scripts/zones/Monastic_Cavern/mobs/Orcish_Overlord.lua | 11 | 1635 | -----------------------------------
-- Area: Monastic Cavern
-- NM: Orcish Overlord
-- Note: PH for Overlord Bakgodek
-- TODO: messages should be zone-wide
-----------------------------------
local ID = require("scripts/zones/Monastic_Cavern/IDs")
mixins = {require("scripts/mixins/job_special")}
require("scripts/globals/status")
-----------------------------------
function onMobInitialize(mob)
-- the quest version of this NM doesn't drop gil
if mob:getID() >= ID.mob.UNDERSTANDING_OVERLORD_OFFSET then
mob:setMobMod(dsp.mobMod.GIL_MAX, -1)
end
end
function onMobEngaged(mob, target)
mob:showText(mob, ID.text.ORCISH_OVERLORD_ENGAGE)
end
function onMobDeath(mob, player, isKiller)
if isKiller then
mob:showText(mob, ID.text.ORCISH_OVERLORD_DEATH)
end
end
function onMobDespawn(mob)
local nqId = mob:getID()
-- the quest version of this NM doesn't respawn or count toward hq nm
if nqId == ID.mob.ORCISH_OVERLORD then
local hqId = mob:getID() + 1
local ToD = GetServerVariable("[POP]Overlord_Bakgodek")
local kills = GetServerVariable("[PH]Overlord_Bakgodek")
local popNow = (math.random(1, 5) == 3 or kills > 6)
if os.time() > ToD and popNow then
DisallowRespawn(nqId, true)
DisallowRespawn(hqId, false)
UpdateNMSpawnPoint(hqId)
GetMobByID(hqId):setRespawnTime(math.random(75600, 86400))
else
UpdateNMSpawnPoint(nqId)
mob:setRespawnTime(math.random(75600, 86400))
SetServerVariable("[PH]Overlord_Bakgodek", kills + 1)
end
end
end | gpl-3.0 |
dvr333/Zero-K | LuaUI/Widgets/chili_old/Controls/screen.lua | 13 | 7772 | Screen = Object:Inherit{
--Screen = Control:Inherit{
classname = 'screen',
x = 0,
y = 0,
width = 0,
height = 0,
preserveChildrenOrder = true,
activeControl = nil,
focusedControl = nil,
hoveredControl = nil,
currentTooltip = nil,
_lastHoveredControl = nil,
_lastClicked = Spring.GetTimer(),
_lastClickedX = 0,
_lastClickedY = 0,
}
local this = Screen
local inherited = this.inherited
--//=============================================================================
function Screen:New(obj)
local vsx,vsy = Spring.GetViewSizes()
if ((obj.width or -1) <= 0) then
obj.width = vsx
end
if ((obj.height or -1) <= 0) then
obj.height = math.ceil(vsy)
end
obj = inherited.New(self,obj)
TaskHandler.RequestGlobalDispose(obj)
obj:RequestUpdate()
return obj
end
function Screen:OnGlobalDispose(obj)
if (UnlinkSafe(self.activeControl) == obj) then
self.activeControl = nil
end
if (UnlinkSafe(self.hoveredControl) == obj) then
self.hoveredControl = nil
end
if (UnlinkSafe(self._lastHoveredControl) == obj) then
self._lastHoveredControl = nil
end
if (UnlinkSafe(self.focusedControl) == obj) then
self.focusedControl = nil
end
end
--//=============================================================================
--FIXME add new coordspace Device (which does y-invert)
function Screen:ParentToLocal(x,y)
return x, y
end
function Screen:LocalToParent(x,y)
return x, y
end
function Screen:LocalToScreen(x,y)
return x, y
end
function Screen:ScreenToLocal(x,y)
return x, y
end
function Screen:ScreenToClient(x,y)
return x, y
end
function Screen:UnscaledClientToScreen(x,y)
return x*WG.uiScale, y*WG.uiScale
end
function Screen:ClientToScreen(x,y)
return x, y
end
function Screen:IsRectInView(x,y,w,h)
return
(x <= self.width) and
(x + w >= 0) and
(y <= self.height) and
(y + h >= 0)
end
function Screen:IsVisibleOnScreen()
return true
end
--//=============================================================================
function Screen:Resize(w,h)
self.width = math.ceil(w)
self.height = math.ceil(h)
self:CallChildren("RequestRealign")
end
--//=============================================================================
function Screen:Update(...)
--//FIXME create a passive MouseMove event and use it instead?
self:RequestUpdate()
local hoveredControl = UnlinkSafe(self.hoveredControl)
local activeControl = UnlinkSafe(self.activeControl)
if hoveredControl and (not activeControl) then
local x, y, lmb, mmb, rmb, outsideSpring = Spring.GetMouseState()
if outsideSpring then
if self.currentTooltip then
self.currentTooltip = nil
end
if self.activeControl then
self.activeControl:MouseOut()
self.activeControl = nil
end
if self.hoveredControl then
self.hoveredControl:MouseOut()
self.hoveredControl = nil
end
return
end
y = select(2,Spring.GetViewSizes()) - y
local cx,cy = hoveredControl:ScreenToLocal(x, y)
hoveredControl:MouseMove(cx, cy, 0, 0)
end
end
function Screen:IsAbove(x,y,...)
local activeControl = UnlinkSafe(self.activeControl)
if activeControl then
self.currentTooltip = activeControl.tooltip
return true
end
y = select(2,Spring.GetViewSizes()) - y
local hoveredControl = inherited.IsAbove(self,x,y,...)
--// tooltip
if (UnlinkSafe(hoveredControl) ~= UnlinkSafe(self._lastHoveredControl)) then
if self._lastHoveredControl then
self._lastHoveredControl:MouseOut()
end
if hoveredControl then
hoveredControl:MouseOver()
end
self.hoveredControl = MakeWeakLink(hoveredControl, self.hoveredControl)
if (hoveredControl) then
local control = hoveredControl
--// find tooltip in hovered control or its parents
while (not control.tooltip)and(control.parent) do
control = control.parent
end
self.currentTooltip = control.tooltip
else
self.currentTooltip = nil
end
self._lastHoveredControl = self.hoveredControl
elseif (self._lastHoveredControl) then
self.currentTooltip = self._lastHoveredControl.tooltip
end
return (not not hoveredControl)
end
function Screen:MouseDown(x,y,...)
y = select(2,Spring.GetViewSizes()) - y
local activeControl = inherited.MouseDown(self,x,y,...)
self.activeControl = MakeWeakLink(activeControl, self.activeControl)
if not CompareLinks(self.activeControl, self.focusedControl) then
local focusedControl = UnlinkSafe(self.focusedControl)
if focusedControl then
focusedControl.state.focused = false
focusedControl:FocusUpdate() --rename FocusLost()
end
self.focusedControl = nil
if self.activeControl then
self.focusedControl = MakeWeakLink(activeControl, self.focusedControl)
self.focusedControl.state.focused = true
self.focusedControl:FocusUpdate() --rename FocusGain()
end
end
return (not not activeControl)
end
function Screen:MouseUp(x,y,...)
y = select(2,Spring.GetViewSizes()) - y
local activeControl = UnlinkSafe(self.activeControl)
if activeControl then
local cx,cy = activeControl:ScreenToLocal(x,y)
local now = Spring.GetTimer()
local obj
local hoveredControl = inherited.IsAbove(self,x,y,...)
if CompareLinks(hoveredControl, activeControl) then
--//FIXME send this to controls too, when they didn't `return self` in MouseDown!
if (math.abs(x - self._lastClickedX)<3) and
(math.abs(y - self._lastClickedY)<3) and
(Spring.DiffTimers(now,self._lastClicked) < 0.45 ) --FIXME 0.45 := doubleClick time (use spring config?)
then
obj = activeControl:MouseDblClick(cx,cy,...)
end
if (obj == nil) then
obj = activeControl:MouseClick(cx,cy,...)
end
end
self._lastClicked = now
self._lastClickedX = x
self._lastClickedY = y
obj = activeControl:MouseUp(cx,cy,...) or obj
self.activeControl = nil
return (not not obj)
else
return (not not inherited.MouseUp(self,x,y,...))
end
end
function Screen:MouseMove(x,y,dx,dy,...)
y = select(2,Spring.GetViewSizes()) - y
local activeControl = UnlinkSafe(self.activeControl)
if activeControl then
local cx,cy = activeControl:ScreenToLocal(x,y)
local obj = activeControl:MouseMove(cx,cy,dx,-dy,...)
if (obj==false) then
self.activeControl = nil
elseif (not not obj)and(obj ~= activeControl) then
self.activeControl = MakeWeakLink(obj, self.activeControl)
return true
else
return true
end
end
return (not not inherited.MouseMove(self,x,y,dx,-dy,...))
end
function Screen:MouseWheel(x,y,...)
y = select(2,Spring.GetViewSizes()) - y
local activeControl = UnlinkSafe(self.activeControl)
if activeControl then
local cx,cy = activeControl:ScreenToLocal(x,y)
local obj = activeControl:MouseWheel(cx,cy,...)
if (obj==false) then
self.activeControl = nil
elseif (not not obj)and(obj ~= activeControl) then
self.activeControl = MakeWeakLink(obj, self.activeControl)
return true
else
return true
end
end
return (not not inherited.MouseWheel(self,x,y,...))
end
function Screen:KeyPress(...)
local focusedControl = UnlinkSafe(self.focusedControl)
if focusedControl then
return (not not focusedControl:KeyPress(...))
end
return (not not inherited:KeyPress(...))
end
function Screen:TextInput(...)
local focusedControl = UnlinkSafe(self.focusedControl)
if focusedControl then
return (not not focusedControl:TextInput(...))
end
return (not not inherited:TextInput(...))
end
--//=============================================================================
| gpl-2.0 |
santssoft/darkstar | scripts/zones/Port_Jeuno/IDs.lua | 6 | 4395 | -----------------------------------
-- Area: Port_Jeuno
-----------------------------------
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[dsp.zone.PORT_JEUNO] =
{
text =
{
ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6388, -- Obtained: <item>.
GIL_OBTAINED = 6389, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>.
KEYITEM_LOST = 6392, -- Lost key item: <keyitem>.
CONQUEST_BASE = 6477, -- Tallying conquest results...
HOMEPOINT_SET = 6638, -- Home point set!
MOG_LOCKER_OFFSET = 6751, -- Your Mog Locker lease is valid until <timestamp>, kupo.
WEATHER_DIALOG = 6849, -- Your fate rides on the changing winds of Vana'diel. I can give you insight on the local weather.
FISHING_MESSAGE_OFFSET = 6897, -- You can't fish here.
GUIDE_STONE = 7013, -- Up: Lower Jeuno (facing Bastok) Down: Qufim Island
LEYLA_SHOP_DIALOG = 7014, -- Hello. All goods are duty-free.
GEKKO_SHOP_DIALOG = 7014, -- Hello. All goods are duty-free.
CHALLOUX_SHOP_DIALOG = 7015, -- Good day!
CUMETOUFLAIX_DIALOG = 7053, -- This underground tunnel leads to the island of Qufim. Everyone is advised to stay out. But of course you adventurers never listen.
COUNTER_NPC_2 = 7059, -- With the airships connecting Jeuno with the three nations, the flow of goods has become much more consistent. Nowadays, everything comes through Jeuno!
COUNTER_NPC = 7061, -- I think the airships are a subtle form of pressure on the other three nations. That way, Jeuno can maintain the current balance of power.
ARRIVAL_NPC = 7071, -- Enjoy your stay in Jeuno!
DAPOL_DIALOG = 7084, -- Welcome to Port Jeuno, the busiest airship hub anywhere! You can't miss the awe-inspiring view of airships in flight!
SECURITY_DIALOG = 7087, -- Port Jeuno must remain secure. After all, if anything happened to the archduke, it would change the world!
MOGHOUSE_EXIT = 7168, -- You have learned your way through the back alleys of Jeuno! Now you can exit to any area from your residence.
CHOCOBO_DIALOG = 7190, -- ...
OLD_BOX = 7288, -- You find a grimy old box.
GAVIN_DIALOG = 7359, -- This is the counter for the air route to the Outlands. Our airships connect Jeuno with the southeastern island of Elshimo.
TSOLAG_DIALOG = 7377, -- This is the departure gate for airship passengers. If you have any questions, please inquire with Guddal.
VEUJAIE_DIALOG = 7378, -- Delivering goods to residences everywhere!
DIGAGA_DIALOG = 7378, -- Delivering goods to residences everywhere!
ITEM_DELIVERY_DIALOG = 7378, -- Delivering goods to residences everywhere!
CONQUEST = 7388, -- You've earned conquest points!
SAGHEERA_MAX_ABCS = 8029, -- I apologize, but I cannot take any more <item> from you.
SAGHEERA_LACK_ABCS = 8030, -- You have collected the proper materials, but unfortunately you lack the required amount of <item> for payment.
GET_LOST = 8153, -- You want somethin' from me? Well, too bad. I don't want nothin' from you. Get lost.
DRYEYES_1 = 8162, -- Then why you waste my time? Get lost.
DRYEYES_2 = 8163, -- Done deal. Deal is done. You a real sucker--<cough>--I mean, good customer. Come back soon. And don't forget the goods.
DRYEYES_3 = 8164, -- Hey, you already got <item>. What you tryin' to pull here? Save some for my other customers, eh?
CHEST_IS_EMPTY = 8652, -- The chest is empty.
KINDLIX_SHOP_DIALOG = 8671, -- Our fam'ly peddle sky flowers. You want have nice scenery? Send fireworks sky high! It's great feeling. Bwee hee hee.
PYROPOX_SHOP_DIALOG = 8675, -- Bwee hee.♪ I get fireworks from all 'round globe. Kindlix never sell more than me.
},
mob =
{
},
npc =
{
},
}
return zones[dsp.zone.PORT_JEUNO] | gpl-3.0 |
santssoft/darkstar | scripts/zones/Windurst-Jeuno_Airship/IDs.lua | 12 | 1300 | -----------------------------------
-- Area: Windurst-Jeuno_Airship
-----------------------------------
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[dsp.zone.WINDURST_JEUNO_AIRSHIP] =
{
text =
{
ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6388, -- Obtained: <item>.
GIL_OBTAINED = 6389, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>.
WILL_REACH_JEUNO = 7049, -- The airship will reach Jeuno in [less than an hour/about 1 hour/about 2 hours/about 3 hours/about 4 hours/about 5 hours/about 6 hours/about 7 hours] (# [minute/minutes] in Earth time).
WILL_REACH_WINDURST = 7050, -- The airship will reach Windurst in [less than an hour/about 1 hour/about 2 hours/about 3 hours/about 4 hours/about 5 hours/about 6 hours/about 7 hours] (# [minute/minutes] in Earth time).
IN_JEUNO_MOMENTARILY = 7051, -- We will be arriving in Jeuno momentarily.
IN_WINDURST_MOMENTARILY = 7052, -- We will be arriving in Windurst momentarily.
},
mob =
{
},
npc =
{
},
}
return zones[dsp.zone.WINDURST_JEUNO_AIRSHIP] | gpl-3.0 |
mpeterv/Penlight | lua/pl/seq.lua | 3 | 14502 | --- Manipulating iterators as sequences.
-- See @{07-functional.md.Sequences|The Guide}
--
-- Dependencies: `pl.utils`, `pl.types`, `debug`
-- @module pl.seq
local next,assert,pairs,tonumber,type,setmetatable = next,assert,pairs,tonumber,type,setmetatable
local strfind,format = string.find,string.format
local mrandom = math.random
local tsort,tappend = table.sort,table.insert
local io = io
local utils = require 'pl.utils'
local callable = require 'pl.types'.is_callable
local function_arg = utils.function_arg
local assert_arg = utils.assert_arg
local debug = require 'debug'
local seq = {}
-- given a number, return a function(y) which returns true if y > x
-- @param x a number
function seq.greater_than(x)
return function(v)
return tonumber(v) > x
end
end
-- given a number, returns a function(y) which returns true if y < x
-- @param x a number
function seq.less_than(x)
return function(v)
return tonumber(v) < x
end
end
-- given any value, return a function(y) which returns true if y == x
-- @param x a value
function seq.equal_to(x)
if type(x) == "number" then
return function(v)
return tonumber(v) == x
end
else
return function(v)
return v == x
end
end
end
--- given a string, return a function(y) which matches y against the string.
-- @param s a string
function seq.matching(s)
return function(v)
return strfind(v,s)
end
end
local nexti
--- sequence adaptor for a table. Note that if any generic function is
-- passed a table, it will automatically use seq.list()
-- @param t a list-like table
-- @usage sum(list(t)) is the sum of all elements of t
-- @usage for x in list(t) do...end
function seq.list(t)
assert_arg(1,t,'table')
if not nexti then
nexti = ipairs{}
end
local key,value = 0
return function()
key,value = nexti(t,key)
return value
end
end
--- return the keys of the table.
-- @param t an arbitrary table
-- @return iterator over keys
function seq.keys(t)
assert_arg(1,t,'table')
local key
return function()
key = next(t,key)
return key
end
end
local list = seq.list
local function default_iter(iter)
if type(iter) == 'table' then return list(iter)
else return iter end
end
seq.iter = default_iter
--- create an iterator over a numerical range. Like the standard Python function xrange.
-- @param start a number
-- @param finish a number greater than start
function seq.range(start,finish)
local i = start - 1
return function()
i = i + 1
if i > finish then return nil
else return i end
end
end
-- count the number of elements in the sequence which satisfy the predicate
-- @param iter a sequence
-- @param condn a predicate function (must return either true or false)
-- @param optional argument to be passed to predicate as second argument.
-- @return count
function seq.count(iter,condn,arg)
local i = 0
seq.foreach(iter,function(val)
if condn(val,arg) then i = i + 1 end
end)
return i
end
--- return the minimum and the maximum value of the sequence.
-- @param iter a sequence
-- @return minimum value
-- @return maximum value
function seq.minmax(iter)
local vmin,vmax = 1e70,-1e70
for v in default_iter(iter) do
v = tonumber(v)
if v < vmin then vmin = v end
if v > vmax then vmax = v end
end
return vmin,vmax
end
--- return the sum and element count of the sequence.
-- @param iter a sequence
-- @param fn an optional function to apply to the values
function seq.sum(iter,fn)
local s = 0
local i = 0
for v in default_iter(iter) do
if fn then v = fn(v) end
s = s + v
i = i + 1
end
return s,i
end
--- create a table from the sequence. (This will make the result a List.)
-- @param iter a sequence
-- @return a List
-- @usage copy(list(ls)) is equal to ls
-- @usage copy(list {1,2,3}) == List{1,2,3}
function seq.copy(iter)
local res,k = {},1
for v in default_iter(iter) do
res[k] = v
k = k + 1
end
setmetatable(res, require('pl.List'))
return res
end
--- create a table of pairs from the double-valued sequence.
-- @param iter a double-valued sequence
-- @param i1 used to capture extra iterator values
-- @param i2 as with pairs & ipairs
-- @usage copy2(ipairs{10,20,30}) == {{1,10},{2,20},{3,30}}
-- @return a list-like table
function seq.copy2 (iter,i1,i2)
local res,k = {},1
for v1,v2 in iter,i1,i2 do
res[k] = {v1,v2}
k = k + 1
end
return res
end
--- create a table of 'tuples' from a multi-valued sequence.
-- A generalization of copy2 above
-- @param iter a multiple-valued sequence
-- @return a list-like table
function seq.copy_tuples (iter)
iter = default_iter(iter)
local res = {}
local row = {iter()}
while #row > 0 do
tappend(res,row)
row = {iter()}
end
return res
end
--- return an iterator of random numbers.
-- @param n the length of the sequence
-- @param l same as the first optional argument to math.random
-- @param u same as the second optional argument to math.random
-- @return a sequence
function seq.random(n,l,u)
local rand
assert(type(n) == 'number')
if u then
rand = function() return mrandom(l,u) end
elseif l then
rand = function() return mrandom(l) end
else
rand = mrandom
end
return function()
if n == 0 then return nil
else
n = n - 1
return rand()
end
end
end
--- return an iterator to the sorted elements of a sequence.
-- @param iter a sequence
-- @param comp an optional comparison function (comp(x,y) is true if x < y)
function seq.sort(iter,comp)
local t = seq.copy(iter)
tsort(t,comp)
return list(t)
end
--- return an iterator which returns elements of two sequences.
-- @param iter1 a sequence
-- @param iter2 a sequence
-- @usage for x,y in seq.zip(ls1,ls2) do....end
function seq.zip(iter1,iter2)
iter1 = default_iter(iter1)
iter2 = default_iter(iter2)
return function()
return iter1(),iter2()
end
end
--- Makes a table where the key/values are the values and value counts of the sequence.
-- This version works with 'hashable' values like strings and numbers.
-- `pl.tablex.count_map` is more general.
-- @param iter a sequence
-- @return a map-like table
-- @return a table
-- @see pl.tablex.count_map
function seq.count_map(iter)
local t = {}
local v
for s in default_iter(iter) do
v = t[s]
if v then t[s] = v + 1
else t[s] = 1 end
end
return setmetatable(t, require('pl.Map'))
end
-- given a sequence, return all the unique values in that sequence.
-- @param iter a sequence
-- @param returns_table true if we return a table, not a sequence
-- @return a sequence or a table; defaults to a sequence.
function seq.unique(iter,returns_table)
local t = seq.count_map(iter)
local res,k = {},1
for key in pairs(t) do res[k] = key; k = k + 1 end
table.sort(res)
if returns_table then
return res
else
return list(res)
end
end
--- print out a sequence iter with a separator.
-- @param iter a sequence
-- @param sep the separator (default space)
-- @param nfields maximum number of values per line (default 7)
-- @param fmt optional format function for each value
function seq.printall(iter,sep,nfields,fmt)
local write = io.write
if not sep then sep = ' ' end
if not nfields then
if sep == '\n' then nfields = 1e30
else nfields = 7 end
end
if fmt then
local fstr = fmt
fmt = function(v) return format(fstr,v) end
end
local k = 1
for v in default_iter(iter) do
if fmt then v = fmt(v) end
if k < nfields then
write(v,sep)
k = k + 1
else
write(v,'\n')
k = 1
end
end
write '\n'
end
-- return an iterator running over every element of two sequences (concatenation).
-- @param iter1 a sequence
-- @param iter2 a sequence
function seq.splice(iter1,iter2)
iter1 = default_iter(iter1)
iter2 = default_iter(iter2)
local iter = iter1
return function()
local ret = iter()
if ret == nil then
if iter == iter1 then
iter = iter2
return iter()
else return nil end
else
return ret
end
end
end
--- return a sequence where every element of a sequence has been transformed
-- by a function. If you don't supply an argument, then the function will
-- receive both values of a double-valued sequence, otherwise behaves rather like
-- tablex.map.
-- @param fn a function to apply to elements; may take two arguments
-- @param iter a sequence of one or two values
-- @param arg optional argument to pass to function.
function seq.map(fn,iter,arg)
fn = function_arg(1,fn)
iter = default_iter(iter)
return function()
local v1,v2 = iter()
if v1 == nil then return nil end
return fn(v1,arg or v2) or false
end
end
--- filter a sequence using a predicate function.
-- @param iter a sequence of one or two values
-- @param pred a boolean function; may take two arguments
-- @param arg optional argument to pass to function.
function seq.filter (iter,pred,arg)
pred = function_arg(2,pred)
return function ()
local v1,v2
while true do
v1,v2 = iter()
if v1 == nil then return nil end
if pred(v1,arg or v2) then return v1,v2 end
end
end
end
--- 'reduce' a sequence using a binary function.
-- @func fn a function of two arguments
-- @param iter a sequence
-- @param initval optional initial value
-- @usage seq.reduce(operator.add,seq.list{1,2,3,4}) == 10
-- @usage seq.reduce('-',{1,2,3,4,5}) == -13
function seq.reduce (fn,iter,initval)
fn = function_arg(1,fn)
iter = default_iter(iter)
local val = initval or iter()
if val == nil then return nil end
for v in iter do
val = fn(val,v)
end
return val
end
--- take the first n values from the sequence.
-- @param iter a sequence of one or two values
-- @param n number of items to take
-- @return a sequence of at most n items
function seq.take (iter,n)
iter = default_iter(iter)
return function()
if n < 1 then return end
local val1,val2 = iter()
if not val1 then return end
n = n - 1
return val1,val2
end
end
--- skip the first n values of a sequence
-- @param iter a sequence of one or more values
-- @param n number of items to skip
function seq.skip (iter,n)
n = n or 1
for i = 1,n do
if iter() == nil then return list{} end
end
return iter
end
--- a sequence with a sequence count and the original value.
-- enum(copy(ls)) is a roundabout way of saying ipairs(ls).
-- @param iter a single or double valued sequence
-- @return sequence of (i,v), i = 1..n and v is from iter.
function seq.enum (iter)
local i = 0
iter = default_iter(iter)
return function ()
local val1,val2 = iter()
if not val1 then return end
i = i + 1
return i,val1,val2
end
end
--- map using a named method over a sequence.
-- @param iter a sequence
-- @param name the method name
-- @param arg1 optional first extra argument
-- @param arg2 optional second extra argument
function seq.mapmethod (iter,name,arg1,arg2)
iter = default_iter(iter)
return function()
local val = iter()
if not val then return end
local fn = val[name]
if not fn then error(type(val).." does not have method "..name) end
return fn(val,arg1,arg2)
end
end
--- a sequence of (last,current) values from another sequence.
-- This will return S(i-1),S(i) if given S(i)
-- @param iter a sequence
function seq.last (iter)
iter = default_iter(iter)
local val, l = iter(), nil
if val == nil then return list{} end
return function ()
val,l = iter(),val
if val == nil then return nil end
return val,l
end
end
--- call the function on each element of the sequence.
-- @param iter a sequence with up to 3 values
-- @param fn a function
function seq.foreach(iter,fn)
fn = function_arg(2,fn)
for i1,i2,i3 in default_iter(iter) do fn(i1,i2,i3) end
end
---------------------- Sequence Adapters ---------------------
local SMT
local function SW (iter,...)
if callable(iter) then
return setmetatable({iter=iter},SMT)
else
return iter,...
end
end
-- can't directly look these up in seq because of the wrong argument order...
local map,reduce,mapmethod = seq.map, seq.reduce, seq.mapmethod
local overrides = {
map = function(self,fun,arg)
return map(fun,self,arg)
end,
reduce = function(self,fun,initval)
return reduce(fun,self,initval)
end
}
SMT = {
__index = function (tbl,key)
local fn = overrides[key] or seq[key]
if fn then
return function(sw,...) return SW(fn(sw.iter,...)) end
else
return function(sw,...) return SW(mapmethod(sw.iter,key,...)) end
end
end,
__call = function (sw)
return sw.iter()
end,
}
setmetatable(seq,{
__call = function(tbl,iter,extra)
if not callable(iter) then
if type(iter) == 'table' then iter = seq.list(iter)
else return iter
end
end
if extra then
return setmetatable({iter=function()
return iter(extra)
end},SMT)
else
return setmetatable({iter=iter},SMT)
end
end
})
--- create a wrapped iterator over all lines in the file.
-- @param f either a filename, file-like object, or 'STDIN' (for standard input)
-- @param ... for Lua 5.2 only, optional format specifiers, as in `io.read`.
-- @return a sequence wrapper
function seq.lines (f,...)
local iter,obj
if f == 'STDIN' then
f = io.stdin
elseif type(f) == 'string' then
iter,obj = io.lines(f,...)
elseif not f.read then
error("Pass either a string or a file-like object",2)
end
if not iter then
iter,obj = f:lines(...)
end
if obj then -- LuaJIT version returns a function operating on a file
local lines,file = iter,obj
iter = function() return lines(file) end
end
return SW(iter)
end
function seq.import ()
debug.setmetatable(function() end,{
__index = function(tbl,key)
local s = overrides[key] or seq[key]
if s then return s
else
return function(s,...) return seq.mapmethod(s,key,...) end
end
end
})
end
return seq
| mit |
m241dan/darkstar | scripts/zones/Xarcabard/npcs/Pelogrant.lua | 13 | 1883 | -----------------------------------
-- Area: Xarcabard
-- NPC: Pelogrant
-- Type: Outpost Vendor
-- @pos 210 -22 -201 112
-----------------------------------
package.loaded["scripts/zones/Xarcabard/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Xarcabard/TextIDs");
local region = VALDEAUNIA;
local csid = 0x7ff4;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local owner = GetRegionOwner(region);
local arg1 = getArg1(owner,player);
if (owner == player:getNation()) then
nation = 1;
elseif (arg1 < 1792) then
nation = 2;
else
nation = 0;
end
player:startEvent(csid,nation,OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP(),0,0,0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
player:updateEvent(player:getGil(),OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP());
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
if (option == 1) then
ShowOPVendorShop(player);
elseif (option == 2) then
if (player:delGil(OP_TeleFee(player,region))) then
toHomeNation(player);
end
elseif (option == 6) then
player:delCP(OP_TeleFee(player,region));
toHomeNation(player);
end
end; | gpl-3.0 |
silky/frequensea | lua/slinky-two-point-five.lua | 2 | 1264 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy)
-- This visualisation looks at the 2.5 (test?) tone
VERTEX_SHADER = [[
#version 400
layout (location = 0) in vec3 vp;
layout (location = 1) in vec3 vn;
out vec3 color;
uniform mat4 uViewMatrix, uProjectionMatrix;
uniform float uTime;
void main() {
color = vec3(1.0, 1.0, 1.0);
vec3 pt = vec3(vp.x, vp.y, (vp.z - 0.5) * 1000.0);
gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0);
}
]]
FRAGMENT_SHADER = [[
#version 400
in vec3 color;
layout (location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(color, 0.95);
}
]]
function setup()
device = nrf_device_new(2.5, "../rfdata/rf-2.500-1.raw")
shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER)
end
function draw()
samples_buffer = nrf_device_get_samples_buffer(device)
position_buffer = nrf_buffer_add_position_channel(samples_buffer)
time = nwm_get_time()
camera_x = 0.5
camera_y = 0.0
camera_z = -1
ngl_clear(0.2, 0.2, 0.2, 1.0)
camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z)
buffer = nrf_device_get_samples_buffer(device)
model = ngl_model_new_with_buffer(position_buffer)
ngl_draw_model(camera, model, shader)
end
| mit |
atimoschenkow/OpenRA | mods/ra/maps/soviet-04b/AI.lua | 19 | 2829 | IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end
IdlingUnits = function()
local lazyUnits = Greece.GetGroundAttackers()
Utils.Do(lazyUnits, function(unit)
Trigger.OnDamaged(unit, function()
Trigger.ClearAll(unit)
Trigger.AfterDelay(0, function() IdleHunt(unit) end)
end)
end)
end
BaseBuildings =
{
{ "powr", CVec.New(-4, -2), 300, true },
{ "tent", CVec.New(-8, 1), 400, true },
{ "proc", CVec.New(-5, 1), 1400, true },
{ "weap", CVec.New(-12, -1), 2000, true }
}
BuildBase = function()
if CYard.IsDead or CYard.Owner ~= Greece then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
BuildBuilding(v)
return
end
end
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = Greece, Location = GreeceCYard.Location + building[2] })
Greece.Cash = Greece.Cash - building[3]
building[4] = true
Trigger.OnKilled(actor, function() building[4] = true end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
end
end)
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end)
end
ProduceInfantry = function()
if not BaseBuildings[2][4] then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(AlliedInfantryTypes) }
local Path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
InfAttack[#InfAttack + 1] = unit[1]
if #InfAttack >= 10 then
SendUnits(InfAttack, Path)
InfAttack = { }
Trigger.AfterDelay(DateTime.Minutes(2), ProduceInfantry)
else
Trigger.AfterDelay(delay, ProduceInfantry)
end
end)
end
ProduceArmor = function()
if not BaseBuildings[4][4] then
return
elseif Harvester.IsDead and Greece.Resources <= 599 then
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
local toBuild = { Utils.Random(AlliedArmorTypes) }
local Path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
ArmorAttack[#ArmorAttack + 1] = unit[1]
if #ArmorAttack >= 6 then
SendUnits(ArmorAttack, Path)
ArmorAttack = { }
Trigger.AfterDelay(DateTime.Minutes(3), ProduceArmor)
else
Trigger.AfterDelay(delay, ProduceArmor)
end
end)
end
SendUnits = function(units, waypoints)
Utils.Do(units, function(unit)
if not unit.IsDead then
Utils.Do(waypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
unit.Hunt()
end
end)
end
| gpl-3.0 |
sigurdfdragon/wesnoth-fork | data/campaigns/The_Rise_Of_Wesnoth/ai/ca_aggressive_attack_no_suicide.lua | 6 | 1846 | local AH = wesnoth.require "ai/lua/ai_helper.lua"
local AANS_attack
local ca_aggressive_attack_no_suicide = {}
function ca_aggressive_attack_no_suicide:evaluation(cfg, data)
local units = AH.get_units_with_attacks { side = wesnoth.current.side }
if (not units[1]) then return 0 end
-- Get all possible attacks
local attacks = AH.get_attacks(units, { include_occupied = true })
if (not attacks[1]) then return 0 end
-- Now find the best of the possible attacks
local max_rating, best_attack = - math.huge, nil
for i, att in ipairs(attacks) do
local attacker = wesnoth.units.get(att.src.x, att.src.y)
local defender = wesnoth.units.get(att.target.x, att.target.y)
local attacker_dst = attacker:clone()
attacker_dst.x, attacker_dst.y = att.dst.x, att.dst.y
local att_stats, def_stats = wesnoth.simulate_combat(attacker_dst, defender)
if (att_stats.hp_chance[0] == 0) then
local rating = def_stats.hp_chance[0] * 100
local attacker_damage = attacker.hitpoints - att_stats.average_hp
local defender_damage = defender.hitpoints - def_stats.average_hp
rating = rating + defender_damage
rating = rating - attacker_damage / 10.
-- Also, take strongest unit first
rating = rating + attacker.hitpoints / 10.
if (rating > max_rating) then
max_rating = rating
best_attack = att
end
end
end
if best_attack then
AANS_attack = best_attack
return 100000
end
return 0
end
function ca_aggressive_attack_no_suicide:execution(cfg, data)
AH.robust_move_and_attack(ai, AANS_attack.src, AANS_attack.dst, AANS_attack.target)
AANS_attack = nil
end
return ca_aggressive_attack_no_suicide
| gpl-2.0 |
m241dan/darkstar | scripts/zones/Windurst_Woods/npcs/Lih_Pituu.lua | 53 | 1893 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Lih Pituu
-- Type: Bonecraft Adv. Image Support
-- @pos -5.471 -6.25 -141.211 241
-----------------------------------
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Windurst_Woods/TextIDs");
require("scripts/globals/status");
require("scripts/globals/crafting");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local guildMember = isGuildMember(player,2);
local SkillLevel = player:getSkillLevel(SKILL_BONECRAFT);
local Cost = getAdvImageSupportCost(player,SKILL_BONECRAFT);
if (guildMember == 1) then
if (player:hasStatusEffect(EFFECT_BONECRAFT_IMAGERY) == false) then
player:startEvent(0x2722,Cost,SkillLevel,0,511,player:getGil(),0,7028,0);
else
player:startEvent(0x2722,Cost,SkillLevel,0,511,player:getGil(),28753,3967,0);
end
else
player:startEvent(0x2722); -- Standard Dialogue
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
local Cost = getAdvImageSupportCost(player,4);
if (csid == 0x2722 and option == 1) then
player:delGil(Cost);
player:messageSpecial(IMAGE_SUPPORT,0,6,0);
player:addStatusEffect(EFFECT_BONECRAFT_IMAGERY,3,0,480);
end
end; | gpl-3.0 |
rekotc/game-engine-experimental-3 | Source/GCC4/3rdParty/luaplus51-all/Src/Modules/penlight/docs/index.lua | 2 | 2339 | -- indexing a library
require 'pl'
local match = sip.match_at_start
local module_name
local funs = List()
function add_function (name,sentence)
funs:append {name,sentence,module_name}
end
function process_module (f)
local state = 'finding_module'
local res = {}
module_name = nil
for line in io.lines(f) do
if match('--- $',line,res) then
sentence = res[1]
local idot = sentence:find '%.'
if idot then
sentence = sentence:sub(1,idot-1)
end
elseif match('-- @class $v',line,res) then
if res[1] == 'module' then
state = 'finding_module_name'
elseif res[1] == 'function' then
state = 'finding_function_name'
end
elseif match('-- @name $S',line,res) then
if state == 'finding_module_name' then
module_name = res[1]
else
add_function(res[1],sentence)
end
sentence = nil
elseif match('local function $v',line,res) then
elseif match('function $S (',line,res) then
if sentence and module_name then
add_function(res[1],sentence)
sentence = nil
end
elseif match('module ($q',line,res) then
if not module_name then
module_name = res[2] -- res[1] will be the quote used!
end
end
end
end
local file = arg[1] or utils.quit 'please supply filename or path'
if path.isfile(file) then
process_module(arg[1])
elseif path.isdir(file) then
local files = dir.getfiles(file,'*.lua')
for _,f in ipairs(files) do
if f ~= '.' and f ~= '..' then
--~ print(f)
process_module(f)
end
end
end
funs:sort(function(t1,t2)
return t1[1] < t2[1]
end)
local outf = io.open('function_index.txt','w')
outf:write('#Penlight Function Index\n\n')
for i = 1,#funs do
local t = funs[i]
local name,mod,descript = t[1],t[3],t[2]
--~ if not mod then mod = '?' end
--~ if not t[3] then t[3] = '??' end
name = '['..name..']('..'api/modules/'..mod..'.html#'..name..')'
outf:write('-\t',name..'('..t[3]..')\t'..t[2],'\n')
--print(t[1]..' ('..t[3]..')',t[2])
--print(t[1],t[3],t[2])
end
outf:close()
| lgpl-3.0 |
santssoft/darkstar | scripts/globals/mobskills/megaflare.lua | 11 | 1890 | ---------------------------------------------
-- Megaflare
-- Family: Bahamut
-- Description: Deals heavy Fire damage to enemies within a fan-shaped area.
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes shadows
-- Range:
-- Notes: Used by Bahamut every 10% of its HP (except at 10%), but can use at will when under 10%.
---------------------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/monstertpmoves")
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
local mobhp = mob:getHPP()
if (mobhp <= 10 and mob:getLocalVar("GigaFlare") ~= 0) then -- make sure Gigaflare has happened first - don't want a random Megaflare to block it.
mob:setLocalVar("MegaFlareQueue", 1) -- set up Megaflare for being called by the script again.
end
return 1
end
function onMobWeaponSkill(target, mob, skill)
local MegaFlareQueue = mob:getLocalVar("MegaFlareQueue") - 1 -- decrement the amount of queued Megaflares.
mob:setLocalVar("MegaFlareQueue", MegaFlareQueue)
mob:setLocalVar("FlareWait", 0) -- reset the variables for Megaflare.
mob:setLocalVar("tauntShown", 0)
mob:SetMobAbilityEnabled(true) -- re-enable the other actions on success
mob:SetMagicCastingEnabled(true)
mob:SetAutoAttackEnabled(true)
if (bit.band(mob:getBehaviour(),dsp.behavior.NO_TURN) == 0) then -- re-enable noturn
mob:setBehaviour(bit.bor(mob:getBehaviour(), dsp.behavior.NO_TURN))
end
local dmgmod = 1
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*10,dsp.magic.ele.FIRE,dmgmod,TP_NO_EFFECT)
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,dsp.attackType.MAGICAL,dsp.damageType.FIRE,MOBPARAM_WIPE_SHADOWS)
target:takeDamage(dmg, mob, dsp.attackType.MAGICAL, dsp.damageType.FIRE)
return dmg
end
| gpl-3.0 |
lvshaco/ejoy2d | examples/test_sprite.lua | 1 | 1761 | local ej = require "ejoy2d"
local fw = require "ejoy2d.framework"
local pack = require "ejoy2d.simplepackage"
local matrix = require "ejoy2d.matrix"
local spritex = require "ex.spritex"
pack.load {
pattern = fw.WorkDir..[[examples/asset/?]],
"image", 'uiimage'
}
local o0 = spritex.new("image", 0)
local o1 = spritex.new("image", 0)
local o2 = spritex.new("image", 0)
local o3 = spritex.new("image", 0)
local o4 = spritex.new("image", 0)
local o5 = spritex.new("image", 0)
local o6 = spritex.new("image", 0)
local s1 = ej.sprite('uiimage', 12)
local s2 = ej.sprite('uiimage', 12)
local s3 = ej.sprite('uiimage', 12)
s1:ps(0, 400)
s2:ps(3, 408)
s3:ps(6, 416)
local w, h = o0.__w, o0.__h
o0:anchorpoint(0,0)
o1:anchorpoint(0,0)
o2:anchorpoint(1,1)
o3:anchorpoint(0.5,0.5)
o4:anchorpoint(0,0)
o5:anchorpoint(1,1)
o6:anchorpoint(0.5,0.5)
o0:pos(100,100)
o1:pos(100,100)
o2:pos(100+w,100+h)
o3:pos(100+w/2,100+h/2)
o4:pos(100,100)
o5:pos(100+w,100+h)
o6:pos(100+w/2,100+h/2)
o4:scale(2)
o5:scale(2)
o6:scale(2)
local game = {}
local rot = 0
function game.update()
rot = rot+1
if rot == 360 then
rot = 0
end
o1:rot(rot)
o2:rot(rot)
o3:rot(rot)
o4:rot(rot)
o5:rot(rot)
o6:rot(rot)
o0:update()
o1:update()
o2:update()
o3:update()
o4:update()
o5:update()
o6:update()
end
function game.drawframe()
ej.clear(0xff808080) -- clear (0.5,0.5,0.5,1) gray
o6:draw()
o5:draw()
o4:draw()
o0:draw()
o3:draw()
o2:draw()
o1:draw()
s1:draw()
s2:draw()
s3:draw()
end
function game.touch(what, x, y)
end
function game.message(...)
end
function game.handle_error(...)
end
function game.on_resume()
end
function game.on_pause()
end
ej.start(game)
| mit |
m241dan/darkstar | scripts/globals/spells/cursna.lua | 21 | 1948 | -----------------------------------------
-- Spell: Cursna
-- Removes curse and bane from target.
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local curse = target:getStatusEffect(EFFECT_CURSE_I);
local curse2 = target:getStatusEffect(EFFECT_CURSE_II);
local bane = target:getStatusEffect(EFFECT_BANE);
local bonus = target:getMod(MOD_ENHANCES_CURSNA);
spell:setMsg(75);
if (curse ~= nil and curse2 ~= nil and bane ~= nil) then
target:delStatusEffect(EFFECT_CURSE_I);
target:delStatusEffect(EFFECT_CURSE_II);
target:delStatusEffect(EFFECT_BANE);
final = EFFECT_CURSE_II;
spell:setMsg(83);
elseif (curse ~= nil and bane ~= nil) then
target:delStatusEffect(EFFECT_CURSE_I);
target:delStatusEffect(EFFECT_BANE);
final = EFFECT_CURSE_I;
spell:setMsg(83);
elseif (curse2 ~= nil and bane ~= nil) then
target:delStatusEffect(EFFECT_CURSE_II);
target:delStatusEffect(EFFECT_BANE);
final = EFFECT_CURSE_II;
spell:setMsg(83);
elseif (curse ~= nil) then
target:delStatusEffect(EFFECT_CURSE_I);
final = EFFECT_CURSE_I;
spell:setMsg(83);
elseif (curse2 ~= nil) then
target:delStatusEffect(EFFECT_CURSE_II);
final = EFFECT_CURSE_II;
spell:setMsg(83);
elseif (bane ~= nil) then
target:delStatusEffect(EFFECT_BANE);
final = EFFECT_BANE;
spell:setMsg(83);
elseif (target:hasStatusEffect(EFFECT_DOOM) and math.random() <= (0.25+bonus)) then
-- remove doom
final = EFFECT_DOOM;
target:delStatusEffect(EFFECT_DOOM);
spell:setMsg(359);
end
return final;
end; | gpl-3.0 |
aqasaeed/uzzbot | plugins/bugzilla.lua | 611 | 3983 | do
local BASE_URL = "https://bugzilla.mozilla.org/rest/"
local function bugzilla_login()
local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password
print("accessing " .. url)
local res,code = https.request( url )
local data = json:decode(res)
return data
end
local function bugzilla_check(id)
-- data = bugzilla_login()
local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey
-- print(url)
local res,code = https.request( url )
local data = json:decode(res)
return data
end
local function bugzilla_listopened(email)
local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey
local res,code = https.request( url )
print(res)
local data = json:decode(res)
return data
end
local function run(msg, matches)
local response = ""
if matches[1] == "status" then
local data = bugzilla_check(matches[2])
vardump(data)
if data.error == true then
return "Sorry, API failed with message: " .. data.message
else
response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator
response = response .. "\n Last update: "..data.bugs[1].last_change_time
response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution
response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard
response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1]
print(response)
end
elseif matches[1] == "list" then
local data = bugzilla_listopened(matches[2])
vardump(data)
if data.error == true then
return "Sorry, API failed with message: " .. data.message
else
-- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator
-- response = response .. "\n Last update: "..data.bugs[1].last_change_time
-- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution
-- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard
-- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1]
local total = table.map_length(data.bugs)
print("total bugs: " .. total)
local response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2]
if total > 0 then
response = response .. ": "
for tableKey, bug in pairs(data.bugs) do
response = response .. "\n #" .. bug.id
response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution
response = response .. "\n Whiteboard: " .. bug.whiteboard
response = response .. "\n Summary: " .. bug.summary
end
end
end
end
return response
end
-- (table)
-- [bugs] = (table)
-- [1] = (table)
-- [status] = (string) ASSIGNED
-- [id] = (number) 927704
-- [whiteboard] = (string) [approved][full processed]
-- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/
-- [2] = (table)
-- [status] = (string) ASSIGNED
-- [id] = (number) 1049337
-- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos]
-- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/
-- total bugs: 2
return {
description = "Lookup bugzilla status update",
usage = "/bot bugzilla [bug number]",
patterns = {
"^/bugzilla (status) (.*)$",
"^/bugzilla (list) (.*)$"
},
run = run
}
end | gpl-2.0 |
m241dan/darkstar | scripts/globals/items/serving_of_karni_yarik_+1.lua | 18 | 1379 | -----------------------------------------
-- ID: 5589
-- Item: serving_of_karni_yarik_+1
-- Food Effect: 60Min, All Races
-----------------------------------------
-- Agility 3
-- Vitality -1
-- Attack % 20
-- Attack Cap 65
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,3600,5589);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_AGI, 3);
target:addMod(MOD_VIT, -1);
target:addMod(MOD_FOOD_ATTP, 20);
target:addMod(MOD_FOOD_ATT_CAP, 65);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_AGI, 3);
target:delMod(MOD_VIT, -1);
target:delMod(MOD_FOOD_ATTP, 20);
target:delMod(MOD_FOOD_ATT_CAP, 65);
end;
| gpl-3.0 |
m241dan/darkstar | scripts/commands/jail.lua | 26 | 2057 | ---------------------------------------------------------------------------------------------------
-- func: jail
-- desc: Sends the target player to jail. (Mordion Gaol)
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "sis"
};
function onTrigger(player, target, cellId, reason)
local jailCells =
{
-- Floor 1 (Bottom)
{-620, 11, 660, 0}, {-180, 11, 660, 0}, {-260, 11, 660, 0}, {-700, 11, 660, 0},
{-620, 11, 220, 0}, {-180, 11, 220, 0}, {-260, 11, 220, 0}, {-700, 11, 220, 0},
{-620, 11, -220, 0}, {-180, 11, -220, 0}, {-260, 11, -220, 0}, {-700, 11, -220, 0},
{-620, 11, -660, 0}, {-180, 11, -660, 0}, {-260, 11, -660, 0}, {-700, 11, -660, 0},
-- Floor 2 (Top)
{-620, -440, 660, 0}, {-180, -440, 660, 0}, {-260, -440, 660, 0}, {-700, -440, 660, 0},
{-620, -440, 220, 0}, {-180, -440, 220, 0}, {-260, -440, 220, 0}, {-700, -440, 220, 0},
{-620, -440, -220, 0}, {-180, -440, -220, 0}, {-260, -440, -220, 0}, {-700, -440, -220, 0},
{-620, -440, -660, 0}, {-180, -440, -660, 0}, {-260, -440, -660, 0}, {-700, -440, -660, 0},
};
-- Validate the target..
local targ = GetPlayerByName( target );
if (targ == nil) then
player:PrintToPlayer( string.format( "Invalid player '%s' given.", target ) );
return;
end
-- Validate the cell id..
if (cellId == nil or cellId == 0 or cellId > 32) then
cellId = 1;
end
-- Validate the reason..
if (reason == nil) then
reason = "Unspecified.";
end
-- Print that we have jailed someone..
local message = string.format( '%s jailed %s(%d) into cell %d. Reason: %s', player:getName(), target, targ:getID(), cellId, reason );
printf( message );
-- Send the target to jail..
local dest = jailCells[ cellId ];
targ:setVar( "inJail", cellId );
targ:setPos( dest[1], dest[2], dest[3], dest[4], 131 );
end | gpl-3.0 |
m241dan/darkstar | scripts/zones/Qulun_Dome/npcs/qm1.lua | 13 | 1386 | -----------------------------------
-- Area: Qulun Dome
-- NPC: qm1 (???)
-- Used In Quest: Whence Blows the Wind
-- @pos 261 39 79 148
-----------------------------------
package.loaded["scripts/zones/Qulun_Dome/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Qulun_Dome/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(JEUNO,WHENCE_BLOWS_THE_WIND) == QUEST_ACCEPTED and player:hasKeyItem(QUADAV_CREST) == false) then
player:addKeyItem(QUADAV_CREST);
player:messageSpecial(KEYITEM_OBTAINED, QUADAV_CREST);
else
player:messageSpecial(YOU_FIND_NOTHING);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
m241dan/darkstar | scripts/commands/changejob.lua | 21 | 1062 | ---------------------------------------------------------------------------------------------------
-- func: changejob
-- desc: Changes the players current job.
---------------------------------------------------------------------------------------------------
require("scripts/globals/status");
cmdprops =
{
permission = 1,
parameters = "si"
};
function onTrigger(player, jobId, level)
jobId = tonumber(jobId) or JOBS[string.upper(jobId)];
if (jobId == nil) then
player:PrintToPlayer("You must enter a job ID or short-name.");
return;
end
if (jobId <= 0 or jobId >= MAX_JOB_TYPE) then
player:PrintToPlayer(string.format("Invalid job '%s' given. Use short-name or id. e.g. WAR", jobId));
return;
end
-- Change the players job..
player:changeJob(jobId);
-- Attempt to set the players level..
if (level ~= nil and level > 0 and level <= 99) then
player:setLevel(level);
else
player:PrintToPlayer("Invalid level given. Level must be between 1 and 99!");
end
end
| gpl-3.0 |
ducseb/domoticz | scripts/dzVents/runtime/tests/tstData.lua | 5 | 9499 | local testData = {
domoticzData = {
[1] = {
["id"] = 1,
["name"] = "device1",
["description"] = "Description 1";
["batteryLevel"] = 10,
["signalLevel"] = 10,
["subType"] = "Zone";
["timedOut"] = true,
["switchType"] = "Contact",
["switchTypeValue"] = 2,
["lastUpdate"] = "2016-03-20 12:23:00";
["data"] = {
["_state"] = "On",
temperature = 37,
dewpoint = 55,
humidity = 66,
setPoint = 2,
["deviceType"] = "Heating",
["hardwareName"] = "hw1",
["hardwareType"] = "ht1",
["hardwareTypeValue"] = 1;
["hardwareID"] = 1,
['unit'] = 1,
heatingMode = '3'
};
["deviceID"] = "__1",
["rawData"] = {
[1] = "1",
[2] = '2',
[3] = '3'
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[2] = {
["id"] = 2,
["name"] = "device2",
["description"] = "Description 2";
["batteryLevel"] = 20,
["signalLevel"] = 20,
["subType"] = "Lux";
["deviceType"] = "Lux",
["timedOut"] = false,
["switchType"] = "Motion Sensor",
["switchTypeValue"] = 8,
["lastUpdate"] = "2016-03-20 12:23:00";
["data"] = {
["_state"] = "Off",
["hardwareName"] = "hw2",
["hardwareType"] = "ht2",
["hardwareTypeValue"] = 2;
["hardwareID"] = 2,
['unit'] = 1,
temperature = 12,
dewpoint = 66,
humidity = 67,
--lux = 4
};
["deviceID"] = "__2",
["rawData"] = {
[1] = "4",
[2] = '5',
[3] = '6'
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[3] = {
["id"] = 3,
["name"] = "device3",
["description"] = "Description 3";
["batteryLevel"] = 30,
["signalLevel"] = 30,
["subType"] = "Energy";
["deviceType"] = "P1 Smart Meter",
["timedOut"] = false,
["switchType"] = "On/Off",
["switchTypeValue"] = 0,
["lastUpdate"] = "2016-03-20 12:23:00";
["data"] = {
["_state"] = 120,
["hardwareName"] = "hw3",
["hardwareType"] = "ht3",
["hardwareTypeValue"] = 3;
["hardwareID"] = 3,
['unit'] = 1,
WActual = 11,
uv = 23
};
["deviceID"] = "__3",
["rawData"] = {
[1] = "7",
[2] = '8',
[3] = '9',
[4] = '10',
[5] = '11'
},
["baseType"] = "device";
["changed"] = false;
["changedAttribute"] = nil --tbd
},
[4] = {
["id"] = 4,
["name"] = "device4",
["description"] = "Description 4";
["batteryLevel"] = 40,
["signalLevel"] = 0,
["subType"] = "SetPoint";
["deviceType"] = "Thermostat",
["timedOut"] = false,
["switchType"] = "Security",
["switchTypeValue"] = 0,
["lastUpdate"] = "2016-03-20 12:23:00";
["data"] = {
["_state"] = "Set Level 5%",
level = 5,
barometer = 333,
["hardwareName"] = "hw4",
["hardwareType"] = "ht4",
["hardwareTypeValue"] = 4;
["hardwareID"] = 4,
['unit'] = 1,
utility = 123,
weather = 'Nice',
rainLastHour = 12,
rain = 666,
setPoint = 10
};
["deviceID"] = "__4",
["rawData"] = {
[1] = "10",
[2] = '11',
[3] = '12'
},
["baseType"] = "device";
["changed"] = false;
["changedAttribute"] = nil --tbd
},
[5] = {
["id"] = 5,
["name"] = "device5",
["description"] = "Description 5";
["batteryLevel"] = 40,
["signalLevel"] = 0,
["subType"] = "kWh";
["deviceType"] = "General",
["timedOut"] = false,
["switchType"] = "Security",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["_state"] = "On",
counterToday = '1.234 kWh',
counter = '567 kWh',
["hardwareName"] = "hw5",
["hardwareType"] = "ht5",
["hardwareTypeValue"] = 5;
["hardwareID"] = 0,
['unit'] = 1,
WhTotal = 14,
WActual = 13,
WhToday = 1.234,
level = 10,
counterTotal = '567 kWh'
};
["deviceID"] = "__5",
["rawData"] = {
[1] = "13",
[2] = '14',
[3] = '15'
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[6] = {
["id"] = 6,
["name"] = "device6",
["description"] = "Description 6";
["batteryLevel"] = 40,
["signalLevel"] = 0,
["subType"] = "Electric";
["deviceType"] = "Usage",
["timedOut"] = false,
["switchType"] = "",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["hardwareName"] = "hw4",
["hardwareType"] = "ht4",
["hardwareTypeValue"] = 4;
["hardwareID"] = 4,
['unit'] = 1,
["value"] = 16.5, -- ?
};
["deviceID"] = "__6",
["rawData"] = {},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[7] = {
["id"] = 7,
["name"] = "device7",
["description"] = "";
["batteryLevel"] = 10,
["signalLevel"] = 10,
["subType"] = "";
["deviceType"] = "",
["timedOut"] = true,
["switchType"] = "",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["hardwareName"] = "",
["hardwareType"] = "",
["hardwareTypeValue"] = 0;
["hardwareID"] = 0,
["_state"] = 16.5,
['unit'] = 1,
WActual = 16.5
};
["deviceID"] = "__7",
["rawData"] = {
[1] = "16.5"
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[8] = {
["id"] = 8,
["name"] = "device8",
["description"] = "";
["batteryLevel"] = 10,
["signalLevel"] = 10,
["subType"] = "Text";
["deviceType"] = "General",
["timedOut"] = true,
["switchType"] = "",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["hardwareName"] = "",
["hardwareType"] = "",
["hardwareTypeValue"] = 0;
["hardwareID"] = 0,
["_state"] = 16.5,
['unit'] = 1,
text = 'Blah'
};
["deviceID"] = "__8",
["rawData"] = {
[1] = "16.5"
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[9] = {
["id"] = 9,
["name"] = "device9", -- double name
["description"] = "";
["batteryLevel"] = 10,
["signalLevel"] = 10,
["subType"] = "Text";
["deviceType"] = "General",
["timedOut"] = true,
["switchType"] = "",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["hardwareName"] = "",
["hardwareType"] = "",
["hardwareTypeValue"] = 0;
["hardwareID"] = 0,
["_state"] = 16.5,
['unit'] = 1,
text = 'Blah'
};
["deviceID"] = "__9",
["rawData"] = {
[1] = "16.5"
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
[10] = {
["id"] = 10,
["name"] = "device9", -- double name
["description"] = "";
["batteryLevel"] = 10,
["signalLevel"] = 10,
["subType"] = "Text";
["deviceType"] = "General",
["timedOut"] = true,
["switchType"] = "",
["switchTypeValue"] = 0,
["lastUpdate"] = "2017-04-18 20:15:23";
["data"] = {
["hardwareName"] = "",
["hardwareType"] = "",
["hardwareTypeValue"] = 0;
["hardwareID"] = 0,
["_state"] = 16.5,
['unit'] = 1,
text = 'Blah'
};
["deviceID"] = "__10",
["rawData"] = {
[1] = "16.5"
},
["baseType"] = "device";
["changed"] = true;
["changedAttribute"] = nil --tbd
},
--- vars
[11] = {
["id"] = 1,
["name"] = "x",
["changed"] = true,
["variableType"] = 'integer',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:15:23";
data = {
["value"] = 1
}
},
[12] = {
["id"] = 2,
["name"] = "y",
["changed"] = false,
["variableType"] = 'float',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:16:23";
data = { ["value"] = 2.3 }
},
[13] = {
["id"] = 3,
["name"] = "z",
["changed"] = true,
["variableType"] = 'string',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:16:23";
data = { ["value"] = 'some value'}
},
[14] = {
["id"] = 4,
["name"] = "a",
["changed"] = true,
["variableType"] = 'date',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:16:23";
data = { ["value"] = '3/12/2017' }
},
[15] = {
["id"] = 5,
["name"] = "b",
["changed"] = true,
["variableType"] = 'time',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:16:23";
data = { ["value"] = '19:34' }
},
[16] = {
["id"] = 6,
["name"] = "var with spaces",
["changed"] = true,
["variableType"] = 'string',
["baseType"] = "uservariable";
["lastUpdate"] = "2017-04-18 20:16:23";
data = { ["value"] = 'some value' }
},
--- scenes and groups
[17] = {
["id"] = 1;
["baseType"] = "scene";
["description"] = 'Descr scene 1',
["name"] = "Scene1";
["data"] = {
_state = "Off"
},
["lastUpdate"] = "2017-04-18 15:31:19";
},
[18] = {
["id"] = 3;
["baseType"] = "group";
["description"] = 'Descr group 1',
["name"] = "Group1";
["data"] = {
_state = "On"
},
["lastUpdate"] = "2017-04-18 15:31:26";
},
[19] = {
["id"] = 2;
["baseType"] = "scene";
["description"] = 'Descr scene 2',
["name"] = "Scene2";
["data"] = {
_state = "Off"
},
["lastUpdate"] = "2017-04-19 20:31:50";
},
[20] = {
["id"] = 4;
["baseType"] = "group";
["description"] = 'Descr group 2',
["name"] = "Group2";
["data"] = {
_state = "Mixed"
},
["lastUpdate"] = "2017-04-19 20:31:57";
},
-- groups
}
}
return testData | gpl-3.0 |
m241dan/darkstar | scripts/globals/spells/bluemagic/light_of_penance.lua | 25 | 2273 | -----------------------------------------
-- Spell: Light of Penance
-- Reduces an enemy's TP. Additional effect: Blindness and "Bind"
-- Spell cost: 53 MP
-- Monster Type: Beastmen
-- Spell Type: Magical (Light)
-- Blue Magic Points: 5
-- Stat Bonus: CHR+1, HP+15
-- Level: 58
-- Casting Time: 3 seconds
-- Recast Time: 60 seconds
-- Magic Bursts on: Transfixion, Fusion, and Light
-- Combos: Auto Refresh
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local typeEffectOne = EFFECT_BLINDNESS;
local typeEffectTwo = EFFECT_BIND;
local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0);
local duration = 30 * resist;
local power = 100 * resist;
local returnEffect = typeEffectOne;
if (resist >= 0.5) then
if (target:isFacing(caster)) then
if (target:hasStatusEffect(typeEffectOne) and target:hasStatusEffect(typeEffectTwo) and target:getTP() == 0) then
spell:setMsg(75); -- no effect
elseif (target:hasStatusEffect(typeEffectOne) and target:hasStatusEffect(typeEffectTwo)) then
target:delTP(power);
spell:setMsg(431); -- tp reduced
elseif (target:hasStatusEffect(typeEffectOne)) then
target:addStatusEffect(typeEffectTwo,1,0,duration);
target:delTP(power);
returnEffect = typeEffectTwo; -- make it return bind message if blind can't be inflicted
spell:setMsg(236);
else
target:addStatusEffect(typeEffectOne,50,0,duration);
target:addStatusEffect(typeEffectTwo,1,0,duration);
target:delTP(power);
spell:setMsg(236);
end;
else
spell:setMsg(75);
end;
end;
return returnEffect;
end; | gpl-3.0 |
santssoft/darkstar | scripts/zones/Windurst_Woods/npcs/Taraihi-Perunhi.lua | 12 | 1206 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Taraihi-Perunhi
-- Only sells when Windurst controlls Derfland Region
-- Confirmed shop stock, August 2013
-----------------------------------
local ID = require("scripts/zones/Windurst_Woods/IDs")
require("scripts/globals/events/harvest_festivals")
require("scripts/globals/shop")
require("scripts/globals/zone")
-----------------------------------
function onTrade(player,npc,trade)
onHalloweenTrade(player,trade,npc)
end
function onTrigger(player,npc)
local RegionOwner = GetRegionOwner(dsp.region.DERFLAND)
if RegionOwner ~= dsp.nation.WINDURST then
player:showText(npc,ID.text.TARAIHIPERUNHI_CLOSED_DIALOG)
else
player:showText(npc,ID.text.TARAIHIPERUNHI_OPEN_DIALOG)
local stock =
{
4352, 128, -- Derfland Pear
617, 142, -- Ginger
4545, 62, -- Gysahl Greens
1412, 1656, -- Olive Flower
633, 14, -- Olive Oil
951, 110 -- Wijnruit
}
dsp.shop.general(player, stock, WINDURST)
end
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end
| gpl-3.0 |
mitterdoo/keeptalkingnobodyexplodes | lua/entities/mitt_explodes/modules/morse.lua | 1 | 6770 | /*
The MIT License (MIT)
Copyright (c) 2015 mitterdoo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
MOD.Name = "Morse Code"
MOD.Difficulty = 3
MOD.Needy = false
MOD.Enabled = true
MOD.ForceWithTimer = false
// MOD.Rarity = 2
MOD.Frequencies = {
3.505,
3.515,
3.522,
3.532,
3.535,
3.542,
3.545,
3.552,
3.555,
3.565,
3.572,
3.575,
3.582,
3.592,
3.595,
3.600
}
MOD.TickRate = 0.3
MOD.Buttons = {
LEFT = 1,
RIGHT = 2,
TRANSMIT = 3,
}
MOD.HoverOutline = 2
function MOD:OnStart()
self:NetworkVar( "String", "Morse" )
self:NetworkVar( "Int", "Frequency" )
if SERVER then
self:StartServer()
else
self:StartClient()
end
end
function MOD:OnDisarm()
end
function MOD:OnEnd()
end
if SERVER then
MOD.Morse = {
A = '.-',
B = '-...',
C = '-.-.',
D = '-..',
E = '.',
F = '..-.',
G = '--.',
H = '....',
I = '..',
J = '.---',
K = '-.-',
L = '.-..',
M = '--',
N = '-.',
O = '---',
P = '.--.',
Q = '--.-',
R = '.-.',
S = '...',
T = '-',
U = '..-',
V = '...-',
W = '.--',
X = '-..-',
Y = '-.--',
Z = '--..'
}
MOD.Words = {
'SHELL',
"HALLS",
"SLICK",
"TRICK",
"BOXES",
"LEAKS",
"STROBE",
"BISTRO",
"FLICK",
"BOMBS",
"BREAK",
"BRICK",
"STEAK",
"STING",
"VECTOR",
"BEATS"
}
function MOD:StartServer()
local morse = ""
self.Word = table.Random( self.Words )
for i = 1, #self.Word do
local c = self.Word:sub( i,i )
morse = morse .. self.Morse[c] .. ( i < #self.Word and "/" or "" )
end
self:SetMorse( morse )
self:SetFrequency( math.random( 1, 16 ) )
end
function MOD:GetNet(button)
if button == self.Buttons.LEFT and self:GetFrequency() > 1 then
self:SetFrequency( self:GetFrequency() - 1 )
elseif button == self.Buttons.RIGHT and self:GetFrequency() < 16 then
self:SetFrequency( self:GetFrequency() + 1 )
elseif button == self.Buttons.TRANSMIT then
if self:GetFrequency() == self:GetFrequencyToTransmitTo() then
self:Disarm()
else
self:GetBomb():Strike( self )
end
end
end
function MOD:GetFrequencyToTransmitTo()
return table.KeyFromValue( self.Words, self.Word )
end
else
function MOD:sleep( time )
self.Next = CurTime() + time
end
function MOD:StartClient()
self.Ind = 1
end
function MOD:Think()
if self.Next and CurTime() < self.Next then return end
local morse = self:GetMorse()
local tick = self.TickRate
if self.Ind > #morse then
self.Ind = 1
self:sleep( tick * 7 )
else
local chr = morse:sub( self.Ind,self.Ind )
if chr == "/" then
self:sleep( tick*3 )
self.Ind = self.Ind + 1
elseif chr == "." then
if !self.Part then
self.Part = 1
self.Lit = true
self:sleep( tick )
elseif self.Part == 1 then
self.Lit = false
self:sleep( tick )
self.Part = nil
self.Ind = self.Ind + 1
end
elseif chr == "-" then
if !self.Part then
self.Part = 1
self.Lit = true
self:sleep( tick*3 )
elseif self.Part == 1 then
self.Lit = false
self:sleep( tick )
self.Part = nil
self.Ind = self.Ind + 1
end
end
end
end
local C_LIT = Color( 255,175,0 )
local C_UNLIT = Color( 128, 88, 0 )
local C_GRAY = Color( 30,30,30 )
local C_BG = Color( 100,100,100 )
local C_RED = Color( 255,80,80 )
local C_REALRED = Color( 255,0,0 )
local C_BUTTONBG = Color( 255, 245, 150 )
local Padding = 4
function MOD:Press( button )
self:SendNet( button )
end
function MOD:Draw( w, h )
surface.SetDrawColor( color_black )
local lw, lh = 32, 16
surface.DrawRect( 10, 10, lw, lh )
surface.DrawRect( 6, 10 + lh/2 - 1, w-6, 2 )
surface.DrawRect( 6, 0, 2, 10 + lh/2 - 1 )
surface.SetDrawColor( self.Lit and C_LIT or C_UNLIT )
local Border = 3
surface.DrawRect( 10 + Border, 10 + Border, 32 - Border*2, 16 - Border*2 )
surface.SetDrawColor( C_BG )
local ow, oh = w, h
w, h = 110, 60
local x, y = ow/2 - w/2, 40
surface.DrawRect( x, y, w, h )
local TunerWidth = w - Padding*2
surface.SetDrawColor( color_black )
surface.DrawRect( x + Padding, y + Padding, TunerWidth, 20 )
surface.SetDrawColor( color_white )
surface.DrawRect( x + Padding + Border, y + Padding + Border, TunerWidth - Border*2, 20 - Border*2 )
local lineSpacing = 6
local times = 16
local lineHeight = 4
surface.SetDrawColor( C_RED )
for i = 1, times do
local offset = i - 8.5
local ox = x + w / 2 + offset * lineSpacing
local oy = i % 2 == 0 and y + Padding + Border or y + Padding - Border + 20 - lineHeight
surface.DrawRect( ox, oy, 1, lineHeight )
end
TunerWidth = 80
local size = TunerWidth / 17 * self:GetFrequency() - TunerWidth / 2
local ox = x + w / 2 + size
local oy = y + Padding + 20 - Border - lineHeight*2
surface.SetDrawColor( C_REALRED )
surface.DrawRect( ox - 1, oy, 2, lineHeight*2)
surface.SetDrawColor( color_black )
surface.DrawRect( x + w / 2 - TunerWidth / 2, y + h - 26, TunerWidth, 20 )
draw.SimpleText( ( self.Frequencies[ self:GetFrequency() ] or "3.555" ) .. " MHz",
"Trebuchet18",
x + w / 2, y + h - 16, C_LIT,
TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER
)
local bw, bh = 12, 20
self:Button(
x + 1, y + h - 26,
bw, bh,
C_GRAY,
"«","default", color_white,
2,
1,color_black,
false,false,
self.Press,
self,
self.Buttons.LEFT
)
self:Button(
x + w - 1 - bw, y + h - 26,
bw, bh,
C_GRAY,
"»","default", color_white,
2,
1,color_black,
false,false,
self.Press,
self,
self.Buttons.RIGHT
)
local bw, bh = 20, 20
self:Button(
x + w/2 - bw/2, y + h + 2,
bw, bh,
C_BUTTONBG,
"TX",
"gothic_sm",
color_black,
4,
2, color_black,
false,false,
self.Press,
self,
self.Buttons.TRANSMIT
)
end
end
| mit |
camchenry/super_shooter | entities/ui/button.lua | 1 | 3375 | Button = class("Button")
function Button:initialize(text, x, y, w, h, fontSize, activated)
self.text = text
self.font = fontSize or font[32]
self.x = x
self.y = y
self.width = w or self.font:getWidth(text)
self.height = h or self.font:getHeight(text)
self.active = {127/255, 127/255, 127/255}
self.bg = {1, 1, 1, 0}
self.fg = {1, 1, 1, 1}
self.translateX = 0
self.click = Button.click
self.selected = false
self.activated = activated or function() end
end
function Button:mousepressed(x, y, mbutton)
if self:hover() and mbutton == 1 then
self.activated()
signal.emit('uiClick')
end
end
function Button:update(dt)
if self:hover() and not self.alreadyHovering then
signal.emit('uiHover')
self.alreadyHovering = true
elseif not self:hover() then
self.alreadyHovering = false
end
end
function Button:draw()
local r, g, b, a = love.graphics.getColor()
local oldColor = {r, g, b, a}
love.graphics.setColor(self.bg)
love.graphics.rectangle("fill", self.x, self.y, self.width, self.height)
if self:hover() then
love.graphics.setColor(self.active)
else
love.graphics.setColor(self.fg)
end
love.graphics.setFont(self.font)
local x = self.x + self.width/2 - self.font:getWidth(self.text)/2 + self.translateX
local y = self.y + self.height/2 - self.font:getHeight(self.text)/2
x, y = math.floor(x), math.floor(y)
love.graphics.printf(self.text, x, y, self.width)
love.graphics.setColor(oldColor)
end
function Button:setFont(font, update)
update = update or true
self.font = font
if update then
self.width = self.font:getWidth(self.text)
self.height = self.font:getHeight(self.text)
end
return self
end
function Button:setActive(r, g, b, a)
self.active = {r, g, b, a or 255}
return self
end
function Button:setBG(r, g, b, a)
self.bg = {r, g, b, a or 255}
return self
end
function Button:setFG(r, g, b, a)
self.fg = {r, g, b, a or 255}
return self
end
function Button:align(mode, margin)
margin = margin or 0
-- this will center align the button around the original coordinates
if mode == 'both' then
self.x = self.x - self.width/2
self.y = self.y - self.height/2
end
-- this will only align the button around the original x coordinate
if mode == 'x' then
self.x = self.x - self.width/2
end
-- this will only align the button around the original y coordinate
if mode == 'y' then
self.y = self.y - self.height/2
end
-- shift text to left
if mode == 'left' then
self.translateX = self.font:getWidth(self.text)/2 - self.width/2 + margin
end
-- shift text to center
if mode == 'center' then
self.translateX = 0
end
-- shift text to right
if mode == 'right' then
self.translateX = 0
end
end
function Button:centerAround(x, y)
self.x = x - self.width/2
self.y = y - self.height/2
return self
end
-- returns whether or not the mouse is currently over the button
function Button:hover()
local mx, my = love.mouse.getX(), love.mouse.getY()
local inX = mx >= self.x and mx <= self.x + self.width
local inY = my >= self.y and my <= self.y + self.height
return inX and inY
end
| mit |
Schaka/PartyAbilityBarsLegion | libs/Spells/spell_lib_rogue.lua | 2 | 8540 | local name, SPELLDB = ...
SPELLDB.ROGUE = {}
SPELLDB.ROGUE.ASSASSINATION = {}
SPELLDB.ROGUE.OUTLAW = {}
SPELLDB.ROGUE.SUBTLETY = {}
SPELLDB.ROGUE.ASSASSINATION.spells = {
208683,
2094 --[[Blind--]],
1833 --[[Cheap Shot--]],
31224 --[[Cloak of Shadows--]],
185311 --[[Crimson Vial--]],
1725 --[[Distract--]],
32645 --[[Envenom--]],
5277 --[[Evasion--]],
51723 --[[Fan of Knives--]],
1966 --[[Feint--]],
703 --[[Garrote--]],
1766 --[[Kick--]],
408 --[[Kidney Shot--]],
1329 --[[Mutilate--]],
1804 --[[Pick Lock--]],
921 --[[Pick Pocket--]],
185565 --[[Poisoned Knife--]],
1943 --[[Rupture--]],
6770 --[[Sap--]],
36554 --[[Shadowstep--]],
114018 --[[Shroud of Concealment--]],
2983 --[[Sprint--]],
1784 --[[Stealth--]],
57934 --[[Tricks of the Trade--]],
1856 --[[Vanish--]],
79140 --[[Vendetta--]],
31209 --[[Fleet Footed--]],
76803 --[[Mastery: Potent Poisons--]],
14190 --[[Seal Fate--]],
79134 --[[Venomous Wounds--]],
};
SPELLDB.ROGUE.OUTLAW.spells = {
13750 --[[Adrenaline Rush--]],
8676 --[[Ambush--]],
199804 --[[Between the Eyes--]],
13877 --[[Blade Flurry--]],
2094 --[[Blind--]],
199740 --[[Bribe--]],
1833 --[[Cheap Shot--]],
31224 --[[Cloak of Shadows--]],
185311 --[[Crimson Vial--]],
1725 --[[Distract--]],
1966 --[[Feint--]],
1776 --[[Gouge--]],
1766 --[[Kick--]],
1804 --[[Pick Lock--]],
921 --[[Pick Pocket--]],
185763 --[[Pistol Shot--]],
199754 --[[Riposte--]],
193316 --[[Roll the Bones--]],
2098 --[[Run Through--]],
193315 --[[Saber Slash--]],
6770 --[[Sap--]],
114018 --[[Shroud of Concealment--]],
2983 --[[Sprint--]],
1784 --[[Stealth--]],
57934 --[[Tricks of the Trade--]],
1856 --[[Vanish--]],
35551 --[[Combat Potency--]],
31209 --[[Fleet Footed--]],
76806 --[[Mastery: Main Gauche--]],
14161 --[[Ruthlessness--]],
};
SPELLDB.ROGUE.SUBTLETY.spells = {
53 --[[Backstab--]],
2094 --[[Blind--]],
1833 --[[Cheap Shot--]],
31224 --[[Cloak of Shadows--]],
185311 --[[Crimson Vial--]],
1725 --[[Distract--]],
5277 --[[Evasion--]],
196819 --[[Eviscerate--]],
1966 --[[Feint--]],
1766 --[[Kick--]],
408 --[[Kidney Shot--]],
195452 --[[Nightblade--]],
1804 --[[Pick Lock--]],
921 --[[Pick Pocket--]],
6770 --[[Sap--]],
121471 --[[Shadow Blades--]],
185313 --[[Shadow Dance--]],
36554 --[[Shadowstep--]],
185438 --[[Shadowstrike--]],
114018 --[[Shroud of Concealment--]],
197835 --[[Shuriken Storm--]],
114014 --[[Shuriken Toss--]],
2983 --[[Sprint--]],
115191 --[[Stealth--]],
212283 --[[Symbols of Death--]],
57934 --[[Tricks of the Trade--]],
1856 --[[Vanish--]],
185314 --[[Deepening Shadows--]],
31209 --[[Fleet Footed--]],
76808 --[[Mastery: Executioner--]],
58423 --[[Relentless Strikes--]],
196912 --[[Shadow Techniques--]],
};
SPELLDB.ROGUE.ASSASSINATION.talents = {
196864 --[[Master Poisoner--]],
193640 --[[Elaborate Planning--]],
16511 --[[Hemorrhage--]],
14062 --[[Nightstalker--]],
108208 --[[Subterfuge--]],
108209 --[[Shadow Focus--]],
193531 --[[Deeper Stratagem--]],
114015 --[[Anticipation--]],
14983 --[[Vigor--]],
108211 --[[Leeching Poison--]],
79008 --[[Elusiveness--]],
31230 --[[Cheat Death--]],
196861 --[[Thuggee--]],
131511 --[[Prey on the Weak--]],
154904 --[[Internal Bleeding--]],
200802 --[[Agonizing Poison--]],
193539 --[[Alacrity--]],
200806 --[[Exsanguinate--]],
152152 --[[Venom Rush--]],
137619 --[[Marked for Death--]],
152150 --[[Death from Above--]],
};
SPELLDB.ROGUE.OUTLAW.talents = {
196937 --[[Ghostly Strike--]],
200733 --[[Swordmaster--]],
196938 --[[Quick Draw--]],
195457 --[[Grappling Hook--]],
196924 --[[Acrobatic Strikes--]],
196922 --[[Hit and Run--]],
193531 --[[Deeper Stratagem--]],
114015 --[[Anticipation--]],
14983 --[[Vigor--]],
193546 --[[Iron Stomach--]],
79008 --[[Elusiveness--]],
31230 --[[Cheat Death--]],
199743 --[[Parley--]],
131511 --[[Prey on the Weak--]],
108216 --[[Dirty Tricks--]],
185767 --[[Cannonball Barrage--]],
193539 --[[Alacrity--]],
51690 --[[Killing Spree--]],
5171 --[[Slice and Dice--]],
137619 --[[Marked for Death--]],
152150 --[[Death from Above--]],
};
SPELLDB.ROGUE.SUBTLETY.talents = {
31223 --[[Master of Subtlety--]],
193537 --[[Weaponmaster--]],
200758 --[[Gloomblade--]],
14062 --[[Nightstalker--]],
108208 --[[Subterfuge--]],
108209 --[[Shadow Focus--]],
193531 --[[Deeper Stratagem--]],
114015 --[[Anticipation--]],
14983 --[[Vigor--]],
200759 --[[Soothing Darkness--]],
79008 --[[Elusiveness--]],
31230 --[[Cheat Death--]],
196951 --[[Strike from the Shadows--]],
131511 --[[Prey on the Weak--]],
200778 --[[Tangled Shadow--]],
196979 --[[Premeditation--]],
193539 --[[Alacrity--]],
206237 --[[Enveloping Shadows--]],
196976 --[[Master of Shadows--]],
137619 --[[Marked for Death--]],
152150 --[[Death from Above--]],
};
SPELLDB.ROGUE.ASSASSINATION.pvpTalents = {
208683 --[[Gladiator's Medallion--]],
214027 --[[Adaptation--]],
196029 --[[Relentless--]],
195416 --[[Hardiness--]],
195282 --[[Reinforced Armor--]],
195425 --[[Sparring--]],
197000 --[[Maneuverability--]],
197007 --[[Intent to Kill--]],
197020 --[[Cut to the Chase--]],
198020 --[[Turn the Tables--]],
198032 --[[Honor Among Thieves--]],
206317 --[[Unfair Advantage--]],
197044 --[[Deadly Brew--]],
197050 --[[Mind-numbing Poison--]],
206328 --[[Shiv--]],
198092 --[[Creeping Venom--]],
198128 --[[Flying Daggers--]],
198145 --[[System Shock--]],
};
SPELLDB.ROGUE.OUTLAW.pvpTalents = {
208683 --[[Gladiator's Medallion--]],
214027 --[[Adaptation--]],
196029 --[[Relentless--]],
195416 --[[Hardiness--]],
195282 --[[Reinforced Armor--]],
195425 --[[Sparring--]],
197000 --[[Maneuverability--]],
209752 --[[Boarding Party--]],
197020 --[[Cut to the Chase--]],
198020 --[[Turn the Tables--]],
198032 --[[Honor Among Thieves--]],
221622 --[[Thick as Thieves--]],
198265 --[[Take Your Cut--]],
212217 --[[Control is King--]],
212210 --[[Drink Up Me Hearties--]],
212035 --[[Cheap Tricks--]],
207777 --[[Dismantle--]],
198529 --[[Plunder Armor--]],
};
SPELLDB.ROGUE.SUBTLETY.pvpTalents = {
208683 --[[Gladiator's Medallion--]],
214027 --[[Adaptation--]],
196029 --[[Relentless--]],
195416 --[[Hardiness--]],
195282 --[[Reinforced Armor--]],
195425 --[[Sparring--]],
197000 --[[Maneuverability--]],
197899 --[[Silhouette--]],
197020 --[[Cut to the Chase--]],
198665 --[[Shadow's Caress--]],
198032 --[[Honor Among Thieves--]],
212182 --[[Smoke Bomb--]],
198952 --[[Veil of Midnight--]],
198675 --[[Dagger in the Dark--]],
213981 --[[Cold Blood--]],
216883 --[[Phantom Assassin--]],
212081 --[[Thief's Bargain--]],
207736 --[[Shadowy Duel--]],
};
SPELLDB.ROGUE.ASSASSINATION.artifact = {192759,192428,192657,192923,192318,192329,192323,192422,192326,192376,192424,192315,214368,192310,192384,192345,192349,};
SPELLDB.ROGUE.OUTLAW.artifact = {202665,202820,202897,202769,202533,202524,202514,202522,202755,202521,216230,202628,202907,202530,202507,202463,202753,};
SPELLDB.ROGUE.SUBTLETY.artifact = {209782,209781,209835,197406,221856,197369,197604,197235,197233,197610,197239,197244,197256,197231,197241,197386,197234,};
| gpl-3.0 |
m241dan/darkstar | scripts/zones/Eastern_Altepa_Desert/npcs/qm.lua | 13 | 1620 | -----------------------------------
-- Area: Eastern Altepa Desert
-- NPC: ???
-- Involved In Quest: A Craftsman's Work
-- @pos 113 -7.972 -72 114
-----------------------------------
package.loaded["scripts/zones/Eastern_Altepa_Desert/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/Eastern_Altepa_Desert/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
Decurio_I_IIIKilled = player:getVar("Decurio_I_IIIKilled");
if (player:getVar("aCraftsmanWork") == 1 and Decurio_I_IIIKilled == 0) then
SpawnMob(17244523,300):updateClaim(player);
elseif (Decurio_I_IIIKilled == 1) then
player:addKeyItem(ALTEPA_POLISHING_STONE);
player:messageSpecial(KEYITEM_OBTAINED,ALTEPA_POLISHING_STONE);
player:setVar("aCraftsmanWork",2);
player:setVar("Decurio_I_IIIKilled",0);
else
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
ILiebhardt/darktable | tools/lua_doc/old_api/dt_api300.lua | 7 | 247785 | API = {
["__text"] = [==[This documentation is for the *development* version of darktable. for the stable version, please visit the user manual
To access the darktable specific functions you must load the darktable environment:<code>darktable = require "darktable"</code>All functions and data are accessed through the darktable module.
This documentation for API version 3.0.0.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["darktable"] = {
["__text"] = [==[The darktable library is the main entry point for all access to the darktable internals.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["print"] = {
["__text"] = [==[Will print a string to the darktable control log (the long overlaid window that appears over the main panel).]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The string to display which should be a single line.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["print_error"] = {
["__text"] = [==[This function will print its parameter if the Lua logdomain is activated. Start darktable with the "-d lua" command line option to enable the Lua logdomain.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The string to display.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["register_event"] = {
["__text"] = [==[This function registers a callback to be called when a given event happens.
Events are documented in the event section.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event to register to.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The function to call on event. The signature of the function depends on the type of event.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
},
},
["3"] = {
["__text"] = [==[Some events need extra parameters at registration time; these must be specified here.]==],
["__attributes"] = {
["reported_type"] = [==[variable]==],
},
},
},
},
},
["register_storage"] = {
["__text"] = [==[This function will add a new storage implemented in Lua.
A storage is a module that is responsible for handling images once they have been generated during export. Examples of core storages include filesystem, e-mail, facebook...]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[A Unique name for the plugin.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[A human readable name for the plugin.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[This function is called once for each exported image. Images can be exported in parallel but the calls to this function will be serialized.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The storage object used for the export.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A virtual type representing all storage types.]==],
["__attributes"] = {
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["plugin_name"] = {
["__text"] = [==[A unique name for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["name"] = {
["__text"] = [==[A human readable name for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["width"] = {
["__text"] = [==[The currently selected width for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["height"] = {
["__text"] = [==[The currently selected height for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["recommended_width"] = {
["__text"] = [==[The recommended width for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["recommended_height"] = {
["__text"] = [==[The recommended height for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["supports_format"] = {
["__text"] = [==[Checks if a format is supported by this storage.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[True if the format is supported by the storage.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The storage type to check against.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The format type to check.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A virtual type representing all format types.]==],
["__attributes"] = {
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["plugin_name"] = {
["__text"] = [==[A unique name for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["name"] = {
["__text"] = [==[A human readable name for the plugin.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["extension"] = {
["__text"] = [==[The typical filename extension for that format.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["mime"] = {
["__text"] = [==[The mime type associated with the format.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["max_width"] = {
["__text"] = [==[The max width allowed for the format (0 = unlimited).]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["max_height"] = {
["__text"] = [==[The max height allowed for the format (0 = unlimited).]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["write_image"] = {
["__text"] = [==[Exports an image to a file. This is a blocking operation that will not return until the image is exported.]==],
["__attributes"] = {
["implicit_yield"] = true,
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[Returns true on success.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The format that will be used to export.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The image object to export.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[Image objects represent an image in the database. This is slightly different from a file on disk since a file can have multiple developments.
Note that this is the real image object; changing the value of a field will immediately change it in darktable and will be reflected on any copy of that image object you may have kept.]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["attach_tag"] = {
["__text"] = [==[Attach a tag to an image; the order of the parameters can be reversed.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The tag to be attached.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A tag that can be attached to an image.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["delete"] = {
["__text"] = [==[Deletes the tag object, detaching it from all images.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The tag to be deleted.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["attach"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"]]=],
["detach"] = {
["__text"] = [==[Detach a tag from an image; the order of the parameters can be reversed.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The tag to be detached.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The image to detach the tag from.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["name"] = {
["__text"] = [==[The name of the tag.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["#"] = {
["__text"] = [==[The images that have that tag attached to them.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["2"] = {
["__text"] = [==[The image to attach the tag to.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["detach_tag"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"]]=],
["get_tags"] = {
["__text"] = [==[Gets all tags attached to an image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[A table of tags that are attached to the image.]==],
["__attributes"] = {
["reported_type"] = [==[table of types.dt_lua_tag_t]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The image to get the tags from.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["create_style"] = {
["__text"] = [==[Create a new style based on an image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The new style object.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A style that can be applied to an image.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["delete"] = {
["__text"] = [==[Deletes an existing style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[the style to delete]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
},
},
},
["duplicate"] = {
["__text"] = [==[Create a new style based on an existing style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The new style object.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The style to base the new style on.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The new style's name.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The new style's description.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["apply"] = {
["__text"] = [==[Apply a style to an image. The order of parameters can be inverted.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The style to use.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The image to apply the style to.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["export"] = {
["__text"] = [==[Export a style to an external .dtstyle file]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The style to export]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The directory to export to]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[Is overwriting an existing file allowed]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
},
},
},
["name"] = {
["__text"] = [==[The name of the style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["description"] = {
["__text"] = [==[The description of the style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["#"] = {
["__text"] = [==[The different items that make the style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[An element that is part of a style.]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["name"] = {
["__text"] = [==[The name of the style item.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["num"] = {
["__text"] = [==[The position of the style item within its style.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
},
},
},
},
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The image to create the style from.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The name to give to the new style.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The description of the new style.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["apply_style"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"]]=],
["duplicate"] = {
["__text"] = [==[Creates a duplicate of an image and returns it.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The new image object.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[the image to duplicate]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["move"] = {
["__text"] = [==[Physically moves an image (and all its duplicates) to another film.
This will move the image file, the related XMP and all XMP for the duplicates to the directory of the new film
Note that the parameter order is not relevant.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image to move]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The film to move to]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A film in darktable; this represents a directory containing imported images.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["move_image"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"]]=],
["copy_image"] = {
["__text"] = [==[Physically copies an image to another film.
This will copy the image file and the related XMP to the directory of the new film
If there is already a file with the same name as the image file, it will create a duplicate from that file instead
Note that the parameter order is not relevant.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The new image]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The image to copy]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The film to copy to]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["#"] = {
["__text"] = [==[The different images within the film.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["id"] = {
["__text"] = [==[A unique numeric id used by this film.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["path"] = {
["__text"] = [==[The path represented by this film.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["delete"] = {
["__text"] = [==[Removes the film from the database.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The film to remove.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[Force removal, even if the film is not empty.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[Boolean]==],
},
},
},
},
},
},
},
},
},
},
},
["copy"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"]]=],
["id"] = {
["__text"] = [==[A unique id identifying the image in the database.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["path"] = {
["__text"] = [==[The file the directory containing the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["film"] = {
["__text"] = [==[The film object that contains this image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["filename"] = {
["__text"] = [==[The filename of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["sidecar"] = {
["__text"] = [==[The filename of the image's sidecar file.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["duplicate_index"] = {
["__text"] = [==[If there are multiple images based on a same file, each will have a unique number, starting from 0.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["publisher"] = {
["__text"] = [==[The publisher field of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["title"] = {
["__text"] = [==[The title field of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["creator"] = {
["__text"] = [==[The creator field of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["rights"] = {
["__text"] = [==[The rights field of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["description"] = {
["__text"] = [==[The description field for the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["exif_maker"] = {
["__text"] = [==[The maker exif data.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["exif_model"] = {
["__text"] = [==[The camera model used.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["exif_lens"] = {
["__text"] = [==[The id string of the lens used.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["exif_aperture"] = {
["__text"] = [==[The aperture saved in the exif data.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["exif_exposure"] = {
["__text"] = [==[The exposure time of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["exif_focal_length"] = {
["__text"] = [==[The focal length of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["exif_iso"] = {
["__text"] = [==[The iso used on the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["exif_datetime_taken"] = {
["__text"] = [==[The date and time of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["exif_focus_distance"] = {
["__text"] = [==[The distance of the subject.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["exif_crop"] = {
["__text"] = [==[The exif crop data.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["latitude"] = {
["__text"] = [==[GPS latitude data of the image, nil if not set.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[float or nil]==],
["write"] = true,
},
},
["longitude"] = {
["__text"] = [==[GPS longitude data of the image, nil if not set.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[float or nil]==],
["write"] = true,
},
},
["elevation"] = {
["__text"] = [==[GPS altitude data of the image, nil if not set.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[float or nil]==],
["write"] = true,
},
},
["is_raw"] = {
["__text"] = [==[True if the image is a RAW file.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
["is_ldr"] = {
["__text"] = [==[True if the image is a ldr image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
["is_hdr"] = {
["__text"] = [==[True if the image is a hdr image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
["has_txt"] = {
["__text"] = [==[True if the image has a txt sidecar file.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["width"] = {
["__text"] = [==[The width of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["height"] = {
["__text"] = [==[The height of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["rating"] = {
["__text"] = [==[The rating of the image (-1 for rejected).]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["red"] = {
["__text"] = [==[True if the image has the corresponding colorlabel.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["blue"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]]=],
["green"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]]=],
["yellow"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]]=],
["purple"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]]=],
["reset"] = {
["__text"] = [==[Removes all processing from the image, resetting it back to its original state]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image whose history will be deleted]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["delete"] = {
["__text"] = [==[Removes an image from the database]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image to remove]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["group_with"] = {
["__text"] = [==[Puts the first image in the same group as the second image. If no second image is provided the image will be in its own group.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image whose group must be changed.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The image we want to group with.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["make_group_leader"] = {
["__text"] = [==[Makes the image the leader of its group.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image we want as the leader.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["get_group_members"] = {
["__text"] = [==[Returns a table containing all types.dt_lua_image_t of the group. The group leader is both at a numeric key and at the "leader" special key (so you probably want to use ipairs to iterate through that table).]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[A table of image objects containing all images that are in the same group as the image.]==],
["__attributes"] = {
["reported_type"] = [==[table of types.dt_lua_image_t]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The image whose group we are querying.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["group_leader"] = {
["__text"] = [==[The image which is the leader of the group this image is a member of.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["local_copy"] = {
["__text"] = [==[True if the image has a copy in the local cache]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["drop_cache"] = {
["__text"] = [==[drops the cached version of this image.
This function should be called if an image is modified out of darktable to force DT to regenerate the thumbnail
darktable will regenerate the thumbnail by itself when it is needed]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The image whose cache must be dropped.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
},
},
},
["3"] = {
["__text"] = [==[The filename to export to.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["4"] = {
["__text"] = [==[Set to true to allow upscaling of the image.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[boolean]==],
},
},
},
},
},
},
},
},
},
},
},
},
},
},
["2"] = {
["__text"] = [==[The exported image object.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["3"] = {
["__text"] = [==[The format object used for the export.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["4"] = {
["__text"] = [==[The name of a temporary file where the processed image is stored.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["5"] = {
["__text"] = [==[The number of the image out of the export series.]==],
["__attributes"] = {
["reported_type"] = [==[integer]==],
},
},
["6"] = {
["__text"] = [==[The total number of images in the export series.]==],
["__attributes"] = {
["reported_type"] = [==[integer]==],
},
},
["7"] = {
["__text"] = [==[True if the export is high quality.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["8"] = {
["__text"] = [==[An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export serie.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
},
},
},
["4"] = {
["__text"] = [==[This function is called once all images are processed and all store calls are finished.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The storage object used for the export.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[A table keyed by the exported image objects and valued with the corresponding temporary export filename.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
["3"] = {
["__text"] = [==[An empty Lua table to store extra data. This table is common to all calls to store and the call to finalize in a given export series.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
},
},
},
["5"] = {
["__text"] = [==[A function called to check if a given image format is supported by the Lua storage; this is used to build the dropdown format list for the GUI.
Note that the parameters in the format are the ones currently set in the GUI; the user might change them before export.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[True if the corresponding format is supported.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The storage object tested.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The format object to report about.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["6"] = {
["__text"] = [==[A function called before storage happens
This function can change the list of exported functions]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The modified table of images to export or nil
If nil (or nothing) is returned, the original list of images will be exported
If a table of images is returned, that table will be used instead. The table can be empty. The images parameter can be modified and returned]==],
["__attributes"] = {
["reported_type"] = [==[table or nil]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The storage object tested.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The format object to report about.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["3"] = {
["__text"] = [==[A table containing images to be exported.]==],
["__attributes"] = {
["reported_type"] = [==[table of types.dt_lua_image_t]==],
},
},
["4"] = {
["__text"] = [==[True if the export is high quality.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["5"] = {
["__text"] = [==[An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export serie.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
},
},
},
["7"] = {
["__text"] = [==[A widget to display in the export section of darktable's UI]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = {
["__text"] = [==[Common parent type for all lua-handled widgets]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["sensitive"] = {
["__text"] = [==[Set if the widget is enabled/disabled]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["tooltip"] = {
["__text"] = [==[Tooltip to display for the widget]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string or nil]==],
["write"] = true,
},
},
["reset_callback"] = {
["__text"] = [==[A function to call when the widget needs to reset itself
Note that some widgets have a default implementation that can be overridden, (containers in particular will recursively reset their children). If you replace that default implementation you need to reimplement that functionality or call the original function within your callback]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget that triggered the callback]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["write"] = true,
},
},
["__call"] = {
["__text"] = [==[Using a lua widget as a function Allows to set multiple attributes of that widget at once. This is mainly used to create UI elements in a more readable way
For example:<code>local widget = dt.new_widget("button"){
label ="my label",
clicked_callback = function() print "hello world" end
}</code>]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The object called itself, to allow chaining]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[A table of attributes => value to set]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
},
},
},
},
},
},
},
},
},
["register_lib"] = {
["__text"] = [==[Register a new lib object. A lib is a graphical element of darktable's user interface]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[A unique name for your library]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[A user-visible name for your library]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[whether this lib should be expandable or not]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["4"] = {
["__text"] = [==[whether this lib has a reset button or not]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["5"] = {
["__text"] = [==[A table associating to each view containing the lib the corresponding container and position]==],
["__attributes"] = {
["reported_type"] = [==[table of types.dt_lua_view_t => [ types.dt_ui_container_t, int ]]==],
},
},
["6"] = {
["__text"] = [==[The widget to display in the lib]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
["7"] = {
["__text"] = [==[A callback called when a view displaying the lib is entered]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The lib on which the callback is called]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {
["__text"] = [==[The type of a UI lib]==],
["__attributes"] = {
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["id"] = {
["__text"] = [==[A unit string identifying the lib]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["name"] = {
["__text"] = [==[The translated title of the UI element]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["version"] = {
["__text"] = [==[The version of the internal data of this lib]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["visible"] = {
["__text"] = [==[Allow to make a lib module completely invisible to the user.
Note that if the module is invisible the user will have no way to restore it without lua]==],
["__attributes"] = {
["implicit_yield"] = true,
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["container"] = {
["__text"] = [==[The location of the lib in the darktable UI]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[A place in the darktable UI where a lib can be placed]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[DT_UI_CONTAINER_PANEL_LEFT_TOP]==],
["2"] = [==[DT_UI_CONTAINER_PANEL_LEFT_CENTER]==],
["3"] = [==[DT_UI_CONTAINER_PANEL_LEFT_BOTTOM]==],
["4"] = [==[DT_UI_CONTAINER_PANEL_RIGHT_TOP]==],
["5"] = [==[DT_UI_CONTAINER_PANEL_RIGHT_CENTER]==],
["6"] = [==[DT_UI_CONTAINER_PANEL_RIGHT_BOTTOM]==],
["7"] = [==[DT_UI_CONTAINER_PANEL_TOP_LEFT]==],
["8"] = [==[DT_UI_CONTAINER_PANEL_TOP_CENTER]==],
["9"] = [==[DT_UI_CONTAINER_PANEL_TOP_RIGHT]==],
["10"] = [==[DT_UI_CONTAINER_PANEL_CENTER_TOP_LEFT]==],
["11"] = [==[DT_UI_CONTAINER_PANEL_CENTER_TOP_CENTER]==],
["12"] = [==[DT_UI_CONTAINER_PANEL_CENTER_TOP_RIGHT]==],
["13"] = [==[DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_LEFT]==],
["14"] = [==[DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_CENTER]==],
["15"] = [==[DT_UI_CONTAINER_PANEL_CENTER_BOTTOM_RIGHT]==],
["16"] = [==[DT_UI_CONTAINER_PANEL_BOTTOM]==],
},
},
},
},
},
["expandable"] = {
["__text"] = [==[True if the lib can be expanded/retracted]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
["expanded"] = {
["__text"] = [==[True if the lib is expanded]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["position"] = {
["__text"] = [==[A value deciding the position of the lib within its container]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
["views"] = {
["__text"] = [==[A table of all the views that display this widget]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[table]==],
},
},
["reset"] = {
["__text"] = [==[A function to reset the lib to its default values
This function will do nothing if the lib is not visible or can't be reset]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The lib to reset]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["on_screen"] = {
["__text"] = [==[True if the lib is currently visible on the screen]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
},
},
},
["2"] = {
["__text"] = [==[The view that we are leaving]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A darktable view]==],
["__attributes"] = {
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["id"] = {
["__text"] = [==[A unique string identifying the view]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["name"] = {
["__text"] = [==[The name of the view]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
},
},
},
["3"] = {
["__text"] = [==[The view that we are entering]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["8"] = {
["__text"] = [==[A callback called when leaving a view displaying the lib]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The lib on which the callback is called]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The view that we are leaving]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["3"] = {
["__text"] = [==[The view that we are entering]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
},
},
},
["films"] = {
["__text"] = [==[A table containing all the film objects in the database.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["#"] = {
["__text"] = [==[Each film has a numeric entry in the database.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["new"] = {
["__text"] = [==[Creates a new empty film
see darktable.database.import to import a directory with all its images and to add images to a film]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created film, or the existing film if the directory is already imported]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The directory that the new film will represent. The directory must exist]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["delete"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"]]=],
},
["new_format"] = {
["__text"] = [==[Creates a new format object to export images]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created object. Exact type depends on the type passed]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The type of format object to create, one of :
* copy
* exr
* j2k
* jpeg
* pdf
* pfm
* png
* ppm
* tiff
* webp
]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["new_storage"] = {
["__text"] = [==[Creates a new storage object to export images]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created object. Exact type depends on the type passed]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The type of storage object to create, one of :
* disk
* email
* facebook
* flickr
* gallery
* latex
* picasa
(Other, lua-defined, storage types may appear.)]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["new_widget"] = {
["__text"] = [==[Creates a new widget object to display in the UI]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created object. Exact type depends on the type passed]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The type of storage object to create, one of :
* box
* button
* check_button
* combobox
* container
* entry
* file_chooser_button
* label
* separator
* slider
* stack
]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["gui"] = {
["__text"] = [==[This subtable contains function and data to manipulate the darktable user interface with Lua.
Most of these function won't do anything if the GUI is not enabled (i.e you are using the command line version darktabl-cli instead of darktable).]==],
["__attributes"] = {
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["action_images"] = {
["__text"] = [==[A table of types.dt_lua_image_t on which the user expects UI actions to happen.
It is based on both the hovered image and the selection and is consistent with the way darktable works.
It is recommended to use this table to implement Lua actions rather than darktable.gui.hovered or darktable.gui.selection to be consistent with darktable's GUI.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[table]==],
},
},
["hovered"] = {
["__text"] = [==[The image under the cursor or nil if no image is hovered.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["selection"] = {
["__text"] = [==[Allows to change the set of selected images.]==],
["__attributes"] = {
["implicit_yield"] = true,
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[A table containing the selection as it was before the function was called.]==],
["__attributes"] = {
["reported_type"] = [==[table of types.dt_lua_image_t]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[A table of images which will define the selected images. If this parameter is not given the selection will be untouched. If an empty table is given the selection will be emptied.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[table of types.dt_lua_image_t]==],
},
},
},
},
},
["current_view"] = {
["__text"] = [==[Allows to change the current view.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[the current view]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The view to switch to. If empty the current view is unchanged]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["create_job"] = {
["__text"] = [==[Create a new progress_bar displayed in darktable.gui.libs.backgroundjobs]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created job object]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A lua-managed entry in the backgroundjob lib]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["percent"] = {
["__text"] = [==[The value of the progress bar, between 0 and 1. will return nil if there is no progress bar, will raise an error if read or written on an invalid job]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["valid"] = {
["__text"] = [==[True if the job is displayed, set it to false to destroy the entry
An invalid job cannot be made valid again]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
},
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The text to display in the job entry]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[Should a progress bar be displayed]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[boolean]==],
},
},
["3"] = {
["__text"] = [==[A function called when the cancel button for that job is pressed
note that the job won't be destroyed automatically. You need to set types.dt_lua_backgroundjob_t.valid to false for that]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The extra information to display]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The job who is being cancelded]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["gui"]["create_job"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The image to analyze]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
},
},
},
["views"] = {
["__text"] = [==[The different views in darktable]==],
["__attributes"] = {
["has_pairs"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["map"] = {
["__text"] = [==[The map view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["latitude"] = {
["__text"] = [==[The latitude of the center of the map]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["longitude"] = {
["__text"] = [==[The longitude of the center of the map]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["zoom"] = {
["__text"] = [==[The current zoom level of the map]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
},
["darkroom"] = {
["__text"] = [==[The darkroom view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["lighttable"] = {
["__text"] = [==[The lighttable view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["tethering"] = {
["__text"] = [==[The tethering view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["slideshow"] = {
["__text"] = [==[The slideshow view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["print"] = {
["__text"] = [==[The print view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
},
["libs"] = {
["__text"] = [==[This table allows to reference all lib objects
lib are the graphical blocks within each view.
To quickly figure out what lib is what, you can use the following code which will make a given lib blink.
<code>local tested_module="global_toolbox"
dt.gui.libs[tested_module].visible=false
coroutine.yield("WAIT_MS",2000)
while true do
dt.gui.libs[tested_module].visible = not dt.gui.libs[tested_module].visible
coroutine.yield("WAIT_MS",2000)
end</code>]==],
["__attributes"] = {
["has_pairs"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["snapshots"] = {
["__text"] = [==[The UI element that manipulates snapshots in darkroom]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["ratio"] = {
["__text"] = [==[The place in the screen where the line separating the snapshot is. Between 0 and 1]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["direction"] = {
["__text"] = [==[The direction of the snapshot overlay]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[Which part of the main window is occupied by a snapshot]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[left]==],
["2"] = [==[right]==],
["3"] = [==[top]==],
["4"] = [==[bottom]==],
},
},
},
["write"] = true,
},
},
["#"] = {
["__text"] = [==[The different snapshots for the image]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[The description of a snapshot in the snapshot lib]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["reported_type"] = [==[dt_type]==],
},
["filename"] = {
["__text"] = [==[The filename of an image containing the snapshot]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["select"] = {
["__text"] = [==[Activates this snapshot on the display. To deactivate all snapshot you need to call this function on the active snapshot]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The snapshot to activate]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]]=],
},
},
},
},
},
["name"] = {
["__text"] = [==[The name of the snapshot, as seen in the UI]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
},
},
},
["selected"] = {
["__text"] = [==[The currently selected snapshot]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]]=],
},
},
["take_snapshot"] = {
["__text"] = [==[Take a snapshot of the current image and add it to the UI
The snapshot file will be generated at the next redraw of the main window]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
},
},
},
["max_snapshot"] = {
["__text"] = [==[The maximum number of snapshots]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
},
},
},
["collect"] = {
["__text"] = [==[The collection UI element that allows to filter images by collection]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["filter"] = {
["__text"] = [==[Allows to get or change the list of visible images]==],
["__attributes"] = {
["implicit_yield"] = true,
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The rules that were applied before this call.]==],
["__attributes"] = {
["reported_type"] = [==[array oftypes.dt_lib_collect_params_rule_t]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[A table of rules describing the filter. These rules will be applied after this call]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[array oftypes.dt_lib_collect_params_rule_t]==],
},
},
},
},
},
["new_rule"] = {
["__text"] = [==[Returns a newly created rule object]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The newly created rule]==],
["__attributes"] = {
["reported_type"] = [==[types.dt_lib_collect_params_rule_t]==],
},
},
["signature"] = {
},
},
},
},
["import"] = {
["__text"] = [==[The buttons to start importing images]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["register_widget"] = {
["__text"] = [==[Add a widget in the option expander of the import dialog]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget to add to the dialog. The reset callback of the widget will be called whenever the dialog is opened]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
},
},
},
["styles"] = {
["__text"] = [==[The style selection menu]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["metadata_view"] = {
["__text"] = [==[The widget displaying metadata about the current image]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["metadata"] = {
["__text"] = [==[The widget allowing modification of metadata fields on the current image]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["hinter"] = {
["__text"] = [==[The small line of text at the top of the UI showing the number of selected images]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["modulelist"] = {
["__text"] = [==[The window allowing to set modules as visible/hidden/favorite]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["filmstrip"] = {
["__text"] = [==[The filmstrip at the bottom of some views]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["viewswitcher"] = {
["__text"] = [==[The labels allowing to switch view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["darktable_label"] = {
["__text"] = [==[The darktable logo in the upper left corner]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["tagging"] = {
["__text"] = [==[The tag manipulation UI]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["geotagging"] = {
["__text"] = [==[The geotagging time synchronisation UI]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["recentcollect"] = {
["__text"] = [==[The recent collection UI element]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["global_toolbox"] = {
["__text"] = [==[The common tools to all view (settings, grouping...)]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["grouping"] = {
["__text"] = [==[The current status of the image grouping option]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["show_overlays"] = {
["__text"] = [==[the current status of the image overlays option]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
},
["filter"] = {
["__text"] = [==[The image-filter menus at the top of the UI]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["ratings"] = {
["__text"] = [==[The starts to set the rating of an image]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["select"] = {
["__text"] = [==[The buttons that allow to quickly change the selection]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["register_selection"] = {
["__text"] = [==[Add a new button and call a callback when it is clicked]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The label to display on the button]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The function to call when the button is pressed]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The images to set the selection to]==],
["__attributes"] = {
["reported_type"] = [==[table oftypes.dt_lua_image_t]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The name of the button that was pressed]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The images in the current collection. This is the same content asdarktable.collection]==],
["__attributes"] = {
["reported_type"] = [==[table oftypes.dt_lua_image_t]==],
},
},
},
},
},
["3"] = {
["__text"] = [==[The tooltip to use on the new button]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[string]==],
},
},
},
},
},
},
["colorlabels"] = {
["__text"] = [==[The color buttons that allow to set labels on an image]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["lighttable_mode"] = {
["__text"] = [==[The navigation and zoom level UI in lighttable]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["copy_history"] = {
["__text"] = [==[The UI element that manipulates history]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["image"] = {
["__text"] = [==[The UI element that manipulates the current images]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["register_action"] = {
["__text"] = [==[Add a new button and call a callback when it is clicked]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The label to display on the button]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The function to call when the button is pressed]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the button that was pressed]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The images to act on when the button was clicked]==],
["__attributes"] = {
["reported_type"] = [==[table oftypes.dt_lua_image_t]==],
},
},
},
},
},
["3"] = {
["__text"] = [==[The tooltip to use on the new button]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[string]==],
},
},
},
},
},
},
["modulegroups"] = {
["__text"] = [==[The icons describing the different iop groups]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["module_toolbox"] = {
["__text"] = [==[The tools on the bottom line of the UI (overexposure)]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["session"] = {
["__text"] = [==[The session UI when tethering]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["histogram"] = {
["__text"] = [==[The histogram widget]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["export"] = {
["__text"] = [==[The export menu]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["history"] = {
["__text"] = [==[The history manipulation menu]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["colorpicker"] = {
["__text"] = [==[The colorpicker menu]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["navigation"] = {
["__text"] = [==[The full image preview to allow navigation]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["masks"] = {
["__text"] = [==[The masks window]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["view_toolbox"] = {
["__text"] = [==[]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["live_view"] = {
["__text"] = [==[The liveview window]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["map_settings"] = {
["__text"] = [==[The map setting window]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["camera"] = {
["__text"] = [==[The camera selection UI]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["location"] = {
["__text"] = [==[The location ui]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["backgroundjobs"] = {
["__text"] = [==[The window displaying the currently running jobs]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
["print_settings"] = {
["__text"] = [==[The settings window in the print view]==],
["__attributes"] = {
["has_pairs"] = true,
["has_tostring"] = true,
["is_attribute"] = true,
["is_singleton"] = true,
["parent"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["read"] = true,
["reported_type"] = [==[dt_singleton]==],
},
},
},
},
["guides"] = {
["__text"] = [==[Guide lines to overlay over an image in crop and rotate.
All guides are clipped to the drawing area.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
["register_guide"] = {
["__text"] = [==[Register a new guide.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the guide to show in the GUI.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The function to call to draw the guide lines. The drawn lines will be stroked by darktable.
THIS IS RUNNING IN THE GUI THREAD AND HAS TO BE FAST!]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The cairo object used for drawing.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[A wrapper around a cairo drawing context.
You probably shouldn't use this after the callback that got it passed returned.
For more details of the member functions have a look at the cairo documentation for <ulink url="http://www.cairographics.org/manual/cairo-cairo-t.html">the drawing context</ulink>, <ulink url="http://www.cairographics.org/manual/cairo-Transformations.html">transformations</ulink> and <ulink url="http://www.cairographics.org/manual/cairo-Paths.html">paths</ulink>.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["save"] = {
["__text"] = [==[Save the state of the drawing context.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["restore"] = {
["__text"] = [==[Restore a previously saved state.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["move_to"] = {
["__text"] = [==[Begin a new sub-path.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x coordinate of the new position.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y coordinate of the new position.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["line_to"] = {
["__text"] = [==[Add a line to the path.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x coordinate of the end of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y coordinate of the end of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["rectangle"] = {
["__text"] = [==[Add a closed sub-path rectangle.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x coordinate of the top left corner of the rectangle.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y coordinate of the top left corner of the rectangle.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["4"] = {
["__text"] = [==[The width of the rectangle.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["5"] = {
["__text"] = [==[The height of the rectangle.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["arc"] = {
["__text"] = [==[Add a circular arc.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x position of the center of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y position of the center of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["4"] = {
["__text"] = [==[The radius of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["5"] = {
["__text"] = [==[The start angle, in radians.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["6"] = {
["__text"] = [==[The end angle, in radians.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["arc_negative"] = {
["__text"] = [==[Add a circular arc. It only differs in the direction from types.dt_lua_cairo_t.arc.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x position of the center of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y position of the center of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["4"] = {
["__text"] = [==[The radius of the arc.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["5"] = {
["__text"] = [==[The start angle, in radians.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["6"] = {
["__text"] = [==[The end angle, in radians.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["rotate"] = {
["__text"] = [==[Add a rotation to the transformation matrix.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The angle (in radians) by which the user-space axes will be rotated.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["scale"] = {
["__text"] = [==[Add a scaling to the transformation matrix.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The scale factor for the x dimension.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The scale factor for the y dimension.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["translate"] = {
["__text"] = [==[Add a translation to the transformation matrix.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[Amount to translate in the x direction]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[Amount to translate in the y direction]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["new_sub_path"] = {
["__text"] = [==[Begin a new sub-path.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["draw_line"] = {
["__text"] = [==[Helper function to draw a line with a given start and end.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The context to modify.]==],
["__attributes"] = {
["is_self"] = true,
["reported_type"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["2"] = {
["__text"] = [==[The x coordinate of the start of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y coordinate of the start of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["4"] = {
["__text"] = [==[The x coordinate of the end of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["5"] = {
["__text"] = [==[The y coordinate of the end of the new line.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
},
},
},
["2"] = {
["__text"] = [==[The x coordinate of the top left corner of the drawing area.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["3"] = {
["__text"] = [==[The y coordinate of the top left corner of the drawing area.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["4"] = {
["__text"] = [==[The width of the drawing area.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["5"] = {
["__text"] = [==[The height of the drawing area.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
["6"] = {
["__text"] = [==[The current zoom_scale. Only needed when setting the line thickness.]==],
["__attributes"] = {
["reported_type"] = [==[float]==],
},
},
},
},
},
["3"] = {
["__text"] = [==[A function returning a widget to show when the guide is selected. It takes no arguments.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[function]==],
},
},
},
},
},
},
["tags"] = {
["__text"] = [==[Allows access to all existing tags.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["#"] = {
["__text"] = [==[Each existing tag has a numeric entry in the tags table - use ipairs to iterate over them.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["create"] = {
["__text"] = [==[Creates a new tag and return it. If the tag exists return the existing tag.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the new tag.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["find"] = {
["__text"] = [==[Returns the tag object or nil if the tag doesn't exist.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The tag object or nil.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The name of the tag to find.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["delete"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["delete"]]=],
["attach"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"]]=],
["detach"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"]]=],
["get_tags"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["get_tags"]]=],
},
["configuration"] = {
["__text"] = [==[This table regroups values that describe details of the configuration of darktable.]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
["version"] = {
["__text"] = [==[The version number of darktable.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["has_gui"] = {
["__text"] = [==[True if darktable has a GUI (launched through the main darktable command, not darktable-cli).]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["verbose"] = {
["__text"] = [==[True if the Lua logdomain is enabled.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["tmp_dir"] = {
["__text"] = [==[The name of the directory where darktable will store temporary files.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["config_dir"] = {
["__text"] = [==[The name of the directory where darktable will find its global configuration objects (modules).]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["cache_dir"] = {
["__text"] = [==[The name of the directory where darktable will store its mipmaps.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["api_version_major"] = {
["__text"] = [==[The major version number of the lua API.]==],
["__attributes"] = {
["reported_type"] = [==[number]==],
},
},
["api_version_minor"] = {
["__text"] = [==[The minor version number of the lua API.]==],
["__attributes"] = {
["reported_type"] = [==[number]==],
},
},
["api_version_patch"] = {
["__text"] = [==[The patch version number of the lua API.]==],
["__attributes"] = {
["reported_type"] = [==[number]==],
},
},
["api_version_suffix"] = {
["__text"] = [==[The version suffix of the lua API.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["api_version_string"] = {
["__text"] = [==[The version description of the lua API. This is a string compatible with the semantic versioning convention]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["check_version"] = {
["__text"] = [==[Check that a module is compatible with the running version of darktable
Add the following line at the top of your module : <code>darktable.configuration.check(...,{M,m,p},{M2,m2,p2})</code>To document that your module has been tested with API version M.m.p and M2.m2.p2.
This will raise an error if the user is running a released version of DT and a warning if he is running a development version
(the ... here will automatically expand to your module name if used at the top of your script]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the module to report on error]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[Tables of API versions that are known to work with the script]==],
["__attributes"] = {
["reported_type"] = [==[table...]==],
},
},
},
},
},
},
["preferences"] = {
["__text"] = [==[Lua allows you to manipulate preferences. Lua has its own namespace for preferences and you can't access nor write normal darktable preferences.
Preference handling functions take a _script_ parameter. This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
Preference handling functions can't guess the type of a parameter. You must pass the type of the preference you are handling.
Note that the directory, enum and file type preferences are stored internally as string. The user can only select valid values, but a lua script can set it to any string]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
["register"] = {
["__text"] = [==[Creates a new preference entry in the Lua tab of the preference screen. If this function is not called the preference can't be set by the user (you can still read and write invisible preferences).]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[Invisible prefix to guarantee unicity of preferences.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[A unique name used with the script part to identify the preference.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The type of the preference - one of the string values described above.]==],
["__attributes"] = {
["reported_type"] = {
["__text"] = [==[The type of value to save in a preference]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[string]==],
["2"] = [==[bool]==],
["3"] = [==[integer]==],
["4"] = [==[float]==],
["5"] = [==[file]==],
["6"] = [==[directory]==],
["7"] = [==[enum]==],
},
},
},
},
},
["4"] = {
["__text"] = [==[The label displayed in the preference screen.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["5"] = {
["__text"] = [==[The tooltip to display in the preference menu.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["6"] = {
["__text"] = [==[Default value to use when not set explicitly or by the user.
For the enum type of pref, this is mandatory]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[depends on type]==],
},
},
["7"] = {
["__text"] = [==[Minimum value (integer and float preferences only).]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[int or float]==],
},
},
["8"] = {
["__text"] = [==[Maximum value (integer and float preferences only).]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[int or float]==],
},
},
["9"] = {
["__text"] = [==[Step of the spinner (float preferences only).]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[float]==],
},
},
["10"] = {
["__text"] = [==[Other allowed values (enum preferences only)]==],
["__attributes"] = {
["reported_type"] = [==[string...]==],
},
},
},
},
},
["read"] = {
["__text"] = [==[Reads a value from a Lua preference.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The value of the preference.]==],
["__attributes"] = {
["reported_type"] = [==[depends on type]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[Invisible prefix to guarantee unicity of preferences.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The name of the preference displayed in the preference screen.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The type of the preference.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]]=],
},
},
},
},
},
["write"] = {
["__text"] = [==[Writes a value to a Lua preference.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[Invisible prefix to guarantee unicity of preferences.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The name of the preference displayed in the preference screen.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The type of the preference.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]]=],
},
},
["4"] = {
["__text"] = [==[The value to set the preference to.]==],
["__attributes"] = {
["reported_type"] = [==[depends on type]==],
},
},
},
},
},
},
["styles"] = {
["__text"] = [==[This pseudo table allows you to access and manipulate styles.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["#"] = {
["__text"] = [==[Each existing style has a numeric index; you can iterate them using ipairs.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
},
},
["create"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"]]=],
["delete"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["delete"]]=],
["duplicate"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["duplicate"]]=],
["apply"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"]]=],
["import"] = {
["__text"] = [==[Import a style from an external .dtstyle file]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The file to import]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["export"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["export"]]=],
},
["database"] = {
["__text"] = [==[Allows to access the database of images. Note that duplicate images (images with the same RAW but different XMP) will appear multiple times with different duplicate indexes. Also note that all images are here. This table is not influenced by any GUI filtering (collections, stars etc...).]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["#"] = {
["__text"] = [==[Each image in the database appears with a numerical index; you can interate them using ipairs.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["duplicate"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["duplicate"]]=],
["import"] = {
["__text"] = [==[Imports new images into the database.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The created image if an image is imported or the toplevel film object if a film was imported.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The filename or directory to import images from.
NOTE: If the images are set to be imported recursively in preferences only the toplevel film is returned (the one whose path was given as a parameter).
NOTE2: If the parameter is a directory the call is non-blocking; the film object will not have the newly imported images yet. Use a post-import-film filtering on that film to react when images are actually imported.
]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["move_image"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"]]=],
["copy_image"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"]]=],
["delete"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"]]=],
},
["collection"] = {
["__text"] = [==[Allows to access the currently worked on images, i.e the ones selected by the collection lib. Filtering (rating etc) does not change that collection.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["#"] = {
["__text"] = [==[Each image in the collection appears with a numerical index; you can interate them using ipairs.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
["control"] = {
["__text"] = [==[This table contain function to manipulate the control flow of lua programs. It provides ways to do background jobs and other related functions]==],
["__attributes"] = {
["has_pairs"] = true,
["is_singleton"] = true,
["reported_type"] = [==[dt_singleton]==],
},
["ending"] = {
["__text"] = [==[TRUE when darktable is terminating
Use this variable to detect when you should finish long running jobs]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
},
},
["dispatch"] = {
["__text"] = [==[Runs a function in the background. This function will be run at a later point, after luarc has finished running. If you do a loop in such a function, please check darktable.control.ending in your loop to finish the function when DT exits]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The call to dispatch]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
},
},
["2"] = {
["__text"] = [==[extra parameters to pass to the function]==],
["__attributes"] = {
["reported_type"] = [==[anything]==],
},
},
},
},
},
},
["gettext"] = {
["__text"] = [==[This table contains functions related to translating lua scripts]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
["gettext"] = {
["__text"] = [==[Translate a string using the darktable textdomain]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The translated string]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The string to translate]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["dgettext"] = {
["__text"] = [==[Translate a string using the specified textdomain]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The translated string]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The domain to use for that translation]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The string to translate]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["ngettext"] = {
["__text"] = [==[Translate a string depending on the number of objects using the darktable textdomain]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The translated string]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The string to translate]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The string to translate in plural form]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The number of objetc]==],
["__attributes"] = {
["reported_type"] = [==[int]==],
},
},
},
},
},
["dngettext"] = {
["__text"] = [==[Translate a string depending on the number of objects using the specified textdomain]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[The translated string]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The domain to use for that translation]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The string to translate]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[The string to translate in plural form]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["4"] = {
["__text"] = [==[The number of objetc]==],
["__attributes"] = {
["reported_type"] = [==[int]==],
},
},
},
},
},
["bindtextdomain"] = {
["__text"] = [==[Tell gettext where to find the .mo file translating messages for a particular domain]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The domain to use for that translation]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The base directory to look for the file. The file should be placed in <em>dirname</em>/<em>locale name</em>/LC_MESSAGES/<em>domain</em>.mo]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
},
["debug"] = {
["__text"] = [==[This section must be activated separately by calling
require "darktable.debug"
]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
["dump"] = {
["__text"] = [==[This will return a string describing everything Lua knows about an object, used to know what an object is.
This function is recursion-safe and can be used to dump _G if needed.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[A string containing a text description of the object - can be very long.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The object to dump.]==],
["__attributes"] = {
["reported_type"] = [==[anything]==],
},
},
["2"] = {
["__text"] = [==[A name to use for the object.]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[string]==],
},
},
["3"] = {
["__text"] = [==[A table of object,string pairs. Any object in that table will not be dumped, the string will be printed instead.
defaults to darktable.debug.known if not set]==],
["__attributes"] = {
["optional"] = true,
["reported_type"] = [==[table]==],
},
},
},
},
},
["debug"] = {
["__text"] = [==[Initialized to false; set it to true to also dump information about metatables.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
["max_depth"] = {
["__text"] = [==[Initialized to 10; The maximum depth to recursively dump content.]==],
["__attributes"] = {
["reported_type"] = [==[number]==],
},
},
["known"] = {
["__text"] = [==[A table containing the default value of darktable.debug.dump.known]==],
["__attributes"] = {
["reported_type"] = [==[table]==],
},
},
["type"] = {
["__text"] = [==[Similar to the system function type() but it will return the real type instead of "userdata" for darktable specific objects.]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[A string describing the type of the object.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The object whos type must be reported.]==],
["__attributes"] = {
["reported_type"] = [==[anything]==],
},
},
},
},
},
},
},
["types"] = {
["__text"] = [==[This section documents types that are specific to darktable's Lua API.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["dt_lua_image_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["dt_imageio_module_format_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["dt_imageio_module_format_data_png"] = {
["__text"] = [==[Type object describing parameters to export to png.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["bpp"] = {
["__text"] = [==[The bpp parameter to use when exporting.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
},
["dt_imageio_module_format_data_tiff"] = {
["__text"] = [==[Type object describing parameters to export to tiff.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["bpp"] = {
["__text"] = [==[The bpp parameter to use when exporting.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
},
["dt_imageio_module_format_data_exr"] = {
["__text"] = [==[Type object describing parameters to export to exr.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["compression"] = {
["__text"] = [==[The compression parameter to use when exporting.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["dt_imageio_module_format_data_copy"] = {
["__text"] = [==[Type object describing parameters to export to copy.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_format_data_pfm"] = {
["__text"] = [==[Type object describing parameters to export to pfm.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_format_data_jpeg"] = {
["__text"] = [==[Type object describing parameters to export to jpeg.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["quality"] = {
["__text"] = [==[The quality to use at export time.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
},
["dt_imageio_module_format_data_ppm"] = {
["__text"] = [==[Type object describing parameters to export to ppm.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_format_data_webp"] = {
["__text"] = [==[Type object describing parameters to export to webp.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["quality"] = {
["__text"] = [==[The quality to use at export time.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["comp_type"] = {
["__text"] = [==[The overall quality to use; can be one of "webp_lossy" or "webp_lossless".]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[Type of compression for webp]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[webp_lossy]==],
["2"] = [==[webp_lossless]==],
},
},
},
["write"] = true,
},
},
["hint"] = {
["__text"] = [==[A hint on the overall content of the image.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[a hint on the way to encode a webp image]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[hint_default]==],
["2"] = [==[hint_picture]==],
["3"] = [==[hint_photo]==],
["4"] = [==[hint_graphic]==],
},
},
},
["write"] = true,
},
},
},
["dt_imageio_module_format_data_j2k"] = {
["__text"] = [==[Type object describing parameters to export to jpeg2000.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["quality"] = {
["__text"] = [==[The quality to use at export time.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["bpp"] = {
["__text"] = [==[The bpp parameter to use when exporting.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["format"] = {
["__text"] = [==[The format to use.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[J2K format type]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[j2k]==],
["2"] = [==[jp2]==],
},
},
},
["write"] = true,
},
},
["preset"] = {
["__text"] = [==[The preset to use.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[J2K preset type]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[off]==],
["2"] = [==[cinema2k_24]==],
["3"] = [==[cinema2k_48]==],
["4"] = [==[cinema4k_24]==],
},
},
},
["write"] = true,
},
},
},
["dt_imageio_module_format_data_pdf"] = {
["__text"] = [==[Type object describing parameters to export to pdf.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["dpi"] = {
["__text"] = [==[The dot per inch value to use at export]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["icc"] = {
["__text"] = [==[Should the images be tagged with their embedded profile]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["border"] = {
["__text"] = [==[Empty space around the PDF images]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["orientation"] = {
["__text"] = [==[Orientation of the pages in the document]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["title"] = {
["__text"] = [==[The title for the document
types.dt_imageio_module_format_data_pdf.rotate:set_text([[Should the images be rotated to match the PDF orientation]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["mode"] = {
["__text"] = [==[The image mode to use at export time]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["size"] = {
["__text"] = [==[The paper size to use]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["compression"] = {
["__text"] = [==[Compression mode to use for images]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["pages"] = {
["__text"] = [==[The page type to use]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["rotate"] = {
["__text"] = [==[Should the images be rotated in the resulting PDF]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
},
["_pdf_mode_t"] = {
["__text"] = [==[The export mode to use for PDF document]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[normal]==],
["2"] = [==[draft]==],
["3"] = [==[debug]==],
},
},
},
["_pdf_pages_t"] = {
["__text"] = [==[The different page types for PDF export]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[all]==],
["2"] = [==[single]==],
["3"] = [==[contact]==],
},
},
},
["dt_pdf_stream_encoder_t"] = {
["__text"] = [==[The compression mode for PDF document]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[uncompressed]==],
["2"] = [==[deflate]==],
},
},
},
["dt_imageio_module_storage_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["dt_imageio_module_storage_data_email"] = {
["__text"] = [==[An object containing parameters to export to email.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_storage_data_flickr"] = {
["__text"] = [==[An object containing parameters to export to flickr.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_storage_data_facebook"] = {
["__text"] = [==[An object containing parameters to export to facebook.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_storage_data_latex"] = {
["__text"] = [==[An object containing parameters to export to latex.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["filename"] = {
["__text"] = [==[The filename to export to.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["title"] = {
["__text"] = [==[The title to use for export.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["dt_imageio_module_storage_data_picasa"] = {
["__text"] = [==[An object containing parameters to export to picasa.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
},
["dt_imageio_module_storage_data_gallery"] = {
["__text"] = [==[An object containing parameters to export to gallery.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["filename"] = {
["__text"] = [==[The filename to export to.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["title"] = {
["__text"] = [==[The title to use for export.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["dt_imageio_module_storage_data_disk"] = {
["__text"] = [==[An object containing parameters to export to disk.]==],
["__attributes"] = {
["has_pairs"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["filename"] = {
["__text"] = [==[The filename to export to.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["dt_lua_film_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["dt_style_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]]=],
["dt_style_item_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["#"].__attributes["reported_type"]]=],
["dt_lua_tag_t"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["dt_lua_lib_t"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["dt_lua_view_t"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
["dt_lua_backgroundjob_t"] = {} --[=[API["darktable"]["gui"]["create_job"].__attributes["ret_val"].__attributes["reported_type"]]=],
["dt_lua_snapshot_t"] = {} --[=[API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]]=],
["hint_t"] = {} --[=[API["types"]["dt_imageio_module_format_data_webp"]["hint"].__attributes["reported_type"]]=],
["dt_ui_container_t"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]["container"].__attributes["reported_type"]]=],
["snapshot_direction_t"] = {} --[=[API["darktable"]["gui"]["libs"]["snapshots"]["direction"].__attributes["reported_type"]]=],
["dt_imageio_j2k_format_t"] = {} --[=[API["types"]["dt_imageio_module_format_data_j2k"]["format"].__attributes["reported_type"]]=],
["dt_imageio_j2k_preset_t"] = {} --[=[API["types"]["dt_imageio_module_format_data_j2k"]["preset"].__attributes["reported_type"]]=],
["yield_type"] = {
["__text"] = [==[What type of event to wait for]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[WAIT_MS]==],
["2"] = [==[FILE_READABLE]==],
["3"] = [==[RUN_COMMAND]==],
},
},
},
["comp_type_t"] = {} --[=[API["types"]["dt_imageio_module_format_data_webp"]["comp_type"].__attributes["reported_type"]]=],
["lua_pref_type"] = {} --[=[API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]]=],
["dt_imageio_exr_compression_t"] = {
["__text"] = [==[The type of compression to use for the EXR image]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[off]==],
["2"] = [==[rle]==],
["3"] = [==[zips]==],
["4"] = [==[zip]==],
["5"] = [==[piz]==],
["6"] = [==[pxr24]==],
["7"] = [==[b44]==],
["8"] = [==[b44a]==],
},
},
},
["dt_lib_collect_params_rule_t"] = {
["__text"] = [==[A single rule for filtering a collection]==],
["__attributes"] = {
["has_pairs"] = true,
["reported_type"] = [==[dt_type]==],
},
["mode"] = {
["__text"] = [==[How this rule is applied after the previous one. Unused for the first rule]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[The logical operators to apply between rules]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[DT_LIB_COLLECT_MODE_AND]==],
["2"] = [==[DT_LIB_COLLECT_MODE_OR]==],
["3"] = [==[DT_LIB_COLLECT_MODE_AND_NOT]==],
},
},
},
["write"] = true,
},
},
["data"] = {
["__text"] = [==[The text segment of the rule. Exact content depends on the type of rule]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["item"] = {
["__text"] = [==[The item on which this rule filter. i.e the type of the rule]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {
["__text"] = [==[The different elements on which a collection can be filtered]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[DT_COLLECTION_PROP_FILMROLL]==],
["2"] = [==[DT_COLLECTION_PROP_FOLDERS]==],
["3"] = [==[DT_COLLECTION_PROP_CAMERA]==],
["4"] = [==[DT_COLLECTION_PROP_TAG]==],
["5"] = [==[DT_COLLECTION_PROP_DAY]==],
["6"] = [==[DT_COLLECTION_PROP_TIME]==],
["7"] = [==[DT_COLLECTION_PROP_HISTORY]==],
["8"] = [==[DT_COLLECTION_PROP_COLORLABEL]==],
["9"] = [==[DT_COLLECTION_PROP_TITLE]==],
["10"] = [==[DT_COLLECTION_PROP_DESCRIPTION]==],
["11"] = [==[DT_COLLECTION_PROP_CREATOR]==],
["12"] = [==[DT_COLLECTION_PROP_PUBLISHER]==],
["13"] = [==[DT_COLLECTION_PROP_RIGHTS]==],
["14"] = [==[DT_COLLECTION_PROP_LENS]==],
["15"] = [==[DT_COLLECTION_PROP_FOCAL_LENGTH]==],
["16"] = [==[DT_COLLECTION_PROP_ISO]==],
["17"] = [==[DT_COLLECTION_PROP_APERTURE]==],
["18"] = [==[DT_COLLECTION_PROP_FILENAME]==],
["19"] = [==[DT_COLLECTION_PROP_GEOTAGGING]==],
},
},
},
["write"] = true,
},
},
},
["dt_lib_collect_mode_t"] = {} --[=[API["types"]["dt_lib_collect_params_rule_t"]["mode"].__attributes["reported_type"]]=],
["dt_collection_properties_t"] = {} --[=[API["types"]["dt_lib_collect_params_rule_t"]["item"].__attributes["reported_type"]]=],
["dt_lua_orientation_t"] = {
["__text"] = [==[A possible orientation for a widget]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[horizontal]==],
["2"] = [==[vertical]==],
},
},
},
["dt_lua_align_t"] = {
["__text"] = [==[The alignment of a label]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[fill]==],
["2"] = [==[start]==],
["3"] = [==[end]==],
["4"] = [==[center]==],
["5"] = [==[baseline]==],
},
},
},
["dt_lua_ellipsize_mode_t"] = {
["__text"] = [==[The ellipsize mode of a label]==],
["__attributes"] = {
["reported_type"] = [==[enum]==],
["values"] = {
["1"] = [==[none]==],
["2"] = [==[start]==],
["3"] = [==[middle]==],
["4"] = [==[end]==],
},
},
},
["dt_lua_cairo_t"] = {} --[=[API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
["lua_widget"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["lua_container"] = {
["__text"] = [==[A widget containing other widgets]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["#"] = {
["__text"] = [==[The widgets contained by the box
You can append widgets by adding them at the end of the list
You can remove widgets by setting them to nil]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["lua_check_button"] = {
["__text"] = [==[A checkable button with a label next to it]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["label"] = {
["__text"] = [==[The label displayed next to the button]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["value"] = {
["__text"] = [==[If the widget is checked or not]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["clicked_callback"] = {
["__text"] = [==[A function to call on button click]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget that triggered the callback]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["write"] = true,
},
},
},
["lua_label"] = {
["__text"] = [==[A label containing some text]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["label"] = {
["__text"] = [==[The label displayed]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["selectable"] = {
["__text"] = [==[True if the label content should be selectable]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["halign"] = {
["__text"] = [==[The horizontal alignment of the label]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["types"]["dt_lua_align_t"]]=],
["write"] = true,
},
},
["ellipsize"] = {
["__text"] = [==[The ellipsize mode of the label]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["types"]["dt_lua_ellipsize_mode_t"]]=],
["write"] = true,
},
},
},
["lua_button"] = {
["__text"] = [==[A clickable button]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["label"] = {
["__text"] = [==[The label displayed on the button]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["clicked_callback"] = {
["__text"] = [==[A function to call on button click]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget that triggered the callback]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["write"] = true,
},
},
},
["lua_box"] = {
["__text"] = [==[A container for widget in a horizontal or vertical list]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["types"]["lua_container"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["orientation"] = {
["__text"] = [==[The orientation of the box.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = {} --[=[API["types"]["dt_lua_orientation_t"]]=],
["write"] = true,
},
},
},
["lua_entry"] = {
["__text"] = [==[A widget in which the user can input text]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["text"] = {
["__text"] = [==[The content of the entry]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["placeholder"] = {
["__text"] = [==[The text to display when the entry is empty]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["is_password"] = {
["__text"] = [==[True if the text content should be hidden]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["editable"] = {
["__text"] = [==[False if the entry should be read-only]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
},
["lua_separator"] = {
["__text"] = [==[A widget providing a separation in the UI.]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["orientation"] = {
["__text"] = [==[The orientation of the separator.]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["lua_combobox"] = {
["__text"] = [==[A widget with multiple text entries in a menu
This widget can be set as editable at construction time.
If it is editable the user can type a value and is not constrained by the values in the menu]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["value"] = {
["__text"] = [==[The text content of the selected entry, can be nil
You can set it to a number to select the corresponding entry from the menu
If the combo box is editable, you can set it to any string
You can set it to nil to deselect all entries]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["#"] = {
["__text"] = [==[The various menu entries.
You can add new entries by writing to the first element beyond the end
You can removes entries by setting them to nil]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
},
},
["changed_callback"] = {
["__text"] = [==[A function to call when the value field changes (character entered or value selected)]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget that triggered the callback]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["write"] = true,
},
},
["editable"] = {
["__text"] = [==[True is the user is allowed to type a string in the combobox]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
["label"] = {
["__text"] = [==[The label displayed on the combobox]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
["lua_file_chooser_button"] = {
["__text"] = [==[A button that allows the user to select an existing file]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["title"] = {
["__text"] = [==[The title of the window when choosing a file]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["value"] = {
["__text"] = [==[The currently selected file]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
["changed_callback"] = {
["__text"] = [==[A function to call when the value field changes (character entered or value selected)]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The widget that triggered the callback]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
},
},
},
["write"] = true,
},
},
["is_directory"] = {
["__text"] = [==[True if the file chooser button only allows directories to be selecte]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[boolean]==],
["write"] = true,
},
},
},
["lua_stack"] = {
["__text"] = [==[A container that will only show one of its child at a time]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_length"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["types"]["lua_container"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["active"] = {
["__text"] = [==[The currently selected child, can be nil if the container has no child, can be set to one of the child widget or to an index in the child table]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[types.lua_widget or nil]==],
["write"] = true,
},
},
},
["lua_slider"] = {
["__text"] = [==[A slider that can be set by the user]==],
["__attributes"] = {
["has_ipairs"] = true,
["has_pairs"] = true,
["has_tostring"] = true,
["parent"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]]=],
["reported_type"] = [==[dt_type]==],
},
["__call"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]]=],
["soft_min"] = {
["__text"] = [==[The soft minimum value for the slider, the slider can't go beyond this point]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["soft_max"] = {
["__text"] = [==[The soft maximum value for the slider, the slider can't go beyond this point]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["hard_min"] = {
["__text"] = [==[The hard minimum value for the slider, the user can't manually enter a value beyond this point]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["hard_max"] = {
["__text"] = [==[The hard maximum value for the slider, the user can't manually enter a value beyond this point]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["value"] = {
["__text"] = [==[The current value of the slider]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[number]==],
["write"] = true,
},
},
["label"] = {
["__text"] = [==[The label next to the slider]==],
["__attributes"] = {
["is_attribute"] = true,
["read"] = true,
["reported_type"] = [==[string]==],
["write"] = true,
},
},
},
},
["events"] = {
["__text"] = [==[This section documents events that can be used to trigger Lua callbacks.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["intermediate-export-image"] = {
["__text"] = [==[This event is called each time an image is exported, once for each image after the image has been processed to an image format but before the storage has moved the image to its final destination.]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The image object that has been exported.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["3"] = {
["__text"] = [==[The name of the file that is the result of the image being processed.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["4"] = {
["__text"] = [==[The format used to export the image.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["5"] = {
["__text"] = [==[The storage used to export the image (can be nil).]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]]=],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["post-import-image"] = {
["__text"] = [==[This event is triggered whenever a new image is imported into the database.
This event can be registered multiple times, all callbacks will be called.]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The image object that has been exported.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["shortcut"] = {
["__text"] = [==[This event registers a new keyboard shortcut. The shortcut isn't bound to any key until the users does so in the preference panel.
The event is triggered whenever the shortcut is triggered.
This event can only be registered once per value of shortcut.
]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The tooltip string that was given at registration time.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
["signature"] = {
["1"] = {
["__text"] = [==[The string that will be displayed on the shortcut preference panel describing the shortcut.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
},
},
},
},
["post-import-film"] = {
["__text"] = [==[This event is triggered when an film import is finished (all post-import-image callbacks have already been triggered). This event can be registered multiple times.
]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The new film that has been added. If multiple films were added recursively only the top level film is reported.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["view-changed"] = {
["__text"] = [==[This event is triggered after the user changed the active view]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The view that we just left]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
["3"] = {
["__text"] = [==[The view we are now in]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["global_toolbox-grouping_toggle"] = {
["__text"] = [==[This event is triggered after the user toggled the grouping button.]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[the new grouping status.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["global_toolbox-overlay_toggle"] = {
["__text"] = [==[This event is triggered after the user toggled the overlay button.]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[the new overlay status.]==],
["__attributes"] = {
["reported_type"] = [==[boolean]==],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["mouse-over-image-changed"] = {
["__text"] = [==[This event is triggered whenever the image under the mouse changes]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The new image under the mous, can be nil if there is no image under the mouse]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]]=],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["exit"] = {
["__text"] = [==[This event is triggered when darktable exits, it allows lua scripts to do cleanup jobs]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["pre-import"] = {
["__text"] = [==[This event is trigger before any import action]==],
["__attributes"] = {
["reported_type"] = [==[event]==],
},
["callback"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["signature"] = {
["1"] = {
["__text"] = [==[The name of the event that triggered the callback.]==],
["__attributes"] = {
["reported_type"] = [==[string]==],
},
},
["2"] = {
["__text"] = [==[The files that will be imported. Modifying this table will change the list of files that will be imported"]==],
["__attributes"] = {
["reported_type"] = [==[table of string]==],
},
},
},
},
},
["extra_registration_parameters"] = {
["__text"] = [==[This event has no extra registration parameters.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
},
["attributes"] = {
["__text"] = [==[This section documents various attributes used throughout the documentation.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["write"] = {
["__text"] = [==[This object is a variable that can be written to.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
["has_tostring"] = {
["__text"] = [==[This object has a specific reimplementation of the "tostring" method that allows pretty-printing it.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
["implicit_yield"] = {
["__text"] = [==[This call will release the Lua lock while executing, thus allowing other Lua callbacks to run.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
["parent"] = {
["__text"] = [==[This object inherits some methods from another object. You can call the methods from the parent on the child object]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
},
},
["system"] = {
["__text"] = [==[This section documents changes to system functions.]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["coroutine"] = {
["__text"] = [==[]==],
["__attributes"] = {
["reported_type"] = [==[documentation node]==],
},
["yield"] = {
["__text"] = [==[Lua functions can yield at any point. The parameters and return types depend on why we want to yield.
A callback that is yielding allows other Lua code to run.
* WAIT_MS: one extra parameter; the execution will pause for that many milliseconds; yield returns nothing;
* FILE_READABLE: an opened file from a call to the OS library; will return when the file is readable; returns nothing;
* RUN_COMMAND: a command to be run by "sh -c"; will return when the command terminates; returns the return code of the execution.
]==],
["__attributes"] = {
["reported_type"] = [==[function]==],
["ret_val"] = {
["__text"] = [==[Nothing for "WAIT_MS" and "FILE_READABLE"; the returned code of the command for "RUN_COMMAND".]==],
["__attributes"] = {
["reported_type"] = [==[variable]==],
},
},
["signature"] = {
["1"] = {
["__text"] = [==[The type of yield.]==],
["__attributes"] = {
["reported_type"] = {} --[=[API["types"]["yield_type"]]=],
},
},
["2"] = {
["__text"] = [==[An extra parameter: integer for "WAIT_MS", open file for "FILE_READABLE", string for "RUN_COMMAND".]==],
["__attributes"] = {
["reported_type"] = [==[variable]==],
},
},
},
},
},
},
},
}
API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_lib"].__attributes["signature"]["8"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_lib"].__attributes["signature"]["8"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["current_view"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["current_view"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["map"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["darkroom"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["lighttable"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["tethering"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["slideshow"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["views"]["print"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_lua_view_t"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["view-changed"]["callback"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["view-changed"]["callback"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["5"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["6"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["new_format"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_png"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_tiff"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_exr"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_copy"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_pfm"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_jpeg"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_ppm"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_webp"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_j2k"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_imageio_module_format_data_pdf"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["intermediate-export-image"]["callback"].__attributes["signature"]["4"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["tags"]["get_tags"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["get_tags"]
API["darktable"]["database"]["duplicate"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["duplicate"]
API["darktable"]["tags"]["delete"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["delete"]
API["system"]["coroutine"]["yield"].__attributes["signature"]["1"].__attributes["reported_type"] = API["types"]["yield_type"]
API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]["select"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["snapshots"]["selected"].__attributes["reported_type"] = API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]
API["types"]["dt_lua_snapshot_t"] = API["darktable"]["gui"]["libs"]["snapshots"]["#"].__attributes["reported_type"]
API["darktable"]["gui"]["create_job"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["gui"]["create_job"].__attributes["ret_val"].__attributes["reported_type"]
API["types"]["dt_lua_backgroundjob_t"] = API["darktable"]["gui"]["create_job"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["film"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["films"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["films"]["new"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_lua_film_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["post-import-film"]["callback"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["preferences"]["read"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]
API["darktable"]["preferences"]["write"].__attributes["signature"]["3"].__attributes["reported_type"] = API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]
API["types"]["lua_pref_type"] = API["darktable"]["preferences"]["register"].__attributes["signature"]["3"].__attributes["reported_type"]
API["types"]["lua_label"]["ellipsize"].__attributes["reported_type"] = API["types"]["dt_lua_ellipsize_mode_t"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["save"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["restore"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["move_to"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["line_to"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["rectangle"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["arc"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["arc_negative"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["rotate"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["scale"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["translate"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["new_sub_path"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]["draw_line"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_lua_cairo_t"] = API["darktable"]["guides"]["register_guide"].__attributes["signature"]["2"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["lua_box"].__attributes["parent"] = API["types"]["lua_container"]
API["types"]["lua_stack"].__attributes["parent"] = API["types"]["lua_container"]
API["types"]["lua_label"]["halign"].__attributes["reported_type"] = API["types"]["dt_lua_align_t"]
API["types"]["lua_box"]["orientation"].__attributes["reported_type"] = API["types"]["dt_lua_orientation_t"]
API["types"]["dt_collection_properties_t"] = API["types"]["dt_lib_collect_params_rule_t"]["item"].__attributes["reported_type"]
API["types"]["dt_lib_collect_mode_t"] = API["types"]["dt_lib_collect_params_rule_t"]["mode"].__attributes["reported_type"]
API["types"]["lua_container"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_check_button"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_label"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_button"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_box"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_entry"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_separator"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_combobox"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_file_chooser_button"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_stack"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["lua_slider"]["__call"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"]
API["types"]["dt_imageio_j2k_preset_t"] = API["types"]["dt_imageio_module_format_data_j2k"]["preset"].__attributes["reported_type"]
API["types"]["dt_imageio_j2k_format_t"] = API["types"]["dt_imageio_module_format_data_j2k"]["format"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["attach"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"]
API["darktable"]["tags"]["attach"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"]
API["darktable"]["styles"]["delete"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["delete"]
API["types"]["comp_type_t"] = API["types"]["dt_imageio_module_format_data_webp"]["comp_type"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["delete"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["duplicate"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["duplicate"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["export"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["styles"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["types"]["dt_style_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["copy"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"]
API["darktable"]["database"]["copy_image"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"]
API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["reset_callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]["__call"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["darktable"]["register_lib"].__attributes["signature"]["6"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["darktable"]["new_widget"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["import"]["register_widget"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_widget"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_container"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_container"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_check_button"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_check_button"]["clicked_callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_label"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_button"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_button"]["clicked_callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_entry"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_separator"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_combobox"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_combobox"]["changed_callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_file_chooser_button"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_file_chooser_button"]["changed_callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["types"]["lua_slider"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["7"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["4"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["5"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["6"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["new_storage"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_email"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_flickr"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_facebook"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_latex"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_picasa"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_gallery"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_imageio_module_storage_data_disk"].__attributes["parent"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["events"]["intermediate-export-image"]["callback"].__attributes["signature"]["5"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]["reset"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_lib"].__attributes["signature"]["8"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["snapshots"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["collect"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["import"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["styles"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["metadata_view"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["metadata"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["hinter"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["modulelist"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["filmstrip"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["viewswitcher"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["darktable_label"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["tagging"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["geotagging"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["recentcollect"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["global_toolbox"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["filter"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["ratings"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["select"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["colorlabels"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["lighttable_mode"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["copy_history"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["image"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["modulegroups"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["module_toolbox"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["session"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["histogram"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["export"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["history"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["colorpicker"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["navigation"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["masks"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["view_toolbox"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["live_view"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["map_settings"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["camera"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["location"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["backgroundjobs"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["gui"]["libs"]["print_settings"].__attributes["parent"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_lua_lib_t"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["styles"]["export"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["export"]
API["types"]["hint_t"] = API["types"]["dt_imageio_module_format_data_webp"]["hint"].__attributes["reported_type"]
API["darktable"]["database"]["delete"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"]
API["darktable"]["films"]["delete"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["blue"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["green"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["yellow"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["purple"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["red"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["delete"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["tags"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]
API["darktable"]["tags"]["find"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_lua_tag_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]
API["types"]["dt_style_item_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["#"].__attributes["reported_type"]
API["types"]["dt_ui_container_t"] = API["darktable"]["register_lib"].__attributes["signature"]["7"].__attributes["signature"]["1"].__attributes["reported_type"]["container"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["detach_tag"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"]
API["darktable"]["tags"]["detach"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["apply_style"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"]
API["darktable"]["styles"]["apply"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"]
API["darktable"]["styles"]["duplicate"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["duplicate"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["detach"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["1"].__attributes["reported_type"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["attach_tag"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["get_tags"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["ret_val"].__attributes["reported_type"]["apply"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["duplicate"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["duplicate"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["copy_image"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["reset"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["delete"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["group_with"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["group_with"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["make_group_leader"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["get_group_members"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["group_leader"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["drop_cache"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["hovered"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["gui"]["create_job"].__attributes["signature"]["3"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["database"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["database"]["import"].__attributes["ret_val"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["collection"]["#"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["types"]["dt_lua_image_t"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["intermediate-export-image"]["callback"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["post-import-image"]["callback"].__attributes["signature"]["2"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["events"]["mouse-over-image-changed"]["callback"].__attributes["signature"]["1"].__attributes["reported_type"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]
API["darktable"]["styles"]["create"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["create_style"]
API["types"]["snapshot_direction_t"] = API["darktable"]["gui"]["libs"]["snapshots"]["direction"].__attributes["reported_type"]
API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"].__attributes["signature"]["2"].__attributes["reported_type"]["move_image"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"]
API["darktable"]["database"]["move_image"] = API["darktable"]["register_storage"].__attributes["signature"]["3"].__attributes["signature"]["1"].__attributes["reported_type"]["supports_format"].__attributes["signature"]["2"].__attributes["reported_type"]["write_image"].__attributes["signature"]["2"].__attributes["reported_type"]["move"]
return API
--
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
| gpl-3.0 |
m241dan/darkstar | scripts/zones/Western_Adoulin/npcs/Porter_Moogle.lua | 41 | 1534 | -----------------------------------
-- Area: Western Adoulin
-- NPC: Porter Moogle
-- Type: Storage Moogle
-- @zone 256
-- @pos TODO
-----------------------------------
package.loaded["scripts/zones/Western_Adoulin/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Western_Adoulin/TextIDs");
require("scripts/globals/porter_moogle_util");
local e =
{
TALK_EVENT_ID = 41,
STORE_EVENT_ID = 42,
RETRIEVE_EVENT_ID = 43,
ALREADY_STORED_ID = 44,
MAGIAN_TRIAL_ID = 45
};
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
porterMoogleTrade(player, trade, e);
end
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- No idea what the params are, other than event ID and gil.
player:startEvent(e.TALK_EVENT_ID, 0x6FFFFF, 0x01, 0x06DD, 0x27, 0x7C7E, 0x15, player:getGil(), 0x03E8);
end
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
porterEventUpdate(player, csid, option, e.RETRIEVE_EVENT_ID, RETRIEVE_DIALOG_ID, ITEM_CANNOT_BE_OBTAINED);
end
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
porterEventFinish(player, csid, option, e.TALK_EVENT_ID, ITEM_CANNOT_BE_OBTAINED, ITEM_OBTAINED, NOT_HAVE_ENOUGH_GIL);
end | gpl-3.0 |
RAHOOMY96ALIRAQI/BOT_MR_KOHI | plugins/stats.lua | 15 | 4017 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(receiver, chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document(receiver,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'devpoint' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /devpoint ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' or msg.to.type == 'channel' then
local receiver = get_receiver(msg)
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(receiver, chat_id)
else
return
end
end
if matches[2] == "devpoint" then -- Put everything you like :)
if not is_admin1(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin1(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[#!/]([Ss]tats)$",
"^[#!/]([Ss]tatslist)$",
"^[#!/]([Ss]tats) (group) (%d+)",
"^[#!/]([Ss]tats) (devpoint)",
"^[#!/]([Dd]evpoint)"
},
run = run
}
end
| gpl-2.0 |
santssoft/darkstar | scripts/globals/weaponskills/exenterator.lua | 10 | 2156 | -----------------------------------
-- Exenterator
-- Skill level: 357
-- Terpsichore: Aftermath effect varies with TP.
-- In order to obtain Exenterator, the quest Martial Mastery must be completed.
-- Description: Delivers a fourfold attack that lowers enemy's params.accuracy. Effect duration varies with TP.
-- Aligned with the Breeze Gorget, Thunder Gorget & Soil Gorget.
-- Aligned with the Breeze Belt, Thunder Belt & Soil Belt.
-- Notes: Stacks with itself allowing continuous params.acc down
-- params.acc down isn't the same as the spell Blind or sources which are the same as blind allowing both to stack
-- Element: None
-- Modifiers: AGI:73~85%, depending on merit points upgrades.
-- 100%TP 200%TP 300%TP
-- 1.0 1.0 1.0
-----------------------------------
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/weaponskills")
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {}
params.numHits = 4
params.ftp100 = 1.0 params.ftp200 = 1.0 params.ftp300 = 1.0
params.str_wsc = 0.0 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.85 + (player:getMerit(dsp.merit.EXENTERATOR) / 100) params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0
params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0
params.canCrit = false
params.acc100 = 0.0 params.acc200= 0.0 params.acc300= 0.0
params.atk100 = 1.0; params.atk200 = 1.0; params.atk300 = 1.0;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.agi_wsc = 0.7 + (player:getMerit(dsp.merit.EXENTERATOR) / 100)
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar)
if (damage > 0 and target:hasStatusEffect(dsp.effect.ACCURACY_DOWN) == false) then
local duration = (45 + (tp/1000 * 45)) * applyResistanceAddEffect(player,target,dsp.magic.ele.EARTH,0)
target:addStatusEffect(dsp.effect.ACCURACY_DOWN, 20, 0,duration)
end
return tpHits, extraHits, criticalHit, damage
end
| gpl-3.0 |
Armyluix/darkstar | scripts/globals/items/slice_of_karakul_meat.lua | 18 | 1290 | -----------------------------------------
-- ID: 5571
-- Item: Slice of Karakul Meat
-- Effect: 5 Minutes, food effect, Galka Only
-----------------------------------------
-- Strength +2
-- Intelligence -4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:getRace() ~= 8) then
result = 247;
end
if (target:getMod(MOD_EAT_RAW_MEAT) == 1) then
result = 0;
end
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,5571);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 2);
target:addMod(MOD_INT, -4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 2);
target:delMod(MOD_INT, -4);
end; | gpl-3.0 |
abriasffxi/darkstar | scripts/zones/The_Eldieme_Necropolis/npcs/_5fq.lua | 14 | 2654 | -----------------------------------
-- Area: The Eldieme Necropolis
-- NPC: West Plate
-- @pos 150 -32 14 195
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local state0 = 8;
local state1 = 9;
local DoorOffset = npc:getID() - 25; -- _5f1
if (npc:getAnimation() == 8) then
state0 = 9;
state1 = 8;
end
-- Gates
-- Shiva's Gate
GetNPCByID(DoorOffset):setAnimation(state0);
GetNPCByID(DoorOffset+1):setAnimation(state0);
GetNPCByID(DoorOffset+2):setAnimation(state0);
GetNPCByID(DoorOffset+3):setAnimation(state0);
GetNPCByID(DoorOffset+4):setAnimation(state0);
-- Odin's Gate
GetNPCByID(DoorOffset+5):setAnimation(state1);
GetNPCByID(DoorOffset+6):setAnimation(state1);
GetNPCByID(DoorOffset+7):setAnimation(state1);
GetNPCByID(DoorOffset+8):setAnimation(state1);
GetNPCByID(DoorOffset+9):setAnimation(state1);
-- Leviathan's Gate
GetNPCByID(DoorOffset+10):setAnimation(state0);
GetNPCByID(DoorOffset+11):setAnimation(state0);
GetNPCByID(DoorOffset+12):setAnimation(state0);
GetNPCByID(DoorOffset+13):setAnimation(state0);
GetNPCByID(DoorOffset+14):setAnimation(state0);
-- Titan's Gate
GetNPCByID(DoorOffset+15):setAnimation(state1);
GetNPCByID(DoorOffset+16):setAnimation(state1);
GetNPCByID(DoorOffset+17):setAnimation(state1);
GetNPCByID(DoorOffset+18):setAnimation(state1);
GetNPCByID(DoorOffset+19):setAnimation(state1);
-- Plates
-- East Plate
GetNPCByID(DoorOffset+20):setAnimation(state0);
GetNPCByID(DoorOffset+21):setAnimation(state0);
-- North Plate
GetNPCByID(DoorOffset+22):setAnimation(state0);
GetNPCByID(DoorOffset+23):setAnimation(state0);
-- West Plate
GetNPCByID(DoorOffset+24):setAnimation(state0);
GetNPCByID(DoorOffset+25):setAnimation(state0);
-- South Plate
GetNPCByID(DoorOffset+26):setAnimation(state0);
GetNPCByID(DoorOffset+27):setAnimation(state0);
return 0;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
rdlaitila/LURE | src/__legacy__/lib/loveframes/objects/multichoice.lua | 13 | 11033 | --[[------------------------------------------------
-- Love Frames - A GUI library for LOVE --
-- Copyright (c) 2012-2014 Kenny Shields --
--]]------------------------------------------------
-- get the current require path
local path = string.sub(..., 1, string.len(...) - string.len(".objects.multichoice"))
local loveframes = require(path .. ".libraries.common")
-- multichoice object
local newobject = loveframes.NewObject("multichoice", "loveframes_object_multichoice", true)
--[[---------------------------------------------------------
- func: initialize()
- desc: initializes the object
--]]---------------------------------------------------------
function newobject:initialize()
self.type = "multichoice"
self.choice = ""
self.text = "Select an option"
self.width = 200
self.height = 25
self.listpadding = 0
self.listspacing = 0
self.buttonscrollamount = 200
self.mousewheelscrollamount = 1500
self.sortfunc = function(a, b) return a < b end
self.haslist = false
self.dtscrolling = true
self.enabled = true
self.internal = false
self.choices = {}
self.listheight = nil
end
--[[---------------------------------------------------------
- func: update(deltatime)
- desc: updates the object
--]]---------------------------------------------------------
function newobject:update(dt)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
local alwaysupdate = self.alwaysupdate
if not visible then
if not alwaysupdate then
return
end
end
local parent = self.parent
local base = loveframes.base
local update = self.Update
self:CheckHover()
-- move to parent if there is a parent
if parent ~= base then
self.x = self.parent.x + self.staticx
self.y = self.parent.y + self.staticy
end
if update then
update(self, dt)
end
end
--[[---------------------------------------------------------
- func: draw()
- desc: draws the object
--]]---------------------------------------------------------
function newobject:draw()
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
if not visible then
return
end
local skins = loveframes.skins.available
local skinindex = loveframes.config["ACTIVESKIN"]
local defaultskin = loveframes.config["DEFAULTSKIN"]
local selfskin = self.skin
local skin = skins[selfskin] or skins[skinindex]
local drawfunc = skin.DrawMultiChoice or skins[defaultskin].DrawMultiChoice
local draw = self.Draw
local drawcount = loveframes.drawcount
-- set the object's draw order
self:SetDrawOrder()
if draw then
draw(self)
else
drawfunc(self)
end
end
--[[---------------------------------------------------------
- func: mousepressed(x, y, button)
- desc: called when the player presses a mouse button
--]]---------------------------------------------------------
function newobject:mousepressed(x, y, button)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
if not visible then
return
end
local hover = self.hover
local haslist = self.haslist
local enabled = self.enabled
if hover and not haslist and enabled and button == "l" then
local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then
baseparent:MakeTop()
end
self.haslist = true
self.list = loveframes.objects["multichoicelist"]:new(self)
self.list:SetState(self.state)
loveframes.downobject = self
end
end
--[[---------------------------------------------------------
- func: mousereleased(x, y, button)
- desc: called when the player releases a mouse button
--]]---------------------------------------------------------
function newobject:mousereleased(x, y, button)
local state = loveframes.state
local selfstate = self.state
if state ~= selfstate then
return
end
local visible = self.visible
if not visible then
return
end
end
--[[---------------------------------------------------------
- func: AddChoice(choice)
- desc: adds a choice to the current list of choices
--]]---------------------------------------------------------
function newobject:AddChoice(choice)
local choices = self.choices
table.insert(choices, choice)
return self
end
--[[---------------------------------------------------------
- func: RemoveChoice(choice)
- desc: removes the specified choice from the object's
list of choices
--]]---------------------------------------------------------
function newobject:RemoveChoice(choice)
local choices = self.choices
for k, v in ipairs(choices) do
if v == choice then
table.remove(choices, k)
break
end
end
return self
end
--[[---------------------------------------------------------
- func: SetChoice(choice)
- desc: sets the current choice
--]]---------------------------------------------------------
function newobject:SetChoice(choice)
self.choice = choice
return self
end
--[[---------------------------------------------------------
- func: SelectChoice(choice)
- desc: selects a choice
--]]---------------------------------------------------------
function newobject:SelectChoice(choice)
local onchoiceselected = self.OnChoiceSelected
self.choice = choice
if self.list then
self.list:Close()
end
if onchoiceselected then
onchoiceselected(self, choice)
end
return self
end
--[[---------------------------------------------------------
- func: SetListHeight(height)
- desc: sets the height of the list of choices
--]]---------------------------------------------------------
function newobject:SetListHeight(height)
self.listheight = height
return self
end
--[[---------------------------------------------------------
- func: SetPadding(padding)
- desc: sets the padding of the list of choices
--]]---------------------------------------------------------
function newobject:SetPadding(padding)
self.listpadding = padding
return self
end
--[[---------------------------------------------------------
- func: SetSpacing(spacing)
- desc: sets the spacing of the list of choices
--]]---------------------------------------------------------
function newobject:SetSpacing(spacing)
self.listspacing = spacing
return self
end
--[[---------------------------------------------------------
- func: GetValue()
- desc: gets the value (choice) of the object
--]]---------------------------------------------------------
function newobject:GetValue()
return self.choice
end
--[[---------------------------------------------------------
- func: GetChoice()
- desc: gets the current choice (same as get value)
--]]---------------------------------------------------------
function newobject:GetChoice()
return self.choice
end
--[[---------------------------------------------------------
- func: SetText(text)
- desc: sets the object's text
--]]---------------------------------------------------------
function newobject:SetText(text)
self.text = text
return self
end
--[[---------------------------------------------------------
- func: GetText()
- desc: gets the object's text
--]]---------------------------------------------------------
function newobject:GetText()
return self.text
end
--[[---------------------------------------------------------
- func: SetButtonScrollAmount(speed)
- desc: sets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:SetButtonScrollAmount(amount)
self.buttonscrollamount = amount
return self
end
--[[---------------------------------------------------------
- func: GetButtonScrollAmount()
- desc: gets the scroll amount of the object's scrollbar
buttons
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.buttonscrollamount
end
--[[---------------------------------------------------------
- func: SetMouseWheelScrollAmount(amount)
- desc: sets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:SetMouseWheelScrollAmount(amount)
self.mousewheelscrollamount = amount
return self
end
--[[---------------------------------------------------------
- func: GetMouseWheelScrollAmount()
- desc: gets the scroll amount of the mouse wheel
--]]---------------------------------------------------------
function newobject:GetButtonScrollAmount()
return self.mousewheelscrollamount
end
--[[---------------------------------------------------------
- func: SetDTScrolling(bool)
- desc: sets whether or not the object should use delta
time when scrolling
--]]---------------------------------------------------------
function newobject:SetDTScrolling(bool)
self.dtscrolling = bool
return self
end
--[[---------------------------------------------------------
- func: GetDTScrolling()
- desc: gets whether or not the object should use delta
time when scrolling
--]]---------------------------------------------------------
function newobject:GetDTScrolling()
return self.dtscrolling
end
--[[---------------------------------------------------------
- func: Sort(func)
- desc: sorts the object's choices
--]]---------------------------------------------------------
function newobject:Sort(func)
local default = self.sortfunc
if func then
table.sort(self.choices, func)
else
table.sort(self.choices, default)
end
return self
end
--[[---------------------------------------------------------
- func: SetSortFunction(func)
- desc: sets the object's default sort function
--]]---------------------------------------------------------
function newobject:SetSortFunction(func)
self.sortfunc = func
return self
end
--[[---------------------------------------------------------
- func: GetSortFunction(func)
- desc: gets the object's default sort function
--]]---------------------------------------------------------
function newobject:GetSortFunction()
return self.sortfunc
end
--[[---------------------------------------------------------
- func: Clear()
- desc: removes all choices from the object's list
of choices
--]]---------------------------------------------------------
function newobject:Clear()
self.choices = {}
self.choice = ""
self.text = "Select an option"
return self
end
--[[---------------------------------------------------------
- func: SetClickable(bool)
- desc: sets whether or not the object is enabled
--]]---------------------------------------------------------
function newobject:SetEnabled(bool)
self.enabled = bool
return self
end
--[[---------------------------------------------------------
- func: GetEnabled()
- desc: gets whether or not the object is enabled
--]]---------------------------------------------------------
function newobject:GetEnabled()
return self.enabled
end
| mit |
Armyluix/darkstar | scripts/globals/spells/mages_ballad_ii.lua | 31 | 1186 | -----------------------------------------
-- Spell: Mage's Ballad II
-- Gradually restores target's MP.
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local power = 2;
local iBoost = caster:getMod(MOD_BALLAD_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
power = power + iBoost;
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
caster:delStatusEffect(EFFECT_MARCATO);
local duration = 120;
duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
if not (target:addBardSong(caster,EFFECT_BALLAD,power,0,duration,caster:getID(), 0, 2)) then
spell:setMsg(75);
end
return EFFECT_BALLAD;
end;
| gpl-3.0 |
abriasffxi/darkstar | scripts/zones/Castle_Zvahl_Baileys/npcs/Treasure_Coffer.lua | 13 | 4974 | -----------------------------------
-- Area: Castle Zvahl Baileys
-- NPC: Treasure Coffer
-- @zone 161
-- @pos -75 0 19
-----------------------------------
package.loaded["scripts/zones/Castle_Zvahl_Baileys/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/treasure");
require("scripts/globals/quests");
require("scripts/zones/Castle_Zvahl_Baileys/TextIDs");
local TreasureType = "Coffer";
local TreasureLvL = 53;
local TreasureMinLvL = 43;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- trade:hasItemQty(1048,1); -- Treasure Key
-- trade:hasItemQty(1115,1); -- Skeleton Key
-- trade:hasItemQty(1023,1); -- Living Key
-- trade:hasItemQty(1022,1); -- Thief's Tools
local questItemNeeded = 0;
-- Player traded a key.
if ((trade:hasItemQty(1048,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then
-- IMPORTANT ITEM: AF Keyitems, AF Items, & Map -----------
local mJob = player:getMainJob();
local zone = player:getZoneID();
local AFHandsActivated = player:getVar("BorghertzAlreadyActiveWithJob");
local listAF = getAFbyZone(zone);
if (AFHandsActivated == 10 and player:hasKeyItem(OLD_GAUNTLETS) == false) then
questItemNeeded = 1;
else
for nb = 1,#listAF,3 do
if (player:getQuestStatus(JEUNO,listAF[nb + 1]) ~= QUEST_AVAILABLE and mJob == listAF[nb] and player:hasItem(listAF[nb + 2]) == false) then
questItemNeeded = 2;
break
end
end
end
--------------------------------------
local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded);
local success = 0;
if (pack[2] ~= nil) then
player:messageSpecial(pack[2]);
success = pack[1];
else
success = pack[1];
end
if (success ~= -2) then
player:tradeComplete();
if (math.random() <= success) then -- 0 or 1
-- Succeded to open the coffer
player:messageSpecial(CHEST_UNLOCKED);
if (questItemNeeded == 1) then
player:addKeyItem(OLD_GAUNTLETS);
player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI)
elseif (questItemNeeded == 2) then
for nb = 1,#listAF,3 do
if (mJob == listAF[nb]) then
player:addItem(listAF[nb + 2]);
player:messageSpecial(ITEM_OBTAINED,listAF[nb + 2]);
break
end
end
elseif (player:getVar("UnderOathCS") == 3) then -- Under Oath - PLD AF3
player:addKeyItem(MIQUES_PAINTBRUSH);
player:messageSpecial(KEYITEM_OBTAINED,MIQUES_PAINTBRUSH);
else
player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME));
local loot = cofferLoot(zone,npc);
-- print("loot array: "); -- debug
-- print("[1]", loot[1]); -- debug
-- print("[2]", loot[2]); -- debug
if (loot[1]=="gil") then
player:addGil(loot[2]*GIL_RATE);
player:messageSpecial(GIL_OBTAINED,loot[2]*GIL_RATE);
else
-- Item
player:addItem(loot[2]);
player:messageSpecial(ITEM_OBTAINED,loot[2]);
end
end
UpdateTreasureSpawnPoint(npc:getID());
else
player:messageSpecial(CHEST_MIMIC);
spawnMimic(zone,npc,player);
UpdateTreasureSpawnPoint(npc:getID(), true);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(CHEST_LOCKED,1048);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
abriasffxi/darkstar | scripts/zones/Qufim_Island/npcs/Nightflowers.lua | 14 | 1556 | -----------------------------------
-- Area: Qufim Island
-- NPC: Nightflowers
-- Involved in Quest: Save My Son (Beastmaster Flag #1)
-- @pos -264.775 -3.718 28.767 126
-----------------------------------
package.loaded["scripts/zones/Qufim_Island/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/zones/Qufim_Island/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local currentTime = VanadielHour();
if (currentTime >= 22 or currentTime <= 4) then
if (player:getQuestStatus(JEUNO,SAVE_MY_SON) == QUEST_ACCEPTED and player:getVar("SaveMySon_Event") == 0) then
player:startEvent(0x0000);
else
player:messageSpecial(NOW_THAT_NIGHT_HAS_FALLEN);
end
else
player:messageSpecial(THESE_WITHERED_FLOWERS);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x0000) then
player:setVar("SaveMySon_Event",1);
end
end; | gpl-3.0 |
jebenexer/kong | spec/03-plugins/14-cors/01-access_spec.lua | 3 | 13130 | local helpers = require "spec.helpers"
local cjson = require "cjson"
describe("Plugin: cors (access)", function()
local client
setup(function()
helpers.run_migrations()
local api1 = assert(helpers.dao.apis:insert {
name = "api-1",
hosts = { "cors1.com" },
upstream_url = helpers.mock_upstream_url,
})
local api2 = assert(helpers.dao.apis:insert {
name = "api-2",
hosts = { "cors2.com" },
upstream_url = helpers.mock_upstream_url,
})
local api3 = assert(helpers.dao.apis:insert {
name = "api-3",
hosts = { "cors3.com" },
upstream_url = helpers.mock_upstream_url,
})
local api4 = assert(helpers.dao.apis:insert {
name = "api-4",
hosts = { "cors4.com" },
upstream_url = helpers.mock_upstream_url,
})
local api5 = assert(helpers.dao.apis:insert {
name = "api-5",
hosts = { "cors5.com" },
upstream_url = helpers.mock_upstream_url,
})
local api6 = assert(helpers.dao.apis:insert {
name = "api-6",
hosts = { "cors6.com" },
upstream_url = helpers.mock_upstream_url,
})
local api7 = assert(helpers.dao.apis:insert {
name = "api-7",
hosts = { "cors7.com" },
upstream_url = helpers.mock_upstream_url,
})
local api8 = assert(helpers.dao.apis:insert {
name = "api-8",
hosts = { "cors-empty-origins.com" },
upstream_url = helpers.mock_upstream_url,
})
local api9 = assert(helpers.dao.apis:insert {
name = "api-9",
hosts = { "cors9.com" },
upstream_url = helpers.mock_upstream_url,
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api1.id
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api2.id,
config = {
origins = {"example.com"},
methods = {"GET"},
headers = {"origin", "type", "accepts"},
exposed_headers = {"x-auth-token"},
max_age = 23,
credentials = true
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api3.id,
config = {
origins = {"example.com"},
methods = {"GET"},
headers = {"origin", "type", "accepts"},
exposed_headers = {"x-auth-token"},
max_age = 23,
preflight_continue = true
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api4.id
})
assert(helpers.dao.plugins:insert {
name = "key-auth",
api_id = api4.id
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api5.id,
config = {
origins = { "*" },
credentials = true
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api6.id,
config = {
origins = {"example.com", "example.org"},
methods = {"GET"},
headers = {"origin", "type", "accepts"},
exposed_headers = {"x-auth-token"},
max_age = 23,
preflight_continue = true
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api7.id,
config = {
origins = { "*" },
credentials = false
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api8.id,
config = {
origins = {},
}
})
assert(helpers.dao.plugins:insert {
name = "cors",
api_id = api9.id,
config = {
origins = { [[.*\.?example(?:-foo)?.com]] },
}
})
assert(helpers.start_kong({
nginx_conf = "spec/fixtures/custom_nginx.template",
}))
client = helpers.proxy_client()
end)
teardown(function()
if client then client:close() end
helpers.stop_kong()
end)
describe("HTTP method: OPTIONS", function()
it("gives appropriate defaults", function()
local res = assert(client:send {
method = "OPTIONS",
headers = {
["Host"] = "cors1.com"
}
})
assert.res_status(204, res)
assert.equal("GET,HEAD,PUT,PATCH,POST,DELETE", res.headers["Access-Control-Allow-Methods"])
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("gives * wildcard when origins is empty", function()
-- this test covers a regression introduced in 0.10.1, where
-- the 'multiple_origins' migration would always insert a table
-- (that might be empty) in the 'config.origins' field, and the
-- * wildcard would only been sent when said table was **nil**,
-- and not necessarily empty.
local res = assert(client:send {
method = "OPTIONS",
headers = {
["Host"] = "cors-empty-origins.com",
}
})
assert.res_status(204, res)
assert.equal("GET,HEAD,PUT,PATCH,POST,DELETE", res.headers["Access-Control-Allow-Methods"])
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("gives appropriate defaults when origin is explicitly set to *", function()
local res = assert(client:send {
method = "OPTIONS",
headers = {
["Host"] = "cors5.com"
}
})
assert.res_status(204, res)
assert.equal("GET,HEAD,PUT,PATCH,POST,DELETE", res.headers["Access-Control-Allow-Methods"])
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("accepts config options", function()
local res = assert(client:send {
method = "OPTIONS",
headers = {
["Host"] = "cors2.com"
}
})
assert.res_status(204, res)
assert.equal("GET", res.headers["Access-Control-Allow-Methods"])
assert.equal("example.com", res.headers["Access-Control-Allow-Origin"])
assert.equal("23", res.headers["Access-Control-Max-Age"])
assert.equal("true", res.headers["Access-Control-Allow-Credentials"])
assert.equal("origin,type,accepts", res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
end)
it("preflight_continue enabled", function()
local res = assert(client:send {
method = "OPTIONS",
path = "/status/201",
headers = {
["Host"] = "cors3.com"
}
})
local body = assert.res_status(201, res)
local json = cjson.decode(body)
assert.equal(201, json.code)
end)
it("replies with request-headers if present in request", function()
local res = assert(client:send {
method = "OPTIONS",
headers = {
["Host"] = "cors5.com",
["Access-Control-Request-Headers"] = "origin,accepts",
}
})
assert.res_status(204, res)
assert.equal("origin,accepts", res.headers["Access-Control-Allow-Headers"])
end)
end)
describe("HTTP method: others", function()
it("gives appropriate defaults", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors1.com"
}
})
assert.res_status(200, res)
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Methods"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("accepts config options", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors2.com"
}
})
assert.res_status(200, res)
assert.equal("example.com", res.headers["Access-Control-Allow-Origin"])
assert.equal("x-auth-token", res.headers["Access-Control-Expose-Headers"])
assert.equal("true", res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Allow-Methods"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("works with 404 responses", function()
local res = assert(client:send {
method = "GET",
path = "/asdasdasd",
headers = {
["Host"] = "cors1.com"
}
})
assert.res_status(404, res)
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Methods"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("works with 40x responses returned by another plugin", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors4.com"
}
})
assert.res_status(401, res)
assert.equal("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Methods"])
assert.is_nil(res.headers["Access-Control-Allow-Headers"])
assert.is_nil(res.headers["Access-Control-Expose-Headers"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
assert.is_nil(res.headers["Access-Control-Max-Age"])
end)
it("sets CORS orgin based on origin host", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors6.com",
["Origin"] = "http://www.example.com"
}
})
assert.res_status(200, res)
assert.equal("http://www.example.com", res.headers["Access-Control-Allow-Origin"])
local domains = {
["example.com"] = true,
["www.example.com"] = true,
["example-foo.com"] = true,
["www.example-foo.com"] = true,
["www.example-fo0.com"] = false,
}
for domain, v in pairs(domains) do
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors9.com",
["Origin"] = domain
}
})
assert.res_status(200, res)
assert.equal(domains[domain] and domain or nil,
res.headers["Access-Control-Allow-Origin"])
end
end)
it("does not sets CORS orgin if origin host is not in origin_domains list", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors6.com",
["Origin"] = "http://www.example.net"
}
})
assert.res_status(200, res)
assert.is_nil(res.headers["Access-Control-Allow-Origin"])
end)
it("responds with the requested Origin when config.credentials=true", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors5.com",
["Origin"] = "http://www.example.net"
}
})
assert.res_status(200, res)
assert.equals("http://www.example.net", res.headers["Access-Control-Allow-Origin"])
assert.equals("true", res.headers["Access-Control-Allow-Credentials"])
end)
it("responds with the requested Origin (including port) when config.credentials=true", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors5.com",
["Origin"] = "http://www.example.net:3000"
}
})
assert.res_status(200, res)
assert.equals("http://www.example.net:3000", res.headers["Access-Control-Allow-Origin"])
assert.equals("true", res.headers["Access-Control-Allow-Credentials"])
end)
it("responds with * when config.credentials=false", function()
local res = assert(client:send {
method = "GET",
headers = {
["Host"] = "cors7.com",
["Origin"] = "http://www.example.net"
}
})
assert.res_status(200, res)
assert.equals("*", res.headers["Access-Control-Allow-Origin"])
assert.is_nil(res.headers["Access-Control-Allow-Credentials"])
end)
end)
end)
| apache-2.0 |
Armyluix/darkstar | scripts/zones/Upper_Jeuno/npcs/Deadly_Minnow.lua | 17 | 1710 | -----------------------------------
-- Area: Upper Jeuno
-- NPC: Deadly Minnow
-- Standard Merchant NPC
-- Involved in Quest: Borghertz's Hands (1st quest only)
-- @zone 244
-- @pos -5 1 48
-----------------------------------
package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/zones/Upper_Jeuno/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getVar("BorghertzHandsFirstTime") == 1) then
player:startEvent(0x0018);
player:setVar("BorghertzHandsFirstTime",2);
else
player:showText(npc,DEADLYMINNOW_SHOP_DIALOG);
stock = {0x309A,13179, --Studded Bandana
0x3089,22800, --Silver Mask
0x308A,47025, --Banded Helm
0x311A,20976, --Studded Vest
0x3109,35200, --Silver Mail
0x310A,66792, --Banded Mail
0x319A,11012, --Studded Gloves
0x3189,18800, --Silver Mittens
0x3180,23846, --Gauntlets
0x318A,35673} --Mufflers
showShop(player, STATIC, stock);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
abriasffxi/darkstar | scripts/globals/mobskills/Haymaker.lua | 33 | 1189 | ---------------------------------------------
-- Haymaker
--
-- Description: Punches the daylights out of all targets in front. Additional effect: Amnesia
-- Type: Physical
-- Utsusemi/Blink absorb: Unknown
-- Range: Front cone
-- Notes: Only used by Gurfurlur the Menacing.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if(mob:getFamily() == 316) then
local mobSkin = mob:getModelId();
if (mobSkin == 1867) then
return 0;
else
return 1;
end
end
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local numhits = 1;
local accmod = 1;
local dmgmod = 2;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_H2H,info.hitslanded);
local typeEffect = EFFECT_AMNESIA;
MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 1, 0, 60);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
abriasffxi/darkstar | scripts/globals/spells/bluemagic/venom_shell.lua | 26 | 1389 | -----------------------------------------
-- Spell: Venom Shell
-- Poisons enemies within range and gradually reduces their HP
-- Spell cost: 86 MP
-- Monster Type: Aquans
-- Spell Type: Magical (Water)
-- Blue Magic Points: 3
-- Stat Bonus: MND+2
-- Level: 42
-- Casting Time: 3 seconds
-- Recast Time: 45 seconds
-- Magic Bursts on: Reverberation, Distortion, and Darkness
-- Combos: Clear Mind
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local typeEffect = EFFECT_POISON
local dINT = caster:getStat(MOD_MND) - target:getStat(MOD_MND);
local resist = applyResistanceEffect(caster,spell,target,dINT,BLUE_SKILL,0,typeEffect);
local duration = 180 * resist;
local power = 6;
if (resist > 0.5) then -- Do it!
if (target:addStatusEffect(typeEffect,power,0,duration)) then
spell:setMsg(236);
else
spell:setMsg(75);
end
else
spell:setMsg(85);
end;
return typeEffect;
end;
| gpl-3.0 |
Armyluix/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Mearuru.lua | 38 | 1044 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Mearuru
-- Type: Standard NPC
-- @zone: 94
-- @pos 153.798 -1 153.712
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x01a2);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
JKGDevs/JediKnightGalaxies | JKGalaxies/glua/maps/jkg_nightfall/npcs.lua | 2 | 2855 | --[[ ------------------------------------------------
Jedi Knight Galaxies Lua Code
JKG Mos Eisley Arena: npcs
Written by Futuza
--------------------------------------------------]]
-- Here we'll spawn all the npcs that belong to the map
local npctable = {
-- The vendors @ blue base
{
NPCType = "vendor_equipment",
NPCScript = "equipment_merchant",
Origin = Vector(314, 212, 320),
Angles = Vector(0, -90, 0)
},
{
NPCType = "vendor_medic",
NPCScript = "medic_merchant",
Origin = Vector(312, 123, 145),
Angles = Vector(0, -180, 0)
},
-- the vendors @ red base
{
NPCType = "vendor_equipment",
NPCScript = "equipment_merchant",
Origin = Vector(1506, 5303, 112),
Angles = Vector(0, -90, 0)
},
{
NPCType = "vendor_medic",
NPCScript = "medic_merchant",
Origin = Vector(1542, 5099, 112),
Angles = Vector(0, 180, 0)
},
-- neutral vendors
--red side, next to bed and barrels
{
NPCType = "vendor_general",
NPCScript = "general_merchant",
Origin = Vector(961 , 3055, -70),
Angles = Vector(0, 90, 0)
},
--blue side, wine cellar
{
NPCType = "vendor_general",
NPCScript = "general_merchant",
Origin = Vector(-5 , 1360, 0),
Angles = Vector(0, 180, 0)
},
--blue side, outside wolf path
{
NPCType = "vendor_grenades",
NPCScript = "grenade_merchant",
Origin = Vector(-2180 , 1985, 115),
Angles = Vector(0, -90, 0)
},
--red side, outside stairs
{
NPCType = "vendor_grenades",
NPCScript = "grenade_merchant",
Origin = Vector(-1080 , 3010, -70),
Angles = Vector(0, -110, 0)
},
--hidden vendor by ice
{
NPCType = "vendor_ammo",
NPCScript = "ammo_merchant",
Origin = Vector(240 , 3741, -99),
Angles = Vector(0, -90, 0)
},
}
local function InitNPCs()
-- First, delete all spawners we already made
local k,v
local entlist = ents.GetByName("arena_npcs")
for k,v in pairs(entlist) do
v:Free()
end
-- Spawn our npcs
local entfact = ents.CreateEntityFactory("NPC_spawner")
-- Fill in the shared data
entfact:SetSpawnVar("targetname", "arena_npcs")
entfact:SetSpawnVar("count", "-1")
for k,v in pairs(npctable) do
entfact:SetSpawnVar("NPC_type", v.NPCType)
entfact:SetSpawnVar("origin", string.format("%i %i %i", v.Origin.x, v.Origin.y, v.Origin.z))
entfact:SetSpawnVar("angles", string.format("%i %i %i", v.Angles.x, v.Angles.y, v.Angles.z))
entfact:SetSpawnVar("npcscript", v.NPCScript)
ent = entfact:Create()
if not ent or ent:IsValid() == false then
print("ERROR: Failed to spawn arena NPC")
end
-- Spawn the npc
ent:Use(nil, nil)
end
end
hook.Add("MapLoaded", "NightfallNPCInit", InitNPCs)
| gpl-2.0 |
abriasffxi/darkstar | scripts/globals/items/dark_bass.lua | 18 | 1328 | -----------------------------------------
-- ID: 4428
-- Item: dark_bass
-- Food Effect: 5Min, Mithra only
-----------------------------------------
-- Dexterity 2
-- Mind -4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:getRace() ~= 7) then
result = 247;
end
if (target:getMod(MOD_EAT_RAW_FISH) == 1) then
result = 0;
end
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,4428);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 2);
target:addMod(MOD_MND, -4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 2);
target:delMod(MOD_MND, -4);
end;
| gpl-3.0 |
rdlaitila/LURE | src/__legacy__/dom/__legacy__/objects/lure_dom_HTMLCssRuleStyle.lua | 1 | 3887 | lure.dom.HTMLCssRuleStyleobj = {}
-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function lure.dom.HTMLCssRuleStyleobj.new(pAttachNode)
local self = {}
--===================================================================
-- OBJECT METATABLE =
--===================================================================
local self_mt = {}
---------------------------------------------------------------------
self_mt.__tostring = function(t)
return "[object]:CssRuleStyleObject"
end
---------------------------------------------------------------------
self_mt.__index = function(t,k)
if rawget(t, k) ~= nil then
return rawget(t, k)
else
return lure.dom.HTMLCssRuleStyleobj.getProperty(self, k)
end
end
---------------------------------------------------------------------
self_mt.__newindex = function(t,k,v)
if rawget(t, k) ~= nil then
rawset(t, k, b)
else
return lure.dom.HTMLCssRuleStyleobj.setProperty(self,k,v)
end
end
---------------------------------------------------------------------
--===================================================================
-- PROPERTIES =
--===================================================================
self.parent = pAttachNode
---------------------------------------------------------------------
self.specificity = {0, 0, 0, 0}
---------------------------------------------------------------------
self.styleRefStore = {}
--====================================================================
-- METHODS =
--====================================================================
self.getCssText = function()
local cssText = ""
for a=1, table.getn(self.styleRefStore) do
cssText = cssText .. self.styleRefStore[a].cssDef.name .. ":" .. self.styleRefStore[a].value .. ";"
end
return cssText
end
setmetatable(self, self_mt)
return self
end
-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function lure.dom.HTMLCssRuleStyleobj.getProperty(pObjRef, pPropertyName)
local self = pObjRef
local isValidPropertyName = false
local cssDef = nil
for k1 in ipairs(lure.dom.cssDefs) do
if pPropertyName == lure.dom.cssDefs[k1].cssToStyle then
cssDef = lure.dom.cssDefs[k1]
isValidPropertyName = true
end
end
if isValidPropertyName then
for a=1, table.getn(self.styleRefStore) do
if self.styleRefStore[a].key == pPropertyName then
return self.styleRefStore[a].value
end
end
else
lure.throw(1, "Cannot get unsupported CSS key '".. pPropertyName .."'")
end
end
-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function lure.dom.HTMLCssRuleStyleobj.setProperty(pObjRef, pPropertyName, pPropertyValue)
local self = pObjRef
local isValidPropertyName = false
local isValidPropertyValue = false
local cssDef = nil
for k1 in ipairs(lure.dom.cssDefs) do
if pPropertyName == lure.dom.cssDefs[k1].cssToStyle then
cssDef = lure.dom.cssDefs[k1]
isValidPropertyName = true
end
end
if isValidPropertyName == true then
if cssDef.validateValue(pPropertyValue) == true then
isValidPropertyValue = true
newStyleRef = table.insert(self.styleRefStore,
{
key = lure.trim(pPropertyName),
value = lure.trim(pPropertyValue),
cssDef = cssDef
})
else
lure.throw(1, "CSS Definition value '".. pPropertyName .. ":" .. pPropertyValue ..";' is malformed or unsupported. Declaration will be dropped")
end
else
lure.throw(1, "Unsupported CSS key '"..pPropertyName.."' Declaration will be dropped.")
end
end
-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | mit |
Armyluix/darkstar | scripts/zones/Lower_Jeuno/npcs/Gurdern.lua | 34 | 1374 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Gurdern
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Lower_Jeuno/TextIDs");
require("scripts/globals/quests");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local WildcatJeuno = player:getVar("WildcatJeuno");
if (player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_ACCEPTED and player:getMaskBit(WildcatJeuno,14) == false) then
player:startEvent(10052);
else
player:startEvent(0x0070);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 10052) then
player:setMaskBit(player:getVar("WildcatJeuno"),"WildcatJeuno",14,true);
end
end;
| gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.