repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278 values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15 values |
|---|---|---|---|---|---|
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/quest/rori/rohd_gostervek.lua | 1 | 1036 | rohd_gostervek = Creature:new {
objectName = "@mob/creature_names:imperial_army_captain",
customName = "Captain Rohd Gostervek",
socialGroup = "imperial",
faction = "imperial",
level = 30,
chanceHit = 0.39,
damageMin = 290,
damageMax = 300,
baseXp = 2914,
baseHAM = 8400,
baseHAMmax = 10200,
armor = 0,
resists = {0,45,0,-1,40,-1,40,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = NONE,
diet = HERBIVORE,
templates = {"object/mobile/dressed_imperial_captain_m.iff"},
lootGroups = {
{
groups = {
{group = "task_loot_booto_lubble_thermal_detonator", chance = 10000000}
},
lootChance = 10000000
}
},
weapons = {"imperial_weapons_medium"},
attacks = merge(riflemanmaster,carbineermaster,brawlermaster),
conversationTemplate = "",
optionsBitmask = 128
}
CreatureTemplates:addCreatureTemplate(rohd_gostervek, "rohd_gostervek") | agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/component/droid/defensive_module_base.lua | 3 | 2272 | --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_component_droid_defensive_module_base = object_tangible_component_droid_shared_defensive_module_base:new {
}
ObjectTemplates:addTemplate(object_tangible_component_droid_defensive_module_base, "object/tangible/component/droid/defensive_module_base.iff")
| agpl-3.0 |
panpakr/TronLauncher | dmc_corona/dmc_gestures/delegate_gesture.lua | 10 | 2729 | --====================================================================--
-- dmc_corona/dmc_gestures/delegate_gesture.lua
--
-- Documentation: http://docs.davidmccuskey.com/
--====================================================================--
--[[
The MIT License (MIT)
Copyright (c) 2015 David McCuskey
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.
--]]
--====================================================================--
--== DMC Corona UI : Gesture Recognizer Delegate
--====================================================================--
-- Semantic Versioning Specification: http://semver.org/
local VERSION = "0.1.0"
--- Gesture Recognizer Delegate Interface.
-- the interface for controlling a Gesture Recognizer via a delegate. currently all methods are optional, only implement if needed.
--
-- @classmod Delegate.GestureRecognizer
-- @usage
-- local Gesture = require 'dmc_corona.dmc_gestures'
--
-- -- setup delegate object
-- local delegate = {
-- shouldRecognizeWith=function(self, did_recognize, to_fail )
-- return true
-- end,
-- }
-- @usage
-- local widget = dUI.newPanGesture()
-- widget.delegate = <delgate object>
-- @usage
-- local Gesture = require 'dmc_corona.dmc_gestures'
-- local widget = dUI.newPanGesture{
-- delegate=<delegate object>
-- }
--- (optional) asks delegate if Gesture Recognizer should remain active.
-- return true if Gesture Recognizer should remain, the default return value is `false`.
--
-- @within Methods
-- @function :shouldRecognizeWith
-- @tparam object did_recognize Gesture Recognizer which has Recognized its gesture
-- @tparam object to_fail Gesture Recognizer which is about to be Failed
-- @treturn bool true if Gesture Recognizer `to_fail` should remain.
| mit |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/furniture/furniture_base.lua | 3 | 2248 | --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_base = object_draft_schematic_furniture_shared_furniture_base:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_furniture_furniture_base, "object/draft_schematic/furniture/furniture_base.iff")
| agpl-3.0 |
KingRaptor/Zero-K | LuaRules/Configs/explosion_spawn_defs.lua | 6 | 1987 | -- $Id: explosion_spawn_defs.lua 4050 2009-03-09 02:56:38Z midknight $
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--Lists post-processing weapon names and the units to spawn when they go off
local spawn_defs = {
corhurc_minebomb = {name = "cormine_impulse", cost = 0, expire = 60},
armcent_droppod = {name = "armpw", cost=0, expire=0},
armpnix3_armadvbomb = {name = "armflea", cost=0, expire=0},
cormine_cortruck_missile = {name = "corareamine", cost=0, expire=0},
chicken_blimpy_dodobomb = {name = "chicken_dodo", cost=0, expire=30},
corgarp_mine = {name = "wolverine_mine", cost=0, expire=60},
hoverminer_mine = {name = "wolverine_mine", cost=0, expire=60},
zenith_meteor = {name = "asteroid_dead", cost=0, expire=0, feature = true},
zenith_meteor_float = {name = "asteroid_dead", cost=0, expire=0, feature = true},
zenith_meteor_aim = {name = "asteroid_dead", cost=0, expire=0, feature = true},
zenith_meteor_uncontrolled = {name = "asteroid_dead", cost=0, expire=0, feature = true},
chickenflyerqueen_dodobomb = {name = "chicken_dodo", cost=0, expire=30},
chickenflyerqueen_basiliskbomb = {name = "chickenc", cost=0, expire=0},
chickenflyerqueen_tiamatbomb = {name = "chicken_tiamat", cost=0, expire=0},
chickenlandqueen_dodobomb = {name = "chicken_dodo", cost=0, expire=30},
chickenlandqueen_basiliskbomb = {name = "chickenc", cost=0, expire=0},
chickenlandqueen_tiamatbomb = {name = "chicken_tiamat", cost=0, expire=0},
}
local shieldCollide = { -- unitDefs as the shield hit callin is setup really strangely
corgarp_mine = {damage = 220, gadgetDamage = 200}, -- gadgetDamage = damage - weapon default damage
-- Weapon name must be used
}
return spawn_defs, shieldCollide
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
| gpl-2.0 |
KingRaptor/Zero-K | LuaUI/Widgets/chili_new/controls/label.lua | 18 | 2997 | --//=============================================================================
--- Label module
--- Label fields.
-- Inherits from Control.
-- @see control.Control
-- @table Label
-- @string[opt="left"] align alignment
-- @string[opt="linecenter"] valign vertical alignment
-- @string[opt="no text"] caption text to be displayed
Label = Control:Inherit{
classname= "label",
defaultWidth = 70,
defaultHeight = 20,
padding = {0,0,0,0},
autosize = true,
autoObeyLineHeight = true, --// (needs autosize) if true, autosize will obey the lineHeight (-> texts with the same line count will have the same height)
align = "left",
valign = "linecenter", --// usefull too "ascender"
caption = "no text",
}
local this = Label
local inherited = this.inherited
--//=============================================================================
function Label:New(obj)
obj = inherited.New(self,obj)
obj:SetCaption(obj.caption)
return obj
end
--//=============================================================================
--- Set the label caption
-- @string newcaption new caption to be set
function Label:SetCaption(newcaption)
if (self.caption == newcaption) then return end
self.caption = newcaption
self:UpdateLayout()
self:Invalidate()
end
function Label:UpdateLayout()
local font = self.font
if (self.autosize) then
self._caption = self.caption
local w = font:GetTextWidth(self.caption);
local h, d, numLines = font:GetTextHeight(self.caption);
h = h + 1
if (self.autoObeyLineHeight) then
h = math.ceil(numLines * font:GetLineHeight())
else
h = math.ceil(h-d)
end
if font.shadow then
w = w + 2 + font.size * 0.1
h = h + 2 + font.size * 0.1
elseif font.outline then
w = w + 2 + font.size * font.outlineWidth
h = h + 2 + font.size * font.outlineWidth
end
local x = self.x
local y = self.y
if self.valign == "center" then
y = math.round(y + (self.height - h) * 0.5)
elseif self.valign == "bottom" then
y = y + self.height - h
elseif self.valign == "top" then
else
end
if self.align == "left" then
elseif self.align == "right" then
x = x + self.width - w
elseif self.align == "center" then
x = math.round(x + (self.width - w) * 0.5)
end
self:_UpdateConstraints(x,y,w,h)
else
self._caption = font:WrapText(self.caption, self.width, self.height)
end
end
--//=============================================================================
function Label:DrawControl()
local font = self.font
font:DrawInBox(self._caption,0,0,self.width,self.height,self.align,self.valign)
if (self.debug) then
gl.Color(0,1,0,0.5)
gl.PolygonMode(GL.FRONT_AND_BACK,GL.LINE)
gl.LineWidth(2)
gl.Rect(0,0,self.width,self.height)
gl.LineWidth(1)
gl.PolygonMode(GL.FRONT_AND_BACK,GL.FILL)
end
end
--//=============================================================================
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/king_merek_harvester.lua | 3 | 2196 | --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_king_merek_harvester = object_mobile_shared_king_merek_harvester:new {
}
ObjectTemplates:addTemplate(object_mobile_king_merek_harvester, "object/mobile/king_merek_harvester.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/weapon/melee/2h_sword/crafted_saber/sword_lightsaber_two_handed_s5_gen1.lua | 1 | 6243 | --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_melee_2h_sword_crafted_saber_sword_lightsaber_two_handed_s5_gen1 = object_weapon_melee_2h_sword_crafted_saber_shared_sword_lightsaber_two_handed_s5_gen1: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 = MELEEATTACK,
-- ENERGY, KINETIC, ELECTRICITY, STUN, BLAST, HEAT, COLD, ACID, FORCE, LIGHTSABER
damageType = LIGHTSABER,
-- NONE, LIGHT, MEDIUM, HEAVY
armorPiercing = MEDIUM,
-- 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,
-- jedi_general, combat_meleespecialize_polearmlightsaber, combat_meleespecialize_onehandlightsaber
xpType = "jedi_general",
-- See http://www.ocdsoft.com/files/certifications.xls
certificationsRequired = { "cert_twohandlightsaber_gen1" },
-- See http://www.ocdsoft.com/files/accuracy.xls
creatureAccuracyModifiers = { "twohandlightsaber_accuracy" },
-- See http://www.ocdsoft.com/files/defense.xls
defenderDefenseModifiers = { "melee_defense" },
-- Leave as "dodge" for now, may have additions later
defenderSecondaryDefenseModifiers = { "saber_block" },
-- See http://www.ocdsoft.com/files/speed.xls
speedModifiers = { "twohandlightsaber_speed" },
-- Leave blank for now
damageModifiers = { },
-- The values below are the default values. To be used for blue frog objects primarily
healthAttackCost = 40,
actionAttackCost = 35,
mindAttackCost = 20,
forceCost = 12,
pointBlankRange = 0,
pointBlankAccuracy = 20,
idealRange = 3,
idealAccuracy = 15,
maxRange = 5,
maxRangeAccuracy = 5,
minDamage = 90,
maxDamage = 180,
attackSpeed = 4.8,
woundsRatio = 15,
defenderToughnessModifiers = { "lightsaber_toughness" },
noTrade = 1,
childObjects = {
{templateFile = "object/tangible/inventory/lightsaber_inventory_1.iff", x = 0, z = 0, y = 0, ox = 0, oy = 0, oz = 0, ow = 0, cellid = -1, containmentType = 4}
},
numberExperimentalProperties = {1, 1, 2, 2, 2, 2, 2, 1, 1, 1},
experimentalProperties = {"XX", "XX", "CD", "OQ", "CD", "OQ", "CD", "OQ", "SR", "UT", "CD", "OQ", "OQ", "OQ", "OQ"},
experimentalWeights = {1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "expDamage", "expDamage", "expDamage", "expDamage", "expEffeciency", "expEffeciency", "expEffeciency", "expEffeciency"},
experimentalSubGroupTitles = {"null", "null", "mindamage", "maxdamage", "attackspeed", "woundchance", "forcecost", "attackhealthcost", "attackactioncost", "attackmindcost"},
experimentalMin = {0, 0, 90, 180, 4.8, 10, 15, 40, 35, 20},
experimentalMax = {0, 0, 110, 220, 4.5, 20, 12, 25, 25, 15},
experimentalPrecision = {0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_weapon_melee_2h_sword_crafted_saber_sword_lightsaber_two_handed_s5_gen1, "object/weapon/melee/2h_sword/crafted_saber/sword_lightsaber_two_handed_s5_gen1.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/structure/installation_mining_ore_heavy.lua | 2 | 4177 | --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_structure_installation_mining_ore_heavy = object_draft_schematic_structure_shared_installation_mining_ore_heavy:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Deed for: Heavy Mineral Mining Installation",
craftingToolTab = 1024, -- (See DraftSchemticImplementation.h)
complexity = 35,
size = 12,
xpType = "crafting_structure_general",
xp = 3900,
assemblySkill = "structure_assembly",
experimentingSkill = "structure_experimentation",
customizationSkill = "structure_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n"},
ingredientTitleNames = {"load_bearing_frame", "body_shell_structure", "body_casing", "structure_foundation", "bore_mechanism", "ore_storage_tank", "boreing_mechanism_buffers_and_bushings", "power_supply_unit", "ore_storage_unit", "resource_handling_system"},
ingredientSlotType = {0, 0, 1, 0, 0, 2, 0, 1, 1, 1},
resourceTypes = {"steel", "metal", "object/tangible/component/structure/shared_wall_module.iff", "metal", "metal", "object/tangible/component/structure/shared_wall_module.iff", "chemical", "object/tangible/component/structure/shared_generator_turbine.iff", "object/tangible/component/structure/shared_structure_small_storage_section.iff", "object/tangible/component/structure/shared_ore_mining_unit.iff"},
resourceQuantities = {400, 600, 1, 200, 300, 6, 400, 2, 6, 2},
contribution = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100},
targetTemplate = "object/tangible/deed/harvester_deed/harvester_ore_heavy_deed.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_structure_installation_mining_ore_heavy, "object/draft_schematic/structure/installation_mining_ore_heavy.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/commands/melee2hMindHit1.lua | 1 | 2604 | --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
Melee2hMindHit1Command = {
name = "melee2hmindhit1",
damageMultiplier = 1.0,
speedMultiplier = 1.25,
healthCostMultiplier = 0.5,
actionCostMultiplier = 1.0,
mindCostMultiplier = 0.5,
accuracyBonus = 10,
poolsToDamage = ACTION_ATTRIBUTE,
dotEffects = {
DotEffect(
BLEEDING,
{ "resistance_bleeding", "bleed_resist" },
ACTION,
true,
125,
100,
30,
30
)
},
weaponType = TWOHANDMELEEWEAPON,
animationCRC = hashCode("combo_2b_medium"),
combatSpam = "mindstrike",
range = -1
}
AddCommand(Melee2hMindHit1Command)
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Sauromugue_Champaign/npcs/Tiger_Bones.lua | 2 | 1406 | -----------------------------------
-- Area: Sauromugue Champaign
-- NPC: Tiger Bones
-- Involed in Quest: The Fanged One.
-- !pos 666 -8 -379 120
-------------------------------------
package.loaded["scripts/zones/Sauromugue_Champaign/TextIDs"] = nil;
-------------------------------------
require("scripts/zones/Sauromugue_Champaign/TextIDs");
require("scripts/zones/Sauromugue_Champaign/MobIDs");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local fangedOne = player:getQuestStatus(WINDURST,THE_FANGED_ONE);
local fangedOneCS = player:getVar("TheFangedOneCS");
-- THE FANGED ONE
if (fangedOne == QUEST_ACCEPTED and fangedOneCS == 1 and not GetMobByID(OLD_SABERTOOTH):isSpawned()) then
SpawnMob(OLD_SABERTOOTH):addStatusEffect(dsp.effects.POISON,40,10,210);
player:messageSpecial(OLD_SABERTOOTH_DIALOG_I);
elseif (fangedOne == QUEST_ACCEPTED and fangedOneCS == 2 and not player:hasKeyItem(OLD_TIGERS_FANG)) then
player:addKeyItem(OLD_TIGERS_FANG);
player:messageSpecial(KEYITEM_OBTAINED, OLD_TIGERS_FANG);
player:setVar("TheFangedOneCS", 0);
-- DEFAULT DIALOG
else
player:messageSpecial(NOTHING_HAPPENS);
end;
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end;
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/kaitok/serverobjects.lua | 3 | 2223 | --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/kaitok/lair_kaitok.lua")
includeFile("tangible/lair/kaitok/lair_kaitok_mountain.lua")
includeFile("tangible/lair/kaitok/lair_kaitok_wasteland.lua")
| agpl-3.0 |
DailyShana/ygopro-scripts | c30213599.lua | 3 | 1339 | --墓守の末裔
function c30213599.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(30213599,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c30213599.cost)
e1:SetTarget(c30213599.target)
e1:SetOperation(c30213599.operation)
c:RegisterEffect(e1)
end
function c30213599.costfilter(c)
return c:IsFaceup() and c:IsSetCard(0x2e)
end
function c30213599.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c30213599.costfilter,1,e:GetHandler()) end
local sg=Duel.SelectReleaseGroup(tp,c30213599.costfilter,1,1,e:GetHandler())
Duel.Release(sg,REASON_COST)
end
function c30213599.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsDestructable() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c30213599.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/warren_teraud_loyalist_cyborg_s03.lua | 3 | 2248 | --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_warren_teraud_loyalist_cyborg_s03 = object_mobile_shared_warren_teraud_loyalist_cyborg_s03:new {
}
ObjectTemplates:addTemplate(object_mobile_warren_teraud_loyalist_cyborg_s03, "object/mobile/warren_teraud_loyalist_cyborg_s03.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Misareaux_Coast/npcs/Spatial_Displacement.lua | 5 | 1459 | -----------------------------------
-- Area: Misareaux Coast
-- NPC: Spacial Displacement
-- Entrance to Riverne Site #A01 and #B01
-----------------------------------
package.loaded["scripts/zones/Misareaux_Coast/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/Misareaux_Coast/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
if (player:hasCompletedMission(COP,SHELTERING_DOUBT)) then
player:startEvent(551); -- Access to Sites A & B
elseif (player:getCurrentMission(COP) == ANCIENT_VOWS and player:getVar("PromathiaStatus") == 1) then
player:startEvent(8);
else
player:startEvent(550); -- Access to Site A Only
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 == 8) then
player:setVar("PromathiaStatus",2);
player:setPos(732.55,-32.5,-506.544,90,30); -- Go to Riverne #A01 {R}
elseif ((csid == 551 or csid == 550) and option == 1) then
player:setPos(732.55,-32.5,-506.544,90,30); -- Go to Riverne #A01 {R}
elseif (csid == 551 and option == 2) then
player:setPos(729.749,-20.319,407.153,90,29); -- Go to Riverne #B01 {R}
end;
end; | gpl-3.0 |
DailyShana/ygopro-scripts | c28348537.lua | 3 | 1654 | --ブリザード・プリンセス
function c28348537.initial_effect(c)
--summon with 1 tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(28348537,0))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c28348537.otcon)
e1:SetOperation(c28348537.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)
--activate limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetOperation(c28348537.actlimit)
c:RegisterEffect(e2)
end
function c28348537.otfilter(c,tp)
return c:IsRace(RACE_SPELLCASTER) and (c:IsControler(tp) or c:IsFaceup())
end
function c28348537.otcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(c28348537.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
return c:GetLevel()>6 and Duel.GetTributeCount(c,mg)>0
end
function c28348537.otop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(c28348537.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
local sg=Duel.SelectTribute(tp,c,1,1,mg)
c:SetMaterial(sg)
Duel.Release(sg, REASON_SUMMON+REASON_MATERIAL)
end
function c28348537.actlimit(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetValue(c28348537.elimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c28348537.elimit(e,te,tp)
return te:IsHasType(EFFECT_TYPE_ACTIVATE)
end
| gpl-2.0 |
DailyShana/ygopro-scripts | c72497366.lua | 3 | 1401 | --悪魔の憑代
function c72497366.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--decrease tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(72497366,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_HAND,0)
e2:SetCountLimit(1)
e2:SetCondition(c72497366.ntcon)
e2:SetTarget(c72497366.nttg)
c:RegisterEffect(e2)
--destroy replace
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DESTROY_REPLACE)
e3:SetRange(LOCATION_SZONE)
e3:SetTarget(c72497366.reptg)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c72497366.ntcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c72497366.nttg(e,c)
return c:IsLevelAbove(5) and c:IsRace(RACE_FIEND)
end
function c72497366.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=eg:GetFirst()
if chk==0 then return eg:GetCount()==1 and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE)
and tc:IsRace(RACE_FIEND) and tc:IsLevelAbove(5) and bit.band(tc:GetSummonType(),SUMMON_TYPE_NORMAL)~=0 end
if Duel.SelectYesNo(tp,aux.Stringid(72497366,1)) then
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
return true
else return false end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/ship/blacksun_medium_s04.lua | 3 | 2184 | --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_medium_s04 = object_ship_shared_blacksun_medium_s04:new {
}
ObjectTemplates:addTemplate(object_ship_blacksun_medium_s04, "object/ship/blacksun_medium_s04.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/shield_generator/shd_armek_plasma_shell_s3.lua | 3 | 2356 | --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_components_shield_generator_shd_armek_plasma_shell_s3 = object_tangible_ship_components_shield_generator_shared_shd_armek_plasma_shell_s3:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_shield_generator_shd_armek_plasma_shell_s3, "object/tangible/ship/components/shield_generator/shd_armek_plasma_shell_s3.iff")
| agpl-3.0 |
AndyClausen/PNRP_HazG | postnukerp/Gamemode/items/medical_code/hp_healthvial.lua | 1 | 1079 | local ITEM = {}
ITEM.ID = "healthvial"
ITEM.Name = "Health Vial"
ITEM.ClassSpawn = "Science"
ITEM.Scrap = 20
ITEM.Small_Parts = 5
ITEM.Chemicals = 20
ITEM.Chance = 100
ITEM.Info = "A glass tube with a strange liquid with pharmaceutical properties"
ITEM.Type = "medical"
ITEM.Remove = true
ITEM.Energy = 0
ITEM.Ent = "hp_smallhealthkit"
ITEM.Model = "models/healthvial.mdl"
ITEM.Script = ""
ITEM.Weight = 2
function ITEM.ToolCheck( p )
return true
end
function ITEM.Spawn( p )
PNRP.BaseItemSpawn( p, ITEM )
end
function ITEM.Use( ply )
local health = ply:Health()
if not ( health == ply:GetMaxHealth() ) then
local sound = Sound("items/smallmedkit1.wav")
ply:EmitSound( sound )
ply:SetHealth( health + 10 )
if ( ply:GetMaxHealth() < health + 10 ) then
ply:SetHealth( ply:GetMaxHealth() )
end
return true
else
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create(class)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
end
PNRP.AddItem(ITEM)
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/armor/component/armor_layer_environmental.lua | 2 | 2316 | --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_armor_component_armor_layer_environmental = object_draft_schematic_armor_component_shared_armor_layer_environmental:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_armor_component_armor_layer_environmental, "object/draft_schematic/armor/component/armor_layer_environmental.iff")
| agpl-3.0 |
njligames/NJLIGameEngine | cmake.in/ldoc.in/PhysicsBodyRigid.lua | 4 | 6257 |
----
-- @file PhysicsBodyRigid
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:calculateSerializeBufferSize()
end
---- Brief description.
-- @author James Folk, 16-02-11 15:02:12
-- <#Description#>
-- @param dataBuffer <#dataBuffer description#>
-- @param btSerializer <#btSerializer description#>
-- @return
function PhysicsBodyRigid:serialize(dataBuffer, btSerializer)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getClassName()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getType()
end
---- Brief description.
-- <#Description#>
-- @param transform <#transform description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setWorldTransform(transform)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getWorldTransform()
end
---- Brief description.
-- <#Description#>
-- @param factor <#factor description#>
-- @return <#return value description#> <#Description#>
function PhysicsBodyRigid:setLinearFactor(factor)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getLinearFactor()
end
---- Brief description.
-- <#Description#>
-- @param factor <#factor description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setAngularFactor(factor)
end
---- Brief description.
-- <#Description#>
-- @param factor <#factor description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setAngularFactor(factor)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getAngularFactor()
end
---- Brief description.
-- <#Description#>
-- @param mass <#mass description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setMass(mass)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getMass()
end
---- Brief description.
-- <#Description#>
-- @param charge <#charge description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setCharge(charge)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getCharge()
end
---- Brief description.
-- <#Description#>
-- @param damping <#damping description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setDamping(damping)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getDamping()
end
---- Brief description.
-- <#Description#>
-- @param damping <#damping description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setAngularDamping(damping)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getAngularDamping()
end
---- Brief description.
-- <#Description#>
-- @param direction <#direction description#>
-- @param impulse <#impulse description#>
-- @return <#return value description#>
function PhysicsBodyRigid:applyForce(direction, impulse)
end
---- Brief description.
-- <#Description#>
-- @param direction <#direction description#>
-- @param position <#position description#>
-- @param impulse <#impulse description#>
-- @return <#return value description#>
function PhysicsBodyRigid:applyForce(direction, position, impulse)
end
---- Brief description.
-- <#Description#>
-- @param direction <#direction description#>
-- @param impulse <#impulse description#>
-- @return <#return value description#>
function PhysicsBodyRigid:applyAngularForce(direction, impulse)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:clearAllForces()
end
---- Brief description.
-- <#Description#>
-- @param velocity <#velocity description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setVelocity(velocity)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getVelocity()
end
---- Brief description.
-- <#Description#>
-- @param velocity <#velocity description#>
-- @return <#return value description#>
function PhysicsBodyRigid:setAngularVelocity(velocity)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:getAngularVelocity()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function PhysicsBodyRigid:isInWorld()
end
---- Brief description.
-- <#Description#>
-- @param size <#size description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.createArray(size)
end
---- Brief description.
-- <#Description#>
-- @param array <#array description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.destroyArray(array)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.create()
end
---- Brief description.
-- <#Description#>
-- @param builder <#builder description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.create(builder)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.clone(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.copy(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.destroy(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @param L <#L description#>
-- @param stack_index <#stack_index description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.load(object, L, stack_index)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function NJLI.PhysicsBodyRigid.type()
end
| mit |
DailyShana/ygopro-scripts | c22996376.lua | 3 | 2294 | --百獣王 ベヒーモス
function c22996376.initial_effect(c)
--summon/set with 1 tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(22996376,0))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c22996376.otcon)
e1:SetOperation(c22996376.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_PROC)
c:RegisterEffect(e2)
--salvage
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(22996376,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetCondition(c22996376.thcon)
e3:SetTarget(c22996376.thtg)
e3:SetOperation(c22996376.thop)
c:RegisterEffect(e3)
end
function c22996376.otcon(e,c)
if c==nil then return true end
return c:GetLevel()>6 and Duel.GetTributeCount(c)>0
end
function c22996376.otop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.SelectTribute(tp,c,1,1)
c:SetMaterial(g)
Duel.Release(g,REASON_SUMMON+REASON_MATERIAL)
--change base attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT+0xff0000)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(2000)
c:RegisterEffect(e1)
end
function c22996376.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_ADVANCE
end
function c22996376.filter(c)
return c:IsRace(RACE_BEAST) and c:IsAbleToHand()
end
function c22996376.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c22996376.filter(chkc) end
local ct=e:GetHandler():GetMaterialCount()
if chk==0 then return ct>0 and Duel.IsExistingTarget(c22996376.filter,tp,LOCATION_GRAVE,0,ct,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c22996376.filter,tp,LOCATION_GRAVE,0,ct,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,ct,0,0)
end
function c22996376.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
| gpl-2.0 |
BlubBlab/Micromacro-2-Bot-Framework | classes/abstract.inputoutput.class.lua | 1 | 15965 | CAbstractInputOutput = class(CBaseObject,
function (self, procHandle , hwnd)
self.procHandle = procHandle;
self.hwnd = hwnd;
end
);
function CAbstractInputOutput:read(Handle, type, Address )
local result = nil;
local counter = 1;
local limit = 5;
repeat
result = process.read(Handle, type, Address)
counter = counter + 1
until counter >= limit or result ~= nil
return result;
end
function CAbstractInputOutput:readPtr(Handle, type, Address, offset )
local result = nil;
local counter = 1;
local limit = 5;
repeat
result = process.readPtr(Handle, type, Address, offset)
counter = counter + 1
until counter >= limit or result ~= nil
return result;
end
function CAbstractInputOutput:debug(test_value, name,debug_flag, extra_message)
--TODO put the infos into the logger in any case
if not debug_flag then
debug_flag = 0;
end
if( settings.options.DEBUGGING and not( debug_flag == 1)) then
if( not test_value ) then
if( not extra_message)then
error("Error in memory writing or reading function:"..name.."", 2);
else
error("Error in memory writing or reading function:"..name.." "..extra_message.."", 2);
end
else
return TestValue;
end
else
return TestValue;
end
end
-- objects
function CAbstractInputOutput:ObjectId(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnId_offset ),debug.getinfo(1, "n").name,1) or 0;
end
function CAbstractInputOutput:ObjectType(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnType_offset ) ,debug.getinfo(1, "n").name,1) or -1;
end
function CAbstractInputOutput:ObjectNamePtr(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnName_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:ObjectName(visitor)
return self:debug(self:read(self.procHandle, "string", visitor:getAddress() ),debug.getinfo(1, "n").name,1);
end
function CAbstractInputOutput:ObjectPosition(select, visitor)
if(string.lower(select) == "x" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnX_offset ),debug.getinfo(1, "n").name,1) or 0;
elseif (string.lower(select) == "y" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnY_offset ) ,debug.getinfo(1, "n").name,1) or 0;
elseif (string.lower(select) == "z" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnZ_offset ) ,debug.getinfo(1, "n").name,1) or 0;
end
error("not specific coordinate type");
end
-- object lists
function CAbstractInputOutput:ObjectListSize(visitor)
return self:debug(self:read(self.procHandle, "int", addresses.staticTableSize ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:ObjectListPtr(mult)
-- 4 = 4 byte = 32-bit pointer
return self:debug(self:readPtr(self.procHandle, "uint", addresses.staticTableSize,mult * 4 ),debug.getinfo(1, "n").name,1)
end
-- pawns
function CAbstractInputOutput:PawnId(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnId_offset) ,debug.getinfo(1, "n").name,1) or 0
end
function CAbstractInputOutput:PawnRace(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnRace_offsett),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnAttackable(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnAttackable_offset),debug.getinfo(1, "n").name,1)
end
-- same as object but if somebody use with another game maybe it is diffrent
function CAbstractInputOutput:PawnNamePtr(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnName_offset ),debug.getinfo(1, "n").name,1)
end
-- again same as object and same reason to let it be
function CAbstractInputOutput:PawnName(visitor)
return self:debug(self:read(self.procHandle, "string", visitor:getAddress() ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnGUID(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnGUID_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnType(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnType_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnIsAlive(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.charAlive_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnIsFading(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnFading_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnHP(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnHP_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnMaxHP(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnMaxHP_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnLastHP(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnLastHP_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnClass(select, visitor)
local class;
if( select == 1 )then
class = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnClass1_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 2 )then
class = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnClass2_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 3 )then
class = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnClass3_offset ),debug.getinfo(1, "n").name,1)
else
error("not a class index for: "..select.."");
end
return class;
end
function CAbstractInputOutput:PawnEnergy(select, visitor)
local energy;
if( select == 1 )then
energy = self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnMP_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 2)then
energy = self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnMP2_offset ),debug.getinfo(1, "n").name,1)
else
error("not a energy index for: "..select.."");
end
return energy;
end
function CAbstractInputOutput:PawnMaxEnergy(select, visitor)
local energy;
if( select == 1 )then
energy = self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnMaxMP_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 2)then
energy = self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnMaxMP2_offset ),debug.getinfo(1, "n").name,1)
else
error("not a energy index for: "..select.."");
end
return energy;
end
function CAbstractInputOutput:PawnBuffStartEnde(visitor)
local start = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnBuffsStart_offset ),debug.getinfo(1, "n").name,1)
local ende = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnBuffsEnd_offset ),debug.getinfo(1, "n").name,1)
return start , ende;
end
function CAbstractInputOutput:PawnBuffID(i, visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + i + addresses.pawnBuffId_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnBuffTimeLeft(i , visitor)
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + i + addresses.pawnBuffTimeLeft_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnBuffLevel(i , visitor)
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + i + addresses.pawnBuffLevel_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnLootable(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnLootable_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnHarvesting(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnHarvesting_offset ),debug.getinfo(1, "n").name,1)~=0
end
function CAbstractInputOutput:PawnCasting(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress() + addresses.pawnCasting_offset ),debug.getinfo(1, "n").name,1)~=0
end
function CAbstractInputOutput:PawnLevel(select, visitor)
local level;
if( select == 1 )then
level = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnLevel_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 2 )then
level = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnLevel2_offset ),debug.getinfo(1, "n").name,1)
elseif( select == 3 )then
level = self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnLevel3_offset ),debug.getinfo(1, "n").name,1)
else
error("not a level index for: "..select.."");
end
return level;
end
function CAbstractInputOutput:PawnTargetPtr(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnTargetPtr_offset ),debug.getinfo(1, "n").name,1) or 0;
end
-- again double
function CAbstractInputOutput:PawnPosition(select, visitor)
if(string.lower(select) == "x" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnX_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "y" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnY_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "z" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnZ_offset ),debug.getinfo(1, "n").name,1)
end
error("not specific coordinate type: "..select.."");
end
function CAbstractInputOutput:PawnDirection(select, visitor)
if(string.lower(select) == "x" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirXUVec_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "z" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirZUVec_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "y" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirYUVec_offset ),debug.getinfo(1, "n").name,1)
end
error("not specific direction type: "..select.."");
end
function CAbstractInputOutput:WritePawnDirection(select, visitor, data, shift)
if not shift then
shift = 0;
end
if(string.lower(select) == "x" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirXUVec_offset, data )
elseif (string.lower(select) == "z" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirZUVec_offset, data )
elseif (string.lower(select) == "y" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.pawnDirYUVec_offset, data )
else
error("not specific direction type: "..select.."");
end
end
function CAbstractInputOutput:CameraDirection(select, visitor)
if(string.lower(select) == "x" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camXUVec_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "z" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camZUVec_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "y" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camYUVec_offset ),debug.getinfo(1, "n").name,1)
end
error("not specific direction type: "..select.."");
end
function CAbstractInputOutput:CameraPosition(select, visitor)
--TODO: move cam to addresse space
if(string.lower(select) == "x" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camX_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "y" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camY_offset ),debug.getinfo(1, "n").name,1)
elseif (string.lower(select) == "z" )then
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.camZ_offset ),debug.getinfo(1, "n").name,1)
end
error("not specific coordinate type");
end
function CAbstractInputOutput:WriteCameraDirection(data, select, visitor)
if(string.lower(select) == "x" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camXUVec_offset, data )
elseif (string.lower(select) == "z" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camZUVec_offset, data )
elseif (string.lower(select) == "y" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camYUVec_offset, data )
end
error("not specific direction type: "..select.."");
end
function CAbstractInputOutput:WriteCameraPosition(data, select, visitor)
--TODO: move cam to addresse space
if(string.lower(select) == "x" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camX_offset, data);
elseif (string.lower(select) == "y" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camY_offset, data);
elseif (string.lower(select) == "z" )then
return process.write(self.procHandle, "float", visitor:getAddress() + addresses.camZ_offset, data);
end
error("not specific coordinate type: "..select.."");
end
function CAbstractInputOutput:PawnSwimming(visitor)
return self:debug(self:readPtr(self.procHandle, "byte", visitor:getAddress() + addresses.pawnSwim_offset1, addresses.pawnSwim_offset2 ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnIsPet(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.pawnIsPet_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnSpeed(visitor)
return self:debug(self:read(self.procHandle, "float", visitor:getAddress() + addresses.pawnSpeed_offset ),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnIconBase(visitor)
return self:debug(self:readPtr(self.procHandle, "uint", visitor:getAddress() + addresses.partyIconList_base, addresses.partyIconList_offset),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PawnIconRead(visitor)
return self:debug(self:read(self.procHandle, "int", visitor:getAddress()),debug.getinfo(1, "n").name,1)
end
function CAbstractInputOutput:PressKey(visitor, key1, key2)
if( not key2)then
keyboard.virtualPress(self.hwnd, key1, true);
else
keyboard.virtualHold(self.hwnd, key1);
end
if (key2)then
keyboard.virtualHold(self.hwnd, key2);
keyboard.virtualRelease(self.hwnd, key1);
keyboard.virtualRelease(self.hwnd, key2);
end
end
function CAbstractInputOutput:PressHold(visitor, key1, key2)
keyboard.virtualHold(self.hwnd, key1);
if (key2)then
keyboard.virtualHold(self.hwnd, key2);
end
end
function CAbstractInputOutput:PressRelease(visitor, key1, key2)
keyboard.virtualRelease(self.hwnd, key1);
if (key2)then
keyboard.virtualRelease(self.hwnd, key2);
end
end
function CAbstractInputOutput:WriteText(visitor,text)
keyboard.keyboard.virtualType(self.hwnd, text);
end
function CAbstractInputOutput:MountBase(visitor)
return self:debug(self:read(self.procHandle, "uint", visitor:getAddress() + addresses.charPtrMounted_offset ),debug.getinfo(1, "n").name,1)
end
| mit |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_bestine_rumor03.lua | 3 | 2208 | --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_bestine_rumor03 = object_mobile_shared_dressed_bestine_rumor03:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_bestine_rumor03, "object/mobile/dressed_bestine_rumor03.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/space/booster/extended_life_fuel_cell_mk1.lua | 2 | 3336 | --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_booster_extended_life_fuel_cell_mk1 = object_draft_schematic_space_booster_shared_extended_life_fuel_cell_mk1:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Extended Life Fuel Cell - Mark I",
craftingToolTab = 131072, -- (See DraftSchemticImplementation.h)
complexity = 19,
size = 0,
xpType = "shipwright",
xp = 25,
assemblySkill = "booster_assembly",
experimentingSkill = "booster_experimentation",
customizationSkill = "medicine_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"fuel_cell_core", "adv_fuel_cell_enhancer"},
ingredientSlotType = {0, 0},
resourceTypes = {"steel", "radioactive_polymetric"},
resourceQuantities = {75, 25},
contribution = {100, 100},
targetTemplate = "object/tangible/ship/crafted/booster/extended_life_fuel_cell_mk1.iff",
additionalTemplates = {
"object/tangible/ship/crafted/booster/shared_extended_life_fuel_cell_mk1.iff",
}
}
ObjectTemplates:addTemplate(object_draft_schematic_space_booster_extended_life_fuel_cell_mk1, "object/draft_schematic/space/booster/extended_life_fuel_cell_mk1.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/naboo/objects.lua | 3 | 20598 | --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_static_naboo_shared_waterfall_200m = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_200m.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_whitewater_6m.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_6meter.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 2421347186,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_200m, "object/static/naboo/shared_waterfall_200m.iff")
object_static_naboo_shared_waterfall_all_thin_forked = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_all_thin_forked.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_all_waterfall_thin_forked.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_tall_forked.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 2586864352,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_all_thin_forked, "object/static/naboo/shared_waterfall_all_thin_forked.iff")
object_static_naboo_shared_waterfall_all_wide_short = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_all_wide_short.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_all_waterfall_wide_short.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_wide_short.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 1454317490,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_all_wide_short, "object/static/naboo/shared_waterfall_all_wide_short.iff")
object_static_naboo_shared_waterfall_mist_lg = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_mist_lg.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/thed_wter_falls_anim1.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_mist_lg.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 4151923875,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_mist_lg, "object/static/naboo/shared_waterfall_mist_lg.iff")
object_static_naboo_shared_waterfall_mist_small = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_mist_small.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/thed_wter_falls_anim1.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_mist_small.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 3240630762,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_mist_small, "object/static/naboo/shared_waterfall_mist_small.iff")
object_static_naboo_shared_waterfall_naboo_crest_01 = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_crest_01.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/pt_waterfall_whitewater_s02_l0.prt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_naboo_theed.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Naboo Waterfall",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 4101701818,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_crest_01, "object/static/naboo/shared_waterfall_naboo_crest_01.iff")
object_static_naboo_shared_waterfall_naboo_falls_01 = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_falls_01.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/pt_waterfall_whitewater_s02_l1.prt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_naboo_theed.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Naboo Waterfall",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 282497930,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_falls_01, "object/static/naboo/shared_waterfall_naboo_falls_01.iff")
object_static_naboo_shared_waterfall_naboo_hangar = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_hangar.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_nboo_thed_waterfall_hangar.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_6meter.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 370991757,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_hangar, "object/static/naboo/shared_waterfall_naboo_hangar.iff")
object_static_naboo_shared_waterfall_naboo_keren = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_keren.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_nboo_waterfall_moenia.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_keren.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 3951584767,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_keren, "object/static/naboo/shared_waterfall_naboo_keren.iff")
object_static_naboo_shared_waterfall_naboo_theed_base = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_theed_base.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/thed_wter_falls_anim1.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_naboo_theed.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Naboo Waterfall",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 4195612510,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_theed_base, "object/static/naboo/shared_waterfall_naboo_theed_base.iff")
object_static_naboo_shared_waterfall_naboo_theed_style_1 = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_waterfall_naboo_theed_style_1.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/pt_invisible_particle.prt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_waterfall_naboo_theed.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Naboo Waterfall",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 3625221420,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_waterfall_naboo_theed_style_1, "object/static/naboo/shared_waterfall_naboo_theed_style_1.iff")
object_static_naboo_shared_whitewater_6meter = SharedStaticObjectTemplate:new {
clientTemplateFileName = "object/static/naboo/shared_whitewater_6meter.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eft_whitewater_6m.apt",
arrangementDescriptorFilename = "",
clearFloraRadius = 0,
clientDataFile = "clientdata/client_shared_whitewater_6m.cdf",
clientGameObjectType = 5,
collisionActionBlockFlags = 255,
collisionActionFlags = 1,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 1,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "@string_table:Whitewater Mesh",
gameObjectType = 5,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_object",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 4015665582,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/static/base/shared_static_base.iff", "object/static/terrain/base/shared_static_terrain_base.iff", "object/static/naboo/shared_waterfall_naboo_theed_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_static_naboo_shared_whitewater_6meter, "object/static/naboo/shared_whitewater_6meter.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_noble_trandoshan_male_01.lua | 3 | 2244 | --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_noble_trandoshan_male_01 = object_mobile_shared_dressed_noble_trandoshan_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_noble_trandoshan_male_01, "object/mobile/dressed_noble_trandoshan_male_01.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/faction_perk/hq/hq_s05_rebel.lua | 3 | 2311 | --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_building_faction_perk_hq_hq_s05_rebel = object_building_faction_perk_hq_shared_hq_s05_rebel:new {
lotSize = 1,
maintenanceCost = 1337,
allowedZones = {0,1,4,5,6,7,8}
}
ObjectTemplates:addTemplate(object_building_faction_perk_hq_hq_s05_rebel, "object/building/faction_perk/hq/hq_s05_rebel.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/loot/quest/force_sensitive/serverobjects.lua | 3 | 2498 | --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/loot/quest/force_sensitive/camp_frequency_datapad.lua")
includeFile("tangible/loot/quest/force_sensitive/camp_remote.lua")
includeFile("tangible/loot/quest/force_sensitive/camp_waypoint_datapad.lua")
includeFile("tangible/loot/quest/force_sensitive/theater_datapad.lua")
includeFile("tangible/loot/quest/force_sensitive/sharred_force_crystal.lua")
includeFile("tangible/loot/quest/force_sensitive/sharred_waypoint_datapad.lua")
| agpl-3.0 |
Whitechaser/darkstar | scripts/globals/spells/sage_etude.lua | 2 | 1609 | -----------------------------------------
-- Spell: Sage Etude
-- Static INT Boost, BRD 66
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/msg");
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing
local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED);
local power = 0;
if (sLvl+iLvl <= 416) then
power = 12;
elseif ((sLvl+iLvl >= 417) and (sLvl+iLvl <= 445)) then
power = 13;
elseif ((sLvl+iLvl >= 446) and (sLvl+iLvl <= 474)) then
power = 14;
elseif (sLvl+iLvl >= 475) then
power = 15;
end
local iBoost = caster:getMod(MOD_ETUDE_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
power = power + iBoost;
if (caster:hasStatusEffect(dsp.effects.SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(dsp.effects.MARCATO)) then
power = power * 1.5;
end
caster:delStatusEffect(dsp.effects.MARCATO);
local duration = 120;
duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(dsp.effects.TROUBADOUR)) then
duration = duration * 2;
end
if not (target:addBardSong(caster,dsp.effects.ETUDE,power,10,duration,caster:getID(), MOD_INT, 2)) then
spell:setMsg(msgBasic.MAGIC_NO_EFFECT);
end
return dsp.effects.ETUDE;
end;
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/poi/corellia_solitude_large1.lua | 2 | 2258 | --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_building_poi_corellia_solitude_large1 = object_building_poi_shared_corellia_solitude_large1:new {
gameObjectType = 531,
}
ObjectTemplates:addTemplate(object_building_poi_corellia_solitude_large1, "object/building/poi/corellia_solitude_large1.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/lair/npc_theater/global_bothan_information_broker_camp_neutral_small_theater.lua | 3 | 1152 | global_bothan_information_broker_camp_neutral_small_theater = Lair:new {
mobiles = {{"bothan_information_broker",1}},
spawnLimit = 9,
buildingsVeryEasy = {"object/building/poi/tatooine_hutt_businessmen_camp_small1.iff","object/building/poi/tatooine_hutt_businessmen_camp_small2.iff"},
buildingsEasy = {"object/building/poi/tatooine_hutt_businessmen_camp_small1.iff","object/building/poi/tatooine_hutt_businessmen_camp_small2.iff"},
buildingsMedium = {"object/building/poi/tatooine_hutt_businessmen_camp_small1.iff","object/building/poi/tatooine_hutt_businessmen_camp_small2.iff"},
buildingsHard = {"object/building/poi/tatooine_hutt_businessmen_camp_small1.iff","object/building/poi/tatooine_hutt_businessmen_camp_small2.iff"},
buildingsVeryHard = {"object/building/poi/tatooine_hutt_businessmen_camp_small1.iff","object/building/poi/tatooine_hutt_businessmen_camp_small2.iff"},
missionBuilding = "object/tangible/lair/base/objective_banner_generic_2.iff",
mobType = "npc",
buildingType = "theater"
}
addLairTemplate("global_bothan_information_broker_camp_neutral_small_theater", global_bothan_information_broker_camp_neutral_small_theater)
| agpl-3.0 |
DailyShana/ygopro-scripts | c38299233.lua | 3 | 1128 | --ニードル・ウォール
function c38299233.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
c:RegisterEffect(e1)
--roll and destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(38299233,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetCondition(c38299233.rdcon)
e2:SetTarget(c38299233.rdtg)
e2:SetOperation(c38299233.rdop)
c:RegisterEffect(e2)
end
function c38299233.rdcon(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function c38299233.rdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1)
end
function c38299233.rdop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local d1=6
while d1==6 do
d1=Duel.TossDice(tp,1)
end
local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,d1-1)
if tc then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
pjm0616/meowbot-pub | modules/lua/autojoin.lua | 1 | 2582 | --[[
meowbot
Copyright (C) 2008-2009 Park Jeong Min <pjm0616_at_gmail_d0t_com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]--
chanlist_file_pfx = './data/autojoin/chanlist-'
function savechanlist(isrv)
local cname = isrv:get_name()
os.remove(chanlist_file_pfx..cname..'.txt')
local fh, errmsg
fh, errmsg = io.open(chanlist_file_pfx..cname..'.txt', 'w')
if not fh then
print('io.open(chanlist_file, \'w\') failed: ' .. errmsg)
return false
end
local clist = isrv:get_chanlist()
fh:write(table.concat(clist, ',') .. '\n')
fh:close()
return true
end
function cmd_savechanlist(isrv, who, msginfo, mdest, cmd, carg)
if not isrv:getbot():is_botadmin(who:getident()) then
return
end
savechanlist(isrv)
isrv:privmsg(mdest, 'chanlist saved')
end
function login_handler(isrv)
local cname = isrv:get_name()
local fh, errmsg
fh, errmsg = io.open(chanlist_file_pfx..cname..'.txt', 'r')
if not fh then
print('io.open(chanlist_file, \'r\') failed: ' .. errmsg)
return
end
clist = fh:read('*l') -- read one line
if (clist == nil) or (clist == '') then
print('autojoin failed: ' .. chanlist_file_pfx..cname..'.txt' .. ' is empty')
else
isrv:quote('JOIN ' .. clist)
end
return true
end
function disconnect_handler(isrv)
--savechanlist(isrv) -- join, part handler로 이동
return true
end
function join_handler(isrv, who, chan)
savechanlist(isrv)
end
function part_handler(isrv, who, chan)
savechanlist(isrv)
end
function init(bot)
bot:register_event_handler('login', login_handler)
bot:register_event_handler('join', join_handler)
bot:register_event_handler('part', part_handler)
bot:register_event_handler('disconnect', disconnect_handler)
bot:register_cmd('savechanlist', cmd_savechanlist)
end
function cleanup(bot)
bot:unregister_event_handler('login')
bot:unregister_event_handler('join')
bot:unregister_event_handler('part')
bot:unregister_event_handler('disconnect')
bot:unregister_cmd('savechanlist')
--savechanlist(bot)
end
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/installation/mining_organic/mining_organic_flora_farm_heavy.lua | 1 | 2719 | --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_installation_mining_organic_mining_organic_flora_farm_heavy = object_installation_mining_organic_shared_mining_organic_flora_farm_heavy:new {
lotSize = 1,
baseMaintenanceRate = 5,
-- SOLAR = 1; CHEMICAL = 2; FLORA = 3; GAS = 4; GEOTHERMAL = 5; MINERAL = 6; WATER = 7; WIND = 8; FUSION = 9;
installationType = 3,
basePowerRate = 10,
width = 3,
length = 3,
objectMenuComponent = "InstallationObjectMenuComponent",
constructionMarker = "object/installation/mining_ore/construction/construction_mining_ore_harvester_style_heavy.iff"
}
ObjectTemplates:addTemplate(object_installation_mining_organic_mining_organic_flora_farm_heavy, "object/installation/mining_organic/mining_organic_flora_farm_heavy.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/skirt/skirt_s13.lua | 3 | 5176 | --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_skirt_skirt_s13 = object_tangible_wearables_skirt_shared_skirt_s13: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/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" },
numberExperimentalProperties = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "sockets", "hitpoints", "mod_idx_one", "mod_val_one", "mod_idx_two", "mod_val_two", "mod_idx_three", "mod_val_three", "mod_idx_four", "mod_val_four", "mod_idx_five", "mod_val_five", "mod_idx_six", "mod_val_six"},
experimentalMin = {0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalMax = {0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalPrecision = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_wearables_skirt_skirt_s13, "object/tangible/wearables/skirt/skirt_s13.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/rori/cobral_mugger.lua | 1 | 1216 | cobral_mugger = Creature:new {
objectName = "",
randomNameType = NAME_GENERIC_TAG,
customName = "a Neo-Cobral Mugger",
socialGroup = "cobral",
faction = "cobral",
level = 9,
chanceHit = 0.27,
damageMin = 80,
damageMax = 90,
baseXp = 235,
baseHAM = 675,
baseHAMmax = 825,
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,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = NONE,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_cobral_mugger_human_male_01.iff",
"object/mobile/dressed_cobral_mugger_human_female_01.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 3000000},
{group = "wearables_common", chance = 2000000},
{group = "loot_kit_parts", chance = 2000000},
{group = "tailor_components", chance = 1000000},
{group = "melee_weapons", chance = 2000000}
}
}
},
weapons = {"pirate_weapons_light"},
conversationTemplate = "",
reactionStf = "@npc_reaction/slang",
attacks = merge(brawlernovice,marksmannovice)
}
CreatureTemplates:addCreatureTemplate(cobral_mugger, "cobral_mugger")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/installation/mockup_mining_gas_harvester_style_1.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_static_installation_mockup_mining_gas_harvester_style_1 = object_static_installation_shared_mockup_mining_gas_harvester_style_1:new {
}
ObjectTemplates:addTemplate(object_static_installation_mockup_mining_gas_harvester_style_1, "object/static/installation/mockup_mining_gas_harvester_style_1.iff")
| agpl-3.0 |
KingRaptor/Zero-K | effects/disrupter_missile.lua | 19 | 3610 | return {
["disruptor_missile_hit"] = {
usedefaultexplosions = false,
airflash = {
air = true,
class = [[heatcloud]],
count = 3,
ground = true,
water = true,
properties = {
alwaysvisible = false,
heat = [[40]],
heatfalloff = 5,
maxheat = 40,
pos = 0,
size = [[5]],
sizegrowth = 3,
speed = [[1 r2]],
texture = [[pinknovaexplo]],
},
},
groundflash = {
circlealpha = 1,
circlegrowth = 0.125,
flashalpha = 0.5,
flashsize = 16,
ttl = 64,
color = {
[1] = 0.5,
[2] = 0.1,
[3] = 0.9,
},
},
cinder = {
air = true,
class = [[heatcloud]],
count = 3,
ground = true,
water = true,
properties = {
alwaysvisible = false,
heat = [[100]],
heatfalloff = 2,
maxheat = 100,
pos = 0,
size = [[5]],
sizegrowth = -0.05,
speed = [[0.1 r0.2]],
texture = [[pinknovaexplo]],
},
},
steam = {
class = [[CExpGenSpawner]],
count = 2,
nounit = 1,
properties = {
delay = [[i1]],
dir = [[dir]],
explosiongenerator = [[custom:BEAMWEAPON_HIT_YELLOW_STEAM]],
pos = [[0, 0, 0]],
},
},
sparks = {
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
unit = 1,
properties = {
airdrag = 0.996,
alwaysvisible = false,
colormap = [[1 0.25 1 0.01 0.01 0.005 0.02 0.01]],
directional = true,
emitrotspread = 360,
emitvector = [[dir]],
gravity = [[0,-0.1,0]];
numparticles = 20,
particlelife = 15,
particlelifespread = 10,
particlesize = 1,
particlesizespread = 1,
particlespeed = 2.5,
particlespeedspread = 2,
pos = [[0, 0, 0]],
sizegrowth = 0,
sizemod = 0.9,
texture = [[pinknovaexplo]],
},
},
smoke = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
underwater = 1,
water = true,
properties = {
airdrag = 0.9,
colormap = [[0.05 0.05 0.05 0.4 0 0 0 0.001]],
directional = false,
emitrot = 80,
emitrotspread = 10,
emitvector = [[0, 1, 0]],
gravity = [[0, 0.001, 0]],
numparticles = 5,
particlelife = 30,
particlelifespread = 20,
particlesize = 2,
particlesizespread = 1,
particlespeed = 1,
particlespeedspread = 2,
pos = [[0, 0, 0]],
sizegrowth = 1.5,
sizemod = 0.985,
texture = [[smoke]],
},
},
},
}
| gpl-2.0 |
LingJiJian/Tui-x | HelloTuiLua/extern.lua | 48 | 2506 | function clone(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for key, value in pairs(object) do
new_table[_copy(key)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
--Create an class.
function class(classname, super)
local superType = type(super)
local cls
if superType ~= "function" and superType ~= "table" then
superType = nil
super = nil
end
if superType == "function" or (super and super.__ctype == 1) then
-- inherited from native C++ Object
cls = {}
if superType == "table" then
-- copy fields from super
for k,v in pairs(super) do cls[k] = v end
cls.__create = super.__create
cls.super = super
else
cls.__create = super
end
cls.ctor = function() end
cls.__cname = classname
cls.__ctype = 1
function cls.new(...)
local instance = cls.__create(...)
-- copy fields from class to native object
for k,v in pairs(cls) do instance[k] = v end
instance.class = cls
instance:ctor(...)
return instance
end
else
-- inherited from Lua Object
if super then
cls = clone(super)
cls.super = super
else
cls = {ctor = function() end}
end
cls.__cname = classname
cls.__ctype = 2 -- lua
cls.__index = cls
function cls.new(...)
local instance = setmetatable({}, cls)
instance.class = cls
instance:ctor(...)
return instance
end
end
return cls
end
function schedule(node, callback, delay)
local delay = cc.DelayTime:create(delay)
local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback))
local action = cc.RepeatForever:create(sequence)
node:runAction(action)
return action
end
function performWithDelay(node, callback, delay)
local delay = cc.DelayTime:create(delay)
local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback))
node:runAction(sequence)
return sequence
end
| mit |
Whitechaser/darkstar | scripts/zones/Northern_San_dOria/npcs/Mevaloud.lua | 5 | 1120 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Mevaloud
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Northern_San_dOria/TextIDs");
require("scripts/globals/settings");
require("scripts/globals/quests");
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE);
if (FlyerForRegine == 1) then
local count = trade:getItemCount();
local MagicFlyer = trade:hasItemQty(532,1);
if (MagicFlyer == true and count == 1) then
player:messageSpecial(FLYER_REFUSED);
end
end
end;
function onTrigger(player,npc)
player:startEvent(661);
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);
end;
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/verne.lua | 3 | 2136 | --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_verne = object_mobile_shared_verne:new {
}
ObjectTemplates:addTemplate(object_mobile_verne, "object/mobile/verne.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/ship/droid_fighter_tier2.lua | 3 | 2184 | --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_droid_fighter_tier2 = object_ship_shared_droid_fighter_tier2:new {
}
ObjectTemplates:addTemplate(object_ship_droid_fighter_tier2, "object/ship/droid_fighter_tier2.iff")
| agpl-3.0 |
Zefiros-Software/premake-core | modules/vstudio/vs2005_dotnetbase.lua | 3 | 19152 | --
-- vs2005_dotnetbase.lua
-- Generate a Visual Studio 2005+ .NET project.
-- Copyright (c) Jason Perkins and the Premake project
--
local p = premake
p.vstudio.dotnetbase = {}
local vstudio = p.vstudio
local dotnetbase = p.vstudio.dotnetbase
local project = p.project
local config = p.config
local fileconfig = p.fileconfig
local dotnet = p.tools.dotnet
dotnetbase.elements = {}
dotnetbase.langObj = {}
--
-- Generate a Visual Studio 200x dotnet project, with support for the new platforms API.
--
function dotnetbase.prepare(langObj)
dotnetbase.elements.project = langObj.elements.project
dotnetbase.elements.projectProperties = langObj.elements.projectProperties
dotnetbase.elements.configuration = langObj.elements.configuration
dotnetbase.langObj = langObj
end
function dotnetbase.generate(prj)
p.utf8()
p.callArray(dotnetbase.elements.project, prj)
_p(1,'<ItemGroup>')
dotnetbase.files(prj)
_p(1,'</ItemGroup>')
dotnetbase.projectReferences(prj)
dotnetbase.packageReferences(prj)
dotnetbase.langObj.targets(prj)
dotnetbase.buildEvents(prj)
p.out('</Project>')
end
--
-- Write the opening <Project> element.
--
function dotnetbase.projectElement(prj)
local ver = ''
local action = p.action.current()
if action.vstudio.toolsVersion then
ver = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion)
end
_p('<Project%s DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', ver)
end
--
-- Write the opening PropertyGroup, which contains the project-level settings.
--
function dotnetbase.projectProperties(prj)
_p(1,'<PropertyGroup>')
local cfg = project.getfirstconfig(prj)
p.callArray(dotnetbase.elements.projectProperties, cfg)
_p(1,'</PropertyGroup>')
end
--
-- Write out the settings for the project configurations.
--
function dotnetbase.configurations(prj)
for cfg in project.eachconfig(prj) do
dotnetbase.configuration(cfg)
end
end
function dotnetbase.configuration(cfg)
p.callArray(dotnetbase.elements.configuration, cfg)
_p(1,'</PropertyGroup>')
end
function dotnetbase.dofile(node, cfg, condition)
local filecfg = fileconfig.getconfig(node, cfg)
if filecfg then
local fname = path.translate(node.relpath)
-- Files that live outside of the project tree need to be "linked"
-- and provided with a project relative pseudo-path. Check for any
-- leading "../" sequences and, if found, remove them and mark this
-- path as external.
local link, count = node.relpath:gsub("%.%.%/", "")
local external = (count > 0)
-- Try to provide a little bit of flexibility by allowing virtual
-- paths for external files. Would be great to support them for all
-- files but Visual Studio chokes if file is already in project area.
if external and node.vpath ~= node.relpath then
link = node.vpath
end
-- Deduce what, if any, special attributes are required for this file.
-- For example, forms may have related source, designer, and resource
-- files which need to be associated.
local info = dotnet.fileinfo(filecfg)
-- Process any sub-elements required by this file; choose the write
-- element form to use based on the results.
local contents = p.capture(function ()
-- Try to write file-level elements in the same order as Visual Studio
local elements = {
"AutoGen",
"CopyToOutputDirectory",
"DesignTime",
"DependentUpon",
"DesignTimeSharedInput",
"Generator",
"LastGenOutput",
"SubType",
}
for _, el in ipairs(elements) do
local value = info[el]
if value then
_p(3,"<%s>%s</%s>", el, value, el)
end
end
if info.action == "EmbeddedResource" and cfg.customtoolnamespace then
_p(3,"<CustomToolNamespace>%s</CustomToolNamespace>", cfg.customtoolnamespace)
end
end)
if #contents > 0 or external then
_p(2,'<%s%s Include="%s">', info.action, condition, fname)
if external then
_p(3,'<Link>%s</Link>', path.translate(link))
end
if #contents > 0 then
_p("%s", contents)
end
_p(2,'</%s>', info.action)
else
_p(2,'<%s%s Include="%s" />', info.action, condition, fname)
end
end
end
--
-- Write out the source files item group.
--
function dotnetbase.files(prj)
local firstcfg = project.getfirstconfig(prj)
local processfcfg = function(node)
-- test if all fileinfo's are going to be the same for each config.
local allsame = true
local first = nil
for cfg in project.eachconfig(prj) do
local filecfg = fileconfig.getconfig(node, cfg)
local info = dotnet.fileinfo(filecfg)
if first == nil then
first = info
elseif not table.equals(first, info) then
allsame = false
end
end
-- output to proj file.
if allsame then
dotnetbase.dofile(node, firstcfg, '')
else
for cfg in project.eachconfig(prj) do
dotnetbase.dofile(node, cfg, ' ' .. dotnetbase.condition(cfg))
end
end
end
if project.isfsharp(prj) then
sorter = function(a,b)
verbosef('Sorting F# proj file (%s, %s), index %s < %s', a.name, b.name, a.order, b.order)
return a.order < b.order
end
table.sort(prj._.files, sorter)
table.foreachi(prj._.files, processfcfg)
else
local tr = project.getsourcetree(prj)
p.tree.traverse(tr, {
onleaf = processfcfg
}, false)
end
end
--
-- Write out pre- and post-build events, if provided.
--
function dotnetbase.buildEvents(prj)
local function output(name, steps)
if #steps > 0 then
steps = os.translateCommandsAndPaths(steps, prj.basedir, prj.location)
steps = table.implode(steps, "", "", "\r\n")
_x(2,'<%sBuildEvent>%s</%sBuildEvent>', name, steps, name)
end
end
local cfg = project.getfirstconfig(prj)
if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then
_p(1,'<PropertyGroup>')
output("Pre", cfg.prebuildcommands)
output("Post", cfg.postbuildcommands)
_p(1,'</PropertyGroup>')
end
end
--
-- Write the compiler flags for a particular configuration.
--
function dotnetbase.compilerProps(cfg)
_x(2,'<DefineConstants>%s</DefineConstants>', table.concat(cfg.defines, ";"))
_p(2,'<ErrorReport>prompt</ErrorReport>')
_p(2,'<WarningLevel>4</WarningLevel>')
if cfg.clr == "Unsafe" then
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
end
if cfg.flags.FatalCompileWarnings then
_p(2,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>')
end
dotnetbase.debugCommandParameters(cfg)
end
--
-- Write out the debug start parameters for MonoDevelop/Xamarin Studio.
--
function dotnetbase.debugCommandParameters(cfg)
if #cfg.debugargs > 0 then
_x(2,'<Commandlineparameters>%s</Commandlineparameters>', table.concat(cfg.debugargs, " "))
end
end
--
-- Write out the debugging and optimization flags for a configuration.
--
function dotnetbase.debugProps(cfg)
if cfg.symbols == p.ON then
_p(2,'<DebugSymbols>true</DebugSymbols>')
_p(2,'<DebugType>full</DebugType>')
else
_p(2,'<DebugType>pdbonly</DebugType>')
end
_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), "true", "false"))
end
--
-- Write out the target and intermediates settings for a configuration.
--
function dotnetbase.outputProps(cfg)
local outdir = vstudio.path(cfg, cfg.buildtarget.directory)
_x(2,'<OutputPath>%s\\</OutputPath>', outdir)
-- Want to set BaseIntermediateOutputPath because otherwise VS will create obj/
-- anyway. But VS2008 throws up ominous warning if present.
local objdir = vstudio.path(cfg, cfg.objdir)
if _ACTION > "vs2008" then
_x(2,'<BaseIntermediateOutputPath>%s\\</BaseIntermediateOutputPath>', objdir)
_p(2,'<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>')
else
_x(2,'<IntermediateOutputPath>%s\\</IntermediateOutputPath>', objdir)
end
end
--
-- Write out the references item group.
--
dotnetbase.elements.references = function(prj)
return {
dotnetbase.assemblyReferences,
dotnetbase.nuGetReferences,
}
end
function dotnetbase.references(prj)
_p(1,'<ItemGroup>')
p.callArray(dotnetbase.elements.references, prj)
_p(1,'</ItemGroup>')
end
--
-- Write the list of assembly (system, or non-sibling) references.
--
function dotnetbase.assemblyReferences(prj)
-- C# doesn't support per-configuration links (does it?) so just use
-- the settings from the first available config instead
local cfg = project.getfirstconfig(prj)
config.getlinks(cfg, "system", function(original, decorated)
local name = path.getname(decorated)
if path.getextension(name) == ".dll" then
name = name.sub(name, 1, -5)
end
if decorated:find("/", nil, true) then
_x(2,'<Reference Include="%s">', name)
local decPath, decVars = decorated:match("(.-),")
if not decPath then
decPath = decorated
end
_x(3,'<HintPath>%s</HintPath>', path.appendextension(path.translate(decPath), ".dll"))
if not config.isCopyLocal(prj, original, true) then
_p(3,"<Private>False</Private>")
end
_p(2,'</Reference>')
else
_x(2,'<Reference Include="%s" />', name)
end
end)
end
--
-- This is a bit janky. To compare versions, we extract all numbers from the
-- given string and right-pad the result with zeros. Then we can just do a
-- lexicographical compare on the resulting strings.
--
-- This is so that we can compare version strings such as "4.6" and "net451"
-- with each other.
--
function dotnetbase.makeVersionComparable(version)
local numbers = ""
for number in version:gmatch("%d") do
numbers = numbers .. number
end
return string.format("%-10d", numbers):gsub(" ", "0")
end
--
-- https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs
--
function dotnetbase.frameworkVersionForFolder(folder)
-- If this exporter ever supports frameworks such as "netstandard1.3",
-- "sl4", "sl5", "uap10", "wp8" or "wp71", this code will need changing
-- to match the right folders, depending on the current framework.
-- Right now this only matches folders for the .NET Framework.
if folder:match("^net%d+$") or folder:match("^[0-9%.]+$") then
return dotnetbase.makeVersionComparable(folder)
elseif folder == "net" then
return dotnetbase.makeVersionComparable("0")
end
end
--
-- Write the list of NuGet references.
--
function dotnetbase.nuGetReferences(prj)
if _ACTION >= "vs2010" and not vstudio.nuget2010.supportsPackageReferences(prj) then
for _, package in ipairs(prj.nuget) do
local id = vstudio.nuget2010.packageId(package)
local packageAPIInfo = vstudio.nuget2010.packageAPIInfo(prj, package)
local cfg = p.project.getfirstconfig(prj)
local action = p.action.current()
local targetFramework = cfg.dotnetframework or action.vstudio.targetFramework
local targetVersion = dotnetbase.makeVersionComparable(targetFramework)
-- Figure out what folder contains the files for the nearest
-- supported .NET Framework version.
local files = {}
local bestVersion, bestFolder
for _, file in ipairs(packageAPIInfo.packageEntries) do
local folder = file:match("^lib[\\/](.+)[\\/]")
if folder and path.hasextension(file, ".dll") then
local version = dotnetbase.frameworkVersionForFolder(folder)
if version then
files[folder] = files[folder] or {}
table.insert(files[folder], file)
if version <= targetVersion and (not bestVersion or version > bestVersion) then
bestVersion = version
bestFolder = folder
end
end
end
end
if not bestVersion then
p.error("NuGet package '%s' is not compatible with project '%s' .NET Framework version '%s'", id, prj.name, targetFramework)
end
-- Now, add references for all DLLs in that folder.
for _, file in ipairs(files[bestFolder]) do
-- There's some stuff missing from this include that we
-- can't get from the API and would need to download and
-- extract the package to figure out. It looks like we can
-- just omit it though.
--
-- So, for example, instead of:
--
-- <Reference Include="nunit.framework, Version=3.6.1.0,
-- <Culture=neutral, PublicKeyToken=2638cd05610744eb,
-- <processorArchitecture=MSIL">
--
-- We're just outputting:
--
-- <Reference Include="nunit.framework">
_x(2, '<Reference Include="%s">', path.getbasename(file))
_x(3, '<HintPath>%s</HintPath>', vstudio.path(prj, p.filename(prj.workspace, string.format("packages\\%s.%s\\%s", id, packageAPIInfo.verbatimVersion or packageAPIInfo.version, file))))
if config.isCopyLocal(prj, package, true) then
_p(3, '<Private>True</Private>')
else
_p(3, '<Private>False</Private>')
end
_p(2, '</Reference>')
end
end
end
end
--
-- Write the list of project dependencies.
--
function dotnetbase.projectReferences(prj)
_p(1,'<ItemGroup>')
local deps = project.getdependencies(prj, 'linkOnly')
if #deps > 0 then
for _, dep in ipairs(deps) do
local relpath = vstudio.path(prj, vstudio.projectfile(dep))
_x(2,'<ProjectReference Include="%s">', relpath)
_p(3,'<Project>{%s}</Project>', dep.uuid)
_x(3,'<Name>%s</Name>', dep.name)
if not config.isCopyLocal(prj, dep.name, true) then
_p(3,"<Private>False</Private>")
end
_p(2,'</ProjectReference>')
end
end
_p(1,'</ItemGroup>')
end
--
-- Write the list of package dependencies.
--
function dotnetbase.packageReferences(prj)
if vstudio.nuget2010.supportsPackageReferences(prj) then
local hasNuget = prj.nuget and #prj.nuget>0
for cfg in project.eachconfig(prj) do
if cfg.nuget and #cfg.nuget>0 then
hasNuget = true
end
end
if hasNuget then
_p(1,'<ItemGroup>')
if prj.nuget and #prj.nuget>0 then
for _, package in ipairs(prj.nuget) do
_p(2,'<PackageReference Include="%s" Version="%s"/>', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package))
end
end
for cfg in project.eachconfig(prj) do
if cfg.nuget and #cfg.nuget>0 then
for _, package in ipairs(cfg.nuget) do
if prj.nuget[package]==nil then
_p(2,'<PackageReference Include="%s" Version="%s" %s/>', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package), dotnetbase.condition(cfg))
end
end
end
end
_p(1,'</ItemGroup>')
end
end
end
--
-- Return the Visual Studio architecture identification string. The logic
-- to select this is getting more complicated in VS2010, but I haven't
-- tackled all the permutations yet.
--
function dotnetbase.arch(cfg)
local arch = vstudio.archFromConfig(cfg)
if arch == "Any CPU" then
arch = "AnyCPU"
end
return arch
end
--
-- Write the PropertyGroup element for a specific configuration block.
--
function dotnetbase.propertyGroup(cfg)
p.push('<PropertyGroup %s>', dotnetbase.condition(cfg))
local arch = dotnetbase.arch(cfg)
if arch ~= "AnyCPU" or _ACTION > "vs2008" then
p.x('<PlatformTarget>%s</PlatformTarget>', arch)
end
end
--
-- Generators for individual project elements.
--
function dotnetbase.applicationIcon(prj)
if prj.icon then
local icon = vstudio.path(prj, prj.icon)
_p(1,'<PropertyGroup>')
_x(2,'<ApplicationIcon>%s</ApplicationIcon>', icon)
_p(1,'</PropertyGroup>')
end
end
---------------------------------------------------------------------------
--
-- Support functions
--
---------------------------------------------------------------------------
--
-- Format and return a Visual Studio Condition attribute.
--
function dotnetbase.condition(cfg)
local platform = vstudio.projectPlatform(cfg)
local arch = dotnetbase.arch(cfg)
return string.format('Condition=" \'$(Configuration)|$(Platform)\' == \'%s|%s\' "', platform, arch)
end
--
-- When given a .NET Framework version, returns it formatted for NuGet.
--
function dotnetbase.formatNuGetFrameworkVersion(framework)
return "net" .. framework:gsub("%.", "")
end
---------------------------------------------------------------------------
--
-- Handlers for individual project elements
--
---------------------------------------------------------------------------
function dotnetbase.appDesignerFolder(cfg)
_p(2,'<AppDesignerFolder>Properties</AppDesignerFolder>')
end
function dotnetbase.assemblyName(cfg)
_p(2,'<AssemblyName>%s</AssemblyName>', cfg.buildtarget.basename)
end
function dotnetbase.commonProperties(prj)
if _ACTION > "vs2010" then
_p(1,'<Import Project="$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props" Condition="Exists(\'$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\')" />')
end
end
function dotnetbase.configurationCondition(cfg)
_x(2,'<Configuration Condition=" \'$(Configuration)\' == \'\' ">%s</Configuration>', cfg.buildcfg)
end
function dotnetbase.fileAlignment(cfg)
if _ACTION >= "vs2010" then
_p(2,'<FileAlignment>512</FileAlignment>')
end
end
function dotnetbase.bindingRedirects(cfg)
if _ACTION >= "vs2015" then
_p(2, '<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>')
end
end
function dotnetbase.outputType(cfg)
_p(2,'<OutputType>%s</OutputType>', dotnet.getkind(cfg))
end
function dotnetbase.platformCondition(cfg)
_p(2,'<Platform Condition=" \'$(Platform)\' == \'\' ">%s</Platform>', dotnetbase.arch(cfg.project))
end
function dotnetbase.productVersion(cfg)
local action = p.action.current()
if action.vstudio.productVersion then
_p(2,'<ProductVersion>%s</ProductVersion>', action.vstudio.productVersion)
end
end
function dotnetbase.projectGuid(cfg)
_p(2,'<ProjectGuid>{%s}</ProjectGuid>', cfg.uuid)
end
function dotnetbase.projectTypeGuids(cfg)
if cfg.flags.WPF then
_p(2,'<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>')
end
end
function dotnetbase.rootNamespace(cfg)
_p(2,'<RootNamespace>%s</RootNamespace>', cfg.namespace or cfg.buildtarget.basename)
end
function dotnetbase.schemaVersion(cfg)
local action = p.action.current()
if action.vstudio.csprojSchemaVersion then
_p(2,'<SchemaVersion>%s</SchemaVersion>', action.vstudio.csprojSchemaVersion)
end
end
function dotnetbase.NoWarn(cfg)
if #cfg.disablewarnings > 0 then
local warnings = table.concat(cfg.disablewarnings, ";")
_p(2,'<NoWarn>%s</NoWarn>', warnings)
end
end
function dotnetbase.targetFrameworkVersion(cfg)
local action = p.action.current()
local framework = cfg.dotnetframework or action.vstudio.targetFramework
if framework then
_p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)
end
end
function dotnetbase.targetFrameworkProfile(cfg)
if _ACTION == "vs2010" then
_p(2,'<TargetFrameworkProfile>')
_p(2,'</TargetFrameworkProfile>')
end
end
function dotnetbase.xmlDeclaration()
if _ACTION > "vs2008" then
p.xmlUtf8()
end
end
| bsd-3-clause |
njligames/NJLIGameEngine | projects/ELIA/_archive/scripts_9.16.2016/nodes/dog/dog.lua | 2 | 13450 |
local function getRootName(name)
return string.sub(name, string.find(name, "/") + 1)
end
local function getFrameName(name, frameAction, frameSide, frameNumber)
local folderName = getRootName(name) .. "_" .. frameAction .. "_" .. frameSide
local fileName = folderName .. "_" .. string.format("%.5d", frameNumber)
return folderName .. "/" .. fileName
end
local function createActionValues()
local action = njli.Action.create()
action:setName('run')
action:setRepeatForever()
local frameActionName = "run"
local frameNumber = 0
local frameIncrement = 1
local frameSideName = "side"
return action, frameActionName, frameSideName, frameNumber, frameIncrement
end
local function createStateObjects(self)
self.stateNames = {}
self.stateObjects = {}
self:addStateObject("Caught", require "nodes.dog.states.caught")
self:addStateObject("Dazed", require "nodes.dog.states.dazed")
self:addStateObject("Land", require "nodes.dog.states.land")
self:addStateObject("Released", require "nodes.dog.states.released")
self:addStateObject("Run", require "nodes.dog.states.run")
self:addStateObject("Spawn", require "nodes.dog.states.spawn")
local frameName = getFrameName(self:getNode():getName(), self:getFrameActionName(), self:getFrameSideName(), self:getFrameNumber())
setupSpriteFrame(frameName, self:getNode(), self:getSheetInfo(), self:getSpriteAtlas(), self:getGeometry())
if self:hasStateObject("Spawn") then
self:getStateObject("Spawn"):push()
end
self.paused = false
end
local function createDogMovingEntity(node, type)
local assetPath = njli.ASSET_PATH("scripts/Params.lua")
local movingEntityParams = loadfile(assetPath)()
local movingEntityParams = movingEntityParams.Dog
local maxSpeed = movingEntityParams.MaxSpeed
local headingVector = bullet.btVector3(0.0, 0.0, -1.0)
local upVector = bullet.btVector3(0.0, 1.0, 0.0)
local turnRate = njli.World.getInstance():getWorldLuaVirtualMachine():getMaxNumber()
local maxForce = movingEntityParams.MaxForce
local me = require "steering.MovingEntity"
local movingEntity = me.new(node, maxSpeed, headingVector, upVector, turnRate, maxForce)
return movingEntity, movingEntityParams
end
local isCaptured = function(self)
local currentY = self:getNode():getOrigin():y()
return currentY > self:getMovingEntityParams().CapturedHeight
end
local getPath = function(self)
assert(self.path, "self.path is nil.")
return self.path
end
local run = function(self)
local hasConstraint = self:getNode():getPhysicsBody():hasPhysicsConstraint()
if not hasConstraint then
self:getStateObject("Run"):push()
end
end
local pause = function(self)
self.paused = true
self.pausedVelocity = bullet.btVector3(self.physicsBody:getVelocity())
self.physicsBody:setVelocity(bullet.btVector3(0,0,0))
end
local unPause = function(self)
self.paused = false
self.physicsBody:applyForce(self.pausedVelocity, true)
end
local isPaused = function(self)
return self.paused
end
local getAnimationClock = function(self)
assert(self.animationClock, "self.animationClock is nil")
return self.animationClock
end
local getNode = function(self)
assert(self.node, "self.node is nil.")
return self.node
end
local hasStateObject = function(self, stateName)
return (self.stateObjects[stateName] ~= nil)
end
local getStateObject = function(self, stateName)
assert(self.stateObjects, "self.stateObjects is nil")
assert(self.stateObjects[stateName], "self.stateObjects[stateName] is nil.")
return self.stateObjects[stateName]
end
local addStateObject = function(self, stateName, nodeStateObject)
assert(self.stateObjects, "node state is nil")
assert(self.stateNames[stateName] == nil, "Already contains a state with name (" .. stateName .. ")")
self.stateNames[stateName] = getRootName(self:getNode():getName()) .. stateName
self.stateObjects[stateName] = nodeStateObject.new(stateName, self)
end
local getAction = function(self)
assert(self.action, "self.action is nil.")
return self.action
end
local getFrameActionName = function(self)
assert(self.frameActionName, "self.frameActionName is nil")
return self.frameActionName
end
local setFrameActionName = function(self, name)
self.frameActionName = name
end
local getFrameSideName = function(self)
assert(self.frameSideName, "self.frameSideName is nil")
return self.frameSideName
end
local incrementFrame = function(self)
self.frameNumber = self:getFrameNumber() + self:getFrameIncrement()
if self:getFrameNumber() > 8 then
self.frameNumber = 0
end
end
local getFrameNumber = function(self)
assert(self.frameNumber, "self.frameNumber is nil")
return self.frameNumber
end
local setFrameNumber = function(self, frameNumber)
assert(type(frameNumber) == "number", "setFrameNumber expects a number.")
self.frameNumber = frameNumber
end
local getFrameIncrement = function(self)
assert(self.frameIncrement, "self.frameIncrement is nil")
return self.frameIncrement
end
local setFrameIncrement = function(self, increment)
assert(type(increment) == "number", "setFrameIncrement expects a number.")
self.frameIncrement = increment
end
local getMovingEntity = function(self)
assert(self.movingEntity, "self.movingEntity is nil")
return self.movingEntity
end
local getMovingEntityParams = function(self)
assert(self.movingEntityParams, "self.movingEntityParams is nil")
return self.movingEntityParams
end
local getSheetInfo = function(self)
assert(self.sheetInfo, "self.sheetInfo is nil")
return self.sheetInfo
end
local getSpriteAtlas = function(self)
assert(self.spriteAtlas, "self.spriteAtlas is nil")
return self.spriteAtlas
end
local getGeometry = function(self)
assert(self.geometry, "self.geometry is nil")
return self.geometry
end
local getBirdType = function(self)
assert(self.birdType, "self.birdType is nil")
return self.birdType
end
local getDog = function(self)
assert(self.dog, "self.dog is nil")
return self.dog
end
local getBeakNodeObject = function(self)
assert(self.beakNode, "self.dog is nil")
return self.beakNode
end
local start = function(self)
createStateObjects(self)
self.physicsBody:setAngularFactor(bullet.btVector3(0.0, 0.0, 0.0))
end
local getCurrentStateName = function(self)
if self:getNode() and
self:getNode():getStateMachine() and
self:getNode():getStateMachine():getState() and
self:getNode():getStateMachine():getState():getName() then
return self:getNode():getStateMachine():getState():getName()
end
return nil
end
local actionUpdate = function(self, action, timeStep)
if not self:isPaused() then
local node = action:getParent()
local nodeName = node:getName()
local nodeStateName = node:getStateMachine():getState():getName()
if (self:getAnimationClock():getTimeMilliseconds() / 1000) > (1.0/30.0) then
self:getAnimationClock():reset()
self:incrementFrame()
local frameName = getFrameName(node:getName(), self:getFrameActionName(), self:getFrameSideName(), self:getFrameNumber())
setupSpriteFrame(frameName, node, self:getSheetInfo(), self:getSpriteAtlas(), self:getGeometry())
local AabbMin, AabbMax = node:getGeometry():getAabb(node)
AabbMax = AabbMax * node:getScale()
AabbMax:setZ(1.0)
self.physicsShape:setHalfExtentsZ(AabbMax)
end
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):actionUpdate(action, timeStep)
end
end
end
local actionComplete = function(self, action)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):actionComplete(action)
end
end
local enter = function(self)
self:getNode():runAction(self:getAction())
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):enter()
end
end
local update = function(self, timeStep)
if not self:isPaused() then
brightnessForNode(self:getNode())
if self:getNode():getPhysicsBody():isKinematicPhysics() then
self:getMovingEntity():update(timeStep)
end
local axis = bullet.btVector3(0,1,0)
local angle = bullet.btRadians(180)
if self:getMovingEntity():getVelocity():x() > 0 then
angle = bullet.btRadians(0)
self:getNode():setRotation(bullet.btQuaternion(axis, angle))
elseif self:getMovingEntity():getVelocity():x() < 0 then
self:getNode():setRotation(bullet.btQuaternion(axis, angle))
end
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):update(timeStep)
end
end
end
local exit = function(self)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):exit()
end
end
local onMessage = function(self, message)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):onMessage(message)
end
end
local render = function(self)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):render()
end
end
local collide = function(self, otherNode, collisionPoint)
local myGroup = self.node:getPhysicsBody():getCollisionGroup()
local otherGroup = otherNode:getPhysicsBody():getCollisionGroup()
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):collide(otherNode, collisionPoint)
end
end
local near = function(self, otherNode)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):near(otherNode)
end
end
local touchDown = function(self, rayContact)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):touchDown(rayContact)
end
end
local touchUp = function(self, rayContact)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):touchUp(rayContact)
end
end
local touchMove = function(self, rayContact)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):touchMove(rayContact)
end
end
local touchCancelled = function(self, rayContact)
local stateName = self:getCurrentStateName()
if self:hasStateObject(stateName) then
self:getStateObject(stateName):touchCancelled(rayContact)
end
end
local delete = function(self)
self:getNode():getStateMachine():pushState(nil)
njli.Clock.destroy(self.animationClock)
njli.Action.destroy(self.action)
self.action = nil
njli.PhysicsShapeCylinder.destroy(self.physicsShape)
self.physicsShape = nil
njli.PhysicsBodyRigid.destroy(self.physicsBody)
self.physicsBody = nil
njli.Node.destroy(self.node)
self.node = nil
for k,v in pairs(self.stateObjects) do
self.stateObjects[k] = nil
end
self.stateObjects = nil
end
local methods =
{
isCaptured = isCaptured,
getPath = getPath,
run = run,
pause = pause,
unPause = unPause,
isPaused = isPaused,
getAnimationClock = getAnimationClock,
getNode = getNode,
hasStateObject = hasStateObject,
getStateObject = getStateObject,
addStateObject = addStateObject,
getAction = getAction,
getFrameActionName = getFrameActionName,
setFrameActionName = setFrameActionName,
getFrameSideName = getFrameSideName,
incrementFrame = incrementFrame,
getFrameNumber = getFrameNumber,
setFrameNumber = setFrameNumber,
getFrameIncrement = getFrameIncrement,
setFrameIncrement = setFrameIncrement,
getMovingEntity = getMovingEntity,
getMovingEntityParams = getMovingEntityParams,
getSheetInfo = getSheetInfo,
getSpriteAtlas = getSpriteAtlas,
getGeometry = getGeometry,
getBirdType = getBirdType,
getDog = getDog,
getBeakNodeObject = getBeakNodeObject,
start = start,
getCurrentStateName = getCurrentStateName,
actionUpdate = actionUpdate,
actionComplete = actionComplete,
enter = enter,
update = update,
exit = exit,
onMessage = onMessage,
render = render,
collide = collide,
near = near,
touchDown = touchDown,
touchUp = touchUp,
touchMove = touchMove,
touchCancelled = touchCancelled,
__gc = delete
}
local new = function(name, sheetInfo, spriteAtlas, geometry, wayPoints)
local node = njli.Node.create()
node:setName(name)
node:setScale(1)
local physicsBody = njli.PhysicsBodyRigid.create()
local physicsShape = njli.PhysicsShapeCylinder.create()
physicsShape:setMargin(1)
physicsBody:addPhysicsShape(physicsShape)
node:addPhysicsBody(physicsBody)
local action, frameActionName, frameSideName, frameNumber, frameIncrement = createActionValues(getRootName(name))
local movingEntity, movingEntityParams = createDogMovingEntity(node, birdType)
local Path = require "steering.Path"
local path = Path.new(wayPoints)
path:loopOn()
local properties =
{
instanceName = name,
node = node,
stateNames = nil,
stateObjects = nil,
colorTransform = colorTransform,
physicsBody = physicsBody,
physicsShape = physicsShape,
action = action,
frameActionName = frameActionName,
frameSideName = frameSideName,
frameNumber = frameNumber,
frameIncrement = frameIncrement,
movingEntity = movingEntity,
movingEntityParams = movingEntityParams,
paused = false,
animationClock = njli.Clock.create(),
path = path,
sheetInfo = sheetInfo,
spriteAtlas = spriteAtlas,
geometry = geometry,
}
return setmetatable(properties, {__index = methods})
end
return {
new = new,
}
| mit |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/event_perk/serverobjects.lua | 2 | 3733 | --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/event_perk/banner_generic_s01.lua")
includeFile("tangible/event_perk/banner_generic_s02.lua")
includeFile("tangible/event_perk/banner_imperial_style_01.lua")
includeFile("tangible/event_perk/banner_rebel_style_01.lua")
includeFile("tangible/event_perk/banner_tatooine_style_01.lua")
includeFile("tangible/event_perk/camp_pavilion_s1.lua")
includeFile("tangible/event_perk/camp_pavilion_s2.lua")
includeFile("tangible/event_perk/corl_banner_govt_tall_s01.lua")
includeFile("tangible/event_perk/corl_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/dant_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/dath_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/endr_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/filler_building_naboo_theed_style_9.lua")
includeFile("tangible/event_perk/garden_gazebo_lg_s01.lua")
includeFile("tangible/event_perk/guild_banner_free_style_01.lua")
includeFile("tangible/event_perk/lambda_shuttle.lua")
includeFile("tangible/event_perk/lok_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/military_outpost_guard_tower_1.lua")
includeFile("tangible/event_perk/nboo_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/player_shuttle.lua")
includeFile("tangible/event_perk/rori_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/sandcrawler.lua")
includeFile("tangible/event_perk/talus_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/tato_imprv_flagpole_s01.lua")
includeFile("tangible/event_perk/tie_bomber.lua")
includeFile("tangible/event_perk/web_tree.lua")
includeFile("tangible/event_perk/xwing.lua")
includeFile("tangible/event_perk/yavn_imprv_flagpole_s01.lua")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/binjinphant/objects.lua | 3 | 5577 | --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_binjinphant_shared_lair_binjinphant = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/binjinphant/shared_lair_binjinphant.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/poi_all_lair_earthmound_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:binjinphant",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:binjinphant",
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 = 40317031,
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_binjinphant_shared_lair_binjinphant, "object/tangible/lair/binjinphant/shared_lair_binjinphant.iff")
object_tangible_lair_binjinphant_shared_lair_binjinphant_forest = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/binjinphant/shared_lair_binjinphant_forest.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/poi_all_lair_earthmound_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:binjinphant_forest",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:binjinphant_forest",
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 = 165640576,
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_binjinphant_shared_lair_binjinphant_forest, "object/tangible/lair/binjinphant/shared_lair_binjinphant_forest.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/container/loot/player_loot_crate.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_container_loot_player_loot_crate = object_tangible_container_loot_shared_player_loot_crate:new {
gameObjectType = 8245,
sliceable = 1,
}
ObjectTemplates:addTemplate(object_tangible_container_loot_player_loot_crate, "object/tangible/container/loot/player_loot_crate.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/loot/items/wearables/ithorian/ith_skirt_s01.lua | 4 | 1276 | ith_skirt_s01 = {
-- Ithorian Striped Skirt
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "",
directObjectTemplate = "object/tangible/wearables/ithorian/ith_skirt_s01.iff",
craftingValues = {},
skillMods = {},
customizationStringNames = {"/private/index_color_1","/private/index_color_2"},
customizationValues = {
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119}
},
junkDealerTypeNeeded = JUNKCLOTHESANDJEWELLERY,
junkMinValue = 35,
junkMaxValue = 70
}
addLootItemTemplate("ith_skirt_s01", ith_skirt_s01) | agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/eg6_power_droid_crafted.lua | 3 | 2208 | --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_eg6_power_droid_crafted = object_mobile_shared_eg6_power_droid_crafted:new {
}
ObjectTemplates:addTemplate(object_mobile_eg6_power_droid_crafted, "object/mobile/eg6_power_droid_crafted.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/commands/creatureAreaDisease.lua | 3 | 2368 | --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
CreatureAreaDiseaseCommand = {
name = "creatureareadisease",
combatSpam = "attack",
dotEffects = {
DotEffect(
DISEASED,
{ "resistance_disease", "poison_disease_resist" },
HEALTH,
true,
125,
50,
50,
300
)
},
areaRange = 25,
areaAction = true
}
AddCommand(CreatureAreaDiseaseCommand)
| agpl-3.0 |
DailyShana/ygopro-scripts | c75190122.lua | 3 | 1184 | --黒・爆・裂・破・魔・導
function c75190122.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c75190122.condition)
e1:SetTarget(c75190122.target)
e1:SetOperation(c75190122.activate)
c:RegisterEffect(e1)
end
function c75190122.cfilter(c,code)
local code1,code2=c:GetOriginalCodeRule()
return c:IsFaceup() and (code1==code or code2==code)
end
function c75190122.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c75190122.cfilter,tp,LOCATION_MZONE,0,1,nil,46986414)
and Duel.IsExistingMatchingCard(c75190122.cfilter,tp,LOCATION_MZONE,0,1,nil,38033121)
end
function c75190122.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c75190122.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
Duel.Destroy(g,REASON_EFFECT)
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/space/ship/cargo_freighter.lua | 3 | 2220 | --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_space_ship_cargo_freighter = object_static_space_ship_shared_cargo_freighter:new {
}
ObjectTemplates:addTemplate(object_static_space_ship_cargo_freighter, "object/static/space/ship/cargo_freighter.iff")
| agpl-3.0 |
dani-sj/mahandash | plugins/inpm.lua | 1114 | 3008 | do
local function pairsByKeys (t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end
local function chat_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*Use /join (ID) to join*\n\n '
for k,v in pairs(data[tostring(groups)]) do
local settings = data[tostring(v)]['settings']
for m,n in pairsByKeys(settings) do
if m == 'set_name' then
name = n
end
end
message = message .. '👥 '.. name .. ' (ID: ' .. v .. ')\n\n '
end
local file = io.open("./groups/lists/listed_groups.txt", "w")
file:write(message)
file:flush()
file:close()
return message
end
local function run(msg, matches)
if msg.to.type ~= 'chat' or is_sudo(msg) or is_admin(msg) and is_realm(msg) then
local data = load_data(_config.moderation.data)
if matches[1] == 'join' and data[tostring(matches[2])] then
if is_banned(msg.from.id, matches[2]) then
return 'You are banned.'
end
if is_gbanned(msg.from.id) then
return 'You are globally banned.'
end
if data[tostring(matches[2])]['settings']['lock_member'] == 'yes' and not is_owner2(msg.from.id, matches[2]) then
return 'Group is private.'
end
local chat_id = "chat#id"..matches[2]
local user_id = "user#id"..msg.from.id
chat_add_user(chat_id, user_id, ok_cb, false)
local group_name = data[tostring(matches[2])]['settings']['set_name']
return "Added you to chat:\n\n👥"..group_name.." (ID:"..matches[2]..")"
elseif matches[1] == 'join' and not data[tostring(matches[2])] then
return "Chat not found."
end
if matches[1] == 'chats'then
if is_admin(msg) and msg.to.type == 'chat' then
return chat_list(msg)
elseif msg.to.type ~= 'chat' then
return chat_list(msg)
end
end
if matches[1] == 'chatlist'then
if is_admin(msg) and msg.to.type == 'chat' then
send_document("chat#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
elseif msg.to.type ~= 'chat' then
send_document("user#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
end
end
end
end
return {
patterns = {
"^[/!](chats)$",
"^[/!](chatlist)$",
"^[/!](join) (.*)$",
"^[/!](kickme) (.*)$",
"^!!tgservice (chat_add_user)$"
},
run = run,
}
end
| gpl-2.0 |
Tarfand-pro/Tarfand | plugins/inpm.lua | 1114 | 3008 | do
local function pairsByKeys (t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end
local function chat_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*Use /join (ID) to join*\n\n '
for k,v in pairs(data[tostring(groups)]) do
local settings = data[tostring(v)]['settings']
for m,n in pairsByKeys(settings) do
if m == 'set_name' then
name = n
end
end
message = message .. '👥 '.. name .. ' (ID: ' .. v .. ')\n\n '
end
local file = io.open("./groups/lists/listed_groups.txt", "w")
file:write(message)
file:flush()
file:close()
return message
end
local function run(msg, matches)
if msg.to.type ~= 'chat' or is_sudo(msg) or is_admin(msg) and is_realm(msg) then
local data = load_data(_config.moderation.data)
if matches[1] == 'join' and data[tostring(matches[2])] then
if is_banned(msg.from.id, matches[2]) then
return 'You are banned.'
end
if is_gbanned(msg.from.id) then
return 'You are globally banned.'
end
if data[tostring(matches[2])]['settings']['lock_member'] == 'yes' and not is_owner2(msg.from.id, matches[2]) then
return 'Group is private.'
end
local chat_id = "chat#id"..matches[2]
local user_id = "user#id"..msg.from.id
chat_add_user(chat_id, user_id, ok_cb, false)
local group_name = data[tostring(matches[2])]['settings']['set_name']
return "Added you to chat:\n\n👥"..group_name.." (ID:"..matches[2]..")"
elseif matches[1] == 'join' and not data[tostring(matches[2])] then
return "Chat not found."
end
if matches[1] == 'chats'then
if is_admin(msg) and msg.to.type == 'chat' then
return chat_list(msg)
elseif msg.to.type ~= 'chat' then
return chat_list(msg)
end
end
if matches[1] == 'chatlist'then
if is_admin(msg) and msg.to.type == 'chat' then
send_document("chat#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
elseif msg.to.type ~= 'chat' then
send_document("user#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
end
end
end
end
return {
patterns = {
"^[/!](chats)$",
"^[/!](chatlist)$",
"^[/!](join) (.*)$",
"^[/!](kickme) (.*)$",
"^!!tgservice (chat_add_user)$"
},
run = run,
}
end
| gpl-2.0 |
KingRaptor/Zero-K | LuaUI/Configs/epicmenu_conf.lua | 1 | 25293 | local confdata = {}
confdata.title = 'Z.K.'
confdata.title_image = LUAUI_DIRNAME .. 'Images/ZK_logo.png'
confdata.default_source_file = 'zk_keys.lua' --the file in ZIP archive where default key is stored.
confdata.mission_keybinds_file = 'zk_keys.lua' --the filename to be used for Mission mod. set this to NIL if want to use mission's name as filename.
-- confdata.regular_keybind_file = LUAUI_DIRNAME .. 'Configs/zk_keys.lua' --for Multiplayer this is automatically set according to modName in epicmenu.lua
--FIXME: find modname instead of using hardcoded mission_keybinds_file name
confdata.description = 'Zero-K is a free real time strategy (RTS), that aims to be the best open source multi-platform strategy game available :-) \n\n www.zero-k.info'
local color = {
white = {1,1,1,1},
yellow = {1,1,0,1},
gray = {0.5,.5,.5,1},
darkgray = {0.3,.3,.3,1},
cyan = {0,1,1,1},
red = {1,0,0,1},
darkred = {0.5,0,0,1},
blue = {0,0,1,1},
black = {0,0,0,1},
darkgreen = {0,0.5,0,1},
green = {0,1,0,1},
postit = {1,0.9,0.5,1},
grayred = {0.5,0.4,0.4,1},
grayblue = {0.4,0.4,0.45,1},
transblack = {0,0,0,0.3},
transblack2 = {0,0,0,0.7},
transGray = {0.1,0.1,0.1,0.8},
empty = {0,0,0,0},
null = {nil, nil, nil, 1},
transnull = {nil, nil, nil, 0.3},
transnull2 = {nil, nil, nil, 0.5},
transnull3 = {nil, nil, nil, 0.8},
}
color.tooltip_bg = color.transnull3
color.tooltip_fg = color.null
color.tooltip_info = color.cyan
color.tooltip_help = color.green
color.main_bg = color.transnull3
color.main_fg = color.null
color.menu_bg = color.null
color.menu_fg = color.null
color.game_bg = color.null
color.game_fg = color.null
color.sub_bg = color.transnull
color.sub_fg = color.null
color.sub_header = color.yellow
color.sub_button_bg = color.null
color.sub_button_fg = color.null
color.sub_back_bg = color.null
color.sub_back_fg = color.null
color.sub_close_bg = color.null
color.sub_close_fg = color.null
color.stats_bg = color.sub_bg
color.stats_fg = color.sub_fg
color.stats_header = color.sub_header
color.context_bg = color.transnull
color.context_fg = color.null
color.context_header = color.yellow
color.disabled_bg = color.transGray
color.disabled_fg = color.darkgray
confdata.color = color
local spSendCommands = Spring.SendCommands
confdata.eopt = {}
local function nullFunc()
end
local function AddOption(path, option)
option.path = path or "Settings\Broken Paths"
if not option.key then
option.key = option.name
end
table.insert(confdata.eopt, option)
end
--ShortHand for adding a button
local function ShButton(path, caption, action2, tooltip, advanced, icon, DisableFunc)
AddOption(path,
{
type='button',
name=caption,
desc = tooltip or '',
action = (type(action2) == 'string' and action2 or nil),
OnChange = (type(action2) ~= 'string' and action2 or nil),
key=caption,
advanced = advanced,
icon = icon,
DisableFunc = DisableFunc or nil, --function that trigger grey colour on buttons (not actually disable their functions, only coloured them grey)
})
end
--ShortHand for adding radiobuttons
local function ShRadio(path, caption, items,defValue, action2, advanced, nhk)
AddOption(path,
{
type='radioButton',
name=caption,
key=caption,
items = items or {},
value = defValue or '',
action = (type(action2) == 'string' and action2 or nil),
OnChange = (type(action2) ~= 'string' and action2 or nil),
advanced = advanced,
noHotkey = nhk,
})
end
--ShortHand for adding a label
local function ShLabel(path, caption)
AddOption(path,
{
type='label',
name=caption,
value = caption,
key=caption,
})
end
local imgPath = LUAUI_DIRNAME .. 'images/'
confdata.subMenuIcons = {
['Game'] = imgPath..'epicmenu/game.png',
['Settings'] = imgPath..'epicmenu/settings.png',
['Help'] = imgPath..'epicmenu/questionmark.png',
['Game/Game Speed'] = imgPath..'epicmenu/speed-test-icon.png',
['Game/New Unit States'] = imgPath..'epicmenu/robot2.png',
['Game/Unit Behaviour'] = imgPath..'epicmenu/robot2.png',
['Game/Transport AI'] = imgPath..'epicmenu/robot2.png',
['Game/Worker AI'] = imgPath..'commands/Bold/build_light.png',
['Game/Unit Marker'] = imgPath..'epicmenu/marker.png',
['Game/Construction Hotkeys'] = imgPath..'epicmenu/keyboard.png',
['Game/Selection Hotkeys'] = imgPath..'epicmenu/keyboard.png',
['Game/Command Hotkeys'] = imgPath..'epicmenu/keyboard.png',
['Settings/Reset Settings'] = imgPath..'epicmenu/undo.png',
['Settings/Audio'] = imgPath..'epicmenu/vol.png',
['Settings/Camera'] = imgPath..'epicmenu/video_camera.png',
['Settings/Graphics'] = imgPath..'epicmenu/graphics.png',
['Settings/HUD Panels'] = imgPath..'epicmenu/control_panel.png',
['Settings/Interface'] = imgPath..'epicmenu/robotarm.png',
['Settings/Misc'] = imgPath..'epicmenu/misc.png',
['Settings/Interface/Mouse Cursor'] = imgPath..'epicmenu/input_mouse.png',
['Settings/Interface/Map'] = imgPath..'epicmenu/map.png',
['Settings/Interface/Healthbars'] = imgPath..'commands/Bold/health.png',
['Settings/Interface/Retreat Zones'] = imgPath..'commands/Bold/retreat.png',
['Settings/Interface/Spectating'] = imgPath..'epicmenu/popcorn.png',
['Settings/Interface/Building Placement'] = imgPath..'factory.png',
['Settings/Interface/Team Colors'] = imgPath..'map/minimap_colors_simple.png',
['Settings/Interface/Common Team Colors'] = imgPath..'map/minimap_colors_simple.png',
['Settings/Interface/Build ETA'] = imgPath..'epicmenu/stop_watch_icon.png',
['Settings/Interface/Defense Ranges'] = imgPath..'epicmenu/target.png',
['Settings/Interface/Command Visibility'] = imgPath..'epicmenu/fingertap.png',
['Settings/Interface/Hovering Icons'] = imgPath..'epicmenu/halo.png',
['Settings/Interface/Selection'] = imgPath..'epicmenu/selection.png',
['Settings/Interface/Control Groups'] = imgPath..'epicmenu/addusergroup.png',
['Settings/HUD Panels/Minimap'] = imgPath..'epicmenu/map.png',
['Settings/HUD Panels/Economy Panel'] = imgPath..'cost.png',
['Settings/HUD Panels/Commander Selector'] = imgPath..'epicmenu/corcommander.png',
['Settings/HUD Panels/Tooltip'] = imgPath..'epicmenu/lightbulb.png',
['Settings/HUD Panels/Chat'] = imgPath..'advplayerslist/chat.png',
['Settings/HUD Panels/FactoryPanel'] = imgPath..'factory.png',
['Settings/HUD Panels/Pause Screen'] = imgPath..'epicmenu/media_playback_pause.png',
['Settings/HUD Panels/Replay Controls'] = imgPath..'epicmenu/key_play_pause.png',
['Settings/HUD Panels/Unit Stats Help Window'] = imgPath..'advplayerslist/random.png',
['Settings/HUD Panels/Player List'] = imgPath..'epicmenu/people.png',
['Settings/HUD Panels/Extras/Docking'] = imgPath..'epicmenu/anchor.png',
['Settings/HUD Panels/Selected Units Panel'] = imgPath..'epicmenu/grid.png',
}
-- SETUP MENU HERE
ShButton('', 'Save Game', (function() if WG.SaveGame then WG.SaveGame.CreateSaveWindow() end end), nil, nil, imgPath .. 'commands/Bold/unload.png')
ShButton('', 'Load Game', (function() if WG.SaveGame then WG.SaveGame.CreateLoadWindow() end end), nil, nil, imgPath .. 'commands/Bold/load.png')
--- GENERAL SETTINGS --- settings about settings
local generalPath = 'Settings/Reset Settings'
ShLabel(generalPath, 'Reset graphic settings to minimum.')
ShButton(generalPath, 'Reset graphic settings',function()
spSendCommands{"water 0",
"Shadows 0",
"maxparticles 100",
"advmodelshading 0",
"grounddecals 0",
'luaui disablewidget LupsManager',
"luaui disablewidget Lups",
"luaui disablewidget Display DPS",
"luaui disablewidget Map Edge Extension",
'mapborder 1',
"luaui disablewidget SelectionHalo",
"luaui disablewidget SelectionCircle",
}
end,
'Use this if your performance is poor'
)
ShLabel(generalPath, 'Reset custom settings to default.')
ShButton(generalPath, 'Reset custom settings', function() WG.crude.ResetSettings() end)
ShLabel(generalPath, 'Reset hotkeys.')
ShButton(generalPath, 'Reset hotkeys',function() WG.crude.ResetKeys() end)
local settingsPath = 'Settings'
--[[
AddOption(settingsPath,
{
name = 'Show Advanced Settings',
type = 'bool',
value = false,
})
--]]
--- GAME --- Stuff for gameplay only. Spectator would never need to open this
local gamePath = 'Game'
local gameSpeedPath = 'Game/Game Speed'
ShButton(gamePath, 'Pause/Unpause', 'pause', nil, nil, imgPath .. 'epicmenu/media_playback_pause.png')
ShButton(gameSpeedPath, 'Increase Speed', 'speedup')
ShButton(gameSpeedPath, 'Decrease Speed', 'slowdown')
ShLabel(gamePath, '')
ShButton(gamePath, 'Choose Commander Type', (function() spSendCommands{"luaui showstartupinfoselector"} end), nil, nil, imgPath..'epicmenu/corcommander.png' )
--ShButton(gamePath, 'Constructor Auto Assist', function() spSendCommands{"luaui togglewidget Constructor Auto Assist"} end)
-- global build command
local GBCPath = 'Game/Worker AI'
local gbcinfo = "Global Build Command gives you a global, persistent build queue for all workers that automatically assigns workers to the nearest jobs.\n \nInstructions: Enable this " ..
"then give any worker build-related commands. Placing buildings on top of existing jobs while holding \255\200\200\200Shift\255\255\255\255 cancels them, and without shift replaces them. \n" ..
"You can also exclude workers from GBC's control by using the state toggle button in the unit's orders menu. " ..
"Units also get a job area removal command, the default hotkey is \255\255\90\90alt-s\255\255\255\255.\n \n" .. "It can also handle repair/reclaim/res, and automatically converts area res to reclaim for targets that cannot be resurrected.\n \n"
ShButton(GBCPath, 'Toggle Global Build Command', function() spSendCommands{"luaui togglewidget Global Build Command"} end, gbcinfo)
--- CAMERA ---
local cameraPath = 'Settings/Camera'
--[[
the problem is "radioButton" is not fully implemented to recognize the item "viewta" as an existing action,
so the hotkey Ctrl+F2 doesn't show in the menu, and thus cannot be unbound. A proposed solution is to enable both "radioButton"
& old camera button, but put the later in saperate category.
--]]
local cofcDisable = "luaui disablewidget Combo Overhead/Free Camera (experimental)"
ShRadio( cameraPath,
'Camera Type', {
{name = 'Total Annihilation',key='Total Annihilation', desc='TA camera', hotkey=nil},
{name = 'FPS',key='FPS', desc='FPS camera', hotkey=nil},
{name = 'Free',key='Free', desc='Freestyle camera', hotkey=nil},
{name = 'Rotatable Overhead',key='Rotatable Overhead', desc='Rotatable Overhead camera', hotkey=nil},
{name = 'Total War',key='Total War', desc='TW camera', hotkey=nil},
{name = 'COFC',key='COFC', desc='Combo Overhead/Free Camera', hotkey=nil},
},'Total Annihilation',
function(self)
local key = self.value
if key == 'Total Annihilation' then
spSendCommands{cofcDisable ,"viewta"}
elseif key == 'FPS' then
spSendCommands{cofcDisable ,"viewfps"}
elseif key == 'Free' then
spSendCommands{cofcDisable ,"viewfree"}
elseif key == 'Rotatable Overhead' then
spSendCommands{cofcDisable ,"viewrot"}
elseif key == 'Total War' then
spSendCommands{cofcDisable ,"viewtw"}
elseif key == 'COFC' then
spSendCommands{"luaui enablewidget Combo Overhead/Free Camera (experimental)",}
end
end
)
ShButton(cameraPath, 'Flip the TA Camera', 'viewtaflip')
ShButton(cameraPath, 'Toggle Camera Shake', 'luaui togglewidget CameraShake')
ShButton(cameraPath, 'Toggle SmooothScroll', 'luaui togglewidget SmoothScroll')
ShButton(cameraPath, 'Toggle Smooth Camera', 'luaui togglewidget SmoothCam')
--ShButton(cameraPath, 'Toggle advanced COFC camera', 'luaui togglewidget Combo Overhead/Free Camera (experimental)' )
local oldCameraPath = 'Settings/Camera/Old Camera Shortcuts'
ShButton(oldCameraPath, 'Total Annihilation', 'viewta')
ShButton(oldCameraPath, 'FPS', 'viewfps')
ShButton(oldCameraPath, 'Free', 'viewfree')
ShButton(oldCameraPath, 'Rotatable Overhead', 'viewrot')
ShButton(oldCameraPath, 'Total War', 'viewtw')
ShLabel(oldCameraPath, '')
ShButton(oldCameraPath, 'Move Forward', 'moveforward')
ShButton(oldCameraPath, 'Move Back', 'moveback')
ShButton(oldCameraPath, 'Move Left', 'moveleft')
ShButton(oldCameraPath, 'Move Right', 'moveright')
ShLabel(oldCameraPath, ' ')
ShButton(oldCameraPath, 'TA camera track unit', 'track')
ShButton(oldCameraPath, 'Overview mode', 'toggleoverview')
ShButton(oldCameraPath, 'Panning mode','mousestate', 'Note: must be bound to a key for use')
--- HUD Panels --- Only settings that pertain to windows/icons at the drawscreen level should go here.
local HUDPath = 'Settings/HUD Panels/Extras'
ShButton(HUDPath, 'Tweak Mode (Esc to exit)', 'luaui tweakgui', 'Tweak Mode. Move and resize parts of the user interface. (Hit Esc to exit)')
ShButton(HUDPath .. "/Display Keys", 'Toggle input visualizer', function() spSendCommands{"luaui togglewidget Display Keys"} end, "Shows pressed key combinations and mouse buttons.")
local HUDSkinPath = 'Settings/HUD Panels/Extras/HUD Skin'
AddOption(HUDSkinPath,
{
name = 'Skin Sets (Requires LuaUI Reload)',
type = 'list',
OnChange = function (self)
WG.crude.SetSkin( self.value );
end,
items = {
{ key = 'Blueprint', name = 'Blueprint', },
{ key = 'Carbon', name = 'Carbon', },
{ key = 'Robocracy', name = 'Robocracy', },
--{ key = 'DarkGlass', name = 'DarkGlass', }, -- Broken
{ key = 'DarkHive', name = 'DarkHive', },
{ key = 'DarkHiveSquare', name = 'DarkHive (square)', },
{ key = 'Evolved', name = 'Evolved', },
--{ key = 'Glass', name = 'Glass', }, -- Broken
{ key = 'Twilight', name = 'Twilight', },
},
})
ShButton(HUDSkinPath, 'Reload LuaUI', 'luaui reload', 'Reloads the entire UI. NOTE: This button will not work. You must bind a hotkey to this command and use the hotkey.')
--- Interface --- anything that's an interface but not a HUD Panel
local pathInterface = 'Settings/Interface'
local pathMouse = 'Settings/Interface/Mouse Cursor'
AddOption(pathMouse,
{
name = 'Hardware Cursor',
type = 'bool',
springsetting = 'HardwareCursor',
noHotkey = true,
OnChange=function(self) spSendCommands{"hardwarecursor " .. (self.value and 1 or 0) } end,
})
local pathSelectionShapes = 'Settings/Interface/Selection/Selection Shapes'
local pathSelectionXrayHalo = 'Settings/Interface/Selection/Selection XRay&Halo'
local pathSelectionPlatters = 'Settings/Interface/Selection/Team Platters'
local pathSelectionBluryHalo = 'Settings/Interface/Selection/Blurry Halo Selections'
ShButton(pathSelectionShapes, 'Toggle Selection Shapes', function() spSendCommands{"luaui togglewidget UnitShapes"} end, "Draws coloured shapes under selected units")
ShButton(pathSelectionXrayHalo, 'Toggle Selection XRay&Halo', function() spSendCommands{"luaui togglewidget XrayHaloSelections"} end, "Highlights bodies of selected units")
ShButton(pathSelectionPlatters, 'Toggle Team Platters', function() spSendCommands{"luaui togglewidget TeamPlatter"} end, "Puts team-coloured disk below units")
ShButton(pathSelectionBluryHalo, 'Toggle Blurry Halo Selections', function() spSendCommands{"luaui togglewidget Selection BlurryHalo"} end, "Places blurry halo around selected units")
--- MISC --- Ungrouped. If some of the settings here can be grouped together, make a new subsection or its own section.
local pathMisc = 'Settings/Misc'
ShButton(pathMisc, 'Local Widget Config', function() spSendCommands{"luaui localwidgetsconfig"} end, '', true)
ShButton(pathMisc, 'Game Info', "gameinfo", '', true)
ShButton(pathMisc, 'Share Dialog...', 'sharedialog', '', true)
ShButton(pathMisc, 'FPS Control', "controlunit", 'Control a unit directly in FPS mode.', true)
--ShButton( 'Exit Game...', "exitwindow", '', false ) --this breaks the exitwindow, fixme
AddOption(pathMisc,
{
name = 'Menu pauses in SP',
desc = 'Does opening the menu pause the game (and closing unpause it) in single player?',
type = 'bool',
value = true,
noHotkey = true,
})
AddOption(pathMisc,
{
name = 'Use uikeys.txt',
desc = 'NOT RECOMMENDED! Enable this to use the engine\'s keybind file. This can break existing functionality. Requires restart.',
type = 'bool',
advanced = true,
noHotkey = true,
value = false,
})
AddOption(pathMisc,
{
name = 'Use Old Chili',
desc = 'Enable this if menu element is missing or does not render properly in Spring 96+. '..
'Do NOT enable if you see nothing wrong with the menu (it is slower).'..
'\n(type "/luaui reload" to apply settings)',
type = 'bool',
value = false,
noHotkey = true,
OnChange = function (self)
local value = (self.value and 1) or 0 --true = 1, false = 0
if self.value then
Spring.Echo("Will use old Chili")
else
Spring.Echo("Will use new Chili")
end
Spring.SetConfigInt("ZKuseOldChili", value); --store in Springsettings.txt because api_chili.lua must read it independent of gui_epicmenu.lua
end,
})
local pathMiscScreenshots = 'Settings/Misc/Screenshots'
ShButton(pathMiscScreenshots, 'Save Screenshot (PNG)', 'screenshot png', 'Find your screenshots under Spring/screenshots')
ShButton(pathMiscScreenshots, 'Save Screenshot (JPG)', 'screenshot jpg', 'Find your screenshots under Spring/screenshots')
ShButton(pathMiscScreenshots,
'Create Video (risky)', 'createvideo', 'Capture video directly from Spring without sound. Gets saved in the Spring folder. '
..'Creates a smooth video framerate without ingame stutter. '
..'Caution: It\'s safer to use this in windowed mode because the encoder pop-up menu appears in the foreground window, and could crash the game with a "Fatal Error" after a long recording. '
..'\n\nRecommendation (especially for low-end PCs): After activating the video recording select the fastest encoder such as Microsoft Video and record the video in segments. '
..' You can then use VirtualDub (opensource software) to do futher compression and editing. Note: there is other opensource video capture software like Taksi that you could try.')
--- GRAPHICS --- We might define section as containing anything graphical that has a significant impact on performance and isn't necessary for gameplay
local pathGraphicsMap = 'Settings/Graphics/Map Detail'
ShRadio( pathGraphicsMap,
'Water rendering', {
{name = 'Basic',key='0', desc='A simple plane.', icon=imgPath..'epicmenu/water.png'},
{name = 'Reflective',key='1', desc='Reflects the world.', icon=imgPath..'epicmenu/water.png'},
{name = 'Dynamic',key='2', desc='Has waves and wakes when units move and projectiles explode.', icon=imgPath..'epicmenu/water.png'},
{name = 'Reflective / Refractive',key='3', desc='Reflects the world and has distortions.', icon=imgPath..'epicmenu/water.png'},
{name = 'Bumpmapped',key='4', desc='Fast and good-looking.', icon=imgPath..'epicmenu/water.png'},
},'4',
function(self)
spSendCommands{"water " .. self.value}
end,
false,
true
)
ShRadio( pathGraphicsMap,
'Shadows cast by', {
{name = 'Nothing',key='0', desc='Shadows disabled.'},
{name = 'Units',key='2', desc='Only units cast shadows.'},
{name = 'Units and terrain',key='1', desc='Terrain can cast shadows onto lower terrain. Units also cast shadows.'},
},'1',
function(self)
spSendCommands{"Shadows " .. self.value}
end,
false,
true
)
AddOption(pathGraphicsMap,
{
name = 'Shadow detail level',
desc = 'How detailed shadows are.',
type = 'number',
valuelist = {512, 1024, 2048, 4096},
springsetting = 'ShadowMapSize',
OnChange=function(self)
local curShadow = Spring.GetConfigInt("Shadows") or 0
spSendCommands{"Shadows " .. curShadow .. ' ' .. self.value}
end,
})
ShLabel(pathGraphicsMap, 'Miscellaneous')
AddOption(pathGraphicsMap,
{
name = 'Map Brightness',
desc = 'How bright the terrain appears.',
type = 'number',
min = 0,
max = 1,
step = 0.01,
value = 1,
icon = imgPath..'epicmenu/stock_brightness.png',
OnChange = function(self) spSendCommands{"luaui enablewidget Darkening", "luaui darkening " .. 1-self.value} end,
} )
AddOption(pathGraphicsMap,
{
name = 'Terrain geometry detail',
desc = 'How detailed the terrain geometry is.',
type = 'number',
min = 32,
max = 256,
step = 8,
value = 128,
OnChange = function(self) spSendCommands{"GroundDetail " .. self.value} end,
})
AddOption(pathGraphicsMap,
{
name = 'Ground Decals',
desc = 'Whether explosions leave scars on the ground.',
type = 'bool',
springsetting = 'GroundDecals',
OnChange=function(self) spSendCommands{"grounddecals " .. (self.value and 1 or 0) } end,
noHotkey = true,
} )
--ShButton(pathGraphicsMap, 'Toggle ROAM Rendering', function() spSendCommands{"roam"} end, "Toggle between legacy map rendering and (the new) ROAM map rendering." )
local pathGraphicsExtras = 'Settings/Graphics/Effects'
AddOption(pathGraphicsExtras,
{
name = 'Particle density',
desc = 'How many visual effects can exist at the same time.',
type = 'number',
min = 250,
max = 20000,
step = 250,
value = 10000,
springsetting = 'MaxParticles',
OnChange=function(self) spSendCommands{"maxparticles " .. self.value } end,
} )
ShButton(pathGraphicsExtras, 'Toggle Lups (Lua Particle System)', function() spSendCommands{'luaui togglewidget LupsManager','luaui togglewidget Lups'} end )
ShButton(pathGraphicsExtras, 'Toggle Nightvision', function() spSendCommands{'luaui togglewidget Nightvision Shader'} end, 'Applies a nightvision filter to screen')
ShButton(pathGraphicsExtras, 'Smoke Signal Markers', function() spSendCommands{'luaui togglewidget Smoke Signal'} end, 'Creates a smoke signal effect at map points' )
ShButton(pathGraphicsExtras, 'Toggle Night View', function() spSendCommands{'luaui togglewidget Night'} end, 'Adds a day/night cycle effect' )
local pathUnitVisiblity = 'Settings/Graphics/Unit Visibility'
ShLabel(pathUnitVisiblity, 'Unit Visibility Options')
AddOption(pathUnitVisiblity,
{
name = 'Draw Distance',
type = 'number',
min = 1,
max = 10000,
springsetting = 'UnitLodDist',
OnChange = function(self) spSendCommands{"distdraw " .. self.value} end
} )
AddOption(pathUnitVisiblity,
{
name = 'Icon Distance',
type = 'number',
min = 1,
max = 1000,
springsetting = 'UnitIconDist',
OnChange = function(self) spSendCommands{"disticon " .. self.value} end
} )
AddOption(pathUnitVisiblity,
{
name = 'Shiny Units',
type = 'bool',
springsetting = 'AdvUnitShading',
OnChange=function(self) spSendCommands{"advmodelshading " .. (self.value and 1 or 0) } end, --needed as setconfigint doesn't apply change right away
} )
ShLabel(pathUnitVisiblity, 'Unit Visibility Widgets')
ShButton(pathUnitVisiblity,'Toggle Unit Halos', function() spSendCommands{"luaui togglewidget Halo"} end, "Shows halo around units")
local pathSpotter = 'Settings/Graphics/Unit Visibility/Spotter'
ShButton(pathSpotter, 'Toggle Unit Spotter', function() spSendCommands{"luaui togglewidget Spotter"} end, "Puts team-coloured blob below units")
local pathXrayShader = 'Settings/Graphics/Unit Visibility/XRay Shader'
ShButton(pathXrayShader, 'Toggle XRay Shader', function() spSendCommands{"luaui togglewidget XrayShader"} end, "Highlights edges of units")
local pathUnitOutline = 'Settings/Graphics/Unit Visibility/Outline'
ShButton(pathUnitOutline, 'Toggle Unit Outline', function() spSendCommands{"luaui togglewidget Outline"} end, "Highlights edges of units")
local pathAudio = 'Settings/Audio'
AddOption(pathAudio,{
name = 'Master Volume',
type = 'number',
min = 0,
max = 100,
springsetting = 'snd_volmaster',
OnChange = function(self) spSendCommands{"set snd_volmaster " .. self.value} end
})
AddOption(pathAudio,{
name = 'Music Volume',
type = 'number',
min = 0,
max = 1,
step = 0.01,
value = WG.music_volume or 0.5,
OnChange = function(self)
if (WG.music_start_volume or 0 > 0) then
Spring.SetSoundStreamVolume(self.value / WG.music_start_volume)
else
Spring.SetSoundStreamVolume(self.value)
end
local prevValue = WG.music_volume
--settings.music_volume = self.value
WG.music_volume = self.value
if (prevValue > 0 and self.value <=0) then widgetHandler:DisableWidget("Music Player") end
if (prevValue <=0 and self.value > 0) then widgetHandler:EnableWidget("Music Player") end
end,
})
--- HELP ---
local pathHelp = 'Help'
AddOption(pathHelp,
{
type='text',
name='Tips',
value=[[Hold your meta-key (spacebar by default) while clicking on a unit or corpse for more info and options.
You can also space-click on menu elements to see context settings.
]]
})
ShButton(pathHelp,'Tutorial', function() spSendCommands{"luaui togglewidget Nubtron"} end )
ShButton(pathHelp,'Tip Dispenser', function() spSendCommands{"luaui togglewidget Automatic Tip Dispenser"} end, 'An advisor which gives you tips as you play' )
local pathClippy = 'Help/Clippy Comments'
ShButton(pathClippy, 'Toggle Clippy Comments', function() spSendCommands{"luaui togglewidget Clippy Comments"} end, "Units speak up if they see you're not playing optimally" )
--- MISC
--
return confdata
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/vendor/vendor_droid_power.lua | 3 | 2224 | --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_vendor_vendor_droid_power = object_tangible_vendor_shared_vendor_droid_power:new {
}
ObjectTemplates:addTemplate(object_tangible_vendor_vendor_droid_power, "object/tangible/vendor/vendor_droid_power.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/lair/npc_theater/rori_gundark_raider_camp_neutral_medium_theater.lua | 2 | 1032 | rori_gundark_raider_camp_neutral_medium_theater = Lair:new {
mobiles = {{"gundark_raider",1},{"gundark_rogue",1},{"gundark_crook",1}},
spawnLimit = 12,
buildingsVeryEasy = {"object/building/poi/naboo_swamp_rat_gang_camp_medium.iff","object/building/poi/naboo_mauler_medium.iff"},
buildingsEasy = {"object/building/poi/naboo_swamp_rat_gang_camp_medium.iff","object/building/poi/naboo_mauler_medium.iff"},
buildingsMedium = {"object/building/poi/naboo_swamp_rat_gang_camp_medium.iff","object/building/poi/naboo_mauler_medium.iff"},
buildingsHard = {"object/building/poi/naboo_swamp_rat_gang_camp_medium.iff","object/building/poi/naboo_mauler_medium.iff"},
buildingsVeryHard = {"object/building/poi/naboo_swamp_rat_gang_camp_medium.iff","object/building/poi/naboo_mauler_medium.iff"},
missionBuilding = "object/tangible/lair/base/objective_power_transformer.iff",
mobType = "npc",
buildingType = "theater"
}
addLairTemplate("rori_gundark_raider_camp_neutral_medium_theater", rori_gundark_raider_camp_neutral_medium_theater)
| agpl-3.0 |
KingRaptor/Zero-K | LuaUI/i18nlib/spec/i18n_variants_spec.lua | 21 | 2057 | require 'spec.assert_same'
local variants = require 'i18n.variants'
describe("i18n.variants", function()
it("is a table", function()
assert_equal('table', type(variants))
end)
describe(".ancestry", function()
it("returns just the locale for simple locales", function()
assert_same(variants.ancestry('en'), {'en'})
end)
it("returns self and parents for composite locales", function()
assert_same(variants.ancestry('en-US-texas'), {'en-US-texas', 'en-US', 'en'})
end)
end)
describe(".isParent", function()
it("works as expected", function()
assert_true(variants.isParent('en', 'en-US'))
assert_false(variants.isParent('en-US', 'en'))
assert_false(variants.isParent('en', 'fr'))
assert_false(variants.isParent('en', 'english'))
assert_false(variants.isParent('en', 'en'))
end)
end)
describe(".root", function()
it("returns just the locale for simple locales", function()
assert_equal('en', variants.root('en'))
end)
it("returns the root for composite locales", function()
assert_equal('en', variants.root('en-US'))
end)
end)
describe(".fallbacks", function()
describe("when given locales of the same ancestry", function()
it("returns the locale ancestry if given exactly the same locale twice", function()
assert_same(variants.fallbacks('en-US','en-US'), {'en-US', 'en'})
end)
it("returns the locale ancestry if fallbackLocale is parent of locale", function()
assert_same(variants.fallbacks('en-US','en'), {'en-US', 'en'})
end)
it("returns the fallbackLocale ancestry if locale is parent of fallbackLocale", function()
assert_same(variants.fallbacks('en','en-US'), {'en-US', 'en'})
end)
end)
describe("when given two different locales", function()
it("returns the first locale first, followed by the fallback locale ancestry", function()
assert_same(variants.fallbacks('fr-CA', 'en-US'), {'fr-CA', 'fr', 'en-US', 'en'})
end)
end)
end)
end)
| gpl-2.0 |
Whitechaser/darkstar | scripts/zones/Mhaura/npcs/Kotan-Purutan.lua | 5 | 2136 | -----------------------------------
-- Area: Mhaura
-- NPC: Kotan-Purutan
-- Involved in Quest: Overnight Delivery
-- !pos 40.323 -8.999 44.242 249
-----------------------------------
package.loaded["scripts/zones/Mhaura/TextIDs"] = nil;
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local OvernightDelivery = player:getQuestStatus(WINDURST,OVERNIGHT_DELIVERY);
local KenapaOvernight = player:getVar("Kenapa_Overnight_var"); -- Variable to track progress for Overnight Delivery
local KenapaOvernightDay = player:getVar("Kenapa_Overnight_Day_var"); -- Variable to track the day the quest is started.
local KenapaOvernightHour = player:getVar("Kenapa_Overnight_Hour_var"); -- Variable to track the hour the quest is started.
local HourOfTheDay = VanadielHour();
if (OvernightDelivery == QUEST_ACCEPTED and player:hasKeyItem(SMALL_BAG) == false and (KenapaOvernight >= 4 and KenapaOvernight <= 7) and (HourOfTheDay < 6 or HourOfTheDay >= 18)) then
player:startEvent(141); -- Gives Key Item at correct times of night
elseif (OvernightDelivery == QUEST_ACCEPTED and player:hasKeyItem(SMALL_BAG) == false and (KenapaOvernight >= 4 and KenapaOvernight <= 7) and (HourOfTheDay >= 6 or HourOfTheDay < 18)) then
player:startEvent(144); -- Only at night
elseif (player:hasKeyItem(SMALL_BAG) == true) then
player:startEvent(142); -- Reminder Dialogue
elseif (OvernightDelivery == QUEST_COMPLETED) then
player:startEvent(143); -- Post quest
else
player:startEvent(140); -- Standard
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 == 141) then
player:addKeyItem(SMALL_BAG);
player:setVar("Kenapa_Overnight_Day_var",VanadielDayOfTheYear());
player:setVar("Kenapa_Overnight_Hour_var",VanadielHour());
player:messageSpecial(KEYITEM_OBTAINED,SMALL_BAG);
end
end;
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/gurk/serverobjects.lua | 3 | 2211 | --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/gurk/lair_gurk.lua")
includeFile("tangible/lair/gurk/lair_gurk_mountain.lua")
includeFile("tangible/lair/gurk/lair_gurk_wasteland.lua")
| agpl-3.0 |
Whitechaser/darkstar | scripts/globals/spells/bluemagic/infrasonics.lua | 2 | 1337 | -----------------------------------------
-- Spell: Infrasonics
-- Lowers the evasion of enemies within a fan-shaped area originating from the caster
-- Spell cost: 42 MP
-- Monster Type: Lizards
-- Spell Type: Magical (Ice)
-- Blue Magic Points: 4
-- Stat Bonus: INT+1
-- Level: 65
-- Casting Time: 5 seconds
-- Recast Time: 120 seconds
-- Magic Bursts on: Induration, Distortion, Darkness
-- Combos: None
-----------------------------------------
require("scripts/globals/bluemagic");
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/msg");
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local params = {};
params.attribute = MOD_INT;
params.skillType = BLUE_SKILL;
params.effect = dsp.effects.EVASION_DOWN;
local resist = applyResistance(caster, target, spell, params);
local duration = 60 * resist;
local power = 20;
if (resist > 0.5) then -- Do it!
if (target:addStatusEffect(params.effect,power,0,duration)) then
spell:setMsg(msgBasic.MAGIC_ENFEEB_IS);
else
spell:setMsg(msgBasic.MAGIC_NO_EFFECT);
end
else
spell:setMsg(msgBasic.MAGIC_RESIST);
end;
return params.effect;
end;
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/remmer/lair_remmer.lua | 2 | 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_tangible_lair_remmer_lair_remmer = object_tangible_lair_remmer_shared_lair_remmer:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_remmer_lair_remmer, "object/tangible/lair/remmer/lair_remmer.iff")
| agpl-3.0 |
erfan7/erfan10 | bot/bot.lua | 10 | 21764 | tdcli = dofile('./tg/tdcli.lua')
serpent = (loadfile "./libs/serpent.lua")()
feedparser = (loadfile "./libs/feedparser.lua")()
our_id = 123456789 -- Put Here Your Bot ID
URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
local lgi = require ('lgi')
local notify = lgi.require('Notify')
notify.init ("Telegram updates")
chats = {}
function do_notify (user, msg)
local n = notify.Notification.new(user, msg)
n:show ()
end
function dl_cb (arg, data)
end
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
function load_data(filename)
local f = io.open(filename)
if not f then
return {}
end
local s = f:read('*all')
f:close()
local data = JSON.decode(s)
return data
end
function save_data(filename, data)
local s = JSON.encode(data)
local f = io.open(filename, 'w')
f:write(s)
f:close()
end
function match_plugins(msg)
for name, plugin in pairs(plugins) do
match_plugin(plugin, name, msg)
end
end
function save_config( )
serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua')
end
function create_config( )
-- A simple config with basic plugins and ourselves as privileged user
config = {
enabled_plugins = {
"banhammer",
"banhammer-fa",
"groupmanager",
"groupmanager-fa",
"msg-checks",
"plugins",
"tools",
"expiretime",
"mute-time",
"del",
"lock-fosh"
},
sudo_users = {123456789},
admins = {},
disabled_channels = {},
moderation = {data = './data/moderation.json'},
info_text = [[》permag.ir v3
🔰Our channel :
》@permag_bots《
🔰Our channel2 :
》@permag_ir《
🔰Our channel3 :
》@permag《
🔰Our website :
》http://permag.ir
]],
}
serialize_to_file(config, './data/config.lua')
print ('saved config into conf.lua')
end
-- Returns the config from config.lua file.
-- If file doesn't exist, create it.
function load_config( )
local f = io.open('./data/config.lua', "r")
-- If config.lua doesn't exist
if not f then
print ("Created new config file: ./data/config.lua")
create_config()
else
f:close()
end
local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do
print("Allowed user: " .. user)
end
return config
end
plugins = {}
_config = load_config()
function load_plugins()
local config = loadfile ("./data/config.lua")()
for k, v in pairs(config.enabled_plugins) do
print("Loading Plugins", v)
local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)
if not ok then
print('\27[31mError loading plugins '..v..'\27[39m')
print(tostring(io.popen("lua plugins/"..v..".lua"):read('*all')))
print('\27[31m'..err..'\27[39m')
end
end
end
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
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
function gp_type(chat_id)
local gp_type = "pv"
local id = tostring(chat_id)
if id:match("^-100") then
gp_type = "channel"
elseif id:match("-") then
gp_type = "chat"
end
return gp_type
end
function is_reply(msg)
local var = false
if msg.reply_to_message_id_ ~= 0 then -- reply message id is not 0
var = true
end
return var
end
function is_supergroup(msg)
chat_id = tostring(msg.chat_id_)
if chat_id:match('^-100') then --supergroups and channels start with -100
if not msg.is_post_ then
return true
end
else
return false
end
end
function is_channel(msg)
chat_id = tostring(msg.chat_id_)
if chat_id:match('^-100') then -- Start with -100 (like channels and supergroups)
if msg.is_post_ then -- message is a channel post
return true
else
return false
end
end
end
function is_group(msg)
chat_id = tostring(msg.chat_id_)
if chat_id:match('^-100') then --not start with -100 (normal groups does not have -100 in first)
return false
elseif chat_id:match('^-') then
return true
else
return false
end
end
function is_private(msg)
chat_id = tostring(msg.chat_id_)
if chat_id:match('^-') then --private chat does not start with -
return false
else
return true
end
end
function check_markdown(text) --markdown escape ( when you need to escape markdown , use it like : check_markdown('your text')
str = text
if str:match('_') then
output = str:gsub('_','\\_')
elseif str:match('*') then
output = str:gsub('*','\\*')
elseif str:match('`') then
output = str:gsub('`','\\`')
else
output = str
end
return output
end
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.sender_user_id_ then
var = true
end
end
return var
end
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.sender_user_id_
if data[tostring(msg.chat_id_)] then
if data[tostring(msg.chat_id_)]['owners'] then
if data[tostring(msg.chat_id_)]['owners'][tostring(user)] then
var = true
end
end
end
for v,user in pairs(_config.admins) do
if user[1] == msg.sender_user_id_ then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.sender_user_id_ then
var = true
end
end
return var
end
function is_admin(msg)
local var = false
local user = msg.sender_user_id_
for v,user in pairs(_config.admins) do
if user[1] == msg.sender_user_id_ then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.sender_user_id_ then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_mod(msg)
local var = false
local data = load_data(_config.moderation.data)
local usert = msg.sender_user_id_
if data[tostring(msg.chat_id_)] then
if data[tostring(msg.chat_id_)]['mods'] then
if data[tostring(msg.chat_id_)]['mods'][tostring(usert)] then
var = true
end
end
end
if data[tostring(msg.chat_id_)] then
if data[tostring(msg.chat_id_)]['owners'] then
if data[tostring(msg.chat_id_)]['owners'][tostring(usert)] then
var = true
end
end
end
for v,user in pairs(_config.admins) do
if user[1] == msg.sender_user_id_ then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.sender_user_id_ then
var = true
end
end
return var
end
function is_owner1(chat_id, user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
if data[tostring(chat_id)] then
if data[tostring(chat_id)]['owners'] then
if data[tostring(chat_id)]['owners'][tostring(user)] then
var = true
end
end
end
for v,user in pairs(_config.admins) do
if user[1] == user_id then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
function is_admin1(user_id)
local var = false
local user = user_id
for v,user in pairs(_config.admins) do
if user[1] == user_id then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_mod1(chat_id, user_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(chat_id)] then
if data[tostring(chat_id)]['mods'] then
if data[tostring(chat_id)]['mods'][tostring(usert)] then
var = true
end
end
end
if data[tostring(chat_id)] then
if data[tostring(chat_id)]['owners'] then
if data[tostring(chat_id)]['owners'][tostring(usert)] then
var = true
end
end
end
for v,user in pairs(_config.admins) do
if user[1] == user_id then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
function is_banned(user_id, chat_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(chat_id)] then
if data[tostring(chat_id)]['banned'] then
if data[tostring(chat_id)]['banned'][tostring(user_id)] then
var = true
end
end
end
return var
end
function is_silent_user(user_id, chat_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(chat_id)] then
if data[tostring(chat_id)]['is_silent_users'] then
if data[tostring(chat_id)]['is_silent_users'][tostring(user_id)] then
var = true
end
end
end
return var
end
function is_gbanned(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local gban_users = 'gban_users'
if data[tostring(gban_users)] then
if data[tostring(gban_users)][tostring(user)] then
var = true
end
end
return var
end
function is_filter(msg, text)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(msg.chat_id_)]['filterlist'] then
for k,v in pairs(data[tostring(msg.chat_id_)]['filterlist']) do
if string.find(string.lower(text), string.lower(k)) then
var = true
end
end
end
return var
end
function kick_user(user_id, chat_id)
if not tonumber(user_id) then
return false
end
tdcli.changeChatMemberStatus(chat_id, user_id, 'Kicked', dl_cb, nil)
end
function del_msg(chat_id, message_ids)
local msgid = {[0] = message_ids}
tdcli.deleteMessages(chat_id, msgid, dl_cb, nil)
end
function banned_list(chat_id)
local hash = "gp_lang:"..chat_id
local lang = redis:get(hash)
local data = load_data(_config.moderation.data)
local i = 1
if not data[tostring(chat_id)] then
if not lang then
return '_Group is not added_'
else
return 'گروه به لیست گروه های مدیریتی ربات اضافه نشده است'
end
end
-- determine if table is empty
if next(data[tostring(chat_id)]['banned']) == nil then --fix way
if not lang then
return "_No_ *banned* _users in this group_"
else
return "*هیچ کاربری از این گروه محروم نشده*"
end
end
if not lang then
message = '*List of banned users :*\n'
else
message = '_لیست کاربران محروم شده از گروه :_\n'
end
for k,v in pairs(data[tostring(chat_id)]['banned']) do
message = message ..i.. '- '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
function silent_users_list(chat_id)
local hash = "gp_lang:"..chat_id
local lang = redis:get(hash)
local data = load_data(_config.moderation.data)
local i = 1
if not data[tostring(chat_id)] then
if not lang then
return '_Group is not added_'
else
return 'گروه به لیست گروه های مدیریتی ربات اضافه نشده است'
end
end
-- determine if table is empty
if next(data[tostring(chat_id)]['is_silent_users']) == nil then --fix way
if not lang then
return "_No_ *silent* _users in this group_"
else
return "*لیست کاربران سایلنت شده خالی است*"
end
end
if not lang then
message = '*List of silent users :*\n'
else
message = '_لیست کاربران سایلنت شده :_\n'
end
for k,v in pairs(data[tostring(chat_id)]['is_silent_users']) do
message = message ..i.. '- '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
function gbanned_list(msg)
local hash = "gp_lang:"..msg.chat_id_
local lang = redis:get(hash)
local data = load_data(_config.moderation.data)
local i = 1
if not data['gban_users'] then
data['gban_users'] = {}
save_data(_config.moderation.data, data)
end
if next(data['gban_users']) == nil then --fix way
if not lang then
return "_No_ *globally banned* _users available_"
else
return "*هیچ کاربری از گروه های ربات محروم نشده*"
end
end
if not lang then
message = '*List of globally banned users :*\n'
else
message = '_لیست کاربران محروم شده از گروه های ربات :_\n'
end
for k,v in pairs(data['gban_users']) do
message = message ..i.. '- '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
function filter_list(msg)
local hash = "gp_lang:"..msg.chat_id_
local lang = redis:get(hash)
local data = load_data(_config.moderation.data)
if not data[tostring(msg.chat_id_)]['filterlist'] then
data[tostring(msg.chat_id_)]['filterlist'] = {}
save_data(_config.moderation.data, data)
end
if not data[tostring(msg.chat_id_)] then
if not lang then
return '_Group is not added_'
else
return 'گروه به لیست گروه های مدیریتی ربات اضافه نشده است'
end
end
-- determine if table is empty
if next(data[tostring(msg.chat_id_)]['filterlist']) == nil then --fix way
if not lang then
return "*Filtered words list* _is empty_"
else
return "_لیست کلمات فیلتر شده خالی است_"
end
end
if not data[tostring(msg.chat_id_)]['filterlist'] then
data[tostring(msg.chat_id_)]['filterlist'] = {}
save_data(_config.moderation.data, data)
end
if not lang then
filterlist = '*List of filtered words :*\n'
else
filterlist = '_لیست کلمات فیلتر شده :_\n'
end
local i = 1
for k,v in pairs(data[tostring(msg.chat_id_)]['filterlist']) do
filterlist = filterlist..'*'..i..'* - _'..k..'_\n'
i = i + 1
end
return filterlist
end
function msg_valid(msg)
if msg.date_ < os.time() - 60 then
print('\27[36mOld msg\27[39m')
return false
end
return true
end
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 match_plugin(plugin, plugin_name, msg)
if plugin.pre_process then
-- If plugin is for privileged users only
local result = plugin.pre_process(msg)
if result then
print("pre process: ", plugin.plugin_name)
--tdcli.sendMessage(receiver, msg.id_, 0, result, 0, "md")
end
end
for k, pattern in pairs(plugin.patterns) do
matches = match_pattern(pattern, msg.content_.text_)
if matches then
print("Message matches: ", pattern)
if plugin.run then
local result = plugin.run(msg, matches)
if result then
tdcli.sendMessage(msg.chat_id_, msg.id_, 0, result, 0, "md")
end
end
return
end
end
end
_config = load_config()
load_plugins()
function tdcli_update_callback (data)
if (data.ID == "UpdateNewMessage") then
--print(serpent.block(msg))
local msg = data.message_
local d = data.disable_notification_
local chat = chats[msg.chat_id_]
if redis:get('markread') == 'on' then
tdcli.viewMessages(msg.chat_id_, {[0] = msg.id_}, dl_cb, nil)
end
if ((not d) and chat) then
if msg.content_.ID == "MessageText" then
do_notify (chat.title_, msg.content_.text_)
else
do_notify (chat.title_, msg.content_.ID)
end
end
if msg.content_.ID == "MessageText" then
if msg_valid(msg) then
msg.edited = false
msg.pinned = false
match_plugins(msg)
end
elseif msg.content_.ID == "MessagePinMessage" then
local function pinned_cb(arg, data)
msg = data
msg.pinned = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, pinned_cb, nil)
elseif msg.content_.ID == "MessagePhoto" then
local function photo_cb(arg, data)
msg = data
msg.photo_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, photo_cb, nil)
elseif msg.content_.ID == "MessageVideo" then
local function video_cb(arg, data)
msg = data
msg.video_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, video_cb, nil)
elseif msg.content_.ID == "MessageAnimation" then
local function gif_cb(arg, data)
msg = data
msg.animation_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, gif_cb, nil)
elseif msg.content_.ID == "MessageVoice" then
local function voice_cb(arg, data)
msg = data
msg.voice_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, voice_cb, nil)
elseif msg.content_.ID == "MessageAudio" then
local function audio_cb(arg, data)
msg = data
msg.audio_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, audio_cb, nil)
elseif msg.content_.ID == "MessageForwardedFromUser" then
local function forward_cb(arg, data)
msg = data
msg.forward_info_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, forward_cb, nil)
elseif msg.content_.ID == "MessageSticker" then
local function sticker_cb(arg, data)
msg = data
msg.sticker_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, sticker_cb, nil)
elseif msg.content_.ID == "MessageContact" then
local function contact_cb(arg, data)
msg = data
msg.contact_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, contact_cb, nil)
elseif msg.content_.ID == "MessageDocument" then
local function doc_cb(arg, data)
msg = data
msg.document_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, doc_cb, nil)
elseif msg.content_.ID == "MessageLocation" then
local function loc_cb(arg, data)
msg = data
msg.location_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, loc_cb, nil)
elseif msg.content_.ID == "MessageGame" then
local function game_cb(arg, data)
msg = data
msg.game_ = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.id_
}, game_cb, nil)
elseif msg.content_.ID == "MessageChatAddMembers" then
if msg_valid(msg) then
for i=0,#msg.content_.members_ do
msg.adduser = msg.content_.members_[i].id_
match_plugins(msg)
end
end
elseif msg.content_.ID == "MessageChatJoinByLink" then
if msg_valid(msg) then
msg.joinuser = msg.sender_user_id_
match_plugins(msg)
end
elseif msg.content_.ID == "MessageChatDeleteMember" then
if msg_valid(msg) then
msg.deluser = true
match_plugins(msg)
end
end
if msg.content_.photo_ then
--write_file("test.txt", vardump(msg))
return false
end
elseif data.ID == "UpdateMessageEdited" then
local function edited_cb(arg, data)
msg = data
msg.edited = true
match_plugins(msg)
end
tdcli_function ({
ID = "GetMessage",
chat_id_ = data.chat_id_,
message_id_ = data.message_id_
}, edited_cb, nil)
elseif (data.ID == "UpdateChat") then
chat = data.chat_
chats[chat.id_] = chat
elseif (data.ID == "UpdateOption" and data.name_ == "my_id") then
tdcli_function ({ID="GetChats", offset_order_="9223372036854775807", offset_chat_id_=0, limit_=20}, dl_cb, nil)
end
end
-- http://permag.ir
-- @permag_ir
-- @permag_bots
-- @permag
| gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/container/medical/objects.lua | 3 | 3818 | --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_container_medical_shared_medbag_base = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/container/medical/shared_medbag_base.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/eqp_medic_medbag_s1.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 20,
customizationVariableMapping = {},
detailedDescription = "@container_name:medbag",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "@container_lookat:base_container",
noBuildRadius = 0,
objectName = "@container_name:medbag",
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 = 1834451270,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/container/base/shared_base_container.iff", "object/tangible/container/base/shared_base_container_volume.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_container_medical_shared_medbag_base, "object/tangible/container/medical/shared_medbag_base.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/managers/spawn_manager/naboo.lua | 2 | 13591 | JUNKNOTSELLABLE = 0
JUNKGENERIC = 1
JUNKCLOTHESANDJEWELLERY = 2
JUNKWEAPONS = 4
JUNKARMOUR = 8
JUNKTUSKEN = 16
JUNKJEDI = 32
JUNKJAWA = 64
JUNKGUNGAN = 128
JUNKCONVGENERIC = 1
JUNKCONVARMS = 2
JUNKCONVFINARY = 3
JUNKCONVDENDERRORI = 4
JUNKCONVDENDERTHEED = 5
JUNKCONVLILABORVO = 6
JUNKCONVMALIKVISTAL = 7
JUNKCONVNADOWATTOS = 8
JUNKCONVNATHANTAIKE = 9
JUNKCONVOLLOBOJABBAS = 10
JUNKCONVQUICHDANTOOINE = 11
JUNKCONVREGGINYM = 12
JUNKCONVSHEANILAKE = 13
JUNKCONVSNEGVALARIAN = 14
JUNKCONVJAWAGENERIC = 15
JUNKCONVJAWAFINARY = 16
JUNKCONVJAWAARMS = 17
JUNKCONVJAWATUSKEN = 18
-- Generated by SWGEmu Spawn Tool v0.12
-- {"regionName", xCenter, yCenter, radius, tier, spawnConstant, "spawnGroup", maxSpawnLimit}
-- Tier is a bit mask with the following possible values where each hexadecimal position is one possible configuration.
-- That means that it is not possible to have both a spawn area and a no spawn area in the same region, but
-- a spawn area that is also a no build zone is possible.
UNDEFINEDAREA = 0x0000
SPAWNAREA = 0x0001
NOSPAWNAREA = 0x0002
WORLDSPAWNAREA = 0x0010
NOBUILDZONEAREA = 0x0100
naboo_regions = {
{"beach_town",0,0,{1,0},UNDEFINEDAREA,1},
{"beachtown_easy_newbie",-5585,-35,{1,1000},SPAWNAREA,1,"naboo_easy",128},
{"beachtown_medium_newbie",-5585,-35,{3,1000,1900},SPAWNAREA,1,"naboo_medium",192},
{"bounty_hunter_camp",5029,4156,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"campfire_and_bones",3939,2701,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"campfire_and_ruins",-1771,2387,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"central_jungle_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"central_mountain_circle",0,0,{1,0},UNDEFINEDAREA,1},
{"central_mountain_range",0,0,{1,0},UNDEFINEDAREA,1},
{"dead_tree",-675,5203,{1,10},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"debris",-1691,5427,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"debris_2",-2957,1699,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"debris_3",-2403,563,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"deeja_easy_newbie",5060,-1470,{1,1300},SPAWNAREA,1,"naboo_easy",192},
{"deeja_medium_newbie",5060,-1470,{3,1300,2200},SPAWNAREA,1,"naboo_medium",320},
{"deeja_peak",0,0,{1,0},UNDEFINEDAREA,1},
{"eastern_forest",0,0,{1,0},UNDEFINEDAREA,1},
{"eastern_jungle_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"eastern_mountains",0,0,{1,0},UNDEFINEDAREA,1},
{"easy_gnort_ne",0,0,{1,0},UNDEFINEDAREA,1},
{"emperors_retreat",2400,-3900,{1,500},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"fence_and_debris",-7575,5043,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"fishing_dock",-6314,-5087,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"forest_1",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_forest_1",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_jungle_1",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_jungle_2",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_1",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_11",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_12",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_13",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_14",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_15",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_16",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_17",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_2",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_3",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_4",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_5",0,0,{1,0},UNDEFINEDAREA,1},
{"gallo_mountains_6",0,0,{1,0},UNDEFINEDAREA,1},
{"gardens",1260,4291,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gate_and_columns",-259,-60,{1,60},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gazebo",1012,-3460,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"great_grass_plains_1",0,0,{1,0},UNDEFINEDAREA,1},
{"great_grass_plains_2",0,0,{1,0},UNDEFINEDAREA,1},
{"great_grass_plains_3",0,0,{1,0},UNDEFINEDAREA,1},
{"great_grass_plains_4",0,0,{1,0},UNDEFINEDAREA,1},
{"great_grass_plains_5",0,0,{1,0},UNDEFINEDAREA,1},
{"graveyard",-3603,3119,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_fountain",5556,5531,{1,50},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_head",1940,6611,{1,50},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_head_with_walls",-5046,6178,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_monument",-7547,2251,{1,50},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_ruins",3428,5075,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_sacred_place",-2013,-5453,{1,180},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"gungan_temple",-264,2826,{1,150},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"hard_capper_spineflap_sw",0,0,{1,0},UNDEFINEDAREA,1},
{"hard_gungan_se",0,0,{1,0},UNDEFINEDAREA,1},
{"hard_mauler_nw",0,0,{1,0},UNDEFINEDAREA,1},
--{"hard_peko_peko_nw",-1856,6112,{1,2500},SPAWNAREA,1,"peko_albatross",5},
{"hard_veermok_ne",0,0,{1,0},UNDEFINEDAREA,1},
{"imperial_vs_gungan_poi",4760,3875,{1,125},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"jungle_1",0,0,{1,0},UNDEFINEDAREA,1},
{"jungle_2",0,0,{1,0},UNDEFINEDAREA,1},
{"kaadara_easy_newbie",5150,6680,{1,1300},SPAWNAREA,1,"naboo_easy",256},
{"kaadara_medium_newbie",5150,6680,{3,1300,2200},SPAWNAREA,1,"naboo_medium",384},
{"kadaara",0,0,{1,0},UNDEFINEDAREA,1},
{"keren",0,0,{1,0},UNDEFINEDAREA,1},
{"keren_easy_newbie",1685,2620,{1,1300},SPAWNAREA,1,"naboo_easy",256},
{"keren_medium_newbie",1685,2620,{3,1300,2200},SPAWNAREA,1,"naboo_medium",384},
{"lainorm_swamp_2",0,0,{1,0},UNDEFINEDAREA,1},
{"lake_retreat",-5555,-34,{1,400},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"lake_retreat_gazebo",-5637,174,{1,40},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"lasay_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"lianorm_swamp_1",0,0,{1,0},UNDEFINEDAREA,1},
{"lianorm_swamps",0,0,{1,0},UNDEFINEDAREA,1},
{"mauler_stronghold",2910,1118,{1,200},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"medium_ikopi_ne",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_mountain_ikopi_ne",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_mountain_ikopi_se",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_mountain_krevol_se",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_swamp_cat_se",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_tusk_cat_ne",0,0,{1,0},UNDEFINEDAREA,1},
{"medium_tusk_cat_nw",0,0,{1,0},UNDEFINEDAREA,1},
{"moenia",0,0,{1,0},UNDEFINEDAREA,1},
{"moenia_easy_newbie",4800,-4820,{1,1300},SPAWNAREA,1,"naboo_easy",256},
{"moenia_medium_newbie",4800,-4820,{3,1300,2200},SPAWNAREA,1,"naboo_medium",384},
{"narglatch_cave",5861,-4650,{1,150},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"north_eastern_jungle_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"northern_plains",0,0,{1,0},UNDEFINEDAREA,1},
{"paitnnu_wetlands",0,0,{1,0},UNDEFINEDAREA,1},
{"plains_1",0,0,{1,0},UNDEFINEDAREA,1},
{"rainforest_1",0,0,{1,0},UNDEFINEDAREA,1},
{"rainforest_2",0,0,{1,0},UNDEFINEDAREA,1},
{"rainforest_3",0,0,{1,0},UNDEFINEDAREA,1},
{"rebel_outpost",-1499,-1732,{1,100},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"rebel_outpost_2",978,-1332,{1,100},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruined_wall",-3603,-876,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruins",-2547,6787,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruins_2",-1799,-500,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruins_3",-7319,-4143,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruins_4",2148,5427,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"ruins_5}",1228,5515,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"shield_generator",-1339,6531,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"small_garden",-6459,1747,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"small_graveyard",-2174,6357,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"southeast_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"southwest_mountain_circle",0,0,{1,0},UNDEFINEDAREA,1},
{"southwest_swamp",0,0,{1,0},UNDEFINEDAREA,1},
{"statues",-1635,-4036,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"statues_and_droideka",-2331,5075,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"statues_and_torches",-1147,347,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"swamp_1",0,0,{1,0},UNDEFINEDAREA,1},
{"swamp_2",0,0,{1,0},UNDEFINEDAREA,1},
{"swamp_3",0,0,{1,0},UNDEFINEDAREA,1},
{"swamp_town",0,0,{1,0},UNDEFINEDAREA,1},
{"theed",-5036,4124,{1,500},NOSPAWNAREA + NOBUILDZONEAREA,0},
{"theed_easy_newbie_1",-5485,4380,{1,1750},SPAWNAREA,1,"naboo_easy",192},
{"theed_easy_newbie_2",-4940,4030,{1,1750},SPAWNAREA,1,"naboo_easy",192},
{"theed_medium_newbie",-5212,4205,{3,1750,2800},SPAWNAREA,1,"naboo_medium",448},
{"tower",-1568,6003,{1,50},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"weapon_development_facility",-6510,-3280,{1,200},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"wreckage",6314,4248,{1,30},NOSPAWNAREA + NOBUILDZONEAREA,1},
{"western_forest",0,0,{1,0},UNDEFINEDAREA,1},
{"world_spawner",0,0,{1,-1},SPAWNAREA + WORLDSPAWNAREA,1,"naboo_world",2048},
}
naboo_static_spawns = {
{"agriculturalist",60,-5827.81,6,4173.98,180.005,0, "conversation", "", "stationary"},
{"bodyguard",300,11.7898,1.75,-1.89849,180.002,1305892, "conversation", "", "stationary"},
{"bodyguard",300,-5258.93,6,4187.17,180.005,0, "conversation", "", "stationary"},
{"bodyguard",300,-29.8622,7.9418,10.8957,180.008,1692104, "conversation", "", "stationary"},
{"bodyguard",300,-37.5788,7.9418,22.3791,0,1692104, "conversation", "", "stationary"},
{"brawler",60,19.6394,0.764492,42.4583,354.768,5475485, "conversation", "", "stationary"},
{"businessman",60,15.5641,1.28309,-2.37071,135.005,1677395, "conversation", "", "stationary"},
{"businessman",60,-4.2087,0.999986,2.15452,179.993,1677394, "conversation", "", "stationary"},
{"coa2_imperial_coordinator",0,-5431.8,6,4168.58,145.531,0, "npc_imperial", "", "stationary"},
{"commoner",60,-17.0001,2.25,17.4832,270.003,1305888, "conversation", "", "stationary"},
{"commoner",60,-19.0001,2.25,17.4832,90.0053,1305888, "conversation", "", "stationary"},
{"commoner",60,-5778.43,6,4397.54,180.005,0, "conversation", "", "stationary"},
{"commoner_technician",60,-22.5486,1.61223,33.2294,354.768,5475485, "conversation", "", "stationary"},
{"entertainer",60,19.6394,0.664388,43.5491,180.018,5475485, "conversation", "", "stationary"},
{"etheli_drenel",60,12.4716,2.31216,25.6024,180.001,5475485, "conversation", "", "stationary"},
{"explorer",60,3.05224,2.12878,72.5469,180.005,5475487, "conversation", "", "stationary"},
{"fringer",300,3.05224,2.12878,71.4469,0,5475487, "conversation", "", "stationary"},
{"gambler",60,4.2931,1,-7.62435,360.011,1677394, "conversation", "", "stationary"},
{"gambler",60,-11.7266,1.6,-16.4722,0,1677399, "conversation", "", "stationary"},
{"gungan_guard",300,12.4716,2.41226,24.5116,5.24304,5475485, "conversation", "", "stationary"},
{"gungan_hermit",300,-22.6115,1.6,-10.3739,179.996,1677400, "conversation", "", "stationary"},
{"gungan_outcast",300,-5827.81,6,4172.98,0,0, "conversation", "", "stationary"},
{"junk_dealer",0,-5222.4,6,4217.4,-137,0, "", "", "stationary",JUNKGENERIC,JUNKCONVGENERIC},
{"junk_dealer",0,5143.9,-192,6818,47,0, "", "", "stationary",JUNKGENERIC,JUNKCONVGENERIC},
{"junk_sheani",0,-5496,4.2,-71,112,0, "", "Sheani Lake", "stationary",JUNKCLOTHESANDJEWELLERY+JUNKARMOUR,JUNKCONVSHEANILAKE},
{"junk_dealer",0,1371.6,13,2705.3,177,0, "", "", "stationary",JUNKGENERIC,JUNKCONVGENERIC},
{"junk_lila",0,4809.5,4.2,-4663,112,0, "", "Lila Rawlkiss", "stationary",JUNKWEAPONS,JUNKCONVLILABORVO},
{"junk_dealer",0,-5885.3,6,4214.7,83,0, "", "", "stationary",JUNKGENERIC,JUNKCONVGENERIC},
{"medic",60,-11.5446,2.12878,75.9709,0,5475487, "conversation", "", "stationary"},
{"mercenary",60,-6.34119,0.6,-9.37965,360.011,5475480, "conversation", "", "stationary"},
{"miner",60,-5886.59,6,4369.23,180.005,0, "conversation", "", "stationary"},
{"naboo_holy_man",300,-22.6115,1.6,-11.4739,0,1677400, "conversation", "", "stationary"},
{"naboo_nomad",300,16.6641,1.28309,-3.47071,360.011,1677395, "conversation", "", "stationary"},
{"noble",60,-16.4118,1.02908,39.5837,179.999,5475485, "conversation", "", "stationary"},
{"noble",60,2432.4,292,-3887.3,-125,0, "npc_use_terminal_high", "", "stationary"},
{"official",300,-5886.59,6,4368.23,0,0, "conversation", "", "stationary"},
{"philosopher",300,-11.7266,1.6,-15.4722,180.001,1677399, "conversation", "", "stationary"},
{"rsf_palace_guard",300,18.5394,0.664266,43.5491,134.79,5475485, "conversation", "", "stationary"},
{"rsf_palace_guard",300,-6.34119,0.6,-8.27965,180.012,5475480, "conversation", "", "stationary"},
{"rsf_pilot",300,-16.4118,1.12919,38.4929,5.24439,5475485, "conversation", "", "stationary"},
{"rsf_pilot",300,-22.5486,1.52122,34.221,180.016,5475485, "conversation", "", "stationary"},
{"rsf_security_guard",300,6.3,1.2,-3.9,-89,1305892, "conversation", "", "stationary"},
{"rsf_security_officer",300,5.4,1.2,-3.9,87,1305892, "conversation", "", "stationary"},
{"scoundrel",300,-4.2087,0.999986,1.15452,0,1677394, "conversation", "", "stationary"},
{"stormtrooper_groupleader",400,-5969.83,6,4246.76,173.432,0, "", "VK-481", "stationary"},
{"trainer_shipwright",0,4727,4.3,-4649,0,0, "", "a shipwright trainer", "stationary"},
{"trainer_shipwright",0,1352,13,2768,141,0, "", "a shipwright trainer", "stationary"},
{"trainer_shipwright",0,0.2,0.7,-71.4,-177,1692101, "", "a shipwright trainer", "stationary"},
{"trainer_shipwright",0,5.1,0.6,66.6,119,1741539, "", "a shipwright trainer", "stationary"},
{"vendor",60,-11.5446,2.12878,76.8966,179.996,5475487, "conversation", "", "stationary"},
{"ysnide_omewror",60,4.2931,1.00001,-6.52435,180.012,1677394, "conversation", "", "stationary"},
}
naboo_badges = {
{"badge_amidalas_sandy_beach",-5828,-93,10,77},
{"badge_deeja_falls_top",5161,-1627,10,76},
{"badge_gungan_sacred_place",-2000,-5429,10,19},
{"badge_theed_falls_bottom",-4614,4261,10,75},
}
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/intangible/pet/snorbal_hue.lua | 3 | 2192 | --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_intangible_pet_snorbal_hue = object_intangible_pet_shared_snorbal_hue:new {
}
ObjectTemplates:addTemplate(object_intangible_pet_snorbal_hue, "object/intangible/pet/snorbal_hue.iff")
| agpl-3.0 |
KingRaptor/Zero-K | units/puppy.lua | 1 | 4339 | unitDef = {
unitname = [[puppy]],
name = [[Puppy]],
description = [[Walking Missile]],
acceleration = 0.24,
activateWhenBuilt = true,
brakeRate = 0.72,
buildCostMetal = 50,
builder = false,
buildPic = [[PUPPY.png]],
canAttack = true,
canGuard = true,
canMove = true,
canPatrol = true,
canstop = [[1]],
category = [[LAND TOOFAST]],
collisionVolumeOffsets = [[0 0 0]],
collisionVolumeScales = [[20 20 20]],
collisionVolumeType = [[ellipsoid]],
customParams = {
description_de = [[Wandernde Rakete]],
helptext = [[This fast-moving suicide unit is good for raiding and sniping lightly-armored targets. When standing next to wreckages, it automatically draws metal from them to replicate itself, grey goo style.]],
helptext_de = [[Diese flinke Kamikazeinheit ist ideal, um schlecht gepanzerte Ziele zu überfallen. Sobald sie neben Wracks steht, zieht sie automatisch Metall aus diesen, um sich selbst zu vervielfältigen.]],
modelradius = [[10]],
grey_goo = 1,
grey_goo_spawn = "puppy",
grey_goo_drain = 5,
grey_goo_cost = 75,
grey_goo_range = 120,
},
explodeAs = [[TINY_BUILDINGEX]],
footprintX = 2,
footprintZ = 2,
iconType = [[kbotbomb]],
idleAutoHeal = 5,
idleTime = 1800,
leaveTracks = true,
maxDamage = 80,
maxSlope = 36,
maxVelocity = 3.5,
maxWaterDepth = 15,
minCloakDistance = 75,
movementClass = [[KBOT2]],
noAutoFire = false,
noChaseCategory = [[FIXEDWING]],
objectName = [[puppy.s3o]],
script = [[puppy.lua]],
selfDestructAs = [[TINY_BUILDINGEX]],
selfDestructCountdown = 5,
sfxtypes = {
explosiongenerators = {
[[custom:RAIDMUZZLE]],
[[custom:VINDIBACK]],
[[custom:digdig]],
},
},
sightDistance = 560,
trackOffset = 0,
trackStrength = 8,
trackStretch = 0.6,
trackType = [[ComTrack]],
trackWidth = 12,
turnRate = 1800,
workerTime = 0,
weapons = {
{
def = [[MISSILE]],
badTargetCategory = [[UNARMED]],
onlyTargetCategory = [[FIXEDWING LAND SINK TURRET SHIP SWIM FLOAT GUNSHIP HOVER]],
},
},
weaponDefs = {
MISSILE = {
name = [[Legless Puppy]],
areaOfEffect = 40,
cegTag = [[VINDIBACK]],
craterBoost = 1,
craterMult = 2,
damage = {
default = 410.1,
planes = 410.1,
subs = 20.5,
},
fireStarter = 70,
fixedlauncher = 1,
flightTime = 0.8,
impulseBoost = 0.75,
impulseFactor = 0.3,
interceptedByShieldType = 2,
model = [[puppymissile.s3o]],
noSelfDamage = true,
range = 170,
reloadtime = 1,
smokeTrail = false,
soundHit = [[explosion/ex_med5]],
soundHitVolume = 8,
soundStart = [[weapon/missile/sabot_fire]],
soundStartVolume = 7,
startVelocity = 300,
tracks = true,
turnRate = 56000,
turret = true,
weaponAcceleration = 300,
weaponType = [[MissileLauncher]],
weaponVelocity = 400,
},
},
featureDefs = {
DEAD = {
blocking = false,
featureDead = [[DEAD2]],
footprintX = 3,
footprintZ = 3,
object = [[debris2x2a.s3o]],
},
HEAP = {
blocking = false,
footprintX = 2,
footprintZ = 2,
object = [[debris2x2c.s3o]],
},
},
}
return lowerkeys({ puppy = unitDef })
| gpl-2.0 |
DailyShana/ygopro-scripts | c68084557.lua | 7 | 2193 | --機械竜 パワー・ツール
function c68084557.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--draw
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetDescription(aux.Stringid(68084557,0))
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_EQUIP)
e1:SetCountLimit(1,68084557)
e1:SetCondition(c68084557.drcon)
e1:SetTarget(c68084557.drtg)
e1:SetOperation(c68084557.drop)
c:RegisterEffect(e1)
--equip change
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(68084557,1))
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetTarget(c68084557.eqtg)
e2:SetOperation(c68084557.eqop)
c:RegisterEffect(e2)
end
function c68084557.drcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c68084557.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c68084557.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c68084557.eqfilter(c,ec)
return c:IsType(TYPE_EQUIP) and c:GetEquipTarget() and c:GetEquipTarget()~=ec and c:CheckEquipTarget(ec)
end
function c68084557.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and c68084557.eqfilter(chkc,e:GetHandler()) end
if chk==0 then return Duel.IsExistingTarget(c68084557.eqfilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,nil,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c68084557.eqfilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil,e:GetHandler())
end
function c68084557.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:CheckEquipTarget(c) then
Duel.Equip(tp,tc,c)
end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/component/dna/dna_template_rancor.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_tangible_component_dna_dna_template_rancor = object_tangible_component_dna_shared_dna_template_rancor:new {
}
ObjectTemplates:addTemplate(object_tangible_component_dna_dna_template_rancor, "object/tangible/component/dna/dna_template_rancor.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Buburimu_Peninsula/npcs/Ganemu-Punnemu_WW.lua | 2 | 3004 | -----------------------------------
-- Area: Buburimu Peninsula
-- NPC: Ganemu-Punnemu, W.W.
-- Outpost Conquest Guards
-- !pos -481.164 -32.858 49.188 118
-----------------------------------
package.loaded["scripts/zones/Buburimu_Peninsula/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Buburimu_Peninsula/TextIDs");
local guardnation = NATION_WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = KOLSHUSHU;
local csid = 0x7ff7;
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(dsp.effects.SIGIL);
player:delStatusEffect(dsp.effects.SANCTION);
player:delStatusEffect(dsp.effects.SIGNET);
player:addStatusEffect(dsp.effects.SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/bio_engineer/creature/creature_graul.lua | 1 | 3368 | --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_bio_engineer_creature_creature_graul = object_draft_schematic_bio_engineer_creature_shared_creature_graul:new {
templateType = DRAFTSCHEMATIC,
disableFactoryRun = true,
customObjectName = "Graul",
craftingToolTab = 256, -- (See DraftSchemticImplementation.h)
complexity = 38,
size = 1,
xpType = "crafting_bio_engineer_creature",
xp = 365,
assemblySkill = "bio_engineer_assembly",
experimentingSkill = "bio_engineer_experimentation",
customizationSkill = "bio_engineer_experimentation",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_creature_ingredients_n", "craft_creature_ingredients_n", "craft_creature_ingredients_n"},
ingredientTitleNames = {"dna_template", "protein_base", "organic_nutrition_materials"},
ingredientSlotType = {1, 0, 0},
resourceTypes = {"object/tangible/component/dna/shared_dna_template_generic.iff", "creature_food", "flora_food"},
resourceQuantities = {1, 100, 90},
contribution = {100, 100, 100},
targetTemplate = "object/tangible/deed/pet_deed/graul_deed.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_bio_engineer_creature_creature_graul, "object/draft_schematic/bio_engineer/creature/creature_graul.iff")
| agpl-3.0 |
pguillory/luajit-libuv | src/uv/util/expect.lua | 2 | 1551 |
local expect = {}
local tosource = function(value)
if type(value) == 'string' then
return string.format('%q', value)
else
return tostring(value)
end
end
function expect.equal(a, b)
if a ~= b then
local err = string.format('values should be equal:\n- %s\n- %s', tosource(a), tosource(b))
-- print(err)
error(err, 2)
end
end
function expect.error(expected, callback)
local ok, actual = pcall(callback)
if ok then
local err = string.format('expected an error but got none:\n- %q', expected)
-- print(err)
error(err, 2)
end
if not actual:find(expected, 1, true) then
local err = string.format('expected a different error:\n- (expect): %q\n- (actual): %q', expected, actual)
-- print(err)
error(err, 2)
end
end
function expect.ok(callback)
local ok, actual = pcall(callback)
if not ok then
local err = string.format('expected no errors but got one:\n- %q', actual)
-- print(err)
error(err, 2)
end
end
do
expect.error('values should be equal', function()
expect.equal('asdf', 'zxcv')
end)
expect.error('expected an error but got none', function()
expect.error('something', function()
end)
end)
expect.error('expected a different error', function()
expect.error('something', function()
error('anything else')
end)
end)
expect.ok(function()
expect.ok(function()
end)
end)
expect.error('expected no errors but got one', function()
expect.ok(function()
error('something')
end)
end)
end
return expect
| mit |
DailyShana/ygopro-scripts | c75081613.lua | 7 | 1742 | --ジャイアントワーム
function c75081613.initial_effect(c)
c:EnableReviveLimit()
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(c75081613.spcon)
e2:SetOperation(c75081613.spop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(75081613,0))
e3:SetCategory(CATEGORY_DECKDES)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_BATTLE_DAMAGE)
e3:SetCondition(c75081613.condition)
e3:SetTarget(c75081613.target)
e3:SetOperation(c75081613.operation)
c:RegisterEffect(e3)
end
function c75081613.spfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAbleToRemoveAsCost()
end
function c75081613.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c75081613.spfilter,tp,LOCATION_GRAVE,0,1,nil)
end
function c75081613.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c75081613.spfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c75081613.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function c75081613.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,1-tp,1)
end
function c75081613.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(1-tp,1,REASON_EFFECT)
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/thug/gambler.lua | 1 | 1306 | gambler = Creature:new {
objectName = "@mob/creature_names:gambler",
randomNameType = NAME_GENERIC_TAG,
socialGroup = "thug",
faction = "thug",
level = 8,
chanceHit = 0.270000,
damageMin = 70,
damageMax = 75,
baseXp = 187,
baseHAM = 405,
baseHAMmax = 495,
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 = STALKER,
diet = HERBIVORE,
templates = {"object/mobile/dressed_commoner_tatooine_nikto_male_02.iff",
"object/mobile/dressed_commoner_tatooine_aqualish_female_01.iff",
"object/mobile/dressed_commoner_naboo_twilek_female_01.iff",
"object/mobile/dressed_commoner_naboo_human_female_03.iff",
"object/mobile/dressed_commoner_tatooine_devaronian_male_01.iff"
},
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "wearables_common", chance = 2000000},
{group = "pistols", chance = 1000000},
{group = "tailor_components", chance = 1500000},
{group = "loot_kit_parts", chance = 1500000}
}
}
},
weapons = {"pirate_weapons_light"},
attacks = merge(marksmannovice,brawlernovice)
}
CreatureTemplates:addCreatureTemplate(gambler, "gambler")
| agpl-3.0 |
njligames/NJLIGameEngine | src/njli/platform/cmake.in/ldoc.in/Camera.lua | 4 | 6315 |
----
-- @file Camera
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:calculateSerializeBufferSize()
end
---- Brief description.
-- @author James Folk, 16-02-11 15:02:17
-- <#Description#>
-- @param dataBuffer <#dataBuffer description#>
-- @param btSerializer <#btSerializer description#>
-- @return
function Camera:serialize(dataBuffer, btSerializer)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getClassName()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getType()
end
---- Brief description.
-- <#Description#>
-- @param val <#val description#>
-- @return <#return value description#>
function Camera:setZNear(val)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getZNear()
end
---- Brief description.
-- <#Description#>
-- @param val <#val description#>
-- @return <#return value description#>
function Camera:setZFar(val)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getZFar()
end
---- Brief description.
-- <#Description#>
-- @param val <#val description#>
-- @return <#return value description#>
function Camera:setFov(val)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getFov()
end
---- Brief description.
-- <#Description#>
-- @param enable <#enable description#>
-- @return <#return value description#>
function Camera:enableOrthographic(enable)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:isOrthographic()
end
---- Brief description.
-- <#Description#>
-- @param category <#category description#>
-- @return <#return value description#>
function Camera:setRenderCategory(category)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getRenderCategory()
end
---- Brief description.
-- <#Description#>
-- @param category <#category description#>
-- @return <#return value description#>
function Camera:addRenderCategory(category)
end
---- Brief description.
-- <#Description#>
-- @param category <#category description#>
-- @return <#return value description#>
function Camera:removeRenderCategory(category)
end
---- Brief description.
-- <#Description#>
-- @param category <#category description#>
-- @return <#return value description#>
function Camera:hasRenderCategory(category)
end
---- Brief description.
-- <#Description#>
-- @param windowPosition <#windowPosition description#>
-- @return <#return value description#>
function Camera:unProject(windowPosition)
end
---- Brief description.
-- <#Description#>
-- @param objectPosition <#objectPosition description#>
-- @return <#return value description#>
function Camera:project(objectPosition)
end
---- Brief description.
-- <#Description#>
-- @param windowPosition <#windowPosition description#>
-- @param from <#from description#>
-- @param to <#to description#>
-- @return <#return value description#>
function Camera:getTouchRay(windowPosition, from, to)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getForwardVector()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getUpVector()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getSideVector()
end
---- Brief description.
-- @author James Folk, 16-02-11 02:02:03
-- <#Description#>
-- @param pos <#pos description#>
-- @param up <#0 description#>
-- @return
function Camera:lookAt(pos, up)
end
---- Brief description.
-- <#Description#>
-- @param screenPosition <#screenPosition description#>
-- @param rayContact <#rayContact description#>
-- @param collisionGroup <#collisionGroup description#>
-- @param collisionMask <#collisionMask description#>
-- @return <#return value description#>
function Camera:rayTestClosest(screenPosition, rayContact, collisionGroup, collisionMask)
end
---- Brief description.
-- <#Description#>
-- @param screenPosition <#screenPosition description#>
-- @param rayContacts <#rayContacts description#>
-- @param numContacts <#numContacts description#>
-- @param collisionGroup <#collisionGroup description#>
-- @param collisionMask <#collisionMask description#>
-- @return <#return value description#>
function Camera:rayTestAll(screenPosition, rayContacts, numContacts, collisionGroup, collisionMask)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getParent()
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function Camera:getParent()
end
---- Brief description.
-- <#Description#>
-- @param size <#size description#>
-- @return <#return value description#>
function NJLI.Camera.createArray(size)
end
---- Brief description.
-- <#Description#>
-- @param array <#array description#>
-- @return <#return value description#>
function NJLI.Camera.destroyArray(array)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function NJLI.Camera.create()
end
---- Brief description.
-- <#Description#>
-- @param builder <#builder description#>
-- @return <#return value description#>
function NJLI.Camera.create(builder)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.Camera.clone(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.Camera.copy(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @return <#return value description#>
function NJLI.Camera.destroy(object)
end
---- Brief description.
-- <#Description#>
-- @param object <#object description#>
-- @param L <#L description#>
-- @param stack_index <#stack_index description#>
-- @return <#return value description#>
function NJLI.Camera.load(object, L, stack_index)
end
---- Brief description.
-- <#Description#>
-- @return <#return value description#>
function NJLI.Camera.type()
end
| mit |
DailyShana/ygopro-scripts | c44046281.lua | 3 | 2820 | --ディメンション・ゲート
function c44046281.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c44046281.target)
e1:SetOperation(c44046281.operation)
c:RegisterEffect(e1)
--send to grave
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(44046281,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c44046281.tgcon)
e2:SetTarget(c44046281.tgtg)
e2:SetOperation(c44046281.tgop)
c:RegisterEffect(e2)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(44046281,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetCondition(c44046281.spcon)
e2:SetTarget(c44046281.sptg)
e2:SetOperation(c44046281.spop)
c:RegisterEffect(e2)
end
function c44046281.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function c44046281.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 then
c:SetCardTarget(tc)
end
end
function c44046281.tgcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and Duel.GetAttackTarget()==nil
end
function c44046281.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
end
function c44046281.tgop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
end
end
function c44046281.spcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
if tc and e:GetHandler():IsLocation(LOCATION_GRAVE) then
e:SetLabelObject(tc)
return true
end
return false
end
function c44046281.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=e:GetLabelObject()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and tc and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,1,0,0)
end
function c44046281.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Whitechaser/darkstar | scripts/zones/Inner_Horutoto_Ruins/npcs/_5ca.lua | 5 | 1955 | -----------------------------------
-- Area: Inner Horutoto Ruins
-- NPC: Mahogany Door
-- Involved In Quest: Making Headlines
-- Involved in Mission 2-1
-- !pos -11 0 20 192
-----------------------------------
package.loaded["scripts/zones/Inner_Horutoto_Ruins/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/globals/missions");
require("scripts/zones/Inner_Horutoto_Ruins/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local MakingHeadlines = player:getQuestStatus(WINDURST,MAKING_HEADLINES);
local CurrentMission = player:getCurrentMission(WINDURST)
local MissionStatus = player:getVar("MissionStatus");
-- Check for Missions first (priority?)
-- We should allow both missions and quests to activate
if (CurrentMission == LOST_FOR_WORDS and MissionStatus == 4) then
player:startEvent(46);
elseif (MakingHeadlines == 1) then
function testflag(set,flag)
return (set % (2*flag) >= flag)
end
local prog = player:getVar("QuestMakingHeadlines_var");
if (testflag(tonumber(prog),16) == false and testflag(tonumber(prog),8) == true) then
player:messageSpecial(7208,1,WINDURST_WOODS_SCOOP); -- Confirm Story
player:setVar("QuestMakingHeadlines_var",prog+16);
else
player:startEvent(44); -- "The door is firmly shut"
end
else
player:startEvent(44); -- "The door is firmly shut"
end;
return 1;
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 == 46) then
-- Mark the progress
player:setVar("MissionStatus",5);
end
end; | gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/dantooine/janta_herbalist.lua | 2 | 1070 | janta_herbalist = Creature:new {
objectName = "@mob/creature_names:janta_herbalist",
randomNameType = NAME_GENERIC_TAG,
socialGroup = "janta_tribe",
faction = "janta_tribe",
level = 27,
chanceHit = 0.39,
damageMin = 305,
damageMax = 320,
baseXp = 2730,
baseHAM = 8200,
baseHAMmax = 10000,
armor = 0,
resists = {-1,25,-1,25,25,25,25,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + HERD,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {
"object/mobile/dantari_male.iff",
"object/mobile/dantari_female.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 5500000},
{group = "janta_common", chance = 1500000},
{group = "loot_kit_parts", chance = 3000000}
}
}
},
weapons = {"primitive_weapons"},
conversationTemplate = "",
attacks = merge(pikemanmaster,fencermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(janta_herbalist, "janta_herbalist")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/base/poi_all_lair_garbage_large.lua | 2 | 2320 | --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_lair_base_poi_all_lair_garbage_large = object_tangible_lair_base_shared_poi_all_lair_garbage_large:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_base_poi_all_lair_garbage_large, "object/tangible/lair/base/poi_all_lair_garbage_large.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/weapon/wpn_armek_elite.lua | 3 | 2276 | --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_components_weapon_wpn_armek_elite = object_tangible_ship_components_weapon_shared_wpn_armek_elite:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_weapon_wpn_armek_elite, "object/tangible/ship/components/weapon/wpn_armek_elite.iff")
| agpl-3.0 |
DailyShana/ygopro-scripts | c83755611.lua | 3 | 3539 | --輝竜星-ショウフク
function c83755611.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_WYRM),1)
c:EnableReviveLimit()
--mat check
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MATERIAL_CHECK)
e1:SetValue(c83755611.matcheck)
c:RegisterEffect(e1)
--todeck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(83755611,0))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCondition(c83755611.tdcon)
e2:SetTarget(c83755611.tdtg)
e2:SetOperation(c83755611.tdop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(83755611,1))
e3:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1)
e3:SetTarget(c83755611.destg)
e3:SetOperation(c83755611.desop)
c:RegisterEffect(e3)
end
function c83755611.matcheck(e,c)
local ct=c:GetMaterial():Filter(Card.IsRace,nil,RACE_WYRM):GetClassCount(Card.GetOriginalAttribute)
e:SetLabel(ct)
end
function c83755611.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c83755611.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsAbleToDeck() end
local ct=e:GetLabelObject():GetLabel()
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and ct>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function c83755611.tdop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=tg:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
end
function c83755611.filter(c,e,tp)
return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c83755611.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then
if not Duel.IsExistingTarget(c83755611.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) then return false end
if ft<0 then
return false
elseif ft>0 then
return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,0,1,nil)
else
return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_MZONE,0,1,nil)
end
end
local g1=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
if ft>0 then
g1=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,0,1,1,nil)
else
g1=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_MZONE,0,1,1,nil)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g2=Duel.SelectTarget(tp,c83755611.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g2,1,0,0)
end
function c83755611.desop(e,tp,eg,ep,ev,re,r,rp)
local ex,g1=Duel.GetOperationInfo(0,CATEGORY_DESTROY)
local ex,g2=Duel.GetOperationInfo(0,CATEGORY_SPECIAL_SUMMON)
local tc1=g1:GetFirst()
local tc2=g2:GetFirst()
if tc1:IsRelateToEffect(e) and tc2:IsRelateToEffect(e) and Duel.Destroy(tc1,REASON_EFFECT)~=0 then
Duel.SpecialSummon(tc2,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/weapon/melee/2h_sword/crafted_saber/sword_lightsaber_two_handed_s7_gen2.lua | 1 | 6244 | --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_melee_2h_sword_crafted_saber_sword_lightsaber_two_handed_s7_gen2 = object_weapon_melee_2h_sword_crafted_saber_shared_sword_lightsaber_two_handed_s7_gen2: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 = MELEEATTACK,
-- ENERGY, KINETIC, ELECTRICITY, STUN, BLAST, HEAT, COLD, ACID, FORCE, LIGHTSABER
damageType = LIGHTSABER,
-- NONE, LIGHT, MEDIUM, HEAVY
armorPiercing = MEDIUM,
-- 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,
-- jedi_general, combat_meleespecialize_polearmlightsaber, combat_meleespecialize_onehandlightsaber
xpType = "jedi_general",
-- See http://www.ocdsoft.com/files/certifications.xls
certificationsRequired = { "cert_twohandlightsaber_gen2" },
-- See http://www.ocdsoft.com/files/accuracy.xls
creatureAccuracyModifiers = { "twohandlightsaber_accuracy" },
-- See http://www.ocdsoft.com/files/defense.xls
defenderDefenseModifiers = { "melee_defense" },
-- Leave as "dodge" for now, may have additions later
defenderSecondaryDefenseModifiers = { "saber_block" },
-- See http://www.ocdsoft.com/files/speed.xls
speedModifiers = { "twohandlightsaber_speed" },
-- Leave blank for now
damageModifiers = { },
-- The values below are the default values. To be used for blue frog objects primarily
healthAttackCost = 55,
actionAttackCost = 47,
mindAttackCost = 25,
forceCost = 24,
pointBlankRange = 0,
pointBlankAccuracy = 20,
idealRange = 3,
idealAccuracy = 15,
maxRange = 5,
maxRangeAccuracy = 5,
minDamage = 100,
maxDamage = 190,
attackSpeed = 4.8,
woundsRatio = 19,
defenderToughnessModifiers = { "lightsaber_toughness" },
noTrade = 1,
childObjects = {
{templateFile = "object/tangible/inventory/lightsaber_inventory_2.iff", x = 0, z = 0, y = 0, ox = 0, oy = 0, oz = 0, ow = 0, cellid = -1, containmentType = 4}
},
numberExperimentalProperties = {1, 1, 2, 2, 2, 2, 2, 1, 1, 1},
experimentalProperties = {"XX", "XX", "CD", "OQ", "CD", "OQ", "CD", "OQ", "SR", "UT", "CD", "OQ", "OQ", "OQ", "OQ"},
experimentalWeights = {1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "expDamage", "expDamage", "expDamage", "expDamage", "expEffeciency", "expEffeciency", "expEffeciency", "expEffeciency"},
experimentalSubGroupTitles = {"null", "null", "mindamage", "maxdamage", "attackspeed", "woundchance", "forcecost", "attackhealthcost", "attackactioncost", "attackmindcost"},
experimentalMin = {0, 0, 100, 190, 4.8, 13, 28, 55, 47, 25},
experimentalMax = {0, 0, 120, 230, 4.5, 25, 24, 40, 32, 20},
experimentalPrecision = {0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_weapon_melee_2h_sword_crafted_saber_sword_lightsaber_two_handed_s7_gen2, "object/weapon/melee/2h_sword/crafted_saber/sword_lightsaber_two_handed_s7_gen2.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/globals/spells/bluemagic/mandibular_bite.lua | 33 | 1716 | -----------------------------------------
-- Spell: Mandibular Bite
-- Damage varies with TP
-- Spell cost: 38 MP
-- Monster Type: Vermin
-- Spell Type: Physical (Slashing)
-- Blue Magic Points: 2
-- Stat Bonus: INT+1
-- Level: 44
-- Casting Time: 0.5 seconds
-- Recast Time: 19.25 seconds
-- Skillchain property(ies): Induration (can open Impaction, Compression, or Fragmentation)
-- Combos: Plantoid Killer
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local params = {};
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.tpmod = TPMOD_ATTACK;
params.dmgtype = DMGTYPE_SLASH;
params.scattr = SC_INDURATION;
params.numhits = 1;
params.multiplier = 2.0;
params.tp150 = 1.2;
params.tp300 = 1.4;
params.azuretp = 1.5;
params.duppercap = 45; --guesstimated attack % bonuses
params.str_wsc = 0.2;
params.dex_wsc = 0.0;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.2;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.0;
damage = BluePhysicalSpell(caster, target, spell, params);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
return damage;
end; | gpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/item/item_food_cake.lua | 3 | 2192 | --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_item_item_food_cake = object_static_item_shared_item_food_cake:new {
}
ObjectTemplates:addTemplate(object_static_item_item_food_cake, "object/static/item/item_food_cake.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/installation/mining_organic/mining_organic_creature_farm.lua | 1 | 2477 | --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_installation_mining_organic_mining_organic_creature_farm = object_installation_mining_organic_shared_mining_organic_creature_farm:new {
lotSize = 1,
baseMaintenanceRate = 2,
basePowerRate = 5,
width = 3,
length = 3,
objectMenuComponent = "InstallationObjectMenuComponent",
installationType = -1
}
ObjectTemplates:addTemplate(object_installation_mining_organic_mining_organic_creature_farm, "object/installation/mining_organic/mining_organic_creature_farm.iff")
| agpl-3.0 |
lasko2112/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/base/poi_all_lair_thicket_large_evil_fire_small.lua | 2 | 2384 | --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_lair_base_poi_all_lair_thicket_large_evil_fire_small = object_tangible_lair_base_shared_poi_all_lair_thicket_large_evil_fire_small:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_base_poi_all_lair_thicket_large_evil_fire_small, "object/tangible/lair/base/poi_all_lair_thicket_large_evil_fire_small.iff")
| agpl-3.0 |
Whitechaser/darkstar | scripts/zones/Southern_San_dOria/npcs/Corua.lua | 5 | 1717 | -----------------------------------
-- Area: Southern San d'Oria
-- NPC: Corua
-- Only sells when San d'Oria controlls Ronfaure Region
-- !pos -66 2 -11 230
-----------------------------------
package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Southern_San_dOria/TextIDs");
require("scripts/globals/events/harvest_festivals");
require("scripts/globals/settings");
require("scripts/globals/conquest");
require("scripts/globals/quests");
require("scripts/globals/shop");
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == 1) then
if (trade:hasItemQty(532,1) == true and trade:getItemCount() == 1) then
player:messageSpecial(FLYER_REFUSED);
end
else
onHalloweenTrade(player,trade,npc);
end
end;
function onTrigger(player,npc)
local RegionOwner = GetRegionOwner(RONFAURE);
-- player:startEvent(849) - are you the chicks owner
if (RegionOwner ~= NATION_SANDORIA) then
player:showText(npc,CORUA_CLOSED_DIALOG);
else
player:showText(npc,CORUA_OPEN_DIALOG);
local stock =
{
4389, 29, -- San d'Orian Carrot
4431, 69, -- San d'Orian Grape
639, 110, -- Chestnut
610, 55 -- San d'Orian Flour
}
showShop(player,SANDORIA,stock);
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);
end;
| gpl-3.0 |
mhmspm/z | libs/fakeredis.lua | 650 | 40405 | local unpack = table.unpack or unpack
--- Bit operations
local ok,bit
if _VERSION == "Lua 5.3" then
bit = (load [[ return {
band = function(x, y) return x & y end,
bor = function(x, y) return x | y end,
bxor = function(x, y) return x ~ y end,
bnot = function(x) return ~x end,
rshift = function(x, n) return x >> n end,
lshift = function(x, n) return x << n end,
} ]])()
else
ok,bit = pcall(require,"bit")
if not ok then bit = bit32 end
end
assert(type(bit) == "table", "module for bitops not found")
--- default sleep
local default_sleep
do
local ok, mod = pcall(require, "socket")
if ok and type(mod) == "table" then
default_sleep = mod.sleep
else
default_sleep = function(n)
local t0 = os.clock()
while true do
local delta = os.clock() - t0
if (delta < 0) or (delta > n) then break end
end
end
end
end
--- Helpers
local xdefv = function(ktype)
if ktype == "list" then
return {head = 0, tail = 0}
elseif ktype == "zset" then
return {
list = {},
set = {},
}
else return {} end
end
local xgetr = function(self, k, ktype)
if self.data[k] then
assert(
(self.data[k].ktype == ktype),
"ERR Operation against a key holding the wrong kind of value"
)
assert(self.data[k].value)
return self.data[k].value
else return xdefv(ktype) end
end
local xgetw = function(self, k, ktype)
if self.data[k] and self.data[k].value then
assert(
(self.data[k].ktype == ktype),
"ERR Operation against a key holding the wrong kind of value"
)
else
self.data[k] = {ktype = ktype, value = xdefv(ktype)}
end
return self.data[k].value
end
local empty = function(self, k)
local v, t = self.data[k].value, self.data[k].ktype
if t == nil then
return true
elseif t == "string" then
return not v[1]
elseif (t == "hash") or (t == "set") then
for _,_ in pairs(v) do return false end
return true
elseif t == "list" then
return v.head == v.tail
elseif t == "zset" then
if #v.list == 0 then
for _,_ in pairs(v.set) do error("incoherent") end
return true
else
for _,_ in pairs(v.set) do return(false) end
error("incoherent")
end
else error("unsupported") end
end
local cleanup = function(self, k)
if empty(self, k) then self.data[k] = nil end
end
local is_integer = function(x)
return (type(x) == "number") and (math.floor(x) == x)
end
local overflows = function(n)
return (n > 2^53-1) or (n < -2^53+1)
end
local is_bounded_integer = function(x)
return (is_integer(x) and (not overflows(x)))
end
local is_finite_number = function(x)
return (type(x) == "number") and (x > -math.huge) and (x < math.huge)
end
local toint = function(x)
if type(x) == "string" then x = tonumber(x) end
return is_bounded_integer(x) and x or nil
end
local tofloat = function(x)
if type(x) == "number" then return x end
if type(x) ~= "string" then return nil end
local r = tonumber(x)
if r then return r end
if x == "inf" or x == "+inf" then
return math.huge
elseif x == "-inf" then
return -math.huge
else return nil end
end
local tostr = function(x)
if is_bounded_integer(x) then
return string.format("%d", x)
else return tostring(x) end
end
local char_bitcount = function(x)
assert(
(type(x) == "number") and
(math.floor(x) == x) and
(x >= 0) and (x < 256)
)
local n = 0
while x ~= 0 do
x = bit.band(x, x-1)
n = n+1
end
return n
end
local chkarg = function(x)
if type(x) == "number" then x = tostr(x) end
assert(type(x) == "string")
return x
end
local chkargs = function(n, ...)
local arg = {...}
assert(#arg == n)
for i=1,n do arg[i] = chkarg(arg[i]) end
return unpack(arg)
end
local getargs = function(...)
local arg = {...}
local n = #arg; assert(n > 0)
for i=1,n do arg[i] = chkarg(arg[i]) end
return arg
end
local getargs_as_map = function(...)
local arg, r = getargs(...), {}
assert(#arg%2 == 0)
for i=1,#arg,2 do r[arg[i]] = arg[i+1] end
return r
end
local chkargs_wrap = function(f, n)
assert( (type(f) == "function") and (type(n) == "number") )
return function(self, ...) return f(self, chkargs(n, ...)) end
end
local lset_to_list = function(s)
local r = {}
for v,_ in pairs(s) do r[#r+1] = v end
return r
end
local nkeys = function(x)
local r = 0
for _,_ in pairs(x) do r = r + 1 end
return r
end
--- Commands
-- keys
local del = function(self, ...)
local arg = getargs(...)
local r = 0
for i=1,#arg do
if self.data[arg[i]] then r = r + 1 end
self.data[arg[i]] = nil
end
return r
end
local exists = function(self, k)
return not not self.data[k]
end
local keys = function(self, pattern)
assert(type(pattern) == "string")
-- We want to convert the Redis pattern to a Lua pattern.
-- Start by escaping dashes *outside* character classes.
-- We also need to escape percents here.
local t, p, n = {}, 1, #pattern
local p1, p2
while true do
p1, p2 = pattern:find("%[.+%]", p)
if p1 then
if p1 > p then
t[#t+1] = {true, pattern:sub(p, p1-1)}
end
t[#t+1] = {false, pattern:sub(p1, p2)}
p = p2+1
if p > n then break end
else
t[#t+1] = {true, pattern:sub(p, n)}
break
end
end
for i=1,#t do
if t[i][1] then
t[i] = t[i][2]:gsub("[%%%-]", "%%%0")
else t[i] = t[i][2]:gsub("%%", "%%%%") end
end
-- Remaining Lua magic chars are: '^$().[]*+?' ; escape them except '*?[]'
-- Then convert '\' to '%', '*' to '.*' and '?' to '.'. Leave '[]' as is.
-- Wrap in '^$' to enforce bounds.
local lp = "^" .. table.concat(t):gsub("[%^%$%(%)%.%+]", "%%%0")
:gsub("\\", "%%"):gsub("%*", ".*"):gsub("%?", ".") .. "$"
local r = {}
for k,_ in pairs(self.data) do
if k:match(lp) then r[#r+1] = k end
end
return r
end
local _type = function(self, k)
return self.data[k] and self.data[k].ktype or "none"
end
local randomkey = function(self)
local ks = lset_to_list(self.data)
local n = #ks
if n > 0 then
return ks[math.random(1, n)]
else return nil end
end
local rename = function(self, k, k2)
assert((k ~= k2) and self.data[k])
self.data[k2] = self.data[k]
self.data[k] = nil
return true
end
local renamenx = function(self, k, k2)
if self.data[k2] then
return false
else
return rename(self, k, k2)
end
end
-- strings
local getrange, incrby, set
local append = function(self, k, v)
local x = xgetw(self, k, "string")
x[1] = (x[1] or "") .. v
return #x[1]
end
local bitcount = function(self, k, i1, i2)
k = chkarg(k)
local s
if i1 or i2 then
assert(i1 and i2, "ERR syntax error")
s = getrange(self, k, i1, i2)
else
s = xgetr(self, k, "string")[1] or ""
end
local r, bytes = 0,{s:byte(1, -1)}
for i=1,#bytes do
r = r + char_bitcount(bytes[i])
end
return r
end
local bitop = function(self, op, k, ...)
assert(type(op) == "string")
op = op:lower()
assert(
(op == "and") or
(op == "or") or
(op == "xor") or
(op == "not"),
"ERR syntax error"
)
k = chkarg(k)
local arg = {...}
local good_arity = (op == "not") and (#arg == 1) or (#arg > 0)
assert(good_arity, "ERR wrong number of arguments for 'bitop' command")
local l, vals = 0, {}
local s
for i=1,#arg do
s = xgetr(self, arg[i], "string")[1] or ""
if #s > l then l = #s end
vals[i] = s
end
if l == 0 then
del(self, k)
return 0
end
local vector_mt = {__index=function() return 0 end}
for i=1,#vals do
vals[i] = setmetatable({vals[i]:byte(1, -1)}, vector_mt)
end
local r = {}
if op == "not" then
assert(#vals[1] == l)
for i=1,l do
r[i] = bit.band(bit.bnot(vals[1][i]), 0xff)
end
else
local _op = bit["b" .. op]
for i=1,l do
local t = {}
for j=1,#vals do t[j] = vals[j][i] end
r[i] = _op(unpack(t))
end
end
set(self, k, string.char(unpack(r)))
return l
end
local decr = function(self, k)
return incrby(self, k, -1)
end
local decrby = function(self, k, n)
n = toint(n)
assert(n, "ERR value is not an integer or out of range")
return incrby(self, k, -n)
end
local get = function(self, k)
local x = xgetr(self, k, "string")
return x[1]
end
local getbit = function(self, k, offset)
k = chkarg(k)
offset = toint(offset)
assert(
(offset >= 0),
"ERR bit offset is not an integer or out of range"
)
local bitpos = offset % 8 -- starts at 0
local bytepos = (offset - bitpos) / 8 -- starts at 0
local s = xgetr(self, k, "string")[1] or ""
if bytepos >= #s then return 0 end
local char = s:sub(bytepos+1, bytepos+1):byte()
return bit.band(bit.rshift(char, 7-bitpos), 1)
end
getrange = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x = xgetr(self, k, "string")
x = x[1] or ""
if i1 >= 0 then i1 = i1 + 1 end
if i2 >= 0 then i2 = i2 + 1 end
return x:sub(i1, i2)
end
local getset = function(self, k, v)
local r = get(self, k)
set(self, k, v)
return r
end
local incr = function(self, k)
return incrby(self, k, 1)
end
incrby = function(self, k, n)
k, n = chkarg(k), toint(n)
assert(n, "ERR value is not an integer or out of range")
local x = xgetw(self, k, "string")
local i = toint(x[1] or 0)
assert(i, "ERR value is not an integer or out of range")
i = i+n
assert(
(not overflows(i)),
"ERR increment or decrement would overflow"
)
x[1] = tostr(i)
return i
end
local incrbyfloat = function(self, k, n)
k, n = chkarg(k), tofloat(n)
assert(n, "ERR value is not a valid float")
local x = xgetw(self, k, "string")
local i = tofloat(x[1] or 0)
assert(i, "ERR value is not a valid float")
i = i+n
assert(
is_finite_number(i),
"ERR increment would produce NaN or Infinity"
)
x[1] = tostr(i)
return i
end
local mget = function(self, ...)
local arg, r = getargs(...), {}
for i=1,#arg do r[i] = get(self, arg[i]) end
return r
end
local mset = function(self, ...)
local argmap = getargs_as_map(...)
for k,v in pairs(argmap) do set(self, k, v) end
return true
end
local msetnx = function(self, ...)
local argmap = getargs_as_map(...)
for k,_ in pairs(argmap) do
if self.data[k] then return false end
end
for k,v in pairs(argmap) do set(self, k, v) end
return true
end
set = function(self, k, v)
self.data[k] = {ktype = "string", value = {v}}
return true
end
local setbit = function(self, k, offset, b)
k = chkarg(k)
offset, b = toint(offset), toint(b)
assert(
(offset >= 0),
"ERR bit offset is not an integer or out of range"
)
assert(
(b == 0) or (b == 1),
"ERR bit is not an integer or out of range"
)
local bitpos = offset % 8 -- starts at 0
local bytepos = (offset - bitpos) / 8 -- starts at 0
local s = xgetr(self, k, "string")[1] or ""
local pad = {s}
for i=2,bytepos+2-#s do pad[i] = "\0" end
s = table.concat(pad)
assert(#s >= bytepos+1)
local before = s:sub(1, bytepos)
local char = s:sub(bytepos+1, bytepos+1):byte()
local after = s:sub(bytepos+2, -1)
local old = bit.band(bit.rshift(char, 7-bitpos), 1)
if b == 1 then
char = bit.bor(bit.lshift(1, 7-bitpos), char)
else
char = bit.band(bit.bnot(bit.lshift(1, 7-bitpos)), char)
end
local r = before .. string.char(char) .. after
set(self, k, r)
return old
end
local setnx = function(self, k, v)
if self.data[k] then
return false
else
return set(self, k, v)
end
end
local setrange = function(self, k, i, s)
local k, s = chkargs(2, k, s)
i = toint(i)
assert(i and (i >= 0))
local x = xgetw(self, k, "string")
local y = x[1] or ""
local ly, ls = #y, #s
if i > ly then -- zero padding
local t = {}
for i=1, i-ly do t[i] = "\0" end
y = y .. table.concat(t) .. s
else
y = y:sub(1, i) .. s .. y:sub(i+ls+1, ly)
end
x[1] = y
return #y
end
local strlen = function(self, k)
local x = xgetr(self, k, "string")
return x[1] and #x[1] or 0
end
-- hashes
local hdel = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local r = 0
local x = xgetw(self, k, "hash")
for i=1,#arg do
if x[arg[i]] then r = r + 1 end
x[arg[i]] = nil
end
cleanup(self, k)
return r
end
local hget
local hexists = function(self, k, k2)
return not not hget(self, k, k2)
end
hget = function(self, k, k2)
local x = xgetr(self, k, "hash")
return x[k2]
end
local hgetall = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _k,v in pairs(x) do r[_k] = v end
return r
end
local hincrby = function(self, k, k2, n)
k, k2, n = chkarg(k), chkarg(k2), toint(n)
assert(n, "ERR value is not an integer or out of range")
assert(type(n) == "number")
local x = xgetw(self, k, "hash")
local i = toint(x[k2] or 0)
assert(i, "ERR value is not an integer or out of range")
i = i+n
assert(
(not overflows(i)),
"ERR increment or decrement would overflow"
)
x[k2] = tostr(i)
return i
end
local hincrbyfloat = function(self, k, k2, n)
k, k2, n = chkarg(k), chkarg(k2), tofloat(n)
assert(n, "ERR value is not a valid float")
local x = xgetw(self, k, "hash")
local i = tofloat(x[k2] or 0)
assert(i, "ERR value is not a valid float")
i = i+n
assert(
is_finite_number(i),
"ERR increment would produce NaN or Infinity"
)
x[k2] = tostr(i)
return i
end
local hkeys = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _k,_ in pairs(x) do r[#r+1] = _k end
return r
end
local hlen = function(self, k)
local x = xgetr(self, k, "hash")
return nkeys(x)
end
local hmget = function(self, k, k2s)
k = chkarg(k)
assert((type(k2s) == "table"))
local r = {}
local x = xgetr(self, k, "hash")
for i=1,#k2s do r[i] = x[chkarg(k2s[i])] end
return r
end
local hmset = function(self, k, ...)
k = chkarg(k)
local arg = {...}
if type(arg[1]) == "table" then
assert(#arg == 1)
local x = xgetw(self, k, "hash")
for _k,v in pairs(arg[1]) do x[chkarg(_k)] = chkarg(v) end
else
assert(#arg % 2 == 0)
local x = xgetw(self, k, "hash")
local t = getargs(...)
for i=1,#t,2 do x[t[i]] = t[i+1] end
end
return true
end
local hset = function(self, k, k2, v)
local x = xgetw(self, k, "hash")
local r = not x[k2]
x[k2] = v
return r
end
local hsetnx = function(self, k, k2, v)
local x = xgetw(self, k, "hash")
if x[k2] == nil then
x[k2] = v
return true
else
return false
end
end
local hvals = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _,v in pairs(x) do r[#r+1] = v end
return r
end
-- lists (head = left, tail = right)
local _l_real_i = function(x, i)
if i < 0 then
return x.tail+i+1
else
return x.head+i+1
end
end
local _l_len = function(x)
return x.tail - x.head
end
local _block_for = function(self, timeout)
if timeout > 0 then
local sleep = self.sleep or default_sleep
if type(sleep) == "function" then
sleep(timeout)
else
error("sleep function unavailable", 0)
end
else
error("operation would block", 0)
end
end
local rpoplpush
local blpop = function(self, ...)
local arg = {...}
local timeout = toint(arg[#arg])
arg[#arg] = nil
local vs = getargs(...)
local x, l, k, v
for i=1,#vs do
k = vs[i]
x = xgetw(self, k, "list")
l = _l_len(x)
if l > 0 then
v = x[x.head+1]
if l > 1 then
x.head = x.head + 1
x[x.head] = nil
else self.data[k] = nil end
return {k, v}
else self.data[k] = nil end
end
_block_for(self, timeout)
end
local brpop = function(self, ...)
local arg = {...}
local timeout = toint(arg[#arg])
arg[#arg] = nil
local vs = getargs(...)
local x, l, k, v
for i=1,#vs do
k = vs[i]
x = xgetw(self, k, "list")
l = _l_len(x)
if l > 0 then
v = x[x.tail]
if l > 1 then
x[x.tail] = nil
x.tail = x.tail - 1
else self.data[k] = nil end
return {k, v}
else self.data[k] = nil end
end
_block_for(self, timeout)
end
local brpoplpush = function(self, k1, k2, timeout)
k1, k2 = chkargs(2, k1, k2)
timeout = toint(timeout)
if not self.data[k1] then _block_for(self, timeout) end
return rpoplpush(self, k1, k2)
end
local lindex = function(self, k, i)
k = chkarg(k)
i = assert(toint(i))
local x = xgetr(self, k, "list")
return x[_l_real_i(x, i)]
end
local linsert = function(self, k, mode, pivot, v)
mode = mode:lower()
assert((mode == "before") or (mode == "after"))
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
local p = nil
for i=x.head+1, x.tail do
if x[i] == pivot then
p = i
break
end
end
if not p then return -1 end
if mode == "after" then
for i=x.head+1, p do x[i-1] = x[i] end
x.head = x.head - 1
else
for i=x.tail, p, -1 do x[i+1] = x[i] end
x.tail = x.tail + 1
end
x[p] = v
return _l_len(x)
end
local llen = function(self, k)
local x = xgetr(self, k, "list")
return _l_len(x)
end
local lpop = function(self, k)
local x = xgetw(self, k, "list")
local l, r = _l_len(x), x[x.head+1]
if l > 1 then
x.head = x.head + 1
x[x.head] = nil
else self.data[k] = nil end
return r
end
local lpush = function(self, k, ...)
local vs = getargs(...)
local x = xgetw(self, k, "list")
for i=1,#vs do
x[x.head] = vs[i]
x.head = x.head - 1
end
return _l_len(x)
end
local lpushx = function(self, k, v)
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
x[x.head] = v
x.head = x.head - 1
return _l_len(x)
end
local lrange = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x, r = xgetr(self, k, "list"), {}
i1 = math.max(_l_real_i(x, i1), x.head+1)
i2 = math.min(_l_real_i(x, i2), x.tail)
for i=i1,i2 do r[#r+1] = x[i] end
return r
end
local _lrem_i = function(x, p)
for i=p,x.tail do
x[i] = x[i+1]
end
x.tail = x.tail - 1
end
local _lrem_l = function(x, v, s)
assert(v)
if not s then s = x.head+1 end
for i=s,x.tail do
if x[i] == v then
_lrem_i(x, i)
return i
end
end
return false
end
local _lrem_r = function(x, v, s)
assert(v)
if not s then s = x.tail end
for i=s,x.head+1,-1 do
if x[i] == v then
_lrem_i(x, i)
return i
end
end
return false
end
local lrem = function(self, k, count, v)
k, v = chkarg(k), chkarg(v)
count = assert(toint(count))
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
local n, last = 0, nil
local op = (count < 0) and _lrem_r or _lrem_l
local limited = (count ~= 0)
count = math.abs(count)
while true do
last = op(x, v, last)
if last then
n = n+1
if limited then
count = count - 1
if count == 0 then break end
end
else break end
end
return n
end
local lset = function(self, k, i, v)
k, v = chkarg(k), chkarg(v)
i = assert(toint(i))
if not self.data[k] then
error("ERR no such key")
end
local x = xgetw(self, k, "list")
local l = _l_len(x)
if i >= l or i < -l then
error("ERR index out of range")
end
x[_l_real_i(x, i)] = v
return true
end
local ltrim = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x = xgetw(self, k, "list")
i1, i2 = _l_real_i(x, i1), _l_real_i(x, i2)
for i=x.head+1,i1-1 do x[i] = nil end
for i=i2+1,x.tail do x[i] = nil end
x.head = math.max(i1-1, x.head)
x.tail = math.min(i2, x.tail)
assert(
(x[x.head] == nil) and
(x[x.tail+1] == nil)
)
cleanup(self, k)
return true
end
local rpop = function(self, k)
local x = xgetw(self, k, "list")
local l, r = _l_len(x), x[x.tail]
if l > 1 then
x[x.tail] = nil
x.tail = x.tail - 1
else self.data[k] = nil end
return r
end
rpoplpush = function(self, k1, k2)
local v = rpop(self, k1)
if not v then return nil end
lpush(self, k2, v)
return v
end
local rpush = function(self, k, ...)
local vs = getargs(...)
local x = xgetw(self, k, "list")
for i=1,#vs do
x.tail = x.tail + 1
x[x.tail] = vs[i]
end
return _l_len(x)
end
local rpushx = function(self, k, v)
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
x.tail = x.tail + 1
x[x.tail] = v
return _l_len(x)
end
-- sets
local sadd = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "set"), 0
for i=1,#arg do
if not x[arg[i]] then
x[arg[i]] = true
r = r + 1
end
end
return r
end
local scard = function(self, k)
local x = xgetr(self, k, "set")
return nkeys(x)
end
local _sdiff = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x = xgetr(self, k, "set")
local r = {}
for v,_ in pairs(x) do r[v] = true end
for i=1,#arg do
x = xgetr(self, arg[i], "set")
for v,_ in pairs(x) do r[v] = nil end
end
return r
end
local sdiff = function(self, k, ...)
return lset_to_list(_sdiff(self, k, ...))
end
local sdiffstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sdiff(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
local _sinter = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x = xgetr(self, k, "set")
local r = {}
local y
for v,_ in pairs(x) do
r[v] = true
for i=1,#arg do
y = xgetr(self, arg[i], "set")
if not y[v] then r[v] = nil; break end
end
end
return r
end
local sinter = function(self, k, ...)
return lset_to_list(_sinter(self, k, ...))
end
local sinterstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sinter(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
local sismember = function(self, k, v)
local x = xgetr(self, k, "set")
return not not x[v]
end
local smembers = function(self, k)
local x = xgetr(self, k, "set")
return lset_to_list(x)
end
local smove = function(self, k, k2, v)
local x = xgetr(self, k, "set")
if x[v] then
local y = xgetw(self, k2, "set")
x[v] = nil
y[v] = true
return true
else return false end
end
local spop = function(self, k)
local x, r = xgetw(self, k, "set"), nil
local l = lset_to_list(x)
local n = #l
if n > 0 then
r = l[math.random(1, n)]
x[r] = nil
end
cleanup(self, k)
return r
end
local srandmember = function(self, k, count)
k = chkarg(k)
local x = xgetr(self, k, "set")
local l = lset_to_list(x)
local n = #l
if not count then
if n > 0 then
return l[math.random(1, n)]
else return nil end
end
count = toint(count)
if (count == 0) or (n == 0) then return {} end
if count >= n then return l end
local r = {}
if count > 0 then -- distinct elements
for i=0,count-1 do
r[#r+1] = table.remove(l, math.random(1, n-i))
end
else -- allow repetition
for i=1,-count do
r[#r+1] = l[math.random(1, n)]
end
end
return r
end
local srem = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "set"), 0
for i=1,#arg do
if x[arg[i]] then
x[arg[i]] = nil
r = r + 1
end
end
cleanup(self, k)
return r
end
local _sunion = function(self, ...)
local arg = getargs(...)
local r = {}
local x
for i=1,#arg do
x = xgetr(self, arg[i], "set")
for v,_ in pairs(x) do r[v] = true end
end
return r
end
local sunion = function(self, k, ...)
return lset_to_list(_sunion(self, k, ...))
end
local sunionstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sunion(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
-- zsets
local _z_p_mt = {
__eq = function(a, b)
if a.v == b.v then
assert(a.s == b.s)
return true
else return false end
end,
__lt = function(a, b)
if a.s == b.s then
return (a.v < b.v)
else
return (a.s < b.s)
end
end,
}
local _z_pair = function(s, v)
assert(
(type(s) == "number") and
(type(v) == "string")
)
local r = {s = s, v = v}
return setmetatable(r, _z_p_mt)
end
local _z_pairs = function(...)
local arg = {...}
assert((#arg > 0) and (#arg % 2 == 0))
local ps = {}
for i=1,#arg,2 do
ps[#ps+1] = _z_pair(
assert(tofloat(arg[i])),
chkarg(arg[i+1])
)
end
return ps
end
local _z_insert = function(x, ix, p)
assert(
(type(x) == "table") and
(type(ix) == "number") and
(type(p) == "table")
)
local l = x.list
table.insert(l, ix, p)
for i=ix+1,#l do
x.set[l[i].v] = x.set[l[i].v] + 1
end
x.set[p.v] = ix
end
local _z_remove = function(x, v)
if not x.set[v] then return false end
local l, ix = x.list, x.set[v]
assert(l[ix].v == v)
table.remove(l, ix)
for i=ix,#l do
x.set[l[i].v] = x.set[l[i].v] - 1
end
x.set[v] = nil
return true
end
local _z_remove_range = function(x, i1, i2)
local l = x.list
i2 = i2 or i1
assert(
(i1 > 0) and
(i2 >= i1) and
(i2 <= #l)
)
local ix, n = i1, i2-i1+1
for i=1,n do
x.set[l[ix].v] = nil
table.remove(l, ix)
end
for i=ix,#l do
x.set[l[i].v] = x.set[l[i].v] - n
end
return n
end
local _z_update = function(x, p)
local l = x.list
local found = _z_remove(x, p.v)
local ix = nil
for i=1,#l do
if l[i] > p then
ix = i; break
end
end
if not ix then ix = #l+1 end
_z_insert(x, ix, p)
return found
end
local _z_coherence = function(x)
local l, s = x.list, x.set
local found, n = {}, 0
for val,pos in pairs(s) do
if found[pos] then return false end
found[pos] = true
n = n + 1
if not (l[pos] and (l[pos].v == val)) then
return false
end
end
if #l ~= n then return false end
for i=1, n-1 do
if l[i].s > l[i+1].s then return false end
end
return true
end
local _z_normrange = function(l, i1, i2)
i1, i2 = assert(toint(i1)), assert(toint(i2))
if i1 < 0 then i1 = #l+i1 end
if i2 < 0 then i2 = #l+i2 end
i1, i2 = math.max(i1+1, 1), i2+1
if (i2 < i1) or (i1 > #l) then return nil end
i2 = math.min(i2, #l)
return i1, i2
end
local _zrbs_opts = function(...)
local arg = {...}
if #arg == 0 then return {} end
local ix, opts = 1, {}
while type(arg[ix]) == "string" do
if arg[ix] == "withscores" then
opts.withscores = true
ix = ix + 1
elseif arg[ix] == "limit" then
opts.limit = {
offset = assert(toint(arg[ix+1])),
count = assert(toint(arg[ix+2])),
}
ix = ix + 3
else error("input") end
end
if type(arg[ix]) == "table" then
local _o = arg[ix]
opts.withscores = opts.withscores or _o.withscores
if _o.limit then
opts.limit = {
offset = assert(toint(_o.limit.offset or _o.limit[1])),
count = assert(toint(_o.limit.count or _o.limit[2])),
}
end
ix = ix + 1
end
assert(arg[ix] == nil)
if opts.limit then
assert(
(opts.limit.count >= 0) and
(opts.limit.offset >= 0)
)
end
return opts
end
local _z_store_params = function(dest, numkeys, ...)
dest = chkarg(dest)
numkeys = assert(toint(numkeys))
assert(numkeys > 0)
local arg = {...}
assert(#arg >= numkeys)
local ks = {}
for i=1, numkeys do ks[i] = chkarg(arg[i]) end
local ix, opts = numkeys+1,{}
while type(arg[ix]) == "string" do
if arg[ix] == "weights" then
opts.weights = {}
ix = ix + 1
for i=1, numkeys do
opts.weights[i] = assert(toint(arg[ix]))
ix = ix + 1
end
elseif arg[ix] == "aggregate" then
opts.aggregate = assert(chkarg(arg[ix+1]))
ix = ix + 2
else error("input") end
end
if type(arg[ix]) == "table" then
local _o = arg[ix]
opts.weights = opts.weights or _o.weights
opts.aggregate = opts.aggregate or _o.aggregate
ix = ix + 1
end
assert(arg[ix] == nil)
if opts.aggregate then
assert(
(opts.aggregate == "sum") or
(opts.aggregate == "min") or
(opts.aggregate == "max")
)
else opts.aggregate = "sum" end
if opts.weights then
assert(#opts.weights == numkeys)
for i=1,#opts.weights do
assert(type(opts.weights[i]) == "number")
end
else
opts.weights = {}
for i=1, numkeys do opts.weights[i] = 1 end
end
opts.keys = ks
opts.dest = dest
return opts
end
local _zrbs_limits = function(x, s1, s2, descending)
local s1_incl, s2_incl = true, true
if s1:sub(1, 1) == "(" then
s1, s1_incl = s1:sub(2, -1), false
end
s1 = assert(tofloat(s1))
if s2:sub(1, 1) == "(" then
s2, s2_incl = s2:sub(2, -1), false
end
s2 = assert(tofloat(s2))
if descending then
s1, s2 = s2, s1
s1_incl, s2_incl = s2_incl, s1_incl
end
if s2 < s1 then return nil end
local l = x.list
local i1, i2
local fst, lst = l[1].s, l[#l].s
if (fst > s2) or ((not s2_incl) and (fst == s2)) then return nil end
if (lst < s1) or ((not s1_incl) and (lst == s1)) then return nil end
if (fst > s1) or (s1_incl and (fst == s1)) then i1 = 1 end
if (lst < s2) or (s2_incl and (lst == s2)) then i2 = #l end
for i=1,#l do
if (i1 and i2) then break end
if (not i1) then
if l[i].s > s1 then i1 = i end
if s1_incl and l[i].s == s1 then i1 = i end
end
if (not i2) then
if l[i].s > s2 then i2 = i-1 end
if (not s2_incl) and l[i].s == s2 then i2 = i-1 end
end
end
assert(i1 and i2)
if descending then
return #l-i2, #l-i1
else
return i1-1, i2-1
end
end
local dbg_zcoherence = function(self, k)
local x = xgetr(self, k, "zset")
return _z_coherence(x)
end
local zadd = function(self, k, ...)
k = chkarg(k)
local ps = _z_pairs(...)
local x = xgetw(self, k, "zset")
local n = 0
for i=1,#ps do
if not _z_update(x, ps[i]) then n = n+1 end
end
return n
end
local zcard = function(self, k)
local x = xgetr(self, k, "zset")
return #x.list
end
local zcount = function(self, k, s1, s2)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, false)
if not (i1 and i2) then return 0 end
assert(i2 >= i1)
return i2 - i1 + 1
end
local zincrby = function(self, k, n, v)
k,v = chkargs(2, k, v)
n = assert(tofloat(n))
local x = xgetw(self, k, "zset")
local p = x.list[x.set[v]]
local s = p and (p.s + n) or n
_z_update(x, _z_pair(s, v))
return s
end
local zinterstore = function(self, ...)
local params = _z_store_params(...)
local x = xdefv("zset")
local aggregate
if params.aggregate == "sum" then
aggregate = function(x, y) return x+y end
elseif params.aggregate == "min" then
aggregate = math.min
elseif params.aggregate == "max" then
aggregate = math.max
else error() end
local y = xgetr(self, params.keys[1], "zset")
local p1, p2
for j=1,#y.list do
p1 = _z_pair(y.list[j].s, y.list[j].v)
_z_update(x, p1)
end
for i=2,#params.keys do
y = xgetr(self, params.keys[i], "zset")
local to_remove, to_update = {}, {}
for j=1,#x.list do
p1 = x.list[j]
if y.set[p1.v] then
p2 = _z_pair(
aggregate(
p1.s,
params.weights[i] * y.list[y.set[p1.v]].s
),
p1.v
)
to_update[#to_update+1] = p2
else
to_remove[#to_remove+1] = p1.v
end
end
for j=1,#to_remove do _z_remove(x, to_remove[j]) end
for j=1,#to_update do _z_update(x, to_update[j]) end
end
local r = #x.list
if r > 0 then
self.data[params.dest] = {ktype = "zset", value = x}
end
return r
end
local _zranger = function(descending)
return function(self, k, i1, i2, opts)
k = chkarg(k)
local withscores = false
if type(opts) == "table" then
withscores = opts.withscores
elseif type(opts) == "string" then
assert(opts:lower() == "withscores")
withscores = true
else assert(opts == nil) end
local x = xgetr(self, k, "zset")
local l = x.list
i1, i2 = _z_normrange(l, i1, i2)
if not i1 then return {} end
local inc = 1
if descending then
i1 = #l - i1 + 1
i2 = #l - i2 + 1
inc = -1
end
local r = {}
if withscores then
for i=i1, i2, inc do r[#r+1] = {l[i].v, l[i].s} end
else
for i=i1, i2, inc do r[#r+1] = l[i].v end
end
return r
end
end
local zrange = _zranger(false)
local zrevrange = _zranger(true)
local _zrangerbyscore = function(descending)
return function(self, k, s1, s2, ...)
k, s1, s2 = chkargs(3, k, s1, s2)
local opts = _zrbs_opts(...)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, descending)
if not (i1 and i2) then return {} end
if opts.limit then
if opts.limit.count == 0 then return {} end
i1 = i1 + opts.limit.offset
if i1 > i2 then return {} end
i2 = math.min(i2, i1+opts.limit.count-1)
end
if descending then
return zrevrange(self, k, i1, i2, opts)
else
return zrange(self, k, i1, i2, opts)
end
end
end
local zrangebyscore = _zrangerbyscore(false)
local zrevrangebyscore = _zrangerbyscore(true)
local zrank = function(self, k, v)
local x = xgetr(self, k, "zset")
local r = x.set[v]
if r then
return r-1
else return nil end
end
local zrem = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "zset"), 0
for i=1,#arg do
if _z_remove(x, arg[i]) then r = r + 1 end
end
cleanup(self, k)
return r
end
local zremrangebyrank = function(self, k, i1, i2)
k = chkarg(k)
local x = xgetw(self, k, "zset")
i1, i2 = _z_normrange(x.list, i1, i2)
if not i1 then
cleanup(self, k)
return 0
end
local n = _z_remove_range(x, i1, i2)
cleanup(self, k)
return n
end
local zremrangebyscore = function(self, k, s1, s2)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, false)
if not (i1 and i2) then return 0 end
assert(i2 >= i1)
return zremrangebyrank(self, k, i1, i2)
end
local zrevrank = function(self, k, v)
local x = xgetr(self, k, "zset")
local r = x.set[v]
if r then
return #x.list-r
else return nil end
end
local zscore = function(self, k, v)
local x = xgetr(self, k, "zset")
local p = x.list[x.set[v]]
if p then
return p.s
else return nil end
end
local zunionstore = function(self, ...)
local params = _z_store_params(...)
local x = xdefv("zset")
local default_score, aggregate
if params.aggregate == "sum" then
default_score = 0
aggregate = function(x, y) return x+y end
elseif params.aggregate == "min" then
default_score = math.huge
aggregate = math.min
elseif params.aggregate == "max" then
default_score = -math.huge
aggregate = math.max
else error() end
local y, p1, p2
for i=1,#params.keys do
y = xgetr(self, params.keys[i], "zset")
for j=1,#y.list do
p1 = y.list[j]
p2 = _z_pair(
aggregate(
params.weights[i] * p1.s,
x.set[p1.v] and x.list[x.set[p1.v]].s or default_score
),
p1.v
)
_z_update(x, p2)
end
end
local r = #x.list
if r > 0 then
self.data[params.dest] = {ktype = "zset", value = x}
end
return r
end
-- connection
local echo = function(self, v)
return v
end
local ping = function(self)
return true
end
-- server
local flushdb = function(self)
self.data = {}
return true
end
--- Class
local methods = {
-- keys
del = del, -- (...) -> #removed
exists = chkargs_wrap(exists, 1), -- (k) -> exists?
keys = keys, -- (pattern) -> list of keys
["type"] = chkargs_wrap(_type, 1), -- (k) -> [string|list|set|zset|hash|none]
randomkey = randomkey, -- () -> [k|nil]
rename = chkargs_wrap(rename, 2), -- (k,k2) -> true
renamenx = chkargs_wrap(renamenx, 2), -- (k,k2) -> ! existed? k2
-- strings
append = chkargs_wrap(append, 2), -- (k,v) -> #new
bitcount = bitcount, -- (k,[start,end]) -> n
bitop = bitop, -- ([and|or|xor|not],k,...)
decr = chkargs_wrap(decr, 1), -- (k) -> new
decrby = decrby, -- (k,n) -> new
get = chkargs_wrap(get, 1), -- (k) -> [v|nil]
getbit = getbit, -- (k,offset) -> b
getrange = getrange, -- (k,start,end) -> string
getset = chkargs_wrap(getset, 2), -- (k,v) -> [oldv|nil]
incr = chkargs_wrap(incr, 1), -- (k) -> new
incrby = incrby, -- (k,n) -> new
incrbyfloat = incrbyfloat, -- (k,n) -> new
mget = mget, -- (k1,...) -> {v1,...}
mset = mset, -- (k1,v1,...) -> true
msetnx = msetnx, -- (k1,v1,...) -> worked? (i.e. !existed? any k)
set = chkargs_wrap(set, 2), -- (k,v) -> true
setbit = setbit, -- (k,offset,b) -> old
setnx = chkargs_wrap(setnx, 2), -- (k,v) -> worked? (i.e. !existed?)
setrange = setrange, -- (k,offset,val) -> #new
strlen = chkargs_wrap(strlen, 1), -- (k) -> [#v|0]
-- hashes
hdel = hdel, -- (k,sk1,...) -> #removed
hexists = chkargs_wrap(hexists, 2), -- (k,sk) -> exists?
hget = chkargs_wrap(hget,2), -- (k,sk) -> v
hgetall = chkargs_wrap(hgetall, 1), -- (k) -> map
hincrby = hincrby, -- (k,sk,n) -> new
hincrbyfloat = hincrbyfloat, -- (k,sk,n) -> new
hkeys = chkargs_wrap(hkeys, 1), -- (k) -> keys
hlen = chkargs_wrap(hlen, 1), -- (k) -> [#sk|0]
hmget = hmget, -- (k,{sk1,...}) -> {v1,...}
hmset = hmset, -- (k,{sk1=v1,...}) -> true
hset = chkargs_wrap(hset, 3), -- (k,sk1,v1) -> !existed?
hsetnx = chkargs_wrap(hsetnx, 3), -- (k,sk1,v1) -> worked? (i.e. !existed?)
hvals = chkargs_wrap(hvals, 1), -- (k) -> values
-- lists
blpop = blpop, -- (k1,...) -> k,v
brpop = brpop, -- (k1,...) -> k,v
brpoplpush = brpoplpush, -- (k1,k2,timeout) -> v
lindex = lindex, -- (k,i) -> v
linsert = chkargs_wrap(linsert, 4), -- (k,mode,pivot,v) -> #list (after)
llen = chkargs_wrap(llen, 1), -- (k) -> #list
lpop = chkargs_wrap(lpop, 1), -- (k) -> v
lpush = lpush, -- (k,v1,...) -> #list (after)
lpushx = chkargs_wrap(lpushx, 2), -- (k,v) -> #list (after)
lrange = lrange, -- (k,start,stop) -> list
lrem = lrem, -- (k,count,v) -> #removed
lset = lset, -- (k,i,v) -> true
ltrim = ltrim, -- (k,start,stop) -> true
rpop = chkargs_wrap(rpop, 1), -- (k) -> v
rpoplpush = chkargs_wrap(rpoplpush, 2), -- (k1,k2) -> v
rpush = rpush, -- (k,v1,...) -> #list (after)
rpushx = chkargs_wrap(rpushx, 2), -- (k,v) -> #list (after)
-- sets
sadd = sadd, -- (k,v1,...) -> #added
scard = chkargs_wrap(scard, 1), -- (k) -> [n|0]
sdiff = sdiff, -- (k1,...) -> set (of elements in k1 & not in any of ...)
sdiffstore = sdiffstore, -- (k0,k1,...) -> #set at k0
sinter = sinter, -- (k1,...) -> set
sinterstore = sinterstore, -- (k0,k1,...) -> #set at k0
sismember = chkargs_wrap(sismember, 2), -- (k,v) -> member?
smembers = chkargs_wrap(smembers, 1), -- (k) -> set
smove = chkargs_wrap(smove, 3), -- (k1,k2,v) -> moved? (i.e. !member? k1)
spop = chkargs_wrap(spop, 1), -- (k) -> [v|nil]
srandmember = srandmember, -- (k,[count]) -> v|[v1,v2,...]
srem = srem, -- (k,v1,...) -> #removed
sunion = sunion, -- (k1,...) -> set
sunionstore = sunionstore, -- (k0,k1,...) -> #set at k0
-- zsets
zadd = zadd, -- (k,score,member,[score,member,...])
zcard = chkargs_wrap(zcard, 1), -- (k) -> n
zcount = chkargs_wrap(zcount, 3), -- (k,min,max) -> count
zincrby = zincrby, -- (k,score,v) -> score
zinterstore = zinterstore, -- (k,numkeys,k1,...,[opts]) -> card
zrange = zrange, -- (k,start,stop,[opts]) -> depends on opts
zrangebyscore = zrangebyscore, -- (k,min,max,[opts]) -> depends on opts
zrank = chkargs_wrap(zrank, 2), -- (k,v) -> rank
zrem = zrem, -- (k,v1,...) -> #removed
zremrangebyrank = zremrangebyrank, -- (k,start,stop) -> #removed
zremrangebyscore = chkargs_wrap(zremrangebyscore, 3), -- (k,min,max) -> #removed
zrevrange = zrevrange, -- (k,start,stop,[opts]) -> depends on opts
zrevrangebyscore = zrevrangebyscore, -- (k,min,max,[opts]) -> depends on opts
zrevrank = chkargs_wrap(zrevrank, 2), -- (k,v) -> rank
zscore = chkargs_wrap(zscore, 2), -- (k,v) -> score
zunionstore = zunionstore, -- (k,numkeys,k1,...,[opts]) -> card
-- connection
echo = chkargs_wrap(echo, 1), -- (v) -> v
ping = ping, -- () -> true
-- server
flushall = flushdb, -- () -> true
flushdb = flushdb, -- () -> true
-- debug
dbg_zcoherence = dbg_zcoherence,
}
local new = function()
local r = {data = {}}
return setmetatable(r,{__index = methods})
end
return {
new = new,
}
| gpl-3.0 |
Cyumus/NutScript | gamemode/core/libs/sh_class.lua | 4 | 3264 | nut.class = nut.class or {}
nut.class.list = {}
local charMeta = nut.meta.character
-- Register classes from a directory.
function nut.class.loadFromDir(directory)
-- Search the directory for .lua files.
for k, v in ipairs(file.Find(directory.."/*.lua", "LUA")) do
-- Get the name without the "sh_" prefix and ".lua" suffix.
local niceName = v:sub(4, -5)
-- Determine a numeric identifier for this class.
local index = #nut.class.list + 1
local halt
for k, v in ipairs(nut.class.list) do
if (v.uniqueID == niceName) then
halt = true
end
end
if (halt == true) then
continue
end
-- Set up a global table so the file has access to the class table.
CLASS = {index = index, uniqueID = niceName}
-- Define some default variables.
CLASS.name = "Unknown"
CLASS.desc = "No description available."
CLASS.limit = 0
-- For future use with plugins.
if (PLUGIN) then
CLASS.plugin = PLUGIN.uniqueID
end
-- Include the file so data can be modified.
nut.util.include(directory.."/"..v, "shared")
-- Why have a class without a faction?
if (!CLASS.faction or !team.Valid(CLASS.faction)) then
ErrorNoHalt("Class '"..niceName.."' does not have a valid faction!\n")
CLASS = nil
continue
end
-- Allow classes to be joinable by default.
if (!CLASS.onCanBe) then
CLASS.onCanBe = function(client)
return true
end
end
-- Add the class to the list of classes.
nut.class.list[index] = CLASS
-- Remove the global variable to prevent conflict.
CLASS = nil
end
end
-- Determines if a player is allowed to join a specific class.
function nut.class.canBe(client, class)
-- Get the class table by its numeric identifier.
local info = nut.class.list[class]
-- See if the class exists.
if (!info) then
return false, "no info"
end
-- If the player's faction matches the class's faction.
if (client:Team() != info.faction) then
return false, "not correct team"
end
if (client:getChar():getClass() == class) then
return false, "same class request"
end
if (info.limit > 0) then
if (#nut.class.getPlayers(info.index) >= info.limit) then
return false, "class is full"
end
end
-- See if the class allows the player to join it.
return info:onCanBe(client)
end
function nut.class.getPlayers(class)
local players = {}
for k, v in ipairs(player.GetAll()) do
local char = v:getChar()
if (char and char:getClass() == class) then
table.insert(players, v)
end
end
return players
end
function charMeta:joinClass(class)
if (!class) then
self:kickClass()
return
end
local oldClass = self:getClass()
local client = self:getPlayer()
if (nut.class.canBe(client, class)) then
self:setClass(class)
hook.Run("OnPlayerJoinClass", client, class, oldClass)
return true
else
return false
end
end
function charMeta:kickClass()
self:setClass()
local client = self:getPlayer()
hook.Run("OnPlayerJoinClass", client, class)
end
function GM:OnPlayerJoinClass(client, class, oldClass)
local info = nut.class.list[class]
local info2 = nut.class.list[oldClass]
if (info.onSet) then
info:onSet(client)
end
if (info2 and info2.onLeave) then
info2:onLeave(client)
end
netstream.Start(nil, "classUpdate", client)
end | mit |
Mashape/kong | kong/plugins/basic-auth/migrations/000_base_basic_auth.lua | 1 | 1104 | return {
postgres = {
up = [[
CREATE TABLE IF NOT EXISTS "basicauth_credentials" (
"id" UUID PRIMARY KEY,
"created_at" TIMESTAMP WITHOUT TIME ZONE DEFAULT (CURRENT_TIMESTAMP(0) AT TIME ZONE 'UTC'),
"consumer_id" UUID REFERENCES "consumers" ("id") ON DELETE CASCADE,
"username" TEXT UNIQUE,
"password" TEXT
);
DO $$
BEGIN
CREATE INDEX IF NOT EXISTS "basicauth_consumer_id_idx" ON "basicauth_credentials" ("consumer_id");
EXCEPTION WHEN UNDEFINED_COLUMN THEN
-- Do nothing, accept existing state
END$$;
]],
},
cassandra = {
up = [[
CREATE TABLE IF NOT EXISTS basicauth_credentials (
id uuid PRIMARY KEY,
created_at timestamp,
consumer_id uuid,
password text,
username text
);
CREATE INDEX IF NOT EXISTS ON basicauth_credentials(username);
CREATE INDEX IF NOT EXISTS ON basicauth_credentials(consumer_id);
]],
},
}
| apache-2.0 |
UnfortunateFruit/darkstar | scripts/globals/weaponskills/sickle_moon.lua | 30 | 1658 | -----------------------------------
-- Sickle Moon
-- Great Sword weapon skill
-- Skill level: 200
-- Delivers a two-hit attack. Damage varies with TP.
-- Modifiers: STR:40% ; AGI:40%
-- 100%TP 200%TP 300%TP
-- 1.5 2 2.75
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 2;
--ftp damage mods (for Damage Varies with TP; lines are calculated in the function
params.ftp100 = 1.5; params.ftp200 = 2; params.ftp300 = 2.75;
--wscs are in % so 0.2=20%
params.str_wsc = 0.2; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.2; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
--critical mods, again in % (ONLY USE FOR CRITICAL HIT VARIES WITH TP)
params.crit100 = 0.0; params.crit200=0.0; params.crit300=0.0;
params.canCrit = false;
--accuracy mods (ONLY USE FOR ACCURACY VARIES WITH TP) , should be the acc at those %s NOT the penalty values. Leave 0 if acc doesnt vary with tp.
params.acc100 = 0; params.acc200=0; params.acc300=0;
--attack multiplier (only some WSes use this, this varies the actual ratio value, see Tachi: Kasha) 1 is default.
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 0.4; params.agi_wsc = 0.4;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
Mashape/kong | kong/plugins/hmac-auth/schema.lua | 2 | 1036 | local typedefs = require "kong.db.schema.typedefs"
local ALGORITHMS = {
"hmac-sha1",
"hmac-sha256",
"hmac-sha384",
"hmac-sha512",
}
return {
name = "hmac-auth",
fields = {
{ consumer = typedefs.no_consumer },
{ run_on = typedefs.run_on_first },
{ protocols = typedefs.protocols_http },
{ config = {
type = "record",
fields = {
{ hide_credentials = { type = "boolean", default = false }, },
{ clock_skew = { type = "number", default = 300, gt = 0 }, },
{ anonymous = { type = "string", uuid = true, legacy = true }, },
{ validate_request_body = { type = "boolean", default = false }, },
{ enforce_headers = {
type = "array",
elements = { type = "string" },
default = {},
}, },
{ algorithms = {
type = "array",
elements = { type = "string", one_of = ALGORITHMS },
default = ALGORITHMS,
}, },
},
},
},
},
}
| apache-2.0 |
makinacorpus/imapfilter | src/message.lua | 3 | 3902 | -- The Message class that represents messages inside a mailbox.
Message = {}
Message._mt = {}
setmetatable(Message, Message._mt)
Message._mt.__call = function (self, account, mailbox, uid)
local object = {}
object._type = 'message'
object._account = account
object._mailbox = mailbox
object._uid = uid
object._string = account._account.username .. '@' ..
account._account.server .. '/' .. mailbox._mailbox ..
'[' .. uid .. ']'
object._structure = nil
object._header = nil
object._body = nil
object._fields = {}
object._parts = {}
object._size = nil
object._date = nil
for key, value in pairs(Message) do
if type(value) == 'function' then object[key] = value end
end
object._mt = {}
setmetatable(object, object._mt)
return object
end
function Message.fetch_structure(self)
local r = self._mailbox._fetch_structure(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the structure of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_header(self)
local r = self._mailbox._fetch_header(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the header of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_body(self)
local r = self._mailbox._fetch_body(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the body of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_message(self)
local r = self._mailbox._fetch_message(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched message ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_field(self, field)
local r = self._mailbox._fetch_fields(self._mailbox, { field },
{ self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched field "' .. field .. '" of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_fields(self, fields)
local r = self._mailbox._fetch_fields(self._mailbox, fields, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched some of the fields of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_part(self, part)
local r = self._mailbox._fetch_parts(self._mailbox, { part }, self._uid)
if not r or not r[part] then return end
if options.info == true then
print('Fetched part "' .. part .. '" of ' .. self._string .. '.')
end
return r[part]
end
function Message.fetch_size(self)
local r = self._mailbox._fetch_size(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the size of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_date(self)
local r = self._mailbox._fetch_date(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the date of ' .. self._string .. '.')
end
return r[self._uid]
end
function Message.fetch_flags(self)
local r = self._mailbox._fetch_flags(self._mailbox, { self._uid })
if not r or not r[self._uid] then return end
if options.info == true then
print('Fetched the flags of ' .. self._string .. '.')
end
return r[self._uid]
end
Message._mt.__index = function () end
Message._mt.__newindex = function () end
| mit |
nesstea/darkstar | scripts/zones/Windurst_Waters_[S]/Zone.lua | 17 | 1278 | -----------------------------------
--
-- Zone: Windurst_Waters_[S] (94)
--
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Windurst_Waters_[S]/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-39.996,-7.64,235,64);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
UnfortunateFruit/darkstar | scripts/globals/mobskills/Tebbad_Wing.lua | 7 | 1239 | ---------------------------------------------
-- Tebbad Wing
--
-- Description: A hot wind deals Fire damage to enemies within a very wide area of effect. Additional effect: Plague
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes shadows
-- Range: 30' radial.
-- Notes: Used only by Tiamat, Smok and Ildebrann
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if (mob:hasStatusEffect(EFFECT_MIGHTY_STRIKES)) then
return 1;
elseif (mob:AnimationSub() == 1) then
return 1;
elseif(target:isBehind(mob, 48) == true) then
return 1;
end
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local typeEffect = EFFECT_PLAGUE;
MobStatusEffectMove(mob, target, typeEffect, 10, 0, 120);
local dmgmod = 1;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*5,ELE_FIRE,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_FIRE,MOBPARAM_WIPE_SHADOWS);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
hamed9898/maxbot | plugins/wiki.lua | 735 | 4364 | -- http://git.io/vUA4M
local socket = require "socket"
local JSON = require "cjson"
local wikiusage = {
"!wiki [text]: Read extract from default Wikipedia (EN)",
"!wiki(lang) [text]: Read extract from 'lang' Wikipedia. Example: !wikies hola",
"!wiki search [text]: Search articles on default Wikipedia (EN)",
"!wiki(lang) search [text]: Search articles on 'lang' Wikipedia. Example: !wikies search hola",
}
local Wikipedia = {
-- http://meta.wikimedia.org/wiki/List_of_Wikipedias
wiki_server = "https://%s.wikipedia.org",
wiki_path = "/w/api.php",
wiki_load_params = {
action = "query",
prop = "extracts",
format = "json",
exchars = 300,
exsectionformat = "plain",
explaintext = "",
redirects = ""
},
wiki_search_params = {
action = "query",
list = "search",
srlimit = 20,
format = "json",
},
default_lang = "en",
}
function Wikipedia:getWikiServer(lang)
return string.format(self.wiki_server, lang or self.default_lang)
end
--[[
-- return decoded JSON table from Wikipedia
--]]
function Wikipedia:loadPage(text, lang, intro, plain, is_search)
local request, sink = {}, {}
local query = ""
local parsed
if is_search then
for k,v in pairs(self.wiki_search_params) do
query = query .. k .. '=' .. v .. '&'
end
parsed = URL.parse(self:getWikiServer(lang))
parsed.path = self.wiki_path
parsed.query = query .. "srsearch=" .. URL.escape(text)
else
self.wiki_load_params.explaintext = plain and "" or nil
for k,v in pairs(self.wiki_load_params) do
query = query .. k .. '=' .. v .. '&'
end
parsed = URL.parse(self:getWikiServer(lang))
parsed.path = self.wiki_path
parsed.query = query .. "titles=" .. URL.escape(text)
end
-- HTTP request
request['url'] = URL.build(parsed)
print(request['url'])
request['method'] = 'GET'
request['sink'] = ltn12.sink.table(sink)
local httpRequest = parsed.scheme == 'http' and http.request or https.request
local code, headers, status = socket.skip(1, httpRequest(request))
if not headers or not sink then
return nil
end
local content = table.concat(sink)
if content ~= "" then
local ok, result = pcall(JSON.decode, content)
if ok and result then
return result
else
return nil
end
else
return nil
end
end
-- extract intro passage in wiki page
function Wikipedia:wikintro(text, lang)
local result = self:loadPage(text, lang, true, true)
if result and result.query then
local query = result.query
if query and query.normalized then
text = query.normalized[1].to or text
end
local page = query.pages[next(query.pages)]
if page and page.extract then
return text..": "..page.extract
else
local text = "Extract not found for "..text
text = text..'\n'..table.concat(wikiusage, '\n')
return text
end
else
return "Sorry an error happened"
end
end
-- search for term in wiki
function Wikipedia:wikisearch(text, lang)
local result = self:loadPage(text, lang, true, true, true)
if result and result.query then
local titles = ""
for i,item in pairs(result.query.search) do
titles = titles .. "\n" .. item["title"]
end
titles = titles ~= "" and titles or "No results found"
return titles
else
return "Sorry, an error occurred"
end
end
local function run(msg, matches)
-- TODO: Remember language (i18 on future version)
-- TODO: Support for non Wikipedias but Mediawikis
local search, term, lang
if matches[1] == "search" then
search = true
term = matches[2]
lang = nil
elseif matches[2] == "search" then
search = true
term = matches[3]
lang = matches[1]
else
term = matches[2]
lang = matches[1]
end
if not term then
term = lang
lang = nil
end
if term == "" then
local text = "Usage:\n"
text = text..table.concat(wikiusage, '\n')
return text
end
local result
if search then
result = Wikipedia:wikisearch(term, lang)
else
-- TODO: Show the link
result = Wikipedia:wikintro(term, lang)
end
return result
end
return {
description = "Searches Wikipedia and send results",
usage = wikiusage,
patterns = {
"^![Ww]iki(%w+) (search) (.+)$",
"^![Ww]iki (search) ?(.*)$",
"^![Ww]iki(%w+) (.+)$",
"^![Ww]iki ?(.*)$"
},
run = run
}
| gpl-2.0 |
nesstea/darkstar | scripts/zones/Northern_San_dOria/npcs/Miageau.lua | 12 | 2605 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Miageau
-- Type: Quest Giver NPC
-- @zone: 231
-- @pos 115 0 108
--
-- Starts and Finishes: Waters of Cheval
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then
if (trade:hasItemQty(532,1) == true and trade:getItemCount() == 1) then
player:messageSpecial(FLYER_REFUSED);
end
end
if (player:getQuestStatus(SANDORIA,WATER_OF_THE_CHEVAL) == QUEST_ACCEPTED) then
if (trade:getItemCount() == 1 and trade:hasItemQty(603, 1)) then
player:startEvent(0x0203);
end;
end;
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
watersOfTheCheval = player:getQuestStatus(SANDORIA,WATER_OF_THE_CHEVAL);
if (watersOfTheCheval == QUEST_ACCEPTED) then
if (player:hasItem(602) == true) then
player:startEvent(0x0200);
else
player:startEvent(0x0207);
end;
elseif (watersOfTheCheval == QUEST_AVAILABLE) then
player:startEvent(0x01f8);
else
player:startEvent(0x0205);
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 == 0x0203) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 13183);
else
player:tradeComplete();
player:addItem(13183);
player:messageSpecial(ITEM_OBTAINED, 13183);
player:addFame(SANDORIA,30);
player:addTitle(THE_PURE_ONE);
player:completeQuest(SANDORIA,WATER_OF_THE_CHEVAL);
end;
elseif (csid == 0x01f8) then
player:addQuest(SANDORIA, WATER_OF_THE_CHEVAL);
end;
end;
| gpl-3.0 |
akdor1154/awesome | lib/wibox/layout/ratio.lua | 1 | 11366 | ---------------------------------------------------------------------------
--- A layout filling all the available space. Each widget is assigned a
-- ratio (percentage) of the total space. Multiple methods are available to
-- ajust this ratio.
-- @author Emmanuel Lepage Vallee
-- @copyright 2016 Emmanuel Lepage Vallee
-- @release @AWESOME_VERSION@
-- @classmod wibox.layout.ratio
---------------------------------------------------------------------------
local base = require("wibox.widget.base" )
local flex = require("wibox.layout.flex" )
local table = table
local pairs = pairs
local floor = math.floor
local util = require("awful.util")
local ratio = {}
--- Set a widget at a specific index, replace the current one
-- @tparam number index A widget or a widget index
-- @param widget2 The widget to take the place of the first one
-- @treturn boolean If the operation is successful
-- @name set
-- @class function
--- Replace the first instance of `widget` in the layout with `widget2`
-- @param widget The widget to replace
-- @param widget2 The widget to replace `widget` with
-- @tparam[opt=false] boolean recursive Digg in all compatible layouts to find the widget.
-- @treturn boolean If the operation is successful
-- @name replace_widget
-- @class function
--- Swap 2 widgets in a layout
-- @tparam number index1 The first widget index
-- @tparam number index2 The second widget index
-- @treturn boolean If the operation is successful
-- @name swap
-- @class function
--- Swap 2 widgets in a layout
-- If widget1 is present multiple time, only the first instance is swapped
-- @param widget1 The first widget
-- @param widget2 The second widget
-- @tparam[opt=false] boolean recursive Digg in all compatible layouts to find the widget.
-- @treturn boolean If the operation is successful
-- @name swap_widgets
-- @class function
--- Get all children of this layout.
-- @param layout The layout you are modifying.
-- @return a list of all widgets
-- @name get_children
-- @class function
--- Fit the ratio layout into the given space
-- @param layout The layout you are modifying.
-- @param context The context in which we are fit.
-- @tparam number orig_width The available width.
-- @tparam number orig_height The available height.
-- @name fit
-- @class function
--- Reset a ratio layout. This removes all widgets from the layout.
-- @param layout The layout you are modifying.
-- @name reset
-- @class function
-- Compute the sum of all ratio (ideally, it should be 1)
local function gen_sum(self, i_s, i_e)
local sum, new_w = 0,0
for i = i_s or 1, i_e or #self.widgets do
if self._ratios[i] then
sum = sum + self._ratios[i]
else
new_w = new_w + 1
end
end
return sum, new_w
end
-- The ratios are expressed as percentages. For this to work, the sum of all
-- ratio must be 1. This function attempt to ajust them. Space can be taken
-- from or added to a ratio when widgets are being added or removed. If a
-- specific ratio must be enforced for a widget, it has to be done with the
-- `ajust_ratio` method after each insertion or deletion
local function normalize(self)
local count = #self.widgets
if count == 0 then return end
-- Instead of adding "if" everywhere, just handle this common case
if count == 1 then
self._ratios = { 1 }
return
end
local sum, new_w = gen_sum(self)
local old_count = #self.widgets - new_w
local to_add = (sum == 0) and 1 or (sum / old_count)
-- Make sure all widgets have a ratio
for i=1, #self.widgets do
if not self._ratios[i] then
self._ratios[i] = to_add
end
end
sum = sum + to_add*new_w
local delta, new_sum = (1 - sum) / count,0
-- Increase or decrease each ratio so it the sum become 1
for i=1, #self.widgets do
self._ratios[i] = self._ratios[i] + delta
new_sum = new_sum + self._ratios[i]
end
-- Floating points is not an exact science, but it should still be close
-- to 1.00.
assert(new_sum > 0.99 and new_sum < 1.01)
end
function ratio:layout(_, width, height)
local result = {}
local pos,spacing = 0, self._spacing
for k, v in ipairs(self.widgets) do
local space
local x, y, w, h
if self.dir == "y" then
space = height * self._ratios[k]
x, y = 0, util.round(pos)
w, h = width, floor(space)
else
space = width * self._ratios[k]
x, y = util.round(pos), 0
w, h = floor(space), height
end
table.insert(result, base.place_widget_at(v, x, y, w, h))
pos = pos + space + spacing
-- Make sure all widgets fit in the layout, if they aren't, something
-- went wrong
if (self.dir == "y" and util.round(pos) >= height) or
(self.dir ~= "y" and util.round(pos) >= width) then
break
end
end
return result
end
--- Increase the ratio of "widget"
-- If the increment produce an invalid ratio (not between 0 and 1), the method
-- do nothing.
-- @tparam number index The widget index to change
-- @tparam number increment An floating point value between -1 and 1 where the
-- end result is within 0 and 1
function ratio:inc_ratio(index, increment)
if #self.widgets == 1 or (not index) or (not self._ratios[index])
or increment < -1 or increment > 1 then
return
end
assert(self._ratios[index])
self:set_ratio(index, self._ratios[index] + increment)
end
--- Increment the ratio of the first instance of `widget`
-- If the increment produce an invalid ratio (not between 0 and 1), the method
-- do nothing.
-- @param widget The widget to ajust
-- @tparam number increment An floating point value between -1 and 1 where the
-- end result is within 0 and 1
function ratio:inc_widget_ratio(widget, increment)
if not widget or not increment then return end
local index = self:index(widget)
self:inc_ratio(index, increment)
end
--- Set the ratio of the widget at position `index`
-- @tparam number index The index of the widget to change
-- @tparam number percent An floating point value between 0 and 1
function ratio:set_ratio(index, percent)
if not percent or #self.widgets == 1 or not index or not self.widgets[index]
or percent < 0 or percent > 1 then
return
end
local old = self._ratios[index]
-- Remove what has to be cleared from all widget
local delta = ( (percent-old) / (#self.widgets-1) )
for k in pairs(self.widgets) do
self._ratios[k] = self._ratios[k] - delta
end
-- Set the new ratio
self._ratios[index] = percent
-- As some widgets may now have a slightly negative ratio, normalize again
normalize(self)
self:emit_signal("widget::layout_changed")
end
--- Get the ratio at `index`.
-- @tparam number index The widget index to query
-- @treturn number The index (between 0 and 1)
function ratio:get_ratio(index)
if not index then return end
return self._ratios[index]
end
--- Set the ratio of `widget` to `percent`.
-- @tparam widget widget The widget to ajust.
-- @tparam number percent A floating point value between 0 and 1.
function ratio:set_widget_ratio(widget, percent)
local index = self:index(widget)
self:set_ratio(index, percent)
end
--- Update all widgets to match a set of a ratio.
-- The sum of before, itself and after must be 1 or nothing will be done
-- @tparam number index The index of the widget to change
-- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget
function ratio:ajust_ratio(index, before, itself, after)
if not self.widgets[index] or not before or not itself or not after then
return
end
local sum = before + itself + after
-- As documented, it is the caller job to come up with valid numbers
if math.min(before, itself, after) < 0 then return end
if sum > 1.01 or sum < -0.99 then return end
-- Compute the before and after offset to be applied to each widgets
local before_count, after_count = index-1, #self.widgets - index
local b, a = gen_sum(self, 1, index-1), gen_sum(self, index+1)
local db, da = (before - b)/before_count, (after - a)/after_count
-- Apply the new ratio
self._ratios[index] = itself
-- Equality split the delta among widgets before and after
for i = 1, index -1 do
self._ratios[i] = self._ratios[i] + db
end
for i = index+1, #self.widgets do
self._ratios[i] = self._ratios[i] + da
end
-- Remove potential negative ratio
normalize(self)
self:emit_signal("widget::layout_changed")
end
--- Update all widgets to match a set of a ratio
-- @param widget The widget to ajust
-- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget
function ratio:ajust_widget_ratio(widget, before, itself, after)
local index = self:index(widget)
self:ajust_ratio(index, before, itself, after)
end
--- Add some widgets to the given fixed layout
-- @tparam widget ... Widgets that should be added (must at least be one)
function ratio:add(...)
-- No table.pack in Lua 5.1 :-(
local args = { n=select('#', ...), ... }
assert(args.n > 0, "need at least one widget to add")
for i=1, args.n do
base.check_widget(args[i])
table.insert(self.widgets, args[i])
end
normalize(self)
self:emit_signal("widget::layout_changed")
end
--- Remove a widget from the layout
-- @tparam number index The widget index to remove
-- @treturn boolean index If the operation is successful
function ratio:remove(index)
if not index or not self.widgets[index] then return false end
table.remove(self._ratios, index)
table.remove(self.widgets, index)
normalize(self)
self:emit_signal("widget::layout_changed")
return true
end
--- Insert a new widget in the layout at position `index`
-- @tparam number index The position
-- @param widget The widget
function ratio:insert(index, widget)
if not index or index < 1 or index > #self.widgets + 1 then return false end
base.check_widget(widget)
table.insert(self.widgets, index, widget)
normalize(self)
self:emit_signal("widget::layout_changed")
end
local function get_layout(dir, widget1, ...)
local ret = flex[dir](widget1, ...)
util.table.crush(ret, ratio)
ret.fill_space = nil
ret._ratios = {}
return ret
end
--- Returns a new horizontal ratio layout. A ratio layout shares the available space
-- equally among all widgets. Widgets can be added via :add(widget).
-- @tparam widget ... Widgets that should be added to the layout.
function ratio.horizontal(...)
return get_layout("horizontal", ...)
end
--- Returns a new vertical ratio layout. A ratio layout shares the available space
-- equally among all widgets. Widgets can be added via :add(widget).
-- @tparam widget ... Widgets that should be added to the layout.
function ratio.vertical(...)
return get_layout("vertical", ...)
end
return ratio
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.