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 |
|---|---|---|---|---|---|
Zenny89/darkstar | scripts/zones/Metalworks/npcs/Ghemp.lua | 24 | 2139 | -----------------------------------
-- Area: Metalworks
-- NPC: Ghemp
-- Type: Smithing Guild Master
-- @pos -109 2 27 237
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/crafting");
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local newRank = tradeTestItem(player,npc,trade,SKILL_SMITHING);
if (newRank ~= 0) then
player:setSkillRank(SKILL_SMITHING,newRank);
player:startEvent(0x0066,0,0,0,0,newRank);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local getNewRank = 0;
local craftSkill = player:getSkillLevel(SKILL_SMITHING);
local testItem = getTestItem(player,npc,SKILL_SMITHING);
local guildMember = isGuildMember(player,8);
if (guildMember == 1) then guildMember = 150995375; end
if (canGetNewRank(player,craftSkill,SKILL_SMITHING) == 1) then getNewRank = 100; end
player:startEvent(0x0065,testItem,getNewRank,30,guildMember,44,0,0,0);
end;
-- 0x038c 0x038d 0x038e 0x0398 0x039f 0x0065 0x0066
-----------------------------------
-- 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 == 0x0065 and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4096);
else
player:addItem(4096);
player:messageSpecial(ITEM_OBTAINED,4096); -- Fire Crystal
signupGuild(player,256);
end
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c64804316.lua | 2 | 3210 | --ゴーストリック・セイレーン
function c64804316.initial_effect(c)
--summon limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetCondition(c64804316.sumcon)
c:RegisterEffect(e1)
--discard deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64804316,0))
e2:SetCategory(CATEGORY_DECKDES+CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_POSITION)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(c64804316.distg)
e2:SetOperation(c64804316.disop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_FLIP)
c:RegisterEffect(e3)
--turn set
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_POSITION)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetTarget(c64804316.postg)
e4:SetOperation(c64804316.posop)
c:RegisterEffect(e4)
end
function c64804316.sfilter(c)
return c:IsFaceup() and c:IsSetCard(0x8d)
end
function c64804316.sumcon(e)
return not Duel.IsExistingMatchingCard(c64804316.sfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c64804316.distg(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 c64804316.cfilter(c)
return c:IsLocation(LOCATION_GRAVE) and c:IsSetCard(0x8d)
end
function c64804316.thfilter(c)
return c:IsSetCard(0x8d) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c64804316.stfilter(c)
return c:IsType(TYPE_EFFECT) and c:IsFaceup() and c:IsCanTurnSet()
end
function c64804316.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(tp,2,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
local ct=g:FilterCount(c64804316.cfilter,nil)
if ct>0 then
local b1=Duel.IsExistingMatchingCard(c64804316.thfilter,tp,LOCATION_DECK,0,1,nil)
local b2=Duel.IsExistingMatchingCard(c64804316.stfilter,tp,0,LOCATION_MZONE,1,nil)
local off=1
local ops,opval={},{}
if b1 then
ops[off]=aux.Stringid(64804316,1)
opval[off]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(64804316,2)
opval[off]=2
off=off+1
end
ops[off]=aux.Stringid(64804316,3)
opval[off]=0
local op=Duel.SelectOption(tp,table.unpack(ops))+1
local sel=opval[op]
if sel==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=Duel.SelectMatchingCard(tp,c64804316.thfilter,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
elseif sel==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local sg=Duel.SelectMatchingCard(tp,c64804316.stfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.HintSelection(sg)
Duel.ChangePosition(sg,POS_FACEDOWN_DEFENSE)
end
end
end
function c64804316.postg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(64804316)==0 end
c:RegisterFlagEffect(64804316,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0)
end
function c64804316.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c92223641.lua | 2 | 1372 | --天空の泉
function c92223641.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--adjust
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_RECOVER)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetRange(LOCATION_SZONE)
e2:SetCost(c92223641.cost)
e2:SetTarget(c92223641.tg)
e2:SetOperation(c92223641.op)
c:RegisterEffect(e2)
end
function c92223641.filter(g,tp)
local c=g:GetFirst()
if c:IsControler(1-tp) then c=g:GetNext() end
if c and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLocation(LOCATION_GRAVE) then return c end
return nil
end
function c92223641.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local rc=c92223641.filter(eg,tp)
return rc and rc:IsAbleToRemoveAsCost()
end
local rc=c92223641.filter(eg,tp)
e:SetLabel(rc:GetAttack())
Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)
end
function c92223641.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(e:GetLabel())
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,e:GetLabel())
end
function c92223641.op(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
| gpl-2.0 |
valhallaGaming/uno | src_trunk/resources/freecam/freecam.lua | 2 | 10479 | -- state variables
local speed = 0
local strafespeed = 0
local rotX, rotY = 0,0
local velocityX, velocityY, velocityZ
local startX, startY, startZ
-- configurable parameters
local options = {
invertMouseLook = false,
normalMaxSpeed = 2,
slowMaxSpeed = 0.2,
fastMaxSpeed = 12,
smoothMovement = true,
acceleration = 0.3,
decceleration = 0.15,
mouseSensitivity = 0.3,
maxYAngle = 188,
key_fastMove = "lshift",
key_slowMove = "lalt",
key_forward = "w",
key_backward = "s",
key_left = "a",
key_right = "d"
}
local mouseFrameDelay = 0
local rootElement = getRootElement()
local localPlayer = getLocalPlayer()
local getKeyState = getKeyState
do
local mta_getKeyState = getKeyState
function getKeyState(key)
if isMTAWindowActive() then
return false
else
return mta_getKeyState(key)
end
end
end
-- PRIVATE
local function freecamFrame ()
-- work out an angle in radians based on the number of pixels the cursor has moved (ever)
local cameraAngleX = rotX
local cameraAngleY = rotY
local freeModeAngleZ = math.sin(cameraAngleY)
local freeModeAngleY = math.cos(cameraAngleY) * math.cos(cameraAngleX)
local freeModeAngleX = math.cos(cameraAngleY) * math.sin(cameraAngleX)
local camPosX, camPosY, camPosZ = getCameraMatrix()
-- calculate a target based on the current position and an offset based on the angle
local camTargetX = camPosX + freeModeAngleX * 100
local camTargetY = camPosY + freeModeAngleY * 100
local camTargetZ = camPosZ + freeModeAngleZ * 100
-- Calculate what the maximum speed that the camera should be able to move at.
local mspeed = options.normalMaxSpeed
if getKeyState ( options.key_fastMove ) then
mspeed = options.fastMaxSpeed
elseif getKeyState ( options.key_slowMove ) then
mspeed = options.slowMaxSpeed
end
if options.smoothMovement then
local acceleration = options.acceleration
local decceleration = options.decceleration
-- Check to see if the forwards/backwards keys are pressed
local speedKeyPressed = false
if getKeyState ( options.key_forward ) then
speed = speed + acceleration
speedKeyPressed = true
end
if getKeyState ( options.key_backward ) then
speed = speed - acceleration
speedKeyPressed = true
end
-- Check to see if the strafe keys are pressed
local strafeSpeedKeyPressed = false
if getKeyState ( options.key_right ) then
if strafespeed > 0 then -- for instance response
strafespeed = 0
end
strafespeed = strafespeed - acceleration / 2
strafeSpeedKeyPressed = true
end
if getKeyState ( options.key_left ) then
if strafespeed < 0 then -- for instance response
strafespeed = 0
end
strafespeed = strafespeed + acceleration / 2
strafeSpeedKeyPressed = true
end
-- If no forwards/backwards keys were pressed, then gradually slow down the movement towards 0
if speedKeyPressed ~= true then
if speed > 0 then
speed = speed - decceleration
elseif speed < 0 then
speed = speed + decceleration
end
end
-- If no strafe keys were pressed, then gradually slow down the movement towards 0
if strafeSpeedKeyPressed ~= true then
if strafespeed > 0 then
strafespeed = strafespeed - decceleration
elseif strafespeed < 0 then
strafespeed = strafespeed + decceleration
end
end
-- Check the ranges of values - set the speed to 0 if its very close to 0 (stops jittering), and limit to the maximum speed
if speed > -decceleration and speed < decceleration then
speed = 0
elseif speed > mspeed then
speed = mspeed
elseif speed < -mspeed then
speed = -mspeed
end
if strafespeed > -(acceleration / 2) and strafespeed < (acceleration / 2) then
strafespeed = 0
elseif strafespeed > mspeed then
strafespeed = mspeed
elseif strafespeed < -mspeed then
strafespeed = -mspeed
end
else
speed = 0
strafespeed = 0
if getKeyState ( options.key_forward ) then speed = mspeed end
if getKeyState ( options.key_backward ) then speed = -mspeed end
if getKeyState ( options.key_left ) then strafespeed = mspeed end
if getKeyState ( options.key_right ) then strafespeed = -mspeed end
end
-- Work out the distance between the target and the camera (should be 100 units)
local camAngleX = camPosX - camTargetX
local camAngleY = camPosY - camTargetY
local camAngleZ = 0 -- we ignore this otherwise our vertical angle affects how fast you can strafe
-- Calulcate the length of the vector
local angleLength = math.sqrt(camAngleX*camAngleX+camAngleY*camAngleY+camAngleZ*camAngleZ)
-- Normalize the vector, ignoring the Z axis, as the camera is stuck to the XY plane (it can't roll)
local camNormalizedAngleX = camAngleX / angleLength
local camNormalizedAngleY = camAngleY / angleLength
local camNormalizedAngleZ = 0
-- We use this as our rotation vector
local normalAngleX = 0
local normalAngleY = 0
local normalAngleZ = 1
-- Perform a cross product with the rotation vector and the normalzied angle
local normalX = (camNormalizedAngleY * normalAngleZ - camNormalizedAngleZ * normalAngleY)
local normalY = (camNormalizedAngleZ * normalAngleX - camNormalizedAngleX * normalAngleZ)
local normalZ = (camNormalizedAngleX * normalAngleY - camNormalizedAngleY * normalAngleX)
-- Update the camera position based on the forwards/backwards speed
camPosX = camPosX + freeModeAngleX * speed
camPosY = camPosY + freeModeAngleY * speed
camPosZ = camPosZ + freeModeAngleZ * speed
-- Update the camera position based on the strafe speed
camPosX = camPosX + normalX * strafespeed
camPosY = camPosY + normalY * strafespeed
camPosZ = camPosZ + normalZ * strafespeed
--Store the velocity
velocityX = (freeModeAngleX * speed) + (normalX * strafespeed)
velocityY = (freeModeAngleY * speed) + (normalY * strafespeed)
velocityZ = (freeModeAngleZ * speed) + (normalZ * strafespeed)
-- Update the target based on the new camera position (again, otherwise the camera kind of sways as the target is out by a frame)
camTargetX = camPosX + freeModeAngleX * 100
camTargetY = camPosY + freeModeAngleY * 100
camTargetZ = camPosZ + freeModeAngleZ * 100
-- Set the new camera position and target
setCameraMatrix ( camPosX, camPosY, camPosZ, camTargetX, camTargetY, camTargetZ )
setElementPosition ( localPlayer, camPosX, camPosY, camPosZ )
end
local function freecamMouse (cX,cY,aX,aY)
--ignore mouse movement if the cursor or MTA window is on
--and do not resume it until at least 5 frames after it is toggled off
--(prevents cursor mousemove data from reaching this handler)
if isCursorShowing() or isMTAWindowActive() then
mouseFrameDelay = 5
return
elseif mouseFrameDelay > 0 then
mouseFrameDelay = mouseFrameDelay - 1
return
end
-- how far have we moved the mouse from the screen center?
local width, height = guiGetScreenSize()
aX = aX - width / 2
aY = aY - height / 2
--invert the mouse look if specified
if options.invertMouseLook then
aY = -aY
end
rotX = rotX + aX * options.mouseSensitivity * 0.01745
rotY = rotY - aY * options.mouseSensitivity * 0.01745
local PI = math.pi
if rotX > PI then
rotX = rotX - 2 * PI
elseif rotX < -PI then
rotX = rotX + 2 * PI
end
if rotY > PI then
rotY = rotY - 2 * PI
elseif rotY < -PI then
rotY = rotY + 2 * PI
end
-- limit the camera to stop it going too far up or down - PI/2 is the limit, but we can't let it quite reach that or it will lock up
-- and strafeing will break entirely as the camera loses any concept of what is 'up'
if rotY < -PI / 2.05 then
rotY = -PI / 2.05
elseif rotY > PI / 2.05 then
rotY = PI / 2.05
end
end
-- PUBLIC
function getFreecamVelocity()
return velocityX,velocityY,velocityZ
end
-- params: x, y, z sets camera's position (optional)
function setFreecamEnabled (x, y, z)
startX, startY, startZ = getElementPosition(localPlayer)
addEventHandler("onClientRender", rootElement, freecamFrame)
addEventHandler("onClientCursorMove",rootElement, freecamMouse)
setElementData(localPlayer, "freecam:state", true)
setPedWeaponSlot(localPlayer, 0)
toggleAllControls(false, true, false)
return true
end
-- param: dontChangeFixedMode leaves toggleCameraFixedMode alone if true, disables it if false or nil (optional)
function setFreecamDisabled()
velocityX,velocityY,velocityZ = 0,0,0
speed = 0
strafespeed = 0
removeEventHandler("onClientRender", rootElement, freecamFrame)
removeEventHandler("onClientCursorMove",rootElement, freecamMouse)
setElementData(localPlayer, "freecam:state", false)
setCameraTarget(localPlayer, localPlayer)
toggleAllControls(true)
setElementPosition(localPlayer, startX, startY, startZ)
return true
end
function isFreecamEnabled()
return getElementData(localPlayer,"freecam:state")
end
function getFreecamOption(theOption, value)
return options[theOption]
end
function setFreecamOption(theOption, value)
if options[theOption] ~= nil then
options[theOption] = value
return true
else
return false
end
end
addEvent("doSetFreecamEnabled", true)
addEventHandler("doSetFreecamEnabled", rootElement, setFreecamEnabled)
addEvent("doSetFreecamDisabled", true)
addEventHandler("doSetFreecamDisabled", rootElement, setFreecamDisabled)
addEvent("doSetFreecamOption", true)
addEventHandler("doSetFreecamOption", rootElement, setFreecamOption)
function onStart()
for k, v in pairs(getElementsByType("player")) do
if getElementData(v, "freecam:state") == true then
setElementCollisionsEnabled(v, false)
end
end
end
addEventHandler("onClientResourceStart", getResourceRootElement(), onStart)
function onDataChange(name)
if getElementType(source) == "player" and name == "freecam:state" then
setElementCollisionsEnabled(source, not getElementData(source, "freecam:state"))
end
end
addEventHandler("onClientElementDataChange", rootElement, onDataChange) | bsd-3-clause |
qq779089973/my_openwrt_mod | luci/modules/niu/luasrc/controller/niu/traffic.lua | 49 | 1218 | --[[
LuCI - Lua Development Framework
Copyright 2009 Steven Barth <steven@midlink.org>
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 require = require
module "luci.controller.niu.traffic"
function index()
local toniu = {on_success_to={"niu"}}
local e = entry({"niu", "traffic"}, alias("niu"), "Network Traffic", 30)
e.niu_dbtemplate = "niu/traffic"
e.niu_dbtasks = true
e.niu_dbicon = "icons32/preferences-system-network.png"
if fs.access("/etc/config/firewall") then
entry({"niu", "traffic", "portfw"}, cbi("niu/traffic/portfw",
toniu), "Manage Port Forwarding", 1)
end
if fs.access("/etc/config/qos") then
entry({"niu", "traffic", "qos"}, cbi("niu/traffic/qos",
toniu), "Manage Prioritization (QoS)", 2)
end
entry({"niu", "traffic", "routes"}, cbi("niu/traffic/routes",
toniu), "Manage Traffic Routing", 30)
entry({"niu", "traffic", "conntrack"}, call("cnntrck"),
"Display Local Network Activity", 50)
end
function cnntrck()
require "luci.template".render("niu/traffic/conntrack")
end
| mit |
Zenny89/darkstar | scripts/zones/Port_Bastok/npcs/Ferrol.lua | 19 | 2970 | -----------------------------------
-- Area: Port Bastok
-- NPC: Ferrol
-- Starts Quest: Trial Size Trial by Earth
-- @pos 33.708 6.499 -39.425 236
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/quests");
require("scripts/globals/teleports");
require("scripts/zones/Port_Bastok/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(1547,1) and player:getQuestStatus(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH) == QUEST_ACCEPTED and player:getMainJob() == JOB_SMN) then
player:startEvent(0x012a,0,1547,1,20);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TrialSizeEarth = player:getQuestStatus(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH);
if (player:getMainLvl() >= 20 and player:getMainJob() == JOB_SMN and TrialSizeEarth == QUEST_AVAILABLE and player:getFameLevel(BASTOK) >= 2) then -- Requires player to be Summoner at least lvl 20
player:startEvent(0x0129,0,1547,1,20); --mini tuning fork, zone, level
elseif (TrialSizeEarth == QUEST_ACCEPTED) then
local EarthFork = player:hasItem(1547);
if (EarthFork) then
player:startEvent(0x00fb); -- Dialogue given to remind player to be prepared
elseif (EarthFork == false and tonumber(os.date("%j")) ~= player:getVar("TrialSizeEarth_date")) then
player:startEvent(0x012d,0,1547,1,20); -- Need another mini tuning fork
else
player:startEvent(0x012f); -- Standard dialog when you loose, and you don't wait 1 real day
end
elseif (TrialSizeEarth == QUEST_COMPLETED) then
player:startEvent(0x012c); -- Defeated Avatar
else
player:startEvent(0x00fe); -- Standard dialog
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x0129 and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1547); --Mini tuning fork
else
player:setVar("TrialSizeEarth_date",0)
player:addQuest(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH);
player:addItem(1547);
player:messageSpecial(ITEM_OBTAINED,1547);
end
elseif (csid == 0x012d and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1547); --Mini tuning fork
else
player:addItem(1547);
player:messageSpecial(ITEM_OBTAINED,1547);
end
elseif (csid == 0x012a and option == 1) then
toCloisterOfTremors(player);
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c57115864.lua | 4 | 1391 | --光子化
function c57115864.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c57115864.condition)
e1:SetTarget(c57115864.target)
e1:SetOperation(c57115864.activate)
c:RegisterEffect(e1)
end
function c57115864.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
end
function c57115864.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tg=Duel.GetAttacker()
if chkc then return chkc==tg end
if chk==0 then return tg:IsOnField() and tg:IsCanBeEffectTarget(e)
and Duel.IsExistingMatchingCard(c57115864.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SetTargetCard(tg)
end
function c57115864.filter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c57115864.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateAttack()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,c57115864.filter,tp,LOCATION_MZONE,0,1,1,nil)
local ac=g:GetFirst()
if ac then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(tc:GetAttack())
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,2)
ac:RegisterEffect(e1)
end
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Cloister_of_Tremors/npcs/Earth_Protocrystal.lua | 19 | 1770 | -----------------------------------
-- Area: Cloister of Tremors
-- NPC: Earth Protocrystal
-- Involved in Quest: Trial by Earth
-- @pos -539 1 -493 209
-----------------------------------
package.loaded["scripts/zones/Cloister_of_Tremors/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/bcnm");
require("scripts/zones/Cloister_of_Tremors/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(ASA) == SUGAR_COATED_DIRECTIVE and player:getVar("ASA4_Amber") == 1) then
player:startEvent(0x0002);
elseif (EventTriggerBCNM(player,npc)) then
return;
else
player:messageSpecial(PROTOCRYSTAL);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if (csid==0x0002) then
player:delKeyItem(DOMINAS_AMBER_SEAL);
player:addKeyItem(AMBER_COUNTERSEAL);
player:messageSpecial(KEYITEM_OBTAINED,AMBER_COUNTERSEAL);
player:setVar("ASA4_Amber","2");
elseif (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c86750474.lua | 2 | 2667 | --トリックスター・フォクシーウィッチ
function c86750474.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_FAIRY),2)
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(86750474,1))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,86750474)
e1:SetTarget(c86750474.damtg)
e1:SetOperation(c86750474.damop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(86750474,2))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCountLimit(1,86750475)
e2:SetCondition(c86750474.damcon)
e2:SetTarget(c86750474.damtg2)
e2:SetOperation(c86750474.damop2)
c:RegisterEffect(e2)
end
function c86750474.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end
Duel.SetTargetPlayer(1-tp)
local d=Duel.GetFieldGroupCount(1-tp,LOCATION_ONFIELD,0)*200
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,d)
end
function c86750474.damop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local d=Duel.GetFieldGroupCount(p,LOCATION_ONFIELD,0)*200
Duel.Damage(p,d,REASON_EFFECT)
end
function c86750474.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and c:IsSummonType(SUMMON_TYPE_LINK) and c:IsPreviousLocation(LOCATION_MZONE)
end
function c86750474.damfilter(c,e,tp)
return c:IsSetCard(0xfb) and c:IsLinkBelow(2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c86750474.damtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c86750474.damfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
local d=Duel.GetFieldGroupCount(1-tp,LOCATION_ONFIELD,0)*200
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,d)
end
function c86750474.damop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c86750474.damfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.BreakEffect()
local d=Duel.GetFieldGroupCount(1-tp,LOCATION_ONFIELD,0)*200
Duel.Damage(1-tp,d,REASON_EFFECT)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Yuhtunga_Jungle/npcs/br3.lua | 10 | 2954 | -----------------------------------
-- Area: Yuhtunga Jungle
-- NPC: Blue Rafflesia
-- Used in quest Even More Gullible Travels
-- @pos -468.876 -1 220.247 170
-----------------------------------
package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Yuhtunga_Jungle/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local evenmoreTravelsStatus = player:getQuestStatus(OUTLANDS, EVEN_MORE_GULLIBLES_TRAVELS)
local scentDay = player:getVar("RafflesiaScentDay");
local currentDay = VanadielDayOfTheYear();
local scentReady = ((scentDay < currentDay) or (scentDay > currentDay and player:getVar("RafflesiaScentYear") < VanadielYear()));
if (evenmoreTravelsStatus == QUEST_ACCEPTED and player:getVar("EVEN_MORE_GULLIBLES_PROGRESS") == 1 and player:getVar("ThirdBlueRafflesiaCS") == 0) then
player:startEvent(0x0017);
elseif (evenmoreTravelsStatus == QUEST_COMPLETED and scentReady == true and player:getVar("BathedInScent") == 0 and player:getVar("ThirdBlueRafflesiaCS") == 0) then
player:startEvent(0x0017);
else
player:messageSpecial(FLOWER_BLOOMING);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
-- Set BathedInScent to 1 if they touched all 3 Rafflesia for EVEN_MORE_GULLIBLES_TRAVELS which opens the quest The Opo-Opo and I
if (csid == 0x0017 and option == 1) then
if (player:getVar("FirstBlueRafflesiaCS") == 1 and player:getVar("SecondBlueRafflesiaCS") == 1) then
player:setVar("FirstBlueRafflesiaCS", 0);
player:setVar("SecondBlueRafflesiaCS", 0);
player:setVar("BathedInScent", 1);
player:setVar("RafflesiaScentDay",VanadielDayOfTheYear());
player:setVar("RafflesiaScentYear",VanadielYear());
player:setVar("EVEN_MORE_GULLIBLES_PROGRESS", 2);
player:addItem(1144); -- Rafflesia Nectar
player:messageSpecial(ITEM_OBTAINED,1144);
player:messageSpecial(FEEL_DIZZY); -- You feel slightly dizzy. You must have breathed in too much of the pollen.
else
player:setVar("ThirdBlueRafflesiaCS", 1);
player:addItem(1144); -- Rafflesia Nectar
player:messageSpecial(ITEM_OBTAINED,1144);
end
end
end; | gpl-3.0 |
valhallaGaming/uno | branches/2_0_3_STABLE/elevator-system/s_elevator_system.lua | 1 | 14069 | -- ////////////////////////////////////
-- // MYSQL //
-- ////////////////////////////////////
sqlUsername = exports.mysql:getMySQLUsername()
sqlPassword = exports.mysql:getMySQLPassword()
sqlDB = exports.mysql:getMySQLDBName()
sqlHost = exports.mysql:getMySQLHost()
sqlPort = exports.mysql:getMySQLPort()
handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort)
function checkMySQL()
if not (mysql_ping(handler)) then
handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort)
end
end
setTimer(checkMySQL, 300000, 0)
function closeMySQL()
if (handler) then
mysql_close(handler)
end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), closeMySQL)
-- ////////////////////////////////////
-- // MYSQL END //
-- ////////////////////////////////////
function createElevator(thePlayer, commandName, interior, dimension, ix, iy, iz)
if (exports.global:isPlayerLeadAdmin(thePlayer)) then
if not (interior) or not (dimension) or not (ix) or not (iy) or not (iz) then
outputChatBox("SYNTAX: /" .. commandName .. " [Interior ID] [Dimension ID] [X] [Y] [Z]", thePlayer, 255, 194, 14)
else
local x, y, z = getElementPosition(thePlayer)
interior = tonumber(interior)
dimension = tonumber(dimension)
local interiorwithin = getElementInterior(thePlayer)
local dimensionwithin = getElementDimension(thePlayer)
ix = tonumber(ix)
iy = tonumber(iy)
iz = tonumber(iz)
id = SmallestElevatorID()
if(id ~= nil and id ~= nil) then
local query = mysql_query(handler, "INSERT INTO elevators SET id='" .. id .. "', x='" .. x .. "', y='" .. y .. "', z='" .. z .. "', tpx='" .. ix .. "', tpy='" .. iy .. "', tpz='" .. iz .. "', dimensionwithin='" .. dimensionwithin .. "', interiorwithin='" .. interiorwithin .. "', dimension='" .. dimension .. "', interior='" .. interior .. "'")
if (query) then
mysql_free_result(query)
local pickup = createPickup(x, y, z, 3, 1318)
exports.pool:allocateElement(pickup)
local intpickup = createPickup(ix, iy, iz, 3, 1318)
exports.pool:allocateElement(intpickup)
local shape1 = createColSphere(x, y, z, 2)
exports.pool:allocateElement(shape1)
local shape2 = createColSphere(ix, iy, iz, 2)
exports.pool:allocateElement(shape2)
setElementData(shape1, "dbid", id)
setElementData(shape1, "x", ix)
setElementData(shape1, "y", iy)
setElementData(shape1, "z", iz)
setElementData(shape1, "interior", interior)
setElementData(shape1, "dimension", dimension)
setElementData(shape1, "type", "elevator")
setElementData(pickup, "type", "elevator")
setElementInterior(pickup, interiorwithin)
setElementDimension(pickup, dimensionwithin)
setElementInterior(shape1, interiorwithin)
setElementDimension(shape1, dimensionwithin)
setElementData(shape2, "dbid", id)
setElementData(shape2, "x", x)
setElementData(shape2, "y", y)
setElementData(shape2, "z", z)
setElementData(shape2, "interior", interiorwithin)
setElementData(shape2, "dimension", dimensionwithin)
setElementData(shape2, "type", "elevator")
setElementData(intpickup, "type", "elevator")
setElementInterior(intpickup, interior)
setElementDimension(intpickup, dimension)
setElementInterior(shape2, interior)
setElementDimension(shape2, dimension)
outputChatBox("Elevator created with ID #" .. id .. "!", thePlayer, 0, 255, 0)
end
else
outputChatBox("There was an error while creating an elevator. Try again.", thePlayer, 255, 0, 0)
end
end
end
end
addCommandHandler("addelevator", createElevator, false, false)
function loadAllElevators(res)
if (res==getThisResource()) then
local players = exports.pool:getPoolElementsByType("player")
for k, thePlayer in ipairs(players) do
setElementData(thePlayer, "UsedElevator", nil)
end
local result = mysql_query(handler, "SELECT id, x, y, z, tpx, tpy, tpz, dimensionwithin, interiorwithin, dimension, interior FROM elevators")
local counter = 0
if (result) then
for result, row in mysql_rows(result) do
local id = tonumber(row[1])
local x = tonumber(row[2])
local y = tonumber(row[3])
local z = tonumber(row[4])
local ix = tonumber(row[5])
local iy = tonumber(row[6])
local iz = tonumber(row[7])
local dimensionwithin = tonumber(row[8])
local interiorwithin = tonumber(row[9])
local dimension = tonumber(row[10])
local interior = tonumber(row[11])
local pickup = createPickup(x, y, z, 3, 1318)
exports.pool:allocateElement(pickup)
local intpickup = createPickup(ix, iy, iz, 3, 1318)
exports.pool:allocateElement(intpickup)
local shape1 = createColSphere(x, y, z, 2)
exports.pool:allocateElement(shape1)
local shape2 = createColSphere(ix, iy, iz, 2)
exports.pool:allocateElement(shape2)
setElementData(shape1, "dbid", id)
setElementData(shape1, "x", ix)
setElementData(shape1, "y", iy)
setElementData(shape1, "z", iz)
setElementData(shape1, "interior", interior)
setElementData(shape1, "dimension", dimension)
setElementData(shape1, "type", "elevator")
setElementData(pickup, "type", "elevator")
setElementData(pickup, "dbid", id)
setElementInterior(pickup, interiorwithin)
setElementDimension(pickup, dimensionwithin)
setElementInterior(shape1, interiorwithin)
setElementDimension(shape1, dimensionwithin)
setElementData(shape2, "dbid", id)
setElementData(shape2, "x", x)
setElementData(shape2, "y", y)
setElementData(shape2, "z", z)
setElementData(shape2, "interior", interiorwithin)
setElementData(shape2, "dimension", dimensionwithin)
setElementData(shape2, "type", "elevator")
setElementData(intpickup, "type", "elevator")
setElementInterior(intpickup, interior)
setElementDimension(intpickup, dimension)
setElementData(intpickup, "dbid", id)
setElementInterior(shape2, interior)
setElementDimension(shape2, dimension)
counter = counter + 1
end
mysql_free_result(result)
end
exports.irc:sendMessage("[SCRIPT] Loaded " .. counter .. " Elevators.")
end
end
addEventHandler("onResourceStart", getRootElement(), loadAllElevators)
function hitInteriorPickup( thePlayer, matchingDimension )
if(matchingDimension) then
local pickuptype = getElementData(source, "type")
if (pickuptype=="elevator") then
bindKeys(thePlayer, source)
end
end
end
addEventHandler("onColShapeHit", getRootElement(), hitInteriorPickup)
function leaveInteriorPickup( thePlayer, matchingDimension )
if(matchingDimension) then
local pickuptype = getElementData(source, "type")
if (pickuptype=="elevator") then
unbindKeys(thePlayer, source)
end
end
end
addEventHandler("onColShapeLeave", getRootElement(), leaveInteriorPickup)
function PickupEnter()
cancelEvent()
end
addEventHandler("onPickupHit", getRootElement(), PickupEnter)
function func (playa, f, down, playa, shape) enterElevator(playa, shape) end
function bindKeys(playa, shape)
if not(isKeyBound(playa, "enter", "down", func)) then
bindKey(playa, "enter", "down", func, playa, shape)
end
if not(isKeyBound(playa, "f", "down", func)) then
bindKey(playa, "f", "down", func, playa, shape)
end
end
function unbindKeys(playa, shape)
if (isKeyBound(playa, "enter", "down", func)) then
unbindKey(playa, "enter", "down", func, playa, shape)
end
if (isKeyBound(playa, "f", "down", func)) then
unbindKey(playa, "f", "down", func, playa, shape)
end
end
function enterElevator(playa, shape)
local check1 = isElementWithinColShape ( playa, shape )
if (check1 == true) then
local check2 = getElementData(playa, "UsedElevator")
if(check2 == nil) then
--unbindKeys(playa, shape)
local x = getElementData(shape, "x")
local y = getElementData(shape, "y")
local z = getElementData(shape, "z")
local check3 = getElementData(playa,"IsInCustomInterior")
if(check3 == 1) then
setElementData(playa,"IsInCustomInterior", nil)
local weather, blend = getWeather()
triggerClientEvent (playa, "onClientWeatherChange", getRootElement(), weather, blend)
end
if( z <= -5) then
triggerClientEvent (playa, "onClientWeatherChange", getRootElement(), 7, nil)
setElementData(playa,"IsInCustomInterior", 1)
end
local interior = getElementData(shape, "interior")
local dimension = getElementData(shape, "dimension")
setElementPosition(playa, x, y, z)
setElementInterior(playa, interior)
setCameraInterior(playa, interior)
setElementDimension(playa, dimension)
playSoundFrontEnd(playa, 40)
setElementData(playa,"UsedElevator", 1)
--setTimer(resetPlayerData, , 1, playa)
resetPlayerData(playa)
else
outputChatBox("Please wait before entering/leaving an interior again.", playa, 255, 0, 0)
end
end
end
function resetPlayerData(playa)
setElementData(playa,"UsedElevator", nil)
end
function resetElevatorData()
setElementData(source,"UsedElevator", nil)
end
addEventHandler("onPlayerJoin", getRootElement(), resetElevatorData)
addEventHandler("onPlayerQuit", getRootElement(), resetElevatorData)
function deleteElevator(thePlayer, commandName, id)
if (exports.global:isPlayerLeadAdmin(thePlayer)) then
if not (id) then
outputChatBox("SYNTAX: /" .. commandName .. " [ID]", thePlayer, 255, 194, 14)
else
id = tonumber(id)
local counter = 0
local pickups = exports.pool:getPoolElementsByType("pickup")
for k, thePickup in ipairs(pickups) do
local pickupType = getElementData(thePickup, "type")
if (pickupType=="elevator") then
local pickupID = tonumber(getElementData(thePickup, "dbid"))
if (pickupID==id) then
destroyElement(thePickup)
counter = counter + 1
end
end
end
local shapes = exports.pool:getPoolElementsByType("colshape")
for k, v in ipairs(shapes) do
local shapeType = getElementData(v, "type")
if (shapeType=="elevator") then
local shapeID = tonumber(getElementData(v, "dbid"))
if (shapeID==tonumber(id)) then
destroyElement(v)
end
end
end
if (counter>0) then -- ID Exists
local query = mysql_query(handler, "DELETE FROM elevators WHERE id='" .. id .. "'")
if (query) then
mysql_free_result(query)
end
outputChatBox("Elevator #" .. id .. " Deleted!", thePlayer, 0, 255, 0)
exports.irc:sendMessage(getPlayerName(thePlayer) .. " deleted elevator #" .. id .. ".")
else
outputChatBox("Elevator ID does not exist!", thePlayer, 255, 0, 0)
end
end
end
end
addCommandHandler("delelevator", deleteElevator, false, false)
function TempDelete(thePlayer, commandName)
if (exports.global:isPlayerLeadAdmin(thePlayer)) then
local posX, posY, posZ = getElementPosition(thePlayer)
for k, thePickup in ipairs(exports.pool:getPoolElementsByType("colshape")) do
local pickuptype = getElementData(thePickup, "type")
if (pickuptype=="elevator") then
local x, y, z = getElementPosition(thePickup)
local distance = getDistanceBetweenPoints3D(posX, posY, posZ, x, y, z)
if (distance<=2) then
local dbid = getElementData(thePickup, "dbid")
local query = mysql_query(handler, "DELETE FROM elevators WHERE id='" .. dbid .. "'")
if (query) then
outputChatBox(" Elevator deleted", thePlayer)
mysql_free_result(query)
end
end
end
end
end
end
addCommandHandler("tempdelete", TempDelete, false, false)
function getNearbyElevators(thePlayer, commandName)
if (exports.global:isPlayerAdmin(thePlayer)) then
local posX, posY, posZ = getElementPosition(thePlayer)
outputChatBox("Nearby Elevators:", thePlayer, 255, 126, 0)
local count = 0
for k, thePickup in ipairs(exports.pool:getPoolElementsByType("colshape")) do
local pickuptype = getElementData(thePickup, "type")
if (pickuptype=="elevator") then
local x, y, z = getElementPosition(thePickup)
local distance = getDistanceBetweenPoints3D(posX, posY, posZ, x, y, z)
if (distance<=10) then
local dbid = getElementData(thePickup, "dbid")
outputChatBox(" Elevator with ID " .. dbid .. ".", thePlayer, 255, 126, 0)
count = count + 1
end
end
end
if (count==0) then
outputChatBox(" None.", thePlayer, 255, 126, 0)
end
end
end
addCommandHandler("nearbyelevators", getNearbyElevators, false, false)
function SmallestElevatorID( ) -- Loop which finds the smallest ID in the SQL instead of the biggest one.
UsedID = {}
local id = 0
local answer = 2 -- 0 = ID = 1 . 1 =Suitable ID found. 2= Still searching for ID.
local highest = 0
local result = mysql_query(handler, "SELECT id FROM elevators")
if(result) then
for result, row in mysql_rows(result) do
UsedID[tonumber(row[1])] = 1
if (tonumber(row[1]) > highest) then
highest = tonumber(row[1])
end
end
end
if(highest > 0) then
for i = 1, highest do
if(UsedID[i] ~= 1) then
answer = 1
id = i
break
end
end
else
answer = 0
id = 1
end
if(answer == 2) then
answer = 1
id = highest + 1
end
if(answer ~= 2) then
return id
else
return false
end
end
function JoinsInCustomInt()
dimension = getElementDimension( source )
interior = getElementInterior( source )
x,y,z = getElementPosition( source )
if( interior == 0 and dimension == 0) then
if(z <= 5) then
setElementData(source,"IsInCustomInterior", 1)
triggerClientEvent (source, "onClientWeatherChange", getRootElement(), 7, nil)
end
end
end
addEventHandler("onPlayerSpawn", getRootElement(), JoinsInCustomInt) | bsd-3-clause |
amirTg/TELEHONES | bot/utils.lua | 473 | 24167 | URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require "serpent"
feedparser = require "feedparser"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
http.TIMEOUT = 10
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
end
if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id
end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end
function is_chat_msg( msg )
if msg.to.type == 'chat' then
return true
end
return false
end
function string.random(length)
local str = "";
for i = 1, length do
math.random(97, 122)
str = str..string.char(math.random(97, 122));
end
return str;
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
-- DEPRECATED
function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1")
end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers)
-- Eg: foo.var
local file_name = url:match("[^%w]+([%.%w]+)$")
-- Any delimited alphanumeric on the url
file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
-- Random name, hope content-type works
file_name = file_name or str:random(5)
local content_type = headers["content-type"]
local extension = nil
if content_type then
extension = mimetype.get_mime_extension(content_type)
end
if extension then
file_name = file_name.."."..extension
end
local disposition = headers["content-disposition"]
if disposition then
-- attachment; filename=CodeCogsEqn.png
file_name = disposition:match('filename=([^;]+)') or file_name
end
return file_name
end
-- Saves file to /tmp/. If file_name isn't provided,
-- will get the text after the last "/" for filename
-- and content-type for extension
function download_to_file(url, file_name)
print("url to download: "..url)
local respbody = {}
local options = {
url = url,
sink = ltn12.sink.table(respbody),
redirect = true
}
-- nil, code, headers, status
local response = nil
if url:starts('https') then
options.redirect = false
response = {https.request(options)}
else
response = {http.request(options)}
end
local code = response[2]
local headers = response[3]
local status = response[4]
if code ~= 200 then return nil end
file_name = file_name or get_http_file_name(url, headers)
local file_path = "/tmp/"..file_name
print("Saved to: "..file_path)
file = io.open(file_path, "w+")
file:write(table.concat(respbody))
file:close()
return file_path
end
function vardump(value)
print(serpent.block(value, {comment=false}))
end
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
i = i + 1
t[i] = filename
end
return t
end
-- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
function run_command(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
cmd:close()
return result
end
-- User has privileges
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
-- Returns the name of the sender
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
-- Returns at table of lua files inside plugins
function plugins_names( )
local files = {}
for k, v in pairs(scandir("plugins")) do
-- Ends with .lua
if (v:match(".lua$")) then
table.insert(files, v)
end
end
return files
end
-- Function name explains what it does.
function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Save into file the data serialized for lua.
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
-- Returns true if the string is empty
function string:isempty()
return self == nil or self == ''
end
-- Returns true if the string is blank
function string:isblank()
self = self:trim()
return self:isempty()
end
-- DEPRECATED!!!!!
function string.starts(String, Start)
print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start))
end
-- Returns true if String starts with Start
function string:starts(text)
return text == string.sub(self,1,string.len(text))
end
-- Send image to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_photo(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function,
cb_extra = cb_extra
}
-- Call to remove with optional callback
send_photo(receiver, file_path, cb_function, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_photo_from_url(receiver, url, cb_function, cb_extra)
-- If callback not provided
cb_function = cb_function or ok_cb
cb_extra = cb_extra or false
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, cb_function, cb_extra)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra)
end
end
-- Same as send_photo_from_url but as callback function
function send_photo_from_url_callback(cb_extra, success, result)
local receiver = cb_extra.receiver
local url = cb_extra.url
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, ok_cb, false)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, ok_cb, false)
end
end
-- Send multiple images asynchronous.
-- param urls must be a table.
function send_photos_from_url(receiver, urls)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = nil
}
send_photos_from_url_callback(cb_extra)
end
-- Use send_photos_from_url.
-- This function might be difficult to understand.
function send_photos_from_url_callback(cb_extra, success, result)
-- cb_extra is a table containing receiver, urls and remove_path
local receiver = cb_extra.receiver
local urls = cb_extra.urls
local remove_path = cb_extra.remove_path
-- The previously image to remove
if remove_path ~= nil then
os.remove(remove_path)
print("Deleted: "..remove_path)
end
-- Nil or empty, exit case (no more urls)
if urls == nil or #urls == 0 then
return false
end
-- Take the head and remove from urls table
local head = table.remove(urls, 1)
local file_path = download_to_file(head, false)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = file_path
}
-- Send first and postpone the others as callback
send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
end
-- Callback to remove a file
function rmtmp_cb(cb_extra, success, result)
local file_path = cb_extra.file_path
local cb_function = cb_extra.cb_function or ok_cb
local cb_extra = cb_extra.cb_extra
if file_path ~= nil then
os.remove(file_path)
print("Deleted: "..file_path)
end
-- Finally call the callback
cb_function(cb_extra, success, result)
end
-- Send document to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_document(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function or ok_cb,
cb_extra = cb_extra or false
}
-- Call to remove with optional callback
send_document(receiver, file_path, rmtmp_cb, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false)
print("File path: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra)
end
-- Parameters in ?a=1&b=2 style
function format_http_params(params, is_get)
local str = ''
-- If is get add ? to the beginning
if is_get then str = '?' end
local first = true -- Frist param
for k,v in pairs (params) do
if v then -- nil value
if first then
first = false
str = str..k.. "="..v
else
str = str.."&"..k.. "="..v
end
end
end
return str
end
-- Check if user can use the plugin and warns user
-- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user'
local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false)
return true
else
return false
end
end
-- Check if user can use the plugin
function user_allowed(plugin, msg)
if plugin.privileged and not is_sudo(msg) then
return false
end
return true
end
function send_order_msg(destination, msgs)
local cb_extra = {
destination = destination,
msgs = msgs
}
send_order_msg_callback(cb_extra, true)
end
function send_order_msg_callback(cb_extra, success, result)
local destination = cb_extra.destination
local msgs = cb_extra.msgs
local file_path = cb_extra.file_path
if file_path ~= nil then
os.remove(file_path)
print("Deleted: " .. file_path)
end
if type(msgs) == 'string' then
send_large_msg(destination, msgs)
elseif type(msgs) ~= 'table' then
return
end
if #msgs < 1 then
return
end
local msg = table.remove(msgs, 1)
local new_cb_extra = {
destination = destination,
msgs = msgs
}
if type(msg) == 'string' then
send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
elseif type(msg) == 'table' then
local typ = msg[1]
local nmsg = msg[2]
new_cb_extra.file_path = nmsg
if typ == 'document' then
send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'image' or typ == 'photo' then
send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'audio' then
send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'video' then
send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
else
send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
end
end
end
-- Same as send_large_msg_callback but friendly params
function send_large_msg(destination, text)
local cb_extra = {
destination = destination,
text = text
}
send_large_msg_callback(cb_extra, true)
end
-- If text is longer than 4096 chars, send multiple msg.
-- https://core.telegram.org/method/messages.sendMessage
function send_large_msg_callback(cb_extra, success, result)
local text_max = 4096
local destination = cb_extra.destination
local text = cb_extra.text
local text_len = string.len(text)
local num_msg = math.ceil(text_len / text_max)
if num_msg <= 1 then
send_msg(destination, text, ok_cb, false)
else
local my_text = string.sub(text, 1, 4096)
local rest = string.sub(text, 4096, text_len)
local cb_extra = {
destination = destination,
text = rest
}
send_msg(destination, my_text, send_large_msg_callback, cb_extra)
end
end
-- Returns a table with matches or nil
function match_pattern(pattern, text, lower_case)
if text then
local matches = {}
if lower_case then
matches = { string.match(text:lower(), pattern) }
else
matches = { string.match(text, pattern) }
end
if next(matches) then
return matches
end
end
-- nil
end
-- Function to read data from files
function load_from_file(file, default_data)
local f = io.open(file, "r+")
-- If file doesn't exists
if f == nil then
-- Create a new empty table
default_data = default_data or {}
serialize_to_file(default_data, file)
print ('Created file', file)
else
print ('Data loaded from file', file)
f:close()
end
return loadfile (file)()
end
-- See http://stackoverflow.com/a/14899740
function unescape_html(str)
local map = {
["lt"] = "<",
["gt"] = ">",
["amp"] = "&",
["quot"] = '"',
["apos"] = "'"
}
new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
var = map[s] or n == "#" and string.char(s)
var = var or n == "#x" and string.char(tonumber(s,16))
var = var or orig
return var
end)
return new
end
--Check if this chat is realm or not
function is_realm(msg)
local var = false
local realms = 'realms'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(realms)] then
if data[tostring(realms)][tostring(msg.to.id)] then
var = true
end
return var
end
end
--Check if this chat is a group or not
function is_group(msg)
local var = false
local groups = 'groups'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(groups)] then
if data[tostring(groups)][tostring(msg.to.id)] then
var = true
end
return var
end
end
function savelog(group, logtxt)
local text = (os.date("[ %c ]=> "..logtxt.."\n \n"))
local file = io.open("./groups/logs/"..group.."log.txt", "a")
file:write(text)
file:close()
end
function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
--Check if user is the owner of that group or not
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_owner2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is admin or not
function is_admin(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_admin2(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_momod(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['moderators'] then
if data[tostring(msg.to.id)]['moderators'][tostring(user)] then
var = true
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_momod2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(group_id)] then
if data[tostring(group_id)]['moderators'] then
if data[tostring(group_id)]['moderators'][tostring(usert)] then
var = true
end
end
end
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == usert then
var = true
end
end
return var
end
-- Returns the name of the sender
function kick_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_owner2(user_id, chat_id) then -- Ignore admins
return
end
local chat = 'chat#id'..chat_id
local user = 'user#id'..user_id
chat_del_user(chat, user, ok_cb, true)
end
-- Ban
function ban_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'banned:'..chat_id
redis:sadd(hash, user_id)
-- Kick from chat
kick_user(user_id, chat_id)
end
-- Global ban
function banall_user(user_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'gbanned'
redis:sadd(hash, user_id)
end
-- Global unban
function unbanall_user(user_id)
--Save on redis
local hash = 'gbanned'
redis:srem(hash, user_id)
end
-- Check if user_id is banned in chat_id or not
function is_banned(user_id, chat_id)
--Save on redis
local hash = 'banned:'..chat_id
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Check if user_id is globally banned or not
function is_gbanned(user_id)
--Save on redis
local hash = 'gbanned'
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Returns chat_id ban list
function ban_list(chat_id)
local hash = 'banned:'..chat_id
local list = redis:smembers(hash)
local text = "Ban list !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- Returns globally ban list
function banall_list()
local hash = 'gbanned'
local list = redis:smembers(hash)
local text = "global bans !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- /id by reply
function get_message_callback_id(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
send_large_msg(chat, result.from.id)
else
return 'Use This in Your Groups'
end
end
-- kick by reply for mods and owner
function Kick_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
-- Kick by reply for admins
function Kick_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
--Ban by reply for admins
function ban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Ban by reply for admins
function ban_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Unban by reply
function unban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't unban myself"
end
send_large_msg(chat, "User "..result.from.id.." Unbanned")
-- Save on redis
local hash = 'banned:'..result.to.id
redis:srem(hash, result.from.id)
else
return 'Use This in Your Groups'
end
end
function banall_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't banall myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
local name = user_print_name(result.from)
banall_user(result.from.id)
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered")
else
return 'Use This in Your Groups'
end
end
| gpl-2.0 |
Stoph2016/Sb | bot/utils.lua | 473 | 24167 | URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require "serpent"
feedparser = require "feedparser"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
http.TIMEOUT = 10
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
end
if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id
end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end
function is_chat_msg( msg )
if msg.to.type == 'chat' then
return true
end
return false
end
function string.random(length)
local str = "";
for i = 1, length do
math.random(97, 122)
str = str..string.char(math.random(97, 122));
end
return str;
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
-- DEPRECATED
function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1")
end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers)
-- Eg: foo.var
local file_name = url:match("[^%w]+([%.%w]+)$")
-- Any delimited alphanumeric on the url
file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
-- Random name, hope content-type works
file_name = file_name or str:random(5)
local content_type = headers["content-type"]
local extension = nil
if content_type then
extension = mimetype.get_mime_extension(content_type)
end
if extension then
file_name = file_name.."."..extension
end
local disposition = headers["content-disposition"]
if disposition then
-- attachment; filename=CodeCogsEqn.png
file_name = disposition:match('filename=([^;]+)') or file_name
end
return file_name
end
-- Saves file to /tmp/. If file_name isn't provided,
-- will get the text after the last "/" for filename
-- and content-type for extension
function download_to_file(url, file_name)
print("url to download: "..url)
local respbody = {}
local options = {
url = url,
sink = ltn12.sink.table(respbody),
redirect = true
}
-- nil, code, headers, status
local response = nil
if url:starts('https') then
options.redirect = false
response = {https.request(options)}
else
response = {http.request(options)}
end
local code = response[2]
local headers = response[3]
local status = response[4]
if code ~= 200 then return nil end
file_name = file_name or get_http_file_name(url, headers)
local file_path = "/tmp/"..file_name
print("Saved to: "..file_path)
file = io.open(file_path, "w+")
file:write(table.concat(respbody))
file:close()
return file_path
end
function vardump(value)
print(serpent.block(value, {comment=false}))
end
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
i = i + 1
t[i] = filename
end
return t
end
-- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
function run_command(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
cmd:close()
return result
end
-- User has privileges
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
-- Returns the name of the sender
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
-- Returns at table of lua files inside plugins
function plugins_names( )
local files = {}
for k, v in pairs(scandir("plugins")) do
-- Ends with .lua
if (v:match(".lua$")) then
table.insert(files, v)
end
end
return files
end
-- Function name explains what it does.
function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Save into file the data serialized for lua.
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
-- Returns true if the string is empty
function string:isempty()
return self == nil or self == ''
end
-- Returns true if the string is blank
function string:isblank()
self = self:trim()
return self:isempty()
end
-- DEPRECATED!!!!!
function string.starts(String, Start)
print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start))
end
-- Returns true if String starts with Start
function string:starts(text)
return text == string.sub(self,1,string.len(text))
end
-- Send image to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_photo(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function,
cb_extra = cb_extra
}
-- Call to remove with optional callback
send_photo(receiver, file_path, cb_function, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_photo_from_url(receiver, url, cb_function, cb_extra)
-- If callback not provided
cb_function = cb_function or ok_cb
cb_extra = cb_extra or false
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, cb_function, cb_extra)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra)
end
end
-- Same as send_photo_from_url but as callback function
function send_photo_from_url_callback(cb_extra, success, result)
local receiver = cb_extra.receiver
local url = cb_extra.url
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, ok_cb, false)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, ok_cb, false)
end
end
-- Send multiple images asynchronous.
-- param urls must be a table.
function send_photos_from_url(receiver, urls)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = nil
}
send_photos_from_url_callback(cb_extra)
end
-- Use send_photos_from_url.
-- This function might be difficult to understand.
function send_photos_from_url_callback(cb_extra, success, result)
-- cb_extra is a table containing receiver, urls and remove_path
local receiver = cb_extra.receiver
local urls = cb_extra.urls
local remove_path = cb_extra.remove_path
-- The previously image to remove
if remove_path ~= nil then
os.remove(remove_path)
print("Deleted: "..remove_path)
end
-- Nil or empty, exit case (no more urls)
if urls == nil or #urls == 0 then
return false
end
-- Take the head and remove from urls table
local head = table.remove(urls, 1)
local file_path = download_to_file(head, false)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = file_path
}
-- Send first and postpone the others as callback
send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
end
-- Callback to remove a file
function rmtmp_cb(cb_extra, success, result)
local file_path = cb_extra.file_path
local cb_function = cb_extra.cb_function or ok_cb
local cb_extra = cb_extra.cb_extra
if file_path ~= nil then
os.remove(file_path)
print("Deleted: "..file_path)
end
-- Finally call the callback
cb_function(cb_extra, success, result)
end
-- Send document to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_document(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function or ok_cb,
cb_extra = cb_extra or false
}
-- Call to remove with optional callback
send_document(receiver, file_path, rmtmp_cb, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false)
print("File path: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra)
end
-- Parameters in ?a=1&b=2 style
function format_http_params(params, is_get)
local str = ''
-- If is get add ? to the beginning
if is_get then str = '?' end
local first = true -- Frist param
for k,v in pairs (params) do
if v then -- nil value
if first then
first = false
str = str..k.. "="..v
else
str = str.."&"..k.. "="..v
end
end
end
return str
end
-- Check if user can use the plugin and warns user
-- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user'
local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false)
return true
else
return false
end
end
-- Check if user can use the plugin
function user_allowed(plugin, msg)
if plugin.privileged and not is_sudo(msg) then
return false
end
return true
end
function send_order_msg(destination, msgs)
local cb_extra = {
destination = destination,
msgs = msgs
}
send_order_msg_callback(cb_extra, true)
end
function send_order_msg_callback(cb_extra, success, result)
local destination = cb_extra.destination
local msgs = cb_extra.msgs
local file_path = cb_extra.file_path
if file_path ~= nil then
os.remove(file_path)
print("Deleted: " .. file_path)
end
if type(msgs) == 'string' then
send_large_msg(destination, msgs)
elseif type(msgs) ~= 'table' then
return
end
if #msgs < 1 then
return
end
local msg = table.remove(msgs, 1)
local new_cb_extra = {
destination = destination,
msgs = msgs
}
if type(msg) == 'string' then
send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
elseif type(msg) == 'table' then
local typ = msg[1]
local nmsg = msg[2]
new_cb_extra.file_path = nmsg
if typ == 'document' then
send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'image' or typ == 'photo' then
send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'audio' then
send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'video' then
send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
else
send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
end
end
end
-- Same as send_large_msg_callback but friendly params
function send_large_msg(destination, text)
local cb_extra = {
destination = destination,
text = text
}
send_large_msg_callback(cb_extra, true)
end
-- If text is longer than 4096 chars, send multiple msg.
-- https://core.telegram.org/method/messages.sendMessage
function send_large_msg_callback(cb_extra, success, result)
local text_max = 4096
local destination = cb_extra.destination
local text = cb_extra.text
local text_len = string.len(text)
local num_msg = math.ceil(text_len / text_max)
if num_msg <= 1 then
send_msg(destination, text, ok_cb, false)
else
local my_text = string.sub(text, 1, 4096)
local rest = string.sub(text, 4096, text_len)
local cb_extra = {
destination = destination,
text = rest
}
send_msg(destination, my_text, send_large_msg_callback, cb_extra)
end
end
-- Returns a table with matches or nil
function match_pattern(pattern, text, lower_case)
if text then
local matches = {}
if lower_case then
matches = { string.match(text:lower(), pattern) }
else
matches = { string.match(text, pattern) }
end
if next(matches) then
return matches
end
end
-- nil
end
-- Function to read data from files
function load_from_file(file, default_data)
local f = io.open(file, "r+")
-- If file doesn't exists
if f == nil then
-- Create a new empty table
default_data = default_data or {}
serialize_to_file(default_data, file)
print ('Created file', file)
else
print ('Data loaded from file', file)
f:close()
end
return loadfile (file)()
end
-- See http://stackoverflow.com/a/14899740
function unescape_html(str)
local map = {
["lt"] = "<",
["gt"] = ">",
["amp"] = "&",
["quot"] = '"',
["apos"] = "'"
}
new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
var = map[s] or n == "#" and string.char(s)
var = var or n == "#x" and string.char(tonumber(s,16))
var = var or orig
return var
end)
return new
end
--Check if this chat is realm or not
function is_realm(msg)
local var = false
local realms = 'realms'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(realms)] then
if data[tostring(realms)][tostring(msg.to.id)] then
var = true
end
return var
end
end
--Check if this chat is a group or not
function is_group(msg)
local var = false
local groups = 'groups'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(groups)] then
if data[tostring(groups)][tostring(msg.to.id)] then
var = true
end
return var
end
end
function savelog(group, logtxt)
local text = (os.date("[ %c ]=> "..logtxt.."\n \n"))
local file = io.open("./groups/logs/"..group.."log.txt", "a")
file:write(text)
file:close()
end
function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
--Check if user is the owner of that group or not
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_owner2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is admin or not
function is_admin(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_admin2(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_momod(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['moderators'] then
if data[tostring(msg.to.id)]['moderators'][tostring(user)] then
var = true
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_momod2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(group_id)] then
if data[tostring(group_id)]['moderators'] then
if data[tostring(group_id)]['moderators'][tostring(usert)] then
var = true
end
end
end
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == usert then
var = true
end
end
return var
end
-- Returns the name of the sender
function kick_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_owner2(user_id, chat_id) then -- Ignore admins
return
end
local chat = 'chat#id'..chat_id
local user = 'user#id'..user_id
chat_del_user(chat, user, ok_cb, true)
end
-- Ban
function ban_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'banned:'..chat_id
redis:sadd(hash, user_id)
-- Kick from chat
kick_user(user_id, chat_id)
end
-- Global ban
function banall_user(user_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'gbanned'
redis:sadd(hash, user_id)
end
-- Global unban
function unbanall_user(user_id)
--Save on redis
local hash = 'gbanned'
redis:srem(hash, user_id)
end
-- Check if user_id is banned in chat_id or not
function is_banned(user_id, chat_id)
--Save on redis
local hash = 'banned:'..chat_id
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Check if user_id is globally banned or not
function is_gbanned(user_id)
--Save on redis
local hash = 'gbanned'
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Returns chat_id ban list
function ban_list(chat_id)
local hash = 'banned:'..chat_id
local list = redis:smembers(hash)
local text = "Ban list !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- Returns globally ban list
function banall_list()
local hash = 'gbanned'
local list = redis:smembers(hash)
local text = "global bans !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- /id by reply
function get_message_callback_id(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
send_large_msg(chat, result.from.id)
else
return 'Use This in Your Groups'
end
end
-- kick by reply for mods and owner
function Kick_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
-- Kick by reply for admins
function Kick_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
--Ban by reply for admins
function ban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Ban by reply for admins
function ban_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Unban by reply
function unban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't unban myself"
end
send_large_msg(chat, "User "..result.from.id.." Unbanned")
-- Save on redis
local hash = 'banned:'..result.to.id
redis:srem(hash, result.from.id)
else
return 'Use This in Your Groups'
end
end
function banall_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't banall myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
local name = user_print_name(result.from)
banall_user(result.from.id)
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered")
else
return 'Use This in Your Groups'
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/abilities/pets/wind_blade.lua | 25 | 1297 | ---------------------------------------------------
-- Geocrush
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
require("scripts/globals/magic");
---------------------------------------------------
function onAbilityCheck(player, target, ability)
return 0,0;
end;
function onPetAbility(target, pet, skill)
local dINT = math.floor(pet:getStat(MOD_INT) - target:getStat(MOD_INT));
local tp = skill:getTP();
local master = pet:getMaster();
local merits = 0;
if (master ~= nil and master:isPC()) then
merits = master:getMerit(MERIT_WIND_BLADE);
end
tp = tp + (merits - 40);
if (tp > 300) then
tp = 300;
end
--note: this formula is only accurate for level 75 - 76+ may have a different intercept and/or slope
local damage = math.floor(512 + 1.72*(tp+1));
damage = damage + (dINT * 1.5);
damage = MobMagicalMove(pet,target,skill,damage,ELE_WIND,1,TP_NO_EFFECT,0);
damage = mobAddBonuses(pet, nil, target, damage.dmg, ELE_WIND);
damage = AvatarFinalAdjustments(damage,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,1);
target:delHP(damage);
target:updateEnmityFromDamage(pet,damage);
return damage;
end | gpl-3.0 |
mercury233/ygopro-scripts | c56790702.lua | 2 | 1521 | --異次元の強襲艦
function c56790702.initial_effect(c)
--attack cost
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ATTACK_COST)
e1:SetCost(c56790702.atcost)
e1:SetOperation(c56790702.atop)
c:RegisterEffect(e1)
--sp summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(56790702,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,56790702)
e2:SetCondition(c56790702.spcon)
e2:SetTarget(c56790702.sptg)
e2:SetOperation(c56790702.spop)
c:RegisterEffect(e2)
end
function c56790702.atcost(e,c,tp)
return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_GRAVE,0,1,nil)
end
function c56790702.atop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c56790702.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetMatchingGroupCount(aux.TRUE,tp,LOCATION_REMOVED,0,nil)==3
end
function c56790702.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 c56790702.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
| gpl-2.0 |
pauldub/luvit-dnode | lib/dnode/walk.lua | 1 | 1413 | local Object = require('core').Object
local table = require('table')
local Queue = require('./queue')
local Logger = require('./logger')
local logger = Logger:new('walk')
local Node = Object:extend()
function Node:initialize(params)
self.value = params.value
self.path = params.path
end
local Walk = Object:extend()
function Walk:initialize(obj)
self.logger = logger
self.path = {}
self.obj = obj
self.fns = { test = function() end }
end
function Walk:clone(obj)
self:_walk(obj, function(node)
if type(obj) ~= 'table' then
node.value = node.value
end
end)
end
function Walk:walk(cb)
return self:_walk(self.obj, cb)
end
function Walk:_walk(obj, cb)
local node = Node:new({ value = obj, path = self.path })
cb(node)
local value = node.value
local value_type = type(value)
logger.debug('value', value, value_type)
logger.debug('value', node)
if value_type == 'table' then
local copy = { }
local acc = 0
for k,v in pairs(value) do
if v ~= nil then
self.path[#self.path + 1] = k
local walk_val = self:_walk(v, cb)
copy[k] = walk_val
self.path[#self.path] = nil
end
end
return copy
elseif value_type == 'boolean' or value_type == 'string' or value_type == 'number' or value_type == 'function' then
return value
else
error('' .. value_type .. 'not handled')
end
end
return Walk
| mit |
mercury233/ygopro-scripts | c71422989.lua | 4 | 3319 | --吸光融合
function c71422989.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,71422989+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c71422989.cost)
e1:SetTarget(c71422989.target)
e1:SetOperation(c71422989.activate)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(71422989,ACTIVITY_SPSUMMON,c71422989.counterfilter)
end
function c71422989.counterfilter(c)
return c:IsSetCard(0x1047)
end
function c71422989.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71422989,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(c71422989.splimit)
Duel.RegisterEffect(e1,tp)
end
function c71422989.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return not c:IsSetCard(0x1047)
end
function c71422989.filter(c)
return c:IsSetCard(0x1047) and c:IsAbleToHand()
end
function c71422989.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71422989.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c71422989.filter1(c,e)
return c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c71422989.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x1047) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c71422989.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c71422989.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c71422989.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(c71422989.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c71422989.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if (sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0)) and Duel.SelectYesNo(tp,aux.Stringid(71422989,0)) then
Duel.BreakEffect()
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c47529357.lua | 2 | 1359 | --ミスト・ボディ
function c47529357.initial_effect(c)
--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(c47529357.target)
e1:SetOperation(c47529357.operation)
c:RegisterEffect(e1)
--Indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c47529357.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c47529357.operation(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
| gpl-2.0 |
mercury233/ygopro-scripts | c23869735.lua | 2 | 2600 | --化石発掘
function c23869735.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:SetHintTiming(0,TIMING_END_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCost(c23869735.cost)
e1:SetTarget(c23869735.target)
e1:SetOperation(c23869735.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(c23869735.desop)
c:RegisterEffect(e2)
--Destroy2
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c23869735.descon2)
e3:SetOperation(c23869735.desop2)
c:RegisterEffect(e3)
--disable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_TARGET)
e4:SetCode(EFFECT_DISABLE)
e4:SetRange(LOCATION_SZONE)
c:RegisterEffect(e4)
end
function c23869735.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 c23869735.filter(c,e,tp)
return c:IsRace(RACE_DINOSAUR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c23869735.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c23869735.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c23869735.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c23869735.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c23869735.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsRace(RACE_DINOSAUR) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
c:SetCardTarget(tc)
end
Duel.SpecialSummonComplete()
end
function c23869735.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
function c23869735.descon2(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY)
end
function c23869735.desop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c90928333.lua | 6 | 1082 | --闇の量産工場
function c90928333.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c90928333.target)
e1:SetOperation(c90928333.activate)
c:RegisterEffect(e1)
end
function c90928333.filter(c)
return c:IsType(TYPE_NORMAL) and c:IsAbleToHand()
end
function c90928333.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c90928333.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c90928333.filter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c90928333.filter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,2,0,0)
end
function c90928333.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c4252828.lua | 2 | 2895 | --シー・アーチャー
function c4252828.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(4252828,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c4252828.eqcon)
e1:SetTarget(c4252828.eqtg)
e1:SetOperation(c4252828.eqop)
c:RegisterEffect(e1)
--Destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetTarget(c4252828.desreptg)
e2:SetOperation(c4252828.desrepop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function c4252828.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=e:GetLabelObject()
return ec==nil or not ec:IsHasCardTarget(c) or ec:GetFlagEffect(4252828)==0
end
function c4252828.filter(c)
return c:IsFaceup() and c:IsLevelBelow(3)
end
function c4252828.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c4252828.filter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c4252828.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c4252828.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c4252828.eqlimit(e,c)
return e:GetOwner()==c
end
function c4252828.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) then
if not Duel.Equip(tp,tc,c,false) then return end
--Add Equip limit
tc:RegisterFlagEffect(4252828,RESET_EVENT+RESETS_STANDARD,0,0)
e:SetLabelObject(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(c4252828.eqlimit)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetValue(800)
tc:RegisterEffect(e2)
end
end
function c4252828.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local ec=e:GetLabelObject():GetLabelObject()
if chk==0 then return ec and ec:IsHasCardTarget(c) and ec:GetFlagEffect(4252828)~=0
and ec:IsDestructable(e) and not ec:IsStatus(STATUS_DESTROY_CONFIRMED)
and not c:IsReason(REASON_REPLACE) end
return Duel.SelectEffectYesNo(tp,c,96)
end
function c4252828.desrepop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetLabelObject():GetLabelObject(),REASON_EFFECT+REASON_REPLACE)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c83370323.lua | 2 | 1358 | --トラパート
function c83370323.initial_effect(c)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BE_MATERIAL)
e1:SetProperty(EFFECT_FLAG_EVENT_PLAYER)
e1:SetCondition(c83370323.con)
e1:SetOperation(c83370323.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetValue(c83370323.synlimit)
c:RegisterEffect(e2)
end
function c83370323.con(e,tp,eg,ep,ev,re,r,rp)
return r==REASON_SYNCHRO
end
function c83370323.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sync=c:GetReasonCard()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c83370323.aclimit)
e1:SetCondition(c83370323.actcon)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sync:RegisterEffect(e1,true)
end
function c83370323.aclimit(e,re,tp)
return re:GetHandler():IsType(TYPE_TRAP) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function c83370323.actcon(e)
return Duel.GetAttacker()==e:GetHandler()
end
function c83370323.synlimit(e,c)
if not c then return false end
return not c:IsRace(RACE_WARRIOR)
end
| gpl-2.0 |
xin3liang/platform_external_chromium_org_third_party_skia | tools/lua/paths_agg.lua | 92 | 1207 |
clips = 0
draws = 0
clipPaths = 0
drawPaths = 0
swClipPaths = 0
swDrawPaths = 0
skpsTotal = 0
skpsWithPath = 0
skpsWithSWPath = 0
dofile("/tmp/lua-output")
io.write("Number of clips: ", clips, "\n");
io.write("Number of draws: ", draws, "\n");
io.write("Number of clipped paths: ", clipPaths, "\n");
io.write("Number of drawn paths: ", drawPaths, "\n");
io.write("Number of clipped software paths: ", swClipPaths, "\n");
io.write("Number of drawn software paths: ", swDrawPaths, "\n");
io.write("\n")
io.write("Number of SKPs total: ", skpsTotal, "\n")
io.write("Number of SKPs that draw paths: ", skpsWithPath, "\n")
io.write("Number of SKPs that draw SW paths: ", skpsWithSWPath, "\n")
io.write("\n")
io.write("\n")
totalSWPaths = swDrawPaths + swClipPaths
totalPaths = drawPaths + clipPaths
io.write("Percentage of paths needing software: ", (100*(totalSWPaths / totalPaths)), "\n")
io.write("Percentage of draws/clips needing software: ",
(100*(totalSWPaths / (draws + clips))), "\n")
io.write("\n")
io.write("Percentage of SKPs that draw paths: ", (100*(skpsWithPath / skpsTotal)), "\n")
io.write("Percentage of SKPs that draw SW paths: ", (100*(skpsWithSWPath / skpsTotal)), "\n")
| bsd-3-clause |
linushsao/marsu_game-linus-v0.2 | server_side/irc/chatcmds.lua | 6 | 3393 | -- This file is licensed under the terms of the BSD 2-clause license.
-- See LICENSE.txt for details.
-- Note: This file does NOT conatin every chat command, only general ones.
-- Feature-specific commands (like /join) are in their own files.
minetest.register_chatcommand("irc_msg", {
params = "<name> <message>",
description = "Send a private message to an IRC user",
privs = {shout=true},
func = function(name, param)
if not irc.connected then
minetest.chat_send_player(name, "Not connected to IRC. Use /irc_connect to connect.")
return
end
local found, _, toname, message = param:find("^([^%s]+)%s(.+)")
if not found then
minetest.chat_send_player(name, "Invalid usage, see /help irc_msg.")
return
end
local toname_l = toname:lower()
local validNick = false
for nick, user in pairs(irc.conn.channels[irc.config.channel].users) do
if nick:lower() == toname_l then
validNick = true
break
end
end
if toname_l:find("serv$") or toname_l:find("bot$") then
validNick = false
end
if not validNick then
minetest.chat_send_player(name,
"You can not message that user. (Hint: They have to be in the channel)")
return
end
irc:say(toname, irc:playerMessage(name, message))
minetest.chat_send_player(name, "Message sent!")
end
})
minetest.register_chatcommand("irc_names", {
params = "",
description = "List the users in IRC.",
func = function(name, params)
if not irc.connected then
minetest.chat_send_player(name, "Not connected to IRC. Use /irc_connect to connect.")
return
end
local users = { }
for k, v in pairs(irc.conn.channels[irc.config.channel].users) do
table.insert(users, k)
end
minetest.chat_send_player(name, "Users in IRC: "..table.concat(users, ", "))
end
})
minetest.register_chatcommand("irc_connect", {
description = "Connect to the IRC server.",
privs = {irc_admin=true},
func = function(name, param)
if irc.connected then
minetest.chat_send_player(name, "You are already connected to IRC.")
return
end
minetest.chat_send_player(name, "IRC: Connecting...")
irc:connect()
end
})
minetest.register_chatcommand("irc_disconnect", {
params = "[message]",
description = "Disconnect from the IRC server.",
privs = {irc_admin=true},
func = function(name, param)
if not irc.connected then
minetest.chat_send_player(name, "You are not connected to IRC.")
return
end
if params == "" then
params = "Manual disconnect by "..name
end
irc:disconnect(param)
end
})
minetest.register_chatcommand("irc_reconnect", {
description = "Reconnect to the IRC server.",
privs = {irc_admin=true},
func = function(name, param)
if not irc.connected then
minetest.chat_send_player(name, "You are not connected to IRC.")
return
end
irc:disconnect("Reconnecting...")
irc:connect()
end
})
minetest.register_chatcommand("irc_quote", {
params = "<command>",
description = "Send a raw command to the IRC server.",
privs = {irc_admin=true},
func = function(name, param)
if not irc.connected then
minetest.chat_send_player(name, "You are not connected to IRC.")
return
end
irc:queue(param)
minetest.chat_send_player(name, "Command sent!")
end
})
local oldme = minetest.chatcommands["me"].func
minetest.chatcommands["me"].func = function(name, param, ...)
oldme(name, param, ...)
irc:say(("* %s %s"):format(name, param))
end
| gpl-3.0 |
Zenny89/darkstar | scripts/globals/spells/bluemagic/mysterious_light.lua | 18 | 1889 | -----------------------------------------
-- Spell: Mysterious Light
-- Deals wind damage to enemies within range. Additional effect: Weight
-- Spell cost: 73 MP
-- Monster Type: Arcana
-- Spell Type: Magical (Wind)
-- Blue Magic Points: 4
-- Stat Bonus: AGI+3
-- Level: 40
-- Casting Time: 3.75 seconds
-- Recast Time: 24.5 seconds
-- Magic Bursts on: Detonation, Fragmentation, Light
-- Combos: Max MP Boost
-----------------------------------------
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 resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0);
local params = {};
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.multiplier = 2.0;
params.tMultiplier = 1.0;
params.duppercap = 56;
params.str_wsc = 0.0;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.0;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.2;
damage = BlueMagicalSpell(caster, target, spell, params, CHR_BASED);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
if (damage > 0 and resist > 0.0625) then
local typeEffect = EFFECT_WEIGHT;
target:delStatusEffect(typeEffect);
target:addStatusEffect(typeEffect,4,0,getBlueEffectDuration(caster,resist,typeEffect));
end
return damage;
end; | gpl-3.0 |
qq779089973/my_openwrt_mod | luci/modules/admin-full/luasrc/model/cbi/admin_system/fstab.lua | 5 | 4594 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
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$
]]--
require("luci.tools.webadmin")
local fs = require "nixio.fs"
local util = require "nixio.util"
local devices = {}
util.consume((fs.glob("/dev/sd*")), devices)
util.consume((fs.glob("/dev/hd*")), devices)
util.consume((fs.glob("/dev/scd*")), devices)
util.consume((fs.glob("/dev/mmc*")), devices)
local size = {}
for i, dev in ipairs(devices) do
local s = tonumber((fs.readfile("/sys/class/block/%s/size" % dev:sub(6))))
size[dev] = s and math.floor(s / 2048)
end
m = Map("fstab", translate("Mount Points"))
local mounts = luci.sys.mounts()
v = m:section(Table, mounts, translate("Mounted file systems"))
fs = v:option(DummyValue, "fs", translate("Filesystem"))
mp = v:option(DummyValue, "mountpoint", translate("Mount Point"))
avail = v:option(DummyValue, "avail", translate("Available"))
function avail.cfgvalue(self, section)
return luci.tools.webadmin.byte_format(
( tonumber(mounts[section].available) or 0 ) * 1024
) .. " / " .. luci.tools.webadmin.byte_format(
( tonumber(mounts[section].blocks) or 0 ) * 1024
)
end
used = v:option(DummyValue, "used", translate("Used"))
function used.cfgvalue(self, section)
return ( mounts[section].percent or "0%" ) .. " (" ..
luci.tools.webadmin.byte_format(
( tonumber(mounts[section].used) or 0 ) * 1024
) .. ")"
end
mount = m:section(TypedSection, "mount", translate("Mount Points"), translate("Mount Points define at which point a memory device will be attached to the filesystem"))
mount.anonymous = true
mount.addremove = true
mount.template = "cbi/tblsection"
mount.extedit = luci.dispatcher.build_url("admin/fstab/mount/%s")
mount.create = function(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(mount.extedit % sid)
return
end
end
mount:option(Flag, "enabled", translate("Enabled")).rmempty = false
dev = mount:option(DummyValue, "device", translate("Device"))
dev.cfgvalue = function(self, section)
local v
v = m.uci:get("fstab", section, "uuid")
if v then return "UUID: %s" % v end
v = m.uci:get("fstab", section, "label")
if v then return "Label: %s" % v end
v = Value.cfgvalue(self, section) or "?"
return size[v] and "%s (%s MB)" % {v, size[v]} or v
end
mp = mount:option(DummyValue, "target", translate("Mount Point"))
mp.cfgvalue = function(self, section)
if m.uci:get("fstab", section, "is_rootfs") == "1" then
return "/overlay"
else
return Value.cfgvalue(self, section) or "?"
end
end
fs = mount:option(DummyValue, "fstype", translate("Filesystem"))
fs.cfgvalue = function(self, section)
return Value.cfgvalue(self, section) or "?"
end
op = mount:option(DummyValue, "options", translate("Options"))
op.cfgvalue = function(self, section)
return Value.cfgvalue(self, section) or "defaults"
end
rf = mount:option(DummyValue, "is_rootfs", translate("Root"))
rf.cfgvalue = function(self, section)
return Value.cfgvalue(self, section) == "1"
and translate("yes") or translate("no")
end
ck = mount:option(DummyValue, "enabled_fsck", translate("Check"))
ck.cfgvalue = function(self, section)
return Value.cfgvalue(self, section) == "1"
and translate("yes") or translate("no")
end
swap = m:section(TypedSection, "swap", "SWAP", translate("If your physical memory is insufficient unused data can be temporarily swapped to a swap-device resulting in a higher amount of usable <abbr title=\"Random Access Memory\">RAM</abbr>. Be aware that swapping data is a very slow process as the swap-device cannot be accessed with the high datarates of the <abbr title=\"Random Access Memory\">RAM</abbr>."))
swap.anonymous = true
swap.addremove = true
swap.template = "cbi/tblsection"
swap.extedit = luci.dispatcher.build_url("admin/fstab/swap/%s")
swap.create = function(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(swap.extedit % sid)
return
end
end
swap:option(Flag, "enabled", translate("Enabled")).rmempty = false
dev = swap:option(DummyValue, "device", translate("Device"))
dev.cfgvalue = function(self, section)
local v
v = m.uci:get("fstab", section, "uuid")
if v then return "UUID: %s" % v end
v = m.uci:get("fstab", section, "label")
if v then return "Label: %s" % v end
v = Value.cfgvalue(self, section) or "?"
return size[v] and "%s (%s MB)" % {v, size[v]} or v
end
return m
| mit |
mercury233/ygopro-scripts | c17021204.lua | 6 | 1177 | --マザー・スパイダー
function c17021204.initial_effect(c)
--spsummon proc
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(c17021204.spcon)
e1:SetOperation(c17021204.spop)
c:RegisterEffect(e1)
end
function c17021204.spfilter(c)
return c:IsPosition(POS_FACEUP_DEFENSE) and c:IsAbleToGraveAsCost()
end
function c17021204.cfilter(c)
return c:GetRace()~=RACE_INSECT
end
function c17021204.check(tp)
local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_MONSTER)
return g:GetCount()~=0 and not g:IsExists(c17021204.cfilter,1,nil)
end
function c17021204.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c17021204.spfilter,c:GetControler(),0,LOCATION_MZONE,2,nil)
and c17021204.check(c:GetControler())
end
function c17021204.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c17021204.spfilter,tp,0,LOCATION_MZONE,2,2,nil)
Duel.SendtoGrave(g,REASON_COST)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c54762426.lua | 9 | 1085 | --埋蔵金の地図
function c54762426.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c54762426.condition)
e1:SetTarget(c54762426.target)
e1:SetOperation(c54762426.activate)
c:RegisterEffect(e1)
end
function c54762426.condition(e,tp,eg,ep,ev,re,r,rp)
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_TOHAND)
return ex and tg~=nil and tg:IsContains(e:GetHandler())
end
function c54762426.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
end
function c54762426.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)==2 then
Duel.BreakEffect()
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT+REASON_DISCARD)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c81954378.lua | 2 | 1679 | --死神の大鎌-デスサイス
function c81954378.initial_effect(c)
--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(c81954378.target)
e1:SetOperation(c81954378.operation)
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(c81954378.eqlimit)
c:RegisterEffect(e2)
--atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(c81954378.value)
c:RegisterEffect(e3)
end
function c81954378.eqlimit(e,c)
return c:IsCode(18175965)
end
function c81954378.filter(c)
return c:IsFaceup() and c:IsCode(18175965)
end
function c81954378.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c81954378.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c81954378.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c81954378.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c81954378.operation(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 c81954378.value(e,c)
return Duel.GetMatchingGroupCount(Card.IsType,0,LOCATION_GRAVE,LOCATION_GRAVE,nil,TYPE_MONSTER)*500
end
| gpl-2.0 |
mercury233/ygopro-scripts | c37256334.lua | 4 | 2108 | --EMカード・ガードナー
function c37256334.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
--defup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(37256334,0))
e1:SetCategory(CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1)
e1:SetTarget(c37256334.deftg)
e1:SetOperation(c37256334.defop)
c:RegisterEffect(e1)
--defup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(c37256334.defval)
c:RegisterEffect(e2)
end
function c37256334.deffilter1(c,def)
return c:IsPosition(POS_FACEUP_DEFENSE) and not c:IsDefense(def)
end
function c37256334.deftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.GetMatchingGroup(Card.IsPosition,tp,LOCATION_MZONE,0,nil,POS_FACEUP_DEFENSE)
local def=g:GetSum(Card.GetBaseDefense)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c37256334.deffilter1(chkc,def) end
if chk==0 then return Duel.IsExistingTarget(c37256334.deffilter1,tp,LOCATION_MZONE,0,1,nil,def) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c37256334.deffilter1,tp,LOCATION_MZONE,0,1,1,nil,def)
end
function c37256334.defop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local g=Duel.GetMatchingGroup(Card.IsPosition,tp,LOCATION_MZONE,0,nil,POS_FACEUP_DEFENSE)
local def=g:GetSum(Card.GetBaseDefense)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(def)
tc:RegisterEffect(e1)
end
end
function c37256334.deffilter2(c)
return c:IsFaceup() and c:IsSetCard(0x9f)
end
function c37256334.defval(e,c)
local g=Duel.GetMatchingGroup(c37256334.deffilter2,c:GetControler(),LOCATION_MZONE,0,c)
return g:GetSum(Card.GetBaseDefense)
end
| gpl-2.0 |
rouing/FHLG-BW | entities/entities/ent_mad_flash/shared.lua | 1 | 1575 | ENT.Type = "anim"
ENT.PrintName = "Flash"
ENT.Author = "Worshipper"
ENT.Contact = "Josephcadieux@hotmail.com"
ENT.Purpose = ""
ENT.Instructions = ""
/*---------------------------------------------------------
Name: ENT:SetupDataTables()
Desc: Setup the data tables.
---------------------------------------------------------*/
function ENT:SetupDataTables()
self:DTVar("Bool", 0, "Explode")
end
/*---------------------------------------------------------
Name: ENT:OnRemove()
---------------------------------------------------------*/
function ENT:OnRemove()
end
/*---------------------------------------------------------
Name: ENT:PhysicsUpdate()
---------------------------------------------------------*/
function ENT:PhysicsUpdate()
end
/*---------------------------------------------------------
Name: ENT:PhysicsCollide()
---------------------------------------------------------*/
function ENT:PhysicsCollide(data, phys)
if data.Speed > 50 then
self.Entity:EmitSound(Sound("Flashbang.Bounce"))
end
local impulse = -data.Speed * data.HitNormal * 0.4 + (data.OurOldVelocity * -0.6)
phys:ApplyForceCenter(impulse)
if not self.Collide then self.Collide = false end
if self.Collide then return end
timer.Simple(0.9, function()
if not self.Entity then return end
if not IsFirstTimePredicted() then return end
self.Entity:SetDTBool(0, true)
end)
timer.Simple(1, function()
if not self.Entity then return end
if not IsFirstTimePredicted() then return end
self:Explode()
end)
self.Entity.Collide = true
end | unlicense |
MiroK/fenics16-poster | luaqrcode.lua | 1 | 1370 | qrencode = dofile("qrencode.lua") -- <--- Ooooh! You cheater!
local function matrix_to_tikz( tab , size)
if (size == nil) then size=10 end
pixel_width = size / #tab
pixel_cmd = string.format("\\filldraw[%%s] (%%f, %%f) +(-%f, %f) rectangle +(%f, -%f);",
pixel_width/2, pixel_width/2, pixel_width/2, pixel_width/2)
str_tab = {}
for y=1,#tab do
row = {}
for x=1,#tab do
if tab[x][y] > 0 then
style = "pixel on"
elseif tab[x][y] < 0 then
style = "pixel off"
else
style = "pixel err"
end
if style=="pixel off" then
row[x] = ""
else
row[x] = string.format(pixel_cmd, style, x*pixel_width, -y*pixel_width)
end
end
str_tab[y] = table.concat(row, "\n")
end
local extra = {}
extra[1] = string.format("\\coordinate (aux1) at (%f,-%f);", pixel_width/2, size+pixel_width/2)
extra[2] = string.format("\\coordinate (aux2) at (%f, %f);", size+pixel_width/2, -pixel_width/2)
extra[3] = "\\node[inner sep=0pt, fit=(aux1) (aux2)] (qrcode) {};"
str_tab[#tab+1] = table.concat(extra, "\n")
return table.concat(str_tab,"\n")
end
function tikzQRCode(txt, size)
local ok, tab_or_message = qrencode.qrcode(txt)
if not ok then
tex.print(tab_or_message)
else
tex.print(matrix_to_tikz(tab_or_message, size))
end
end
| mit |
Zenny89/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Animated_Tachi.lua | 16 | 1477 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Animated Tachi
-----------------------------------
require("scripts/globals/status");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
if (mob:AnimationSub() == 3) then
SetDropRate(117,1580,1000);
else
SetDropRate(117,1580,0);
end
target:showText(mob,ANIMATED_TACHI_DIALOG);
SpawnMob(17330445,120):updateEnmity(target);
SpawnMob(17330446,120):updateEnmity(target);
SpawnMob(17330447,120):updateEnmity(target);
SpawnMob(17330457,120):updateEnmity(target);
SpawnMob(17330458,120):updateEnmity(target);
SpawnMob(17330459,120):updateEnmity(target);
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
-- TODO: add battle dialog
end;
-----------------------------------
-- onMobDisengage
-----------------------------------
function onMobDisengage(mob)
mob:showText(mob,ANIMATED_TACHI_DIALOG+2);
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
killer:showText(mob,ANIMATED_TACHI_DIALOG+1);
DespawnMob(17330445);
DespawnMob(17330446);
DespawnMob(17330447);
DespawnMob(17330457);
DespawnMob(17330458);
DespawnMob(17330459);
end; | gpl-3.0 |
Zenny89/darkstar | scripts/zones/Phomiuna_Aqueducts/npcs/_0rw.lua | 17 | 1304 | -----------------------------------
-- Area: Phomiuna_Aqueducts
-- NPC: _0rw (Oil Lamp)
-- Notes: Opens south door at J-9 from inside.
-- @pos 103.703 -26.180 83.000 27
-----------------------------------
package.loaded["scripts/zones/Phomiuna_Aqueducts/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Phomiuna_Aqueducts/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local DoorOffset = npc:getID() - 1;
if (GetNPCByID(DoorOffset):getAnimation() == 9) then
if (player:getZPos() < 85) then
npc:openDoor(7); -- torch animation
GetNPCByID(DoorOffset):openDoor(7); -- _0rh
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 |
Zenny89/darkstar | scripts/zones/Castle_Oztroja/npcs/_47j.lua | 17 | 1570 | -----------------------------------
-- Area: Castle Oztroja
-- NPC: _47j (Torch Stand)
-- Notes: Opens door _472 near password #1
-- @pos -62.533 -1.859 -30.634 151
-----------------------------------
package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Castle_Oztroja/TextIDs");
require("scripts/globals/settings");
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local DoorID = npc:getID() - 4;
local DoorA = GetNPCByID(DoorID):getAnimation();
local TorchStandA = npc:getAnimation();
local Torch2 = npc:getID();
local Torch1 = npc:getID() - 1;
if (DoorA == 9 and TorchStandA == 9) then
player:startEvent(0x000a);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
local Torch2 = GetNPCByID(17396169):getID();
local Torch1 = GetNPCByID(Torch2):getID() - 1;
local DoorID = GetNPCByID(Torch2):getID() - 4;
if (option == 1) then
GetNPCByID(Torch1):openDoor(10); -- Torch Lighting
GetNPCByID(Torch2):openDoor(10); -- Torch Lighting
GetNPCByID(DoorID):openDoor(6);
end
end;
--printf("CSID: %u",csid);
--printf("RESULT: %u",option); | gpl-3.0 |
Zenny89/darkstar | scripts/zones/Spire_of_Dem/npcs/_0j3.lua | 51 | 1321 | -----------------------------------
-- Area: Spire_of_Dem
-- NPC: web of regret
-----------------------------------
package.loaded["scripts/zones/Spire_of_Dem/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/bcnm");
require("scripts/zones/Spire_of_Dem/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (EventTriggerBCNM(player,npc)) then
return 1;
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c86868952.lua | 4 | 1954 | --武神器-ヤツカ
function c86868952.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(86868952,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(c86868952.condition)
e1:SetCost(c86868952.cost)
e1:SetTarget(c86868952.target)
e1:SetOperation(c86868952.operation)
c:RegisterEffect(e1)
end
function c86868952.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsAbleToEnterBP()
end
function c86868952.cost(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 c86868952.filter(c)
return c:IsFaceup() and c:IsSetCard(0x88) and not c:IsHasEffect(EFFECT_EXTRA_ATTACK)
end
function c86868952.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c86868952.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c86868952.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c86868952.filter,tp,LOCATION_MZONE,0,1,1,nil)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_OATH)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c86868952.ftarget)
e1:SetLabel(g:GetFirst():GetFieldID())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c86868952.ftarget(e,c)
return e:GetLabel()~=c:GetFieldID()
end
function c86868952.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(1)
tc:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c45593826.lua | 2 | 2346 | --彼岸の悪鬼 ドラゴネル
function c45593826.initial_effect(c)
--self destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetCondition(c45593826.sdcon)
c:RegisterEffect(e1)
--Special Summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(45593826,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,45593826)
e2:SetCondition(c45593826.sscon)
e2:SetTarget(c45593826.sstg)
e2:SetOperation(c45593826.ssop)
c:RegisterEffect(e2)
--to deck top
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(45593826,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,45593826)
e3:SetTarget(c45593826.dttg)
e3:SetOperation(c45593826.dtop)
c:RegisterEffect(e3)
end
function c45593826.sdfilter(c)
return c:IsFacedown() or not c:IsSetCard(0xb1)
end
function c45593826.sdcon(e)
return Duel.IsExistingMatchingCard(c45593826.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c45593826.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c45593826.sscon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c45593826.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c45593826.sstg(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 c45593826.ssop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function c45593826.dttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_DECK,0,1,nil,0xb1) end
end
function c45593826.dtop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(45593826,2))
local g=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_DECK,0,1,1,nil,0xb1)
local tc=g:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,SEQ_DECKTOP)
Duel.ConfirmDecktop(tp,1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c67968069.lua | 2 | 1210 | --ジャンク・パペット
function c67968069.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_FREE_CHAIN)
e1:SetCountLimit(1,67968069+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c67968069.target)
e1:SetOperation(c67968069.activate)
c:RegisterEffect(e1)
end
function c67968069.filter(c,e,tp)
return c:IsSetCard(0x1083) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c67968069.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c67968069.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c67968069.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c67968069.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c67968069.activate(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 |
Zenny89/darkstar | scripts/commands/addallspells.lua | 12 | 5159 | ---------------------------------------------------------------------------------------------------
-- func: addallspells
-- desc: Adds all valid spells to the given target. If no target; then to the current player.
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "s"
};
local ValidSpells = {
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,
38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,
72,73,74,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,119,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,149,150,151,152,153,154,155,156,
157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,
183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,
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,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,
287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,
313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,
339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,
365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,
391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,
417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,
443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,
469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,
495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,515,517,519,521,522,524,527,
529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,547,548,549,551,554,555,557,560,561,
563,564,565,567,569,570,572,573,574,575,576,577,578,579,581,582,584,585,587,588,589,591,592,593,594,595,
596,597,598,599,603,604,605,606,608,610,611,612,613,614,615,616,617,618,620,621,622,623,626,628,629,631,
632,633,634,636,637,638,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,
660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,
686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,
712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,736,737,738,739,740,741,742,743,744,
745,746,747,748,749,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,
789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,
815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,
841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,
867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,
893,894,895
--trusts are causing client crashes when flagged in char spells packets sent outside of zone/log in
--896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,
--922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,
--948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,
--974,975,976,977,978,979,980,981,982,983,984,985,986,987,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016
};
local function AddAllSpells(player)
for i = 1, #ValidSpells do
local silent = true; -- prevent packet spam
local save = false; -- dont wanna write to the db every time addSpell is called
if i == #ValidSpells then
silent = false;
save = true;
end
player:addSpell(ValidSpells[i], silent, save);
end
end;
function onTrigger(player, target)
if (target == nil) then
AddAllSpells(player);
else
local targ = GetPlayerByName(target);
if (targ == nil) then
player:PrintToPlayer(string.format( "Player named '%s' not found!", target ));
else
AddAllSpells(targ);
end
end
end | gpl-3.0 |
mercury233/ygopro-scripts | c71978434.lua | 2 | 3739 | --深海のミンストレル
function c71978434.initial_effect(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71978434,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,71978434)
e1:SetCost(c71978434.rmcost)
e1:SetTarget(c71978434.rmtg)
e1:SetOperation(c71978434.rmop)
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71978434,1))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCountLimit(1,71978435)
e2:SetCost(c71978434.tdcost)
e2:SetTarget(c71978434.tdtg)
e2:SetOperation(c71978434.tdop)
c:RegisterEffect(e2)
end
function c71978434.costfilter(c)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsDiscardable()
end
function c71978434.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable()
and Duel.IsExistingMatchingCard(c71978434.costfilter,tp,LOCATION_HAND,0,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c71978434.costfilter,tp,LOCATION_HAND,0,1,1,c)
g:AddCard(c)
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
end
function c71978434.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_HAND,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND)
end
function c71978434.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_HAND,nil)
if g:GetCount()==0 then return end
Duel.ConfirmCards(tp,g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
Duel.ShuffleHand(1-tp)
local c=e:GetHandler()
local fid=c:GetFieldID()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(c71978434.retcon)
e1:SetOperation(c71978434.retop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
tc:RegisterFlagEffect(71978434,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,fid)
end
function c71978434.retcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(71978434)==e:GetLabel() then
return true
else
e:Reset()
return false
end
end
function c71978434.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
function c71978434.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeckAsCost(tp,3) end
Duel.DiscardDeck(tp,3,REASON_COST)
end
function c71978434.tdfilter(c)
return c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_WATER) and not c:IsCode(71978434) and c:IsAbleToDeck()
end
function c71978434.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c71978434.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c71978434.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c71978434.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c71978434.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if tc:IsExtraDeckMonster()
or Duel.SelectOption(tp,aux.Stringid(71978434,2),aux.Stringid(71978434,3))==0 then
Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT)
else
Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c52346240.lua | 2 | 1682 | --ロックキャット
function c52346240.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(52346240,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c52346240.sptg)
e1:SetOperation(c52346240.spop)
c:RegisterEffect(e1)
end
function c52346240.filter(c,e,tp)
return c:IsLevel(1) and c:IsRace(RACE_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c52346240.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c52346240.filter(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c52346240.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c52346240.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c52346240.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
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)
tc:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
mercury233/ygopro-scripts | c47457347.lua | 3 | 1899 | --魔法名-「大いなる獣」
function c47457347.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_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c47457347.target)
e1:SetOperation(c47457347.activate)
c:RegisterEffect(e1)
end
function c47457347.filter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0xf4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c47457347.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c47457347.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c47457347.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local g=Duel.GetMatchingGroup(c47457347.filter,tp,LOCATION_REMOVED,0,nil,e,tp):Filter(Card.IsCanBeEffectTarget,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=g:SelectSubGroup(tp,aux.dncheck,false,1,ft)
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,tg:GetCount(),0,0)
end
function c47457347.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if ft<=0 or g:GetCount()==0 or (g:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then return end
if g:GetCount()<=ft then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,ft,ft,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
g:Sub(sg)
Duel.SendtoGrave(g,REASON_RULE)
end
end
| gpl-2.0 |
dustine/ChargeTransmission | stdlib/utils/queue_hashed.lua | 1 | 2306 | -------------------------------------------------------------------------------
--[[Queue]]
-------------------------------------------------------------------------------
local function NtoZ_c(x, y)
return (x >= 0 and x or (-0.5 - x)), (y >= 0 and y or (-0.5 - y))
end
local function cantorPair_v7(pos)
local x, y = NtoZ_c(math.floor(pos.x), math.floor(pos.y))
local s = x + y
local h = s * (s + 0.5) + x
return h + h
end
local Queue = {}
function Queue.new()
return {_hash={}}
end
function Queue.set_hash(t, data)
local index = data.entity.unit_number or cantorPair_v7(data.entity.position)
local hash = t._hash
hash[index] = hash[index] or {}
hash[index].count = (hash[index].count or 0) + 1
hash[index][data.hash] = data.hash
return index
end
function Queue.get_hash(t, entity)
local index = entity.unit_number or cantorPair_v7(entity.position)
return t._hash[index]
end
function Queue.insert(t, data, tick, count)
data.hash = Queue.set_hash(t, data)
t[tick] = t[tick] or {}
t[tick][#t[tick] + 1] = data
return t, count
end
function Queue.next(t, _next_tick, tick_spacing, dont_combine)
tick_spacing = tick_spacing or 1
local count = 0
local tick = (_next_tick and _next_tick >= game.tick and _next_tick) or game.tick
local next_tick = function(really_dont_combine)
tick = tick + tick_spacing
while (dont_combine or really_dont_combine) and t[tick] do
tick = tick + 1
end
count = count + 1
return tick, count
end
local queue_count = function(num)
count = count + (num or 0)
return count
end
return next_tick, queue_count
end
--Tick handler, handles executing multiple data tables in a queue
function Queue.execute(event, queue)
if queue[event.tick] then
for _, data in ipairs(queue[event.tick]) do
local hash, index = queue._hash, data.hash
if Queue[data.action] then
Queue[data.action](data)
end
hash[index][data.action] = nil
hash[index].count = hash[index].count - 1
if hash[index].count <= 0 then
hash[index] = nil
end
end
queue[event.tick] = nil
end
end
return Queue
| mit |
Zenny89/darkstar | scripts/globals/weaponskills/shell_crusher.lua | 18 | 1620 | -----------------------------------
-- Shell Crusher
-- Staff weapon skill
-- Skill Level: 175
-- Lowers target's defense. Duration of effect varies with TP.
-- If unresisted, lowers target defense by 25%.
-- Will stack with Sneak Attack.
-- Aligned with the Breeze Gorget.
-- Aligned with the Breeze Belt.
-- Element: None
-- Modifiers: STR:100%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 1;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.35; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 1.0;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
if damage > 0 then
local tp = player:getTP();
local duration = (tp/100 * 60) + 120;
if (target:hasStatusEffect(EFFECT_DEFENSE_DOWN) == false) then
target:addStatusEffect(EFFECT_DEFENSE_DOWN, 25, 0, duration);
end
end
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
mercury233/ygopro-scripts | c50065971.lua | 2 | 3106 | --超重忍者シノビ-A・C
function c50065971.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE),aux.NonTuner(Card.IsRace,RACE_MACHINE),1)
c:EnableReviveLimit()
--defense attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DEFENSE_ATTACK)
e1:SetValue(1)
c:RegisterEffect(e1)
--direct attack
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(50065971,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c50065971.dircon)
e2:SetOperation(c50065971.dirop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetOperation(c50065971.spreg)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(50065971,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetRange(LOCATION_GRAVE)
e4:SetCode(EVENT_PHASE+PHASE_STANDBY)
e4:SetCountLimit(1)
e4:SetCondition(c50065971.spcon)
e4:SetTarget(c50065971.sptg)
e4:SetOperation(c50065971.spop)
e4:SetLabelObject(e3)
c:RegisterEffect(e4)
end
function c50065971.dircon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_GRAVE,0,1,nil,TYPE_SPELL+TYPE_TRAP)
and not e:GetHandler():IsHasEffect(EFFECT_DIRECT_ATTACK)
end
function c50065971.dirop(e,tp,eg,ep,ev,re,r,rp)
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_SET_BASE_DEFENSE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(math.ceil(c:GetBaseDefense()/2))
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DIRECT_ATTACK)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e2)
end
end
function c50065971.spreg(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if bit.band(r,REASON_EFFECT+REASON_DESTROY)~=REASON_EFFECT+REASON_DESTROY then return end
if Duel.GetCurrentPhase()==PHASE_STANDBY then
e:SetLabel(Duel.GetTurnCount())
c:RegisterFlagEffect(50065971,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY,0,2)
else
e:SetLabel(0)
c:RegisterFlagEffect(50065971,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_STANDBY,0,1)
end
end
function c50065971.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and e:GetHandler():GetFlagEffect(50065971)>0
end
function c50065971.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
c:ResetFlagEffect(50065971)
end
function c50065971.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 |
ArmanKiIng/telegram--bot | plugins/img_google.lua | 660 | 3196 | do
local mime = require("mime")
local google_config = load_from_file('data/google.lua')
local cache = {}
--[[
local function send_request(url)
local t = {}
local options = {
url = url,
sink = ltn12.sink.table(t),
method = "GET"
}
local a, code, headers, status = http.request(options)
return table.concat(t), code, headers, status
end]]--
local function get_google_data(text)
local url = "http://ajax.googleapis.com/ajax/services/search/images?"
url = url.."v=1.0&rsz=5"
url = url.."&q="..URL.escape(text)
url = url.."&imgsz=small|medium|large"
if google_config.api_keys then
local i = math.random(#google_config.api_keys)
local api_key = google_config.api_keys[i]
if api_key then
url = url.."&key="..api_key
end
end
local res, code = http.request(url)
if code ~= 200 then
print("HTTP Error code:", code)
return nil
end
local google = json:decode(res)
return google
end
-- Returns only the useful google data to save on cache
local function simple_google_table(google)
local new_table = {}
new_table.responseData = {}
new_table.responseDetails = google.responseDetails
new_table.responseStatus = google.responseStatus
new_table.responseData.results = {}
local results = google.responseData.results
for k,result in pairs(results) do
new_table.responseData.results[k] = {}
new_table.responseData.results[k].unescapedUrl = result.unescapedUrl
new_table.responseData.results[k].url = result.url
end
return new_table
end
local function save_to_cache(query, data)
-- Saves result on cache
if string.len(query) <= 7 then
local text_b64 = mime.b64(query)
if not cache[text_b64] then
local simple_google = simple_google_table(data)
cache[text_b64] = simple_google
end
end
end
local function process_google_data(google, receiver, query)
if google.responseStatus == 403 then
local text = 'ERROR: Reached maximum searches per day'
send_msg(receiver, text, ok_cb, false)
elseif google.responseStatus == 200 then
local data = google.responseData
if not data or not data.results or #data.results == 0 then
local text = 'Image not found.'
send_msg(receiver, text, ok_cb, false)
return false
end
-- Random image from table
local i = math.random(#data.results)
local url = data.results[i].unescapedUrl or data.results[i].url
local old_timeout = http.TIMEOUT or 10
http.TIMEOUT = 5
send_photo_from_url(receiver, url)
http.TIMEOUT = old_timeout
save_to_cache(query, google)
else
local text = 'ERROR!'
send_msg(receiver, text, ok_cb, false)
end
end
function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local text_b64 = mime.b64(text)
local cached = cache[text_b64]
if cached then
process_google_data(cached, receiver, text)
else
local data = get_google_data(text)
process_google_data(data, receiver, text)
end
end
return {
description = "Search image with Google API and sends it.",
usage = "!img [term]: Random search an image with Google API.",
patterns = {
"^!img (.*)$"
},
run = run
}
end
| gpl-2.0 |
SharpWoW/Command | locales/enUS.lua | 1 | 35829 | --[[
* Copyright (c) 2011-2012 by Adam Hellberg.
*
* This file is part of Command.
*
* Command is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Command 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 Command. If not, see <http://www.gnu.org/licenses/>.
--]]
local L = {
-------------------
-- LocaleManager --
-------------------
LOCALE_NOT_LOADED = "The specified locale has not been loaded.",
LOCALE_UPDATE = "Set new locale to: %s",
LOCALE_PI_ACTIVE = "Player independent locale settings is now active.",
LOCALE_PI_INACTIVE = "Player independent locale settings is now inactive.",
-------------
-- General --
-------------
YES = "Yes",
NO = "No",
UNKNOWN = "Unknown",
SECONDS = "Second(s)",
------------------
-- WoW Specific --
---------------------------------------------------------------------------
-- ONLY translate these if the locale has official support on the client --
---------------------------------------------------------------------------
USE_SOULSTONE = "Use Soulstone",
REINCARNATION = "Reincarnation",
TWISTING_NETHER = "Twisting Nether",
----------
-- Core --
----------
ADDON_LOAD = "AddOn loaded! Use /cmd help or !help for help.",
SVARS_OUTDATED = "Saved Variables out of date, resetting...",
NEWVERSION_NOTICE = "\124cffFF0000A new version of \124cff00FFFF%s\124cffFF0000 is available! \124cffFFFF00Check the site you downloaded from for the updated version.",
ENABLED = "AddOn \124cff00FF00enabled\124r.",
DISABLED = "AddOn \124cffFF0000disabled\124r.",
DEBUGENABLED = "Debugging \124cff00FF00enabled\124r.",
DEBUGDISABLED = "Debugging \124cffFF0000disabled\124r.",
---------------
-- AddonComm --
---------------
AC_ERR_PREFIX = "[FATAL] Failed to register AddOn prefix %q. Maximum number of prefixes reached on client.",
AC_ERR_MSGTYPE = "Invalid message type specified: %s",
AC_ERR_MALFORMED_DATA = "Malformed data received from %s. Their AddOn is probably outdated.",
AC_ERR_MALFORMED_DATA_SEND = "[AddonComm] Malformed data detected (\"%s\"). Aborting Send...",
AC_GROUP_NORESP = "No response from group, running updater...",
AC_GROUP_R_UPDATE = "Updated group members, controller: %s",
AC_GROUP_LEFT = "Left group, resetting group variables...",
AC_GROUP_WAIT = "Waiting for group response...",
AC_GROUP_REMOVE = "Detected that %s is no longer in the group, removing and updating group members...",
AC_GROUP_SYNC = "Detected group handlers out of date! Sending sync message...",
AC_GUILD_NORESP = "No response from guild, running updater...",
AC_GUILD_R_UPDATE = "Updated guild members, controller: %s",
AC_GUILD_WAIT = "Waiting for guild response...",
-----------------
-- ChatManager --
-----------------
CHAT_ERR_CMDCHAR = "Command char has to be of type string.",
CHAT_CMDCHAR_SUCCESS = "Successfully set the command char to: %s",
CHAT_HANDLE_NOTCONTROLLER = "Not controller instance for \124cff00FFFF%s\124r, aborting.",
--------------------
-- CommandManager --
--------------------
CM_ERR_UNKNOWN = "Unknown error occurred, please contact addon author.",
CM_ERR_NOTALLOWED = "%s is not allowed to be used, %s.",
CM_ERR_NOACCESS = "You do not have permission to use that command, %s. Required access level: %d. Your access level: %d.",
CM_ERR_NOTREGGED = "%q is not a registered command.",
CM_ERR_NOCMDCHAR = "No command character specified.",
CM_ERR_NOCHAT = "This command is not allowed to be used from the chat.",
CM_ERR_CHATONLY = "This command can only be used from the chat.",
CM_ERR_DISABLED = "This command has been disabled.",
CM_ERR_PERMDISABLED = "This command has been permanently disabled.",
CM_ERR_TEMPDISABLED = "This command has been temporarily disabled.",
CM_NO_HELP = "No help available.",
CM_DEFAULT_HELP = "Prints this help message.",
CM_DEFAULT_HELPCOMMAND = "Use \"help <command>\" to get help on a specific command.",
CM_DEFAULT_CHAT = "Type !commands for a listing of commands available. Type !help <command> for help on a specific command.",
CM_DEFAULT_END = "End of help message.",
CM_HELP_HELP = "Gets help about the addon or a specific command.",
CM_HELP_USAGE = "Usage: help <command>",
CM_COMMANDS_HELP = "Print all registered commands.",
CM_VERSION_HELP = "Print the version of Command.",
CM_VERSION = "%s",
CM_SET_HELP = "Control the settings of Command.",
CM_SET_USAGE = "Usage: set cmdchar|deathmanager|summonmanager|invitemanager|duelmanager",
CM_SET_DM_ISENABLED = "DeathManager is enabled.",
CM_SET_DM_ISDISABLED = "DeathManager is disabled.",
CM_SET_DM_RELEASEDELAY_CURRENT = "DeathManager announce delay (release) is set to %s.",
CM_SET_DM_RELEASEDELAY_USAGE = "Usage: set deathmanager releasedelay [delay]",
CM_SET_DM_RESURRECTDELAY_CURRENT = "DeathManager announce delay (resurrect) is set to %s.",
CM_SET_DM_RESURRECTDELAY_USAGE = "Usage: set deathmanager resurrectdelay [delay]",
CM_SET_DM_USAGE = "Usage: set deathmanager [enable|disable|toggle|enableress|disress|togress|enablerel|disrel|togrel|enablerelann|disrelann|togglerelann|enableresann|disresann|togresann|reldelay|resdelay]",
CM_SET_SM_ISENABLED = "SummonManager is enabled.",
CM_SET_SM_ISDISABLED = "SummonManager is disabled.",
CM_SET_SM_DELAY_CURRENT = "The current delay for summon announcements is %s.",
CM_SET_SM_DELAY_USAGE = "Usage: set sm delay <delay>",
CM_SET_SM_USAGE = "Usage: set sm [enable|disable|toggle|delay]",
CM_SET_IM_ISENABLED = "InviteManager is enabled.",
CM_SET_IM_ISDISABLED = "InviteManager is disabled.",
CM_SET_IM_GROUP_DELAY_CURRENT = "Group announce delay is set to %d second(s).",
CM_SET_IM_GROUP_DELAY_USAGE = "Usage: set im groupdelay [delay]",
CM_SET_IM_GUILD_DELAY_CURRENT = "Guild announce delay is set to %d second(s).",
CM_SET_IM_GUILD_DELAY_USAGE = "Usage: set im guilddelay [delay]",
CM_SET_IM_USAGE = "Usage: set im [e|d|t|groupe|groupd|groupt|groupea|groupda|groupta|groupd|groupdd|guilde|guildd|guildt|guildea|guildda|guildta|guildeo|guilddiso|guildto|guilddelay|guildddelay]",
CM_SET_CDM_ISENABLED = "DuelManager is enabled.",
CM_SET_CDM_ISDISABLED = "DuelManager is disabled.",
CM_SET_CDM_DELAY_CURRENT = "Announce delay is set to %d second(s).",
CM_SET_CDM_DELAY_USAGE = "Usage: set duelmanager delay [delay]",
CM_SET_CDM_USAGE = "Usage: set duelmanager [enable|disable|toggle|enableannounce|disableannounce|toggleannounce|delay]",
CM_SET_CRM_ISENABLED = "RoleManager is enabled.",
CM_SET_CRM_ISDISABLED = "RoleManager is disabled.",
CM_SET_CRM_DELAY_CURRENT = "Announce delay is set to %s.",
CM_SET_CRM_DELAY_USAGE = "Usage: set rm delay [delay]",
CM_SET_CRM_USAGE = "Usage: set rm [enable|disable|toggle|enableannounce|disableannounce|toggleannounce|setdelay]",
CM_LOCALE_HELP = "Change locale settings.",
CM_LOCALE_USAGE = "Usage: locale [set|reset|usemaster|playerindependent]",
CM_LOCALE_CURRENT = "Current locale: %s.",
CM_LOCALE_SET_USAGE = "Usage: locale set <locale>",
CM_MYLOCALE_HELP = "Let's users set their own locale.",
CM_MYLOCALE_SET = "Successfully set your locale to %s.",
CM_LOCK_HELP = "Lock a player.",
CM_UNLOCK_HELP = "Unlock a player.",
CM_GETACCESS_HELP = "Get the access level of a user.",
CM_GETACCESS_STRING = "%s's access is %d (%s)",
CM_SETACCESS_HELP = "Set the access level of a user.",
CM_SETACCESS_USAGE = "Usage: setaccess [player] <group>",
CM_OWNER_HELP = "Promote a player to owner rank.",
CM_ADMIN_HELP = "Promote a player to admin rank.",
CM_ADMIN_USAGE = "Usage: admin <name>",
CM_OP_HELP = "Promote a player to op rank.",
CM_USER_HELP = "Promote a player to user rank.",
CM_BAN_HELP = "Ban a player.",
CM_BAN_USAGE = "Usage: ban <name>",
CM_AUTH_HELP = "Add/Remove/Enable/Disable auths.",
CM_AUTH_USAGE = "Usage: auth add|remove|enable|disable <target>",
CM_AUTH_ADDUSAGE = "Usage: auth add <target> <level> [password]",
CM_AUTH_ERR_SELF = "Cannot modify myself in auth list.",
CM_AUTHME_HELP = "Authenticates the sender if the correct pass is specified.",
CM_AUTHME_USAGE = "Usage: authme <password>",
CM_ACCEPTINVITE_HELP = "Accepts a pending group invite.",
CM_DECLINEINVITE_HELP = "Declines a pending group invite.",
CM_ACCEPTGUILDINVITE_HELP = "Accepts a pending guild invite.",
CM_DECLINEGUILDINVITE_HELP = "Declines a pending guild invite.",
CM_INVITE_HELP = "Invite a player to group.",
CM_INVITEME_HELP = "Player who issued the command will be invited to group.",
CM_DENYINVITE_HELP = "Player issuing this command will no longer be sent invites from this AddOn.",
CM_ALLOWINVITE_HELP = "Player issuing this command will receive invites sent from this AddOn.",
CM_KICK_HELP = "Kick a player from group with optional reason (Requires confirmation).",
CM_KICK_USAGE = "Usage: kick <player> [reason]",
CM_KINGME_HELP = "Player issuing this command will be promoted to group leader.",
CM_OPME_HELP = "Player issuing this command will be promoted to raid assistant.",
CM_DEOPME_HELP = "Player issuing this command will be demoted from assistant status.",
CM_LEADER_HELP = "Promote a player to group leader.",
CM_LEADER_USAGE = "Usage: leader <name>",
CM_PROMOTE_HELP = "Promote a player to raid assistant.",
CM_PROMOTE_USAGE = "Usage: promote <name>",
CM_DEMOTE_HELP = "Demote a player from assistant status.",
CM_DEMOTE_USAGE = "Usage: demote <name>",
CM_QUEUE_HELP = "Enter the LFG queue for the specified category.",
CM_QUEUE_USAGE = "Usage: queue <type>",
CM_QUEUE_INVALID = "No such dungeon type: %q.",
CM_LEAVELFG_HELP = "Leave the LFG queue.",
CM_LEAVELFG_FAIL = "Not queued by command, unable to cancel.",
CM_ACCEPTLFG_HELP = "Causes you to accept the LFG invite.",
CM_ACCEPTLFG_FAIL = "Not currently queued by command.",
CM_ACCEPTLFG_NOEXIST = "There is currently no LFG proposal to accept.",
CM_CONVERT_HELP = "Convert group to party or raid.",
CM_CONVERT_USAGE = "Usage: convert party||raid",
CM_CONVERT_LFG = "LFG groups cannot be converted.",
CM_CONVERT_NOGROUP = "Cannot convert if not in a group.",
CM_CONVERT_NOLEAD = "Cannot convert group, not leader.",
CM_CONVERT_PARTY = "Converted raid to party.",
CM_CONVERT_PARTYFAIL = "Group is already a party.",
CM_CONVERT_RAID = "Converted party to raid.",
CM_CONVERT_RAIDFAIL = "Group is already a raid.",
CM_CONVERT_INVALID = "Invalid group type, only \"party\" or \"raid\" allowed.",
CM_LIST_HELP = "Toggle status of a command on the blacklist/whitelist.",
CM_LIST_USAGE = "Usage: list <command>",
CM_LISTMODE_HELP = "Toggle list between being a blacklist and being a whitelist.",
CM_GROUPALLOW_HELP = "Allow a group to use a specific command.",
CM_GROUPALLOW_USAGE = "Usage: groupallow <group> <command>",
CM_GROUPDENY_HELP = "Deny a group to use a specific command.",
CM_GROUPDENY_USAGE = "Usage: groupdeny <group> <command>",
CM_RESETGROUPACCESS_HELP = "Reset the group's access to a specific command.",
CM_RESETGROUPACCESS_USAGE = "Usage: resetgroupaccess <group> <command>",
CM_USERALLOW_HELP = "Allow a user to use a specific command.",
CM_USERALLOW_USAGE = "Usage: userallow <player> <command>",
CM_USERDENY_HELP = "Deny a user to use a specific command.",
CM_USERDENY_USAGE = "Usage: userdeny <player> <command>",
CM_RESETUSERACCESS_HELP = "Reset the user's access to a specific command.",
CM_RESETUSERACCESS_USAGE = "Usage: resetuseraccess <player> <command>",
CM_TOGGLE_HELP = "Toggle AddOn on and off.",
CM_TOGGLEDEBUG_HELP = "Toggle debugging mode on and off.",
CM_READYCHECK_HELP = "Respond to ready check or initiate a new one.",
CM_READYCHECK_USAGE = "Usage: rc [accept|decline]",
CM_LOOT_HELP = "Provides various loot functions.",
CM_LOOT_USAGE = "Usage: loot type||threshold||master||pass",
CM_LOOT_LFG = "Cannot use loot command in LFG group.",
CM_LOOT_NOMETHOD = "No loot method specified.",
CM_LOOT_NOTHRESHOLD = "No loot threshold specified.",
CM_LOOT_NOMASTER = "No master looter specified.",
CM_ROLL_HELP = "Provides tools for managing or starting/stopping rolls.",
CM_ROLL_USAGE = "Usage: roll [start||stop||pass||time||do||set]",
CM_ROLL_START_USAGE = "Usage: roll start <[time] [item]>",
CM_ROLL_SET_USAGE = "Usage: roll set min||max||time <amount>",
CM_RAIDWARNING_HELP = "Sends a raid warning.",
CM_RAIDWARNING_USAGE = "Usage: raidwarning <message>",
CM_RAIDWARNING_NORAID = "Cannot send raid warning when not in a raid group.",
CM_RAIDWARNING_NOPRIV = "Cannot send raid warning: Not raid leader or assistant.",
CM_RAIDWARNING_SENT = "Sent raid warning.",
CM_DUNGEONMODE_HELP = "Set the dungeon difficulty.",
CM_DUNGEONMODE_USAGE = "Usage: dungeondifficulty <difficulty>",
CM_RAIDMODE_HELP = "Set the raid difficulty.",
CM_RAIDMODE_USAGE = "Usage: raiddifficulty <difficulty>",
CM_RELEASE_HELP = "Player will release corpse.",
CM_RESURRECT_HELP = "Player will accept pending resurrect request.",
CM_ACCEPTSUMMON_HELP = "Player will accept a pending summon request.",
CM_DECLINESUMMON_HELP = "Player will decline a pending summon request.",
CM_ACCEPTDUEL_HELP = "Accepts a pending duel request.",
CM_DECLINEDUEL_HELP = "Declines a pending duel request or cancels an active duel.",
CM_STARTDUEL_HELP = "Challenges another player to a duel.",
CM_STARTDUEL_USAGE = "Usage: startduel <target>",
CM_ROLE_HELP = "Provides various commands for controlling role assignment.",
CM_ROLE_USAGE = "Usage: role start|set|confirm",
CM_ROLE_CURRENT = "My current role is %s.",
CM_ROLE_SET_USAGE = "Usage: role set tank|healer|dps",
CM_ROLE_CONFIRM_USAGE = "Usage: role confirm [tank|healer|dps]",
CM_ROLE_NOT_ACTIVE = "Roll check is not active, did you mean to use !role set?",
CM_FOLLOW_HELP = "Starts following the specified player (or sender if no player specified).",
CM_FOLLOW_STARTED = "Started following %s!",
CM_FOLLOW_SELF = "I cannot follow myself.",
CM_EMOTE_HELP = "Performs an emote",
CM_EMOTE_USAGE = "Usage: emote <emote> (E.g: 'emote sit')",
CM_SIT_HELP = "Alias for 'emote sit'",
CM_FACT_HELP = "Returns a random or specific fact from the specified topic",
CM_FACT_USAGE = "Usage: fact <topic> [index]",
CM_CAT_HELP = "Returns a random or specific cat fact (Usage: cat [index])",
CM_FACTSTATS_HELP = "Return info about all fact topics or a specific one (Usage: factstats [topic])",
CM_FACTSETTINGS_HELP = "Configure FactsManager",
CM_FACTSETTINGS_USAGE = "factsettings [enable|disable|toggle|nodupe [enable|disable|toggle]]",
CM_FACTSETTINGS_ENABLED = "FactsManager is enabled.",
CM_FACTSETTINGS_DISABLED = "FactsManager is disabled",
CM_FACTSETTINGS_NODUPE_ENABLED = "FactsManager (No Duplicates) is enabled.",
CM_FACTSETTINGS_NODUPE_DISABLED = "FactsManager (No Duplicates) is disabled.",
CM_COINFLIP_HELP = "Flips a coin",
CM_COINFLIP_HEADS = "The coin landed heads up!",
CM_COINFLIP_TAILS = "The coin landed face down for tails!",
CM_SLAP_HELP = "Slaps someone around",
CM_SLAP = "%s slaps %s around a bit with a large trout.",
------------
-- Events --
------------
E_LFGPROPOSAL = "Group has been found, type !accept to make me accept the invite.",
E_LFGFAIL = "LFG failed, use !queue <type> to requeue.",
E_READYCHECK = "%s issued a ready check, type !rc accept to make me accept it or !rc deny to deny it.",
------------------
-- EventHandler --
------------------
EH_REGISTERED = "%q registered.",
------------
-- Logger --
------------
LOGGER_ERR_UNDEFINED = "Undefined logger level passed (%q)",
LOGGER_PREFIX_MAIN = "\124cff00FF00[%s]\124r",
LOGGER_PREFIX_DEBUG = " \124cffBBBBFFDebug\124r",
LOGGER_PREFIX_NORMAL = "",
LOGGER_PREFIX_WARNING = " \124cffFFFF00Warning\124r",
LOGGER_PREFIX_ERROR = " \124cffFF0000ERROR\124r",
-----------------
-- LootManager --
-----------------
LOOT_METHOD_GROUP = "Group Loot",
LOOT_METHOD_FFA = "Free For All",
LOOT_METHOD_MASTER = "Master Looter",
LOOT_METHOD_NEEDGREED = "Need Before Greed",
LOOT_METHOD_ROUNDROBIN = "Round Robin",
LOOT_THRESHOLD_UNCOMMON = "Uncommon",
LOOT_THRESHOLD_RARE = "Rare",
LOOT_THRESHOLD_EPIC = "Epic",
LOOT_THRESHOLD_LEGENDARY = "Legendary",
LOOT_THRESHOLD_ARTIFACT = "Artifact",
LOOT_THRESHOLD_HEIRLOOM = "Heirloom",
LOOT_THRESHOLD_UNKNOWN = "Unknown",
LOOT_MASTER_NOEXIST = "%q is not in the group and cannot be set as the master looter.",
LOOT_SM_NOLEAD = "Unable to change loot method, not group leader.",
LOOT_SM_DUPE = "The loot method is already set to %s!",
LOOT_SM_SUCCESS = "Successfully set the loot method to %s!",
LOOT_SM_SUCCESSMASTER = "Successfully set the loot method to %s (%s)!",
LOOT_SLM_NOLEAD = "Unable to change master looter, not group leader.",
LOOT_SLM_METHOD = "Cannot set master looter when loot method is set to %s.",
LOOT_SLM_SPECIFY = "Master looter not specified.",
LOOT_SLM_SUCCESS = "Successfully set %s as the master looter!",
LOOT_ST_NOLEAD = "Unable to change loot threshold, not group leader.",
LOOT_ST_INVALID = "Invalid loot threshold specified, please specify a loot threshold between 2 and 7 (inclusive).",
LOOT_ST_SUCCESS = "Successfully set the loot threshold to %s!",
LOOT_SP_PASS = "%s is now passing on loot.",
LOOT_SP_ROLL = "%s is not passing on loot.",
-------------------
-- PlayerManager --
-------------------
PM_ERR_NOCOMMAND = "No command specified.",
PM_ERR_LOCKED = "Target player is locked and cannot be modified.",
PM_ERR_NOTINGROUP = "%s is not in the group.",
PM_MATCH_INVITEACCEPTED_PARTY = "(%w+) joins the party.",
PM_MATCH_INVITEACCEPTED_RAID = "(%w+) has joined the raid group.",
PM_MATCH_INVITEDECLINED = "(%w+) declines your group invitation.",
PM_MATCH_INGROUP = "(%w+) is already in a group.",
PM_MATCH_NOTFOUND = "Cannot find player '(%w+)'.",
PM_MATCH_NOTPLAYING = "No player named '(%w+)' is currently playing.",
PM_ACCESS_ALLOWED = "%q is now allowed for %s.",
PM_ACCESS_DENIED = "%q is now denied for %s.",
PM_KICK_REASON = "%s has been kicked on %s's request. (Reason: %s)",
PM_KICK = "%s has been kicked on %s's request.",
PM_KICK_NOTIFY = "%s was kicked on your request.",
PM_KICK_TARGET = "You have ben kicked out of the group by %s.",
PM_KICK_DENIED = "%s's request to kick %s has been denied.",
PM_KICK_POPUP = "%s wants to kick %s. Confirm?",
PM_KICK_SELF = "Cannot kick myself.",
PM_KICK_FRIEND = "Cannot kick my friend.",
PM_KICK_DEFAULTREASON = "%s used !kick command.",
PM_KICK_WAIT = "Awaiting confirmation to kick %s...",
PM_KICK_NOPRIV = "Unable to kick %s from group. Not group leader or assistant.",
PM_KICK_TARGETASSIST = "Unable to kick %s, assistants cannot kick other assistants from group.",
PM_PLAYER_CREATE = "Created player %q (%s) with default settings.",
PM_PLAYER_UPDATE = "Updated player %q (%s).",
PM_GA_REMOVED = "%q removed from group %s.",
PM_GA_EXISTSALLOW = "%q already has that command on the allow list.",
PM_GA_EXISTSDENY = "%q already has that command on the deny list.",
PM_PA_REMOVED = "%q removed from %s.",
PM_PA_EXISTSALLOW = "%s already has that command on the allow list.",
PM_PA_EXISTSDENY = "%s already has that command on the deny list.",
PM_LOCKED = "Player %s has been locked.",
PM_UNLOCKED = "Player %s has been unlocked",
PM_SAG_SELF = "Cannot modify my own access level.",
PM_SAG_NOEXIST = "No such access group: %q",
PM_SAG_SET = "Set the access level of %q to %d (%s).",
PM_INVITE_SELF = "Cannot invite myself to group.",
PM_INVITE_INGROUP = "%s is already in the group.",
PM_INVITE_FULL = "The group is already full.",
PM_INVITE_LFG = "Cannot invite players to an LFG group.",
PM_INVITE_ACTIVE = "%s already has an active invite.",
PM_INVITE_DECLINED = "%s has declined the group invite.",
PM_INVITE_INOTHERGROUP = "%s is already in a group.",
PM_INVITE_NOTFOUND = "Unable to find player %s.",
PM_INVITE_NOTIFYTARGET = "Invited you to the group.",
PM_INVITE_NOTIFY = "%s invited you to the group, %s. Whisper !blockinvites to block these invites.",
PM_INVITE_SUCCESS = "Invited %s to group.",
PM_INVITE_BLOCKED = "%s does not wish to be invited.",
PM_INVITE_NOPRIV = "Unable to invite %s to group. Not group leader or assistant.",
PM_DI_BLOCKING = "You are now blocking invites, whisper !allowinvites to receive them again.",
PM_DI_SUCCESS = "%s is no longer receiving invites.",
PM_DI_FAIL = "You are already blocking invites.",
PM_AI_ALLOWING = "You are now allowing invites, whisper !blockinvites to block them.",
PM_AI_SUCCESS = "%s is now receiving invites.",
PM_AI_FAIL = "You are already allowing invites.",
PM_LEADER_SELF = "Cannot promote myself to leader.",
PM_LEADER_DUPE = "%s is already leader.",
PM_LEADER_SUCCESS = "Promoted %s to group leader.",
PM_LEADER_NOPRIV = "Cannot promote %s to group leader, insufficient permissions.",
PM_ASSIST_SELF = "Cannot promote myself to assistant.",
PM_ASSIST_DUPE = "%s is already assistant.",
PM_ASSIST_NORAID = "Cannot promote to assistant when not in a raid.",
PM_ASSIST_SUCCESS = "Promoted %s to assistant.",
PM_ASSIST_NOPRIV = "Cannot promote %s to assistant, insufficient permissions.",
PM_DEMOTE_SELF = "Cannot demote myself.",
PM_DEMOTE_INVALID = "%s is not an assistant, can only demote assistants.",
PM_DEMOTE_NORAID = "Cannot demote when not in a raid.",
PM_DEMOTE_SUCCESS = "Demoted %s.",
PM_DEMOTE_NOPRIV = "Cannot demote %s, insufficient permissions.",
PM_LIST_ADDWHITE = "Added %s to whitelist.",
PM_LIST_ADDBLACK = "Added %s to blacklist.",
PM_LIST_REMOVEWHITE = "Removed %s from whitelist.",
PM_LIST_REMOVEBLACK = "Removed %s from blacklist.",
PM_LIST_SETWHITE = "Now using list as whitelist.",
PM_LIST_SETBLACK = "Now using list as blacklist.",
------------------
-- EmoteManager --
------------------
EM_ERR_UNKNOWN = "Unknown emote: %s",
EM_ERR_CANNOT = "Unable to perform emote %q: %s",
EM_SUCCESS = "Successfully executed the %s emote!",
EM_VALIDATOR_ERR_MOVEMENT = "Cannot perform that emote while moving",
EM_VALIDATOR_ERR_FLYING = "Cannot perform that emote while flying",
EM_VALIDATOR_ERR_COMBAT = "Cannot perform that emote while in combat",
------------------
-- DeathManager --
------------------
DM_ERR_NOTDEAD = "I am not dead.",
DM_ENABLED = "DeathManager has been enabled.",
DM_DISABLED = "DeathManager has been disabled.",
DM_RELEASE_ENABLED = "DeathManager (Release) has been enabled.",
DM_RELEASE_DISABLED = "DeathManager (Release) has been disabled.",
DM_RESURRECT_ENABLED = "DeathManager (Resurrect) has been enabled.",
DM_RESURRECT_DISABLED = "DeathManager (Resurrect) has been disabled.",
DM_RELEASE_ANNOUNCE_ENABLED = "DeathManager will now announce on death.",
DM_RELEASE_ANNOUNCE_DISABLED = "DeathManager will no longer announce on death.",
DM_RESURRECT_ANNOUNCE_ENABLED = "DeathManager will now announce when receiving a resurrection.",
DM_RESURRECT_ANNOUNCE_DISABLED = "DeathManager will no longer announce when receiving a resurrection.",
DM_RELEASE_SETDELAY_INSTANT = "DeathManager will now announce deaths instantly.",
DM_RELEASE_SETDELAY_SUCCESS = "DeathManager will announce deaths after %s.",
DM_RESURRECT_SETDELAY_INSTANT = "DeathManager will now announce resurrections instantly.",
DM_RESURRECT_SETDELAY_SUCCESS = "DeathManager will announce resurrections after %s.",
DM_ONDEATH = "I have died! Type !release to make me release spirit.",
DM_ONDEATH_SOULSTONE = "Died with active soulstone, type !ress to make me ress!",
DM_ONDEATH_REINCARNATE = "Died with reincarnate off cooldown, type !ress to make me ress!",
DM_ONDEATH_CARD = "Died with proc from Twisted Nether active, type !ress to make me ress!",
DM_ONRESS = "I have received a ress from %s! Type !ress to make me accept it.",
DM_RELEASE_NOTDEAD = "I am not dead or have already released.",
DM_RELEASED = "Released corpse!",
DM_RESURRECT_NOTACTIVE = "I have no pending resurrection request or it has expired.",
DM_RESURRECTED = "Successfully resurrected!",
DM_RESURRECTED_SOULSTONE = "Resurrected with soulstone!",
DM_RESURRECTED_REINCARNATE = "Resurrected with reincarnate!",
DM_RESURRECTED_CARD = "Resurrected with Darkmoon Card: Twisting Nether proc!",
DM_RESURRECTED_PLAYER = "Accepted resurrect from %s!",
-------------------
-- SummonManager --
-------------------
SM_ERR_NOSUMMON = "I do not have an active summon request or it has expired.",
SM_ENABLED = "Summon Manager has been enabled!",
SM_DISABLED = "Summon Manager has been disabled!",
SM_ONSUMMON = "I have received a summon to %s from %s, expires in %s! Type !acceptsummon or !declinesummon to make me accept or decline the request.",
SM_ACCEPTED = "Accepted summon request from %s!",
SM_DECLINED = "Declined summon request from %s!",
SM_SETDELAY_SUCCESS = "Summon announce delay successfully set to %s!",
SM_SETDELAY_INSTANT = "Summons will now announce instantly when received.",
-------------------
-- InviteManager --
-------------------
IM_GUILD_CONFIRM_OVERRIDE_POPUP = "Enabling this will render users able to issue !acceptguild even if you have reputation with a former guild, in which case you lose that reputation.\nAre you sure you want to enable this setting?",
IM_ENABLED = "InviteManager has been enabled!",
IM_DISABLED = "InviteManager has been disabled!",
IM_GROUP_ENABLED = "InviteManager (Group) has been enabled!",
IM_GROUP_DISABLED = "InviteManager (Group) has been disabled!",
IM_GROUPANNOUNCE_ENABLED = "Group invite announcement has been enabled!",
IM_GROUPANNOUNCE_DISABLED = "Group invite announcement has been disabled!",
IM_GROUPDELAY_NUM = "Group announce delay must be a number.",
IM_GROUPDELAY_OUTOFRANGE = "Group announce delay must be between 0 and %d seconds.",
IM_GROUPDELAY_SET = "Group announce delay set to %d second(s)!",
IM_GROUPDELAY_DISABLED = "Group announce delay disabled, announcement will now be sent instantly!",
IM_GUILD_ENABLED = "InviteManager (Guild) has been enabled!",
IM_GUILD_DISABLED = "InviteManager (Guild) has been disabled!",
IM_GUILDANNOUNCE_ENABLED = "Guild invite announcement has been enabled!",
IM_GUILDANNOUNCE_DISABLED = "Guild invite announcement has been disabled!",
IM_GUILDOVERRIDE_PENDING = "The guild override setting is currently being modified, please finish modifying it before issuing this command again.",
IM_GUILDOVERRIDE_WAITING = "Waiting for user input on guild override setting popup...",
IM_GUILDOVERRIDE_ENABLED = "Guild override has been enabled, users will now be able to issue !acceptguildinvite even if you have reputation with a former guild. !! USE WITH CARE !!",
IM_GUILDOVERRIDE_DISABLED = "Guild override has been disabled, users will no longer be able to issue !acceptguildinvite if you have reputation with a former guild.",
IM_GUILDDELAY_NUM = "Guild announce delay must be a number.",
IM_GUILDDELAY_OUTOFRANGE = "Guild announce delay must be between 0 and %d seconds.",
IM_GUILDDElAY_SET = "Guild announce delay set to %d second(s)!",
IM_GUILDDELAY_DISABLED = "Guild announce delay disabled, announcement will now be sent instantly!",
IM_GROUP_ANNOUNCE = "Type !accept to make me accept the group invite or !decline to decline it!",
IM_GUILD_ANNOUNCE = "Type !acceptguildinvite to make me accept the guild invite or !declineguildinvite to declie it!",
IM_GROUP_NOINVITE = "I do not have an active group invite.",
IM_GROUP_ACCEPTED = "Accepted group invite!",
IM_GROUP_DECLINED = "Declined group invite.",
IM_GUILD_NOINVITE = "I do not have an active guild invite.",
IM_GUILD_HASREP = "Unable to auto-accept guild invite, I still have reputation with my former guild that would be lost.",
IM_GUILD_ACCEPTED = "Accepted guild invite!",
IM_GUILD_DECLINED = "Declined guild invite.",
-----------------
-- DuelManager --
-----------------
CDM_ERR_NODUEL = "I do not currently have an active duel request.",
CDM_ANNOUNCE = "Type !acceptduel to make me accept the duel request or !decline duel to decline it!",
CDM_ACCEPETED = "Accepted duel request!",
CDM_DECLINED = "Declined duel request.",
CDM_CANCELLED = "Cancelled active duel (if any).",
CDM_CHALLENGED = "Sent a duel request to %s!",
CDM_ENABLED = "DuelManager has been enabled!",
CDM_DISABLED = "DuelManager has been disabled.",
CDM_ANNOUNCE_ENABLED = "DuelManager announce has been enabled!",
CDM_ANNOUNCE_DISABLED = "DuelManager announce has been disabled.",
CDM_DELAY_NUM = "Delay has to be a number.",
CDM_DELAY_OUTOFRANGE = "Delay has to be between 0 and %d seconds.",
CDM_DELAY_SET = "Announce delay set to %d second(s)!",
CDM_DELAY_DISABLED = "Announce delay has been disabled, will now announce immediately.",
-----------------
-- RoleManager --
-----------------
CRM_ENABLED = "RoleManager enabled.",
CRM_DISABLED = "RoleManager disabled.",
CRM_TANK = "Tank",
CRM_HEALER = "Healer",
CRM_DAMAGE = "DPS",
CRM_UNDEFINED = "Undefined",
CRM_ANNOUNCE_HASROLE = "Role check started! Confirm my current role (%s) with !role confirm or set a new one with !role confirm tank|healer|dps",
CRM_ANNOUNCE_NOROLE = "Role check started! Set my role with !role confirm tank|healer|dps",
CRM_SET_INVALID = "I cannot fulfill the role of %s, please specify another role.",
CRM_SET_SUCCESS = "Successfully set my role to %s!",
CRM_CONFIRM_NOROLE = "No role set, confirmation needed with role confirm tank|healer|dps",
CRM_START_ACTIVE = "A role check is already pending, please wait until it has ended.",
CRM_START_NOPRIV = "Unable to start role check, not leader or assistant.",
CRM_START_NOGROUP = "Role checks can only be started when in a group.",
CRM_STARTDELAY_SUCCESS = "RoleManager announce delay set to %s!",
CRM_STARTDELAY_INSTANT = "RoleManager now announces instantly.",
-----------------------
-- ReadyCheckManager --
-----------------------
RCM_INACTIVE = "No ready check is currently running.",
RCM_RESPONDED = "I have already responded to the ready check.",
RCM_ENABLED = "ReadyCheckManager has been enabled.",
RCM_DISABLED = "ReadyCheckManager has been disabled.",
RCM_ANNOUNCE = "%s has started a ready check! Type !rc accept to make me accept or !rc deny to deny it.",
RCM_ACCEPTED = "Accepted the ready check!",
RCM_DECLINED = "Declined the ready check!",
RCM_START_ISSUED = "%s has started a ready check!",
RCM_START_NOPRIV = "Unable to start ready check, not leader or assistant.",
RCM_ANNOUNCE_ENABLED = "ReadyCheckManager will now announce received ready checks.",
RCM_ANNOUNCE_DISABLED = "ReadyCheckManager will no longer announce recevied ready checks.",
RCM_SETDELAY_SUCCESS = "ReadyCheckManager announce delay set to %d second(s)!",
RCM_SETDELAY_INSTANT = "ReadyCheckManager will now announce instantly!",
-----------------
-- AuthManager --
-----------------
AM_ERR_NOEXISTS = "%q does not exist in the auth list.",
AM_ERR_USEREXISTS = "%q is already in the auth list, please authenticate with authme.",
AM_ERR_DISABLED = "%q is disabled in the auth list.",
AM_ERR_NOLEVEL = "No access level specified.",
AM_ERR_AUTHED = "%q is already authenticated!",
AM_AUTH_ERR_INVALIDPASS = "Invalid password.",
AM_AUTH_SUCCESS = "%q successfully authenticated for access level %d!",
AM_ADD_SUCCESS = "Added %q to auth list for access level %d, password: %s. Authenticate with !authme.",
AM_ADD_WHISPER = "Added you to the auth list for access level %d, password: %s. Authenticate with !authme.",
AM_REMOVE_SUCCESS = "Removed %q from auth list.",
AM_ENABLE_SUCCESS = "Enabled %q for authentication.",
AM_DISABLE_SUCCESS = "Disabled %q from authenticating.",
----------------
-- GroupTools --
----------------
GT_DUNGEON_NORMAL = "Normal",
GT_DUNGEON_HEROIC = "Heroic",
GT_DUNGEON_CHALLENGE = "Challenge",
GT_RAID_N10 = "Normal (10)",
GT_RAID_N25 = "Normal (25)",
GT_RAID_H10 = "Heroic (10)",
GT_RAID_H25 = "Heroic (25)",
GT_DIFF_INVALID = "%q is not a valid difficulty.",
GT_DD_DUPE = "Dungeon difficulty is already set to %s.",
GT_DD_SUCCESS = "Successfully set the dungeon difficulty to %s!",
GT_RD_DUPE = "Raid difficulty is already set to %s.",
GT_RD_SUCCESS = "Successfully set raid difficulty to %s!",
------------------
-- QueueManager --
------------------
QM_QUEUE_START = "Starting queue for %s, please select your role(s)... Type !cancel to cancel.",
QM_CANCEL = "Left the LFG queue.",
QM_ACCEPT = "Accepted LFG invite.",
QM_ANNOUNCE_QUEUEING = "Now queueing for %s, type !cancel to cancel.",
QM_ANNOUNCE_ROLECANCEL = "Role Check cancelled.",
QM_ANNOUNCE_LFGCANCEL = "LFG cancelled.",
-----------------
-- RollManager --
-----------------
RM_ERR_INVALIDAMOUNT = "Invalid amount passed: %s.",
RM_ERR_NOTRUNNING = "No roll is currently in progress.",
RM_ERR_INVALIDROLL = "%s specified too high or too low roll region, not including their roll.",
RM_MATCH = "(%w+) rolls (%d+) %((%d+)-(%d+)%)",
RM_ROLLEXISTS = "%s has already rolled! (%d)",
RM_ROLLPROGRESS = "%d/%d players have rolled!",
RM_UPDATE_TIMELEFT = "%d seconds left to roll!",
RM_SET_MINFAIL = "Minimum roll number cannot be higher than maximum roll number!",
RM_SET_MINSUCCESS = "Successfully set minimum roll number to %d!",
RM_SET_MAXFAIL = "Maximum roll number cannot be lower than minimum roll number!",
RM_SET_MAXSUCCESS = "Successfully set maximum roll number to %d!",
RM_SET_TIMEFAIL = "Amount must be larger than zero (0).",
RM_SET_TIMESUCCESS = "Successfully set default roll time to %d!",
RM_START_RUNNING = "A roll is already in progress, wait for it to complete or use roll stop.",
RM_START_SENDER = "Could not identify sender: %s. Aborting roll...",
RM_START_MEMBERS = "Could not start roll, not enough group members!",
RM_START_SUCCESS = "%s started a roll, ends in %d seconds! Type /roll %d %d. Type !roll pass to pass.",
RM_START_SUCCESSITEM = "%s started a roll for %s, ends in %d seconds! Type /roll %d %d. Type !roll pass to pass.",
RM_STOP_SUCCESS = "Roll has been stopped.",
RM_DO_SUCCESS = "Done! Executed RandomRoll(%d, %d)",
RM_PASS_SUCCESS = "%s has passed on the roll.",
RM_TIME_LEFT = "%d seconds remaining!",
RM_ANNOUNCE_EXPIRE = "Roll time expired! Results...",
RM_ANNOUNCE_FINISH = "Everyone has rolled! Results...",
RM_ANNOUNCE_EMPTY = "Noone rolled, there is no winner!",
RM_ANNOUNCE_PASS = "Everyone passed on the roll, there is no winner!",
RM_ANNOUNCE_PASSITEM = "Everyone passed on the roll, there is no winner for %s!",
RM_ANNOUNCE_WIN = "The winner is: %s! With a roll of %d.",
RM_ANNOUNCE_WINITEM = "The winner is: %s! With a roll of %d for %s.",
RM_ANNOUNCE_MULTIPLE = "There are multiple winners:",
RM_ANNOUNCE_MULTIPLEITEM = "There are multiple winners for %s:",
RM_ANNOUNCE_WINNER = "%s with a roll of %d.",
------------------
-- FactsManager --
------------------
FM_ERR_TOPIC_NOT_FOUND = "Unable to find the specified topic: %s.",
FM_ERR_TOPIC_EMPTY = "The specified topic, %s, is empty.",
FM_ERR_NO_TOPICS_FOUND = "FactsManager was unable to find any topics.",
FM_ERR_TOPIC_EMPTY = "The randomly selected topic, %s, is empty.",
FM_ERR_DISABLED = "FactsManager is disabled.",
FM_ERR_FACT_NOT_FOUND = "Could not find %s fact #%d.",
FM_ENABLED = "FactsManager has been enabled.",
FM_DISABLED = "FactsManager has been disabled.",
FM_NODUPE_ENABLED = "FactsManager (No Duplicates) has been enabled.",
FM_NODUPE_DISABLED = "FactsManager (No Duplicates) has been disabled.",
FM_LOADED_FORMAT = "Loaded topics: %s",
FM_INFO_FORMAT = "Topic %q has %d loaded facts."
}
Command.LocaleManager:Register("enUS", L)
| gpl-3.0 |
mercury233/ygopro-scripts | c7369217.lua | 2 | 3212 | --メタル化寄生生物-ルナタイト
function c7369217.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(7369217,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c7369217.eqtg)
e1:SetOperation(c7369217.eqop)
c:RegisterEffect(e1)
--unequip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(7369217,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(aux.IsUnionState)
e2:SetTarget(c7369217.sptg)
e2:SetOperation(c7369217.spop)
c:RegisterEffect(e2)
--immune
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetCondition(aux.IsUnionState)
e3:SetValue(c7369217.efilter)
c:RegisterEffect(e3)
--destroy sub
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_EQUIP)
e5:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e5:SetCode(EFFECT_DESTROY_SUBSTITUTE)
e5:SetCondition(aux.IsUnionState)
e5:SetValue(c7369217.repval)
c:RegisterEffect(e5)
--eqlimit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_UNION_LIMIT)
e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e6:SetValue(1)
c:RegisterEffect(e6)
end
c7369217.old_union=true
function c7369217.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c7369217.filter(c)
return c:IsFaceup() and c:GetUnionCount()==0
end
function c7369217.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c7369217.filter(chkc) end
if chk==0 then return e:GetHandler():GetFlagEffect(7369217)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c7369217.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c7369217.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
e:GetHandler():RegisterFlagEffect(7369217,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c7369217.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if not tc:IsRelateToEffect(e) or not c7369217.filter(tc) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
if not Duel.Equip(tp,c,tc,false) then return end
aux.SetUnionState(c)
end
function c7369217.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(7369217)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEUP_ATTACK) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(7369217,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c7369217.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
function c7369217.efilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer() and te:IsActiveType(TYPE_SPELL)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c58600555.lua | 2 | 3118 | --電子光虫-コアベージ
function c58600555.initial_effect(c)
c:EnableReviveLimit()
--xyz summon
aux.AddXyzProcedure(c,c58600555.mfilter,5,2,c58600555.ovfilter,aux.Stringid(58600555,2),99,c58600555.xyzop)
--Back to Deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(58600555,0))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCost(c58600555.tdcost)
e2:SetTarget(c58600555.tdtg)
e2:SetOperation(c58600555.tdop)
c:RegisterEffect(e2)
--Change position
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(58600555,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCode(EVENT_CHANGE_POS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(c58600555.condition)
e3:SetTarget(c58600555.target)
e3:SetOperation(c58600555.operation)
c:RegisterEffect(e3)
end
function c58600555.ovfilter(c)
return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsRank(3,4) and c:IsRace(RACE_INSECT)
end
function c58600555.mfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c58600555.xyzop(e,tp,chk,mc)
if chk==0 then return mc:CheckRemoveOverlayCard(tp,2,REASON_COST) end
mc:RemoveOverlayCard(tp,2,2,REASON_COST)
end
function c58600555.tdcost(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 c58600555.tdfilter(c)
return c:IsPosition(POS_DEFENSE) and c:IsAbleToDeck()
end
function c58600555.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c58600555.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c58600555.tdfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c58600555.tdfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c58600555.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
function c58600555.cfilter(c)
local np=c:GetPosition()
local pp=c:GetPreviousPosition()
return ((np<3 and pp>3) or (pp<3 and np>3))
end
function c58600555.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c58600555.cfilter,1,nil)
end
function c58600555.matfilter(c)
return c:IsRace(RACE_INSECT) and c:IsCanOverlay()
end
function c58600555.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsType(TYPE_XYZ)
and Duel.IsExistingMatchingCard(c58600555.matfilter,tp,LOCATION_GRAVE,0,1,nil) end
end
function c58600555.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c58600555.matfilter),tp,LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.Overlay(c,g)
end
end
| gpl-2.0 |
valhallaGaming/uno | branches/2_0_3_STABLE/gate-system/pd_garage_gate1.lua | 1 | 1168 | objGateh = createObject(972, 2297.1805664063, 2509.133789063, 2.2734375, 0, 0, 180)
exports.pool:allocateElement(objGateh)
open = false
-- Green door
createObject(1492, 2293.8684082031, 2494.5129394531, 2.3734375, 0, 0, 270)
-- Gate code
function usePDSideGarageGate(thePlayer)
local team = getPlayerTeam(thePlayer)
if (team==getTeamFromName("Las Venturas Metropolitan Police Department")) then
local x, y, z = getElementPosition(thePlayer)
local distance = getDistanceBetweenPoints3D(2297.1805664063, 2509.133789063, 2.2734375, x, y, z)
if (distance<=50) and (open==false) then
open = true
outputChatBox("LVMPD Side Garage Gate is now Open!", thePlayer, 0, 255, 0)
moveObject(objGateh, 1000, 2297.1805664063, 2521.8940429688, 2.2734375)
setTimer(closePDSideGarageGate, 5000, 1, thePlayer)
end
end
end
addCommandHandler("gate", usePDSideGarageGate)
function closePDSideGarageGate(thePlayer)
if (getElementType(thePlayer)) then
outputChatBox("LVMPD Side Garage Gate is now Closed!", thePlayer, 255, 0, 0)
end
open = false
moveObject(objGateh, 1000, 2297.1805664063, 2509.133789063, 2.2734375)
end | bsd-3-clause |
alfred-bot/mer2phm | plugins/domaintools.lua | 359 | 1494 | local ltn12 = require "ltn12"
local https = require "ssl.https"
-- Edit data/mashape.lua with your Mashape API key
-- http://docs.mashape.com/api-keys
local mashape = load_from_file('data/mashape.lua', {
api_key = ''
})
local function check(name)
local api = "https://domainsearch.p.mashape.com/index.php?"
local param = "name="..name
local url = api..param
local api_key = mashape.api_key
if api_key:isempty() then
return 'Configure your Mashape API Key'
end
local headers = {
["X-Mashape-Key"] = api_key,
["Accept"] = "application/json"
}
local respbody = {}
local body, code = https.request{
url = url,
method = "GET",
headers = headers,
sink = ltn12.sink.table(respbody),
protocol = "tlsv1"
}
if code ~= 200 then return code end
local body = table.concat(respbody)
local body = json:decode(body)
--vardump(body)
local domains = "List of domains for '"..name.."':\n"
for k,v in pairs(body) do
print(k)
local status = " ❌ "
if v == "Available" then
status = " ✔ "
end
domains = domains..k..status.."\n"
end
return domains
end
local function run(msg, matches)
if matches[1] == "check" then
local name = matches[2]
return check(name)
end
end
return {
description = "Domain tools",
usage = {"!domain check [domain] : Check domain name availability.",
},
patterns = {
"^!domain (check) (.*)$",
},
run = run
}
| gpl-2.0 |
ZeroK-RTS/SpringRTS-Tools | aoplate baker/plateshield.lua | 1 | 3223 | return { plateshield = {
unitname = [[plateshield]],
name = [[Shieldbot Plate]],
description = [[Augments Production]],
acceleration = 0,
brakeRate = 0,
buildCostMetal = Shared.FACTORY_PLATE_COST,
builder = true,
buildingGroundDecalDecaySpeed = 30,
buildingGroundDecalSizeX = 10,
buildingGroundDecalSizeY = 10,
buildingGroundDecalType = [[plateshield_aoplane.dds]],
buildoptions = {
[[shieldcon]],
[[shieldscout]],
[[shieldraid]],
[[shieldskirm]],
[[shieldassault]],
[[shieldriot]],
[[shieldfelon]],
[[shieldarty]],
[[shieldaa]],
[[shieldbomb]],
[[shieldshield]],
},
buildPic = [[plateshield.png]],
canMove = true,
canPatrol = true,
category = [[SINK UNARMED]],
collisionVolumeOffsets = [[0 -6 -10]],
collisionVolumeScales = [[66 26 36]],
collisionVolumeType = [[box]],
selectionVolumeOffsets = [[0 0 0]],
selectionVolumeScales = [[88 48 104]],
selectionVolumeType = [[box]],
corpse = [[DEAD]],
customParams = {
sortName = [[1]],
modelradius = [[40]],
aimposoffset = [[0 16 -25]],
midposoffset = [[0 16 -25]],
solid_factory = [[3]],
default_spacing = 4,
unstick_help = 1,
selectionscalemult = 1,
cus_noflashlight = 1,
child_of_factory = [[factoryshield]],
},
energyUse = 0,
explodeAs = [[FAC_PLATEEX]],
footprintX = 5,
footprintZ = 7,
iconType = [[padwalker]],
idleAutoHeal = 5,
idleTime = 1800,
maxDamage = Shared.FACTORY_PLATE_HEALTH,
maxSlope = 15,
maxVelocity = 0,
maxWaterDepth = 0,
minCloakDistance = 150,
moveState = 1,
noAutoFire = false,
objectName = [[factory_pad.s3o]],
script = "plateshield.lua",
selfDestructAs = [[FAC_PLATEEX]],
showNanoSpray = false,
sightDistance = 273,
turnRate = 0,
useBuildingGroundDecal = true,
workerTime = Shared.FACTORY_BUILDPOWER,
yardMap = [[oooooo oooooo oooooo cccccc cccccc cccccc cccccc]],
featureDefs = {
DEAD = {
blocking = true,
featureDead = [[HEAP]],
footprintX = 3,
footprintZ = 3,
object = [[wreck3x3c.s3o]],
},
HEAP = {
blocking = false,
footprintX = 3,
footprintZ = 3,
object = [[debris4x4a.s3o]],
},
},
} }
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Castle_Oztroja/npcs/_47v.lua | 17 | 1251 | -----------------------------------
-- Area: Castle Oztroja
-- NPC: _47v (Handle)
-- Notes: Opens door _472 from behind
-- @pos -61 0 -36 151
-----------------------------------
package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Castle_Oztroja/TextIDs");
require("scripts/globals/settings");
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local DoorID = npc:getID() - 1;
local DoorA = GetNPCByID(DoorID):getAnimation();
if (player:getZPos() < -32) then
if (DoorA == 9 and npc:getAnimation() == 9) then
npc:openDoor(6.5);
-- Should be a ~1 second delay here before the door opens
GetNPCByID(DoorID):openDoor(4.5);
end
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 |
mercury233/ygopro-scripts | c78084378.lua | 3 | 2912 | --ダイプレクサ・キマイラ
function c78084378.initial_effect(c)
--fusion material
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsRace,RACE_CYBERSE),2,true)
c:EnableReviveLimit()
--lock
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(78084378,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c78084378.con)
e1:SetCost(c78084378.cost)
e1:SetOperation(c78084378.operation)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(78084378,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,78084378)
e2:SetCondition(c78084378.thcon)
e2:SetTarget(c78084378.thtg)
e2:SetOperation(c78084378.thop)
c:RegisterEffect(e2)
end
function c78084378.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsAbleToEnterBP()
end
function c78084378.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,nil,RACE_CYBERSE) end
local g=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,nil,RACE_CYBERSE)
Duel.Release(g,REASON_COST)
end
function c78084378.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetCondition(c78084378.accon)
e1:SetValue(c78084378.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c78084378.accon(e)
local ph=Duel.GetCurrentPhase()
return ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE
end
function c78084378.aclimit(e,re,tp)
return re:IsActiveType(TYPE_SPELL+TYPE_TRAP)
end
function c78084378.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_FUSION)
end
function c78084378.filter1(c)
return c:IsRace(RACE_CYBERSE) and c:IsAbleToHand()
end
function c78084378.filter2(c)
return c:IsCode(65801012) and c:IsAbleToHand()
end
function c78084378.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c78084378.filter1,tp,LOCATION_GRAVE,0,1,e:GetHandler())
and Duel.IsExistingTarget(c78084378.filter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g1=Duel.SelectTarget(tp,c78084378.filter1,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g2=Duel.SelectTarget(tp,c78084378.filter2,tp,LOCATION_GRAVE,0,1,1,nil)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g1,2,0,0)
end
function c78084378.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c97093037.lua | 6 | 1260 | --創世者の化身
function c97093037.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(97093037,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c97093037.spcost)
e1:SetTarget(c97093037.sptg)
e1:SetOperation(c97093037.spop)
c:RegisterEffect(e1)
end
function c97093037.spcost(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 c97093037.filter(c,e,tp)
return c:IsCode(61505339) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c97093037.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c97093037.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c97093037.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,c97093037.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 |
mercury233/ygopro-scripts | c39475024.lua | 2 | 2889 | --骸の魔妖-餓者髑髏
function c39475024.initial_effect(c)
c:SetUniqueOnField(1,0,39475024)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--immune
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(39475024,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,39475024)
e1:SetCondition(c39475024.condition)
e1:SetOperation(c39475024.operation)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(39475024,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_DESTROYED)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,39475025)
e2:SetCondition(c39475024.spcon)
e2:SetTarget(c39475024.sptg)
e2:SetOperation(c39475024.spop)
c:RegisterEffect(e2)
end
function c39475024.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE)
end
function c39475024.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c39475024.imfilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c39475024.imfilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
function c39475024.spfilter(c,tp)
return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:GetPreviousTypeOnField()&TYPE_LINK~=0
and (c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp)
end
function c39475024.spcon(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c39475024.spfilter,1,nil,tp)
end
function c39475024.rmfilter(c)
return c:IsAbleToRemove() and c:IsRace(RACE_ZOMBIE)
end
function c39475024.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingMatchingCard(c39475024.rmfilter,tp,LOCATION_GRAVE,0,1,c) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_GRAVE)
end
function c39475024.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c39475024.rmfilter),tp,LOCATION_GRAVE,0,1,1,c)
if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 and c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Northern_San_dOria/npcs/Castilchat.lua | 17 | 3336 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Castilchat
-- Starts Quest: Trial Size Trial by Ice
-- @pos -186 0 107 231
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/quests");
require("scripts/globals/teleports");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
local count = trade:getItemCount();
if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED and trade:hasItemQty(532,1) and count == 1) then
player:messageSpecial(FLYER_REFUSED);
elseif (trade:hasItemQty(1545,1) and player:getQuestStatus(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE) == QUEST_ACCEPTED and player:getMainJob() == JOB_SMN and count == 1) then -- Trade mini fork of ice
player:startEvent(0x02de,0,1545,4,20);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TrialSizeByIce = player:getQuestStatus(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE);
if (player:getMainLvl() >= 20 and player:getMainJob() == JOB_SMN and TrialSizeByIce == QUEST_AVAILABLE and player:getFameLevel(SANDORIA) >= 2) then -- Requires player to be Summoner at least lvl 20
player:startEvent(0x02dd,0,1545,4,20); --mini tuning fork of ice, zone, level
elseif (TrialSizeByIce == QUEST_ACCEPTED) then
local IceFork = player:hasItem(1545);
if (IceFork) then
player:startEvent(0x02c4); --Dialogue given to remind player to be prepared
elseif (IceFork == false and tonumber(os.date("%j")) ~= player:getVar("TrialSizeIce_date")) then
player:startEvent(0x02e1,0,1545,4,20); -- Need another mini tuning fork
else
player:startEvent(0x02f6); -- Standard dialog when you loose, and you don't wait 1 real day
end
elseif (TrialSizeByIce == QUEST_COMPLETED) then
player:startEvent(0x02e0); -- Defeated Avatar
else
player:startEvent(0x02c7); -- Standard dialog
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x02dd and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1545);
else
player:setVar("TrialSizeIce_date", 0);
player:addQuest(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE);
player:addItem(1545);
player:messageSpecial(ITEM_OBTAINED,1545);
end
elseif (csid == 0x02de and option == 0 or csid == 0x02e1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1545);
else
player:addItem(1545);
player:messageSpecial(ITEM_OBTAINED,1545);
end
elseif (csid == 0x02de and option == 1) then
toCloisterOfFrost(player);
end
end; | gpl-3.0 |
ytodorov/AntServices | AdvancedNetToolsSolution/AntServicesMvc5/programs/Nmap/nselib/rtsp.lua | 4 | 8877 | ---
-- This Real Time Streaming Protocol (RTSP) library implements only a minimal
-- subset of the protocol needed by the current scripts.
--
-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html
-- @author Patrik Karlsson <patrik@cqure.net>
--
-- The library contains the following classes:
--
-- * <code>Request</code>
-- ** This class contains the functions needed to create the RTSP request
--
-- * <code>Response</code>
-- ** This class contains the functions needed to parse the RTSP response
--
-- * <code>Client</code>
-- ** This class contains the RTSP client, a class responsible for sending
-- and receiving requests and responses to/from the server
--
-- * <code>Helper</code>
-- ** This class serves as the main interface for script writers
--
-- The following sample code shows how to use the library:
-- <code>
-- local helper = rtsp.Helper:new(host, port)
-- local status = helper:connect()
-- local response
-- status, response = helper:describe(url)
-- helper:close()
-- </code>
--
-- Version 0.1
-- Created 10/23/2011 - v0.1 - Created by Patrik Karlsson
--
local nmap = require "nmap"
local stdnse = require "stdnse"
local table = require "table"
_ENV = stdnse.module("rtsp", stdnse.seeall)
-- The RTSP Request object
Request = {
--- Creates a new Request instance
-- @return o instance of Request
new = function(self, url, headers)
local o = { url = url, req = {}, headers = headers or {} }
setmetatable(o, self)
self.__index = self
return o
end,
--- Sets the RTSP Request method
-- @param method string containing the RTSP method
setMethod = function(self, method)
self.method = method
end,
--- Sets the RTSP sequence number
-- @param cseq number containing the sequence number
setCSeq = function(self, cseq)
self.cseq = cseq
end,
--- Adds an optional header to the RTSP request
-- @param header string containing the header name
-- @param value string containing the header value
addHeader = function(self, header, value)
table.insert( self.headers, { header = value } )
end,
--- Converts the Request to a string
--
-- @return req string containing the request as a string
__tostring = function(self)
assert(self.cseq, "Request is missing required header CSeq")
assert(self.url, "Request is missing URL")
local req = stdnse.strjoin("\r\n", {
("%s %s RTSP/1.0"):format(self.method, self.url),
("CSeq: %d"):format(self.cseq)
} ) .. "\r\n"
if ( #self.headers > 0 ) then
req = req .. stdnse.strjoin("\r\n", self.headers) .. "\r\n"
end
return req .. "\r\n"
end,
}
-- The RTSP response instance
Response = {
--- Creates a new Response instance
-- @param data string containing the unparsed data
new = function(self, data)
assert(data, "No data was supplied")
local o = {
raw = data,
status = tonumber(data:match("^RTSP%/1%.0 (%d*) "))
}
-- Split the response into a temporary array
local tmp = stdnse.strsplit("\r\n", data)
if ( not(tmp) ) then return nil end
-- we should have atleast one entry
if ( #tmp > 1 ) then
o.headers = {}
for i=2, #tmp do
-- if we have an empty line, this should be the end of headers
if ( #tmp[i] == 0 ) then break end
local key, val = tmp[i]:match("^(.-): (.*)$")
-- create a key per header name
o.headers[key] = val
end
end
setmetatable(o, self)
self.__index = self
return o
end,
}
-- RTSP Client class
Client = {
-- Creates a new Client instance
-- @param host table as received by the action method
-- @param port table as received by the action method
-- @return o instance of Client
new = function(self, host, port)
local o = {
host = host,
port = port,
cseq = 0,
headers = { },
retries = 3,
timeout = 10 * 1000,
}
setmetatable(o, self)
self.__index = self
return o
end,
--- Sets the number of retries for socket reads
-- @param retries number containing the number of retries
setRetries = function(self, retries) self.retries = retries end,
--- Sets the socket connection timeout in ms
-- @param timeout number containing the timeout in ms
setTimeout = function(self, timeout) self.timeout = timeout end,
--- Adds a RTSP header to the request
-- @param header string containing the header name
-- @param value string containing the header value
addHeader = function(self, header, value)
table.insert(self.headers, { ("%s: %s"):format(header,value) } )
end,
--- Connects to the RTSP server
-- @return status true on success, false on failure
-- @return err string containing the error message on failure
connect = function(self)
self.socket = nmap.new_socket()
self.socket:set_timeout(self.timeout)
local status = self.socket:connect(self.host, self.port)
if ( not(status) ) then
stdnse.debug2("Failed to connect to the server: %s", self.host.ip)
return false, ("Failed to connect to the server: %s"):format(self.host.ip)
end
return true
end,
--- Sends a DESCRIBE request to the server and receives the response
-- @param url string containing the RTSP URL
-- @return status true on success, false on failure
-- @return response Response instance on success
-- err string containing the error message on failure
describe = function(self, url)
local req = Request:new(url, self.headers)
req:setMethod("DESCRIBE")
return self:exch(req)
end,
options = function(self, url)
local req = Request:new(url, self.headers)
req:setMethod("OPTIONS")
return self:exch(req)
end,
--- Sends a request to the server and receives the response and attempts
-- to retry if either send or receive fails.
-- @param request instance of Request
-- @return status true on success, false on failure
-- @return response Response instance on success
-- err string containing the error message on failure
exch = function(self, req)
local retries = self.retries
local status, data
self.cseq = self.cseq + 1
req:setCSeq( self.cseq )
repeat
local err
status, err = self.socket:send( tostring(req) )
-- check if send was successful, in case it wasn't AND
-- this is our last retry, ABORT
if ( not(status) and 0 == retries - 1 ) then
stdnse.debug2("Failed to send request to server (%s)", err)
return false, ("Failed to send request to server (%s)"):format(err)
-- if send was successful, attempt to receive the response
elseif ( status ) then
status, data = self.socket:receive()
-- if we got the response all right, break out of retry loop
if ( status ) then break end
end
-- if either send or receive fails, re-connect the socket
if ( not(status) ) then
self:close()
local status, err = self:connect()
-- if re-connect fails, BAIL out of here
if ( not(status) ) then
stdnse.debug2("Failed to reconnect socket to server (%s)", err)
return false, ("Failed to reconnect socket to server (%s)"):format(err)
end
end
retries = retries - 1
until( status or retries == 0 )
if( not(status) ) then
stdnse.debug2("Failed to receive response from server (%s)", data)
return false, ("Failed to receive response from server (%s)"):format(data)
end
return true, Response:new(data)
end,
--- Closes the RTSP socket with the server
close = function(self)
return self.socket:close()
end,
}
-- The Helper class is the main script interface
Helper = {
-- Creates a new Helper instance
-- @param host table as received by the action method
-- @param port table as received by the action method
-- @return o instance of Client
new = function(self, host, port)
local o = { host = host, port = port, client = Client:new(host, port) }
setmetatable(o, self)
self.__index = self
return o
end,
-- Connects to the RTSP server
-- @return status true on success, false on failure
-- @return err string containing the error message on failure
connect = function(self)
return self.client:connect()
end,
-- Closes the RTSP socket with the server
close = function(self)
return self.client:close()
end,
-- Sends a DESCRIBE request to the server and receives the response
--
-- @param url string containing the RTSP URL
-- @return status true on success, false on failure
-- @return response string containing the unparsed RTSP response on success
-- err string containing the error message on failure
describe = function(self, url)
return self.client:describe(url)
end,
options = function(self, url)
return self.client:options(url)
end,
}
return _ENV;
| apache-2.0 |
mercury233/ygopro-scripts | c97091969.lua | 2 | 3759 | --武装竜の震霆
function c97091969.initial_effect(c)
--activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--atk
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(97091969,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1,97091969)
e1:SetTarget(c97091969.target)
e1:SetOperation(c97091969.activate)
c:RegisterEffect(e1)
--to hand
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(97091969,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetTarget(c97091969.thtg)
e2:SetOperation(c97091969.thop)
c:RegisterEffect(e2)
--replace
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DESTROY_REPLACE)
e3:SetRange(LOCATION_SZONE)
e3:SetTarget(c97091969.reptg)
e3:SetOperation(c97091969.repop)
e3:SetValue(c97091969.repval)
c:RegisterEffect(e3)
end
function c97091969.filter(c)
return c:IsFaceup() and c:IsSetCard(0x111) and c:IsLevelAbove(1)
end
function c97091969.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c97091969.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c97091969.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c97091969.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c97091969.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(tc:GetLevel()*100)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
function c97091969.tgfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x111) and c:IsLevelAbove(1) and Duel.IsExistingMatchingCard(c97091969.thfilter,tp,LOCATION_GRAVE,0,1,nil,c:GetLevel())
end
function c97091969.thfilter(c,lv)
return c:IsSetCard(0x111) and c:IsLevelBelow(lv) and c:IsAbleToHand()
end
function c97091969.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c97091969.tgfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(c97091969.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c97091969.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c97091969.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c97091969.thfilter),tp,LOCATION_GRAVE,0,1,1,nil,tc:GetLevel())
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
function c97091969.repfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x111) and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function c97091969.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsStatus(STATUS_DESTROY_CONFIRMED)
and c:IsAbleToGrave() and eg:IsExists(c97091969.repfilter,1,nil,tp) end
return Duel.SelectEffectYesNo(tp,c,96)
end
function c97091969.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
end
function c97091969.repval(e,c)
return c97091969.repfilter(c,e:GetHandlerPlayer())
end
| gpl-2.0 |
mercury233/ygopro-scripts | c71172240.lua | 2 | 2116 | --バックリンカー
function c71172240.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c71172240.spcon)
c:RegisterEffect(e1)
--todeck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71172240,0))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c71172240.tdcost)
e2:SetTarget(c71172240.tdtg)
e2:SetOperation(c71172240.tdop)
c:RegisterEffect(e2)
end
function c71172240.filter(c)
return c:GetSequence()>=5
end
function c71172240.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c71172240.filter,tp,0,LOCATION_MZONE,1,nil)
and not Duel.IsExistingMatchingCard(c71172240.filter,tp,LOCATION_MZONE,0,1,nil)
end
function c71172240.tdcost(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 c71172240.tdfilter(c)
return c:GetSequence()>=5 and c:IsAbleToDeck()
end
function c71172240.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71172240.tdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
local g=Duel.GetMatchingGroup(c71172240.tdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function c71172240.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c71172240.tdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(c71172240.splimit)
Duel.RegisterEffect(e1,tp)
end
function c71172240.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_EXTRA)
end
| gpl-2.0 |
notcake/gcompute | lua/gcompute/execution/executionserviceexecutionfilterable.lua | 1 | 4764 | local self = {}
GCompute.Execution.ExecutionServiceExecutionFilterable = GCompute.MakeConstructor (self, GCompute.Execution.IExecutionFilterable)
--[[
Events:
CanCreateExecutionContext (authId, hostId, languageName)
Fired when an execution context is about to be created.
CanCreateExecutionInstance (IExecutionContext executionContext, code, sourceId, instanceOptions)
Fired when an execution instance is about to be created.
CanStartExecution (IExecutionInstance executionInstance)
Fired when an execution instance is about to start execution.
ExecutionContextCreated (IExecutionContext executionContext)
Fired when an execution context has been created.
ExecutionInstanceCreated (IExecutionContext executionContext, IExecutionInstance executionInstance)
Fired when an execution instance has been created.
]]
function self:ctor (executionService)
self.ExecutionService = nil
self.ExecutionContexts = GLib.WeakKeyTable ()
self.ExecutionInstances = GLib.WeakKeyTable ()
GCompute.EventProvider (self)
self:SetExecutionService (executionService)
end
function self:SetExecutionService (executionService)
if self.ExecutionService == executionService then return self end
self:UnhookExecutionService (self.ExecutionService)
self:UnhookExecutionContexts ()
self:UnhookExecutionInstances ()
self.ExecutionService = executionService
self:HookExecutionService (self.ExecutionService)
return self
end
-- Internal, do not call
function self:HookExecutionService (executionService)
if not executionService then return end
executionService:AddEventListener ("CanCreateExecutionContext", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode (),
function (_, authId, hostId, languageName)
return self:DispatchEvent ("CanCreateExecutionContext", authId, hostId, languageName)
end
)
executionService:AddEventListener ("ExecutionContextCreated", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode (),
function (_, executionContext)
self:HookExecutionContext (executionContext)
self.ExecutionContexts [executionContext] = true
return self:DispatchEvent ("ExecutionContextCreated", executionContext)
end
)
end
function self:UnhookExecutionService (executionService)
if not executionService then return end
executionService:RemoveEventListener ("CanCreateExecutionContext", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode ())
executionService:RemoveEventListener ("ExecutionContextCreated", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode ())
end
function self:UnhookExecutionContexts ()
for executionContext, _ in pairs (self.ExecutionContexts) do
self:UnhookExecutionContext (executionContext)
end
self.ExecutionContexts = GLib.WeakKeyTable ()
end
function self:HookExecutionContext (executionContext)
if not executionContext then return end
executionContext:AddEventListener ("CanCreateExecutionInstance", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode (),
function (_, code, sourceId, instanceOptions)
return self:DispatchEvent ("CanCreateExecutionInstance", executionContext, code, sourceId, instanceOptions)
end
)
executionContext:AddEventListener ("ExecutionInstanceCreated", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode (),
function (_, executionInstance)
self:HookExecutionInstance (executionInstance)
self.ExecutionInstances [executionInstance] = true
return self:DispatchEvent ("ExecutionInstanceCreated", executionContext, executionInstance)
end
)
end
function self:UnhookExecutionContext (executionContext)
if not executionContext then return end
executionContext:RemoveEventListener ("CanCreateExecutionInstance", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode ())
executionContext:RemoveEventListener ("ExecutionInstanceCreated", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode ())
end
function self:UnhookExecutionInstances ()
for executionInstance, _ in pairs (self.ExecutionInstances) do
self:UnhookExecutionInstance (executionInstance)
end
self.ExecutionInstances = GLib.WeakKeyTable ()
end
function self:HookExecutionInstance (executionInstance)
if not executionInstance then return end
executionInstance:AddEventListener ("CanStartExecution", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode (),
function (_)
return self:DispatchEvent ("CanStartExecution", executionInstance)
end
)
end
function self:UnhookExecutionInstance (executionInstance)
if not executionInstance then return end
executionInstance:RemoveEventListener ("CanStartExecution", "GCompute.ExecutionServiceExecutionFilterable." .. self:GetHashCode ())
end | gpl-3.0 |
mercury233/ygopro-scripts | c35638627.lua | 6 | 1534 | --ワーム・ウォーロード
function c35638627.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--Disable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BATTLED)
e2:SetOperation(c35638627.disop)
c:RegisterEffect(e2)
--chain attack
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(35638627,0))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_BATTLE_DESTROYING)
e3:SetCondition(c35638627.atcon)
e3:SetOperation(c35638627.atop)
c:RegisterEffect(e3)
end
function c35638627.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttackTarget()
local c=e:GetHandler()
if c==tc then tc=Duel.GetAttacker() end
if tc and tc:IsType(TYPE_EFFECT) and tc:IsStatus(STATUS_BATTLE_DESTROYED) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x17a0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x17a0000)
tc:RegisterEffect(e2)
end
end
function c35638627.atcon(e,tp,eg,ep,ev,re,r,rp)
return aux.bdocon(e,tp,eg,ep,ev,re,r,rp) and e:GetHandler():IsChainAttackable()
end
function c35638627.atop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChainAttack()
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/West_Ronfaure/npcs/Stone_Monument.lua | 32 | 1287 | -----------------------------------
-- Area: West Ronfaure
-- NPC: Stone Monument
-- Involved in quest "An Explorer's Footsteps"
-- @pos -183.734 -12.678 -395.722 100
-----------------------------------
package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/West_Ronfaure/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",0x00001);
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 |
Zenny89/darkstar | scripts/globals/spells/bluemagic/uppercut.lua | 28 | 1859 | -----------------------------------------
-- Spell: Uppercut
-- Damage varies with TP
-- Spell cost: 31 MP
-- Monster Type: Plantoids
-- Spell Type: Physical (Blunt)
-- Blue Magic Points: 3
-- Stat Bonus: STR+2, DEX+1
-- Level: 38
-- Casting Time: 0.5 seconds
-- Recast Time: 17.75 seconds
-- Skillchain Element(s): Fire (Primary) and Lightning (Secondary) - (can open Scission, Detonation, Liquefaction, or Fusion; can close Liquefaction, Impaction, or Fusion)
-- Combos: Attack Bonus
-----------------------------------------
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_ATTACK;
params.dmgtype = DMGTYPE_H2H;
params.scattr = SC_LIQUEFACTION;
params.scattr2 = SC_IMPACTION;
params.numhits = 1;
params.multiplier = 1.5;
params.tp150 = 1.5;
params.tp300 = 1.5;
params.azuretp = 1.5;
params.duppercap = 39;
params.str_wsc = 0.35;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.0;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.0;
damage = BluePhysicalSpell(caster, target, spell, params);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
-- Missing Knockback
return damage;
end; | gpl-3.0 |
Zenny89/darkstar | scripts/globals/items/moon_ball.lua | 35 | 1183 | -----------------------------------------
-- ID: 4568
-- Item: moon_ball
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Health 3
-- Magic 3
-----------------------------------------
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,4568);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 3);
target:addMod(MOD_MP, 3);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 3);
target:delMod(MOD_MP, 3);
end;
| gpl-3.0 |
fusijie/cocos2d-x-samples | samples/KillBug/src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua | 61 | 3456 | if nil == ccs then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
end
--functions of GUIReader will be deprecated begin
local GUIReaderDeprecated = { }
function GUIReaderDeprecated.shareReader()
deprecatedTip("GUIReader:shareReader","ccs.GUIReader:getInstance")
return ccs.GUIReader:getInstance()
end
GUIReader.shareReader = GUIReaderDeprecated.shareReader
function GUIReaderDeprecated.purgeGUIReader()
deprecatedTip("GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
return ccs.GUIReader:destroyInstance()
end
GUIReader.purgeGUIReader = GUIReaderDeprecated.purgeGUIReader
--functions of GUIReader will be deprecated end
--functions of SceneReader will be deprecated begin
local SceneReaderDeprecated = { }
function SceneReaderDeprecated.sharedSceneReader()
deprecatedTip("SceneReader:sharedSceneReader","ccs.SceneReader:getInstance")
return ccs.SceneReader:getInstance()
end
SceneReader.sharedSceneReader = SceneReaderDeprecated.sharedSceneReader
function SceneReaderDeprecated.purgeSceneReader(self)
deprecatedTip("SceneReader:purgeSceneReader","ccs.SceneReader:destroyInstance")
return self:destroyInstance()
end
SceneReader.purgeSceneReader = SceneReaderDeprecated.purgeSceneReader
--functions of SceneReader will be deprecated end
--functions of ccs.GUIReader will be deprecated begin
local CCSGUIReaderDeprecated = { }
function CCSGUIReaderDeprecated.purgeGUIReader()
deprecatedTip("ccs.GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
return ccs.GUIReader:destroyInstance()
end
ccs.GUIReader.purgeGUIReader = CCSGUIReaderDeprecated.purgeGUIReader
--functions of ccs.GUIReader will be deprecated end
--functions of ccs.ActionManagerEx will be deprecated begin
local CCSActionManagerExDeprecated = { }
function CCSActionManagerExDeprecated.destroyActionManager()
deprecatedTip("ccs.ActionManagerEx:destroyActionManager","ccs.ActionManagerEx:destroyInstance")
return ccs.ActionManagerEx:destroyInstance()
end
ccs.ActionManagerEx.destroyActionManager = CCSActionManagerExDeprecated.destroyActionManager
--functions of ccs.ActionManagerEx will be deprecated end
--functions of ccs.SceneReader will be deprecated begin
local CCSSceneReaderDeprecated = { }
function CCSSceneReaderDeprecated.destroySceneReader(self)
deprecatedTip("ccs.SceneReader:destroySceneReader","ccs.SceneReader:destroyInstance")
return self:destroyInstance()
end
ccs.SceneReader.destroySceneReader = CCSSceneReaderDeprecated.destroySceneReader
--functions of ccs.SceneReader will be deprecated end
--functions of CCArmatureDataManager will be deprecated begin
local CCArmatureDataManagerDeprecated = { }
function CCArmatureDataManagerDeprecated.sharedArmatureDataManager()
deprecatedTip("CCArmatureDataManager:sharedArmatureDataManager","ccs.ArmatureDataManager:getInstance")
return ccs.ArmatureDataManager:getInstance()
end
CCArmatureDataManager.sharedArmatureDataManager = CCArmatureDataManagerDeprecated.sharedArmatureDataManager
function CCArmatureDataManagerDeprecated.purge()
deprecatedTip("CCArmatureDataManager:purge","ccs.ArmatureDataManager:destoryInstance")
return ccs.ArmatureDataManager:destoryInstance()
end
CCArmatureDataManager.purge = CCArmatureDataManagerDeprecated.purge
--functions of CCArmatureDataManager will be deprecated end
| mit |
Zenny89/darkstar | scripts/zones/Southern_San_dOria_[S]/npcs/Mainchelite.lua | 21 | 5532 | -----------------------------------
-- Area: Southern SandOria [S]
-- NPC: Mainchelite
-- @zone 80
-- @pos -16 1 -30
-- CS IDs:
-- 0x005 = Generic Greeting for Iron Ram members
-- 0x006 = Mid Initiation of other nation
-- 0x007 = Ask player to Join Iron Rams
-- 0x008 = Ask if changed mind about joining Iron rams (after player has declined)
-- 0x009 = Mid Initiation of other nation
-- 0x00A = Player works for another nation, offer to switch +give quest
-- 0x00B = Player works for another nation, offer to switch +give quest
-- 0x00C = Complete investigation
-- 0x00D = "How fares the search, <player>?"
-- 0x00E = "How fares the search, <player>?"
-- 0x00F = No Red Recommendation Letter and has no nation affiliation
-- Todo: medal loss from nation switching. Since there is no rank-up yet, this isn't so important for now.
-----------------------------------
package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/globals/missions");
require("scripts/zones/Southern_San_dOria_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local Allegiance = player:getCampaignAllegiance();
-- 0 = none, 1 = San d'Oria Iron Rams, 2 = Bastok Fighting Fourth, 3 = Windurst Cobras
local TheFightingFourth = player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH);
local SnakeOnThePlains = player:getQuestStatus(CRYSTAL_WAR,SNAKE_ON_THE_PLAINS);
local SteamedRams = player:getQuestStatus(CRYSTAL_WAR,STEAMED_RAMS);
local RedLetter = player:hasKeyItem(RED_RECOMMENDATION_LETTER);
local CharredPropeller = player:hasKeyItem(CHARRED_PROPELLER);
local OxidizedPlate = player:hasKeyItem(OXIDIZED_PLATE);
local ShatteredLumber = player:hasKeyItem(PIECE_OF_SHATTERED_LUMBER);
if (TheFightingFourth == QUEST_ACCEPTED or SnakeOnThePlains == QUEST_ACCEPTED) then
player:startEvent(0x009);
elseif (SteamedRams == QUEST_AVAILABLE and RedLetter == true) then
player:startEvent(0x007);
elseif (SteamedRams == QUEST_AVAILABLE and player:getVar("RED_R_LETTER_USED") == 1) then
player:startEvent(0x008);
elseif (SteamedRams == QUEST_ACCEPTED and CharredPropeller == true and OxidizedPlate == true and ShatteredLumber == true) then
player:startEvent(0x00C);
elseif (SteamedRams == QUEST_ACCEPTED) then
player:startEvent(0x00D);
elseif (SteamedRams == QUEST_COMPLETED and Allegiance == 1) then
player:startEvent(0x005);
else
player:startEvent(0x00F);
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 == 0x007 and option == 0) then
player:addQuest(CRYSTAL_WAR,STEAMED_RAMS);
player:setVar("RED_R_LETTER_USED",1);
player:delKeyItem(RED_RECOMMENDATION_LETTER);
elseif (csid == 0x007 and option == 1) then
player:setVar("RED_R_LETTER_USED",1);
player:delKeyItem(RED_RECOMMENDATION_LETTER);
elseif (csid == 0x008 and option == 0) then
player:addQuest(CRYSTAL_WAR, STEAMED_RAMS);
elseif (csid == 0x00A and option == 0) then
player:addQuest(CRYSTAL_WAR, STEAMED_RAMS);
elseif (csid == 0x00B and option == 0) then
player:addQuest(CRYSTAL_WAR, STEAMED_RAMS);
elseif (csid == 0x00C and option == 0) then
-- Is first join, so add Sprinter's Shoes and bronze medal
if (player:getVar("Campaign_Nation") == 0) then
if (player:getFreeSlotsCount() >= 1) then
player:setCampaignAllegiance(1);
player:setVar("RED_R_LETTER_USED",0);
player:addTitle(KNIGHT_OF_THE_IRON_RAM);
player:addKeyItem(BRONZE_RIBBON_OF_SERVICE);
player:addItem(15754);
player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS);
player:delKeyItem(CHARRED_PROPELLER);
player:delKeyItem(OXIDIZED_PLATE);
player:delKeyItem(PIECE_OF_SHATTERED_LUMBER);
player:messageSpecial(KEYITEM_OBTAINED, BRONZE_RIBBON_OF_SERVICE);
player:messageSpecial(ITEM_OBTAINED, 15754);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 15754);
end
else
player:setCampaignAllegiance(1);
player:setVar("RED_R_LETTER_USED",0);
player:addTitle(KNIGHT_OF_THE_IRON_RAM);
player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS);
player:delKeyItem(CHARRED_PROPELLER);
player:delKeyItem(OXIDIZED_PLATE);
player:delKeyItem(PIECE_OF_SHATTERED_LUMBER);
end
elseif (csid == 0x00D and option == 1) then
player:delQuest(CRYSTAL_WAR,STEAMED_RAMS);
end
end; | gpl-3.0 |
l33tRS/E2Power | lua/entities/gmod_wire_expression2/core/custom/KeyPress.lua | 1 | 7206 | -- made by [G-moder]FertNoN
local keys = {
["w"]= IN_FORWARD,
["a"]= IN_MOVELEFT,
["s"]= IN_BACK,
["d"]= IN_MOVERIGHT,
["mouse1"]= IN_ATTACK,
["mouse2"]= IN_ATTACK2,
["reload"]= IN_RELOAD,
["jump"]= IN_JUMP,
["speed"] = IN_SPEED,
["run"] = IN_SPEED,
["zoom"]= IN_ZOOM,
["walk"]= IN_WALK,
["turnleftkey"]= IN_LEFT,
["turnrightkey"]= IN_RIGHT,
["duck"]= IN_DUCK,
["use"]= IN_USE,
["cancel"]= IN_CANCEL,
}
local MouseKeys = {
["left"] = 107,
["middle"] = 109,
["right"] = 108,
["4"] = 110,
["5"] = 111,
["wheel_down"] = 113,
["wheel_up"] = 112,
["invprev"] = 113,
["invnext"] = 112,
}
for k,v in pairs(MouseKeys) do
MouseKeys[v]=k
end
local function keyMemory(ply)
ply.e2Keys = {}
ply.e2KeyAsk = {}
ply.KeyAct={}
ply.MKeyAct={}
end
hook.Add("PlayerInitialSpawn", "E2KeyPress", function(ply)
keyMemory(ply)
end)
for _, ply in ipairs( player.GetAll() ) do
keyMemory(ply)
end
hook.Add("PlayerButtonUp","E2KeyPress", function(ply,key)
ply.e2Keys[key] = nil
end)
hook.Add("PlayerButtonDown","E2KeyPress", function(ply,key)
if ply.runkey then
ply.e2Keys[key] = 1
ply.e2KeyAsk[key] = {}
if key < 107 or key > 113 then
ply.e2LastKeyPress=key
ply.e2KeyAsk[0] = {}
for k,v in pairs(ply.KeyAct) do
if !IsValid(k) then ply.KeyAct[k]=nil continue end
k:Execute()
end
else
ply.e2mLastKeyPress = MouseKeys[key]
ply.e2KeyAsk["last"] = {}
for k,v in pairs(ply.MKeyAct) do
if !IsValid(k) then ply.MKeyAct[k]=nil continue end
k:Execute()
end
end
end
end)
concommand.Add("wire_e2mkp",function(ply, cmd, argm)
if !ply.runkey then return end
key = MouseKeys[argm[1]]
ply.e2Keys[key] = 1
ply.e2KeyAsk[key] = {}
ply.e2mLastKeyPress = MouseKeys[key]
ply.e2KeyAsk["last"] = {}
for k,v in pairs(ply.MKeyAct) do
if !IsValid(k) then ply.MKeyAct[k]=nil continue end
k:Execute()
end
end)
__e2setcost(20)
e2function number clKeyPress(number key)
return self.player.e2Keys[key] or 0
end
e2function number clKeyPressVel(number key)
if self.player.e2Keys[key] then
if self.player.e2KeyAsk[key][self.entity]!=nil then return 0 end
self.player.e2KeyAsk[key][self.entity]=true
return 1
else
return 0
end
end
e2function number clLastKeyPress()
return self.player.e2LastKeyPress or 0
end
e2function number clLastKeyPressVel()
if self.player.e2LastKeyPress then
if self.player.e2KeyAsk[0][self.entity]!=nil then return 0 end
self.player.e2KeyAsk[0][self.entity]=true
return self.player.e2LastKeyPress
else
return 0
end
end
local function runkey(self,active)
if active!=0 then
if self.runkey then return end
self.runkey=true
if self.player.runkey==nil then self.player.runkey=1 else self.player.runkey=self.player.runkey+1 end
self.entity:CallOnRemove("e2keyrun",function() if IsValid(self.player) then if self.player.runkey==1 then self.player.runkey=nil else self.player.runkey=self.player.runkey-1 end end end)
else
if !self.runkey then return end
self.runkey=nil
if self.player.runkey==1 then self.player.runkey=nil else self.player.runkey=self.player.runkey-1 end
self.entity:RemoveCallOnRemove("e2keyrun")
end
end
__e2setcost(200)
e2function void runOnKey(number active)
if active!=0 then
if self.player.KeyAct[self.entity] then return end
self.player.KeyAct[self.entity]=true
else
if !self.player.KeyAct[self.entity] then return end
self.player.KeyAct[self.entity]=nil
end
runkey(self,active)
end
e2function void runOnMouseKey(number active)
if active!=0 then
if self.player.MKeyAct[self.entity] then return end
self.player.MKeyAct[self.entity]=true
else
if !self.player.MKeyAct[self.entity] then return end
self.player.MKeyAct[self.entity]=nil
end
runkey(self,active)
end
e2function void runKey(number active)
runkey(self,active)
end
e2function void clKeyClearBuffer()
self.player.e2Keys = {}
self.player.e2KeyAsk = {}
self.player.e2LastKeyPress = nil
self.player.e2mLastKeyPress = nil
end
--------------------MOUSE
__e2setcost(20)
e2function number clMouseKeyPress(string key)
return self.player.e2Keys[MouseKeys[key:lower()]] or 0
end
e2function number clMouseKeyPressVel(string key)
local key = MouseKeys[key:lower()]
if self.player.e2Keys[key] then
if self.player.e2KeyAsk[key][self.entity]!=nil then return 0 end
self.player.e2KeyAsk[key][self.entity]=true
return 1
else
return 0
end
end
e2function string clLastMouseKeyPress()
return self.player.e2mLastKeyPress or "null"
end
e2function string clLastMouseKeyPressVel()
if self.player.e2mLastKeyPress then
if self.player.e2KeyAsk["last"][self.entity]!=nil then return "null" end
self.player.e2KeyAsk["last"][self.entity]=true
return self.player.e2mLastKeyPress
else
return "null"
end
end
__e2setcost(20)
e2function number keyPress(string key)
if !keys[key:lower()] then return 0 end
if self.player:KeyDown(keys[key:lower()]) then return 1 else return 0 end
end
__e2setcost(50)
e2function number entity:inUse()
if !IsValid(this) then return 0 end
if this.e2UseKeyAsk==nil then this.e2UseKeyAsk={} end
if this.e2UseKeyAsk[self.entity]==nil then this.e2UseKeyAsk[self.entity]={} end
if this.e2UseKeyAsk[self.entity].use==nil then this.e2UseKeyAsk[self.entity].use=true else return 0 end
if this.user==nil then return 0 end
return 1
end
e2function entity entity:inUseBy()
if !IsValid(this) then return nil end
if this.e2UseKeyAsk==nil then this.e2UseKeyAsk={} end
if this.e2UseKeyAsk[self.entity]==nil then this.e2UseKeyAsk[self.entity]={} end
if this.e2UseKeyAsk[self.entity].useBy==nil then this.e2UseKeyAsk[self.entity].useBy=true else return nil end
return this.user
end
__e2setcost(150)
e2function void runOnUse(number active)
if active!=0 then
self.entity.Use = function(ent,ply)
if ply.CantUseE2 != nil then return end
local plyID = tostring(ply:EntIndex())
hook.Add("PlayerButtonUp","e2RunUse"..plyID, function(player,key)
if !IsValid(ply) then hook.Remove("Think","e2RunUse"..plyID) end
if player == ply and key==15 then ply.CantUseE2=nil hook.Remove("Think","e2RunUse"..plyID) end
end)
ply.CantUseE2=true
self.entity.user=ply
self.entity:Execute()
end
else
self.entity.Use = nil
end
end
__e2setcost(50)
e2function void runOnUse(number active, entity ent)
if !IsValid(ent) then return end
if active!=0 then
if ent.E2Execute == nil then ent.E2Execute = {} end
ent.E2Execute[self.entity]=true
else
ent.E2Execute[self.entity]=nil
end
end
__e2setcost(5)
e2function entity useEntClk()
return self.entity.UseEntClk
end
local function e2_use(ply,key)
if key==15 then
local rv1=ply:GetEyeTraceNoCursor().HitPos
local rv2=ply:GetShootPos()
local rvd1, rvd2, rvd3 = rv1[1] - rv2[1], rv1[2] - rv2[2], rv1[3] - rv2[3]
local dis=(rvd1 * rvd1 + rvd2 * rvd2 + rvd3 * rvd3) ^ 0.5
if dis<40 then
local ent = ply:GetEyeTraceNoCursor().Entity
if ent:IsValid() then
ent.user=ply
ent.e2UseKeyAsk={}
if ent.E2Execute != nil then
for k,v in pairs(ent.E2Execute) do
if !IsValid(k) then ent.E2Execute[k]=nil continue end
k.UseEntClk=ent k:Execute() k.UseEntClk=nil
end
end
end
end
end
end
hook.Add("PlayerButtonDown","e2_use", e2_use) | gpl-3.0 |
amirTg/TELEHONES | plugins/stats.lua | 866 | 4001 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'teleseed' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' then
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(chat_id)
else
return
end
end
if matches[2] == "teleseed" then -- Put everything you like :)
if not is_admin(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[!/]([Ss]tats)$",
"^[!/]([Ss]tatslist)$",
"^[!/]([Ss]tats) (group) (%d+)",
"^[!/]([Ss]tats) (teleseed)",-- Put everything you like :)
"^[!/]([Tt]eleseed)"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
samijon/suofi | plugins/stats.lua | 866 | 4001 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'teleseed' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' then
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(chat_id)
else
return
end
end
if matches[2] == "teleseed" then -- Put everything you like :)
if not is_admin(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[!/]([Ss]tats)$",
"^[!/]([Ss]tatslist)$",
"^[!/]([Ss]tats) (group) (%d+)",
"^[!/]([Ss]tats) (teleseed)",-- Put everything you like :)
"^[!/]([Tt]eleseed)"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
AlmightyLaxz/gmRPG | entities/weapons/weapon_gmrpg_unarmed/shared.lua | 1 | 1272 | if SERVER then
AddCSLuaFile("shared.lua")
end
if CLIENT then
SWEP.Slot = 0
SWEP.ViewModelFOV = 10
end
SWEP.HoldType = "normal"
SWEP.Base = "weapon_base"
SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
SWEP.WorldModel = "models/weapons/w_crowbar.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.AllowDelete = false
SWEP.AllowDrop = false
SWEP.NoSights = true
SWEP.PrintName = "Empty"
SWEP.Category = "gmRPG"
SWEP.Author = "Almighty Laxz";
SWEP.Contact = "";
SWEP.Purpose = "Do nothing";
SWEP.Instructions = "Do nothing";
function SWEP:PrimaryAttack()
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
end
function SWEP:Deploy()
if SERVER and IsValid(self.Owner) then
self.Owner:DrawViewModel(false)
end
return true
end
function SWEP:Initialize()
self:SetHoldType(self.HoldType)
end
function SWEP:Holster()
return true
end
function SWEP:DrawWorldModel()
end
function SWEP:DrawWorldModelTranslucent()
end | gpl-3.0 |
mercury233/ygopro-scripts | c85313220.lua | 2 | 2605 | --漆黒の魔王 LV4
function c85313220.initial_effect(c)
--disable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLED)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(c85313220.disop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetOperation(c85313220.btop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(85313220,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCondition(c85313220.spcon)
e3:SetCost(c85313220.spcost)
e3:SetTarget(c85313220.sptg)
e3:SetOperation(c85313220.spop)
c:RegisterEffect(e3)
end
c85313220.lvup={12817939}
function c85313220.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local d=Duel.GetAttackTarget()
if d==c then d=Duel.GetAttacker() end
if d and d:IsStatus(STATUS_BATTLE_DESTROYED) and not c:IsStatus(STATUS_BATTLE_DESTROYED) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x17a0000)
d:RegisterEffect(e1)
end
end
function c85313220.btop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(85313220,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,2)
end
function c85313220.spcon(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and e:GetHandler():GetFlagEffect(85313220)~=0
end
function c85313220.spcost(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 c85313220.spfilter(c,e,tp)
return c:IsCode(12817939) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function c85313220.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c85313220.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c85313220.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,c85313220.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_VALUE_LV,tp,tp,true,true,POS_FACEUP)
tc:CompleteProcedure()
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c79766336.lua | 2 | 1968 | --闇よりの罠
function c79766336.initial_effect(c)
--copy trap
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0x1e1,0x1e1)
e1:SetCondition(c79766336.condition)
e1:SetCost(c79766336.cost)
e1:SetTarget(c79766336.target)
e1:SetOperation(c79766336.operation)
c:RegisterEffect(e1)
end
function c79766336.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)<=3000
end
function c79766336.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c79766336.filter(c)
return c:GetType()==0x4 and not c:IsCode(79766336) and c:IsAbleToRemove() and c:CheckActivateEffect(false,true,false)~=nil
end
function c79766336.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
if chk==0 then return Duel.IsExistingTarget(c79766336.filter,tp,LOCATION_GRAVE,0,1,nil) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c79766336.filter,tp,LOCATION_GRAVE,0,1,1,nil)
local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true)
Duel.ClearTargetCard()
g:GetFirst():CreateEffectRelation(e)
local tg=te:GetTarget()
e:SetProperty(te:GetProperty())
if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
Duel.ClearOperationInfo(0)
end
function c79766336.operation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te then return end
local tc=te:GetHandler()
if not (tc:IsRelateToEffect(e) and tc:GetType()==TYPE_TRAP) then return end
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
if tc:IsRelateToEffect(e) and tc:GetType()==TYPE_TRAP then
Duel.BreakEffect()
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Northern_San_dOria/npcs/Shomo_Pochachilo.lua | 38 | 1288 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Shomo Pochachilo
-- Type: Standard Info NPC
-- @zone: 231
-- @pos 28.369 -0.199 30.061
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
quest_FatherAndSon = player:getQuestStatus(SANDORIA,FATHER_AND_SON);
if (quest_FatherAndSon == QUEST_COMPLETED) then
player:startEvent(0x02b8);
else
player:startEvent(0x02a3);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
Zenny89/darkstar | scripts/globals/spells/aurorastorm.lua | 31 | 1161 | --------------------------------------
-- Spell: Aurorastorm
-- Changes the weather around target party member to "auroras."
--------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
target:delStatusEffectSilent(EFFECT_FIRESTORM);
target:delStatusEffectSilent(EFFECT_SANDSTORM);
target:delStatusEffectSilent(EFFECT_RAINSTORM);
target:delStatusEffectSilent(EFFECT_WINDSTORM);
target:delStatusEffectSilent(EFFECT_HAILSTORM);
target:delStatusEffectSilent(EFFECT_THUNDERSTORM);
target:delStatusEffectSilent(EFFECT_AURORASTORM);
target:delStatusEffectSilent(EFFECT_VOIDSTORM);
local merit = caster:getMerit(MERIT_STORMSURGE);
local power = 0;
if merit > 0 then
power = merit + caster:getMod(MOD_STORMSURGE_EFFECT) + 2;
end
target:addStatusEffect(EFFECT_AURORASTORM,power,0,180);
return EFFECT_AURORASTORM;
end; | gpl-3.0 |
mercury233/ygopro-scripts | c34898052.lua | 2 | 1690 | --牙竜咆哮
function c34898052.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(34898052,0))
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCost(c34898052.cost)
e1:SetTarget(c34898052.target)
e1:SetOperation(c34898052.activate)
c:RegisterEffect(e1)
end
c34898052.rchecks=aux.CreateChecks(Card.IsAttribute,{ATTRIBUTE_EARTH,ATTRIBUTE_WATER,ATTRIBUTE_FIRE,ATTRIBUTE_WIND})
function c34898052.rfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH+ATTRIBUTE_WATER+ATTRIBUTE_FIRE+ATTRIBUTE_WIND)
and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c34898052.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c34898052.rfilter,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroupEach(c34898052.rchecks) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroupEach(tp,c34898052.rchecks)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function c34898052.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c34898052.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,aux.ExceptThisCard(e))
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
| gpl-2.0 |
Firew0lf/ctruLua | sdcard/3ds/ctruLua/editor/syntax.lua | 2 | 3361 | -- Each pattern should return 3 captures : start position, the string to colorize, and the end position.
local syntax = {
{ "comment", { "()(%-%-.*)()$" } },
--["string"] = { "()(%'.*%f[%\\]%')()", "()(%\".*%f[%\\]%\")()" },
{ "string", { "()(%'[^%']*%')()", "()(%\"[^%\"]*%\")()" } },
{ "constant.numeric", {
"%f[%d%w%.]()(0x[a-fA-F%d]+)()%f[^%d%w%.]",
"%f[%d%w%.]()([%d% ]+%.[%d% ]+)()%f[^%d%w%.]",
"%f[%d%w%.]()([%d% ]+)()%f[^%d%w%.]"
}
},
{ "constant.language", {
"%f[%w]()(false)()%f[%W]", "%f[%w]()(nil)()%f[%W]", "%f[%w]()(true)()%f[%W]", "%f[%w]()(_G)()%f[%W]",
"%f[%w]()(_VERSION)()%f[%W]", "%f[%w]()(math.pi)()%f[%W]", "%f[%w]()(math.huge)()%f[%W]", "%f[%w]()(%.%.%.)()%f[%W]"
}
},
{ "keyword.control", {
"%f[%w]()(break)()%f[%W]", "%f[%w]()(goto)()%f[%W]", "%f[%w]()(do)()%f[%W]", "%f[%w]()(else)()%f[%W]",
"%f[%w]()(for)()%f[%W]", "%f[%w]()(if)()%f[%W]", "%f[%w]()(elseif)()%f[%W]", "%f[%w]()(return)()%f[%W]",
"%f[%w]()(then)()%f[%W]", "%f[%w]()(repeat)()%f[%W]", "%f[%w]()(while)()%f[%W]", "%f[%w]()(until)()%f[%W]",
"%f[%w]()(end)()%f[%W]", "%f[%w]()(function)()%f[%W]", "%f[%w]()(local)()%f[%W]", "%f[%w]()(in)()%f[%W]"
}
},
{ "keyword.operator", {
"%f[%w]()(and)()%f[%W]", "%f[%w]()(or)()%f[%W]", "%f[%w]()(not)()%f[%W]",
"()(%+)()", "()(%-)()", "()(%%)()", "()(%#)()", "()(%*)()", "()(%/%/?)()", "()(%^)()", "()(%=%=?)()", "()(%~%=?)()",
"()(%.%.)()", "()(%<%=?)()", "()(%>%=?)()", "()(%&)()", "()(%|)()", "()(%<%<)()", "()(%>%>)()",
}
},
{ "support.function", {
"[^%.%:]()(assert)()[%( %{]", "[^%.%:]()(collectgarbage)()[%( %{]", "[^%.%:]()(dofile)()[%( %{]",
"[^%.%:]()(error)()[%( %{]", "[^%.%:]()(getfenv)()[%( %{]", "[^%.%:]()(getmetatable)()[%( %{]",
"[^%.%:]()(ipairs)()[%( %{]", "[^%.%:]()loadfile)()[%( %{]", "[^%.%:]()(loadstring)()[%( %{]",
"[^%.%:]()(module)()[%( %{]", "[^%.%:]()(next)()[%( %{]", "[^%.%:]()(pairs)()[%( %{]",
"[^%.%:]()(pcall)()[%( %{]", "[^%.%:]()(print)()[%( %{]", "[^%.%:]()(rawequal)()[%( %{]",
"[^%.%:]()(rawget)()[%( %{]", "[^%.%:]()(rawset)()[%( %{]", "[^%.%:]()(require)()[%( %{]",
"[^%.%:]()(select)()[%( %{]", "[^%.%:]()(setfenv)()[%( %{]", "[^%.%:]()(setmetatable)()[%( %{]",
"[^%.%:]()(tonumber)()[%( %{]", "[^%.%:]()(tostring)()[%( %{]", "[^%.%:]()(type)()[%( %{]",
"[^%.%:]()(unpack)()[%( %{]", "[^%.%:]()(xpcall)()[%( %{]"
}
}
}
return function(lines, color)
local ret = {}
for _, line in ipairs(type(lines) == "table" and lines or {lines}) do
local colored = { { line, color.default } }
for _, patterns in ipairs(syntax) do
local name = patterns[1]
for _, pattern in ipairs(patterns[2]) do
local i = 1
while i <= #colored do
local oldcolor = colored[i][2]
if oldcolor == color.default then
local part = colored[i][1]
local starti, match, endi = part:match(pattern)
if starti then
table.remove(colored, i)
if starti > 1 then
table.insert(colored, i, { part:sub(1, starti-1), oldcolor })
i = i + 1
end
table.insert(colored, i, { match, color[name] or color.default })
if endi <= #part then
table.insert(colored, i+1, { part:sub(endi, -1), oldcolor })
end
end
end
i = i + 1
end
end
end
table.insert(ret, colored)
end
return type(lines) == "table" and ret or ret[1]
end
| gpl-3.0 |
mercury233/ygopro-scripts | c82971335.lua | 3 | 1904 | --フォーチュンレディ・アーシー
function c82971335.initial_effect(c)
--atk,def
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(c82971335.value)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE)
c:RegisterEffect(e2)
--level up
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(82971335,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCondition(c82971335.lvcon)
e3:SetOperation(c82971335.lvop)
c:RegisterEffect(e3)
--damage
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(82971335,1))
e4:SetCategory(CATEGORY_DAMAGE)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EVENT_LEVEL_UP)
e4:SetTarget(c82971335.damtg)
e4:SetOperation(c82971335.damop)
c:RegisterEffect(e4)
end
function c82971335.value(e,c)
return c:GetLevel()*400
end
function c82971335.lvcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c82971335.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsLevelAbove(12) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
function c82971335.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(400)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,400)
end
function c82971335.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c10424147.lua | 2 | 4503 | --超量機艦マグナキャリア
function c10424147.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(10424147,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_FZONE)
e2:SetCost(c10424147.spcost1)
e2:SetTarget(c10424147.sptg1)
e2:SetOperation(c10424147.spop1)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(10424147,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_FZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCost(c10424147.spcost2)
e3:SetTarget(c10424147.sptg2)
e3:SetOperation(c10424147.spop2)
c:RegisterEffect(e3)
end
function c10424147.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c10424147.spfilter1(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x10dc)
and Duel.IsExistingMatchingCard(c10424147.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,c:GetAttribute())
and aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL)
end
function c10424147.spfilter2(c,e,tp,mc,att)
return c:IsType(TYPE_XYZ) and c:IsSetCard(0x20dc) and c:IsAttribute(att) and mc:IsCanBeXyzMaterial(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function c10424147.sptg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c10424147.spfilter1(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c10424147.spfilter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c10424147.spfilter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c10424147.spop1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10424147.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetAttribute())
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(tc))
Duel.Overlay(sc,Group.FromCards(tc))
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
function c10424147.spfilter3(c,e)
return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsSetCard(0x20dc) and c:IsType(TYPE_XYZ) and c:IsCanBeEffectTarget(e)
end
function c10424147.spfilter4(c,e,tp)
return c:IsCode(84025439) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c10424147.spcost2(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 c10424147.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c10424147.spfilter3,tp,LOCATION_MZONE+LOCATION_GRAVE,0,nil,e)
if chk==0 then return g:GetClassCount(Card.GetCode)>=3
and Duel.IsExistingMatchingCard(c10424147.spfilter4,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,3,3)
Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c10424147.mtfilter(c,e)
return c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e)
end
function c10424147.spop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,c10424147.spfilter4,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local sc=sg:GetFirst()
if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=tg:Filter(c10424147.mtfilter,nil,e)
local tc=g:GetFirst()
while tc do
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
Duel.Overlay(sc,Group.FromCards(tc))
tc=g:GetNext()
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c20747792.lua | 2 | 2820 | --ベリー・マジシャン・ガール
function c20747792.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(20747792,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(c20747792.thtg)
e1:SetOperation(c20747792.thop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(20747792,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_BECOME_TARGET)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e2:SetCondition(c20747792.spcon1)
e2:SetTarget(c20747792.sptg)
e2:SetOperation(c20747792.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetDescription(aux.Stringid(20747792,2))
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c20747792.spcon2)
c:RegisterEffect(e3)
end
function c20747792.thfilter(c)
return c:IsSetCard(0x20a2) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c20747792.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c20747792.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c20747792.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c20747792.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 c20747792.spfilter(c,e,tp)
return c:IsSetCard(0x20a2) and not c:IsCode(20747792) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c20747792.spcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsContains(e:GetHandler()) and rp==1-tp
end
function c20747792.spcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsContains(e:GetHandler()) and Duel.GetAttacker():IsControler(1-tp)
end
function c20747792.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c20747792.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0)
end
function c20747792.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or Duel.ChangePosition(c,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)==0 then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c20747792.spfilter,tp,LOCATION_DECK,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/West_Sarutabaruta/npcs/Banege_RK.lua | 30 | 3066 | -----------------------------------
-- Area: West Sarutabaruta
-- NPC: Banege, R.K.
-- Type: Border Conquest Guards
-- @pos 399.450 -25.858 727.545 115
-----------------------------------
package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/West_Sarutabaruta/TextIDs");
local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = SARUTABARUTA;
local csid = 0x7ffa;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(EFFECT_SIGIL);
player:delStatusEffect(EFFECT_SANCTION);
player:delStatusEffect(EFFECT_SIGNET);
player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
Faeder-EN/Faeder-EN | plugins/reply.lua | 1 | 26035 | do
ws = {}
rs = {}
-- some examples of how to use this :3
ws[1] = "هلو" -- msg
rs[1] = "هلاوووات عيني نورتـ/ي😻🙈 " -- reply
ws[2] = "😒" -- msg
rs[2] = "عابت هالخلقـة وبِلَت😒وج الطاوة🌚" -- reply
ws[3] = "شلونكم" -- msg
rs[3] = "اني تعبان☹️الأدمنيـة تعبوني😞🔫" -- reply
ws[4] = "انجب" -- msg
rs[4] = "🌚چبابـة تچبـكـ/چ" -- reply
ws[5] = "حجي" -- msg
rs[5] ="يـَعيون الحجي گولـ/ي😻🙊" -- replyrs[] ="يـَعيون الحجي گولـ/ي😻🙊" -- reply
ws[6] = "ضوجة" -- msg
rs[6] = "شي أكيد الكبل ماكو😉😄لو بعدكـ/چ ما زاحفـ/ـة😹🔪" -- reply
ws[7] = "مرحبا" -- msg
rs[7] = "مـراحـب😻يـمه هله😻" -- reply
ws[8] = "السلام عليكم" -- msg
rs[8] = "وعلـيكُم السلامُ والرحمـة😍" -- reply
ws[9] = "مساء الخير" -- msg
rs[9] = "مسـاء الخيرات يـا وجـه الخير😽" -- reply
ws[10] = "صباح الخير" -- msg
rs[10] = "صبـاح الخيرات عُمري😻😽" -- reply
ws[11] = "تصبحون على خير" -- msg
rs[11] = " وانتـ/ي مـن اهـلو حيـاتي💋 " -- reply
ws[12] = "اكرهك" -- msg
rs[12] = "طبكـ/چ مـرض🌚🔪" -- reply
ws[13] = "احبك" -- msg
rs[13] = "وانـه امووت عليكـ/يرووحي😻💋" -- reply
ws[14] = "علاوي" -- msg
rs[14] = "هـا يروووح علاوي🙈❤️" -- reply
ws[15] = "وجع" -- msg
rs[15] = "اليـوجع ضلـوعكـ/چ🌝😷" -- reply
ws[16] = "باي" -- msg
rs[16] = "بـايات عُمري😚سد/ي الباب وراكـ/چ☺️😻" -- reply
ws[17] = "نوشة" -- msg
rs[17] = "هـاي الـگلُب مالتي🙊😻💋" -- reply
ws[18] = "علاوي المطور" -- msg
rs[18] = "فدوة لأسـمه😻هيبـة الضلـع💋" --reply
ws[19] = "سداد" --msg
rs[19] = "يومـه يومـه😻العقل المُدَبِر فديتو💋" -- reply
ws[20] = "هنيد" -- msg
rs[20] = "بووويـاي😻ابو الكـلفات بعد شيبـي😻💋" -- reply
ws[21] = "اسو" -- msg
rs[21] = "خـوش ضلعـة😻بس من كَبَلَت خُربَت☹️" -- reply
ws[22] = "امجد" -- msg
rs[22] = "هذا الفَخـر والذُخُر😻💋فديت ربـه💋" -- reply
ws[23] = "حسوني" -- msg
rs[23] = "فد واحـد دُرةَ😻بس يضحكـ هوايـة😹🍃" -- reply
ws[24] = "كناري" -- msg
rs[24] = " واحـد ملَگلگ🌞💯بس احبـه😻💋" -- reply
ws[25] = "الخال" -- msg
rs[25] = "هـذا الحقيـر🙄اخذ نص گلـبي وسحـرني بحبـه" -- reply
ws[26] = "بوسني" -- msg
rs[26] = "مممممح💋😻" -- reply
ws[27] = "شخباركم" -- msg
rs[27] = "يعمُـر داركـم☺️عايشـين😁وانتـ/ي؟🤔" -- reply
ws[28] = "ضوجه" -- msg
rs[28] = "هاكـ/چ ممممممح💋😍حتى تروح الضوجه💋😁" -- reply
ws[29] = "هاي" -- msg
rs[29] = "هـايـات حيـاتي😻😘" -- reply
ws[30] = "احم" -- msg
rs[30] = "اسـم الله😧اشربـ/ي دوة😓" -- reply
ws[31] = "ابوك شلونه" -- msg
rs[31] = "الحمد لله زين بس طايح حظة 🙄😅"
ws[32] = "سلام عليكم" -- msg
rs[32] = "وعليكـم السلام والرحمـة😻" -- reply
ws[33] = "هلوو" -- msg
rs[33] = "هلاوات كـبد عمري😍😚" -- reply
ws[34] = "خاص" -- msg
rs[34] = "بـاع الزحـف😈" -- reply
ws[35] = "شباب" -- msg
rs[35] = "هـا داد😇" -- reply
ws[36] = "زاحف" -- msg
rs[36] = "تـعلمت منكـ/چ😈" -- reply
ws[37] = "اجكم" -- msg
rs[37] = "مظغوط/ـة من جمالي🌚" --reply
ws[38] = "ولي" -- msg
rs[38] = "صدگ ماعندكـ/چ ذوق😒" -- reply
ws[39] = "😏" -- msg
rs[39] = "عـود شوفـوني انـه شخصيـة🌝" -- reply
ws[40] = "وينك" -- msg
rs[40] = "موجـود حبي😶" -- reply
ws[41] = "شبيك" -- msg
rs[41] = "احب وحدة تخـبل بـس ثـولـة😓😿" -- reply
ws[42] = "محمد" -- msg
rs[42] = "صلى الله عليـه وسلـم😍🍃" -- reply
ws[43] = "😒😒" -- msg
rs[43] = "عابـت هالشـكول وبلت😒" -- reply
ws[44] = "😂" -- msg
rs[44] = "دوووم😁" -- reply
ws[45] = "😂😂" -- msg
rs[45] = "دوووووم" -- reply
ws[46] = "فديت" -- msg
rs[46] = "فداكـ/چ ثولان العالـم😍😂" -- reply
ws[47] = "هونر" -- msg
rs[47] = "فد واحد وردة مـال الله😻بس يضحـك هوايـة😂" -- reply
ws[48] = "شلونك" -- msg
rs[48] = "اني زيـن الحمـد لله وانتـ/ي؟😽" -- reply
ws[49] = "اكو احد" -- msg
rs[49] = "يي عيني انـي موجـود😁" -- reply
ws[50] = "نايمين" -- msg
rs[50] = "اني سهران احرـسكـم😐🍃" -- reply
ws[51] = "كمال" -- msg
rs[51] = "يعني سنايـدي😎" -- reply
ws[52] = "كيمو" -- msg
rs[52] = "فديت ربـه شگد احبـه😍" -- reply
ws[53] = "🌚" -- msg
rs[53] = "نورتـ/ي صخـام الجـدر🌝😂" -- reply
ws[54] = "تف" -- msg
rs[54] = "تف بوجهـكـ/چ🌚" -- reply
ws[55] = "تحبني" -- msg
rs[55] = "يااااا😱غير اعشقكـ/چ😢" -- reply
ws[56] = "نجب" -- msg
rs[56] = "ياعديمـ/ـة الذوق😑" -- reply
ws[57] = "تخليني" -- msg
rs[57] = "باوعـوا مدَود/ة☝😂" -- reply
ws[58] = "تفو" -- msg
rs[58] = " بخلقتكـ/ـچ الزفـرة🙌" -- reply
ws[58] = "اموت عليك" -- msg
rs[58] = "مي توو گلبي💋" -- reply
ws[59] = "كافي لغوة" -- msg
rs[59] = "ماگـدر والله بيـة دودة😷" -- reply
ws[60] = "🌚🌝" -- msg
rs[60] = "بيكـ/چ انفصام باشخصـيـة بابا!!" -- reply
ws[61] = "🌝🌚" -- msg
rs[61] = "هـذا انفصـام بالشخصيـة مستفحل🐸😷" -- reply
ws[62] = "🌚🌚" -- msg
rs[62] = "نرجع ونگول :منور/ة صخـام الجـدر🌝😂" -- reply
ws[63] = "ليش" -- msg
rs[63] = "حتى احسـن🍃😽" -- reply
ws[64] = "اسكت" -- msg
rs[64] = "ليـش بالله😐داحچي من حلگكـ/چ مثلاً😑" -- reply
ws[65] = "خطية" -- msg
rs[65] = "يييييييييييييييييي😓" -- reply
ws[66] = "زوزايه" -- msg
rs[66] = " هاي حبيبـة هونر😻🙊ومعشـوقته 🙊هو گالي والله☝️😁مممممممح 💋💋💋" -- reply
ws[67] = "وين" -- msg
rs[67] = "بأرض الله الواسعـة🙄" -- reply
ws[68] = "شكو" -- msg
rs[68] = "كلشي وكلاشي🐸تگـول عبالك احنـة بالشورجـة🌝" -- reply
ws[69] = "وين؟" -- msg
rs[69] = "للبحـرين🙄🤓" -- reply
ws[70] = "شونكم" -- msg
rs[70] = "تمـام بُحي🐸وانتـ/ي؟" -- reply
ws[71] = "شونك" -- msg
rs[71] = "تمـام الحمد لله😚وانتـ/ي؟" -- reply
ws[72] = "اوف" -- msg
rs[72] = "سلامتـكـ/چ من الأووف يـا بعد افادي☹️💔" -- reply
ws[73] = "احبج" -- msg
rs[73] = "واليحب بلوة🙄وين الله وزحفتي تجيبلي عيونچ الحلـوة🙄🤓" -- reply
ws[74] = "دنجب" -- msg
rs[74] = "چـبابـة تچبكـ/چ😇" -- reply
ws[75] = "انجب لك" -- msg
rs[75] = "اول شي لكلاكـة تلكلك ضلوعكـ/چ🐸وثاني شي چبابـة تچبكـ/چ☹️👌🏼" -- reply
ws[76] = "زاحف على اختك" -- msg
rs[76] = "أختكـ/چ اختي🐸😇" -- reply
ws[77] = "زاحف ع اختك" -- msg
rs[77] = "أختكـ/چ أختي🐸😇" -- reply
ws[78] = "😢" -- msg
rs[78] = "ياااا😱گامـ/ت تـ/يبچي خطيـة منو أخذ چبس منهـ/هـة😐" -- reply
ws[79] = "☹️" -- msg
rs[79] = "هل تعلمـ/ين أن حلگكـ/چ مثل حلگ الجريـة😶🙌🏾" -- reply
ws[80] = "😍" -- msg
rs[80] = "صَعَد الحُـب🙄❣" -- reply
ws[81] = "😘" -- msg
rs[81] = "عيب البـوس هنـا تعالـ/ي خاص😍😬" -- reply
ws[82] = "😪" -- msg
rs[82] = "امسحـ/ي مخاطينكـ/چ بابا خزيتونـة😾🙌🏾" -- reply
ws[83] = "🙄" -- msg
rs[83] = "ورجعنـا ع التلصلص🙄" -- reply
ws[84] = "انته منو" -- msg
rs[84] = "آني كامـل مفيد أكبر زنگين اگعدة عالحديد😼🙌🏾" -- reply
ws[85] = "انتة منو" -- msg
rs[85] = "آني كـامل مفيد اكبر زنگين أگعدة عالحديـد😼🙌🏾" -- reply
ws[86] = "كافي" -- msg
rs[86] = "كافي وگيمـر عرب🤓🐸" -- reply
ws[87] = "💔🌝" -- msg
rs[87] = "صارت قديمـة🐸" -- reply
ws[88] = "🌝💔" -- msg
rs[88] = "صارت قديمـة هاي🐸🙌🏾" -- reply
ws[89] = "تمام" -- msg
rs[89] = "دوووم" -- reply
ws[90] = "بخير" -- msg
rs[90] = "عساكـ/چ دووم😋" -- reply
ws[91] = "تسلم" -- msg
rs[91] = "ولـو😚" -- reply
ws[92] = "يسلمو" -- msg
rs[92] = "يدللـو😋" -- reply
ws[93] = "يسلموو" -- msg
rs[93] = "يدندل الحلـو😋🙌🏾" -- reply
ws[94] = "شكرا" -- msg
rs[94] = "عفواً😇" -- reply
ws[95] = "شكراً" -- msg
rs[95] = "عفواً😇" -- reply
ws[96] = "شكرن" -- msg
rs[96] = "عفواً😇" -- reply
ws[97] = "هذا منو" -- msg
rs[97] = "يمكـن جني🙄🙌🏾" -- reply
ws[98] = "هاي منو" -- msg
rs[98] = "عدويـة البياتي🙄💔" -- reply
ws[99] = "انته شبيك" -- msg
rs[99] = "جنـي🙄🙌🏾" -- reply
ws[100] = "فدوة" -- msg
rs[100] = "لخشمكـ/چ الأفنـص❣🙊" -- reply
ws[101] = "فديتك" -- msg
rs[101] = "فداكـ/چ الي ابالي😉" -- reply
ws[102] = "منو ابالك" -- msg
rs[102] = "بطل العرگ 🌝😢" -- reply
ws[103] = "منو بالك" -- msg
rs[103] = "عباس أبـو الغاز🐸🙌🏾" -- reply
ws[104] = "حرام" -- msg
rs[104] = "صار شيخنـا بعد ماعيدهـة🙄🙌🏾" -- reply
ws[105] = "استغفر الله" -- msg
rs[105] = "بركاتكـ/چ مولاي😈" -- reply
ws[106] = "استغفرالله" -- msg
rs[106] = "بركاتكـ/چ مولاي" -- reply
ws[107] = "🌝" -- msg
rs[107] = "خطيـة بيهـ/ـة ابو صفار🙄ديروبالكم من العدوى" -- reply
ws[108] = "راح اكفر" -- msg
rs[108] = "اشگ حلگكـ/چ اذا سويهـة😒🐸" -- reply
ws[109] = "شونج" -- msg
rs[109] = "زينـة وعايشـة وبخير🙄ارتاحيتـ/ي؟ يلا كافي زحـف ع الكبد ماتي🐸😒" -- reply
ws[110] = "فديتج" -- msg
rs[110] = "شنو هاللواگـة هاي🐸بابا عيب منا العالم🌝" -- reply
ws[111] = "اعشقك" -- msg
rs[111] = "يومـه اروحن فدوة 😻❤️" -- reply
ws[112] = "حبك" -- msg
rs[112] = "أفيش ربي 😍واني اكثر💋" -- reply
ws[113] = "عشقك" -- msg
rs[113] = "اتنفسكـ/چ واختنگ بيكـ/چ😍😂" -- reply
ws[114] = "موت عليك" -- msg
rs[114] = "اموت بيكـ/چ😍❤️" -- reply
ws[115] = "😍😍" -- msg
rs[115] = "فدوة اروحـن والله لهالعيـون😍" -- reply
ws[116] = "😁" -- msg
rs[116] = "عابت هالسنون الحلوات چنهن دگم😂" -- reply
ws[117] = "😂😂😂" -- msg
rs[117] = "دوووووم يبعد الگلب😍" -- reply
ws[118] = "عفية" -- msg
rs[118] = "الله يعافيكـ/چ🙂😇" -- reply
ws[119] = "بوت ملطلط" -- msg
rs[119] = "فوگ الحگة دگة😒والله يا الله فوگ ما اضحكهم يحچون عليـة🌝🙌🏾ربي صبرني😔" -- reply
ws[120] = "امداك" -- msg
rs[120] = "أتجاوزكـ/چ بسرعتي أمري لله🌝🙌🏾" -- reply
ws[121] = "😔" -- msg
rs[121] = "اوووي كسرتـ/ي قلبي الزعطـوط☹️💔" -- reply
ws[122] = "🤔" -- msg
rs[122] = "بدأت الأفكـار🙄والنتيجـة خريييط كالعادة🙂😂" -- reply
ws[123] = "تمارة" -- msg
rs[123] = "الكبل مال حسوني🙄صاكة تمووت🙄عبالي اكبل وياهة بس حسوني مخبل اخاف يسويلي شي😭" -- reply
ws[124] = "جوان" -- msg
rs[124] = "صاگـة تموووت😻عسل لگروب😻❤️ومحبوبة الگلوب😎🌹" -- reply
ws[125] = "حمودي" -- msg
rs[125] = "اخلاق✋🏾ذووق✋🏾انحراف🙄من جوة لجوة🙄اصلي يخبل🙂❤️" -- reply
ws[126] = "حمايد" -- msg
rs[126] = "هيبـة الشيخ😎بس خطيـة نفسيتـة مجعوصـة😞💔شيخ اني انصحک روح اسكر☹️✋🏾🍷" -- reply
ws[127] = "امك شلونهه" -- msg
rs[127] = "مو لبارحة جانت يم امك🌚������نو هاللواكة😐🐸" -- reply
ws[128] = "هايدر"
rs[128] = "عيون هايدر كول حياتي 😍🙈"
ws[129] = "انور"
rs[129] = "فديت ربه 😍 هو الصنعني ⚙ من البنطرون 👖 للبدي 👕 فديته مطوري 🔩"
ws[130] = "بوت"
rs[130] = "اي بوت🙄 ما مصدك اتريد احلف🙀 الك🌚✋"
ws[131] = "البوت"
rs[131] = "كول شتريد/ين مني 😒🍷 عندي شغل 🏌"
ws[132] = "مطور"
rs[132] = "مطور البوت @xXxDev_iqxXx 💋😻 "
ws[133] = "@xXxDev_iqxXx"
rs[133] = "فديت ربه 🙊 هذا مطور السورس 😻❤️"
ws[134] ="اريد قناة"
rs[134] =" @dev_faed 😌"
ws[135] = "اكلج"
rs[135] = "تاحسك تسحف ☹️"
ws[136] = "اكولج"
rs[136] = "تاحسك تسحف ☹️"
ws[137] = "سيف"
rs[137] = "؏ـيــ❦ـونةة لحبيبي 😘 سيوفي 😻❤️ تاج راســك وحامـ❦ـي اعراضـك 🐸🖕🏿"
ws[138] = "😂😂😂😂"
rs[138] = "شوف الناس وين وصلت ونته تضحك كبر يلخبل 🌚😹"
ws[139] = "نيجه"
rs[139] = "ميسوه اجب عليه 🐸😹🖕🏿"
ws[140] = "اغتصبه"
rs[140] = "حرامات اخرب مستقبلي بي 🐸🌝🖕🏿"
ws[141] = "طيز"
rs[141] = "ااوف ابلس 😻🖕🏿"
ws[142] = "🤔🤔"
rs[142] = "على كيفك انشتاين 😹🤘🏿"
ws[143] = "🤐"
rs[143] = "عفيه لو هيج تخيط حلكك لو لا 😹😹"
ws[144] = "😛"
rs[144] = "هذا مطلع لسانه كيوت 😹"
ws[145] = "😜"
rs[145] = "ضم لسانك 😁 فضحتنه"
ws[146] = "😚"
rs[146] = "عساس مستحي/ة بعد بست 😹"
ws[147] = "😘"
rs[147] = "ممنوع التقبيل في هذا الكروب 😹 هسه \nيزعلون الحدايق"
ws[148] = "☺️"
rs[148] = "خجلان الحلو/ة 😂 منو تحارش بيك/ج غيري 😌"
ws[149] = "🙂"
rs[149] = "ابتسامه مال واحد مكتول كتله غسل ولبس 😍😹"
ws[150] = "😊"
rs[150] = "انها احقر ابتسامه على وجه الكره الارضيه 😹"
ws[151] = "😇"
rs[151] = "شيخ جامع"
ws[152] = "😅"
rs[152] = "شبيك جنك واحد دايضربو ابره 😂"
ws[153] = "😃"
rs[153] = "فرحان/ه دووووم الفرحه ☺️😍"
ws[154] = "😹😹"
ws[154] = "دوم الضحكات عيوني 😍"
ws[155] = "😬"
rs[155] = "ضم سنونك/ج فضحتنه 🙀😹"
ws[156] = "😀"
rs[156] = "عيوووون مال كوري 😹😹"
ws[157] = "ضلعتي"
rs[157] = "هلا هلا اجن الضلوعات 😍😹"
ws[158] = "جاو"
rs[158] = "خليك مضوجني 😹❤️"
ws[159] = "بوسه جبيره"
rs[159]= "امــــ💋💋ــــمـــ💋💋ــــمــــــ💋💋ــــمــــــــــــــــ💋💋ــــمــؤوووووواح 😹\n بهاي البوسه انسف وجهك/ج 😹😹"
ws[160] = "تعشقني"
rs[160] = "😌☝🏿️اعشقكج لدرجه اذا خلوج بين 10 وردات اطلعج واني مغمض لان بس انتي الشوكه 😹\n #طــــن_تم_القصف"
ws[161] = "ممكن"
rs[161] = "كضوووو راح يزحف 🙀😹"
ws[162] = "عركة"
rs[162] = "🙀يا الهي \n عركه اجيب 🏃🏻 السجاجين 🔪والمسدسات 🔫"
ws[163] = "عركه"
rs[163] = "🙀يا الهي \n عركه اجيب 🏃🏻 السجاجين 🔪والمسدسات 🔫"
ws[164] = "مساء الخير"
rs[164] = "مساء الخيرات اشرقت وانورت 😌🍁"
ws[165] = "صباحوو"
rs[165] = "صباحووو اشرقت وانورت 😌🍁"
ws[166] = "صباحو"
rs[166] = "صباحو اشرقت وانورت 😌🍁"
ws[167] = "صباح الخير"
rs[167] = "صباحووو اشرقت وانورت 😌🍁"
ws[168] = "منو بيتهوفن"
rs[168] = "😹😹😹 شوف ياربي يطلب من الحافي نعال"
ws[169] = "موسيقى"
rs[169] = "😒☝🏿️اكعد راحه بيتهوفن 😹 \n #اذا_ماتعرف_منو_بيتهوفن \n #اكتب منو بيتهوفن"
ws[170] = "موال"
rs[170] = "🙁☝🏿️شكولي مال تحشيش ماخربها بلموال 😹❤️"
ws[171] = "ردح حزين"
rs[171] = "😹😹 مشت عليكم وين اكو ردح حزين عود هاي انته الجبير 🤑😹"
ws[172] = "ردح"
rs[172] = "😹😹😹تره رمضان قريب صلي صوم احسلك"
ws[173] = "حزين"
rs[173] = "اكو هواي مجروحين 😔 خاف غني وذكرهم"
ws[174] = "راب"
rs[174] = "شكولك مال ثريد لاتخربها بلراب 😹❤️"
ws[175] = "شسمها"
rs[175] = "لو اعرف اسمها جان مابقيت يمك/ج 😹"
ws[176] = "شسمه"
rs[176] = "لو اعرف اسمه جان مابقيت يمك/ج 😹"
ws[177] = "شسمج"
rs[177] = "اسمها جعجوعه"
ws[178] = "شسمك"
rs[178] = "اسمه اللمبــي 😹❤️"
ws[179] = "شوف"
rs[179] = "👀ششوف 👀"
ws[180]= "اسمعي"
rs[180] = "كوووووؤ👂🏿🌝👂🏿ؤؤؤؤؤل/ي سامعك/ج"
ws[181] = "اسمع"
rs[181] = "كوووووؤ👂🏿🌝👂🏿ؤؤؤؤؤل/ي سامعك/ج"
ws[182] = "خالتك"
rs[182] = "هَـ (⊙﹏⊙) ــاآك😝افلوس💵جيبلي خالتك😂"
ws[183] = "حمه"
rs[183] = "ۿہ✯ہذآإ✟😘❥الבـ﴿❤️﴾ـلـٰ୭وٰ୭❥😍مالي فديته😂"
ws[184] = "منو هاي"
rs[184] = "هَـ (⊙﹏⊙) ــاآي😝الراقصه مال الكروب💃😂"
ws[185] = "حاتة"
rs[185] = "وينها خلي نرقمها 😍😹"
ws[186] = "صاكة"
rs[186] = "وينها خلي اكفش شعرها 😹😍"
ws[187] = "بيباي"
rs[187] = "وين بعد وكت 🙊❤️"
ws[188] = "اشاقة"
rs[188] = "😹😍 استمر هوه غير شقاك/ج الثكيل يخبل"
ws[189] = "اشاقه"
rs[189] = "😹😍 استمر هوه غير شقاك/ج الثكيل يخبل"
ws[190] = "احبنك"
rs[190] = "😌❤️ طبعا وتموت/ين عليه هم"
ws[191] = "عشق"
rs[191] = "يمه اذوبــن 😌❤️"
ws[192] = "مرتي"
rs[192] = "يعني عفت النسوان كلها جيت على مرتي 😡"
ws[193] = "تريد مكياج"
rs[193] = "هيج انتي جكمه 😹😍 تردين مكياج \n يوجد ☟تٌَحَـتْ☟ المكياج الخادع \n (͡° ͜ʖ ͡°) اما قمر ساطع \n او نوع من انواع الضفادع 😂🐸"
ws[194] = "بالة"
rs[194] = "😹☝🏿️ موحلوات عليك هم ماشتريلك"
ws[195] = "باله"
rs[195] = "😹☝🏿️ موحلوات عليك هم ماشتريلك"
ws[196] = "مول"
rs[196] = "😹☝🏿️يريد يقطني ماشتريلك لوتموت"
ws[197] = "ملابس"
rs[197] = "🌚☝🏿️ تريدهن من المول لو من باله ؟"
ws[198] = "سيارة"
rs[198] = "😹☝🏿️ تريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[199] = "سياره"
rs[199] = "😹☝🏿️ ت ريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[200] = "سياره"
rs[200] = "😹☝🏿️ ت ريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[201] = "شيك"
rs[201] = "هوه اني لو عندي شيك اصير بوت 😹 الله وكيلك نص ملفاتي بلدين 😹😹"
ws[202] = "كاش"
rs[202] = "هوه اني لو عندي كاش اصير بوت 😹 الله وكيلك نص ملفاتي بلدين 😹😹"
ws[203] = "فلوس"
rs[203] = "كبدي شتريد/ين فلوسك/ج كاش لو شيك 🤔 ؟"
ws[204] = "وردة"
rs[204] = "🙈الي يمريني بورده ارمي بورده هيه والمزهريه #ياخي_الكرم_واجب 😹"
ws[205] = "اهووو"
rs[205] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[206] = "اهوو"
rs[206] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[207] = "اهو"
rs[207] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[208] = "انجبي"
rs[208] = "☹️☝️ 🏿 هــاااااي عليها مو"
ws[209] = "زبالة"
rs[209] = "لاتقلط 😤🔫 لو الا ازرف بيتكم"
ws[210] = "زباله"
rs[210] = "لاتقلط 😤🔫 لو الا ازرف بيتكم"
ws[211] = "زاحفة"
rs[211] = "ماخرب الشباب الطيبه غيرجن 😹 شنووو علاججن"
ws[212] = "زاحفه"
rs[212] = "ماخرب الشباب الطيبه غيرجن 😹 شنووو علاججن"
ws[213] = "اخوج"
rs[213] = "🌝😹 هووووه اني جيت للكروب داخلص منه شسوي/ن بي انته/ي"
ws[214] = "اخوك"
rs[214] = "🌝😹 هووووه اني جيت للكروب داخلص منه شسوي/ن بي انته/ي"
ws[215] = "اختج"
rs[215] = "😹☝🏿️حظرو سجاجينكم 🔪جابو سيره الخوات راح تصير عركه"
ws[216] = "اختك"
rs[216] = "😹☝🏿️حظرو سجاجينكم 🔪جابو سيره الخوات راح تصير عركه"
ws[217] = "امج"
rs[217] = "🤑 عــ👵🏻ــؤف الحجيه بحالها"
ws[218] = "امك"
rs[218] = "🤑 عــ👵🏻ــؤف الحجيه بحالها"
ws[219] = "ابوج"
rs[219] = "عـــ👴🏽ـوف/ي لحجي 🤑 بحــاله"
ws[220] = "ابوك"
rs[220] = "عـــ👴🏽ـوف/ي لحجي 🤑 بحــاله"
rs[221] = "احوالكم"
rs[221] = "احنه تمام احجيلنه انته/ي شلوونك/ج 😌"
ws[222] = "بخير"
rs[222] = "😌🐾 ياااااااارب الى الأفضل"
ws[223] = "ضوجة"
rs[223] = "هاك فلوس 💵 حتى تفكك الضوجه 🤑🤑"
ws[224] = "زين"
rs[224] = "دوؤؤؤمــــ😌🐾ــــــك/ج"
ws[225] = "زينه"
rs[225] = "دوؤؤؤمــــ😌🐾ــــــك/ج"
ws[226] = "زينة"
rs[226] = "دوؤؤؤمــــ😌🐾ــــــك/ج"
ws[227] = "😂😂😂😂😂😂😂"
rs[227] = "ضحكني وياك بس تكركر 🙄😹"
ws[228] = "😂😂😂😂😂"
rs[228] = "اي ولله سالفه اضحج 😿😹"
ws[229] = "مح"
rs[229] = "هاي ليش تبوسني بااع الحديق حتكفر 😹💋"
ws[230] = "كفو"
rs[230] = "ميكول كفو اله الكفو تاج مخي🐲 🌝💋"
ws[231] = "اها"
rs[231] = "يب قابل اغشك شسالفة ضلع 😐🌝🎧"
ws[232] = "اه"
rs[232] = "اوف ستحمل بس واحد بعد😞😹"
ws[233] = "كرار"
rs[233] = " كرار باعص ليث ورسول المنصوري 🐸✋🏿"
ws[234] = "🌚"
rs[234] = "هاك صابونةه 🚿 اغسل وجهكك 😳😹🏃🏿"
ws[235] = "احجي انكليزي"
rs[235] = "شوف يطلب من الحافي انعال 🤔 هواني عربي اشخبط شخبط 😹😹😹"
ws[236] = "احجي عربي"
rs[236] = "لك بابا العربي ميردله شي بس اقرا انكليزي 😻😹😹"
ws[237] = "انور"
rs[237] = "فديت ربه 😻💔"
ws[238] = "فايدر"
rs[238] = "فديت ربه 😍 هو الصنعني ⚙ من البنطرون 👖 للبدي 👕 فديته مطوري 🔩"
-- the main function
function II02II( msg, matches )
-- just a local variables that i used in my algorithm
local i = 0; local w = false
-- the main part that get the message that the user send and check if it equals to one of the words in the ws table :)
-- this section loops through all the words table and assign { k } to the word index and { v } to the word itself
for k,v in pairs(ws) do
-- change the message text to uppercase and the { v } value that toke form the { ws } table and than compare it in a specific pattern
if ( string.find(string.upper(msg.text), "^" .. string.upper(v) .. "$") ) then
-- assign the { i } to the index of the reply and the { w } to true ( we will use it later )
i = k; w = true;
end
end
-- check if { w } is not false and { i } not equals to 0
if ( (w ~= false) and (i ~= 0) ) then
-- get the receiver :3
R = get_receiver(msg)
-- send him the proper message from the index that { i } assigned to
--send_large_msg ( R , rs[i] );
--send_reply(msg.id, rs[i])
reply_msg(msg.id, rs[i], ok_cb, false )
end
-- don't edit this section
if ( msg.text == "about" ) then
if ( msg.from.username == "Memo" ) then
R = get_receiver(msg)
send_large_msg ( R , "Made by @xXxDev_iqxXx" );
end
end
end
return {
patterns = {
"(.*)"
},
run = II02II
}
end | gpl-2.0 |
mercury233/ygopro-scripts | c51993760.lua | 2 | 3176 | --抹殺の邪悪霊
function c51993760.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(51993760,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_START)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_HAND+LOCATION_MZONE)
e1:SetCountLimit(1,51993760)
e1:SetCondition(c51993760.condition)
e1:SetCost(c51993760.cost)
e1:SetTarget(c51993760.target)
e1:SetOperation(c51993760.operation)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(51993760,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,51993761)
e2:SetCondition(c51993760.thcon)
e2:SetTarget(c51993760.thtg)
e2:SetOperation(c51993760.thop)
c:RegisterEffect(e2)
end
function c51993760.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():IsControler(1-tp)
end
function c51993760.cost(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 c51993760.spfilter(c,e,tp)
return c:IsLevel(8) and c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c51993760.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c51993760.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c51993760.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c51993760.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c51993760.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
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)
tc:RegisterEffect(e2)
Duel.SpecialSummonComplete()
local a=Duel.GetAttacker()
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
end
end
function c51993760.cfilter(c,tp)
return c:IsLevel(8) and c:IsRace(RACE_FIEND) and c:IsControler(tp)
end
function c51993760.thcon(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c51993760.cfilter,1,nil,tp)
end
function c51993760.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c51993760.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c61374414.lua | 2 | 3462 | --CX-N·As·Ch Knight
function c61374414.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,6,3,c61374414.ovfilter,aux.Stringid(61374414,0))
c:EnableReviveLimit()
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(1)
c:RegisterEffect(e1)
--xyz spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(61374414,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,61374414)
e2:SetCost(c61374414.spcost)
e2:SetTarget(c61374414.sptg)
e2:SetOperation(c61374414.spop)
c:RegisterEffect(e2)
end
function c61374414.ovfilter(c)
return c:IsCode(34876719) and c:IsFaceup()
end
function c61374414.spcost(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 c61374414.spfilter(c,e,tp,mc)
local no=aux.GetXyzNumber(c)
return no and no>=101 and no<=107 and c:IsSetCard(0x48) and c:IsType(TYPE_XYZ) and mc:IsCanBeXyzMaterial(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function c61374414.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL)
and Duel.IsExistingMatchingCard(c61374414.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c61374414.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) then return end
if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsControler(tp) and not c:IsImmuneToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c61374414.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c)
local sc=g:GetFirst()
if sc then
local mg=c:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(c))
Duel.Overlay(sc,Group.FromCards(c))
if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)~=0 then
sc:CompleteProcedure()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetLabelObject(sc)
e1:SetCondition(c61374414.descon)
e1:SetOperation(c61374414.desop)
if Duel.GetTurnPlayer()==1-tp and Duel.GetCurrentPhase()==PHASE_END then
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,2)
e1:SetLabel(Duel.GetTurnCount())
sc:RegisterFlagEffect(61374414,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,2)
else
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e1:SetLabel(0)
sc:RegisterFlagEffect(61374414,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,1)
end
Duel.RegisterEffect(e1,tp)
end
end
end
end
function c61374414.descon(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()==tp or Duel.GetTurnCount()==e:GetLabel() then return false end
return e:GetLabelObject():GetFlagEffect(61374414)>0
end
function c61374414.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetLabelObject(),REASON_EFFECT)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c86223870.lua | 4 | 1279 | --レベル・リチューナー
function c86223870.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c86223870.target)
e1:SetOperation(c86223870.activate)
c:RegisterEffect(e1)
end
function c86223870.filter(c)
return c:IsFaceup() and c:IsLevelAbove(2)
end
function c86223870.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c86223870.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c86223870.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c86223870.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c86223870.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local lv=tc:GetLevel()
local dlv=1
if lv==1 then return
elseif lv>2 then
dlv=Duel.SelectOption(tp,aux.Stringid(86223870,0),aux.Stringid(86223870,1))+1
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(-dlv)
tc:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c63665875.lua | 6 | 1679 | --ゴブリンゾンビ
function c63665875.initial_effect(c)
--handes
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(63665875,0))
e1:SetCategory(CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(c63665875.ddcon)
e1:SetTarget(c63665875.ddtg)
e1:SetOperation(c63665875.ddop)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(63665875,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c63665875.srcon)
e2:SetTarget(c63665875.srtg)
e2:SetOperation(c63665875.srop)
c:RegisterEffect(e2)
end
function c63665875.ddcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function c63665875.ddtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,1-tp,1)
end
function c63665875.ddop(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(1-tp,1,REASON_EFFECT)
end
function c63665875.srcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c63665875.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c63665875.filter(c)
return c:IsDefenseBelow(1200) and c:IsRace(RACE_ZOMBIE) and c:IsAbleToHand()
end
function c63665875.srop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c63665875.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 |
fusijie/cocos2d-x-samples | samples/KillBug/src/packages/mvc/AppBase.lua | 25 | 1853 |
local AppBase = class("AppBase")
function AppBase:ctor(configs)
self.configs_ = {
viewsRoot = "app.views",
modelsRoot = "app.models",
defaultSceneName = "MainScene",
}
for k, v in pairs(configs or {}) do
self.configs_[k] = v
end
if type(self.configs_.viewsRoot) ~= "table" then
self.configs_.viewsRoot = {self.configs_.viewsRoot}
end
if type(self.configs_.modelsRoot) ~= "table" then
self.configs_.modelsRoot = {self.configs_.modelsRoot}
end
if DEBUG > 1 then
dump(self.configs_, "AppBase configs")
end
if CC_SHOW_FPS then
cc.Director:getInstance():setDisplayStats(true)
end
-- event
self:onCreate()
end
function AppBase:run(initSceneName)
initSceneName = initSceneName or self.configs_.defaultSceneName
self:enterScene(initSceneName)
end
function AppBase:enterScene(sceneName, transition, time, more)
local view = self:createView(sceneName)
view:showWithScene(transition, time, more)
return view
end
function AppBase:createView(name)
for _, root in ipairs(self.configs_.viewsRoot) do
local packageName = string.format("%s.%s", root, name)
local status, view = xpcall(function()
return require(packageName)
end, function(msg)
if not string.find(msg, string.format("'%s' not found:", packageName)) then
print("load view error: ", msg)
end
end)
local t = type(view)
if status and (t == "table" or t == "userdata") then
return view:create(self, name)
end
end
error(string.format("AppBase:createView() - not found view \"%s\" in search paths \"%s\"",
name, table.concat(self.configs_.viewsRoot, ",")), 0)
end
function AppBase:onCreate()
end
return AppBase
| mit |
mercury233/ygopro-scripts | c94689635.lua | 2 | 1604 | --紫光の宣告者
function c94689635.initial_effect(c)
--Negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(94689635,0))
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c94689635.discon)
e1:SetCost(c94689635.discost)
e1:SetTarget(c94689635.distg)
e1:SetOperation(c94689635.disop)
c:RegisterEffect(e1)
end
function c94689635.discon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and re:IsActiveType(TYPE_TRAP) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
and Duel.IsChainNegatable(ev)
end
function c94689635.costfilter(c)
return c:IsRace(RACE_FAIRY) and c:IsAbleToGraveAsCost()
end
function c94689635.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGraveAsCost() and
Duel.IsExistingMatchingCard(c94689635.costfilter,tp,LOCATION_HAND,0,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c94689635.costfilter,tp,LOCATION_HAND,0,1,1,c)
g:AddCard(c)
Duel.SendtoGrave(g,REASON_COST)
end
function c94689635.distg(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 c94689635.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/items/serving_of_vermillion_jelly.lua | 35 | 1448 | -----------------------------------------
-- ID: 5158
-- Item: Vermillion Jelly
-- Food Effect: 4 hours, All Races
-----------------------------------------
-- MP +12%(Cap: 90@750 Base MP)
-- Intelligence +6
-- MP Recovered While Healing +2
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,5158);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_MPP, 12);
target:addMod(MOD_FOOD_MP_CAP, 90);
target:addMod(MOD_INT, 6);
target:addMod(MOD_MPHEAL, 2);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_MPP,12);
target:delMod(MOD_FOOD_MP_CAP, 90);
target:delMod(MOD_INT, 6);
target:delMod(MOD_MPHEAL, 2);
end;
| gpl-3.0 |
mercury233/ygopro-scripts | c16984449.lua | 2 | 1537 | --炎妖蝶ウィルプス
function c16984449.initial_effect(c)
aux.EnableDualAttribute(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetDescription(aux.Stringid(16984449,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(aux.IsDualState)
e1:SetCost(c16984449.cost)
e1:SetTarget(c16984449.target)
e1:SetOperation(c16984449.operation)
c:RegisterEffect(e1)
end
function c16984449.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 c16984449.filter(c,e,sp)
return c:IsType(TYPE_DUAL) and not c:IsCode(16984449) and c:IsCanBeSpecialSummoned(e,0,sp,false,false)
end
function c16984449.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c16984449.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingTarget(c16984449.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c16984449.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c16984449.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
tc:EnableDualState()
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
ajayk/kong | kong/plugins/rate-limiting/daos.lua | 2 | 3183 | local BaseDao = require "kong.dao.cassandra.base_dao"
local cassandra = require "cassandra"
local timestamp = require "kong.tools.timestamp"
local ngx_log = ngx and ngx.log or print
local ngx_err = ngx and ngx.ERR
local tostring = tostring
local RateLimitingMetrics = BaseDao:extend()
function RateLimitingMetrics:new(properties, events_handler)
self._table = "ratelimiting_metrics"
self.queries = {
increment_counter = [[ UPDATE ratelimiting_metrics SET value = value + ? WHERE api_id = ? AND
identifier = ? AND
period_date = ? AND
period = ?; ]],
select_one = [[ SELECT * FROM ratelimiting_metrics WHERE api_id = ? AND
identifier = ? AND
period_date = ? AND
period = ?; ]],
delete = [[ DELETE FROM ratelimiting_metrics WHERE api_id = ? AND
identifier = ? AND
period_date = ? AND
period = ?; ]]
}
RateLimitingMetrics.super.new(self, properties, events_handler)
end
function RateLimitingMetrics:increment(api_id, identifier, current_timestamp, value)
local periods = timestamp.get_timestamps(current_timestamp)
local options = self._factory:get_session_options()
local session, err = cassandra.spawn_session(options)
if err then
ngx_log(ngx_err, "[rate-limiting] could not spawn session to Cassandra: "..tostring(err))
return
end
local ok = true
for period, period_date in pairs(periods) do
local res, err = session:execute(self.queries.increment_counter, {
cassandra.counter(value),
cassandra.uuid(api_id),
identifier,
cassandra.timestamp(period_date),
period
})
if not res then
ok = false
ngx_log(ngx_err, "[rate-limiting] could not increment counter for period '"..period.."': ", tostring(err))
end
end
session:set_keep_alive()
return ok
end
function RateLimitingMetrics:find_one(api_id, identifier, current_timestamp, period)
local periods = timestamp.get_timestamps(current_timestamp)
local metric, err = RateLimitingMetrics.super.execute(self, self.queries.select_one, {
cassandra.uuid(api_id),
identifier,
cassandra.timestamp(periods[period]),
period
})
if err then
return nil, err
elseif #metric > 0 then
metric = metric[1]
else
metric = nil
end
return metric
end
-- Unsuported
function RateLimitingMetrics:find_by_primary_key()
error("ratelimiting_metrics:find_by_primary_key() not yet implemented", 2)
end
function RateLimitingMetrics:delete(api_id, identifier, periods)
error("ratelimiting_metrics:delete() not yet implemented", 2)
end
function RateLimitingMetrics:insert()
error("ratelimiting_metrics:insert() not supported", 2)
end
function RateLimitingMetrics:update()
error("ratelimiting_metrics:update() not supported", 2)
end
function RateLimitingMetrics:find()
error("ratelimiting_metrics:find() not supported", 2)
end
function RateLimitingMetrics:find_by_keys()
error("ratelimiting_metrics:find_by_keys() not supported", 2)
end
return {ratelimiting_metrics = RateLimitingMetrics}
| apache-2.0 |
Josepdal/DBTeam | plugins/rules.lua | 43 | 2283 | --------------------------------------------------
-- ____ ____ _____ --
-- | \| _ )_ _|___ ____ __ __ --
-- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
-- |____/|____/ |_|\____/\_____|_/\/\_| --
-- --
--------------------------------------------------
-- --
-- Developers: @Josepdal & @MaSkAoS --
-- Support: @Skneos, @iicc1 & @serx666 --
-- --
-- Created by @Josepdal & @A7F --
-- --
--------------------------------------------------
local function set_rules_channel(msg, text)
local rules = text
local hash = 'channel:id:'..msg.to.id..':rules'
redis:set(hash, rules)
end
local function del_rules_channel(chat_id)
local hash = 'channel:id:'..chat_id..':rules'
redis:del(hash)
end
local function init_def_rules(chat_id)
local rules = 'ℹ️ Rules:\n'
..'1⃣ No Flood.\n'
..'2⃣ No Spam.\n'
..'3⃣ Try to stay on topic.\n'
..'4⃣ Forbidden any racist, sexual, homophobic or gore content.\n'
..'➡️ Repeated failure to comply with these rules will cause ban.'
local hash='channel:id:'..chat_id..':rules'
redis:set(hash, rules)
end
local function ret_rules_channel(msg)
local chat_id = msg.to.id
local hash = 'channel:id:'..msg.to.id..':rules'
if redis:get(hash) then
return redis:get(hash)
else
init_def_rules(chat_id)
return redis:get(hash)
end
end
local function run(msg, matches)
if matches[1] == 'rules' then
return ret_rules_channel(msg)
elseif matches[1] == 'setrules' then
if permissions(msg.from.id, msg.to.id, 'rules') then
set_rules_channel(msg, matches[2])
return 'ℹ️ '..lang_text(msg.to.id, 'setRules')
end
elseif matches[1] == 'remrules' then
if permissions(msg.from.id, msg.to.id, 'rules') then
del_rules_channel(msg.to.id)
return 'ℹ️ '..lang_text(msg.to.id, 'remRules')
end
end
end
return {
patterns = {
'^[!/#](rules)$',
'^[!/#](setrules) (.+)$',
'^[!/#](remrules)$'
},
run = run
}
| gpl-2.0 |
ajayk/kong | spec/unit/tools/database_cache_spec.lua | 3 | 1356 | require "kong.tools.ngx_stub"
local cache = require "kong.tools.database_cache"
describe("Database cache", function()
it("should return a valid API cache key", function()
assert.are.equal("apis:httpbin.org", cache.api_key("httpbin.org"))
end)
it("should return a valid PLUGIN cache key", function()
assert.are.equal("plugins:authentication:api123:app123", cache.plugin_key("authentication", "api123", "app123"))
assert.are.equal("plugins:authentication:api123", cache.plugin_key("authentication", "api123"))
end)
it("should return a valid KeyAuthCredential cache key", function()
assert.are.equal("keyauth_credentials:username", cache.keyauth_credential_key("username"))
end)
it("should return a valid BasicAuthCredential cache key", function()
assert.are.equal("basicauth_credentials:username", cache.basicauth_credential_key("username"))
end)
it("should return a valid HmacAuthCredential cache key", function()
assert.are.equal("hmacauth_credentials:username", cache.hmacauth_credential_key("username"))
end)
it("should return a valid JWTAuthCredential cache key", function()
assert.are.equal("jwtauth_credentials:hello", cache.jwtauth_credential_key("hello"))
end)
it("should return a valid requests cache key", function()
assert.are.equal("requests", cache.requests_key())
end)
end)
| apache-2.0 |
Zenny89/darkstar | scripts/zones/Tavnazian_Safehold/npcs/Despachiaire.lua | 17 | 2660 | -----------------------------------
-- Area: Tavnazian Safehold
-- NPC: Despachiaire
-- @pos 108 -40 -83 26
-----------------------------------
require("scripts/globals/missions");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local currentCOPMission = player:getCurrentMission(COP);
local LouverancePathStatut = player:getVar("COP_Louverance_s_Path");
if (currentCOPMission == THE_LOST_CITY and player:getVar("PromathiaStatus") == 0) then
player:startEvent(0x0066);
elseif (currentCOPMission == SHELTERING_DOUBT and player:getVar("PromathiaStatus") == 1) then
player:startEvent(0x006C);
elseif (currentCOPMission == THE_ENDURING_TUMULT_OF_WAR and player:getVar("COP_optional_CS_Despachaire") == 0) then
player:startEvent(0x0075); --117
elseif (currentCOPMission == THREE_PATHS and LouverancePathStatut == 0) then
player:startEvent(0x0076);
elseif (currentCOPMission == THREE_PATHS and LouverancePathStatut == 1 ) then
player:startEvent(0x0086);
else
player:startEvent(0x006A);
end
end;
--Despachiaire 102 ++
--Despachiaire 104 ++
--Despachiaire 106 ++
--Despachiaire 107 ++
--Despachiaire 108 ++
--Despachiaire 110 ++
--Despachiaire 112 ++
--Despachiaire 117 ++
--Despachiaire 118 ++
--Despachiaire 132
--Despachiaire 133
--Despachiaire 134 ??
--Despachiaire 139
--Despachiaire 144 chat
--Despachiaire 149 XX
--Despachiaire 315 chat
--Despachiaire 317 chat
--Despachiaire 318 chat
--Despachiaire 505 CS
--Despachiaire 517 CS (despachiaire's wife)
--Despachiaire 518 CS (ulmia mother)
--Despachiaire 576 CS
--Despachiaire 577 chat
--Despachiaire 578 chat
--Despachiaire 579 chat
--Despachiaire 617 XX
--Despachiaire 618 XX
-----------------------------------
-- 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 == 0x0066 or csid == 0x006C) then
player:setVar("PromathiaStatus",2);
elseif (csid == 0x0075) then
player:setVar("COP_optional_CS_Despachaire",1);
elseif (csid == 0x0076) then
player:setVar("COP_Louverance_s_Path",1);
end
end; | gpl-3.0 |
focusworld/telemamal | plugins/id.lua | 226 | 4260 | local function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
local function returnids(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
local text = 'IDs for chat '..chatname
..' ('..chat_id..')\n'
..'There are '..result.members_num..' members'
..'\n---------\n'
for k,v in pairs(result.members) do
text = text .. v.print_name .. " (user#id" .. v.id .. ")\n"
end
send_large_msg(receiver, text)
end
local function run(msg, matches)
local receiver = get_receiver(msg)
if matches[1] == "!id" then
local text = user_print_name(msg.from) .. ' (user#id' .. msg.from.id .. ')'
if is_chat_msg(msg) then
text = text .. "\nYou are in group " .. user_print_name(msg.to) .. " (chat#id" .. msg.to.id .. ")"
end
return text
elseif matches[1] == "chat" then
-- !ids? (chat) (%d+)
if matches[2] and is_sudo(msg) then
local chat = 'chat#id'..matches[2]
chat_info(chat, returnids, {receiver=receiver})
else
if not is_chat_msg(msg) then
return "You are not in a group."
end
local chat = get_receiver(msg)
chat_info(chat, returnids, {receiver=receiver})
end
elseif matches[1] == "member" and matches[2] == "@" then
local nick = matches[3]
local chat = get_receiver(msg)
if not is_chat_msg(msg) then
return "You are not in a group."
end
chat_info(chat, function (extra, success, result)
local receiver = extra.receiver
local nick = extra.nick
local found
for k,user in pairs(result.members) do
if user.username == nick then
found = user
end
end
if not found then
send_msg(receiver, "User not found on this chat.", ok_cb, false)
else
local text = "ID: "..found.id
send_msg(receiver, text, ok_cb, false)
end
end, {receiver=chat, nick=nick})
elseif matches[1] == "members" and matches[2] == "name" then
local text = matches[3]
local chat = get_receiver(msg)
if not is_chat_msg(msg) then
return "You are not in a group."
end
chat_info(chat, function (extra, success, result)
local members = result.members
local receiver = extra.receiver
local text = extra.text
local founds = {}
for k,member in pairs(members) do
local fields = {'first_name', 'print_name', 'username'}
for k,field in pairs(fields) do
if member[field] and type(member[field]) == "string" then
if member[field]:match(text) then
local id = tostring(member.id)
founds[id] = member
end
end
end
end
if next(founds) == nil then -- Empty table
send_msg(receiver, "User not found on this chat.", ok_cb, false)
else
local text = ""
for k,user in pairs(founds) do
local first_name = user.first_name or ""
local print_name = user.print_name or ""
local user_name = user.user_name or ""
local id = user.id or "" -- This would be funny
text = text.."First name: "..first_name.."\n"
.."Print name: "..print_name.."\n"
.."User name: "..user_name.."\n"
.."ID: "..id
end
send_msg(receiver, text, ok_cb, false)
end
end, {receiver=chat, text=text})
end
end
return {
description = "Know your id or the id of a chat members.",
usage = {
"!id: Return your ID and the chat id if you are in one.",
"!ids chat: Return the IDs of the current chat members.",
"!ids chat <chat_id>: Return the IDs of the <chat_id> members.",
"!id member @<user_name>: Return the member @<user_name> ID from the current chat",
"!id members name <text>: Search for users with <text> on first_name, print_name or username on current chat"
},
patterns = {
"^!id$",
"^!ids? (chat) (%d+)$",
"^!ids? (chat)$",
"^!id (member) (@)(.+)",
"^!id (members) (name) (.+)"
},
run = run
}
| gpl-2.0 |
mercury233/ygopro-scripts | c51474037.lua | 2 | 2412 | --ヤモイモリ
function c51474037.initial_effect(c)
--change / destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1,51474037)
e1:SetCost(aux.bfgcost)
e1:SetTarget(c51474037.target)
e1:SetOperation(c51474037.activate)
c:RegisterEffect(e1)
end
function c51474037.filter1(c,tp)
return c:IsFaceup() and c:IsRace(RACE_REPTILE)
and Duel.IsExistingTarget(c51474037.filter2,tp,0,LOCATION_MZONE,1,nil,c:IsCanTurnSet())
end
function c51474037.filter2(c,check)
return c:IsFaceup() and (check and c:IsCanTurnSet() or c:GetAttack()>0)
end
function c51474037.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c51474037.filter1,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g1=Duel.SelectTarget(tp,c51474037.filter1,tp,LOCATION_MZONE,0,1,1,nil,tp)
local tc1=g1:GetFirst()
local check=tc1:IsCanTurnSet()
e:SetLabelObject(tc1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g2=Duel.SelectTarget(tp,c51474037.filter2,tp,0,LOCATION_MZONE,1,1,nil,check)
local sel
local tc2=g2:GetFirst()
if tc2:IsAttack(0) then
sel=Duel.SelectOption(tp,aux.Stringid(51474037,0))
elseif not (check and tc2:IsCanTurnSet()) then
sel=Duel.SelectOption(tp,aux.Stringid(51474037,1))+1
else
sel=Duel.SelectOption(tp,aux.Stringid(51474037,0),aux.Stringid(51474037,1))
end
e:SetLabel(sel)
if sel==0 then
e:SetCategory(CATEGORY_POSITION)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g1,1,0,0)
else
e:SetCategory(CATEGORY_DESTROY)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
end
end
function c51474037.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sel=e:GetLabel()
if sel==0 then
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.ChangePosition(tg,POS_FACEDOWN_DEFENSE)
else
local tc1=e:GetLabelObject()
local tc2=g:GetFirst()
if tc2==tc1 then tc2=g:GetNext() end
if tc1:IsRelateToEffect(e) and Duel.Destroy(tc1,REASON_EFFECT)~=0 and tc2 and tc2:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc2:RegisterEffect(e1)
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c27699122.lua | 2 | 1542 | --トゥーン・フリップ
function c27699122.initial_effect(c)
aux.AddCodeList(c,15259703)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,27699122+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c27699122.con)
e1:SetTarget(c27699122.tg)
e1:SetOperation(c27699122.op)
c:RegisterEffect(e1)
end
function c27699122.ffilter(c)
return c:IsFaceup() and c:IsCode(15259703)
end
function c27699122.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c27699122.ffilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c27699122.filter(c,e,tp)
return c:IsType(TYPE_TOON) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEUP)
end
function c27699122.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local dg=Duel.GetMatchingGroup(c27699122.filter,tp,LOCATION_DECK,0,nil,e,tp)
return dg:GetClassCount(Card.GetCode)>=3 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c27699122.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c27699122.filter,tp,LOCATION_DECK,0,nil,e,tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or g:GetClassCount(Card.GetCode)<3 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,3,3)
if #sg>0 then
Duel.ConfirmCards(1-tp,sg)
local tc=sg:RandomSelect(1-tp,1):GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c61019812.lua | 3 | 1821 | --レッド・ダストン
function c61019812.initial_effect(c)
c:SetUniqueOnField(1,0,61019812)
--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(c61019812.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)
--damage
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(61019812,0))
e6:SetCategory(CATEGORY_DAMAGE)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_DESTROYED)
e6:SetCondition(c61019812.dmcon)
e6:SetTarget(c61019812.dmtg)
e6:SetOperation(c61019812.dmop)
c:RegisterEffect(e6)
end
function c61019812.fuslimit(e,c,sumtype)
return sumtype==SUMMON_TYPE_FUSION
end
function c61019812.dmcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function c61019812.dmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
Duel.SetTargetPlayer(c:GetPreviousControler())
Duel.SetTargetParam(500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,c:GetPreviousControler(),500)
end
function c61019812.dmop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c10204849.lua | 2 | 4555 | --フルール・ド・フルーレ
function c10204849.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,10204849+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c10204849.target)
e1:SetOperation(c10204849.operation)
c:RegisterEffect(e1)
--atk up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(700)
c:RegisterEffect(e3)
--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)
e4:SetCountLimit(1,10204849)
e4:SetCondition(c10204849.eqcon)
e4:SetTarget(c10204849.eqtg)
e4:SetOperation(c10204849.eqop)
c:RegisterEffect(e4)
end
function c10204849.filter(c,e,tp)
return c:IsLevelBelow(2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c10204849.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c10204849.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c10204849.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c10204849.filter,tp,LOCATION_GRAVE,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 c10204849.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)
and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
tc:RegisterEffect(e2)
Duel.Equip(tp,c,tc)
--equip limit
local e3=Effect.CreateEffect(tc)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetValue(c10204849.eqlimit)
c:RegisterEffect(e3)
--Destroy
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetCode(EVENT_LEAVE_FIELD_P)
e4:SetOperation(c10204849.checkop)
e4:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e5:SetCode(EVENT_LEAVE_FIELD)
e5:SetOperation(c10204849.desop)
e5:SetReset(RESET_EVENT+RESET_OVERLAY+RESET_TOFIELD)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
end
Duel.SpecialSummonComplete()
end
function c10204849.eqlimit(e,c)
return e:GetOwner()==c
end
function c10204849.checkop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsDisabled() then
e:SetLabel(1)
else e:SetLabel(0) end
end
function c10204849.desop(e,tp,eg,ep,ev,re,r,rp)
e:Reset()
if e:GetLabelObject():GetLabel()~=0 then return end
local tc=e:GetHandler():GetEquipTarget()
if tc and tc:IsLocation(LOCATION_MZONE) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c10204849.eqcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_SZONE)
end
function c10204849.eqfilter(c)
return c:IsType(TYPE_SYNCHRO) and c:IsFaceup()
end
function c10204849.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c10204849.eqfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function c10204849.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c10204849.eqfilter,tp,LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if tc and tc:IsFaceup() and c:CheckUniqueOnField(tp) then
Duel.Equip(tp,c,tc)
--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(c10204849.eqlimit)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.