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 |
|---|---|---|---|---|---|
nesstea/darkstar | scripts/zones/Dynamis-San_dOria/bcnms/dynamis_sandoria.lua | 22 | 1331 | -----------------------------------
-- Area: Dynamis San d'Oria
-- Name: Dynamis San d'Oria
-----------------------------------
-- After registering the BCNM via bcnmRegister(bcnmid)
function onBcnmRegister(player,instance)
SetServerVariable("[DynaSandoria]UniqueID",player:getDynamisUniqueID(1281));
SetServerVariable("[DynaSandoria]Boss_Trigger",0);
SetServerVariable("[DynaSandoria]Already_Received",0);
end;
-- Physically entering the BCNM via bcnmEnter(bcnmid)
function onBcnmEnter(player,instance)
player:setVar("DynamisID",GetServerVariable("[DynaSandoria]UniqueID"));
local realDay = os.time();
if (DYNA_MIDNIGHT_RESET == true) then
realDay = getMidnight() - 86400;
end
local dynaWaitxDay = player:getVar("dynaWaitxDay");
if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay) then
player:setVar("dynaWaitxDay",realDay);
end
end;
-- Leaving the Dynamis by every mean possible, given by the LeaveCode
-- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3)
-- 4=Finish he dynamis
function onBcnmLeave(player,instance,leavecode)
--print("leave code "..leavecode);
if (leavecode == 4) then
GetNPCByID(17535224):setStatus(2);
SetServerVariable("[DynaSandoria]UniqueID",0);
end
end; | gpl-3.0 |
JulioC/telegram-bot | plugins/isup.lua | 741 | 3095 | do
local socket = require("socket")
local cronned = load_from_file('data/isup.lua')
local function save_cron(msg, url, delete)
local origin = get_receiver(msg)
if not cronned[origin] then
cronned[origin] = {}
end
if not delete then
table.insert(cronned[origin], url)
else
for k,v in pairs(cronned[origin]) do
if v == url then
table.remove(cronned[origin], k)
end
end
end
serialize_to_file(cronned, 'data/isup.lua')
return 'Saved!'
end
local function is_up_socket(ip, port)
print('Connect to', ip, port)
local c = socket.try(socket.tcp())
c:settimeout(3)
local conn = c:connect(ip, port)
if not conn then
return false
else
c:close()
return true
end
end
local function is_up_http(url)
-- Parse URL from input, default to http
local parsed_url = URL.parse(url, { scheme = 'http', authority = '' })
-- Fix URLs without subdomain not parsed properly
if not parsed_url.host and parsed_url.path then
parsed_url.host = parsed_url.path
parsed_url.path = ""
end
-- Re-build URL
local url = URL.build(parsed_url)
local protocols = {
["https"] = https,
["http"] = http
}
local options = {
url = url,
redirect = false,
method = "GET"
}
local response = { protocols[parsed_url.scheme].request(options) }
local code = tonumber(response[2])
if code == nil or code >= 400 then
return false
end
return true
end
local function isup(url)
local pattern = '^(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?):?(%d?%d?%d?%d?%d?)$'
local ip,port = string.match(url, pattern)
local result = nil
-- !isup 8.8.8.8:53
if ip then
port = port or '80'
result = is_up_socket(ip, port)
else
result = is_up_http(url)
end
return result
end
local function cron()
for chan, urls in pairs(cronned) do
for k,url in pairs(urls) do
print('Checking', url)
if not isup(url) then
local text = url..' looks DOWN from here. 😱'
send_msg(chan, text, ok_cb, false)
end
end
end
end
local function run(msg, matches)
if matches[1] == 'cron delete' then
if not is_sudo(msg) then
return 'This command requires privileged user'
end
return save_cron(msg, matches[2], true)
elseif matches[1] == 'cron' then
if not is_sudo(msg) then
return 'This command requires privileged user'
end
return save_cron(msg, matches[2])
elseif isup(matches[1]) then
return matches[1]..' looks UP from here. 😃'
else
return matches[1]..' looks DOWN from here. 😱'
end
end
return {
description = "Check if a website or server is up.",
usage = {
"!isup [host]: Performs a HTTP request or Socket (ip:port) connection",
"!isup cron [host]: Every 5mins check if host is up. (Requires privileged user)",
"!isup cron delete [host]: Disable checking that host."
},
patterns = {
"^!isup (cron delete) (.*)$",
"^!isup (cron) (.*)$",
"^!isup (.*)$",
"^!ping (.*)$",
"^!ping (cron delete) (.*)$",
"^!ping (cron) (.*)$"
},
run = run,
cron = cron
}
end
| gpl-2.0 |
magnan/cordova-cef | 3rdparty/pugixml/scripts/premake4.lua | 128 | 2376 | -- Reset RNG seed to get consistent results across runs (i.e. XCode)
math.randomseed(12345)
local static = _ARGS[1] == 'static'
local action = premake.action.current()
if string.startswith(_ACTION, "vs") then
if action then
-- Disable solution generation
function action.onsolution(sln)
sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
end
-- Rename output file
function action.onproject(prj)
local name = "%%_" .. _ACTION .. (static and "_static" or "")
if static then
for k, v in pairs(prj.project.__configs) do
v.objectsdir = v.objectsdir .. "Static"
end
end
if _ACTION == "vs2010" then
premake.generate(prj, name .. ".vcxproj", premake.vs2010_vcxproj)
else
premake.generate(prj, name .. ".vcproj", premake.vs200x_vcproj)
end
end
end
elseif _ACTION == "codeblocks" then
action.onsolution = nil
function action.onproject(prj)
premake.generate(prj, "%%_" .. _ACTION .. ".cbp", premake.codeblocks_cbp)
end
elseif _ACTION == "codelite" then
action.onsolution = nil
function action.onproject(prj)
premake.generate(prj, "%%_" .. _ACTION .. ".project", premake.codelite_project)
end
end
solution "pugixml"
objdir(_ACTION)
targetdir(_ACTION)
if string.startswith(_ACTION, "vs") then
if _ACTION ~= "vs2002" and _ACTION ~= "vs2003" then
platforms { "x32", "x64" }
configuration "x32" targetdir(_ACTION .. "/x32")
configuration "x64" targetdir(_ACTION .. "/x64")
end
configurations { "Debug", "Release" }
if static then
configuration "Debug" targetsuffix "sd"
configuration "Release" targetsuffix "s"
else
configuration "Debug" targetsuffix "d"
end
else
if _ACTION == "xcode3" then
platforms "universal"
end
configurations { "Debug", "Release" }
configuration "Debug" targetsuffix "d"
end
project "pugixml"
kind "StaticLib"
language "C++"
files { "../src/pugixml.hpp", "../src/pugiconfig.hpp", "../src/pugixml.cpp" }
flags { "NoPCH", "NoMinimalRebuild", "NoEditAndContinue", "Symbols" }
uuid "89A1E353-E2DC-495C-B403-742BE206ACED"
configuration "Debug"
defines { "_DEBUG" }
configuration "Release"
defines { "NDEBUG" }
flags { "Optimize" }
if static then
configuration "*"
flags { "StaticRuntime" }
end
| apache-2.0 |
nesstea/darkstar | scripts/zones/Qufim_Island/npcs/Numumu_WW.lua | 13 | 3323 | -----------------------------------
-- Area: Qufim Island
-- NPC: Numumu, W.W.
-- Type: Border Conquest Guards
-- @pos 179.093 -21.575 -15.282 126
-----------------------------------
package.loaded["scripts/zones/Qufim_Island/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Qufim_Island/TextIDs");
local guardnation = WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = QUFIMISLAND;
local csid = 0x7ff6;
-----------------------------------
-- 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 |
nesstea/darkstar | scripts/zones/Promyvion-Vahzl/npcs/_0md.lua | 13 | 1390 | -----------------------------------
-- Area: Promyvion vahzl
-- NPC: Memory flux (2)
-----------------------------------
package.loaded["scripts/zones/Promyvion-Vahzl/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Promyvion-Vahzl/TextIDs");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(COP) == DESIRES_OF_EMPTINESS and player:getVar("PromathiaStatus")==3) then
SpawnMob(16867333,240):updateClaim(player);
elseif (player:getCurrentMission(COP) == DESIRES_OF_EMPTINESS and player:getVar("PromathiaStatus")==4) then
player:startEvent(0x0034);
else
player:messageSpecial(OVERFLOWING_MEMORIES);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
if (csid == 0x0034) then
player:setVar("PromathiaStatus",5);
end
end; | gpl-3.0 |
malortie/gmod-addons | th_weapons/lua/weapons/weapon_th_chaingun/shared.lua | 1 | 14213 | -- Only enable this addon if HL:S is mounted.
if !IsHL1Mounted() then return end
-- Define a global variable to ease calling base class methods.
DEFINE_BASECLASS( 'weapon_th_base' )
SWEP.Base = 'weapon_th_base'
SWEP.PrintName = 'Chaingun'
SWEP.Author = 'Marc-Antoine (malortie) Lortie'
SWEP.Contact = ''
SWEP.Purpose = ''
SWEP.Instructions = '+attack: Fire.\n+reload: Reload.'
SWEP.Category = 'They Hunger'
SWEP.Slot = 3
SWEP.SlotPos = 4
SWEP.ViewModelFOV = 90
SWEP.ViewModelFlip = false
SWEP.ViewModel = 'models/th/v_tfac/v_tfac.mdl'
SWEP.WorldModel = 'models/th/w_tfac/w_tfac.mdl'
SWEP.PModel = 'models/th/p_mini2/p_mini2.mdl'
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.Primary.ClipSize = 100
SWEP.Primary.DefaultClip = 100
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = AMMO_CLASS_HL1_9MM
SWEP.Primary.FireRate = 0.1
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = 'none'
-- The rate at which to decrement ammunition when
-- the player is firing.
SWEP.AmmoDrainRate = 0.1
-- The sound to play when shooting.
SWEP.ShootSound = 'weapon_th_chaingun.single'
-- The sound to play when reloading.
SWEP.ReloadSound = 'weapon_th_chaingun.reload'
-- The Chaingun cannon's spin down sound.
SWEP.SpindownSound = 'weapon_th_chaingun.spindown'
-- The Chaingun cannon's spin up sound.
SWEP.SpinupSound = 'weapon_th_chaingun.spinup'
-- The Chaingun cannon's spin sound.
SWEP.SpinSound = 'weapon_th_chaingun.spin'
-- The speed factor to use when the player is firing.
SWEP.OwnerSpeedScale = 0.25
SWEP.MuzzleFlashOffset = Vector( 0, 0, 0 )
-------------------------------------
-- Skill ConVars
-------------------------------------
-- Represents the amount of damage casted to a player.
local chaingun_damage = GetConVar( 'sk_th_plr_dmg_9mm_bullet' ) or CreateConVar( 'sk_th_plr_dmg_9mm_bullet', '8' )
-- Attack states.
local AttackStates = {
None = 0, -- Chaingun cannon is at rest.
Spinup = 1, -- Chaingun cannon is spinning up.
Spin = 2, -- Chaingun cannon is spinning.
Spindown = 3 -- Chaingun cannon is spinning down.
}
--[[---------------------------------------------------------
Setup networked variables.
-----------------------------------------------------------]]
function SWEP:SetupDataTables()
BaseClass.SetupDataTables( self )
self.Weapon:NetworkVar( 'Float', 3, 'NextAmmoDrain' )
self.Weapon:NetworkVar( 'Float', 4, 'NextSpinSound' )
self.Weapon:NetworkVar( 'Float', 5, 'OriginalOwnerRunSpeed' )
self.Weapon:NetworkVar( 'Float', 6, 'OriginalOwnerWalkSpeed' )
end
--[[---------------------------------------------------------
Perform Client/Server initialization.
-----------------------------------------------------------]]
function SWEP:Initialize()
BaseClass.Initialize( self )
self.Weapon:SetNextAmmoDrain( 0 )
self.Weapon:SetNextSpinSound( 0 )
self.Weapon:SetOriginalOwnerRunSpeed( -1 )
self.Weapon:SetOriginalOwnerWalkSpeed( -1 )
self.Weapon:SetMuzzleFlashType( MUZZLEFLASH_TH_CHAINGUN )
self.Weapon:SetMuzzleFlashScale( 2.0 )
self:SetHoldType( 'shotgun' )
end
--[[---------------------------------------------------------
Called when weapon tries to holster.
@param wep The weapon we are trying switch to.
@return true on success.
@return false on failure.
-----------------------------------------------------------]]
function SWEP:Holster( wep )
self.Weapon:SetInSpecialReload( 0 )
self:ResetWeaponStates()
self:StopLoopingSounds()
return BaseClass.Holster( self, wep )
end
--[[---------------------------------------------------------
Primary weapon attack.
-----------------------------------------------------------]]
function SWEP:PrimaryAttack()
if !self:CanPrimaryAttack() then
self:Spindown()
return
end
if self:CannonIsAtRest() then
self:Spinup()
elseif self:CannonHasSpinUp() or self:CannonIsSpinning() then
self:Spin()
end
end
--[[---------------------------------------------------------
Check if the weapon can do a secondary attack.
@return true on success.
@return false on failure.
-----------------------------------------------------------]]
function SWEP:CanSecondaryAttack() return false end
--[[---------------------------------------------------------
Called every frame.
-----------------------------------------------------------]]
function SWEP:Think()
BaseClass.Think( self )
self:UpdateWeaponCannon()
end
--[[---------------------------------------------------------
Called when the reload key is pressed.
-----------------------------------------------------------]]
function SWEP:Reload()
if self:Clip1() == self:GetMaxClip1() or self.Owner:GetAmmoCount( self:GetPrimaryAmmoType() ) <= 0 then
return
end
-- don't reload until recoil is done
if self:GetNextPrimaryFire() > CurTime() then
return end
-- check to see if we're ready to reload
if self.Weapon:GetInSpecialReload() == 0 then
self:ResetWeaponStates()
self:StopLoopingSounds()
self.Weapon:SetInSpecialReload(1)
self:SendWeaponAnim( ACT_VM_HOLSTER )
self.Weapon:SetNextIdle( CurTime() + self:ViewModelSequenceDuration() )
self:SetNextPrimaryFire(CurTime() + self:ViewModelSequenceDuration())
self:SetNextSecondaryFire(CurTime() + self:ViewModelSequenceDuration())
return;
elseif self.Weapon:GetInSpecialReload() == 1 then
if self.Weapon:GetNextIdle() > CurTime() then return end
self.Weapon:SetInSpecialReload(2)
self.Weapon:EmitSound( self.ReloadSound )
self.Weapon:SetNextIdle( CurTime() + 0.7 )
self:SetNextPrimaryFire(CurTime() + 0.7)
self:SetNextSecondaryFire(CurTime() + 0.7)
elseif self.Weapon:GetInSpecialReload() == 2 then
if self.Weapon:GetNextIdle() > CurTime() then return end
-- Add them to the clip
local j = math.min( self:GetMaxClip1() - self:Clip1(), self.Owner:GetAmmoCount( self:GetPrimaryAmmoType() ) )
self:SetClip1( self:Clip1() + j )
self.Owner:RemoveAmmo( j, self:GetPrimaryAmmoType() )
self:SendWeaponAnim( ACT_VM_DRAW )
self.Weapon:SetNextIdle( CurTime() + self:ViewModelSequenceDuration() )
self:SetNextPrimaryFire(CurTime() + self:ViewModelSequenceDuration() )
self:SetNextSecondaryFire(CurTime() + self:ViewModelSequenceDuration() )
self.Weapon:SetInSpecialReload(0)
end
end
--[[---------------------------------------------------------
Play weapon idle animation.
-----------------------------------------------------------]]
function SWEP:WeaponIdle()
if !self:CanIdle() then return end
if ( self.Weapon:Clip1() == 0 && self.Weapon:GetInSpecialReload() == 0 && self.Owner:GetAmmoCount( self:GetPrimaryAmmoType() ) > 0 ) then
self:Reload()
elseif self.Weapon:GetInSpecialReload() != 0 then
self:Reload()
else
self:SendWeaponAnim( ACT_VM_IDLE )
self.Weapon:SetNextIdle( CurTime() + self:ViewModelSequenceDuration() )
end
end
--[[---------------------------------------------------------
This method returns the shell eject offset.
@return A vector reprensenting the shell eject offset.
-----------------------------------------------------------]]
function SWEP:GetShellEjectOffset()
return Vector( 20, 8, -12 )
end
--[[---------------------------------------------------------
Start spinning down chaingun cannon.
-----------------------------------------------------------]]
function SWEP:Spindown()
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK_2 )
self.Weapon:SetInAttack( AttackStates.Spindown )
self:SetNextPrimaryFire( CurTime() + self:ViewModelSequenceDuration() )
self.Weapon:StopSound( self.SpinSound )
self.Weapon:StopSound( self.ShootSound )
self.Weapon:EmitSound( self.SpindownSound )
self:RestoreOwnerSpeed()
end
--[[---------------------------------------------------------
Start spinning up chaingun cannon.
-----------------------------------------------------------]]
function SWEP:Spinup()
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK_1 )
self.Weapon:SetInAttack( AttackStates.Spinup )
self:SetNextPrimaryFire( CurTime() + self:ViewModelSequenceDuration() )
self.Weapon:EmitSound( self.SpinupSound )
self:CheckOwnerSpeed()
self:SlowOwnerDown()
end
--[[---------------------------------------------------------
Called every frame.
Spin chaingun cannon.
-----------------------------------------------------------]]
function SWEP:Spin()
self:DoFire()
if self:IsViewModelSequenceFinished() then
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK_3 )
end
self.Weapon:SetInAttack( AttackStates.Spin )
self.Weapon:StopSound( self.SpinupSound )
if self.Weapon:GetNextSpinSound() <= CurTime() then
self.Weapon:EmitSound( self.SpinSound )
self.Weapon:SetNextSpinSound( CurTime() + SoundDuration( self.SpinSound ) )
end
end
--[[---------------------------------------------------------
Shoot a bullet.
-----------------------------------------------------------]]
function SWEP:DoFire()
local owner = self.Owner
if !IsValid( owner ) then return end
if self.Weapon:GetNextAmmoDrain() > CurTime() then return end
self.Weapon:SetNextAmmoDrain( CurTime() + self.AmmoDrainRate )
-- Do a muzzleflash effect.
self:MuzzleEffect()
local bullet = {}
bullet.Num = 4
bullet.Src = owner:GetShootPos()
bullet.Dir = owner:GetAimVector()
bullet.Spread = VECTOR_CONE_10DEGREES
bullet.Tracer = 0
bullet.Force = 1
bullet.Damage = chaingun_damage:GetFloat()
bullet.AmmoType = self:GetPrimaryAmmoType()
owner:FireBullets( bullet )
self:DefaultShellEject()
self:TakePrimaryAmmo( 2 )
owner:SetAnimation( PLAYER_ATTACK1 )
owner:DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY )
-- Kick the player's view angles.
owner:ViewPunch( Angle( RandomFloat( -0.1, 0.1 ), RandomFloat( -0.1, 0.1 ), 0 ) )
self.Weapon:EmitSound( self.ShootSound )
end
--[[---------------------------------------------------------
Stop all weapons sounds.
-----------------------------------------------------------]]
function SWEP:StopLoopingSounds()
self.Weapon:StopSound( self.ShootSound )
self.Weapon:StopSound( self.SpindownSound )
self.Weapon:StopSound( self.SpinSound )
self.Weapon:StopSound( self.SpinupSound )
end
--[[---------------------------------------------------------
Reset weapon state variables.
-----------------------------------------------------------]]
function SWEP:ResetWeaponStates()
self.Weapon:SetInAttack( AttackStates.None )
end
--[[---------------------------------------------------------
This method is used to either slowdown or restore
the owner's original speed before/after firing.
-----------------------------------------------------------]]
function SWEP:CheckOwnerSpeed()
local owner = self.Owner
if !IsValid( owner ) then return end
if self.Weapon:GetOriginalOwnerRunSpeed() == -1 then
self.Weapon:SetOriginalOwnerRunSpeed( self.Owner:GetRunSpeed() )
end
if self.Weapon:GetOriginalOwnerWalkSpeed() == -1 then
self.Weapon:SetOriginalOwnerWalkSpeed( self.Owner:GetWalkSpeed() )
end
end
--[[---------------------------------------------------------
Reduce owner's speed.
-----------------------------------------------------------]]
function SWEP:SlowOwnerDown()
local owner = self.Owner
if !IsValid( owner ) then return end
local runspeed = self.Weapon:GetOriginalOwnerRunSpeed()
local walkspeed = self.Weapon:GetOriginalOwnerWalkSpeed()
--[[
It is possible that the walk/run speed are different.
Therefore, calculate the ratio between the two speeds and
adjust each other in consequence.
This gives the illusion of a single move speed.
--]]
local speedRadio
if runspeed > walkspeed then
speedRadio = runspeed / walkspeed
owner:SetRunSpeed( runspeed * self.OwnerSpeedScale )
owner:SetWalkSpeed( walkspeed * self.OwnerSpeedScale * speedRadio )
else
speedRadio = walkspeed / runspeed
owner:SetRunSpeed( runspeed * self.OwnerSpeedScale * speedRadio )
owner:SetWalkSpeed( walkspeed * self.OwnerSpeedScale )
end
end
--[[---------------------------------------------------------
Restore owner's speed to it's original value.
-----------------------------------------------------------]]
function SWEP:RestoreOwnerSpeed()
local owner = self.Owner
if !IsValid( owner ) then return end
-- Restore original owner speed.
owner:SetRunSpeed( self.Weapon:GetOriginalOwnerRunSpeed() )
owner:SetWalkSpeed( self.Weapon:GetOriginalOwnerWalkSpeed() )
end
--[[---------------------------------------------------------
Check if the cannon is at rest.
@return true if the cannon is at rest.
@return false otherwise.
-----------------------------------------------------------]]
function SWEP:CannonIsAtRest() return self.Weapon:GetInAttack() == AttackStates.None end
--[[---------------------------------------------------------
Check if the cannon is spinning down.
@return true if the cannon is spinning down.
@return false otherwise.
-----------------------------------------------------------]]
function SWEP:CannonHasSpinDown() return self.Weapon:GetInAttack() == AttackStates.Spindown end
--[[---------------------------------------------------------
Check if the cannon is spinning up.
@return true if the cannon is spinning up.
@return false otherwise.
-----------------------------------------------------------]]
function SWEP:CannonHasSpinUp() return self.Weapon:GetInAttack() == AttackStates.Spinup end
--[[---------------------------------------------------------
Check if the cannon is spinning.
@return true if the cannon is spinning.
@return false otherwise.
-----------------------------------------------------------]]
function SWEP:CannonIsSpinning() return self.Weapon:GetInAttack() == AttackStates.Spin end
--[[---------------------------------------------------------
Called every frame. Update the chaingun cannon.
-----------------------------------------------------------]]
function SWEP:UpdateWeaponCannon()
local owner = self.Owner
if !IsValid( owner ) then return false end
if !self:CannonIsAtRest() && self:GetNextPrimaryFire() <= CurTime() then
if !owner:KeyDown( IN_ATTACK ) then
if self:CannonHasSpinUp() || self:CannonIsSpinning() then
self:Spindown()
end
end
if self:CannonHasSpinDown() then
self:ResetWeaponStates()
end
end
end
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/loach_slop.lua | 35 | 1529 | -----------------------------------------
-- ID: 5669
-- Item: loach_slop
-- Food Effect: 3Hour,Group Food, All Races
-----------------------------------------
-- Accuracy % 7
-- Accuracy Cap 15
-- HP % 7
-- HP Cap 15
-- Evasion 3
-- (Did Not Add Group Food Effect)
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,10800,5669);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_ACCP, 7);
target:addMod(MOD_FOOD_ACC_CAP, 15);
target:addMod(MOD_FOOD_HPP, 7);
target:addMod(MOD_FOOD_HP_CAP, 15);
target:addMod(MOD_EVA, 3);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_ACCP, 7);
target:delMod(MOD_FOOD_ACC_CAP, 15);
target:delMod(MOD_FOOD_HPP, 7);
target:delMod(MOD_FOOD_HP_CAP, 15);
target:delMod(MOD_EVA, 3);
end;
| gpl-3.0 |
slawekb/domoticz-scripts | script_time_thermostat.lua | 1 | 4828 | -- A thermostat script that I use to control my gas boiler. It uses data
-- from a 433,92MHz temperature sensor and a few other inputs to regulate temperature
-- It is based on a script by Martin Rourke:
-----------------------------------------------------------------------------------------------
-- Heating Control
-- Version 0.4.1
-- Author - Martin Rourke
-- This library is free software: you can redistribute it and/or modify it under the terms of
-- the GNU Lesser General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This library 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 Lesser General
-- Public License for more details. You should have received a copy of the GNU Lesser General
-- Public License along with this library. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------------------------
-- Set basic variables
local threshold_low = 0.2 -- How much temperature has to drop below setpoint before heating turns on
local threshold_high = 0.0 -- How much temperature has to raise above setpoint before heating turns off
local sensor = 'Temp: Pokój' -- Sensor to derive room temperature
local switch = 'Ogrzewanie: Kocioł' -- Physical switch to operate (boiler switch)
local mode = 'Ogrzewanie: Dzień/Noc' -- Day/Night mode switch
local override = 'Ogrzewanie: Suszenie' -- Override - always on
-- Thermostats to use for day, night and holiday temperature setting
local thermostat_day = 'Termostat: Dzień' -- Day
local thermostat_night = 'Termostat: Noc' -- Night
local thermostat_holiday = 'Termostat: Wakacje' -- Holidays
local thermostat_select = thermostat_night -- Default thermostat
local presence = 'Ogólne: Obecność' -- Presence indicator switch
local holiday = 'Ogólne: Wakacje' -- Holiday indicator switch
local command = 'Off' -- Default command
local minupdateint = 60 -- Minimum time interval between switch operations to avoid switching device too often
local retransmit = 900 -- Retransmit command minimum interval (failsafe for switches that do not report status)
function timedifference (s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
function debuglog (s)
if uservariables["Debug"] == 1 then print("THERMOSTAT: " .. s) end
return true
end
function getsetpoint()
local setpoint
-- Select correct thermostat setting based on holiday and presence
-- Could use more variables like time of day, day of week, etc.
if (otherdevices[holiday] == 'On') then
debuglog ('Holiday')
thermostat_select = thermostat_holiday
elseif (otherdevices[mode] == 'On') then
debuglog ('Heating mode: day')
thermostat_select = thermostat_day
else
debuglog ('Heating mode: night')
thermostat_select = thermostat_night
end
setpoint = otherdevices_svalues[thermostat_select]
debuglog ('Selected setting: '.. thermostat_select)
return setpoint
end
function updatedevice(cmd)
-- Transmits new command if different from current status and time 'minupdateint' since last update has elapsed
-- If command is the same as current status, retransmit the same command if time 'retransmit' interval has elapsed
if (otherdevices[switch] == cmd and timedifference(otherdevices_lastupdate[switch]) > retransmit) then
debuglog ('Retransmitting: ' .. cmd)
commandArray[switch] = cmd
elseif ( otherdevices[switch] ~= cmd and timedifference(otherdevices_lastupdate[switch]) > minupdateint) then
debuglog ('Transmit new command: ' .. cmd)
commandArray[switch] = cmd
else
debuglog ('Transmission time not reached')
end
end
commandArray = {}
-- Get current room temperature
local temperature = tonumber(string.gmatch(otherdevices_svalues[sensor], '([^;]+)')(1))
-- Get requested room temperature (thermostat setpoint)
local settemp = getsetpoint()
debuglog ('Actual temp: '.. temperature)
debuglog ('Setpoint :' .. settemp)
-- Decide whether to turn the heating on or off
if (temperature < (settemp - threshold_low)) then
debuglog ('Temperature low, heating on')
updatedevice('On')
elseif (otherdevices[override] == 'On') then
debuglog ('Override on, heating on')
updatedevice('On')
elseif (temperature > (settemp + threshold_high)) then
debuglog ('Temperature high, heating off')
updatedevice('Off')
else
debuglog ('No need to do anything')
end
return commandArray
| gpl-3.0 |
vanish87/skia | tools/lua/glyph-counts.lua | 91 | 2733 | function tostr(t)
local str = ""
for k, v in next, t do
if #str > 0 then
str = str .. ", "
end
if type(k) == "number" then
str = str .. "[" .. k .. "] = "
else
str = str .. tostring(k) .. " = "
end
if type(v) == "table" then
str = str .. "{ " .. tostr(v) .. " }"
else
str = str .. tostring(v)
end
end
return str
end
local canvas -- holds the current canvas (from startcanvas())
--[[
startcanvas() is called at the start of each picture file, passing the
canvas that we will be drawing into, and the name of the file.
Following this call, there will be some number of calls to accumulate(t)
where t is a table of parameters that were passed to that draw-op.
t.verb is a string holding the name of the draw-op (e.g. "drawRect")
when a given picture is done, we call endcanvas(canvas, fileName)
]]
function sk_scrape_startcanvas(c, fileName)
canvas = c
end
--[[
Called when the current canvas is done drawing.
]]
function sk_scrape_endcanvas(c, fileName)
canvas = nil
end
--[[
Called with the parameters to each canvas.draw call, where canvas is the
current canvas as set by startcanvas()
]]
local gCounts = {} -- [fontID_pointsize] = [] unique glyphs
local gFirstGlyphs = {}
local gTotalCount = 0
function array_count(array)
local n = 0
for k in next, array do
n = n + 1
end
return n
end
function sk_scrape_accumulate(t)
verb = t.verb;
if verb == "drawPosText" or verb == "drawPosTextH" then
if t.glyphs then
local key = array_count(t.glyphs)
local n = gCounts[key]
if n then
gCounts[key] = n + 1
else
gCounts[key] = 1
end
if key == 1 then
local first = t.glyphs[1];
local n = gFirstGlyphs[first]
if n then
n = n + 1
else
n = 0
end
gFirstGlyphs[first] = n
end
gTotalCount = gTotalCount + 1
end
end
end
--[[
lua_pictures will call this function after all of the pictures have been
"accumulated".
]]
function sk_scrape_summarize()
for k, v in next, gCounts do
io.write("glyph_count ", k, ",frequency ", v * 100 / gTotalCount, "\n")
end
--[[
io.write("\n\nFirst glyph spread\n\n")
for k, v in next, gFirstGlyphs do
io.write("glyph, ", k, ",count, ", v, "\n")
end
]]
end
function test_summary()
io.write("just testing test_summary\n")
end
| bsd-3-clause |
hamed9898/maxbot | plugins/channels.lua | 356 | 1732 | -- Checks if bot was disabled on specific chat
local function is_channel_disabled( receiver )
if not _config.disabled_channels then
return false
end
if _config.disabled_channels[receiver] == nil then
return false
end
return _config.disabled_channels[receiver]
end
local function enable_channel(receiver)
if not _config.disabled_channels then
_config.disabled_channels = {}
end
if _config.disabled_channels[receiver] == nil then
return 'Channel isn\'t disabled'
end
_config.disabled_channels[receiver] = false
save_config()
return "Channel re-enabled"
end
local function disable_channel( receiver )
if not _config.disabled_channels then
_config.disabled_channels = {}
end
_config.disabled_channels[receiver] = true
save_config()
return "Channel disabled"
end
local function pre_process(msg)
local receiver = get_receiver(msg)
-- If sender is moderator then re-enable the channel
--if is_sudo(msg) then
if is_momod(msg) then
if msg.text == "!channel enable" then
enable_channel(receiver)
end
end
if is_channel_disabled(receiver) then
msg.text = ""
end
return msg
end
local function run(msg, matches)
local receiver = get_receiver(msg)
-- Enable a channel
if matches[1] == 'enable' then
return enable_channel(receiver)
end
-- Disable a channel
if matches[1] == 'disable' then
return disable_channel(receiver)
end
end
return {
description = "Plugin to manage channels. Enable or disable channel.",
usage = {
"!channel enable: enable current channel",
"!channel disable: disable current channel" },
patterns = {
"^!channel? (enable)",
"^!channel? (disable)" },
run = run,
--privileged = true,
moderated = true,
pre_process = pre_process
}
| gpl-2.0 |
nesstea/darkstar | scripts/globals/settings.lua | 4 | 11935 | -----------------------------------------------
------------- GLOBAL SETTINGS -------------
-----------------------------------------------
-- This is to allow server operators to further customize their servers. As more features are added to pXI, the list will surely expand.
-- Anything scripted can be customized with proper script editing.
-- PLEASE REQUIRE THIS SCRIPT IN ANY SCRIPTS YOU DO: ADD THIS LINE TO THE TOP!!!!
-- require("scripts/globals/settings");
-- With this script added to yours, you can pull variables from it!!
-- Always include status.lua, which defines mods
-- require("scripts/globals/status");
-- Common functions
require("scripts/globals/common");
-- Enable Extension (1= yes 0= no)
ENABLE_COP = 0;
ENABLE_TOAU = 0;
ENABLE_WOTG = 0;
ENABLE_ACP = 0;
ENABLE_AMK = 0;
ENABLE_ASA = 0;
ENABLE_ABYSSEA = 0;
ENABLE_SOA = 0;
ENABLE_ROV = 0;
-- Setting to lock content more accurately to the expansions you have defined above
-- This generally results in a more accurate presentation of your selected expansions
-- as well as a less confusing player experience for things that are disabled (things that are disabled are not loaded)
-- This feature correlates to the required_expansion column in the SQL files
RESTRICT_BY_EXPANSION = 0;
-- CHARACTER CONFIG
INITIAL_LEVEL_CAP = 50; -- The initial level cap for new players. There seems to be a hardcap of 255.
MAX_LEVEL = 75; -- Level max of the server, lowers the attainable cap by disabling Limit Break quests.
NORMAL_MOB_MAX_LEVEL_RANGE_MIN = 81; -- Lower Bound of Max Level Range for Normal Mobs (0 = Uncapped)
NORMAL_MOB_MAX_LEVEL_RANGE_MAX = 84; -- Upper Bound of Max Level Range for Normal Mobs (0 = Uncapped)
START_GIL = 10; --Amount of gil given to newly created characters.
START_INVENTORY = 30; -- Starting inventory and satchel size. Ignores values < 30. Do not set above 80!
OPENING_CUTSCENE_ENABLE = 0; --Set to 1 to enable opening cutscenes, 0 to disable.
SUBJOB_QUEST_LEVEL = 18; -- Minimum level to accept either subjob quest. Set to 0 to start the game with subjobs unlocked.
ADVANCED_JOB_LEVEL = 30; -- Minimum level to accept advanced job quests. Set to 0 to start the game with advanced jobs.
ALL_MAPS = 0; -- Set to 1 to give starting characters all the maps.
UNLOCK_OUTPOST_WARPS = 0; -- Set to 1 to give starting characters all outpost warps. 2 to add Tu'Lia and Tavnazia.
SHOP_PRICE = 1.000; -- Multiplies prices in NPC shops.
GIL_RATE = 1.000; -- Multiplies gil earned from quests. Won't always display in game.
EXP_RATE = 1.000; -- Multiplies exp earned from fov.
TABS_RATE = 1.000; -- Multiplies tabs earned from fov.
CURE_POWER = 1.000; -- Multiplies amount healed from Healing Magic, including the relevant Blue Magic.
ELEMENTAL_POWER = 1.000; -- Multiplies damage dealt by Elemental and non-drain Dark Magic.
DIVINE_POWER = 1.000; -- Multiplies damage dealt by Divine Magic.
NINJUTSU_POWER = 1.000; -- Multiplies damage dealt by Ninjutsu Magic.
BLUE_POWER = 1.000; -- Multiplies damage dealt by Blue Magic.
DARK_POWER = 1.000; -- Multiplies amount drained by Dark Magic.
ITEM_POWER = 1.000; -- Multiplies the effect of items such as Potions and Ethers.
WEAPON_SKILL_POWER = 1.000; -- Multiplies damage dealt by Weapon Skills.
WEAPON_SKILL_POINTS = 1.000; -- Multiplies points earned during weapon unlocking.
USE_ADOULIN_WEAPON_SKILL_CHANGES = false; -- true/false. Change to toggle new Adoulin weapon skill damage calculations
HARVESTING_BREAK_CHANCE = 0.33; -- % chance for the sickle to break during harvesting. Set between 0 and 1.
EXCAVATION_BREAK_CHANCE = 0.33; -- % chance for the pickaxe to break during excavation. Set between 0 and 1.
LOGGING_BREAK_CHANCE = 0.33; -- % chance for the hatchet to break during logging. Set between 0 and 1.
MINING_BREAK_CHANCE = 33; -- % chance for the pickaxe to break during mining. Set between 0 and 100.
HARVESTING_RATE = 0.50; -- % chance to recieve an item from haresting. Set between 0 and 1.
EXCAVATION_RATE = 0.50; -- % chance to recieve an item from excavation. Set between 0 and 1.
LOGGING_RATE = 0.50; -- % chance to recieve an item from logging. Set between 0 and 1.
MINING_RATE = 50; -- % chance to recieve an item from mining. Set between 0 and 100.
-- SE implemented coffer/chest illusion time in order to prevent coffer farming. No-one in the same area can open a chest or coffer for loot (gil, gems & items)
-- till a random time between MIN_ILLSION_TIME and MAX_ILLUSION_TIME. During this time players can loot keyitem and item related to quests (AF, maps... etc.)
COFFER_MAX_ILLUSION_TIME = 3600; -- 1 hour
COFFER_MIN_ILLUSION_TIME = 1800; -- 30 minutes
CHEST_MAX_ILLUSION_TIME = 3600; -- 1 hour
CHEST_MIN_ILLUSION_TIME = 1800; -- 30 minutes
-- Sets spawn type for: Behemoth, Fafnir, Adamantoise, King Behemoth, Nidhog, Aspidochelone.
-- Use 0 for timed spawns, 1 for force pop only, 2 for both
LandKingSystem_NQ = 0;
LandKingSystem_HQ = 0;
-- DYNAMIS SETTINGS
BETWEEN_2DYNA_WAIT_TIME = 1; -- wait time between 2 Dynamis (in real day) min: 1 day
DYNA_MIDNIGHT_RESET = true; -- if true, makes the wait time count by number of server midnights instead of full 24 hour intervals
DYNA_LEVEL_MIN = 65; -- level min for entering in Dynamis
TIMELESS_HOURGLASS_COST = 500000; -- cost of the timeless hourglass for Dynamis.
CURRENCY_EXCHANGE_RATE = 100; -- X Tier 1 ancient currency -> 1 Tier 2, and so on. Certain values may conflict with shop items. Not designed to exceed 198.
RELIC_2ND_UPGRADE_WAIT_TIME = 604800; -- wait time for 2nd relic upgrade (stage 2 -> stage 3) in seconds. 604800s = 1 RL week.
RELIC_3RD_UPGRADE_WAIT_TIME = 295200; -- wait time for 3rd relic upgrade (stage 3 -> stage 4) in seconds. 295200s = 82 hours.
FREE_COP_DYNAMIS = 1 ; -- Authorize player to entering inside COP Dynamis without completing COP mission ( 1 = enable 0= disable)
-- QUEST/MISSION SPECIFIC SETTINGS
WSNM_LEVEL = 70; -- Min Level to get WSNM Quests
WSNM_SKILL_LEVEL = 240;
AF1_QUEST_LEVEL = 40; -- Minimum level to start AF1 quest
AF2_QUEST_LEVEL = 50; -- Minimum level to start AF2 quest
AF3_QUEST_LEVEL = 50; -- Minimum level to start AF3 quest
AF1_FAME = 20; -- base fame for completing an AF1 quest
AF2_FAME = 40; -- base fame for completing an AF2 quest
AF3_FAME = 60; -- base fame for completing an AF3 quest
DEBUG_MODE = 0; -- Set to 1 to activate auto-warping to the next location (only supported by certain missions / quests).
QM_RESET_TIME = 300; -- Default time (in seconds) you have from killing ???-pop mission NMs to click again and get key item, until ??? resets.
OldSchoolG1 = false; -- Set to true to require farming Exoray Mold, Bombd Coal, and Ancient Papyrus drops instead of allowing key item method.
OldSchoolG2 = false; -- Set true to require the NMs for "Atop the Highest Mountains" be dead to get KI like before SE changed it.
FrigiciteDuration = 30; -- When OldSChoolG2 is enabled, this is the time (in seconds) you have from killing Boreal NMs to click the "???" target.
-- FIELDS OF VALOR/Grounds of Valor SETTINGS
REGIME_WAIT = 1; --Make people wait till 00:00 game time as in retail. If it's 0, there is no wait time.
FIELD_MANUALS = 1; -- Enables Fields of Valor manuals
LOW_LEVEL_REGIME = 0; --Allow people to kill regime targets even if they give no exp, allowing people to farm regime targets at 75 in low level areas.
GROUNDS_TOMES = 1; -- Enables Grounds of Valor tomes
-- JOB ABILITY/TRAIT SPECIFIC SETTINGS
CIRCLE_KILLER_EFFECT = 20; -- Intimidation percentage granted by circle effects. (made up number)
KILLER_EFFECT = 10; -- Intimidation percentage from killer job traits.
-- SPELL SPECIFIC SETTINGS
DIA_OVERWRITE = 1; --Set to 1 to allow Bio to overwrite same tier Dia. Default is 1.
BIO_OVERWRITE = 0; --Set to 1 to allow Dia to overwrite same tier Bio. Default is 0.
BARELEMENT_OVERWRITE = 1; --Set to 1 to allow Barelement spells to overwrite each other (prevent stacking). Default is 1.
BARSTATUS_OVERWRITE = 1; --Set to 1 to allow Barstatus spells to overwrite each other (prevent stacking). Default is 1.
STONESKIN_CAP = 350; -- soft cap for hp absorbed by stoneskin
BLINK_SHADOWS = 2; -- number of shadows supplied by Blink spell
ENSPELL_DURATION = 180; -- duration of RDM en-spells
SPIKE_EFFECT_DURATION = 180; -- the duration of RDM, BLM spikes effects (not Reprisal)
ELEMENTAL_DEBUFF_DURATION = 120; -- base duration of elemental debuffs
AQUAVEIL_COUNTER = 1; -- Base amount of hits Aquaveil absorbs to prevent spell interrupts. Retail is 1.
ABSORB_SPELL_AMOUNT = 8; -- how much of a stat gets absorbed by DRK absorb spells - expected to be a multiple of 8.
ABSORB_SPELL_TICK = 9; -- duration of 1 absorb spell tick
SNEAK_INVIS_DURATION_MULTIPLIER = 1; -- multiplies duration of sneak,invis,deodorize to reduce player torture. 1 = retail behavior.
USE_OLD_CURE_FORMULA = false; -- true/false. if true, uses older cure formula (3*MND + VIT + 3*(healing skill/5)) // cure 6 will use the newer formula
-- CELEBRATIONS
EXPLORER_MOOGLE = 1; -- Enables Explorer Moogle teleports
EXPLORER_MOOGLE_LEVELCAP = 10;
JINX_MODE_2005 = 0; -- Set to 1 to give starting characters swimsuits from 2005. Ex: Hume Top
JINX_MODE_2008 = 0; -- Set to 1 to give starting characters swimsuits from 2008. Ex: Custom Top
JINX_MODE_2012 = 0; -- Set to 1 to give starting characters swimsuits from 2012. Ex: Marine Top
SUMMERFEST_2004 = 0; -- Set to 1 to give starting characters Far East dress from 2004. Ex: Onoko Yukata
SUNBREEZE_2009 = 0; -- Set to 1 to give starting characters Far East dress from 2009. Ex: Otokogusa Yukata
SUNBREEZE_2011 = 0; -- Set to 1 to give starting characters Far East dress from 2011. Ex: Hikogami Yukata
CHRISTMAS = 0; -- Set to 1 to give starting characters Christmas dress.
HALLOWEEN = 0; -- Set to 1 to give starting characters Halloween items (Does not start event).
HALLOWEEN_2005 = 0; -- Set to 1 to Enable the 2005 version of Harvest Festival, will start on Oct. 20 and end Nov. 1.
HALLOWEEN_YEAR_ROUND = 0; -- Set to 1 to have Harvest Festival initialize outside of normal times.
-- MISC
HOMEPOINT_HEAL = 0; --Set to 1 if you want Home Points to heal you like in single-player Final Fantasy games.
RIVERNE_PORTERS = 120; -- Time in seconds that Unstable Displacements in Cape Riverne stay open after trading a scale.
LANTERNS_STAY_LIT = 1200; -- time in seconds that lanterns in the Den of Rancor stay lit.
ENABLE_COP_ZONE_CAP=1; -- enable or disable lvl cap
TIMEZONE_OFFSET = 9.0; -- Offset from UTC used to determine when "JP Midnight" is for the server. Default is JST (+9.0).
ALLOW_MULTIPLE_EXP_RINGS = 0; -- Set to 1 to remove ownership restrictions on the Chariot/Empress/Emperor Band trio.
BYPASS_EXP_RING_ONE_PER_WEEK = 0; -- -- Set to 1 to bypass the limit of one ring per Conquest Tally Week.
NUMBER_OF_DM_EARRINGS = 1; -- Number of earrings players can simultaneously own from Divine Might before scripts start blocking them (Default: 1)
HOMEPOINT_TELEPORT = 0; -- Enables the homepoint teleport system
DIG_ABUNDANCE_BONUS = 0; -- Increase chance of digging up an item (450 = item digup chance +45)
DIG_FATIGUE = 1; -- Set to 0 to disable Dig Fatigue
MIASMA_FILTER_COOLDOWN = 5; -- Number of days a player can obtain a Miasma Filter KI for any of the Boneyard Gully ENMs (Minimum:1)
FORCE_SPAWN_QM_RESET_TIME = 300; -- Number of seconds the ??? remains hidden for after the despawning of the mob it force spawns.
-- LIMBUS
BETWEEN_2COSMOCLEANSE_WAIT_TIME = 3; -- day between 2 limbus keyitem (default 3 days)
DIMENSIONAL_PORTAL_UNLOCK = false; -- Set true to bypass requirements for using dimensional portals to reach sea for Limbus
-- ABYSSEA
VISITANT_BONUS = 1.00; -- Default: 1.00 - (retail) - Multiplies the base time value of each Traverser Stone. | gpl-3.0 |
nesstea/darkstar | scripts/zones/Port_San_dOria/npcs/Dabbio.lua | 13 | 1051 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Dabbio
-- Type: Standard NPC
-- @zone: 232
-- @pos -7.819 -15 -106.990
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x02d2);
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 |
nesstea/darkstar | scripts/globals/mobskills/Hydro_Canon.lua | 33 | 1323 | ---------------------------------------------------
-- Hydro_Canon
-- Description:
-- Type: Magical
-- additional effect : 40hp/tick Poison
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------------
function onMobSkillCheck(target,mob,skill)
-- skillList 54 = Omega
-- skillList 727 = Proto-Omega
-- skillList 728 = Ultima
-- skillList 729 = Proto-Ultima
local skillList = mob:getMobMod(MOBMOD_SKILL_LIST);
local mobhp = mob:getHPP();
local phase = mob:getLocalVar("battlePhase");
if ((skillList == 729 and phase >= 1 and phase <= 2) or (skillList == 728 and mobhp < 70 and mobhp >= 40)) then
return 0;
end
return 1;
end;
function onMobWeaponSkill(target, mob, skill)
local typeEffect = EFFECT_POISON;
local power = 40;
MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, power, 3, 60);
local dmgmod = 2;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*3,ELE_WATER,dmgmod,TP_MAB_BONUS,1);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_WATER,MOBPARAM_IGNORE_SHADOWS);
target:delHP(dmg);
return dmg;
end; | gpl-3.0 |
gabri94/packages-2 | net/acme/files/acme-cbi.lua | 27 | 2719 | --[[
LuCI - Lua Configuration Interface
Copyright 2016 Toke Høiland-Jørgensen <toke@toke.dk>
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
]]--
m = Map("acme", translate("ACME certificates"),
translate("This configures ACME (Letsencrypt) automatic certificate installation. " ..
"Simply fill out this to have the router configured with Letsencrypt-issued " ..
"certificates for the web interface. " ..
"Note that the domain names in the certificate must already be configured to " ..
"point at the router's public IP address. " ..
"Once configured, issuing certificates can take a while. " ..
"Check the logs for progress and any errors."))
s = m:section(TypedSection, "acme", translate("ACME global config"))
s.anonymous = true
st = s:option(Value, "state_dir", translate("State directory"),
translate("Where certs and other state files are kept."))
st.rmempty = false
st.datatype = "string"
ae = s:option(Value, "account_email", translate("Account email"),
translate("Email address to associate with account key."))
ae.rmempty = false
d = s:option(Flag, "debug", translate("Enable debug logging"))
d.rmempty = false
cs = m:section(TypedSection, "cert", translate("Certificate config"))
cs.anonymous = false
cs.addremove = true
e = cs:option(Flag, "enabled", translate("Enabled"))
e.rmempty = false
us = cs:option(Flag, "use_staging", translate("Use staging server"),
translate("Get certificate from the Letsencrypt staging server " ..
"(use for testing; the certificate won't be valid)."))
us.rmempty = false
kl = cs:option(Value, "keylength", translate("Key length"),
translate("Number of bits (minimum 2048)."))
kl.rmempty = false
kl.datatype = "and(uinteger,min(2048))"
u = cs:option(Flag, "update_uhttpd", translate("Use for uhttpd"),
translate("Update the uhttpd config with this certificate once issued " ..
"(only select this for one certificate)."))
u.rmempty = false
dom = cs:option(DynamicList, "domains", translate("Domain names"),
translate("Domain names to include in the certificate. " ..
"The first name will be the subject name, subsequent names will be alt names. " ..
"Note that all domain names must point at the router in the global DNS."))
dom.datatype = "list(string)"
return m
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/globals/spells/bluemagic/regeneration.lua | 9 | 1147 | -----------------------------------------
-- Spell: Regeneration
-- Gradually restores HP
-- Spell cost: 36 MP
-- Monster Type: Aquans
-- Spell Type: Magical (Light)
-- Blue Magic Points: 2
-- Stat Bonus: MND+2
-- Level: 78
-- Casting Time: 2 Seconds
-- Recast Time: 60 Seconds
-- Spell Duration: 30 ticks, 90 Seconds
--
-- Combos: None
-----------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
if(target:hasStatusEffect(EFFECT_REGEN) and target:getStatusEffect(EFFECT_REGEN):getTier() == 1) then
target:delStatusEffect(EFFECT_REGEN);
end
if(target:addStatusEffect(EFFECT_REGEN,10,3,90,0,0,0)) then
spell:setMsg(230);
else
spell:setMsg(75); -- no effect
end
return EFFECT_REGEN;
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Castle_Oztroja/npcs/Brass_Statue.lua | 19 | 1375 | -----------------------------------
-- Area: Castle Oztroja
-- NPC: Brass Statue
-- Type: Passageway Machine
-- @pos -60.061 -4.348 -61.538 151 (1)
-- @pos -18.599 -19.307 20.024 151 (2)
-- @pos -60 22 -100 151 (3)
-- @pos -100 -72 -19 151 (4)
-----------------------------------
package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Castle_Oztroja/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local Z = npc:getZPos();
if(Z < -15 and Z > -19) then
local DoorID = npc:getID() - 1;
local DoorA = GetNPCByID(DoorID):getAnimation();
if(DoorA == 9) then
GetNPCByID(DoorID):openDoor(6);
end
end
end;
--player:startEvent(0x000d); -- Password event
-----------------------------------
-- 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 |
UnfortunateFruit/darkstar | scripts/zones/Fort_Karugo-Narugo_[S]/npcs/Logging_Point.lua | 29 | 1128 | -----------------------------------
-- Area: Fort Karugo-Narugo [S]
-- NPC: Logging Point
-----------------------------------
package.loaded["scripts/zones/Fort_Karugo-Narugo_[S]/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/logging");
require("scripts/zones/Fort_Karugo-Narugo_[S]/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
startLogging(player,player:getZoneID(),npc,trade,0x0385);
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(LOGGING_IS_POSSIBLE_HERE,1021);
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 |
VurtualRuler98/kswep2-NWI | lua/ins_sounds/sounds_ppk.lua | 1 | 1600 | if (SERVER) then
AddCSLuaFile()
end
--ppk
sound.Add({
name="Weapon_ppk.Single",
volume = 1.0,
pitch = {100,105},
sound = "weapons/ppk/ppk_fp.wav",
level = 142,
channel = CHAN_STATIC
})
sound.Add({
name="Weapon_ppk.Magrelease",
volume = 0.2,
sound = "weapons/ppk/handling/ppk_magrelease.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.MagFetch",
volume = 0.3,
sound = "weapons/ppk/handling/ppk_fetchmag.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.Magin",
volume = 0.2,
sound = "weapons/ppk/handling/ppk_magin.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.Magout",
volume = 0.2,
sound = "weapons/ppk/handling/ppk_magout.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.MagHit",
volume = 0.2,
sound = "weapons/ppk/handling/ppk_maghit.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.Rattle",
volume = 0.2,
sound = "weapons/ppk/handling/ppk_rattle.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.Safety",
volume = 0.3,
sound = "weapons/ppk/handling/ppk_safety.wav",
level = 75,
channel = CHAN_STATIC
})
sound.Add({
name="Weapon_ppk.Boltback",
volume = 0.3,
sound = "weapons/ppk/handling/ppk_boltback.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="Weapon_ppk.Boltrelease",
volume = 0.3,
sound = "weapons/ppk/handling/ppk_boltrelease.wav",
level = 65,
channel = CHAN_ITEM
})
sound.Add({
name="weapon_ppk.Empty",
volume=0.2,
level=65,
sound="weapons/ppk/handling/ppk_empty.wav",
channel = CHAN_ITEM
})
| apache-2.0 |
nesstea/darkstar | scripts/globals/spells/bluemagic/sprout_smack.lua | 26 | 1859 | -----------------------------------------
-- Spell: Sprout Smack
-- Additional effect: Slow. Duration of effect varies with TP
-- Spell cost: 6 MP
-- Monster Type: Plantoids
-- Spell Type: Physical (Blunt)
-- Blue Magic Points: 2
-- Stat Bonus: MND+1
-- Level: 4
-- Casting Time: 0.5 seconds
-- Recast Time: 7.25 seconds
-- Skillchain property: Reverberation (can open Induration or Impaction)
-- Combos: Beast Killer
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local params = {};
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.tpmod = TPMOD_DURATION;
params.dmgtype = DMGTYPE_BLUNT;
params.scattr = SC_REVERBERATION;
params.numhits = 1;
params.multiplier = 1.5;
params.tp150 = 1.5;
params.tp300 = 1.5;
params.azuretp = 1.5;
params.duppercap = 11;
params.str_wsc = 0.0;
params.dex_wsc = 0.0;
params.vit_wsc = 0.3;
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);
if (target:hasStatusEffect(EFFECT_SLOW)) then
spell:setMsg(75); -- no effect
else
target:addStatusEffect(EFFECT_SLOW,15,0,20);
end
return damage;
end; | gpl-3.0 |
vonflynee/opencomputersserver | world/opencomputers/6d437cc7-8fe8-4147-8a29-4c8b62fcedc7/bin/ls.lua | 15 | 2632 | local component = require("component")
local fs = require("filesystem")
local shell = require("shell")
local text = require('text')
local dirs, options = shell.parse(...)
if #dirs == 0 then
table.insert(dirs, ".")
end
local function formatOutput()
return component.isAvailable("gpu") and io.output() == io.stdout
end
io.output():setvbuf("line")
for i = 1, #dirs do
local path = shell.resolve(dirs[i])
if #dirs > 1 then
if i > 1 then
io.write("\n")
end
io.write(path, ":\n")
end
local list, reason = fs.list(path)
if not list then
io.write(reason .. "\n")
else
local function setColor(c)
if formatOutput() and component.gpu.getForeground() ~= c then
io.stdout:flush()
component.gpu.setForeground(c)
end
end
local lsd = {}
local lsf = {}
local m = 1
for f in list do
m = math.max(m, f:len() + 2)
if f:sub(-1) == "/" then
if options.p then
table.insert(lsd, f)
else
table.insert(lsd, f:sub(1, -2))
end
else
table.insert(lsf, f)
end
end
table.sort(lsd)
table.sort(lsf)
setColor(0x66CCFF)
local col = 1
local columns = math.huge
if formatOutput() then
columns = math.max(1, math.floor((component.gpu.getResolution() - 1) / m))
end
for _, d in ipairs(lsd) do
if options.a or d:sub(1, 1) ~= "." then
if options.l or not formatOutput() or col % columns == 0 then
io.write(d .. "\n")
else
io.write(text.padRight(d, m))
end
col = col + 1
end
end
for _, f in ipairs(lsf) do
if fs.isLink(fs.concat(path, f)) then
setColor(0xFFAA00)
elseif f:sub(-4) == ".lua" then
setColor(0x00FF00)
else
setColor(0xFFFFFF)
end
if options.a or f:sub(1, 1) ~= "." then
if not formatOutput() then
io.write(f)
if options.l then
io.write(" " .. fs.size(fs.concat(path, f)))
end
io.write("\n")
else
io.write(text.padRight(f, m))
if options.l then
setColor(0xFFFFFF)
io.write(fs.size(fs.concat(path, f)), "\n")
elseif col % columns == 0 then
io.write("\n")
end
end
col = col + 1
end
end
setColor(0xFFFFFF)
if options.M then
io.write("\n" .. tostring(#lsf) .. " File(s)")
io.write("\n" .. tostring(#lsd) .. " Dir(s)")
end
if not options.l then
io.write("\n")
end
end
end
io.output():setvbuf("no")
io.output():flush()
| mit |
Spartan322/finalfrontier | gamemode/sgui/slider.lua | 2 | 4431 | -- Copyright (c) 2014 James King [metapyziks@gmail.com]
--
-- This file is part of Final Frontier.
--
-- Final Frontier is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as
-- published by the Free Software Foundation, either version 3 of
-- the License, or (at your option) any later version.
--
-- Final Frontier 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 Lesser General Public License
-- along with Final Frontier. If not, see <http://www.gnu.org/licenses/>.
local BASE = "base"
GUI.BaseName = BASE
GUI.CanClick = true
GUI.Margin = 4
GUI.Value = 0
GUI.Snap = 0.01
GUI.Font = "CTextSmall"
GUI.Color = Color(191, 191, 191, 255)
GUI.DisabledColor = Color(64, 64, 64, 255)
GUI.HighlightColorNeg = Color(0, 0, 0, 127)
GUI.HighlightColorPos = Color(191, 191, 191, 32)
GUI.TextColorNeg = Color(0, 0, 0, 255)
GUI.TextColorPos = GUI.Color
if SERVER then
function GUI:OnClick(x, y, button)
local oldValue = self.Value
self.Value = math.Clamp((x - self:GetLeft() - self.Margin) /
(self:GetWidth() - self.Margin * 2), 0, 1)
if self.Snap > 0 then
self.Value = math.Round(self.Value / self.Snap) * self.Snap
end
if self.Value ~= oldValue then
self:OnValueChanged(self.Value)
self:GetScreen():UpdateLayout()
end
return true
end
function GUI:OnValueChanged(value)
return
end
function GUI:UpdateLayout(layout)
self.Super[BASE].UpdateLayout(self, layout)
layout.value = self.Value
end
elseif CLIENT then
function GUI:GetValueText(value)
return tostring(math.Round(value * 100)) .. "%"
end
function GUI:DrawValueText(value)
local text = self:GetValueText(value)
surface.SetFont(self.Font)
local x, y, w, h = self:GetGlobalRect()
local a = x + self.Margin + (w - self.Margin * 2) * value
local wid, hei = surface.GetTextSize(text)
if value < 0 then
surface.SetTextColor(self.TextColorPos)
surface.SetTextPos(x + (w - wid) / 2, y + (h - hei) / 2)
elseif wid < a - x - self.Margin * 2 then
surface.SetTextColor(self.TextColorNeg)
surface.SetTextPos(a - self.Margin - wid, y + (h - hei) / 2)
elseif wid < self:GetGlobalRight() - a - self.Margin * 2 then
surface.SetTextColor(self.TextColorPos)
surface.SetTextPos(a + self.Margin, y + (h - hei) / 2)
end
surface.DrawText(text)
end
function GUI:Draw()
if self.CanClick then
surface.SetDrawColor(self.Color)
else
surface.SetDrawColor(self.DisabledColor)
end
local val = math.Clamp(self.Value, 0, 1)
local x, y, w, h = self:GetGlobalRect()
surface.DrawOutlinedRect(x, y, w, h)
surface.DrawRect(x + self.Margin, y + self.Margin,
(w - self.Margin * 2) * val, h - self.Margin * 2)
local a = x + self.Margin + (w - self.Margin * 2) * val
if self.CanClick and self:IsCursorInside() then
local cx = self:GetCursorPos() - self:GetLeft()
local value = math.Clamp((cx - self.Margin) /
(self:GetWidth() - self.Margin * 2), 0, 1)
if self.Snap > 0 then
value = math.Round(value / self.Snap) * self.Snap
end
local b = x + self.Margin + (w - self.Margin * 2) * value
if b >= a then
surface.SetDrawColor(self.HighlightColorPos)
surface.DrawRect(a, y + self.Margin, b - a,
h - self.Margin * 2)
else
surface.SetDrawColor(self.HighlightColorNeg)
surface.DrawRect(b, y + self.Margin, a - b,
h - self.Margin * 2)
end
self:DrawValueText(value)
else
self:DrawValueText(self.Value)
end
self.Super[BASE].Draw(self)
end
function GUI:UpdateLayout(layout)
self.Value = layout.value
self.Super[BASE].UpdateLayout(self, layout)
end
end
| lgpl-3.0 |
Olipro/Payday-2-BLT_Club-Sandwich-Edition | mods/base/req/download_progress_dialog.lua | 2 | 3355 |
local LuaModUpdates = _G.LuaModUpdates
core:module("SystemMenuManager")
require("lib/managers/dialogs/GenericDialog")
DownloadProgressDialog = DownloadProgressDialog or class(GenericDialog)
function DownloadProgressDialog:init(manager, data, is_title_outside)
Dialog.init(self, manager, data)
if not self._data.focus_button then
if #self._button_text_list > 0 then
self._data.focus_button = #self._button_text_list
else
self._data.focus_button = 1
end
end
self._ws = self._data.ws or manager:_get_ws()
local text_config = {
title_font = data.title_font,
title_font_size = data.title_font_size,
font = data.font,
font_size = data.font_size,
w = data.w or 420,
h = data.h or 400,
no_close_legend = true,
no_scroll_legend = true,
use_indicator = data.indicator or data.no_buttons,
is_title_outside = is_title_outside,
use_text_formating = data.use_text_formating,
text_formating_color = data.text_formating_color,
text_formating_color_table = data.text_formating_color_table,
text_blend_mode = data.text_blend_mode
}
self._panel_script = _G.DownloadProgressBoxGui:new(self._ws, self._data.title or "", self._data.text or "", self._data, text_config)
self._panel_script:add_background()
self._panel_script:set_layer(_G.tweak_data.gui.DIALOG_LAYER)
self._panel_script:set_centered()
self._panel_script:set_fade(0)
self._controller = self._data.controller or manager:_get_controller()
self._confirm_func = callback(self, self, "button_pressed_callback")
self._cancel_func = callback(self, self, "dialog_cancel_callback")
self._resolution_changed_callback = callback(self, self, "resolution_changed_callback")
managers.viewport:add_resolution_changed_func(self._resolution_changed_callback)
if data.counter then
self._counter = data.counter
self._counter_time = self._counter[1]
end
self._sound_event = data.sound_event
LuaModUpdates:RegisterDownloadDialog( self )
end
function DownloadProgressDialog:button_pressed_callback()
self._download_complete = self._panel_script:chk_close()
if self._download_complete then
DownloadProgressDialog.super.button_pressed_callback(self)
end
end
function DownloadProgressDialog:dialog_cancel_callback()
self._download_complete = self._panel_script:chk_close()
if self._download_complete then
DownloadProgressDialog.super.dialog_cancel_callback(self)
end
end
function DownloadProgressDialog:fade_in()
DownloadProgressDialog.super.fade_in(self)
self._start_sound_t = self._sound_event and TimerManager:main():time() + 0.2
end
function DownloadProgressDialog:update(t, dt)
DownloadProgressDialog.super.update(self, t, dt)
if self._start_sound_t and t > self._start_sound_t then
managers.menu_component:post_event(self._sound_event)
self._start_sound_t = nil
end
end
function DownloadProgressDialog:fade_out_close()
self._download_complete = self._panel_script:chk_close()
if self._download_complete then
self:fade_out()
end
managers.menu:post_event("prompt_exit")
end
function DownloadProgressDialog:remove_mouse()
if not self._download_complete then
return
end
if not self._removed_mouse then
self._removed_mouse = true
if managers.controller:get_default_wrapper_type() == "pc" then
managers.mouse_pointer:remove_mouse(self._mouse_id)
else
managers.mouse_pointer:enable()
end
self._mouse_id = nil
end
end
| mit |
nesstea/darkstar | scripts/globals/abilities/konzen-ittai.lua | 27 | 1660 | -----------------------------------
-- Ability: Konzen-Ittai
-- Readies target for a skillchain.
-- Obtained: Samurai Level 65
-- Recast Time: 0:03:00
-- Duration: 1:00 or until next Weapon Skill
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/weaponskills");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if (player:getAnimation() ~= 1) then
return MSGBASIC_REQUIRES_COMBAT,0;
else
return 0,0;
end
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability,action)
if (not target:hasStatusEffect(EFFECT_CHAINBOUND, 0) and not target:hasStatusEffect(EFFECT_SKILLCHAIN, 0)) then
target:addStatusEffectEx(EFFECT_CHAINBOUND, 0, 2, 0, 5, 0, 1);
else
ability:setMsg(156);
end
local skill = player:getWeaponSkillType(SLOT_MAIN);
local anim = 36;
if skill <= 1 then
anim = 37;
elseif skill <= 3 then
anim = 36;
elseif skill == 4 then
anim = 41;
elseif skill == 5 then
anim = 28;
elseif skill <= 7 then
anim = 40;
elseif skill == 8 then
anim = 42;
elseif skill == 9 then
anim = 43;
elseif skill == 10 then
anim = 44;
elseif skill == 11 then
anim = 39;
elseif skill == 12 then
anim = 45;
else
anim = 36;
end
action:animation(target:getID(), anim)
action:speceffect(target:getID(), 1)
return 0
end;
| gpl-3.0 |
0xd4d/iced | src/rust/iced-x86-lua/lua/types/iced_x86/MemorySizeInfo.lua | 1 | 6064 | -- SPDX-License-Identifier: MIT
-- Copyright (C) 2018-present iced project and contributors
-- ⚠️This file was generated by GENERATOR!🦹♂️
---@meta
---@diagnostic disable unused-local
---`MemorySize` enum info, see also `MemorySizeExt`
---
---@class MemorySizeInfo
local MemorySizeInfo = {}
---`MemorySize` enum info, see also `MemorySizeExt`
---
---@param memory_size integer #(A `MemorySize` enum variant) Memory size value
---@return MemorySizeInfo
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:size() == 32)
---```
function MemorySizeInfo.new(memory_size) end
---Gets the `MemorySize` value
---
---@return integer #A `MemorySize` enum variant
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:memory_size() == MemorySize.Packed256_UInt16)
---```
function MemorySizeInfo:memory_size() end
---Gets the size in bytes of the memory location or 0 if it's not accessed or unknown
---
---@return integer
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(info:size() == 4)
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:size() == 32)
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(info:size() == 8)
---```
function MemorySizeInfo:size() end
---Gets the size in bytes of the packed element. If it's not a packed data type, it's equal to `MemorySizeInfo.size()`.
---
---@return integer
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(info:element_size() == 4)
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:element_size() == 2)
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(info:element_size() == 8)
---```
function MemorySizeInfo:element_size() end
---Gets the element type if it's packed data or the type itself if it's not packed data
---
---@return integer #A `MemorySize` enum variant
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(info:element_type() == MemorySize.UInt32)
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:element_type() == MemorySize.UInt16)
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(info:element_type() == MemorySize.UInt64)
---```
function MemorySizeInfo:element_type() end
---Gets the element type if it's packed data or the type itself if it's not packed data
---
---@return MemorySizeInfo
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32):element_type_info()
---assert(info:memory_size() == MemorySize.UInt32)
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16):element_type_info()
---assert(info:memory_size() == MemorySize.UInt16)
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64):element_type_info()
---assert(info:memory_size() == MemorySize.UInt64)
---```
function MemorySizeInfo:element_type_info() end
---`true` if it's signed data (signed integer or a floating point value)
---
---@return boolean
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(not info:is_signed())
---info = MemorySizeInfo.new(MemorySize.Int32)
---assert(info:is_signed())
---info = MemorySizeInfo.new(MemorySize.Float64)
---assert(info:is_signed())
---```
function MemorySizeInfo:is_signed() end
---`true` if it's a broadcast memory type
---
---@return boolean
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(not info:is_broadcast())
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(not info:is_broadcast())
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(info:is_broadcast())
---```
function MemorySizeInfo:is_broadcast() end
---`true` if this is a packed data type, eg. `MemorySize.Packed128_Float32`. See also `MemorySizeInfo.element_count()`
---
---@return boolean
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(not info:is_packed())
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:is_packed())
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(not info:is_packed())
---```
function MemorySizeInfo:is_packed() end
---Gets the number of elements in the packed data type or `1` if it's not packed data (`MemorySizeInfo.is_packed()`)
---
---@return integer
---
---# Examples
---
---```lua
---local MemorySize = require("iced_x86.MemorySize")
---local MemorySizeInfo = require("iced_x86.MemorySizeInfo")
---
---local info = MemorySizeInfo.new(MemorySize.UInt32)
---assert(info:element_count() == 1)
---info = MemorySizeInfo.new(MemorySize.Packed256_UInt16)
---assert(info:element_count() == 16)
---info = MemorySizeInfo.new(MemorySize.Broadcast512_UInt64)
---assert(info:element_count() == 1)
---```
function MemorySizeInfo:element_count() end
return MemorySizeInfo
| mit |
nesstea/darkstar | scripts/globals/weaponskills/backhand_blow.lua | 11 | 1348 | -----------------------------------
-- Backhand Blow
-- Hand-to-Hand weapon skill
-- Skill Level: 100
-- Deals params.critical damage. Chance of params.critical hit varies with TP.
-- Aligned with the Breeze Gorget.
-- Aligned with the Breeze Belt.
-- Element: None
-- Modifiers: STR:30% ; DEX:30%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.numHits = 1;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.3; params.dex_wsc = 0.3; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.4; params.crit200 = 0.6; params.crit300 = 0.8;
params.canCrit = true;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 0.5; params.dex_wsc = 0.5;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/commands/additem.lua | 27 | 1341 | ---------------------------------------------------------------------------------------------------
-- func: @additem <itemId> <quantity> <aug1> <v1> <aug2> <v2> <aug3> <v3> <aug4> <v4> <trial>
-- desc: Adds an item to the GMs inventory.
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "iiiiiiiiiii"
};
function onTrigger(player, itemId, quantity, aug0, aug0val, aug1, aug1val, aug2, aug2val, aug3, aug3val, trialId)
-- Load needed text ids for players current zone..
local TextIDs = "scripts/zones/" .. player:getZoneName() .. "/TextIDs";
package.loaded[TextIDs] = nil;
require(TextIDs);
-- Ensure item id was given..
if (itemId == nil or tonumber(itemId) == nil or tonumber(itemId) == 0) then
player:PrintToPlayer( "You must enter a valid item id." );
return;
end
-- Ensure the GM has room to obtain the item...
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial( ITEM_CANNOT_BE_OBTAINED, itemId );
return;
end
-- Give the GM the item...
player:addItem( itemId, quantity, aug0, aug0val, aug1, aug1val, aug2, aug2val, aug3, aug3val, trialId );
player:messageSpecial( ITEM_OBTAINED, itemId );
end | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Outer_RaKaznar/npcs/Liseran_Door_Exit.lua | 15 | 1226 | -----------------------------------
-- Area: Outer Ra'Kaznar
-- NPC: Liseran Door Exit
-- Zones out to Kamihr Drifts (zone 267)
-- @zone 274
-- @pos -34.549 -181.334 -20.031
-----------------------------------
package.loaded["scripts/zones/Outer_RaKaznar/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Outer_RaKaznar/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x001c);
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 == 0x001c and option == 1)then
player:setPos(-279.709,19.976,60.353,0,267);
end
end; | gpl-3.0 |
nesstea/darkstar | scripts/globals/spells/bluemagic/battery_charge.lua | 28 | 1450 | -----------------------------------------
-- Spell: Battery Charge
-- Gradually restores MP
-- Spell cost: 50 MP
-- Monster Type: Arcana
-- Spell Type: Magical (Light)
-- Blue Magic Points: 3
-- Stat Bonus: MP+10, MND+1
-- Level: 79
-- Casting Time: 5 seconds
-- Recast Time: 75 seconds
-- Spell Duration: 100 ticks, 300 Seconds (5 Minutes)
--
-- Combos: None
-----------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local typeEffect = EFFECT_REFRESH;
local power = 3;
local duration = 300;
if (caster:hasStatusEffect(EFFECT_DIFFUSION)) then
local diffMerit = caster:getMerit(MERIT_DIFFUSION);
if (diffMerit > 0) then
duration = duration + (duration/100)* diffMerit;
end;
caster:delStatusEffect(EFFECT_DIFFUSION);
end;
if (target:hasStatusEffect(EFFECT_REFRESH)) then
target:delStatusEffect(EFFECT_REFRESH);
end
if (target:addStatusEffect(typeEffect,power,3,duration) == false) then
spell:setMsg(75);
end;
return typeEffect;
end; | gpl-3.0 |
jballanc/aydede | src/grammar.lua | 1 | 12269 | --[[ grammar.lua
A simple LPeg grammar for scheme.
In order to be as flexible as possible, this grammar only parses tokens from
input. All interpretation and evaluation tasks are handled by the interpreter
which is provided as an argument to the main function returned by this
module.
Copyright (c) 2014, Joshua Ballanco.
Licensed under the BSD 2-Clause License. See COPYING for full license details.
--]]
local tu = require("util/table")
local lp = require("lpeg")
local P, R, S, V, C, Cg, Ct, locale
= lp.P, lp.R, lp.S, lp.V, lp.C, lp.Cg, lp.Ct, lp.locale
local grammar = {
"Program",
Program = V("CommandOrDefinition")
}
local tokens = require("grammar/tokens")
local cod = require("grammar/command_or_definition")
tu.merge(grammar, tokens)
tu.merge(grammar, cod)
return grammar
--[=[
local re = require("re")
local function grammar(parse)
-- Use locale for matching; generates rules: alnum, alpha, cntrl, digit, graph, lower,
-- print, punct, space, upper, and xdigit
re.updatelocale()
return re.compile([[
-- "Program" is the top-level construct in Scheme, but for now we're using it to proxy
-- to other forms for testing...
Program <- --ImportDecl
CommandOrDefinition
CommandOrDefinition <- Definition
/ Command
/ open "begin"
(intraline_whitespace+ CommandOrDefinition)+
close
Command <- Expression
-- "Expression" encompases most valid forms, including everything that counts as a
-- "Datum" for processing by the REPL. More elements will be added to this list as
-- more of the grammar is defined.
Expression <- LambdaExpression
/ ProcedureCall
/ Literal
/ Identifier
LambdaExpression <- { {}
{| open "lambda"
{:params: formals :}
{:body: body :}
close |}
} -> parse_lambda
formals <- open Symbol* close
/ Symbol
/ open Symbol+ dot Symbol close
body <- Expression
ProcedureCall <- { {}
{| open
{:op: operator :}
{:args: {| (intraline_whitespace+ { operand })* |} :}
close |}
} -> parse_call
operator <- Expression
operand <- Expression
Literal <- Quotation
/ SelfEvaluating
Quotation <- { {} "'" Datum
/ open "quote" intraline_whitespace+ Datum close
} -> parse_quotation
SelfEvaluating <- Boolean
/ Number
/ Vector
/ Character
/ String
/ Bytevector
-- Some useful tokens
explicit_sign <- [+-]
open <- intraline_whitespace* [(] intraline_whitespace*
close <- intraline_whitespace* [)] intraline_whitespace*
slash <- [/]
backslash <- [\\]
quote <- ["]
dot <- [.]
minus <- [-]
-- Other basic elements
initial <- %alpha / special_initial
special_initial <- [!$%&*/:<=>?^_~]
subsequent <- initial / digit / special_subsequent
special_subsequent <- explicit_sign / [.@]
space <- [ ]
tab <- [\t]
newline <- [\n]
return <- [\r]
intraline_whitespace<- space / tab
vertical_line <- [|]
line_ending <- newline / return newline / return
xscalar <- xdigit+
inline_hex_escape <- backslash [x] xscalar [;]
mnemonic_escape <- backslash [abtnr]
symbol_element <- [^|\\] / inline_hex_escape / mnemonic_escape / "\\|"
Boolean <- { {} "#true" / "#t" } -> parse_true
/ { {} "#false" / "#f" } -> parse_false
-- Rules for the R7RS numeric tower
-- NOTE: For a true full numeric tower, we would have to implement all the variations
-- on complex number forms. For now, we only consider simple real numbers.
Number <- bnum / onum / num / xnum
bnum <- { {}
{| {:prefix: bprefix :} {:num: breal :} |}
} -> parse_bnum
onum <- { {}
{| {:prefix: oprefix :} {:num: oreal :} |}
} -> parse_onum
num <- { {}
{| {:prefix: prefix :} {:num: real :} |}
} -> parse_num
xnum <- { {}
{| {:prefix: xprefix :} {:num: xreal :} |}
} -> parse_xnum
breal <- {| {:sign: sign :} bureal |} / infnan
oreal <- {| {:sign: sign :} oureal |} / infnan
real <- {| {:sign: sign :} ureal |} / infnan
xreal <- {| {:sign: sign :} xureal |} / infnan
bureal <- {:numerator: buint :} slash {:denominator: buint :}
/ {:whole: buint :}
oureal <- {:numerator: ouint :} slash {:denominator: ouint :}
/ {:whole: ouint :}
ureal <- decimal
/ {:numerator: uint :} slash {:denominator: uint :}
/ {:whole: uint :}
xureal <- {:numerator: xuint :} slash {:denominator: xuint :}
/ {:whole: xuint :}
decimal <- {:whole: digit+ :} dot {:fraction: digit+ :} suffix
/ dot {:fraction: digit+ :} suffix
/ {:whole: uint :} suffix
buint <- bdigit +
ouint <- odigit +
uint <- digit +
xuint <- xdigit +
bprefix <- {:radix: bradix :} {:exactness: exactness :}
/ {:exactness: exactness :} {:radix: bradix :}
oprefix <- {:radix: oradix :} {:exactness: exactness :}
/ {:exactness: exactness :} {:radix: oradix :}
prefix <- {:radix: radix :} {:exactness: exactness :}
/ {:exactness: exactness :} {:radix: radix :}
xprefix <- {:radix: xradix :} {:exactness: exactness :}
/ {:exactness: exactness :} {:radix: xradix :}
inf <- {:sign: explicit_sign :} [iI][nN][fF] dot '0'
nan <- {:sign: explicit_sign :} [nN][aA][nN] dot '0'
infnan <- {|
{:inf: inf :}
/ {:nan: nan :}
|}
suffix <- {:exp:
exp_marker
{|
{:sign: sign :}
{:value: digit+ :}
|}
:}?
exp_marker <- [eE]
sign <- explicit_sign?
exactness <- ([#] ([iI] / [eE]))?
bradix <- [#] [bB]
oradix <- [#] [oO]
radix <- ([#] [dD])?
xradix <- [#] [xX]
bdigit <- [01]
odigit <- [0-7]
digit <- %digit
xdigit <- %xdigit
Vector <- { {} "#("
{| Datum (intraline_whitespace+ Datum)* |}
")" } -> parse_vector
Datum <- { {} simple_datum
/ compound_datum
/ {| {:label: label :} "=" {:datum: Datum :} |}
/ {| {:label: label "#" :} |} }
simple_datum <- Boolean / Number / Character / String / Symbol / Bytevector
compound_datum <- List / Vector / Abbreviation
label <- { {} "#" uint } -> parse_label
Abbreviation <- { {} {| abbrev_prefix Datum |} } -> parse_abbreviation
abbrev_prefix <- {:prefix: "'" / "`" / "," / ",@" :}
Character <- { {} {| "#" backslash
( "x" {:hex_character: hex_scalar_value :}
/ {:named_character: character_name :}
/ {:character: . :}) |} } -> parse_character
character_name <- "alarm" / "backspace" / "delete" / "escape" / "newline"
/ "null" / "return" / "space" / "tab"
hex_scalar_value <- xdigit+
String <- { {} quote { string_element* } quote } -> parse_string
string_element <- [^"\\]
/ mnemonic_escape
/ backslash quote
/ backslash backslash
/ backslash intraline_whitespace* line_ending
intraline_whitespace*
/ inline_hex_escape
Bytevector <- { {} "#u8" open
{| byte (intraline_whitespace+ byte)* |}
close } -> parse_bytevector
byte <- { "2" "5" [0-5]
/ "2" [0-4] [0-9]
/ "1" [0-9]^2
/ [0-9]^-2 }
-- Definitions
Definition <- { {} {|
open "define" intraline_whitespace+
{:name: Identifier :} intraline_whitespace+
{:value: Expression :}
close |}
} -> parse_simple_definition
/ { {} {|
open "define" open
{:name: Identifier :} intraline_whitespace+
{:formals: def_formals :} close
{:body: body :} close |}
} -> parse_function_definition
/ { {} {|
open "define-syntax" intraline_whitespace+
{:name: Keyword :} intraline_whitespace+
{:transform: transformer_spec :} close |}
} -> parse_syntax_definition
def_formals <- { {} {|
{ Identifier }*
/ { Identifier }* "." {:rest_arg: Identifier :}
|} }
transformer_spec <- { {} {|
(open "syntax-rules"
open {:identifier: Identifier :} close
syntax_rule* close)
|} }
syntax_rule <- { {} {| open {:pattern: pattern :}
intraline_whitespace+
{:template: template :}
close |}
} -> parse_syntax_rule
pattern <- pattern_datum
pattern_datum <- String
/ Character
/ Boolean
/ Number
template <- template_datum
template_datum <- pattern_datum
-- Parsing constructs
Identifier <- { %alpha %alnum* } -> parse_symbol
Symbol <- Identifier
Keyword <- Identifier
-- Simple forms
Car <- Symbol
Cdr <- List+ / Symbol / Number
List <- {|
open %space*
{:car: Car :} %space+
{:cdr: Cdr :} %space*
close
|} -> parse_list
]], parse)
end
return grammar
--]=]
| bsd-2-clause |
UnfortunateFruit/darkstar | scripts/zones/RoMaeve/Zone.lua | 6 | 2425 | -----------------------------------
--
-- Zone: RoMaeve (122)
--
-----------------------------------
package.loaded["scripts/zones/RoMaeve/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/RoMaeve/TextIDs");
require("scripts/globals/zone");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
local manuals = {17277227,17277228};
SetFieldManual(manuals);
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(-0.008,-33.595,123.478,62);
end
if(player:getCurrentMission(WINDURST) == VAIN and player:getVar("MissionStatus") ==1)then
cs = 0x0003; -- doll telling "you're in the right area"
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onGameDay
-----------------------------------
function onGameDay()
-- Moongates
local Moongate_Offset = 17277195; -- _3e0 in npc_list
local direction = VanadielMoonDirection();
local phase = VanadielMoonPhase();
if(((direction == 2 and phase >= 90) or (direction == 1 and phase >= 95)) and GetNPCByID(Moongate_Offset):getWeather() == 0) then
GetNPCByID(Moongate_Offset):openDoor(432);
GetNPCByID(Moongate_Offset+1):openDoor(432);
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 |
nesstea/darkstar | scripts/zones/Port_San_dOria/npcs/Vounebariont.lua | 27 | 2108 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Vounebariont
-- Starts and Finishes Quest: Thick Shells
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getQuestStatus(SANDORIA,THICK_SHELLS) ~= QUEST_AVAILABLE) then
if (trade:hasItemQty(889,5) and trade:getItemCount() == 5) then -- Trade Beetle Shell
player:startEvent(0x0202);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getFameLevel(SANDORIA) >= 2) then
player:startEvent(0x0204);
else
player:startEvent(0x0238);
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 == 0x0204) then
if (player:getQuestStatus(SANDORIA,THICK_SHELLS) == QUEST_AVAILABLE) then
player:addQuest(SANDORIA,THICK_SHELLS);
end
elseif (csid == 0x0202) then
if (player:getQuestStatus(SANDORIA,THICK_SHELLS) == QUEST_ACCEPTED) then
player:completeQuest(SANDORIA,THICK_SHELLS);
player:addFame(SANDORIA,30);
else
player:addFame(SANDORIA,5);
end
player:tradeComplete();
player:addTitle(BUG_CATCHER);
player:addGil(GIL_RATE*750);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*750)
end
end; | gpl-3.0 |
e7/latasia | lua_app/lib/lua/proto_sjsonb.lua | 1 | 1239 | local ltspack = require "ltspack"
local _M = {_VERSION = '0.01'}
function _M.encode(proto_type, content)
local rslt = string.pack(">I2S2I2A",
0xE78F8A9D, 1000, proto_type, 20, #content, 0, content)
return rslt
end
-- 返回未决数据偏移,内容类型,内容数据,错误信息
function _M.decode(bytebuffer, ofst)
local find_pack = function (bytebuffer, ofst)
local ne, magic_no
while true do
ne, magic_no = string.unpack(bytebuffer, ">I", ofst)
if ne == ofst or 0xE78F8A9D == magic_no then
return ne, magic_no
end
ofst = ofst + 1
end
end
-- 寻找有效标识
local ne, magic_no = find_pack(bytebuffer, 1)
if nil == magic_no then
return 1, 0, nil, "unknown data"
end
local next_ofst, version, ent_type, ent_ofst, ent_len, checksum =
string.unpack(bytebuffer, ">IS2I2", ne)
if ne == next_ofst then
return ne, 0, nil, "no enough data"
end
-- 各种参数校验
if 0 then
end
local ne, data = string.unpack(bytebuffer,
string.format("A%d", ent_len), ne)
return ne, ent_type, data, nil
end
return _M
| gpl-2.0 |
nesstea/darkstar | scripts/zones/Xarcabard_[S]/Zone.lua | 32 | 1259 | -----------------------------------
--
-- Zone: Xarcabard_[S] (137)
--
-----------------------------------
package.loaded["scripts/zones/Xarcabard_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Xarcabard_[S]/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-414,-46.5,20,253);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
aminsa2000/create-me | plugins/arabic_lang.lua | 12 | 22231 | --------------------------------------------------
-- ____ ____ _____ --
-- | \| _ )_ _|___ ____ __ __ --
-- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
-- |____/|____/ |_|\____/\_____|_/\/\_| --
-- --
--------------------------------------------------
-- --
-- Developers: @Josepdal & @MaSkAoS --
-- Support: @Skneos, @iicc1 & @serx666 --
-- --
-- Translated by Wathiq Al-Qajar { @Wathiqq } --
-- --
--------------------------------------------------
local LANG = 'ar'
local function run(msg, matches)
if permissions(msg.from.id, msg.to.id, "lang_install") then
-------------------------
-- Translation version --
-------------------------
set_text(LANG, 'version', '0.1')
set_text(LANG, 'versionExtended', 'إصدار الترجمة نسخة 0.1')
-------------
-- Plugins --
-------------
-- global plugins --
set_text(LANG, 'require_sudo', '.يتطلب هذاالمساعده امتيازات مطور')
set_text(LANG, 'require_admin', '.يتطلب هذاالمساعده امتيازات المسئول او اعلى')
set_text(LANG, 'require_mod', '.يتطلب هذاالمساعده الامتيازات الادمن او اعلى')
-- Spam.lua --
set_text(LANG, 'reportUser', 'مستخدم')
set_text(LANG, 'reportReason', 'تقرير السبب')
set_text(LANG, 'reportGroup', 'كروب')
set_text(LANG, 'reportMessage', 'رسالة')
set_text(LANG, 'allowedSpamT', '.لا يسمح البريد المزعج في هذه الدردشة')
set_text(LANG, 'allowedSpamL', '.لا يسمح البريد المزعج في هذاالسوبر كروب')
set_text(LANG, 'notAllowedSpamT', '.لا يسمح البريد المزعج في هذه الدردشة')
set_text(LANG, 'notAllowedSpamL', '.لا يسمح البريد المزعج في هذاالسوبر كروب')
-- bot.lua --
set_text(LANG, 'botOn', 'تم تشغيل البوت')
set_text(LANG, 'botOff', 'تم اطفاء البوت')
-- settings.lua --
set_text(LANG, 'user', 'مستخدم')
set_text(LANG, 'isFlooding', 'الفلود')
set_text(LANG, 'noStickersT', '.لا يسمح للملصقات في هذه الدردشة')
set_text(LANG, 'noStickersL', '.لا يسمح للملصقات في هذا السوبر كروب')
set_text(LANG, 'stickersT', 'لا يسمح للملصقات في هذه الدردشة.')
set_text(LANG, 'stickersL', '.لا يسمح للملصقات في هذا السوبر كروب')
set_text(LANG, 'gifsT', '.لا يسمح بلصور المتحركة في هذه الدردشة')
set_text(LANG, 'gifsL', '.لا يسمح بلصور المتحركة في هذا السوبر كروب')
set_text(LANG, 'noGifsT', '.لا يسمح بلصور المتحركة في هذه الدردشة')
set_text(LANG, 'noGifsL', '.لا يسمح بلصور المتحركة في هذا السوبر كروب')
set_text(LANG, 'photosT', '.لا يسمح بلصور في هذه الدردشة')
set_text(LANG, 'photosL', '.لا يسمح للصور في هذا السوبر كروب')
set_text(LANG, 'noPhotosT', '.لا يسمح بلصور في هذه الدردشة')
set_text(LANG, 'noPhotosL', '.لا يسمح للصور في هذا السوبر كروب')
set_text(LANG, 'arabicT', '.لا يسمح تكلم العربية في هذه الدردشة')
set_text(LANG, 'arabicL', '.لا يسمح تكلم العربية في هذا السوبر كروب')
set_text(LANG, 'noArabicT', '.لا يسمح تكلم العربية في هذه الدردشة')
set_text(LANG, 'noArabicL', '.لا يسمح تكلم العربية في هذا السوبر كروب')
set_text(LANG, 'audiosT', 'ل.ا يسمح للصوتيات في هذه الدردشة')
set_text(LANG, 'audiosL', '.لا يسمح للصوتيات في هذا اسوبر كروب')
set_text(LANG, 'noAudiosT', '.لا يسمح للصوتيات في هذه الدردشة')
set_text(LANG, 'noAudiosL', '.لا يسمح للصوتيات في هذا اسوبر كروب')
set_text(LANG, 'kickmeT', 'خاصية الخروج من المجموعة مسموحة الان.')
set_text(LANG, 'kickmeL', 'خاصية الخروج من المجموعة الخارقة مسموحة الان.')
set_text(LANG, 'noKickmeT', 'خاصية الخروج من المجموعة ممنوعة الان.')
set_text(LANG, 'noKickmeL', 'خاصية الخروج من المجموعة الخارقة ممنوعة الان.')
set_text(LANG, 'floodT', 'الفلود مفعل في الكروب.')
set_text(LANG, 'floodL', 'الفلود مفعل في السوبر كروب.')
set_text(LANG, 'noFloodT', 'الفلود مفعل في الكروب.')
set_text(LANG, 'noFloodL', 'الفلود مفعل في السوبر كروب.')
set_text(LANG, 'floodTime', 'تم ضبط الاختيار وقت الفلود لـ ')
set_text(LANG, 'floodMax', 'تم تعيين رسائل الفلود ماكس لـ ')
set_text(LANG, 'gSettings', 'ضبط مجموعة')
set_text(LANG, 'sSettings', 'ضبط سوبر كروب')
set_text(LANG, 'allowed', 'سماح')
set_text(LANG, 'noAllowed', 'لاتسمح')
set_text(LANG, 'noSet', 'غير مضبوط')
set_text(LANG, 'stickers', 'ملصقات')
set_text(LANG, 'links', 'روابط')
set_text(LANG, 'arabic', 'العربية')
set_text(LANG, 'bots', 'البوتات')
set_text(LANG, 'gifs', 'الصور التحركة')
set_text(LANG, 'photos', 'الصور')
set_text(LANG, 'audios', 'الصوتيات')
set_text(LANG, 'kickme', 'طردي')
set_text(LANG, 'spam', 'غير مرغوب فية')
set_text(LANG, 'gName', 'اسم الكروب')
set_text(LANG, 'flood', 'فلود')
set_text(LANG, 'language', 'لغة')
set_text(LANG, 'mFlood', 'فلود ماكس')
set_text(LANG, 'tFlood', 'وقت الفلود')
set_text(LANG, 'setphoto', 'تعيين صورة')
set_text(LANG, 'photoSaved', 'تم حفض الصورة!')
set_text(LANG, 'photoFailed', 'خطاء ,الرجاء اعادة المحاولة!')
set_text(LANG, 'setPhotoAborted', 'وقف وضع عملية الصور...')
set_text(LANG, 'sendPhoto', 'الرجاء,ارسالة الصورة هنا')
set_text(LANG, 'linkSaved', 'تم حفض الرابط الجديد.')
set_text(LANG, 'groupLink', 'رابط الكروب')
set_text(LANG, 'sGroupLink', 'رابط السوبر كروب')
set_text(LANG, 'noLinkSet', 'لم يتم وضع رابط الرجاء ضغط على #setlink مع الرابط')
set_text(LANG, 'chatRename', 'الان يمكنك اعادة تسمية الكروب.')
set_text(LANG, 'channelRename', 'الآن يمكنك إعادة تسمية القناة.')
set_text(LANG, 'notChatRename', 'الآن لا يمكنك إعادة تسمية الكروب.')
set_text(LANG, 'notChannelRename', 'الآن لا يمكن إعادة تسمية القناة.')
set_text(LANG, 'lockMembersT', 'تم حظر عدد أعضاء هذه الدردشة.')
set_text(LANG, 'lockMembersL', 'تم حظر عدد أعضاء هذه القناة.')
set_text(LANG, 'notLockMembersT', 'عدد الأعضاء الآن لم يتم تأمين على هذه الكروب.')
set_text(LANG, 'notLockMembersL', 'عدد الأعضاء الآن لم يتم تأمين على هذه القناة.')
set_text(LANG, 'langUpdated', 'تم تحديث اللغة لـ: ')
set_text(LANG, 'chatUpgrade', 'تم ترقية المجموعة بنجاح.')
set_text(LANG, 'notInChann', 'المجموعة خارقة بالفعل.')
set_text(LANG, 'chatUpgrade', 'تم ترقية المجموعة بنجاح.')
set_text(LANG, 'notInChann', 'المجموعة خارقة بالفعل.')
set_text(LANG, 'desChanged', 'تم تغيير وصف المجموعة الخارقة.')
set_text(LANG, 'desOnlyChannels', 'هذه الخاصية للمجموعات الخارقة فقط.')
set_text(LANG, 'muteAll', 'تم كتم المجموعة.')
set_text(LANG, 'unmuteAll', 'تم الغاء الكتم عن المجموعة.')
set_text(LANG, 'muteAllX:1', 'تم كتم المجموعة لـ ')
set_text(LANG, 'muteAllX:2', 'ثواني.')
set_text(LANG, 'createGroup:1', 'المجموعة')
set_text(LANG, 'createGroup:2', 'تم صنعها.')
set_text(LANG, 'newGroupWelcome', 'مرحبا بك في مجموعتك الجديدة .')
-- export_gban.lua --
set_text(LANG, 'accountsGban', 'حسابات المحظورة عام.')
-- giverank.lua --
set_text(LANG, 'alreadyAdmin', 'هذا المستخدم هو بالفعل مشرف.')
set_text(LANG, 'alreadyMod', 'هذا المستخدم هو بالفعل مسؤؤل.')
set_text(LANG, 'newAdmin', 'المشرف الجديد')
set_text(LANG, 'newMod', 'المسؤؤل الجديد')
set_text(LANG, 'nowUser', 'هو الآن مستخدم.')
set_text(LANG, 'modList', 'قائمة المسؤؤلون')
set_text(LANG, 'adminList', 'قائمة المشرفون')
set_text(LANG, 'modEmpty', 'قائمة المسؤؤلون فارغة في هاذه الكروب.')
set_text(LANG, 'adminEmpty', 'قائمة المشرفون فارغة.')
-- id.lua --
set_text(LANG, 'user', 'مستخدم')
set_text(LANG, 'supergroupName', 'اسم السوبر كروب')
set_text(LANG, 'chatName', 'اسم الكروب')
set_text(LANG, 'supergroup', 'سوبر كروب')
set_text(LANG, 'chat', 'كروب')
-- moderation.lua --
set_text(LANG, 'userUnmuted:1', 'مستخدم')
set_text(LANG, 'userUnmuted:2', 'الغاء التجاهل.')
set_text(LANG, 'userMuted:1', 'مستخدم')
set_text(LANG, 'userMuted:2', 'تجاهل.')
set_text(LANG, 'kickUser:1', 'مستخدم')
set_text(LANG, 'kickUser:2', 'طرد.')
set_text(LANG, 'banUser:1', 'مستخدم')
set_text(LANG, 'banUser:2', 'حظر.')
set_text(LANG, 'unbanUser:1', 'مستخدم')
set_text(LANG, 'unbanUser:2', 'غير محضور.')
set_text(LANG, 'gbanUser:1', 'مستخدم')
set_text(LANG, 'gbanUser:2', 'المحضور عام.')
set_text(LANG, 'ungbanUser:1', 'مستخدم')
set_text(LANG, 'ungbanUser:2', 'الغير محضور عام.')
set_text(LANG, 'addUser:1', 'مستخدم')
set_text(LANG, 'addUser:2', 'اضافة الى كروب.')
set_text(LANG, 'addUser:3', 'اضافة الى القناة.')
set_text(LANG, 'kickmeBye', 'وداعا.')
-- plugins.lua --
set_text(LANG, 'plugins', 'الإضافات')
set_text(LANG, 'installedPlugins', 'تثبيت الاضافات.')
set_text(LANG, 'pEnabled', 'تفعيل.')
set_text(LANG, 'pDisabled', 'تعطيل.')
set_text(LANG, 'isEnabled:1', 'الإضافات')
set_text(LANG, 'isEnabled:2', 'يتم تفعيلها.')
set_text(LANG, 'notExist:1', 'الاضافات')
set_text(LANG, 'notExist:2', 'لا توجد.')
set_text(LANG, 'notEnabled:1', 'الاضافات')
set_text(LANG, 'notEnabled:2', 'غير مفعل.')
set_text(LANG, 'pNotExists', 'الاضافة لا توجد.')
set_text(LANG, 'pDisChat:1', 'الاضافات')
set_text(LANG, 'pDisChat:2', 'تعطيل على هاذا الكروب.')
set_text(LANG, 'anyDisPlugin', 'لا توجد أية الإضافات معطلة.')
set_text(LANG, 'anyDisPluginChat', 'لا توجد أية الإضافات المعطلة لهذه الدردشة.')
set_text(LANG, 'notDisabled', 'لا يتم تعطيل هذا الاضافات')
set_text(LANG, 'enabledAgain:1', 'الاضافات')
set_text(LANG, 'enabledAgain:2', 'يتم تفعيل مرة أخرى')
-- commands.lua --
set_text(LANG, 'commandsT', 'الاوامر')
set_text(LANG, 'errorNoPlug', 'الاضافات ليسة موجودة في الاستخدام.')
-- rules.lua --
set_text(LANG, 'setRules', 'تم تحديث قوانين المجموعة.')
set_text(LANG, 'remRules', 'تم ازالة قوانين المجموعة.')
------------
-- Usages --
------------
-- bot.lua --
set_text(LANG, 'bot:0', 2)
set_text(LANG, 'bot:1', '#bot on: تمكين بوت في القناة الحالية.')
set_text(LANG, 'bot:2', '#bot off: تعطيل بوت في القناة الحالية.')
-- commands.lua --
set_text(LANG, 'commands:0', 2)
set_text(LANG, 'commands:1', '#commands: عرض كل الأوامر لكل المساعد.')
set_text(LANG, 'commands:2', '#commands [plugins]: أوامر لهذا البرنامج المساعد.')
-- rules.lua --
set_text(LANG, 'setRules', 'تم تحديث قوانين الكروب.')
set_text(LANG, 'remRules', 'تم إزالة قوانين الكروب.')
-- export_gban.lua --
set_text(LANG, 'export_gban:0', 2)
set_text(LANG, 'export_gban:1', '#gbans installer: العودة المثبت ملف لوا لتبادل gbans وإضافة تلك في بوت آخر في أمر واحد فقط.')
set_text(LANG, 'export_gban:2', '#gbans list: العودة أرشيف بقائمة من gbans.')
-- gban_installer.lua --
set_text(LANG, 'gban_installer:0', 1)
set_text(LANG, 'gban_installer:1', '#install gbans: إضافة قائمة مسودات في ديسيبل رديس الخاص بك.')
-- giverank.lua --
set_text(LANG, 'giverank:0', 9)
set_text(LANG, 'giverank:1', '#rank admin (reply): إضافة ادمن من قبل الرد.')
set_text(LANG, 'giverank:2', '#rank admin <user_id>/<user_name>: إضافة ادمن من قبل المستخدم ID/Username.')
set_text(LANG, 'giverank:3', '#rank mod (reply): اضافة مشرف من قبل الرد.')
set_text(LANG, 'giverank:4', '#rank mod <user_id>/<user_name>: اضافة مشرف من قبل المستخدم ID/Username.')
set_text(LANG, 'giverank:5', '#rank guest (reply): إزالة ادمن قبل الرد.')
set_text(LANG, 'giverank:6', '#rank guest <user_id>/<user_name>: إزالة ادمن من قبل المستخدمID/Username.')
set_text(LANG, 'giverank:7', '#admins: قائمة بجميع الأعضاء المشرف.')
set_text(LANG, 'giverank:8', '#mods: قائمة بجميع الأعضاء المشرفين.')
set_text(LANG, 'giverank:9', '#members: قائمة بجميع الأعضاء قناة.')
-- id.lua --
set_text(LANG, 'id:0', 6)
set_text(LANG, 'id:1', '#id: اضهار الايدي.')
set_text(LANG, 'id:2', '#ids chat: اضهار ايديات الاعضاء.')
set_text(LANG, 'id:3', '#ids channel: اضهار ايديات الاعضاءفي القناة الحالية.')
set_text(LANG, 'id:4', '#id <user_name>:اضهار ايدي عضو.')
set_text(LANG, 'id:5', '#whois <user_id>/<user_name>: اضهار اسم المستخدم.')
set_text(LANG, 'id:6', '#whois (reply): اضهار ايدي المستخدم.')
-- moderation.lua --
set_text(LANG, 'moderation:0', 18)
set_text(LANG, 'moderation:1', '#add: الرد على رسالة، سيتم إضافة المستخدم إلى مجموعة الحالي / السوبركروب.')
set_text(LANG, 'moderation:2', '#add <id>/<username>: يضيف المستخدم عن طريق لمعرف / اسم المستخدم إلى مجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:3', '#kick: الرد على رسالة، سيتم طرد المستخدم في المجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:4', '#kick <id>/<username>: سيتم طرد المستخدم من قبل في الهوية / اسم المستخدم في المجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:5', '#kickme: طرد نفسي من الكروب.')
set_text(LANG, 'moderation:6', '#ban: الرد على رسالة، سيتم طرد المستخدم وحظرت في المجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:7', '#ban <id>/<username>: سيتم حظر المستخدم عن طريق لمعرف / اسم المستخدم في المجموعة الحالي / السوبر كروب، وأنها لن تكون قادرة على العودة.')
set_text(LANG, 'moderation:8', '#unban: الرد على رسالة، سيتم إلغاء حظر المستخدم في المجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:9', '#unban <id>/<username>: سيتم إلغاء حظر المستخدم من قبل في الهوية / اسم المستخدم في المجموعة الحالي / السوبر كروب.')
set_text(LANG, 'moderation:10', '#gban:الرد على رسالة، سيتم طرد المستخدم ومنعت من جميع الفئات / سوبر كروب.')
set_text(LANG, 'moderation:11', '#gban <id>/<username>: سيتم حظر المستخدم عن طريق لمعرف / اسم المستخدم من جميع الفئات / supergroups وأنها لن تكون قادرة على الدخول.')
set_text(LANG, 'moderation:12', '#ungban: الرد على رسالة، سيتم إلغاء حظر المستخدم من جميع الفئات / supergroups.')
set_text(LANG, 'moderation:13', '#ungban <id>/<username>: سيتم إلغاء حظر المستخدم من قبل في الهوية / اسم المستخدم من جميع الفئات / supergroups.')
set_text(LANG, 'moderation:14', '#mute: الرد على رسالة، سيتم إسكات المستخدم في السوبر كروب الحالي، ومحو كل رسائلها.')
set_text(LANG, 'moderation:15', '#mute <id>/<username>: سيتم إسكات المستخدم عن طريق لمعرف / اسم المستخدم في السوبر كروب الحالي، ومحو كل رسائلها.')
set_text(LANG, 'moderation:16', '#unmute: الرد على رسالة، سيتم فتح الصامت المستخدم في السوبر كروب.')
set_text(LANG, 'moderation:17', '#unmute <id>/<username>: سيتم فتح الصامت المستخدم عن طريق لمعرف / اسم المستخدم في السوبر كروب')
set_text(LANG, 'moderation:18', '#rem: الرد على رسالة، سيتم إزالة رسالة.')
-- settings.lua --
set_text(LANG, 'settings:0', 19)
set_text(LANG, 'settings:1', '#settings stickers enable/disable: عندما مكن، سيتم مسح جميع ملصقات.')
set_text(LANG, 'settings:2', '#settings links enable/disable: عندما تمكين، سيتم مسح جميع الروابط.')
set_text(LANG, 'settings:3', '#settings arabic enable/disabl: عندما مكن، سيتم مسح جميع الرسائل مع العربية / الفارسية.')
set_text(LANG, 'settings:4', '#settings bots enable/disable: عندما مكن، إذا كان شخص ما يضيف بوت، فإنه سيطرد.')
set_text(LANG, 'settings:5', '#settings gifs enable/disable: عندما مكن، سيتم مسح جميع الصور المتحركة.')
set_text(LANG, 'settings:6', '#settings photos enable/disable: عندما مكن، سيتم مسح جميع الصور.')
set_text(LANG, 'settings:7', '#settings audios enable/disable: عندما مكن، سيتم مسح كافة الأصوات.')
set_text(LANG, 'settings:8', '#settings kickme enable/disable: عندما مكن، يمكن للناس أن تطرد نفسها.')
set_text(LANG, 'settings:9', '#settings spam enable/disable: عندما مكن، سيتم مسح جميع الروابط المزعجة.')
set_text(LANG, 'settings:10', '#settings setphoto enable/disable: عندما مكن، إذا كان المستخدم بتغيير صورة جماعية، فإن البوت يعود إلى الصورة المحفوظة.')
set_text(LANG, 'settings:11', '#settings setname enable/disable: عندما مكن، إذا تغير المستخدم اسم المجموعة، والبوت يعود إلى الاسم المحفوظ.')
set_text(LANG, 'settings:12', '#settings lockmember enable/disable: عندما مكن، فإن البوت يطرد جميع الناس أن يدخل إلى مجموعة.')
set_text(LANG, 'settings:13', '#settings floodtime <secs>: تعيين الوقت الذي لا يستخدم للتحقق الفلود.')
set_text(LANG, 'settings:14', '#settings maxflood <secs>: تعيين الحد الأقصى الرسائل في وقت الفلود اعتبار التكرار.')
set_text(LANG, 'settings:15', '#setname <group title>: والبوت تغيير عنوان المجموعة.')
set_text(LANG, 'settings:16', '#setphoto <then send photo>: والبوت تغيير صورة جماعية.')
set_text(LANG, 'settings:17', '#lang <language (en, es,ar...)>: فإنه يغير لغة بوت.')
set_text(LANG, 'settings:18', '#setlink <link>: يوفر رابط المجموعة.')
set_text(LANG, 'settings:19', '#link: للحصول على رابط للمجموعة.')
-- plugins.lua --
set_text(LANG, 'plugins:0', 4)
set_text(LANG, 'plugins:1', '#plugins: .اضهار لائحة جميع الإضافات')
set_text(LANG, 'plugins:2', '#plugins .<enable> / <disable> [plugins]: enable / disable الاضافات المحددة')
set_text(LANG, 'plugins:3', '#plugins .<enable> / <disable> [plugins] الدردشة: enable / disable hghqhthj hglp]]m، فقط في مجموعة الحالي /السوبر كروب')
set_text(LANG, 'plugins:4', '#plugins reload: .اعادة تحميل جميع الإضافات')
-- version.lua --
set_text(LANG, 'version:0', 1)
set_text(LANG, 'version:1', '#version: .اظهار نسخة البوت')
-- rules.lua --
set_text(LANG, 'rules:0', 1)
set_text(LANG, 'rules:1', '#rules: .اضهار قوانين القناة')
if matches[1] == 'install' then
return 'ℹ️ .تم تركيب اللغة العربية بنجاح على بوت'
elseif matches[1] == 'update' then
return 'ℹ️ .تم تحديث اللغة العربية بنجاح على بوت'
end
else
return ".🚫 هذا اوامر المساعده تتطلب المستخدم متميز (المطور)"
end
end
return {
patterns = {
'#(install) (arabic_lang)$',
'#(update) (arabic_lang)$'
},
run = run
}
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/zones/LaLoff_Amphitheater/Zone.lua | 32 | 1666 | -----------------------------------
--
-- Zone: LaLoff_Amphitheater (180)
--
-----------------------------------
package.loaded["scripts/zones/LaLoff_Amphitheater/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/LaLoff_Amphitheater/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(189.849,-176.455,346.531,244);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Outer_Horutoto_Ruins/npcs/_5eh.lua | 19 | 3309 | -----------------------------------
-- Area: Inner Horutoto Ruins
-- NPC: Ancient Magical Gizmo #4 (H out of E, F, G, H, I, J)
-- Involved In Mission: The Heart of the Matter
-----------------------------------
package.loaded["scripts/zones/Outer_Horutoto_Ruins/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/zones/Outer_Horutoto_Ruins/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- Check if we are on Windurst Mission 1-2
if(player:getCurrentMission(WINDURST) == THE_HEART_OF_THE_MATTER) then
MissionStatus = player:getVar("MissionStatus");
if(MissionStatus == 2) then
-- Entered a Dark Orb
if(player:getVar("MissionStatus_orb4") == 1) then
player:startEvent(0x0031);
else
player:messageSpecial(ORB_ALREADY_PLACED);
end
elseif(MissionStatus == 4) then
-- Took out a Glowing Orb
if(player:getVar("MissionStatus_orb4") == 2) then
player:startEvent(0x0031);
else
player:messageSpecial(G_ORB_ALREADY_GOTTEN);
end
else
player:messageSpecial(DARK_MANA_ORB_RECHARGER);
end
else
player:messageSpecial(DARK_MANA_ORB_RECHARGER);
end
return 1;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if(csid == 0x0031) then
orb_value = player:getVar("MissionStatus_orb4");
if(orb_value == 1) then
player:setVar("MissionStatus_orb4",2);
-- Push the text that the player has placed the orb
player:messageSpecial(FOURTH_DARK_ORB_IN_PLACE);
--Delete the key item
player:delKeyItem(FOURTH_DARK_MANA_ORB);
-- Check if all orbs have been placed or not
if(player:getVar("MissionStatus_orb1") == 2 and
player:getVar("MissionStatus_orb2") == 2 and
player:getVar("MissionStatus_orb3") == 2 and
player:getVar("MissionStatus_orb5") == 2 and
player:getVar("MissionStatus_orb6") == 2) then
player:messageSpecial(ALL_DARK_MANA_ORBS_SET);
player:setVar("MissionStatus",3);
end
elseif(orb_value == 2) then
player:setVar("MissionStatus_orb4",3);
-- Time to get the glowing orb out
player:addKeyItem(FOURTH_GLOWING_MANA_ORB);
player:messageSpecial(KEYITEM_OBTAINED,FOURTH_GLOWING_MANA_ORB);
-- Check if all orbs have been placed or not
if(player:getVar("MissionStatus_orb1") == 3 and
player:getVar("MissionStatus_orb2") == 3 and
player:getVar("MissionStatus_orb3") == 3 and
player:getVar("MissionStatus_orb5") == 3 and
player:getVar("MissionStatus_orb6") == 3) then
player:messageSpecial(RETRIEVED_ALL_G_ORBS);
player:setVar("MissionStatus",5);
end
end
end
end; | gpl-3.0 |
nesstea/darkstar | scripts/zones/Balgas_Dais/Zone.lua | 30 | 1783 | -----------------------------------
--
-- Zone: Balgas_Dais (146)
--
-----------------------------------
package.loaded["scripts/zones/Balgas_Dais/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Balgas_Dais/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(317.842,-126.158,380.143,127);
end
return cs;
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
print("Player: ",player);
print("RESULT: ",regionID);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
print("zone CSID: ",csid);
print("zone RESULT: ",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/abilities/charm.lua | 28 | 1164 | -----------------------------------
-- Ability: Charm a monster
-- Tames a monster to fight by your side.
-- Obtained: Beastmaster Level 1
-- Recast Time: 0:15
-- Duration: Varies
-- Check |Duration
-- ---------------- |--------------
-- Too Weak |30 Minutes
-- Easy Prey |20 Minutes
-- Decent Challenge |10 Minutes
-- Even Match |3.0 Minutes
-- Tough |1.5 Minutes
-- Very Tough |1-20 seconds
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/pets");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if (player:getPet() ~= nil) then
return MSGBASIC_ALREADY_HAS_A_PET,0;
elseif (target:getMaster() ~= nil and target:getMaster():isPC()) then
return MSGBASIC_THAT_SOMEONES_PET,0;
else
return 0,0;
end
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
player:charmPet(target);
end;
| gpl-3.0 |
nesstea/darkstar | scripts/globals/spells/bluemagic/corrosive_ooze.lua | 25 | 1991 | -----------------------------------------
-- Spell: Corrosive Ooze
-- Deals water damage to an enemy. Additional Effect: Attack Down and Defense Down
-- Spell cost: 55 MP
-- Monster Type: Amorphs
-- Spell Type: Magical (Water)
-- Blue Magic Points: 4
-- Stat Bonus: HP-10 MP+10
-- Level: 66
-- Casting Time: 5 seconds
-- Recast Time: 30 seconds
--
-- Combos: Clear Mind
-----------------------------------------
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
local multi = 2.125;
if (caster:hasStatusEffect(EFFECT_AZURE_LORE)) then
multi = multi + 0.50;
end
params.multiplier = multi;
params.tMultiplier = 2.0;
params.duppercap = 69;
params.str_wsc = 0.0;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.2;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.0;
damage = BlueMagicalSpell(caster, target, spell, params, INT_BASED);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT) - target:getStat(MOD_INT),BLUE_SKILL,1.0);
local typeEffectOne = EFFECT_DEFENSE_DOWN;
local typeEffectTwo = EFFECT_ATTACK_DOWN;
local duration = 60;
if (damage > 0 and resist > 0.3) then
target:addStatusEffect(typeEffectOne,5,0,duration);
target:addStatusEffect(typeEffectTwo,5,0,duration);
end
return damage;
end; | gpl-3.0 |
nesstea/darkstar | scripts/zones/Windurst_Waters/npcs/Ensasa.lua | 13 | 1810 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Ensasa
-- Standard Merchant NPC
-- Confirmed shop stock, August 2013
-----------------------------------
require("scripts/globals/events/harvest_festivals")
require("scripts/globals/shop");
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
require("scripts/zones/Windurst_Waters/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
onHalloweenTrade(player,trade,npc);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,ENSASA_SHOP_DIALOG);
stock = {
0x0068, 3881,1, --Tarutaru Folding Screen
0x43B8, 5,2, --Crossbow Bolt
0x43A6, 3,2, --Wooden Arrow
0x0070, 456,2, --Yellow Jar
0x43A7, 4,3, --Bone Arrow
0x00DA, 920,3, --Earthen Flowerpot
0x43F4, 3,3, --Little Worm
0x43F3, 9,3, --Lugworm
0x0762, 576,3, --River Foliage
0x13C9, 283,3, --Earth Threnody
0x13C6, 644,3, --Fire Threnody
0x0763, 576,3, --Sea Foliage
0x005C, 905,3, --Tarutaru Stool
0x006E, 4744,3 --White Jar
}
showNationShop(player, WINDURST, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
Xileck/forgottenserver | data/migrations/7.lua | 58 | 2518 | function onUpdateDatabase()
print("> Updating database to version 8 (account viplist with description, icon and notify server side)")
db.query("RENAME TABLE `player_viplist` TO `account_viplist`")
db.query("ALTER TABLE `account_viplist` DROP FOREIGN KEY `account_viplist_ibfk_1`")
db.query("UPDATE `account_viplist` SET `player_id` = (SELECT `account_id` FROM `players` WHERE `id` = `player_id`)")
db.query("ALTER TABLE `account_viplist` CHANGE `player_id` `account_id` INT( 11 ) NOT NULL COMMENT 'id of account whose viplist entry it is'")
db.query("ALTER TABLE `account_viplist` DROP FOREIGN KEY `account_viplist_ibfk_2`")
db.query("ALTER TABLE `account_viplist` CHANGE `vip_id` `player_id` INT( 11 ) NOT NULL COMMENT 'id of target player of viplist entry'")
db.query("ALTER TABLE `account_viplist` DROP INDEX `player_id`, ADD INDEX `account_id` (`account_id`)")
db.query("ALTER TABLE `account_viplist` DROP INDEX `vip_id`, ADD INDEX `player_id` (`player_id`)")
db.query("ALTER TABLE `account_viplist` ADD FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE")
db.query("ALTER TABLE `account_viplist` ADD FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE CASCADE")
db.query("ALTER TABLE `account_viplist` ADD `description` VARCHAR(128) NOT NULL DEFAULT '', ADD `icon` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '0', ADD `notify` TINYINT( 1 ) NOT NULL DEFAULT '0'")
-- Remove duplicates
local resultId = db.storeQuery("SELECT `account_id`, `player_id`, COUNT(*) AS `count` FROM `account_viplist` GROUP BY `account_id`, `player_id` HAVING COUNT(*) > 1")
if resultId ~= false then
repeat
db.query("DELETE FROM `account_viplist` WHERE `account_id` = " .. result.getDataInt(resultId, "account_id") .. " AND `player_id` = " .. result.getDataInt(resultId, "player_id") .. " LIMIT " .. (result.getDataInt(resultId, "count") - 1))
until not result.next(resultId)
result.free(resultId)
end
-- Remove if an account has over 200 entries
resultId = db.storeQuery("SELECT `account_id`, COUNT(*) AS `count` FROM `account_viplist` GROUP BY `account_id` HAVING COUNT(*) > 200")
if resultId ~= false then
repeat
db.query("DELETE FROM `account_viplist` WHERE `account_id` = " .. result.getDataInt(resultId, "account_id") .. " LIMIT " .. (result.getDataInt(resultId, "count") - 200))
until not result.next(resultId)
result.free(resultId)
end
db.query("ALTER TABLE `account_viplist` ADD UNIQUE `account_player_index` (`account_id`, `player_id`)")
return true
end
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/commands/promote.lua | 26 | 1214 | ---------------------------------------------------------------------------------------------------
-- func: promote
-- desc: Promotes the player to a new GM level.
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "si"
};
function onTrigger(player, target, level)
if (level == nil) then
level = target;
target = player:getName();
end
if (target == nil) then
target = player:getName();
end
-- Validate the target..
local targ = GetPlayerByName( target );
if (targ == nil) then
player:PrintToPlayer( string.format( "Invalid player '%s' given.", target ) );
return;
end
-- Validate the level..
if (level < 0) then
level = 0;
end
if (targ:getGMLevel() < player:getGMLevel()) then
if (level < player:getGMLevel()) then
targ:setGMLevel(level);
else
player:PrintToPlayer( "Target's new level is too high." );
end
else
printf( "%s attempting to adjust higher GM: %s", player:getName(), targ:getName() );
end
end; | gpl-3.0 |
nesstea/darkstar | scripts/zones/Dynamis-Qufim/bcnms/dynamis_Qufim.lua | 22 | 1270 | -----------------------------------
-- Area: dynamis_Qufim
-- Name: dynamis_Qufim
-----------------------------------
-- After registering the BCNM via bcnmRegister(bcnmid)
function onBcnmRegister(player,instance)
SetServerVariable("[DynaQufim]UniqueID",player:getDynamisUniqueID(1288));
SetServerVariable("[DynaQufim]Boss_Trigger",0);
SetServerVariable("[DynaQufim]Already_Received",0);
end;
-- Physically entering the BCNM via bcnmEnter(bcnmid)
function onBcnmEnter(player,instance)
player:setVar("DynamisID",GetServerVariable("[DynaQufim]UniqueID"));
local realDay = os.time();
if (DYNA_MIDNIGHT_RESET == true) then
realDay = getMidnight() - 86400;
end
local dynaWaitxDay = player:getVar("dynaWaitxDay");
if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay) then
player:setVar("dynaWaitxDay",realDay);
end
end;
-- Leaving the Dynamis by every mean possible, given by the LeaveCode
-- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3)
-- 4=Finish he dynamis
function onBcnmLeave(player,instance,leavecode)
--print("leave code "..leavecode);
if (leavecode == 4) then
SetServerVariable("[DynaQufim]UniqueID",0);
end
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Port_San_dOria/npcs/Louis.lua | 12 | 1266 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Louis
-- Type: Standard NPC
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local vHour = VanadielHour();
local vMin = VanadielMinute();
while vHour >= 3 do
vHour = vHour - 6;
end
if( vHour == -3) then vHour = 3;
elseif( vHour == -2) then vHour = 4;
elseif( vHour == -1) then vHour = 5;
end
local seconds = math.floor(2.4 * ((vHour * 60) + vMin));
player:startEvent( 0x02FB, seconds, 0, 0, 0, 0, 0, 0, 0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/spells/holy.lua | 31 | 1129 | -----------------------------------------
-- Spell: Holy
-- Deals light damage to an enemy.
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
--calculate raw damage
local dmg = calculateMagicDamage(125,1,caster,spell,target,DIVINE_MAGIC_SKILL,MOD_MND,false);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(MOD_MND)-target:getStat(MOD_MND),DIVINE_MAGIC_SKILL,1.0);
--get the resisted damage
dmg = dmg*resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg);
--TODO: no additional bonus from Afflatus Solace yet
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--add in final adjustments
dmg = finalMagicAdjustments(caster,target,spell,dmg);
return dmg;
end; | gpl-3.0 |
dpino/snabbswitch | lib/ljsyscall/syscall/linux/x86/nr.lua | 18 | 7167 | -- x86 syscall numbers
local nr = {
SYS = {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
["break"] = 17,
oldstat = 18,
lseek = 19,
getpid = 20,
mount = 21,
umount = 22,
setuid = 23,
getuid = 24,
stime = 25,
ptrace = 26,
alarm = 27,
oldfstat = 28,
pause = 29,
utime = 30,
stty = 31,
gtty = 32,
access = 33,
nice = 34,
ftime = 35,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
prof = 44,
brk = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
lock = 53,
ioctl = 54,
fcntl = 55,
mpx = 56,
setpgid = 57,
ulimit = 58,
oldolduname = 59,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
sgetmask = 68,
ssetmask = 69,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrlimit = 76,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
select = 82,
symlink = 83,
oldlstat = 84,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
readdir = 89,
mmap = 90,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
profil = 98,
statfs = 99,
fstatfs = 100,
ioperm = 101,
socketcall = 102,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
olduname = 109,
iopl = 110,
vhangup = 111,
idle = 112,
vm86old = 113,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
ipc = 117,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
modify_ldt = 123,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
create_module = 127,
init_module = 128,
delete_module = 129,
get_kernel_syms = 130,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
afs_syscall = 137,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
vm86 = 166,
query_module = 167,
poll = 168,
nfsservctl = 169,
setresgid = 170,
getresgid = 171,
prctl = 172,
rt_sigreturn = 173,
rt_sigaction = 174,
rt_sigprocmask = 175,
rt_sigpending = 176,
rt_sigtimedwait = 177,
rt_sigqueueinfo = 178,
rt_sigsuspend = 179,
pread64 = 180,
pwrite64 = 181,
chown = 182,
getcwd = 183,
capget = 184,
capset = 185,
sigaltstack = 186,
sendfile = 187,
getpmsg = 188,
putpmsg = 189,
vfork = 190,
ugetrlimit = 191,
mmap2 = 192,
truncate64 = 193,
ftruncate64 = 194,
stat64 = 195,
lstat64 = 196,
fstat64 = 197,
lchown32 = 198,
getuid32 = 199,
getgid32 = 200,
geteuid32 = 201,
getegid32 = 202,
setreuid32 = 203,
setregid32 = 204,
getgroups32 = 205,
setgroups32 = 206,
fchown32 = 207,
setresuid32 = 208,
getresuid32 = 209,
setresgid32 = 210,
getresgid32 = 211,
chown32 = 212,
setuid32 = 213,
setgid32 = 214,
setfsuid32 = 215,
setfsgid32 = 216,
pivot_root = 217,
mincore = 218,
madvise = 219,
getdents64 = 220,
fcntl64 = 221,
gettid = 224,
readahead = 225,
setxattr = 226,
lsetxattr = 227,
fsetxattr = 228,
getxattr = 229,
lgetxattr = 230,
fgetxattr = 231,
listxattr = 232,
llistxattr = 233,
flistxattr = 234,
removexattr = 235,
lremovexattr = 236,
fremovexattr = 237,
tkill = 238,
sendfile64 = 239,
futex = 240,
sched_setaffinity = 241,
sched_getaffinity = 242,
set_thread_area = 243,
get_thread_area = 244,
io_setup = 245,
io_destroy = 246,
io_getevents = 247,
io_submit = 248,
io_cancel = 249,
fadvise64 = 250,
exit_group = 252,
lookup_dcookie = 253,
epoll_create = 254,
epoll_ctl = 255,
epoll_wait = 256,
remap_file_pages = 257,
set_tid_address = 258,
timer_create = 259,
timer_settime = 260,
timer_gettime = 261,
timer_getoverrun = 262,
timer_delete = 263,
clock_settime = 264,
clock_gettime = 265,
clock_getres = 266,
clock_nanosleep = 267,
statfs64 = 268,
fstatfs64 = 269,
tgkill = 270,
utimes = 271,
fadvise64_64 = 272,
vserver = 273,
mbind = 274,
get_mempolicy = 275,
set_mempolicy = 276,
mq_open = 277,
mq_unlink = 278,
mq_timedsend = 279,
mq_timedreceive = 280,
mq_notify = 281,
mq_getsetattr = 282,
kexec_load = 283,
waitid = 284,
add_key = 286,
request_key = 287,
keyctl = 288,
ioprio_set = 289,
ioprio_get = 290,
inotify_init = 291,
inotify_add_watch = 292,
inotify_rm_watch = 293,
migrate_pages = 294,
openat = 295,
mkdirat = 296,
mknodat = 297,
fchownat = 298,
futimesat = 299,
fstatat64 = 300,
unlinkat = 301,
renameat = 302,
linkat = 303,
symlinkat = 304,
readlinkat = 305,
fchmodat = 306,
faccessat = 307,
pselect6 = 308,
ppoll = 309,
unshare = 310,
set_robust_list = 311,
get_robust_list = 312,
splice = 313,
sync_file_range = 314,
tee = 315,
vmsplice = 316,
move_pages = 317,
getcpu = 318,
epoll_pwait = 319,
utimensat = 320,
signalfd = 321,
timerfd_create = 322,
eventfd = 323,
fallocate = 324,
timerfd_settime = 325,
timerfd_gettime = 326,
signalfd4 = 327,
eventfd2 = 328,
epoll_create1 = 329,
dup3 = 330,
pipe2 = 331,
inotify_init1 = 332,
preadv = 333,
pwritev = 334,
prlimit64 = 340,
name_to_handle_at = 341,
open_by_handle_at = 342,
clock_adjtime = 343,
syncfs = 344,
sendmmsg = 345,
setns = 346,
process_vm_readv = 347,
process_vm_writev = 348,
kcmp = 349,
finit_module = 350,
sched_setattr = 351,
sched_getattr = 352,
renameat2 = 353,
seccomp = 354,
getrandom = 355,
memfd_create = 356,
}
}
return nr
| apache-2.0 |
UnfortunateFruit/darkstar | scripts/zones/Port_Windurst/npcs/Ohruru.lua | 19 | 4677 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Ohruru
-- Starts & Finishes Repeatable Quest: Catch me if you can
-- Working 90%
-- Involved in Quest: Wonder Wands
-- Note: Animation for his "Cure" is not functioning. Unable to capture option 1, so if the user says no, he heals them anyways.
-- @zone = 240
-- @pos = -108 -5 94
-----------------------------------
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/status");
require("scripts/zones/Port_Windurst/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- player:delQuest(WINDURST,CATCH_IT_IF_YOU_CAN); -- ======== FOR TESTING ONLY ==========-----
-- ======== FOR TESTING ONLY ==========-----
-- if (player:getVar("QuestCatchItIfYouCan_var") == 0 and player:hasStatusEffect(EFFECT_MUTE) == false and player:hasStatusEffect(EFFECT_BANE) == false and player:hasStatusEffect(EFFECT_PLAGUE) == false) then
-- rand = math.random(1,3);
-- if (rand == 1) then
-- player:addStatusEffect(EFFECT_MUTE,0,0,100);
-- elseif (rand == 2) then
-- player:addStatusEffect(EFFECT_BANE,0,0,100);
-- elseif (rand == 3) then
-- player:addStatusEffect(EFFECT_PLAGUE,0,0,100);
-- end
-- end
-- ======== FOR TESTING ONLY ==========-----
Catch = player:getQuestStatus(WINDURST,CATCH_IT_IF_YOU_CAN);
WonderWands = player:getQuestStatus(WINDURST,WONDER_WANDS);
if(WonderWands == QUEST_ACCEPTED) then
player:startEvent(0x0102,0,17053);
elseif (Catch == 0) then
prog = player:getVar("QuestCatchItIfYouCan_var");
if (prog == 0) then
player:startEvent(0x00e6); -- CATCH IT IF YOU CAN: Before Quest 1
player:setVar("QuestCatchItIfYouCan_var",1);
elseif (prog == 1) then
player:startEvent(0x00fd); -- CATCH IT IF YOU CAN: Before Start
player:setVar("QuestCatchItIfYouCan_var",2);
elseif (prog == 2) then
player:startEvent(0x00e7); -- CATCH IT IF YOU CAN: Before Quest 2
end
elseif (Catch >= 1 and (player:hasStatusEffect(EFFECT_MUTE) == true or player:hasStatusEffect(EFFECT_BANE) == true or player:hasStatusEffect(EFFECT_PLAGUE) == true)) then
player:startEvent(0x00f6); -- CATCH IT IF YOU CAN: Quest Turn In 1
elseif (Catch >= 1 and player:needToZone()) then
player:startEvent(0x00ff); -- CATCH IT IF YOU CAN: After Quest
elseif (Catch == 1 and player:hasStatusEffect(EFFECT_MUTE) == false and player:hasStatusEffect(EFFECT_BANE) == false and player:hasStatusEffect(EFFECT_PLAGUE) == false) then
rand = math.random(1,2);
if (rand == 1) then
player:startEvent(0x00f8); -- CATCH IT IF YOU CAN: During Quest 1
else
player:startEvent(0x00fb); -- CATCH IT IF YOU CAN: During Quest 2
end
elseif(WonderWands == QUEST_COMPLETED) then
player:startEvent(0x0109);
else
player:startEvent(0x00e6); -- STANDARD CONVERSATION
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 == 0x00e7) then
player:addQuest(WINDURST,CATCH_IT_IF_YOU_CAN);
elseif (csid == 0x00f6 and option == 0) then
player:needToZone(true);
if (player:hasStatusEffect(EFFECT_MUTE) == true) then
player:delStatusEffect(EFFECT_MUTE);
player:addGil(GIL_RATE*1000);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*1000);
elseif (player:hasStatusEffect(EFFECT_BANE) == true) then
player:delStatusEffect(EFFECT_BANE);
player:addGil(GIL_RATE*1200);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*1200);
elseif (player:hasStatusEffect(EFFECT_PLAGUE) == true) then
player:delStatusEffect(EFFECT_PLAGUE);
player:addGil(GIL_RATE*1500);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*1500);
end
player:setVar("QuestCatchItIfYouCan_var",0);
if (player:getQuestStatus(WINDURST,CATCH_IT_IF_YOU_CAN) == QUEST_ACCEPTED) then
player:completeQuest(WINDURST,CATCH_IT_IF_YOU_CAN);
player:addFame(WINDURST,WIN_FAME*75);
else
player:addFame(WINDURST,WIN_FAME*8);
end
end
end;
| gpl-3.0 |
tectronics/afrimesh | package-scripts/openwrt/afrimesh/files.provision/www/cgi-bin/provision.lua | 5 | 4062 | #!/usr/bin/lua
--[[ includes ]]------------------------------------------------------------
require "luarocks.require"
require "json"
-- http://wiki.openwrt.org/doc/devel/uci-lua
package.cpath = package.cpath .. ";/Users/antoine/afrimesh/ext/darwin/lib/lua5.1/?.so"
package.cpath = package.cpath .. ";/usr/share/lua/5.1/?.so"
uci = require("uci")
uci = uci.cursor()
--[[ utils ]]------------------------------------------------------------
require "common"
--[[ logging ]]------------------------------------------------------------
require "logging"
require "logging.file"
logname = "/tmp/provision.log"
os.pexecute("touch " .. logname)
os.pexecute("chmod 0666 " .. logname)
log = logging.file(logname)
if not log then
log = logging.file("/dev/null")
end
-- log:setLevel(logging.INFO)
log:setLevel(logging.DEBUG)
log:info("provision.lua starting")
--[[ definitions ]]---------------------------------------------------------
function readconf()
local factory = {
mode = "ahdemo",
ssid = "potato",
bssid = "01:CA:FF:EE:BA:BE",
channel = "1",
network = "10.130.1.0",
netmask = "255.255.255.0",
root = "10.130.1.1",
}
local wireless = { }
uci:foreach("wireless", "wifi-iface",
function(entry)
local wifi = {
device = entry.device,
ssid = entry.ssid,
bssid = entry.bssid,
mode = entry.mode
}
wifi.interface = uci:get("network", wifi.device, "ifname")
wifi.address = uci:get("network", wifi.device, "ipaddr")
wifi.mac = os.pexecute("ifconfig " .. wifi.interface .. " | grep HWaddr | awk '{ print $5 }'")
wifi.mac = string.upper(wifi.mac)
wifi.type = uci:get("wireless", wifi.device, "type")
wifi.channel = uci:get("wireless", wifi.device, "channel")
table.insert(wireless, wifi)
end)
local ethernet = { }
ethernet.interface = uci:get("network.lan.ifname")
ethernet.address = uci:get("network.lan.ipaddr")
ethernet.mac = os.pexecute("ifconfig " .. ethernet.interface .. " | grep HWaddr | awk '{ print $5 }'")
ethernet.mac = string.upper(ethernet.mac)
local conf = {
provision = "/cgi-bin/villagebus.lua/provision/router",
deviceid = uci:get("afrimesh.settings.deviceid") or "",
root = uci:get("afrimesh.settings.root") or factory.root,
wireless = wireless,
ethernet = ethernet,
factory = factory
}
return conf
end
--[[ main ]]----------------------------------------------------------------
function main(arg)
local conf = readconf();
log:info("root: " .. conf.root)
log:info("id: " .. conf.deviceid)
log:info("mac: " .. conf.wireless[1].mac)
log:info("address: " .. conf.wireless[1].address)
log:debug("conf : " .. json.encode(conf))
-- check if device has been provisioned
common.REST({ host = conf.root,
verb = "GET",
path = conf.provision,
query = {
deviceid = conf.deviceid,
mac = conf.wireless[1].mac,
address = conf.wireless[1].address
}
},
function(error, data)
if error then -- TODO
print("Fail: " .. error)
return
end
print("Got: " .. data)
end)
--[[
name="/cgi-bin/villagebus/db/provision:$self:mac"
REQUEST="GET $name HTTP/1.0
"
provisioned_mac=`echo -n "$REQUEST" | nc $root 80 | grep jsonp | cut -d\" -f 2`
echo "provisioned: $provisioned_mac"
echo
[ "$wifi0_mac" == "$provisioned_mac" ] && {
logger "$wifi0_mac ($self) already provisioned, exiting."
echo "$wifi0_mac ($self) already provisioned, exiting."
echo
exit
}
# nuke any existing deviceid
uci del afrimesh.settings.deviceid
uci commit
]]--
end
main(arg)
| bsd-3-clause |
vonflynee/opencomputersserver | world/opencomputers/6d437cc7-8fe8-4147-8a29-4c8b62fcedc7/bin/cp.lua | 13 | 3960 | local fs = require("filesystem")
local shell = require("shell")
local args, options = shell.parse(...)
if #args < 2 then
io.write("Usage: cp [-inrv] <from...> <to>\n")
io.write(" -i: prompt before overwrite (overrides -n option).\n")
io.write(" -n: do not overwrite an existing file.\n")
io.write(" -r: copy directories recursively.\n")
io.write(" -u: copy only when the SOURCE file differs from the destination\n")
io.write(" file or when the destination file is missing.\n")
io.write(" -v: verbose output.\n")
io.write(" -x: stay on original source file system.")
return
end
local from = {}
for i = 1, #args - 1 do
table.insert(from, shell.resolve(args[i]))
end
local to = shell.resolve(args[#args])
local function status(from, to)
if options.v then
io.write(from .. " -> " .. to .. "\n")
end
os.sleep(0) -- allow interrupting
end
local result, reason
local function prompt(message)
io.write(message .. " [Y/n]\n")
local result = io.read()
return result and (result == "" or result:sub(1, 1):lower() == "y")
end
local function areEqual(path1, path2)
local f1 = io.open(path1, "rb")
if not f1 then
return nil, "could not open `" .. path1 .. "' for update test"
end
local f2 = io.open(path2, "rb")
if not f2 then
f1:close()
return nil, "could not open `" .. path2 .. "' for update test"
end
local result = true
local chunkSize = 4 * 1024
repeat
local s1, s2 = f1:read(chunkSize), f2:read(chunkSize)
if s1 ~= s2 then
result = false
break
end
until not s1 or not s2
f1:close()
f2:close()
return result
end
local function isMount(path)
path = fs.canonical(path)
for _, mountPath in fs.mounts() do
if path == fs.canonical(mountPath) then
return true
end
end
end
local function recurse(fromPath, toPath)
status(fromPath, toPath)
if fs.isDirectory(fromPath) then
if not options.r then
io.write("omitting directory `" .. fromPath .. "'\n")
return true
end
if fs.canonical(fromPath) == fs.canonical(fs.path(toPath)) then
return nil, "cannot copy a directory, `" .. fromPath .. "', into itself, `" .. toPath .. "'\n"
end
if fs.exists(toPath) and not fs.isDirectory(toPath) then
-- my real cp always does this, even with -f, -n or -i.
return nil, "cannot overwrite non-directory `" .. toPath .. "' with directory `" .. fromPath .. "'"
end
if options.x and isMount(fromPath) then
return true
end
fs.makeDirectory(toPath)
for file in fs.list(fromPath) do
local result, reason = recurse(fs.concat(fromPath, file), fs.concat(toPath, file))
if not result then
return nil, reason
end
end
return true
else
if fs.exists(toPath) then
if fs.canonical(fromPath) == fs.canonical(toPath) then
return nil, "`" .. fromPath .. "' and `" .. toPath .. "' are the same file"
end
if fs.isDirectory(toPath) then
if options.i then
if not prompt("overwrite `" .. toPath .. "'?") then
return true
end
elseif options.n then
return true
else -- yes, even for -f
return nil, "cannot overwrite directory `" .. toPath .. "' with non-directory"
end
else
if options.u then
if areEqual(fromPath, toPath) then
return true
end
end
if options.i then
if not prompt("overwrite `" .. toPath .. "'?") then
return true
end
elseif options.n then
return true
end
-- else: default to overwriting
end
fs.remove(toPath)
end
return fs.copy(fromPath, toPath)
end
end
for _, fromPath in ipairs(from) do
local toPath = to
if fs.isDirectory(toPath) then
toPath = fs.concat(toPath, fs.name(fromPath))
end
result, reason = recurse(fromPath, toPath)
if not result then
error(reason, 0)
end
end | mit |
vonflynee/opencomputersserver | world/opencomputers/05fe03dc-84c6-416b-a304-6f79787f6411/bin/cp.lua | 13 | 3960 | local fs = require("filesystem")
local shell = require("shell")
local args, options = shell.parse(...)
if #args < 2 then
io.write("Usage: cp [-inrv] <from...> <to>\n")
io.write(" -i: prompt before overwrite (overrides -n option).\n")
io.write(" -n: do not overwrite an existing file.\n")
io.write(" -r: copy directories recursively.\n")
io.write(" -u: copy only when the SOURCE file differs from the destination\n")
io.write(" file or when the destination file is missing.\n")
io.write(" -v: verbose output.\n")
io.write(" -x: stay on original source file system.")
return
end
local from = {}
for i = 1, #args - 1 do
table.insert(from, shell.resolve(args[i]))
end
local to = shell.resolve(args[#args])
local function status(from, to)
if options.v then
io.write(from .. " -> " .. to .. "\n")
end
os.sleep(0) -- allow interrupting
end
local result, reason
local function prompt(message)
io.write(message .. " [Y/n]\n")
local result = io.read()
return result and (result == "" or result:sub(1, 1):lower() == "y")
end
local function areEqual(path1, path2)
local f1 = io.open(path1, "rb")
if not f1 then
return nil, "could not open `" .. path1 .. "' for update test"
end
local f2 = io.open(path2, "rb")
if not f2 then
f1:close()
return nil, "could not open `" .. path2 .. "' for update test"
end
local result = true
local chunkSize = 4 * 1024
repeat
local s1, s2 = f1:read(chunkSize), f2:read(chunkSize)
if s1 ~= s2 then
result = false
break
end
until not s1 or not s2
f1:close()
f2:close()
return result
end
local function isMount(path)
path = fs.canonical(path)
for _, mountPath in fs.mounts() do
if path == fs.canonical(mountPath) then
return true
end
end
end
local function recurse(fromPath, toPath)
status(fromPath, toPath)
if fs.isDirectory(fromPath) then
if not options.r then
io.write("omitting directory `" .. fromPath .. "'\n")
return true
end
if fs.canonical(fromPath) == fs.canonical(fs.path(toPath)) then
return nil, "cannot copy a directory, `" .. fromPath .. "', into itself, `" .. toPath .. "'\n"
end
if fs.exists(toPath) and not fs.isDirectory(toPath) then
-- my real cp always does this, even with -f, -n or -i.
return nil, "cannot overwrite non-directory `" .. toPath .. "' with directory `" .. fromPath .. "'"
end
if options.x and isMount(fromPath) then
return true
end
fs.makeDirectory(toPath)
for file in fs.list(fromPath) do
local result, reason = recurse(fs.concat(fromPath, file), fs.concat(toPath, file))
if not result then
return nil, reason
end
end
return true
else
if fs.exists(toPath) then
if fs.canonical(fromPath) == fs.canonical(toPath) then
return nil, "`" .. fromPath .. "' and `" .. toPath .. "' are the same file"
end
if fs.isDirectory(toPath) then
if options.i then
if not prompt("overwrite `" .. toPath .. "'?") then
return true
end
elseif options.n then
return true
else -- yes, even for -f
return nil, "cannot overwrite directory `" .. toPath .. "' with non-directory"
end
else
if options.u then
if areEqual(fromPath, toPath) then
return true
end
end
if options.i then
if not prompt("overwrite `" .. toPath .. "'?") then
return true
end
elseif options.n then
return true
end
-- else: default to overwriting
end
fs.remove(toPath)
end
return fs.copy(fromPath, toPath)
end
end
for _, fromPath in ipairs(from) do
local toPath = to
if fs.isDirectory(toPath) then
toPath = fs.concat(toPath, fs.name(fromPath))
end
result, reason = recurse(fromPath, toPath)
if not result then
error(reason, 0)
end
end | mit |
ystk/tools-yocto1-rpm | syck/ext/lua/test.lua | 1 | 2332 |
require "yaml"
require "lunit"
lunit.import "all"
local testcase = lunit.TestCase("LuaYAML Testcases")
function testcase.test_load()
assert_error(function() syck.load() end)
assert_nil(syck.load("--- "))
assert_true(syck.load("--- true"))
assert_false(syck.load("--- false"))
assert_equal(10, syck.load("--- 10"))
local t = syck.load("--- \n- 5\n- 10\n- 15")
assert_equal(5, t[1])
assert_equal(10, t[2])
assert_equal(15, t[3])
local t = syck.load("--- \n- one\n- two\n- three")
assert_equal("one", t[1])
assert_equal("two", t[2])
assert_equal("three", t[3])
local t = syck.load("--- \nthree: 15\ntwo: 10\none: 5")
assert_equal(5, t.one)
assert_equal(10, t.two)
assert_equal(15, t.three)
local t = syck.load("--- \nints: \n - 1\n - 2\n - 3\nmaps: \n three: 3\n two: 2\n one: 1\nstrings: \n - one\n - two\n - three")
assert_equal(1, t.ints[1])
assert_equal(2, t.ints[2])
assert_equal(3, t.ints[3])
assert_equal(1, t.maps.one)
assert_equal(2, t.maps.two)
assert_equal(3, t.maps.three)
assert_equal("one", t.strings[1])
assert_equal("two", t.strings[2])
assert_equal("three", t.strings[3])
end
function testcase.test_dump()
assert_equal("--- \n", syck.dump(nil))
assert_equal("--- hey\n", syck.dump("hey"))
assert_equal("--- 5\n", syck.dump(5))
assert_equal("--- true\n", syck.dump(true))
assert_equal("--- false\n", syck.dump(false))
assert_equal("--- \n- 5\n- 6\n- 7\n", syck.dump({5, 6, 7}))
local str = "--- \n- \n - 1\n - 2\n - 3\n- \n - 6\n - 7\n - 8\n"
assert_equal(str, syck.dump({{1, 2, 3}, {6, 7, 8}}))
local str = "--- \n- \n - 1\n - 2\n - 3\n- \n - one\n - two\n - three\n"
assert_equal(str, syck.dump({{1, 2, 3}, {"one", "two", "three"}}))
local str = "--- \none: 1\nthree: 3\ntwo: 2\n"
assert_equal(str, syck.dump({one=1, two=2, three=3}))
end
function testcase.test_file()
local file = "test.dump"
local f = assert(io.open(file, "w"))
local obj = {5, 6, "hello"}
yaml.dump(obj, f)
f:close()
local obj2, err = yaml.load_file(file)
assert_nil(err)
assert_equal(5, obj2[1])
assert_equal(6, obj2[2])
assert_equal("hello", obj2[3])
os.remove(file)
yaml.dump_file(obj, file)
local obj2, err = yaml.load_file(file)
assert_nil(err)
assert_equal(5, obj2[1])
assert_equal(6, obj2[2])
assert_equal("hello", obj2[3])
end
os.exit(lunit.run())
| lgpl-2.1 |
nesstea/darkstar | scripts/globals/pets.lua | 15 | 34924 | -----------------------------------
--
-- PETS ID
--
-----------------------------------
-----------------------------------
-- PETTYPE
-----------------------------------
PETTYPE_AVATAR = 0;
PETTYPE_WYVERN = 1;
PETTYPE_JUGPET = 2;
PETTYPE_CHARMED_MOB = 3;
PETTYPE_AUTOMATON = 4;
PETTYPE_ADVENTURING_FELLOW= 5;
PETTYPE_CHOCOBO = 6;
-----------------------------------
-- PETNAME
-----------------------------------
PETNAME_AZURE = 1;
PETNAME_CERULEAN = 2;
PETNAME_RYGOR = 3;
PETNAME_FIREWING = 4;
PETNAME_DELPHYNE = 5;
PETNAME_EMBER = 6;
PETNAME_ROVER = 7;
PETNAME_MAX = 8;
PETNAME_BUSTER = 9;
PETNAME_DUKE = 10;
PETNAME_OSCAR = 11;
PETNAME_MAGGIE = 12;
PETNAME_JESSIE = 13;
PETNAME_LADY = 14;
PETNAME_HIEN = 15;
PETNAME_RAIDEN = 16;
PETNAME_LUMIERE = 17;
PETNAME_EISENZAHN = 18;
PETNAME_PFEIL = 19;
PETNAME_WUFFI = 20;
PETNAME_GEORGE = 21;
PETNAME_DONRYU = 22;
PETNAME_QIQIRU = 23;
PETNAME_KARAV_MARAV = 24;
PETNAME_OBORO = 25;
PETNAME_DARUG_BORUG = 26;
PETNAME_MIKAN = 27;
PETNAME_VHIKI = 28;
PETNAME_SASAVI = 29;
PETNAME_TATANG = 30;
PETNAME_NANAJA = 31;
PETNAME_KHOCHA = 32;
PETNAME_DINO = 33;
PETNAME_CHOMPER = 34;
PETNAME_HUFFY = 35;
PETNAME_POUNCER = 36;
PETNAME_FIDO = 37;
PETNAME_LUCY = 38;
PETNAME_JAKE = 39;
PETNAME_ROCKY = 40;
PETNAME_REX = 41;
PETNAME_RUSTY = 42;
PETNAME_HIMMELSKRALLE = 43;
PETNAME_GIZMO = 44;
PETNAME_SPIKE = 45;
PETNAME_SYLVESTER = 46;
PETNAME_MILO = 47;
PETNAME_TOM = 48;
PETNAME_TOBY = 49;
PETNAME_FELIX = 50;
PETNAME_KOMET = 51;
PETNAME_BO = 52;
PETNAME_MOLLY = 53;
PETNAME_UNRYU = 54;
PETNAME_DAISY = 55;
PETNAME_BARON = 56;
PETNAME_GINGER = 57;
PETNAME_MUFFIN = 58;
PETNAME_LUMINEUX = 59;
PETNAME_QUATREVENTS = 60;
PETNAME_TORYU = 61;
PETNAME_TATABA = 62;
PETNAME_ETOILAZUREE = 63;
PETNAME_GRISNUAGE = 64;
PETNAME_BELORAGE = 65;
PETNAME_CENTONNERRE = 66;
PETNAME_NOUVELLUNE = 67;
PETNAME_MISSY = 68;
PETNAME_AMEDEO = 69;
PETNAME_TRANCHEVENT = 70;
PETNAME_SOUFFLEFEU = 71;
PETNAME_ETOILE = 72;
PETNAME_TONNERRE = 73;
PETNAME_NUAGE = 74;
PETNAME_FOUDRE = 75;
PETNAME_HYUH = 76;
PETNAME_ORAGE = 77;
PETNAME_LUNE = 78;
PETNAME_ASTRE = 79;
PETNAME_WAFFENZAHN = 80;
PETNAME_SOLEIL = 81;
PETNAME_COURAGEUX = 82;
PETNAME_KOFFLA_PAFFLA = 83;
PETNAME_VENTEUSE = 84;
PETNAME_LUNAIRE = 85;
PETNAME_TORA = 86;
PETNAME_CELESTE = 87;
PETNAME_GALJA_MOGALJA = 88;
PETNAME_GABOH = 89;
PETNAME_VHYUN = 90;
PETNAME_ORAGEUSE = 91;
PETNAME_STELLAIRE = 92;
PETNAME_SOLAIRE = 93;
PETNAME_WIRBELWIND = 94;
PETNAME_BLUTKRALLE = 95;
PETNAME_BOGEN = 96;
PETNAME_JUNKER = 97;
PETNAME_FLINK = 98;
PETNAME_KNIRPS = 99;
PETNAME_BODO = 100;
PETNAME_SORYU = 101;
PETNAME_WAWARO = 102;
PETNAME_TOTONA = 103;
PETNAME_LEVIAN_MOVIAN = 104;
PETNAME_KAGERO = 105;
PETNAME_JOSEPH = 106;
PETNAME_PAPARAL = 107;
PETNAME_COCO = 108;
PETNAME_RINGO = 109;
PETNAME_NONOMI = 110;
PETNAME_TETER = 111;
PETNAME_GIGIMA = 112;
PETNAME_GOGODAVI = 113;
PETNAME_RURUMO = 114;
PETNAME_TUPAH = 115;
PETNAME_JYUBIH = 116;
PETNAME_MAJHA = 117;
PETNAME_LURON = 118;
PETNAME_DRILLE = 119;
PETNAME_TOURNEFOUX = 120;
PETNAME_CHAFOUIN = 121;
PETNAME_PLAISANTIN = 122;
PETNAME_LOUSTIC = 123;
PETNAME_HISTRION = 124;
PETNAME_BOBECHE = 125;
PETNAME_BOUGRION = 126;
PETNAME_ROULETEAU = 127;
PETNAME_ALLOUETTE = 128;
PETNAME_SERENADE = 129;
PETNAME_FICELETTE = 130;
PETNAME_TOCADIE = 131;
PETNAME_CAPRICE = 132;
PETNAME_FOUCADE = 133;
PETNAME_CAPILLOTTE = 134;
PETNAME_QUENOTTE = 135;
PETNAME_PACOTILLE = 136;
PETNAME_COMEDIE = 137;
PETNAME_KAGEKIYO = 138;
PETNAME_TORAOH = 139;
PETNAME_GENTA = 140;
PETNAME_KINTOKI = 141;
PETNAME_KOUMEI = 142;
PETNAME_PAMAMA = 143;
PETNAME_LOBO = 144;
PETNAME_TSUKUSHI = 145;
PETNAME_ONIWAKA = 146;
PETNAME_KENBISHI = 147;
PETNAME_HANNYA = 148;
PETNAME_MASHIRA = 149;
PETNAME_NADESHIKO = 150;
PETNAME_E100 = 151;
PETNAME_KOUME = 152;
PETNAME_X_32 = 153;
PETNAME_POPPO = 154;
PETNAME_ASUKA = 155;
PETNAME_SAKURA = 156;
PETNAME_TAO = 157;
PETNAME_MAO = 158;
PETNAME_GADGET = 159;
PETNAME_MARION = 160;
PETNAME_WIDGET = 161;
PETNAME_QUIRK = 162;
PETNAME_SPROCKET = 163;
PETNAME_COGETTE = 164;
PETNAME_LECTER = 165;
PETNAME_COPPELIA = 166;
PETNAME_SPARKY = 167;
PETNAME_CLANK = 168;
PETNAME_CALCOBRENA = 169;
PETNAME_CRACKLE = 170;
PETNAME_RICOCHET = 171;
PETNAME_JOSETTE = 172;
PETNAME_FRITZ = 173;
PETNAME_SKIPPY = 174;
PETNAME_PINO = 175;
PETNAME_MANDARIN = 176;
PETNAME_JACKSTRAW = 177;
PETNAME_GUIGNOL = 178;
PETNAME_MOPPET = 179;
PETNAME_NUTCRACKER = 180;
PETNAME_ERWIN = 181;
PETNAME_OTTO = 182;
PETNAME_GUSTAV = 183;
PETNAME_MUFFIN = 184;
PETNAME_XAVER = 185;
PETNAME_TONI = 186;
PETNAME_INA = 187;
PETNAME_GERDA = 188;
PETNAME_PETRA = 189;
PETNAME_VERENA = 190;
PETNAME_ROSI = 191;
PETNAME_SCHATZI = 192;
PETNAME_WARASHI = 193;
PETNAME_KLINGEL = 194;
PETNAME_CLOCHETTE = 195;
PETNAME_CAMPANELLO = 196;
PETNAME_KAISERIN = 197;
PETNAME_PRINCIPESSA = 198;
PETNAME_BUTLER = 199;
PETNAME_GRAF = 200;
PETNAME_CARO = 201;
PETNAME_CARA = 202;
PETNAME_MADEMOISELLE = 203;
PETNAME_HERZOG = 204;
PETNAME_TRAMP = 205;
PETNAME_V_1000 = 206;
PETNAME_HIKOZAEMON = 207;
PETNAME_NINE = 208;
PETNAME_ACHT = 209;
PETNAME_QUATTRO = 210;
PETNAME_ZERO = 211;
PETNAME_DREIZEHN = 212;
PETNAME_SEIZE = 213;
PETNAME_FUKUSUKE = 214;
PETNAME_MATAEMON = 215;
PETNAME_KANSUKE = 216;
PETNAME_POLICHINELLE = 217;
PETNAME_TOBISUKE = 218;
PETNAME_SASUKE = 219;
PETNAME_SHIJIMI = 220;
PETNAME_CHOBI = 221;
PETNAME_AURELIE = 222;
PETNAME_MAGALIE = 223;
PETNAME_AURORE = 224;
PETNAME_CAROLINE = 225;
PETNAME_ANDREA = 226;
PETNAME_MACHINETTE = 227;
PETNAME_CLARINE = 228;
PETNAME_ARMELLE = 229;
PETNAME_REINETTE = 230;
PETNAME_DORLOTE = 231;
PETNAME_TURLUPIN = 232;
PETNAME_KLAXON = 233;
PETNAME_BAMBINO = 234;
PETNAME_POTIRON = 235;
PETNAME_FUSTIGE = 236;
PETNAME_AMIDON = 237;
PETNAME_MACHIN = 238;
PETNAME_BIDULON = 239;
PETNAME_TANDEM = 240;
PETNAME_PRESTIDIGE = 241;
PETNAME_PURUTE_PORUTE = 242;
PETNAME_BITO_RABITO = 243;
PETNAME_COCOA = 244;
PETNAME_TOTOMO = 245;
PETNAME_CENTURION = 246;
PETNAME_A7V = 247;
PETNAME_SCIPIO = 248;
PETNAME_SENTINEL = 249;
PETNAME_PIONEER = 250;
PETNAME_SENESCHAL = 251;
PETNAME_GINJIN = 252;
PETNAME_AMAGATSU = 253;
PETNAME_DOLLY = 254;
PETNAME_FANTOCCINI = 255;
PETNAME_JOE = 256;
PETNAME_KIKIZARU = 257;
PETNAME_WHIPPET = 258;
PETNAME_PUNCHINELLO = 259;
PETNAME_CHARLIE = 260;
PETNAME_MIDGE = 261;
PETNAME_PETROUCHKA = 262;
PETNAME_SCHNEIDER = 263;
PETNAME_USHABTI = 264;
PETNAME_NOEL = 265;
PETNAME_YAJIROBE = 266;
PETNAME_HINA = 267;
PETNAME_NORA = 268;
PETNAME_SHOKI = 269;
PETNAME_KOBINA = 270;
PETNAME_KOKESHI = 271;
PETNAME_MAME = 272;
PETNAME_BISHOP = 273;
PETNAME_MARVIN = 274;
PETNAME_DORA = 275;
PETNAME_DATA = 276;
PETNAME_ROBIN = 277;
PETNAME_ROBBY = 278;
PETNAME_PORLO_MOPERLO = 279;
PETNAME_PAROKO_PURONKO= 280;
PETNAME_PIPIMA = 281;
PETNAME_GAGAJA = 282;
PETNAME_MOBIL = 283;
PETNAME_DONZEL = 284;
PETNAME_ARCHER = 285;
PETNAME_SHOOTER = 286;
PETNAME_STEPHEN = 287;
PETNAME_MK_IV = 288;
PETNAME_CONJURER = 289;
PETNAME_FOOTMAN = 290;
PETNAME_TOKOTOKO = 291;
PETNAME_SANCHO = 292;
PETNAME_SARUMARO = 293;
PETNAME_PICKET = 294;
PETNAME_MUSHROOM = 295;
PETNAME_G = 296;
PETNAME_I = 297;
PETNAME_Q = 298;
PETNAME_V = 299;
PETNAME_X = 300;
PETNAME_Z = 301;
PETNAME_II = 302;
PETNAME_IV = 303;
PETNAME_IX = 304;
PETNAME_OR = 305;
PETNAME_VI = 306;
PETNAME_XI = 307;
PETNAME_ACE = 308;
PETNAME_AIR = 309;
PETNAME_AKI = 310;
PETNAME_AYU = 311;
PETNAME_BAT = 312;
PETNAME_BEC = 313;
PETNAME_BEL = 314;
PETNAME_BIG = 315;
PETNAME_BON = 316;
PETNAME_BOY = 317;
PETNAME_CAP = 318;
PETNAME_COQ = 319;
PETNAME_CRY = 320;
PETNAME_DOM = 321;
PETNAME_DUC = 322;
PETNAME_DUN = 323;
PETNAME_END = 324;
PETNAME_ETE = 325;
PETNAME_EYE = 326;
PETNAME_FAT = 327;
PETNAME_FEE = 328;
PETNAME_FER = 329;
PETNAME_FEU = 330;
PETNAME_FOG = 331;
PETNAME_FOX = 332;
PETNAME_HOT = 333;
PETNAME_ICE = 334;
PETNAME_ICE = 335;
PETNAME_ICY = 336;
PETNAME_III = 337;
PETNAME_JET = 338;
PETNAME_JOY = 339;
PETNAME_LEG = 340;
PETNAME_MAX = 341;
PETNAME_NEO = 342;
PETNAME_ONE = 343;
PETNAME_PUR = 344;
PETNAME_RAY = 345;
PETNAME_RED = 346;
PETNAME_ROI = 347;
PETNAME_SEA = 348;
PETNAME_SKY = 349;
PETNAME_SUI = 350;
PETNAME_SUN = 351;
PETNAME_TEN = 352;
PETNAME_VIF = 353;
PETNAME_VII = 354;
PETNAME_XII = 355;
PETNAME_AILE = 356;
PETNAME_ANGE = 357;
PETNAME_ARDI = 358;
PETNAME_BEAK = 359;
PETNAME_BEAU = 360;
PETNAME_BEST = 361;
PETNAME_BLEU = 362;
PETNAME_BLUE = 363;
PETNAME_BONE = 364;
PETNAME_CART = 365;
PETNAME_CHIC = 366;
PETNAME_CIEL = 367;
PETNAME_CLAW = 368;
PETNAME_COOL = 369;
PETNAME_DAME = 370;
PETNAME_DARK = 371;
PETNAME_DORE = 372;
PETNAME_DRAY = 373;
PETNAME_DUKE = 374;
PETNAME_EASY = 375;
PETNAME_EDEL = 376;
PETNAME_FACE = 377;
PETNAME_FAST = 378;
PETNAME_FIER = 379;
PETNAME_FINE = 380;
PETNAME_FIRE = 381;
PETNAME_FOOT = 382;
PETNAME_FURY = 383;
PETNAME_FUYU = 384;
PETNAME_GALE = 385;
PETNAME_GIRL = 386;
PETNAME_GOER = 387;
PETNAME_GOLD = 388;
PETNAME_GOOD = 389;
PETNAME_GRAF = 390;
PETNAME_GRAY = 391;
PETNAME_GUST = 392;
PETNAME_GUTE = 393;
PETNAME_HAOH = 394;
PETNAME_HARU = 395;
PETNAME_HELD = 396;
PETNAME_HERO = 397;
PETNAME_HOPE = 398;
PETNAME_IDOL = 399;
PETNAME_IRIS = 400;
PETNAME_IRON = 401;
PETNAME_JACK = 402;
PETNAME_JADE = 403;
PETNAME_JOLI = 404;
PETNAME_JUNG = 405;
PETNAME_KIKU = 406;
PETNAME_KING = 407;
PETNAME_KOPF = 408;
PETNAME_LADY = 409;
PETNAME_LAST = 410;
PETNAME_LILI = 411;
PETNAME_LILY = 412;
PETNAME_LINE = 413;
PETNAME_LONG = 414;
PETNAME_LORD = 415;
PETNAME_LUFT = 416;
PETNAME_LUNA = 417;
PETNAME_LUNE = 418;
PETNAME_MAMA = 419;
PETNAME_MARS = 420;
PETNAME_MIEL = 421;
PETNAME_MISS = 422;
PETNAME_MOMO = 423;
PETNAME_MOND = 424;
PETNAME_MOON = 425;
PETNAME_NANA = 426;
PETNAME_NICE = 427;
PETNAME_NOIR = 428;
PETNAME_NONO = 429;
PETNAME_NOVA = 430;
PETNAME_NUIT = 431;
PETNAME_OCRE = 432;
PETNAME_OLLE = 433;
PETNAME_PAPA = 434;
PETNAME_PERS = 435;
PETNAME_PHAR = 436;
PETNAME_PONY = 437;
PETNAME_PURE = 438;
PETNAME_RAIN = 439;
PETNAME_RICE = 440;
PETNAME_RICH = 441;
PETNAME_ROAD = 442;
PETNAME_ROSE = 443;
PETNAME_ROTE = 444;
PETNAME_ROUX = 445;
PETNAME_RUBY = 446;
PETNAME_SAGE = 447;
PETNAME_SNOW = 448;
PETNAME_STAR = 449;
PETNAME_TAIL = 450;
PETNAME_TROT = 451;
PETNAME_VEGA = 452;
PETNAME_VENT = 453;
PETNAME_VERT = 454;
PETNAME_VIII = 455;
PETNAME_VIVE = 456;
PETNAME_WAVE = 457;
PETNAME_WEST = 458;
PETNAME_WILD = 459;
PETNAME_WIND = 460;
PETNAME_WING = 461;
PETNAME_XIII = 462;
PETNAME_ZERO = 463;
PETNAME_ACIER = 464;
PETNAME_AGATE = 465;
PETNAME_AGILE = 466;
PETNAME_AGNES = 467;
PETNAME_AILEE = 468;
PETNAME_ALPHA = 469;
PETNAME_AMBER = 470;
PETNAME_AMBRE = 471;
PETNAME_ANGEL = 472;
PETNAME_ARDIE = 473;
PETNAME_ARKIE = 474;
PETNAME_ARROW = 475;
PETNAME_AVIAN = 476;
PETNAME_AZURE = 477;
PETNAME_BARON = 478;
PETNAME_BELLE = 479;
PETNAME_BERYL = 480;
PETNAME_BLACK = 481;
PETNAME_BLADE = 482;
PETNAME_BLAUE = 483;
PETNAME_BLAZE = 484;
PETNAME_BLEUE = 485;
PETNAME_BLITZ = 486;
PETNAME_BLOND = 487;
PETNAME_BLOOD = 488;
PETNAME_BONNE = 489;
PETNAME_BRAVE = 490;
PETNAME_BRIAN = 491;
PETNAME_BRISE = 492;
PETNAME_BURST = 493;
PETNAME_CALME = 494;
PETNAME_CHAOS = 495;
PETNAME_CLAIR = 496;
PETNAME_CLOUD = 497;
PETNAME_COMET = 498;
PETNAME_COMTE = 499;
PETNAME_COURT = 500;
PETNAME_CRAFT = 501;
PETNAME_CRETE = 502;
PETNAME_CROWN = 503;
PETNAME_DANCE = 504;
PETNAME_DANDY = 505;
PETNAME_DEVIL = 506;
PETNAME_DIANA = 507;
PETNAME_DOREE = 508;
PETNAME_DREAM = 509;
PETNAME_EAGER = 510;
PETNAME_EAGLE = 511;
PETNAME_EBONY = 512;
PETNAME_EISEN = 513;
PETNAME_EMBER = 514;
PETNAME_ENGEL = 515;
PETNAME_FAIRY = 516;
PETNAME_FATTY = 517;
PETNAME_FEDER = 518;
PETNAME_FEUER = 519;
PETNAME_FIERE = 520;
PETNAME_FIERY = 521;
PETNAME_FINAL = 522;
PETNAME_FLARE = 523;
PETNAME_FLEET = 524;
PETNAME_FLEUR = 525;
PETNAME_FLIER = 526;
PETNAME_FLOOD = 527;
PETNAME_FLORA = 528;
PETNAME_FLYER = 529;
PETNAME_FRAIS = 530;
PETNAME_FROST = 531;
PETNAME_FUCHS = 532;
PETNAME_GALOP = 533;
PETNAME_GEIST = 534;
PETNAME_GELBE = 535;
PETNAME_GHOST = 536;
PETNAME_GLORY = 537;
PETNAME_GRAND = 538;
PETNAME_GREAT = 539;
PETNAME_GREEN = 540;
PETNAME_GUTER = 541;
PETNAME_GUTES = 542;
PETNAME_HEART = 543;
PETNAME_HELLE = 544;
PETNAME_HIDEN = 545;
PETNAME_HITEN = 546;
PETNAME_HIVER = 547;
PETNAME_HOBBY = 548;
PETNAME_HYPER = 549;
PETNAME_IVORY = 550;
PETNAME_JAUNE = 551;
PETNAME_JEUNE = 552;
PETNAME_JINPU = 553;
PETNAME_JOLIE = 554;
PETNAME_JOLLY = 555;
PETNAME_KLUGE = 556;
PETNAME_KNIFE = 557;
PETNAME_KOMET = 558;
PETNAME_KUGEL = 559;
PETNAME_LAHME = 560;
PETNAME_LESTE = 561;
PETNAME_LIGHT = 562;
PETNAME_LILAS = 563;
PETNAME_LUCKY = 564;
PETNAME_LUNAR = 565;
PETNAME_LUTIN = 566;
PETNAME_MAGIC = 567;
PETNAME_MERRY = 568;
PETNAME_METAL = 569;
PETNAME_NATSU = 570;
PETNAME_NEDDY = 571;
PETNAME_NIGHT = 572;
PETNAME_NINJA = 573;
PETNAME_NOBLE = 574;
PETNAME_NOIRE = 575;
PETNAME_NUAGE = 576;
PETNAME_OCREE = 577;
PETNAME_OLIVE = 578;
PETNAME_OLLER = 579;
PETNAME_OLLES = 580;
PETNAME_OMEGA = 581;
PETNAME_OPALE = 582;
PETNAME_ORAGE = 583;
PETNAME_PATTE = 584;
PETNAME_PEACE = 585;
PETNAME_PENNE = 586;
PETNAME_PETIT = 587;
PETNAME_PFEIL = 588;
PETNAME_PLUIE = 589;
PETNAME_PLUME = 590;
PETNAME_PLUTO = 591;
PETNAME_POINT = 592;
PETNAME_POMME = 593;
PETNAME_POWER = 594;
PETNAME_QUAKE = 595;
PETNAME_QUEEN = 596;
PETNAME_QUEUE = 597;
PETNAME_REINE = 598;
PETNAME_REPPU = 599;
PETNAME_RICHE = 600;
PETNAME_RIEUR = 601;
PETNAME_ROTER = 602;
PETNAME_ROTES = 603;
PETNAME_ROUGE = 604;
PETNAME_ROYAL = 605;
PETNAME_RUBIN = 606;
PETNAME_RUBIS = 607;
PETNAME_SAURE = 608;
PETNAME_SERRE = 609;
PETNAME_SMALT = 610;
PETNAME_SNOWY = 611;
PETNAME_SOLAR = 612;
PETNAME_SPARK = 613;
PETNAME_SPEED = 614;
PETNAME_STEED = 615;
PETNAME_STERN = 616;
PETNAME_STONE = 617;
PETNAME_STORM = 618;
PETNAME_STURM = 619;
PETNAME_STUTE = 620;
PETNAME_SUPER = 621;
PETNAME_SWEEP = 622;
PETNAME_SWEET = 623;
PETNAME_SWIFT = 624;
PETNAME_TALON = 625;
PETNAME_TEIOH = 626;
PETNAME_TITAN = 627;
PETNAME_TURBO = 628;
PETNAME_ULTRA = 629;
PETNAME_URARA = 630;
PETNAME_VENUS = 631;
PETNAME_VERTE = 632;
PETNAME_VERVE = 633;
PETNAME_VIVID = 634;
PETNAME_VOGEL = 635;
PETNAME_YOUNG = 636;
PETNAME_ZIPPY = 637;
PETNAME_AIRAIN = 638;
PETNAME_AMBREE = 639;
PETNAME_AMIRAL = 640;
PETNAME_ARASHI = 641;
PETNAME_ARCHER = 642;
PETNAME_ARDENT = 643;
PETNAME_ARGENT = 644;
PETNAME_AUDACE = 645;
PETNAME_AUTUMN = 646;
PETNAME_BATTLE = 647;
PETNAME_BEAUTE = 648;
PETNAME_BEAUTY = 649;
PETNAME_BEETLE = 650;
PETNAME_BLAUER = 651;
PETNAME_BLAUES = 652;
PETNAME_BLEUET = 653;
PETNAME_BLONDE = 654;
PETNAME_BONBON = 655;
PETNAME_BREEZE = 656;
PETNAME_BRONZE = 657;
PETNAME_BRUMBY = 658;
PETNAME_BUCKER = 659;
PETNAME_CAESAR = 660;
PETNAME_CARMIN = 661;
PETNAME_CERISE = 662;
PETNAME_CERULE = 663;
PETNAME_CHANCE = 664;
PETNAME_CINDER = 665;
PETNAME_CITRON = 666;
PETNAME_CLAIRE = 667;
PETNAME_COBALT = 668;
PETNAME_CORAIL = 669;
PETNAME_COURTE = 670;
PETNAME_CUIVRE = 671;
PETNAME_DANCER = 672;
PETNAME_DARING = 673;
PETNAME_DESERT = 674;
PETNAME_DOBBIN = 675;
PETNAME_DUNKLE = 676;
PETNAME_ELANCE = 677;
PETNAME_EMBLEM = 678;
PETNAME_ENZIAN = 679;
PETNAME_ESPRIT = 680;
PETNAME_ETOILE = 681;
PETNAME_FILANT = 682;
PETNAME_FLAMME = 683;
PETNAME_FLECHE = 684;
PETNAME_FLIGHT = 685;
PETNAME_FLINKE = 686;
PETNAME_FLOWER = 687;
PETNAME_FLURRY = 688;
PETNAME_FLYING = 689;
PETNAME_FOREST = 690;
PETNAME_FREEZE = 691;
PETNAME_FREUND = 692;
PETNAME_FRIEND = 693;
PETNAME_FROSTY = 694;
PETNAME_FROZEN = 695;
PETNAME_FUBUKI = 696;
PETNAME_GALAXY = 697;
PETNAME_GANGER = 698;
PETNAME_GELBER = 699;
PETNAME_GELBES = 700;
PETNAME_GINGER = 701;
PETNAME_GLOIRE = 702;
PETNAME_GLORIE = 703;
PETNAME_GOEMON = 704;
PETNAME_GRANDE = 705;
PETNAME_GRENAT = 706;
PETNAME_GROOVE = 707;
PETNAME_GROSSE = 708;
PETNAME_GRUENE = 709;
PETNAME_GUSTAV = 710;
PETNAME_HAYATE = 711;
PETNAME_HELDIN = 712;
PETNAME_HELLER = 713;
PETNAME_HELLES = 714;
PETNAME_HENGST = 715;
PETNAME_HERMES = 716;
PETNAME_HERZOG = 717;
PETNAME_HIMMEL = 718;
PETNAME_HUMBLE = 719;
PETNAME_IDATEN = 720;
PETNAME_IMPACT = 721;
PETNAME_INDIGO = 722;
PETNAME_JAGGER = 723;
PETNAME_JASMIN = 724;
PETNAME_JOYEUX = 725;
PETNAME_JUNGLE = 726;
PETNAME_KAISER = 727;
PETNAME_KEFFEL = 728;
PETNAME_KLEINE = 729;
PETNAME_KLUGER = 730;
PETNAME_KLUGES = 731;
PETNAME_KOLOSS = 732;
PETNAME_LAHMER = 733;
PETNAME_LAHMES = 734;
PETNAME_LANCER = 735;
PETNAME_LANDER = 736;
PETNAME_LAUREL = 737;
PETNAME_LEAPER = 738;
PETNAME_LEGEND = 739;
PETNAME_LIMBER = 740;
PETNAME_LONGUE = 741;
PETNAME_MELODY = 742;
PETNAME_METEOR = 743;
PETNAME_MIRAGE = 744;
PETNAME_MISTER = 745;
PETNAME_MOTION = 746;
PETNAME_MUGUET = 747;
PETNAME_NATURE = 748;
PETNAME_NEBULA = 749;
PETNAME_NETHER = 750;
PETNAME_NIMBLE = 751;
PETNAME_OLYMPE = 752;
PETNAME_ORCHID = 753;
PETNAME_OUTLAW = 754;
PETNAME_PASSER = 755;
PETNAME_PASTEL = 756;
PETNAME_PELTER = 757;
PETNAME_PENSEE = 758;
PETNAME_PETITE = 759;
PETNAME_PIMENT = 760;
PETNAME_POETIC = 761;
PETNAME_POULET = 762;
PETNAME_PRESTE = 763;
PETNAME_PRETTY = 764;
PETNAME_PRINCE = 765;
PETNAME_PURETE = 766;
PETNAME_QUARTZ = 767;
PETNAME_QUASAR = 768;
PETNAME_RAFALE = 769;
PETNAME_RAGING = 770;
PETNAME_RAIDEN = 771;
PETNAME_RAMAGE = 772;
PETNAME_RAPIDE = 773;
PETNAME_REICHE = 774;
PETNAME_REMIGE = 775;
PETNAME_RIEUSE = 776;
PETNAME_RISING = 777;
PETNAME_ROBUST = 778;
PETNAME_ROYALE = 779;
PETNAME_RUDOLF = 780;
PETNAME_RUNNER = 781;
PETNAME_SADDLE = 782;
PETNAME_SAFRAN = 783;
PETNAME_SAKURA = 784;
PETNAME_SAPHIR = 785;
PETNAME_SATURN = 786;
PETNAME_SCHUSS = 787;
PETNAME_SEKITO = 788;
PETNAME_SELENE = 789;
PETNAME_SENDEN = 790;
PETNAME_SEREIN = 791;
PETNAME_SHADOW = 792;
PETNAME_SHIDEN = 793;
PETNAME_SHINPU = 794;
PETNAME_SIEGER = 795;
PETNAME_SILBER = 796;
PETNAME_SILENT = 797;
PETNAME_SILVER = 798;
PETNAME_SILVER = 799;
PETNAME_SOLEIL = 800;
PETNAME_SOMBRE = 801;
PETNAME_SORREL = 802;
PETNAME_SPHENE = 803;
PETNAME_SPIRIT = 804;
PETNAME_SPRING = 805;
PETNAME_STREAM = 806;
PETNAME_STRIKE = 807;
PETNAME_SUMMER = 808;
PETNAME_TEKIRO = 809;
PETNAME_TERROR = 810;
PETNAME_TICKET = 811;
PETNAME_TIMIDE = 812;
PETNAME_TOPAZE = 813;
PETNAME_TULIPE = 814;
PETNAME_TYCOON = 815;
PETNAME_ULTIME = 816;
PETNAME_URANUS = 817;
PETNAME_VELOCE = 818;
PETNAME_VELVET = 819;
PETNAME_VICTOR = 820;
PETNAME_VIOLET = 821;
PETNAME_WALKER = 822;
PETNAME_WEISSE = 823;
PETNAME_WINGED = 824;
PETNAME_WINNER = 825;
PETNAME_WINNER = 826;
PETNAME_WINTER = 827;
PETNAME_WONDER = 828;
PETNAME_XANTHE = 829;
PETNAME_YELLOW = 830;
PETNAME_ZEPHYR = 831;
PETNAME_ARDENTE = 832;
PETNAME_AUTOMNE = 833;
PETNAME_AVENGER = 834;
PETNAME_BARONNE = 835;
PETNAME_BATTANT = 836;
PETNAME_BLAZING = 837;
PETNAME_BLITZER = 838;
PETNAME_CAMELIA = 839;
PETNAME_CANDIDE = 840;
PETNAME_CARAMEL = 841;
PETNAME_CELESTE = 842;
PETNAME_CERULEE = 843;
PETNAME_CHARBON = 844;
PETNAME_CHARGER = 845;
PETNAME_CHARIOT = 846;
PETNAME_CLIPPER = 847;
PETNAME_COUREUR = 848;
PETNAME_CRIMSON = 849;
PETNAME_CRISTAL = 850;
PETNAME_CRYSTAL = 851;
PETNAME_CUIVREE = 852;
PETNAME_CYCLONE = 853;
PETNAME_DANCING = 854;
PETNAME_DANSEUR = 855;
PETNAME_DIAMANT = 856;
PETNAME_DIAMOND = 857;
PETNAME_DRAFTER = 858;
PETNAME_DUNKLER = 859;
PETNAME_DUNKLES = 860;
PETNAME_EASTERN = 861;
PETNAME_EINHORN = 862;
PETNAME_ELANCEE = 863;
PETNAME_ELEGANT = 864;
PETNAME_EMPEROR = 865;
PETNAME_EMPRESS = 866;
PETNAME_EXPRESS = 867;
PETNAME_FARCEUR = 868;
PETNAME_FEATHER = 869;
PETNAME_FIGHTER = 870;
PETNAME_FILANTE = 871;
PETNAME_FLINKER = 872;
PETNAME_FLINKES = 873;
PETNAME_FORTUNE = 874;
PETNAME_FRAICHE = 875;
PETNAME_GAGNANT = 876;
PETNAME_GALAXIE = 877;
PETNAME_GALLANT = 878;
PETNAME_GENESIS = 879;
PETNAME_GEOELTE = 880;
PETNAME_GROSSER = 881;
PETNAME_GROSSES = 882;
PETNAME_GRUENER = 883;
PETNAME_GRUENES = 884;
PETNAME_HARMONY = 885;
PETNAME_HEROINE = 886;
PETNAME_IKEZUKI = 887;
PETNAME_IMPULSE = 888;
PETNAME_JAVELIN = 889;
PETNAME_JOYEUSE = 890;
PETNAME_JUMPING = 891;
PETNAME_JUPITER = 892;
PETNAME_JUSTICE = 893;
PETNAME_KLEINER = 894;
PETNAME_KLEINES = 895;
PETNAME_LAVANDE = 896;
PETNAME_LEAPING = 897;
PETNAME_LEGENDE = 898;
PETNAME_LIBERTY = 899;
PETNAME_LICORNE = 900;
PETNAME_MAJESTY = 901;
PETNAME_MARQUIS = 902;
PETNAME_MAXIMAL = 903;
PETNAME_MELODIE = 904;
PETNAME_MERCURY = 905;
PETNAME_MILLION = 906;
PETNAME_MIRACLE = 907;
PETNAME_MUSASHI = 908;
PETNAME_MUSTANG = 909;
PETNAME_NACARAT = 910;
PETNAME_NATURAL = 911;
PETNAME_NEMESIS = 912;
PETNAME_NEPTUNE = 913;
PETNAME_OEILLET = 914;
PETNAME_OPTIMAL = 915;
PETNAME_ORAGEUX = 916;
PETNAME_OURAGAN = 917;
PETNAME_PAPRIKA = 918;
PETNAME_PARFAIT = 919;
PETNAME_PARTNER = 920;
PETNAME_PATIENT = 921;
PETNAME_PATURON = 922;
PETNAME_PEGASUS = 923;
PETNAME_PENSIVE = 924;
PETNAME_PERFECT = 925;
PETNAME_PEUREUX = 926;
PETNAME_PHOENIX = 927;
PETNAME_PLUMAGE = 928;
PETNAME_POURPRE = 929;
PETNAME_POUSSIN = 930;
PETNAME_PRANCER = 931;
PETNAME_PREMIUM = 932;
PETNAME_QUANTUM = 933;
PETNAME_RADIANT = 934;
PETNAME_RAINBOW = 935;
PETNAME_RATTLER = 936;
PETNAME_REICHER = 937;
PETNAME_REICHES = 938;
PETNAME_ROUGHIE = 939;
PETNAME_SAMURAI = 940;
PETNAME_SAUTANT = 941;
PETNAME_SCARLET = 942;
PETNAME_SCHWEIF = 943;
PETNAME_SEREINE = 944;
PETNAME_SERGENT = 945;
PETNAME_SHINDEN = 946;
PETNAME_SHINING = 947;
PETNAME_SHOOTER = 948;
PETNAME_SMOKING = 949;
PETNAME_SOUFFLE = 950;
PETNAME_SPECIAL = 951;
PETNAME_STYLISH = 952;
PETNAME_SUMPTER = 953;
PETNAME_TEMPEST = 954;
PETNAME_TEMPETE = 955;
PETNAME_THUNDER = 956;
PETNAME_TORNADO = 957;
PETNAME_TORPEDO = 958;
PETNAME_TRISTAN = 959;
PETNAME_TROOPER = 960;
PETNAME_TROTTER = 961;
PETNAME_TYPHOON = 962;
PETNAME_UNICORN = 963;
PETNAME_VENGEUR = 964;
PETNAME_VERMEIL = 965;
PETNAME_VICTORY = 966;
PETNAME_WARRIOR = 967;
PETNAME_WEISSER = 968;
PETNAME_WEISSES = 969;
PETNAME_WESTERN = 970;
PETNAME_WHISPER = 971;
PETNAME_WINNING = 972;
PETNAME_ZETSUEI = 973;
PETNAME_ZILLION = 974;
PETNAME_BARONESS = 975;
PETNAME_BATTANTE = 976;
PETNAME_BLIZZARD = 977;
PETNAME_CANNELLE = 978;
PETNAME_CAPUCINE = 979;
PETNAME_CERULEAN = 980;
PETNAME_CHANCEUX = 981;
PETNAME_CHARISMA = 982;
PETNAME_CHARMANT = 983;
PETNAME_CHOCOLAT = 984;
PETNAME_CLAYBANK = 985;
PETNAME_COMTESSE = 986;
PETNAME_COUREUSE = 987;
PETNAME_DANSEUSE = 988;
PETNAME_DUCHESSE = 989;
PETNAME_ECARLATE = 990;
PETNAME_ELEGANTE = 991;
PETNAME_EMERAUDE = 992;
PETNAME_FARCEUSE = 993;
PETNAME_FARFADET = 994;
PETNAME_FRINGANT = 995;
PETNAME_GAGNANTE = 996;
PETNAME_GALLOPER = 997;
PETNAME_GALOPANT = 998;
PETNAME_GEOELTER = 999;
PETNAME_GEOELTES = 1000;
PETNAME_GESCHOSS = 1001;
PETNAME_GORGEOUS = 1002;
PETNAME_HANAKAZE = 1003;
PETNAME_HIGHLAND = 1004;
PETNAME_HYPERION = 1005;
PETNAME_ILLUSION = 1006;
PETNAME_IMMORTAL = 1007;
PETNAME_IMPERIAL = 1008;
PETNAME_INCARNAT = 1009;
PETNAME_INFINITY = 1010;
PETNAME_INNOCENT = 1011;
PETNAME_JACINTHE = 1012;
PETNAME_KAISERIN = 1013;
PETNAME_KRISTALL = 1014;
PETNAME_MAHARAJA = 1015;
PETNAME_MAHARANI = 1016;
PETNAME_MARQUISE = 1017;
PETNAME_MATAEMON = 1018;
PETNAME_MEILLEUR = 1019;
PETNAME_MERCEDES = 1020;
PETNAME_MYOSOTIS = 1021;
PETNAME_NEBULOUS = 1022;
PETNAME_NEGATIVE = 1023;
PETNAME_NENUPHAR = 1024;
PETNAME_NORTHERN = 1025;
PETNAME_NORTHERN = 1026;
PETNAME_OBSIDIAN = 1027;
PETNAME_ORAGEUSE = 1028;
PETNAME_ORCHIDEE = 1029;
PETNAME_PARFAITE = 1030;
PETNAME_PATIENTE = 1031;
PETNAME_PEUREUSE = 1032;
PETNAME_POSITIVE = 1033;
PETNAME_PRINCELY = 1034;
PETNAME_PRINCESS = 1035;
PETNAME_PRODIGUE = 1036;
PETNAME_PUISSANT = 1037;
PETNAME_RESTLESS = 1038;
PETNAME_RHAPSODY = 1039;
PETNAME_ROADSTER = 1040;
PETNAME_RUTILANT = 1041;
PETNAME_SAUTANTE = 1042;
PETNAME_SCHWARZE = 1043;
PETNAME_SHOOTING = 1044;
PETNAME_SILBERNE = 1045;
PETNAME_SOUTHERN = 1046;
PETNAME_SPECIALE = 1047;
PETNAME_STALLION = 1048;
PETNAME_STARDUST = 1049;
PETNAME_SURUSUMI = 1050;
PETNAME_TONNERRE = 1051;
PETNAME_TROTTEUR = 1052;
PETNAME_ULTIMATE = 1053;
PETNAME_UNIVERSE = 1054;
PETNAME_VAILLANT = 1055;
PETNAME_VENGEUSE = 1056;
PETNAME_XANTHOUS = 1057;
PETNAME_ZEPPELIN = 1058;
PETNAME_AMBITIOUS = 1059;
PETNAME_AUDACIEUX = 1060;
PETNAME_BALLISTIC = 1061;
PETNAME_BEAUTIFUL = 1062;
PETNAME_BRILLIANT = 1063;
PETNAME_CAMPANULE = 1064;
PETNAME_CAPITAINE = 1065;
PETNAME_CHANCEUSE = 1066;
PETNAME_CHARMANTE = 1067;
PETNAME_CLEMATITE = 1068;
PETNAME_CLOCHETTE = 1069;
PETNAME_CORIANDRE = 1070;
PETNAME_CRACKLING = 1071;
PETNAME_DESTROYER = 1072;
PETNAME_EXCELLENT = 1073;
PETNAME_FANTASTIC = 1074;
PETNAME_FEATHERED = 1075;
PETNAME_FRINGANTE = 1076;
PETNAME_GALOPANTE = 1077;
PETNAME_GINGEMBRE = 1078;
PETNAME_HURRICANE = 1079;
PETNAME_ICHIMONJI = 1080;
PETNAME_IMPETUEUX = 1081;
PETNAME_INCARNATE = 1082;
PETNAME_LIGHTNING = 1083;
PETNAME_MATSUKAZE = 1084;
PETNAME_MEILLEURE = 1085;
PETNAME_MENESTREL = 1086;
PETNAME_MERCILESS = 1087;
PETNAME_PENDRAGON = 1088;
PETNAME_PRINCESSE = 1089;
PETNAME_PRINTEMPS = 1090;
PETNAME_PUISSANTE = 1091;
PETNAME_QUADRILLE = 1092;
PETNAME_ROSINANTE = 1093;
PETNAME_RUTILANTE = 1094;
PETNAME_SCHWARZER = 1095;
PETNAME_SCHWARZES = 1096;
PETNAME_SILBERNER = 1097;
PETNAME_SILBERNES = 1098;
PETNAME_SPARKLING = 1099;
PETNAME_SPEEDSTER = 1100;
PETNAME_TOURNESOL = 1101;
PETNAME_TRANSIENT = 1102;
PETNAME_TROTTEUSE = 1103;
PETNAME_TURBULENT = 1104;
PETNAME_TWINKLING = 1105;
PETNAME_VAILLANTE = 1106;
PETNAME_VALENTINE = 1107;
PETNAME_VELOCIOUS = 1108;
PETNAME_VERMEILLE = 1109;
PETNAME_WONDERFUL = 1110;
PETNAME_AMATSUKAZE = 1111;
PETNAME_AUDACIEUSE = 1112;
PETNAME_BENEVOLENT = 1113;
PETNAME_BLISTERING = 1114;
PETNAME_BRILLIANCE = 1115;
PETNAME_BUCEPHALUS = 1116;
PETNAME_CHALLENGER = 1117;
PETNAME_EXCELLENTE = 1118;
PETNAME_IMPETUEUSE = 1119;
PETNAME_INVINCIBLE = 1120;
PETNAME_MALEVOLENT = 1121;
PETNAME_MILLENNIUM = 1122;
PETNAME_TRANQUILLE = 1123;
PETNAME_TURBULENTE = 1124;
PETNAME_DESTRUCTION = 1125;
PETNAME_FIRECRACKER = 1126;
-----------------------------------
-- Summoner
-----------------------------------
PET_FIRE_SPIRIT = 0;
PET_ICE_SPIRIT = 1;
PET_AIR_SPIRIT = 2;
PET_EARTH_SPIRIT = 3;
PET_THUNDER_SPIRIT = 4;
PET_WATER_SPIRIT = 5;
PET_LIGHT_SPIRIT = 6;
PET_DARK_SPIRIT = 7;
PET_CARBUNCLE = 8;
PET_FENRIR = 9;
PET_IFRIT = 10;
PET_TITAN = 11;
PET_LEVIATHAN = 12;
PET_GARUDA = 13;
PET_SHIVA = 14;
PET_RAMUH = 15;
PET_DIABOLOS = 16;
PET_ALEXANDER = 17;
PET_ODIN = 18;
PET_ATOMOS = 19;
PET_CAIT_SITH = 20;
PET_AUTOMATON = 69;
PET_WYVERN = 48;
-----------------------------------
-- Beastmaster
-----------------------------------
PET_SHEEP_FAMILIAR = 21;
PET_HARE_FAMILIAR = 22;
PET_CRAB_FAMILIAR = 23;
PET_COURIER_CARRIE = 24;
PET_HOMUNCULUS = 25;
PET_FLYTRAP_FAMILIAR = 26;
PET_TIGER_FAMILIAR = 27;
PET_FLOWERPOT_BILL = 28;
PET_EFT_FAMILIAR = 29;
PET_LIZARD_FAMILIAR = 30;
PET_MAYFLY_FAMILIAR = 31;
PET_FUNGUAR_FAMILIAR = 32;
PET_BEETLE_FAMILIAR = 33;
PET_ANTLION_FAMILIAR = 34;
PET_MITE_FAMILIAR = 35;
PET_LULLABY_MELODIA = 36;
PET_KEENEARED_STEFFI = 37;
PET_FLOWERPOT_BEN = 38;
PET_SABER_SIRAVARDE = 39;
PET_COLDBLOOD_COMO = 40;
PET_SHELLBUSTER_OROB = 41;
PET_VORACIOUS_AUDREY = 42;
PET_AMBUSHER_ALLIE = 43;
PET_LIFEDRINKER_LARS = 44;
PET_PANZER_GALAHAD = 45;
PET_CHOPSUEY_CHUCKY = 46;
PET_AMIGO_SABOTENDER = 47; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/spells/dia_iii.lua | 5 | 2715 | -----------------------------------------
-- Spell: Dia III
-- Lowers an enemy's defense and gradually deals light elemental damage.
-- caster:getMerit() returns a value which is equal to the number of merit points TIMES the value of each point
-- Dia III value per point is '30' This is a constant set in the table 'merits'
-----------------------------------------
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)
--calculate raw damage
local basedmg = caster:getSkillLevel(ENFEEBLING_MAGIC_SKILL) / 4;
local dmg = calculateMagicDamage(basedmg,5,caster,spell,target,ENFEEBLING_MAGIC_SKILL,MOD_INT,false);
-- Softcaps at 32, should always do at least 1
dmg = utils.clamp(dmg, 1, 32);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT)-target:getStat(MOD_INT),ENFEEBLING_MAGIC_SKILL,1.0);
--get the resisted damage
dmg = dmg*resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg);
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--add in final adjustments including the actual damage dealt
local final = finalMagicAdjustments(caster,target,spell,dmg);
-- Calculate duration.
local duration = caster:getMerit(MERIT_DIA_III);
local dotBonus = 0;
if (duration == 0) then --if caster has the spell but no merits in it, they are either a mob or we assume they are GM or otherwise gifted with max duration
duration = 150;
end
if (caster:hasStatusEffect(EFFECT_SABOTEUR)) then
duration = duration * 2;
end
caster:delStatusEffect(EFFECT_SABOTEUR);
dotBonus = dotBonus+caster:getMod(MOD_DIA_DOT); -- Dia Wand
-- Check for Bio.
local bio = target:getStatusEffect(EFFECT_BIO);
-- Do it!
if(bio == nil or (DIA_OVERWRITE == 0 and bio:getPower() <= 3) or (DIA_OVERWRITE == 1 and bio:getPower() < 3)) then
target:addStatusEffect(EFFECT_DIA,3+dotBonus,3,duration,FLAG_ERASABLE, 15);
spell:setMsg(2);
else
spell:setMsg(75);
end
-- Try to kill same tier Bio
if(BIO_OVERWRITE == 1 and bio ~= nil) then
if(bio:getPower() <= 3) then
target:delStatusEffect(EFFECT_BIO);
end
end
return final;
end;
| gpl-3.0 |
hamed9898/maxbot | plugins/pokedex.lua | 626 | 1668 | do
local images_enabled = true;
local function get_sprite(path)
local url = "http://pokeapi.co/"..path
print(url)
local b,c = http.request(url)
local data = json:decode(b)
local image = data.image
return image
end
local function callback(extra)
send_msg(extra.receiver, extra.text, ok_cb, false)
end
local function send_pokemon(query, receiver)
local url = "http://pokeapi.co/api/v1/pokemon/" .. query .. "/"
local b,c = http.request(url)
local pokemon = json:decode(b)
if pokemon == nil then
return 'No pokémon found.'
end
-- api returns height and weight x10
local height = tonumber(pokemon.height)/10
local weight = tonumber(pokemon.weight)/10
local text = 'Pokédex ID: ' .. pokemon.pkdx_id
..'\nName: ' .. pokemon.name
..'\nWeight: ' .. weight.." kg"
..'\nHeight: ' .. height.." m"
..'\nSpeed: ' .. pokemon.speed
local image = nil
if images_enabled and pokemon.sprites and pokemon.sprites[1] then
local sprite = pokemon.sprites[1].resource_uri
image = get_sprite(sprite)
end
if image then
image = "http://pokeapi.co"..image
local extra = {
receiver = receiver,
text = text
}
send_photo_from_url(receiver, image, callback, extra)
else
return text
end
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local query = URL.escape(matches[1])
return send_pokemon(query, receiver)
end
return {
description = "Pokedex searcher for Telegram",
usage = "!pokedex [Name/ID]: Search the pokédex for Name/ID and get info of the pokémon!",
patterns = {
"^!pokedex (.*)$",
"^!pokemon (.+)$"
},
run = run
}
end
| gpl-2.0 |
kidanger/Drystal | src/particle/particle.lua | 1 | 2143 | local drystal = require 'drystal'
local System = drystal.System
local function is_getset(funcname)
if funcname:sub(1, string.len('set_min_')) == 'set_min_' then
return true
end
return false
end
local funcs = {}
for k, v in pairs(System) do
if is_getset(k) then
local attr = k:sub(string.len('get_min_') + 1)
local getmin = System['get_min_' .. attr]
local getmax = System['get_max_' .. attr]
local setmin = System['set_min_' .. attr]
local setmax = System['set_max_' .. attr]
local get_both = function(data)
return getmin(data), getmax(data)
end
local set_both = function(data, min, max)
setmin(data, min)
setmax(data, max or min)
end
funcs['set_' .. attr] = set_both
funcs['get_' .. attr] = get_both
end
end
for k, v in pairs(funcs) do
System[k] = v
end
local function preprocess(data)
local s = {}
for at, value in pairs(data) do
table.insert(s, {at=at, value=value})
end
table.sort(s, function(a, b) return a.at < b.at end)
if s[1].at ~= 0 then
table.insert(s, 1, {at=0, value=s[1].value})
end
if s[#s].at ~= 1 then
table.insert(s, {at=1, value=s[#s].value})
end
return s
end
function System:set_sizes(sizes)
self:clear_sizes()
local s = preprocess(sizes)
for _, data in ipairs(s) do
if type(data.value) == 'table' then
self:add_size(data.at, unpack(data.value))
else
self:add_size(data.at, data.value)
end
end
end
function System:set_colors(colors)
self:clear_colors()
local c = preprocess(colors)
for _, data in ipairs(c) do
local c1, c2 = data.value, data.value
if type(data.value[1]) == 'table' or type(data.value[1]) == 'string' then
c1 = data.value[1]
c2 = data.value[2]
end
if type(c1) == 'string' then
c1 = drystal.colors[c1]
end
if type(c2) == 'string' then
c2 = drystal.colors[c2]
end
self:add_color(data.at, c1[1], c2[1], c1[2], c2[2], c1[3], c1[3])
end
end
function System:set_alphas(alphas)
self:clear_alphas()
local a = preprocess(alphas)
for _, data in ipairs(a) do
if type(data.value) == 'table' then
self:add_alpha(data.at, unpack(data.value))
else
self:add_alpha(data.at, data.value)
end
end
end
| gpl-3.0 |
plajjan/snabbswitch | src/lib/hash/base.lua | 15 | 2923 | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
-- Abstract base class for hash functions.
--
-- A subclass must define the instance variable "_size" as the number
-- of bits in the output of the hash function. The standard
-- constructor expects that the hash size is at least 32 and is a
-- multiple thereof. It allocates a chunk of memory that can hold the
-- output of the hash function and overlays it with a union of arrays
-- of signed and unsigned 8 and 32 bit integers. If the size is a
-- multiple of 64, the union contains additional arrays of signed and
-- unsigned 64-bit integers. The union is exposed as a public
-- instance variable named 'h' in the API, allowing the arrays to be
-- accessed as follows, where the prefixes 'u' and 'i' refer to the
-- unsigned and signed variants, respectively.
--
-- hash.h.u8
-- hash.h.i8
-- hash.h.u32
-- hash.h.i32
-- hash.h.u64
-- hash.h.i64
--
-- A subclass must implement the method hash(), which must accept at
-- least two arguments:
--
-- data Pointer to a region of memory where the input is stored
-- length Size of input in bytes
--
-- The hash() method must store the result in the 'h' instance
-- variable. For convenience of the caller, the method must return
-- 'h', allowing for direct access like
--
-- local foo = hash:hash(data, l).u32[0]
--
module(..., package.seeall)
local ffi = require("ffi")
local hash = subClass(nil)
hash._name = "hash function"
-- Cache for ctypes that store the result of a hash function, keyed by
-- the size of the result in bytes. Note: this is not just to save
-- space but make sure that each instance of the same hash function
-- uses the exact same ctype (i.e. same internal ctype ID).
-- Otherwise, it may happen that a trace takes a side exit due to a
-- ctype mismatch.
local hash_types = {}
function hash:new ()
assert(self ~= hash, "Can't instantiate abstract class hash")
local o = hash:superClass().new(self)
assert(o._size and o._size >= 32 and o._size%32 == 0)
local h_t = hash_types[o._size]
if not h_t then
if o._size >= 64 and o._size%64 == 0 then
h_t = ffi.typeof([[
union {
uint8_t u8[$];
int8_t i8[$];
uint32_t u32[$];
int32_t i32[$];
uint64_t u64[$];
int64_t i64[$];
}
]],
o._size/8, o._size/8,
o._size/32, o._size/32,
o._size/64, o._size/64)
else
h_t = ffi.typeof([[
union {
uint8_t u8[$];
int8_t i8[$];
uint32_t u32[$];
int32_t i32[$];
}
]],
o._size/8, o._size/8,
o._size/32, o._size/32)
end
hash_types[o._size] = h_t
end
o.h = h_t()
return o
end
function hash:size ()
return self._size
end
return hash
| apache-2.0 |
vonflynee/opencomputersserver | world/opencomputers/f6b12c72-550e-4c86-b7bc-3a72d250d375/lib/text.lua | 16 | 3341 | local unicode = require("unicode")
local text = {}
function text.detab(value, tabWidth)
checkArg(1, value, "string")
checkArg(2, tabWidth, "number", "nil")
tabWidth = tabWidth or 8
local function rep(match)
local spaces = tabWidth - match:len() % tabWidth
return match .. string.rep(" ", spaces)
end
local result = value:gsub("([^\n]-)\t", rep) -- truncate results
return result
end
function text.padRight(value, length)
checkArg(1, value, "string", "nil")
checkArg(2, length, "number")
if not value or unicode.wlen(value) == 0 then
return string.rep(" ", length)
else
return value .. string.rep(" ", length - unicode.wlen(value))
end
end
function text.padLeft(value, length)
checkArg(1, value, "string", "nil")
checkArg(2, length, "number")
if not value or unicode.wlen(value) == 0 then
return string.rep(" ", length)
else
return string.rep(" ", length - unicode.wlen(value)) .. value
end
end
function text.trim(value) -- from http://lua-users.org/wiki/StringTrim
local from = string.match(value, "^%s*()")
return from > #value and "" or string.match(value, ".*%S", from)
end
function text.wrap(value, width, maxWidth)
checkArg(1, value, "string")
checkArg(2, width, "number")
checkArg(3, maxWidth, "number")
local line, nl = value:match("([^\r\n]*)(\r?\n?)") -- read until newline
if unicode.wlen(line) > width then -- do we even need to wrap?
local partial = unicode.wtrunc(line, width)
local wrapped = partial:match("(.*[^a-zA-Z0-9._()'`=])")
if wrapped or unicode.wlen(line) > maxWidth then
partial = wrapped or partial
return partial, unicode.sub(value, unicode.len(partial) + 1), true
else
return "", value, true -- write in new line.
end
end
local start = unicode.len(line) + unicode.len(nl) + 1
return line, start <= unicode.len(value) and unicode.sub(value, start) or nil, unicode.len(nl) > 0
end
function text.wrappedLines(value, width, maxWidth)
local line, nl
return function()
if value then
line, value, nl = text.wrap(value, width, maxWidth)
return line
end
end
end
-------------------------------------------------------------------------------
function text.tokenize(value)
checkArg(1, value, "string")
local tokens, token = {}, ""
local escaped, quoted, start = false, false, -1
for i = 1, unicode.len(value) do
local char = unicode.sub(value, i, i)
if escaped then -- escaped character
escaped = false
token = token .. char
elseif char == "\\" and quoted ~= "'" then -- escape character?
escaped = true
token = token .. char
elseif char == quoted then -- end of quoted string
quoted = false
token = token .. char
elseif (char == "'" or char == '"') and not quoted then
quoted = char
start = i
token = token .. char
elseif string.find(char, "%s") and not quoted then -- delimiter
if token ~= "" then
table.insert(tokens, token)
token = ""
end
else -- normal char
token = token .. char
end
end
if quoted then
return nil, "unclosed quote at index " .. start
end
if token ~= "" then
table.insert(tokens, token)
end
return tokens
end
-------------------------------------------------------------------------------
return text
| mit |
vonflynee/opencomputersserver | world/opencomputers/6d437cc7-8fe8-4147-8a29-4c8b62fcedc7/lib/text.lua | 16 | 3341 | local unicode = require("unicode")
local text = {}
function text.detab(value, tabWidth)
checkArg(1, value, "string")
checkArg(2, tabWidth, "number", "nil")
tabWidth = tabWidth or 8
local function rep(match)
local spaces = tabWidth - match:len() % tabWidth
return match .. string.rep(" ", spaces)
end
local result = value:gsub("([^\n]-)\t", rep) -- truncate results
return result
end
function text.padRight(value, length)
checkArg(1, value, "string", "nil")
checkArg(2, length, "number")
if not value or unicode.wlen(value) == 0 then
return string.rep(" ", length)
else
return value .. string.rep(" ", length - unicode.wlen(value))
end
end
function text.padLeft(value, length)
checkArg(1, value, "string", "nil")
checkArg(2, length, "number")
if not value or unicode.wlen(value) == 0 then
return string.rep(" ", length)
else
return string.rep(" ", length - unicode.wlen(value)) .. value
end
end
function text.trim(value) -- from http://lua-users.org/wiki/StringTrim
local from = string.match(value, "^%s*()")
return from > #value and "" or string.match(value, ".*%S", from)
end
function text.wrap(value, width, maxWidth)
checkArg(1, value, "string")
checkArg(2, width, "number")
checkArg(3, maxWidth, "number")
local line, nl = value:match("([^\r\n]*)(\r?\n?)") -- read until newline
if unicode.wlen(line) > width then -- do we even need to wrap?
local partial = unicode.wtrunc(line, width)
local wrapped = partial:match("(.*[^a-zA-Z0-9._()'`=])")
if wrapped or unicode.wlen(line) > maxWidth then
partial = wrapped or partial
return partial, unicode.sub(value, unicode.len(partial) + 1), true
else
return "", value, true -- write in new line.
end
end
local start = unicode.len(line) + unicode.len(nl) + 1
return line, start <= unicode.len(value) and unicode.sub(value, start) or nil, unicode.len(nl) > 0
end
function text.wrappedLines(value, width, maxWidth)
local line, nl
return function()
if value then
line, value, nl = text.wrap(value, width, maxWidth)
return line
end
end
end
-------------------------------------------------------------------------------
function text.tokenize(value)
checkArg(1, value, "string")
local tokens, token = {}, ""
local escaped, quoted, start = false, false, -1
for i = 1, unicode.len(value) do
local char = unicode.sub(value, i, i)
if escaped then -- escaped character
escaped = false
token = token .. char
elseif char == "\\" and quoted ~= "'" then -- escape character?
escaped = true
token = token .. char
elseif char == quoted then -- end of quoted string
quoted = false
token = token .. char
elseif (char == "'" or char == '"') and not quoted then
quoted = char
start = i
token = token .. char
elseif string.find(char, "%s") and not quoted then -- delimiter
if token ~= "" then
table.insert(tokens, token)
token = ""
end
else -- normal char
token = token .. char
end
end
if quoted then
return nil, "unclosed quote at index " .. start
end
if token ~= "" then
table.insert(tokens, token)
end
return tokens
end
-------------------------------------------------------------------------------
return text
| mit |
UnfortunateFruit/darkstar | scripts/zones/Kazham/npcs/Mamerie.lua | 37 | 1372 | -----------------------------------
-- Area: Kazham
-- NPC: Mamerie
-- Standard Merchant NPC
-----------------------------------
require("scripts/globals/shop");
package.loaded["scripts/zones/Kazham/TextIDs"] = nil;
require("scripts/zones/Kazham/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,MAMERIE_SHOP_DIALOG);
stock = {0x11C1,62, -- Gysahl Greens
0x0348,7, -- Chocobo Feather
0x4278,11, -- Pet Food Alpha Biscuit
0x4279,82, -- Pet Food Beta Biscuit
0x45C4,82, -- Carrot Broth
0x45C6,695, -- Bug Broth
0x45C8,126, -- Herbal Broth
0x45CA,695, -- Carrion Broth
0x13D1,50784} -- Scroll of Chocobo Mazurka
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
nesstea/darkstar | scripts/globals/items/red_curry_bun.lua | 18 | 2193 | -----------------------------------------
-- ID: 5759
-- Item: red_curry_bun
-- Food Effect: 30 Min, All Races
-----------------------------------------
-- Health 25
-- Strength 7
-- Agility 1
-- Intelligence -2
-- Attack % 23
-- Attack Cap 150 (cap 150)
-- Ranged Atk % 23 (cap 150)
-- Demon Killer 4
-- HP recovered when healing +4
-- MP recovered when healing +2
-- TODO: Atk/R.Atk should be +23% solo, +24% in a party of 2-3, and +25% in a party of 4+ apparently? Does this change dynamically? Going with solo stats.
-----------------------------------------
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,5759);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 25);
target:addMod(MOD_STR, 7);
target:addMod(MOD_AGI, 1);
target:addMod(MOD_INT, -2);
target:addMod(MOD_FOOD_ATTP, 23);
target:addMod(MOD_FOOD_ATT_CAP, 150);
target:addMod(MOD_FOOD_RATTP, 23);
target:addMod(MOD_FOOD_RATT_CAP, 150);
target:addMod(MOD_DEMON_KILLER, 4);
target:addMod(MOD_HPHEAL, 4);
target:addMod(MOD_MPHEAL, 2);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 25);
target:delMod(MOD_STR, 7);
target:delMod(MOD_AGI, 1);
target:delMod(MOD_INT, -2);
target:delMod(MOD_FOOD_ATTP, 23);
target:delMod(MOD_FOOD_ATT_CAP, 150);
target:delMod(MOD_FOOD_RATTP, 23);
target:delMod(MOD_FOOD_RATT_CAP, 150);
target:delMod(MOD_DEMON_KILLER, 4);
target:delMod(MOD_HPHEAL, 4);
target:delMod(MOD_MPHEAL, 2);
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/dish_of_spaghetti_carbonara.lua | 35 | 1821 | -----------------------------------------
-- ID: 5190
-- Item: dish_of_spaghetti_carbonara
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Health % 14
-- Health Cap 175
-- Magic 10
-- Strength 4
-- Vitality 2
-- Intelligence -3
-- Attack % 18
-- Attack Cap 65
-- Store TP 6
-----------------------------------------
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,5190);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_HPP, 14);
target:addMod(MOD_FOOD_HP_CAP, 175);
target:addMod(MOD_MP, 10);
target:addMod(MOD_STR, 4);
target:addMod(MOD_VIT, 2);
target:addMod(MOD_INT, -3);
target:addMod(MOD_FOOD_ATTP, 18);
target:addMod(MOD_FOOD_ATT_CAP, 65);
target:addMod(MOD_STORETP, 6);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_HPP, 14);
target:delMod(MOD_FOOD_HP_CAP, 175);
target:delMod(MOD_MP, 10);
target:delMod(MOD_STR, 4);
target:delMod(MOD_VIT, 2);
target:delMod(MOD_INT, -3);
target:delMod(MOD_FOOD_ATTP, 18);
target:delMod(MOD_FOOD_ATT_CAP, 65);
target:delMod(MOD_STORETP, 6);
end;
| gpl-3.0 |
DevCobra/Cobra.iraq | plugin/kick.lua | 1 | 1112 |
do
local function run(msg, matches)
if matches[1] == 'زحلك' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'channel_block',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'de' and string.match(matches[2], '^%d+$') then
local get_cmd = 'channel_block'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif msg.text:match("@[%a%d]") then
local get_cmd = 'channel_block'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
end
return {
patterns = {
"^[!/](زحلك)$",
},
run = run,
}
end
--By @G0vip
---ch @Hlusat
| gpl-2.0 |
nesstea/darkstar | scripts/globals/mobskills/Ill_Wind.lua | 33 | 1407 | ---------------------------------------------
-- Ill Wind
-- Description: Deals Wind damage to enemies within an area of effect. Additional effect: Dispel
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes Shadows
-- Range: Unknown radial
-- Notes: Only used by Puks in Mamook, Besieged, and the following Notorious Monsters: Vulpangue, Nis Puk, Nguruvilu, Seps , Phantom Puk and Waugyl. Dispels one effect.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if (mob:getFamily() == 316 and mob:getModelId() == 1746) then
return 0;
else
return 1;
end
end;
function onMobWeaponSkill(target, mob, skill)
local dmgmod = 1;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*2.5,ELE_WIND,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_WIND,MOBPARAM_WIPE_SHADOWS);
target:dispelStatusEffect();
target:delHP(dmg);
--printf("[TP MOVE] Zone: %u Monster: %u Mob lvl: %u TP: %u TP Move: %u Damage: %u on Player: %u Level: %u HP: %u",mob:getZoneID(),mob:getID(),mob:getMainLvl(),skill:getTP(),skill:getID(),dmg,target:getID(),target:getMainLvl(),target:getMaxHP());
return dmg;
end; | gpl-3.0 |
nesstea/darkstar | scripts/zones/FeiYin/npcs/Strange_Apparatus.lua | 27 | 1124 | -----------------------------------
-- Area: FeiYin
-- NPC: Strange Apparatus
-- @pos -94 -15 220 204
-----------------------------------
package.loaded["scripts/zones/FeiYin/TextIDs"] = nil;
require("scripts/zones/FeiYin/TextIDs");
require("scripts/globals/strangeapparatus");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
player:startEvent(0x001B, 0, 0, INFINITY_CORE, 0, 0, 0, 0, player:getZoneID());
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0019, 0, 0, INFINITY_CORE, 0, 0, 0, 0, player:getZoneID());
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 |
Cyumus/NutScript | gamemode/core/derma/cl_tooltip.lua | 3 | 2317 | local tooltip_delay = CreateClientConVar( "tooltip_delay", "0.5", true, false )
local PANEL = {}
function PANEL:Init()
self:SetDrawOnTop( true )
self.DeleteContentsOnClose = false
self:SetText( "" )
self:SetFont( "nutToolTipText" )
end
function PANEL:UpdateColours(skin)
return self:SetTextStyleColor(color_black)
end
function PANEL:SetContents(panel, bDelete)
panel:SetParent( self )
self.Contents = panel
self.DeleteContentsOnClose = bDelete or false
self.Contents:SizeToContents()
self:InvalidateLayout( true )
self.Contents:SetVisible( false )
end
function PANEL:PerformLayout()
if ( self.Contents ) then
self:SetWide( self.Contents:GetWide() + 8 )
self:SetTall( self.Contents:GetTall() + 8 )
self.Contents:SetPos( 4, 4 )
else
local w, h = self:GetContentSize()
self:SetSize( w + 8, h + 6 )
self:SetContentAlignment( 5 )
end
end
local Mat = Material( "vgui/arrow" )
function PANEL:DrawArrow(x, y)
self.Contents:SetVisible( true )
surface.SetMaterial( Mat )
surface.DrawTexturedRect( self.ArrowPosX+x, self.ArrowPosY+y, self.ArrowWide, self.ArrowTall )
end
function PANEL:PositionTooltip()
if ( !IsValid( self.TargetPanel ) ) then
self:Remove()
return
end
self:PerformLayout()
local x, y = input.GetCursorPos()
local w, h = self:GetSize()
local lx, ly = self.TargetPanel:LocalToScreen( 0, 0 )
y = y - 50
y = math.min( y, ly - h * 1.5 )
if ( y < 2 ) then y = 2 end
// Fixes being able to be drawn off screen
self:SetPos( math.Clamp( x - w * 0.5, 0, ScrW( ) - self:GetWide( ) ), math.Clamp( y, 0, ScrH( ) - self:GetTall( ) ) )
end
function PANEL:Paint(w, h)
self:PositionTooltip()
derma.SkinHook( "Paint", "Tooltip", self, w, h )
end
function PANEL:OpenForPanel(panel)
self.TargetPanel = panel
self:PositionTooltip()
if ( tooltip_delay:GetFloat() > 0 ) then
self:SetVisible( false )
timer.Simple( tooltip_delay:GetFloat(), function()
if ( !IsValid( self ) ) then return end
if ( !IsValid( panel ) ) then return end
self:PositionTooltip()
self:SetVisible( true )
end )
end
end
function PANEL:Close()
if ( !self.DeleteContentsOnClose && self.Contents ) then
self.Contents:SetVisible( false )
self.Contents:SetParent( nil )
end
self:Remove()
end
derma.DefineControl("DTooltip", "", PANEL, "DLabel") | mit |
vonflynee/opencomputersserver | world/opencomputers/6d437cc7-8fe8-4147-8a29-4c8b62fcedc7/lib/shell.lua | 15 | 5213 | local fs = require("filesystem")
local text = require("text")
local unicode = require("unicode")
local shell = {}
local aliases = {}
-- Cache loaded shells for command execution. This puts the requirement on
-- shells that they do not keep a global state, since they may be called
-- multiple times, but reduces memory usage a lot.
local shells = setmetatable({}, {__mode="v"})
local function getShell()
local shellPath = os.getenv("SHELL") or "/bin/sh"
local shellName, reason = shell.resolve(shellPath, "lua")
if not shellName then
return nil, "cannot resolve shell `" .. shellPath .. "': " .. reason
end
if shells[shellName] then
return shells[shellName]
end
local sh, reason = loadfile(shellName, "t", env)
if sh then
shells[shellName] = sh
end
return sh, reason
end
local function findFile(name, ext)
checkArg(1, name, "string")
local function findIn(dir)
if dir:sub(1, 1) ~= "/" then
dir = shell.resolve(dir)
end
dir = fs.concat(fs.concat(dir, name), "..")
local name = fs.name(name)
local list = fs.list(dir)
if list then
local files = {}
for file in list do
files[file] = true
end
if ext and unicode.sub(name, -(1 + unicode.len(ext))) == "." .. ext then
-- Name already contains extension, prioritize.
if files[name] then
return true, fs.concat(dir, name)
end
elseif files[name] then
-- Check exact name.
return true, fs.concat(dir, name)
elseif ext then
-- Check name with automatially added extension.
local name = name .. "." .. ext
if files[name] then
return true, fs.concat(dir, name)
end
end
end
return false
end
if unicode.sub(name, 1, 1) == "/" then
local found, where = findIn("/")
if found then return where end
elseif unicode.sub(name, 1, 2) == "./" then
local found, where = findIn(shell.getWorkingDirectory())
if found then return where end
else
for path in string.gmatch(shell.getPath(), "[^:]+") do
local found, where = findIn(path)
if found then return where end
end
end
return false
end
-------------------------------------------------------------------------------
function shell.getAlias(alias)
return aliases[alias]
end
function shell.setAlias(alias, value)
checkArg(1, alias, "string")
checkArg(2, value, "string", "nil")
aliases[alias] = value
end
function shell.aliases()
return pairs(aliases)
end
function shell.resolveAlias(command, args)
checkArg(1, command, "string")
checkArg(2, args, "table", "nil")
args = args or {}
local program, lastProgram = command, nil
while true do
local tokens = text.tokenize(shell.getAlias(program) or program)
program = tokens[1]
if program == lastProgram then
break
end
lastProgram = program
for i = #tokens, 2, -1 do
table.insert(args, 1, tokens[i])
end
end
return program, args
end
function shell.getWorkingDirectory()
return os.getenv("PWD")
end
function shell.setWorkingDirectory(dir)
checkArg(1, dir, "string")
dir = fs.canonical(dir) .. "/"
if dir == "//" then dir = "/" end
if fs.isDirectory(dir) then
os.setenv("PWD", dir)
return true
else
return nil, "not a directory"
end
end
function shell.getPath()
return os.getenv("PATH")
end
function shell.setPath(value)
os.setenv("PATH", value)
end
function shell.resolve(path, ext)
if ext then
checkArg(2, ext, "string")
local where = findFile(path, ext)
if where then
return where
else
return nil, "file not found"
end
else
if unicode.sub(path, 1, 1) == "/" then
return fs.canonical(path)
else
return fs.concat(shell.getWorkingDirectory(), path)
end
end
end
function shell.execute(command, env, ...)
local sh, reason = getShell()
if not sh then
return false, reason
end
local result = table.pack(pcall(sh, env, command, ...))
if not result[1] and type(result[2]) == "table" and result[2].reason == "terminated" then
if result[2].code then
return true
else
return false, "terminated"
end
end
return table.unpack(result, 1, result.n)
end
function shell.parse(...)
local params = table.pack(...)
local args = {}
local options = {}
local doneWithOptions = false
for i = 1, params.n do
local param = params[i]
if not doneWithOptions and type(param) == "string" then
if param == "--" then
doneWithOptions = true -- stop processing options at `--`
elseif unicode.sub(param, 1, 2) == "--" then
if param:match("%-%-(.-)=") ~= nil then
options[param:match("%-%-(.-)=")] = param:match("=(.*)")
else
options[unicode.sub(param, 3)] = true
end
elseif unicode.sub(param, 1, 1) == "-" and param ~= "-" then
for j = 2, unicode.len(param) do
options[unicode.sub(param, j, j)] = true
end
else
table.insert(args, param)
end
else
table.insert(args, param)
end
end
return args, options
end
-------------------------------------------------------------------------------
return shell
| mit |
vonflynee/opencomputersserver | world/opencomputers/05fe03dc-84c6-416b-a304-6f79787f6411/lib/shell.lua | 15 | 5213 | local fs = require("filesystem")
local text = require("text")
local unicode = require("unicode")
local shell = {}
local aliases = {}
-- Cache loaded shells for command execution. This puts the requirement on
-- shells that they do not keep a global state, since they may be called
-- multiple times, but reduces memory usage a lot.
local shells = setmetatable({}, {__mode="v"})
local function getShell()
local shellPath = os.getenv("SHELL") or "/bin/sh"
local shellName, reason = shell.resolve(shellPath, "lua")
if not shellName then
return nil, "cannot resolve shell `" .. shellPath .. "': " .. reason
end
if shells[shellName] then
return shells[shellName]
end
local sh, reason = loadfile(shellName, "t", env)
if sh then
shells[shellName] = sh
end
return sh, reason
end
local function findFile(name, ext)
checkArg(1, name, "string")
local function findIn(dir)
if dir:sub(1, 1) ~= "/" then
dir = shell.resolve(dir)
end
dir = fs.concat(fs.concat(dir, name), "..")
local name = fs.name(name)
local list = fs.list(dir)
if list then
local files = {}
for file in list do
files[file] = true
end
if ext and unicode.sub(name, -(1 + unicode.len(ext))) == "." .. ext then
-- Name already contains extension, prioritize.
if files[name] then
return true, fs.concat(dir, name)
end
elseif files[name] then
-- Check exact name.
return true, fs.concat(dir, name)
elseif ext then
-- Check name with automatially added extension.
local name = name .. "." .. ext
if files[name] then
return true, fs.concat(dir, name)
end
end
end
return false
end
if unicode.sub(name, 1, 1) == "/" then
local found, where = findIn("/")
if found then return where end
elseif unicode.sub(name, 1, 2) == "./" then
local found, where = findIn(shell.getWorkingDirectory())
if found then return where end
else
for path in string.gmatch(shell.getPath(), "[^:]+") do
local found, where = findIn(path)
if found then return where end
end
end
return false
end
-------------------------------------------------------------------------------
function shell.getAlias(alias)
return aliases[alias]
end
function shell.setAlias(alias, value)
checkArg(1, alias, "string")
checkArg(2, value, "string", "nil")
aliases[alias] = value
end
function shell.aliases()
return pairs(aliases)
end
function shell.resolveAlias(command, args)
checkArg(1, command, "string")
checkArg(2, args, "table", "nil")
args = args or {}
local program, lastProgram = command, nil
while true do
local tokens = text.tokenize(shell.getAlias(program) or program)
program = tokens[1]
if program == lastProgram then
break
end
lastProgram = program
for i = #tokens, 2, -1 do
table.insert(args, 1, tokens[i])
end
end
return program, args
end
function shell.getWorkingDirectory()
return os.getenv("PWD")
end
function shell.setWorkingDirectory(dir)
checkArg(1, dir, "string")
dir = fs.canonical(dir) .. "/"
if dir == "//" then dir = "/" end
if fs.isDirectory(dir) then
os.setenv("PWD", dir)
return true
else
return nil, "not a directory"
end
end
function shell.getPath()
return os.getenv("PATH")
end
function shell.setPath(value)
os.setenv("PATH", value)
end
function shell.resolve(path, ext)
if ext then
checkArg(2, ext, "string")
local where = findFile(path, ext)
if where then
return where
else
return nil, "file not found"
end
else
if unicode.sub(path, 1, 1) == "/" then
return fs.canonical(path)
else
return fs.concat(shell.getWorkingDirectory(), path)
end
end
end
function shell.execute(command, env, ...)
local sh, reason = getShell()
if not sh then
return false, reason
end
local result = table.pack(pcall(sh, env, command, ...))
if not result[1] and type(result[2]) == "table" and result[2].reason == "terminated" then
if result[2].code then
return true
else
return false, "terminated"
end
end
return table.unpack(result, 1, result.n)
end
function shell.parse(...)
local params = table.pack(...)
local args = {}
local options = {}
local doneWithOptions = false
for i = 1, params.n do
local param = params[i]
if not doneWithOptions and type(param) == "string" then
if param == "--" then
doneWithOptions = true -- stop processing options at `--`
elseif unicode.sub(param, 1, 2) == "--" then
if param:match("%-%-(.-)=") ~= nil then
options[param:match("%-%-(.-)=")] = param:match("=(.*)")
else
options[unicode.sub(param, 3)] = true
end
elseif unicode.sub(param, 1, 1) == "-" and param ~= "-" then
for j = 2, unicode.len(param) do
options[unicode.sub(param, j, j)] = true
end
else
table.insert(args, param)
end
else
table.insert(args, param)
end
end
return args, options
end
-------------------------------------------------------------------------------
return shell
| mit |
UnfortunateFruit/darkstar | scripts/globals/mobskills/Panzerfaust.lua | 25 | 1285 | ---------------------------------------------
-- Panzerfaust
--
-- Description: Strikes a target twice with an armored fist. Additional effect: Knockback
-- Type: Physical
-- Utsusemi/Blink absorb: 2 shadows
-- Range: Melee
-- Notes:
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
-- onMobSkillCheck
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
---------------------------------------------
-- onMobWeaponSkill
---------------------------------------------
function onMobWeaponSkill(target, mob, skill)
local numhits = 2;
local accmod = 1;
local dmgmod = 1.5;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded);
target:delHP(dmg);
if (mob:getName() == "Despot") then
if (mob:actionQueueAbility() == false) then
local rand = math.random(1,4); -- Panzerfaust 3-6 times
for i = 0,rand do
mob:useMobAbility(280);
end
end
end
return dmg;
end;
| gpl-3.0 |
NezzKryptic/Wire-Extras | lua/autorun/server/lib-gui-panel-server.lua | 1 | 13612 | AddCSLuaFile ("autorun/shared/lib-gui-panel-shared.lua")
AddCSLuaFile ("autorun/client/lib-gui-panel-client.lua")
include ("autorun/shared/lib-gui-panel-shared.lua")
guiP_schemeTable = {}
local nVal = 1
for k,sch in pairs(guiP_colourScheme) do
--Msg("found scheme "..k.."\n")
guiP_schemeTable[k] = nVal
nVal = nVal + 1
end
------------------------CLIENT / SERVER COMMUNICATIONS------------------------------
--Console variables for recieved data
--CreateConVar("wmpcldata", "0", false, false )
--CreateConVar("wmpcldwait", 0, false, false )
--Called by a client to request panel setup information
function clientPanelInitRequest(player, commandName, args)
--Msg ("responding to init request\n")
local ent = ents.GetByIndex(args[1])
--ent = guipLastNewEnt
umSendPanelInit(ent, ent.entID)
umSendPanelScheme(ent, ent.currentScheme)
umSendPanelWake(ent)
umSendPanelState(ent, true)
end
concommand.Add("guiPinitMe", clientPanelInitRequest)
function umSendPanelInit(ent, entID)
umsg.Start("umsgClientPanelInit", player)
umsg.Entity(ent)
umsg.Short(entID)
umsg.End()
end
function umSendPanelScheme(ent, scheme)
umsg.Start("umsgPanelScheme", player)
umsg.Entity(ent)
umsg.Short(guiP_schemeTable[scheme])
umsg.End()
end
function umSendPanelWake(ent)
umsg.Start("umsgPanelWake", player)
umsg.Short(42)
umsg.Entity(ent)
umsg.End()
end
function umSendPanelState(ent, state)
umsg.Start("umsgPanelState", player)
umsg.Entity(ent)
umsg.Bool(state)
umsg.End()
end
function guiP_cl_drawUpdate(widget, paramNum, value)
local allPlayers = RecipientFilter()
allPlayers:AddAllPlayers()
isString = (type(value) == "string")
umsg.Start("umsgDrawUpdate", allPlayers)
umsg.Entity(widget.parent)
umsg.Short(widget.modIndex)
umsg.Short(paramNum)
umsg.Bool(isString)
if (isString) then
umsg.String(value)
else
umsg.Float(value)
end
umsg.End()
end
--[[
print(type(Function)) // Prints "function"
print(type(String)) // Prints "string"
print(type(Number)) // Prints "number"
print(type(Table)) // Prints "table"
]]--
function gpCursorClick (ply)
local trace = {}
trace.start = ply:GetShootPos()
trace.endpos = ply:GetAimVector() * 64 + trace.start
trace.filter = ply
local trace = util.TraceLine(trace)
local ent = trace.Entity
if (ent.Base == "base_gui_panel") then
if !ent.paramsSetup then
ent:SetupParams()
end
local pos = ent.Entity:WorldToLocal(trace.HitPos)
local xval = (ent.x1 - pos.y) / (ent.x1 - ent.x2)
local yval = (ent.y1 - pos.z) / (ent.y1 - ent.y2)
if (xval >= 0 and yval >= 0 and xval <= 1 and yval <= 1) then
--Msg ("clicked at ( "..xval.." , "..yval.." )\n")
for k, widget in ipairs(ent.pWidgets) do
if (xval * ent.drawParams.screenWidth > widget.X) && (yval * ent.drawParams.screenHeight > widget.Y) && (xval * ent.drawParams.screenWidth < widget.X + widget.W) && (yval * ent.drawParams.screenHeight < widget.Y + widget.H) then
--Msg("clicked on widget\n")
if (widget.enabled) then
widget.modType.modClicked (ply, widget, (xval * ent.drawParams.screenWidth) - widget.X, (yval * ent.drawParams.screenHeight) - widget.Y)
end
end
end
end
return true
end
end
function AttackKeyPress (ply, key)
if (key == IN_ATTACK or key == IN_USE) then
gpCursorClick (ply)
--add keyboard (text entry) support here
end
end
hook.Add( "KeyPress", "guipanelKeyHook", AttackKeyPress )
--------------------------User Functions----------------------------------------------------
function guiP_PanelInit(ent, w, h)
local newID = table.getn(guiP_panelDatabase) + 1
table.insert(guiP_panelDatabase, ent)
guipLastNewEnt = ent
ent.entID = newID
ent.initOccured = true
--make transmit to client, or just add this to client code also?
ent.drawParams = {}
if (w and w > 0) then
ent.drawParams.screenWidth = w
else
ent.drawParams.screenWidth = 200
end
if (h and h > 0) then
ent.drawParams.screenHeight = h
else
ent.drawParams.screenHeight = 200
end
ent.pWidgets = {}
ent.nameTable = {}
end
function guiP_SetPanelState(ent, enabled)
if (!ent.firstRun.enable) then
umSendPanelState(ent, enabled)
ent.firstRun.enable = true
end
end
function guiP_SetPanelScheme(ent, scheme)
--Msg ("scheme "..scheme.."\n")
if (guiP_schemeTable[scheme]) then
ent.currentScheme = guiP_colourScheme[scheme]
--Msg(string.format("using scheme #%d (%s)\n", guiP_schemeTable[scheme], scheme))
ent.currentScheme = scheme
--[[
if (!ent.firstRun.scheme) then
umSendPanelScheme(ent, scheme)
ent.firstRun.scheme = true
end
]]--
umSendPanelScheme(ent, scheme)
else
Msg(ent.errorMsg.."colour scheme '"..scheme.."' not found\n")
end
end
--Clear all widgets
function guiP_ClearWidgets(ent)
end
--Set widget variable
function guiP_setWidgetProperty (ent, modName, inpName, value)
local modNum = ent.nameTable[modName]
--Msg(string.format("value at smv = %f\n", value))
--servSendInput(ent, modNum, ent.pWidgets[modNum].modType.inputs[inpName].index, ent.pWidgets[modNum].modType.inputs[inpName].msgType, value)
if (ent.pWidgets[modNum]) then
ent.pWidgets[modNum].modType.triggerInput(ent.pWidgets[modNum], inpName, value)
else
Msg(ent.errorMsg.."invalid widget number\n")
end
end
function guiP_loadWidgetsFromTable(ent, widTable)
local wireData = {inputs = {}, inputMap = {}, outputs = {}, outputMap = {}}
for k, wid in ipairs (widTable) do
Msg("adding widget "..wid.name..", x = "..wid.x.."\n")
--wid.paramTable = {} --not supported yet
for tk, tp in pairs (wid.params) do
Msg("wid has param "..tk..", "..tp.."\n")
end
guiP_AddWidget(ent, wid.name, guiP_widgetLookup[wid.widgetType], wid.x, wid.y, wid.w, wid.h, wid.params)
Msg("wire name = "..wid.wire.name..", type = "..wid.wire.wireType.."\n")
if (wid.wire.wireType == 1) then
table.insert(wireData.inputs, wid.wire.name)
wireData.inputMap[wid.wire.name] = wid.name
elseif (wid.wire.wireType == 2) then
table.insert(wireData.outputs, wid.wire.name)
wireData.outputMap[wid.name] = wid.wire.name
end
end
return wireData
end
function guiP_fileDataToTable (fileData)
--local wireData = {inputs = {}, inputMap = {}, outputs = {}, outputMap = {}}
local widgetTable = {}
local lineTable = string.Explode(string.char(10), fileData)
--for each widgets (line)
for k, line in ipairs(lineTable) do
local newWidget = {
name = "",
index = 0,
widgetType = 1,
x = 0,
y = 0,
w = 0,
h = 0,
params = {},
wire = {name = "", wireType = nil}
}
if (string.Left(line, 1) == string.char(34)) then
local lineData = string.Explode(string.char(9), line)
local stillTabs = true
--parse line, remove all tabs
while (stillTabs) do
stillTabs = false
for dk, dItem in ipairs(lineData) do
if (string.byte(dItem) == 9 or not string.byte(dItem)) then
table.remove(lineData, dk)
stillTabs = true
elseif (string.Left(dItem, 1) == string.char(9)) then
lineData[dk] = string.Right(dItem, string.len(dItem) - 1)
end
end
end
--remove speeh marks
for dk, dItem in ipairs(lineData) do
if (string.Left(dItem, 1) == string.char(34)) then
lineData[dk] = string.sub(lineData[dk], 2, string.len(lineData[dk]) - 1)
end
end
for k, nn in ipairs (lineData) do
Msg("dat "..k.." : '"..nn.."'\n")
end
local mName = lineData[1]
local mType = lineData[2]
Msg("tryconv '"..lineData[3].."'\n")
local mLeft = tonumber(lineData[3])
local mTop = tonumber(lineData[4])
local mWidth = tonumber(lineData[5])
local mHeight = tonumber(lineData[6])
local parmTable = {}
local parmStart = 7
--read wire settings
if (lineData[7] == "WIREI" || lineData[7] == "WIREO") then
if (lineData[7] == "WIREI") then
newWidget.wire.wireType = 1
newWidget.wire.name = lineData[8]
else
newWidget.wire.wireType = 2
newWidget.wire.name = lineData[8]
end
parmStart = 9
end
--read extra parameters
if (table.getn(lineData) > parmStart) then
for iv=parmStart, table.getn(lineData), 2 do
newWidget.params[lineData[iv]] = lineData[iv + 1]
end
end
Msg(string.format("complete widget: '%s' '%s' '%d' '%d '%d' '%d' + parmtable?\n", mName, mType, mLeft, mTop, mWidth, mHeight))
newWidget.name = mName
newWidget.widgetType = guiP_widgetLookup[mType]
newWidget.x = mLeft
newWidget.y = mTop
newWidget.w = mWidth
newWidget.h = mHeight
table.insert (widgetTable, table.Copy (newWidget))
Msg("widget.y = "..newWidget.w.."\n")
widgetTable[table.getn (widgetTable)].index = table.getn (widgetTable)
end
end
return widgetTable
end
--"modular_panels/"..fileselect
function SaveTableToFile (widgetTable, filename)
local fileString = ""
for k, wid in ipairs (widgetTable) do
Msg("adding to save, wid "..wid.name..", x = "..wid.x..", y = "..wid.y..", w = "..wid.w..", h = "..wid.h.."\n")
local wireString = ""
if (wid.wire.wireType == 1) then
wireString = string.format ('WIREI\t"%s"', wid.wire.name)
elseif (wid.wire.wireType == 2) then
wireString = string.format ('WIREO\t"%s"', wid.wire.name)
end
Msg("wt lookup = "..guiP_widgetLookup[wid.widgetType]..", ws = "..wireString.."\n")
local newLine = string.format ('"%s"\t%s\t%d\t%d\t%d\t%d\t%s\n', wid.name, guiP_widgetLookup[wid.widgetType], wid.x, wid.y, wid.w, wid.h, wireString)
fileString = fileString .. newLine
end
file.Write (filename, fileString)
end
--Load widgets from a file (including wire i/o)
function guiP_LoadWidgetsFromFileData(ent, fileData)
local wireData = {inputs = {}, inputMap = {}, outputs = {}, outputMap = {}}
local lineTable = string.Explode(string.char(10), fileData)
for k, line in ipairs(lineTable) do
if (string.Left(line, 1) == string.char(34)) then
--Msg(string.format("Line #%d = '%s'\n", k, line))
local lineData = string.Explode(string.char(9), line)
local stillTabs = true
--parse line, remove all tabs
while (stillTabs) do
stillTabs = false
--Msg("parsing for tabs\n")
for dk, dItem in ipairs(lineData) do
--Msg("instecting #"..tostring(dk).." = "..dItem.."\n")
if (dItem == string.char(9)) then
--Msg("removing\n")
table.remove(lineData, dk)
stillTabs = true
elseif (string.Left(dItem, 1) == string.char(9)) then
--Msg("needs cropping\n")
--Msg(string.format("replacing '%s' with '%s'\n", dItem, string.Right(dItem, string.len(dItem) - 1)))
lineData[dk] = string.Right(dItem, string.len(dItem) - 1)
--Msg(string.format("verified '%s'\n", dItem))
--stillTabs = true
end
end
end
--remove speeh marks
for dk, dItem in ipairs(lineData) do
if (string.Left(dItem, 1) == string.char(34)) then
lineData[dk] = string.sub(lineData[dk], 2, string.len(lineData[dk]) - 1)
end
end
local mName = lineData[1]
local mType = lineData[2]
local mLeft = tonumber(lineData[3])
local mTop = tonumber(lineData[4])
local mWidth = tonumber(lineData[5])
local mHeight = tonumber(lineData[6])
local parmTable = {}
local parmStart = 7
--read wire settings
if (lineData[7] == "WIREI" || lineData[7] == "WIREO") then
if (lineData[7] == "WIREI") then
--Msg("adding wire input "..lineData[8].."\n")
table.insert(wireData.inputs, lineData[8])
wireData.inputMap[lineData[8]] = mName
else
--Msg("adding wire output "..lineData[8].."\n")
table.insert(wireData.outputs, lineData[8])
wireData.outputMap[mName] = lineData[8]
end
parmStart = 9
end
--read extra parameters
if (table.getn(lineData) > parmStart) then
for iv=parmStart, table.getn(lineData), 2 do
parmTable[lineData[iv]] = lineData[iv + 1]
--Msg("added param "..lineData[iv].." = "..lineData[iv + 1].."\n")
end
end
Msg(string.format("complete widget: '%s' '%s' '%d' '%d '%d' '%d' + parmtable?\n", mName, mType, mLeft, mTop, mWidth, mHeight))
guiP_AddWidget(ent, mName, mType, mLeft, mTop, mWidth, mHeight, parmTable)
end
end
return wireData
end
--Send panel config to client
function guiP_SendClientWidgets(ent)
local allPlayers = RecipientFilter()
allPlayers:AddAllPlayers()
umsg.Start("umsgPanelConfig", allPlayers)
--Msg("starting panel usmg\n")
umsg.Entity(ent)
umsg.Short(table.getn(ent.pWidgets))
for key, modu in ipairs(ent.pWidgets) do
Msg(string.format("sending panel #%d\n", key))
--umsg.String(modu.modType.name)
Msg("sending type = "..tostring(modu.modType.name).."\n")
Msg("modindex "..tostring(guiP_widgetLookup[modu.modType.name]).."\n")
umsg.Short(guiP_widgetLookup[modu.modType.name])
--umsg.Short(key)
umsg.Short(modu.X)
umsg.Short(modu.Y)
umsg.Short(modu.W)
umsg.Short(modu.H)
--check extra params
local numParams = table.Count(modu.paramTable)
umsg.Short(numParams)
local keysend = 0
for pkey, param in pairs(modu.paramTable) do
--Msg(string.format("key = %s, param = %s, cms = '%s'\n", pkey, param, table.concat(modu.modType.paramTable)))
Msg("cs param "..pkey.." = "..param.."\n")
--if (modu.modType.paramTable[pkey]) then
--Msg("param verified for client\n")
--Msg("looking up param "..pkey..", index = "..modu.modType.paramTable[pkey].index.."\n")
--keysend = modu.modType.paramTable[pkey].index
--else
--- Msg(ent.errorMsg.."param error\n")
--end
--Msg("(server) param #"..tostring(keysend).." = "..tostring(param).."\n")
umsg.Short(pkey)
umsg.String(tostring(param))
end
end
umsg.Bool(true)
umsg.End()
end
--function guiP_PanelEnable(ent)
--end
| gpl-3.0 |
morganzhh/sysrepo | swig/lua/tests/changes.lua | 1 | 4673 | local sr = require("libsysrepoLua")
local lu = require('luaunit')
local MODULE_NAME = 'swig-test' -- name of module used for testing
local LOW_BOUND = 10 -- for testing purposes, index of lowest 'eth' interface name
local HIGH_BOUND = 20 -- for testing purposes, index of highest 'eth' interface name
local CHANGE_PATH = "/" .. MODULE_NAME .. ":*"
local xpath_if_fmt = "/swig-test:lua-changes/test[name='%s']/%s"
-- Helper functions
local function sleep()
local _sleep_ignore = 0
for i=1,100000000 do
_sleep_ignore = i + _sleep_ignore
end
end
function clean_slate(sess)
local function _cb(session, module_name, event, private_ctx)
print('clean cb')
return tonumber(sr.SR_ERR_OK)
end
local xpath = "/" .. MODULE_NAME .. ":*"
local subs = sr.Subscribe(sess)
local wrap = sr.Callback_lua(_cb)
subs:module_change_subscribe(MODULE_NAME, wrap, nil, 0, sr.SR_SUBSCR_APPLY_ONLY);
print('cleaning up', xpath)
sess:delete_item(xpath)
sess:commit()
sess:copy_config(MODULE_NAME, sr.SR_DS_RUNNING, sr.SR_DS_STARTUP)
sleep()
end
local function get_test_name(i)
return 'luatest'..'-'..tostring(i)
end
local function init_test(sess)
local function _cb(session, module_name, event, private_ctx)
print('init cb')
return tonumber(sr.SR_ERR_OK)
end
local subs = sr.Subscribe(sess);
local wrap = sr.Callback_lua(_cb)
subs:module_change_subscribe(MODULE_NAME, wrap, nil, 0, sr.SR_SUBSCR_APPLY_ONLY);
for i=LOW_BOUND, HIGH_BOUND do
local val = sr.Val(i, sr.SR_INT32_T)
local xpath = string.format(xpath_if_fmt, get_test_name(i), 'number')
sess:set_item(xpath, val)
end
sess:commit()
sess:copy_config(MODULE_NAME, sr.SR_DS_RUNNING, sr.SR_DS_STARTUP)
sleep()
subs:unsubscribe()
sleep()
end
-- Suite start:
local conn = sr.Connection('main connection')
local sess = sr.Session(conn)
clean_slate(sess)
-- Test suite:
TestChanges = {}
function TestChanges:setUp()
self.setup_test_num = 42
end
-- Clean-up after test has executed.
function TestChanges:tearDown()
collectgarbage()
collectgarbage()
end
function TestChanges:test_module_change()
local set_num = 42
local mod_num = 43
local deletitionp = false;
init_test(sess)
local function _cb(session, module_name, event, private_ctx)
print('test_module_change_cb', deletitionp)
if not deletitionp then
deletitionp = true
return tonumber(sr.SR_ERR_OK)
end
local it = session:get_changes_iter(CHANGE_PATH);
lu.assertNotIsNil(it)
while true do
local change = session:get_change_next(it)
if (change == nil) then break end
lu.assertEquals(change:oper(), sr.SR_OP_MODIFIED)
end
return tonumber(sr.SR_ERR_OK)
end
-- local conn, sess, subs = init_helper('change-modify')
-- local wrap = sr.Callback_lua(_cb)
-- subs:module_change_subscribe(MODULE_NAME, wrap, nil, 0, sr.SR_SUBSCR_APPLY_ONLY);
local wrap = sr.Callback_lua(_cb)
local subs = sr.Subscribe(sess)
subs:module_change_subscribe(MODULE_NAME, wrap, nil, 0, sr.SR_SUBSCR_APPLY_ONLY);
local val = sr.Val(set_num, sr.SR_INT32_T)
local xpath = string.format(xpath_if_fmt, get_test_name(set_num), 'number')
sess:set_item(xpath, val)
sess:commit()
sleep()
local xpath = string.format(xpath_if_fmt, get_test_name(set_num), 'number')
local val2 = sr.Val(mod_num, sr.SR_INT32_T)
sess:set_item(xpath, val2)
sess:commit()
sleep()
subs:unsubscribe()
sleep()
end
function TestChanges:test_module_change_delete()
local set_num = 44
local deletitionp = false;
init_test(sess)
local function _cb(session, module_name, event, private_ctx)
print('test_module_change_delete_cb', deletitionp)
if not deletitionp then
deletitionp = true
return tonumber(sr.SR_ERR_OK)
end
local it = session:get_changes_iter(CHANGE_PATH);
lu.assertNotIsNil(it)
while true do
local change = session:get_change_next(it)
if (change == nil) then break end
lu.assertEquals(change:oper(), sr.SR_OP_DELETED)
end
return tonumber(sr.SR_ERR_OK)
end
local wrap = sr.Callback_lua(_cb)
local subs = sr.Subscribe(sess)
subs:module_change_subscribe(MODULE_NAME, wrap, nil, 0, sr.SR_SUBSCR_APPLY_ONLY);
local setval = sr.Val(set_num, sr.SR_INT32_T)
local xpath = string.format(xpath_if_fmt, get_test_name(set_num), 'number')
sess:set_item(xpath, setval)
sess:commit()
sleep()
sess:delete_item(xpath)
sess:commit()
sleep()
subs:unsubscribe()
sleep()
end
local runner = lu.LuaUnit.new()
runner:setOutputType("tap")
local rc = runner:runSuite()
clean_slate(sess)
os.exit(rc)
| apache-2.0 |
vonflynee/opencomputersserver | world/opencomputers/a3abb948-eba5-4c6b-9388-1bb1f150ed2b/lib/event.lua | 16 | 6257 | local computer = require("computer")
local keyboard = require("keyboard")
local event, listeners, timers = {}, {}, {}
local lastInterrupt = -math.huge
local function call(callback, ...)
local result, message = pcall(callback, ...)
if not result and type(event.onError) == "function" then
pcall(event.onError, message)
return
end
return message
end
local function dispatch(signal, ...)
if listeners[signal] then
local function callbacks()
local list = {}
for index, listener in ipairs(listeners[signal]) do
list[index] = listener
end
return list
end
for _, callback in ipairs(callbacks()) do
if call(callback, signal, ...) == false then
event.ignore(signal, callback) -- alternative method of removing a listener
end
end
end
end
local function tick()
local function elapsed()
local list = {}
for id, timer in pairs(timers) do
if timer.after <= computer.uptime() then
table.insert(list, timer.callback)
timer.times = timer.times - 1
if timer.times <= 0 then
timers[id] = nil
else
timer.after = computer.uptime() + timer.interval
end
end
end
return list
end
for _, callback in ipairs(elapsed()) do
call(callback)
end
end
local function createPlainFilter(name, ...)
local filter = table.pack(...)
if name == nil and filter.n == 0 then
return nil
end
return function(...)
local signal = table.pack(...)
if name and not (type(signal[1]) == "string" and signal[1]:match(name)) then
return false
end
for i = 1, filter.n do
if filter[i] ~= nil and filter[i] ~= signal[i + 1] then
return false
end
end
return true
end
end
local function createMultipleFilter(...)
local filter = table.pack(...)
if filter.n == 0 then
return nil
end
return function(...)
local signal = table.pack(...)
if type(signal[1]) ~= "string" then
return false
end
for i = 1, filter.n do
if filter[i] ~= nil and signal[1]:match(filter[i]) then
return true
end
end
return false
end
end
-------------------------------------------------------------------------------
function event.cancel(timerId)
checkArg(1, timerId, "number")
if timers[timerId] then
timers[timerId] = nil
return true
end
return false
end
function event.ignore(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
if listeners[name] then
for i = 1, #listeners[name] do
if listeners[name][i] == callback then
table.remove(listeners[name], i)
if #listeners[name] == 0 then
listeners[name] = nil
end
return true
end
end
end
return false
end
function event.listen(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
if listeners[name] then
for i = 1, #listeners[name] do
if listeners[name][i] == callback then
return false
end
end
else
listeners[name] = {}
end
table.insert(listeners[name], callback)
return true
end
function event.onError(message)
local log = io.open("/tmp/event.log", "a")
if log then
log:write(message .. "\n")
log:close()
end
end
function event.pull(...)
local args = table.pack(...)
if type(args[1]) == "string" then
return event.pullFiltered(createPlainFilter(...))
else
checkArg(1, args[1], "number", "nil")
checkArg(2, args[2], "string", "nil")
return event.pullFiltered(args[1], createPlainFilter(select(2, ...)))
end
end
function event.pullMultiple(...)
local seconds
local args
if type(...) == "number" then
seconds = ...
args = table.pack(select(2,...))
for i=1,args.n do
checkArg(i+1, args[i], "string", "nil")
end
else
args = table.pack(...)
for i=1,args.n do
checkArg(i, args[i], "string", "nil")
end
end
return event.pullFiltered(seconds, createMultipleFilter(table.unpack(args, 1, args.n)))
end
function event.pullFiltered(...)
local args = table.pack(...)
local seconds, filter
if type(args[1]) == "function" then
filter = args[1]
else
checkArg(1, args[1], "number", "nil")
checkArg(2, args[2], "function", "nil")
seconds = args[1]
filter = args[2]
end
local deadline = seconds and
(computer.uptime() + seconds) or
(filter and math.huge or 0)
repeat
local closest = seconds and deadline or math.huge
for _, timer in pairs(timers) do
closest = math.min(closest, timer.after)
end
local signal = table.pack(computer.pullSignal(closest - computer.uptime()))
if signal.n > 0 then
dispatch(table.unpack(signal, 1, signal.n))
end
tick()
if event.shouldInterrupt() then
lastInterrupt = computer.uptime()
error("interrupted", 0)
end
if event.shouldSoftInterrupt() and (filter == nil or filter("interrupted", computer.uptime() - lastInterrupt)) then
local awaited = computer.uptime() - lastInterrupt
lastInterrupt = computer.uptime()
return "interrupted", awaited
end
if not (seconds or filter) or filter == nil or filter(table.unpack(signal, 1, signal.n)) then
return table.unpack(signal, 1, signal.n)
end
until computer.uptime() >= deadline
end
function event.shouldInterrupt()
return computer.uptime() - lastInterrupt > 1 and
keyboard.isControlDown() and
keyboard.isAltDown() and
keyboard.isKeyDown(keyboard.keys.c)
end
function event.shouldSoftInterrupt()
return computer.uptime() - lastInterrupt > 1 and
keyboard.isControlDown() and
keyboard.isKeyDown(keyboard.keys.c)
end
function event.timer(interval, callback, times)
checkArg(1, interval, "number")
checkArg(2, callback, "function")
checkArg(3, times, "number", "nil")
local id
repeat
id = math.floor(math.random(1, 0x7FFFFFFF))
until not timers[id]
timers[id] = {
interval = interval,
after = computer.uptime() + interval,
callback = callback,
times = times or 1
}
return id
end
-------------------------------------------------------------------------------
return event
| mit |
vonflynee/opencomputersserver | world/opencomputers/c0a0157a-e685-4d05-9dc9-9340cf29f413/lib/event.lua | 16 | 6257 | local computer = require("computer")
local keyboard = require("keyboard")
local event, listeners, timers = {}, {}, {}
local lastInterrupt = -math.huge
local function call(callback, ...)
local result, message = pcall(callback, ...)
if not result and type(event.onError) == "function" then
pcall(event.onError, message)
return
end
return message
end
local function dispatch(signal, ...)
if listeners[signal] then
local function callbacks()
local list = {}
for index, listener in ipairs(listeners[signal]) do
list[index] = listener
end
return list
end
for _, callback in ipairs(callbacks()) do
if call(callback, signal, ...) == false then
event.ignore(signal, callback) -- alternative method of removing a listener
end
end
end
end
local function tick()
local function elapsed()
local list = {}
for id, timer in pairs(timers) do
if timer.after <= computer.uptime() then
table.insert(list, timer.callback)
timer.times = timer.times - 1
if timer.times <= 0 then
timers[id] = nil
else
timer.after = computer.uptime() + timer.interval
end
end
end
return list
end
for _, callback in ipairs(elapsed()) do
call(callback)
end
end
local function createPlainFilter(name, ...)
local filter = table.pack(...)
if name == nil and filter.n == 0 then
return nil
end
return function(...)
local signal = table.pack(...)
if name and not (type(signal[1]) == "string" and signal[1]:match(name)) then
return false
end
for i = 1, filter.n do
if filter[i] ~= nil and filter[i] ~= signal[i + 1] then
return false
end
end
return true
end
end
local function createMultipleFilter(...)
local filter = table.pack(...)
if filter.n == 0 then
return nil
end
return function(...)
local signal = table.pack(...)
if type(signal[1]) ~= "string" then
return false
end
for i = 1, filter.n do
if filter[i] ~= nil and signal[1]:match(filter[i]) then
return true
end
end
return false
end
end
-------------------------------------------------------------------------------
function event.cancel(timerId)
checkArg(1, timerId, "number")
if timers[timerId] then
timers[timerId] = nil
return true
end
return false
end
function event.ignore(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
if listeners[name] then
for i = 1, #listeners[name] do
if listeners[name][i] == callback then
table.remove(listeners[name], i)
if #listeners[name] == 0 then
listeners[name] = nil
end
return true
end
end
end
return false
end
function event.listen(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
if listeners[name] then
for i = 1, #listeners[name] do
if listeners[name][i] == callback then
return false
end
end
else
listeners[name] = {}
end
table.insert(listeners[name], callback)
return true
end
function event.onError(message)
local log = io.open("/tmp/event.log", "a")
if log then
log:write(message .. "\n")
log:close()
end
end
function event.pull(...)
local args = table.pack(...)
if type(args[1]) == "string" then
return event.pullFiltered(createPlainFilter(...))
else
checkArg(1, args[1], "number", "nil")
checkArg(2, args[2], "string", "nil")
return event.pullFiltered(args[1], createPlainFilter(select(2, ...)))
end
end
function event.pullMultiple(...)
local seconds
local args
if type(...) == "number" then
seconds = ...
args = table.pack(select(2,...))
for i=1,args.n do
checkArg(i+1, args[i], "string", "nil")
end
else
args = table.pack(...)
for i=1,args.n do
checkArg(i, args[i], "string", "nil")
end
end
return event.pullFiltered(seconds, createMultipleFilter(table.unpack(args, 1, args.n)))
end
function event.pullFiltered(...)
local args = table.pack(...)
local seconds, filter
if type(args[1]) == "function" then
filter = args[1]
else
checkArg(1, args[1], "number", "nil")
checkArg(2, args[2], "function", "nil")
seconds = args[1]
filter = args[2]
end
local deadline = seconds and
(computer.uptime() + seconds) or
(filter and math.huge or 0)
repeat
local closest = seconds and deadline or math.huge
for _, timer in pairs(timers) do
closest = math.min(closest, timer.after)
end
local signal = table.pack(computer.pullSignal(closest - computer.uptime()))
if signal.n > 0 then
dispatch(table.unpack(signal, 1, signal.n))
end
tick()
if event.shouldInterrupt() then
lastInterrupt = computer.uptime()
error("interrupted", 0)
end
if event.shouldSoftInterrupt() and (filter == nil or filter("interrupted", computer.uptime() - lastInterrupt)) then
local awaited = computer.uptime() - lastInterrupt
lastInterrupt = computer.uptime()
return "interrupted", awaited
end
if not (seconds or filter) or filter == nil or filter(table.unpack(signal, 1, signal.n)) then
return table.unpack(signal, 1, signal.n)
end
until computer.uptime() >= deadline
end
function event.shouldInterrupt()
return computer.uptime() - lastInterrupt > 1 and
keyboard.isControlDown() and
keyboard.isAltDown() and
keyboard.isKeyDown(keyboard.keys.c)
end
function event.shouldSoftInterrupt()
return computer.uptime() - lastInterrupt > 1 and
keyboard.isControlDown() and
keyboard.isKeyDown(keyboard.keys.c)
end
function event.timer(interval, callback, times)
checkArg(1, interval, "number")
checkArg(2, callback, "function")
checkArg(3, times, "number", "nil")
local id
repeat
id = math.floor(math.random(1, 0x7FFFFFFF))
until not timers[id]
timers[id] = {
interval = interval,
after = computer.uptime() + interval,
callback = callback,
times = times or 1
}
return id
end
-------------------------------------------------------------------------------
return event
| mit |
inmation/library | inmation/dropzone-file-parser.lua | 1 | 2427 | -- inmation.dropzone-file-parser
-- inmation Script Library Lua Script
--
-- (c) 2017 inmation
--
-- Version history:
--
-- 20161017.1 Initial release.
--
local ioLib = require('io')
local DropzoneFileParser = {
onListeners = {}, -- Array of objects with { action, callback }
}
DropzoneFileParser.__index = DropzoneFileParser
-- Private
local function notifyListeners(self, action, args)
-- Explicit set continue to false will stop the processing of the file.
local continue = nil
if #self.onListeners > 0 then
for _, listener in ipairs(self.onListeners) do
if listener.action == "" or listener.action == action then
args.action = action
local cont = listener.callback(args)
if false == cont then
continue = false;
end
end
end
end
return continue
end
-- Public
function DropzoneFileParser.new(o)
o = o or {} -- create object if user does not provide one
setmetatable(o, DropzoneFileParser)
return o
end
function DropzoneFileParser:on(callback)
self:onAction("", callback)
end
-- action like FileOpened, Line, FileClosing, FileClosed
function DropzoneFileParser:onAction(action, callback)
local listener = {
action = action,
callback = callback
}
table.insert(self.onListeners, listener)
end
function DropzoneFileParser:process(filename)
local args = {
filename = filename
}
-- on FileOpening
local continue = notifyListeners(self, 'FileOpening', args)
if false == continue then return end
local file = ioLib.open(filename)
if nil ~= file then
args.file = file
-- on FileOpened
continue = notifyListeners(self, 'FileOpened', args)
if false == continue then return end
local lineNumber = 0
for line in file:lines() do
args.line = line
args.lineNumber = lineNumber
-- on Line
continue = notifyListeners(self, 'Line', args)
if false == continue then break end
lineNumber = lineNumber + 1
end
-- on FileClosing
args.line = nil
notifyListeners(self, 'FileClosing', args)
file:close()
-- on FileClosed
args.file = nil
notifyListeners(self, 'FileClosed', args)
end
end
return DropzoneFileParser | mit |
Spartan322/finalfrontier | gamemode/sgui/securitypage.lua | 3 | 4099 | -- Copyright (c) 2014 James King [metapyziks@gmail.com]
--
-- This file is part of Final Frontier.
--
-- Final Frontier is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as
-- published by the Free Software Foundation, either version 3 of
-- the License, or (at your option) any later version.
--
-- Final Frontier 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 Lesser General Public License
-- along with Final Frontier. If not, see <http://www.gnu.org/licenses/>.
local BASE = "page"
GUI.BaseName = BASE
GUI.PermNoneColor = Color(127, 127, 127, 255)
GUI.PermAccessColor = Color(45, 51, 172, 255)
GUI.PermSystemColor = Color(51, 172, 45, 255)
GUI.PermSecurityColor = Color(172, 45, 51, 255)
GUI._playerList = nil
GUI._buttons = nil
function GUI:UpdateButtons()
if self._buttons then
for _, btn in pairs(self._buttons) do
btn:Remove()
end
self._buttons = nil
end
if self._playerList then
self._buttons = {}
for i, ply in ipairs(self._playerList) do
if i > 12 then break end
local btn = sgui.Create(self, "securitybutton")
btn:SetPlayer(ply)
btn:SetSize((self:GetWidth() - 16) / 2 - 4, 48)
btn:SetCentre(self:GetWidth() / 4
+ math.floor((i - 1) / 6) * self:GetWidth() / 2,
((i - 1) % 6) * 48 + 32)
table.insert(self._buttons, btn)
end
end
end
function GUI:Enter()
self.Super[BASE].Enter(self)
local function keyLabel(index, text, clr)
local lbl = sgui.Create(self, "label")
lbl.Text = text
lbl:SetSize((self:GetWidth() - 32) / 5 + 16, 64)
lbl:SetCentre((self:GetWidth() - 32) * (2 * index + 1) / 10 + 16, self:GetHeight() - 32)
lbl.AlignX = TEXT_ALIGN_CENTER
lbl.AlignY = TEXT_ALIGN_CENTER
lbl.Color = clr or lbl.Color
end
keyLabel(0, "COLOR KEY:", Color(64, 64, 64, 255))
keyLabel(1, "NONE", self.PermNoneColor)
keyLabel(2, "ACCESS", self.PermAccessColor)
keyLabel(3, "SYSTEM", self.PermSystemColor)
keyLabel(4, "SECURITY", self.PermSecurityColor)
if SERVER then
self._playerList = self:GetShip():GetPlayers()
table.sort(self._playerList, function(a, b)
return self:GetScreen():GetPos():DistToSqr(a:GetPos())
< self:GetScreen():GetPos():DistToSqr(b:GetPos())
end)
self:UpdateButtons()
end
end
function GUI:Leave()
self.Super[BASE].Leave(self)
self._playerList = nil
self._buttons = nil
end
if SERVER then
function GUI:UpdateLayout(layout)
self.Super[BASE].UpdateLayout(self, layout)
if not self._playerList then
layout.players = nil
else
if not layout.players or #layout.players > #self._playerList then
layout.players = {}
end
for i, ply in ipairs(self._playerList) do
layout.players[i] = ply
end
end
end
end
if CLIENT then
function GUI:UpdateLayout(layout)
if layout.players then
if not self._playerList or #self._playerList > #layout.players then
self._playerList = {}
end
local changed = false
for i, ply in pairs(layout.players) do
if not self._playerList[i] or self._playerList[i] ~= ply then
changed = true
self._playerList[i] = ply
end
end
if changed then self:UpdateButtons() end
else
if self._playerList then
self._playerList = nil
self:UpdateButtons()
end
end
self.Super[BASE].UpdateLayout(self, layout)
end
end
| lgpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/blackened_newt.lua | 35 | 1569 | -----------------------------------------
-- ID: 4581
-- Item: Blackened Newt
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Dexterity 4
-- Mind -3
-- Attack % 18
-- Attack Cap 60
-- Virus Resist 5
-- Charm Resist 5
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,10800,4581);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 4);
target:addMod(MOD_MND, -3);
target:addMod(MOD_FOOD_ATTP, 18);
target:addMod(MOD_FOOD_ATT_CAP, 60);
target:addMod(MOD_VIRUSRES, 5);
target:addMod(MOD_CHARMRES, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 4);
target:delMod(MOD_MND, -3);
target:delMod(MOD_FOOD_ATTP, 18);
target:delMod(MOD_FOOD_ATT_CAP, 60);
target:delMod(MOD_VIRUSRES, 5);
target:delMod(MOD_CHARMRES, 5);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/jar_of_ground_wasabi.lua | 35 | 1587 | -----------------------------------------
-- ID: 5164
-- Item: jar_of_ground_wasabi
-- Food Effect: 5Min, All Races
-----------------------------------------
-- Strength -1
-- Dexterity -1
-- Agility -1
-- Vitality -1
-- Intelligence -1
-- Mind -1
-- Charisma -1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,5164);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, -1);
target:addMod(MOD_DEX, -1);
target:addMod(MOD_AGI, -1);
target:addMod(MOD_VIT, -1);
target:addMod(MOD_INT, -1);
target:addMod(MOD_MND, -1);
target:addMod(MOD_CHR, -1);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, -1);
target:delMod(MOD_DEX, -1);
target:delMod(MOD_AGI, -1);
target:delMod(MOD_VIT, -1);
target:delMod(MOD_INT, -1);
target:delMod(MOD_MND, -1);
target:delMod(MOD_CHR, -1);
end;
| gpl-3.0 |
microbang/luasocket | etc/tftp.lua | 59 | 4718 | -----------------------------------------------------------------------------
-- TFTP support for the Lua language
-- LuaSocket toolkit.
-- Author: Diego Nehab
-- RCS ID: $Id: tftp.lua,v 1.16 2005/11/22 08:33:29 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Load required files
-----------------------------------------------------------------------------
local base = _G
local table = require("table")
local math = require("math")
local string = require("string")
local socket = require("socket")
local ltn12 = require("ltn12")
local url = require("socket.url")
module("socket.tftp")
-----------------------------------------------------------------------------
-- Program constants
-----------------------------------------------------------------------------
local char = string.char
local byte = string.byte
PORT = 69
local OP_RRQ = 1
local OP_WRQ = 2
local OP_DATA = 3
local OP_ACK = 4
local OP_ERROR = 5
local OP_INV = {"RRQ", "WRQ", "DATA", "ACK", "ERROR"}
-----------------------------------------------------------------------------
-- Packet creation functions
-----------------------------------------------------------------------------
local function RRQ(source, mode)
return char(0, OP_RRQ) .. source .. char(0) .. mode .. char(0)
end
local function WRQ(source, mode)
return char(0, OP_RRQ) .. source .. char(0) .. mode .. char(0)
end
local function ACK(block)
local low, high
low = math.mod(block, 256)
high = (block - low)/256
return char(0, OP_ACK, high, low)
end
local function get_OP(dgram)
local op = byte(dgram, 1)*256 + byte(dgram, 2)
return op
end
-----------------------------------------------------------------------------
-- Packet analysis functions
-----------------------------------------------------------------------------
local function split_DATA(dgram)
local block = byte(dgram, 3)*256 + byte(dgram, 4)
local data = string.sub(dgram, 5)
return block, data
end
local function get_ERROR(dgram)
local code = byte(dgram, 3)*256 + byte(dgram, 4)
local msg
_,_, msg = string.find(dgram, "(.*)\000", 5)
return string.format("error code %d: %s", code, msg)
end
-----------------------------------------------------------------------------
-- The real work
-----------------------------------------------------------------------------
local function tget(gett)
local retries, dgram, sent, datahost, dataport, code
local last = 0
socket.try(gett.host, "missing host")
local con = socket.try(socket.udp())
local try = socket.newtry(function() con:close() end)
-- convert from name to ip if needed
gett.host = try(socket.dns.toip(gett.host))
con:settimeout(1)
-- first packet gives data host/port to be used for data transfers
local path = string.gsub(gett.path or "", "^/", "")
path = url.unescape(path)
retries = 0
repeat
sent = try(con:sendto(RRQ(path, "octet"), gett.host, gett.port))
dgram, datahost, dataport = con:receivefrom()
retries = retries + 1
until dgram or datahost ~= "timeout" or retries > 5
try(dgram, datahost)
-- associate socket with data host/port
try(con:setpeername(datahost, dataport))
-- default sink
local sink = gett.sink or ltn12.sink.null()
-- process all data packets
while 1 do
-- decode packet
code = get_OP(dgram)
try(code ~= OP_ERROR, get_ERROR(dgram))
try(code == OP_DATA, "unhandled opcode " .. code)
-- get data packet parts
local block, data = split_DATA(dgram)
-- if not repeated, write
if block == last+1 then
try(sink(data))
last = block
end
-- last packet brings less than 512 bytes of data
if string.len(data) < 512 then
try(con:send(ACK(block)))
try(con:close())
try(sink(nil))
return 1
end
-- get the next packet
retries = 0
repeat
sent = try(con:send(ACK(last)))
dgram, err = con:receive()
retries = retries + 1
until dgram or err ~= "timeout" or retries > 5
try(dgram, err)
end
end
local default = {
port = PORT,
path ="/",
scheme = "tftp"
}
local function parse(u)
local t = socket.try(url.parse(u, default))
socket.try(t.scheme == "tftp", "invalid scheme '" .. t.scheme .. "'")
socket.try(t.host, "invalid host")
return t
end
local function sget(u)
local gett = parse(u)
local t = {}
gett.sink = ltn12.sink.table(t)
tget(gett)
return table.concat(t)
end
get = socket.protect(function(gett)
if base.type(gett) == "string" then return sget(gett)
else return tget(gett) end
end)
| mit |
nesstea/darkstar | scripts/zones/RuLude_Gardens/npcs/Nomad_Moogle.lua | 25 | 6265 | -----------------------------------
-- Area: Ru'Lude Gardens
-- NPC: Nomad Moogle
-- Type: Adventurer's Assistant
-- @pos 10.012 1.453 121.883 243
-----------------------------------
package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/RuLude_Gardens/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local meritCount = player:getMeritCount();
if (trade:hasItemQty(1127,5) == true and trade:getGil() == 0 and trade:getItemCount() == 5 and meritCount > 2) then
if (player:getQuestStatus(JEUNO,NEW_WORLDS_AWAIT) == QUEST_ACCEPTED) then
player:startEvent(10135);
end
elseif (trade:hasItemQty(2955,5) == true and trade:getGil() == 0 and trade:getItemCount() == 5 and meritCount > 3) then
if (player:getQuestStatus(JEUNO,EXPANDING_HORIZONS) == QUEST_ACCEPTED) then
player:startEvent(10136);
end
elseif (trade:hasItemQty(2955,10) == true and trade:getGil() == 0 and trade:getItemCount() == 10 and meritCount > 4) then
if (player:getQuestStatus(JEUNO,BEYOND_THE_STARS) == QUEST_ACCEPTED) then
player:startEvent(10137);
end
elseif (trade:hasItemQty(2955,1) == true and trade:hasItemQty(503,1) == true and trade:getGil() == 0 and trade:getItemCount() == 2 and meritCount > 9) then
if (player:getQuestStatus(JEUNO,DORMANT_POWERS_DISLODGED) == QUEST_ACCEPTED) then
player:startEvent(10138);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(LIMIT_BREAKER) == false and player:getMainLvl() >= 75) then
player:startEvent(10045,75,2,10,7,30,302895,4095);
elseif (player:getMainLvl() == 75 and player:levelCap() == 75 and MAX_LEVEL >= 80 and player:getQuestStatus(JEUNO,NEW_WORLDS_AWAIT) == QUEST_AVAILABLE) then
player:startEvent(10045,0,1,1,0);
elseif (player:getMainLvl() >= 76 and player:levelCap() == 80 and MAX_LEVEL >= 85 and player:getQuestStatus(JEUNO,EXPANDING_HORIZONS) == QUEST_AVAILABLE) then
player:startEvent(10045,0,1,2,0);
elseif (player:getMainLvl() >= 81 and player:levelCap() == 85 and MAX_LEVEL >= 90 and player:getQuestStatus(JEUNO,BEYOND_THE_STARS) == QUEST_AVAILABLE) then
player:startEvent(10045,0,1,3,0);
elseif (player:getMainLvl() >= 86 and player:levelCap() == 90 and MAX_LEVEL >= 95 and player:getQuestStatus(JEUNO,DORMANT_POWERS_DISLODGED) == QUEST_AVAILABLE) then
player:startEvent(10045,0,1,4,0);
elseif (player:getMainLvl() >= 91 and player:levelCap() == 95 and MAX_LEVEL >= 99 and player:getQuestStatus(JEUNO,BEYOND_INFINITY) == QUEST_AVAILABLE) then
player:startEvent(10045,0,1,5,0);
elseif (player:getQuestStatus(JEUNO,NEW_WORLDS_AWAIT) == QUEST_ACCEPTED) then
player:startEvent(10045,0,1,1,1);
elseif (player:getQuestStatus(JEUNO,EXPANDING_HORIZONS) == QUEST_ACCEPTED) then
player:startEvent(10045,0,1,2,1);
elseif (player:getQuestStatus(JEUNO,BEYOND_THE_STARS) == QUEST_ACCEPTED) then
player:startEvent(10045,0,1,3,1);
elseif (player:getQuestStatus(JEUNO,DORMANT_POWERS_DISLODGED) == QUEST_ACCEPTED) then
player:startEvent(10045,0,1,4,1);
elseif (player:getQuestStatus(JEUNO,BEYOND_INFINITY) == QUEST_ACCEPTED) then
player:startEvent(10045,0,1,5,1); -- player:startEvent(0x273d,0,1,6,1);
elseif (player:hasKeyItem(LIMIT_BREAKER) == true and player:getMainLvl() >= 75) then
player:startEvent(10045,0,1,0,0);
else
player:startEvent(10045,0,2,0,0);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
local meritCount = player:getMeritCount();
if (csid == 10045 and option == 4) then
player:addKeyItem(LIMIT_BREAKER);
player:messageSpecial(KEYITEM_OBTAINED,LIMIT_BREAKER);
elseif (csid == 10045) then
if (option == 5) then
player:addQuest(JEUNO,NEW_WORLDS_AWAIT);
elseif (option == 7 ) then
player:addQuest(JEUNO,EXPANDING_HORIZONS);
elseif (option == 9) then
player:addQuest(JEUNO,BEYOND_THE_STARS);
elseif (option == 11) then
player:addQuest(JEUNO,DORMANT_POWERS_DISLODGED);
end
elseif (csid == 10135) then
player:tradeComplete();
player:setMerits(meritCount - 3);
player:addFame(JEUNO,50);
player:levelCap(80);
player:completeQuest(JEUNO,NEW_WORLDS_AWAIT);
player:messageSpecial(YOUR_LEVEL_LIMIT_IS_NOW_80);
elseif (csid == 10136) then
player:tradeComplete();
player:setMerits(meritCount - 4);
player:addFame(JEUNO,50);
player:levelCap(85);
player:completeQuest(JEUNO,EXPANDING_HORIZONS);
player:messageSpecial(YOUR_LEVEL_LIMIT_IS_NOW_85);
elseif (csid == 10137) then
player:tradeComplete();
player:setMerits(meritCount - 5);
player:startEvent(0x27B1); -- this is the scene that is suppose to play and you are suppose to have to do correctly inorder to level cap increase to 90
player:addFame(JEUNO,50);
player:levelCap(90);
player:completeQuest(JEUNO,BEYOND_THE_STARS);
player:messageSpecial(YOUR_LEVEL_LIMIT_IS_NOW_90);
elseif (csid == 10138) then
player:tradeComplete();
player:setMerits(meritCount - 10);
player:addFame(JEUNO,50);
player:levelCap(95);
player:completeQuest(JEUNO,DORMANT_POWERS_DISLODGED);
player:messageSpecial(YOUR_LEVEL_LIMIT_IS_NOW_95);
player:addKeyItem(SOUL_GEM);
player:messageSpecial(KEYITEM_OBTAINED,SOUL_GEM);
end
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Port_Jeuno/npcs/Guddal.lua | 19 | 2156 | -----------------------------------
-- Area: Port Jeuno
-- NPC: Guddal
-- Starts and Finishes Quest: Kazham Airship Pass (This quest does not appear in your quest log)
-- @zone 246
-- @pos -14 8 44
-----------------------------------
package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Port_Jeuno/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(player:hasKeyItem(AIRSHIP_PASS_FOR_KAZHAM) == false) then
if(trade:hasItemQty(1024,1) == true and trade:hasItemQty(1025,1) == true and trade:hasItemQty(1026,1) == true and
trade:getGil() == 0 and trade:getItemCount() == 3) then
player:startEvent(0x012d); -- Ending quest "Kazham Airship Pass"
else
player:startEvent(0x012e);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:hasKeyItem(AIRSHIP_PASS_FOR_KAZHAM) == false) then
player:startEvent(0x012c);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x012c) then
if (player:delGil(148000)) then
player:addKeyItem(AIRSHIP_PASS_FOR_KAZHAM);
player:updateEvent(0,1);
end
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if(csid == 0x012c) then
if (player:hasKeyItem(AIRSHIP_PASS_FOR_KAZHAM) == true) then
player:messageSpecial(KEYITEM_OBTAINED,AIRSHIP_PASS_FOR_KAZHAM);
end
elseif(csid == 0x012d) then
player:addKeyItem(AIRSHIP_PASS_FOR_KAZHAM);
player:messageSpecial(KEYITEM_OBTAINED,AIRSHIP_PASS_FOR_KAZHAM);
player:tradeComplete();
end
end;
| gpl-3.0 |
alirezanile/LaSt-GaMfg | plugins/id.lua | 30 | 5808 | --[[
Print user identification/informations by replying their post or by providing
their username or print_name.
!id <text> is the least reliable because it will scan trough all of members
and print all member with <text> in their print_name.
chat_info can be displayed on group, send it into PM, or save as file then send
it into group or PM.
--]]
do
local function scan_name(extra, success, result)
local founds = {}
for k,member in pairs(result.members) do
if extra.name then
gp_member = extra.name
fields = {'first_name', 'last_name', 'print_name'}
elseif extra.user then
gp_member = string.gsub(extra.user, '@', '')
fields = {'username'}
end
for k,field in pairs(fields) do
if member[field] and type(member[field]) == 'string' then
if member[field]:match(gp_member) then
founds[tostring(member.id)] = member
end
end
end
end
if next(founds) == nil then -- Empty table
send_large_msg(extra.receiver, (extra.name or extra.user)..' not found on this chat.')
else
local text = ''
for k,user in pairs(founds) do
text = text..'Name: '..(user.first_name or '')..' '..(user.last_name or '')..'\n'
..'First name: '..(user.first_name or '')..'\n'
..'Last name: '..(user.last_name or '')..'\n'
..'User name: @'..(user.username or '')..'\n'
..'ID: '..(user.id or '')..'\n\n'
end
send_large_msg(extra.receiver, text)
end
end
local function action_by_reply(extra, success, result)
local text = 'Name: '..(result.from.first_name or '')..' '..(result.from.last_name or '')..'\n'
..'First name: '..(result.from.first_name or '')..'\n'
..'Last name: '..(result.from.last_name or '')..'\n'
..'User name: @'..(result.from.username or '')..'\n'
..'ID: '..result.from.id
send_large_msg(extra.receiver, text)
end
local function returnids(extra, success, result)
local chat_id = extra.msg.to.id
local text = '['..result.id..'] '..result.title..'.\n'
..result.members_num..' members.\n\n'
i = 0
for k,v in pairs(result.members) do
i = i+1
if v.username then
user_name = ' @'..v.username
else
user_name = ''
end
text = text..i..'. ['..v.id..'] '..user_name..' '..(v.first_name or '')..(v.last_name or '')..'\n'
end
if extra.matches == 'pm' then
send_large_msg('user#id'..extra.msg.from.id, text)
elseif extra.matches == 'txt' or extra.matches == 'pmtxt' then
local textfile = '/tmp/chat_info_'..chat_id..'_'..os.date("%y%m%d.%H%M%S")..'.txt'
local file = io.open(textfile, 'w')
file:write(text)
file:flush()
file:close()
if extra.matches == 'txt' then
send_document('chat#id'..chat_id, textfile, rmtmp_cb, {file_path=textfile})
elseif extra.matches == 'pmtxt' then
send_document('user#id'..extra.msg.from.id, textfile, rmtmp_cb, {file_path=textfile})
end
elseif not extra.matches then
send_large_msg('chat#id'..chat_id, text)
end
end
local function run(msg, matches)
local receiver = get_receiver(msg)
if is_chat_msg(msg) then
if msg.text == '!id' then
if msg.reply_id then
if is_mod(msg.from.id, msg.to.id) then
msgr = get_message(msg.reply_id, action_by_reply, {receiver=receiver})
end
else
local text = 'Name: '..(msg.from.first_name or '')..' '..(msg.from.last_name or '')..'\n'
..'First name: '..(msg.from.first_name or '')..'\n'
..'Last name: '..(msg.from.last_name or '')..'\n'
..'User name: @'..(msg.from.username or '')..'\n'
..'ID: ' .. msg.from.id
local text = text..'\n\nYou are in group '
..msg.to.title..' (ID: '..msg.to.id..')'
return text
end
elseif is_mod(msg.from.id, msg.to.id) and matches[1] == 'chat' then
if matches[2] == 'pm' or matches[2] == 'txt' or matches[2] == 'pmtxt' then
chat_info(receiver, returnids, {msg=msg, matches=matches[2]})
else
chat_info(receiver, returnids, {msg=msg})
end
elseif is_mod(msg.from.id, msg.to.id) and string.match(matches[1], '^@.+$') then
chat_info(receiver, scan_name, {receiver=receiver, user=matches[1]})
elseif is_mod(msg.from.id, msg.to.id) and string.gsub(matches[1], ' ', '_') then
user = string.gsub(matches[1], ' ', '_')
chat_info(receiver, scan_name, {receiver=receiver, name=matches[1]})
end
else
return 'You are not in a group.'
end
end
return {
description = 'Know your id or the id of a chat members.',
usage = {
user = {
'!id: Return your ID and the chat id if you are in one.'
},
moderator = {
'!id : Return ID of replied user if used by reply.',
'!id chat : Return the IDs of the current chat members.',
'!id chat txt : Return the IDs of the current chat members and send it as text file.',
'!id chat pm : Return the IDs of the current chat members and send it to PM.',
'!id chat pmtxt : Return the IDs of the current chat members, save it as text file and then send it to PM.',
'!id <id> : Return the IDs of the <id>.',
'!id @<user_name> : Return the member @<user_name> ID from the current chat.',
'!id <text> : Search for users with <text> on first_name, last_name, or print_name on current chat.'
},
},
patterns = {
"^!id$",
"^!id (chat) (.*)$",
"^!id (.*)$"
},
run = run
}
end
| gpl-2.0 |
nesstea/darkstar | scripts/zones/Windurst_Waters/npcs/Bondada.lua | 13 | 1964 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Bondada
-- Involved in Quests: Hat in Hand
-- Working 100%
-- @zone = 238
-- @pos = -66 -3 -148
-----------------------------------
package.loaded["scripts/zones/Windurst_Walls/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/zones/Windurst_Walls/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
function testflag(set,flag)
return (set % (2*flag) >= flag)
end
hatstatus = player:getQuestStatus(WINDURST,HAT_IN_HAND);
if ((hatstatus == 1 or player:getVar("QuestHatInHand_var2") == 1) and player:getVar("QuestHatInHand_var") < 127) then
player:startEvent(0x0035); -- Show Off Hat (She does not buy one)
elseif ((hatstatus == 1 or player:getVar("QuestHatInHand_var2") == 1) and player:getVar("QuestHatInHand_var") == 127) then
player:startEvent(0x003d); -- Show Off Hat (She buys one)
else
player:startEvent(0x002b); -- Standard Conversation
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 == 0x003d) then -- Show Off Hat
player:setVar("QuestHatInHand_var",player:getVar("QuestHatInHand_var")+128);
player:setVar("QuestHatInHand_count",player:getVar("QuestHatInHand_count")+1);
end
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Riverne-Site_B01/Zone.lua | 15 | 1799 | -----------------------------------
--
-- Zone: Riverne-Site_B01
--
-----------------------------------
package.loaded["scripts/zones/Riverne-Site_B01/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Riverne-Site_B01/TextIDs");
require("scripts/globals/status");
require("scripts/globals/settings");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(729.749,-20.319,407.153,90); -- {R}
end
-- ZONE LEVEL RESTRICTION
if(ENABLE_COP_ZONE_CAP == 1)then
player:addStatusEffect(EFFECT_LEVEL_RESTRICTION,50,0,0);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
Cyumus/NutScript | plugins/propprotect.lua | 4 | 3829 | PLUGIN.name = "Basic Prop Protection"
PLUGIN.author = "Chessnut"
PLUGIN.desc = "Adds a simple prop protection system."
local PROP_BLACKLIST = {
["models/props_combine/combinetrain02b.mdl"] = true,
["models/props_combine/combinetrain02a.mdl"] = true,
["models/props_combine/combinetrain01.mdl"] = true,
["models/cranes/crane_frame.mdl"] = true,
["models/props_wasteland/cargo_container01.mdl"] = true,
["models/props_junk/trashdumpster02.mdl"] = true,
["models/props_c17/oildrum001_explosive.mdl"] = true,
["models/props_canal/canal_bridge02.mdl"] = true,
["models/props_canal/canal_bridge01.mdl"] = true,
["models/props_canal/canal_bridge03a.mdl"] = true,
["models/props_canal/canal_bridge03b.mdl"] = true,
["models/props_wasteland/cargo_container01.mdl"] = true,
["models/props_wasteland/cargo_container01c.mdl"] = true,
["models/props_wasteland/cargo_container01b.mdl"] = true,
["models/props_combine/combine_mine01.mdl"] = true,
["models/props_junk/glassjug01.mdl"] = true,
["models/props_c17/paper01.mdl"] = true,
["models/props_junk/garbage_takeoutcarton001a.mdl"] = true,
["models/props_c17/trappropeller_engine.mdl"] = true,
["models/props/cs_office/microwave.mdl"] = true,
["models/items/item_item_crate.mdl"] = true,
["models/props_junk/gascan001a.mdl"] = true,
["models/props_c17/consolebox01a.mdl"] = true,
["models/props_buildings/building_002a.mdl"] = true,
["models/props_phx/mk-82.mdl"] = true,
["models/props_phx/cannonball.mdl"] = true,
["models/props_phx/ball.mdl"] = true,
["models/props_phx/amraam.mdl"] = true,
["models/props_phx/misc/flakshell_big.mdl"] = true,
["models/props_phx/ww2bomb.mdl"] = true,
["models/props_phx/torpedo.mdl"] = true,
["models/props/de_train/biohazardtank.mdl"] = true,
["models/props_buildings/project_building01.mdl"] = true,
["models/props_combine/prison01c.mdl"] = true,
["models/props/cs_militia/silo_01.mdl"] = true,
["models/props_phx/huge/evildisc_corp.mdl"] = true,
["models/props_phx/misc/potato_launcher_explosive.mdl"] = true,
["models/props_combine/combine_citadel001.mdl"] = true,
["models/props_phx/oildrum001_explosive.mdl"] = true
}
if (SERVER) then
local function getLogName(entity)
local class = entity:GetClass():lower()
if (class:find("prop")) then
local propType = class:sub(6)
if (propType == "physics") then
propType = "prop"
end
class = propType.." ("..entity:GetModel()..")"
end
return class
end
function PLUGIN:PlayerSpawnObject(client, model, skin)
if ((client.nutNextSpawn or 0) < CurTime()) then
client.nutNextSpawn = CurTime() + 0.75
else
return false
end
if (!client:IsAdmin() and PROP_BLACKLIST[model:lower()]) then
return false
end
end
function PLUGIN:PhysgunPickup(client, entity)
if (entity:GetCreator() == client) then
return true
end
end
function PLUGIN:CanProperty(client, property, entity)
if (entity:GetCreator() == client and (property == "remover" or property == "collision")) then
nut.log.add(client, " used "..property.." on "..getLogName(entity))
return true
end
end
function PLUGIN:CanTool(client, trace, tool)
local entity = trace.Entity
if (IsValid(entity) and entity:GetCreator() == client) then
return true
end
end
function PLUGIN:PlayerSpawnedEntity(client, entity)
entity:SetCreator(client)
nut.log.add(client, "spawned "..getLogName(entity))
end
function PLUGIN:PlayerSpawnedProp(client, model, entity)
hook.Run("PlayerSpawnedEntity", client, entity)
end
PLUGIN.PlayerSpawnedEffect = PLUGIN.PlayerSpawnedProp
PLUGIN.PlayerSpawnedRagdoll = PLUGIN.PlayerSpawnedProp
function PLUGIN:PlayerSpawnedNPC(client, entity)
hook.Run("PlayerSpawnedEntity", client, entity)
end
PLUGIN.PlayerSpawnedSENT = PLUGIN.PlayerSpawnedNPC
PLUGIN.PlayerSpawnedVehicle = PLUGIN.PlayerSpawnedNPC
end | mit |
Mashape/kong | spec/03-plugins/18-acl/03-invalidations_spec.lua | 2 | 7126 | local helpers = require "spec.helpers"
for _, strategy in helpers.each_strategy() do
describe("Plugin: ACL (invalidations) [#" .. strategy .. "]", function()
local admin_client
local proxy_client
local consumer
local acl
local db
before_each(function()
local bp
bp, db = helpers.get_db_utils(strategy, {
"routes",
"services",
"plugins",
"consumers",
"acls",
"keyauth_credentials",
})
consumer = bp.consumers:insert {
username = "consumer1"
}
bp.keyauth_credentials:insert {
key = "apikey123",
consumer = { id = consumer.id },
}
acl = bp.acls:insert {
group = "admin",
consumer = { id = consumer.id },
}
bp.acls:insert {
group = "pro",
consumer = { id = consumer.id },
}
local consumer2 = bp.consumers:insert {
username = "consumer2"
}
bp.keyauth_credentials:insert {
key = "apikey124",
consumer = { id = consumer2.id },
}
bp.acls:insert {
group = "admin",
consumer = { id = consumer2.id },
}
local route1 = bp.routes:insert {
hosts = { "acl1.com" },
}
bp.plugins:insert {
name = "key-auth",
route = { id = route1.id }
}
bp.plugins:insert {
name = "acl",
route = { id = route1.id },
config = {
whitelist = {"admin"}
}
}
local route2 = bp.routes:insert {
hosts = { "acl2.com" },
}
bp.plugins:insert {
name = "key-auth",
route = { id = route2.id }
}
bp.plugins:insert {
name = "acl",
route = { id = route2.id },
config = {
whitelist = { "ya" }
}
}
assert(helpers.start_kong({
database = strategy,
nginx_conf = "spec/fixtures/custom_nginx.template",
}))
proxy_client = helpers.proxy_client()
admin_client = helpers.admin_client()
end)
after_each(function()
if admin_client and proxy_client then
admin_client:close()
proxy_client:close()
end
helpers.stop_kong()
end)
describe("ACL entity invalidation", function()
it("should invalidate when ACL entity is deleted", function()
-- It should work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(200, res)
-- Check that the cache is populated
local cache_key = db.acls:cache_key(consumer.id)
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
assert.res_status(200, res)
-- Delete ACL group (which triggers invalidation)
local res = assert(admin_client:delete("/consumers/consumer1/acls/" .. acl.id, {
headers = {}
}))
assert.res_status(204, res)
-- Wait for cache to be invalidated
helpers.wait_until(function()
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
res:read_body()
return res.status == 404
end, 3)
-- It should not work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(403, res)
end)
it("should invalidate when ACL entity is updated", function()
-- It should work
local res = assert(proxy_client:get("/status/200?apikey=apikey123&prova=scemo", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(200, res)
-- It should not work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl2.com"
}
}))
assert.res_status(403, res)
-- Check that the cache is populated
local cache_key = db.acls:cache_key(consumer.id)
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
assert.res_status(200, res)
-- Update ACL group (which triggers invalidation)
local res = assert(admin_client:patch("/consumers/consumer1/acls/" .. acl.id, {
headers = {
["Content-Type"] = "application/json"
},
body = {
group = "ya"
}
}))
assert.res_status(200, res)
-- Wait for cache to be invalidated
helpers.wait_until(function()
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
res:read_body()
return res.status == 404
end, 3)
-- It should not work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(403, res)
-- It works now
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl2.com"
}
}))
assert.res_status(200, res)
end)
end)
describe("Consumer entity invalidation", function()
it("should invalidate when Consumer entity is deleted", function()
-- It should work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(200, res)
-- Check that the cache is populated
local cache_key = db.acls:cache_key(consumer.id)
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
assert.res_status(200, res)
-- Delete Consumer (which triggers invalidation)
local res = assert(admin_client:delete("/consumers/consumer1", {
headers = {}
}))
assert.res_status(204, res)
-- Wait for cache to be invalidated
helpers.wait_until(function()
local res = assert(admin_client:get("/cache/" .. cache_key, {
headers = {}
}))
res:read_body()
return res.status == 404
end, 3)
-- Wait for key to be invalidated
local keyauth_cache_key = db.keyauth_credentials:cache_key("apikey123")
helpers.wait_until(function()
local res = assert(admin_client:get("/cache/" .. keyauth_cache_key, {
headers = {}
}))
res:read_body()
return res.status == 404
end, 3)
-- It should not work
local res = assert(proxy_client:get("/status/200?apikey=apikey123", {
headers = {
["Host"] = "acl1.com"
}
}))
assert.res_status(401, res)
end)
end)
end)
end
| apache-2.0 |
nesstea/darkstar | scripts/zones/Attohwa_Chasm/mobs/Tiamat.lua | 6 | 3294 | -----------------------------------
-- Area: Attohwa Chasm
-- MOB: Tiamat
-----------------------------------
require("scripts/globals/titles");
require("scripts/globals/status");
-----------------------------------
-- onMobInitialize Action
-----------------------------------
function onMobInitialize(mob)
end;
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
mob:SetMobSkillAttack(0); -- resetting so it doesn't respawn in flight mode.
mob:AnimationSub(0); -- subanim 0 is only used when it spawns until first flight.
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
-- Gains a large attack boost when health is under 25% which cannot be Dispelled.
if (mob:getHP() < ((mob:getMaxHP() / 10) * 2.5)) then
if (mob:hasStatusEffect(EFFECT_ATTACK_BOOST) == false) then
mob:addStatusEffect(EFFECT_ATTACK_BOOST,75,0,0);
mob:getStatusEffect(EFFECT_ATTACK_BOOST):setFlag(32);
end;
end;
if (mob:hasStatusEffect(EFFECT_MIGHTY_STRIKES) == false and mob:actionQueueEmpty() == true) then
local changeTime = mob:getLocalVar("changeTime")
local twohourTime = mob:getLocalVar("twohourTime")
local changeHP = mob:getLocalVar("changeHP")
if (twohourTime == 0) then
twohourTime = math.random(8, 14);
mob:setLocalVar("twohourTime", twohourTime);
end;
if (mob:AnimationSub() == 2 and mob:getBattleTime()/15 > twohourTime) then
mob:useMobAbility(688);
mob:setLocalVar("twohourTime", math.random((mob:getBattleTime()/15)+4, (mob:getBattleTime()/15)+8));
elseif (mob:AnimationSub() == 0 and mob:getBattleTime() - changeTime > 60) then
mob:AnimationSub(1);
mob:addStatusEffectEx(EFFECT_ALL_MISS, 0, 1, 0, 0);
mob:SetMobSkillAttack(730);
--and record the time and HP this phase was started
mob:setLocalVar("changeTime", mob:getBattleTime());
mob:setLocalVar("changeHP", mob:getHP()/1000);
-- subanimation 1 is flight, so check if she should land
elseif (mob:AnimationSub() == 1 and (mob:getHP()/1000 <= changeHP - 10 or
mob:getBattleTime() - changeTime > 120)) then
mob:useMobAbility(1282);
mob:setLocalVar("changeTime", mob:getBattleTime());
mob:setLocalVar("changeHP", mob:getHP()/1000);
-- subanimation 2 is grounded mode, so check if she should take off
elseif (mob:AnimationSub() == 2 and (mob:getHP()/1000 <= changeHP - 10 or
mob:getBattleTime() - changeTime > 120)) then
mob:AnimationSub(1);
mob:addStatusEffectEx(EFFECT_ALL_MISS, 0, 1, 0, 0);
mob:SetMobSkillAttack(730);
mob:setLocalVar("changeTime", mob:getBattleTime());
mob:setLocalVar("changeHP", mob:getHP()/1000);
end;
end;
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, killer, ally)
ally:addTitle(TIAMAT_TROUNCER);
mob:setRespawnTime(math.random(259200,432000)); -- 3 to 5 days
end;
| gpl-3.0 |
hussian/hell_iraq | plugins/writer.lua | 13 | 15918 | --[[
#
#ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#:((
# For More Information ....!
# Developer : Aziz < @TH3_GHOST >
# our channel: @DevPointTeam
# Version: 1.1
#:))
#ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#
]]
local function DevPoint(msg, matches)
if #matches < 2 then
return "اكتب الامر /write ثم ضع فاصلة واكتب الجملة وستظهر لك نتائج الزخرفة " end
if string.len(matches[2]) > 20 then
return "متاح لك 20 حرف انكليزي فقط لايمكنك وضع حروف اكثر ❤️😐 @"..msg.from.username..'\n'
end--@devPointch
local font_base = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,9,8,7,6,5,4,3,2,1,.,_"
local font_hash = "z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,0,1,2,3,4,5,6,7,8,9,.,_"
local fonts = {
"ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,⓪,➈,➇,➆,➅,➄,➃,➂,➁,➀,●,_",
"⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⓪,⑼,⑻,⑺,⑹,⑸,⑷,⑶,⑵,⑴,.,_",
"α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,0,9,8,7,6,5,4,3,2,1,.,_",
"α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,0,9,8,7,6,5,4,3,2,1,.,_",
"α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,⊘,९,𝟠,7,Ϭ,Ƽ,५,Ӡ,ϩ,𝟙,.,_", "ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,0,9,8,7,6,5,4,3,2,1,.,_",
"α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,Q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ᅙ,9,8,ᆨ,6,5,4,3,ᆯ,1,.,_",
"α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,Б,Ͼ,Ð,Ξ,Ŧ,G,H,ł,J,К,Ł,M,Л,Ф,P,Ǫ,Я,S,T,U,V,Ш,Ж,Џ,Z,Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"A̴,̴B̴,̴C̴,̴D̴,̴E̴,̴F̴,̴G̴,̴H̴,̴I̴,̴J̴,̴K̴,̴L̴,̴M̴,̴N̴,̴O̴,̴P̴,̴Q̴,̴R̴,̴S̴,̴T̴,̴U̴,̴V̴,̴W̴,̴X̴,̴Y̴,̴Z̴,̴a̴,̴b̴,̴c̴,̴d̴,̴e̴,̴f̴,̴g̴,̴h̴,̴i̴,̴j̴,̴k̴,̴l̴,̴m̴,̴n̴,̴o̴,̴p̴,̴q̴,̴r̴,̴s̴,̴t̴,̴u̴,̴v̴,̴w̴,̴x̴,̴y̴,̴z̴,̴0̴,̴9̴,̴8̴,̴7̴,̴6̴,̴5̴,̴4̴,̴3̴,̴2̴,̴1̴,̴.̴,̴_̴",
"ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,⓪,➈,➇,➆,➅,➄,➃,➂,➁,➀,●,_",
"⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⓪,⑼,⑻,⑺,⑹,⑸,⑷,⑶,⑵,⑴,.,_",
"α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,0,9,8,7,6,5,4,3,2,1,.,_",
"α,в,c,ɗ,є,f,g,н,ι,נ,к,Ɩ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,x,у,z,α,в,c,ɗ,є,f,g,н,ι,נ,к,Ɩ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,x,у,z,0,9,8,7,6,5,4,3,2,1,.,_",
"α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,0,9,8,7,6,5,4,3,2,1,.,_",
"α,Ⴆ,ƈ,ԃ,ҽ,ϝ,ɠ,ԋ,ι,ʝ,ƙ,ʅ,ɱ,ɳ,σ,ρ,ϙ,ɾ,ʂ,ƚ,υ,ʋ,ɯ,x,ყ,ȥ,α,Ⴆ,ƈ,ԃ,ҽ,ϝ,ɠ,ԋ,ι,ʝ,ƙ,ʅ,ɱ,ɳ,σ,ρ,ϙ,ɾ,ʂ,ƚ,υ,ʋ,ɯ,x,ყ,ȥ,0,9,8,7,6,5,4,3,2,1,.,_",
"α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ą,ɓ,ƈ,đ,ε,∱,ɠ,ɧ,ï,ʆ,ҡ,ℓ,ɱ,ŋ,σ,þ,ҩ,ŗ,ş,ŧ,ų,√,щ,х,γ,ẕ,ą,ɓ,ƈ,đ,ε,∱,ɠ,ɧ,ï,ʆ,ҡ,ℓ,ɱ,ŋ,σ,þ,ҩ,ŗ,ş,ŧ,ų,√,щ,х,γ,ẕ,0,9,8,7,6,5,4,3,2,1,.,_",
"ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,⊘,९,𝟠,7,Ϭ,Ƽ,५,Ӡ,ϩ,𝟙,.,_",
"მ,ჩ,ƈ,ძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,მ,ჩ,ƈ,ძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,0,Գ,Ց,Դ,6,5,Վ,Յ,Զ,1,.,_",
"ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,0,9,8,7,6,5,4,3,2,1,.,_",
"α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,0,9,8,7,6,5,4,3,2,1,.,_",
"Δ,Ɓ,C,D,Σ,F,G,H,I,J,Ƙ,L,Μ,∏,Θ,Ƥ,Ⴓ,Γ,Ѕ,Ƭ,Ʊ,Ʋ,Ш,Ж,Ψ,Z,λ,ϐ,ς,d,ε,ғ,ɢ,н,ι,ϳ,κ,l,ϻ,π,σ,ρ,φ,г,s,τ,υ,v,ш,ϰ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,ß,Ƈ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,Λ,ß,Ƈ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,0,9,8,7,6,5,4,3,2,1,.,_",
"ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,Q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ᅙ,9,8,ᆨ,6,5,4,3,ᆯ,1,.,_",
"α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ค,๖,¢,໓,ē,f,ງ,h,i,ว,k,l,๓,ຖ,໐,p,๑,r,Ş,t,น,ง,ຟ,x,ฯ,ຊ,ค,๖,¢,໓,ē,f,ງ,h,i,ว,k,l,๓,ຖ,໐,p,๑,r,Ş,t,น,ง,ຟ,x,ฯ,ຊ,0,9,8,7,6,5,4,3,2,1,.,_",
"ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,0,9,8,7,6,5,4,3,2,1,.,_",
"Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,Б,Ͼ,Ð,Ξ,Ŧ,G,H,ł,J,К,Ł,M,Л,Ф,P,Ǫ,Я,S,T,U,V,Ш,Ж,Џ,Z,Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,0,9,8,7,6,5,4,3,2,1,.,_",
"Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,0,9,8,7,6,5,4,3,2,1,.,_",
"ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,0,9,8,7,6,5,4,3,2,1,.,_",
"4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,0,9,8,7,6,5,4,3,2,1,.,_",
"Λ,M,X,ʎ,Z,ɐ,q,ɔ,p,ǝ,ɟ,ƃ,ɥ,ı,ɾ,ʞ,l,ա,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,Λ,M,X,ʎ,Z,ɐ,q,ɔ,p,ǝ,ɟ,ƃ,ɥ,ı,ɾ,ʞ,l,ա,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,‾",
"A̴,̴B̴,̴C̴,̴D̴,̴E̴,̴F̴,̴G̴,̴H̴,̴I̴,̴J̴,̴K̴,̴L̴,̴M̴,̴N̴,̴O̴,̴P̴,̴Q̴,̴R̴,̴S̴,̴T̴,̴U̴,̴V̴,̴W̴,̴X̴,̴Y̴,̴Z̴,̴a̴,̴b̴,̴c̴,̴d̴,̴e̴,̴f̴,̴g̴,̴h̴,̴i̴,̴j̴,̴k̴,̴l̴,̴m̴,̴n̴,̴o̴,̴p̴,̴q̴,̴r̴,̴s̴,̴t̴,̴u̴,̴v̴,̴w̴,̴x̴,̴y̴,̴z̴,̴0̴,̴9̴,̴8̴,̴7̴,̴6̴,̴5̴,̴4̴,̴3̴,̴2̴,̴1̴,̴.̴,̴_̴",
"A̱,̱Ḇ,̱C̱,̱Ḏ,̱E̱,̱F̱,̱G̱,̱H̱,̱I̱,̱J̱,̱Ḵ,̱Ḻ,̱M̱,̱Ṉ,̱O̱,̱P̱,̱Q̱,̱Ṟ,̱S̱,̱Ṯ,̱U̱,̱V̱,̱W̱,̱X̱,̱Y̱,̱Ẕ,̱a̱,̱ḇ,̱c̱,̱ḏ,̱e̱,̱f̱,̱g̱,̱ẖ,̱i̱,̱j̱,̱ḵ,̱ḻ,̱m̱,̱ṉ,̱o̱,̱p̱,̱q̱,̱ṟ,̱s̱,̱ṯ,̱u̱,̱v̱,̱w̱,̱x̱,̱y̱,̱ẕ,̱0̱,̱9̱,̱8̱,̱7̱,̱6̱,̱5̱,̱4̱,̱3̱,̱2̱,̱1̱,̱.̱,̱_̱",
"A̲,̲B̲,̲C̲,̲D̲,̲E̲,̲F̲,̲G̲,̲H̲,̲I̲,̲J̲,̲K̲,̲L̲,̲M̲,̲N̲,̲O̲,̲P̲,̲Q̲,̲R̲,̲S̲,̲T̲,̲U̲,̲V̲,̲W̲,̲X̲,̲Y̲,̲Z̲,̲a̲,̲b̲,̲c̲,̲d̲,̲e̲,̲f̲,̲g̲,̲h̲,̲i̲,̲j̲,̲k̲,̲l̲,̲m̲,̲n̲,̲o̲,̲p̲,̲q̲,̲r̲,̲s̲,̲t̲,̲u̲,̲v̲,̲w̲,̲x̲,̲y̲,̲z̲,̲0̲,̲9̲,̲8̲,̲7̲,̲6̲,̲5̲,̲4̲,̲3̲,̲2̲,̲1̲,̲.̲,̲_̲",
"Ā,̄B̄,̄C̄,̄D̄,̄Ē,̄F̄,̄Ḡ,̄H̄,̄Ī,̄J̄,̄K̄,̄L̄,̄M̄,̄N̄,̄Ō,̄P̄,̄Q̄,̄R̄,̄S̄,̄T̄,̄Ū,̄V̄,̄W̄,̄X̄,̄Ȳ,̄Z̄,̄ā,̄b̄,̄c̄,̄d̄,̄ē,̄f̄,̄ḡ,̄h̄,̄ī,̄j̄,̄k̄,̄l̄,̄m̄,̄n̄,̄ō,̄p̄,̄q̄,̄r̄,̄s̄,̄t̄,̄ū,̄v̄,̄w̄,̄x̄,̄ȳ,̄z̄,̄0̄,̄9̄,̄8̄,̄7̄,̄6̄,̄5̄,̄4̄,̄3̄,̄2̄,̄1̄,̄.̄,̄_̄",
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,9,8,7,6,5,4,3,2,1,.,_",
"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,9,8,7,6,5,4,3,2,1,.,_",
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local result = {}
i=0
for k=1,#fonts do
i=i+1
local tar_font = fonts[i]:split(",")
local text = matches[2]
local text = text:gsub("A",tar_font[1])
local text = text:gsub("B",tar_font[2])
local text = text:gsub("C",tar_font[3])
local text = text:gsub("D",tar_font[4])
local text = text:gsub("E",tar_font[5])
local text = text:gsub("F",tar_font[6])
local text = text:gsub("G",tar_font[7])
local text = text:gsub("H",tar_font[8])
local text = text:gsub("I",tar_font[9])
local text = text:gsub("J",tar_font[10])
local text = text:gsub("K",tar_font[11])
local text = text:gsub("L",tar_font[12])
local text = text:gsub("M",tar_font[13])
local text = text:gsub("N",tar_font[14])
local text = text:gsub("O",tar_font[15])
local text = text:gsub("P",tar_font[16])
local text = text:gsub("Q",tar_font[17])
local text = text:gsub("R",tar_font[18])
local text = text:gsub("S",tar_font[19])
local text = text:gsub("T",tar_font[20])
local text = text:gsub("U",tar_font[21])
local text = text:gsub("V",tar_font[22])
local text = text:gsub("W",tar_font[23])
local text = text:gsub("X",tar_font[24])
local text = text:gsub("Y",tar_font[25])
local text = text:gsub("Z",tar_font[26])
local text = text:gsub("a",tar_font[27])
local text = text:gsub("b",tar_font[28])
local text = text:gsub("c",tar_font[29])
local text = text:gsub("d",tar_font[30])
local text = text:gsub("e",tar_font[31])
local text = text:gsub("f",tar_font[32])
local text = text:gsub("g",tar_font[33])
local text = text:gsub("h",tar_font[34])
local text = text:gsub("i",tar_font[35])
local text = text:gsub("j",tar_font[36])
local text = text:gsub("k",tar_font[37])
local text = text:gsub("l",tar_font[38])
local text = text:gsub("m",tar_font[39])
local text = text:gsub("n",tar_font[40])
local text = text:gsub("o",tar_font[41])
local text = text:gsub("p",tar_font[42])
local text = text:gsub("q",tar_font[43])
local text = text:gsub("r",tar_font[44])
local text = text:gsub("s",tar_font[45])
local text = text:gsub("t",tar_font[46])
local text = text:gsub("u",tar_font[47])
local text = text:gsub("v",tar_font[48])
local text = text:gsub("w",tar_font[49])
local text = text:gsub("x",tar_font[50])
local text = text:gsub("y",tar_font[51])
local text = text:gsub("z",tar_font[52])
local text = text:gsub("0",tar_font[53])
local text = text:gsub("9",tar_font[54])
local text = text:gsub("8",tar_font[55])
local text = text:gsub("7",tar_font[56])
local text = text:gsub("6",tar_font[57])
local text = text:gsub("5",tar_font[58])
local text = text:gsub("4",tar_font[59])
local text = text:gsub("3",tar_font[60])
local text = text:gsub("2",tar_font[61])
local text = text:gsub("1",tar_font[62])
table.insert(result, text)
end--@DevPointCH
local result_text = "زخرفة كلمة : "..matches[2].."\nتطبيق اكثر من "..tostring(#fonts).." نوع من الخطوط : \n______________________________\n"
a=0
for v=1,#result do
a=a+1
result_text = result_text..a.."- "..result[a].."\n\n"
end
return result_text.."______________________________\nChannel : @DevPointCH 🎗"
end
return {
description = "Fantasy Writer",
usagehtm = '<tr><td align="center">write </td><td align="right">ملف زخرفة للكلمات الانكليزية ملف يحتوي على اكثر من 50 نوع من الخطوط للزخرفة وتحصل على زخارف رائعة يمكنك وضع 20 حرف انكليزي فقط لايمكنك وضع اكثر</td></tr>',
usage = {"write [text] : ",},
patterns = {
"^([/,!][Ww]rite) (.*)",
"^([/,!][Ww]rite)$",
},
run = DevPoint
}
--post by Channel @DevPointCH
--Dont Remove This
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/zones/The_Garden_of_RuHmet/npcs/Ebon_Panel.lua | 19 | 3707 | -----------------------------------
-- Area: The Garden of RuHmet
-- NPC: Ebon_Panel
-- @pos 100.000 -5.180 -337.661 35 | Mithra Tower
-- @pos 740.000 -5.180 -342.352 35 | Elvaan Tower
-- @pos 257.650 -5.180 -699.999 35 | Tarutaru Tower
-- @pos 577.648 -5.180 -700.000 35 | Galka Tower
-----------------------------------
package.loaded["scripts/zones/The_Garden_of_RuHmet/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/The_Garden_of_RuHmet/TextIDs");
require("scripts/globals/missions");
require("scripts/globals/titles");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local Race = player:getRace();
local xPos = npc:getXPos();
if(player:getCurrentMission(COP) == WHEN_ANGELS_FALL and player:getVar("PromathiaStatus") == 1)then
player:startEvent(0x00CA);
elseif(player:getCurrentMission(COP) == WHEN_ANGELS_FALL and player:getVar("PromathiaStatus") == 2)then
if (xPos > 99 and xPos < 101) then -- Mithra Tower
if( Race==7 )then
player:startEvent(0x007C);
else
player:messageSpecial(NO_NEED_INVESTIGATE);
end
elseif (xPos > 739 and xPos < 741) then -- Elvaan Tower
if( Race==3 or Race==4)then
player:startEvent(0x0079);
else
player:messageSpecial(NO_NEED_INVESTIGATE);
end
elseif (xPos > 256 and xPos < 258) then -- Tarutaru Tower
if( Race==5 or Race==6 )then
player:startEvent(0x007B);
else
player:messageSpecial(NO_NEED_INVESTIGATE);
end
elseif (xPos > 576 and xPos < 578) then -- Galka Tower
if( Race==8)then
player:startEvent(0x007A);
else
player:messageSpecial(NO_NEED_INVESTIGATE);
end
end
else
player:messageSpecial(NO_NEED_INVESTIGATE);
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 == 0x00CA)then
player:setVar("PromathiaStatus",2);
elseif(0x007C and option ~=0)then -- Mithra
player:addTitle(WARRIOR_OF_THE_CRYSTAL);
player:setVar("PromathiaStatus",3);
player:addKeyItem(LIGHT_OF_DEM);
player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_DEM);
elseif(0x0079 and option ~=0)then -- Elvaan
player:addTitle(WARRIOR_OF_THE_CRYSTAL);
player:setVar("PromathiaStatus",3);
player:addKeyItem(LIGHT_OF_MEA);
player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_MEA);
elseif(0x007B and option ~=0)then -- Tarutaru
player:addTitle(WARRIOR_OF_THE_CRYSTAL);
player:setVar("PromathiaStatus",3);
player:addKeyItem(LIGHT_OF_HOLLA);
player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_HOLLA);
elseif(0x007A and option ~=0)then -- Galka
player:addTitle(WARRIOR_OF_THE_CRYSTAL);
player:setVar("PromathiaStatus",3);
player:addKeyItem(LIGHT_OF_ALTAIEU);
player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_ALTAIEU);
end
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/plate_of_fin_sushi.lua | 35 | 1483 | -----------------------------------------
-- ID: 5665
-- Item: plate_of_fin_sushi
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Intelligence 5
-- Accuracy % 16
-- Ranged Accuracy % 16
-----------------------------------------
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,5665);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_INT, 5);
target:addMod(MOD_FOOD_ACCP, 16);
target:addMod(MOD_FOOD_ACC_CAP, 999);
target:addMod(MOD_FOOD_RACCP, 16);
target:addMod(MOD_FOOD_RACC_CAP, 999);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_INT, 5);
target:delMod(MOD_FOOD_ACCP, 16);
target:delMod(MOD_FOOD_ACC_CAP, 999);
target:delMod(MOD_FOOD_RACCP, 16);
target:delMod(MOD_FOOD_RACC_CAP, 999);
end;
| gpl-3.0 |
nesstea/darkstar | scripts/zones/Temple_of_Uggalepih/npcs/_4fv.lua | 13 | 1696 | -----------------------------------
-- Area: Temple of Uggalepih
-- NPC: Granite Door
-- Involved in Missions: San dOria Mission 8-2
-- @pos -50 -17 -154
-----------------------------------
package.loaded["scripts/zones/Temple_of_Uggalepih/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Temple_of_Uggalepih/TextIDs");
require("scripts/globals/keyitems");
require("scripts/globals/missions");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(SANDORIA) == LIGHTBRINGER and player:getVar("MissionStatus") == 5) then
if (player:hasKeyItem(PIECE_OF_A_BROKEN_KEY1) and player:hasKeyItem(PIECE_OF_A_BROKEN_KEY2) and player:hasKeyItem(PIECE_OF_A_BROKEN_KEY3)) then
if (player:getVar("Mission8-2Kills") >= 1) then
player:startEvent(0x0041);
else
SpawnMob(17428495,180)
SpawnMob(17428496,180)
end
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);
if (csid == 0x0041) then
player:setVar("Mission8-2Kills",0);
player:setVar("MissionStatus",6);
end
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Pashhow_Marshlands/npcs/Shikoko_WW.lua | 30 | 3064 | -----------------------------------
-- Area: Pashhow Marshlands
-- NPC: Shikoko, W.W.
-- Type: Border Conquest Guards
-- @pos 536.291 23.517 694.063 109
-----------------------------------
package.loaded["scripts/zones/Pashhow_Marshlands/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Pashhow_Marshlands/TextIDs");
local guardnation = WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = DERFLAND
local csid = 0x7ff6;
-----------------------------------
-- 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 |
nesstea/darkstar | scripts/zones/Lower_Jeuno/npcs/Porter_Moogle.lua | 41 | 1537 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Porter Moogle
-- Type: Storage Moogle
-- @zone 245
-- @pos TODO
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Lower_Jeuno/TextIDs");
require("scripts/globals/porter_moogle_util");
local e =
{
TALK_EVENT_ID = 10104,
STORE_EVENT_ID = 10105,
RETRIEVE_EVENT_ID = 10106,
ALREADY_STORED_ID = 10107,
MAGIAN_TRIAL_ID = 10108
};
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
porterMoogleTrade(player, trade, e);
end
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- No idea what the params are, other than event ID and gil.
player:startEvent(e.TALK_EVENT_ID, 0x6FFFFF, 0x01, 0x06DD, 0x27, 0x7C7E, 0x15, player:getGil(), 0x03E8);
end
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
porterEventUpdate(player, csid, option, e.RETRIEVE_EVENT_ID, RETRIEVE_DIALOG_ID, ITEM_CANNOT_BE_OBTAINED);
end
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
porterEventFinish(player, csid, option, e.TALK_EVENT_ID, ITEM_CANNOT_BE_OBTAINED, ITEM_OBTAINED, NOT_HAVE_ENOUGH_GIL);
end | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Lower_Jeuno/npcs/Porter_Moogle.lua | 41 | 1537 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Porter Moogle
-- Type: Storage Moogle
-- @zone 245
-- @pos TODO
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Lower_Jeuno/TextIDs");
require("scripts/globals/porter_moogle_util");
local e =
{
TALK_EVENT_ID = 10104,
STORE_EVENT_ID = 10105,
RETRIEVE_EVENT_ID = 10106,
ALREADY_STORED_ID = 10107,
MAGIAN_TRIAL_ID = 10108
};
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
porterMoogleTrade(player, trade, e);
end
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- No idea what the params are, other than event ID and gil.
player:startEvent(e.TALK_EVENT_ID, 0x6FFFFF, 0x01, 0x06DD, 0x27, 0x7C7E, 0x15, player:getGil(), 0x03E8);
end
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
porterEventUpdate(player, csid, option, e.RETRIEVE_EVENT_ID, RETRIEVE_DIALOG_ID, ITEM_CANNOT_BE_OBTAINED);
end
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
porterEventFinish(player, csid, option, e.TALK_EVENT_ID, ITEM_CANNOT_BE_OBTAINED, ITEM_OBTAINED, NOT_HAVE_ENOUGH_GIL);
end | gpl-3.0 |
nesstea/darkstar | scripts/zones/Buburimu_Peninsula/npcs/Ganemu-Punnemu_WW.lua | 13 | 3342 | -----------------------------------
-- Area: Buburimu Peninsula
-- NPC: Ganemu-Punnemu, W.W.
-- Outpost Conquest Guards
-- @pos -481.164 -32.858 49.188 118
-----------------------------------
package.loaded["scripts/zones/Buburimu_Peninsula/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Buburimu_Peninsula/TextIDs");
local guardnation = WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = KOLSHUSHU;
local csid = 0x7ff7;
-----------------------------------
-- 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 |
nesstea/darkstar | scripts/zones/Temenos/mobs/Enhanced_Lizard.lua | 7 | 1028 | -----------------------------------
-- Area: Temenos W T
-- NPC: Enhanced_Lizard
-----------------------------------
package.loaded["scripts/zones/Temenos/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/limbus");
require("scripts/zones/Temenos/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer,ally)
local cofferID=Randomcoffer(4,GetInstanceRegion(1298));
local mobX = mob:getXPos();
local mobY = mob:getYPos();
local mobZ = mob:getZPos();
GetNPCByID(16929238):setStatus(STATUS_NORMAL);
if (cofferID~=0) then
GetNPCByID(16928768+cofferID):setPos(mobX,mobY,mobZ);
GetNPCByID(16928768+cofferID):setStatus(STATUS_NORMAL);
end
end;
| gpl-3.0 |
DigiTechs/ROBLOX-Wiki-Backend | src/Module/API/Util/Util.lua | 1 | 7177 | -- Module:API/Util
-- Utilities for Module:API.
-- Essentially, the back-end of the back-end.
-- Warning: DO NOT USE THIS MODULE BY ITSELF! It will break and you will be sad - Use Module:API instead!
local LUNQ = require("Module:API/Util/LUNQ")
local ReflectionMetadata = mw.loadData("Module:API/Data/ReflectionMetadata")
local APIDump = mw.loadData("Module:API/Data/APIDump")
local ExplorerImageUtil = require("Module:GetExplorerImage")
local _M = { }
-- Searches for a class in the API dump, and returns it and its members.
function _M.GetClassInfo(ClassName)
return LUNQ.Where(APIDump, function(x)
return
(
(x.type == "Class" and x.Name == ClassName)
or
(x.Class == ClassName)
)
end)
end
function _M.GetEnumInfo(EnumName) -- TODO: merge this into one function with GetClassInfo?
return LUNQ.Where(APIDump, function(x)
return
(
(x.type == "Enum" and x.Name == EnumName)
or
(x.Enum == EnumName)
)
end)
end
-- Searches through the API dump and returns a list of classes which have properties with the given type
function _M.GetClassesByPropertyType(PropertyType)
return LUNQ.Distinct(LUNQ.Select(LUNQ.Where(APIDump, function(x)
return x.type == "Property" and x.ValueType == PropertyType
end), function(x)
return x.Class
end))
end
-- Looks in the API dump for an item, and returns its type.
do
local BaseTypes = {
"variant",
"string",
"number", "double", "float", "int",
"bool", "boolean",
"dictionary", "tuple", "array", -- these refer to a table.
"void", "rbxscriptsignal", -- These are 'basic' types i.e. not instance classes
"color3", "udim2",
"vector4", "cframe", "vector3",
} for i = 1, #BaseTypes do BaseTypes[BaseTypes[i]] = true end
function _M.TypeOf(typename)
typename = typename:lower()
if BaseTypes[typename] then -- If we're a base type all we need to return is our type.
return typename, true
end
local DumpInfo = LUNQ.Where(APIDump, function(x)
return
((x.type == "Enum") or (x.type == "Class")) and
x.Name:lower() == typename
end)
if #DumpInfo > 0 then
local First = LUNQ.FirstOrDefault(DumpInfo, function(x)
return x.type == "Class"
end)
if not First then
First = LUNQ.FirstOrDefault(DumpInfo, function(x)
return x.type == "Enum"
end)
end
if First then
return First.type, false
else
return nil, "Could not find class"
end
end
return nil, "Could not find class"
end
end
-- Returns the image of a class
-- Returns the default icon if none exists.
do
function _M.GetImage(ClassName)
local ImageIndex = 0
-- Fancy searching for the Class info
local ReflClassInfo = LUNQ.First(ReflectionMetadata, function(x)
local IsClassDefinition = x[0] == "Item" and x.class == "ReflectionMetadataClass"
if IsClassDefinition then
local Properties = LUNQ.First(x, function(y)
return y[0] == "Properties"
end)
local Name = LUNQ.First(Properties, function(y)
return y.name == "Name"
end)[1]
return Name == ClassName
end
return false
end)
if ReflClassInfo then
local Properties = LUNQ.First(ReflClassInfo, function(x)
return x[0] == "Properties"
end)
local ExplorerImageIndex = LUNQ.FirstOrDefault(Properties, function(x)
return x.name == "ExplorerImageIndex"
end)
if ExplorerImageIndex then
ImageIndex = ExplorerImageIndex[1]
end
end
return ExplorerImageUtil.GetExplorerImage(ImageIndex)
end
end
-- Returns a 'type link' to a page.
-- Contains colour and images.
-- Usage: TypeLink("Platform", false, true)
-- Output: [[API:Enum/Platform|<span style="color:#666362">Platform</span>]]
-- Usage: TypeLink("Platform", false, false)
-- Output: [[API:Class/Platform|<span style="color:#666362">Platform</span>]]
function _M.TypeLink(Type, ContainImage)
local TypeName, IsBaseType = _M.TypeOf(Type) -- Get the type of our class/enum
if TypeName then
return string.format([=[%s%s[[API:%s%s%s|<span style="color:%s">%s</span>]]]=],
ContainImage and _M.GetImage(Type) or "",
ContainImage and " " or "",
TypeName,
IsBaseType and "" or "/",
IsBaseType and "" or Type,
IsBaseType and "green" or "#666362",
Type
)
end
-- The type couldn't be found, so return something which makes sense.
return string.format("[[API:%s|%s]]", Type, Type)
end
-- Returns the (typelinked) superclass tree as a string, MSDN style
-- Usage: GetSuperclassTree("Part")
do
local function GetHierarchyTable(ClassName) -- Retrieves the hierarchy tables for the given class
local ClassInfo = _M.GetClassInfo(ClassName)[1]
local Subclasses
if ClassName ~= "Instance" then -- HACK: To avoid page bloat, don't find subclasses of Instance
Subclasses = LUNQ.Select(LUNQ.Where(APIDump, function(x)
return
(x.type == "Class") and
x.Superclass and
x.Superclass:lower() == ClassName:lower()
end), function(x) return x.Name end)
end
local Superclasses = { ClassInfo.Name }
local SuperClass = ClassInfo.Superclass
while SuperClass do
Superclasses[#Superclasses+1] = SuperClass
ClassInfo = _M.GetClassInfo(SuperClass)[1]
SuperClass = ClassInfo.Superclass
end
return Superclasses, Subclasses
end
function _M.GetSuperclassTree(ClassName, ContainImages)
local SuperClassTable, SubClassTable = GetHierarchyTable(ClassName)
local htmlBuilder = mw.html.create("ul"):addClass("rbx-inheritance-list")
for i = #SuperClassTable, 1, -1 do
--local numSpaces = 4 * (#SuperClassTable - i)
if i == 1 then
htmlBuilder = htmlBuilder:tag("ul"):tag("li"):wikitext(_M.GetImage(SuperClassTable[i]), " '''"..SuperClassTable[i].."'''")
elseif i == #SuperClassTable then
htmlBuilder = htmlBuilder:tag("li"):wikitext(_M.TypeLink(SuperClassTable[i], true))
else
htmlBuilder = htmlBuilder:tag("ul"):tag("li"):wikitext(_M.TypeLink(SuperClassTable[i], true))
end
end
if not SubClassTable then -- HACK: Avoiding page bloat again
htmlBuilder:tag("ul"):tag("li"):wikitext("''All classes inherit from this''")
elseif #SubClassTable > 0 then
htmlBuilder = htmlBuilder:tag("ul")
for i = 1, #SubClassTable do
htmlBuilder:tag("li"):wikitext(_M.TypeLink(SubClassTable[i], true)):done()
end
end
return tostring(htmlBuilder:allDone())
end
end
-- Gets the description of the class member. Does *not* walk up the inheritance tree for the member.
-- Usage: GetDescription("BasePart", "Destroy")
function _M.GetShortDescription(ClassName, MemberName)
local page = mw.title.new(string.format("Class/%s/%s", ClassName, MemberName), "API") -- Ensure the page is created under the 'API' namespace
local content = page:getContent()
if content then -- Page exists
-- HACK: Since we can't parse the template into a table, we 'append' our arguments to it.
content = mw.ustring.gsub(content, "}}$", "|_APIModuleInvoke=true}}")
return mw.getCurrentFrame():preprocess(content)
end
end
return _M | mit |
vonflynee/opencomputersserver | world/opencomputers/3f9e70c3-6961-48bd-bbb9-5c4b3888a254/boot/04_component.lua | 15 | 4131 | local component = require("component")
local computer = require("computer")
local event = require("event")
local adding = {}
local removing = {}
local primaries = {}
-------------------------------------------------------------------------------
-- This allows writing component.modem.open(123) instead of writing
-- component.getPrimary("modem").open(123), which may be nicer to read.
setmetatable(component, {
__index = function(_, key)
return component.getPrimary(key)
end,
__pairs = function(self)
local parent = false
return function(_, key)
if parent then
return next(primaries, key)
else
local k, v = next(self, key)
if not k then
parent = true
return next(primaries)
else
return k, v
end
end
end
end
})
function component.get(address, componentType)
checkArg(1, address, "string")
checkArg(2, componentType, "string", "nil")
for c in component.list(componentType, true) do
if c:sub(1, address:len()) == address then
return c
end
end
return nil, "no such component"
end
function component.isAvailable(componentType)
checkArg(1, componentType, "string")
if not primaries[componentType] and not adding[componentType] then
-- This is mostly to avoid out of memory errors preventing proxy
-- creation cause confusion by trying to create the proxy again,
-- causing the oom error to be thrown again.
component.setPrimary(componentType, component.list(componentType, true)())
end
return primaries[componentType] ~= nil
end
function component.isPrimary(address)
local componentType = component.type(address)
if componentType then
if component.isAvailable(componentType) then
return primaries[componentType].address == address
end
end
return false
end
function component.getPrimary(componentType)
checkArg(1, componentType, "string")
assert(component.isAvailable(componentType),
"no primary '" .. componentType .. "' available")
return primaries[componentType]
end
function component.setPrimary(componentType, address)
checkArg(1, componentType, "string")
checkArg(2, address, "string", "nil")
if address ~= nil then
address = component.get(address, componentType)
assert(address, "no such component")
end
local wasAvailable = primaries[componentType]
if wasAvailable and address == wasAvailable.address then
return
end
local wasAdding = adding[componentType]
if wasAdding and address == wasAdding.address then
return
end
if wasAdding then
event.cancel(wasAdding.timer)
end
primaries[componentType] = nil
adding[componentType] = nil
local primary = address and component.proxy(address) or nil
if wasAvailable then
computer.pushSignal("component_unavailable", componentType)
end
if primary then
if wasAvailable or wasAdding then
adding[componentType] = {
address=address,
timer=event.timer(0.1, function()
adding[componentType] = nil
primaries[componentType] = primary
computer.pushSignal("component_available", componentType)
end)
}
else
primaries[componentType] = primary
computer.pushSignal("component_available", componentType)
end
end
end
-------------------------------------------------------------------------------
for address in component.list('screen') do
if #component.invoke(address,'getKeyboards') > 0 then
component.setPrimary('screen',address)
end
end
local function onComponentAdded(_, address, componentType)
if not (primaries[componentType] or adding[componentType]) then
component.setPrimary(componentType, address)
end
end
local function onComponentRemoved(_, address, componentType)
if primaries[componentType] and primaries[componentType].address == address or
adding[componentType] and adding[componentType].address == address
then
component.setPrimary(componentType, component.list(componentType, true)())
end
end
event.listen("component_added", onComponentAdded)
event.listen("component_removed", onComponentRemoved)
| mit |
FailcoderAddons/supervillain-ui | SVUI_!Core/libs/AceVillain-1.0/widgets/AceGUIWidget-Keybinding.lua | 4 | 6538 | --[[-----------------------------------------------------------------------------
Keybinding Widget
Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 999999
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NOT_BOUND
local wowMoP
do
local _, _, _, interface = GetBuildInfo()
wowMoP = (interface >= 50000)
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Keybinding_OnClick(frame, button)
if button == "LeftButton" or button == "RightButton" then
local self = frame.obj
if self.waitingForKey then
frame:EnableKeyboard(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
else
frame:EnableKeyboard(true)
self.msgframe:Show()
frame:LockHighlight()
self.waitingForKey = true
end
end
AceGUI:ClearFocus()
end
local ignoreKeys = {
["BUTTON1"] = true, ["BUTTON2"] = true,
["UNKNOWN"] = true,
["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
}
local function Keybinding_OnKeyDown(frame, key)
local self = frame.obj
if self.waitingForKey then
local keyPressed = key
if keyPressed == "ESCAPE" then
keyPressed = ""
else
if ignoreKeys[keyPressed] then return end
if IsShiftKeyDown() then
keyPressed = "SHIFT-"..keyPressed
end
if IsControlKeyDown() then
keyPressed = "CTRL-"..keyPressed
end
if IsAltKeyDown() then
keyPressed = "ALT-"..keyPressed
end
end
frame:EnableKeyboard(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
if not self.disabled then
self:SetKey(keyPressed)
self:Fire("OnKeyChanged", keyPressed)
end
end
end
local function Keybinding_OnMouseDown(frame, button)
if button == "LeftButton" or button == "RightButton" then
return
elseif button == "MiddleButton" then
button = "BUTTON3"
elseif button == "Button4" then
button = "BUTTON4"
elseif button == "Button5" then
button = "BUTTON5"
end
Keybinding_OnKeyDown(frame, button)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(320)
self:SetLabel("")
self:SetKey("")
self.waitingForKey = nil
self.msgframe:Hide()
self:SetDisabled(false)
self.button:EnableKeyboard(false)
end,
-- ["OnRelease"] = nil,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.button:Disable()
self.label:SetTextColor(0.5,0.5,0.5)
else
self.button:Enable()
self.label:SetTextColor(1,1,1)
end
end,
["SetKey"] = function(self, key)
if (key or "") == "" then
self.button:SetText(NOT_BOUND)
self.button:SetNormalFontObject("GameFontNormal")
else
self.button:SetText(key)
self.button:SetNormalFontObject("GameFontHighlight")
end
end,
["GetKey"] = function(self)
local key = self.button:GetText()
if key == NOT_BOUND then
key = nil
end
return key
end,
["SetLabel"] = function(self, label)
self.label:SetText(label or "")
if (label or "") == "" then
self.alignoffset = nil
self:SetHeight(24)
else
self.alignoffset = 30
self:SetHeight(44)
end
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local backdrop = {
bgFile = "Interface\\AddOns\\SVUI_!Core\\assets\\backgrounds\\TRANSPARENT",
edgeFile = "Interface\\AddOns\\SVUI_!Core\\assets\\borders\\DEFAULT",
tile = true, tileSize = 16, edgeSize = 8,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
}
local function keybindingMsgFixWidth(frame)
frame:SetWidth(frame.msg:GetWidth() + 10)
frame:SetScript("OnUpdate", nil)
end
local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local button = CreateFrame("Button", name, frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2")
button:EnableMouse(true)
button:RegisterForClicks("AnyDown")
button:SetScript("OnEnter", Control_OnEnter)
button:SetScript("OnLeave", Control_OnLeave)
button:SetScript("OnClick", Keybinding_OnClick)
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24)
button:EnableKeyboard(false)
local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0)
text:SetPoint("RIGHT", -7, 0)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
label:SetPoint("TOPLEFT")
label:SetPoint("TOPRIGHT")
label:SetJustifyH("CENTER")
label:SetHeight(18)
local msgframe = CreateFrame("Frame", nil, UIParent)
msgframe:SetHeight(30)
msgframe:SetBackdrop(backdrop)
msgframe:SetBackdropColor(0,0,0)
msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
msgframe:SetFrameLevel(1000)
msgframe:SetToplevel(true)
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal")
msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
msgframe.msg = msg
msg:SetPoint("TOPLEFT", 5, -5)
msgframe:SetScript("OnUpdate", keybindingMsgFixWidth)
msgframe:SetPoint("BOTTOM", button, "TOP")
msgframe:Hide()
local widget = {
button = button,
label = label,
msgframe = msgframe,
frame = frame,
alignoffset = 30,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
button.obj = widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
| mit |
nesstea/darkstar | scripts/zones/Al_Zahbi/npcs/Dahaaba.lua | 55 | 1752 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Dahaaba
-- Type: Chocobo Renter
-- @pos -65.309 -1 -39.585
-----------------------------------
require("scripts/globals/chocobo");
require("scripts/globals/keyitems");
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local level = player:getMainLvl();
local gil = player:getGil();
if (player:hasKeyItem(CHOCOBO_LICENSE) and level >= 20) then
local price = getChocoboPrice(player);
player:setLocalVar("chocoboPriceOffer",price);
player:startEvent(0x010E,price,gil);
else
player:startEvent(0x010F);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
local price = player:getLocalVar("chocoboPriceOffer");
if (csid == 0x010E and option == 0) then
if (player:delGil(price)) then
updateChocoboPrice(player, price);
local duration = 1800 + (player:getMod(MOD_CHOCOBO_RIDING_TIME) * 60)
player:addStatusEffectEx(EFFECT_CHOCOBO,EFFECT_CHOCOBO,1,0,duration,true);
player:setPos(610,-24,356,0x80,0x33);
end
end
end; | gpl-3.0 |
Mashape/kong | kong/cmd/migrations.lua | 1 | 6503 | local DB = require "kong.db"
local log = require "kong.cmd.utils.log"
local tty = require "kong.cmd.utils.tty"
local meta = require "kong.meta"
local conf_loader = require "kong.conf_loader"
local kong_global = require "kong.global"
local migrations_utils = require "kong.cmd.utils.migrations"
local lapp = [[
Usage: kong migrations COMMAND [OPTIONS]
Manage database schema migrations.
The available commands are:
bootstrap Bootstrap the database and run all
migrations.
up Run any new migrations.
finish Finish running any pending migrations after
'up'.
list List executed migrations.
reset Reset the database.
Options:
-y,--yes Assume "yes" to prompts and run
non-interactively.
-q,--quiet Suppress all output.
-f,--force Run migrations even if database reports
as already executed.
--db-timeout (default 60) Timeout, in seconds, for all database
operations (including schema consensus for
Cassandra).
--lock-timeout (default 60) Timeout, in seconds, for nodes waiting on
the leader node to finish running
migrations.
-c,--conf (optional string) Configuration file.
]]
local function confirm_prompt(q)
local MAX = 3
local ANSWERS = {
y = true,
Y = true,
yes = true,
YES = true,
n = false,
N = false,
no = false,
NO = false
}
while MAX > 0 do
io.write("> " .. q .. " [Y/n] ")
local a = io.read("*l")
if ANSWERS[a] ~= nil then
return ANSWERS[a]
end
MAX = MAX - 1
end
end
local function execute(args)
args.db_timeout = args.db_timeout * 1000
args.lock_timeout = args.lock_timeout
if args.quiet then
log.disable()
end
local conf = assert(conf_loader(args.conf))
conf.pg_timeout = args.db_timeout -- connect + send + read
conf.cassandra_timeout = args.db_timeout -- connect + send + read
conf.cassandra_schema_consensus_timeout = args.db_timeout
_G.kong = kong_global.new()
kong_global.init_pdk(_G.kong, conf, nil) -- nil: latest PDK
local db = assert(DB.new(conf))
assert(db:init_connector())
local schema_state = assert(db:schema_state())
if args.command == "list" then
if schema_state.needs_bootstrap then
if schema_state.legacy_invalid_state then
-- legacy: migration from 0.14 to 1.0 cannot be performed
if schema_state.legacy_missing_component then
log("Migrations can only be listed on a %s %s that has been " ..
"upgraded to 1.0, but the current %s seems to be older " ..
"than 0.14 (missing migrations for '%s')",
db.strategy, db.infos.db_desc, db.infos.db_desc,
schema_state.legacy_missing_component)
os.exit(2)
end
if schema_state.legacy_missing_migration then
log("Migrations can only be listed on a %s %s that has been " ..
"upgraded to 1.0, but the current %s seems to be older " ..
"than 0.14 (missing migration '%s' for '%s')",
db.strategy, db.infos.db_desc, db.infos.db_desc,
schema_state.legacy_missing_migration,
schema_state.legacy_missing_component)
os.exit(2)
end
log("Migrations can only be listed on a %s %s that has been " ..
"upgraded to 1.0, but the current %s seems to be older than " ..
"0.14 (missing migrations)", db.strategy, db.infos.db_desc,
db.infos.db_desc)
os.exit(2)
elseif not schema_state.legacy_is_014 then
log("Database needs bootstrapping; run 'kong migrations bootstrap'")
os.exit(3)
end
end
local r = ""
if schema_state.executed_migrations then
log("Executed migrations:\n%s", schema_state.executed_migrations)
r = "\n"
end
if schema_state.pending_migrations then
log("%sPending migrations:\n%s", r, schema_state.pending_migrations)
r = "\n"
end
if schema_state.new_migrations then
log("%sNew migrations available:\n%s", r, schema_state.new_migrations)
r = "\n"
end
if schema_state.pending_migrations and schema_state.new_migrations then
if r ~= "" then
log("")
end
log.warn("Database has pending migrations from a previous upgrade, " ..
"and new migrations from this upgrade (version %s)",
tostring(meta._VERSION))
log("\nRun 'kong migrations finish' when ready to complete pending " ..
"migrations (%s %s will be incompatible with the previous Kong " ..
"version)", db.strategy, db.infos.db_desc)
os.exit(4)
end
if schema_state.pending_migrations then
log("\nRun 'kong migrations finish' when ready")
os.exit(4)
end
if schema_state.new_migrations then
log("\nRun 'kong migrations up' to proceed")
os.exit(5)
end
-- exit(0)
elseif args.command == "bootstrap" then
migrations_utils.bootstrap(schema_state, db, args.lock_timeout)
elseif args.command == "reset" then
if not args.yes then
if not tty.isatty() then
error("not a tty: invoke 'reset' non-interactively with the --yes flag")
end
if not confirm_prompt("Are you sure? This operation is irreversible.") then
log("cancelled")
return
end
end
local ok = migrations_utils.reset(schema_state, db, args.lock_timeout)
if not ok then
os.exit(1)
end
os.exit(0)
elseif args.command == "up" then
migrations_utils.up(schema_state, db, {
ttl = args.lock_timeout,
force = args.force,
abort = true, -- exit the mutex if another node acquired it
})
elseif args.command == "finish" then
migrations_utils.finish(schema_state, db, {
ttl = args.lock_timeout,
force = args.force,
})
else
error("unreachable")
end
end
return {
lapp = lapp,
execute = execute,
sub_commands = {
bootstrap = true,
up = true,
finish = true,
list = true,
reset = true,
}
}
| apache-2.0 |
nesstea/darkstar | scripts/globals/items/salty_bretzel.lua | 18 | 1278 | -----------------------------------------
-- ID: 5182
-- Item: salty_bretzel
-- Food Effect: 5Min, All Races
-----------------------------------------
-- Magic % 8
-- Magic Cap 60
-- Vitality 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,300,5182);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_MPP, 8);
target:addMod(MOD_FOOD_MP_CAP, 60);
target:addMod(MOD_VIT, 2);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_MPP, 8);
target:delMod(MOD_FOOD_MP_CAP, 60);
target:delMod(MOD_VIT, 2);
end;
| gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.