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 |
|---|---|---|---|---|---|
The-HalcyonDays/darkstar | scripts/zones/Western_Altepa_Desert/Zone.lua | 27 | 4592 | -----------------------------------
--
-- Zone: Western_Altepa_Desert (125)
--
-----------------------------------
package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil;
package.loaded["scripts/globals/chocobo_digging"] = nil;
-----------------------------------
require("scripts/zones/Western_Altepa_Desert/TextIDs");
require("scripts/globals/icanheararainbow");
require("scripts/globals/weather");
require("scripts/globals/zone");
require("scripts/globals/chocobo_digging");
-----------------------------------
-- Chocobo Digging vars
-----------------------------------
local itemMap = {
-- itemid, abundance, requirement
{ 880, 224, DIGREQ_NONE },
{ 887, 39, DIGREQ_NONE },
{ 645, 14, DIGREQ_NONE },
{ 893, 105, DIGREQ_NONE },
{ 737, 17, DIGREQ_NONE },
{ 643, 64, DIGREQ_NONE },
{ 17296, 122, DIGREQ_NONE },
{ 942, 6, DIGREQ_NONE },
{ 642, 58, DIGREQ_NONE },
{ 864, 22, DIGREQ_NONE },
{ 843, 4, DIGREQ_NONE },
{ 4096, 100, DIGREQ_NONE }, -- all crystals
{ 845, 122, DIGREQ_BURROW },
{ 844, 71, DIGREQ_BURROW },
{ 1845, 33, DIGREQ_BURROW },
{ 838, 11, DIGREQ_BURROW },
{ 902, 6, DIGREQ_BORE },
{ 886, 3, DIGREQ_BORE },
{ 867, 3, DIGREQ_BORE },
{ 1587, 19, DIGREQ_BORE },
{ 888, 25, DIGREQ_BORE },
{ 1586, 8, DIGREQ_BORE },
{ 885, 10, DIGREQ_BORE },
{ 866, 3, DIGREQ_BORE },
{ 4570, 10, DIGREQ_MODIFIER },
{ 4487, 11, DIGREQ_MODIFIER },
{ 4409, 12, DIGREQ_MODIFIER },
{ 1188, 10, DIGREQ_MODIFIER },
{ 4532, 12, DIGREQ_MODIFIER },
};
local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED };
-----------------------------------
-- onChocoboDig
-----------------------------------
function onChocoboDig(player, precheck)
return chocoboDig(player, itemMap, precheck, messageArray);
end;
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
local manuals = {17289795,17289796,17289797};
SetFieldManual(manuals);
-- King Vinegarroon
SetRespawnTime(17289575, 900, 10800);
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn( player, prevZone)
local cs = -1;
if ( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos( -19.901, 13.607, 440.058, 78);
end
if ( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow
cs = 0x0002;
end
return cs;
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter( player, region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate( player, csid, option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if ( csid == 0x0002) then
lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish( player, csid, option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x0002) then
lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow
end
end;
function onZoneWeatherChange(weather)
if (GetMobAction(17289575) == 24 and (weather == WEATHER_DUST_STORM or weather == WEATHER_SAND_STORM)) then
SpawnMob(17289575); -- King Vinegarroon
elseif (GetMobAction(17289575) == 16 and (weather ~= WEATHER_DUST_STORM and weather ~= WEATHER_SAND_STORM)) then
DespawnMob(17289575);
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Kristen.lua | 38 | 1041 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Kristen
-- Type: Standard NPC
-- @zone: 94
-- @pos 2.195 -2 60.296
--
-- 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(0x0194);
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 |
FluffyGods/IBG-Afghan-War-TDM-Content | IBG Afghan War TDM Content/lua/autorun/effect_explode.lua | 1 | 1644 | function Splodev2()
--local universalexplosion = ents.FindByClass("*explosion")
--local universalboom = ents.FindByClass("*boom*")
local explode = ents.FindByClass("env_explosion")
local explode2 = ents.FindByClass("Explosion")
local explodear2 = ents.FindByClass("env_ar2explosion")
local physboom = ents.FindByClass("env_physexplosion")
local m9kcmboom = ents.FindByClass("m9k_gdcw_cinematicboom")
local m9kcmboom2 = ents.FindByClass("m9k_cinematicboom")
local m9kcmboom3 = ents.FindByClass("m9k_cin*")
local m9ktpaboom = ents.FindByClass("m9k_gdcw_tpaboom")
local helimegabomb = ents.FindByClass("HelicopterMegaBomb")
local fasgrenade = ents.FindByClass("grenade_final")
local fasm79 = ents.FindByClass("explosion_m79")
local m9kfrag = ents.FindByClass("m9k_frag_splode")
local m9kgdcw = ents.FindByClass("m9k_gdcw_*")
local m9kfx = ents.FindByClass("m9k_effect_ex*")
local targets = {};
targets[1] = explode
targets[2] = explodear2
targets[3] = physboom
targets[4] = m9kcmboom
targets[5] = m9ktpaboom
targets[6] = helimegabomb
targets[7] = fasgrenade
targets[8] = fasm79
targets[9] = explode2
targets[10] = m9kfrag
targets[11] = m9kcmboom2
targets[12] = m9kcmboom3
targets[13] = m9kgdcw
targets[14] = m9kfx
for k,v in pairs( targets ) do
if v then
for l,b in pairs( v ) do
if( b:IsValid() ) then
local Pos = b:LocalToWorld( b:OBBCenter( ) )
ParticleEffect("dusty_explosion_rockets", Pos, Angle(0,0,0), nil)
b:Remove()
end
end
end
end
end
game.AddParticles( "particles/vman_explosion.pcf" )
hook.Add("Think", "Splodev2", Splodev2) | apache-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Halvung/npcs/qm4.lua | 8 | 1149 | -----------------------------------
-- Area: Halvung
-- NPC: ??? (Spawn Achamoth(ZNM T3))
-- @pos -34 10 336 62
-----------------------------------
package.loaded["scripts/zones/Halvung/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Halvung/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(trade:hasItemQty(2586,1) and trade:getItemCount() == 1) then -- Trade Rock Juice
player:tradeComplete();
SpawnMob(17031600,180):updateClaim(player);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(NOTHING_HAPPENS);
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 |
FluffyGods/IBG-Afghan-War-TDM-Content | IBG Afghan War TDM Content/lua/wac/base.lua | 1 | 3117 |
--[[
WAC (WeltEnSTurm's Addon Compilation)
Copyright (C) 2012 Robert Luger
This program is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
http://www.gnu.org/licenses/gpl.html
]]
wac = wac or {
version = "331",
author = "weltensturm",
menu = {
tab = "Options",
category = "WAC",
},
player = function(p)
p.wac = p.wac or {}
end,
smoothApproach = function(x,y,s,c)
if not x then error("first argument nil", 2) end
if not y then error("second argument nil", 2) end
local FrT=math.Clamp(FrameTime(), 0.001, 0.035)*0.3
c=(c and c*FrT)or(99999)
return x-math.Clamp((x-y)*s*FrT,-c,c)
end,
smoothApproachAngle = function(x,y,s,c)
local FrT=math.Clamp(FrameTime(), 0.001, 0.035)*0.3
c=(c and c*FrT)or(99999)
return x-math.Clamp(math.AngleDifference(x,y)*s*FrT,-c,c)
end,
smoothApproachAngles = function(a1,a2,s,c)
if not a1 or not a2 then error("one argument is nil", 2) end
a1.p = wac.smoothApproachAngle(a1.p, a2.p, s,c)
a1.y = wac.smoothApproachAngle(a1.y, a2.y, s,c)
a1.r = wac.smoothApproachAngle(a1.r, a2.r, s,c)
return a1
end,
smoothApproachVector = function(begin, target, s, c)
if not begin then error("first argument is nil", 2) end
if not target then error("second argument is nil", 2) end
if not s then error("third argument is nil", 2) end
local dir = (begin-target):GetNormal()
local dist = begin:Distance(target)
local var = wac.smoothApproach(0,dist,s,c)
local v = begin-dir*var
begin.x = v.x
begin.y = v.y
begin.z = v.z
--[[begin.x=WAC.SmoothApproach(begin.x,end.x,s,c)
begin.y=WAC.SmoothApproach(begin.y,end.y,s,c)
begin.z=WAC.SmoothApproach(begin.z,end.z,s,c)]]
return begin
end,
hooks = {},
hooksCalcView = {},
hook = function(gmhook, name, func, unload)
if gmhook == "CalcView" then
wac.hooksCalcView[name] = {f = func, u = unload, g = gmhook}
else
wac.hooks[name] = {f = func, u = unload, g = gmhook}
hook.Add(gmhook, name, func)
end
end,
menuPanels = {},
addMenuPanel = function(tab, category, name, func, ...)
wac.menuPanels[tab] = wac.menuPanels[tab] or {}
wac.menuPanels[tab][category] = wac.menuPanels[tab][category] or {}
wac.menuPanels[tab][category][name] = wac.menuPanels[tab][category][name] or {}
local t = wac.menuPanels[tab][category][name]
t.funcs = t.funcs or {}
table.insert(t.funcs, func)
if t.triggers then
for k, v in pairs(t.triggers) do
t.triggers[k] = ""
end
end
t.triggers = t.triggers or {}
if ... then
for _, var in pairs({...}) do
t.triggers[var] = ""
end
end
end,
}
| apache-2.0 |
Goranaws/Dominos | libs/LibKeyBound-1.0/Locale-esES.lua | 1 | 2362 | --[[
LibKeyBound-1.0 localization file
Spanish by StiviS
--]]
if (GetLocale() ~= "esES") then
return
end
local REVISION = 90000 + tonumber(("$Revision: 92 $"):match("%d+"))
if (LibKeyBoundLocale10 and REVISION <= LibKeyBoundLocale10.REVISION) then
return
end
LibKeyBoundLocale10 = {
REVISION = REVISION;
Enabled = 'Modo Atajos activado';
Disabled = 'Modo Atajos desactivado';
ClearTip = format('Pulsa %s para limpiar todos los atajos', GetBindingText('ESCAPE', 'KEY_'));
NoKeysBoundTip = 'No existen atajos';
ClearedBindings = 'Eliminados todos los atajos de %s';
BoundKey = 'Establecer %s a %s';
UnboundKey = 'Quitado atajo %s de %s';
CannotBindInCombat = 'No se pueden atajar teclas en combate';
CombatBindingsEnabled = 'Saliendo de combate, modo de Atajos de Teclado activado';
CombatBindingsDisabled = 'Entrando en combate, modo de Atajos de Teclado desactivado';
BindingsHelp = "Sitúese en un botón, entonces pulse una tecla para establecer su atajo. Para limpiar el Atajo del botón actual, pulse %s.";
-- This is the short display version you see on the Button
["Alt"] = "A",
["Ctrl"] = "C",
["Shift"] = "S",
["NumPad"] = "N",
["Backspace"] = "BS",
["Button1"] = "B1",
["Button2"] = "B2",
["Button3"] = "B3",
["Button4"] = "B4",
["Button5"] = "B5",
["Button6"] = "B6",
["Button7"] = "B7",
["Button8"] = "B8",
["Button9"] = "B9",
["Button10"] = "B10",
["Button11"] = "B11",
["Button12"] = "B12",
["Button13"] = "B13",
["Button14"] = "B14",
["Button15"] = "B15",
["Button16"] = "B16",
["Button17"] = "B17",
["Button18"] = "B18",
["Button19"] = "B19",
["Button20"] = "B20",
["Button21"] = "B21",
["Button22"] = "B22",
["Button23"] = "B23",
["Button24"] = "B24",
["Button25"] = "B25",
["Button26"] = "B26",
["Button27"] = "B27",
["Button28"] = "B28",
["Button29"] = "B29",
["Button30"] = "B30",
["Button31"] = "B31",
["Capslock"] = "Cp",
["Clear"] = "Cl",
["Delete"] = "Del",
["End"] = "Fin",
["Home"] = "Ini",
["Insert"] = "Ins",
["Mouse Wheel Down"] = "AW",
["Mouse Wheel Up"] = "RW",
["Num Lock"] = "NL",
["Page Down"] = "AP",
["Page Up"] = "RP",
["Scroll Lock"] = "SL",
["Spacebar"] = "Sp",
["Tab"] = "Tb",
["Down Arrow"] = "Ar",
["Left Arrow"] = "Ab",
["Right Arrow"] = "Iz",
["Up Arrow"] = "De",
}
setmetatable(LibKeyBoundLocale10, {__index = LibKeyBoundBaseLocale10})
| bsd-3-clause |
The-HalcyonDays/darkstar | scripts/globals/mobskills/Tribulation.lua | 3 | 1126 | ---------------------------------------------
-- Tribulation
--
-- Description: Inflicts Bio and blinds all targets in an area of effect.
-- Type: Enfeebling
-- Utsusemi/Blink absorb: Ignores shadows
-- Range: AoE
-- Notes: Bio effect can take away up to 39/tick.
---------------------------------------------
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 blinded = false;
local bio = false;
blinded = MobStatusEffectMove(mob, target, EFFECT_BLINDNESS, 20, 0, 120);
bio = MobStatusEffectMove(mob, target, EFFECT_BIO, 39, 0, 120);
skill:setMsg(MSG_ENFEEB_IS);
-- display blind first, else bio
if(blinded == MSG_ENFEEB_IS) then
typeEffect = EFFECT_BLINDNESS;
elseif(bio == MSG_ENFEEB_IS) then
typeEffect = EFFECT_BIO;
else
skill:setMsg(MSG_MISS);
end
return typeEffect;
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Mhaura/npcs/Wilhelm.lua | 7 | 2233 | -----------------------------------
-- Area: Mhaura
-- NPC: Wilhelm
-- Type: Standard NPC
-- @pos -22.746 -5 17.157 249
-----------------------------------
package.loaded["scripts/zones/Mhaura/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/armor_upgrade");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local armor=0;
if(trade:getItemCount() == 1)then
for n = 1,table.getn (LIMBUSARMOR),2 do
if(trade:hasItemQty( LIMBUSARMOR[n] ,1) )then
armor=LIMBUSARMOR[n+1][1];
end
end
end
--print("armor"..armor);
if(armor > 0)then
if(player:getFreeSlotsCount()==0 or player:hasItem(armor) )then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,armor);
else
if(armor == 15241 or armor == 14489 or armor == 14906 or armor == 15577 or armor == 15662)then -- utlima
player:startEvent(0x0148,armor);
elseif(armor == 15576 or armor == 15661 or armor == 15240 or armor == 14905 or armor == 14488)then -- omega
player:startEvent(0x014A,armor);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:hasKeyItem(LIGHT_OF_ALTAIEU) == true or player:getCurrentMission(COP) > THE_WARRIOR_S_PATH)then
player:startEvent(0x0146);
else
player:startEvent(0x0145);
end
--Wilhelm 325 default
--Wilhelm 326 demande fragment de creature
--Wilhelm 327
--Wilhelm 328 apres trade fragment d'ultima
--Wilhelm 329
--Wilhelm 330 apres trade fragment omega
--Wilhelm 331
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== 0x0148 or csid == 0x014A)then
player:addItem(option);
player:messageSpecial(ITEM_OBTAINED,option);
player:tradeComplete();
end
end;
| gpl-3.0 |
miralireza/telegram_star | plugins/rae.lua | 616 | 1312 | do
function getDulcinea( text )
-- Powered by https://github.com/javierhonduco/dulcinea
local api = "http://dulcinea.herokuapp.com/api/?query="
local query_url = api..text
local b, code = http.request(query_url)
if code ~= 200 then
return "Error: HTTP Connection"
end
dulcinea = json:decode(b)
if dulcinea.status == "error" then
return "Error: " .. dulcinea.message
end
while dulcinea.type == "multiple" do
text = dulcinea.response[1].id
b = http.request(api..text)
dulcinea = json:decode(b)
end
local text = ""
local responses = #dulcinea.response
if responses == 0 then
return "Error: 404 word not found"
end
if (responses > 5) then
responses = 5
end
for i = 1, responses, 1 do
text = text .. dulcinea.response[i].word .. "\n"
local meanings = #dulcinea.response[i].meanings
if (meanings > 5) then
meanings = 5
end
for j = 1, meanings, 1 do
local meaning = dulcinea.response[i].meanings[j].meaning
text = text .. meaning .. "\n\n"
end
end
return text
end
function run(msg, matches)
return getDulcinea(matches[1])
end
return {
description = "Spanish dictionary",
usage = "!rae [word]: Search that word in Spanish dictionary.",
patterns = {"^!rae (.*)$"},
run = run
}
end | gpl-2.0 |
FluffyGods/IBG-Afghan-War-TDM-Content | IBG Afghan War TDM Content/lua/effects/wac_impact_m197/init.lua | 1 | 2461 |
function EFFECT:Init(data)
self.LifeTime = CurTime()+1
self.vEntity = data:GetEntity()
local pos=data:GetOrigin()
local ang = data:GetAngles()
local fwd = ang:Forward()
local up = ang:Up()
local ri = ang:Right()
ang.p=ang.p+90
local normal=ang:Up()
local scale=data:GetScale()
self.emitter=ParticleEmitter(pos)
local dlight=DynamicLight(self.vEntity:EntIndex())
if (dlight) then
dlight.Pos=pos+normal
dlight.r=255
dlight.g=220
dlight.b=0
dlight.Brightness=3
dlight.Decay=500
dlight.Size=scale
dlight.DieTime=CurTime()+0.5
end
local particle;
for i=0, 360, 20 do
particle=self.emitter:Add("particle/smokesprites_000"..math.random(1,9), pos+normal*scale/20)
particle:SetVelocity(((math.cos(i)*up + normal*math.Rand(0,2) + math.sin(i)*ri)*50+fwd*math.Rand(0,100))*scale/20)
particle:SetLifeTime(0)
particle:SetDieTime(math.Rand(0.4, 0.8))
particle:SetStartAlpha(math.Rand(10, 100))
particle:SetEndAlpha(0)
particle:SetStartSize(0.1*scale)
particle:SetEndSize(0.5*scale)
particle:SetAirResistance(300)
particle:SetRoll(math.Rand(0, 60))
particle:SetRollDelta(math.Rand(-0.2, 0.2))
particle:SetColor(94, 84, 79)
particle:SetGravity(Vector(0,0,-100))
particle=self.emitter:Add("particles/flamelet"..math.random(1,5), pos+normal*scale/20)
particle:SetVelocity((math.cos(i)*up*math.Rand(10,70) + math.sin(i)*ri*math.Rand(10,70) + normal*math.Rand(10,90))*scale/20)
particle:SetLifeTime(0)
particle:SetDieTime(0.1)
particle:SetStartAlpha(250)
particle:SetEndAlpha(0)
particle:SetStartSize(0.1*scale)
particle:SetEndSize(0.3*scale)
particle:SetRoll(math.Rand(0, 500))
particle:SetRollDelta(math.Rand(-0.2, 0.2))
particle:SetColor(220, 220, 220)
end
for i=1, math.Rand(3, 5) do
particle=self.emitter:Add("particle/smokesprites_000"..math.random(1,9), pos+normal*scale/20)
particle:SetVelocity(fwd*10+normal*math.Rand(0,100))
particle:SetLifeTime(0)
particle:SetDieTime(math.Rand(0.1, 1.2))
particle:SetStartAlpha(math.Rand(0, 100))
particle:SetEndAlpha(0)
particle:SetStartSize(5)
particle:SetEndSize(10)
particle:SetAirResistance(200)
particle:SetRoll(math.Rand(0, 60))
particle:SetRollDelta(math.Rand(-0.2, 0.2))
particle:SetColor(94, 84, 79)
end
self.emitter:Finish()
end
function EFFECT:Think()
return (self.LifeTime > CurTime())
end
function EFFECT:Render()
end | apache-2.0 |
The-HalcyonDays/darkstar | scripts/globals/items/bowl_of_boiled_cockatrice.lua | 35 | 1750 | -----------------------------------------
-- ID: 4547
-- Item: Bowl of Boiled Cockatrice
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Strength 5
-- Agility 2
-- Intelligence -1
-- Mind 1
-- Attack % 22
-- Attack Cap 60
-- Ranged ATT % 22
-- Ranged ATT Cap 60
-----------------------------------------
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,10800,4547);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 5);
target:addMod(MOD_AGI, 2);
target:addMod(MOD_INT, -1);
target:addMod(MOD_MND, 1);
target:addMod(MOD_FOOD_ATTP, 22);
target:addMod(MOD_FOOD_ATT_CAP, 60);
target:addMod(MOD_FOOD_RATTP, 22);
target:addMod(MOD_FOOD_RATT_CAP, 60);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 5);
target:delMod(MOD_AGI, 2);
target:delMod(MOD_INT, -1);
target:delMod(MOD_MND, 1);
target:delMod(MOD_FOOD_ATTP, 22);
target:delMod(MOD_FOOD_ATT_CAP, 60);
target:delMod(MOD_FOOD_RATTP, 22);
target:delMod(MOD_FOOD_RATT_CAP, 60);
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/globals/abilities/addendum_black.lua | 28 | 1632 | -----------------------------------
-- Ability: Addendum: Black
-- Allows access to additional Black Magic spells while using Dark Arts.
-- Obtained: Scholar Level 30
-- Recast Time: Stratagem Charge
-- Duration: 2 hours
--
-- Level |Charges |Recharge Time per Charge
-- ----- -------- ---------------
-- 10 |1 |4:00 minutes
-- 30 |2 |2:00 minutes
-- 50 |3 |1:20 minutes
-- 70 |4 |1:00 minute
-- 90 |5 |48 seconds
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if player:hasStatusEffect(EFFECT_ADDENDUM_BLACK) then
return MSGBASIC_EFFECT_ALREADY_ACTIVE, 0;
end
return 0,0;
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
player:delStatusEffectSilent(EFFECT_LIGHT_ARTS);
player:delStatusEffectSilent(EFFECT_ADDENDUM_WHITE);
player:delStatusEffectSilent(EFFECT_DARK_ARTS);
local skillbonus = player:getMod(MOD_DARK_ARTS_SKILL);
local effectbonus = player:getMod(MOD_DARK_ARTS_EFFECT);
local helixbonus = 0;
if (player:getMainJob() == JOB_SCH and player:getMainLvl() >= 20) then
helixbonus = math.floor(player:getMainLvl() / 4);
end
player:addStatusEffectEx(EFFECT_ADDENDUM_BLACK,EFFECT_ADDENDUM_BLACK,effectbonus,0,7200,0,helixbonus,true);
return EFFECT_ADDENDUM_BLACK;
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/globals/items/plate_of_witch_risotto.lua | 35 | 1537 | -----------------------------------------
-- ID: 4330
-- Item: witch_risotto
-- Food Effect: 4hours, All Races
-----------------------------------------
-- Magic Points 35
-- Strength -1
-- Vitality 3
-- Mind 3
-- MP Recovered While Healing 2
-- Enmity -1
-----------------------------------------
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,4330);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 35);
target:addMod(MOD_STR, -1);
target:addMod(MOD_VIT, 3);
target:addMod(MOD_MND, 3);
target:addMod(MOD_MPHEAL, 2);
target:addMod(MOD_ENMITY, -1);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 35);
target:delMod(MOD_STR, -1);
target:delMod(MOD_VIT, 3);
target:delMod(MOD_MND, 3);
target:delMod(MOD_MPHEAL, 2);
target:delMod(MOD_ENMITY, -1);
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Northern_San_dOria/npcs/Shomo_Pochachilo.lua | 38 | 1288 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Shomo Pochachilo
-- Type: Standard Info NPC
-- @zone: 231
-- @pos 28.369 -0.199 30.061
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
quest_FatherAndSon = player:getQuestStatus(SANDORIA,FATHER_AND_SON);
if (quest_FatherAndSon == QUEST_COMPLETED) then
player:startEvent(0x02b8);
else
player:startEvent(0x02a3);
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 |
otservme/global1053 | data/npc/scripts/Amanda.lua | 2 | 7097 | local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
local blessings = 0
for i = 1, 5 do
if player:hasBlessing(i) then
blessings = blessings + 1
end
end
-- Bless Price
if getPlayerLevel(cid) < 30 then
amount = 2000*5
price = ""..amount.." gold"
elseif getPlayerLevel(cid) > 30 and getPlayerLevel(cid) < 120 then
amount = (((getPlayerLevel(cid)-30)*200)+2000)*5
price = ""..amount.." gold"
elseif getPlayerLevel(cid) >= 120 then
amount = 20000*5
price = ""..amount.." gold"
end
if msgcontains(msg, "heal") then
if player:getHealth() < 50 then
player:addHealth(50 - player:getHealth())
local conditions = {CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_BLEEDING, CONDITION_PARALYZE, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED}
for i = 1, #conditions do
if player:getCondition(conditions[i], CONDITIONID_COMBAT) then
player:removeCondition(conditions[i], CONDITIONID_COMBAT)
end
end
npcHandler:say("You are hurt, my child. I will heal your wounds.", cid)
else
npcHandler:say("You aren't looking that bad. Sorry, I can't help you. But if you are looking for additional protection you should go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.", cid)
end
elseif msgcontains(msg, "twist of fate") then
selfSay("This is a special blessing I can bestow upon you once you have obtained at least one of the other blessings and which functions a bit differently. ...", cid)
selfSay("It only works when you're killed by other adventurers, which means that at least half of the damage leading to your death was caused by others, not by monsters or the environment. ...", cid)
selfSay("The {twist of fate} will not reduce the death penalty like the other blessings, but instead prevent you from losing your other blessings as well as the amulet of loss, should you wear one. It costs the same as the other blessings. ...", cid)
npcHandler:say("Would you like to receive that protection for a sacrifice of " .. getPvpBlessingCost(player:getLevel()) .. " gold, child?", cid)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, "all") then
for i = 1, 5 do
if not player:hasBlessing(i) then
npcHandler:say("For "..price..", I will bless you with all the blessings you don't already have. Is that okay?", cid)
npcHandler.topic[cid] = 3
else
npcHandler:say("You already possess all blessings.", cid)
end
end
elseif msgcontains(msg, "wooden stake") then
if player:getStorageValue(Storage.FriendsandTraders.TheBlessedStake) == 7 then
if player:getItemCount(5941) >= 1 then
npcHandler:say("Yes, I was informed what to do. Are you prepared to receive my line of the prayer?", cid)
npcHandler.topic[cid] = 2
end
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 1 then
if blessings >= 1 or player:getItemCount(2173) > 0 then
if not player:hasBlessing(6) then
if player:removeMoney(getPvpBlessingCost(player:getLevel())) then
player:addBlessing(6)
npcHandler:say("So receive the protection of the twist of fate, pilgrim.", cid)
else
npcHandler:say("Oh. You do not have enough money.", cid)
end
else
npcHandler:say("You already possess this blessing.", cid)
end
else
npcHandler:say("You don't have any of the other blessings nor an amulet of loss, so it wouldn't make sense to bestow this protection on you now. Remember that it can only protect you from the loss of those!", cid)
end
elseif npcHandler.topic[cid] == 2 then
if player:getItemCount(5941) > 0 then
player:setStorageValue(Storage.FriendsandTraders.TheBlessedStake, 8)
npcHandler:say("So receive my prayer: 'Wicked curses shall be broken'. Now, bring your stake to Kasmir in Darashia for the next line of the prayer. I will inform him what to do. ", cid)
end
elseif npcHandler.topic[cid] == 3 then
if player:removeMoney(amount) then
for i = 1, 5 do
player:addBlessing(i)
npcHandler:say("You have been blessed!", cid)
end
else
npcHandler:say("You don't have enough gold.", cid)
end
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "no") and npcHandler.topic[cid] >= 1 then
npcHandler:say("Fine. You are free to decline my offer.", cid)
npcHandler.topic[cid] = 0
end
return true
end
keywordHandler:addKeyword({'pilgrimage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Whenever you receive a lethal wound, your vital force is damaged and there is a chance that you lose some of your equipment. With every single of the five {blessings} you have, this damage and chance of loss will be reduced.'})
keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'There are five different blessings available in five {sacred places}. These blessings are: the {spiritual shielding}, the {spark of the phoenix}, the {embrace of tibia}, the {fire of the suns} and the {wisdom of solitude}. You have 5 out of 5 blessings. I can also provide you with {all} blessings at once. Additionally, you can receive the {twist of fate} here.'})
keywordHandler:addKeyword({'spiritual'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You can ask for the blessing of spiritual shielding in the whiteflower temple south of Thais.'})
keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'The spark of the phoenix is given by the dwarven priests of earth and fire in Kazordoon.'})
keywordHandler:addKeyword({'embrace'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'The druids north of Carlin will provide you with the embrace of Tibia.'})
keywordHandler:addKeyword({'suns'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You can ask for the blessing of the two suns in the suntower near Ab\'Dendriel.'})
keywordHandler:addKeyword({'solitude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Talk to the hermit Eremo on the isle of Cormaya about this blessing.'})
npcHandler:setMessage(MESSAGE_GREET, "Welcome, young |PLAYERNAME|! If you are new in Tibia, ask me for help. If you need {healing} or {blessings}, I can help you.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Remember: If you are heavily wounded or poisoned, I can heal you for free.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the gods bless you, |PLAYERNAME|!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) | gpl-2.0 |
The-HalcyonDays/darkstar | scripts/globals/abilities/meditate.lua | 10 | 1306 | -----------------------------------
-- Ability: Meditate
-- Gradually charges TP.
-- Obtained: Samurai Level 30
-- Recast Time: 3:00 (Can be reduced to 2:30 using Merit Points)
-- Duration: 15 seconds
-----------------------------------
require("scripts/globals/status");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
return 0,0;
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
local amount = 12;
if(player:getMainJob()==12) then
amount = 20;
end
local tick = 15;
local extratick = 0;
local sHands = target:getEquipID(SLOT_HANDS);
local sHead = target:getEquipID(SLOT_HEAD);
-- Todo: change these item checks into a modifier.
if (sHands == 15113 or sHands == 14920) then
extratick = 1;
end
if (sHead == 13868 or sHead == 15236) then
extratick = extratick + 1;
end
if (extratick == 1) then
extratick = math.random(1,2);
elseif (extratick == 2) then
extratick = math.random(2,3);
end
tick = tick + (extratick * 3);
player:addStatusEffectEx(EFFECT_MEDITATE,0,amount,3,tick);
end; | gpl-3.0 |
Goranaws/Dominos | bars/extraActionBar.lua | 1 | 3146 | if not _G['ExtraActionBarFrame'] then return end
--[[ Globals ]]--
local Addon = _G[...]
local KeyBound = LibStub('LibKeyBound-1.0')
local Tooltips = Addon:GetModule('Tooltips')
local Bindings = Addon.BindingsController
--[[ buttons ]]--
local ExtraActionButton = Addon:CreateClass('CheckButton', Addon.BindableButton)
do
local unused = {}
function ExtraActionButton:New(id)
local button = self:Restore(id) or self:Create(id)
Tooltips:Register(button)
Bindings:Register(button)
return button
end
function ExtraActionButton:Create(id)
local button = self:Bind(_G[('ExtraActionButton%d'):format(id)])
if button then
button.buttonType = 'EXTRAACTIONBUTTON'
button:HookScript('OnEnter', self.OnEnter)
Addon:GetModule('ButtonThemer'):Register(button, 'Extra Bar')
return button
end
end
function ExtraActionButton:Restore(id)
local b = unused and unused[id]
if b then
unused[id] = nil
b:Show()
return b
end
end
--saving them thar memories
function ExtraActionButton:Free()
unused[self:GetID()] = self
self:SetParent(nil)
self:Hide()
Tooltips:Unregister(self)
Bindings:Unregister(self)
end
--keybound support
function ExtraActionButton:OnEnter()
KeyBound:Set(self)
end
end
--[[ bar ]]--
local ExtraBar = Addon:CreateClass('Frame', Addon.ButtonBar)
do
function ExtraBar:New()
local bar = ExtraBar.proto.New(self, 'extra')
bar:UpdateShowBlizzardTexture()
return bar
end
function ExtraBar:GetDefaults()
return {
point = 'CENTER',
x = -244,
y = 0,
}
end
function ExtraBar:GetShowStates()
return '[extrabar]show;hide'
end
function ExtraBar:NumButtons()
return 1
end
function ExtraBar:GetButton(index)
local button = ExtraActionButton:New(index)
button:SetAttribute('showgrid', 1)
return button
end
function ExtraBar:ShowBlizzardTexture(show)
self.sets.hideBlizzardTeture = not show
self:UpdateShowBlizzardTexture()
end
function ExtraBar:ShowingBlizzardTexture()
return not self.sets.hideBlizzardTeture
end
function ExtraBar:UpdateShowBlizzardTexture()
local showTexture = self:ShowingBlizzardTexture()
for i, button in pairs(self.buttons) do
if showTexture then
button.style:Show()
else
button.style:Hide()
end
end
end
function ExtraBar:CreateMenu()
local bar = self
local menu = Addon:NewMenu(bar.id)
local panel = menu:AddLayoutPanel()
local L = LibStub('AceLocale-3.0'):GetLocale('Dominos-Config')
local showTextureButton = panel:NewCheckButton(L.ExtraBarShowBlizzardTexture)
showTextureButton:SetScript('OnShow', function(self)
self:SetChecked(bar:ShowingBlizzardTexture())
end)
showTextureButton:SetScript('OnClick', function(self)
bar:ShowBlizzardTexture(self:GetChecked())
end)
menu:AddAdvancedPanel()
self.menu = menu
end
end
--[[ module ]]--
local ExtraBarController = Addon:NewModule('ExtraBar')
function ExtraBarController:OnInitialize()
_G['ExtraActionBarFrame'].ignoreFramePositionManager = true
end
function ExtraBarController:Load()
self.frame = ExtraBar:New()
end
function ExtraBarController:Unload()
self.frame:Free()
end
| bsd-3-clause |
KlonD90/tarantool | test/app/csv.test.lua | 6 | 3607 | #!/usr/bin/env tarantool
local function table2str(t)
local res = ""
for k, line in pairs(t) do
local s = ""
for k2, field in pairs(line) do
s = s .. '|' .. field .. '|\t'
end
res = res .. s .. '\n'
end
return res
end
local function myread(self, bytes)
self.i = self.i + bytes
return self.v:sub(self.i - bytes + 1, self.i)
end
local csv = require('csv')
local fio = require('fio')
local tap = require('tap')
local test1_ans = '|a|\t|b|\t\n|1|\t|ha\n"ha"\nha|\t\n|3|\t|4|\t\n'
local test2_ans = '||\t||\t||\t\n||\t||\t\n||\t\n'
local test3_ans = '||\t||\t\n|kp"v|\t\n'
local test4_ans = '|123|\t|5|\t|92|\t|0|\t|0|\t\n|1|\t|12 34|\t|56|\t' ..
'|quote , |\t|66|\t\n|ok|\t\n'
local test5_ans = "|1|\t\n|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n" ..
"|none|\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f" ..
"3|\t|0|\t\n|local res = internal.pwrite(self.fh|\t|dat" ..
"a|\t|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio." ..
"c.flag[ flag ])|\t\n||\t||\t||\t\n"
local test6_ans = "|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n|none|" ..
"\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f3|\t|" ..
"0|\t\n|local res = internal.pwrite(self.fh|\t|data|\t" ..
"|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio.c.f" ..
"lag[ flag ])|\t\n||\t||\t||\t\n"
test = tap.test("csv")
test:plan(8)
readable = {}
readable.read = myread
readable.v = "a,b\n1,\"ha\n\"\"ha\"\"\nha\"\n3,4\n"
readable.i = 0
test:is(table2str(csv.load(readable)), test1_ans, "obj test1")
readable.v = ", ,\n , \n\n"
readable.i = 0
test:is(table2str(csv.load(readable, {chunk_size = 1} )), test2_ans, "obj test2")
readable.v = ", \r\nkp\"\"v"
readable.i = 0
test:is(table2str(csv.load(readable, {chunk_size = 3})), test3_ans, "obj test3")
tmpdir = fio.tempdir()
file1 = fio.pathjoin(tmpdir, 'file.1')
file2 = fio.pathjoin(tmpdir, 'file.2')
file3 = fio.pathjoin(tmpdir, 'file.3')
local f = fio.open(file1, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, 0777)
f:write("123 , 5 , 92 , 0, 0\n" ..
"1, 12 34, 56, \"quote , \", 66\nok")
f:close()
f = fio.open(file1, {'O_RDONLY'})
test:is(table2str(csv.load(f, {chunk_size = 10})), test4_ans, "fio test1")
f:close()
f = fio.open(file2, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, 0777)
f:write("1\n23,456,abcac,\'multiword field 4\'\n" ..
"none,none,0\n" ..
",,\n" ..
"aba,adda,f3,0\n" ..
"local res = internal.pwrite(self.fh, data, len, offset)\n" ..
"iflag = bit.bor(iflag, fio.c.flag[ flag ])\n" ..
",,"
)
f:close()
f = fio.open(file2, {'O_RDONLY'})
--symbol by symbol reading
test:is(table2str(csv.load(f, {chunk_size = 1})), test5_ans, "fio test2")
f:close()
f = fio.open(file2, {'O_RDONLY'})
opts = {chunk_size = 7, skip_head_lines = 1}
--7 symbols per chunk
test:is(table2str(csv.load(f, opts)), test6_ans, "fio test3")
f:close()
t = {
{'quote" d', ',and, comma', 'both " of " t,h,e,m'},
{'"""', ',","'},
{'mul\nti\nli\r\nne\n\n', 'field'},
{""},
{'"'},
{"\n"}
}
f = require("fio").open(file3, { "O_WRONLY", "O_TRUNC" , "O_CREAT"}, 0x1FF)
csv.dump(t, {}, f)
f:close()
f = fio.open(file3, {'O_RDONLY'})
t2 = csv.load(f, {chunk_size = 5})
f:close()
test:is(table2str(t), table2str(t2), "test roundtrip")
test:is(table2str(t), table2str(csv.load(csv.dump(t))), "test load(dump(t))")
fio.unlink(file1)
fio.unlink(file2)
fio.unlink(file3)
fio.rmdir(tmpdir)
| bsd-2-clause |
coltonj96/UsefulCombinators | UsefulCombinators_0.2.1/prototypes/technology/technology.lua | 4 | 2073 | data:extend({
{
type = "technology",
name = "useful-combinators",
icon = "__UsefulCombinators__/graphics/technology/clock.png",
icon_size = 64,
effects =
{
{
type = "unlock-recipe",
recipe = "timer-combinator"
},
{
type = "unlock-recipe",
recipe = "counting-combinator"
},
{
type = "unlock-recipe",
recipe = "random-combinator"
},
{
type = "unlock-recipe",
recipe = "comparator-combinator"
},
{
type = "unlock-recipe",
recipe = "converter-combinator"
},
{
type = "unlock-recipe",
recipe = "min-combinator"
},
{
type = "unlock-recipe",
recipe = "max-combinator"
},
{
type = "unlock-recipe",
recipe = "and-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "nand-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "nor-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "not-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "or-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "xnor-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "xor-gate-combinator"
},
{
type = "unlock-recipe",
recipe = "detector-combinator"
},
{
type = "unlock-recipe",
recipe = "sensor-combinator"
},
{
type = "unlock-recipe",
recipe = "railway-combinator"
},
{
type = "unlock-recipe",
recipe = "color-combinator"
}
},
prerequisites = {"circuit-network"},
unit =
{
count = 100,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1}
},
time = 15
},
order = "a-d-d"
}
}) | mit |
The-HalcyonDays/darkstar | scripts/zones/Western_Altepa_Desert/npcs/Cermet_Headstone.lua | 17 | 2670 | -----------------------------------
-- Area: Western Altepa Desert
-- NPC: Cermet Headstone
-- Involved in Mission: ZM5 Headstone Pilgrimage (Earth Fragment)
-- @pos -108 10 -216 125
-----------------------------------
package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/titles");
require("scripts/globals/missions");
require("scripts/zones/Western_Altepa_Desert/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:getCurrentMission(ZILART) == HEADSTONE_PILGRIMAGE) then
if(player:hasKeyItem(EARTH_FRAGMENT) == false) then
player:startEvent(0x00C8,EARTH_FRAGMENT);
elseif(player:hasKeyItem(239) and player:hasKeyItem(240) and player:hasKeyItem(241) and
player:hasKeyItem(242) and player:hasKeyItem(243) and player:hasKeyItem(244) and
player:hasKeyItem(245) and player:hasKeyItem(246)) then
player:messageSpecial(ALREADY_HAVE_ALL_FRAGS);
elseif(player:hasKeyItem(EARTH_FRAGMENT)) then
player:messageSpecial(ALREADY_OBTAINED_FRAG,EARTH_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
player:addKeyItem(EARTH_FRAGMENT);
-- Check and see if all fragments have been found (no need to check earth and dark frag)
if(player:hasKeyItem(FIRE_FRAGMENT) and player:hasKeyItem(WATER_FRAGMENT) and player:hasKeyItem(ICE_FRAGMENT) and
player:hasKeyItem(WIND_FRAGMENT) and player:hasKeyItem(LIGHTNING_FRAGMENT) and player:hasKeyItem(LIGHT_FRAGMENT)) then
player:messageSpecial(FOUND_ALL_FRAGS,EARTH_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,EARTH_FRAGMENT);
end
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Yuhtunga_Jungle/npcs/Robino-Mobino.lua | 17 | 1852 | -----------------------------------
-- Area: Yuhtunga Jungle
-- NPC: Robino-Mobino
-- @pos -244 0 -401 123
-----------------------------------
package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Yuhtunga_Jungle/TextIDs");
local region = ELSHIMOLOWLANDS;
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 |
The-HalcyonDays/darkstar | scripts/zones/West_Sarutabaruta/npcs/Banege_RK.lua | 30 | 3066 | -----------------------------------
-- Area: West Sarutabaruta
-- NPC: Banege, R.K.
-- Type: Border Conquest Guards
-- @pos 399.450 -25.858 727.545 115
-----------------------------------
package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/West_Sarutabaruta/TextIDs");
local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = SARUTABARUTA;
local csid = 0x7ffa;
-----------------------------------
-- 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 |
The-HalcyonDays/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Animated_Spear.lua | 17 | 1476 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Animated Spear
-----------------------------------
require("scripts/globals/status");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
if(mob:AnimationSub() == 3) then
SetDropRate(114,1578,1000);
else
SetDropRate(114,1578,0);
end
target:showText(mob,ANIMATED_SPEAR_DIALOG);
SpawnMob(17330423,120):updateEnmity(target);
SpawnMob(17330424,120):updateEnmity(target);
SpawnMob(17330425,120):updateEnmity(target);
SpawnMob(17330435,120):updateEnmity(target);
SpawnMob(17330436,120):updateEnmity(target);
SpawnMob(17330437,120):updateEnmity(target);
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
-- TODO: add battle dialog
end;
-----------------------------------
-- onMobDisengage
-----------------------------------
function onMobDisengage(mob)
mob:showText(mob,ANIMATED_SPEAR_DIALOG+2);
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
killer:showText(mob,ANIMATED_SPEAR_DIALOG+1);
DespawnMob(17330423);
DespawnMob(17330424);
DespawnMob(17330425);
DespawnMob(17330435);
DespawnMob(17330436);
DespawnMob(17330437);
end; | gpl-3.0 |
zero-rp/ZNet | tool/zero/lualib/http/sockethelper.lua | 4 | 1923 | local socket = require "socket"
local skynet = require "skynet"
local readbytes = socket.read
local writebytes = socket.write
local sockethelper = {}
local socket_error = setmetatable({} , { __tostring = function() return "[Socket Error]" end })
sockethelper.socket_error = socket_error
local function preread(fd, str)
return function (sz)
if str then
if sz == #str or sz == nil then
local ret = str
str = nil
return ret
else
if sz < #str then
local ret = str:sub(1,sz)
str = str:sub(sz + 1)
return ret
else
sz = sz - #str
local ret = readbytes(fd, sz)
if ret then
return str .. ret
else
error(socket_error)
end
end
end
else
local ret = readbytes(fd, sz)
if ret then
return ret
else
error(socket_error)
end
end
end
end
function sockethelper.readfunc(fd, pre)
if pre then
return preread(fd, pre)
end
return function (sz)
local ret = readbytes(fd, sz)
if ret then
return ret
else
error(socket_error)
end
end
end
sockethelper.readall = socket.readall
function sockethelper.writefunc(fd)
return function(content)
local ok = writebytes(fd, content)
if not ok then
error(socket_error)
end
end
end
function sockethelper.connect(host, port, timeout)
local fd
if timeout then
local drop_fd
local co = coroutine.running()
-- asynchronous connect
skynet.fork(function()
fd = socket.open(host, port)
if drop_fd then
-- sockethelper.connect already return, and raise socket_error
socket.close(fd)
else
-- socket.open before sleep, wakeup.
skynet.wakeup(co)
end
end)
skynet.sleep(timeout)
if not fd then
-- not connect yet
drop_fd = true
end
else
-- block connect
fd = socket.open(host, port)
end
if fd then
return fd
end
error(socket_error)
end
function sockethelper.close(fd)
socket.close(fd)
end
return sockethelper
| mit |
The-HalcyonDays/darkstar | scripts/zones/Apollyon/mobs/Apollyon_Scavenger.lua | 17 | 1403 | -----------------------------------
-- Area: Apollyon NW
-- NPC: Kaiser Behemoth
-----------------------------------
package.loaded["scripts/zones/Apollyon/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Apollyon/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
local mobID = mob:getID();
-- print(mobID);
local mobX = mob:getXPos();
local mobY = mob:getYPos();
local mobZ = mob:getZPos();
if(mobID ==16932964)then -- recover
GetNPCByID(16932864+327):setPos(mobX,mobY,mobZ);
GetNPCByID(16932864+327):setStatus(STATUS_NORMAL);
elseif(mobID ==16932966)then -- timer 1
GetNPCByID(16932864+177):setPos(mobX,mobY,mobZ);
GetNPCByID(16932864+177):setStatus(STATUS_NORMAL);
elseif(mobID ==16932967)then -- timer 2
GetNPCByID(16932864+189):setPos(mobX,mobY,mobZ);
GetNPCByID(16932864+189):setStatus(STATUS_NORMAL);
elseif(mobID ==16932969)then -- timer 3
GetNPCByID(16932864+190):setPos(mobX,mobY,mobZ);
GetNPCByID(16932864+190):setStatus(STATUS_NORMAL);
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Windurst_Woods/npcs/Kopuro-Popuro.lua | 19 | 6247 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Kopuro-Popuro
-- Type: Standard NPC
-- @zone: 241
-- @pos -0.037 -4.749 -22.589
-- Starts Quests: The All-New C-2000, Legendary Plan B, The All-New C-3000
-- Involved in quests: Lost Chick
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/titles");
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
require("scripts/zones/Windurst_Woods/TextIDs");
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
allnew = player:getQuestStatus(WINDURST,THE_ALL_NEW_C_2000);
LPB = player:getQuestStatus(WINDURST,LEGENDARY_PLAN_B);
ANC3K = player:getQuestStatus(WINDURST,THE_ALL_NEW_C_3000);
-- The All New C-2000
if (allnew == QUEST_ACCEPTED) then
count = trade:getItemCount();
if(trade:hasItemQty(856,1) and trade:hasItemQty(4368,1) and trade:hasItemQty(846,1) and count == 3) then
player:startEvent(0x0124,GIL_RATE*200); -- Correct items given, complete quest.
else
player:startEvent(0x0120,0,856,846,4368); -- Incorrect or not enough items.
end
-- Legendary Plan B
elseif (LPB == QUEST_ACCEPTED) then
count = trade:getItemCount();
if(trade:hasItemQty(529,1) and trade:hasItemQty(940,1) and trade:hasItemQty(858,1) and count == 3) then
player:startEvent(0x013A,0,529,940,858); -- Correct items given, complete quest in onEventUpdate
else
player:startEvent(0x0135,0,529,940,858); -- Incorrect or not enough items
end
-- The All New C-3000
elseif (ANC3K == QUEST_ACCEPTED) then
count = trade:getItemCount();
if(trade:hasItemQty(889,1) and trade:hasItemQty(939,1) and count == 2) then
player:startEvent(0x0291,0,889,939); -- Correct items given, complete quest in onEventUpdate
else
player:startEvent(0x0290,0,889,939); -- Incorrect or not enough items
end
-- Repeat The All New C-3000
elseif (ANC3K == QUEST_COMPLETED) then
count = trade:getItemCount();
if(trade:hasItemQty(889,1) and trade:hasItemQty(939,1) and count == 2) then
player:startEvent(0x0291,0,889,939); -- Correct items given, complete quest in onEventUpdate
else
player:startEvent(0x0290,0,889,939); -- Incorrect or not enough items
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local allnew = player:getQuestStatus(WINDURST,THE_ALL_NEW_C_2000);
local AGreetingCardian = player:getQuestStatus(WINDURST,A_GREETING_CARDIAN); -- previous quest in line
local AGCcs = player:getVar("AGreetingCardian_Event"); -- for supplemental dialog before start of Legendary Plan B
local LPB = player:getQuestStatus(WINDURST,LEGENDARY_PLAN_B);
local ANC3K = player:getQuestStatus(WINDURST,THE_ALL_NEW_C_3000);
-- The All New C-3000
if (LPB == QUEST_COMPLETED and ANC3K == QUEST_AVAILABLE and player:getFameLevel (WINDURST) >= 4) then
if(player:needToZone()) then
player:startEvent(0x013c); -- Post quest text from LPB
else
player:startEvent(0x028F,0,889,939); -- ANC3K start
end
-- Repeating The All New C-3000
elseif (ANC3K == QUEST_COMPLETED) then
player:startEvent(0x0293,0,889,939);
-- A Greeting Cardian supplemental text
elseif (AGreetingCardian == QUEST_ACCEPTED and AGCcs == 5) then
player:startEvent(0x012D); -- Supplemental text when AGreetingCardian in progress, right before completion
-- Legendary Plan B
elseif (AGreetingCardian == QUEST_COMPLETED and LPB == QUEST_AVAILABLE and player:getFameLevel (WINDURST) >= 3) then
if(player:needToZone()) then
player:startEvent(0x0132); -- Supplemental text for AGreetingCardian before start of LPB
else
player:startEvent(0x0134,0,529,940,858); -- LPB start
end
elseif (LPB == QUEST_ACCEPTED) then
player:startEvent(0x0135,0,529,940,858); -- LPB reminder
-- standard dialog after Legendary Plan B
elseif (LPB == QUEST_COMPLETED) then
player:startEvent(0x013c);
-- The All New C-2000
elseif (allnew == QUEST_AVAILABLE) then
player:startEvent(0x011d,0,856,846,4368); -- Start Quest
elseif (allnew == QUEST_ACCEPTED) then
player:startEvent(0x0120,0,856,846,4368); -- Reminder Dialogue
elseif (allnew == QUEST_COMPLETED) then
player:startEvent(0x0125); -- Post Quest Finish Text
-- No Quest Available
else
player:startEvent(0x0114);
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);
-- The All New C-2000
if (csid == 0x011d and option ~= 2) then -- option 2 is declining the quest for the second question
player:addQuest(WINDURST,THE_ALL_NEW_C_2000);
elseif (csid == 0x0124) then
player:tradeComplete();
player:addFame(WINDURST,WIN_FAME*80);
player:addTitle(CARDIAN_TUTOR);
player:addGil(GIL_RATE*200);
player:completeQuest(WINDURST,THE_ALL_NEW_C_2000);
-- Start LPB
elseif (csid == 0x0134) then
player:addQuest(WINDURST,LEGENDARY_PLAN_B);
-- Finish LPB
elseif (csid == 0x013A) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,12749); -- Scentless Armlets
else
player:tradeComplete();
player:addFame(WINDURST,WIN_FAME*30);
player:addGil(GIL_RATE*700);
player:addItem(12749);
player:messageSpecial(ITEM_OBTAINED,12749); -- Scentless Armlets
player:completeQuest(WINDURST,LEGENDARY_PLAN_B);
player:needToZone(true); -- zone before starting The All New C-3000
end
-- start The All New C-3000
elseif (csid == 0x028F) then
player:addQuest(WINDURST,THE_ALL_NEW_C_3000);
-- finish The All New C-3000
elseif (csid == 0x0291) then
player:tradeComplete();
player:addFame(WINDURST,WIN_FAME*10);
player:addGil(GIL_RATE*600);
player:completeQuest(WINDURST,THE_ALL_NEW_C_3000);
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Sacrificial_Chamber/npcs/_4j2.lua | 12 | 1341 | -----------------------------------
-- Area: Sacrificial Chamber
-- NPC: Mahogany Door
-- @pos -260 -33 274 163
-------------------------------------
package.loaded["scripts/zones/Sacrificial_Chamber/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/bcnm");
require("scripts/globals/missions");
require("scripts/zones/Sacrificial_Chamber/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(TradeBCNM(player,player:getZoneID(),trade,npc))then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(EventTriggerBCNM(player,npc))then
return 1;
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if(EventUpdateBCNM(player,csid,option))then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if(EventFinishBCNM(player,csid,option))then
return;
end
end; | gpl-3.0 |
Goranaws/Dominos | core/buttonBar.lua | 1 | 5389 | -- buttonBar.lua
-- a dominos frame that contains buttons
local ButtonBar = Dominos:CreateClass('Frame', Dominos.Frame)
Dominos.ButtonBar = ButtonBar
function ButtonBar:New(...)
local bar = ButtonBar.proto.New(self, ...)
bar:ReloadButtons()
return bar
end
function ButtonBar:Create(...)
local bar = ButtonBar.proto.Create(self, ...)
bar.buttons = {}
return bar
end
function ButtonBar:Free()
for i in pairs(self.buttons) do
self:DetachButton(i)
end
return ButtonBar.proto.Free(self)
end
-- retrives the button that should be placed at index
function ButtonBar:GetButton(index) end
-- adds the specified button to the bar
function ButtonBar:AttachButton(index)
local button = self:GetButton(index)
if button then
button:SetParent(self.header)
button:EnableMouse(not self:GetClickThrough())
button:Show()
self.buttons[index] = button
end
end
-- removes the specified button from the bar
function ButtonBar:DetachButton(index)
local button = self.buttons[index]
if button then
if type(button.Free) == 'function' then
button:Free()
else
button:SetParent(nil)
button:Hide()
end
self.buttons[index] = nil
end
end
function ButtonBar:ReloadButtons()
local oldNumButtons = #self.buttons
for i = 1, oldNumButtons do
self:DetachButton(i)
end
local newNumButtons = self:NumButtons()
for i = 1, newNumButtons do
self:AttachButton(i)
end
self:Layout()
end
function ButtonBar:SetNumButtons(numButtons)
self.sets.numButtons = numButtons or 0
self:UpdateNumButtons()
end
function ButtonBar:UpdateNumButtons()
local oldNumButtons = #self.buttons
local newNumButtons = self:NumButtons()
for i = newNumButtons + 1, oldNumButtons do
self:DetachButton(i)
end
for i = oldNumButtons + 1, newNumButtons do
self:AttachButton(i)
end
self:Layout()
end
function ButtonBar:NumButtons()
return self.sets.numButtons or 0
end
function ButtonBar:SetColumns(columns)
self.sets.columns = columns ~= self:NumButtons() and columns or nil
self:Layout()
end
function ButtonBar:NumColumns()
return self.sets.columns or self:NumButtons()
end
function ButtonBar:SetSpacing(spacing)
self.sets.spacing = spacing
self:Layout()
end
function ButtonBar:GetSpacing()
return self.sets.spacing or 0
end
--[[ Layout ]]--
--the wackiness here is for backward compaitbility reasons, since I did not implement true defaults
function ButtonBar:SetLeftToRight(isLeftToRight)
local isRightToLeft = not isLeftToRight
self.sets.isRightToLeft = isRightToLeft and true or nil
self:Layout()
end
function ButtonBar:GetLeftToRight()
return not self.sets.isRightToLeft
end
function ButtonBar:SetTopToBottom(isTopToBottom)
local isBottomToTop = not isTopToBottom
self.sets.isBottomToTop = isBottomToTop and true or nil
self:Layout()
end
function ButtonBar:GetTopToBottom()
return not self.sets.isBottomToTop
end
function ButtonBar:GetButtonInsets()
if #self.buttons >= 1 then
return self.buttons[1]:GetHitRectInsets()
end
return 0, 0, 0, 0
end
function ButtonBar:GetButtonSize()
if #self.buttons >= 1 then
local w, h = self.buttons[1]:GetSize()
local l, r, t, b = self:GetButtonInsets()
return w - (l + r), h - (t + b)
end
return 0, 0
end
--[[
A rough model of a bar for doing calculations
^
| Padding
v
<--Padding-->[Button]<--Spacing-->[Button]<--Padding-->
^
| Spacing
v
<--Padding-->[Button]<--Spacing-->[Button]<--Padding-->
^
| Padding
v
--]]
function ButtonBar:Layout()
if InCombatLockdown() then return end
local numButtons = #self.buttons
if numButtons < 1 then
ButtonBar.proto.Layout(self)
return
end
local cols = min(self:NumColumns(), numButtons)
local rows = ceil(numButtons / cols)
local isLeftToRight = self:GetLeftToRight()
local isTopToBottom = self:GetTopToBottom()
-- grab base button sizes
local l, r, t, b = self:GetButtonInsets()
local bW, bH = self:GetButtonSize()
local pW, pH = self:GetPadding()
local spacing = self:GetSpacing()
local buttonWidth = bW + spacing
local buttonHeight = bH + spacing
local xOff = pW - l
local yOff = pH - t
for i, button in ipairs(self.buttons) do
local row = floor((i - 1) / cols)
if not isTopToBottom then
row = rows - (row + 1)
end
local col = (i - 1) % cols
if not isLeftToRight then
col = cols - (col + 1)
end
local x = xOff + buttonWidth*col
local y = yOff + buttonHeight*row
button:SetParent(self.header)
button:ClearAllPoints()
button:SetPoint('TOPLEFT', x, -y)
end
local barWidth = (buttonWidth * cols) + (pW * 2) - spacing
local barHeight = (buttonHeight * rows) + (pH * 2) - spacing
self:SetSize(barWidth, barHeight)
end
function ButtonBar:UpdateClickThrough()
local isClickThroughEnabled = self:GetClickThrough()
for _, button in pairs(self.buttons) do
if isClickThroughEnabled then
button:EnableMouse(false)
else
button:EnableMouse(true)
end
end
end
| bsd-3-clause |
The-HalcyonDays/darkstar | scripts/zones/Attohwa_Chasm/npcs/HomePoint#1.lua | 12 | 1183 | -----------------------------------
-- Area: Attohwa Chasm
-- NPC: HomePoint#2
-- @pos
-----------------------------------
package.loaded["scripts/zones/Attohwa_Chasm/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/Attohwa_Chasm/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fc, 81);
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 == 0x21fc) then
if (option == 1) then
player:setHomePoint();
player:messageSpecial(HOMEPOINT_SET);
else
hpTeleport( player, option);
end
end
end; | gpl-3.0 |
otservme/global1053 | data/actions/scripts/the ancient tombs quest/AncientRuinsTombInstruments.lua | 2 | 1573 | function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if item.itemid == 2367 and player:getStorageValue(12109) < 1 then
player:setStorageValue(12109, 1)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
elseif item.itemid == 2373 and player:getStorageValue(12109) == 1 then
player:setStorageValue(12109, 2)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
elseif item.itemid == 2370 and player:getStorageValue(12109) == 2 then
player:setStorageValue(12109, 3)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
elseif item.itemid == 2372 and player:getStorageValue(12109) == 3 then
player:setStorageValue(12109, 4)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
elseif item.itemid == 2369 and player:getStorageValue(12109) == 4 then
player:setStorageValue(12109, 5)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You played them in correct order and got the access through door!")
elseif item.itemid == 1241 then
if player:getStorageValue(12109) == 5 then
player:teleportTo(toPosition, true)
Item(item.uid):transform(item.itemid + 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You first must play the instruments in correct order to get the access!")
end
else
player:setStorageValue(12109, 0)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You played them wrong, now you must begin with first again! ")
doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, Player(cid):getPosition(), 0, -20, -20, CONST_ME_GROUNDSHAKER)
end
return true
end
| gpl-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Bibiki_Bay/npcs/Mep_Nhapopoluko.lua | 19 | 1157 | -----------------------------------
-- Area: Bibiki Bay
-- NPC: Mep Nhapopoluko
-- Type: Guild Merchant NPC (Fishing Guild)
-- @pos 464.350 -6 752.731 4
-----------------------------------
package.loaded["scripts/zones/Bibiki_Bay/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/zones/Bibiki_Bay/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:sendGuild(519,1,18,5)) then
player:showText(npc, MEP_NHAPOPOLUKO_DIALOG);
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 |
The-HalcyonDays/darkstar | scripts/zones/Port_San_dOria/npcs/Pomilla.lua | 17 | 1693 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Pomilla
-- Involved in Quest: Lure of the Wildcat (San d'Oria)
-- @pos -38 -4 -55 232
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then
if(trade:hasItemQty(532,1) and trade:getItemCount() == 1) then -- Trade Magicmart_flyer
player:messageSpecial(FLYER_REFUSED);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local WildcatSandy = player:getVar("WildcatSandy");
if(player:getQuestStatus(SANDORIA,LURE_OF_THE_WILDCAT_SAN_D_ORIA) == QUEST_ACCEPTED and player:getMaskBit(WildcatSandy,11) == false) then
player:startEvent(0x02ed);
else
player:startEvent(0x0232);
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 == 0x02ed) then
player:setMaskBit(player:getVar("WildcatSandy"),"WildcatSandy",11,true);
end
end; | gpl-3.0 |
mamaddeveloper/ghs | plugins/minecraft.lua | 624 | 2605 | local usage = {
"!mine [ip]: Searches Minecraft server on specified ip and sends info. Default port: 25565",
"!mine [ip] [port]: Searches Minecraft server on specified ip and port and sends info.",
}
local ltn12 = require "ltn12"
local function mineSearch(ip, port, receiver) --25565
local responseText = ""
local api = "https://api.syfaro.net/server/status"
local parameters = "?ip="..(URL.escape(ip) or "").."&port="..(URL.escape(port) or "").."&players=true&favicon=true"
local http = require("socket.http")
local respbody = {}
local body, code, headers, status = http.request{
url = api..parameters,
method = "GET",
redirect = true,
sink = ltn12.sink.table(respbody)
}
local body = table.concat(respbody)
if (status == nil) then return "ERROR: status = nil" end
if code ~=200 then return "ERROR: "..code..". Status: "..status end
local jsonData = json:decode(body)
responseText = responseText..ip..":"..port.." ->\n"
if (jsonData.motd ~= nil) then
local tempMotd = ""
tempMotd = jsonData.motd:gsub('%§.', '')
if (jsonData.motd ~= nil) then responseText = responseText.." Motd: "..tempMotd.."\n" end
end
if (jsonData.online ~= nil) then
responseText = responseText.." Online: "..tostring(jsonData.online).."\n"
end
if (jsonData.players ~= nil) then
if (jsonData.players.max ~= nil) then
responseText = responseText.." Max Players: "..jsonData.players.max.."\n"
end
if (jsonData.players.now ~= nil) then
responseText = responseText.." Players online: "..jsonData.players.now.."\n"
end
if (jsonData.players.sample ~= nil and jsonData.players.sample ~= false) then
responseText = responseText.." Players: "..table.concat(jsonData.players.sample, ", ").."\n"
end
end
if (jsonData.favicon ~= nil and false) then
--send_photo(receiver, jsonData.favicon) --(decode base64 and send)
end
return responseText
end
local function parseText(chat, text)
if (text == nil or text == "!mine") then
return usage
end
ip, port = string.match(text, "^!mine (.-) (.*)$")
if (ip ~= nil and port ~= nil) then
return mineSearch(ip, port, chat)
end
local ip = string.match(text, "^!mine (.*)$")
if (ip ~= nil) then
return mineSearch(ip, "25565", chat)
end
return "ERROR: no input ip?"
end
local function run(msg, matches)
local chat_id = tostring(msg.to.id)
local result = parseText(chat_id, msg.text)
return result
end
return {
description = "Searches Minecraft server and sends info",
usage = usage,
patterns = {
"^!mine (.*)$"
},
run = run
} | gpl-2.0 |
otservme/global1053 | data/actions/scripts/gnomebase/crystalWarzone1.lua | 2 | 2068 | --- [[ Warzone 1 feito por Yuri Lagrotta ]] ---
local posdotp = {x= 33104, y=31908, z=10} -- Posicao que o tp vai ser criado (Eh o tp que leva pra sala do Deathstriker)
local salaDeathstriker = {x=33101, y=31956, z=10} -- Posicao da sala do Deathstriker (Pos pra onde o player vai qd entrar no tp)
local posDeathstriker = {x=33108, y=31968, z=10} -- Posicao onde o Deathstriker vai nascer.
function removerTp(tp)
local t = getTileItemById(posdotp, 1387)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(posdotp, CONST_ME_POFF)
end
end
function TirarCristal()
local cristal = getTileItemById(posdotp, 17999) -- Id do cristal azul que some para dar lugar ao tp
if cristal then
doRemoveItem(cristal.uid, 1)
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getGlobalStorageValue(96973) < 1) then
setGlobalStorageValue(96973, 1)
for i = 1, 6 do
for k = 1, 10 do
creatures = {
"humongous fungus",
"hideous fungus"
}
pos = {x = math.random(33091, 33101), y = math.random(31899, 31916), z = 10}
addEvent(doSummonCreature, i * 20 * 1000, creatures[math.random(1, 2)], pos)
addEvent(doSendMagicEffect, i * 20 * 1000, pos, CONST_ME_TELEPORT)
end
addEvent(doCreatureSay, i * 20 * 1000, cid, "The crystals are charging.", TALKTYPE_ORANGE_1, false, cid, toPosition)
end
doCreatureSay(cid, "The crystals are damaging!", TALKTYPE_ORANGE_1, false, cid, toPosition)
addEvent(doSummonCreature, 62000+6*20*1000, "Deathstrike", posDeathstriker)
addEvent(doSendMagicEffect, 6*20*1000, posDeathstriker, CONST_ME_TELEPORT)
addEvent(TirarCristal, 6*20*1000)
addEvent(doCreateTeleport, 100+6*20*1000, 1387, salaDeathstriker, posdotp)
addEvent(removerTp, 60000+6*20*1000)
addEvent(doCreateItem, 61000+6*20*1000, 17999, posdotp)
addEvent(setGlobalStorageValue, 6*20*1000 + 30*60*1000, 96973, 0)
else
doPlayerSendCancel(cid, "Wait 30 minutes to start again.")
end
return true
end | gpl-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Tahrongi_Canyon/npcs/Shattered_Telepoint.lua | 7 | 2224 | -----------------------------------
-- Area: Tahrongi_Canyon
-- NPC: Shattered Telepoint
-- @pos 179 35 255 117
-----------------------------------
package.loaded["scripts/zones/Tahrongi_Canyon/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Tahrongi_Canyon/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(COP) == BELOW_THE_ARKS and player:getVar("PromathiaStatus") == 1) then
player:startEvent(0x0391,0,0,1); -- first time in promy -> have you made your preparations cs
elseif (player:getCurrentMission(COP) == THE_MOTHERCRYSTALS and (player:hasKeyItem(LIGHT_OF_HOLLA) or player:hasKeyItem(LIGHT_OF_DEM))) then
if(player:getVar("cspromy2") == 1) then
player:startEvent(0x0390); -- cs you get nearing second promyvion
else
player:startEvent(0x391)
end
elseif (player:getCurrentMission(COP) > THE_MOTHERCRYSTALS or player:hasCompletedMission(COP,THE_LAST_VERSE) or (player:getCurrentMission(COP) == BELOW_THE_ARKS and player:getVar("PromathiaStatus") > 1)) then
player:startEvent(0x0391); -- normal cs (third promyvion and each entrance after having that promyvion visited or mission completed)
else
player:messageSpecial(TELEPOINT_HAS_BEEN_SHATTERED);
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 == 0x0390) then
player:setVar("cspromy2",0);
player:setVar("cs2ndpromy",1);
player:setPos(280.066, -80.635, -67.096, 191, 14); -- To Hall of Transference {R}
elseif (csid == 0x0391 and option == 0) then
player:setPos(280.066, -80.635, -67.096, 191, 14); -- To Hall of Transference {R}
end
end; | gpl-3.0 |
zhaozg/luvit | tests/test-tls-connect-simple.lua | 11 | 1050 |
require('tap')(function (test)
local fixture = require('./fixture-tls')
local tls = require('tls')
local options = {
cert = fixture.certPem,
key = fixture.keyPem
}
local serverConnected = 0
local clientConnected = 0
local server
local client1
test("tls connect simple test", function()
server = tls.createServer(options, function(conn)
serverConnected = serverConnected + 1
p('server accepted',serverConnected)
if (serverConnected == 1) then
server:close()
p('server closed')
conn:destroy()
end
end)
server:listen(fixture.commonPort, function()
p('server listening')
client1 = tls.connect({port = fixture.commonPort, host = '127.0.0.1'})
client1:on('connect', function()
p('client connected')
clientConnected = clientConnected + 1
end)
client1:on('error', function(err)
p(err)
client1:destroy()
end)
client1:on('end', function()
p('client end')
end)
end)
end)
end)
| apache-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Castle_Zvahl_Keep/npcs/_4i5.lua | 23 | 1492 | -----------------------------------
-- Area: Castle Zvahl Keep
-- NPC: Ore door
-- Involved In Quest: Recollections
-- @pos -14 0 69 162
-----------------------------------
package.loaded["scripts/zones/Castle_Zvahl_Keep/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/zones/Castle_Zvahl_Keep/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(player:getQuestStatus(WINDURST,RECOLLECTIONS) == QUEST_ACCEPTED and player:getVar("recollectionsQuest") == 2) then
if(trade:hasItemQty(1106,1) and trade:getItemCount() == 1) then
player:startEvent(0x0008,1106);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0009);
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);
if(csid == 0x0008) then
player:tradeComplete();
player:setVar("recollectionsQuest",3);
player:addKeyItem(FOE_FINDER_MK_I);
player:messageSpecial(KEYITEM_OBTAINED,FOE_FINDER_MK_I);
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Misareaux_Coast/npcs/_0p8.lua | 17 | 1776 | -----------------------------------
-- Area: Misareaux Coast
-- NPC: Iron Gate
-- Entrance to Sacrarium
-----------------------------------
package.loaded["scripts/zones/Misareaux_Coast/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Misareaux_Coast/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
local currentCoP = player:getCurrentMission(COP);
local PromathiaStatus = player:getVar("PromathiaStatus");
if(currentCoP == THE_SECRETS_OF_WORSHIP and PromathiaStatus == 1)then
player:startEvent(0x0009);
elseif(player:hasCompletedMission(COP,THE_LAST_VERSE) or (currentCoP == THE_SECRETS_OF_WORSHIP and PromathiaStatus >= 2)or(currentCoP > THE_SECRETS_OF_WORSHIP)) then
player:startEvent(0x01f6);
else
player:messageSpecial(DOOR_CLOSED);
end
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);
if(csid == 0x0009 and option == 1)then
player:setVar("PromathiaStatus",2);
player:setPos(-220.075,-15.999,79.634,62,28); -- To Sacrarium {R}
elseif(csid == 0x01f6 and option == 1) then
player:setPos(-220.075,-15.999,79.634,62,28); -- To Sacrarium {R}
end
end; | gpl-3.0 |
herman-rogers/xenia | third_party/capstone.lua | 10 | 1207 | group("third_party")
project("capstone")
uuid("b3a89f7e-bb02-4945-ae75-219caed6afa2")
kind("StaticLib")
language("C++")
links({
})
defines({
"CAPSTONE_X86_ATT_DISABLE",
"CAPSTONE_DIET_NO",
"CAPSTONE_X86_REDUCE_NO",
"CAPSTONE_HAS_X86",
"CAPSTONE_USE_SYS_DYN_MEM",
"_LIB",
})
includedirs({
"capstone",
"capstone/include",
})
files({
"capstone/cs.c",
"capstone/cs_priv.h",
"capstone/LEB128.h",
"capstone/MathExtras.h",
"capstone/MCDisassembler.h",
"capstone/MCFixedLenDisassembler.h",
"capstone/MCInst.c",
"capstone/MCInst.h",
"capstone/MCInstrDesc.c",
"capstone/MCInstrDesc.h",
"capstone/MCRegisterInfo.c",
"capstone/MCRegisterInfo.h",
"capstone/myinttypes.h",
"capstone/SStream.c",
"capstone/SStream.h",
"capstone/utils.c",
"capstone/utils.h",
"capstone/arch/X86/*.c",
"capstone/arch/X86/*.h",
"capstone/arch/X86/*.inc",
})
force_compile_as_cc({"capstone/**.c"})
filter("platforms:Linux")
-- Capstone code is... not fantastic.
buildoptions({
"-Wno-error=write-strings",
"-Wno-write-string",
"-Wno-deprecated",
"-w",
})
filter({})
| bsd-3-clause |
The-HalcyonDays/darkstar | scripts/zones/Castle_Oztroja/TextIDs.lua | 4 | 2162 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6564; -- You cannot obtain the item <item>. Come back after sorting your inventory.
FULL_INVENTORY_AFTER_TRADE = 6567; -- You cannot obtain the #. Try trading again after sorting your inventory.
ITEM_OBTAINED = 6568; -- Obtained: <item>.
GIL_OBTAINED = 6569; -- Obtained <number> gil.
KEYITEM_OBTAINED = 6571; -- Obtained key item: <keyitem>.
ITEMS_OBTAINED = 6574; -- You obtain
FISHING_MESSAGE_OFFSET = 7242; -- You can't fish here.
-- Other dialog
SENSE_OF_FOREBODING = 6583; -- You are suddenly overcome with a sense of foreboding...
NOTHING_OUT_OF_ORDINARY = 7750; -- There is nothing out of the ordinary here.
ITS_LOCKED = 1; -- It's locked.
PROBABLY_WORKS_WITH_SOMETHING_ELSE = 3; -- It probably works with something else.
TORCH_LIT = 5; -- The torch is lit.
-- Treasure Coffer/Chest Dialog
CHEST_UNLOCKED = 7407; -- You unlock the chest!
CHEST_FAIL = 7408; -- Fails to open the chest.
CHEST_TRAP = 7409; -- The chest was trapped!
CHEST_WEAK = 7410; -- You cannot open the chest when you are in a weakened state.
CHEST_MIMIC = 7411; -- The chest was a mimic!
CHEST_MOOGLE = 7412; -- You cannot open the chest while participating in the moogle event.
CHEST_ILLUSION = 7413; -- The chest was but an illusion...
CHEST_LOCKED = 7414; -- The chest appears to be locked.
YAGUDO_AVATAR_ENGAGE = 7428; -- Kahk-ka-ka... You filthy, dim-witted heretics! You have damned yourselves by coming here.
YAGUDO_AVATAR_DEATH = 7429; -- Our lord, Tzee Xicu the Manifest!Even should our bodies be crushed and broken, may our souls endure into eternity...
YAGUDO_KING_ENGAGE = 7430; -- You are not here as sacrifices, are you? Could you possibly be committing this affront in the face of a deity?Very well, I will personally mete out your divine punishment, kyah!
YAGUDO_KING_DEATH = 7431; -- You have...bested me... However, I...am...a god... I will never die...never rot...never fade...never...
-- conquest Base
CONQUEST_BASE = 26;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Talacca_Cove/Zone.lua | 28 | 1314 | -----------------------------------
--
-- Zone: Talacca_Cove (57)
--
-----------------------------------
package.loaded["scripts/zones/Talacca_Cove/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Talacca_Cove/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(64.007,-9.281,-99.988,88);
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 |
The-HalcyonDays/darkstar | scripts/zones/The_Celestial_Nexus/mobs/Eald_narche.lua | 18 | 2568 | -----------------------------------
-- Area: The Celestial Nexus
-- NPC: Eald'Narche - Phase 1
-- Zilart Mission 16 BCNM Fight
-----------------------------------
require("scripts/globals/titles");
require("scripts/globals/status");
require("scripts/globals/magic");
function onMobInitialize(mob)
--50% fast cast
mob:addMod(MOD_UFASTCAST, 50);
end
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
mob:SetAutoAttackEnabled(false);
mob:setMobMod(MOBMOD_STANDBACK_TIME, 0);
mob:setMobMod(MOBMOD_GA_CHANCE,25);
mob:addStatusEffectEx(EFFECT_PHYSICAL_SHIELD, 0, 1, 0, 0);
mob:addStatusEffectEx(EFFECT_ARROW_SHIELD, 0, 1, 0, 0);
mob:addStatusEffectEx(EFFECT_MAGIC_SHIELD, 0, 1, 0, 0);
end;
function onMobEngaged(mob, target)
mob:addStatusEffectEx(EFFECT_SILENCE, 0, 1, 0, 5);
GetMobByID(mob:getID() + 1):updateEnmity(target);
end;
function onMobFight(mob, target)
if (mob:getBattleTime() % 9 <= 2) then
local orbital1 = mob:getID()+3;
local orbital2 = mob:getID()+4;
if (GetMobAction(orbital1) == ACTION_NONE) then
GetMobByID(orbital1):setPos(mob:getPos());
SpawnMob(orbital1):updateEnmity(target);
elseif (GetMobAction(orbital2) == ACTION_NONE) then
GetMobByID(orbital2):setPos(mob:getPos());
SpawnMob(orbital2):updateEnmity(target);
end
end
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
DespawnMob(mob:getID()+1);
DespawnMob(mob:getID()+3);
DespawnMob(mob:getID()+4);
local battlefield = killer:getBattlefield();
killer:startEvent(0x7d04, battlefield:getBattlefieldNumber());
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("updateCSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,target)
--printf("finishCSID: %u",csid);
--printf("RESULT: %u",option);
if(csid == 0x7d04) then
DespawnMob(target:getID());
mob = SpawnMob(target:getID()+2);
mob:updateEnmity(player);
--the "30 seconds of rest" you get before he attacks you, and making sure he teleports first in range
mob:addStatusEffectEx(EFFECT_BIND, 0, 1, 0, 30);
mob:addStatusEffectEx(EFFECT_SILENCE, 0, 1, 0, 40);
end
end; | gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Yhoator_Jungle/npcs/Mugha_Dovajaiho.lua | 17 | 1848 | -----------------------------------
-- Area: Yhoator Jungle
-- NPC: Mugha Dovajaiho
-- @pos 202 0 -82 124
-----------------------------------
package.loaded["scripts/zones/Yhoator_Jungle/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Yhoator_Jungle/TextIDs");
local region = ELSHIMOUPLANDS;
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 |
The-HalcyonDays/darkstar | scripts/globals/weaponskills/realmrazer.lua | 30 | 1450 | -----------------------------------
-- Realmrazer
-- Club weapon skill
-- Skill Level: 357
-- Delivers a seven-hit attack. params.accuracy varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Shadow Gorget & Soil Gorget.
-- Aligned with the Shadow Belt & Soil Belt.
-- Element: None
-- Modifiers: MND:73~85%
-- 100%TP 200%TP 300%TP
-- .88 .88 .88
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 7;
params.ftp100 = 0.88; params.ftp200 = 0.88; params.ftp300 = 0.88;
params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.85 + (player:getMerit(MERIT_REALMRAZER) / 100); params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.8; params.acc200= 0.9; params.acc300= 1;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.mnd_wsc = 0.7 + (player:getMerit(MERIT_REALMRAZER) / 100);
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Exalted 3rd/output/rdkObjs/Ficha Exalted 3rd/DetailList.lfm.lua | 3 | 5630 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmDetailList()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmDetailList");
obj:setAlign("client");
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.scrollBox1);
obj.button1:setLeft(0);
obj.button1:setTop(0);
obj.button1:setWidth(25);
obj.button1:setHeight(25);
obj.button1:setText("+");
obj.button1:setHint("Adicionar");
obj.button1:setName("button1");
obj.rectangle1 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj.scrollBox1);
obj.rectangle1:setLeft(0);
obj.rectangle1:setTop(25);
obj.rectangle1:setWidth(240);
obj.rectangle1:setHeight(260);
obj.rectangle1:setColor("black");
obj.rectangle1:setName("rectangle1");
obj.rclSelector = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclSelector:setParent(obj.scrollBox1);
obj.rclSelector:setLeft(0);
obj.rclSelector:setTop(25);
obj.rclSelector:setWidth(240);
obj.rclSelector:setHeight(260);
obj.rclSelector:setName("rclSelector");
obj.rclSelector:setField("listaDeOpcoes");
obj.rclSelector:setTemplateForm("frmDataScopeSelectionForm");
obj.rclSelector:setLayout("vertical");
obj.rclSelector:setSelectable(true);
obj.boxDetalhesDoItem = GUI.fromHandle(_obj_newObject("dataScopeBox"));
obj.boxDetalhesDoItem:setParent(obj.scrollBox1);
obj.boxDetalhesDoItem:setLeft(250);
obj.boxDetalhesDoItem:setTop(25);
obj.boxDetalhesDoItem:setWidth(240);
obj.boxDetalhesDoItem:setHeight(260);
obj.boxDetalhesDoItem:setName("boxDetalhesDoItem");
obj.boxDetalhesDoItem:setVisible(false);
obj.rectangle2 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle2:setParent(obj.boxDetalhesDoItem);
obj.rectangle2:setAlign("client");
obj.rectangle2:setColor("black");
obj.rectangle2:setName("rectangle2");
obj.edit1 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit1:setParent(obj.boxDetalhesDoItem);
obj.edit1:setLeft(5);
obj.edit1:setTop(5);
obj.edit1:setWidth(230);
obj.edit1:setHeight(25);
obj.edit1:setField("nome");
obj.edit1:setName("edit1");
obj._e_event0 = obj.button1:addEventListener("onClick",
function (_)
self.rclSelector:append();
end, obj);
obj._e_event1 = obj.rclSelector:addEventListener("onCompare",
function (_, nodeA, nodeB)
-- Esse codigo organiza a ordem dos objetos da lista alfabeticamente.
return Utils.compareStringPtBr(nodeA.nome, nodeB.nome);
end, obj);
obj._e_event2 = obj.rclSelector:addEventListener("onSelect",
function (_)
local node = self.rclSelector.selectedNode;
self.boxDetalhesDoItem.node = node;
self.boxDetalhesDoItem.visible = (node ~= nil);
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event2);
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.boxDetalhesDoItem ~= nil then self.boxDetalhesDoItem:destroy(); self.boxDetalhesDoItem = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.rectangle2 ~= nil then self.rectangle2:destroy(); self.rectangle2 = nil; end;
if self.edit1 ~= nil then self.edit1:destroy(); self.edit1 = nil; end;
if self.rclSelector ~= nil then self.rclSelector:destroy(); self.rclSelector = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmDetailList()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmDetailList();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmDetailList = {
newEditor = newfrmDetailList,
new = newfrmDetailList,
name = "frmDetailList",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmDetailList = _frmDetailList;
Firecast.registrarForm(_frmDetailList);
return _frmDetailList;
| apache-2.0 |
The-HalcyonDays/darkstar | scripts/zones/The_Boyahda_Tree/npcs/HomePoint#1.lua | 12 | 1203 | -----------------------------------
-- Area: The Boyahda Tree
-- NPC: HomePoint#1
-- @pos 88 -15 -217 153
-----------------------------------
package.loaded["scripts/zones/The_Boyahda_Tree/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/The_Boyahda_Tree/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fc, 92);
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 == 0x21fc) then
if (option == 1) then
player:setHomePoint();
player:messageSpecial(HOMEPOINT_SET);
else
hpTeleport( player, option);
end
end
end; | gpl-3.0 |
otservme/global1053 | data/npc/scripts/Eva.lua | 2 | 14670 | local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local count = {}
local transfer = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
local lastSound = 0
function onThink()
if lastSound < os.time() then
lastSound = (os.time() + 5)
if math.random(100) < 25 then
Npc():say("Better deposit your money in the bank where it's safe.", TALKTYPE_SAY)
end
end
npcHandler:onThink()
end
local function greetCallback(cid)
count[cid], transfer[cid] = nil, nil
return true
end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
---------------------------- help ------------------------
if msgcontains(msg, 'bank account') then
npcHandler:say({
'Every Tibian has one. The big advantage is that you can access your money in every branch of the Tibian Bank! ...',
'Would you like to know more about the {basic} functions of your bank account, the {advanced} functions, or are you already bored, perhaps?'
}, cid)
npcHandler.topic[cid] = 0
return true
---------------------------- balance ---------------------
elseif msgcontains(msg, 'balance') then
npcHandler.topic[cid] = 0
if player:getBankBalance() >= 100000000 then
npcHandler:say('I think you must be one of the richest inhabitants in the world! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid)
return true
elseif player:getBankBalance() >= 10000000 then
npcHandler:say('You have made ten millions and it still grows! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid)
return true
elseif player:getBankBalance() >= 1000000 then
npcHandler:say('Wow, you have reached the magic number of a million gp!!! Your account balance is ' .. player:getBankBalance() .. ' gold!', cid)
return true
elseif player:getBankBalance() >= 100000 then
npcHandler:say('You certainly have made a pretty penny. Your account balance is ' .. player:getBankBalance() .. ' gold.', cid)
return true
else
npcHandler:say('Your account balance is ' .. player:getBankBalance() .. ' gold.', cid)
return true
end
---------------------------- deposit ---------------------
elseif msgcontains(msg, 'deposit') then
count[cid] = player:getMoney()
if count[cid] < 1 then
npcHandler:say('You do not have enough gold.', cid)
npcHandler.topic[cid] = 0
return false
end
if msgcontains(msg, 'all') then
count[cid] = player:getMoney()
npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid)
npcHandler.topic[cid] = 2
return true
else
if string.match(msg,'%d+') then
count[cid] = getMoneyCount(msg)
if count[cid] < 1 then
npcHandler:say('You do not have enough gold.', cid)
npcHandler.topic[cid] = 0
return false
end
npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid)
npcHandler.topic[cid] = 2
return true
else
npcHandler:say('Please tell me how much gold it is you would like to deposit.', cid)
npcHandler.topic[cid] = 1
return true
end
end
if not isValidMoney(count[cid]) then
npcHandler:say('Sorry, but you can\'t deposit that much.', cid)
npcHandler.topic[cid] = 0
return false
end
elseif npcHandler.topic[cid] == 1 then
count[cid] = getMoneyCount(msg)
if isValidMoney(count[cid]) then
npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid)
npcHandler.topic[cid] = 2
return true
else
npcHandler:say('You do not have enough gold.', cid)
npcHandler.topic[cid] = 0
return true
end
elseif npcHandler.topic[cid] == 2 then
if msgcontains(msg, 'yes') then
if player:getMoney() >= tonumber(count[cid]) then
player:depositMoney(count[cid])
npcHandler:say('Alright, we have added the amount of ' .. count[cid] .. ' gold to your {balance}. You can {withdraw} your money anytime you want to.', cid)
else
npcHandler:say('You do not have enough gold.', cid)
end
elseif msgcontains(msg, 'no') then
npcHandler:say('As you wish. Is there something else I can do for you?', cid)
end
npcHandler.topic[cid] = 0
return true
---------------------------- withdraw --------------------
elseif msgcontains(msg, 'withdraw') then
if string.match(msg,'%d+') then
count[cid] = getMoneyCount(msg)
if isValidMoney(count[cid]) then
npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid)
npcHandler.topic[cid] = 7
else
npcHandler:say('There is not enough gold on your account.', cid)
npcHandler.topic[cid] = 0
end
return true
else
npcHandler:say('Please tell me how much gold you would like to withdraw.', cid)
npcHandler.topic[cid] = 6
return true
end
elseif npcHandler.topic[cid] == 6 then
count[cid] = getMoneyCount(msg)
if isValidMoney(count[cid]) then
npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid)
npcHandler.topic[cid] = 7
else
npcHandler:say('There is not enough gold on your account.', cid)
npcHandler.topic[cid] = 0
end
return true
elseif npcHandler.topic[cid] == 7 then
if msgcontains(msg, 'yes') then
if player:getFreeCapacity() >= getMoneyWeight(count[cid]) then
if not player:withdrawMoney(count[cid]) then
npcHandler:say('There is not enough gold on your account.', cid)
else
npcHandler:say('Here you are, ' .. count[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid)
end
else
npcHandler:say('Whoah, hold on, you have no room in your inventory to carry all those coins. I don\'t want you to drop it on the floor, maybe come back with a cart!', cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') then
npcHandler:say('The customer is king! Come back anytime you want to if you wish to {withdraw} your money.', cid)
npcHandler.topic[cid] = 0
end
return true
---------------------------- transfer --------------------
elseif msgcontains(msg, 'transfer') then
npcHandler:say('Please tell me the amount of gold you would like to transfer.', cid)
npcHandler.topic[cid] = 11
elseif npcHandler.topic[cid] == 11 then
count[cid] = getMoneyCount(msg)
if player:getBankBalance() < count[cid] then
npcHandler:say('There is not enough gold on your account.', cid)
npcHandler.topic[cid] = 0
return true
end
if isValidMoney(count[cid]) then
npcHandler:say('Who would you like transfer ' .. count[cid] .. ' gold to?', cid)
npcHandler.topic[cid] = 12
else
npcHandler:say('There is not enough gold on your account.', cid)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 12 then
transfer[cid] = msg
if player:getName() == transfer[cid] then
npcHandler:say('Fill in this field with person who receives your gold!', cid)
npcHandler.topic[cid] = 0
return true
end
if playerExists(transfer[cid]) then
npcHandler:say('So you would like to transfer ' .. count[cid] .. ' gold to ' .. transfer[cid] .. '?', cid)
npcHandler.topic[cid] = 13
else
npcHandler:say('This player does not exist.', cid)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 13 then
if msgcontains(msg, 'yes') then
if not player:transferMoneyTo(transfer[cid], count[cid]) then
npcHandler:say('You cannot transfer money to this account.', cid)
else
npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. transfer[cid] ..'.', cid)
transfer[cid] = nil
end
elseif msgcontains(msg, 'no') then
npcHandler:say('Alright, is there something else I can do for you?', cid)
end
npcHandler.topic[cid] = 0
---------------------------- money exchange --------------
elseif msgcontains(msg, 'change gold') then
npcHandler:say('How many platinum coins would you like to get?', cid)
npcHandler.topic[cid] = 14
elseif npcHandler.topic[cid] == 14 then
if getMoneyCount(msg) < 1 then
npcHandler:say('Sorry, you do not have enough gold coins.', cid)
npcHandler.topic[cid] = 0
else
count[cid] = getMoneyCount(msg)
npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your gold coins into ' .. count[cid] .. ' platinum coins?', cid)
npcHandler.topic[cid] = 15
end
elseif npcHandler.topic[cid] == 15 then
if msgcontains(msg, 'yes') then
if player:removeItem(2148, count[cid] * 100) then
player:addItem(2152, count[cid])
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Sorry, you do not have enough gold coins.', cid)
end
else
npcHandler:say('Well, can I help you with something else?', cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'change platinum') then
npcHandler:say('Would you like to change your platinum coins into gold or crystal?', cid)
npcHandler.topic[cid] = 16
elseif npcHandler.topic[cid] == 16 then
if msgcontains(msg, 'gold') then
npcHandler:say('How many platinum coins would you like to change into gold?', cid)
npcHandler.topic[cid] = 17
elseif msgcontains(msg, 'crystal') then
npcHandler:say('How many crystal coins would you like to get?', cid)
npcHandler.topic[cid] = 19
else
npcHandler:say('Well, can I help you with something else?', cid)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 17 then
if getMoneyCount(msg) < 1 then
npcHandler:say('Sorry, you do not have enough platinum coins.', cid)
npcHandler.topic[cid] = 0
else
count[cid] = getMoneyCount(msg)
npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your platinum coins into ' .. count[cid] * 100 .. ' gold coins for you?', cid)
npcHandler.topic[cid] = 18
end
elseif npcHandler.topic[cid] == 18 then
if msgcontains(msg, 'yes') then
if player:removeItem(2152, count[cid]) then
player:addItem(2148, count[cid] * 100)
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Sorry, you do not have enough platinum coins.', cid)
end
else
npcHandler:say('Well, can I help you with something else?', cid)
end
npcHandler.topic[cid] = 0
elseif npcHandler.topic[cid] == 19 then
if getMoneyCount(msg) < 1 then
npcHandler:say('Sorry, you do not have enough platinum coins.', cid)
npcHandler.topic[cid] = 0
else
count[cid] = getMoneyCount(msg)
npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your platinum coins into ' .. count[cid] .. ' crystal coins for you?', cid)
npcHandler.topic[cid] = 20
end
elseif npcHandler.topic[cid] == 20 then
if msgcontains(msg, 'yes') then
if player:removeItem(2152, count[cid] * 100) then
player:addItem(2160, count[cid])
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Sorry, you do not have enough platinum coins.', cid)
end
else
npcHandler:say('Well, can I help you with something else?', cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'change crystal') then
npcHandler:say('How many crystal coins would you like to change into platinum?', cid)
npcHandler.topic[cid] = 21
elseif npcHandler.topic[cid] == 21 then
if getMoneyCount(msg) < 1 then
npcHandler:say('Sorry, you do not have enough crystal coins.', cid)
npcHandler.topic[cid] = 0
else
count[cid] = getMoneyCount(msg)
npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your crystal coins into ' .. count[cid] * 100 .. ' platinum coins for you?', cid)
npcHandler.topic[cid] = 22
end
elseif npcHandler.topic[cid] == 22 then
if msgcontains(msg, 'yes') then
if player:removeItem(2160, count[cid]) then
player:addItem(2152, count[cid] * 100)
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Sorry, you do not have enough crystal coins.', cid)
end
else
npcHandler:say('Well, can I help you with something else?', cid)
end
npcHandler.topic[cid] = 0
end
return true
end
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'We can {change} money for you. You can also access your {bank account}.'})
keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'There are three different coin types in Tibia: 100 gold coins equal 1 platinum coin, 100 platinum coins equal 1 crystal coin. So if you\'d like to change 100 gold into 1 platinum, simply say \'{change gold}\' and then \'1 platinum\'.'})
keywordHandler:addKeyword({'bank'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'We can {change} money for you. You can also access your {bank account}.'})
keywordHandler:addKeyword({'advanced'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Your bank account will be used automatically when you want to {rent} a house or place an offer on an item on the {market}. Let me know if you want to know about how either one works.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'})
keywordHandler:addKeyword({'functions'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'})
keywordHandler:addKeyword({'basic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I work in this bank. I can change money for you and help you with your bank account.'})
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Welcome |PLAYERNAME|! What business do you have in the Tibian bank today?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())
| gpl-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Ifrits_Cauldron/TextIDs.lua | 4 | 1658 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item>. Come back after sorting your inventory.
FULL_INVENTORY_AFTER_TRADE = 6382; -- You cannot obtain the #. Try trading again after sorting your inventory.
ITEM_OBTAINED = 6383; -- Obtained: <item>.
GIL_OBTAINED = 6384; -- Obtained <number> gil.
KEYITEM_OBTAINED = 6386; -- Obtained key item: <keyitem>.
ITEMS_OBTAINED = 6392; -- You obtain
HOMEPOINT_SET = 11496; -- Home point set!
-- Other dialog
NOTHING_OUT_OF_ORDINARY = 6397; -- There is nothing out of the ordinary here.
-- Altar of Ashes Dialog (unable to find csid)
ALTAR_COMPLETED = 7227; -- You have already made an offering today.
ALTAR_INSPECT = 7228; -- This looks like the altar where offerings are to be placed.
ALTAR_OFFERING = 7229; -- You place your offering of
ALTAR_STANDARD = 7230; -- It is an altar for offerings.
-- Treasure Coffer/Chest Dialog
CHEST_UNLOCKED = 7238; -- You unlock the chest!
CHEST_FAIL = 7239; -- Fails to open the chest.
CHEST_TRAP = 7240; -- The chest was trapped!
CHEST_WEAK = 7241; -- You cannot open the chest when you are in a weakened state.
CHEST_MIMIC = 7242; -- The chest was a mimic!
CHEST_MOOGLE = 7243; -- You cannot open the chest while participating in the moogle event.
CHEST_ILLUSION = 7244; -- The chest was but an illusion...
CHEST_LOCKED = 7245; -- The chest appears to be locked.
-- Mining
MINING_IS_POSSIBLE_HERE = 7246; -- Mining is possible here if you have
-- conquest Base
CONQUEST_BASE = 7038; -- Tallying conquest results...
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/globals/spells/bluemagic/ram_charge.lua | 27 | 1737 | -----------------------------------------
-- Spell: Ram Charge
-- Damage varies with TP
-- Spell cost: 79 MP
-- Monster Type: Beasts
-- Spell Type: Physical (Blunt)
-- Blue Magic Points: 4
-- Stat Bonus: HP+5
-- Level: 73
-- Casting Time: 0.5 seconds
-- Recast Time: 34.75 seconds
-- Skillchain Element(s): Fragmentation (can open/close Light with Fusion WSs and spells)
-- Combos: Lizard Killer
-----------------------------------------
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.tpmod = TPMOD_DAMAGE;
params.dmgtype = DMGTYPE_BLUNT;
params.scattr = SC_FRAGMENTATION;
params.numhits = 1;
params.multiplier = 1.0;
params.tp150 = 1.375;
params.tp300 = 1.75;
params.azuretp = 1.875;
params.duppercap = 75;
params.str_wsc = 0.3;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.0;
params.mnd_wsc = 0.5;
params.chr_wsc = 0.0;
damage = BluePhysicalSpell(caster, target, spell, params);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
-- Missing KNOCKBACK effect
return damage;
end; | gpl-3.0 |
Jereviendrai/telegram-bot | libs/mimetype.lua | 6 | 2586 | -- Thanks to https://github.com/catwell/lua-toolbox/blob/master/mime.types
do
local mimetype = {}
local types = {
["text/html"] = "html",
["text/css"] = "css",
["text/xml"] = "xml",
["image/gif"] = "gif",
["image/jpeg"] = "jpg",
["application/x-javascript"] = "js",
["application/atom+xml"] = "atom",
["application/rss+xml"] = "rss",
["text/mathml"] = "mml",
["text/plain"] = "txt",
["text/vnd.sun.j2me.app-descriptor"] = "jad",
["text/vnd.wap.wml"] = "wml",
["text/x-component"] = "htc",
["image/png"] = "png",
["image/tiff"] = "tiff",
["image/vnd.wap.wbmp"] = "wbmp",
["image/x-icon"] = "ico",
["image/x-jng"] = "jng",
["image/x-ms-bmp"] = "bmp",
["image/svg+xml"] = "svg",
["image/webp"] = "webp",
["application/java-archive"] = "jar",
["application/mac-binhex40"] = "hqx",
["application/msword"] = "doc",
["application/pdf"] = "pdf",
["application/postscript"] = "ps",
["application/rtf"] = "rtf",
["application/vnd.ms-excel"] = "xls",
["application/vnd.ms-powerpoint"] = "ppt",
["application/vnd.wap.wmlc"] = "wmlc",
["application/vnd.google-earth.kml+xml"] = "kml",
["application/vnd.google-earth.kmz"] = "kmz",
["application/x-7z-compressed"] = "7z",
["application/x-cocoa"] = "cco",
["application/x-java-archive-diff"] = "jardiff",
["application/x-java-jnlp-file"] = "jnlp",
["application/x-makeself"] = "run",
["application/x-perl"] = "pl",
["application/x-pilot"] = "prc",
["application/x-rar-compressed"] = "rar",
["application/x-redhat-package-manager"] = "rpm",
["application/x-sea"] = "sea",
["application/x-shockwave-flash"] = "swf",
["application/x-stuffit"] = "sit",
["application/x-tcl"] = "tcl",
["application/x-x509-ca-cert"] = "crt",
["application/x-xpinstall"] = "xpi",
["application/xhtml+xml"] = "xhtml",
["application/zip"] = "zip",
["application/octet-stream"] = "bin",
["audio/midi"] = "mid",
["audio/mpeg"] = "mp3",
["audio/ogg"] = "ogg",
["audio/x-m4a"] = "m4a",
["audio/x-realaudio"] = "ra",
["video/3gpp"] = "3gpp",
["video/mp4"] = "mp4",
["video/mpeg"] = "mpeg",
["video/quicktime"] = "mov",
["video/webm"] = "webm",
["video/x-flv"] = "flv",
["video/x-m4v"] = "m4v",
["video/x-mng"] = "mng",
["video/x-ms-asf"] = "asf",
["video/x-ms-wmv"] = "wmv",
["video/x-msvideo"] = "avi"
}
function mimetype.get_mime_extension(content_type)
return types[content_type]
end
function mimetype.get_content_type(extension)
for k,v in pairs(types) do
if v == extension then
return k
end
end
end
return mimetype
end | gpl-2.0 |
otservme/global1053 | data/npc/scripts/Yaman.lua | 2 | 4968 | local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local function getTable()
local list =
{
{id = 2201, buy = 1000, sell = 100, name = 'Dragon Necklace'},
{id = 2213, buy = 2000, sell = 100, name = 'Dwarven Ring'},
{id = 2167, buy = 2000, sell = 100, name = 'Energy Ring'},
{id = 2168, buy = 900, sell = 50, name = 'Life Ring'},
{id = 2164, buy = 5000, sell = 250, name = 'Might Ring'},
{id = 2200, buy = 700, sell = 100, name = 'Protection Amulet'},
{id = 2216, buy = 2000, sell = 100, name = 'Ring of Healing'},
{id = 2170, buy = 100, sell = 50, name = 'Silver Amulet'},
{id = 2161, buy = 100, sell = 30, name = 'Strange Talisman'},
{id = 2169, buy = 2000, sell = 100, name = 'Time Ring'},
{id = 2327, buy = 0, sell = 100, name = 'Ankh'},
{id = 18412, buy = 0, sell = 6500, name = 'Glacial Rod'},
{id = 2183, buy = 0, sell = 3000, name = 'Hailstorm Rod'},
{id = 2186, buy = 0, sell = 200, name = 'Moonlight Rod'},
{id = 18411, buy = 0, sell = 6000, name = 'Muck Rod'},
{id = 2194, buy = 0, sell = 50, name = 'Mysterious Fetish'},
{id = 2185, buy = 0, sell = 1000, name = 'Necrotic Rod'},
{id = 8911, buy = 0, sell = 1500, name = 'Northwind Rod'},
{id = 2182, buy = 0, sell = 100, name = 'Snakebite Rod'},
{id = 8912, buy = 0, sell = 3600, name = 'Springsprout Rod'},
{id = 2181, buy = 0, sell = 2000, name = 'Terra Rod'},
{id = 8910, buy = 0, sell = 4400, name = 'Underworld Rod'}
}
return list
end
function creatureSayCallback(cid, type, msg)
local player = Player(cid)
if(msg == "DJANNI'HAH" or (player:getStorageValue(GreenDjinn.MissionEnd) >= 3 and msg == "hi")) then
npcHandler:addFocus(cid)
npcHandler:say("Be greeted, human " .. player:getName() .. ". How can a humble djinn be of service?", player)
end
if(not npcHandler:isFocused(cid)) then
return false
end
if (msgcontains(msg, "bye") or msgcontains(msg, "farewell")) then
npcHandler:say("Finally.", player)
npcHandler.topic[cid] = 0
npcHandler:releaseFocus(cid)
elseif isInArray({"enchanted chicken wing", "boots of haste"}, msg:lower()) then
npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wind?', cid)
npcHandler.topic[cid] = 1
elseif isInArray({"warrior Sweat", "warrior helmet"}, msg:lower()) then
npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
npcHandler.topic[cid] = 2
elseif isInArray({"fighting Spirit", "royal helmet"}, msg:lower()) then
npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
npcHandler.topic[cid] = 3
elseif isInArray({"magic sulphur", "fire sword"}, msg:lower()) then
npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
npcHandler.topic[cid] = 4
elseif isInArray({"job", "items"}, msg:lower()) then
npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
npcHandler.topic[cid] = 0
elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then
local trade = {
{NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
{NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
{NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
{NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}, -- Magic Sulphur
}
if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
return npcHandler:say(msg,'Here you are')
else
npcHandler:say('Sorry but you don\'t have the item', player)
end
elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
npcHandler:say(msg,'Ok then', player)
npcHandler.topic[cid] = 0
npcHandler:releaseFocus(cid)
end
return true
end
local function onTradeRequest(cid)
TradeRequest(cid, npcHandler, getTable(), GreenDjinn, 4)
end
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
| gpl-2.0 |
mdave88/luabind | examples/glut/glut_bindings.lua | 38 | 1543 | quit = false
function resize_func(w, h)
local ratio = w / h
print('====== resize')
glMatrixMode(gl.PROJECTION)
glLoadIdentity()
glViewport(0,0,w,h)
gluPerspective(45,ratio,1,1000)
glMatrixMode(gl.MODELVIEW)
glLoadIdentity()
end
angle = 0
angle2 = 0
previous_time = 0
function display_func()
if quit then return end
local cur_time = glutGet(glut.ELAPSED_TIME)
local delta = (cur_time - previous_time) / 1000
previous_time = cur_time
glClear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT)
glPushMatrix()
glTranslate(0,0,-5)
glRotate(angle, 0, 1, 0)
glRotate(angle2, 0, 0, 1)
glColor3(1,0,0)
-- glutWireSphere(0.75, 10, 10)
glutSolidTeapot(0.75)
-- glColor3(1,1,1)
-- glutWireTeapot(0.75)
glPopMatrix()
angle = angle + 200 * delta
angle2 = angle2 + 170 * delta
frames = frames + 1
if math.mod(frames, 100) == 0 then
local fps = frames * 1000 / (glutGet(glut.ELAPSED_TIME) - start_time);
print('fps: ' .. fps .. ' time: ' .. glutGet(glut.ELAPSED_TIME) .. ' frames: ' .. frames)
end
glutSwapBuffers()
end
function keyboard_func(key,x,y)
print('keyboard' .. key)
if key == 27 then glutDestroyWindow(window) quit = true end
end
glutInitWindowSize(600,600)
glutInitWindowPosition(0,0)
glutInitDisplayMode(glut.RGB + glut.DOUBLE + glut.DEPTH)
window = glutCreateWindow("luabind, glut-bindings")
glutDisplayFunc(display_func)
glutIdleFunc(display_func)
glutKeyboardFunc(keyboard_func)
glutReshapeFunc(resize_func)
resize_func(600,600)
start_time = glutGet(glut.ELAPSED_TIME)
frames = 0
glutMainLoop()
| mit |
Stanzilla/prat-3-0 | services/textcolor.lua | 1 | 5671 | ---------------------------------------------------------------------------------
--
-- Prat - A framework for World of Warcraft chat mods
--
-- Copyright (C) 2006-2011 Prat Development Team
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to:
--
-- Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor,
-- Boston, MA 02110-1301, USA.
--
--
-------------------------------------------------------------------------------
--[[ BEGIN STANDARD HEADER ]] --
-- Imports
local _G = _G
local tostring = tostring
local select = select
local type = type
local table = table
local math = math
local string = string
-- Isolate the environment
setfenv(1, select(2, ...))
--[[ END STANDARD HEADER ]] --
CLR = {}
CLR.DEFAULT = "ffffff" -- default to white
CLR.LINK = {
"|cff", CLR.DEFAULT, "", "|r"
}
CLR.COLOR_NONE = nil
local function get_default_color()
return 1.0, 1.0, 1.0, 1.0
end
local function get_color(c)
if type(c.r) == "number" and type(c.g) == "number" and type(c.b) == "number" and type(c.a) == "number" then
return c.r, c.g, c.b, c.a
end
if type(c.r) == "number" and type(c.g) == "number" and type(c.b) == "number" then
return c.r, c.g, c.b, 1.0
end
return get_default_color()
end
local function get_var_color(a1, a2, a3, a4)
local r, g, b, a
if type(a1) == "table" then
r, g, b, a = get_color(a1)
elseif type(a1) == "number" and type(a2) == "number" and type(a3) == "number" and type(a4) == "number" then
r, g, b, a = a1, a2, a3, a4
elseif type(a1) == "number" and type(a2) == "number" and type(a3) == "number" and type(a4) == "nil" then
r, g, b, a = a1, a2, a3, 1.0
else
r, g, b, a = get_default_color()
end
return r, g, b, a
end
-- CLR:GetHexColor(color or cr, cg, cb)
local function mult_255(r, g, b, a)
return r * 255, g * 255, b * 255, a
end
function CLR:GetHexColor(a1, a2, a3, a4)
return string.format("%02x%02x%02x", mult_255(get_var_color(a1, a2, a3, a4)))
end
function CLR:GetHashColor(text)
local hash = 17
for i=1,text:len() do
hash = hash * 37 * text:byte(i)
end
local r = math.floor(math.fmod(hash / 97, 255));
local g = math.floor(math.fmod(hash / 17, 255));
local b = math.floor(math.fmod(hash / 227, 255));
if ((r * 299 + g * 587 + b * 114) / 1000) < 105 then
r = math.abs(r - 255);
g = math.abs(g - 255);
b = math.abs(b - 255);
end
return ("%02x%02x%02x"):format(r, g, b)
end
function CLR:Random(text)
return CLR:Colorize(self:GetHashColor(text), text)
end
function CLR:Colorize(hexColor, text)
if text == nil or text == "" then
return ""
end
local color = hexColor
if type(hexColor) == "table" then
color = self:GetHexColor(hexColor)
end
if color == CLR.COLOR_NONE then
return text
end
local link = CLR.LINK
link[2] = tostring(color or 'ffffff')
link[3] = text
return table.concat(link, "")
end
local function desat_chan(c) return ((c or 1.0) * 192 * 0.8 + 63) / 255 end
function CLR:Desaturate(a1, a2, a3, a4)
local r, g, b, a = get_var_color(a1, a2, a3, a4)
r = desat_chan(r)
g = desat_chan(g)
b = desat_chan(b)
return r, g, b, a
end
-- Not sure if the follow are used, i got them from either rock or crayon.
function CLR:RGBtoHSL(red, green, blue)
local hue, saturation, luminance
local minimum = math.min(red, green, blue)
local maximum = math.max(red, green, blue)
local difference = maximum - minimum
luminance = (maximum + minimum) / 2
if difference == 0 then --Greyscale
hue = 0
saturation = 0
else --Colour
if luminance < 0.5 then
saturation = difference / (maximum + minimum)
else
saturation = difference / (2 - maximum - minimum)
end
local tmpRed = (((maximum - red) / 6) + (difference / 2)) / difference
local tmpGreen = (((maximum - green) / 6) + (difference / 2)) / difference
local tmpBlue = (((maximum - blue) / 6) + (difference / 2)) / difference
if red == maximum then
hue = tmpBlue - tmpGreen
elseif green == maximum then
hue = (1 / 3) + tmpRed - tmpBlue
elseif blue == maximum then
hue = (2 / 3) + tmpGreen - tmpRed
end
hue = hue % 1
if hue < 0 then hue = hue + 1 end
end
return hue, saturation, luminance
end
function CLR:HSLtoRGB(hue, saturation, luminance)
local red, green, blue
if (S == 0) then
red, green, blue = luminance, luminance, luminance
else
if luminance < 0.5 then
var2 = luminance * (1 + saturation)
else
var2 = (luminance + saturation) - (saturation * luminance)
end
var1 = 2 * luminance - var2
red = self:HueToColor(var1, var2, hue + (1 / 3))
green = self:HueToColor(var1, var2, hue)
blue = self:HueToColor(var1, var2, hue - (1 / 3))
end
return red, green, blue
end
function CLR:HueToColor(var1, var2, hue)
hue = hue % 1
if hue < 0 then hue = hue + 1 end
if (6 * hue) < 1 then
return hue + (var2 - var1) * 6 * hue
elseif (2 * hue) < 1 then
return var2
elseif (3 * hue) < 2 then
return var1 + (var2 - var1) * ((2 / 3) - hue) * 6
else
return var1
end
end
| gpl-3.0 |
vasilenkomike/tarantool | test/big/tree_pk.test.lua | 6 | 4665 | dofile('utils.lua')
s0 = box.schema.space.create('tweedledum')
i0 = s0:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true })
bsize = i0:bsize()
-- integer keys
s0:insert{1, 'tuple'}
box.snapshot()
s0:insert{2, 'tuple 2'}
box.snapshot()
i0:bsize() > bsize
s0:insert{3, 'tuple 3'}
s0.index['primary']:get{1}
s0.index['primary']:get{2}
s0.index['primary']:get{3}
-- Cleanup
s0:delete{1}
s0:delete{2}
s0:delete{3}
-- Test incorrect keys - supplied key field type does not match index type
-- https://bugs.launchpad.net/tarantool/+bug/1072624
s0:insert{'xxxxxxx'}
s0:insert{''}
s0:insert{'12'}
s1 = box.schema.space.create('tweedledee')
i1 = s1:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true })
s2 = box.schema.space.create('alice')
i2 = s2:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true })
-- string keys
s1:insert{'identifier', 'tuple'}
box.snapshot()
s1:insert{'second', 'tuple 2'}
box.snapshot()
s1.index['primary']:select('second', { limit = 100, iterator = 'GE' })
s1.index['primary']:select('identifier', { limit = 100, iterator = 'GE' })
s1:insert{'third', 'tuple 3'}
s1.index['primary']:get{'identifier'}
s1.index['primary']:get{'second'}
s1.index['primary']:get{'third'}
-- Cleanup
s1:delete{'identifier'}
s1:delete{'second'}
s1:delete{'third'}
--# setopt delimiter ';'
function crossjoin(space0, space1, limit)
local result = {}
for state, v0 in space0:pairs() do
for state, v1 in space1:pairs() do
if limit <= 0 then
return result
end
local newtuple = v0:totable()
for _, v in v1:pairs() do
table.insert(newtuple, v)
end
table.insert(result, box.tuple.new(newtuple))
limit = limit - 1
end
end
return result
end;
--# setopt delimiter ''
s2:insert{'1', 'tuple'}
s1:insert{'1', 'tuple'}
s1:insert{'2', 'tuple'}
crossjoin(s1, s1, 0)
crossjoin(s1, s1, 5)
crossjoin(s1, s1, 10000)
crossjoin(s1, s2, 10000)
s1:truncate()
s2:truncate()
-- Bug #922520 - select missing keys
s0:insert{200, 'select me!'}
s0.index['primary']:get{200}
s0.index['primary']:get{199}
s0.index['primary']:get{201}
-- Test partially specified keys in TREE indexes
s1:insert{'abcd'}
s1:insert{'abcda'}
s1:insert{'abcda_'}
s1:insert{'abcdb'}
s1:insert{'abcdb_'}
s1:insert{'abcdb__'}
s1:insert{'abcdb___'}
s1:insert{'abcdc'}
s1:insert{'abcdc_'}
box.sort(s1.index['primary']:select('abcdb', { limit = 3, iterator = 'GE' }))
s1:drop()
s1 = nil
s2:drop()
s2 = nil
--
-- tree::replace tests
--
s0:truncate()
i1 = s0:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = true })
i2 = s0:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false })
i3 = s0:create_index('i3', { type = 'tree', parts = {4, 'num'}, unique = true })
s0:insert{0, 0, 0, 0}
s0:insert{1, 1, 1, 1}
s0:insert{2, 2, 2, 2}
-- OK
s0:replace{1, 1, 1, 1}
s0:replace{1, 10, 10, 10}
s0:replace{1, 1, 1, 1}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['primary']:get{1}
s0.index['i1']:select{1}
s0.index['i2']:select{1}
s0.index['i3']:select{1}
-- OK
s0:insert{10, 10, 10, 10}
s0:delete{10}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
-- TupleFound (primary key)
s0:insert{1, 10, 10, 10}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['primary']:get{1}
-- TupleNotFound (primary key)
s0:replace{10, 10, 10, 10}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
-- TupleFound (key #1)
s0:insert{10, 0, 10, 10}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['i1']:select{0}
-- TupleFound (key #1)
s0:replace{2, 0, 10, 10}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['i1']:select{0}
-- TupleFound (key #3)
s0:insert{10, 10, 10, 0}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['i3']:select{0}
-- TupleFound (key #3)
s0:replace{2, 10, 10, 0}
s0.index['primary']:get{10}
s0.index['i1']:select{10}
s0.index['i2']:select{10}
s0.index['i3']:select{10}
s0.index['i3']:select{0}
-- Non-Uniq test (key #2)
s0:insert{4, 4, 0, 4}
s0:insert{5, 5, 0, 5}
s0:insert{6, 6, 0, 6}
s0:replace{5, 5, 0, 5}
box.sort(s0.index['i2']:select(0))
s0:delete{5}
box.sort(s0.index['i2']:select(0))
s0:drop()
s0 = nil
| bsd-2-clause |
drix/jagg | src/scenes/start.lua | 1 | 9520 | -------------------------------------------------------------------------
-- Created by Adriano Spadoni
-- alte_br@hotmail.com
-------------------------------------------------------------------------
local physics = require( "physics" )
local widget = require( "widget" )
local soundManager = require( "sounds.manager" )
local composer = require( "composer" )
local scene = composer.newScene()
-- properties
scene.shouldAcumulateGems = true
scene.gemsLimit = 80
scene.gemsGroup = nil
scene.reload = 10
scene.gems = 0
scene.music = nil
-- GUI
scene.background = nil
scene.btNewgame = nil
scene.gear = nil
scene.logo = nil
scene.floor = nil
scene.wallleft = nil
scene.wallright = nil
scene.roof = nil
local newgameSheet = graphics.newImageSheet("images/newgame.png", {height=46, width=189, numFrames=2, sheetContentWidth=189, sheetContentHeight=92})
local object = display.newRect( 15, 100, 25, 300 )
local composide = {
type="composite",
paint1={ type="image", filename="images/health-full.png" },
paint2={ type="image", filename="images/health-full-n.png" }
}
local lightPosY = 0
local lightDir = 0.02
object.fill = composide
object.fill.effect = "composite.normalMapWith1DirLight"
object.fill.effect.dirLightDirection = { 1, lightPosY, 1 }
object.fill.effect.dirLightColor = { 0.8, 0.8, 0.8, 0.8 }
object.fill.effect.ambientLightIntensity = 1.2
Runtime:addEventListener( "enterFrame", function( ... )
--object.fill.effect.dirLightDirection= { 1, 0, 1 }
lightPosY = (lightPosY + lightDir)
object.fill.effect.dirLightDirection = { lightPosY, 0, 1 }
--object.fill.effect.ambientLightIntensity = lightPosY
if(lightPosY >= 1) then lightDir = -0.02 end
if(lightPosY <= 0) then lightDir = 0.02 end
end )
------- Event Listeners ---------------
local listenerOnEnterFrame = nil
local function enterFrame( self, event )
-- animate gear
if not self.gear == nil then
self.gear.rotation = scene.gear.rotation + 2
end
-- animate buttons
self.btNewgame.y = self.btNewgame.fixY + math.sin( system.getTimer() * .2 ) * 1.2
-- create new gems
self.reload = self.reload - 1
if (self.reload < 1) then
self.reload = 10
self:createGem()
end
end
local listenerOnCollision = nil
local function onCollision( self, event )
if ( event.phase == "ended" ) then
if (event.object1 == self.floor) then
timer.performWithDelay(1,function ( ... )
-- if the scene has been destroyed already (only edge cases but...)
if not (self.floor) then return end
-- remove gem with in the next cicle
if (event.object2 and event.object2.isGem) then
event.object2:removeSelf( )
self.gems = self.gems - 1
end
end)
end
end
end
local function listenerOnAccelerate( event )
physics.setGravity( 10 * event.xGravity, -10 * event.yGravity )
end
-----------------------------------------------
-- *** COMPOSER SCENE EVENT FUNCTIONS ***
------------------------------------------------
function scene:create( event )
print('scene:create start')
local group = self.view
-- background
self.background = display.newImageRect("images/background-intro.png", display.contentWidth,display.contentHeight)
self.background.anchorX = 0
self.background.anchorY = 0
self.background.x = 0
self.background.y = 0
group:insert(self.background)
-- gear
self.gear = display.newImageRect("images/gear.png", 80, 80)
self.gear.x = (display.contentWidth/2)
self.gear.y = (display.contentHeight * 0.2)
group:insert(self.gear)
-- falling gems
self.gemsGroup = display.newGroup( )
self.floor = display.newRect(0,_H + 50,_W,30)
self.floor:setFillColor( 0,0,0,1 )
self.floor.anchorX = 0
self.gemsGroup:insert( self.floor )
self.wallleft = display.newRect(-30,0,30,_H + 50)
self.wallleft:setFillColor( 0,0,0,1 )
self.wallleft.anchorY = 0
self.gemsGroup:insert( self.wallleft )
self.wallright = display.newRect(0,0,30,_H+ 50)
self.wallright:setFillColor( 0,0,0,1 )
self.wallright.anchorY = 0
self.wallright.x = _W + 30
self.roof = display.newRect(0,-40,_W,30)
self.roof:setFillColor( 0,0,0,1 )
self.roof.anchorX = 0
self.gemsGroup:insert( self.roof )
group:insert(self.gemsGroup)
-- logo
self.logo = display.newImageRect("images/logo.png", 205, 90)
self.logo.x = (display.contentWidth/2) - 1
self.logo.y = (display.contentHeight * 0.2 + 20)
group:insert(self.logo)
-- button start
self.btNewgame = widget.newButton( {
self=self,width=189, height=46,
sheet=newgameSheet, defaultFrame=2, overFrame=1,
onRelease=function(...) self.startNewgame(self,...) end
})
self.btNewgame.x = (display.contentWidth/2)
self.btNewgame.y = (display.contentHeight * 0.8)
self.btNewgame.fixY = (display.contentHeight * 0.8)
group:insert(self.btNewgame)
-- listeners
listenerOnEnterFrame = function ( ... ) enterFrame(self, ...) end
listenerOnCollision = function ( ... ) onCollision(self, ...) end
self.logo.isSleepingAllowed = false
self.logo.isSensor = true
self.gear.isSensor = true
self.floor.isSensor = (true ~= self.shouldAcumulateGems)
end
function scene:show( event )
print('scene:show start')
local phase = event.phase
local group = self.view
if ( phase == "will" ) then
physics.start()
physics.setGravity( 0, 9.81 )
--physics.setDrawMode("hybrid")
local logoCollisionFilter = { categoryBits=1, maskBits=0 }
physics.addBody( self.logo, "dynamic", {density=1.0, friction=0.5, bounce=0.1, filter=logoCollisionFilter } )
physics.addBody( self.gear, "static", {density=1.0, friction=0.5, bounce=0.1, filter=logoCollisionFilter } )
physics.newJoint( "pivot", self.gear, self.logo,self.gear.x+1, self.gear.y-20 )
physics.addBody( self.btNewgame, "static", {shape={ 0,5, 95,0, 190,35, 190,5, 0,35},density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.floor, "static", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.wallleft, "static", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.wallright, "static", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.roof, "static", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.btNewgame, "static", {shape={ 0,5, 95,0, 190,35, 190,5, 0,35},density=1.0, friction=0.5, bounce=0.1} )
-- music
self.music = _G.soundManager:play("intro",{ loops=-1,volume=.1,channel=1 })
audio.setVolume( .3, {channel=1} )
elseif ( phase == "did" ) then
-- listeners
--Runtime:addEventListener( "accelerometer", listenerOnAccelerate )
Runtime:addEventListener( "enterFrame", listenerOnEnterFrame )
if not (self.shouldAcumulateGems) then
Runtime:addEventListener( "collision", listenerOnCollision )
end
end
end
function scene:hide( event )
print('scene:hide start')
-- remove listeners
Runtime:removeEventListener( "enterFrame", listenerOnEnterFrame )
Runtime:removeEventListener( "collision", listenerOnCollision )
--Runtime:removeEventListener( "accelerometer", listenerOnAccelerate )
-- animations on exit
self.floor.bodyType = "dynamic"
physics.addBody( self.btNewgame, "dynamic", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.logo, "dynamic", {density=1.0, friction=0.5, bounce=0.1} )
physics.addBody( self.gear, "dynamic", {density=1.0, friction=0.5, bounce=0.1} )
end
function scene:destroy( event )
print('scene:destroy start')
listenerOnEnterFrame = nil
listenerOnCollision = nil
physics.setGravity( 0, 9.81 )
physics.stop()
end
-----------------------------------------------
-- Game function
-----------------------------------------------
function scene:move( event )
local body = event.target
local phase = event.phase
local stage = display.getCurrentStage()
if "began" == phase then
stage:setFocus( body, event.id )
body.isFocus = true
body.tempJoint = physics.newJoint( "touch", body, event.x, event.y )
elseif body.isFocus then
if "moved" == phase then
-- Update the joint to track the touch
body.tempJoint:setTarget( event.x, event.y )
elseif "ended" == phase or "cancelled" == phase then
stage:setFocus( body, nil )
body.isFocus = false
-- Remove the joint when the touch ends
body.tempJoint:removeSelf()
end
end
-- Stop further propagation of touch event
return true
end
function scene:createGem( )
if (self.gems < self.gemsLimit) then
local gem = display.newImageRect(_G.gemsSheet, math.random(1,5), 30, 30)
gem.x = self.gear.x
gem.y = self.gear.y
self.gems = self.gems + 1
self.gemsGroup:insert( gem )
physics.addBody( gem, "dynamic", {radius=15,density=1.0, friction=0.5, bounce=0.1} )
gem:applyForce( -40 + 80 * math.random(), -30 + 60 * math.random(), gem.x, gem.y )
gem:addEventListener( "touch", function(...) self:move(...) end )
end
end
function scene:startNewgame( event )
print('scene:startNewgame')
audio.fadeOut({ channel=self.music, time=3000 })
_G.soundManager:play("pop")
composer.gotoScene( "scenes.game", "fade", 500 )
end
-----------------------------------------------
-- Add the story board event listeners
-----------------------------------------------
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
return scene | mit |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Pathfinder/output/rdkObjs/FichaPathfinder/04.Habilidades.lfm.lua | 3 | 13319 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmFichaRPGmeister4_svg()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmFichaRPGmeister4_svg");
obj:setAlign("client");
obj:setTheme("dark");
obj:setMargins({top=1});
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.layout1 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout1:setParent(obj.scrollBox1);
obj.layout1:setLeft(0);
obj.layout1:setTop(0);
obj.layout1:setWidth(380);
obj.layout1:setHeight(295);
obj.layout1:setName("layout1");
obj.rectangle1 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj.layout1);
obj.rectangle1:setAlign("client");
obj.rectangle1:setColor("#0000007F");
obj.rectangle1:setName("rectangle1");
obj.label1 = GUI.fromHandle(_obj_newObject("label"));
obj.label1:setParent(obj.layout1);
obj.label1:setLeft(0);
obj.label1:setTop(0);
obj.label1:setWidth(380);
obj.label1:setHeight(20);
obj.label1:setText("TALENTOS");
obj.label1:setHorzTextAlign("center");
obj.label1:setName("label1");
obj.rclListaDosTalentos = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclListaDosTalentos:setParent(obj.layout1);
obj.rclListaDosTalentos:setName("rclListaDosTalentos");
obj.rclListaDosTalentos:setField("campoDosTalentos");
obj.rclListaDosTalentos:setTemplateForm("frmFichaRPGmeister4h_svg");
obj.rclListaDosTalentos:setLeft(5);
obj.rclListaDosTalentos:setTop(25);
obj.rclListaDosTalentos:setWidth(370);
obj.rclListaDosTalentos:setHeight(265);
obj.rclListaDosTalentos:setLayout("vertical");
obj.layout2 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout2:setParent(obj.scrollBox1);
obj.layout2:setLeft(0);
obj.layout2:setTop(305);
obj.layout2:setWidth(380);
obj.layout2:setHeight(295);
obj.layout2:setName("layout2");
obj.rectangle2 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle2:setParent(obj.layout2);
obj.rectangle2:setAlign("client");
obj.rectangle2:setColor("#0000007F");
obj.rectangle2:setName("rectangle2");
obj.label2 = GUI.fromHandle(_obj_newObject("label"));
obj.label2:setParent(obj.layout2);
obj.label2:setLeft(0);
obj.label2:setTop(0);
obj.label2:setWidth(380);
obj.label2:setHeight(20);
obj.label2:setText("PROEZAS");
obj.label2:setHorzTextAlign("center");
obj.label2:setName("label2");
obj.rclListaDasProezas = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclListaDasProezas:setParent(obj.layout2);
obj.rclListaDasProezas:setName("rclListaDasProezas");
obj.rclListaDasProezas:setField("campoDasProezas");
obj.rclListaDasProezas:setTemplateForm("frmFichaRPGmeister4h_svg");
obj.rclListaDasProezas:setLeft(5);
obj.rclListaDasProezas:setTop(25);
obj.rclListaDasProezas:setWidth(370);
obj.rclListaDasProezas:setHeight(265);
obj.rclListaDasProezas:setLayout("vertical");
obj.layout3 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout3:setParent(obj.scrollBox1);
obj.layout3:setLeft(395);
obj.layout3:setTop(0);
obj.layout3:setWidth(380);
obj.layout3:setHeight(600);
obj.layout3:setName("layout3");
obj.rectangle3 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle3:setParent(obj.layout3);
obj.rectangle3:setAlign("client");
obj.rectangle3:setColor("#0000007F");
obj.rectangle3:setName("rectangle3");
obj.label3 = GUI.fromHandle(_obj_newObject("label"));
obj.label3:setParent(obj.layout3);
obj.label3:setLeft(0);
obj.label3:setTop(0);
obj.label3:setWidth(380);
obj.label3:setHeight(20);
obj.label3:setText("OUTROS");
obj.label3:setHorzTextAlign("center");
obj.label3:setName("label3");
obj.rclListaDosOutros = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclListaDosOutros:setParent(obj.layout3);
obj.rclListaDosOutros:setName("rclListaDosOutros");
obj.rclListaDosOutros:setField("campoDosOutros");
obj.rclListaDosOutros:setTemplateForm("frmFichaRPGmeister4h_svg");
obj.rclListaDosOutros:setLeft(5);
obj.rclListaDosOutros:setTop(25);
obj.rclListaDosOutros:setWidth(370);
obj.rclListaDosOutros:setHeight(570);
obj.rclListaDosOutros:setLayout("vertical");
obj.layout4 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout4:setParent(obj.scrollBox1);
obj.layout4:setLeft(790);
obj.layout4:setTop(0);
obj.layout4:setWidth(380);
obj.layout4:setHeight(600);
obj.layout4:setName("layout4");
obj.rectangle4 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle4:setParent(obj.layout4);
obj.rectangle4:setAlign("client");
obj.rectangle4:setColor("#0000007F");
obj.rectangle4:setName("rectangle4");
obj.label4 = GUI.fromHandle(_obj_newObject("label"));
obj.label4:setParent(obj.layout4);
obj.label4:setLeft(0);
obj.label4:setTop(0);
obj.label4:setWidth(380);
obj.label4:setHeight(20);
obj.label4:setText("CARACTERISTICAS DE CLASSE");
obj.label4:setHorzTextAlign("center");
obj.label4:setName("label4");
obj.rclListaDasCaracteristicasClasse = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclListaDasCaracteristicasClasse:setParent(obj.layout4);
obj.rclListaDasCaracteristicasClasse:setName("rclListaDasCaracteristicasClasse");
obj.rclListaDasCaracteristicasClasse:setField("campoDasCaracteristicasClasse");
obj.rclListaDasCaracteristicasClasse:setTemplateForm("frmFichaRPGmeister4h_svg");
obj.rclListaDasCaracteristicasClasse:setLeft(5);
obj.rclListaDasCaracteristicasClasse:setTop(25);
obj.rclListaDasCaracteristicasClasse:setWidth(370);
obj.rclListaDasCaracteristicasClasse:setHeight(570);
obj.rclListaDasCaracteristicasClasse:setLayout("vertical");
obj.layout5 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout5:setParent(obj.scrollBox1);
obj.layout5:setLeft(1180);
obj.layout5:setTop(0);
obj.layout5:setWidth(135);
obj.layout5:setHeight(600);
obj.layout5:setName("layout5");
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.layout5);
obj.button1:setText("Novo Talento");
obj.button1:setLeft(0);
obj.button1:setTop(0);
obj.button1:setWidth(125);
obj.button1:setHeight(25);
obj.button1:setName("button1");
obj.button2 = GUI.fromHandle(_obj_newObject("button"));
obj.button2:setParent(obj.layout5);
obj.button2:setText("Nova Proeza");
obj.button2:setLeft(0);
obj.button2:setTop(25);
obj.button2:setWidth(125);
obj.button2:setHeight(25);
obj.button2:setName("button2");
obj.button3 = GUI.fromHandle(_obj_newObject("button"));
obj.button3:setParent(obj.layout5);
obj.button3:setText("Novo Outros");
obj.button3:setLeft(0);
obj.button3:setTop(50);
obj.button3:setWidth(125);
obj.button3:setHeight(25);
obj.button3:setName("button3");
obj.button4 = GUI.fromHandle(_obj_newObject("button"));
obj.button4:setParent(obj.layout5);
obj.button4:setText("Nova Caracteristica");
obj.button4:setLeft(0);
obj.button4:setTop(75);
obj.button4:setWidth(125);
obj.button4:setHeight(25);
obj.button4:setName("button4");
obj._e_event0 = obj.rclListaDosTalentos:addEventListener("onCompare",
function (_, nodeA, nodeB)
return ((tonumber(nodeA.nivelHabilidade) or 0) - (tonumber(nodeB.nivelHabilidade) or 0));
end, obj);
obj._e_event1 = obj.rclListaDasProezas:addEventListener("onCompare",
function (_, nodeA, nodeB)
return ((tonumber(nodeA.nivelHabilidade) or 0) - (tonumber(nodeB.nivelHabilidade) or 0));
end, obj);
obj._e_event2 = obj.rclListaDosOutros:addEventListener("onCompare",
function (_, nodeA, nodeB)
return ((tonumber(nodeA.nivelHabilidade) or 0) - (tonumber(nodeB.nivelHabilidade) or 0));
end, obj);
obj._e_event3 = obj.rclListaDasCaracteristicasClasse:addEventListener("onCompare",
function (_, nodeA, nodeB)
return ((tonumber(nodeA.nivelHabilidade) or 0) - (tonumber(nodeB.nivelHabilidade) or 0));
end, obj);
obj._e_event4 = obj.button1:addEventListener("onClick",
function (_)
self.rclListaDosTalentos:append();
end, obj);
obj._e_event5 = obj.button2:addEventListener("onClick",
function (_)
self.rclListaDasProezas:append();
end, obj);
obj._e_event6 = obj.button3:addEventListener("onClick",
function (_)
self.rclListaDosOutros:append();
end, obj);
obj._e_event7 = obj.button4:addEventListener("onClick",
function (_)
self.rclListaDasCaracteristicasClasse:append();
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event7);
__o_rrpgObjs.removeEventListenerById(self._e_event6);
__o_rrpgObjs.removeEventListenerById(self._e_event5);
__o_rrpgObjs.removeEventListenerById(self._e_event4);
__o_rrpgObjs.removeEventListenerById(self._e_event3);
__o_rrpgObjs.removeEventListenerById(self._e_event2);
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.layout5 ~= nil then self.layout5:destroy(); self.layout5 = nil; end;
if self.button4 ~= nil then self.button4:destroy(); self.button4 = nil; end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.button3 ~= nil then self.button3:destroy(); self.button3 = nil; end;
if self.label1 ~= nil then self.label1:destroy(); self.label1 = nil; end;
if self.layout4 ~= nil then self.layout4:destroy(); self.layout4 = nil; end;
if self.rectangle4 ~= nil then self.rectangle4:destroy(); self.rectangle4 = nil; end;
if self.rectangle2 ~= nil then self.rectangle2:destroy(); self.rectangle2 = nil; end;
if self.rectangle3 ~= nil then self.rectangle3:destroy(); self.rectangle3 = nil; end;
if self.label3 ~= nil then self.label3:destroy(); self.label3 = nil; end;
if self.label4 ~= nil then self.label4:destroy(); self.label4 = nil; end;
if self.button2 ~= nil then self.button2:destroy(); self.button2 = nil; end;
if self.rclListaDosTalentos ~= nil then self.rclListaDosTalentos:destroy(); self.rclListaDosTalentos = nil; end;
if self.layout3 ~= nil then self.layout3:destroy(); self.layout3 = nil; end;
if self.layout1 ~= nil then self.layout1:destroy(); self.layout1 = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.layout2 ~= nil then self.layout2:destroy(); self.layout2 = nil; end;
if self.rclListaDasProezas ~= nil then self.rclListaDasProezas:destroy(); self.rclListaDasProezas = nil; end;
if self.rclListaDosOutros ~= nil then self.rclListaDosOutros:destroy(); self.rclListaDosOutros = nil; end;
if self.rclListaDasCaracteristicasClasse ~= nil then self.rclListaDasCaracteristicasClasse:destroy(); self.rclListaDasCaracteristicasClasse = nil; end;
if self.label2 ~= nil then self.label2:destroy(); self.label2 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmFichaRPGmeister4_svg()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmFichaRPGmeister4_svg();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmFichaRPGmeister4_svg = {
newEditor = newfrmFichaRPGmeister4_svg,
new = newfrmFichaRPGmeister4_svg,
name = "frmFichaRPGmeister4_svg",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmFichaRPGmeister4_svg = _frmFichaRPGmeister4_svg;
Firecast.registrarForm(_frmFichaRPGmeister4_svg);
return _frmFichaRPGmeister4_svg;
| apache-2.0 |
The-HalcyonDays/darkstar | scripts/zones/La_Theine_Plateau/npcs/Augevinne.lua | 13 | 1565 | -----------------------------------
-- Area: La Theine Plateau
-- NPC: Augevinne
-- Involved in Mission: The Rescue Drill
-- @pos -361 39 266 102
-----------------------------------
package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/La_Theine_Plateau/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:getCurrentMission(SANDORIA) == THE_RESCUE_DRILL) then
local MissionStatus = player:getVar("MissionStatus");
if(MissionStatus >= 5 and MissionStatus <= 7) then
player:startEvent(0x0067);
elseif(MissionStatus == 8) then
player:showText(npc, RESCUE_DRILL + 21);
elseif(MissionStatus >= 9) then
player:showText(npc, RESCUE_DRILL + 26);
else
player:showText(npc, RESCUE_DRILL);
end
else
player:showText(npc, RESCUE_DRILL);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
NAM-IL/VLC-2_2_0 | share/lua/intf/modules/httprequests.lua | 19 | 15839 | --[==========================================================================[
httprequests.lua: code for processing httprequests commands and output
--[==========================================================================[
Copyright (C) 2007 the VideoLAN team
$Id$
Authors: Antoine Cellerier <dionoea at videolan dot org>
Rob Jonson <rob at hobbyistsoftware.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]==========================================================================]
module("httprequests",package.seeall)
local common = require ("common")
local dkjson = require ("dkjson")
--Round the number to the specified precision
function round(what, precision)
if type(what) == "string" then
what = common.us_tonumber(what)
end
if type(what) == "number" then
return math.floor(what*math.pow(10,precision)+0.5) / math.pow(10,precision)
end
return nil
end
--split text where it matches the delimiter
function strsplit(text, delimiter)
local strfind = string.find
local strsub = string.sub
local tinsert = table.insert
local list = {}
local pos = 1
if strfind("", delimiter, 1) then -- this would result in endless loops
error("delimiter matches empty string!")
end
local i=1
while 1 do
local first, last = strfind(text, delimiter, pos)
if first then -- found?
tinsert(list,i, strsub(text, pos, first-1))
pos = last+1
else
tinsert(list,i, strsub(text, pos))
break
end
i = i+1
end
return list
end
--main function to process commands sent with the request
processcommands = function ()
local input = _GET['input']
local command = _GET['command']
local id = tonumber(_GET['id'] or -1)
local val = _GET['val']
local options = _GET['option']
local band = tonumber(_GET['band'])
local name = _GET['name']
local duration = tonumber(_GET['duration'])
if type(options) ~= "table" then -- Deal with the 0 or 1 option case
options = { options }
end
if command == "in_play" then
--[[
vlc.msg.err( "<options>" )
for a,b in ipairs(options) do
vlc.msg.err(b)
end
vlc.msg.err( "</options>" )
--]]
vlc.playlist.add({{path=vlc.strings.make_uri(input),options=options,name=name,duration=duration}})
elseif command == "addsubtitle" then
vlc.input.add_subtitle (val)
elseif command == "in_enqueue" then
vlc.playlist.enqueue({{path=vlc.strings.make_uri(input),options=options,name=name,duration=duration}})
elseif command == "pl_play" then
if id == -1 then
vlc.playlist.play()
else
vlc.playlist.gotoitem(id)
end
elseif command == "pl_pause" then
if vlc.playlist.status() == "stopped" then
if id == -1 then
vlc.playlist.play()
else
vlc.playlist.gotoitem(id)
end
else
vlc.playlist.pause()
end
elseif command == "pl_forcepause" then
if vlc.playlist.status() == "playing" then
vlc.playlist.pause()
end
elseif command == "pl_forceresume" then
if vlc.playlist.status() == "paused" then
vlc.playlist.pause()
end
elseif command == "pl_stop" then
vlc.playlist.stop()
elseif command == "pl_next" then
vlc.playlist.next()
elseif command == "pl_previous" then
vlc.playlist.prev()
elseif command == "pl_delete" then
vlc.playlist.delete(id)
elseif command == "pl_empty" then
vlc.playlist.clear()
elseif command == "pl_sort" then
vlc.playlist.sort( val, id > 0 )
elseif command == "pl_random" then
vlc.playlist.random()
elseif command == "pl_loop" then
--if loop is set true, then repeat needs to be set false
if vlc.playlist.loop() then
vlc.playlist.repeat_("off")
end
elseif command == "pl_repeat" then
--if repeat is set true, then loop needs to be set false
if vlc.playlist.repeat_() then
vlc.playlist.loop("off")
end
elseif command == "pl_sd" then
if vlc.sd.is_loaded(val) then
vlc.sd.remove(val)
else
vlc.sd.add(val)
end
elseif command == "fullscreen" then
if vlc.object.vout() then
vlc.video.fullscreen()
end
elseif command == "snapshot" then
common.snapshot()
elseif command == "volume" then
common.volume(val)
elseif command == "seek" then
common.seek(val)
elseif command == "key" then
common.hotkey("key-"..val)
elseif command == "audiodelay" then
if vlc.object.input() and val then
val = common.us_tonumber(val)
vlc.var.set(vlc.object.input(),"audio-delay",val)
end
elseif command == "rate" then
val = common.us_tonumber(val)
if vlc.object.input() and val >= 0 then
vlc.var.set(vlc.object.input(),"rate",val)
end
elseif command == "subdelay" then
if vlc.object.input() then
val = common.us_tonumber(val)
vlc.var.set(vlc.object.input(),"spu-delay",val)
end
elseif command == "aspectratio" then
if vlc.object.vout() then
vlc.var.set(vlc.object.vout(),"aspect-ratio",val)
end
elseif command == "preamp" then
val = common.us_tonumber(val)
vlc.equalizer.preampset(val)
elseif command == "equalizer" then
val = common.us_tonumber(val)
vlc.equalizer.equalizerset(band,val)
elseif command == "enableeq" then
if val == '0' then vlc.equalizer.enable(false) else vlc.equalizer.enable(true) end
elseif command == "setpreset" then
vlc.equalizer.setpreset(val)
elseif command == "title" then
vlc.var.set(vlc.object.input(), "title", val)
elseif command == "chapter" then
vlc.var.set(vlc.object.input(), "chapter", val)
elseif command == "audio_track" then
vlc.var.set(vlc.object.input(), "audio-es", val)
elseif command == "video_track" then
vlc.var.set(vlc.object.input(), "video-es", val)
elseif command == "subtitle_track" then
vlc.var.set(vlc.object.input(), "spu-es", val)
end
local input = nil
local command = nil
local id = nil
local val = nil
end
--utilities for formatting output
function xmlString(s)
if (type(s)=="string") then
return vlc.strings.convert_xml_special_chars(s)
elseif (type(s)=="number") then
return common.us_tostring(s)
else
return tostring(s)
end
end
--dkjson outputs numbered tables as arrays
--so we don't need the array indicators
function removeArrayIndicators(dict)
local newDict=dict
for k,v in pairs(dict) do
if (type(v)=="table") then
local arrayEntry=v._array
if arrayEntry then
v=arrayEntry
end
dict[k]=removeArrayIndicators(v)
end
end
return newDict
end
printTableAsJson = function (dict)
dict=removeArrayIndicators(dict)
local output=dkjson.encode (dict, { indent = true })
print(output)
end
local printXmlKeyValue = function (k,v,indent)
print("\n")
for i=1,indent do print(" ") end
if (k) then
print("<"..k..">")
end
if (type(v)=="table") then
printTableAsXml(v,indent+2)
else
print(xmlString(v))
end
if (k) then
xs=xmlString(k)
space_loc=string.find(xs," ")
if space_loc == nil then
print("</"..xs..">")
else
xs=string.sub(xs,1,space_loc)
print("</"..xs..">")
end
end
end
printTableAsXml = function (dict,indent)
for k,v in pairs(dict) do
printXmlKeyValue(k,v,indent)
end
end
--[[
function logTable(t,pre)
local pre = pre or ""
for k,v in pairs(t) do
vlc.msg.err(pre..tostring(k).." : "..tostring(v))
if type(v) == "table" then
a(v,pre.." ")
end
end
end
--]]
--main accessors
getplaylist = function ()
local p
if _GET["search"] then
if _GET["search"] ~= "" then
_G.search_key = _GET["search"]
else
_G.search_key = nil
end
local key = vlc.strings.decode_uri(_GET["search"])
p = vlc.playlist.search(key)
else
p = vlc.playlist.get()
end
--logTable(p) --Uncomment to debug
return p
end
parseplaylist = function (item)
if item.flags.disabled then return end
if (item.children) then
local result={}
local name = (item.name or "")
result["type"]="node"
result.id=tostring(item.id)
result.name=tostring(name)
result.ro=item.flags.ro and "ro" or "rw"
--store children in an array
--we use _array as a proxy for arrays
result.children={}
result.children._array={}
for _, child in ipairs(item.children) do
local nextChild=parseplaylist(child)
table.insert(result.children._array,nextChild)
end
return result
else
local result={}
local name, path = item.name or ""
local path = item.path or ""
local current_item_id = vlc.playlist.current()
-- Is the item the one currently played
if(current_item_id ~= nil) then
if(current_item_id == item.id) then
result.current = "current"
end
end
result["type"]="leaf"
result.id=tostring(item.id)
result.uri=tostring(path)
result.name=name
result.ro=item.flags.ro and "ro" or "rw"
result.duration=math.floor(item.duration)
return result
end
end
playlisttable = function ()
local basePlaylist=getplaylist()
return parseplaylist(basePlaylist)
end
getbrowsetable = function ()
local dir = nil
local uri = _GET["uri"]
--uri takes precedence, but fall back to dir
if uri then
if uri == "file://~" then
dir = uri
else
dir = vlc.strings.make_path(uri)
end
else
dir = _GET["dir"]
end
--backwards compatibility with old format driveLetter:\\..
--this is forgiving with the slash type and number
if dir then
local position=string.find(dir, '%a:[\\/]*%.%.',0)
if position==1 then dir="" end
end
local result={}
--paths are returned as an array of elements
result.element={}
result.element._array={}
if dir then
if dir == "~" or dir == "file://~" then dir = vlc.config.homedir() end
-- FIXME: hack for Win32 drive list
if dir~="" then
dir = common.realpath(dir.."/")
end
local d = vlc.net.opendir(dir)
table.sort(d)
for _,f in pairs(d) do
if f == ".." or not string.match(f,"^%.") then
local df = common.realpath(dir..f)
local s = vlc.net.stat(df)
local path, name = df, f
local element={}
if (s) then
for k,v in pairs(s) do
element[k]=v
end
else
element["type"]="unknown"
end
element["path"]=path
element["name"]=name
local uri=vlc.strings.make_uri(df)
--windows paths are returned with / separators, but make_uri expects \ for windows and returns nil
if not uri then
--convert failed path to windows format and try again
path=string.gsub(path,"/","\\")
uri=vlc.strings.make_uri(df)
end
element["uri"]=uri
table.insert(result.element._array,element)
end
end
end
return result;
end
getstatus = function (includecategories)
local input = vlc.object.input()
local item = vlc.input.item()
local playlist = vlc.object.playlist()
local vout = vlc.object.vout()
local aout = vlc.object.aout()
local s ={}
--update api version when new data/commands added
s.apiversion=3
s.version=vlc.misc.version()
s.volume=vlc.volume.get()
if input then
s.length=math.floor(vlc.var.get(input,"length"))
s.time=math.floor(vlc.var.get(input,"time"))
s.position=vlc.var.get(input,"position")
s.currentplid=vlc.playlist.current()
s.audiodelay=vlc.var.get(input,"audio-delay")
s.rate=vlc.var.get(input,"rate")
s.subtitledelay=vlc.var.get(input,"spu-delay")
else
s.length=0
s.time=0
s.position=0
s.currentplid=-1
s.audiodelay=0
s.rate=1
s.subtitledelay=0
end
if vout then
s.fullscreen=vlc.var.get(vout,"fullscreen")
s.aspectratio=vlc.var.get(vout,"aspect-ratio");
if s.aspectratio=="" then s.aspectratio = "default" end
else
s.fullscreen=0
end
if aout then
local filters=vlc.var.get(aout,"audio-filter")
local temp=strsplit(filters,":")
s.audiofilters={}
local id=0
for i,j in pairs(temp) do
s.audiofilters['filter_'..id]=j
id=id+1
end
end
s.videoeffects={}
s.videoeffects.hue=round(vlc.config.get("hue"),2)
s.videoeffects.brightness=round(vlc.config.get("brightness"),2)
s.videoeffects.contrast=round(vlc.config.get("contrast"),2)
s.videoeffects.saturation=round(vlc.config.get("saturation"),2)
s.videoeffects.gamma=round(vlc.config.get("gamma"),2)
s.state=vlc.playlist.status()
s.random=vlc.var.get(playlist,"random")
s.loop=vlc.var.get(playlist,"loop")
s["repeat"]=vlc.var.get(playlist,"repeat")
s.equalizer={}
s.equalizer.preamp=round(vlc.equalizer.preampget(),2)
s.equalizer.bands=vlc.equalizer.equalizerget()
if s.equalizer.bands ~= null then
for k,i in pairs(s.equalizer.bands) do s.equalizer.bands[k]=round(i,2) end
s.equalizer.presets=vlc.equalizer.presets()
end
if (includecategories and item) then
s.information={}
s.information.category={}
s.information.category.meta=item:metas()
local info = item:info()
for k, v in pairs(info) do
local streamTable={}
for k2, v2 in pairs(v) do
local tag = string.gsub(k2," ","_")
streamTable[tag]=v2
end
s.information.category[k]=streamTable
end
s.stats={}
local statsdata = item:stats()
for k,v in pairs(statsdata) do
local tag = string.gsub(k,"_","")
s.stats[tag]=v
end
s.information.chapter=vlc.var.get(input, "chapter")
s.information.title=vlc.var.get(input, "title")
s.information.chapters=vlc.var.get_list(input, "chapter")
s.information.titles=vlc.var.get_list(input, "title")
end
return s
end
| lgpl-2.1 |
The-HalcyonDays/darkstar | scripts/globals/items/wizard_cookie.lua | 35 | 1345 | -----------------------------------------
-- ID: 4576
-- Item: wizard_cookie
-- Food Effect: 5Min, All Races
-----------------------------------------
-- MP Recovered While Healing 7
-- Plantoid Killer 7
-- Slow Resist 7
-----------------------------------------
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,300,4576);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MPHEAL, 7);
target:addMod(MOD_PLANTOID_KILLER, 7);
target:addMod(MOD_SLOWRES, 7);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MPHEAL, 7);
target:delMod(MOD_PLANTOID_KILLER, 7);
target:delMod(MOD_SLOWRES, 7);
end;
| gpl-3.0 |
TeleAweSome/awesome | bot/utils.lua | 646 | 23489 | URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require "serpent"
feedparser = require "feedparser"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
http.TIMEOUT = 10
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
end
if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id
end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end
function is_chat_msg( msg )
if msg.to.type == 'chat' then
return true
end
return false
end
function string.random(length)
local str = "";
for i = 1, length do
math.random(97, 122)
str = str..string.char(math.random(97, 122));
end
return str;
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
-- DEPRECATED
function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1")
end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers)
-- Eg: foo.var
local file_name = url:match("[^%w]+([%.%w]+)$")
-- Any delimited alphanumeric on the url
file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
-- Random name, hope content-type works
file_name = file_name or str:random(5)
local content_type = headers["content-type"]
local extension = nil
if content_type then
extension = mimetype.get_mime_extension(content_type)
end
if extension then
file_name = file_name.."."..extension
end
local disposition = headers["content-disposition"]
if disposition then
-- attachment; filename=CodeCogsEqn.png
file_name = disposition:match('filename=([^;]+)') or file_name
end
return file_name
end
-- Saves file to /tmp/. If file_name isn't provided,
-- will get the text after the last "/" for filename
-- and content-type for extension
function download_to_file(url, file_name)
print("url to download: "..url)
local respbody = {}
local options = {
url = url,
sink = ltn12.sink.table(respbody),
redirect = true
}
-- nil, code, headers, status
local response = nil
if url:starts('https') then
options.redirect = false
response = {https.request(options)}
else
response = {http.request(options)}
end
local code = response[2]
local headers = response[3]
local status = response[4]
if code ~= 200 then return nil end
file_name = file_name or get_http_file_name(url, headers)
local file_path = "/tmp/"..file_name
print("Saved to: "..file_path)
file = io.open(file_path, "w+")
file:write(table.concat(respbody))
file:close()
return file_path
end
function vardump(value)
print(serpent.block(value, {comment=false}))
end
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
i = i + 1
t[i] = filename
end
return t
end
-- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
function run_command(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
cmd:close()
return result
end
-- User has privileges
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
-- Returns the name of the sender
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
-- Returns at table of lua files inside plugins
function plugins_names( )
local files = {}
for k, v in pairs(scandir("plugins")) do
-- Ends with .lua
if (v:match(".lua$")) then
table.insert(files, v)
end
end
return files
end
-- Function name explains what it does.
function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Save into file the data serialized for lua.
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
-- Returns true if the string is empty
function string:isempty()
return self == nil or self == ''
end
-- Returns true if the string is blank
function string:isblank()
self = self:trim()
return self:isempty()
end
-- DEPRECATED!!!!!
function string.starts(String, Start)
print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start))
end
-- Returns true if String starts with Start
function string:starts(text)
return text == string.sub(self,1,string.len(text))
end
-- Send image to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_photo(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function,
cb_extra = cb_extra
}
-- Call to remove with optional callback
send_photo(receiver, file_path, cb_function, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_photo_from_url(receiver, url, cb_function, cb_extra)
-- If callback not provided
cb_function = cb_function or ok_cb
cb_extra = cb_extra or false
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, cb_function, cb_extra)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra)
end
end
-- Same as send_photo_from_url but as callback function
function send_photo_from_url_callback(cb_extra, success, result)
local receiver = cb_extra.receiver
local url = cb_extra.url
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, ok_cb, false)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, ok_cb, false)
end
end
-- Send multiple images asynchronous.
-- param urls must be a table.
function send_photos_from_url(receiver, urls)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = nil
}
send_photos_from_url_callback(cb_extra)
end
-- Use send_photos_from_url.
-- This function might be difficult to understand.
function send_photos_from_url_callback(cb_extra, success, result)
-- cb_extra is a table containing receiver, urls and remove_path
local receiver = cb_extra.receiver
local urls = cb_extra.urls
local remove_path = cb_extra.remove_path
-- The previously image to remove
if remove_path ~= nil then
os.remove(remove_path)
print("Deleted: "..remove_path)
end
-- Nil or empty, exit case (no more urls)
if urls == nil or #urls == 0 then
return false
end
-- Take the head and remove from urls table
local head = table.remove(urls, 1)
local file_path = download_to_file(head, false)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = file_path
}
-- Send first and postpone the others as callback
send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
end
-- Callback to remove a file
function rmtmp_cb(cb_extra, success, result)
local file_path = cb_extra.file_path
local cb_function = cb_extra.cb_function or ok_cb
local cb_extra = cb_extra.cb_extra
if file_path ~= nil then
os.remove(file_path)
print("Deleted: "..file_path)
end
-- Finally call the callback
cb_function(cb_extra, success, result)
end
-- Send document to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_document(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function or ok_cb,
cb_extra = cb_extra or false
}
-- Call to remove with optional callback
send_document(receiver, file_path, rmtmp_cb, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false)
print("File path: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra)
end
-- Parameters in ?a=1&b=2 style
function format_http_params(params, is_get)
local str = ''
-- If is get add ? to the beginning
if is_get then str = '?' end
local first = true -- Frist param
for k,v in pairs (params) do
if v then -- nil value
if first then
first = false
str = str..k.. "="..v
else
str = str.."&"..k.. "="..v
end
end
end
return str
end
-- Check if user can use the plugin and warns user
-- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user'
local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false)
return true
else
return false
end
end
-- Check if user can use the plugin
function user_allowed(plugin, msg)
if plugin.privileged and not is_sudo(msg) then
return false
end
return true
end
function send_order_msg(destination, msgs)
local cb_extra = {
destination = destination,
msgs = msgs
}
send_order_msg_callback(cb_extra, true)
end
function send_order_msg_callback(cb_extra, success, result)
local destination = cb_extra.destination
local msgs = cb_extra.msgs
local file_path = cb_extra.file_path
if file_path ~= nil then
os.remove(file_path)
print("Deleted: " .. file_path)
end
if type(msgs) == 'string' then
send_large_msg(destination, msgs)
elseif type(msgs) ~= 'table' then
return
end
if #msgs < 1 then
return
end
local msg = table.remove(msgs, 1)
local new_cb_extra = {
destination = destination,
msgs = msgs
}
if type(msg) == 'string' then
send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
elseif type(msg) == 'table' then
local typ = msg[1]
local nmsg = msg[2]
new_cb_extra.file_path = nmsg
if typ == 'document' then
send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'image' or typ == 'photo' then
send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'audio' then
send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'video' then
send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
else
send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
end
end
end
-- Same as send_large_msg_callback but friendly params
function send_large_msg(destination, text)
local cb_extra = {
destination = destination,
text = text
}
send_large_msg_callback(cb_extra, true)
end
-- If text is longer than 4096 chars, send multiple msg.
-- https://core.telegram.org/method/messages.sendMessage
function send_large_msg_callback(cb_extra, success, result)
local text_max = 4096
local destination = cb_extra.destination
local text = cb_extra.text
local text_len = string.len(text)
local num_msg = math.ceil(text_len / text_max)
if num_msg <= 1 then
send_msg(destination, text, ok_cb, false)
else
local my_text = string.sub(text, 1, 4096)
local rest = string.sub(text, 4096, text_len)
local cb_extra = {
destination = destination,
text = rest
}
send_msg(destination, my_text, send_large_msg_callback, cb_extra)
end
end
-- Returns a table with matches or nil
function match_pattern(pattern, text, lower_case)
if text then
local matches = {}
if lower_case then
matches = { string.match(text:lower(), pattern) }
else
matches = { string.match(text, pattern) }
end
if next(matches) then
return matches
end
end
-- nil
end
-- Function to read data from files
function load_from_file(file, default_data)
local f = io.open(file, "r+")
-- If file doesn't exists
if f == nil then
-- Create a new empty table
default_data = default_data or {}
serialize_to_file(default_data, file)
print ('Created file', file)
else
print ('Data loaded from file', file)
f:close()
end
return loadfile (file)()
end
-- See http://stackoverflow.com/a/14899740
function unescape_html(str)
local map = {
["lt"] = "<",
["gt"] = ">",
["amp"] = "&",
["quot"] = '"',
["apos"] = "'"
}
new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
var = map[s] or n == "#" and string.char(s)
var = var or n == "#x" and string.char(tonumber(s,16))
var = var or orig
return var
end)
return new
end
--Check if this chat is realm or not
function is_realm(msg)
local var = false
local realms = 'realms'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(realms)] then
if data[tostring(realms)][tostring(msg.to.id)] then
var = true
end
return var
end
end
--Check if this chat is a group or not
function is_group(msg)
local var = false
local groups = 'groups'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(groups)] then
if data[tostring(groups)][tostring(msg.to.id)] then
var = true
end
return var
end
end
function savelog(group, logtxt)
local text = (os.date("[ %c ]=> "..logtxt.."\n \n"))
local file = io.open("./groups/logs/"..group.."log.txt", "a")
file:write(text)
file:close()
end
function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
--Check if user is the owner of that group or not
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_owner2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is admin or not
function is_admin(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_admin2(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_momod(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['moderators'] then
if data[tostring(msg.to.id)]['moderators'][tostring(user)] then
var = true
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_momod2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(group_id)] then
if data[tostring(group_id)]['moderators'] then
if data[tostring(group_id)]['moderators'][tostring(usert)] then
var = true
end
end
end
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == usert then
var = true
end
end
return var
end
-- Returns the name of the sender
function kick_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_owner2(user_id, chat_id) then -- Ignore admins
return
end
local chat = 'chat#id'..chat_id
local user = 'user#id'..user_id
chat_del_user(chat, user, ok_cb, true)
end
-- Ban
function ban_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'banned:'..chat_id
redis:sadd(hash, user_id)
-- Kick from chat
kick_user(user_id, chat_id)
end
-- Global ban
function banall_user(user_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'gbanned'
redis:sadd(hash, user_id)
end
-- Global unban
function unbanall_user(user_id)
--Save on redis
local hash = 'gbanned'
redis:srem(hash, user_id)
end
-- Check if user_id is banned in chat_id or not
function is_banned(user_id, chat_id)
--Save on redis
local hash = 'banned:'..chat_id
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Check if user_id is globally banned or not
function is_gbanned(user_id)
--Save on redis
local hash = 'gbanned'
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Returns chat_id ban list
function ban_list(chat_id)
local hash = 'banned:'..chat_id
local list = redis:smembers(hash)
local text = "Ban list !\n\n"
for k,v in pairs(list) do
text = text..k.." - "..v.." \n"
end
return text
end
-- Returns globally ban list
function banall_list()
local hash = 'gbanned'
local list = redis:smembers(hash)
local text = "global bans !\n\n"
for k,v in pairs(list) do
text = text..k.." - "..v.." \n"
end
return text
end
-- /id by reply
function get_message_callback_id(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
send_large_msg(chat, result.from.id)
else
return 'Use This in Your Groups'
end
end
-- kick by reply for mods and owner
function Kick_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
-- Kick by reply for admins
function Kick_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
--Ban by reply for admins
function ban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Ban by reply for admins
function ban_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Unban by reply
function unban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't unban myself"
end
send_large_msg(chat, "User "..result.from.id.." Unbanned")
-- Save on redis
local hash = 'banned:'..result.to.id
redis:srem(hash, result.from.id)
else
return 'Use This in Your Groups'
end
end
function banall_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't banall myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
local name = user_print_name(result.from)
banall_user(result.from.id)
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered")
else
return 'Use This in Your Groups'
end
end
| gpl-2.0 |
shahabsaf1/beni-dalton | plugins/twitter_send.lua | 627 | 1555 | do
local OAuth = require "OAuth"
local consumer_key = ""
local consumer_secret = ""
local access_token = ""
local access_token_secret = ""
local client = OAuth.new(consumer_key, consumer_secret, {
RequestToken = "https://api.twitter.com/oauth/request_token",
AuthorizeUser = {"https://api.twitter.com/oauth/authorize", method = "GET"},
AccessToken = "https://api.twitter.com/oauth/access_token"
}, {
OAuthToken = access_token,
OAuthTokenSecret = access_token_secret
})
function run(msg, matches)
if consumer_key:isempty() then
return "Twitter Consumer Key is empty, write it in plugins/twitter_send.lua"
end
if consumer_secret:isempty() then
return "Twitter Consumer Secret is empty, write it in plugins/twitter_send.lua"
end
if access_token:isempty() then
return "Twitter Access Token is empty, write it in plugins/twitter_send.lua"
end
if access_token_secret:isempty() then
return "Twitter Access Token Secret is empty, write it in plugins/twitter_send.lua"
end
if not is_sudo(msg) then
return "You aren't allowed to send tweets"
end
local response_code, response_headers, response_status_line, response_body =
client:PerformRequest("POST", "https://api.twitter.com/1.1/statuses/update.json", {
status = matches[1]
})
if response_code ~= 200 then
return "Error: "..response_code
end
return "Tweet sent"
end
return {
description = "Sends a tweet",
usage = "!tw [text]: Sends the Tweet with the configured account.",
patterns = {"^!tw (.+)"},
run = run
}
end
| gpl-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Windurst_Woods/npcs/Samigo-Pormigo.lua | 10 | 2685 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Samigo-Pormigo
-- Type: Guildworker's Union Representative
-- @zone: 241
-- @pos -9.782 -5.249 -134.432
-----------------------------------
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
require("scripts/globals/keyitems");
require("scripts/globals/crafting");
require("scripts/zones/Windurst_Woods/TextIDs");
local keyitems = {
[0] = {
id = BONE_PURIFICATION,
rank = 3,
cost = 40000
},
[1] = {
id = BONE_ENSORCELLMENT,
rank = 3,
cost = 40000
},
[2] = {
id = FILING,
rank = 3,
cost = 10000
},
[3] = {
id = WAY_OF_THE_BONEWORKER,
rank = 9,
cost = 20000
}
};
local items = {
[2] = {
id = 15449,
rank = 3,
cost = 10000
},
[3] = {
id = 13947,
rank = 6,
cost = 70000
},
[4] = {
id = 14397,
rank = 7,
cost = 100000
},
[5] = {
id = 142, -- Drogaroga's Fang
rank = 9,
cost = 150000
},
[6] = {
id = 336, -- Boneworker's Signboard
rank = 9,
cost = 200000
},
[7] = {
id = 15824, -- Bonecrafter's Ring
rank = 6,
cost = 80000
},
[8] = {
id = 3663, -- Bonecraft Tools
rank = 7,
cost = 50000
},
[9] = {
id = 3326, -- Boneworker's Emblem
rank = 9,
cost = 15000
}
};
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
unionRepresentativeTrade(player, npc, trade, 0x2727, 6);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
unionRepresentativeTrigger(player, 6, 0x2726, "guild_bonecraft", keyitems);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,target)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x2726) then
unionRepresentativeTriggerFinish(player, option, target, 6, "guild_bonecraft", keyitems, items);
elseif(csid == 0x2727) then
player:messageSpecial(GP_OBTAINED, option);
end
end;
| gpl-3.0 |
hxw804781317/MT7620N | package/ralink/ui/luci-mtk/src/modules/base/luasrc/sys/zoneinfo/tzoffset.lua | 72 | 3904 | --[[
LuCI - Autogenerated Zoneinfo Module
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
]]--
module "luci.sys.zoneinfo.tzoffset"
OFFSET = {
gmt = 0, -- GMT
eat = 10800, -- EAT
cet = 3600, -- CET
wat = 3600, -- WAT
cat = 7200, -- CAT
wet = 0, -- WET
sast = 7200, -- SAST
eet = 7200, -- EET
hast = -36000, -- HAST
hadt = -32400, -- HADT
akst = -32400, -- AKST
akdt = -28800, -- AKDT
ast = -14400, -- AST
brt = -10800, -- BRT
art = -10800, -- ART
pyt = -14400, -- PYT
pyst = -10800, -- PYST
est = -18000, -- EST
cst = -21600, -- CST
cdt = -18000, -- CDT
amt = -14400, -- AMT
cot = -18000, -- COT
mst = -25200, -- MST
mdt = -21600, -- MDT
vet = -16200, -- VET
gft = -10800, -- GFT
pst = -28800, -- PST
pdt = -25200, -- PDT
ect = -18000, -- ECT
gyt = -14400, -- GYT
bot = -14400, -- BOT
pet = -18000, -- PET
pmst = -10800, -- PMST
pmdt = -7200, -- PMDT
uyt = -10800, -- UYT
uyst = -7200, -- UYST
fnt = -7200, -- FNT
srt = -10800, -- SRT
egt = -3600, -- EGT
egst = 0, -- EGST
nst = -12600, -- NST
ndt = -9000, -- NDT
wst = 28800, -- WST
davt = 25200, -- DAVT
ddut = 36000, -- DDUT
mist = 39600, -- MIST
mawt = 18000, -- MAWT
nzst = 43200, -- NZST
nzdt = 46800, -- NZDT
rott = -10800, -- ROTT
syot = 10800, -- SYOT
vost = 21600, -- VOST
almt = 21600, -- ALMT
anat = 43200, -- ANAT
aqtt = 18000, -- AQTT
tmt = 18000, -- TMT
azt = 14400, -- AZT
azst = 18000, -- AZST
ict = 25200, -- ICT
kgt = 21600, -- KGT
bnt = 28800, -- BNT
chot = 28800, -- CHOT
ist = 19800, -- IST
bdt = 21600, -- BDT
tlt = 32400, -- TLT
gst = 14400, -- GST
tjt = 18000, -- TJT
hkt = 28800, -- HKT
hovt = 25200, -- HOVT
irkt = 32400, -- IRKT
wit = 25200, -- WIT
eit = 32400, -- EIT
aft = 16200, -- AFT
pett = 43200, -- PETT
pkt = 18000, -- PKT
npt = 20700, -- NPT
krat = 28800, -- KRAT
myt = 28800, -- MYT
magt = 43200, -- MAGT
cit = 28800, -- CIT
pht = 28800, -- PHT
novt = 25200, -- NOVT
omst = 25200, -- OMST
orat = 18000, -- ORAT
kst = 32400, -- KST
qyzt = 21600, -- QYZT
mmt = 23400, -- MMT
sakt = 39600, -- SAKT
uzt = 18000, -- UZT
sgt = 28800, -- SGT
get = 14400, -- GET
btt = 21600, -- BTT
jst = 32400, -- JST
ulat = 28800, -- ULAT
vlat = 39600, -- VLAT
yakt = 36000, -- YAKT
yekt = 21600, -- YEKT
azot = -3600, -- AZOT
azost = 0, -- AZOST
cvt = -3600, -- CVT
fkt = -14400, -- FKT
fkst = -10800, -- FKST
cwst = 31500, -- CWST
lhst = 37800, -- LHST
lhst = 39600, -- LHST
fet = 10800, -- FET
msk = 14400, -- MSK
samt = 14400, -- SAMT
volt = 14400, -- VOLT
iot = 21600, -- IOT
cxt = 25200, -- CXT
cct = 23400, -- CCT
tft = 18000, -- TFT
sct = 14400, -- SCT
mvt = 18000, -- MVT
mut = 14400, -- MUT
ret = 14400, -- RET
chast = 45900, -- CHAST
chadt = 49500, -- CHADT
chut = 36000, -- CHUT
vut = 39600, -- VUT
phot = 46800, -- PHOT
tkt = -36000, -- TKT
fjt = 43200, -- FJT
tvt = 43200, -- TVT
galt = -21600, -- GALT
gamt = -32400, -- GAMT
sbt = 39600, -- SBT
hst = -36000, -- HST
lint = 50400, -- LINT
kost = 39600, -- KOST
mht = 43200, -- MHT
mart = -34200, -- MART
sst = -39600, -- SST
nrt = 43200, -- NRT
nut = -39600, -- NUT
nft = 41400, -- NFT
nct = 39600, -- NCT
pwt = 32400, -- PWT
pont = 39600, -- PONT
pgt = 36000, -- PGT
ckt = -36000, -- CKT
taht = -36000, -- TAHT
gilt = 43200, -- GILT
tot = 46800, -- TOT
wakt = 43200, -- WAKT
wft = 43200, -- WFT
}
| gpl-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Tormenta 20/output/rdkObjs/Ficha Tormenta 20/ImportExport.lfm.lua | 2 | 4219 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmImportExport()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmImportExport");
obj:setAlign("client");
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.scrollBox1);
obj.button1:setLeft(0);
obj.button1:setTop(0);
obj.button1:setWidth(100);
obj.button1:setHeight(20);
obj.button1:setText("Exportar Ficha");
obj.button1:setName("button1");
obj.button2 = GUI.fromHandle(_obj_newObject("button"));
obj.button2:setParent(obj.scrollBox1);
obj.button2:setLeft(0);
obj.button2:setTop(25);
obj.button2:setWidth(100);
obj.button2:setHeight(20);
obj.button2:setText("Importar Ficha");
obj.button2:setName("button2");
obj._e_event0 = obj.button1:addEventListener("onClick",
function (_)
local xml = NDB.exportXML(sheet);
local export = {};
local bytes = Utils.binaryEncode(export, "utf8", xml);
local stream = Utils.newMemoryStream();
local bytes = stream:write(export);
Dialogs.saveFile("Salvar Ficha como XML", stream, "ficha.xml", "application/xml",
function()
stream:close();
showMessage("Ficha Exportada.");
end);
end, obj);
obj._e_event1 = obj.button2:addEventListener("onClick",
function (_)
Dialogs.openFile("Importar Ficha", "application/xml", false,
function(arquivos)
local arq = arquivos[1];
local import = {};
local bytes = arq.stream:read(import, arq.stream.size);
local xml = Utils.binaryDecode(import, "utf8");
NDB.importXML(sheet, xml);
end);
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.button2 ~= nil then self.button2:destroy(); self.button2 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmImportExport()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmImportExport();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmImportExport = {
newEditor = newfrmImportExport,
new = newfrmImportExport,
name = "frmImportExport",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmImportExport = _frmImportExport;
Firecast.registrarForm(_frmImportExport);
return _frmImportExport;
| apache-2.0 |
Goranaws/Dominos | bars/stanceBar.lua | 1 | 2561 | --[[
stanceBar - a bar for displaying class specific buttons for things like stances/forms/etc
--]]
-- don't bother loading the module if the player is currently playing something without a stance
if select(2, UnitClass('player')) == 'MAGE' or select(2, UnitClass('player')) == 'SHAMAN' or select(2, UnitClass('player')) == 'HUNTER' then
return
end
--[[ Globals ]]--
local Addon = _G[...]
local KeyBound = LibStub('LibKeyBound-1.0')
--[[ Button ]]--
local StanceButton = Addon:CreateClass('CheckButton', Addon.BindableButton)
do
local unused = {}
StanceButton.buttonType = 'SHAPESHIFTBUTTON'
function StanceButton:New(id)
local button = self:Restore(id) or self:Create(id)
Addon.BindingsController:Register(button)
Addon:GetModule('Tooltips'):Register(button)
return button
end
function StanceButton:Create(id)
local buttonName = ('StanceButton%d'):format(id)
local button = self:Bind(_G[buttonName])
if button then
button:HookScript('OnEnter', self.OnEnter)
Addon:GetModule('ButtonThemer'):Register(button, 'Class Bar')
end
return button
end
function StanceButton:Restore(id)
local button = unused[id]
if button then
unused[id] = nil
button:Show()
return button
end
end
--saving them thar memories
function StanceButton:Free()
unused[self:GetID()] = self
self:SetParent(nil)
self:Hide()
Addon.BindingsController:Unregister(self)
Addon:GetModule('Tooltips'):Unregister(self)
end
--keybound support
function StanceButton:OnEnter()
KeyBound:Set(self)
end
end
--[[ Bar ]]--
local StanceBar = Addon:CreateClass('Frame', Addon.ButtonBar)
do
function StanceBar:New()
return StanceBar.proto.New(self, 'class')
end
function StanceBar:GetDefaults()
return {
point = 'CENTER',
spacing = 2
}
end
function StanceBar:NumButtons()
return GetNumShapeshiftForms() or 0
end
function StanceBar:GetButton(index)
return StanceButton:New(index)
end
end
--[[ Module ]]--
do
local StanceBarController = Addon:NewModule('StanceBar', 'AceEvent-3.0')
function StanceBarController:Load()
self.bar = StanceBar:New()
self:RegisterEvent('UPDATE_SHAPESHIFT_FORMS', 'UpdateNumForms')
self:RegisterEvent('PLAYER_REGEN_ENABLED', 'UpdateNumForms')
self:RegisterEvent('PLAYER_ENTERING_WORLD', 'UpdateNumForms')
end
function StanceBarController:Unload()
self:UnregisterAllEvents()
if self.bar then
self.bar:Free()
end
end
function StanceBarController:UpdateNumForms()
if InCombatLockdown() then return end
self.bar:UpdateNumButtons()
end
end
| bsd-3-clause |
rogerthat52/Unnamed-Love2D-RPG | functions.lua | 1 | 1705 | function math.round(n)
--rounds instead of math.floor or math.ceil
return math.floor(n+.5)
end
function switchGM(gm)
gamestate = gm
gamestate.load()
end
function love.displayLoading(text)
loadtxt = "loading..."
local font = love.graphics.getFont()
local width = font:getWidth(loadtxt)
local height = font:getHeight(loadtxt)
love.graphics.print(loadtxt, love.graphics.getWidth()/2, love.graphics.getHeight()/2,0,1,1,width/2, height/2)
love.graphics.present()
end
function drawTextBox(num)
if talking.is then
love.graphics.draw(ttilesetBatch, 0, 0)
love.graphics.print(npc[talking.npc].text, 32*5.5, love.graphics.getHeight() - (4.5*32))
drawFace(num)
end
if talking.can == true and talking.is == false then
local text = "----------------------------------[press space]----------------------------------"
love.graphics.print ({{0,0,0,255},text}, math.floor(love.graphics.getWidth()/2 - love.graphics.getFont():getWidth(text)), math.floor(love.graphics.getHeight()*.9), 0, 2)
end
end
function drawFace(num)
love.graphics.draw(npc[num].faceimage, npc[num].facequad, 32, love.graphics.getHeight() - (5*32), 0, 2, 2)
end
function changeRes()
player.speed = player.bSpeed * overworld.scale
dtileSize = tileSize*overworld.scale
tileSizeDif = dtileSize/tileSize
htiles = math.floor(love.graphics.getWidth()/dtileSize)+2
vtiles = math.floor(love.graphics.getHeight()/dtileSize)+2
overworld.setMap(1)
--updates data for new map
overworld.genTextBox()
--generate spritebatch for the textbox
end
function checkBroken(x, y)
for i, v in ipairs(broken) do
if v[1] == x and v[2] == y then
return true
end
end
end | mit |
The-HalcyonDays/darkstar | scripts/zones/Port_San_dOria/npcs/Nazar.lua | 12 | 1266 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Nazar
-- Type: Standard NPC
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local vHour = VanadielHour();
local vMin = VanadielMinute();
while vHour >= 3 do
vHour = vHour - 6;
end
if( vHour == -3) then vHour = 3;
elseif( vHour == -2) then vHour = 4;
elseif( vHour == -1) then vHour = 5;
end
local seconds = math.floor(2.4 * ((vHour * 60) + vMin));
player:startEvent( 0x02BF, seconds, 0, 0, 0, 0, 0, 0, 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 |
The-HalcyonDays/darkstar | scripts/zones/Port_San_dOria/npcs/Brifalien.lua | 19 | 1772 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Brifalien
-- Involved in Quests: Riding on the Clouds
-- @zone 232
-- @pos -20 -4 -74
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then
if(trade:hasItemQty(532,1) and trade:getItemCount() == 1) then -- Trade Magicmart Flyer
player:messageSpecial(FLYER_REFUSED);
end
end
if(player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_1") == 7) then
if(trade:hasItemQty(1127,1) and trade:getItemCount() == 1) then -- Trade Kindred seal
player:setVar("ridingOnTheClouds_1",0);
player:tradeComplete();
player:addKeyItem(SCOWLING_STONE);
player:messageSpecial(KEYITEM_OBTAINED,SCOWLING_STONE);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x024d);
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 |
The-HalcyonDays/darkstar | scripts/zones/Aht_Urhgan_Whitegate/npcs/Kalimahf.lua | 34 | 1033 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Kalimahf
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x02A8);
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 |
rrpgfirecast/firecast | Plugins/Sheets/Gerenciador SotDL/output/rdkObjs/GerenciadorSotDL/DropDownFalsa.lfm.lua | 1 | 4248 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_OpcaoDaComboboxFalsa()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("OpcaoDaComboboxFalsa");
obj:setHeight(24);
obj:setAlign("top");
obj:setTheme("dark");
obj.imgApagar2 = GUI.fromHandle(_obj_newObject("imageCheckBox"));
obj.imgApagar2:setParent(obj);
obj.imgApagar2:setAlign("left");
obj.imgApagar2:setWidth(20);
obj.imgApagar2:setMargins({left=4, top=2, bottom=2});
obj.imgApagar2:setName("imgApagar2");
obj.imgApagar2:setImageChecked("/GerenciadorSotDL/images/delete.png");
obj.imgApagar2:setImageUnchecked("/GerenciadorSotDL/images/delete.png");
obj.label1 = GUI.fromHandle(_obj_newObject("label"));
obj.label1:setParent(obj);
obj.label1:setAlign("client");
obj.label1:setField("NomeDaOpcao");
obj.label1:setMargins({left=4});
obj.label1:setText("Título da Aba");
obj.label1:setName("label1");
obj.dataLink1 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink1:setParent(obj);
obj.dataLink1:setField("TipoOrganizar");
obj.dataLink1:setDefaultValue("Alfa");
obj.dataLink1:setName("dataLink1");
obj.dataLink2 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink2:setParent(obj);
obj.dataLink2:setField("NomeDaOpcao");
obj.dataLink2:setDefaultValue("Título da Aba");
obj.dataLink2:setName("dataLink2");
obj._e_event0 = obj.imgApagar2:addEventListener("onClick",
function (_)
if DonoMestre(sheet, false, "docksub10") then
dialogs.confirmYesNo("Deseja realmente apagar este item?",
function (confirmado)
if confirmado then
safeNodeDeletion(sheet);
else
end;
end);
end;
end, obj);
obj._e_event1 = obj.dataLink2:addEventListener("onChange",
function (_, field, oldValue, newValue)
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.dataLink1 ~= nil then self.dataLink1:destroy(); self.dataLink1 = nil; end;
if self.imgApagar2 ~= nil then self.imgApagar2:destroy(); self.imgApagar2 = nil; end;
if self.dataLink2 ~= nil then self.dataLink2:destroy(); self.dataLink2 = nil; end;
if self.label1 ~= nil then self.label1:destroy(); self.label1 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newOpcaoDaComboboxFalsa()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_OpcaoDaComboboxFalsa();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _OpcaoDaComboboxFalsa = {
newEditor = newOpcaoDaComboboxFalsa,
new = newOpcaoDaComboboxFalsa,
name = "OpcaoDaComboboxFalsa",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
OpcaoDaComboboxFalsa = _OpcaoDaComboboxFalsa;
Firecast.registrarForm(_OpcaoDaComboboxFalsa);
return _OpcaoDaComboboxFalsa;
| apache-2.0 |
The-HalcyonDays/darkstar | scripts/globals/items/bowl_of_seafood_stew.lua | 35 | 1467 | -----------------------------------------
-- ID: 4561
-- Item: Bowl of Seafood Stew
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Health 20
-- Dexterity 1
-- Vitality 5
-- Defense % 25
-- Defense Cap 120
-----------------------------------------
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,10800,4561);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 20);
target:addMod(MOD_DEX, 1);
target:addMod(MOD_VIT, 5);
target:addMod(MOD_FOOD_DEFP, 25);
target:addMod(MOD_FOOD_DEF_CAP, 120);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 20);
target:delMod(MOD_DEX, 1);
target:delMod(MOD_VIT, 5);
target:delMod(MOD_FOOD_DEFP, 25);
target:delMod(MOD_FOOD_DEF_CAP, 120);
end;
| gpl-3.0 |
rrpgfirecast/firecast | Plugins/Sheets/Gerenciador SotDL/output/rdkObjs/GerenciadorSotDL/DropDownFalsa2.lfm.lua | 3 | 2635 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_OpcaoDaComboboxFalsa2()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("OpcaoDaComboboxFalsa2");
obj:setHeight(24);
obj:setAlign("top");
obj:setTheme("dark");
obj.label1 = GUI.fromHandle(_obj_newObject("label"));
obj.label1:setParent(obj);
obj.label1:setAlign("client");
obj.label1:setField("NomeDaOpcao");
obj.label1:setText("Nome da Opção");
obj.label1:setName("label1");
obj.dataLink1 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink1:setParent(obj);
obj.dataLink1:setField("NomeDaOpcao");
obj.dataLink1:setDefaultValue("Nenhum");
obj.dataLink1:setName("dataLink1");
function obj:_releaseEvents()
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.dataLink1 ~= nil then self.dataLink1:destroy(); self.dataLink1 = nil; end;
if self.label1 ~= nil then self.label1:destroy(); self.label1 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newOpcaoDaComboboxFalsa2()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_OpcaoDaComboboxFalsa2();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _OpcaoDaComboboxFalsa2 = {
newEditor = newOpcaoDaComboboxFalsa2,
new = newOpcaoDaComboboxFalsa2,
name = "OpcaoDaComboboxFalsa2",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
OpcaoDaComboboxFalsa2 = _OpcaoDaComboboxFalsa2;
Firecast.registrarForm(_OpcaoDaComboboxFalsa2);
return _OpcaoDaComboboxFalsa2;
| apache-2.0 |
The-HalcyonDays/darkstar | scripts/zones/The_Celestial_Nexus/mobs/Exoplates.lua | 13 | 2870 | -----------------------------------
-- Area: The Celestial Nexus
-- NPC: Exoplates
-- Zilart Mission 16 BCNM Fight
-----------------------------------
require("scripts/globals/titles");
require("scripts/globals/status");
require("scripts/globals/magic");
function onMobInitialize(mob)
mob:addMod(MOD_REGAIN, 50);
end
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
mob:AnimationSub(0);
mob:SetAutoAttackEnabled(false);
mob:setUnkillable(true);
end;
function onMobFight(mob, target)
local shifts = mob:getLocalVar("shifts");
local shiftTime = mob:getLocalVar("shiftTime");
if (mob:AnimationSub() == 0 and shifts == 0 and mob:getHPP() <= 67) then
mob:useMobAbility(737);
mob:setLocalVar("shifts", shifts+1);
mob:setLocalVar("shiftTime", mob:getBattleTime()+5);
elseif (mob:AnimationSub() == 1 and shifts <= 1 and mob:getHPP() <= 33) then
mob:useMobAbility(741);
mob:setLocalVar("shifts", shifts+1);
mob:setLocalVar("shiftTime", mob:getBattleTime()+5);
elseif (mob:AnimationSub() == 2 and shifts <= 2 and mob:getHPP() <= 2) then
mob:useMobAbility(745);
mob:setLocalVar("shifts", shifts+1);
mob:setLocalVar("shiftTime", mob:getBattleTime()+5);
elseif (mob:getHPP() <= 67 and mob:AnimationSub() == 0 and mob:getBattleTime() >= shiftTime ) then
mob:AnimationSub(1);
elseif (mob:getHPP() <= 33 and mob:AnimationSub() == 1 and mob:getBattleTime() >= shiftTime) then
mob:AnimationSub(2);
end;
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
local eald_narche = GetMobByID(mob:getID() - 1);
eald_narche:delStatusEffect(EFFECT_PHYSICAL_SHIELD, 0, 1, 0, 0);
eald_narche:delStatusEffect(EFFECT_ARROW_SHIELD, 0, 1, 0, 0);
eald_narche:delStatusEffect(EFFECT_MAGIC_SHIELD, 0, 1, 0, 0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("updateCSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,target)
--printf("finishCSID: %u",csid);
--printf("RESULT: %u",option);
if(csid == 0x7d04) then
DespawnMob(target:getID());
DespawnMob(target:getID()-1);
DespawnMob(target:getID()+2);
DespawnMob(target:getID()+3);
mob = SpawnMob(target:getID()+1);
mob:updateEnmity(player);
--the "30 seconds of rest" you get before he attacks you, and making sure he teleports first in range
mob:addStatusEffectEx(EFFECT_BIND, 0, 1, 0, 30);
mob:addStatusEffectEx(EFFECT_SILENCE, 0, 1, 0, 40);
end
end; | gpl-3.0 |
alysher/portaltbc | dep/recastnavigation/RecastDemo/premake4.lua | 82 | 3551 | --
-- premake4 file to build RecastDemo
-- http://industriousone.com/premake
--
local action = _ACTION or ""
local todir = "Build/" .. action
solution "recastnavigation"
configurations {
"Debug",
"Release"
}
location (todir)
-- extra warnings, no exceptions or rtti
flags {
"ExtraWarnings",
"FloatFast",
"NoExceptions",
"NoRTTI",
"Symbols"
}
-- debug configs
configuration "Debug*"
defines { "DEBUG" }
targetdir ( todir .. "/lib/Debug" )
-- release configs
configuration "Release*"
defines { "NDEBUG" }
flags { "Optimize" }
targetdir ( todir .. "/lib/Release" )
-- windows specific
configuration "windows"
defines { "WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS" }
project "DebugUtils"
language "C++"
kind "StaticLib"
includedirs {
"../DebugUtils/Include",
"../Detour/Include",
"../DetourTileCache/Include",
"../Recast/Include"
}
files {
"../DebugUtils/Include/*.h",
"../DebugUtils/Source/*.cpp"
}
project "Detour"
language "C++"
kind "StaticLib"
includedirs {
"../Detour/Include"
}
files {
"../Detour/Include/*.h",
"../Detour/Source/*.cpp"
}
project "DetourCrowd"
language "C++"
kind "StaticLib"
includedirs {
"../DetourCrowd/Include",
"../Detour/Include",
"../Recast/Include"
}
files {
"../DetourCrowd/Include/*.h",
"../DetourCrowd/Source/*.cpp"
}
project "DetourTileCache"
language "C++"
kind "StaticLib"
includedirs {
"../DetourTileCache/Include",
"../Detour/Include",
"../Recast/Include"
}
files {
"../DetourTileCache/Include/*.h",
"../DetourTileCache/Source/*.cpp"
}
project "Recast"
language "C++"
kind "StaticLib"
includedirs {
"../Recast/Include"
}
files {
"../Recast/Include/*.h",
"../Recast/Source/*.cpp"
}
project "RecastDemo"
language "C++"
kind "WindowedApp"
includedirs {
"../RecastDemo/Include",
"../RecastDemo/Contrib",
"../RecastDemo/Contrib/fastlz",
"../DebugUtils/Include",
"../Detour/Include",
"../DetourCrowd/Include",
"../DetourTileCache/Include",
"../Recast/Include"
}
files {
"../RecastDemo/Include/*.h",
"../RecastDemo/Source/*.cpp",
"../RecastDemo/Contrib/fastlz/*.h",
"../RecastDemo/Contrib/fastlz/*.c"
}
-- project dependencies
links {
"DebugUtils",
"Detour",
"DetourCrowd",
"DetourTileCache",
"Recast"
}
-- distribute executable in RecastDemo/Bin directory
targetdir "Bin"
-- linux library cflags and libs
configuration { "linux", "gmake" }
buildoptions {
"`pkg-config --cflags sdl`",
"`pkg-config --cflags gl`",
"`pkg-config --cflags glu`"
}
linkoptions {
"`pkg-config --libs sdl`",
"`pkg-config --libs gl`",
"`pkg-config --libs glu`"
}
-- windows library cflags and libs
configuration { "windows" }
includedirs { "../RecastDemo/Contrib/SDL/include" }
libdirs { "../RecastDemo/Contrib/SDL/lib/x86" }
links {
"opengl32",
"glu32",
"sdlmain",
"sdl"
}
-- mac includes and libs
configuration { "macosx" }
kind "ConsoleApp" -- xcode4 failes to run the project if using WindowedApp
includedirs { "/Library/Frameworks/SDL.framework/Headers" }
buildoptions { "-Wunused-value -Wshadow -Wreorder -Wsign-compare -Wall" }
links {
"OpenGL.framework",
"/Library/Frameworks/SDL.framework",
"Cocoa.framework",
}
files {
"../RecastDemo/Include/SDLMain.h",
"../RecastDemo/Source/SDLMain.m",
-- These don't seem to work in xcode4 target yet.
-- "Info.plist",
-- "Icon.icns",
-- "English.lproj/InfoPlist.strings",
-- "English.lproj/MainMenu.xib",
}
| gpl-2.0 |
godly-devotion/Baka-MPlayer-old | Baka MPlayer/bin/Debug/libquvi-scripts/0.9/media/myspass.lua | 3 | 2960 | -- libquvi-scripts
-- Copyright (C) 2013 Toni Gundogdu <legatvs@gmail.com>
-- Copyright (C) 2012 Guido Leisker <guido@guido-leisker.de>
--
-- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
--
-- This program is free software: you can redistribute it and/or
-- modify it under the terms of the GNU Affero General Public
-- License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General
-- Public License along with this program. If not, see
-- <http://www.gnu.org/licenses/>.
--
local MySpass = {} -- Utility functions unique to this script
-- Identify the media script.
function ident(qargs)
return {
can_parse_url = MySpass.can_parse_url(qargs),
domains = table.concat({'myspass.de'}, ',')
}
end
-- Parse the media properties.
function parse(qargs)
-- Make mandatory: the media ID is needed to fetch the data XML.
qargs.id = qargs.input_url:match("(%d+)/?$") or error("no match: media ID")
local t = {
'http://www.myspass.de/myspass/includes/apps/video',
'/getvideometadataxml.php?id=', qargs.id
}
local c = quvi.http.fetch(table.concat(t)).data
local P = require 'lxp.lom'
local L = require 'quvi/lxph'
local x = P.parse(c)
qargs.thumb_url = L.find_first_tag(x, 'imagePreview')[1]
qargs.duration_ms = MySpass.to_duration_ms(L, x)
qargs.streams = MySpass.iter_streams(L, x)
qargs.title = MySpass.to_title(L, x)
return qargs
end
--
-- Utility functions
--
function MySpass.can_parse_url(qargs)
local U = require 'socket.url'
local t = U.parse(qargs.input_url)
if t and t.scheme and t.scheme:lower():match('^http$')
and t.host and t.host:lower():match('myspass%.de$')
-- Expect all URLs ending with digits to be videos.
and t.path and t.path:lower():match('^/myspass/.-/%d+/?$')
then
return true
else
return false
end
end
function MySpass.iter_streams(L, x)
local u = L.find_first_tag(x, 'url_flv')[1]
local S = require 'quvi/stream'
return {S.stream_new(u)}
end
function MySpass.to_duration_ms(L, x)
local m,s = L.find_first_tag(x, 'duration')[1]:match('(%d+)%:(%d+)')
m = tonumber(((m or ''):gsub('%a',''))) or 0
m = tonumber(((s or ''):gsub('%a',''))) or 0
return (m*60000) + (s*1000)
end
function MySpass.to_title(L, x)
local t = {
L.find_first_tag(x, 'format')[1],
string.format('s%02de%02d -', L.find_first_tag(x, 'season')[1],
L.find_first_tag(x, 'episode')[1]),
L.find_first_tag(x, 'title')[1]
}
return table.concat(t, ' ')
end
-- vim: set ts=2 sw=2 tw=72 expandtab:
| gpl-2.0 |
The-HalcyonDays/darkstar | scripts/zones/Kazham-Jeuno_Airship/npcs/Oslam.lua | 12 | 2037 | -----------------------------------
-- Area: Kazham-Jeuno Airship
-- NPC: Oslam
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Kazham-Jeuno_Airship/TextIDs"] = nil;
require("scripts/zones/Kazham-Jeuno_Airship/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local vHour = VanadielHour();
local vMin = VanadielMinute();
while vHour >= 1 do
vHour = vHour - 6;
end
local message = WILL_REACH_KAZHAM;
if (vHour == -5) then
if (vMin >= 48) then
vHour = 3;
message = WILL_REACH_JEUNO;
else
vHour = 0;
end
elseif (vHour == -4) then
vHour = 2;
message = WILL_REACH_JEUNO;
elseif (vHour == -3) then
vHour = 1;
message = WILL_REACH_JEUNO;
elseif (vHour == -2) then
if (vMin <= 49) then
vHour = 0;
message = WILL_REACH_JEUNO;
else
vHour = 3;
end
elseif (vHour == -1) then
vHour = 2;
elseif (vHour == 0) then
vHour = 1;
end
local vMinutes = 0;
if (message == WILL_REACH_JEUNO) then
vMinutes = (vHour * 60) + 49 - vMin;
else -- WILL_REACH_KAZHAM
vMinutes = (vHour * 60) + 48 - vMin;
end
if (vMinutes <= 30) then
if( message == WILL_REACH_KAZHAM) then
message = IN_KAZHAM_MOMENTARILY;
else -- WILL_REACH_JEUNO
message = IN_JEUNO_MOMENTARILY;
end
elseif (vMinutes < 60) then
vHour = 0;
end
player:messageSpecial( message, math.floor((2.4 * vMinutes) / 60), math.floor( vMinutes / 60 + 0.5));
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 |
NAM-IL/VLC-2_2_0 | share/lua/playlist/mpora.lua | 97 | 2565 | --[[
$Id$
Copyright © 2009 the VideoLAN team
Authors: Konstantin Pavlov (thresh@videolan.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-- Probe function.
function probe()
return vlc.access == "http"
and string.match( vlc.path, "video%.mpora%.com/watch/" )
end
-- Parse function.
function parse()
p = {}
while true do
-- Try to find the video's title
line = vlc.readline()
if not line then break end
if string.match( line, "meta name=\"title\"" ) then
_,_,name = string.find( line, "content=\"(.*)\" />" )
end
if string.match( line, "image_src" ) then
_,_,arturl = string.find( line, "image_src\" href=\"(.*)\" />" )
end
if string.match( line, "video_src" ) then
_,_,video = string.find( line, 'href="http://video%.mpora%.com/ep/(.*)%.swf" />' )
end
end
if not name or not arturl or not video then return nil end
-- Try and get URL for SD video.
sd = vlc.stream("http://api.mpora.com/tv/player/playlist/vid/"..video.."/")
if not sd then return nil end
page = sd:read( 65653 )
sdurl = string.match( page, "url=\"(.*)\" />")
page = nil
table.insert( p, { path = sdurl; name = name; arturl = arturl; } )
-- Try and check if HD video is available.
checkhd = vlc.stream("http://api.mpora.com/tv/player/load/vid/"..video.."/platform/video/domain/video.mpora.com/" )
if not checkhd then return nil end
page = checkhd:read( 65653 )
hashd = tonumber( string.match( page, "<has_hd>(%d)</has_hd>" ) )
page = nil
if hashd then
hd = vlc.stream("http://api.mpora.com/tv/player/playlist/vid/"..video.."/hd/true/")
page = hd:read( 65653 )
hdurl = string.match( page, "url=\"(.*)\" />")
table.insert( p, { path = hdurl; name = name.." (HD)"; arturl = arturl; } )
end
return p
end
| lgpl-2.1 |
The-HalcyonDays/darkstar | scripts/zones/Ghoyus_Reverie/Zone.lua | 36 | 1119 | -----------------------------------
--
-- Zone: Ghoyus_Reverie
--
-----------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Ghoyus_Reverie/TextIDs"] = nil;
require("scripts/zones/Ghoyus_Reverie/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
cs = -1;
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 |
The-HalcyonDays/darkstar | scripts/globals/items/serving_of_yellow_curry.lua | 35 | 2067 | -----------------------------------------
-- ID: 4517
-- Item: serving_of_yellow_curry
-- Food Effect: 3hours, All Races
-----------------------------------------
-- Health Points 20
-- Strength 5
-- Agility 2
-- Intelligence -4
-- HP Recovered While Healing 2
-- MP Recovered While Healing 1
-- Attack 20% (caps @ 75)
-- Ranged Attack 20% (caps @ 75)
-- Resist Sleep
-- Resist Stun
-----------------------------------------
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,10800,4517);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 5);
target:addMod(MOD_AGI, 2);
target:addMod(MOD_INT, -4);
target:addMod(MOD_HPHEAL, 2);
target:addMod(MOD_MPHEAL, 1);
target:addMod(MOD_FOOD_ATTP, 20);
target:addMod(MOD_FOOD_ATT_CAP, 75);
target:addMod(MOD_FOOD_RATTP, 20);
target:addMod(MOD_FOOD_RATT_CAP, 75);
target:addMod(MOD_SLEEPRES, 7);
target:addMod(MOD_STUNRES, 7);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 5);
target:delMod(MOD_AGI, 2);
target:delMod(MOD_INT, -4);
target:delMod(MOD_HPHEAL, 2);
target:delMod(MOD_MPHEAL, 1);
target:delMod(MOD_FOOD_ATTP, 20);
target:delMod(MOD_FOOD_ATT_CAP, 75);
target:delMod(MOD_FOOD_RATTP, 20);
target:delMod(MOD_FOOD_RATT_CAP, 75);
target:delMod(MOD_SLEEPRES, 7);
target:delMod(MOD_STUNRES, 7);
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/globals/mobskills/Grim_Halo.lua | 7 | 1089 | ---------------------------------------------------
-- Grim Halo
-- Deals damage to a all targets. Additional effect: Knockback
-- Only used by Fomors that wield a two-handed weapon (principally WAR, BLM, DRK, SAM, DRG, and SMN fomors).
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------------
function onMobSkillCheck(target,mob,skill)
local job = mob:getMainJob();
if(job == JOB_WAR or job == JOB_BLM or job == JOB_DRK or job == JOB_SAM or job == JOB_DRG or job == JOB_SMN) then
return 0;
end
return 1;
end;
function onMobWeaponSkill(target, mob, skill)
-- Needs Knockback added
local numhits = 1;
local accmod = 1;
local dmgmod = 2.5;
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);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/The_Eldieme_Necropolis/npcs/_5f7.lua | 34 | 1110 | -----------------------------------
-- Area: The Eldieme Necropolis
-- NPC: Leviathan's Gate
-- @pos 249 -34 100 195
-----------------------------------
package.loaded["scripts/zones/The_Eldieme_Necropolis/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/The_Eldieme_Necropolis/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 9) then
player:messageSpecial(SOLID_STONE);
end
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 |
The-HalcyonDays/darkstar | scripts/globals/items/plate_of_dorado_sushi.lua | 21 | 1679 | -----------------------------------------
-- ID: 5178
-- Item: plate_of_dorado_sushi
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Dexterity 5
-- Accuracy % 15
-- Accuracy Cap 75
-- Ranged ACC % 15
-- Ranged ACC Cap 75
-- Sleep Resist 5
-----------------------------------------
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,1800,5178);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_ENMITY, 3);
target:addMod(MOD_DEX, 5);
target:addMod(MOD_FOOD_ACCP, 15);
target:addMod(MOD_FOOD_ACC_CAP, 75);
target:addMod(MOD_FOOD_RACCP, 15);
target:addMod(MOD_FOOD_RACC_CAP, 75);
target:addMod(MOD_SLEEPRES, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_ENMITY, 3);
target:delMod(MOD_DEX, 5);
target:delMod(MOD_FOOD_ACCP, 15);
target:delMod(MOD_FOOD_ACC_CAP, 75);
target:delMod(MOD_FOOD_RACCP, 15);
target:delMod(MOD_FOOD_RACC_CAP, 75);
target:delMod(MOD_SLEEPRES, 5);
end;
| gpl-3.0 |
rrpgfirecast/firecast | Plugins/Sheets/Call Of Cthulhu Dark Ages/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Pendragon/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Shadow of the Demon Lord/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/PokeRPG/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Demônio A Queda/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Pokemon D20/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Mutantes e Malfeitores 3e/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Call Of Cthulhu 7e/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha Mighty Blade 3e/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Michiria/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Pathfinder_2E/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/Sheets/Ficha L5A/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
rrpgfirecast/firecast | Plugins/ChatMods/AfkBot/sdk/rrpgLFM.lua | 99 | 5179 | require("rrpgUtil.lua");
require("rrpgGUI.lua");
local serpent = nil;
local lfmObjectsStrongRef = {};
function lfm_getObject(ctrlOrHandle)
if ctrlOrHandle == nil then
return nil;
elseif isNumber(ctrlOrHandle) then
return lfmObjectsStrongRef[ctrlOrHandle];
else
return ctrlOrHandle;
end;
end;
function lfm_newObjectHandle(className)
local obj = gui.fromHandle(_obj_newObject(className));
lfmObjectsStrongRef[obj.handle] = obj;
return obj.handle;
end;
function lfm_destroyObject(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
if obj ~= nil then
lfmObjectsStrongRef[obj.handle] = nil;
obj:destroy();
end
end
function lfm_enumEvents(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local eves = {};
local qt = 0;
for k, v in pairs(obj.eves) do
qt = qt + 1;
eves[qt] = {name = k, parameters = v};
end;
return eves;
end;
function lfm_enumProps(ctrlOrHandle)
local obj = lfm_getObject(ctrlOrHandle);
local props = {};
local qt = 0;
for k, v in pairs(obj.props) do
qt = qt + 1;
props[qt] = {name = k, tipo = v.tipo, values = v.values, getter = v.getter, setter = v.setter};
end;
return props;
end;
local function _getStrOfSetTable(value)
local ret = "";
local qt = 0;
for k, v in pairs(value) do
if qt == 0 then
ret = tostring(v);
else
ret = ret .. " " .. tostring(v);
end;
qt = qt + 1;
end;
return ret;
end;
function lfm_valueToStr(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
if value then
return "true";
else
return "false";
end;
elseif (tipo == "int") then
return tostring(round(value));
elseif tipo == "double" then
return tostring(value);
elseif tipo == "enum" then
return tostring(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == 'url') then
return value;
elseif tipo == "set" then
return _getStrOfSetTable(value, valuesOfTipo);
elseif (tipo == "bounds") or (tipo == "table") then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(value, {comment = false});
else
return "";
end;
end;
function lfm_strToValue(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "bool" then
return value == "true";
elseif (tipo == "int") or (tipo =="double") then
return tonumber(value);
elseif (tipo == "string") or (tipo == "color") or (tipo == "url") then
return value;
elseif tipo == "enum" then
if isStrInTable(value, valuesOfTipo) then
return value;
else
return "";
end;
elseif tipo == "set" then
local objSet = {};
if type(value) == "string" then
for k, v in pairs(valuesOfTipo) do
if string.find(value, v) then
objSet[#objSet + 1] = v;
end;
end;
elseif type(value) == "table" then
objSet = value;
end;
return objSet;
elseif (tipo == "bounds") or (tipo == "table") then
f, e = load("return " .. value);
if e then error(e) end
return f();
else
return nil;
end;
end;
local function simplificarTable(t)
local ret = {};
for k, v in pairs(t) do
if isNumber(k) or (k == v) then
ret[#ret + 1] = v;
else
ret[k]=v;
end;
end;
return ret;
end
function lfm_valueToStrToUser(value, tipo, valuesOfTipo)
tipo = lowercase(tipo);
if tipo == "set" then
if serpent == nil then
serpent = require("serpent.dlua");
end;
return serpent.line(simplificarTable(value), {comment = false});
else
return lfm_valueToStr(value, tipo, valuesOfTipo);
end;
end;
function lfm_getPropAsString(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStr(v, prop.tipo, prop.values);
end;
function lfm_setPropAsString(ctrlOrHandle, propName, vAsStr)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
v = lfm_strToValue(vAsStr, prop.tipo, prop.values);
local setterName = prop.setter;
if setterName ~= nil then
local setter = obj[setterName];
setter(obj, v);
else
local writePropName = prop.writeProp;
if writePropName == nil then
error(propName .. " is readonly");
end;
_obj_setProp(obj.handle, writePropName, v);
end;
end;
function lfm_getPropAsStringToUser(ctrlOrHandle, propName)
local obj = lfm_getObject(ctrlOrHandle);
local props = obj.props;
if props == nil then
return nil;
end;
local prop = props[propName];
if prop == nil then
return nil;
end;
local getter = obj[prop.getter];
local v = getter(obj);
return lfm_valueToStrToUser(v, prop.tipo, prop.values);
end;
function lfm_setParent(ctrlOrHandleFilho, ctrlOrHandlePai)
local objFilho = lfm_getObject(ctrlOrHandleFilho);
local objPai = lfm_getObject(ctrlOrHandlePai);
objFilho:setParent(objPai);
end;
function lfm_enumerarClasses()
local ret = {};
for k, v in pairs(gui.guiLoaders) do
ret[#ret + 1]= k;
end;
return ret;
end; | apache-2.0 |
The-HalcyonDays/darkstar | scripts/globals/items/serving_of_salmon_meuniere.lua | 35 | 1404 | -----------------------------------------
-- ID: 4583
-- Item: serving_of_salmon_meuniere
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Dexterity 2
-- Mind -2
-- Ranged ACC % 7
-- Ranged ACC Cap 10
-----------------------------------------
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,10800,4583);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 2);
target:addMod(MOD_MND, -2);
target:addMod(MOD_FOOD_RACCP, 7);
target:addMod(MOD_FOOD_RACC_CAP, 10);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 2);
target:delMod(MOD_MND, -2);
target:delMod(MOD_FOOD_RACCP, 7);
target:delMod(MOD_FOOD_RACC_CAP, 10);
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Bastok_Mines/npcs/Ranpi-Pappi.lua | 38 | 1047 | -----------------------------------
-- Area: Bastok Mines
-- NPC: Ranpi-Pappi
-- Type: Standard NPC
-- @zone: 234
-- @pos -4.535 -1.044 49.881
--
-- Auto-Script: Requires Verification (Verified by Brando)
-----------------------------------
package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil;
require("scripts/zones/Bastok_Mines/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x004d);
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 |
The-HalcyonDays/darkstar | scripts/zones/Bostaunieux_Oubliette/npcs/Grounds_Tome.lua | 34 | 1160 | -----------------------------------
-- Area: Bostaunieux Oubliette
-- NPC: Grounds Tome
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/groundsofvalor");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
startGov(GOV_EVENT_BOSTAUNIEUX_OUBLIETTE,player);
end;
-----------------------------------
-- onEventSelection
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
updateGov(player,csid,option,610,611,612,613,614,615,616,617,0,0);
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
finishGov(player,csid,option,610,611,612,613,614,615,616,617,0,0,GOV_MSG_BOSTAUNIEUX_OUBLIETTE);
end;
| gpl-3.0 |
The-HalcyonDays/darkstar | scripts/zones/Northern_San_dOria/npcs/Miaux.lua | 23 | 6482 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Miaux
-- Type: Quest Giver
-- @pos -169.127 2.999 158.677 231
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local aCraftsmansWork = player:getQuestStatus(SANDORIA,A_CRAFTSMAN_S_WORK);
local Quotas_Status = player:getVar("ChasingQuotas_Progress");
if(player:getMainJob() == 14 and player:getMainLvl() >= AF1_QUEST_LEVEL and aCraftsmansWork == QUEST_AVAILABLE) then
if(player:getVar("has_seen_drgaf1_quest_already") == 0) then
player:startEvent(0x0049);
else -- If player has seen the big cut scene, give them a smaller one.
player:startEvent(0x0047);
end
elseif(aCraftsmansWork == QUEST_ACCEPTED and player:hasKeyItem(ALTEPA_POLISHING_STONE) == false) then
player:startEvent(0x0045);
elseif(aCraftsmansWork == QUEST_ACCEPTED) then
player:startEvent(0x0046);
elseif(Quotas_Status == 2) then
player:startEvent(67); -- I found this earring.
elseif(Quotas_Status == 3 or Quotas_Status == 4) then
player:startEvent(68); -- Post-earring, move along.
elseif(Quotas_Status >= 5) then
player:startEvent(66); -- The earring was helpful?
else
player:startEvent(0x000b);
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 == 0x0049 and option == 0) then -- first part of long CS -- declines questgiver
player:setVar("has_seen_drgaf1_quest_already",1);
elseif((csid == 0x0049 or csid == 0x0047) and option == 1) then
player:addQuest(SANDORIA,A_CRAFTSMAN_S_WORK);
player:setVar("has_seen_drgaf1_quest_already",0);
player:setVar("aCraftsmanWork",1);
elseif(csid == 0x0046) then -- This is only if player has Altepa Polishing Stone
if(player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,16887);-- Peregrine (DRG AF1)
else
player:setVar("aCraftsmanWork",0);
player:delKeyItem(ALTEPA_POLISHING_STONE);
player:addItem(16887);
player:messageSpecial(ITEM_OBTAINED,16887); -- Peregrine (DRG AF1)
player:addFame(SANDORIA,SAN_FAME*AF1_FAME);
player:completeQuest(SANDORIA,A_CRAFTSMAN_S_WORK);
end
elseif(csid == 67) then
player:addKeyItem(SHINY_EARRING);
player:messageSpecial(KEYITEM_OBTAINED,SHINY_EARRING);
player:setVar("ChasingQuotas_Progress",3);
end
end;
-- 0x000b Miaux : "<Sigh> Why must all craftsmen be so uptight?"
-- 0x0049 Miaux : "I wish to have a breastplate repaired... Y/N dialog
-- 0x0047 Miaux : "I...I hesitate to impose upon you again, but would it be possible for you to find
-- me an Altepa polishing stone? Naturally, I will pay you for your troubles...
-- accept the task? Yes/No dialog Thank you. It would mean so much to me."
-- 0x0045 Miaux : "The Altepa polishing stone can be found in the Eastern Altepa Desert. Please take
-- care on your travels!"
-- 0x0046 Miaux : "So this is the Altepa polishing stone that Ranchuriome was talking about. I am
-- most grateful for your help. Please accept this as payment." ------------------------------------------Reward gil
-- "Miaux : Here, Ranchuriome. <Character> is the reason we have this!"
-- Ranchuriome : "Excellent! You managed to find one. Now I can start on those repairs. I'll
-- have it ready for you by dinnertime."
-- Ranchuriome : "I've really been feeling my years lately... No matter. I'm sure I'll perk up
-- once I start working."
-- Miaux : "I'm most grateful to you!"
-- 0x0048 Miaux : "You don't see many people with that kind of integrity around anymore. If my
-- father was still alive, they would have struck up a solid friendship, I'm sure."
-- 0x0042 Miaux : "Oh, that shiny earring came in handy after all? That's wonderful! I'm glad
-- I could help someone out in the same way that you and Ranchuriome helped me.
-- Miaux: I don't think I'm suited for a career as a detective, though... I think I'll concentrate
-- on helping people in a way that's more within my capabilities."
-- (10)0x000A Miaux : "Thanks to your help, my father's breastplate is looking like new, but...
-- That nice old man, Ranchuriome, has passed away.
-- Miaux : "I can't help but think it's my fault in some way...that the repairs he did for me were
-- too strenuous. When I attended the funeral to pay my respects, though, his features seemed to
-- be at peace."
-- (67)0x0043 Miaux : "I attended Ranchuriome's funeral to pay my respects and express my thanks for
-- his kindness. During the ceremony, I was distracted by an unusal lady among the mourners.
-- Miaux : "Something about this woman seemed out of place. I tried to follow her after the funeral
-- ended, but... I lost sight of her not long after. I searched around, trying to find her again.
-- Instead, I came across Ranchuriome's son lying unconscious on the ground. I tended to his wound,
-- and thankfully, he soon regained consciousness. I found this lying nearby.
-- Miaux : "This shiny earring might be a clue as to what happened. It's probably just my overactive
-- imagination, but perhaps it will help in some way. Here, you should hold onto it, just in case."
-- (68)0x0044 Miaux : "A suspicious woman and a shiny earring... Probably just my overactive imagination."
-- (535)0x0217 City - The fortress of sandy... But now, her reign of glory... The sun set on the kingdom
-- of knights... Yet young Elvaan knights still venture proudly... On this particular day there comes a new...
-- The king wishes to bolster his ranks, and <Character>... Should fortune favor her, bards across the land...
-- Of course, she has only begun her rise to glory... Never before has she set foot within the Elvaan Capital...
-- Rochefogne : "Say, are you an adventurer?"
| gpl-3.0 |
rrpgfirecast/firecast | Plugins/Sheets/Os Mundos dos Mortos/output/rdkObjs/starkpdf/2.lfm.lua | 1 | 11212 | require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmstarkpdf2_svg()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmstarkpdf2_svg");
obj:setAlign("client");
obj:setTheme("light");
obj:setMargins({top=1});
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.rectangle1 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj.scrollBox1);
obj.rectangle1:setWidth(893);
obj.rectangle1:setHeight(1191);
obj.rectangle1:setColor("white");
obj.rectangle1:setName("rectangle1");
obj.image1 = GUI.fromHandle(_obj_newObject("image"));
obj.image1:setParent(obj.rectangle1);
obj.image1:setLeft(0);
obj.image1:setTop(0);
obj.image1:setWidth(893);
obj.image1:setHeight(1191);
obj.image1:setSRC("/starkpdf/images/2.png");
obj.image1:setStyle("stretch");
obj.image1:setOptimize(true);
obj.image1:setName("image1");
obj.layout1 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout1:setParent(obj.rectangle1);
obj.layout1:setLeft(255);
obj.layout1:setTop(227);
obj.layout1:setWidth(169);
obj.layout1:setHeight(171);
obj.layout1:setName("layout1");
obj.textEditor1 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor1:setParent(obj.layout1);
obj.textEditor1:setLeft(0);
obj.textEditor1:setTop(0);
obj.textEditor1:setWidth(169);
obj.textEditor1:setHeight(171);
obj.textEditor1:setFontSize(14.2);
obj.textEditor1:setFontColor("#000000");
obj.textEditor1:setField("Caixa_de_texto_24");
obj.textEditor1:setTransparent(true);
obj.textEditor1:setName("textEditor1");
obj.layout2 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout2:setParent(obj.rectangle1);
obj.layout2:setLeft(47);
obj.layout2:setTop(224);
obj.layout2:setWidth(172);
obj.layout2:setHeight(175);
obj.layout2:setName("layout2");
obj.textEditor2 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor2:setParent(obj.layout2);
obj.textEditor2:setLeft(0);
obj.textEditor2:setTop(0);
obj.textEditor2:setWidth(172);
obj.textEditor2:setHeight(175);
obj.textEditor2:setFontSize(14.2);
obj.textEditor2:setFontColor("#000000");
obj.textEditor2:setField("Caixa_de_texto_23");
obj.textEditor2:setTransparent(true);
obj.textEditor2:setName("textEditor2");
obj.layout3 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout3:setParent(obj.rectangle1);
obj.layout3:setLeft(456);
obj.layout3:setTop(228);
obj.layout3:setWidth(180);
obj.layout3:setHeight(171);
obj.layout3:setName("layout3");
obj.textEditor3 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor3:setParent(obj.layout3);
obj.textEditor3:setLeft(0);
obj.textEditor3:setTop(0);
obj.textEditor3:setWidth(180);
obj.textEditor3:setHeight(171);
obj.textEditor3:setFontSize(14.2);
obj.textEditor3:setFontColor("#000000");
obj.textEditor3:setField("Caixa_de_texto_25");
obj.textEditor3:setTransparent(true);
obj.textEditor3:setName("textEditor3");
obj.layout4 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout4:setParent(obj.rectangle1);
obj.layout4:setLeft(663);
obj.layout4:setTop(229);
obj.layout4:setWidth(176);
obj.layout4:setHeight(170);
obj.layout4:setName("layout4");
obj.textEditor4 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor4:setParent(obj.layout4);
obj.textEditor4:setLeft(0);
obj.textEditor4:setTop(0);
obj.textEditor4:setWidth(176);
obj.textEditor4:setHeight(170);
obj.textEditor4:setFontSize(14.2);
obj.textEditor4:setFontColor("#000000");
obj.textEditor4:setField("Caixa_de_texto_26");
obj.textEditor4:setTransparent(true);
obj.textEditor4:setName("textEditor4");
obj.layout5 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout5:setParent(obj.rectangle1);
obj.layout5:setLeft(40);
obj.layout5:setTop(533);
obj.layout5:setWidth(793);
obj.layout5:setHeight(83);
obj.layout5:setName("layout5");
obj.textEditor5 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor5:setParent(obj.layout5);
obj.textEditor5:setLeft(0);
obj.textEditor5:setTop(0);
obj.textEditor5:setWidth(793);
obj.textEditor5:setHeight(83);
obj.textEditor5:setFontSize(14.2);
obj.textEditor5:setFontColor("#000000");
obj.textEditor5:setField("Caixa_de_texto_27");
obj.textEditor5:setTransparent(true);
obj.textEditor5:setName("textEditor5");
obj.layout6 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout6:setParent(obj.rectangle1);
obj.layout6:setLeft(43);
obj.layout6:setTop(692);
obj.layout6:setWidth(792);
obj.layout6:setHeight(81);
obj.layout6:setName("layout6");
obj.textEditor6 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor6:setParent(obj.layout6);
obj.textEditor6:setLeft(0);
obj.textEditor6:setTop(0);
obj.textEditor6:setWidth(792);
obj.textEditor6:setHeight(81);
obj.textEditor6:setFontSize(14.2);
obj.textEditor6:setFontColor("#000000");
obj.textEditor6:setField("Caixa_de_texto_28");
obj.textEditor6:setTransparent(true);
obj.textEditor6:setName("textEditor6");
obj.layout7 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout7:setParent(obj.rectangle1);
obj.layout7:setLeft(42);
obj.layout7:setTop(850);
obj.layout7:setWidth(791);
obj.layout7:setHeight(82);
obj.layout7:setName("layout7");
obj.textEditor7 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor7:setParent(obj.layout7);
obj.textEditor7:setLeft(0);
obj.textEditor7:setTop(0);
obj.textEditor7:setWidth(791);
obj.textEditor7:setHeight(82);
obj.textEditor7:setFontSize(14.2);
obj.textEditor7:setFontColor("#000000");
obj.textEditor7:setField("Caixa_de_texto_29");
obj.textEditor7:setTransparent(true);
obj.textEditor7:setName("textEditor7");
obj.layout8 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout8:setParent(obj.rectangle1);
obj.layout8:setLeft(47);
obj.layout8:setTop(1018);
obj.layout8:setWidth(790);
obj.layout8:setHeight(86);
obj.layout8:setName("layout8");
obj.textEditor8 = GUI.fromHandle(_obj_newObject("textEditor"));
obj.textEditor8:setParent(obj.layout8);
obj.textEditor8:setLeft(0);
obj.textEditor8:setTop(0);
obj.textEditor8:setWidth(790);
obj.textEditor8:setHeight(86);
obj.textEditor8:setFontSize(14.2);
obj.textEditor8:setFontColor("#000000");
obj.textEditor8:setField("Caixa_de_texto_30");
obj.textEditor8:setTransparent(true);
obj.textEditor8:setName("textEditor8");
obj.layout9 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout9:setParent(obj.rectangle1);
obj.layout9:setLeft(265);
obj.layout9:setTop(1141);
obj.layout9:setWidth(162);
obj.layout9:setHeight(23);
obj.layout9:setName("layout9");
obj.edit1 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit1:setParent(obj.layout9);
obj.edit1:setTransparent(true);
obj.edit1:setFontSize(14.2);
obj.edit1:setFontColor("#000000");
obj.edit1:setHorzTextAlign("leading");
obj.edit1:setVertTextAlign("center");
obj.edit1:setLeft(0);
obj.edit1:setTop(0);
obj.edit1:setWidth(162);
obj.edit1:setHeight(24);
obj.edit1:setField("Caixa_de_texto_31");
obj.edit1:setName("edit1");
function obj:_releaseEvents()
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.edit1 ~= nil then self.edit1:destroy(); self.edit1 = nil; end;
if self.textEditor4 ~= nil then self.textEditor4:destroy(); self.textEditor4 = nil; end;
if self.layout6 ~= nil then self.layout6:destroy(); self.layout6 = nil; end;
if self.layout4 ~= nil then self.layout4:destroy(); self.layout4 = nil; end;
if self.layout9 ~= nil then self.layout9:destroy(); self.layout9 = nil; end;
if self.textEditor1 ~= nil then self.textEditor1:destroy(); self.textEditor1 = nil; end;
if self.image1 ~= nil then self.image1:destroy(); self.image1 = nil; end;
if self.textEditor5 ~= nil then self.textEditor5:destroy(); self.textEditor5 = nil; end;
if self.layout3 ~= nil then self.layout3:destroy(); self.layout3 = nil; end;
if self.textEditor6 ~= nil then self.textEditor6:destroy(); self.textEditor6 = nil; end;
if self.textEditor2 ~= nil then self.textEditor2:destroy(); self.textEditor2 = nil; end;
if self.textEditor7 ~= nil then self.textEditor7:destroy(); self.textEditor7 = nil; end;
if self.layout8 ~= nil then self.layout8:destroy(); self.layout8 = nil; end;
if self.layout1 ~= nil then self.layout1:destroy(); self.layout1 = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.layout2 ~= nil then self.layout2:destroy(); self.layout2 = nil; end;
if self.layout5 ~= nil then self.layout5:destroy(); self.layout5 = nil; end;
if self.layout7 ~= nil then self.layout7:destroy(); self.layout7 = nil; end;
if self.textEditor8 ~= nil then self.textEditor8:destroy(); self.textEditor8 = nil; end;
if self.textEditor3 ~= nil then self.textEditor3:destroy(); self.textEditor3 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmstarkpdf2_svg()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmstarkpdf2_svg();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmstarkpdf2_svg = {
newEditor = newfrmstarkpdf2_svg,
new = newfrmstarkpdf2_svg,
name = "frmstarkpdf2_svg",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmstarkpdf2_svg = _frmstarkpdf2_svg;
Firecast.registrarForm(_frmstarkpdf2_svg);
return _frmstarkpdf2_svg;
| apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.