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 |
|---|---|---|---|---|---|
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Southern_San_dOria_[S]/npcs/Kilhwch1.lua | 19 | 1082 | -----------------------------------
-- Area: Southern SandOria [S]
-- NPC: Kilhwch
-- @zone 80
-- @pos -63 2 -50
-----------------------------------
package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil;
require("scripts/zones/Southern_San_dOria_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc, 11143) -- I advise you distance yourself from Lady Ulla. I know not your intentions, but am inclined to believe they are crooked
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 |
Sonicrich05/FFXI-Server | scripts/zones/Dynamis-Xarcabard/mobs/Prince_Seere.lua | 16 | 1253 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Prince Seere
-----------------------------------
require("scripts/globals/dynamis");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
local Animate_Trigger = GetServerVariable("[DynaXarcabard]Boss_Trigger");
if (mob:isInBattlefieldList() == false) then
mob:addInBattlefieldList();
Animate_Trigger = Animate_Trigger + 8;
SetServerVariable("[DynaXarcabard]Boss_Trigger",Animate_Trigger);
if (Animate_Trigger == 32767) then
SpawnMob(17330911); -- 142
SpawnMob(17330912); -- 143
SpawnMob(17330183); -- 177
SpawnMob(17330184); -- 178
activateAnimatedWeapon(); -- Change subanim of all animated weapon
end
end
if (Animate_Trigger == 32767) then
killer:messageSpecial(PRISON_OF_SOULS_HAS_SET_FREE);
end
end; | gpl-3.0 |
SnakeSVx/spacebuild | lua/caf/stools/ls3_environmental_control.lua | 4 | 6870 | TOOL.Category = "Life Support"
TOOL.Name = "#Environmental Control"
TOOL.DeviceName = "Environmental Control"
TOOL.DeviceNamePlural = "Environmental Controls"
TOOL.ClassName = "ls3_environmental_control"
TOOL.DevSelect = true
TOOL.CCVar_type = "other_dispenser"
TOOL.CCVar_sub_type = "default_other_dispenser"
TOOL.CCVar_model = "models/props_combine/combine_emitter01.mdl"
TOOL.Limited = true
TOOL.LimitName = "ls3_environmental_control"
TOOL.Limit = 30
CAFToolSetup.SetLang("Environmental Controls", "Create life support devices attached to any surface.", "Left-Click: Spawn a Device. Reload: Repair Device.")
function TOOL.EnableFunc()
if not CAF then
return false;
end
if not CAF.GetAddon("Resource Distribution") or not CAF.GetAddon("Resource Distribution").GetStatus() then
return false;
end
return true;
end
TOOL.ExtraCCVars = {
extra_num = 0,
extra_bool = 0,
}
function TOOL.ExtraCCVarsCP(tool, panel)
end
function TOOL:GetExtraCCVars()
local Extra_Data = {}
return Extra_Data
end
local function environmental_control_func(ent, type, sub_type, devinfo, Extra_Data, ent_extras)
local volume_mul = 1 --Change to be 0 by default later on
local base_volume = 4084 --Change to the actual base volume later on
local base_mass = 10
local base_health = 100
if type == "other_dispenser" then
base_volume = 4084 --This will need changed
elseif type == "base_air_exchanger" then
base_volume = 4084
base_mass = 100
base_health = 600
--TODO: MAke it volume based or a tool setting??
if (sub_type == "small_air_exchanger") then
ent:SetRange(256)
else
ent:SetRange(768) --right value??
end
elseif type == "base_temperature_exchanger" then
base_volume = 4084 --Change to the actual base volume later on
base_mass = 100
base_health = 500
if (sub_type == "small_temp_exchanger") then
ent:SetRange(256)
else
ent:SetRange(768) --right value??
end
elseif type == "base_climate_control" then
base_volume = 4084
base_mass = 1200
base_health = 1000
elseif type == "other_probe" then
base_volume = 4084
base_mass = 20
base_health = 1000
elseif type == "base_gravity_control" then
base_volume = 4084
base_mass = 1200
base_health = 1000
elseif type == "nature_plant" then
base_volume = 4084
base_mass = 10
base_health = 50
end
CAF.GetAddon("Resource Distribution").RegisterNonStorageDevice(ent)
local phys = ent:GetPhysicsObject()
if phys:IsValid() and phys.GetVolume then
local vol = phys:GetVolume()
MsgN("Ent Physics Object Volume: ", vol)
vol = math.Round(vol)
volume_mul = vol / base_volume
end
ent:SetMultiplier(volume_mul)
local mass = math.Round(base_mass * volume_mul)
ent.mass = mass
local maxhealth = math.Round(base_health * volume_mul)
return mass, maxhealth
end
local function sbCheck()
local SB = CAF.GetAddon("Spacebuild")
if SB and SB.GetStatus() then
return true;
end
return false;
end
TOOL.Devices = {
other_dispenser = {
Name = "Suit Dispensers",
type = "other_dispenser",
class = "other_dispenser",
func = environmental_control_func,
devices = {
default_other_dispenser = {
Name = "Suit Dispenser",
model = "models/props_combine/combine_emitter01.mdl",
skin = 0,
legacy = false,
},
},
},
base_air_exchanger = {
Name = "Air Exchangers",
type = "base_air_exchanger",
class = "base_air_exchanger",
func = environmental_control_func,
devices = {
small_air_exchanger = {
Name = "Small Air Exchanger",
model = "models/props_combine/combine_light001a.mdl",
skin = 0,
legacy = false,
},
large_air_exchanger = {
Name = "Large Air Exchanger",
model = "models/props_combine/combine_light001b.mdl",
skin = 0,
legacy = false,
},
},
},
base_temperature_exchanger = {
Name = "Heat Exchangers",
type = "base_temperature_exchanger",
class = "base_temperature_exchanger",
func = environmental_control_func,
EnableFunc = sbCheck,
devices = {
small_temp_exchanger = {
Name = "Small Temperature Exchanger",
model = "models/props_c17/utilityconnecter006c.mdl",
skin = 0,
legacy = false,
},
large_temp_exchanger = {
Name = "Large Temperature Exchanger",
model = "models/props_c17/substation_transformer01d.mdl",
skin = 0,
legacy = false,
},
},
},
base_climate_control = {
Name = "Climate Regulators",
type = "base_climate_control",
class = "base_climate_control",
func = environmental_control_func,
EnableFunc = sbCheck,
devices = {
normal = {
Name = "Climate Regulator",
model = "models/props_combine/combine_generator01.mdl",
skin = 0,
legacy = false,
},
},
},
other_probe = {
Name = "Atmospheric Probes",
type = "other_probe",
class = "other_probe",
func = environmental_control_func,
EnableFunc = sbCheck,
devices = {
normal = {
Name = "Atmospheric Probe",
model = "models/props_combine/combine_mine01.mdl",
skin = 0,
legacy = false,
},
},
},
base_gravity_control = {
Name = "Gravity Regulators",
type = "base_gravity_control",
class = "base_gravity_control",
func = environmental_control_func,
EnableFunc = sbCheck,
devices = {
normal = {
Name = "Gravity Regulator",
model = "models/props_combine/combine_mine01.mdl",
skin = 0,
legacy = false,
},
},
},
nature_plant = {
Name = "Air Hydroponics",
type = "nature_plant",
class = "nature_plant",
func = environmental_control_func,
devices = {
normal = {
Name = "Air Hydroponics",
model = "models/props/cs_office/plant01.mdl",
skin = 0,
legacy = false,
},
},
},
} | apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Wajaom_Woodlands/npcs/leypoint.lua | 17 | 2538 | -----------------------------------
-- Area: Wajaom Woodlands
-- NPC: Leypoint
-- Teleport point, Quest -- NAVIGATING THE UNFRIENDLY SEAS RELATED --
-- @pos -200.027 -8.500 80.058 51
-----------------------------------
require("scripts/zones/Wajaom_Woodlands/TextIDs");
require("scripts/globals/settings");
require("scripts/globals/quests");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getQuestStatus(AHT_URHGAN,OLDUUM) == QUEST_COMPLETED and player:hasItem(15769) == false) then
if (trade:hasItemQty(2217,1) and trade:getItemCount() == 1) then -- Trade Lightning Band
player:tradeComplete(); -- Trade Complete
player:addItem(15769); -- Receive Olduum Ring
player:messageSpecial(ITEM_OBTAINED,15769); -- Message for Receiving Ring
end
end
if (player:getQuestStatus(AHT_URHGAN,NAVIGATING_THE_UNFRIENDLY_SEAS) == QUEST_ACCEPTED and player:getVar("NavigatingtheUnfriendlySeas") == 2) then
if (trade:hasItemQty(2341,1) and trade:getItemCount() == 1) then -- Trade Hydrogauge
player:messageSpecial(PLACE_HYDROGAUGE,2341); -- You set the <item> in the trench.
player:tradeComplete(); --Trade Complete
player:setVar("NavigatingtheUnfriendlySeas",3)
player:setVar("Leypoint_waitJTime",getMidnight()); -- Time Set for 1 day real life time.
printf("Midnight: %u",getMidnight());
printf("Os: %u",os.time());
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(AHT_URHGAN,NAVIGATING_THE_UNFRIENDLY_SEAS) == QUEST_ACCEPTED and player:getVar("NavigatingtheUnfriendlySeas") == 3) then
if (player:getVar("Leypoint_waitJTime") <= os.time()) then
player:startEvent(0x01FC);
player:setVar("NavigatingtheUnfriendlySeas",4); -- play cs for having waited enough time
else
player:messageSpecial(ENIGMATIC_LIGHT,2341); -- play cs for not waiting long enough
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
Servius/tfa-sw-weapons-repository | Backups_Reworks/tfa_swrp_extended_weapons_pack/lua/weapons/tfa_swch_ee3_expanded/shared.lua | 2 | 2662 |
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "EE-3"
SWEP.Author = "Servius"
SWEP.ViewModelFOV = 50
SWEP.Slot = 2
SWEP.SlotPos = 3
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/EE3")
killicon.Add( "weapon_752_ee3", "HUD/killicons/EE3", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "ar2"
SWEP.Base = "tfa_swsft_base"
SWEP.Category = "TFA Star Wars Battlefront"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/synbf3/c_EE3.mdl"
SWEP.WorldModel = "models/weapons/synbf3/w_EE3.mdl"
SWEP.UseHands = true --Use gmod c_arms system.
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Sound = Sound ("weapons/EE3_fire.wav");
SWEP.Primary.ReloadSound = Sound ("weapons/EE3_reload.wav");
SWEP.Primary.Recoil = 0.3
SWEP.Primary.Damage = 20 -- Damage, in standard damage points.
SWEP.Primary.HullSize = 0 --Big bullets, increase this value. They increase the hull size of the hitscan bullet.
SWEP.DamageType = DMG_SHOCK--See DMG enum. This might be DMG_SHOCK, DMG_BURN, DMG_BULLET, etc.
SWEP.Primary.NumShots = 5 --The number of shots the weapon fires. SWEP.Shotgun is NOT required for this to be >1.
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.RPM = 120 -- This is in Rounds Per Minute / RPM
SWEP.Primary.RPM_Semi = nil -- RPM for semi-automatic or burst fire. This is in Rounds Per Minute / RPM
SWEP.FiresUnderwater = false
SWEP.Primary.Spread = .05 --This is hip-fire acuracy. Less is more (1 is horribly awful, .0001 is close to perfect)
SWEP.Primary.IronAccuracy = .05 -- Ironsight accuracy, should be the same for shotguns
SWEP.Primary.ClipSize = 20
SWEP.Primary.DefaultClip = 60
SWEP.Primary.Ammo = "ar2"
SWEP.TracerName = "effect_sw_laser_red"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector(1, -5, 0)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.VElements = {
["element_name"] = { type = "Model", model = "models/rtcircle.mdl", bone = "v_thompson.root5", rel = "", pos = Vector(-9.931, -2.225, 0.28), angle = Angle(0, -180, 0), size = Vector(0.18, 0.18, 0.18), color = Color(255, 255, 255, 255), surpresslightning = false, material = "!tfa_rtmaterial", skin = 0, bodygroup = {} }
}
SWEP.IronSightsSensitivity = 0.25 --Useful for a RT scope. Change this to 0.25 for 25% sensitivity. This is if normal FOV compenstaion isn't your thing for whatever reason, so don't change it for normal scopes.
SWEP.BlowbackVector = Vector(0,-1,0.05) | apache-2.0 |
omid010/-K- | plugins/owners.lua | 284 | 12473 |
local function lock_group_namemod(msg, data, target)
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function unlock_group_namemod(msg, data, target)
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
local function lock_group_floodmod(msg, data, target)
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function unlock_group_floodmod(msg, data, target)
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
local function lock_group_membermod(msg, data, target)
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function unlock_group_membermod(msg, data, target)
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
local function unlock_group_photomod(msg, data, target)
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function show_group_settingsmod(msg, data, target)
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX
return text
end
local function set_rules(target, rules)
local data = load_data(_config.moderation.data)
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
local function set_description(target, about)
local data = load_data(_config.moderation.data)
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function run(msg, matches)
if msg.to.type ~= 'chat' then
local chat_id = matches[1]
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
if matches[2] == 'ban' then
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) == tonumber(our_id) then return false end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't ban yourself"
end
ban_user(matches[3], matches[1])
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] banned user ".. matches[3])
return 'User '..user_id..' banned'
end
if matches[2] == 'unban' then
if tonumber(matches[3]) == tonumber(our_id) then return false end
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't unban yourself"
end
local hash = 'banned:'..matches[1]
redis:srem(hash, user_id)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unbanned user ".. matches[3])
return 'User '..user_id..' unbanned'
end
if matches[2] == 'kick' then
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) == tonumber(our_id) then return false end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't kick yourself"
end
kick_user(matches[3], matches[1])
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] kicked user ".. matches[3])
return 'User '..user_id..' kicked'
end
if matches[2] == 'clean' then
if matches[3] == 'modlist' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
for k,v in pairs(data[tostring(matches[1])]['moderators']) do
data[tostring(matches[1])]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned modlist")
end
if matches[3] == 'rules' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local data_cat = 'rules'
data[tostring(matches[1])][data_cat] = nil
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned rules")
end
if matches[3] == 'about' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local data_cat = 'description'
data[tostring(matches[1])][data_cat] = nil
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned about")
end
end
if matches[2] == "setflood" then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) < 5 or tonumber(matches[3]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[3]
data[tostring(matches[1])]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] set flood to ["..matches[3].."]")
return 'Group flood has been set to '..matches[3]
end
if matches[2] == 'lock' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local target = matches[1]
if matches[3] == 'name' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[3] == 'member' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
end
if matches[2] == 'unlock' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local target = matches[1]
if matches[3] == 'name' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unlocked name ")
return unlock_group_namemod(msg, data, target)
end
if matches[3] == 'member' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
end
if matches[2] == 'new' then
if matches[3] == 'link' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local function callback (extra , success, result)
local receiver = 'chat#'..matches[1]
vardump(result)
data[tostring(matches[1])]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
return
end
local receiver = 'chat#'..matches[1]
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] revoked group link ")
export_chat_link(receiver, callback, true)
return "Created a new new link ! \n owner can get it by /owners "..matches[1].." get link"
end
end
if matches[2] == 'get' then
if matches[3] == 'link' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local group_link = data[tostring(matches[1])]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first !"
end
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
end
if matches[1] == 'changeabout' and matches[2] and is_owner2(msg.from.id, matches[2]) then
local target = matches[2]
local about = matches[3]
local name = user_print_name(msg.from)
savelog(matches[2], name.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]")
return set_description(target, about)
end
if matches[1] == 'changerules' and is_owner2(msg.from.id, matches[2]) then
local rules = matches[3]
local target = matches[2]
local name = user_print_name(msg.from)
savelog(matches[2], name.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]")
return set_rules(target, rules)
end
if matches[1] == 'changename' and is_owner2(msg.from.id, matches[2]) then
local new_name = string.gsub(matches[3], '_', ' ')
data[tostring(matches[2])]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(matches[2])]['settings']['set_name']
local to_rename = 'chat#id'..matches[2]
local name = user_print_name(msg.from)
savelog(matches[2], "Group {} name changed to [ "..new_name.." ] by "..name.." ["..msg.from.id.."]")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
if matches[1] == 'loggroup' and matches[2] and is_owner2(msg.from.id, matches[2]) then
savelog(matches[2], "------")
send_document("user#id".. msg.from.id,"./groups/"..matches[2].."log.txt", ok_cb, false)
end
end
end
return {
patterns = {
"^[!/]owners (%d+) ([^%s]+) (.*)$",
"^[!/]owners (%d+) ([^%s]+)$",
"^[!/](changeabout) (%d+) (.*)$",
"^[!/](changerules) (%d+) (.*)$",
"^[!/](changename) (%d+) (.*)$",
"^[!/](loggroup) (%d+)$"
},
run = run
}
| gpl-2.0 |
mehrpouya81/gamer3 | plugins/owners.lua | 284 | 12473 |
local function lock_group_namemod(msg, data, target)
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function unlock_group_namemod(msg, data, target)
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
local function lock_group_floodmod(msg, data, target)
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function unlock_group_floodmod(msg, data, target)
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
local function lock_group_membermod(msg, data, target)
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function unlock_group_membermod(msg, data, target)
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
local function unlock_group_photomod(msg, data, target)
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function show_group_settingsmod(msg, data, target)
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX
return text
end
local function set_rules(target, rules)
local data = load_data(_config.moderation.data)
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
local function set_description(target, about)
local data = load_data(_config.moderation.data)
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function run(msg, matches)
if msg.to.type ~= 'chat' then
local chat_id = matches[1]
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
if matches[2] == 'ban' then
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) == tonumber(our_id) then return false end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't ban yourself"
end
ban_user(matches[3], matches[1])
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] banned user ".. matches[3])
return 'User '..user_id..' banned'
end
if matches[2] == 'unban' then
if tonumber(matches[3]) == tonumber(our_id) then return false end
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't unban yourself"
end
local hash = 'banned:'..matches[1]
redis:srem(hash, user_id)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unbanned user ".. matches[3])
return 'User '..user_id..' unbanned'
end
if matches[2] == 'kick' then
local chat_id = matches[1]
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) == tonumber(our_id) then return false end
local user_id = matches[3]
if tonumber(matches[3]) == tonumber(msg.from.id) then
return "You can't kick yourself"
end
kick_user(matches[3], matches[1])
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] kicked user ".. matches[3])
return 'User '..user_id..' kicked'
end
if matches[2] == 'clean' then
if matches[3] == 'modlist' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
for k,v in pairs(data[tostring(matches[1])]['moderators']) do
data[tostring(matches[1])]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned modlist")
end
if matches[3] == 'rules' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local data_cat = 'rules'
data[tostring(matches[1])][data_cat] = nil
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned rules")
end
if matches[3] == 'about' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local data_cat = 'description'
data[tostring(matches[1])][data_cat] = nil
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] cleaned about")
end
end
if matches[2] == "setflood" then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
if tonumber(matches[3]) < 5 or tonumber(matches[3]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[3]
data[tostring(matches[1])]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] set flood to ["..matches[3].."]")
return 'Group flood has been set to '..matches[3]
end
if matches[2] == 'lock' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local target = matches[1]
if matches[3] == 'name' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[3] == 'member' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
end
if matches[2] == 'unlock' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local target = matches[1]
if matches[3] == 'name' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unlocked name ")
return unlock_group_namemod(msg, data, target)
end
if matches[3] == 'member' then
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
end
if matches[2] == 'new' then
if matches[3] == 'link' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local function callback (extra , success, result)
local receiver = 'chat#'..matches[1]
vardump(result)
data[tostring(matches[1])]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
return
end
local receiver = 'chat#'..matches[1]
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] revoked group link ")
export_chat_link(receiver, callback, true)
return "Created a new new link ! \n owner can get it by /owners "..matches[1].." get link"
end
end
if matches[2] == 'get' then
if matches[3] == 'link' then
if not is_owner2(msg.from.id, chat_id) then
return "You are not the owner of this group"
end
local group_link = data[tostring(matches[1])]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first !"
end
local name = user_print_name(msg.from)
savelog(matches[1], name.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
end
if matches[1] == 'changeabout' and matches[2] and is_owner2(msg.from.id, matches[2]) then
local target = matches[2]
local about = matches[3]
local name = user_print_name(msg.from)
savelog(matches[2], name.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]")
return set_description(target, about)
end
if matches[1] == 'changerules' and is_owner2(msg.from.id, matches[2]) then
local rules = matches[3]
local target = matches[2]
local name = user_print_name(msg.from)
savelog(matches[2], name.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]")
return set_rules(target, rules)
end
if matches[1] == 'changename' and is_owner2(msg.from.id, matches[2]) then
local new_name = string.gsub(matches[3], '_', ' ')
data[tostring(matches[2])]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(matches[2])]['settings']['set_name']
local to_rename = 'chat#id'..matches[2]
local name = user_print_name(msg.from)
savelog(matches[2], "Group {} name changed to [ "..new_name.." ] by "..name.." ["..msg.from.id.."]")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
if matches[1] == 'loggroup' and matches[2] and is_owner2(msg.from.id, matches[2]) then
savelog(matches[2], "------")
send_document("user#id".. msg.from.id,"./groups/"..matches[2].."log.txt", ok_cb, false)
end
end
end
return {
patterns = {
"^[!/]owners (%d+) ([^%s]+) (.*)$",
"^[!/]owners (%d+) ([^%s]+)$",
"^[!/](changeabout) (%d+) (.*)$",
"^[!/](changerules) (%d+) (.*)$",
"^[!/](changename) (%d+) (.*)$",
"^[!/](loggroup) (%d+)$"
},
run = run
}
| gpl-2.0 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader/dc15s_addon_live/lua/weapons/tfa_dc15s_ashura/shared.lua | 1 | 4395 | if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "DC-15s"
SWEP.Author = "TFA, Servius"
SWEP.Slot = 2
SWEP.SlotPos = 3
end
SWEP.Base = "tfa_gun_base"
SWEP.Category = "TFA Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.HoldType = "ar2"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/servius/starwars/c_ashuradc15s.mdl"
SWEP.WorldModel = "models/servius/starwars/w_ashuradc15s.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true
SWEP.UseHands = true
SWEP.Primary.Sound = Sound ("strasser/weapons/dc15/dc15_laser.wav");
SWEP.Primary.ReloadSound = Sound ("weapons/bf3/standard_reload2.ogg");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.SafetyPos = Vector(0, 0, 0)
SWEP.SafetyAng = Vector(-10, 10, 0)
SWEP.Primary.Damage = 30
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.009
SWEP.Primary.IronAccuracy = .001 -- Ironsight accuracy, should be the same for shotguns
SWEP.Primary.ClipSize = 35
SWEP.Primary.RPM = 300
SWEP.Primary.DefaultClip = 50
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.DisableChambering = true
SWEP.Primary.Force = nil
SWEP.Primary.Knockback = nil
SWEP.Primary.Recoil = 0
SWEP.Primary.KickUp = .3
SWEP.Primary.SpreadMultiplierMax = nil -- How far the spread can expand when you shoot. Example val: 2.5
SWEP.Primary.SpreadIncrement = 1/2.9 -- What percentage of the modifier is added on, per shot. Example val: 1/3.5
SWEP.Tracer = 0
SWEP.TracerName = "effect_sw_laser_blue"
SWEP.TracerCount = 1
SWEP.TracerLua = false
SWEP.TracerDelay = 0.01
SWEP.ImpactEffect = "effect_sw_impact"
SWEP.ImpactDecal = "FadingScorch"
SWEP.SelectiveFire = false --Allow selecting your firemode?
SWEP.DisableBurstFire = false --Only auto/single?
SWEP.OnlyBurstFire = false --No auto, only burst/single?
SWEP.DefaultFireMode = "" --Default to auto or whatev
SWEP.FireModeName = nil --Change to a text value to override it
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.IronFOV = 90
SWEP.IronSightsPos = Vector(-2.8, 0, 1.96)
SWEP.IronSightsAng = Vector(0, 0, 0.5)
SWEP.BlowbackVector = Vector(0,0,0)
SWEP.Blowback_Only_Iron = false
SWEP.DoProceduralReload = false
SWEP.ProceduralReloadTime = 2.5
SWEP.DoMuzzleFlash = true
SWEP.CustomMuzzleFlash = true
SWEP.MuzzleFlashEffect = "rw_sw_muzzleflash_blue"
SWEP.GrappleHookSound = "weapons/rpg/shotdown.wav"
SWEP.GrappleMoveSound = "weapons/tripwire/ropeshoot.wav"
SWEP.VElements = {
["lasersight"] = { type = "Model", model = "models/sw_battlefront/props/flashlight/flashlight.mdl", bone = "DC15_S", rel = "", pos = Vector(0.99, 6.752, 0.518), angle = Angle(0, -90, 180), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}, bonermerge = true, active = true },
["laser"] = { type = "Model", model = "models/tfa/lbeam.mdl", bone = "DC15_S", rel = "lasersight", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(1.274, 1.274, 1.274), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}, bonermerge = true, active = false }
}
SWEP.WElements = {
["lazer"] = { type = "Model", model = "models/tfa/lbeam.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "lazersight", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.755, 0.755, 0.755), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}, bonermerge = true, active = false },
["lazersight"] = { type = "Model", model = "models/sw_battlefront/props/flashlight/flashlight.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(17, 2.2, -6), angle = Angle(-10.52, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}, bonermerge = true, active = true }
}
SWEP.Attachments = {
[1] = { offset = { 0, 0 }, atts = { "lazersight4"}, order = 1 },
[2] = { offset = { 0, 0 }, atts = { "clipexpand2"}, order = 2 },
-- [3] = { offset = { 0, 0 }, atts = { "grapplehookatt","mod_stun5_servius","mod_stun10_servius","mod_stun15_servius","mod_stun20_servius","mod_stun5_servius2"}, order = 3 },
} | apache-2.0 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader_legacy/tfa_extended_live/lua/weapons/tfa_f11_white/shared.lua | 1 | 7466 | if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "F-11I"
SWEP.Author = "TFA, Servius"
SWEP.ViewModelFOV = 70.35175879397
SWEP.Slot = 2
SWEP.SlotPos = 3
--SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DC15A")
--killicon.Add( "weapon_752_dc15a", "HUD/killicons/DC15A", Color( 255, 80, 0, 255 ) )
end
SWEP.Base = "tfa_3dscoped_base"
SWEP.Category = "TFA Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.HoldType = "ar2"
SWEP.ViewModelFOV = 70.35175879397
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/synbf3/c_e11.mdl"
SWEP.WorldModel = "models/weapons/synbf3/w_e11.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.UseHands = true
SWEP.Primary.Sound = Sound ("weapons/f11/f11_fire.ogg");
SWEP.Primary.ReloadSound = Sound ("weapons/shared/battlefront_standard_reload.ogg");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 50
SWEP.Primary.NumShots = 1
-- Selective Fire Stuff
SWEP.SelectiveFire = true --Allow selecting your firemode?
SWEP.DisableBurstFire = false --Only auto/single?
SWEP.OnlyBurstFire = false --No auto, only burst/single?
SWEP.DefaultFireMode = "" --Default to auto or whatev
SWEP.FireModeName = nil --Change to a text value to override it
SWEP.Primary.Spread = 0.0125
SWEP.Primary.IronAccuracy = .002 -- Ironsight accuracy, should be the same for shotguns
SWEP.Primary.SpreadMultiplierMax = 2 --How far the spread can expand when you shoot.
--Range Related
SWEP.Primary.Range = -1 -- The distance the bullet can travel in source units. Set to -1 to autodetect based on damage/rpm.
SWEP.Primary.RangeFalloff = -1 -- The percentage of the range the bullet damage starts to fall off at. Set to 0.8, for example, to start falling off after 80% of the range.
--Penetration Related
SWEP.MaxPenetrationCounter = 1 --The maximum number of ricochets. To prevent stack overflows.
SWEP.Primary.ClipSize = 45
SWEP.Primary.RPM = 300
SWEP.Primary.DefaultClip = 150
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.IronFOV = 70
SWEP.ViewModelBoneMods = {
["r_thumb_mid"] = { scale = Vector(1, 1, 1), pos = Vector(-0.926, 0.185, -0.186), angle = Angle(0, 0, 0) },
["v_e11_reference001"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["r_thumb_tip"] = { scale = Vector(1, 1, 1.07), pos = Vector(0, 0, 0.185), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Hand"] = { scale = Vector(1, 0.647, 1), pos = Vector(-0.556, 0.925, -0.926), angle = Angle(0, 0, 0) },
["l_thumb_low"] = { scale = Vector(1, 1, 1), pos = Vector(1.296, -0.556, 0), angle = Angle(0, 0, 0) }
}
SWEP.IronSightsPos = Vector(-3.241, -3.619, 1.759)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.VElements = {
["element_scope"] = { type = "Model", model = "models/rtcircle.mdl", bone = "v_e11_reference001", rel = "", pos = Vector(-1.31, -6.011, 5.46), angle = Angle(0, 90, 0), size = Vector(0.33, 0.33, 0.33), color = Color(255, 255, 255, 255), surpresslightning = false, material = "!tfa_rtmaterial", skin = 0, bodygroup = {} },
["element_name"] = { type = "Model", model = "models/weapons/w_f-11d.mdl", bone = "v_e11_reference001", rel = "", pos = Vector(-1.558, 5, 2), angle = Angle(0, -90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["element_name"] = { type = "Model", model = "models/weapons/w_f-11d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8, 0.899, -4), angle = Angle(-15.195, 3.506, 180), size = Vector(0.899, 0.899, 0.899), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.BlowbackVector = Vector(0,-3,0.025)
SWEP.Blowback_Only_Iron = false
SWEP.DoProceduralReload = false
SWEP.ProceduralReloadTime = 2.5
----Swft Base Code
SWEP.TracerCount = 1
SWEP.MuzzleFlashEffect = ""
SWEP.TracerName = "effect_sw_laser_red"
SWEP.Secondary.IronFOV = 70
SWEP.Primary.KickUp = 0.2
SWEP.Primary.KickDown = 0.1
SWEP.Primary.KickHorizontal = 0.1
SWEP.Primary.KickRight = 0.1
SWEP.DisableChambering = true
SWEP.ImpactDecal = "FadingScorch"
SWEP.ImpactEffect = "effect_sw_impact" --Impact Effect
SWEP.RunSightsPos = Vector(2.127, 0, 1.355)
SWEP.RunSightsAng = Vector(-15.775, 10.023, -5.664)
SWEP.BlowbackEnabled = true
SWEP.BlowbackVector = Vector(0,-3,0.1)
SWEP.Blowback_Shell_Enabled = false
SWEP.Blowback_Shell_Effect = ""
SWEP.ThirdPersonReloadDisable=false
SWEP.Primary.DamageType = DMG_SHOCK
SWEP.DamageType = DMG_SHOCK
--3dScopedBase stuff
SWEP.RTMaterialOverride = -1
SWEP.RTScopeAttachment = -1
SWEP.Scoped_3D = true
SWEP.ScopeReticule = "scope/gdcw_red_nobar"
SWEP.Secondary.ScopeZoom = 8
SWEP.ScopeReticule_Scale = {2.5,2.5}
SWEP.Secondary.UseACOG = false --Overlay option
SWEP.Secondary.UseMilDot = false --Overlay option
SWEP.Secondary.UseSVD = false --Overlay option
SWEP.Secondary.UseParabolic = false --Overlay option
SWEP.Secondary.UseElcan = false --Overlay option
SWEP.Secondary.UseGreenDuplex = false --Overlay option
if surface then
SWEP.Secondary.ScopeTable = nil --[[
{
scopetex = surface.GetTextureID("scope/gdcw_closedsight"),
reticletex = surface.GetTextureID("scope/gdcw_acogchevron"),
dottex = surface.GetTextureID("scope/gdcw_acogcross")
}
]]--
end
DEFINE_BASECLASS( SWEP.Base )
--[[
SWEP.HoldType = "ar2"
SWEP.ViewModelFOV = 70.35175879397
SWEP.ViewModelFlip = false
SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/synbf3/c_e11.mdl"
SWEP.WorldModel = "models/weapons/synbf3/w_e11.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.ViewModelBoneMods = {
["r_thumb_mid"] = { scale = Vector(1, 1, 1), pos = Vector(-0.926, 0.185, -0.186), angle = Angle(0, 0, 0) },
["v_e11_reference001"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["r_thumb_tip"] = { scale = Vector(1, 1, 1.07), pos = Vector(0, 0, 0.185), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Hand"] = { scale = Vector(1, 0.647, 1), pos = Vector(-0.556, 0.925, -0.926), angle = Angle(0, 0, 0) },
["l_thumb_low"] = { scale = Vector(1, 1, 1), pos = Vector(1.296, -0.556, 0), angle = Angle(0, 0, 0) }
}
SWEP.IronSightsPos = Vector(-3.241, -3.619, 1.759)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.VElements = {
["element_scope"] = { type = "Model", model = "models/rtcircle.mdl", bone = "v_e11_reference001", rel = "", pos = Vector(-1.31, -6.011, 5.46), angle = Angle(0, 90, 0), size = Vector(0.33, 0.33, 0.33), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["element_name"] = { type = "Model", model = "models/weapons/w_f-11d.mdl", bone = "v_e11_reference001", rel = "", pos = Vector(-1.558, 5, 2), angle = Angle(0, -90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["element_name"] = { type = "Model", model = "models/weapons/w_f-11d.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8, 0.899, -4), angle = Angle(-15.195, 3.506, 180), size = Vector(0.899, 0.899, 0.899), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
]] | apache-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Windurst_Woods/npcs/Mheca_Khetashipah.lua | 5 | 1047 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Mheca Khetashipah
-- Type: Standard NPC
-- @zone: 241
-- @pos: 66.881 -6.249 185.752
--
-- Auto-Script: Requires Verification (Verfied by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x01aa);
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 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Sacrarium/npcs/qm2.lua | 2 | 1356 | -----------------------------------
-- ???
-- Area: Sacrarium
-----------------------------------
package.loaded["scripts/zones/Sacrarium/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Sacrarium/TextIDs");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:getCurrentMission(COP) == THE_SECRETS_OF_WORSHIP and player:getVar("PromathiaStatus") == 3 and player:hasKeyItem(RELIQUIARIUM_KEY)==false)then
-- print("pop");
SpawnMob(16891970,240):updateEnmity(player);
SpawnMob(16891971,240):updateEnmity(player);
SpawnMob(16891972,240):updateEnmity(player);
elseif(player:getCurrentMission(COP) == THE_SECRETS_OF_WORSHIP and player:getVar("PromathiaStatus") == 4 and player:hasKeyItem(RELIQUIARIUM_KEY)==false)then
player:addKeyItem(RELIQUIARIUM_KEY);
player:messageSpecial(KEYITEM_OBTAINED,RELIQUIARIUM_KEY);
else
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);--There is nothing out of the ordinary here
end
end;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
end;
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Windurst_Waters/npcs/Aramu-Paramu.lua | 6 | 1589 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Aramu-Paramu
-- Involved In Quest: Wondering Minstrel
-- Working 100%
-- @zone = 238
-- @pos = -63 -4 27
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/keyitems");
require("scripts/zones/Windurst_Waters/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
wonderingstatus = player:getQuestStatus(WINDURST,WONDERING_MINSTREL);
if (wonderingstatus == QUEST_ACCEPTED) then
player:startEvent(0x027e); -- WONDERING_MINSTREL: Quest Available / Quest Accepted
elseif (wonderingstatus == QUEST_COMPLETED and player:needToZone()) then
player:startEvent(0x0281); -- WONDERING_MINSTREL: Quest After
else
player:startEvent(0x261); -- 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);
end;
| gpl-3.0 |
kans/zirgo | tests/net/init.lua | 1 | 3131 | local table = require('table')
local async = require('async')
local ConnectionStream = require('/client/connection_stream').ConnectionStream
local misc = require('/util/misc')
local helper = require('../helper')
local timer = require('timer')
local constants = require('constants')
local consts = require('../../util/constants')
local Endpoint = require('../../endpoint').Endpoint
local path = require('path')
local os = require('os')
local exports = {}
local AEP
exports['test_reconnects'] = function(test, asserts)
if os.type() == "win32" then
test.skip("Skip test_reconnects until a suitable SIGUSR1 replacement is used in runner.py")
return nil
end
local options = {
datacenter = 'test',
stateDirectory = './tests',
tls = { rejectUnauthorized = false }
}
local client = ConnectionStream:new('id', 'token', 'guid', false, options)
local clientEnd = 0
local reconnect = 0
client:on('client_end', function(err)
clientEnd = clientEnd + 1
end)
client:on('reconnect', function(err)
reconnect = reconnect + 1
end)
local endpoints = {}
for _, address in pairs(TESTING_AGENT_ENDPOINTS) do
-- split ip:port
table.insert(endpoints, Endpoint:new(address))
end
async.series({
function(callback)
AEP = helper.start_server(callback)
end,
function(callback)
client:on('handshake_success', misc.nCallbacks(callback, 3))
local endpoints = {}
for _, address in pairs(TESTING_AGENT_ENDPOINTS) do
-- split ip:port
table.insert(endpoints, Endpoint:new(address))
end
client:createConnections(endpoints, function() end)
end,
function(callback)
AEP:kill(9)
client:on('reconnect', misc.nCallbacks(callback, 3))
end,
function(callback)
AEP = helper.start_server(function()
client:on('handshake_success', misc.nCallbacks(callback, 3))
end)
end,
}, function()
AEP:kill(9)
asserts.ok(clientEnd > 0)
asserts.ok(reconnect > 0)
test.done()
end)
end
exports['test_upgrades'] = function(test, asserts)
local options, client, endpoints
if true then
test.skip("Skip upgrades test until it is reliable")
return nil
end
-- Override the default download path
consts.DEFAULT_DOWNLOAD_PATH = path.join('.', 'tmp')
options = {
datacenter = 'test',
stateDirectory = './tests',
tls = { rejectUnauthorized = false }
}
local endpoints = {}
for _, address in pairs(TESTING_AGENT_ENDPOINTS) do
-- split ip:port
table.insert(endpoints, Endpoint:new(address))
end
async.series({
function(callback)
AEP = helper.start_server(callback)
end,
function(callback)
client = ConnectionStream:new('id', 'token', 'guid', false, options)
client:on('handshake_success', misc.nCallbacks(callback, 3))
client:createConnections(endpoints, function() end)
end,
function(callback)
client:on('upgrade_done', callback)
client:getUpgrade():forceUpgradeCheck({test = true})
end
}, function()
AEP:kill(9)
client:done()
test.done()
end)
end
return exports
| apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Windurst_Waters/npcs/Anja-Enja.lua | 37 | 1052 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Anja-Enja
-- Adventurer's Assistant
-- Working 100%
-------------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
require("scripts/zones/Windurst_Waters/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0116);
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 |
Sonicrich05/FFXI-Server | scripts/zones/Metalworks/npcs/Amulya.lua | 19 | 1154 | -----------------------------------
-- Area: Metalworks
-- NPC: Amulya
-- Type: Guild Merchant (Blacksmithing Guild)
-- @pos -106.093 0.999 -24.564 237
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:sendGuild(5332,8,23,2)) then
player:showText(npc, AMULYA_SHOP_DIALOG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
ShmooDude/ovale | dist/Queue.lua | 1 | 3335 | local __exports = LibStub:NewLibrary("ovale/Queue", 80000)
if not __exports then return end
local __class = LibStub:GetLibrary("tslib").newClass
local __Ovale = LibStub:GetLibrary("ovale/Ovale")
local Ovale = __Ovale.Ovale
local BackToFrontIterator = __class(nil, {
constructor = function(self, invariant, control)
self.invariant = invariant
self.control = control
end,
Next = function(self)
self.control = self.control - 1
self.value = self.invariant[self.control]
return self.control >= self.invariant.first
end,
})
local FrontToBackIterator = __class(nil, {
constructor = function(self, invariant, control)
self.invariant = invariant
self.control = control
end,
Next = function(self)
self.control = self.control + 1
self.value = self.invariant[self.control]
return self.control <= self.invariant.last
end,
})
__exports.OvaleDequeue = __class(nil, {
constructor = function(self, name)
self.name = name
self.first = 0
self.last = -1
end,
InsertFront = function(self, element)
local first = self.first - 1
self.first = first
self[first] = element
end,
InsertBack = function(self, element)
local last = self.last + 1
self.last = last
self[last] = element
end,
RemoveFront = function(self)
local first = self.first
local element = self[first]
if element then
self[first] = nil
self.first = first + 1
end
return element
end,
RemoveBack = function(self)
local last = self.last
local element = self[last]
if element then
self[last] = nil
self.last = last - 1
end
return element
end,
At = function(self, index)
if index > self:Size() then
return
end
return self[self.first + index - 1]
end,
Front = function(self)
return self[self.first]
end,
Back = function(self)
return self[self.last]
end,
BackToFrontIterator = function(self)
return BackToFrontIterator(self, self.last + 1)
end,
FrontToBackIterator = function(self)
return FrontToBackIterator(self, self.first - 1)
end,
Reset = function(self)
local iterator = self:BackToFrontIterator()
while iterator:Next() do
self[iterator.control] = nil
end
self.first = 0
self.last = -1
end,
Size = function(self)
return self.last - self.first + 1
end,
DebuggingInfo = function(self)
Ovale:Print("Queue %s has %d item(s), first=%d, last=%d.", self.name, self:Size(), self.first, self.last)
end,
})
__exports.OvaleQueue = __class(__exports.OvaleDequeue, {
Insert = function(self, value)
self:InsertBack(value)
end,
Remove = function(self)
return self:RemoveFront()
end,
Iterator = function(self)
return self:FrontToBackIterator()
end,
})
__exports.OvaleStack = __class(__exports.OvaleDequeue, {
Push = function(self, value)
self:InsertBack(value)
end,
Pop = function(self)
return self:RemoveBack()
end,
Top = function(self)
return self:Back()
end,
})
| gpl-2.0 |
Sonicrich05/FFXI-Server | scripts/globals/weaponskills/keen_edge.lua | 30 | 1342 | -----------------------------------
-- Keen Edge
-- Great Axe weapon skill
-- Skill level: 150
-- Delivers a single hit attack. Chance of params.critical varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Shadow Gorget.
-- Aligned with the Shadow Belt.
-- Element: None
-- Modifiers: STR:35%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 1;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.35; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.3; params.crit200 = 0.6; params.crit300 = 0.9;
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 = 1.0;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
Ding8222/skynet | service/snaxd.lua | 29 | 2244 | local skynet = require "skynet"
local c = require "skynet.core"
local snax_interface = require "snax.interface"
local profile = require "skynet.profile"
local snax = require "skynet.snax"
local snax_name = tostring(...)
local loaderpath = skynet.getenv"snax_loader"
local loader = loaderpath and assert(dofile(loaderpath))
local func, pattern = snax_interface(snax_name, _ENV, loader)
local snax_path = pattern:sub(1,pattern:find("?", 1, true)-1) .. snax_name .. "/"
package.path = snax_path .. "?.lua;" .. package.path
SERVICE_NAME = snax_name
SERVICE_PATH = snax_path
local profile_table = {}
local function update_stat(name, ti)
local t = profile_table[name]
if t == nil then
t = { count = 0, time = 0 }
profile_table[name] = t
end
t.count = t.count + 1
t.time = t.time + ti
end
local traceback = debug.traceback
local function return_f(f, ...)
return skynet.ret(skynet.pack(f(...)))
end
local function timing( method, ... )
local err, msg
profile.start()
if method[2] == "accept" then
-- no return
err,msg = xpcall(method[4], traceback, ...)
else
err,msg = xpcall(return_f, traceback, method[4], ...)
end
local ti = profile.stop()
update_stat(method[3], ti)
assert(err,msg)
end
skynet.start(function()
local init = false
local function dispatcher( session , source , id, ...)
local method = func[id]
if method[2] == "system" then
local command = method[3]
if command == "hotfix" then
local hotfix = require "snax.hotfix"
skynet.ret(skynet.pack(hotfix(func, ...)))
elseif command == "profile" then
skynet.ret(skynet.pack(profile_table))
elseif command == "init" then
assert(not init, "Already init")
local initfunc = method[4] or function() end
initfunc(...)
skynet.ret()
skynet.info_func(function()
return profile_table
end)
init = true
else
assert(init, "Never init")
assert(command == "exit")
local exitfunc = method[4] or function() end
exitfunc(...)
skynet.ret()
init = false
skynet.exit()
end
else
assert(init, "Init first")
timing(method, ...)
end
end
skynet.dispatch("snax", dispatcher)
-- set lua dispatcher
function snax.enablecluster()
skynet.dispatch("lua", dispatcher)
end
end)
| mit |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader/[TFA][AT] Expanded Pack/lua/weapons/tfa_swch_dc15a_blacktiger/shared.lua | 1 | 2729 |
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "DC-15A [ Black Tiger ]"
SWEP.Author = "TFA"
SWEP.ViewModelFOV = 50
SWEP.Slot = 2
SWEP.SlotPos = 3
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DC15A")
killicon.Add( "weapon_752_dc15a", "HUD/killicons/DC15A", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "ar2"
SWEP.Base = "tfa_swsft_base"
SWEP.Category = "TFA Bling Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.HoldType = "ar2"
SWEP.ViewModelFOV = 56
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl"
SWEP.WorldModel = "models/weapons/w_irifle.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.UseHands = true
SWEP.ViewModelBoneMods = {
["v_weapon.awm_parent"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Clavicle"] = { scale = Vector(1, 1, 1), pos = Vector(0.338, 2.914, 0.18), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Finger0"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 1.447, 0) }
}
SWEP.Primary.Sound = Sound ("weapons/dc15a/DC15A_fire.ogg");
SWEP.Primary.ReloadSound = Sound ("weapons/shared/standard_reload.ogg");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 50
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.0125
SWEP.Primary.ClipSize = 50
SWEP.Primary.RPM = 40/0.175
SWEP.Primary.DefaultClip = 150
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.TracerName = "rw_sw_laser_blue"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.IronFOV = 70
SWEP.IronSightsPos = Vector(-7.401, -18.14, 2.099)
SWEP.IronSightsAng = Vector(-1.89, 0.282, 0)
SWEP.VElements = {
["element_name"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_blacktiger.mdl", bone = "v_weapon.awm_parent", rel = "", pos = Vector(-0.011, -2.924, -5.414), angle = Angle(180, 0, -89.595), size = Vector(0.95, 0.95, 0.95), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["element_name2"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_blacktiger.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.279, 0.584, -4.468), angle = Angle(0, -90, 160.731), size = Vector(0.884, 0.884, 0.884), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.BlowbackVector = Vector(0,-3,0.025)
SWEP.Blowback_Only_Iron = false
SWEP.DoProceduralReload = true
SWEP.ProceduralReloadTime = 2.5 | apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/West_Ronfaure/npcs/Harvetour.lua | 17 | 1867 | -----------------------------------
-- Area: West Ronfaure
-- NPC: Harvetour
-- Type: Outpost Vendor
-- @pos -448 -19 -214 100
-----------------------------------
package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/West_Ronfaure/TextIDs");
local region = RONFAURE;
local csid = 0x7ff4;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local owner = GetRegionOwner(region);
local arg1 = getArg1(owner,player);
if (owner == player:getNation()) then
nation = 1;
elseif (arg1 < 1792) then
nation = 2;
else
nation = 0;
end
player:startEvent(csid,nation,OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP(),0,0,0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
player:updateEvent(player:getGil(),OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP());
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
if (option == 1) then
ShowOPVendorShop(player);
elseif (option == 2) then
if (player:delGil(OP_TeleFee(player,region))) then
toHomeNation(player);
end
elseif (option == 6) then
player:delCP(OP_TeleFee(player,region));
toHomeNation(player);
end
end; | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Batallia_Downs_[S]/npcs/Cavernous_Maw.lua | 13 | 1428 | -----------------------------------
-- Area: Batallia Downs [S]
-- NPC: Cavernous Maw
-- @pos -48 0 435 84
-- Teleports Players to Batallia Downs
-----------------------------------
package.loaded["scripts/zones/Batallia_Downs_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/teleports");
require("scripts/globals/campaign");
require("scripts/zones/Batallia_Downs_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (hasMawActivated(player,0) == false) then
player:startEvent(0x0064);
else
player:startEvent(0x0065);
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 (option == 1) then
if (csid == 0x0064) then
player:addNationTeleport(MAW,1);
end
toMaw(player,2);
end
end; | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Port_Bastok/npcs/Alib-Mufalib.lua | 19 | 3841 | -----------------------------------
-- Area: Port Bastok
-- NPC: Alib-Mufalib
-- Type: Warp NPC
-- @pos 116.080 7.372 -31.820 236
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/globals/missions");
require("scripts/globals/teleports");
require("scripts/globals/keyitems");
require("scripts/zones/Port_Bastok/TextIDs");
--[[
Bitmask Designations:
Port Bastok (East to West)
00001 (J-5) Kaede (northernmost house)
00002 (F-5) Patient Wheel (north of Warehouse 2)
00004 (F-6) Paujean (bottom floor of Warehouse 2)
00008 (E-6) Hilda (Steaming Sheep Restaurant, walks on the top floor and occasionally down. However, she can still be talked to when on second floor. Unable to get if you have Cid's Secret flagged.)
00010 (F-8) Tilian (end of a pier west of Air Travel Agency)
Metalworks (all found on top floor)
00020 (G-8) Raibaht (Cid's lab)
00040 (G-8) Invincible Shield (outside Cid's Lab)
00080 (G-7) Manilam (on top of Cermet Refinery)
00100 (I-8) Kaela (between Consulate of Windurst & Consulate of Bastok)
00200 (K-7) Ayame (Inside north Cannonry)
Bastok Markets (East to West)
00400 (K-10) Harmodios (Harmodios's Music Shop)
00800 (J-10) Arawn (west of music store)
01000 (I-9) Horatius (Inside Trader's Home)
02000 (E-10) Ken (outside Mjoll's General Goods)
04000 (E-11) Pavel (West Gate to South Gustaberg)
Bastok Mines (Clockwise, starting at Ore Street, upper floor to lower floor)
08000 (H-5) Griselda (upper floor, Bat's Lair Inn)
10000 (I-6) Goraow (upper floor, in stairwell of Ore Street)
20000 (I-7) Echo Hawk (lower floor, Ore Street)
40000 (H-6) Deidogg (lower floor, Ore Street)
80000 (H-9) Vaghron (southwest of South Auction House)
]]--
function onTrade(player,npc,trade)
if (trade:getGil() == 300 and trade:getItemCount() == 1 and player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_COMPLETED and player:getCurrentMission(TOAU) > IMMORTAL_SENTRIES) then
-- Needs a check for at least traded an invitation card to Naja Salaheem
player:startEvent(0x017b);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local LureBastok = player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK);
local WildcatBastok = player:getVar("WildcatBastok");
if (LureBastok ~= 2 and ENABLE_TOAU == 1) then
if (LureBastok == 0) then
player:startEvent(0x0165);
else
if (WildcatBastok == 0) then
player:startEvent(0x0166);
elseif (player:isMaskFull(WildcatBastok,20) == true) then
player:startEvent(0x0168);
else
player:startEvent(0x0167);
end
end
elseif (player:getCurrentMission(TOAU) >= 2) then
player:startEvent(0x017a);
else
player:startEvent(0x0169);
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0165) then
player:addQuest(BASTOK,LURE_OF_THE_WILDCAT_BASTOK);
player:setVar("WildcatBastok",0);
player:addKeyItem(BLUE_SENTINEL_BADGE);
player:messageSpecial(KEYITEM_OBTAINED,BLUE_SENTINEL_BADGE);
elseif (csid == 0x0168) then
player:completeQuest(BASTOK,LURE_OF_THE_WILDCAT_BASTOK);
player:addFame(BASTOK,150);
player:setVar("WildcatBastok",0);
player:delKeyItem(BLUE_SENTINEL_BADGE);
player:addKeyItem(BLUE_INVITATION_CARD);
player:messageSpecial(KEYITEM_LOST,BLUE_SENTINEL_BADGE);
player:messageSpecial(KEYITEM_OBTAINED,BLUE_INVITATION_CARD);
elseif (csid == 0x017b) then
player:tradeComplete();
toAhtUrhganWhitegate(player);
end
end;
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Garlaige_Citadel/npcs/qm2.lua | 2 | 1308 | -----------------------------------
-- Area: Garlaige Citadel
-- NPC: qm2 (???)
-- Grants the Pouch of Weighted Stones keyitem
-- used to pass through the banishing gates
-- @zone 200
-- @pos -364 0 299
-----------------------------------
package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/Garlaige_Citadel/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if(player:hasKeyItem(POUCH_OF_WEIGHTED_STONES) == false) then
player:addKeyItem(POUCH_OF_WEIGHTED_STONES);
player:messageSpecial(KEYITEM_OBTAINED,POUCH_OF_WEIGHTED_STONES);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Northern_San_dOria/npcs/Abioleget.lua | 19 | 2190 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Abioleget
-- Type: Quest Giver (Her Memories: The Faux Pas and The Vicasque's Sermon) / Merchant
-- @zone: 231
-- @pos 128.771 0.000 118.538
--
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
require("scripts/zones/Northern_San_dOria/TextIDs");
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (sermonQuest == QUEST_ACCEPTED) then
gil = trade:getGil();
count = trade:getItemCount();
if (gil == 70 and count == 1) then
player:tradeComplete();
player:startEvent(0x024F);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
sermonQuest = player:getQuestStatus(SANDORIA,THE_VICASQUE_S_SERMON);
if (sermonQuest == QUEST_AVAILABLE) then
player:startEvent(0x024d);
elseif (sermonQuest == QUEST_ACCEPTED) then
if (player:getVar("sermonQuestVar") == 1) then
player:tradeComplete();
player:startEvent(0x0258);
else
player:showText(npc,11103,618,70);
end
else
player:showText(npc,ABIOLEGET_DIALOG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x0258) then
player:addItem(13465);
player:messageSpecial(6567, 13465);
player:addFame(SANDORIA,SAN_FAME*30);
player:addTitle(THE_BENEVOLENT_ONE);
player:setVar("sermonQuestVar",0);
player:completeQuest(SANDORIA,THE_VICASQUE_S_SERMON );
elseif (csid == 0x024D) then
player:addQuest(SANDORIA,THE_VICASQUE_S_SERMON );
elseif (csid == 0x024F) then
player:addItem(618);
player:messageSpecial(6567, 618);
end
end;
| gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Riverne-Site_A01/npcs/_0u4.lua | 17 | 1341 | -----------------------------------
-- Area: Riverne Site #A01
-- NPC: Unstable Displacement
-----------------------------------
package.loaded["scripts/zones/Riverne-Site_A01/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Riverne-Site_A01/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(1691,1) and trade:getItemCount() == 1) then -- Trade Giant Scale
player:tradeComplete();
npc:openDoor(RIVERNE_PORTERS);
player:messageSpecial(SD_HAS_GROWN);
end
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 8) then
player:startEvent(0x20);
else
player:messageSpecial(SD_VERY_SMALL);
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);
end; | gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Metalworks/npcs/Moyoyo.lua | 5 | 1035 | -----------------------------------
-- Area: Metalworks
-- NPC: Moyoyo
-- Type: Standard NPC
-- @zone: 237
-- @pos: 19.508 -17 26.870
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00fc);
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 |
Sonicrich05/FFXI-Server | scripts/zones/Bastok_Mines/npcs/Deidogg.lua | 19 | 4762 | -----------------------------------
-- Area: Bastok Mines
-- NPC: Deidogg
-- Starts and Finishes Quest: The Talekeeper's Truth, The Talekeeper's Gift (start)
-- @pos -13 7 29 234
-----------------------------------
package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Bastok_Mines/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getVar("theTalekeeperTruthCS") == 3) then
if (trade:hasItemQty(1101,1) and trade:getItemCount() == 1) then -- Trade Mottled Quadav Egg
player:startEvent(0x00a2);
end
elseif (player:getVar("theTalekeeperTruthCS") == 4) then
if (trade:hasItemQty(1099,1) and trade:getItemCount() == 1) then -- Trade Parasite Skin
player:startEvent(0x00a4);
end
elseif (player:getVar("theTalekeeperGiftCS") == 2) then
if (trade:hasItemQty(4394,1) and trade:getItemCount() == 1) then -- Trade Ginger Cookie
player:startEvent(0x00ac);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local theDoorman = player:getQuestStatus(BASTOK,THE_DOORMAN);
local theTalekeeperTruth = player:getQuestStatus(BASTOK,THE_TALEKEEPER_S_TRUTH);
local theTalekeeperTruthCS = player:getVar("theTalekeeperTruthCS");
local Wait1DayForAF3 = player:getVar("DeidoggWait1DayForAF3");
local theTalekeeperGiftCS = player:getVar("theTalekeeperGiftCS");
local WildcatBastok = player:getVar("WildcatBastok");
if (player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,18) == false) then
player:startEvent(0x01f8);
elseif (theDoorman == QUEST_COMPLETED and theTalekeeperTruth == QUEST_AVAILABLE and player:getMainJob() == 1 and player:getMainLvl() >= 50) then
if (theTalekeeperTruthCS == 1) then
player:startEvent(0x00a0);
player:setVar("theTalekeeperTruthCS",2);
elseif (theTalekeeperTruthCS == 2) then
player:startEvent(0x00a1); -- Start Quest "The Talekeeper's Truth"
else
player:startEvent(0x0020); -- Standard dialog
end
elseif (theTalekeeperTruthCS == 4) then
player:startEvent(0x00a3); -- During Quest "The Talekeeper's Truth"
elseif (theTalekeeperTruthCS == 5 and VanadielDayOfTheYear() ~= player:getVar("theTalekeeperTruth_timer")) then
player:startEvent(0x00a5); -- Finish Quest "The Talekeeper's Truth"
elseif (theTalekeeperTruthCS == 5 or (theTalekeeperTruth == QUEST_COMPLETED and (player:needToZone() or VanadielDayOfTheYear() == Wait1DayForAF3))) then
player:startEvent(0x00a6); -- New standard dialog after "The Talekeeper's Truth"
elseif (player:needToZone() == false and VanadielDayOfTheYear() ~= Wait1DayForAF3 and Wait1DayForAF3 ~= 0 and theTalekeeperGiftCS == 0 and player:getMainJob() == 1) then
player:startEvent(0x00aa);
player:setVar("theTalekeeperGiftCS",1);
player:setVar("DeidoggWait1DayForAF3",0);
else
player:startEvent(0x0020); -- Standard dialog
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x00a1) then
player:addQuest(BASTOK,THE_TALEKEEPER_S_TRUTH);
player:setVar("theTalekeeperTruthCS",3);
elseif (csid == 0x00a2) then
player:tradeComplete();
player:setVar("theTalekeeperTruthCS",4);
elseif (csid == 0x00a4) then
player:tradeComplete();
player:setVar("theTalekeeperTruthCS",5);
player:setVar("theTalekeeperTruth_timer",VanadielDayOfTheYear());
elseif (csid == 0x00a5) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,14089); -- Fighter's Calligae
else
player:addItem(14089);
player:messageSpecial(ITEM_OBTAINED, 14089); -- Fighter's Calligae
player:setVar("theTalekeeperTruthCS",0);
player:setVar("theTalekeeperTruth_timer",0);
player:setVar("DeidoggWait1DayForAF3",VanadielDayOfTheYear());
player:needToZone(true);
player:addFame(BASTOK,AF2_FAME);
player:completeQuest(BASTOK,THE_TALEKEEPER_S_TRUTH);
end
elseif (csid == 0x00ac) then
player:tradeComplete();
player:addQuest(BASTOK,THE_TALEKEEPER_S_GIFT);
player:setVar("theTalekeeperGiftCS",3);
elseif (csid == 0x01f8) then
player:setMaskBit(player:getVar("WildcatBastok"),"WildcatBastok",18,true);
end
end; | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/globals/abilities/pets/thunderstorm.lua | 25 | 1305 | ---------------------------------------------------
-- Geocrush
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
require("scripts/globals/magic");
---------------------------------------------------
function onAbilityCheck(player, target, ability)
return 0,0;
end;
function onPetAbility(target, pet, skill)
local dINT = math.floor(pet:getStat(MOD_INT) - target:getStat(MOD_INT));
local tp = skill:getTP();
local master = pet:getMaster();
local merits = 0;
if (master ~= nil and master:isPC()) then
merits = master:getMerit(MERIT_THUNDERSTORM);
end
tp = tp + (merits - 40);
if (tp > 300) then
tp = 300;
end
--note: this formula is only accurate for level 75 - 76+ may have a different intercept and/or slope
local damage = math.floor(512 + 1.72*(tp+1));
damage = damage + (dINT * 1.5);
damage = MobMagicalMove(pet,target,skill,damage,ELE_LIGHTNING,1,TP_NO_EFFECT,0);
damage = mobAddBonuses(pet, nil, target, damage.dmg, ELE_LIGHTNING);
damage = AvatarFinalAdjustments(damage,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,1);
target:delHP(damage);
target:updateEnmityFromDamage(pet,damage);
return damage;
end | gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/LaLoff_Amphitheater/mobs/Ark_Angel_s_Tiger.lua | 2 | 1188 | -----------------------------------
-- Area: LaLoff Amphitheater
-- NPC: Ark Angel's Tiger
--
-----------------------------------
require("scripts/zones/LaLoff_Amphitheater/TextIDs");
-- TODO: Implement shared spawning and victory system with Ark Angel's Mandragora.
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function OnMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
local mobid = mob:getID()
for member = mobid-2, mobid+5 do
if (GetMobAction(member) == 16) then
GetMobByID(member):updateEnmity(target);
end
end
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
local mobid = mob:getID()
-- Party hate. Keep everybody in the fight.
for member = mobid-2, mobid+5 do
if (GetMobAction(member) == 16) then
GetMobByID(member):updateEnmity(target);
end
end
end;
-----------------------------------
-- onMobDeath Action
-----------------------------------
function onMobDeath(mob,killer)
end;
| gpl-3.0 |
premake/premake-core | src/base/tools.lua | 14 | 1780 | ---
-- tools.lua
-- Work with Premake's collection of tool adapters.
-- Author Jason Perkins
-- Copyright (c) 2015 Jason Perkins and the Premake project
---
local p = premake
p.tools = {}
---
-- Given a toolset identifier (e.g. "gcc" or "gcc-4.8") returns the
-- corresponding tool adapter and the version, if one was provided.
--
-- @param identifier
-- A toolset identifier composed of two parts: the toolset name,
-- which should match of the name of the adapter object ("gcc",
-- "clang", etc.) in the p.tools namespace, and and optional
-- version number, separated by a dash.
--
-- To make things more intuitive for Visual Studio users, supports
-- identifiers like "v100" to represent the v100 Microsoft platform
-- toolset.
-- @return
-- If successful, returns the toolset adapter object. If a version
-- was specified as part of the identifier, that is returned as a
-- second return value. If no corresponding tool adapter exists,
-- returns nil.
---
function p.tools.normalize(identifier)
if identifier:startswith("v") then -- TODO: this should be deprecated?
identifier = 'msc-' .. identifier
end
local parts = identifier:explode("-", true, 1)
if parts[2] == nil then
return parts[1]
end
-- 'msc-100' is accepted, but the code expects 'v100'
if parts[1] == "msc" and tonumber(parts[2]:sub(1,3)) ~= nil then
parts[2] = "v" .. parts[2]
end
-- perform case-correction of the LLVM toolset
if parts[2]:startswith("llvm-vs") then
parts[2] = "LLVM-" .. parts[2]:sub(6)
end
return parts[1] .. '-' .. parts[2]
end
function p.tools.canonical(identifier)
identifier = p.tools.normalize(identifier)
local parts = identifier:explode("-", true, 1)
return p.tools[parts[1]], parts[2]
end
| bsd-3-clause |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Selbina/npcs/Quelpia.lua | 2 | 1523 | -----------------------------------
-- Area: Selbina
-- NPC: Quelpia
-- Standard Merchant NPC
-----------------------------------
require("scripts/globals/shop");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,TextID_Selbina.QUELPIA_SHOP_DIALOG);
stock = {0x1202,585, -- Scroll of Cure II
0x1203,3261, -- Scroll of Cure III
0x1208,10080, -- Scroll of Curaga II
0x120C,5178, -- Scroll of Raise
0x1215,31500, -- Scroll of Holy
0x1218,10080, -- Scroll of Dia II
0x121D,8100, -- Scroll of Banish II
0x122C,6366, -- Scroll of Protect II
0x1231,15840, -- Scroll of Shell II
0x1239,18000, -- Scroll of Haste
0x1264,4644, -- Scroll of Enfire
0x1265,3688, -- Scroll of Enblizzard
0x1266,2250, -- Scroll of Enaero
0x1267,1827, -- Scroll of Enstone
0x1268,1363, -- Scroll of Enthunder
0x1269,6366} -- Scroll of Enwater
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 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/items/shogun_rice_ball.lua | 3 | 1643 | -----------------------------------------
-- ID: 4278
-- Item: shogun_rice_ball
-- Food Effect: 60Min, All Races
-----------------------------------------
-- HP +20, Dex +4, Vit +4, Chr +4. (Atk +50, Def +30, DA% +5) * number of enhancing gear
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/equipment");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,RiceBalls(target),0,3600,4278);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
local power = effect:getPower();
target:addMod(MOD_HP, 20);
target:addMod(MOD_DEX, 4);
target:addMod(MOD_VIT, 4);
target:addMod(MOD_CHR, 4);
target:addMod(MOD_ATT, 50*power);
target:addMod(MOD_DEF, 30*power);
target:addMod(MOD_DOUBLE_ATTACK,5*power);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
local power = effect:getPower();
target:delMod(MOD_HP, 20);
target:delMod(MOD_DEX, 4);
target:delMod(MOD_VIT, 4);
target:delMod(MOD_CHR, 4);
target:delMod(MOD_ATT, 50*power);
target:delMod(MOD_DEF, 30*power);
target:delMod(MOD_DOUBLE_ATTACK,5*power);
end;
| gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/globals/regimeinfo.lua | 12 | 97619 | -------------------------------------------------
--
-- Regime Info Database
--
-- Stores details on the number of monsters to kill
-- as well as the suggested level range.
-- n1,n2,n3,n4 = Number of monsters needed
-- sl = Start Level range
-- s2 = End Level range
--
-- Example:
-- n1=6, n2=0, n3=0, n4=0, sl=1, el=6, Regime ID=1, produces:
-- Defeat the following monsters:
-- 6 Worms
-- Level range 1 ~ 6
-- Area: West Ronfaure
-------------------------------------------------
function getRegimeInfo(regimeid)
a = {};
if (regimeid >= 1 and regimeid <= 146) then -- FoV (1~146)
if (regimeid <= 50) then
if (regimeid <= 10) then
if (regimeid == 1) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=6;
return a;
elseif (regimeid == 2) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=6;
return a;
elseif (regimeid == 3) then
a.n1=5;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=7;
return a;
elseif (regimeid == 4) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
elseif (regimeid == 5) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=8;
a.el=12;
return a;
elseif (regimeid == 6) then
a.n1=8;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=12;
a.el=13;
return a;
elseif (regimeid == 7) then
a.n1=7;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=15;
a.el=19;
return a;
elseif (regimeid == 8) then
a.n1=6;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=15;
a.el=22;
return a;
elseif (regimeid == 9) then
a.n1=5;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=18;
a.el=23;
return a;
elseif (regimeid == 10) then
a.n1=4;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=23;
return a;
end
elseif (regimeid > 10 and regimeid <= 20) then
if (regimeid == 11) then
a.n1=9;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=21;
a.el=22;
return a;
elseif (regimeid == 12) then
a.n1=8;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=21;
a.el=23;
return a;
elseif (regimeid == 13) then
a.n1=7;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=22;
a.el=25;
return a;
elseif (regimeid == 14) then
a.n1=6;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=24;
a.el=25;
return a;
elseif (regimeid == 15) then
a.n1=4;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=25;
a.el=28;
return a;
elseif (regimeid == 16) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=6;
return a;
elseif (regimeid == 17) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 18) then
a.n1=5;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=7;
return a;
elseif (regimeid == 19) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=8;
return a;
elseif (regimeid == 20) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=10;
a.el=12;
return a;
end
elseif (regimeid > 20 and regimeid <= 30) then
if (regimeid == 21) then
a.n1=9;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=21;
return a;
elseif (regimeid == 22) then
a.n1=8;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=22;
return a;
elseif (regimeid == 23) then
a.n1=7;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=21;
a.el=23;
return a;
elseif (regimeid == 24) then
a.n1=6;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=22;
a.el=25;
return a;
elseif (regimeid == 25) then
a.n1=4;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=25;
a.el=28;
return a;
elseif (regimeid == 26) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=5;
return a;
elseif (regimeid == 27) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=5;
return a;
elseif (regimeid == 28) then
a.n1=5;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=8;
return a;
elseif (regimeid == 29) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
elseif (regimeid == 30) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=7;
a.el=12;
return a;
end
elseif (regimeid > 30 and regimeid <= 40) then
if (regimeid == 31) then
a.n1=8;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=11;
a.el=13;
return a;
elseif (regimeid == 32) then
a.n1=7;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=15;
a.el=19;
return a;
elseif (regimeid == 33) then
a.n1=6;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=15;
a.el=23;
return a;
elseif (regimeid == 34) then
a.n1=5;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=24;
return a;
elseif (regimeid == 35) then
a.n1=4;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=21;
a.el=24;
return a;
elseif (regimeid == 36) then
a.n1=9;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=21;
return a;
elseif (regimeid == 37) then
a.n1=8;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=20;
a.el=22;
return a;
elseif (regimeid == 38) then
a.n1=7;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=21;
a.el=23;
return a;
elseif (regimeid == 39) then
a.n1=6;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=22;
a.el=25;
return a;
elseif (regimeid == 40) then
a.n1=4;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=25;
a.el=28;
return a;
end
else --Regime between 41-50
if (regimeid == 41) then
a.n1=9;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=26;
a.el=29;
return a;
elseif (regimeid == 42) then
a.n1=8;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=26;
a.el=29;
return a;
elseif (regimeid == 43) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=28;
a.el=29;
return a;
elseif (regimeid == 44) then
a.n1=6;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=28;
a.el=30;
return a;
elseif (regimeid == 45) then
a.n1=5;
a.n2=4;
a.n3=1;
a.n4=0;
a.sl=28;
a.el=34;
return a;
elseif (regimeid == 46) then
a.n1=9;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=34;
a.el=38;
return a;
elseif (regimeid == 47) then
a.n1=8;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=34;
a.el=39;
return a;
elseif (regimeid == 48) then
a.n1=7;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=37;
a.el=42;
return a;
elseif (regimeid == 49) then
a.n1=6;
a.n2=4;
a.n3=1;
a.n4=0;
a.sl=37;
a.el=43;
return a;
elseif (regimeid == 50) then
a.n1=5;
a.n2=4;
a.n3=2;
a.n4=0;
a.sl=40;
a.el=43;
return a;
end
end
elseif (regimeid > 50 and regimeid <= 100) then
if (regimeid > 50 and regimeid <= 60) then
if (regimeid == 51) then
a.n1=9;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=42;
a.el=46;
return a;
elseif (regimeid == 52) then
a.n1=8;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=42;
a.el=45;
return a;
elseif (regimeid == 53) then
a.n1=7;
a.n2=4;
a.n3=1;
a.n4=0;
a.sl=42;
a.el=48;
return a;
elseif (regimeid == 54) then
a.n1=6;
a.n2=4;
a.n3=2;
a.n4=0;
a.sl=42;
a.el=48;
return a;
elseif (regimeid == 55) then
a.n1=5;
a.n2=4;
a.n3=3;
a.n4=0;
a.sl=45;
a.el=52;
return a;
elseif (regimeid == 56) then
a.n1=6;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
elseif (regimeid == 57) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=22;
a.el=25;
return a;
elseif (regimeid == 58) then
a.n1=8;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=15;
a.el=18;
return a;
elseif (regimeid == 59) then
a.n1=3;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=8;
return a;
elseif (regimeid == 60) then
a.n1=5;
a.n2=4;
a.n3=1;
a.n4=0;
a.sl=22;
a.el=25;
return a;
end
elseif (regimeid > 60 and regimeid <= 70) then
if (regimeid == 61) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
elseif (regimeid == 62) then
a.n1=4;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=22;
a.el=27;
return a;
elseif (regimeid == 63) then
a.n1=3;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=25;
a.el=27;
return a;
elseif (regimeid == 64) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=5;
return a;
elseif (regimeid == 65) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=5;
return a;
elseif (regimeid == 66) then
a.n1=7;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=6;
return a;
elseif (regimeid == 67) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 68) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
elseif (regimeid == 69) then
a.n1=3;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=11;
a.el=13;
return a;
elseif (regimeid == 70) then
a.n1=5;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=11;
a.el=14;
return a;
end
elseif (regimeid > 70 and regimeid <= 80) then
if (regimeid == 71) then
a.n1=5;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=10;
a.el=15;
return a;
elseif (regimeid == 72) then
a.n1=5;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=23;
a.el=26;
return a;
elseif (regimeid == 73) then
a.n1=5;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=23;
a.el=28;
return a;
elseif (regimeid == 74) then
a.n1=5;
a.n2=2;
a.n3=2;
a.n4=0;
a.sl=26;
a.el=32;
return a;
elseif (regimeid == 75) then
a.n1=9;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=31;
a.el=32;
return a;
elseif (regimeid == 76) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=6;
return a;
elseif (regimeid == 77) then
a.n1=7;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=5;
return a;
elseif (regimeid == 78) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 79) then
a.n1=7;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 80) then
a.n1=5;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=4;
a.el=8;
return a;
end
elseif (regimeid > 80 and regimeid <= 90) then
if (regimeid == 81) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=8;
a.el=11;
return a;
elseif (regimeid == 82) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=9;
a.el=12;
return a;
elseif (regimeid == 83) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=9;
a.el=15;
return a;
elseif (regimeid == 84) then
a.n1=2;
a.n2=2;
a.n3=2;
a.n4=0;
a.sl=12;
a.el=14;
return a;
elseif (regimeid == 85) then
a.n1=5;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=25;
a.el=26;
return a;
elseif (regimeid == 86) then
a.n1=6;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=26;
a.el=32;
return a;
elseif (regimeid == 87) then
a.n1=6;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=27;
a.el=33;
return a;
elseif (regimeid == 88) then
a.n1=5;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=36;
a.el=37;
return a;
elseif (regimeid == 89) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=6;
return a;
elseif (regimeid == 90) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=1;
a.el=8;
return a;
end
else --Regime 91-100
if (regimeid == 91) then
a.n1=6;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=2;
a.el=6;
return a;
elseif (regimeid == 92) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 93) then
a.n1=4;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=3;
a.el=6;
return a;
elseif (regimeid == 94) then
a.n1=4;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=7;
a.el=11;
return a;
elseif (regimeid == 95) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=8;
a.el=12;
return a;
elseif (regimeid == 96) then
a.n1=3;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=12;
a.el=16;
return a;
elseif (regimeid == 97) then
a.n1=4;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=26;
a.el=32;
return a;
elseif (regimeid == 98) then
a.n1=2;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=26;
a.el=34;
return a;
elseif (regimeid == 99) then
a.n1=3;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=27;
a.el=33;
return a;
elseif (regimeid == 100) then
a.n1=5;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=36;
a.el=38;
return a;
end
end
elseif (regimeid > 100 and regimeid <= 146) then
if (regimeid > 100 and regimeid <= 110) then
if (regimeid == 101) then
a.n1=3;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=41;
a.el=44;
return a;
elseif (regimeid == 102) then
a.n1=3;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=41;
a.el=46;
return a;
elseif (regimeid == 103) then
a.n1=3;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=43;
a.el=47;
return a;
elseif (regimeid == 104) then
a.n1=4;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=62;
a.el=66;
return a;
elseif (regimeid == 105) then
a.n1=4;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=64;
a.el=68;
return a;
elseif (regimeid == 106) then
a.n1=4;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=64;
a.el=69;
return a;
elseif (regimeid == 107) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=66;
a.el=74;
return a;
elseif (regimeid == 108) then
a.n1=4;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=71;
a.el=79;
return a;
elseif (regimeid == 109) then
a.n1=10;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=30;
a.el=34;
return a;
elseif (regimeid == 110) then
a.n1=3;
a.n2=1;
a.n3=7;
a.n4=0;
a.sl=35;
a.el=40;
return a;
end
elseif (regimeid > 110 and regimeid <= 120) then
if (regimeid == 111) then
a.n1=3;
a.n2=1;
a.n3=7;
a.n4=0;
a.sl=35;
a.el=44;
return a;
elseif (regimeid == 112) then
a.n1=5;
a.n2=2;
a.n3=2;
a.n4=1;
a.sl=44;
a.el=49;
return a;
elseif (regimeid == 113) then
a.n1=3;
a.n2=3;
a.n3=2;
a.n4=1;
a.sl=45;
a.el=49;
return a;
elseif (regimeid == 114) then
a.n1=7;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=40;
a.el=44;
return a;
elseif (regimeid == 115) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=41;
a.el=46;
return a;
elseif (regimeid == 116) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=41;
a.el=46;
return a;
elseif (regimeid == 117) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=42;
a.el=47;
return a;
elseif (regimeid == 118) then
a.n1=3;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=44;
a.el=50;
return a;
elseif (regimeid == 119) then
a.n1=3;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=60;
a.el=65;
return a;
elseif (regimeid == 120) then
a.n1=7;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=64;
a.el=69;
return a;
end
elseif (regimeid > 120 and regimeid <= 130) then
if (regimeid == 121) then
a.n1=7;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=65;
a.el=69;
return a;
elseif (regimeid == 122) then
a.n1=6;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=78;
a.el=82;
return a;
elseif (regimeid == 123) then
a.n1=6;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=79;
a.el=82;
return a;
elseif (regimeid == 124) then
a.n1=4;
a.n2=5;
a.n3=0;
a.n4=0;
a.sl=30;
a.el=35;
return a;
elseif (regimeid == 125) then
a.n1=7;
a.n2=4;
a.n3=0;
a.n4=0;
a.sl=32;
a.el=37;
return a;
elseif (regimeid == 126) then
a.n1=10;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=34;
a.el=36;
return a;
elseif (regimeid == 127) then
a.n1=4;
a.n2=6;
a.n3=0;
a.n4=0;
a.sl=34;
a.el=38;
return a;
elseif (regimeid == 128) then
a.n1=4;
a.n2=6;
a.n3=0;
a.n4=0;
a.sl=34;
a.el=41;
return a;
elseif (regimeid == 129) then
a.n1=3;
a.n2=6;
a.n3=0;
a.n4=0;
a.sl=35;
a.el=39;
return a;
elseif (regimeid == 130) then
a.n1=3;
a.n2=6;
a.n3=0;
a.n4=0;
a.sl=35;
a.el=40;
return a;
end
elseif (regimeid > 130 and regimeid <= 140) then
if (regimeid == 131) then
a.n1=10;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=40;
a.el=44;
return a;
elseif (regimeid == 132) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=40;
a.el=46;
return a;
elseif (regimeid == 133) then
a.n1=10;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=45;
a.el=49;
return a;
elseif (regimeid == 134) then
a.n1=7;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=40;
a.el=45;
return a;
elseif (regimeid == 135) then
a.n1=5;
a.n2=1;
a.n3=4;
a.n4=0;
a.sl=44;
a.el=49;
return a;
elseif (regimeid == 136) then
a.n1=10;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=47;
a.el=53;
return a;
elseif (regimeid == 137) then
a.n1=2;
a.n2=8;
a.n3=0;
a.n4=0;
a.sl=51;
a.el=56;
return a;
elseif (regimeid == 138) then
a.n1=4;
a.n2=6;
a.n3=0;
a.n4=0;
a.sl=54;
a.el=58;
return a;
elseif (regimeid == 139) then
a.n1=5;
a.n2=2;
a.n3=0;
a.n4=0;
a.sl=66;
a.el=72;
return a;
elseif (regimeid == 140) then
a.n1=5;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=66;
a.el=74;
return a;
end
else --Regime 140-146
if (regimeid == 141) then
a.n1=4;
a.n2=1;
a.n3=0;
a.n4=0;
a.sl=69;
a.el=74;
return a;
elseif (regimeid == 142) then
a.n1=8;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=72;
a.el=76;
return a;
elseif (regimeid == 143) then
a.n1=8;
a.n2=3;
a.n3=0;
a.n4=0;
a.sl=73;
a.el=78;
return a;
elseif (regimeid == 144) then
a.n1=11;
a.n2=0;
a.n3=0;
a.n4=0;
a.sl=75;
a.el=78;
return a;
elseif (regimeid == 145) then
a.n1=2;
a.n2=2;
a.n3=2;
a.n4=0;
a.sl=78;
a.el=79;
return a;
elseif (regimeid == 146) then
a.n1=2;
a.n2=2;
a.n3=2;
a.n4=0;
a.sl=78;
a.el=79;
return a;
end
end
end
-- ---------------------------------------------------------
-- This space reserved for Hunt Registry (147~559) if needed.
-- I know they prevent FoV/GoV page sign-up and FoV/GoV prevent registry.
-- Need confirmation of retail behavior - Do they display in menu?
-- ---------------------------------------------------------
-- This space reserved for Dominion OPs (560~601) if needed.
-- I'm pretty sure you can have an active page and OP at same time.
-- They might still display on the review option though.
-- ---------------------------------------------------------
elseif (regimeid >= 602 and regimeid <= 819) then -- GoV (602~819)
if (regimeid >= 602 and regimeid <= 651) then
if (regimeid >= 602 and regimeid <= 611) then
if (regimeid == 602) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 3;
a.el = 5;
return a;
elseif (regimeid == 603) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 30;
return a;
elseif (regimeid == 604) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 26;
a.el = 30;
return a;
elseif (regimeid == 605) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 26;
a.el = 30;
return a;
elseif (regimeid == 606) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 30;
a.el = 34;
return a;
elseif (regimeid == 607) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 87;
a.el = 92;
return a;
elseif (regimeid == 608 or regimeid == 609) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 88;
a.el = 90;
return a;
elseif (regimeid == 610) then
a.n1 = 5;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 52;
a.el = 54;
return a;
elseif (regimeid == 611) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 52;
a.el = 59;
return a;
end
elseif (regimeid > 611 and regimeid <= 621) then
if (regimeid == 612) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 56;
a.el = 63;
return a;
elseif (regimeid == 613) then
a.n1 = 9;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 65;
a.el = 68;
return a;
elseif (regimeid == 614) then
a.n1 = 6;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 94;
a.el = 97;
return a;
elseif (regimeid == 615) then
a.n1 = 6;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 97;
return a;
elseif (regimeid == 616) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 96;
a.el = 97;
return a;
elseif (regimeid == 617) then
a.n1 = 2;
a.n2 = 5;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 99;
return a;
elseif (regimeid == 618) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 47;
a.el = 52;
return a;
elseif (regimeid == 619) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 52;
a.el = 57;
return a;
elseif (regimeid == 620) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 53;
a.el = 57;
return a;
elseif (regimeid == 621) then
a.n1 = 3;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 65;
return a;
end
elseif (regimeid > 621 and regimeid <= 631) then
if (regimeid == 622) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 97;
return a;
elseif (regimeid == 623) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 98;
return a;
elseif (regimeid == 624) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 96;
a.el = 98;
return a;
elseif (regimeid == 625) then
a.n1 = 8;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 94;
a.el = 99;
return a;
elseif (regimeid == 626) then
a.n1 = 3;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 1;
a.el = 3;
return a;
elseif (regimeid == 627) then
a.n1 = 3;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 2;
a.el = 4;
return a;
elseif (regimeid == 628) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 78;
return a;
elseif (regimeid == 629) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 79;
return a;
elseif (regimeid == 630) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 80;
return a;
elseif (regimeid == 631) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 3;
a.el = 8;
return a;
end
elseif (regimeid > 631 and regimeid <= 641) then
if (regimeid == 632) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 5;
a.el = 11;
return a;
elseif (regimeid == 633) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 12;
a.el = 16;
return a;
elseif (regimeid == 634) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 14;
a.el = 17;
return a;
elseif (regimeid == 635) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 21;
a.el = 23;
return a;
elseif (regimeid == 636) then
a.n1 = 6;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 78;
a.el = 80;
return a;
elseif (regimeid == 637) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 77;
a.el = 80;
return a;
elseif (regimeid == 638) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 80;
a.el = 83;
return a;
elseif (regimeid == 639) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 3;
a.el = 8;
return a;
elseif (regimeid == 640) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 5;
a.el = 9;
return a;
elseif (regimeid == 641) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 11;
a.el = 14;
return a;
end
else -- 642-651
if (regimeid == 642) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 86;
a.el = 89;
return a;
elseif (regimeid == 643) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 86;
a.el = 90;
return a;
elseif (regimeid == 644) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 86;
a.el = 90;
return a;
elseif (regimeid == 645) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 90;
a.el = 91;
return a;
elseif (regimeid == 646) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 90;
a.el = 93;
return a;
elseif (regimeid == 647) then
a.n1 = 2;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 1;
a.el = 6;
return a;
elseif (regimeid == 648) then
a.n1 = 2;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 1;
a.el = 7;
return a;
elseif (regimeid == 649) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 15;
a.el = 20;
return a;
elseif (regimeid == 650) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 22;
a.el = 26;
return a;
elseif (regimeid == 651) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 78;
a.el = 82;
return a;
end
end
elseif (regimeid > 651 and regimeid <= 701) then
if (regimeid > 651 and regimeid <= 661) then
if (regimeid == 652) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 79;
a.el = 82;
return a;
elseif (regimeid == 653) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 81;
a.el = 83;
return a;
elseif (regimeid == 654) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 81;
a.el = 84;
return a;
elseif (regimeid == 655) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 18;
a.el = 21;
return a;
elseif (regimeid == 656) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 21;
a.el = 27;
return a;
elseif (regimeid == 657) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 17;
a.el = 26;
return a;
elseif (regimeid == 658) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 23;
a.el = 26;
return a;
elseif (regimeid == 659) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 26;
a.el = 28;
return a;
elseif (regimeid == 660) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 29;
a.el = 34;
return a;
elseif (regimeid == 661) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 84;
a.el = 86;
return a;
end
elseif (regimeid > 661 and regimeid <= 671) then
if (regimeid == 662) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 86;
a.el = 88;
return a;
elseif (regimeid == 663) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 10;
a.el = 14;
return a;
elseif (regimeid == 664) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 15;
a.el = 19;
return a;
elseif (regimeid == 665) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 20;
a.el = 24;
return a;
elseif (regimeid == 666) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 25;
a.el = 29;
return a;
elseif (regimeid == 667) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 30;
a.el = 34;
return a;
elseif (regimeid == 668) then
a.n1 = 1;
a.n2 = 1;
a.n3 = 1;
a.n4 = 1;
a.sl = 35;
a.el = 39;
return a;
elseif (regimeid == 669) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 81;
a.el = 85;
return a;
elseif (regimeid == 670) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 82;
a.el = 85;
return a;
elseif (regimeid == 671) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 42;
a.el = 46;
return a;
end
elseif (regimeid > 671 and regimeid <= 681) then
if (regimeid == 672) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 46;
a.el = 49;
return a;
elseif (regimeid == 673) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 54;
return a;
elseif (regimeid == 674) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 55;
return a;
elseif (regimeid == 675) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 53;
a.el = 56;
return a;
elseif (regimeid == 676) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 63;
return a;
elseif (regimeid == 677) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 91;
a.el = 95;
return a;
elseif (regimeid == 678) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 91;
a.el = 95;
return a;
elseif (regimeid == 679) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 20;
a.el = 27;
return a;
elseif (regimeid == 680) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 20;
a.el = 24;
return a;
elseif (regimeid == 681) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 21;
a.el = 26;
return a;
end
elseif (regimeid > 681 and regimeid <= 691) then
if (regimeid == 682) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 28;
a.el = 31;
return a;
elseif (regimeid == 683) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 30;
a.el = 34;
return a;
elseif (regimeid == 684) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 32;
a.el = 36;
return a;
elseif (regimeid == 685) then
a.n1 = 2;
a.n2 = 5;
a.n3 = 0;
a.n4 = 0;
a.sl = 85;
a.el = 87;
return a;
elseif (regimeid == 686) then
a.n1 = 2;
a.n2 = 5;
a.n3 = 0;
a.n4 = 0;
a.sl = 85;
a.el = 89;
return a;
elseif (regimeid == 687) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 40;
a.el = 44;
return a;
elseif (regimeid == 688) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 45;
a.el = 49;
return a;
elseif (regimeid == 689) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 49;
a.el = 52;
return a;
elseif (regimeid == 690) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 54;
return a;
elseif (regimeid == 691) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 53;
a.el = 58;
return a;
end
else -- 691-701
if (regimeid == 692) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 59;
a.el = 63;
return a;
elseif (regimeid == 693) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 91;
a.el = 93;
return a;
elseif (regimeid == 694) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 92;
a.el = 96;
return a;
elseif (regimeid == 695) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 15;
a.el = 18;
return a;
elseif (regimeid == 696) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 18;
a.el = 23;
return a;
elseif (regimeid == 697) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 22;
a.el = 26;
return a;
elseif (regimeid == 698) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 26;
a.el = 31;
return a;
elseif (regimeid == 699) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 26;
a.el = 31;
return a;
elseif (regimeid == 700) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 27;
a.el = 33;
return a;
elseif (regimeid == 701) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 83;
a.el = 85;
return a;
end
end
elseif (regimeid > 701 and regimeid <= 751) then
if (regimeid > 701 and regimeid <= 711) then
if (regimeid == 702) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 86;
a.el = 88;
return a;
elseif (regimeid == 703) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 40;
a.el = 43;
return a;
elseif (regimeid == 704) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 40;
a.el = 44;
return a;
elseif (regimeid == 705) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 46;
a.el = 49;
return a;
elseif (regimeid == 706) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 55;
return a;
elseif (regimeid == 707) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 52;
a.el = 58;
return a;
elseif (regimeid == 708) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 1;
a.n4 = 0;
a.sl = 59;
a.el = 62;
return a;
elseif (regimeid == 709) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 91;
a.el = 96;
return a;
elseif (regimeid == 710) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 92;
a.el = 96;
return a;
elseif (regimeid == 711) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 40;
a.el = 43;
return a;
end
elseif (regimeid > 711 and regimeid <= 721) then
if (regimeid == 712) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 43;
a.el = 46;
return a;
elseif (regimeid == 713) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 55;
return a;
elseif (regimeid == 714) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 56;
return a;
elseif (regimeid == 715) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 58;
return a;
elseif (regimeid == 716) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 59;
a.el = 63;
return a;
elseif (regimeid == 717) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 99;
return a;
elseif (regimeid == 718) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 99;
return a;
elseif (regimeid == 719) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 63;
return a;
elseif (regimeid == 720) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 66;
return a;
elseif (regimeid == 721) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 67;
return a;
end
elseif (regimeid > 721 and regimeid <= 731) then
if (regimeid == 722) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 72;
a.el = 75;
return a;
elseif (regimeid == 723) then
a.n1 = 3;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 72;
a.el = 76;
return a;
elseif (regimeid == 724) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 72;
a.el = 78;
return a;
elseif (regimeid == 725) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 74;
a.el = 78;
return a;
elseif (regimeid == 726) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 102;
a.el = 105;
return a;
elseif (regimeid == 727) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 20;
a.el = 26;
return a;
elseif (regimeid == 728) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 22;
a.el = 30;
return a;
elseif (regimeid == 729) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 23;
a.el = 31;
return a;
elseif (regimeid == 730) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 28;
a.el = 31;
return a;
elseif (regimeid == 731) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 29;
a.el = 33;
return a;
end
elseif (regimeid > 731 and regimeid <= 741) then
if (regimeid == 732) then
a.n1 = 4;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 30;
a.el = 33;
return a;
elseif (regimeid == 733) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 35;
a.el = 37;
return a;
elseif (regimeid == 734) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 87;
a.el = 91;
return a;
elseif (regimeid == 735) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 64;
return a;
elseif (regimeid == 736) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 66;
return a;
elseif (regimeid == 737) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 66;
return a;
elseif (regimeid == 738) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 67;
return a;
elseif (regimeid == 739) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 63;
a.el = 69;
return a;
elseif (regimeid == 740) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 65;
a.el = 69;
return a;
elseif (regimeid == 741) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 77;
a.el = 80;
return a;
end
else -- 741-751
if (regimeid == 742) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 99;
a.el = 103;
return a;
elseif (regimeid == 743) then
a.n1 = 10;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 72;
a.el = 72;
return a;
elseif (regimeid == 744) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 74;
a.el = 77;
return a;
elseif (regimeid == 745) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 78;
return a;
elseif (regimeid == 746) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 76;
a.el = 79;
return a;
elseif (regimeid == 747) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 77;
a.el = 80;
return a;
elseif (regimeid == 748) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 79;
a.el = 80;
return a;
elseif (regimeid == 749) then
a.n1 = 10;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 71;
a.el = 71;
return a;
elseif (regimeid == 750) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 71;
a.el = 74;
return a;
elseif (regimeid == 751) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 80;
return a;
end
end
elseif (regimeid > 751 and regimeid <= 803) then
if (regimeid > 751 and regimeid <= 761) then
if (regimeid == 752) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 77;
a.el = 82;
return a;
elseif (regimeid == 753) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 79;
a.el = 82;
return a;
elseif (regimeid == 754) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 81;
a.el = 84;
return a;
elseif (regimeid == 755 or regimeid == 756) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 61;
a.el = 68;
return a;
elseif (regimeid == 757) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 69;
return a;
elseif (regimeid == 758) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 73;
return a;
elseif (regimeid == 759) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 73;
return a;
elseif (regimeid == 760) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 69;
a.el = 74;
return a;
elseif (regimeid == 761 or regimeid == 762) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 71;
a.el = 78;
return a;
end
elseif (regimeid > 762 and regimeid <= 772) then
if (regimeid == 763) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 1;
a.n4 = 0;
a.sl = 44;
a.el = 49;
return a;
elseif (regimeid == 764) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 45;
a.el = 49;
return a;
elseif (regimeid == 765) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 1;
a.n4 = 0;
a.sl = 65;
a.el = 68;
return a;
elseif (regimeid == 766) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 73;
a.el = 76;
return a;
elseif (regimeid == 767) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 78;
return a;
elseif (regimeid == 768) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 79;
return a;
elseif (regimeid == 769) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 76;
a.el = 80;
return a;
elseif (regimeid == 770) then
a.n1 = 5;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 100;
a.el = 103;
return a;
elseif (regimeid == 771) then
a.n1 = 2;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 45;
a.el = 49;
return a;
elseif (regimeid == 772) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 53;
return a;
end
elseif (regimeid > 772 and regimeid <= 782) then
if (regimeid == 773) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 50;
a.el = 54;
return a;
elseif (regimeid == 774) then
a.n1 = 3;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 55;
a.el = 59;
return a;
elseif (regimeid == 775) then
a.n1 = 4;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 70;
a.el = 74;
return a;
elseif (regimeid == 776) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 95;
a.el = 98;
return a;
elseif (regimeid == 777 or regimeid == 778) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 30;
return a;
elseif (regimeid == 779) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 30;
return a;
elseif (regimeid == 780) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 32;
return a;
elseif (regimeid == 781) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 35;
return a;
elseif (regimeid == 782 or regimeid == 783) then
a.n1 = 4;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 25;
a.el = 34;
return a;
end
elseif (regimeid > 783 and regimeid <= 793) then
if (regimeid == 784) then
a.n1 = 4;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 30;
a.el = 34;
return a;
elseif (regimeid == 785) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 34;
a.el = 35;
return a;
elseif (regimeid == 786 or regimeid == 787) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 62;
a.el = 69;
return a;
elseif (regimeid == 788 or regimeid == 789) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 65;
a.el = 69;
return a;
elseif (regimeid == 790) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 57;
return a;
elseif (regimeid == 791 or regimeid == 792) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 57;
return a;
elseif (regimeid == 793) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 61;
a.el = 63;
return a;
end
else -- 793-803
if (regimeid == 794) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 61;
a.el = 67;
return a;
elseif (regimeid == 795) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 61;
a.el = 68;
return a;
elseif (regimeid == 796) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 64;
return a;
elseif (regimeid == 797) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 60;
a.el = 67;
return a;
elseif (regimeid == 798) then
a.n1 = 6;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 69;
return a;
elseif (regimeid == 799) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 69;
return a;
elseif (regimeid == 800) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 76;
return a;
elseif (regimeid == 801) then
a.n1 = 5;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 73;
a.el = 81;
return a;
elseif (regimeid == 802) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 74;
a.el = 79;
return a;
end
end
elseif (regimeid > 803 and regimeid <= 819) then
if (regimeid > 803 and regimeid <= 813) then
if (regimeid == 803) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 75;
a.el = 80;
return a;
elseif (regimeid == 804) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 35;
a.el = 39;
return a;
elseif (regimeid == 805) then
a.n1 = 2;
a.n2 = 4;
a.n3 = 0;
a.n4 = 0;
a.sl = 37;
a.el = 41;
return a;
elseif (regimeid == 806) then
a.n1 = 5;
a.n2 = 1;
a.n3 = 0;
a.n4 = 0;
a.sl = 41;
a.el = 45;
return a;
elseif (regimeid == 807) then
a.n1 = 2;
a.n2 = 2;
a.n3 = 2;
a.n4 = 0;
a.sl = 43;
a.el = 48;
return a;
elseif (regimeid == 808) then
a.n1 = 4;
a.n2 = 2;
a.n3 = 0;
a.n4 = 0;
a.sl = 44;
a.el = 48;
return a;
elseif (regimeid == 809) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 67;
return a;
elseif (regimeid == 810) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 69;
return a;
elseif (regimeid == 811) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 66;
a.el = 69;
return a;
elseif (regimeid == 812) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 55;
return a;
elseif (regimeid == 813) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 58;
return a;
end
else
if (regimeid == 814) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 51;
a.el = 59;
return a;
elseif (regimeid == 815) then
a.n1 = 7;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 52;
a.el = 59;
return a;
elseif (regimeid == 816) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 52;
a.el = 59;
return a;
elseif (regimeid == 817) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 56;
a.el = 59;
return a;
elseif (regimeid == 818) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 62;
a.el = 65;
return a;
elseif (regimeid == 819) then
a.n1 = 3;
a.n2 = 3;
a.n3 = 0;
a.n4 = 0;
a.sl = 65;
a.el = 69;
return a;
end
end
end
else
-- print("Warning: Regime ID not found! Returning blank array.");
a.n1 = 0;
a.n2 = 0;
a.n3 = 0;
a.n4 = 0;
a.sl = 0;
a.el = 0;
return a;
end
end | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Aht_Urhgan_Whitegate/npcs/Shajaf.lua | 34 | 1031 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Shajaf
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00A2);
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 |
premake/premake-core | modules/vstudio/tests/vc2019/test_toolset_settings.lua | 3 | 2525 | --
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
-- Validate compiler settings in Visual Studio 2019 C/C++ projects.
-- Copyright (c) 2011-2020 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_vs2019_toolset_settings")
local vc2010 = p.vstudio.vc2010
local project = p.project
--
-- Setup
--
local wks, prj
function suite.setup()
p.action.set("vs2019")
wks, prj = test.createWorkspace()
end
local function prepare(platform)
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.configurationProperties(cfg)
end
---
-- Check the default project settings
---
function suite.defaultSettings()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
]]
end
---
-- Check the project settings with the clang toolset
---
function suite.toolsetClang()
toolset "clang"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup>
]]
end
--
-- If AllModulesPublic flag is set, add <AllProjectBMIsArePublic> element (supported from VS2019)
--
function suite.onAllModulesPublicOn()
allmodulespublic "On"
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.outputProperties(cfg)
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup>
]]
end
function suite.onAllModulesPublicOff()
allmodulespublic "Off"
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.outputProperties(cfg)
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<AllProjectBMIsArePublic>false</AllProjectBMIsArePublic>
</PropertyGroup>
]]
end
| bsd-3-clause |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader/[TFA][AT] Expanded Pack/lua/weapons/weapon_tfa_dc15sa501/shared.lua | 1 | 1696 |
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "DC-15 Side Arm 501st Edition"
SWEP.Author = "Servius & StrickenNZ"
SWEP.ViewModelFOV = 70
SWEP.Slot = 1
SWEP.SlotPos = 5
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DC15SA")
killicon.Add( "weapon_tfa_dc15sa501", "HUD/killicons/DC15SA", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "pistol"
SWEP.Base = "tfa_swsft_base_servius"
SWEP.Category = "TFA Star Wars: Color Force"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_5015SA.mdl"
SWEP.WorldModel = "models/weapons/w_5015SA.mdl"
SWEP.Primary.Sound = Sound ("weapons/dc15sa/DC15SA_fire.ogg");
local MaxTimer =64
local CurrentTimer =0
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 50
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.0125
SWEP.Primary.IronAccuracy = .005 -- Ironsight accuracy, should be the same for shotguns
SWEP.Primary.ClipSize = 8
SWEP.Primary.RPM = 60/0.2
SWEP.Primary.DefaultClip = 8
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "battery"
SWEP.TracerName = "rw_sw_laser_blue"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector (-3.9, -6, 2.5)
SWEP.IronSightsAng = Vector (-0.3, -0.05, 0)
function SWEP:Think()
if (self.Weapon:Clip1() < self.Primary.ClipSize) and SERVER then
if (CurrentTimer <= 0) then
CurrentTimer = MaxTimer
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
else
CurrentTimer = CurrentTimer-1
end
end
end
function SWEP:Reload()
end | apache-2.0 |
RavenX8/osIROSE-new | scripts/npcs/ai/[arumic_prophet]_olleck_basilasi.lua | 2 | 1069 | registerNpc(1173, {
walk_speed = 0,
run_speed = 0,
scale = 130,
r_weapon = 0,
l_weapon = 0,
level = 10,
hp = 100,
attack = 100,
hit = 100,
def = 100,
res = 100,
avoid = 100,
attack_spd = 100,
is_magic_damage = 0,
ai_type = 0,
give_exp = 0,
drop_type = 56,
drop_money = 0,
drop_item = 0,
union_number = 0,
need_summon_count = 512,
sell_tab0 = 512,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 200,
npc_type = 999,
hit_material_type = 0,
face_icon = 28,
summon_mob_type = 28,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end | apache-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/abilities/pets/tail_whip.lua | 4 | 1227 | ---------------------------------------------------
-- Tail Whip M=5
---------------------------------------------------
require("/scripts/globals/settings");
require("/scripts/globals/status");
require("/scripts/globals/monstertpmoves");
require("/scripts/globals/summon");
---------------------------------------------------
function OnAbilityCheck(player, target, ability)
return 0,0;
end;
function OnPetAbility(target, pet, skill)
local numhits = 1;
local accmod = 1;
local dmgmod = 5;
local totaldamage = 0;
local damage = AvatarPhysicalMove(pet,target,skill,numhits,accmod,dmgmod,0,TP_NO_EFFECT,1,2,3);
totaldamage = AvatarFinalAdjustments(damage.dmg,pet,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_PIERCE,numhits);
local duration = 120;
local resm = applyPlayerResistance(pet,-1,target,pet:getStat(MOD_INT)-target:getStat(MOD_INT),ELEMENTAL_MAGIC_SKILL, 5);
if resm < 0.25 then
resm = 0;
end
duration = duration * resm
if(duration > 0 and AvatarPhysicalHit(skill, totaldamage) and target:hasStatusEffect(EFFECT_WEIGHT) == false) then
target:addStatusEffect(EFFECT_WEIGHT, 50, 0, duration);
end
target:delHP(totaldamage);
target:updateEnmityFromDamage(pet,totaldamage);
return totaldamage;
end | gpl-3.0 |
LPGhatguy/lemur | lib/functions/settings/RenderSettings.lua | 1 | 1075 | local assign = import("../../assign")
local typeKey = import("../../typeKey")
local RenderSettings = {}
setmetatable(RenderSettings, {
__tostring = function()
return "RenderSettings"
end,
})
local prototype = {}
local metatable = {}
metatable[typeKey] = "RenderSettings"
function metatable:__index(key)
local internal = getmetatable(self).internal
if internal[key] ~= nil then
return internal[key]
end
if prototype[key] ~= nil then
return prototype[key]
end
error(string.format("%s is not a valid member of RenderSettings", tostring(key)), 2)
end
function metatable:__newindex(key, value)
local internal = getmetatable(self).internal
if internal[key] ~= nil then
internal[key] = value
return
end
error(string.format("%q is not a valid member of RenderSettings", tostring(key)), 2)
end
function RenderSettings.new()
local internalInstance = {
QualityLevel = 0,
}
local instance = newproxy(true)
assign(getmetatable(instance), metatable)
getmetatable(instance).internal = internalInstance
return instance
end
return RenderSettings | mit |
RavenX8/osIROSE-new | scripts/npcs/ai/[ferrell_guild_staff]_crow.lua | 2 | 1066 | registerNpc(1004, {
walk_speed = 0,
run_speed = 0,
scale = 120,
r_weapon = 0,
l_weapon = 0,
level = 10,
hp = 100,
attack = 100,
hit = 100,
def = 100,
res = 100,
avoid = 100,
attack_spd = 100,
is_magic_damage = 0,
ai_type = 0,
give_exp = 37,
drop_type = 57,
drop_money = 0,
drop_item = 0,
union_number = 0,
need_summon_count = 0,
sell_tab0 = 0,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 200,
npc_type = 999,
hit_material_type = 0,
face_icon = 13,
summon_mob_type = 13,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end | apache-2.0 |
smbolton/libwhy | examples/sg02-fields_animation_demo.lua | 1 | 2512 | #!/usr/bin/env ylua
-- sg01-fields_demo.lua
-- A libwhy simple_graphics module demonstration program.
-- This program, written by Sean Bolton, is in the public domain:
--
-- To the extent possible under law, the author has waived all copyright
-- and related or neighboring rights to the contents of this file, as
-- described in the CC0 legalcode.
--
-- You should have received a copy of the CC0 legalcode along with this
-- work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
function try_require(module, message)
if not pcall(require, module) then
print(string.format("%s: could not require('%s'): %s", arg[0], module, message))
os.exit(1)
end
end
try_require('ygtk', "perhaps you need to run this with libwhy's ylua?")
try_require('simple_graphics', 'perhaps you need to start this in the same directory as simple_graphics.lua?')
simple_graphics = require("simple_graphics")
gtk.init()
-- local width = 280
-- local height = 192
-- local width = 800
local width = 128
-- local width = 300
local height = math.floor(width * 192 / 280)
local window = gtk.window.new()
local canvas = gtk.drawing_area.new()
canvas:set("width-request", width, "height-request", height)
window:set("title", "fields.bas")
window:add(canvas)
window:show_all()
window:signal_connect('destroy', gtk.main_quit)
window:signal_connect("delete-event", function() gtk.main_quit() return true end)
local w = 0
local function xyzzy(sg)
sg:set_color(0, 0, 0)
sg:rectangle(true, 0, 0, width, height)
w = w + math.pi / 128
local n = 3
local px = { width * 0.5, width * 0.25, width * 0.75 }
local py = { height / 3.0, height * 2.0 / 3.0, height / 2.0 }
local pc = { math.sin(w), math.sin(w * 1.2), math.sin(w * 0.7) }
local s = width / 12.0
local m = 0.33
local mc = m + (1.0 - m) * 0.5 * (math.sin(w * 0.4) + 1.0)
local yc = 0
for y0 = 0, height - 1 do
local y = (y0 * 7) % height
for x = 0, width - 1 do
local t = 0
for i = 1, n do
local zx = x - px[i]
local zy = y - py[i]
local z = zx * zx + zy * zy
t = t + pc[i] * s / math.sqrt(math.sqrt(z))
end
t = t - math.floor(t)
if t < m then
sg:set_color_hsv(mc - t, 1, 1)
sg:point(x, y)
end
end
end
sg:update()
return true -- keep calling me
end
local sg = simple_graphics.new(canvas, width, height)
g.idle_add(xyzzy, sg)
gtk.main()
sg:destroy()
| lgpl-2.1 |
AdUki/Grapedit | scripts/libs/lpeglj/lpprint.lua | 1 | 10688 | --[[
LPEGLJ
lpprint.lua
Tree, code and debug print function (only for debuging)
Copyright (C) 2013 Rostislav Sacek.
based on LPeg v0.12 - PEG pattern matching for Lua
Lua.org & PUC-Rio written by Roberto Ierusalimschy
http://www.inf.puc-rio.br/~roberto/lpeg/
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
--]]
local ffi = require"ffi"
local band, rshift, lshift = bit.band, bit.rshift, bit.lshift
ffi.cdef[[
int isprint ( int c );
]]
local RuleLR = 0x10000
local Ruleused = 0x20000
-- {======================================================
-- Printing patterns (for debugging)
-- =======================================================
local TChar = 0
local TSet = 1
local TAny = 2 -- standard PEG elements
local TTrue = 3
local TFalse = 4
local TRep = 5
local TSeq = 6
local TChoice = 7
local TNot = 8
local TAnd = 9
local TCall = 10
local TOpenCall = 11
local TRule = 12 -- sib1 is rule's pattern, sib2 is 'next' rule
local TGrammar = 13 -- sib1 is initial (and first) rule
local TBehind = 14 -- match behind
local TCapture = 15 -- regular capture
local TRunTime = 16 -- run-time capture
local IAny = 0 -- if no char, fail
local IChar = 1 -- if char != aux, fail
local ISet = 2 -- if char not in val, fail
local ITestAny = 3 -- in no char, jump to 'offset'
local ITestChar = 4 -- if char != aux, jump to 'offset'
local ITestSet = 5 -- if char not in val, jump to 'offset'
local ISpan = 6 -- read a span of chars in val
local IBehind = 7 -- walk back 'aux' characters (fail if not possible)
local IRet = 8 -- return from a rule
local IEnd = 9 -- end of pattern
local IChoice = 10 -- stack a choice; next fail will jump to 'offset'
local IJmp = 11 -- jump to 'offset'
local ICall = 12 -- call rule at 'offset'
local IOpenCall = 13 -- call rule number 'offset' (must be closed to a ICall)
local ICommit = 14 -- pop choice and jump to 'offset'
local IPartialCommit = 15 -- update top choice to current position and jump
local IBackCommit = 16 -- "fails" but jump to its own 'offset'
local IFailTwice = 17 -- pop one choice and then fail
local IFail = 18 -- go back to saved state on choice and jump to saved offset
local IGiveup = 19 -- internal use
local IFullCapture = 20 -- complete capture of last 'off' chars
local IOpenCapture = 21 -- start a capture
local ICloseCapture = 22
local ICloseRunTime = 23
local Cclose = 0
local Cposition = 1
local Cconst = 2
local Cbackref = 3
local Carg = 4
local Csimple = 5
local Ctable = 6
local Cfunction = 7
local Cquery = 8
local Cstring = 9
local Cnum = 10
local Csubst = 11
local Cfold = 12
local Cruntime = 13
local Cgroup = 14
-- number of siblings for each tree
local numsiblings = {
[TRep] = 1,
[TSeq] = 2,
[TChoice] = 2,
[TNot] = 1,
[TAnd] = 1,
[TRule] = 2,
[TGrammar] = 1,
[TBehind] = 1,
[TCapture] = 1,
[TRunTime] = 1,
}
local names = {
[IAny] = "any",
[IChar] = "char",
[ISet] = "set",
[ITestAny] = "testany",
[ITestChar] = "testchar",
[ITestSet] = "testset",
[ISpan] = "span",
[IBehind] = "behind",
[IRet] = "ret",
[IEnd] = "end",
[IChoice] = "choice",
[IJmp] = "jmp",
[ICall] = "call",
[IOpenCall] = "open_call",
[ICommit] = "commit",
[IPartialCommit] = "partial_commit",
[IBackCommit] = "back_commit",
[IFailTwice] = "failtwice",
[IFail] = "fail",
[IGiveup] = "giveup",
[IFullCapture] = "fullcapture",
[IOpenCapture] = "opencapture",
[ICloseCapture] = "closecapture",
[ICloseRunTime] = "closeruntime"
}
local function printcharset(st)
io.write("[");
local i = 0
while i <= 255 do
local first = i;
while band(st[rshift(i, 5)], lshift(1, band(i, 31))) ~= 0 and i <= 255 do
i = i + 1
end
if i - 1 == first then -- unary range?
io.write(("(%02x)"):format(first))
elseif i - 1 > first then -- non-empty range?
io.write(("(%02x-%02x)"):format(first, i - 1))
end
i = i + 1
end
io.write("]")
end
local modes = {
[Cclose] = "close",
[Cposition] = "position",
[Cconst] = "constant",
[Cbackref] = "backref",
[Carg] = "argument",
[Csimple] = "simple",
[Ctable] = "table",
[Cfunction] = "function",
[Cquery] = "query",
[Cstring] = "string",
[Cnum] = "num",
[Csubst] = "substitution",
[Cfold] = "fold",
[Cruntime] = "runtime",
[Cgroup] = "group"
}
local function printcapkind(kind)
io.write(("%s"):format(modes[kind]))
end
local function printjmp(p, index)
io.write(("-> %d"):format(index + p[index].offset))
end
local function printinst(p, index, valuetable)
local code = p[index].code
io.write(("%02d: %s "):format(index, names[code]))
if code == IChar then
io.write(("'%s'"):format(string.char(p[index].val)))
elseif code == ITestChar then
io.write(("'%s'"):format(string.char(p[index].val)))
printjmp(p, index)
elseif code == IFullCapture then
printcapkind(band(p[index].val, 0x0f));
io.write((" (size = %d) (idx = %s)"):format(band(rshift(p[index].val, 4), 0xF), tostring(valuetable[p[index].offset])))
elseif code == IOpenCapture then
printcapkind(band(p[index].val, 0x0f))
io.write((" (idx = %s)"):format(tostring(valuetable[p[index].offset])))
elseif code == ISet then
printcharset(valuetable[p[index].val]);
elseif code == ITestSet then
printcharset(valuetable[p[index].val])
printjmp(p, index);
elseif code == ISpan then
printcharset(valuetable[p[index].val]);
elseif code == IOpenCall then
io.write(("-> %d"):format(p[index].offset))
elseif code == IBehind then
io.write(("%d"):format(p[index].val))
elseif code == IJmp or code == ICall or code == ICommit or code == IChoice or
code == IPartialCommit or code == IBackCommit or code == ITestAny then
printjmp(p, index);
if (code == ICall or code == IJmp) and p[index].aux > 0 then
io.write(' ', valuetable[p[index].aux])
end
end
io.write("\n")
end
local function printpatt(p, valuetable)
for i = 0, p.size - 1 do
printinst(p.p, i, valuetable);
end
end
local function printcap(cap, index, valuetable)
printcapkind(cap[index].kind)
io.write((" (idx: %s - size: %d) -> %d\n"):format(valuetable[cap[index].idx], cap[index].siz, cap[index].s))
end
local function printcaplist(cap, limit, valuetable)
io.write(">======\n")
local index = 0
while cap[index].s and index < limit do
printcap(cap, index, valuetable)
index = index + 1
end
io.write("=======\n")
end
-- ======================================================
-- {======================================================
-- Printing trees (for debugging)
-- =======================================================
local tagnames = {
[TChar] = "char",
[TSet] = "set",
[TAny] = "any",
[TTrue] = "true",
[TFalse] = "false",
[TRep] = "rep",
[TSeq] = "seq",
[TChoice] = "choice",
[TNot] = "not",
[TAnd] = "and",
[TCall] = "call",
[TOpenCall] = "opencall",
[TRule] = "rule",
[TGrammar] = "grammar",
[TBehind] = "behind",
[TCapture] = "capture",
[TRunTime] = "run-time"
}
local function printtree(tree, ident, index, valuetable)
for i = 1, ident do
io.write(" ")
end
local tag = tree[index].tag
io.write(("%s"):format(tagnames[tag]))
if tag == TChar then
local c = tree[index].val
if ffi.C.isprint(c) then
io.write((" '%c'\n"):format(c))
else
io.write((" (%02X)\n"):format(c))
end
elseif tag == TSet then
printcharset(valuetable[tree[index].val]);
io.write("\n")
elseif tag == TOpenCall or tag == TCall then
io.write((" key: %s\n"):format(tostring(valuetable[tree[index].val])))
elseif tag == TBehind then
io.write((" %d\n"):format(tree[index].val))
printtree(tree, ident + 2, index + 1, valuetable);
elseif tag == TCapture then
io.write((" cap: %s n: %s\n"):format(modes[tree[index].cap], valuetable[tree[index].val]))
printtree(tree, ident + 2, index + 1, valuetable);
elseif tag == TRule then
local extra = bit.band(tree[index].cap, RuleLR) == RuleLR and ' left recursive' or ''
extra = extra .. (bit.band(tree[index].cap, Ruleused) ~= Ruleused and ' not used' or '')
io.write((" n: %d key: %s%s\n"):format(bit.band(tree[index].cap, 0xffff) - 1, valuetable[tree[index].val], extra))
printtree(tree, ident + 2, index + 1, valuetable);
-- do not print next rule as a sibling
elseif tag == TGrammar then
local ruleindex = index + 1
io.write((" %d\n"):format(tree[index].val)) -- number of rules
for i = 1, tree[index].val do
printtree(tree, ident + 2, ruleindex, valuetable);
ruleindex = ruleindex + tree[ruleindex].ps
end
assert(tree[ruleindex].tag == TTrue); -- sentinel
else
local sibs = numsiblings[tree[index].tag] or 0
io.write("\n")
if sibs >= 1 then
printtree(tree, ident + 2, index + 1, valuetable);
if sibs >= 2 then
printtree(tree, ident + 2, index + tree[index].ps, valuetable)
end
end
end
end
-- }====================================================== */
return {
printtree = printtree,
printpatt = printpatt,
printcaplist = printcaplist,
printinst = printinst
} | mit |
ahmedbrake/telegram-bot | bot/utils.lua | 473 | 24167 | URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require "serpent"
feedparser = require "feedparser"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
http.TIMEOUT = 10
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
end
if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id
end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end
function is_chat_msg( msg )
if msg.to.type == 'chat' then
return true
end
return false
end
function string.random(length)
local str = "";
for i = 1, length do
math.random(97, 122)
str = str..string.char(math.random(97, 122));
end
return str;
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
-- DEPRECATED
function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1")
end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers)
-- Eg: foo.var
local file_name = url:match("[^%w]+([%.%w]+)$")
-- Any delimited alphanumeric on the url
file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
-- Random name, hope content-type works
file_name = file_name or str:random(5)
local content_type = headers["content-type"]
local extension = nil
if content_type then
extension = mimetype.get_mime_extension(content_type)
end
if extension then
file_name = file_name.."."..extension
end
local disposition = headers["content-disposition"]
if disposition then
-- attachment; filename=CodeCogsEqn.png
file_name = disposition:match('filename=([^;]+)') or file_name
end
return file_name
end
-- Saves file to /tmp/. If file_name isn't provided,
-- will get the text after the last "/" for filename
-- and content-type for extension
function download_to_file(url, file_name)
print("url to download: "..url)
local respbody = {}
local options = {
url = url,
sink = ltn12.sink.table(respbody),
redirect = true
}
-- nil, code, headers, status
local response = nil
if url:starts('https') then
options.redirect = false
response = {https.request(options)}
else
response = {http.request(options)}
end
local code = response[2]
local headers = response[3]
local status = response[4]
if code ~= 200 then return nil end
file_name = file_name or get_http_file_name(url, headers)
local file_path = "/tmp/"..file_name
print("Saved to: "..file_path)
file = io.open(file_path, "w+")
file:write(table.concat(respbody))
file:close()
return file_path
end
function vardump(value)
print(serpent.block(value, {comment=false}))
end
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
i = i + 1
t[i] = filename
end
return t
end
-- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
function run_command(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
cmd:close()
return result
end
-- User has privileges
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
-- Returns the name of the sender
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
-- Returns at table of lua files inside plugins
function plugins_names( )
local files = {}
for k, v in pairs(scandir("plugins")) do
-- Ends with .lua
if (v:match(".lua$")) then
table.insert(files, v)
end
end
return files
end
-- Function name explains what it does.
function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Save into file the data serialized for lua.
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
-- Returns true if the string is empty
function string:isempty()
return self == nil or self == ''
end
-- Returns true if the string is blank
function string:isblank()
self = self:trim()
return self:isempty()
end
-- DEPRECATED!!!!!
function string.starts(String, Start)
print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start))
end
-- Returns true if String starts with Start
function string:starts(text)
return text == string.sub(self,1,string.len(text))
end
-- Send image to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_photo(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function,
cb_extra = cb_extra
}
-- Call to remove with optional callback
send_photo(receiver, file_path, cb_function, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_photo_from_url(receiver, url, cb_function, cb_extra)
-- If callback not provided
cb_function = cb_function or ok_cb
cb_extra = cb_extra or false
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, cb_function, cb_extra)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra)
end
end
-- Same as send_photo_from_url but as callback function
function send_photo_from_url_callback(cb_extra, success, result)
local receiver = cb_extra.receiver
local url = cb_extra.url
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, ok_cb, false)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, ok_cb, false)
end
end
-- Send multiple images asynchronous.
-- param urls must be a table.
function send_photos_from_url(receiver, urls)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = nil
}
send_photos_from_url_callback(cb_extra)
end
-- Use send_photos_from_url.
-- This function might be difficult to understand.
function send_photos_from_url_callback(cb_extra, success, result)
-- cb_extra is a table containing receiver, urls and remove_path
local receiver = cb_extra.receiver
local urls = cb_extra.urls
local remove_path = cb_extra.remove_path
-- The previously image to remove
if remove_path ~= nil then
os.remove(remove_path)
print("Deleted: "..remove_path)
end
-- Nil or empty, exit case (no more urls)
if urls == nil or #urls == 0 then
return false
end
-- Take the head and remove from urls table
local head = table.remove(urls, 1)
local file_path = download_to_file(head, false)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = file_path
}
-- Send first and postpone the others as callback
send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
end
-- Callback to remove a file
function rmtmp_cb(cb_extra, success, result)
local file_path = cb_extra.file_path
local cb_function = cb_extra.cb_function or ok_cb
local cb_extra = cb_extra.cb_extra
if file_path ~= nil then
os.remove(file_path)
print("Deleted: "..file_path)
end
-- Finally call the callback
cb_function(cb_extra, success, result)
end
-- Send document to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_document(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function or ok_cb,
cb_extra = cb_extra or false
}
-- Call to remove with optional callback
send_document(receiver, file_path, rmtmp_cb, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false)
print("File path: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra)
end
-- Parameters in ?a=1&b=2 style
function format_http_params(params, is_get)
local str = ''
-- If is get add ? to the beginning
if is_get then str = '?' end
local first = true -- Frist param
for k,v in pairs (params) do
if v then -- nil value
if first then
first = false
str = str..k.. "="..v
else
str = str.."&"..k.. "="..v
end
end
end
return str
end
-- Check if user can use the plugin and warns user
-- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user'
local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false)
return true
else
return false
end
end
-- Check if user can use the plugin
function user_allowed(plugin, msg)
if plugin.privileged and not is_sudo(msg) then
return false
end
return true
end
function send_order_msg(destination, msgs)
local cb_extra = {
destination = destination,
msgs = msgs
}
send_order_msg_callback(cb_extra, true)
end
function send_order_msg_callback(cb_extra, success, result)
local destination = cb_extra.destination
local msgs = cb_extra.msgs
local file_path = cb_extra.file_path
if file_path ~= nil then
os.remove(file_path)
print("Deleted: " .. file_path)
end
if type(msgs) == 'string' then
send_large_msg(destination, msgs)
elseif type(msgs) ~= 'table' then
return
end
if #msgs < 1 then
return
end
local msg = table.remove(msgs, 1)
local new_cb_extra = {
destination = destination,
msgs = msgs
}
if type(msg) == 'string' then
send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
elseif type(msg) == 'table' then
local typ = msg[1]
local nmsg = msg[2]
new_cb_extra.file_path = nmsg
if typ == 'document' then
send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'image' or typ == 'photo' then
send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'audio' then
send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'video' then
send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
else
send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
end
end
end
-- Same as send_large_msg_callback but friendly params
function send_large_msg(destination, text)
local cb_extra = {
destination = destination,
text = text
}
send_large_msg_callback(cb_extra, true)
end
-- If text is longer than 4096 chars, send multiple msg.
-- https://core.telegram.org/method/messages.sendMessage
function send_large_msg_callback(cb_extra, success, result)
local text_max = 4096
local destination = cb_extra.destination
local text = cb_extra.text
local text_len = string.len(text)
local num_msg = math.ceil(text_len / text_max)
if num_msg <= 1 then
send_msg(destination, text, ok_cb, false)
else
local my_text = string.sub(text, 1, 4096)
local rest = string.sub(text, 4096, text_len)
local cb_extra = {
destination = destination,
text = rest
}
send_msg(destination, my_text, send_large_msg_callback, cb_extra)
end
end
-- Returns a table with matches or nil
function match_pattern(pattern, text, lower_case)
if text then
local matches = {}
if lower_case then
matches = { string.match(text:lower(), pattern) }
else
matches = { string.match(text, pattern) }
end
if next(matches) then
return matches
end
end
-- nil
end
-- Function to read data from files
function load_from_file(file, default_data)
local f = io.open(file, "r+")
-- If file doesn't exists
if f == nil then
-- Create a new empty table
default_data = default_data or {}
serialize_to_file(default_data, file)
print ('Created file', file)
else
print ('Data loaded from file', file)
f:close()
end
return loadfile (file)()
end
-- See http://stackoverflow.com/a/14899740
function unescape_html(str)
local map = {
["lt"] = "<",
["gt"] = ">",
["amp"] = "&",
["quot"] = '"',
["apos"] = "'"
}
new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
var = map[s] or n == "#" and string.char(s)
var = var or n == "#x" and string.char(tonumber(s,16))
var = var or orig
return var
end)
return new
end
--Check if this chat is realm or not
function is_realm(msg)
local var = false
local realms = 'realms'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(realms)] then
if data[tostring(realms)][tostring(msg.to.id)] then
var = true
end
return var
end
end
--Check if this chat is a group or not
function is_group(msg)
local var = false
local groups = 'groups'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(groups)] then
if data[tostring(groups)][tostring(msg.to.id)] then
var = true
end
return var
end
end
function savelog(group, logtxt)
local text = (os.date("[ %c ]=> "..logtxt.."\n \n"))
local file = io.open("./groups/logs/"..group.."log.txt", "a")
file:write(text)
file:close()
end
function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
--Check if user is the owner of that group or not
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_owner2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is admin or not
function is_admin(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_admin2(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_momod(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['moderators'] then
if data[tostring(msg.to.id)]['moderators'][tostring(user)] then
var = true
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_momod2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(group_id)] then
if data[tostring(group_id)]['moderators'] then
if data[tostring(group_id)]['moderators'][tostring(usert)] then
var = true
end
end
end
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == usert then
var = true
end
end
return var
end
-- Returns the name of the sender
function kick_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_owner2(user_id, chat_id) then -- Ignore admins
return
end
local chat = 'chat#id'..chat_id
local user = 'user#id'..user_id
chat_del_user(chat, user, ok_cb, true)
end
-- Ban
function ban_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'banned:'..chat_id
redis:sadd(hash, user_id)
-- Kick from chat
kick_user(user_id, chat_id)
end
-- Global ban
function banall_user(user_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'gbanned'
redis:sadd(hash, user_id)
end
-- Global unban
function unbanall_user(user_id)
--Save on redis
local hash = 'gbanned'
redis:srem(hash, user_id)
end
-- Check if user_id is banned in chat_id or not
function is_banned(user_id, chat_id)
--Save on redis
local hash = 'banned:'..chat_id
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Check if user_id is globally banned or not
function is_gbanned(user_id)
--Save on redis
local hash = 'gbanned'
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Returns chat_id ban list
function ban_list(chat_id)
local hash = 'banned:'..chat_id
local list = redis:smembers(hash)
local text = "Ban list !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- Returns globally ban list
function banall_list()
local hash = 'gbanned'
local list = redis:smembers(hash)
local text = "global bans !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- /id by reply
function get_message_callback_id(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
send_large_msg(chat, result.from.id)
else
return 'Use This in Your Groups'
end
end
-- kick by reply for mods and owner
function Kick_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
-- Kick by reply for admins
function Kick_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
--Ban by reply for admins
function ban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Ban by reply for admins
function ban_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Unban by reply
function unban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't unban myself"
end
send_large_msg(chat, "User "..result.from.id.." Unbanned")
-- Save on redis
local hash = 'banned:'..result.to.id
redis:srem(hash, result.from.id)
else
return 'Use This in Your Groups'
end
end
function banall_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't banall myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
local name = user_print_name(result.from)
banall_user(result.from.id)
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered")
else
return 'Use This in Your Groups'
end
end
| gpl-2.0 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader_legacy/tfa_swrp_expanded_weapons_pack/lua/weapons/tfa_swch_dc15a_woodcamo_fray/shared.lua | 1 | 2820 |
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "DC-15A Wood Camo"
SWEP.Author = "TFA"
SWEP.ViewModelFOV = 50
SWEP.Slot = 2
SWEP.SlotPos = 3
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DC15A")
killicon.Add( "weapon_752_dc15a", "HUD/killicons/DC15A", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "ar2"
SWEP.Base = "tfa_swsft_base_servius"
SWEP.Category = "TFA Fray SWEP's"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.HoldType = "ar2"
SWEP.ViewModelFOV = 56
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl"
SWEP.WorldModel = "models/weapons/w_irifle.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.UseHands = true
SWEP.ViewModelBoneMods = {
["v_weapon.awm_parent"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Clavicle"] = { scale = Vector(1, 1, 1), pos = Vector(0.338, 2.914, 0.18), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Finger0"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 1.447, 0) }
}
SWEP.Primary.Sound = Sound ("weapons/dc15a/DC15A_fire.ogg");
SWEP.Primary.ReloadSound = Sound ("weapons/shared/standard_reload.ogg");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 25
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.0125
SWEP.Primary.IronAccuracy = .005 -- Ironsight accuracy, should be the same for shotguns
SWEP.Primary.ClipSize = 50
SWEP.Primary.RPM = 60/0.175
SWEP.Primary.DefaultClip = 150
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.TracerName = "effect_sw_laser_blue"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.IronFOV = 70
SWEP.IronSightsPos = Vector(-7.401, -18.14, 2.099)
SWEP.IronSightsAng = Vector(-1.89, 0.282, 0)
SWEP.VElements = {
["element_name"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_woodcamo.mdl", bone = "v_weapon.awm_parent", rel = "", pos = Vector(-0.011, -2.924, -5.414), angle = Angle(180, 0, -89.595), size = Vector(0.95, 0.95, 0.95), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["element_name2"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_woodcamo.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.279, 0.584, -4.468), angle = Angle(0, -90, 160.731), size = Vector(0.884, 0.884, 0.884), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.BlowbackVector = Vector(0,-3,0.025)
SWEP.Blowback_Only_Iron = false
SWEP.DoProceduralReload = true
SWEP.ProceduralReloadTime = 2.5 | apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Windurst_Waters_[S]/npcs/Pelftrix.lua | 34 | 1248 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Pelftrix
-- Standard Merchant NPC
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/zones/Windurst_Waters_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,PELFTRIX_SHOP_DIALOG);
stock = {0x1014,4500, -- Hi-Potion
0x1024,28000, -- Hi-Ether
0x03FC,300, -- Sickle
0x03FD,500} -- Hatchet
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/mobskills/Trinary_Tap.lua | 10 | 2015 | ---------------------------------------------------
-- Trinary Tap
-- Attempts to absorb three buffs from a single target, or otherwise steals HP.
-- Type: Magical
-- Utsusemi/Blink absorb: Ignores Shadows
-- Range: Melee
-- Notes: Can be any (positive) buff, including food. Will drain about 100HP if it can't take any buffs
---------------------------------------------------
require("/scripts/globals/settings");
require("/scripts/globals/status");
require("/scripts/globals/monstertpmoves");
---------------------------------------------------
function OnMobSkillCheck(target,mob,skill)
if(mob:isMobType(MOBTYPE_NOTORIOUS)) then
return 0;
end
return 1;
end;
function OnMobWeaponSkill(target, mob, skill)
-- try to drain buff
local effect1 = target:stealStatusEffect();
local effect2 = target:stealStatusEffect();
local effect3 = target:stealStatusEffect();
local dmg = 0;
if(effect1 ~= nil) then
local count = 1;
-- add to myself
mob:addStatusEffect(effect1:getType(), effect1:getPower(), effect1:getTickCount(), effect1:getDuration());
if(effect2 ~= nil) then
count = count + 1;
-- add to myself
mob:addStatusEffect(effect2:getType(), effect2:getPower(), effect2:getTickCount(), effect2:getDuration());
end
if(effect3 ~= nil) then
count = count + 1;
-- add to myself
mob:addStatusEffect(effect3:getType(), effect3:getPower(), effect3:getTickCount(), effect3:getDuration());
end
-- add buff to myself
skill:setMsg(MSG_EFFECT_DRAINED);
return count;
else
-- time to drain HP. 150-300
local power = math.random(0, 151) + 150;
dmg = MobFinalAdjustments(power,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_DARK,MOBPARAM_IGNORE_SHADOWS);
target:delHP(dmg);
mob:addHP(dmg);
skill:setMsg(MSG_DRAIN_HP);
return dmg;
end
end;
| gpl-3.0 |
Sornii/pureviolence | data/spells/scripts/attack/curse.lua | 27 | 1206 | local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
local condition = createConditionObject(CONDITION_CURSED)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 1, 3000, -45)
addDamageCondition(condition, 1, 3000, -40)
addDamageCondition(condition, 1, 3000, -35)
addDamageCondition(condition, 1, 3000, -34)
addDamageCondition(condition, 2, 3000, -33)
addDamageCondition(condition, 2, 3000, -32)
addDamageCondition(condition, 2, 3000, -31)
addDamageCondition(condition, 2, 3000, -30)
addDamageCondition(condition, 3, 3000, -29)
addDamageCondition(condition, 3, 3000, -25)
addDamageCondition(condition, 3, 3000, -24)
addDamageCondition(condition, 4, 3000, -23)
addDamageCondition(condition, 4, 3000, -20)
addDamageCondition(condition, 5, 3000, -19)
addDamageCondition(condition, 5, 3000, -15)
addDamageCondition(condition, 6, 3000, -10)
addDamageCondition(condition, 10, 3000, -5)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end | gpl-2.0 |
Sonicrich05/FFXI-Server | scripts/globals/weaponskills/shattersoul.lua | 30 | 2341 | -----------------------------------
-- Skill Level: 357
-- Description: Delivers a threefold attack. Decreases target's magic defense. Duration of effect varies with TP.
-- To obtain Shattersoul, the quest Martial Mastery must be completed and it must be purchased from the Merit Points menu.
-- Target's magic defense is lowered by 10.
-- Aligned with the Shadow Gorget, Soil Gorget & Snow Gorget.
-- Aligned with the Shadow Belt, Soil Belt & Snow Belt.
-- Element: N/A
-- Skillchain Properties: Gravitation/Induration
-- Shattersoul is only available to Warriors, Monks, White Mages, Black Mages, Paladins, Bards, Dragoons, Summoners and Scholars.
-- While some jobs may obtain skill level 357 earlier than level 96, Shattersoul must be unlocked once skill reaches level 357 and job level 96 is reached.
-- Staff skill level 357 is obtainable by the following jobs at these corresponding levels:
-- Modifiers: INT:73~85%, depending on merit points upgrades.
-- Damage Multipliers by TP:
-- 100%TP 200%TP 300%TP
-- 1.375 1.375 1.375
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 3;
params.ftp100 = 1.375; params.ftp200 = 1.375; params.ftp300 = 1.375;
params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.85 + (player:getMerit(MERIT_SHATTERSOUL) / 100); params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.int_wsc = 0.7 + (player:getMerit(MERIT_SHATTERSOUL) / 100);
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
if damage > 0 and (target:hasStatusEffect(EFFECT_MAGIC_DEF_DOWN) == false) then
target:addStatusEffect(EFFECT_MAGIC_DEF_DOWN, 10, 0, 120);
end
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Phanauet_Channel/Zone.lua | 2 | 1197 | -----------------------------------
--
-- Zone: Phanauet_Channel
--
-----------------------------------
require("scripts/globals/settings");
package.loaded["scripts/zones/Phanauet_Channel/TextIDs"] = nil;
require("scripts/zones/Phanauet_Channel/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(0,-3,0,192);
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 |
Sonicrich05/FFXI-Server | scripts/zones/Metalworks/npcs/_6lg.lua | 17 | 1297 | -----------------------------------
-- Area: Metalworks
-- Door: _6lg (Cornelia's Room)
-- @pos 114 -20 -7 237
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasCompletedMission(BASTOK,ON_MY_WAY) and player:getVar("[B7-2]Cornelia") == 0) then
player:startEvent(0x026e);
else
player:messageSpecial(ITS_LOCKED);
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 == 0x026e) then
player:setVar("[B7-2]Cornelia", 1);
end
end; | gpl-3.0 |
ferisystem/TeleTard | plugins/ingroup.lua | 202 | 31524 | do
local function check_member(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'You have been promoted as the owner.')
end
end
end
local function check_member_modadd(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group is added and you have been promoted as the owner ')
end
end
end
local function automodadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member,{receiver=receiver, data=data, msg = msg})
end
end
local function check_member_modrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group has been removed')
end
end
end
local function show_group_settingsmod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local bots_protection = "Yes"
if data[tostring(msg.to.id)]['settings']['lock_bots'] then
bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots']
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection
return text
end
local function set_descriptionmod(msg, data, target, about)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function get_description(msg, data)
local data_cat = 'description'
if not data[tostring(msg.to.id)][data_cat] then
return 'No description available.'
end
local about = data[tostring(msg.to.id)][data_cat]
local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about
return 'About '..about
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'Arabic is already locked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'Arabic has been locked'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'Arabic is already unlocked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'Arabic has been unlocked'
end
end
local function lock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'yes' then
return 'Bots protection is already enabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'yes'
save_data(_config.moderation.data, data)
return 'Bots protection has been enabled'
end
end
local function unlock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'no' then
return 'Bots protection is already disabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'no'
save_data(_config.moderation.data, data)
return 'Bots protection has been disabled'
end
end
local function lock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function unlock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
local function lock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function unlock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
local function unlock_group_photomod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
local function modadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
return 'Group is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg})
end
local function modrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if not data[tostring(msg.to.id)] then
return 'Group is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg})
end
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(msg.to.id)][data_cat]
local rules = 'Chat rules:\n'..rules
return rules
end
local function set_group_photo(msg, success, result)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
chat_set_photo (receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes'
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'Photo saved!', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
local function promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is already a moderator.')
end
data[group]['moderators'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, '@'..member_username..' has been promoted.')
end
local function demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if not data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is not a moderator.')
end
data[group]['moderators'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, '@'..member_username..' has been demoted.')
end
local function username_id(cb_extra, success, result)
local mod_cmd = cb_extra.mod_cmd
local receiver = cb_extra.receiver
local member = cb_extra.member
local text = 'No user @'..member..' in this group.'
for k,v in pairs(result.members) do
vusername = v.username
if vusername == member then
member_username = member
member_id = v.id
if mod_cmd == 'promote' then
return promote(receiver, member_username, member_id)
elseif mod_cmd == 'demote' then
return demote(receiver, member_username, member_id)
end
end
end
send_large_msg(receiver, text)
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
if not data[tostring(msg.to.id)] then
return 'Group is not added.'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - @'..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function callbackres(extra, success, result)
local user = result.id
local name = string.gsub(result.print_name, "_", " ")
local chat = 'chat#id'..extra.chatid
send_large_msg(chat, user..'\n'..name)
return user
end
local function help()
local help_text = tostring(_config.help_text)
return help_text
end
local function cleanmember(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
if success == -1 then
return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.')
end
for k,v in pairs(result.members) do
kick_user(v.id, result.id)
end
end
local function run(msg, matches)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
local name_log = user_print_name(msg.from)
local group = msg.to.id
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then
load_photo(msg.id, set_group_photo, msg)
end
end
if matches[1] == 'add' then
print("group "..msg.to.print_name.."("..msg.to.id..") added")
return modadd(msg)
end
if matches[1] == 'rem' then
print("group "..msg.to.print_name.."("..msg.to.id..") removed")
return modrem(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 then
return automodadd(msg)
end
if msg.to.id and data[tostring(msg.to.id)] then
local settings = data[tostring(msg.to.id)]['settings']
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_member_lock = settings.lock_member
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then
chat_del_user(chat, user, ok_cb, true)
elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then
return nil
elseif group_member_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local receiver = 'user#id'..msg.action.user.id
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return false
end
local rules = data[tostring(msg.to.id)][data_cat]
local rules = 'Welcome to "' .. string.gsub(msg.to.print_name, '_', ' ') ..'" this group has rules that you should follow:\n'..rules
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..msg.action.user.id)
send_large_msg(receiver, rules)
end
if matches[1] == 'chat_del_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user)
end
if matches[1] == 'chat_delete_photo' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_rename' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_name_set = settings.set_name
local group_name_lock = settings.lock_name
local to_rename = 'chat#id'..msg.to.id
if group_name_lock == 'yes' then
if group_name_set ~= tostring(msg.to.print_name) then
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:incr(namehash)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
local nameprotectionredis = redis:get(namehash)
if nameprotectionredis then
if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:set(namehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
elseif group_name_lock == 'no' then
return nil
end
end
if matches[1] == 'setname' and is_momod(msg) then
local new_name = string.gsub(matches[2], '_', ' ')
data[tostring(msg.to.id)]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(msg.to.id)]['settings']['set_name']
local to_rename = 'chat#id'..msg.to.id
rename_chat(to_rename, group_name_set, ok_cb, false)
savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]")
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
return 'Please send me new group photo now'
end
if matches[1] == 'promote' and matches[2] then
if not is_owner(msg) then
return "Only owner can promote"
end
local member = string.gsub(matches[2], "@", "")
local mod_cmd = 'promote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member)
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
if matches[1] == 'demote' and matches[2] then
if not is_owner(msg) then
return "Only owner can demote"
end
if string.gsub(matches[2], "@", "") == msg.from.username then
return "You can't demote yourself"
end
local member = string.gsub(matches[2], "@", "")
local mod_cmd = 'demote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member)
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
if matches[1] == 'modlist' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
end
if matches[1] == 'about' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description")
return get_description(msg, data)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'set' then
if matches[2] == 'rules' then
rules = matches[3]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]")
return set_rulesmod(msg, data, target)
end
if matches[2] == 'about' then
local data = load_data(_config.moderation.data)
local target = msg.to.id
local about = matches[3]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]")
return set_descriptionmod(msg, data, target, about)
end
end
if matches[1] == 'lock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_floodmod(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ")
return lock_group_bots(msg, data, target)
end
end
if matches[1] == 'unlock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ")
return unlock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
if matches[2] == 'photo' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ")
return unlock_group_photomod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ")
return unlock_group_floodmod(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked arabic ")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ")
return unlock_group_bots(msg, data, target)
end
end
if matches[1] == 'settings' then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ")
return show_group_settingsmod(msg, data, target)
end
if matches[1] == 'newlink' then
if not is_momod(msg) then
return "For moderators only!"
end
local function callback (extra , success, result)
local receiver = 'chat#'..msg.to.id
if success == 0 then
return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.')
end
send_large_msg(receiver, "Created a new link")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
local receiver = 'chat#'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] revoked group link ")
return export_chat_link(receiver, callback, true)
end
if matches[1] == 'link' then
if not is_momod(msg) then
return "For moderators only!"
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first !"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
if matches[1] == 'setowner' then
if not is_owner(msg) then
return "For owner only!"
end
data[tostring(msg.to.id)]['set_owner'] = matches[2]
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = matches[2].." added as owner"
return text
end
if matches[1] == 'owner' then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
return "no owner,ask admins in support groups to set owner for your group"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
return "Group owner is ["..group_owner..']'
end
if matches[1] == 'setgpowner' then
local receiver = "chat#id"..matches[2]
if not is_admin(msg) then
return "For admins only!"
end
data[tostring(matches[2])]['set_owner'] = matches[3]
save_data(_config.moderation.data, data)
local text = matches[3].." added as owner"
send_large_msg(receiver, text)
return
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return "For moderators only!"
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
return 'Group flood has been set to '..matches[2]
end
if matches[1] == 'clean' then
if not is_owner(msg) then
return "Only owner can clean"
end
if matches[2] == 'member' then
if not is_owner(msg) then
return "Only admins can clean members"
end
local receiver = get_receiver(msg)
chat_info(receiver, cleanmember, {receiver=receiver})
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
end
if matches[2] == 'rules' then
local data_cat = 'rules'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
end
if matches[2] == 'about' then
local data_cat = 'description'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
end
end
if matches[1] == 'help' then
if not is_momod(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help")
return help()
end
if matches[1] == 'res' and is_momod(msg) then
local cbres_extra = {
chatid = msg.to.id
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username)
return res_user(username, callbackres, cbres_extra)
end
end
end
return {
patterns = {
"^[!/](add)$",
"^[!/](rem)$",
"^[!/](rules)$",
"^[!/](about)$",
"^[!/](setname) (.*)$",
"^[!/](setphoto)$",
"^[!/](promote) (.*)$",
"^[!/](help)$",
"^[!/](clean) (.*)$",
"^[!/](demote) (.*)$",
"^[!/](set) ([^%s]+) (.*)$",
"^[!/](lock) (.*)$",
"^[!/](setowner) (%d+)$",
"^[!/](owner)$",
"^[!/](res) (.*)$",
"^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^[!/](unlock) (.*)$",
"^[!/](setflood) (%d+)$",
"^[!/](settings)$",
"^[!/](modlist)$",
"^[!/](newlink)$",
"^[!/](link)$",
"%[(photo)%]",
"^!!tgservice (.+)$",
},
run = run
}
end
| gpl-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Windurst_Waters_[S]/npcs/Mindala-Andola_CC.lua | 4 | 1060 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Mindala-Andola, C.C.
-- Type: Sigil
-- @zone: 94
-- @pos: -31.869 -6.009 226.793
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x000d, npc);
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 |
cwarden/mysql-proxy | tests/suite/run-tests.lua | 1 | 14975 | --[[ $%BEGINLICENSE%$
Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
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; version 2 of the
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
$%ENDLICENSE%$ --]]
-- vim:sw=4:noexpandtab
---
-- a lua baed test-runner for the mysql-proxy
--
-- to stay portable it is written in lua
--
-- we require LFS (LuaFileSystem)
require("lfs")
require("glib2")
require("posix")
local fileutils = require("testenv.fileutils")
local shellutils = require("testenv.shellutils")
local testutils = require("testenv.testutils")
local process = require("testenv.process")
local processmanager = require("testenv.processmanager")
--
-- a set of user variables which can be overwritten from the environment
--
TestRunner = {
num_tests = 0,
num_passes = 0,
num_skipped = 0,
num_fails = 0,
failed_test = {},
tests = {},
testenv = {
},
force_on_error = true,
tests_to_skip_filename = "tests_to_skip.lua",
tests_regex = os.getenv("TESTS_REGEX")
}
function TestRunner:new(o)
-- create a new process object
--
o = o or {}
setmetatable(o, self)
self.__index = self
local port_base = testutils.get_port_base(os.getenv("MYSQL_PROXY_START_PORT"), os.getenv("MYSQL_PROXY_END_PORT"))
local lua_module_suffix = os.getenv("DYNLIB_LUA_SUFFIX") or "so"
self.testenv.testdir = fileutils.dirname(arg[0])
self.testenv.srcdir = os.getenv("srcdir") or self.testenv.testdir .. "/"
self.testenv.top_builddir = os.getenv("top_builddir") or self.testenv.testdir .. "/../"
self.testenv.builddir = os.getenv("builddir") or self.testenv.testdir .. "/" -- same as srcdir by default
self.testenv.plugin_dir = self.testenv.top_builddir .. "/plugins/"
self.testenv.basedir = lfs.currentdir()
self.testenv.lua_path = self.testenv.basedir .. "/" .. self.testenv.srcdir .. "/../../lib/?.lua"
self.testenv.lua_cpath = self.testenv.basedir .. "/../../lib/.libs/?." .. lua_module_suffix
self.testenv.PROXY_HOST = os.getenv("PROXY_HOST") or "127.0.0.1"
self.testenv.PROXY_PORT = os.getenv("PROXY_PORT") or tostring(port_base + 0)
self.testenv.MYSQL_TEST_BIN = os.getenv("MYSQL_TEST_BIN") or "mysqltest"
self.testenv.MYSQL_CLIENT_BIN = os.getenv("MYSQL_CLIENT_BIN") or "mysql"
self.testenv.PROXY_CHAIN_PORT = os.getenv("PROXY_CHAIN_PORT") or tostring(port_base + 30)
self.testenv.abs_srcdir = os.getenv("abs_srcdir")
if not self.testenv.abs_srcdir then
if not fileutils.path_is_absolute(self.testenv.srcdir) then
local abs_srcdir = posix.getcwd() .. "/" .. self.testenv.srcdir
self.testenv.abs_srcdir = abs_srcdir
else
self.testenv.abs_srcdir = self.testenv.srcdir
end
glib2.setenv("abs_srcdir", self.testenv.abs_srcdir) -- expose the abs_srcdir again as we run the proxy as --daemon which chdir()s to /
end
return o
end
function TestRunner:register_tests(suites)
for i, suite in ipairs(suites) do
local suite_srcdir = self.testenv.srcdir .. '/' .. suite
local suite_skipfile = suite_srcdir .. '/' .. self.tests_to_skip_filename
local stat = assert(lfs.attributes(suite_srcdir))
-- if it is a directory, execute all of them
if stat.mode == "directory" then
if fileutils.file_exists(suite_skipfile) then
assert(loadfile(suite_skipfile))()
end
for file in lfs.dir(suite_srcdir .. "/t/") do
local testname = file:match("(.+)\.test$")
if testname then
local is_skipped = false
if (self.tests_regex and not testname:match(self.tests_regex)) or tests_to_skip[testname] then
is_skipped = true
end
local test = MySQLProxyTest:new()
test.testname = testname
test.suite_srcdir = suite_srcdir
test.testenv = self.testenv
test.skipped = is_skipped
self.tests[#self.tests + 1] = test
end
end
end
end
end
function TestRunner:run_all()
local exitcode = 0
for i, test in ipairs(self.tests) do
shellutils.print_verbose("# >> " .. test.testname .. " started")
self.num_tests = self.num_tests + 1
local r = test:run()
if (r == 0) then
self.num_passes = self.num_passes + 1
elseif (r == 77) then
self.num_skipped = self.num_skipped + 1
else
self.num_fails = self.num_fails + 1
table.insert(self.failed_test, test)
end
shellutils.print_verbose("# << (exitcode = " .. r .. ")" )
if r ~= 0 and r ~= 77 and exitcode == 0 then
exitcode = r
end
if self.num_fails > 0 and (not self.force_on_error) then
break
end
end
if self.num_fails > 0 then
print ("*** ERRORS OCCURRED - The following tests failed")
for i, test in pairs(self.failed_test) do
print(test.testname)
end
end
--
-- prints test suite statistics
shellutils.print_verbose (string.format('tests: %d - skipped: %d (%4.1f%%) - passed: %d (%4.1f%%) - failed: %d (%4.1f%%)',
self.num_tests,
self.num_skipped,
self.num_skipped / self.num_tests * 100,
self.num_passes,
self.num_passes / (self.num_tests - self.num_skipped) * 100,
self.num_fails,
self.num_fails / (self.num_tests - self.num_skipped) * 100))
return exitcode
end
local VERBOSE = os.getenv('TEST_VERBOSE') or
os.getenv('VERBOSE') or
os.getenv('DEBUG') or 0
VERBOSE = VERBOSE + 0
local FORCE_ON_ERROR = os.getenv('FORCE_ON_ERROR') or os.getenv('FORCE')
local MYSQL_USER = os.getenv("MYSQL_USER") or "root"
local MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD") or ""
local MYSQL_HOST = os.getenv("MYSQL_HOST") or "127.0.0.1"
local MYSQL_PORT = os.getenv("MYSQL_PORT") or "3306"
local MYSQL_DB = os.getenv("MYSQL_DB") or "test"
--
-- end of user-vars
--
-- options for the MySQL Proxy
MySQLProxy = {
}
function MySQLProxy:new(o)
-- create a new process object
o = o or {}
setmetatable(o, self)
self.__index = self
self.backends = { }
return o
end
function MySQLProxy:add_backend(addr)
self.backends[#self.backends + 1] = addr
end
function MySQLProxy:get_args(opts)
-- add a default backend
if #self.backends == 0 then
self:add_backend(("%s:%d"):format(MYSQL_HOST, MYSQL_PORT))
end
opts = opts or { }
opts["plugin-dir"] = self.testenv["plugin_dir"]
opts["basedir"] = self.testenv["basedir"]
opts["pid-file"] = opts["pid-file"] or ("%s/mysql-proxy.pid"):format(self.testenv.basedir)
opts["plugins"] = "proxy"
opts["proxy-address"]= opts["proxy-address"] or ("%s:%d"):format(self.testenv.PROXY_HOST, self.testenv.PROXY_PORT)
self.proxy_address = opts["proxy-address"]
opts["daemon"] = true
opts["lua-path"] = self.testenv.lua_path
opts["lua-cpath"] = self.testenv.lua_cpath
opts["log-file"] = opts["log-file"] or ("%s/mysql-proxy.log"):format(self.testenv.basedir)
opts["proxy-backend-addresses"] = self.backends
return opts
end
function MySQLProxy:get_env()
return {}
end
function MySQLProxy:get_command()
return os.getenv("PROXY_BINPATH") or self.testenv.top_builddir .. "/src/mysql-proxy"
end
---
-- the backend
MockBackend = MySQLProxy:new()
function MockBackend:chain_with_frontend(frontend)
frontend:add_backend(self.proxy_address)
end
Test = {
}
function Test:new(o)
-- create a new process object
--
o = o or {}
setmetatable(o, self)
self.__index = self
self.skipped = false
self.testname = nil
return o
end
---
-- @return true[, msg] if test should be skipped, false otherwise
function Test:is_skipped()
return self.skipped
end
function Test:setup()
return true
end
function Test:teardown()
return true
end
function Test:run()
local is_skipped, skip_msg = self:is_skipped()
if is_skipped then
print(('skip %s %s'):format(
self.testname,
skip_msg or 'no reason given'))
return 77
end
self.procs = processmanager:new()
local ret, errmsg = self:setup()
if not ret then
print(("err %s # setup failed: %s"):format(
self.testname,
errmsg))
ret = -1
else
ret = self:run_test()
self:teardown()
end
self.procs:shutdown_all() -- shutdown all the processes we started
return ret
end
---
-- a Test baseclass that knows about
-- * mysqltest as test-driver
-- * starting MySQL Proxies before starting mysqltest
--
-- inherited from Test
MySQLProxyTest = Test:new({})
---
-- 'test_self' is a hack to pass down the object we test right now to chain_proxy().
--
-- It is set in MySQLProxyTest:setup()
test_self = nil
---
-- setup the backend proxies and wire them together
--
-- depends on 'test_self' being a set to the currently running Test-object
function chain_proxy(backend_filenames, script_filename)
local self = test_self
if type(backend_filenames) ~= "table" then
backend_filenames = { backend_filenames }
end
local backends = { }
for backend_ndx, backend_filename in ipairs(backend_filenames) do
local mock = MockBackend:new()
mock.testenv = self.testenv
local port = tonumber(self.testenv.PROXY_CHAIN_PORT) + backend_ndx - 1 -- we start with 1
local mock_args = mock:get_args({
["proxy-lua-script"] = ("%s/t/%s"):format(self.suite_srcdir, backend_filename),
["proxy-address"] = ("%s:%d"):format(self.testenv.PROXY_HOST, port),
["pid-file"] = ("%s/chain-%d.pid"):format(self.testenv.basedir, backend_ndx),
["log-file"] = ("%s/chain-%d.log"):format(self.testenv.basedir, backend_ndx),
})
if mock_args["log-file"] then
-- truncate the file
fileutils.create_empty_file(mock_args["log-file"])
self.log_files[#self.log_files + 1] = mock_args["log-file"]
end
local proc = process:new()
local ret = proc:execute(mock:get_command(),
mock:get_env(),
mock_args)
if ret ~= 0 then
return false, ""
end
if mock_args["pid-file"] then
local is_running, errmsg = proc:wait_running(mock_args["pid-file"])
if not is_running then
return false, errmsg or "not running"
end
end
self.procs:add(proc)
table.insert(backends, mock)
end
-- all the backends are up, start the middle proxy
script_filename = ("%s/t/%s"):format(self.suite_srcdir, script_filename)
local proxy = MySQLProxy:new()
proxy.testenv = self.testenv
for _, backend in ipairs(backends) do
backend:chain_with_frontend(proxy)
end
local proxy_args = proxy:get_args({
["proxy-lua-script"] = script_filename,
})
if proxy_args["log-file"] then
-- truncate the file
fileutils.create_empty_file(proxy_args["log-file"])
self.log_files[#self.log_files + 1] = proxy_args["log-file"]
end
local proc = process:new()
local ret = proc:execute(proxy:get_command(),
proxy:get_env(),
proxy_args)
if ret ~= 0 then
return false, ""
end
if proxy_args["pid-file"] then
local is_running, errmsg = proc:wait_running(proxy_args["pid-file"])
if not is_running then
return false, errmsg or "not running"
end
end
self.procs:add(proc)
end
function MySQLProxyTest:start_proxy(script_filename)
local proxy = MySQLProxy:new()
proxy.testenv = self.testenv
local proxy_args = proxy:get_args({
["proxy-lua-script"] = script_filename,
})
if proxy_args["log-file"] then
-- truncate the file
fileutils.create_empty_file(proxy_args["log-file"])
self.log_files[#self.log_files + 1] = proxy_args["log-file"]
end
local proc = process:new()
local ret = proc:execute(proxy:get_command(),
proxy:get_env(),
proxy_args)
if ret ~= 0 then
return false, ""
end
if proxy_args["pid-file"] then
local is_running, errmsg = proc:wait_running(proxy_args["pid-file"])
if not is_running then
return false, errmsg or "not running"
end
end
self.procs:add(proc)
end
function MySQLProxyTest:setup()
local script_filename = ("%s/t/%s.lua"):format(self.suite_srcdir, self.testname)
local options_filename = ("%s/t/%s.options"):format(self.suite_srcdir, self.testname)
local has_script_file = fileutils.file_exists(script_filename)
local has_options_file = fileutils.file_exists(options_filename)
self.log_files = {}
-- if we have a options file, run it as part of the setup phases
-- if not, assume that we want to start a proxy with the script_filename
if has_options_file then
-- load the options file
test_self = self -- expose 'self' so that chain_proxy() can use it
local setup_func, errmsg = loadfile(options_filename)
if not setup_func then
return false, errmsg
end
-- try to call the setup func
local ret, errmsg = pcall(setup_func)
if not ret then
return false, errmsg
end
else
self:start_proxy(script_filename)
end
return true
end
function MySQLProxyTest:run_test()
local result = 0
local proc = process:new()
local ret
local is_success, ret = pcall(proc.popen, proc,
self.testenv.MYSQL_TEST_BIN,
{
['MYSQL_USER'] = self.testenv.MYSQL_USER,
['MYSQL_PASSWORD'] = self.testenv.MYSQL_PASSWORD,
['PROXY_HOST'] = self.testenv.PROXY_HOST,
['PROXY_PORT'] = self.testenv.PROXY_PORT,
['PROXY_CHAIN_PORT'] = self.testenv.PROXY_CHAIN_PORT,
['MASTER_PORT'] = self.testenv.PROXY_MASTER_PORT,
['SLAVE_PORT'] = self.testenv.PROXY_SLAVE_PORT,
},
{
user = self.testenv.MYSQL_USER,
password = self.testenv.MYSQL_PASSWORD,
database = self.testenv.MYSQL_DB,
host = self.testenv.PROXY_HOST,
port = self.testenv.PROXY_PORT,
verbose = (VERBOSE > 0) and "TRUE" or "FALSE", -- pass down the verbose setting
["test-file"] = self.suite_srcdir .. "/t/" .. self.testname .. ".test",
["result-file"] = self.suite_srcdir .. "/r/" .. self.testname .. ".result",
["logdir"] = self.suite_builddir, -- the .result dir might not be writable
})
if not is_success then
print(("not ok # %s - %s"):format(self.testname, ret))
return -1
end
if (ret == "ok") then
print(("ok # %s"):format(self.testname))
return 0
elseif (ret == "not ok") then
print(("not ok # %s"):format(self.testname))
return -1
else
print(("not ok # (%s) %s"):format(ret, self.testname))
return -1
end
end
function MySQLProxyTest:teardown()
-- if we have a log-file written, paste it now
print("### dumping logs")
for ndx, log_file in ipairs(self.log_files) do
local f = io.open(log_file)
-- prefix all lines with # to make the compatible with the test-output
print("## " .. log_file)
for line in f:lines() do
print("# " .. line)
end
f:close()
end
end
local runner = TestRunner:new()
runner:register_tests({"base"})
local exitcode = runner:run_all()
if exitcode == 0 then
os.exit(0)
else
shellutils.print_verbose("mysql-test exit-code: " .. exitcode)
os.exit(-1)
end
| gpl-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Port_San_dOria/npcs/Fontoumant.lua | 2 | 4216 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Fontoumant
-- Starts Quest: The Brugaire Consortium
-- Involved in Quests: Riding on the Clouds
-- @zone 232
-- @pos -10 -10 -122
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local count = trade:getItemCount();
if(player:getQuestStatus(SANDORIA,THE_BRUGAIRE_CONSORTIUM) == QUEST_ACCEPTED) then
if(count == 1 and trade:getGil() == 100) then -- pay to replace package
local prog = player:getVar("TheBrugaireConsortium-Parcels");
if(prog == 10 and player:hasItem(593) == false)then
player:startEvent(0x0260);
player:setVar("TheBrugaireConsortium-Parcels",11)
elseif(prog == 20 and player:hasItem(594) == false) then
player:startEvent(0x0261);
player:setVar("TheBrugaireConsortium-Parcels",21)
elseif(prog == 30 and player:hasItem(595) == false) then
player:startEvent(0x0262);
player:setVar("TheBrugaireConsortium-Parcels",31)
end
end
end
if(player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then
if(trade:hasItemQty(532,1) and count == 1) then -- Trade Magicmart Flyer
player:messageSpecial(FLYER_REFUSED);
end
end
if(player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_1") == 6) then
if(trade:hasItemQty(1127,1) and count == 1) then -- Trade Kindred seal
player:setVar("ridingOnTheClouds_1",0);
player:tradeComplete();
player:addKeyItem(SCOWLING_STONE);
player:messageSpecial(KEYITEM_OBTAINED,SCOWLING_STONE);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TheBrugaireConsortium = player:getQuestStatus(SANDORIA,THE_BRUGAIRE_CONSORTIUM);
if(TheBrugaireConsortium == QUEST_AVAILABLE) then
player:startEvent(0x01fd);
elseif(TheBrugaireConsortium == QUEST_ACCEPTED) then
local prog = player:getVar("TheBrugaireConsortium-Parcels");
if(prog == 11) then
player:startEvent(0x01ff);
elseif(prog == 21) then
player:startEvent(0x0200);
elseif(prog == 31) then
player:startEvent(0x0203);
else
player:startEvent(0x0230);
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);
local freeSlots = player:getFreeSlotsCount();
if(csid == 0x01fd and option == 0) then
if(freeSlots ~= 0)then
player:addItem(593);
player:messageSpecial(ITEM_OBTAINED,593);
player:addQuest(SANDORIA,THE_BRUGAIRE_CONSORTIUM)
player:setVar("TheBrugaireConsortium-Parcels",10)
else
player:startEvent(0x0219);
end
elseif(csid == 0x01ff) then
if(freeSlots ~= 0)then
player:addItem(594);
player:messageSpecial(ITEM_OBTAINED,594);
player:setVar("TheBrugaireConsortium-Parcels",20);
else
player:startEvent(0x0219);
end
elseif(csid == 0x0200) then
if(freeSlots ~= 0)then
player:addItem(595);
player:messageSpecial(ITEM_OBTAINED,595);
player:setVar("TheBrugaireConsortium-Parcels",30);
else
player:startEvent(0x0219);
end
elseif(csid == 0x0260 or csid == 0x0261 or csid == 0x0262) then
player:tradeComplete()
elseif(csid == 0x0203) then
if(freeSlots ~= 0)then
player:addItem(0x3001);
player:messageSpecial(ITEM_OBTAINED,0x3001);
player:addTitle(COURIER_EXTRAORDINAIRE);
player:completeQuest(SANDORIA,THE_BRUGAIRE_CONSORTIUM);
player:addFame(SANDORIA,SAN_FAME*30);
player:setVar("TheBrugaireConsortium-Parcels",0);
else
player:startEvent(0x0219);
end
end
end; | gpl-3.0 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader_legacy/tfa_shared_resources/lua/effects/tfa_muzzleflash_fubar_aq/init.lua | 3 | 5052 | local function rvec(vec)
vec.x=math.Round(vec.x)
vec.y=math.Round(vec.y)
vec.z=math.Round(vec.z)
return vec
end
local blankvec = Vector(0,0,0)
local function partfunc(self)
if IsValid(self.FollowEnt) then
if self.Att then
local angpos = self.FollowEnt:GetAttachment(self.Att)
if angpos and angpos.Pos then
self:SetPos(angpos.Pos)
self:SetNextThink(CurTime())
end
end
end
end
function EFFECT:Init( data )
self.StartPacket = data:GetStart()
self.Attachment = data:GetAttachment()
local AddVel = vector_origin
if LocalPlayer then
if IsValid(LocalPlayer()) then
AddVel = LocalPlayer():GetVelocity()
end
end
if AddVel == vector_origin then
AddVel = Entity(1):GetVelocity()
end
self.Position = data:GetOrigin()
self.Forward = data:GetNormal()
self.Angle = self.Forward:Angle()
self.Right = self.Angle:Right()
local wepent = Entity(math.Round(self.StartPacket.z))
if IsValid(wepent) then
if wepent.IsFirstPerson and !wepent:IsFirstPerson() then
data:SetEntity(wepent)
self.Position = blankvec
end
end
local ownerent = player.GetByID(math.Round(self.StartPacket.x))
local serverside = false
if math.Round(self.StartPacket.y)==1 then
serverside = true
end
local ent = data:GetEntity()
if serverside then
if IsValid(ownerent) then
if LocalPlayer() == ownerent then
return
end
ent = ownerent:GetActiveWeapon()
AddVel = ownerent:GetVelocity()
end
end
if (!self.Position) or ( rvec(self.Position) == blankvec ) then
self.WeaponEnt = data:GetEntity()
self.Attachment = data:GetAttachment()
if self.WeaponEnt and IsValid(self.WeaponEnt) then
local rpos = self.WeaponEnt:GetAttachment(self.Attachment)
if rpos and rpos.Pos then
self.Position = rpos.Pos
if data:GetNormal()==vector_origin then
self.Forward = rpos.Ang:Up()
self.Angle = self.Forward:Angle()
self.Right = self.Angle:Right()
end
end
end
end
self.vOffset = self.Position
dir = self.Forward
AddVel = AddVel * 0.05
if IsValid(ent) then
dlight = DynamicLight(ent:EntIndex())
else
dlight = DynamicLight(0)
end
if (dlight) then
dlight.Pos = self.Position + dir * 1 - dir:Angle():Right()*5
dlight.r = 0
dlight.g = 109
dlight.b = 255
dlight.Brightness = 7.0
dlight.size = 128+24
dlight.DieTime = CurTime() + 0.03
end
ParticleEffectAttach("tfa_muzzle_fubar_aq",PATTACH_POINT_FOLLOW,ent,data:GetAttachment())
--[[
local emitter = ParticleEmitter( self.vOffset )
for i=0, 6 do
local particle = emitter:Add( "particles/flamelet"..math.random(1,5), self.vOffset + (dir * 1.7 * i))
if (particle) then
particle:SetVelocity((dir * 19 * i) + 1.05 * AddVel )
particle:SetLifeTime( 0 )
particle:SetDieTime( 0.1 )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.max(7 - 0.65 * i,1) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(0, 360) )
particle:SetRollDelta( math.Rand(-40, 40) )
particle:SetColor( 255 , 218 , 97 )
particle:SetLighting(false)
particle.FollowEnt = data:GetEntity()
particle.Att = self.Attachment
particle:SetThinkFunction( partfunc )
particle:SetNextThink(CurTime())
end
end
for i=0, 5 do
local particle = emitter:Add( "particles/smokey", self.vOffset + dir * math.Rand(6, 10 ))
if (particle) then
particle:SetVelocity(VectorRand() * 5 + dir * math.Rand(27,33) + 1.05 * AddVel )
particle:SetLifeTime( 0 )
particle:SetDieTime( math.Rand( 0.5, 0.5 ) )
particle:SetStartAlpha( math.Rand( 5, 15 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(8,10) )
particle:SetEndSize( math.Rand(2,5) )
particle:SetRoll( math.Rand(0, 360) )
particle:SetRollDelta( math.Rand(-0.8, 0.8) )
particle:SetAirResistance( 10 )
particle:SetGravity( Vector( 0, 0, 60 ) )
particle:SetColor( 255 , 255 , 255 )
end
end
if GetTFAGasEnabled() then
for i=0, 2 do
local particle = emitter:Add( "sprites/heatwave", self.vOffset + (dir * i) )
if (particle) then
particle:SetVelocity((dir * 25 * i) + 1.05 * AddVel )
particle:SetLifeTime( 0 )
particle:SetDieTime( math.Rand( 0.05, 0.15 ) )
particle:SetStartAlpha( math.Rand( 200, 225 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(3,5) )
particle:SetEndSize( math.Rand(8,10) )
particle:SetRoll( math.Rand(0, 360) )
particle:SetRollDelta( math.Rand(-2, 2) )
particle:SetAirResistance( 5 )
particle.FollowEnt = data:GetEntity()
particle.Att = self.Attachment
particle:SetThinkFunction( partfunc )
particle:SetGravity( Vector( 0, 0, 40 ) )
particle:SetColor( 255 , 255 , 255 )
end
end
end
emitter:Finish()
]]--
end
function EFFECT:Think( )
return false
end
function EFFECT:Render()
end
| apache-2.0 |
kyroskoh/kong | kong/plugins/request-transformer/access.lua | 17 | 3899 | local utils = require "kong.tools.utils"
local stringy = require "stringy"
local Multipart = require "multipart"
local _M = {}
local CONTENT_LENGTH = "content-length"
local FORM_URLENCODED = "application/x-www-form-urlencoded"
local MULTIPART_DATA = "multipart/form-data"
local CONTENT_TYPE = "content-type"
local function iterate_and_exec(val, cb)
if utils.table_size(val) > 0 then
for _, entry in ipairs(val) do
local parts = stringy.split(entry, ":")
cb(parts[1], utils.table_size(parts) == 2 and parts[2] or nil)
end
end
end
local function get_content_type()
local header_value = ngx.req.get_headers()[CONTENT_TYPE]
if header_value then
return stringy.strip(header_value):lower()
end
end
function _M.execute(conf)
if conf.add then
-- Add headers
if conf.add.headers then
iterate_and_exec(conf.add.headers, function(name, value)
ngx.req.set_header(name, value)
end)
end
-- Add Querystring
if conf.add.querystring then
local querystring = ngx.req.get_uri_args()
iterate_and_exec(conf.add.querystring, function(name, value)
querystring[name] = value
end)
ngx.req.set_uri_args(querystring)
end
if conf.add.form then
local content_type = get_content_type()
if content_type and stringy.startswith(content_type, FORM_URLENCODED) then
-- Call ngx.req.read_body to read the request body first
ngx.req.read_body()
local parameters = ngx.req.get_post_args()
iterate_and_exec(conf.add.form, function(name, value)
parameters[name] = value
end)
local encoded_args = ngx.encode_args(parameters)
ngx.req.set_header(CONTENT_LENGTH, string.len(encoded_args))
ngx.req.set_body_data(encoded_args)
elseif content_type and stringy.startswith(content_type, MULTIPART_DATA) then
-- Call ngx.req.read_body to read the request body first
ngx.req.read_body()
local body = ngx.req.get_body_data()
local parameters = Multipart(body and body or "", content_type)
iterate_and_exec(conf.add.form, function(name, value)
parameters:set_simple(name, value)
end)
local new_data = parameters:tostring()
ngx.req.set_header(CONTENT_LENGTH, string.len(new_data))
ngx.req.set_body_data(new_data)
end
end
end
if conf.remove then
-- Remove headers
if conf.remove.headers then
iterate_and_exec(conf.remove.headers, function(name, value)
ngx.req.clear_header(name)
end)
end
if conf.remove.querystring then
local querystring = ngx.req.get_uri_args()
iterate_and_exec(conf.remove.querystring, function(name)
querystring[name] = nil
end)
ngx.req.set_uri_args(querystring)
end
if conf.remove.form then
local content_type = get_content_type()
if content_type and stringy.startswith(content_type, FORM_URLENCODED) then
local parameters = ngx.req.get_post_args()
iterate_and_exec(conf.remove.form, function(name)
parameters[name] = nil
end)
local encoded_args = ngx.encode_args(parameters)
ngx.req.set_header(CONTENT_LENGTH, string.len(encoded_args))
ngx.req.set_body_data(encoded_args)
elseif content_type and stringy.startswith(content_type, MULTIPART_DATA) then
-- Call ngx.req.read_body to read the request body first
ngx.req.read_body()
local body = ngx.req.get_body_data()
local parameters = Multipart(body and body or "", content_type)
iterate_and_exec(conf.remove.form, function(name)
parameters:delete(name)
end)
local new_data = parameters:tostring()
ngx.req.set_header(CONTENT_LENGTH, string.len(new_data))
ngx.req.set_body_data(new_data)
end
end
end
end
return _M
| apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Nashmau/npcs/Yohj_Dukonlhy.lua | 24 | 1449 | -----------------------------------
-- Area: Nashmau
-- NPC: Yohj Dukonlhy
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Nashmau/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Nashmau/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
-- Based on scripts/zones/Mhaura/Dieh_Yamilsiah.lua
local timer = 1152 - ((os.time() - 1009810800)%1152);
local direction = 0; -- Arrive, 1 for depart
local waiting = 431; -- Offset for Nashmau
if (timer <= waiting) then
direction = 1; -- Ship arrived, switch dialog from "arrive" to "depart"
else
timer = timer - waiting; -- Ship hasn't arrived, subtract waiting time to get time to arrival
end
player:startEvent(231,timer,direction);
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 |
alit7005/haji | plugins/lock-fosh.lua | 24 | 2263 | local function pre_process(msg)
local chkfosh = redis:hget('settings:fosh',msg.chat_id_)
if not chkfosh then
redis:hset('settings:fosh',msg.chat_id_,'off')
end
end
local function run(msg, matches)
--Commands --دستورات فعال و غیرفعال کردن فحش
if matches[1]:lower() == 'unlock' then
if matches[2]:lower() == 'fosh' then
if not is_mod(msg) then return end
local fosh = redis:hget('settings:fosh',msg.chat_id_)
if fosh == 'on' then
redis:hset('settings:fosh',msg.chat_id_,'off')
return ''
elseif fosh == 'off' then
return ''
end
end
end
if matches[1]:lower() == 'lock' then
if matches[2]:lower() == 'fosh' then
if not is_mod(msg) then return end
local fosh = redis:hget('settings:fosh',msg.chat_id_)
if fosh == 'off' then
redis:hset('settings:fosh',msg.chat_id_,'on')
return ''
elseif fosh == 'on' then
return ''
end
end
end
--Delete words contains --حذف پیامهای فحش
if not is_mod(msg) then
local fosh = redis:hget('settings:fosh',msg.chat_id_)
if fosh == 'on' then
tdcli.deleteMessages(msg.chat_id_, {[0] = msg.id_}, dl_cb, nil)
end
end
end
return {
patterns = {
"(ک*س)$",
"کیر",
"کص",
"کــــــــــیر",
"کــــــــــــــــــــــــــــــیر",
"کـیـــــــــــــــــــــــــــــــــــــــــــــــــــر",
"ک×یر",
"ک÷یر",
"ک*ص",
"کــــــــــیرر",
"kir",
"kos",
"گوساله",
"gosale",
"gusale",
"جاکش",
"قرمساق",
"دیوس",
"دیوص",
"dayus",
"dayos",
"dayu3",
"10yus",
"10yu3",
"daus",
"dau3",
"تخمی",
"حرومزاده",
"حروم زاده",
"harumzade",
"haromzade",
"haroomzade",
"lashi",
"لاشی",
"لاشي",
"جنده",
"jende",
"tokhmi",
"madarjende",
"kharkosde",
"خارکسده",
"خوارکسده",
"خارکصده",
"خوارکصده",
"kharko3de",
"مادرجنده",
--Commands ##Don't change this##
"^[!/#]([Ll][Oo][Cc][Kk]) (.*)$",
"^[!/#]([Uu][Nn][Ll][Oo][Cc][Kk]) (.*)$",
------------End----------------
},
run = run,
pre_process = pre_process
}
-- http://permag.ir
-- @permag_ir
-- @permag_bots
| gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Bastok_Markets/npcs/Malene.lua | 29 | 2371 | -----------------------------------
-- Area: Bastok Markets
-- NPC: Malene
-- Type: Quest NPC
-- @zone: 235
-- @pos -173 -4 64
-----------------------------------
package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Bastok_Markets/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(550, 1) and trade:getItemCount() == 1) then -- Quest: The Cold Light of Day - Trade Steam Clock
if (player:getQuestStatus(BASTOK, THE_COLD_LIGHT_OF_DAY) ~= QUEST_AVAILABLE) then
player:startEvent(0x0068);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(BASTOK, WISH_UPON_A_STAR) == QUEST_ACCEPTED and player:getVar("WishUponAStar_Status") == 1) then -- Quest: Wish Upon a Star
player:startEvent(0x014A);
else -- Quest: The Cold Light of Day
player:startEvent(0x0066);
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 == 0x0066) then -- Quest: The Cold Light of Day
if (player:getQuestStatus(BASTOK, THE_COLD_LIGHT_OF_DAY) == QUEST_AVAILABLE) then
player:addQuest(BASTOK, THE_COLD_LIGHT_OF_DAY);
end
elseif (csid == 0x0068) then -- Quest: The Cold Light of Day - Traded Steam Clock
player:tradeComplete( );
player:addTitle(CRAB_CRUSHER);
player:addGil(GIL_RATE*500);
player:messageSpecial(GIL_OBTAINED, GIL_RATE*500);
if (TheColdLightofDay == QUEST_ACCEPTED) then
player:addFame(BASTOK, BAS_FAME * 50);
player:completeQuest(BASTOK, THE_COLD_LIGHT_OF_DAY);
else
player:addFame(BASTOK, BAS_FAME * 8);
end
elseif (csid == 0x014A) then -- Quest: Wish Upon a Star
player:setVar("WishUponAStar_Status", 2);
end
end;
| gpl-3.0 |
SnakeSVx/spacebuild | lua/entities/nature_dev_tree/init.lua | 5 | 1353 | AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')
function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self.rate = 0
end
function ENT:AcceptInput(name, activator, caller)
end
function ENT:SetRate(rate, setmodel)
--Add Various models depending on the rate!
rate = rate or 0
--
if setmodel then
self:SetModel("models/ce_ls3additional/plants/plantfull.mdl")
end
--
self.rate = rate
end
function ENT:OnTakeDamage(DmgInfo)
--Don't take damage?
end
function ENT:Think()
if self.rate > 0 and self.environment then
local left = self.environment:Convert(1, 0, self.rate)
if left > 0 then
left = self.environment:Convert(-1, 0, left)
if left > 0 and self.environment:GetO2Percentage() < 10 then
left = self.environment:Convert(2, 0, left)
if left > 0 and self.environment:GetO2Percentage() < 10 then
left = self.environment:Convert(3, 0, left)
end
end
end
end
self:NextThink(CurTime() + 1)
return true
end
function ENT:CanTool()
return false
end
function ENT:GravGunPunt()
return false
end
function ENT:GravGunPickupAllowed()
return false
end
| apache-2.0 |
DiNaSoR/Angel_Arena | game/angel_arena/scripts/vscripts/modifier/modifier_duel_rune_hill.lua | 1 | 3419 | LinkLuaModifier('modifier_duel_rune_hill_enemy', 'modifiers/modifier_duel_rune_hill.lua', LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier('modifier_rune_hill_tripledamage', 'modifiers/modifier_rune_hill_tripledamage.lua', LUA_MODIFIER_MOTION_NONE)
modifier_duel_rune_hill = class(ModifierBaseClass)
modifier_duel_rune_hill_enemy = class(ModifierBaseClass)
function modifier_duel_rune_hill_enemy:IsHidden()
return true
end
function modifier_duel_rune_hill:OnCreated()
self:StartIntervalThink(0.1)
self:SetStackCount(0)
end
--------------------------------------------------------------------------
-- aura stuff
function modifier_duel_rune_hill:IsAura()
return true
end
function modifier_duel_rune_hill:GetAuraSearchType()
return DOTA_UNIT_TARGET_HERO
end
function modifier_duel_rune_hill:GetAuraSearchTeam()
return DOTA_UNIT_TARGET_TEAM_ENEMY
end
function modifier_duel_rune_hill:GetAuraRadius()
return 800
end
function modifier_duel_rune_hill:GetModifierAura()
return "modifier_duel_rune_hill_enemy"
end
function modifier_duel_rune_hill:GetAuraEntityReject(entity)
self:SetStackCount(0)
return false
end
--------------------------------------------------------------------------
function modifier_duel_rune_hill:GetTexture()
return "fountain_heal"
end
function modifier_duel_rune_hill:DeclareFunctions()
return {
MODIFIER_EVENT_ON_TAKEDAMAGE
}
end
function modifier_duel_rune_hill:OnIntervalThink()
if self:GetCaster():HasModifier("modifier_duel_rune_hill_enemy") then
self:SetStackCount(0)
return
end
if self:GetStackCount() == 130 then
return
end
local stackCount = self:GetStackCount() + 1
if not DuelRunes or not DuelRunes.active then
stackCount = 0
end
local rewardTable = {
[30] = "modifier_rune_regen",
[80] = "modifier_rune_haste",
[90] = "modifier_rune_regen",
[100] = "modifier_rune_doubledamage",
[110] = "modifier_rune_invis",
[120] = "modifier_rune_regen",
[130] = "modifier_rune_hill_tripledamage",
}
self:SetStackCount(stackCount)
local unit = self:GetCaster()
if rewardTable[stackCount] ~= nil and self:GetCaster().AddNewModifier then
unit:AddNewModifier(self:GetCaster(), nil, rewardTable[stackCount], {
duration = 60
})
end
local particleTable = {
[1] = "particles/econ/items/tinker/boots_of_travel/teleport_end_bots_spiral_b.vpcf",
[30] = "particles/items2_fx/mekanism.vpcf",
[80] = "particles/units/heroes/hero_phantom_lancer/phantom_lancer_doppleganger_illlmove.vpcf",
[90] = "particles/items2_fx/mekanism.vpcf",
[100]= "particles/econ/items/tinker/boots_of_travel/teleport_end_bots_flare.vpcf",
[110]= "particles/econ/items/gyrocopter/hero_gyrocopter_gyrotechnics/gyro_guided_missle_explosion_smoke.vpcf",
[120]= "particles/items2_fx/mekanism.vpcf",
[130]= "particles/econ/items/tinker/boots_of_travel/teleport_end_bots_flare.vpcf",
}
if particleTable[stackCount] ~= nil and self:GetCaster() then
local part = ParticleManager:CreateParticle(particleTable[stackCount], PATTACH_ABSORIGIN_FOLLOW, unit)
ParticleManager:SetParticleControlEnt(part, 1, unit, PATTACH_ABSORIGIN_FOLLOW, "attach_origin", unit:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(part)
end
end
function modifier_duel_rune_hill:OnTakeDamage(keys)
if keys.unit ~= self:GetParent() then
return
end
self:SetStackCount(0)
end
| mit |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/items/yellow_curry_bun_+1.lua | 3 | 1867 | -----------------------------------------
-- ID: 5763
-- Item: yellow_curry_bun_+1
-- Food Effect: 30minutes, All Races
-----------------------------------------
-- Health Points 30
-- Strength 5
-- Agility 2
-- Vitality 2
-- Intelligence -2
-- Attack 23% (caps @ 80)
-- Ranged Attack 23% (caps @ 80)
-- Resist Sleep
-- Resist Stun
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,5763);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 30);
target:addMod(MOD_STR, 5);
target:addMod(MOD_AGI, 2);
target:addMod(MOD_VIT, 2);
target:addMod(MOD_INT, -2);
target:addMod(MOD_FOOD_ATTP, 23);
target:addMod(MOD_FOOD_ATT_CAP, 80);
target:addMod(MOD_FOOD_RATTP, 23);
target:addMod(MOD_FOOD_RATT_CAP, 80);
target:addMod(MOD_SLEEPRES, 5);
target:addMod(MOD_STUNRES, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 30);
target:delMod(MOD_STR, 5);
target:delMod(MOD_AGI, 2);
target:delMod(MOD_VIT, 2);
target:delMod(MOD_INT, -2);
target:delMod(MOD_FOOD_ATTP, 23);
target:delMod(MOD_FOOD_ATT_CAP, 80);
target:delMod(MOD_FOOD_RATTP, 23);
target:delMod(MOD_FOOD_RATT_CAP, 80);
target:delMod(MOD_SLEEPRES, 5);
target:delMod(MOD_STUNRES, 5);
end;
| gpl-3.0 |
DiNaSoR/Angel_Arena | game/angel_arena/scripts/vscripts/heroes/hero_invoker/invoker_retro_emp.lua | 1 | 3790 | --[[ ============================================================================================================
Author: Rook
Date: February 24, 2015
Called when EMP is cast.
Additional parameters: keys.DistanceToMove, keys.ProjectileSpeedPerSecond, keys.DelayBeforeExploding, keys.Radius
================================================================================================================= ]]
function invoker_retro_emp_on_spell_start(keys)
local caster_origin = keys.caster:GetAbsOrigin()
--Calculate where and when the EMP should end up.
local caster_forward_vector = keys.caster:GetForwardVector()
local emp_time_to_final_position = keys.DistanceToMove / keys.ProjectileSpeedPerSecond
local emp_velocity_per_frame = keys.caster:GetForwardVector() * (keys.ProjectileSpeedPerSecond * .03)
--The amount of mana to burn depends on both Wex and Quas.
local quas_ability = keys.caster:FindAbilityByName("invoker_retro_quas")
local wex_ability = keys.caster:FindAbilityByName("invoker_retro_wex")
if quas_ability ~= nil and wex_ability ~= nil then
local average_level = (quas_ability:GetLevel() + wex_ability:GetLevel()) / 2
average_level = math.floor(average_level + .5) --Round to the nearest integer.
--Ensure that the average level is in-bounds, just in case.
if average_level < 1 then
average_level = 1
end
if average_level > 8 then
average_level = 8
end
local mana_to_burn = keys.ability:GetLevelSpecialValueFor("mana_burned", average_level - 1)
--Create a dummy unit that will dictate the path of the EMP and provide sound.
local emp_dummy_unit = CreateUnitByName("npc_dota_invoker_retro_emp_unit", caster_origin + (caster_forward_vector * 100), false, nil, nil, keys.caster:GetTeam())
local emp_dummy_unit_ability = emp_dummy_unit:FindAbilityByName("dummy_unit_passive")
if emp_dummy_unit_ability ~= nil then
emp_dummy_unit_ability:SetLevel(1)
end
keys.caster:EmitSound("Hero_Invoker.EMP.Cast")
emp_dummy_unit:EmitSound("Hero_Invoker.EMP.Charge") --Emit a sound that will follow the EMP.
local emp_effect = ParticleManager:CreateParticle("particles/units/heroes/hero_invoker/invoker_emp.vpcf", PATTACH_ABSORIGIN_FOLLOW, emp_dummy_unit)
--Move the EMP dummy unit to its final position.
local endTime = GameRules:GetGameTime() + emp_time_to_final_position
Timers:CreateTimer({
callback = function()
emp_dummy_unit:SetAbsOrigin(emp_dummy_unit:GetAbsOrigin() + emp_velocity_per_frame)
if GameRules:GetGameTime() > endTime then
--Explode the EMP after it is in its final position and the delay has passed.
Timers:CreateTimer({
endTime = keys.DelayBeforeExploding,
callback = function()
ParticleManager:DestroyParticle(emp_effect, false)
local emp_explosion_effect = ParticleManager:CreateParticle("particles/units/heroes/hero_invoker/invoker_emp_explode.vpcf", PATTACH_ABSORIGIN, emp_dummy_unit)
emp_dummy_unit:EmitSound("Hero_Invoker.EMP.Discharge")
local nearby_enemy_units = FindUnitsInRadius(keys.caster:GetTeam(), emp_dummy_unit:GetAbsOrigin(), nil, keys.Radius, DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_MANA_ONLY, FIND_ANY_ORDER, false)
for i, individual_unit in ipairs(nearby_enemy_units) do
individual_unit:ReduceMana(mana_to_burn)
end
--Remove the dummy unit once the sound has stopped.
Timers:CreateTimer({
endTime = 4,
callback = function()
emp_dummy_unit:RemoveSelf() --Note that this does cause a small dust cloud to appear in the dummy unit's location.
end
})
end
})
return
else
return .03
end
end
})
end
end | mit |
Sonicrich05/FFXI-Server | scripts/globals/items/melon_pie_+1.lua | 35 | 1368 | -----------------------------------------
-- ID: 4523
-- Item: melon_pie_+1
-- Food Effect: 60Min, All Races
-----------------------------------------
-- Magic 30
-- Intelligence 5
-- Magic Regen While Healing 2
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,3600,4523);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 30);
target:addMod(MOD_INT, 5);
target:addMod(MOD_MPHEAL, 2);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 30);
target:delMod(MOD_INT, 5);
target:delMod(MOD_MPHEAL, 2);
end; | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Garlaige_Citadel/npcs/qm19.lua | 57 | 2137 | -----------------------------------
-- Area: Garlaige Citadel
-- NPC: qm19 (??? - Bomb Coal Fragments)
-- Involved in Quest: In Defiant Challenge
-- @pos -50.175 6.264 251.669 200
-----------------------------------
package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/keyitems");
require("scripts/globals/settings");
require("scripts/zones/Garlaige_Citadel/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (OldSchoolG1 == false) then
if (player:hasItem(1090) == false and player:hasKeyItem(BOMB_COAL_FRAGMENT2) == false
and player:getQuestStatus(JEUNO,IN_DEFIANT_CHALLENGE) == QUEST_ACCEPTED) then
player:addKeyItem(BOMB_COAL_FRAGMENT2);
player:messageSpecial(KEYITEM_OBTAINED,BOMB_COAL_FRAGMENT2);
end
if (player:hasKeyItem(BOMB_COAL_FRAGMENT1) and player:hasKeyItem(BOMB_COAL_FRAGMENT2) and player:hasKeyItem(BOMB_COAL_FRAGMENT3)) then
if (player:getFreeSlotsCount() >= 1) then
player:addItem(1090, 1);
player:messageSpecial(ITEM_OBTAINED, 1090);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 1090);
end
end
if (player:hasItem(1090)) then
player:delKeyItem(BOMB_COAL_FRAGMENT1);
player:delKeyItem(BOMB_COAL_FRAGMENT2);
player:delKeyItem(BOMB_COAL_FRAGMENT3);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID2: %u",csid);
-- printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Port_Bastok/npcs/Yazan.lua | 17 | 2027 | -----------------------------------
-- Area: Port Bastok
-- NPC: Yazan
-- Starts Quests: Bite the Dust (100%)
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
------------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Port_Bastok/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
BiteDust = player:getQuestStatus(BASTOK,BITE_THE_DUST);
if (BiteDust ~= QUEST_AVAILABLE and trade:hasItemQty(1015,1) and trade:getItemCount() == 1) then
player:tradeComplete();
player:startEvent(0x00c1);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
BiteDust = player:getQuestStatus(BASTOK,BITE_THE_DUST);
if (BiteDust == QUEST_AVAILABLE) then
player:startEvent(0x00bf);
elseif (BiteDust == QUEST_ACCEPTED) then
player:startEvent(0x00c0);
else
player:startEvent(0x00be);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x00bf) then
player:addQuest(BASTOK,BITE_THE_DUST);
elseif (csid == 0x00c1) then
if (player:getQuestStatus(BASTOK,BITE_THE_DUST) == QUEST_ACCEPTED) then
player:addTitle(SAND_BLASTER)
player:addFame(BASTOK,BAS_FAME*120);
player:completeQuest(BASTOK,BITE_THE_DUST);
else
player:addFame(BASTOK,BAS_FAME*80);
end
player:addGil(GIL_RATE*350);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*350);
end
end; | gpl-3.0 |
focusworld/focusrobot | bot/seedbot.lua | 1 | 9877 | package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
..';.luarocks/share/lua/5.2/?/init.lua'
package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
require("./bot/utils")
VERSION = '1.0'
-- This function is called when tg receive a msg
function on_msg_receive (msg)
if not started then
return
end
local receiver = get_receiver(msg)
print (receiver)
--vardump(msg)
msg = pre_process_service_msg(msg)
if msg_valid(msg) then
msg = pre_process_msg(msg)
if msg then
match_plugins(msg)
-- mark_read(receiver, ok_cb, false)
end
end
end
function ok_cb(extra, success, result)
end
function on_binlog_replay_end()
started = true
postpone (cron_plugins, false, 60*5.0)
_config = load_config()
-- load plugins
plugins = {}
load_plugins()
end
function msg_valid(msg)
-- Don't process outgoing messages
if msg.out then
print('\27[36mNot valid: msg from us\27[39m')
return false
end
-- Before bot was started
if msg.date < now then
print('\27[36mNot valid: old msg\27[39m')
return false
end
if msg.unread == 0 then
print('\27[36mNot valid: readed\27[39m')
return false
end
if not msg.to.id then
print('\27[36mNot valid: To id not provided\27[39m')
return false
end
if not msg.from.id then
print('\27[36mNot valid: From id not provided\27[39m')
return false
end
if msg.from.id == our_id then
print('\27[36mNot valid: Msg from our id\27[39m')
return false
end
if msg.to.type == 'encr_chat' then
print('\27[36mNot valid: Encrypted chat\27[39m')
return false
end
if msg.from.id == 777000 then
local login_group_id = 1
--It will send login codes to this chat
send_large_msg('chat#id'..login_group_id, msg.text)
end
return true
end
--
function pre_process_service_msg(msg)
if msg.service then
local action = msg.action or {type=""}
-- Double ! to discriminate of normal actions
msg.text = "!!tgservice " .. action.type
-- wipe the data to allow the bot to read service messages
if msg.out then
msg.out = false
end
if msg.from.id == our_id then
msg.from.id = 0
end
end
return msg
end
-- Apply plugin.pre_process function
function pre_process_msg(msg)
for name,plugin in pairs(plugins) do
if plugin.pre_process and msg then
print('Preprocess', name)
msg = plugin.pre_process(msg)
end
end
return msg
end
-- Go over enabled plugins patterns.
function match_plugins(msg)
for name, plugin in pairs(plugins) do
match_plugin(plugin, name, msg)
end
end
-- Check if plugin is on _config.disabled_plugin_on_chat table
local function is_plugin_disabled_on_chat(plugin_name, receiver)
local disabled_chats = _config.disabled_plugin_on_chat
-- Table exists and chat has disabled plugins
if disabled_chats and disabled_chats[receiver] then
-- Checks if plugin is disabled on this chat
for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
if disabled_plugin == plugin_name and disabled then
local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
print(warning)
send_msg(receiver, warning, ok_cb, false)
return true
end
end
end
return false
end
function match_plugin(plugin, plugin_name, msg)
local receiver = get_receiver(msg)
-- Go over patterns. If one matches it's enough.
for k, pattern in pairs(plugin.patterns) do
local matches = match_pattern(pattern, msg.text)
if matches then
print("msg matches: ", pattern)
if is_plugin_disabled_on_chat(plugin_name, receiver) then
return nil
end
-- Function exists
if plugin.run then
-- If plugin is for privileged users only
if not warns_user_not_allowed(plugin, msg) then
local result = plugin.run(msg, matches)
if result then
send_large_msg(receiver, result)
end
end
end
-- One patterns matches
return
end
end
end
-- DEPRECATED, use send_large_msg(destination, text)
function _send_msg(destination, text)
send_large_msg(destination, text)
end
-- Save the content of _config to config.lua
function save_config( )
serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua')
end
-- Returns the config from config.lua file.
-- If file doesn't exist, create it.
function load_config( )
local f = io.open('./data/config.lua', "r")
-- If config.lua doesn't exist
if not f then
print ("Created new config file: data/config.lua")
create_config()
else
f:close()
end
local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do
print("Allowed user: " .. user)
end
return config
end
-- Create a basic config.json file and saves it.
function create_config( )
-- A simple config with basic plugins and ourselves as privileged user
config = {
enabled_plugins = {
"onservice",
"inrealm",
"ingroup",
"inpm",
"banhammer",
"stats",
"anti_spam",
"owners",
"arabic_lock",
"set",
"get",
"broadcast",
"download_media",
"invite",
"all",
"leave_ban"
},
sudo_users = {157187288}(our_id)},--Sudo users
disabled_channels = {},
moderation = {data = 'data/moderation.json'},
about_text = [[Teleseed v2 - Open Source
An advance Administration bot based on yagop/telegram-bot
https://github.com/SEEDTEAM/TeleSeed
Admins
@mamaligodem [Founder]
thanks to
mamali
Our channels
@focusteam [persian]
]],
help_text_realm = [[
Realm Commands:
!creategroup [Name]
Create a group
!createrealm [Name]
Create a realm
!setname [Name]
Set realm name
!setabout [GroupID] [Text]
Set a group's about text
!setrules [GroupID] [Text]
Set a group's rules
!lock [GroupID] [setting]
Lock a group's setting
!unlock [GroupID] [setting]
Unock a group's setting
!wholist
Get a list of members in group/realm
!who
Get a file of members in group/realm
!type
Get group type
!kill chat [GroupID]
Kick all memebers and delete group
!kill realm [RealmID]
Kick all members and delete realm
!addadmin [id|username]
Promote an admin by id OR username *Sudo only
!removeadmin [id|username]
Demote an admin by id OR username *Sudo only
!list groups
Get a list of all groups
!list realms
Get a list of all realms
!log
Grt a logfile of current group or realm
!broadcast [text]
!broadcast Hello !
Send text to all groups
Only sudo users can run this command
!br [group_id] [text]
!br 123456789 Hello !
This command will send text to [group_id]
**U can use both "/" and "!"
*Only admins and sudo can add bots in group
*Only admins and sudo can use kick,ban,unban,newlink,setphoto,setname,lock,unlock,set rules,set about and settings commands
*Only admins and sudo can use res, setowner, commands
]],
help_text = [[
Commands list :
!kick [username|id]
You can also do it by reply
!ban [ username|id]
You can also do it by reply
!unban [id]
You can also do it by reply
!who
Members list
!modlist
Moderators list
!promote [username]
Promote someone
!demote [username]
Demote someone
!kickme
Will kick user
!about
Group description
!setphoto
Set and locks group photo
!setname [name]
Set group name
!rules
Group rules
!id
return group id or user id
!help
!lock [member|name|bots|leave]
Locks [member|name|bots|leaveing]
!unlock [member|name|bots|leave]
Unlocks [member|name|bots|leaving]
!set rules <text>
Set <text> as rules
!set about <text>
Set <text> as about
!settings
Returns group settings
!newlink
create/revoke your group link
!link
returns group link
!owner
returns group owner id
!setowner [id]
Will set id as owner
!setflood [value]
Set [value] as flood sensitivity
!stats
Simple message statistics
!save [value] <text>
Save <text> as [value]
!get [value]
Returns text of [value]
!clean [modlist|rules|about]
Will clear [modlist|rules|about] and set it to nil
!res [username]
returns user id
"!res @username"
!log
will return group logs
!banlist
will return group ban list
**U can use both "/" and "!"
*Only owner and mods can add bots in group
*Only moderators and owner can use kick,ban,unban,newlink,link,setphoto,setname,lock,unlock,set rules,set about and settings commands
*Only owner can use res,setowner,promote,demote and log commands
]]
}
serialize_to_file(config, './data/config.lua')
print('saved config into ./data/config.lua')
end
function on_our_id (id)
our_id = id
end
function on_user_update (user, what)
--vardump (user)
end
function on_chat_update (chat, what)
end
function on_secret_chat_update (schat, what)
--vardump (schat)
end
function on_get_difference_end ()
end
-- Enable plugins in config.json
function load_plugins()
for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v)
local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)
if not ok then
print('\27[31mError loading plugin '..v..'\27[39m')
print('\27[31m'..err..'\27[39m')
end
end
end
-- custom add
function load_data(filename)
local f = io.open(filename)
if not f then
return {}
end
local s = f:read('*all')
f:close()
local data = JSON.decode(s)
return data
end
function save_data(filename, data)
local s = JSON.encode(data)
local f = io.open(filename, 'w')
f:write(s)
f:close()
end
-- Call and postpone execution for cron plugins
function cron_plugins()
for name, plugin in pairs(plugins) do
-- Only plugins with cron function
if plugin.cron ~= nil then
plugin.cron()
end
end
-- Called again in 2 mins
postpone (cron_plugins, false, 120)
end
-- Start and load values
our_id = 0
now = os.time()
math.randomseed(now)
started = false
| gpl-2.0 |
3583Bytes/PokeBot | Emulator/Lua/socket/tp.lua | 146 | 3608 | -----------------------------------------------------------------------------
-- Unified SMTP/FTP subsystem
-- LuaSocket toolkit.
-- Author: Diego Nehab
-- RCS ID: $Id: tp.lua,v 1.22 2006/03/14 09:04:15 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = _G
local string = require("string")
local socket = require("socket")
local ltn12 = require("ltn12")
module("socket.tp")
-----------------------------------------------------------------------------
-- Program constants
-----------------------------------------------------------------------------
TIMEOUT = 60
-----------------------------------------------------------------------------
-- Implementation
-----------------------------------------------------------------------------
-- gets server reply (works for SMTP and FTP)
local function get_reply(c)
local code, current, sep
local line, err = c:receive()
local reply = line
if err then return nil, err end
code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
if not code then return nil, "invalid server reply" end
if sep == "-" then -- reply is multiline
repeat
line, err = c:receive()
if err then return nil, err end
current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
reply = reply .. "\n" .. line
-- reply ends with same code
until code == current and sep == " "
end
return code, reply
end
-- metatable for sock object
local metat = { __index = {} }
function metat.__index:check(ok)
local code, reply = get_reply(self.c)
if not code then return nil, reply end
if base.type(ok) ~= "function" then
if base.type(ok) == "table" then
for i, v in base.ipairs(ok) do
if string.find(code, v) then
return base.tonumber(code), reply
end
end
return nil, reply
else
if string.find(code, ok) then return base.tonumber(code), reply
else return nil, reply end
end
else return ok(base.tonumber(code), reply) end
end
function metat.__index:command(cmd, arg)
if arg then
return self.c:send(cmd .. " " .. arg.. "\r\n")
else
return self.c:send(cmd .. "\r\n")
end
end
function metat.__index:sink(snk, pat)
local chunk, err = c:receive(pat)
return snk(chunk, err)
end
function metat.__index:send(data)
return self.c:send(data)
end
function metat.__index:receive(pat)
return self.c:receive(pat)
end
function metat.__index:getfd()
return self.c:getfd()
end
function metat.__index:dirty()
return self.c:dirty()
end
function metat.__index:getcontrol()
return self.c
end
function metat.__index:source(source, step)
local sink = socket.sink("keep-open", self.c)
local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step)
return ret, err
end
-- closes the underlying c
function metat.__index:close()
self.c:close()
return 1
end
-- connect with server and return c object
function connect(host, port, timeout, create)
local c, e = (create or socket.tcp)()
if not c then return nil, e end
c:settimeout(timeout or TIMEOUT)
local r, e = c:connect(host, port)
if not r then
c:close()
return nil, e
end
return base.setmetatable({c = c}, metat)
end
| mit |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader/[TFA][AT] Expanded Pack/lua/weapons/tfa_swch_elg3a/shared.lua | 1 | 1347 |
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "ELG-3A"
SWEP.Author = "Syntax_Error752"
SWEP.ViewModelFOV = 70
SWEP.Slot = 1
SWEP.SlotPos = 5
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/ELG3A")
killicon.Add( "weapon_752_elg3a", "HUD/killicons/ELG3A", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "pistol"
SWEP.Base = "tfa_swsft_base"
SWEP.Category = "TFA Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_ELG3A.mdl"
SWEP.WorldModel = "models/weapons/w_ELG3A.mdl"
SWEP.Primary.Sound = Sound ("weapons/elg3a/ELG3A_fire.ogg");
SWEP.Primary.ReloadSound = Sound ("weapons/shared/standard_reload.ogg");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 50
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.0125
SWEP.Primary.ClipSize = 25
SWEP.Primary.RPM = 60/0.2
SWEP.Primary.DefaultClip = 75
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "ar2"
SWEP.TracerName = "rw_sw_laser_green"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector (-3.6, -4, 2.5)
SWEP.IronSightsAng = Vector(0.8,0.1,0)
SWEP.DoProceduralReload = true
SWEP.ProceduralReloadTime = 2 | apache-2.0 |
boundary/boundary-plugin-disk-summary | init.lua | 2 | 2977 | -- Copyright 2015 Boundary, Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
local framework = require('framework')
local Plugin = framework.Plugin
local MeterDataSource = framework.MeterDataSource
local urldecode = framework.string.urldecode
local ipack = framework.util.ipack
local trim = framework.string.trim
local params = framework.params
params.items = params.items or {}
local metric_mapping = {
['system.disk.reads.total'] = 'DISK_READS_TOTAL',
['system.disk.reads'] = 'DISK_READS',
['system.disk.read_bytes.total'] = 'DISK_READ_BYTES_TOTAL',
['system.disk.read_bytes'] = 'DISK_READ_BYTES',
['system.disk.writes.total'] = 'DISK_WRITES_TOTAL',
['system.disk.writes'] = 'DISK_WRITES',
['system.disk.write_bytes.total'] = 'DISK_WRITE_BYTES_TOTAL',
['system.disk.write_bytes'] = 'DISK_WRITE_BYTES',
['system.disk.ios'] = 'DISK_IOS',
['system.fs.use_percent'] = 'DISKUSE_SUMMARY',
['system.fs.use_percent.total'] = 'DISKUSE_SUMMARY'
}
local ds = MeterDataSource:new()
function ds:onFetch(socket)
socket:write(self:queryMetricCommand({match = "(system.disk.*|system.fs.use_percent)"}))
end
local function matchItem(item, dir, dev)
item.dir = item.dir and string.lower(trim(item.dir))
item.device = item.device and string.lower(trim(item.device))
dir = dir and string.lower(trim(dir))
dev = dev and string.lower(trim(dev))
return (item.dir == dir and item.device == dev) or (item.dir and (not item.device or item.device == "") and item.dir == dir) or ((not item.dir or item.dir == "") and item.device and item.device == dev)
end
local plugin = Plugin:new(params, ds)
function plugin:onParseValues(data)
local result = {}
for _, v in ipairs(data) do
local metric, rest = string.match(v.metric, '([^|]+)|?(.*)')
local boundary_metric = metric_mapping[metric]
if boundary_metric then
if string.find(metric, 'total') then
result[boundary_metric] = { value = v.value, timestamp = v.timestamp }
elseif rest then
local dir, dev = string.match(rest, '^dir=(.+)&dev=(.+)')
dir = urldecode(dir)
dev = urldecode(dev)
for _, item in ipairs(params.items) do
if matchItem(item, dir, dev) then
local source = self.source .. '.' .. (item.diskname or dir .. '.' .. dev)
ipack(result, boundary_metric, v.value, v.timestamp, source)
break
end
end
end
end
end
return result
end
plugin:run()
| apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Al_Zahbi/npcs/Allard.lua | 37 | 1186 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Allard
-- Standard Merchant NPC
-----------------------------------
require("scripts/globals/shop");
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
require("scripts/zones/Al_Zahbi/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,ALLARD_SHOP_DIALOG);
stock = {0x30B2,20000, --Red Cap
0x3132,32500, --Gambison
0x31B2,16900, --Bracers
0x3232,24500, --Hose
0x32B2,16000} --Socks
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 |
dani-sj/nanebot | plugins/time.lua | 771 | 2865 | -- Implement a command !time [area] which uses
-- 2 Google APIs to get the desired result:
-- 1. Geocoding to get from area to a lat/long pair
-- 2. Timezone to get the local time in that lat/long location
-- Globals
-- If you have a google api key for the geocoding/timezone api
api_key = nil
base_api = "https://maps.googleapis.com/maps/api"
dateFormat = "%A %d %B - %H:%M:%S"
-- Need the utc time for the google api
function utctime()
return os.time(os.date("!*t"))
end
-- Use the geocoding api to get the lattitude and longitude with accuracy specifier
-- CHECKME: this seems to work without a key??
function get_latlong(area)
local api = base_api .. "/geocode/json?"
local parameters = "address=".. (URL.escape(area) or "")
if api_key ~= nil then
parameters = parameters .. "&key="..api_key
end
-- Do the request
local res, code = https.request(api..parameters)
if code ~=200 then return nil end
local data = json:decode(res)
if (data.status == "ZERO_RESULTS") then
return nil
end
if (data.status == "OK") then
-- Get the data
lat = data.results[1].geometry.location.lat
lng = data.results[1].geometry.location.lng
acc = data.results[1].geometry.location_type
types= data.results[1].types
return lat,lng,acc,types
end
end
-- Use timezone api to get the time in the lat,
-- Note: this needs an API key
function get_time(lat,lng)
local api = base_api .. "/timezone/json?"
-- Get a timestamp (server time is relevant here)
local timestamp = utctime()
local parameters = "location=" ..
URL.escape(lat) .. "," ..
URL.escape(lng) ..
"×tamp="..URL.escape(timestamp)
if api_key ~=nil then
parameters = parameters .. "&key="..api_key
end
local res,code = https.request(api..parameters)
if code ~= 200 then return nil end
local data = json:decode(res)
if (data.status == "ZERO_RESULTS") then
return nil
end
if (data.status == "OK") then
-- Construct what we want
-- The local time in the location is:
-- timestamp + rawOffset + dstOffset
local localTime = timestamp + data.rawOffset + data.dstOffset
return localTime, data.timeZoneId
end
return localTime
end
function getformattedLocalTime(area)
if area == nil then
return "The time in nowhere is never"
end
lat,lng,acc = get_latlong(area)
if lat == nil and lng == nil then
return 'It seems that in "'..area..'" they do not have a concept of time.'
end
local localTime, timeZoneId = get_time(lat,lng)
return "The local time in "..timeZoneId.." is: ".. os.date(dateFormat,localTime)
end
function run(msg, matches)
return getformattedLocalTime(matches[1])
end
return {
description = "Displays the local time in an area",
usage = "!time [area]: Displays the local time in that area",
patterns = {"^!time (.*)$"},
run = run
}
| gpl-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/items/piece_of_raisin_bread.lua | 3 | 1168 | -----------------------------------------
-- ID: 4546
-- Item: piece_of_raisin_bread
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Health 20
-- Dexterity -1
-- Vitality 4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,4546);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 20);
target:addMod(MOD_DEX, -1);
target:addMod(MOD_VIT, 4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 20);
target:delMod(MOD_DEX, -1);
target:delMod(MOD_VIT, 4);
end;
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/items/serving_of_flounder_meuniere_+1.lua | 3 | 1533 | -----------------------------------------
-- ID: 4345
-- Item: serving_of_flounder_meuniere_+1
-- Food Effect: 240Min, All Races
-----------------------------------------
-- Dexterity 6
-- Vitality 1
-- Mind -1
-- Ranged ACC 15
-- Ranged ATT % 14
-- Ranged ATT Cap 30
-- Enmity -3
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,4345);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 6);
target:addMod(MOD_VIT, 1);
target:addMod(MOD_MND, -1);
target:addMod(MOD_RACC, 15);
target:addMod(MOD_FOOD_RATTP, 14);
target:addMod(MOD_FOOD_RATT_CAP, 30);
target:addMod(MOD_ENMITY, -3);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 6);
target:delMod(MOD_VIT, 1);
target:delMod(MOD_MND, -1);
target:delMod(MOD_RACC, 15);
target:delMod(MOD_FOOD_RATTP, 14);
target:delMod(MOD_FOOD_RATT_CAP, 30);
target:delMod(MOD_ENMITY, -3);
end;
| gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/zones/Misareaux_Coast/npcs/qm1.lua | 16 | 1324 | -----------------------------------
-- Area: Misareaux_Coast
-- NPC: ??? (Spawn Gration)
-- @pos 113.563 -16.302 38.912 25
-----------------------------------
package.loaded["scripts/zones/Misareaux_Coast/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Misareaux_Coast/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- Trade Hickory Shield OR Picaroon's Shield
if (GetMobAction(16879899) == 0 and (trade:hasItemQty(12370,1) or trade:hasItemQty(12359,1)) and trade:getItemCount() == 1) then
player:tradeComplete();
SpawnMob(16879899,900):updateClaim(player);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);
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 |
DiNaSoR/Angel_Arena | game/angel_arena/scripts/vscripts/modifier/imba/modifier_imba_invoke_buff.lua | 1 | 2131 | --[[ Author: Noobsauce
Date: 1.5.2017 ]]
if modifier_imba_invoke_buff == nil then
modifier_imba_invoke_buff = class({})
end
function modifier_imba_invoke_buff:OnCreated()
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.spell_amp = self:GetAbility():GetSpecialValueFor("bonus_spellpower")
self.int_buff = self.ability:GetSpecialValueFor("bonus_intellect")
self.magic_resist = self:GetAbility():GetSpecialValueFor("magic_resistance_pct")
self.cooldown_reduction = self:GetAbility():GetSpecialValueFor("cooldown_reduction_pct")
self.spell_lifesteal = self:GetAbility():GetSpecialValueFor("spell_lifesteal")
self:StartIntervalThink(1.0)
end
function modifier_imba_invoke_buff:OnIntervalThink()
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.spell_amp = self:GetAbility():GetSpecialValueFor("bonus_spellpower")
self.int_buff = self.ability:GetSpecialValueFor("bonus_intellect")
self.magic_resist = self:GetAbility():GetSpecialValueFor("magic_resistance_pct")
self.cooldown_reduction = self:GetAbility():GetSpecialValueFor("cooldown_reduction_pct")
self.spell_lifesteal = self:GetAbility():GetSpecialValueFor("spell_lifesteal")
end
function modifier_imba_invoke_buff:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS,
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS
}
return funcs
end
function modifier_imba_invoke_buff:GetModifierSpellAmplify_Percentage()
return self.spell_amp
end
function modifier_imba_invoke_buff:GetModifierMagicalResistanceBonus()
return self.magic_resist
end
function modifier_imba_invoke_buff:GetModifierBonusStats_Intellect()
return self.int_buff
end
function modifier_imba_invoke_buff:GetCustomCooldownReductionStacking()
return self.cooldown_reduction
end
function modifier_imba_invoke_buff:GetModifierSpellLifesteal()
return self.spell_lifesteal
end
function modifier_imba_invoke_buff:IsPurgable()
return false
end
function modifier_imba_invoke_buff:IsHidden()
return true
end
function modifier_imba_invoke_buff:IsPermanent()
return true
end | mit |
Sonicrich05/FFXI-Server | scripts/zones/Northern_San_dOria/npcs/Castilchat.lua | 17 | 3336 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Castilchat
-- Starts Quest: Trial Size Trial by Ice
-- @pos -186 0 107 231
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/quests");
require("scripts/globals/teleports");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
local count = trade:getItemCount();
if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED and trade:hasItemQty(532,1) and count == 1) then
player:messageSpecial(FLYER_REFUSED);
elseif (trade:hasItemQty(1545,1) and player:getQuestStatus(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE) == QUEST_ACCEPTED and player:getMainJob() == JOB_SMN and count == 1) then -- Trade mini fork of ice
player:startEvent(0x02de,0,1545,4,20);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TrialSizeByIce = player:getQuestStatus(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE);
if (player:getMainLvl() >= 20 and player:getMainJob() == JOB_SMN and TrialSizeByIce == QUEST_AVAILABLE and player:getFameLevel(SANDORIA) >= 2) then -- Requires player to be Summoner at least lvl 20
player:startEvent(0x02dd,0,1545,4,20); --mini tuning fork of ice, zone, level
elseif (TrialSizeByIce == QUEST_ACCEPTED) then
local IceFork = player:hasItem(1545);
if (IceFork) then
player:startEvent(0x02c4); --Dialogue given to remind player to be prepared
elseif (IceFork == false and tonumber(os.date("%j")) ~= player:getVar("TrialSizeIce_date")) then
player:startEvent(0x02e1,0,1545,4,20); -- Need another mini tuning fork
else
player:startEvent(0x02f6); -- Standard dialog when you loose, and you don't wait 1 real day
end
elseif (TrialSizeByIce == QUEST_COMPLETED) then
player:startEvent(0x02e0); -- Defeated Avatar
else
player:startEvent(0x02c7); -- Standard dialog
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x02dd and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1545);
else
player:setVar("TrialSizeIce_date", 0);
player:addQuest(SANDORIA,TRIAL_SIZE_TRIAL_BY_ICE);
player:addItem(1545);
player:messageSpecial(ITEM_OBTAINED,1545);
end
elseif (csid == 0x02de and option == 0 or csid == 0x02e1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1545);
else
player:addItem(1545);
player:messageSpecial(ITEM_OBTAINED,1545);
end
elseif (csid == 0x02de and option == 1) then
toCloisterOfFrost(player);
end
end; | gpl-3.0 |
FelixPe/nodemcu-firmware | app/lua53/host/tests/goto.lua | 13 | 5160 | -- $Id: goto.lua,v 1.13 2016/11/07 13:11:28 roberto Exp $
-- See Copyright Notice in file all.lua
collectgarbage()
local function errmsg (code, m)
local st, msg = load(code)
assert(not st and string.find(msg, m))
end
-- cannot see label inside block
errmsg([[ goto l1; do ::l1:: end ]], "label 'l1'")
errmsg([[ do ::l1:: end goto l1; ]], "label 'l1'")
-- repeated label
errmsg([[ ::l1:: ::l1:: ]], "label 'l1'")
-- undefined label
errmsg([[ goto l1; local aa ::l1:: ::l2:: print(3) ]], "local 'aa'")
-- jumping over variable definition
errmsg([[
do local bb, cc; goto l1; end
local aa
::l1:: print(3)
]], "local 'aa'")
-- jumping into a block
errmsg([[ do ::l1:: end goto l1 ]], "label 'l1'")
errmsg([[ goto l1 do ::l1:: end ]], "label 'l1'")
-- cannot continue a repeat-until with variables
errmsg([[
repeat
if x then goto cont end
local xuxu = 10
::cont::
until xuxu < x
]], "local 'xuxu'")
-- simple gotos
local x
do
local y = 12
goto l1
::l2:: x = x + 1; goto l3
::l1:: x = y; goto l2
end
::l3:: ::l3_1:: assert(x == 13)
-- long labels
do
local prog = [[
do
local a = 1
goto l%sa; a = a + 1
::l%sa:: a = a + 10
goto l%sb; a = a + 2
::l%sb:: a = a + 20
return a
end
]]
local label = string.rep("0123456789", 40)
prog = string.format(prog, label, label, label, label)
assert(assert(load(prog))() == 31)
end
-- goto to correct label when nested
do goto l3; ::l3:: end -- does not loop jumping to previous label 'l3'
-- ok to jump over local dec. to end of block
do
goto l1
local a = 23
x = a
::l1::;
end
while true do
goto l4
goto l1 -- ok to jump over local dec. to end of block
goto l1 -- multiple uses of same label
local x = 45
::l1:: ;;;
end
::l4:: assert(x == 13)
if print then
goto l1 -- ok to jump over local dec. to end of block
error("should not be here")
goto l2 -- ok to jump over local dec. to end of block
local x
::l1:: ; ::l2:: ;;
else end
-- to repeat a label in a different function is OK
local function foo ()
local a = {}
goto l3
::l1:: a[#a + 1] = 1; goto l2;
::l2:: a[#a + 1] = 2; goto l5;
::l3::
::l3a:: a[#a + 1] = 3; goto l1;
::l4:: a[#a + 1] = 4; goto l6;
::l5:: a[#a + 1] = 5; goto l4;
::l6:: assert(a[1] == 3 and a[2] == 1 and a[3] == 2 and
a[4] == 5 and a[5] == 4)
if not a[6] then a[6] = true; goto l3a end -- do it twice
end
::l6:: foo()
do -- bug in 5.2 -> 5.3.2
local x
::L1::
local y -- cannot join this SETNIL with previous one
assert(y == nil)
y = true
if x == nil then
x = 1
goto L1
else
x = x + 1
end
assert(x == 2 and y == true)
end
--------------------------------------------------------------------------------
-- testing closing of upvalues
local debug = require 'debug'
local function foo ()
local t = {}
do
local i = 1
local a, b, c, d
t[1] = function () return a, b, c, d end
::l1::
local b
do
local c
t[#t + 1] = function () return a, b, c, d end -- t[2], t[4], t[6]
if i > 2 then goto l2 end
do
local d
t[#t + 1] = function () return a, b, c, d end -- t[3], t[5]
i = i + 1
local a
goto l1
end
end
end
::l2:: return t
end
local a = foo()
assert(#a == 6)
-- all functions share same 'a'
for i = 2, 6 do
assert(debug.upvalueid(a[1], 1) == debug.upvalueid(a[i], 1))
end
-- 'b' and 'c' are shared among some of them
for i = 2, 6 do
-- only a[1] uses external 'b'/'b'
assert(debug.upvalueid(a[1], 2) ~= debug.upvalueid(a[i], 2))
assert(debug.upvalueid(a[1], 3) ~= debug.upvalueid(a[i], 3))
end
for i = 3, 5, 2 do
-- inner functions share 'b'/'c' with previous ones
assert(debug.upvalueid(a[i], 2) == debug.upvalueid(a[i - 1], 2))
assert(debug.upvalueid(a[i], 3) == debug.upvalueid(a[i - 1], 3))
-- but not with next ones
assert(debug.upvalueid(a[i], 2) ~= debug.upvalueid(a[i + 1], 2))
assert(debug.upvalueid(a[i], 3) ~= debug.upvalueid(a[i + 1], 3))
end
-- only external 'd' is shared
for i = 2, 6, 2 do
assert(debug.upvalueid(a[1], 4) == debug.upvalueid(a[i], 4))
end
-- internal 'd's are all different
for i = 3, 5, 2 do
for j = 1, 6 do
assert((debug.upvalueid(a[i], 4) == debug.upvalueid(a[j], 4))
== (i == j))
end
end
--------------------------------------------------------------------------------
-- testing if x goto optimizations
local function testG (a)
if a == 1 then
goto l1
error("should never be here!")
elseif a == 2 then goto l2
elseif a == 3 then goto l3
elseif a == 4 then
goto l1 -- go to inside the block
error("should never be here!")
::l1:: a = a + 1 -- must go to 'if' end
else
goto l4
::l4a:: a = a * 2; goto l4b
error("should never be here!")
::l4:: goto l4a
error("should never be here!")
::l4b::
end
do return a end
::l2:: do return "2" end
::l3:: do return "3" end
::l1:: return "1"
end
assert(testG(1) == "1")
assert(testG(2) == "2")
assert(testG(3) == "3")
assert(testG(4) == 5)
assert(testG(5) == 10)
--------------------------------------------------------------------------------
print'OK'
| mit |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Rabao/npcs/Generoit.lua | 6 | 1305 | -----------------------------------
-- Area: Rabao
-- NPC: Generoit
-- Standard Merchant NPC
-----------------------------------
require("scripts/globals/shop");
package.loaded["scripts/zones/Rabao/TextIDs"] = nil;
require("scripts/zones/Rabao/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,GENEROIT_SHOP_DIALOG);
stock = {0x11C1,61, -- Gysahl Greens
0x0348,7, -- Chocobo Feather
0x4278,10, -- Pet Food Alpha Biscuit
0x4279,81, -- Pet Food Beta Biscuit
0x45C4,81, -- Carrot Broth
0x45C6,687, -- Bug Broth
0x45C8,125, -- Herbal Broth
0x45CA,687, -- 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 |
Ding8222/skynet | lualib/skynet/mqueue.lua | 115 | 1798 | -- This is a deprecated module, use skynet.queue instead.
local skynet = require "skynet"
local c = require "skynet.core"
local mqueue = {}
local init_once
local thread_id
local message_queue = {}
skynet.register_protocol {
name = "queue",
-- please read skynet.h for magic number 8
id = 8,
pack = skynet.pack,
unpack = skynet.unpack,
dispatch = function(session, from, ...)
table.insert(message_queue, {session = session, addr = from, ... })
if thread_id then
skynet.wakeup(thread_id)
thread_id = nil
end
end
}
local function do_func(f, msg)
return pcall(f, table.unpack(msg))
end
local function message_dispatch(f)
while true do
if #message_queue==0 then
thread_id = coroutine.running()
skynet.wait()
else
local msg = table.remove(message_queue,1)
local session = msg.session
if session == 0 then
local ok, msg = do_func(f, msg)
if ok then
if msg then
skynet.fork(message_dispatch,f)
error(string.format("[:%x] send a message to [:%x] return something", msg.addr, skynet.self()))
end
else
skynet.fork(message_dispatch,f)
error(string.format("[:%x] send a message to [:%x] throw an error : %s", msg.addr, skynet.self(),msg))
end
else
local data, size = skynet.pack(do_func(f,msg))
-- 1 means response
c.send(msg.addr, 1, session, data, size)
end
end
end
end
function mqueue.register(f)
assert(init_once == nil)
init_once = true
skynet.fork(message_dispatch,f)
end
local function catch(succ, ...)
if succ then
return ...
else
error(...)
end
end
function mqueue.call(addr, ...)
return catch(skynet.call(addr, "queue", ...))
end
function mqueue.send(addr, ...)
return skynet.send(addr, "queue", ...)
end
function mqueue.size()
return #message_queue
end
return mqueue
| mit |
uuuuuuBoT/uuuuuuBoT | plugins/ar-azan.lua | 8 | 3853 | --[[
▀▄ ▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀
▀▄ ▄▀ ▀▄ ▄▀
▀▄ ▄▀ BY(@AHMED_ALOBIDE) ▀▄ ▄▀
▀▄ ▄▀ BY(@hussian_9) ▀▄ ▄▀
▀▄ ▄▀ ▀▄ ▄▀
▀▄ ▄▀ (ملف الاذان واوقات الصلاة) ▀▄ ▄▀
▀▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀
--]]
do
function run_bash(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
return result
end
local api_key = nil
local base_api = "https://maps.googleapis.com/maps/api"
function get_latlong(area)
local api = base_api .. "/geocode/json?"
local parameters = "address=".. (URL.escape(area) or "")
if api_key ~= nil then
parameters = parameters .. "&key="..api_key
end
local res, code = https.request(api..parameters)
if code ~=200 then return nil end
local data = json:decode(res)
if (data.status == "ZERO_RESULTS") then
return nil
end
if (data.status == "OK") then
lat = data.results[1].geometry.location.lat
lng = data.results[1].geometry.location.lng
acc = data.results[1].geometry.location_type
types= data.results[1].types
return lat,lng,acc,types
end
end
function get_staticmap(area)
local api = base_api .. "/staticmap?"
local lat,lng,acc,types = get_latlong(area)
local scale = types[1]
if scale=="locality" then zoom=8
elseif scale=="country" then zoom=4
else zoom = 13 end
local parameters =
"size=600x300" ..
"&zoom=" .. zoom ..
"¢er=" .. URL.escape(area) ..
"&markers=color:red"..URL.escape("|"..area)
if api_key ~=nil and api_key ~= "" then
parameters = parameters .. "&key="..api_key
end
return lat, lng, api..parameters
end
function DevPoint(msg, matches)
local hash = 'usecommands:'..msg.from.id..':'..msg.to.id
redis:incr(hash)
local receiver = get_receiver(msg)
local city = matches[1]
if matches[1] == 'الاذان' then
city = 'Baghdad'
end
local lat,lng,url = get_staticmap(city)
local dumptime = run_bash('date +%s')
local code = http.request('http://api.aladhan.com/timings/'..dumptime..'?latitude='..lat..'&longitude='..lng..'&timezonestring=Asia/Baghdad&method=7')
local jdat = json:decode(code)
local data = jdat.data.timings
local text = '⛪️مدينة : '..city
text = text..'\n🕌آذان الصبح: '..data.Fajr
text = text..'\n🕌شروق الشمس: '..data.Sunrise
text = text..'\n🕌آذان الظهر: '..data.Dhuhr
text = text..'\n🕌الغروب: '..data.Sunset
text = text..'\n🕌آذان المغرب: '..data.Maghrib
text = text..'\n🕌آذان العشاء : '..data.Isha
text = text..'\n\nchannel : @help_tele'
if string.match(text, '0') then text = string.gsub(text, '0', '0') end
if string.match(text, '1') then text = string.gsub(text, '1', '1') end
if string.match(text, '2') then text = string.gsub(text, '2', '2') end
if string.match(text, '3') then text = string.gsub(text, '3', '3') end
if string.match(text, '4') then text = string.gsub(text, '4', '4') end
if string.match(text, '5') then text = string.gsub(text, '5', '5') end
if string.match(text, '6') then text = string.gsub(text, '6', '6') end
if string.match(text, '7') then text = string.gsub(text, '7', '7') end
if string.match(text, '8') then text = string.gsub(text, '8', '8') end
if string.match(text, '9') then text = string.gsub(text, '9', '9') end
return text
end
return {
patterns = {"^الاذان (.*)$","^(الاذان)$"},
run =AHMED_ALOBIDE }
end | gpl-3.0 |
Sonicrich05/FFXI-Server | scripts/globals/items/dhalmel_steak.lua | 35 | 1391 | -----------------------------------------
-- ID: 4438
-- Item: dhalmel_steak
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Strength 4
-- Intelligence -1
-- Attack % 25
-- Attack Cap 45
-----------------------------------------
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,4438);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 4);
target:addMod(MOD_INT, -1);
target:addMod(MOD_ATTP, 25);
target:addMod(MOD_FOOD_ATT_CAP, 45);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 4);
target:delMod(MOD_INT, -1);
target:delMod(MOD_ATTP, 25);
target:delMod(MOD_FOOD_ATT_CAP, 45);
end;
| gpl-3.0 |
nrodriguez/SpellGainz | libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua | 12 | 7255 | --[[-----------------------------------------------------------------------------
EditBox Widget
-------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 26
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 tostring, pairs = tostring, pairs
-- WoW APIs
local PlaySound = PlaySound
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
if not AceGUIEditBoxInsertLink then
-- upgradeable hook
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
end
function _G.AceGUIEditBoxInsertLink(text)
for i = 1, AceGUI:GetWidgetCount(Type) do
local editbox = _G["AceGUI-3.0EditBox"..i]
if editbox and editbox:IsVisible() and editbox:HasFocus() then
editbox:Insert(text)
return true
end
end
end
local function ShowButton(self)
if not self.disablebutton then
self.button:Show()
self.editbox:SetTextInsets(0, 20, 3, 3)
end
end
local function HideButton(self)
self.button:Hide()
self.editbox:SetTextInsets(0, 0, 3, 3)
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Frame_OnShowFocus(frame)
frame.obj.editbox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function EditBox_OnEscapePressed(frame)
AceGUI:ClearFocus()
end
local function EditBox_OnEnterPressed(frame)
local self = frame.obj
local value = frame:GetText()
local cancel = self:Fire("OnEnterPressed", value)
if not cancel then
PlaySound("igMainMenuOptionCheckBoxOn")
HideButton(self)
end
end
local function EditBox_OnReceiveDrag(frame)
local self = frame.obj
local type, id, info = GetCursorInfo()
if type == "item" then
self:SetText(info)
self:Fire("OnEnterPressed", info)
ClearCursor()
elseif type == "spell" then
local name = GetSpellInfo(id, info)
self:SetText(name)
self:Fire("OnEnterPressed", name)
ClearCursor()
elseif type == "macro" then
local name = GetMacroInfo(id)
self:SetText(name)
self:Fire("OnEnterPressed", name)
ClearCursor()
end
HideButton(self)
AceGUI:ClearFocus()
end
local function EditBox_OnTextChanged(frame)
local self = frame.obj
local value = frame:GetText()
if tostring(value) ~= tostring(self.lasttext) then
self:Fire("OnTextChanged", value)
self.lasttext = value
ShowButton(self)
end
end
local function EditBox_OnFocusGained(frame)
AceGUI:SetFocus(frame.obj)
end
local function Button_OnClick(frame)
local editbox = frame.obj.editbox
editbox:ClearFocus()
EditBox_OnEnterPressed(editbox)
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- height is controlled by SetLabel
self:SetWidth(200)
self:SetDisabled(false)
self:SetLabel()
self:SetText()
self:DisableButton(false)
self:SetMaxLetters(0)
end,
["OnRelease"] = function(self)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.editbox:EnableMouse(false)
self.editbox:ClearFocus()
self.editbox:SetTextColor(0.5,0.5,0.5)
self.label:SetTextColor(0.5,0.5,0.5)
else
self.editbox:EnableMouse(true)
self.editbox:SetTextColor(1,1,1)
self.label:SetTextColor(1,.82,0)
end
end,
["SetText"] = function(self, text)
self.lasttext = text or ""
self.editbox:SetText(text or "")
self.editbox:SetCursorPosition(0)
HideButton(self)
end,
["GetText"] = function(self, text)
return self.editbox:GetText()
end,
["SetLabel"] = function(self, text)
if text and text ~= "" then
self.label:SetText(text)
self.label:Show()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
self:SetHeight(44)
self.alignoffset = 30
else
self.label:SetText("")
self.label:Hide()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
self:SetHeight(26)
self.alignoffset = 12
end
end,
["DisableButton"] = function(self, disabled)
self.disablebutton = disabled
if disabled then
HideButton(self)
end
end,
["SetMaxLetters"] = function (self, num)
self.editbox:SetMaxLetters(num or 0)
end,
["ClearFocus"] = function(self)
self.editbox:ClearFocus()
self.frame:SetScript("OnShow", nil)
end,
["SetFocus"] = function(self)
self.editbox:SetFocus()
if not self.frame:IsShown() then
self.frame:SetScript("OnShow", Frame_OnShowFocus)
end
end,
["HighlightText"] = function(self, from, to)
self.editbox:HighlightText(from, to)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate")
editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal)
editbox:SetScript("OnEnter", Control_OnEnter)
editbox:SetScript("OnLeave", Control_OnLeave)
editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
editbox:SetTextInsets(0, 0, 3, 3)
editbox:SetMaxLetters(256)
editbox:SetPoint("BOTTOMLEFT", 6, 0)
editbox:SetPoint("BOTTOMRIGHT")
editbox:SetHeight(19)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", 0, -2)
label:SetPoint("TOPRIGHT", 0, -2)
label:SetJustifyH("LEFT")
label:SetHeight(18)
local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate")
button:SetWidth(40)
button:SetHeight(20)
button:SetPoint("RIGHT", -2, 0)
button:SetText(OKAY)
button:SetScript("OnClick", Button_OnClick)
button:Hide()
local widget = {
alignoffset = 30,
editbox = editbox,
label = label,
button = button,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
editbox.obj, button.obj = widget, widget
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
| gpl-3.0 |
bright-things/ionic-luci | applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widgets_overview.lua | 68 | 1868 | -- Copyright 2012 Manuel Munz <freifunk at somakoma dot de>
-- Licensed to the public under the Apache License 2.0.
local uci = require "luci.model.uci".cursor()
local fs = require "nixio.fs"
local utl = require "luci.util"
m = Map("freifunk-widgets", translate("Widgets"),
translate("Configure installed widgets."))
wdg = m:section(TypedSection, "widget", translate("Widgets"))
wdg.addremove = true
wdg.extedit = luci.dispatcher.build_url("admin/freifunk/widgets/widget/%s")
wdg.template = "cbi/tblsection"
wdg.sortable = true
--[[
function wdg.create(...)
local sid = TypedSection.create(...)
luci.http.redirect(wdg.extedit % sid)
end
]]--
local en = wdg:option(Flag, "enabled", translate("Enable"))
en.rmempty = false
--en.default = "0"
function en.cfgvalue(self, section)
return Flag.cfgvalue(self, section) or "0"
end
local tmpl = wdg:option(ListValue, "template", translate("Template"))
local file
for file in fs.dir("/usr/lib/lua/luci/view/freifunk/widgets/") do
if file ~= "." and file ~= ".." then
tmpl:value(file)
end
end
local title = wdg:option(Value, "title", translate("Title"))
title.rmempty = true
local width = wdg:option(Value, "width", translate("Width"))
width.rmempty = true
local height = wdg:option(Value, "height", translate("Height"))
height.rmempty = true
local pr = wdg:option(Value, "paddingright", translate("Padding right"))
pr.rmempty = true
function m.on_commit(self)
-- clean custom text files whose config has been deleted
local dir = "/usr/share/customtext/"
local active = {}
uci:foreach("freifunk-widgets", "widget", function(s)
if s["template"] == "html" then
table.insert(active, s[".name"])
end
end )
local file
for file in fs.dir(dir) do
local filename = string.gsub(file, ".html", "")
if not utl.contains(active, filename) then
fs.unlink(dir .. file)
end
end
end
return m
| apache-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Al_Zahbi/npcs/Krujaal.lua | 4 | 1025 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Krujaal
-- Type: Residence Renter
-- @zone: 48
-- @pos: 36.522 -1 -63.198
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0000);
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 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/items/watermelon.lua | 3 | 1088 | -----------------------------------------
-- ID: 4491
-- Item: watermelon
-- Food Effect: 5Min, All Races
-----------------------------------------
-- Agility -6
-- Intelligence 4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,4491);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_AGI, -6);
target:addMod(MOD_INT, 4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_AGI, -6);
target:delMod(MOD_INT, 4);
end;
| gpl-3.0 |
RavenX8/osIROSE-new | scripts/mobs/ai/mini-jelly_bean.lua | 2 | 1056 | registerNpc(1, {
walk_speed = 160,
run_speed = 370,
scale = 56,
r_weapon = 0,
l_weapon = 0,
level = 2,
hp = 15,
attack = 2,
hit = 56,
def = 25,
res = 11,
avoid = 5,
attack_spd = 80,
is_magic_damage = 0,
ai_type = 101,
give_exp = 6,
drop_type = 100,
drop_money = 6,
drop_item = 70,
union_number = 70,
need_summon_count = 0,
sell_tab0 = 0,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 190,
npc_type = 1,
hit_material_type = 1,
face_icon = 0,
summon_mob_type = 0,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end | apache-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Windurst_Waters_[S]/npcs/Khea_Mhyyih.lua | 4 | 1052 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Khea Mhyyih
-- Type: Standard NPC
-- @zone: 94
-- @pos: -53.927 -4.499 56.215
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x01ac);
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 |
poelzi/ulatencyd | rules/io.lua | 2 | 3695 | --[[
IO rules
these are optimizers for IO
]]--
posix = require("posix")
BottleNeck = {
-- Detects high loads on discs and disable slice idling,
-- when the treshold is over a limited time.
-- When we disable slice idling (slice_idle=0), cfq start using group idling instead (group_idle)
--! (both defaults to 8ms). And if the disk and io port supports NCQ, cfq switches to IOPS mode
--! (i/o operations per seconds). This makes starting new applications under pressure faster.
last_data = {},
history = {},
-- list of entries to be ignored (partitions)
ignored = {},
first_run = true,
window = tonumber(ulatency.get_config("io", "window") or 10),
threshold = tonumber(ulatency.get_config("io", "threshold") or 100000),
percent = tonumber(ulatency.get_config("io", "percent") or 50) ,
last_set = {},
calc_history = function(self, old, new)
-- calculates if the threshold was reached and puts the result into the history
function check(old, new)
if new < old then -- overflow, better be safe :-)
return true
end
if new >= old + self.threshold then
return true
end
return false
end
result = check(tonumber(old[14]), tonumber(new[14]))
local h = self.history[old[3]]
table.insert(h, 1, result)
h[self.window+1] = nil
end,
add_entry = function(self, chunks)
local dev = chunks[3]
if self.ignored[dev] then
return
end
if self.first_run == true then
self:set_scheduler(dev, ulatency.get_config("io", "scheduler") or "cfq")
end
if not self.history[dev] then
if posix.access(ulatency.mountpoints["sysfs"] .. "/block/"..dev) == 0 then
self.history[dev] = {}
else
self.ignored[dev] = true
end
end
if self.last_data[dev] then
self:calc_history(self.last_data[dev], chunks)
end
self.last_data[dev] = chunks
end,
set_scheduler = function(self, dev, scheduler)
local path = ulatency.mountpoints["sysfs"] .. "/block/" .. dev .. "/queue/scheduler"
local fp = io.open(path, "w")
if not fp then
return
end
fp:write(tostring(scheduler))
fp:close()
end,
set_slice_idling = function(self, dev, value)
if self.last_set[dev] == value then
return
end
self.last_set[dev] = value
local path = ulatency.mountpoints["sysfs"] .. "/block/" .. dev .. "/queue/iosched/slice_idle"
local fp = io.open(path, "w")
if not fp then
return
end
u_info("IO: set slice idling on dev %s to %d", dev, value)
fp:write(tostring(value))
fp:close()
end,
parse_data = function(self)
local fp = io.open("/proc/diskstats", "r")
if not fp then
return
end
for line in fp:lines() do
local chunks = string.split(line, " ")
self:add_entry(chunks)
end
fp:close()
self.first_run = false
end,
decide = function(self)
for dev, history in pairs(self.history) do
if #history == self.window then
local yes = 0
for n, x in ipairs(history) do
if x then
yes = yes +1
end
end
if (yes * 100) >= (#history * self.percent) then
self:set_slice_idling(dev, 0)
else
self:set_slice_idling(dev, 8)
end
end
end
end,
iterate = function(self)
-- called from timeout function
self:parse_data()
self:decide()
end
}
local function iterate()
-- called from timeout function
BottleNeck:iterate()
return true
end
if ulatency.tree_loaded("blkio") then
ulatency.add_timeout(iterate, 1000)
end
if ulatency.tree_loaded("bfqio") then
ulatency.add_timeout(iterate, 1000)
end
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Windurst_Woods/npcs/Erpolant.lua | 5 | 1039 | -----------------------------------
-- Area: Windurst Woods
-- NPC: Erpolant
-- Type: Standard NPC
-- @zone: 241
-- @pos: -63.224 -0.749 -33.424
--
-- Auto-Script: Requires Verification (Verfied by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x01bc);
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 |
teleantispirit/SPIRIT | plugins/stats.lua | 866 | 4001 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'teleseed' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' then
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(chat_id)
else
return
end
end
if matches[2] == "teleseed" then -- Put everything you like :)
if not is_admin(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[!/]([Ss]tats)$",
"^[!/]([Ss]tatslist)$",
"^[!/]([Ss]tats) (group) (%d+)",
"^[!/]([Ss]tats) (teleseed)",-- Put everything you like :)
"^[!/]([Tt]eleseed)"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
Sonicrich05/FFXI-Server | scripts/globals/items/plate_of_witch_risotto.lua | 35 | 1537 | -----------------------------------------
-- ID: 4330
-- Item: witch_risotto
-- Food Effect: 4hours, All Races
-----------------------------------------
-- Magic Points 35
-- Strength -1
-- Vitality 3
-- Mind 3
-- MP Recovered While Healing 2
-- Enmity -1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,4330);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 35);
target:addMod(MOD_STR, -1);
target:addMod(MOD_VIT, 3);
target:addMod(MOD_MND, 3);
target:addMod(MOD_MPHEAL, 2);
target:addMod(MOD_ENMITY, -1);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 35);
target:delMod(MOD_STR, -1);
target:delMod(MOD_VIT, 3);
target:delMod(MOD_MND, 3);
target:delMod(MOD_MPHEAL, 2);
target:delMod(MOD_ENMITY, -1);
end;
| gpl-3.0 |
kamalasv/orthanc | Resources/Samples/Lua/OnStableStudy.lua | 3 | 1415 | function Initialize()
print('Number of stored studies at initialization: ' ..
table.getn(ParseJson(RestApiGet('/studies'))))
end
function Finalize()
print('Number of stored studies at finalization: ' ..
table.getn(ParseJson(RestApiGet('/studies'))))
end
function OnStoredInstance(instanceId, tags, metadata)
patient = ParseJson(RestApiGet('/instances/' .. instanceId .. '/patient'))
print('Received an instance for patient: ' ..
patient['MainDicomTags']['PatientID'] .. ' - ' ..
patient['MainDicomTags']['PatientName'])
end
function OnStableStudy(studyId, tags, metadata)
if (metadata['ModifiedFrom'] == nil and
metadata['AnonymizedFrom'] == nil) then
print('This study is now stable: ' .. studyId)
-- The tags to be replaced
local replace = {}
replace['StudyDescription'] = 'Modified study'
replace['StationName'] = 'My Medical Device'
replace['0031-1020'] = 'Some private tag'
-- The tags to be removed
local remove = { 'MilitaryRank' }
-- The modification command
local command = {}
command['Remove'] = remove
command['Replace'] = replace
-- Modify the entire study in one single call
local m = RestApiPost('/studies/' .. studyId .. '/modify',
DumpJson(command))
print('Modified study: ' .. m)
end
end
| gpl-3.0 |
RavenX8/osIROSE-new | scripts/mobs/ai/christmas_tree.lua | 2 | 1063 | registerNpc(992, {
walk_speed = 0,
run_speed = 0,
scale = 130,
r_weapon = 1073,
l_weapon = 0,
level = 30,
hp = 2000,
attack = 10,
hit = 10,
def = 300,
res = 300,
avoid = 40,
attack_spd = 100,
is_magic_damage = 0,
ai_type = 282,
give_exp = 0,
drop_type = 0,
drop_money = 0,
drop_item = 0,
union_number = 0,
need_summon_count = 30,
sell_tab0 = 30,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 10,
npc_type = 0,
hit_material_type = 1,
face_icon = 0,
summon_mob_type = 0,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end | apache-2.0 |
Sonicrich05/FFXI-Server | scripts/zones/Northern_San_dOria/npcs/Shomo_Pochachilo.lua | 38 | 1288 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Shomo Pochachilo
-- Type: Standard Info NPC
-- @zone: 231
-- @pos 28.369 -0.199 30.061
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
quest_FatherAndSon = player:getQuestStatus(SANDORIA,FATHER_AND_SON);
if (quest_FatherAndSon == QUEST_COMPLETED) then
player:startEvent(0x02b8);
else
player:startEvent(0x02a3);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/globals/spells/exuviation.lua | 4 | 1201 | -----------------------------------------
-- Spell: Exuviation
-- Restores HP and removes one detrimental magic effect.
-- Can be used with Diffusion.
-- Shamelessly stolen from http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html
-----------------------------------------
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)
local minCure = 60;
local divisor = 1;
local constant = 40;
local power = getCurePowerOld(caster);
if(power > 99) then
divisor = 57;
constant = 79.125;
elseif(power > 59) then
divisor = 2;
constant = 55;
end
local final = getCureFinal(caster,spell,getBaseCureOld(power,divisor,constant),minCure,true);
final = final + (final * (target:getMod(MOD_CURE_POTENCY_RCVD)/100));
local diff = (target:getMaxHP() - target:getHP());
if(final > diff) then
final = diff;
end
caster:eraseStatusEffect();
target:addHP(final);
caster:updateEnmityFromCure(target,final);
return final;
end; | gpl-3.0 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader/[TFA][AT] Shared Resources Pack/lua/tfa/att/mod_stun15_servius.lua | 1 | 1436 | if not ATTACHMENT then
ATTACHMENT = {}
end
ATTACHMENT.Name = "Charge Round Charlie"
ATTACHMENT.ShortName = "15s" --Abbreviation, 5 chars or less please
--ATTACHMENT.ID = "base" -- normally this is just your filename
ATTACHMENT.Description = {
TFA.AttachmentColors["+"],"Stunned for 15 Seconds",
}
ATTACHMENT.Icon = "entities/icon/mod_stun15.png" --Revers to label, please give it an icon though! This should be the path to a png, like "entities/tfa_ammo_match.png"
ATTACHMENT.WeaponTable = {
["Primary"] = {
["AmmoConsumption"] = 7,
["StatusEffect"] = "stun",
["StatusEffectDmg"] = 45,
["StatusEffectDur"] = 15,
["StatusEffectParticle"] = true,
},
["TracerName"] = "effect_sw_laser_blue_stun",
}
function ATTACHMENT:Attach(wep)
wep.CustomBulletCallbackOld = wep.CustomBulletCallbackOld or wep.CustomBulletCallback
wep.CustomBulletCallback = function(a, tr, dmg)
local wep = dmg:GetInflictor()
if wep:GetStat("Primary.StatusEffect") then
GMSERV:AddStatus(tr.Entity, wep:GetOwner(), wep:GetStat("Primary.StatusEffect"), wep:GetStat("Primary.StatusEffectDur"), wep:GetStat("Primary.StatusEffectDmg"), wep:GetStat("Primary.StatusEffectParticle"))
--util.Effect("BGOLightning", ED_Stun, true, true)
end
end
end
function ATTACHMENT:Detach(wep)
wep.CustomBulletCallback = wep.CustomBulletCallbackOld
wep.CustomBulletCallbackOld = nil
end
if not TFA_ATTACHMENT_ISUPDATING then
TFAUpdateAttachments()
end | apache-2.0 |
everslick/awesome | lib/naughty/dbus.lua | 5 | 9979 | ---------------------------------------------------------------------------
-- DBUS/Notification support
-- Notify
--
-- @author koniu <gkusnierz@gmail.com>
-- @copyright 2008 koniu
-- @release @AWESOME_VERSION@
-- @module naughty.dbus
---------------------------------------------------------------------------
assert(dbus)
-- Package environment
local pairs = pairs
local type = type
local string = string
local capi = { awesome = awesome,
dbus = dbus }
local util = require("awful.util")
local cairo = require("lgi").cairo
local schar = string.char
local sbyte = string.byte
local tcat = table.concat
local tins = table.insert
local unpack = unpack or table.unpack -- v5.1: unpack, v5.2: table.unpack
local naughty = require("naughty.core")
--- Notification library, dbus bindings
local dbus = { config = {} }
-- DBUS Notification constants
local urgency = {
low = "\0",
normal = "\1",
critical = "\2"
}
--- DBUS notification to preset mapping.
-- The first element is an object containing the filter.
-- If the rules in the filter match, the associated preset will be applied.
-- The rules object can contain the following keys: urgency, category, appname.
-- The second element is the preset.
-- @tfield table 1 low urgency
-- @tfield table 2 normal urgency
-- @tfield table 3 critical urgency
-- @table config.mapping
dbus.config.mapping = {
{{urgency = urgency.low}, naughty.config.presets.low},
{{urgency = urgency.normal}, naughty.config.presets.normal},
{{urgency = urgency.critical}, naughty.config.presets.critical}
}
local function sendActionInvoked(notificationId, action)
if capi.dbus then
capi.dbus.emit_signal("session", "/org/freedesktop/Notifications",
"org.freedesktop.Notifications", "ActionInvoked",
"u", notificationId,
"s", action)
end
end
local function sendNotificationClosed(notificationId, reason)
if capi.dbus then
capi.dbus.emit_signal("session", "/org/freedesktop/Notifications",
"org.freedesktop.Notifications", "NotificationClosed",
"u", notificationId,
"u", reason)
end
end
local function convert_icon(w, h, rowstride, channels, data)
-- Do the arguments look sane? (e.g. we have enough data)
local expected_length = rowstride * (h - 1) + w * channels
if w < 0 or h < 0 or rowstride < 0 or (channels ~= 3 and channels ~= 4) or
string.len(data) < expected_length then
w = 0
h = 0
end
local format = cairo.Format[channels == 4 and 'ARGB32' or 'RGB24']
-- Figure out some stride magic (cairo dictates rowstride)
local stride = cairo.Format.stride_for_width(format, w)
local append = schar(0):rep(stride - 4 * w)
local offset = 0
-- Now convert each row on its own
local rows = {}
for y = 1, h do
local this_row = {}
for i = 1 + offset, w * channels + offset, channels do
local R, G, B, A = sbyte(data, i, i + channels - 1)
tins(this_row, schar(B, G, R, A or 255))
end
-- Handle rowstride, offset is stride for the input, append for output
tins(this_row, append)
tins(rows, tcat(this_row))
offset = offset + rowstride
end
return cairo.ImageSurface.create_for_data(tcat(rows), format, w, h, stride)
end
capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
local args = { }
if data.member == "Notify" then
if text ~= "" then
args.text = text
if title ~= "" then
args.title = title
end
else
if title ~= "" then
args.text = title
else
return
end
end
if appname ~= "" then
args.appname = appname
end
for i, obj in pairs(dbus.config.mapping) do
local filter, preset, s = obj[1], obj[2], 0
if (not filter.urgency or filter.urgency == hints.urgency) and
(not filter.category or filter.category == hints.category) and
(not filter.appname or filter.appname == appname) then
args.preset = util.table.join(args.preset, preset)
end
end
local preset = args.preset or naughty.config.defaults
local notification
if actions then
args.actions = {}
local actionid
-- create actions callbacks
for i , v in ipairs(actions) do
if i % 2 == 1 then
actionid = v
elseif actionid == "default" then
args.run = function()
sendActionInvoked(notification.id, "default")
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
end
actionid = nil
elseif actionid ~= nil then
local action = actionid
args.actions[actionid] = function()
sendActionInvoked(notification.id, action)
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
end
actionid = nil
end
end
end
args.destroy = function(reason)
sendNotificationClosed(notification.id, reason)
end
if not preset.callback or (type(preset.callback) == "function" and
preset.callback(data, appname, replaces_id, icon, title, text, actions, hints, expire)) then
if icon ~= "" then
args.icon = icon
elseif hints.icon_data or hints.image_data then
if hints.icon_data == nil then hints.icon_data = hints.image_data end
-- icon_data is an array:
-- 1 -> width
-- 2 -> height
-- 3 -> rowstride
-- 4 -> has alpha
-- 5 -> bits per sample
-- 6 -> channels
-- 7 -> data
local w, h, rowstride, _, _, channels, data = unpack(hints.icon_data)
args.icon = convert_icon(w, h, rowstride, channels, data)
end
if replaces_id and replaces_id ~= "" and replaces_id ~= 0 then
args.replaces_id = replaces_id
end
if expire and expire > -1 then
args.timeout = expire / 1000
end
notification = naughty.notify(args)
return "u", notification.id
end
return "u", "0"
elseif data.member == "CloseNotification" then
local obj = naughty.getById(appname)
if obj then
naughty.destroy(obj, naughty.notificationClosedReason.dismissedByCommand)
end
elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
-- name of notification app, name of vender, version
return "s", "naughty", "s", "awesome", "s", capi.awesome.version:match("%d.%d"), "s", "1.0"
elseif data.member == "GetCapabilities" then
-- We actually do display the body of the message, we support <b>, <i>
-- and <u> in the body and we handle static (non-animated) icons.
return "as", { "s", "body", "s", "body-markup", "s", "icon-static", "s", "actions" }
end
end)
capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable", function (data, text)
if data.member == "Introspect" then
local xml = [=[<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object
Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="data" direction="out" type="s"/>
</method>
</interface>
<interface name="org.freedesktop.Notifications">
<method name="GetCapabilities">
<arg name="caps" type="as" direction="out"/>
</method>
<method name="CloseNotification">
<arg name="id" type="u" direction="in"/>
</method>
<method name="Notify">
<arg name="app_name" type="s" direction="in"/>
<arg name="id" type="u" direction="in"/>
<arg name="icon" type="s" direction="in"/>
<arg name="summary" type="s" direction="in"/>
<arg name="body" type="s" direction="in"/>
<arg name="actions" type="as" direction="in"/>
<arg name="hints" type="a{sv}" direction="in"/>
<arg name="timeout" type="i" direction="in"/>
<arg name="return_id" type="u" direction="out"/>
</method>
<method name="GetServerInformation">
<arg name="return_name" type="s" direction="out"/>
<arg name="return_vendor" type="s" direction="out"/>
<arg name="return_version" type="s" direction="out"/>
<arg name="return_spec_version" type="s" direction="out"/>
</method>
<method name="GetServerInfo">
<arg name="return_name" type="s" direction="out"/>
<arg name="return_vendor" type="s" direction="out"/>
<arg name="return_version" type="s" direction="out"/>
</method>
<signal name="NotificationClosed">
<arg name="id" type="u" direction="out"/>
<arg name="reason" type="u" direction="out"/>
</signal>
<signal name="ActionInvoked">
<arg name="id" type="u" direction="out"/>
<arg name="action_key" type="s" direction="out"/>
</signal>
</interface>
</node>]=]
return "s", xml
end
end)
-- listen for dbus notification requests
capi.dbus.request_name("session", "org.freedesktop.Notifications")
return dbus
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
| gpl-2.0 |
kidaa/ffxinfinity | FFXI Server-Development/Build Files/scripts/zones/Metalworks/npcs/Olaf.lua | 2 | 1104 | -----------------------------------
-- Area: Metalworks
-- NPC: Olaf
-- Standard Merchant NPC
-----------------------------------
require("scripts/globals/shop");
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
require("scripts/zones/Metalworks/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,OLAF_SHOP_DIALOG);
stock = {0x4360,46836,2, -- Arquebus
0x43BC,90,3, -- Bullet
0x03A0,463,3} -- Bomb Ash
showNationShop(player, BASTOK, 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 |
Servius/tfa-sw-weapons-repository | Live Addons/servius_uploader_legacy/tfa_shared_resources/lua/entities/e60r_rocket2/cl_init.lua | 11 | 1374 | include('shared.lua')
//[[---------------------------------------------------------
//Name: Draw Purpose: Draw the model in-game.
//Remember, the things you render first will be underneath!
//-------------------------------------------------------]]
function ENT:Draw()
// self.BaseClass.Draw(self)
-- We want to override rendering, so don't call baseclass.
// Use this when you need to add to the rendering.
self.Entity:DrawModel() // Draw the model.
end
function ENT:Initialize()
pos = self:GetPos()
self.emitter = ParticleEmitter( pos )
end
function ENT:Think()
pos = self:GetPos()
for i=0, (10) do
local particle = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), pos + (self:GetForward() * -100 * i))
if (particle) then
particle:SetVelocity((self:GetForward() * -2000) )
particle:SetDieTime( math.Rand( 1.5, 3 ) )
particle:SetStartAlpha( math.Rand( 5, 8 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand( 40, 50 ) )
particle:SetEndSize( math.Rand( 130, 150 ) )
particle:SetRoll( math.Rand(0, 360) )
particle:SetRollDelta( math.Rand(-1, 1) )
particle:SetColor( 200 , 200 , 200 )
particle:SetAirResistance( 200 )
particle:SetGravity( Vector( 100, 0, 0 ) )
end
end
end
| apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.