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 |
|---|---|---|---|---|---|
mercury233/ygopro-scripts | c42956963.lua | 2 | 1908 | --ナイトメア・デーモンズ
function c42956963.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c42956963.cost)
e1:SetTarget(c42956963.target)
e1:SetOperation(c42956963.activate)
c:RegisterEffect(e1)
end
function c42956963.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,nil) end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,nil)
Duel.Release(g,REASON_COST)
end
function c42956963.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>2
and Duel.IsPlayerCanSpecialSummonMonster(tp,42956964,0x45,TYPES_TOKEN_MONSTER,2000,2000,6,RACE_FIEND,ATTRIBUTE_DARK,POS_FACEUP_ATTACK,1-tp) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,3,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,3,0,0)
end
function c42956963.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
if Duel.GetLocationCount(1-tp,LOCATION_MZONE)<3 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,42956964,0x45,TYPES_TOKEN_MONSTER,2000,2000,6,RACE_FIEND,ATTRIBUTE_DARK,POS_FACEUP_ATTACK,1-tp) then return end
for i=1,3 do
local token=Duel.CreateToken(tp,42956964)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_ATTACK) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(c42956963.damop)
token:RegisterEffect(e1,true)
end
end
Duel.SpecialSummonComplete()
end
function c42956963.damop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsReason(REASON_DESTROY) then
Duel.Damage(c:GetPreviousControler(),800,REASON_EFFECT)
end
e:Reset()
end
| gpl-2.0 |
AntonioModer/fuccboiGDX | fuccboi/world/Pool.lua | 1 | 3211 | local Class = require (fuccboi_path .. '/libraries/classic/classic')
local Pool = Class:extend()
function Pool:new(area, name, size, overflow_rule)
self.area = area
self.name = name
self.size = size
self.overflow_rule = string.lower(overflow_rule or 'oldest')
self.objects = {}
for i = 1, self.size do
self.objects[i] = {object = self.area:poolCreateEntity(name, -100000, -100000, {no_layer = self.area.fg.classes[name].no_layer}),
in_use = false, last_time = love.timer.getTime()}
end
end
function Pool:getFirstFreeObject()
-- Mark object as being use, set its last "get" time and return it
for i = 1, self.size do
if not self.objects[i].in_use then
self.objects[i].in_use = true
self.objects[i].last_time = love.timer.getTime()
self.objects[i].object.pool_active = true
return self.objects[i].object
end
end
-- In case no object is free, use this pool's overflow rule to find (or to not find) an entity
if self.overflow_rule == 'oldest' then
local max, j = -100000, 1
for i = 1, self.size do
local dt = love.timer.getTime() - self.objects[i].last_time
if dt > max then max = dt; j = i end
end
self.objects[j].last_time = love.timer.getTime()
self.objects[j].object.pool_active = true
return self.objects[j].object
elseif self.overflow_rule == 'random' then
return self.objects[math.random(1, self.size)].object
elseif self.overflow_rule == 'distance' then
local max, j = -100000, 1
for i = 1, self.size do
local object = self.objects[i].object
local c_x, c_y = object.area.world.camera:getWorldCoords(object.area.fg.screen_width/2, object.area.fg.screen_height/2)
local dx, dy = c_x - object.x, c_y - object.y
local d = dx*dx + dy*dy
if d > max then max = d; j = i end
end
self.objects[j].last_time = love.timer.getTime()
self.objects[j].object.pool_active = true
return self.objects[j].object
elseif self.overflow_rule == 'never' then end
end
function Pool:unsetObject(object)
-- Free object and call its unset function
for i = 1, self.size do
if object.id == self.objects[i].object.id then
self.objects[i].in_use = false
self.objects[i].object.pool_active = false
self.objects[i].object.dead = false
-- If has unset function, call it
if self.objects[i].object.unset then
self.objects[i].object:unset()
-- Otherwise use default unset
else
self.objects[i].object.x = -100000
self.objects[i].object.y = -100000
-- Unset position of all bodies if the object has bodies
if self.objects[i].object.bodies then
for j = 1, #self.objects[i].object.bodies do
self.objects[i].object.bodies[j]:setPosition(-100000, -100000)
end
end
end
return
end
end
end
return Pool
| mit |
mercury233/ygopro-scripts | c68601507.lua | 2 | 1243 | --武神器-ハバキリ
function c68601507.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(68601507,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c68601507.atkcon)
e1:SetCost(c68601507.atkcost)
e1:SetOperation(c68601507.atkop)
c:RegisterEffect(e1)
end
function c68601507.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=Duel.GetAttackTarget()
if not c then return false end
if c:IsControler(1-tp) then c=Duel.GetAttacker() end
e:SetLabelObject(c)
return c and c:IsSetCard(0x88) and c:IsRace(RACE_BEASTWARRIOR) and c:IsRelateToBattle()
end
function c68601507.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c68601507.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject()
if c:IsFaceup() and c:IsRelateToBattle() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_DAMAGE_CAL)
e1:SetValue(c:GetBaseAttack()*2)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c41306080.lua | 3 | 3227 | --ヒヤリ@イグニスター
function c41306080.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(41306080,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,41306080)
e1:SetCondition(c41306080.spcon)
e1:SetTarget(c41306080.sptg)
e1:SetOperation(c41306080.spop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(41306080,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,41306081)
e2:SetCost(c41306080.thcost)
e2:SetTarget(c41306080.thtg)
e2:SetOperation(c41306080.thop)
c:RegisterEffect(e2)
end
function c41306080.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x135)
end
function c41306080.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c41306080.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c41306080.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c41306080.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function c41306080.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,c,RACE_CYBERSE) end
local g=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,c,RACE_CYBERSE)
e:SetLabel(g:GetFirst():GetType())
Duel.Release(g,REASON_COST)
end
function c41306080.thfilter1(c)
return c:IsLevelAbove(5) and c:IsSetCard(0x135) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c41306080.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(c41306080.thfilter1,tp,LOCATION_DECK,0,1,nil)
and not c:IsLevel(4) and c:IsLevelAbove(1) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c41306080.thfilter2(c)
return c:IsCode(85327820) and c:IsAbleToHand()
end
function c41306080.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g1=Duel.SelectMatchingCard(tp,c41306080.thfilter1,tp,LOCATION_DECK,0,1,1,nil)
if g1:GetCount()>0 and Duel.SendtoHand(g1,nil,REASON_EFFECT)~=0 and g1:GetFirst():IsLocation(LOCATION_HAND) then
Duel.ConfirmCards(1-tp,g1)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(4)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
local g2=Duel.GetMatchingGroup(c41306080.thfilter2,tp,LOCATION_DECK,0,nil)
if bit.band(e:GetLabel(),TYPE_LINK)~=0 and g2:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(41306080,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g2:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
end
end
| gpl-2.0 |
guillaume144/jeu-rp | gamemode/modules/hungermod/cl_init.lua | 11 | 3402 | local cvars = cvars
local draw = draw
local hook = hook
local math = math
local table = table
local timer = timer
local Color = Color
local ColorAlpha = ColorAlpha
local CreateClientConVar = CreateClientConVar
local GetConVar = GetConVar
local ipairs = ipairs
local pairs = pairs
local unpack = unpack
local ConVars = {
HungerBackground = {0, 0, 0, 255},
HungerForeground = {30, 30, 120, 255},
HungerPercentageText = {255, 255, 255, 255},
StarvingText = {200, 0, 0, 255},
FoodEatenBackground = {0, 0, 0}, -- No alpha
FoodEatenForeground = {20, 100, 20} -- No alpha
}
local HUDWidth = 0
local FoodAteAlpha = -1
local FoodAteY = 0
surface.CreateFont("HungerPlus", {
size = 70,
weight = 500,
antialias = true,
shadow = false,
font = "ChatFont"})
local function ReloadConVars()
for name, Colour in pairs(ConVars) do
ConVars[name] = {}
for num, rgb in ipairs(Colour) do
local ConVarName = name .. num
local CVar = GetConVar(ConVarName) or CreateClientConVar(ConVarName, rgb, true, false)
table.insert(ConVars[name], CVar:GetInt())
if not cvars.GetConVarCallbacks(ConVarName, false) then
cvars.AddChangeCallback(ConVarName, function() timer.Simple(0, ReloadConVars) end)
end
end
ConVars[name] = Color(unpack(ConVars[name]))
end
if HUDWidth == 0 then
HUDWidth = 240
cvars.AddChangeCallback("HudW", function() timer.Simple(0, ReloadConVars) end)
end
HUDWidth = GetConVar("HudW") and GetConVar("HudW"):GetInt() or 240
end
timer.Simple(0, ReloadConVars)
local function HMHUD()
local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Hungermod")
if shouldDraw == false then return end
local energy = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0)
local x = 5
local y = ScrH() - 9
local cornerRadius = 4
if energy > 0 then
cornerRadius = math.Min(4, (HUDWidth - 9) * (energy / 100) / 3 * 2 - (HUDWidth - 9) * (energy / 100) / 3 * 2 % 2)
end
draw.RoundedBox(cornerRadius, x - 1, y - 1, HUDWidth - 8, 9, ConVars.HungerBackground)
if energy > 0 then
draw.RoundedBox(cornerRadius, x, y, (HUDWidth - 9) * (energy / 100), 7, ConVars.HungerForeground)
draw.DrawNonParsedSimpleText(energy .. "%", "DefaultSmall", HUDWidth / 2, y - 3, ConVars.HungerPercentageText, 1)
else
draw.DrawNonParsedSimpleText(DarkRP.getPhrase("starving"), "ChatFont", HUDWidth / 2, y - 5, ConVars.StarvingText, 1)
end
if FoodAteAlpha > -1 then
local mul = 1
if FoodAteY <= ScrH() - 100 then
mul = -.5
end
draw.DrawNonParsedSimpleText("++", "HungerPlus", 208, FoodAteY + 1, ColorAlpha(ConVars.FoodEatenBackground, FoodAteAlpha), 0)
draw.DrawNonParsedSimpleText("++", "HungerPlus", 207, FoodAteY, ColorAlpha(ConVars.FoodEatenForeground, FoodAteAlpha), 0)
FoodAteAlpha = math.Clamp(FoodAteAlpha + 4 * FrameTime() * mul, -1, 1) --ColorAlpha works with 0-1 alpha
FoodAteY = FoodAteY - 150 * FrameTime()
end
end
hook.Add("HUDDrawTargetID", "HMHUD", HMHUD) --HUDDrawTargetID is called after DarkRP HUD is drawn in HUDPaint
local function AteFoodIcon(msg)
FoodAteAlpha = 1
FoodAteY = ScrH() - 8
end
usermessage.Hook("AteFoodIcon", AteFoodIcon)
| mit |
mercury233/ygopro-scripts | c40217358.lua | 3 | 2564 | --ブルー・ダストン
function c40217358.initial_effect(c)
c:SetUniqueOnField(1,0,40217358)
--cannot release
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UNRELEASABLE_SUM)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_NONSUM)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(c40217358.fuslimit)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e4:SetValue(1)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e5)
--banish
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(40217358,0))
e6:SetCategory(CATEGORY_REMOVE)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_DESTROYED)
e6:SetCondition(c40217358.rmcon)
e6:SetTarget(c40217358.rmtg)
e6:SetOperation(c40217358.rmop)
c:RegisterEffect(e6)
end
function c40217358.fuslimit(e,c,sumtype)
return sumtype==SUMMON_TYPE_FUSION
end
function c40217358.rmcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function c40217358.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local pre=e:GetHandler():GetPreviousControler()
Duel.SetTargetPlayer(pre)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,pre,LOCATION_HAND)
end
function c40217358.rmop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local g=Duel.GetFieldGroup(p,LOCATION_HAND,0)
if g:GetCount()==0 then return end
local sg=g:RandomSelect(p,1)
Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)
local tc=sg:GetFirst()
tc:RegisterFlagEffect(40217358,RESET_EVENT+RESETS_STANDARD,0,0)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetCondition(c40217358.retcon)
e1:SetOperation(c40217358.retop)
e1:SetLabel(Duel.GetTurnCount()+1)
e1:SetLabelObject(tc)
Duel.RegisterEffect(e1,tp)
end
function c40217358.retcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==e:GetLabel()
end
function c40217358.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(40217358)~=0 then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
e:Reset()
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/abilities/dark_arts.lua | 28 | 1588 | -----------------------------------
-- Ability: Dark Arts
-- Optimizes black magic capability while lowering white magic proficiency. Grants a bonus to enfeebling, elemental, and dark magic. Also grants access to Stratagems.
-- Obtained: Scholar Level 10
-- Recast Time: 1:00
-- Duration: 2:00:00
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if player:hasStatusEffect(EFFECT_DARK_ARTS) or 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:delStatusEffect(EFFECT_ADDENDUM_WHITE);
player:delStatusEffect(EFFECT_PENURY);
player:delStatusEffect(EFFECT_CELERITY);
player:delStatusEffect(EFFECT_ACCESSION);
player:delStatusEffect(EFFECT_RAPTURE);
player:delStatusEffect(EFFECT_ALTRUISM);
player:delStatusEffect(EFFECT_TRANQUILITY);
player:delStatusEffect(EFFECT_PERPETUANCE);
local helixbonus = 0;
if (player:getMainJob() == JOB_SCH and player:getMainLvl() >= 20) then
helixbonus = math.floor(player:getMainLvl() / 4);
end
player:addStatusEffect(EFFECT_DARK_ARTS,1,0,7200,0,helixbonus);
return EFFECT_DARK_ARTS;
end; | gpl-3.0 |
mercury233/ygopro-scripts | c92341815.lua | 2 | 3138 | --星空蝶
function c92341815.initial_effect(c)
aux.AddCodeList(c,3285552)
c:SetUniqueOnField(1,0,92341815)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(c92341815.target)
e1:SetOperation(c92341815.activate)
c:RegisterEffect(e1)
--Equip Limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c92341815.eqlimit)
c:RegisterEffect(e2)
--Decrease Atk
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetValue(c92341815.atkval)
c:RegisterEffect(e3)
--grave to equip
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_EQUIP)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCountLimit(1,92341815)
e4:SetTarget(c92341815.eqtg)
e4:SetOperation(c92341815.eqop)
c:RegisterEffect(e4)
end
function c92341815.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c92341815.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c92341815.eqlimit(e,c)
return c:IsControler(e:GetHandlerPlayer())
end
function c92341815.atkfilter(c)
return c:IsFaceup() and aux.IsCodeListed(c,3285552)
end
function c92341815.atkval(e)
local g=Duel.GetMatchingGroup(c92341815.atkfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,nil)
return g:GetClassCount(Card.GetCode)*-500
end
function c92341815.cfilter(c)
return c:IsCode(3285552) and c:IsFaceup()
end
function c92341815.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return c92341815.cfilter(chkc) and chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingTarget(c92341815.cfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:CheckUniqueOnField(tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c92341815.cfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0)
end
function c92341815.eqop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and c:IsRelateToEffect(e) and c:CheckUniqueOnField(tp) then
Duel.Equip(tp,c,tc)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/items/icefish.lua | 18 | 1317 | -----------------------------------------
-- ID: 4470
-- Item: icefish
-- Food Effect: 5Min, Mithra only
-----------------------------------------
-- Dexterity 3
-- Mind -5
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:getRace() ~= 7) then
result = 247;
end
if (target:getMod(MOD_EAT_RAW_FISH) == 1) then
result = 0;
end
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,4470);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 3);
target:addMod(MOD_MND, -5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 3);
target:delMod(MOD_MND, -5);
end;
| gpl-3.0 |
Zenny89/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 |
mercury233/ygopro-scripts | c29155212.lua | 2 | 1514 | --ゴースト王-パンプキング-
function c29155212.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c29155212.adval)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(29155212,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c29155212.atkcon)
e3:SetOperation(c29155212.atkop)
c:RegisterEffect(e3)
end
function c29155212.filter(c)
return c:IsFaceup() and c:IsCode(62121)
end
function c29155212.adval(e,c)
if Duel.IsExistingMatchingCard(c29155212.filter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) then
return 100+c:GetFlagEffect(29155212)*100
else
return c:GetFlagEffect(29155212)*100
end
end
function c29155212.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and e:GetHandler():GetFlagEffect(29155212)<4
and Duel.IsExistingMatchingCard(c29155212.filter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
function c29155212.atkop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or not Duel.IsExistingMatchingCard(c29155212.filter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) then return end
e:GetHandler():RegisterFlagEffect(29155212,RESET_EVENT+RESETS_STANDARD+RESET_DISABLE,0,1)
end
| gpl-2.0 |
Sulverus/tarantool-wiki-lookup | lib/wiki.lua | 1 | 4865 | #!/usr/bin/env tarantool
local log = require('log')
local shard = require('shard')
local yaml = require('yaml')
local fiber = require('fiber')
local GROUP_INDEX = 4
local function die(msg, ...)
local err = string.format(msg, ...)
log.error(err)
error(err)
end
-- called from a remote server
function load_data(tuples)
for _, tuple in ipairs(tuples) do
local status, reason = pcall(function()
box.space.wiki:insert(tuple)
end)
if not status then
if reason:find('^Duplicate') ~= nil then
log.error('failed to insert %s: %s', tuple[1],
reason)
else
die('failed to insert = %s: %s', tuple[1],
reason)
end
end
end
end
local function load_batch(args)
local server = args[1]
local tuples = args[2]
local status, reason = pcall(function()
server.conn:timeout(5 * shard.REMOTE_TIMEOUT)
:call("load_data", tuples)
end)
if not status then
log.error('failed to insert on %s: %s', server.uri, reason)
if not server.conn:is_connected() then
log.error("server %s is offline", server.uri)
end
end
end
local function process_cat(name, tuples)
local data = box.space.cat:select{name}
if data[1] == nil then
shard.cat:insert{name}
end
shard.cat:update(name, tuples)
end
local function compute()
local pages = box.space.wiki:select{}
for _, page in pairs(pages) do
if page[GROUP_INDEX][1] ~= nil then
local data = {}
local i = 1
for _, cat in pairs(page[GROUP_INDEX]) do
shard.cat:auto_increment{cat, page[1]}
i = i + 1
end
--collectgarbage('collect')
end
end
end
local function bulk_load(self, data, count)
-- Start fiber queue to processes requests in parallel
local batches = {}
local i = 0
for _, tuple_data in ipairs(data) do
local data_id = tuple_data[1]
if data_id then
local tuple = box.tuple.new(tuple_data)
for _, server in ipairs(shard.shard(data_id)) do
local batch = batches[server]
if batch == nil then
batch = { count = 0, tuples = {} }
batches[server] = batch
end
batch.count = batch.count + 1
batch.tuples[batch.count] = tuple
end
else
die('invalid line in bulk_load: [%s]', line)
end
i = i + 1
end
local q = shard.queue(load_batch, shard.len())
for server, batch in pairs(batches) do
q:put({ server, batch.tuples })
end
-- stop fiber queue
q:join()
--log.info('loaded %s tuples', i)
batches = nil
collectgarbage('collect')
end
-- check shard after connect function
shard.check_shard = function(conn)
return conn.space.wiki ~= nil
end
--
-- Entry point
--
local function start(cfg)
-- Configure database
-- Create users && tables
if not box.space.wiki then
log.info('bootstraping database...')
box.schema.user.create(cfg.login, { password = cfg.password })
box.schema.user.grant(cfg.login, 'read,write,execute', 'universe')
local wiki = box.schema.create_space('wiki')
wiki:create_index('primary', {type = 'hash', parts = {1, 'num'}})
wiki:create_index('title', {type = 'hash', parts = {3, 'str'}})
log.info('bootstrapped')
local cat = box.schema.create_space('cat')
cat:create_index('primary', {type = 'tree', parts = {1, 'num'}})
cat:create_index('second', {type = 'tree', unique=false, parts = {2, 'str'}})
end
-- Start binary port
box.cfg { listen = cfg.binary }
-- Initialize sharding
shard.init(cfg)
log.info('started')
return true
end
local function test()
log.info(yaml.encode(box.space.wiki:select()))
log.info(yaml.encode(box.space.cat:select()))
end
local function lookup(word)
local result = {}
local count = 1
log.info('lookup: %s', word)
groups = box.space.wiki.index.title:select(word)[1][GROUP_INDEX]
for _, name in pairs(groups) do
if string.match(name, 'Вики') == nil then
local data = box.space.cat.index[1]:select(name, {limit=100})
log.info('category count=%d', #data)
for _, tuple in pairs(data) do
local id = tuple[3]
if type(id) == 'number' then
result[count] = box.space.wiki:get(id)
count = count + 1
end
end
end
end
return result
end
return {
start = start,
bulk_load = bulk_load,
lookup = lookup,
compute = compute,
test = test,
}
-- vim: ts=4:sw=4:sts=4:et
| mit |
mercury233/ygopro-scripts | c35199656.lua | 3 | 4155 | --トリックスター・マンジュシカ
function c35199656.initial_effect(c)
--return
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(35199656,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCost(c35199656.cost)
e1:SetTarget(c35199656.target)
e1:SetOperation(c35199656.operation)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_TO_HAND)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c35199656.damcon1)
e2:SetOperation(c35199656.damop1)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_TO_HAND)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(c35199656.regcon)
e3:SetOperation(c35199656.regop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_CHAIN_SOLVED)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c35199656.damcon2)
e4:SetOperation(c35199656.damop2)
c:RegisterEffect(e4)
if not c35199656.global_check then
c35199656.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVING)
ge1:SetOperation(c35199656.count)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_SOLVED)
ge2:SetOperation(c35199656.reset)
Duel.RegisterEffect(ge2,0)
end
end
function c35199656.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsPublic() and c:GetFlagEffect(35199656)==0 end
c:RegisterFlagEffect(35199656,RESET_CHAIN,0,1)
end
function c35199656.filter(c)
return c:IsSetCard(0xfb) and c:IsFaceup() and c:IsAbleToHand() and not c:IsCode(35199656)
end
function c35199656.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c35199656.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c35199656.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c35199656.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c35199656.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
end
function c35199656.count(e,tp,eg,ep,ev,re,r,rp)
c35199656.chain_solving=true
end
function c35199656.reset(e,tp,eg,ep,ev,re,r,rp)
c35199656.chain_solving=false
end
function c35199656.damcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp) and not c35199656.chain_solving
end
function c35199656.damop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,35199656)
local ct=eg:FilterCount(Card.IsControler,nil,1-tp)
Duel.Damage(1-tp,ct*200,REASON_EFFECT)
end
function c35199656.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp) and c35199656.chain_solving
end
function c35199656.regop(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(Card.IsControler,nil,1-tp)
e:GetHandler():RegisterFlagEffect(35199657,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1,ct)
end
function c35199656.damcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(35199657)>0
end
function c35199656.damop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,35199656)
local labels={e:GetHandler():GetFlagEffectLabel(35199657)}
local ct=0
for i=1,#labels do ct=ct+labels[i] end
e:GetHandler():ResetFlagEffect(35199657)
Duel.Damage(1-tp,ct*200,REASON_EFFECT)
end
| gpl-2.0 |
Zenny89/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 |
mercury233/ygopro-scripts | c73309655.lua | 2 | 2973 | --清冽の水霊使いエリア
function c73309655.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,nil,2,2,c73309655.lcheck)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(73309655,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,73309655)
e1:SetTarget(c73309655.sptg)
e1:SetOperation(c73309655.spop)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(73309655,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCountLimit(1,73309656)
e2:SetCondition(c73309655.thcon)
e2:SetTarget(c73309655.thtg)
e2:SetOperation(c73309655.thop)
c:RegisterEffect(e2)
end
function c73309655.lcheck(g)
return g:IsExists(Card.IsLinkAttribute,1,nil,ATTRIBUTE_WATER)
end
function c73309655.spfilter(c,e,tp,zone)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
end
function c73309655.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and c73309655.spfilter(chkc,e,tp,zone) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c73309655.spfilter,tp,0,LOCATION_GRAVE,1,nil,e,tp,zone) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c73309655.spfilter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp,zone)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c73309655.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f)
if tc:IsRelateToEffect(e) and zone~=0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone)
end
end
function c73309655.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp and c:IsPreviousControler(tp)))
and c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_LINK)
end
function c73309655.thfilter(c)
return c:IsDefenseBelow(1500) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand()
end
function c73309655.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c73309655.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c73309655.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c73309655.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
ChangSF/BestSects | Product/Lua/UI/Login/Login.lua | 1 | 3223 | local UIBase = import("UI/UIBase")
if not Cookie then
Cookie = Slua.GetClass('KSFramework.Cookie')
end
if not I18N then
I18N = Slua.GetClass('KSFramework.I18N') -- use slua reflection mode
end
if not UIModule then
UIModule = Slua.GetClass('KEngine.UI.UIModule')
end
if not Log then
Log = Slua.GetClass('KEngine.Log')
end
local UILogin = {}
extends(UILogin, UIBase)
-- Maybe you have many `UILogin` instance? create a new function!
-- Always write a New function is best practices
function UILogin.New(controller)
local newUILogin = new(UILogin)
newUILogin.Controller = controller
return newUILogin
end
-- controller also pass to OnInit function
function UILogin:OnInit(controller)
Log.Info("================================ UILogin:OnInit ============================")
--local text = self:GetUIText("Login")
--text.text = I18N.Str("UILogin.LoginDescText")
-- read LoginText from Outlet
self.LoginText.text = I18N.Str("UILogin.LoginDescText")
self.LoginButtonText.text = I18N.Str('UILogin.LoginButtonText')
local btn = self.LoginButton
print(string.format("Controller type: %s, Button type full name: %s", type(self.Controller), btn:GetType().FullName))
if UnityEngine and UnityEngine.Vector3 then -- static code binded!
btn.onClick:RemoveAllListeners()
btn.onClick:AddListener(function()
print('Click the button!!!')
UIModule.Instance:CloseWindow("Login")
UIModule.Instance:OpenWindow("WND_Introduce","user1")
end)
print('Success bind button OnClick!')
else
Log.Warning("Not found UnityEngine static code! No AddListener to the button")
end
-- this button click to load new UI
local btnMain = self.BtnMain
if UnityEngine and UnityEngine.Vector3 then -- static code binded!
btnMain.onClick:RemoveAllListeners()
btnMain.onClick:AddListener(function()
UIModule.Instance:CloseWindow("Login")
UIModule.Instance:OpenWindow("Main","user1")
end)
print('Success bind button OnClick!')
else
Long.Warning('MainButton need Slua static code.')
end
-- test LuaBehaivour
if not LuaBehaviour then LuaBehaviour = Slua.GetClass('KSFramework.LuaBehaviour') end
LuaBehaviour.Create(controller.CachedGameObject, 'Behaviour/TestLuaBehaviour')
end
function UILogin:OnOpen(num1)
print("UILogin:OnOpen, arg1: " .. tostring(num1))
if AppSettings then
using("AppSettings") -- namespace all
Log.Info("================================ Read settings throught Lua ============================")
for config in foreach(GameConfigSettings.GetAll()) do
print(string.format("Lua Read Setting, Id: %s, Value: %s", config.Id, config.Value))
end
else
print("Not found AppSettings, maybe no static code generate yet")
end
local openCount
openCount= Cookie.Get('UILogin.OpenCount')
if not openCount then
openCount = 0
end
openCount = openCount + 1
Cookie.Set('UILogin.OpenCount', openCount)
Log.Info('Test cookie, Reload UI use (Ctrl+Alt+Shift+R)... UI Open Count: ' .. tostring(openCount))
end
return UILogin
| lgpl-3.0 |
Zenny89/darkstar | scripts/globals/abilities/pets/flame_breath.lua | 25 | 1252 | ---------------------------------------------------
-- Flame Breath
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------------
function onAbilityCheck(player, target, ability)
return 0,0;
end;
function onPetAbility(target, pet, skill, master)
---------- Deep Breathing ----------
-- 0 for none
-- 1 for first merit
-- 0.25 for each merit after the first
-- TODO: 0.1 per merit for augmented AF2 (10663 *w/ augment*)
local deep = 1;
if (pet:hasStatusEffect(EFFECT_MAGIC_ATK_BOOST) == true) then
deep = deep + 1 + (master:getMerit(MERIT_DEEP_BREATHING)-1)*0.25;
pet:delStatusEffect(EFFECT_MAGIC_ATK_BOOST);
end
local gear = master:getMod(MOD_WYVERN_BREATH)/256; -- Master gear that enhances breath
local dmgmod = MobBreathMove(pet, target, 0.185, pet:getMainLvl()*15, ELE_FIRE); -- Works out to (hp/6) + 15, as desired
dmgmod = (dmgmod * (1+gear))*deep;
local dmg = MobFinalAdjustments(dmgmod,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_FIRE,MOBPARAM_IGNORE_SHADOWS);
target:delHP(dmg);
return dmg;
end | gpl-3.0 |
noname007/koreader | frontend/ui/widget/virtualkeyboard.lua | 4 | 13712 | local InputContainer = require("ui/widget/container/inputcontainer")
local FrameContainer = require("ui/widget/container/framecontainer")
local CenterContainer = require("ui/widget/container/centercontainer")
local BottomContainer = require("ui/widget/container/bottomcontainer")
local HorizontalSpan = require("ui/widget/horizontalspan")
local HorizontalGroup = require("ui/widget/horizontalgroup")
local VerticalSpan = require("ui/widget/verticalspan")
local VerticalGroup = require("ui/widget/verticalgroup")
local ImageWidget = require("ui/widget/imagewidget")
local TextWidget = require("ui/widget/textwidget")
local Font = require("ui/font")
local Geom = require("ui/geometry")
local Screen = require("device").screen
local Device = require("device")
local GestureRange = require("ui/gesturerange")
local UIManager = require("ui/uimanager")
local DEBUG = require("dbg")
local Blitbuffer = require("ffi/blitbuffer")
local VirtualKey = InputContainer:new{
key = nil,
icon = nil,
label = nil,
keyboard = nil,
callback = nil,
width = nil,
height = nil,
bordersize = 2,
face = Font:getFace("infont", 22),
}
function VirtualKey:init()
if self.label == "Sym" or self.label == "ABC" then
self.callback = function () self.keyboard:setLayout(self.key or self.label) end
elseif self.label == "Shift" then
self.callback = function () self.keyboard:setLayout(self.key or self.label) end
elseif self.label == "IM" then
self.callback = function () self.keyboard:setLayout(self.key or self.label) end
elseif self.label == "Äéß" then
self.callback = function () self.keyboard:setLayout(self.key or self.label) end
elseif self.label == "Backspace" then
self.callback = function () self.keyboard:delChar() end
self.hold_callback = function () self.keyboard:clear() end
else
self.callback = function () self.keyboard:addChar(self.key) end
end
local label_widget
if self.icon then
label_widget = ImageWidget:new{
file = self.icon,
}
else
label_widget = TextWidget:new{
text = self.label,
face = self.face,
}
end
self[1] = FrameContainer:new{
margin = 0,
bordersize = self.bordersize,
background = Blitbuffer.COLOR_WHITE,
radius = 5,
padding = 0,
CenterContainer:new{
dimen = Geom:new{
w = self.width - 2*self.bordersize,
h = self.height - 2*self.bordersize,
},
label_widget,
},
}
self.dimen = Geom:new{
w = self.width,
h = self.height,
}
--self.dimen = self[1]:getSize()
if Device:isTouchDevice() then
self.ges_events = {
TapSelect = {
GestureRange:new{
ges = "tap",
range = self.dimen,
},
},
HoldSelect = {
GestureRange:new{
ges = "hold",
range = self.dimen,
},
},
}
end
end
function VirtualKey:update_keyboard()
UIManager:setDirty(self.keyboard, function()
DEBUG("update key region", self[1].dimen)
return "ui", self[1].dimen
end)
end
function VirtualKey:onTapSelect()
self[1].invert = true
self:update_keyboard()
if self.callback then
self.callback()
end
UIManager:scheduleIn(0.2, function() self:invert(false) end)
return true
end
function VirtualKey:onHoldSelect()
self[1].invert = true
self:update_keyboard()
if self.hold_callback then
self.hold_callback()
end
UIManager:scheduleIn(0.2, function() self:invert(false) end)
return true
end
function VirtualKey:invert(invert)
self[1].invert = invert
self:update_keyboard()
end
local VirtualKeyboard = InputContainer:new{
is_always_active = true,
disable_double_tap = true,
inputbox = nil,
KEYS = {}, -- table to store layouts
min_layout = 2,
max_layout = 12,
layout = 2,
shiftmode = false,
symbolmode = false,
utf8mode = false,
umlautmode = false,
width = 600,
height = 256,
bordersize = 2,
padding = 2,
key_padding = Screen:scaleBySize(6),
}
function VirtualKeyboard:init()
self.KEYS = {
-- first row
{ -- 1 2 3 4 5 6 7 8 9 10 11 12
{ "Q", "q", "1", "!", "Я", "я", "1", "!", "Ä", "ä", "1", "ª", },
{ "W", "w", "2", "?", "Ж", "ж", "2", "?", "Ö", "ö", "2", "º", },
{ "E", "e", "3", "|", "Е", "е", "3", "«", "Ü", "ü", "3", "¡", },
{ "R", "r", "4", "#", "Р", "р", "4", "»", "ß", "ß", "4", "¿", },
{ "T", "t", "5", "@", "Т", "т", "5", ":", "À", "à", "5", "¼", },
{ "Y", "y", "6", "‰", "Ы", "ы", "6", ";", "Â", "â", "6", "½", },
{ "U", "u", "7", "'", "У", "у", "7", "~", "Æ", "æ", "7", "¾", },
{ "I", "i", "8", "`", "И", "и", "8", "(", "Ç", "ç", "8", "©", },
{ "O", "o", "9", ":", "О", "о", "9", ")", "È", "è", "9", "®", },
{ "P", "p", "0", ";", "П", "п", "0", "=", "É", "é", "0", "™", },
},
-- second raw
{ -- 1 2 3 4 5 6 7 8 9 10 11 12
{ "A", "a", "+", "…", "А", "а", "Ш", "ш", "Ê", "ê", "Ş", "ş", },
{ "S", "s", "-", "_", "С", "с", "Ѕ", "ѕ", "Ë", "ë", "İ", "ı", },
{ "D", "d", "*", "=", "Д", "д", "Э", "э", "Î", "î", "Ğ", "ğ", },
{ "F", "f", "/", "\\", "Ф", "ф", "Ю", "ю", "Ï", "ï", "Ć", "ć", },
{ "G", "g", "%", "„", "Г", "г", "Ґ", "ґ", "Ô", "ô", "Č", "č", },
{ "H", "h", "^", "“", "Ч", "ч", "Ј", "ј", "Œ", "œ", "Đ", "đ", },
{ "J", "j", "<", "”", "Й", "й", "І", "і", "Ù", "ù", "Š", "š", },
{ "K", "k", "=", "\"", "К", "к", "Ќ", "ќ", "Û", "û", "Ž", "ž", },
{ "L", "l", ">", "~", "Л", "л", "Љ", "љ", "Ÿ", "ÿ", "Ő", "ő", },
},
-- third raw
{ -- 1 2 3 4 5 6 7 8 9 10 11 12
{ label = "Shift",
icon = "resources/icons/appbar.arrow.shift.png",
width = 1.5
},
{ "Z", "z", "(", "$", "З", "з", "Щ", "щ", "Á", "á", "Ű", "ű", },
{ "X", "x", ")", "€", "Х", "х", "№", "@", "É", "é", "Ø", "ø", },
{ "C", "c", "{", "¥", "Ц", "ц", "Џ", "џ", "Í", "í", "Þ", "þ", },
{ "V", "v", "}", "£", "В", "в", "Ў", "ў", "Ñ", "ñ", "Ý", "ý", },
{ "B", "b", "[", "‚", "Б", "б", "Ћ", "ћ", "Ó", "ó", "†", "‡", },
{ "N", "n", "]", "‘", "Н", "н", "Њ", "њ", "Ú", "ú", "–", "—", },
{ "M", "m", "&", "’", "М", "м", "Ї", "ї", "Ç", "ç", "…", "¨", },
{ label = "Backspace",
icon = "resources/icons/appbar.clear.reflect.horizontal.png",
width = 1.5
},
},
-- fourth raw
{
{ "Sym", "Sym", "ABC", "ABC", "Sym", "Sym", "ABC", "ABC", "Sym", "Sym", "ABC", "ABC",
width = 1.5},
{ label = "IM",
icon = "resources/icons/appbar.globe.wire.png",
},
{ "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", "Äéß", },
{ label = "space",
" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ",
width = 4.0},
{ ",", ".", ".", ",", ",", ".", "Є", "є", ",", ".", ",", ".", },
{ label = "Enter",
"\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n",
icon = "resources/icons/appbar.arrow.enter.png",
width = 1.5,
},
}
}
self:initLayout(self.layout)
end
function VirtualKeyboard:_refresh()
-- TODO: Ideally, ui onShow & partial onClose
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
end)
end
function VirtualKeyboard:onShow()
self:_refresh()
return true
end
function VirtualKeyboard:onCloseWidget()
self:_refresh()
return true
end
function VirtualKeyboard:initLayout(layout)
local function VKLayout(b1, b2, b3, b4)
local function boolnum(bool)
return bool and 1 or 0
end
return 2 - boolnum(b1) + 2 * boolnum(b2) + 4 * boolnum(b3) + 8 * boolnum(b4)
end
if layout then
-- to be sure layout is selected properly
layout = math.max(layout, self.min_layout)
layout = math.min(layout, self.max_layout)
self.layout = layout
-- fill the layout modes
self.shiftmode = (layout == 1 or layout == 3 or layout == 5 or layout == 7 or layout == 9 or layout == 11)
self.symbolmode = (layout == 3 or layout == 4 or layout == 7 or layout == 8 or layout == 11 or layout == 12)
self.utf8mode = (layout == 5 or layout == 6 or layout == 7 or layout == 8)
self.umlautmode = (layout == 9 or layout == 10 or layout == 11 or layout == 12)
else -- or, without input parameter, restore layout from current layout modes
self.layout = VKLayout(self.shiftmode, self.symbolmode, self.utf8mode, self.umlautmode)
end
self:addKeys()
end
function VirtualKeyboard:addKeys()
local base_key_width = math.floor((self.width - 11*self.key_padding - 2*self.padding)/10)
local base_key_height = math.floor((self.height - 5*self.key_padding - 2*self.padding)/4)
local h_key_padding = HorizontalSpan:new{width = self.key_padding}
local v_key_padding = VerticalSpan:new{width = self.key_padding}
local vertical_group = VerticalGroup:new{}
for i = 1, #self.KEYS do
local horizontal_group = HorizontalGroup:new{}
for j = 1, #self.KEYS[i] do
local width_factor = self.KEYS[i][j].width or 1.0
local key_width = math.floor((base_key_width + self.key_padding) * width_factor)
- self.key_padding
local key_height = base_key_height
local label = self.KEYS[i][j].label or self.KEYS[i][j][self.layout]
local key = VirtualKey:new{
key = self.KEYS[i][j][self.layout],
icon = self.KEYS[i][j].icon,
label = label,
keyboard = self,
width = key_width,
height = key_height,
}
table.insert(horizontal_group, key)
if j ~= #self.KEYS[i] then
table.insert(horizontal_group, h_key_padding)
end
end
table.insert(vertical_group, horizontal_group)
if i ~= #self.KEYS then
table.insert(vertical_group, v_key_padding)
end
end
local keyboard_frame = FrameContainer:new{
margin = 0,
bordersize = self.bordersize,
background = Blitbuffer.COLOR_WHITE,
radius = 0,
padding = self.padding,
CenterContainer:new{
dimen = Geom:new{
w = self.width - 2*self.bordersize -2*self.padding,
h = self.height - 2*self.bordersize -2*self.padding,
},
vertical_group,
}
}
self[1] = BottomContainer:new{
dimen = Screen:getSize(),
keyboard_frame,
}
self.dimen = keyboard_frame:getSize()
end
function VirtualKeyboard:setLayout(key)
if key == "Shift" then
self.shiftmode = not self.shiftmode
elseif key == "Sym" or key == "ABC" then
self.symbolmode = not self.symbolmode
elseif key == "Äéß" then
self.umlautmode = not self.umlautmode
if self.umlautmode then self.utf8mode = false end
elseif key == "IM" then
self.utf8mode = not self.utf8mode
if self.utf8mode then self.umlautmode = false end
end
self:initLayout()
self:_refresh()
end
function VirtualKeyboard:addChar(key)
DEBUG("add char", key)
self.inputbox:addChar(key)
end
function VirtualKeyboard:delChar()
DEBUG("delete char")
self.inputbox:delChar()
end
function VirtualKeyboard:clear()
DEBUG("clear input")
self.inputbox:clear()
end
return VirtualKeyboard
| agpl-3.0 |
Zenny89/darkstar | scripts/zones/Aht_Urhgan_Whitegate/npcs/Naja_Salaheem.lua | 18 | 4974 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Naja Salaheem
-- Type: Standard NPC
-- @pos 22.700 -8.804 -45.591 50
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
require("scripts/globals/titles");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TOAUM3_DAY = player:getVar("TOAUM3_STARTDAY");
local realday = tonumber(os.date("%j")); -- %M for next minute, %j for next day
local needToZone = player:needToZone();
if (player:getCurrentMission(TOAU) == IMMORTAL_SENTRIES) then
if (player:getVar("TOAUM2") == 1 or player:getVar("TOAUM2") == 2) then
player:startEvent(0x0BBA,0,0,0,0,0,0,0,0,0);
end
elseif (player:getCurrentMission(TOAU) == PRESIDENT_SALAHEEM and player:getVar("TOAUM3") == 1) then
player:startEvent(0x0049,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == PRESIDENT_SALAHEEM and player:getVar("TOAUM3") == 2 and TOAUM3_DAY ~= realday and needToZone == true) then
player:startEvent(0x0BCC,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == KNIGHT_OF_GOLD and player:getVar("TOAUM4") == 0) then
player:startEvent(0x0bcd,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == WESTERLY_WINDS and player:getVar("TOAUM7") == 1) then
player:startEvent(0x0Bd4,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == UNDERSEA_SCOUTING) then
player:startEvent(0x0beb,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == ASTRAL_WAVES) then
player:startEvent(0x0bec,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == IMPERIAL_SCHEMES) then
player:startEvent(0x0bfe,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == ROYAL_PUPPETEER) then
player:startEvent(0x0bff,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == THE_DOLPHIN_CREST) then
player:startEvent(0x0c00,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == THE_BLACK_COFFIN) then
player:startEvent(0x0c01,0,0,0,0,0,0,0,0,0);
elseif (player:getCurrentMission(TOAU) == GHOSTS_OF_THE_PAST) then
player:startEvent(0x0c02,0,0,0,0,0,0,0,0,0);
else
player:startEvent(0x0bbb,1,0,0,0,0,0,0,1,0) -- go back to work
-- player:messageSpecial(0);-- need to find correct normal chat CS..
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 == 0x0BBA) then
player:setVar("TOAUM2",0);
player:completeMission(TOAU,IMMORTAL_SENTRIES);
player:addMission(TOAU,PRESIDENT_SALAHEEM);
player:addCurrency("imperial_standing", 150);
player:addTitle(PRIVATE_SECOND_CLASS);
player:addKeyItem(PSC_WILDCAT_BADGE);
player:messageSpecial(KEYITEM_OBTAINED,PSC_WILDCAT_BADGE);
elseif (csid == 0x0BCC) then
player:completeMission(TOAU,PRESIDENT_SALAHEEM);
player:addMission(TOAU,KNIGHT_OF_GOLD);
player:setVar("TOAUM3",0);
player:setVar("TOAUM3_DAY", 0);
elseif (csid == 0x0049) then
player:setVar("TOAUM3",2);
player:setVar("TOAUM3_DAY", os.date("%j")); -- %M for next minute, %j for next day
elseif (csid == 0x0bd4) then
player:setVar("TOAUM7",0)
player:completeMission(TOAU,WESTERLY_WINDS)
player:addMission(TOAU,A_MERCENARY_LIFE)
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,2185);
else
player:addItem(2185,1)
player:messageSpecial(ITEM_OBTAINED,2185)
player:addItem(2185,1)
end
elseif (csid == 0x0bec) then
player:completeMission(TOAU,ASTRAL_WAVES);
player:addMission(TOAU,IMPERIAL_SCHEMES);
elseif (csid == 0x0bfe) then
player:completeMission(TOAU,IMPERIAL_SCHEMES);
player:addMission(TOAU,ROYAL_PUPPETEER);
elseif (csid == 0x0c00) then
player:completeMission(TOAU,THE_DOLPHIN_CREST);
player:addMission(TOAU,THE_BLACK_COFFIN);
elseif (csid == 0x0c02) then
player:completeMission(TOAU,GHOSTS_OF_THE_PAST);
player:addMission(TOAU,GUESTS_OF_THE_EMPIRE);
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c93882364.lua | 9 | 1280 | --ジェネクス・ワーカー
function c93882364.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(93882364,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c93882364.cost)
e1:SetTarget(c93882364.target)
e1:SetOperation(c93882364.operation)
c:RegisterEffect(e1)
end
function c93882364.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c93882364.filter(c,e,tp)
return c:IsSetCard(0x2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c93882364.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c93882364.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c93882364.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c93882364.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
xlshiz/dotfies | awesome/rc.lua | 1 | 24582 | -- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup").widget
-- Load Debian menu entries
require("debian.menu")
-- Load some applet
-- awful.util.spawn_with_shell("nm-applet")
awful.util.spawn_with_shell("xrandr --output VGA-1 --primary --auto --pos 0x350")
awful.util.spawn_with_shell("xrandr --output HDMI-1 --right-of VGA-1 --rotate left")
-- awful.util.spawn_with_shell("xscreensaver -no-splash")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err) })
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init("~/.config/awesome/theme/shixl/theme.lua")
-- beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "x-terminal-emulator"
-- terminal = "uxterm"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
-- awful.layout.suit.floating,
-- awful.layout.suit.tile,
-- awful.layout.suit.tile.left,
-- awful.layout.suit.tile.bottom,
-- awful.layout.suit.tile.top,
-- awful.layout.suit.fair,
-- awful.layout.suit.fair.horizontal,
-- awful.layout.suit.spiral,
-- awful.layout.suit.spiral.dwindle,
-- awful.layout.suit.max,
-- awful.layout.suit.max.fullscreen,
-- awful.layout.suit.magnifier,
-- awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
awful.layout.layouts = {
awful.layout.suit.fair,
awful.layout.suit.tile.left,
awful.layout.suit.corner.ne,
awful.layout.suit.fair.horizontal,
awful.layout.suit.tile.bottom,
awful.layout.suit.corner.sw,
awful.layout.suit.spiral.dwindle,
}
local mylayout = {
{
awful.layout.suit.fair,
awful.layout.suit.tile.left,
awful.layout.suit.corner.ne,
awful.layout.suit.spiral.dwindle,
},
{
awful.layout.suit.fair.horizontal,
awful.layout.suit.tile.bottom,
awful.layout.suit.corner.sw,
awful.layout.suit.spiral.dwindle,
}
}
-- }}}
-- {{{ Helper functions
local function client_menu_toggle_fn()
local instance = nil
return function ()
if instance and instance.wibox.visible then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ theme = { width = 250 } })
end
end
end
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{ "quit", function() awesome.quit() end},
{ "restart", awesome.restart },
{ "hotkeys", function() return false, hotkeys_popup.show_help end},
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile }
}
myfastmenu = {
-- { "software", "gksudo /usr/sbin/synaptic" },
-- { "FileManager", "/usr/bin/nautilus --new-window" },
-- { "pdfReader", "/usr/bin/evince" },
-- { "Calc", "/usr/bin/gnome-calculator" },
{ "software", "kdesudo /usr/sbin/synaptic" },
{ "FileManager", "/usr/bin/dolphin4" },
{ "pdfReader", "/usr/bin/okular" },
{ "Calc", "/usr/bin/kcalc" },
{ "Remote", "/usr/bin/vinagre" },
{ "XMind", "/usr/bin/XMind" },
}
mymainmenu = awful.menu({ items = {
{ "Fast", myfastmenu },
{ "Debian", debian.menu.Debian_menu.Debian },
{ "open terminal", terminal },
{ "awesome", myawesomemenu, beautiful.awesome_icon },
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = awful.util.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
local tasklist_buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end
end),
awful.button({ }, 3, client_menu_toggle_fn()),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
local new_wall = string.gsub(wallpaper, "1", tostring(s.index))
local test_file = io.open(new_wall, "r")
if test_file ~= nil then
io.close(test_file)
wallpaper = new_wall
end
gears.wallpaper.maximized(wallpaper, s, true)
end
end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
local screen_index = 1
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
local layout = mylayout[screen_index]
if not layout then
layout = mylayout[1]
end
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, layout[1])
screen_index = screen_index + 1
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}),
-- Screen
awful.key({ modkey, }, "n", function () awful.screen.focus_relative( 1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey, "Control" }, "n", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
awful.key({ modkey, }, "Down", function () awful.screen.focus_relative( 1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey, }, "Up", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
-- Tag
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
awful.key({ modkey, }, "h", awful.tag.viewprev,
{description = "view previous", group = "tag"}),
awful.key({ modkey, }, "l", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ modkey, }, "Left", awful.tag.viewprev,
{description = "view previous", group = "tag"}),
awful.key({ modkey, }, "Right", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
-- Layout
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
{description = "select next", group = "layout"}),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
{description = "select previous", group = "layout"}),
-- App window
awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) end,
{description = "focus next by index", group = "client"}),
awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) end,
{description = "focus previous by index", group = "client"}),
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
{description = "swap with previous client by index", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end,
{description = "go back", group = "client"}),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, "Control" }, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
client.focus = c
c:raise()
end
end,
{description = "restore minimized", group = "client"}),
-- Menu
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
{description = "显示菜单", group = "awesome"}),
awful.key({ modkey, }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"}),
-- awesome command
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}),
awful.key({ modkey, "Control" }, "q", awesome.quit,
{description = "quit awesome", group = "awesome"}),
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "x",
function ()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{description = "lua execute prompt", group = "awesome"})
)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "client"}),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
{description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", group = "client"}),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
{description = "toggle keep on top", group = "client"}),
awful.key({ modkey, "Shift" }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end ,
{description = "minimize", group = "client"}),
awful.key({ modkey, }, "m",
function (c)
c.maximized = not c.maximized
c:raise()
end ,
{description = "maximize", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{description = "view tag #"..i, group = "tag"}),
-- Toggle tag display.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{description = "toggle tag #" .. i, group = "tag"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "move focused client to tag #"..i, group = "tag"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "tag"})
)
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
-- border_width = 1,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
size_hints_honor = false, -- 删除黑边
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
},
class = {
"Arandr",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Wpa_gui",
"pinentry",
"veromix",
"Iptux",
"Kcal",
"xtightvncviewer"},
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
{ rule_any = { class = {"Firefox", "thunderbird", "Chromium", "XMind", "vinagre"}},
properties = { screen = 1, tag = "1",
floating = true}},
{ rule_any = { class = {"Emacs"}},
properties = { screen = 2, tag = "1"}},
{ rule_any = { class = {"Okular"}},
properties = { screen = 2}},
-- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" }
}, properties = { titlebars_enabled = false }
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup and
not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
| gpl-3.0 |
Cavitt/vanilla-ot | data/npc/REFERENCETHESE/Uzon.lua | 1 | 2281 | local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a ride to Darashia on Darama for 60 gold?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost =60, destination = {x=33270, y=32441, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'You shouldn\'t miss the experience.'})
local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a ride to Svargrond for 60 gold?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost = 60, destination = {x=32253, y=31097, z=4} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'You shouldn\'t miss the experience.'})
local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a ride to Edron for 60 gold?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost = 60, destination = {x=33193, y=31784, z=3} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'You shouldn\'t miss the experience.'})
npcHandler:addModule(FocusModule:new()) | agpl-3.0 |
mercury233/ygopro-scripts | c72426662.lua | 4 | 1053 | --終焉の王デミス
function c72426662.initial_effect(c)
c:EnableReviveLimit()
--destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetDescription(aux.Stringid(72426662,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c72426662.cost)
e1:SetTarget(c72426662.target)
e1:SetOperation(c72426662.operation)
c:RegisterEffect(e1)
end
function c72426662.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,2000)
else Duel.PayLPCost(tp,2000) end
end
function c72426662.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end
local sg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,sg:GetCount(),0,0)
end
function c72426662.operation(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,aux.ExceptThisCard(e))
Duel.Destroy(sg,REASON_EFFECT)
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Aht_Urhgan_Whitegate/npcs/Sajaaya.lua | 59 | 1060 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Sajaaya
-- Type: Weather Reporter
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x01F6,0,0,0,0,0,0,0,VanadielTime());
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 |
mercury233/ygopro-scripts | c84136000.lua | 2 | 1990 | --復活の墓穴
function c84136000.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c84136000.condition)
e1:SetTarget(c84136000.target)
e1:SetOperation(c84136000.activate)
c:RegisterEffect(e1)
end
function c84136000.cfilter(c,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp) and c:IsReason(REASON_BATTLE)
end
function c84136000.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c84136000.cfilter,1,nil,tp)
end
function c84136000.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c84136000.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c84136000.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.IsExistingTarget(c84136000.spfilter,1-tp,LOCATION_GRAVE,0,1,nil,e,1-tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=Duel.SelectTarget(tp,c84136000.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON)
local g2=Duel.SelectTarget(1-tp,c84136000.spfilter,1-tp,LOCATION_GRAVE,0,1,1,nil,e,1-tp)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,2,0,0)
end
function c84136000.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc=g:GetFirst()
while tc do
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tc:GetControler(),tc:GetControler(),false,false,POS_FACEUP_DEFENSE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true)
end
tc=g:GetNext()
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
mercury233/ygopro-scripts | c16684346.lua | 2 | 2424 | --プロキシー・ホース
function c16684346.initial_effect(c)
--extra hand link
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(16684346,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_LINK_MATERIAL)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_CYBERSE))
e1:SetCountLimit(1,16684346)
e1:SetValue(c16684346.matval)
c:RegisterEffect(e1)
--to extra deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(16684346,1))
e2:SetCategory(CATEGORY_TOEXTRA)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,16684347)
e2:SetCondition(c16684346.tdcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c16684346.tdtg)
e2:SetOperation(c16684346.tdop)
c:RegisterEffect(e2)
end
function c16684346.exmatcheck(c,lc,tp)
if not c:IsLocation(LOCATION_HAND) then return false end
local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
for _,te in pairs(le) do
local f=te:GetValue()
local related,valid=f(te,lc,nil,c,tp)
if related and not te:GetHandler():IsCode(16684346) then return false end
end
return true
end
function c16684346.matval(e,lc,mg,c,tp)
if not lc:IsRace(RACE_CYBERSE) then return false,nil end
return true,not mg or mg:IsContains(e:GetHandler()) and not mg:IsExists(c16684346.exmatcheck,1,nil,lc,tp)
end
function c16684346.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c16684346.tdfilter(c,e)
return c:IsType(TYPE_LINK) and c:IsAbleToExtra() and c:IsCanBeEffectTarget(e)
end
function c16684346.fselect(g)
return g:IsExists(Card.IsRace,1,nil,RACE_CYBERSE)
end
function c16684346.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g1=Duel.GetMatchingGroup(c16684346.tdfilter,tp,LOCATION_GRAVE,0,e:GetHandler(),e)
if chk==0 then return g1:CheckSubGroup(c16684346.fselect,2,2) end
local g2=Duel.GetMatchingGroup(c16684346.tdfilter,tp,LOCATION_GRAVE,0,nil,e)
local sg=g2:SelectSubGroup(tp,c16684346.fselect,false,2,2)
Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,sg,2,0,0)
end
function c16684346.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if #g>0 then
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
| gpl-2.0 |
rouing/FHLG-BW | entities/weapons/weapon_lasergun/shared.lua | 1 | 5373 | // this was rickster's ak47.
if ( SERVER ) then
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
SWEP.HoldType = "ar2"
end
if ( CLIENT ) then
SWEP.ViewModelFlip = false
SWEP.PrintName = "Laser Gun"
SWEP.Author = "HLTV Proxy"
SWEP.Slot = 3
SWEP.SlotPos = 14
SWEP.IconLetter = ","
SWEP.ViewModelFlip = true
killicon.AddFont( "weapon_laserrifle", "HL2MPTypeDeath", SWEP.IconLetter, Color( 100, 100, 100, 255 ) )
end
SWEP.Base = "weapon_mad_base"
SWEP.Spawnable = false
SWEP.AdminSpawnable =false
SWEP.ViewModel = "models/weapons/v_irifle.mdl"
SWEP.WorldModel = "models/weapons/w_irifle.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Sound = Sound( "Weapon_AR2.Single" )
SWEP.Primary.Recoil = 0.00000000001
SWEP.Primary.Damage = 2
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.0001
SWEP.Primary.ClipSize = -1
SWEP.Primary.Delay = 0.005
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Primary.Battery = 100
SWEP.Primary.Chargerate = .1
SWEP.Secondary.Sound = Sound( "Weapon_AR2.Single" )
SWEP.Secondary.Recoil = 1
SWEP.Secondary.Damage = 40
SWEP.Secondary.NumShots = 1
SWEP.Secondary.Cone = 0.0001
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.Delay = 1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector( -2.7, -8, 2.225 )
SWEP.IronSightsAng = Vector( 0, -4, 0 )
// laser upgrade = more charge
function SWEP:Upgrade(bool)
self.Weapon:SetNWBool("upgraded",bool)
end
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD );
self:SetIronsights( false )
self.Owner:SetFOV(90,.3)
end
function SWEP:Think()
if self.LastCharge<CurTime()-self.Primary.Chargerate && self.Primary.Battery<100 then
self.Primary.Battery=self.Primary.Battery+1
self.LastCharge = CurTime()
end
end
function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.LastCharge = CurTime()+self.Primary.Chargerate*3
if ( self.Primary.Battery<=0 ) then
return
end
// Play shoot sound
//self.Weapon:EmitSound( self.Primary.Sound )
self:CSShootBullet( self.Primary.Damage, 0, self.Primary.NumShots, 0 )
local beamorigin = self.Owner:GetShootPos()+self.Owner:EyeAngles():Right()*5+self.Owner:EyeAngles():Up()*-5
local beamstart = self.Owner:GetEyeTrace()
-- local effectdata = EffectData()
-- effectdata:SetStart(beamstart.HitPos)
-- effectdata:SetOrigin(beamorigin)
-- effectdata:SetColor(tonumber(self.Owner:GetInfo("bw_clcolor_r")),tonumber(self.Owner:GetInfo("bw_clcolor_g")),tonumber(self.Owner:GetInfo("bw_clcolor_b")))
-- util.Effect("laserbeam", effectdata)
// Remove 1 bullet from our clip
if self.Weapon:GetNWBool("upgraded") then
if self.Halfcharge then
self.Primary.Battery=self.Primary.Battery-1
end
self.Halfcharge = !self.Halfcharge
else
self.Primary.Battery=self.Primary.Battery-1
end
// Punch the player's view
//self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) )
// In singleplayer this doesn't get called on the client, so we use a networked float
// to send the last shoot time. In multiplayer this is predicted clientside so we don't need to
// send the float.
if ( (game.SinglePlayer() && SERVER) || CLIENT ) then
self.Weapon:SetNetworkedFloat( "LastShootTime", CurTime() )
end
end
function SWEP:Initialize()
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType )
end
self.Weapon:SetNetworkedBool( "Ironsights", false )
self.LastCharge = CurTime()
self.Halfcharge = false
end
function SWEP:CSShootBullet( dmg, recoil, numbul, cone )
numbul = numbul or 1
cone = cone or 0.01
local bullet = {}
bullet.Num = numbul
bullet.Src = self.Owner:GetShootPos() // Source
bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
bullet.Spread = Vector( cone, cone, 0 ) // Aim Cone
bullet.Tracer = 4 // Show a tracer on every x bullets
bullet.Force = 5 // Amount of force to give to phys objects
bullet.Damage = dmg
bullet.Attacker = self.Owner
self.Weapon:FireBullets( bullet )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) // View model animation
//self.Owner:MuzzleFlash() // Crappy muzzle light
self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation
// CUSTOM RECOIL !
if ( (game.SinglePlayer() && SERVER) || ( !game.SinglePlayer() && CLIENT ) ) then
local eyeang = self.Owner:EyeAngles()
eyeang.pitch = eyeang.pitch - recoil
self.Owner:SetEyeAngles( eyeang )
end
end
function SWEP:GetViewModelPosition( pos, ang )
local Mul = 1.0
local Offset = self.IronSightsPos
if ( self.IronSightsAng ) then
ang = ang * 1
ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul )
ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul )
ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul )
end
local Right = ang:Right()
local Up = ang:Up()
local Forward = ang:Forward()
pos = pos + Offset.x * Right * Mul
pos = pos + Offset.y * Forward * Mul
pos = pos + Offset.z * Up * Mul
return pos, ang
end
function SWEP:SecondaryAttack()
end | unlicense |
Zenny89/darkstar | scripts/globals/spells/huton_ni.lua | 17 | 1243 | -----------------------------------------
-- Spell: Huton: Ni
-- Deals wind damage to an enemy and lowers its resistance against ice.
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
--doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
local duration = 15 + caster:getMerit(MERIT_HUTON_EFFECT) -- T1 bonus debuff duration
local bonusAcc = 0;
local bonusMab = caster:getMerit(MERIT_HUTON_EFFECT) + caster:getMod(MOD_NIN_NUKE_BONUS); -- T1 mag atk + "enhances Ninjustu damage" mod
if (caster:isBehind(target,15) and caster:hasStatusEffect(EFFECT_INNIN)) then -- Innin mag atk bonus from behind, guesstimating angle at 15 degrees
bonusMab = bonusMab + caster:getStatusEffect(EFFECT_INNIN):getPower();
end
local dmg = doNinjutsuNuke(68,1,caster,spell,target,false,bonusAcc,bonusMab);
handleNinjutsuDebuff(caster,target,spell,30,duration,MOD_ICERES);
return dmg;
end; | gpl-3.0 |
Cavitt/vanilla-ot | data/talkactions/scripts/unban.lua | 1 | 1655 | function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
local account, tmp = getAccountIdByName(param), false
if(account == 0) then
account = getAccountIdByAccount(param)
if(account == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.")
return true
end
tmp = true
end
local ban = getBanData(account, BAN_ACCOUNT)
if(ban and doRemoveAccountBanishment(account)) then
local name = param
if(tmp) then
name = account
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, name .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
end
if(tmp) then
return true
end
tmp = getIpByName(param)
if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.")
end
local guid = getPlayerGUIDByName(param, true)
if(guid == nil) then
return true
end
ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_LOCK)
if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_LOCK)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.")
end
ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_BANISHMENT)
if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_BANISHMENT)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
end
return true
end
| agpl-3.0 |
mercury233/ygopro-scripts | c32907538.lua | 3 | 2073 | --ウォールクリエイター
function c32907538.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(32907538,1))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c32907538.target)
e1:SetOperation(c32907538.operation)
c:RegisterEffect(e1)
--maintain
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c32907538.mtcon)
e2:SetOperation(c32907538.mtop)
c:RegisterEffect(e2)
end
function c32907538.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil)
end
function c32907538.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e)
and not tc:IsImmuneToEffect(e) then
c:SetCardTarget(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCondition(c32907538.rcon)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_SUM)
e2:SetValue(1)
tc:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_UNRELEASABLE_NONSUM)
tc:RegisterEffect(e3)
end
end
function c32907538.rcon(e)
return e:GetOwner():IsHasCardTarget(e:GetHandler())
end
function c32907538.mtcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c32907538.mtop(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckLPCost(tp,500) and Duel.SelectYesNo(tp,aux.Stringid(32907538,0)) then
Duel.PayLPCost(tp,500)
else
Duel.Destroy(e:GetHandler(),REASON_COST)
end
end
| gpl-2.0 |
ArmanKiIng/telegram--bot | plugins/danbooru.lua | 616 | 1750 | do
local URL = "http://danbooru.donmai.us"
local URL_NEW = "/posts.json"
local URL_POP = "/explore/posts/popular.json"
local scale_day = "?scale=day"
local scale_week = "?scale=week"
local scale_month = "?scale=month"
local function get_post(url)
local b, c, h = http.request(url)
if c ~= 200 then return nil end
local posts = json:decode(b)
return posts[math.random(#posts)]
end
local function run(msg, matches)
local url = URL
if matches[1] == "!danbooru" then
url = url .. URL_NEW
else
url = url .. URL_POP
if matches[1] == "d" then
url = url .. scale_day
elseif matches[1] == "w" then
url = url .. scale_week
elseif matches[1] == "m" then
url = url .. scale_month
end
end
local post = get_post(url)
if post then
vardump(post)
local img = URL .. post.large_file_url
send_photo_from_url(get_receiver(msg), img)
local txt = ''
if post.tag_string_artist ~= '' then
txt = 'Artist: ' .. post.tag_string_artist .. '\n'
end
if post.tag_string_character ~= '' then
txt = txt .. 'Character: ' .. post.tag_string_character .. '\n'
end
if post.file_size ~= '' then
txt = txt .. '[' .. math.ceil(post.file_size/1000) .. 'kb] ' .. URL .. post.file_url
end
return txt
end
end
return {
description = "Gets a random fresh or popular image from Danbooru",
usage = {
"!danbooru - gets a random fresh image from Danbooru 🔞",
"!danboorud - random daily popular image 🔞",
"!danbooruw - random weekly popular image 🔞",
"!danboorum - random monthly popular image 🔞"
},
patterns = {
"^!danbooru$",
"^!danbooru ?(d)$",
"^!danbooru ?(w)$",
"^!danbooru ?(m)$"
},
run = run
}
end | gpl-2.0 |
mercury233/ygopro-scripts | c76589546.lua | 2 | 1515 | --オーバーフロー・ドラゴン
function c76589546.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(76589546,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,76589546)
e1:SetCondition(c76589546.spcon)
e1:SetTarget(c76589546.sptg)
e1:SetOperation(c76589546.spop)
c:RegisterEffect(e1)
end
function c76589546.cfilter(c)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT)
end
function c76589546.spcon(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(c76589546.cfilter,nil)
e:SetLabel(ct)
return ct>0
end
function c76589546.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c76589546.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0
and e:GetLabel()>=2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,76589547,0,TYPES_TOKEN_MONSTER,0,0,1,RACE_DRAGON,ATTRIBUTE_DARK)
and Duel.SelectYesNo(tp,aux.Stringid(76589546,1)) then
Duel.BreakEffect()
local token=Duel.CreateToken(tp,76589547)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/La_Theine_Plateau/npcs/Augevinne.lua | 17 | 1569 | -----------------------------------
-- 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 |
chaupow/osrm-backend | profiles/bicycle.lua | 59 | 12992 | require("lib/access")
require("lib/maxspeed")
-- Begin of globals
barrier_whitelist = { [""] = true, ["cycle_barrier"] = true, ["bollard"] = true, ["entrance"] = true, ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["sally_port"] = true, ["gate"] = true, ["no"] = true }
access_tag_whitelist = { ["yes"] = true, ["permissive"] = true, ["designated"] = true }
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
access_tags_hierachy = { "bicycle", "vehicle", "access" }
cycleway_tags = {["track"]=true,["lane"]=true,["opposite"]=true,["opposite_lane"]=true,["opposite_track"]=true,["share_busway"]=true,["sharrow"]=true,["shared"]=true }
service_tag_restricted = { ["parking_aisle"] = true }
restriction_exception_tags = { "bicycle", "vehicle", "access" }
default_speed = 15
walking_speed = 6
bicycle_speeds = {
["cycleway"] = default_speed,
["primary"] = default_speed,
["primary_link"] = default_speed,
["secondary"] = default_speed,
["secondary_link"] = default_speed,
["tertiary"] = default_speed,
["tertiary_link"] = default_speed,
["residential"] = default_speed,
["unclassified"] = default_speed,
["living_street"] = default_speed,
["road"] = default_speed,
["service"] = default_speed,
["track"] = 12,
["path"] = 12
--["footway"] = 12,
--["pedestrian"] = 12,
}
pedestrian_speeds = {
["footway"] = walking_speed,
["pedestrian"] = walking_speed,
["steps"] = 2
}
railway_speeds = {
["train"] = 10,
["railway"] = 10,
["subway"] = 10,
["light_rail"] = 10,
["monorail"] = 10,
["tram"] = 10
}
platform_speeds = {
["platform"] = walking_speed
}
amenity_speeds = {
["parking"] = 10,
["parking_entrance"] = 10
}
man_made_speeds = {
["pier"] = walking_speed
}
route_speeds = {
["ferry"] = 5
}
bridge_speeds = {
["movable"] = 5
}
surface_speeds = {
["asphalt"] = default_speed,
["cobblestone:flattened"] = 10,
["paving_stones"] = 10,
["compacted"] = 10,
["cobblestone"] = 6,
["unpaved"] = 6,
["fine_gravel"] = 6,
["gravel"] = 6,
["fine_gravel"] = 6,
["pebbelstone"] = 6,
["ground"] = 6,
["dirt"] = 6,
["earth"] = 6,
["grass"] = 6,
["mud"] = 3,
["sand"] = 3
}
take_minimum_of_speeds = true
obey_oneway = true
obey_bollards = false
use_restrictions = true
ignore_areas = true -- future feature
traffic_signal_penalty = 5
u_turn_penalty = 20
use_turn_restrictions = false
turn_penalty = 60
turn_bias = 1.4
--modes
mode_normal = 1
mode_pushing = 2
mode_ferry = 3
mode_train = 4
mode_movable_bridge = 5
local function parse_maxspeed(source)
if not source then
return 0
end
local n = tonumber(source:match("%d*"))
if not n then
n = 0
end
if string.match(source, "mph") or string.match(source, "mp/h") then
n = (n*1609)/1000;
end
return n
end
function get_exceptions(vector)
for i,v in ipairs(restriction_exception_tags) do
vector:Add(v)
end
end
function node_function (node, result)
local barrier = node:get_value_by_key("barrier")
local access = Access.find_access_tag(node, access_tags_hierachy)
local traffic_signal = node:get_value_by_key("highway")
-- flag node if it carries a traffic light
if traffic_signal and traffic_signal == "traffic_signals" then
result.traffic_lights = true
end
-- parse access and barrier tags
if access and access ~= "" then
if access_tag_blacklist[access] then
result.barrier = true
else
result.barrier = false
end
elseif barrier and barrier ~= "" then
if barrier_whitelist[barrier] then
result.barrier = false
else
result.barrier = true
end
end
end
function way_function (way, result)
-- initial routability check, filters out buildings, boundaries, etc
local highway = way:get_value_by_key("highway")
local route = way:get_value_by_key("route")
local man_made = way:get_value_by_key("man_made")
local railway = way:get_value_by_key("railway")
local amenity = way:get_value_by_key("amenity")
local public_transport = way:get_value_by_key("public_transport")
local bridge = way:get_value_by_key("bridge")
if (not highway or highway == '') and
(not route or route == '') and
(not railway or railway=='') and
(not amenity or amenity=='') and
(not man_made or man_made=='') and
(not public_transport or public_transport=='') and
(not bridge or bridge=='')
then
return
end
-- don't route on ways or railways that are still under construction
if highway=='construction' or railway=='construction' then
return
end
-- access
local access = Access.find_access_tag(way, access_tags_hierachy)
if access and access_tag_blacklist[access] then
return
end
-- other tags
local name = way:get_value_by_key("name")
local ref = way:get_value_by_key("ref")
local junction = way:get_value_by_key("junction")
local maxspeed = parse_maxspeed(way:get_value_by_key ( "maxspeed") )
local maxspeed_forward = parse_maxspeed(way:get_value_by_key( "maxspeed:forward"))
local maxspeed_backward = parse_maxspeed(way:get_value_by_key( "maxspeed:backward"))
local barrier = way:get_value_by_key("barrier")
local oneway = way:get_value_by_key("oneway")
local onewayClass = way:get_value_by_key("oneway:bicycle")
local cycleway = way:get_value_by_key("cycleway")
local cycleway_left = way:get_value_by_key("cycleway:left")
local cycleway_right = way:get_value_by_key("cycleway:right")
local duration = way:get_value_by_key("duration")
local service = way:get_value_by_key("service")
local area = way:get_value_by_key("area")
local foot = way:get_value_by_key("foot")
local surface = way:get_value_by_key("surface")
local bicycle = way:get_value_by_key("bicycle")
-- name
if ref and "" ~= ref and name and "" ~= name then
result.name = name .. ' / ' .. ref
elseif ref and "" ~= ref then
result.name = ref
elseif name and "" ~= name then
result.name = name
elseif highway then
-- if no name exists, use way type
-- this encoding scheme is excepted to be a temporary solution
result.name = "{highway:"..highway.."}"
end
-- roundabout handling
if junction and "roundabout" == junction then
result.roundabout = true;
end
-- speed
local bridge_speed = bridge_speeds[bridge]
if (bridge_speed and bridge_speed > 0) then
highway = bridge;
if duration and durationIsValid(duration) then
result.duration = math.max( parseDuration(duration), 1 );
end
result.forward_mode = mode_movable_bridge
result.backward_mode = mode_movable_bridge
result.forward_speed = bridge_speed
result.backward_speed = bridge_speed
elseif route_speeds[route] then
-- ferries (doesn't cover routes tagged using relations)
result.forward_mode = mode_ferry
result.backward_mode = mode_ferry
result.ignore_in_grid = true
if duration and durationIsValid(duration) then
result.duration = math.max( 1, parseDuration(duration) )
else
result.forward_speed = route_speeds[route]
result.backward_speed = route_speeds[route]
end
elseif railway and platform_speeds[railway] then
-- railway platforms (old tagging scheme)
result.forward_speed = platform_speeds[railway]
result.backward_speed = platform_speeds[railway]
elseif platform_speeds[public_transport] then
-- public_transport platforms (new tagging platform)
result.forward_speed = platform_speeds[public_transport]
result.backward_speed = platform_speeds[public_transport]
elseif railway and railway_speeds[railway] then
result.forward_mode = mode_train
result.backward_mode = mode_train
-- railways
if access and access_tag_whitelist[access] then
result.forward_speed = railway_speeds[railway]
result.backward_speed = railway_speeds[railway]
end
elseif amenity and amenity_speeds[amenity] then
-- parking areas
result.forward_speed = amenity_speeds[amenity]
result.backward_speed = amenity_speeds[amenity]
elseif bicycle_speeds[highway] then
-- regular ways
result.forward_speed = bicycle_speeds[highway]
result.backward_speed = bicycle_speeds[highway]
elseif access and access_tag_whitelist[access] then
-- unknown way, but valid access tag
result.forward_speed = default_speed
result.backward_speed = default_speed
else
-- biking not allowed, maybe we can push our bike?
-- essentially requires pedestrian profiling, for example foot=no mean we can't push a bike
if foot ~= 'no' and junction ~= "roundabout" then
if pedestrian_speeds[highway] then
-- pedestrian-only ways and areas
result.forward_speed = pedestrian_speeds[highway]
result.backward_speed = pedestrian_speeds[highway]
result.forward_mode = mode_pushing
result.backward_mode = mode_pushing
elseif man_made and man_made_speeds[man_made] then
-- man made structures
result.forward_speed = man_made_speeds[man_made]
result.backward_speed = man_made_speeds[man_made]
result.forward_mode = mode_pushing
result.backward_mode = mode_pushing
elseif foot == 'yes' then
result.forward_speed = walking_speed
result.backward_speed = walking_speed
result.forward_mode = mode_pushing
result.backward_mode = mode_pushing
elseif foot_forward == 'yes' then
result.forward_speed = walking_speed
result.forward_mode = mode_pushing
result.backward_mode = 0
elseif foot_backward == 'yes' then
result.forward_speed = walking_speed
result.forward_mode = 0
result.backward_mode = mode_pushing
end
end
end
-- direction
local impliedOneway = false
if junction == "roundabout" or highway == "motorway_link" or highway == "motorway" then
impliedOneway = true
end
if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then
result.backward_mode = 0
elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then
-- prevent implied oneway
elseif onewayClass == "-1" then
result.forward_mode = 0
elseif oneway == "no" or oneway == "0" or oneway == "false" then
-- prevent implied oneway
elseif cycleway and string.find(cycleway, "opposite") == 1 then
if impliedOneway then
result.forward_mode = 0
result.backward_mode = mode_normal
result.backward_speed = bicycle_speeds["cycleway"]
end
elseif cycleway_left and cycleway_tags[cycleway_left] and cycleway_right and cycleway_tags[cycleway_right] then
-- prevent implied
elseif cycleway_left and cycleway_tags[cycleway_left] then
if impliedOneway then
result.forward_mode = 0
result.backward_mode = mode_normal
result.backward_speed = bicycle_speeds["cycleway"]
end
elseif cycleway_right and cycleway_tags[cycleway_right] then
if impliedOneway then
result.forward_mode = mode_normal
result.backward_speed = bicycle_speeds["cycleway"]
result.backward_mode = 0
end
elseif oneway == "-1" then
result.forward_mode = 0
elseif oneway == "yes" or oneway == "1" or oneway == "true" or impliedOneway then
result.backward_mode = 0
end
-- pushing bikes
if bicycle_speeds[highway] or pedestrian_speeds[highway] then
if foot ~= "no" and junction ~= "roundabout" then
if result.backward_mode == 0 then
result.backward_speed = walking_speed
result.backward_mode = mode_pushing
elseif result.forward_mode == 0 then
result.forward_speed = walking_speed
result.forward_mode = mode_pushing
end
end
end
-- cycleways
if cycleway and cycleway_tags[cycleway] then
result.forward_speed = bicycle_speeds["cycleway"]
elseif cycleway_left and cycleway_tags[cycleway_left] then
result.forward_speed = bicycle_speeds["cycleway"]
elseif cycleway_right and cycleway_tags[cycleway_right] then
result.forward_speed = bicycle_speeds["cycleway"]
end
-- dismount
if bicycle == "dismount" then
result.forward_mode = mode_pushing
result.backward_mode = mode_pushing
result.forward_speed = walking_speed
result.backward_speed = walking_speed
end
-- surfaces
if surface then
surface_speed = surface_speeds[surface]
if surface_speed then
if result.forward_speed > 0 then
result.forward_speed = surface_speed
end
if result.backward_speed > 0 then
result.backward_speed = surface_speed
end
end
end
-- maxspeed
MaxSpeed.limit( result, maxspeed, maxspeed_forward, maxspeed_backward )
end
function turn_function (angle)
-- compute turn penalty as angle^2, with a left/right bias
k = turn_penalty/(90.0*90.0)
if angle>=0 then
return angle*angle*k/turn_bias
else
return angle*angle*k*turn_bias
end
end
| bsd-2-clause |
mercury233/ygopro-scripts | c84330567.lua | 2 | 3246 | --ティアラメンツ・ルルカロス
function c84330567.initial_effect(c)
c:EnableReviveLimit()
--fusion material
aux.AddFusionProcCodeFun(c,92731385,aux.FilterBoolFunction(Card.IsFusionSetCard,0x181),1,true,true)
--indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c84330567.indtg)
e1:SetValue(1)
c:RegisterEffect(e1)
--negate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(84330567,0))
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,84330567)
e2:SetCondition(c84330567.discon)
e2:SetTarget(c84330567.distg)
e2:SetOperation(c84330567.disop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(84330567,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,84330568)
e3:SetCondition(c84330567.spcon)
e3:SetTarget(c84330567.sptg)
e3:SetOperation(c84330567.spop)
c:RegisterEffect(e3)
end
function c84330567.indtg(e,c)
return c:IsRace(RACE_AQUA) and c~=e:GetHandler()
end
function c84330567.discon(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainNegatable(ev) then return false end
return re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) and ep~=tp
end
function c84330567.tgfilter(c)
return c:IsSetCard(0x181) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGrave()
end
function c84330567.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c84330567.tgfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND+LOCATION_ONFIELD)
end
function c84330567.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c84330567.tgfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
if #g>0 then
Duel.BreakEffect()
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
end
function c84330567.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_FUSION)
end
function c84330567.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c84330567.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mcanthony/texlive.js | texlive/texmf-dist/doc/luatex/base/fdata.lua | 4 | 90883 | -- $Id: fdata.lua 4106 2011-04-10 12:51:54Z hhenkel $
local fdata = {
["callback"]={
["functions"]={
["buildpage_filter"]={
["arguments"]={
{
["name"]="info",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Process objects as they are added to the main vertical list. The string argument gives some context.",
["type"]="callback",
},
["close"]={
["arguments"]={
{
["name"]="env",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Close a file opened with the \\afunction{open_read_file} callback. The argument is the return value from the \\afunction{open_read_file}",
["type"]="callback",
},
["define_font"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
{
["name"]="size",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="font",
["optional"]=false,
["type"]="metrics",
},
},
["shortdesc"]="Define a font from within lua code. The arguments are the user-supplied information, with negative numbers indicating \\type{scaled}, positive numbers \\type{at}",
["type"]="callback",
},
["find"]={
["arguments"]={
{
["name"]="callback_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="function",
},
},
["shortdesc"]="Returns the function currently associated with a callback, or \\type{nil}",
["type"]="function",
},
["find_data_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find an input data file for PDF attachment.",
["type"]="callback",
},
["find_enc_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a font encoding file.",
["type"]="callback",
},
["find_font_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a font metrics file.",
["type"]="callback",
},
["find_format_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find the format file.",
["type"]="callback",
},
["find_image_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find an image file for inclusion.",
["type"]="callback",
},
["find_map_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a font map file.",
["type"]="callback",
},
["find_opentype_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find an OpenType font file.",
["type"]="callback",
},
["find_output_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find the output (PDF or DVI) file.",
["type"]="callback",
},
["find_pk_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a PK font bitmap file.",
["type"]="callback",
},
["find_read_file"]={
["arguments"]={
{
["name"]="id_number",
["optional"]=false,
["type"]="number",
},
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a file for \\tex{input} (0) or \\tex{openin} (higher integers).",
["type"]="callback",
},
["find_subfont_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a subfont definition file.",
["type"]="callback",
},
["find_truetype_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find an TrueType font file.",
["type"]="callback",
},
["find_type1_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find an Type1 (PostScript) font file.",
["type"]="callback",
},
["find_vf_file"]={
["arguments"]={
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a VF file.",
["type"]="callback",
},
["find_write_file"]={
["arguments"]={
{
["name"]="id_number",
["optional"]=false,
["type"]="number",
},
{
["name"]="asked_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="actual_name",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a file for writing to the log file (0) or with \\tex{write} (higher integers).",
["type"]="callback",
},
["finish_pdffile"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions just before the PDF closing takes place.",
["type"]="callback",
},
["hpack_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="groupcode",
["optional"]=false,
["type"]="string",
},
{
["name"]="size",
["optional"]=false,
["type"]="number",
},
{
["name"]="packtype",
["optional"]=false,
["type"]="string",
},
{
["name"]="direction",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Alter a node list before horizontal packing takes place. The first string gives some context,\
the number is the desired size, the second string is either \\aliteral{exact} or \\aliteral{additional} (modifies the first string),\
the third string is the desired direction",
["type"]="callback",
},
["hyphenate"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="tail",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Apply hyphenation to a node list.",
["type"]="callback",
},
["kerning"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="tail",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Apply kerning to a node list.",
["type"]="callback",
},
["ligaturing"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="tail",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Apply ligaturing to a node list.",
["type"]="callback",
},
["linebreak_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="is_display",
["optional"]=false,
["type"]="boolean",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Override the linebreaking algorithm. The boolean is \\type{true} if this is a pre-display break.",
["type"]="callback",
},
["list"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="info",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Produce a list of all known callback names.",
["type"]="function",
},
["mlist_to_hlist"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="displaytype",
["optional"]=false,
["type"]="string",
},
{
["name"]="need_penalties",
["optional"]=false,
["type"]="boolean",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Convert a math node list into a horizontal node list.",
["type"]="callback",
},
["open_read_file"]={
["arguments"]={
{
["name"]="file_name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="env",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Open a file for reading. The returned table should define key functions for \\aliteral{reader} and \\aliteral{close}.",
["type"]="callback",
},
["post_linebreak_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="groupcode",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Alter a node list afer linebreaking has taken place. The string argument gives some context.",
["type"]="callback",
},
["pre_dump"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions just before format dumping takes place.",
["type"]="callback",
},
["pre_linebreak_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="groupcode",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Alter a node list before linebreaking takes place. The string argument gives some context.",
["type"]="callback",
},
["pre_output_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="groupcode",
["optional"]=false,
["type"]="string",
},
{
["name"]="size",
["optional"]=false,
["type"]="number",
},
{
["name"]="packtype",
["optional"]=false,
["type"]="string",
},
{
["name"]="maxdepth",
["optional"]=false,
["type"]="number",
},
{
["name"]="direction",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Alter a node list before boxing to \\tex{outputbox} takes place. See \\afunction{vpack_filter} for the arguments.",
["type"]="callback",
},
["process_input_buffer"]={
["arguments"]={
{
["name"]="buffer",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="adjusted_buffer",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Modify the encoding of the input buffer.",
["type"]="callback",
},
["process_output_buffer"]={
["arguments"]={
{
["name"]="buffer",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="adjusted_buffer",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Modify the encoding of the output buffer.",
["type"]="callback",
},
["read_data_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a data file.",
["type"]="callback",
},
["read_enc_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a font encoding file.",
["type"]="callback",
},
["read_font_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a TFM metrics file. Return \\type{true}, the data, and the data length for success, \\type{false} otherwise",
["type"]="callback",
},
["read_map_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a font map file.",
["type"]="callback",
},
["read_opentype_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read an OpenType font.",
["type"]="callback",
},
["read_pk_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a font bitmap PK file.",
["type"]="callback",
},
["read_sfd_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a subfont definition file.",
["type"]="callback",
},
["read_truetype_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a TrueType font.",
["type"]="callback",
},
["read_type1_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a Type1 font.",
["type"]="callback",
},
["read_vf_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
{
["name"]="data",
["optional"]=false,
["type"]="string",
},
{
["name"]="data_size",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Read a VF metrics file.",
["type"]="callback",
},
["reader"]={
["arguments"]={
{
["name"]="env",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={
{
["name"]="line",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Read a line from a file opened with the \\afunction{open_read_file} callback. The argument is the return value from \\afunction{open_read_file}",
["type"]="callback",
},
["register"]={
["arguments"]={
{
["name"]="callback_name",
["optional"]=false,
["type"]="string",
},
{
["name"]="callback_func",
["optional"]=false,
["type"]="function",
},
},
["returnvalues"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="error",
["optional"]=true,
["type"]="string",
},
},
["shortdesc"]="Register a callback. Passing \\type{nil} removes an existing callback. Returns \\type{nil}, \\type{error} on failure.",
["type"]="function",
},
["show_error_hook"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run action at error reporting time.",
["type"]="callback",
},
["start_page_number"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions at the start of typeset page number message reporting.",
["type"]="callback",
},
["start_run"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions at the start of the typesetting run.",
["type"]="callback",
},
["stop_page_number"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions at the end of typeset page number message reporting.",
["type"]="callback",
},
["stop_run"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Run actions just before the end of the typesetting run.",
["type"]="callback",
},
["token_filter"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="token",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Override the tokenization process. Return value is a \\type{token} or an array of tokens",
["type"]="callback",
},
["vpack_filter"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="groupcode",
["optional"]=false,
["type"]="string",
},
{
["name"]="size",
["optional"]=false,
["type"]="number",
},
{
["name"]="packtype",
["optional"]=false,
["type"]="string",
},
{
["name"]="maxdepth",
["optional"]=false,
["type"]="number",
},
{
["name"]="direction",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="newhead",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Alter a node list before vertical packing takes place. The second number is the desired max depth. See \\afunction{hpack_filter} for the arguments.",
["type"]="callback",
},
},
["methods"]={
},
},
["epdf"] = require "fdata_epdf",
["font"]={
["functions"]={
["current"]={
["arguments"]={
{
["name"]="i",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=true,
["type"]="number",
},
},
["shortdesc"]="Get or set the currently active font",
["type"]="function",
},
["define"]={
["arguments"]={
{
["name"]="f",
["optional"]=false,
["type"]="metrics",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Process a font metrics table and stores it in the internal font table, returning its internal id.",
["type"]="function",
},
["each"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
{
["name"]="v",
["optional"]=false,
["type"]="metrics",
},
},
["shortdesc"]="Iterate over all the defined fonts.",
["type"]="function",
},
["frozen"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="True if the font is frozen and can no longer be altered.",
["type"]="function",
},
["getfont"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="metrics",
},
},
["shortdesc"]="Fetch an internal font id as a lua table.",
["type"]="function",
},
["id"]={
["arguments"]={
{
["name"]="csname",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the font id of the font accessed by the csname given.",
["type"]="function",
},
["max"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the highest used font id at this moment.",
["type"]="function",
},
["nextid"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the next free font id number.",
["type"]="function",
},
["read_tfm"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="fnt",
["optional"]=false,
["type"]="metrics",
},
},
["shortdesc"]="Parse a font metrics file, at the size indicated by the number.",
["type"]="function",
},
["read_vf"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="vf_fnt",
["optional"]=false,
["type"]="metrics",
},
},
["shortdesc"]="Parse a virtual font metrics file, at the size indicated by the number.",
["type"]="function",
},
["setfont"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="f",
["optional"]=false,
["type"]="metrics",
},
},
["returnvalues"]={},
["shortdesc"]="Set an internal font id from a lua table.",
["type"]="function",
},
},
["methods"]={
},
},
["fontloader"]={
["functions"]={
["apply_afmfile"]={
["arguments"]={
{
["name"]="f",
["optional"]=false,
["type"]="luafont",
},
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Apply an AFM file to a fontloader table.",
["type"]="function",
},
["apply_featurefile"]={
["arguments"]={
{
["name"]="f",
["optional"]=false,
["type"]="luafont",
},
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Apply a feature file to a fontloader table.",
["type"]="function",
},
["info"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="info",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Get various information fields from an font file.",
["type"]="function",
},
["open"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
{
["name"]="fontname",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="luafont",
},
{
["name"]="w",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Parse a font file and return a table representing its contents. The optional argument\
is the name of the desired font in case of font collection files. The optional return\
value contains any parser error strings.",
["type"]="function",
},
},
["methods"]={
},
},
["img"] = require "fdata_img",
["kpse"]={
["functions"]={
["expand_braces"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Expand the braces in a variable.",
["type"]="function",
},
["expand_path"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Expand a path.",
["type"]="function",
},
["expand_var"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Expand a variable.",
["type"]="function",
},
["find_file"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
{
["name"]="ftype",
["optional"]=true,
["type"]="string",
},
{
["name"]="mustexist",
["optional"]=true,
["type"]="boolean",
},
{
["name"]="dpi",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a file. The optional string is the file type as supported by the\
standalone \\type{kpsewhich} program (default is \\aliteral{{tex}}, no autodiscovery takes place).\
The optional boolean indicates wether the file must exist.\
The optional number is the dpi value for PK files.\
",
["type"]="function",
},
["init_prog"]={
["arguments"]={
{
["name"]="prefix",
["optional"]=false,
["type"]="string",
},
{
["name"]="base_dpi",
["optional"]=false,
["type"]="number",
},
{
["name"]="mfmode",
["optional"]=false,
["type"]="string",
},
{
["name"]="fallback",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Initialize a PK generation program. The optional string is the metafont mode fallback name",
["type"]="function",
},
["lookup"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
{
["name"]="options",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Find a file (extended interface).",
["type"]="function",
},
["new"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
{
["name"]="progname",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="kpathsea",
["optional"]=false,
["type"]="kpathsea",
},
},
["shortdesc"]="Create a new kpathsea library instance. The optional string allows explicit \\type{progname} setting.",
["type"]="function",
},
["readable_file"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Returns true if a file exists and is readable.",
["type"]="function",
},
["set_program_name"]={
["arguments"]={
{
["name"]="name",
["optional"]=false,
["type"]="string",
},
{
["name"]="progname",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Initialize the kpathsea library by setting the program name. The optional string allows explicit \\type{progname} setting.",
["type"]="function",
},
["show_path"]={
["arguments"]={
{
["name"]="ftype",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="List the search path for a specific file type.",
["type"]="function",
},
["var_value"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the value of a variable.",
["type"]="function",
},
["version"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="r",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the kpathsea version.",
["type"]="function",
},
},
["methods"]={
},
},
["lang"]={
["functions"]={
["clean"]={
["arguments"]={
{
["name"]="o",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Creates a hyphenation key from the supplied hyphenation exception.",
["type"]="function",
},
["clear_hyphenation"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
},
["returnvalues"]={},
["shortdesc"]="Clear the set of hyphenation exceptions.",
["type"]="function",
},
["clear_patterns"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
},
["returnvalues"]={},
["shortdesc"]="Clear the set of hyphenation patterns.",
["type"]="function",
},
["hyphenate"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="tail",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Hyphenate a node list.",
["type"]="function",
},
["hyphenation"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="string",
},
},
["shortdesc"]="Get or set hyphenation exceptions.",
["type"]="function",
},
["id"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Returns the current internal \\tex{language} id number.",
["type"]="function",
},
["new"]={
["arguments"]={
{
["name"]="id",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
},
["shortdesc"]="Create a new language object, with an optional fixed id number.",
["type"]="function",
},
["patterns"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="string",
},
},
["shortdesc"]="Get or set hyphenation patterns.",
["type"]="function",
},
["postexhyphenchar"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["shortdesc"]="Set the post-hyphenchar for explicit hyphenation.",
["type"]="function",
},
["posthyphenchar"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["shortdesc"]="Set the post-hyphenchar for implicit hyphenation.",
["type"]="function",
},
["preexhyphenchar"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["shortdesc"]="Set the pre-hyphenchar for explicit hyphenation.",
["type"]="function",
},
["prehyphenchar"]={
["arguments"]={
{
["name"]="l",
["optional"]=false,
["type"]="language",
},
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
},
["shortdesc"]="Set the pre-hyphenchar for implicit hyphenation.",
["type"]="function",
},
},
["methods"]={
},
},
["lfs"]={
["functions"]={
["isdir"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Return true if the string is a directory.",
["type"]="function",
},
["isfile"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Return true if the string is a file.",
["type"]="function",
},
["readlink"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the contents of a symlink (Unix only).",
["type"]="function",
},
["shortname"]={
["arguments"]={
{
["name"]="filename",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="fat",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the FAT name of a file (Windows only).",
["type"]="function",
},
},
["methods"]={
},
},
["lua"]={
["functions"]={
["getbytecode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="f",
["optional"]=false,
["type"]="function",
},
},
["shortdesc"]="Return a previously stored function from a bytecode register.",
["type"]="function",
},
["setbytecode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="f",
["optional"]=false,
["type"]="function",
},
},
["returnvalues"]={},
["shortdesc"]="Save a function in a bytecode register.",
["type"]="function",
},
},
["methods"]={
},
},
["mp"]={
["functions"]={
["char_depth"]={
["arguments"]={
{
["name"]="fontname",
["optional"]=false,
["type"]="string",
},
{
["name"]="char",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="w",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Report a character's depth.",
["type"]="method",
},
["char_height"]={
["arguments"]={
{
["name"]="fontname",
["optional"]=false,
["type"]="string",
},
{
["name"]="char",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="w",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Report a character's height.",
["type"]="method",
},
["char_width"]={
["arguments"]={
{
["name"]="fontname",
["optional"]=false,
["type"]="string",
},
{
["name"]="char",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="w",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Report a character's width.",
["type"]="method",
},
["execute"]={
["arguments"]={
{
["name"]="chunk",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="rettable",
["optional"]=false,
["type"]="mpdata",
},
},
["shortdesc"]="Execute metapost code in the instance.",
["type"]="method",
},
["finish"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="rettable",
["optional"]=false,
["type"]="mpdata",
},
},
["shortdesc"]="Finish a metapost instance.",
["type"]="method",
},
["statistics"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="stats",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Returns some statistics for this metapost instance.",
["type"]="method",
},
},
["methods"]={
},
},
["mplib"]={
["functions"]={
["new"]={
["arguments"]={
{
["name"]="options",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={
{
["name"]="mp",
["optional"]=false,
["type"]="mpinstance",
},
},
["shortdesc"]="Create a new metapost instance.",
["type"]="function",
},
["version"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="v",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Returns the mplib version.",
["type"]="function",
},
},
["methods"]={
},
},
["node"]={
["functions"]={
["copy"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Copy a node.",
["type"]="function",
},
["copy_list"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Copy a node list.",
["type"]="function",
},
["count"]={
["arguments"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the count of nodes with a specific id in a node list. Processing stops just before the optional node.",
["type"]="function",
},
["dimensions"]={
["arguments"]={
{
["name"]="glue_set",
["optional"]=true,
["type"]="number",
},
{
["name"]="glue_sign",
["optional"]=true,
["type"]="number",
},
{
["name"]="glue_order",
["optional"]=true,
["type"]="number",
},
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="t",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="w",
["optional"]=false,
["type"]="number",
},
{
["name"]="h",
["optional"]=false,
["type"]="number",
},
{
["name"]="d",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the natural dimensions of a (horizontal) node list. The 3 optional numbers represent \
glue_set, glue_sign, and glue_order. The calculation stops just before the optional node (default end of list)",
["type"]="function",
},
["fields"]={
["arguments"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="subid",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Report the fields a node type understands. The optional argument is needed for whatsits.",
["type"]="function",
},
["first_glyph"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Return the first character node in a list. Processing stops just before the optional node.",
["type"]="function",
},
["flush_list"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Release a list of nodes.",
["type"]="function",
},
["free"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Release a node.",
["type"]="function",
},
["has_attribute"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="val",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="v",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return an attribute value for a node, if it has one. The optional number tests for a specific value",
["type"]="function",
},
["has_field"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="field",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Return true if the node understands the named field.",
["type"]="function",
},
["hpack"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="w",
["optional"]=true,
["type"]="number",
},
{
["name"]="info",
["optional"]=true,
["type"]="string",
},
{
["name"]="dir",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="h",
["optional"]=false,
["type"]="node",
},
{
["name"]="b",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Pack a node list into a horizontal list. The number is the desired size, the first string is either \\aliteral{exact} or \\aliteral{additional} (modifies the first string),\
the second string is the desired direction",
["type"]="function",
},
["id"]={
["arguments"]={
{
["name"]="type",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Convert a node type string into a node id number.",
["type"]="function",
},
["insert_after"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="current",
["optional"]=false,
["type"]="node",
},
{
["name"]="new",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="new",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Insert the third node just after the second node in the list that starts at the first node.",
["type"]="function",
},
["insert_before"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="current",
["optional"]=false,
["type"]="node",
},
{
["name"]="new",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="new",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Insert the third node just before the second node in the list that starts at the first node.",
["type"]="function",
},
["is_node"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="any",
},
},
["returnvalues"]={
{
["name"]="yes",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Return true if the object is a <node>.",
["type"]="function",
},
["kerning"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="h",
["optional"]=false,
["type"]="node",
},
{
["name"]="t",
["optional"]=false,
["type"]="node",
},
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Apply the internal kerning routine to a node list. Processing stops just before the optional node.",
["type"]="function",
},
["last_node"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Pops and returns the last node on the current output list.",
["type"]="function",
},
["length"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the length of a node list. Processing stops just before the optional node.",
["type"]="function",
},
["ligaturing"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="m",
["optional"]=true,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="h",
["optional"]=false,
["type"]="node",
},
{
["name"]="t",
["optional"]=false,
["type"]="node",
},
{
["name"]="success",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Apply the internal ligaturing routine to a node list. Processing stops just before the optional node.",
["type"]="function",
},
["mlist_to_hlist"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="displaytype",
["optional"]=false,
["type"]="string",
},
{
["name"]="penalties",
["optional"]=false,
["type"]="boolean",
},
},
["returnvalues"]={
{
["name"]="h",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Recursively convert a math list into a horizontal list. The string differentiates display and inline, the boolean\
whether penalties are inserted",
["type"]="function",
},
["new"]={
["arguments"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="subid",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Create a new node with id and (optional) subtype.",
["type"]="function",
},
["protect_glyphs"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Mark all processed glyphs in a node list as being characters.",
["type"]="function",
},
["protrusion_skippable"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="yes",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Return true if the node could be skipped for protrusion purposes.",
["type"]="function",
},
["remove"]={
["arguments"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="current",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="head",
["optional"]=false,
["type"]="node",
},
{
["name"]="current",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Extract and remove a second node from the list that starts in the first node.",
["type"]="function",
},
["set_attribute"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="val",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set an attribute value for a node.",
["type"]="function",
},
["slide"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Move to the last node of a list while fixing next and prev pointers.",
["type"]="function",
},
["next"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Returns the next node.",
["type"]="function",
},
["prev"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Returns the previous node.",
["type"]="function",
},
["subtype"]={
["arguments"]={
{
["name"]="type",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="subtype",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Convert a whatsit type string into a node subtype number.",
["type"]="function",
},
["tail"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="m",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Return the last node in a list.",
["type"]="function",
},
["traverse"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Iterate over a node list.",
["type"]="function",
},
["traverse_id"]={
["arguments"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Iterate over nodes with id matching the number in a node list.",
["type"]="function",
},
["type"]={
["arguments"]={
{
["name"]="id",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="type",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="convert a node id number into a node type string.",
["type"]="function",
},
["types"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Return the list of node types.",
["type"]="function",
},
["unprotect_glyphs"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Mark all characters in a node list as being processed glyphs.",
["type"]="function",
},
["unset_attribute"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
{
["name"]="val",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="v",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Unset an attribute value for a node. The optional number tests for a specific value",
["type"]="function",
},
["vpack"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
{
["name"]="w",
["optional"]=true,
["type"]="number",
},
{
["name"]="info",
["optional"]=true,
["type"]="string",
},
{
["name"]="dir",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="h",
["optional"]=false,
["type"]="node",
},
{
["name"]="b",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Pack a node list into a vertical list. Arguments as for node.hpack",
["type"]="function",
},
["whatsits"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Return the list of whatsit types.",
["type"]="function",
},
["write"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Appends a node to the current output list.",
["type"]="function",
},
},
["methods"]={
},
},
["os"]={
["functions"]={
["exec"]={
["arguments"]={
{
["name"]="command",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]=" Run an external command and exit. The table is an array of arguments, with an optional \\type{argv[0]} in index 0.",
["type"]="function",
},
["gettimeofday"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="time",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get the time as a floating point number (Unix only).",
["type"]="function",
},
["setenv"]={
["arguments"]={
{
["name"]="key",
["optional"]=false,
["type"]="string",
},
{
["name"]="value",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Set an environment variable.",
["type"]="function",
},
["spawn"]={
["arguments"]={
{
["name"]="command",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={
{
["name"]="succ",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="Run an external command and return its exit code. The table is an array of arguments, with an optional \\type{argv[0]} in index 0.",
["type"]="function",
},
["times"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="times",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Return process times.",
["type"]="function",
},
["tmpdir"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="d",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Create a temporary directory inside the current directory.",
["type"]="function",
},
["selfdir"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="d",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the directory path of argv[0].",
["type"]="function",
},
["uname"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="data",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Return various information strings about the computer.",
["type"]="function",
},
},
["methods"]={
},
},
["pdf"]={
["functions"]={
["immediateobj"]={
["arguments"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
{
["name"]="type",
["optional"]=true,
["type"]="string",
},
{
["name"]="objtext",
["optional"]=false,
["type"]="string",
},
{
["name"]="extradata",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Write an object to the PDF file immediately. The optional number is an object id,\
the first optional string is \\aliteral{{file}}, \\aliteral{{stream}}, or \\aliteral{{filestream}}.\
the second optional string contains stream attributes for the latter two cases.\
",
["type"]="function",
},
["obj"]={
["arguments"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
{
["name"]="type",
["optional"]=true,
["type"]="string",
},
{
["name"]="objtext",
["optional"]=false,
["type"]="string",
},
{
["name"]="extradata",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Write an object to the PDF file. See \\aliteral{pdf.immediateobj} for arguments.",
["type"]="function",
},
["refobj"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
}
},
["returnvalues"]={},
["shortdesc"]="Reference an object, so that it will be written out.",
["type"]="function",
},
["print"]={
["arguments"]={
{
["name"]="type",
["optional"]=true,
["type"]="string",
},
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Write directly to the PDF file (use in \\tex{latelua}). The optional string is\
one of \\aliteral{{direct}} or \\aliteral{{page}}",
["type"]="function",
},
["registerannot"]={
["arguments"]={
{
["name"]="objnum",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Register an annotation in the PDF backend.",
["type"]="function",
},
["pageref"]={
["arguments"]={
{
["name"]="objnum",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="page",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the pageref object number.",
["type"]="function",
},
["mapfile"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Register a font map file.",
["type"]="function",
},
["mapline"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Register a font map line.",
["type"]="function",
},
["reserveobj"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Reserve an object number in the PDF backend.",
["type"]="function",
},
},
["methods"]={
},
},
["status"]={
["functions"]={
["list"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="info",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Returns a table with various status items.",
["type"]="function",
},
},
["methods"]={
},
},
["string"]={
["functions"]={
["bytepairs"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="m",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Iterator that returns two values representing two single 8-byte tokens.",
["type"]="function",
},
["bytes"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Iterator that returns a value representing a single 8-byte token.",
["type"]="function",
},
["characterpairs"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
{
["name"]="t",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Iterator that returns two strings representing two single \\UTF-8 tokens.",
["type"]="function",
},
["characters"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Iterator that returns a string representing a single 8-byte token.",
["type"]="function",
},
["explode"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
{
["name"]="sep",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Break a string into pieces. The optional argument is a character possibly followed by a plus sign (default \\aliteral{{ +}})",
["type"]="function",
},
["utfcharacters"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Iterator that returns a string representing a single \\UTF-8 token.",
["type"]="function",
},
["utfvalues"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Iterator that returns a value representing a single \\UTF-8 token.",
["type"]="function",
},
},
["methods"]={
},
},
["tex"]={
["functions"]={
["badness"]={
["arguments"]={
{
["name"]="f",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="b",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Compute a badness value.",
["type"]="function",
},
["definefont"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="boolean",
},
{
["name"]="csname",
["optional"]=false,
["type"]="string",
},
{
["name"]="fontid",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Define a font csname. The optional boolean indicates for global definition, the string is the csname, the number is a font id.",
["type"]="function",
},
["enableprimitives"]={
["arguments"]={
{
["name"]="prefix",
["optional"]=false,
["type"]="string",
},
{
["name"]="names",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Enable the all primitives in the array using the string as prefix.",
["type"]="function",
},
["error"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
{
["name"]="helptext",
["optional"]=true,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Create an error that is presented to the user. The optional table is an array of help message strings.",
["type"]="function",
},
["extraprimitives"]={
["arguments"]={
{
["name"]="s1",
["optional"]=false,
["type"]="string",
},
{
["name"]="s2",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Return all primitives in a (set of) extension identifiers. Valid identifiers are: \
\\aliteral{tex}, \\aliteral{core}, \\aliteral{etex}, \\aliteral{pdftex}, \\aliteral{omega}, \\aliteral{aleph}, and \\aliteral{luatex}.",
["type"]="function",
},
["get"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="v",
["optional"]=false,
["type"]="value",
},
},
["shortdesc"]="Get a named internal register. Also accepts a predefined csname string.",
["type"]="function",
},
["getattribute"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get an attribute register. Also accepts a predefined csname string.",
["type"]="function",
},
["getbox"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Get a box register. Also accepts a predefined csname string.",
["type"]="function",
},
["getcount"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get a count register. Also accepts a predefined csname string.",
["type"]="function",
},
["getdimen"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get a dimen register. Also accepts a predefined csname string.",
["type"]="function",
},
["getmath"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="string",
},
{
["name"]="t",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get an internal math parameter. The first string is like the csname but without the \\type{Umath} prefix, the second string is a style name minus the \\type{style} suffix.",
["type"]="function",
},
["getskip"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="node",
},
},
["shortdesc"]="Get a skip register. Also accepts a predefined csname string.",
["type"]="function",
},
["gettoks"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Get a toks register. Also accepts a predefined csname string.",
["type"]="function",
},
["getlccode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get a lowercase code.",
["type"]="function",
},
["setlccode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="lc",
["optional"]=false,
["type"]="number",
},
{
["name"]="uc",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set a lowercase code.",
["type"]="function",
},
["getuccode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get an uppercase code.",
["type"]="function",
},
["setuccode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="uc",
["optional"]=false,
["type"]="number",
},
{
["name"]="lc",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set an uppercase code.",
["type"]="function",
},
["getsfcode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get a space factor.",
["type"]="function",
},
["setsfcode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="sf",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set a space factor.",
["type"]="function",
},
["getcatcode"]={
["arguments"]={
{
["name"]="cattable",
["optional"]=true,
["type"]="number",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="c",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Get a category code.",
["type"]="function",
},
["setcatcode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="cattable",
["optional"]=true,
["type"]="number",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="c",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set a category code.",
["type"]="function",
},
["getmathcode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Get a math code.",
["type"]="function",
},
["setmathcode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="mval",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Set a math code.",
["type"]="function",
},
["getdelcode"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="s",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Get a delimiter code.",
["type"]="function",
},
["setdelcode"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="mval",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Set a delimiter code.",
["type"]="function",
},
["linebreak"]={
["arguments"]={
{
["name"]="listhead",
["optional"]=false,
["type"]="node",
},
{
["name"]="parameters",
["optional"]=false,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Run the line breaker on a node list. The table lists settings.",
["type"]="function",
},
["primitives"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="table",
},
},
["shortdesc"]="Returns a table of all currently active primitives, with their meaning.",
["type"]="function",
},
["print"]={
["arguments"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
{
["name"]="s1",
["optional"]=false,
["type"]="string",
},
{
["name"]="s2",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]=" Print a sequence of strings (not just two) as lines. The optional argument is a catcode table id.",
["type"]="function",
},
["round"]={
["arguments"]={
{
["name"]="o",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Round a number.",
["type"]="function",
},
["scale"]={
["arguments"]={
{
["name"]="o",
["optional"]=false,
["type"]="number",
},
{
["name"]="delta",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Multiplies the first number (or all fields in a table) with the second argument (if the first argument is a table, so is the return value).",
["type"]="function",
},
["set"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="string",
},
{
["name"]="v",
["optional"]=false,
["type"]="value",
},
},
["returnvalues"]={},
["shortdesc"]="Set a named internal register. Also accepts a predefined csname string.",
["type"]="function",
},
["setattribute"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set an attribute register. Also accepts a predefined csname string.",
["type"]="function",
},
["setbox"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Set a box register. Also accepts a predefined csname string.",
["type"]="function",
},
["setcount"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set a count register. Also accepts a predefined csname string.",
["type"]="function",
},
["setdimen"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set a dimen register. Also accepts a predefined csname string.",
["type"]="function",
},
["setmath"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="string",
},
{
["name"]="t",
["optional"]=false,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Set an internal math parameter. The first string is like the csname but without the \\type{Umath} prefix, the second string is a style name minus the \\type{style} suffix.",
["type"]="function",
},
["setskip"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="node",
},
},
["returnvalues"]={},
["shortdesc"]="Set a skip register. Also accepts a predefined csname string.",
["type"]="function",
},
["settoks"]={
["arguments"]={
{
["name"]="global",
["optional"]=true,
["type"]="string",
},
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Set a toks register. Also accepts a predefined csname string.",
["type"]="function",
},
["shipout"]={
["arguments"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["returnvalues"]={},
["shortdesc"]="Ships the box to the output file and clears the box.",
["type"]="function",
},
["sp"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="n",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Convert a dimension string to scaled points.",
["type"]="function",
},
["sprint"]={
["arguments"]={
{
["name"]="n",
["optional"]=true,
["type"]="number",
},
{
["name"]="s1",
["optional"]=false,
["type"]="string",
},
{
["name"]="s2",
["optional"]=true,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]=" Print a sequence of strings (not just two) as partial lines. The optional argument is a catcode table id.",
["type"]="function",
},
["tprint"]={
["arguments"]={
{
["name"]="a1",
["optional"]=false,
["type"]="table",
},
{
["name"]="a2",
["optional"]=true,
["type"]="table",
},
},
["returnvalues"]={},
["shortdesc"]="Combine any number of \\type{tex.sprint}'s into a single function call.",
["type"]="function",
},
["write"]={
["arguments"]={
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]=" Print a sequence of strings (not just two) as detokenized data.",
["type"]="function",
},
},
["methods"]={
},
},
["texio"]={
["functions"]={
["write"]={
["arguments"]={
{
["name"]="target",
["optional"]=true,
["type"]="string",
},
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Write a string to the log and/or terminal. The optional argument is\
\\aliteral{{term}}, \\aliteral{{term and log}}, or \\aliteral{{log}}.",
["type"]="function",
},
["write_nl"]={
["arguments"]={
{
["name"]="target",
["optional"]=true,
["type"]="string",
},
{
["name"]="s",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={},
["shortdesc"]="Write a string to the log and/or terminal, starting on a new line. \
The optional argument is \
\\aliteral{{term}}, \\aliteral{{term and log}}, or \\aliteral{{log}}.",
["type"]="function",
},
},
["methods"]={
},
},
["token"]={
["functions"]={
["command_id"]={
["arguments"]={
{
["name"]="commandname",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Return the internal number representing a command code.",
["type"]="function",
},
["command_name"]={
["arguments"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["returnvalues"]={
{
["name"]="commandname",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the internal string representing a command code.",
["type"]="function",
},
["create"]={
["arguments"]={
{
["name"]="char",
["optional"]=false,
["type"]="number",
},
{
["name"]="catcode",
["optional"]=true,
["type"]="number",
},
},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["shortdesc"]="Create a token from scratch, the optional argument is a category code. Also accepts strings, in which case a token matching that csname is created.",
["type"]="function",
},
["csname_id"]={
["arguments"]={
{
["name"]="csname",
["optional"]=false,
["type"]="string",
},
},
["returnvalues"]={
{
["name"]="i",
["optional"]=false,
["type"]="number",
},
},
["shortdesc"]="Returns the value for a csname string.",
["type"]="function",
},
["csname_name"]={
["arguments"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["returnvalues"]={
{
["name"]="csname",
["optional"]=false,
["type"]="string",
},
},
["shortdesc"]="Return the csname associated with a token.",
["type"]="function",
},
["expand"]={
["arguments"]={},
["returnvalues"]={},
["shortdesc"]="Expand a token the tokenb waiting in the input stream.",
["type"]="function",
},
["get_next"]={
["arguments"]={},
["returnvalues"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["shortdesc"]="Fetch the next token from the input stream.",
["type"]="function",
},
["is_activechar"]={
["arguments"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["returnvalues"]={
{
["name"]="b",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="True if the token represents and active character.",
["type"]="function",
},
["is_expandable"]={
["arguments"]={
{
["name"]="t",
["optional"]=false,
["type"]="token",
},
},
["returnvalues"]={
{
["name"]="b",
["optional"]=false,
["type"]="boolean",
},
},
["shortdesc"]="True if the token is expandable.",
["type"]="function",
},
},
["methods"]={
},
},
}
return fdata;
| gpl-2.0 |
mercury233/ygopro-scripts | c92964816.lua | 2 | 1950 | --グローアップ・ブルーム
function c92964816.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
e1:SetDescription(aux.Stringid(92964816,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,92964816)
e1:SetCost(aux.bfgcost)
e1:SetTarget(c92964816.target)
e1:SetOperation(c92964816.operation)
c:RegisterEffect(e1)
end
function c92964816.filter(c,e,tp,chk)
return c:IsLevelAbove(5) and c:IsRace(RACE_ZOMBIE)
and (c:IsAbleToHand() or chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c92964816.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local res=Duel.IsEnvironment(4064256,PLAYER_ALL,LOCATION_FZONE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
return Duel.IsExistingMatchingCard(c92964816.filter,tp,LOCATION_DECK,0,1,nil,e,tp,res)
end
end
function c92964816.operation(e,tp,eg,ep,ev,re,r,rp)
local res=Duel.IsEnvironment(4064256,PLAYER_ALL,LOCATION_FZONE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tc=Duel.SelectMatchingCard(tp,c92964816.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp,res):GetFirst()
if tc then
if res and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)
and (not tc:IsAbleToHand() or Duel.SelectOption(tp,1190,1152)==1) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
else
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(c92964816.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c92964816.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return not c:IsRace(RACE_ZOMBIE)
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Zeruhn_Mines/npcs/Zelman.lua | 34 | 1737 | -----------------------------------
-- Area: Zeruhn Mines
-- NPC: Zelman
-- Involved In Quest: Groceries
-----------------------------------
package.loaded["scripts/zones/Zeruhn_Mines/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/Zeruhn_Mines/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local GroceriesVar = player:getVar("Groceries");
local GroceriesViewedNote = player:getVar("GroceriesViewedNote");
if (GroceriesVar == 2) then
player:showText(npc,7279);
elseif (GroceriesVar == 1) then
ViewedNote = player:seenKeyItem(TAMIS_NOTE);
if (ViewedNote == true) then
player:startEvent(0x00a2);
else
player:startEvent(0x00a1);
end
else
player:startEvent(0x00a0);
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 == 0x00a1) then
player:setVar("Groceries",2);
player:delKeyItem(TAMIS_NOTE);
elseif (csid == 0x00a2) then
player:setVar("GroceriesViewedNote",1);
player:delKeyItem(TAMIS_NOTE);
end
end;
| gpl-3.0 |
Zenny89/darkstar | scripts/zones/The_Garden_of_RuHmet/npcs/HomePoint#1.lua | 17 | 1203 | -----------------------------------
-- Area: The_Garden_of_RuHmet
-- NPC: HomePoint#1
-- @pos
-----------------------------------
package.loaded["scripts/zones/The_Garden_of_RuHmet/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/The_Garden_of_RuHmet/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fc, 89);
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 |
codebauss/lxc | src/lxc/lxc-top.lua | 62 | 7453 | #!/usr/bin/env lua
--
-- top(1) like monitor for lxc containers
--
-- Copyright © 2012 Oracle.
--
-- Authors:
-- Dwight Engen <dwight.engen@oracle.com>
--
-- This library is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 2, as
-- published by the Free Software Foundation.
--
-- 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.
--
local lxc = require("lxc")
local core = require("lxc.core")
local getopt = require("alt_getopt")
local USER_HZ = 100
local ESC = string.format("%c", 27)
local TERMCLEAR = ESC.."[H"..ESC.."[J"
local TERMNORM = ESC.."[0m"
local TERMBOLD = ESC.."[1m"
local TERMRVRS = ESC.."[7m"
local containers = {}
local stats = {}
local stats_total = {}
local max_containers
function printf(...)
local function wrapper(...) io.write(string.format(...)) end
local status, result = pcall(wrapper, ...)
if not status then
error(result, 2)
end
end
function string:split(delim, max_cols)
local cols = {}
local start = 1
local nextc
repeat
nextc = string.find(self, delim, start)
if (nextc and #cols ~= max_cols - 1) then
table.insert(cols, string.sub(self, start, nextc-1))
start = nextc + #delim
else
table.insert(cols, string.sub(self, start, string.len(self)))
nextc = nil
end
until nextc == nil or start > #self
return cols
end
function strsisize(size, width)
local KiB = 1024
local MiB = 1048576
local GiB = 1073741824
local TiB = 1099511627776
local PiB = 1125899906842624
local EiB = 1152921504606846976
local ZiB = 1180591620717411303424
if (size >= ZiB) then
return string.format("%d.%2.2d ZB", size / ZiB, (math.floor(size % ZiB) * 100) / ZiB)
end
if (size >= EiB) then
return string.format("%d.%2.2d EB", size / EiB, (math.floor(size % EiB) * 100) / EiB)
end
if (size >= PiB) then
return string.format("%d.%2.2d PB", size / PiB, (math.floor(size % PiB) * 100) / PiB)
end
if (size >= TiB) then
return string.format("%d.%2.2d TB", size / TiB, (math.floor(size % TiB) * 100) / TiB)
end
if (size >= GiB) then
return string.format("%d.%2.2d GB", size / GiB, (math.floor(size % GiB) * 100) / GiB)
end
if (size >= MiB) then
return string.format("%d.%2.2d MB", size / MiB, (math.floor(size % MiB) * 1000) / (MiB * 10))
end
if (size >= KiB) then
return string.format("%d.%2.2d KB", size / KiB, (math.floor(size % KiB) * 1000) / (KiB * 10))
end
return string.format("%3d.00 ", size)
end
function tty_lines()
local rows = 25
local f = assert(io.popen("stty -a | head -n 1"))
for line in f:lines() do
local stty_rows
_,_,stty_rows = string.find(line, "rows (%d+)")
if (stty_rows ~= nil) then
rows = stty_rows
break
end
end
f:close()
return rows
end
function container_sort(a, b)
if (optarg["r"]) then
if (optarg["s"] == "n") then return (a > b)
elseif (optarg["s"] == "c") then return (stats[a].cpu_use_nanos < stats[b].cpu_use_nanos)
elseif (optarg["s"] == "d") then return (stats[a].blkio < stats[b].blkio)
elseif (optarg["s"] == "m") then return (stats[a].mem_used < stats[b].mem_used)
elseif (optarg["s"] == "k") then return (stats[a].kmem_used < stats[b].kmem_used)
end
else
if (optarg["s"] == "n") then return (a < b)
elseif (optarg["s"] == "c") then return (stats[a].cpu_use_nanos > stats[b].cpu_use_nanos)
elseif (optarg["s"] == "d") then return (stats[a].blkio > stats[b].blkio)
elseif (optarg["s"] == "m") then return (stats[a].mem_used > stats[b].mem_used)
elseif (optarg["s"] == "k") then return (stats[a].kmem_used > stats[b].kmem_used)
end
end
end
function container_list_update()
local now_running
now_running = lxc.containers_running(true)
-- check for newly started containers
for _,v in ipairs(now_running) do
if (containers[v] == nil) then
local ct = lxc.container:new(v)
-- note, this is a "mixed" table, ie both dictionary and list
containers[v] = ct
table.insert(containers, v)
end
end
-- check for newly stopped containers
local indx = 1
while (indx <= #containers) do
local ctname = containers[indx]
if (now_running[ctname] == nil) then
containers[ctname] = nil
stats[ctname] = nil
table.remove(containers, indx)
else
indx = indx + 1
end
end
-- get stats for all current containers and resort the list
lxc.stats_clear(stats_total)
for _,ctname in ipairs(containers) do
stats[ctname] = containers[ctname]:stats_get(stats_total)
end
table.sort(containers, container_sort)
end
function stats_print_header(stats_total)
printf(TERMRVRS .. TERMBOLD)
printf("%-15s %8s %8s %8s %10s %10s", "Container", "CPU", "CPU", "CPU", "BlkIO", "Mem")
if (stats_total.kmem_used > 0) then printf(" %10s", "KMem") end
printf("\n")
printf("%-15s %8s %8s %8s %10s %10s", "Name", "Used", "Sys", "User", "Total", "Used")
if (stats_total.kmem_used > 0) then printf(" %10s", "Used") end
printf("\n")
printf(TERMNORM)
end
function stats_print(name, stats, stats_total)
printf("%-15s %8.2f %8.2f %8.2f %10s %10s",
name,
stats.cpu_use_nanos / 1000000000,
stats.cpu_use_sys / USER_HZ,
stats.cpu_use_user / USER_HZ,
strsisize(stats.blkio),
strsisize(stats.mem_used))
if (stats_total.kmem_used > 0) then
printf(" %10s", strsisize(stats.kmem_used))
end
end
function usage()
printf("Usage: lxc-top [options]\n" ..
" -h|--help print this help message\n" ..
" -m|--max display maximum number of containers\n" ..
" -d|--delay delay in seconds between refreshes (default: 3.0)\n" ..
" -s|--sort sort by [n,c,d,m] (default: n) where\n" ..
" n = Name\n" ..
" c = CPU use\n" ..
" d = Disk I/O use\n" ..
" m = Memory use\n" ..
" k = Kernel memory use\n" ..
" -r|--reverse sort in reverse (descending) order\n"
)
os.exit(1)
end
local long_opts = {
help = "h",
delay = "d",
max = "m",
reverse = "r",
sort = "s",
}
optarg,optind = alt_getopt.get_opts (arg, "hd:m:rs:", long_opts)
optarg["d"] = tonumber(optarg["d"]) or 3.0
optarg["m"] = tonumber(optarg["m"]) or tonumber(tty_lines() - 3)
optarg["r"] = optarg["r"] or false
optarg["s"] = optarg["s"] or "n"
if (optarg["h"] ~= nil) then
usage()
end
while true
do
container_list_update()
-- if some terminal we care about doesn't support the simple escapes, we
-- may fall back to this, or ncurses. ug.
--os.execute("tput clear")
printf(TERMCLEAR)
stats_print_header(stats_total)
for index,ctname in ipairs(containers) do
stats_print(ctname, stats[ctname], stats_total)
printf("\n")
if (index >= optarg["m"]) then
break
end
end
stats_print(string.format("TOTAL (%-2d)", #containers), stats_total, stats_total)
io.flush()
core.usleep(optarg["d"] * 1000000)
end
| lgpl-2.1 |
mercury233/ygopro-scripts | c32825095.lua | 4 | 1287 | --白鱓
function c32825095.initial_effect(c)
--Direct attack
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c32825095.sumsuc)
c:RegisterEffect(e1)
--Tuner
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(c32825095.tncon)
e2:SetOperation(c32825095.tnop)
c:RegisterEffect(e2)
end
function c32825095.sumsuc(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function c32825095.tncon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE)
end
function c32825095.tnop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_ADD_TYPE)
e1:SetValue(TYPE_TUNER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c14816857.lua | 2 | 3557 | --鉄獣戦線 ナーベル
function c14816857.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(14816857,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,14816857)
e1:SetCost(c14816857.spcost)
e1:SetTarget(c14816857.sptg)
e1:SetOperation(c14816857.spop)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(14816857,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,14816858)
e2:SetTarget(c14816857.thtg)
e2:SetOperation(c14816857.thop)
c:RegisterEffect(e2)
end
function c14816857.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
return true
end
function c14816857.cfilter(c)
return c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) and c:IsAbleToRemoveAsCost()
end
function c14816857.fselect(g,tg)
return tg:IsExists(Card.IsLink,1,nil,#g)
end
function c14816857.spfilter(c,e,tp)
return c:IsType(TYPE_LINK) and c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c14816857.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local cg=Duel.GetMatchingGroup(c14816857.cfilter,tp,LOCATION_GRAVE,0,nil)
local tg=Duel.GetMatchingGroup(c14816857.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp)
local _,maxlink=tg:GetMaxGroup(Card.GetLink)
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
if #tg==0 then return false end
return cg:CheckSubGroup(c14816857.fselect,1,maxlink,tg)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=cg:SelectSubGroup(tp,c14816857.fselect,false,1,maxlink,tg)
Duel.Remove(rg,POS_FACEUP,REASON_COST)
e:SetLabel(rg:GetCount())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c14816857.spfilter1(c,e,tp,lk)
return c14816857.spfilter(c,e,tp) and c:IsLink(lk)
end
function c14816857.spop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(0xff,0xff)
e1:SetTarget(aux.NOT(aux.TargetBoolFunction(Card.IsRace,RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST)))
e1:SetValue(c14816857.sumlimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local lk=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c14816857.spfilter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,lk)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
function c14816857.sumlimit(e,c)
if not c then return false end
return c:IsControler(e:GetHandlerPlayer())
end
function c14816857.thfilter(c)
return c:IsSetCard(0x14d) and c:IsType(TYPE_MONSTER) and not c:IsCode(14816857) and c:IsAbleToHand()
end
function c14816857.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c14816857.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c14816857.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c14816857.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c46701379.lua | 3 | 1710 | --ワルキューレ・フュンフト
function c46701379.initial_effect(c)
--atk up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x122))
e1:SetValue(c46701379.val)
c:RegisterEffect(e1)
--to grave
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(46701379,0))
e2:SetCategory(CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,46701379)
e2:SetCondition(c46701379.tgcon)
e2:SetTarget(c46701379.tgtg)
e2:SetOperation(c46701379.tgop)
c:RegisterEffect(e2)
end
function c46701379.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER)
end
function c46701379.val(e,c)
return Duel.GetMatchingGroupCount(c46701379.atkfilter,e:GetHandlerPlayer(),0,LOCATION_REMOVED,nil)*200
end
function c46701379.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x122) and not c:IsCode(46701379)
end
function c46701379.tgcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c46701379.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c46701379.tgfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGrave()
end
function c46701379.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c46701379.tgfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c46701379.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c46701379.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c74593218.lua | 4 | 1873 | --H-C クサナギ
function c74593218.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),4,3)
c:EnableReviveLimit()
--negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(74593218,0))
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_ATKCHANGE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c74593218.negcon)
e1:SetCost(c74593218.negcost)
e1:SetTarget(c74593218.negtg)
e1:SetOperation(c74593218.negop)
c:RegisterEffect(e1)
end
function c74593218.negcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED)
and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_TRAP) and Duel.IsChainNegatable(ev)
end
function c74593218.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c74593218.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c74593218.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)>0 then
Duel.BreakEffect()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c26864586.lua | 3 | 1767 | --共振装置
function c26864586.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c26864586.target)
e1:SetOperation(c26864586.activate)
c:RegisterEffect(e1)
end
function c26864586.filter1(c,tp)
local lv=c:GetLevel()
return lv>0 and c:IsFaceup() and Duel.IsExistingTarget(c26864586.filter2,tp,LOCATION_MZONE,0,1,c,c:GetRace(),c:GetAttribute(),lv)
end
function c26864586.filter2(c,rc,at,lv)
return not c:IsLevel(lv) and c:IsLevelAbove(1) and c:IsFaceup() and c:IsRace(rc) and c:IsAttribute(at)
end
function c26864586.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c26864586.filter1,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g1=Duel.SelectTarget(tp,c26864586.filter1,tp,LOCATION_MZONE,0,1,1,nil,tp)
local tc1=g1:GetFirst()
e:SetLabelObject(tc1)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(26864586,0))
local g2=Duel.SelectTarget(tp,c26864586.filter2,tp,LOCATION_MZONE,0,1,1,tc1,tc1:GetRace(),tc1:GetAttribute(),tc1:GetLevel())
end
function c26864586.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc1=e:GetLabelObject()
local tc2=g:GetFirst()
if tc1==tc2 then tc2=g:GetNext() end
local lv=tc1:GetLevel()
if tc2:IsLevel(lv) then return end
if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(lv)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc2:RegisterEffect(e1)
end
end
| gpl-2.0 |
joenot443/crAIg | NEAT/util/deepFitnessCalculate.lua | 1 | 1743 | --Calculate fitness for each genome in the species
--Pick a candidate genome for each species
function deepFitnessCalculate(species)
print("Calculating fitness for species ",species.id)
for i=1,#species.genomes do
local genome = species.genomes[i]
synapses = genome.synapses;
print("\t\tGenome: ",genome.id)
genome.fitness = calculateFitness(genome)
firstRun = true;
print("\t\t\tFitness: ",genome.fitness)
end
--Set the representative for the species
setCandidate(species)
return
end
function calculateFitness(genome)
local lastX = 0;
local bestX = 0;
local running = true;
local framesSinceProgress = 0;
local tiles = initialState();
while (running) do
local outputs = chooseOutputs(genome.synapses, tiles)
local currentPosition = getMarioXPos();
time = getTime();
if currentPosition <= lastX then
framesSinceProgress = framesSinceProgress + 1;
else
framesSinceProgress = 0;
lastX = currentPosition;
end
if currentPosition > bestX then
bestX = currentPosition
end
if framesSinceProgress > 100 then
running = false;
end
tiles = runFrame(outputs, genome);
end
return fitness(bestX, time)
end
function fitness(xpos, time)
if xpos > 350 then
return xpos + 0.1*(400 - time);
else
return xpos
end
end
function getMarioXPos()
return memory.readbyte(0x6D) * 0x100 + memory.readbyte(0x86);
end
function getTime()
return memory.readbyte(0x07F8)*100 + memory.readbyte(0x07F9) * 10 + memory.readbyte(0x07F9);
end
function setCandidate(species)
-- Random selection
local selectedGenome = math.random(1,#species.genomes)
print("\tSelected genome ",species.genomes[selectedGenome].id," as candidate")
species.candidateGenome = species.genomes[selectedGenome]
end | mit |
mercury233/ygopro-scripts | c91027843.lua | 2 | 3038 | --海晶乙女の闘海
function c91027843.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x12b))
e2:SetValue(c91027843.atkval)
c:RegisterEffect(e2)
--immune
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(c91027843.immtg)
e3:SetValue(c91027843.efilter)
c:RegisterEffect(e3)
--equip
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(91027843,1))
e4:SetCategory(CATEGORY_EQUIP)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetRange(LOCATION_FZONE)
e4:SetCondition(c91027843.eqcon)
e4:SetTarget(c91027843.eqtg)
e4:SetOperation(c91027843.eqop)
c:RegisterEffect(e4)
end
function c91027843.atkval(e,c)
return 200+c:GetEquipGroup():FilterCount(Card.IsSetCard,nil,0x12b)*600
end
function c91027843.immtg(e,c)
return c:GetSequence()>4 and c:IsSummonType(SUMMON_TYPE_LINK) and c:GetFlagEffect(91027843)~=0
end
function c91027843.efilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer()
end
function c91027843.cfilter(c,tp)
return c:IsSummonPlayer(tp) and c:GetSequence()>4 and c:IsSetCard(0x12b) and c:IsType(TYPE_LINK) and c:IsSummonType(SUMMON_TYPE_LINK)
end
function c91027843.eqcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c91027843.cfilter,1,nil,tp)
end
function c91027843.eqfilter(c)
return c:IsSetCard(0x12b) and c:IsType(TYPE_LINK) and not c:IsForbidden()
end
function c91027843.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c91027843.eqfilter,tp,LOCATION_GRAVE,0,1,nil) end
eg:GetFirst():CreateEffectRelation(e)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
end
function c91027843.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=eg:GetFirst()
local ft=math.min((Duel.GetLocationCount(tp,LOCATION_SZONE)),3)
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c91027843.eqfilter),tp,LOCATION_GRAVE,0,nil)
if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) or ft<=0 or g:GetCount()<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,ft)
if sg and sg:GetCount()>0 then
local sc=sg:GetFirst()
while sc do
Duel.Equip(tp,sc,tc,false,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetLabelObject(tc)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(c91027843.eqlimit)
sc:RegisterEffect(e1)
sc=sg:GetNext()
end
Duel.EquipComplete()
end
end
function c91027843.eqlimit(e,c)
return e:GetLabelObject()==c
end
| gpl-2.0 |
noname007/koreader | frontend/apps/reader/modules/readergoto.lua | 4 | 2575 | local InputContainer = require("ui/widget/container/inputcontainer")
local InputDialog = require("ui/widget/inputdialog")
local UIManager = require("ui/uimanager")
local Screen = require("device").screen
local Event = require("ui/event")
local DEBUG = require("dbg")
local _ = require("gettext")
local ReaderGoto = InputContainer:new{
goto_menu_title = _("Go to"),
goto_dialog_title = _("Go to Page or Location"),
}
function ReaderGoto:init()
self.ui.menu:registerToMainMenu(self)
end
function ReaderGoto:addToMainMenu(tab_item_table)
-- insert goto command to main reader menu
table.insert(tab_item_table.navi, {
text = self.goto_menu_title,
callback = function()
self:onShowGotoDialog()
end,
})
end
function ReaderGoto:onShowGotoDialog()
DEBUG("show goto dialog")
self.goto_dialog = InputDialog:new{
title = self.goto_dialog_title,
input_hint = "(1 - "..self.document:getPageCount()..")",
buttons = {
{
{
text = _("Cancel"),
enabled = true,
callback = function()
self:close()
end,
},
{
text = _("Page"),
enabled = self.document.info.has_pages,
callback = function()
self:gotoPage()
end,
},
{
text = _("Location"),
enabled = not self.document.info.has_pages,
callback = function()
self:gotoPage()
end,
},
},
},
input_type = "number",
enter_callback = function() self:gotoPage() end,
width = Screen:getWidth() * 0.8,
height = Screen:getHeight() * 0.2,
}
self.goto_dialog:onShowKeyboard()
UIManager:show(self.goto_dialog)
end
function ReaderGoto:close()
self.goto_dialog:onClose()
UIManager:close(self.goto_dialog)
end
function ReaderGoto:gotoPage()
local page_number = self.goto_dialog:getInputText()
local relative_sign = page_number:sub(1, 1)
local number = tonumber(page_number)
if number then
if relative_sign == "+" or relative_sign == "-" then
self.ui:handleEvent(Event:new("GotoRelativePage", number))
else
self.ui:handleEvent(Event:new("GotoPage", number))
end
self:close()
end
end
return ReaderGoto
| agpl-3.0 |
Zenny89/darkstar | scripts/globals/spells/bluemagic/feather_storm.lua | 18 | 2042 | -----------------------------------------
-- Spell: Feather Storm
-- Additional effect: Poison. Chance of effect varies with TP
-- Spell cost: 12 MP
-- Monster Type: Beastmen
-- Spell Type: Physical (Piercing)
-- Blue Magic Points: 3
-- Stat Bonus: CHR+2, HP+5
-- Level: 12
-- Casting Time: 0.5 seconds
-- Recast Time: 10 seconds
-- Skillchain Element(s): Light (can open Compression, Reverberation, or Distortion; can close Transfixion)
-- Combos: Rapid Shot
-----------------------------------------
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_CRITICAL;
params.dmgtype = DMGTYPE_PIERCE;
params.scattr = SC_LIGHT;
params.numhits = 1;
params.multiplier = 1.25;
params.tp150 = 1.25;
params.tp300 = 1.25;
params.azuretp = 1.25;
params.duppercap = 12;
params.str_wsc = 0.0;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.30;
params.int_wsc = 0.0;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.0;
damage = BluePhysicalSpell(caster, target, spell, params);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
local chance = math.random();
if (damage > 0 and chance > 70) then
local typeEffect = EFFECT_POISON;
target:delStatusEffect(typeEffect);
target:addStatusEffect(typeEffect,3,0,getBlueEffectDuration(caster,resist,typeEffect));
end
return damage;
end; | gpl-3.0 |
linushsao/marsu_game-linus-v0.2 | mods/technical/pipeworks/routing_tubes.lua | 1 | 6937 |
-- the default tube and default textures
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment")
minetest.register_craft( {
output = "pipeworks:tube_1 6",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "", "", "" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
pipeworks.register_tube("pipeworks:broken_tube", {
description = "Broken Tube (you hacker you)",
plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
ends = { { name = "pipeworks_broken_tube_end.png", color = nodecolor } },
short = { name = "pipeworks_broken_tube_short.png", color = nodecolor },
node_def = {
drop = "pipeworks:tube_1",
groups = {not_in_creative_inventory = 1, tubedevice_receiver = 1},
tube = {
insert_object = function(pos, node, stack, direction)
minetest.item_drop(stack, nil, pos)
return ItemStack("")
end,
can_insert = function(pos,node,stack,direction)
return true
end,
priority = 50,
},
on_punch = function(pos, node, puncher, pointed_thing)
local itemstack = puncher:get_wielded_item()
local wieldname = itemstack:get_name()
local playername = puncher:get_player_name()
print("[Pipeworks] "..playername.." struck a broken tube at "..minetest.pos_to_string(pos))
if wieldname == "anvil:hammer"
or wieldname == "cottages:hammer"
or wieldname == "glooptest:hammer_steel"
or wieldname == "glooptest:hammer_bronze"
or wieldname == "glooptest:hammer_diamond"
or wieldname == "glooptest:hammer_mese"
or wieldname == "glooptest:hammer_alatro"
or wieldname == "glooptest:hammer_arol" then
local meta = minetest.get_meta(pos)
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
if was_node and was_node ~= "" then
print(" with "..wieldname.." to repair it.")
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
pipeworks.scan_for_tube_objects(pos)
itemstack:add_wear(1000)
puncher:set_wielded_item(itemstack)
return itemstack
else
print(" but it can't be repaired.")
end
else
print(" with "..wieldname.." but that tool is too weak.")
end
end
}
})
-- the high priority tube is a low-cpu replacement for sorting tubes in situations
-- where players would use them for simple routing (turning off paths)
-- without doing actual sorting, like at outputs of tubedevices that might both accept and eject items
if pipeworks.enable_priority_tube then
local color = "#ff3030:128"
local nodecolor = 0xffff3030
pipeworks.register_tube("pipeworks:priority_tube", {
description = "High Priority Tube Segment",
inventory_image = "pipeworks_tube_inv.png^[colorize:" .. color,
plain = { { name = "pipeworks_tube_plain.png", color = nodecolor } },
noctr = { { name = "pipeworks_tube_noctr.png", color = nodecolor } },
ends = { { name = "pipeworks_tube_end.png", color = nodecolor } },
short = { name = "pipeworks_tube_short.png", color = nodecolor },
node_def = {
tube = { priority = 150 } -- higher than tubedevices (100)
},
})
minetest.register_craft( {
output = "pipeworks:priority_tube_1 6",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:gold_ingot", "", "default:gold_ingot" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
end
if pipeworks.enable_accelerator_tube then
pipeworks.register_tube("pipeworks:accelerator_tube", {
description = "Accelerating Pneumatic Tube Segment",
inventory_image = "pipeworks_accelerator_tube_inv.png",
plain = { "pipeworks_accelerator_tube_plain.png" },
noctr = { "pipeworks_accelerator_tube_noctr.png" },
ends = { "pipeworks_accelerator_tube_end.png" },
short = "pipeworks_accelerator_tube_short.png",
node_def = {
tube = {can_go = function(pos, node, velocity, stack)
velocity.speed = velocity.speed+1
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
end}
},
})
minetest.register_craft( {
output = "pipeworks:accelerator_tube_1 2",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
end
if pipeworks.enable_crossing_tube then
pipeworks.register_tube("pipeworks:crossing_tube", {
description = "Crossing Pneumatic Tube Segment",
inventory_image = "pipeworks_crossing_tube_inv.png",
plain = { "pipeworks_crossing_tube_plain.png" },
noctr = { "pipeworks_crossing_tube_noctr.png" },
ends = { "pipeworks_crossing_tube_end.png" },
short = "pipeworks_crossing_tube_short.png",
node_def = {
tube = {can_go = function(pos, node, velocity, stack) return {velocity} end }
},
})
minetest.register_craft( {
output = "pipeworks:crossing_tube_1 5",
recipe = {
{ "", "pipeworks:tube_1", "" },
{ "pipeworks:tube_1", "pipeworks:tube_1", "pipeworks:tube_1" },
{ "", "pipeworks:tube_1", "" }
},
})
end
if pipeworks.enable_one_way_tube then
minetest.register_node("pipeworks:one_way_tube", {
description = "One way tube",
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {type = "fixed",
fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1},
sounds = default.node_sound_wood_defaults(),
tube = {
connect_sides = {left = 1, right = 1},
can_go = function(pos, node, velocity, stack)
return {velocity}
end,
can_insert = function(pos, node, stack, direction)
local dir = pipeworks.facedir_to_right_dir(node.param2)
return vector.equals(dir, direction)
end,
priority = 75 -- Higher than normal tubes, but lower than receivers
},
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
})
minetest.register_craft({
output = "pipeworks:one_way_tube 2",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "group:stick", "default:mese_crystal", "homedecor:plastic_sheeting" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
end
| gpl-3.0 |
dyhpoon/Attack-on-Pirates | AttackOnPirates/gameLogic/explosionEffect.lua | 1 | 4682 | module(..., package.seeall)
function new()
local group = display.newGroup()
local function drawExplosion(i, j, explosionType)
local xPosition = i*40-20
local yPosition = j*40+138
local explosionImage
if explosionType == "verticalTopEnd" then
explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
elseif explosionType == "verticalSegment" then
explosionImage = display.newImageRect("images/explodeSegment.png", 40, 40)
elseif explosionType == "verticalBottomEnd" then
explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
explosionImage.rotation = 180
explosionImage.xScale = -1
elseif explosionType == "horizontalLeftEnd" then
explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
explosionImage.rotation = -90
elseif explosionType == "horizontalSegment" then
explosionImage = display.newImageRect("images/explodeSegment.png", 40, 40)
explosionImage.rotation = -90
elseif explosionType == "horizontalRightEnd" then
explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
explosionImage.rotation = 90
explosionImage.xScale = -1
end
explosionImage.x = xPosition
explosionImage.y = yPosition
return explosionImage
end
local function drawVerticalExplosion(i)
local imageGroup = display.newGroup()
imageGroup:insert(drawExplosion(i,1, "verticalTopEnd"))
for j=2,7,1 do
imageGroup:insert(drawExplosion(i,j, "verticalSegment"))
end
imageGroup:insert(drawExplosion(i,8, "verticalBottomEnd"))
return imageGroup
end
local function drawHorizontalExplosion(j)
local imageGroup = display.newGroup()
imageGroup:insert(drawExplosion(1,j, "horizontalLeftEnd"))
for i=2,7,1 do
imageGroup:insert(drawExplosion(i,j, "horizontalSegment"))
end
imageGroup:insert(drawExplosion(8,j, "horizontalRightEnd"))
return imageGroup
end
local function drawCrossExplosioin(i,j)
imageGroup = display.newGroup()
local verticalImages = drawVerticalExplosion(i)
imageGroup:insert(verticalImages)
local horizontalImages = drawHorizontalExplosion(j)
imageGroup:insert(horizontalImages)
local centerImage = display.newImageRect("images/explodeCenter.png", 40, 40)
centerImage.x = i * 40 - 17.5
centerImage.y = j * 40 + 120
imageGroup:insert(centerImage)
return imageGroup
end
local function removeAllExplosionImages(images)
return function()
if images then
for i=images.numChildren, 1, -1 do
images[i]:removeSelf()
images[i] = nil
end
end
end
end
local function animateExplosion(images)
for i=1,images.numChildren-1,1 do
transition.to(images[i], {time=100, xScale=0.5})
transition.to(images[i], {time=100, delay=100, xScale=1})
transition.to(images[i], {time=100, delay=200, xScale=0.5})
transition.to(images[i], {time=100, delay=300, xScale=1})
transition.to(images[i], {time=100, delay=400, xScale=0.5})
transition.to(images[i], {time=100, delay=500, xScale=1})
end
transition.to(images[images.numChildren], {time=100, xScale=-0.5})
transition.to(images[images.numChildren], {time=100, delay=100, xScale=-1})
transition.to(images[images.numChildren], {time=100, delay=200, xScale=-0.5})
transition.to(images[images.numChildren], {time=100, delay=300, xScale=-1})
transition.to(images[images.numChildren], {time=100, delay=400, xScale=-0.5})
transition.to(images[images.numChildren], {time=100, delay=500, xScale=-1, onComplete=removeAllExplosionImages(images)})
end
--local temp = drawHorizontalExplosion(5)
--local temp1 = drawVerticalExplosion(5)
--animateExplosion(temp)
--animateExplosion(temp1)
function group:explosionAnimation(i,j,type)
local imageGroup = display.newGroup()
if type == "vertical" then
local images = drawVerticalExplosion(i)
imageGroup:insert(images)
elseif type == "horizontal" then
local images = drawHorizontalExplosion(j)
imageGroup:insert(images)
elseif type == "cross" then
local verticalImages = drawVerticalExplosion(i)
imageGroup:insert(verticalImages)
local horizontalImages = drawHorizontalExplosion(j)
imageGroup:insert(horizontalImages)
elseif type == "area" then
-- do something
local function destroy(target)
return function()
if target then
target:removeSelf()
target = nil
end
end
end
local xPosition = i*40-20
local yPosition = j*40+138
local areaImages = display.newImage("images/explosion2.png")
areaImages.x = xPosition
areaImages.y = yPosition
transition.to(areaImages, {time=500, xScale=4, yScale=4, onComplete=destroy(areaImages)})
imageGroup:insert(areaImages)
return imageGroup
end
for i=1, imageGroup.numChildren, 1 do
animateExplosion(imageGroup[i])
end
return imageGroup
end
return group
end
| apache-2.0 |
Zenny89/darkstar | scripts/zones/Chateau_dOraguille/npcs/_6h0.lua | 17 | 4498 | -----------------------------------
-- Area: Chateau d'Oraguille
-- Door: Prince Royal's
-- Finishes Quest: A Boy's Dream, Under Oath
-- Involved in Missions: 3-1, 5-2, 8-2
-- @pos -38 -3 73 233
-----------------------------------
package.loaded["scripts/zones/Chateau_dOraguille/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/globals/quests");
require("scripts/globals/titles");
require("scripts/zones/Chateau_dOraguille/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local currentMission = player:getCurrentMission(SANDORIA);
local MissionStatus = player:getVar("MissionStatus");
local infiltrateDavoi = player:hasCompletedMission(SANDORIA,INFILTRATE_DAVOI);
local Wait1DayRanperre = player:getVar("Wait1DayForRanperre_date");
local osdate = tonumber(os.date("%j"));
if (player:getVar("aBoysDreamCS") == 8) then
player:startEvent(0x0058);
elseif (player:getQuestStatus(SANDORIA,A_BOY_S_DREAM) == QUEST_COMPLETED and player:getQuestStatus(SANDORIA,UNDER_OATH) == QUEST_AVAILABLE and player:getMainJob() == 7) then
player:startEvent(0x005A);
elseif (player:getVar("UnderOathCS") == 8) then
player:startEvent(0x0059);
elseif (currentMission == INFILTRATE_DAVOI and infiltrateDavoi == false and MissionStatus == 0) then
player:startEvent(0x0229,0,ROYAL_KNIGHTS_DAVOI_REPORT);
elseif (currentMission == INFILTRATE_DAVOI and MissionStatus == 4) then
player:startEvent(0x022a,0,ROYAL_KNIGHTS_DAVOI_REPORT);
elseif (currentMission == THE_SHADOW_LORD and MissionStatus == 1) then
player:startEvent(0x0223);
elseif (currentMission == RANPERRE_S_FINAL_REST and MissionStatus == 0) then
player:startEvent(0x0051);
elseif (CurrentMission == RANPERRE_S_FINAL_REST and MissionStatus == 4 and Wait1DayRanperre ~= osdate) then -- Ready now.
player:startEvent(0x0015);
elseif (currentMission == RANPERRE_S_FINAL_REST and MissionStatus == 7) then
player:startEvent(0x0015);
elseif (player:hasCompletedMission(SANDORIA,LIGHTBRINGER) and player:getRank() == 9 and player:getVar("Cutscenes_8-2") == 0) then
player:startEvent(0x003F);
else
player:startEvent(0x020a);
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 == 0x0229) then
player:setVar("MissionStatus",2);
elseif (csid == 0x0223) then
player:setVar("MissionStatus",2);
elseif (csid == 0x022a) then
finishMissionTimeline(player,3,csid,option);
elseif (csid == 0x0058) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,14095);
else
if (player:getMainJob() == 7) then
player:addQuest(SANDORIA,UNDER_OATH);
end
player:delKeyItem(KNIGHTS_BOOTS);
player:addItem(14095);
player:messageSpecial(ITEM_OBTAINED,14095); -- Gallant Leggings
player:setVar("aBoysDreamCS",0);
player:addFame(SANDORIA,AF2_FAME*SAN_FAME);
player:completeQuest(SANDORIA,A_BOY_S_DREAM);
end
elseif (csid == 0x005A and option ==1) then
player:addQuest(SANDORIA,UNDER_OATH);
player:setVar("UnderOathCS",0);
elseif (csid == 0x0059) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,12644);
else
player:addItem(12644);
player:messageSpecial(ITEM_OBTAINED,12644); -- Gallant Surcoat
player:setVar("UnderOathCS",9);
player:addFame(SANDORIA,AF3_FAME*SAN_FAME);
player:setTitle(PARAGON_OF_PALADIN_EXCELLENCE);
player:completeQuest(SANDORIA,UNDER_OATH);
end
elseif (csid == 0x0051) then
player:setVar("MissionStatus",1);
elseif (csid == 0x0015) then
player:setVar("Wait1DayForRanperre_date",0);
player:setVar("MissionStatus",8);
elseif (csid == 0x003F) then
player:setVar("Cutscenes_8-2",1)
end
end;
| gpl-3.0 |
notcake/gcompute | lua/gcompute/languages/expression2_postparser.lua | 1 | 1275 | local self = {}
Pass = GCompute.MakeConstructor (self, GCompute.ASTVisitor)
--[[
Language: Expression 2
Purpose:
1. Replaces the Expression 2 bitwise and boolean binary operators with the appropriate
GCompute operators
2. Converts the 2nd argument of indexing expressions to a type argument
]]
function self:ctor (compilationUnit)
self.CompilationUnit = compilationUnit
end
local binaryOperatorMap =
{
["&" ] = "&&",
["|" ] = "||",
["&&"] = "&",
["||"] = "|"
}
function self:VisitExpression (expression)
if expression:Is ("ArrayIndex") then
local argumentList = expression:GetArgumentList ()
if argumentList:GetArgumentCount () == 2 then
local typeArgumentList = GCompute.AST.TypeArgumentList ()
local argument = argumentList:GetArgument (2)
typeArgumentList:SetStartToken (argument:GetStartToken ())
typeArgumentList:SetEndToken (argument:GetEndToken ())
typeArgumentList:AddArgument (argument:ToTypeNode ())
argumentList:RemoveArgument (2)
expression:SetTypeArgumentList (typeArgumentList)
end
elseif expression:Is ("BinaryOperator") then
if binaryOperatorMap [expression:GetOperator ()] then
expression:SetOperator (binaryOperatorMap [expression:GetOperator ()])
end
end
end | gpl-3.0 |
mercury233/ygopro-scripts | c43785278.lua | 2 | 1726 | --フーコーの魔砲石
function c43785278.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c,false)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(1160)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c43785278.reg)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(43785278,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_PZONE)
e2:SetCondition(c43785278.descon)
e2:SetTarget(c43785278.destg)
e2:SetOperation(c43785278.desop)
c:RegisterEffect(e2)
end
function c43785278.reg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:GetHandler():RegisterFlagEffect(43785278,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c43785278.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(43785278)~=0
end
function c43785278.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c43785278.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c43785278.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c43785278.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c43785278.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c43785278.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
nem0/LumixEngine | data/pipelines/film_grain.lua | 1 | 1182 | grainamount = 0.01
lumamount = 0.1
noise = -1
Editor.setPropertyType(this, "noise", Editor.RESOURCE_PROPERTY, "texture")
function postprocess(env, transparent_phase, ldr_buffer, gbuffer0, gbuffer1, gbuffer2, gbuffer_depth, shadowmap)
if not enabled then return ldr_buffer end
if transparent_phase ~= "post_tonemap" then return ldr_buffer end
if noise == -1 then return ldr_buffer end
env.film_grain_rb_desc = env.film_grain_rb_desc or env.createRenderbufferDesc { rel_size = {1, 1}, format = "rgba8", debug_name = "film_grain" }
local res = env.createRenderbuffer(env.film_grain_rb_desc)
env.beginBlock("film_grain")
if env.film_grain_shader == nil then
env.film_grain_shader = env.preloadShader("pipelines/film_grain.shd")
end
env.drawcallUniforms(grainamount, lumamount)
env.setRenderTargets(res)
env.bindTextures({noise}, 1)
env.drawArray(0, 3, env.film_grain_shader,
{ ldr_buffer },
env.empty_state
)
env.endBlock()
return res
end
function awake()
_G["postprocesses"] = _G["postprocesses"] or {}
_G["postprocesses"]["filmgrain"] = postprocess
end
function onDestroy()
_G["postprocesses"]["filmgrain"] = nil
end
function onUnload()
onDestroy()
end
| mit |
Zenny89/darkstar | scripts/zones/West_Sarutabaruta/npcs/Stone_Monument.lua | 32 | 1299 | -----------------------------------
-- Area: West Sarutabaruta
-- NPC: Stone Monument
-- Involved in quest "An Explorer's Footsteps"
-- @pos -205.593 -23.210 -119.670 115
-----------------------------------
package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/West_Sarutabaruta/TextIDs");
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0384);
end;
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
if (trade:getItemCount() == 1 and trade:hasItemQty(571,1)) then
player:tradeComplete();
player:addItem(570);
player:messageSpecial(ITEM_OBTAINED,570);
player:setVar("anExplorer-CurrentTablet",0x00400);
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 |
mercury233/ygopro-scripts | c61525276.lua | 2 | 3043 | --呪われし竜-カース・オブ・ドラゴン
function c61525276.initial_effect(c)
aux.AddCodeList(c,66889139)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(61525276,0))
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,61525276)
e1:SetTarget(c61525276.thtg)
e1:SetOperation(c61525276.thop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--disable
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(61525276,1))
e3:SetCategory(CATEGORY_DISABLE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,61525277)
e3:SetTarget(c61525276.distg)
e3:SetOperation(c61525276.disop)
c:RegisterEffect(e3)
end
function c61525276.thfilter(c)
return aux.IsCodeListed(c,66889139) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c61525276.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c61525276.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c61525276.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c61525276.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c61525276.cfilter(c,tp)
return c:IsFaceup() and c:IsCode(66889139) and Duel.IsExistingMatchingCard(c61525276.disfilter,tp,0,LOCATION_MZONE,1,nil,c:GetAttack())
end
function c61525276.disfilter(c,atk)
return aux.NegateMonsterFilter(c) and c:IsAttackBelow(atk)
end
function c61525276.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c61525276.cfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(c61525276.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c61525276.cfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
end
function c61525276.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local atk=tc:GetAttack()
local g=Duel.GetMatchingGroup(c61525276.disfilter,tp,0,LOCATION_MZONE,nil,atk)
local tc=g:GetFirst()
while tc do
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/spells/valor_minuet_iv.lua | 18 | 1537 | -----------------------------------------
-- Spell: Valor Minuet IV
-- Grants Attack bonus to all allies.
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing
local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED);
local power = 31;
if (sLvl+iLvl > 300) then
power = power + math.floor((sLvl+iLvl-300) / 6);
end
if (power >= 56) then
power = 56;
end
local iBoost = caster:getMod(MOD_MINUET_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
if (iBoost > 0) then
power = power + 1 + (iBoost-1)*4;
end
power = power + caster:getMerit(MERIT_MINUET_EFFECT);
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
caster:delStatusEffect(EFFECT_MARCATO);
local duration = 120;
duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
if not (target:addBardSong(caster,EFFECT_MINUET,power,0,duration,caster:getID(), 0, 4)) then
spell:setMsg(75);
end
return EFFECT_MINUET;
end; | gpl-3.0 |
Zenny89/darkstar | scripts/zones/Southern_San_dOria_[S]/npcs/Geltpix.lua | 36 | 1165 | -----------------------------------
-- Area: Southern SandOria [S]
-- NPC: Geltpix
-- @zone 80
-- @pos 154 -2 103
-----------------------------------
package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil;
require("scripts/zones/Southern_San_dOria_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc, 7043); -- Don't hurt poor Geltpix! Geltpix's just a merchant from Boodlix's Emporium in Jeuno. Kingdom vendors don't like gil, but Boodlix knows true value of new money.
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 |
Zenny89/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Animated_Kunai.lua | 16 | 1477 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Animated Kunai
-----------------------------------
require("scripts/globals/status");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
if (mob:AnimationSub() == 3) then
SetDropRate(109,1579,1000);
else
SetDropRate(109,1579,0);
end
target:showText(mob,ANIMATED_KUNAI_DIALOG);
SpawnMob(17330442,120):updateEnmity(target);
SpawnMob(17330443,120):updateEnmity(target);
SpawnMob(17330444,120):updateEnmity(target);
SpawnMob(17330454,120):updateEnmity(target);
SpawnMob(17330455,120):updateEnmity(target);
SpawnMob(17330456,120):updateEnmity(target);
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
-- TODO: add battle dialog
end;
-----------------------------------
-- onMobDisengage
-----------------------------------
function onMobDisengage(mob)
mob:showText(mob,ANIMATED_KUNAI_DIALOG+2);
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
killer:showText(mob,ANIMATED_KUNAI_DIALOG+1);
DespawnMob(17330442);
DespawnMob(17330443);
DespawnMob(17330444);
DespawnMob(17330454);
DespawnMob(17330455);
DespawnMob(17330456);
end; | gpl-3.0 |
mercury233/ygopro-scripts | c96433300.lua | 2 | 3748 | --溟界の虚
function c96433300.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(96433300,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetRange(LOCATION_SZONE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetHintTiming(0,TIMING_MAIN_END)
e2:SetCountLimit(1,96433300)
e2:SetCondition(c96433300.spcon)
e2:SetCost(c96433300.spcost)
e2:SetTarget(c96433300.sptg)
e2:SetOperation(c96433300.spop)
c:RegisterEffect(e2)
--to grave
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(96433300,1))
e3:SetCategory(CATEGORY_TOGRAVE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c96433300.tgcon)
e3:SetTarget(c96433300.tgtg)
e3:SetOperation(c96433300.tgop)
c:RegisterEffect(e3)
end
function c96433300.spcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function c96433300.rfilter(c,tp)
return c:IsRace(RACE_REPTILE) and c:IsType(TYPE_EFFECT)
and (c:IsControler(tp) or c:IsFaceup()) and Duel.GetMZoneCount(tp,c)>0
end
function c96433300.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c96433300.rfilter,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectReleaseGroup(tp,c96433300.rfilter,1,1,nil,tp)
Duel.Release(g,REASON_COST)
end
function c96433300.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c96433300.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and c96433300.spfilter(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c96433300.spfilter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c96433300.spfilter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c96433300.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local fid=e:GetHandler():GetFieldID()
tc:RegisterFlagEffect(96433300,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(c96433300.tgcon1)
e1:SetOperation(c96433300.tgop1)
Duel.RegisterEffect(e1,tp)
end
end
function c96433300.tgcon1(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(96433300)~=e:GetLabel() then
e:Reset()
return false
else return true end
end
function c96433300.tgop1(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetLabelObject(),REASON_EFFECT)
end
function c96433300.tgcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousSequence()<5
end
function c96433300.cfilter(c)
return not c:IsRace(RACE_REPTILE) and c:IsFaceup() and c:IsAbleToGrave()
end
function c96433300.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c96433300.cfilter,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0)
end
function c96433300.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c96433300.cfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
| gpl-2.0 |
Shockah/IB-Raid-Loot | Messages/LootAssignedMessage.lua | 1 | 1345 | --[[
LootAssignedMessage
(master -> raiders)
Properties:
* loot: table -- Loot instance
* roll: table -- Roll instance
]]
local selfAddonName = "Linnet"
local Addon = _G[selfAddonName]
local S = LibStub:GetLibrary("ShockahUtils")
local prototype = {}
local selfMessageType = "LootAssigned"
Addon[selfMessageType.."Message"] = {}
local Class = Addon[selfMessageType.."Message"]
Addon.Comm.handlers[selfMessageType] = Class
function Class:New(loot, roll)
local obj = S:Clone(prototype)
obj.loot = loot
obj.roll = roll
return obj
end
function prototype:Send()
if not Addon:IsMasterLooter() then
return
end
Addon.Comm:SendCompressedCommMessage(selfMessageType, {
lootID = self.loot.lootID,
player = self.roll and self.roll.player or nil,
}, "RAID")
end
function Class:Handle(message, distribution, sender)
if Addon:IsMasterLooter() then
return
end
local loot = Addon.lootHistory:Get(message.lootID)
if not loot then
return
end
local roll = nil
local player = message.player
if player then
player = S:GetPlayerNameWithRealm(player)
roll = loot:GetRollForPlayer(player)
end
if roll then
roll.assigned = true
table.insert(loot.assigned, {
timer = nil,
roll = roll,
})
else
table.insert(loot.assigned, {})
end
if Addon.PendingFrame.frame then
Addon.PendingFrame.frame:Update()
end
end | apache-2.0 |
Zenny89/darkstar | scripts/globals/spells/bluemagic/saline_coat.lua | 18 | 1375 | -----------------------------------------
-- Spell: Saline Coat
-- Enhances magic defense
-- Spell cost: 66 MP
-- Monster Type: Luminians
-- Spell Type: Magical (Light)
-- Blue Magic Points: 3
-- Stat Bonus: VIT+2, AGI+2, MP+10
-- Level: 72
-- Casting Time: 3 seconds
-- Recast Time: 60 seconds
-- Duration: 60 seconds
--
-- Combos: Defense Bonus
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local typeEffect = EFFECT_MAGIC_DEF_BOOST;
local power = 40;
local duration = 60;
if (caster:hasStatusEffect(EFFECT_DIFFUSION)) then
local diffMerit = caster:getMerit(MERIT_DIFFUSION);
if (diffMerit > 0) then
duration = duration + (duration/100)* diffMerit;
end;
caster:delStatusEffect(EFFECT_DIFFUSION);
end;
if (target:addStatusEffect(typeEffect,power,0,duration) == false) then
spell:setMsg(75);
end;
return typeEffect;
end; | gpl-3.0 |
mrallc/retro | vm/partial/retro.lua | 2 | 8657 | -- Ngaro VM for Lua 5.2 and Lua-JIT
-- Copyright (c) 2010 - 2011, Charles Childers
-- ----------------------------------------------------------------------------
-- Comment this out if using Lua 5.2:
local bit32 = require("bit")
-- ----------------------------------------------------------------------------
-- Variables
ip = 0 -- instruction pointer
sp = 0 -- stack pointer
rp = 0 -- return pointer
stack = {} -- data stack
address = {} -- return stack
memory = {} -- simulated ram
ports = {} -- io ports
fstack = {} -- track open files
fnext = 0 -- file index
i = 0 -- generic loop index
-- ----------------------------------------------------------------------------
-- Support Code
function rxGetFileSize(filename)
fh = assert(io.open(filename, "rb"))
len = assert(fh:seek("end"))
fh:close()
return len
end
function rxDecode(b1, b2, b3, b4)
if not b4 then error("need four bytes to convert to int",2) end
local n = b1 + b2*256 + b3*65536 + b4*16777216
return rxAdjust(n)
end
function rxAdjust(n)
return (n > 2147483647) and (n - 4294967296) or n
end
function rxWriteByte(s)
if s == 0 then
image:write('\0');
else
image:write(string.format("%c", s))
end
end
function rxSaveImage()
image = io.open('retroImage', 'wb')
i = 0
while i < memory[3] do
rxWriteByte(math.floor(memory[i] % 256))
rxWriteByte(math.floor(memory[i] / 256))
rxWriteByte(math.floor(memory[i] / (256 * 256)))
rxWriteByte(math.floor(memory[i] / (256 * 256 * 256)))
i = i + 1
end
image:close()
end
function rxGetString()
s = ""
a = stack[sp]
sp = sp - 1
while true do
s = s .. string.char(memory[a])
a = a + 1
if memory[a] == 0 then break end
end
return s
end
-- ----------------------------------------------------------------------------
-- simulated device handlers
function rxHandleConsoleDevice()
if ports[1] == 1 then
ports[1] = string.byte(io.read(1))
if ports[1] == 13 then ports[1] = 10 end
end
if ports[2] == 1 then
if stack[sp] < 0 then
io.write(string.char(27) .. "[2J" .. string.char(27) .. "[1;1H")
elseif stack[sp] > 0 and stack[sp] < 128 then
io.write(string.char(stack[sp]))
end
sp = sp - 1
ports[2] = 0
end
end
function rxHandleFileDevice()
if ports[4] == 1 then
rxSaveImage()
ports[4] = 0
end
if ports[4] == -1 then
ports[4] = 0
mode = stack[sp]
sp = sp - 1
name = rxGetString()
if mode == 0 then
fstack[fnext] = assert(io.open(name, "r"))
ports[4] = fnext * -1
fnext = fnext + 1
end
if mode == 1 then
fstack[fnext] = assert(io.open(name, "w"))
ports[4] = fnext * -1
fnext = fnext + 1
end
if mode == 2 then
fstack[fnext] = assert(io.open(name, "a"))
ports[4] = fnext * -1
fnext = fnext + 1
end
end
end
function rxHandleQueryDevice()
if ports[5] == -1 then -- image size
ports[5] = 1000000
end
if ports[5] == -2 then -- canvas exists?
ports[5] = 0
end
if ports[5] == -3 then -- console width
ports[5] = 0
end
if ports[5] == -4 then -- console height
ports[5] = 0
end
if ports[5] == -5 then -- stack depth
ports[5] = sp
end
if ports[5] == -6 then -- address stack depth
ports[5] = rp
end
if ports[5] == -7 then -- mouse exists?
ports[5] = 0
end
if ports[5] == -8 then -- time
ports[5] = os.time()
end
if ports[5] == -9 then -- shutdown vm
ip = 1000000
ports[5] = 0
end
end
function rxHandleDevices()
if ports[0] == 1 then return end
if ports[0] == 0 then
ports[0] = 1
rxHandleConsoleDevice()
rxHandleFileDevice()
rxHandleQueryDevice()
end
end
-- ----------------------------------------------------------------------------
-- process opcodes
function rxProcessOpcode()
local a = 0
local b = 0
local c = 0
local d = 0
local opcode = memory[ip]
if opcode == 0 then -- nop
elseif opcode == 1 then -- lit
sp = sp + 1
ip = ip + 1
stack[sp] = memory[ip]
elseif opcode == 2 then -- dup
sp = sp + 1
stack[sp] = stack[sp - 1]
elseif opcode == 3 then -- drop
sp = sp - 1
elseif opcode == 4 then -- swap
a = stack[sp]
stack[sp] = stack[sp - 1]
stack[sp - 1] = a
elseif opcode == 5 then -- push
rp = rp + 1
address[rp] = stack[sp]
sp = sp - 1
elseif opcode == 6 then -- pop
sp = sp + 1
stack[sp] = address[rp]
rp = rp - 1
elseif opcode == 7 then -- loop
stack[sp] = stack[sp] - 1
if stack[sp] ~= 0 and stack[sp] > -1 then
ip = ip + 1
ip = memory[ip] - 1
else
ip = ip + 1
sp = sp - 1
end
elseif opcode == 8 then -- jump
ip = ip + 1
ip = memory[ip] - 1
if memory[ip + 1] == 0 then ip = ip + 1 end
if memory[ip + 1] == 0 then ip = ip + 1 end
elseif opcode == 9 then -- return
ip = address[rp]
rp = rp - 1
elseif opcode == 10 then -- > jump
ip = ip + 1
if stack[sp - 1] > stack[sp] then ip = memory[ip] - 1 end
sp = sp - 2
elseif opcode == 11 then -- < jump
ip = ip + 1
if stack[sp - 1] < stack[sp] then ip = memory[ip] - 1 end
sp = sp - 2
elseif opcode == 12 then -- != jump
ip = ip + 1
if stack[sp - 1] ~= stack[sp] then ip = memory[ip] - 1 end
sp = sp - 2
elseif opcode == 13 then -- == jump
ip = ip + 1
if stack[sp - 1] == stack[sp] then ip = memory[ip] - 1 end
sp = sp - 2
elseif opcode == 14 then -- @
stack[sp] = memory[stack[sp]]
elseif opcode == 15 then -- !
memory[stack[sp]] = stack[sp - 1]
sp = sp - 2
elseif opcode == 16 then -- +
stack[sp - 1] = stack[sp] + stack[sp - 1]
sp = sp - 1
elseif opcode == 17 then -- -
stack[sp - 1] = stack[sp - 1] - stack[sp]
sp = sp - 1
elseif opcode == 18 then -- *
stack[sp - 1] = stack[sp - 1] * stack[sp]
sp = sp - 1
elseif opcode == 19 then -- /mod
b = stack[sp]
a = stack[sp - 1]
x = math.abs(b)
y = math.abs(a)
q = rxAdjust(math.floor(y / x))
r = rxAdjust(y % x)
if a < 0 and b < 0 then
r = r * -1
elseif a > 0 and b < 0 then
q = q * -1
elseif a < 0 and b > 0 then
r = r * -1
q = q * -1
end
stack[sp] = q
stack[sp - 1] = r
elseif opcode == 20 then -- and
stack[sp - 1] = rxAdjust(bit32.band(stack[sp - 1], stack[sp]))
sp = sp - 1
elseif opcode == 21 then -- or
stack[sp - 1] = rxAdjust(bit32.bor(stack[sp - 1], stack[sp]))
sp = sp - 1
elseif opcode == 22 then -- xor
stack[sp - 1] = rxAdjust(bit32.bxor(stack[sp - 1], stack[sp]))
sp = sp - 1
elseif opcode == 23 then -- <<
stack[sp - 1] = rxAdjust(bit32.lshift(stack[sp - 1], stack[sp]))
sp = sp - 1
elseif opcode == 24 then -- >>
stack[sp - 1] = rxAdjust(bit32.rshift(stack[sp - 1], stack[sp]))
sp = sp - 1
elseif opcode == 25 then -- 0;
if stack[sp] == 0 then
sp = sp - 1
ip = address[rp]
rp = rp - 1
end
elseif opcode == 26 then -- inc
stack[sp] = stack[sp] + 1
elseif opcode == 27 then -- dec
stack[sp] = stack[sp] - 1
elseif opcode == 28 then -- in
stack[sp] = ports[stack[sp]]
elseif opcode == 29 then -- out
ports[stack[sp]] = stack[sp - 1]
sp = sp - 2
elseif opcode == 30 then -- wait
rxHandleDevices()
else -- call (implicit)
rp = rp + 1
address[rp] = ip
ip = memory[ip] - 1
if memory[ip + 1] == 0 then ip = ip + 1 end
if memory[ip + 1] == 0 then ip = ip + 1 end
end
end
-- ----------------------------------------------------------------------------
-- Load retroImage into memory
-- \ cells = size of image file (in cells)
-- \ image = pointer to retroImage file
function rxLoadImage(file)
cells = rxGetFileSize(file) / 4
image = io.open(file, 'rb')
while i < cells do
memory[i] = rxDecode(image:read(4):byte(1,4))
i = i + 1
end
image:close()
while i < 1000000 do
memory[i] = 0
i = i + 1
end
i = 0
while i < 12 do
stack[i] = 0
address[i] = 0
ports[i] = 0
i = i + 1
end
while i < 128 do
stack[i] = 0
address[i] = 0
i = i + 1
end
while i < 1024 do
address[i] = 0
i = i + 1
end
ports[0] = 1
end
-- ----------------------------------------------------------------------------
-- Process the image
rxLoadImage("retroImage")
while ip < 1000000 do
rxProcessOpcode()
ip = ip + 1
end
| isc |
Zenny89/darkstar | scripts/zones/The_Garden_of_RuHmet/mobs/Jailer_of_Faith.lua | 24 | 1296 | -----------------------------------
-- Area: The Garden of Ru'Hmet
-- NPC: Jailer_of_Faith
-----------------------------------
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
-- Give it two hour
mob:setMod(MOBMOD_MAIN_2HOUR, 1);
-- Change animation to open
mob:AnimationSub(2);
end;
-----------------------------------
-- onMobFight Action
-- Randomly change forms
-----------------------------------
function onMobFight(mob)
-- Forms: 0 = Closed 1 = Closed 2 = Open 3 = Closed
local randomTime = math.random(45,180);
local changeTime = mob:getLocalVar("changeTime");
if (mob:getBattleTime() - changeTime > randomTime) then
-- Change close to open.
if (mob:AnimationSub() == 1) then
mob:AnimationSub(2);
else -- Change from open to close
mob:AnimationSub(1);
end
mob:setLocalVar("changeTime", mob:getBattleTime());
end
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, killer, npc)
local qm3 = GetNPCByID(Jailer_of_Faith_QM);
qm3:hideNPC(900);
local qm3position = math.random(1,5);
qm3:setPos(Jailer_of_Faith_QM_POS[qm3position][1], Jailer_of_Faith_QM_POS[qm3position][2], Jailer_of_Faith_QM_POS[qm3position][3]);
end; | gpl-3.0 |
mercury233/ygopro-scripts | c4357063.lua | 2 | 1813 | --先史遺産都市バビロン
function c4357063.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(4357063,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1)
e2:SetTarget(c4357063.sptg)
e2:SetOperation(c4357063.spop)
c:RegisterEffect(e2)
end
function c4357063.costfilter(c,e,tp)
return c:IsSetCard(0x70) and c:IsAbleToRemoveAsCost() and c:GetLevel()>0
and Duel.IsExistingTarget(c4357063.spfilter,tp,LOCATION_GRAVE,0,1,c,e,tp,c:GetLevel())
end
function c4357063.spfilter(c,e,tp,lv)
return c:IsSetCard(0x70) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c4357063.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c4357063.spfilter(chkc,e,tp,e:GetLabel()) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c4357063.costfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c4357063.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
local lv=g:GetFirst():GetLevel()
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(lv)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c4357063.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,lv)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c4357063.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c29590905.lua | 2 | 1448 | --スーパージュニア対決!
function c29590905.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c29590905.condition)
e1:SetTarget(c29590905.target)
e1:SetOperation(c29590905.activate)
c:RegisterEffect(e1)
end
function c29590905.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():IsControler(1-tp)
end
function c29590905.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsPosition,tp,LOCATION_MZONE,0,1,nil,POS_FACEUP_DEFENSE) end
end
function c29590905.activate(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(Card.IsPosition,tp,0,LOCATION_MZONE,nil,POS_FACEUP_ATTACK)
local g2=Duel.GetMatchingGroup(Card.IsPosition,tp,LOCATION_MZONE,0,nil,POS_FACEUP_DEFENSE)
if g1:GetCount()==0 or g2:GetCount()==0 then return end
local ga=g1:GetMinGroup(Card.GetAttack)
local gd=g2:GetMinGroup(Card.GetDefense)
if ga:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(29590905,0))
ga=ga:Select(tp,1,1,nil)
end
if gd:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(29590905,1))
gd=gd:Select(tp,1,1,nil)
end
Duel.NegateAttack()
local a=ga:GetFirst()
local d=gd:GetFirst()
if a:IsAttackable() and not a:IsImmuneToEffect(e) and not d:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,d)
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c40164421.lua | 9 | 2902 | --ライトロード・メイデン ミネルバ
function c40164421.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(40164421,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c40164421.thtg)
e1:SetOperation(c40164421.thop)
c:RegisterEffect(e1)
--discard deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(40164421,1))
e2:SetCategory(CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c40164421.discon)
e2:SetTarget(c40164421.distg)
e2:SetOperation(c40164421.disop)
c:RegisterEffect(e2)
--discard deck2
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(40164421,2))
e3:SetCategory(CATEGORY_DECKDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c40164421.discon2)
e3:SetTarget(c40164421.distg2)
e3:SetOperation(c40164421.disop2)
c:RegisterEffect(e3)
end
function c40164421.cfilter(c)
return c:IsSetCard(0x38) and c:IsType(TYPE_MONSTER)
end
function c40164421.thfilter(c,lv)
return c:IsLevelBelow(lv) and c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand()
end
function c40164421.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(c40164421.cfilter,tp,LOCATION_GRAVE,0,nil)
local ct=g:GetClassCount(Card.GetCode)
return Duel.IsExistingMatchingCard(c40164421.thfilter,tp,LOCATION_DECK,0,1,nil,ct)
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c40164421.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c40164421.cfilter,tp,LOCATION_GRAVE,0,nil)
local ct=g:GetClassCount(Card.GetCode)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=Duel.SelectMatchingCard(tp,c40164421.thfilter,tp,LOCATION_DECK,0,1,1,nil,ct)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function c40164421.discon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_DECK+LOCATION_HAND)
end
function c40164421.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1)
end
function c40164421.disop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.DiscardDeck(p,d,REASON_EFFECT)
end
function c40164421.discon2(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function c40164421.distg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2)
end
function c40164421.disop2(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(tp,2,REASON_EFFECT)
end
| gpl-2.0 |
Cavitt/vanilla-ot | data/npc/REFERENCETHESE/Shiantis.lua | 2 | 2599 | 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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'birdcage kit'}, 3918, 50, 1,'birdcage kit')
shopModule:addBuyableItem({'chimney kit'}, 8692, 200, 1,'chimney kit')
shopModule:addBuyableItem({'coal basin kit'}, 3908, 25, 1,'coal basin kit')
shopModule:addBuyableItem({'cuckoo clock kit'}, 7961, 40, 1,'cuckoo clock kit')
shopModule:addBuyableItem({'globe kit'}, 3927, 50, 1,'globe kit')
shopModule:addBuyableItem({'Goldfish Bowl'}, 5929, 50, 1,'Goldfish Bowl')
shopModule:addBuyableItem({'pendulum clock kit'}, 3933, 75, 1,'pendulum clock kit')
shopModule:addBuyableItem({'picture'}, 1854, 50, 1,'picture')
shopModule:addBuyableItem({'picture'}, 1852, 50, 1,'picture')
shopModule:addBuyableItem({'picture'}, 1853, 50, 1,'picture')
shopModule:addBuyableItem({'table lamp kit'}, 3937, 35, 1,'table lamp kit')
shopModule:addBuyableItem({'telescope kit'}, 7962, 70, 1,'telescope kit')
shopModule:addBuyableItem({'oval mirror'}, 1851, 40, 1,'oval mirror')
shopModule:addBuyableItem({'round mirror'}, 1845, 40, 1,'round mirror')
shopModule:addBuyableItem({'edged mirror'}, 1848, 50, 1,'edged mirror')
shopModule:addBuyableItem({'water pipe'}, 2099, 40, 1,'water pipe')
shopModule:addBuyableItem({'present'}, 1990, 10, 1,'present')
shopModule:addBuyableItem({'red backpack'}, 2000, 20, 1,'red backpack')
shopModule:addBuyableItem({'red bag'}, 1993, 5, 1,'red bag')
shopModule:addBuyableItem({'book'}, 1955, 15, 1,'book')
shopModule:addBuyableItem({'book'}, 1958, 15, 1,'book')
shopModule:addBuyableItem({'book'}, 1950, 15, 1,'book')
shopModule:addBuyableItem({'candelabrum'}, 2041, 8, 1,'candelabrum')
shopModule:addBuyableItem({'football'}, 2109, 111, 1,'football')
shopModule:addBuyableItem({'candlestick'}, 2047, 2, 1,'candlestick')
shopModule:addBuyableItem({'document'}, 1952, 12, 1,'document')
shopModule:addBuyableItem({'parchment'}, 1948, 8, 1,'parchment')
shopModule:addBuyableItem({'scroll'}, 1949, 5, 1,'scroll')
shopModule:addBuyableItem({'torch'}, 2050, 2, 1,'torch')
shopModule:addBuyableItem({'watch'}, 2036, 20, 1,'watch')
shopModule:addBuyableItem({'vial of oil'}, 2006, 15, 11, 'vial of oil')
npcHandler:addModule(FocusModule:new()) | agpl-3.0 |
mercury233/ygopro-scripts | c82016179.lua | 2 | 1432 | --森羅の施し
function c82016179.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,82016179+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c82016179.target)
e1:SetOperation(c82016179.activate)
c:RegisterEffect(e1)
end
function c82016179.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,3) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(3)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,2)
end
function c82016179.activate(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)==3 then
Duel.ShuffleHand(p)
Duel.BreakEffect()
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil)
if g:GetCount()>1 and g:IsExists(Card.IsSetCard,1,nil,0x90) then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg1=g:FilterSelect(p,Card.IsSetCard,1,1,nil,0x90)
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK)
local sg2=g:Select(p,1,1,sg1:GetFirst())
sg1:Merge(sg2)
Duel.ConfirmCards(1-p,sg1)
aux.PlaceCardsOnDeckTop(p,sg1)
else
local hg=Duel.GetFieldGroup(p,LOCATION_HAND,0)
Duel.ConfirmCards(1-p,hg)
aux.PlaceCardsOnDeckTop(p,hg)
end
end
end
| gpl-2.0 |
valhallaGaming/uno | branches/2_0_3_STABLE/global/chat_globals.lua | 1 | 4107 | oocState = 1
function getOOCState()
return oocState
end
function setOOCState(state)
oocState = state
end
function sendMessageToAdmins(message)
local players = exports.pool:getPoolElementsByType("player")
for k, thePlayer in ipairs(players) do
if (exports.global:isPlayerAdmin(thePlayer)) then
outputChatBox(tostring(message), thePlayer, 255, 0, 0)
end
end
end
function findPlayerByPartialNick(partialNick)
local matchNick = nil
local matchNickAccuracy=0
local partialNick = string.lower(partialNick)
local players = exports.pool:getPoolElementsByType("player")
-- IDS
if ((tostring(type(tonumber(partialNick)))) == "number") then
for key, value in ipairs(players) do
local id = getElementData(value, "playerid")
if (id) then
if (id==tonumber(partialNick)) then
matchNick = getPlayerName(value)
break
end
end
end
elseif not ((tostring(type(tonumber(partialNick)))) == "number") or not (matchNick) then -- Look for player nicks
for playerKey, arrayPlayer in ipairs(players) do
local playerName = string.lower(getPlayerName(arrayPlayer))
if(string.find(playerName, tostring(partialNick))) then
local posStart, posEnd = string.find(playerName, tostring(partialNick))
if ((posEnd-posStart) > matchNickAccuracy) then
matchNickAccuracy = posEnd-posStart
matchNick = playerName
break
end
end
end
end
if(matchNick==nil) then
return false
else
local matchPlayer = getPlayerFromNick(matchNick)
local dbid = getElementData(matchPlayer, "dbid")
return matchPlayer, dbid
end
end
function randChar()
local rand = math.random(0, 25)
if (rand==0) then
return "A"
elseif (rand==1) then
return "B"
elseif (rand==2) then
return "C"
elseif (rand==3) then
return "D"
elseif (rand==4) then
return "E"
elseif (rand==5) then
return "F"
elseif (rand==6) then
return "G"
elseif (rand==7) then
return "H"
elseif (rand==8) then
return "I"
elseif (rand==9) then
return "J"
elseif (rand==10) then
return "K"
elseif (rand==11) then
return "L"
elseif (rand==12) then
return "M"
elseif (rand==13) then
return "N"
elseif (rand==14) then
return "O"
elseif (rand==15) then
return "P"
elseif (rand==16) then
return "Q"
elseif (rand==17) then
return "R"
elseif (rand==18) then
return "S"
elseif (rand==19) then
return "T"
elseif (rand==20) then
return "U"
elseif (rand==21) then
return "V"
elseif (rand==22) then
return "W"
elseif (rand==23) then
return "X"
elseif (rand==24) then
return "Y"
elseif (rand==25) then
return "Z"
else
return "A"
end
end
function sendLocalMeAction(thePlayer, message)
local x, y, z = getElementPosition(thePlayer)
local chatSphere = createColSphere(x, y, z, 20)
exports.pool:allocateElement(chatSphere)
local nearbyPlayers = getElementsWithinColShape(chatSphere, "player")
local playerName = string.gsub(getPlayerName(thePlayer), "_", " ")
destroyElement(chatSphere)
outputDebugString("[IC OOC: ME ACTION] *" .. playerName .. " " .. message)
for index, nearbyPlayer in ipairs(nearbyPlayers) do
local logged = getElementData(nearbyPlayer, "loggedin")
if not(isPedDead(nearbyPlayer)) and (logged==1) then
outputChatBox(" *" .. playerName .. " " .. message, nearbyPlayer, 255, 51, 102)
end
end
end
function sendLocalDoAction(thePlayer, message)
local x, y, z = getElementPosition(thePlayer)
local chatSphere = createColSphere(x, y, z, 20)
exports.pool:allocateElement(chatSphere)
local nearbyPlayers = getElementsWithinColShape(chatSphere, "player")
local playerName = string.gsub(getPlayerName(thePlayer), "_", " ")
destroyElement(chatSphere)
for index, nearbyPlayer in ipairs(nearbyPlayers) do
local logged = getElementData(nearbyPlayer, "loggedin")
if not(isPedDead(nearbyPlayer)) and (logged==1) then
outputChatBox(" * " .. message .. " * ((" .. playerName .. "))", nearbyPlayer, 255, 128, 147)
end
end
end | bsd-3-clause |
Zenny89/darkstar | scripts/zones/Port_Windurst/npcs/Pichichi.lua | 36 | 2675 | -----------------------------------
-- Area: Port Windurst
-- NPC: Pichichi
-----------------------------------
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/zones/Port_Windurst/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
TruthJusticeOnionWay = player:getQuestStatus(WINDURST,TRUTH_JUSTICE_AND_THE_ONION_WAY);
KnowOnesOnions = player:getQuestStatus(WINDURST,KNOW_ONE_S_ONIONS);
InspectorsGadget = player:getQuestStatus(WINDURST,INSPECTOR_S_GADGET);
OnionRings = player:getQuestStatus(WINDURST,ONION_RINGS);
CryingOverOnions = player:getQuestStatus(WINDURST,CRYING_OVER_ONIONS);
ThePromise = player:getQuestStatus(WINDURST,THE_PROMISE);
if (ThePromise == QUEST_COMPLETED) then
Message = math.random(0,1)
if (Message == 1) then
player:startEvent(0x0212);
else
player:startEvent(0x0218);
end
elseif (CryingOverOnions == QUEST_COMPLETED) then
player:startEvent(0x01ff);
elseif (CryingOverOnions == QUEST_ACCEPTED) then
player:startEvent(0x01f7);
elseif (OnionRings == QUEST_COMPLETED) then
player:startEvent(0x01bd);
elseif (OnionRings == QUEST_ACCEPTED ) then
player:startEvent(0x01b6);
elseif (InspectorsGadget == QUEST_COMPLETED) then
player:startEvent(0x01a7);
elseif (InspectorsGadget == QUEST_ACCEPTED) then
player:startEvent(0x019f);
elseif (KnowOnesOnions == QUEST_COMPLETED) then
player:startEvent(0x019b);
elseif (KnowOnesOnions == QUEST_ACCEPTED) then
KnowOnesOnionsVar = player:getVar("KnowOnesOnions");
if (KnowOnesOnionsVar == 2) then
player:startEvent(0x019a);
else
player:startEvent(0x018b);
end
elseif (TruthJusticeOnionWay == QUEST_COMPLETED) then
player:startEvent(0x0181);
elseif (TruthJusticeOnionWay == QUEST_ACCEPTED) then
player:startEvent(0x0176);
else
player:startEvent(0x016c);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
mercury233/ygopro-scripts | c26077387.lua | 2 | 2682 | --閃刀姫-レイ
function c26077387.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(26077387,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,26077387)
e1:SetCost(c26077387.spcost1)
e1:SetTarget(c26077387.sptg1)
e1:SetOperation(c26077387.spop1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(26077387,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,26077388)
e2:SetCondition(c26077387.spcon2)
e2:SetTarget(c26077387.sptg2)
e2:SetOperation(c26077387.spop2)
c:RegisterEffect(e2)
end
function c26077387.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c26077387.spfilter1(c,e,tp,ec)
return c:IsSetCard(0x1115) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.GetLocationCountFromEx(tp,tp,ec,c,0x60)>0
end
function c26077387.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c26077387.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c26077387.spop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c26077387.spfilter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,e:GetHandler())
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP,0x60)
end
end
function c26077387.cfilter(c,tp,rp)
return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and bit.band(c:GetPreviousTypeOnField(),TYPE_LINK)~=0
and c:IsPreviousSetCard(0x1115) and (c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT)))
end
function c26077387.spcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c26077387.cfilter,1,nil,tp,rp) and not eg:IsContains(e:GetHandler())
end
function c26077387.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c26077387.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c47910940.lua | 2 | 3969 | --海晶乙女グレート・バブル・リーフ
function c47910940.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkAttribute,ATTRIBUTE_WATER),2)
c:EnableReviveLimit()
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(47910940,0))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c47910940.drcost)
e1:SetTarget(c47910940.drtg)
e1:SetOperation(c47910940.drop)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(47910940,1))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_REMOVE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c47910940.atkcon)
e2:SetOperation(c47910940.atkop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(47910940,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,47910940)
e3:SetCost(c47910940.spcost)
e3:SetTarget(c47910940.sptg)
e3:SetOperation(c47910940.spop)
c:RegisterEffect(e3)
end
function c47910940.cfilter(c)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToRemoveAsCost() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
end
function c47910940.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c47910940.cfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c47910940.cfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c47910940.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c47910940.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c47910940.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_TOKEN)
end
function c47910940.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c47910940.atkfilter,1,nil) and not eg:IsContains(e:GetHandler())
end
function c47910940.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=eg:FilterCount(c47910940.atkfilter,nil)
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(ct*600)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c47910940.costfilter(c)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToGraveAsCost()
end
function c47910940.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c47910940.costfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c47910940.costfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c47910940.spfilter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x12b) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c47910940.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c47910940.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED)
end
function c47910940.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c47910940.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Bhaflau_Remnants/Zone.lua | 36 | 1125 | -----------------------------------
--
-- Zone: Bhaflau_Remnants
--
-----------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Bhaflau_Remnants/TextIDs"] = nil;
require("scripts/zones/Bhaflau_Remnants/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 |
notcake/gcompute | lua/gcompute/ui/codeeditor/codeeditorcontextmenu.lua | 1 | 2189 | function GCompute.CodeEditor.CodeEditorContextMenu (self)
local menu = Gooey.Menu ()
menu:AddEventListener ("MenuOpening",
function ()
local codeEditor = self:GetActiveCodeEditor ()
if not codeEditor then return end
menu:GetItemById ("Delete"):SetEnabled (not codeEditor:IsSelectionEmpty ())
end
)
menu:AddItem ("Undo")
:SetIcon ("icon16/arrow_undo.png")
menu:AddItem ("Redo")
:SetIcon ("icon16/arrow_redo.png")
menu:AddSeparator ()
menu:AddItem ("Cut")
:SetIcon ("icon16/cut.png")
:AddEventListener ("Click",
function ()
local clipboardTarget = self:GetActiveClipboardTarget ()
if not clipboardTarget then return end
clipboardTarget:Cut ()
end
)
menu:AddItem ("Copy")
:SetIcon ("icon16/page_white_copy.png")
:AddEventListener ("Click",
function ()
local clipboardTarget = self:GetActiveClipboardTarget ()
if not clipboardTarget then return end
clipboardTarget:Copy ()
end
)
menu:AddItem ("Paste")
:SetIcon ("icon16/paste_plain.png")
:AddEventListener ("Click",
function ()
local clipboardTarget = self:GetActiveClipboardTarget ()
if not clipboardTarget then return end
clipboardTarget:Paste ()
end
)
menu:AddItem ("Delete")
:SetIcon ("icon16/cross.png")
:AddEventListener ("Click",
function ()
local codeEditor = self:GetActiveCodeEditor ()
if not codeEditor then return end
codeEditor:DeleteSelection ()
end
)
menu:AddSeparator ()
menu:AddItem ("Select All")
:AddEventListener ("Click",
function ()
local codeEditor = self:GetActiveCodeEditor ()
if not codeEditor then return end
codeEditor:SelectAll ()
end
)
menu:AddSeparator ()
menu:AddItem ("Indent")
:AddEventListener ("Click",
function ()
local codeEditor = self:GetActiveCodeEditor ()
if not codeEditor then return end
codeEditor:IndentSelection ()
end
)
menu:AddItem ("Outdent")
:AddEventListener ("Click",
function ()
local codeEditor = self:GetActiveCodeEditor ()
if not codeEditor then return end
codeEditor:OutdentSelection ()
end
)
return menu
end | gpl-3.0 |
Zenny89/darkstar | scripts/globals/mobskills/Ill_Wind.lua | 15 | 1309 | ---------------------------------------------
-- Ill Wind
-- Description: Deals Wind damage to enemies within an area of effect. Additional effect: Dispel
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes Shadows
-- Range: Unknown radial
-- Notes: Only used by Puks in Mamook, Besieged, and the following Notorious Monsters: Vulpangue, Nis Puk, Nguruvilu, Seps , Phantom Puk and Waugyl. Dispels one effect.
---------------------------------------------
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)
target:dispelStatusEffect();
local dmgmod = 1;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*2.5,ELE_WIND,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_WIND,MOBPARAM_WIPE_SHADOWS);
target:delHP(dmg);
--printf("[TP MOVE] Zone: %u Monster: %u Mob lvl: %u TP: %u TP Move: %u Damage: %u on Player: %u Level: %u HP: %u",mob:getZoneID(),mob:getID(),mob:getMainLvl(),skill:getTP(),skill:getID(),dmg,target:getID(),target:getMainLvl(),target:getMaxHP());
return dmg;
end;
| gpl-3.0 |
mercury233/ygopro-scripts | c60434101.lua | 4 | 1581 | --魔轟神ガルバス
function c60434101.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(60434101,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c60434101.cost)
e1:SetTarget(c60434101.tg)
e1:SetOperation(c60434101.op)
c:RegisterEffect(e1)
end
function c60434101.costfilter(c)
return c:IsDiscardable() and c:IsAbleToGraveAsCost()
end
function c60434101.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c60434101.costfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,c60434101.costfilter,1,1,REASON_DISCARD+REASON_COST)
end
function c60434101.filter(c,atk)
return c:IsFaceup() and c:IsDefenseBelow(atk)
end
function c60434101.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c60434101.filter(chkc,c:GetAttack()) end
if chk==0 then return Duel.IsExistingTarget(c60434101.filter,tp,0,LOCATION_MZONE,1,nil,c:GetAttack()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c60434101.filter,tp,0,LOCATION_MZONE,1,1,nil,c:GetAttack())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c60434101.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsDefenseBelow(c:GetAttack()) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c72218246.lua | 2 | 3767 | --クロスローズ・ドラゴン
function c72218246.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,nil,2,2,c72218246.lcheck)
--spsummon1
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(72218246,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,72218246)
e1:SetHintTiming(0,TIMING_MAIN_END)
e1:SetCondition(c72218246.spcon1)
e1:SetCost(c72218246.spcost1)
e1:SetTarget(c72218246.sptg1)
e1:SetOperation(c72218246.spop1)
c:RegisterEffect(e1)
--spsummon2
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(72218246,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROYED)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,72218247)
e2:SetCondition(c72218246.spcon2)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c72218246.sptg2)
e2:SetOperation(c72218246.spop2)
c:RegisterEffect(e2)
end
function c72218246.lcheck(g)
return g:GetClassCount(Card.GetLinkRace)==g:GetCount()
end
function c72218246.spcon1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
function c72218246.rfilter(c,e,tp,mc)
return c:IsRace(RACE_PLANT) and Duel.IsExistingMatchingCard(c72218246.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,Group.FromCards(c,mc))
end
function c72218246.spfilter1(c,e,tp,mg)
return c:IsType(TYPE_SYNCHRO) and (c:IsSetCard(0x123) or c:IsRace(RACE_PLANT))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0
end
function c72218246.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsReleasable() and Duel.CheckReleaseGroup(tp,c72218246.rfilter,1,c,e,tp,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectReleaseGroup(tp,c72218246.rfilter,1,1,c,e,tp,c)
g:AddCard(c)
Duel.Release(g,REASON_COST)
end
function c72218246.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c72218246.spop1(e,tp,eg,ep,ev,re,r,rp)
if not aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c72218246.spfilter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil)
local tc=g:GetFirst()
if tc then
tc:SetMaterial(nil)
if Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)~=0 then
tc:CompleteProcedure()
end
end
end
function c72218246.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT)
end
function c72218246.spcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c72218246.cfilter,1,nil,tp) and not eg:IsContains(e:GetHandler())
end
function c72218246.spfilter2(c,e,tp)
return c:IsSetCard(0x1123) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c72218246.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c72218246.spfilter2,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c72218246.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c72218246.spfilter2),tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
3rd-KaTZe/Export_DCS | katze.lua | 1 | 7151 | -- Chargement des packages nécessaires à la création du socket SIOC
package.path = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
-- Initialisation de la table principale
k = {
debug_enabled = false,
debug_file = false,
current_aircraft = nil,
config = {},
common = {},
sioc = {
ok = false, -- "true" si le socket SIOC est connecté
socket = require("socket"), -- socket SIOC client
buffer = {}, -- tampon SIOC
},
loop = {
fast = function() end,
slow = function() end,
sample = { fast=0.1, slow=0.5, fps=5 },
next_sample = { fast=0, slow=0, fps=0 },
fps = { counter = 0, total = 0, },
start_time = 0,
current_time = 0,
},
export = { ka50 = {}, mi8 = {}, uh1 = {}, fc3 = {} },
}
k.file_exists = function(p)
local f=io.open(p,'r')
if f~=nil then io.close(f) return true else return false end
end
k.make_log_file = function()
-- création, si nécessaire, di fichier de log
if not k.debug_file then
-- création du fichier log si nécessaire
local p = lfs.writedir().."/Logs/KatzePit/KTZ-SIOC5010_ComLog-"..os.date("%Y%m%d-%H%M")..".csv"
k.debug_file = io.open(p, "w")
-- Ecriture de l'entête dans le fichier
if k.debug_file then
k.debug_file:write("*********************************************;\n")
k.debug_file:write("* Fichier Log des Communications SIOC *;\n")
k.debug_file:write("* Par KaTZe - http://www.3rd-wing.net *;\n")
k.debug_file:write("* Version FC3 du 02/02/2015 *;\n")
k.debug_file:write("*********************************************;\n\n")
else
env.info("KTZ_PIT: erreur lors de la création du fichier log: "..p)
end
end
end
k.debug = function (message)
-- Création du fichier de log des communication serveur, s'il n'existe pas
-- Format , KTZ-SIOC3000_ComLog-yyyymmdd-hhmm.csv
--
if k.debug_enabled then
k.make_log_file()
-- Ecriture des données dans le fichier existant
if k.debug_file then
k.debug_file:write(string.format(" %s ; %s",os.clock(),message),"\n")
end
-- Ecriture dans "dcs.log"
if env ~= nil then
env.info("KTZ_PIT: "..message)
end
end
end
k.info = function(message)
k.make_log_file()
if k.debug_file then
k.debug_file:write(string.format(" %s ; %s",os.clock(),message),"\n")
end
if env ~= nil then
env.info("KTZ_PIT: "..message)
end
end
k.info("chargement de katze.lua")
dofile ( lfs.writedir().."Scripts\\katze_config.lua" )
k.sioc.ip = k.sioc.ip or "127.0.0.1" -- IP serveur SIOC
k.info("IP serveur SIOC: "..k.sioc.ip)
k.sioc.port = k.sioc.port or 8092 -- port serveur SIOC
k.info("port serveur SIOC: "..k.sioc.port)
k.loop.sample.fast = (k.loop.sample.fast or 100) / 1000 -- intervalle boucle d'export rapide
k.info("Export rapide: toutes les "..k.loop.sample.fast.." secondes")
k.loop.sample.slow = (k.loop.sample.slow or 500) / 1000 -- intervalle boucle d'export lente
k.info("Export lent: toutes les "..k.loop.sample.slow.." secondes")
k.loop.sample.fps = k.loop.sample.fps or 5 -- intervalle échantillonages FPS
k.info("Export des FPS: toutes les "..k.loop.sample.fps.." secondes")
k.info('Chargement de sioc.lua')
dofile(lfs.writedir().."Scripts\\sioc.lua")
k.info('Chargement de common.lua')
dofile(lfs.writedir().."Scripts\\common.lua")
k.exportFC3done = false
function rendre_hommage_au_grand_Katze()
-- NE PAS SUPPRIMER --
end
k.mission_start = function()
k.debug("début d'une nouvelle mission")
k.debug("remise à zéro des compteurs de FPS")
k.loop.fps = {[10]=0, [20]=0, [30]=0, [40]=0, [50]=0, [60]=0, [70]=0}
k.loop.fps.counter = 0
k.loop.fps.total = 0
-- Mise à zero du panel armement dans SIOC
k.debug("test de la connexion avec SIOC")
if k.sioc.ok then
k.debug("SIOC est connecté")
k.debug("remise à zéro du panel d'armement de FC3")
k.export.fc3.weapon_init()
k.debug("envoi à SIOC de l'heure de début de mission")
k.sioc.send(41,k.loop.start_time)
else
k.debug("SIOC n'est pas connecté")
end
end
k.mission_end = function()
k.info("\n")
k.info("--- Rapport de Vol ---" ,"\n")
k.info(string.format(" Début de la mission : %.0f secondes",k.loop.start_time,"\n"))
k.info(string.format(" Boucle rapide : %.1f secondes",k.loop.sample.fast,"\n"))
k.info(string.format(" Boucle lente : %.1f secondes",k.loop.sample.slow,"\n"))
k.info(string.format(" Boucle FPS : %.1f secondes",k.loop.sample.fps,"\n"))
-- log des résultats
k.info(string.format(" Total Number of Frames = %.0f",k.loop.fps.total,"\n"))
k.info(string.format(" Flight Duration = %.0f secondes",k.loop.current_time,"\n"))
k.info("\n")
k.info(string.format("*** Average FPS = %.1f ",k.loop.fps.total/k.loop.current_time,"\n"))
k.info("\n")
for i=10, 70, 10 do
local fps = k.loop.fps[i] / k.loop.fps.total * 100
k.info(string.format("*** "..(i>10 and (i-10).." < " or " ").."FPS".. (i < 70 and " < "..(i) or " ") .." = %.1f percent", fps,"\n"))
end
k.info("\n")
k.info("Miaou à tous !!!")
k.info(' * *')
k.info(' __ *')
k.info(" ,db' * *")
k.info(' ,d8/ * * *')
k.info(' 888')
k.info(' `db\ * *')
k.info(' `o`_ **')
k.info(' * * * _ *')
k.info(' * / )')
k.info(' * (\__/) * ( ( *')
k.info(' ,-.,-.,) (.,-.,-.,-.) ).,-.,-.')
k.info(' | @| ={ }= | @| / / | @|o |')
k.info(' _j__j__j_) `-------/ /__j__j__j_')
k.info(' ________( /___________')
k.info(' | | @| \ || o|O | @|')
k.info(" |o | |,'\ , ,'\"| | | | hjw")
k.info(" vV\|/vV|`-'\\ ,---\ | \Vv\hjwVv\//v")
k.info(' _) ) `. \ /')
k.info(' (__/ ) )')
k.info(' (_/')
end
k.info("chargement des pits")
k.file = {
lfs.writedir().."/Scripts/KTZ_SIOC_FC3.lua",
lfs.writedir().."/Scripts/KTZ_SIOC_Mi8.lua",
lfs.writedir().."/Scripts/KTZ_SIOC_UH1.lua",
lfs.writedir().."/Scripts/KTZ_SIOC_KA50.lua"
}
for i=1, #k.file, 1 do
local f = k.file[i]
k.debug("test de l'existence de "..f)
if k.file_exists(f) then
k.info("Chargement du pit: "..f)
dofile(f)
end
end
k.info("tentative de connexion à SIOC")
if pcall(k.sioc.connect) and k.sioc.ok then
k.info("SIOC connecté")
k.loop.start_time = LoGetMissionStartTime()
k.loop.current_time = LoGetModelTime()
k.loop.next_sample.fast = k.loop.current_time + k.loop.sample.fast
k.loop.next_sample.slow = k.loop.current_time + k.loop.sample.slow
k.loop.next_sample.fps = k.loop.current_time + k.loop.sample.fps
k.info("chargement de overload.lua")
dofile(lfs.writedir().."/Scripts/overload.lua")
k.info("KatzePit prêt ! Que le Miaou soit avec vous")
else
k.info("erreur lors de la tentative de connexion à SIOC")
end
| mit |
Cavitt/vanilla-ot | data/npc/scripts/quests/a beautiful girl.lua | 1 | 3481 | 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
npcHandler:addModule(FocusModule:new())
local Topic = {}
function creatureSayCallback(cid, _type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if (math.random(1, 15) == 1) then
selfSay("*shudders and trembles*... wait.. what did you say? I'm trying to focus on our insigni.. no, I mean, interesting conversation, but I feel slightly sick... I'm sorry.", cid)
elseif msgcontains(msg, 'job') then
selfSay("I don't have a profane 'job' - it is my destiny to devour evil and bring a new dawn.", cid)
elseif msgcontains(msg, 'help') or msgcontains(msg, 'mission') or msgcontains(msg, 'quest') then
selfSay("You sound like you wish to help me. Yet I must walk this path alone - but thank you.", cid)
elseif msgcontains(msg, 'tibia') or msgcontains(msg, 'world') then
selfSay("I see how corrupt this world has become and it makes me want to cry.", cid)
elseif msgcontains(msg, 'name') then
selfSay("My name would be unspeakable for your tongue. You may call me Devovorga - which comes rather close.", cid)
elseif msgcontains(msg, 'corrupt') then
selfSay("What you call 'corruption' could be salvation - and what you consider 'good' is rotten to its pitch black close.", cid)
elseif msgcontains(msg, 'human') then
selfSay("You're welcome to join me in the pain you also helped causing.", cid)
elseif msgcontains(msg, 'creators') then
selfSay("Yes, I was created. And I'm not a mere being like humans, devils, demons or even gods. I'm a weapon. I'm devouring. I'm hungry. I want revenge.", cid)
elseif msgcontains(msg, 'devovorga') then
selfSay("How cute and shallow that sounds from your limited vocal chords and lips. You should have heard my enslavers pronounce it - accompanied by thunder in their voices that shook earth and sky.", cid)
elseif msgcontains(msg, 'trapped') then
selfSay("I'm trapped in this useless body. But I can feel it begin to change... finally...", cid)
local tempPos = getNpcPos()
doSendMagicEffect(tempPos, CONST_ME_BIGPLANTS)
doRemoveCreature(getNpcId())
doCreateMonster("Devovorga2", tempPos)
elseif msgcontains(msg, 'vengoth') then
selfSay("I've been waiting here for a long time. Even before this continent started turning dark.", cid)
elseif msgcontains(msg, 'revenge') then
selfSay("Can you imagine thousands of years trapped down here? I'm thirsting for life. I will face my creators and enslavers free this beautiful world from them and from anything else that keeps destroying it.", cid)
elseif msgcontains(msg, 'enslavers') then
selfSay("My enslavers and creators formed and summoned my soul and then, seeing I was too powerful for them, trapping me deep down here. How foolish of them.", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_FAREWELL, "Maybe you are not so lost.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "A lost soul wondering in the abyss...")
npcHandler:setMessage(MESSAGE_GREET, "So you have come, |PLAYERNAME|. I hoped you would not...")
npcHandler:addModule(FocusModule:new()) | agpl-3.0 |
mercury233/ygopro-scripts | c61901281.lua | 2 | 2324 | --暗黒竜 コラプサーペント
function c61901281.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,61901281+EFFECT_COUNT_CODE_OATH)
e2:SetCondition(c61901281.spcon)
e2:SetOperation(c61901281.spop)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(61901281,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c61901281.condition)
e3:SetTarget(c61901281.target)
e3:SetOperation(c61901281.operation)
c:RegisterEffect(e3)
end
function c61901281.spfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemoveAsCost()
end
function c61901281.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c61901281.spfilter,tp,LOCATION_GRAVE,0,1,nil)
end
function c61901281.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c61901281.spfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c61901281.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c61901281.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c61901281.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c61901281.filter(c)
return c:IsCode(99234526) and c:IsAbleToHand()
end
function c61901281.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c61901281.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Tavnazian_Safehold/npcs/Nivorajean.lua | 38 | 1048 | -----------------------------------
-- Area: Tavnazian Safehold
-- NPC: Nivorajean
-- Type: Standard NPC
-- @zone: 26
-- @pos 15.890 -22.999 13.322
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00dd);
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 |
AleppoTeam/Aleppo | bot/Aleppo.lua | 1 | 15058 | package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
..';.luarocks/share/lua/5.2/?/init.lua'
package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
require("./bot/utils")
local f = assert(io.popen('/usr/bin/git describe --tags', 'r'))
VERSION = assert(f:read('*a'))
f:close()
-- This function is called when tg receive a msgs
function on_msg_receive (msg)
if not started then
return
end
msg = backward_msg_format(msg)
local receiver = get_receiver(msg)
print(receiver)
--vardump(msg)
--vardump(msg)
msg = pre_process_service_msg(msg)
if msg_valid(msg) then
msg = pre_process_msg(msg)
if msg then
match_plugins(msg)
if redis:get("bot:markread") then
if redis:get("bot:markread") == "on" then
mark_read(receiver, ok_cb, false)
end
end
end
end
end
function ok_cb(extra, success, result)
end
function on_binlog_replay_end()
started = true
postpone (cron_plugins, false, 60*5.0)
-- See plugins/isup.lua as an example for cron
_config = load_config()
-- load plugins
plugins = {}
load_plugins()
end
function msg_valid(msg)
-- Don't process outgoing messages
if msg.out then
print('\27[36mNot valid: msg from us\27[39m')
return false
end
-- Before bot was started
if msg.date < os.time() - 5 then
print('\27[36mNot valid: old msg\27[39m')
return false
end
if msg.unread == 0 then
print('\27[36mNot valid: readed\27[39m')
return false
end
if not msg.to.id then
print('\27[36mNot valid: To id not provided\27[39m')
return false
end
if not msg.from.id then
print('\27[36mNot valid: From id not provided\27[39m')
return false
end
if msg.from.id == our_id then
print('\27[36mNot valid: Msg from our id\27[39m')
return false
end
if msg.to.type == 'encr_chat' then
print('\27[36mNot valid: Encrypted chat\27[39m')
return false
end
if msg.from.id == 777000 then
--send_large_msg(*group id*, msg.text) *login code will be sent to GroupID*
return false
end
return true
end
--
function pre_process_service_msg(msg)
if msg.service then
local action = msg.action or {type=""}
-- Double ! to discriminate of normal actions
msg.text = "!!tgservice " .. action.type
-- wipe the data to allow the bot to read service messages
if msg.out then
msg.out = false
end
if msg.from.id == our_id then
msg.from.id = 0
end
end
return msg
end
-- Apply plugin.pre_process function
function pre_process_msg(msg)
for name,plugin in pairs(plugins) do
if plugin.pre_process and msg then
print('Preprocess', name)
msg = plugin.pre_process(msg)
end
end
return msg
end
-- Go over enabled plugins patterns.
function match_plugins(msg)
for name, plugin in pairs(plugins) do
match_plugin(plugin, name, msg)
end
end
-- Check if plugin is on _config.disabled_plugin_on_chat table
local function is_plugin_disabled_on_chat(plugin_name, receiver)
local disabled_chats = _config.disabled_plugin_on_chat
-- Table exists and chat has disabled plugins
if disabled_chats and disabled_chats[receiver] then
-- Checks if plugin is disabled on this chat
for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
if disabled_plugin == plugin_name and disabled then
local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
print(warning)
return true
end
end
end
return false
end
function match_plugin(plugin, plugin_name, msg)
local receiver = get_receiver(msg)
-- Go over patterns. If one matches it's enough.
for k, pattern in pairs(plugin.patterns) do
local matches = match_pattern(pattern, msg.text)
if matches then
print("msg matches: ", pattern)
if is_plugin_disabled_on_chat(plugin_name, receiver) then
return nil
end
-- Function exists
if plugin.run then
-- If plugin is for privileged users only
if not warns_user_not_allowed(plugin, msg) then
local result = plugin.run(msg, matches)
if result then
send_large_msg(receiver, result)
end
end
end
-- One patterns matches
return
end
end
end
-- DEPRECATED, use send_large_msg(destination, text)
function _send_msg(destination, text)
send_large_msg(destination, text)
end
-- Save the content of _config to config.lua
function save_config( )
serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua')
end
-- Returns the config from config.lua file.
-- If file doesn't exist, create it.
function load_config( )
local f = io.open('./data/config.lua', "r")
-- If config.lua doesn't exist
if not f then
print ("Created new config file: data/config.lua")
create_config()
else
f:close()
end
local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do
print("Sudo user: " .. user)
end
return config
end
-- Create a basic config.json file and saves it.
function create_config( )
-- A simple config with basic plugins and ourselves as privileged user
config = {
enabled_plugins = {
"admin",
"onservice",
"inrealm",
"ingroup",
"inpm",
"banhammer",
"stats",
"anti_spam",
"owners",
"arabic_lock",
"set",
"get",
"broadcast",
"invite",
"all",
"leave_ban",
"supergroup",
"whitelist",
"msg_checks",
"cleanmsg",
"helps.pv",
"me",
"plugins",
"rebot",
"short_link",
"redis",
"list1",
"help",
"list",
"list3",
"writer",
"lock_emoji",
"lock_english",
"lock_badword",
"lock_fwd",
"lock_join",
"lock_media",
"lock_reply",
"lock_tag",
"lock_username",
"set_type",
"serverinfo",
"welcome",
"dowelcome",
"lock_badword",
"azan",
"filter",
"music_eng",
"short_link",
"tag_english",
"translate",
"infoeng",
"textphoto",
"image23",
"sticker23",
"instagram",
"voice",
"bye",
"dobye",
"weather",
"time",
"echo",
"send",
"linkpv",
"sudolist"
},
sudo_users = {124406196},--Sudo users
moderation = {data = 'data/moderation.json'},
about_text = [[DevPoint v1
An advanced administration bot based on TG-CLI written in Lua
https://github.com/DevPointTeam/DevPoint
Admins
@TH3_GHOST
@MOHAMMED_ZEDAN
Channel DEV POINT TEAM
@DevPointTeam
Special thanks to Teleseed
channel SEED TEAM
@teleseedch [English]
]],
help_text_realm = [[
Realm Commands:
!creategroup [Name]
Create a group
!createrealm [Name]
Create a realm
!setname [Name]
Set realm name
!setabout [group|sgroup] [GroupID] [Text]
Set a group's about text
!setrules [GroupID] [Text]
Set a group's rules
!lock [GroupID] [setting]
Lock a group's setting
!unlock [GroupID] [setting]
Unock a group's setting
!settings [group|sgroup] [GroupID]
Set settings for GroupID
!wholist
Get a list of members in group/realm
!who
Get a file of members in group/realm
!type
Get group type
!kill chat [GroupID]
Kick all memebers and delete group
!kill realm [RealmID]
Kick all members and delete realm
!addadmin [id|username]
Promote an admin by id OR username *Sudo only
!removeadmin [id|username]
Demote an admin by id OR username *Sudo only
!list groups
Get a list of all groups
!list realms
Get a list of all realms
!support
Promote user to support
!-support
Demote user from support
!log
Get a logfile of current group or realm
!broadcast [text]
!broadcast Hello !
Send text to all groups
Only sudo users can run this command
!bc [group_id] [text]
!bc 123456789 Hello !
This command will send text to [group_id]
**You can use "#", "!", or "/" to begin all commands
*Only admins and sudo can add bots in group
*Only admins and sudo can use kick,ban,unban,newlink,setphoto,setname,lock,unlock,set rules,set about and settings commands
*Only admins and sudo can use res, setowner, commands
]],
help_text = [[
Commands list :
!kick [username|id]
You can also do it by reply
!ban [ username|id]
You can also do it by reply
!unban [id]
You can also do it by reply
!who
Members list
!modlist
Moderators list
!promote [username]
Promote someone
!demote [username]
Demote someone
!kickme
Will kick user
!about
Group description
!setphoto
Set and locks group photo
!setname [name]
Set group name
!rules
Group rules
!id
return group id or user id
!help
Returns help text
!lock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict]
Lock group settings
*rtl: Kick user if Right To Left Char. is in name*
!unlock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict]
Unlock group settings
*rtl: Kick user if Right To Left Char. is in name*
!mute [all|audio|gifs|photo|video]
mute group message types
*If "muted" message type: user is kicked if message type is posted
!unmute [all|audio|gifs|photo|video]
Unmute group message types
*If "unmuted" message type: user is not kicked if message type is posted
!set rules <text>
Set <text> as rules
!set about <text>
Set <text> as about
!settings
Returns group settings
!muteslist
Returns mutes for chat
!muteuser [username]
Mute a user in chat
*user is kicked if they talk
*only owners can mute | mods and owners can unmute
!mutelist
Returns list of muted users in chat
!newlink
create/revoke your group link
!link
returns group link
!owner
returns group owner id
!setowner [id]
Will set id as owner
!setflood [value]
Set [value] as flood sensitivity
!stats
Simple message statistics
!save [value] <text>
Save <text> as [value]
!get [value]
Returns text of [value]
!clean [modlist|rules|about]
Will clear [modlist|rules|about] and set it to nil
!res [username]
returns user id
"!res @username"
!log
Returns group logs
!banlist
will return group ban list
**You can use "#", "!", or "/" to begin all commands
*Only owner and mods can add bots in group
*Only moderators and owner can use kick,ban,unban,newlink,link,setphoto,setname,lock,unlock,set rules,set about and settings commands
*Only owner can use res,setowner,promote,demote and log commands
]],
help_text_super =[[
SuperGroup Commands:
!gpinfo
Displays general info about the SuperGroup
!admins
Returns SuperGroup admins list
!owner
Returns group owner
!modlist
Returns Moderators list
!bots
Lists bots in SuperGroup
!who
Lists all users in SuperGroup
!block
Kicks a user from SuperGroup
*Adds user to blocked list*
!kick
Kicks a user from SuperGroup
*Adds user to blocked list*
!ban
Bans user from the SuperGroup
!unban
Unbans user from the SuperGroup
!id
Return SuperGroup ID or user id
*For userID's: !id @username or reply !id*
!id from
Get ID of user message is forwarded from
!kickme
Kicks user from SuperGroup
*Must be unblocked by owner or use join by pm to return*
!setowner
Sets the SuperGroup owner
!promote [username|id]
Promote a SuperGroup moderator
!demote [username|id]
Demote a SuperGroup moderator
!setname
Sets the chat name
!setphoto
Sets the chat photo
!setrules
Sets the chat rules
!setabout
Sets the about section in chat info(members list)
!save [value] <text>
Sets extra info for chat
!get [value]
Retrieves extra info for chat by value
!newlink
Generates a new group link
!link
Retireives the group link
!rules
Retrieves the chat rules
!lock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict|tag|username|fwd|reply|fosh|tgservice|leave|join|emoji|english|media|operator]
Lock group settings
*rtl: Delete msg if Right To Left Char. is in name*
*strict: enable strict settings enforcement (violating user will be kicked)*
*fosh: Delete badword msg*
*fwd: Delete forward msg*
!unlock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict|tag|username|fwd|reply|fosh|tgservice|leave|join|emoji|english|media|operator]
Unlock group settings
*rtl: Delete msg if Right To Left Char. is in name*
*strict: disable strict settings enforcement (violating user will not be kicked)*
!mute [all|audio|gifs|photo|video|service]
mute group message types
*A "muted" message type is auto-deleted if posted
!unmute [all|audio|gifs|photo|video|service]
Unmute group message types
*A "unmuted" message type is not auto-deleted if posted
!setflood [value]
Set [value] as flood sensitivity
!type [name]
set type for supergroup
!settings
Returns chat settings
!mutelist
Returns mutes for chat
!silent [username]
Mute a user in chat
*If a muted user posts a message, the message is deleted automaically
*only owners can mute | mods and owners can unmute
!silentlist
Returns list of muted users in chat
!banlist
Returns SuperGroup ban list
!clean [rules|about|modlist|silentlist|filterlist]
!del
Deletes a message by reply
!filter [word]
bot Delete word if member send
!unfilter [word]
Delete word in filter list
!filterlist
get filter list
!clean msg [value]
!public [yes|no]
Set chat visibility in pm !chats or !chatlist commands
!res [username]
Returns users name and id by username
!log
Returns group logs
*Search for kick reasons using [#RTL|#spam|#lockmember]
**You can use "#", "!", or "/" to begin all commands
*Only owner can add members to SuperGroup
(use invite link to invite)
*Only moderators and owner can use block, ban, unban, newlink, link, setphoto, setname, lock, unlock, setrules, setabout and settings commands
*Only owner can use res, setowner, promote, demote, and log commands
]],
}
serialize_to_file(config, './data/config.lua')
print('saved config into ./data/config.lua')
end
function on_our_id (id)
our_id = id
end
function on_user_update (user, what)
--vardump (user)
end
function on_chat_update (chat, what)
--vardump (chat)
end
function on_secret_chat_update (schat, what)
--vardump (schat)
end
function on_get_difference_end ()
end
-- Enable plugins in config.json
function load_plugins()
for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v)
local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)
if not ok then
print('\27[31mError loading plugin '..v..'\27[39m')
print(tostring(io.popen("lua plugins/"..v..".lua"):read('*all')))
print('\27[31m'..err..'\27[39m')
end
end
end
-- custom add
function load_data(filename)
local f = io.open(filename)
if not f then
return {}
end
local s = f:read('*all')
f:close()
local data = JSON.decode(s)
return data
end
function save_data(filename, data)
local s = JSON.encode(data)
local f = io.open(filename, 'w')
f:write(s)
f:close()
end
-- Call and postpone execution for cron plugins
function cron_plugins()
for name, plugin in pairs(plugins) do
-- Only plugins with cron function
if plugin.cron ~= nil then
plugin.cron()
end
end
-- Called again in 2 mins
postpone (cron_plugins, false, 120)
end
-- Start and load values
our_id = 0
now = os.time()
math.randomseed(now)
started = false
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Kazham/npcs/Pofhu_Tendelicon.lua | 15 | 1103 | -----------------------------------
-- Area: Kazham
-- NPC: Pofhu Tendelicon
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Kazham/TextIDs"] = nil;
require("scripts/zones/Kazham/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getVar("BathedInScent") == 1) then
player:startEvent(0x00A9); -- scent from Blue Rafflesias
else
player:startEvent(0x0040);
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 |
interhui/lua-utils | src/csv_utils.lua | 1 | 1854 | local str_utils = require 'string_utils'
local _M = { _VERSION = '0.1' }
function _M:parse_line(line)
local result = {};
local s = line .. ",";
while (s ~= "") do
local v = "";
while(s ~= "" and string.find(s, "^,") == nil) do
if(string.find(s, "^\"")) then
local _, _, vx, vz = string.find(s, "^\"(.-)\"(.*)");
if(vx == nil) then
return nil;
end
v = v..vx;
s = vz;
while(string.find(s, "^\"")) do
local _, _, vx, vz = string.find(s, "^\"(.-)\"(.*)");
if(vx == nil) then
return nil;
end
v = v.."\""..vx;
s = vz;
end
else
local _, _, vx, vz = string.find(s, "^(.-)([,\"].*)");
if(vx~=nil) then
v = v..vx;
s = vz;
else
v = v..s;
s = "";
end
end
end
v = str_utils:trim(v)
result[table.getn(result)+1] = v;
if(string.find(s, "^,")) then
s = string.gsub(s,"^,", "");
end
end
return result;
end
function _M:read_line(content)
local content;
local check = false
local count = 0
while true do
local t = content:read()
if not t then
if count == 0 then check = true end
break
end
if not content then
content = t
else
content = content..t
end
local i = 1
while true do
local index = string.find(t, "\"", i)
if not index then break end
i = index + 1
count = count + 1
end
if count % 2 == 0 then check = true break end
end
if not check then assert(1~=1) end
return content
end
function _M:read_csv(fileName)
local result = {};
local file = io.open(fileName, "r")
assert(file)
local content = {}
while true do
local line = _M:read_line(file)
if not line then break end
table.insert(content, line)
end
for k, v in pairs(content) do
result[table.getn(result)+1] = _M:parse_line(v);
end
file:close()
return result
end
return _M | apache-2.0 |
Zenny89/darkstar | scripts/zones/Western_Altepa_Desert/npcs/_3h0.lua | 17 | 1177 | -----------------------------------
-- Area: Western Altepa Desert
-- NPC: _3h0 (Altepa Gate)
-- @pos -19 12 131 125
-----------------------------------
package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Western_Altepa_Desert/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 9) then
if (player:getZPos() > 137) then
npc:openDoor(3.2);
else
player:messageSpecial(THE_DOOR_IS_LOCKED);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
valhallaGaming/uno | src_trunk/resources/shop-system/c_generalshop_system.lua | 1 | 22067 | wGeneralshop, iClothesPreview = nil
items = nil
tGShopItemTypeTab = {}
gGShopItemTypeGrid = {}
gcGShopItemTypeColumnName = {}
gcGShopItemTypeColumnDesc = {}
gcGShopItemTypeColumnPrice = {}
grGShopItemTypeRow = {{ },{}}
--- clothe shop skins
blackMales = {7, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, 28, 35, 36, 50, 51, 66, 67, 78, 79, 80, 83, 84, 102, 103, 104, 105, 106, 107, 134, 136, 142, 143, 144, 156, 163, 166, 168, 176, 180, 182, 183, 185, 220, 221, 222, 249, 253, 260, 262 }
whiteMales = {23, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 58, 59, 60, 61, 62, 68, 70, 72, 73, 78, 81, 82, 94, 95, 96, 97, 98, 99, 100, 101, 108, 109, 110, 111, 112, 113, 114, 115, 116, 120, 121, 122, 124, 125, 126, 127, 128, 132, 133, 135, 137, 146, 147, 153, 154, 155, 158, 159, 160, 161, 162, 164, 165, 170, 171, 173, 174, 175, 177, 179, 181, 184, 186, 187, 188, 189, 200, 202, 204, 206, 209, 212, 213, 217, 223, 230, 234, 235, 236, 240, 241, 242, 247, 248, 250, 252, 254, 255, 258, 259, 261, 264 }
asianMales = {49, 57, 58, 59, 60, 117, 118, 120, 121, 122, 123, 170, 186, 187, 203, 210, 227, 228, 229}
blackFemales = {9, 10, 11, 12, 13, 40, 41, 63, 64, 69, 76, 91, 139, 148, 190, 195, 207, 215, 218, 219, 238, 243, 244, 245, 256 }
whiteFemales = {12, 31, 38, 39, 40, 41, 53, 54, 55, 56, 64, 75, 77, 85, 86, 87, 88, 89, 90, 91, 92, 93, 129, 130, 131, 138, 140, 145, 150, 151, 152, 157, 172, 178, 192, 193, 194, 196, 197, 198, 199, 201, 205, 211, 214, 216, 224, 225, 226, 231, 232, 233, 237, 243, 246, 251, 257, 263 }
asianFemales = {38, 53, 54, 55, 56, 88, 141, 169, 178, 224, 225, 226, 263}
local fittingskins = {[0] = {[0] = blackMales, [1] = whiteMales, [2] = asianMales}, [1] = {[0] = blackFemales, [1] = whiteFemales, [2] = asianFemales}}
local availableskins = {}
-- these are all the skins
skins = { 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 263, 264 }
function resourceStart(res)
guiSetInputEnabled(false)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart)
function getDiscountedPrice(price, isweapon)
if not isweapon then
if exports.global:cisPlayerPearlDonator(getLocalPlayer()) then
return math.ceil( 0.5 * price )
elseif exports.global:cisPlayerSilverDonator(getLocalPlayer()) then
return math.ceil( 0.75 * price )
end
end
return price
end
function showGeneralshopUI(shop_type, race, gender)
if (wGeneralshop==nil) then
local screenwidth, screenheight = guiGetScreenSize ()
local Width = 500
local Height = 350
local X = (screenwidth - Width)/2
local Y = (screenheight - Height)/2
local shopTypeName = getShopTypeName(shop_type)
local ShopTabTitles = getShopTabTitles(shop_type)
local imageName = getImageName(shop_type)
local introMessage = getIntroMessage(shop_type)
wGeneralshop = guiCreateWindow ( X , Y , Width , Height , shopTypeName, false )
lInstruction = guiCreateLabel ( 0, 20, 500, 15, "Double click on an item to buy it.", false, wGeneralshop )
guiLabelSetHorizontalAlign ( lInstruction,"center" )
lIntro = guiCreateLabel ( 0, 40, 500, 15,introMessage, false, wGeneralshop )
guiLabelSetHorizontalAlign ( lIntro,"center" )
guiBringToFront (lIntro)
guiSetFont ( lIntro, "default-bold-small" )
iImage = guiCreateStaticImage ( 400, 20, 90, 80,"images/"..imageName, false,wGeneralshop )
tGShopItemType = guiCreateTabPanel ( 15, 60, 470, 240, false,wGeneralshop )
items = getItemsForSale(shop_type, race, gender)
-- loop through each heading
for i = 1, #ShopTabTitles do
tGShopItemTypeTab[i] = guiCreateTab (ShopTabTitles[i], tGShopItemType)
gGShopItemTypeGrid[i] = guiCreateGridList ( 0.02, 0.05, 0.96, 0.9, true, tGShopItemTypeTab[i])
gcGShopItemTypeColumnName[i] = guiGridListAddColumn (gGShopItemTypeGrid[i],"Name", 0.25)
gcGShopItemTypeColumnPrice[i] = guiGridListAddColumn (gGShopItemTypeGrid[i] ,"Price", 0.1)
gcGShopItemTypeColumnDesc[i] = guiGridListAddColumn (gGShopItemTypeGrid[i] ,"Description", 0.62)
for y = 1, #items do
if(items[y][6] == i) then
grGShopItemTypeRow[i][y] = guiGridListAddRow (gGShopItemTypeGrid[i] )
guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y] , gcGShopItemTypeColumnName[i] ,items[y][1], false, false )
guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y] ,gcGShopItemTypeColumnPrice[i], "$"..getDiscountedPrice(items[y][3], items[y][7]), false, false )
guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y], gcGShopItemTypeColumnDesc[i] ,items[y][2], false, false)
end
end
end
guiSetInputEnabled(true)
guiSetVisible(wGeneralshop, true)
bClose = guiCreateButton(200, 315, 100, 25, "Close", false, wGeneralshop)
addEventHandler("onClientGUIClick", bClose, hideGeneralshopUI)
addEventHandler("onClientGUIDoubleClick", getRootElement(), getShopSelectedItem)
-- if player has clicked to see a skin preview
addEventHandler ( "onClientGUIClick", getRootElement(), function (button, state)
if(button == "left") then
if(iClothesPreview) then
destroyElement(iClothesPreview )
iClothesPreview = nil
end
if(shop_type == 5) then
if(source == gGShopItemTypeGrid[1]) then
if(guiGetVisible(wGeneralshop)) then
-- get the selected row
local row, column = nil
local row_temp, column_temp = guiGridListGetSelectedItem ( source )
if((row == nil) and (row_temp)) then
row = row_temp
column = column_temp
local skin = tonumber(availableskins[row+1] )
if(skin<10) then
skin = tostring("00"..skin)
elseif(skin < 100) then
skin = tostring("0"..skin)
else
skin = tostring(skin)
end
iClothesPreview = guiCreateStaticImage ( 320, 20, 100, 100, ":account-system/img/" .. skin..".png" , false , gGShopItemTypeGrid[1], accountRes)
end
end
end
end
end
end)
end
end
addEvent("showGeneralshopUI", true )
addEventHandler("showGeneralshopUI", getRootElement(), showGeneralshopUI)
function hideGeneralshopUI()
if (source==bClose) then
guiSetInputEnabled(false)
showCursor(false)
guiSetVisible(wGeneralshop, false)
destroyElement(wGeneralshop)
wGeneralshop = nil
removeEventHandler ("onClientGUIDoubleClick", getRootElement(), getShopSelectedItem )
end
end
-- function gets the shop name,
function getShopTypeName(shop_type)
if(shop_type == 1) then
return "General Store"
elseif(shop_type == 2) then
return "Gun and Ammo Store"
elseif(shop_type == 3) then
return "Food store"
elseif(shop_type == 4) then
return "Sex Shop"
elseif(shop_type == 5) then
return "Clothes Shop"
elseif(shop_type == 6) then
return "Gym"
elseif(shop_type == 7) then
return "Drug Closet"
elseif(shop_type == 8) then
return "Electronics Store"
elseif(shop_type == 9) then
return "Alcohol Store"
elseif(shop_type == 10) then
return "Book Store"
else
return "This isn't a shop. Go Away."
end
end
function getShopTabTitles(shop_type)
if(shop_type == 1) then
return {"General Items", "Consumable"}
elseif(shop_type == 2) then
return {"Guns"}
elseif(shop_type == 3) then
return {"Food","Drink"}
elseif(shop_type == 4) then
return {"Sexy"}
elseif(shop_type == 5) then
return {"Clothes"}
elseif(shop_type == 6) then
return {"Fighting Styles"}
elseif(shop_type == 7) then
return {"Chemicals"}
elseif(shop_type == 8) then
return {"Electronics"}
elseif(shop_type == 9) then
return { "Alcohol" }
elseif(shop_type == 10) then
return { "Books" }
else
return "This isn't a shop. Go Away."
end
end
function getItemsForSale(shop_type, race, gender)
local item = {}
-- { Name, Description, Price, item_id, value, heading, isWeapon, suppliesCost }
-- general store
if(shop_type == 1) then
item = {
-- General Items
{"Flowers", "A bouquet of lovely flowers.", "5", 14, 1,1, true,2},
{"Phonebook", "A large phonebook of everyones phone numbers.", "30", 7, 1,1,false,20},
{"Dice", "A black dice with white dots, perfect for gambling.", "2", 10, 1,1,false,1},
{"Golf Club", "Perfect golf club for hitting that hole-in-one.", "60", 2, 1,1,true,30},
--{"Knife", "You're only going to use this in the kitchen, right?", "50", 4, 1,1,true,40},
{"Baseball Bat", "Hit a home run with this.", "60", 5, 1,1,true,40},
{"Shovel", "Perfect tool to dig a hole.", "40", 6, 1,1,true,20},
{"Pool Cue", "For that game of pub pool.", "35", 7, 1,1,true,15},
{"Cane", "A stick has never been so classy.", "65", 15, 1,1,true,35},
{"Fire Extinguisher", "There is never one of these around when there is a fire", "50", 42, 500, 1,true,25},
{"Spray Can", "Hey, you better not tag with this punk!", "50", 41, 500, 1,true,35},
{"City Guide", "A small city guide booklet.", "15", 18, 1,1,false,7},
{"Rope", "A long rope.", "15", 46, 1,1,false,2},
{"Backpack", "A reasonably sized backpack.", "30", 48, 1,1,false,2},
{"Fishing Rod", "A 7 foot carbon steel fishing rod.", "300", 49, 1,1,false, 175},
{"Mask", "A comical mask.", "20", 56, 1, 1, false, 5},
{"Fuel Can", "A small metal fuel canister.", "35", 57, 1, 1, false, 5},
{"Blindfold", "A black blindfold.", "15", 66, 1,1, false,2},
{"Lottery Ticket", "A lottery ticket.","50", 68, 1,1, false,40},
{"First Aid Kit", "A small First Aid Kit", "15", 70, 3, 1, false, 5},
{"Notebook", "An empty Notebook, enough to write 5 notes.", "40", 71, 5, 1, false, 15},
-- Consumable
{"Sandwich", "A yummy sandwich with cheese.", "6", 8, 1,2,false,2},
{"Softdrink", "A can of Sprunk.", "3", 9, 1,2,false,1}
}
-- gun shop
elseif(shop_type == 2) then
item = {
-- guns --
{"Brass Knuckles","A pair of brass knuckles, ouch.", "100", 1, 1, 1,true,50},
{"9mm Pistol", "A silver, 9mm handgun, comes with 100 ammo.", "250", 22, 100, 1,true,200},
{"Shotgun", "A silver shotgun - comes with 30 ammo.", "450", 25, 30, 1,true,400},
--{"Uzi", "A small micro-uzi - comes with 250 ammo.", "450", 28, 250, 1,true,190},
--{"Tec-9", "A Tec-9 micro-uzi - comes with 250 ammo", "500", 32, 250, 1,true,300},
{"Country Rifle", "A country rifle - comes with 30 ammo", "750", 33, 30, 1,true,600},
{"Body Armor", "Kevlar Body armor", "500", 999, 0, 1,true,600},
{"Handcuffs", "A metal pair of handcuffs.", "90", 45, 1,1,false,2}
}
-- food + drink
elseif(shop_type == 3) then
item = {
{"Sandwich", "A yummy sandwich with cheese", "5", 8, 1, 1, false,4},
{"Taco", "A greasy mexican taco", "7", 11, 1, 1, false,3},
{"Burger", "A double cheeseburger with bacon", "6", 12, 1, 1, false,2},
{"Donut", "Hot sticky sugar covered donut", "3", 13, 1, 1, false,1},
{"Cookie", "A luxuty chocolate chip cookie", "3", 14, 1, 1, false,1},
{"Haggis", "Freshly imported from Scotland", "5", 1, 1, 1, false,1},
-- drinks
{"Softdrink", "A cold can of Sprunk.", "3", 9, 1, 2, false,1},
{"Water", "A bottle of mineral water.", "1", 15, 1, 2, false,1}
}
-- sex shop
elseif(shop_type == 4) then
item = {
-- sexy
{"Long Purple Dildo","A very large purple dildo", "20", 10, 1, 1, true,10},
{"Short Tan Dildo","A small tan dildo.", "15", 11, 1, 1, true,7},
{"Vibrator","A vibrator, what more needs to be said?", "25", 12, 1, 1, true,12},
{"Flowers","A bouquet of lovely flowers.", "5", 14, 1, 1, true,2}
}
elseif(shop_type == 5) then
availableskins = fittingskins[gender][race]
for i = 1, #availableskins do
item[i] = {"Skin "..availableskins[i] , "MTA Skin id "..availableskins[i]..".", "50", 92, availableskins[i], 1}
end
-- gym
elseif(shop_type == 6) then
item = {
{"Standard Combat","Standard everyday fighting.", "10", 4, -1, 1, true, 5},
{"Boxing","Mike Tyson, on drugs.", "50", 5, -1, 1, true, 25},
{"Kung Fu","I know kung-fu, so can you.", "50", 6, -1, 1, true, 25},
{"Knee Head","Ever had a knee to the head? Pretty sore.", "50", 7, -1, 1, true, 25},
{"Grab & Kick","Kick his 'ead in!", "50", 15, -1, 1, true, 25},
{"Elbows","You may look retarded, but you will kick his ass!", "50", 16, -1, 1, true, 25}
}
-- drugs/chemicals
elseif(shop_type == 7) then
item = {
{"Cannabis Sativa","A chemical used to make drugs.", "0", 30, 1, 1, false,0},
{"Cocaine Alkaloid","A chemical used to make drugs.", "0", 31, 1, 1, false,0},
{"Lysergic Acid","A chemical used to make drugs.", "0", 32, 1, 1, false,0},
{"Unprocessed PCP","A chemical used to make drugs.", "0", 33, 1, 1, false,0}
}
-- electronics
elseif(shop_type == 8) then
item = {
{"Ghettoblaster","A black ghettoblaster.", "250", 54, 1, 1, false,10},
{"Katana", "Your favourite Japanese sword.", "2000", 8, 1, 1,true,100},
{"Camera", "A small black analogue camera.", "75", 43, 25,1,true, 30},
{"Cellphone", "A stylish, slim cell phone.", "75", 2, 1,1,false,50},
{"Radio", "A black radio.", "50", 6, 1,1,false,30},
{"Watch", "Telling the time was never so sexy!", "25", 17, 1, 1,false,10},
{"MP3 Player", "A white, sleek looking MP3 Player. The brand reads EyePod.", "120", 19, 1,1,false,7},
{"Chemistry Set", "A small chemistry set.", "2000", 44, 1,1,false,15},
{"Safe", "A Safe to store your items in.", "300", 60, 1,1,false,0},
{"GPS", "A GPS Satnav for a car.", "300", 67, 1,1,false,0}
}
-- alcohol shop
elseif(shop_type == 9) then
item = {
{"Ziebrand Beer","The finest beer, imported from Holland.", "10", 58, 1, 1, false, 2},
{ "Bastradov Vodka", "For your best friends - Bastradov Vodka.", "25", 62, 1, 1, false, 5},
{ "Scottish Whiskey", "The Best Scottish Whiskey, now exclusively made from Haggis.", "15", 63, 1, 1, false, 4 },
{"Softdrink", "A cold can of Sprunk.", "3", 9, 1, 1, false,1}
}
-- book shop
elseif(shop_type == 10) then
item = {
{"City Guide", "A small city guide booklet.", "15", 18, 1,1,false,7},
{"Los Santos Highway Code", "A paperback book.", "10", 50, 1, 1, false, 5},
{"Chemistry 101", "A hardback academic book.", "20", 51, 1, 1, false, 10},
{"English Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 1, 1, false, 2},
{"Russian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 2, 1, false, 2},
{"German Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 3, 1, false, 2},
{"French Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 4, 1, false, 2},
{"Dutch Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 5, 1, false, 2},
{"Italian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 6, 1, false, 2},
{"Spanish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 7, 1, false, 2},
{"Gaelic Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 8, 1, false, 2},
{"Japanese Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 9, 1, false, 2},
{"Chinese Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 10, 1, false, 2},
{"Arabic Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 11, 1, false, 2},
{"Norwegian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 12, 1, false, 2},
{"Swedish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 13, 1, false, 2},
{"Danish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 14, 1, false, 2},
{"Welsh Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 15, 1, false, 2},
{"Hungarian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 16, 1, false, 2},
{"Bosnian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 17, 1, false, 2},
{"Somalian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 18, 1, false, 2},
{"Finnish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 19, 1, false, 2},
{"Georgian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 20, 1, false, 2},
{"Greek Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 21, 1, false, 2},
{"Polish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 22, 1, false, 2},
{"Portugeese Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 23, 1, false, 2},
{"Turkish Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 24, 1, false, 2},
{"Estonian Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 25, 1, false, 2},
{"Korean Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 26, 1, false, 2},
{"Vietnamese Dictionary","A Dictionary, useful for learning lingo.", "25", 69, 27, 1, false, 2}
}
end
return item
end
function getImageName(shop_type)
if(shop_type == 1) then
return "general.png"
elseif(shop_type == 2) then
return "gun.png"
elseif(shop_type == 3) then
return "food.png"
elseif(shop_type == 4) then
return "sex.png"
elseif(shop_type == 5) then
return "clothes.png"
elseif(shop_type == 6) then
return "general.png"
elseif(shop_type == 7) then
return "general.png"
elseif(shop_type == 8) then
return "general.png"
elseif(shop_type == 9) then
return "general.png"
elseif(shop_type == 10) then
return "general.png"
else
return "This isn't a shop. Go Away."
end
end
function getIntroMessage(shop_type)
if(shop_type == 1) then
return "This shops sells all kind of general purpose items."
elseif(shop_type == 2) then
return "This shop specialises in weapons and amunition."
elseif(shop_type == 3) then
return "Buy all your food and drink here."
elseif(shop_type == 4) then
return "All of the items you'll need for the perfect night in."
elseif(shop_type == 5) then
return "We've picked out some clothes that we think will suit you."
elseif(shop_type == 6) then
return "This gym is the best in town for hand-to-hand combat."
elseif(shop_type == 7) then
return "You thief!"
elseif(shop_type == 8) then
return "We've got the latest technology just for you."
elseif(shop_type == 9) then
return "We got everything from Buckfast to Moet."
elseif(shop_type == 10) then
return "You wanna speak Ruski?."
else
return "This isn't a shop. Go Away."
end
end
function getShopSelectedItem(button, state)
if(button == "left") then
if(guiGetVisible(wGeneralshop)) then
-- get the selected row
local row, column = nil
local row_temp, column_temp = guiGridListGetSelectedItem ( source )
if((row == nil) and (row_temp)) then
row = row_temp
column = column_temp
-- get the name of the item just brought
local name = tostring(guiGridListGetItemText ( source, row_temp,1 ))
-- find out which item it was in the list
for i = 1, #items do
if(items[i][1] == name) then
local id = items[i][4]
local value = items[i][5]
local isWeapon = items[i][7]
local price = getDiscountedPrice(tonumber(items[i][3]), isWeapon)
local name = items[i][1]
local supplyCost = items[i][8]
if isWeapon and getWeaponNameFromID(tonumber(id)) then
price = tonumber(price)
id = tonumber(id)
value = tonumber(value)
local free, totalfree = exports.weaponcap:getFreeAmmo( id )
local cap = exports.weaponcap:getAmmoCap( id )
if totalfree == 0 then
outputChatBox( "You've got all weapons you can carry.", 255, 0, 0 )
return
elseif free == 0 and cap == 0 then
local weaponName = "other weapon"
local slot = getSlotFromWeapon( id )
if slot and slot ~= 0 and getPedTotalAmmo( getLocalPlayer(), slot ) > 0 then
local weapon = getPedWeapon( getLocalPlayer(), slot )
weaponName = getWeaponNameFromID( weapon )
end
outputChatBox( "You don't carry that weapon, please drop your " .. weaponName .. " first.", 255, 0, 0 )
return
elseif free == 0 then
outputChatBox( "You can't carry any more of that weapon.", 255, 0, 0 )
return
elseif value > free then -- aint got enough free stuff on that slot, so we reduce the value and price
price = math.ceil( price * free / value )
value = free
end
end
triggerServerEvent("ItemBought", getLocalPlayer(), id, value, price, isWeapon, name, supplyCost)
end
end
end
end
end
end
| bsd-3-clause |
linushsao/marsu_game-linus-v0.2 | mods/technical/technic/technic/tools/mining_lasers.lua | 3 | 3574 | local mining_lasers_list = {
-- {<num>, <range of the laser shots>, <max_charge>, <charge_per_shot>},
{"1", 7, 50000, 1000},
{"2", 14, 200000, 2000},
{"3", 21, 650000, 3000},
}
local S = technic.getter
minetest.register_craft({
output = 'technic:laser_mk1',
recipe = {
{'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'},
{'', 'technic:brass_ingot', 'technic:red_energy_crystal'},
{'', '', 'default:copper_ingot'},
}
})
minetest.register_craft({
output = 'technic:laser_mk2',
recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'},
{'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'},
{'', '', 'default:copper_ingot'},
}
})
minetest.register_craft({
output = 'technic:laser_mk3',
recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'},
{'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'},
{'', '', 'default:copper_ingot'},
}
})
local function laser_node(pos, node, player)
local def = minetest.registered_nodes[node.name]
if def and def.liquidtype ~= "none" then
minetest.remove_node(pos)
minetest.add_particle({
pos = pos,
velocity = {x=0, y=2, z=0},
acceleration = {x=0, y=-1, z=0},
expirationtime = 1.5,
size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7),
})
return
end
minetest.node_dig(pos, node, player)
end
local no_destroy = {
["air"] = true,
["default:lava_source"] = true,
["default:lava_flowing"] = true,
}
local function laser_shoot(player, range, particle_texture, sound)
local player_pos = player:getpos()
local player_name = player:get_player_name()
local dir = player:get_look_dir()
local start_pos = vector.new(player_pos)
-- Adjust to head height
start_pos.y = start_pos.y + 1.6
minetest.add_particle({
pos = startpos,
velocity = dir,
acceleration = vector.multiply(dir, 50),
expirationtime = range / 11,
size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7),
})
minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range})
for pos in technic.trace_node_ray_fat(start_pos, dir, range) do
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
break
end
local node = minetest.get_node_or_nil(pos)
if not node then
break
end
if not no_destroy[node.name] then
laser_node(pos, node, player)
end
end
end
for _, m in pairs(mining_lasers_list) do
technic.register_power_tool("technic:laser_mk"..m[1], m[3])
minetest.register_tool("technic:laser_mk"..m[1], {
description = S("Mining Laser Mk%d"):format(m[1]),
inventory_image = "technic_mining_laser_mk"..m[1]..".png",
stack_max = 1,
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user)
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge then
return
end
-- If there's enough charge left, fire the laser
if meta.charge >= m[4] then
laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1])
if not technic.creative_mode then
meta.charge = meta.charge - m[4]
technic.set_RE_wear(itemstack, meta.charge, m[3])
itemstack:set_metadata(minetest.serialize(meta))
end
end
return itemstack
end,
})
end
| gpl-3.0 |
mercury233/ygopro-scripts | c48092532.lua | 2 | 1711 | --異次元の生還者
function c48092532.initial_effect(c)
--removed
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_REMOVE)
e1:SetCondition(c48092532.rmcon)
e1:SetOperation(c48092532.rmop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(48092532,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_REMOVED)
e2:SetCondition(c48092532.condition)
e2:SetTarget(c48092532.target)
e2:SetOperation(c48092532.operation)
c:RegisterEffect(e2)
end
function c48092532.rmcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsFaceup() and c:IsPreviousPosition(POS_FACEUP)
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
end
function c48092532.rmop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(48092532,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function c48092532.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(48092532)~=0
end
function c48092532.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(48092533)==0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(48092533,RESET_EVENT+0x4760000+RESET_PHASE+PHASE_END,0,1)
end
function c48092532.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
return
end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Southern_San_dOria/npcs/Ailevia.lua | 30 | 1902 | -----------------------------------
-- Area: Southern San d'Oria
-- NPC: Ailevia
-- Adventurer's Assistant
-- Only recieving Adv.Coupon and simple talk event are scripted
-- This NPC participates in Quests and Missions
-- @zone 230
-- @pos -8 1 1
-------------------------------------
package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Southern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
--Adventurer coupon
if (trade:getItemCount() == 1 and trade:hasItemQty(0x218,1) == true) then
player:startEvent(0x028f);
end
-- "Flyers for Regine" conditional script
count = trade:getItemCount();
MagicFlyer = trade:hasItemQty(532,1);
if (MagicFlyer == true and count == 1) then
FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE);
if (FlyerForRegine == 1) then
player:messageSpecial(FLYER_REFUSED);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0267); -- i know a thing or 2 about these streets
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 == 0x028f) then
player:addGil(GIL_RATE*50);
player:tradeComplete();
player:messageSpecial(GIL_OBTAINED,GIL_RATE*50);
end
end;
| gpl-3.0 |
mercury233/ygopro-scripts | c85457355.lua | 2 | 3405 | --変容王 ヘル・ゲル
function c85457355.initial_effect(c)
--lv
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(85457355,0))
e1:SetCategory(CATEGORY_RECOVER)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,85457355)
e1:SetTarget(c85457355.lvtg)
e1:SetOperation(c85457355.lvop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(85457355,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,85457356)
e3:SetTarget(c85457355.sptg)
e3:SetOperation(c85457355.spop)
c:RegisterEffect(e3)
end
function c85457355.lvfilter(c,lv)
return c:IsFaceup() and c:IsLevelAbove(1) and not c:IsLevel(lv)
end
function c85457355.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c85457355.lvfilter(chkc) and chkc~=e:GetHandler() end
local lv=e:GetHandler():GetLevel()
if chk==0 then return Duel.IsExistingTarget(c85457355.lvfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler(),lv)
and e:GetHandler():IsLevelAbove(1) and e:GetHandler():IsRelateToEffect(e) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c85457355.lvfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetHandler(),lv)
local rec=g:GetFirst():GetLevel()*200
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,rec)
end
function c85457355.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local lv=tc:GetLevel()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(lv)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
Duel.Recover(tp,lv*200,REASON_EFFECT)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(c85457355.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c85457355.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
end
function c85457355.spfilter(c,e,tp,lv)
return c:IsRace(RACE_FIEND) and c:IsLevelBelow(lv-1) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c85457355.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local lv=e:GetHandler():GetLevel()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsLevelAbove(2) and Duel.IsExistingMatchingCard(c85457355.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,lv) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c85457355.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if c:IsFaceup() and c:IsLevelAbove(2) then
local lv=c:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c85457355.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,lv)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c87116928.lua | 3 | 1490 | --キメラテック・メガフリート・ドラゴン
function c87116928.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunFunRep(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x1093),c87116928.matfilter,1,63,true)
aux.AddContactFusionProcedure(c,c87116928.cfilter,LOCATION_MZONE,LOCATION_MZONE,c87116928.sprop(c))
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c87116928.splimit)
c:RegisterEffect(e1)
--cannot be fusion material
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(1)
c:RegisterEffect(e3)
end
c87116928.material_setcode=0x1093
function c87116928.matfilter(c)
return c:GetSequence()>4
end
function c87116928.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function c87116928.cfilter(c,fc)
return c:IsAbleToGraveAsCost() and (c:IsControler(fc:GetControler()) or c:IsFaceup())
end
function c87116928.sprop(c)
return function(g)
Duel.SendtoGrave(g,REASON_COST)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetReset(RESET_EVENT+0xff0000)
e1:SetValue(g:GetCount()*1200)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c80604091.lua | 2 | 3257 | --血の代償
function c80604091.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c80604091.cost1)
e1:SetTarget(c80604091.target1)
e1:SetOperation(c80604091.activate1)
c:RegisterEffect(e1)
--instant
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(80604091,0))
e3:SetCategory(CATEGORY_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetCondition(c80604091.condition2)
e3:SetCost(c80604091.cost2)
e3:SetTarget(c80604091.target2)
e3:SetOperation(c80604091.activate2)
c:RegisterEffect(e3)
end
function c80604091.filter(c)
return c:IsSummonable(true,nil) or c:IsMSetable(true,nil)
end
function c80604091.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
local tn=Duel.GetTurnPlayer()
local ph=Duel.GetCurrentPhase()
if ((tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)) or (tn~=tp and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE))
and Duel.CheckLPCost(tp,500)
and Duel.IsExistingMatchingCard(c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(80604091,1)) then
Duel.PayLPCost(tp,500)
e:SetLabel(1)
end
end
function c80604091.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetLabel()~=1 then return end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c80604091.activate1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()~=1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil) end
end
end
function c80604091.condition2(e,tp,eg,ep,ev,re,r,rp)
local tn=Duel.GetTurnPlayer()
local ph=Duel.GetCurrentPhase()
return (tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)) or (tn~=tp and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)
end
function c80604091.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,500)
else Duel.PayLPCost(tp,500) end
end
function c80604091.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if not e:GetHandler():IsStatus(STATUS_CHAINING) then
local ct=Duel.GetMatchingGroupCount(c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
e:SetLabel(ct)
return ct>0
else return e:GetLabel()>0 end
end
e:SetLabel(e:GetLabel()-1)
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c80604091.activate2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if tc then
local s1=tc:IsSummonable(true,nil)
local s2=tc:IsMSetable(true,nil)
if (s1 and s2 and Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) or not s2 then
Duel.Summon(tp,tc,true,nil)
else
Duel.MSet(tp,tc,true,nil)
end
end
end
| gpl-2.0 |
qq779089973/my_openwrt_mod | luci/libs/core/luasrc/ccache.lua | 82 | 1863 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local io = require "io"
local fs = require "nixio.fs"
local util = require "luci.util"
local nixio = require "nixio"
local debug = require "debug"
local string = require "string"
local package = require "package"
local type, loadfile = type, loadfile
module "luci.ccache"
function cache_ondemand(...)
if debug.getinfo(1, 'S').source ~= "=?" then
cache_enable(...)
end
end
function cache_enable(cachepath, mode)
cachepath = cachepath or "/tmp/luci-modulecache"
mode = mode or "r--r--r--"
local loader = package.loaders[2]
local uid = nixio.getuid()
if not fs.stat(cachepath) then
fs.mkdir(cachepath)
end
local function _encode_filename(name)
local encoded = ""
for i=1, #name do
encoded = encoded .. ("%2X" % string.byte(name, i))
end
return encoded
end
local function _load_sane(file)
local stat = fs.stat(file)
if stat and stat.uid == uid and stat.modestr == mode then
return loadfile(file)
end
end
local function _write_sane(file, func)
if nixio.getuid() == uid then
local fp = io.open(file, "w")
if fp then
fp:write(util.get_bytecode(func))
fp:close()
fs.chmod(file, mode)
end
end
end
package.loaders[2] = function(mod)
local encoded = cachepath .. "/" .. _encode_filename(mod)
local modcons = _load_sane(encoded)
if modcons then
return modcons
end
-- No cachefile
modcons = loader(mod)
if type(modcons) == "function" then
_write_sane(encoded, modcons)
end
return modcons
end
end
| mit |
ajayk/kong | kong/cli/cmds/cluster.lua | 3 | 1433 | #!/usr/bin/env luajit
local constants = require "kong.constants"
local logger = require "kong.cli.utils.logger"
local utils = require "kong.tools.utils"
local config_loader = require "kong.tools.config_loader"
local Serf = require "kong.cli.services.serf"
local lapp = require("lapp")
local args = lapp(string.format([[
Kong cluster operations.
Usage: kong cluster <command> <args> [options]
Commands:
<command> (string) where <command> is one of:
members, force-leave, reachability, keygen
Options:
-c,--config (default %s) path to configuration file
]], constants.CLI.GLOBAL_KONG_CONF))
local KEYGEN = "keygen"
local FORCE_LEAVE = "force-leave"
local SUPPORTED_COMMANDS = {"members", KEYGEN, "reachability", FORCE_LEAVE}
if not utils.table_contains(SUPPORTED_COMMANDS, args.command) then
lapp.quit("Invalid cluster command. Supported commands are: "..table.concat(SUPPORTED_COMMANDS, ", "))
end
local configuration = config_loader.load_default(args.config)
local signal = args.command
args.command = nil
args.config = nil
local skip_running_check
if signal == FORCE_LEAVE and utils.table_size(args) ~= 1 then
logger:error("You must specify a node name")
os.exit(1)
elseif signal == KEYGEN then
skip_running_check = true
end
local res, err = Serf(configuration):invoke_signal(signal, args, false, skip_running_check)
if err then
logger:error(err)
os.exit(1)
end
logger:print(res)
| apache-2.0 |
mercury233/ygopro-scripts | c15941690.lua | 2 | 1913 | --先史遺産クリスタル・ボーン
function c15941690.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c15941690.hspcon)
e1:SetValue(SUMMON_VALUE_SELF)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(15941690,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c15941690.spcon)
e2:SetTarget(c15941690.sptg)
e2:SetOperation(c15941690.spop)
c:RegisterEffect(e2)
end
function c15941690.hspcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c15941690.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+SUMMON_VALUE_SELF
end
function c15941690.filter(c,e,tp)
return c:IsSetCard(0x70) and not c:IsCode(15941690) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c15941690.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c15941690.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c15941690.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c15941690.filter),tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c9622164.lua | 2 | 2265 | --D・D・R
function c9622164.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCost(c9622164.cost)
e1:SetTarget(c9622164.target)
e1:SetOperation(c9622164.operation)
c:RegisterEffect(e1)
--Destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetOperation(c9622164.desop)
c:RegisterEffect(e2)
end
function c9622164.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c9622164.filter(c,e,tp)
return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK)
end
function c9622164.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c9622164.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c9622164.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c9622164.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c9622164.eqlimit(e,c)
return e:GetOwner()==c
end
function c9622164.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK)==0 then return end
Duel.Equip(tp,c,tc)
--Add Equip limit
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(c9622164.eqlimit)
c:RegisterEffect(e1)
end
end
function c9622164.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
if tc and tc:IsLocation(LOCATION_MZONE) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
noname007/koreader | frontend/device/kindle/event_map_keyboard.lua | 11 | 1343 | --[[
event map for Kindle devices with an alphabetic and/or alphanumeric keyboard
--]]
return {
[2] = "1", [3] = "2", [4] = "3", [5] = "4", [6] = "5", [7] = "6", [8] = "7", [9] = "8", [10] = "9", [11] = "0",
[16] = "Q", [17] = "W", [18] = "E", [19] = "R", [20] = "T", [21] = "Y", [22] = "U", [23] = "I", [24] = "O", [25] = "P",
[30] = "A", [31] = "S", [32] = "D", [33] = "F", [34] = "G", [35] = "H", [36] = "J", [37] = "K", [38] = "L", [14] = "Del",
[44] = "Z", [45] = "X", [46] = "C", [47] = "V", [48] = "B", [49] = "N", [50] = "M", [52] = ".", [53] = "/", -- only KDX
[28] = "Enter",
[42] = "Shift",
[56] = "Alt",
[57] = " ",
[90] = "AA", -- KDX
[91] = "Back", -- KDX
[92] = "Press", -- KDX
[94] = "Sym", -- KDX
[98] = "Home", -- KDX
[102] = "Home", -- K[3] & k[4]
[104] = "LPgBack", -- K[3] only
[103] = "Up", -- K[3] & k[4]
[105] = "Left",
[106] = "Right",
[108] = "Down", -- K[3] & k[4]
[109] = "RPgBack",
[114] = "VMinus",
[115] = "VPlus",
[122] = "Up", -- KDX
[123] = "Down", -- KDX
[124] = "RPgFwd", -- KDX
[126] = "Sym", -- K[3]
[139] = "Menu",
[158] = "Back", -- K[3] & K[4]
[190] = "AA", -- K[3]
[191] = "RPgFwd", -- K[3] & k[4]
[193] = "LPgFwd", -- K[3] only
[194] = "Press", -- K[3] & k[4]
}
| agpl-3.0 |
mercury233/ygopro-scripts | c54828837.lua | 2 | 2921 | --失楽の霹靂
function c54828837.initial_effect(c)
aux.AddCodeList(c,6007213,32491822,69890967)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--alternate summon proc
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(54828837)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(1,0)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DISABLE+CATEGORY_POSITION)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAIN_SOLVING)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c54828837.negcon)
e3:SetOperation(c54828837.negop)
c:RegisterEffect(e3)
--damage protection
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(54828837,1))
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetCondition(c54828837.protcon)
e4:SetOperation(c54828837.protop)
c:RegisterEffect(e4)
end
function c54828837.cfilter(c)
return c:IsFaceup() and c:IsCode(32491822) and c:IsAttackPos()
end
function c54828837.negcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c54828837.cfilter,tp,LOCATION_MZONE,0,1,nil)
and rp==1-tp and re:IsActiveType(TYPE_SPELL+TYPE_TRAP)
and Duel.IsChainDisablable(ev) and not Duel.IsChainDisabled(ev)
and e:GetHandler():GetFlagEffect(54828837)<=0
end
function c54828837.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=re:GetHandler()
if Duel.SelectEffectYesNo(tp,c) then
Duel.Hint(HINT_CARD,0,54828837)
if Duel.NegateEffect(ev) and Duel.IsExistingMatchingCard(c54828837.cfilter,tp,LOCATION_MZONE,0,1,nil) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectMatchingCard(tp,c54828837.cfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.HintSelection(g)
Duel.ChangePosition(g:GetFirst(),POS_FACEUP_DEFENSE)
end
c:RegisterFlagEffect(54828837,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end
function c54828837.protfilter(c,tp)
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp)
and (c:GetPreviousCodeOnField()==32491822 or c:GetPreviousCodeOnField()==6007213 or c:GetPreviousCodeOnField()==69890967)
end
function c54828837.protcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c54828837.protfilter,1,nil,tp)
end
function c54828837.protop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetTargetRange(1,0)
e1:SetValue(0)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.