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 |
|---|---|---|---|---|---|
Sajaki/MizusRaidTracker | libs/LibDialog-1.0/LibStub/LibStub.lua | 10 | 2251 | -- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
-- LibStub is hereby placed in the Public Domain
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
-- Check to see is this version of the stub is obsolete
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
-- LibStub:NewLibrary(major, minor)
-- major (string) - the major version of the library
-- minor (string or number ) - the minor version of the library
--
-- returns nil if a newer or same version of the lib is already present
-- returns empty library object or old library object if upgrade is needed
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
-- LibStub:GetLibrary(major, [silent])
-- major (string) - the major version of the library
-- silent (boolean) - if true, library is optional, silently return nil if its not found
--
-- throws an error if the library can not be found (except silent is set)
-- returns the library object if found
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
-- LibStub:IterateLibraries()
--
-- Returns an iterator for the currently registered libraries
function LibStub:IterateLibraries()
return pairs(self.libs)
end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
| gpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/vehicle/military/objects.lua | 3 | 15583 | --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_draft_schematic_vehicle_military_shared_military_a = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_military_a.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 2402380717,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_military_a, "object/draft_schematic/vehicle/military/shared_military_a.iff")
object_draft_schematic_vehicle_military_shared_military_b = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_military_b.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 1411826490,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_military_b, "object/draft_schematic/vehicle/military/shared_military_b.iff")
object_draft_schematic_vehicle_military_shared_military_c = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_military_c.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 489399479,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_military_c, "object/draft_schematic/vehicle/military/shared_military_c.iff")
object_draft_schematic_vehicle_military_shared_military_d = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_military_d.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 3871903651,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_military_d, "object/draft_schematic/vehicle/military/shared_military_d.iff")
object_draft_schematic_vehicle_military_shared_military_e = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_military_e.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 2948982830,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_military_e, "object/draft_schematic/vehicle/military/shared_military_e.iff")
object_draft_schematic_vehicle_military_shared_starship_impl_tie_a = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_starship_impl_tie_a.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 4100515758,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_starship_impl_tie_a, "object/draft_schematic/vehicle/military/shared_starship_impl_tie_a.iff")
object_draft_schematic_vehicle_military_shared_starship_impl_tie_b = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_starship_impl_tie_b.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 796872505,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_starship_impl_tie_b, "object/draft_schematic/vehicle/military/shared_starship_impl_tie_b.iff")
object_draft_schematic_vehicle_military_shared_starship_rebel_xwing_a = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_starship_rebel_xwing_a.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 1330578969,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_starship_rebel_xwing_a, "object/draft_schematic/vehicle/military/shared_starship_rebel_xwing_a.iff")
object_draft_schematic_vehicle_military_shared_starship_rebel_xwing_b = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/vehicle/military/shared_starship_rebel_xwing_b.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff",
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 2049,
collisionActionBlockFlags = 0,
collisionActionFlags = 0,
collisionActionPassFlags = 0,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 0,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 0,
detailedDescription = "string_id_table",
gameObjectType = 2049,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "string_id_table",
onlyVisibleInTools = 0,
portalLayoutFilename = "",
scale = 0,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
surfaceType = 0,
totalCellNumber = 0,
clientObjectCRC = 2488839822,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_draft_schematic_vehicle_military_shared_starship_rebel_xwing_b, "object/draft_schematic/vehicle/military/shared_starship_rebel_xwing_b.iff")
| agpl-3.0 |
REZATITAN/update | plugins/welcome.lua | 190 | 3526 | local add_user_cfg = load_from_file('data/add_user_cfg.lua')
local function template_add_user(base, to_username, from_username, chat_name, chat_id)
base = base or ''
to_username = '@' .. (to_username or '')
from_username = '@' .. (from_username or '')
chat_name = string.gsub(chat_name, '_', ' ') or ''
chat_id = "chat#id" .. (chat_id or '')
if to_username == "@" then
to_username = ''
end
if from_username == "@" then
from_username = ''
end
base = string.gsub(base, "{to_username}", to_username)
base = string.gsub(base, "{from_username}", from_username)
base = string.gsub(base, "{chat_name}", chat_name)
base = string.gsub(base, "{chat_id}", chat_id)
return base
end
function chat_new_user_link(msg)
local pattern = add_user_cfg.initial_chat_msg
local to_username = msg.from.username
local from_username = 'link (@' .. (msg.action.link_issuer.username or '') .. ')'
local chat_name = msg.to.print_name
local chat_id = msg.to.id
pattern = template_add_user(pattern, to_username, from_username, chat_name, chat_id)
if pattern ~= '' then
local receiver = get_receiver(msg)
send_msg(receiver, pattern, ok_cb, false)
end
end
function chat_new_user(msg)
local pattern = add_user_cfg.initial_chat_msg
local to_username = msg.action.user.username
local from_username = msg.from.username
local chat_name = msg.to.print_name
local chat_id = msg.to.id
pattern = template_add_user(pattern, to_username, from_username, chat_name, chat_id)
if pattern ~= '' then
local receiver = get_receiver(msg)
send_msg(receiver, pattern, ok_cb, false)
end
end
local function description_rules(msg, nama)
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
local about = ""
local rules = ""
if data[tostring(msg.to.id)]["description"] then
about = data[tostring(msg.to.id)]["description"]
about = "\nAbout :\n"..about.."\n"
end
if data[tostring(msg.to.id)]["rules"] then
rules = data[tostring(msg.to.id)]["rules"]
rules = "\nRules :\n"..rules.."\n"
end
local sambutan = "Hi "..nama.."\nWelcome to '"..string.gsub(msg.to.print_name, "_", " ").."'\nYou can use /help for see bot commands\n"
local text = sambutan..about..rules.."\n"
local receiver = get_receiver(msg)
send_large_msg(receiver, text, ok_cb, false)
end
end
local function run(msg, matches)
if not msg.service then
return "Are you trying to troll me?"
end
--vardump(msg)
if matches[1] == "chat_add_user" then
if not msg.action.user.username then
nama = string.gsub(msg.action.user.print_name, "_", " ")
else
nama = "@"..msg.action.user.username
end
chat_new_user(msg)
description_rules(msg, nama)
elseif matches[1] == "chat_add_user_link" then
if not msg.from.username then
nama = string.gsub(msg.from.print_name, "_", " ")
else
nama = "@"..msg.from.username
end
chat_new_user_link(msg)
description_rules(msg, nama)
elseif matches[1] == "chat_del_user" then
local bye_name = msg.action.user.first_name
return 'Bye '..bye_name
end
end
return {
description = "Welcoming Message",
usage = "send message to new member",
patterns = {
"^!!tgservice (chat_add_user)$",
"^!!tgservice (chat_add_user_link)$",
"^!!tgservice (chat_del_user)$",
},
run = run
}
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/loot/groups/npc/meatlump_common.lua | 4 | 1379 | meatlump_common = {
description = "",
minimumLevel = 0,
maximumLevel = 0,
lootItems = {
{itemTemplate = "cheap_copper_battery", weight = 1000000},
{groupTemplate = "wearables_common", weight = 1000000},
{itemTemplate = "droid_body_schematic", weight = 800000},
{itemTemplate = "radio_schematic", weight = 800000},
{itemTemplate = "streetlamp_schematic", weight = 800000},
{itemTemplate = "skill_buff_carbine_accuracy", weight = 400000},
{itemTemplate = "skill_buff_carbine_speed", weight = 400000},
{itemTemplate = "skill_buff_heavy_weapon_accuracy", weight = 400000},
{itemTemplate = "skill_buff_heavy_weapon_speed", weight = 400000},
{itemTemplate = "skill_buff_melee_accuracy", weight = 400000},
{itemTemplate = "skill_buff_melee_defense", weight = 400000},
{itemTemplate = "skill_buff_pistol_accuracy", weight = 400000},
{itemTemplate = "skill_buff_pistol_speed", weight = 400000},
{itemTemplate = "skill_buff_ranged_accuracy", weight = 400000},
{itemTemplate = "skill_buff_ranged_defense", weight = 400000},
{itemTemplate = "skill_buff_thrown_accuracy", weight = 400000},
{itemTemplate = "skill_buff_thrown_speed", weight = 400000},
{itemTemplate = "skill_buff_twohandmelee_accuracy", weight = 400000},
{itemTemplate = "skill_buff_twohandmelee_speed", weight = 400000}
}
}
addLootGroupTemplate("meatlump_common", meatlump_common)
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/space/armor/durasteel_plating.lua | 1 | 3459 | --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_armor_durasteel_plating = object_draft_schematic_space_armor_shared_durasteel_plating:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Mark II Durasteel Plating",
craftingToolTab = 131072, -- (See DraftSchematicObjectTemplate.h)
complexity = 25,
size = 1,
xpType = "shipwright",
xp = 125,
assemblySkill = "chassis_assembly",
experimentingSkill = "chassis_experimentation",
customizationSkill = "medicine_customization",
disableFactoryRun = true,
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"ship_skin", "steel_frame", "armor_upgrade", "absorptive_layer", "plate_lubricant"},
ingredientSlotType = {0, 0, 3, 0, 0},
resourceTypes = {"aluminum", "steel", "object/tangible/ship/crafted/armor/shared_base_armor_subcomponent_mk2.iff", "ore", "petrochem_inert"},
resourceQuantities = {125, 125, 1, 125, 125},
contribution = {100, 100, 100, 100, 100},
targetTemplate = "object/tangible/ship/crafted/armor/durasteel_plating.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_space_armor_durasteel_plating, "object/draft_schematic/space/armor/durasteel_plating.iff")
| agpl-3.0 |
sprunk/Zero-K | LuaUI/Widgets/gui_chili_selections_and_cursortip.lua | 1 | 74263 |
function widget:GetInfo()
return {
name = "Chili Selections & CursorTip v2",
desc = "Chili Selection Window and Cursor Tooltip remade.",
author = "GoogleFrog", -- (CarRepairer and jK orginal)
date = "9 February 2017",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = true,
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
VFS.Include("LuaRules/Configs/customcmds.h.lua")
include("Widgets/COFCTools/ExportUtilities.lua")
local spGetMouseState = Spring.GetMouseState
local spTraceScreenRay = Spring.TraceScreenRay
local spGetUnitHealth = Spring.GetUnitHealth
local spGetUnitIsStunned = Spring.GetUnitIsStunned
local spGetGameRulesParam = Spring.GetGameRulesParam
local spGetModKeyState = Spring.GetModKeyState
local spSelectUnitArray = Spring.SelectUnitArray
local spGetUnitWeaponState = Spring.GetUnitWeaponState
local spGetUnitCurrentBuildPower = Spring.GetUnitCurrentBuildPower
local spGetUnitRulesParam = Spring.GetUnitRulesParam
local spScaledGetMouseState = Spring.ScaledGetMouseState
local GetUnitBuildSpeed = Spring.Utilities.GetUnitBuildSpeed
local GetHumanName = Spring.Utilities.GetHumanName
local GetUnitCost = Spring.Utilities.GetUnitCost
local GetDescription = Spring.Utilities.GetDescription
local strFormat = string.format
local green = '\255\1\255\1'
local red = '\255\255\1\1'
local cyan = '\255\1\255\255'
local white = '\255\255\255\255'
local yellow = '\255\255\255\1'
local selectionTooltip = "\n" .. green .. WG.Translate("interface", "lmb") .. ": " .. WG.Translate("interface", "select") .. "\n" ..
green .. WG.Translate("interface", "rmb") .. ": " .. WG.Translate("interface", "deselect") .. "\n" ..
green .. WG.Translate("interface", "shift") .. "+" .. WG.Translate("interface", "lmb") .. ": " .. WG.Translate("interface", "select_type") .. "\n" ..
green .. WG.Translate("interface", "shift") .. "+" .. WG.Translate("interface", "rmb") .. ": " .. WG.Translate("interface", "deselect_type") .. "\n" ..
green .. WG.Translate("interface", "mmb") .. ": " .. WG.Translate("interface", "go_to")
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local Chili
local screen0
local screenWidth, screenHeight = Spring.GetWindowGeometry()
local tooltipWindow
local selectionWindow
local ICON_SIZE = 20
local BAR_SIZE = 22
local BAR_FONT = 13
local BAR_SPACING = 24
local IMAGE_FONT = 10
local DESC_FONT = 10
local TOOLTIP_FONT = 12
local NAME_FONT = 14
local LEFT_SPACE = 24
local LEFT_LABEL_HEIGHT = 16
local SEL_BUTTON_SHORTENING = 2
local LEFT_WIDTH = 55
local PIC_HEIGHT = LEFT_WIDTH*4/5
local RIGHT_WIDTH = 235
local GROUP_STATS_WIDTH = 150
local IMAGE = {
HEALTH = 'LuaUI/images/commands/bold/health.png',
SHIELD = 'LuaUI/Images/commands/Bold/guard.png',
BUILD = 'LuaUI/Images/commands/Bold/buildsmall.png',
COST = 'LuaUI/images/costIcon.png',
TIME = 'LuaUI/images/clock.png',
METAL = 'LuaUI/images/metalplus.png',
ENERGY = 'LuaUI/images/energyplus.png',
METAL_RECLAIM = 'LuaUI/images/ibeamReclaim.png',
ENERGY_RECLAIM = 'LuaUI/images/energyReclaim.png',
}
local CURSOR_ERASE = 'eraser'
local CURSOR_POINT = 'flagtext'
local CURSOR_DRAW = 'pencil'
local CURSOR_ERASE_NAME = "map_erase"
local CURSOR_POINT_NAME = "map_point"
local CURSOR_DRAW_NAME = "map_draw"
local NO_TOOLTIP = "NONE"
local iconTypesPath = LUAUI_DIRNAME .. "Configs/icontypes.lua"
local icontypes = VFS.FileExists(iconTypesPath) and VFS.Include(iconTypesPath)
local _, iconFormat = VFS.Include(LUAUI_DIRNAME .. "Configs/chilitip_conf.lua" , nil, VFS.RAW_FIRST)
local UNIT_BURST_DAMAGES = VFS.Include(LUAUI_DIRNAME .. "Configs/burst_damages.lua" , nil, VFS.RAW_FIRST)
local terraformGeneralTip =
green.. 'Click&Drag'..white..': Free draw terraform. \n'..
green.. 'Alt+Click&Drag'..white..': Box terraform. \n'..
green.. 'Alt+Ctrl+Click&Drag'..white..': Hollow box terraform. \n'..
green.. 'Ctrl+Click on unit' ..white..': Terraform around unit. \n'..
'\n'
local terraCmdTip = {
[CMD_RAMP] =
yellow..'[Ramp between two points]\n'..
'1: ' .. green.. 'Click&Drag'..white..' from start to end. \n' ..
'2: ' .. green.. 'Click' ..white..' again to set width. \n'..
'\n'..
yellow..'[Ramp with raised end]\n'..
'1: ' .. green.. 'Click'..white..' at start. \n'..
'2: ' .. green.. 'Click&Drag'..white..' at end to set height. \n'..
'3: ' .. green.. 'Click' ..white..' again to set width. \n'..
'\n'..
yellow..'[Modifiers]\n'..
'- Hold '.. green..'Ctrl or Alt'..white..' and '.. green..'drag' ..white..' in Step 1 to set start height. \n'..
'- Hold '.. green..'Alt'..white..' to snap height or gradient. \n'..
'- Press '..green.. 'Space'..white..' to cycle raise/lower. \n'..
'\n'..
yellow..'[Wireframe indicator colors]\n'..
green.. 'Green'..white..': All units can traverse. \n'..
green.. 'Yellow'..white..': Vehicles cannot traverse. \n'..
green.. 'Red'..white..': Only all-terrain units can traverse.',
[CMD_LEVEL] = terraformGeneralTip ..
yellow..'[During Terraform Draw]\n'..
green.. 'Ctrl'..white..': Draw straight line segment. \n'..
'\n'..
yellow..'[After Terraform Draw]\n'..
green.. 'Alt'..white..': Snap to starting height / below water level (prevent ships) / below water level (prevent land units). \n'..
green.. 'Ctrl'..white..': Hold and point at terrain to level to height pointed at.\n'..
'\n'..
yellow..'[Any Time]\n'..
green.. 'Space'..white..': Cycle through only raise/lower',
[CMD_RAISE] = terraformGeneralTip ..
yellow..'[During Terraform Draw]\n'..
green.. 'Ctrl'..white..': Draw straight line segment. \n'..
'\n'..
yellow..'[After Terraform Draw]\n'..
green.. 'Alt'..white..': Snap to steps of 15 height. \n'..
green.. 'Ctrl'..white..': Snap to 0 height.',
[CMD_SMOOTH] = terraformGeneralTip ..
yellow..'[During Terraform Draw]\n'..
green.. 'Ctrl'..white..': Draw straight line segment.',
[CMD_RESTORE] = terraformGeneralTip ..
yellow..'[Any Time]\n'..
green.. 'Space'..white..': Limit to only raise/lower',
}
local DRAWING_TOOLTIP =
green.. 'Left click'..white..': Draw on map. \n' ..
green.. 'Right click'..white..': Erase. \n' ..
green.. 'Middle click'..white..': Place marker. \n' ..
green.. 'Double click'..white..': Place marker with label.'
local reloadBarColor = {013, 245, 243, 1}
local fullHealthBarColor = {0, 255, 0, 1}
-- TODO, autogenerate
local econStructureDefs = {
[UnitDefNames["staticmex"].id] = {cost = 75, mex = true},
[UnitDefNames["energywind"].id] = {cost = 35, income = 1.25, isWind = true},
[UnitDefNames["energysolar"].id] = {cost = 70, income = 2},
[UnitDefNames["energygeo"].id] = {cost = 500, income = 25},
[UnitDefNames["energyheavygeo"].id] = {cost = 1000, income = 75},
[UnitDefNames["energyfusion"].id] = {cost = 1000, income = 35},
[UnitDefNames["energysingu"].id] = {cost = 4000, income = 225},
}
local dynamicTooltipDefs = {
[UnitDefNames["terraunit"].id] = true,
[UnitDefNames["energypylon"].id] = true,
[UnitDefNames["zenith"].id] = true,
}
for unitDefID,_ in pairs(econStructureDefs) do
dynamicTooltipDefs[unitDefID] = true
end
local filterUnitDefIDs = {
[UnitDefNames["terraunit"].id] = true
}
local tidalHeight
local tidalStrength
local windMin
local windMax
local windGroundMin
local windGroundSlope
local windMinBound
local GAIA_TEAM = Spring.GetGaiaTeamID()
local UPDATE_FREQUENCY = 0.2
local isCommander = {}
for i = 1, #UnitDefs do
local ud = UnitDefs[i]
if ud.customParams.level or ud.customParams.dynamic_comm then
isCommander[i] = true
end
end
local manualFireTimeDefs = {}
for unitDefID = 1, #UnitDefs do
local ud = UnitDefs[unitDefID]
local unitWeapon = (ud and ud.weapons and ud.weapons[3])
--Note: weapon no.3 is by ZK convention is usually used for user controlled weapon
if (unitWeapon ~= nil) and WeaponDefs[unitWeapon.weaponDef].manualFire then
manualFireTimeDefs[unitDefID] = WeaponDefs[unitWeapon.weaponDef].reload
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Variables
local drawHotkeyBytes = {}
local drawHotkeyBytesCount = 0
local oldMouseX, oldMouseY = 0, 0
local stillCursorTime = 0
local global_totalBuildPower = 0
local sameObjectID
local sameObjectIDTime = 0
local selectedUnitsList = {}
local commanderManualFireReload = {}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Settings
options_path = 'Settings/HUD Panels/Tooltip'
local selPath = 'Settings/HUD Panels/Selected Units Panel'
options_order = {
--tooltip
'tooltip_delay', 'independant_world_tooltip_delay',
'show_for_units', 'show_for_wreckage', 'show_for_unreclaimable', 'showdrawtooltip','showterratooltip',
'showDrawTools', 'tooltip_opacity',
--selected units
'selection_opacity', 'allowclickthrough', 'groupbehaviour', 'showgroupinfo','uniticon_size', 'manualWeaponReloadBar',
'fancySkinning', 'leftPadding',
}
local showManualFire = true
options = {
tooltip_delay = {
name = 'Tooltip display delay (0 - 4s)',
desc = 'Determines how long you can leave the mouse idle until the tooltip is displayed.',
type = 'number',
min=0,max=4,step=0.05,
value = 0,
},
independant_world_tooltip_delay = { -- Done
name = 'Unit and Feature tooltip delay (0 - 4s)',
--desc = 'Determines how long you can leave the mouse over a unit or feature until the tooltip is displayed.',
type = 'number',
min=0,max=4,step=0.05,
value = 0.2,
},
show_for_units = {
name = "Show Tooltip for Units",
type = 'bool',
value = true,
noHotkey = true,
desc = 'Show the tooltip for units.',
},
show_for_wreckage = {
name = "Show Tooltip for Wreckage",
type = 'bool',
value = true,
noHotkey = true,
desc = 'Show the tooltip for wreckage and map features.',
},
show_for_unreclaimable = {
name = "Show Tooltip for Unreclaimables",
type = 'bool',
advanced = true,
value = false,
noHotkey = true,
desc = 'Show the tooltip for unreclaimable features.',
},
showdrawtooltip = {
name = "Show Map-drawing Tooltip",
type = 'bool',
value = true,
noHotkey = true,
desc = 'Show map-drawing tooltip when holding down the tilde (~).',
},
showterratooltip = {
name = "Show Terraform Tooltip",
type = 'bool',
value = true,
noHotkey = true,
desc = 'Show terraform tooltip when performing terraform commands.',
},
showDrawTools = {
name = "Show Drawing Tools When Drawing",
type = 'bool',
value = true,
noHotkey = true,
desc = 'Show pencil or eraser when drawing or erasing.'
},
tooltip_opacity = {
name = "Opacity",
type = "number",
value = 0.8, min = 0, max = 1, step = 0.01,
update_on_the_fly = true,
OnChange = function(self)
if not tooltipWindow then
return
end
tooltipWindow.SetOpacity(self.value)
end,
},
selection_opacity = {
name = "Opacity",
type = "number",
value = 0.8, min = 0, max = 1, step = 0.01,
update_on_the_fly = true,
OnChange = function(self)
if selectionWindow then
selectionWindow.SetOpacity(self.value)
end
end,
path = selPath,
},
allowclickthrough = {
name='Allow clicking through', type='bool', value=true,
path = selPath,
OnChange = function(self)
if selectionWindow then
selectionWindow.SetAllowClickThrough(self.value)
end
end,
},
groupbehaviour = {name='Unit Grouping Behaviour', type='radioButton',
value='overflow',
items = {
{key = 'overflow', name = 'On window overflow'},
{key = 'multitype', name = 'With multiple unit types'},
{key = 'always', name = 'Always'},
},
path = selPath,
},
showgroupinfo = {name='Show Group Info', type='bool', value=true,
path = selPath,
OnChange = function(self)
if selectionWindow then
selectionWindow.SetGroupInfoVisible(self.value)
end
end,
},
--unitCommand = {
-- name="Show Unit's Command",
-- type='bool',
-- value= false,
-- noHotkey = true,
-- desc = "Display current command on unit's icon (only for ungrouped unit selection)",
-- path = selPath,
--},
uniticon_size = {
name = 'Icon size on selection list',
--desc = 'Determines how small the icon in selection list need to be.',
type = 'number',
min=30,max=100,step=1,
value = 57,
path = selPath,
OnChange = function(self)
if selectionWindow then
selectionWindow.SetSelectionIconSize(self.value)
end
end,
},
manualWeaponReloadBar = {
name="Show Unit's Special Weapon Status",
type='bool',
value= true,
noHotkey = true,
desc = "Show reload progress for weapon that use manual trigger (only for ungrouped unit selection)",
path = selPath,
OnChange = function(self)
showManualFire = self.value
end,
},
fancySkinning = {
name = 'Fancy Skinning',
type = 'radioButton',
value = 'panel',
path = selPath,
items = {
{key = 'panel', name = 'None'},
{key = 'panel_1120', name = 'Bottom Left Flush',},
{key = 'panel_0120', name = 'Bot Mid Left Flush',},
{key = 'panel_2120', name = 'Bot Mid Both Flush',},
},
OnChange = function (self)
if selectionWindow then
selectionWindow.SetSkin(self.value)
end
end,
hidden = true,
noHotkey = true,
},
leftPadding = {
name = "Left Padding",
type = "number",
value = 0, min = 0, max = 500, step = 1,
OnChange = function(self)
if selectionWindow then
selectionWindow.SetLeftPadding(self.value)
end
end,
path = selPath,
},
}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Utilities
function Round(num, idp)
if (not idp) then
return math.floor(num+.5)
else
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
end
local function Format(amount, displaySign)
local formatted
if type(amount) == "number" then
if (amount ==0) then formatted = "0" else
if (amount < 20 and (amount * 10)%10 ~=0) then
if displaySign then formatted = strFormat("%+.1f", amount)
else formatted = strFormat("%.1f", amount) end
else
if displaySign then
formatted = strFormat("%+d", amount)
else
formatted = strFormat("%d", amount)
end
end
end
else
formatted = amount .. ""
end
return formatted
end
local function FormatPlusMinus(num)
if num > 0.04 then
return green .. Format(num, true)
elseif num < -0.04 then
return red .. Format(num, true)
end
return Format(num)
end
local function SecondsToMinutesSeconds(seconds)
if seconds%60 < 10 then
return math.floor(seconds/60) ..":0" .. math.floor(seconds%60)
else
return math.floor(seconds/60) ..":" .. math.floor(seconds%60)
end
end
local function UnitDefTableSort(a,b)
return a and UnitDefs[a] and b and UnitDefs[b] and UnitDefs[a].name < UnitDefs[b].name
end
local function IsGroupingRequired(selectedUnits, selectionSortOrder, selectionSpace)
if options.groupbehaviour.value == 'overflow' then
return #selectedUnits > selectionSpace
elseif options.groupbehaviour.value == 'multitype' then
return not (#selectedUnits <= selectionSpace and #selectionSortOrder <= 1)
else
return true
end
end
local function GetHealthColor(fraction, returnString)
local midpt = (fraction > 0.5)
local r, g
if midpt then
r = (1 - fraction)*2
g = 1
else
r = 1
g = fraction*2
end
if returnString then
return string.char(255, math.floor(255*r), math.floor(255*g), 0)
end
return {r, g, 0, 1}
end
local function SetPanelSkin(targetPanel, className)
local currentSkin = Chili.theme.skin.general.skinName
local skin = Chili.SkinHandler.GetSkin(currentSkin)
local newClass = skin.panel
if skin[className] then
newClass = skin[className]
end
targetPanel.tiles = newClass.tiles
targetPanel.TileImageFG = newClass.TileImageFG
--targetPanel.backgroundColor = newClass.backgroundColor
targetPanel.TileImageBK = newClass.TileImageBK
if newClass.padding then
targetPanel.padding = newClass.padding
targetPanel:UpdateClientArea()
end
targetPanel:Invalidate()
end
local iconTypeCache = {}
local function GetUnitIcon(unitDefID)
if unitDefID and iconTypeCache[unitDefID] then
return iconTypeCache[unitDefID]
end
local ud = UnitDefs[unitDefID]
if not ud then
return
end
iconTypeCache[unitDefID] = icontypes[(ud and ud.iconType or "default")].bitmap or 'icons/' .. ud.iconType .. iconFormat
return iconTypeCache[unitDefID]
end
local function GetCurrentBuildSpeed(unitID, buildSpeed)
return (Spring.GetUnitCurrentBuildPower(unitID) or 0)*(spGetUnitRulesParam(unitID, "totalEconomyChange") or 1)*buildSpeed
end
local unitBorderCache = {}
local function GetUnitBorder(unitDefID)
if unitDefID and unitBorderCache[unitDefID] then
return unitBorderCache[unitDefID]
end
local ud = UnitDefs[unitDefID]
if not ud then
return
end
unitBorderCache[unitDefID] = WG.GetBuildIconFrame and WG.GetBuildIconFrame(ud)
return unitBorderCache[unitDefID]
end
local unitSelectionTooltipCache = {}
local function GetUnitSelectionTooltip(ud, unitDefID, unitID)
if ud.level then
return GetHumanName(ud, unitID) .. " - " .. GetDescription(ud, unitID) .. selectionTooltip
end
if not unitSelectionTooltipCache[unitDefID] then
unitSelectionTooltipCache[unitDefID] = GetHumanName(ud, unitID) .. " - " .. GetDescription(ud, unitID) .. selectionTooltip
end
return unitSelectionTooltipCache[unitDefID]
end
local function GetWeaponReloadStatus(unitID, weapNum, reloadTime)
local _, _, weaponReloadFrame, _, _ = spGetUnitWeaponState(unitID, weapNum) --select weapon no.X
if weaponReloadFrame then
local currentFrame, _ = Spring.GetGameFrame()
local remainingTime = (weaponReloadFrame - currentFrame)/30
local reloadFraction = 1 - remainingTime/reloadTime
return reloadFraction, remainingTime
end
return nil --Note: this mean unit doesn't have weapon number 'weapNum'
end
local function GetUnitResources(unitID)
local mm, mu, em, eu = Spring.GetUnitResources(unitID)
mm = (mm or 0) + (spGetUnitRulesParam(unitID, "current_metalIncome") or 0)
em = (em or 0) + (spGetUnitRulesParam(unitID, "current_energyIncome") or 0)
eu = (eu or 0) + (spGetUnitRulesParam(unitID, "overdrive_energyDrain") or 0)
if mm ~= 0 or mu ~= 0 or em ~= 0 or eu ~= 0 then
return mm, (mu or 0), em, eu
else
return
end
end
local function GetUnitRegenString(unitID, ud)
if unitID and (not select(3, spGetUnitIsStunned(unitID))) then
local regen_timer = spGetUnitRulesParam(unitID, "idleRegenTimer")
if regen_timer and ud then
if ((ud.idleTime <= 600) and (regen_timer > 0)) then
return " (" .. math.ceil(regen_timer / 30) .. "s)"
else
local regenMult = (1 - (spGetUnitRulesParam(unitID, "slowState") or 0)) * (1 - (spGetUnitRulesParam(unitID,"disarmed") or 0))
if regenMult == 0 then
return
end
local regen = 0
if (regen_timer <= 0) then
regen = regen + (spGetUnitRulesParam(unitID, "comm_autorepair_rate") or ud.customParams.idle_regen)
end
if ud.customParams.amph_regen then
local x,y,z = Spring.GetUnitPosition(unitID)
local h = Spring.GetGroundHeight(x,z) or y
if (h < 0) then
regen = regen + math.min(ud.customParams.amph_regen, ud.customParams.amph_regen*(-h / ud.customParams.amph_submerged_at))
end
end
if ud.customParams.armored_regen and Spring.GetUnitArmored(unitID) then
regen = regen + ud.customParams.armored_regen
end
if (regen > 0) then
return " (+" .. math.ceil(regenMult*regen) .. ")"
end
end
end
end
end
local function GetUnitShieldRegenString(unitID, ud)
if ud.customParams.shield_recharge_delay or true then
local shieldRegen = spGetUnitRulesParam(unitID, "shieldRegenTimer")
if shieldRegen and shieldRegen > 0 then
return " (" .. math.ceil(shieldRegen / 30) .. "s)"
end
end
local mult = spGetUnitRulesParam(unitID,"totalReloadSpeedChange") or 1 * (1 - (spGetUnitRulesParam(unitID, "shieldChargeDisabled") or 0))
if mult == 0 then
return ""
end
-- FIXME: take energy stall into account
local wd = WeaponDefs[ud.shieldWeaponDef]
return " (+" .. math.ceil(mult * (wd.customParams.shield_rate or wd.shieldPowerRegen)) .. ")"
end
local function IsUnitInLos(unitID)
local spectating, fullView = Spring.GetSpectatingState()
if fullView then
return true
end
if not unitID then
return false
end
local state = Spring.GetUnitLosState(unitID)
return state and state.los
end
local function GetManualFireReload(unitID, unitDefID)
if not (unitDefID and showManualFire) then
return false
end
if unitID and commanderManualFireReload[unitID] then
local reload = commanderManualFireReload[unitID]
if reload[1] == 0 then
return false
end
return reload[1], reload[2]
end
unitDefID = unitDefID or Spring.GetUnitDefID(unitID)
if not unitDefID then
return false
end
if manualFireTimeDefs[unitDefID] then
return manualFireTimeDefs[unitDefID], 3
end
if not (unitID and isCommander[unitDefID]) then
return false
end
local manualFire = spGetUnitRulesParam(unitID, "comm_weapon_manual_2")
if manualFire ~= 1 then
commanderManualFireReload[unitID] = {0}
return false
end
local weaponNum = spGetUnitRulesParam(unitID, "comm_weapon_num_2")
if not weaponNum then
commanderManualFireReload[unitID] = {0}
return false
end
local ud = UnitDefs[unitDefID]
local unitWeapon = ud and ud.weapons and ud.weapons[weaponNum]
if (unitWeapon ~= nil) and WeaponDefs[unitWeapon.weaponDef].manualFire then
local reload = WeaponDefs[unitWeapon.weaponDef].reload
commanderManualFireReload[unitID] = {reload, weaponNum}
return reload, weaponNum
end
commanderManualFireReload[unitID] = {0}
return false
end
local function GetExtraBuildTooltipAndHealthOverride(unitDefID, mousePlaceX, mousePlaceY)
local econDef = econStructureDefs[unitDefID]
if not econDef then
return
end
if econDef.mex then
if mousePlaceX and WG.mouseoverMexIncome then
local extraText = ", ".. WG.Translate("interface", "income") .. " +" .. string.format("%.2f", WG.mouseoverMexIncome)
if WG.mouseoverMexIncome > 0 then
return extraText .. "\n" .. WG.Translate("interface", "base_payback") .. ": " .. SecondsToMinutesSeconds(econDef.cost/WG.mouseoverMexIncome)
else
return extraText .. "\n" .. WG.Translate("interface", "base_payback") .. ": " .. WG.Translate("interface", "never")
end
end
return
end
local income = econDef.income
local cost = econDef.cost
local extraText = ""
local healthOverride = false
if econDef.isWind and mousePlaceX and mousePlaceY then
local _, pos = spTraceScreenRay(mousePlaceX, mousePlaceY, true)
if pos and pos[1] and pos[3] then
local x,z = math.floor(pos[1]/16)*16, math.floor(pos[3]/16)*16
local y = Spring.GetGroundHeight(x,z)
if y then
if y <= tidalHeight then
extraText = ", " .. WG.Translate("interface", "tidal_income") .. " +" .. string.format("%.1f", tidalStrength)
income = tidalStrength
healthOverride = 400
else
local minWindIncome = windMin + (windMax - windMin)*math.max(0, math.min(windMinBound, windGroundSlope*(y - windGroundMin)))
extraText = ", " .. WG.Translate("interface", "wind_range") .. " " .. string.format("%.1f", minWindIncome ) .. " - " .. string.format("%.1f", windMax)
income = (minWindIncome+windMax)/2
end
end
end
end
local teamID = Spring.GetLocalTeamID()
local metalOD = Spring.GetTeamRulesParam(teamID, "OD_team_metalOverdrive") or 0
local energyOD = Spring.GetTeamRulesParam(teamID, "OD_team_energyOverdrive") or 0
if metalOD and metalOD > 0 and energyOD and energyOD > 0 then
-- Best case payback assumes that extra energy will make
-- metal at the current energy:metal ratio. Note that if
-- grids are linked better then better payback may be
-- achieved.
--local bestCasePayback = cost/(income*metalOD/energyOD)
-- Uniform case payback assumes that all mexes are being
-- overdriven equally and figures out their multiplier
-- from the base mex income. It then figures out how many
-- mexes there are and adds a portion of the new enginer to
-- them.
--local totalMexIncome = WG.mexIncome
--if not totalMexIncome then
-- local singleMexMult = math.sqrt(energyOD)/4
-- totalMexIncome = metalOD/singleMexMult
--end
--local overdriveMult = metalOD/totalMexIncome
--local energyPerMex = 16*overdriveMult^2
--local mexCount = energyOD/energyPerMex
--local incomePerMex = income/mexCount
--local overdrivePerMex = metalOD/mexCount
--local extraMetalPerMex = totalMexIncome/mexCount*math.sqrt(energyPerMex+incomePerMex)/4 - overdrivePerMex
--local extraMetal = extraMetalPerMex*mexCount
--local unitformCasePayback = cost/extraMetal
-- Worst case payback assumes that all your OD metal is from
-- a single mex and you are going to link your new energy to it.
-- It seems to be equal to Uniform case payback and quite accurate.
local singleMexMult = math.sqrt(energyOD)/4
local mexIncome = metalOD/singleMexMult
local worstCasePayback = cost/(mexIncome*math.sqrt(energyOD+income)/4 - metalOD)
--extraText = extraText
--.. "\n overdriveMult: " .. overdriveMult
--.. "\n energyPerMex: " .. energyPerMex
--.. "\n mexCount: " .. mexCount
--.. "\n incomePerMex: " .. incomePerMex
--.. "\n overdrivePerMex: " .. overdrivePerMex
--.. "\n extraMetalPerMex: " .. extraMetalPerMex
--.. "\n extraMetal: " .. extraMetalza
--.. "\n unitformCasePayback: " .. unitformCasePayback
--.. "\n worstCasePayback: " .. worstCasePayback
return extraText .. "\n" .. WG.Translate("interface", "od_payback") .. ": " .. SecondsToMinutesSeconds(worstCasePayback), healthOverride
end
return extraText .. "\n" .. WG.Translate("interface", "od_payback") .. ": " .. WG.Translate("interface", "unknown"), healthOverride
end
local function GetPlayerCaption(teamID)
local _, player,_,isAI = Spring.GetTeamInfo(teamID, false)
local playerName
if isAI then
local _, aiName, _, shortName = Spring.GetAIInfo(teamID)
playerName = aiName -- .. ' (' .. shortName .. ')'
else
playerName = (player and Spring.GetPlayerInfo(player, false)) or (teamID ~= GAIA_TEAM and "noname")
if not playerName then
return false
end
end
local teamColor = Chili.color2incolor(Spring.GetTeamColor(teamID))
return WG.Translate("interface", "player") .. ': ' .. teamColor .. playerName
end
local function GetIsHoldingDrawKey()
if drawHotkeyBytesCount == 0 then
WG.drawtoolKeyPressed = false
return false
end
for i = 1, drawHotkeyBytesCount do
local key = drawHotkeyBytes[i]
if Spring.GetKeyState(key) then
WG.drawtoolKeyPressed = true
return true
end
end
WG.drawtoolKeyPressed = false
return false
end
local function UpdateMouseCursor(holdingDrawKey)
if not (holdingDrawKey and options.showDrawTools.value) then
return
end
local x, y, drawing, addingPoint, erasing = Spring.GetMouseState()
if addingPoint then
Spring.SetMouseCursor(CURSOR_POINT_NAME)
elseif erasing then
Spring.SetMouseCursor(CURSOR_ERASE_NAME)
else
Spring.SetMouseCursor(CURSOR_DRAW_NAME)
end
end
local UnitDefIDByHumanName_cache = {}
local function GetUnitDefByHumanName(humanName)
local cached_unitDefID = UnitDefIDByHumanName_cache[humanName]
if (cached_udef ~= nil) then
return cached_udef
end
for i = 1, #UnitDefs do
local ud = UnitDefs[i]
if (ud.humanName == humanName) then
UnitDefIDByHumanName_cache[humanName] = i
return i
end
end
UnitDefIDByHumanName_cache[humanName] = false
return false
end
local function SelectionsIconClick(button, unitID, unitList, unitDefID)
unitID = unitID or (unitList and unitList[1])
if not unitID then
return
end
local alt, ctrl, meta, shift = spGetModKeyState()
-- selectedUnitsList is global and has the same ordering as unitList
local newSelectedUnits
if (button == 3) then
if shift then
--// deselect a whole unitdef block
newSelectedUnits = {}
local j = 1
for i = 1, #selectedUnitsList do
if unitList[j] and selectedUnitsList[i] == unitList[j] then
j = j + 1
else
newSelectedUnits[#newSelectedUnits + 1] = selectedUnitsList[i]
end
end
else
--// deselect a single unit
for i = 1, #selectedUnitsList do
if selectedUnitsList[i] == unitID then
selectedUnitsList[i] = selectedUnitsList[#selectedUnitsList]
selectedUnitsList[#selectedUnitsList] = nil
end
end
newSelectedUnits = selectedUnitsList
end
spSelectUnitArray(newSelectedUnits)
widget:SelectionChanged(newSelectedUnits)
elseif button == 1 then
if shift then
spSelectUnitArray(unitList) -- select all
else
spSelectUnitArray({unitID}) -- only 1
end
else --button2 (middle)
local x,y,z = Spring.GetUnitPosition(unitID)
SetCameraTarget(x, y, z, 1)
end
end
local cacheFeatureTooltip = {}
local cacheFeatureUnitDefID = {}
local function GetFeatureDisplayAttributes(featureDefID)
if cacheFeatureTooltip[featureDefID] or cacheFeatureUnitDefID[featureDefID] then
return cacheFeatureTooltip[featureDefID], cacheFeatureUnitDefID[featureDefID]
end
local fd = FeatureDefs[featureDefID]
local featureName = fd and fd.name
local unitName
if fd and fd.customParams and fd.customParams.unit then
unitName = fd.customParams.unit
else
unitName = featureName:gsub('(.*)_.*', '%1') --filter out _dead or _dead2 or _anything
end
local unitDefID
if unitName and UnitDefNames[unitName] then
unitDefID = UnitDefNames[unitName].id
end
if featureName:find("dead2") or featureName:find("heap") then
addedName = " (" .. WG.Translate("interface", "debris") .. ")"
elseif featureName:find("dead") then
addedName = " (" .. WG.Translate("interface", "wreckage") .. ")"
end
if unitDefID then
cacheFeatureUnitDefID[featureDefID] = unitDefID
return nil, cacheFeatureUnitDefID[featureDefID]
end
cacheFeatureTooltip[featureDefID] = fd.tooltip
return cacheFeatureTooltip[featureDefID]
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Unit tooltip window components
local function GetBarWithImage(parentControl, name, initY, imageFile, color, colorFunc)
local image = Chili.Image:New{
name = name .. "_image",
x = 0,
y = initY,
width = ICON_SIZE,
height = ICON_SIZE,
file = imageFile,
parent = parentControl,
}
local bar = Chili.Progressbar:New {
name = name .. "_bar",
x = ICON_SIZE + 1,
y = initY,
right = 0,
height = BAR_SIZE,
max = 1,
color = color,
itemMargin = {0,0,0,0},
itemPadding = {0,0,0,0},
padding = {0,0,0,0},
caption = '',
font = {size = BAR_FONT},
parent = parentControl
}
local function UpdateBar(visible, yPos, currentValue, maxValue, extraCaption, newCaption)
image:SetVisibility(visible)
bar:SetVisibility(visible)
if not visible then
return
end
if yPos then
image:SetPos(nil, yPos, nil, nil, nil, true)
bar:SetPos(nil, yPos, nil, nil, nil, true)
end
if not newCaption then
newCaption = Format(currentValue) .. ' / ' .. Format(maxValue)
if extraCaption then
newCaption = newCaption .. extraCaption
end
end
bar:SetCaption(newCaption)
if colorFunc then
color = colorFunc(currentValue/maxValue)
bar.color = color
end
bar:SetValue(currentValue/maxValue)
end
return UpdateBar
end
local function GetImageWithText(parentControl, name, initY, imageFile, caption, fontSize, iconSize, textOffset)
fontSize = fontSize or IMAGE_FONT
iconSize = iconSize or ICON_SIZE
local image = Chili.Image:New{
name = name .. "_image",
x = 0,
y = initY,
width = iconSize,
height = iconSize,
file = imageFile,
parent = parentControl,
}
local label = Chili.Label:New{
name = name .. "_label",
x = iconSize + 2,
y = initY + (textOffset or 0),
right = 0,
height = LEFT_LABEL_HEIGHT,
caption = IMAGE_FONT,
fontSize = fontSize,
parent = parentControl,
}
image:SetVisibility(false)
label:SetVisibility(false)
local function Update(visible, newCaption, newImage, yPos)
image:SetVisibility(visible)
label:SetVisibility(visible)
if not visible then
return
end
if yPos then
image:SetPos(nil, yPos, nil, nil, nil, true)
label:SetPos(nil, yPos + textOffset, nil, nil, nil, true)
end
label:SetCaption(newCaption)
if newImage ~= imageFile then
if imageFile == nil then
label:SetPos(iconSize + 2, nil, nil, nil, nil, true)
elseif newImage == nil then
label:SetPos(2, nil, nil, nil, nil, true)
end
imageFile = newImage
image.file = imageFile
image:Invalidate()
end
end
return Update
end
local function GetMorphInfo(parentControl, yPos)
local holder = Chili.Control:New{
x = 0,
y = yPos,
right = 0,
height = ICON_SIZE,
padding = {0,0,0,0},
parent = parentControl,
}
local morphLabel = Chili.Label:New{
x = 4,
y = 0,
height = ICON_SIZE,
width = 50,
valign = 'center',
caption = cyan .. 'Morph:',
fontSize = BAR_FONT,
parent = holder,
}
local timeImage = Chili.Image:New{
x = 54,
y = 0,
width = ICON_SIZE,
height = ICON_SIZE,
file = IMAGE.TIME,
parent = holder,
}
local timeLabel = Chili.Label:New{
x = 54 + ICON_SIZE + 4,
y = 4,
right = 0,
height = BAR_SIZE,
caption = BAR_FONT,
fontSize = fontSize,
parent = holder,
}
local costImage = Chili.Image:New{
x = 114,
y = 0,
width = ICON_SIZE,
height = ICON_SIZE,
file = IMAGE.COST,
parent = holder,
}
local costLabel = Chili.Label:New{
x = 113 + ICON_SIZE + 4,
y = 4,
right = 0,
height = BAR_SIZE,
caption = BAR_FONT,
fontSize = fontSize,
parent = holder,
}
local function Update(visible, newTime, newCost, yPos)
holder:SetVisibility(visible)
if not visible then
return
end
if yPos then
holder:SetPos(nil, yPos, nil, nil, nil, true)
end
timeLabel:SetCaption(cyan .. newTime)
costLabel:SetCaption(cyan .. newCost)
end
return Update
end
local function UpdateManualFireReload(reloadBar, parentImage, unitID, weaponNum, reloadTime)
if not reloadBar then
reloadBar = Chili.Progressbar:New {
x = "82%",
y = 5,
right = 5,
bottom = 5,
minWidth = 4,
max = 1,
caption = false,
noFont = true,
color = reloadBarColor,
skinName = 'default',
orientation = "vertical",
reverse = true,
parent = parentImage,
}
end
local reloadFraction, remainingTime = GetWeaponReloadStatus(unitID, weaponNum, reloadTime)
if reloadFraction and reloadFraction < 1 then
reloadBar:SetValue(reloadFraction)
reloadBar:SetVisibility(true)
else
reloadBar:SetVisibility(false)
end
return reloadBar
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Group buttons window
local function GetUnitGroupIconButton(parentControl)
local unitDefID
local unitID
local unitList
local unitCount
local size = options.uniticon_size.value
local holder = Chili.Control:New{
x = 0,
y = 0,
width = size,
height = size,
padding = {1,1,1,1},
parent = parentControl,
}
local reloadBar
local healthBar = Chili.Progressbar:New {
x = 0,
y = "80%",
right = 0,
height = 0,
max = 1,
caption = false,
noFont = true,
color = fullHealthBarColor,
parent = holder
}
local unitImage = Chili.Image:New{
keepAspect = false,
x = 0,
y = 0,
right = 0,
bottom = "20%",
padding = {0,0,0,0},
parent = holder,
OnClick = {
function(_,_,_,button)
SelectionsIconClick(button, unitID, unitList, unitDefID)
end
}
}
local groupLabel = Chili.Label:New{
x = 0,
right = 2,
bottom = 0,
height = 25,
align = "right",
valign = "top",
fontsize = 20,
fontshadow = true,
fontOutline = true,
parent = unitImage
}
local function UpdateUnitInfo()
if unitID then
local health, maxhealth = spGetUnitHealth(unitID)
if health then
healthBar.color = GetHealthColor(health/maxhealth)
healthBar:SetValue(health/maxhealth)
end
local reloadTime, weaponNum = GetManualFireReload(unitID, unitDefID)
if reloadTime then
reloadBar = UpdateManualFireReload(reloadBar, unitImage, unitID, weaponNum, reloadTime)
elseif reloadBar then
reloadBar:SetVisibility(false)
end
return
end
if reloadBar then
reloadBar:SetVisibility(false)
end
local totalHealth, totalMax = 0, 0
for i = 1, #unitList do
local health, maxhealth = spGetUnitHealth(unitList[i])
if health and maxhealth then
totalHealth = totalHealth + health
totalMax = totalMax + maxhealth
end
end
if totalMax > 0 then
healthBar.color = GetHealthColor(totalHealth/totalMax)
healthBar:SetValue(totalHealth/totalMax)
end
end
local function UpdateUnitDefID(newUnitDefID)
if newUnitDefID == unitDefID then
return
end
unitDefID = newUnitDefID
local ud = UnitDefs[unitDefID]
if not ud then
return
end
unitImage.tooltip = GetUnitSelectionTooltip(ud, unitDefID, unitID)
unitImage.file = "#" .. unitDefID
unitImage.file2 = GetUnitBorder(unitDefID)
unitImage:Invalidate()
end
local function UpdateUnits(newUnitID, newUnitList)
unitID = newUnitID
unitList = newUnitList
local newCount = (not unitID) and newUnitList and #newUnitList
if newCount and newCount < 2 then
newCount = false
end
if newCount == unitCount then
return
end
unitCount = newCount
groupLabel._relativeBounds.left = 0
groupLabel._relativeBounds.right = 2
groupLabel:SetCaption(unitCount or "")
end
local externalStuff = {
visible = true
}
function externalStuff.SetPosition(x,y,size)
holder:SetPos(x*size,y*size - SEL_BUTTON_SHORTENING*y,size,size)
end
function externalStuff.SetHidden()
holder:SetVisibility(false)
externalStuff.visible = false
end
function externalStuff.UpdateUnitButton()
UpdateUnitInfo()
end
function externalStuff.SetGroupIconUnits(newUnitID, newUnitList, newUnitDefID)
holder:SetVisibility(true)
externalStuff.visible = true
UpdateUnitDefID(newUnitDefID)
UpdateUnits(newUnitID, newUnitList)
UpdateUnitInfo()
end
return externalStuff
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Group info handler
local function GetSelectionStatsDisplay(parentControl)
local holder = Chili.Control:New{
name = "holder",
y = 0,
right = 0,
bottom = 0,
width = GROUP_STATS_WIDTH,
padding = {0,0,0,0},
parent = parentControl,
}
local selectedUnits
local selectedUnitDefID = {}
local visible = true
local statLabel = Chili.Label:New{
name = "statLabel",
x = 0,
y = 3,
right = 0,
valign = 'top',
fontSize = 12,
fontShadow = true,
parent = holder,
}
local total_count = 0
local total_finishedcost = 0
local total_totalbp = 0
local total_maxhp = 0
local total_totalburst = 0
local unreliableBurst = false
local burstClass = 0
local function UpdateDynamicGroupInfo()
local total_cost = 0
local total_hp = 0
local total_metalincome = 0
local total_metaldrain = 0
local total_energyincome = 0
local total_energydrain = 0
local total_usedbp = 0
local unitID, unitDefID, ud --micro optimization, avoiding repeated localization.
local name, hp, paradam, cap, build, mm, mu, em, eu
local stunned_or_inbuild
for i = 1, total_count do
unitID = selectedUnits[i]
unitDefID = selectedUnitDefID[i]
ud = unitDefID and UnitDefs[unitDefID]
if ud then
hp, _, paradam, cap, build = spGetUnitHealth(unitID)
mm, mu, em, eu = GetUnitResources(unitID)
if hp then
total_cost = total_cost + GetUnitCost(unitID, unitDefID)*build
total_hp = total_hp + hp
end
stunned_or_inbuild = spGetUnitIsStunned(unitID)
if not stunned_or_inbuild then
if mm then
total_metalincome = total_metalincome + mm
total_metaldrain = total_metaldrain + mu
total_energyincome = total_energyincome + em
total_energydrain = total_energydrain + eu
end
if ud.buildSpeed ~= 0 then
total_usedbp = total_usedbp + (GetCurrentBuildSpeed(unitID, GetUnitBuildSpeed(unitID, unitDefID)) or 0)
end
end
end
end
local unitInfoString = WG.Translate("interface", "selected_units") .. ": " .. Format(total_count) .. "\n" ..
WG.Translate("interface", "health") .. ": " .. Format(total_hp) .. " / " .. Format(total_maxhp) .. "\n" ..
WG.Translate("interface", "value") .. ": " .. Format(total_cost) .. " / " .. Format(total_finishedcost) .. "\n"
if total_metalincome ~= 0 or total_metaldrain ~= 0 or total_energyincome ~= 0 or total_energydrain ~= 0 then
unitInfoString = unitInfoString ..
WG.Translate("interface", "metal") .. ": " .. FormatPlusMinus(total_metalincome) .. white .. " / " .. FormatPlusMinus(-total_metaldrain) .. white .. "\n" ..
WG.Translate("interface", "energy") .. ": " .. FormatPlusMinus(total_energyincome) .. white .. " / " .. FormatPlusMinus(-total_energydrain) .. white .. "\n"
end
if total_totalbp ~= 0 then
unitInfoString = unitInfoString ..
WG.Translate("interface", "buildpower") .. ": " .. Format(total_usedbp) .. " / " .. Format(total_totalbp) .. "\n"
end
if burstClass and total_totalburst ~= 0 then
unitInfoString = unitInfoString ..
WG.Translate("interface", "burst_damage") .. ": " .. ((unreliableBurst and "~") or "") .. Format(total_totalburst) .. "\n"
end
statLabel:SetCaption(unitInfoString)
end
--updates values that don't change over time for group info
local function UpdateStaticGroupInfo()
total_count = #selectedUnits
total_finishedcost = 0
total_totalbp = 0
total_maxhp = 0
total_totalburst = 0
unreliableBurst = false
burstClass = 0
local unitID, unitDefID
for i = 1, total_count do
unitID = selectedUnits[i]
unitDefID = Spring.GetUnitDefID(unitID)
if unitDefID and not filterUnitDefIDs[unitDefID] then
selectedUnitDefID[i] = unitDefID
total_totalbp = total_totalbp + GetUnitBuildSpeed(unitID, unitDefID)
total_maxhp = total_maxhp + (select(2, Spring.GetUnitHealth(unitID)) or 0)
total_finishedcost = total_finishedcost + GetUnitCost(unitID, unitDefID)
local burstData = UNIT_BURST_DAMAGES[unitDefID]
if burstData and burstClass then
if burstClass == 0 then
burstClass = burstData.class
end
if burstClass == burstData.class then
total_totalburst = total_totalburst + burstData.damage
unreliableBurst = unreliableBurst or burstData.unreliable
else
burstClass = false
end
end
global_totalBuildPower = total_totalbp
end
end
total_totalburst = math.floor(total_totalburst / 10) * 10 -- round numbers are easier to parse and compare
UpdateDynamicGroupInfo()
end
local externalFunctions = {}
function externalFunctions.ChangeSelection(newSelection)
selectedUnits = newSelection
if visible and selectedUnits then
UpdateStaticGroupInfo()
end
end
function externalFunctions.UpdateStats()
if visible and selectedUnits then
UpdateDynamicGroupInfo()
end
end
function externalFunctions.SetVisibile(newVisible)
visible = newVisible
holder:SetVisibility(newVisible)
end
return externalFunctions
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Group window
local function GetMultiUnitInfoPanel(parentControl)
local holder = Chili.Control:New{
x = 0,
y = 0,
right = GROUP_STATS_WIDTH,
bottom = 0,
padding = {-1,1,0,0},
parent = parentControl,
}
local iconSize = options.uniticon_size.value
local displayColumns = 5
local displayRows = 3
local displayUnits
local displayButtons = {}
local function UpdateButtonPosition(index)
local col = (index - 1)%displayColumns
local row = (index - 1 - col)/displayColumns
displayButtons[index].SetPosition(col, row, iconSize)
end
local function GetButton(index)
if not displayButtons[index] then
displayButtons[index] = GetUnitGroupIconButton(holder)
UpdateButtonPosition(index)
end
return displayButtons[index]
end
local function HideButtonsFromIndex(index)
while displayButtons[index] and displayButtons[index].visible do
displayButtons[index].SetHidden()
index = index + 1
end
end
local function Resize(self)
local sizeX, sizeY = self.clientWidth, self.clientHeight
local newIconSize = options.uniticon_size.value
local newCols = math.floor(sizeX/iconSize)
local newRows = math.floor(sizeY/(iconSize - SEL_BUTTON_SHORTENING))
if newCols == displayColumns and newRows == displayRows and newIconSize == iconSize then
return
end
iconSize = newIconSize
displayColumns = newCols
displayRows = newRows
local displaySpace = displayRows*displayColumns
local index = 1
while displayButtons[index] and index <= displaySpace do
UpdateButtonPosition(index)
index = index + 1
end
HideButtonsFromIndex(displaySpace + 1)
end
holder.OnResize[#holder.OnResize + 1] = Resize
local function StaticButtonUpdate(selectionSortOrder, displayUnitsByDefID)
local displaySpace = displayRows*displayColumns
local groupRequired = IsGroupingRequired(displayUnits, selectionSortOrder, displaySpace)
local buttonIndex = 1
for i = 1, #selectionSortOrder do
if displaySpace < buttonIndex then
return false
end
local unitDefID = selectionSortOrder[i]
local unitList = displayUnitsByDefID[unitDefID]
if groupRequired then
local button = GetButton(buttonIndex)
button.SetGroupIconUnits(nil, unitList, unitDefID)
buttonIndex = buttonIndex + 1
else
for j = 1, #unitList do
if displaySpace < buttonIndex then
return false
end
local button = GetButton(buttonIndex)
button.SetGroupIconUnits(unitList[j], unitList, unitDefID)
buttonIndex = buttonIndex + 1
end
end
end
return buttonIndex
end
local function DynamicButtonUpdate()
for i = 1, #displayButtons do
local button = displayButtons[i]
if button.visible then
button.UpdateUnitButton()
end
end
end
local externalFunctions = {}
function externalFunctions.UpdateUnitDisplay()
if displayUnits then
DynamicButtonUpdate()
end
end
function externalFunctions.SetUnitDisplay(newDisplayUnits)
if not newDisplayUnits then
displayUnits = false
holder:SetVisibility(false)
return
end
holder:SetVisibility(true)
displayUnits = newDisplayUnits
local unitDefAdded = {}
local displayUnitsByDefID = {}
local selectionSortOrder = {}
for i = 1, #displayUnits do
local unitID = displayUnits[i]
local unitDefID = Spring.GetUnitDefID(unitID) or 0
local byDefID = displayUnitsByDefID[unitDefID] or {}
byDefID[#byDefID + 1] = unitID
displayUnitsByDefID[unitDefID] = byDefID
if not unitDefAdded[unitDefID] then
selectionSortOrder[#selectionSortOrder + 1] = unitDefID
unitDefAdded[unitDefID] = true
end
end
table.sort(selectionSortOrder, UnitDefTableSort)
local buttonIndex = StaticButtonUpdate(selectionSortOrder, displayUnitsByDefID)
if buttonIndex then
HideButtonsFromIndex(buttonIndex)
end
end
function externalFunctions.SetRightPadding(newRightPadding)
holder._relativeBounds.left = 0
holder._relativeBounds.right = newRightPadding
holder:UpdateClientArea()
end
function externalFunctions.SetIconSize(newIconSize)
iconSize = newIconSize
Resize(holder)
end
return externalFunctions
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Unit tooltip window
local function GetSingleUnitInfoPanel(parentControl, isTooltipVersion)
local selectedUnitID
local leftPanel = Chili.Control:New{
name = "leftPanel",
x = 0,
y = 0,
width = LEFT_WIDTH,
minWidth = LEFT_WIDTH,
autosize = true,
padding = {0,2,0,2},
parent = parentControl,
}
local rightPanel = Chili.Control:New{
name = "rightPanel",
x = LEFT_WIDTH,
y = 0,
width = RIGHT_WIDTH,
minWidth = RIGHT_WIDTH,
autosize = true,
padding = {2,2,0,2},
parent = parentControl,
}
local reloadBar
local unitImage = Chili.Image:New{
name = "unitImage",
x = 0,
y = 0,
right = 0,
height = PIC_HEIGHT,
keepAspect = false,
file = imageFile,
parent = leftPanel,
}
if not isTooltipVersion then
unitImage.OnClick[#unitImage.OnClick + 1] = function()
if selectedUnitID then
local x,y,z = Spring.GetUnitPosition(selectedUnitID)
SetCameraTarget(x, y, z, 1)
end
end
end
local unitNameUpdate = GetImageWithText(rightPanel, "unitNameUpdate", 1, nil, nil, NAME_FONT, nil, 3)
local unitDesc = Chili.TextBox:New{
name = "unitDesc",
x = 4,
y = 25,
right = 0,
height = BAR_SIZE,
fontSize = DESC_FONT,
parent = rightPanel,
}
local costInfoUpdate = GetImageWithText(leftPanel, "costInfoUpdate", PIC_HEIGHT + 4, IMAGE.COST, nil, nil, ICON_SIZE, 5)
local metalInfoUpdate = GetImageWithText(leftPanel, "metalInfoUpdate", PIC_HEIGHT + LEFT_SPACE + 4, IMAGE.METAL, nil, nil, ICON_SIZE, 5)
local energyInfoUpdate = GetImageWithText(leftPanel, "energyInfoUpdate", PIC_HEIGHT + 2*LEFT_SPACE + 4, IMAGE.ENERGY, nil, nil, ICON_SIZE, 5)
local maxHealthLabel = GetImageWithText(rightPanel, "maxHealthLabel", PIC_HEIGHT + 4, IMAGE.HEALTH, nil, NAME_FONT, ICON_SIZE, 3)
local healthBarUpdate = GetBarWithImage(rightPanel, "healthBarUpdate", PIC_HEIGHT + 4, IMAGE.HEALTH, {0, 1, 0, 1}, GetHealthColor)
local metalInfo
local energyInfo
local spaceClickLabel, shieldBarUpdate, buildBarUpdate, morphInfo, playerNameLabel, timeInfoUpdate
if isTooltipVersion then
playerNameLabel = Chili.Label:New{
name = "playerNameLabel",
x = 4,
y = PIC_HEIGHT + 31,
right = 0,
height = BAR_FONT,
fontSize = BAR_FONT,
parent = rightPanel,
}
spaceClickLabel = Chili.Label:New{
name = "spaceClickLabel",
x = 4,
y = PIC_HEIGHT + 55,
right = 0,
height = 18,
fontSize = DESC_FONT,
caption = green .. WG.Translate("interface", "space_click_show_stats"),
parent = rightPanel,
}
morphInfo = GetMorphInfo(rightPanel, PIC_HEIGHT + LEFT_SPACE + 3)
timeInfoUpdate = GetImageWithText(leftPanel, "timeInfoUpdate", PIC_HEIGHT + LEFT_SPACE + 4, IMAGE.TIME, nil, nil, ICON_SIZE, 5)
else
shieldBarUpdate = GetBarWithImage(rightPanel, "shieldBarUpdate", PIC_HEIGHT + 4, IMAGE.SHIELD, {0.3,0,0.9,1})
buildBarUpdate = GetBarWithImage(rightPanel, "buildBarUpdate", PIC_HEIGHT + 58, IMAGE.BUILD, {0.8,0.8,0.2,1})
end
local prevUnitID, prevUnitDefID, prevFeatureID, prevFeatureDefID, prevVisible, prevMorphTime, prevMorphCost, prevMousePlace
local externalFunctions = {}
local function UpdateReloadTime(unitID, unitDefID)
local reloadTime, weaponNum = GetManualFireReload(unitID, unitDefID)
if reloadTime then
reloadBar = UpdateManualFireReload(reloadBar, unitImage, unitID, weaponNum, reloadTime)
elseif reloadBar then
reloadBar:SetVisibility(false)
end
end
local function UpdateDynamicUnitAttributes(unitID, unitDefID, ud)
local mm, mu, em, eu = GetUnitResources(unitID)
local showMetalInfo = false
if mm then
metalInfoUpdate(true, FormatPlusMinus(mm - mu), IMAGE.METAL, PIC_HEIGHT + LEFT_SPACE + 4)
energyInfoUpdate(true, FormatPlusMinus(em - eu), IMAGE.ENERGY, PIC_HEIGHT + 2*LEFT_SPACE + 4)
showMetalInfo = true
else
metalInfoUpdate(false)
energyInfoUpdate(false)
end
local healthPos
if shieldBarUpdate then
if ud and (ud.shieldPower > 0 or ud.level) then
local shieldPower = spGetUnitRulesParam(unitID, "comm_shield_max") or ud.shieldPower
local _, shieldCurrentPower = Spring.GetUnitShieldState(unitID, -1)
if shieldCurrentPower and shieldPower then
shieldBarUpdate(true, nil, shieldCurrentPower, shieldPower, (shieldCurrentPower < shieldPower) and GetUnitShieldRegenString(unitID, ud))
end
healthPos = PIC_HEIGHT + 4 + BAR_SPACING
else
shieldBarUpdate(false)
healthPos = PIC_HEIGHT + 4
end
end
local health, maxHealth = spGetUnitHealth(unitID)
if health and maxHealth then
healthBarUpdate(true, healthPos, health, maxHealth, (health < maxHealth) and GetUnitRegenString(unitID, ud))
end
if buildBarUpdate then
if ud and ud.buildSpeed > 0 then
local metalMake, metalUse, energyMake,energyUse = Spring.GetUnitResources(unitID)
local buildSpeed = GetUnitBuildSpeed(unitID, unitDefID)
local currentBuild = GetCurrentBuildSpeed(unitID, buildSpeed)
buildBarUpdate(true, (healthPos or (PIC_HEIGHT + 4)) + BAR_SPACING, currentBuild or 0, buildSpeed)
else
buildBarUpdate(false)
end
end
if dynamicTooltipDefs[unitDefID] then
unitDesc:SetText(GetDescription(ud, unitID))
end
UpdateReloadTime(unitID, unitDefID)
return showMetalInfo
end
local function UpdateDynamicFeatureAttributes(featureID, unitDefID)
local metal, _, energy, _, _ = Spring.GetFeatureResources(featureID)
local leftOffset = 1
if unitDefID then
leftOffset = PIC_HEIGHT + LEFT_SPACE
end
metalInfoUpdate(true, Format(metal), IMAGE.METAL_RECLAIM, leftOffset + 4)
energyInfoUpdate(true, Format(energy), IMAGE.ENERGY_RECLAIM, leftOffset + LEFT_SPACE + 4)
end
local function UpdateDynamicEconInfo(unitDefID, mousePlaceX, mousePlaceY)
local ud = UnitDefs[unitDefID]
local extraTooltip, healthOverride
if not (unitID or featureID) then
extraTooltip, healthOverride = GetExtraBuildTooltipAndHealthOverride(unitDefID, mousePlaceX, mousePlaceY)
end
if extraTooltip then
unitDesc:SetText(GetDescription(ud, unitID) .. extraTooltip)
else
unitDesc:SetText(GetDescription(ud, unitID))
end
unitDesc:Invalidate()
if econStructureDefs[unitDefID].isWind then
maxHealthLabel(true, healthOverride or ud.health, IMAGE.HEALTH)
end
end
local function UpdateBuildTime(unitDefID)
if not timeInfoUpdate then
return
end
if (global_totalBuildPower or 0) < 1 then
timeInfoUpdate(true, cyan .. "??", IMAGE.TIME)
return
end
local buildCost = GetUnitCost(nil, unitDefID)
if not buildCost then
timeInfoUpdate(false)
return
end
timeInfoUpdate(true, cyan .. SecondsToMinutesSeconds(math.floor(buildCost/global_totalBuildPower)), IMAGE.TIME)
end
function externalFunctions.SetDisplay(unitID, unitDefID, featureID, featureDefID, blueprint, morphTime, morphCost, mousePlaceX, mousePlaceY, requiredOnly)
local teamID
local addedName
local ud
local metalInfoShown = false
local maxHealthShown = false
local morphShown = false
local visible = IsUnitInLos(unitID)
if prevUnitID == unitID and prevUnitDefID == unitDefID and prevFeatureID == featureID and prevFeatureDefID == featureDefID and
prevVisible == visible and prevMorphTime == morphTime and prevMorphCost == morphCost and prevMousePlace == ((mousePlaceX and true) or false) then
if not requiredOnly then
if unitID and unitDefID and visible then
UpdateDynamicUnitAttributes(unitID, unitDefID, UnitDefs[unitDefID])
end
if featureID then
UpdateDynamicFeatureAttributes(featureID, prevUnitDefID)
end
if unitDefID and not (unitID or featureID) then
if blueprint then
UpdateBuildTime(unitDefID)
end
if econStructureDefs[unitDefID] then
UpdateDynamicEconInfo(unitDefID, mousePlaceX, mousePlaceY)
end
end
end
return
end
if featureID then
teamID = Spring.GetFeatureTeam(featureID)
local featureTooltip, featureUnitDefID = GetFeatureDisplayAttributes(featureDefID)
healthBarUpdate(false)
if featureUnitDefID then
unitDefID = featureUnitDefID
if playerNameLabel then
playerNameLabel:SetPos(nil, PIC_HEIGHT + 10, nil, nil, nil, true)
spaceClickLabel:SetPos(nil, PIC_HEIGHT + 34, nil, nil, nil, true)
end
else
costInfoUpdate(false)
unitNameUpdate(true, featureTooltip, nil)
if playerNameLabel then
playerNameLabel:SetPos(nil, PIC_HEIGHT - 10, nil, nil, nil, true)
spaceClickLabel:SetPos(nil, PIC_HEIGHT + 14, nil, nil, nil, true)
end
end
UpdateDynamicFeatureAttributes(featureID, featureUnitDefID)
metalInfoShown = true
end
if unitDefID then
ud = UnitDefs[unitDefID]
unitImage.file = "#" .. unitDefID
unitImage.file2 = GetUnitBorder(unitDefID)
unitImage:Invalidate()
costInfoUpdate(true, cyan .. math.floor(GetUnitCost(unitID, unitDefID) or 0), IMAGE.COST, PIC_HEIGHT + 4)
local extraTooltip, healthOverride
if not (unitID or featureID) then
extraTooltip, healthOverride = GetExtraBuildTooltipAndHealthOverride(unitDefID, mousePlaceX, mousePlaceY)
end
if extraTooltip then
unitDesc:SetText(GetDescription(ud, unitID) .. extraTooltip)
else
unitDesc:SetText(GetDescription(ud, unitID))
end
unitDesc:Invalidate()
local unitName = GetHumanName(ud, unitID)
if addedName then
unitName = unitName .. addedName
end
unitNameUpdate(true, unitName, GetUnitIcon(unitDefID))
if unitID then
if playerNameLabel then
playerNameLabel:SetPos(nil, PIC_HEIGHT + 31, nil, nil, nil, true)
spaceClickLabel:SetPos(nil, PIC_HEIGHT + 55, nil, nil, nil, true)
end
end
if (not (unitID and visible)) and not featureDefID then
healthBarUpdate(false)
maxHealthLabel(true, healthOverride or ud.health, IMAGE.HEALTH)
maxHealthShown = true
if blueprint then
UpdateBuildTime(unitDefID)
end
if morphTime then
morphInfo(true, morphTime, morphCost)
morphShown = true
if spaceClickLabel then
spaceClickLabel:SetPos(nil, PIC_HEIGHT + LEFT_SPACE + 31, nil, nil, nil, true)
end
elseif spaceClickLabel and not unitID then
spaceClickLabel:SetPos(nil, PIC_HEIGHT + 30, nil, nil, nil, true)
end
end
end
if timeInfoUpdate and not blueprint then
timeInfoUpdate(false)
end
if unitID then
teamID = Spring.GetUnitTeam(unitID)
if UpdateDynamicUnitAttributes(unitID, unitDefID, ud) then
metalInfoShown = true
end
selectedUnitID = unitID
else
selectedUnitID = nil
if reloadBar then
reloadBar:SetVisibility(false)
end
end
if not metalInfoShown then
metalInfoUpdate(false)
energyInfoUpdate(false)
end
if playerNameLabel then
local playerName = teamID and GetPlayerCaption(teamID)
if playerName then
playerNameLabel:SetCaption(playerName)
end
playerNameLabel:SetVisibility((playerName and true) or false)
end
local visibleUnitDefID = (unitDefID and true) or false
unitImage:SetVisibility(visibleUnitDefID)
unitDesc:SetVisibility(visibleUnitDefID)
if spaceClickLabel then
spaceClickLabel:SetVisibility(visibleUnitDefID)
end
if maxHealthLabel and not maxHealthShown then
maxHealthLabel(false)
end
if morphInfo and not morphShown then
morphInfo(false)
end
prevUnitID, prevUnitDefID, prevFeatureID, prevFeatureDefID = unitID, unitDefID, featureID, featureDefID
prevVisible = visible
prevMorphTime, prevMorphCost, prevMousePlace = morphTime, morphCost, ((mousePlaceX and true) or false)
end
function externalFunctions.SetVisible(newVisible)
leftPanel:SetVisibility(newVisible)
rightPanel:SetVisibility(newVisible)
end
return externalFunctions
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Tooltip window handler
local function GetTooltipWindow()
local window = Chili.Window:New{
name = "tooltipWindow",
x = 300,
y = 250,
savespace = true,
resizable = false,
draggable = false,
autosize = true,
minWidth = RIGHT_WIDTH,
padding = {6,4,6,2},
color = {1, 1, 1, options.tooltip_opacity.value},
parent = screen0
}
window:Hide()
local textTooltip = Chili.TextBox:New{
name = "textTooltip",
x = 0,
y = 4,
width = RIGHT_WIDTH - 10,
height = 5,
valign = "ascender",
autoHeight = true,
font = {size = TOOLTIP_FONT},
parent = window,
}
textTooltip:SetVisibility(false)
local unitDisplay = GetSingleUnitInfoPanel(window, true)
local externalFunctions = {}
function externalFunctions.SetVisible(newVisible)
window:SetVisibility(newVisible)
end
function externalFunctions.SetOpacity(opacity)
window.color[4] = opacity
window:Invalidate()
end
function externalFunctions.SetPosition(x, y)
y = screenHeight - y
if x + window.width > screenWidth - 2 then
x = screenWidth - window.width - 2
end
if y + window.height > screenHeight - 2 then
y = screenHeight - window.height - 2
end
local map = WG.MinimapPosition
if map then
-- Only move tooltip up and/or left if it overlaps the minimap. This is because the
-- minimap does not have tooltips.
if x < map[1] + map[3] and y < map[2] + map[4] then
local inX = x + window.width - map[1] + 2
local inY = y + window.height - map[2] + 2
if inX > 0 and inY > 0 then
if inX > inY then
y = y - inY
else
x = x - inX
end
end
end
if x + window.width > screenWidth - 2 then
x = screenWidth - window.width - 2
end
if y + window.height > screenHeight - 2 then
y = screenHeight - window.height - 2
end
end
window:SetPos(x, y, nil, nil, nil, true)
window:BringToFront()
end
function externalFunctions.SetTextTooltip(text)
if text == "" then
return false
end
textTooltip:SetText(text)
textTooltip:Invalidate()
textTooltip:SetVisibility(true)
unitDisplay.SetVisible(false)
return true
end
function externalFunctions.SetUnitishTooltip(unitID, unitDefID, featureID, featureDefID, blueprint, morphTime, morphCost, mousePlaceX, mousePlaceY, requiredOnly)
if unitDefID or featureID or featureDefID then
unitDisplay.SetDisplay(unitID, unitDefID, featureID, featureDefID, blueprint, morphTime, morphCost, mousePlaceX, mousePlaceY, requiredOnly)
textTooltip:SetVisibility(false)
unitDisplay.SetVisible(true)
else
externalFunctions.SetTextTooltip("Enemy unit")
end
end
return externalFunctions
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Tooltip updates
local function ShowUnitCheck(holdingSpace)
if holdingSpace or options.show_for_units.value then
return true
end
end
local function ShowFeatureCheck(holdingSpace, featureDefID)
if holdingSpace then
return true
end
if options.show_for_wreckage.value then
if options.show_for_unreclaimable.value then
local fd = FeatureDefs[featureDefID]
if not (fd and fd.reclaimable) then
return false
end
end
return true
end
end
local function UpdateTooltipContent(mx, my, dt, requiredOnly)
local holdingDrawKey = GetIsHoldingDrawKey()
local holdingSpace = select(3, Spring.GetModKeyState()) and not Spring.IsUserWriting()
UpdateMouseCursor(holdingDrawKey)
if not (holdingSpace or (options.tooltip_delay.value == 0)) then
local mouseMoved = (mx ~= oldMouseX or my ~= oldMouseY)
if not mouseMoved then
stillCursorTime = stillCursorTime + dt
if stillCursorTime < options.tooltip_delay.value then
return false
end
else
stillCursorTime = 0
oldMouseX = mx
oldMouseY = my
return false
end
end
-- Mouseover build option tooltip (screen0.currentTooltip)
local chiliTooltip = screen0.currentTooltip
if chiliTooltip == NO_TOOLTIP then
return false
end
if chiliTooltip and string.find(chiliTooltip, "BuildUnit") then
local name = string.sub(chiliTooltip, 10)
local ud = name and UnitDefNames[name]
if ud then
tooltipWindow.SetUnitishTooltip(nil, ud.id, nil, nil, true)
return true
end
elseif chiliTooltip and string.find(chiliTooltip, "Build") then
local name = string.sub(chiliTooltip, 6)
local ud = name and UnitDefNames[name]
if ud then
tooltipWindow.SetUnitishTooltip(nil, ud.id, nil, nil, true)
return true
end
end
-- Mouseover morph tooltip (screen0.currentTooltip)
if chiliTooltip and string.find(chiliTooltip, "Morph") then
local unitHumanName = chiliTooltip:gsub('Morph into a (.*)(time).*', '%1'):gsub('[^%a \\-]', '')
local morphTime = chiliTooltip:gsub('.*time:(.*)metal.*', '%1'):gsub('[^%d]', '')
local morphCost = chiliTooltip:gsub('.*metal: (.*)energy.*', '%1'):gsub('[^%d]', '')
local unitDefID = GetUnitDefByHumanName(unitHumanName)
if unitDefID and morphTime and morphCost then
tooltipWindow.SetUnitishTooltip(nil, unitDefID, nil, nil, false, morphTime, morphCost)
end
return true
end
-- Generic chili text tooltip
if chiliTooltip then
return tooltipWindow.SetTextTooltip(chiliTooltip)
end
-- Map drawing tooltip
if holdingDrawKey and (holdingSpace or options.showdrawtooltip.value) then
return tooltipWindow.SetTextTooltip(DRAWING_TOOLTIP)
end
-- Terraform tooltip (spring.GetActiveCommand)
local index, cmdID, cmdType, cmdName = Spring.GetActiveCommand()
if cmdID and terraCmdTip[cmdID] and (holdingSpace or options.showterratooltip.value) then
return tooltipWindow.SetTextTooltip(terraCmdTip[cmdID])
end
-- Placing structure tooltip (spring.GetActiveCommand)
if cmdID and cmdID < 0 then
tooltipWindow.SetUnitishTooltip(nil, -cmdID, nil, nil, true, nil, nil, mx, my, requiredOnly)
return true
end
-- Unit or feature tooltip
local thingType, thingID = spTraceScreenRay(mx,my)
local thingIsUnit = (thingType == "unit")
if thingIsUnit or (thingType == "feature") then
local ignoreDelay = holdingSpace or (options.independant_world_tooltip_delay.value == 0)
if ignoreDelay or (thingID == sameObjectID) then
if ignoreDelay or (sameObjectIDTime > options.independant_world_tooltip_delay.value) then
if thingIsUnit then
local thingDefID = Spring.GetUnitDefID(thingID)
if ShowUnitCheck(holdingSpace) then
tooltipWindow.SetUnitishTooltip(thingID, thingDefID, nil, nil, false, nil, nil, nil, nil, requiredOnly)
return true
end
else
local thingDefID = Spring.GetFeatureDefID(thingID)
if ShowFeatureCheck(holdingSpace, thingDefID) then
tooltipWindow.SetUnitishTooltip(nil, nil, thingID, thingDefID, false, nil, nil, nil, nil, requiredOnly)
return true
end
end
else
sameObjectIDTime = sameObjectIDTime + dt
end
else
sameObjectID = thingID
sameObjectIDTime = 0
end
end
-- Ground position tooltip (spGetCurrentTooltip())
if holdingSpace then
local springTooltip = Spring.GetCurrentTooltip()
if springTooltip and string.find(springTooltip, "Terrain type:") then
return tooltipWindow.SetTextTooltip(springTooltip)
end
end
-- Start position tooltip (really bad widget interface)
-- Don't want to implement this as is (pairs over positions registered in WG).
-- Geothermal tooltip (WG.mouseAboveGeo)
if WG.mouseAboveGeo then
return tooltipWindow.SetTextTooltip(WG.Translate("interface", "geospot"))
end
return false
end
local function UpdateTooltip(dt, requiredOnly)
local mx, my, _, _, _, outsideSpring = spScaledGetMouseState()
local worldMx, worldMy = spGetMouseState()
local visible = (not outsideSpring) and UpdateTooltipContent(worldMx, worldMy, dt, requiredOnly)
tooltipWindow.SetVisible(visible)
if visible then
tooltipWindow.SetPosition(mx + 20/(WG.uiScale or 1), my - 20/(WG.uiScale or 1))
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Selection window handler
local function GetSelectionWindow()
local integralWidth = math.max(350, math.min(450, screenWidth*screenHeight*0.0004))
local integralHeight = math.min(screenHeight/4.5, 200*integralWidth/450) + 8
local x = integralWidth
local visible = true
local height = integralHeight*0.84
local holderWindow = Chili.Window:New{
name = 'selections',
x = x,
bottom = 0,
width = 450,
height = height,
minWidth = 450,
minHeight = 120,
bringToFrontOnClick = false,
dockable = true,
draggable = false,
resizable = false,
tweakDraggable = true,
tweakResizable = true,
padding = {0, 0, 0, -1},
color = {0, 0, 0, 0},
parent = screen0,
}
holderWindow:SendToBack()
local mainPanel = Chili.Panel:New{
name = "mainPanel",
classname = options.fancySkinning.value,
x = 0,
y = 0,
right = 0,
bottom = 0,
padding = {8, 4, 4, 2},
backgroundColor = {1, 1, 1, options.selection_opacity.value},
OnMouseDown = {
function(self)
local _,_, meta,_ = spGetModKeyState()
if not meta then
return false
end
WG.crude.OpenPath('Settings/HUD Panels/Selected Units Window')
WG.crude.ShowMenu()
return true --skip button function, else clicking on build pic will also select the unit.
end
},
noClickThrough = false,
parent = holderWindow
}
mainPanel.padding[1] = mainPanel.padding[1] + options.leftPadding.value
mainPanel:Hide()
local singleUnitDisplay = GetSingleUnitInfoPanel(mainPanel, false)
local multiUnitDisplay = GetMultiUnitInfoPanel(mainPanel)
local selectionStatsDisplay = GetSelectionStatsDisplay(mainPanel)
local singleUnitID, singleUnitDefID
local externalFunctions = {}
function externalFunctions.ShowSingleUnit(unitID)
singleUnitID, singleUnitDefID = unitID, Spring.GetUnitDefID(unitID)
singleUnitDisplay.SetDisplay(unitID, Spring.GetUnitDefID(unitID))
singleUnitDisplay.SetVisible(true)
multiUnitDisplay.SetUnitDisplay()
selectionStatsDisplay.ChangeSelection({unitID})
end
function externalFunctions.ShowMultiUnit(newSelection)
singleUnitID = nil
multiUnitDisplay.SetUnitDisplay(newSelection)
singleUnitDisplay.SetVisible(false)
selectionStatsDisplay.ChangeSelection(newSelection)
end
function externalFunctions.UpdateSelectionWindow()
if not visible then
return
end
if singleUnitID then
singleUnitDisplay.SetDisplay(singleUnitID, singleUnitDefID)
else
multiUnitDisplay.UpdateUnitDisplay()
end
selectionStatsDisplay.UpdateStats()
end
function externalFunctions.SetVisible(newVisible)
if not newVisible then
singleUnitID = nil
end
visible = newVisible
mainPanel:SetVisibility(newVisible)
singleUnitDisplay.SetVisible(false)
multiUnitDisplay.SetUnitDisplay(false)
end
function externalFunctions.SetOpacity(opacity)
mainPanel.backgroundColor = {1,1,1,opacity}
mainPanel:Invalidate()
end
function externalFunctions.SetSkin(className)
SetPanelSkin(mainPanel, className)
end
function externalFunctions.SetLeftPadding(padding)
mainPanel.padding[1] = 8 + padding
mainPanel:UpdateClientArea()
end
function externalFunctions.SetAllowClickThrough(allowClickThrough)
mainPanel.noClickThrough = not allowClickThrough
end
function externalFunctions.SetGroupInfoVisible(newVisible)
local rightPadding = newVisible and GROUP_STATS_WIDTH or 0
multiUnitDisplay.SetRightPadding(rightPadding)
selectionStatsDisplay.SetVisibile(newVisible)
end
function externalFunctions.SetSelectionIconSize(iconSize)
multiUnitDisplay.SetIconSize(iconSize)
end
-- Initialization
externalFunctions.SetGroupInfoVisible(options.showgroupinfo.value)
return externalFunctions
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Selection update
local function UpdateSelection(newSelection)
-- Check if selection is 0, hide window. Return
-- Check if selection is 1, get unit tooltip
-- Check if selection is many, get unit list tooltip
-- Update group info.
selectedUnitsList = newSelection
if (not newSelection) or (#newSelection == 0) then
selectionWindow.SetVisible(false)
return
end
selectionWindow.SetVisible(true)
if #newSelection == 1 then
selectionWindow.ShowSingleUnit(newSelection[1])
else
selectionWindow.ShowMultiUnit(newSelection)
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Widget Interface
local function InitializeWindParameters()
windMin = spGetGameRulesParam("WindMin")
windMax = spGetGameRulesParam("WindMax")
windGroundMin = spGetGameRulesParam("WindGroundMin")
windGroundSlope = spGetGameRulesParam("WindSlope")
windMinBound = spGetGameRulesParam("WindMinBound")
tidalStrength = Spring.GetGameRulesParam("tidalStrength")
tidalHeight = Spring.GetGameRulesParam("tidalHeight")
end
local updateTimer = 0
function widget:Update(dt)
updateTimer = updateTimer + dt
local slowUpdate = updateTimer > UPDATE_FREQUENCY
UpdateTooltip(dt, not slowUpdate)
if slowUpdate then
selectionWindow.UpdateSelectionWindow()
updateTimer = 0
end
end
function widget:SelectionChanged(newSelection)
UpdateSelection(newSelection)
end
function widget:ViewResize(vsx, vsy)
screenWidth = vsx/(WG.uiScale or 1)
screenHeight = vsy/(WG.uiScale or 1)
end
function widget:Initialize()
Chili = WG.Chili
screen0 = Chili.Screen0
Spring.AssignMouseCursor(CURSOR_ERASE_NAME, CURSOR_ERASE, true, false) -- Hotspot center.
Spring.AssignMouseCursor(CURSOR_POINT_NAME, CURSOR_POINT, true, true)
Spring.AssignMouseCursor(CURSOR_DRAW_NAME, CURSOR_DRAW, true, true)
Spring.SendCommands({"tooltip 0"})
Spring.SetDrawSelectionInfo(false)
local hotkeys = WG.crude.GetHotkeys("drawinmap")
for k,v in pairs(hotkeys) do
drawHotkeyBytesCount = drawHotkeyBytesCount + 1
drawHotkeyBytes[drawHotkeyBytesCount] = v:byte(-1)
end
selectionWindow = GetSelectionWindow()
tooltipWindow = GetTooltipWindow()
InitializeWindParameters()
end
function widget:UnitDestroyed(unitID)
if commanderManualFireReload[unitID] then
commanderManualFireReload[unitID] = nil
end
end
function widget:Shutdown()
Spring.SendCommands({"tooltip 1"})
Spring.SetDrawSelectionInfo(true)
Spring.SetDrawSelectionInfo(true)
end
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/tatooine/sennex_slaver.lua | 1 | 1730 | sennex_slaver = Creature:new {
objectName = "@mob/creature_names:sennex_slaver",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "sennex",
faction = "pirate",
level = 23,
chanceHit = 0.35,
damageMin = 220,
damageMax = 230,
baseXp = 2443,
baseHAM = 6800,
baseHAMmax = 8300,
armor = 0,
resists = {0,0,0,30,-1,30,-1,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/dressed_sennex_pirate_01.iff",
"object/mobile/dressed_sennex_pirate_02.iff",
"object/mobile/dressed_sennex_pirate_03.iff",
"object/mobile/dressed_sennex_pirate_04.iff",
"object/mobile/dressed_sennex_pirate_05.iff",
"object/mobile/dressed_sennex_pirate_06.iff",
"object/mobile/dressed_sennex_pirate_07.iff",
"object/mobile/dressed_sennex_pirate_08.iff",
"object/mobile/dressed_sennex_pirate_09.iff",
"object/mobile/dressed_sennex_pirate_10.iff",
"object/mobile/dressed_sennex_pirate_11.iff",
"object/mobile/dressed_sennex_pirate_12.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 2500000},
{group = "wearables_common", chance = 2000000},
{group = "heavy_weapons", chance = 2000000},
{group = "tailor_components", chance = 1500000},
{group = "loot_kit_parts", chance = 2000000}
}
}
},
weapons = {"pirate_weapons_heavy"},
conversationTemplate = "",
reactionStf = "@npc_reaction/slang",
attacks = merge(brawlermaster,marksmanmaster)
}
CreatureTemplates:addCreatureTemplate(sennex_slaver, "sennex_slaver")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/weapon/serverobjects.lua | 3 | 7295 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
includeFile("draft_schematic/weapon/component/serverobjects.lua")
includeFile("draft_schematic/weapon/lightsaber/serverobjects.lua")
-- Server Objects
includeFile("draft_schematic/weapon/2h_sword_scythe.lua")
includeFile("draft_schematic/weapon/axe.lua")
includeFile("draft_schematic/weapon/axe_vibro.lua")
includeFile("draft_schematic/weapon/baton_gaderiffi.lua")
includeFile("draft_schematic/weapon/baton_stun.lua")
includeFile("draft_schematic/weapon/battleaxe.lua")
includeFile("draft_schematic/weapon/blaster_cannon.lua")
includeFile("draft_schematic/weapon/carbine_blaster_cdef.lua")
includeFile("draft_schematic/weapon/carbine_quest_smuggler_underslung.lua")
includeFile("draft_schematic/weapon/cleaver.lua")
includeFile("draft_schematic/weapon/executioners_hack.lua")
includeFile("draft_schematic/weapon/heavy_acid_beam.lua")
includeFile("draft_schematic/weapon/heavy_lightning_beam.lua")
includeFile("draft_schematic/weapon/heavy_particle_beam.lua")
includeFile("draft_schematic/weapon/heavy_rocket_launcher.lua")
includeFile("draft_schematic/weapon/ion_cannon.lua")
includeFile("draft_schematic/weapon/katana.lua")
includeFile("draft_schematic/weapon/knife_stone.lua")
includeFile("draft_schematic/weapon/knife_survival.lua")
includeFile("draft_schematic/weapon/knife_twilek_dagger.lua")
includeFile("draft_schematic/weapon/knife_vibroblade.lua")
includeFile("draft_schematic/weapon/knuckler_vibro.lua")
includeFile("draft_schematic/weapon/lance_nightsister.lua")
includeFile("draft_schematic/weapon/lance_vibro.lua")
includeFile("draft_schematic/weapon/lance_vibro_controller_fp.lua")
includeFile("draft_schematic/weapon/laser_cannon.lua")
includeFile("draft_schematic/weapon/lightsaber_basic.lua")
includeFile("draft_schematic/weapon/maul.lua")
includeFile("draft_schematic/weapon/pistol_blaster_cdef.lua")
includeFile("draft_schematic/weapon/pistol_blaster_d18.lua")
includeFile("draft_schematic/weapon/pistol_blaster_dh17.lua")
includeFile("draft_schematic/weapon/pistol_blaster_dl44.lua")
includeFile("draft_schematic/weapon/pistol_blaster_dl44_metal.lua")
includeFile("draft_schematic/weapon/pistol_blaster_power5.lua")
includeFile("draft_schematic/weapon/pistol_blaster_scout_trooper.lua")
includeFile("draft_schematic/weapon/pistol_blaster_short_range_combat.lua")
includeFile("draft_schematic/weapon/pistol_de_10.lua")
includeFile("draft_schematic/weapon/pistol_disrupter_dx2.lua")
includeFile("draft_schematic/weapon/pistol_flechette_fwg5.lua")
includeFile("draft_schematic/weapon/pistol_flechette_fwg5_quest.lua")
includeFile("draft_schematic/weapon/pistol_geo_sonic_blaster.lua")
includeFile("draft_schematic/weapon/pistol_launcher.lua")
includeFile("draft_schematic/weapon/pistol_projectile_striker.lua")
includeFile("draft_schematic/weapon/pistol_quest_imperial_navy_formal.lua")
includeFile("draft_schematic/weapon/pistol_republic_blaster.lua")
includeFile("draft_schematic/weapon/pistol_republic_blaster_quest.lua")
includeFile("draft_schematic/weapon/pistol_scatter.lua")
includeFile("draft_schematic/weapon/poleaxe_vibro.lua")
includeFile("draft_schematic/weapon/razor_knuckler.lua")
includeFile("draft_schematic/weapon/rifle_acid_beam.lua")
includeFile("draft_schematic/weapon/rifle_beam.lua")
includeFile("draft_schematic/weapon/rifle_berserker.lua")
includeFile("draft_schematic/weapon/rifle_blaster_cdef.lua")
includeFile("draft_schematic/weapon/rifle_blaster_dlt20.lua")
includeFile("draft_schematic/weapon/rifle_blaster_dlt20a.lua")
includeFile("draft_schematic/weapon/rifle_blaster_e11.lua")
includeFile("draft_schematic/weapon/rifle_blaster_ionization_jawa.lua")
includeFile("draft_schematic/weapon/rifle_blaster_laser_rifle.lua")
includeFile("draft_schematic/weapon/rifle_bowcaster.lua")
includeFile("draft_schematic/weapon/rifle_disrupter_dxr6.lua")
includeFile("draft_schematic/weapon/rifle_flame_thrower.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_dh17_carbine.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_dh17_carbine_snubnose.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_e11_carbine.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_e11_carbine_quest.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_ee3.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_imperial_scout_carbine.lua")
includeFile("draft_schematic/weapon/rifle_light_blaster_laser_carbine.lua")
includeFile("draft_schematic/weapon/rifle_lightning.lua")
includeFile("draft_schematic/weapon/rifle_projectile_tusken.lua")
includeFile("draft_schematic/weapon/rifle_quest_rebel_longrifle.lua")
includeFile("draft_schematic/weapon/rifle_sonic_sg82.lua")
includeFile("draft_schematic/weapon/rifle_spray_stick_stohli.lua")
includeFile("draft_schematic/weapon/rifle_t21.lua")
includeFile("draft_schematic/weapon/rifle_tangle_gun7.lua")
includeFile("draft_schematic/weapon/rifle_tenloss_disrupter.lua")
includeFile("draft_schematic/weapon/staff.lua")
includeFile("draft_schematic/weapon/staff_metal.lua")
includeFile("draft_schematic/weapon/staff_reinforced.lua")
includeFile("draft_schematic/weapon/sword.lua")
includeFile("draft_schematic/weapon/sword_curved.lua")
includeFile("draft_schematic/weapon/sword_ryyk_blade.lua")
includeFile("draft_schematic/weapon/turbo_laser.lua")
| agpl-3.0 |
mretegan/crispy | crispy/quanty/templates/4d_Td_XPS_4s.lua | 1 | 21072 | --------------------------------------------------------------------------------
-- Quanty input file generated using Crispy. If you use this file please cite
-- the following reference: http://dx.doi.org/10.5281/zenodo.1008184.
--
-- elements: 4d
-- symmetry: Td
-- experiment: XPS
-- edge: N1 (4s)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Set the verbosity of the calculation. For increased verbosity use the values
-- 0x00FF or 0xFFFF.
--------------------------------------------------------------------------------
Verbosity($Verbosity)
--------------------------------------------------------------------------------
-- Define the parameters of the calculation.
--------------------------------------------------------------------------------
Temperature = $Temperature -- Temperature (Kelvin).
NPsis = $NPsis -- Number of states to consider in the spectra calculation.
NPsisAuto = $NPsisAuto -- Determine the number of state automatically.
NConfigurations = $NConfigurations -- Number of configurations.
Emin = $XEmin -- Minimum value of the energy range (eV).
Emax = $XEmax -- Maximum value of the energy range (eV).
NPoints = $XNPoints -- Number of points of the spectra.
ZeroShift = $XZeroShift -- Shift that brings the edge or line energy to approximately zero (eV).
ExperimentalShift = $XExperimentalShift -- Experimental edge or line energy (eV).
Gaussian = $XGaussian -- Gaussian FWHM (eV).
Lorentzian = $XLorentzian -- Lorentzian FWHM (eV).
Gamma = $XGamma -- Lorentzian FWHM used in the spectra calculation (eV).
WaveVector = $XWaveVector -- Wave vector.
Ev = $XFirstPolarization -- Vertical polarization.
Eh = $XSecondPolarization -- Horizontal polarization.
SpectraToCalculate = $SpectraToCalculate -- Types of spectra to calculate.
DenseBorder = $DenseBorder -- Number of determinants where we switch from dense methods to sparse methods.
ShiftSpectra = $ShiftSpectra -- If enabled, shift the spectra in the experimental energy range.
Prefix = "$Prefix" -- File name prefix.
--------------------------------------------------------------------------------
-- Toggle the Hamiltonian terms.
--------------------------------------------------------------------------------
AtomicTerm = $AtomicTerm
CrystalFieldTerm = $CrystalFieldTerm
MagneticFieldTerm = $MagneticFieldTerm
ExchangeFieldTerm = $ExchangeFieldTerm
--------------------------------------------------------------------------------
-- Define the number of electrons, shells, etc.
--------------------------------------------------------------------------------
NBosons = 0
NFermions = 12
NElectrons_4s = 2
NElectrons_4d = $NElectrons_4d
IndexDn_4s = {0}
IndexUp_4s = {1}
IndexDn_4d = {2, 4, 6, 8, 10}
IndexUp_4d = {3, 5, 7, 9, 11}
--------------------------------------------------------------------------------
-- Initialize the Hamiltonians.
--------------------------------------------------------------------------------
H_i = 0
H_f = 0
--------------------------------------------------------------------------------
-- Define the atomic term.
--------------------------------------------------------------------------------
N_4s = NewOperator("Number", NFermions, IndexUp_4s, IndexUp_4s, {1})
+ NewOperator("Number", NFermions, IndexDn_4s, IndexDn_4s, {1})
N_4d = NewOperator("Number", NFermions, IndexUp_4d, IndexUp_4d, {1, 1, 1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_4d, IndexDn_4d, {1, 1, 1, 1, 1})
if AtomicTerm then
F0_4d_4d = NewOperator("U", NFermions, IndexUp_4d, IndexDn_4d, {1, 0, 0})
F2_4d_4d = NewOperator("U", NFermions, IndexUp_4d, IndexDn_4d, {0, 1, 0})
F4_4d_4d = NewOperator("U", NFermions, IndexUp_4d, IndexDn_4d, {0, 0, 1})
F0_4s_4d = NewOperator("U", NFermions, IndexUp_4s, IndexDn_4s, IndexUp_4d, IndexDn_4d, {1}, {0})
G2_4s_4d = NewOperator("U", NFermions, IndexUp_4s, IndexDn_4s, IndexUp_4d, IndexDn_4d, {0}, {1})
U_4d_4d_i = $U(4d,4d)_i_value
F2_4d_4d_i = $F2(4d,4d)_i_value * $F2(4d,4d)_i_scaleFactor
F4_4d_4d_i = $F4(4d,4d)_i_value * $F4(4d,4d)_i_scaleFactor
F0_4d_4d_i = U_4d_4d_i + 2 / 63 * F2_4d_4d_i + 2 / 63 * F4_4d_4d_i
U_4d_4d_f = $U(4d,4d)_f_value
F2_4d_4d_f = $F2(4d,4d)_f_value * $F2(4d,4d)_f_scaleFactor
F4_4d_4d_f = $F4(4d,4d)_f_value * $F4(4d,4d)_f_scaleFactor
F0_4d_4d_f = U_4d_4d_f + 2 / 63 * F2_4d_4d_f + 2 / 63 * F4_4d_4d_f
U_4s_4d_f = $U(4s,4d)_f_value
G2_4s_4d_f = $G2(4s,4d)_f_value * $G2(4s,4d)_f_scaleFactor
F0_4s_4d_f = U_4s_4d_f + 1 / 10 * G2_4s_4d_f
H_i = H_i + Chop(
F0_4d_4d_i * F0_4d_4d
+ F2_4d_4d_i * F2_4d_4d
+ F4_4d_4d_i * F4_4d_4d)
H_f = H_f + Chop(
F0_4d_4d_f * F0_4d_4d
+ F2_4d_4d_f * F2_4d_4d
+ F4_4d_4d_f * F4_4d_4d
+ F0_4s_4d_f * F0_4s_4d
+ G2_4s_4d_f * G2_4s_4d)
ldots_4d = NewOperator("ldots", NFermions, IndexUp_4d, IndexDn_4d)
zeta_4d_i = $zeta(4d)_i_value * $zeta(4d)_i_scaleFactor
zeta_4d_f = $zeta(4d)_f_value * $zeta(4d)_f_scaleFactor
H_i = H_i + Chop(
zeta_4d_i * ldots_4d)
H_f = H_f + Chop(
zeta_4d_f * ldots_4d)
end
--------------------------------------------------------------------------------
-- Define the crystal field term.
--------------------------------------------------------------------------------
if CrystalFieldTerm then
-- PotentialExpandedOnClm("Td", 2, {Ee, Et2})
-- tenDq_4d = NewOperator("CF", NFermions, IndexUp_4d, IndexDn_4d, PotentialExpandedOnClm("Td", 2, {-0.6, 0.4}))
Akm = {{4, 0, -2.1}, {4, -4, -1.5 * sqrt(0.7)}, {4, 4, -1.5 * sqrt(0.7)}}
tenDq_4d = NewOperator("CF", NFermions, IndexUp_4d, IndexDn_4d, Akm)
tenDq_4d_i = $10Dq(4d)_i_value
io.write("Energies of the 4d orbitals in the initial Hamiltonian (crystal field term only):\n")
io.write("================\n")
io.write("Irrep. E\n")
io.write("================\n")
io.write(string.format("e %8.3f\n", -0.6 * tenDq_4d_i))
io.write(string.format("t2 %8.3f\n", 0.4 * tenDq_4d_i))
io.write("================\n")
io.write("\n")
tenDq_4d_f = $10Dq(4d)_f_value
H_i = H_i + Chop(
tenDq_4d_i * tenDq_4d)
H_f = H_f + Chop(
tenDq_4d_f * tenDq_4d)
end
--------------------------------------------------------------------------------
-- Define the magnetic field and exchange field terms.
--------------------------------------------------------------------------------
Sx_4d = NewOperator("Sx", NFermions, IndexUp_4d, IndexDn_4d)
Sy_4d = NewOperator("Sy", NFermions, IndexUp_4d, IndexDn_4d)
Sz_4d = NewOperator("Sz", NFermions, IndexUp_4d, IndexDn_4d)
Ssqr_4d = NewOperator("Ssqr", NFermions, IndexUp_4d, IndexDn_4d)
Splus_4d = NewOperator("Splus", NFermions, IndexUp_4d, IndexDn_4d)
Smin_4d = NewOperator("Smin", NFermions, IndexUp_4d, IndexDn_4d)
Lx_4d = NewOperator("Lx", NFermions, IndexUp_4d, IndexDn_4d)
Ly_4d = NewOperator("Ly", NFermions, IndexUp_4d, IndexDn_4d)
Lz_4d = NewOperator("Lz", NFermions, IndexUp_4d, IndexDn_4d)
Lsqr_4d = NewOperator("Lsqr", NFermions, IndexUp_4d, IndexDn_4d)
Lplus_4d = NewOperator("Lplus", NFermions, IndexUp_4d, IndexDn_4d)
Lmin_4d = NewOperator("Lmin", NFermions, IndexUp_4d, IndexDn_4d)
Jx_4d = NewOperator("Jx", NFermions, IndexUp_4d, IndexDn_4d)
Jy_4d = NewOperator("Jy", NFermions, IndexUp_4d, IndexDn_4d)
Jz_4d = NewOperator("Jz", NFermions, IndexUp_4d, IndexDn_4d)
Jsqr_4d = NewOperator("Jsqr", NFermions, IndexUp_4d, IndexDn_4d)
Jplus_4d = NewOperator("Jplus", NFermions, IndexUp_4d, IndexDn_4d)
Jmin_4d = NewOperator("Jmin", NFermions, IndexUp_4d, IndexDn_4d)
Tx_4d = NewOperator("Tx", NFermions, IndexUp_4d, IndexDn_4d)
Ty_4d = NewOperator("Ty", NFermions, IndexUp_4d, IndexDn_4d)
Tz_4d = NewOperator("Tz", NFermions, IndexUp_4d, IndexDn_4d)
Sx = Sx_4d
Sy = Sy_4d
Sz = Sz_4d
Lx = Lx_4d
Ly = Ly_4d
Lz = Lz_4d
Jx = Jx_4d
Jy = Jy_4d
Jz = Jz_4d
Tx = Tx_4d
Ty = Ty_4d
Tz = Tz_4d
Ssqr = Sx * Sx + Sy * Sy + Sz * Sz
Lsqr = Lx * Lx + Ly * Ly + Lz * Lz
Jsqr = Jx * Jx + Jy * Jy + Jz * Jz
if MagneticFieldTerm then
-- The values are in eV, and not Tesla. To convert from Tesla to eV multiply
-- the value with EnergyUnits.Tesla.value.
Bx_i = $Bx_i_value
By_i = $By_i_value
Bz_i = $Bz_i_value
Bx_f = $Bx_f_value
By_f = $By_f_value
Bz_f = $Bz_f_value
H_i = H_i + Chop(
Bx_i * (2 * Sx + Lx)
+ By_i * (2 * Sy + Ly)
+ Bz_i * (2 * Sz + Lz))
H_f = H_f + Chop(
Bx_f * (2 * Sx + Lx)
+ By_f * (2 * Sy + Ly)
+ Bz_f * (2 * Sz + Lz))
end
if ExchangeFieldTerm then
Hx_i = $Hx_i_value
Hy_i = $Hy_i_value
Hz_i = $Hz_i_value
Hx_f = $Hx_f_value
Hy_f = $Hy_f_value
Hz_f = $Hz_f_value
H_i = H_i + Chop(
Hx_i * Sx
+ Hy_i * Sy
+ Hz_i * Sz)
H_f = H_f + Chop(
Hx_f * Sx
+ Hy_f * Sy
+ Hz_f * Sz)
end
--------------------------------------------------------------------------------
-- Define the restrictions and set the number of initial states.
--------------------------------------------------------------------------------
InitialRestrictions = {NFermions, NBosons, {"11 0000000000", NElectrons_4s, NElectrons_4s},
{"00 1111111111", NElectrons_4d, NElectrons_4d}}
FinalRestrictions = {NFermions, NBosons, {"11 0000000000", NElectrons_4s - 1, NElectrons_4s - 1},
{"00 1111111111", NElectrons_4d, NElectrons_4d}}
CalculationRestrictions = nil
--------------------------------------------------------------------------------
-- Define some helper functions.
--------------------------------------------------------------------------------
function MatrixToOperator(Matrix, StartIndex)
-- Transform a matrix to an operator.
local Operator = 0
for i = 1, #Matrix do
for j = 1, #Matrix do
local Weight = Matrix[i][j]
Operator = Operator + NewOperator("Number", #Matrix + StartIndex, i + StartIndex - 1, j + StartIndex - 1) * Weight
end
end
Operator.Chop()
return Operator
end
function ValueInTable(Value, Table)
-- Check if a value is in a table.
for _, v in ipairs(Table) do
if Value == v then
return true
end
end
return false
end
function GetSpectrum(G, Ids, dZ, NOperators, NPsis)
-- Extract the spectrum corresponding to the operators identified using the
-- Ids argument. The returned spectrum is a weighted sum, where the weights
-- are the Boltzmann probabilities.
--
-- @param G userdata: Spectrum object as returned by the functions defined in Quanty, i.e. one spectrum
-- for each operator and each wavefunction.
-- @param Ids table: Indexes of the operators that are considered in the returned spectrum.
-- @param dZ table: Boltzmann prefactors for each of the spectrum in the spectra object.
-- @param NOperators number: Number of transition operators.
-- @param NPsis number: Number of wavefunctions.
if not (type(Ids) == "table") then
Ids = {Ids}
end
local Id = 1
local dZs = {}
for i = 1, NOperators do
for _ = 1, NPsis do
if ValueInTable(i, Ids) then
table.insert(dZs, dZ[Id])
else
table.insert(dZs, 0)
end
Id = Id + 1
end
end
return Spectra.Sum(G, dZs)
end
function SaveSpectrum(G, Filename, Gaussian, Lorentzian, Pcl)
if Pcl == nil then
Pcl = 1
end
G = -1 / math.pi / Pcl * G
G.Broaden(Gaussian, Lorentzian)
G.Print({{"file", Filename .. ".spec"}})
end
function CalculateT(Basis, Eps, K)
-- Calculate the transition operator in the basis of tesseral harmonics for
-- an arbitrary polarization and wave-vector (for quadrupole operators).
--
-- @param Basis table: Operators forming the basis.
-- @param Eps table: Cartesian components of the polarization vector.
-- @param K table: Cartesian components of the wave-vector.
if #Basis == 3 then
-- The basis for the dipolar operators must be in the order x, y, z.
T = Eps[1] * Basis[1]
+ Eps[2] * Basis[2]
+ Eps[3] * Basis[3]
elseif #Basis == 5 then
-- The basis for the quadrupolar operators must be in the order xy, xz, yz, x2y2, z2.
T = (Eps[1] * K[2] + Eps[2] * K[1]) / math.sqrt(3) * Basis[1]
+ (Eps[1] * K[3] + Eps[3] * K[1]) / math.sqrt(3) * Basis[2]
+ (Eps[2] * K[3] + Eps[3] * K[2]) / math.sqrt(3) * Basis[3]
+ (Eps[1] * K[1] - Eps[2] * K[2]) / math.sqrt(3) * Basis[4]
+ (Eps[3] * K[3]) * Basis[5]
end
return Chop(T)
end
function DotProduct(a, b)
return Chop(a[1] * b[1] + a[2] * b[2] + a[3] * b[3])
end
function WavefunctionsAndBoltzmannFactors(H, NPsis, NPsisAuto, Temperature, Threshold, StartRestrictions, CalculationRestrictions)
-- Calculate the wavefunctions and Boltzmann factors of a Hamiltonian.
--
-- @param H userdata: Hamiltonian for which to calculate the wavefunctions.
-- @param NPsis number: The number of wavefunctions.
-- @param NPsisAuto boolean: Determine automatically the number of wavefunctions that are populated at the specified
-- temperature and within the threshold.
-- @param Temperature number: The temperature in eV.
-- @param Threshold number: Threshold used to determine the number of wavefunction in the automatic procedure.
-- @param StartRestrictions table: Occupancy restrictions at the start of the calculation.
-- @param CalculationRestrictions table: Occupancy restrictions used during the calculation.
-- @return table: The calculated wavefunctions.
-- @return table: The calculated Boltzmann factors.
if Threshold == nil then
Threshold = 1e-8
end
local dZ = {}
local Z = 0
local Psis
if NPsisAuto == true and NPsis ~= 1 then
NPsis = 4
local NPsisIncrement = 8
local NPsisIsConverged = false
while not NPsisIsConverged do
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
if E_gs == nil then
E_gs = Psis[1] * H * Psis[1]
end
Z = 0
for i, Psi in ipairs(Psis) do
local E = Psi * H * Psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
if dZ[i] / Z < Threshold then
i = i - 1
NPsisIsConverged = true
NPsis = i
Psis = {unpack(Psis, 1, i)}
dZ = {unpack(dZ, 1, i)}
break
end
end
if NPsisIsConverged then
break
else
NPsis = NPsis + NPsisIncrement
end
end
else
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
local E_gs = Psis[1] * H * Psis[1]
Z = 0
for i, psi in ipairs(Psis) do
local E = psi * H * psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
end
end
-- Normalize the Boltzmann factors to unity.
for i in ipairs(dZ) do
dZ[i] = dZ[i] / Z
end
return Psis, dZ
end
function PrintHamiltonianAnalysis(Psis, Operators, dZ, Header, Footer)
io.write(Header)
for i, Psi in ipairs(Psis) do
io.write(string.format("%5d", i))
for j, Operator in ipairs(Operators) do
if j == 1 then
io.write(string.format("%12.6f", Complex.Re(Psi * Operator * Psi)))
elseif Operator == "dZ" then
io.write(string.format("%12.2e", dZ[i]))
else
io.write(string.format("%10.4f", Complex.Re(Psi * Operator * Psi)))
end
end
io.write("\n")
end
io.write(Footer)
end
function CalculateEnergyDifference(H1, H1Restrictions, H2, H2Restrictions)
-- Calculate the energy difference between the lowest eigenstates of the two
-- Hamiltonians.
--
-- @param H1 userdata: The first Hamiltonian.
-- @param H1Restrictions table: Restrictions of the occupation numbers for H1.
-- @param H2 userdata: The second Hamiltonian.
-- @param H2Restrictions table: Restrictions of the occupation numbers for H2.
local E1 = 0.0
local E2 = 0.0
if H1 ~= nil and H1Restrictions ~= nil then
Psis1, _ = WavefunctionsAndBoltzmannFactors(H1, 1, false, 0, nil, H1Restrictions, nil)
E1 = Psis1[1] * H1 * Psis1[1]
end
if H2 ~= nil and H2Restrictions ~= nil then
Psis2, _ = WavefunctionsAndBoltzmannFactors(H2, 1, false, 0, nil, H2Restrictions, nil)
E2 = Psis2[1] * H2 * Psis2[1]
end
return E1 - E2
end
--------------------------------------------------------------------------------
-- Analyze the initial Hamiltonian.
--------------------------------------------------------------------------------
Temperature = Temperature * EnergyUnits.Kelvin.value
Sk = DotProduct(WaveVector, {Sx, Sy, Sz})
Lk = DotProduct(WaveVector, {Lx, Ly, Lz})
Jk = DotProduct(WaveVector, {Jx, Jy, Jz})
Tk = DotProduct(WaveVector, {Tx, Ty, Tz})
Operators = {H_i, Ssqr, Lsqr, Jsqr, Sk, Lk, Jk, Tk, ldots_4d, N_4s, N_4d, "dZ"}
Header = "Analysis of the %s Hamiltonian:\n"
Header = Header .. "=================================================================================================================================\n"
Header = Header .. "State E <S^2> <L^2> <J^2> <Sk> <Lk> <Jk> <Tk> <l.s> <N_4s> <N_4d> dZ\n"
Header = Header .. "=================================================================================================================================\n"
Footer = "=================================================================================================================================\n"
local Psis_i, dZ_i = WavefunctionsAndBoltzmannFactors(H_i, NPsis, NPsisAuto, Temperature, nil, InitialRestrictions, CalculationRestrictions)
PrintHamiltonianAnalysis(Psis_i, Operators, dZ_i, string.format(Header, "initial"), Footer)
-- Stop the calculation if no spectra need to be calculated.
if next(SpectraToCalculate) == nil then
return
end
--------------------------------------------------------------------------------
-- Calculate and save the spectra.
--------------------------------------------------------------------------------
T_4s_4d = {}
for i = 1, NElectrons_4s / 2 do
T_4s_4d[2*i - 1] = NewOperator("An", NFermions, IndexDn_4s[i])
T_4s_4d[2*i] = NewOperator("An", NFermions, IndexUp_4s[i])
end
if ShiftSpectra then
Emin = Emin - (ZeroShift + ExperimentalShift)
Emax = Emax - (ZeroShift + ExperimentalShift)
end
if CalculationRestrictions == nil then
G_4s_4d = CreateSpectra(H_f, T_4s_4d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"DenseBorder", DenseBorder}})
else
G_4s_4d = CreateSpectra(H_f, T_4s_4d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"Restrictions", CalculationRestrictions}, {"DenseBorder", DenseBorder}})
end
if ShiftSpectra then
G_4s_4d.Shift(ZeroShift + ExperimentalShift)
end
-- Create a list with the Boltzmann probabilities for a given operator and wavefunction.
local dZ_4s_4d = {}
for _ in ipairs(T_4s_4d) do
for j in ipairs(Psis_i) do
table.insert(dZ_4s_4d, dZ_i[j])
end
end
-- Subtract the broadening used in the spectra calculations from the Lorentzian table.
for i, _ in ipairs(Lorentzian) do
-- The FWHM is the second value in each pair.
Lorentzian[i][2] = Lorentzian[i][2] - Gamma
end
Spectrum = "Photoemission"
if ValueInTable(Spectrum, SpectraToCalculate) then
SpectrumIds = {}
c = 1
for i, Operator in ipairs(T_4s_4d) do
table.insert(SpectrumIds, c)
c = c + 1
end
Giso = GetSpectrum(G_4s_4d, SpectrumIds, dZ_4s_4d, #T_4s_4d, #Psis_i)
SaveSpectrum(Giso, Prefix .. "_pho", Gaussian, Lorentzian)
end
| mit |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ui/ui_planet_corellia.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_tangible_ui_ui_planet_corellia = object_tangible_ui_shared_ui_planet_corellia:new {
}
ObjectTemplates:addTemplate(object_tangible_ui_ui_planet_corellia, "object/tangible/ui/ui_planet_corellia.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/booster/bst_mission_reward_rebel_novaldex_hypernova.lua | 3 | 2392 | --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_booster_bst_mission_reward_rebel_novaldex_hypernova = object_tangible_ship_components_booster_shared_bst_mission_reward_rebel_novaldex_hypernova:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_booster_bst_mission_reward_rebel_novaldex_hypernova, "object/tangible/ship/components/booster/bst_mission_reward_rebel_novaldex_hypernova.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/recycler/metal_recycler.lua | 1 | 3796 | --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_recycler_metal_recycler = object_tangible_recycler_shared_metal_recycler:new {
templateType = RECYCLETOOL,
gameObjectType = 32780,
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" },
customizationOptions = {},
customizationDefaults = {},
toolType = 18,
resourceTypes = {"ferrous", "nonferrous"},
containerComponent = "RecycleToolContainerComponent",
numberExperimentalProperties = {1, 1, 1},
experimentalProperties = {"XX", "XX", "XX"},
experimentalWeights = {1, 1, 1},
experimentalGroupTitles = {"null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "hitpoints"},
experimentalMin = {0, 0, 1000},
experimentalMax = {0, 0, 1000},
experimentalPrecision = {0, 0, 0},
experimentalCombineType = {0, 0, 4},
}
ObjectTemplates:addTemplate(object_tangible_recycler_metal_recycler, "object/tangible/recycler/metal_recycler.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_nym_patrol_strong_nikto_m.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_dressed_nym_patrol_strong_nikto_m = object_mobile_shared_dressed_nym_patrol_strong_nikto_m:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_nym_patrol_strong_nikto_m, "object/mobile/dressed_nym_patrol_strong_nikto_m.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/intangible/ship/ywing_pcd.lua | 3 | 2188 | --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_ship_ywing_pcd = object_intangible_ship_shared_ywing_pcd:new {
}
ObjectTemplates:addTemplate(object_intangible_ship_ywing_pcd, "object/intangible/ship/ywing_pcd.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/poi/lok_nymshenchman_medium3.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_lok_nymshenchman_medium3 = object_building_poi_shared_lok_nymshenchman_medium3:new {
gameObjectType = 531,
}
ObjectTemplates:addTemplate(object_building_poi_lok_nymshenchman_medium3, "object/building/poi/lok_nymshenchman_medium3.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/quest/talus/nurla_employee.lua | 1 | 2726 | nurla_employee = Creature:new {
objectName = "@mob/creature_names:businessman",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "townsperson",
faction = "townsperson",
level = 4,
chanceHit = 0.24,
damageMin = 40,
damageMax = 45,
baseXp = 62,
baseHAM = 113,
baseHAMmax = 138,
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 = AIENABLED + CONVERSABLE,
diet = HERBIVORE,
templates = { "object/mobile/dressed_commoner_fat_zabrak_male_01.iff",
"object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff",
"object/mobile/dressed_commoner_tatooine_aqualish_female_07.iff",
"object/mobile/dressed_commoner_naboo_twilek_female_01.iff",
"object/mobile/dressed_commoner_old_zabrak_male_01.iff",
"object/mobile/dressed_commoner_tatooine_sullustan_male_03.iff",
"object/mobile/dressed_commoner_naboo_human_male_08.iff",
"object/mobile/dressed_commoner_tatooine_nikto_male_03.iff",
"object/mobile/dressed_commoner_old_human_female_02.iff",
"object/mobile/dressed_commoner_tatooine_nikto_male_07.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_05.iff",
"object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff",
"object/mobile/dressed_commoner_naboo_human_male_03.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_02.iff",
"object/mobile/dressed_commoner_tatooine_trandoshan_male_02.iff",
"object/mobile/dressed_commoner_naboo_human_female_07.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_01.iff",
"object/mobile/dressed_commoner_tatooine_trandoshan_female_04.iff",
"object/mobile/dressed_diplomat_human_female_01.iff",
"object/mobile/dressed_diplomat_human_female_02.iff",
"object/mobile/dressed_diplomat_human_female_03.iff",
"object/mobile/dressed_diplomat_human_male_01.iff",
"object/mobile/dressed_diplomat_human_male_02.iff",
"object/mobile/dressed_diplomat_human_male_03.iff",
"object/mobile/dressed_diplomat_trando_female_01.iff",
"object/mobile/dressed_diplomat_trando_male_01.iff",
"object/mobile/dressed_diplomat_zabrak_female_01.iff",
"object/mobile/dressed_diplomat_zabrak_female_02.iff",
"object/mobile/dressed_diplomat_zabrak_male_01.iff",
"object/mobile/dressed_diplomat_zabrak_male_02.iff"
},
lootGroups = {},
weapons = {},
conversationTemplate = "nurla_slinthiss_mission_target_convotemplate",
attacks = brawlermaster
}
CreatureTemplates:addCreatureTemplate(nurla_employee, "nurla_employee")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/weapon/melee/sword/crafted_saber/sword_lightsaber_one_handed_s3_gen3.lua | 1 | 6224 | --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_sword_crafted_saber_sword_lightsaber_one_handed_s3_gen3 = object_weapon_melee_sword_crafted_saber_shared_sword_lightsaber_one_handed_s3_gen3: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, 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,
-- combat_meleespecialize_twohandlightsaber, combat_meleespecialize_polearmlightsaber, jedi_general
xpType = "jedi_general",
-- See http://www.ocdsoft.com/files/certifications.xls
certificationsRequired = { "cert_onehandlightsaber_gen3" },
-- See http://www.ocdsoft.com/files/accuracy.xls
creatureAccuracyModifiers = { "onehandlightsaber_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 = { "onehandlightsaber_speed" },
-- Leave blank for now
damageModifiers = { },
-- The values below are the default values. To be used for blue frog objects primarily
healthAttackCost = 35,
actionAttackCost = 50,
mindAttackCost = 85,
forceCost = 36,
pointBlankRange = 0,
pointBlankAccuracy = 20,
idealRange = 3,
idealAccuracy = 15,
maxRange = 5,
maxRangeAccuracy = 5,
minDamage = 130,
maxDamage = 220,
attackSpeed = 4.5,
woundsRatio = 25,
defenderToughnessModifiers = { "lightsaber_toughness" },
noTrade = 1,
childObjects = {
{templateFile = "object/tangible/inventory/lightsaber_inventory_3.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, 130, 220, 4.5, 19, 40, 35, 50, 85},
experimentalMax = {0, 0, 150, 260, 4.2, 31, 36, 30, 45, 55},
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_sword_crafted_saber_sword_lightsaber_one_handed_s3_gen3, "object/weapon/melee/sword/crafted_saber/sword_lightsaber_one_handed_s3_gen3.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/quest/talus/hagrin_aide.lua | 1 | 2849 | hagrin_aide = Creature:new {
objectName = "@mob/creature_names:businessman",
socialGroup = "townsperson",
faction = "townsperson",
level = 4,
chanceHit = 0.24,
damageMin = 40,
damageMax = 45,
baseXp = 62,
baseHAM = 113,
baseHAMmax = 138,
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 = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = { "object/mobile/dressed_commoner_fat_zabrak_male_01.iff",
"object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff",
"object/mobile/dressed_commoner_tatooine_aqualish_female_07.iff",
"object/mobile/dressed_commoner_naboo_twilek_female_01.iff",
"object/mobile/dressed_commoner_old_zabrak_male_01.iff",
"object/mobile/dressed_commoner_tatooine_sullustan_male_03.iff",
"object/mobile/dressed_commoner_naboo_human_male_08.iff",
"object/mobile/dressed_commoner_tatooine_nikto_male_03.iff",
"object/mobile/dressed_commoner_old_human_female_02.iff",
"object/mobile/dressed_commoner_tatooine_nikto_male_07.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_05.iff",
"object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff",
"object/mobile/dressed_commoner_naboo_human_male_03.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_02.iff",
"object/mobile/dressed_commoner_tatooine_trandoshan_male_02.iff",
"object/mobile/dressed_commoner_naboo_human_female_07.iff",
"object/mobile/dressed_commoner_tatooine_bith_male_01.iff",
"object/mobile/dressed_commoner_tatooine_trandoshan_female_04.iff",
"object/mobile/dressed_diplomat_human_female_01.iff",
"object/mobile/dressed_diplomat_human_female_02.iff",
"object/mobile/dressed_diplomat_human_female_03.iff",
"object/mobile/dressed_diplomat_human_male_01.iff",
"object/mobile/dressed_diplomat_human_male_02.iff",
"object/mobile/dressed_diplomat_human_male_03.iff",
"object/mobile/dressed_diplomat_trando_female_01.iff",
"object/mobile/dressed_diplomat_trando_male_01.iff",
"object/mobile/dressed_diplomat_zabrak_female_01.iff",
"object/mobile/dressed_diplomat_zabrak_female_02.iff",
"object/mobile/dressed_diplomat_zabrak_male_01.iff",
"object/mobile/dressed_diplomat_zabrak_male_02.iff"
},
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "wearables_common", chance = 3000000},
{group = "loot_kit_parts", chance = 2000000},
{group = "tailor_components", chance = 1000000},
}
}
},
weapons = {},
conversationTemplate = "",
attacks = brawlermaster
}
CreatureTemplates:addCreatureTemplate(hagrin_aide, "hagrin_aide")
| agpl-3.0 |
RamiLego4Game/P-MUG | p-mug/drawers/material.lua | 1 | 6616 | local Path = string.sub(..., 1, -string.len(".drawers.material"))
local Class = require(Path..".third-party.middleclass")
local DBase = require(Path..".api.drawerbase")
local Material = require(Path..".third-party.material-love")
local DMaterial = Class("drawer.material",DBase)
local Config = {}
Config.rectangleExpand = 1 --How much to expand the rectangle when it's down ?
Config.circleExpand = 1 --How much to expand the circle when it's down ?
--[[
Drawing Args:
rectangle shapes:
DShadow, DExpand, RColor, NColor, HColor
DShadow: boolean: To disable the shadow or not.
DExpand: boolean: To disable the expand affect or not.
RColor: table: {red,green,blue,alpha} The color of the ripple.
NColor: table: {red,green,blue,alpha} The color of the rectangle when not hovered.
HColor: table: {red,green,blue,alpha} The color of the rectangle when hovered.
circle shapes:
DShadow, DExpand, RColor, NColor, HColor
DShadow: boolean: To disable the shadow or not.
DExpand: boolean: To disable the expand affect or not.
RColor: table: {red,green,blue,alpha} The color of the ripple.
NColor: table: {red,green,blue,alpha} The color of the rectangle when not hovered.
HColor: table: {red,green,blue,alpha} The color of the rectangle when hovered.
text shapes:
FontType, FontColor
FontType: string: The type of the material robot font to use.
FontColor: table: {red,green,blue,alpha} The color of the text.
spinner shapes:
SpinnerColor
SpinnerColor: table: {red,green,blue,alpha} The color of the spinner.
]]
function DMaterial:initialize()
DBase.initialize(self)
self.sd = {}
end
function DMaterial:getName()
return "Material"
end
function DMaterial:draw_spinner(shape,obj)
local dtype, x, y, r, m, s, p = shape:getDType()
local Color = shape:getDrawingArgs()
if not shape.spinner then
shape.spinner = Material.spinner.new(r,m,s,p)
shape:addUpdate(function(dt,shp,obj) shp.spinner:update(dt) end)
end
love.graphics.setColor(Color or {Material.colors.main("teal")})
shape.spinner:draw(x,y,r)
end
function DMaterial:draw_circle(shape,obj)
local dtype, x, y, r = shape:getDType()
local DShadow, DExpand, RColor, NColor, HColor = shape:getDrawingArgs()
if not shape.ripple then --Creating the ripple
shape.rippleStarted = false
shape.ripple = Material.ripple.circle(x,y,r+Config.circleExpand,0.5)
shape:addUpdate(function(dt,shp,obj) shp.ripple:update(dt) end) --Adding a hook to update the ripple.
end
local isDown, dx, dy = shape:isDown()
local isHovered = shape:isHovered()
if isDown and not DExpand then r = r+Config.circleExpand end --Expand Effect
if isDown then
if not shape.rippleStarted then
shape.ripple.circle.x, shape.ripple.circle.y, shape.ripple.circle.r = x,y,r
shape.ripple:start(dx,dy, unpack(RColor or {Material.colors.main("blue")}))
shape.rippleStarted = true
end
else
if shape.rippleStarted then
shape.ripple.circle.x, shape.ripple.circle.y, shape.ripple.circle.r = x,y,r
shape.ripple:fade()
shape.rippleStarted = false
end
end
if isHovered or isDown then
love.graphics.setColor(HColor or {Material.colors("grey","100")})
else
love.graphics.setColor(NColor or {Material.colors.main("white")})
end
local _, _, z = obj:getPosition()
if z and not DShadow then
z = math.floor(z+0.5) if z > 4 then z = 4 end
if isDown then Material.fab(x,y,r,z+1)
elseif z > 0 then Material.fab(x,y,r,z) end
end
love.graphics.setLineStyle("smooth")
love.graphics.circle("fill",x,y,r,20)
shape.ripple:draw()
end
function DMaterial:draw_rectangle(shape,obj)
local dtype, x, y, w, h = shape:getDType()
local DShadow, DExpand, RColor, NColor, HColor = shape:getDrawingArgs()
if not shape.ripple then --Creating the ripple
shape.rippleStarted = false
shape.ripple = Material.ripple.box(x-Config.rectangleExpand,y-Config.rectangleExpand,w+Config.rectangleExpand*2,h+Config.rectangleExpand*2,0.5)
shape:addUpdate(function(dt,shp,obj) shp.ripple:update(dt) end) --Adding a hook to update the ripple.
end
local isDown, dx, dy = shape:isDown()
local isHovered = shape:isHovered()
if isDown and not DExpand then x,y,w,h = x-Config.rectangleExpand,y-Config.rectangleExpand,w+Config.rectangleExpand*2,h+Config.rectangleExpand*2 end --Expand Effect
if isDown then
if not shape.rippleStarted then
shape.ripple.box.x, shape.ripple.box.y, shape.ripple.box.w, shape.ripple.box.h = x,y,w,h
shape.ripple:start(dx,dy, unpack(RColor or {Material.colors.main("blue")}))
shape.rippleStarted = true
end
else
if shape.rippleStarted then
shape.ripple.box.x, shape.ripple.box.y, shape.ripple.box.w, shape.ripple.box.h = x,y,w,h
shape.ripple:fade()
shape.rippleStarted = false
end
end
if isHovered or isDown then
love.graphics.setColor(HColor or {Material.colors("grey","100")})
else
love.graphics.setColor(NColor or {Material.colors.main("white")})
end
love.graphics.setLineWidth(1)
local _, _, z = obj:getPosition()
if z and not DShadow then
z = math.floor(z+0.5) if z > 4 then z = 4 end
if isDown then Material.shadow.draw(x,y,w,h,false,z+1)
elseif z > 0 then Material.shadow.draw(x,y,w,h,false,z) end
end
love.graphics.setLineStyle("smooth")
love.graphics.rectangle("fill",x,y,w,h)
shape.ripple:draw()
end
function DMaterial:draw_line(shape,obj)
local dtype, x1, y1, x2, y2, width = shape:getDType()
local NColor, HColor = shape:getDrawingArgs()
local isDown, dx, dy = shape:isDown()
local isHovered = shape:isHovered()
if isHovered or isDown then
love.graphics.setColor(HColor or {Material.colors("blue-grey","600")})
else
love.graphics.setColor(NColor or {Material.colors.main("blue-grey")})
end
love.graphics.setLineWidth(width)
love.graphics.setLineStyle("smooth")
love.graphics.line(x1, y1, x2, y2)
end
function DMaterial:draw_text(shape,obj)
local fonttype, fontcolor = shape:getDrawingArgs()
local dtype, t, x, y, l, a = shape:getDType(Material.roboto[fonttype or "button"])
love.graphics.setColor(fontcolor or {Material.colors.mono("black","button")})
love.graphics.setLineWidth(1)
love.graphics.setFont(Material.roboto[fonttype or "button"])
love.graphics.printf(t, x, y, l, a)
end
function DMaterial:draw_icon(shape,obj)
local dtype, icon, x,y, rotation, color, active, invert = shape:getDType()
Material.icons.draw(icon, x,y, rotation, color, active, invert)
end
return DMaterial
| mit |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_rebel_specforce_guerilla_human_male_01.lua | 3 | 2300 | --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_rebel_specforce_guerilla_human_male_01 = object_mobile_shared_dressed_rebel_specforce_guerilla_human_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_rebel_specforce_guerilla_human_male_01, "object/mobile/dressed_rebel_specforce_guerilla_human_male_01.iff")
| agpl-3.0 |
motoschifo/mame | 3rdparty/genie/tests/actions/vstudio/cs2002/test_files.lua | 57 | 2430 | --
-- tests/actions/vstudio/cs2002/test_files.lua
-- Validate generation of <Files/> block in Visual Studio 2002 .csproj
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
--
T.vstudio_cs2002_files = { }
local suite = T.vstudio_cs2002_files
local cs2002 = premake.vstudio.cs2002
--
-- Setup
--
local sln, prj
function suite.setup()
sln = test.createsolution()
end
local function prepare()
premake.bake.buildconfigs()
prj = premake.solution.getproject(sln, 1)
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
cs2002.Files(prj)
end
--
-- Test grouping and nesting
--
function suite.SimpleSourceFile()
files { "Hello.cs" }
prepare()
test.capture [[
<File
RelPath = "Hello.cs"
BuildAction = "Compile"
SubType = "Code"
/>
]]
end
function suite.NestedSourceFile()
files { "Src/Hello.cs" }
prepare()
test.capture [[
<File
RelPath = "Src\Hello.cs"
BuildAction = "Compile"
SubType = "Code"
/>
]]
end
--
-- The relative path to the file is correct for files that live outside
-- the project's folder.
--
function suite.filesUseRelativePath_onOutOfTreePath()
files { "../Src/Hello.cs" }
prepare()
test.capture [[
<File
RelPath = "..\Src\Hello.cs"
BuildAction = "Compile"
SubType = "Code"
/>
]]
end
--
-- Test file dependencies
--
function suite.SimpleResourceDependency()
files { "Resources.resx", "Resources.cs" }
prepare()
test.capture [[
<File
RelPath = "Resources.cs"
BuildAction = "Compile"
SubType = "Code"
/>
<File
RelPath = "Resources.resx"
BuildAction = "EmbeddedResource"
DependentUpon = "Resources.cs"
/>
]]
end
--
-- Test build actions
--
function suite.BuildAction_Compile()
files { "Hello.png" }
configuration "*.png"
buildaction "Compile"
prepare()
test.capture [[
<File
RelPath = "Hello.png"
BuildAction = "Compile"
/>
]]
end
function suite.BuildAction_Copy()
files { "Hello.png" }
configuration "*.png"
buildaction "Copy"
prepare()
test.capture [[
<File
RelPath = "Hello.png"
BuildAction = "Content"
/>
]]
end
function suite.BuildAction_Embed()
files { "Hello.png" }
configuration "*.png"
buildaction "Embed"
prepare()
test.capture [[
<File
RelPath = "Hello.png"
BuildAction = "EmbeddedResource"
/>
]]
end
| gpl-2.0 |
ouyangruoxue/pokerServer | server/lua/netease/history/queryChatroomMsg.lua | 1 | 2189 | --[[
-- 作者:左笑林
-- 日期:2017-03-31
-- 文件名:queryChatroomMsg.lua
-- 功能:聊天室云端历史消息查询
-- 版权说明:南京正溯网络科技有限公司.版权所有©copy right.
-- 1.此接口有频控限制,每分钟可调用不超过1200次
--]]
-- 参数说明
-- 参数 类型 必须 说明
-- roomid long 是 聊天室id
-- accid String 是 用户账号
-- timetag long 是 查询的时间戳锚点,13位。reverse=1时timetag为起始时间戳,reverse=2时timetag为终止时间戳
-- limit int 是 本次查询的消息条数上限(最多200条),小于等于0,或者大于200,会提示参数错误
-- reverse int 否 1按时间正序排列,2按时间降序排列。其它返回参数414错误。默认是2按时间降序排列
local cjson = require "cjson"
local reqArgs = require "common.request_args"
local http = require "resty.http"
local neteaseHead = require "netease.netease_header"
local httpc = http:new()
local currentRequestArgs = reqArgs.new()
local args = currentRequestArgs.getArgs()
local headr = neteaseHead.getNeteaseHttpHeadr(0)
local res, err = httpc:request_uri("https://api.netease.im/nimserver/history/queryChatroomMsg.action",{
method = "POST",
body = ngx.encode_args(args),
ssl_verify = false, -- 需要关闭这项才能发起https请求
headers = headr,
})
if not res then
ngx.say(cjson.encode(err))
return
end
ngx.status = res.status
--code
--200成功
--414 其它错误(具体看待,可能是注册重复等)
--403 非法操作
--416 频率控制
--431 http重复请求
--500 服务器内部错误
-- 聊天室相关错误码
-- 13001 IM主连接状态异常
-- 13002 聊天室状态异常
-- 13003 账号在黑名单中,不允许进入聊天室
-- 13004 在禁言列表中,不允许发言
--"Content-Type": "application/json; charset=utf-8"
-- {
-- "code":200,
-- "size":xxx,//总共消息条数
-- "msgs":[各种类型的消息参见"历史消息查询返回的消息格式说明",JSONArray] // 其中的msgid字段为客户端消息id,对应单聊和群群云端历史消息中的msgid为服务端消息id
-- }
ngx.say(res.body) | mit |
ashrafboss/V1_ASHRAF_EN_AR | libs/dateparser.lua | 114 | 6213 | local difftime, time, date = os.difftime, os.time, os.date
local format = string.format
local tremove, tinsert = table.remove, table.insert
local pcall, pairs, ipairs, tostring, tonumber, type, setmetatable = pcall, pairs, ipairs, tostring, tonumber, type, setmetatable
local dateparser={}
--we shall use the host OS's time conversion facilities. Dealing with all those leap seconds by hand can be such a bore.
local unix_timestamp
do
local now = time()
local local_UTC_offset_sec = difftime(time(date("!*t", now)), time(date("*t", now)))
unix_timestamp = function(t, offset_sec)
local success, improper_time = pcall(time, t)
if not success or not improper_time then return nil, "invalid date. os.time says: " .. (improper_time or "nothing") end
return improper_time - local_UTC_offset_sec - offset_sec
end
end
local formats = {} -- format names
local format_func = setmetatable({}, {__mode='v'}) --format functions
---register a date format parsing function
function dateparser.register_format(format_name, format_function)
if type(format_name)~="string" or type(format_function)~='function' then return nil, "improper arguments, can't register format handler" end
local found
for i, f in ipairs(format_func) do --for ordering
if f==format_function then
found=true
break
end
end
if not found then
tinsert(format_func, format_function)
end
formats[format_name] = format_function
return true
end
---register a date format parsing function
function dateparser.unregister_format(format_name)
if type(format_name)~="string" then return nil, "format name must be a string" end
formats[format_name]=nil
end
---return the function responsible for handling format_name date strings
function dateparser.get_format_function(format_name)
return formats[format_name] or nil, ("format %s not registered"):format(format_name)
end
---try to parse date string
--@param str date string
--@param date_format optional date format name, if known
--@return unix timestamp if str can be parsed; nil, error otherwise.
function dateparser.parse(str, date_format)
local success, res, err
if date_format then
if not formats[date_format] then return 'unknown date format: ' .. tostring(date_format) end
success, res = pcall(formats[date_format], str)
else
for i, func in ipairs(format_func) do
success, res = pcall(func, str)
if success and res then return res end
end
end
return success and res
end
dateparser.register_format('W3CDTF', function(rest)
local year, day_of_year, month, day, week
local hour, minute, second, second_fraction, offset_hours
local alt_rest
year, rest = rest:match("^(%d%d%d%d)%-?(.*)$")
day_of_year, alt_rest = rest:match("^(%d%d%d)%-?(.*)$")
if day_of_year then rest=alt_rest end
month, rest = rest:match("^(%d%d)%-?(.*)$")
day, rest = rest:match("^(%d%d)(.*)$")
if #rest>0 then
rest = rest:match("^T(.*)$")
hour, rest = rest:match("^([0-2][0-9]):?(.*)$")
minute, rest = rest:match("^([0-6][0-9]):?(.*)$")
second, rest = rest:match("^([0-6][0-9])(.*)$")
second_fraction, alt_rest = rest:match("^%.(%d+)(.*)$")
if second_fraction then
rest=alt_rest
end
if rest=="Z" then
rest=""
offset_hours=0
else
local sign, offset_h, offset_m
sign, offset_h, rest = rest:match("^([+-])(%d%d)%:?(.*)$")
local offset_m, alt_rest = rest:match("^(%d%d)(.*)$")
if offset_m then rest=alt_rest end
offset_hours = tonumber(sign .. offset_h) + (tonumber(offset_m) or 0)/60
end
if #rest>0 then return nil end
end
year = tonumber(year)
local d = {
year = year and (year > 100 and year or (year < 50 and (year + 2000) or (year + 1900))),
month = tonumber(month) or 1,
day = tonumber(day) or 1,
hour = tonumber(hour) or 0,
min = tonumber(minute) or 0,
sec = tonumber(second) or 0,
isdst = false
}
local t = unix_timestamp(d, (offset_hours or 0) * 3600)
if second_fraction then
return t + tonumber("0."..second_fraction)
else
return t
end
end)
do
local tz_table = { --taken from http://www.timeanddate.com/library/abbreviations/timezones/
A = 1, B = 2, C = 3, D = 4, E=5, F = 6, G = 7, H = 8, I = 9,
K = 10, L = 11, M = 12, N = -1, O = -2, P = -3, Q = -4, R = -5,
S = -6, T = -7, U = -8, V = -9, W = -10, X = -11, Y = -12,
Z = 0,
EST = -5, EDT = -4, CST = -6, CDT = -5,
MST = -7, MDT = -6, PST = -8, PDT = -7,
GMT = 0, UT = 0, UTC = 0
}
local month_val = {Jan=1, Feb=2, Mar=3, Apr=4, May=5, Jun=6, Jul=7, Aug=8, Sep=9, Oct=10, Nov=11, Dec=12}
dateparser.register_format('RFC2822', function(rest)
local year, month, day, day_of_year, week_of_year, weekday
local hour, minute, second, second_fraction, offset_hours
local alt_rest
weekday, alt_rest = rest:match("^(%w%w%w),%s+(.*)$")
if weekday then rest=alt_rest end
day, rest=rest:match("^(%d%d?)%s+(.*)$")
month, rest=rest:match("^(%w%w%w)%s+(.*)$")
month = month_val[month]
year, rest = rest:match("^(%d%d%d?%d?)%s+(.*)$")
hour, rest = rest:match("^(%d%d?):(.*)$")
minute, rest = rest:match("^(%d%d?)(.*)$")
second, alt_rest = rest:match("^:(%d%d)(.*)$")
if second then rest = alt_rest end
local tz, offset_sign, offset_h, offset_m
tz, alt_rest = rest:match("^%s+(%u+)(.*)$")
if tz then
rest = alt_rest
offset_hours = tz_table[tz]
else
offset_sign, offset_h, offset_m, rest = rest:match("^%s+([+-])(%d%d)(%d%d)%s*(.*)$")
offset_hours = tonumber(offset_sign .. offset_h) + (tonumber(offset_m) or 0)/60
end
if #rest>0 or not (year and day and month and hour and minute) then
return nil
end
year = tonumber(year)
local d = {
year = year and ((year > 100) and year or (year < 50 and (year + 2000) or (year + 1900))),
month = month,
day = tonumber(day),
hour= tonumber(hour) or 0,
min = tonumber(minute) or 0,
sec = tonumber(second) or 0,
isdst = false
}
return unix_timestamp(d, offset_hours * 3600)
end)
end
dateparser.register_format('RFC822', formats.RFC2822) --2822 supercedes 822, but is not a strict superset. For our intents and purposes though, it's perfectly good enough
dateparser.register_format('RFC3339', formats.W3CDTF) --RFC3339 is a subset of W3CDTF
return dateparser
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/goggles/goggles_s06.lua | 1 | 4279 | --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_goggles_goggles_s06 = object_tangible_wearables_goggles_shared_goggles_s06: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",
"object/mobile/vendor/bothan_female.iff",
"object/mobile/vendor/bothan_male.iff",
"object/mobile/vendor/devaronian_male.iff",
"object/mobile/vendor/human_female.iff",
"object/mobile/vendor/human_male.iff",
"object/mobile/vendor/ithorian_female.iff",
"object/mobile/vendor/ithorian_male.iff",
"object/mobile/vendor/moncal_female.iff",
"object/mobile/vendor/moncal_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/wookiee_female.iff",
"object/mobile/vendor/wookiee_male.iff",
"object/mobile/vendor/zabrak_female.iff",
"object/mobile/vendor/zabrak_male.iff" },
objectMenuComponent = "GogglesObjectMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_wearables_goggles_goggles_s06, "object/tangible/wearables/goggles/goggles_s06.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/ship/prototype_hutt_light.lua | 3 | 2188 | --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_prototype_hutt_light = object_ship_shared_prototype_hutt_light:new {
}
ObjectTemplates:addTemplate(object_ship_prototype_hutt_light, "object/ship/prototype_hutt_light.iff")
| agpl-3.0 |
ld-test/kong | spec/integration/admin_api/kong_routes_spec.lua | 20 | 2623 | local json = require "cjson"
local http_client = require "kong.tools.http_client"
local spec_helper = require "spec.spec_helpers"
local utils = require "kong.tools.utils"
describe("Admin API", function()
setup(function()
spec_helper.prepare_db()
spec_helper.start_kong()
end)
teardown(function()
spec_helper.stop_kong()
end)
describe("Kong routes", function()
describe("/", function()
local constants = require "kong.constants"
it("should return Kong's version and a welcome message", function()
local response, status = http_client.get(spec_helper.API_URL)
assert.are.equal(200, status)
local body = json.decode(response)
assert.truthy(body.version)
assert.truthy(body.tagline)
assert.are.same(constants.VERSION, body.version)
end)
it("should have a Server header", function()
local _, status, headers = http_client.get(spec_helper.API_URL)
assert.are.same(200, status)
assert.are.same(string.format("%s/%s", constants.NAME, constants.VERSION), headers.server)
assert.falsy(headers.via) -- Via is only set for proxied requests
end)
it("should return method not allowed", function()
local res, status = http_client.post(spec_helper.API_URL)
assert.are.same(405, status)
assert.are.same("Method not allowed", json.decode(res).message)
local res, status = http_client.delete(spec_helper.API_URL)
assert.are.same(405, status)
assert.are.same("Method not allowed", json.decode(res).message)
local res, status = http_client.put(spec_helper.API_URL)
assert.are.same(405, status)
assert.are.same("Method not allowed", json.decode(res).message)
local res, status = http_client.patch(spec_helper.API_URL)
assert.are.same(405, status)
assert.are.same("Method not allowed", json.decode(res).message)
end)
end)
end)
describe("/status", function()
it("should return status information", function()
local response, status = http_client.get(spec_helper.API_URL.."/status")
assert.are.equal(200, status)
local body = json.decode(response)
assert.truthy(body)
assert.are.equal(7, utils.table_size(body))
assert.truthy(body.connections_accepted)
assert.truthy(body.connections_active)
assert.truthy(body.connections_handled)
assert.truthy(body.connections_reading)
assert.truthy(body.connections_writing)
assert.truthy(body.connections_waiting)
assert.truthy(body.total_requests)
end)
end)
end)
| apache-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/crafted/droid_interface/ddi_mk2.lua | 2 | 3120 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_ship_crafted_droid_interface_ddi_mk2 = object_tangible_ship_crafted_droid_interface_shared_ddi_mk2:new {
numberExperimentalProperties = {1, 1, 2, 1, 2, 2, 1, 2, 3},
experimentalProperties = {"XX", "XX", "OQ", "UT", "XX", "OQ", "UT", "OQ", "UT", "XX", "CD", "OQ", "CD", "OQ", "SR"},
experimentalWeights = {1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "exp_hp", "null", "exp_mass", "exp_armorhpmax", "null", "exp_energy_maintenance", "exp_droid_speed"},
experimentalSubGroupTitles = {"null", "null", "ship_component_hitpoints", "efficiency", "ship_component_mass", "ship_component_armor", "energy_efficiency", "ship_component_energy_required", "ship_component_droidinterface_speed"},
experimentalMin = {0, 0, 293, 1, 1150, 147, 1, 604, 30},
experimentalMax = {0, 0, 397, 1, 850, 198, 1, 446, 22},
experimentalPrecision = {0, 0, 1, 0, 1, 1, 0, 1, 1},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_ship_crafted_droid_interface_ddi_mk2, "object/tangible/ship/crafted/droid_interface/ddi_mk2.iff")
| agpl-3.0 |
mretegan/crispy | crispy/quanty/templates/5d_Td_XPS_3s.lua | 1 | 21072 | --------------------------------------------------------------------------------
-- Quanty input file generated using Crispy. If you use this file please cite
-- the following reference: http://dx.doi.org/10.5281/zenodo.1008184.
--
-- elements: 5d
-- symmetry: Td
-- experiment: XPS
-- edge: M1 (3s)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Set the verbosity of the calculation. For increased verbosity use the values
-- 0x00FF or 0xFFFF.
--------------------------------------------------------------------------------
Verbosity($Verbosity)
--------------------------------------------------------------------------------
-- Define the parameters of the calculation.
--------------------------------------------------------------------------------
Temperature = $Temperature -- Temperature (Kelvin).
NPsis = $NPsis -- Number of states to consider in the spectra calculation.
NPsisAuto = $NPsisAuto -- Determine the number of state automatically.
NConfigurations = $NConfigurations -- Number of configurations.
Emin = $XEmin -- Minimum value of the energy range (eV).
Emax = $XEmax -- Maximum value of the energy range (eV).
NPoints = $XNPoints -- Number of points of the spectra.
ZeroShift = $XZeroShift -- Shift that brings the edge or line energy to approximately zero (eV).
ExperimentalShift = $XExperimentalShift -- Experimental edge or line energy (eV).
Gaussian = $XGaussian -- Gaussian FWHM (eV).
Lorentzian = $XLorentzian -- Lorentzian FWHM (eV).
Gamma = $XGamma -- Lorentzian FWHM used in the spectra calculation (eV).
WaveVector = $XWaveVector -- Wave vector.
Ev = $XFirstPolarization -- Vertical polarization.
Eh = $XSecondPolarization -- Horizontal polarization.
SpectraToCalculate = $SpectraToCalculate -- Types of spectra to calculate.
DenseBorder = $DenseBorder -- Number of determinants where we switch from dense methods to sparse methods.
ShiftSpectra = $ShiftSpectra -- If enabled, shift the spectra in the experimental energy range.
Prefix = "$Prefix" -- File name prefix.
--------------------------------------------------------------------------------
-- Toggle the Hamiltonian terms.
--------------------------------------------------------------------------------
AtomicTerm = $AtomicTerm
CrystalFieldTerm = $CrystalFieldTerm
MagneticFieldTerm = $MagneticFieldTerm
ExchangeFieldTerm = $ExchangeFieldTerm
--------------------------------------------------------------------------------
-- Define the number of electrons, shells, etc.
--------------------------------------------------------------------------------
NBosons = 0
NFermions = 12
NElectrons_3s = 2
NElectrons_5d = $NElectrons_5d
IndexDn_3s = {0}
IndexUp_3s = {1}
IndexDn_5d = {2, 4, 6, 8, 10}
IndexUp_5d = {3, 5, 7, 9, 11}
--------------------------------------------------------------------------------
-- Initialize the Hamiltonians.
--------------------------------------------------------------------------------
H_i = 0
H_f = 0
--------------------------------------------------------------------------------
-- Define the atomic term.
--------------------------------------------------------------------------------
N_3s = NewOperator("Number", NFermions, IndexUp_3s, IndexUp_3s, {1})
+ NewOperator("Number", NFermions, IndexDn_3s, IndexDn_3s, {1})
N_5d = NewOperator("Number", NFermions, IndexUp_5d, IndexUp_5d, {1, 1, 1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_5d, IndexDn_5d, {1, 1, 1, 1, 1})
if AtomicTerm then
F0_5d_5d = NewOperator("U", NFermions, IndexUp_5d, IndexDn_5d, {1, 0, 0})
F2_5d_5d = NewOperator("U", NFermions, IndexUp_5d, IndexDn_5d, {0, 1, 0})
F4_5d_5d = NewOperator("U", NFermions, IndexUp_5d, IndexDn_5d, {0, 0, 1})
F0_3s_5d = NewOperator("U", NFermions, IndexUp_3s, IndexDn_3s, IndexUp_5d, IndexDn_5d, {1}, {0})
G2_3s_5d = NewOperator("U", NFermions, IndexUp_3s, IndexDn_3s, IndexUp_5d, IndexDn_5d, {0}, {1})
U_5d_5d_i = $U(5d,5d)_i_value
F2_5d_5d_i = $F2(5d,5d)_i_value * $F2(5d,5d)_i_scaleFactor
F4_5d_5d_i = $F4(5d,5d)_i_value * $F4(5d,5d)_i_scaleFactor
F0_5d_5d_i = U_5d_5d_i + 2 / 63 * F2_5d_5d_i + 2 / 63 * F4_5d_5d_i
U_5d_5d_f = $U(5d,5d)_f_value
F2_5d_5d_f = $F2(5d,5d)_f_value * $F2(5d,5d)_f_scaleFactor
F4_5d_5d_f = $F4(5d,5d)_f_value * $F4(5d,5d)_f_scaleFactor
F0_5d_5d_f = U_5d_5d_f + 2 / 63 * F2_5d_5d_f + 2 / 63 * F4_5d_5d_f
U_3s_5d_f = $U(3s,5d)_f_value
G2_3s_5d_f = $G2(3s,5d)_f_value * $G2(3s,5d)_f_scaleFactor
F0_3s_5d_f = U_3s_5d_f + 1 / 10 * G2_3s_5d_f
H_i = H_i + Chop(
F0_5d_5d_i * F0_5d_5d
+ F2_5d_5d_i * F2_5d_5d
+ F4_5d_5d_i * F4_5d_5d)
H_f = H_f + Chop(
F0_5d_5d_f * F0_5d_5d
+ F2_5d_5d_f * F2_5d_5d
+ F4_5d_5d_f * F4_5d_5d
+ F0_3s_5d_f * F0_3s_5d
+ G2_3s_5d_f * G2_3s_5d)
ldots_5d = NewOperator("ldots", NFermions, IndexUp_5d, IndexDn_5d)
zeta_5d_i = $zeta(5d)_i_value * $zeta(5d)_i_scaleFactor
zeta_5d_f = $zeta(5d)_f_value * $zeta(5d)_f_scaleFactor
H_i = H_i + Chop(
zeta_5d_i * ldots_5d)
H_f = H_f + Chop(
zeta_5d_f * ldots_5d)
end
--------------------------------------------------------------------------------
-- Define the crystal field term.
--------------------------------------------------------------------------------
if CrystalFieldTerm then
-- PotentialExpandedOnClm("Td", 2, {Ee, Et2})
-- tenDq_5d = NewOperator("CF", NFermions, IndexUp_5d, IndexDn_5d, PotentialExpandedOnClm("Td", 2, {-0.6, 0.4}))
Akm = {{4, 0, -2.1}, {4, -4, -1.5 * sqrt(0.7)}, {4, 4, -1.5 * sqrt(0.7)}}
tenDq_5d = NewOperator("CF", NFermions, IndexUp_5d, IndexDn_5d, Akm)
tenDq_5d_i = $10Dq(5d)_i_value
io.write("Energies of the 5d orbitals in the initial Hamiltonian (crystal field term only):\n")
io.write("================\n")
io.write("Irrep. E\n")
io.write("================\n")
io.write(string.format("e %8.3f\n", -0.6 * tenDq_5d_i))
io.write(string.format("t2 %8.3f\n", 0.4 * tenDq_5d_i))
io.write("================\n")
io.write("\n")
tenDq_5d_f = $10Dq(5d)_f_value
H_i = H_i + Chop(
tenDq_5d_i * tenDq_5d)
H_f = H_f + Chop(
tenDq_5d_f * tenDq_5d)
end
--------------------------------------------------------------------------------
-- Define the magnetic field and exchange field terms.
--------------------------------------------------------------------------------
Sx_5d = NewOperator("Sx", NFermions, IndexUp_5d, IndexDn_5d)
Sy_5d = NewOperator("Sy", NFermions, IndexUp_5d, IndexDn_5d)
Sz_5d = NewOperator("Sz", NFermions, IndexUp_5d, IndexDn_5d)
Ssqr_5d = NewOperator("Ssqr", NFermions, IndexUp_5d, IndexDn_5d)
Splus_5d = NewOperator("Splus", NFermions, IndexUp_5d, IndexDn_5d)
Smin_5d = NewOperator("Smin", NFermions, IndexUp_5d, IndexDn_5d)
Lx_5d = NewOperator("Lx", NFermions, IndexUp_5d, IndexDn_5d)
Ly_5d = NewOperator("Ly", NFermions, IndexUp_5d, IndexDn_5d)
Lz_5d = NewOperator("Lz", NFermions, IndexUp_5d, IndexDn_5d)
Lsqr_5d = NewOperator("Lsqr", NFermions, IndexUp_5d, IndexDn_5d)
Lplus_5d = NewOperator("Lplus", NFermions, IndexUp_5d, IndexDn_5d)
Lmin_5d = NewOperator("Lmin", NFermions, IndexUp_5d, IndexDn_5d)
Jx_5d = NewOperator("Jx", NFermions, IndexUp_5d, IndexDn_5d)
Jy_5d = NewOperator("Jy", NFermions, IndexUp_5d, IndexDn_5d)
Jz_5d = NewOperator("Jz", NFermions, IndexUp_5d, IndexDn_5d)
Jsqr_5d = NewOperator("Jsqr", NFermions, IndexUp_5d, IndexDn_5d)
Jplus_5d = NewOperator("Jplus", NFermions, IndexUp_5d, IndexDn_5d)
Jmin_5d = NewOperator("Jmin", NFermions, IndexUp_5d, IndexDn_5d)
Tx_5d = NewOperator("Tx", NFermions, IndexUp_5d, IndexDn_5d)
Ty_5d = NewOperator("Ty", NFermions, IndexUp_5d, IndexDn_5d)
Tz_5d = NewOperator("Tz", NFermions, IndexUp_5d, IndexDn_5d)
Sx = Sx_5d
Sy = Sy_5d
Sz = Sz_5d
Lx = Lx_5d
Ly = Ly_5d
Lz = Lz_5d
Jx = Jx_5d
Jy = Jy_5d
Jz = Jz_5d
Tx = Tx_5d
Ty = Ty_5d
Tz = Tz_5d
Ssqr = Sx * Sx + Sy * Sy + Sz * Sz
Lsqr = Lx * Lx + Ly * Ly + Lz * Lz
Jsqr = Jx * Jx + Jy * Jy + Jz * Jz
if MagneticFieldTerm then
-- The values are in eV, and not Tesla. To convert from Tesla to eV multiply
-- the value with EnergyUnits.Tesla.value.
Bx_i = $Bx_i_value
By_i = $By_i_value
Bz_i = $Bz_i_value
Bx_f = $Bx_f_value
By_f = $By_f_value
Bz_f = $Bz_f_value
H_i = H_i + Chop(
Bx_i * (2 * Sx + Lx)
+ By_i * (2 * Sy + Ly)
+ Bz_i * (2 * Sz + Lz))
H_f = H_f + Chop(
Bx_f * (2 * Sx + Lx)
+ By_f * (2 * Sy + Ly)
+ Bz_f * (2 * Sz + Lz))
end
if ExchangeFieldTerm then
Hx_i = $Hx_i_value
Hy_i = $Hy_i_value
Hz_i = $Hz_i_value
Hx_f = $Hx_f_value
Hy_f = $Hy_f_value
Hz_f = $Hz_f_value
H_i = H_i + Chop(
Hx_i * Sx
+ Hy_i * Sy
+ Hz_i * Sz)
H_f = H_f + Chop(
Hx_f * Sx
+ Hy_f * Sy
+ Hz_f * Sz)
end
--------------------------------------------------------------------------------
-- Define the restrictions and set the number of initial states.
--------------------------------------------------------------------------------
InitialRestrictions = {NFermions, NBosons, {"11 0000000000", NElectrons_3s, NElectrons_3s},
{"00 1111111111", NElectrons_5d, NElectrons_5d}}
FinalRestrictions = {NFermions, NBosons, {"11 0000000000", NElectrons_3s - 1, NElectrons_3s - 1},
{"00 1111111111", NElectrons_5d, NElectrons_5d}}
CalculationRestrictions = nil
--------------------------------------------------------------------------------
-- Define some helper functions.
--------------------------------------------------------------------------------
function MatrixToOperator(Matrix, StartIndex)
-- Transform a matrix to an operator.
local Operator = 0
for i = 1, #Matrix do
for j = 1, #Matrix do
local Weight = Matrix[i][j]
Operator = Operator + NewOperator("Number", #Matrix + StartIndex, i + StartIndex - 1, j + StartIndex - 1) * Weight
end
end
Operator.Chop()
return Operator
end
function ValueInTable(Value, Table)
-- Check if a value is in a table.
for _, v in ipairs(Table) do
if Value == v then
return true
end
end
return false
end
function GetSpectrum(G, Ids, dZ, NOperators, NPsis)
-- Extract the spectrum corresponding to the operators identified using the
-- Ids argument. The returned spectrum is a weighted sum, where the weights
-- are the Boltzmann probabilities.
--
-- @param G userdata: Spectrum object as returned by the functions defined in Quanty, i.e. one spectrum
-- for each operator and each wavefunction.
-- @param Ids table: Indexes of the operators that are considered in the returned spectrum.
-- @param dZ table: Boltzmann prefactors for each of the spectrum in the spectra object.
-- @param NOperators number: Number of transition operators.
-- @param NPsis number: Number of wavefunctions.
if not (type(Ids) == "table") then
Ids = {Ids}
end
local Id = 1
local dZs = {}
for i = 1, NOperators do
for _ = 1, NPsis do
if ValueInTable(i, Ids) then
table.insert(dZs, dZ[Id])
else
table.insert(dZs, 0)
end
Id = Id + 1
end
end
return Spectra.Sum(G, dZs)
end
function SaveSpectrum(G, Filename, Gaussian, Lorentzian, Pcl)
if Pcl == nil then
Pcl = 1
end
G = -1 / math.pi / Pcl * G
G.Broaden(Gaussian, Lorentzian)
G.Print({{"file", Filename .. ".spec"}})
end
function CalculateT(Basis, Eps, K)
-- Calculate the transition operator in the basis of tesseral harmonics for
-- an arbitrary polarization and wave-vector (for quadrupole operators).
--
-- @param Basis table: Operators forming the basis.
-- @param Eps table: Cartesian components of the polarization vector.
-- @param K table: Cartesian components of the wave-vector.
if #Basis == 3 then
-- The basis for the dipolar operators must be in the order x, y, z.
T = Eps[1] * Basis[1]
+ Eps[2] * Basis[2]
+ Eps[3] * Basis[3]
elseif #Basis == 5 then
-- The basis for the quadrupolar operators must be in the order xy, xz, yz, x2y2, z2.
T = (Eps[1] * K[2] + Eps[2] * K[1]) / math.sqrt(3) * Basis[1]
+ (Eps[1] * K[3] + Eps[3] * K[1]) / math.sqrt(3) * Basis[2]
+ (Eps[2] * K[3] + Eps[3] * K[2]) / math.sqrt(3) * Basis[3]
+ (Eps[1] * K[1] - Eps[2] * K[2]) / math.sqrt(3) * Basis[4]
+ (Eps[3] * K[3]) * Basis[5]
end
return Chop(T)
end
function DotProduct(a, b)
return Chop(a[1] * b[1] + a[2] * b[2] + a[3] * b[3])
end
function WavefunctionsAndBoltzmannFactors(H, NPsis, NPsisAuto, Temperature, Threshold, StartRestrictions, CalculationRestrictions)
-- Calculate the wavefunctions and Boltzmann factors of a Hamiltonian.
--
-- @param H userdata: Hamiltonian for which to calculate the wavefunctions.
-- @param NPsis number: The number of wavefunctions.
-- @param NPsisAuto boolean: Determine automatically the number of wavefunctions that are populated at the specified
-- temperature and within the threshold.
-- @param Temperature number: The temperature in eV.
-- @param Threshold number: Threshold used to determine the number of wavefunction in the automatic procedure.
-- @param StartRestrictions table: Occupancy restrictions at the start of the calculation.
-- @param CalculationRestrictions table: Occupancy restrictions used during the calculation.
-- @return table: The calculated wavefunctions.
-- @return table: The calculated Boltzmann factors.
if Threshold == nil then
Threshold = 1e-8
end
local dZ = {}
local Z = 0
local Psis
if NPsisAuto == true and NPsis ~= 1 then
NPsis = 4
local NPsisIncrement = 8
local NPsisIsConverged = false
while not NPsisIsConverged do
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
if E_gs == nil then
E_gs = Psis[1] * H * Psis[1]
end
Z = 0
for i, Psi in ipairs(Psis) do
local E = Psi * H * Psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
if dZ[i] / Z < Threshold then
i = i - 1
NPsisIsConverged = true
NPsis = i
Psis = {unpack(Psis, 1, i)}
dZ = {unpack(dZ, 1, i)}
break
end
end
if NPsisIsConverged then
break
else
NPsis = NPsis + NPsisIncrement
end
end
else
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
local E_gs = Psis[1] * H * Psis[1]
Z = 0
for i, psi in ipairs(Psis) do
local E = psi * H * psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
end
end
-- Normalize the Boltzmann factors to unity.
for i in ipairs(dZ) do
dZ[i] = dZ[i] / Z
end
return Psis, dZ
end
function PrintHamiltonianAnalysis(Psis, Operators, dZ, Header, Footer)
io.write(Header)
for i, Psi in ipairs(Psis) do
io.write(string.format("%5d", i))
for j, Operator in ipairs(Operators) do
if j == 1 then
io.write(string.format("%12.6f", Complex.Re(Psi * Operator * Psi)))
elseif Operator == "dZ" then
io.write(string.format("%12.2e", dZ[i]))
else
io.write(string.format("%10.4f", Complex.Re(Psi * Operator * Psi)))
end
end
io.write("\n")
end
io.write(Footer)
end
function CalculateEnergyDifference(H1, H1Restrictions, H2, H2Restrictions)
-- Calculate the energy difference between the lowest eigenstates of the two
-- Hamiltonians.
--
-- @param H1 userdata: The first Hamiltonian.
-- @param H1Restrictions table: Restrictions of the occupation numbers for H1.
-- @param H2 userdata: The second Hamiltonian.
-- @param H2Restrictions table: Restrictions of the occupation numbers for H2.
local E1 = 0.0
local E2 = 0.0
if H1 ~= nil and H1Restrictions ~= nil then
Psis1, _ = WavefunctionsAndBoltzmannFactors(H1, 1, false, 0, nil, H1Restrictions, nil)
E1 = Psis1[1] * H1 * Psis1[1]
end
if H2 ~= nil and H2Restrictions ~= nil then
Psis2, _ = WavefunctionsAndBoltzmannFactors(H2, 1, false, 0, nil, H2Restrictions, nil)
E2 = Psis2[1] * H2 * Psis2[1]
end
return E1 - E2
end
--------------------------------------------------------------------------------
-- Analyze the initial Hamiltonian.
--------------------------------------------------------------------------------
Temperature = Temperature * EnergyUnits.Kelvin.value
Sk = DotProduct(WaveVector, {Sx, Sy, Sz})
Lk = DotProduct(WaveVector, {Lx, Ly, Lz})
Jk = DotProduct(WaveVector, {Jx, Jy, Jz})
Tk = DotProduct(WaveVector, {Tx, Ty, Tz})
Operators = {H_i, Ssqr, Lsqr, Jsqr, Sk, Lk, Jk, Tk, ldots_5d, N_3s, N_5d, "dZ"}
Header = "Analysis of the %s Hamiltonian:\n"
Header = Header .. "=================================================================================================================================\n"
Header = Header .. "State E <S^2> <L^2> <J^2> <Sk> <Lk> <Jk> <Tk> <l.s> <N_3s> <N_5d> dZ\n"
Header = Header .. "=================================================================================================================================\n"
Footer = "=================================================================================================================================\n"
local Psis_i, dZ_i = WavefunctionsAndBoltzmannFactors(H_i, NPsis, NPsisAuto, Temperature, nil, InitialRestrictions, CalculationRestrictions)
PrintHamiltonianAnalysis(Psis_i, Operators, dZ_i, string.format(Header, "initial"), Footer)
-- Stop the calculation if no spectra need to be calculated.
if next(SpectraToCalculate) == nil then
return
end
--------------------------------------------------------------------------------
-- Calculate and save the spectra.
--------------------------------------------------------------------------------
T_3s_5d = {}
for i = 1, NElectrons_3s / 2 do
T_3s_5d[2*i - 1] = NewOperator("An", NFermions, IndexDn_3s[i])
T_3s_5d[2*i] = NewOperator("An", NFermions, IndexUp_3s[i])
end
if ShiftSpectra then
Emin = Emin - (ZeroShift + ExperimentalShift)
Emax = Emax - (ZeroShift + ExperimentalShift)
end
if CalculationRestrictions == nil then
G_3s_5d = CreateSpectra(H_f, T_3s_5d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"DenseBorder", DenseBorder}})
else
G_3s_5d = CreateSpectra(H_f, T_3s_5d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"Restrictions", CalculationRestrictions}, {"DenseBorder", DenseBorder}})
end
if ShiftSpectra then
G_3s_5d.Shift(ZeroShift + ExperimentalShift)
end
-- Create a list with the Boltzmann probabilities for a given operator and wavefunction.
local dZ_3s_5d = {}
for _ in ipairs(T_3s_5d) do
for j in ipairs(Psis_i) do
table.insert(dZ_3s_5d, dZ_i[j])
end
end
-- Subtract the broadening used in the spectra calculations from the Lorentzian table.
for i, _ in ipairs(Lorentzian) do
-- The FWHM is the second value in each pair.
Lorentzian[i][2] = Lorentzian[i][2] - Gamma
end
Spectrum = "Photoemission"
if ValueInTable(Spectrum, SpectraToCalculate) then
SpectrumIds = {}
c = 1
for i, Operator in ipairs(T_3s_5d) do
table.insert(SpectrumIds, c)
c = c + 1
end
Giso = GetSpectrum(G_3s_5d, SpectrumIds, dZ_3s_5d, #T_3s_5d, #Psis_i)
SaveSpectrum(Giso, Prefix .. "_pho", Gaussian, Lorentzian)
end
| mit |
devevo/EVO_TEAM | libs/lua-redis.lua | 580 | 35599 | local redis = {
_VERSION = 'redis-lua 2.0.4',
_DESCRIPTION = 'A Lua client library for the redis key value storage system.',
_COPYRIGHT = 'Copyright (C) 2009-2012 Daniele Alessandri',
}
-- The following line is used for backwards compatibility in order to keep the `Redis`
-- global module name. Using `Redis` is now deprecated so you should explicitly assign
-- the module to a local variable when requiring it: `local redis = require('redis')`.
Redis = redis
local unpack = _G.unpack or table.unpack
local network, request, response = {}, {}, {}
local defaults = {
host = '127.0.0.1',
port = 6379,
tcp_nodelay = true,
path = nil
}
local function merge_defaults(parameters)
if parameters == nil then
parameters = {}
end
for k, v in pairs(defaults) do
if parameters[k] == nil then
parameters[k] = defaults[k]
end
end
return parameters
end
local function parse_boolean(v)
if v == '1' or v == 'true' or v == 'TRUE' then
return true
elseif v == '0' or v == 'false' or v == 'FALSE' then
return false
else
return nil
end
end
local function toboolean(value) return value == 1 end
local function sort_request(client, command, key, params)
--[[ params = {
by = 'weight_*',
get = 'object_*',
limit = { 0, 10 },
sort = 'desc',
alpha = true,
} ]]
local query = { key }
if params then
if params.by then
table.insert(query, 'BY')
table.insert(query, params.by)
end
if type(params.limit) == 'table' then
-- TODO: check for lower and upper limits
table.insert(query, 'LIMIT')
table.insert(query, params.limit[1])
table.insert(query, params.limit[2])
end
if params.get then
if (type(params.get) == 'table') then
for _, getarg in pairs(params.get) do
table.insert(query, 'GET')
table.insert(query, getarg)
end
else
table.insert(query, 'GET')
table.insert(query, params.get)
end
end
if params.sort then
table.insert(query, params.sort)
end
if params.alpha == true then
table.insert(query, 'ALPHA')
end
if params.store then
table.insert(query, 'STORE')
table.insert(query, params.store)
end
end
request.multibulk(client, command, query)
end
local function zset_range_request(client, command, ...)
local args, opts = {...}, { }
if #args >= 1 and type(args[#args]) == 'table' then
local options = table.remove(args, #args)
if options.withscores then
table.insert(opts, 'WITHSCORES')
end
end
for _, v in pairs(opts) do table.insert(args, v) end
request.multibulk(client, command, args)
end
local function zset_range_byscore_request(client, command, ...)
local args, opts = {...}, { }
if #args >= 1 and type(args[#args]) == 'table' then
local options = table.remove(args, #args)
if options.limit then
table.insert(opts, 'LIMIT')
table.insert(opts, options.limit.offset or options.limit[1])
table.insert(opts, options.limit.count or options.limit[2])
end
if options.withscores then
table.insert(opts, 'WITHSCORES')
end
end
for _, v in pairs(opts) do table.insert(args, v) end
request.multibulk(client, command, args)
end
local function zset_range_reply(reply, command, ...)
local args = {...}
local opts = args[4]
if opts and (opts.withscores or string.lower(tostring(opts)) == 'withscores') then
local new_reply = { }
for i = 1, #reply, 2 do
table.insert(new_reply, { reply[i], reply[i + 1] })
end
return new_reply
else
return reply
end
end
local function zset_store_request(client, command, ...)
local args, opts = {...}, { }
if #args >= 1 and type(args[#args]) == 'table' then
local options = table.remove(args, #args)
if options.weights and type(options.weights) == 'table' then
table.insert(opts, 'WEIGHTS')
for _, weight in ipairs(options.weights) do
table.insert(opts, weight)
end
end
if options.aggregate then
table.insert(opts, 'AGGREGATE')
table.insert(opts, options.aggregate)
end
end
for _, v in pairs(opts) do table.insert(args, v) end
request.multibulk(client, command, args)
end
local function mset_filter_args(client, command, ...)
local args, arguments = {...}, {}
if (#args == 1 and type(args[1]) == 'table') then
for k,v in pairs(args[1]) do
table.insert(arguments, k)
table.insert(arguments, v)
end
else
arguments = args
end
request.multibulk(client, command, arguments)
end
local function hash_multi_request_builder(builder_callback)
return function(client, command, ...)
local args, arguments = {...}, { }
if #args == 2 then
table.insert(arguments, args[1])
for k, v in pairs(args[2]) do
builder_callback(arguments, k, v)
end
else
arguments = args
end
request.multibulk(client, command, arguments)
end
end
local function parse_info(response)
local info = {}
local current = info
response:gsub('([^\r\n]*)\r\n', function(kv)
if kv == '' then return end
local section = kv:match('^# (%w+)$')
if section then
current = {}
info[section:lower()] = current
return
end
local k,v = kv:match(('([^:]*):([^:]*)'):rep(1))
if k:match('db%d+') then
current[k] = {}
v:gsub(',', function(dbkv)
local dbk,dbv = kv:match('([^:]*)=([^:]*)')
current[k][dbk] = dbv
end)
else
current[k] = v
end
end)
return info
end
local function load_methods(proto, commands)
local client = setmetatable ({}, getmetatable(proto))
for cmd, fn in pairs(commands) do
if type(fn) ~= 'function' then
redis.error('invalid type for command ' .. cmd .. '(must be a function)')
end
client[cmd] = fn
end
for i, v in pairs(proto) do
client[i] = v
end
return client
end
local function create_client(proto, client_socket, commands)
local client = load_methods(proto, commands)
client.error = redis.error
client.network = {
socket = client_socket,
read = network.read,
write = network.write,
}
client.requests = {
multibulk = request.multibulk,
}
return client
end
-- ############################################################################
function network.write(client, buffer)
local _, err = client.network.socket:send(buffer)
if err then client.error(err) end
end
function network.read(client, len)
if len == nil then len = '*l' end
local line, err = client.network.socket:receive(len)
if not err then return line else client.error('connection error: ' .. err) end
end
-- ############################################################################
function response.read(client)
local payload = client.network.read(client)
local prefix, data = payload:sub(1, -#payload), payload:sub(2)
-- status reply
if prefix == '+' then
if data == 'OK' then
return true
elseif data == 'QUEUED' then
return { queued = true }
else
return data
end
-- error reply
elseif prefix == '-' then
return client.error('redis error: ' .. data)
-- integer reply
elseif prefix == ':' then
local number = tonumber(data)
if not number then
if res == 'nil' then
return nil
end
client.error('cannot parse '..res..' as a numeric response.')
end
return number
-- bulk reply
elseif prefix == '$' then
local length = tonumber(data)
if not length then
client.error('cannot parse ' .. length .. ' as data length')
end
if length == -1 then
return nil
end
local nextchunk = client.network.read(client, length + 2)
return nextchunk:sub(1, -3)
-- multibulk reply
elseif prefix == '*' then
local count = tonumber(data)
if count == -1 then
return nil
end
local list = {}
if count > 0 then
local reader = response.read
for i = 1, count do
list[i] = reader(client)
end
end
return list
-- unknown type of reply
else
return client.error('unknown response prefix: ' .. prefix)
end
end
-- ############################################################################
function request.raw(client, buffer)
local bufferType = type(buffer)
if bufferType == 'table' then
client.network.write(client, table.concat(buffer))
elseif bufferType == 'string' then
client.network.write(client, buffer)
else
client.error('argument error: ' .. bufferType)
end
end
function request.multibulk(client, command, ...)
local args = {...}
local argsn = #args
local buffer = { true, true }
if argsn == 1 and type(args[1]) == 'table' then
argsn, args = #args[1], args[1]
end
buffer[1] = '*' .. tostring(argsn + 1) .. "\r\n"
buffer[2] = '$' .. #command .. "\r\n" .. command .. "\r\n"
local table_insert = table.insert
for _, argument in pairs(args) do
local s_argument = tostring(argument)
table_insert(buffer, '$' .. #s_argument .. "\r\n" .. s_argument .. "\r\n")
end
client.network.write(client, table.concat(buffer))
end
-- ############################################################################
local function custom(command, send, parse)
command = string.upper(command)
return function(client, ...)
send(client, command, ...)
local reply = response.read(client)
if type(reply) == 'table' and reply.queued then
reply.parser = parse
return reply
else
if parse then
return parse(reply, command, ...)
end
return reply
end
end
end
local function command(command, opts)
if opts == nil or type(opts) == 'function' then
return custom(command, request.multibulk, opts)
else
return custom(command, opts.request or request.multibulk, opts.response)
end
end
local define_command_impl = function(target, name, opts)
local opts = opts or {}
target[string.lower(name)] = custom(
opts.command or string.upper(name),
opts.request or request.multibulk,
opts.response or nil
)
end
local undefine_command_impl = function(target, name)
target[string.lower(name)] = nil
end
-- ############################################################################
local client_prototype = {}
client_prototype.raw_cmd = function(client, buffer)
request.raw(client, buffer .. "\r\n")
return response.read(client)
end
-- obsolete
client_prototype.define_command = function(client, name, opts)
define_command_impl(client, name, opts)
end
-- obsolete
client_prototype.undefine_command = function(client, name)
undefine_command_impl(client, name)
end
client_prototype.quit = function(client)
request.multibulk(client, 'QUIT')
client.network.socket:shutdown()
return true
end
client_prototype.shutdown = function(client)
request.multibulk(client, 'SHUTDOWN')
client.network.socket:shutdown()
end
-- Command pipelining
client_prototype.pipeline = function(client, block)
local requests, replies, parsers = {}, {}, {}
local table_insert = table.insert
local socket_write, socket_read = client.network.write, client.network.read
client.network.write = function(_, buffer)
table_insert(requests, buffer)
end
-- TODO: this hack is necessary to temporarily reuse the current
-- request -> response handling implementation of redis-lua
-- without further changes in the code, but it will surely
-- disappear when the new command-definition infrastructure
-- will finally be in place.
client.network.read = function() return '+QUEUED' end
local pipeline = setmetatable({}, {
__index = function(env, name)
local cmd = client[name]
if not cmd then
client.error('unknown redis command: ' .. name, 2)
end
return function(self, ...)
local reply = cmd(client, ...)
table_insert(parsers, #requests, reply.parser)
return reply
end
end
})
local success, retval = pcall(block, pipeline)
client.network.write, client.network.read = socket_write, socket_read
if not success then client.error(retval, 0) end
client.network.write(client, table.concat(requests, ''))
for i = 1, #requests do
local reply, parser = response.read(client), parsers[i]
if parser then
reply = parser(reply)
end
table_insert(replies, i, reply)
end
return replies, #requests
end
-- Publish/Subscribe
do
local channels = function(channels)
if type(channels) == 'string' then
channels = { channels }
end
return channels
end
local subscribe = function(client, ...)
request.multibulk(client, 'subscribe', ...)
end
local psubscribe = function(client, ...)
request.multibulk(client, 'psubscribe', ...)
end
local unsubscribe = function(client, ...)
request.multibulk(client, 'unsubscribe')
end
local punsubscribe = function(client, ...)
request.multibulk(client, 'punsubscribe')
end
local consumer_loop = function(client)
local aborting, subscriptions = false, 0
local abort = function()
if not aborting then
unsubscribe(client)
punsubscribe(client)
aborting = true
end
end
return coroutine.wrap(function()
while true do
local message
local response = response.read(client)
if response[1] == 'pmessage' then
message = {
kind = response[1],
pattern = response[2],
channel = response[3],
payload = response[4],
}
else
message = {
kind = response[1],
channel = response[2],
payload = response[3],
}
end
if string.match(message.kind, '^p?subscribe$') then
subscriptions = subscriptions + 1
end
if string.match(message.kind, '^p?unsubscribe$') then
subscriptions = subscriptions - 1
end
if aborting and subscriptions == 0 then
break
end
coroutine.yield(message, abort)
end
end)
end
client_prototype.pubsub = function(client, subscriptions)
if type(subscriptions) == 'table' then
if subscriptions.subscribe then
subscribe(client, channels(subscriptions.subscribe))
end
if subscriptions.psubscribe then
psubscribe(client, channels(subscriptions.psubscribe))
end
end
return consumer_loop(client)
end
end
-- Redis transactions (MULTI/EXEC)
do
local function identity(...) return ... end
local emptytable = {}
local function initialize_transaction(client, options, block, queued_parsers)
local table_insert = table.insert
local coro = coroutine.create(block)
if options.watch then
local watch_keys = {}
for _, key in pairs(options.watch) do
table_insert(watch_keys, key)
end
if #watch_keys > 0 then
client:watch(unpack(watch_keys))
end
end
local transaction_client = setmetatable({}, {__index=client})
transaction_client.exec = function(...)
client.error('cannot use EXEC inside a transaction block')
end
transaction_client.multi = function(...)
coroutine.yield()
end
transaction_client.commands_queued = function()
return #queued_parsers
end
assert(coroutine.resume(coro, transaction_client))
transaction_client.multi = nil
transaction_client.discard = function(...)
local reply = client:discard()
for i, v in pairs(queued_parsers) do
queued_parsers[i]=nil
end
coro = initialize_transaction(client, options, block, queued_parsers)
return reply
end
transaction_client.watch = function(...)
client.error('WATCH inside MULTI is not allowed')
end
setmetatable(transaction_client, { __index = function(t, k)
local cmd = client[k]
if type(cmd) == "function" then
local function queuey(self, ...)
local reply = cmd(client, ...)
assert((reply or emptytable).queued == true, 'a QUEUED reply was expected')
table_insert(queued_parsers, reply.parser or identity)
return reply
end
t[k]=queuey
return queuey
else
return cmd
end
end
})
client:multi()
return coro
end
local function transaction(client, options, coroutine_block, attempts)
local queued_parsers, replies = {}, {}
local retry = tonumber(attempts) or tonumber(options.retry) or 2
local coro = initialize_transaction(client, options, coroutine_block, queued_parsers)
local success, retval
if coroutine.status(coro) == 'suspended' then
success, retval = coroutine.resume(coro)
else
-- do not fail if the coroutine has not been resumed (missing t:multi() with CAS)
success, retval = true, 'empty transaction'
end
if #queued_parsers == 0 or not success then
client:discard()
assert(success, retval)
return replies, 0
end
local raw_replies = client:exec()
if not raw_replies then
if (retry or 0) <= 0 then
client.error("MULTI/EXEC transaction aborted by the server")
else
--we're not quite done yet
return transaction(client, options, coroutine_block, retry - 1)
end
end
local table_insert = table.insert
for i, parser in pairs(queued_parsers) do
table_insert(replies, i, parser(raw_replies[i]))
end
return replies, #queued_parsers
end
client_prototype.transaction = function(client, arg1, arg2)
local options, block
if not arg2 then
options, block = {}, arg1
elseif arg1 then --and arg2, implicitly
options, block = type(arg1)=="table" and arg1 or { arg1 }, arg2
else
client.error("Invalid parameters for redis transaction.")
end
if not options.watch then
watch_keys = { }
for i, v in pairs(options) do
if tonumber(i) then
table.insert(watch_keys, v)
options[i] = nil
end
end
options.watch = watch_keys
elseif not (type(options.watch) == 'table') then
options.watch = { options.watch }
end
if not options.cas then
local tx_block = block
block = function(client, ...)
client:multi()
return tx_block(client, ...) --can't wrap this in pcall because we're in a coroutine.
end
end
return transaction(client, options, block)
end
end
-- MONITOR context
do
local monitor_loop = function(client)
local monitoring = true
-- Tricky since the payload format changed starting from Redis 2.6.
local pattern = '^(%d+%.%d+)( ?.- ?) ?"(%a+)" ?(.-)$'
local abort = function()
monitoring = false
end
return coroutine.wrap(function()
client:monitor()
while monitoring do
local message, matched
local response = response.read(client)
local ok = response:gsub(pattern, function(time, info, cmd, args)
message = {
timestamp = tonumber(time),
client = info:match('%d+.%d+.%d+.%d+:%d+'),
database = tonumber(info:match('%d+')) or 0,
command = cmd,
arguments = args:match('.+'),
}
matched = true
end)
if not matched then
client.error('Unable to match MONITOR payload: '..response)
end
coroutine.yield(message, abort)
end
end)
end
client_prototype.monitor_messages = function(client)
return monitor_loop(client)
end
end
-- ############################################################################
local function connect_tcp(socket, parameters)
local host, port = parameters.host, tonumber(parameters.port)
local ok, err = socket:connect(host, port)
if not ok then
redis.error('could not connect to '..host..':'..port..' ['..err..']')
end
socket:setoption('tcp-nodelay', parameters.tcp_nodelay)
return socket
end
local function connect_unix(socket, parameters)
local ok, err = socket:connect(parameters.path)
if not ok then
redis.error('could not connect to '..parameters.path..' ['..err..']')
end
return socket
end
local function create_connection(parameters)
if parameters.socket then
return parameters.socket
end
local perform_connection, socket
if parameters.scheme == 'unix' then
perform_connection, socket = connect_unix, require('socket.unix')
assert(socket, 'your build of LuaSocket does not support UNIX domain sockets')
else
if parameters.scheme then
local scheme = parameters.scheme
assert(scheme == 'redis' or scheme == 'tcp', 'invalid scheme: '..scheme)
end
perform_connection, socket = connect_tcp, require('socket').tcp
end
return perform_connection(socket(), parameters)
end
-- ############################################################################
function redis.error(message, level)
error(message, (level or 1) + 1)
end
function redis.connect(...)
local args, parameters = {...}, nil
if #args == 1 then
if type(args[1]) == 'table' then
parameters = args[1]
else
local uri = require('socket.url')
parameters = uri.parse(select(1, ...))
if parameters.scheme then
if parameters.query then
for k, v in parameters.query:gmatch('([-_%w]+)=([-_%w]+)') do
if k == 'tcp_nodelay' or k == 'tcp-nodelay' then
parameters.tcp_nodelay = parse_boolean(v)
end
end
end
else
parameters.host = parameters.path
end
end
elseif #args > 1 then
local host, port = unpack(args)
parameters = { host = host, port = port }
end
local commands = redis.commands or {}
if type(commands) ~= 'table' then
redis.error('invalid type for the commands table')
end
local socket = create_connection(merge_defaults(parameters))
local client = create_client(client_prototype, socket, commands)
return client
end
function redis.command(cmd, opts)
return command(cmd, opts)
end
-- obsolete
function redis.define_command(name, opts)
define_command_impl(redis.commands, name, opts)
end
-- obsolete
function redis.undefine_command(name)
undefine_command_impl(redis.commands, name)
end
-- ############################################################################
-- Commands defined in this table do not take the precedence over
-- methods defined in the client prototype table.
redis.commands = {
-- commands operating on the key space
exists = command('EXISTS', {
response = toboolean
}),
del = command('DEL'),
type = command('TYPE'),
rename = command('RENAME'),
renamenx = command('RENAMENX', {
response = toboolean
}),
expire = command('EXPIRE', {
response = toboolean
}),
pexpire = command('PEXPIRE', { -- >= 2.6
response = toboolean
}),
expireat = command('EXPIREAT', {
response = toboolean
}),
pexpireat = command('PEXPIREAT', { -- >= 2.6
response = toboolean
}),
ttl = command('TTL'),
pttl = command('PTTL'), -- >= 2.6
move = command('MOVE', {
response = toboolean
}),
dbsize = command('DBSIZE'),
persist = command('PERSIST', { -- >= 2.2
response = toboolean
}),
keys = command('KEYS', {
response = function(response)
if type(response) == 'string' then
-- backwards compatibility path for Redis < 2.0
local keys = {}
response:gsub('[^%s]+', function(key)
table.insert(keys, key)
end)
response = keys
end
return response
end
}),
randomkey = command('RANDOMKEY', {
response = function(response)
if response == '' then
return nil
else
return response
end
end
}),
sort = command('SORT', {
request = sort_request,
}),
-- commands operating on string values
set = command('SET'),
setnx = command('SETNX', {
response = toboolean
}),
setex = command('SETEX'), -- >= 2.0
psetex = command('PSETEX'), -- >= 2.6
mset = command('MSET', {
request = mset_filter_args
}),
msetnx = command('MSETNX', {
request = mset_filter_args,
response = toboolean
}),
get = command('GET'),
mget = command('MGET'),
getset = command('GETSET'),
incr = command('INCR'),
incrby = command('INCRBY'),
incrbyfloat = command('INCRBYFLOAT', { -- >= 2.6
response = function(reply, command, ...)
return tonumber(reply)
end,
}),
decr = command('DECR'),
decrby = command('DECRBY'),
append = command('APPEND'), -- >= 2.0
substr = command('SUBSTR'), -- >= 2.0
strlen = command('STRLEN'), -- >= 2.2
setrange = command('SETRANGE'), -- >= 2.2
getrange = command('GETRANGE'), -- >= 2.2
setbit = command('SETBIT'), -- >= 2.2
getbit = command('GETBIT'), -- >= 2.2
-- commands operating on lists
rpush = command('RPUSH'),
lpush = command('LPUSH'),
llen = command('LLEN'),
lrange = command('LRANGE'),
ltrim = command('LTRIM'),
lindex = command('LINDEX'),
lset = command('LSET'),
lrem = command('LREM'),
lpop = command('LPOP'),
rpop = command('RPOP'),
rpoplpush = command('RPOPLPUSH'),
blpop = command('BLPOP'), -- >= 2.0
brpop = command('BRPOP'), -- >= 2.0
rpushx = command('RPUSHX'), -- >= 2.2
lpushx = command('LPUSHX'), -- >= 2.2
linsert = command('LINSERT'), -- >= 2.2
brpoplpush = command('BRPOPLPUSH'), -- >= 2.2
-- commands operating on sets
sadd = command('SADD'),
srem = command('SREM'),
spop = command('SPOP'),
smove = command('SMOVE', {
response = toboolean
}),
scard = command('SCARD'),
sismember = command('SISMEMBER', {
response = toboolean
}),
sinter = command('SINTER'),
sinterstore = command('SINTERSTORE'),
sunion = command('SUNION'),
sunionstore = command('SUNIONSTORE'),
sdiff = command('SDIFF'),
sdiffstore = command('SDIFFSTORE'),
smembers = command('SMEMBERS'),
srandmember = command('SRANDMEMBER'),
-- commands operating on sorted sets
zadd = command('ZADD'),
zincrby = command('ZINCRBY'),
zrem = command('ZREM'),
zrange = command('ZRANGE', {
request = zset_range_request,
response = zset_range_reply,
}),
zrevrange = command('ZREVRANGE', {
request = zset_range_request,
response = zset_range_reply,
}),
zrangebyscore = command('ZRANGEBYSCORE', {
request = zset_range_byscore_request,
response = zset_range_reply,
}),
zrevrangebyscore = command('ZREVRANGEBYSCORE', { -- >= 2.2
request = zset_range_byscore_request,
response = zset_range_reply,
}),
zunionstore = command('ZUNIONSTORE', { -- >= 2.0
request = zset_store_request
}),
zinterstore = command('ZINTERSTORE', { -- >= 2.0
request = zset_store_request
}),
zcount = command('ZCOUNT'),
zcard = command('ZCARD'),
zscore = command('ZSCORE'),
zremrangebyscore = command('ZREMRANGEBYSCORE'),
zrank = command('ZRANK'), -- >= 2.0
zrevrank = command('ZREVRANK'), -- >= 2.0
zremrangebyrank = command('ZREMRANGEBYRANK'), -- >= 2.0
-- commands operating on hashes
hset = command('HSET', { -- >= 2.0
response = toboolean
}),
hsetnx = command('HSETNX', { -- >= 2.0
response = toboolean
}),
hmset = command('HMSET', { -- >= 2.0
request = hash_multi_request_builder(function(args, k, v)
table.insert(args, k)
table.insert(args, v)
end),
}),
hincrby = command('HINCRBY'), -- >= 2.0
hincrbyfloat = command('HINCRBYFLOAT', {-- >= 2.6
response = function(reply, command, ...)
return tonumber(reply)
end,
}),
hget = command('HGET'), -- >= 2.0
hmget = command('HMGET', { -- >= 2.0
request = hash_multi_request_builder(function(args, k, v)
table.insert(args, v)
end),
}),
hdel = command('HDEL'), -- >= 2.0
hexists = command('HEXISTS', { -- >= 2.0
response = toboolean
}),
hlen = command('HLEN'), -- >= 2.0
hkeys = command('HKEYS'), -- >= 2.0
hvals = command('HVALS'), -- >= 2.0
hgetall = command('HGETALL', { -- >= 2.0
response = function(reply, command, ...)
local new_reply = { }
for i = 1, #reply, 2 do new_reply[reply[i]] = reply[i + 1] end
return new_reply
end
}),
-- connection related commands
ping = command('PING', {
response = function(response) return response == 'PONG' end
}),
echo = command('ECHO'),
auth = command('AUTH'),
select = command('SELECT'),
-- transactions
multi = command('MULTI'), -- >= 2.0
exec = command('EXEC'), -- >= 2.0
discard = command('DISCARD'), -- >= 2.0
watch = command('WATCH'), -- >= 2.2
unwatch = command('UNWATCH'), -- >= 2.2
-- publish - subscribe
subscribe = command('SUBSCRIBE'), -- >= 2.0
unsubscribe = command('UNSUBSCRIBE'), -- >= 2.0
psubscribe = command('PSUBSCRIBE'), -- >= 2.0
punsubscribe = command('PUNSUBSCRIBE'), -- >= 2.0
publish = command('PUBLISH'), -- >= 2.0
-- redis scripting
eval = command('EVAL'), -- >= 2.6
evalsha = command('EVALSHA'), -- >= 2.6
script = command('SCRIPT'), -- >= 2.6
-- remote server control commands
bgrewriteaof = command('BGREWRITEAOF'),
config = command('CONFIG', { -- >= 2.0
response = function(reply, command, ...)
if (type(reply) == 'table') then
local new_reply = { }
for i = 1, #reply, 2 do new_reply[reply[i]] = reply[i + 1] end
return new_reply
end
return reply
end
}),
client = command('CLIENT'), -- >= 2.4
slaveof = command('SLAVEOF'),
save = command('SAVE'),
bgsave = command('BGSAVE'),
lastsave = command('LASTSAVE'),
flushdb = command('FLUSHDB'),
flushall = command('FLUSHALL'),
monitor = command('MONITOR'),
time = command('TIME'), -- >= 2.6
slowlog = command('SLOWLOG', { -- >= 2.2.13
response = function(reply, command, ...)
if (type(reply) == 'table') then
local structured = { }
for index, entry in ipairs(reply) do
structured[index] = {
id = tonumber(entry[1]),
timestamp = tonumber(entry[2]),
duration = tonumber(entry[3]),
command = entry[4],
}
end
return structured
end
return reply
end
}),
info = command('INFO', {
response = parse_info,
}),
}
-- ############################################################################
return redis
| gpl-3.0 |
sprunk/Zero-K | LuaUI/Widgets/chili/Controls/font.lua | 2 | 7158 | --// =============================================================================
--- Font module
--- Font fields
-- Inherits from Control.
-- @see control.Control
-- @table Font
-- @string[opt = "FreeSansBold.otf"] font font name
-- @int[opt = 12] size font size
-- @bool[opt = false] shadow shadow enabled
-- @bool[opt = false] outline outline enabled
-- @tparam {r, g, b, a} color color table (default {1, 1, 1, 1})
-- @tparam {r, g, b, a} outlineColor outlineColor table (default {0, 0, 0, 1})
-- @bool[opt = true] autoOutlineColor ??
Font = Object:Inherit{
classname = 'font',
font = "FreeSansBold.otf",
size = 12,
outlineWidth = 3,
outlineWeight = 3,
shadow = false,
outline = false,
color = {1, 1, 1, 1},
outlineColor = {0, 0, 0, 1},
autoOutlineColor = true,
}
local this = Font
local inherited = this.inherited
--// =============================================================================
function Font:New(obj)
obj = inherited.New(self, obj)
--// Load the font
obj:_LoadFont()
return obj
end
function Font:Dispose(...)
if (not self.disposed) then
FontHandler.UnloadFont(self._font)
end
inherited.Dispose(self, ...)
end
--// =============================================================================
function Font:_LoadFont()
local oldfont = self._font
local uiScale = (WG and WG.uiScale or 1)
self._font = FontHandler.LoadFont(self.font, math.floor(self.size*uiScale), math.floor(self.outlineWidth*uiScale), self.outlineWeight)
--// do this after LoadFont because it can happen that LoadFont returns the same font again
--// but if we Unload our old one before, the gc could collect it before, so the engine would have to reload it again
FontHandler.UnloadFont(oldfont)
end
--// =============================================================================
local function NotEqual(v1, v2)
local t1 = type(v1)
local t2 = type(v2)
if (t1 ~= t2) then
return true
end
local isindexable = (t == "table") or (t == "metatable") or (t == "userdata")
if (not isindexable) then
return (t1 ~= t2)
end
for i, v in pairs(v1) do
if (v ~= v2[i]) then
return true
end
end
for i, v in pairs(v2) do
if (v ~= v1[i]) then
return true
end
end
end
do
--// Create some Set... methods (e.g. SetColor, SetSize, SetFont, ...)
local params = {
font = true,
size = true,
outlineWidth = true,
outlineWeight = true,
shadow = false,
outline = false,
color = false,
outlineColor = false,
autoOutlineColor = false,
}
for param, recreateFont in pairs(params) do
local paramWithUpperCase = param:gsub("^%l", string.upper)
local funcname = "Set" .. paramWithUpperCase
Font[funcname] = function(self, value, ...)
local t = type(value)
local oldValue = self[param]
if (t == "table") then
self[param] = table.shallowcopy(value)
else
local to = type(self[param])
if (to == "table") then
--// this allows :SetColor(r, g, b, a) and :SetColor({r, g, b, a})
local newtable = {value, ...}
table.merge(newtable, self[param])
self[param] = newtable
else
self[param] = value
end
end
local p = self.parent
if (recreateFont) then
self:_LoadFont()
if (p) then
p:RequestRealign()
end
else
if (p) and NotEqual(oldValue, self[param]) then
p:Invalidate()
end
end
end
end
params = nil
end
--// =============================================================================
function Font:GetLineHeight(size)
return self._font.lineheight * (size or self.size)
end
function Font:GetAscenderHeight(size)
local font = self._font
return (font.lineheight + font.descender) * (size or self.size)
end
function Font:GetTextWidth(text, size)
return (self._font):GetTextWidth(text) * (size or self.size)
end
function Font:GetTextHeight(text, size)
if (not size) then
size = self.size
end
local h, descender, numlines = (self._font):GetTextHeight(text)
return h*size, descender*size, numlines
end
function Font:WrapText(text, width, height, size)
if (not size) then
size = self.size
end
if (height < 1.5 * self._font.lineheight) or (width < size) then
return text --//workaround for a bug in <= 80.5.2
end
return (self._font):WrapText(text, width, height, size)
end
--// =============================================================================
function Font:AdjustPosToAlignment(x, y, width, height, align, valign)
local extra = ''
if self.shadow then
width = width - 1 - self.size * 0.1
height = height - 1 - self.size * 0.1
elseif self.outline then
width = width - 1 - self.outlineWidth
height = height - 1 - self.outlineWidth
end
--// vertical alignment
if valign == "center" then
y = y + height/2
extra = 'v'
elseif valign == "top" then
extra = 't'
elseif valign == "bottom" then
y = y + height
extra = 'b'
elseif valign == "linecenter" then
y = y + (height / 2) + (1 + self._font.descender) * self.size / 2
extra = 'x'
else
--// ascender
extra = 'a'
end
--FIXME add baseline 'd'
--// horizontal alignment
if align == "left" then
--do nothing
elseif align == "center" then
x = x + width/2
extra = extra .. 'c'
elseif align == "right" then
x = x + width
extra = extra .. 'r'
end
return x, y, extra
end
local function _GetExtra(align, valign)
local extra = ''
--// vertical alignment
if valign == "center" then
extra = 'v'
elseif valign == "top" then
extra = 't'
elseif valign == "bottom" then
extra = 'b'
else
--// ascender
extra = 'a'
end
--// horizontal alignment
if align == "left" then
--do nothing
elseif align == "center" then
extra = extra .. 'c'
elseif align == "right" then
extra = extra .. 'r'
end
return extra
end
--// =============================================================================
function Font:_DrawText(text, x, y, extra)
local font = self._font
gl.PushAttrib(GL.COLOR_BUFFER_BIT)
gl.PushMatrix()
gl.Scale(1, -1, 1)
font:Begin()
if AreInRTT() then
gl.BlendFuncSeparate(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ZERO, GL.ONE_MINUS_SRC_ALPHA)
end
font:SetTextColor(self.color)
font:SetOutlineColor(self.outlineColor)
font:SetAutoOutlineColor(self.autoOutlineColor)
font:Print(text, x, -y, self.size, extra)
font:End()
gl.PopMatrix()
gl.PopAttrib()
end
function Font:Draw(text, x, y, align, valign)
if (not text) then
return
end
local extra = _GetExtra(align, valign)
if self.outline then
extra = extra .. 'o'
elseif self.shadow then
extra = extra .. 's'
end
self:_DrawText(text, x, y, extra)
end
function Font:DrawInBox(text, x, y, w, h, align, valign)
if (not text) then
return
end
local x, y, extra = self:AdjustPosToAlignment(x, y, w, h, align, valign)
if self.outline then
extra = extra .. 'o'
elseif self.shadow then
extra = extra .. 's'
end
y = y + 1 --// FIXME: if this isn't done some chars as 'R' get truncated at the top
self:_DrawText(text, x, y, extra)
end
Font.Print = Font.Draw
Font.PrintInBox = Font.DrawInBox
--// =============================================================================
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/item/item_music_microphone_s2.lua | 3 | 2232 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_item_item_music_microphone_s2 = object_static_item_shared_item_music_microphone_s2:new {
}
ObjectTemplates:addTemplate(object_static_item_item_music_microphone_s2, "object/static/item/item_music_microphone_s2.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/corellia/filler_slum_16x32_s02.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_building_corellia_filler_slum_16x32_s02 = object_building_corellia_shared_filler_slum_16x32_s02:new {
}
ObjectTemplates:addTemplate(object_building_corellia_filler_slum_16x32_s02, "object/building/corellia/filler_slum_16x32_s02.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/space_privateer_tier4_tatooine_nirame.lua | 3 | 2264 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_space_privateer_tier4_tatooine_nirame = object_mobile_shared_space_privateer_tier4_tatooine_nirame:new {
}
ObjectTemplates:addTemplate(object_mobile_space_privateer_tier4_tatooine_nirame, "object/mobile/space_privateer_tier4_tatooine_nirame.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/structure/exterior/lair_cave_giant_exterior_krayt_dragon.lua | 1 | 2411 | --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_structure_exterior_lair_cave_giant_exterior_krayt_dragon = object_tangible_lair_structure_exterior_shared_lair_cave_giant_exterior_krayt_dragon:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_structure_exterior_lair_cave_giant_exterior_krayt_dragon, "object/tangible/lair/structure/exterior/lair_cave_giant_exterior_krayt_dragon.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/screenplays/cities/naboo_keren.lua | 1 | 10910 | NabooKerenScreenPlay = CityScreenPlay:new {
numberOfActs = 1,
screenplayName = "NabooKerenScreenPlay",
planet = "naboo",
gcwMobs = {
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1981.7,11.0,2184.7,162,0, "", ""},
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1984.8,11.0,2185.6,165,0, "", ""},
{"stormtrooper_black_hole_squad_leader", "rebel_gungan_war_chief", 1942.9,11.7,2329.8,-14,0, "", ""},
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1935.8,12.0,2328.8,-17,0, "", ""},
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1950.3,11.8,2333.0,-17,0, "", ""},
{"dark_trooper", "rebel_trooper", 1958.2,12.0,2403.6,-102,0, "", ""},
{"dark_trooper", "rebel_trooper", 1964.1,12.0,2375.3,-100,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1961.5,12.0,2454.2,35,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1968.4,12.0,2448.3,35,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 2009.9,19.0,2536.1,120,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 2012.9,19.0,2540.9,120,0, "", ""},
{"stormtrooper_bombardier", "rebel_gungan_kaadu_rider", 2049.8,19.0,2561.6,-120,0, "", ""},
{"scout_trooper", "rebel_scout", 2105.3,30.0,2597.9,-150,0, "", ""},
{"scout_trooper", "rebel_scout", 2098.0,30.0,2601.6,-155,0, "", ""},
{"scout_trooper", "rebel_scout", 1901.2,12.0,2611.8,-90,0, "", ""},
{"scout_trooper", "rebel_scout", 1901.6,12.0,2618.6,-90,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1862.4,12.0,2543.0,-45,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1856.7,12.0,2538.1,-45,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1803.1,12.0,2516.6,0,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1810.2,12.0,2516.7,0,0, "", ""},
{"stormtrooper_rifleman", "rebel_gungan_scout", 1685.7,12.0,2609.5,175,0, "", ""},
{"stormtrooper_rifleman", "rebel_gungan_scout", 1686.0,12.0,2618.9,0,0, "", ""},
{"dark_trooper", "rebel_trooper", 1802.0,12.5,2629.2,50,0, "", ""},
{"dark_trooper", "rebel_trooper", 1772.1,12.5,2598.7,-132,0, "", ""},
{"stormtrooper_sniper", "rebel_gungan_bomber", 1602.3,25.0,2697.0,-87,0, "", ""},
{"stormtrooper_sniper", "rebel_gungan_bomber", 1607.5,25.0,2695.9,-168,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1528.0,25.0,2739.8,5,0, "", ""},
{"stormtrooper", "rebel_gungan_guard", 1523.1,25.0,2741.6,0,0, "", ""},
{"scout_trooper", "rebel_scout", 1572.7,25.0,2830.7,-90,0, "", ""},
{"scout_trooper", "rebel_scout", 1572.5,25.0,2836.3,-90,0, "", ""},
{"stormtrooper_sniper", "rebel_gungan_bomber", 1598.4,40.0,2830.5,90,0, "", ""},
{"stormtrooper_black_hole_squad_leader", "rebel_gungan_war_chief", 1213.8,13.0,2768.2,90,0, "", ""},
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1209.4,13.0,2785.8,-90,0, "", ""},
{"stormtrooper_black_hole", "rebel_gungan_grand_army_soldier", 1209.5,13.0,2751.3,-90,0, "", ""},
{"special_missions_engineer", "rebel_general", 1210.2,13.0,2768.3,-90,0, "", ""},
},
}
registerScreenPlay("NabooKerenScreenPlay", true)
function NabooKerenScreenPlay:start()
if (isZoneEnabled(self.planet)) then
self:spawnMobiles()
self:spawnSceneObjects()
self:spawnGcwMobiles()
end
end
function NabooKerenScreenPlay:spawnSceneObjects()
--outside starport
spawnSceneObject(self.planet, "object/tangible/crafting/station/public_space_station.iff", 1437.02, 13, 2763.06, 0, math.rad(90) )
spawnSceneObject(self.planet, "object/tangible/crafting/station/public_space_station.iff", 1436.71, 13, 2778.92, 0, math.rad(90) )
end
function NabooKerenScreenPlay:spawnMobiles()
--Anything dashed out will need to be added here and removed from spawn manager once the spawnMobiles command is extended.
spawnMobile(self.planet, "gadget_specialist", 60, 1215.5, 13, 2741.1, 11, 0)
--starport interior
local pNpc = spawnMobile(self.planet, "chiss_female",60,55.2,-0.5,31.6,0,2125385)
self:setMoodString(pNpc, "npc_sitting_table_eating")
pNpc = spawnMobile(self.planet, "chiss_male",60,57.4,-0.5,33.4,-135,2125385)
self:setMoodString(pNpc, "npc_sitting_chair")
pNpc = spawnMobile(self.planet, "chassis_dealer",60,5.5,0.6,67.4,-2,2125382)
self:setMoodString(pNpc, "neutral")
--relocated sw trainer from previously bugged exterior spot
--pNpc = spawnMobile(self.planet, "trainer_shipwright",60,-0.5,0.6,67.2,180,2125382)
--self:setMoodString(pNpc, "neutral")
--cantina
pNpc = spawnMobile(self.planet, "bartender",60,3.6,-0.9,-2.5,163,5)
self:setMoodString(pNpc, "conversation")
--Guild Hall 1720 2613
--spawnMobile(self.planet, "trainer_artisan",0,0.0976721,1.13306,-13.6995,0,1396874)
--Guild Hall/Theater
--[[ spawnMobile(self.planet, "trainer_dancer",0,18.188,2.12871,53.8705,2,4045383)
spawnMobile(self.planet, "trainer_entertainer",0,29.6396,2.12878,74.0291,270,4045383)
spawnMobile(self.planet, "trainer_musician",0,21.7,2.1,76.2,180,4045383)
spawnMobile(self.planet, "theater_manager",0,21.7887,2.12809,63.5017,3,4045383)
spawnMobile(self.planet, "trainer_imagedesigner",0,-20.97,2.1287,74.23,180,4045384)
--Guild Hall 1786 2547
spawnMobile(self.planet, "trainer_architect",0,11,1.133,-14.5,0,1650543)
spawnMobile(self.planet, "trainer_armorsmith",0,-15,1.133,0,88,1650542)
spawnMobile(self.planet, "trainer_droidengineer",0,-11,1.13306,-13,0,1650545)
spawnMobile(self.planet, "trainer_merchant",0,12,1.13306,6,180,1650541)
spawnMobile(self.planet, "trainer_weaponsmith",0,-2.5,1.13306,-8.4,91,1650544)
--Guild Hall 1851 2613
spawnMobile(self.planet, "trainer_brawler",0,-11,1.13306,-12.5,0,1650535)
spawnMobile(self.planet, "trainer_marksman",0,0,0,-13,0,1650534)
spawnMobile(self.planet, "trainer_scout",0,-12.0327,1.13306,4.62955,179,1650532)
--Med Center
spawnMobile(self.planet, "trainer_combatmedic",0,27.2188,0.26,5.37779,76,1661366)
spawnMobile(self.planet, "trainer_combatmedic",0,-17,0.26,9,180,1661370)
spawnMobile(self.planet, "trainer_doctor",0,17.4,0.3,1,9,1661366)
spawnMobile(self.planet, "trainer_doctor",0,-25.9,0.3,-3.2,173,1661370)
spawnMobile(self.planet, "trainer_medic",0,14.1386,0.26,3.567,128,1661366)
spawnMobile(self.planet, "trainer_medic",0,-16.956,0.26,1.559,24,1661370)
--]]
--Outside
spawnMobile(self.planet, "informant_npc_lvl_1",0,2030,12,2591,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1959,12,2577,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1818,12,2496,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1890,12,2527,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1926,12,2527,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1835,12,2633,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1847,12,2573,0,0)
spawnMobile(self.planet, "informant_npc_lvl_1",0,1347,13,2671,0,0)
spawnMobile(self.planet, "informant_npc_lvl_2",0,1279,13,2858,330,0)
--{"junk_dealer",0,1371.6,13,2705.3,177,0, "", "",JUNKGENERIC,JUNKCONVGENERIC},
--[[ spawnMobile(self.planet, "trainer_architect",0,1533,25,2744,-93,0)
spawnMobile(self.planet, "trainer_armorsmith",0,1890,12,2767,180,0)
spawnMobile(self.planet, "trainer_artisan",0,1522,25,2781,180,0)
spawnMobile(self.planet, "trainer_artisan",0,2003.71,12,2484.06,243,0)
spawnMobile(self.planet, "trainer_brawler",0,1890,12,2725,0,0)
spawnMobile(self.planet, "trainer_brawler",0,1537,25,2757,0,0)
spawnMobile(self.planet, "trainer_carbine",0,1265.08,13,2677.88,9,0)
spawnMobile(self.planet, "trainer_chef",0,1840,12,2672,180,0)
spawnMobile(self.planet, "trainer_combatmedic",0,1927,12,2729.93,264,0)
spawnMobile(self.planet, "trainer_dancer",0,1630.59,12,2574.54,99,0)
spawnMobile(self.planet, "trainer_droidengineer",0,1966,12,2419,-64,0)
spawnMobile(self.planet, "trainer_droidengineer",0,1627,12,2439,0,0)
spawnMobile(self.planet, "trainer_entertainer",0,1246,13,2723,12,0)
spawnMobile(self.planet, "trainer_entertainer",0,1520,25,2744,0,0)
spawnMobile(self.planet, "trainer_entertainer",0,1727,12,2479,0,0)
spawnMobile(self.planet, "trainer_entertainer",0,1772.77,12,2744.98,179,0)
spawnMobile(self.planet, "trainer_imagedesigner",0,1253,13,2711,0,0)
spawnMobile(self.planet, "trainer_marksman",0,1538,25,2751,180,0)
spawnMobile(self.planet, "trainer_marksman",0,1992,12,2515,180,0)
spawnMobile(self.planet, "trainer_medic",0,1982,12,2598,0,0)
spawnMobile(self.planet, "trainer_medic",0,1541,25,2789,0,0)
spawnMobile(self.planet, "trainer_medic",0,1784,12,2714,0,0)
spawnMobile(self.planet, "trainer_merchant",0,1524,25,2782,37,0)
spawnMobile(self.planet, "trainer_merchant",0,2005,12,2483,243,0)
spawnMobile(self.planet, "trainer_pistol",0,1253,13,2686,180,0)
spawnMobile(self.planet, "trainer_rifleman",0,1276,13,2685,73,0)
spawnMobile(self.planet, "trainer_scout",0,1512.27,25,2754.94,111,0)
spawnMobile(self.planet, "trainer_scout",0,1842.37,12,2709.61,134,0)
spawnMobile(self.planet, "trainer_smuggler",0,1362.94,13,2833.96,82,0)
spawnMobile(self.planet, "trainer_smuggler",0,1846,12,2772,31,0)
spawnMobile(self.planet, "trainer_weaponsmith",0,1905,12,2767,180,0)
spawnMobile(self.planet, "trainer_bountyhunter",0,2087,30,2575,180,0)
--]]
--newb grind starter spawns
spawnMobile(self.planet, "gungan_hermit", 300, getRandomNumber(10) + 1360, 13.3, getRandomNumber(10) + 2941, getRandomNumber(360), 0)
spawnMobile(self.planet, "gungan_hermit", 300, getRandomNumber(10) + 1360, 13.3, getRandomNumber(10) + 2941, getRandomNumber(360), 0)
spawnMobile(self.planet, "gungan_hermit", 300, getRandomNumber(10) + 1360, 13.3, getRandomNumber(10) + 2941, getRandomNumber(360), 0)
spawnMobile(self.planet, "gungan_hermit", 300, getRandomNumber(10) + 1360, 13.3, getRandomNumber(10) + 2941, getRandomNumber(360), 0)
spawnMobile(self.planet, "flewt", 300, getRandomNumber(10) + 1216, 6.1, getRandomNumber(10) + 2878, getRandomNumber(360), 0)
spawnMobile(self.planet, "flewt", 300, getRandomNumber(10) + 1216, 6.1, getRandomNumber(10) + 2878, getRandomNumber(360), 0)
spawnMobile(self.planet, "flewt", 300, getRandomNumber(10) + 1216, 6.1, getRandomNumber(10) + 2878, getRandomNumber(360), 0)
spawnMobile(self.planet, "flewt", 300, getRandomNumber(10) + 1216, 6.1, getRandomNumber(10) + 2878, getRandomNumber(360), 0)
spawnMobile(self.planet, "flewt", 300, getRandomNumber(10) + 1216, 6.1, getRandomNumber(10) + 2878, getRandomNumber(360), 0)
spawnMobile(self.planet, "chuba", 300, getRandomNumber(10) + 1328, 11.9, getRandomNumber(10) + 2604, getRandomNumber(360), 0)
spawnMobile(self.planet, "chuba", 300, getRandomNumber(10) + 1328, 11.9, getRandomNumber(10) + 2604, getRandomNumber(360), 0)
spawnMobile(self.planet, "chuba", 300, getRandomNumber(10) + 1328, 11.9, getRandomNumber(10) + 2604, getRandomNumber(360), 0)
spawnMobile(self.planet, "chuba", 300, getRandomNumber(10) + 1328, 11.9, getRandomNumber(10) + 2604, getRandomNumber(360), 0)
spawnMobile(self.planet, "chuba", 300, getRandomNumber(10) + 1328, 11.9, getRandomNumber(10) + 2604, getRandomNumber(360), 0)
end
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/armor/tantel/objects.lua | 3 | 14988 | --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_wearables_armor_tantel_shared_armor_tantel_skreej_boots = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_boots.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_boots_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/shoe.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 263,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_boots",
gameObjectType = 263,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_boots",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_boots",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 917083893,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_shoes.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_boots, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_boots.iff")
object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_boots_quest = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_boots_quest.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_boots_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/shoe.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 263,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_boots_quest",
gameObjectType = 263,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_boots",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_boots_quest",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 30813288,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_shoes.iff", "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_boots.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_boots_quest, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_boots_quest.iff")
object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_chest_plate = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_chest_plate.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_chest_plate_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/vest.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 257,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_chest_plate",
gameObjectType = 257,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_chest_plate",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_chest_plate",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 290985679,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_vest.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_chest_plate, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_chest_plate.iff")
object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_chest_plate_quest = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_chest_plate_quest.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_chest_plate_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/vest.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 257,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_chest_plate_quest",
gameObjectType = 257,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_chest_plate",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_chest_plate_quest",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 1738912430,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_vest.iff", "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_chest_plate.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_chest_plate_quest, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_chest_plate_quest.iff")
object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_helmet = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_helmet.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_helmet_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/helmet_closed_full.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 258,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_helmet",
gameObjectType = 258,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_helmet",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_helmet",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 1458475008,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_helmet_closed_full.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_helmet, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_helmet.iff")
object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_helmet_quest = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_helmet_quest.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/armor_tantel_skreej_helmet_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/helmet_closed_full.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 258,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:armor_tantel_skreej_helmet_quest",
gameObjectType = 258,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:armor_tantel_skreej_helmet",
noBuildRadius = 0,
objectName = "@wearables_name:armor_tantel_skreej_helmet_quest",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 1049616094,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_helmet_closed_full.iff", "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_helmet.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_tantel_shared_armor_tantel_skreej_helmet_quest, "object/tangible/wearables/armor/tantel/shared_armor_tantel_skreej_helmet_quest.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/space/reverse_engineering/analysis_tool.lua | 1 | 3194 | --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_reverse_engineering_analysis_tool = object_draft_schematic_space_reverse_engineering_shared_analysis_tool:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Component Analysis Tool",
craftingToolTab = 262144, -- (See DraftSchematicObjectTemplate.h)
complexity = 11,
size = 1,
xpType = "shipwright",
xp = 22,
assemblySkill = "general_assembly",
experimentingSkill = "general_experimentation",
customizationSkill = "medicine_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"spare_parts", "chemical"},
ingredientSlotType = {0, 0},
resourceTypes = {"steel", "chemical"},
resourceQuantities = {50, 15},
contribution = {100, 100},
targetTemplate = "object/tangible/ship/crafted/reverse_engineering/analysis_tool.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_space_reverse_engineering_analysis_tool, "object/draft_schematic/space/reverse_engineering/analysis_tool.iff")
| agpl-3.0 |
dalistudio/uboss | framework/http/httpd.lua | 101 | 3708 | local internal = require "http.internal"
local table = table
local string = string
local type = type
local httpd = {}
local http_status_msg = {
[100] = "Continue",
[101] = "Switching Protocols",
[200] = "OK",
[201] = "Created",
[202] = "Accepted",
[203] = "Non-Authoritative Information",
[204] = "No Content",
[205] = "Reset Content",
[206] = "Partial Content",
[300] = "Multiple Choices",
[301] = "Moved Permanently",
[302] = "Found",
[303] = "See Other",
[304] = "Not Modified",
[305] = "Use Proxy",
[307] = "Temporary Redirect",
[400] = "Bad Request",
[401] = "Unauthorized",
[402] = "Payment Required",
[403] = "Forbidden",
[404] = "Not Found",
[405] = "Method Not Allowed",
[406] = "Not Acceptable",
[407] = "Proxy Authentication Required",
[408] = "Request Time-out",
[409] = "Conflict",
[410] = "Gone",
[411] = "Length Required",
[412] = "Precondition Failed",
[413] = "Request Entity Too Large",
[414] = "Request-URI Too Large",
[415] = "Unsupported Media Type",
[416] = "Requested range not satisfiable",
[417] = "Expectation Failed",
[500] = "Internal Server Error",
[501] = "Not Implemented",
[502] = "Bad Gateway",
[503] = "Service Unavailable",
[504] = "Gateway Time-out",
[505] = "HTTP Version not supported",
}
local function readall(readbytes, bodylimit)
local tmpline = {}
local body = internal.recvheader(readbytes, tmpline, "")
if not body then
return 413 -- Request Entity Too Large
end
local request = assert(tmpline[1])
local method, url, httpver = request:match "^(%a+)%s+(.-)%s+HTTP/([%d%.]+)$"
assert(method and url and httpver)
httpver = assert(tonumber(httpver))
if httpver < 1.0 or httpver > 1.1 then
return 505 -- HTTP Version not supported
end
local header = internal.parseheader(tmpline,2,{})
if not header then
return 400 -- Bad request
end
local length = header["content-length"]
if length then
length = tonumber(length)
end
local mode = header["transfer-encoding"]
if mode then
if mode ~= "identity" and mode ~= "chunked" then
return 501 -- Not Implemented
end
end
if mode == "chunked" then
body, header = internal.recvchunkedbody(readbytes, bodylimit, header, body)
if not body then
return 413
end
else
-- identity mode
if length then
if bodylimit and length > bodylimit then
return 413
end
if #body >= length then
body = body:sub(1,length)
else
local padding = readbytes(length - #body)
body = body .. padding
end
end
end
return 200, url, method, header, body
end
function httpd.read_request(...)
local ok, code, url, method, header, body = pcall(readall, ...)
if ok then
return code, url, method, header, body
else
return nil, code
end
end
local function writeall(writefunc, statuscode, bodyfunc, header)
local statusline = string.format("HTTP/1.1 %03d %s\r\n", statuscode, http_status_msg[statuscode] or "")
writefunc(statusline)
if header then
for k,v in pairs(header) do
if type(v) == "table" then
for _,v in ipairs(v) do
writefunc(string.format("%s: %s\r\n", k,v))
end
else
writefunc(string.format("%s: %s\r\n", k,v))
end
end
end
local t = type(bodyfunc)
if t == "string" then
writefunc(string.format("content-length: %d\r\n\r\n", #bodyfunc))
writefunc(bodyfunc)
elseif t == "function" then
writefunc("transfer-encoding: chunked\r\n")
while true do
local s = bodyfunc()
if s then
if s ~= "" then
writefunc(string.format("\r\n%x\r\n", #s))
writefunc(s)
end
else
writefunc("\r\n0\r\n\r\n")
break
end
end
else
assert(t == "nil")
writefunc("\r\n")
end
end
function httpd.write_response(...)
return pcall(writeall, ...)
end
return httpd
| mit |
AMKING7/A.M-7- | plugins/all.lua | 1321 | 4661 | do
data = load_data(_config.moderation.data)
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Chat stats:\n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
local function get_group_type(target)
local data = load_data(_config.moderation.data)
local group_type = data[tostring(target)]['group_type']
if not group_type or group_type == nil then
return 'No group type available.'
end
return group_type
end
local function show_group_settings(target)
local data = load_data(_config.moderation.data)
if data[tostring(target)] then
if data[tostring(target)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local settings = data[tostring(target)]['settings']
local text = "Lock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX
return text
end
local function get_description(target)
local data = load_data(_config.moderation.data)
local data_cat = 'description'
if not data[tostring(target)][data_cat] then
return 'No description available.'
end
local about = data[tostring(target)][data_cat]
return about
end
local function get_rules(target)
local data = load_data(_config.moderation.data)
local data_cat = 'rules'
if not data[tostring(target)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(target)][data_cat]
return rules
end
local function modlist(target)
local data = load_data(_config.moderation.data)
local groups = 'groups'
if not data[tostring(groups)] or not data[tostring(groups)][tostring(target)] then
return 'Group is not added or is Realm.'
end
if next(data[tostring(target)]['moderators']) == nil then
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators :\n'
for k,v in pairs(data[tostring(target)]['moderators']) do
message = message ..i..' - @'..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function get_link(target)
local data = load_data(_config.moderation.data)
local group_link = data[tostring(target)]['settings']['set_link']
if not group_link or group_link == nil then
return "No link"
end
return "Group link:\n"..group_link
end
local function all(target, receiver)
local text = "All the things I know about this group\n\n"
local group_type = get_group_type(target)
text = text.."Group Type: \n"..group_type
local settings = show_group_settings(target)
text = text.."\n\nGroup settings: \n"..settings
local rules = get_rules(target)
text = text.."\n\nRules: \n"..rules
local description = get_description(target)
text = text.."\n\nAbout: \n"..description
local modlist = modlist(target)
text = text.."\n\nMods: \n"..modlist
local link = get_link(target)
text = text.."\n\nLink: \n"..link
local stats = chat_stats(target)
text = text.."\n\n"..stats
local ban_list = ban_list(target)
text = text.."\n\n"..ban_list
local file = io.open("./groups/all/"..target.."all.txt", "w")
file:write(text)
file:flush()
file:close()
send_document(receiver,"./groups/all/"..target.."all.txt", ok_cb, false)
return
end
function run(msg, matches)
if matches[1] == "all" and matches[2] and is_owner2(msg.from.id, matches[2]) then
local receiver = get_receiver(msg)
local target = matches[2]
return all(target, receiver)
end
if not is_owner(msg) then
return
end
if matches[1] == "all" and not matches[2] then
local receiver = get_receiver(msg)
if not is_owner(msg) then
return
end
return all(msg.to.id, receiver)
end
end
return {
patterns = {
"^[!/](all)$",
"^[!/](all) (%d+)$"
},
run = run
}
end
| gpl-2.0 |
SbssTeam/Quick-v2 | plugins/all.lua | 1321 | 4661 | do
data = load_data(_config.moderation.data)
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Chat stats:\n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
local function get_group_type(target)
local data = load_data(_config.moderation.data)
local group_type = data[tostring(target)]['group_type']
if not group_type or group_type == nil then
return 'No group type available.'
end
return group_type
end
local function show_group_settings(target)
local data = load_data(_config.moderation.data)
if data[tostring(target)] then
if data[tostring(target)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local settings = data[tostring(target)]['settings']
local text = "Lock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX
return text
end
local function get_description(target)
local data = load_data(_config.moderation.data)
local data_cat = 'description'
if not data[tostring(target)][data_cat] then
return 'No description available.'
end
local about = data[tostring(target)][data_cat]
return about
end
local function get_rules(target)
local data = load_data(_config.moderation.data)
local data_cat = 'rules'
if not data[tostring(target)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(target)][data_cat]
return rules
end
local function modlist(target)
local data = load_data(_config.moderation.data)
local groups = 'groups'
if not data[tostring(groups)] or not data[tostring(groups)][tostring(target)] then
return 'Group is not added or is Realm.'
end
if next(data[tostring(target)]['moderators']) == nil then
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators :\n'
for k,v in pairs(data[tostring(target)]['moderators']) do
message = message ..i..' - @'..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function get_link(target)
local data = load_data(_config.moderation.data)
local group_link = data[tostring(target)]['settings']['set_link']
if not group_link or group_link == nil then
return "No link"
end
return "Group link:\n"..group_link
end
local function all(target, receiver)
local text = "All the things I know about this group\n\n"
local group_type = get_group_type(target)
text = text.."Group Type: \n"..group_type
local settings = show_group_settings(target)
text = text.."\n\nGroup settings: \n"..settings
local rules = get_rules(target)
text = text.."\n\nRules: \n"..rules
local description = get_description(target)
text = text.."\n\nAbout: \n"..description
local modlist = modlist(target)
text = text.."\n\nMods: \n"..modlist
local link = get_link(target)
text = text.."\n\nLink: \n"..link
local stats = chat_stats(target)
text = text.."\n\n"..stats
local ban_list = ban_list(target)
text = text.."\n\n"..ban_list
local file = io.open("./groups/all/"..target.."all.txt", "w")
file:write(text)
file:flush()
file:close()
send_document(receiver,"./groups/all/"..target.."all.txt", ok_cb, false)
return
end
function run(msg, matches)
if matches[1] == "all" and matches[2] and is_owner2(msg.from.id, matches[2]) then
local receiver = get_receiver(msg)
local target = matches[2]
return all(target, receiver)
end
if not is_owner(msg) then
return
end
if matches[1] == "all" and not matches[2] then
local receiver = get_receiver(msg)
if not is_owner(msg) then
return
end
return all(msg.to.id, receiver)
end
end
return {
patterns = {
"^[!/](all)$",
"^[!/](all) (%d+)$"
},
run = run
}
end
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/test/test_terminal.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_tangible_test_test_terminal = object_tangible_test_shared_test_terminal:new {
}
ObjectTemplates:addTemplate(object_tangible_test_test_terminal, "object/tangible/test/test_terminal.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/fynock/lair_fynock.lua | 1 | 2259 | --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_fynock_lair_fynock = object_tangible_lair_fynock_shared_lair_fynock:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_fynock_lair_fynock, "object/tangible/lair/fynock/lair_fynock.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/loot/loot_schematic/flora_recycler_schematic.lua | 1 | 2600 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_loot_loot_schematic_flora_recycler_schematic = object_tangible_loot_loot_schematic_shared_flora_recycler_schematic:new {
templateType = LOOTSCHEMATIC,
objectMenuComponent = "LootSchematicMenuComponent",
attributeListComponent = "LootSchematicAttributeListComponent",
requiredSkill = "crafting_artisan_engineering_01",
targetDraftSchematic = "object/draft_schematic/item/item_recycler_flora.iff",
targetUseCount = 1,
}
ObjectTemplates:addTemplate(object_tangible_loot_loot_schematic_flora_recycler_schematic, "object/tangible/loot/loot_schematic/flora_recycler_schematic.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/poi/scout_camp_s0.lua | 1 | 3291 | --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_scout_camp_s0 = object_building_poi_shared_scout_camp_s0:new {
-- Basic Camp
templateType = CAMPSTRUCTURE,
lotSize = 0,
baseMaintenanceRate = 0,
basePowerRate = 0,
skillMods = {
{"private_safe_logout", 1},
{"private_medical_rating", 60},
{"private_med_wound_health", 20},
{"private_med_wound_action", 20},
{"private_buff_mind", 100}
},
aggroMod = 0,
duration = 3600,
radius = 12,
experience = 360,
skillRequired = 5,
childObjects = {
{templateFile = "object/tangible/camp/camp_control_panel.iff",
x = 2.3, z = 0, y = 1.7,
ox = 0, oy = 1, oz = 0, ow = -0.707107,
cellid = -1,
containmentType = -1},
{templateFile = "object/tangible/camp/campfire_logs_ash.iff",
x = 0.806110, z = 0, y = -0.1,
ox = 0, oy = 0, oz = 0, ow = 0,
cellid = -1,
containmentType = -1},
{templateFile = "object/static/particle/particle_campfire_style_1.iff",
x = 0.806110, z = 0, y = -0.1,
ox = 0, oy = 0, oz = 0, ow = 0,
cellid = -1,
containmentType = -1},
{templateFile = "object/tangible/camp/camp_chair_s1.iff",
x = .863, z = 0, y = -2.75,
ox = 0, oy = 0, oz = -.009319, ow = -.999957,
cellid = -1,
containmentType = -1}
}
}
ObjectTemplates:addTemplate(object_building_poi_scout_camp_s0, "object/building/poi/scout_camp_s0.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_vinya_maysor.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_dressed_vinya_maysor = object_mobile_shared_dressed_vinya_maysor:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_vinya_maysor, "object/mobile/dressed_vinya_maysor.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/tanc_mite/lair_tanc_mite_mountain.lua | 1 | 2319 | --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_tanc_mite_lair_tanc_mite_mountain = object_tangible_lair_tanc_mite_shared_lair_tanc_mite_mountain:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_tanc_mite_lair_tanc_mite_mountain, "object/tangible/lair/tanc_mite/lair_tanc_mite_mountain.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/screenplays/tasks/rori/sidoras_bey.lua | 1 | 1492 | sidoras_bey_missions =
{
{
missionType = "retrieve",
primarySpawns =
{
{ npcTemplate = "sidoras_artisan", npcName = "Artisan" }
},
secondarySpawns = {},
itemSpawns =
{
{ itemTemplate = "object/tangible/mission/quest_item/sidoras_bey_q1_needed.iff", itemName = "Narmle Arts Gala Winner" }
},
rewards =
{
{ rewardType = "credits", amount = 25 },
}
},
{
missionType = "escort",
primarySpawns =
{
{ npcTemplate = "silaras_bey", npcName = "Silaras Bey" }
},
secondarySpawns = {
{ npcTemplate = "sidoras_thug", npcName = "a Thug" },
{ npcTemplate = "sidoras_thug", npcName = "a Thug" }
},
itemSpawns = {},
rewards =
{
{ rewardType = "credits", amount = 50 },
}
}
}
npcMapSidorasBey =
{
{
spawnData = { npcTemplate = "sidoras_bey", x = -5248.1, z = 80, y = -2387.4, direction = 90, cellID = 0, position = STAND },
worldPosition = { x = -5248, y = -2387 },
npcNumber = 1,
stfFile = "@static_npc/rori/rori_narmle_sidoras_bey",
missions = sidoras_bey_missions
},
}
SidorasBey = ThemeParkLogic:new {
npcMap = npcMapSidorasBey,
className = "SidorasBey",
screenPlayState = "sidoras_bey_quest",
planetName = "rori",
distance = 600
}
registerScreenPlay("SidorasBey", true)
sidoras_bey_mission_giver_conv_handler = mission_giver_conv_handler:new {
themePark = SidorasBey
}
sidoras_bey_mission_target_conv_handler = mission_target_conv_handler:new {
themePark = SidorasBey
}
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/attachment/weapon/merchant_cruiser_medium_turret_base_s01.lua | 3 | 2372 | --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_attachment_weapon_merchant_cruiser_medium_turret_base_s01 = object_tangible_ship_attachment_weapon_shared_merchant_cruiser_medium_turret_base_s01:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_attachment_weapon_merchant_cruiser_medium_turret_base_s01, "object/tangible/ship/attachment/weapon/merchant_cruiser_medium_turret_base_s01.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/chemistry/component/dispersal_mechanism.lua | 1 | 3229 | --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_chemistry_component_dispersal_mechanism = object_draft_schematic_chemistry_component_shared_dispersal_mechanism:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Dispersal Mechanism",
craftingToolTab = 64, -- (See DraftSchematicObjectTemplate.h)
complexity = 15,
size = 2,
xpType = "crafting_bio_engineer_creature",
xp = 45,
assemblySkill = "bio_engineer_assembly",
experimentingSkill = "bio_engineer_experimentation",
customizationSkill = "bio_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_chemical_ingredients_n", "craft_chemical_ingredients_n"},
ingredientTitleNames = {"delivery_medium", "body_shell"},
ingredientSlotType = {0, 0},
resourceTypes = {"fuel_petrochem_liquid", "petrochem_inert"},
resourceQuantities = {12, 12},
contribution = {100, 100},
targetTemplate = "object/tangible/component/chemistry/dispersal_mechanism.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_chemistry_component_dispersal_mechanism, "object/draft_schematic/chemistry/component/dispersal_mechanism.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/creature/npc/base/aqualish_s03_base_female.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_creature_npc_base_aqualish_s03_base_female = object_creature_npc_base_shared_aqualish_s03_base_female:new {
}
ObjectTemplates:addTemplate(object_creature_npc_base_aqualish_s03_base_female, "object/creature/npc/base/aqualish_s03_base_female.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/weapon/lightsaber/serverobjects.lua | 3 | 3371 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
-- Server Objects
includeFile("draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen1.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen2.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen3.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen4.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen5.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_polearm_gen1.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_polearm_gen2.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_polearm_gen3.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_polearm_gen4.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_polearm_gen5.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_refined_crystal_pack.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_training.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_two_hand_gen1.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_two_hand_gen2.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_two_hand_gen3.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_two_hand_gen4.lua")
includeFile("draft_schematic/weapon/lightsaber/lightsaber_two_hand_gen5.lua")
| agpl-3.0 |
cappiewu/luci | modules/luci-mod-admin-mini/luasrc/model/cbi/mini/wifi.lua | 48 | 11450 | -- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-- Data init --
local fs = require "nixio.fs"
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
if not uci:get("network", "wan") then
uci:section("network", "interface", "wan", {proto="none", ifname=" "})
uci:save("network")
uci:commit("network")
end
local wlcursor = luci.model.uci.cursor_state()
local wireless = wlcursor:get_all("wireless")
local wifidevs = {}
local ifaces = {}
for k, v in pairs(wireless) do
if v[".type"] == "wifi-iface" then
table.insert(ifaces, v)
end
end
wlcursor:foreach("wireless", "wifi-device",
function(section)
table.insert(wifidevs, section[".name"])
end)
-- Main Map --
m = Map("wireless", translate("Wifi"), translate("Here you can configure installed wifi devices."))
m:chain("network")
-- Status Table --
s = m:section(Table, ifaces, translate("Networks"))
link = s:option(DummyValue, "_link", translate("Link"))
function link.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
local iwinfo = sys.wifi.getiwinfo(ifname)
return iwinfo and "%d/%d" %{ iwinfo.quality, iwinfo.quality_max } or "-"
end
essid = s:option(DummyValue, "ssid", "ESSID")
bssid = s:option(DummyValue, "_bsiid", "BSSID")
function bssid.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
local iwinfo = sys.wifi.getiwinfo(ifname)
return iwinfo and iwinfo.bssid or "-"
end
channel = s:option(DummyValue, "channel", translate("Channel"))
function channel.cfgvalue(self, section)
return wireless[self.map:get(section, "device")].channel
end
protocol = s:option(DummyValue, "_mode", translate("Protocol"))
function protocol.cfgvalue(self, section)
local mode = wireless[self.map:get(section, "device")].mode
return mode and "802." .. mode
end
mode = s:option(DummyValue, "mode", translate("Mode"))
encryption = s:option(DummyValue, "encryption", translate("<abbr title=\"Encrypted\">Encr.</abbr>"))
power = s:option(DummyValue, "_power", translate("Power"))
function power.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
local iwinfo = sys.wifi.getiwinfo(ifname)
return iwinfo and "%d dBm" % iwinfo.txpower or "-"
end
scan = s:option(Button, "_scan", translate("Scan"))
scan.inputstyle = "find"
function scan.cfgvalue(self, section)
return self.map:get(section, "ifname") or false
end
-- WLAN-Scan-Table --
t2 = m:section(Table, {}, translate("<abbr title=\"Wireless Local Area Network\">WLAN</abbr>-Scan"), translate("Wifi networks in your local environment"))
function scan.write(self, section)
m.autoapply = false
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
local iwinfo = sys.wifi.getiwinfo(ifname)
if iwinfo then
local _, cell
for _, cell in ipairs(iwinfo.scanlist) do
t2.data[#t2.data+1] = {
Quality = "%d/%d" %{ cell.quality, cell.quality_max },
ESSID = cell.ssid,
Address = cell.bssid,
Mode = cell.mode,
["Encryption key"] = cell.encryption.enabled and "On" or "Off",
["Signal level"] = "%d dBm" % cell.signal,
["Noise level"] = "%d dBm" % iwinfo.noise
}
end
end
end
t2._render = t2.render
t2.render = function() end
t2:option(DummyValue, "Quality", translate("Link"))
essid = t2:option(DummyValue, "ESSID", "ESSID")
function essid.cfgvalue(self, section)
return self.map:get(section, "ESSID")
end
t2:option(DummyValue, "Address", "BSSID")
t2:option(DummyValue, "Mode", translate("Mode"))
chan = t2:option(DummyValue, "channel", translate("Channel"))
function chan.cfgvalue(self, section)
return self.map:get(section, "Channel")
or self.map:get(section, "Frequency")
or "-"
end
t2:option(DummyValue, "Encryption key", translate("<abbr title=\"Encrypted\">Encr.</abbr>"))
t2:option(DummyValue, "Signal level", translate("Signal"))
t2:option(DummyValue, "Noise level", translate("Noise"))
if #wifidevs < 1 then
return m
end
-- Config Section --
s = m:section(NamedSection, wifidevs[1], "wifi-device", translate("Devices"))
s.addremove = false
en = s:option(Flag, "disabled", translate("enable"))
en.rmempty = false
en.enabled = "0"
en.disabled = "1"
function en.cfgvalue(self, section)
return Flag.cfgvalue(self, section) or "0"
end
local hwtype = m:get(wifidevs[1], "type")
if hwtype == "atheros" then
mode = s:option(ListValue, "hwmode", translate("Mode"))
mode.override_values = true
mode:value("", "auto")
mode:value("11b", "802.11b")
mode:value("11g", "802.11g")
mode:value("11a", "802.11a")
mode:value("11bg", "802.11b+g")
mode.rmempty = true
end
ch = s:option(Value, "channel", translate("Channel"))
for i=1, 14 do
ch:value(i, i .. " (2.4 GHz)")
end
s = m:section(TypedSection, "wifi-iface", translate("Local Network"))
s.anonymous = true
s.addremove = false
s:option(Value, "ssid", translate("Network Name (<abbr title=\"Extended Service Set Identifier\">ESSID</abbr>)"))
bssid = s:option(Value, "bssid", translate("<abbr title=\"Basic Service Set Identifier\">BSSID</abbr>"))
local devs = {}
luci.model.uci.cursor():foreach("wireless", "wifi-device",
function (section)
table.insert(devs, section[".name"])
end)
if #devs > 1 then
device = s:option(DummyValue, "device", translate("Device"))
else
s.defaults.device = devs[1]
end
mode = s:option(ListValue, "mode", translate("Mode"))
mode.override_values = true
mode:value("ap", translate("Provide (Access Point)"))
mode:value("adhoc", translate("Independent (Ad-Hoc)"))
mode:value("sta", translate("Join (Client)"))
function mode.write(self, section, value)
if value == "sta" then
local oldif = m.uci:get("network", "wan", "ifname")
if oldif and oldif ~= " " then
m.uci:set("network", "wan", "_ifname", oldif)
end
m.uci:set("network", "wan", "ifname", " ")
self.map:set(section, "network", "wan")
else
if m.uci:get("network", "wan", "_ifname") then
m.uci:set("network", "wan", "ifname", m.uci:get("network", "wan", "_ifname"))
end
self.map:set(section, "network", "lan")
end
return ListValue.write(self, section, value)
end
encr = s:option(ListValue, "encryption", translate("Encryption"))
encr.override_values = true
encr:value("none", "No Encryption")
encr:value("wep", "WEP")
if hwtype == "atheros" or hwtype == "mac80211" then
local supplicant = fs.access("/usr/sbin/wpa_supplicant")
local hostapd = fs.access("/usr/sbin/hostapd")
if hostapd and supplicant then
encr:value("psk", "WPA-PSK")
encr:value("psk2", "WPA2-PSK")
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode")
encr:value("wpa", "WPA-Radius", {mode="ap"}, {mode="sta"})
encr:value("wpa2", "WPA2-Radius", {mode="ap"}, {mode="sta"})
elseif hostapd and not supplicant then
encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="adhoc"})
encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="adhoc"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="adhoc"})
encr:value("wpa", "WPA-Radius", {mode="ap"})
encr:value("wpa2", "WPA2-Radius", {mode="ap"})
encr.description = translate(
"WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
"and ad-hoc mode) to be installed."
)
elseif not hostapd and supplicant then
encr:value("psk", "WPA-PSK", {mode="sta"})
encr:value("psk2", "WPA2-PSK", {mode="sta"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"})
encr:value("wpa", "WPA-EAP", {mode="sta"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"})
encr.description = translate(
"WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
"and ad-hoc mode) to be installed."
)
else
encr.description = translate(
"WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
"and ad-hoc mode) to be installed."
)
end
elseif hwtype == "broadcom" then
encr:value("psk", "WPA-PSK")
encr:value("psk2", "WPA2-PSK")
encr:value("psk+psk2", "WPA-PSK/WPA2-PSK Mixed Mode")
end
key = s:option(Value, "key", translate("Key"))
key:depends("encryption", "wep")
key:depends("encryption", "psk")
key:depends("encryption", "psk2")
key:depends("encryption", "psk+psk2")
key:depends("encryption", "psk-mixed")
key:depends({mode="ap", encryption="wpa"})
key:depends({mode="ap", encryption="wpa2"})
key.rmempty = true
key.password = true
server = s:option(Value, "server", translate("Radius-Server"))
server:depends({mode="ap", encryption="wpa"})
server:depends({mode="ap", encryption="wpa2"})
server.rmempty = true
port = s:option(Value, "port", translate("Radius-Port"))
port:depends({mode="ap", encryption="wpa"})
port:depends({mode="ap", encryption="wpa2"})
port.rmempty = true
if hwtype == "atheros" or hwtype == "mac80211" then
nasid = s:option(Value, "nasid", translate("NAS ID"))
nasid:depends({mode="ap", encryption="wpa"})
nasid:depends({mode="ap", encryption="wpa2"})
nasid.rmempty = true
eaptype = s:option(ListValue, "eap_type", translate("EAP-Method"))
eaptype:value("TLS")
eaptype:value("TTLS")
eaptype:value("PEAP")
eaptype:depends({mode="sta", encryption="wpa"})
eaptype:depends({mode="sta", encryption="wpa2"})
cacert = s:option(FileUpload, "ca_cert", translate("Path to CA-Certificate"))
cacert:depends({mode="sta", encryption="wpa"})
cacert:depends({mode="sta", encryption="wpa2"})
privkey = s:option(FileUpload, "priv_key", translate("Path to Private Key"))
privkey:depends({mode="sta", eap_type="TLS", encryption="wpa2"})
privkey:depends({mode="sta", eap_type="TLS", encryption="wpa"})
privkeypwd = s:option(Value, "priv_key_pwd", translate("Password of Private Key"))
privkeypwd:depends({mode="sta", eap_type="TLS", encryption="wpa2"})
privkeypwd:depends({mode="sta", eap_type="TLS", encryption="wpa"})
auth = s:option(Value, "auth", translate("Authentication"))
auth:value("PAP")
auth:value("CHAP")
auth:value("MSCHAP")
auth:value("MSCHAPV2")
auth:depends({mode="sta", eap_type="PEAP", encryption="wpa2"})
auth:depends({mode="sta", eap_type="PEAP", encryption="wpa"})
auth:depends({mode="sta", eap_type="TTLS", encryption="wpa2"})
auth:depends({mode="sta", eap_type="TTLS", encryption="wpa"})
identity = s:option(Value, "identity", translate("Identity"))
identity:depends({mode="sta", eap_type="PEAP", encryption="wpa2"})
identity:depends({mode="sta", eap_type="PEAP", encryption="wpa"})
identity:depends({mode="sta", eap_type="TTLS", encryption="wpa2"})
identity:depends({mode="sta", eap_type="TTLS", encryption="wpa"})
password = s:option(Value, "password", translate("Password"))
password:depends({mode="sta", eap_type="PEAP", encryption="wpa2"})
password:depends({mode="sta", eap_type="PEAP", encryption="wpa"})
password:depends({mode="sta", eap_type="TTLS", encryption="wpa2"})
password:depends({mode="sta", eap_type="TTLS", encryption="wpa"})
end
if hwtype == "atheros" or hwtype == "broadcom" then
iso = s:option(Flag, "isolate", translate("AP-Isolation"), translate("Prevents Client to Client communication"))
iso.rmempty = true
iso:depends("mode", "ap")
hide = s:option(Flag, "hidden", translate("Hide <abbr title=\"Extended Service Set Identifier\">ESSID</abbr>"))
hide.rmempty = true
hide:depends("mode", "ap")
end
if hwtype == "mac80211" or hwtype == "atheros" then
bssid:depends({mode="adhoc"})
end
if hwtype == "broadcom" then
bssid:depends({mode="wds"})
bssid:depends({mode="adhoc"})
end
return m
| apache-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/vlutore/lair_vlutore_mountain.lua | 1 | 2303 | --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_vlutore_lair_vlutore_mountain = object_tangible_lair_vlutore_shared_lair_vlutore_mountain:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_vlutore_lair_vlutore_mountain, "object/tangible/lair/vlutore/lair_vlutore_mountain.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/armor/ithorian_sentinel/objects.lua | 3 | 20935 | --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_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bicep_l = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_l.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_bicep_l_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bicep_l.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 261,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 261,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_bicep_l",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_bicep_l",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 2273272421,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_bicep_l.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bicep_l, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_l.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bicep_r = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_r.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_bicep_r_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bicep_r.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 261,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 261,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_bicep_r",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_bicep_r",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 4155123702,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_bicep_r.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bicep_r, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_r.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_boots = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_boots.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_boots_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/shoe.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 263,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 263,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_boots",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_boots",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 3974465933,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_shoes.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_boots, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_boots.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bracer_l = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_l.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_bracer_l_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_l.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 261,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 261,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_bracer_l",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_bracer_l",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 2685476975,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_bracer_l.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bracer_l, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_l.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bracer_r = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_r.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_bracer_r_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_r.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 261,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 261,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_bracer_r",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_bracer_r",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 3502532092,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_bracer_r.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_bracer_r, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_r.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_chest_plate = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_chest_plate.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_chest_plate_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/vest.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 257,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 257,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_chest_plate",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_chest_plate",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 379409880,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_vest.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_chest_plate, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_chest_plate.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_gloves = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_gloves.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_gloves_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/gloves.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 262,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 262,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_gloves",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_gloves",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 2451608631,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_gloves.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_gloves, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_gloves.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_helmet = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_helmet.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_helmet_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/helmet_closed_full.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 258,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 258,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_helmet",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_helmet",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 618689855,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_armor_base.iff", "object/tangible/wearables/base/shared_base_helmet_closed_full.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_helmet, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_helmet.iff")
object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_leggings = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_leggings.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/ith_armor_s03_leggings_f.sat",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/pants.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 260,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@wearables_detail:ithorian_armor",
gameObjectType = 260,
locationReservationRadius = 0,
lookAtText = "@wearables_lookat:ith_armor_s03_leggings",
noBuildRadius = 0,
objectName = "@wearables_name:ith_armor_s03_leggings",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 792067440,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/base/shared_tangible_craftable.iff", "object/tangible/wearables/base/shared_wearables_base.iff", "object/tangible/wearables/base/shared_base_pants.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_wearables_armor_ithorian_sentinel_shared_ith_armor_s03_leggings, "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_leggings.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_commoner_tatooine_aqualish_male_01.lua | 3 | 2284 | --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_commoner_tatooine_aqualish_male_01 = object_mobile_shared_dressed_commoner_tatooine_aqualish_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_commoner_tatooine_aqualish_male_01, "object/mobile/dressed_commoner_tatooine_aqualish_male_01.iff")
| agpl-3.0 |
SpaceVim/SpaceVim | bundle/nvim-lspconfig/lua/lspconfig/server_configurations/denols.lua | 1 | 3092 | local util = require 'lspconfig.util'
local lsp = vim.lsp
local function buf_cache(bufnr, client)
local params = {}
params['referrer'] = { uri = vim.uri_from_bufnr(bufnr) }
params['uris'] = {}
client.request_sync('deno/cache', params)
end
local function virtual_text_document_handler(uri, res, client)
if not res then
return nil
end
local lines = vim.split(res.result, '\n')
local bufnr = vim.uri_to_bufnr(uri)
local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
if #current_buf ~= 0 then
return nil
end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, nil, lines)
vim.api.nvim_buf_set_option(bufnr, 'readonly', true)
vim.api.nvim_buf_set_option(bufnr, 'modified', false)
vim.api.nvim_buf_set_option(bufnr, 'modifiable', false)
lsp.buf_attach_client(bufnr, client.id)
end
local function virtual_text_document(uri, client)
local params = {
textDocument = {
uri = uri,
},
}
local result = client.request_sync('deno/virtualTextDocument', params)
virtual_text_document_handler(uri, result, client)
end
local function denols_handler(err, result, ctx)
if not result or vim.tbl_isempty(result) then
return nil
end
local client = vim.lsp.get_client_by_id(ctx.client_id)
for _, res in pairs(result) do
local uri = res.uri or res.targetUri
if uri:match '^deno:' then
virtual_text_document(uri, client)
res['uri'] = uri
res['targetUri'] = uri
end
end
lsp.handlers[ctx.method](err, result, ctx)
end
return {
default_config = {
cmd = { 'deno', 'lsp' },
filetypes = {
'javascript',
'javascriptreact',
'javascript.jsx',
'typescript',
'typescriptreact',
'typescript.tsx',
},
root_dir = util.root_pattern('deno.json', 'deno.jsonc', '.git'),
init_options = {
enable = true,
unstable = false,
},
handlers = {
['textDocument/definition'] = denols_handler,
['textDocument/references'] = denols_handler,
['workspace/executeCommand'] = function(err, result, context)
if context.params.command == 'deno.cache' then
buf_cache(context.bufnr, vim.lsp.get_client_by_id(context.client_id))
else
lsp.handlers[context.method](err, result, context)
end
end,
},
},
commands = {
DenolsCache = {
function()
local clients = vim.lsp.get_active_clients()
for _, client in ipairs(clients) do
if client.name == 'denols' then
buf_cache(0, client)
break
end
end
end,
description = 'Cache a module and all of its dependencies.',
},
},
docs = {
description = [[
https://github.com/denoland/deno
Deno's built-in language server
To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages
in your init.lua. Example:
```lua
vim.g.markdown_fenced_languages = {
"ts=typescript"
}
```
]],
default_config = {
root_dir = [[root_pattern("deno.json", "deno.jsonc", ".git")]],
},
},
}
| gpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/hair/sullustan/sul_hair_s11_f.lua | 3 | 2240 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_hair_sullustan_sul_hair_s11_f = object_tangible_hair_sullustan_shared_sul_hair_s11_f:new {
}
ObjectTemplates:addTemplate(object_tangible_hair_sullustan_sul_hair_s11_f, "object/tangible/hair/sullustan/sul_hair_s11_f.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/reptilian_flyer/lair_reptilian_flyer_mountain.lua | 1 | 2367 | --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_reptilian_flyer_lair_reptilian_flyer_mountain = object_tangible_lair_reptilian_flyer_shared_lair_reptilian_flyer_mountain:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_reptilian_flyer_lair_reptilian_flyer_mountain, "object/tangible/lair/reptilian_flyer/lair_reptilian_flyer_mountain.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/particle/particle_test_15.lua | 3 | 2216 | --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_particle_particle_test_15 = object_static_particle_shared_particle_test_15:new {
}
ObjectTemplates:addTemplate(object_static_particle_particle_test_15, "object/static/particle/particle_test_15.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/player/player_npc_university_naboo.lua | 1 | 2511 | -- GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
object_building_player_player_npc_university_naboo = object_building_player_shared_player_npc_university_naboo:new {
lotSize = 6,
baseMaintenanceRate = 65,
allowedZones = {"corellia", "dantooine", "lok", "naboo", "rori", "talus", "tatooine"},
publicStructure = 0,
skillMods = {
{"private_medical_rating", 100},
{"private_buff_mind", 100},
{"private_med_battle_fatigue", 5},
{"private_safe_logout", 1}
},
childObjects = {
{templateFile = "object/tangible/sign/player/house_address.iff", x = 3.3, z = 6.25, y = 18.0, ox = 0, oy = 1, oz = 0, ow = 0, cellid = -1, containmentType = -1},
{templateFile = "object/tangible/terminal/terminal_player_structure.iff", x = 7.5738, z = 1.133, y = -3.13489, ox = 0, oy = 1, oz = 0, ow = 0, cellid = 4, containmentType = -1},
},
shopSigns = {
{templateFile = "object/tangible/sign/player/house_address.iff", x = 3.3, z = 6.25, y = 18.0, ox = 0, oy = 1, oz = 0, ow = 0, cellid = -1, containmentType = -1, requiredSkill = "", suiItem = "@player_structure:house_address"},
{templateFile = "object/tangible/sign/player/shop_sign_s01.iff", x = 3.3, z = 2.5, y = 18.3, ox = 0, oy = 0, oz = 0, ow = 1, cellid = -1, containmentType = -1, requiredSkill = "crafting_merchant_management_01", suiItem = "@player_structure:shop_sign1"},
{templateFile = "object/tangible/sign/player/shop_sign_s02.iff", x = 3.3, z = 2.5, y = 18.3, ox = 0, oy = 0, oz = 0, ow = 1, cellid = -1, containmentType = -1, requiredSkill = "crafting_merchant_management_02", suiItem = "@player_structure:shop_sign2"},
{templateFile = "object/tangible/sign/player/shop_sign_s03.iff", x = 3.3, z = 2.5, y = 18.3, ox = 0, oy = 0, oz = 0, ow = 1, cellid = -1, containmentType = -1, requiredSkill = "crafting_merchant_management_03", suiItem = "@player_structure:shop_sign3"},
{templateFile = "object/tangible/sign/player/shop_sign_s04.iff", x = 3.3, z = 2.5, y = 18.3, ox = 0, oy = 0, oz = 0, ow = 1, cellid = -1, containmentType = -1, requiredSkill = "crafting_merchant_management_04", suiItem = "@player_structure:shop_sign4"},
},
constructionMarker = "object/building/player/construction/construction_player_house_naboo_medium_style_01.iff",
structureFootprintFileName = "footprint/building/player/shared_player_house_generic_medium_style_01.sfp",
length = 3,
width = 4
}
ObjectTemplates:addTemplate(object_building_player_player_npc_university_naboo, "object/building/player/player_npc_university_naboo.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/attachment/engine/tiebomber_engine_s01.lua | 3 | 2296 | --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_attachment_engine_tiebomber_engine_s01 = object_tangible_ship_attachment_engine_shared_tiebomber_engine_s01:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_tiebomber_engine_s01, "object/tangible/ship/attachment/engine/tiebomber_engine_s01.iff")
| agpl-3.0 |
ahmed112a/smart | plugins/invite.lua | 1 | 1331 | do
local function callbackres(extra, success, result)
--vardump(result)
local user = 'user#id'..result.peer_id
local chat = 'chat#id'..extra.chatid
local channel = 'channel#id'..extra.chatid
if is_banned(result.id, extra.chatid) then
send_large_msg(chat, 'User is banned.')
send_large_msg(channel, 'User is banned.')
elseif is_gbanned(result.id) then
send_large_msg(chat, 'User is globaly banned.')
send_large_msg(channel, 'User is globaly banned.')
else
chat_add_user(chat, user, ok_cb, false)
channel_invite(channel, user, ok_cb, false)
end
end
function run(msg, matches)
local data = load_data(_config.moderation.data)
if not is_momod(msg) then
return
end
if not is_admin1(msg) then -- For admins only !
return 'Only admins can invite.'
end
if not is_realm(msg) then
if data[tostring(msg.to.id)]['settings']['lock_member'] == 'yes' and not is_admin1(msg) then
return 'Group is private.'
end
end
if msg.to.type ~= 'chat' or msg.to.type ~= 'channel' then
local cbres_extra = {chatid = msg.to.id}
local username = matches[1]
local username = username:gsub("@","")
resolve_username(username, callbackres, cbres_extra)
end
end
return {
patterns = {
"^ضيف (.*)$"
},
run = run
}
end
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/ray/objects.lua | 3 | 5422 | --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_ray_shared_lair_ray = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/ray/shared_lair_ray.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/defaultappearance.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:ray",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:ray",
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 = 3495854251,
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_ray_shared_lair_ray, "object/tangible/lair/ray/shared_lair_ray.iff")
object_tangible_lair_ray_shared_lair_ray_underwater = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/lair/ray/shared_lair_ray_underwater.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/defaultappearance.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:ray_underwater",
gameObjectType = 4,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 64,
objectName = "@lair_n:ray_underwater",
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 = 3792404273,
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_ray_shared_lair_ray_underwater, "object/tangible/lair/ray/shared_lair_ray_underwater.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/deed/pet_deed/bearded_jax_deed.lua | 2 | 2767 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_deed_pet_deed_bearded_jax_deed = object_tangible_deed_pet_deed_shared_bearded_jax_deed:new {
templateType = PETDEED,
numberExperimentalProperties = {1, 1},
experimentalProperties = {"XX", "XX"},
experimentalWeights = {1, 1},
experimentalGroupTitles = {"null", "null"},
experimentalSubGroupTitles = {"null", "null"},
experimentalMin = {0, 0},
experimentalMax = {0, 0},
experimentalPrecision = {0, 0},
experimentalCombineType = {0, 0},
generatedObjectTemplate = "mobile/pet/bearded_jax_be.iff",
controlDeviceObjectTemplate = "object/intangible/pet/bearded_jax_hue.iff",
mobileTemplate = "bearded_jax_be",
}
ObjectTemplates:addTemplate(object_tangible_deed_pet_deed_bearded_jax_deed, "object/tangible/deed/pet_deed/bearded_jax_deed.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_sith_shadow_zab_f_nco.lua | 3 | 2232 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_sith_shadow_zab_f_nco = object_mobile_shared_dressed_sith_shadow_zab_f_nco:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_sith_shadow_zab_f_nco, "object/mobile/dressed_sith_shadow_zab_f_nco.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/draft_schematic/scout/item_trap_state_def_1.lua | 1 | 3098 | --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_scout_item_trap_state_def_1 = object_draft_schematic_scout_shared_item_trap_state_def_1:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Stink Bomb",
craftingToolTab = 524288, -- (See DraftSchematicObjectTemplate.h)
complexity = 7,
size = 1,
xpType = "camp",
xp = 30,
assemblySkill = "general_assembly",
experimentingSkill = "general_experimentation",
customizationSkill = "clothing_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"trap_housing", "musk"},
ingredientSlotType = {0, 0},
resourceTypes = {"bone", "hide"},
resourceQuantities = {10, 5},
contribution = {100, 100},
targetTemplate = "object/tangible/scout/trap/trap_state_def_1.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_scout_item_trap_state_def_1, "object/draft_schematic/scout/item_trap_state_def_1.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/shipcontrol/serverobjects.lua | 3 | 2402 | --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/shipcontrol/pilot_chair.lua")
includeFile("tangible/shipcontrol/shipcontrol_corvette.lua")
includeFile("tangible/shipcontrol/shipcontrol_falcon.lua")
includeFile("tangible/shipcontrol/shipoperations_falcon.lua")
includeFile("tangible/shipcontrol/turretcontrol_falcon.lua")
includeFile("tangible/shipcontrol/turretcontrol_vt49.lua")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/condor_dragon/serverobjects.lua | 3 | 2262 | --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/condor_dragon/lair_condor_dragon.lua")
includeFile("tangible/lair/condor_dragon/lair_condor_dragon_forest.lua")
includeFile("tangible/lair/condor_dragon/lair_condor_dragon_mountain.lua")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/corellia/drall_patriot_legionnaire.lua | 1 | 1142 | drall_patriot_legionnaire = Creature:new {
objectName = "@mob/creature_names:drall_patriot_legionnare",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "drall",
faction = "drall",
level = 14,
chanceHit = 0.3,
damageMin = 150,
damageMax = 160,
baseXp = 831,
baseHAM = 2000,
baseHAMmax = 2400,
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 = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {
"object/mobile/drall_male.iff",
"object/mobile/drall_female.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 7000000},
{group = "loot_kit_parts", chance = 2000000},
{group = "tailor_components", chance = 1000000}
}
}
},
weapons = {"pirate_weapons_medium"},
conversationTemplate = "",
reactionStf = "@npc_reaction/military",
attacks = merge(brawlermid,marksmanmid)
}
CreatureTemplates:addCreatureTemplate(drall_patriot_legionnaire, "drall_patriot_legionnaire")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/droid_interface/ddi_rss_enhanced_imperial_1.lua | 3 | 2360 | --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_droid_interface_ddi_rss_enhanced_imperial_1 = object_tangible_ship_components_droid_interface_shared_ddi_rss_enhanced_imperial_1:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_droid_interface_ddi_rss_enhanced_imperial_1, "object/tangible/ship/components/droid_interface/ddi_rss_enhanced_imperial_1.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_criminal_thug_trandoshan_male_01.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_mobile_dressed_criminal_thug_trandoshan_male_01 = object_mobile_shared_dressed_criminal_thug_trandoshan_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_criminal_thug_trandoshan_male_01, "object/mobile/dressed_criminal_thug_trandoshan_male_01.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/dungeon/terminal_free_s1.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_tangible_dungeon_terminal_free_s1 = object_tangible_dungeon_shared_terminal_free_s1:new {
}
ObjectTemplates:addTemplate(object_tangible_dungeon_terminal_free_s1, "object/tangible/dungeon/terminal_free_s1.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/lair/npc_theater/global_imperial_warrant_officer_camp_imperial_medium_theater.lua | 1 | 1051 | global_imperial_warrant_officer_camp_imperial_medium_theater = Lair:new {
mobiles = {
{"imperial_warrant_officer_i",1},
{"imperial_warrant_officer_ii",2}
},
spawnLimit = 12,
buildingsVeryEasy = {"object/building/poi/lok_imperial_medium4.iff","object/building/poi/lok_imperial_medium5.iff"},
buildingsEasy = {"object/building/poi/lok_imperial_medium4.iff","object/building/poi/lok_imperial_medium5.iff"},
buildingsMedium = {"object/building/poi/lok_imperial_medium4.iff","object/building/poi/lok_imperial_medium5.iff"},
buildingsHard = {"object/building/poi/lok_imperial_medium4.iff","object/building/poi/lok_imperial_medium5.iff"},
buildingsVeryHard = {"object/building/poi/lok_imperial_medium4.iff","object/building/poi/lok_imperial_medium5.iff"},
missionBuilding = "object/tangible/lair/base/objective_banner_imperial.iff",
mobType = "npc",
buildingType = "theater",
faction = "imperial"
}
addLairTemplate("global_imperial_warrant_officer_camp_imperial_medium_theater", global_imperial_warrant_officer_camp_imperial_medium_theater)
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_lok_cas_vankoo.lua | 3 | 2204 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_lok_cas_vankoo = object_mobile_shared_dressed_lok_cas_vankoo:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_lok_cas_vankoo, "object/mobile/dressed_lok_cas_vankoo.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/wearables/pants/pants_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_pants_pants_s13 = object_tangible_wearables_pants_shared_pants_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_pants_pants_s13, "object/tangible/wearables/pants/pants_s13.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/droid_interface/ddi_sds_elite.lua | 3 | 2304 | --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_droid_interface_ddi_sds_elite = object_tangible_ship_components_droid_interface_shared_ddi_sds_elite:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_droid_interface_ddi_sds_elite, "object/tangible/ship/components/droid_interface/ddi_sds_elite.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/armor/arm_sorosuub_elite_plastisteel.lua | 3 | 2332 | --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_armor_arm_sorosuub_elite_plastisteel = object_tangible_ship_components_armor_shared_arm_sorosuub_elite_plastisteel:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_armor_arm_sorosuub_elite_plastisteel, "object/tangible/ship/components/armor/arm_sorosuub_elite_plastisteel.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/poi/corellia_drall_abbot_large2.lua | 2 | 2270 | --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_drall_abbot_large2 = object_building_poi_shared_corellia_drall_abbot_large2:new {
gameObjectType = 531,
}
ObjectTemplates:addTemplate(object_building_poi_corellia_drall_abbot_large2, "object/building/poi/corellia_drall_abbot_large2.iff")
| agpl-3.0 |
TerraME/terrame | packages/base/tests/functional/basics/CellularSpace.lua | 2 | 44462 | -------------------------------------------------------------------------------------------
-- TerraME - a software platform for multiple scale spatially-explicit dynamic modeling.
-- Copyright (C) 2001-2017 INPE and TerraLAB/UFOP -- www.terrame.org
-- This code is part of the TerraME framework.
-- This framework 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.1 of the License, or (at your option) any later version.
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library.
-- The authors reassure the license terms regarding the warranties.
-- They specifically disclaim any warranties, including, but not limited to,
-- the implied warranties of merchantability and fitness for a particular purpose.
-- The framework provided hereunder is on an "as is" basis, and the authors have no
-- obligation to provide maintenance, support, updates, enhancements, or modifications.
-- In no event shall INPE and TerraLAB / UFOP be held liable to any party for direct,
-- indirect, special, incidental, or consequential damages arising out of the use
-- of this software and its documentation.
--
-------------------------------------------------------------------------------------------
return{
CellularSpace = function(unitTest)
local basicTests = function()
Random{seed = 12345}
local cs = CellularSpace{xdim = 10}
unitTest:assertType(cs, "CellularSpace")
unitTest:assertEquals(#cs, 100)
unitTest:assertEquals(10, cs.xdim)
unitTest:assertEquals(10, cs.ydim)
unitTest:assertType(cs:sample(), "Cell")
unitTest:assertType(cs.cells, "table")
local cell = Cell{
defor = 1,
road = true,
cover = "pasture",
deforest = function(self) self.defor = self.defor + 1 end,
water = Random{1, 2, 3},
set = function() end
}
local replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10,
set = 5
}
end
unitTest:assertWarning(replaceWarn, "Attribute 'set' will not be replaced by a summary function.")
unitTest:assertEquals(cs:defor(), 100)
unitTest:assertEquals(cs:road(), 100)
unitTest:assertEquals(cs:cover().pasture, 100)
unitTest:assertEquals(cs:water(), 218)
unitTest:assert(cs:deforest())
unitTest:assertEquals(cs:sample().defor, 2)
cell = Cell{
defor = 1,
deforest = function(self)
if self.x > 4 then
return false
end
self.defor = self.defor + 1
end,
init = function(self)
self.status = "forest"
end,
value = 4
}
replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10,
status = 5
}
end
unitTest:assertWarning(replaceWarn, "Attribute 'status' will not be replaced by a summary function.")
unitTest:assertEquals(cs:defor(), 100)
unitTest:assert(not cs:deforest())
unitTest:assertEquals(cs:defor(), 150)
cell = Cell{
defor = 1,
deforest = function(self)
if self.x > 4 then
return false
end
self.defor = self.defor + 1
end,
value = 4
}
replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10,
value = 5
}
end
unitTest:assertWarning(replaceWarn, "Attribute 'value' will not be replaced by a summary function.")
unitTest:assertEquals(cs:defor(), 100)
unitTest:assert(not cs:deforest())
unitTest:assertEquals(cs:defor(), 150)
cell = Cell{
defor = 1,
deforest = function(self)
if self.x > 4 then
return false
end
self.defor = self.defor + 1
end,
alive = true
}
replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10,
alive = 5
}
end
unitTest:assertWarning(replaceWarn, "Attribute 'alive' will not be replaced by a summary function.")
unitTest:assertEquals(cs:defor(), 100)
unitTest:assert(not cs:deforest())
unitTest:assertEquals(cs:defor(), 150)
cell = Cell{
defor = 1,
deforest = function(self)
if self.x > 4 then
return false
end
self.defor = self.defor + 1
end,
status = "forest"
}
replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10,
status = 5
}
end
unitTest:assertWarning(replaceWarn, "Attribute 'status' will not be replaced by a summary function.")
unitTest:assertEquals(cs:defor(), 100)
unitTest:assert(not cs:deforest())
unitTest:assertEquals(cs:defor(), 150)
cell = Cell{
getNeighborhood = function()
return "neighbor"
end
}
replaceWarn = function()
cs = CellularSpace{
instance = cell,
xdim = 10
}
end
unitTest:assertWarning(replaceWarn, "Function 'getNeighborhood()' from Cell is replaced in the instance.")
unitTest:assertEquals(cs:sample():getNeighborhood(), "neighbor")
end
local gis = getPackage("gis")
local createProject = function()
return gis.Project{
file = "cellspace_basic.tview",
clean = true,
author = "Avancini",
title = "Cellular Space Tests"
}
end
local shapeFileTests = function()
local proj = createProject()
local layerName1 = "Sampa"
gis.Layer{
project = proj,
name = layerName1,
file = filePath("test/sampa.shp", "gis"),
}
local testDir = currentDir()
local shp1 = "sampa_cells.shp"
local filePath1 = testDir..shp1
local fn1 = File(filePath1):name()
fn1 = testDir..fn1
File(fn1):deleteIfExists()
local clName1 = "Sampa_Cells"
local layer = gis.Layer{
project = proj,
clean = true,
input = layerName1,
name = clName1,
resolution = 1,
file = filePath1,
progress = false
}
local cs
local geometryDefaultValue = function()
cs = CellularSpace{
project = proj,
layer = clName1,
geometry = true
}
end
unitTest:assertWarning(geometryDefaultValue, defaultValueMsg("geometry", true))
unitTest:assertEquals(proj.file, cs.project.file)
unitTest:assertType(cs.layer, "Layer")
unitTest:assertEquals(layer.source, "shp")
unitTest:assertEquals(layer.file, filePath1)
cs = CellularSpace{
file = filePath1
}
unitTest:assert(#cs.cells > 0)
forEachCell(cs, function(c)
unitTest:assertNotNil(c.x)
unitTest:assertNotNil(c.y)
end)
cs = CellularSpace{
project = proj,
layer = clName1,
geometry = false
}
forEachCell(cs, function(c)
unitTest:assertNil(c.geom)
unitTest:assertNil(c[layer.geometry])
end)
cs = CellularSpace{
project = proj,
layer = clName1,
geometry = false
}
forEachCell(cs, function(c)
unitTest:assertNil(c.geom)
unitTest:assertNil(c[layer.geometry])
end)
proj.file:delete()
File(fn1):delete()
end
local tifTests = function()
local proj = createProject()
local layerName1 = "tif_one_Layer"
local filePath1 = filePath("itaituba-elevation.tif", "gis")
local layer = gis.Layer{
project = proj,
name = layerName1,
file = filePath1
}
local cs = CellularSpace{
project = proj,
layer = layerName1
}
unitTest:assertEquals(proj.file:name(), cs.project.file:name())
unitTest:assertType(cs.layer, "Layer")
unitTest:assertEquals(layer.source, "tif")
unitTest:assertEquals(layer.file, tostring(filePath1))
unitTest:assertEquals(#cs, 17928)
cs = CellularSpace{
file = filePath1
}
unitTest:assertEquals(#cs, 17928)
proj.file:delete()
end
local netCdfTests = function()
local proj = createProject()
local layerName1 = "NC_vegtype2000"
local filePath1 = filePath("test/vegtype_2000.nc", "gis")
local layer = gis.Layer{
project = proj,
name = layerName1,
file = filePath1,
epsg = 4326
}
local cs = CellularSpace{
project = proj,
layer = layerName1
}
unitTest:assertEquals(proj.file:name(), cs.project.file:name()) -- SKIP
unitTest:assertType(cs.layer, "Layer") -- SKIP
unitTest:assertEquals(layer.source, "nc") -- SKIP
unitTest:assertEquals(layer.file, tostring(filePath1)) -- SKIP
unitTest:assertEquals(#cs.cells, 8904) -- SKIP
cs = CellularSpace{
file = filePath1
}
unitTest:assertEquals(#cs.cells, 8904) -- SKIP
proj.file:delete()
end
local ascTests = function()
local proj = createProject()
local layerName1 = "ASC_biomassa-manaus"
local filePath1 = filePath("test/biomassa-manaus.asc", "gis")
local layer = gis.Layer{
project = proj,
name = layerName1,
file = filePath1
}
local cs = CellularSpace{
project = proj,
layer = layerName1
}
unitTest:assertEquals(proj.file:name(), cs.project.file:name()) -- SKIP
unitTest:assertType(cs.layer, "Layer") -- SKIP
unitTest:assertEquals(layer.source, "asc") -- SKIP
unitTest:assertEquals(layer.file, tostring(filePath1)) -- SKIP
unitTest:assertEquals(#cs.cells, 9964) -- SKIP
cs = CellularSpace{
file = filePath1
}
unitTest:assertEquals(#cs.cells, 9964) -- SKIP
proj.file:delete()
end
local geoJsonTests = function()
local projName = "geojson_cellspace.tview"
local proj = gis.Project{
file = projName,
clean = true,
author = "Carneiro Heitor",
title = "GeoJSON Cellular Space"
}
local esGjLayer = gis.Layer{
project = proj,
name = "GeoJSON_ES",
file = filePath("test/es_sirgas2000_5880.geojson", "gis")
}
local esShpLayer = gis.Layer {
project = proj,
name = "ESShp",
file = filePath("test/es_sirgas2000_5880.shp", "gis")
}
local esShp = CellularSpace {
project = proj,
layer = esShpLayer.name
}
local esGj = CellularSpace{
project = proj,
layer = esGjLayer.name
}
unitTest:assertEquals(#esShp, #esGj)
for i = 0, #esShp - 1 do
local s = tostring(i)
unitTest:assertEquals(esShp:get(s).idh_POP, esGj:get(s).idh_POP)
end
local gjCsFile = File("gjSpCs.geojson")
gjCsFile:deleteIfExists()
local gjCsLayerName = "GeoJSON_ES_Cells"
local resolution = 20e3
local gjCsLayer = gis.Layer{
project = proj,
input = esGjLayer.name,
name = gjCsLayerName,
resolution = resolution,
file = gjCsFile,
progress = false
}
local esGjCs = CellularSpace{
project = proj,
layer = gjCsLayerName
}
unitTest:assertEquals(projName, esGjCs.project.file:name())
unitTest:assertType(esGjCs.layer, "Layer")
unitTest:assertEquals(gjCsLayer.source, "geojson")
unitTest:assertEquals(gjCsLayer.file, tostring(gjCsFile)) -- TODO(#2176)
unitTest:assert(#esGjCs.cells > 0)
forEachCell(esGjCs, function(c)
unitTest:assertNotNil(c.x)
unitTest:assertNotNil(c.y)
unitTest:assertNotNil(c.geom)
end)
local esShpCsLayer = gis.Layer{
project = proj,
input = esShpLayer.name,
name = "ES_Cells_Shp",
resolution = resolution,
file = "esShpCs.shp",
clean = true,
progress = false
}
local esShpCs = CellularSpace {
project = proj,
layer = esShpCsLayer.name
}
unitTest:assertEquals(#esGjCs, #esShpCs)
for i = 0, #esGjCs - 1 do
local s = tostring(i)
unitTest:assertEquals(esShpCs:get(s).id, esGjCs:get(s).id)
end
local gjCsWithoutProject = CellularSpace{
file = gjCsFile
}
unitTest:assert(#gjCsWithoutProject.cells > 0)
forEachCell(gjCsWithoutProject, function(c)
unitTest:assertNotNil(c.x)
unitTest:assertNotNil(c.y)
unitTest:assertNotNil(c.geom)
end)
local gjCsWithoutGeom = CellularSpace{
project = projName,
layer = gjCsLayerName,
geometry = false
}
forEachCell(gjCsWithoutGeom, function(c)
unitTest:assertNil(c.geom)
end)
gjCsFile:delete()
esShpCsLayer:delete()
proj.file:delete()
end
unitTest:assert(basicTests)
unitTest:assert(shapeFileTests)
unitTest:assert(tifTests)
if _Gtme.sessionInfo().system == "windows" then
unitTest:assert(netCdfTests) -- SKIP
unitTest:assert(ascTests) -- SKIP
end
unitTest:assert(geoJsonTests)
end,
__len = function(unitTest)
local cs = CellularSpace{xdim = 10}
unitTest:assertEquals(#cs, 100)
end,
__tostring = function(unitTest)
local cs1 = CellularSpace{
xdim = 10,
ydim = 20,
xyz = function() end,
vvv = 333}
unitTest:assertEquals(tostring(cs1), [[cObj_ userdata
cells vector of size 200
load function
source string [virtual]
vvv number [333]
xMax number [9]
xMin number [0]
xdim number [10]
xyz function
yMax number [19]
yMin number [0]
ydim number [20]
]])
end,
add = function(unitTest)
local cs = CellularSpace{xdim = 10}
local c = Cell{x = 20, y = 20}
cs:add(c)
unitTest:assertEquals(#cs, 101)
unitTest:assertEquals(cs.cells[101], c)
end,
createNeighborhood = function(unitTest)
local icell = Cell{}
local cs = CellularSpace{xdim = 5, instance = icell}
local unnecessaryArgument = function()
cs:createNeighborhood{namen = "abc"}
end
unitTest:assertWarning(unnecessaryArgument, unnecessaryArgumentMsg("namen", "name"))
-- Vector of size counters - Used to verify the size of the neighborhoods
local sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood()
unitTest:assert(not neighborhood:isNeighbor(cell))
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x >= (cell.x - 1))
unitTest:assert(neigh.x <= (cell.x + 1))
unitTest:assert(neigh.y >= (cell.y -1))
unitTest:assert(neigh.y <= (cell.y + 1))
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
end)
unitTest:assertEquals(4, sizes[3])
unitTest:assertEquals(12, sizes[5])
unitTest:assertEquals(9, sizes[8])
cs:createNeighborhood{name = "neigh2"}
local sample = cs:sample()
forEachNeighbor(sample, "neigh2", function(neigh)
unitTest:assert(sample ~= neigh)
unitTest:assert(neigh.x >= (sample.x - 1))
unitTest:assert(neigh.x <= (sample.x + 1))
unitTest:assert(neigh.y >= (sample.y - 1))
unitTest:assert(neigh.y <= (sample.y + 1))
end)
cs:createNeighborhood{name = "my_neighborhood2", self = true}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood2")
unitTest:assert(neighborhood:isNeighbor(cell))
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood2", function(neigh)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 1)
unitTest:assert(neigh.y <= cell.y + 1)
end)
end)
unitTest:assertEquals(4, sizes[4])
unitTest:assertEquals(12, sizes[6])
unitTest:assertEquals(9, sizes[9])
local verifyWrapX = function(cs1, cell, neigh)
return neigh.x == ((cell.x - 1) - cs1.xMin) % (cs1.xMax - cs1.xMin + 1) + cs1.xMin
or neigh.x == cell.x
or neigh.x == ((cell.x + 1) - cs1.xMin) % (cs1.xMax - cs1.xMin + 1) + cs1.xMin
end
local verifyWrapY = function(cs1, cell, neigh)
return neigh.y == (((cell.y - 1) - cs1.yMin) % (cs1.yMax - cs1.yMin + 1) + cs1.yMin)
or neigh.y == cell.y
or neigh.y == (((cell.y + 1) - cs1.yMin) % (cs1.yMax - cs1.yMin + 1) + cs1.yMin)
end
cs:createNeighborhood{name = "my_neighborhood3", wrap = true}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood3")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(8, neighborhoodSize)
unitTest:assert(not neighborhood:isNeighbor(cell))
forEachNeighbor(cell, function(neigh)
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
end)
cs:createNeighborhood{
name = "my_neighborhood4",
wrap = true,
self = true
}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood4")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(9, neighborhoodSize)
unitTest:assert(neighborhood:isNeighbor(cell))
forEachNeighbor(cell, function(neigh)
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
end)
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{strategy = "vonneumann"}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x == cell.x or neigh.y == cell.y)
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
unitTest:assert(not neighborhood:isNeighbor(cell))
end)
unitTest:assertEquals(4, sizes[2])
unitTest:assertEquals(12, sizes[3])
unitTest:assertEquals(9, sizes[4])
cs:createNeighborhood{
strategy = "vonneumann",
name = "my_neighborhood1",
self = true
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood1", function(neigh, weight)
unitTest:assertEquals(1 / neighborhoodSize, weight, 0.00001)
unitTest:assert(neigh.x == cell.x or neigh.y == cell.y)
sumWeight = sumWeight + weight
end)
unitTest:assert(neighborhood:isNeighbor(cell))
end)
unitTest:assertEquals(4, sizes[3])
unitTest:assertEquals(12, sizes[4])
unitTest:assertEquals(9, sizes[5])
cs:createNeighborhood{
strategy = "vonneumann",
name = "my_neighborhood2",
wrap = true
}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood2")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(4, neighborhoodSize)
local sumWeight = 0
forEachNeighbor(cell, "my_neighborhood2", function(neigh, weight)
unitTest:assertEquals(1 / neighborhoodSize, weight, 0.00001)
unitTest:assert(cell ~= neigh)
unitTest:assert(neigh.x == cell.x or neigh.y == cell.y)
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
unitTest:assert(not neighborhood:isNeighbor(cell))
forEachNeighbor(cell, function(neigh)
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
end)
cs:createNeighborhood{
strategy = "vonneumann",
name = "my_neighborhood3",
wrap = true,
self = true
}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood3")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(5, neighborhoodSize)
forEachNeighbor(cell, "my_neighborhood3", function(neigh, weight)
unitTest:assertEquals(1 / neighborhoodSize, weight, 0.00001)
unitTest:assert(neigh.x == cell.x or neigh.y == cell.y)
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
unitTest:assert(neighborhood:isNeighbor(cell))
end)
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{strategy = "diagonal"}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x ~= cell.x and neigh.y ~= cell.y)
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
unitTest:assert(not neighborhood:isNeighbor(cell))
end)
unitTest:assertEquals(4, sizes[1])
unitTest:assertEquals(12, sizes[2])
unitTest:assertEquals(9, sizes[4])
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{
strategy = "diagonal",
wrap = true
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x ~= cell.x and neigh.y ~= cell.y)
sumWeight = sumWeight + weight
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
unitTest:assert(not neighborhood:isNeighbor(cell))
end)
unitTest:assertEquals(25, sizes[4])
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{
strategy = "diagonal",
self = true,
wrap = true
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert((neigh.x ~= cell.x and neigh.y ~= cell.y) or (cell == neigh))
sumWeight = sumWeight + weight
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
end)
unitTest:assertEquals(25, sizes[5])
-- mxn
cs = CellularSpace{xdim = 10}
cs:createNeighborhood{strategy = "mxn"}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood()
unitTest:assert(neighborhood:isNeighbor(cell))
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 1)
unitTest:assert(neigh.y <= cell.y + 1)
unitTest:assertEquals(1, weight)
end)
end)
unitTest:assertEquals(4, sizes[4])
unitTest:assertEquals(32, sizes[6])
unitTest:assertEquals(64, sizes[9])
cs:createNeighborhood{
strategy = "mxn",
m = 5,
wrap = true,
name = "mxnwrap"
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("mxnwrap")
unitTest:assert(neighborhood:isNeighbor(cell))
unitTest:assertEquals(#neighborhood, 25)
forEachNeighbor(cell, function(neigh)
unitTest:assert(verifyWrapX(cs, cell, neigh))
unitTest:assert(verifyWrapY(cs, cell, neigh))
end)
end)
local filterFunction = function(cell, neighbor)
return neighbor.y > cell.y
end
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood1",
filter = filterFunction
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood1", function(neigh)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 1)
unitTest:assert(neigh.y <= cell.y + 1)
unitTest:assert(filterFunction(cell, neigh))
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(18, sizes[2])
unitTest:assertEquals(72, sizes[3])
local weightFunction = function(cell, neighbor)
return (neighbor.y - cell.y) / (neighbor.y + cell.y)
end
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood2",
filter = filterFunction,
weight = weightFunction
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood2", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 1)
unitTest:assert(neigh.y <= cell.y + 1)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(((neigh.y - cell.y) / (neigh.y + cell.y)), weight, 0.00001)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(18, sizes[2])
unitTest:assertEquals(72, sizes[3])
cs = CellularSpace{xdim = 10}
local cs2 = CellularSpace{xdim = 10}
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood1",
m = 5
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
unitTest:assertNotNil(neighborhood)
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood1", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 2)
unitTest:assert(neigh.x <= cell.x + 2)
unitTest:assert(neigh.y >= cell.y - 2)
unitTest:assert(neigh.y <= cell.y + 2)
unitTest:assertEquals(1, weight)
end)
end)
unitTest:assertEquals(36, sizes[25])
unitTest:assertEquals(4, sizes[9])
unitTest:assertEquals(24, sizes[20])
unitTest:assertEquals(4, sizes[16])
unitTest:assertEquals(8, sizes[12])
unitTest:assertEquals(24, sizes[15])
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood2",
m = 5,
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood2")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood2", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 2)
unitTest:assert(neigh.x <= cell.x + 2)
unitTest:assert(neigh.y >= cell.y - 2)
unitTest:assert(neigh.y <= cell.y + 2)
unitTest:assertEquals(1, weight)
end)
end)
unitTest:assertEquals(36, sizes[25])
unitTest:assertEquals(4, sizes[9])
unitTest:assertEquals(24, sizes[20])
unitTest:assertEquals(4, sizes[16])
unitTest:assertEquals(8, sizes[12])
unitTest:assertEquals(24, sizes[15])
filterFunction = function(cell, neighbor)
return neighbor.y > cell.y
end
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood3",
n = 5,
filter = filterFunction
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood3")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood3", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 2)
unitTest:assert(neigh.y <= cell.y + 2)
unitTest:assert(neigh.y > cell.y)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(1, weight)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(2, sizes[2])
unitTest:assertEquals(8, sizes[3])
unitTest:assertEquals(16, sizes[4])
unitTest:assertEquals(64, sizes[6])
weightFunction = function(cell, neighbor)
return (neighbor.y - cell.y) / (neighbor.y + cell.y)
end
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood4",
m = 5,
filter = filterFunction,
weight = weightFunction
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood4")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood4", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 2)
unitTest:assert(neigh.x <= cell.x + 2)
unitTest:assert(neigh.y >= cell.y - 2)
unitTest:assert(neigh.y <= cell.y + 2)
unitTest:assert(neigh.y > cell.y)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(((neigh.y - cell.y) / (neigh.y + cell.y)), weight, 0.00001)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(2, sizes[3])
unitTest:assertEquals(2, sizes[4])
unitTest:assertEquals(6, sizes[5])
unitTest:assertEquals(16, sizes[6])
unitTest:assertEquals(16, sizes[8])
unitTest:assertEquals(48, sizes[10])
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood5",
n = 5,
filter = filterFunction,
weight = weightFunction
}
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood5")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood5", function(neigh, weight)
unitTest:assert(neigh.x >= cell.x - 1)
unitTest:assert(neigh.x <= cell.x + 1)
unitTest:assert(neigh.y >= cell.y - 2)
unitTest:assert(neigh.y <= cell.y + 2)
unitTest:assert(neigh.y > cell.y)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(((neigh.y - cell.y) / (neigh.y + cell.y)), weight, 0.00001)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(2, sizes[2])
unitTest:assertEquals(8, sizes[3])
unitTest:assertEquals(16, sizes[4])
unitTest:assertEquals(64, sizes[6])
weightFunction = function(cell, neighbor)
if neighbor.x + cell.x == 0 then
return 0
else
return (neighbor.x - cell.x) / (neighbor.x + cell.x)
end
end
local defaultValue = function()
cs:createNeighborhood{
strategy = "mxn",
name = "my_neighborhood6",
target = cs2,
m = 5,
n = 5,
filter = filterFunction,
weight = weightFunction
}
end
unitTest:assertWarning(defaultValue, defaultValueMsg("n", 5))
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood6")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood6", function(neigh, weight)
unitTest:assert(neigh.y >= cell.y)
unitTest:assert(neigh.x >= cell.x - 2)
unitTest:assert(neigh.x <= cell.x + 2)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(weightFunction(cell, neigh), weight, 0.00001)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(2, sizes[3])
unitTest:assertEquals(2, sizes[4])
unitTest:assertEquals(6, sizes[5])
unitTest:assertEquals(16, sizes[6])
unitTest:assertEquals(16, sizes[8])
unitTest:assertEquals(48, sizes[10])
-- Tests the bilaterality (From cs2 to cs)
sizes = {}
forEachCell(cs2, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood6")
local neighborhoodSize = #neighborhood
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, "my_neighborhood6", function(neigh, weight)
unitTest:assert(neigh.y > cell.y)
unitTest:assert(neigh.x >= cell.x - 2)
unitTest:assert(neigh.x <= cell.x + 2)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(weightFunction(cell, neigh), weight, 0.00001)
end)
end)
unitTest:assertEquals(10, sizes[0])
unitTest:assertEquals(2, sizes[3])
unitTest:assertEquals(2, sizes[4])
unitTest:assertEquals(6, sizes[5])
unitTest:assertEquals(16, sizes[6])
unitTest:assertEquals(16, sizes[8])
unitTest:assertEquals(48, sizes[10])
-- filter
cs = CellularSpace{xdim = 5}
filterFunction = function(cell, neighbor)
return cell.x == neighbor.x and cell.y ~= neighbor.y
end
cs:createNeighborhood{
strategy = "function",
name = "my_neighborhood1",
filter = filterFunction
}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(4, neighborhoodSize)
forEachNeighbor(cell, "my_neighborhood1", function(neigh, weight)
unitTest:assertEquals(neigh.x, cell.x)
unitTest:assert(neigh.y ~= cell.y)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(1, weight)
end)
end)
weightFunction = function(cell, neighbor)
return math.abs(neighbor.y - cell.y)
end
cs:createNeighborhood{
strategy = "function",
name = "my_neighborhood2",
filter = filterFunction,
weight = weightFunction
}
local sumWeightVec = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood2")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(4, neighborhoodSize)
local sumWeight = 0
forEachNeighbor(cell, "my_neighborhood2", function(neigh, weight)
unitTest:assertEquals(neigh.x, cell.x)
unitTest:assert(neigh.y ~= cell.y)
unitTest:assert(filterFunction(cell, neigh))
unitTest:assertEquals(math.abs(neigh.y - cell.y), weight)
sumWeight = sumWeight + weight
end)
if sumWeightVec[sumWeight] == nil then sumWeightVec[sumWeight] = 0 end
sumWeightVec[sumWeight] = sumWeightVec[sumWeight] + 1
end)
unitTest:assertEquals(5, sumWeightVec[6])
unitTest:assertEquals(10, sumWeightVec[7])
unitTest:assertEquals(10, sumWeightVec[10])
-- coord
cs = CellularSpace{xdim = 5}
cs2 = CellularSpace{xdim = 5}
cs:createNeighborhood{
strategy = "coord",
name = "my_neighborhood1",
inmemory = false,
target = cs2
}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(1, neighborhoodSize)
forEachNeighbor(cell, "my_neighborhood1", function(neigh, weight)
unitTest:assertEquals(neigh.x, cell.x)
unitTest:assertEquals(neigh.y, cell.y)
unitTest:assert(neigh ~= cell)
unitTest:assertEquals(1, weight)
end)
end)
forEachCell(cs2, function(cell)
local neighborhood = cell:getNeighborhood("my_neighborhood1")
local neighborhoodSize = #neighborhood
unitTest:assertEquals(1, neighborhoodSize)
forEachNeighbor(cell, "my_neighborhood1", function(neigh, weight)
unitTest:assertEquals(neigh.x, cell.x)
unitTest:assertEquals(neigh.y, cell.y)
unitTest:assert(neigh ~= cell)
unitTest:assertEquals(1, weight)
end)
end)
-- on the fly
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{inmemory = false}
unitTest:assertType(cs.cells[1].neighborhoods["1"], "function")
unitTest:assertType(cs.cells[1]:getNeighborhood(), "Neighborhood")
-- Vector of size counters - Used to verify the size of the neighborhoods
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood()
unitTest:assert(not neighborhood:isNeighbor(cell))
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x >= (cell.x - 1))
unitTest:assert(neigh.x <= (cell.x + 1))
unitTest:assert(neigh.y >= (cell.y -1))
unitTest:assert(neigh.y <= (cell.y + 1))
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
end)
unitTest:assertEquals(4, sizes[3])
unitTest:assertEquals(12, sizes[5])
unitTest:assertEquals(9, sizes[8])
cs = CellularSpace{xdim = 5}
cs:createNeighborhood{strategy = "vonneumann", inmemory = false}
unitTest:assertType(cs.cells[1].neighborhoods["1"], "function")
unitTest:assertType(cs.cells[1]:getNeighborhood(), "Neighborhood")
sizes = {}
forEachCell(cs, function(cell)
local neighborhood = cell:getNeighborhood("1")
local neighborhoodSize = #neighborhood
local sumWeight = 0
if sizes[neighborhoodSize] == nil then sizes[neighborhoodSize] = 0 end
sizes[neighborhoodSize] = sizes[neighborhoodSize] + 1
forEachNeighbor(cell, function(neigh, weight)
unitTest:assert(neigh.x == cell.x or neigh.y == cell.y)
sumWeight = sumWeight + weight
end)
unitTest:assertEquals(1, sumWeight, 0.00001)
unitTest:assert(not neighborhood:isNeighbor(cell))
end)
unitTest:assertEquals(4, sizes[2])
unitTest:assertEquals(12, sizes[3])
unitTest:assertEquals(9, sizes[4])
-- small cellular spaces
cs = CellularSpace{xdim = 2}
cs:createNeighborhood{
strategy = "vonneumann",
wrap = true
}
cs:createNeighborhood{
wrap = true,
name = "2"
}
cs:createNeighborhood{
wrap = true,
strategy = "mxn",
m = 5,
name = "3"
}
end,
cut = function(unitTest)
local cs = CellularSpace{xdim = 10}
local region = cs:cut()
unitTest:assertEquals(#region, #cs)
region = cs:cut{xmin = 3, xmax = 7}
unitTest:assertEquals(#region, 50)
region = cs:cut{xmin = 5}
unitTest:assertEquals(#region, 50)
local unnecessaryArgument = function()
region = cs:cut{xmin = 1, xmax = 5, ymin = 3, ymax = 7, xmox = 5}
end
unitTest:assertWarning(unnecessaryArgument, unnecessaryArgumentMsg("xmox", "xmax"))
unitTest:assertEquals(#region, 25)
local defaultValue = function()
region = cs:cut{xmin = 0}
end
unitTest:assertWarning(defaultValue, defaultValueMsg("xmin", 0))
unitTest:assertEquals(#region, #cs)
end,
get = function(unitTest)
local cs = CellularSpace{xdim = 10}
local c = cs:get(2, 2)
unitTest:assertEquals(2, c.x)
unitTest:assertEquals(2, c.y)
local d = cs:get(c:getId())
unitTest:assertEquals(c, d)
c = cs:get(100, 100)
unitTest:assertNil(c)
local warningFunc = function()
c = cs:get("4", 2.3)
end
unitTest:assertWarning(warningFunc, "As #1 is string, #2 should be nil, but got number.")
unitTest:assertEquals(c.x, 0)
unitTest:assertEquals(c.y, 3)
end,
load = function(unitTest)
local cs = CellularSpace{xdim = 5}
forEachCell(cs, function(cell)
cell.w = 3
end)
cs:load()
unitTest:assertNil(cs:sample().w)
end,
sample = function(unitTest)
local cs = CellularSpace{xdim = 3}
unitTest:assertType(cs:sample(), "Cell")
end,
save = function(unitTest)
local gis = getPackage("gis")
local projName = "cellspace_save_basic.tview"
File(projName):deleteIfExists()
local proj = gis.Project{
file = projName,
clean = true,
author = "Avancini",
title = "Sampa"
}
local layerName1 = "Sampa"
gis.Layer{
project = proj,
name = layerName1,
file = filePath("test/sampa.shp", "gis")
}
local testDir = currentDir()
local shp1 = "sampa_cells.shp"
local filePath1 = testDir..shp1
local fn1 = File(filePath1):name()
fn1 = testDir..fn1
File(fn1):deleteIfExists()
local clName1 = "Sampa_Cells"
gis.Layer{
project = proj,
clean = true,
input = layerName1,
name = clName1,
resolution = 0.7,
file = filePath1,
progress = false
}
local cs = CellularSpace{
project = proj,
layer = clName1
}
forEachCell(cs, function(cell)
cell.t0 = 1000
end)
local cellSpaceLayerNameT0 = clName1.."_CellSpace_T0"
local shp2 = cellSpaceLayerNameT0..".shp"
local filePath2 = testDir..shp2
local fn2 = File(filePath2):name()
fn2 = testDir..fn2
File(fn2):deleteIfExists()
cs:save(cellSpaceLayerNameT0, "t0")
local layer = gis.Layer{
project = proj,
name = cellSpaceLayerNameT0,
}
unitTest:assertEquals(layer.source, "shp")
unitTest:assertEquals(layer.file, filePath2)
cs = CellularSpace{
project = projName,
layer = cellSpaceLayerNameT0
}
forEachCell(cs, function(cell)
unitTest:assertEquals(cell.t0, 1000)
cell.t0 = cell.t0 + 1000
end)
cs:save(cellSpaceLayerNameT0, "t0")
cs = CellularSpace{
project = projName,
layer = cellSpaceLayerNameT0
}
forEachCell(cs, function(cell)
unitTest:assertEquals(cell.t0, 2000)
end)
cs = CellularSpace{
project = projName,
layer = cellSpaceLayerNameT0
}
local cellSpaceLayerNameGeom = clName1.."_CellSpace_Geom"
local shp3 = cellSpaceLayerNameGeom..".shp"
local filePath3 = testDir..shp3
local fn3 = File(filePath3):name()
fn3 = testDir..fn3
File(fn3):deleteIfExists()
cs:save(cellSpaceLayerNameGeom)
cs = CellularSpace{
project = projName,
layer = cellSpaceLayerNameGeom
}
forEachCell(cs, function(cell)
unitTest:assertNotNil(cell.geom)
end)
local cellSpaceLayerNameGeom2 = clName1.."_CellSpace_Geom2"
local shp4 = cellSpaceLayerNameGeom2..".shp"
local filePath4 = testDir..shp4
local fn4 = File(filePath4):name()
fn4 = testDir..fn4
File(fn4):deleteIfExists()
cs:save(cellSpaceLayerNameGeom2)
cs = CellularSpace{
project = projName,
layer = cellSpaceLayerNameGeom2
}
forEachCell(cs, function(cell)
unitTest:assertNotNil(cell.geom)
end)
File(projName):deleteIfExists()
File(fn1):deleteIfExists()
File(fn2):deleteIfExists()
File(fn3):deleteIfExists()
File(fn4):deleteIfExists()
end,
split = function(unitTest)
local cs = CellularSpace{xdim = 3}
local counter = 0
forEachCell(cs, function(cell)
if counter >= 3 then
cell.cover = "forest"
else
cell.cover = "pasture"
end
counter = counter + 1
end)
local ts = cs:split("cover")
local t1 = ts["pasture"]
local t2 = ts["forest"]
unitTest:assertType(t1, "Trajectory")
unitTest:assertEquals(#t1, 3)
unitTest:assertEquals(#t2, 6)
t2 = cs:split(function()
return "test"
end)
unitTest:assertType(t2.test, "Trajectory")
unitTest:assertEquals(#cs.cells, 9)
unitTest:assertEquals(#cs.cells, #t2.test)
unitTest:assertType(cs:sample(), "Cell")
local v = function(cell)
if cell.x > 1 then
return "test"
else
return nil
end
end
t2 = cs:split(v)
unitTest:assertEquals(#t2.test, 3)
local cell = Cell{
cover = Random{"pasture", "forest"},
}
cs = CellularSpace{
xdim = 5,
instance = cell
}
ts = cs:split("cover")
unitTest:assertEquals(getn(ts), 2)
unitTest:assertEquals(#ts.forest, 16)
unitTest:assertEquals(#ts.pasture, 9)
forEachCell(cs, function(mcell)
mcell.cover = "pasture"
end)
ts.forest:filter()
ts.pasture:rebuild()
unitTest:assertEquals(#ts.forest, 0)
unitTest:assertEquals(#ts.pasture, 25)
end,
synchronize = function(unitTest)
local cs = CellularSpace{xdim = 5}
forEachCell(cs, function(cell) unitTest:assertNotNil(cell) end)
forEachCell(cs, function(cell) unitTest:assertNotNil(cell.past) end)
forEachCell(cs, function(cell) cell.cover = "forest" end)
cs:synchronize()
forEachCell(cs, function(cell) unitTest:assertNotNil(cell.past.cover) end)
forEachCell(cs, function(cell) unitTest:assertEquals("forest", cell.past.cover) end)
forEachElement(cs.cells[1], function(el) unitTest:assertNotNil(el) end)
forEachElement(cs.cells[1].past, function(el) unitTest:assertNotNil(el) end)
local c = Cell{
value = 3,
on_synchronize = function(self)
self.value = 0
end
}
cs = CellularSpace{
instance = c,
xdim = 3
}
cs:synchronize()
forEachCell(cs, function(cell) unitTest:assertEquals(3, cell.past.value) end)
forEachCell(cs, function(cell) unitTest:assertEquals(0, cell.value) end)
end
}
| lgpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_rebel_first_lieutenant_moncal_female_02.lua | 3 | 2304 | --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_rebel_first_lieutenant_moncal_female_02 = object_mobile_shared_dressed_rebel_first_lieutenant_moncal_female_02:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_rebel_first_lieutenant_moncal_female_02, "object/mobile/dressed_rebel_first_lieutenant_moncal_female_02.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/hair/bothan/base/objects.lua | 3 | 7361 | --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_hair_bothan_base_shared_hair_bothan_base = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hair/bothan/base/shared_hair_bothan_base.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/hair.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hair_detail:hair",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "@hair_lookat:hair",
noBuildRadius = 0,
objectName = "@hair_name:hair",
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 = 2550508164,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hair/base/shared_hair_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hair_bothan_base_shared_hair_bothan_base, "object/tangible/hair/bothan/base/shared_hair_bothan_base.iff")
object_tangible_hair_bothan_base_shared_hair_bothan_female_base = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hair/bothan/base/shared_hair_bothan_female_base.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/hair.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hair_detail:hair",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "@hair_lookat:hair",
noBuildRadius = 0,
objectName = "@hair_name:hair",
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 = 4122368933,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hair/base/shared_hair_base.iff", "object/tangible/hair/bothan/base/shared_hair_bothan_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hair_bothan_base_shared_hair_bothan_female_base, "object/tangible/hair/bothan/base/shared_hair_bothan_female_base.iff")
object_tangible_hair_bothan_base_shared_hair_bothan_male_base = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hair/bothan/base/shared_hair_bothan_male_base.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/hair.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hair_detail:hair",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "@hair_lookat:hair",
noBuildRadius = 0,
objectName = "@hair_name:hair",
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 = 4062977600,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hair/base/shared_hair_base.iff", "object/tangible/hair/bothan/base/shared_hair_bothan_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hair_bothan_base_shared_hair_bothan_male_base, "object/tangible/hair/bothan/base/shared_hair_bothan_male_base.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/lair/base/poi_all_lair_nest_small_fog_mustard.lua | 1 | 2347 | --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_nest_small_fog_mustard = object_tangible_lair_base_shared_poi_all_lair_nest_small_fog_mustard:new {
objectMenuComponent = "LairMenuComponent",
}
ObjectTemplates:addTemplate(object_tangible_lair_base_poi_all_lair_nest_small_fog_mustard, "object/tangible/lair/base/poi_all_lair_nest_small_fog_mustard.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/component/weapon/serverobjects.lua | 3 | 11930 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
includeFile("tangible/component/weapon/lightsaber/serverobjects.lua")
-- Server Objects
includeFile("tangible/component/weapon/acklay_bone_reinforcement_core.lua")
includeFile("tangible/component/weapon/base_blaster_power_handler_enhancement.lua")
includeFile("tangible/component/weapon/base_projectile_feed_mechanism_enhancement.lua")
includeFile("tangible/component/weapon/base_vibro_unit_enhancement.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s01.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s01_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s02.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s02_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s03.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s03_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s04.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s04_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s05.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s05_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s06.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s06_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s07.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_lg_s07_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s01.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s01_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s02.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s02_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s03.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s03_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s04.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s04_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s05.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s05_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s06.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s06_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s07.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_m_s07_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s01.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s01_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s02.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s02_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s03.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s03_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s04.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s04_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s05.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s05_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s06.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s06_lg.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s07.lua")
includeFile("tangible/component/weapon/blaster_barrel_wp_muzzle_sm_s07_lg.lua")
includeFile("tangible/component/weapon/blaster_pistol_barrel.lua")
includeFile("tangible/component/weapon/blaster_pistol_barrel_advanced.lua")
includeFile("tangible/component/weapon/blaster_pistol_barrel_quest.lua")
includeFile("tangible/component/weapon/blaster_power_handler.lua")
includeFile("tangible/component/weapon/blaster_power_handler_advanced.lua")
includeFile("tangible/component/weapon/blaster_power_handler_enhancement_durability.lua")
includeFile("tangible/component/weapon/blaster_power_handler_enhancement_krayt.lua")
includeFile("tangible/component/weapon/blaster_power_handler_enhancement_max_damage.lua")
includeFile("tangible/component/weapon/blaster_power_handler_enhancement_min_damage.lua")
includeFile("tangible/component/weapon/blaster_power_handler_quest.lua")
includeFile("tangible/component/weapon/blaster_rifle_barrel.lua")
includeFile("tangible/component/weapon/blaster_rifle_barrel_advanced.lua")
includeFile("tangible/component/weapon/chemical_dispersion_mechanism.lua")
includeFile("tangible/component/weapon/chemical_dispersion_mechanism_advanced.lua")
includeFile("tangible/component/weapon/corvette_rifle_barrel.lua")
includeFile("tangible/component/weapon/energization_crystals.lua")
includeFile("tangible/component/weapon/galven_tube_circuits.lua")
includeFile("tangible/component/weapon/geonosian_power_cube.lua")
includeFile("tangible/component/weapon/geonosian_power_cube_base.lua")
includeFile("tangible/component/weapon/geonosian_power_cube_green.lua")
includeFile("tangible/component/weapon/geonosian_power_cube_red.lua")
includeFile("tangible/component/weapon/geonosian_power_cube_yellow.lua")
includeFile("tangible/component/weapon/geonosian_reinforcement_core.lua")
includeFile("tangible/component/weapon/geonosian_solidifying_agent.lua")
includeFile("tangible/component/weapon/geonosian_sword_core.lua")
includeFile("tangible/component/weapon/laser_cannon_cooling_sleeve.lua")
includeFile("tangible/component/weapon/laser_cannon_gun_tube.lua")
includeFile("tangible/component/weapon/laser_generator.lua")
includeFile("tangible/component/weapon/laser_magnetic_flashback_supressor.lua")
includeFile("tangible/component/weapon/melee_core_enhancement.lua")
includeFile("tangible/component/weapon/parallel_weapon_targeting_computer.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism_advanced.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism_enhancement_durability.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism_enhancement_gorax.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism_enhancement_max_damage.lua")
includeFile("tangible/component/weapon/projectile_feed_mechanism_enhancement_min_damage.lua")
includeFile("tangible/component/weapon/projectile_pistol_barrel.lua")
includeFile("tangible/component/weapon/projectile_pistol_barrel_advanced.lua")
includeFile("tangible/component/weapon/projectile_pistol_barrel_quest.lua")
includeFile("tangible/component/weapon/projectile_rifle_barrel.lua")
includeFile("tangible/component/weapon/projectile_rifle_barrel_advanced.lua")
includeFile("tangible/component/weapon/projectile_rifle_barrel_advanced_quest.lua")
includeFile("tangible/component/weapon/rancor_tooth.lua")
includeFile("tangible/component/weapon/rancor_tooth_quest.lua")
includeFile("tangible/component/weapon/reinforcement_core.lua")
includeFile("tangible/component/weapon/reinforcement_core_advanced.lua")
includeFile("tangible/component/weapon/scope_weapon.lua")
includeFile("tangible/component/weapon/scope_weapon_advanced.lua")
includeFile("tangible/component/weapon/scope_weapon_advanced_quest.lua")
includeFile("tangible/component/weapon/scope_weapon_lg_s01.lua")
includeFile("tangible/component/weapon/scope_weapon_lg_s02.lua")
includeFile("tangible/component/weapon/scope_weapon_lg_s03.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s01.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s02.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s03.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s04.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s05.lua")
includeFile("tangible/component/weapon/scope_weapon_sm_s06.lua")
includeFile("tangible/component/weapon/spider_spine.lua")
includeFile("tangible/component/weapon/stock.lua")
includeFile("tangible/component/weapon/stock_advanced.lua")
includeFile("tangible/component/weapon/stock_advanced_quest.lua")
includeFile("tangible/component/weapon/sword_core.lua")
includeFile("tangible/component/weapon/sword_core_advanced.lua")
includeFile("tangible/component/weapon/sword_core_quest.lua")
includeFile("tangible/component/weapon/turbo_laser_gun_tube.lua")
includeFile("tangible/component/weapon/vibro_unit.lua")
includeFile("tangible/component/weapon/vibro_unit_advanced.lua")
includeFile("tangible/component/weapon/vibro_unit_enhancement_durability.lua")
includeFile("tangible/component/weapon/vibro_unit_enhancement_max_damage.lua")
includeFile("tangible/component/weapon/vibro_unit_enhancement_min_damage.lua")
includeFile("tangible/component/weapon/vibro_unit_enhancement_wounding.lua")
includeFile("tangible/component/weapon/vibro_unit_nightsister.lua")
includeFile("tangible/component/weapon/vibro_unit_quest.lua")
includeFile("tangible/component/weapon/weapon_carbine_laser_stock.lua")
includeFile("tangible/component/weapon/weapon_dlt20_stock.lua")
includeFile("tangible/component/weapon/weapon_dxr6_stock.lua")
includeFile("tangible/component/weapon/weapon_e11_stock_closed.lua")
includeFile("tangible/component/weapon/weapon_e11_stock_open.lua")
includeFile("tangible/component/weapon/weapon_ee3_stock.lua")
includeFile("tangible/component/weapon/weapon_elite_stock.lua")
includeFile("tangible/component/weapon/weapon_mount.lua")
includeFile("tangible/component/weapon/weapon_mount_light.lua")
includeFile("tangible/component/weapon/weapon_rifle_laser_stock.lua")
includeFile("tangible/component/weapon/weapon_t21_stock.lua")
includeFile("tangible/component/weapon/weapon_targeting_computer.lua")
includeFile("tangible/component/weapon/weapon_trajectory_computer.lua")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/container/quest/crafting_contract/serverobjects.lua | 3 | 2575 | --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/container/quest/crafting_contract/armor_crate.lua")
includeFile("tangible/container/quest/crafting_contract/clothing_crate.lua")
includeFile("tangible/container/quest/crafting_contract/droid_crate.lua")
includeFile("tangible/container/quest/crafting_contract/food_crate.lua")
includeFile("tangible/container/quest/crafting_contract/furniture_crate.lua")
includeFile("tangible/container/quest/crafting_contract/generic_crate.lua")
includeFile("tangible/container/quest/crafting_contract/weapon_crate.lua")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/loot/collectible/collectible_parts/light_table_structure_03.lua | 3 | 2360 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_loot_collectible_collectible_parts_light_table_structure_03 = object_tangible_loot_collectible_collectible_parts_shared_light_table_structure_03:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_collectible_collectible_parts_light_table_structure_03, "object/tangible/loot/collectible/collectible_parts/light_table_structure_03.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/hq_destructible/objects.lua | 3 | 10640 | --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_hq_destructible_shared_base_destructible = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hq_destructible/shared_base_destructible.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/frn_all_data_terminal_wall_s4.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hq:destructible",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@hq:destructible",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 730285201,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hq_destructible_shared_base_destructible, "object/tangible/hq_destructible/shared_base_destructible.iff")
object_tangible_hq_destructible_shared_override_terminal = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hq_destructible/shared_override_terminal.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/frn_all_data_terminal_wall_s2.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hq:override_terminal",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@hq:override_terminal",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 2006377548,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hq_destructible/shared_base_destructible.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hq_destructible_shared_override_terminal, "object/tangible/hq_destructible/shared_override_terminal.iff")
object_tangible_hq_destructible_shared_power_regulator = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hq_destructible/shared_power_regulator.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/frn_all_data_terminal_wall_s4.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hq:power_regulator",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@hq:power_regulator",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 3447096600,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hq_destructible/shared_base_destructible.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hq_destructible_shared_power_regulator, "object/tangible/hq_destructible/shared_power_regulator.iff")
object_tangible_hq_destructible_shared_security_terminal = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hq_destructible/shared_security_terminal.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/frn_all_data_terminal_wall_s1.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hq:security_terminal",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@hq:security_terminal",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 868384958,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hq_destructible/shared_base_destructible.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hq_destructible_shared_security_terminal, "object/tangible/hq_destructible/shared_security_terminal.iff")
object_tangible_hq_destructible_shared_uplink_terminal = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hq_destructible/shared_uplink_terminal.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "appearance/frn_all_data_terminal_wall_s3.apt",
arrangementDescriptorFilename = "",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8211,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 0,
containerVolumeLimit = 1,
customizationVariableMapping = {},
detailedDescription = "@hq:uplink_terminal",
gameObjectType = 8211,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@hq:uplink_terminal",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "",
snapToTerrain = 0,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
totalCellNumber = 0,
useStructureFootprintOutline = 0,
clientObjectCRC = 459058175,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff", "object/tangible/hq_destructible/shared_base_destructible.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hq_destructible_shared_uplink_terminal, "object/tangible/hq_destructible/shared_uplink_terminal.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/particle/particle_test_71.lua | 3 | 2216 | --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_particle_particle_test_71 = object_static_particle_shared_particle_test_71:new {
}
ObjectTemplates:addTemplate(object_static_particle_particle_test_71, "object/static/particle/particle_test_71.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/static/structure/military/military_column_weak_rebel_style_01.lua | 3 | 2332 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_military_military_column_weak_rebel_style_01 = object_static_structure_military_shared_military_column_weak_rebel_style_01:new {
}
ObjectTemplates:addTemplate(object_static_structure_military_military_column_weak_rebel_style_01, "object/static/structure/military/military_column_weak_rebel_style_01.iff")
| agpl-3.0 |
sprunk/Zero-K | LuaRules/Gadgets/unit_structure_typemap.lua | 8 | 2973 | function gadget:GetInfo()
return {
name = "Structure Typemap",
desc = "Sets structures to have unpathable terrain under them.",
author = "GoogleFrog",
date = "2 December 2018",
license = "GNU LGPL, v2.1 or later",
layer = 0,
enabled = false
}
end
if not (gadgetHandler:IsSyncedCode()) then
return
end
--------------------------------------------------------------------------------
-- SYNCED
--------------------------------------------------------------------------------
local spGetUnitDefID = Spring.GetUnitDefID
local IMPASSIBLE_TERRAIN = 137 -- Hope that this does not conflict with any maps
local structureDefs = {}
for i = 1, #UnitDefs do
local ud = UnitDefs[i]
if (ud.isImmobile or ud.speed == 0) and not ud.customParams.mobilebuilding then
structureDefs[i] = {
xsize = (ud.xsize)*4,
zsize = (ud.ysize or ud.zsize)*4,
}
end
end
-------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local function GetUnitExtents(unitID, def)
local ux,_,uz = Spring.GetUnitPosition(unitID, true)
local face = Spring.GetUnitBuildFacing(unitID)
local xsize = def.xsize
local zsize = def.zsize
local minx, minz, maxx, maxz
if ((face == 0) or (face == 2)) then
if xsize%16 == 0 then
ux = math.floor((ux+8)/16)*16
else
ux = math.floor(ux/16)*16+8
end
if zsize%16 == 0 then
uz = math.floor((uz+8)/16)*16
else
uz = math.floor(uz/16)*16+8
end
minx = ux - xsize
minz = uz - zsize
maxx = ux + xsize
maxz = uz + zsize
else
if xsize%16 == 0 then
uz = math.floor((uz+8)/16)*16
else
uz = math.floor(uz/16)*16+8
end
if zsize%16 == 0 then
ux = math.floor((ux+8)/16)*16
else
ux = math.floor(ux/16)*16+8
end
minx = ux - zsize
minz = uz - xsize
maxx = ux + zsize
maxz = uz + xsize
end
return minx - 8, minz - 8, maxx, maxz
end
local function SetTypemapSquare(minx, minz, maxx, maxz, value)
for x = minx, maxx, 8 do
for z = minz, maxz, 8 do
Spring.SetMapSquareTerrainType(x, z, value)
end
end
end
-------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:UnitCreated(unitID, unitDefID)
if not structureDefs[unitDefID] then
return
end
local minx, minz, maxx, maxz = GetUnitExtents(unitID, structureDefs[unitDefID])
SetTypemapSquare(minx, minz, maxx, maxz, IMPASSIBLE_TERRAIN)
end
function gadget:UnitDestroyed(unitID, unitDefID)
if not structureDefs[unitDefID] then
return
end
local minx, minz, maxx, maxz = GetUnitExtents(unitID, ud)
SetTypemapSquare(minx, minz, maxx, maxz, 0)
end
function gadget:Initialize()
Spring.SetTerrainTypeData(IMPASSIBLE_TERRAIN, 0, 0, 0, 0)
local allUnits = Spring.GetAllUnits()
for i = 1, #allUnits do
local unitID = allUnits[i]
gadget:UnitCreated(unitID, spGetUnitDefID(unitID))
end
end
| gpl-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_patron_klaatu_01.lua | 3 | 2212 | --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_patron_klaatu_01 = object_mobile_shared_dressed_patron_klaatu_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_patron_klaatu_01, "object/mobile/dressed_patron_klaatu_01.iff")
| agpl-3.0 |
sprunk/Zero-K | effects/feature_poof.lua | 22 | 1425 | -- feature_poof
return {
["feature_poof_spawner"] = {
poof01 = {
air = true,
class = [[CExpGenSpawner]],
count = [[10]],
ground = true,
properties = {
delay = [[i1 x0.1d]],
damage = [[d1]],
explosionGenerator = [[custom:feature_poof]],
},
},
},
["feature_poof"] = {
poof01 = {
air = true,
class = [[CSimpleParticleSystem]],
count = [[1]],
ground = true,
properties = {
airdrag = 0.975,
alwaysvisible = false,
colormap = [[0.8 0.65 0.55 1.0 0 0 0 0.0]],
directional = true,
emitrot = 180,
emitrotspread = 180,
emitvector = [[0, 1, 0]],
gravity = [[r-0.05 r0.05, -0.2 r0.05, r-0.05 r0.05]],
numparticles = [[1 d0.05]],
particlelife = 30,
particlelifespread = 10,
particlesize = [[1 d0.25]],
particlesizespread = [[d0.4]],
particlespeed = [[d0.05 r1]],
particlespeedspread = 1,
pos = [[r-5d r10d, r-5d r10d, r-5d r10d]],
sizegrowth = 1.2,
sizemod = 0.995,
texture = [[dirt]],
},
},
},
}
| gpl-2.0 |
error454/ShiVa-Proof-Of-Concept | HorseTest/Resources/Scripts/CameraFX_State_FollowObject_onLoop.lua | 1 | 1403 | --------------------------------------------------------------------------------
-- State............ : FollowObject
-- Author........... :
-- Description...... :
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function CameraFX.FollowObject_onLoop ( )
--------------------------------------------------------------------------------
local dt = application.getLastFrameTime ( )
local x, y, z = object.getTranslation ( this.hTrackingTarget ( ), object.kGlobalSpace )
local dx, dy, dz = object.getDirection ( this.hTrackingTarget ( ), object.kGlobalSpace )
--object.translateTo ( application.getCurrentUserActiveCamera ( ), x + -dx * 2, y + 10, z + 30, object.kGlobalSpace, dt * this.nTrackingSpeed ( ))
-- feet of horse
object.translateTo ( application.getCurrentUserActiveCamera ( ), x - 15, 8, z - 15, object.kGlobalSpace, dt * this.nTrackingSpeed ( ))
object.lookAt ( application.getCurrentUserActiveCamera ( ), x - 6, y + 5, z, object.kGlobalSpace, 1 )
--object.rotateTo ( application.getCurrentUserActiveCamera ( ), 0, 0, 0, object.kGlobalSpace, dt * this.nTrackingSpeed ( ) )
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------
| mit |
beauli/kong | kong/plugins/bot-detection/handler.lua | 5 | 2087 | local BasePlugin = require "kong.plugins.base_plugin"
local responses = require "kong.tools.responses"
local rules = require "kong.plugins.bot-detection.rules"
local bot_cache = require "kong.plugins.bot-detection.cache"
local strip = require("kong.tools.utils").strip
local ipairs = ipairs
local get_headers = ngx.req.get_headers
local re_match = ngx.re.match
local BotDetectionHandler = BasePlugin:extend()
BotDetectionHandler.PRIORITY = 2500
local function get_user_agent()
local user_agent = get_headers()["user-agent"]
if type(user_agent) == "table" then
return nil, "Only one User-Agent header allowed"
end
return user_agent
end
function BotDetectionHandler:new()
BotDetectionHandler.super.new(self, "bot-detection")
end
function BotDetectionHandler:access(conf)
BotDetectionHandler.super.access(self)
local user_agent, err = get_user_agent()
if err then
return responses.send_HTTP_BAD_REQUEST(err)
end
if user_agent then
user_agent = strip(user_agent)
-- Cache key, per API
local cache_key = ngx.ctx.api.id..":"..user_agent
-- The cache already has the user_agents that should be blocked
-- So we avoid matching the regexes everytime
local cached_match = bot_cache.get(cache_key)
if cached_match then
return
elseif cached_match == false then
return responses.send_HTTP_FORBIDDEN()
end
if conf.whitelist then
for _, rule in ipairs(conf.whitelist) do
if re_match(user_agent, rule) then
bot_cache.set(cache_key, true)
return
end
end
end
if conf.blacklist then
for _, rule in ipairs(conf.blacklist) do
if re_match(user_agent, rule) then
bot_cache.set(cache_key, false)
return responses.send_HTTP_FORBIDDEN()
end
end
end
for _, rule in ipairs(rules.bots) do
if re_match(user_agent, rule) then
bot_cache.set(cache_key, false)
return responses.send_HTTP_FORBIDDEN()
end
end
bot_cache.set(cache_key, true)
end
end
return BotDetectionHandler | apache-2.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/ship/components/booster/bst_subpro_accelatron_mk5.lua | 3 | 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_ship_components_booster_bst_subpro_accelatron_mk5 = object_tangible_ship_components_booster_shared_bst_subpro_accelatron_mk5:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_booster_bst_subpro_accelatron_mk5, "object/tangible/ship/components/booster/bst_subpro_accelatron_mk5.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/mobile/lok/nym_bodyguard.lua | 1 | 1281 | nym_bodyguard = Creature:new {
objectName = "@mob/creature_names:nym_bodyguard",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "nym",
faction = "nym",
level = 28,
chanceHit = 0.37,
damageMin = 260,
damageMax = 270,
baseXp = 2914,
baseHAM = 8100,
baseHAMmax = 9900,
armor = 1,
resists = {15,15,15,15,40,15,-1,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/dressed_nym_bodyguard_rod_m.iff",
"object/mobile/dressed_nym_bodyguard_hum_m.iff",
"object/mobile/dressed_nym_bodyguard_hum_f.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 6500000},
{group = "nyms_common", chance = 1000000},
{group = "pistols", chance = 1000000},
{group = "carbines", chance = 1000000},
{group = "tailor_components", chance = 500000}
}
}
},
weapons = {"rebel_weapons_medium"},
conversationTemplate = "",
reactionStf = "@npc_reaction/slang",
attacks = merge(riflemanmaster,carbineermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(nym_bodyguard, "nym_bodyguard")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/dressed_warren_cyborg_style_01.lua | 3 | 2236 | --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_warren_cyborg_style_01 = object_mobile_shared_dressed_warren_cyborg_style_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_warren_cyborg_style_01, "object/mobile/dressed_warren_cyborg_style_01.iff")
| agpl-3.0 |
NeuroRoboticTech/AnimatLabPublicSource | Applications/AnimatProjectGen/Projects_CodeBlocks/Projects.lua | 3 | 2089 |
project "AnimatSimulator"
language "C++"
kind "ConsoleApp"
files { "../*.h",
"../*.cpp"}
buildoptions { "-std=c++0x" }
includedirs { "../../../include",
"../../../../3rdParty/stlsoft-1.9.117/include" }
libdirs { "../../../bin" }
configuration { "Debug or Debug_Double", "linux" }
defines { "_DEBUG"}
flags { "Symbols", "SEH" }
targetdir ("Debug")
targetname ("animatsimulator_debug")
links { "AnimatBootstrapLoader_debug", "dl", "pthread" }
postbuildcommands { "cp Debug/animatsimulator_debug ../../../bin" }
configuration { "Debug_Static", "linux" }
defines { "_DEBUG", "OSGBULLET_STATIC", "ANIMAT_STATIC"}
flags { "Symbols", "SEH" }
targetdir ("Debug")
targetname ("animatsimulator_debug")
includedirs { "../../../Libraries/StdUtils",
"../../../Libraries/AnimatSim",
"../../../Libraries/OsgAnimatSim",
"../../../Libraries/BulletAnimatSim",
"/usr/local/include/bullet" }
links { "AnimatBootstrapLoader_debug",
"dl",
"pthread",
"StdUtils_debug",
"AnimatSim_debug",
"OsgAnimatSim_debug",
"OpenThreadsd",
"osgAnimationd",
"osgd",
"osgDBd",
"osgFXd",
"osgGAd",
"osgManipulatord",
"osgParticled",
"osgShadowd",
"osgSimd",
"osgTerraind",
"osgTextd",
"osgUtild",
"osgViewerd",
"osgVolumed",
"osgWidgetd",
"osgbDynamics_single_debug",
"osgbCollision_single_debug",
"osgwControls_animat_debug",
"osgwQuery_animat_debug",
"osgwTools_animat_debug",
"BulletCollision_single_debug",
"BulletDynamics_single_debug",
"LinearMath_single_debug",
"BulletSoftBody_single_debug"}
postbuildcommands { "cp Debug/animatsimulator_debug ../../../bin" }
configuration { "Release or Release_Double", "linux" }
defines { "NDEBUG" }
flags { "Optimize", "SEH" }
targetdir ("Release")
targetname ("animatsimulator")
links { "AnimatBootstrapLoader", "dl", "pthread" }
postbuildcommands { "cp Release/animatsimulator ../../../bin" }
| bsd-3-clause |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/mobile/kliknik.lua | 3 | 2144 | --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_kliknik = object_mobile_shared_kliknik:new {
}
ObjectTemplates:addTemplate(object_mobile_kliknik, "object/mobile/kliknik.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/building/poi/tatooine_evil_settlers_large3.lua | 2 | 2278 | --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_tatooine_evil_settlers_large3 = object_building_poi_shared_tatooine_evil_settlers_large3:new {
gameObjectType = 531,
}
ObjectTemplates:addTemplate(object_building_poi_tatooine_evil_settlers_large3, "object/building/poi/tatooine_evil_settlers_large3.iff")
| agpl-3.0 |
Tatwi/legend-of-hondo | MMOCoreORB/bin/scripts/object/tangible/powerup/weapon/ranged_scope.lua | 3 | 3286 | --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_powerup_weapon_ranged_scope = object_tangible_powerup_weapon_shared_ranged_scope:new {
templateType = POWERUP,
pupType = "Ranged",
baseName = "Scope",
primary = {
{"mindAttackCost", "Powered", "cat_pup.pup_wpn_attack_cost_mind"},
{"idealAccuracy", "Ranged", "cat_pup.pup_wpn_range_attack_mod_mid"},
{"maxRangeAccuracy", "Calibrated", "cat_pup.pup_wpn_range_attack_mod_max"},
{"minDamage", "Precision", "cat_pup.pup_wpn_damage_min"}
},
secondary = {
{"woundsRatio", "Pin-Pointed", "cat_pup.pup_wpn_wound_chance"},
{"attackSpeed", "Targeting", "cat_pup.pup_wpn_attack_speed"},
{"actionAttackCost", "Tracking", "cat_pup.pup_wpn_attack_cost_action"}
},
factoryCrateSize = 10,
numberExperimentalProperties = {1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "OQ"},
experimentalWeights = {1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "exp_effectiveness"},
experimentalSubGroupTitles = {"null", "null", "hitpoints", "effect"},
experimentalMin = {0, 0, 1000, 1},
experimentalMax = {0, 0, 1000, 100},
experimentalPrecision = {0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 1},
}
ObjectTemplates:addTemplate(object_tangible_powerup_weapon_ranged_scope, "object/tangible/powerup/weapon/ranged_scope.iff")
| agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.