repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278 values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15 values |
|---|---|---|---|---|---|
kidaa/Awakening-Core3 | bin/scripts/object/tangible/lair/voritor_lizard/serverobjects.lua | 3 | 2271 | --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/voritor_lizard/lair_voritor_lizard.lua")
includeFile("tangible/lair/voritor_lizard/lair_voritor_lizard_grassland.lua")
includeFile("tangible/lair/voritor_lizard/lair_voritor_lizard_mountain.lua")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/wearables/shirt/shirt_s28.lua | 3 | 3515 | --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_shirt_shirt_s28 = object_tangible_wearables_shirt_shared_shirt_s28:new {
playerRaces = { "object/creature/player/bothan_female.iff",
"object/creature/player/human_female.iff",
"object/creature/player/moncal_female.iff",
"object/creature/player/rodian_female.iff",
"object/creature/player/sullustan_female.iff",
"object/creature/player/trandoshan_female.iff",
"object/creature/player/twilek_female.iff",
"object/creature/player/zabrak_female.iff",
"object/mobile/vendor/aqualish_female.iff",
"object/mobile/vendor/bith_female.iff",
"object/mobile/vendor/bothan_female.iff",
"object/mobile/vendor/human_female.iff",
"object/mobile/vendor/moncal_female.iff",
"object/mobile/vendor/rodian_female.iff",
"object/mobile/vendor/sullustan_female.iff",
"object/mobile/vendor/trandoshan_female.iff",
"object/mobile/vendor/twilek_female.iff",
"object/mobile/vendor/zabrak_female.iff" },
numberExperimentalProperties = {1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "sockets", "hitpoints"},
experimentalMin = {0, 0, 0, 1000},
experimentalMax = {0, 0, 0, 1000},
experimentalPrecision = {0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 4},
}
ObjectTemplates:addTemplate(object_tangible_wearables_shirt_shirt_s28, "object/tangible/wearables/shirt/shirt_s28.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/player/city/garden_corellia_sml_04.lua | 3 | 2754 | --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_player_city_garden_corellia_sml_04 = object_building_player_city_shared_garden_corellia_sml_04:new {
lotSize = 0,
baseMaintenanceRate = 0,
allowedZones = {"corellia", "talus"},
length = 3,
width = 3,
cityRankRequired = 1,
cityMaintenanceBase = 10000,
abilityRequired = "place_small_garden",
zoneComponent = "StructureZoneComponent",
dataObjectComponent = "DecorationDataComponent",
childObjects = {
{templateFile = "object/tangible/terminal/terminal_player_structure_nosnap_mini.iff", x = 4, z = 1, y = -4, ox = 0, oy = 1, oz = 0, ow = 0, cellid = -1, containmentType = -1}
}
}
ObjectTemplates:addTemplate(object_building_player_city_garden_corellia_sml_04, "object/building/player/city/garden_corellia_sml_04.iff")
| lgpl-3.0 |
meshr-net/meshr_tomato-RT-N | usr/lib/lua/luci/sgi/wsapi.lua | 12 | 1844 | --[[
LuCI - SGI-Module for WSAPI
Description:
Server Gateway Interface for WSAPI
FileId:
$Id: wsapi.lua 2656 2008-07-23 18:52:12Z Cyrus $
License:
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
module("luci.sgi.wsapi", package.seeall)
local ltn12 = require("luci.ltn12")
require("luci.http")
require("luci.dispatcher")
require("luci.http.protocol")
function run(wsapi_env)
local r = luci.http.Request(
wsapi_env,
ltn12.source.file(wsapi_env.input),
ltn12.sink.file(wsapi_env.error)
)
local res, id, data1, data2 = true, 0, nil, nil
local headers = {}
local status = 200
local x = coroutine.create(luci.dispatcher.httpdispatch)
local active = true
while id < 3 do
res, id, data1, data2 = coroutine.resume(x, r)
if not res then
status = 500
headers["Content-Type"] = "text/plain"
local err = {id}
return status, headers, function() local x = table.remove(err) return x end
end
if id == 1 then
status = data1
elseif id == 2 then
headers[data1] = data2
end
end
local function iter()
local res, id, data = coroutine.resume(x)
if id == 4 and active then
return data
elseif id == 5 then
active = false
return ""
else
return ""
end
if coroutine.status(x) == "dead" then
return nil
end
end
return status, headers, iter
end
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_mercenary_commander_nikto_m.lua | 3 | 2256 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_mercenary_commander_nikto_m = object_mobile_shared_dressed_mercenary_commander_nikto_m:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_mercenary_commander_nikto_m, "object/mobile/dressed_mercenary_commander_nikto_m.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Yhoator_Jungle/Zone.lua | 2 | 2889 | -----------------------------------
--
-- Zone: Yhoator_Jungle (124)
--
-----------------------------------
package.loaded[ "scripts/zones/Yhoator_Jungle/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Yhoator_Jungle/TextIDs");
require("scripts/zones/Yhoator_Jungle/MobIDs");
require("scripts/globals/icanheararainbow");
require("scripts/globals/chocobo_digging");
require("scripts/globals/conquest");
require("scripts/globals/zone");
-----------------------------------
local itemMap =
{
-- itemid, abundance, requirement
{ 880, 282, DIGREQ_NONE },
{ 689, 177, DIGREQ_NONE },
{ 4432, 140, DIGREQ_NONE },
{ 923, 90, DIGREQ_NONE },
{ 702, 41, DIGREQ_NONE },
{ 700, 44, DIGREQ_NONE },
{ 4450, 47, DIGREQ_NONE },
{ 703, 26, DIGREQ_NONE },
{ 4449, 12, DIGREQ_NONE },
{ 4096, 100, DIGREQ_NONE }, -- all crystals
{ 4374, 17, DIGREQ_BURROW },
{ 4373, 41, DIGREQ_BURROW },
{ 4375, 15, DIGREQ_BURROW },
{ 4566, 3, DIGREQ_BURROW },
{ 688, 23, DIGREQ_BORE },
{ 696, 17, DIGREQ_BORE },
{ 690, 3, DIGREQ_BORE },
{ 699, 12, DIGREQ_BORE },
{ 701, 9, DIGREQ_BORE },
{ 1446, 3, DIGREQ_BORE },
{ 4570, 10, DIGREQ_MODIFIER },
{ 4487, 11, DIGREQ_MODIFIER },
{ 4409, 12, DIGREQ_MODIFIER },
{ 1188, 10, DIGREQ_MODIFIER },
{ 4532, 12, DIGREQ_MODIFIER },
};
local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED };
function onChocoboDig(player, precheck)
return chocoboDig(player, itemMap, precheck, messageArray);
end;
function onInitialize(zone)
UpdateNMSpawnPoint(WOODLAND_SAGE);
GetMobByID(WOODLAND_SAGE):setRespawnTime(math.random(900, 10800));
UpdateNMSpawnPoint(BISQUE_HEELED_SUNBERRY);
GetMobByID(BISQUE_HEELED_SUNBERRY):setRespawnTime(math.random(900, 10800));
UpdateNMSpawnPoint(BRIGHT_HANDED_KUNBERRY);
GetMobByID(BRIGHT_HANDED_KUNBERRY):setRespawnTime(math.random(900, 10800));
SetRegionalConquestOverseers(zone:getRegionID())
end;
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
function onZoneIn( player, prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos( 299.997, -5.838, -622.998, 190);
end
if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow
cs = 2;
end
return cs;
end;
function onRegionEnter( player, region)
end;
function onEventUpdate( player, csid, option)
if (csid == 2) then
lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow
end
end;
function onEventFinish( player, csid, option)
if (csid == 2) then
lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow
end
end; | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/poi/dantooine_janta_small2.lua | 1 | 2228 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_building_poi_dantooine_janta_small2 = object_building_poi_shared_dantooine_janta_small2:new {
}
ObjectTemplates:addTemplate(object_building_poi_dantooine_janta_small2, "object/building/poi/dantooine_janta_small2.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/wearables/armor/objects.lua | 165 | 2016 | --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.
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/container/quest/objects.lua | 165 | 2016 | --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.
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/objects.lua | 165 | 2016 | --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.
| lgpl-3.0 |
fhaoquan/skynet | lualib/sharemap.lua | 78 | 1496 | local stm = require "stm"
local sprotoloader = require "sprotoloader"
local sproto = require "sproto"
local setmetatable = setmetatable
local sharemap = {}
function sharemap.register(protofile)
-- use global slot 0 for type define
sprotoloader.register(protofile, 0)
end
local sprotoobj
local function loadsp()
if sprotoobj == nil then
sprotoobj = sprotoloader.load(0)
end
return sprotoobj
end
function sharemap:commit()
self.__obj(sprotoobj:encode(self.__typename, self.__data))
end
function sharemap:copy()
return stm.copy(self.__obj)
end
function sharemap.writer(typename, obj)
local sp = loadsp()
obj = obj or {}
local stmobj = stm.new(sp:encode(typename,obj))
local ret = {
__typename = typename,
__obj = stmobj,
__data = obj,
commit = sharemap.commit,
copy = sharemap.copy,
}
return setmetatable(ret, { __index = obj, __newindex = obj })
end
local function decode(msg, sz, self)
local data = self.__data
for k in pairs(data) do
data[k] = nil
end
return sprotoobj:decode(self.__typename, msg, sz, data)
end
function sharemap:update()
return self.__obj(decode, self)
end
function sharemap.reader(typename, stmcpy)
local sp = loadsp()
local stmobj = stm.newcopy(stmcpy)
local _, data = stmobj(function(msg, sz)
return sp:decode(typename, msg, sz)
end)
local obj = {
__typename = typename,
__obj = stmobj,
__data = data,
update = sharemap.update,
}
return setmetatable(obj, { __index = data, __newindex = error })
end
return sharemap
| mit |
eraffxi/darkstar | scripts/commands/setmentor.lua | 19 | 1135 | ---------------------------------------------------------------------------------------------------
-- func: setmentor <MentorMode> <target>
-- desc: 0 = Not a mentor, 1 = Unlocked but inactive, 2 = Unlocked & flag on.
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "is"
};
function error(player, msg)
player:PrintToPlayer(msg);
player:PrintToPlayer("!setmentor <mode> {player}");
player:PrintToPlayer("mode: 0 = Not a mentor, 1 = Unlocked but inactive.");
end;
function onTrigger(player, mentorMode, target)
-- validate mode
if (mentorMode == nil or mentorMode < 0 or mentorMode > 1) then
error(player, "Invalid mode.");
return;
end
-- validate target
local targ;
if (target == nil) then
targ = player;
else
targ = GetPlayerByName(target);
if (targ == nil) then
error(player, string.format( "Player named '%s' not found!", target ) );
return;
end
end
-- set mentor mode
targ:setMentor(mentorMode);
end; | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/medicine/medpack_enhance_quickness.lua | 3 | 2385 | --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_medicine_medpack_enhance_quickness = object_tangible_medicine_shared_medpack_enhance_quickness:new {
gameObjectType = 8238,
templateType = ENHANCEPACK,
medicineUse = 5,
effectiveness = 100,
duration = 1800,
attribute = 4
}
ObjectTemplates:addTemplate(object_tangible_medicine_medpack_enhance_quickness, "object/tangible/medicine/medpack_enhance_quickness.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/structure/corellia/corl_imprv_bannerpole_s01.lua | 3 | 2292 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_corellia_corl_imprv_bannerpole_s01 = object_static_structure_corellia_shared_corl_imprv_bannerpole_s01:new {
}
ObjectTemplates:addTemplate(object_static_structure_corellia_corl_imprv_bannerpole_s01, "object/static/structure/corellia/corl_imprv_bannerpole_s01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/structure/naboo/obelisk_naboo_theed_style_1.lua | 3 | 2288 | --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_naboo_obelisk_naboo_theed_style_1 = object_static_structure_naboo_shared_obelisk_naboo_theed_style_1:new {
}
ObjectTemplates:addTemplate(object_static_structure_naboo_obelisk_naboo_theed_style_1, "object/static/structure/naboo/obelisk_naboo_theed_style_1.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/droid/component/data_storage_module_4.lua | 2 | 3495 | --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_droid_component_data_storage_module_4 = object_draft_schematic_droid_component_shared_data_storage_module_4:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Level 4 Droid Data Module",
craftingToolTab = 32, -- (See DraftSchemticImplementation.h)
complexity = 22,
size = 8,
xpType = "crafting_droid_general",
xp = 80,
assemblySkill = "droid_assembly",
experimentingSkill = "droid_experimentation",
customizationSkill = "droid_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n"},
ingredientTitleNames = {"module_frame", "contaminent_neutralization_medium", "thermal_shielding", "circuit_mounting_unit", "memory_circuit"},
ingredientSlotType = {0, 0, 0, 0, 1},
resourceTypes = {"copper", "gas_inert", "ore_extrusive", "fiberplast", "object/tangible/component/item/shared_electronics_memory_module.iff"},
resourceQuantities = {16, 10, 8, 6, 1},
contribution = {100, 100, 100, 100, 100},
targetTemplate = "object/tangible/component/droid/data_storage_module_4.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_droid_component_data_storage_module_4, "object/draft_schematic/droid/component/data_storage_module_4.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/La_Theine_Plateau/npcs/Narvecaint.lua | 2 | 1286 | -----------------------------------
-- Area: La Theine Plateau
-- NPC: Narvecaint
-- Involved in Mission: The Rescue Drill
-- !pos -263 22 129 102
-----------------------------------
package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/missions");
require("scripts/zones/La_Theine_Plateau/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
if (player:getCurrentMission(SANDORIA) == THE_RESCUE_DRILL) then
local MissionStatus = player:getVar("MissionStatus");
if (MissionStatus == 6) then
player:startEvent(107);
elseif (MissionStatus == 7) then
player:showText(npc, RESCUE_DRILL + 14);
elseif (MissionStatus == 8) then
player:showText(npc, RESCUE_DRILL + 21);
elseif (MissionStatus >= 9) then
player:showText(npc, RESCUE_DRILL + 26);
else
player:showText(npc, RESCUE_DRILL);
end
else
player:showText(npc, RESCUE_DRILL);
end
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
if (csid == 107) then
player:setVar("MissionStatus",7);
end
end; | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_dathomir_nightsister_initiate.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_dressed_dathomir_nightsister_initiate = object_mobile_shared_dressed_dathomir_nightsister_initiate:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_dathomir_nightsister_initiate, "object/mobile/dressed_dathomir_nightsister_initiate.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/naboo_npc/veers.lua | 3 | 2176 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_naboo_npc_veers = object_mobile_naboo_npc_shared_veers:new {
}
ObjectTemplates:addTemplate(object_mobile_naboo_npc_veers, "object/mobile/naboo_npc/veers.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/globals/mobskills/gospel_of_the_lost.lua | 2 | 1061 | ---------------------------------------------
-- Gospel_of_the_Lost
--
-- Description: Self-heal (~1000 HP) and erase.
-- Type: Healing
-- Can be dispelled: N/A
-- Utsusemi/Blink absorb: N/A
-- Range: Self
-- Notes: Accompanied by text
-- "Bask in my glory..."
-- "Mine existence...stretches into infinity..."
---------------------------------------------
require("scripts/globals/monstertpmoves");
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/msg");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
-- Lets not heal if we haven't taken any damage..
if (mob:getHPP() == 100) then
return 1;
end
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
mob:eraseStatusEffect();
-- Didn't see any msg for the erase in youtube vids.
skill:setMsg(dsp.msg.basic.SELF_HEAL);
-- Assuming its a 4-6% heal based on its max HP and numbers quoted on wiki.
return MobHealMove(mob, mob:getMaxHP() * (math.random(4,6) * 0.01));
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/hopper/crafting_station_hopper/objects.lua | 3 | 13272 | --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_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_large = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_large.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_large",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_large",
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 = 1942668017,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_large, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_large.iff")
object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_medium = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_medium.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_medium",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_medium",
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 = 1814389996,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_medium, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_medium.iff")
object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_small = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_small.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_small",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_small",
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 = 1204901592,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_small, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_small.iff")
object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_large = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_large.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_structure_large",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_structure_large",
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 = 2805227646,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_large, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_large.iff")
object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_medium = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_medium.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_structure_medium",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_structure_medium",
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 = 2417546969,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_medium, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_medium.iff")
object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_small = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_small.iff"
--Data below here is deprecated and loaded from the tres, keeping for easy lookups
--[[
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_ingredient_hopper.iff",
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "",
clientGameObjectType = 8197,
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 2,
containerVolumeLimit = 100,
customizationVariableMapping = {},
detailedDescription = "@crafting_detail:hopper_structure_small",
gameObjectType = 8197,
locationReservationRadius = 0,
lookAtText = "",
noBuildRadius = 0,
objectName = "@crafting:hopper_structure_small",
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 = 2469393495,
derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/tangible/base/shared_tangible_base.iff"}
]]
}
ObjectTemplates:addClientTemplate(object_tangible_hopper_crafting_station_hopper_shared_crafting_station_ingredient_hopper_structure_small, "object/tangible/hopper/crafting_station_hopper/shared_crafting_station_ingredient_hopper_structure_small.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/structure/general/cave_stalactite_damprock_s03_small.lua | 3 | 2324 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_general_cave_stalactite_damprock_s03_small = object_static_structure_general_shared_cave_stalactite_damprock_s03_small:new {
}
ObjectTemplates:addTemplate(object_static_structure_general_cave_stalactite_damprock_s03_small, "object/static/structure/general/cave_stalactite_damprock_s03_small.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/loot/loot_schematic/foodcart_schematic.lua | 3 | 2276 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_loot_loot_schematic_foodcart_schematic = object_tangible_loot_loot_schematic_shared_foodcart_schematic:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_loot_schematic_foodcart_schematic, "object/tangible/loot/loot_schematic/foodcart_schematic.iff")
| lgpl-3.0 |
Joker-Developer/Joker-Developer | plugins/super-info.lua | 4 | 8139 | --[[
# For More Information ....!
# Developer : Aziz < @devss_bot > #Dev
# our channel: @help_tele
]]
do
local Arian = 159280034 --تضع ايدي بوتك هنا
local function setrank(msg, name, value) -- setrank function
local hash = nil
if msg.to.type == 'chat' then
hash = 'rank:'..msg.to.id..':variables'
end
if hash then
redis:hset(hash, name, value)
return send_msg('chat#id'..msg.to.id, 'set Rank for ('..name..') To : '..value, ok_cb, true)
end
end
local function res_user_callback(extra, success, result) -- /info <username> function
if success == 1 then
if result.username then
Username = '@'..result.username
else
Username = '----'
end
local text = 'Full name : '..(result.first_name or '')..' '..(result.last_name or '')..'\n'
..'User name: '..Username..'\n'
..'ID : '..result.id..'\n\n'
local hash = 'rank:'..extra.chat2..':variables'
local value = redis:hget(hash, result.id)
if not value then
if result.id == tonumber(Arian) then
text = text..'Rank : Executive Admin \n\n'
elseif is_admin2(result.id) then
text = text..'Rank : Admin \n\n'
elseif is_owner2(result.id, extra.chat2) then
text = text..'Rank : Owner \n\n'
elseif is_momod2(result.id, extra.chat2) then
text = text..'Rank : Moderator \n\n'
else
text = text..'Rank : Member \n\n'
end
else
text = text..'Rank : '..value..'\n\n'
end
local uhash = 'user:'..result.id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..result.id..':'..extra.chat2
user_info_msgs = tonumber(redis:get(um_hash) or 0)
text = text..'Total messages : '..user_info_msgs..'\n\n'
text = text..'#CHANNEL BOT : @IQ_DEV8'
send_msg(extra.receiver, text, ok_cb, true)
else
send_msg(extra.receiver, ' Username not found.', ok_cb, false)
end
end
local function action_by_id(extra, success, result) -- /info <ID> function
if success == 1 then
if result.username then
Username = '@'..result.username
else
Username = '----'
end
local text = 'Full name : '..(result.first_name or '')..' '..(result.last_name or '')..'\n'
..'Username: '..Username..'\n'
..'ID : '..result.id..'\n\n'
local hash = 'rank:'..extra.chat2..':variables'
local value = redis:hget(hash, result.id)
if not value then
if result.id == tonumber(Arian) then
text = text..'Rank : Executive Admin \n\n'
elseif is_admin2(result.id) then
text = text..'Rank : Admin \n\n'
elseif is_owner2(result.id, extra.chat2) then
text = text..'Rank : Owner \n\n'
elseif is_momod2(result.id, extra.chat2) then
text = text..'Rank : Moderator \n\n'
else
text = text..'Rank : Member \n\n'
end
else
text = text..'Rank : '..value..'\n\n'
end
local uhash = 'user:'..result.id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..result.id..':'..extra.chat2
user_info_msgs = tonumber(redis:get(um_hash) or 0)
text = text..'Total messages : '..user_info_msgs..'\n\n'
text = text..'#CHANNEL BOT : @IQ_DEV8'
send_msg(extra.receiver, text, ok_cb, true)
else
send_msg(extra.receiver, 'id not found.\nuse : /info @username', ok_cb, false)
end
end
local function action_by_reply(extra, success, result)-- (reply) /info function
if result.from.username then
Username = '@'..result.from.username
else
Username = '----'
end
local text = 'Full name : '..(result.from.first_name or '')..' '..(result.from.last_name or '')..'\n'
..'Username : '..Username..'\n'
..'ID : '..result.from.id..'\n\n'
local hash = 'rank:'..result.to.id..':variables'
local value = redis:hget(hash, result.from.id)
if not value then
if result.from.id == tonumber(Arian) then
text = text..'Rank : Executive Admin \n\n'
elseif is_admin2(result.from.id) then
text = text..'Rank : Admin \n\n'
elseif is_owner2(result.from.id, result.to.id) then
text = text..'Rank : Owner \n\n'
elseif is_momod2(result.from.id, result.to.id) then
text = text..'Rank : Moderator \n\n'
else
text = text..'Rank : Member \n\n'
end
else
text = text..'Rank : '..value..'\n\n'
end
local user_info = {}
local uhash = 'user:'..result.from.id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..result.from.id..':'..result.to.id
user_info_msgs = tonumber(redis:get(um_hash) or 0)
text = text..'Total messages : '..user_info_msgs..'\n\n'
text = text..'#CHANNEL BOT : @IQ_DEV8'
send_msg(extra.receiver, text, ok_cb, true)
end
local function action_by_reply2(extra, success, result)
local value = extra.value
setrank(result, result.from.id, value)
end
local function run(msg, matches)
if matches[1]:lower() == 'setrank' then
local hash = 'usecommands:'..msg.from.id..':'..msg.to.id
redis:incr(hash)
if not is_sudo(msg) then
return "Only for Sudo"
end
local receiver = get_receiver(msg)
local Reply = msg.reply_id
if msg.reply_id then
local value = string.sub(matches[2], 1, 1000)
msgr = get_message(msg.reply_id, action_by_reply2, {receiver=receiver, Reply=Reply, value=value})
else
local name = string.sub(matches[2], 1, 50)
local value = string.sub(matches[3], 1, 1000)
local text = setrank(msg, name, value)
return text
end
end
if matches[1]:lower() == 'info' and not matches[2] then
local receiver = get_receiver(msg)
local Reply = msg.reply_id
if msg.reply_id then
msgr = get_message(msg.reply_id, action_by_reply, {receiver=receiver, Reply=Reply})
else
if msg.from.username then
Username = '@'..msg.from.username
else
Username = '----'
end
local text = 'First name : '..(msg.from.first_name or '----')..'\n'
local text = text..'Last name : '..(msg.from.last_name or '----')..'\n'
local text = text..'Username : '..Username..'\n'
local text = text..'ID : '..msg.from.id..'\n\n'
local hash = 'rank:'..msg.to.id..':variables'
if hash then
local value = redis:hget(hash, msg.from.id)
if not value then
if msg.from.id == tonumber(Arian) then
text = text..'Rank : Executive Admin \n\n'
elseif is_sudo(msg) then
text = text..'Rank : Admin \n\n'
elseif is_owner(msg) then
text = text..'Rank : Owner \n\n'
elseif is_momod(msg) then
text = text..'Rank : Moderator \n\n'
else
text = text..'Rank : Member \n\n'
end
else
text = text..'Rank : '..value..'\n'
end
end
local uhash = 'user:'..msg.from.id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..msg.from.id..':'..msg.to.id
user_info_msgs = tonumber(redis:get(um_hash) or 0)
text = text..'Total messages : '..user_info_msgs..'\n\n'
if msg.to.type == 'chat' then
text = text..'Group name : '..msg.to.title..'\n'
text = text..'Group ID : '..msg.to.id
end
text = text..'\n\n#CHANNEL : @help_tele'
return send_msg(receiver, text, ok_cb, true)
end
end
if matches[1]:lower() == 'info' and matches[2] then
local user = matches[2]
local chat2 = msg.to.id
local receiver = get_receiver(msg)
if string.match(user, '^%d+$') then
user_info('user#id'..user, action_by_id, {receiver=receiver, user=user, text=text, chat2=chat2})
elseif string.match(user, '^@.+$') then
username = string.gsub(user, '@', '')
msgr = res_user(username, res_user_callback, {receiver=receiver, user=user, text=text, chat2=chat2})
end
end
end
return {
description = 'Know your information or the info of a chat members.',
usage = {
'!info: Return your info and the chat info if you are in one.',
'(Reply)!info: Return info of replied user if used by reply.',
'!info <id>: Return the info\'s of the <id>.',
'!info @<user_name>: Return the member @<user_name> information from the current chat.',
'!setrank <userid> <rank>: change members rank.',
'(Reply)!setrank <rank>: change members rank.',
},
patterns = {
"^([Ii][Nn][Ff][Oo])$",
"^([Ii][Nn][Ff][Oo]) (.*)$",
"^([Ss][Ee][Tt][Rr][Aa][Nn][Kk]) (%d+) (.*)$",
"^([Ss][Ee][Tt][Rr][Aa][Nn][Kk]) (.*)$",
},
run = run
}
end
--CHANNEL BOT : @IQ_DEV8
--by @zeoon3 | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/loot/items/wearables/ithorian/ith_jacket_s11.lua | 4 | 1192 | ith_jacket_s11 = {
-- Ithorian Officer's Jacket
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "",
directObjectTemplate = "object/tangible/wearables/ithorian/ith_jacket_s11.iff",
craftingValues = {},
skillMods = {},
customizationStringNames = {"/private/index_color_1","/private/index_color_2"},
customizationValues = {
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119}
},
junkDealerTypeNeeded = JUNKCLOTHESANDJEWELLERY,
junkMinValue = 50,
junkMaxValue = 100
}
addLootItemTemplate("ith_jacket_s11", ith_jacket_s11) | lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/space_greeter_coronet_shipwright_impatient.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_space_greeter_coronet_shipwright_impatient = object_mobile_shared_space_greeter_coronet_shipwright_impatient:new {
}
ObjectTemplates:addTemplate(object_mobile_space_greeter_coronet_shipwright_impatient, "object/mobile/space_greeter_coronet_shipwright_impatient.iff")
| lgpl-3.0 |
AwfulRanger/TF2Weapons | lua/weapons/tf_weapon_medigun.lua | 1 | 16347 | AddCSLuaFile()
DEFINE_BASECLASS( "tf2weapons_base" )
game.AddParticles( "particles/medicgun_beam.pcf" )
if CLIENT then
local redoverlay = CreateMaterial( "TF2Weapons_MediGun_InvulnOverlay_Red", "Refract", {
[ "$forcerefract" ] = "1",
[ "$refractamount" ] = "0.02",
[ "$model" ] = "1",
[ "$refracttint" ] = "{ 255 155 15 }",
[ "$normalmap" ] = "effects/invuln_overlay_normal",
[ "$bumpframe" ] = "0",
[ "$bluramount" ] = "1",
[ "$refracttinttexture" ] = "effects/invulnoverlay/invuln_overlay",
[ "Proxies" ] = {
[ "sine" ] = {
[ "sinemax" ] = "0.1",
[ "sinemin" ] = "-0.1",
[ "sineperiod" ] = "0.81",
[ "resultvar" ] = "$refractamount",
},
},
} )
local bluoverlay = CreateMaterial( "TF2Weapons_MediGun_InvulnOverlay_Blue", "Refract", {
[ "$forcerefract" ] = "1",
[ "$refractamount" ] = "0.02",
[ "$model" ] = "1",
[ "$refracttint" ] = "{ 55 155 255 }",
[ "$normalmap" ] = "effects/invuln_overlay_normal",
[ "$bumpframe" ] = "0",
[ "$bluramount" ] = "1",
[ "$refracttinttexture" ] = "effects/invulnoverlay/invuln_overlay",
[ "Proxies" ] = {
[ "sine" ] = {
[ "sinemax" ] = "0.1",
[ "sinemin" ] = "-0.1",
[ "sineperiod" ] = "0.81",
[ "resultvar" ] = "$refractamount",
},
},
} )
hook.Add( "HUDPaint", "TF2Weapons_MediGun_HUDPaint", function()
if LocalPlayer():GetNW2Bool( "Ubercharged", false ) == true then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( redoverlay )
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
end
end )
else
hook.Add( "PlayerDeath", "TF2Weapons_MediGun_PlayerDeath", function( ply )
ply:SetNW2Bool( "Ubercharged", false )
ply:GodDisable()
ply:SetMaterial()
end )
end
CreateConVar( "tf2weapons_heal_teammates", 0, { FCVAR_SERVER_CAN_EXECUTE, FCVAR_REPLICATED }, [[0 to allow medigun to heal teammates and prevent it from healing enemies
1 to prevent medigun from healing teammates and allow it to heal enemies
2 to allow medigun to heal anyone]] )
SWEP.Slot = 1
SWEP.SlotPos = 0
SWEP.DrawAmmo = false
SWEP.CrosshairType = TF2Weapons.Crosshair.BIGPLUS
SWEP.KillIconX = 0
SWEP.KillIconY = 0
SWEP.KillIconW = 0
SWEP.KillIconH = 0
SWEP.IconOverride = "backpack/weapons/c_models/c_medigun/c_medigun"
if CLIENT then SWEP.WepSelectIcon = surface.GetTextureID( SWEP.IconOverride ) end
SWEP.PrintName = "#TF_Weapon_Medigun"
SWEP.Author = "AwfulRanger"
SWEP.Category = "Team Fortress 2 - Medic"
SWEP.Level = 1
SWEP.Type = "#TF_Weapon_Medigun"
SWEP.Base = "tf2weapons_base"
SWEP.Classes = { [ TF2Weapons.Class.MEDIC ] = true }
SWEP.Quality = TF2Weapons.Quality.NORMAL
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.ViewModel = Model( "models/weapons/c_models/c_medigun/c_medigun.mdl" )
SWEP.WorldModel = Model( "models/weapons/c_models/c_medigun/c_medigun.mdl" )
SWEP.HandModel = Model( "models/weapons/c_models/c_medic_arms.mdl" )
SWEP.HoldType = "crossbow"
function SWEP:GetAnimations()
return ""
end
function SWEP:GetInspect()
return "secondary"
end
SWEP.Attributes = {}
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Primary.Range = 256
SWEP.Primary.Overheal = 1.5
SWEP.Primary.InCombatTime = 10
SWEP.Primary.OutCombatTime = 15
SWEP.Primary.HPSInCombat = 24
SWEP.Primary.HPSOutCombat = 72
SWEP.Primary.Charge = 0.025
SWEP.Primary.ChargeOverheal = 0.0125
SWEP.Primary.ChargeTime = 8
SWEP.CritChance = 0
function SWEP:SetVariables()
self.HealSound = Sound( "weapons/medigun_heal.wav" )
self.ChargedSound = Sound( "weapons/medigun_charged.wav" )
self.NoTargetSound = Sound( "weapons/medigun_no_target.wav" )
self.HealEndSound = Sound( "null.wav" )
end
function SWEP:SetupDataTables()
self:BaseDataTables()
self:TFNetworkVar( "Bool", "BeamDeployed", false )
self:TFNetworkVar( "Bool", "HealLoop", false )
self:TFNetworkVar( "Bool", "HasUbercharge", false )
self:TFNetworkVar( "Bool", "UsingUbercharge", false )
self:TFNetworkVar( "Float", "HealAnim", 0 )
self:TFNetworkVar( "Float", "LastHeal", 0 )
self:TFNetworkVar( "Float", "AddedHealth", 0 )
self:TFNetworkVar( "Float", "Ubercharge", 0 )
self:TFNetworkVar( "Float", "UberchargeStart", 0 )
self:TFNetworkVar( "Entity", "Patient", nil )
self:TFNetworkVar( "Entity", "BeamTarget", nil )
end
SWEP.UberchargeOverlayRed = redoverlay
SWEP.UberchargeOverlayBlue = bluoverlay
function SWEP:Initialize()
self:DoInitialize()
self:PrecacheParticles( { self.MediGunBeamRed, self.MediGunBeamBlue } )
end
function SWEP:DoDrawCrosshair( x, y )
self:OnDrawCrosshair( x, y )
self:DrawMeter( self:GetTFUbercharge() )
return true
end
SWEP.MediGunBeamRed = "medicgun_beam_red"
SWEP.MediGunBeamBlue = "medicgun_beam_blue"
SWEP.UberchargeMaterialRed = Material( "models/effects/invulnfx_red" )
SWEP.UberchargeMaterialBlue = Material( "models/effects/invulnfx_blue" )
function SWEP:EnableUbercharge( ent )
if IsValid( ent ) ~= true then return end
local ubermat = self.UberchargeMaterialRed:GetName()
if self:GetTeam() == true then ubermat = self.UberchargeMaterialBlue:GetName() end
ent:SetNW2Bool( "Ubercharged", true )
if SERVER and ent:IsPlayer() == true then ent:GodEnable() end
ent:SetMaterial( ubermat )
if ent:IsPlayer() == true then
if IsValid( ent:GetActiveWeapon() ) == true then ent:GetActiveWeapon():SetMaterial( ubermat ) end
for i = 0, 2 do
if IsValid( ent:GetViewModel( i ) ) == true then ent:GetViewModel( i ):SetMaterial( ubermat ) end
end
end
end
function SWEP:DisableUbercharge( ent )
if IsValid( ent ) ~= true then return end
ent:SetNW2Bool( "Ubercharged", false )
if SERVER and ent:IsPlayer() == true then ent:GodDisable() end
ent:SetMaterial()
if ent:IsPlayer() == true then
if IsValid( ent:GetActiveWeapon() ) == true then ent:GetActiveWeapon():SetMaterial() end
for i = 0, 2 do
if IsValid( ent:GetViewModel( i ) ) == true then ent:GetViewModel( i ):SetMaterial() end
end
end
end
function SWEP:StopHealing()
if IsFirstTimePredicted() ~= true then return end
if self.StopHealingNext == true and self:GetTFBeamDeployed() == true then
self.StopHealingNext = false
self:DisableUbercharge( self:GetTFPatient() )
self:SetTFPatient( nil )
self:SetTFHealAnim( 0 )
self:SetTFHealLoop( false )
self:SetVMAnimation( self:GetHandAnim( "fire_off" ) )
self:EmitSound( self.HealEndSound )
local hands, weapon = self:GetViewModels()
if IsValid( self:GetOwner() ) == true and IsValid( weapon ) == true then weapon:StopParticles() end
self:RemoveParticles()
self:SetTFBeamDeployed( false )
end
end
SWEP.BeamViewModel = true
function SWEP:CreateBeamParticle()
local particle = self.MediGunBeamRed
if self:GetTeam() == true then particle = self.MediGunBeamBlue end
if SERVER or IsFirstTimePredicted() ~= true then return end
if self:DrawingVM() == true then
local hands, weapon = self:GetViewModels()
self:AddParticle( particle, {
{
entity = weapon,
attachtype = PATTACH_POINT_FOLLOW,
attachment = "muzzle",
},
{
entity = self:GetTFPatient(),
attachtype = PATTACH_POINT_FOLLOW,
attachment = "chest",
},
} )
else
self:AddParticle( particle, {
{
attachtype = PATTACH_POINT_FOLLOW,
attachment = "muzzle",
},
{
entity = self:GetTFPatient(),
attachtype = PATTACH_POINT_FOLLOW,
attachment = "chest",
},
} )
end
end
function SWEP:DoHealing()
local hands, weapon = self:GetViewModels()
if self:Healing() == true then
if self:CheckPatient() ~= true then self:GetPatient() end
if IsValid( self:GetTFPatient() ) == true then
if self:GetTFBeamDeployed() ~= true or self:GetTFPatient() ~= self:GetTFBeamTarget() then
self:SetTFBeamTarget( self:GetTFPatient() )
if IsValid( self:GetTFBeamTarget() ) ~= true then return end
self:CreateBeamParticle()
self:SetTFBeamDeployed( true )
self:SetTFLastHeal( CurTime() )
self:SetTFAddedHealth( 0 )
end
if CurTime() > self:GetTFHealAnim() then
if self:GetTFHealLoop() == true then
local fire_loop = self:GetHandAnim( "fire_loop" )
self:SetVMAnimation( fire_loop )
self:SetTFHealAnim( CurTime() + hands:SequenceDuration( hands:LookupSequence( fire_loop ) ) )
else
local fire_on = self:GetHandAnim( "fire_on" )
self:SetVMAnimation( fire_on )
self:SetTFHealAnim( CurTime() + hands:SequenceDuration( hands:LookupSequence( fire_on ) ) )
self:SetTFHealLoop( true )
self:EmitSound( self.HealSound )
end
end
self:Heal( self:GetPatient() )
/*
if CLIENT and self.BeamViewModel ~= self:DrawingVM() then
self:CreateBeamParticle()
self.BeamViewModel = self:DrawingVM()
end
*/
self.StopHealingNext = true
else
self:StopHealing()
end
else
self:StopHealing()
end
end
function SWEP:DoUbercharge()
if self:GetTFUsingUbercharge() == true then
local uber = ( ( self.Primary.ChargeTime - ( CurTime() - self:GetTFUberchargeStart() ) ) / self.Primary.ChargeTime )
self:SetTFUbercharge( uber )
self:EnableUbercharge( self )
self:EnableUbercharge( self:GetTFPatient() )
if self:GetTFUbercharge() <= 0 then
self:SetTFUsingUbercharge( false )
self:DisableUbercharge( self:GetOwner() )
self:DisableUbercharge( self:GetTFPatient() )
end
else
self:DisableUbercharge( self:GetOwner() )
self:DisableUbercharge( self:GetTFPatient() )
end
end
function SWEP:Think()
if IsValid( self:GetOwner() ) == false then return end
BaseClass.Think( self )
self:DoHealing()
self:DoUbercharge()
end
function SWEP:PrimaryAttack()
end
function SWEP:GetPatient()
if IsValid( self:GetTFPatient() ) ~= true then
if self:GetOwner():IsPlayer() == true then self:GetOwner():LagCompensation( true ) end
trace = util.TraceLine( { start = self:GetOwner():GetShootPos(), endpos = self:GetOwner():GetShootPos() + self:GetOwner():GetAimVector() * self.Primary.Range, filter = self:GetOwner(), mask = MASK_SHOT } )
if self:GetOwner():IsPlayer() == true then self:GetOwner():LagCompensation( false ) end
if trace.Hit == false then
if self:GetOwner():IsPlayer() == true then self:GetOwner():LagCompensation( true ) end
trace = util.TraceHull( { start = self:GetOwner():GetShootPos(), endpos = self:GetOwner():GetShootPos() + self:GetOwner():GetAimVector() * ( self.Primary.Range - 10 ), mins = Vector( -10, -10, -10 ), maxs = Vector( 10, 10, 10 ), filter = self:GetOwner(), mask = MASK_SHOT_HULL } )
if self:GetOwner():IsPlayer() == true then self:GetOwner():LagCompensation( false ) end
end
local ent = trace.Entity
if IsValid( ent ) == true and ( ent:IsPlayer() == true or ent:IsNPC() == true ) then
if TF2Weapons:MediGunCanHeal( self, ent ) == true then self:SetTFPatient( ent ) end
end
end
return self:GetTFPatient()
end
function SWEP:CheckPatient( dontremove )
local ent = self:GetTFPatient()
local valid = IsValid( ent )
if valid == true then
if IsValid( self:GetOwner() ) ~= true then
valid = false
else
if SERVER and ent:Visible( self:GetOwner() ) ~= true then valid = false end
if ent:GetPos():Distance( self:GetOwner():GetPos() ) > self.Primary.Range then valid = false end
local teammates = GetConVar( "tf2weapons_heal_teammates" ):GetInt()
if teammates ~= 2 then
if teammates <= 0 then
if ent:IsNPC() ~= true and hook.Run( "PlayerShouldTakeDamage", self:GetOwner(), ent ) == true then valid = false end
elseif teammates == 1 then
if ent:IsNPC() ~= true and hook.Run( "PlayerShouldTakeDamage", self:GetOwner(), ent ) ~= true then valid = false end
end
end
end
end
if valid == false and dontremove ~= true then
if IsValid( ent ) == true then self:DisableUbercharge( ent ) end
self:SetTFPatient( nil )
end
return valid
end
function SWEP:Healing()
if CurTime() > self:GetNextPrimaryFire() and IsValid( self:GetOwner() ) == true and self:GetOwner():KeyDown( IN_ATTACK ) == true then return true end
return false
end
function SWEP:Heal( target )
if IsValid( target ) ~= true then return end
--health
local healthmult = self.Primary.Overheal
if GetConVar( "tf2weapons_overheal" ):GetBool() ~= true then healthmult = 1 end
local hps = self.Primary.HPSInCombat
local time = CurTime() - target:GetNW2Float( "TFLastDamage", 0 )
if time > self.Primary.InCombatTime then
local mult = ( time - self.Primary.InCombatTime ) / ( self.Primary.OutCombatTime - self.Primary.InCombatTime )
if mult > 1 then mult = 1 end
hps = self.Primary.HPSInCombat + ( self.Primary.HPSInCombat * ( ( ( self.Primary.HPSOutCombat / self.Primary.HPSInCombat ) - 1 ) * mult ) )
end
local health = self:GetTFAddedHealth() + ( hps * ( CurTime() - self:GetTFLastHeal() ) )
local healthfloor = math.floor( health )
if healthfloor >= 1 then
health = health - healthfloor
end
if target:Health() + healthfloor > target:GetMaxHealth() * healthmult then
health = 0
healthfloor = ( target:GetMaxHealth() * healthmult ) - target:Health()
end
if healthfloor >= 1 then target:SetHealth( target:Health() + healthfloor ) end
--ubercharge
local ups = self.Primary.Charge
if target:Health() > target:GetMaxHealth() then ups = self.Primary.ChargeOverheal end
local uber = self:GetTFUbercharge() + ( ups * ( CurTime() - self:GetTFLastHeal() ) )
if uber < 0 then uber = 0 end
if uber > 1 then uber = 1 end
self:SetTFUbercharge( uber )
self:SetTFLastHeal( CurTime() )
self:SetTFAddedHealth( health )
end
function SWEP:SecondaryAttack()
local uber = self:GetTFUbercharge()
if uber < 1 then return end
self:EnableUbercharge( self:GetOwner() )
self:EnableUbercharge( self:GetTFPatient() )
self:SetTFUsingUbercharge( true )
self:SetTFUberchargeStart( CurTime() )
end
function SWEP:Reload()
end
function SWEP:Deploy()
if IsValid( self:GetOwner() ) == false then return end
self:DoDeploy()
if self:GetTFUsingUbercharge() == true then self:EnableUbercharge( self:GetOwner() ) end
return true
end
function SWEP:Holster()
self:DoHolster()
self:DisableUbercharge( self:GetOwner() )
self:DisableUbercharge( self:GetTFPatient() )
return true
end
function SWEP:BuildWorldModelBones( ent, count )
if IsValid( self:GetOwner() ) == true and self:GetOwner():LookupBone( "weapon_bone_l" ) == nil then
local weaponbonel = self:LookupBone( "weapon_bone_l" )
local lhandbone = self:GetOwner():LookupBone( "valvebiped.bip01_l_hand" )
if weaponbonel == nil or lhandbone == nil then return end
local lpos, lang = self:GetOwner():GetBonePosition( lhandbone )
if self:GetOwner():LookupAttachment( "anim_attachment_lh" ) ~= 0 then lpos = self:GetOwner():GetAttachment( self:GetOwner():LookupAttachment( "anim_attachment_lh" ) ).Pos end
lang:RotateAroundAxis( lang:Up(), 180 )
local lwpos, lwang = self:GetBonePosition( weaponbonel )
for i = 0, self:GetBoneCount() - 1 do
if i ~= weaponbonel and string.lower( self:GetBoneName( i ) ) ~= "__invalidbone__" then
local cpos, cang = self:GetBonePosition( i )
local localpos, localang = WorldToLocal( cpos, cang, lwpos, lwang )
local childpos, childang = LocalToWorld( localpos, localang, lpos, lang )
self:SetBonePosition( i, childpos, childang )
end
end
self:SetBonePosition( weaponbonel, lpos, lang )
/*
local weaponboner = self:LookupBone( "joint_lever" )
local rhandbone = self:GetOwner():LookupBone( "valvebiped.bip01_r_hand" )
if weaponboner == nil or rhandbone == nil then return end
local rpos, rang = self:GetOwner():GetBonePosition( rhandbone )
if self:GetOwner():LookupAttachment( "anim_attachment_rh" ) ~= 0 then rpos = self:GetOwner():GetAttachment( self:GetOwner():LookupAttachment( "anim_attachment_rh" ) ).Pos end
self:SetBonePosition( weaponboner, rpos, rang )
*/
end
end | mit |
zj831007/some-mmorpg | 3rd/lua-cjson/lua/cjson/util.lua | 170 | 6837 | local json = require "cjson"
-- Various common routines used by the Lua CJSON package
--
-- Mark Pulford <mark@kyne.com.au>
-- Determine with a Lua table can be treated as an array.
-- Explicitly returns "not an array" for very sparse arrays.
-- Returns:
-- -1 Not an array
-- 0 Empty table
-- >0 Highest index in the array
local function is_array(table)
local max = 0
local count = 0
for k, v in pairs(table) do
if type(k) == "number" then
if k > max then max = k end
count = count + 1
else
return -1
end
end
if max > count * 2 then
return -1
end
return max
end
local serialise_value
local function serialise_table(value, indent, depth)
local spacing, spacing2, indent2
if indent then
spacing = "\n" .. indent
spacing2 = spacing .. " "
indent2 = indent .. " "
else
spacing, spacing2, indent2 = " ", " ", false
end
depth = depth + 1
if depth > 50 then
return "Cannot serialise any further: too many nested tables"
end
local max = is_array(value)
local comma = false
local fragment = { "{" .. spacing2 }
if max > 0 then
-- Serialise array
for i = 1, max do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment, serialise_value(value[i], indent2, depth))
comma = true
end
elseif max < 0 then
-- Serialise table
for k, v in pairs(value) do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment,
("[%s] = %s"):format(serialise_value(k, indent2, depth),
serialise_value(v, indent2, depth)))
comma = true
end
end
table.insert(fragment, spacing .. "}")
return table.concat(fragment)
end
function serialise_value(value, indent, depth)
if indent == nil then indent = "" end
if depth == nil then depth = 0 end
if value == json.null then
return "json.null"
elseif type(value) == "string" then
return ("%q"):format(value)
elseif type(value) == "nil" or type(value) == "number" or
type(value) == "boolean" then
return tostring(value)
elseif type(value) == "table" then
return serialise_table(value, indent, depth)
else
return "\"<" .. type(value) .. ">\""
end
end
local function file_load(filename)
local file
if filename == nil then
file = io.stdin
else
local err
file, err = io.open(filename, "rb")
if file == nil then
error(("Unable to read '%s': %s"):format(filename, err))
end
end
local data = file:read("*a")
if filename ~= nil then
file:close()
end
if data == nil then
error("Failed to read " .. filename)
end
return data
end
local function file_save(filename, data)
local file
if filename == nil then
file = io.stdout
else
local err
file, err = io.open(filename, "wb")
if file == nil then
error(("Unable to write '%s': %s"):format(filename, err))
end
end
file:write(data)
if filename ~= nil then
file:close()
end
end
local function compare_values(val1, val2)
local type1 = type(val1)
local type2 = type(val2)
if type1 ~= type2 then
return false
end
-- Check for NaN
if type1 == "number" and val1 ~= val1 and val2 ~= val2 then
return true
end
if type1 ~= "table" then
return val1 == val2
end
-- check_keys stores all the keys that must be checked in val2
local check_keys = {}
for k, _ in pairs(val1) do
check_keys[k] = true
end
for k, v in pairs(val2) do
if not check_keys[k] then
return false
end
if not compare_values(val1[k], val2[k]) then
return false
end
check_keys[k] = nil
end
for k, _ in pairs(check_keys) do
-- Not the same if any keys from val1 were not found in val2
return false
end
return true
end
local test_count_pass = 0
local test_count_total = 0
local function run_test_summary()
return test_count_pass, test_count_total
end
local function run_test(testname, func, input, should_work, output)
local function status_line(name, status, value)
local statusmap = { [true] = ":success", [false] = ":error" }
if status ~= nil then
name = name .. statusmap[status]
end
print(("[%s] %s"):format(name, serialise_value(value, false)))
end
local result = { pcall(func, unpack(input)) }
local success = table.remove(result, 1)
local correct = false
if success == should_work and compare_values(result, output) then
correct = true
test_count_pass = test_count_pass + 1
end
test_count_total = test_count_total + 1
local teststatus = { [true] = "PASS", [false] = "FAIL" }
print(("==> Test [%d] %s: %s"):format(test_count_total, testname,
teststatus[correct]))
status_line("Input", nil, input)
if not correct then
status_line("Expected", should_work, output)
end
status_line("Received", success, result)
print()
return correct, result
end
local function run_test_group(tests)
local function run_helper(name, func, input)
if type(name) == "string" and #name > 0 then
print("==> " .. name)
end
-- Not a protected call, these functions should never generate errors.
func(unpack(input or {}))
print()
end
for _, v in ipairs(tests) do
-- Run the helper if "should_work" is missing
if v[4] == nil then
run_helper(unpack(v))
else
run_test(unpack(v))
end
end
end
-- Run a Lua script in a separate environment
local function run_script(script, env)
local env = env or {}
local func
-- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists
if _G.setfenv then
func = loadstring(script)
if func then
setfenv(func, env)
end
else
func = load(script, nil, nil, env)
end
if func == nil then
error("Invalid syntax.")
end
func()
return env
end
-- Export functions
return {
serialise_value = serialise_value,
file_load = file_load,
file_save = file_save,
compare_values = compare_values,
run_test_summary = run_test_summary,
run_test = run_test,
run_test_group = run_test_group,
run_script = run_script
}
-- vi:ai et sw=4 ts=4:
| mit |
danronco/nodemcu-firmware | app/cjson/lua/cjson/util.lua | 170 | 6837 | local json = require "cjson"
-- Various common routines used by the Lua CJSON package
--
-- Mark Pulford <mark@kyne.com.au>
-- Determine with a Lua table can be treated as an array.
-- Explicitly returns "not an array" for very sparse arrays.
-- Returns:
-- -1 Not an array
-- 0 Empty table
-- >0 Highest index in the array
local function is_array(table)
local max = 0
local count = 0
for k, v in pairs(table) do
if type(k) == "number" then
if k > max then max = k end
count = count + 1
else
return -1
end
end
if max > count * 2 then
return -1
end
return max
end
local serialise_value
local function serialise_table(value, indent, depth)
local spacing, spacing2, indent2
if indent then
spacing = "\n" .. indent
spacing2 = spacing .. " "
indent2 = indent .. " "
else
spacing, spacing2, indent2 = " ", " ", false
end
depth = depth + 1
if depth > 50 then
return "Cannot serialise any further: too many nested tables"
end
local max = is_array(value)
local comma = false
local fragment = { "{" .. spacing2 }
if max > 0 then
-- Serialise array
for i = 1, max do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment, serialise_value(value[i], indent2, depth))
comma = true
end
elseif max < 0 then
-- Serialise table
for k, v in pairs(value) do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment,
("[%s] = %s"):format(serialise_value(k, indent2, depth),
serialise_value(v, indent2, depth)))
comma = true
end
end
table.insert(fragment, spacing .. "}")
return table.concat(fragment)
end
function serialise_value(value, indent, depth)
if indent == nil then indent = "" end
if depth == nil then depth = 0 end
if value == json.null then
return "json.null"
elseif type(value) == "string" then
return ("%q"):format(value)
elseif type(value) == "nil" or type(value) == "number" or
type(value) == "boolean" then
return tostring(value)
elseif type(value) == "table" then
return serialise_table(value, indent, depth)
else
return "\"<" .. type(value) .. ">\""
end
end
local function file_load(filename)
local file
if filename == nil then
file = io.stdin
else
local err
file, err = io.open(filename, "rb")
if file == nil then
error(("Unable to read '%s': %s"):format(filename, err))
end
end
local data = file:read("*a")
if filename ~= nil then
file:close()
end
if data == nil then
error("Failed to read " .. filename)
end
return data
end
local function file_save(filename, data)
local file
if filename == nil then
file = io.stdout
else
local err
file, err = io.open(filename, "wb")
if file == nil then
error(("Unable to write '%s': %s"):format(filename, err))
end
end
file:write(data)
if filename ~= nil then
file:close()
end
end
local function compare_values(val1, val2)
local type1 = type(val1)
local type2 = type(val2)
if type1 ~= type2 then
return false
end
-- Check for NaN
if type1 == "number" and val1 ~= val1 and val2 ~= val2 then
return true
end
if type1 ~= "table" then
return val1 == val2
end
-- check_keys stores all the keys that must be checked in val2
local check_keys = {}
for k, _ in pairs(val1) do
check_keys[k] = true
end
for k, v in pairs(val2) do
if not check_keys[k] then
return false
end
if not compare_values(val1[k], val2[k]) then
return false
end
check_keys[k] = nil
end
for k, _ in pairs(check_keys) do
-- Not the same if any keys from val1 were not found in val2
return false
end
return true
end
local test_count_pass = 0
local test_count_total = 0
local function run_test_summary()
return test_count_pass, test_count_total
end
local function run_test(testname, func, input, should_work, output)
local function status_line(name, status, value)
local statusmap = { [true] = ":success", [false] = ":error" }
if status ~= nil then
name = name .. statusmap[status]
end
print(("[%s] %s"):format(name, serialise_value(value, false)))
end
local result = { pcall(func, unpack(input)) }
local success = table.remove(result, 1)
local correct = false
if success == should_work and compare_values(result, output) then
correct = true
test_count_pass = test_count_pass + 1
end
test_count_total = test_count_total + 1
local teststatus = { [true] = "PASS", [false] = "FAIL" }
print(("==> Test [%d] %s: %s"):format(test_count_total, testname,
teststatus[correct]))
status_line("Input", nil, input)
if not correct then
status_line("Expected", should_work, output)
end
status_line("Received", success, result)
print()
return correct, result
end
local function run_test_group(tests)
local function run_helper(name, func, input)
if type(name) == "string" and #name > 0 then
print("==> " .. name)
end
-- Not a protected call, these functions should never generate errors.
func(unpack(input or {}))
print()
end
for _, v in ipairs(tests) do
-- Run the helper if "should_work" is missing
if v[4] == nil then
run_helper(unpack(v))
else
run_test(unpack(v))
end
end
end
-- Run a Lua script in a separate environment
local function run_script(script, env)
local env = env or {}
local func
-- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists
if _G.setfenv then
func = loadstring(script)
if func then
setfenv(func, env)
end
else
func = load(script, nil, nil, env)
end
if func == nil then
error("Invalid syntax.")
end
func()
return env
end
-- Export functions
return {
serialise_value = serialise_value,
file_load = file_load,
file_save = file_save,
compare_values = compare_values,
run_test_summary = run_test_summary,
run_test = run_test,
run_test_group = run_test_group,
run_script = run_script
}
-- vi:ai et sw=4 ts=4:
| mit |
sniperHW/netclient | deps/lua-cjson-2.1.0/lua/cjson/util.lua | 170 | 6837 | local json = require "cjson"
-- Various common routines used by the Lua CJSON package
--
-- Mark Pulford <mark@kyne.com.au>
-- Determine with a Lua table can be treated as an array.
-- Explicitly returns "not an array" for very sparse arrays.
-- Returns:
-- -1 Not an array
-- 0 Empty table
-- >0 Highest index in the array
local function is_array(table)
local max = 0
local count = 0
for k, v in pairs(table) do
if type(k) == "number" then
if k > max then max = k end
count = count + 1
else
return -1
end
end
if max > count * 2 then
return -1
end
return max
end
local serialise_value
local function serialise_table(value, indent, depth)
local spacing, spacing2, indent2
if indent then
spacing = "\n" .. indent
spacing2 = spacing .. " "
indent2 = indent .. " "
else
spacing, spacing2, indent2 = " ", " ", false
end
depth = depth + 1
if depth > 50 then
return "Cannot serialise any further: too many nested tables"
end
local max = is_array(value)
local comma = false
local fragment = { "{" .. spacing2 }
if max > 0 then
-- Serialise array
for i = 1, max do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment, serialise_value(value[i], indent2, depth))
comma = true
end
elseif max < 0 then
-- Serialise table
for k, v in pairs(value) do
if comma then
table.insert(fragment, "," .. spacing2)
end
table.insert(fragment,
("[%s] = %s"):format(serialise_value(k, indent2, depth),
serialise_value(v, indent2, depth)))
comma = true
end
end
table.insert(fragment, spacing .. "}")
return table.concat(fragment)
end
function serialise_value(value, indent, depth)
if indent == nil then indent = "" end
if depth == nil then depth = 0 end
if value == json.null then
return "json.null"
elseif type(value) == "string" then
return ("%q"):format(value)
elseif type(value) == "nil" or type(value) == "number" or
type(value) == "boolean" then
return tostring(value)
elseif type(value) == "table" then
return serialise_table(value, indent, depth)
else
return "\"<" .. type(value) .. ">\""
end
end
local function file_load(filename)
local file
if filename == nil then
file = io.stdin
else
local err
file, err = io.open(filename, "rb")
if file == nil then
error(("Unable to read '%s': %s"):format(filename, err))
end
end
local data = file:read("*a")
if filename ~= nil then
file:close()
end
if data == nil then
error("Failed to read " .. filename)
end
return data
end
local function file_save(filename, data)
local file
if filename == nil then
file = io.stdout
else
local err
file, err = io.open(filename, "wb")
if file == nil then
error(("Unable to write '%s': %s"):format(filename, err))
end
end
file:write(data)
if filename ~= nil then
file:close()
end
end
local function compare_values(val1, val2)
local type1 = type(val1)
local type2 = type(val2)
if type1 ~= type2 then
return false
end
-- Check for NaN
if type1 == "number" and val1 ~= val1 and val2 ~= val2 then
return true
end
if type1 ~= "table" then
return val1 == val2
end
-- check_keys stores all the keys that must be checked in val2
local check_keys = {}
for k, _ in pairs(val1) do
check_keys[k] = true
end
for k, v in pairs(val2) do
if not check_keys[k] then
return false
end
if not compare_values(val1[k], val2[k]) then
return false
end
check_keys[k] = nil
end
for k, _ in pairs(check_keys) do
-- Not the same if any keys from val1 were not found in val2
return false
end
return true
end
local test_count_pass = 0
local test_count_total = 0
local function run_test_summary()
return test_count_pass, test_count_total
end
local function run_test(testname, func, input, should_work, output)
local function status_line(name, status, value)
local statusmap = { [true] = ":success", [false] = ":error" }
if status ~= nil then
name = name .. statusmap[status]
end
print(("[%s] %s"):format(name, serialise_value(value, false)))
end
local result = { pcall(func, unpack(input)) }
local success = table.remove(result, 1)
local correct = false
if success == should_work and compare_values(result, output) then
correct = true
test_count_pass = test_count_pass + 1
end
test_count_total = test_count_total + 1
local teststatus = { [true] = "PASS", [false] = "FAIL" }
print(("==> Test [%d] %s: %s"):format(test_count_total, testname,
teststatus[correct]))
status_line("Input", nil, input)
if not correct then
status_line("Expected", should_work, output)
end
status_line("Received", success, result)
print()
return correct, result
end
local function run_test_group(tests)
local function run_helper(name, func, input)
if type(name) == "string" and #name > 0 then
print("==> " .. name)
end
-- Not a protected call, these functions should never generate errors.
func(unpack(input or {}))
print()
end
for _, v in ipairs(tests) do
-- Run the helper if "should_work" is missing
if v[4] == nil then
run_helper(unpack(v))
else
run_test(unpack(v))
end
end
end
-- Run a Lua script in a separate environment
local function run_script(script, env)
local env = env or {}
local func
-- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists
if _G.setfenv then
func = loadstring(script)
if func then
setfenv(func, env)
end
else
func = load(script, nil, nil, env)
end
if func == nil then
error("Invalid syntax.")
end
func()
return env
end
-- Export functions
return {
serialise_value = serialise_value,
file_load = file_load,
file_save = file_save,
compare_values = compare_values,
run_test_summary = run_test_summary,
run_test = run_test,
run_test_group = run_test_group,
run_script = run_script
}
-- vi:ai et sw=4 ts=4:
| gpl-2.0 |
coinapi/coinapi-sdk | ems-gateway-rest-sdk/lua/spec/order_cancel_single_request_spec.lua | 2 | 4179 | --[[
EMS - REST API
This section will provide necessary information about the `CoinAPI EMS REST API` protocol. <br/> This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> <br/><br/> Implemented Standards: * [HTTP1.0](https://datatracker.ietf.org/doc/html/rfc1945) * [HTTP1.1](https://datatracker.ietf.org/doc/html/rfc2616) * [HTTP2.0](https://datatracker.ietf.org/doc/html/rfc7540) ### Endpoints <table> <thead> <tr> <th>Deployment method</th> <th>Environment</th> <th>Url</th> </tr> </thead> <tbody> <tr> <td>Managed Cloud</td> <td>Production</td> <td>Use <a href=\"#ems-docs-sh\">Managed Cloud REST API /v1/locations</a> to get specific endpoints to each server site where your deployments span</td> </tr> <tr> <td>Managed Cloud</td> <td>Sandbox</td> <td><code>https://ems-gateway-aws-eu-central-1-dev.coinapi.io/</code></td> </tr> <tr> <td>Self Hosted</td> <td>Production</td> <td>IP Address of the <code>ems-gateway</code> container/excecutable in the closest server site to the caller location</td> </tr> <tr> <td>Self Hosted</td> <td>Sandbox</td> <td>IP Address of the <code>ems-gateway</code> container/excecutable in the closest server site to the caller location</td> </tr> </tbody> </table> ### Authentication If the software is deployed as `Self-Hosted` then API do not require authentication as inside your infrastructure, your company is responsible for the security and access controls. <br/><br/> If the software is deployed in our `Managed Cloud`, there are 2 methods for authenticating with us, you only need to use one: 1. Custom authorization header named `X-CoinAPI-Key` with the API Key 2. Query string parameter named `apikey` with the API Key 3. <a href=\"#certificate\">TLS Client Certificate</a> from the `Managed Cloud REST API` (/v1/certificate/pem endpoint) while establishing a TLS session with us. #### Custom authorization header You can authorize by providing additional custom header named `X-CoinAPI-Key` and API key as its value. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY`, then the authorization header you should send to us will look like: <br/><br/> `X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY` <aside class=\"success\">This method is recommended by us and you should use it in production environments.</aside> #### Query string authorization parameter You can authorize by providing an additional parameter named `apikey` with a value equal to your API key in the query string of your HTTP request. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY` and that you want to request all balances, then your query string should look like this: <br/><br/> `GET /v1/balances?apikey=73034021-THIS-IS-SAMPLE-KEY` <aside class=\"notice\">Query string method may be more practical for development activities.</aside>
The version of the OpenAPI document: v1
Contact: support@coinapi.io
Generated by: https://openapi-generator.tech
]]
--[[
Unit tests for openapiclient.model.order_cancel_single_request
Automatically generated by openapi-generator (https://openapi-generator.tech)
Please update as you see appropriate
]]
describe("order_cancel_single_request", function()
local openapiclient_order_cancel_single_request = require "openapiclient.model.order_cancel_single_request"
-- unit tests for the property 'exchange_id'
describe("property exchange_id test", function()
it("should work", function()
-- TODO assertion here: http://olivinelabs.com/busted/#asserts
end)
end)
-- unit tests for the property 'exchange_order_id'
describe("property exchange_order_id test", function()
it("should work", function()
-- TODO assertion here: http://olivinelabs.com/busted/#asserts
end)
end)
-- unit tests for the property 'client_order_id'
describe("property client_order_id test", function()
it("should work", function()
-- TODO assertion here: http://olivinelabs.com/busted/#asserts
end)
end)
end)
| mit |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_dathomir_nightsister_outcast.lua | 3 | 2260 | --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_dathomir_nightsister_outcast = object_mobile_shared_dressed_dathomir_nightsister_outcast:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_dathomir_nightsister_outcast, "object/mobile/dressed_dathomir_nightsister_outcast.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/chemistry/antidote_sm_s1.lua | 3 | 2248 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_chemistry_antidote_sm_s1 = object_draft_schematic_chemistry_shared_antidote_sm_s1:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_chemistry_antidote_sm_s1, "object/draft_schematic/chemistry/antidote_sm_s1.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/townsperson/artisan.lua | 1 | 1073 | artisan = Creature:new {
objectName = "@mob/creature_names:artisan",
generateRandomName =true,
socialGroup = "townsperson",
pvpFaction = "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 = NONE,
creatureBitmask = NONE,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_artisan_trainer_03.iff",
"object/mobile/dressed_artisan_trainer_02.iff",
"object/mobile/dressed_artisan_trainer_01.iff",
"object/mobile/dressed_commoner_artisan_trandoshan_male_01.iff",
"object/mobile/dressed_commoner_artisan_sullustan_male_01.iff",
"object/mobile/dressed_commoner_artisan_bith_male_01.iff"
},
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
}
}
CreatureTemplates:addCreatureTemplate(artisan, "artisan")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/skeleton/insect_basic.lua | 3 | 2200 | --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_skeleton_insect_basic = object_mobile_skeleton_shared_insect_basic:new {
}
ObjectTemplates:addTemplate(object_mobile_skeleton_insect_basic, "object/mobile/skeleton/insect_basic.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/commands/deathBlow.lua | 4 | 2120 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
--true = 1, false = 0
DeathBlowCommand = {
name = "deathblow",
}
AddCommand(DeathBlowCommand)
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/poi/hq/rebel_sm.lua | 3 | 2184 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_building_poi_hq_rebel_sm = object_building_poi_hq_shared_rebel_sm:new {
}
ObjectTemplates:addTemplate(object_building_poi_hq_rebel_sm, "object/building/poi/hq/rebel_sm.iff")
| lgpl-3.0 |
virgo-agent-toolkit/luvi | samples/winsvc.app/main.lua | 6 | 9119 | --[[
Copyright 2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local table = require('table')
local winsvc = require('winsvc')
local winsvcaux = require('winsvcaux')
local uv = require('uv')
local svcname = 'Test Lua Service'
local gSvcStatus = {}
local gSvcStatusHandle
local gRunning = true
local function ReportSvcStatus(dwCurrentState, dwWin32ExitCode, dwWaitHint)
local dwCheckPoint = 1
-- Fill in the SERVICE_STATUS structure.
gSvcStatus.dwCurrentState = dwCurrentState
gSvcStatus.dwWin32ExitCode = dwWin32ExitCode
gSvcStatus.dwWaitHint = dwWaitHint
if dwCurrentState == winsvc.SERVICE_START_PENDING then
gSvcStatus.dwControlsAccepted = 0
else
gSvcStatus.dwControlsAccepted = winsvc.SERVICE_ACCEPT_STOP
end
if dwCurrentState == winsvc.SERVICE_RUNNING or
dwCurrentState == winsvc.SERVICE_STOPPED then
gSvcStatus.dwCheckPoint = 0
else
dwCheckPoint = dwCheckPoint + 1
gSvcStatus.dwCheckPoint = dwCheckPoint
end
-- Report the status of the service to the SCM.
winsvc.SetServiceStatus(gSvcStatusHandle, gSvcStatus)
end
local function SvcHandler(dwControl, dwEventType, lpEventData, lpContext)
-- Handle the requested control code.
if dwControl == winsvc.SERVICE_CONTROL_STOP then
ReportSvcStatus(winsvc.SERVICE_STOP_PENDING, winsvc.NO_ERROR, 0)
-- Signal the service to stop.
gRunning = false
ReportSvcStatus(gSvcStatus.dwCurrentState, winsvc.NO_ERROR, 0)
return winsvc.NO_ERROR
elseif dwControl == winsvc.SERVICE_CONTROL_INTERROGATE then
return winsvc.NO_ERROR
else
return winsvc.ERROR_CALL_NOT_IMPLEMENTED
end
end
local function SvcReportEvent(...)
-- Log that somewhere
local args = {...}
local s
if type(args) == 'string' then
s = args
else
s = table.concat(args, ' ')
end
print(s)
s = s .. '\n'
-- synchronous file i/o for the logging so it can work even outside the event loop
local fd, err = uv.fs_open('logfile.txt', 'a', tonumber('644', 8))
if not err then
uv.fs_write(fd, s, -1)
uv.fs_close(fd)
end
end
local function SvcInit(args, context)
-- TO_DO: Declare and set any required variables.
-- Be sure to periodically call ReportSvcStatus() with
-- SERVICE_START_PENDING. If initialization fails, call
-- ReportSvcStatus with SERVICE_STOPPED.
-- Create an event. The control handler function, SvcCtrlHandler,
-- signals this event when it receives the stop control code.
ReportSvcStatus(winsvc.SERVICE_RUNNING, winsvc.NO_ERROR, 0)
-- TO_DO: Setup Serive Work To Be done
local timer = uv.new_timer()
uv.timer_start(timer, 0, 2000, function()
if gRunning then
SvcReportEvent('Just waiting...')
uv.timer_again(timer)
else
uv.timer_stop(timer)
uv.close(timer)
ReportSvcStatus(winsvc.SERVICE_STOPPED, winsvc.NO_ERROR, 0);
winsvc.EndService(context)
end
end)
end
local function SvcMain(args, context)
gSvcStatusHandle = winsvc.GetStatusHandleFromContext(context)
-- These SERVICE_STATUS members remain as set here
gSvcStatus.dwServiceType = winsvc.SERVICE_WIN32_OWN_PROCESS
gSvcStatus.dwServiceSpecificExitCode = 0
-- Report initial status to the SCM
ReportSvcStatus(winsvc.SERVICE_START_PENDING, winsvc.NO_ERROR, 3000)
-- Perform service-specific initialization and work.
SvcInit(args, context)
end
local function SvcInstall()
local svcPath, err = winsvcaux.GetModuleFileName()
if svcPath == nil then
SvcReportEvent('Cannot install service, service path unobtainable', winsvcaux.GetErrorString(err))
return
end
-- Get a handle to the SCM database
local schSCManager, err = winsvc.OpenSCManager(nil, nil, winsvc.SC_MANAGER_ALL_ACCESS)
if schSCManager == nil then
SvcReportEvent('OpenSCManager failed', winsvcaux.GetErrorString(err))
return
end
-- Create the Service
local schService, tagid, err = winsvc.CreateService(
schSCManager,
svcname,
svcname,
winsvc.SERVICE_ALL_ACCESS,
winsvc.SERVICE_WIN32_OWN_PROCESS,
winsvc.SERVICE_DEMAND_START,
winsvc.SERVICE_ERROR_NORMAL,
svcPath,
nil,
nil,
nil,
nil)
if schService == nil then
SvcReportEvent('CreateService failed', winsvcaux.GetErrorString(err))
winsvc.CloseServiceHandle(schSCManager)
return
end
-- Describe the service
winsvc.ChangeServiceConfig2(schService, winsvc.SERVICE_CONFIG_DESCRIPTION, {lpDescription = "This is a test service written in Luvi/Lua"})
-- Set the service to restart on failure in 15 seconds
winsvc.ChangeServiceConfig2(schService, winsvc.SERVICE_CONFIG_FAILURE_ACTIONS,
{dwResetPeriod = 0, lpsaActions = {
{Delay = 15000, Type = winsvc.SC_ACTION_RESTART}
}})
SvcReportEvent('Service installed successfully')
winsvc.CloseServiceHandle(schService)
winsvc.CloseServiceHandle(schSCManager)
end
local function SvcDelete()
-- Get a handle to the SCM database
local schSCManager, err = winsvc.OpenSCManager(nil, nil, winsvc.SC_MANAGER_ALL_ACCESS)
if schSCManager == nil then
SvcReportEvent('OpenSCManager failed', winsvcaux.GetErrorString(err))
return
end
-- Open the Service
local schService, err = winsvc.OpenService(
schSCManager,
svcname,
winsvc.DELETE)
if schService == nil then
SvcReportEvent('OpenService failed', winsvcaux.GetErrorString(err))
winsvc.CloseServiceHandle(schSCManager)
return
end
local delsuccess, err = winsvc.DeleteService(schService)
if not delsuccess then
SvcReportEvent('DeleteService failed', winsvcaux.GetErrorString(err))
else
SvcReportEvent('DeleteService succeeded')
end
winsvc.CloseServiceHandle(schService)
winsvc.CloseServiceHandle(schSCManager)
end
local function SvcStart()
-- Get a handle to the SCM database
local schSCManager, err = winsvc.OpenSCManager(nil, nil, winsvc.SC_MANAGER_ALL_ACCESS)
if schSCManager == nil then
SvcReportEvent('OpenSCManager failed', winsvcaux.GetErrorString(err))
return
end
-- Open the Service
local schService, err = winsvc.OpenService(
schSCManager,
svcname,
winsvc.SERVICE_START)
if schService == nil then
SvcReportEvent('OpenService failed', winsvcaux.GetErrorString(err))
winsvc.CloseServiceHandle(schSCManager)
return
end
local startsuccess, err = winsvc.StartService(schService, nil)
if not startsuccess then
SvcReportEvent('StartService failed', winsvcaux.GetErrorString(err))
else
SvcReportEvent('StartService succeeded')
end
winsvc.CloseServiceHandle(schService)
winsvc.CloseServiceHandle(schSCManager)
end
local function SvcStop()
-- Get a handle to the SCM database
local schSCManager, err = winsvc.OpenSCManager(nil, nil, winsvc.SC_MANAGER_ALL_ACCESS)
if schSCManager == nil then
SvcReportEvent('OpenSCManager failed', winsvcaux.GetErrorString(err))
return
end
-- Open the Service
local schService, err = winsvc.OpenService(
schSCManager,
svcname,
winsvc.SERVICE_STOP)
if schService == nil then
SvcReportEvent('OpenService failed', winsvcaux.GetErrorString(err))
winsvc.CloseServiceHandle(schSCManager)
return
end
-- Stop the Service
local success, status, err = winsvc.ControlService(schService, winsvc.SERVICE_CONTROL_STOP, nil)
if not success then
SvcReportEvent('ControlService stop failed', winsvcaux.GetErrorString(err))
else
local i, v, fstatus
fstatus = {}
for i, v in pairs(status) do
table.insert(fstatus, i .. ': ' .. v)
end
SvcReportEvent('ControlService stop succeeded, status:', table.concat(fstatus, ', '))
end
winsvc.CloseServiceHandle(schService)
winsvc.CloseServiceHandle(schSCManager)
end
-- Main Code
if args[1] == 'install' then
SvcInstall()
return
elseif args[1] == 'delete' then
SvcDelete()
return
elseif args[1] == 'start' then
SvcStart()
return
elseif args[1] == 'stop' then
SvcStop()
return
end
local DispatchTable = {}
DispatchTable[svcname] = { SvcMain, SvcHandler };
local ret, err = winsvc.SpawnServiceCtrlDispatcher(DispatchTable, function(success, err)
if success then
SvcReportEvent('Service Control Dispatcher returned after threads exited ok')
else
SvcReportEvent('Service Control Dispatcher returned with err', winsvcaux.GetErrorString(err))
end
end, function(err)
SvcReportEvent('A Service function returned with err', err)
end)
if ret then
SvcReportEvent('SpawnServiceCtrlDispatcher Succeeded')
else
SvcReportEvent('SpawnServiceCtrlDispatcher Failed', winsvcaux.GetErrorString(err))
end
uv.run('default')
| apache-2.0 |
eraffxi/darkstar | scripts/globals/items/dish_of_spaghetti_tonno_rosso_+1.lua | 2 | 1258 | -----------------------------------------
-- ID: 5624
-- Item: Dish of Spaghetti Tonno Rosso +1
-- Food Effect: 60 Mins, All Races
-----------------------------------------
-- Health % 13
-- Health Cap 185
-- Dexterity 2
-- Vitality 3
-- Store TP +6
-- hMP +1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(dsp.effect.FOOD) == true or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
function onItemUse(target)
target:addStatusEffect(dsp.effect.FOOD,0,0,7200,5624);
end;
function onEffectGain(target, effect)
target:addMod(dsp.mod.FOOD_HPP, 13);
target:addMod(dsp.mod.FOOD_HP_CAP, 185);
target:addMod(dsp.mod.DEX, 2);
target:addMod(dsp.mod.VIT, 3);
target:addMod(dsp.mod.STORETP, 6);
target:addMod(dsp.mod.HPHEAL, 1);
end;
function onEffectLose(target, effect)
target:delMod(dsp.mod.FOOD_HPP, 13);
target:delMod(dsp.mod.FOOD_HP_CAP, 185);
target:delMod(dsp.mod.DEX, 2);
target:delMod(dsp.mod.VIT, 3);
target:delMod(dsp.mod.STORETP, 6);
target:delMod(dsp.mod.HPHEAL, 1);
end;
| gpl-3.0 |
shentok/chdk-a430 | CHDK/SCRIPTS/examples/input_1.lua | 9 | 2958 | --[[
@title char input
@param f key delay
@default f 200
]]
key_delay = f
output=""
function button()
local x = 0
repeat
wait_click(key_delay)
if is_pressed "remote" then
key = "REMOTE"
x = 1
end
if is_pressed "set" then
key = "SET"
x = 1
end
if is_pressed "erase" then
key = "ERASE"
x = 1
end
if is_pressed "display" then
key = "DISP."
x = 1
end
if is_pressed "menu" then
key = "MENU"
x = 1
end
if is_pressed "up" then
key = "UP"
x = 1
end
if is_pressed "down" then
key = "DOWN"
x = 1
end
if is_pressed "left" then
key = "LEFT"
x = 1
end
if is_pressed "right" then
key = "RIGHT"
x = 1
end
if is_pressed "zoom_in" then
key = "ZOOM_IN"
x = 1
end
if is_pressed "zoom_out" then
key = "ZOOM_OUT"
x = 1
end
until x == 1
set_led (8,1)
sleep (10)
set_led (8,0)
end
function tabToStr()
output=table.concat(word)
end
function input()
abc_lower = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
"q","r","s","t","u","v","w","x","y","z"}
abc_upper = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P",
"Q","R","S","T","U","V","W","X","Y","Z"}
abc_spec = {"0","1","2","3","4","5","6","7","8","9",",",".","-",";",":","_",
"/",".JPG",".CRW",".CR2",".THM",".WAV",".LUA",".BAS",".TXT"," "}
word = {}
a=0
b=0
actChar=""
repeat
print("[<-][->][SET] [+/-][MENU]")
print("[ZOOM in/out] [UP][DOWN]")
button()
cls()
if key == "RIGHT" then a=a+1 end
if key == "LEFT" then a=a-1 end
if key == "UP" then b=b+1 end
if key == "DOWN" then a=1 end
if key == "ZOOM_IN" then a=a+5 end
if key == "ZOOM_OUT" then a=a-5 end
if a >= 27 then a=1 end
if a <= 0 then a=26 end
if b>=3 then b=0 end
if b==0 then
actChar=abc_lower[a]
char_info="lower case"
end
if b==1 then
actChar=abc_upper[a]
char_info="upper case"
end
if b==2 then
actChar=abc_spec[a]
char_info="special char"
end
print(char_info..": "..actChar)
if key == "SET" then table.insert(word,actChar) end
if key == "ERASE" then table.remove(word) end
tabToStr()
print("input: "..output)
print (" ")
until key == "MENU"
end
function make_dir(dirname)
os.mkdir(dirname)
end
x=0
repeat
input()
cls()
print("INPUT: "..output)
print("[SET] new input")
print("[DISP] make dir and stop")
print("[MENU] stop")
button()
if key == "SET" then cls() end
if key == "DISP." then
dir = "A/"..output
make_dir(dir)
print "ready"
sleep(3000)
x=1
end
if key == "MENU" then
print "ready"
sleep(3000)
x=1
end
until x==1
--[[
***possible commands***
function make_dir(dirname)
os.mkdir(dirname)
end
function delete_dir(dirname)
os.remove(dirname)
end
function rename_file(old_filename, new_filename)
os.rename(old_filename, new_filename)
end
function delete_file(filename)
os.remove(filename)
end
***missing commands***
-os.list_dir
]]
| gpl-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/component/droid/surgical_droid_chassis.lua | 3 | 3272 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_component_droid_surgical_droid_chassis = object_tangible_component_droid_shared_surgical_droid_chassis:new {
numberExperimentalProperties = {1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "OQ", "SR", "UT", "XX", "XX", "XX", "OQ", "SR", "UT", "OQ", "XX", "XX", "XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "exp_durability", "null", "null", "null", "exp_quality", "exp_effectiveness", "null", "null", "null", "null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "decayrate", "armoreffectiveness", "armorintegrity", "armorencumbrance", "mechanism_quality", "power_level", "storage_module", "data_module", "personality_module", "medical_module", "repair_module", "armor_module"},
experimentalMin = {0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalMax = {0, 0, 15, 0, 0, 0, 100, 50, 0, 0, 0, 0, 0, 0},
experimentalPrecision = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_component_droid_surgical_droid_chassis, "object/tangible/component/droid/surgical_droid_chassis.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/staff/skills/serverobjects.lua | 1 | 3102 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
--true = 1, false = 0
includeFile("skills/admin_base.lua")
includeFile("skills/admin_debug_01.lua")
includeFile("skills/admin_debug_02.lua")
includeFile("skills/admin_debug_03.lua")
includeFile("skills/admin_general_admin_01.lua")
includeFile("skills/admin_general_admin_02.lua")
includeFile("skills/admin_general_admin_03.lua")
includeFile("skills/admin_inventory_management_01.lua")
includeFile("skills/admin_jedi_management_01.lua")
includeFile("skills/admin_player_management_01.lua")
includeFile("skills/admin_player_management_02.lua")
includeFile("skills/admin_player_management_03.lua")
includeFile("skills/admin_quest_management_01.lua")
includeFile("skills/admin_server_admin_01.lua")
includeFile("skills/admin_server_admin_02.lua")
includeFile("skills/admin_server_admin_03.lua")
includeFile("skills/admin_skill_management_01.lua")
includeFile("skills/admin_spawn_management_01.lua")
includeFile("skills/admin_spawn_management_02.lua")
includeFile("skills/admin_veteran_rewards_01.lua")
includeFile("skills/admin_internship.lua")
includeFile("skills/admin_ecinternship.lua")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/space_chassis_broker_01.lua | 2 | 2271 | --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_chassis_broker_01 = object_mobile_shared_space_chassis_broker_01:new {
--objectMenuComponent = {"cpp", "ChassisBrokerMenuComponent"},
}
ObjectTemplates:addTemplate(object_mobile_space_chassis_broker_01, "object/mobile/space_chassis_broker_01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/clothing/clothing_armor_zam_boots.lua | 2 | 3789 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_clothing_clothing_armor_zam_boots = object_draft_schematic_clothing_shared_clothing_armor_zam_boots:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Mabari Armorweave Boots",
craftingToolTab = 2, -- (See DraftSchemticImplementation.h)
complexity = 20,
size = 4,
xpType = "crafting_clothing_armor",
xp = 120,
assemblySkill = "armor_assembly",
experimentingSkill = "armor_experimentation",
customizationSkill = "armor_customization",
customizationOptions = {2, 1},
customizationStringNames = {"/private/index_color_1", "/private/index_color_2"},
customizationDefaults = {20, 29},
ingredientTemplateNames = {"craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n"},
ingredientTitleNames = {"auxilary_coverage", "body", "liner", "hardware_and_attachments", "binding_and_reinforcement", "padding", "armor", "load_bearing_harness"},
ingredientSlotType = {0, 0, 0, 0, 0, 0, 1, 1},
resourceTypes = {"metal", "hide", "fiberplast", "metal", "petrochem_inert", "fiberplast", "object/tangible/component/armor/shared_armor_segment_zam.iff", "object/tangible/component/clothing/shared_synthetic_cloth.iff"},
resourceQuantities = {15, 15, 15, 15, 6, 10, 1, 1},
contribution = {100, 100, 100, 100, 100, 100, 100, 100},
targetTemplate = "object/tangible/wearables/armor/zam/armor_zam_wesell_boots.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_clothing_clothing_armor_zam_boots, "object/draft_schematic/clothing/clothing_armor_zam_boots.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/faction/rebel/crackdown_rebel_liberator.lua | 1 | 1429 | crackdown_rebel_liberator = Creature:new {
objectName = "@mob/creature_names:crackdown_rebel_liberator",
socialGroup = "rebel",
pvpFaction = "rebel",
faction = "rebel",
level = 1,
chanceHit = 0.36,
damageMin = 240,
damageMax = 250,
baseXp = 45,
baseHAM = 7200,
baseHAMmax = 8800,
armor = 0,
resists = {0,0,40,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 = 128,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_rebel_trooper_twk_female_01.iff"
},
lootGroups = {
{
groups = {
{group = "color_crystals", chance = 100000},
{group = "junk", chance = 4700000},
{group = "rifles", chance = 1000000},
{group = "pistols", chance = 1000000},
{group = "melee_weapons", chance = 1000000},
{group = "carbines", chance = 1000000},
{group = "clothing_attachments", chance = 100000},
{group = "armor_attachments", chance = 100000},
{group = "wearables_common", chance = 1000000}
},
lootChance = 3000000
}
},
weapons = {"rebel_weapons_heavy"},
conversationTemplate = "",
attacks = merge(riflemanmaster,pistoleermaster,carbineermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(crackdown_rebel_liberator, "crackdown_rebel_liberator") | lgpl-3.0 |
virgo-agent-toolkit/luvi | samples/test.app/utils.lua | 11 | 9569 | --[[
Copyright 2014-2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
--[[lit-meta
name = "luvit/pretty-print"
version = "2.0.0"
homepage = "https://github.com/luvit/luvit/blob/master/deps/pretty-print.lua"
description = "A lua value pretty printer and colorizer for terminals."
tags = {"colors", "tty"}
license = "Apache 2"
author = { name = "Tim Caswell" }
]]
local success, uv = pcall(require, 'uv')
if not success then
success, uv = pcall(require, 'luv')
end
assert(success, uv)
local getenv = require('os').getenv
local prettyPrint, dump, strip, color, colorize, loadColors
local theme = {}
local useColors = false
local defaultTheme
local stdout, stdin, stderr, width
local quote, quote2, dquote, dquote2, obracket, cbracket, obrace, cbrace, comma, equals, controls
local themes = {
-- nice color theme using 16 ansi colors
[16] = {
property = "0;37", -- white
sep = "1;30", -- bright-black
braces = "1;30", -- bright-black
["nil"] = "1;30", -- bright-black
boolean = "0;33", -- yellow
number = "1;33", -- bright-yellow
string = "0;32", -- green
quotes = "1;32", -- bright-green
escape = "1;32", -- bright-green
["function"] = "0;35", -- purple
thread = "1;35", -- bright-purple
table = "1;34", -- bright blue
userdata = "1;36", -- bright cyan
cdata = "0;36", -- cyan
err = "1;31", -- bright red
success = "1;33;42", -- bright-yellow on green
failure = "1;33;41", -- bright-yellow on red
highlight = "1;36;44", -- bright-cyan on blue
},
-- nice color theme using ansi 256-mode colors
[256] = {
property = "38;5;253",
braces = "38;5;247",
sep = "38;5;240",
["nil"] = "38;5;244",
boolean = "38;5;220", -- yellow-orange
number = "38;5;202", -- orange
string = "38;5;34", -- darker green
quotes = "38;5;40", -- green
escape = "38;5;46", -- bright green
["function"] = "38;5;129", -- purple
thread = "38;5;199", -- pink
table = "38;5;27", -- blue
userdata = "38;5;39", -- blue2
cdata = "38;5;69", -- teal
err = "38;5;196", -- bright red
success = "38;5;120;48;5;22", -- bright green on dark green
failure = "38;5;215;48;5;52", -- bright red on dark red
highlight = "38;5;45;48;5;236", -- bright teal on dark grey
},
}
local special = {
[7] = 'a',
[8] = 'b',
[9] = 't',
[10] = 'n',
[11] = 'v',
[12] = 'f',
[13] = 'r'
}
function strip(str)
return string.gsub(str, '\027%[[^m]*m', '')
end
function loadColors(index)
if index == nil then index = defaultTheme end
-- Remove the old theme
for key in pairs(theme) do
theme[key] = nil
end
if index then
local new = themes[index]
if not new then error("Invalid theme index: " .. tostring(index)) end
-- Add the new theme
for key in pairs(new) do
theme[key] = new[key]
end
useColors = true
else
useColors = false
end
quote = colorize('quotes', "'", 'string')
quote2 = colorize('quotes', "'")
dquote = colorize('quotes', '"', 'string')
dquote2 = colorize('quotes', '"')
obrace = colorize('braces', '{ ')
cbrace = colorize('braces', '}')
obracket = colorize('property', '[')
cbracket = colorize('property', ']')
comma = colorize('sep', ', ')
equals = colorize('sep', ' = ')
controls = {}
for i = 0, 31 do
local c = special[i]
if not c then
if i < 10 then
c = "00" .. tostring(i)
else
c = "0" .. tostring(i)
end
end
controls[i] = colorize('escape', '\\' .. c, 'string')
end
controls[92] = colorize('escape', '\\\\', 'string')
controls[34] = colorize('escape', '\\"', 'string')
controls[39] = colorize('escape', "\\'", 'string')
for i = 128, 255 do
local c
if i < 100 then
c = "0" .. tostring(i)
else
c = tostring(i)
end
controls[i] = colorize('escape', '\\' .. c, 'string')
end
end
function color(colorName)
return '\27[' .. (theme[colorName] or '0') .. 'm'
end
function colorize(colorName, string, resetName)
return useColors and
(color(colorName) .. tostring(string) .. color(resetName)) or
tostring(string)
end
local function stringEscape(c)
return controls[string.byte(c, 1)]
end
function dump(value, recurse, nocolor)
local seen = {}
local output = {}
local offset = 0
local stack = {}
local function recalcOffset(index)
for i = index + 1, #output do
local m = string.match(output[i], "\n([^\n]*)$")
if m then
offset = #(strip(m))
else
offset = offset + #(strip(output[i]))
end
end
end
local function write(text, length)
if not length then length = #(strip(text)) end
-- Create room for data by opening parent blocks
-- Start at the root and go down.
local i = 1
while offset + length > width and stack[i] do
local entry = stack[i]
if not entry.opened then
entry.opened = true
table.insert(output, entry.index + 1, "\n" .. string.rep(" ", i))
-- Recalculate the offset
recalcOffset(entry.index)
-- Bump the index of all deeper entries
for j = i + 1, #stack do
stack[j].index = stack[j].index + 1
end
end
i = i + 1
end
output[#output + 1] = text
offset = offset + length
if offset > width then
return dump(stack)
end
end
local function indent()
stack[#stack + 1] = {
index = #output,
opened = false,
}
end
local function unindent()
stack[#stack] = nil
end
local function process(localValue)
local typ = type(localValue)
if typ == 'string' then
if string.match(localValue, "'") and not string.match(localValue, '"') then
write(dquote .. string.gsub(localValue, '[%c\\\128-\255]', stringEscape) .. dquote2)
else
write(quote .. string.gsub(localValue, "[%c\\'\128-\255]", stringEscape) .. quote2)
end
elseif typ == 'table' and not seen[localValue] then
if not recurse then seen[localValue] = true end
write(obrace)
local i = 1
-- Count the number of keys so we know when to stop adding commas
local total = 0
for _ in pairs(localValue) do total = total + 1 end
local nextIndex = 1
for k, v in pairs(localValue) do
indent()
if k == nextIndex then
-- if the key matches the last numerical index + 1
-- This is how lists print without keys
nextIndex = k + 1
process(v)
else
if type(k) == "string" and string.find(k,"^[%a_][%a%d_]*$") then
write(colorize("property", k) .. equals)
else
write(obracket)
process(k)
write(cbracket .. equals)
end
if type(v) == "table" then
process(v)
else
indent()
process(v)
unindent()
end
end
if i < total then
write(comma)
else
write(" ")
end
i = i + 1
unindent()
end
write(cbrace)
else
write(colorize(typ, tostring(localValue)))
end
end
process(value)
local s = table.concat(output, "")
return nocolor and strip(s) or s
end
-- Print replacement that goes through libuv. This is useful on windows
-- to use libuv's code to translate ansi escape codes to windows API calls.
function _G.print(...)
local n = select('#', ...)
local arguments = {...}
for i = 1, n do
arguments[i] = tostring(arguments[i])
end
uv.write(stdout, table.concat(arguments, "\t") .. "\n")
end
function prettyPrint(...)
local n = select('#', ...)
local arguments = { ... }
for i = 1, n do
arguments[i] = dump(arguments[i])
end
print(table.concat(arguments, "\t"))
end
function strip(str)
return string.gsub(str, '\027%[[^m]*m', '')
end
if uv.guess_handle(0) == 'tty' then
stdin = assert(uv.new_tty(0, true))
else
stdin = uv.new_pipe(false)
uv.pipe_open(stdin, 0)
end
if uv.guess_handle(1) == 'tty' then
stdout = assert(uv.new_tty(1, false))
width = uv.tty_get_winsize(stdout)
if width == 0 then width = 80 end
-- auto-detect when 16 color mode should be used
local term = getenv("TERM")
if term and (term == 'xterm' or term:match'-256color$') then
defaultTheme = 256
else
defaultTheme = 16
end
else
stdout = uv.new_pipe(false)
uv.pipe_open(stdout, 1)
width = 80
end
loadColors()
if uv.guess_handle(2) == 'tty' then
stderr = assert(uv.new_tty(2, false))
else
stderr = uv.new_pipe(false)
uv.pipe_open(stderr, 2)
end
return {
loadColors = loadColors,
theme = theme,
print = print,
prettyPrint = prettyPrint,
dump = dump,
color = color,
colorize = colorize,
stdin = stdin,
stdout = stdout,
stderr = stderr,
strip = strip,
}
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/component/vehicle/blaster_cannon.lua | 3 | 2252 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_component_vehicle_blaster_cannon = object_tangible_component_vehicle_shared_blaster_cannon:new {
}
ObjectTemplates:addTemplate(object_tangible_component_vehicle_blaster_cannon, "object/tangible/component/vehicle/blaster_cannon.iff")
| lgpl-3.0 |
gunchleoc/wesnoth | data/ai/micro_ais/cas/ca_return_guardian.lua | 4 | 1133 | local H = wesnoth.require "lua/helper.lua"
local AH = wesnoth.require "ai/lua/ai_helper.lua"
local function get_guardian(cfg)
local filter = H.get_child(cfg, "filter") or { id = cfg.id }
local guardian = AH.get_units_with_moves {
side = wesnoth.current.side,
{ "and", filter }
}[1]
return guardian
end
local ca_return_guardian = {}
function ca_return_guardian:evaluation(cfg)
local guardian = get_guardian(cfg)
if guardian then
if (guardian.x == cfg.return_x) and (guardian.y == cfg.return_y) then
return cfg.ca_score - 200
else
return cfg.ca_score
end
end
return 0
end
function ca_return_guardian:execution(cfg)
local guardian = get_guardian(cfg)
-- In case the return hex is occupied:
local x, y = cfg.return_x, cfg.return_y
if (guardian.x ~= x) or (guardian.y ~= y) then
x, y = wesnoth.find_vacant_tile(x, y, guardian)
end
local nh = AH.next_hop(guardian, x, y)
if (not nh) then nh = { guardian.x, guardian.y } end
AH.movefull_stopunit(ai, guardian, nh)
end
return ca_return_guardian
| gpl-2.0 |
houqp/koreader | frontend/ui/widget/datewidget.lua | 4 | 6712 | local Blitbuffer = require("ffi/blitbuffer")
local ButtonTable = require("ui/widget/buttontable")
local CenterContainer = require("ui/widget/container/centercontainer")
local CloseButton = require("ui/widget/closebutton")
local Device = require("device")
local FrameContainer = require("ui/widget/container/framecontainer")
local Geom = require("ui/geometry")
local GestureRange = require("ui/gesturerange")
local Font = require("ui/font")
local HorizontalGroup = require("ui/widget/horizontalgroup")
local InputContainer = require("ui/widget/container/inputcontainer")
local LineWidget = require("ui/widget/linewidget")
local OverlapGroup = require("ui/widget/overlapgroup")
local NumberPickerWidget = require("ui/widget/numberpickerwidget")
local Size = require("ui/size")
local TextBoxWidget = require("ui/widget/textboxwidget")
local TextWidget = require("ui/widget/textwidget")
local UIManager = require("ui/uimanager")
local VerticalGroup = require("ui/widget/verticalgroup")
local WidgetContainer = require("ui/widget/container/widgetcontainer")
local _ = require("gettext")
local Screen = Device.screen
local DateWidget = InputContainer:new{
title_face = Font:getFace("x_smalltfont"),
width = nil,
height = nil,
day = 1,
month = 1,
year = 2017,
ok_text = _("OK"),
cancel_text = _("Cancel"),
}
function DateWidget:init()
self.medium_font_face = Font:getFace("ffont")
self.light_bar = {}
self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight()
self.width = self.screen_width * 0.95
if Device:hasKeys() then
self.key_events = {
Close = { {"Back"}, doc = "close date widget" }
}
end
if Device:isTouchDevice() then
self.ges_events = {
TapClose = {
GestureRange:new{
ges = "tap",
range = Geom:new{
w = self.screen_width,
h = self.screen_height,
}
},
},
}
end
self:update()
end
function DateWidget:update()
local year_widget = NumberPickerWidget:new{
show_parent = self,
width = self.screen_width * 0.2,
value = self.year,
value_min = 2017,
value_max = 2037,
value_step = 1,
value_hold_step = 4,
}
local month_widget = NumberPickerWidget:new{
show_parent = self,
width = self.screen_width * 0.2,
value = self.month,
value_min = 1,
value_max = 12,
value_step = 1,
value_hold_step = 3,
}
local day_widget = NumberPickerWidget:new{
show_parent = self,
width = self.screen_width * 0.2,
value = self.day,
value_min = 1,
value_max = 31,
value_step = 1,
value_hold_step = 5,
date_month = month_widget,
date_year = year_widget,
}
local dash_space = TextBoxWidget:new{
text = "–",
alignment = "center",
face = self.title_face,
bold = true,
width = self.screen_width * 0.1,
}
local date_group = HorizontalGroup:new{
align = "center",
year_widget,
dash_space,
month_widget,
dash_space,
day_widget,
}
local date_title = FrameContainer:new{
padding = Size.padding.default,
margin = Size.margin.title,
bordersize = 0,
TextWidget:new{
text = self.title_text,
face = self.title_face,
bold = true,
width = self.screen_width * 0.95,
},
}
local date_line = LineWidget:new{
dimen = Geom:new{
w = self.width,
h = Size.line.thick,
}
}
local date_bar = OverlapGroup:new{
dimen = {
w = self.width,
h = date_title:getSize().h
},
date_title,
CloseButton:new{ window = self, padding_top = Size.margin.title, },
}
local buttons = {
{
{
text = self.cancel_text,
callback = function()
self:onClose()
end,
},
{
text = self.ok_text,
callback = function()
if self.callback then
self.year = year_widget:getValue()
self.month = month_widget:getValue()
self.day = day_widget:getValue()
self:callback(self)
end
self:onClose()
end,
},
}
}
local ok_cancel_buttons = ButtonTable:new{
width = self.width - 2*Size.padding.default,
buttons = buttons,
zero_sep = true,
show_parent = self,
}
self.date_frame = FrameContainer:new{
radius = Size.radius.window,
bordersize = Size.border.window,
padding = 0,
margin = 0,
background = Blitbuffer.COLOR_WHITE,
VerticalGroup:new{
align = "left",
date_bar,
date_line,
CenterContainer:new{
dimen = Geom:new{
w = self.screen_width * 0.95,
h = date_group:getSize().h * 1.2,
},
date_group
},
CenterContainer:new{
dimen = Geom:new{
w = self.width,
h = ok_cancel_buttons:getSize().h,
},
ok_cancel_buttons
}
}
}
self[1] = WidgetContainer:new{
align = "center",
dimen = Geom:new{
x = 0, y = 0,
w = self.screen_width,
h = self.screen_height,
},
FrameContainer:new{
bordersize = 0,
padding = Size.padding.default,
self.date_frame,
}
}
UIManager:setDirty(self, function()
return "ui", self.date_frame.dimen
end)
end
function DateWidget:onCloseWidget()
UIManager:setDirty(nil, function()
return "partial", self.date_frame.dimen
end)
return true
end
function DateWidget:onShow()
UIManager:setDirty(self, function()
return "ui", self.date_frame.dimen
end)
return true
end
function DateWidget:onAnyKeyPressed()
UIManager:close(self)
return true
end
function DateWidget:onTapClose(arg, ges_ev)
if ges_ev.pos:notIntersectWith(self.date_frame.dimen) then
self:onClose()
end
return true
end
function DateWidget:onClose()
UIManager:close(self)
return true
end
return DateWidget
| agpl-3.0 |
isdom/kong | spec/unit/tools/responses_spec.lua | 20 | 4199 | local responses = require "kong.tools.responses"
local constants = require "kong.constants"
require "kong.tools.ngx_stub"
describe("Responses", function()
before_each(function()
mock(ngx, true) -- mock table with stubs.
end)
after_each(function()
ngx.ctx = {}
ngx.header = {}
-- Revert mocked functions
for _, v in pairs(ngx) do
if type(v) == "table" and v.revert then
v:revert()
end
end
end)
it("should have a list of the main http status codes used in Kong", function()
assert.truthy(responses.status_codes)
assert.are.same("table", type(responses.status_codes))
end)
it("should be callable via `send_HTTP_STATUS_CODE`", function()
for status_code_name, status_code in pairs(responses.status_codes) do
assert.has_no.errors(function()
responses["send_"..status_code_name]()
end)
end
end)
it("should set the correct ngx values and call ngx.say and ngx.exit", function()
responses.send_HTTP_OK("OK")
assert.are.same(ngx.status, responses.status_codes.HTTP_OK)
assert.are.same(ngx.header["Server"], constants.NAME.."/"..constants.VERSION)
assert.stub(ngx.say).was.called() -- set custom content
assert.stub(ngx.exit).was.called() -- exit nginx (or continue to the next context if 200)
end)
it("should send the content as a JSON string with a `message` property if given a string", function()
responses.send_HTTP_OK("OK")
assert.stub(ngx.say).was.called_with("{\"message\":\"OK\"}")
end)
it("should send the content as a JSON string if given a table", function()
responses.send_HTTP_OK({ success = true })
assert.stub(ngx.say).was.called_with("{\"success\":true}")
end)
it("should send the content as passed if `raw` is given", function()
responses.send_HTTP_OK("OK", true)
assert.stub(ngx.say).was.called_with("OK")
end)
it("should call `ngx.exit` with the corresponding status_code", function()
for status_code_name, status_code in pairs(responses.status_codes) do
assert.has_no.errors(function()
responses["send_"..status_code_name]()
assert.stub(ngx.exit).was.called_with(status_code)
end)
end
end)
it("should call `ngx.log` and set `stop_phases` if and only if a 500 status code range was given", function()
responses.send_HTTP_BAD_REQUEST()
assert.stub(ngx.log).was_not_called()
assert.falsy(ngx.ctx.stop_phases)
responses.send_HTTP_INTERNAL_SERVER_ERROR()
assert.stub(ngx.log).was_not_called()
assert.True(ngx.ctx.stop_phases)
responses.send_HTTP_INTERNAL_SERVER_ERROR("error")
assert.stub(ngx.log).was_called()
end)
describe("default content rules for some status codes", function()
it("should apply default content rules for some status codes", function()
responses.send_HTTP_NOT_FOUND()
assert.stub(ngx.say).was.called_with("{\"message\":\"Not found\"}")
responses.send_HTTP_NOT_FOUND("override")
assert.stub(ngx.say).was.called_with("{\"message\":\"override\"}")
end)
it("should apply default content rules for some status codes", function()
responses.send_HTTP_NO_CONTENT("some content")
assert.stub(ngx.say).was.not_called()
end)
it("should apply default content rules for some status codes", function()
responses.send_HTTP_INTERNAL_SERVER_ERROR()
assert.stub(ngx.say).was.called_with("{\"message\":\"An unexpected error occurred\"}")
responses.send_HTTP_INTERNAL_SERVER_ERROR("override")
assert.stub(ngx.say).was.called_with("{\"message\":\"An unexpected error occurred\"}")
end)
end)
describe("#send()", function()
it("should send a custom status code", function()
responses.send(415, "Unsupported media type")
assert.stub(ngx.say).was.called_with("{\"message\":\"Unsupported media type\"}")
assert.stub(ngx.exit).was.called_with(415)
responses.send(415, "Unsupported media type")
assert.stub(ngx.say).was.called_with("{\"message\":\"Unsupported media type\"}")
assert.stub(ngx.exit).was.called_with(415)
responses.send(501)
assert.stub(ngx.exit).was.called_with(501)
end)
end)
end)
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/particle/particle_test_3.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_static_particle_particle_test_3 = object_static_particle_shared_particle_test_3:new {
}
ObjectTemplates:addTemplate(object_static_particle_particle_test_3, "object/static/particle/particle_test_3.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/terminal/terminal_nym_cave.lua | 3 | 2228 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_terminal_terminal_nym_cave = object_tangible_terminal_shared_terminal_nym_cave:new {
}
ObjectTemplates:addTemplate(object_tangible_terminal_terminal_nym_cave, "object/tangible/terminal/terminal_nym_cave.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/instrument/instrument_fanfar.lua | 2 | 3106 | --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_instrument_instrument_fanfar = object_draft_schematic_instrument_shared_instrument_fanfar:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "a Fanfar",
craftingToolTab = 524288, -- (See DraftSchemticImplementation.h)
complexity = 14,
size = 1,
xpType = "music",
xp = 110,
assemblySkill = "instrument_assembly",
experimentingSkill = "general_experimentation",
customizationSkill = "instrument_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_furniture_ingredients_n", "craft_furniture_ingredients_n"},
ingredientTitleNames = {"frame", "valving"},
ingredientSlotType = {0, 0},
resourceTypes = {"metal", "metal"},
resourceQuantities = {40, 15},
contribution = {100, 100},
targetTemplate = "object/tangible/instrument/fanfar.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_instrument_instrument_fanfar, "object/draft_schematic/instrument/instrument_fanfar.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/space/reactor/objects.lua | 3 | 26254 | --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_space_reactor_shared_basic_reactor = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_basic_reactor.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 = 366234772,
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_space_reactor_shared_basic_reactor, "object/draft_schematic/space/reactor/shared_basic_reactor.iff")
object_draft_schematic_space_reactor_shared_fusion_reactor_mk1 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_fusion_reactor_mk1.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 = 3664496596,
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_space_reactor_shared_fusion_reactor_mk1, "object/draft_schematic/space/reactor/shared_fusion_reactor_mk1.iff")
object_draft_schematic_space_reactor_shared_fusion_reactor_mk2 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_fusion_reactor_mk2.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 = 24932163,
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_space_reactor_shared_fusion_reactor_mk2, "object/draft_schematic/space/reactor/shared_fusion_reactor_mk2.iff")
object_draft_schematic_space_reactor_shared_fusion_reactor_mk3 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_fusion_reactor_mk3.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 = 1215367374,
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_space_reactor_shared_fusion_reactor_mk3, "object/draft_schematic/space/reactor/shared_fusion_reactor_mk3.iff")
object_draft_schematic_space_reactor_shared_fusion_reactor_mk4 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_fusion_reactor_mk4.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 = 3012699098,
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_space_reactor_shared_fusion_reactor_mk4, "object/draft_schematic/space/reactor/shared_fusion_reactor_mk4.iff")
object_draft_schematic_space_reactor_shared_fusion_reactor_mk5 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_fusion_reactor_mk5.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 = 4204741719,
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_space_reactor_shared_fusion_reactor_mk5, "object/draft_schematic/space/reactor/shared_fusion_reactor_mk5.iff")
object_draft_schematic_space_reactor_shared_reactor_limiter_mk1 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_limiter_mk1.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 = 3282952808,
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_space_reactor_shared_reactor_limiter_mk1, "object/draft_schematic/space/reactor/shared_reactor_limiter_mk1.iff")
object_draft_schematic_space_reactor_shared_reactor_limiter_mk2 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_limiter_mk2.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 = 414862079,
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_space_reactor_shared_reactor_limiter_mk2, "object/draft_schematic/space/reactor/shared_reactor_limiter_mk2.iff")
object_draft_schematic_space_reactor_shared_reactor_limiter_mk3 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_limiter_mk3.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 = 1370959218,
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_space_reactor_shared_reactor_limiter_mk3, "object/draft_schematic/space/reactor/shared_reactor_limiter_mk3.iff")
object_draft_schematic_space_reactor_shared_reactor_limiter_mk4 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_limiter_mk4.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 = 2857633382,
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_space_reactor_shared_reactor_limiter_mk4, "object/draft_schematic/space/reactor/shared_reactor_limiter_mk4.iff")
object_draft_schematic_space_reactor_shared_reactor_limiter_mk5 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_limiter_mk5.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 = 3814285803,
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_space_reactor_shared_reactor_limiter_mk5, "object/draft_schematic/space/reactor/shared_reactor_limiter_mk5.iff")
object_draft_schematic_space_reactor_shared_reactor_overcharger_mk1 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk1.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 = 287048772,
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_space_reactor_shared_reactor_overcharger_mk1, "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk1.iff")
object_draft_schematic_space_reactor_shared_reactor_overcharger_mk2 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk2.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 = 3389762771,
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_space_reactor_shared_reactor_overcharger_mk2, "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk2.iff")
object_draft_schematic_space_reactor_shared_reactor_overcharger_mk3 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk3.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 = 2198260574,
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_space_reactor_shared_reactor_overcharger_mk3, "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk3.iff")
object_draft_schematic_space_reactor_shared_reactor_overcharger_mk4 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk4.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 = 2028331082,
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_space_reactor_shared_reactor_overcharger_mk4, "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk4.iff")
object_draft_schematic_space_reactor_shared_reactor_overcharger_mk5 = SharedDraftSchematicObjectTemplate:new {
clientTemplateFileName = "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk5.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 = 837322695,
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_space_reactor_shared_reactor_overcharger_mk5, "object/draft_schematic/space/reactor/shared_reactor_overcharger_mk5.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Rabao/npcs/Porter_Moogle.lua | 7 | 1145 | -----------------------------------
-- Area: Rabao
-- NPC: Porter Moogle
-- Type: Storage Moogle
-- @zone 247
-- !pos TODO
-----------------------------------
package.loaded["scripts/zones/Rabao/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Rabao/TextIDs");
require("scripts/globals/porter_moogle_util");
local e =
{
TALK_EVENT_ID = 136,
STORE_EVENT_ID = 137,
RETRIEVE_EVENT_ID = 138,
ALREADY_STORED_ID = 139,
MAGIAN_TRIAL_ID = 140
};
function onTrade(player,npc,trade)
porterMoogleTrade(player, trade, e);
end;
function onTrigger(player,npc)
-- No idea what the params are, other than event ID and gil.
player:startEvent(e.TALK_EVENT_ID, 0x6FFFFF, 0x01, 0x06DD, 0x27, 0x7C7E, 0x15, player:getGil(), 0x03E8);
end;
function onEventUpdate(player,csid,option)
porterEventUpdate(player, csid, option, e.RETRIEVE_EVENT_ID, RETRIEVE_DIALOG_ID, ITEM_CANNOT_BE_OBTAINED);
end;
function onEventFinish(player,csid,option)
porterEventFinish(player, csid, option, e.TALK_EVENT_ID, ITEM_CANNOT_BE_OBTAINED, ITEM_OBTAINED, NOT_HAVE_ENOUGH_GIL);
end | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/mission/quest_item/figrindan_q1_needed.lua | 3 | 2276 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_mission_quest_item_figrindan_q1_needed = object_tangible_mission_quest_item_shared_figrindan_q1_needed:new {
}
ObjectTemplates:addTemplate(object_tangible_mission_quest_item_figrindan_q1_needed, "object/tangible/mission/quest_item/figrindan_q1_needed.iff")
| lgpl-3.0 |
gunchleoc/wesnoth | data/lua/wml-utils.lua | 1 | 6485 |
local helper = wesnoth.require "lua/helper.lua"
local utils = {vwriter = {}}
function utils.trim(s)
-- use (f(a)) to get first argument
return (tostring(s):gsub("^%s*(.-)%s*$", "%1"))
end
function utils.split(s)
return tostring(s or ""):gmatch("[^%s,][^,]*")
end
function utils.check_key(val, key, tag, convert_spaces)
if not val then return nil end
if convert_spaces then
val = tostring(val):gsub(' ', '_')
end
if not val:match('^[a-zA-Z0-9_]+$') then
helper.wml_error("Invalid " .. key .. "= in [" .. tag .. "]")
end
return val
end
function utils.vwriter.init(cfg, default_variable)
local variable = cfg.variable or default_variable
local is_explicit_index = string.sub(variable, string.len(variable)) == "]"
local mode = cfg.mode or "always_clear"
local index = 0
if is_explicit_index then
-- explicit indexes behave always like "replace"
elseif mode == "append" then
index = wesnoth.get_variable(variable .. ".length")
elseif mode ~= "replace" then
wesnoth.set_variable(variable)
end
return {
variable = variable,
is_explicit_index = is_explicit_index,
index = index,
}
end
function utils.vwriter.write(self, container)
if self.is_explicit_index then
wesnoth.set_variable(self.variable, container)
else
wesnoth.set_variable(string.format("%s[%u]", self.variable, self.index), container)
end
self.index = self.index + 1
end
function utils.get_sides(cfg, key_name, filter_name)
key_name = key_name or "side"
filter_name = filter_name or "filter_side"
local filter = helper.get_child(cfg, filter_name)
if filter then
if cfg[key_name] then
wesnoth.log('warn', "ignoring duplicate side filter information (inline side=)")
end
return wesnoth.get_sides(filter)
else
return wesnoth.get_sides{side = cfg[key_name]}
end
end
function utils.optional_side_filter(cfg, key_name, filter_name)
local key_name = key_name or "side"
local filter_name = filter_name or "filter_side"
if cfg[key_name] == nil and helper.get_child(cfg, filter_name) == nil then
return true
end
local sides = utils.get_sides(cfg, key_name, filter_name)
for index,side in ipairs(sides) do
if side.controller == "human" then
return true
end
end
return false
end
local current_exit = "none"
local scope_stack = {
push = table.insert,
pop = table.remove,
}
--[[ Possible exit types:
- none - ordinary execution
- break - exiting a loop scope
- return - immediate termination (exit all scopes)
- continue - jumping to the end of a loop scope
]]
function utils.set_exiting(exit_type)
current_exit = exit_type
end
--[[ Possible scope types:
- plain - ordinary scope, no special features; eg [command] or [event]
- conditional - scope that's executing because of a condition, eg [then] or [else]
- switch - scope that's part of a switch statement, eg [case] or [else]
- loop - scope that's part of a loop, eg [do]
Currently, only "loop" has any special effects. ]]
function utils.handle_event_commands(cfg, scope_type)
-- The WML might be modifying the currently executed WML by mixing
-- [insert_tag] with [set_variables] and [clear_variable], so we
-- have to be careful not to get confused by tags vanishing during
-- the execution, hence the manual handling of [insert_tag].
scope_type = scope_type or "plain"
scope_stack:push(scope_type)
local cmds = helper.shallow_literal(cfg)
for i = 1,#cmds do
local v = cmds[i]
local cmd = v[1]
local arg = v[2]
local insert_from
if cmd == "insert_tag" then
cmd = arg.name
local from = arg.variable or
helper.wml_error("[insert_tag] found with no variable= field")
arg = wesnoth.get_variable(from)
if type(arg) ~= "table" then
-- Corner case: A missing variable is replaced
-- by an empty container rather than being ignored.
arg = {}
elseif string.sub(from, -1) ~= ']' then
insert_from = from
end
arg = wesnoth.tovconfig(arg)
end
if not string.find(cmd, "^filter") then
cmd = wesnoth.wml_actions[cmd] or
helper.wml_error(string.format("[%s] not supported", cmd))
if insert_from then
local j = 0
repeat
cmd(arg)
if current_exit ~= "none" then break end
j = j + 1
if j >= wesnoth.get_variable(insert_from .. ".length") then break end
arg = wesnoth.tovconfig(wesnoth.get_variable(string.format("%s[%d]", insert_from, j)))
until false
else
cmd(arg)
end
end
if current_exit ~= "none" then break end
end
scope_stack:pop()
if #scope_stack == 0 then
if current_exit == "continue" and scope_type ~= "loop" then
helper.wml_error("[continue] found outside a loop scope!")
end
current_exit = "none"
end
-- Apply music alterations once all the commands have been processed.
wesnoth.set_music()
return current_exit
end
-- Splits the string argument on commas, excepting those commas that occur
-- within paired parentheses. The result is returned as a (non-empty) table.
-- (The table might have a single entry that is an empty string, though.)
-- Spaces around splitting commas are stripped (as in the C++ version).
-- Empty strings are not removed (unlike the C++ version).
function utils.parenthetical_split(str)
local t = {""}
-- To simplify some logic, end the string with paired parentheses.
local formatted = (str or "") .. ",()"
-- Isolate paired parentheses.
for prefix,paren in string.gmatch(formatted, "(.-)(%b())") do
-- Separate on commas
for comma,text in string.gmatch(prefix, "(,?)([^,]*)") do
if comma == "" then
-- We are continuing the last string found.
t[#t] = t[#t] .. text
else
-- We are starting the next string.
-- (Now that we know the last string is complete,
-- strip leading and trailing spaces from it.)
t[#t] = string.match(t[#t], "^%s*(.-)%s*$")
table.insert(t, text)
end
end
-- Add the parenthetical part to the last string found.
t[#t] = t[#t] .. paren
end
-- Remove the empty parentheses we had added to the end.
table.remove(t)
return t
end
--note: when using these, make sure that nothing can throw over the call to end_var_scope
function utils.start_var_scope(name)
local var = helper.get_variable_array(name) --containers and arrays
if #var == 0 then var = wesnoth.get_variable(name) end --scalars (and nil/empty)
wesnoth.set_variable(name)
return var
end
function utils.end_var_scope(name, var)
wesnoth.set_variable(name)
if type(var) == "table" then
helper.set_variable_array(name, var)
else
wesnoth.set_variable(name, var)
end
end
return utils
| gpl-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/crafting/station/jedi_tool.lua | 3 | 3833 | --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_crafting_station_jedi_tool = object_tangible_crafting_station_shared_jedi_tool:new {
templateType = CRAFTINGTOOL,
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 = 4,
complexityLevel = 20,
enabledTabs = {2048},
numberExperimentalProperties = {1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "CD"},
experimentalWeights = {1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "exp_effectiveness"},
experimentalSubGroupTitles = {"null", "null", "hitpoints", "usemodifier"},
experimentalMin = {0, 0, 1000, -15},
experimentalMax = {0, 0, 1000, 15},
experimentalCombineType = {0, 0, 4, 1},
experimentalPrecision = {0, 0, 0, 0},
experimentalCombineType = {1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_crafting_station_jedi_tool, "object/tangible/crafting/station/jedi_tool.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Lower_Jeuno/npcs/_6t2.lua | 2 | 3895 | -----------------------------------
-- Area: Lower Jeuno
-- Door: Merchant's House
-- Starts & Finishes Quest: Save My Son
-- Optional Involvement in Quest: Chocobo's Wounds, Path of the Beastmaster
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
package.loaded["scripts/globals/settings"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Lower_Jeuno/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
local ANewDawn = player:getQuestStatus(JEUNO,A_NEW_DAWN);
local ANewDawnEvent = player:getVar("ANewDawn_Event");
local ScatteredIntoShadow = player:getQuestStatus(JEUNO,SCATTERED_INTO_SHADOW);
local SaveMySon = player:getVar("SaveMySon_Event");
local ChocobosWounds = player:getQuestStatus(JEUNO, CHOCOBO_S_WOUNDS);
local mLvl = player:getMainLvl();
local mJob = player:getMainJob();
-- A New Dawn (BST AF3)
if (ScatteredIntoShadow == QUEST_COMPLETED and ANewDawn == QUEST_AVAILABLE) then
if (mJob == 9 and mLvl >= 50) then
if (ANewDawnEvent == 0) then
player:startEvent(5);
elseif (ANewDawnEvent == 1) then
player:startEvent(4);
end
else
player:startEvent(1);
end
elseif (ANewDawn == QUEST_ACCEPTED) then
if (ANewDawnEvent == 2) then
player:startEvent(2);
elseif (ANewDawnEvent >= 4) then
player:startEvent(3);
end
elseif (ANewDawn == QUEST_COMPLETED and ANewDawnEvent == 6) then
player:startEvent(0);
-- Save My Son
elseif (player:getQuestStatus(JEUNO, SAVE_MY_SON) == QUEST_AVAILABLE and mLvl >= 30) then
player:startEvent(164);
elseif (player:getQuestStatus(JEUNO, SAVE_MY_SON) == QUEST_ACCEPTED) then
if (SaveMySon == 0) then
player:startEvent(229);
elseif (SaveMySon == 1) then
player:startEvent(163);
end
elseif (player:needToZone() == false and player:getQuestStatus(JEUNO, SAVE_MY_SON) == QUEST_COMPLETED and SaveMySon == 2) then
player:startEvent(132);
-- Chocobos Wounds
elseif (ChocobosWounds == QUEST_AVAILABLE) then
player:startEvent(64);
elseif (player:getVar("ChocobosWounds_Event") > 3) then
player:startEvent(63);
-- Standard Dialogue?, Probably Wrong
else
player:messageSpecial(ITS_LOCKED);
end
return 1;
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
if (csid == 164 and option == 0) then
player:addQuest(JEUNO, SAVE_MY_SON);
elseif (csid == 163) then
if (player:getFreeSlotsCount(0) >= 1) then
player:addTitle(dsp.title.LIFE_SAVER);
player:addItem(13110);
player:messageSpecial(ITEM_OBTAINED, 13110);
player:addGil(GIL_RATE*2100);
player:messageSpecial(GIL_OBTAINED, GIL_RATE*2100);
player:setVar("SaveMySon_Event",2);
player:needToZone(true);
player:addFame(JEUNO,30);
player:completeQuest(JEUNO,SAVE_MY_SON);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13110);
end
elseif (csid == 132) then
player:setVar("SaveMySon_Event",0);
elseif (csid == 5) then
player:setVar("ANewDawn_Event",1);
if (option == 1) then
player:addQuest(JEUNO, A_NEW_DAWN);
player:setVar("ANewDawn_Event",2);
end
elseif (csid == 4 and option == 1) then
player:addQuest(JEUNO, A_NEW_DAWN);
player:setVar("ANewDawn_Event",2);
elseif (csid == 0) then
player:setVar("ANewDawn_Event",0);
end
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_criminal_thug_rodian_male_01.lua | 3 | 2260 | --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_rodian_male_01 = object_mobile_shared_dressed_criminal_thug_rodian_male_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_criminal_thug_rodian_male_01, "object/mobile/dressed_criminal_thug_rodian_male_01.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/globals/mobskills/trembling.lua | 37 | 1114 | ---------------------------------------------
-- Trembling
--
-- Description: Deals physical damage to enemies within an area of effect. Additional effect: Dispel
-- Type: Physical
-- Wipes Shadows
-- Range: 10' radial
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local numhits = 1;
local accmod = 1;
local dmgmod = 4;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_DMG_VARIES,1,2,3);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,MOBPARAM_WIPE_SHADOWS);
local dispelled = math.random(2,3);
if (info.hitslanded ~= 0) then
for i=1,dispelled do
target:dispelStatusEffect();
end
end
-- TODO: Dispelled messages. No examples of damage+dispel working to crib notes from.
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/managers/player_manager.lua | 1 | 2760 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
-----------------------------------
--GENERAL PLAYER SETTINGS
-----------------------------------
--Blue frog / GM buff values
performanceBuff = 1000
medicalBuff = 1900
performanceDuration = 7200 -- in seconds
medicalDuration = 7200 -- in seconds
--Sets the experience multiplier while grouped
groupExpMultiplier = 1.2
--Sets a global experience multiplier
globalExpMultiplier = 1.0
--Sets the base number of control devices of each type that a player can have in their datapad at once
--For creature pets, A Creature Handler will have the base number + their stored pets skill mod as limit
baseStoredCreaturePets = 2
baseStoredFactionPets = 3
baseStoredDroids = 5
baseStoredVehicles = 3
baseStoredShips = 3
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Full_Moon_Fountain/npcs/Moon_Spiral.lua | 2 | 1168 | -----------------------------------
-- Area: Full Moon Fountain
-- NPC: Moon Spiral
-- Involved in Quests: The Moonlit Path
-- !pos -302 9 -260 170
-----------------------------------
package.loaded["scripts/zones/Full_Moon_Fountain/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/bcnm");
require("scripts/globals/quests");
require("scripts/globals/missions");
require("scripts/zones/Full_Moon_Fountain/TextIDs");
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
function onTrigger(player,npc)
if (EventTriggerBCNM(player,npc)) then
return;
end
end;
function onEventUpdate(player,csid,option)
printf("onUpdate CSID: %u",csid);
printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
printf("onFinish CSID: %u",csid);
printf("onFinish RESULT: %u",option);
if (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
meshr-net/meshr_tomato-RT-N | usr/lib/lua/luci/sys/iptparser.lua | 2 | 10750 | --[[
Iptables parser and query library
(c) 2008-2009 Jo-Philipp Wich <xm@leipzig.freifunk.net>
(c) 2008-2009 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: iptparser.lua 9797 2013-03-27 13:28:26Z jow $
]]--
local luci = {}
luci.util = require "luci.util"
luci.sys = require "luci.sys"
luci.ip = require "luci.ip"
local tonumber, ipairs, table = tonumber, ipairs, table
--- LuCI iptables parser and query library
-- @cstyle instance
module("luci.sys.iptparser")
--- Create a new iptables parser object.
-- @class function
-- @name IptParser
-- @param family Number specifying the address family. 4 for IPv4, 6 for IPv6
-- @return IptParser instance
IptParser = luci.util.class()
function IptParser.__init__( self, family )
self._family = (tonumber(family) == 6) and 6 or 4
self._rules = { }
self._chains = { }
if self._family == 4 then
self._nulladdr = "0.0.0.0/0"
self._tables = { "filter", "nat", "mangle", "raw" }
self._command = "iptables -t %s --line-numbers -nxvL"
else
self._nulladdr = "::/0"
self._tables = { "filter", "mangle", "raw" }
self._command = "ip6tables -t %s --line-numbers -nxvL"
end
self:_parse_rules()
end
--- Find all firewall rules that match the given criteria. Expects a table with
-- search criteria as only argument. If args is nil or an empty table then all
-- rules will be returned.
--
-- The following keys in the args table are recognized:
-- <ul>
-- <li> table - Match rules that are located within the given table
-- <li> chain - Match rules that are located within the given chain
-- <li> target - Match rules with the given target
-- <li> protocol - Match rules that match the given protocol, rules with
-- protocol "all" are always matched
-- <li> source - Match rules with the given source, rules with source
-- "0.0.0.0/0" (::/0) are always matched
-- <li> destination - Match rules with the given destination, rules with
-- destination "0.0.0.0/0" (::/0) are always matched
-- <li> inputif - Match rules with the given input interface, rules
-- with input interface "*" (=all) are always matched
-- <li> outputif - Match rules with the given output interface, rules
-- with output interface "*" (=all) are always matched
-- <li> flags - Match rules that match the given flags, current
-- supported values are "-f" (--fragment)
-- and "!f" (! --fragment)
-- <li> options - Match rules containing all given options
-- </ul>
-- The return value is a list of tables representing the matched rules.
-- Each rule table contains the following fields:
-- <ul>
-- <li> index - The index number of the rule
-- <li> table - The table where the rule is located, can be one
-- of "filter", "nat" or "mangle"
-- <li> chain - The chain where the rule is located, e.g. "INPUT"
-- or "postrouting_wan"
-- <li> target - The rule target, e.g. "REJECT" or "DROP"
-- <li> protocol The matching protocols, e.g. "all" or "tcp"
-- <li> flags - Special rule options ("--", "-f" or "!f")
-- <li> inputif - Input interface of the rule, e.g. "eth0.0"
-- or "*" for all interfaces
-- <li> outputif - Output interface of the rule,e.g. "eth0.0"
-- or "*" for all interfaces
-- <li> source - The source ip range, e.g. "0.0.0.0/0" (::/0)
-- <li> destination - The destination ip range, e.g. "0.0.0.0/0" (::/0)
-- <li> options - A list of specific options of the rule,
-- e.g. { "reject-with", "tcp-reset" }
-- <li> packets - The number of packets matched by the rule
-- <li> bytes - The number of total bytes matched by the rule
-- </ul>
-- Example:
-- <pre>
-- ip = luci.sys.iptparser.IptParser()
-- result = ip.find( {
-- target="REJECT",
-- protocol="tcp",
-- options={ "reject-with", "tcp-reset" }
-- } )
-- </pre>
-- This will match all rules with target "-j REJECT",
-- protocol "-p tcp" (or "-p all")
-- and the option "--reject-with tcp-reset".
-- @params args Table containing the search arguments (optional)
-- @return Table of matching rule tables
function IptParser.find( self, args )
local args = args or { }
local rv = { }
args.source = args.source and self:_parse_addr(args.source)
args.destination = args.destination and self:_parse_addr(args.destination)
for i, rule in ipairs(self._rules) do
local match = true
-- match table
if not ( not args.table or args.table:lower() == rule.table ) then
match = false
end
-- match chain
if not ( match == true and (
not args.chain or args.chain == rule.chain
) ) then
match = false
end
-- match target
if not ( match == true and (
not args.target or args.target == rule.target
) ) then
match = false
end
-- match protocol
if not ( match == true and (
not args.protocol or rule.protocol == "all" or
args.protocol:lower() == rule.protocol
) ) then
match = false
end
-- match source
if not ( match == true and (
not args.source or rule.source == self._nulladdr or
self:_parse_addr(rule.source):contains(args.source)
) ) then
match = false
end
-- match destination
if not ( match == true and (
not args.destination or rule.destination == self._nulladdr or
self:_parse_addr(rule.destination):contains(args.destination)
) ) then
match = false
end
-- match input interface
if not ( match == true and (
not args.inputif or rule.inputif == "*" or
args.inputif == rule.inputif
) ) then
match = false
end
-- match output interface
if not ( match == true and (
not args.outputif or rule.outputif == "*" or
args.outputif == rule.outputif
) ) then
match = false
end
-- match flags (the "opt" column)
if not ( match == true and (
not args.flags or rule.flags == args.flags
) ) then
match = false
end
-- match specific options
if not ( match == true and (
not args.options or
self:_match_options( rule.options, args.options )
) ) then
match = false
end
-- insert match
if match == true then
rv[#rv+1] = rule
end
end
return rv
end
--- Rebuild the internal lookup table, for example when rules have changed
-- through external commands.
-- @return nothing
function IptParser.resync( self )
self._rules = { }
self._chain = nil
self:_parse_rules()
end
--- Find the names of all tables.
-- @return Table of table names.
function IptParser.tables( self )
return self._tables
end
--- Find the names of all chains within the given table name.
-- @param table String containing the table name
-- @return Table of chain names in the order they occur.
function IptParser.chains( self, table )
local lookup = { }
local chains = { }
for _, r in ipairs(self:find({table=table})) do
if not lookup[r.chain] then
lookup[r.chain] = true
chains[#chains+1] = r.chain
end
end
return chains
end
--- Return the given firewall chain within the given table name.
-- @param table String containing the table name
-- @param chain String containing the chain name
-- @return Table containing the fields "policy", "packets", "bytes"
-- and "rules". The "rules" field is a table of rule tables.
function IptParser.chain( self, table, chain )
return self._chains[table:lower()] and self._chains[table:lower()][chain]
end
--- Test whether the given target points to a custom chain.
-- @param target String containing the target action
-- @return Boolean indicating whether target is a custom chain.
function IptParser.is_custom_target( self, target )
for _, r in ipairs(self._rules) do
if r.chain == target then
return true
end
end
return false
end
-- [internal] Parse address according to family.
function IptParser._parse_addr( self, addr )
if self._family == 4 then
return luci.ip.IPv4(addr)
else
return luci.ip.IPv6(addr)
end
end
-- [internal] Parse iptables output from all tables.
function IptParser._parse_rules( self )
for i, tbl in ipairs(self._tables) do
self._chains[tbl] = { }
for i, rule in ipairs(luci.util.execl(self._command % tbl)) do
if rule:find( "^Chain " ) == 1 then
local crefs
local cname, cpol, cpkt, cbytes = rule:match(
"^Chain ([^%s]*) %(policy (%w+) " ..
"(%d+) packets, (%d+) bytes%)"
)
if not cname then
cname, crefs = rule:match(
"^Chain ([^%s]*) %((%d+) references%)"
)
end
self._chain = cname
self._chains[tbl][cname] = {
policy = cpol,
packets = tonumber(cpkt or 0),
bytes = tonumber(cbytes or 0),
references = tonumber(crefs or 0),
rules = { }
}
else
if rule:find("%d") == 1 then
local rule_parts = luci.util.split( rule, "%s+", nil, true )
local rule_details = { }
-- cope with rules that have no target assigned
if rule:match("^%d+%s+%d+%s+%d+%s%s") then
table.insert(rule_parts, 4, nil)
end
-- ip6tables opt column is usually zero-width
if self._family == 6 then
table.insert(rule_parts, 6, "--")
end
rule_details["table"] = tbl
rule_details["chain"] = self._chain
rule_details["index"] = tonumber(rule_parts[1])
rule_details["packets"] = tonumber(rule_parts[2])
rule_details["bytes"] = tonumber(rule_parts[3])
rule_details["target"] = rule_parts[4]
rule_details["protocol"] = rule_parts[5]
rule_details["flags"] = rule_parts[6]
rule_details["inputif"] = rule_parts[7]
rule_details["outputif"] = rule_parts[8]
rule_details["source"] = rule_parts[9]
rule_details["destination"] = rule_parts[10]
rule_details["options"] = { }
for i = 11, #rule_parts do
if #rule_parts[i] > 0 then
rule_details["options"][i-10] = rule_parts[i]
end
end
self._rules[#self._rules+1] = rule_details
self._chains[tbl][self._chain].rules[
#self._chains[tbl][self._chain].rules + 1
] = rule_details
end
end
end
end
self._chain = nil
end
-- [internal] Return true if optlist1 contains all elements of optlist 2.
-- Return false in all other cases.
function IptParser._match_options( self, o1, o2 )
-- construct a hashtable of first options list to speed up lookups
local oh = { }
for i, opt in ipairs( o1 ) do oh[opt] = true end
-- iterate over second options list
-- each string in o2 must be also present in o1
-- if o2 contains a string which is not found in o1 then return false
for i, opt in ipairs( o2 ) do
if not oh[opt] then
return false
end
end
return true
end
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/bile_drenched_quenker.lua | 3 | 2200 | --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_bile_drenched_quenker = object_mobile_shared_bile_drenched_quenker:new {
}
ObjectTemplates:addTemplate(object_mobile_bile_drenched_quenker, "object/mobile/bile_drenched_quenker.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/creature/npc/droid/crafted/r3_droid_advanced.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_creature_npc_droid_crafted_r3_droid_advanced = object_creature_npc_droid_crafted_shared_r3_droid_advanced:new {
}
ObjectTemplates:addTemplate(object_creature_npc_droid_crafted_r3_droid_advanced, "object/creature/npc/droid/crafted/r3_droid_advanced.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/weapon/component/projectile_rifle_barrel.lua | 2 | 3187 | --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_weapon_component_projectile_rifle_barrel = object_draft_schematic_weapon_component_shared_projectile_rifle_barrel:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Projectile Rifle Barrel",
craftingToolTab = 1, -- (See DraftSchemticImplementation.h)
complexity = 5,
size = 1,
xpType = "crafting_weapons_general",
xp = 90,
assemblySkill = "weapon_assembly",
experimentingSkill = "weapon_experimentation",
customizationSkill = "weapon_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_weapon_ingredients_n", "craft_weapon_ingredients_n"},
ingredientTitleNames = {"lining", "bore"},
ingredientSlotType = {0, 0},
resourceTypes = {"steel", "metal"},
resourceQuantities = {31, 15},
contribution = {100, 100},
targetTemplate = "object/tangible/component/weapon/projectile_rifle_barrel.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_weapon_component_projectile_rifle_barrel, "object/draft_schematic/weapon/component/projectile_rifle_barrel.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/faction_perk/hq/hq_s02_imp.lua | 2 | 12790 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_building_faction_perk_hq_hq_s02_imp = object_building_faction_perk_hq_shared_hq_s02_imp:new {
lotSize = 0,
containerComponent = "GCWBaseContainerComponent",
zoneComponent = "StructureZoneComponent",
maintenanceCost = 0,
baseMaintenanceRate = 0,
faction = "imperial",
pvpFaction = "imperial",
dataObjectComponent = "DestructibleBuildingDataComponent",
allowedZones = {"dantooine", "naboo", "rori","tatooine", "corellia", "lok", "talus"},
constructionMarker = "object/building/player/construction/construction_player_house_generic_medium_style_01.iff",
length = 7,
width = 6,
planetMapCategory = "imperial_hq",
alwaysPublic = 1,
factionBaseType = 1,
skillMods = {
{"private_medical_rating", 100},
{"private_med_wound_health", 100},
{"private_med_wound_action", 100},
},
childObjects = {
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=7, z=0, y=23.7, ox=0, oy=.37824, oz=0, ow=.9257, cellid=-1, containmentType=-1}, -- Front right
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-7, z=0, y=23.7, ox=0, oy=-.37824, oz=0, ow=.9257, cellid=-1, containmentType=-1},
-- wall 2
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-10, z=0, y=17, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1}, -- left wall 2
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=10, z=0, y=17, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1},
-- wall 3
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-14, z=0, y=13, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1}, -- left wall 3
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=14, z=0, y=13, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1}, -- right wall 3
-- wall 4
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-18, z=0, y=9, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1}, -- left wall 2
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=18, z=0, y=9, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1},
--wall 5
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-18, z=0, y=1, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1}, -- left wall 2
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=18, z=0, y=1, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1},
-- wall 6
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-18, z=0, y=-7, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1}, -- left wall 2
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=18, z=0, y=-7, ox=0, oy=-.7, oz=0, ow=.7, cellid=-1, containmentType=-1},
-- wall 7 45degree
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-15.2, z=0, y=-13.8, ox=0, oy=.4, oz=0, ow=.9, cellid=-1, containmentType=-1}, -- left wall 4
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=15.2, z=0, y=-13.8, oy=-.4, oz=0, ow=.9, cellid=-1, containmentType=-1},
-- back walls
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-8.4, z=0, y=-16.6, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1},
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=-0, z=0, y=-16.6, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1},
{templateFile = "object/static/structure/military/military_wall_med_imperial_style_01.iff", x=8.4, z=0, y=-16.6, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1},
-- turret
{templateFile = "object/installation/faction_perk/turret/tower_lg.iff", x=-14.5, z=0, y=16, ox=0, oy=-0, oz=0, ow=1, cellid=-1, containmentType=-1}, -- left turret front
{templateFile = "object/installation/faction_perk/turret/tower_lg.iff", x=14.5, z=0, y=16, ox=0, oy=0, oz=0, ow=1, cellid=-1, containmentType=-1},
{templateFile = "object/tangible/terminal/terminal_hq_turret_control.iff", x=-4.75, z=.25, y=1, ow=.7, ox=0, oz=0, oy=.7, cellid=2, containmentType=-1},
{templateFile = "object/tangible/terminal/terminal_hq_turret_control.iff", x=-4.75, z=.25, y=-.5, ow=.7, ox=0, oz=0, oy=.7, cellid=2, containmentType=-1},
{templateFile = "object/installation/faction_perk/minefield/field_1x1.iff", x=0, z=0, y=20, ox=0, oy=.7, oz=0, ow=.7, cellid=-1, containmentType=-1},
{templateFile="object/tangible/terminal/terminal_mission_imperial.iff", x=5, z=.25, y=-3, ow=-.7, ox=0, oz=0, oy=.7, cellid=3, containmentType=-1},
{templateFile="object/tangible/terminal/terminal_mission.iff", x=5, z=.25, y=-4.75, ow=-.7, ox=0, oz=0, oy=.7, cellid=3, containmentType=-1},
{templateFile="object/tangible/terminal/terminal_bank.iff", x=-9, z=-6.66, y=-7, ow=.7, ox=0, oz=0, oy=.7, cellid=5, containmentType=-1},
{templateFile = "object/tangible/terminal/terminal_hq_imperial.iff", x = .38, z = .25, y = 1.75, ox = 0, oy = 0, oz = 0, ow = 1, cellid = 2, containmentType = -1 },
{templateFile = "object/tangible/hq_destructible/uplink_terminal.iff", x =.375, z = -6.75, y =-8, ow = 1, ox =0, oz = 0, oy = .7, cellid = 5, containmentType = -1},
{templateFile = "object/tangible/hq_destructible/security_terminal.iff", x =8, z =-6.75, y =-17.75, ox = 0, oy = 0, oz = 0, ow =1, cellid = 6, containmentType = -1 },
{templateFile = "object/tangible/hq_destructible/override_terminal.iff", x =2.75, z =-6.75, y=.25, ox = 0, oy=1, oz =0, ow =0, cellid = 7, containmentType = -1 },
{templateFile = "object/tangible/hq_destructible/power_regulator.iff", x =-5.9, z =-13.75, y =-17, ox = 0, oy =0, oz = 0, ow =1, cellid =9, containmentType = -1 },
},
childCreatureObjects = {
{ mobile="at_st", x=0, z=0, y=52, cellid=-1, respawn=720, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=0, z=0, y=60, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=5, z=0, y=60, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=-5, z=0, y=60, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=25, z=0, y=-13, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_squad_leader", x=30, z=0, y=-13, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=27.5, z=0, y=-10.5, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=25, z=0, y=-8, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_bombardier", x=30, z=0, y=-8, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=-25, z=0, y=-13, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_squad_leader", x=-30, z=0, y=-13, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=-27.5, z=0, y=-10.5, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=-25, z=0, y=-8, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_bombardier", x=-30, z=0, y=-8, cellid=-1, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=0, z=0, y=15, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=-4, z=0, y=15, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=4, z=0, y=15, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_bombardier", x=2, z=0, y=19, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=-2, z=0, y=19, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_squad_leader", x=-30, z=0, y=26, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=-25, z=0, y=26, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_colonel", x=-27.5, z=0, y=28.5, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=25, z=0, y=26, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=30, z=0, y=26, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="stormtrooper_bombardier", x=27.5, z=0, y=28.5, cellid=-1, respawn=360, containmentType=-1, heading=0},
{ mobile="imperial_trooper", x=2.6, z=0, y=-4.1, cellid=3, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=-6.7, z=-6.75, y=-0.8, cellid=5, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=-0.1, z=-6.75, y=-6.3, cellid=5, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=9.3, z=-6.75, y=-15.0, cellid=6, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=2.5, z=-6.75, y=-16.5, cellid=6, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=7.9, z=-6.75, y=-16.9, cellid=6, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=8, z=-6.75, y=-6, cellid=7, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=3.6, z=-6.75, y=-8.8, cellid=7, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=3.6, z=-6.75, y=-.25, cellid=7, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper", x=-5.5, z=-13.75, y=-3, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="dark_trooper", x=.5, z=-13.75, y=-3, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=.5, z=-13.75, y=-6.6, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="stormtrooper_medic", x=-5.5, z=-13.75, y=-6.6, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="imperial_medic", x=1.8, z=-13.75, y=-12.6, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="imperial_medic", x=-7.6, z=-13.75, y=-12.6, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="imperial_captain", x=-2.5, z=-13.75, y=-14.9, cellid=9, respawn=300, containmentType=-1, heading=0},
{ mobile="imperial_recruiter", x=0, z=-13.75, y=-17, cellid=9, containmentType=-1, respawn=60, heading=0},
},
}
ObjectTemplates:addTemplate(object_building_faction_perk_hq_hq_s02_imp, "object/building/faction_perk/hq/hq_s02_imp.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/attachment/weapon/z95_missile.lua | 3 | 2260 | --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_z95_missile = object_tangible_ship_attachment_weapon_shared_z95_missile:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_attachment_weapon_z95_missile, "object/tangible/ship/attachment/weapon/z95_missile.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/corellian_butterfly.lua | 3 | 2192 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_corellian_butterfly = object_mobile_shared_corellian_butterfly:new {
}
ObjectTemplates:addTemplate(object_mobile_corellian_butterfly, "object/mobile/corellian_butterfly.iff")
| lgpl-3.0 |
houqp/koreader | frontend/version.lua | 1 | 1881 | --[[--
This module helps with retrieving version information.
]]
local Version = {}
--- Returns current KOReader git-rev.
-- @treturn string full KOReader git-rev such as `v2015.11-982-g704d4238`
function Version:getCurrentRevision()
if not self.rev then
local rev_file = io.open("git-rev", "r")
if rev_file then
self.rev = rev_file:read()
rev_file:close()
end
-- sanity check in case `git describe` failed
if self.rev == "fatal: No names found, cannot describe anything." then
self.rev = nil
end
end
return self.rev
end
--- Returns normalized version of KOReader git-rev input string.
-- @string rev full KOReader git-rev such as `v2015.11-982-g704d4238`
-- @treturn int version in the form of a 10 digit number such as `2015110982`
-- @treturn string short git commit version hash such as `704d4238`
function Version:getNormalizedVersion(rev)
if not rev then return end
local year, month, point, revision = rev:match("v(%d%d%d%d)%.(%d%d)%.?(%d?%d?)-?(%d*)")
year = tonumber(year)
month = tonumber(month)
point = tonumber(point)
revision = tonumber(revision)
local commit = rev:match("-%d*-g(%x*)[%d_%-]*")
-- NOTE: * 10000 to handle at most 9999 commits since last tag ;).
return ((year or 0) * 100 + (month or 0)) * 1000000 + (point or 0) * 10000 + (revision or 0), commit
end
--- Returns current version of KOReader.
-- @treturn int version in the form of a 10 digit number such as `2015110982`
-- @treturn string short git commit version hash such as `704d4238`
-- @see normalized_version
function Version:getNormalizedCurrentVersion()
if not self.version or not self.commit then
self.version, self.commit = self:getNormalizedVersion(self:getCurrentRevision())
end
return self.version, self.commit
end
return Version
| agpl-3.0 |
hayword/tfatf_epgp | libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua | 59 | 2966 | --[[-----------------------------------------------------------------------------
InlineGroup Container
Simple container widget that creates a visible "box" with an optional title.
-------------------------------------------------------------------------------]]
local Type, Version = "InlineGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(300)
self:SetHeight(100)
self:SetTitle("")
end,
-- ["OnRelease"] = nil,
["SetTitle"] = function(self,title)
self.titletext:SetText(title)
end,
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight((height or 0) + 40)
end,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 20
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 20
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titletext:SetPoint("TOPLEFT", 14, 0)
titletext:SetPoint("TOPRIGHT", -14, 0)
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
local border = CreateFrame("Frame", nil, frame)
border:SetPoint("TOPLEFT", 0, -17)
border:SetPoint("BOTTOMRIGHT", -1, 3)
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
--Container Support
local content = CreateFrame("Frame", nil, border)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
frame = frame,
content = content,
titletext = titletext,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
| bsd-3-clause |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/loot/quest/force_sensitive/camp_frequency_datapad.lua | 1 | 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_loot_quest_force_sensitive_camp_frequency_datapad = object_tangible_loot_quest_force_sensitive_shared_camp_frequency_datapad:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_quest_force_sensitive_camp_frequency_datapad, "object/tangible/loot/quest/force_sensitive/camp_frequency_datapad.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/loot/quest/force_sensitive/theater_datapad.lua | 1 | 2333 | --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_quest_force_sensitive_theater_datapad = object_tangible_loot_quest_force_sensitive_shared_theater_datapad:new {
objectMenuComponent = {"cpp", "WaypointDatapadMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_loot_quest_force_sensitive_theater_datapad, "object/tangible/loot/quest/force_sensitive/theater_datapad.iff")
| lgpl-3.0 |
MrAnTiFuN/s-group | plugins/supergroup.lua | 2 | 95094 | local function check_member_super(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
if type(result) == 'boolean' then
print('This is a old message!')
return reply_msg(msg.id, '[Not supported] This is a old message!', ok_cb, false)
end
if success == 0 then
send_large_msg(receiver, "Promote me to admin first!")
end
for k,v in pairs(result) do
local member_id = v.peer_id
if member_id ~= our_id then
-- SuperGroup configuration
data[tostring(msg.to.id)] = {
group_type = 'SuperGroup',
long_id = msg.to.peer_id,
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.title, '_', ' '),
lock_arabic = 'no',
lock_link = "no",
flood = 'no',
lock_spam = 'no',
lock_sticker = 'no',
member = 'no',
public = 'no',
lock_rtl = 'no',
lock_tgservice = 'yes',
lock_contacts = 'no',
strict = 'no'
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
local text = '👽ربات در گروه فعال شد!'
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Check Members #rem supergroup
local function check_member_superrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
if type(result) == 'boolean' then
print('This is a old message!')
return reply_msg(msg.id, '[Not supported] This is a old message!', ok_cb, false)
end
for k,v in pairs(result) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local text = 'SuperGroup has been removed'
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Function to Add supergroup
local function superadd(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_super,{receiver = receiver, data = data, msg = msg})
end
--Function to remove supergroup
local function superrem(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_superrem,{receiver = receiver, data = data, msg = msg})
end
--Get and output admins and bots in supergroup
local function callback(cb_extra, success, result)
local i = 1
local chat_name = string.gsub(cb_extra.msg.to.print_name, "_", " ")
local member_type = cb_extra.member_type
local text = member_type.." for "..chat_name..":\n"
for k,v in pairsByKeys(result) do
if not v.first_name then
name = " "
else
vname = v.first_name:gsub("", "")
name = vname:gsub("_", " ")
end
text = text.."\n"..i.." - "..name.."["..v.peer_id.."]"
i = i + 1
end
send_large_msg(cb_extra.receiver, text)
end
local function callback_clean_bots (extra, success, result)
local msg = extra.msg
local receiver = 'channel#id'..msg.to.id
local channel_id = msg.to.id
for k,v in pairs(result) do
local bot_id = v.peer_id
kick_user(bot_id,channel_id)
end
end
--Get and output info about supergroup
local function callback_info(cb_extra, success, result)
local title ="Info for SuperGroup: ["..result.title.."]\n\n"
local admin_num = "Admin count: "..result.admins_count.."\n"
local user_num = "User count: "..result.participants_count.."\n"
local kicked_num = "Kicked user count: "..result.kicked_count.."\n"
local channel_id = "ID: "..result.peer_id.."\n"
if result.username then
channel_username = "Username: @"..result.username
else
channel_username = ""
end
local text = title..admin_num..user_num..kicked_num..channel_id..channel_username
send_large_msg(cb_extra.receiver, text)
end
--Get and output members of supergroup
local function callback_who(cb_extra, success, result)
local text = "Members for "..cb_extra.receiver
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
username = " @"..v.username
else
username = ""
end
text = text.."\n"..i.." - "..name.." "..username.." [ "..v.peer_id.." ]\n"
--text = text.."\n"..username
i = i + 1
end
local file = io.open("./groups/lists/supergroups/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/"..cb_extra.receiver..".txt", ok_cb, false)
post_msg(cb_extra.receiver, text, ok_cb, false)
end
--Get and output list of kicked users for supergroup
local function callback_kicked(cb_extra, success, result)
--vardump(result)
local text = "Kicked Members for SuperGroup "..cb_extra.receiver.."\n\n"
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
name = name.." @"..v.username
end
text = text.."\n"..i.." - "..name.." [ "..v.peer_id.." ]\n"
i = i + 1
end
local file = io.open("./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", ok_cb, false)
--send_large_msg(cb_extra.receiver, text)
end
--Begin supergroup locks
local function lock_group_username(msg, data, target)
if not is_momod(msg) then
return reply_msg(msg.id,"\n<b>شما مدیر نیستید! </b>", ok_cb, false)
end
local group_username_lock = data[tostring(target)]['settings']['username']
if group_username_lock == 'yes' then
return '🔹یوزر نیم قفل است'
else
data[tostring(target)]['settings']['username'] = 'yes'
save_data(_config.moderation.data, data)
return '🔹یوزر نیم قفل شد'
end
end
local function unlock_group_username(msg, data, target)
if not is_momod(msg) then
return reply_msg(msg.id,"\n<b>شما مدیر نیستید! </b>", ok_cb, false)
end
local group_username_lock = data[tostring(target)]['settings']['username']
if group_username_lock == 'no' then
return '🔹قفل یوزر نیم غیرفعال شد'
else
data[tostring(target)]['settings']['username'] = 'no'
save_data(_config.moderation.data, data)
return '🔹قفل یوزر نیم غیرفعال شد'
end
end
local function lock_group_inline(msg, data, target)
if not is_momod(msg) then
return reply_msg(msg.id,"\n", ok_cb, false)
end
local group_inline_lock = data[tostring(target)]['settings']['inline']
if group_inline == 'yes' then
return '🔹تبلیغات شیشه ای و هایپرلینک قفل شدند'
else
data[tostring(target)]['settings']['inline'] = 'yes'
save_data(_config.moderation.data, data)
return '🔹تبلیغات شیشه ای و هایپرلینک قفل شدند'
end
end
local function unlock_group_inline(msg, data, target)
if not is_momod(msg) then
return reply_msg(msg.id,"\n", ok_cb, false)
end
local group_inline_lock = data[tostring(target)]['settings']['inline']
if group_inline_lock == 'no' then
return '🔹قفل تبلیغات شیشه ای و هایپرلینک غیرفعال شد'
else
data[tostring(target)]['settings']['inline'] = 'no'
save_data(_config.moderation.data, data)
return '🔹قفل تبلیغات شیشه ای و هایپرلینک غیرفعال شد'
end
end
local function lock_group_links(msg, data, target)
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'yes' then
return '✅ ارسال لینک در حال حاضر قفل است'
else
data[tostring(target)]['settings']['lock_link'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ ارسال لینک قفل شد'
end
end
local function unlock_group_links(msg, data, target)
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'no' then
return '✅ ارسال لینک آزاد است'
else
data[tostring(target)]['settings']['lock_link'] = 'no'
save_data(_config.moderation.data, data)
return '✅ ارسال لینک آزاد شد'
end
end
local function lock_group_operator(msg, data, target)
if not is_momod(msg) then
return
end
local group_operator_lock = data[tostring(target)]['settings']['operator']
if group_operator_lock == 'yes' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return ' 🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)فعال بود🔒'
else
return '🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)فعال بود🔒'
end
end
data[tostring(target)]['settings']['operator'] = 'yes'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return ' 🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)فعال شد🔒'
else
return '🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)فعال شد🔒'
end
end
local function unlock_group_operator(msg, data, target)
if not is_momod(msg) then
return
end
local group_operator_lock = data[tostring(target)]['settings']['operator']
if group_operator_lock == 'no' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return ' 🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)غیرفعال بود🔒'
else
return '🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)غیرفعال بود🔒'
end
end
data[tostring(target)]['settings']['operator'] = 'no'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return ' 🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)غیرفعال شد🔒'
else
return '🔐قُفل تبلیغات شارژ(ایرانسل،همراه،رایتل)غیرفعال شد🔒'
end
end
local function lock_group_fosh(msg, data, target)
if not is_momod(msg) then
return
end
local group_fosh_lock = data[tostring(target)]['settings']['fosh']
if group_fosh_lock == 'yes' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه فعاڶ شُده بۅد🔒'
else
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه فعاڶ شُده بۅد🔒'
end
end
data[tostring(target)]['settings']['fosh'] = 'yes'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه فعاڶ شُد🔒'
else
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه فعاڶ شُد🔒'
end
end
local function unlock_group_fosh(msg, data, target)
if not is_momod(msg) then
return
end
local group_fosh_lock = data[tostring(target)]['settings']['fosh']
if group_fosh_lock == 'no' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه غیږ فعاڶ شُدة بۅڊ🔓'
else
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه غیږ فعاڶ شُدة بۅڊ🔓'
end
end
data[tostring(target)]['settings']['fosh'] = 'no'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه غیږ فعاڶ شُد🔓'
else
return '🔐فیلتږینگ کلماټ +18 دږ سوپږ گږۅه غیږ فعاڶ شُد🔓'
end
end
local function lock_group_spam(msg, data, target)
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Owners only!"
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'yes' then
return '✅ اسپم فعال است . پیام های طولانی پاک خواهند شد'
else
data[tostring(target)]['settings']['lock_spam'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ اسپم فعال شد . پیام های طولانی پاک خواهند شد '
end
end
local function unlock_group_spam(msg, data, target)
if not is_momod(msg) then
return
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'no' then
return '✅ اسپم غیرفعال است'
else
data[tostring(target)]['settings']['lock_spam'] = 'no'
save_data(_config.moderation.data, data)
return '✅ اسپم غیرفعال شد'
end
end
local function lock_group_flood(msg, data, target)
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return '✅ فلود فعال است - پیام های رگباری پاک میشوند'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ فلود فعال شد - پیام های رگباری پاک میشوند'
end
end
local function unlock_group_flood(msg, data, target)
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return '✅ فلود غیرفعال است '
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return '✅ فلود غیرفعال شد '
end
end
local function lock_group_welcome(msg, data, target)
if not is_momod(msg) then
return "شما مدیر گروه نیستید"
end
local welcoms = data[tostring(target)]['settings']['welcome']
if welcoms == 'yes' then
return 'پیام خوش امد گویی فعال است'
else
data[tostring(target)]['settings']['welcome'] = 'yes'
save_data(_config.moderation.data, data)
return 'پیام خوش امد گویی فعال شد\nبرای تغییر این پیام از دستور زیر استفاده کنید\n/set welcome <welcomemsg>'
end
end
local function unlock_group_welcome(msg, data, target)
if not is_momod(msg) then
return "شما مدیر گروه نیستید"
end
local welcoms = data[tostring(target)]['settings']['welcome']
if welcoms == 'no' then
return 'پیام خوش امد گویی غیر فعال است'
else
data[tostring(target)]['settings']['welcome'] = 'no'
save_data(_config.moderation.data, data)
return 'پیام خوش امد گویی غیر فعال شد'
end
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return '✅ زبان فارسی و عربی قفل شد - اخطار : پیام های فارسی پاک خواهند شد'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ زبان فارسی و عربی قفل شد - اخطار : پیام های فارسی پاک خواهند شد'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return '✅ قفل زبان فارسی و عربی باز است '
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return '✅ قفل زبان فارسی و عربی باز شد '
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return '✅ اعضا قفل هستند'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return '✅ اعضا قفل شدند - اخطار : کسی نمیتواند به گروه وارد شود'
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return '✅ قفل اعضا غیرفعال است'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return '✅ قفل اعضا غیرفعال شد'
end
end
local function lock_group_rtl(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'yes' then
return '✅ متون راست چین قفل است - اخطار : کاربران نمیتوانند فارسی تایپ کنند'
else
data[tostring(target)]['settings']['lock_rtl'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ متون راست چین قفل شد - اخطار : کاربران نمیتوانند فارسی تایپ کنند'
end
end
local function unlock_group_rtl(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'no' then
return '✅ قفل متون راست چین غیرفعال است '
else
data[tostring(target)]['settings']['lock_rtl'] = 'no'
save_data(_config.moderation.data, data)
return '✅ قفل متون راست چین غیرفعال شد '
end
end
local function lock_group_tgservice(msg, data, target)
if not is_momod(msg) then
return
end
local group_tgservice_lock = data[tostring(target)]['settings']['lock_tgservice']
if group_tgservice_lock == 'yes' then
return 'Tgservice is already locked'
else
data[tostring(target)]['settings']['lock_tgservice'] = 'yes'
save_data(_config.moderation.data, data)
return 'Tgservice has been locked'
end
end
local function unlock_group_tgservice(msg, data, target)
if not is_momod(msg) then
return
end
local group_tgservice_lock = data[tostring(target)]['settings']['lock_tgservice']
if group_tgservice_lock == 'no' then
return 'TgService Is Not Locked!'
else
data[tostring(target)]['settings']['lock_tgservice'] = 'no'
save_data(_config.moderation.data, data)
return 'Tgservice has been unlocked'
end
end
local function lock_group_sticker(msg, data, target)
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'yes' then
return '✅ ارسال استیکر برای کاربران قفل است'
else
data[tostring(target)]['settings']['lock_sticker'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ ارسال استیکر برای کاربران قفل شد'
end
end
local function unlock_group_sticker(msg, data, target)
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'no' then
return '✅ قفل ارسال استیکر برای کاربران باز است '
else
data[tostring(target)]['settings']['lock_sticker'] = 'no'
save_data(_config.moderation.data, data)
return '✅ قفل ارسال استیکر برای کاربران باز شد '
end
end
local function lock_group_fwd(msg, data, target)
if not is_momod(msg) then
return
end
local group_fwd_lock = data[tostring(target)]['settings']['lock_fwd']
if group_fosh_lock == 'yes' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return ' 🔐قُفل فۅږواږد دږ سوپږ گرۅه فعال بود🔒'
else
return '🔐قُفل فۅږواږد دږ سوپږ گرۅه فعال بود🔒'
end
end
data[tostring(target)]['settings']['lock_fwd'] = 'yes'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐قفل فۅږۅاږد دږ سۅپږ گږۅة فعاڶ شُد🔒'
else
return ' 🔐قفل فۅږۅاږد دږ سۅپږ گږۅة فعاڶ شُد🔒'
end
end
local function unlock_group_fwd(msg, data, target)
if not is_momod(msg) then
return
end
local group_fwd_lock = data[tostring(target)]['settings']['lock_fwd']
if group_fwd_lock == 'no' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐قفل فۅږۅاږد دږ سۅپږگږۅة از قبل غیږ فعاڶ شُدہ بۅڍ🔒'
else
return ' 🔓Fwd is not locked🔓'
end
end
data[tostring(target)]['settings']['lock_fwd'] = 'no'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐قفل فۅږۅاږد دږ سۅپږ گږۅة غیرفعاڶ شُد🔒'
else
return ' 🔓Fwd has been unlocked🔓'
end
end
local function lock_group_cmds(msg, data, target)
if not is_momod(msg) then
return
end
local group_cmds_lock = data[tostring(target)]['settings']['cmds']
if group_cmds_lock == 'yes' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐زدن دستورات توسط کاربران قفل شد🔒'
else
return '🔒Username is already locked🔒'
end
end
data[tostring(target)]['settings']['cmds'] = 'yes'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐زدن دستورات توسط کاربران قفل شد🔒'
else
return '🔒Username has been locked🔒'
end
end
local function unlock_group_cmds(msg, data, target)
if not is_momod(msg) then
return
end
local group_cmds_lock = data[tostring(target)]['settings']['cmds']
if group_cmds_lock == 'no' then
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐کاربران میتوانند دستور برای ربات ارسال کنند . فقط دستورات فان🔒'
else
return '🔓کاربران میتوانند دستور برای ربات ارسال کنند . فقط دستورات فان🔓'
end
end
data[tostring(target)]['settings']['cmds'] = 'no'
save_data(_config.moderation.data, data)
local hash = 'group:'..msg.to.id
local group_lang = redis:hget(hash,'lang')
if group_lang then
return '🔐کاربران میتوانند دستور برای ربات ارسال کنند . فقط دستورات فان🔒'
else
return '🔓کاربران میتوانند دستور برای ربات ارسال کنند . فقط دستورات فان🔓'
end
end
local function lock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_contacts_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'yes' then
return '✅ ارسال اطلاعات تماس قفل شد - گزینه کانتکت تلگرام'
else
data[tostring(target)]['settings']['lock_contacts'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ ارسال اطلاعات تماس قفل شد - گزینه کانتکت تلگرام'
end
end
local function unlock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_contacts_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'no' then
return '✅ قفل ارسال اطلاعات تماس غیرفعال شد - گزینه کانتکت تلگرام'
else
data[tostring(target)]['settings']['lock_contacts'] = 'no'
save_data(_config.moderation.data, data)
return '✅ قفل ارسال اطلاعات تماس غیرفعال شد - گزینه کانتکت تلگرام'
end
end
local function enable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'yes' then
return '✅ ربات در حالت سختگیرانه قرار گرفت - اخطار : اگر کاربری خطایی بکند بلافاصله حذف خواهد شد '
else
data[tostring(target)]['settings']['strict'] = 'yes'
save_data(_config.moderation.data, data)
return '✅ ربات در حالت سختگیرانه قرار گرفت - اخطار : اگر کاربری خطایی بکند بلافاصله حذف خواهد شد '
end
end
local function disable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'no' then
return '✅ ربات از حالت سختگیرانه خارج شد - اگر کاربر خطایی بکند فقط پیغام او حذف خواهد شد '
else
data[tostring(target)]['settings']['strict'] = 'no'
save_data(_config.moderation.data, data)
return '✅ ربات از حالت سختگیرانه خارج شد - اگر کاربر خطایی بکند فقط پیغام او حذف خواهد شد '
end
end
--End supergroup locks
--'Set supergroup rules' function
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return '✅ قوانین ثبت شد '
end
--'Get supergroup rules' function
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return '❌شما قوانینی را ثبت نکرده اید جهت ثبت قوانین دستور #setrules را وارد کنید.'
end
local rules = data[tostring(msg.to.id)][data_cat]
local group_name = data[tostring(msg.to.id)]['settings']['set_name']
local rules = group_name..' rules:\n\n'..rules:gsub("/n", " ")
return rules
end
--Set supergroup to public or not public function
local function set_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'yes' then
return '✅ گروه عمومی است'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return '✅ گروه عمومی است'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'no' then
return '✅ گروه خصوصی است'
else
data[tostring(target)]['settings']['public'] = 'no'
data[tostring(target)]['long_id'] = msg.to.long_id
save_data(_config.moderation.data, data)
return '✅ گروه خصوصی است'
end
end
--Show supergroup settings; function
function show_supergroup_settingsmod(msg, target)
if not is_momod(msg) then
return
end
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
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['public'] then
data[tostring(target)]['settings']['public'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['photo'] then
data[tostring(target)]['settings']['photo'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_rtl'] then
data[tostring(target)]['settings']['lock_rtl'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['tag'] then
data[tostring(target)]['settings']['tag'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['username'] then
data[tostring(target)]['settings']['username'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_fwd'] then
data[tostring(target)]['settings']['lock_fwd'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['inline'] then
data[tostring(target)]['settings']['inline'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_tgservice'] then
data[tostring(target)]['settings']['lock_tgservice'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_member'] then
data[tostring(target)]['settings']['lock_member'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['operator'] then
data[tostring(target)]['settings']['operator'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['fosh'] then
data[tostring(target)]['settings']['fosh'] = 'no'
end
end
if is_muted(tostring(target), 'Audio: yes') then
Audio = 'yes'
else
Audio = 'no'
end
if is_muted(tostring(target), 'Photo: yes') then
Photo = 'yes'
else
Photo = 'no'
end
if is_muted(tostring(target), 'Video: yes') then
Video = 'yes'
else
Video = 'no'
end
if is_muted(tostring(target), 'Gifs: yes') then
Gifs = 'yes'
else
Gifs = 'no'
end
if is_muted(tostring(target), 'Documents: yes') then
Documents = 'yes'
else
Documents = 'no'
end
if is_muted(tostring(target), 'Text: yes') then
Text = 'yes'
else
Text = 'no'
end
if is_muted(tostring(target), 'All: yes') then
All = 'yes'
else
All = 'no'
end
local settings = data[tostring(target)]['settings']
local text = "⚙نمایش تنظیمات گروه ⚙:\n =============== \n🔒قفل لینک : "..settings.lock_link.."\n🔒قفل پست رگباری: "..settings.flood.."\n🔒حداکثر پست رگباری : "..NUM_MSG_MAX.."\n🔒قفل اسپم: "..settings.lock_spam.."\n🔒قفل عربی و فارسی: "..settings.lock_arabic.."\n🔒قفل اعضا: "..settings.lock_member.."\n🔒قفل راستچین: "..settings.lock_rtl.."\n🔒قفل استیکر: "..settings.lock_sticker.."\n________________ \n🔒حالت سختگیرانه: "..settings.strict.."\n🔒 قفل یوزر نیم: "..settings.username.."\n🔒قفل فوروارد: "..settings.lock_fwd.."\n🔒قفل فحش: "..settings.fosh.."\n🔒قفل اپراتور: "..settings.operator.."\n🔒 قفل اینلاین: "..settings.inline.."\n🔒 قفل اطلاعات تماس: "..settings.lock_contacts.."\n🔒 قفل پیام ورود کاربر: "..settings.lock_tgservice.."\n🔒 قفل متن: "..Text.."\n🔒 قفل موزیک: "..Audio.."\n🔒 قفل ویدیو: "..Video.."\n🔒 قفل فایل: ".. Documents.."\n🔒 قفل عکس: "..Photo.."\n🔒 عکس های متحرک: "..Gifs.."\n🔒 قفل همه: "..All.."\n.."
return text
end
local function promote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' در حال حاضر ناظر است 👽')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
end
local function demote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..' در حال حاضر ناظر نیست 👽')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
end
local function promote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return send_large_msg(receiver, '❌سوپر گروه ادد نشده')
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' در حال حاضر ناظر است 👽.')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' ✅ ترفیع گرفت')
end
local function demote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return send_large_msg(receiver, '❌سوپر گروه ادد نشده')
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..' ❌ناظری وجود ندارد')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' ✅ ترفیع لغو شد.')
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'SuperGroup is not added.'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then
return '❌در این گروه ناظری وجود ندارد.'
end
local i = 1
local message = '👽لیست ناظرین گروه ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
-- Start by reply actions
function get_message_callback(extra, success, result)
local get_cmd = extra.get_cmd
local msg = extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
if type(result) == 'boolean' then
print('This is a old message!')
return
end
if get_cmd == "id" and not result.action then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for: ["..result.from.peer_id.."]")
id1 = send_large_msg(channel, result.from.peer_id)
elseif get_cmd == 'id' and result.action then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
else
user_id = result.peer_id
end
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id by service msg for: ["..user_id.."]")
id1 = send_large_msg(channel, user_id)
end
elseif get_cmd == "idfrom" then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for msg fwd from: ["..result.fwd_from.peer_id.."]")
id2 = send_large_msg(channel, result.fwd_from.peer_id)
elseif get_cmd == 'channel_block' and not result.action then
local member_id = result.from.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "👽تو نمیتوانی دیگر مدیران را حذف کنی")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "👽تو نمیتوانی دیگر مدیران را حذف کنی")
end
--savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply")
kick_user(member_id, channel_id)
elseif get_cmd == 'channel_block' and result.action and result.action.type == 'chat_add_user' then
local user_id = result.action.user.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "👽تو نمیتوانی دیگر مدیران را حذف کنی")
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply to sev. msg.")
kick_user(user_id, channel_id)
elseif get_cmd == "del" then
delete_msg(result.id, ok_cb, false)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted a message by reply")
elseif get_cmd == "setadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
channel_set_admin(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." set as an admin"
else
text = "[ "..user_id.." ]set as an admin"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..user_id.."] as admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "demoteadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
if is_admin2(result.from.peer_id) then
return send_large_msg(channel_id, "👽تو نمیتوانی رتبه مدیر اصلی را پایین بیاوری!")
end
channel_demote(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." 👽از مدیریت برداشته شد"
else
text = "[ "..user_id.." ] 👽از مدیریت برداشته شد"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted: ["..user_id.."] from admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "setowner" then
local group_owner = data[tostring(result.to.peer_id)]['set_owner']
if group_owner then
local channel_id = 'channel#id'..result.to.peer_id
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(channel_id, user, ok_cb, false)
end
local user_id = "user#id"..result.from.peer_id
channel_set_admin(channel_id, user_id, ok_cb, false)
data[tostring(result.to.peer_id)]['set_owner'] = tostring(result.from.peer_id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..result.from.peer_id.."] as owner by reply")
if result.from.username then
text = "@"..result.from.username.." [ "..result.from.peer_id.." ] added as owner"
else
text = "[ "..result.from.peer_id.." ] added as owner"
end
send_large_msg(channel_id, text)
end
elseif get_cmd == "promote" then
local receiver = result.to.peer_id
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
if result.to.peer_type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted mod: @"..member_username.."["..result.from.peer_id.."] by reply")
promote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_set_mod(channel_id, user, ok_cb, false)
end
elseif get_cmd == "demote" then
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
--local user = "user#id"..result.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted mod: @"..member_username.."["..user_id.."] by reply")
demote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_demote(channel_id, user, ok_cb, false)
elseif get_cmd == 'mute_user' then
if result.service then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
end
end
if action == 'chat_add_user_link' then
if result.from then
user_id = result.from.peer_id
end
end
else
user_id = result.from.peer_id
end
local receiver = extra.receiver
local chat_id = msg.to.id
print(user_id)
print(chat_id)
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, "["..user_id.."] removed from the muted user list")
elseif is_admin1(msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] added to the muted user list")
end
end
end
-- End by reply actions
--By ID actions
local function cb_user_info(extra, success, result)
local receiver = extra.receiver
local user_id = result.peer_id
local get_cmd = extra.get_cmd
local data = load_data(_config.moderation.data)
--[[if get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
else
text = "[ "..result.peer_id.." ] has been set as an admin"
end
send_large_msg(receiver, text)]]
if get_cmd == "demoteadmin" then
if is_admin2(result.peer_id) then
return send_large_msg(receiver, "You can't demote global admins!")
end
local user_id = "user#id"..result.peer_id
channel_demote(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(receiver, text)
else
text = "[ "..result.peer_id.." ] has been demoted from admin"
send_large_msg(receiver, text)
end
elseif get_cmd == "promote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
promote2(receiver, member_username, user_id)
elseif get_cmd == "demote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
demote2(receiver, member_username, user_id)
end
end
-- Begin resolve username actions
local function callbackres(extra, success, result)
local member_id = result.peer_id
local member_username = "@"..result.username
local get_cmd = extra.get_cmd
if get_cmd == "res" then
local user = result.peer_id
local name = string.gsub(result.print_name, "_", " ")
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user..'\n'..name)
return user
elseif get_cmd == "id" then
local user = result.peer_id
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user)
return user
elseif get_cmd == "invite" then
local receiver = extra.channel
local user_id = "user#id"..result.peer_id
channel_invite(receiver, user_id, ok_cb, false)
--[[elseif get_cmd == "channel_block" then
local user_id = result.peer_id
local channel_id = extra.channelid
local sender = extra.sender
if member_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
kick_user(user_id, channel_id)
elseif get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
channel_set_admin(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been set as an admin"
send_large_msg(channel_id, text)
end
elseif get_cmd == "setowner" then
local receiver = extra.channel
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = extra.from_id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
local user = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(result.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.." ["..from_id.."] set ["..result.peer_id.."] as owner by username")
if result.username then
text = member_username.." [ "..result.peer_id.." ] added as owner"
else
text = "[ "..result.peer_id.." ] added as owner"
end
send_large_msg(receiver, text)
end]]
elseif get_cmd == "promote" then
local receiver = extra.channel
local user_id = result.peer_id
--local user = "user#id"..result.peer_id
promote2(receiver, member_username, user_id)
--channel_set_mod(receiver, user, ok_cb, false)
elseif get_cmd == "demote" then
local receiver = extra.channel
local user_id = result.peer_id
local user = "user#id"..result.peer_id
demote2(receiver, member_username, user_id)
elseif get_cmd == "demoteadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
if is_admin2(result.peer_id) then
return send_large_msg(channel_id, "You can't demote global admins!")
end
channel_demote(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been demoted from admin"
send_large_msg(channel_id, text)
end
local receiver = extra.channel
local user_id = result.peer_id
demote_admin(receiver, member_username, user_id)
elseif get_cmd == 'mute_user' then
local user_id = result.peer_id
local receiver = extra.receiver
local chat_id = string.gsub(receiver, 'channel#id', '')
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] ✅ از لیست کاربران ساکت شده برداشته شد")
elseif is_owner(extra.msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] ✅ به لیست کاربران ساکت شده اضافه شد")
end
end
end
--End resolve username actions
--Begin non-channel_invite username actions
local function in_channel_cb(cb_extra, success, result)
local get_cmd = cb_extra.get_cmd
local receiver = cb_extra.receiver
local msg = cb_extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(cb_extra.msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local member = cb_extra.username
local memberid = cb_extra.user_id
if member then
text = 'No user @'..member..' در این سوپر گروه.'
else
text = 'No user ['..memberid..'] در این سوپر گروه.'
end
if get_cmd == "channel_block" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = v.peer_id
local channel_id = cb_extra.msg.to.id
local sender = cb_extra.msg.from.id
if user_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(user_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(user_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
if v.username then
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..v.username.." ["..v.peer_id.."]")
else
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..v.peer_id.."]")
end
kick_user(user_id, channel_id)
return
end
end
elseif get_cmd == "setadmin" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = "user#id"..v.peer_id
local channel_id = "channel#id"..cb_extra.msg.to.id
channel_set_admin(channel_id, user_id, ok_cb, false)
if v.username then
text = "@"..v.username.." ["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..v.username.." ["..v.peer_id.."]")
else
text = "["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin "..v.peer_id)
end
if v.username then
member_username = "@"..v.username
else
member_username = string.gsub(v.print_name, '_', ' ')
end
local receiver = channel_id
local user_id = v.peer_id
promote_admin(receiver, member_username, user_id)
end
send_large_msg(channel_id, text)
return
end
elseif get_cmd == 'setowner' then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..v.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(v.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..v.peer_id.."] as owner by username")
if result.username then
text = member_username.." ["..v.peer_id.."] added as owner"
else
text = "["..v.peer_id.."] added as owner"
end
end
elseif memberid and vusername ~= member and vpeer_id ~= memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
data[tostring(channel)]['set_owner'] = tostring(memberid)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..memberid.."] as owner by username")
text = "["..memberid.."] added as owner"
end
end
end
end
send_large_msg(receiver, text)
end
--End non-channel_invite username actions
--'Set supergroup photo' function
local function set_supergroup_photo(msg, success, result)
local data = load_data(_config.moderation.data)
if not data[tostring(msg.to.id)] then
return
end
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/channel_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
channel_set_photo(receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'Photo saved!', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
--Run function
local function run(msg, matches)
if msg.to.type == 'chat' then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
local receiver = get_receiver(msg)
chat_upgrade(receiver, ok_cb, false)
end
elseif msg.to.type == 'channel'then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
return "Already a SuperGroup"
end
end
if msg.to.type == 'channel' then
local support_id = msg.from.id
local receiver = get_receiver(msg)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local data = load_data(_config.moderation.data)
if matches[1] == 'add' and not matches[2] then
if not is_admin1(msg) and not is_support(support_id) then
return
end
if is_super_group(msg) then
return reply_msg(msg.id, '👽ربات در گروه فعال است', ok_cb, false)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") added")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] added SuperGroup")
superadd(msg)
set_mutes(msg.to.id)
channel_set_admin(receiver, 'user#id'..msg.from.id, ok_cb, false)
end
if matches[1] == 'rem' and is_admin1(msg) and not matches[2] then
if not is_super_group(msg) then
return reply_msg(msg.id, 'SuperGroup is not added.', ok_cb, false)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") removed")
superrem(msg)
rem_mutes(msg.to.id)
end
if not data[tostring(msg.to.id)] then
return
end
if matches[1] == "info" then
if not is_owner(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup info")
channel_info(receiver, callback_info, {receiver = receiver, msg = msg})
end
if matches[1] == "admins" then
if not is_owner(msg) and not is_support(msg.from.id) then
return
end
member_type = 'Admins'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup Admins list")
admins = channel_get_admins(receiver,callback, {receiver = receiver, msg = msg, member_type = member_type})
end
if matches[1] == "owner" then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
return "no owner,ask admins in support groups to set owner for your SuperGroup"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
return "SuperGroup owner is ["..group_owner..']'
end
if matches[1] == "modlist" then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
-- channel_get_admins(receiver,callback, {receiver = receiver})
end
if matches[1] == "bots" and is_momod(msg) then
member_type = 'Bots'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup bots list")
channel_get_bots(receiver, callback, {receiver = receiver, msg = msg, member_type = member_type})
end
if matches[1] == "who" and not matches[2] and is_momod(msg) then
local user_id = msg.from.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup users list")
channel_get_users(receiver, callback_who, {receiver = receiver})
end
if matches[1] == "kicked" and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested Kicked users list")
channel_get_kicked(receiver, callback_kicked, {receiver = receiver})
end
if matches[1] == 'del' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'del',
msg = msg
}
delete_msg(msg.id, ok_cb, false)
get_message(msg.reply_id, get_message_callback, cbreply_extra)
end
end
if matches[1] == 'block' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'channel_block',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'block' and matches[2] and string.match(matches[2], '^%d+$') then
--[[local user_id = matches[2]
local channel_id = msg.to.id
if is_momod2(user_id, channel_id) and not is_admin2(user_id) then
return send_large_msg(receiver, "You can't kick mods/owner/admins")
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: [ user#id"..user_id.." ]")
kick_user(user_id, channel_id)]]
local get_cmd = 'channel_block'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == "block" and matches[2] and not string.match(matches[2], '^%d+$') then
--[[local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'channel_block',
sender = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'channel_block'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'id' then
if type(msg.reply_id) ~= "nil" and is_momod(msg) and not matches[2] then
local cbreply_extra = {
get_cmd = 'id',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif type(msg.reply_id) ~= "nil" and matches[2] == "from" and is_momod(msg) then
local cbreply_extra = {
get_cmd = 'idfrom',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif msg.text:match("@[%a%d]") then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'id'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested ID for: @"..username)
resolve_username(username, callbackres, cbres_extra)
else
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup ID")
return "SuperGroup ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id
end
end
if matches[1] == 'kickme' then
if msg.to.type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] left via kickme")
channel_kick("channel#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false)
end
end
if matches[1] == 'newlink' and is_momod(msg)then
local function callback_link (extra , success, result)
local receiver = get_receiver(msg)
if success == 0 then
send_large_msg(receiver, '❌این گروه لینکی ندارد نخست باید لینک را بسازید')
data[tostring(msg.to.id)]['settings']['set_link'] = nil
save_data(_config.moderation.data, data)
else
send_large_msg(receiver, "✅ لینک جدید ساخته شد")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to create a new SuperGroup link")
export_channel_link(receiver, callback_link, false)
end
if matches[1] == 'setlink' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = 'waiting'
save_data(_config.moderation.data, data)
return 'Please send the new group link now'
end
if msg.text then
if msg.text:match("^([https?://w]*.?telegram.me/joinchat/%S+)$") and data[tostring(msg.to.id)]['settings']['set_link'] == 'waiting' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = msg.text
save_data(_config.moderation.data, data)
return "New link set"
end
end
if matches[1] == 'link' then
if not is_momod(msg) then
return
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "❌اگر ربات سازنده گروه نباشید نمیتواند لینک بسازد شما باید خودتان لینک را بسازید و سپس با دستور #setlink آن را به ربات بدهید"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
if matches[1] == "invite" and is_sudo(msg) then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = "invite"
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] invited @"..username)
resolve_username(username, callbackres, cbres_extra)
end
if matches[1] == 'res' and is_owner(msg) then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'res'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] resolved username: @"..username)
resolve_username(username, callbackres, cbres_extra)
end
--[[if matches[1] == 'kick' and is_momod(msg) then
local receiver = channel..matches[3]
local user = "user#id"..matches[2]
chaannel_kick(receiver, user, ok_cb, false)
end]]
if matches[1] == 'setadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'setadmin',
msg = msg
}
setadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'setadmin' and matches[2] and string.match(matches[2], '^%d+$') then
--[[] local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'setadmin'
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})]]
local get_cmd = 'setadmin'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'setadmin' and matches[2] and not string.match(matches[2], '^%d+$') then
--[[local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'setadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'setadmin'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'demoteadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demoteadmin',
msg = msg
}
demoteadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demoteadmin' and matches[2] and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demoteadmin'
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'demoteadmin' and matches[2] and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demoteadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted admin @"..username)
resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'setowner' and is_owner(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'setowner',
msg = msg
}
setowner = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'setowner' and matches[2] and string.match(matches[2], '^%d+$') then
--[[ local group_owner = data[tostring(msg.to.id)]['set_owner']
if group_owner then
local receiver = get_receiver(msg)
local user_id = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user_id, ok_cb, false)
end
local user = "user#id"..matches[2]
channel_set_admin(receiver, user, ok_cb, false)
data[tostring(msg.to.id)]['set_owner'] = tostring(matches[2])
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = "[ "..matches[2].." ] added as owner"
return text
end]]
local get_cmd = 'setowner'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'setowner' and matches[2] and not string.match(matches[2], '^%d+$') then
local get_cmd = 'setowner'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'promote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner/admin can promote"
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'promote',
msg = msg
}
promote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'promote' and matches[2] and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'promote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ارتقا یافت user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'promote' and matches[2] and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'promote',
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ارتقا یافت @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'mp' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_set_mod(channel, user_id, ok_cb, false)
return "ok"
end
if matches[1] == 'md' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_demote(channel, user_id, ok_cb, false)
return "ok"
end
if matches[1] == 'demote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner/support/admin can promote"
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demote',
msg = msg
}
demote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demote' and matches[2] and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تنزیل یافت user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'demote' and matches[2] and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demote'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تنزیل یافت @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == "setname" and is_momod(msg) then
local receiver = get_receiver(msg)
local set_name = string.gsub(matches[2], '_', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅نام گروه تغییر کرد به : "..matches[2])
rename_channel(receiver, set_name, ok_cb, false)
end
if msg.service and msg.action.type == 'chat_rename' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅نام گروه تغییر کرد به : "..msg.to.title)
data[tostring(msg.to.id)]['settings']['set_name'] = msg.to.title
save_data(_config.moderation.data, data)
end
if matches[1] == "setabout" and is_momod(msg) then
local receiver = get_receiver(msg)
local about_text = matches[2]
local data_cat = 'description'
local target = msg.to.id
data[tostring(target)][data_cat] = about_text
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅توضیحات گروه تغییر کرد: "..about_text)
channel_set_about(receiver, about_text, ok_cb, false)
return "Description has been set.\n\nSelect the chat again to see the changes."
end
if matches[1] == "setusername" and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "SuperGroup username Set.\n\nSelect the chat again to see the changes.")
elseif success == 0 then
send_large_msg(receiver, "Failed to set SuperGroup username.\nUsername may already be taken.\n\nNote: Username can use a-z, 0-9 and underscores.\nMinimum length is 5 characters.")
end
end
local username = string.gsub(matches[2], '@', '')
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
if matches[1] == 'setrules' and is_momod(msg) then
rules = matches[2]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ قوانین گروه تغییر کرد ["..matches[2].."]")
return set_rulesmod(msg, data, target)
end
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set new SuperGroup photo")
load_photo(msg.id, set_supergroup_photo, msg)
return
end
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] started setting new SuperGroup photo")
return 'Please send the new group photo now'
end
if matches[1] == 'clean' then
if not is_momod(msg) then
return
end
if not is_momod(msg) then
return "Only owner can clean"
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then
return 'No moderator(s) in this SuperGroup.'
end
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ لیست مدیران پاک شد")
return 'Modlist has been cleaned'
end
if matches[2] == 'rules' then
local data_cat = 'rules'
if data[tostring(msg.to.id)][data_cat] == nil then
return "Rules have not been set"
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ قوانین حذف شد")
return 'Rules have been cleaned'
end
if matches[2] == 'about' then
local receiver = get_receiver(msg)
local about_text = ' '
local data_cat = 'description'
if data[tostring(msg.to.id)][data_cat] == nil then
return 'About is not set'
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ توضیحات حذف شد")
channel_set_about(receiver, about_text, ok_cb, false)
return "About has been cleaned"
end
if matches[2] == 'mutelist' then
chat_id = msg.to.id
local hash = 'mute_user:'..chat_id
redis:del(hash)
return "همه اعضای ساکت شده ازاد شدند"
end
if matches[2] == 'username' and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "SuperGroup username cleaned.")
elseif success == 0 then
send_large_msg(receiver, "Failed to clean SuperGroup username.")
end
end
local username = ""
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
if matches[2] == "bots" and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تمام ربات های گروه حذف شدند")
channel_get_bots(receiver, callback_clean_bots, {msg = msg})
end
end
if matches[1] == 'lock' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ لینک ها قفل هستند ")
return lock_group_links(msg, data, target)
end
if matches[2] == 'tag' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تگ قفل شد ")
return lock_group_tag(msg, data, target)
end
if matches[2] == 'username' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] یوزر نیم قفل شد ")
return lock_group_username(msg, data, target)
end
if matches[2] == 'inline' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] اینلاین قفل شد ")
return lock_group_inline(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ اسپم قفل است ")
return lock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ پست رگباری قفل است ")
return lock_group_flood(msg, data, target)
end
if matches[2] == 'operator'or matches[2] =='اپراتور' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked operator")
return lock_group_operator(msg, data, target)
end
if matches[2] == 'fosh'or matches[2] =='فحش' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked fosh")
return lock_group_fosh(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ عربی و فارسی قفل است ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'cmd' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] دستورات قفل شد")
return lock_group_cmds(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ اعضا قفل هستند ")
return lock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ راستچین قفل است")
return lock_group_rtl(msg, data, target)
end
if matches[2] == 'fwd'or matches[2] =='فوروارد' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked fwd")
return lock_group_fwd(msg, data, target)
end
if matches[2] == 'tgservice' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked Tgservice Actions")
return lock_group_tgservice(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ ارسال استیکر قفل است ")
return lock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ ارسال اطلاعات شخصی قفل است ")
return lock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ✅ ربات در حالت سختگیرانه میباشد")
return enable_strict_rules(msg, data, target)
end
end
if matches[1] == 'unlock' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ لینک ها قفل نیستند")
return unlock_group_links(msg, data, target)
end
if matches[2] == 'tag' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تگ غیرفعال شد")
return unlock_group_tag(msg, data, target)
end
if matches[2] == 'username' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] یوزر نیم غیرفعال شد")
return unlock_group_username(msg, data, target)
end
if matches[2] == 'fosh'or matches[2] =='فحش' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked fosh")
return unlock_group_fosh(msg, data, target)
end
if matches[2] == 'operator'or matches[2] =='اپراتور' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked operator")
return unlock_group_operator(msg, data, target)
end
if matches[2] == 'username' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] یوزر نیم غیرفعال شد")
return unlock_group_username(msg, data, target)
end
if matches[2] == 'fwd'or matches[2] =='فوروارد' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked fwd")
return unlock_group_fwd(msg, data, target)
end
if matches[2] == 'inline' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] اینلاین غیر فعال شد")
return unlock_group_inline(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ اسپم قفل نیست")
return unlock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ پست رگباری قفل نیست")
return unlock_group_flood(msg, data, target)
end
if matches[2] == 'cmd' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] دستورات قفل نیست")
return unlock_group_cmds(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌عربی قفل نیست")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌اعضا قفل نیستند ")
return unlock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌راستچین قفل نیست")
return unlock_group_rtl(msg, data, target)
end
if matches[2] == 'tgservice' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked tgservice actions")
return unlock_group_tgservice(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ارسال استیکر قفل نیست")
return unlock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ارسال اطلاعات شخصی قفل نیست")
return unlock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] ❌ربات در حال سختگیرانه نمیباشد")
return disable_strict_rules(msg, data, target)
end
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] پست رگباری تنظیم شد به ["..matches[2].."]")
return 'Flood has been set to: '..matches[2]
end
if matches[1] == 'public' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] تنظیم سوپر گروه به : not public")
return unset_public_membermod(msg, data, target)
end
end
if matches[1] == 'mute' and is_owner(msg) then
local chat_id = msg.to.id
if matches[2] == 'audio' then
local msg_type = 'Audio'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." has been muted"
else
return "SuperGroup mute "..msg_type.." is already on"
end
end
if matches[2] == 'photo' then
local msg_type = 'Photo'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." has been muted"
else
return "SuperGroup mute "..msg_type.." is already on"
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." has been muted"
else
return "SuperGroup mute "..msg_type.." is already on"
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." have been muted"
else
return "SuperGroup mute "..msg_type.." is already on"
end
end
if matches[2] == 'documents' then
local msg_type = 'Documents'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." have been muted"
else
return "SuperGroup mute "..msg_type.." is already on"
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return msg_type.." has been muted"
else
return "Mute "..msg_type.." is already on"
end
end
if matches[2] == 'all' then
local msg_type = 'All'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return "Mute "..msg_type.." has been enabled"
else
return "Mute "..msg_type.." is already on"
end
end
end
if matches[1] == 'unmute' and is_momod(msg) then
local chat_id = msg.to.id
if matches[2] == 'audio' then
local msg_type = 'Audio'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return msg_type.." has been unmuted"
else
return "Mute "..msg_type.." is already off"
end
end
if matches[2] == 'photo' then
local msg_type = 'Photo'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return msg_type.." has been unmuted"
else
return "Mute "..msg_type.." is already off"
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return msg_type.." has been unmuted"
else
return "Mute "..msg_type.." is already off"
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return msg_type.." have been unmuted"
else
return "Mute "..msg_type.." is already off"
end
end
if matches[2] == 'documents' then
local msg_type = 'Documents'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return msg_type.." have been unmuted"
else
return "Mute "..msg_type.." is already off"
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute message")
unmute(chat_id, msg_type)
return msg_type.." has been unmuted"
else
return "Mute text is already off"
end
end
if matches[2] == 'all' then
local msg_type = 'All'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return "Mute "..msg_type.." has been disabled"
else
return "Mute "..msg_type.." is already disabled"
end
end
end
if matches[1] == "muteuser" and is_momod(msg) then
local chat_id = msg.to.id
local hash = "mute_user"..chat_id
local user_id = ""
if type(msg.reply_id) ~= "nil" then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
muteuser = get_message(msg.reply_id, get_message_callback, {receiver = receiver, get_cmd = get_cmd, msg = msg})
elseif matches[1] == "muteuser" and matches[2] and string.match(matches[2], '^%d+$') then
local user_id = matches[2]
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] حذف ["..user_id.."] از لیست کاربران ساکت شده")
return "["..user_id.."] از لیست ساکت شده ها حذف شد"
elseif is_owner(msg) then
mute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] اضافه شد ["..user_id.."] به لیست کابران ساکت شده")
return "["..user_id.."] اضافه شد به لیست ساکت شده ها"
end
elseif matches[1] == "muteuser" and matches[2] and not string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
resolve_username(username, callbackres, {receiver = receiver, get_cmd = get_cmd, msg=msg})
end
end
if matches[1] == "muteslist" and is_momod(msg) then
local chat_id = msg.to.id
if not has_mutes(chat_id) then
set_mutes(chat_id)
return mutes_list(chat_id)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup muteslist")
return mutes_list(chat_id)
end
if matches[1] == "mutelist" and is_momod(msg) then
local chat_id = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup mutelist")
return muted_user_list(chat_id)
end
if matches[1] == 'settings' and is_momod(msg) then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup settings ")
return show_supergroup_settingsmod(msg, target)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'help' and not is_owner(msg) then
text = "🔺اگر مشکلی دارید به کانال @Permag_bots مراجعه کنید"
reply_msg(msg.id, text, ok_cb, false)
elseif matches[1] == 'help' and is_owner(msg) then
local name_log = user_print_name(msg.from)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /superhelp")
return super_help()
end
if matches[1] == 'peer_id' and is_admin1(msg)then
text = msg.to.peer_id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
if matches[1] == 'msg.to.id' and is_admin1(msg) then
text = msg.to.id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
--Admin Join Service Message
if msg.service then
local action = msg.action.type
if action == 'chat_add_user_link' then
if is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Admin ["..msg.from.id.."] با لینک به گروه اضافه شد")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.from.id) and not is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Support member ["..msg.from.id.."] ضافه شد به گروه")
channel_set_mod(receiver, user, ok_cb, false)
end
end
if action == 'chat_add_user' then
if is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Admin ["..msg.action.user.id.."] اضافه شد به گروه به وسیله [ "..msg.from.id.." ]")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.action.user.id) and not is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Support member ["..msg.action.user.id.."] اضافه شد به گروه به وسیله [ "..msg.from.id.." ]")
channel_set_mod(receiver, user, ok_cb, false)
end
end
end
if matches[1] == 'msg.to.peer_id' then
post_large_msg(receiver, msg.to.peer_id)
end
end
end
local function pre_process(msg)
if not msg.text and msg.media then
msg.text = '['..msg.media.type..']'
end
return msg
end
return {
patterns = {
"^[#!/]([Aa]dd)$",
"^[#!/]([Rr]em)$",
"^[#!/]([Mm]ove) (.*)$",
"^[#!/]([Ii]nfo)$",
"^[#!/]([Aa]dmins)$",
"^[#!/]([Oo]wner)$",
"^[#!/]([Mm]odlist)$",
"^[#!/]([Bb]ots)$",
"^[#!/]([Ww]ho)$",
"^[#!/]([Kk]icked)$",
"^[#!/]([Bb]lock) (.*)",
"^[#!/]([Bb]lock)",
"^[#!/]([Tt]osuper)$",
"^[#!/]([Ii][Dd])$",
"^[#!/]([Ii][Dd]) (.*)$",
"^[#!/]([Kk]ickme)$",
"^[#!/]([Kk]ick) (.*)$",
"^[#!/]([Nn]ewlink)$",
"^[#!/]([Ss]etlink)$",
"^[#!/]([Ll]ink)$",
"^[#!/]([Rr]es) (.*)$",
"^[#!/]([Ss]etadmin) (.*)$",
"^[#!/]([Ss]etadmin)",
"^[#!/]([Dd]emoteadmin) (.*)$",
"^[#!/]([Dd]emoteadmin)",
"^[#!/]([Ss]etowner) (.*)$",
"^[#!/]([Ss]etowner)$",
"^[#!/]([Pp]romote) (.*)$",
"^[#!/]([Pp]romote)",
"^[#!/]([Dd]emote) (.*)$",
"^[#!/]([Dd]emote)",
"^[#!/]([Ss]etname) (.*)$",
"^[#!/]([Ss]etabout) (.*)$",
"^[#!/]([Ss]etrules) (.*)$",
"^[#!/]([Ss]etphoto)$",
"^[#!/]([Ss]etusername) (.*)$",
"^[#!/]([Dd]el)$",
"^[#!/]([Ll]ock) (.*)$",
"^[#!/]([Uu]nlock) (.*)$",
"^[#!/]([Mm]ute) ([^%s]+)$",
"^[#!/]([Uu]nmute) ([^%s]+)$",
"^[#!/]([Mm]uteuser)$",
"^[#!/]([Mm]uteuser) (.*)$",
"^[#!/]([Pp]ublic) (.*)$",
"^[#!/]([Ss]ettings)$",
"^[#!/]([Rr]ules)$",
"^[#!/]([Ss]etflood) (%d+)$",
"^[#!/]([Cc]lean) (.*)$",
"^[#!/]([Hh]elp)$",
"^[#!/]([Mm]uteslist)$",
"^[#!/]([Mm]utelist)$",
"[#!/](mp) (.*)",
"[#!/](md) (.*)",
"^([https?://w]*.?telegram.me/joinchat/%S+)$",
"msg.to.peer_id",
"%[(document)%]",
"%[(photo)%]",
"%[(video)%]",
"%[(audio)%]",
"%[(contact)%]",
"^!!tgservice (.+)$",
},
run = run,
pre_process = pre_process
}
--End supergrpup.lua
--By @permag_bots
| agpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/commands/applyDisease.lua | 4 | 2129 | --Copyright (C) 2007 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
--true = 1, false = 0
ApplyDiseaseCommand = {
name = "applydisease",
}
AddCommand(ApplyDiseaseCommand)
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/crafted/capacitor/capacitor_mk5.lua | 1 | 3124 | --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_capacitor_capacitor_mk5 = object_tangible_ship_crafted_capacitor_shared_capacitor_mk5:new {
numberExperimentalProperties = {1, 1, 2, 1, 2, 2, 1, 2, 2, 2},
experimentalProperties = {"XX", "XX", "OQ", "UT", "XX", "OQ", "UT", "OQ", "UT", "XX", "CD", "OQ", "CD", "OQ", "CD", "OQ"},
experimentalWeights = {1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1},
experimentalGroupTitles = {"null", "null", "exp_hp", "null", "exp_mass", "exp_armorhpmax", "null", "exp_energy_maintenance", "exp_cap_max_energy", "exp_recharge"},
experimentalSubGroupTitles = {"null", "null", "hitpointsmax", "efficiency", "mass", "armorhpmax", "energy_efficiency", "energy_maintenance", "cap_max_energy", "cap_recharge_rate"},
experimentalMin = {0, 0, 935, 1, 40365, 468, 1, 1380, 622, 25},
experimentalMax = {0, 0, 1265, 1, 29835, 633, 1, 1020, 842, 34},
experimentalPrecision = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_ship_crafted_capacitor_capacitor_mk5, "object/tangible/ship/crafted/capacitor/capacitor_mk5.iff")
| lgpl-3.0 |
fhaoquan/skynet | lualib/snax/loginserver.lua | 42 | 5057 | local skynet = require "skynet"
require "skynet.manager"
local socket = require "socket"
local crypt = require "crypt"
local table = table
local string = string
local assert = assert
--[[
Protocol:
line (\n) based text protocol
1. Server->Client : base64(8bytes random challenge)
2. Client->Server : base64(8bytes handshake client key)
3. Server: Gen a 8bytes handshake server key
4. Server->Client : base64(DH-Exchange(server key))
5. Server/Client secret := DH-Secret(client key/server key)
6. Client->Server : base64(HMAC(challenge, secret))
7. Client->Server : DES(secret, base64(token))
8. Server : call auth_handler(token) -> server, uid (A user defined method)
9. Server : call login_handler(server, uid, secret) ->subid (A user defined method)
10. Server->Client : 200 base64(subid)
Error Code:
400 Bad Request . challenge failed
401 Unauthorized . unauthorized by auth_handler
403 Forbidden . login_handler failed
406 Not Acceptable . already in login (disallow multi login)
Success:
200 base64(subid)
]]
local socket_error = {}
local function assert_socket(service, v, fd)
if v then
return v
else
skynet.error(string.format("%s failed: socket (fd = %d) closed", service, fd))
error(socket_error)
end
end
local function write(service, fd, text)
assert_socket(service, socket.write(fd, text), fd)
end
local function launch_slave(auth_handler)
local function auth(fd, addr)
fd = assert(tonumber(fd))
skynet.error(string.format("connect from %s (fd = %d)", addr, fd))
socket.start(fd)
-- set socket buffer limit (8K)
-- If the attacker send large package, close the socket
socket.limit(fd, 8192)
local challenge = crypt.randomkey()
write("auth", fd, crypt.base64encode(challenge).."\n")
local handshake = assert_socket("auth", socket.readline(fd), fd)
local clientkey = crypt.base64decode(handshake)
if #clientkey ~= 8 then
error "Invalid client key"
end
local serverkey = crypt.randomkey()
write("auth", fd, crypt.base64encode(crypt.dhexchange(serverkey)).."\n")
local secret = crypt.dhsecret(clientkey, serverkey)
local response = assert_socket("auth", socket.readline(fd), fd)
local hmac = crypt.hmac64(challenge, secret)
if hmac ~= crypt.base64decode(response) then
write("auth", fd, "400 Bad Request\n")
error "challenge failed"
end
local etoken = assert_socket("auth", socket.readline(fd),fd)
local token = crypt.desdecode(secret, crypt.base64decode(etoken))
local ok, server, uid = pcall(auth_handler,token)
socket.abandon(fd)
return ok, server, uid, secret
end
local function ret_pack(ok, err, ...)
if ok then
skynet.ret(skynet.pack(err, ...))
else
if err == socket_error then
skynet.ret(skynet.pack(nil, "socket error"))
else
skynet.ret(skynet.pack(false, err))
end
end
end
skynet.dispatch("lua", function(_,_,...)
ret_pack(pcall(auth, ...))
end)
end
local user_login = {}
local function accept(conf, s, fd, addr)
-- call slave auth
local ok, server, uid, secret = skynet.call(s, "lua", fd, addr)
socket.start(fd)
if not ok then
if ok ~= nil then
write("response 401", fd, "401 Unauthorized\n")
end
error(server)
end
if not conf.multilogin then
if user_login[uid] then
write("response 406", fd, "406 Not Acceptable\n")
error(string.format("User %s is already login", uid))
end
user_login[uid] = true
end
local ok, err = pcall(conf.login_handler, server, uid, secret)
-- unlock login
user_login[uid] = nil
if ok then
err = err or ""
write("response 200",fd, "200 "..crypt.base64encode(err).."\n")
else
write("response 403",fd, "403 Forbidden\n")
error(err)
end
end
local function launch_master(conf)
local instance = conf.instance or 8
assert(instance > 0)
local host = conf.host or "0.0.0.0"
local port = assert(tonumber(conf.port))
local slave = {}
local balance = 1
skynet.dispatch("lua", function(_,source,command, ...)
skynet.ret(skynet.pack(conf.command_handler(command, ...)))
end)
for i=1,instance do
table.insert(slave, skynet.newservice(SERVICE_NAME))
end
skynet.error(string.format("login server listen at : %s %d", host, port))
local id = socket.listen(host, port)
socket.start(id , function(fd, addr)
local s = slave[balance]
balance = balance + 1
if balance > #slave then
balance = 1
end
local ok, err = pcall(accept, conf, s, fd, addr)
if not ok then
if err ~= socket_error then
skynet.error(string.format("invalid client (fd = %d) error = %s", fd, err))
end
socket.start(fd)
end
socket.close(fd)
end)
end
local function login(conf)
local name = "." .. (conf.name or "login")
skynet.start(function()
local loginmaster = skynet.localname(name)
if loginmaster then
local auth_handler = assert(conf.auth_handler)
launch_master = nil
conf = nil
launch_slave(auth_handler)
else
launch_slave = nil
conf.auth_handler = nil
assert(conf.login_handler)
assert(conf.command_handler)
skynet.register(name)
launch_master(conf)
end
end)
end
return login
| mit |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/sign/base/serverobjects.lua | 3 | 2096 | --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/sign/base/base_sign.lua")
| lgpl-3.0 |
eraffxi/darkstar | scripts/globals/abilities/curing_waltz_iii.lua | 2 | 2542 | -----------------------------------
-- Ability: Curing Waltz III
-- Heals HP to target player.
-- Obtained: Dancer Level 45
-- TP Required: 50%
-- Recast Time: 00:10
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/msg");
-----------------------------------
function onAbilityCheck(player,target,ability)
if (target:getHP() == 0) then
return dsp.msg.basic.CANNOT_ON_THAT_TARG,0;
elseif (player:hasStatusEffect(dsp.effect.SABER_DANCE)) then
return dsp.msg.basic.UNABLE_TO_USE_JA2, 0;
elseif (player:hasStatusEffect(dsp.effect.TRANCE)) then
return 0,0;
elseif (player:getTP() < 500) then
return dsp.msg.basic.NOT_ENOUGH_TP,0;
else
--[[ Apply "Waltz Ability Delay" reduction
1 modifier = 1 second]]
local recastMod = player:getMod(dsp.mod.WALTZ_DELAY);
if (recastMod ~= 0) then
local newRecast = ability:getRecast() +recastMod;
ability:setRecast(utils.clamp(newRecast,0,newRecast));
end
-- Apply "Fan Dance" Waltz recast reduction
if (player:hasStatusEffect(dsp.effect.FAN_DANCE)) then
local fanDanceMerits = target:getMerit(dsp.merit.FAN_DANCE);
-- Every tier beyond the 1st is -5% recast time
if (fanDanceMerits > 5) then
ability:setRecast(ability:getRecast() * ((fanDanceMerits -5)/100));
end
end
return 0,0;
end
end;
function onUseAbility(player,target,ability)
-- Only remove TP if the player doesn't have Trance.
if not player:hasStatusEffect(dsp.effect.TRANCE) then
player:delTP(500);
end;
--Grabbing variables.
local vit = target:getStat(dsp.mod.VIT);
local chr = player:getStat(dsp.mod.CHR);
local mjob = player:getMainJob(); --19 for DNC main.
local cure = 0;
--Performing mj check.
if (mjob == 19) then
cure = (vit+chr)*0.75+270;
else
cure = (vit+chr)*0.375+270;
end
-- apply waltz modifiers
cure = math.floor(cure * (1.0 + (player:getMod(dsp.mod.WALTZ_POTENTCY)/100)));
--Reducing TP.
--Applying server mods....
cure = cure * CURE_POWER;
--Cap the final amount to max HP.
if ((target:getMaxHP() - target:getHP()) < cure) then
cure = (target:getMaxHP() - target:getHP());
end
--Do it
target:restoreHP(cure);
target:wakeUp();
player:updateEnmityFromCure(target,cure);
return cure;
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/dungeon/death_watch_bunker/death_watch_bloodguard.lua | 1 | 1165 | death_watch_bloodguard = Creature:new {
objectName = "@mob/creature_names:mand_bunker_dthwatch_red",
socialGroup = "death_watch",
pvpFaction = "death_watch",
faction = "",
level = 121,
chanceHit = 40,
damageMin = 745,
damageMax = 1200,
baseXp = 11390,
baseHAM = 50000,
baseHAMmax = 50000,
armor = 2,
resists = {55,55,70,60,30,30,100,40,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = KILLER,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {"object/mobile/dressed_death_watch_red.iff"},
lootGroups = {
{
groups = {
{group = "death_watch_bunker_commoners", chance = 6000000},
{group = "death_watch_bunker_lieutenants", chance = 4000000}
},
lootChance = 1000000
}
},
weapons = {"pirate_weapons_heavy"},
conversationTemplate = "",
attacks = {
{"defaultattack", ""},
{"intimidationattack","intimidationChance=50"},
{"knockdownattack","knockdownChance=50"}
}
}
CreatureTemplates:addCreatureTemplate(death_watch_bloodguard, "death_watch_bloodguard") | lgpl-3.0 |
eraffxi/darkstar | scripts/globals/items/yellow_curry_bun.lua | 2 | 1947 | -----------------------------------------
-- ID: 5757
-- Item: yellow_curry_bun
-- Food Effect: 30minutes, All Races
-----------------------------------------
-- TODO: Group effects
-- Health Points 20
-- Strength 5
-- Agility 2
-- Intelligence -4
-- Attack 20% (caps @ 75)
-- Ranged Attack 20% (caps @ 75)
-- Resist Sleep +3
-- Resist Stun +4
-- hHP +2
-- hMP +1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(dsp.effect.FOOD) == true or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
function onItemUse(target)
target:addStatusEffect(dsp.effect.FOOD,0,0,1800,5757);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(dsp.mod.HP, 20);
target:addMod(dsp.mod.STR, 5);
target:addMod(dsp.mod.AGI, 2);
target:addMod(dsp.mod.INT, -4);
target:addMod(dsp.mod.FOOD_ATTP, 20);
target:addMod(dsp.mod.FOOD_ATT_CAP, 75);
target:addMod(dsp.mod.FOOD_RATTP, 20);
target:addMod(dsp.mod.FOOD_RATT_CAP, 75);
target:addMod(dsp.mod.SLEEPRES, 3);
target:addMod(dsp.mod.STUNRES, 4);
target:addMod(dsp.mod.HPHEAL, 2);
target:addMod(dsp.mod.MPHEAL, 1);
end;
function onEffectLose(target, effect)
target:delMod(dsp.mod.HP, 20);
target:delMod(dsp.mod.STR, 5);
target:delMod(dsp.mod.AGI, 2);
target:delMod(dsp.mod.INT, -4);
target:delMod(dsp.mod.FOOD_ATTP, 20);
target:delMod(dsp.mod.FOOD_ATT_CAP, 75);
target:delMod(dsp.mod.FOOD_RATTP, 20);
target:delMod(dsp.mod.FOOD_RATT_CAP, 75);
target:delMod(dsp.mod.SLEEPRES, 3);
target:delMod(dsp.mod.STUNRES, 4);
target:delMod(dsp.mod.HPHEAL, 2);
target:delMod(dsp.mod.MPHEAL, 1);
end;
| gpl-3.0 |
eraffxi/darkstar | scripts/zones/Lufaise_Meadows/TextIDs.lua | 2 | 1259 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6381; -- You cannot obtain the item <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6387; -- Obtained: <item>.
GIL_OBTAINED = 6388; -- Obtained <number> gil.
KEYITEM_OBTAINED = 6390; -- Obtained key item: <keyitem>.
NOTHING_OUT_OF_THE_ORDINARY = 7650; -- There is nothing out of the ordinary here.
FISHING_MESSAGE_OFFSET = 7550; -- You can't fish here.
-- Conquest
CONQUEST = 7216; -- You've earned conquest points!
-- Logging
LOGGING_IS_POSSIBLE_HERE = 7727; -- Logging is possible here if you have
-- Other Texts
SURVEY_THE_SURROUNDINGS = 7734; -- You survey the surroundings but see nothing out of the ordinary.
MURDEROUS_PRESENCE = 7735; -- Wait, you sense a murderous presence...!
YOU_CAN_SEE_FOR_MALMS = 7736; -- You can see for malms in every direction.
SPINE_CHILLING_PRESENCE = 7738; -- You sense a spine-chilling presence!
KI_STOLEN = 7679; -- The ?Possible Special Code: 01??Possible Special Code: 05?3??BAD CHAR: 80??BAD CHAR: 80? has been stolen!
-- conquest Base
CONQUEST_BASE = 7048; -- Tallying conquest results...
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/player/city/cityhall_tatooine.lua | 2 | 3339 | --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_player_city_cityhall_tatooine = object_building_player_city_shared_cityhall_tatooine:new {
lotSize = 0,
baseMaintenanceRate = 0,
allowedZones = {"dantooine", "lok", "tatooine"},
length = 7,
width = 9,
zoneComponent = "CityHallZoneComponent",
cityRankRequired = 0,
uniqueStructure = true,
cityMaintenanceBase = 35000,
cityMaintenanceRate = 25000,
abilityRequired = "place_cityhall",
skillMods = {
{"private_buff_mind", 100},
{"private_med_battle_fatigue", 5}
},
childObjects = {
{templateFile = "object/tangible/terminal/terminal_player_structure.iff", x = -16.78, z = 2.0, y = 7.9, ox = 0, oy = 1, oz = 0, ow = 0, cellid = 4, containmentType = -1},
{templateFile = "object/tangible/terminal/terminal_city_vote.iff", x = 0.25, z = 2.0, y = -9.65, ow = 1, ox = 0, oy = 0, oz = 0, cellid = 3, containmentType = -1},
{templateFile = "object/tangible/terminal/terminal_city.iff", x = 17.07, z = 2.0, y = -8.7, ow = 1, ox = 0, oy = 0, oz = 0, cellid = 5, containmentType = -1},
--{templateFile = "object/tangible/terminal/terminal_character_builder.iff", x = 0, z = 2.0, y = 14, ox = 0, oy = 1, oz = 0, ow = 0, cellid = 3, containmentType = -1}
},
alwaysPublic = 1
}
ObjectTemplates:addTemplate(object_building_player_city_cityhall_tatooine, "object/building/player/city/cityhall_tatooine.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/globals/items/uberkuchen.lua | 2 | 1358 | -----------------------------------------
-- ID: 5615
-- Item: uberkuchen
-- Food Effect: 4Hrs, All Races
-----------------------------------------
-- HP 10
-- MP % 3 (cap 15)
-- Intelligence 3
-- HP Recovered While Healing 2
-- MP Recovered While Healing 1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(dsp.effect.FOOD) == true or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
function onItemUse(target)
target:addStatusEffect(dsp.effect.FOOD,0,0,14400,5615);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(dsp.mod.HP, 10);
target:addMod(dsp.mod.FOOD_MPP, 3);
target:addMod(dsp.mod.FOOD_MP_CAP, 15);
target:addMod(dsp.mod.HPHEAL, 2);
target:addMod(dsp.mod.MPHEAL, 1);
target:addMod(dsp.mod.INT, 3);
end;
function onEffectLose(target, effect)
target:delMod(dsp.mod.HP, 10);
target:delMod(dsp.mod.FOOD_MPP, 3);
target:delMod(dsp.mod.FOOD_MP_CAP, 15);
target:delMod(dsp.mod.HPHEAL, 2);
target:delMod(dsp.mod.MPHEAL, 1);
target:delMod(dsp.mod.INT, 3);
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/structure/general/skeleton_bith_head.lua | 3 | 2260 | --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_general_skeleton_bith_head = object_static_structure_general_shared_skeleton_bith_head:new {
}
ObjectTemplates:addTemplate(object_static_structure_general_skeleton_bith_head, "object/static/structure/general/skeleton_bith_head.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/skill_buff/skill_buff_melee_defense.lua | 2 | 2544 | --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_skill_buff_skill_buff_melee_defense = object_tangible_skill_buff_shared_skill_buff_melee_defense:new {
templateType = SKILLBUFF,
objectMenuComponent = {"cpp", "SkillBuffObjectMenuComponent"},
attributeListComponent = "SkillBuffObjectAttributeListComponent",
duration = 300,
useCount = 5,
modifiers = { "melee_defense", 10 },
buffName = "melee_defense",
buffCRC = 0xC78FA3B7
}
ObjectTemplates:addTemplate(object_tangible_skill_buff_skill_buff_melee_defense, "object/tangible/skill_buff/skill_buff_melee_defense.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Crawlers_Nest/Zone.lua | 2 | 1058 | -----------------------------------
--
-- Zone: Crawlers_Nest (197)
--
-----------------------------------
package.loaded["scripts/zones/Crawlers_Nest/TextIDs"] = nil
-----------------------------------
require("scripts/zones/Crawlers_Nest/TextIDs")
require("scripts/zones/Crawlers_Nest/MobIDs")
require("scripts/globals/conquest")
-----------------------------------
function onInitialize(zone)
UpdateTreasureSpawnPoint(CNEST_TREASURE_CHEST)
UpdateTreasureSpawnPoint(CNEST_TREASURE_COFFER)
end
function onZoneIn(player,prevZone)
local cs = -1
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(380.617,-34.61,4.581,59)
end
return cs
end
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers()
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE)
end
end
function onRegionEnter(player,region)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end | gpl-3.0 |
meshr-net/meshr_tomato-RT-N | usr/lib/lua/nixioutil.lua | 2 | 5844 | --[[
nixio - Linux I/O library for lua
Copyright 2009 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local table = require "table"
local nixio = require "nixio"
local getmetatable, assert, pairs, type = getmetatable, assert, pairs, type
local tostring = tostring
module "nixio.util"
local BUFFERSIZE = nixio.const.buffersize
local ZIOBLKSIZE = 65536
local socket = nixio.meta_socket
local tls_socket = nixio.meta_tls_socket
local file = nixio.meta_file
local uname = nixio.uname()
local ZBUG = uname.sysname == "Linux" and uname.release:sub(1, 3) == "2.4"
function consume(iter, append)
local tbl = append or {}
if iter then
for obj in iter do
tbl[#tbl+1] = obj
end
end
return tbl
end
local meta = {}
function meta.is_socket(self)
return (getmetatable(self) == socket)
end
function meta.is_tls_socket(self)
return (getmetatable(self) == tls_socket)
end
function meta.is_file(self)
return (getmetatable(self) == file)
end
function meta.readall(self, len)
local block, code, msg = self:read(len or BUFFERSIZE)
if not block then
return nil, code, msg, ""
elseif #block == 0 then
return "", nil, nil, ""
end
local data, total = {block}, #block
while not len or len > total do
block, code, msg = self:read(len and (len - total) or BUFFERSIZE)
if not block then
return nil, code, msg, table.concat(data)
elseif #block == 0 then
break
end
data[#data+1], total = block, total + #block
end
local data = #data > 1 and table.concat(data) or data[1]
return data, nil, nil, data
end
meta.recvall = meta.readall
function meta.writeall(self, data)
data = tostring(data)
local sent, code, msg = self:write(data)
if not sent then
return nil, code, msg, 0
end
local total = sent
while total < #data do
sent, code, msg = self:write(data, total)
if not sent then
return nil, code, msg, total
end
total = total + sent
end
return total, nil, nil, total
end
meta.sendall = meta.writeall
function meta.linesource(self, limit)
limit = limit or BUFFERSIZE
local buffer = ""
local bpos = 0
return function(flush)
local line, endp, _
if flush then
line = buffer:sub(bpos + 1)
buffer = type(flush) == "string" and flush or ""
bpos = 0
return line
end
while not line do
_, endp, line = buffer:find("(.-)\r?\n", bpos + 1)
if line then
bpos = endp
return line
elseif #buffer < limit + bpos then
local newblock, code, msg = self:read(limit + bpos - #buffer)
if not newblock or newblock == true then
return nil, code, msg
elseif #newblock == 0 then
return nil
end
buffer = buffer:sub(bpos + 1) .. newblock
bpos = 0
else
return nil, 0
end
end
end
end
function meta.blocksource(self, bs, limit)
bs = bs or BUFFERSIZE
return function()
local toread = bs
if limit then
if limit < 1 then
return nil
elseif limit < toread then
toread = limit
end
end
local block, code, msg = self:read(toread)
if not block then
return nil, code, msg
elseif #block == 0 then
return nil
else
if limit then
limit = limit - #block
end
return block
end
end
end
function meta.sink(self, close)
return function(chunk, src_err)
if not chunk and not src_err and close then
if self.shutdown then
self:shutdown()
end
self:close()
elseif chunk and #chunk > 0 then
return self:writeall(chunk)
end
return true
end
end
function meta.copy(self, fdout, size)
local source = self:blocksource(nil, size)
local sink = fdout:sink()
local sent, chunk, code, msg = 0
repeat
chunk, code, msg = source()
sink(chunk, code, msg)
sent = chunk and (sent + #chunk) or sent
until not chunk
return not code and sent or nil, code, msg, sent
end
function meta.copyz(self, fd, size)
local sent, lsent, code, msg = 0
local splicable
if not ZBUG and self:is_file() then
local ftype = self:stat("type")
if nixio.sendfile and fd:is_socket() and ftype == "reg" then
repeat
lsent, code, msg = nixio.sendfile(fd, self, size or ZIOBLKSIZE)
if lsent then
sent = sent + lsent
size = size and (size - lsent)
end
until (not lsent or lsent == 0 or (size and size == 0))
if lsent or (not lsent and sent == 0 and
code ~= nixio.const.ENOSYS and code ~= nixio.const.EINVAL) then
return lsent and sent, code, msg, sent
end
elseif nixio.splice and not fd:is_tls_socket() and ftype == "fifo" then
splicable = true
end
end
if nixio.splice and fd:is_file() and not splicable then
splicable = not self:is_tls_socket() and fd:stat("type") == "fifo"
end
if splicable then
repeat
lsent, code, msg = nixio.splice(self, fd, size or ZIOBLKSIZE)
if lsent then
sent = sent + lsent
size = size and (size - lsent)
end
until (not lsent or lsent == 0 or (size and size == 0))
if lsent or (not lsent and sent == 0 and
code ~= nixio.const.ENOSYS and code ~= nixio.const.EINVAL) then
return lsent and sent, code, msg, sent
end
end
return self:copy(fd, size)
end
if tls_socket then
function tls_socket.close(self)
return self.socket:close()
end
function tls_socket.getsockname(self)
return self.socket:getsockname()
end
function tls_socket.getpeername(self)
return self.socket:getpeername()
end
function tls_socket.getsockopt(self, ...)
return self.socket:getsockopt(...)
end
tls_socket.getopt = tls_socket.getsockopt
function tls_socket.setsockopt(self, ...)
return self.socket:setsockopt(...)
end
tls_socket.setopt = tls_socket.setsockopt
end
for k, v in pairs(meta) do
file[k] = v
socket[k] = v
if tls_socket then
tls_socket[k] = v
end
end
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/loot/groups/npc/desert_swooper_common.lua | 4 | 1105 | desert_swooper_common = {
description = "",
minimumLevel = 0,
maximumLevel = 0,
lootItems = {
{itemTemplate = "skill_buff_carbine_accuracy", weight = 714286},
{itemTemplate = "skill_buff_carbine_speed", weight = 714286},
{itemTemplate = "skill_buff_heavy_weapon_accuracy", weight = 714286},
{itemTemplate = "skill_buff_heavy_weapon_speed", weight = 714286},
{itemTemplate = "skill_buff_melee_accuracy", weight = 714286},
{itemTemplate = "skill_buff_melee_defense", weight = 714286},
{itemTemplate = "skill_buff_pistol_accuracy", weight = 714286},
{itemTemplate = "skill_buff_pistol_speed", weight = 714286},
{itemTemplate = "skill_buff_ranged_accuracy", weight = 714286},
{itemTemplate = "skill_buff_ranged_defense", weight = 714286},
{itemTemplate = "skill_buff_thrown_accuracy", weight = 714285},
{itemTemplate = "skill_buff_thrown_speed", weight = 714285},
{itemTemplate = "skill_buff_twohandmelee_accuracy", weight = 714285},
{itemTemplate = "skill_buff_twohandmelee_speed", weight = 714285}
}
}
addLootGroupTemplate("desert_swooper_common", desert_swooper_common)
| lgpl-3.0 |
imitah/lionbotsor | plugins/msg-checks.lua | 26 | 13860 | --Begin msg_checks.lua By @SoLiD
local function pre_process(msg)
local data = load_data(_config.moderation.data)
local chat = msg.to.id
local user = msg.from.id
local is_channel = msg.to.type == "channel"
local is_chat = msg.to.type == "chat"
local auto_leave = 'auto_leave_bot'
local hash = "gp_lang:"..chat
local lang = redis:get(hash)
if not redis:get('autodeltime') then
redis:setex('autodeltime', 14400, true)
run_bash("rm -rf ~/.telegram-cli/data/sticker/*")
run_bash("rm -rf ~/.telegram-cli/data/photo/*")
run_bash("rm -rf ~/.telegram-cli/data/animation/*")
run_bash("rm -rf ~/.telegram-cli/data/video/*")
run_bash("rm -rf ~/.telegram-cli/data/audio/*")
run_bash("rm -rf ~/.telegram-cli/data/voice/*")
run_bash("rm -rf ~/.telegram-cli/data/temp/*")
run_bash("rm -rf ~/.telegram-cli/data/thumb/*")
run_bash("rm -rf ~/.telegram-cli/data/document/*")
run_bash("rm -rf ~/.telegram-cli/data/profile_photo/*")
run_bash("rm -rf ~/.telegram-cli/data/encrypted/*")
run_bash("rm -rf ./data/photos/*")
end
if is_channel or is_chat then
local TIME_CHECK = 2
if data[tostring(chat)] then
if data[tostring(chat)]['settings']['time_check'] then
TIME_CHECK = tonumber(data[tostring(chat)]['settings']['time_check'])
end
end
if msg.text then
if msg.text:match("(.*)") then
if not data[tostring(msg.to.id)] and not redis:get(auto_leave) and not is_admin(msg) then
tdcli.sendMessage(msg.to.id, "", 0, "_This Is Not One Of My_ *Groups*", 0, "md")
tdcli.changeChatMemberStatus(chat, our_id, 'Left', dl_cb, nil)
end
end
end
if data[tostring(chat)] and data[tostring(chat)]['mutes'] then
mutes = data[tostring(chat)]['mutes']
else
return
end
if mutes.mute_all then
mute_all = mutes.mute_all
else
mute_all = 'no'
end
if mutes.mute_gif then
mute_gif = mutes.mute_gif
else
mute_gif = 'no'
end
if mutes.mute_photo then
mute_photo = mutes.mute_photo
else
mute_photo = 'no'
end
if mutes.mute_sticker then
mute_sticker = mutes.mute_sticker
else
mute_sticker = 'no'
end
if mutes.mute_contact then
mute_contact = mutes.mute_contact
else
mute_contact = 'no'
end
if mutes.mute_inline then
mute_inline = mutes.mute_inline
else
mute_inline = 'no'
end
if mutes.mute_game then
mute_game = mutes.mute_game
else
mute_game = 'no'
end
if mutes.mute_text then
mute_text = mutes.mute_text
else
mute_text = 'no'
end
if mutes.mute_keyboard then
mute_keyboard = mutes.mute_keyboard
else
mute_keyboard = 'no'
end
if mutes.mute_forward then
mute_forward = mutes.mute_forward
else
mute_forward = 'no'
end
if mutes.mute_location then
mute_location = mutes.mute_location
else
mute_location = 'no'
end
if mutes.mute_document then
mute_document = mutes.mute_document
else
mute_document = 'no'
end
if mutes.mute_voice then
mute_voice = mutes.mute_voice
else
mute_voice = 'no'
end
if mutes.mute_audio then
mute_audio = mutes.mute_audio
else
mute_audio = 'no'
end
if mutes.mute_video then
mute_video = mutes.mute_video
else
mute_video = 'no'
end
if mutes.mute_tgservice then
mute_tgservice = mutes.mute_tgservice
else
mute_tgservice = 'no'
end
if data[tostring(chat)] and data[tostring(chat)]['settings'] then
settings = data[tostring(chat)]['settings']
else
return
end
if settings.lock_link then
lock_link = settings.lock_link
else
lock_link = 'no'
end
if settings.lock_join then
lock_join = settings.lock_join
else
lock_join = 'no'
end
if settings.lock_tag then
lock_tag = settings.lock_tag
else
lock_tag = 'no'
end
if settings.lock_pin then
lock_pin = settings.lock_pin
else
lock_pin = 'no'
end
if settings.lock_arabic then
lock_arabic = settings.lock_arabic
else
lock_arabic = 'no'
end
if settings.lock_mention then
lock_mention = settings.lock_mention
else
lock_mention = 'no'
end
if settings.lock_edit then
lock_edit = settings.lock_edit
else
lock_edit = 'no'
end
if settings.lock_spam then
lock_spam = settings.lock_spam
else
lock_spam = 'no'
end
if settings.flood then
lock_flood = settings.flood
else
lock_flood = 'no'
end
if settings.lock_markdown then
lock_markdown = settings.lock_markdown
else
lock_markdown = 'no'
end
if settings.lock_webpage then
lock_webpage = settings.lock_webpage
else
lock_webpage = 'no'
end
if msg.adduser or msg.joinuser or msg.deluser then
if mute_tgservice == "yes" then
del_msg(chat, tonumber(msg.id))
end
end
if not is_mod(msg) and not is_whitelist(msg.from.id, msg.to.id) and msg.from.id ~= our_id then
if msg.adduser or msg.joinuser then
if lock_join == "yes" then
function join_kick(arg, data)
kick_user(data.id_, msg.to.id)
end
if msg.adduser then
tdcli.getUser(msg.adduser, join_kick, nil)
elseif msg.joinuser then
tdcli.getUser(msg.joinuser, join_kick, nil)
end
end
end
end
if msg.pinned and is_channel then
if lock_pin == "yes" then
if is_owner(msg) then
return
end
if tonumber(msg.from.id) == our_id then
return
end
local pin_msg = data[tostring(chat)]['pin']
if pin_msg then
tdcli.pinChannelMessage(msg.to.id, pin_msg, 1)
elseif not pin_msg then
tdcli.unpinChannelMessage(msg.to.id)
end
if lang then
tdcli.sendMessage(msg.to.id, msg.id, 0, '<b>User ID :</b> <code>'..msg.from.id..'</code>\n<b>Username :</b> '..('@'..msg.from.username or '<i>No Username</i>')..'\n<i>شما اجازه دسترسی به سنجاق پیام را ندارید، به همین دلیل پیام قبلی مجدد سنجاق میگردد</i>', 0, "html")
elseif not lang then
tdcli.sendMessage(msg.to.id, msg.id, 0, '<b>User ID :</b> <code>'..msg.from.id..'</code>\n<b>Username :</b> '..('@'..msg.from.username or '<i>No Username</i>')..'\n<i>You Have Not Permission To Pin Message, Last Message Has Been Pinned Again</i>', 0, "html")
end
end
end
if not is_mod(msg) and not is_whitelist(msg.from.id, msg.to.id) and msg.from.id ~= our_id then
if msg.edited and lock_edit == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.forward_info_ and mute_forward == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.photo_ and mute_photo == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.video_ and mute_video == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.document_ and mute_document == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.sticker_ and mute_sticker == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.animation_ and mute_gif == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.contact_ and mute_contact == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.location_ and mute_location == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.voice_ and mute_voice == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.content_ and mute_keyboard == "yes" then
if msg.reply_markup_ and msg.reply_markup_.ID == "ReplyMarkupInlineKeyboard" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
if tonumber(msg.via_bot_user_id_) ~= 0 and mute_inline == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.game_ and mute_game == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.audio_ and mute_audio == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.media.caption then
local link_caption = msg.media.caption:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.media.caption:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Dd][Oo][Gg]/") or msg.media.caption:match("[Tt].[Mm][Ee]/") or msg.media.caption:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/")
if link_caption
and lock_link == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
local tag_caption = msg.media.caption:match("@") or msg.media.caption:match("#")
if tag_caption and lock_tag == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if is_filter(msg, msg.media.caption) then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
local arabic_caption = msg.media.caption:match("[\216-\219][\128-\191]")
if arabic_caption and lock_arabic == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
if msg.text then
local _nl, ctrl_chars = string.gsub(msg.text, '%c', '')
local max_chars = 40
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['set_char'] then
max_chars = tonumber(data[tostring(msg.to.id)]['settings']['set_char'])
end
end
local _nl, real_digits = string.gsub(msg.text, '%d', '')
local max_real_digits = tonumber(max_chars) * 50
local max_len = tonumber(max_chars) * 51
if lock_spam == "yes" then
if string.len(msg.text) > max_len or ctrl_chars > max_chars or real_digits > max_real_digits then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
local link_msg = msg.text:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.text:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Dd][Oo][Gg]/") or msg.text:match("[Tt].[Mm][Ee]/") or msg.text:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/")
if link_msg
and lock_link == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
local tag_msg = msg.text:match("@") or msg.text:match("#")
if tag_msg and lock_tag == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if is_filter(msg, msg.text) then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
local arabic_msg = msg.text:match("[\216-\219][\128-\191]")
if arabic_msg and lock_arabic == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.text:match("(.*)")
and mute_text == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
if mute_all == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
if msg.content_.entities_ and msg.content_.entities_[0] then
if msg.content_.entities_[0].ID == "MessageEntityMentionName" then
if lock_mention == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
if msg.content_.entities_[0].ID == "MessageEntityUrl" or msg.content_.entities_[0].ID == "MessageEntityTextUrl" then
if lock_webpage == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
if msg.content_.entities_[0].ID == "MessageEntityBold" or msg.content_.entities_[0].ID == "MessageEntityCode" or msg.content_.entities_[0].ID == "MessageEntityPre" or msg.content_.entities_[0].ID == "MessageEntityItalic" then
if lock_markdown == "yes" then
if is_channel then
del_msg(chat, tonumber(msg.id))
elseif is_chat then
kick_user(user, chat)
end
end
end
end
if msg.to.type ~= 'pv' then
if lock_flood == "yes" and not is_mod(msg) and not is_whitelist(msg.from.id, msg.to.id) and not msg.adduser and msg.from.id ~= our_id then
local hash = 'user:'..user..':msgs'
local msgs = tonumber(redis:get(hash) or 0)
local NUM_MSG_MAX = 5
if data[tostring(chat)] then
if data[tostring(chat)]['settings']['num_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(chat)]['settings']['num_msg_max'])
end
end
if msgs > NUM_MSG_MAX then
if msg.from.username then
user_name = "@"..msg.from.username
else
user_name = msg.from.first_name
end
if redis:get('sender:'..user..':flood') then
return
else
del_msg(chat, msg.id)
kick_user(user, chat)
if not lang then
tdcli.sendMessage(chat, msg.id, 0, "_User_ "..user_name.." `[ "..user.." ]` _has been_ *kicked* _because of_ *flooding*", 0, "md")
elseif lang then
tdcli.sendMessage(chat, msg.id, 0, "_کاربر_ "..user_name.." `[ "..user.." ]` _به دلیل ارسال پیام های مکرر اخراج شد_", 0, "md")
end
redis:setex('sender:'..user..':flood', 30, true)
end
end
redis:setex(hash, TIME_CHECK, msgs+1)
end
end
end
end
end
return {
patterns = {},
pre_process = pre_process
}
--End msg_checks.lua--
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_lost_aqualish_marksman_female_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_lost_aqualish_marksman_female_01 = object_mobile_shared_dressed_lost_aqualish_marksman_female_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_lost_aqualish_marksman_female_01, "object/mobile/dressed_lost_aqualish_marksman_female_01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/lair/base/earthmound_light.lua | 2 | 2280 | --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_earthmound_light = object_tangible_lair_base_shared_earthmound_light:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_base_earthmound_light, "object/tangible/lair/base/earthmound_light.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Sea_Serpent_Grotto/npcs/_4w3.lua | 2 | 2393 | -----------------------------------
-- Area: Sea Serpent Grotto
-- NPC: Mythril Beastcoin Door
-- @zone 176
-- !pos 40 8.6 20.012
-----------------------------------
package.loaded["scripts/zones/Sea_Serpent_Grotto/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Sea_Serpent_Grotto/TextIDs");
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(749,1) and trade:getItemCount() == 1) then
if (player:getVar("SSG_MythrilDoor") == 7) then
npc:openDoor(5) --Open the door if a mythril beastcoin has been traded after checking the door the required number of times
end
end
end;
function onTrigger(player,npc)
X = player:getXPos();
Z = player:getZPos();
MythrilDoorCheck = player:getVar("SSG_MythrilDoor");
if (X >= 40 and Z >= 15) then
if (MythrilDoorCheck == 0) then --Door has never been checked
player:messageSpecial(FIRST_CHECK);
player:setVar("SSG_MythrilDoor",1);
elseif (MythrilDoorCheck == 1) then --Door has been checked once
player:messageSpecial(SECOND_CHECK);
player:setVar("SSG_MythrilDoor",2);
elseif (MythrilDoorCheck == 2) then --Door has been checked twice
player:messageSpecial(THIRD_CHECK);
player:setVar("SSG_MythrilDoor",3);
elseif (MythrilDoorCheck == 3) then --Door has been checked three times
player:messageSpecial(FOURTH_CHECK);
player:setVar("SSG_MythrilDoor",4);
elseif (MythrilDoorCheck == 4) then --Door has been checked four times
player:messageSpecial(FIFTH_CHECK);
player:setVar("SSG_MythrilDoor",5);
elseif (MythrilDoorCheck == 5) then --Door has been checked five times
player:messageSpecial(MYTHRIL_CHECK);
player:setVar("SSG_MythrilDoor",6);
elseif (MythrilDoorCheck == 6 or MythrilDoorCheck == 7) then --Door has been checked six or more times
player:messageSpecial(COMPLETED_CHECK,749);
player:setVar("SSG_MythrilDoor",7);
end
return 1 --Keep the door closed
elseif (X < 40 and Z < 24) then
return -1 --Open the door if coming from the "inside"
end
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end; | gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/components/armor/arm_mandal_double_insulated_i7.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_mandal_double_insulated_i7 = object_tangible_ship_components_armor_shared_arm_mandal_double_insulated_i7:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_armor_arm_mandal_double_insulated_i7, "object/tangible/ship/components/armor/arm_mandal_double_insulated_i7.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/group/base/group_default.lua | 3 | 2184 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_group_base_group_default = object_group_base_shared_group_default:new {
}
ObjectTemplates:addTemplate(object_group_base_group_default, "object/group/base/group_default.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/structure/generic_house_player_medium.lua | 2 | 3728 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_structure_generic_house_player_medium = object_draft_schematic_structure_shared_generic_house_player_medium:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Deed for: Medium Generic Planet House",
craftingToolTab = 1024, -- (See DraftSchemticImplementation.h)
complexity = 25,
size = 12,
xpType = "crafting_structure_general",
xp = 8000,
assemblySkill = "structure_assembly",
experimentingSkill = "structure_experimentation",
customizationSkill = "structure_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n", "craft_structure_ingredients_n"},
ingredientTitleNames = {"load_bearing_structure_and_shell", "insulation_and_covering", "foundation", "wall_sections", "power_supply_unit", "storage_space"},
ingredientSlotType = {0, 0, 0, 2, 1, 1},
resourceTypes = {"metal", "ore", "ore", "object/tangible/component/structure/shared_wall_module.iff", "object/tangible/component/structure/shared_generator_turbine.iff", "object/tangible/component/structure/shared_structure_storage_section.iff"},
resourceQuantities = {1250, 2250, 400, 6, 1, 1},
contribution = {100, 100, 100, 100, 100, 100},
targetTemplate = "object/tangible/deed/player_house_deed/generic_house_medium_deed.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_structure_generic_house_player_medium, "object/draft_schematic/structure/generic_house_player_medium.iff")
| lgpl-3.0 |
coinapi/coinapi-sdk | ems-cloud-mgmt-sdk/lua/openapiclient/model/position_data_inner.lua | 2 | 4065 | --[[
EMS - REST API
This section will provide necessary information about the `CoinAPI EMS REST API` protocol. <br/> This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> <br/><br/> Implemented Standards: * [HTTP1.0](https://datatracker.ietf.org/doc/html/rfc1945) * [HTTP1.1](https://datatracker.ietf.org/doc/html/rfc2616) * [HTTP2.0](https://datatracker.ietf.org/doc/html/rfc7540) ### Endpoints <table> <thead> <tr> <th>Deployment method</th> <th>Environment</th> <th>Url</th> </tr> </thead> <tbody> <tr> <td>Managed Cloud</td> <td>Production</td> <td>Use <a href=\"#ems-docs-sh\">Managed Cloud REST API /v1/locations</a> to get specific endpoints to each server site where your deployments span</td> </tr> <tr> <td>Managed Cloud</td> <td>Sandbox</td> <td><code>https://ems-gateway-aws-eu-central-1-dev.coinapi.io/</code></td> </tr> <tr> <td>Self Hosted</td> <td>Production</td> <td>IP Address of the <code>ems-gateway</code> container/excecutable in the closest server site to the caller location</td> </tr> <tr> <td>Self Hosted</td> <td>Sandbox</td> <td>IP Address of the <code>ems-gateway</code> container/excecutable in the closest server site to the caller location</td> </tr> </tbody> </table> ### Authentication If the software is deployed as `Self-Hosted` then API do not require authentication as inside your infrastructure, your company is responsible for the security and access controls. <br/><br/> If the software is deployed in our `Managed Cloud`, there are 2 methods for authenticating with us, you only need to use one: 1. Custom authorization header named `X-CoinAPI-Key` with the API Key 2. Query string parameter named `apikey` with the API Key 3. <a href=\"#certificate\">TLS Client Certificate</a> from the `Managed Cloud REST API` (/v1/certificate/pem endpoint) while establishing a TLS session with us. #### Custom authorization header You can authorize by providing additional custom header named `X-CoinAPI-Key` and API key as its value. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY`, then the authorization header you should send to us will look like: <br/><br/> `X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY` <aside class=\"success\">This method is recommended by us and you should use it in production environments.</aside> #### Query string authorization parameter You can authorize by providing an additional parameter named `apikey` with a value equal to your API key in the query string of your HTTP request. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY` and that you want to request all balances, then your query string should look like this: <br/><br/> `GET /v1/balances?apikey=73034021-THIS-IS-SAMPLE-KEY` <aside class=\"notice\">Query string method may be more practical for development activities.</aside>
The version of the OpenAPI document: v1
Contact: support@coinapi.io
Generated by: https://openapi-generator.tech
]]
-- position_data_inner class
local position_data_inner = {}
local position_data_inner_mt = {
__name = "position_data_inner";
__index = position_data_inner;
}
local function cast_position_data_inner(t)
return setmetatable(t, position_data_inner_mt)
end
local function new_position_data_inner(symbol_id_exchange, symbol_id_coinapi, avg_entry_price, quantity, side, unrealized_pnl, leverage, cross_margin, liquidation_price, raw_data)
return cast_position_data_inner({
["symbol_id_exchange"] = symbol_id_exchange;
["symbol_id_coinapi"] = symbol_id_coinapi;
["avg_entry_price"] = avg_entry_price;
["quantity"] = quantity;
["side"] = side;
["unrealized_pnl"] = unrealized_pnl;
["leverage"] = leverage;
["cross_margin"] = cross_margin;
["liquidation_price"] = liquidation_price;
["raw_data"] = raw_data;
})
end
return {
cast = cast_position_data_inner;
new = new_position_data_inner;
}
| mit |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/space_imperial_tier4_corellia_nin_gursawe.lua | 3 | 2280 | --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_imperial_tier4_corellia_nin_gursawe = object_mobile_shared_space_imperial_tier4_corellia_nin_gursawe:new {
}
ObjectTemplates:addTemplate(object_mobile_space_imperial_tier4_corellia_nin_gursawe, "object/mobile/space_imperial_tier4_corellia_nin_gursawe.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/component/chemistry/biologic_effect_controller.lua | 3 | 2810 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_component_chemistry_biologic_effect_controller = object_tangible_component_chemistry_shared_biologic_effect_controller:new {
numberExperimentalProperties = {1, 1, 2, 2, 1},
experimentalProperties = {"XX", "XX", "OQ", "PE", "OQ", "UT", "XX"},
experimentalWeights = {1, 1, 2, 1, 2, 1, 1},
experimentalGroupTitles = {"null", "null", "exp_effectiveness", "exp_charges", "null"},
experimentalSubGroupTitles = {"null", "null", "power", "charges", "hitpoints"},
experimentalMin = {0, 0, 1, 1, 1000},
experimentalMax = {0, 0, 10, 10, 1000},
experimentalPrecision = {0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 4},
}
ObjectTemplates:addTemplate(object_tangible_component_chemistry_biologic_effect_controller, "object/tangible/component/chemistry/biologic_effect_controller.iff")
| lgpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.