repo_name stringlengths 6 78 | path stringlengths 4 206 | copies stringclasses 281
values | size stringlengths 4 7 | content stringlengths 625 1.05M | license stringclasses 15
values |
|---|---|---|---|---|---|
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/clothing/clothing_ith_hat_chef_02.lua | 2 | 3371 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_clothing_clothing_ith_hat_chef_02 = object_draft_schematic_clothing_shared_clothing_ith_hat_chef_02:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Small Ithorian Chef Hat",
craftingToolTab = 8, -- (See DraftSchemticImplementation.h)
complexity = 19,
size = 3,
xpType = "crafting_clothing_general",
xp = 50,
assemblySkill = "clothing_assembly",
experimentingSkill = "clothing_experimentation",
customizationSkill = "clothing_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n"},
ingredientTitleNames = {"shell", "binding_and_weatherproofing", "liner"},
ingredientSlotType = {1, 0, 1},
resourceTypes = {"object/tangible/component/clothing/shared_fiberplast_panel.iff", "petrochem_inert", "object/tangible/component/clothing/shared_synthetic_cloth.iff"},
resourceQuantities = {3, 20, 1},
contribution = {100, 100, 100},
targetTemplate = "object/tangible/wearables/ithorian/hat_chef_s02_ith.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_clothing_clothing_ith_hat_chef_02, "object/draft_schematic/clothing/clothing_ith_hat_chef_02.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/commands/jediMindTrick.lua | 4 | 2132 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
--true = 1, false = 0
JediMindTrickCommand = {
name = "jedimindtrick",
}
AddCommand(JediMindTrickCommand)
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/mission/quest_item/current_alternator.lua | 3 | 2720 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_mission_quest_item_current_alternator = object_tangible_mission_quest_item_shared_current_alternator:new {
numberExperimentalProperties = {1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "exp_durability", "exp_effectiveness"},
experimentalSubGroupTitles = {"null", "null", "hitpoints", "usemodifier"},
experimentalMin = {0, 0, 100, -15},
experimentalMax = {0, 0, 150, 15},
experimentalPrecision = {0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 1},
}
ObjectTemplates:addTemplate(object_tangible_mission_quest_item_current_alternator, "object/tangible/mission/quest_item/current_alternator.iff")
| agpl-3.0 |
DailyShana/ygopro-scripts | c33114323.lua | 7 | 1600 | --メタルシルバー・アーマー
--Effect is not fully implemented
function c33114323.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c33114323.target)
e1:SetOperation(c33114323.operation)
c:RegisterEffect(e1)
--atk target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_IGNORE_RANGE)
e2:SetRange(LOCATION_SZONE)
e2:SetTarget(c33114323.efftg)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c33114323.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c33114323.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c33114323.efftg(e,c)
return c~=e:GetHandler():GetEquipTarget() and c:IsType(TYPE_MONSTER)
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/hair/twilek/hair_twilek_male_s06.lua | 3 | 2252 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_hair_twilek_hair_twilek_male_s06 = object_tangible_hair_twilek_shared_hair_twilek_male_s06:new {
}
ObjectTemplates:addTemplate(object_tangible_hair_twilek_hair_twilek_male_s06, "object/tangible/hair/twilek/hair_twilek_male_s06.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/furniture/furniture_rug_rectangle_large.lua | 3 | 2308 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_furniture_furniture_rug_rectangle_large = object_draft_schematic_furniture_shared_furniture_rug_rectangle_large:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_furniture_furniture_rug_rectangle_large, "object/draft_schematic/furniture/furniture_rug_rectangle_large.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/commands/grantSkill.lua | 4 | 2123 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
--true = 1, false = 0
GrantSkillCommand = {
name = "grantskill",
}
AddCommand(GrantSkillCommand)
| agpl-3.0 |
DailyShana/ygopro-scripts | c80559548.lua | 3 | 1842 | --SRシェイブー・メラン
function c80559548.initial_effect(c)
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c80559548.sumop)
c:RegisterEffect(e1)
--atk down
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(80559548,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c80559548.atkcon)
e2:SetTarget(c80559548.atktg)
e2:SetOperation(c80559548.atkop)
c:RegisterEffect(e2)
end
function c80559548.sumop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function c80559548.atkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
end
function c80559548.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c80559548.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
if tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(-800)
tc:RegisterEffect(e1)
end
end
end
| gpl-2.0 |
DailyShana/ygopro-scripts | c59385322.lua | 6 | 3301 | --コアバスター
function c59385322.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c59385322.target)
e1:SetOperation(c59385322.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c59385322.eqlimit)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(59385322,0))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_BATTLE_START)
e3:SetCondition(c59385322.descon)
e3:SetTarget(c59385322.destg)
e3:SetOperation(c59385322.desop)
c:RegisterEffect(e3)
--salvage
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(59385322,1))
e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(c59385322.thcon)
e4:SetTarget(c59385322.thtg)
e4:SetOperation(c59385322.thop)
c:RegisterEffect(e4)
end
function c59385322.eqlimit(e,c)
return c:IsSetCard(0x1d)
end
function c59385322.filter(c)
return c:IsFaceup() and c:IsSetCard(0x1d)
end
function c59385322.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c59385322.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c59385322.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c59385322.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c59385322.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function c59385322.descon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
if ec~=Duel.GetAttacker() and ec~=Duel.GetAttackTarget() then return false end
local tc=ec:GetBattleTarget()
e:SetLabelObject(tc)
return tc and tc:IsFaceup() and tc:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
end
function c59385322.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetLabelObject(),1,0,0)
end
function c59385322.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=e:GetLabelObject()
if tc:IsFaceup() and tc:IsRelateToBattle() then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c59385322.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_LOST_TARGET)
and not e:GetHandler():GetPreviousEquipTarget():IsLocation(LOCATION_MZONE)
end
function c59385322.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c59385322.thop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,e:GetHandler())
end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/woolamander_hue.lua | 3 | 2176 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_woolamander_hue = object_mobile_shared_woolamander_hue:new {
}
ObjectTemplates:addTemplate(object_mobile_woolamander_hue, "object/mobile/woolamander_hue.iff")
| agpl-3.0 |
AndyClausen/PNRP_HazG | postnukerp/entities/entities/hp_healthkit/init.lua | 1 | 1070 | AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
util.PrecacheModel ("models/items/healthkit.mdl")
function ENT:Initialize()
self.Entity:SetModel("models/items/healthkit.mdl")
self.Entity:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self.Entity:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self.Entity:PhysWake()
end
function ENT:Use( activator, caller )
if ( activator:IsPlayer() ) then
// Give the collecting player some free health
local health = activator:Health()
if not ( health == activator:GetMaxHealth() ) then
local sound = Sound("items/medshot4.wav")
self.Entity:EmitSound( sound )
self.Entity:Remove()
activator:SetHealth( health + 30 )
if ( activator:GetMaxHealth() < health + 30 ) then
activator:SetHealth( activator:GetMaxHealth() )
end
end
end
end
function ENT:PostEntityPaste(pl, Ent, CreatedEntities)
self:Remove()
end
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/structure/tatooine/wall_damaged_tatooine_large_style_01.lua | 3 | 2336 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_tatooine_wall_damaged_tatooine_large_style_01 = object_static_structure_tatooine_shared_wall_damaged_tatooine_large_style_01:new {
}
ObjectTemplates:addTemplate(object_static_structure_tatooine_wall_damaged_tatooine_large_style_01, "object/static/structure/tatooine/wall_damaged_tatooine_large_style_01.iff")
| agpl-3.0 |
DailyShana/ygopro-scripts | c88177324.lua | 3 | 3684 | --No.107 銀河眼の時空竜
function c88177324.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,8,2)
c:EnableReviveLimit()
--negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(88177324,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetHintTiming(TIMING_BATTLE_START,0)
e1:SetCondition(c88177324.negcon)
e1:SetCost(c88177324.negcost)
e1:SetTarget(c88177324.negtg)
e1:SetOperation(c88177324.negop)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetCondition(c88177324.regcon)
e2:SetOperation(c88177324.regop)
c:RegisterEffect(e2)
end
c88177324.xyz_number=107
function c88177324.negcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_BATTLE and not Duel.CheckPhaseActivity() and Duel.GetCurrentChain()==0
end
function c88177324.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c88177324.filter1(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not c:IsDisabled()
end
function c88177324.filter2(c)
return c:IsFaceup() and (c:GetAttack()~=c:GetBaseAttack() or c:GetDefence()~=c:GetBaseDefence())
end
function c88177324.filter3(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT)
end
function c88177324.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return
Duel.IsExistingMatchingCard(c88177324.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler())
or Duel.IsExistingMatchingCard(c88177324.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler())
end
end
function c88177324.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c88177324.filter3,tp,LOCATION_MZONE,LOCATION_MZONE,c)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
g=Duel.GetMatchingGroup(c88177324.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,c)
tc=g:GetFirst()
while tc do
if tc:GetAttack()~=tc:GetBaseAttack() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(tc:GetBaseAttack())
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
end
if tc:GetDefence()~=tc:GetBaseDefence() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENCE_FINAL)
e1:SetValue(tc:GetBaseDefence())
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
end
tc=g:GetNext()
end
if c:IsFaceup() and c:IsRelateToEffect(e) then
c:RegisterFlagEffect(88177324,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE,0,1)
end
end
function c88177324.regcon(e,tp,eg,ep,ev,re,r,rp)
return rp~=tp and e:GetHandler():GetFlagEffect(88177324)>0
end
function c88177324.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_BATTLE)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EXTRA_ATTACK)
e2:SetValue(1)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
c:RegisterEffect(e2)
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/loot/loot_schematic/pitcher_full_schematic.lua | 3 | 2292 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_loot_loot_schematic_pitcher_full_schematic = object_tangible_loot_loot_schematic_shared_pitcher_full_schematic:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_loot_schematic_pitcher_full_schematic, "object/tangible/loot/loot_schematic/pitcher_full_schematic.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/weapon/ranged/pistol/pistol_fwg5_quest.lua | 2 | 6187 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_weapon_ranged_pistol_pistol_fwg5_quest = object_weapon_ranged_pistol_shared_pistol_fwg5_quest:new {
playerRaces = { "object/creature/player/bothan_male.iff",
"object/creature/player/bothan_female.iff",
"object/creature/player/human_male.iff",
"object/creature/player/human_female.iff",
"object/creature/player/ithorian_male.iff",
"object/creature/player/ithorian_female.iff",
"object/creature/player/moncal_male.iff",
"object/creature/player/moncal_female.iff",
"object/creature/player/rodian_male.iff",
"object/creature/player/rodian_female.iff",
"object/creature/player/sullustan_male.iff",
"object/creature/player/sullustan_female.iff",
"object/creature/player/trandoshan_male.iff",
"object/creature/player/trandoshan_female.iff",
"object/creature/player/twilek_male.iff",
"object/creature/player/twilek_female.iff",
"object/creature/player/wookiee_male.iff",
"object/creature/player/wookiee_female.iff",
"object/creature/player/zabrak_male.iff",
"object/creature/player/zabrak_female.iff" },
-- RANGEDATTACK, MELEEATTACK, FORCEATTACK, TRAPATTACK, GRENADEATTACK, HEAVYACIDBEAMATTACK,
-- HEAVYLIGHTNINGBEAMATTACK, HEAVYPARTICLEBEAMATTACK, HEAVYROCKETLAUNCHERATTACK, HEAVYLAUNCHERATTACK
attackType = RANGEDATTACK,
-- ENERGY, KINETIC, ELECTRICITY, STUN, BLAST, HEAT, COLD, ACID, FORCE, LIGHTSABER
damageType = HEAT,
-- NONE, LIGHT, MEDIUM, HEAVY
armorPiercing = NONE,
-- combat_rangedspecialize_bactarifle, combat_rangedspecialize_rifle, combat_rangedspecialize_pistol, combat_rangedspecialize_heavy, combat_rangedspecialize_carbine
-- combat_meleespecialize_unarmed, combat_meleespecialize_twohand, combat_meleespecialize_polearm, combat_meleespecialize_onehand, combat_general,
-- combat_meleespecialize_twohandlightsaber, combat_meleespecialize_polearmlightsaber, combat_meleespecialize_onehandlightsaber
xpType = "combat_rangedspecialize_pistol",
-- See http://www.ocdsoft.com/files/certifications.xls
certificationsRequired = { "cert_pistol_fwg5" },
-- See http://www.ocdsoft.com/files/accuracy.xls
creatureAccuracyModifiers = { "pistol_accuracy" },
creatureAimModifiers = { "pistol_aim", "aim" },
-- See http://www.ocdsoft.com/files/defense.xls
defenderDefenseModifiers = { "ranged_defense" },
-- Leave as "dodge" for now, may have additions later
defenderSecondaryDefenseModifiers = { "dodge" },
-- See http://www.ocdsoft.com/files/speed.xls
speedModifiers = { "pistol_speed" },
-- Leave blank for now
damageModifiers = { },
-- The values below are the default values. To be used for blue frog objects primarily
healthAttackCost = 13,
actionAttackCost = 40,
mindAttackCost = 20,
forceCost = 0,
pointBlankAccuracy = 0,
pointBlankRange = 0,
idealRange = 15,
idealAccuracy = 15,
maxRange = 64,
maxRangeAccuracy = 5,
minDamage = 14,
maxDamage = 70,
attackSpeed = 4.6,
numberExperimentalProperties = {1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2},
experimentalProperties = {"XX", "XX", "CD", "OQ", "CD", "OQ", "CD", "OQ", "CD", "OQ", "CD", "OQ", "CD", "OQ", "CD", "OQ", "XX", "XX", "CD", "OQ", "CD", "OQ", "CD", "OQ", "CD", "OQ"},
experimentalWeights = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "expDamage", "expDamage", "expDamage", "expDamage", "expEffeciency", "exp_durability", "null", "null", "null", "expRange", "expEffeciency", "expEffeciency", "expEffeciency"},
experimentalSubGroupTitles = {"null", "null", "mindamage", "maxdamage", "attackspeed", "woundchance", "roundsused", "hitpoints", "zerorangemod", "maxrangemod", "midrange", "midrangemod", "attackhealthcost", "attackactioncost", "attackmindcost"},
experimentalMin = {0, 0, 14, 70, 4.6, 6, 1, 750, 0, -70, 20, 14, 13, 40, 20},
experimentalMax = {0, 0, 26, 130, 3.2, 12, 3, 1500, 0, -70, 20, 26, 7, 22, 11},
experimentalPrecision = {0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_weapon_ranged_pistol_pistol_fwg5_quest, "object/weapon/ranged/pistol/pistol_fwg5_quest.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/space/weapon/missile/basic_launcher.lua | 3 | 2292 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_space_weapon_missile_basic_launcher = object_draft_schematic_space_weapon_missile_shared_basic_launcher:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_space_weapon_missile_basic_launcher, "object/draft_schematic/space/weapon/missile/basic_launcher.iff")
| agpl-3.0 |
DailyShana/ygopro-scripts | c36484016.lua | 3 | 4204 | --ミラクルシンクロフュージョン
function c36484016.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c36484016.target)
e1:SetOperation(c36484016.activate)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(36484016,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c36484016.drcon)
e2:SetTarget(c36484016.drtg)
e2:SetOperation(c36484016.drop)
c:RegisterEffect(e2)
end
function c36484016.filter0(c)
return c:IsCanBeFusionMaterial() and c:IsAbleToRemove()
end
function c36484016.filter1(c,e)
return c:IsCanBeFusionMaterial() and c:IsAbleToRemove() and not c:IsImmuneToEffect(e)
end
function c36484016.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x101) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and m:IsExists(c36484016.filter3,1,nil,c,m,chkf)
end
function c36484016.filter3(c,fusc,m,chkf)
return c:IsType(TYPE_SYNCHRO) and fusc:CheckFusionMaterial(m,c,chkf)
end
function c36484016.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp
local mg1=Duel.GetMatchingGroup(c36484016.filter0,tp,LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local res=Duel.IsExistingMatchingCard(c36484016.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c36484016.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c36484016.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp
local mg1=Duel.GetMatchingGroup(c36484016.filter1,tp,LOCATION_GRAVE+LOCATION_MZONE,0,nil,e)
local sg1=Duel.GetMatchingGroup(c36484016.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c36484016.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local gc=mg1:FilterSelect(tp,c36484016.filter3,1,1,nil,tc,mg1,chkf):GetFirst()
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,gc,chkf)
mat1:AddCard(gc)
tc:SetMaterial(mat1)
Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local gc=mg2:FilterSelect(tp,c36484016.filter3,1,1,nil,tc,mg2,chkf):GetFirst()
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,gc,chkf)
mat2:AddCard(gc)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c36484016.drcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(r,0x41)==0x41 and rp~=tp and c:GetPreviousControler()==tp
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN)
end
function c36484016.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c36484016.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bicep_l.lua | 1 | 4671 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_wearables_armor_bounty_hunter_armor_bounty_hunter_bicep_l = object_tangible_wearables_armor_bounty_hunter_shared_armor_bounty_hunter_bicep_l:new {
templateType = ARMOROBJECT,
playerRaces = { "object/creature/player/bothan_male.iff",
"object/creature/player/bothan_female.iff",
"object/creature/player/human_male.iff",
"object/creature/player/human_female.iff",
"object/creature/player/moncal_male.iff",
"object/creature/player/moncal_female.iff",
"object/creature/player/rodian_male.iff",
"object/creature/player/rodian_female.iff",
"object/creature/player/sullustan_male.iff",
"object/creature/player/sullustan_female.iff",
"object/creature/player/trandoshan_male.iff",
"object/creature/player/trandoshan_female.iff",
"object/creature/player/twilek_male.iff",
"object/creature/player/twilek_female.iff",
"object/creature/player/zabrak_male.iff",
"object/creature/player/zabrak_female.iff",
"object/mobile/vendor/aqualish_female.iff",
"object/mobile/vendor/aqualish_male.iff",
"object/mobile/vendor/bith_female.iff",
"object/mobile/vendor/bith_male.iff",
"object/mobile/vendor/bothan_female.iff",
"object/mobile/vendor/bothan_male.iff",
"object/mobile/vendor/devaronian_male.iff",
"object/mobile/vendor/gran_male.iff",
"object/mobile/vendor/human_female.iff",
"object/mobile/vendor/human_male.iff",
"object/mobile/vendor/ishi_tib_male.iff",
"object/mobile/vendor/moncal_female.iff",
"object/mobile/vendor/moncal_male.iff",
"object/mobile/vendor/nikto_male.iff",
"object/mobile/vendor/quarren_male.iff",
"object/mobile/vendor/rodian_female.iff",
"object/mobile/vendor/rodian_male.iff",
"object/mobile/vendor/sullustan_female.iff",
"object/mobile/vendor/sullustan_male.iff",
"object/mobile/vendor/trandoshan_female.iff",
"object/mobile/vendor/trandoshan_male.iff",
"object/mobile/vendor/twilek_female.iff",
"object/mobile/vendor/twilek_male.iff",
"object/mobile/vendor/weequay_male.iff",
"object/mobile/vendor/zabrak_female.iff",
"object/mobile/vendor/zabrak_male.iff" },
-- The damage types in WeaponObject
vulnerability = STUN + LIGHTSABER,
-- These are default Blue Frog stats
maxCondition = 30000,
healthEncumbrance = 35,
actionEncumbrance = 35,
mindEncumbrance = 35,
-- LIGHT, MEDIUM, HEAVY
rating = LIGHT,
kinetic = 55,
energy = 55,
electricity = 55,
blast = 55,
cold = 55,
}
ObjectTemplates:addTemplate(object_tangible_wearables_armor_bounty_hunter_armor_bounty_hunter_bicep_l, "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bicep_l.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_herald_pirate_naboo_human_male.lua | 3 | 2268 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_herald_pirate_naboo_human_male = object_mobile_shared_dressed_herald_pirate_naboo_human_male:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_herald_pirate_naboo_human_male, "object/mobile/dressed_herald_pirate_naboo_human_male.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/corellia/smashball_bully.lua | 2 | 1502 | smashball_bully = Creature:new {
objectName = "@mob/creature_names:smashball_bully",
randomNameType = NAME_GENERIC_TAG,
socialGroup = "smashball",
faction = "smashball",
level = 7,
chanceHit = 0.260000,
damageMin = 70,
damageMax = 75,
baseXp = 187,
baseHAM = 180,
baseHAMmax = 220,
armor = 0,
resists = {0,0,0,0,0,0,0,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.000000,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_goon_twk_female_01.iff",
"object/mobile/dressed_goon_twk_male_01.iff",
"object/mobile/dressed_crook_zabrak_female_01.iff",
"object/mobile/dressed_crook_zabrak_male_01.iff",
"object/mobile/dressed_desperado_bith_female_01.iff",
"object/mobile/dressed_desperado_bith_male_01.iff",
"object/mobile/dressed_hoodlum_zabrak_female_01.iff",
"object/mobile/dressed_hoodlum_zabrak_male_01.iff",
"object/mobile/dressed_hooligan_rodian_female_01.iff",
"object/mobile/dressed_hooligan_rodian_male_01.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 6000000},
{group = "loot_kit_parts", chance = 2500000},
{group = "tailor_components", chance = 1500000}
}
}
},
weapons = {"pirate_weapons_medium"},
reactionStf = "@npc_reaction/slang",
attacks = merge(brawlernovice,marksmannovice)
}
CreatureTemplates:addCreatureTemplate(smashball_bully, "smashball_bully")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/space/droid_interface/basic_droid_interface.lua | 3 | 2324 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_space_droid_interface_basic_droid_interface = object_draft_schematic_space_droid_interface_shared_basic_droid_interface:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_space_droid_interface_basic_droid_interface, "object/draft_schematic/space/droid_interface/basic_droid_interface.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/ship/blacksun_heavy_s04_tier3.lua | 3 | 2204 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_ship_blacksun_heavy_s04_tier3 = object_ship_shared_blacksun_heavy_s04_tier3:new {
}
ObjectTemplates:addTemplate(object_ship_blacksun_heavy_s04_tier3, "object/ship/blacksun_heavy_s04_tier3.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_brigade_gunner_bith_male_01.lua | 3 | 2256 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_brigade_gunner_bith_male_01 = object_mobile_shared_dressed_brigade_gunner_bith_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_brigade_gunner_bith_male_01, "object/mobile/dressed_brigade_gunner_bith_male_01.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/npc/serverobjects.lua | 3 | 2102 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
-- Server Objects
includeFile("tangible/lair/npc/lair_npc_general.lua")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/furniture/serverobjects.lua | 3 | 2941 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
includeFile("tangible/furniture/all/serverobjects.lua")
includeFile("tangible/furniture/base/serverobjects.lua")
includeFile("tangible/furniture/cheap/serverobjects.lua")
includeFile("tangible/furniture/city/serverobjects.lua")
includeFile("tangible/furniture/decorative/serverobjects.lua")
includeFile("tangible/furniture/elegant/serverobjects.lua")
includeFile("tangible/furniture/imperial/serverobjects.lua")
includeFile("tangible/furniture/jedi/serverobjects.lua")
includeFile("tangible/furniture/modern/serverobjects.lua")
includeFile("tangible/furniture/plain/serverobjects.lua")
includeFile("tangible/furniture/space/serverobjects.lua")
includeFile("tangible/furniture/tatooine/serverobjects.lua")
includeFile("tangible/furniture/technical/serverobjects.lua")
-- Server Objects
includeFile("tangible/furniture/furniture_base.lua")
includeFile("tangible/furniture/furniture_tatooine_cantina_seat_01.lua")
| agpl-3.0 |
Whitechaser/darkstar | scripts/globals/weaponskills/black_halo.lua | 25 | 1568 | -----------------------------------
-- Black Halo
-- Club weapon skill
-- Skill level: 230
-- In order to obtain Black Halo, the quest Orastery Woes must be completed.
-- Delivers a two-hit attack. Damage varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Shadow Gorget, Thunder Gorget & Breeze Gorget.
-- Aligned with the Shadow Belt, Thunder Belt & Breeze Belt.
-- Element: None
-- Modifiers: STR:30% ; MND:50%
-- 100%TP 200%TP 300%TP
-- 1.50 2.50 3.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {};
params.numHits = 2;
params.ftp100 = 1.5; params.ftp200 = 2.5; params.ftp300 = 3;
params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.5; params.chr_wsc = 0.0;
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 = 3.0; params.ftp200 = 7.25; params.ftp300 = 9.75;
params.mnd_wsc = 0.7;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, tp, primary, action, taChar, params);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/naboo/gungan_guard.lua | 1 | 1078 | gungan_guard = Creature:new {
objectName = "@mob/creature_names:gungan_guard",
randomNameType = NAME_GENERIC_TAG,
socialGroup = "gungan",
faction = "gungan",
level = 16,
chanceHit = 0.31,
damageMin = 170,
damageMax = 180,
baseXp = 960,
baseHAM = 2900,
baseHAMmax = 3500,
armor = 0,
resists = {5,5,5,-1,25,-1,-1,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {"object/mobile/gungan_male.iff",
"object/mobile/gungan_s02_male.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "gungan_common", chance = 2000000},
{group = "tailor_components", chance = 2000000},
{group = "loot_kit_parts", chance = 2000000}
}
}
},
weapons = {"rebel_weapons_medium"},
conversationTemplate = "",
attacks = merge(brawlermaster,marksmanmaster)
}
CreatureTemplates:addCreatureTemplate(gungan_guard, "gungan_guard")
| agpl-3.0 |
DailyShana/ygopro-scripts | c47754278.lua | 5 | 2229 | --ヘル・ドラゴン
function c47754278.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(47754278,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c47754278.descon)
e1:SetTarget(c47754278.destg)
e1:SetOperation(c47754278.desop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(47754278,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CVAL_CHECK)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c47754278.spcon)
e2:SetCost(c47754278.spcost)
e2:SetTarget(c47754278.sptg)
e2:SetOperation(c47754278.spop)
e2:SetValue(c47754278.valcheck)
c:RegisterEffect(e2)
end
function c47754278.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetAttackAnnouncedCount()~=0
end
function c47754278.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function c47754278.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
function c47754278.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c47754278.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetFlagEffect(tp,47754278)==0 then
Duel.RegisterFlagEffect(tp,47754278,RESET_CHAIN,0,1)
c47754278[0]=Duel.GetReleaseGroupCount(tp)
c47754278[1]=0
end
return c47754278[0]-c47754278[1]>=1
end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,nil)
Duel.Release(g,REASON_COST)
end
function c47754278.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c47754278.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c47754278.valcheck(e)
c47754278[1]=c47754278[1]+1
end
| gpl-2.0 |
DailyShana/ygopro-scripts | c85771019.lua | 3 | 3119 | --堕天使アスモディウス
function c85771019.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_DECK+LOCATION_GRAVE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--to grave
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(85771019,0))
e2:SetCategory(CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(c85771019.tgtg)
e2:SetOperation(c85771019.tgop)
c:RegisterEffect(e2)
--token
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(85771019,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c85771019.spcon)
e3:SetTarget(c85771019.sptg)
e3:SetOperation(c85771019.spop)
c:RegisterEffect(e3)
end
function c85771019.tgfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_FAIRY) and c:IsAbleToGrave()
end
function c85771019.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c85771019.tgfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c85771019.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c85771019.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function c85771019.spcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_DESTROY)~=0 and e:GetHandler():GetPreviousControler()==tp
and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c85771019.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,0,0)
end
function c85771019.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
if Duel.IsPlayerCanSpecialSummonMonster(tp,85771020,0,0x4011,1800,1300,5,RACE_FAIRY,ATTRIBUTE_DARK) then
local token=Duel.CreateToken(tp,85771020)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1)
end
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,85771021,0,0x4011,1200,1200,3,RACE_FAIRY,ATTRIBUTE_DARK) then
local token=Duel.CreateToken(tp,85771021)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1)
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/helmet/helmet_atat.lua | 2 | 3955 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_wearables_helmet_helmet_atat = object_tangible_wearables_helmet_shared_helmet_atat:new {
faction = "Imperial",
playerRaces = { "object/creature/player/bothan_male.iff",
"object/creature/player/bothan_female.iff",
"object/creature/player/human_male.iff",
"object/creature/player/human_female.iff",
"object/creature/player/moncal_male.iff",
"object/creature/player/moncal_female.iff",
"object/creature/player/rodian_male.iff",
"object/creature/player/rodian_female.iff",
"object/creature/player/sullustan_male.iff",
"object/creature/player/sullustan_female.iff",
"object/creature/player/trandoshan_male.iff",
"object/creature/player/trandoshan_female.iff",
"object/creature/player/twilek_male.iff",
"object/creature/player/twilek_female.iff",
"object/creature/player/zabrak_male.iff",
"object/creature/player/zabrak_female.iff",
"object/mobile/vendor/aqualish_female.iff",
"object/mobile/vendor/aqualish_male.iff",
"object/mobile/vendor/bothan_female.iff",
"object/mobile/vendor/bothan_male.iff",
"object/mobile/vendor/devaronian_male.iff",
"object/mobile/vendor/human_female.iff",
"object/mobile/vendor/human_male.iff",
"object/mobile/vendor/moncal_female.iff",
"object/mobile/vendor/moncal_male.iff",
"object/mobile/vendor/nikto_male.iff",
"object/mobile/vendor/rodian_female.iff",
"object/mobile/vendor/rodian_male.iff",
"object/mobile/vendor/sullustan_female.iff",
"object/mobile/vendor/sullustan_male.iff",
"object/mobile/vendor/trandoshan_female.iff",
"object/mobile/vendor/trandoshan_male.iff",
"object/mobile/vendor/twilek_female.iff",
"object/mobile/vendor/twilek_male.iff",
"object/mobile/vendor/zabrak_female.iff",
"object/mobile/vendor/zabrak_male.iff" },
}
ObjectTemplates:addTemplate(object_tangible_wearables_helmet_helmet_atat, "object/tangible/wearables/helmet/helmet_atat.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/scout/camp/camp_multi.lua | 2 | 2775 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_scout_camp_camp_multi = object_tangible_scout_camp_shared_camp_multi:new {
templateType = CAMPKIT,
objectMenuComponent = {"cpp", "CampKitMenuComponent"},
spawnObjectTemplate = "object/building/poi/scout_camp_s1.iff",
numberExperimentalProperties = {1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "hitpoints", "quality"},
experimentalMin = {0, 0, 1000, 1},
experimentalMax = {0, 0, 1000, 100},
experimentalPrecision = {0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 1},
}
ObjectTemplates:addTemplate(object_tangible_scout_camp_camp_multi, "object/tangible/scout/camp/camp_multi.iff")
| agpl-3.0 |
pguillory/luajit-libuv | src/uv/util/async.lua | 2 | 1432 | local ffi = require 'ffi'
local join = require 'uv/util/join'
local libuv = require 'uv/libuv'
local async, threads, id = {}, {}, 0
setmetatable(async, async)
local red_on_black = '\27[31;40m'
local green_on_black = '\27[32;40m'
local yellow_on_black = '\27[33;40m'
local white_on_black = '\27[37;40m'
local function log(color, method, id, req, info)
local source = info.short_src .. ':' .. info.currentline
print(string.format('%s%-8s %-5i %-42s %-10s %s%s', color, method, id, req, info.name, source, white_on_black))
io.flush()
end
function async.yield(req)
local thread = coroutine.running()
if not thread then
local retval
local thread = coroutine.create(function()
retval = { async.yield(req) }
end)
local ok = coroutine.resume(thread)
libuv.uv_default_loop():run()
return unpack(retval)
end
while threads[id] do
id = bit.band(id + 1, 0xFFFFFFFFFFFF) -- lower 48 bits
end
-- log(yellow_on_black, 'yield', id, req, debug.getinfo(2))
req.data = ffi.cast('void*', id)
threads[id] = thread
return coroutine.yield()
end
function async.resume(req, ...)
local id = tonumber(ffi.cast('int', req.data))
local thread = threads[id]
-- log(green_on_black, 'resume', id, req, debug.getinfo(thread, 1))
threads[id] = nil
return join(thread, ...)
end
function async:__index(ctype)
self[ctype] = ffi.cast(ctype, self.resume)
return self[ctype]
end
return async
| mit |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/tauntaun_hue.lua | 3 | 2164 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_tauntaun_hue = object_mobile_shared_tauntaun_hue:new {
}
ObjectTemplates:addTemplate(object_mobile_tauntaun_hue, "object/mobile/tauntaun_hue.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/crafted/chassis/hutt_light_s02_deed.lua | 3 | 2457 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_ship_crafted_chassis_hutt_light_s02_deed = object_tangible_ship_crafted_chassis_shared_hutt_light_s02_deed:new {
templateType = SHIPDEED,
shipControlObject = "object/intangible/ship/hutt_light_02_pcd.iff",
generatedObjectTemplate = "object/ship/player/player_hutt_light_s02.iff",
}
ObjectTemplates:addTemplate(object_tangible_ship_crafted_chassis_hutt_light_s02_deed, "object/tangible/ship/crafted/chassis/hutt_light_s02_deed.iff")
| agpl-3.0 |
mswf/MeepMeep | lua/base/signal.lua | 1 | 1789 |
local weakMT = {
__mode = "kv"
}
Signal = class(Signal, function(self)
self._callbacks = {
setmetatable({}, weakMT),
setmetatable({}, weakMT),
setmetatable({}, weakMT)
}
self._callbacksOnce = {
setmetatable({}, weakMT),
setmetatable({}, weakMT),
setmetatable({}, weakMT)
}
end)
function Signal:add(callback, context, priority)
priority = priority or 2
self._callbacks[priority][context] = callback
end
function Signal:addOnce(callback, context, priority)
priority = priority or 2
self._callbacksOnce[priority][context] = callback
end
function Signal:remove(contextToRemove)
for i=1,3 do
for context, callback in pairs(self._callbacks[i]) do
if (context == contextToRemove) then
self._callbacks[i][context] = nil
return
end
end
end
end
function Signal:removeOnce(contextToRemove)
for i=1,3 do
for context, callback in pairs(self._callbacksOnce[i]) do
if (context == contextToRemove) then
self._callbacksOnce[i][context] = nil
return true
end
end
end
return false
end
function Signal:removeAll()
self._callbacks = {
setmetatable({}, weakMT),
setmetatable({}, weakMT),
setmetatable({}, weakMT)
}
self._callbacksOnce = {
setmetatable({}, weakMT),
setmetatable({}, weakMT),
setmetatable({}, weakMT)
}
end
function Signal:__call(...)
self:dispatch(...)
end
function Signal:dispatch(...)
local callbacksOnceDirty = false
for i=1,3 do
for context, callback in pairs(self._callbacks[i]) do
callback(context, ...)
end
for context, callback in pairs(self._callbacksOnce[i]) do
callbacksOnceDirty = true
callback(context, ...)
end
end
if (callbacksOnceDirty) then
self._callbacksOnce = {
setmetatable({}, weakMT),
setmetatable({}, weakMT),
setmetatable({}, weakMT)
}
end
end
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/furniture/plain/plain_love_seat_s01.lua | 3 | 2264 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_furniture_plain_plain_love_seat_s01 = object_tangible_furniture_plain_shared_plain_love_seat_s01:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_plain_plain_love_seat_s01, "object/tangible/furniture/plain/plain_love_seat_s01.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/globals/abilities/pets/knockout.lua | 2 | 1427 | ---------------------------------------------------
-- Knockout
---------------------------------------------------
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/automatonweaponskills")
---------------------------------------------------
function onMobSkillCheck(target, automaton, skill)
local master = automaton:getMaster()
return master:countEffect(dsp.effects.WIND_MANEUVER)
end
function onPetAbility(target, automaton, skill, master, action)
local params = {
numHits = 1,
atkmulti = 1,
accBonus = 50,
weaponType = SKILL_CLB,
ftp100 = 4.0,
ftp200 = 5.0,
ftp300 = 5.5,
acc100 = 0.0,
acc200 = 0.0,
acc300 = 0.0,
str_wsc = 0.0,
dex_wsc = 0.0,
vit_wsc = 0.0,
agi_wsc = 0.0,
int_wsc = 0.0,
mnd_wsc = 0.0,
chr_wsc = 0.0
}
if USE_ADOULIN_WEAPON_SKILL_CHANGES then
params.agi_wsc = 1.0
params.ftp100 = 6.0
params.ftp200 = 8.5
params.ftp300 = 11.0
end
local damage = doAutoPhysicalWeaponskill(automaton, target, 0, skill:getTP(), true, action, false, params, skill, action)
if damage > 0 then
if not target:hasStatusEffect(dsp.effects.EVASION_DOWN) then
target:addStatusEffect(dsp.effects.EVASION_DOWN, 10, 0, 30)
end
end
return damage
end
| gpl-3.0 |
KingRaptor/Zero-K | units/fighterdrone.lua | 1 | 3987 | unitDef = {
unitname = [[fighterdrone]],
name = [[Spicula]],
description = [[Fighter Drone]],
brakerate = 0.4,
buildCostMetal = 100,
buildPic = [[fighterdrone.png]],
canAttack = true,
canFly = true,
canGuard = true,
canMove = true,
canPatrol = true,
canstop = [[1]],
canSubmerge = false,
category = [[FIXEDWING]],
collide = false,
collisionVolumeOffsets = [[0 0 5]],
collisionVolumeScales = [[25 8 40]],
collisionVolumeType = [[box]],
crashDrag = 0.02,
cruiseAlt = 250,
canLand = false,
customParams = {
description_fr = [[Drone Chasseur]],
description_de = [[Kappenjaegerdrohne]],
helptext = [[The Spicula is a fast multirole fighter drone whose particle beam is effective against both land and air targets.]],
--helptext_fr = [[Capable de tirer en l'air ou au sol le Spicula n'est efficace qu'en groupe. Sa puissance de feu limité le rends moins éfficace qu'un aeronef dédié au combat Air/Sol ou au Air/Air.]],
helptext_de = [[Der Spicula ist eine schnelle Kappenjaegerdrohne, der kann Luft- und Landeinheiten schiessen.]],
modelradius = [[5]],
refuelturnradius = [[80]],
is_drone = 1,
},
explodeAs = [[GUNSHIPEX]],
fireState = 2,
floater = true,
footprintX = 2,
footprintZ = 2,
frontToSpeed = 0,
iconType = [[fighter]],
idleAutoHeal = 5,
idleTime = 1800,
maneuverleashlength = [[400]],
maxAcc = 0.7,
maxDamage = 360,
maxVelocity = 8,
maxElevator = 0.02,
maxRudder = 0.006,
--maxPitch = 0.1,
minCloakDistance = 75,
mygravity = 1,
noAutoFire = false,
noChaseCategory = [[TERRAFORM SUB]],
objectName = [[fighterdrone.dae]],
script = [[fighterdrone.lua]],
selfDestructAs = [[GUNSHIPEX]],
sfxtypes = {
explosiongenerators = {
[[custom:MUZZLE_ORANGE]],
[[custom:FF_PUFF]],
[[custom:BEAMWEAPON_MUZZLE_RED]],
[[custom:FLAMER]],
},
},
sightDistance = 520,
speedToFront = 0,
turnRate = 9001,
turnRadius = 90,
weapons = {
{
def = [[LASER]],
mainDir = [[0 0 1]],
maxAngleDif = 90,
onlyTargetCategory = [[FIXEDWING LAND SINK TURRET SHIP SWIM FLOAT GUNSHIP HOVER]],
},
},
weaponDefs = {
LASER = {
name = [[Rapid-Fire Particle Beam]],
beamDecay = 0.8,
beamTime = 1/30,
beamttl = 6,
coreThickness = 0.2,
craterBoost = 0,
craterMult = 0,
cylinderTargeting = 1,
damage = {
default = 33,
subs = 2.2,
},
explosionGenerator = [[custom:BEAMWEAPON_HIT_RED]],
fireStarter = 100,
impactOnly = true,
impulseFactor = 0,
interceptedByShieldType = 1,
laserFlareSize = 3.25,
minIntensity = 1,
range = 500,
reloadtime = 0.2,
rgbColor = [[1 0 0]],
soundStart = [[weapon/laser/mini_laser]],
soundStartVolume = 4,
thickness = 2,
tolerance = 8192,
turret = true,
weaponType = [[BeamLaser]],
},
},
}
return lowerkeys({ fighterdrone = unitDef })
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/graul/objects.lua | 3 | 5452 | --Copyright (C) 2009 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
object_tangible_lair_graul_shared_lair_graul = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/graul/shared_lair_graul.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/poi_all_lair_rancor_dark.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 25,
clientDataFile = "clientdata/client_shared_lair_small.cdf",
clientGameObjectType = 4,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@lair_d:graul",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:graul",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 1881708167,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/lair/base/shared_lair_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_lair_graul_shared_lair_graul, "object/tangible/lair/graul/shared_lair_graul.iff")
object_tangible_lair_graul_shared_lair_graul_jungle = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/graul/shared_lair_graul_jungle.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/poi_all_lair_rancor_dark.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 25,
clientDataFile = "clientdata/client_shared_lair_small.cdf",
clientGameObjectType = 4,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@lair_d:graul_jungle",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:graul_jungle",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 1200430930,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/lair/base/shared_lair_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_lair_graul_shared_lair_graul_jungle, "object/tangible/lair/graul/shared_lair_graul_jungle.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/furniture/city/city_furniture.lua | 3 | 2240 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_furniture_city_city_furniture = object_tangible_furniture_city_shared_city_furniture:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_city_city_furniture, "object/tangible/furniture/city/city_furniture.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Bastok_Mines/npcs/Vaghron.lua | 5 | 1099 | -----------------------------------
-- Area: Bastok Mines
-- NPC: Vaghron
-- Type: Adventurer's Assistant
-- !pos -39.162 -1 -92.147 234
-----------------------------------
package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/zones/Bastok_Mines/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local WildcatBastok = player:getVar("WildcatBastok");
if (player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,19) == false) then
player:startEvent(503);
else
player:startEvent(118);
end
end;
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 503) then
player:setMaskBit(player:getVar("WildcatBastok"),"WildcatBastok",19,true);
end
end;
| gpl-3.0 |
LuaDist2/lua-llthreads2 | lakeconfig.lua | 8 | 5403 | local io = require "io"
io.stdout:setvbuf"no"
io.stderr:setvbuf"no"
function vc_version()
local VER = lake.compiler_version()
MSVC_VER = ({
[15] = '9';
[16] = '10';
})[VER.MAJOR] or ''
return MSVC_VER
end
if not L then
local function arkey(t)
assert(type(t) == 'table')
local keys = {}
for k in pairs(t) do
assert(type(k) == 'number')
table.insert(keys, k)
end
table.sort(keys)
return keys
end
local function ikeys(t)
local keys = arkey(t)
local i = 0
return function()
i = i + 1
local k = keys[i]
if k == nil then return end
return k, t[k]
end
end
local function expand(arr, t)
if t == nil then return arr end
if type(t) ~= 'table' then
table.insert(arr, t)
return arr
end
for _, v in ikeys(t) do
expand(arr, v)
end
return arr
end
function L(...)
return expand({}, {...})
end
end
J = J or path.join
IF = IF or lake.choose or choose
DIR_SEP = package.config:sub(1,1)
function prequire(...)
local ok, mod = pcall(require, ...)
if ok then return mod end
end
function clone(t, o)
o = o or {}
for k, v in pairs(t) do
if o[k] == nil then o[k] = v end
end
return o
end
function each_join(dir, list)
for i, v in ipairs(list) do
list[i] = path.join(dir, v)
end
return list
end
function run(file, cwd)
print()
print("run " .. file)
if not TESTING then
if cwd then lake.chdir(cwd) end
local status, code = utils.execute( LUA_RUNNER .. ' ' .. file )
if cwd then lake.chdir("<") end
print()
return status, code
end
return true, 0
end
function exec(file, cwd)
print()
print("exec " .. file)
if not TESTING then
if cwd then lake.chdir(cwd) end
local status, code = utils.execute( file )
if cwd then lake.chdir("<") end
print()
return status, code
end
return true, 0
end
local TESTS = {}
function run_test(name, params)
local test_dir = TESTDIR or J(ROOT, 'test')
local cmd = J(test_dir, name)
if params then cmd = cmd .. ' ' .. params end
local ok = run(cmd, test_dir)
table.insert(TESTS, {cmd = cmd, result = ok})
print("TEST " .. name .. (ok and ' - pass!' or ' - fail!'))
end
function exec_test(name, params)
local test_dir = TESTDIR or J(ROOT, 'test')
local cmd = J(test_dir, name)
if params then cmd = cmd .. ' ' .. params end
local ok = exec(cmd, test_dir)
table.insert(TESTS, {cmd = cmd, result = ok})
print("TEST " .. name .. (ok and ' - pass!' or ' - fail!'))
end
function test_summary()
local ok = true
print("")
print("------------------------------------")
print("Number of tests:", #TESTS)
for _, t in ipairs(TESTS) do
ok = ok and t.result
print((t.result and ' Pass' or ' Fail') .. " - TEST " .. t.cmd)
end
print("------------------------------------")
print("")
return ok
end
--[[spawn]] if WINDOWS then
function spawn(file, cwd)
local winapi = prequire "winapi"
if not winapi then
quit('needs winapi for spawn!')
return false
end
print("spawn " .. file)
if not TESTING then
if cwd then lake.chdir(cwd) end
assert(winapi.shell_exec(nil, LUA_RUNNER, file, cwd))
if cwd then lake.chdir("<") end
print()
end
return true
end
else
function spawn(file, cwd)
print("spawn " .. file)
if not TESTING then
assert(run(file .. ' &', cwd))
end
return true
end
end
function as_bool(v,d)
if v == nil then return not not d end
local n = tonumber(v)
if n == 0 then return false end
if n then return true end
return false
end
--- set global variables
-- LUA_NEED
-- LUA_DIR
-- LUA_RUNNER
-- ROOT
-- LUADIR
-- LIBDIR
-- TESTDIR
-- DOCDIR
-- DYNAMIC
function INITLAKEFILE()
if LUA_VER == '5.3' then
LUA_NEED = 'lua53'
LUA_DIR = ENV.LUA_DIR_5_3 or ENV.LUA_DIR
LUA_RUNNER = LUA_RUNNER or 'lua53'
elseif LUA_VER == '5.2' then
LUA_NEED = 'lua52'
LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR
LUA_RUNNER = LUA_RUNNER or 'lua52'
elseif LUA_VER == '5.1' then
LUA_NEED = 'lua51'
LUA_DIR = ENV.LUA_DIR
LUA_RUNNER = LUA_RUNNER or 'lua'
else
LUA_NEED = 'lua'
LUA_DIR = ENV.LUA_DIR
LUA_RUNNER = LUA_RUNNER or 'lua'
end
ROOT = ROOT or J( LUA_DIR, 'libs', PROJECT )
LUADIR = LUADIR or J( ROOT, 'share' )
LIBDIR = LIBDIR or J( ROOT, 'share' )
TESTDIR = TESTDIR or J( ROOT, 'test' )
DOCDIR = DOCDIR or J( ROOT, 'doc' )
DYNAMIC = as_bool(DYNAMIC, false)
end
-----------------------
-- needs --
-----------------------
lake.define_need('lua53', function()
return {
incdir = J(ENV.LUA_DIR_5_3, 'include');
libdir = J(ENV.LUA_DIR_5_3, 'lib');
libs = {'lua53'};
}
end)
lake.define_need('lua52', function()
return {
incdir = J(ENV.LUA_DIR_5_2, 'include');
libdir = J(ENV.LUA_DIR_5_2, 'lib');
libs = {'lua52'};
}
end)
lake.define_need('lua51', function()
return {
incdir = J(ENV.LUA_DIR, 'include');
libdir = J(ENV.LUA_DIR, 'lib');
libs = {'lua5.1'};
}
end)
lake.define_need('pthread', function()
return {
libs = 'pthread';
}
end) | mit |
EddyK69/domoticz | dzVents/runtime/device-adapters/temperature_humidity_device.lua | 14 | 1051 | local humidityMapping = {
['dry'] = 2,
['normal'] = 0,
['comfortable'] = 1,
['wet'] = 3
}
return {
baseType = 'device',
name = 'Temperature+humidity device adapter',
matches = function (device, adapterManager)
local res = (device.deviceType == 'Temp + Humidity')
if (not res) then
adapterManager.addDummyMethod(device, 'updateTempHum')
end
return res
end,
process = function (device, data, domoticz, utils, adapterManager)
-- from data: dewPoint, humidity, humidityStatus, temperature
local humVal = humidityMapping[string.lower(device.humidityStatus or '')] or -1
device.humidityStatusValue = humVal
function device.updateTempHum(temperature, humidity, status)
if (status == nil) then
-- when no status is provided, domoticz will not set the device obviously
utils.log('No status provided. Temperature + humidity not set', utils.LOG_ERROR)
return
end
local value = tostring(temperature) .. ';' .. tostring(humidity) .. ';' .. tostring(status)
return device.update(0, value)
end
end
} | gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/soundobject/soundobject_water_gurgle.lua | 3 | 2232 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_soundobject_soundobject_water_gurgle = object_soundobject_shared_soundobject_water_gurgle:new {
}
ObjectTemplates:addTemplate(object_soundobject_soundobject_water_gurgle, "object/soundobject/soundobject_water_gurgle.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/deed/city_deed/garden_dathomir_lrg_01_deed.lua | 3 | 2869 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_deed_city_deed_garden_dathomir_lrg_01_deed = object_tangible_deed_city_deed_shared_garden_dathomir_lrg_01_deed:new {
templateType = STRUCTUREDEED,
placeStructureComponent = "PlaceDecorationComponent",
gameObjectType = 8388609,
generatedObjectTemplate = "object/building/player/city/garden_dathomir_lrg_01.iff",
numberExperimentalProperties = {1, 1, 1},
experimentalProperties = {"XX", "XX", "XX"},
experimentalWeights = {1, 1, 1},
experimentalGroupTitles = {"null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "hitpoints"},
experimentalMin = {0, 0, 35000},
experimentalMax = {0, 0, 75000},
experimentalPrecision = {0, 0, 0},
experimentalCombineType = {0, 0, 4},
}
ObjectTemplates:addTemplate(object_tangible_deed_city_deed_garden_dathomir_lrg_01_deed, "object/tangible/deed/city_deed/garden_dathomir_lrg_01_deed.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/structure/dathomir/mtn_clan_pillar_s01.lua | 3 | 2268 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_dathomir_mtn_clan_pillar_s01 = object_static_structure_dathomir_shared_mtn_clan_pillar_s01:new {
}
ObjectTemplates:addTemplate(object_static_structure_dathomir_mtn_clan_pillar_s01, "object/static/structure/dathomir/mtn_clan_pillar_s01.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/soundobject/soundobject_river_small.lua | 3 | 2228 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser 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
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_soundobject_soundobject_river_small = object_soundobject_shared_soundobject_river_small:new {
}
ObjectTemplates:addTemplate(object_soundobject_soundobject_river_small, "object/soundobject/soundobject_river_small.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Temenos/mobs/Kindred_Dark_Knight.lua | 28 | 1108 | -----------------------------------
-- Area: Temenos N T
-- NPC: Kindred_Dark_Knight
-----------------------------------
package.loaded["scripts/zones/Temenos/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/limbus");
require("scripts/zones/Temenos/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, player, isKiller)
if (IsMobDead(16928797)==true and IsMobDead(16928798)==true and IsMobDead(16928799)==true ) then
GetNPCByID(16928768+27):setPos(-120,-80,429);
GetNPCByID(16928768+27):setStatus(STATUS_NORMAL);
GetNPCByID(16928768+161):setPos(-123,-80,429);
GetNPCByID(16928768+161):setStatus(STATUS_NORMAL);
GetNPCByID(16928768+212):setPos(-117,-80,429);
GetNPCByID(16928768+212):setStatus(STATUS_NORMAL);
end
end; | gpl-3.0 |
DailyShana/ygopro-scripts | c25700114.lua | 3 | 2748 | --ダストンローラー
function c25700114.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c25700114.target)
e1:SetOperation(c25700114.activate)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(25700114,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c25700114.thcon)
e2:SetTarget(c25700114.thtg)
e2:SetOperation(c25700114.thop)
c:RegisterEffect(e2)
end
function c25700114.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c25700114.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UNRELEASABLE_SUM)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_NONSUM)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e5)
end
end
function c25700114.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return rp~=tp and bit.band(r,0x41)==0x41 and c:GetPreviousControler()==tp
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN)
end
function c25700114.filter(c)
return c:IsSetCard(0x80) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c25700114.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c25700114.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c25700114.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c25700114.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/thug/traveller.lua | 1 | 2668 | traveller = Creature:new {
objectName = "",
randomNameType = NAME_GENERIC_TAG,
customName = "a Traveller",
socialGroup = "wilder",
faction = "",
level = 4,
chanceHit = 0.24,
damageMin = 40,
damageMax = 45,
baseXp = 85,
baseHAM = 113,
baseHAMmax = 138,
armor = 0,
resists = {20,20,10,25,35,10,10,10,0},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + STALKER,
optionsBitmask = 128,
diet = HERBIVORE,
templates = { "object/mobile/dressed_commoner_old_human_female_01.iff",
"object/mobile/dressed_commoner_old_human_female_02.iff",
"object/mobile/dressed_commoner_old_human_male_01.iff",
"object/mobile/dressed_commoner_old_human_male_02.iff",
"object/mobile/dressed_commoner_old_twilek_female_01.iff",
"object/mobile/dressed_commoner_old_twilek_female_02.iff",
"object/mobile/dressed_commoner_old_twilek_male_01.iff",
"object/mobile/dressed_commoner_old_twilek_male_02.iff",
"object/mobile/dressed_commoner_old_zabrak_female_01.iff",
"object/mobile/dressed_commoner_old_zabrak_female_02.iff",
"object/mobile/dressed_commoner_old_zabrak_male_01.iff",
"object/mobile/dressed_commoner_old_zabrak_male_02.iff",
"object/mobile/dressed_commoner_artisan_bith_male_01.iff",
"object/mobile/dressed_commoner_artisan_sullustan_male_01.iff",
"object/mobile/dressed_commoner_artisan_trandoshan_male_01.iff",
"object/mobile/dressed_commoner_fat_human_female_01.iff",
"object/mobile/dressed_commoner_fat_human_female_02.iff",
"object/mobile/dressed_commoner_fat_human_male_01.iff",
"object/mobile/dressed_commoner_fat_human_male_02.iff",
"object/mobile/dressed_commoner_fat_twilek_female_01.iff",
"object/mobile/dressed_commoner_fat_twilek_female_02.iff",
"object/mobile/dressed_commoner_fat_twilek_male_01.iff",
"object/mobile/dressed_commoner_fat_twilek_male_02.iff",
"object/mobile/dressed_commoner_fat_zabrak_female_01.iff",
"object/mobile/dressed_commoner_fat_zabrak_female_02.iff",
"object/mobile/dressed_commoner_fat_zabrak_male_01.iff",
"object/mobile/dressed_commoner_fat_zabrak_male_02.iff", },
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "wearables_common", chance = 3000000},
{group = "loot_kit_parts", chance = 2000000},
{group = "tailor_components", chance = 1000000},
}
}
},
weapons = {"rebel_weapons_medium"},
conversationTemplate = "",
reactionStf = "@npc_reaction/townperson",
attacks = merge(marksmannovice,brawlernovice)
}
CreatureTemplates:addCreatureTemplate(traveller, "traveller")
| agpl-3.0 |
nesstea/darkstar | scripts/zones/Lufaise_Meadows/npcs/Jersey.lua | 13 | 1910 | -----------------------------------
-- Area: Lufaise Meadows
-- NPC: Jersey
-- Type: Outpost Vendor
-- @pos -548.706 -7.197 -53.897 24
-----------------------------------
package.loaded["scripts/zones/Lufaise_Meadows/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Lufaise_Meadows/TextIDs");
local region = TAVNAZIANARCH;
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 |
FailcoderAddons/supervillain-ui | SVUI_UnitFrames/libs/Plugins/oUF_Gladiator/oUF_Gladiator.lua | 3 | 6193 | --GLOBAL NAMESPACE
local _G = _G;
--LUA
local unpack = _G.unpack;
local select = _G.select;
local assert = _G.assert;
local error = _G.error;
local print = _G.print;
local pairs = _G.pairs;
local next = _G.next;
local tostring = _G.tostring;
local setmetatable = _G.setmetatable;
--STRING
local string = _G.string;
local format = string.format;
--MATH
local math = _G.math;
local floor = math.floor
local ceil = math.ceil
--BLIZZARD API
local GetTime = _G.GetTime;
local CreateFrame = _G.CreateFrame;
local UnitIsEnemy = _G.UnitIsEnemy;
local UnitGUID = _G.UnitGUID;
local IsActiveBattlefieldArena = _G.IsActiveBattlefieldArena;
local UnitFactionGroup = _G.UnitFactionGroup;
local GetNumArenaOpponentSpecs = _G.GetNumArenaOpponentSpecs;
local GetArenaOpponentSpec = _G.GetArenaOpponentSpec;
local GetSpecializationInfoByID = _G.GetSpecializationInfoByID;
local UnitName = _G.UnitName;
local SendChatMessage = _G.SendChatMessage;
local CooldownFrame_Set = _G.CooldownFrame_Set;
local _, ns = ...
local oUF = ns.oUF
local trinketSpells = {
[59752] = 120,
[42292] = 120,
[7744] = 45,
}
local timeLeft = 0
local Trinket_OnUpdate = function(self, elapsed)
local expires = (self.duration - (GetTime() - self.start));
if(expires == 0) then
local parent = self:GetParent()
parent.Icon:SetDesaturated(false)
parent.Unavailable:Hide()
self:SetScript("OnUpdate", nil)
end
end
local function GetPVPIcons(unit, frameID)
local _, trinket, badge
local unitFactionGroup = UnitFactionGroup(unit)
if unitFactionGroup == "Horde" then
trinket, badge = [[Interface\Icons\INV_Jewelry_TrinketPVP_02]], [[Interface\Icons\INV_BannerPVP_01]]
elseif unitFactionGroup == "Alliance" then
trinket, badge = [[Interface\Icons\INV_Jewelry_TrinketPVP_01]], [[Interface\Icons\INV_BannerPVP_02]]
else
trinket, badge = [[Interface\Icons\INV_MISC_QUESTIONMARK]], [[Interface\Icons\INV_MISC_QUESTIONMARK]]
end
if(frameID) then
local numOpps = GetNumArenaOpponentSpecs()
local specID = GetArenaOpponentSpec(frameID)
if((numOpps > 0) and specID) then
_, _, _, badge = GetSpecializationInfoByID(specID)
end
end
return trinket, badge
end
local function LogUpdate(self, event, ...)
local arenaMatch = IsActiveBattlefieldArena()
local element = self.Gladiator
local trinket = element.Trinket
local alert = element.Alert
if not arenaMatch then trinket:Hide() return end
trinket:Show()
if(event == "COMBAT_LOG_EVENT_UNFILTERED") then
local _, eventType, _, sourceGUID, _, _, _, _, _, _, _, spellID = ...
if eventType == "SPELL_CAST_SUCCESS" and sourceGUID == UnitGUID(self.unit) and trinketSpells[spellID] then
local startTime = GetTime()
local duration = trinketSpells[spellID]
trinket.CD.start = startTime
trinket.CD.duration = duration
trinket.CD.nextUpdate = 0
trinket.CD:SetScript("OnUpdate", Trinket_OnUpdate)
trinket.Icon:SetDesaturated(true)
trinket.Unavailable:Show()
CooldownFrame_Set(trinket.CD, startTime, duration, 1)
end
elseif(alert and event == "UNIT_SPELLCAST_SUCCEEDED") then
local unitID, spellName, _, _, spellID = ...
if UnitIsEnemy("player", unitID) and (spellID == 118358 or spellID == 104270 or spellName:find("Drink")) then
SendChatMessage(("%s is drinking."):format(UnitName(self.unit)), "RAID_WARNING")
end
end
end
local Update = function(self, event, ...)
local unit, unitType = ...
if(event == "COMBAT_LOG_EVENT_UNFILTERED" or event == "UNIT_SPELLCAST_SUCCEEDED") then return LogUpdate(self, event, ...) end
if(not unit or unit ~= self.unit) then return end
local element = self.Gladiator
local trinket = element.Trinket
local badge = element.Badge
local arenaMatch = IsActiveBattlefieldArena()
local frameID = arenaMatch and self:GetID()
local tIcon, bIcon = GetPVPIcons(unit, frameID)
if(badge) then badge.Icon:SetTexture(bIcon) end
if(trinket) then
if(not arenaMatch) then trinket:Hide() return end
trinket.Icon:SetTexture(tIcon)
trinket:Show()
if event == 'PLAYER_ENTERING_WORLD' then
CooldownFrame_Set(trinket.CD, 1, 1, 1)
end
end
end
local Enable = function(self, unit)
--if(not unit:match("arena%d")) then return end
local element = self.Gladiator
if(element) then
local trinket = element.Trinket
local badge = element.Badge
self:RegisterEvent("ARENA_OPPONENT_UPDATE", Update)
self:RegisterEvent("PLAYER_ENTERING_WORLD", Update)
if(trinket) then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Update)
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", Update)
if not trinket.CD then
trinket.CD = CreateFrame("Cooldown", nil, trinket, "CooldownFrameTemplate")
trinket.CD:SetAllPoints(trinket)
end
if not trinket.Icon then
trinket.Icon = trinket:CreateTexture(nil, "BORDER")
trinket.Icon:SetAllPoints(trinket)
trinket.Icon:SetTexture([[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]])
end
if not trinket.Unavailable then
trinket.Unavailable = trinket:CreateTexture(nil, "OVERLAY")
trinket.Unavailable:SetAllPoints(trinket)
trinket.Unavailable:SetTexture([[Interface\BUTTONS\UI-GroupLoot-Pass-Up]])
end
trinket:Show()
end
if(badge) then
self:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS", Update)
if not badge.Icon then
badge.Icon = badge:CreateTexture(nil, "OVERLAY")
badge.Icon:SetAllPoints(badge)
badge.Icon:SetTexture([[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]])
end
badge:Show()
end
return true
end
end
local Disable = function(self)
local element = self.Gladiator
local trinket = element.Trinket
local badge = element.Badge
if(trinket or badge) then
self:UnregisterEvent("ARENA_OPPONENT_UPDATE", Update)
self:UnregisterEvent("PLAYER_ENTERING_WORLD", Update)
if trinket then
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Update)
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED", Update)
trinket:Hide()
end
if badge then
self:UnregisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS", Update)
badge:Hide()
end
end
end
oUF:AddElement('Gladiator', Update, Enable, Disable) | mit |
UnfortunateFruit/darkstar | scripts/zones/Port_San_dOria/npcs/HomePoint#2.lua | 12 | 1254 | -----------------------------------
-- Area: Port San dOria
-- NPC: HomePoint#2
-- @pos 48 -12.000 -105 232
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/Port_San_dOria/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fd, 7);
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 == 0x21fd) then
if (option == 1) then
player:setHomePoint();
player:messageSpecial(HOMEPOINT_SET);
else
hpTeleport( player, option);
end
end
end; | gpl-3.0 |
nesstea/darkstar | scripts/zones/Northern_San_dOria/npcs/Arnau.lua | 13 | 1785 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Arnau
-- Involved in Mission: Save the Children
-- @pos 148 0 139 231
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(COP) == THE_ROAD_FORKS and player:getVar("EMERALD_WATERS_Status") == 2) then
player:startEvent(0x0033); --COP event
elseif (player:getCurrentMission(SANDORIA) == SAVE_THE_CHILDREN and player:getVar("MissionStatus") < 2) then
player:startEvent(0x02b5);
elseif (player:hasCompletedMission(SANDORIA,SAVE_THE_CHILDREN) and player:getVar("OptionalCSforSTC") == 1) then
player:startEvent(0x02b6);
else
player:startEvent(0x0014);
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 == 0x0033) then
player:setVar("EMERALD_WATERS_Status",3);
elseif (csid == 0x02b5) then
player:setVar("MissionStatus",2);
elseif (csid == 0x02b6) then
player:setVar("OptionalCSforSTC",0);
end
end; | gpl-3.0 |
heyuqi/wxFormBuilder | build/premake/plugins/additional.lua | 1 | 1717 | -----------------------------------------------------------------------------
-- Name: additional.lua
-- Purpose: Additional controls plugin project build script.
-- Author: Andrea Zanellato
-- Modified by:
-- Created: 21/10/2011
-- Copyright: (c) 2011 wxFormBuilder Team
-- Licence: GNU General Public License Version 2
-----------------------------------------------------------------------------
project "additional-components-plugin"
kind "SharedLib"
targetname "additional"
files {"../../../plugins/additional/additional.cpp"}
includedirs
{
"../../../subprojects/ticpp", "../../../sdk/plugin_interface"
}
defines {"BUILD_DLL", "TIXML_USE_TICPP"}
links {"plugin-interface", "TiCPP"}
if wxCompiler == "vc" then
libs = "core,adv,html,richtext,propgrid,stc,ribbon,aui"
else
libs = "std,richtext,propgrid,stc,ribbon,aui"
end
if wxUseMediaCtrl then
defines {"USE_MEDIACTRL"}
libs = libs .. ",media"
end
if wxArchitecture then
buildoptions {"-arch " .. wxArchitecture}
end
configuration "not vs*"
buildoptions "-std=c++14"
configuration "not windows"
targetdir "../../../output/lib/wxformbuilder"
configuration "windows"
targetprefix "lib"
targetdir "../../../output/plugins/additional"
configuration "Debug"
targetsuffix ( DebugSuffix )
wx_config { Libs=libs, Debug="yes" }
configuration "Release"
wx_config { Libs=libs }
configuration {"not vs*", "Release"}
buildoptions {"-fno-strict-aliasing"}
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/zones/The_Eldieme_Necropolis/npcs/qm8.lua | 57 | 2181 | -----------------------------------
-- Area: The Eldieme Necropolis
-- NPC: qm8 (??? - Ancient Papyrus Shreds)
-- Involved in Quest: In Defiant Challenge
-- @pos 105.275 -32 92.551 195
-----------------------------------
package.loaded["scripts/zones/The_Eldieme_Necropolis/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/keyitems");
require("scripts/globals/settings");
require("scripts/zones/The_Eldieme_Necropolis/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (OldSchoolG1 == false) then
if (player:hasItem(1088) == false and player:hasKeyItem(ANCIENT_PAPYRUS_SHRED2) == false
and player:getQuestStatus(JEUNO,IN_DEFIANT_CHALLENGE) == QUEST_ACCEPTED) then
player:addKeyItem(ANCIENT_PAPYRUS_SHRED2);
player:messageSpecial(KEYITEM_OBTAINED,ANCIENT_PAPYRUS_SHRED2);
end
if (player:hasKeyItem(ANCIENT_PAPYRUS_SHRED1) and player:hasKeyItem(ANCIENT_PAPYRUS_SHRED2) and player:hasKeyItem(ANCIENT_PAPYRUS_SHRED3)) then
if (player:getFreeSlotsCount() >= 1) then
player:addItem(1088, 1);
player:messageSpecial(ITEM_OBTAINED, 1088);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 1088);
end
end
if (player:hasItem(1088)) then
player:delKeyItem(ANCIENT_PAPYRUS_SHRED1);
player:delKeyItem(ANCIENT_PAPYRUS_SHRED2);
player:delKeyItem(ANCIENT_PAPYRUS_SHRED3);
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 |
arahlf/LuaPool | lunit/lunit-tests.lua | 9 | 34836 |
--[[--------------------------------------------------------------------------
This file is part of lunit 0.5.
For Details about lunit look at: http://www.mroth.net/lunit/
Author: Michael Roth <mroth@nessie.de>
Copyright (c) 2004, 2006-2009 Michael Roth <mroth@nessie.de>
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.
--]]--------------------------------------------------------------------------
require "lunit"
local a_number = 123
local a_string = "A string"
local a_table = { }
local a_function = function() end
local a_thread = coroutine.create(function() end)
local pcall = pcall
local error = error
local pairs = pairs
local ipairs = ipairs
local module = module
module( "lunit-tests.interface", lunit.testcase )
function test()
local funcnames = {
"main", "run", "runtest", "testcase", "testcases", "tests", "setupname",
"teardownname", "loadrunner", "setrunner", "loadonly",
"assert", "assert_true", "assert_false", "assert_equal", "assert_not_equal",
"assert_match", "assert_not_match", "assert_nil", "assert_not_nil",
"assert_boolean", "assert_not_boolean", "assert_number", "assert_not_number",
"assert_string", "assert_not_string", "assert_table", "assert_not_table",
"assert_function", "assert_not_function", "assert_thread", "assert_not_thread",
"assert_userdata", "assert_not_userdata", "assert_pass", "assert_error",
"assert_error_match", "fail", "clearstats",
"is_nil", "is_boolean", "is_number", "is_string", "is_table", "is_function",
"is_thread", "is_userdata"
}
for _, funcname in ipairs(funcnames) do
assert_function( lunit[funcname], "Public function missing: "..funcname )
end
assert_table( lunit.stats, "Statistic table missing" )
do
local map = {}
for _, name in ipairs(funcnames) do
map[name] = true
end
for _, name in ipairs{"lunit", "_PACKAGE", "_M", "_NAME", "stats"} do
map[name] = true
end
for name, _ in pairs(lunit) do
assert( map[name], "Invalid public variable: lunit."..name )
end
end
end
-- We must assume that errors thrown by test functions are detected. We use
-- the stdlib error() function to signal errors instead of fail().
module( "lunit-tests.basics", lunit.testcase )
function test_fail()
local ok, errmsg
ok, errmsg = pcall(function() fail() end)
if ok then
error("fail() doesn't fail!")
end
ok, errmsg = pcall(function() fail("A message") end)
if ok then
error("fail(\"A message\") doesn't fail!")
end
end
function test_assert_error()
local ok, errmsg
ok, errmsg = pcall(function() assert_error(function() error("Error!") end) end)
if not ok then
error("assert_error( <error> ) doesn't work!")
end
ok, errmsg = pcall(function() assert_error("A message", function() error("Error") end) end)
if not ok then
error("assert_error(\"A message\", <error>) doesn't work!")
end
ok, errmsg = pcall(function() assert_error(function() end) end)
if ok then
error("assert_error( <no error> ) doesn't fail!")
end
ok, errmsg = pcall(function() assert_error("A Message", function() end) end)
if ok then
error("assert_error(\"A message\", <no error>) doesn't fail!")
end
end
function test_assert_pass()
local ok, errmsg
ok, errmsg = pcall(function() assert_pass(function() error("Error!") end) end)
if ok then
error("assert_pass( <error> ) doesn't fail!")
end
ok, errmsg = pcall(function() assert_pass("A message", function() error("Error") end) end)
if ok then
error("assert_pass(\"A message\", <error>) doesn't fail!")
end
ok, errmsg = pcall(function() assert_pass(function() end) end)
if not ok then
error("assert_pass( <no error> ) doesn't work!")
end
ok, errmsg = pcall(function() assert_pass("A Message", function() end) end)
if not ok then
error("assert_pass(\"A message\", <no error>) doesn't work!")
end
end
function test_assert_true()
assert_pass("assert_true(true) doesn't work!", function() assert_true(true) end)
assert_pass("assert_true(true, \"A message\" doesn't work!", function() assert_true(true, "A Message") end)
assert_error("assert_true(false) doesn't fail!", function() assert_true(false) end)
assert_error("assert_true(false, \"A message\" doesn't fail!", function() assert_true(false, "A Message") end)
end
function test_assert_false()
assert_pass("assert_false(false) doesn't work!", function() assert_false(false) end)
assert_pass("assert_false(false, \"A message\" doesn't work!", function() assert_false(false, "A Message") end)
assert_error("assert_false(true) doesn't fail!", function() assert_false(true) end)
assert_error("assert_false(true, \"A message\" doesn't fail!", function() assert_false(true, "A Message") end)
end
function test_assert()
assert_pass("assert(true) doesn't work!", function() assert(true) end)
assert_pass("assert(12345) doesn't work!", function() assert(12345) end)
assert_pass("assert(\"A string\") doesn't work!", function() assert("A string") end)
assert_pass("assert( {} ) doesn't work!", function() assert( {} ) end)
assert_error("assert_(false) doesn't fail!", function() assert(false) end)
assert_error("assert_(nil) doesn't fail!", function() assert(nil) end)
end
function test_assert_equal()
assert_pass("assert_equal(\"A String\", \"A String\") doesn't work!", function()
local a_string = assert_equal("A String", "A String")
assert_true("A String" == a_string)
end)
assert_pass("assert_equal(\"A String\", \"A String\", \"A message\") doesn't work!", function()
local a_string = assert_equal("A String", "A String", "A message")
assert_true("A String" == a_string)
end)
assert_pass("assert_equal(12345, 12345) doesn't work!", function()
local a_number = assert_equal(12345, 12345)
assert_true(12345 == a_number)
end)
assert_pass("assert_equal(12345, 12345, \"A message\") doesn't work!", function()
local a_number = assert_equal(12345, 12345, "A message")
assert_true(12345 == a_number)
end)
assert_pass("assert_equal(nil, nil) doesn't work!", function()
local a_nil = assert_equal(nil, nil)
assert_true(nil == a_nil)
end)
assert_pass("assert_equal(12345, 12345, \"A message\") doesn't work!", function()
local a_nil = assert_equal(nil, nil, "A message")
assert_true(nil == a_nil)
end)
assert_pass("assert_equal(false, false) doesn't work!", function()
local a_false = assert_equal(false, false)
assert_true(false == a_false)
end)
assert_pass("assert_equal(false, false, \"A message\") doesn't work!", function()
local a_false = assert_equal(false, false, "A message")
assert_true(false == a_false)
end)
assert_pass("assert_equal(true, true) doesn't work!", function()
local a_true = assert_equal(true, true)
assert_true(true == a_true)
end)
assert_pass("assert_equal(true, true, \"A message\") doesn't work!", function()
local a_true = assert_equal(true, true, "A message")
assert_true(true == a_true)
end)
assert_error("assert_equal(\"A String\", \"Another String\") doesn't fail!", function()
assert_equal("A String", "Another String")
end)
assert_error("assert_equal(\"A String\", \"Another String\", \"A message\") doesn't fail!", function()
assert_equal("A String", "Another String", "A message")
end)
assert_error("assert_equal(123, 456) doesn't fail!", function()
assert_equal(123, 456)
end)
assert_error("assert_equal(123, 456) \"A message\") doesn't fail!", function()
assert_equal(123, 456, "A message")
end)
assert_error("assert_equal(true, false) doesn't fail!", function()
assert_equal(true, false)
end)
assert_error("assert_equal(true, false) \"A message\") doesn't fail!", function()
assert_equal(true, false, "A message")
end)
assert_error("assert_equal(true, nil) doesn't fail!", function()
assert_equal(true, nil)
end)
assert_error("assert_equal(true, nil) \"A message\") doesn't fail!", function()
assert_equal(true, nil, "A message")
end)
assert_error("assert_equal(false, true) doesn't fail!", function()
assert_equal(false, true)
end)
assert_error("assert_equal(false, true, \"A message\") doesn't fail!", function()
assert_equal(false, true, "A message")
end)
assert_error("assert_equal(false, nil) doesn't fail!", function()
assert_equal(false, nil)
end)
assert_error("assert_equal(false, nil) \"A message\") doesn't fail!", function()
assert_equal(false, nil, "A message")
end)
assert_error("assert_equal(nil, true) doesn't fail!", function()
assert_equal(nil, true)
end)
assert_error("assert_equal(nil, true) \"A message\") doesn't fail!", function()
assert_equal(nil, true, "A message")
end)
assert_error("assert_equal(nil, false) doesn't fail!", function()
assert_equal(nil, false)
end)
assert_error("assert_equal(nil, false) \"A message\") doesn't fail!", function()
assert_equal(nil, false, "A message")
end)
end
function test_assert_not_equal()
assert_pass("assert_not_equal(\"A String\", \"Another String\") doesn't work!", function()
local a_string = assert_not_equal("A String", "Another String")
assert_true("Another String" == a_string)
end)
assert_pass("assert_not_equal(\"A String\", \"Another String\", \"A message\") doesn't work!", function()
local a_string = assert_not_equal("A String", "Another String", "A message")
assert_true("Another String" == a_string)
end)
assert_pass("assert_not_equal(123, 456) doesn't work!", function()
local a_number = assert_not_equal(123, 456)
assert_true(456 == a_number)
end)
assert_pass("assert_not_equal(123, 456, \"A message\") doesn't work!", function()
local a_number = assert_not_equal(123, 456, "A message")
assert_true(456 == a_number)
end)
assert_pass("assert_not_equal(true, false) doesn't work!", function()
local a_false = assert_not_equal(true, false)
assert_true(false == a_false)
end)
assert_pass("assert_not_equal(true, false) \"A message\") doesn't work!", function()
local a_false = assert_not_equal(true, false, "A message")
assert_true(false == a_false)
end)
assert_pass("assert_not_equal(true, nil) doesn't work!", function()
local a_nil = assert_not_equal(true, nil)
assert_true(nil == a_nil)
end)
assert_pass("assert_not_equal(true, nil) \"A message\") doesn't work!", function()
local a_nil = assert_not_equal(true, nil, "A message")
assert_true(nil == a_nil)
end)
assert_pass("assert_not_equal(false, true) doesn't work!", function()
local a_true = assert_not_equal(false, true)
assert_true(true == a_true)
end)
assert_pass("assert_not_equal(false, true, \"A message\") doesn't work!", function()
local a_true = assert_not_equal(false, true, "A message")
assert_true(true == a_true)
end)
assert_pass("assert_not_equal(false, nil) doesn't work!", function()
local a_nil = assert_not_equal(false, nil)
assert_true(nil == a_nil)
end)
assert_pass("assert_not_equal(false, nil) \"A message\") doesn't work!", function()
local a_nil = assert_not_equal(false, nil, "A message")
assert_true(nil == a_nil)
end)
assert_pass("assert_not_equal(nil, true) doesn't work!", function()
local a_true = assert_not_equal(nil, true)
assert_true(true == a_true)
end)
assert_pass("assert_not_equal(nil, true) \"A message\") doesn't work!", function()
local a_true = assert_not_equal(nil, true, "A message")
assert_true(true == a_true)
end)
assert_pass("assert_not_equal(nil, false) doesn't work!", function()
local a_false = assert_not_equal(nil, false)
assert_true(false == a_false)
end)
assert_pass("assert_not_equal(nil, false) \"A message\") doesn't work!", function()
local a_false = assert_not_equal(nil, false, "A message")
assert_true(false == a_false)
end)
assert_error("assert_not_equal(\"A String\", \"A String\") doesn't work!", function()
assert_not_equal("A String", "A String")
end)
assert_error("assert_not_equal(\"A String\", \"A String\", \"A message\") doesn't fail!", function()
assert_not_equal("A String", "A String", "A message")
end)
assert_error("assert_not_equal(12345, 12345) doesn't fail!", function()
assert_not_equal(12345, 12345)
end)
assert_error("assert_not_equal(12345, 12345, \"A message\") doesn't fail!", function()
assert_not_equal(12345, 12345, "A message")
end)
assert_error("assert_not_equal(nil, nil) doesn't fail!", function()
assert_not_equal(nil, nil)
end)
assert_error("assert_not_equal(nil, nil, \"A message\") doesn't fail!", function()
assert_not_equal(nil, nil, "A message")
end)
assert_error("assert_not_equal(false, false) doesn't fail!", function()
assert_not_equal(false, false)
end)
assert_error("assert_not_equal(false, false, \"A message\") doesn't fail!", function()
assert_not_equal(false, false, "A message")
end)
assert_error("assert_not_equal(true, true) doesn't fail!", function()
assert_not_equal(true, true)
end)
assert_error("assert_not_equal(true, true, \"A message\") doesn't fail!", function()
assert_not_equal(true, true, "A message")
end)
end
module( "lunit-tests.is_xyz", lunit.testcase )
function test_is_nil()
assert_true( is_nil(nil) )
assert_false( is_nil(true) )
assert_false( is_nil(false) )
assert_false( is_nil(a_number) )
assert_false( is_nil(a_string) )
assert_false( is_nil(a_table) )
assert_false( is_nil(a_function) )
assert_false( is_nil(a_thread) )
end
function test_is_boolean()
assert_true( is_boolean(false) )
assert_true( is_boolean(true) )
assert_false( is_boolean(nil) )
assert_false( is_boolean(a_number) )
assert_false( is_boolean(a_string) )
assert_false( is_boolean(a_table) )
assert_false( is_boolean(a_function) )
assert_false( is_boolean(a_thread) )
end
function test_is_number()
assert_true( is_number(a_number) )
assert_false( is_number(nil) )
assert_false( is_number(true) )
assert_false( is_number(false) )
assert_false( is_number(a_string) )
assert_false( is_number(a_table) )
assert_false( is_number(a_function) )
assert_false( is_number(a_thread) )
end
function test_is_string()
assert_true( is_string(a_string) )
assert_false( is_string(nil) )
assert_false( is_string(true) )
assert_false( is_string(false) )
assert_false( is_string(a_number) )
assert_false( is_string(a_table) )
assert_false( is_string(a_function) )
assert_false( is_string(a_thread) )
end
function test_is_table()
assert_true( is_table(a_table) )
assert_false( is_table(nil) )
assert_false( is_table(true) )
assert_false( is_table(false) )
assert_false( is_table(a_number) )
assert_false( is_table(a_string) )
assert_false( is_table(a_function) )
assert_false( is_table(a_thread) )
end
function test_is_function()
assert_true( is_function(a_function) )
assert_false( is_function(nil) )
assert_false( is_function(true) )
assert_false( is_function(false) )
assert_false( is_function(a_number) )
assert_false( is_function(a_string) )
assert_false( is_function(a_table) )
assert_false( is_function(a_thread) )
end
function test_is_thread()
assert_true( is_thread(a_thread) )
assert_false( is_thread(nil) )
assert_false( is_thread(true) )
assert_false( is_thread(false) )
assert_false( is_thread(a_number) )
assert_false( is_thread(a_string) )
assert_false( is_thread(a_table) )
assert_false( is_thread(a_function) )
end
module( "lunit-tests.assert_not_xyz", lunit.testcase )
function test_assert_not_nil()
assert_not_nil( true )
assert_not_nil( false )
assert_not_nil( a_number )
assert_not_nil( a_string )
assert_not_nil( a_table )
assert_not_nil( a_function )
assert_not_nil( a_thread )
assert_not_nil( true, "A message")
assert_not_nil( false, "A message")
assert_not_nil( a_number, "A message")
assert_not_nil( a_string, "A message")
assert_not_nil( a_table, "A message")
assert_not_nil( a_function, "A message")
assert_not_nil( a_thread, "A message")
assert_error(function() assert_not_nil(nil) end)
assert_error(function() assert_not_nil(nil, "A message") end)
end
function test_assert_not_boolean()
assert_not_boolean( nil )
assert_not_boolean( a_number )
assert_not_boolean( a_string )
assert_not_boolean( a_table )
assert_not_boolean( a_function )
assert_not_boolean( a_thread )
assert_not_boolean( nil, "A message")
assert_not_boolean( a_number, "A message")
assert_not_boolean( a_string, "A message")
assert_not_boolean( a_table, "A message")
assert_not_boolean( a_function, "A message")
assert_not_boolean( a_thread, "A message")
assert_error(function() assert_not_boolean(true) end)
assert_error(function() assert_not_boolean(true, "A message") end)
assert_error(function() assert_not_boolean(false) end)
assert_error(function() assert_not_boolean(false, "A message") end)
end
function test_assert_not_number()
assert_not_number( nil )
assert_not_number( true )
assert_not_number( false )
assert_not_number( a_string )
assert_not_number( a_table )
assert_not_number( a_function )
assert_not_number( a_thread )
assert_not_number( nil, "A message")
assert_not_number( true, "A message")
assert_not_number( false, "A message")
assert_not_number( a_string, "A message")
assert_not_number( a_table, "A message")
assert_not_number( a_function, "A message")
assert_not_number( a_thread, "A message")
assert_error(function() assert_not_number(a_number) end)
assert_error(function() assert_not_number(a_number, "A message") end)
end
function test_assert_not_string()
assert_not_string( nil )
assert_not_string( true )
assert_not_string( false )
assert_not_string( a_number )
assert_not_string( a_table )
assert_not_string( a_function )
assert_not_string( a_thread )
assert_not_string( nil, "A message")
assert_not_string( true, "A message")
assert_not_string( false, "A message")
assert_not_string( a_number, "A message")
assert_not_string( a_table, "A message")
assert_not_string( a_function, "A message")
assert_not_string( a_thread, "A message")
assert_error(function() assert_not_string(a_string) end)
assert_error(function() assert_not_string(a_string, "A message") end)
end
function test_assert_not_table()
assert_not_table( nil )
assert_not_table( true )
assert_not_table( false )
assert_not_table( a_number )
assert_not_table( a_string )
assert_not_table( a_function )
assert_not_table( a_thread )
assert_not_table( nil, "A message")
assert_not_table( true, "A message")
assert_not_table( false, "A message")
assert_not_table( a_number, "A message")
assert_not_table( a_string, "A message")
assert_not_table( a_function, "A message")
assert_not_table( a_thread, "A message")
assert_error(function() assert_not_table(a_table) end)
assert_error(function() assert_not_table(a_table, "A message") end)
end
function test_assert_not_function()
assert_not_function( nil )
assert_not_function( true )
assert_not_function( false )
assert_not_function( a_number )
assert_not_function( a_string )
assert_not_function( a_table )
assert_not_function( a_thread )
assert_not_function( nil, "A message")
assert_not_function( true, "A message")
assert_not_function( false, "A message")
assert_not_function( a_number, "A message")
assert_not_function( a_string, "A message")
assert_not_function( a_table, "A message")
assert_not_function( a_thread, "A message")
assert_error(function() assert_not_function(a_function) end)
assert_error(function() assert_not_function(a_function, "A message") end)
end
function test_assert_not_thread()
assert_not_thread( nil )
assert_not_thread( true )
assert_not_thread( false )
assert_not_thread( a_number )
assert_not_thread( a_string )
assert_not_thread( a_table )
assert_not_thread( a_function )
assert_not_thread( nil, "A message")
assert_not_thread( true, "A message")
assert_not_thread( false, "A message")
assert_not_thread( a_number, "A message")
assert_not_thread( a_string, "A message")
assert_not_thread( a_table, "A message")
assert_not_thread( a_function, "A message")
assert_error(function() assert_not_thread(a_thread) end)
assert_error(function() assert_not_thread(a_thread, "A message") end)
end
module( "lunit-tests.assert_xyz", lunit.testcase )
function test_assert_nil()
assert_nil( nil )
assert_nil( nil, "A message" )
assert_error( function() assert_nil( true ) end)
assert_error( function() assert_nil( false ) end)
assert_error( function() assert_nil( a_number ) end)
assert_error( function() assert_nil( a_string ) end)
assert_error( function() assert_nil( a_table ) end)
assert_error( function() assert_nil( a_function ) end)
assert_error( function() assert_nil( a_thread ) end)
assert_error( function() assert_nil( true, "A message" ) end)
assert_error( function() assert_nil( false, "A message" ) end)
assert_error( function() assert_nil( a_number, "A message" ) end)
assert_error( function() assert_nil( a_string, "A message" ) end)
assert_error( function() assert_nil( a_table, "A message" ) end)
assert_error( function() assert_nil( a_function, "A message" ) end)
assert_error( function() assert_nil( a_thread, "A message" ) end)
end
function test_assert_boolean()
assert_boolean( true )
assert_boolean( false )
assert_boolean( true, "A message" )
assert_boolean( false, "A message" )
assert_error( function() assert_boolean( nil ) end)
assert_error( function() assert_boolean( a_number ) end)
assert_error( function() assert_boolean( a_string ) end)
assert_error( function() assert_boolean( a_table ) end)
assert_error( function() assert_boolean( a_function ) end)
assert_error( function() assert_boolean( a_thread ) end)
assert_error( function() assert_boolean( nil, "A message" ) end)
assert_error( function() assert_boolean( a_number, "A message" ) end)
assert_error( function() assert_boolean( a_string, "A message" ) end)
assert_error( function() assert_boolean( a_table, "A message" ) end)
assert_error( function() assert_boolean( a_function, "A message" ) end)
assert_error( function() assert_boolean( a_thread, "A message" ) end)
end
function test_assert_number()
assert_number( a_number )
assert_number( a_number, "A message" )
assert_error( function() assert_number( nil ) end)
assert_error( function() assert_number( true ) end)
assert_error( function() assert_number( false ) end)
assert_error( function() assert_number( a_string ) end)
assert_error( function() assert_number( a_table ) end)
assert_error( function() assert_number( a_function ) end)
assert_error( function() assert_number( a_thread ) end)
assert_error( function() assert_number( nil, "A message" ) end)
assert_error( function() assert_number( true, "A message" ) end)
assert_error( function() assert_number( false, "A message" ) end)
assert_error( function() assert_number( a_string, "A message" ) end)
assert_error( function() assert_number( a_table, "A message" ) end)
assert_error( function() assert_number( a_function, "A message" ) end)
assert_error( function() assert_number( a_thread, "A message" ) end)
end
function test_assert_string()
assert_string( a_string )
assert_string( a_string, "A message" )
assert_error( function() assert_string( nil ) end)
assert_error( function() assert_string( true ) end)
assert_error( function() assert_string( false ) end)
assert_error( function() assert_string( a_number ) end)
assert_error( function() assert_string( a_table ) end)
assert_error( function() assert_string( a_function ) end)
assert_error( function() assert_string( a_thread ) end)
assert_error( function() assert_string( nil, "A message" ) end)
assert_error( function() assert_string( true, "A message" ) end)
assert_error( function() assert_string( false, "A message" ) end)
assert_error( function() assert_string( a_number, "A message" ) end)
assert_error( function() assert_string( a_table, "A message" ) end)
assert_error( function() assert_string( a_function, "A message" ) end)
assert_error( function() assert_string( a_thread, "A message" ) end)
end
function test_assert_table()
assert_table( a_table )
assert_table( a_table, "A message" )
assert_error( function() assert_table( nil ) end)
assert_error( function() assert_table( true ) end)
assert_error( function() assert_table( false ) end)
assert_error( function() assert_table( a_number ) end)
assert_error( function() assert_table( a_string ) end)
assert_error( function() assert_table( a_function ) end)
assert_error( function() assert_table( a_thread ) end)
assert_error( function() assert_table( nil, "A message" ) end)
assert_error( function() assert_table( true, "A message" ) end)
assert_error( function() assert_table( false, "A message" ) end)
assert_error( function() assert_table( a_number, "A message" ) end)
assert_error( function() assert_table( a_string, "A message" ) end)
assert_error( function() assert_table( a_function, "A message" ) end)
assert_error( function() assert_table( a_thread, "A message" ) end)
end
function test_assert_function()
assert_function( a_function )
assert_function( a_function, "A message" )
assert_error( function() assert_function( nil ) end)
assert_error( function() assert_function( true ) end)
assert_error( function() assert_function( false ) end)
assert_error( function() assert_function( a_number ) end)
assert_error( function() assert_function( a_string ) end)
assert_error( function() assert_function( a_table ) end)
assert_error( function() assert_function( a_thread ) end)
assert_error( function() assert_function( nil, "A message" ) end)
assert_error( function() assert_function( true, "A message" ) end)
assert_error( function() assert_function( false, "A message" ) end)
assert_error( function() assert_function( a_number, "A message" ) end)
assert_error( function() assert_function( a_string, "A message" ) end)
assert_error( function() assert_function( a_table, "A message" ) end)
assert_error( function() assert_function( a_thread, "A message" ) end)
end
function test_assert_thread()
assert_thread( a_thread )
assert_thread( a_thread, "A message" )
assert_error( function() assert_thread( nil ) end)
assert_error( function() assert_thread( true ) end)
assert_error( function() assert_thread( false ) end)
assert_error( function() assert_thread( a_number ) end)
assert_error( function() assert_thread( a_string ) end)
assert_error( function() assert_thread( a_table ) end)
assert_error( function() assert_thread( a_function ) end)
assert_error( function() assert_thread( nil, "A message" ) end)
assert_error( function() assert_thread( true, "A message" ) end)
assert_error( function() assert_thread( false, "A message" ) end)
assert_error( function() assert_thread( a_number, "A message" ) end)
assert_error( function() assert_thread( a_string, "A message" ) end)
assert_error( function() assert_thread( a_table, "A message" ) end)
assert_error( function() assert_thread( a_function, "A message" ) end)
end
module( "lunit-tests.match", lunit.testcase )
function test_assert_match()
assert_pass("assert_match(\"^Hello\", \"Hello World\") doesn't work!", function()
local a_string = assert_match("^Hello", "Hello World")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_match(\"^Hello\", \"Hello World\", \"A Message\") doesn't work!", function()
local a_string = assert_match("^Hello", "Hello World", "A message")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_match(\"World$\", \"Hello World\") doesn't work!", function()
local a_string = assert_match("World$", "Hello World")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_match(\"World$\", \"Hello World\", \"A Message\") doesn't work!", function()
local a_string = assert_match("World$", "Hello World", "A message")
assert_equal("Hello World", a_string)
end)
assert_error("assert_match(\"Hello$\", \"Hello World\") doesn't fail!", function()
assert_match("Hello$", "Hello World")
end)
assert_error("assert_match(\"Hello$\", \"Hello World\", \"A Message\") doesn't fail!", function()
assert_match("Hello$", "Hello World", "A message")
end)
assert_error("assert_match(\"^World\", \"Hello World\") doesn't fail!", function()
assert_match("^World", "Hello World")
end)
assert_error("assert_match(\"^World\", \"Hello World\", \"A Message\") doesn't fail!", function()
assert_match("^World", "Hello World", "A message")
end)
assert_error("assert_match(nil, \"Hello World\") doesn't fail!", function()
assert_match(nil, "Hello World")
end)
assert_error("assert_match(nil, \"Hello World\", \"A Message\") doesn't fail!", function()
assert_match(nil, "Hello World", "A message")
end)
assert_error("assert_match(\"^World\", nil) doesn't fail!", function()
assert_match("^World", nil)
end)
assert_error("assert_match(\"^World\", nil, \"A Message\") doesn't fail!", function()
assert_match("^World", nil, "A message")
end)
end
function test_assert_not_match()
assert_pass("assert_not_match(\"Hello$\", \"Hello World\") doesn't work!", function()
local a_string = assert_not_match("Hello$", "Hello World")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_not_match(\"Hello$\", \"Hello World\", \"A Message\") doesn't work!", function()
local a_string = assert_not_match("Hello$", "Hello World", "A message")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_not_match(\"^World\", \"Hello World\") doesn't work!", function()
local a_string = assert_not_match("^World", "Hello World")
assert_equal("Hello World", a_string)
end)
assert_pass("assert_not_match(\"^World\", \"Hello World\", \"A Message\") doesn't work!", function()
local a_string = assert_not_match("^World", "Hello World", "A message")
assert_equal("Hello World", a_string)
end)
assert_error("assert_not_match(\"^Hello\", \"Hello World\") doesn't fail!", function()
assert_not_match("^Hello", "Hello World")
end)
assert_error("assert_not_match(\"^Hello\", \"Hello World\", \"A Message\") doesn't fail!", function()
assert_not_match("^Hello", "Hello World", "A message")
end)
assert_error("assert_not_match(\"World$\", \"Hello World\") doesn't fail!", function()
assert_not_match("World$", "Hello World")
end)
assert_error("assert_not_match(\"World$\", \"Hello World\", \"A Message\") doesn't fail!", function()
assert_not_match("World$", "Hello World", "A message")
end)
assert_error("assert_not_match(nil, \"Hello World\") doesn't fail!", function()
assert_not_match(nil, "Hello World")
end)
assert_error("assert_not_match(nil, \"Hello World\", \"A Message\") doesn't fail!", function()
assert_not_match(nil, "Hello World", "A message")
end)
assert_error("assert_not_match(\"^World\", nil) doesn't fail!", function()
assert_not_match("^World", nil)
end)
assert_error("assert_not_match(\"^World\", nil, \"A Message\") doesn't fail!", function()
assert_not_match("^World", nil, "A message")
end)
end
function test_assert_error_match()
local ok, errobj, usrmsg
local function errfunc()
error("My Error!")
end
local errpattern = "Error!$"
local wrongpattern = "^_foobar_$"
local function goodfunc()
-- NOP
end
ok = pcall(function() assert_error_match(errpattern, errfunc) end)
assert_true(ok, "assert_error_match( <pattern>, <error> )")
ok = pcall(function() assert_error_match("A message", errpattern, errfunc) end)
assert_true(ok, "assert_error_match(\"A message\", <pattern>, <error>)")
usrmsg = "assert_error_match( <wrong pattern>, <error> )"
ok, errobj = pcall(function() assert_error_match(wrongpattern, errfunc) end)
assert_false(ok, usrmsg)
assert_table(errobj, usrmsg)
assert_match("expected error '.+: My Error!' to match pattern '"..wrongpattern.."' but doesn't$", errobj.msg, usrmsg)
usrmsg = "assert_error_match(\"A message\", <wrong pattern>, <error>)"
ok, errobj = pcall(function() assert_error_match("A message", wrongpattern, errfunc) end)
assert_false(ok, usrmsg)
assert_table(errobj, usrmsg)
assert_match("expected error '.+: My Error!' to match pattern '"..wrongpattern.."' but doesn't$", errobj.msg, usrmsg)
usrmsg = "assert_error_match( <pattern>, <no error> )"
ok, errobj = pcall(function() assert_error_match(errpattern, goodfunc) end)
assert_false(ok, usrmsg)
assert_table(errobj, usrmsg)
assert_match("error expected but no error occurred$", errobj.msg, usrmsg)
usrmsg = "assert_error_match(\"A message\", <pattern>, <no error>)"
ok, errobj = pcall(function() assert_error_match("A Message", errpattern, goodfunc) end)
assert_false(ok, usrmsg)
assert_table(errobj, usrmsg)
assert_match("error expected but no error occurred$", errobj.msg, usrmsg)
end
module( "lunit-tests.setup-teardown", lunit.testcase )
local setup_called = 0
local teardown_called = 0
local helper_called = 0
function setup()
setup_called = setup_called + 1
end
function Teardown()
teardown_called = teardown_called + 1
end
local function helper()
helper_called = helper_called + 1
assert(setup_called == helper_called, "setup() not called")
assert(teardown_called == helper_called - 1, "teardown() not called")
end
function test1()
helper()
end
function test2()
helper()
end
function test3()
helper()
end
| bsd-3-clause |
dpino/snabbswitch | src/program/lwaftr/check/util.lua | 9 | 1681 | module(..., package.seeall)
local counter = require("core.counter")
local lib = require("core.lib")
local data = require("lib.yang.data")
local state = require("lib.yang.state")
local lwutil = require("apps.lwaftr.lwutil")
local write_to_file = lwutil.write_to_file
function load_requested_counters(counters)
local result = dofile(counters)
assert(type(result) == "table", "Not a valid counters file: "..counters)
return result
end
function diff_counters(final, initial)
local results = {}
for name, ref in pairs(initial) do
local cur = final[name]
if cur ~= ref then
results[name] = tonumber(cur - ref)
end
end
return results
end
function validate_diff(actual, expected)
if not lib.equal(actual, expected) then
local msg
print('--- Expected (actual values in brackets, if any)')
for k, v in pairs(expected) do
msg = k..' = '..v
if actual[k] ~= nil then
msg = msg..' ('..actual[k]..')'
end
print(msg)
end
print('--- actual (expected values in brackets, if any)')
for k, v in pairs(actual) do
msg = k..' = '..v
if expected[k] ~= nil then
msg = msg..' ('..expected[k]..')'
end
print(msg)
end
error('counters did not match')
end
end
function regen_counters(counters, outfile)
local cnames = lwutil.keys(counters)
table.sort(cnames)
local out_val = {'return {'}
for _,k in ipairs(cnames) do
table.insert(out_val, string.format(' ["%s"] = %s,', k, counters[k]))
end
table.insert(out_val, '}\n')
write_to_file(outfile, (table.concat(out_val, '\n')))
end
| apache-2.0 |
nesstea/darkstar | scripts/zones/Windurst_Waters/npcs/Sohdede.lua | 13 | 1054 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Sohdede
-- Type: Standard NPC
-- @zone: 238
-- @pos -60.601 -7.499 111.639
--
-- Auto-Script: Requires Verification (Verfied By Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0176);
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 |
jj918160/cocos2d-x-samples | samples/KillBug/src/cocos/framework/extends/MenuEx.lua | 57 | 1228 | --[[
Copyright (c) 2011-2014 chukong-inc.com
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.
]]
local Menu = cc.Menu
local MenuItem = cc.MenuItem
function MenuItem:onClicked(callback)
self:registerScriptTapHandler(callback)
return self
end
| mit |
amirmrbad/teleatom | plugins/stats.lua | 168 | 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() == 'creedbot' 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 /creedbot ")
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] == "creedbot" 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) (creedbot)",-- Put everything you like :)
"^[!/]([Cc]reedbot)"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
Mashape/kong | spec/01-unit/11-reports_spec.lua | 1 | 11376 | local meta = require "kong.meta"
local helpers = require "spec.helpers"
local reports = require "kong.reports"
local cjson = require "cjson"
describe("reports", function()
describe("send()", function()
lazy_setup(function()
reports.toggle(true)
end)
lazy_teardown(function()
package.loaded["kong.reports"] = nil
end)
it("sends report over TCP", function()
local thread = helpers.tcp_server(8189)
reports.send("stub", {
hello = "world",
foo = "bar",
baz = function() return "bat" end,
foobar = function() return { foo = "bar" } end,
bazbat = { baz = "bat" },
nilval = function() return nil end,
}, "127.0.0.1", 8189)
local ok, res = thread:join()
assert.True(ok)
assert.matches("^<14>", res)
res = res:sub(5)
assert.matches("cores=%d+", res)
assert.matches("uname=[%w]+", res)
assert.matches("version=" .. meta._VERSION, res, nil, true)
assert.matches("hostname=[%w]+", res)
assert.matches("foo=bar", res, nil, true)
assert.matches("hello=world", res, nil, true)
assert.matches("signal=stub", res, nil, true)
assert.matches("baz=bat", res, nil, true)
assert.not_matches("nilval", res, nil, true)
assert.matches("foobar=" .. cjson.encode({ foo = "bar" }), res, nil, true)
assert.matches("bazbat=" .. cjson.encode({ baz = "bat" }), res, nil, true)
end)
it("doesn't send if not enabled", function()
reports.toggle(false)
local thread = helpers.tcp_server(8189, { requests = 1, timeout = 0.1 })
reports.send({
foo = "bar"
}, "127.0.0.1", 8189)
local ok, res = thread:join()
assert.True(ok)
assert.equal("timeout", res)
end)
it("accepts custom immutable items", function()
reports.toggle(true)
local thread = helpers.tcp_server(8189)
reports.add_immutable_value("imm1", "fooval")
reports.add_immutable_value("imm2", "barval")
reports.send("stub", {k1 = "bazval"}, "127.0.0.1", 8189)
local ok, res = thread:join()
assert.True(ok)
assert.matches("imm1=fooval", res)
assert.matches("imm2=barval", res)
assert.matches("k1=bazval", res)
end)
end)
describe("configure_ping()", function()
local conf_loader = require "kong.conf_loader"
before_each(function()
package.loaded["kong.reports"] = nil
reports = require "kong.reports"
reports.toggle(true)
end)
describe("sends 'database'", function()
it("postgres", function()
local conf = assert(conf_loader(nil, {
database = "postgres",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert._matches("database=postgres", res, nil, true)
end)
it("cassandra", function()
local conf = assert(conf_loader(nil, {
database = "cassandra",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("database=cassandra", res, nil, true)
end)
it("off", function()
local conf = assert(conf_loader(nil, {
database = "off",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("database=off", res, nil, true)
end)
end)
describe("sends '_admin' for 'admin_listen'", function()
it("off", function()
local conf = assert(conf_loader(nil, {
admin_listen = "off",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_admin=0", res, nil, true)
end)
it("on", function()
local conf = assert(conf_loader(nil, {
admin_listen = "127.0.0.1:8001",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_admin=1", res, nil, true)
end)
end)
describe("sends '_proxy' for 'proxy_listen'", function()
it("off", function()
local conf = assert(conf_loader(nil, {
proxy_listen = "off",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_proxy=0", res, nil, true)
end)
it("on", function()
local conf = assert(conf_loader(nil, {
proxy_listen = "127.0.0.1:8000",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_proxy=1", res, nil, true)
end)
end)
describe("sends '_stream' for 'stream_listen'", function()
it("off", function()
local conf = assert(conf_loader(nil, {
stream_listen = "off",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_stream=0", res, nil, true)
end)
it("on", function()
local conf = assert(conf_loader(nil, {
stream_listen = "127.0.0.1:8000",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_stream=1", res, nil, true)
end)
end)
describe("sends '_orig' for 'origins'", function()
it("off", function()
local conf = assert(conf_loader(nil, {
origins = ""
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_orig=0", res, nil, true)
end)
it("on", function()
local conf = assert(conf_loader(nil, {
origins = "http://localhost:8000=http://localhost:9000",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_orig=1", res, nil, true)
end)
end)
describe("sends '_tip' for 'transparent'", function()
it("not specified", function()
local conf = assert(conf_loader(nil, {
stream_listen = "127.0.0.1:9000",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_tip=0", res, nil, true)
end)
it("specified in 'stream_listen'", function()
local conf = assert(conf_loader(nil, {
stream_listen = "127.0.0.1:8000 transparent",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_tip=1", res, nil, true)
end)
it("specified in 'proxy_listen'", function()
local conf = assert(conf_loader(nil, {
proxy_listen = "127.0.0.1:8000 transparent",
}))
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("_tip=1", res, nil, true)
end)
end)
it("default configuration ping contents", function()
local conf = assert(conf_loader())
reports.configure_ping(conf)
local thread = helpers.tcp_server(8189)
reports.send_ping("127.0.0.1", 8189)
local _, res = assert(thread:join())
assert.matches("database=" .. helpers.test_conf.database, res, nil, true)
assert.matches("_admin=1", res, nil, true)
assert.matches("_proxy=1", res, nil, true)
assert.matches("_stream=0", res, nil, true)
assert.matches("_orig=0", res, nil, true)
assert.matches("_tip=0", res, nil, true)
end)
end)
describe("retrieve_redis_version()", function()
lazy_setup(function()
stub(ngx, "log")
end)
lazy_teardown(function()
ngx.log:revert()
end)
before_each(function()
package.loaded["kong.reports"] = nil
reports = require "kong.reports"
reports.toggle(true)
end)
it("does not query Redis if not enabled", function()
reports.toggle(false)
local red_mock = {
info = function() end,
}
local s = spy.on(red_mock, "info")
reports.retrieve_redis_version(red_mock)
assert.spy(s).was_not_called()
end)
it("queries Redis if enabled", function()
local red_mock = {
info = function()
return "redis_version:2.4.5\r\nredis_git_sha1:e09e31b1"
end,
}
local s = spy.on(red_mock, "info")
reports.retrieve_redis_version(red_mock)
assert.spy(s).was_called_with(red_mock, "server")
end)
it("queries Redis only once", function()
local red_mock = {
info = function()
return "redis_version:2.4.5\r\nredis_git_sha1:e09e31b1"
end,
}
local s = spy.on(red_mock, "info")
reports.retrieve_redis_version(red_mock)
reports.retrieve_redis_version(red_mock)
reports.retrieve_redis_version(red_mock)
assert.spy(s).was_called(1)
end)
it("retrieves major.minor version", function()
local red_mock = {
info = function()
return "redis_version:2.4.5\r\nredis_git_sha1:e09e31b1"
end,
}
reports.retrieve_redis_version(red_mock)
assert.equal("2.4", reports.get_ping_value("redis_version"))
end)
it("retrieves 'unknown' when the version could not be retrieved (1/3)", function()
local red_mock = {
info = function()
return nil
end,
}
reports.retrieve_redis_version(red_mock)
assert.equal("unknown", reports.get_ping_value("redis_version"))
end)
it("retrieves 'unknown' when the version could not be retrieved (2/3)", function()
local red_mock = {
info = function()
return ngx.null
end,
}
reports.retrieve_redis_version(red_mock)
assert.equal("unknown", reports.get_ping_value("redis_version"))
end)
it("retrieves 'unknown' when the version could not be retrieved (3/3)", function()
local red_mock = {
info = function()
return "hello world"
end,
}
reports.retrieve_redis_version(red_mock)
assert.equal("unknown", reports.get_ping_value("redis_version"))
end)
end)
end)
| apache-2.0 |
oralius/byond1 | libs/JSON.lua | 3765 | 34843 | -- -*- coding: utf-8 -*-
--
-- Simple JSON encoding and decoding in pure Lua.
--
-- Copyright 2010-2014 Jeffrey Friedl
-- http://regex.info/blog/
--
-- Latest version: http://regex.info/blog/lua/json
--
-- This code is released under a Creative Commons CC-BY "Attribution" License:
-- http://creativecommons.org/licenses/by/3.0/deed.en_US
--
-- It can be used for any purpose so long as the copyright notice above,
-- the web-page links above, and the 'AUTHOR_NOTE' string below are
-- maintained. Enjoy.
--
local VERSION = 20141223.14 -- version history at end of file
local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-"
--
-- The 'AUTHOR_NOTE' variable exists so that information about the source
-- of the package is maintained even in compiled versions. It's also
-- included in OBJDEF below mostly to quiet warnings about unused variables.
--
local OBJDEF = {
VERSION = VERSION,
AUTHOR_NOTE = AUTHOR_NOTE,
}
--
-- Simple JSON encoding and decoding in pure Lua.
-- http://www.json.org/
--
--
-- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines
--
-- local lua_value = JSON:decode(raw_json_text)
--
-- local raw_json_text = JSON:encode(lua_table_or_value)
-- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability
--
--
--
-- DECODING (from a JSON string to a Lua table)
--
--
-- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines
--
-- local lua_value = JSON:decode(raw_json_text)
--
-- If the JSON text is for an object or an array, e.g.
-- { "what": "books", "count": 3 }
-- or
-- [ "Larry", "Curly", "Moe" ]
--
-- the result is a Lua table, e.g.
-- { what = "books", count = 3 }
-- or
-- { "Larry", "Curly", "Moe" }
--
--
-- The encode and decode routines accept an optional second argument,
-- "etc", which is not used during encoding or decoding, but upon error
-- is passed along to error handlers. It can be of any type (including nil).
--
--
--
-- ERROR HANDLING
--
-- With most errors during decoding, this code calls
--
-- JSON:onDecodeError(message, text, location, etc)
--
-- with a message about the error, and if known, the JSON text being
-- parsed and the byte count where the problem was discovered. You can
-- replace the default JSON:onDecodeError() with your own function.
--
-- The default onDecodeError() merely augments the message with data
-- about the text and the location if known (and if a second 'etc'
-- argument had been provided to decode(), its value is tacked onto the
-- message as well), and then calls JSON.assert(), which itself defaults
-- to Lua's built-in assert(), and can also be overridden.
--
-- For example, in an Adobe Lightroom plugin, you might use something like
--
-- function JSON:onDecodeError(message, text, location, etc)
-- LrErrors.throwUserError("Internal Error: invalid JSON data")
-- end
--
-- or even just
--
-- function JSON.assert(message)
-- LrErrors.throwUserError("Internal Error: " .. message)
-- end
--
-- If JSON:decode() is passed a nil, this is called instead:
--
-- JSON:onDecodeOfNilError(message, nil, nil, etc)
--
-- and if JSON:decode() is passed HTML instead of JSON, this is called:
--
-- JSON:onDecodeOfHTMLError(message, text, nil, etc)
--
-- The use of the fourth 'etc' argument allows stronger coordination
-- between decoding and error reporting, especially when you provide your
-- own error-handling routines. Continuing with the the Adobe Lightroom
-- plugin example:
--
-- function JSON:onDecodeError(message, text, location, etc)
-- local note = "Internal Error: invalid JSON data"
-- if type(etc) = 'table' and etc.photo then
-- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName')
-- end
-- LrErrors.throwUserError(note)
-- end
--
-- :
-- :
--
-- for i, photo in ipairs(photosToProcess) do
-- :
-- :
-- local data = JSON:decode(someJsonText, { photo = photo })
-- :
-- :
-- end
--
--
--
--
--
-- DECODING AND STRICT TYPES
--
-- Because both JSON objects and JSON arrays are converted to Lua tables,
-- it's not normally possible to tell which original JSON type a
-- particular Lua table was derived from, or guarantee decode-encode
-- round-trip equivalency.
--
-- However, if you enable strictTypes, e.g.
--
-- JSON = assert(loadfile "JSON.lua")() --load the routines
-- JSON.strictTypes = true
--
-- then the Lua table resulting from the decoding of a JSON object or
-- JSON array is marked via Lua metatable, so that when re-encoded with
-- JSON:encode() it ends up as the appropriate JSON type.
--
-- (This is not the default because other routines may not work well with
-- tables that have a metatable set, for example, Lightroom API calls.)
--
--
-- ENCODING (from a lua table to a JSON string)
--
-- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines
--
-- local raw_json_text = JSON:encode(lua_table_or_value)
-- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability
-- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false })
--
-- On error during encoding, this code calls:
--
-- JSON:onEncodeError(message, etc)
--
-- which you can override in your local JSON object.
--
-- The 'etc' in the error call is the second argument to encode()
-- and encode_pretty(), or nil if it wasn't provided.
--
--
-- PRETTY-PRINTING
--
-- An optional third argument, a table of options, allows a bit of
-- configuration about how the encoding takes place:
--
-- pretty = JSON:encode(val, etc, {
-- pretty = true, -- if false, no other options matter
-- indent = " ", -- this provides for a three-space indent per nesting level
-- align_keys = false, -- see below
-- })
--
-- encode() and encode_pretty() are identical except that encode_pretty()
-- provides a default options table if none given in the call:
--
-- { pretty = true, align_keys = false, indent = " " }
--
-- For example, if
--
-- JSON:encode(data)
--
-- produces:
--
-- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11}
--
-- then
--
-- JSON:encode_pretty(data)
--
-- produces:
--
-- {
-- "city": "Kyoto",
-- "climate": {
-- "avg_temp": 16,
-- "humidity": "high",
-- "snowfall": "minimal"
-- },
-- "country": "Japan",
-- "wards": 11
-- }
--
-- The following three lines return identical results:
-- JSON:encode_pretty(data)
-- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " })
-- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " })
--
-- An example of setting your own indent string:
--
-- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " })
--
-- produces:
--
-- {
-- | "city": "Kyoto",
-- | "climate": {
-- | | "avg_temp": 16,
-- | | "humidity": "high",
-- | | "snowfall": "minimal"
-- | },
-- | "country": "Japan",
-- | "wards": 11
-- }
--
-- An example of setting align_keys to true:
--
-- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true })
--
-- produces:
--
-- {
-- "city": "Kyoto",
-- "climate": {
-- "avg_temp": 16,
-- "humidity": "high",
-- "snowfall": "minimal"
-- },
-- "country": "Japan",
-- "wards": 11
-- }
--
-- which I must admit is kinda ugly, sorry. This was the default for
-- encode_pretty() prior to version 20141223.14.
--
--
-- AMBIGUOUS SITUATIONS DURING THE ENCODING
--
-- During the encode, if a Lua table being encoded contains both string
-- and numeric keys, it fits neither JSON's idea of an object, nor its
-- idea of an array. To get around this, when any string key exists (or
-- when non-positive numeric keys exist), numeric keys are converted to
-- strings.
--
-- For example,
-- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" }))
-- produces the JSON object
-- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"}
--
-- To prohibit this conversion and instead make it an error condition, set
-- JSON.noKeyConversion = true
--
--
-- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT
--
-- assert
-- onDecodeError
-- onDecodeOfNilError
-- onDecodeOfHTMLError
-- onEncodeError
--
-- If you want to create a separate Lua JSON object with its own error handlers,
-- you can reload JSON.lua or use the :new() method.
--
---------------------------------------------------------------------------
local default_pretty_indent = " "
local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent }
local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray
local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject
function OBJDEF:newArray(tbl)
return setmetatable(tbl or {}, isArray)
end
function OBJDEF:newObject(tbl)
return setmetatable(tbl or {}, isObject)
end
local function unicode_codepoint_as_utf8(codepoint)
--
-- codepoint is a number
--
if codepoint <= 127 then
return string.char(codepoint)
elseif codepoint <= 2047 then
--
-- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8
--
local highpart = math.floor(codepoint / 0x40)
local lowpart = codepoint - (0x40 * highpart)
return string.char(0xC0 + highpart,
0x80 + lowpart)
elseif codepoint <= 65535 then
--
-- 1110yyyy 10yyyyxx 10xxxxxx
--
local highpart = math.floor(codepoint / 0x1000)
local remainder = codepoint - 0x1000 * highpart
local midpart = math.floor(remainder / 0x40)
local lowpart = remainder - 0x40 * midpart
highpart = 0xE0 + highpart
midpart = 0x80 + midpart
lowpart = 0x80 + lowpart
--
-- Check for an invalid character (thanks Andy R. at Adobe).
-- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070
--
if ( highpart == 0xE0 and midpart < 0xA0 ) or
( highpart == 0xED and midpart > 0x9F ) or
( highpart == 0xF0 and midpart < 0x90 ) or
( highpart == 0xF4 and midpart > 0x8F )
then
return "?"
else
return string.char(highpart,
midpart,
lowpart)
end
else
--
-- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
--
local highpart = math.floor(codepoint / 0x40000)
local remainder = codepoint - 0x40000 * highpart
local midA = math.floor(remainder / 0x1000)
remainder = remainder - 0x1000 * midA
local midB = math.floor(remainder / 0x40)
local lowpart = remainder - 0x40 * midB
return string.char(0xF0 + highpart,
0x80 + midA,
0x80 + midB,
0x80 + lowpart)
end
end
function OBJDEF:onDecodeError(message, text, location, etc)
if text then
if location then
message = string.format("%s at char %d of: %s", message, location, text)
else
message = string.format("%s: %s", message, text)
end
end
if etc ~= nil then
message = message .. " (" .. OBJDEF:encode(etc) .. ")"
end
if self.assert then
self.assert(false, message)
else
assert(false, message)
end
end
OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError
OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError
function OBJDEF:onEncodeError(message, etc)
if etc ~= nil then
message = message .. " (" .. OBJDEF:encode(etc) .. ")"
end
if self.assert then
self.assert(false, message)
else
assert(false, message)
end
end
local function grok_number(self, text, start, etc)
--
-- Grab the integer part
--
local integer_part = text:match('^-?[1-9]%d*', start)
or text:match("^-?0", start)
if not integer_part then
self:onDecodeError("expected number", text, start, etc)
end
local i = start + integer_part:len()
--
-- Grab an optional decimal part
--
local decimal_part = text:match('^%.%d+', i) or ""
i = i + decimal_part:len()
--
-- Grab an optional exponential part
--
local exponent_part = text:match('^[eE][-+]?%d+', i) or ""
i = i + exponent_part:len()
local full_number_text = integer_part .. decimal_part .. exponent_part
local as_number = tonumber(full_number_text)
if not as_number then
self:onDecodeError("bad number", text, start, etc)
end
return as_number, i
end
local function grok_string(self, text, start, etc)
if text:sub(start,start) ~= '"' then
self:onDecodeError("expected string's opening quote", text, start, etc)
end
local i = start + 1 -- +1 to bypass the initial quote
local text_len = text:len()
local VALUE = ""
while i <= text_len do
local c = text:sub(i,i)
if c == '"' then
return VALUE, i + 1
end
if c ~= '\\' then
VALUE = VALUE .. c
i = i + 1
elseif text:match('^\\b', i) then
VALUE = VALUE .. "\b"
i = i + 2
elseif text:match('^\\f', i) then
VALUE = VALUE .. "\f"
i = i + 2
elseif text:match('^\\n', i) then
VALUE = VALUE .. "\n"
i = i + 2
elseif text:match('^\\r', i) then
VALUE = VALUE .. "\r"
i = i + 2
elseif text:match('^\\t', i) then
VALUE = VALUE .. "\t"
i = i + 2
else
local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i)
if hex then
i = i + 6 -- bypass what we just read
-- We have a Unicode codepoint. It could be standalone, or if in the proper range and
-- followed by another in a specific range, it'll be a two-code surrogate pair.
local codepoint = tonumber(hex, 16)
if codepoint >= 0xD800 and codepoint <= 0xDBFF then
-- it's a hi surrogate... see whether we have a following low
local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i)
if lo_surrogate then
i = i + 6 -- bypass the low surrogate we just read
codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16)
else
-- not a proper low, so we'll just leave the first codepoint as is and spit it out.
end
end
VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint)
else
-- just pass through what's escaped
VALUE = VALUE .. text:match('^\\(.)', i)
i = i + 2
end
end
end
self:onDecodeError("unclosed string", text, start, etc)
end
local function skip_whitespace(text, start)
local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2
if match_end then
return match_end + 1
else
return start
end
end
local grok_one -- assigned later
local function grok_object(self, text, start, etc)
if text:sub(start,start) ~= '{' then
self:onDecodeError("expected '{'", text, start, etc)
end
local i = skip_whitespace(text, start + 1) -- +1 to skip the '{'
local VALUE = self.strictTypes and self:newObject { } or { }
if text:sub(i,i) == '}' then
return VALUE, i + 1
end
local text_len = text:len()
while i <= text_len do
local key, new_i = grok_string(self, text, i, etc)
i = skip_whitespace(text, new_i)
if text:sub(i, i) ~= ':' then
self:onDecodeError("expected colon", text, i, etc)
end
i = skip_whitespace(text, i + 1)
local new_val, new_i = grok_one(self, text, i)
VALUE[key] = new_val
--
-- Expect now either '}' to end things, or a ',' to allow us to continue.
--
i = skip_whitespace(text, new_i)
local c = text:sub(i,i)
if c == '}' then
return VALUE, i + 1
end
if text:sub(i, i) ~= ',' then
self:onDecodeError("expected comma or '}'", text, i, etc)
end
i = skip_whitespace(text, i + 1)
end
self:onDecodeError("unclosed '{'", text, start, etc)
end
local function grok_array(self, text, start, etc)
if text:sub(start,start) ~= '[' then
self:onDecodeError("expected '['", text, start, etc)
end
local i = skip_whitespace(text, start + 1) -- +1 to skip the '['
local VALUE = self.strictTypes and self:newArray { } or { }
if text:sub(i,i) == ']' then
return VALUE, i + 1
end
local VALUE_INDEX = 1
local text_len = text:len()
while i <= text_len do
local val, new_i = grok_one(self, text, i)
-- can't table.insert(VALUE, val) here because it's a no-op if val is nil
VALUE[VALUE_INDEX] = val
VALUE_INDEX = VALUE_INDEX + 1
i = skip_whitespace(text, new_i)
--
-- Expect now either ']' to end things, or a ',' to allow us to continue.
--
local c = text:sub(i,i)
if c == ']' then
return VALUE, i + 1
end
if text:sub(i, i) ~= ',' then
self:onDecodeError("expected comma or '['", text, i, etc)
end
i = skip_whitespace(text, i + 1)
end
self:onDecodeError("unclosed '['", text, start, etc)
end
grok_one = function(self, text, start, etc)
-- Skip any whitespace
start = skip_whitespace(text, start)
if start > text:len() then
self:onDecodeError("unexpected end of string", text, nil, etc)
end
if text:find('^"', start) then
return grok_string(self, text, start, etc)
elseif text:find('^[-0123456789 ]', start) then
return grok_number(self, text, start, etc)
elseif text:find('^%{', start) then
return grok_object(self, text, start, etc)
elseif text:find('^%[', start) then
return grok_array(self, text, start, etc)
elseif text:find('^true', start) then
return true, start + 4
elseif text:find('^false', start) then
return false, start + 5
elseif text:find('^null', start) then
return nil, start + 4
else
self:onDecodeError("can't parse JSON", text, start, etc)
end
end
function OBJDEF:decode(text, etc)
if type(self) ~= 'table' or self.__index ~= OBJDEF then
OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc)
end
if text == nil then
self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc)
elseif type(text) ~= 'string' then
self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc)
end
if text:match('^%s*$') then
return nil
end
if text:match('^%s*<') then
-- Can't be JSON... we'll assume it's HTML
self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc)
end
--
-- Ensure that it's not UTF-32 or UTF-16.
-- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3),
-- but this package can't handle them.
--
if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then
self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc)
end
local success, value = pcall(grok_one, self, text, 1, etc)
if success then
return value
else
-- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert.
if self.assert then
self.assert(false, value)
else
assert(false, value)
end
-- and if we're still here, return a nil and throw the error message on as a second arg
return nil, value
end
end
local function backslash_replacement_function(c)
if c == "\n" then
return "\\n"
elseif c == "\r" then
return "\\r"
elseif c == "\t" then
return "\\t"
elseif c == "\b" then
return "\\b"
elseif c == "\f" then
return "\\f"
elseif c == '"' then
return '\\"'
elseif c == '\\' then
return '\\\\'
else
return string.format("\\u%04x", c:byte())
end
end
local chars_to_be_escaped_in_JSON_string
= '['
.. '"' -- class sub-pattern to match a double quote
.. '%\\' -- class sub-pattern to match a backslash
.. '%z' -- class sub-pattern to match a null
.. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters
.. ']'
local function json_string_literal(value)
local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function)
return '"' .. newval .. '"'
end
local function object_or_array(self, T, etc)
--
-- We need to inspect all the keys... if there are any strings, we'll convert to a JSON
-- object. If there are only numbers, it's a JSON array.
--
-- If we'll be converting to a JSON object, we'll want to sort the keys so that the
-- end result is deterministic.
--
local string_keys = { }
local number_keys = { }
local number_keys_must_be_strings = false
local maximum_number_key
for key in pairs(T) do
if type(key) == 'string' then
table.insert(string_keys, key)
elseif type(key) == 'number' then
table.insert(number_keys, key)
if key <= 0 or key >= math.huge then
number_keys_must_be_strings = true
elseif not maximum_number_key or key > maximum_number_key then
maximum_number_key = key
end
else
self:onEncodeError("can't encode table with a key of type " .. type(key), etc)
end
end
if #string_keys == 0 and not number_keys_must_be_strings then
--
-- An empty table, or a numeric-only array
--
if #number_keys > 0 then
return nil, maximum_number_key -- an array
elseif tostring(T) == "JSON array" then
return nil
elseif tostring(T) == "JSON object" then
return { }
else
-- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects
return nil
end
end
table.sort(string_keys)
local map
if #number_keys > 0 then
--
-- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array
-- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object.
--
if self.noKeyConversion then
self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc)
end
--
-- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings
--
map = { }
for key, val in pairs(T) do
map[key] = val
end
table.sort(number_keys)
--
-- Throw numeric keys in there as strings
--
for _, number_key in ipairs(number_keys) do
local string_key = tostring(number_key)
if map[string_key] == nil then
table.insert(string_keys , string_key)
map[string_key] = T[number_key]
else
self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc)
end
end
end
return string_keys, nil, map
end
--
-- Encode
--
-- 'options' is nil, or a table with possible keys:
-- pretty -- if true, return a pretty-printed version
-- indent -- a string (usually of spaces) used to indent each nested level
-- align_keys -- if true, align all the keys when formatting a table
--
local encode_value -- must predeclare because it calls itself
function encode_value(self, value, parents, etc, options, indent)
if value == nil then
return 'null'
elseif type(value) == 'string' then
return json_string_literal(value)
elseif type(value) == 'number' then
if value ~= value then
--
-- NaN (Not a Number).
-- JSON has no NaN, so we have to fudge the best we can. This should really be a package option.
--
return "null"
elseif value >= math.huge then
--
-- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should
-- really be a package option. Note: at least with some implementations, positive infinity
-- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is.
-- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">="
-- case first.
--
return "1e+9999"
elseif value <= -math.huge then
--
-- Negative infinity.
-- JSON has no INF, so we have to fudge the best we can. This should really be a package option.
--
return "-1e+9999"
else
return tostring(value)
end
elseif type(value) == 'boolean' then
return tostring(value)
elseif type(value) ~= 'table' then
self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc)
else
--
-- A table to be converted to either a JSON object or array.
--
local T = value
if type(options) ~= 'table' then
options = {}
end
if type(indent) ~= 'string' then
indent = ""
end
if parents[T] then
self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc)
else
parents[T] = true
end
local result_value
local object_keys, maximum_number_key, map = object_or_array(self, T, etc)
if maximum_number_key then
--
-- An array...
--
local ITEMS = { }
for i = 1, maximum_number_key do
table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent))
end
if options.pretty then
result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]"
else
result_value = "[" .. table.concat(ITEMS, ",") .. "]"
end
elseif object_keys then
--
-- An object
--
local TT = map or T
if options.pretty then
local KEYS = { }
local max_key_length = 0
for _, key in ipairs(object_keys) do
local encoded = encode_value(self, tostring(key), parents, etc, options, indent)
if options.align_keys then
max_key_length = math.max(max_key_length, #encoded)
end
table.insert(KEYS, encoded)
end
local key_indent = indent .. tostring(options.indent or "")
local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "")
local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s"
local COMBINED_PARTS = { }
for i, key in ipairs(object_keys) do
local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent)
table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val))
end
result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}"
else
local PARTS = { }
for _, key in ipairs(object_keys) do
local encoded_val = encode_value(self, TT[key], parents, etc, options, indent)
local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent)
table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val))
end
result_value = "{" .. table.concat(PARTS, ",") .. "}"
end
else
--
-- An empty array/object... we'll treat it as an array, though it should really be an option
--
result_value = "[]"
end
parents[T] = false
return result_value
end
end
function OBJDEF:encode(value, etc, options)
if type(self) ~= 'table' or self.__index ~= OBJDEF then
OBJDEF:onEncodeError("JSON:encode must be called in method format", etc)
end
return encode_value(self, value, {}, etc, options or nil)
end
function OBJDEF:encode_pretty(value, etc, options)
if type(self) ~= 'table' or self.__index ~= OBJDEF then
OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc)
end
return encode_value(self, value, {}, etc, options or default_pretty_options)
end
function OBJDEF.__tostring()
return "JSON encode/decode package"
end
OBJDEF.__index = OBJDEF
function OBJDEF:new(args)
local new = { }
if args then
for key, val in pairs(args) do
new[key] = val
end
end
return setmetatable(new, OBJDEF)
end
return OBJDEF:new()
--
-- Version history:
--
-- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really
-- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines
-- more flexible, and changed the default encode_pretty() to be more generally useful.
--
-- Added a third 'options' argument to the encode() and encode_pretty() routines, to control
-- how the encoding takes place.
--
-- Updated docs to add assert() call to the loadfile() line, just as good practice so that
-- if there is a problem loading JSON.lua, the appropriate error message will percolate up.
--
-- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string,
-- so that the source of the package, and its version number, are visible in compiled copies.
--
-- 20140911.12 Minor lua cleanup.
-- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'.
-- (Thanks to SmugMug's David Parry for these.)
--
-- 20140418.11 JSON nulls embedded within an array were being ignored, such that
-- ["1",null,null,null,null,null,"seven"],
-- would return
-- {1,"seven"}
-- It's now fixed to properly return
-- {1, nil, nil, nil, nil, nil, "seven"}
-- Thanks to "haddock" for catching the error.
--
-- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up.
--
-- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2",
-- and this caused some problems.
--
-- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate,
-- and had of course diverged (encode_pretty didn't get the fixes that encode got, so
-- sometimes produced incorrect results; thanks to Mattie for the heads up).
--
-- Handle encoding tables with non-positive numeric keys (unlikely, but possible).
--
-- If a table has both numeric and string keys, or its numeric keys are inappropriate
-- (such as being non-positive or infinite), the numeric keys are turned into
-- string keys appropriate for a JSON object. So, as before,
-- JSON:encode({ "one", "two", "three" })
-- produces the array
-- ["one","two","three"]
-- but now something with mixed key types like
-- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" }))
-- instead of throwing an error produces an object:
-- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"}
--
-- To maintain the prior throw-an-error semantics, set
-- JSON.noKeyConversion = true
--
-- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry.
--
-- 20130120.6 Comment update: added a link to the specific page on my blog where this code can
-- be found, so that folks who come across the code outside of my blog can find updates
-- more easily.
--
-- 20111207.5 Added support for the 'etc' arguments, for better error reporting.
--
-- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent.
--
-- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules:
--
-- * When encoding lua for JSON, Sparse numeric arrays are now handled by
-- spitting out full arrays, such that
-- JSON:encode({"one", "two", [10] = "ten"})
-- returns
-- ["one","two",null,null,null,null,null,null,null,"ten"]
--
-- In 20100810.2 and earlier, only up to the first non-null value would have been retained.
--
-- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999".
-- Version 20100810.2 and earlier created invalid JSON in both cases.
--
-- * Unicode surrogate pairs are now detected when decoding JSON.
--
-- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding
--
-- 20100731.1 initial public release
--
| gpl-3.0 |
nesstea/darkstar | scripts/globals/spells/hojo_ni.lua | 27 | 1246 | -----------------------------------------
-- Spell: Hojo:Ni
-- Description: Inflicts Slow on target.
-- Edited from slow.lua
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local dINT = (caster:getStat(MOD_INT) - target:getStat(MOD_INT));
--Power for Hojo is a flat 19.5% reduction
local power = 200;
--Duration and Resistance calculation
local duration = 300 * applyResistance(caster,spell,target,dINT,NINJUTSU_SKILL,0);
--Calculates the resist chance from Resist Blind trait
if (math.random(0,100) >= target:getMod(MOD_SLOWRES)) then
-- Spell succeeds if a 1 or 1/2 resist check is achieved
if (duration >= 150) then
if (target:addStatusEffect(EFFECT_SLOW,power,0,duration)) then
spell:setMsg(236);
else
spell:setMsg(75);
end
else
spell:setMsg(85);
end
else
spell:setMsg(284);
end
return EFFECT_SLOW;
end; | gpl-3.0 |
aqasaeed/spartafinal | plugins/ingroup.lua | 527 | 44020 | do
-- Check Member
local function check_member_autorealm(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)] = {
group_type = 'Realm',
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 realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Welcome to your new realm !')
end
end
end
local function check_member_realm_add(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)] = {
group_type = 'Realm',
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 realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been added!')
end
end
end
function check_member_group(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)] = {
group_type = 'Group',
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)] = {
group_type = 'Group',
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_group,{receiver=receiver, data=data, msg = msg})
end
end
local function autorealmadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_autorealm,{receiver=receiver, data=data, msg = msg})
end
end
local function check_member_realmrem(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
-- Realm configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been removed!')
end
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
--End Check Member
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 leave_ban = "no"
if data[tostring(msg.to.id)]['settings']['leave_ban'] then
leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
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.."\nLock group leave : "..leave_ban.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection--"\nPublic: "..public
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 set_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'yes' then
return 'Group is already public'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group is now: public'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'no' then
return 'Group is not public'
else
data[tostring(target)]['settings']['public'] = 'no'
save_data(_config.moderation.data, data)
return 'Group is now: not public'
end
end
local function lock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'yes' then
return 'Leaving users will be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Leaving users will be banned'
end
local function unlock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'no' then
return 'Leaving users will not be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'no'
save_data(_config.moderation.data, data)
return 'Leaving users will not be banned'
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 is_group(msg) 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 realmadd(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 is_realm(msg) then
return 'Realm is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realm_add,{receiver=receiver, data=data, msg = msg})
end
-- Global functions
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 is_group(msg) then
return 'Group is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg})
end
function realmrem(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 is_realm(msg) then
return 'Realm is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realmrem,{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 promote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'.. msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return promote(get_receiver(msg), member_username, member_id)
end
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 demote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'..msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return demote(get_receiver(msg), member_username, member_id)
end
end
local function setowner_by_reply(extra, success, result)
local msg = result
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
local name_log = msg.from.print_name:gsub("_", " ")
data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] setted ["..msg.from.id.."] as owner")
local text = msg.from.print_name:gsub("_", " ").." is the owner now"
return send_large_msg(receiver, text)
end
local function promote_demote_res(extra, success, result)
--vardump(result)
--vardump(extra)
local member_id = result.id
local member_username = "@"..result.username
local chat_id = extra.chat_id
local mod_cmd = extra.mod_cmd
local receiver = "chat#id"..chat_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
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][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)
--vardump(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
for k,v in pairs(result.members) do
kick_user(v.id, result.id)
end
end
local function killchat(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function killrealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function user_msgs(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 = tonumber(redis:get(um_hash) or 0)
return user_info
end
local function kick_zero(cb_extra, success, result)
local chat_id = cb_extra.chat_id
local chat = "chat#id"..chat_id
local ci_user
local re_user
for k,v in pairs(result.members) do
local si = false
ci_user = v.id
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
for i = 1, #users do
re_user = users[i]
if tonumber(ci_user) == tonumber(re_user) then
si = true
end
end
if not si then
if ci_user ~= our_id then
if not is_momod2(ci_user, chat_id) then
chat_del_user(chat, 'user#id'..ci_user, ok_cb, true)
end
end
end
end
end
local function kick_inactive(chat_id, num, receiver)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = user_msgs(user_id, chat_id)
local nmsg = user_info
if tonumber(nmsg) < tonumber(num) then
if not is_momod2(user_id, chat_id) then
chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true)
end
end
end
return chat_info(receiver, kick_zero, {chat_id = chat_id})
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' and not matches[2] then
if is_realm(msg) then
return 'Error: Already a realm.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added")
return modadd(msg)
end
if matches[1] == 'add' and matches[2] == 'realm' then
if is_group(msg) then
return 'Error: Already a group.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm")
return realmadd(msg)
end
if matches[1] == 'rem' and not matches[2] then
print("group "..msg.to.print_name.."("..msg.to.id..") removed")
return modrem(msg)
end
if matches[1] == 'rem' and matches[2] == 'realm' then
print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm")
return realmrem(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then
return automodadd(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then
return autorealmadd(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_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 not matches[2] then
if not is_owner(msg) then
return "Only the owner can prmote new moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, promote_by_reply, false)
end
end
if matches[1] == 'promote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can promote"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'promote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'demote' and not matches[2] then
if not is_owner(msg) then
return "Only the owner can demote moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, demote_by_reply, false)
end
end
if matches[1] == 'demote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can demote"
end
if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then
return "You can't demote yourself"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'demote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
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
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ")
return lock_group_leave(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
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ")
return unlock_group_leave(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] == 'public' then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public")
return unset_public_membermod(msg, data, target)
end
end]]
if matches[1] == 'newlink' and not is_realm(msg) 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' and matches[2] 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] == 'setowner' and not matches[2] then
if not is_owner(msg) then
return "only for the owner!"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, setowner_by_reply, false)
end
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] == 'kill' and matches[2] == 'chat' then
if not is_admin(msg) then
return nil
end
if not is_realm(msg) then
local receiver = get_receiver(msg)
return modrem(msg),
print("Closing Group..."),
chat_info(receiver, killchat, {receiver=receiver})
else
return 'This is a realm'
end
end
if matches[1] == 'kill' and matches[2] == 'realm' then
if not is_admin(msg) then
return nil
end
if not is_group(msg) then
local receiver = get_receiver(msg)
return realmrem(msg),
print("Closing Realm..."),
chat_info(receiver, killrealm, {receiver=receiver})
else
return 'This is a group'
end
end
if matches[1] == 'help' then
if not is_momod(msg) or is_realm(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
if matches[1] == 'kickinactive' then
--send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]')
if not is_momod(msg) then
return 'Only a moderator can kick inactive users'
end
local num = 1
if matches[2] then
num = matches[2]
end
local chat_id = msg.to.id
local receiver = get_receiver(msg)
return kick_inactive(chat_id, num, receiver)
end
end
end
return {
patterns = {
"^[!/](add)$",
"^[!/](add) (realm)$",
"^[!/](rem)$",
"^[!/](rem) (realm)$",
"^[!/](rules)$",
"^[!/](about)$",
"^[!/](setname) (.*)$",
"^[!/](setphoto)$",
"^[!/](promote) (.*)$",
"^[!/](promote)",
"^[!/](help)$",
"^[!/](clean) (.*)$",
"^[!/](kill) (chat)$",
"^[!/](kill) (realm)$",
"^[!/](demote) (.*)$",
"^[!/](demote)",
"^[!/](set) ([^%s]+) (.*)$",
"^[!/](lock) (.*)$",
"^[!/](setowner) (%d+)$",
"^[!/](setowner)",
"^[!/](owner)$",
"^[!/](res) (.*)$",
"^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^[!/](unlock) (.*)$",
"^[!/](setflood) (%d+)$",
"^[!/](settings)$",
-- "^[!/](public) (.*)$",
"^[!/](modlist)$",
"^[!/](newlink)$",
"^[!/](link)$",
"^[!/](kickinactive)$",
"^[!/](kickinactive) (%d+)$",
"%[(photo)%]",
"^!!tgservice (.+)$",
},
run = run
}
end
| gpl-2.0 |
UnfortunateFruit/darkstar | scripts/zones/Tavnazian_Safehold/npcs/Morangeart.lua | 38 | 1057 | -----------------------------------
-- Area: Tavnazian Safehold
-- NPC: Morangeart
-- Type: ENM Quest Activator
-- @zone: 26
-- @pos -74.308 -24.782 -28.475
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0208);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/The_Sanctuary_of_ZiTah/npcs/qm2.lua | 8 | 1835 | -----------------------------------
-- Area: The Sanctuary of ZiTah
-- NPC: qm2 (???)
-- Involved in Quest: Forge Your Destiny
-- @pos 639 -1 -151 121
-----------------------------------
package.loaded["scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/The_Sanctuary_of_ZiTah/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if(player:getQuestStatus(OUTLANDS,FORGE_YOUR_DESTINY) == QUEST_ACCEPTED) then
if(trade:hasItemQty(1021,1) and trade:getItemCount() == 1 and player:hasItem(1153) == false) then
if(GetMobAction(17272838) == 0) then
SpawnMob(17272838,288):updateClaim(player); -- Spawn Guardian Treant
player:tradeComplete();
end
elseif(player:getVar("ForgeYourDestiny_killed") == 1) then
if(trade:hasItemQty(1198,1) and trade:getItemCount() == 1) then
player:tradeComplete();
player:addItem(1153);
player:messageSpecial(ITEM_OBTAINED, 1153); -- Sacred Branch
player:setVar("ForgeYourDestiny_killed",0);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(STURDY_BRANCH,1021);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Lower_Jeuno/npcs/Tuh_Almobankha.lua | 15 | 3827 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Tuh Almobankha
-- Title Change NPC
-- @pos -14 0 -61 245
-----------------------------------
require("scripts/globals/titles");
local title2 = { BROWN_MAGE_GUINEA_PIG , BROWN_MAGIC_BYPRODUCT , RESEARCHER_OF_CLASSICS , TORCHBEARER , FORTUNETELLER_IN_TRAINING ,
CHOCOBO_TRAINER , CLOCK_TOWER_PRESERVATIONIST , LIFE_SAVER , CARD_COLLECTOR , TWOS_COMPANY , TRADER_OF_ANTIQUITIES , GOBLINS_EXCLUSIVE_FASHION_MANNEQUIN ,
TENSHODO_MEMBER , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
local title3 = { ACTIVIST_FOR_KINDNESS , ENVOY_TO_THE_NORTH , EXORCIST_IN_TRAINING , FOOLS_ERRAND_RUNNER , STREET_SWEEPER ,
MERCY_ERRAND_RUNNER , BELIEVER_OF_ALTANA , TRADER_OF_MYSTERIES , WANDERING_MINSTREL , ANIMAL_TRAINER , HAVE_WINGS_WILL_FLY ,
ROD_RETRIEVER , DESTINED_FELLOW , TROUPE_BRILIOTH_DANCER , PROMISING_DANCER , STARDUST_DANCER ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
local title4 = { TIMEKEEPER , BRINGER_OF_BLISS , PROFESSIONAL_LOAFER , TRADER_OF_RENOWN , HORIZON_BREAKER , SUMMIT_BREAKER ,
BROWN_BELT , DUCAL_DUPE , CHOCOBO_LOVE_GURU , PICKUP_ARTIST , WORTHY_OF_TRUST , A_FRIEND_INDEED , CHOCOROOKIE , CRYSTAL_STAKES_CUPHOLDER ,
WINNING_OWNER , VICTORIOUS_OWNER , TRIUMPHANT_OWNER , HIGH_ROLLER , FORTUNES_FAVORITE , CHOCOCHAMPION ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
local title5 = { PARAGON_OF_BEASTMASTER_EXCELLENCE , PARAGON_OF_BARD_EXCELLENCE , SKY_BREAKER , BLACK_BELT , GREEDALOX , CLOUD_BREAKER ,
STAR_BREAKER , ULTIMATE_CHAMPION_OF_THE_WORLD , DYNAMISJEUNO_INTERLOPER , DYNAMISBEAUCEDINE_INTERLOPER , DYNAMISXARCABARD_INTERLOPER ,
DYNAMISQUFIM_INTERLOPER , CONQUEROR_OF_FATE , SUPERHERO , SUPERHEROINE , ELEGANT_DANCER , DAZZLING_DANCE_DIVA , GRIMOIRE_BEARER ,
FELLOW_FORTIFIER , BUSHIN_ASPIRANT , BUSHIN_RYU_INHERITOR , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
local title6 = { GRAND_GREEDALOX , SILENCER_OF_THE_ECHO , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
local title7 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x271E,npcUtil.genTmask(player,title2),npcUtil.genTmask(player,title3),npcUtil.genTmask(player,title4),npcUtil.genTmask(player,title5),npcUtil.genTmask(player,title6),npcUtil.genTmask(player,title7),1 ,player:getGil());
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==0x271E) then
if(option > 0 and option <29) then
if (player:delGil(400)) then
player:setTitle( title2[option] )
end
elseif(option > 256 and option <285) then
if (player:delGil(500)) then
player:setTitle( title3[option - 256] )
end
elseif(option > 512 and option < 541) then
if (player:delGil(600)) then
player:setTitle( title4[option - 512] )
end
elseif(option > 768 and option <797) then
if (player:delGil(700)) then
player:setTitle( title5[option - 768] )
end
elseif(option > 1024 and option < 1053) then
if (player:delGil(800)) then
player:setTitle( title6[option - 1024] )
end
end
end
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/serving_of_golden_royale.lua | 36 | 1429 | -----------------------------------------
-- ID: 5558
-- Item: Serving of Golden Royale
-- Food Effect: 4 Hrs, All Races
-----------------------------------------
-- TODO: Group Effect
-- HP +10
-- MP +10
-- Intelligence +2
-- HP Recoverd while healing 2
-- MP Recovered while healing 2
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,5558);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 10);
target:addMod(MOD_MP, 10);
target:addMod(MOD_INT, 2);
target:addMod(MOD_HPHEAL, 2);
target:addMod(MOD_MPHEAL, 2);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 10);
target:delMod(MOD_MP, 10);
target:delMod(MOD_INT, 2);
target:delMod(MOD_HPHEAL, 2);
target:delMod(MOD_MPHEAL, 2);
end;
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/bowl_of_adoulin_soup.lua | 36 | 1504 | -----------------------------------------
-- ID: 5998
-- Item: Bowl of Adoulin Soup
-- Food Effect: 180 Min, All Races
-----------------------------------------
-- HP % 3 Cap 40
-- Vitality 3
-- Defense % 15 Cap 70
-- HP Healing 6
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,10800,5998);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_HPP, 3);
target:addMod(MOD_FOOD_HP_CAP, 40);
target:addMod(MOD_VIT, 3);
target:addMod(MOD_FOOD_DEFP, 15);
target:addMod(MOD_FOOD_DEF_CAP, 70);
target:addMod(MOD_HPHEAL, 6);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_HPP, 3);
target:delMod(MOD_FOOD_HP_CAP, 40);
target:delMod(MOD_VIT, 3);
target:delMod(MOD_FOOD_DEFP, 15);
target:delMod(MOD_FOOD_DEF_CAP, 70);
target:delMod(MOD_HPHEAL, 6);
end;
| gpl-3.0 |
nesstea/darkstar | scripts/globals/items/simit.lua | 19 | 1289 | -----------------------------------------
-- ID: 5596
-- Item: simit
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Health 16
-- Dexterity -1
-- Vitality 3
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,5596);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 16);
target:addMod(MOD_DEX, -1);
target:addMod(MOD_VIT, 3);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 16);
target:delMod(MOD_DEX, -1);
target:delMod(MOD_VIT, 3);
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Den_of_Rancor/npcs/_4g4.lua | 10 | 2108 | -----------------------------------
-- Area: Den of Rancor
-- NPC: Lantern (NW)
-- @pos -59 45 24 160
-----------------------------------
package.loaded["scripts/zones/Den_of_Rancor/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Den_of_Rancor/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local Lantern_ID = 17433047
local LSW = GetNPCByID(Lantern_ID):getAnimation();
local LNW = GetNPCByID(Lantern_ID+1):getAnimation();
local LNE = GetNPCByID(Lantern_ID+2):getAnimation();
local LSE = GetNPCByID(Lantern_ID+3):getAnimation();
-- Trade Crimson Rancor Flame
if(trade:hasItemQty(1139,1) and trade:getItemCount() == 1) then
if (LNW == 8) then
player:messageSpecial(LANTERN_OFFSET + 7); -- already lit
elseif(LNW == 9)then
npc:openDoor(LANTERNS_STAY_LIT);
local ALL = LSW+LNE+LSE;
player:tradeComplete();
player:addItem(1138); -- Unlit Lantern
if ALL == 27 then
player:messageSpecial(LANTERN_OFFSET + 9);
elseif ALL == 26 then
player:messageSpecial(LANTERN_OFFSET + 10);
elseif ALL == 25 then
player:messageSpecial(LANTERN_OFFSET + 11);
elseif ALL == 24 then
player:messageSpecial(LANTERN_OFFSET + 12);
GetNPCByID(Lantern_ID+3):closeDoor(1);
GetNPCByID(Lantern_ID+2):closeDoor(1);
GetNPCByID(Lantern_ID+1):closeDoor(1);
GetNPCByID(Lantern_ID):closeDoor(1);
GetNPCByID(Lantern_ID+4):openDoor(30);
GetNPCByID(Lantern_ID+3):openDoor(30);
GetNPCByID(Lantern_ID+2):openDoor(30);
GetNPCByID(Lantern_ID+1):openDoor(30);
GetNPCByID(Lantern_ID):openDoor(30);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local npca = npc:getAnimation()
if (npca == 8) then
player:messageSpecial(LANTERN_OFFSET + 7); -- already lit
else
player:messageSpecial(LANTERN_OFFSET + 20); -- unlit
end
return 0;
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/weaponskills/blade_jin.lua | 30 | 1426 | -----------------------------------
-- Blade Jin
-- Katana weapon skill
-- Skill Level: 200
-- Delivers a three-hit attack. Chance of params.critical varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Breeze Gorget & Thunder Gorget.
-- Aligned with the Breeze Belt & Thunder Belt.
-- Element: Wind
-- Modifiers: STR:30% ; DEX:30%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 3;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.3; params.dex_wsc = 0.3; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.1; params.crit200 = 0.3; params.crit300 = 0.5;
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.ftp100 = 1.375; params.ftp200 = 1.375; params.ftp300 = 1.375;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/items/smilodon_liver.lua | 18 | 1281 | -----------------------------------------
-- ID: 5668
-- Item: Smilodon Liver
-- Food Effect: 5Min, Galka only
-----------------------------------------
-- Strength 5
-- Intelligence -7
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:getRace() ~= 8) then
result = 247;
end
if(target:getMod(MOD_EAT_RAW_MEAT) == 1) then
result = 0;
end
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,5668);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 5);
target:addMod(MOD_INT, -7);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 5);
target:delMod(MOD_INT, -7);
end;
| gpl-3.0 |
nesstea/darkstar | scripts/zones/Western_Altepa_Desert/npcs/_3h5.lua | 13 | 1873 | -----------------------------------
-- Area: Western Altepa Desert
-- NPC: _3h5 (Ruby Column)
-- Notes: Mechanism for Altepa Gate
-- @pos 59 10 -104 125
-----------------------------------
package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Western_Altepa_Desert/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local RubyID = npc:getID();
local Ruby = npc:getAnimation();
local Topaz = GetNPCByID(RubyID+1):getAnimation();
local Emerald = GetNPCByID(RubyID+2):getAnimation();
local Sapphire = GetNPCByID(RubyID+3):getAnimation();
if (Ruby ~= 8) then
npc:setAnimation(8);
GetNPCByID(RubyID-4):setAnimation(8);
else
player:messageSpecial(DOES_NOT_RESPOND);
end
if (Emerald == 8 and Sapphire == 8 and Topaz == 8) then
local rand = math.random(15,30);
local randT = rand * 60;
-- Add timer for the door
GetNPCByID(RubyID-5):openDoor(randT);
-- Add same timer for the 4 center lights
GetNPCByID(RubyID-4):openDoor(randT);
GetNPCByID(RubyID-3):openDoor(randT);
GetNPCByID(RubyID-2):openDoor(randT);
GetNPCByID(RubyID-1):openDoor(randT);
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 |
jj918160/cocos2d-x-samples | samples/KillBug/src/cocos/framework/extends/UICheckBox.lua | 57 | 1436 |
--[[
Copyright (c) 2011-2014 chukong-inc.com
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.
]]
local CheckBox = ccui.CheckBox
function CheckBox:onEvent(callback)
self:addEventListener(function(sender, eventType)
local event = {}
if eventType == 0 then
event.name = "selected"
else
event.name = "unselected"
end
event.target = sender
callback(event)
end)
return self
end
| mit |
dpino/snabbswitch | src/program/alarms/set_operator_state/set_operator_state.lua | 7 | 1568 | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local common = require("program.config.common")
function show_usage(program, status, err_msg)
if err_msg then print('error: '..err_msg) end
print(require("program.alarms.set_operator_state.README_inc"))
main.exit(status)
end
local function fatal()
show_usage('set-operator-state', 1)
end
local function parse_args (args)
if #args < 3 or #args > 4 then fatal() end
local alarm_type_id, alarm_type_qualifier = (args[2]):match("([%w]+)/([%w]+)")
if not alarm_type_id then
alarm_type_id, alarm_type_qualifier = args[2], ''
end
local ret = {
key = {
resource = args[1],
alarm_type_id = alarm_type_id,
alarm_type_qualifier = alarm_type_qualifier,
},
state = args[3],
text = args[4] or '',
}
return ret
end
function run(args)
local opts = { command='set-alarm-operator-state', with_path=false, is_config=false,
usage=show_usage, allow_extra_args=true }
local args, cdr = common.parse_command_line(args, opts)
local l_args = parse_args(cdr)
local response = common.call_leader(
args.instance_id, 'set-alarm-operator-state',
{ schema = args.schema_name, revision = args.revision_date,
resource = l_args.key.resource, alarm_type_id = l_args.key.alarm_type_id,
alarm_type_qualifier = l_args.key.alarm_type_qualifier,
state = l_args.state, text = l_args.text })
common.print_and_exit(response, "success")
end
| apache-2.0 |
plajjan/snabbswitch | src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.lua | 5 | 1720 | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local lib = require("core.lib")
local syscall = require("syscall")
local usage = require("program.snabbnfv.neutron_sync_agent.README_inc")
local script = require("program.snabbnfv.neutron_sync_agent.neutron_sync_agent_sh_inc")
local long_opts = {
["neutron-dir"] = "d",
["snabb-dir"] = "s",
["tmp-dir"] = "t",
["sync-host"] = "h",
["sync-port"] = "P",
["sync-path"] = "p",
["interval"] = "i",
["help"] = "H"
}
function run (args)
local conf = {
["NEUTRON_DIR"] = os.getenv("NEUTRON_DIR"),
["SNABB_DIR"] = os.getenv("SNABB_DIR"),
["TMP_DIR"] = os.getenv("TMP_DIR"),
["NEUTRON2SNABB"] = os.getenv("NEUTRON2SNABB"),
["SYNC_HOST"] = os.getenv("SYNC_HOST"),
["SYNC_PORT"] = os.getenv("SYNC_PORT"),
["SYNC_PATH"] = os.getenv("SYNC_PATH"),
["SYNC_INTERVAL"] = os.getenv("SYNC_INTERVAL")
}
local opt = {}
function opt.d (arg) conf["NEUTRON_DIR"] = arg end
function opt.s (arg) conf["SNABB_DIR"] = arg end
function opt.t (arg) conf["TMP_DIR"] = arg end
function opt.h (arg) conf["SYNC_HOST"] = arg end
function opt.P (arg) conf["SYNC_PORT"] = arg end
function opt.p (arg) conf["SYNC_PATH"] = arg end
function opt.i (arg) conf["SYNC_INTERVAL"] = arg end
function opt.H (arg) print(usage) main.exit(1) end
args = lib.dogetopt(args, opt, "d:s:t:h:P:p:i:H", long_opts)
local env = {}
for key, value in pairs(conf) do
table.insert(env, key.."="..value)
end
syscall.execve("/bin/bash", {"/bin/bash", "-c", script}, env)
end
| apache-2.0 |
UnfortunateFruit/darkstar | scripts/zones/Port_Jeuno/npcs/Rinzei.lua | 34 | 1369 | -----------------------------------
-- Area: Port Jeuno
-- NPC: Rinzei
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Port_Jeuno/TextIDs");
require("scripts/globals/quests");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local WildcatJeuno = player:getVar("WildcatJeuno");
if (player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_ACCEPTED and player:getMaskBit(WildcatJeuno,18) == false) then
player:startEvent(315);
else
player:startEvent(0x38);
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 == 315) then
player:setMaskBit(player:getVar("WildcatJeuno"),"WildcatJeuno",18,true);
end
end;
| gpl-3.0 |
nesstea/darkstar | scripts/globals/magic.lua | 2 | 45757 | require("scripts/globals/magicburst");
require("scripts/globals/status");
require("scripts/globals/weather");
require("scripts/globals/utils");
require("scripts/globals/settings");
MMSG_BUFF_FAIL = 75;
DIVINE_MAGIC_SKILL = 32;
HEALING_MAGIC_SKILL = 33;
ENHANCING_MAGIC_SKILL = 34;
ENFEEBLING_MAGIC_SKILL = 35;
ELEMENTAL_MAGIC_SKILL = 36;
DARK_MAGIC_SKILL = 37;
NINJUTSU_SKILL = 39;
SUMMONING_SKILL = 38;
SINGING_SKILL = 40;
STRING_SKILL = 41;
WIND_SKILL = 42;
BLUE_SKILL = 43;
FIRESDAY = 0;
EARTHSDAY = 1;
WATERSDAY = 2;
WINDSDAY = 3;
ICEDAY = 4;
LIGHTNINGDAY = 5;
LIGHTSDAY = 6;
DARKSDAY = 7;
ELE_NONE = 0;
ELE_FIRE = 1;
ELE_EARTH = 2;
ELE_WATER = 3;
ELE_WIND = 4;
ELE_ICE = 5;
ELE_LIGHTNING = 6;
-- added both because monsterstpmoves calls it thunder
ELE_THUNDER = 6;
ELE_LIGHT = 7;
ELE_DARK = 8;
dayStrong = {FIRESDAY, EARTHSDAY, WATERSDAY, WINDSDAY, ICEDAY, LIGHTNINGDAY, LIGHTSDAY, DARKSDAY};
dayWeak = {WATERSDAY, WINDSDAY, LIGHTNINGDAY, ICEDAY, FIRESDAY, EARTHSDAY, DARKSDAY, LIGHTSDAY};
singleWeatherStrong = {WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_RAIN, WEATHER_WIND, WEATHER_SNOW, WEATHER_THUNDER, WEATHER_AURORAS, WEATHER_GLOOM};
doubleWeatherStrong = {WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_SQUALL, WEATHER_GALES, WEATHER_BLIZZARDS, WEATHER_THUNDERSTORMS, WEATHER_STELLAR_GLARE, WEATHER_DARKNESS};
singleWeatherWeak = {WEATHER_RAIN, WEATHER_WIND, WEATHER_THUNDER, WEATHER_SNOW, WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_GLOOM, WEATHER_AURORAS};
doubleWeatherWeak = {WEATHER_SQUALL, WEATHER_GALES, WEATHER_THUNDERSTORMS, WEATHER_BLIZZARDS, WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_DARKNESS, WEATHER_STELLAR_GLARE};
elementalObi = {MOD_FORCE_FIRE_DWBONUS, MOD_FORCE_EARTH_DWBONUS, MOD_FORCE_WATER_DWBONUS, MOD_FORCE_WIND_DWBONUS, MOD_FORCE_ICE_DWBONUS, MOD_FORCE_LIGHTNING_DWBONUS, MOD_FORCE_LIGHT_DWBONUS, MOD_FORCE_DARK_DWBONUS};
elementalObiWeak = {MOD_FORCE_WATER_DWBONUS, MOD_FORCE_WIND_DWBONUS, MOD_FORCE_LIGHTNING_DWBONUS, MOD_FORCE_ICE_DWBONUS, MOD_FORCE_FIRE_DWBONUS, MOD_FORCE_EARTH_DWBONUS, MOD_FORCE_DARK_DWBONUS, MOD_FORCE_LIGHT_DWBONUS};
spellAcc = {MOD_FIREACC, MOD_EARTHACC, MOD_WATERACC, MOD_WINDACC, MOD_ICEACC, MOD_THUNDERACC, MOD_LIGHTACC, MOD_DARKACC};
strongAffinityDmg = {MOD_FIRE_AFFINITY_DMG, MOD_EARTH_AFFINITY_DMG, MOD_WATER_AFFINITY_DMG, MOD_WIND_AFFINITY_DMG, MOD_ICE_AFFINITY_DMG, MOD_THUNDER_AFFINITY_DMG, MOD_LIGHT_AFFINITY_DMG, MOD_DARK_AFFINITY_DMG};
strongAffinityAcc = {MOD_FIRE_AFFINITY_ACC, MOD_EARTH_AFFINITY_ACC, MOD_WATER_AFFINITY_ACC, MOD_WIND_AFFINITY_ACC, MOD_ICE_AFFINITY_ACC, MOD_THUNDER_AFFINITY_ACC, MOD_LIGHT_AFFINITY_ACC, MOD_DARK_AFFINITY_ACC};
resistMod = {MOD_FIRERES, MOD_EARTHRES, MOD_WATERRES, MOD_WINDRES, MOD_ICERES, MOD_THUNDERRES, MOD_LIGHTRES, MOD_DARKRES};
defenseMod = {MOD_FIREDEF, MOD_EARTHDEF, MOD_WATERDEF, MOD_WINDDEF, MOD_ICEDEF, MOD_THUNDERDEF, MOD_LIGHTDEF, MOD_DARKDEF};
absorbMod = {MOD_FIRE_ABSORB, MOD_EARTH_ABSORB, MOD_WATER_ABSORB, MOD_WIND_ABSORB, MOD_ICE_ABSORB, MOD_LTNG_ABSORB, MOD_LIGHT_ABSORB, MOD_DARK_ABSORB};
nullMod = {MOD_FIRE_NULL, MOD_EARTH_NULL, MOD_WATER_NULL, MOD_WIND_NULL, MOD_ICE_NULL, MOD_LTNG_NULL, MOD_LIGHT_NULL, MOD_DARK_NULL};
blmMerit = {MERIT_FIRE_MAGIC_POTENCY, MERIT_EARTH_MAGIC_POTENCY, MERIT_WATER_MAGIC_POTENCY, MERIT_WIND_MAGIC_POTENCY, MERIT_ICE_MAGIC_POTENCY, MERIT_LIGHTNING_MAGIC_POTENCY};
rdmMerit = {MERIT_FIRE_MAGIC_ACCURACY, MERIT_EARTH_MAGIC_ACCURACY, MERIT_WATER_MAGIC_ACCURACY, MERIT_WIND_MAGIC_ACCURACY, MERIT_ICE_MAGIC_ACCURACY, MERIT_LIGHTNING_MAGIC_ACCURACY};
blmAMIIMerit = {MERIT_FLARE_II, MERIT_QUAKE_II, MERIT_FLOOD_II, MERIT_TORNADO_II, MERIT_FREEZE_II, MERIT_BURST_II};
barSpells = {EFFECT_BARFIRE, EFFECT_BARSTONE, EFFECT_BARWATER, EFFECT_BARAERO, EFFECT_BARBLIZZARD, EFFECT_BARTHUNDER};
-- USED FOR DAMAGING MAGICAL SPELLS (Stages 1 and 2 in Calculating Magic Damage on wiki)
--Calculates magic damage using the standard magic damage calc.
--Does NOT handle resistance.
-- Inputs:
-- V - The base damage of the spell
-- M - The INT multiplier of the spell
-- skilltype - The skill ID of the spell.
-- atttype - The attribute type (usually MOD_INT , except for things like Banish which is MOD_MND)
-- hasMultipleTargetReduction - true ifdamage is reduced on AoE. False otherwise (e.g. Charged Whisker vs -ga3 spells)
--
-- Output:
-- The total damage, before resistance and before equipment (so no HQ staff bonus worked out here).
SOFT_CAP = 60; --guesstimated
HARD_CAP = 120; --guesstimated
function calculateMagicDamage(V,M,player,spell,target,skilltype,atttype,hasMultipleTargetReduction)
local dint = player:getStat(atttype) - target:getStat(atttype);
local dmg = V;
if (dint<=0) then --ifdINT penalises, it's always M=1
dmg = dmg + dint;
if (dmg <= 0) then --dINT penalty cannot result in negative damage (target absorption)
return 0;
end
elseif (dint > 0 and dint <= SOFT_CAP) then --The standard calc, most spells hit this
dmg = dmg + (dint*M);
elseif (dint > 0 and dint > SOFT_CAP and dint < HARD_CAP) then --After SOFT_CAP, INT is only half effective
dmg = dmg + SOFT_CAP*M + ((dint-SOFT_CAP)*M)/2;
elseif (dint > 0 and dint > SOFT_CAP and dint >= HARD_CAP) then --After HARD_CAP, INT has no effect.
dmg = dmg + HARD_CAP*M;
end
if (skilltype == DIVINE_MAGIC_SKILL and target:isUndead()) then
-- 150% bonus damage
dmg = dmg * 1.5;
end
-- printf("dmg: %d dint: %d\n", dmg, dint);
return dmg;
end;
function doBoostGain(caster,target,spell,effect)
local duration = 300;
if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then
duration = duration * 3;
end
--calculate potency
local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL);
local potency = math.floor((magicskill - 300) / 10) + 5;
if (potency > 25) then
potency = 25;
elseif (potency < 5) then
potency = 5;
end
--printf("BOOST-GAIN: POTENCY = %d", potency);
--Only one Boost Effect can be active at once, so if the player has any we have to cancel & overwrite
local effectOverwrite = {80, 81, 82, 83, 84, 85, 86};
for i, effect in ipairs(effectOverwrite) do
--printf("BOOST-GAIN: CHECKING FOR EFFECT %d...",effect);
if (caster:hasStatusEffect(effect)) then
--printf("BOOST-GAIN: HAS EFFECT %d, DELETING...",effect);
caster:delStatusEffect(effect);
end
end
if (target:addStatusEffect(effect,potency,0,duration)) then
spell:setMsg(230);
else
spell:setMsg(75);
end
end;
function doEnspell(caster,target,spell,effect)
if (effect==EFFECT_BLOOD_WEAPON) then
target:addStatusEffect(EFFECT_BLOOD_WEAPON,1,0,30);
return;
end
local duration = 180;
if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then
duration = duration * 3;
end
--calculate potency
local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL);
local potency = 3 + math.floor((6*magicskill)/100);
if (magicskill>200) then
potency = 5 + math.floor((5*magicskill)/100);
end
if (target:addStatusEffect(effect,potency,0,duration)) then
spell:setMsg(230);
else
spell:setMsg(75);
end
end;
---------------------------------
-- getCurePower returns the caster's cure power
-- getCureFinal returns the final cure amount
-- Source: http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html
---------------------------------
function getCurePower(caster,isBlueMagic)
local MND = caster:getStat(MOD_MND);
local VIT = caster:getStat(MOD_VIT);
local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING);
local power = math.floor(MND/2) + math.floor(VIT/4) + skill;
return power;
end;
function getCurePowerOld(caster)
local MND = caster:getStat(MOD_MND);
local VIT = caster:getStat(MOD_VIT);
local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING);--it's healing magic skill for the BLU cures as well
local power = ((3 * MND) + VIT + (3 * math.floor(skill/5)));
return power;
end;
function getBaseCure(power,divisor,constant,basepower)
return ((power - basepower) / divisor) + constant;
end;
function getBaseCureOld(power,divisor,constant)
return (power / 2) / divisor + constant;
end;
function getCureFinal(caster,spell,basecure,minCure,isBlueMagic)
if (basecure < minCure) then
basecure = minCure;
end
local potency = 1 + (caster:getMod(MOD_CURE_POTENCY) / 100);
if (potency > 1.5) then
potency = 1.5;
end
local dSeal = 1;
if (caster:hasStatusEffect(EFFECT_DIVINE_SEAL)) then
dSeal = 2;
end
local rapture = 1;
if (isBlueMagic == false) then --rapture doesn't affect BLU cures as they're not white magic
if (caster:hasStatusEffect(EFFECT_RAPTURE)) then
rapture = 1.5 + caster:getMod(MOD_RAPTURE_AMOUNT)/100;
caster:delStatusEffectSilent(EFFECT_RAPTURE);
end
end
local dayWeatherBonus = 1;
local ele = spell:getElement();
local castersWeather = caster:getWeather();
if (castersWeather == singleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (castersWeather == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (castersWeather == doubleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (castersWeather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
end
if (dayWeatherBonus > 1.4) then
dayWeatherBonus = 1.4;
end
local final = math.floor(math.floor(math.floor(math.floor(basecure) * potency) * dayWeatherBonus) * rapture) * dSeal;
return final;
end;
function getCureAsNukeFinal(caster,spell,power,divisor,constant,basepower)
return getCureFinal(caster,spell,power,divisor,constant,basepower);
end;
-----------------------------------
-- Returns the staff bonus for the caster and spell.
-----------------------------------
-- affinities that strengthen/weaken the index element
function AffinityBonusDmg(caster,ele)
local affinity = caster:getMod(strongAffinityDmg[ele]);
local bonus = 1.00 + affinity * 0.05; -- 5% per level of affinity
-- print(bonus);
return bonus;
end;
function AffinityBonusAcc(caster,ele)
local affinity = caster:getMod(strongAffinityAcc[ele]);
local bonus = 0 + affinity * 10; -- 10 acc per level of affinity
-- print(bonus);
return bonus;
end;
-- USED FOR DAMAGING MAGICAL SPELLS. Stage 3 of Calculating Magic Damage on wiki
-- Reduces damage ifit resists.
--
-- Output:
-- The factor to multiply down damage (1/2 1/4 1/8 1/16) - In this format so this func can be used for enfeebs on duration.
function applyResistance(player,spell,target,diff,skill,bonus)
return applyResistanceEffect(player, spell, target, diff, skill, bonus, nil);
end;
-- USED FOR Status Effect Enfeebs (blind, slow, para, etc.)
-- Output:
-- The factor to multiply down duration (1/2 1/4 1/8 1/16)
function applyResistanceEffect(player,spell,target,diff,skill,bonus,effect)
-- If Stymie is active, as long as the mob is not immune then the effect is not resisted
if (effect ~= nil) then -- Dispel's script doesn't have an "effect" to send here, nor should it.
if (skill == ENFEEBLING_MAGIC_SKILL and player:hasStatusEffect(EFFECT_STYMIE) and target:canGainStatusEffect(effect)) then
player:delStatusEffect(EFFECT_STYMIE);
return 1;
end
end
if (skill == SINGING_SKILL and player:hasStatusEffect(EFFECT_TROUBADOUR)) then
if (math.random(0,99) < player:getMerit(MERIT_TROUBADOUR)-25) then
return 1.0;
end
end
local element = spell:getElement();
local percentBonus = 0;
local magicaccbonus = getSpellBonusAcc(player, target, spell);
if (diff > 10) then
magicaccbonus = magicaccbonus + 10 + (diff - 10)/2;
else
magicaccbonus = magicaccbonus + diff;
end
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
if(effect ~= nil) then
percentBonus = percentBonus - getEffectResistance(target, effect);
end
local p = getMagicHitRate(player, target, skill, element, percentBonus, magicaccbonus);
return getMagicResist(p);
end;
-- Applies resistance for things that may not be spells - ie. Quick Draw
function applyResistanceAbility(player,target,element,skill,bonus)
local p = getMagicHitRate(player, target, skill, element, 0, bonus);
return getMagicResist(p);
end;
-- Applies resistance for additional effects
function applyResistanceAddEffect(player,target,element,bonus)
local p = getMagicHitRate(player, target, 0, element, 0, bonus);
return getMagicResist(p);
end;
function getMagicHitRate(caster, target, skillType, element, percentBonus, bonusAcc)
-- resist everything if magic shield is active
if (target:hasStatusEffect(EFFECT_MAGIC_SHIELD, 0)) then
return 0;
end
local magiceva = 0;
if (bonusAcc == nil) then
bonusAcc = 0;
end
-- Get the base acc (just skill + skill mod (79 + skillID = ModID) + magic acc mod)
local magicacc = caster:getMod(MOD_MACC) + caster:getILvlMacc();
if (skillType ~= 0) then
magicacc = magicacc + caster:getSkillLevel(skillType) + caster:getMod(79 + skillType);
else
-- for mob skills / additional effects which don't have a skill
magicacc = magicacc + utils.getSkillLvl(1, caster:getMainLvl());
end
local resMod = 0; -- Some spells may possibly be non elemental, but have status effects.
if (element ~= ELE_NONE) then
resMod = target:getMod(resistMod[element]);
-- Add acc for elemental affinity accuracy and element specific accuracy
local affinityBonus = AffinityBonusAcc(caster, element);
local elementBonus = caster:getMod(spellAcc[element]);
-- print(elementBonus);
bonusAcc = bonusAcc + affinityBonus + elementBonus;
end
-- Base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs)
local magiceva = target:getMod(MOD_MEVA) + resMod;
magicacc = magicacc + bonusAcc;
return calculateMagicHitRate(magicacc, magiceva, percentBonus, caster:getMainLvl(), target:getMainLvl());
end
function calculateMagicHitRate(magicacc, magiceva, percentBonus, casterLvl, targetLvl)
local p = 0;
--add a scaling bonus or penalty based on difference of targets level from caster
local levelDiff = utils.clamp(casterLvl - targetLvl, -5, 5);
p = 70 - 0.5 * (magiceva - magicacc) + levelDiff * 3 + percentBonus;
-- printf("P: %f, macc: %f, meva: %f, bonus: %d%%, leveldiff: %d", p, magicacc, magiceva, percentBonus, levelDiff);
return utils.clamp(p, 5, 95);
end
-- Returns resistance value from given magic hit rate (p)
function getMagicResist(magicHitRate)
local p = magicHitRate / 100;
local resist = 1;
-- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates.
local half = (1 - p);
local quart = ((1 - p)^2);
local eighth = ((1 - p)^3);
local sixteenth = ((1 - p)^4);
-- print("HALF: "..half);
-- print("QUART: "..quart);
-- print("EIGHTH: "..eighth);
-- print("SIXTEENTH: "..sixteenth);
local resvar = math.random();
-- Determine final resist based on which thresholds have been crossed.
if (resvar <= sixteenth) then
resist = 0.0625;
--printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth);
elseif (resvar <= eighth) then
resist = 0.125;
--printf("Spell resisted to 1/8! Threshold = %u",eighth);
elseif (resvar <= quart) then
resist = 0.25;
--printf("Spell resisted to 1/4. Threshold = %u",quart);
elseif (resvar <= half) then
resist = 0.5;
--printf("Spell resisted to 1/2. Threshold = %u",half);
else
resist = 1.0;
--printf("1.0");
end
return resist;
end
-- Returns the amount of resistance the
-- target has to the given effect (stun, sleep, etc..)
function getEffectResistance(target, effect)
local effectres = 0;
if (effect == EFFECT_SLEEP_I or effect == EFFECT_SLEEP_II) then
effectres = MOD_SLEEPRES;
elseif(effect == EFFECT_LULLABY) then
effectres = MOD_LULLABYRES;
elseif (effect == EFFECT_POISON) then
effectres = MOD_POISONRES;
elseif (effect == EFFECT_PARALYZE) then
effectres = MOD_PARALYZERES;
elseif (effect == EFFECT_BLINDNESS) then
effectres = MOD_BLINDRES
elseif (effect == EFFECT_SILENCE) then
effectres = MOD_SILENCERES;
elseif (effect == EFFECT_PLAGUE or effect == EFFECT_DISEASE) then
effectres = MOD_VIRUSRES;
elseif (effect == EFFECT_PETRIFICATION) then
effectres = MOD_PETRIFYRES;
elseif (effect == EFFECT_BIND) then
effectres = MOD_BINDRES;
elseif (effect == EFFECT_CURSE_I or effect == EFFECT_CURSE_II or effect == EFFECT_BANE) then
effectres = MOD_CURSERES;
elseif (effect == EFFECT_WEIGHT) then
effectres = MOD_GRAVITYRES;
elseif (effect == EFFECT_SLOW or effect == EFFECT_ELEGY) then
effectres = MOD_SLOWRES;
elseif (effect == EFFECT_STUN) then
effectres = MOD_STUNRES;
elseif (effect == EFFECT_CHARM) then
effectres = MOD_CHARMRES;
elseif (effect == EFFECT_AMNESIA) then
effectres = MOD_AMNESIARES;
end
if (effectres ~= 0) then
return target:getMod(effectres);
end
return 0;
end;
-- Returns the bonus magic accuracy for any spell
function getSpellBonusAcc(caster, target, spell)
local magicAccBonus = 0;
local spellId = spell:getID();
local element = spell:getElement();
local castersWeather = caster:getWeather();
local skill = spell:getSkillType();
local spellGroup = spell:getSpellGroup();
if caster:hasStatusEffect(EFFECT_ALTRUISM) and spellGroup == SPELLGROUP_WHITE then
magicAccBonus = magicAccBonus + caster:getStatusEffect(EFFECT_ALTRUISM):getPower();
end
if caster:hasStatusEffect(EFFECT_FOCALIZATION) and spellGroup == SPELLGROUP_BLACK then
magicAccBonus = magicAccBonus + caster:getStatusEffect(EFFECT_FOCALIZATION):getPower();
end
local skillchainTier, skillchainCount = FormMagicBurst(element, target);
--add acc for BLM AMII spells
if (spellId == 205 or spellId == 207 or spellId == 209 or spellId == 211 or spellId == 213 or spellId == 215) then
-- no bonus if the caster has zero merit investment - don't want to give them a negative bonus
if (caster:getMerit(blmAMIIMerit[element]) ~= 0) then
-- bonus value granted by merit is 1; subtract 1 since unlock doesn't give an accuracy bonus
magicAccBonus = magicAccBonus + (caster:getMerit(blmAMIIMerit[element]) - 1) * 5;
end
end
--add acc for skillchains
if (skillchainTier > 0) then
magicAccBonus = magicAccBonus + 25;
end
--Add acc for klimaform
if (caster:hasStatusEffect(EFFECT_KLIMAFORM) and (castersWeather == singleWeatherStrong[element] or castersWeather == doubleWeatherStrong[element])) then
magicAccBonus = magicAccBonus + 15;
end
--Add acc for dark seal
if (skill == DARK_MAGIC_SKILL and caster:hasStatusEffect(EFFECT_DARK_SEAL)) then
magicAccBonus = magicAccBonus + 256;
end
--add acc for RDM group 1 merits
if (element > 0 and element <= 6) then
magicAccBonus = magicAccBonus + caster:getMerit(rdmMerit[element]);
end
-- BLU mag acc merits - nuke acc is handled in bluemagic.lua
if (skill == BLUE_SKILL) then
magicAccBonus = magicAccBonus + caster:getMerit(MERIT_MAGICAL_ACCURACY);
end
return magicAccBonus;
end;
function handleAfflatusMisery(caster, spell, dmg)
if (caster:hasStatusEffect(EFFECT_AFFLATUS_MISERY)) then
local misery = caster:getMod(MOD_AFFLATUS_MISERY);
local miseryMax = caster:getMaxHP() / 4;
-- BGwiki puts the boost capping at 200% bonus at 1/4th max HP.
if (misery > miseryMax) then
misery = miseryMax;
end;
-- Damage is 2x at boost cap.
local boost = 1 + (misery / miseryMax);
dmg = math.floor(dmg * boost);
-- printf("AFFLATUS MISERY: Damage boosted by %f to %d", boost, dmg);
--Afflatus Mod is Used Up...
caster:setMod(MOD_AFFLATUS_MISERY, 0)
end
return dmg;
end;
function finalMagicAdjustments(caster,target,spell,dmg)
--Handles target's HP adjustment and returns UNSIGNED dmg (absorb message is set in this function)
-- handle multiple targets
if (caster:isSpellAoE(spell:getID())) then
local total = spell:getTotalTargets();
if (total > 9) then
-- ga spells on 10+ targets = 0.4
dmg = dmg * 0.4;
elseif (total > 1) then
-- -ga spells on 2 to 9 targets = 0.9 - 0.05T where T = number of targets
dmg = dmg * (0.9 - 0.05 * total);
end
-- kill shadows
-- target:delStatusEffect(EFFECT_COPY_IMAGE);
-- target:delStatusEffect(EFFECT_BLINK);
else
-- this logic will eventually be moved here
-- dmg = utils.takeShadows(target, dmg, 1);
-- if (dmg == 0) then
-- spell:setMsg(31);
-- return 1;
-- end
end
local skill = spell:getSkillType();
if (skill == ELEMENTAL_MAGIC_SKILL) then
dmg = dmg * ELEMENTAL_POWER;
elseif (skill == DARK_MAGIC_SKILL) then
dmg = dmg * DARK_POWER;
elseif (skill == NINJUTSU_SKILL) then
dmg = dmg * NINJUTSU_POWER;
elseif (skill == DIVINE_MAGIC_SKILL) then
dmg = dmg * DIVINE_POWER;
end
dmg = target:magicDmgTaken(dmg);
if (dmg > 0) then
dmg = dmg - target:getMod(MOD_PHALANX);
dmg = utils.clamp(dmg, 0, 99999);
end
--handling stoneskin
dmg = utils.stoneskin(target, dmg);
dmg = utils.clamp(dmg, -99999, 99999);
if (dmg < 0) then
dmg = target:addHP(-dmg);
spell:setMsg(7);
else
target:delHP(dmg);
target:handleAfflatusMiseryDamage(dmg);
target:updateEnmityFromDamage(caster,dmg);
-- Only add TP if the target is a mob
if (target:getObjType() ~= TYPE_PC) then
target:addTP(100);
end
end
return dmg;
end;
function finalMagicNonSpellAdjustments(caster,target,ele,dmg)
--Handles target's HP adjustment and returns SIGNED dmg (negative values on absorb)
dmg = target:magicDmgTaken(dmg);
if (dmg > 0) then
dmg = dmg - target:getMod(MOD_PHALANX);
dmg = utils.clamp(dmg, 0, 99999);
end
--handling stoneskin
dmg = utils.stoneskin(target, dmg);
dmg = utils.clamp(dmg, -99999, 99999);
if (dmg < 0) then
dmg = -(target:addHP(-dmg));
else
target:delHP(dmg);
end
--Not updating enmity from damage, as this is primarily used for additional effects (which don't generate emnity)
-- in the case that updating enmity is needed, do it manually after calling this
--target:updateEnmityFromDamage(caster,dmg);
return dmg;
end;
function adjustForTarget(target,dmg,ele)
if (dmg > 0 and math.random(0,99) < target:getMod(absorbMod[ele])) then
return -dmg;
end
if (math.random(0,99) < target:getMod(nullMod[ele])) then
return 0;
end
--Moved non element specific absorb and null mod checks to core
--TODO: update all lua calls to magicDmgTaken with appropriate element and remove this function
return dmg;
end;
function calculateMagicBurst(caster, spell, target)
local burst = 1.0;
if (spell:getSpellGroup() == 3 and not caster:hasStatusEffect(EFFECT_BURST_AFFINITY)) then
return burst;
end
local skillchainTier, skillchainCount = FormMagicBurst(spell:getElement(), target);
if (skillchainTier > 0) then
if (skillchainCount == 1) then
burst = 1.3;
elseif (skillchainCount == 2) then
burst = 1.35;
elseif (skillchainCount == 3) then
burst = 1.40;
elseif (skillchainCount == 4) then
burst = 1.45;
elseif (skillchainCount == 5) then
burst = 1.50;
else
-- Something strange is going on if this occurs.
burst = 1.0;
end
--add burst bonus for BLM AMII spells
if (spell:getID() == 205 or spell:getID() == 207 or spell:getID() == 209 or spell:getID() == 211 or spell:getID() == 213 or spell:getID() == 215) then
if (caster:getMerit(blmAMIIMerit[spell:getElement()]) ~= 0) then -- no bonus if the caster has zero merit investment - don't want to give them a negative bonus
burst = burst + (caster:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 0.03; -- bonus value granted by merit is 1; subtract 1 since unlock doesn't give a magic burst bonus
-- print((caster:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 0.03)
end
end
end
-- Add in Magic Burst Bonus Modifier
if (burst > 1) then
burst = burst + (caster:getMod(MOD_MAG_BURST_BONUS) / 100);
end
return burst;
end;
function addBonuses(caster, spell, target, dmg, bonusmab)
local ele = spell:getElement();
local affinityBonus = AffinityBonusDmg(caster, ele);
dmg = math.floor(dmg * affinityBonus);
if (bonusmab == nil) then
bonusmab = 0;
end
local magicDefense = getElementalDamageReduction(target, ele);
dmg = math.floor(dmg * magicDefense);
local dayWeatherBonus = 1.00;
local weather = caster:getWeather();
if (weather == singleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (caster:getWeather() == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (weather == doubleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (weather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
dayWeatherBonus = dayWeatherBonus + caster:getMod(MOD_DAY_NUKE_BONUS)/100; -- sorc. tonban(+1)/zodiac ring
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1 or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
end
if dayWeatherBonus > 1.4 then
dayWeatherBonus = 1.4;
end
dmg = math.floor(dmg * dayWeatherBonus);
local burst = calculateMagicBurst(caster, spell, target);
if (burst > 1.0) then
spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!"
end
dmg = math.floor(dmg * burst);
local mabbonus = 0;
if (spell:getID() >= 245 and spell:getID() <= 248) then -- Drain/Aspir (II)
mabbonus = 1 + caster:getMod(MOD_ENH_DRAIN_ASPIR)/100;
-- print(mabbonus);
else
local mab = caster:getMod(MOD_MATT) + bonusmab;
local mab_crit = caster:getMod(MOD_MAGIC_CRITHITRATE);
if( math.random(1,100) < mab_crit ) then
mab = mab + ( 10 + caster:getMod(MOD_MAGIC_CRIT_DMG_INCREASE ) );
end
local mdefBarBonus = 0;
if (ele > 0 and ele <= 6) then
mab = mab + caster:getMerit(blmMerit[ele]);
if (target:hasStatusEffect(barSpells[ele])) then -- bar- spell magic defense bonus
mdefBarBonus = target:getStatusEffect(barSpells[ele]):getSubPower();
end
end
mabbonus = (100 + mab) / (100 + target:getMod(MOD_MDEF) + mdefBarBonus);
end
if (mabbonus < 0) then
mabbonus = 0;
end
dmg = math.floor(dmg * mabbonus);
if (caster:hasStatusEffect(EFFECT_EBULLIENCE)) then
dmg = dmg * 1.2 + caster:getMod(MOD_EBULLIENCE_AMOUNT)/100;
caster:delStatusEffectSilent(EFFECT_EBULLIENCE);
end
dmg = math.floor(dmg);
-- print(affinityBonus);
-- print(speciesReduction);
-- print(dayWeatherBonus);
-- print(burst);
-- print(mab);
-- print(magicDmgMod);
return dmg;
end;
function addBonusesAbility(caster, ele, target, dmg, params)
local affinityBonus = AffinityBonusDmg(caster, ele);
dmg = math.floor(dmg * affinityBonus);
local magicDefense = getElementalDamageReduction(target, ele);
dmg = math.floor(dmg * magicDefense);
local dayWeatherBonus = 1.00;
local weather = caster:getWeather();
if (weather == singleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (caster:getWeather() == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (weather == doubleWeatherStrong[ele]) then
if (caster:getMod(MOD_IRIDESCENCE) >= 1) then
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (weather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
dayWeatherBonus = dayWeatherBonus + caster:getMod(MOD_DAY_NUKE_BONUS)/100; -- sorc. tonban(+1)/zodiac ring
if (math.random() < 0.33 or caster:getMod(elementalObi[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or caster:getMod(elementalObiWeak[ele]) >= 1) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
end
if dayWeatherBonus > 1.4 then
dayWeatherBonus = 1.4;
end
dmg = math.floor(dmg * dayWeatherBonus);
local mab = 1;
local mdefBarBonus = 0;
if (ele > 0 and ele <= 6 and target:hasStatusEffect(barSpells[ele])) then -- bar- spell magic defense bonus
mdefBarBonus = target:getStatusEffect(barSpells[ele]):getSubPower();
end
if (params ~= nil and params.bonusmab ~= nil and params.includemab == true) then
mab = (100 + caster:getMod(MOD_MATT) + params.bonusmab) / (100 + target:getMod(MOD_MDEF) + mdefBarBonus);
elseif (params == nil or (params ~= nil and params.includemab == true)) then
mab = (100 + caster:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF) + mdefBarBonus);
end
if (mab < 0) then
mab = 0;
end
dmg = math.floor(dmg * mab);
-- print(affinityBonus);
-- print(speciesReduction);
-- print(dayWeatherBonus);
-- print(burst);
-- print(mab);
-- print(magicDmgMod);
return dmg;
end;
-- get elemental damage reduction
function getElementalDamageReduction(target, element)
local defense = 1;
if (element > 0) then
defense = 1 - (target:getMod(defenseMod[element]) / 256);
return utils.clamp(defense, 0.0, 2.0);
end
return defense;
end
---------------------------------------------------------------------
-- Elemental Debuff Potency functions
---------------------------------------------------------------------
function getElementalDebuffDOT(INT)
local DOT = 0;
if (INT<= 39) then
DOT = 1;
elseif (INT <= 69) then
DOT = 2;
elseif (INT <= 99) then
DOT = 3;
elseif (INT <= 149) then
DOT = 4;
else
DOT = 5;
end
return DOT;
end;
function getElementalDebuffStatDownFromDOT(dot)
local stat_down = 0;
if (dot == 1) then
stat_down = 5;
elseif (dot == 2) then
stat_down = 7;
elseif (dot == 3) then
stat_down = 9;
elseif (dot == 4) then
stat_down = 11;
else
stat_down = 13;
end
return stat_down;
end;
function getHelixDuration(caster)
--Dark Arts will further increase Helix duration, but testing is ongoing.
local casterLevel = caster:getMainLvl();
local duration = 30; --fallthrough
if (casterLevel <= 39) then
duration = 30;
elseif (casterLevel <= 59) then
duration = 60;
elseif (casterLevel <= 99) then
duration = 90;
end
return duration;
end;
function isHelixSpell(spell)
--Dark Arts will further increase Helix duration, but testing is ongoing.
local id = spell:getID();
if id >= 278 and id <= 285 then
return true;
end
return false;
end;
function handleThrenody(caster, target, spell, basePower, baseDuration, modifier)
-- Process resitances
local staff = AffinityBonusAcc(caster, spell:getElement());
-- print("staff=" .. staff);
local dCHR = (caster:getStat(MOD_CHR) - target:getStat(MOD_CHR));
-- print("dCHR=" .. dCHR);
local resm = applyResistance(caster, spell, target, dCHR, SINGING_SKILL, staff);
-- print("rsem=" .. resm);
if (resm < 0.5) then
-- print("resm resist");
spell:setMsg(85);
return EFFECT_THRENODY;
end
-- Remove previous Threnody
target:delStatusEffect(EFFECT_THRENODY);
local iBoost = caster:getMod(MOD_THRENODY_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
local power = basePower + iBoost*5;
local duration = baseDuration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
-- Set spell message and apply status effect
target:addStatusEffect(EFFECT_THRENODY, power, 0, duration, 0, modifier, 0);
return EFFECT_THRENODY;
end;
function handleNinjutsuDebuff(caster, target, spell, basePower, baseDuration, modifier)
-- Add new
target:addStatusEffectEx(EFFECT_NINJUTSU_ELE_DEBUFF, 0, basePower, 0, baseDuration, 0, modifier, 0);
return EFFECT_NINJUTSU_ELE_DEBUFF;
end;
-- Returns true if you can overwrite the effect
-- Example: canOverwrite(target, EFFECT_SLOW, 25)
function canOverwrite(target, effect, power, mod)
mod = mod or 1;
local statusEffect = target:getStatusEffect(effect);
-- effect not found so overwrite
if (statusEffect == nil) then
return true;
end
-- overwrite if its weaker
if (statusEffect:getPower()*mod > power) then
return false;
end
return true;
end
function doElementalNuke(caster, spell, target, spellParams)
local DMG = 0;
local V = 0;
local M = 0;
local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
local hasMultipleTargetReduction = spellParams.hasMultipleTargetReduction; --still unused!!!
local resistBonus = spellParams.resistBonus;
local mDMG = caster:getMod(MOD_MAGIC_DAMAGE);
--[[
Calculate base damage:
D = mDMG + V + (dINT × M)
D is then floored
For dINT reduce by amount factored into the V value (example: at 134 INT, when using V100 in the calculation, use dINT = 134-100 = 34)
]]
if (dINT <= 49) then
V = spellParams.V0;
M = spellParams.M0;
DMG = math.floor(DMG + mDMG + V + (dINT * M));
if (DMG <= 0) then
return 0;
end
elseif (dINT >= 50 and dINT <= 99) then
V = spellParams.V50;
M = spellParams.M50;
DMG = math.floor(DMG + mDMG + V + ((dINT - 50) * M));
elseif (dINT >= 100 and dINT <= 199) then
V = spellParams.V100;
M = spellParams.M100;
DMG = math.floor(DMG + mDMG + V + ((dINT - 100) * M));
elseif (dINT > 199) then
V = spellParams.V200;
M = spellParams.M200;
DMG = math.floor(DMG + mDMG + V + ((dINT - 200) * M));
end
--get resist multiplier (1x if no resist)
local diff = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
local resist = applyResistance(caster, spell, target, diff, ELEMENTAL_MAGIC_SKILL, resistBonus);
--get the resisted damage
DMG = DMG * resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
DMG = addBonuses(caster, spell, target, DMG);
--add in target adjustment
local ele = spell:getElement();
DMG = adjustForTarget(target, DMG, ele);
--add in final adjustments
DMG = finalMagicAdjustments(caster, target, spell, DMG);
return DMG;
end
function doDivineNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,DIVINE_MAGIC_SKILL,MOD_MND);
end
function doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,mabBonus)
mabBonus = mabBonus or 0;
mabBonus = mabBonus + caster:getMod(MOD_NIN_NUKE_BONUS); -- "enhances ninjutsu damage" bonus
if (caster:hasStatusEffect(EFFECT_INNIN) and caster:isBehind(target, 23)) then -- Innin mag atk bonus from behind, guesstimating angle at 23 degrees
mabBonus = mabBonus + caster:getStatusEffect(EFFECT_INNIN):getPower();
end
return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,NINJUTSU_SKILL,MOD_INT,mabBonus);
end
function doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,skill,modStat,mabBonus)
--calculate raw damage
local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus);
--get the resisted damage
dmg = dmg*resist;
if (skill == NINJUTSU_SKILL) then
if (caster:getMainJob() == JOB_NIN) then -- NIN main gets a bonus to their ninjutsu nukes
local ninSkillBonus = 100;
if (spell:getID() % 3 == 2) then -- ichi nuke spell ids are 320, 323, 326, 329, 332, and 335
ninSkillBonus = 100 + math.floor((caster:getSkillLevel(SKILL_NIN) - 50)/2); -- getSkillLevel includes bonuses from merits and modifiers (ie. gear)
elseif (spell:getID() % 3 == 0) then -- ni nuke spell ids are 1 more than their corresponding ichi spell
ninSkillBonus = 100 + math.floor((caster:getSkillLevel(SKILL_NIN) - 125)/2);
else -- san nuke spell, also has ids 1 more than their corresponding ni spell
ninSkillBonus = 100 + math.floor((caster:getSkillLevel(SKILL_NIN) - 275)/2);
end
ninSkillBonus = utils.clamp(ninSkillBonus, 100, 200); -- bonus caps at +100%, and does not go negative
dmg = dmg * ninSkillBonus/100;
end
-- boost with Futae
if (caster:hasStatusEffect(EFFECT_FUTAE)) then
dmg = math.floor(dmg * 1.50);
caster:delStatusEffect(EFFECT_FUTAE);
end
end
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg,mabBonus);
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--add in final adjustments
dmg = finalMagicAdjustments(caster,target,spell,dmg);
return dmg;
end
function doDivineBanishNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
local skill = DIVINE_MAGIC_SKILL;
local modStat = MOD_MND;
--calculate raw damage
local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus);
--get the resisted damage
dmg = dmg*resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg);
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--handling afflatus misery
dmg = handleAfflatusMisery(caster, spell, dmg);
--add in final adjustments
dmg = finalMagicAdjustments(caster,target,spell,dmg);
return dmg;
end
function calculateDurationForLvl(duration, spellLvl, targetLvl)
if (targetLvl < spellLvl) then
return duration * targetLvl / spellLvl;
end
return duration;
end
function calculateBarspellPower(caster,enhanceSkill)
local meritBonus = caster:getMerit(MERIT_BAR_SPELL_EFFECT);
local equipBonus = caster:getMod(MOD_BARSPELL_AMOUNT);
--printf("Barspell: Merit Bonus +%d", meritBonus);
if (enhanceSkill == nil or enhanceSkill < 0) then
enhanceSkill = 0;
end
local power = 40 + 0.2 * enhanceSkill + meritBonus + equipBonus;
return power;
end
-- Output magic hit rate for all levels
function outputMagicHitRateInfo()
for casterLvl = 1, 75 do
printf("");
printf("-------- CasterLvl: %d", casterLvl);
for lvlMod = -5, 20 do
local targetLvl = casterLvl + lvlMod;
if(targetLvl >= 0) then
-- assume BLM spell, A+
local magicAcc = utils.getSkillLvl(6, casterLvl);
-- assume default monster magic eva, D
local magicEvaRank = 3;
local rate = 0;
local magicEva = utils.getMobSkillLvl(magicEvaRank, targetLvl);
local dINT = (lvlMod + 1) * -1;
if (dINT > 10) then
magicAcc = magicAcc + 10 + (dINT - 10)/2;
else
magicAcc = magicAcc + dINT;
end
local magicHitRate = calculateMagicHitRate(magicAcc, magicEva, 0, casterLvl, targetLvl);
printf("Lvl: %d vs %d, %d%%, MA: %d, ME: %d", casterLvl, targetLvl, magicHitRate, magicAcc, magicEva);
end
end
end
end;
-- outputMagicHitRateInfo();
| gpl-3.0 |
dpino/snabbswitch | src/lib/ipsec/esp.lua | 3 | 18586 | -- Implementation of IPsec ESP using AES-128-GCM with a 12 byte ICV and
-- “Extended Sequence Number” (see RFC 4303 and RFC 4106). Provides
-- address-family independent encapsulation/decapsulation routines for
-- “tunnel mode” and “transport mode” routines for IPv6.
--
-- Notes:
--
-- * Wrapping around of the Extended Sequence Number is *not* detected because
-- it is assumed to be an unrealistic scenario as it would take 584 years to
-- overflow the counter when transmitting 10^9 packets per second.
--
-- * decapsulate_transport6: Rejection of IP fragments is *not* implemented
-- because `lib.protocol.ipv6' does not support fragmentation. E.g.
-- fragments will be rejected because they can not be parsed as IPv6
-- packets. If however `lib.protocol.ipv6' were to be updated to be able to
-- parse IP fragments this implementation would have to be updated as well
-- to remain correct. See the “Reassembly” section of RFC 4303 for details:
-- https://tools.ietf.org/html/rfc4303#section-3.4.1
--
module(..., package.seeall)
local header = require("lib.protocol.header")
local datagram = require("lib.protocol.datagram")
local ethernet = require("lib.protocol.ethernet")
local ipv6 = require("lib.protocol.ipv6")
local esp = require("lib.protocol.esp")
local esp_tail = require("lib.protocol.esp_tail")
local aes_128_gcm = require("lib.ipsec.aes_128_gcm")
local seq_no_t = require("lib.ipsec.seq_no_t")
local lib = require("core.lib")
local ffi = require("ffi")
local C = ffi.C
local logger = lib.logger_new({ rate = 32, module = 'esp' })
require("lib.ipsec.track_seq_no_h")
local window_t = ffi.typeof("uint8_t[?]")
PROTOCOL = 50 -- https://tools.ietf.org/html/rfc4303#section-2
local ETHERNET_SIZE = ethernet:sizeof()
local IPV6_SIZE = ipv6:sizeof()
local ESP_SIZE = esp:sizeof()
local ESP_TAIL_SIZE = esp_tail:sizeof()
local TRANSPORT6_PAYLOAD_OFFSET = ETHERNET_SIZE + IPV6_SIZE
local function padding (a, l) return (a - l%a) % a end
function esp_new (conf)
assert(conf.mode == "aes-gcm-128-12", "Only supports 'aes-gcm-128-12'.")
assert(conf.spi, "Need SPI.")
local o = {
cipher = aes_128_gcm:new(conf.spi, conf.key, conf.salt),
spi = conf.spi,
seq = ffi.new(seq_no_t),
pad_to = 4, -- minimal padding
esp = esp:new({}),
esp_tail = esp_tail:new({}),
ip = ipv6:new({}) -- for transport mode
}
o.ESP_CTEXT_OVERHEAD = o.cipher.IV_SIZE + ESP_TAIL_SIZE
o.ESP_OVERHEAD = ESP_SIZE + o.ESP_CTEXT_OVERHEAD + o.cipher.AUTH_SIZE
return o
end
encrypt = {}
function encrypt:new (conf)
return setmetatable(esp_new(conf), {__index=encrypt})
end
-- Increment sequence number.
function encrypt:next_seq_no ()
self.seq.no = self.seq.no + 1
end
function encrypt:padding (length)
-- See https://tools.ietf.org/html/rfc4303#section-2.4
return padding(self.pad_to, length + self.ESP_CTEXT_OVERHEAD)
end
function encrypt:encode_esp_trailer (ptr, next_header, pad_length)
self.esp_tail:new_from_mem(ptr, ESP_TAIL_SIZE)
self.esp_tail:next_header(next_header)
self.esp_tail:pad_length(pad_length)
end
function encrypt:encrypt_payload (ptr, length)
self:next_seq_no()
local seq, low, high = self.seq, self.seq:low(), self.seq:high()
self.cipher:encrypt(ptr, seq, low, high, ptr, length, ptr + length)
end
function encrypt:encode_esp_header (ptr)
self.esp:new_from_mem(ptr, ESP_SIZE)
self.esp:spi(self.spi)
self.esp:seq_no(self.seq:low())
ffi.copy(ptr + ESP_SIZE, self.seq, self.cipher.IV_SIZE)
end
-- Encapsulation in transport mode is performed as follows:
-- 1. Grow p to fit ESP overhead
-- 2. Append ESP trailer to p
-- 3. Encrypt payload+trailer in place
-- 4. Move resulting ciphertext to make room for ESP header
-- 5. Write ESP header
function encrypt:encapsulate_transport6 (p)
if p.length < TRANSPORT6_PAYLOAD_OFFSET then return nil end
local payload = p.data + TRANSPORT6_PAYLOAD_OFFSET
local payload_length = p.length - TRANSPORT6_PAYLOAD_OFFSET
local pad_length = self:padding(payload_length)
local overhead = self.ESP_OVERHEAD + pad_length
p = packet.resize(p, p.length + overhead)
self.ip:new_from_mem(p.data + ETHERNET_SIZE, IPV6_SIZE)
local tail = payload + payload_length + pad_length
self:encode_esp_trailer(tail, self.ip:next_header(), pad_length)
local ctext_length = payload_length + pad_length + ESP_TAIL_SIZE
self:encrypt_payload(payload, ctext_length)
local ctext = payload + ESP_SIZE + self.cipher.IV_SIZE
C.memmove(ctext, payload, ctext_length + self.cipher.AUTH_SIZE)
self:encode_esp_header(payload)
self.ip:next_header(PROTOCOL)
self.ip:payload_length(payload_length + overhead)
return p
end
-- Encapsulation in tunnel mode is performed as follows:
-- (In tunnel mode, the input packet must be an IP frame already stripped of
-- its Ethernet header.)
-- 1. Grow and shift p to fit ESP overhead
-- 2. Append ESP trailer to p
-- 3. Encrypt payload+trailer in place
-- 4. Write ESP header
-- (The resulting packet contains the raw ESP frame, without IP or Ethernet
-- headers.)
function encrypt:encapsulate_tunnel (p, next_header)
local pad_length = self:padding(p.length)
local trailer_overhead = pad_length + ESP_TAIL_SIZE + self.cipher.AUTH_SIZE
local orig_length = p.length
p = packet.resize(p, orig_length + trailer_overhead)
local tail = p.data + orig_length + pad_length
self:encode_esp_trailer(tail, next_header, pad_length)
local ctext_length = orig_length + pad_length + ESP_TAIL_SIZE
self:encrypt_payload(p.data, ctext_length)
local len = p.length
p = packet.shiftright(p, ESP_SIZE + self.cipher.IV_SIZE)
self:encode_esp_header(p.data)
return p
end
decrypt = {}
function decrypt:new (conf)
local o = esp_new(conf)
o.MIN_SIZE = o.ESP_OVERHEAD + padding(o.pad_to, o.ESP_OVERHEAD)
o.CTEXT_OFFSET = ESP_SIZE + o.cipher.IV_SIZE
o.PLAIN_OVERHEAD = ESP_SIZE + o.cipher.IV_SIZE + o.cipher.AUTH_SIZE
local window_size = conf.window_size or 128
o.window_size = window_size + padding(8, window_size)
o.window = ffi.new(window_t, o.window_size / 8)
o.resync_threshold = conf.resync_threshold or 1024
o.resync_attempts = conf.resync_attempts or 8
o.decap_fail = 0
o.auditing = conf.auditing
return setmetatable(o, {__index=decrypt})
end
function decrypt:decrypt_payload (ptr, length)
-- NB: bounds check is performed by caller
local esp = self.esp:new_from_mem(ptr, esp:sizeof())
local iv_start = ptr + ESP_SIZE
local ctext_start = ptr + self.CTEXT_OFFSET
local ctext_length = length - self.PLAIN_OVERHEAD
local seq_low = esp:seq_no()
local seq_high = tonumber(
C.check_seq_no(seq_low, self.seq.no, self.window, self.window_size)
)
local error = nil
if seq_high < 0 or not self.cipher:decrypt(
ctext_start, seq_low, seq_high, iv_start, ctext_start, ctext_length
) then
if seq_high < 0 then error = "replayed"
else error = "integrity error" end
self.decap_fail = self.decap_fail + 1
if self.decap_fail > self.resync_threshold then
seq_high = self:resync(ptr, length, seq_low, seq_high)
if seq_high then error = nil end
end
end
if error then
self:audit(error)
return nil
end
self.decap_fail = 0
self.seq.no = C.track_seq_no(
seq_high, seq_low, self.seq.no, self.window, self.window_size
)
local esp_tail_start = ctext_start + ctext_length - ESP_TAIL_SIZE
self.esp_tail:new_from_mem(esp_tail_start, ESP_TAIL_SIZE)
local ptext_length =
ctext_length - self.esp_tail:pad_length() - ESP_TAIL_SIZE
return ctext_start, ptext_length
end
-- Decapsulation in transport mode is performed as follows:
-- 1. Parse IP and ESP headers and check Sequence Number
-- 2. Decrypt ciphertext in place
-- 3. Parse ESP trailer and update IP header
-- 4. Move cleartext up to IP payload
-- 5. Shrink p by ESP overhead
function decrypt:decapsulate_transport6 (p)
if p.length - TRANSPORT6_PAYLOAD_OFFSET < self.MIN_SIZE then return nil end
self.ip:new_from_mem(p.data + ETHERNET_SIZE, IPV6_SIZE)
local payload = p.data + TRANSPORT6_PAYLOAD_OFFSET
local payload_length = p.length - TRANSPORT6_PAYLOAD_OFFSET
local ptext_start, ptext_length =
self:decrypt_payload(payload, payload_length)
if not ptext_start then return nil end
self.ip:next_header(self.esp_tail:next_header())
self.ip:payload_length(ptext_length)
C.memmove(payload, ptext_start, ptext_length)
p = packet.resize(p, TRANSPORT6_PAYLOAD_OFFSET + ptext_length)
return p
end
-- Decapsulation in tunnel mode is performed as follows:
-- (In tunnel mode, the input packet must be already stripped of its outer
-- Ethernet and IP headers.)
-- 1. Parse ESP header and check Sequence Number
-- 2. Decrypt ciphertext in place
-- 3. Parse ESP trailer and shrink p by overhead
-- (The resulting packet contains the raw ESP payload (i.e. an IP frame),
-- without an Ethernet header.)
function decrypt:decapsulate_tunnel (p)
if p.length < self.MIN_SIZE then return nil end
local ptext_start, ptext_length = self:decrypt_payload(p.data, p.length)
if not ptext_start then return nil end
p = packet.shiftleft(p, self.CTEXT_OFFSET)
p = packet.resize(p, ptext_length)
return p, self.esp_tail:next_header()
end
function decrypt:audit (reason)
if not self.auditing then return end
-- This is the information RFC4303 says we SHOULD log
logger:log("Rejecting packet (" ..
"SPI=" .. self.spi .. ", " ..
"src_addr='" .. self.ip:ntop(self.ip:src()) .. "', " ..
"dst_addr='" .. self.ip:ntop(self.ip:dst()) .. "', " ..
"seq_low=" .. self.esp:seq_no() .. ", " ..
"flow_id=" .. self.ip:flow_label() .. ", " ..
"reason='" .. reason .. "'" ..
")")
end
function decrypt:resync (ptr, length, seq_low, seq_high)
local iv_start = ptr + ESP_SIZE
local ctext_start = ptr + self.CTEXT_OFFSET
local ctext_length = length - self.PLAIN_OVERHEAD
if seq_high < 0 then
-- The sequence number looked replayed, we use the last seq_high we have
-- seen
seq_high = self.seq:high()
else
-- We failed to decrypt in-place, undo the damage to recover the original
-- ctext (ignore bogus auth data)
self.cipher:encrypt(
ctext_start, iv_start, seq_low, seq_high, ctext_start, ctext_length
)
end
local p_orig = packet.from_pointer(ptr, length)
for i = 1, self.resync_attempts do
seq_high = seq_high + 1
if self.cipher:decrypt(
ctext_start, seq_low, seq_high, iv_start, ctext_start, ctext_length
) then
packet.free(p_orig)
return seq_high
else
ffi.copy(ptr, p_orig.data, length)
end
end
end
function selftest ()
local conf = { spi = 0x0,
mode = "aes-gcm-128-12",
key = "00112233445566778899AABBCCDDEEFF",
salt = "00112233",
resync_threshold = 16,
resync_attempts = 8}
local enc, dec = encrypt:new(conf), decrypt:new(conf)
local payload = packet.from_string(
[[abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789]]
)
local d = datagram:new(payload)
local ip = ipv6:new({})
ip:payload_length(payload.length)
d:push(ip)
d:push(ethernet:new({type=0x86dd}))
local p = d:packet()
-- Check integrity
print("original", lib.hexdump(ffi.string(p.data, p.length)))
local p_enc = assert(enc:encapsulate_transport6(packet.clone(p)),
"encapsulation failed")
print("encrypted", lib.hexdump(ffi.string(p_enc.data, p_enc.length)))
local p2 = assert(dec:decapsulate_transport6(packet.clone(p_enc)),
"decapsulation failed")
print("decrypted", lib.hexdump(ffi.string(p2.data, p2.length)))
assert(p2.length == p.length and C.memcmp(p.data, p2.data, p.length) == 0,
"integrity check failed")
-- ... for tunnel mode
local p_enc = assert(enc:encapsulate_tunnel(packet.clone(p), 42),
"encapsulation failed")
print("enc. (tun)", lib.hexdump(ffi.string(p_enc.data, p_enc.length)))
local p2, nh = dec:decapsulate_tunnel(packet.clone(p_enc))
assert(p2 and nh == 42, "decapsulation failed")
print("dec. (tun)", lib.hexdump(ffi.string(p2.data, p2.length)))
assert(p2.length == p.length and C.memcmp(p.data, p2.data, p.length) == 0,
"integrity check failed")
-- Check invalid packets.
assert(not enc:encapsulate_transport6(packet.from_string("invalid")),
"encapsulated invalid packet")
assert(not dec:decapsulate_transport6(packet.from_string("invalid")),
"decapsulated invalid packet")
-- ... for tunnel mode
assert(not dec:decapsulate_tunnel(packet.from_string("invalid")),
"decapsulated invalid packet")
-- Check minimum packet.
local p_min = packet.from_string("012345678901234567890123456789012345678901234567890123")
p_min.data[18] = 0 -- Set IPv6 payload length to zero
p_min.data[19] = 0 -- ...
assert(p_min.length == TRANSPORT6_PAYLOAD_OFFSET)
print("original", lib.hexdump(ffi.string(p_min.data, p_min.length)))
local e_min = assert(enc:encapsulate_transport6(packet.clone(p_min)))
print("encrypted", lib.hexdump(ffi.string(e_min.data, e_min.length)))
assert(e_min.length == dec.MIN_SIZE+TRANSPORT6_PAYLOAD_OFFSET)
e_min = assert(dec:decapsulate_transport6(e_min),
"decapsulation of minimum packet failed")
print("decrypted", lib.hexdump(ffi.string(e_min.data, e_min.length)))
assert(e_min.length == TRANSPORT6_PAYLOAD_OFFSET)
assert(p_min.length == e_min.length
and C.memcmp(p_min.data, e_min.data, p_min.length) == 0,
"integrity check failed")
-- ... for tunnel mode
print("original", "(empty)")
local e_min = assert(enc:encapsulate_tunnel(packet.allocate(), 0))
print("enc. (tun)", lib.hexdump(ffi.string(e_min.data, e_min.length)))
e_min = assert(dec:decapsulate_tunnel(e_min))
assert(e_min.length == 0)
-- Tunnel/transport mode independent tests
for _, op in ipairs(
{{encap=function (p) return enc:encapsulate_transport6(p) end,
decap=function (p) return dec:decapsulate_transport6(p) end},
{encap=function (p) return enc:encapsulate_tunnel(p, 0) end,
decap=function (p) return dec:decapsulate_tunnel(p) end}}
) do
-- Check transmitted Sequence Number wrap around
C.memset(dec.window, 0, dec.window_size / 8) -- clear window
enc.seq.no = 2^32 - 1 -- so next encapsulated will be seq 2^32
dec.seq.no = 2^32 - 1 -- pretend to have seen 2^32-1
local px = op.encap(packet.clone(p))
assert(op.decap(px),
"Transmitted Sequence Number wrap around failed.")
assert(dec.seq:high() == 1 and dec.seq:low() == 0,
"Lost Sequence Number synchronization.")
-- Check Sequence Number exceeding window
C.memset(dec.window, 0, dec.window_size / 8) -- clear window
enc.seq.no = 2^32
dec.seq.no = 2^32 + dec.window_size + 1
local px = op.encap(packet.clone(p))
assert(not op.decap(px),
"Accepted out of window Sequence Number.")
assert(dec.seq:high() == 1 and dec.seq:low() == dec.window_size+1,
"Corrupted Sequence Number.")
-- Test anti-replay: From a set of 15 packets, first send all those
-- that have an even sequence number. Then, send all 15. Verify that
-- in the 2nd run, packets with even sequence numbers are rejected while
-- the others are not.
-- Then do the same thing again, but with offset sequence numbers so that
-- we have a 32bit wraparound in the middle.
local offset = 0 -- close to 2^32 in the 2nd iteration
for offset = 0, 2^32-7, 2^32-7 do -- duh
C.memset(dec.window, 0, dec.window_size / 8) -- clear window
dec.seq.no = offset
for i = 1+offset, 15+offset do
if (i % 2 == 0) then
enc.seq.no = i-1 -- so next seq will be i
local px = op.encap(packet.clone(p))
assert(op.decap(px),
"rejected legitimate packet seq=" .. i)
assert(dec.seq.no == i,
"Lost sequence number synchronization")
end
end
for i = 1+offset, 15+offset do
enc.seq.no = i-1
local px = op.encap(packet.clone(p))
if (i % 2 == 0) then
assert(not op.decap(px),
"accepted replayed packet seq=" .. i)
else
assert(op.decap(px),
"rejected legitimate packet seq=" .. i)
end
end
end
-- Check that packets from way in the past/way in the future (further
-- than the biggest allowable window size) are rejected This is where we
-- ultimately want resynchronization (wrt. future packets)
C.memset(dec.window, 0, dec.window_size / 8) -- clear window
dec.seq.no = 2^34 + 42
enc.seq.no = 2^36 + 24
local px = op.encap(packet.clone(p))
assert(not op.decap(px),
"accepted packet from way into the future")
enc.seq.no = 2^32 + 42
local px = op.encap(packet.clone(p))
assert(not op.decap(px),
"accepted packet from way into the past")
-- Test resynchronization after having lost >2^32 packets
enc.seq.no = 0
dec.seq.no = 0
C.memset(dec.window, 0, dec.window_size / 8) -- clear window
local px = op.encap(packet.clone(p)) -- do an initial packet
assert(op.decap(px), "decapsulation failed")
enc.seq:high(3) -- pretend there has been massive packet loss
enc.seq:low(24)
for i = 1, dec.resync_threshold do
local px = op.encap(packet.clone(p))
assert(not op.decap(px), "decapsulated pre-resync packet")
end
local px = op.encap(packet.clone(p))
assert(op.decap(px), "failed to resynchronize")
-- Make sure we don't accidentally resynchronize with very old replayed
-- traffic
enc.seq.no = 42
for i = 1, dec.resync_threshold do
local px = op.encap(packet.clone(p))
assert(not op.decap(px), "decapsulated very old packet")
end
local px = op.encap(packet.clone(p))
assert(not op.decap(px), "resynchronized with the past!")
end
end
| apache-2.0 |
dpino/snabbswitch | lib/luajit/src/jit/dis_arm.lua | 59 | 19344 | ----------------------------------------------------------------------------
-- LuaJIT ARM disassembler module.
--
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.
--
-- It disassembles most user-mode ARMv7 instructions
-- NYI: Advanced SIMD and VFP instructions.
------------------------------------------------------------------------------
local type = type
local sub, byte, format = string.sub, string.byte, string.format
local match, gmatch = string.match, string.gmatch
local concat = table.concat
local bit = require("bit")
local band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex
local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift
------------------------------------------------------------------------------
-- Opcode maps
------------------------------------------------------------------------------
local map_loadc = {
shift = 8, mask = 15,
[10] = {
shift = 20, mask = 1,
[0] = {
shift = 23, mask = 3,
[0] = "vmovFmDN", "vstmFNdr",
_ = {
shift = 21, mask = 1,
[0] = "vstrFdl",
{ shift = 16, mask = 15, [13] = "vpushFdr", _ = "vstmdbFNdr", }
},
},
{
shift = 23, mask = 3,
[0] = "vmovFDNm",
{ shift = 16, mask = 15, [13] = "vpopFdr", _ = "vldmFNdr", },
_ = {
shift = 21, mask = 1,
[0] = "vldrFdl", "vldmdbFNdr",
},
},
},
[11] = {
shift = 20, mask = 1,
[0] = {
shift = 23, mask = 3,
[0] = "vmovGmDN", "vstmGNdr",
_ = {
shift = 21, mask = 1,
[0] = "vstrGdl",
{ shift = 16, mask = 15, [13] = "vpushGdr", _ = "vstmdbGNdr", }
},
},
{
shift = 23, mask = 3,
[0] = "vmovGDNm",
{ shift = 16, mask = 15, [13] = "vpopGdr", _ = "vldmGNdr", },
_ = {
shift = 21, mask = 1,
[0] = "vldrGdl", "vldmdbGNdr",
},
},
},
_ = {
shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc.
},
}
local map_vfps = {
shift = 6, mask = 0x2c001,
[0] = "vmlaF.dnm", "vmlsF.dnm",
[0x04000] = "vnmlsF.dnm", [0x04001] = "vnmlaF.dnm",
[0x08000] = "vmulF.dnm", [0x08001] = "vnmulF.dnm",
[0x0c000] = "vaddF.dnm", [0x0c001] = "vsubF.dnm",
[0x20000] = "vdivF.dnm",
[0x24000] = "vfnmsF.dnm", [0x24001] = "vfnmaF.dnm",
[0x28000] = "vfmaF.dnm", [0x28001] = "vfmsF.dnm",
[0x2c000] = "vmovF.dY",
[0x2c001] = {
shift = 7, mask = 0x1e01,
[0] = "vmovF.dm", "vabsF.dm",
[0x0200] = "vnegF.dm", [0x0201] = "vsqrtF.dm",
[0x0800] = "vcmpF.dm", [0x0801] = "vcmpeF.dm",
[0x0a00] = "vcmpzF.d", [0x0a01] = "vcmpzeF.d",
[0x0e01] = "vcvtG.dF.m",
[0x1000] = "vcvt.f32.u32Fdm", [0x1001] = "vcvt.f32.s32Fdm",
[0x1800] = "vcvtr.u32F.dm", [0x1801] = "vcvt.u32F.dm",
[0x1a00] = "vcvtr.s32F.dm", [0x1a01] = "vcvt.s32F.dm",
},
}
local map_vfpd = {
shift = 6, mask = 0x2c001,
[0] = "vmlaG.dnm", "vmlsG.dnm",
[0x04000] = "vnmlsG.dnm", [0x04001] = "vnmlaG.dnm",
[0x08000] = "vmulG.dnm", [0x08001] = "vnmulG.dnm",
[0x0c000] = "vaddG.dnm", [0x0c001] = "vsubG.dnm",
[0x20000] = "vdivG.dnm",
[0x24000] = "vfnmsG.dnm", [0x24001] = "vfnmaG.dnm",
[0x28000] = "vfmaG.dnm", [0x28001] = "vfmsG.dnm",
[0x2c000] = "vmovG.dY",
[0x2c001] = {
shift = 7, mask = 0x1e01,
[0] = "vmovG.dm", "vabsG.dm",
[0x0200] = "vnegG.dm", [0x0201] = "vsqrtG.dm",
[0x0800] = "vcmpG.dm", [0x0801] = "vcmpeG.dm",
[0x0a00] = "vcmpzG.d", [0x0a01] = "vcmpzeG.d",
[0x0e01] = "vcvtF.dG.m",
[0x1000] = "vcvt.f64.u32GdFm", [0x1001] = "vcvt.f64.s32GdFm",
[0x1800] = "vcvtr.u32FdG.m", [0x1801] = "vcvt.u32FdG.m",
[0x1a00] = "vcvtr.s32FdG.m", [0x1a01] = "vcvt.s32FdG.m",
},
}
local map_datac = {
shift = 24, mask = 1,
[0] = {
shift = 4, mask = 1,
[0] = {
shift = 8, mask = 15,
[10] = map_vfps,
[11] = map_vfpd,
-- NYI cdp, mcr, mrc.
},
{
shift = 8, mask = 15,
[10] = {
shift = 20, mask = 15,
[0] = "vmovFnD", "vmovFDn",
[14] = "vmsrD",
[15] = { shift = 12, mask = 15, [15] = "vmrs", _ = "vmrsD", },
},
},
},
"svcT",
}
local map_loadcu = {
shift = 0, mask = 0, -- NYI unconditional CP load/store.
}
local map_datacu = {
shift = 0, mask = 0, -- NYI unconditional CP data.
}
local map_simddata = {
shift = 0, mask = 0, -- NYI SIMD data.
}
local map_simdload = {
shift = 0, mask = 0, -- NYI SIMD load/store, preload.
}
local map_preload = {
shift = 0, mask = 0, -- NYI preload.
}
local map_media = {
shift = 20, mask = 31,
[0] = false,
{ --01
shift = 5, mask = 7,
[0] = "sadd16DNM", "sasxDNM", "ssaxDNM", "ssub16DNM",
"sadd8DNM", false, false, "ssub8DNM",
},
{ --02
shift = 5, mask = 7,
[0] = "qadd16DNM", "qasxDNM", "qsaxDNM", "qsub16DNM",
"qadd8DNM", false, false, "qsub8DNM",
},
{ --03
shift = 5, mask = 7,
[0] = "shadd16DNM", "shasxDNM", "shsaxDNM", "shsub16DNM",
"shadd8DNM", false, false, "shsub8DNM",
},
false,
{ --05
shift = 5, mask = 7,
[0] = "uadd16DNM", "uasxDNM", "usaxDNM", "usub16DNM",
"uadd8DNM", false, false, "usub8DNM",
},
{ --06
shift = 5, mask = 7,
[0] = "uqadd16DNM", "uqasxDNM", "uqsaxDNM", "uqsub16DNM",
"uqadd8DNM", false, false, "uqsub8DNM",
},
{ --07
shift = 5, mask = 7,
[0] = "uhadd16DNM", "uhasxDNM", "uhsaxDNM", "uhsub16DNM",
"uhadd8DNM", false, false, "uhsub8DNM",
},
{ --08
shift = 5, mask = 7,
[0] = "pkhbtDNMU", false, "pkhtbDNMU",
{ shift = 16, mask = 15, [15] = "sxtb16DMU", _ = "sxtab16DNMU", },
"pkhbtDNMU", "selDNM", "pkhtbDNMU",
},
false,
{ --0a
shift = 5, mask = 7,
[0] = "ssatDxMu", "ssat16DxM", "ssatDxMu",
{ shift = 16, mask = 15, [15] = "sxtbDMU", _ = "sxtabDNMU", },
"ssatDxMu", false, "ssatDxMu",
},
{ --0b
shift = 5, mask = 7,
[0] = "ssatDxMu", "revDM", "ssatDxMu",
{ shift = 16, mask = 15, [15] = "sxthDMU", _ = "sxtahDNMU", },
"ssatDxMu", "rev16DM", "ssatDxMu",
},
{ --0c
shift = 5, mask = 7,
[3] = { shift = 16, mask = 15, [15] = "uxtb16DMU", _ = "uxtab16DNMU", },
},
false,
{ --0e
shift = 5, mask = 7,
[0] = "usatDwMu", "usat16DwM", "usatDwMu",
{ shift = 16, mask = 15, [15] = "uxtbDMU", _ = "uxtabDNMU", },
"usatDwMu", false, "usatDwMu",
},
{ --0f
shift = 5, mask = 7,
[0] = "usatDwMu", "rbitDM", "usatDwMu",
{ shift = 16, mask = 15, [15] = "uxthDMU", _ = "uxtahDNMU", },
"usatDwMu", "revshDM", "usatDwMu",
},
{ --10
shift = 12, mask = 15,
[15] = {
shift = 5, mask = 7,
"smuadNMS", "smuadxNMS", "smusdNMS", "smusdxNMS",
},
_ = {
shift = 5, mask = 7,
[0] = "smladNMSD", "smladxNMSD", "smlsdNMSD", "smlsdxNMSD",
},
},
false, false, false,
{ --14
shift = 5, mask = 7,
[0] = "smlaldDNMS", "smlaldxDNMS", "smlsldDNMS", "smlsldxDNMS",
},
{ --15
shift = 5, mask = 7,
[0] = { shift = 12, mask = 15, [15] = "smmulNMS", _ = "smmlaNMSD", },
{ shift = 12, mask = 15, [15] = "smmulrNMS", _ = "smmlarNMSD", },
false, false, false, false,
"smmlsNMSD", "smmlsrNMSD",
},
false, false,
{ --18
shift = 5, mask = 7,
[0] = { shift = 12, mask = 15, [15] = "usad8NMS", _ = "usada8NMSD", },
},
false,
{ --1a
shift = 5, mask = 3, [2] = "sbfxDMvw",
},
{ --1b
shift = 5, mask = 3, [2] = "sbfxDMvw",
},
{ --1c
shift = 5, mask = 3,
[0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", },
},
{ --1d
shift = 5, mask = 3,
[0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", },
},
{ --1e
shift = 5, mask = 3, [2] = "ubfxDMvw",
},
{ --1f
shift = 5, mask = 3, [2] = "ubfxDMvw",
},
}
local map_load = {
shift = 21, mask = 9,
{
shift = 20, mask = 5,
[0] = "strtDL", "ldrtDL", [4] = "strbtDL", [5] = "ldrbtDL",
},
_ = {
shift = 20, mask = 5,
[0] = "strDL", "ldrDL", [4] = "strbDL", [5] = "ldrbDL",
}
}
local map_load1 = {
shift = 4, mask = 1,
[0] = map_load, map_media,
}
local map_loadm = {
shift = 20, mask = 1,
[0] = {
shift = 23, mask = 3,
[0] = "stmdaNR", "stmNR",
{ shift = 16, mask = 63, [45] = "pushR", _ = "stmdbNR", }, "stmibNR",
},
{
shift = 23, mask = 3,
[0] = "ldmdaNR", { shift = 16, mask = 63, [61] = "popR", _ = "ldmNR", },
"ldmdbNR", "ldmibNR",
},
}
local map_data = {
shift = 21, mask = 15,
[0] = "andDNPs", "eorDNPs", "subDNPs", "rsbDNPs",
"addDNPs", "adcDNPs", "sbcDNPs", "rscDNPs",
"tstNP", "teqNP", "cmpNP", "cmnNP",
"orrDNPs", "movDPs", "bicDNPs", "mvnDPs",
}
local map_mul = {
shift = 21, mask = 7,
[0] = "mulNMSs", "mlaNMSDs", "umaalDNMS", "mlsDNMS",
"umullDNMSs", "umlalDNMSs", "smullDNMSs", "smlalDNMSs",
}
local map_sync = {
shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd.
[0] = "swpDMN", false, false, false,
"swpbDMN", false, false, false,
"strexDMN", "ldrexDN", "strexdDN", "ldrexdDN",
"strexbDMN", "ldrexbDN", "strexhDN", "ldrexhDN",
}
local map_mulh = {
shift = 21, mask = 3,
[0] = { shift = 5, mask = 3,
[0] = "smlabbNMSD", "smlatbNMSD", "smlabtNMSD", "smlattNMSD", },
{ shift = 5, mask = 3,
[0] = "smlawbNMSD", "smulwbNMS", "smlawtNMSD", "smulwtNMS", },
{ shift = 5, mask = 3,
[0] = "smlalbbDNMS", "smlaltbDNMS", "smlalbtDNMS", "smlalttDNMS", },
{ shift = 5, mask = 3,
[0] = "smulbbNMS", "smultbNMS", "smulbtNMS", "smulttNMS", },
}
local map_misc = {
shift = 4, mask = 7,
-- NYI: decode PSR bits of msr.
[0] = { shift = 21, mask = 1, [0] = "mrsD", "msrM", },
{ shift = 21, mask = 3, "bxM", false, "clzDM", },
{ shift = 21, mask = 3, "bxjM", },
{ shift = 21, mask = 3, "blxM", },
false,
{ shift = 21, mask = 3, [0] = "qaddDMN", "qsubDMN", "qdaddDMN", "qdsubDMN", },
false,
{ shift = 21, mask = 3, "bkptK", },
}
local map_datar = {
shift = 4, mask = 9,
[9] = {
shift = 5, mask = 3,
[0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, },
{ shift = 20, mask = 1, [0] = "strhDL", "ldrhDL", },
{ shift = 20, mask = 1, [0] = "ldrdDL", "ldrsbDL", },
{ shift = 20, mask = 1, [0] = "strdDL", "ldrshDL", },
},
_ = {
shift = 20, mask = 25,
[16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, },
_ = {
shift = 0, mask = 0xffffffff,
[bor(0xe1a00000)] = "nop",
_ = map_data,
}
},
}
local map_datai = {
shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12.
[16] = "movwDW", [20] = "movtDW",
[18] = { shift = 0, mask = 0xf00ff, [0] = "nopv6", _ = "msrNW", },
[22] = "msrNW",
_ = map_data,
}
local map_branch = {
shift = 24, mask = 1,
[0] = "bB", "blB"
}
local map_condins = {
[0] = map_datar, map_datai, map_load, map_load1,
map_loadm, map_branch, map_loadc, map_datac
}
-- NYI: setend.
local map_uncondins = {
[0] = false, map_simddata, map_simdload, map_preload,
false, "blxB", map_loadcu, map_datacu,
}
------------------------------------------------------------------------------
local map_gpr = {
[0] = "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc",
}
local map_cond = {
[0] = "eq", "ne", "hs", "lo", "mi", "pl", "vs", "vc",
"hi", "ls", "ge", "lt", "gt", "le", "al",
}
local map_shift = { [0] = "lsl", "lsr", "asr", "ror", }
------------------------------------------------------------------------------
-- Output a nicely formatted line with an opcode and operands.
local function putop(ctx, text, operands)
local pos = ctx.pos
local extra = ""
if ctx.rel then
local sym = ctx.symtab[ctx.rel]
if sym then
extra = "\t->"..sym
elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then
extra = "\t; 0x"..tohex(ctx.rel)
end
end
if ctx.hexdump > 0 then
ctx.out(format("%08x %s %-5s %s%s\n",
ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra))
else
ctx.out(format("%08x %-5s %s%s\n",
ctx.addr+pos, text, concat(operands, ", "), extra))
end
ctx.pos = pos + 4
end
-- Fallback for unknown opcodes.
local function unknown(ctx)
return putop(ctx, ".long", { "0x"..tohex(ctx.op) })
end
-- Format operand 2 of load/store opcodes.
local function fmtload(ctx, op, pos)
local base = map_gpr[band(rshift(op, 16), 15)]
local x, ofs
local ext = (band(op, 0x04000000) == 0)
if not ext and band(op, 0x02000000) == 0 then
ofs = band(op, 4095)
if band(op, 0x00800000) == 0 then ofs = -ofs end
if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end
ofs = "#"..ofs
elseif ext and band(op, 0x00400000) ~= 0 then
ofs = band(op, 15) + band(rshift(op, 4), 0xf0)
if band(op, 0x00800000) == 0 then ofs = -ofs end
if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end
ofs = "#"..ofs
else
ofs = map_gpr[band(op, 15)]
if ext or band(op, 0xfe0) == 0 then
elseif band(op, 0xfe0) == 0x60 then
ofs = format("%s, rrx", ofs)
else
local sh = band(rshift(op, 7), 31)
if sh == 0 then sh = 32 end
ofs = format("%s, %s #%d", ofs, map_shift[band(rshift(op, 5), 3)], sh)
end
if band(op, 0x00800000) == 0 then ofs = "-"..ofs end
end
if ofs == "#0" then
x = format("[%s]", base)
elseif band(op, 0x01000000) == 0 then
x = format("[%s], %s", base, ofs)
else
x = format("[%s, %s]", base, ofs)
end
if band(op, 0x01200000) == 0x01200000 then x = x.."!" end
return x
end
-- Format operand 2 of vector load/store opcodes.
local function fmtvload(ctx, op, pos)
local base = map_gpr[band(rshift(op, 16), 15)]
local ofs = band(op, 255)*4
if band(op, 0x00800000) == 0 then ofs = -ofs end
if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end
if ofs == 0 then
return format("[%s]", base)
else
return format("[%s, #%d]", base, ofs)
end
end
local function fmtvr(op, vr, sh0, sh1)
if vr == "s" then
return format("s%d", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1))
else
return format("d%d", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16))
end
end
-- Disassemble a single instruction.
local function disass_ins(ctx)
local pos = ctx.pos
local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)
local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)
local operands = {}
local suffix = ""
local last, name, pat
local vr
ctx.op = op
ctx.rel = nil
local cond = rshift(op, 28)
local opat
if cond == 15 then
opat = map_uncondins[band(rshift(op, 25), 7)]
else
if cond ~= 14 then suffix = map_cond[cond] end
opat = map_condins[band(rshift(op, 25), 7)]
end
while type(opat) ~= "string" do
if not opat then return unknown(ctx) end
opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._
end
name, pat = match(opat, "^([a-z0-9]*)(.*)")
if sub(pat, 1, 1) == "." then
local s2, p2 = match(pat, "^([a-z0-9.]*)(.*)")
suffix = suffix..s2
pat = p2
end
for p in gmatch(pat, ".") do
local x = nil
if p == "D" then
x = map_gpr[band(rshift(op, 12), 15)]
elseif p == "N" then
x = map_gpr[band(rshift(op, 16), 15)]
elseif p == "S" then
x = map_gpr[band(rshift(op, 8), 15)]
elseif p == "M" then
x = map_gpr[band(op, 15)]
elseif p == "d" then
x = fmtvr(op, vr, 12, 22)
elseif p == "n" then
x = fmtvr(op, vr, 16, 7)
elseif p == "m" then
x = fmtvr(op, vr, 0, 5)
elseif p == "P" then
if band(op, 0x02000000) ~= 0 then
x = ror(band(op, 255), 2*band(rshift(op, 8), 15))
else
x = map_gpr[band(op, 15)]
if band(op, 0xff0) ~= 0 then
operands[#operands+1] = x
local s = map_shift[band(rshift(op, 5), 3)]
local r = nil
if band(op, 0xf90) == 0 then
if s == "ror" then s = "rrx" else r = "#32" end
elseif band(op, 0x10) == 0 then
r = "#"..band(rshift(op, 7), 31)
else
r = map_gpr[band(rshift(op, 8), 15)]
end
if name == "mov" then name = s; x = r
elseif r then x = format("%s %s", s, r)
else x = s end
end
end
elseif p == "L" then
x = fmtload(ctx, op, pos)
elseif p == "l" then
x = fmtvload(ctx, op, pos)
elseif p == "B" then
local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6)
if cond == 15 then addr = addr + band(rshift(op, 23), 2) end
ctx.rel = addr
x = "0x"..tohex(addr)
elseif p == "F" then
vr = "s"
elseif p == "G" then
vr = "d"
elseif p == "." then
suffix = suffix..(vr == "s" and ".f32" or ".f64")
elseif p == "R" then
if band(op, 0x00200000) ~= 0 and #operands == 1 then
operands[1] = operands[1].."!"
end
local t = {}
for i=0,15 do
if band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end
end
x = "{"..concat(t, ", ").."}"
elseif p == "r" then
if band(op, 0x00200000) ~= 0 and #operands == 2 then
operands[1] = operands[1].."!"
end
local s = tonumber(sub(last, 2))
local n = band(op, 255)
if vr == "d" then n = rshift(n, 1) end
operands[#operands] = format("{%s-%s%d}", last, vr, s+n-1)
elseif p == "W" then
x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000)
elseif p == "T" then
x = "#0x"..tohex(band(op, 0x00ffffff), 6)
elseif p == "U" then
x = band(rshift(op, 7), 31)
if x == 0 then x = nil end
elseif p == "u" then
x = band(rshift(op, 7), 31)
if band(op, 0x40) == 0 then
if x == 0 then x = nil else x = "lsl #"..x end
else
if x == 0 then x = "asr #32" else x = "asr #"..x end
end
elseif p == "v" then
x = band(rshift(op, 7), 31)
elseif p == "w" then
x = band(rshift(op, 16), 31)
elseif p == "x" then
x = band(rshift(op, 16), 31) + 1
elseif p == "X" then
x = band(rshift(op, 16), 31) - last + 1
elseif p == "Y" then
x = band(rshift(op, 12), 0xf0) + band(op, 0x0f)
elseif p == "K" then
x = "#0x"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4)
elseif p == "s" then
if band(op, 0x00100000) ~= 0 then suffix = "s"..suffix end
else
assert(false)
end
if x then
last = x
if type(x) == "number" then x = "#"..x end
operands[#operands+1] = x
end
end
return putop(ctx, name..suffix, operands)
end
------------------------------------------------------------------------------
-- Disassemble a block of code.
local function disass_block(ctx, ofs, len)
if not ofs then ofs = 0 end
local stop = len and ofs+len or #ctx.code
ctx.pos = ofs
ctx.rel = nil
while ctx.pos < stop do disass_ins(ctx) end
end
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
local function create(code, addr, out)
local ctx = {}
ctx.code = code
ctx.addr = addr or 0
ctx.out = out or io.write
ctx.symtab = {}
ctx.disass = disass_block
ctx.hexdump = 8
return ctx
end
-- Simple API: disassemble code (a string) at address and output via out.
local function disass(code, addr, out)
create(code, addr, out):disass()
end
-- Return register name for RID.
local function regname(r)
if r < 16 then return map_gpr[r] end
return "d"..(r-16)
end
-- Public module functions.
return {
create = create,
disass = disass,
regname = regname
}
| apache-2.0 |
UnfortunateFruit/darkstar | scripts/zones/Dragons_Aery/npcs/relic.lua | 38 | 1837 | -----------------------------------
-- Area: Dragon's Aery
-- NPC: <this space intentionally left blank>
-- @pos -20 -2 61 154
-----------------------------------
package.loaded["scripts/zones/Dragons_Aery/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Dragons_Aery/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- Working on correct relic, 4 items, Stage 4 item, Shard, Necropsyche, currencypiece
if (player:getVar("RELIC_IN_PROGRESS") == 18275 and trade:getItemCount() == 4 and trade:hasItemQty(18275,1) and
trade:hasItemQty(1573,1) and trade:hasItemQty(1589,1) and trade:hasItemQty(1454,1)) then
player:startEvent(3,18276);
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);
if (csid == 3) then
if (player:getFreeSlotsCount() < 2) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,18276);
player:messageSpecial(FULL_INVENTORY_AFTER_TRADE,1453);
else
player:tradeComplete();
player:addItem(18276);
player:addItem(1453,30);
player:messageSpecial(ITEM_OBTAINED,18276);
player:messageSpecial(ITEMS_OBTAINED,1453,30);
player:setVar("RELIC_IN_PROGRESS",0);
end
end
end; | gpl-3.0 |
focusworld/aabb | bot/utils.lua | 356 | 14963 | 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 superuser 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
-- user has admins privileges
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
-- user has moderator privileges
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['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
-- 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)
-- Berfungsi utk mengecek user jika plugin moderated = true
if plugin.moderated and not is_momod(msg) then --Cek apakah user adalah momod
if plugin.moderated and not is_admin(msg) then -- Cek apakah user adalah admin
if plugin.moderated and not is_sudo(msg) then -- Cek apakah user adalah sudoers
return false
end
end
end
-- Berfungsi mengecek user jika plugin privileged = true
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 | gpl-2.0 |
hamed9898/maxbot | bot/utils.lua | 356 | 14963 | 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 superuser 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
-- user has admins privileges
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
-- user has moderator privileges
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['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
-- 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)
-- Berfungsi utk mengecek user jika plugin moderated = true
if plugin.moderated and not is_momod(msg) then --Cek apakah user adalah momod
if plugin.moderated and not is_admin(msg) then -- Cek apakah user adalah admin
if plugin.moderated and not is_sudo(msg) then -- Cek apakah user adalah sudoers
return false
end
end
end
-- Berfungsi mengecek user jika plugin privileged = true
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 | gpl-2.0 |
hussian/hell_iraq | plugins/ar-h2.lua | 2 | 2159 | --[[
▀▄ ▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀
▀▄ ▄▀ ▀▄ ▄▀
▀▄ ▄▀ BY(@AHMED_ALOBIDE) ▀▄ ▄▀
▀▄ ▄▀ BY(@hussian_9) ▀▄ ▄▀
▀▄ ▄▀ ▀▄ ▄▀
▀▄ ▄▀ (ملف الاوامر 2) ▀▄ ▄▀
▀▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀
--]]
do
local function run(msg, matches)
if is_momod(msg) and matches[1]== "اوامر 2" then
return [[
💀THE LAND OF THE FIRE💀
➖➖➖➖➖➖➖➖➖➖
⬛️اوامر رفع ادمنية➕ وكتم الاعضاء⬛️
➖➖➖➖➖➖➖➖➖➖
🔲دفرة (لطرد العضو بالرد)
🔲رفع ادمن (لاضافة ادمن)
🔲تنزيل ادمن (تنزيل ادمن)
🔲الادمنيه (اضهار الادمنية)
🔲بلوك (لطرد المستخدم بالرد)
🔲حظر (لحضر المستخدم)
🔲الغاءالحظر(لفك حضر المستخدم)
🔲مغادرة (للخروج من المجموعه)
🔲كتم (لكنم المستخدم)
🔲كتم (لالغاء كتم المستخدم)
🔲المكتومين (عرض المكتومين)
🔲منع (لحضرالكلمات في المجموعة
🔲قائمة المنع (لعرض الكلمات المجموعة
🔲حظر عام (باند عام)
🔲الغاء العام (لالغاء الحضر)
🔲قائمه المنع (لعرض الكلمات المحضور
🔲حظر عام (باند عام )
🔲الغاء العام (لالغاء العام)
🔲قائمه العام (لعرض المحضورين)
➖➖➖➖➖➖➖➖➖➖
🕵المطور @AHMED_ALOBIDE
🕵المطور @hussian_9
]]
end
if not is_momod(msg) then
return "مو شغلك ودعبل 😎🖕🏿"
end
end
return {
description = "Help list",
usage = "Help list",
patterns = {
"(اوامر 2)"
},
run = run
}
end | gpl-2.0 |
nesstea/darkstar | scripts/globals/monstertpmoves.lua | 2 | 23817 | require("scripts/globals/magic");
require("scripts/globals/magicburst")
require("scripts/globals/status")
require("scripts/globals/utils")
-- Foreword: A lot of this is good estimating since the FFXI playerbase has not found all of info for individual moves.
-- What is known is that they roughly follow player Weaponskill calculations (pDIF, dMOD, ratio, etc) so this is what
-- this set of functions emulates.
-- mob types
-- used in mob:isMobType()
MOBTYPE_NORMAL = 0x00;
MOBTYPE_PCSPAWNED = 0x01;
MOBTYPE_NOTORIOUS = 0x02;
MOBTYPE_FISHED = 0x04;
MOBTYPE_CALLED = 0x08;
MOBTYPE_BATTLEFIELD = 0x10;
MOBTYPE_EVENT = 0x20;
--skilltype
MOBSKILL_PHYSICAL = 0;
MOBSKILL_MAGICAL = 1;
MOBSKILL_RANGED = 2;
MOBSKILL_BREATH = 4;
MOBSKILL_SPECIAL = 3;
--skillparam (PHYSICAL)
MOBPARAM_NONE = 0;
MOBPARAM_BLUNT = 1;
MOBPARAM_SLASH = 2;
MOBPARAM_PIERCE = 3;
MOBPARAM_H2H = 4;
MOBDRAIN_HP = 0;
MOBDRAIN_MP = 1;
MOBDRAIN_TP = 2;
--skillparam (MAGICAL)
-- this is totally useless and should be removed
-- add resistence using ELE_FIRE, see bomb_toss.lua
MOBPARAM_FIRE = 6;
MOBPARAM_EARTH = 7;
MOBPARAM_WATER = 8;
MOBPARAM_WIND = 9;
MOBPARAM_ICE = 10;
MOBPARAM_THUNDER = 11;
MOBPARAM_LIGHT = 12;
MOBPARAM_DARK = 13;
--shadowbehav (number of shadows to take off)
MOBPARAM_IGNORE_SHADOWS = 0;
MOBPARAM_1_SHADOW = 1;
MOBPARAM_2_SHADOW = 2;
MOBPARAM_3_SHADOW = 3;
MOBPARAM_4_SHADOW = 4;
MOBPARAM_WIPE_SHADOWS = 999;
TP_ACC_VARIES = 0;
TP_ATK_VARIES = 1;
TP_DMG_VARIES = 2;
TP_CRIT_VARIES = 3;
TP_NO_EFFECT = 0;
TP_MACC_BONUS = 1;
TP_MAB_BONUS = 2;
TP_DMG_BONUS = 3;
TP_RANGED = 4;
MSG_NONE = 0; -- display nothing
MSG_USES = 101; -- simple uses message
MSG_FAMILIAR = 108;
MSG_SELF_HEAL = 238;
MSG_ENFEEB_IS = 242; --XXX is petrified.
MSG_ENFEEB = 243; --XXX receives the effect of petrification.
MSG_BUFF = 186;
MSG_DRAIN_HP = 187;
MSG_DRAIN_MP = 225;
MSG_DRAIN_TP = 226;
MSG_NO_EFFECT = 189;
MSG_SHADOW = 31;
MSG_ANTICIPATE = 30;
MSG_DAMAGE = 185; -- player uses, target takes 10 damage. DEFAULT
MSG_MISS = 188;
MSG_RESIST = 85;
MSG_EFFECT_DRAINED = 370; -- <num> status effects are drained from <target>.
MSG_ATTR_DRAINED = 369;
MSG_TP_REDUCED = 362; -- tp reduced to
MSG_DISAPPEAR = 159; -- <target>'s stun effect disappears!
MSG_DISAPPEAR_NUM = 231; -- <num> of <target>'s effects disappear!
BOMB_TOSS_HPP = 1;
function MobRangedMove(mob,target,skill,numberofhits,accmod,dmgmod, tpeffect)
-- this will eventually contian ranged attack code
return MobPhysicalMove(mob,target,skill,numberofhits,accmod,dmgmod, TP_RANGED);
end;
-- PHYSICAL MOVE FUNCTION
-- Call this on every physical move!
-- accmod is a linear multiplier for accuracy (1 default)
-- dmgmod is a linear multiplier for damage (1 default)
-- tpeffect is an enum which can be one of:
-- 0 TP_ACC_VARIES
-- 1 TP_ATK_VARIES
-- 2 TP_DMG_VARIES
-- 3 TP_CRIT_VARIES
-- mtp100/200/300 are the three values for 100% TP, 200% TP, 300% TP just like weaponskills.lua
-- if TP_ACC_VARIES -> three values are acc %s (1.0 is 100% acc, 0.8 is 80% acc, 1.2 is 120% acc)
-- if TP_ATK_VARIES -> three values are attack multiplier (1.5x 0.5x etc)
-- if TP_DMG_VARIES -> three values are
function MobPhysicalMove(mob,target,skill,numberofhits,accmod,dmgmod,tpeffect,mtp000,mtp150,mtp300,offcratiomod)
local returninfo = {};
--get dstr (bias to monsters, so no fSTR)
local dstr = mob:getStat(MOD_STR) - target:getStat(MOD_VIT);
if (dstr < -10) then
dstr = -10;
end
if (dstr > 10) then
dstr = 10;
end
local lvluser = mob:getMainLvl();
local lvltarget = target:getMainLvl();
local acc = mob:getACC();
local eva = target:getEVA();
if (target:hasStatusEffect(EFFECT_YONIN) and mob:isFacing(target, 23)) then -- Yonin evasion boost if mob is facing target
eva = eva + target:getStatusEffect(EFFECT_YONIN):getPower();
end
--apply WSC
local base = mob:getWeaponDmg() + dstr; --todo: change to include WSC
if (base < 1) then
base = 1;
end
--work out and cap ratio
if (offcratiomod == nil) then -- default to attack. Pretty much every physical mobskill will use this, Cannonball being the exception.
offcratiomod = mob:getStat(MOD_ATT);
-- print ("Nothing passed, defaulting to attack");
end;
local ratio = offcratiomod/target:getStat(MOD_DEF);
local lvldiff = lvluser - lvltarget;
if lvldiff < 0 then
lvldiff = 0;
end;
ratio = ratio + lvldiff * 0.05;
ratio = utils.clamp(ratio, 0, 4);
--work out hit rate for mobs (bias towards them)
local hitrate = (acc*accmod) - eva + (lvldiff*2) + 75;
-- printf("acc: %f, eva: %f, hitrate: %f", acc, eva, hitrate);
hitrate = utils.clamp(hitrate, 20, 95);
--work out the base damage for a single hit
local hitdamage = base + lvldiff;
if (hitdamage < 1) then
hitdamage = 1;
end
hitdamage = hitdamage * dmgmod;
if (tpeffect == TP_DMG_VARIES) then
hitdamage = hitdamage * MobTPMod(skill:getTP() / 10);
end
--work out min and max cRatio
local maxRatio = 1;
local minRatio = 0;
if (ratio < 0.5) then
maxRatio = ratio + 0.5;
elseif ((0.5 <= ratio) and (ratio <= 0.7)) then
maxRatio = 1;
elseif ((0.7 < ratio) and (ratio <= 1.2)) then
maxRatio = ratio + 0.3;
elseif ((1.2 < ratio) and (ratio <= 1.5)) then
maxRatio = (ratio * 0.25) + ratio;
elseif ((1.5 < ratio) and (ratio <= 2.625)) then
maxRatio = ratio + 0.375;
elseif ((2.625 < ratio) and (ratio <= 3.25)) then
maxRatio = 3;
else
maxRatio = ratio;
end
if (ratio < 0.38) then
minRatio = 0;
elseif ((0.38 <= ratio) and (ratio <= 1.25)) then
minRatio = ratio * (1176 / 1024) - (448 / 1024);
elseif ((1.25 < ratio) and (ratio <= 1.51)) then
minRatio = 1;
elseif ((1.51 < ratio) and (ratio <= 2.44)) then
minRatio = ratio * (1176 / 1024) - (775 / 1024);
else
minRatio = ratio - 0.375;
end
--apply ftp (assumes 1~3 scalar linear mod)
if (tpeffect==TP_DMG_BONUS) then
hitdamage = hitdamage * fTP(skill:getTP(), mtp000, mtp150, mtp300);
end
--Applying pDIF
local pdif = 0;
-- start the hits
local hitchance = math.random();
local finaldmg = 0;
local hitsdone = 1;
local hitslanded = 0;
local chance = math.random();
-- first hit has a higher chance to land
local firstHitChance = hitrate * 1.5;
if (tpeffect==TP_RANGED) then
firstHitChance = hitrate * 1.2;
end
firstHitChance = utils.clamp(firstHitChance, 35, 95);
if ((chance*100) <= firstHitChance) then
pdif = math.random((minRatio*1000),(maxRatio*1000)) --generate random PDIF
pdif = pdif/1000; --multiplier set.
finaldmg = finaldmg + hitdamage * pdif;
hitslanded = hitslanded + 1;
end
while (hitsdone < numberofhits) do
chance = math.random();
if ((chance*100)<=hitrate) then --it hit
pdif = math.random((minRatio*1000),(maxRatio*1000)) --generate random PDIF
pdif = pdif/1000; --multiplier set.
finaldmg = finaldmg + hitdamage * pdif;
hitslanded = hitslanded + 1;
end
hitsdone = hitsdone + 1;
end
-- printf("final: %f, hits: %f, acc: %f", finaldmg, hitslanded, hitrate);
-- printf("ratio: %f, min: %f, max: %f, pdif, %f hitdmg: %f", ratio, minRatio, maxRatio, pdif, hitdamage);
-- if an attack landed it must do at least 1 damage
if (hitslanded >= 1 and finaldmg < 1) then
finaldmg = 1;
end
-- all hits missed
if (hitslanded == 0 or finaldmg == 0) then
finaldmg = 0;
hitslanded = 0;
skill:setMsg(MSG_MISS);
end
returninfo.dmg = finaldmg;
returninfo.hitslanded = hitslanded;
return returninfo;
end
-- MAGICAL MOVE
-- Call this on every magical move!
-- mob/target/skill should be passed from onMobWeaponSkill.
-- dmg is the base damage (V value), accmod is a multiplier for accuracy (1 default, more than 1 = higher macc for mob),
-- ditto for dmg mod but more damage >1 (equivalent of M value)
-- tpeffect is an enum from one of:
-- 0 = TP_NO_EFFECT
-- 1 = TP_MACC_BONUS
-- 2 = TP_MAB_BONUS
-- 3 = TP_DMG_BONUS
-- tpvalue affects the strength of having more TP along the following lines:
-- TP_NO_EFFECT -> tpvalue has no effect.
-- TP_MACC_BONUS -> direct multiplier to macc (1 for default)
-- TP_MAB_BONUS -> direct multiplier to mab (1 for default)
-- TP_DMG_BONUS -> direct multiplier to damage (V+dINT) (1 for default)
--Examples:
-- TP_DMG_BONUS and TP=100, tpvalue = 1, assume V=150 --> damage is now 150*(TP*1)/100 = 150
-- TP_DMG_BONUS and TP=200, tpvalue = 1, assume V=150 --> damage is now 150*(TP*1)/100 = 300
-- TP_DMG_BONUS and TP=100, tpvalue = 2, assume V=150 --> damage is now 150*(TP*2)/100 = 300
-- TP_DMG_BONUS and TP=200, tpvalue = 2, assume V=150 --> damage is now 150*(TP*2)/100 = 600
function MobMagicalMove(mob,target,skill,damage,element,dmgmod,tpeffect,tpvalue)
returninfo = {};
--get all the stuff we need
local resist = 1;
local mdefBarBonus = 0;
if (element > 0 and element <= 6 and target:hasStatusEffect(barSpells[element])) then -- bar- spell magic defense bonus
mdefBarBonus = target:getStatusEffect(barSpells[element]):getSubPower();
end
-- plus 100 forces it to be a number
mab = (100 + mob:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF) + mdefBarBonus);
if (mab > 1.3) then
mab = 1.3;
end
if (mab < 0.7) then
mab = 0.7;
end
if (tpeffect==TP_DMG_BONUS) then
damage = damage * (((skill:getTP() / 10)*tpvalue)/100);
end
-- printf("power: %f, bonus: %f", damage, mab);
-- resistence is added last
finaldmg = damage * mab * dmgmod;
-- get resistence
local avatarAccBonus = 0;
if (mob:isPet() and mob:getMaster() ~= nil) then
local master = mob:getMaster();
if (master:getPetID() >= 0 and master:getPetID() <= 20) then -- check to ensure pet is avatar
avatarAccBonus = utils.clamp(master:getSkillLevel(SKILL_SUM) - master:getMaxSkillLevel(mob:getMainLvl(), JOB_SMN, SUMMONING_SKILL), 0, 200);
end
end
resist = applyPlayerResistance(mob,nil,target,mob:getStat(MOD_INT)-target:getStat(MOD_INT),avatarAccBonus,element);
local magicDefense = getElementalDamageReduction(target, element);
finaldmg = finaldmg * resist * magicDefense;
returninfo.dmg = finaldmg;
return returninfo;
end
--mob version
--effect = EFFECT_WHATEVER if enfeeble
--statmod = the stat to account for resist (INT,MND,etc) e.g. MOD_INT
--This determines how much the monsters ability resists on the player.
function applyPlayerResistance(mob,effect,target,diff,bonus,element)
local percentBonus = 0;
local magicaccbonus = 0;
if (diff > 10) then
magicaccbonus = magicaccbonus + 10 + (diff - 10)/2;
else
magicaccbonus = magicaccbonus + diff;
end
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
if(effect ~= nil) then
percentBonus = percentBonus - getEffectResistance(target, effect);
end
local p = getMagicHitRate(mob, target, 0, element, percentBonus, magicaccbonus);
return getMagicResist(p);
end;
function mobAddBonuses(caster, spell, target, dmg, ele)
local magicDefense = getElementalDamageReduction(target, ele);
dmg = math.floor(dmg * magicDefense);
dayWeatherBonus = 1.00;
if caster:getWeather() == singleWeatherStrong[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif caster:getWeather() == singleWeatherWeak[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif caster:getWeather() == doubleWeatherStrong[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif caster:getWeather() == doubleWeatherWeak[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
if VanadielDayElement() == dayStrong[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif VanadielDayElement() == dayWeak[ele] then
if math.random() < 0.33 then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if dayWeatherBonus > 1.35 then
dayWeatherBonus = 1.35;
end
dmg = math.floor(dmg * dayWeatherBonus);
burst = calculateMobMagicBurst(caster, ele, target);
-- not sure what to do for this yet
-- if (burst > 1.0) then
-- spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!"
-- end
dmg = math.floor(dmg * burst);
local mdefBarBonus = 0;
if (ele > 0 and ele <= 6 and target:hasStatusEffect(barSpells[ele])) then -- bar- spell magic defense bonus
mdefBarBonus = target:getStatusEffect(barSpells[ele]):getSubPower();
end
mab = (100 + caster:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF) + mdefBarBonus) ;
dmg = math.floor(dmg * mab);
magicDmgMod = (256 + target:getMod(MOD_DMGMAGIC)) / 256;
dmg = math.floor(dmg * magicDmgMod);
-- print(affinityBonus);
-- print(speciesReduction);
-- print(dayWeatherBonus);
-- print(burst);
-- print(mab);
-- print(magicDmgMod);
return dmg;
end
function calculateMobMagicBurst(caster, ele, target)
local burst = 1.0;
local skillchainTier, skillchainCount = MobFormMagicBurst(ele, target);
if (skillchainTier > 0) then
if (skillchainCount == 1) then
burst = 1.3;
elseif (skillchainCount == 2) then
burst = 1.35;
elseif (skillchainCount == 3) then
burst = 1.40;
elseif (skillchainCount == 4) then
burst = 1.45;
elseif (skillchainCount == 5) then
burst = 1.50;
else
-- Something strange is going on if this occurs.
burst = 1.0;
end
end
return burst;
end;
-- Calculates breath damage
-- mob is a mob reference to get hp and lvl
-- percent is the percentage to take from HP
-- base is calculated from main level to create a minimum
-- Equation: (HP * percent) + (LVL / base)
-- cap is optional, defines a maximum damage
function MobBreathMove(mob, target, percent, base, element, cap)
local damage = (mob:getHP() * percent) + (mob:getMainLvl() / base);
if (cap == nil) then
-- cap max damage
cap = math.floor(mob:getHP()/5);
end
-- Deal bonus damage vs mob ecosystem
local systemBonus = utils.getSystemStrengthBonus(mob, target);
damage = damage + (damage * (systemBonus * 0.25));
-- elemental resistence
if (element ~= nil and element > 0) then
-- no skill available, pass nil
local resist = applyPlayerResistance(mob,nil,target,mob:getStat(MOD_INT)-target:getStat(MOD_INT),0,element);
-- get elemental damage reduction
local defense = getElementalDamageReduction(target, element)
damage = damage * resist * defense;
end
damage = utils.clamp(damage, 1, cap);
return damage;
end;
function MobFinalAdjustments(dmg,mob,skill,target,skilltype,skillparam,shadowbehav)
-- physical attack missed, skip rest
if (skill:hasMissMsg()) then
return 0;
end
--handle pd
if ((target:hasStatusEffect(EFFECT_PERFECT_DODGE) or target:hasStatusEffect(EFFECT_ALL_MISS) )
and skilltype==MOBSKILL_PHYSICAL) then
skill:setMsg(MSG_MISS);
return 0;
end
-- set message to damage
-- this is for AoE because its only set once
skill:setMsg(MSG_DAMAGE);
--Handle shadows depending on shadow behaviour / skilltype
if (shadowbehav ~= MOBPARAM_WIPE_SHADOWS and shadowbehav ~= MOBPARAM_IGNORE_SHADOWS) then --remove 'shadowbehav' shadows.
if (skill:isAoE() or skill:isConal()) then
shadowbehav = MobTakeAoEShadow(mob, target, shadowbehav);
end
dmg = utils.takeShadows(target, dmg, shadowbehav);
-- dealt zero damage, so shadows took hit
if (dmg == 0) then
skill:setMsg(MSG_SHADOW);
return shadowbehav;
end
elseif (shadowbehav == MOBPARAM_WIPE_SHADOWS) then --take em all!
target:delStatusEffect(EFFECT_COPY_IMAGE);
target:delStatusEffect(EFFECT_BLINK);
target:delStatusEffect(EFFECT_THIRD_EYE);
end
if (skilltype == MOBSKILL_PHYSICAL and skill:isSingle() == false) then
target:delStatusEffect(EFFECT_THIRD_EYE);
end
--handle Third Eye using shadowbehav as a guide
if (skilltype == MOBSKILL_PHYSICAL and utils.thirdeye(target)) then
skill:setMsg(MSG_ANTICIPATE);
return 0;
end
if (skilltype == MOBSKILL_PHYSICAL) then
dmg = target:physicalDmgTaken(dmg);
elseif (skilltype == MOBSKILL_MAGICAL) then
dmg = target:magicDmgTaken(dmg);
elseif (skilltype == MOBSKILL_BREATH) then
dmg = target:breathDmgTaken(dmg);
elseif (skilltype == MOBSKILL_RANGED) then
dmg = target:rangedDmgTaken(dmg);
end
--handling phalanx
dmg = dmg - target:getMod(MOD_PHALANX);
if (dmg < 0) then
return 0;
end
dmg = utils.stoneskin(target, dmg);
if (dmg > 0) then
target:wakeUp();
target:updateEnmityFromDamage(mob,dmg);
target:handleAfflatusMiseryDamage(dmg);
end
return dmg;
end;
-- returns true if mob attack hit
-- used to stop tp move status effects
function MobPhysicalHit(skill)
-- if message is not the default. Then there was a miss, shadow taken etc
return skill:hasMissMsg() == false;
end;
-- function MobHit()
-- end;
-- function MobAoEHit()
-- end;
-- function MobMagicHit()
-- end;
-- function MobMagicAoEHit()
-- end;
function MobDrainMove(mob, target, drainType, drain)
if (target:isUndead() == false) then
if (drainType == MOBDRAIN_MP) then
-- can't go over limited mp
if (target:getMP() < drain) then
drain = target:getMP();
end
target:delMP(drain);
mob:addMP(drain);
return MSG_DRAIN_MP;
elseif (drainType == MOBDRAIN_TP) then
-- can't go over limited tp
if (target:getTP() < drain) then
drain = target:getTP();
end
target:delTP(drain);
mob:addTP(drain);
return MSG_DRAIN_TP;
elseif (drainType == MOBDRAIN_HP) then
-- can't go over limited hp
if (target:getHP() < drain) then
drain = target:getHP();
end
target:delHP(drain);
mob:addHP(drain);
return MSG_DRAIN_HP;
end
else
-- it's undead so just deal damage
-- can't go over limited hp
if (target:getHP() < drain) then
drain = target:getHP();
end
target:delHP(drain);
return MSG_DAMAGE;
end
return MSG_NO_EFFECT;
end;
function MobPhysicalDrainMove(mob, target, skill, drainType, drain)
if (MobPhysicalHit(skill)) then
return MobDrainMove(mob, target, drainType, drain);
end
return MSG_MISS;
end;
function MobDrainAttribute(mob, target, typeEffect, power, tick, duration)
local positive = nil;
if (typeEffect == EFFECT_STR_DOWN) then
positive = EFFECT_STR_BOOST;
elseif (typeEffect == EFFECT_DEX_DOWN) then
positive = EFFECT_DEX_BOOST;
elseif (typeEffect == EFFECT_AGI_DOWN) then
positive = EFFECT_AGI_BOOST;
elseif (typeEffect == EFFECT_VIT_DOWN) then
positive = EFFECT_VIT_BOOST;
elseif (typeEffect == EFFECT_MND_DOWN) then
positive = EFFECT_MND_BOOST;
elseif (typeEffect == EFFECT_INT_DOWN) then
positive = EFFECT_INT_BOOST;
elseif (typeEffect == EFFECT_CHR_DOWN) then
positive = EFFECT_CHR_BOOST;
end
if (positive ~= nil) then
local results = MobStatusEffectMove(mob, target, typeEffect, power, tick, duration);
if (results == MSG_ENFEEB_IS) then
mob:addStatusEffect(positive, power, tick, duration);
return MSG_ATTR_DRAINED;
end
return MSG_MISS;
end
return MSG_NO_EFFECT;
end;
function MobDrainStatusEffectMove(mob, target)
-- try to drain buff
local effect = target:stealStatusEffect();
local dmg = 0;
if (effect ~= nil) then
if (mob:hasStatusEffect(effect:getType()) == false) then
-- add to myself
mob:addStatusEffect(effect:getType(), effect:getPower(), effect:getTickCount(), effect:getDuration());
end
-- add buff to myself
return MSG_EFFECT_DRAINED;
end
return MSG_NO_EFFECT;
end;
-- Adds a status effect to a target
function MobStatusEffectMove(mob, target, typeEffect, power, tick, duration)
if (target:canGainStatusEffect(typeEffect, power)) then
local statmod = MOD_INT;
local element = mob:getStatusEffectElement(typeEffect);
local resist = applyPlayerResistance(mob,typeEffect,target,mob:getStat(statmod)-target:getStat(statmod),0,element);
if (resist >= 0.25) then
local totalDuration = utils.clamp(duration * resist, 1);
target:addStatusEffect(typeEffect, power, tick, totalDuration);
return MSG_ENFEEB_IS;
end
return MSG_MISS; -- resist !
end
return MSG_NO_EFFECT; -- no effect
end;
-- similar to status effect move except, this will not land if the attack missed
function MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, power, tick, duration)
if (MobPhysicalHit(skill)) then
return MobStatusEffectMove(mob, target, typeEffect, power, tick, duration);
end
return MSG_MISS;
end;
-- similar to statuseffect move except it will only take effect if facing
function MobGazeMove(mob, target, typeEffect, power, tick, duration)
if (target:isFacing(mob)) then
return MobStatusEffectMove(mob, target, typeEffect, power, tick, duration);
end
return MSG_NO_EFFECT;
end;
function MobBuffMove(mob, typeEffect, power, tick, duration)
if (mob:addStatusEffect(typeEffect,power,tick,duration)) then
return MSG_BUFF;
end
return MSG_NO_EFFECT;
end;
function MobHealMove(target, heal)
local mobHP = target:getHP();
local mobMaxHP = target:getMaxHP();
if (mobHP+heal > mobMaxHP) then
heal = mobMaxHP - mobHP;
end
target:wakeUp();
target:addHP(heal);
return heal;
end
function MobTakeAoEShadow(mob, target, max)
-- this is completely crap and should be using actual nin skill
-- TODO fix this
if (target:getMainJob() == JOB_NIN and math.random() < 0.6) then
max = max - 1;
if (max < 1) then
max = 1;
end
end
return math.random(1, max);
end;
function MobTPMod(tp)
-- increase damage based on tp
if (tp >= 3000) then
return 2;
elseif (tp >= 2000) then
return 1.5;
end
return 1;
end;
function fTP(tp,ftp1,ftp2,ftp3)
if (tp<1000) then
tp=1000;
end
if (tp>=1000 and tp<1500) then
return ftp1 + ( ((ftp2-ftp1)/500) * (tp-1000));
elseif (tp>=1500 and tp<=3000) then
--generate a straight line between ftp2 and ftp3 and find point @ tp
return ftp2 + ( ((ftp3-ftp2)/1500) * (tp-1500));
end
return 1; --no ftp mod
end;
| gpl-3.0 |
JulioC/telegram-bot | plugins/vote.lua | 615 | 2128 | do
local _file_votes = './data/votes.lua'
function read_file_votes ()
local f = io.open(_file_votes, "r+")
if f == nil then
print ('Created voting file '.._file_votes)
serialize_to_file({}, _file_votes)
else
print ('Values loaded: '.._file_votes)
f:close()
end
return loadfile (_file_votes)()
end
function clear_votes (chat)
local _votes = read_file_votes ()
_votes [chat] = {}
serialize_to_file(_votes, _file_votes)
end
function votes_result (chat)
local _votes = read_file_votes ()
local results = {}
local result_string = ""
if _votes [chat] == nil then
_votes[chat] = {}
end
for user,vote in pairs (_votes[chat]) do
if (results [vote] == nil) then
results [vote] = user
else
results [vote] = results [vote] .. ", " .. user
end
end
for vote,users in pairs (results) do
result_string = result_string .. vote .. " : " .. users .. "\n"
end
return result_string
end
function save_vote(chat, user, vote)
local _votes = read_file_votes ()
if _votes[chat] == nil then
_votes[chat] = {}
end
_votes[chat][user] = vote
serialize_to_file(_votes, _file_votes)
end
function run(msg, matches)
if (matches[1] == "ing") then
if (matches [2] == "reset") then
clear_votes (tostring(msg.to.id))
return "Voting statistics reset.."
elseif (matches [2] == "stats") then
local votes_result = votes_result (tostring(msg.to.id))
if (votes_result == "") then
votes_result = "[No votes registered]\n"
end
return "Voting statistics :\n" .. votes_result
end
else
save_vote(tostring(msg.to.id), msg.from.print_name, tostring(tonumber(matches[2])))
return "Vote registered : " .. msg.from.print_name .. " " .. tostring(tonumber(matches [2]))
end
end
return {
description = "Plugin for voting in groups.",
usage = {
"!voting reset: Reset all the votes.",
"!vote [number]: Cast the vote.",
"!voting stats: Shows the statistics of voting."
},
patterns = {
"^!vot(ing) (reset)",
"^!vot(ing) (stats)",
"^!vot(e) ([0-9]+)$"
},
run = run
}
end | gpl-2.0 |
firoxer/naive-bayes-lua | tests/naivebayes.lua | 1 | 1481 | -- luacheck: ignore lrun lok
require "minctest"
local NaiveBayes = require("naivebayes.naivebayes")
local function splitToWords(sentence)
local words = {}
for word in string.gmatch(sentence, "%S+") do
table.insert(words, word)
end
return words
end
-- Test data to learn
local sentences = {
["heartwarming optimists achieved harmony"] = "positive",
["tranquil benefactors rejoiced in sunshine"] = "positive",
["menacing filth smells foul"] = "negative",
["sinister villains horrified the injured"] = "negative"
}
local classifier = NaiveBayes.new()
-- Split the test sentences to words and learn them
for sentence, classification in pairs(sentences) do
classifier:learn(splitToWords(sentence), classification)
end
lrun("test", function()
local words
-- completely positive
words = splitToWords("tranquil optimists rejoiced")
lok(classifier:guess(words) == "positive")
-- mostly positive
words = splitToWords("heartwarming optimists were injured")
lok(classifier:guess(words) == "positive")
-- balanced
words = splitToWords("tranquil filth horrified sunshine ")
lok(classifier:guess(words) == "positive"
or classifier:guess(words) == "negative")
-- mostly negative
words = splitToWords("sinister harmony smells")
lok(classifier:guess(words) == "negative")
-- completely negative
words = splitToWords("foul filth menacing the injured")
lok(classifier:guess(words) == "negative")
end)
| mit |
nesstea/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/King_Zagan.lua | 2 | 1559 | -----------------------------------
-- Area: Dynamis Xarcabard
-- MOB: King Zagan
-----------------------------------
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,ally)
local Animate_Trigger = GetServerVariable("[DynaXarcabard]Boss_Trigger");
if (mob:isInBattlefieldList() == false) then
mob:addInBattlefieldList();
Animate_Trigger = Animate_Trigger + 2048;
SetServerVariable("[DynaXarcabard]Boss_Trigger",Animate_Trigger);
if (Animate_Trigger == 32767) then
SpawnMob(17330911); -- 142
SpawnMob(17330912); -- 143
SpawnMob(17330177); -- Dynamis Lord
GetMobByID(17330183):setSpawn(-364,-35.661,17.254); -- Set Ying and Yang's spawn points to their initial spawn point.
GetMobByID(17330184):setSpawn(-364,-35.974,24.254);
SpawnMob(17330183);
SpawnMob(17330184);
activateAnimatedWeapon(); -- Change subanim of all animated weapon
end
end
if (Animate_Trigger == 32767) then
ally:messageSpecial(PRISON_OF_SOULS_HAS_SET_FREE);
end
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/zones/Windurst_Waters/npcs/Furakku-Norakku.lua | 15 | 4696 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Furakku-Norakku
-- Involved in Quests: Early Bird Catches the Bookworm, Chasing Tales, Class Reunion
-- @pos -19 -5 101 238
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Windurst_Waters/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local bookwormStatus = player:getQuestStatus(WINDURST,EARLY_BIRD_CATCHES_THE_BOOKWORM);
local chasingStatus = player:getQuestStatus(WINDURST,CHASING_TALES);
local bookNotifications = player:hasKeyItem(OVERDUE_BOOK_NOTIFICATIONS);
local ClassReunion = player:getQuestStatus(WINDURST,CLASS_REUNION);
local ClassReunionProgress = player:getVar("ClassReunionProgress");
local talk2 = player:getVar("ClassReunion_TalkedToFurakku");
if(bookwormStatus == QUEST_ACCEPTED and bookNotifications == false) then
player:startEvent(0x0185); -- During Quest "Early Bird Catches the Bookworm" 1
elseif(bookwormStatus == QUEST_ACCEPTED and bookNotifications and player:getVar("EARLY_BIRD_TRACK_BOOK") == 0) then
player:startEvent(0x0186); -- During Quest "Early Bird Catches the Bookworm" 2
elseif(bookwormStatus == QUEST_ACCEPTED and player:getVar("EARLY_BIRD_TRACK_BOOK") == 1) then
player:startEvent(0x018d); -- During Quest "Early Bird Catches the Bookworm" 3
elseif(bookwormStatus == QUEST_ACCEPTED and player:getVar("EARLY_BIRD_TRACK_BOOK") >= 2) then
player:startEvent(0x0190); -- Finish Quest "Early Bird Catches the Bookworm"
elseif(bookwormStatus == QUEST_COMPLETED and player:needToZone()) then
player:startEvent(0x0191); -- Standard dialog before player zone
elseif(chasingStatus == QUEST_ACCEPTED and player:hasKeyItem(OVERDUE_BOOK_NOTIFICATION) == false) then
player:startEvent(0x0194,0,126); -- During Quest "Chasing Tales", tells you the book "A Song of Love" is overdue
elseif(player:hasKeyItem(OVERDUE_BOOK_NOTIFICATION) and player:hasKeyItem(A_SONG_OF_LOVE) == false) then
player:startEvent(0x0195,0,126);
elseif(player:getVar("CHASING_TALES_TRACK_BOOK") == 1 and player:hasKeyItem(A_SONG_OF_LOVE) == false) then
player:startEvent(0x0199);
elseif(player:hasKeyItem(A_SONG_OF_LOVE)) then
player:startEvent(0x019a);
elseif(chasingStatus == QUEST_COMPLETED and player:needToZone() == true) then
player:startEvent(0x019b);
-----------------------------------------------------------------
-- Class Reunion
elseif(ClassReunion == 1 and ClassReunionProgress >= 3 and talk2 ~= 1) then
player:startEvent(0x0330); -- he tells you about Uran-Mafran
-----------------------------------------------------------------
else
player:startEvent(0x0173);
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 == 0x0185) then
player:addKeyItem(OVERDUE_BOOK_NOTIFICATIONS);
player:messageSpecial(KEYITEM_OBTAINED,OVERDUE_BOOK_NOTIFICATIONS);
elseif(csid == 0x0190) then
player:needToZone(true);
player:addTitle(SAVIOR_OF_KNOWLEDGE);
player:addGil(GIL_RATE*1500);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*1500);
player:setVar("EARLY_BIRD_TRACK_BOOK",0);
player:addFame(WINDURST,WIN_FAME*120);
player:completeQuest(WINDURST,EARLY_BIRD_CATCHES_THE_BOOKWORM);
elseif(csid == 0x0194) then
player:addKeyItem(OVERDUE_BOOK_NOTIFICATION);
player:messageSpecial(KEYITEM_OBTAINED,OVERDUE_BOOK_NOTIFICATION);
elseif(csid == 0x019a) then
player:needToZone(true);
player:addGil(GIL_RATE*2800);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*2800);
player:addTitle(SAVIOR_OF_KNOWLEDGE);
player:delKeyItem(OVERDUE_BOOK_NOTIFICATION);
player:delKeyItem(A_SONG_OF_LOVE);
player:setVar("CHASING_TALES_TRACK_BOOK",0);
player:addFame(WINDURST,WIN_FAME*120);
player:completeQuest(WINDURST,CHASING_TALES);
elseif(csid == 0x0330) then
player:setVar("ClassReunion_TalkedToFurakku",1);
end
end; | gpl-3.0 |
dpino/snabbswitch | src/program/l2vpn/l2vpn.lua | 3 | 30865 | -- This program provisions a complete endpoint for one or more L2 VPNs.
--
-- Each VPN provides essentially a multi-point L2 VPN over IPv6,
-- a.k.a. Virtual Private LAN Service (VPLS). A point-to-point VPN,
-- a.k.a. Virtual Private Wire Service (VPWS) is provided as a
-- degenerate case of a VPLS with exactly two endpoints (i.e. a single
-- pseudowire). The general framework is described in RFC4664.
--
-- The configuration is split into two parts. The first part defines
-- the interfaces which are available for uplinks and attachment
-- circuits as well as their L2 and L3 properties.
--
-- The second part defines the actual VPN endpoints which contain
-- references to the interfaces defined in the first part.
--
-- See the README.md for details about the configuration.
--
-- The module constructs a network of apps from such a specification
-- as follows.
--
-- For each interface, the corresponding driver is instantiated with
-- the given configuration. In non-trunking mode and without a L3
-- configuration, initialization is finished and other apps can link
-- directly to the driver. For a L3 interface, the nd_light app is
-- attached to the driver and other apps attach to nd_light instead.
--
-- If the interface is in trunking mode, an instance of the VlanMux
-- app from apps.vlan.vlan is instantiated and its "trunk" port is
-- connected to the interface. For each sub-interface that contains a
-- L3 configuration, an instance of the nd_light app is attached to
-- the appropriate "vlan" link of the VlanMux app (for vlan = 0, the
-- corresponding VlanMux link is called "native").
--
-- Each uplink of the VPLS configuration must reference a
-- L3-(sub-)interface of a previously defined physical interface. For
-- each VPLS, the "uplink" link of the pseudowire-dispatch app is
-- connected to the "north" link of the ND module of its uplink
-- interface.
--
-- The dispatch app provides the demultiplexing of incoming packets
-- based on the source and destination IPv6 addresses, which uniquely
-- identify a single pseudowire within one of the VPLS instances.
--
-- An instance of apps.bridge.learning or apps.bridge.flooding is
-- created for every VPLS, depending on the selected bridge type. The
-- bridge connects all pseudowires and attachment circuits of the
-- VPLS. The pseudowires are assigned to a split horizon group,
-- i.e. packets arriving on any of those links are only forwarded to
-- the attachment circuits and not to any of the other pseudowires
-- (this is a consequence of the full-mesh topology of the pseudowires
-- of a VPLS). All attachment circuits defined for a VPLS must
-- reference a L2 interface or sub-interface. In non-trunking mode,
-- the interface driver is connected directly to the bridge module.
-- In trunking mode, the corresponding "vlan" links of the VlanMux app
-- are connected to the bridge instead.
--
-- Every pseudowire can have its own tunnel configuration or it can
-- inherit a default configuration for the entire VPLS instance.
--
-- Finally, all pseudowires of the VPLS instance are connected to the
-- dispatcher on the "ac" side.
--
-- If a VPLS consists of a single PW and a single AC, the resulting
-- two-port bridge is optimized away by creating a direct link between
-- the two. The VPLS thus turns into a VPWS.
-- config = {
-- [ shmem_dir = <shmem_dir> , ]
-- [ snmp = { enable = true | false,
-- interval = <interval> }, ]
-- interfaces = {
-- {
-- name = <name>,
-- [ description = <description>, ]
-- driver = {
-- path = <path>,
-- name = <name>,
-- config = {
-- pciaddr = <pciaddress>,
-- },
-- [ extra_config = <extra_config>, ]
-- },
-- [ mirror = {
-- [ rx = true | false | <rx_name>, ]
-- [ tx = true | false | <tx_name>, ]
-- [ type = 'tap' | 'pcap', ]
-- }, ]
-- mtu = <mtu>,
-- [ -- only allowed if trunk.enable == false
-- afs = {
-- ipv6 = {
-- address = <address>,
-- next_hop = <next_hop>,
-- [ next_hop_mac = <neighbor_mac> ]
-- }
-- }, ]
-- [ trunk = {
-- enable = true | false,
-- encapsulation = "dot1q" | "dot1ad" | <number>,
-- vlans = {
-- {
-- [ description = <description>, ]
-- vid = <vid>,
-- [ afs = {
-- ipv6 = {
-- address = <address>,
-- next_hop = <next_hop>,
-- [ next_hop_mac = <next_hop_mac> ]
-- }
-- } ]
-- },
-- ...
-- }
-- } ]
-- }
-- },
-- vpls = {
-- <vpls1> = {
-- [ description = <description> ,]
-- vc_id = <vc_id>,
-- mtu = <mtu>,
-- address = <ipv6-address>,
-- uplink = <int>,
-- bridge = {
-- type = "flooding"|"learning",
-- [ config = <bridge-config> ]
-- },
-- [ tunnel = <tunnel-config>, ]
-- [ cc = <cc-config>, ]
-- ac = {
-- <ac1> = <int>
-- <ac2> = ...
-- },
-- pw = {
-- <pw1> = {
-- address = <ipv6-address>,
-- [ tunnel = <tunnel-config> ],
-- [ cc = <cc-config> ]
-- },
-- <pw2> = ...
-- },
-- },
-- <vpls2> = ...
-- }
-- }
module(...,package.seeall)
local ffi = require("ffi")
local C = ffi.C
local usage_msg = require("program.l2vpn.README_inc")
local lib = require("core.lib")
local counter = require("core.counter")
local macaddress = require("lib.macaddress")
local shm = require("core.shm")
local const = require("syscall.linux.constants")
local S = require("syscall")
local app_graph = require("core.config")
local leader = require("apps.config.leader").Leader
local ipv6 = require("lib.protocol.ipv6")
local dipatch = require("program.l2vpn.dispatch").dispatch
local Tap = require("apps.tap.tap").Tap
local Tee = require("apps.basic.basic_apps").Tee
local PcapWriter = require("apps.pcap.pcap").PcapWriter
local Sink = require("apps.basic.basic_apps").Sink
local VlanMux = require("apps.vlan.vlan").VlanMux
local nd_light = require("apps.ipv6.nd_light").nd_light
local dispatch = require("program.l2vpn.dispatch").dispatch
local pseudowire = require("program.l2vpn.pseudowire").pseudowire
local ifmib = require("lib.ipc.shmem.iftable_mib")
local bridge_types = { flooding = true, learning = true }
function usage ()
print(usage_msg)
main.exit(0)
end
local state
local function clear_state ()
state = {
apps = {},
links = {},
intfs = {},
nds = {},
}
end
local App = {}
function App:new (name, class, initial_arg)
-- assert(not state.apps[name], "Duplicate app "..name)
local self = setmetatable({}, { __index = App })
state.apps[name] = self
self._name = name
self._class = class
self:arg(initial_arg)
return self
end
function App:name ()
return self._name
end
function App:class ()
return self._class
end
function App:arg (arg)
if arg == nil then return self._arg end
self._arg = arg
end
function App:connector (input, output)
assert(input)
local output = output or input
return {
input = function ()
return self:name()..'.'..input
end,
output = function ()
return self:name()..'.'..output
end
}
end
local function connect (from, to)
table.insert(state.links, from.output()..' -> '..to.input())
end
local function connect_duplex (from, to)
connect(from, to)
connect(to, from)
end
local function normalize_name (name)
return string.gsub(name, '[/%.]', '_')
end
-- Helper functions to abstract from driver-specific behaviour. The
-- key into this table is the full path to the module used to create
-- the driver object. For each driver, the following functions must be
-- defined
-- link_names ()
-- Return the name of the links used for input and ouput
-- stats_path (driver)
-- This function is called after the driver has been created
-- and receives the driver object as input. It returns the
-- path to the shm frame where the driver stores its stats counters.
local driver_helpers = {
['apps.intel_mp.intel_mp.Intel'] = {
link_names = function ()
return 'input', 'output'
end,
stats_path = function (intf)
return 'pci/'..intf.pci_address
end
},
['apps.tap.tap.Tap'] = {
link_names = function ()
return 'input', 'output'
end,
stats_path = function (intf)
return 'apps/'..intf.app:name()
end
},
}
function parse_intf(config)
assert(config.name, "Missing interface name")
print("Setting up interface "..config.name)
print(" Description: "..(config.description or "<none>"))
local intf = {
description = config.description,
name = config.name,
-- The normalized name is used in app and link names
nname = normalize_name(config.name),
}
-- NIC driver
assert(config.driver, "Missing driver configuration")
local drv_c = config.driver
assert(drv_c.path and drv_c.name and
drv_c.config, "Incomplete driver configuration")
if type(drv_c.config) == "table" then
if (drv_c.config.pciaddr) then
print(" PCI address: "..drv_c.config.pciaddr)
intf.pci_address = drv_c.config.pciaddr
end
drv_c.config.mtu = config.mtu
if drv_c.extra_config then
-- If present, extra_config must be a table, whose elements
-- are merged with the regular config. This feature allows
-- for more flexibility when the configuration is created by
-- a Lua-agnostic layer on top, e.g. by a NixOS module
assert(type(drv_c.extra_config) == "table",
"Driver extra configuration must be a table")
for k, v in pairs(drv_c.extra_config) do
drv_c.config[k] = v
end
end
end
intf.app = App:new('intf_'..intf.nname,
require(drv_c.path)[drv_c.name], drv_c.config)
local driver_helper = driver_helpers[drv_c.path.."."..drv_c.name]
assert(driver_helper,
"Unsupported driver (missing driver helper)"
..drv_c.path.."."..drv_c.name)
intf.driver_helper = driver_helper
intf.connector = intf.app:connector(driver_helper.link_names())
-- L2 configuration
print(" L2 configuration")
assert(config.mtu, "Missing MTU")
print(" MTU: "..config.mtu)
intf.mtu = config.mtu
-- Port mirror configuration
if config.mirror then
local mirror = config.mirror
local mtype = mirror.type or 'tap'
assert(type(mtype) == "string", "Mirror type must be a string")
for _, dir in ipairs({ 'rx', 'tx' }) do
local mirror_connector
if mirror[dir] then
if mtype == "pcap" then
local file
if type(mirror[dir]) == "string" then
file = mirror[dir]
else
file = '/tmp/'..string.gsub(config.name, "/", "-")
.."_"..dir..".pcap"
end
local mirror = App:new('tap_'..intf.nname..'_pcap_'..dir,
PcapWriter, file)
mirror_connector = mirror:connector('input')
print(" "..dir.." port-mirror on pcap file "..file)
elseif mtype == "tap" then
local tap_name
if type(mirror[dir]) == "string" then
tap_name = mirror[dir]
else
tap_name = string.gsub(config.name, "/", "-")
tap_name = string.sub(tap_name, 0, const.IFNAMSIZ-3).."_"..dir
end
local mirror = App:new('tap_'..intf.nname..'_'..dir,
Tap, { name = tap_name, mtu = config.mtu})
mirror_connector = mirror:connector('input', 'output')
local sink = App:new('sink_'..intf.nname..'_tap_'..dir,
Sink)
connect(mirror_connector, sink:connector('input'))
print(" "..dir.." port-mirror on tap interface "..tap_name)
else
error("Illegal mirror type: "..mtype)
end
local tee = App:new('tee_'..intf.nname..'_'..dir, Tee)
connect(tee:connector('mirror'), mirror_connector)
if dir == "rx" then
connect(intf.connector, tee:connector('input'))
intf.connector.output = tee:connector('pass').output
else
connect(tee:connector('pass'), intf.connector)
intf.connector.input = tee:connector('input').input
end
end
end
end
local afs_procs = {
ipv6 = function (config, vid, connector, indent)
assert(config.address, "Missing address")
assert(config.next_hop, "Missing next-hop")
-- FIXME: check fo uniqueness of subnet
print(indent.." Address: "..config.address.."/64")
print(indent.." Next-Hop: "..config.next_hop)
if config.next_hop_mac then
print(indent.." Next-Hop MAC address: "
..config.next_hop_mac)
end
local nd = App:new('nd_'..intf.nname..((vid and "_"..vid) or ''),
nd_light,
{ local_ip = config.address,
local_mac = "00:00:00:00:00:00",
remote_mac = config.next_hop_mac,
next_hop = config.next_hop,
quiet = true })
state.nds[nd:name()] = { app = nd, intf = intf }
connect_duplex(nd:connector('south'), connector)
return nd:connector('north')
end
}
local function process_afs (afs, vid, connector, indent)
print(indent.." Address family configuration")
local config = afs.ipv6
assert(config, "IPv6 configuration missing")
print(indent.." IPv6")
return afs_procs.ipv6(config, vid, connector, indent.." ")
end
local trunk = config.trunk or { enable = false }
assert(type(trunk) == "table", "Trunk configuration must be a table")
if trunk.enable then
-- The interface is configured as a VLAN trunk. Attach an
-- instance of the VLAN multiplexer.
print(" Trunking mode: enabled")
intf.subintfs = {}
assert(not config.afs,
"Address family configuration not allowed in trunking mode")
local encap = trunk.encapsulation or "dot1q"
assert(encap == "dot1q" or encap == "dot1ad" or
(type(encap) == "number"),
"Illegal encapsulation mode "..encap)
print(" Encapsulation "..
(type(encap) == "string" and encap
or string.format("ether-type 0x%04x", encap)))
local vmux = App:new('vmux_'..intf.nname, VlanMux,
{ encapsulation = encap })
connect_duplex(vmux:connector('trunk'), intf.connector)
-- Process VLANs and create sub-interfaces
assert(trunk.vlans, "Missing VLAN configuration on trunk port")
print(" Sub-Interfaces")
for n, vlan in ipairs(trunk.vlans) do
local vid = vlan.vid
assert(vid, "Missing VLAN ID for sub-interface #"..n)
assert(type(vid) == "number" and vid >= 0 and vid < 4095,
"Invalid VLAN ID "..vid.." for sub-interface #"..n)
local name = config.name..'.'..vid
assert(not intf.subintfs[name], "Duplicate VID: "..vid)
local subintf = {
name = name,
-- The normalized name is used in app and link names
nname = normalize_name(name),
description = vlan.description,
vlan = true,
phys_intf = intf,
-- The effective MTU of the VLAN port
mtu = intf.mtu-4,
}
intf.subintfs[name] = subintf
print(" "..config.name.."."..vid)
print(" Description: "..(vlan.description or '<none>'))
print(" L2 configuration")
print(" VLAN ID: "..(vid > 0 and vid or "<untagged>"))
local connector = vmux:connector((vid == 0 and 'native') or 'vlan'..vid)
if vlan.afs then
subintf.connector = process_afs(vlan.afs, vid, connector
, " ")
subintf.l3 = true
else
subintf.connector = connector
subintf.l3 = false
end
-- Store a copy of the vmux connector to find the proper shm
-- frame for the interface counters later on
subintf.vmux_connector = connector
end
else
print(" Trunking mode: disabled")
if config.afs then
intf.connector = process_afs(config.afs, nil, intf.connector, "")
intf.l3 = true
else
intf.l3 = false
end
end
return intf
end
function parse_config (main_config)
local intfs_config = main_config.interfaces
assert(intfs_config, "Missing interfaces configuration")
local intfs = state.intfs
for _, config in ipairs(intfs_config) do
local intf = parse_intf(config)
assert(not intfs[intf.name], "Duplicate interface name: "..intf.name)
intfs[intf.name] = intf
for name, subintf in pairs(intf.subintfs or {}) do
intfs[name] = subintf
end
end
local vpls_config = main_config.vpls
assert(vpls_config, "Missing VPLS configuration")
local dispatchers = {}
local bridge_groups = {}
for vpls_name, vpls in pairs(vpls_config) do
local function assert_vpls (cond, msg)
assert(cond, "VPLS "..vpls_name..": "..msg)
end
print("Creating VPLS instance "..vpls_name
.." ("..(vpls.description or "<no description>")..")")
assert_vpls(vpls.vc_id, "Missing VC ID")
print(" VC ID: "..vpls.vc_id)
assert_vpls(vpls.mtu, "Missing MTU")
print(" MTU: "..vpls.mtu)
assert_vpls(vpls.address, "Mssing address")
print(" Address: "..vpls.address)
assert_vpls(vpls.ac, "Missing ac configuration")
assert_vpls(vpls.pw, "Missing pseudowire configuration")
local uplink = vpls.uplink
assert_vpls(uplink, "missing uplink")
assert(type(uplink) == "string",
"Uplink interface specifier must be a string")
local intf = intfs[uplink]
assert_vpls(intf, "Uplink interface "..uplink.." does not exist")
assert_vpls(intf.l3, "Uplink interface "..uplink
.." is L2 when L3 is expected")
print(" Uplink is on "..uplink)
intf.used = true
local tunnel = vpls.tunnel
local cc = vpls.cc
local dispatcher = dispatchers[uplink]
if not dispatcher then
dispatcher = App:new('disp_'..normalize_name(uplink),
dispatch, {})
dispatchers[uplink] = dispatcher
local south = dispatcher:connector('south')
connect(intf.connector, south)
connect(south, intf.connector)
end
local bridge_group = {
config = vpls.bridge or { type = 'flooding' },
pws = {},
acs = {}
}
assert(bridge_types[bridge_group.config.type],
"Invalid bridge type: "..bridge_group.config.type)
bridge_groups[vpls_name] = bridge_group
print(" Creating pseudowires")
for name, pw in pairs(vpls.pw) do
print(" "..name)
assert(tunnel or pw.tunnel,
"Missing tunnel configuration for pseudowire"
.." and no default specified")
assert(pw.address, "Missing remote address configuration")
print(" Address: "..pw.address)
local link_name = vpls_name..'_'..name
dispatcher:arg()[link_name] = { source = ipv6:pton(pw.address),
destination = ipv6:pton(vpls.address) }
local app = App:new('pw_'..vpls_name..'_'..name,
pseudowire,
{ name = vpls_name..'_'..name,
vc_id = vpls.vc_id,
mtu = vpls.mtu,
shmem_dir = main_config.shmem_dir,
description = vpls.description,
transport = { type = 'ipv6',
src = vpls.address,
dst = pw.address },
tunnel = pw.tunnel or tunnel,
cc = pw.cc or cc or nil })
connect_duplex(dispatcher:connector(link_name), app:connector('uplink'))
table.insert(bridge_group.pws, app)
end
print(" Creating attachment circuits")
for name, ac in pairs(vpls.ac) do
print(" "..name)
assert(type(ac) == "string",
"AC interface specifier must be a string")
print(" AC is on "..ac)
local intf = intfs[ac]
assert_vpls(intf, "AC interface "..ac.." does not exist")
assert_vpls(not intf.l3, "AC interface "..ac
.." is L3 when L2 is expected")
table.insert(bridge_group.acs, intf)
intf.used = true
-- Note: if the AC is the native VLAN on a trunk, the actual packets
-- can carry frames which exceed the nominal MTU by 4 bytes.
assert(vpls.mtu == intf.mtu, "MTU mismatch between "
.."VPLS ("..vpls.mtu..") and interface "
..ac.." ("..intf.mtu..")")
end
end
for vpls_name, bridge_group in pairs(bridge_groups) do
if #bridge_group.pws == 1 and #bridge_group.acs == 1 then
-- No bridge needed for a p2p VPN
local pw, ac = bridge_group.pws[1], bridge_group.acs[1]
local pw_connector = pw:connector('ac')
connect_duplex(pw:connector('ac'), ac.connector)
-- For a p2p VPN, pass the name of the AC
-- interface so the PW module can set up the
-- proper service-specific MIB
pw:arg().interface = bridge_group.acs[1].name
else
local bridge =
App:new('bridge_'..vpls_name,
require("apps.bridge."..bridge_group.config.type).bridge,
{ ports = {},
split_horizon_groups = { pw = {} },
config = bridge_group.config.config })
for _, pw in ipairs(bridge_group.pws) do
connect_duplex(pw:connector('ac'),
bridge:connector(pw:name()))
table.insert(bridge:arg().split_horizon_groups.pw, pw:name())
end
for _, ac in ipairs(bridge_group.acs) do
local ac_name = normalize_name(ac.name)
connect_duplex(ac.connector,
bridge:connector(ac_name))
table.insert(bridge:arg().ports, ac_name)
end
end
end
-- Create sinks for interfaces not used as uplink or AC
for name, intf in pairs(intfs) do
if not intf.used and not intf.subintfs then
local sink = App:new('sink_'..intf.nname,
Sink, {})
connect_duplex(intf.connector, sink:connector('input'))
end
end
end
local function setup_shm_and_snmp (main_config)
-- For each interface, attach to the shm frame that stores
-- the statistics counters
for _, intf in pairs(state.intfs) do
if not intf.vlan then
local stats_path = intf.driver_helper.stats_path(intf)
intf.stats = shm.open_frame(stats_path)
end
end
-- Commit all counters to the backing store to make them available
-- immediately through the read-only frames we just created
counter.commit()
local snmp = main_config.snmp or { enable = false }
if snmp.enable then
for name, intf in pairs(state.intfs) do
if not intf.vlan then
-- Set up SNMP for physical interfaces
local stats = intf.stats
if stats then
ifmib.init_snmp( { ifDescr = name,
ifName = name,
ifAlias = intf.description, },
string.gsub(name, '/', '-'), stats,
main_config.shmem_dir, snmp.interval or 5)
else
print("Can't enable SNMP for interface "..name
..": no statistics counters available")
end
else
-- Set up SNMP for sub-interfaces
counter_t = ffi.typeof("struct counter")
local counters = {}
local function map (c)
return (c and ffi.cast("struct counter *", c)) or nil
end
counters.type = counter_t()
if intf.l3 then
counters.type.c = 0x1003ULL -- l3ipvlan
else
counters.type.c = 0x1002ULL -- l2vlan
end
-- Inherit the operational status, MAC address, MTU, speed
-- from the physical interface
local stats = intf.phys_intf.stats
counters.status = map(stats.status)
counters.macaddr = map(stats.macaddr)
counters.mtu = map(stats.mtu)
counters.speed = map(stats.speed)
-- Create mappings to the counters of the relevant VMUX
-- link The VMUX app replaces the physical network for a
-- sub-interface. Hence, its output is what the
-- sub-interface receives and its input is what the
-- sub-interface transmits to the "virtual wire".
local function find_linkspec (pattern)
pattern = string.gsub(pattern, '%.', '%%.')
for _, linkspec in ipairs(state.links) do
if string.match(linkspec, pattern) then
return linkspec
end
end
error("No links match pattern: "..pattern)
end
local tstats = shm.open_frame(
find_linkspec('^'..intf.vmux_connector.output()))
local rstats = shm.open_frame(
find_linkspec(intf.vmux_connector.input()..'$'))
counters.rxpackets = map(tstats.txpackets)
counters.rxbytes = map(tstats.txbytes)
counters.rxdrop = map(tstats.txdrop)
counters.txpackets = map(rstats.rxpackets)
counters.txbytes = map(rstats.rxbytes)
ifmib.init_snmp( { ifDescr = name,
ifName = name,
ifAlias = intf.description, },
string.gsub(name, '/', '-'), counters,
main_config.shmem_dir, snmp.interval or 5)
end
end
end
end
local function create_app_graph ()
local graph = app_graph.new()
for name, app in pairs(state.apps) do
app_graph.app(graph, app:name(), app:class(), app:arg())
end
for _, linkspec in ipairs(state.links) do
app_graph.link(graph, linkspec)
end
return graph
end
local long_opts = {
duration = "D",
reconfig = "r",
logfile = "l",
debug = "d",
jit = "j",
help = "h",
}
function run (parameters)
local duration = 0
local reconfig = false
local jit_conf = {}
local jit_opts = {}
local opt = {}
function opt.D (arg)
if arg:match("^[0-9]+$") then
duration = tonumber(arg)
else
usage()
end
end
function opt.l (arg)
local logfh = assert(io.open(arg, "a"))
lib.logger_default.fh = logfh
end
function opt.h (arg) usage() end
function opt.d (arg) _G.developer_debug = true end
function opt.j (arg)
if arg:match("^v") then
local file = arg:match("^v=(.*)")
if file == '' then file = nil end
require("jit.v").start(file)
elseif arg:match("^p") then
jit_conf.p = {}
local p = jit_conf.p
p.opts, p.file = arg:match("^p=([^,]*),?(.*)")
if p.file == '' then p.file = nil end
elseif arg:match("^dump") then
jit_conf.dump = {}
local dump = jit_conf.dump
dump.opts, dump.file = arg:match("^dump=([^,]*),?(.*)")
if dump.file == '' then dump.file = nil end
elseif arg:match("^opt") then
local opt = arg:match("^opt=(.*)")
table.insert(jit_opts, opt)
end
end
function opt.r (arg) reconfig = true end
-- Parse command line arguments
parameters = lib.dogetopt(parameters, opt, "hdj:D:l:r", long_opts)
if (reconfig and not (duration > 0)) then
print("--reconfig requires --duration > 0 to take effect")
usage()
end
-- Defaults: sizemcode=32, maxmcode=512
require("jit.opt").start('sizemcode=256', 'maxmcode=2048')
if #jit_opts then
require("jit.opt").start(unpack(jit_opts))
end
if #parameters ~= 1 then usage () end
local file = table.remove(parameters, 1)
local engine_opts = { no_report = true }
if duration ~= 0 then engine_opts.duration = duration end
if jit_conf.p then
require("jit.p").start(jit_conf.p.opts, jit_conf.p.file)
end
if jit_conf.dump then
require("jit.dump").start(jit_conf.dump.opts, jit_conf.dump.file)
end
local mtime = 0
local loop = true
while loop do
local stat, err = S.stat(file)
if not stat then
error("Can't stat "..file..": "..tostring(err))
end
if mtime ~= stat.mtime then
-- This is a very crude and disruptive way to pick up changes
-- of the configuration while the system is running. It
-- requires setting -D to a reasonable non-zero value. By
-- default, the configuration is instantiated only once and
-- engine.main() runs indefinitely. The proper way to do
-- this is to write a YANG schema and use core.config.
print("Instantiating configuration")
clear_state()
local main_config = assert(loadfile(file))()
parse_config(main_config)
engine.configure(create_app_graph())
setup_shm_and_snmp(main_config)
-- Reconfigure ND apps with proper MAC addresses from the
-- interfaces to which they are attached
for name, nd in pairs(state.nds) do
nd.app:arg().local_mac =
macaddress:new(counter.read(nd.intf.stats.macaddr)).bytes
end
engine.configure(create_app_graph())
jit.flush()
end
mtime = stat.mtime
engine.main(engine_opts)
loop = reconfig
end
if jit_conf.p then
require("jit.p").stop()
end
end
| apache-2.0 |
UnfortunateFruit/darkstar | scripts/zones/Quicksand_Caves/npcs/qm4.lua | 34 | 1190 | -----------------------------------
-- Area: Quicksand Caves
-- NPC: ??? (qm4)
-- Involved in Mission: Bastok 8.1 "The Chains That Bind Us"
-- @pos
-----------------------------------
package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Quicksand_Caves/TextIDs");
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local missionStatus = player:getVar("MissionStatus");
if (player:getCurrentMission(player:getNation()) == THE_CHAINS_THAT_BIND_US) and (missionStatus == 2) then
player:startEvent(0x0A)
else
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);
end
end;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--print("CSID:",csid);
--print("RESULT:",option);
if (csid == 0x0A) then
player:setVar("MissionStatus", 3);
end
end;
| gpl-3.0 |
FailcoderAddons/supervillain-ui | SVUI_!Core/system/letsride.lua | 1 | 16246 | --[[
##########################################################
S V U I By: Failcoder
##########################################################
LOCALIZED LUA FUNCTIONS
##########################################################
]]--
--[[ GLOBALS ]]--
local _G = _G;
local unpack = _G.unpack;
local select = _G.select;
local pairs = _G.pairs;
local type = _G.type;
local tonumber = _G.tonumber;
local table = _G.table;
local math = _G.math;
local bit = _G.bit;
local random = math.random;
local twipe,band = table.wipe, bit.band;
--BLIZZARD API
local CreateFrame = _G.CreateFrame;
local InCombatLockdown = _G.InCombatLockdown;
local GameTooltip = _G.GameTooltip;
local LoadAddOn = _G.LoadAddOn;
local hooksecurefunc = _G.hooksecurefunc;
local IsAltKeyDown = _G.IsAltKeyDown;
local IsShiftKeyDown = _G.IsShiftKeyDown;
local IsControlKeyDown = _G.IsControlKeyDown;
local IsModifiedClick = _G.IsModifiedClick;
local PlaySound = _G.PlaySound;
local PlaySoundFile = _G.PlaySoundFile;
local PlayMusic = _G.PlayMusic;
local StopMusic = _G.StopMusic;
local UnitName = _G.UnitName;
local ToggleFrame = _G.ToggleFrame;
local ERR_NOT_IN_COMBAT = _G.ERR_NOT_IN_COMBAT;
local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS;
local CUSTOM_CLASS_COLORS = _G.CUSTOM_CLASS_COLORS;
local C_MountJournal = _G.C_MountJournal;
--[[
##########################################################
GET ADDON DATA
##########################################################
]]--
local SV = select(2, ...);
--[[
##########################################################
LOCAL VARIABLES
##########################################################
]]--
local TOOLTIP_SUMMARY = "";
local MountListener = CreateFrame("Frame");
MountListener.favorites = false
--[[
##########################################################
LOCAL FUNCTIONS
##########################################################
]]--
local function CacheMounts()
return C_MountJournal.GetMountIDs()
end
local function RandomMount()
if(MountListener.favorites) then
return 0
end
local maxMounts = C_MountJournal.GetNumMounts()
return random(1, maxMounts)
end
local function MountInfo(index)
index = index or RandomMount()
return C_MountJournal.GetDisplayedMountInfo(index)
end
local function CheckFallbackDruidShaman()
local _,class,_ = UnitClass('player')
if (not IsMounted() and (class == "DRUID" or class == "SHAMAN")) then
-- If we fail to mount, but we're a druid or shaman, we have a backup plan...
-- JV: Working on this... TBC
end
end
local function MountUp(index)
local _, _, _, _, _, _, _, _, _, _, _, id = MountInfo(index);
if id then
C_MountJournal.SummonByID(id)
CheckFallbackDruidShaman()
end
end
local UnMount = C_MountJournal.Dismiss
local function UpdateMountCheckboxes(button, index)
local creatureName = MountInfo(index);
local n = button.MountBar
local bar = _G[n]
if(bar) then
bar["GROUND"].index = index
bar["GROUND"].name = creatureName
bar["FLYING"].index = index
bar["FLYING"].name = creatureName
bar["SWIMMING"].index = index
bar["SWIMMING"].name = creatureName
bar["SPECIAL"].index = index
bar["SPECIAL"].name = creatureName
if(SV.private.Mounts.names["GROUND"] == creatureName) then
if(SV.private.Mounts.types["GROUND"] ~= index) then
SV.private.Mounts.types["GROUND"] = index
end
bar["GROUND"]:SetChecked(true)
else
bar["GROUND"]:SetChecked(false)
end
if(SV.private.Mounts.names["FLYING"] == creatureName) then
if(SV.private.Mounts.types["FLYING"] ~= index) then
SV.private.Mounts.types["FLYING"] = index
end
bar["FLYING"]:SetChecked(true)
else
bar["FLYING"]:SetChecked(false)
end
if(SV.private.Mounts.names["SWIMMING"] == creatureName) then
if(SV.private.Mounts.types["SWIMMING"] ~= index) then
SV.private.Mounts.types["SWIMMING"] = index
end
bar["SWIMMING"]:SetChecked(true)
else
bar["SWIMMING"]:SetChecked(false)
end
if(SV.private.Mounts.names["SPECIAL"] == creatureName) then
if(SV.private.Mounts.types["SPECIAL"] ~= index) then
SV.private.Mounts.types["SPECIAL"] = index
end
bar["SPECIAL"]:SetChecked(true)
else
bar["SPECIAL"]:SetChecked(false)
end
end
end
local function UpdateMountsCache()
if(not MountJournal) then return end
local myMounts = CacheMounts();
MountListener.favorites = false
for index, id in pairs(myMounts) do
--creatureName, spellID, icon, active, isUsable, sourceType, isFavorite, isFactionSpecific, faction, hideOnChar, isCollected, mountID
local info, spellId, _, _, _, _, favorite, _, _, _, _, mId = MountInfo(index);
if(favorite == true) then
MountListener.favorites = true
end
if(SV.private.Mounts.names["GROUND"] == info) then
if(SV.private.Mounts.types["GROUND"] ~= index) then
SV.private.Mounts.types["GROUND"] = index
end
end
if(SV.private.Mounts.names["FLYING"] == info) then
if(SV.private.Mounts.types["FLYING"] ~= index) then
SV.private.Mounts.types["FLYING"] = index
end
end
if(SV.private.Mounts.names["SWIMMING"] == info) then
if(SV.private.Mounts.types["SWIMMING"] ~= index) then
SV.private.Mounts.types["SWIMMING"] = index
end
end
if(SV.private.Mounts.names["SPECIAL"] == info) then
if(SV.private.Mounts.types["SPECIAL"] ~= index) then
SV.private.Mounts.types["SPECIAL"] = index
end
end
end
end
local function Update_MountCheckButtons()
if(not MountJournal) then return end
local count = C_MountJournal.GetNumMounts();
local scrollFrame = MountJournal.ListScrollFrame;
local offset = HybridScrollFrame_GetOffset(scrollFrame);
local buttons = scrollFrame.buttons;
for i=1, #buttons do
local button = buttons[i];
local displayIndex = i + offset;
if ( displayIndex <= count ) then
UpdateMountCheckboxes(button, displayIndex)
end
end
end
local ProxyUpdate_Mounts = function(self, event, ...)
if(event == "COMPANION_LEARNED" or event == "COMPANION_UNLEARNED") then
UpdateMountsCache()
end
Update_MountCheckButtons()
end
local function UpdateCurrentMountSelection()
TOOLTIP_SUMMARY = ""
local creatureName
if(SV.private.Mounts.types["FLYING"]) then
creatureName = SV.private.Mounts.names["FLYING"]
if(creatureName) then
TOOLTIP_SUMMARY = TOOLTIP_SUMMARY .. "\nFlying: " .. creatureName
end
end
if(SV.private.Mounts.types["SWIMMING"]) then
creatureName = SV.private.Mounts.names["SWIMMING"]
if(creatureName) then
TOOLTIP_SUMMARY = TOOLTIP_SUMMARY .. "\nSwimming: " .. creatureName
end
end
if(SV.private.Mounts.types["GROUND"]) then
creatureName = SV.private.Mounts.names["GROUND"]
if(creatureName) then
TOOLTIP_SUMMARY = TOOLTIP_SUMMARY .. "\nGround: " .. creatureName
end
end
if(SV.private.Mounts.types["SPECIAL"]) then
creatureName = SV.private.Mounts.names["SPECIAL"]
if(creatureName) then
TOOLTIP_SUMMARY = TOOLTIP_SUMMARY .. "\nSpecial: " .. creatureName
end
end
end
local CheckButton_OnClick = function(self)
local index = self.index
local name = self.name
local key = self.key
if(index) then
if(self:GetChecked() == true) then
SV.private.Mounts.types[key] = index
SV.private.Mounts.names[key] = name
else
SV.private.Mounts.types[key] = false
SV.private.Mounts.names[key] = ""
end
Update_MountCheckButtons()
UpdateCurrentMountSelection()
end
GameTooltip:Hide()
end
local CheckButton_OnEnter = function(self)
local index = self.name
local key = self.key
local r,g,b = self:GetBackdropColor()
GameTooltip:SetOwner(self, 'ANCHOR_TOPLEFT', 0, 20)
GameTooltip:ClearLines()
GameTooltip:AddLine(key,r,g,b)
GameTooltip:AddLine("",1,1,0)
GameTooltip:AddLine("Check this box to enable/disable \nthis mount for \nthe 'Lets Ride' key-binding",1,1,1)
if(key == "SPECIAL") then
GameTooltip:AddLine("",1,1,0)
GameTooltip:AddLine("Hold |cff00FF00[SHIFT]|r or |cff00FF00[CTRL]|r while \nclicking to force this mount \nover all others.",1,1,1)
end
GameTooltip:AddLine(TOOLTIP_SUMMARY,1,1,1)
GameTooltip:Show()
end
local CheckButton_OnLeave = function(self)
GameTooltip:Hide()
end
local _hook_SetChecked = function(self, checked)
local r,g,b = 0,0,0
if(checked) then
r,g,b = self:GetCheckedTexture():GetVertexColor()
end
self:SetBackdropBorderColor(r,g,b)
end
local function CreateMountCheckBox(name, parent)
local frame = CreateFrame("CheckButton", name, parent, "UICheckButtonTemplate")
frame:RemoveTextures()
frame:SetBackdrop({
bgFile = SV.media.statusbar.gloss,
edgeFile = [[Interface\BUTTONS\WHITE8X8]],
tile = false,
tileSize = 0,
edgeSize = 1,
insets =
{
left = 0,
right = 0,
top = 0,
bottom = 0,
},
});
if(frame.Left) then frame.Left:SetAlpha(0) end
if(frame.Middle) then frame.Middle:SetAlpha(0) end
if(frame.Right) then frame.Right:SetAlpha(0) end
if(frame.SetNormalTexture) then frame:SetNormalTexture("") end
if(frame.SetDisabledTexture) then frame:SetDisabledTexture("") end
if(frame.SetCheckedTexture) then frame:SetCheckedTexture("") end
if(frame.SetHighlightTexture) then
if(not frame.hover) then
local hover = frame:CreateTexture(nil, "HIGHLIGHT")
hover:InsetPoints(frame.Panel)
frame.hover = hover;
end
frame.hover:SetColorTexture(0.1, 0.8, 0.8, 0.5)
frame:SetHighlightTexture(frame.hover)
end
if(frame.SetPushedTexture) then
if(not frame.pushed) then
local pushed = frame:CreateTexture(nil, "OVERLAY")
pushed:InsetPoints(frame.Panel)
frame.pushed = pushed;
end
frame.pushed:SetColorTexture(0.1, 0.8, 0.1, 0.3)
frame:SetPushedTexture(frame.pushed)
end
if(frame.SetCheckedTexture) then
if(not frame.checked) then
local checked = frame:CreateTexture(nil, "OVERLAY")
checked:InsetPoints(frame.Panel)
frame.checked = checked
end
frame.checked:SetTexture(SV.media.statusbar.gloss)
frame.checked:SetVertexColor(0, 1, 0, 1)
frame:SetCheckedTexture(frame.checked)
end
hooksecurefunc(frame, "SetChecked", _hook_SetChecked)
return frame
end;
--[[
##########################################################
LOAD BY TRIGGER
##########################################################
]]--
local function InitializeLetsRide()
if(SV.GameVersion > 60000) then
LoadAddOn("Blizzard_Collections")
else
LoadAddOn("Blizzard_PetJournal")
end
SV.private.Mounts = SV.private.Mounts or {}
if not SV.private.Mounts.types then
SV.private.Mounts.types = {
["GROUND"] = false,
["FLYING"] = false,
["SWIMMING"] = false,
["SPECIAL"] = false
}
end
if not SV.private.Mounts.names then
SV.private.Mounts.names = {
["GROUND"] = "",
["FLYING"] = "",
["SWIMMING"] = "",
["SPECIAL"] = ""
}
end
UpdateMountsCache()
local scrollFrame = MountJournal.ListScrollFrame;
local scrollBar = _G["MountJournalListScrollFrameScrollBar"]
local buttons = scrollFrame.buttons;
for i = 1, #buttons do
local button = buttons[i]
local barWidth = button:GetWidth()
local width = (barWidth - 18) * 0.25
local height = 7
local barName = ("SVUI_MountSelectBar%d"):format(i)
local buttonBar = CreateFrame("Frame", barName, button)
buttonBar:SetPoint("BOTTOMLEFT", button, "BOTTOMLEFT", 0, 0)
buttonBar:SetSize(barWidth, height + 8)
--[[ CREATE CHECKBOXES ]]--
buttonBar["GROUND"] = CreateMountCheckBox(("%s_GROUND"):format(barName), buttonBar)
buttonBar["GROUND"]:SetSize(width,height)
buttonBar["GROUND"]:SetPoint("BOTTOMLEFT", buttonBar, "BOTTOMLEFT", 6, 4)
buttonBar["GROUND"]:SetBackdropColor(0.2, 0.7, 0.1, 0.25)
buttonBar["GROUND"]:SetBackdropBorderColor(0, 0, 0, 1)
buttonBar["GROUND"]:GetCheckedTexture():SetVertexColor(0.2, 0.7, 0.1, 1)
buttonBar["GROUND"].key = "GROUND"
buttonBar["GROUND"]:SetChecked(false)
buttonBar["GROUND"]:SetScript("OnClick", CheckButton_OnClick)
buttonBar["GROUND"]:SetScript("OnEnter", CheckButton_OnEnter)
buttonBar["GROUND"]:SetScript("OnLeave", CheckButton_OnLeave)
buttonBar["FLYING"] = CreateMountCheckBox(("%s_FLYING"):format(barName), buttonBar)
buttonBar["FLYING"]:SetSize(width,height)
buttonBar["FLYING"]:SetPoint("BOTTOMLEFT", buttonBar["GROUND"], "BOTTOMRIGHT", 2, 0)
buttonBar["FLYING"]:SetBackdropColor(1, 1, 0.2, 0.25)
buttonBar["FLYING"]:SetBackdropBorderColor(0, 0, 0, 1)
buttonBar["FLYING"]:GetCheckedTexture():SetVertexColor(1, 1, 0.2, 1)
buttonBar["FLYING"].key = "FLYING"
buttonBar["FLYING"]:SetChecked(false)
buttonBar["FLYING"]:SetScript("OnClick", CheckButton_OnClick)
buttonBar["FLYING"]:SetScript("OnEnter", CheckButton_OnEnter)
buttonBar["FLYING"]:SetScript("OnLeave", CheckButton_OnLeave)
buttonBar["SWIMMING"] = CreateMountCheckBox(("%s_SWIMMING"):format(barName), buttonBar)
buttonBar["SWIMMING"]:SetSize(width,height)
buttonBar["SWIMMING"]:SetPoint("BOTTOMLEFT", buttonBar["FLYING"], "BOTTOMRIGHT", 2, 0)
buttonBar["SWIMMING"]:SetBackdropColor(0.2, 0.42, 0.76, 0.25)
buttonBar["SWIMMING"]:SetBackdropBorderColor(0, 0, 0, 1)
buttonBar["SWIMMING"]:GetCheckedTexture():SetVertexColor(0.2, 0.42, 0.76, 1)
buttonBar["SWIMMING"].key = "SWIMMING"
buttonBar["SWIMMING"]:SetChecked(false)
buttonBar["SWIMMING"]:SetScript("OnClick", CheckButton_OnClick)
buttonBar["SWIMMING"]:SetScript("OnEnter", CheckButton_OnEnter)
buttonBar["SWIMMING"]:SetScript("OnLeave", CheckButton_OnLeave)
buttonBar["SPECIAL"] = CreateMountCheckBox(("%s_SPECIAL"):format(barName), buttonBar)
buttonBar["SPECIAL"]:SetSize(width,height)
buttonBar["SPECIAL"]:SetPoint("BOTTOMLEFT", buttonBar["SWIMMING"], "BOTTOMRIGHT", 2, 0)
buttonBar["SPECIAL"]:SetBackdropColor(0.7, 0.1, 0.1, 0.25)
buttonBar["SPECIAL"]:SetBackdropBorderColor(0, 0, 0, 1)
buttonBar["SPECIAL"]:GetCheckedTexture():SetVertexColor(0.7, 0.1, 0.1, 1)
buttonBar["SPECIAL"].key = "SPECIAL"
buttonBar["SPECIAL"]:SetChecked(false)
buttonBar["SPECIAL"]:SetScript("OnClick", CheckButton_OnClick)
buttonBar["SPECIAL"]:SetScript("OnEnter", CheckButton_OnEnter)
buttonBar["SPECIAL"]:SetScript("OnLeave", CheckButton_OnLeave)
button.MountBar = barName
UpdateMountCheckboxes(button, i)
end
UpdateCurrentMountSelection()
MountListener:RegisterEvent("MOUNT_JOURNAL_USABILITY_CHANGED")
MountListener:RegisterEvent("COMPANION_LEARNED")
MountListener:RegisterEvent("COMPANION_UNLEARNED")
MountListener:RegisterEvent("COMPANION_UPDATE")
MountListener:SetScript("OnEvent", ProxyUpdate_Mounts)
scrollFrame:HookScript("OnMouseWheel", Update_MountCheckButtons)
scrollBar:HookScript("OnValueChanged", Update_MountCheckButtons)
hooksecurefunc("MountJournal_UpdateMountList", Update_MountCheckButtons)
end
SV.Events:On("CORE_INITIALIZED", InitializeLetsRide);
--[[
##########################################################
KEYBIND FUNCTION
##########################################################
]]--
_G.SVUILetsRide = function()
local myMounts = CacheMounts()
if(not myMounts or IsMounted()) then
UnMount()
return
end
if(CanExitVehicle()) then
VehicleExit()
return
end
SV.private.Mounts = SV.private.Mounts or {}
if not SV.private.Mounts.types then
SV.private.Mounts.types = {
["GROUND"] = false,
["FLYING"] = false,
["SWIMMING"] = false,
["SPECIAL"] = false
}
end
local continent = WorldMapFrame:GetMapID()
local checkList = SV.private.Mounts.types
local letsFly = (IsFlyableArea() and (continent ~= 962 and continent ~= 7))
local letsSwim = IsSwimming()
if(IsModifierKeyDown() and checkList["SPECIAL"]) then
MountUp(checkList["SPECIAL"])
else
if(letsSwim) then
if(checkList["SWIMMING"]) then
MountUp(checkList["SWIMMING"])
elseif(letsFly) then
MountUp(checkList["FLYING"])
else
MountUp(checkList["GROUND"])
end
elseif(letsFly) then
if(checkList["FLYING"]) then
MountUp(checkList["FLYING"])
else
MountUp(checkList["GROUND"])
end
else
MountUp(checkList["GROUND"])
end
end
end
| mit |
alireza1998/AnOnYmOuS | plugins/inrealm.lua | 114 | 25001 | -- data saved to moderation.json
-- check moderation plugin
do
local function create_group(msg)
-- superuser and admins only (because sudo are always has privilege)
if is_sudo(msg) or is_realm(msg) and is_admin(msg) then
local group_creator = msg.from.print_name
create_group_chat (group_creator, group_name, ok_cb, false)
return 'Group [ '..string.gsub(group_name, '_', ' ')..' ] has been created.'
end
end
local function create_realm(msg)
-- superuser and admins only (because sudo are always has privilege)
if is_sudo(msg) or is_realm(msg) and is_admin(msg) then
local group_creator = msg.from.print_name
create_group_chat (group_creator, group_name, ok_cb, false)
return 'Realm [ '..string.gsub(group_name, '_', ' ')..' ] has been created.'
end
end
local function killchat(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function killrealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function get_group_type(msg)
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if not data[tostring(msg.to.id)]['group_type'] then
return 'No group type available.'
end
local group_type = data[tostring(msg.to.id)]['group_type']
return group_type
else
return 'Chat type not found.'
end
end
local function callbackres(extra, success, result)
--vardump(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 set_description(msg, data, target, about)
if not is_admin(msg) then
return "For admins 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 set_rules(msg, data, target)
if not is_admin(msg) then
return "For admins 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
-- lock/unlock group name. bot automatically change group name when locked
local function lock_group_name(msg, data, target)
if not is_admin(msg) then
return "For admins 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_name(msg, data, target)
if not is_admin(msg) then
return "For admins 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
--lock/unlock group member. bot automatically kick new added user when locked
local function lock_group_member(msg, data, target)
if not is_admin(msg) then
return "For admins 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_member(msg, data, target)
if not is_admin(msg) then
return "For admins 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
--lock/unlock group photo. bot automatically keep group photo when locked
local function lock_group_photo(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'yes' then
return 'Group photo is already locked'
else
data[tostring(target)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
end
return 'Please send me the group photo now'
end
local function unlock_group_photo(msg, data, target)
if not is_admin(msg) then
return "For admins 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 lock_group_flood(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
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_flood(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
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
-- show group settings
local function show_group_settings(msg, data, target)
local data = load_data(_config.moderation.data, data)
if not is_admin(msg) then
return "For admins only!"
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
return text
end
local function returnids(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
local text = 'Users in '..string.gsub(chatname,"_"," ")..' ('..result.id..'):'..'\n'..''
for k,v in pairs(result.members) do
local username = ""
text = text .. "- " .. string.gsub(v.print_name,"_"," ") .. " (" .. v.id .. ") \n"
end
send_large_msg(receiver, text)
local file = io.open("./groups/lists/"..result.id.."memberlist.txt", "w")
file:write(text)
file:flush()
file:close()
end
local function returnidsfile(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
local text = 'Users in '..string.gsub(chatname,"_"," ")..' ('..result.id..'):'..'\n'..''
for k,v in pairs(result.members) do
local username = ""
text = text .. "- " .. string.gsub(v.print_name,"_"," ") .. " (" .. v.id .. ") \n"
end
local file = io.open("./groups/lists/"..result.id.."memberlist.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..result.id,"./groups/lists/"..result.id.."memberlist.txt", ok_cb, false)
end
local function admin_promote(msg, admin_id)
if not is_sudo(msg) then
return "Access denied!"
end
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
if data[tostring(admins)][tostring(admin_id)] then
return admin_name..' is already an admin.'
end
data[tostring(admins)][tostring(admin_id)] = admin_id
save_data(_config.moderation.data, data)
return admin_id..' has been promoted as admin.'
end
local function admin_demote(msg, admin_id)
if not is_sudo(msg) then
return "Access denied!"
end
local data = load_data(_config.moderation.data)
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
if not data[tostring(admins)][tostring(admin_id)] then
return admin_id..' is not an admin.'
end
data[tostring(admins)][tostring(admin_id)] = nil
save_data(_config.moderation.data, data)
return admin_id..' has been demoted from admin.'
end
local function admin_list(msg)
local data = load_data(_config.moderation.data)
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
local message = 'List for Realm admins:\n'
for k,v in pairs(data[tostring(admins)]) do
message = message .. '- (at)' .. v .. ' [' .. k .. '] ' ..'\n'
end
return message
end
local function groups_list(msg)
local data = load_data(_config.moderation.data)
local groups = 'groups'
if not data[tostring(groups)] then
return 'No groups at the moment'
end
local message = 'List of groups:\n'
for k,v in pairs(data[tostring(groups)]) do
local settings = data[tostring(v)]['settings']
for m,n in pairs(settings) do
if m == 'set_name' then
name = n
end
end
local group_owner = "No owner"
if data[tostring(v)]['set_owner'] then
group_owner = tostring(data[tostring(v)]['set_owner'])
end
local group_link = "No link"
if data[tostring(v)]['settings']['set_link'] then
group_link = data[tostring(v)]['settings']['set_link']
end
message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n"
end
local file = io.open("./groups/lists/groups.txt", "w")
file:write(message)
file:flush()
file:close()
return message
end
local function realms_list(msg)
local data = load_data(_config.moderation.data)
local realms = 'realms'
if not data[tostring(realms)] then
return 'No Realms at the moment'
end
local message = 'List of Realms:\n'
for k,v in pairs(data[tostring(realms)]) do
local settings = data[tostring(v)]['settings']
for m,n in pairs(settings) do
if m == 'set_name' then
name = n
end
end
local group_owner = "No owner"
if data[tostring(v)]['admins_in'] then
group_owner = tostring(data[tostring(v)]['admins_in'])
end
local group_link = "No link"
if data[tostring(v)]['settings']['set_link'] then
group_link = data[tostring(v)]['settings']['set_link']
end
message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n"
end
local file = io.open("./groups/lists/realms.txt", "w")
file:write(message)
file:flush()
file:close()
return message
end
local function admin_user_promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
if not data['admins'] then
data['admins'] = {}
save_data(_config.moderation.data, data)
end
if data['admins'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is already as admin.')
end
data['admins'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, '@'..member_username..' has been promoted as admin.')
end
local function admin_user_demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
if not data['admins'] then
data['admins'] = {}
save_data(_config.moderation.data, data)
end
if not data['admins'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is not an admin.')
end
data['admins'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Admin '..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 == 'addadmin' then
return admin_user_promote(receiver, member_username, member_id)
elseif mod_cmd == 'removeadmin' then
return admin_user_demote(receiver, member_username, member_id)
end
end
end
send_large_msg(receiver, text)
end
local function set_log_group(msg)
if not is_admin(msg) then
return
end
local log_group = data[tostring(groups)][tostring(msg.to.id)]['log_group']
if log_group == 'yes' then
return 'Log group is already set'
else
data[tostring(groups)][tostring(msg.to.id)]['log_group'] = 'yes'
save_data(_config.moderation.data, data)
return 'Log group has been set'
end
end
local function unset_log_group(msg)
if not is_admin(msg) then
return
end
local log_group = data[tostring(groups)][tostring(msg.to.id)]['log_group']
if log_group == 'no' then
return 'Log group is already disabled'
else
data[tostring(groups)][tostring(msg.to.id)]['log_group'] = 'no'
save_data(_config.moderation.data, data)
return 'log group has been disabled'
end
end
local function help()
local help_text = tostring(_config.help_text_realm)
return help_text
end
function run(msg, matches)
--vardump(msg)
local name_log = user_print_name(msg.from)
if matches[1] == 'log' and is_owner(msg) then
savelog(msg.to.id, "log file created by owner")
send_document("chat#id"..msg.to.id,"./groups/"..msg.to.id.."log.txt", ok_cb, false)
end
if matches[1] == 'who' and is_momod(msg) then
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list ")
local receiver = get_receiver(msg)
chat_info(receiver, returnidsfile, {receiver=receiver})
end
if matches[1] == 'wholist' and is_momod(msg) then
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list in a file")
local receiver = get_receiver(msg)
chat_info(receiver, returnids, {receiver=receiver})
end
if not is_sudo(msg) or not is_admin(msg) and not is_realm(msg) then
return --Do nothing
end
if matches[1] == 'creategroup' and matches[2] then
group_name = matches[2]
group_type = 'group'
return create_group(msg)
end
if matches[1] == 'createrealm' and matches[2] then
group_name = matches[2]
group_type = 'realm'
return create_realm(msg)
end
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if matches[2] then if data[tostring(matches[2])] then
local settings = data[tostring(matches[2])]['settings']
if matches[1] == 'setabout' and matches[2] then
local target = matches[2]
local about = matches[3]
return set_description(msg, data, target, about)
end
if matches[1] == 'setrules' then
rules = matches[3]
local target = matches[2]
return set_rules(msg, data, target)
end
if matches[1] == 'lock' then --group lock *
local target = matches[2]
if matches[3] == 'name' then
return lock_group_name(msg, data, target)
end
if matches[3] == 'member' then
return lock_group_member(msg, data, target)
end
if matches[3] == 'photo' then
return lock_group_photo(msg, data, target)
end
if matches[3] == 'flood' then
return lock_group_flood(msg, data, target)
end
end
if matches[1] == 'unlock' then --group unlock *
local target = matches[2]
if matches[3] == 'name' then
return unlock_group_name(msg, data, target)
end
if matches[3] == 'member' then
return unlock_group_member(msg, data, target)
end
if matches[3] == 'photo' then
return unlock_group_photo(msg, data, target)
end
if matches[3] == 'flood' then
return unlock_group_flood(msg, data, target)
end
end
if matches[1] == 'settings' and data[tostring(matches[2])]['settings'] then
local target = matches[2]
return show_group_settings(msg, data, target)
end
if matches[1] == 'setname' and is_realm(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, "Realm { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]")
end
if matches[1] == 'setgpname' and is_admin(msg) 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]
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
end
end
if matches[1] == 'help' and is_realm(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help")
return help()
end
if matches[1] == 'set' then
if matches[2] == 'loggroup' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set as log group")
return set_log_group(msg)
end
end
if matches[1] == 'kill' and matches[2] == 'chat' then
if not is_admin(msg) then
return nil
end
if is_realm(msg) then
local receiver = 'chat#id'..matches[3]
return modrem(msg),
print("Closing Group: "..receiver),
chat_info(receiver, killchat, {receiver=receiver})
else
return 'Error: Group '..matches[3]..' not found'
end
end
if matches[1] == 'kill' and matches[2] == 'realm' then
if not is_admin(msg) then
return nil
end
if is_realm(msg) then
local receiver = 'chat#id'..matches[3]
return realmrem(msg),
print("Closing realm: "..receiver),
chat_info(receiver, killrealm, {receiver=receiver})
else
return 'Error: Realm '..matches[3]..' not found'
end
end
if matches[1] == 'chat_add_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
if not is_admin(msg) then
chat_del_user(chat, user, ok_cb, true)
end
end
if matches[1] == 'addadmin' then
if string.match(matches[2], '^%d+$') then
local admin_id = matches[2]
print("user "..admin_id.." has been promoted as admin")
return admin_promote(msg, admin_id)
else
local member = string.gsub(matches[2], "@", "")
local mod_cmd = "addadmin"
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
end
if matches[1] == 'removeadmin' then
if string.match(matches[2], '^%d+$') then
local admin_id = matches[2]
print("user "..admin_id.." has been demoted")
return admin_demote(msg, admin_id)
else
local member = string.gsub(matches[2], "@", "")
local mod_cmd = "removeadmin"
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
end
if matches[1] == 'type'then
local group_type = get_group_type(msg)
return group_type
end
if matches[1] == 'list' and matches[2] == 'admins' then
return admin_list(msg)
end
if matches[1] == 'list' and matches[2] == 'groups' then
if msg.to.type == 'chat' then
groups_list(msg)
send_document("chat#id"..msg.to.id, "./groups/lists/groups.txt", ok_cb, false)
return "Group list created" --group_list(msg)
elseif msg.to.type == 'user' then
groups_list(msg)
send_document("user#id"..msg.from.id, "./groups/lists/groups.txt", ok_cb, false)
return "Group list created" --group_list(msg)
end
end
if matches[1] == 'list' and matches[2] == 'realms' then
if msg.to.type == 'chat' then
realms_list(msg)
send_document("chat#id"..msg.to.id, "./groups/lists/realms.txt", ok_cb, false)
return "Realms list created" --realms_list(msg)
elseif msg.to.type == 'user' then
realms_list(msg)
send_document("user#id"..msg.from.id, "./groups/lists/realms.txt", ok_cb, false)
return "Realms list created" --realms_list(msg)
end
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
return {
patterns = {
"^[!/](creategroup) (.*)$",
"^[!/](createrealm) (.*)$",
"^[!/](setabout) (%d+) (.*)$",
"^[!/](setrules) (%d+) (.*)$",
"^[!/](setname) (.*)$",
"^[!/](setgpname) (%d+) (.*)$",
"^[!/](setname) (%d+) (.*)$",
"^[!/](lock) (%d+) (.*)$",
"^[!/](unlock) (%d+) (.*)$",
"^[!/](setting) (%d+)$",
"^[!/](wholist)$",
"^[!/](who)$",
"^[!/](type)$",
"^[!/](kill) (chat) (%d+)$",
"^[!/](kill) (realm) (%d+)$",
"^[!/](addadmin) (.*)$", -- sudoers only
"^[!/](removeadmin) (.*)$", -- sudoers only
"^[!/](list) (.*)$",
"^[!/](log)$",
"^[!/](help)$",
"^!!tgservice (.+)$",
},
run = run
}
end
| gpl-2.0 |
heyuqi/wxFormBuilder | build/premake/4.3/src/actions/vstudio/vs2002_solution.lua | 7 | 1525 | --
-- vs2002_solution.lua
-- Generate a Visual Studio 2002 solution.
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
function premake.vs2002_solution(sln)
io.eol = '\r\n'
-- Precompute Visual Studio configurations
sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
_p('Microsoft Visual Studio Solution File, Format Version 7.00')
-- Write out the list of project entries
for prj in premake.solution.eachproject(sln) do
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))
_p('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
_p('EndProject')
end
_p('Global')
_p(1,'GlobalSection(SolutionConfiguration) = preSolution')
for i, cfgname in ipairs(sln.configurations) do
_p(2,'ConfigName.%d = %s', i - 1, cfgname)
end
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ProjectDependencies) = postSolution')
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ProjectConfiguration) = postSolution')
for prj in premake.solution.eachproject(sln) do
for _, cfgname in ipairs(sln.configurations) do
_p(2,'{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
_p(2,'{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
end
end
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ExtensibilityGlobals) = postSolution')
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ExtensibilityAddIns) = postSolution')
_p(1,'EndGlobalSection')
_p('EndGlobal')
end
| gpl-2.0 |
NezzKryptic/Wire-Extras | lua/entities/gmod_wire_wireless_recv/init.lua | 4 | 3455 |
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
ENT.WireDebugName = "BT_Recv"
local MODEL = Model( "models/props_lab/binderblue.mdl" )
local Recvs = {}
function GetWirelessRecv()
return Recvs;
end
function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self.Key=0;
self.SendMsg=0;
self.Buff={};
self.Byte=0;
self.Connected=0;
self:SetOverlayText("Wireless Receiver - Scanning")
table.insert( Recvs , self );
self.Inputs = Wire_CreateInputs(self, { "Pop" , "Message" , "Send" , "Reset" , "Key" })
self.Outputs = Wire_CreateOutputs(self, { "Connected" , "Count" , "Message" })
end
function ENT:TriggerInput(iname, value)
if ( value != nil && iname == "Key" ) then
self.Key=value;
iname="Reset";
value=1;
end
if ( iname == "Reset" ) then
if ( value != nil && math.floor( value ) != 0 ) then
if self.Connected != 0 then
self.Connected:Dissconnect( self );
end
self.SendMsg=0;
self.Buff={};
self.Byte=0;
self.Connected=0;
end
end
if ( iname == "Pop" ) then
if ( value != nil && math.floor( value ) != 0 ) then
table.remove( self.Buff , 1 )
end
end
if ( value != nil && iname == "Message" ) then
self.SendMsg=value;
end
if ( iname == "Send" ) then
if ( value != nil && value != nil && math.floor( value ) != 0 ) then
if ( self.Connected != 0 ) then
if ( self.Connected:IsValid() ) then
self.Connected:Push( self , self.SendMsg )
else
self.Connected=0
end
end
end
end
self:UpdateRMessage();
end
function ENT:UpdateRMessage()
if ( self.Connected != 0 ) then
if self.Key != 0 then
self:SetOverlayText("Wireless Receiver (" .. self.Key .. ") - Connected")
else
self:SetOverlayText("Wireless Receiver - Connected")
end
Wire_TriggerOutput(self, "Connected", 1 )
else
if self.Key != 0 then
self:SetOverlayText("Wireless Receiver (" .. self.Key .. ") - Scanning")
else
self:SetOverlayText("Wireless Receiver - Scanning")
end
Wire_TriggerOutput(self, "Connected", 0 )
end
Wire_TriggerOutput(self, "Count", #self.Buff )
Wire_TriggerOutput(self, "Message", self.Buff[1] or 0 )
end
function ENT:Push( data )
table.insert( self.Buff, data );
self:UpdateRMessage();
end
function ENT:Think()
if self.Connected != 0 then
if ( not self.Connected:IsValid() ) then self.Connected=0 end
else
local Closest=0;
local CDistance=0;
if self then
local myPos = self:GetPos();
for _,Server in pairs( GetWirelessSrv() ) do
if Server then
if Server.Key == self.Key then
local TheirPos=Server:GetPos();
local ldist=TheirPos:Distance( myPos )
if ( Closest == 0 || ldist < CDistance ) then
CDistance=ldist
Closest=Server
end
end
end
end
end
if ( Closest != 0 ) then
self.Connected=Closest;
Closest:Connect( self );
self:UpdateRMessage();
end
end
self.BaseClass.Think(self)
end
function ENT:OnRemove()
if self.Connected != 0 then
self.Connected:Dissconnect( self );
end
for Key,BT in pairs( GetWirelessRecv() ) do
if BT == self then
table.remove( Recvs , Key )
end
end
end
| gpl-3.0 |
nesstea/darkstar | scripts/globals/abilities/water_maneuver.lua | 35 | 1609 | -----------------------------------
-- Ability: Water Maneuver
-- Enhances the effect of water attachments. Must have animator equipped.
-- Obtained: Puppetmaster level 1
-- Recast Time: 10 seconds (shared with all maneuvers)
-- Duration: 1 minute
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if (player:getWeaponSubSkillType(SLOT_RANGED) == 10 and
not player:hasStatusEffect(EFFECT_OVERLOAD)) then
return 0,0;
else
return 71,0;
end
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
local burden = 15;
if (target:getStat(MOD_MND) < target:getPet():getStat(MOD_MND)) then
burden = 20;
end
local overload = target:addBurden(ELE_WATER-1, burden);
if (overload ~= 0) then
target:removeAllManeuvers();
target:addStatusEffect(EFFECT_OVERLOAD, 0, 0, overload);
else
local level;
if (target:getMainJob() == JOB_PUP) then
level = target:getMainLvl()
else
level = target:getSubLvl()
end
local bonus = 1 + (level/15) + target:getMod(MOD_MANEUVER_BONUS);
if (target:getActiveManeuvers() == 3) then
target:removeOldestManeuver();
end
target:addStatusEffect(EFFECT_WATER_MANEUVER, bonus, 0, 60);
end
return EFFECT_WATER_MANEUVER;
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/keyitems.lua | 32 | 120326 | ---------------------------------------------
--
-- KEYITEMS IDS
--
---------------------------------------------
ZERUHN_REPORT = 1;
PALBOROUGH_MINES_LOGS = 2;
BLUE_ACIDITY_TESTER = 3;
RED_ACIDITY_TESTER = 4;
LETTER_TO_THE_CONSULS_SANDORIA = 5;
LETTER_TO_THE_CONSULS_BASTOK = 6;
LETTER_TO_THE_CONSULS_WINDURST = 7;
AIRSHIP_PASS = 8;
AIRSHIP_PASS_FOR_KAZHAM = 9;
OVERDUE_BOOK_NOTIFICATIONS = 10;
LETTERS_FROM_DOMIEN = 11;
C_L_REPORTS = 12;
KINDRED_CREST = 13;
MAGICITE_OPTISTONE = 14;
MAGICITE_AURASTONE = 15;
MAGICITE_ORASTONE = 16;
FOOD_OFFERINGS = 17;
DRINK_OFFERINGS = 18;
CLOCK_TOWER_OIL = 19;
YAGUDO_TORCH = 20;
CREST_OF_DAVOI_KI = 21;
LETTERS_TO_ALDO = 22;
BOUQUETS_FOR_THE_PIONEERS = 23;
OLD_TOOLBOX = 24;
NOTES_FROM_HARIGAORIGA = 25;
NOTES_FROM_IPUPU = 26;
ART_FOR_EVERYONE = 27;
CRACKED_MANA_ORBS = 28;
KINDRED_REPORT = 29;
LETTER_TO_THE_AMBASSADOR = 30;
SWORD_OFFERING = 31;
SHIELD_OFFERING = 32;
DULL_SWORD = 33;
DARK_KEY = 34;
ADVENTURERS_CERTIFICATE = 35;
STARWAY_STAIRWAY_BAUBLE = 36;
FIRST_DARK_MANA_ORB = 37;
CREATURE_COUNTER_MAGIC_DOLL = 38;
OFF_OFFERING = 39;
WINDURST_WATERS_SCOOP = 40;
WINDURST_WALLS_SCOOP = 41;
PORT_WINDURST_SCOOP = 42;
WINDURST_WOODS_SCOOP = 43;
TEMPLE_KNIGHTS_DAVOI_REPORT = 44;
SILVER_BELL = 45;
CORUSCANT_ROSARY = 46;
BLACK_MATINEE_NECKLACE = 47;
DUCAL_GUARDS_LANTERN = 48;
DUCAL_GUARDS_LANTERN_LIT = 49;
HOLY_CANDLE = 50;
SECOND_DARK_MANA_ORB = 51;
THIRD_DARK_MANA_ORB = 52;
FOURTH_DARK_MANA_ORB = 53;
FIFTH_DARK_MANA_ORB = 54;
SIXTH_DARK_MANA_ORB = 55;
ARCHDUCAL_AUDIENCE_PERMIT = 56;
SUPER_SOUP_POT = 57;
TWO_OF_SWORDS = 58;
FIRST_GLOWING_MANA_ORB = 59;
SECOND_GLOWING_MANA_ORB = 60;
THIRD_GLOWING_MANA_ORB = 61;
FOURTH_GLOWING_MANA_ORB = 62;
FIFTH_GLOWING_MANA_ORB = 63;
SIXTH_GLOWING_MANA_ORB = 64;
RESCUE_TRAINING_CERTIFICATE = 65;
CHARM_OF_LIGHT = 66;
HIDEOUT_KEY = 67;
LAPIS_CORAL = 68;
MESSAGE_TO_JEUNO_SANDORIA = 69;
MESSAGE_TO_JEUNO_BASTOK = 70;
MESSAGE_TO_JEUNO_WINDURST = 71;
NEW_FEIYIN_SEAL = 72;
BURNT_SEAL = 73;
SHADOW_FRAGMENT = 74;
RONFAURE_SUPPLIES = 75;
ZULKHEIM_SUPPLIES = 76;
NORVALLEN_SUPPLIES = 77;
GUSTABERG_SUPPLIES = 78;
DERFLAND_SUPPLIES = 79;
SARUTABARUTA_SUPPLIES = 80;
KOLSHUSHU_SUPPLIES = 81;
ARAGONEU_SUPPLIES = 82;
FAUREGANDI_SUPPLIES = 83;
VALDEAUNIA_SUPPLIES = 84;
LITELOR_SUPPLIES = 85;
KUZOTZ_SUPPLIES = 86;
VOLLBOW_SUPPLIES = 87;
LAPIS_MONOCLE = 88;
DONATION_ENVELOPE = 89;
ARAGONEU_PIZZA = 90;
LAND_CRAB_BISQUE = 91;
MHAURAN_COUSCOUS = 92;
ETCHED_RING = 93;
TRADERS_SACK = 94;
FAKE_MOUSTACHE = 95;
GARDENIA_PASS = 96;
WEAPONS_ORDER = 97;
WEAPONS_RECEIPT = 98;
SMALL_BAG = 99;
RANPIMONPIS_SPECIAL_STEW = 100;
FERRY_TICKET = 101;
STAMP_SHEET = 102;
LOST_DOCUMENT = 103;
EAST_BLOCK_CODE = 104;
SOUTH_BLOCK_CODE = 105;
NORTH_BLOCK_CODE = 106;
LETTER_FROM_ROH_LATTEH = 107;
PAINTING_OF_A_WINDMILL = 108;
TATTERED_MISSION_ORDERS = 109;
MONASTIC_CAVERN_KEY = 110;
MOON_CRYSTAL = 111;
SOUTHEASTERN_STAR_CHARM = 112;
WONDER_MAGIC_SET = 113;
UNFINISHED_LETTER = 114;
NEW_MODEL_HAT = 115;
ANGELICAS_AUTOGRAPH = 116;
OLD_TIGERS_FANG = 117;
TENSHODO_MEMBERS_CARD = 118;
RECEIPT_FOR_THE_PRINCE = 119;
MAGIC_TRASH = 120;
TENSHODO_APPLICATION_FORM = 121;
SHARP_GRAY_STONE = 122;
CATHEDRAL_DONATION = 123;
QUFIM_SUPPLIES = 124;
TATTERED_TEST_SHEET = 125;
A_SONG_OF_LOVE = 126;
STEAMING_SHEEP_INVITATION = 127;
BROKEN_WAND = 128;
GULEMONTS_DOCUMENT = 129;
OLD_RING = 130;
WHITE_ORB = 131;
PINK_ORB = 132;
RED_ORB = 133;
BLOOD_ORB = 134;
CURSED_ORB = 135;
CRIMSON_ORB = 136;
KEY_TO_THE_OZTROJA_MINES = 137;
CHOCOBO_LICENSE = 138;
CURSEPAPER = 139;
CORRUPTED_DIRT = 140;
STALACTITE_DEW = 141;
SQUIRE_CERTIFICATE = 142;
BOOK_OF_TASKS = 143;
BOOK_OF_THE_EAST = 144;
BOOK_OF_THE_WEST = 145;
KNIGHTS_SOUL = 146;
COLD_MEDICINE = 147;
AMAURAS_FORMULA = 148;
OVERDUE_BOOK_NOTIFICATION = 149;
SCRIPTURE_OF_WATER = 150;
SCRIPTURE_OF_WIND = 151;
TAMIS_NOTE = 152;
THYME_MOSS = 153;
COUGH_MEDICINE = 154;
SCROLL_OF_TREASURE = 155;
CODE_OF_BEASTMASTERS = 156;
ORCISH_HUT_KEY = 157;
STAR_CRESTED_SUMMONS = 158;
BRUGAIRE_GOODS = 159;
SMALL_TEACUP = 160;
SUSPICIOUS_ENVELOPE = 161;
CARRIER_PIGEON_LETTER = 162;
CARMELOS_SONG_SHEET = 163;
CURILLAS_BOTTLE_EMPTY = 164;
CURILLAS_BOTTLE_FULL = 165;
NEUTRALIZER = 166;
GOLDSMITHING_ORDER = 167;
MYTHRIL_HEARTS = 168;
TESTIMONIAL = 169;
LETTER_FROM_ZEID = 170;
SHANTOTTOS_NEW_SPELL = 171;
SHANTOTTOS_EXSPELL = 172;
BUCKET_OF_DIVINE_PAINT = 173;
LETTER_FROM_VIRNAGE = 174;
SPIRIT_INCENSE = 175;
GANTINEUXS_LETTER = 176;
SEAL_OF_BANISHING = 177;
MAGICAL_PATTERN = 178;
FEIYIN_MAGIC_TOME = 179;
SLUICE_SURVEYOR_MK_I = 180;
FOE_FINDER_MK_I = 181;
EARTHEN_CHARM = 182;
LETTER_FROM_THE_TENSHODO = 183;
TENSHODO_ENVELOPE = 184;
SIGNED_ENVELOPE = 185;
GANG_WHEREABOUTS_NOTE = 186;
FIRST_FORGED_ENVELOPE = 187;
SECOND_FORGED_ENVELOPE = 188;
FIRST_SIGNED_FORGED_ENVELOPE = 189;
SECOND_SIGNED_FORGED_ENVELOPE = 190;
LETTER_FROM_DALZAKK = 191;
SANDORIAN_MARTIAL_ARTS_SCROLL = 192;
BOMB_INCENSE = 193;
PERCHONDS_ENVELOPE = 194;
PORTAL_CHARM = 195;
ORCISH_DRIED_FOOD = 196;
OLD_POCKET_WATCH = 197;
OLD_BOOTS = 198;
BALGA_CHAMPION_CERTIFICATE = 199;
HOLY_ONES_OATH = 200;
CRAWLER_BLOOD = 201;
CAT_BURGLARS_NOTE = 202;
CHIEFTAINNESS_TWINSTONE_EARRING = 203;
NORTHERN_VINE = 204;
SOUTHERN_VINE = 205;
EASTERN_VINE = 206;
WESTERN_VINE = 207;
SWORD_GRIP_MATERIAL = 208;
YASINS_SWORD = 209;
OLD_GAUNTLETS = 210;
SHADOW_FLAMES = 211;
FIREBLOOM_TREE_WOOD = 212;
LETTER_TO_ANGELICA = 213;
FINAL_FANTASY = 214;
RIPPED_FINAL_FANTASY_PAINTING = 215;
FINAL_FANTASY_PART_II = 216;
TAMERS_WHISTLE = 217;
KNIGHTS_BOOTS = 218;
MIQUES_PAINTBRUSH = 219;
STRANGE_SHEET_OF_PAPER = 220;
KNIGHTS_CONFESSION = 221;
ROUND_FRIGICITE = 222;
SQUARE_FRIGICITE = 223;
TRIANGULAR_FRIGICITE = 224;
STAR_RING1 = 225;
STAR_RING2 = 226;
MOON_RING = 227;
MERTAIRES_BRACELET = 228;
AQUAFLORA1 = 229;
AQUAFLORA2 = 230;
AQUAFLORA3 = 231;
GUIDING_BELL = 232;
ORDELLE_WHETSTONE = 233;
LETTER_FROM_THE_DARKSTEEL_FORGE = 234;
DARKSTEEL_FORMULA = 235;
KOHS_LETTER = 236;
ROYAL_KNIGHTS_DAVOI_REPORT = 237;
SACRIFICIAL_CHAMBER_KEY = 238;
FIRE_FRAGMENT = 239;
WATER_FRAGMENT = 240;
EARTH_FRAGMENT = 241;
WIND_FRAGMENT = 242;
LIGHTNING_FRAGMENT = 243;
ICE_FRAGMENT = 244;
LIGHT_FRAGMENT = 245;
DARK_FRAGMENT = 246;
PRISMATIC_FRAGMENT = 247;
SOUTHWESTERN_STAR_CHARM = 248;
HOLY_ONES_INVITATION = 249;
OPTISTERY_RING = 250;
BLANK_BOOK_OF_THE_GODS = 251;
BOOK_OF_THE_GODS = 252;
NONBERRYS_KNIFE = 253;
SUBLIME_STATUE_OF_THE_GODDESS = 254;
RAUTEINOTS_PARCEL = 255;
TREASURE_MAP = 256;
STRANGELY_SHAPED_CORAL = 257;
SEALED_DAGGER = 258;
ANGELICAS_LETTER = 259;
EMPTY_BARREL = 260;
BARREL_OF_OPOOPO_BREW = 261;
ELSHIMO_LOWLANDS_SUPPLIES = 262;
ELSHIMO_UPLANDS_SUPPLIES = 263;
JOKER_CARD = 264;
ORASTERY_RING = 265;
ALTEPA_MOONPEBBLE = 266;
RHINOSTERY_CERTIFICATE = 267;
DREAMROSE = 268;
ANCIENT_SANDORIAN_BOOK = 269;
PIECE_OF_PAPER = 270;
INVISIBLE_MAN_STICKER = 271;
PAINTBRUSH_OF_SOULS = 272;
OLD_RUSTY_KEY = 273;
ANCIENT_TABLET_FRAGMENT = 274;
STAR_SEEKER = 275;
AURASTERY_RING = 276;
TABLET_OF_ANCIENT_MAGIC = 277;
LETTER_FROM_ALFESAR = 278;
MAGIC_DRAINED_STAR_SEEKER = 279;
RHINOSTERY_RING = 280;
MANUSTERY_RING = 281;
GLOVE_OF_PERPETUAL_TWILIGHT = 282;
ANCIENT_SANDORIAN_TABLET = 283;
CRYSTAL_DOWSER = 284;
PIECE_OF_A_BROKEN_KEY1 = 285;
PIECE_OF_A_BROKEN_KEY2 = 286;
PIECE_OF_A_BROKEN_KEY3 = 287;
DROPS_OF_AMNIO = 288;
REINFORCED_CERMET = 289;
LETTER_FROM_WEREI = 290;
TONBERRY_KEY = 291;
THESIS_ON_ALCHEMY = 292;
OLD_PIECE_OF_WOOD = 293;
DRAGON_CURSE_REMEDY = 294;
SEALED_IRON_BOX = 295;
SEA_SERPENT_STATUE = 296;
ALTEPA_POLISHING_STONE = 297;
CHALLENGE_TO_THE_ROYAL_KNIGHTS = 298;
RANCHURIOMES_LEGACY = 299;
RONFAURE_EF_INSIGNIA = 300;
ZULKHEIM_EF_INSIGNIA = 301;
NORVALLEN_EF_INSIGNIA = 302;
GUSTABERG_EF_INSIGNIA = 303;
DERFLAND_EF_INSIGNIA = 304;
SARUTABARUTA_EF_INSIGNIA = 305;
KOLSHUSHU_EF_INSIGNIA = 306;
ARAGONEU_EF_INSIGNIA = 307;
FAUREGANDI_EF_INSIGNIA = 308;
VALDEAUNIA_EF_INSIGNIA = 309;
QUFIM_EF_INSIGNIA = 310;
LITELOR_EF_INSIGNIA = 311;
KUZOTZ_EF_INSIGNIA = 312;
VOLLBOW_EF_INSIGNIA = 313;
ELSHIMO_LOWLANDS_EF_INSIGNIA = 314;
ELSHIMO_UPLANDS_EF_INSIGNIA = 315;
KEY_ITEM316 = 316;
KEY_ITEM317 = 317;
KEY_ITEM318 = 318;
KEY_ITEM319 = 319;
WHISPER_OF_FLAMES = 320;
WHISPER_OF_TREMORS = 321;
WHISPER_OF_TIDES = 322;
WHISPER_OF_GALES = 323;
WHISPER_OF_FROST = 324;
WHISPER_OF_STORMS = 325;
WHISPER_OF_THE_MOON = 326;
WHISPER_OF_DREAMS = 327;
TUNING_FORK_OF_FIRE = 328;
TUNING_FORK_OF_EARTH = 329;
TUNING_FORK_OF_WATER = 330;
TUNING_FORK_OF_WIND = 331;
TUNING_FORK_OF_ICE = 332;
TUNING_FORK_OF_LIGHTNING = 333;
MOON_BAUBLE = 334;
VIAL_OF_DREAM_INCENSE = 335;
ORCISH_CREST = 336;
QUADAV_CREST = 337;
YAGUDO_CREST = 338;
UN_MOMENT = 339;
LEPHEMERE = 340;
LANCIENNE = 341;
CHANSON_DE_LIBERTE = 342;
WEAPON_TRAINING_GUIDE = 343;
MAP_TO_THE_ANNALS_OF_TRUTH = 344;
ANNALS_OF_TRUTH = 345;
COMPLETION_CERTIFICATE = 346;
DYNAMIS_DEBUGGER = 347;
DROPPED_ITEM = 348;
WHITE_CARD = 349;
RED_CARD = 350;
BLACK_CARD = 351;
HOLLA_GATE_CRYSTAL = 352;
DEM_GATE_CRYSTAL = 353;
MEA_GATE_CRYSTAL = 354;
VAHZL_GATE_CRYSTAL = 355;
YHOATOR_GATE_CRYSTAL = 356;
ALTEPA_GATE_CRYSTAL = 357;
PROMYVION_HOLLA_SLIVER = 358;
PROMYVION_DEM_SLIVER = 359;
PROMYVION_MEA_SLIVER = 360;
WHISPER_OF_THE_WYRMKING = 361;
NOTE_WRITTEN_BY_ESHANTARL = 362;
RAINBOW_RESONATOR = 363;
FADED_RUBY = 364;
TATTERED_MAZE_MONGER_POUCH = 365;
CRIMSON_STRATUM_ABYSSITE = 366;
CRIMSON_STRATUM_ABYSSITE_II = 367;
CRIMSON_STRATUM_ABYSSITE_III = 368;
CRIMSON_STRATUM_ABYSSITE_IV = 369;
INDIGO_STRATUM_ABYSSITE = 370;
INDIGO_STRATUM_ABYSSITE_II = 371;
INDIGO_STRATUM_ABYSSITE_III = 372;
INDIGO_STRATUM_ABYSSITE_IV = 373;
JADE_STRATUM_ABYSSITE = 374;
JADE_STRATUM_ABYSSITE_II = 375;
JADE_STRATUM_ABYSSITE_III = 376;
JADE_STRATUM_ABYSSITE_IV = 377;
SHODDY_METAL_CLASP = 378;
BUNDLE_OF_SUNDRY_PLANTS = 379;
SQUARE_OF_ULTIMATE_CLOTH = 380;
PLIABLE_LIZARD_SKIN = 381;
SQUARE_OF_LIZARD_LEATHER = 382;
MAP_OF_ABDH_ISLE_PURGONORGO = 383;
MAP_OF_THE_SAN_DORIA_AREA = 385;
MAP_OF_THE_BASTOK_AREA = 386;
MAP_OF_THE_WINDURST_AREA = 387;
MAP_OF_THE_JEUNO_AREA = 388;
MAP_OF_QUFIM_ISLAND = 389;
MAP_OF_THE_NORTHLANDS_AREA = 390;
MAP_OF_KING_RANPERRES_TOMB = 391;
MAP_OF_THE_DANGRUF_WADI = 392;
MAP_OF_THE_HORUTOTO_RUINS = 393;
MAP_OF_BOSTAUNIEUX_OUBLIETTE = 394;
MAP_OF_THE_ZERUHN_MINES = 395;
MAP_OF_THE_TORAIMARAI_CANAL = 396;
MAP_OF_ORDELLES_CAVES = 397;
MAP_OF_THE_GUSGEN_MINES = 398;
MAP_OF_THE_MAZE_OF_SHAKHRAMI = 399;
MAP_OF_THE_ELDIEME_NECROPOLIS = 400;
MAP_OF_THE_CRAWLERS_NEST = 401;
MAP_OF_THE_GARLAIGE_CITADEL = 402;
MAP_OF_THE_RANGUEMONT_PASS = 403;
MAP_OF_GHELSBA = 404;
MAP_OF_DAVOI = 405;
MAP_OF_THE_PALBOROUGH_MINES = 406;
MAP_OF_BEADEAUX = 407;
MAP_OF_GIDDEUS = 408;
MAP_OF_CASTLE_OZTROJA = 409;
MAP_OF_DELKFUTTS_TOWER = 410;
MAP_OF_FEIYIN = 411;
MAP_OF_CASTLE_ZVAHL = 412;
MAP_OF_THE_ELSHIMO_REGIONS = 413;
MAP_OF_THE_KUZOTZ_REGION = 414;
MAP_OF_THE_LITELOR_REGION = 415;
MAP_OF_THE_RUAUN_GARDENS = 416;
MAP_OF_NORG = 417;
MAP_OF_THE_TEMPLE_OF_UGGALEPIH = 418;
MAP_OF_THE_DEN_OF_RANCOR = 419;
MAP_OF_THE_KORROLOKA_TUNNEL = 420;
MAP_OF_THE_KUFTAL_TUNNEL = 421;
MAP_OF_THE_BOYAHDA_TREE = 422;
MAP_OF_THE_VELUGANNON_PALACE = 423;
MAP_OF_IFRITS_CAULDRON = 424;
MAP_OF_THE_QUICKSAND_CAVES = 425;
MAP_OF_THE_SEA_SERPENT_GROTTO = 426;
MAP_OF_THE_VOLLBOW_REGION = 427;
MAP_OF_THE_LABYRINTH_OF_ONZOZO = 428;
MAP_OF_CARPENTERS_LANDING = 429;
MAP_OF_BIBIKI_BAY = 430;
MAP_OF_THE_ULEGUERAND_RANGE = 431;
MAP_OF_THE_ATTOHWA_CHASM = 432;
MAP_OF_PSOXJA = 433;
MAP_OF_OLDTON_MOVALPOLOS = 434;
MAP_OF_NEWTON_MOVALPOLOS = 435;
MAP_OF_PROMYVION_HOLLA = 436;
MAP_OF_PROMYVION_DEM = 437;
MAP_OF_PROMYVION_MEA = 438;
MAP_OF_PROMYVION_VAHZL = 439;
MAP_OF_TAVNAZIA = 440;
MAP_OF_THE_AQUEDUCTS = 441;
MAP_OF_THE_SACRARIUM = 442;
MAP_OF_CAPE_RIVERNE = 443;
MAP_OF_ALTAIEU = 444;
MAP_OF_HUXZOI = 445;
MAP_OF_RUHMET = 446;
MAP_OF_DIO_ABDHALJS_GHELSBA = 447;
DAZEBREAKER_CHARM = 448;
SHINY_EARRING = 449;
CARBUNCLES_TEAR = 450;
SCRAP_OF_PAPYRUS = 451;
CERULEAN_CRYSTAL = 452;
HANDFUL_OF_CRYSTAL_SCALES = 453;
CHARRED_HELM = 454;
SHARD_OF_APATHY = 455;
SHARD_OF_ARROGANCE = 456;
SHARD_OF_COWARDICE = 457;
SHARD_OF_ENVY = 458;
SHARD_OF_RAGE = 459;
TRICK_BOX = 460;
WASHUS_TASTY_WURST = 461;
YOMOTSU_FEATHER = 462;
YOMOTSU_HIRASAKA = 463;
FADED_YOMOTSU_HIRASAKA = 464;
SEANCE_STAFF = 465;
SMILING_STONE = 466;
SCOWLING_STONE = 467;
SOMBER_STONE = 468;
SPIRITED_STONE = 469;
OLD_TRICK_BOX = 470;
LARGE_TRICK_BOX = 471;
INDIGESTED_STALAGMITE = 472;
INDIGESTED_ORE = 473;
INDIGESTED_MEAT = 474;
LETTER_FROM_ZONPAZIPPA = 475;
MOONDROP = 476;
MIRACLESALT = 477;
ANCIENT_VERSE_OF_ROMAEVE = 478;
ANCIENT_VERSE_OF_ALTEPA = 479;
ANCIENT_VERSE_OF_UGGALEPIH = 480;
FIGURE_OF_LEVIATHAN = 481;
FIGURE_OF_GARUDA = 482;
FIGURE_OF_TITAN = 483;
DARK_MANA_ORB = 484;
MOONGATE_PASS = 485;
HYDRA_CORPS_COMMAND_SCEPTER = 486;
HYDRA_CORPS_EYEGLASS = 487;
HYDRA_CORPS_LANTERN = 488;
HYDRA_CORPS_TACTICAL_MAP = 489;
HYDRA_CORPS_INSIGNIA = 490;
HYDRA_CORPS_BATTLE_STANDARD = 491;
VIAL_OF_SHROUDED_SAND = 492;
DIARY_OF_MUKUNDA = 493;
LETTER_TO_THE_BAS_CONFLICT_CMD1 = 494;
LETTER_TO_THE_WIN_CONFLICT_CMD1 = 495;
LETTER_TO_THE_SAN_CONFLICT_CMD1 = 496;
LETTER_TO_THE_WIN_CONFLICT_CMD2 = 497;
LETTER_TO_THE_SAN_CONFLICT_CMD2 = 498;
LETTER_TO_THE_BAS_CONFLICT_CMD2 = 499;
BALLISTA_EARRING = 500;
DRAWING_OF_A_MALE_HUME = 501;
DRAWING_OF_A_FEMALE_HUME = 502;
DRAWING_OF_A_MALE_ELVAAN = 503;
DRAWING_OF_A_FEMALE_ELVAAN = 504;
DRAWING_OF_A_MALE_TARUTARU = 505;
DRAWING_OF_A_FEMALE_TARUTARU = 506;
DRAWING_OF_A_MITHRA = 507;
DRAWING_OF_A_GALKA = 508;
YE_OLDE_MANNEQUIN_CATALOGUE = 509;
MANNEQUIN_JOINT_DIAGRAMS = 510;
CLAMMING_KIT = 511;
MOGHANCEMENT_FIRE = 512;
MOGHANCEMENT_ICE = 513;
MOGHANCEMENT_WIND = 514;
MOGHANCEMENT_EARTH = 515;
MOGHANCEMENT_LIGHTNING = 516;
MOGHANCEMENT_WATER = 517;
MOGHANCEMENT_LIGHT = 518;
MOGHANCEMENT_DARK = 519;
MOGHANCEMENT_EXPERIENCE = 520;
MOGHANCEMENT_GARDENING = 521;
MOGHANCEMENT_DESYNTHESIS = 522;
MOGHANCEMENT_FISHING = 523;
MOGHANCEMENT_WOODWORKING = 524;
MOGHANCEMENT_SMITHING = 525;
MOGHANCEMENT_GOLDSMITHING = 526;
MOGHANCEMENT_CLOTHCRAFT = 527;
MOGHANCEMENT_LEATHERCRAFT = 528;
MOGHANCEMENT_BONECRAFT = 529;
MOGHANCEMENT_ALCHEMY = 530;
MOGHANCEMENT_COOKING = 531;
MOGHANCEMENT_CONQUEST = 532;
MOGHANCEMENT_REGION = 533;
MOGHANCEMENT_FISHINGITEMS = 534;
MOGHANCEMENT_SAN_CONQUEST = 535;
MOGHANCEMENT_BAS_CONQUEST = 536;
MOGHANCEMENT_WIN_CONQUEST = 537;
MOGHANCEMENT_MONEY = 538;
MOGHANCEMENT_CAMPAIGN = 539;
MOGLIFICATION_FISHING = 544;
MOGLIFICATION_WOODWORKING = 545;
MOGLIFICATION_SMITHING = 546;
MOGLIFICATION_GOLDSMITHING = 547;
MOGLIFICATION_CLOTHCRAFT = 548;
MOGLIFICATION_LEATHERCRAFT = 549;
MOGLIFICATION_BONECRAFT = 550;
MOGLIFICATION_ALCHEMY = 551;
MOGLIFICATION_COOKING = 552;
MEGA_MOGLIFICATION_FISHING = 553;
MEGA_MOGLIFICATION_WOODWORK = 554;
MEGA_MOGLIFICATION_SMITHING = 555;
MEGA_MOGLIFICATION_GOLDSMITH = 556;
MEGA_MOGLIFICATION_CLOTHCRAFT = 557;
MEGA_MOGLIFICATION_LEATHRCRFT = 558;
MEGA_MOGLIFICATION_BONECRAFT = 559;
MEGA_MOGLIFICATION_ALCHEMY = 560;
MEGA_MOGLIFICATION_COOKING = 561;
BALLISTA_LICENSE = 576;
BALLISTA_INSTAWARP = 577;
BALLISTA_INSTAPORT = 578;
MYSTERIOUS_AMULET = 579;
MYSTERIOUS_AMULET_DRAINED = 580;
CRACKED_MIMEO_MIRROR = 581;
RELIQUIARIUM_KEY = 582;
MIMEO_STONE = 583;
MYSTIC_ICE = 584;
KEY_ITEM585 = 585;
MIMEO_JEWEL = 586;
MIMEO_FEATHER = 587;
SECOND_MIMEO_FEATHER = 588;
THIRD_MIMEO_FEATHER = 589;
LIGHT_OF_HOLLA = 590;
LIGHT_OF_DEM = 591;
LIGHT_OF_MEA = 592;
LIGHT_OF_VAHZL = 593;
LIGHT_OF_ALTAIEU = 594;
BLUE_BRACELET = 595;
GREEN_BRACELET = 596;
DUSTY_TOME = 597;
POINTED_JUG = 598;
CRACKED_CLUB = 599;
PEELING_HAIRPIN = 600;
OLD_NAMETAG = 601;
TINY_WRISTLET = 602;
WHISPERING_CONCH = 603;
PSOXJA_PASS = 604;
PIECE_OF_RIPPED_FLOORPLANS = 605;
LIMIT_BREAKER = 606;
HYPER_ALTIMETER = 607;
MOLYBDENUM_BOX = 608;
ALABASTER_HAIRPIN = 609;
DAWN_TALISMAN = 610;
SILVER_COMETS_COLLAR = 611;
ENVELOPE_FROM_MONBERAUX = 612;
DELKFUTT_RECOGNITION_DEVICE = 613;
DEED_TO_PURGONORGO_ISLE = 614;
PHOENIX_ARMLET = 615;
PHOENIX_PEARL = 616;
MANACLIPPER_TICKET = 617;
BARGE_TICKET = 618;
ALLYOUCANRIDEPASS = 619;
TAVNAZIAN_ARCHIPELAGO_SUPPLIES = 620;
RIVERNEWORT = 621;
TAVNAZIAN_COOKBOOK = 622;
WASHUS_FLASK = 623;
FLASK_OF_CLAM_WATER = 624;
PUNGENT_PROVIDENCE_POT = 625;
TORN_OUT_PAGES = 626;
TONBERRY_BLACKBOARD = 627;
LETTER_FROM_MUCKVIX = 628;
LETTER_FROM_MAGRIFFON = 629;
PROVIDENCE_POT = 630;
CARE_PACKAGE = 631;
GLITTERING_FRAGMENT = 632;
STOREROOM_KEY = 633;
ZEELOZOKS_EARPLUG = 634;
POTION_VOUCHER = 635;
HIPOTION_VOUCHER = 636;
XPOTION_VOUCHER = 637;
ETHER_VOUCHER = 638;
HIETHER_VOUCHER = 639;
SUPER_ETHER_VOUCHER = 640;
ELIXER_VOUCHER = 641;
REVITALIZER_VOUCHER = 642;
BODY_BOOST_VOUCHER = 643;
MANA_BOOST_VOUCHER = 644;
DRACHENESSENCE_VOUCHER = 645;
BARFIRE_OINTMENT_VOUCHER = 646;
BARBLIZZARD_OINTMENT_VOUCHER = 647;
BARAERO_OINTMENT_VOUCHER = 648;
BARSTONE_OINTMENT_VOUCHER = 649;
BARTHUNDER_OINTMENT_VOUCHER = 650;
BARWATER_OINTMENT_VOUCHER = 651;
BARGE_MULTITICKET = 652;
MANACLIPPER_MULTITICKET = 653;
FIGHTERS_ARMOR_CLAIM_SLIP = 654;
TEMPLE_ATTIRE_CLAIM_SLIP = 655;
HEALERS_ATTIRE_CLAIM_SLIP = 656;
WIZARDS_ATTIRE_CLAIM_SLIP = 657;
WARLOCKS_ARMOR_CLAIM_SLIP = 658;
ROGUES_ATTIRE_CLAIM_SLIP = 659;
GALLANT_ARMOR_CLAIM_SLIP = 660;
CHAOS_ARMOR_CLAIM_SLIP = 661;
BEAST_ARMOR_CLAIM_SLIP = 662;
CHORAL_ATTIRE_CLAIM_SLIP = 663;
HUNTERS_ATTIRE_CLAIM_SLIP = 664;
MYOCHIN_ARMOR_CLAIM_SLIP = 665;
NINJAS_GARB_CLAIM_SLIP = 666;
DRACHEN_ARMOR_CLAIM_SLIP = 667;
EVOKERS_ATTIRE_CLAIM_SLIP = 668;
VESSEL_OF_LIGHT = 669;
CENSER_OF_ABANDONMENT = 670;
CENSER_OF_ANTIPATHY = 671;
CENSER_OF_ANIMUS = 672;
CENSER_OF_ACRIMONY = 673;
MONARCH_BEARD = 674;
ASTRAL_COVENANT = 675;
SHAFT_2716_OPERATING_LEVER = 676;
ZEPHYR_FAN = 677;
MIASMA_FILTER = 678;
PARTICULARLY_POIGNANT_PETAL = 679;
ANTIQUE_AMULET = 680;
CATHEDRAL_MEDALLION = 681;
GOLD_BALLISTA_CHEVRON = 682;
MYTHRIL_BALLISTA_CHEVRON = 683;
SILVER_BALLISTA_CHEVRON = 684;
BRONZE_BALLISTA_CHEVRON = 685;
BLOODY_BALLISTA_CHEVRON = 686;
ORANGE_BALLISTA_CHEVRON = 687;
WHITE_BALLISTA_CHEVRON = 688;
BLACK_BALLISTA_CHEVRON = 689;
RED_BALLISTA_CHEVRON = 690;
GREEN_BALLISTA_CHEVRON = 691;
SPARKING_BALLISTA_CHEVRON = 692;
EBON_BALLISTA_CHEVRON = 693;
FURRY_BALLISTA_CHEVRON = 694;
BROWN_BALLISTA_CHEVRON = 695;
OCHRE_BALLISTA_CHEVRON = 696;
JADE_BALLISTA_CHEVRON = 697;
TRANSPARENT_BALLISTA_CHEVRON = 698;
PURPLE_BALLISTA_CHEVRON = 699;
RAINBOW_BALLISTA_CHEVRON = 700;
LETTERS_FROM_ULMIA_AND_PRISHE = 701;
PETRA_EATER_VOUCHER = 702;
CATHOLICON_VOUCHER = 703;
RED_OIL = 704;
MARBLE_BRIDGE_COASTER = 705;
LAMP_LIGHTERS_MEMBERSHIP_CARD = 706;
SHAFT_GATE_OPERATING_DIAL = 707;
MYSTERIOUS_AMULET = 708;
MIRE_INCENSE = 709;
BRAND_OF_DAWN = 710;
BRAND_OF_TWILIGHT = 711;
ORNAMENTED_SCROLL = 712;
BETTER_HUMES_AND_MANNEQUINS = 713;
PETRA_SHOVEL = 714;
CALIGINOUS_BLADE = 715;
TEAR_OF_ALTANA = 716;
BALLISTA_BAND = 717;
SHADED_CRUSE = 718;
LETTER_FROM_SHIKAREE_X = 719;
MONARCH_LINN_PATROL_PERMIT = 720;
LETTER_FROM_SHIKAREE_Y = 721;
LETTER_FROM_THE_MITHRAN_TRACKER = 722;
COMMUNICATION_FROM_TZEE_XICU = 723;
ORCISH_SEEKER_BATS = 724;
VAULT_QUIPUS = 725;
GOBLIN_RECOMMENDATION_LETTER = 726;
COSTUME_KIT = 727;
JAR_OF_REVERSION_DUST = 728;
REMEDY_VOUCHER = 729;
PANACEA_VOUCHER = 730;
SMELLING_SALTS_VOUCHER = 731;
VITRALLUM = 732;
OPALESCENT_STONE = 733;
COSMOCLEANSE = 734;
OLD_WOMANS_PORTRAIT = 735;
GLIMMERING_MICA = 736;
MISTROOT = 737;
LUNASCENT_LOG = 738;
DYNAMIS_VALKURM_SLIVER = 739;
DYNAMIS_BUBURIMU_SLIVER = 740;
DYNAMIS_QUFIM_SLIVER = 741;
DYNAMIS_TAVNAZIA_SLIVER = 742;
RED_SENTINEL_BADGE = 743;
BLUE_SENTINEL_BADGE = 744;
GREEN_SENTINEL_BADGE = 745;
WHITE_SENTINEL_BADGE = 746;
EYE_OF_FLAMES = 747;
EYE_OF_TREMORS = 748;
EYE_OF_TIDES = 749;
EYE_OF_GALES = 750;
EYE_OF_FROST = 751;
EYE_OF_STORMS = 752;
RED_INVITATION_CARD = 753;
BLUE_INVITATION_CARD = 754;
GREEN_INVITATION_CARD = 755;
WHITE_INVITATION_CARD = 756;
HEALING_POWDER_VOUCHER = 757;
BRENNER_SHOVEL = 758;
BRENNER_BAND = 759;
SILVER_SEA_FERRY_TICKET = 760;
MOONLIGHT_ORE = 761;
LEUJAOAM_ASSAULT_ORDERS = 762;
MAMOOL_JA_ASSAULT_ORDERS = 763;
LEBROS_ASSAULT_ORDERS = 764;
PERIQIA_ASSAULT_ORDERS = 765;
ILRUSI_ASSAULT_ORDERS = 766;
DKHAAYAS_RESEARCH_JOURNAL = 767;
ELECTROCELL = 768;
ELECTROPOT = 769;
ELECTROLOCOMOTIVE = 770;
MARK_OF_ZAHAK = 771;
VIAL_OF_LUMINOUS_WATER = 772;
IMAGE_RECORDER = 773;
CAST_METAL_PLATE = 774;
SUPPLIES_PACKAGE = 775;
RAINBOW_BERRY = 776;
SAPPHIRE_BALLISTA_CHEVRON = 777;
CORAL_BALLISTA_CHEVRON = 778;
SILK_BALLISTA_CHEVRON = 779;
PSC_WILDCAT_BADGE = 780;
BOARDING_PERMIT = 781;
RUNIC_PORTAL_USE_PERMIT = 782;
PFC_WILDCAT_BADGE = 783;
SP_WILDCAT_BADGE = 784;
RAILLEFALS_LETTER = 785;
EPHRAMADIAN_GOLD_COIN = 786;
IMPERIAL_ARMY_ID_TAG = 787;
RAILLEFALS_NOTE = 788;
DARK_RIDER_HOOFPRINT = 789;
BAG_OF_GOLD_PIECES = 790;
FORGOTTEN_HEXAGUN = 791;
PLASMA_OIL = 792;
PLASMA_ROCK = 793;
LC_WILDCAT_BADGE = 794;
C_WILDCAT_BADGE = 795;
POT_OF_TSETSEROONS_STEW = 796;
ASSAULT_ARMBAND = 797;
ANTIQUE_AUTOMATON = 798;
RED_BELL = 799;
BLUE_BELL = 800;
MUSICAL_SCORE_1ST_PAGE = 801;
MUSICAL_SCORE_2ND_PAGE = 802;
MERROW_HOMUNCULUS = 803;
LAMIA_HOMUNCULUS = 804;
MUNAHDAS_PACKAGE = 805;
WHITE_HANDKERCHIEF = 806;
CONFIDENTIAL_IMPERIAL_ORDER = 807;
SECRET_IMPERIAL_ORDER = 808;
HANDKERCHIEF = 809;
DIRTY_HANDKERCHIEF = 810;
REPLAY_DEBUGGER = 811;
ASTRAL_COMPASS = 812;
VIAL_OF_SPECTRAL_SCENT = 813;
EMPTY_TEST_TUBE_1 = 814;
EMPTY_TEST_TUBE_2 = 815;
EMPTY_TEST_TUBE_3 = 816;
EMPTY_TEST_TUBE_4 = 817;
EMPTY_TEST_TUBE_5 = 818;
TEST_TUBE_1 = 819;
TEST_TUBE_2 = 820;
TEST_TUBE_3 = 821;
TEST_TUBE_4 = 822;
TEST_TUBE_5 = 823;
QUARTZ_TRANSMITTER = 824;
S_WILDCAT_BADGE = 825;
SM_WILDCAT_BADGE = 826;
CS_WILDCAT_BADGE = 827;
CHUNK_OF_GLITTERING_ORE = 828;
BRAND_OF_THE_SPRINGSERPENT = 829;
BRAND_OF_THE_GALESERPENT = 830;
BRAND_OF_THE_FLAMESERPENT = 831;
BRAND_OF_THE_SKYSERPENT = 832;
BRAND_OF_THE_STONESERPENT = 833;
MAGUS_ORDER_SLIP = 834;
SEALED_IMMORTAL_ENVELOPE = 835;
STORY_OF_AN_IMPATIENT_CHOCOBO = 837;
STORY_OF_A_CURIOUS_CHOCOBO = 838;
STORY_OF_A_WORRISOME_CHOCOBO = 839;
STORY_OF_A_YOUTHFUL_CHOCOBO = 840;
STORY_OF_A_HAPPY_CHOCOBO = 841;
MAMOOL_JA_MANDATE = 842;
VALKENGS_MEMORY_CHIP = 843;
TOGGLE_SWITCH = 844;
LELEROONS_LETTER_GREEN = 845;
LELEROONS_LETTER_BLUE = 846;
LELEROONS_LETTER_RED = 847;
LIFE_FLOAT = 848;
WHEEL_LOCK_TRIGGER = 849;
STORY_OF_A_DILIGENT_CHOCOBO = 850;
PRAIRIE_CHOCOGRAPH = 851;
BUSH_CHOCOGRAPH = 852;
LETTER_FROM_BERNAHN = 853;
REMNANTS_PERMIT = 854;
LILAC_RIBBON = 855;
COASTAL_CHOCOGRAPH = 856;
DUNE_CHOCOGRAPH = 857;
JUNGLE_CHOCOGRAPH = 858;
DESERT_CHOCOGRAPH = 859;
PERIQIA_ASSAULT_AREA_ENTRY_PERMIT = 860;
WARRIORS_ARMOR_CLAIM_SLIP = 861;
MELEE_ATTIRE_CLAIM_SLIP = 862;
CLERICS_ATTIRE_CLAIM_SLIP = 863;
SORCERERS_ATTIRE_CLAIM_SLIP = 864;
DUELISTS_ARMOR_CLAIM_SLIP = 865;
ASSASSINS_ATTIRE_CLAIM_SLIP = 866;
VALOR_ARMOR_CLAIM_SLIP = 867;
ABYSS_ARMOR_CLAIM_SLIP = 868;
MONSTER_ARMOR_CLAIM_SLIP = 869;
BARDS_ATTIRE_CLAIM_SLIP = 870;
SCOUTS_ATTIRE_CLAIM_SLIP = 871;
SAOTOME_ARMOR_CLAIM_SLIP = 872;
KOGA_GARB_CLAIM_SLIP = 873;
WYRM_ARMOR_CLAIM_SLIP = 874;
SUMMONERS_ATTIRE_CLAIM_SLIP = 875;
SCOURSHROOM = 876;
PERCIPIENT_EYE = 877;
NYZUL_ISLE_ASSAULT_ORDERS = 878;
RUNIC_DISC = 879;
RUNIC_KEY = 880;
GYSAHL_MEDAL = 881;
ROSSWEISSES_FEATHER = 882;
GRIMGERDES_FEATHER = 883;
SIEGRUNES_FEATHER = 884;
HELMWIGES_FEATHER = 885;
SCHWERTLEITES_FEATHER = 886;
WALTRAUTES_FEATHER = 887;
ORTLINDES_FEATHER = 888;
GERHILDES_FEATHER = 889;
BRUNHILDES_FEATHER = 890;
MARK_OF_THE_EINHERJAR = 891;
PHOTOPTICATOR = 892;
LUMINIAN_DAGGER = 893;
SL_WILDCAT_BADGE = 894;
BIYAADAS_LETTER = 895;
OFFICER_ACADEMY_MANUAL = 896;
ALLIED_COUNCIL_SUMMONS = 897;
NYZUL_ISLE_ROUTE = 898;
MYTHRIL_MIRROR = 899;
FL_WILDCAT_BADGE = 900;
CHOCOBO_CIRCUIT_GRANDSTAND_PASS = 908;
CAPTAIN_WILDCAT_BADGE = 909;
PURE_WHITE_FEATHER = 910;
STARDUST_PEBBLE = 911;
LEFT_MAP_PIECE = 912;
MIDDLE_MAP_PIECE = 913;
RIGHT_MAP_PIECE = 914;
SEQUINED_BALLISTA_CHEVRON = 915;
VELVET_BALLISTA_CHEVRON = 916;
BATTLE_RATIONS = 917;
CLUMP_OF_ANIMAL_HAIR = 918;
XHIFHUT = 919;
WARNING_LETTER = 920;
RED_RECOMMENDATION_LETTER = 921;
BLUE_RECOMMENDATION_LETTER = 922;
GREEN_RECOMMENDATION_LETTER = 923;
BRONZE_RIBBON_OF_SERVICE = 924;
BRASS_RIBBON_OF_SERVICE = 925;
ALLIED_RIBBON_OF_BRAVERY = 926;
ALLIED_RIBBON_OF_GLORY = 927;
BRONZE_STAR = 928;
STERLING_STAR = 929;
MYTHRIL_STAR = 930;
GOLDEN_STAR = 931;
COPPER_EMBLEM_OF_SERVICE = 932;
IRON_EMBLEM_OF_SERVICE = 933;
STEELKNIGHT_EMBLEM = 934;
HOLYKNIGHT_EMBLEM = 935;
BRASS_WINGS_OF_SERVICE = 936;
MYTHRIL_WINGS_OF_SERVICE = 937;
WINGS_OF_INTEGRITY = 938;
WINGS_OF_HONOR = 939;
STARLIGHT_MEDAL = 940;
MOONLIGHT_MEDAL = 941;
DAWNLIGHT_MEDAL = 942;
MEDAL_OF_ALTANA = 943;
SLICED_POLE = 944;
SUPPLY_ORDER = 945;
GRIMOIRE = 946;
ZONPAZIPPAS_ALLPURPOSE_PUTTY = 947;
SCOOPDEDICATED_LINKPEARL = 948;
FIREPOWER_CASE = 949;
CHARRED_PROPELLER = 950;
PIECE_OF_SHATTERED_LUMBER = 951;
OXIDIZED_PLATE = 952;
PIECE_OF_KIONITE = 953;
RANPIMONPI_SPECIALTY = 954;
CULINARY_KNIFE = 955;
FIREBLOSSOM = 956;
THE_HEALING_HERB = 957;
SMALL_STARFRUIT = 958;
INKY_BLACK_YAGUDO_FEATHER = 959;
CAMPAIGN_SUPPLIES = 960;
MINE_SHAFT_KEY = 961;
THE_ESSENCE_OF_DANCE = 962;
JUGNER_GATE_CRYSTAL = 963;
PASHHOW_GATE_CRYSTAL = 964;
MERIPHATAUD_GATE_CRYSTAL = 965;
VUNKERL_HERB = 966;
VUNKERL_HERB_MEMO = 967;
EVIL_WARDING_SEAL = 968;
ORNATE_PACKAGE = 969;
SHEAF_OF_HANDMADE_INCENSE = 970;
LEATHERBOUND_BOOK = 971;
LYNX_PELT = 972;
WYATTS_PROPOSAL = 973;
FORT_KEY = 974;
ULBRECHTS_SEALED_LETTER = 975;
SCHULTS_SEALED_LETTER = 976;
UNADDRESSED_SEALED_LETTER = 977;
PORTING_MAGIC_TRANSCRIPT = 978;
SAMPLE_OF_GRAUBERG_CHERT = 979;
DROGAROGAN_BONEMEAL = 980;
SLUG_MUCUS = 981;
DJINN_EMBER = 982;
RAFFLESIA_DREAMSPIT = 983;
PEISTE_DUNG = 984;
ULBRECHTS_MORTARBOARD = 985;
BEASTMEN_CONFEDERATE_CRATE = 986;
MILITARY_SCRIP = 987;
SILVERMINE_KEY = 988;
RED_PRIZE_BALLOON = 989;
BLUE_PRIZE_BALLOON = 990;
GREEN_PRIZE_BALLOON = 991;
TRAVONCES_ESCORT_AWARD = 992;
KENS_ESCORT_AWARD = 993;
EMPTINESS_INVESTIGATION_NOTE = 994;
TIGRIS_STONE = 995;
DIAMOND_SEAL = 996;
XICUS_ROSARY = 997;
MAROON_SEAL = 998;
APPLE_GREEN_SEAL = 999;
CHARCOAL_GREY_SEAL = 1000;
DEEP_PURPLE_SEAL = 1001;
CHESTNUT_COLORED_SEAL = 1002;
LILAC_COLORED_SEAL = 1003;
CERISE_SEAL = 1004;
SALMON_COLORED_SEAL = 1005;
PURPLISH_GREY_SEAL = 1006;
GOLD_COLORED_SEAL = 1007;
COPPER_COLORED_SEAL = 1008;
BRIGHT_BLUE_SEAL = 1009;
PINE_GREEN_SEAL = 1010;
AMBER_COLORED_SEAL = 1011;
FALLOW_COLORED_SEAL = 1012;
TAUPE_COLORED_SEAL = 1013;
SIENNA_COLORED_SEAL = 1014;
LAVENDER_COLORED_SEAL = 1015;
SICKLEMOON_SALT = 1016;
SILVER_SEA_SALT = 1017;
CYAN_DEEP_SALT = 1018;
ORCISH_WARMACHINE_BODY = 1019;
PAPAROONS_SEALED_INVITATION = 1020;
DATA_ANALYZER_AND_LOGGER_EX = 1021;
MAYAKOV_SHOW_TICKET = 1022;
SERPENTKING_ZAHAK_RELIEF = 1023;
SAKURA_RACING_BADGE = 1024;
SERPENTKING_ZAHAK_RELIEF_SHARD = 1025;
IMPERIAL_LINEAGE_CHAPTER_I = 1026;
IMPERIAL_LINEAGE_CHAPTER_II = 1027;
IMPERIAL_LINEAGE_CHAPTER_III = 1028;
IMPERIAL_LINEAGE_CHAPTER_IV = 1029;
IMPERIAL_LINEAGE_CHAPTER_V = 1030;
IMPERIAL_LINEAGE_CHAPTER_VI = 1031;
IMPERIAL_LINEAGE_CHAPTER_VII = 1032;
IMPERIAL_LINEAGE_CHAPTER_VIII = 1033;
THE_WORDS_OF_DONHU_I = 1034;
THE_WORDS_OF_DONHU_II = 1035;
THE_WORDS_OF_DONHU_III = 1036;
THE_WORDS_OF_DONHU_IV = 1037;
THE_WORDS_OF_DONHU_V = 1038;
THE_WORDS_OF_DONHU_VI = 1039;
THE_WORDS_OF_DONHU_VII = 1040;
THE_WORDS_OF_DONHU_VIII = 1041;
HABALOS_ECLOGUE_VERSE_I = 1042;
HABALOS_ECLOGUE_VERSE_II = 1043;
HABALOS_ECLOGUE_VERSE_III = 1044;
HABALOS_ECLOGUE_VERSE_IV = 1045;
HABALOS_ECLOGUE_VERSE_V = 1046;
HABALOS_ECLOGUE_VERSE_VI = 1047;
HABALOS_ECLOGUE_VERSE_VII = 1048;
HABALOS_ECLOGUE_VERSE_VIII = 1049;
SIGNAL_FIRECRACKER = 1050;
NUMBER_EIGHT_SHELTER_KEY = 1051;
TORN_PATCHES_OF_LEATHER = 1052;
REPAIRED_HANDBAG = 1053;
MIRAGE_ATTIRE_CLAIM_SLIP = 1054;
COMMODORE_ATTIRE_CLAIM_SLIP = 1055;
PANTIN_ATTIRE_CLAIM_SLIP = 1056;
ETOILE_ATTIRE_CLAIM_SLIP = 1057;
ARGUTE_ATTIRE_CLAIM_SLIP = 1058;
ARGENT_ATTIRE_CLAIM_SLIP = 1059;
CONQUEST_PROMOTION_VOUCHER = 1060;
CERNUNNOS_RESIN = 1061;
COUNT_BORELS_LETTER = 1062;
UNDERPASS_HATCH_KEY = 1063;
BOTTLE_OF_TREANT_TONIC = 1064;
TIMBER_SURVEY_CHECKLIST = 1065;
SNOWTHEMED_GIFT_TOKEN = 1066;
STARTHEMED_GIFT_TOKEN = 1067;
BELLTHEMED_GIFT_TOKEN = 1068;
FLARE_GRENADE = 1069;
RONFAURE_MAPLE_SYRUP = 1070;
LONGLIFE_BISCUITS = 1071;
FLASK_OF_KINGDOM_WATER = 1072;
BISCUIT_A_LA_RHOLONT = 1073;
LETTER_TO_COUNT_AURCHIAT = 1074;
LENGTH_OF_JUGNER_IVY = 1075;
DARKFIRE_CINDER = 1076;
FLOELIGHT_STONE = 1077;
LIQUID_QUICKSILVER = 1078;
GELID_SULFUR = 1079;
BEASTBANE_BULLETS = 1080;
GLEIPNIR = 1081;
SCINTILLANT_STRAND = 1082;
REFULGENT_STRAND = 1083;
IRRADIANT_STRAND = 1084;
BOWL_OF_BLAND_GOBLIN_SALAD = 1085;
JUG_OF_GREASY_GOBLIN_JUICE = 1086;
CHUNK_OF_SMOKED_GOBLIN_GRUB = 1087;
SEEDSPALL_ROSEUM = 1088;
SEEDSPALL_CAERULUM = 1089;
SEEDSPALL_VIRIDIS = 1090;
MARK_OF_SEED = 1091;
AMICITIA_STONE = 1092;
VERITAS_STONE = 1093;
SAPIENTIA_STONE = 1094;
SANCTITAS_STONE = 1095;
FELICITAS_STONE = 1096;
DIVITIA_STONE = 1097;
STUDIUM_STONE = 1098;
AMORIS_STONE = 1099;
CARITAS_STONE = 1100;
CONSTANTIA_STONE = 1101;
SPEI_STONE = 1102;
SALUS_STONE = 1103;
OMNIS_STONE = 1104;
CRIMSON_KEY = 1105;
VIRIDIAN_KEY = 1106;
AMBER_KEY = 1107;
AZURE_KEY = 1108;
IVORY_KEY = 1109;
EBON_KEY = 1110;
DELKFUTT_KEY = 1111;
BEASTBANE_ARROWHEADS = 1112;
RED_LABELED_CRATE = 1113;
BLUE_LABELED_CRATE = 1114;
GREEN_LABELED_CRATE = 1115;
ELITE_TRAINING_INTRODUCTION = 1116;
ELITE_TRAINING_CHAPTER_1 = 1117;
ELITE_TRAINING_CHAPTER_2 = 1118;
ELITE_TRAINING_CHAPTER_3 = 1119;
ELITE_TRAINING_CHAPTER_4 = 1120;
ELITE_TRAINING_CHAPTER_5 = 1121;
ELITE_TRAINING_CHAPTER_6 = 1122;
ELITE_TRAINING_CHAPTER_7 = 1123;
UNADORNED_RING = 1124;
MOG_KUPON_A_DBCD = 1125;
MOG_KUPON_A_DXAR = 1126;
PRISMATIC_KEY = 1127;
SHADOW_BUG = 1128;
WHITE_CORAL_KEY = 1129;
BLUE_CORAL_KEY = 1130;
PEACH_CORAL_KEY = 1131;
BLACK_CORAL_KEY = 1132;
RED_CORAL_KEY = 1133;
ANGEL_SKIN_KEY = 1134;
OXBLOOD_KEY = 1135;
STURDY_METAL_STRIP = 1136;
PIECE_OF_RUGGED_TREE_BARK = 1137;
SAVORY_LAMB_ROAST = 1138;
ORB_OF_SWORDS = 1139;
ORB_OF_CUPS = 1140;
ORB_OF_BATONS = 1141;
ORB_OF_COINS = 1142;
RIPE_STARFRUIT = 1143;
MOLDY_WORMEATEN_CHEST = 1144;
STONE_OF_SURYA = 1145;
STONE_OF_CHANDRA = 1146;
STONE_OF_MANGALA = 1147;
STONE_OF_BUDHA = 1148;
STONE_OF_BRIHASPATI = 1149;
STONE_OF_SHUKRA = 1150;
STONE_OF_SHANI = 1151;
STONE_OF_RAHU = 1152;
STONE_OF_KETU = 1153;
TRIVIA_CHALLENGE_KUPON = 1154;
GAUNTLET_CHALLENGE_KUPON = 1155;
FESTIVAL_SOUVENIR_KUPON = 1156;
POCKET_MOGBOMB = 1157;
NAVARATNA_TALISMAN = 1158;
MEGA_BONANZA_KUPON = 1159;
AROMA_BUG = 1160;
UMBRA_BUG = 1161;
NORTHBOUND_PETITION = 1162;
PONONOS_CHARM = 1163;
DELICATE_WOOL_THREAD = 1164;
DELICATE_LINEN_THREAD = 1165;
DELICATE_COTTON_THREAD = 1166;
ENCHANTED_WOOL_THREAD = 1167;
ENCHANTED_LINEN_THREAD = 1168;
ENCHANTED_COTTON_THREAD = 1169;
WAX_SEAL = 1170;
SACK_OF_VICTUALS = 1171;
COMMANDERS_ENDORSEMENT = 1172;
SUCCULENT_DRAGON_FRUIT = 1173;
SHARD_OF_OPTISTONE = 1174;
SHARD_OF_AURASTONE = 1175;
SHARD_OF_ORASTONE = 1176;
PROSPECTORS_PAN = 1177;
CORKED_AMPOULE = 1178;
AMPOULE_OF_GOLD_DUST = 1179;
VIAL_OF_MILITARY_PRISM_POWDER = 1180;
LANCE_FISH = 1181;
PALADIN_LOBSTER = 1182;
SCUTUM_CRAB = 1183;
MOOGLE_KEY = 1184;
BIRD_KEY = 1185;
CACTUAR_KEY = 1186;
BOMB_KEY = 1187;
CHOCOBO_KEY = 1188;
TONBERRY_KEY = 1189;
BEHEMOTH_KEY = 1190;
DOMINAS_SCARLET_SEAL = 1191;
DOMINAS_CERULEAN_SEAL = 1192;
DOMINAS_EMERALD_SEAL = 1193;
DOMINAS_AMBER_SEAL = 1194;
DOMINAS_VIOLET_SEAL = 1195;
DOMINAS_AZURE_SEAL = 1196;
SCARLET_COUNTERSEAL = 1197;
CERULEAN_COUNTERSEAL = 1198;
EMERALD_COUNTERSEAL = 1199;
AMBER_COUNTERSEAL = 1200;
VIOLET_COUNTERSEAL = 1201;
AZURE_COUNTERSEAL = 1202;
BLACK_BOOK = 1203;
LUMINOUS_RED_FRAGMENT = 1204;
LUMINOUS_BEIGE_FRAGMENT = 1205;
LUMINOUS_GREEN_FRAGMENT = 1206;
LUMINOUS_YELLOW_FRAGMENT = 1207;
LUMINOUS_PURPLE_FRAGMENT = 1208;
LUMINOUS_BLUE_FRAGMENT = 1209;
FIRE_SAP_CRYSTAL = 1210;
WATER_SAP_CRYSTAL = 1211;
WIND_SAP_CRYSTAL = 1212;
EARTH_SAP_CRYSTAL = 1213;
LIGHTNING_SAP_CRYSTAL = 1214;
ICE_SAP_CRYSTAL = 1215;
LIGHT_SAP_CRYSTAL = 1216;
DARK_SAP_CRYSTAL = 1217;
TABLET_OF_HEXES_GREED = 1218;
TABLET_OF_HEXES_ENVY = 1219;
TABLET_OF_HEXES_MALICE = 1220;
TABLET_OF_HEXES_DECEIT = 1221;
TABLET_OF_HEXES_PRIDE = 1222;
TABLET_OF_HEXES_BALE = 1223;
TABLET_OF_HEXES_DESPAIR = 1224;
TABLET_OF_HEXES_REGRET = 1225;
TABLET_OF_HEXES_RAGE = 1226;
TABLET_OF_HEXES_AGONY = 1227;
TABLET_OF_HEXES_DOLOR = 1228;
TABLET_OF_HEXES_RANCOR = 1229;
TABLET_OF_HEXES_STRIFE = 1230;
TABLET_OF_HEXES_PENURY = 1231;
TABLET_OF_HEXES_BLIGHT = 1232;
TABLET_OF_HEXES_DEATH = 1233;
SYNERGY_CRUCIBLE = 1234;
MOG_KUPON_AW_ABS = 1235;
MOG_KUPON_AW_PAN = 1236;
MAGELIGHT_SIGNAL_FLARE = 1237;
ALCHEMICAL_SIGNAL_FLARE = 1238;
DISTRESS_SIGNAL_FLARE = 1239;
IMPERIAL_MISSIVE = 1240;
SANDORIAN_APPROVAL_LETTER = 1241;
BASTOKAN_APPROVAL_LETTER = 1242;
WINDURSTIAN_APPROVAL_LETTER = 1243;
JEUNOAN_APPROVAL_LETTER = 1244;
PRESENT_FOR_MEGOMAK = 1245;
LIGHTNING_CELL = 1246;
MEGOMAKS_SHOPPING_LIST = 1247;
WHISPER_OF_RADIANCE = 1248;
TALISMAN_OF_THE_REBEL_GODS = 1249;
MESSAGE_FROM_YOYOROON = 1250;
WHISPER_OF_GLOOM = 1251;
SPATIAL_PRESSURE_BAROMETER = 1252;
CLEAR_ABYSSITE = 1253;
COLORFUL_ABYSSITE = 1254;
BLUE_ABYSSITE = 1255;
ORANGE_ABYSSITE = 1256;
BROWN_ABYSSITE = 1257;
YELLOW_ABYSSITE = 1258;
PURPLE_ABYSSITE = 1259;
BLACK_ABYSSITE = 1260;
MAGIAN_TRIAL_LOG = 1261;
MOG_KUPON_A_LUM = 1262;
TALISMAN_KEY = 1263;
LETTER_FROM_HALVER = 1264;
LETTER_FROM_NAJI = 1265;
LETTER_FROM_ZUBABA = 1266;
LETTER_FROM_MAAT = 1267;
LETTER_FROM_DESPACHIAIRE = 1268;
LETTER_FROM_JAKOH_WAHCONDALO = 1269;
ZVAHL_PASSKEY = 1270;
TRAVERSER_STONE1 = 1271;
TRAVERSER_STONE2 = 1272;
TRAVERSER_STONE3 = 1273;
TRAVERSER_STONE4 = 1274;
TRAVERSER_STONE5 = 1275;
TRAVERSER_STONE6 = 1276;
POET_GODS_KEY = 1277;
ORCISH_INFILTRATION_KIT = 1278;
ATMA_OF_THE_LION = 1279;
ATMA_OF_THE_STOUT_ARM = 1280;
ATMA_OF_THE_TWIN_CLAW = 1281;
ATMA_OF_ALLURE = 1282;
ATMA_OF_ETERNITY = 1283;
ATMA_OF_THE_HEAVENS = 1284;
ATMA_OF_THE_BAYING_MOON = 1285;
ATMA_OF_THE_EBON_HOOF = 1286;
ATMA_OF_TREMORS = 1287;
ATMA_OF_THE_SAVAGE_TIGER = 1288;
ATMA_OF_THE_VORACIOUS_VIOLET = 1289;
ATMA_OF_CLOAK_AND_DAGGER = 1290;
ATMA_OF_THE_STORMBIRD = 1291;
ATMA_OF_THE_NOXIOUS_FANG = 1292;
ATMA_OF_VICISSITUDE = 1293;
ATMA_OF_THE_BEYOND = 1294;
ATMA_OF_STORMBREATH = 1295;
ATMA_OF_GALES = 1296;
ATMA_OF_THRASHING_TENDRILS = 1297;
ATMA_OF_THE_DRIFTER = 1298;
ATMA_OF_THE_STRONGHOLD = 1299;
ATMA_OF_THE_HARVESTER = 1300;
ATMA_OF_DUNES = 1301;
ATMA_OF_THE_COSMOS = 1302;
ATMA_OF_THE_SIREN_SHADOW = 1303;
ATMA_OF_THE_IMPALER = 1304;
ATMA_OF_THE_ADAMANTINE = 1305;
ATMA_OF_CALAMITY = 1306;
ATMA_OF_THE_CLAW = 1307;
ATMA_OF_BALEFUL_BONES = 1308;
ATMA_OF_THE_CLAWED_BUTTERFLY = 1309;
ATMA_OF_THE_DESERT_WORM = 1310;
ATMA_OF_THE_UNDYING = 1311;
ATMA_OF_THE_IMPREGNABLE_TOWER = 1312;
ATMA_OF_THE_SMOLDERING_SKY = 1313;
ATMA_OF_THE_DEMONIC_SKEWER = 1314;
ATMA_OF_THE_GOLDEN_CLAW = 1315;
ATMA_OF_THE_GLUTINOUS_OOZE = 1316;
ATMA_OF_THE_LIGHTNING_BEAST = 1317;
ATMA_OF_THE_NOXIOUS_BLOOM = 1318;
ATMA_OF_THE_GNARLED_HORN = 1319;
ATMA_OF_THE_STRANGLING_WIND = 1320;
ATMA_OF_THE_DEEP_DEVOURER = 1321;
ATMA_OF_THE_MOUNTED_CHAMPION = 1322;
ATMA_OF_THE_RAZED_RUINS = 1323;
ATMA_OF_THE_BLUDGEONING_BRUTE = 1324;
ATMA_OF_THE_RAPID_REPTILIAN = 1325;
ATMA_OF_THE_WINGED_ENIGMA = 1326;
ATMA_OF_THE_CRADLE = 1327;
ATMA_OF_THE_UNTOUCHED = 1328;
ATMA_OF_THE_SANGUINE_SCYTHE = 1329;
ATMA_OF_THE_TUSKED_TERROR = 1330;
ATMA_OF_THE_MINIKIN_MONSTROSITY = 1331;
ATMA_OF_THE_WOULD_BE_KING = 1332;
ATMA_OF_THE_BLINDING_HORN = 1333;
ATMA_OF_THE_DEMONIC_LASH = 1334;
ATMA_OF_APPARITIONS = 1335;
ATMA_OF_THE_SHIMMERING_SHELL = 1336;
ATMA_OF_THE_MURKY_MIASMA = 1337;
ATMA_OF_THE_AVARICIOUS_APE = 1338;
ATMA_OF_THE_MERCILESS_MATRIARCH = 1339;
ATMA_OF_THE_BROTHER_WOLF = 1340;
ATMA_OF_THE_EARTH_WYRM = 1341;
ATMA_OF_THE_ASCENDING_ONE = 1342;
ATMA_OF_THE_SCORPION_QUEEN = 1343;
ATMA_OF_A_THOUSAND_NEEDLES = 1344;
ATMA_OF_THE_BURNING_EFFIGY = 1345;
ATMA_OF_THE_SMITING_BLOW = 1346;
ATMA_OF_THE_LONE_WOLF = 1347;
ATMA_OF_THE_CRIMSON_SCALE = 1348;
ATMA_OF_THE_SCARLET_WING = 1349;
ATMA_OF_THE_RAISED_TAIL = 1350;
ATMA_OF_THE_SAND_EMPEROR = 1351;
ATMA_OF_THE_OMNIPOTENT = 1352;
ATMA_OF_THE_WAR_LION = 1353;
ATMA_OF_THE_FROZEN_FETTERS = 1354;
ATMA_OF_THE_PLAGUEBRINGER = 1355;
ATMA_OF_THE_SHRIEKING_ONE = 1356;
ATMA_OF_THE_HOLY_MOUNTAIN = 1357;
ATMA_OF_THE_LAKE_LURKER = 1358;
ATMA_OF_THE_CRUSHING_CUDGEL = 1359;
ATMA_OF_PURGATORY = 1360;
ATMA_OF_BLIGHTED_BREATH = 1361;
ATMA_OF_THE_PERSISTENT_PREDATOR = 1362;
ATMA_OF_THE_STONE_GOD = 1363;
ATMA_OF_THE_SUN_EATER = 1364;
ATMA_OF_THE_DESPOT = 1365;
ATMA_OF_THE_SOLITARY_ONE = 1366;
ATMA_OF_THE_WINGED_GLOOM = 1367;
ATMA_OF_THE_SEA_DAUGHTER = 1368;
ATMA_OF_THE_HATEFUL_STREAM = 1369;
ATMA_OF_THE_FOE_FLAYER = 1370;
ATMA_OF_THE_ENDLESS_NIGHTMARE = 1371;
ATMA_OF_THE_SUNDERING_SLASH = 1372;
ATMA_OF_ENTWINED_SERPENTS = 1373;
ATMA_OF_THE_HORNED_BEAST = 1374;
ATMA_OF_AQUATIC_ARDOR = 1375;
ATMA_OF_THE_FALLEN_ONE = 1376;
ATMA_OF_FIRES_AND_FLARES = 1377;
ATMA_OF_THE_APOCALYPSE = 1378;
IVORY_ABYSSITE_OF_SOJOURN = 1379;
SCARLET_ABYSSITE_OF_SOJOURN = 1380;
JADE_ABYSSITE_OF_SOJOURN = 1381;
SAPPHIRE_ABYSSITE_OF_SOJOURN = 1382;
INDIGO_ABYSSITE_OF_SOJOURN = 1383;
EMERALD_ABYSSITE_OF_SOJOURN = 1384;
AZURE_ABYSSITE_OF_CELERITY = 1385;
CRIMSON_ABYSSITE_OF_CELERITY = 1386;
IVORY_ABYSSITE_OF_CELERITY = 1387;
VIRIDIAN_ABYSSITE_OF_AVARICE = 1388;
IVORY_ABYSSITE_OF_AVARICE = 1389;
VERMILLION_ABYSSITE_OF_AVARICE = 1390;
IVORY_ABYSSITE_OF_CONFLUENCE = 1391;
CRIMSON_ABYSSITE_OF_CONFLUENCE = 1392;
INDIGO_ABYSSITE_OF_CONFLUENCE = 1393;
IVORY_ABYSSITE_OF_EXPERTISE = 1394;
JADE_ABYSSITE_OF_EXPERTISE = 1395;
EMERALD_ABYSSITE_OF_EXPERTISE = 1396;
IVORY_ABYSSITE_OF_FORTUNE = 1397;
SAPPHIRE_ABYSSITE_OF_FORTUNE = 1398;
EMERALD_ABYSSITE_OF_FORTUNE = 1399;
SCARLET_ABYSSITE_OF_KISMET = 1400;
IVORY_ABYSSITE_OF_KISMET = 1401;
VERMILLION_ABYSSITE_OF_KISMET = 1402;
AZURE_ABYSSITE_OF_PROSPERITY = 1403;
JADE_ABYSSITE_OF_PROSPERITY = 1404;
IVORY_ABYSSITE_OF_PROSPERITY = 1405;
VIRIDIAN_ABYSSITE_OF_DESTINY = 1406;
CRIMSON_ABYSSITE_OF_DESTINY = 1407;
IVORY_ABYSSITE_OF_DESTINY = 1408;
IVORY_ABYSSITE_OF_ACUMEN = 1409;
CRIMSON_ABYSSITE_OF_ACUMEN = 1410;
EMERALD_ABYSSITE_OF_ACUMEN = 1411;
SCARLET_ABYSSITE_OF_LENITY = 1412;
AZURE_ABYSSITE_OF_LENITY = 1413;
VIRIDIAN_ABYSSITE_OF_LENITY = 1414;
JADE_ABYSSITE_OF_LENITY = 1415;
SAPPHIRE_ABYSSITE_OF_LENITY = 1416;
CRIMSON_ABYSSITE_OF_LENITY = 1417;
VERMILLION_ABYSSITE_OF_LENITY = 1418;
INDIGO_ABYSSITE_OF_LENITY = 1419;
EMERALD_ABYSSITE_OF_LENITY = 1420;
SCARLET_ABYSSITE_OF_PERSPICACITY = 1421;
IVORY_ABYSSITE_OF_PERSPICACITY = 1422;
VERM_ABYSSITE_OF_PERSPICACITY = 1423;
AZURE_ABYSSITE_OF_THE_REAPER = 1424;
IVORY_ABYSSITE_OF_THE_REAPER = 1425;
INDIGO_ABYSSITE_OF_THE_REAPER = 1426;
VIRIDIAN_ABYSSITE_OF_GUERDON = 1427;
IVORY_ABYSSITE_OF_GUERDON = 1428;
VERMILLION_ABYSSITE_OF_GUERDON = 1429;
SCARLET_ABYSSITE_OF_FURTHERANCE = 1430;
SAPPHIRE_ABYSSITE_OF_FURTHERANCE = 1431;
IVORY_ABYSSITE_OF_FURTHERANCE = 1432;
AZURE_ABYSSITE_OF_MERIT = 1433;
VIRIDIAN_ABYSSITE_OF_MERIT = 1434;
JADE_ABYSSITE_OF_MERIT = 1435;
SAPPHIRE_ABYSSITE_OF_MERIT = 1436;
IVORY_ABYSSITE_OF_MERIT = 1437;
INDIGO_ABYSSITE_OF_MERIT = 1438;
LUNAR_ABYSSITE1 = 1439;
LUNAR_ABYSSITE2 = 1440;
LUNAR_ABYSSITE3 = 1441;
ABYSSITE_OF_DISCERNMENT = 1442;
ABYSSITE_OF_THE_COSMOS = 1443;
WHITE_STRATUM_ABYSSITE = 1444;
WHITE_STRATUM_ABYSSITE_II = 1445;
WHITE_STRATUM_ABYSSITE_III = 1446;
ASHEN_STRATUM_ABYSSITE = 1447;
ASHEN_STRATUM_ABYSSITE_II = 1448;
ASHEN_STRATUM_ABYSSITE_III = 1449;
WHITE_STRATUM_ABYSSITE_IV = 1450;
WHITE_STRATUM_ABYSSITE_V = 1451;
WHITE_STRATUM_ABYSSITE_VI = 1452;
LEGION_TOME_PAGE_MAXIMUS = 1453;
LEGION_MEDAL_AN = 1454;
LEGION_MEDAL_KI = 1455;
LEGION_MEDAL_IM = 1456;
LEGION_MEDAL_MURU = 1457;
LEGION_TOME_PAGE_MINIMUS = 1458;
FRAGRANT_TREANT_PETAL = 1459;
FETID_RAFFLESIA_STALK = 1460;
DECAYING_MORBOL_TOOTH = 1461;
TURBID_SLIME_OIL = 1462;
VENOMOUS_PEISTE_CLAW = 1463;
TATTERED_HIPPOGRYPH_WING = 1464;
CRACKED_WIVRE_HORN = 1465;
MUCID_AHRIMAN_EYEBALL = 1466;
TWISTED_TONBERRY_CROWN = 1467;
VEINOUS_HECTEYES_EYELID = 1468;
TORN_BAT_WING = 1469;
GORY_SCORPION_CLAW = 1470;
MOSSY_ADAMANTOISE_SHELL = 1471;
FAT_LINED_COCKATRICE_SKIN = 1472;
SODDEN_SANDWORM_HUSK = 1473;
LUXURIANT_MANTICORE_MANE = 1474;
STICKY_GNAT_WING = 1475;
OVERGROWN_MANDRAGORA_FLOWER = 1476;
CHIPPED_SANDWORM_TOOTH = 1477;
MARBLED_MUTTON_CHOP = 1478;
BLOODIED_SABER_TOOTH = 1479;
BLOOD_SMEARED_GIGAS_HELM = 1480;
GLITTERING_PIXIE_CHOKER = 1481;
DENTED_GIGAS_SHIELD = 1482;
WARPED_GIGAS_ARMBAND = 1483;
SEVERED_GIGAS_COLLAR = 1484;
PELLUCID_FLY_EYE = 1485;
SHIMMERING_PIXIE_PINION = 1486;
SMOLDERING_CRAB_SHELL = 1487;
VENOMOUS_WAMOURA_FEELER = 1488;
BULBOUS_CRAWLER_COCOON = 1489;
DISTENDED_CHIGOE_ABDOMEN = 1490;
MUCID_WORM_SEGMENT = 1491;
SHRIVELED_HECTEYES_STALK = 1492;
BLOTCHED_DOOMED_TONGUE = 1493;
CRACKED_SKELETON_CLAVICLE = 1494;
WRITHING_GHOST_FINGER = 1495;
RUSTED_HOUND_COLLAR = 1496;
HOLLOW_DRAGON_EYE = 1497;
BLOODSTAINED_BUGARD_FANG = 1498;
GNARLED_LIZARD_NAIL = 1499;
MOLTED_PEISTE_SKIN = 1500;
JAGGED_APKALLU_BEAK = 1501;
CLIPPED_BIRD_WING = 1502;
BLOODIED_BAT_FUR = 1503;
GLISTENING_OROBON_LIVER = 1504;
DOFFED_POROGGO_HAT = 1505;
SCALDING_IRONCLAD_SPIKE = 1506;
BLAZING_CLUSTER_SOUL = 1507;
INGROWN_TAURUS_NAIL = 1508;
OSSIFIED_GARGOUILLE_HAND = 1509;
IMBRUED_VAMPYR_FANG = 1510;
GLOSSY_SEA_MONK_SUCKER = 1511;
SHIMMERING_PUGIL_SCALE = 1512;
DECAYED_DVERGR_TOOTH = 1513;
PULSATING_SOULFLAYER_BEARD = 1514;
CHIPPED_IMPS_OLIFANT = 1515;
WARPED_SMILODON_CHOKER = 1516;
MALODOROUS_MARID_FUR = 1517;
BROKEN_IRON_GIANT_SPIKE = 1518;
RUSTED_CHARIOT_GEAR = 1519;
STEAMING_CERBERUS_TONGUE = 1520;
BLOODIED_DRAGON_EAR = 1521;
RESPLENDENT_ROC_QUILL = 1522;
WARPED_IRON_GIANT_NAIL = 1523;
DENTED_CHARIOT_SHIELD = 1524;
TORN_KHIMAIRA_WING = 1525;
BEGRIMED_DRAGON_HIDE = 1526;
DECAYING_DIREMITE_FANG = 1527;
SHATTERED_IRON_GIANT_CHAIN = 1528;
WARPED_CHARIOT_PLATE = 1529;
VENOMOUS_HYDRA_FANG = 1530;
VACANT_BUGARD_EYE = 1531;
VARIEGATED_URAGNITE_SHELL = 1532;
BATTLE_TROPHY_1ST_ECHELON = 1533;
BATTLE_TROPHY_2ND_ECHELON = 1534;
BATTLE_TROPHY_3RD_ECHELON = 1535;
BATTLE_TROPHY_4TH_ECHELON = 1536;
BATTLE_TROPHY_5TH_ECHELON = 1537;
CRIMSON_TRAVERSER_STONE = 1538;
VOIDSTONE1 = 1539;
VOIDSTONE2 = 1540;
VOIDSTONE3 = 1541;
VOIDSTONE4 = 1542;
VOIDSTONE5 = 1543;
VOIDSTONE6 = 1544;
CRIMSON_GRANULES_OF_TIME = 1545;
AZURE_GRANULES_OF_TIME = 1546;
AMBER_GRANULES_OF_TIME = 1547;
ALABASTER_GRANULES_OF_TIME = 1548;
OBSIDIAN_GRANULES_OF_TIME = 1549;
PRISMATIC_HOURGLASS = 1550;
MOG_KUPON_W_R90 = 1551;
MOG_KUPON_W_M90 = 1552;
MOG_KUPON_W_E90 = 1553;
MOG_KUPON_A_E2 = 1554;
MOG_KUPON_I_SEAL = 1555;
BEGUILING_PETRIFACT = 1556;
SEDUCTIVE_PETRIFACT = 1557;
MADDENING_PETRIFACT = 1558;
VAT_OF_MARTELLO_FUEL = 1559;
FUEL_RESERVOIR = 1560;
EMPTY_FUEL_VAT = 1561;
CRACKED_FUEL_RESERVOIR = 1562;
VIAL_OF_LAMBENT_POTION = 1563;
CLEAR_DEMILUNE_ABYSSITE = 1564;
COLORFUL_DEMILUNE_ABYSSITE = 1565;
SCARLET_DEMILUNE_ABYSSITE = 1566;
AZURE_DEMILUNE_ABYSSITE = 1567;
VIRIDIAN_DEMILUNE_ABYSSITE = 1568;
ANTI_ABYSSEAN_GRENADE_01 = 1569;
ANTI_ABYSSEAN_GRENADE_02 = 1570;
ANTI_ABYSSEAN_GRENADE_03 = 1571;
RAINBOW_PEARL = 1572;
CHIPPED_WIND_CLUSTER = 1573;
PIECE_OF_DRIED_EBONY_LUMBER = 1574;
CAPTAIN_RASHIDS_LINKPEARL = 1575;
CAPTAIN_ARGUSS_LINKPEARL = 1576;
CAPTAIN_HELGAS_LINKPEARL = 1577;
SEAL_OF_THE_RESISTANCE = 1578;
SUNBEAM_FRAGMENT = 1579;
LUGARHOOS_EYEBALL = 1580;
VIAL_OF_PURIFICATION_AGENT_BLK = 1581;
VIAL_OF_PURIFICATION_AGENT_BRZ = 1582;
VIAL_OF_PURIFICATION_AGENT_SLV = 1583;
VIAL_OF_PURIFICATION_AGENT_GLD = 1584;
BLACK_LABELED_VIAL = 1585;
BRONZE_LABELED_VIAL = 1586;
SILVER_LABELED_VIAL = 1587;
GOLD_LABELED_VIAL = 1588;
RAINBOW_COLORED_LINKPEARL = 1589;
GREY_ABYSSITE = 1590;
RIPE_STARFRUIT_ABYSSEA = 1591;
VIAL_OF_FLOWER_WOWER_FERTILIZER = 1592;
TAHRONGI_TREE_NUT = 1593;
BUCKET_OF_COMPOUND_COMPOST = 1594;
CUP_OF_TAHRONGI_CACTUS_WATER = 1595;
HASTILY_SCRAWLED_POSTER = 1596;
BLOODIED_ARROW = 1597;
CRIMSON_BLOODSTONE = 1598;
KUPOFRIEDS_MEDALLION = 1599;
PINCH_OF_MOIST_DANGRUF_SULFUR = 1600;
NAJIS_GAUGER_PLATE = 1601;
NAJIS_LINKPEARL = 1602;
POT_OF_MARTIAL_RELISH = 1603;
THIERRIDES_BEAN_CREATION = 1604;
TINY_MEMORY_FRAGMENT1 = 1605;
LARGE_MEMORY_FRAGMENT1 = 1606;
FEY_STONE = 1607;
LARGE_MEMORY_FRAGMENT2 = 1608;
TORN_RECIPE_PAGE = 1609;
MINERAL_GAUGE_FOR_DUMMIES = 1610;
TUBE_OF_ALCHEMICAL_FERTILIZER = 1611;
LARGE_MEMORY_FRAGMENT3 = 1612;
LARGE_MEMORY_FRAGMENT4 = 1613;
PULSE_MARTELLO_REPAIR_PACK = 1614;
CLONE_WARD_REINFORCEMENT_PACK = 1615;
PACK_OF_OUTPOST_REPAIR_TOOLS = 1616;
PARRADAMO_SUPPLY_PACK1 = 1617;
PARRADAMO_SUPPLY_PACK2 = 1618;
PARRADAMO_SUPPLY_PACK3 = 1619;
PARRADAMO_SUPPLY_PACK4 = 1620;
PARRADAMO_SUPPLY_PACK5 = 1621;
GASPONIA_STAMEN = 1622;
ROCKHOPPER = 1623;
PHIAL_OF_COUNTERAGENT = 1624;
DAMAGED_STEWPOT = 1625;
NARURUS_STEWPOT = 1626;
MAGICKED_HEMPEN_SACK = 1627;
MAGICKED_FLAXEN_SACK = 1628;
PARALYSIS_TRAP_FLUID = 1629;
PARALYSIS_TRAP_FLUID_BOTTLE = 1630;
WEAKENING_TRAP_FLUID = 1631;
WEAKENING_TRAP_FLUID_BOTTLE = 1632;
IRON_EATERS_PEARLSACK = 1633;
MEDICAL_SUPPLY_CHEST = 1635;
WOODWORKERS_BELT = 1636;
ESPIONAGE_PEARLSACK = 1637;
CHIPPED_LINKSHELL = 1638;
GRIMY_LINKSHELL = 1639;
CRACKED_LINKSHELL = 1640;
POCKET_SUPPLY_PACK = 1641;
STANDARD_SUPPLY_PACK = 1642;
HEFTY_SUPPLY_PACK = 1643;
PACK_OF_MOLTEN_SLAG = 1644;
LETTER_OF_RECEIPT = 1645;
SMUDGED_LETTER = 1646;
YELLOW_LINKPEARL = 1647;
JESTERS_HAT = 1648;
JADE_DEMILUNE_ABYSSITE = 1649;
SAPPHIRE_DEMILUNE_ABYSSITE = 1650;
CRIMSON_DEMILUNE_ABYSSITE = 1651;
EMERALD_DEMILUNE_ABYSSITE = 1652;
VERMILLION_DEMILUNE_ABYSSITE = 1653;
INDIGO_DEMILUNE_ABYSSITE = 1654;
ATMA_OF_THE_HEIR = 1655;
ATMA_OF_THE_HERO = 1656;
ATMA_OF_THE_FULL_MOON = 1657;
ATMA_OF_ILLUSIONS = 1658;
ATMA_OF_THE_BANISHER = 1659;
ATMA_OF_THE_SELLSWORD = 1660;
ATMA_OF_A_FUTURE_FABULOUS = 1661;
ATMA_OF_CAMARADERIE = 1662;
ATMA_OF_THE_TRUTHSEEKER = 1663;
ATMA_OF_THE_AZURE_SKY = 1664;
ATMA_OF_ECHOES = 1665;
ATMA_OF_DREAD = 1666;
ATMA_OF_AMBITION = 1667;
ATMA_OF_THE_BEAST_KING = 1668;
ATMA_OF_THE_KIRIN = 1669;
ATMA_OF_HELLS_GUARDIAN = 1670;
ATMA_OF_LUMINOUS_WINGS = 1671;
ATMA_OF_THE_DRAGON_RIDER = 1672;
ATMA_OF_THE_IMPENETRABLE = 1673;
ATMA_OF_ALPHA_AND_OMEGA = 1674;
ATMA_OF_THE_ULTIMATE = 1675;
ATMA_OF_THE_HYBRID_BEAST = 1676;
ATMA_OF_THE_DARK_DEPTHS = 1677;
ATMA_OF_THE_ZENITH = 1678;
ATMA_OF_PERFECT_ATTENDANCE = 1679;
ATMA_OF_THE_RESCUER = 1680;
ATMA_OF_NIGHTMARES = 1681;
ATMA_OF_THE_EINHERJAR = 1682;
ATMA_OF_THE_ILLUMINATOR = 1683;
ATMA_OF_THE_BUSHIN = 1684;
ATMA_OF_THE_ACE_ANGLER = 1685;
ATMA_OF_THE_MASTER_CRAFTER = 1686;
ATMA_OF_INGENUITY = 1687;
ATMA_OF_THE_GRIFFONS_CLAW = 1688;
ATMA_OF_THE_FETCHING_FOOTPAD = 1689;
ATMA_OF_UNDYING_LOYALTY = 1690;
ATMA_OF_THE_ROYAL_LINEAGE = 1691;
ATMA_OF_THE_SHATTERING_STAR = 1692;
ATMA_OF_THE_COBRA_COMMANDER = 1693;
ATMA_OF_ROARING_LAUGHTER = 1694;
ATMA_OF_THE_DARK_BLADE = 1695;
ATMA_OF_THE_DUCAL_GUARD = 1696;
ATMA_OF_HARMONY = 1697;
ATMA_OF_REVELATIONS = 1698;
ATMA_OF_THE_SAVIOR = 1699;
TINY_MEMORY_FRAGMENT2 = 1700;
TINY_MEMORY_FRAGMENT3 = 1701;
EX_01_MARTELLO_CORE = 1702;
EX_02_MARTELLO_CORE = 1703;
EX_03_MARTELLO_CORE = 1704;
EX_04_MARTELLO_CORE = 1705;
EX_05_MARTELLO_CORE = 1706;
EX_06_MARTELLO_CORE = 1707;
EX_07_MARTELLO_CORE = 1708;
MOG_KUPON_W_E85 = 1709;
MOG_KUPON_A_RJOB = 1710;
SILVER_POCKET_WATCH = 1711;
ELEGANT_GEMSTONE = 1712;
WIVRE_EGG1 = 1713;
WIVRE_EGG2 = 1714;
WIVRE_EGG3 = 1715;
TORCH_COAL = 1716;
SUBNIVEAL_MINES = 1717;
PIECE_OF_SODDEN_OAK_LUMBER = 1718;
SODDEN_LINEN_CLOTH = 1719;
DHORME_KHIMAIRAS_MANE = 1720;
IMPERIAL_PEARL = 1721;
RONFAURE_DAWNDROP = 1722;
LA_VAULE_DAWNDROP = 1723;
JUGNER_DAWNDROP = 1724;
BEAUCEDINE_DAWNDROP = 1725;
XARCABARD_DAWNDROP = 1726;
THRONE_ROOM_DAWNDROP = 1727;
WALK_OF_ECHOES_DAWNDROP = 1728;
SANDORIA_DAWNDROP = 1729;
BOTTLED_PUNCH_BUG = 1730;
PRIMAL_GLOW = 1731;
MOONSHADE_EARRING = 1732;
PINCH_OF_PIXIE_DUST = 1733;
WEDDING_INVITATION = 1734;
SNOLL_REFLECTOR = 1735;
FROSTED_SNOLL_REFLECTOR = 1736;
EXPERIMENT_CHEAT_SHEET = 1737;
JOB_GESTURE_WARRIOR = 1738;
JOB_GESTURE_MONK = 1739;
JOB_GESTURE_WHITE_MAGE = 1740;
JOB_GESTURE_BLACK_MAGE = 1741;
JOB_GESTURE_RED_MAGE = 1742;
JOB_GESTURE_THIEF = 1743;
JOB_GESTURE_PALADIN = 1744;
JOB_GESTURE_DARK_KNIGHT = 1745;
JOB_GESTURE_BEASTMASTER = 1746;
JOB_GESTURE_BARD = 1747;
JOB_GESTURE_RANGER = 1748;
JOB_GESTURE_SAMURAI = 1749;
JOB_GESTURE_NINJA = 1750;
JOB_GESTURE_DRAGOON = 1751;
JOB_GESTURE_SUMMONER = 1752;
JOB_GESTURE_BLUE_MAGE = 1753;
JOB_GESTURE_CORSAIR = 1754;
JOB_GESTURE_PUPPETMASTER = 1755;
JOB_GESTURE_DANCER = 1756;
JOB_GESTURE_SCHOLAR = 1757;
FROSTBLOOM1 = 1758;
FROSTBLOOM2 = 1759;
FROSTBLOOM3 = 1760;
MOON_PENDANT = 1761;
WYVERN_EGG = 1762;
WYVERN_EGG_SHELL = 1763;
WAUGYLS_CLAW = 1764;
BOTTLE_OF_MILITARY_INK = 1765;
MILITARY_INK_PACKAGE = 1766;
MAGIAN_LEARNERS_LOG = 1767;
MAGIAN_MOOGLEHOOD_MISSIVE1 = 1768;
MAGIAN_MOOGLEHOOD_MISSIVE2 = 1769;
MAGIAN_MOOGLEHOOD_MISSIVE3 = 1770;
MAGIAN_MOOGLEHOOD_MISSIVE4 = 1771;
MAGIAN_MOOGLEHOOD_MISSIVE5 = 1772;
MAGIAN_MOOGLEHOOD_MISSIVE6 = 1773;
PERIAPT_OF_EMERGENCE1 = 1774;
PERIAPT_OF_EMERGENCE2 = 1775;
PERIAPT_OF_EMERGENCE3 = 1776;
PERIAPT_OF_GUIDANCE = 1777;
PERIAPT_OF_PERCIPIENCE = 1778;
VIVID_PERIAPT_OF_CONCORD = 1779;
DUSKY_PERIAPT_OF_CONCORD = 1780;
VIVID_PERIAPT_OF_CATALYSIS = 1781;
DUSKY_PERIAPT_OF_CATALYSIS = 1782;
VIVID_PERIAPT_OF_EXPLORATION = 1783;
DUSKY_PERIAPT_OF_EXPLORATION = 1784;
VIVID_PERIAPT_OF_FRONTIERS = 1785;
DUSKY_PERIAPT_OF_FRONTIERS = 1786;
NEUTRAL_PERIAPT_OF_FRONTIERS = 1787;
VIVID_PERIAPT_OF_CONCENTRATION = 1788;
DUSKY_PERIAPT_OF_CONCENTRATION = 1789;
VIVID_PERIAPT_OF_GLORY = 1790;
DUSKY_PERIAPT_OF_GLORY = 1791;
VIVID_PERIAPT_OF_FOCUS = 1792;
DUSKY_PERIAPT_OF_FOCUS = 1793;
VIVID_PERIAPT_OF_INTENSITY = 1794;
DUSKY_PERIAPT_OF_INTENSITY = 1795;
VIVID_PERIAPT_OF_READINESS = 1796;
DUSKY_PERIAPT_OF_READINESS = 1797;
VIVID_PERIAPT_OF_ADAPTABILITY = 1798;
DUSKY_PERIAPT_OF_ADAPTABILITY = 1799;
VIVID_PERIAPT_OF_VIGILANCE = 1800;
DUSKY_PERIAPT_OF_VIGILANCE = 1801;
VIVID_PERIAPT_OF_PRUDENCE = 1802;
DUSKY_PERIAPT_OF_PRUDENCE = 1803;
PERIAPT_OF_RECOMPENSE = 1804;
VOID_CLUSTER = 1805;
ATMACITE_OF_DEVOTION = 1806;
ATMACITE_OF_PERSISTENCE = 1807;
ATMACITE_OF_EMINENCE = 1808;
ATMACITE_OF_ONSLAUGHT = 1809;
ATMACITE_OF_INCURSION = 1810;
ATMACITE_OF_ENTICEMENT = 1811;
ATMACITE_OF_DESTRUCTION = 1812;
ATMACITE_OF_TEMPERANCE = 1813;
ATMACITE_OF_DISCIPLINE = 1814;
ATMACITE_OF_COERCION = 1815;
ATMACITE_OF_FINESSE = 1816;
ATMACITE_OF_LATITUDE = 1817;
ATMACITE_OF_MYSTICISM = 1818;
ATMACITE_OF_RAPIDITY = 1819;
ATMACITE_OF_PREPAREDNESS = 1820;
ATMACITE_OF_DELUGES = 1821;
ATMACITE_OF_UNITY = 1822;
ATMACITE_OF_EXHORTATION = 1823;
ATMACITE_OF_SKYBLAZE = 1824;
ATMACITE_OF_THE_SLAYER = 1825;
ATMACITE_OF_THE_ADAMANT = 1826;
ATMACITE_OF_THE_VALIANT = 1827;
ATMACITE_OF_THE_SHREWD = 1828;
ATMACITE_OF_THE_VANGUARD = 1829;
ATMACITE_OF_ASSAILMENT = 1830;
ATMACITE_OF_CATAPHRACT = 1831;
ATMACITE_OF_THE_PARAPET = 1832;
ATMACITE_OF_IMPERIUM = 1833;
ATMACITE_OF_THE_SOLIPSIST = 1834;
ATMACITE_OF_PROVENANCE = 1835;
ATMACITE_OF_DARK_DESIGNS = 1836;
ATMACITE_OF_THE_FORAGER = 1837;
ATMACITE_OF_GLACIERS = 1838;
ATMACITE_OF_AFFINITY = 1839;
ATMACITE_OF_THE_DEPTHS = 1840;
ATMACITE_OF_THE_ASSASSIN = 1841;
ATMACITE_OF_APLOMB = 1842;
ATMACITE_OF_THE_TROPICS = 1843;
ATMACITE_OF_CURSES = 1844;
ATMACITE_OF_PRESERVATION = 1845;
POUCH_OF_WEIGHTED_STONES = 1846;
GOSSAMER_BALLISTA_CHEVRON = 1847;
STEEL_BALLISTA_CHEVRON = 1848;
PERIAPT_OF_SAPIENCE = 1854;
PERIAPT_OF_CLARITY = 1855;
MAP_OF_AL_ZAHBI = 1856;
MAP_OF_NASHMAU = 1857;
MAP_OF_WAJAOM_WOODLANDS = 1858;
MAP_OF_CAEDARVA_MIRE = 1859;
MAP_OF_MOUNT_ZHAYOLM = 1860;
MAP_OF_AYDEEWA_SUBTERRANE = 1861;
MAP_OF_MAMOOK = 1862;
MAP_OF_HALVUNG = 1863;
MAP_OF_ARRAPAGO_REEF = 1864;
MAP_OF_ALZADAAL_RUINS = 1865;
MAP_OF_LEUJAOAM_SANCTUM = 1866;
MAP_OF_THE_TRAINING_GROUNDS = 1867;
MAP_OF_LEBROS_CAVERN = 1868;
MAP_OF_ILRUSI_ATOLL = 1869;
MAP_OF_PERIQIA = 1870;
MAP_OF_NYZUL_ISLE = 1871;
MAP_OF_THE_CHOCOBO_CIRCUIT = 1872;
MAP_OF_THE_COLOSSEUM = 1873;
MAP_OF_BHAFLAU_THICKETS = 1874;
MAP_OF_ZHAYOLM_REMNANTS = 1875;
MAP_OF_ARRAPAGO_REMNANTS = 1876;
MAP_OF_BHAFLAU_REMNANTS = 1877;
MAP_OF_SILVER_SEA_REMNANTS = 1878;
MAP_OF_VUNKERL_INLET = 1879;
MAP_OF_EVERBLOOM_HOLLOW = 1880;
MAP_OF_GRAUBERG = 1881;
MAP_OF_RUHOTZ_SILVERMINES = 1882;
MAP_OF_FORT_KARUGONARUGO = 1883;
MAP_OF_GHOYUS_REVERIE = 1884;
MAP_OF_ABYSSEA_LA_THEINE = 1885;
MAP_OF_ABYSSEA_KONSCHTAT = 1886;
MAP_OF_ABYSSEA_TAHRONGI = 1887;
MAP_OF_ABYSSEA_ATTOHWA = 1888;
MAP_OF_ABYSSEA_MISAREAUX = 1889;
MAP_OF_ABYSSEA_VUNKERL = 1890;
MAP_OF_ABYSSEA_ALTEPA = 1891;
MAP_OF_ABYSSEA_ULEGUERAND = 1892;
MAP_OF_ABYSSEA_GRAUBERG = 1893;
MAP_OF_DYNAMIS_SANDORIA = 1894;
MAP_OF_DYNAMIS_BASTOK = 1895;
MAP_OF_DYNAMIS_WINDURST = 1896;
MAP_OF_DYNAMIS_JEUNO = 1897;
MAP_OF_DYNAMIS_BEAUCEDINE = 1898;
MAP_OF_DYNAMIS_XARCABARD = 1899;
MAP_OF_DYNAMIS_VALKURM = 1900;
MAP_OF_DYNAMIS_BUBURIMU = 1901;
MAP_OF_DYNAMIS_QUFIM = 1902;
MAP_OF_DYNAMIS_TAVNAZIA = 1903;
MAP_OF_ADOULIN = 1904;
MAP_OF_RALA_WATERWAYS = 1905;
MAP_OF_YAHSE_HUNTING_GROUNDS = 1906;
MAP_OF_CEIZAK_BATTLEGROUNDS = 1907;
MAP_OF_FORET_DE_HENNETIEL = 1908;
MAP_OF_YORCIA_WEALD = 1909;
MAP_OF_MORIMAR_BASALT_FIELDS = 1910;
MAP_OF_MARJAMI_RAVINE = 1911;
MAP_OF_KAMIHR_DRIFTS = 1912;
MAP_OF_SIH_GATES = 1913;
MAP_OF_MOH_GATES = 1914;
MAP_OF_CIRDAS_CAVERNS = 1915;
MAP_OF_DHO_GATES = 1916;
MAP_OF_WOH_GATES = 1917;
MAP_OF_OUTER_RAKAZNAR = 1918;
IRON_CHAINMAIL_CLAIM_SLIP = 1920;
SHADE_HARNESS_CLAIM_SLIP = 1921;
BRASS_SCALE_MAIL_CLAIM_SLIP = 1922;
WOOL_ROBE_CLAIM_SLIP = 1923;
EISENPLATTE_ARMOR_CLAIM_SLIP = 1924;
SOIL_GI_CLAIM_SLIP = 1925;
SEERS_TUNIC_CLAIM_SLIP = 1926;
STUDDED_ARMOR_CLAIM_SLIP = 1927;
CENTURION_SCALE_MAIL_CLAIM_SLIP = 1928;
MRCCPT_DOUBLET_CLAIM_SLIP = 1929;
GARISH_TUNIC_CLAIM_SLIP = 1930;
NOCT_DOUBLET_CLAIM_SLIP = 1931;
CUSTOM_ARMOR_MALE_CLAIM_SLIP = 1932;
CUSTOM_ARMOR_FEMALE_CLAIM_SLIP = 1933;
MAGNA_ARMOR_MALE_CLAIM_SLIP = 1934;
MAGNA_ARMOR_FEMALE_CLAIM_SLIP = 1935;
WONDER_ARMOR_CLAIM_SLIP = 1936;
SAVAGE_ARMOR_CLAIM_SLIP = 1937;
ELDER_ARMOR_CLAIM_SLIP = 1938;
LINEN_CLOAK_CLAIM_SLIP = 1939;
PADDED_ARMOR_CLAIM_SLIP = 1940;
SILVER_CHAINMAIL_CLAIM_SLIP = 1941;
GAMBISON_CLAIM_SLIP = 1942;
IRON_SCALE_ARMOR_CLAIM_SLIP = 1943;
CUIR_ARMOR_CLAIM_SLIP = 1944;
VELVET_ROBE_CLAIM_SLIP = 1945;
OPALINE_DRESS_CLAIM_SLIP = 1946;
RYLSQR_CHAINMAIL_CLAIM_SLIP = 1947;
PLATE_ARMOR_CLAIM_SLIP = 1948;
COMBAT_CASTERS_CLOAK_CLAIM_SLIP = 1949;
ALUMINE_HAUBERT_CLAIM_SLIP = 1950;
CARAPACE_HARNESS_CLAIM_SLIP = 1951;
BANDED_MAIL_CLAIM_SLIP = 1952;
HARA_ATE_CLAIM_SLIP = 1953;
RAPTOR_ARMOR_CLAIM_SLIP = 1954;
STEEL_SCALE_CLAIM_SLIP = 1955;
WOOL_GAMBISON_CLAIM_SLIP = 1956;
SHINOBI_GI_CLAIM_SLIP = 1957;
IRNMSK_CUIRASS_CLAIM_SLIP = 1958;
TCTMGC_CLOAK_CLAIM_SLIP = 1959;
WHITE_CLOAK_CLAIM_SLIP = 1960;
AUSTERE_ROBE_CLAIM_SLIP = 1961;
MYTHRIL_PLATE_ARMOR_CLAIM_SLIP = 1962;
CROW_JUPON_CLAIM_SLIP = 1963;
MAGUS_ATTIRE_CLAIM_SLIP = 1964;
CORSAIRS_ATTIRE_CLAIM_SLIP = 1965;
PUPPETRY_ATTIRE_CLAIM_SLIP = 1966;
DANCERS_ATTIRE_CLAIM_SLIP = 1967;
DANCERS_ATTIRE_CLAIM_SLIP = 1968;
SCHOLARS_ATTIRE_CLAIM_SLIP = 1969;
AMIR_ARMOR_CLAIM_SLIP = 1970;
PAHLUWAN_ARMOR_CLAIM_SLIP = 1971;
YIGIT_ARMOR_CLAIM_SLIP = 1972;
FROG_FISHING = 1976;
SERPENT_RUMORS = 1977;
MOOCHING = 1978;
ANGLERS_ALMANAC = 1979;
SPIFFY_SYNTH1 = 1980;
SPIFFY_SYNTH2 = 1981;
SPIFFY_SYNTH3 = 1982;
SPIFFY_SYNTH4 = 1983;
WOOD_PURIFICATION = 1984;
WOOD_ENSORCELLMENT = 1985;
LUMBERJACK = 1986;
BOLTMAKER = 1987;
WAY_OF_THE_CARPENTER = 1988;
SPIFFY_SYNTH5 = 1989;
SPIFFY_SYNTH6 = 1990;
SPIFFY_SYNTH7 = 1991;
METAL_PURIFICATION = 1992;
METAL_ENSORCELLMENT = 1993;
CHAINWORK = 1994;
SHEETING = 1995;
WAY_OF_THE_BLACKSMITH = 1996;
SPIFFY_SYNTH8 = 1997;
SPIFFY_SYNTH9 = 1998;
SPIFFY_SYNTH10 = 1999;
GOLD_PURIFICATION = 2000;
GOLD_ENSORCELLMENT = 2001;
CLOCKMAKING = 2002;
WAY_OF_THE_GOLDSMITH = 2003;
SPIFFY_SYNTH11 = 2004;
SPIFFY_SYNTH12 = 2005;
SPIFFY_SYNTH13 = 2006;
SPIFFY_SYNTH14 = 2007;
CLOTH_PURIFICATION = 2008;
CLOTH_ENSORCELLMENT = 2009;
SPINNING = 2010;
FLETCHING = 2011;
WAY_OF_THE_WEAVER = 2012;
SPIFFY_SYNTH15 = 2013;
SPIFFY_SYNTH16 = 2014;
SPIFFY_SYNTH17 = 2015;
LEATHER_PURIFICATION = 2016;
LEATHER_ENSORCELLMENT = 2017;
TANNING = 2018;
WAY_OF_THE_TANNER = 2019;
SPIFFY_SYNTH18 = 2020;
SPIFFY_SYNTH19 = 2021;
SPIFFY_SYNTH20 = 2022;
SPIFFY_SYNTH21 = 2023;
BONE_PURIFICATION = 2024;
BONE_ENSORCELLMENT = 2025;
FILING = 2026;
WAY_OF_THE_BONEWORKER = 2027;
SPIFFY_SYNTH22 = 2028;
SPIFFY_SYNTH23 = 2029;
SPIFFY_SYNTH24 = 2030;
SPIFFY_SYNTH25 = 2031;
ANIMA_SYNTHESIS = 2032;
ALCHEMIC_PURIFICATION = 2033;
ALCHEMIC_ENSORCELLMENT = 2034;
TRITURATION = 2035;
CONCOCTION = 2036;
IATROCHEMISTRY = 2037;
MIASMAL_COUNTERAGENT_RECIPE = 2038;
WAY_OF_THE_ALCHEMIST = 2039;
RAW_FISH_HANDLING = 2040;
NOODLE_KNEADING = 2041;
PATISSIER = 2042;
STEWPOT_MASTERY = 2043;
WAY_OF_THE_CULINARIAN = 2044;
SPIFFY_SYNTH26 = 2045;
SPIFFY_SYNTH27 = 2046;
SPIFFY_SYNTH28 = 2047;
VOIDWATCH_ALARUM = 2048;
VOIDWATCHERS_EMBLEM_JEUNO = 2049;
VOIDWATCHERS_EMBLEM_QUFIM = 2050;
LOADSTONE = 2051;
SOUL_GEM = 2052;
SOUL_GEM_CLASP = 2053;
TRICOLOR_VOIDWATCHERS_EMBLEM = 2054;
STARLIGHT_VOIDWATCHERS_EMBLEM = 2055;
RED_PRESENT = 2056;
BLUE_PRESENT = 2057;
GREEN_PRESENT = 2058;
HEART_OF_THE_BUSHIN = 2059;
HYACINTH_STRATUM_ABYSSITE = 2060;
HYACINTH_STRATUM_ABYSSITE_II = 2061;
AMBER_STRATUM_ABYSSITE = 2062;
AMBER_STRATUM_ABYSSITE_II = 2063;
CLAIRVOY_ANT = 2064;
KUPOFRIEDS_CORUNDUM = 2065;
KUPOFRIEDS_CORUNDUM = 2066;
KUPOFRIEDS_CORUNDUM = 2067;
BRONZE_ASTRARIUM = 2068;
SILVER_ASTRARIUM = 2069;
MYTHRIL_ASTRARIUM = 2070;
GOLD_ASTRARIUM = 2071;
PLATINUM_ASTRARIUM = 2072;
DEMONS_IN_THE_RYE_CHRONICLE = 2073;
MONSTROUS_MAYHEM_REPORT = 2074;
CULLING_IS_CARING_POSTER = 2075;
MERRY_MOOGLE_MEMORIAL_GUIDE = 2076;
CONNORS_COMMUNIQUE = 2077;
PERNICIOUS_PRESENTS_BRIEF = 2078;
LITTLE_GOBLINS_ADVENTURE_VOL1 = 2079;
LITTLE_GOBLINS_ADVENTURE_VOL2 = 2080;
LITTLE_GOBLINS_ADVENTURE_VOL3 = 2081;
LITTLE_GOBLINS_ADVENTURE_VOL4 = 2082;
LITTLE_GOBLINS_ADVENTURE_VOL5 = 2083;
LITTLE_GOBLINS_ADVENTURE_VOL6 = 2084;
LITTLE_GOBLINS_ADVENTURE_VOL7 = 2085;
LITTLE_GOBLINS_ADVENTURE_VOL8 = 2086;
VANADIEL_TRIBUNE_VOL00 = 2087;
VANADIEL_TRIBUNE_VOL01 = 2088;
VANADIEL_TRIBUNE_VOL02 = 2089;
VANADIEL_TRIBUNE_VOL03 = 2090;
VANADIEL_TRIBUNE_VOL04 = 2091;
VANADIEL_TRIBUNE_VOL05 = 2092;
VANADIEL_TRIBUNE_VOL06 = 2093;
VANADIEL_TRIBUNE_VOL07 = 2094;
VANADIEL_TRIBUNE_VOL08 = 2095;
VANADIEL_TRIBUNE_VOL09 = 2096;
VANADIEL_TRIBUNE_VOL10 = 2097;
VANADIEL_TRIBUNE_VOL11 = 2098;
VANADIEL_TRIBUNE_VOL12 = 2099;
VANADIEL_TRIBUNE_VOL13 = 2100;
VANADIEL_TRIBUNE_VOL15 = 2102;
VANADIEL_TRIBUNE_VOL16 = 2103;
VANADIEL_TRIBUNE_VOL17 = 2104;
VANADIEL_TRIBUNE_VOL18 = 2105;
VANADIEL_TRIBUNE_VOL19 = 2106;
VANADIEL_TRIBUNE_VOL20 = 2107;
VANADIEL_TRIBUNE_VOL21 = 2108;
VANADIEL_TRIBUNE_VOL22 = 2109;
VANADIEL_TRIBUNE_VOL23 = 2110;
VANADIEL_TRIBUNE_VOL24 = 2111;
VANADIEL_TRIBUNE_VOL25 = 2112;
VANADIEL_TRIBUNE_VOL26 = 2113;
VANADIEL_TRIBUNE_VOL27 = 2114;
VANADIEL_TRIBUNE_II_NO01 = 2115;
VANADIEL_TRIBUNE_II_NO02 = 2116;
VANADIEL_TRIBUNE_II_NO03 = 2117;
VANADIEL_TRIBUNE_II_NO04 = 2118;
VANADIEL_TRIBUNE_II_NO05 = 2119;
VANADIEL_TRIBUNE_II_NO06 = 2120;
VANADIEL_TRIBUNE_II_NO07 = 2121;
VANADIEL_TRIBUNE_II_NO08 = 2122;
VANADIEL_TRIBUNE_II_NO09 = 2123;
VANADIEL_TRIBUNE_II_NO10 = 2124;
VANADIEL_TRIBUNE_II_NO11 = 2125;
VANADIEL_TRIBUNE_II_NO12 = 2126;
VANADIEL_TRIBUNE_II_NO13 = 2127;
VANADIEL_TRIBUNE_II_NO14 = 2128;
VANADIEL_TRIBUNE_II_NO15 = 2129;
VANADIEL_TRIBUNE_II_NO16 = 2130;
HANDCRAFTED_SPATULA = 2131;
TRANSMUTED_CANDLE = 2132;
GOURMET_WHIPPED_CREAM = 2133;
ANCIENT_PAPYRUS_SHRED1 = 2134;
ANCIENT_PAPYRUS_SHRED2 = 2135;
ANCIENT_PAPYRUS_SHRED3 = 2136;
EXORAY_MOLD_CRUMB1 = 2137;
EXORAY_MOLD_CRUMB2 = 2138;
EXORAY_MOLD_CRUMB3 = 2139;
BOMB_COAL_FRAGMENT1 = 2140;
BOMB_COAL_FRAGMENT2 = 2141;
BOMB_COAL_FRAGMENT3 = 2142;
SHINING_FRAGMENT = 2143;
GLOSSY_FRAGMENT = 2144;
GRIMOIRE_PAGE = 2145;
MOBLIN_PHEROMONE_SACK = 2146;
GOLDEN_WING = 2147;
MOSS_COVERED_SHARD = 2148;
ESSENCE_OF_PERFERVIDITY = 2149;
BRANDED_WING = 2150;
MALICIOUS_HORN = 2151;
SHEET_OF_SAN_DORIAN_TUNES = 2152;
SHEET_OF_BASTOKAN_TUNES = 2153;
SHEET_OF_WINDURSTIAN_TUNES = 2154;
GEOMAGNETRON = 2155;
ADOULINIAN_CHARTER_PERMIT = 2156;
PIONEERS_BADGE = 2157;
TEMPORARY_GEOMAGNETRON = 2158;
AGED_MATRIARCH_NAAKUAL_CREST = 2159;
AGED_RIPTIDE_NAAKUAL_CREST = 2160;
AGED_FIREBRAND_NAAKUAL_CREST = 2161;
AGED_LIGNEOUS_NAAKUAL_CREST = 2162;
AGED_BOOMING_NAAKUAL_CREST = 2163;
AGED_FLASHFROST_NAAKUAL_CREST = 2164;
PROTOTYPE_ATTUNER = 2166;
WATERCRAFT = 2167;
RESTRAINMENT_RESILIENCE = 2171;
CUPFUL_OF_DUST_LADEN_SAP = 2179;
MANTID_BAIT = 2180;
VIAL_OF_TOXIC_ZOLDEFF_WATER = 2185;
FISTFUL_OF_PRISTINE_SAND = 2186;
RIME_ICE_FRAGMENT = 2190;
BROKEN_HARPOON = 2192;
EXTRAVAGANT_HARPOON = 2193;
GEOMAGNETIC_COMPASS = 2196;
OCULAR_ORB = 2197;
PILE_OF_NOXIOUS_GRIME = 2198;
PULSATING_SHARD = 2199;
DINNER_INVITATION = 2200;
ROCKBERRY1 = 2201;
ROCKBERRY2 = 2202;
ROCKBERRY3 = 2203;
LOGGING = 2204;
WATERCRAFTING = 2205;
DEMOLISHING = 2206;
TOXIN_RESILIENCE = 2207;
PARESIS_RESILIENCE = 2208;
CALOR_RESILIENCE = 2209;
HEN_FS_BUILDING_MAT_CONTAINER = 2210;
MOR_FS_BUILDING_MAT_CONTAINER = 2211;
HEN_FS_RESOURCE_CONTAINER = 2212;
MOR_FS_RESOURCE_CONTAINER = 2213;
CEI_FB_OP_MATERIALS_CONTAINER = 2214;
HEN_FB_OP_MATERIALS_CONTAINER = 2215;
MOR_FB_OP_MATERIALS_CONTAINER = 2216;
LOST_ARTICLE1 = 2217;
LOST_ARTICLE2 = 2218;
FLAYED_MANTID_CORPSE = 2220;
CHAPULI_HORN = 2221;
HOT_SPRING_REPORT_1 = 2225;
HOT_SPRING_REPORT_2 = 2226;
HOT_SPRING_REPORT_3 = 2227;
HOT_SPRING_REPORT_4 = 2228;
HOT_SPRING_REPORT_5 = 2229;
MAGMA_SURVEY_REPORT = 2232;
REIVE_UNITY = 2234;
CRITICAL_CHOP = 2236;
CHERISHED_AXE = 2237;
CRITICAL_SMASH = 2238;
CHERISHED_PICK = 2239;
CRITICAL_SLICE = 2240;
CHERISHED_SICKLE = 2241;
SAN_DORIA_WARP_RUNE = 2248;
BASTOK_WARP_RUNE = 2249;
WINDURST_WARP_RUNE = 2250;
SELBINA_WARP_RUNE = 2251;
MHAURA_WARP_RUNE = 2252;
KAZHAM_WARP_RUNE = 2253;
RABAO_WARP_RUNE = 2254;
NORG_WARP_RUNE = 2255;
TAVNAZIA_WARP_RUNE = 2256;
WHITEGATE_WARP_RUNE = 2257;
NASHMAU_WARP_RUNE = 2258;
RUSTED_PICKAXE = 2261;
TINY_SEED = 2262;
BOTTLE_OF_FERTILIZER_X = 2263;
WAYPOINT_SCANNER_KIT = 2264;
ROYAL_FIAT_BANNING_COLONIZATION = 2265;
RECORD_OF_THE_17TH_ASSEMBLY = 2266;
COPY_OF_THE_ALLIANCE_AGREEMENT = 2267;
ULBUKAN_NAVIGATION_CHART = 2268;
COPY_OF_ADOULINS_PATRONESS = 2269;
MEMO_FROM_MIDRAS = 2270;
CIDS_CATALYST = 2271;
CHUNK_OF_MILKY_WHITE_MINERALS = 2272;
FAIL_BADGE = 2273;
WESTERN_ADOULIN_PATROL_ROUTE = 2274;
MISDELIVERED_PARCEL = 2275;
EASTERN_ADOULIN_PATROL_ROUTE = 2276;
HOT_SPRINGS_CARE_PACKAGE = 2277;
FISTFUL_OF_HOMELAND_SOIL = 2278;
YAHSE_WILDFLOWER_PETAL = 2279;
HABITUAL_BEHAVIOR_BAROMETER = 2280;
BRIER_PROOF_NET = 2281;
COMPASS_OF_TRANSFERENCE = 2282;
MAGMA_MITIGATION_SET = 2283;
RESURRECTION_RETARDANT_AXE = 2284;
INSULATOR_TABLET = 2285;
ANTI_GLACIATION_GEAR = 2286;
LAND_OF_MILK_AND_HONEY_HIVE = 2288;
FULL_LAND_OF_MILK_AND_HONEY_HIVE = 2289;
LUOPAN = 2290;
RALA_SIMULACRUM = 2291;
YORCIA_SIMULACRUM = 2292;
CIRDAS_SIMULACRUM = 2293;
RAKAZNAR_SIMULACRUM = 2294;
CELADON_YANTRIC_PLANCHETTE = 2296;
ZAFFRE_YANTRIC_PLANCHETTE = 2297;
ALIZARIN_YANTRIC_PLANCHETTE = 2298;
DETACHED_STINGER = 2299;
CRAGGY_FIN = 2300;
FLAME_SCARRED_SKULL = 2301;
MAP_OF_RALA_WATERWAYS_U = 2302;
MAP_OF_YORCIA_WEALD_U = 2303;
MAP_OF_CIRDAS_CAVERNS_U = 2304;
MAP_OF_OUTER_RAKAZNAR_U = 2305;
MOG_KUPON_A_DEII = 2334;
MOG_KUPON_A_DE = 2335;
MOG_KUPON_A_SAL = 2336;
MOG_KUPON_A_NYZ = 2337;
MOG_KUPON_I_S5 = 2338;
MOG_KUPON_I_S2 = 2339;
MOG_KUPON_I_ORCHE = 2340;
SHEET_OF_E_ADOULINIAN_TUNES = 2341;
SHEET_OF_W_ADOULINIAN_TUNES = 2342;
HENNEBLOOM_LEAF = 2343;
IMPURE_CELADON_YGGZI = 2344;
SEMI_PURE_CELADON_YGGZI = 2345;
IMPURE_ZAFFRE_YGGZI = 2346;
SEMI_PURE_ZAFFRE_YGGZI = 2347;
IMPURE_ALIZARIN_YGGZI = 2348;
SEMI_PURE_ALIZARIN_YGGZI = 2349;
RING_OF_SUPERNAL_DISJUNCTION = 2350;
EPHEMERAL_ENDEAVOR = 2352;
ENLIGHTENED_ENDEAVOR = 2353;
RUNE_SABER = 2354;
FLASK_OF_FRUISERUM = 2355;
FROST_ENCRUSTED_FLAME_GEM = 2356;
LETTER_FROM_OCTAVIEN = 2357;
STONE_OF_IGNIS = 2358;
STONE_OF_GELUS = 2359;
STONE_OF_FLABRA = 2360;
STONE_OF_TELLUS = 2361;
STONE_OF_SULPOR = 2362;
STONE_OF_UNDA = 2363;
STONE_OF_LUX = 2364;
STONE_OF_TENEBRAE = 2365;
STONE_OF_UNKNOWN_RUNIC_ORIGINS1 = 2366;
STONE_OF_UNKNOWN_RUNIC_ORIGINS2 = 2367;
STONE_OF_UNKNOWN_RUNIC_ORIGINS3 = 2368;
SECRETS_OF_RUNIC_ENHANCEMENT = 2369;
RUNIC_KINEGRAVER = 2370;
VIAL_OF_VIVID_RAINBOW_EXTRACT = 2371;
INSIDIOS_EXTINGUISHED_LANTERN = 2372;
VESSEL_OF_SUMMONING = 2373;
SILVER_LUOPAN = 2374;
LHAISO_NEFTEREHS_BELL = 2375;
MIDRASS_EXPLOSIVE_SAMPLE = 2376;
REPORT_ON_MIDRASS_EXPLOSIVE = 2377;
TRAY_OF_ADOULINIAN_DELICACIES = 2378;
SMALL_BAG_OF_ADOULINIAN_DELICACIES = 2379;
WAYPOINT_RECALIBRATION_KIT = 2380;
TWELVE_ORDERS_DOSSIER = 2381;
RAVINE_WATER_TESTING_KIT = 2382;
FISTFUL_OF_NUMBING_SOIL = 2383;
HUNK_OF_BEDROCK = 2384;
YORCIAS_TEAR = 2385;
BLIGHTBERRY = 2386;
LARGE_STRIP_OF_VELKK_HIDE = 2387;
CLIMBING = 2388;
BOX_OF_ADOULINIAN_TOMATOES = 2389;
KALEIDOSCOPIC_CLAM = 2390;
GLASS_PENDULUM = 2391;
IVORY_WING_TALISMAN = 2393;
BRONZE_MATTOCK_CORDON = 2394;
BRONZE_SHOVEL_CORDON = 2395;
TARUTARU_SAUCE_INVOICE = 2396;
TARUTARU_SAUCE_RECEIPT = 2397;
GPS_CRYSTAL = 2398;
PAIR_OF_VELKK_GLOVES = 2399;
LOST_ARTICLE1 = 2400;
LOST_ARTICLE2 = 2401;
GEOMANCER_CLAIM_TICKET = 2402;
MAR_FB_OP_MATERIALS_CONTAINER = 2403;
YOR_FB_OP_MATERIALS_CONTAINER = 2404;
MAR_FS_BUILDING_MAT_CONTAINER = 2405;
YOR_FS_BUILDING_MAT_CONTAINER = 2406;
PROOF_OF_ORDER_RUNIC_HEADGEAR1 = 2407;
PROOF_OF_ORDER_RUNIC_HANDGEAR2 = 2408;
PROOF_OF_ORDER_RUNIC_FOOTGEAR4 = 2409;
ROSULATIAS_POME = 2410;
CELENNIA_MEMORIAL_LIBRARY_CARD = 2411;
SOWYOURSEED = 2412;
MY_FIRST_FURROW = 2413;
FIELDS_AND_FERTILIZING = 2414;
DESIGNER_FARMING = 2415;
HOMESTEADERS_COMPENDIUM = 2416;
MHMU_TREATISE_ON_AGRONOMY = 2417;
GIVE_MY_REGARDS_TO_REODOAN = 2419;
ADOULINS_TOPIARY_TREASURES = 2420;
GRANDILOQUENT_GROVES = 2421;
ARBOREAL_ABRACADABRA = 2422;
VERDANT_AND_VERDONTS = 2423;
MHMU_TREATISE_ON_FORESTRY = 2424;
MYTHRIL_MARATHON_QUARTERLY = 2426;
TAKE_A_LODE_OFF = 2427;
VARICOSE_MINERAL_VEINS = 2428;
TALES_FROM_THE_TUNNEL = 2429;
THE_GUSGEN_MINES_TRAGEDY = 2430;
MHMU_TREATISE_ON_MINERALOGY = 2431;
A_FAREWELL_TO_FRESHWATER = 2433;
WATER_WATER_EVERYWHERE = 2434;
DREDGINGS_NO_DRUDGERY = 2435;
ALL_THE_WAYS_TO_SKIN_A_CARP = 2436;
ANATOMY_OF_AN_ANGLER = 2437;
MHMU_TREATISE_ON_FISH_I = 2438;
THE_OLD_MEN_OF_THE_SEA = 2440;
BLACK_FISH_OF_THE_FAMILY = 2442;
TWENTY_THOUSAND_YALMS_UNDER_THE_SEA = 2443;
ENCYCLOPEDIA_ICTHYONNICA = 2444;
MHMU_TREATISE_ON_FISH_II = 2445;
MAR_FS_RESOURCE_CONTAINER = 2447;
YOR_FS_RESOURCE_CONTAINER = 2448;
NOTE_DETAILING_SEDITIOUS_PLANS = 2449;
WATERWAY_FACILITY_CRANK = 2450;
VIAL_OF_TRANSLURRY = 2451;
GIL_REPOSITORY = 2452;
CRAB_CALLER = 2453;
PIECE_OF_A_STONE_WALL = 2454;
VIAL_OF_UNTAINTED_HOLY_WATER = 2455;
ETERNAL_FLAME = 2456;
WEATHER_VANE_WINGS = 2457;
AUREATE_BALL_OF_FUR = 2458;
INVENTORS_COALITION_PICKAXE = 2459;
TINTINNABULUM = 2460;
FRAGMENTING = 2461;
PAIR_OF_FUZZY_EARMUFFS = 2462;
KAM_FB_OP_MATERIALS_CONTAINER = 2463;
KAM_FS_BUILDING_MAT_CONTAINER = 2464;
KAM_FS_RESOURCE_CONTAINER = 2465;
MEMORANDOLL = 2466;
SHADOW_LORD_PHANTOM_GEM = 2468;
CELESTIAL_NEXUS_PHANTOM_GEM = 2469;
STELLAR_FULCRUM_PHANTOM_GEM = 2470;
PHANTOM_GEM_OF_APATHY = 2471;
PHANTOM_GEM_OF_ARROGANCE = 2472;
PHANTOM_GEM_OF_ENVY = 2473;
PHANTOM_GEM_OF_COWARDICE = 2474;
PHANTOM_GEM_OF_RAGE = 2475;
P_PERPETRATOR_PHANTOM_GEM = 2476;
COPPER_AMAN_VOUCHER = 2477;
MATRIARCH_NAAKUAL_PARAGON = 2482;
RIPTIDE_NAAKUAL_PARAGON = 2483;
FIREBRAND_NAAKUAL_PARAGON = 2484;
LIGNEOUS_NAAKUAL_PARAGON = 2485;
BOOMING_NAAKUAL_PARAGON = 2486;
FLASHFROST_NAAKUAL_PARAGON = 2487;
MOG_KUPON_I_AF109 = 2489;
MOG_KUPON_W_EWS = 2490;
MOG_KUPON_AW_WK = 2491;
MOG_KUPON_I_S3 = 2492;
MOG_KUPON_A_PK109 = 2493;
MOG_KUPON_I_S1 = 2494;
MOG_KUPON_I_SKILL = 2495;
GREEN_INSTITUTE_CARD = 2496;
WINDURST_TRUST_PERMIT = 2497;
BLUE_INSTITUTE_CARD = 2498;
BASTOK_TRUST_PERMIT = 2499;
RED_INSTITUTE_CARD = 2500;
SAN_DORIA_TRUST_PERMIT = 2501;
MOG_KUPON_I_RME = 2502;
PULVERIZING = 2503;
LERENES_PATEN = 2504;
AMCHUCHUS_MISSIVE = 2505;
TEMPLE_KNIGHT_KEY = 2506;
UNBLEMISHED_PIONEERS_BADGE = 2507;
SILVERY_PLATE = 2508;
SOUL_SIPHON = 2509;
TAPESTRY_OF_BAGUA_POETRY = 2511;
FUTHARKIC_CONCEPTS_IN_FLUX = 2512;
CRYSTALLIZED_LIFESTREAM_ESSENCE = 2513;
STRAND_OF_RAKAZNAR_FILAMENT = 2514;
ORDER_SLIP_LIFESTREAM_HEADGEAR = 2515;
ORDER_SLIP_LIFESTREAM_BODYGEAR = 2516;
ORDER_SLIP_LIFESTREAM_HANDGEAR = 2517;
ORDER_SLIP_LIFESTREAM_LEGGEAR = 2518;
ORDER_SLIP_LIFESTREAM_FOOTGEAR = 2519;
ORDER_SLIP_LOGOMORPH_HEADGEAR = 2520;
ORDER_SLIP_LOGOMORPH_BODYGEAR = 2521;
ORDER_SLIP_LOGOMORPH_HANDGEAR = 2522;
ORDER_SLIP_LOGOMORPH_LEGGEAR = 2523;
ORDER_SLIP_LOGOMORPH_FOOTGEAR = 2524;
PRISTINE_HAIR_RIBBON = 2525;
VIAL_OF_TRANSMELANGE = 2526;
LOST_ARTICLE = 2527;
BREATH_OF_DAWN = 2528;
PHLOX_YANTRIC_PLANCHETTE = 2529;
RUSSET_YANTRIC_PLANCHETTE = 2530;
ASTER_YANTRIC_PLANCHETTE = 2531;
SPARKING_TAIL_FEATHER = 2532;
PIECE_OF_INVIOLABLE_BARK = 2533;
FROSTED_INCISOR = 2534;
IMPURE_PHLOX_YGGZI = 2535;
SEMI_PURE_PHLOX_YGGZI = 2536;
IMPURE_RUSSET_YGGZI = 2537;
SEMI_PURE_RUSSET_YGGZI = 2538;
IMPURE_ASTER_YGGZI = 2539;
SEMI_PURE_ASTER_YGGZI = 2540;
BREATH_OF_DAWN1 = 2541;
BREATH_OF_DAWN2 = 2542;
BREATH_OF_DAWN3 = 2543;
JOB_BREAKER = 2544;
| gpl-3.0 |
trilastiko/keys | VSCOKeys.lrdevplugin/halfway_server/mime.lua | 118 | 2433 | -----------------------------------------------------------------------------
-- MIME support for the Lua language.
-- Author: Diego Nehab
-- Conforming to RFCs 2045-2049
-- RCS ID: $Id: mime.lua,v 1.29 2007/06/11 23:44:54 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = _G
local ltn12 = require("ltn12")
local mime = require("mime.core")
local io = require("io")
local string = require("string")
module("mime")
-- encode, decode and wrap algorithm tables
encodet = {}
decodet = {}
wrapt = {}
-- creates a function that chooses a filter by name from a given table
local function choose(table)
return function(name, opt1, opt2)
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
end
local f = table[name or "nil"]
if not f then
base.error("unknown key (" .. base.tostring(name) .. ")", 3)
else return f(opt1, opt2) end
end
end
-- define the encoding filters
encodet['base64'] = function()
return ltn12.filter.cycle(b64, "")
end
encodet['quoted-printable'] = function(mode)
return ltn12.filter.cycle(qp, "",
(mode == "binary") and "=0D=0A" or "\r\n")
end
-- define the decoding filters
decodet['base64'] = function()
return ltn12.filter.cycle(unb64, "")
end
decodet['quoted-printable'] = function()
return ltn12.filter.cycle(unqp, "")
end
local function format(chunk)
if chunk then
if chunk == "" then return "''"
else return string.len(chunk) end
else return "nil" end
end
-- define the line-wrap filters
wrapt['text'] = function(length)
length = length or 76
return ltn12.filter.cycle(wrp, length, length)
end
wrapt['base64'] = wrapt['text']
wrapt['default'] = wrapt['text']
wrapt['quoted-printable'] = function()
return ltn12.filter.cycle(qpwrp, 76, 76)
end
-- function that choose the encoding, decoding or wrap algorithm
encode = choose(encodet)
decode = choose(decodet)
wrap = choose(wrapt)
-- define the end-of-line normalization filter
function normalize(marker)
return ltn12.filter.cycle(eol, 0, marker)
end
-- high level stuffing filter
function stuff()
return ltn12.filter.cycle(dot, 2)
end
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.