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/terminal/terminal_newbie_medicine.lua | 3 | 2256 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_terminal_terminal_newbie_medicine = object_tangible_terminal_shared_terminal_newbie_medicine:new {
}
ObjectTemplates:addTemplate(object_tangible_terminal_terminal_newbie_medicine, "object/tangible/terminal/terminal_newbie_medicine.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_tatooine_ikka_gesul.lua | 3 | 2224 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_tatooine_ikka_gesul = object_mobile_shared_dressed_tatooine_ikka_gesul:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_tatooine_ikka_gesul, "object/mobile/dressed_tatooine_ikka_gesul.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/dressed_garyn_prowler_trandoshan_female_01.lua | 3 | 2284 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_garyn_prowler_trandoshan_female_01 = object_mobile_shared_dressed_garyn_prowler_trandoshan_female_01:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_garyn_prowler_trandoshan_female_01, "object/mobile/dressed_garyn_prowler_trandoshan_female_01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/poi/yavin4_abandoned_rebel_camp_small2.lua | 1 | 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_building_poi_yavin4_abandoned_rebel_camp_small2 = object_building_poi_shared_yavin4_abandoned_rebel_camp_small2:new {
}
ObjectTemplates:addTemplate(object_building_poi_yavin4_abandoned_rebel_camp_small2, "object/building/poi/yavin4_abandoned_rebel_camp_small2.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/scout/item_camp_improved.lua | 2 | 3105 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_scout_item_camp_improved = object_draft_schematic_scout_shared_item_camp_improved:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Improved Camp Kit",
craftingToolTab = 524288, -- (See DraftSchemticImplementation.h)
complexity = 7,
size = 1,
xpType = "camp",
xp = 84,
assemblySkill = "general_assembly",
experimentingSkill = "general_experimentation",
customizationSkill = "clothing_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"shelter_canvas", "shelter_structure"},
ingredientSlotType = {0, 0},
resourceTypes = {"hide", "bone"},
resourceQuantities = {30, 12},
contribution = {100, 100},
targetTemplate = "object/tangible/scout/camp/camp_improved.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_scout_item_camp_improved, "object/draft_schematic/scout/item_camp_improved.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/lair/malkloc/lair_malkloc_desert.lua | 2 | 2304 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_lair_malkloc_lair_malkloc_desert = object_tangible_lair_malkloc_shared_lair_malkloc_desert:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_malkloc_lair_malkloc_desert, "object/tangible/lair/malkloc/lair_malkloc_desert.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/shear_mite_broodling.lua | 3 | 2196 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_shear_mite_broodling = object_mobile_shared_shear_mite_broodling:new {
}
ObjectTemplates:addTemplate(object_mobile_shear_mite_broodling, "object/mobile/shear_mite_broodling.iff")
| lgpl-3.0 |
widelands/widelands | data/campaigns/emp04.wmf/scripting/tribes/farm1/init.lua | 1 | 1674 | dirname = "campaigns/emp04.wmf/" .. path.dirname (__file__)
push_textdomain("scenario_emp04.wmf")
wl.Descriptions():new_productionsite_type {
name = "empire_farm1",
descname = pgettext("empire_building", "Farm"),
icon = dirname .. "menu.png",
size = "big",
enhancement = {
name = "empire_farm",
enhancement_cost = {
planks = 1,
marble = 1,
marble_column = 2
},
enhancement_return_on_dismantle = {
planks = 1,
granite = 1,
marble = 1,
marble_column = 1
}
},
animation_directory = dirname,
animations = {
idle = {
hotspot = { 89, 82 },
},
},
aihints = {
},
working_positions = {
empire_farmer = 1
},
programs = {
main = {
descname = pgettext("empire_building", "working"),
actions = {
"call=plant",
"call=harvest",
}
},
plant = {
descname = pgettext("empire_building", "planting wheat"),
actions = {
"sleep=duration:14s",
"callworker=harvest"
}
},
harvest = {
descname = pgettext("empire_building", "harvesting wheat"),
actions = {
"sleep=duration:4s",
"callworker=harvest"
}
},
},
out_of_resource_notification = {
title = pgettext("empire_building", "No Fields"),
heading = pgettext("empire_building", "Out of Fields"),
message = pgettext("empire_building", "The farmer working at this farm has no cleared soil to plant his seeds."),
productivity_threshold = 30
},
}
pop_textdomain()
| gpl-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/general/mun_all_hospital_s02.lua | 2 | 2400 | --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_general_mun_all_hospital_s02 = object_building_general_shared_mun_all_hospital_s02:new {
skillMods = {
{"private_medical_rating", 100},
{"private_med_wound_health", 100},
{"private_med_wound_action", 100}
},
planetMapCategory = "medicalcenter"
}
ObjectTemplates:addTemplate(object_building_general_mun_all_hospital_s02, "object/building/general/mun_all_hospital_s02.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/item/item_con_winebottle_01.lua | 3 | 2224 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_item_item_con_winebottle_01 = object_static_item_shared_item_con_winebottle_01:new {
}
ObjectTemplates:addTemplate(object_static_item_item_con_winebottle_01, "object/static/item/item_con_winebottle_01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/bio_engineer/dna_template/dna_template_narglatch.lua | 3 | 2344 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_bio_engineer_dna_template_dna_template_narglatch = object_draft_schematic_bio_engineer_dna_template_shared_dna_template_narglatch:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_bio_engineer_dna_template_dna_template_narglatch, "object/draft_schematic/bio_engineer/dna_template/dna_template_narglatch.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/screenplays/cities/dathomir_science_outpost.lua | 2 | 2069 | DathomirScienceOutpostScreenPlay = ScreenPlay:new {
numberOfActs = 1,
screenplayName = "DathomirScienceOutpostScreenPlay"
}
registerScreenPlay("DathomirScienceOutpostScreenPlay", true)
function DathomirScienceOutpostScreenPlay:start()
if (isZoneEnabled("dathomir")) then
self:spawnMobiles()
end
end
function DathomirScienceOutpostScreenPlay:spawnMobiles()
--In a building
spawnMobile("dathomir", "criminal", 300, -3.46893, 0.624996, -1.80359, 9.95605, 2835552)
--Outside
spawnMobile("dathomir", "businessman", 60, -70.8878, 18, -1646.08, 315.408, 0)
spawnMobile("dathomir", "businessman", 60, -64.4958, 18, -1581.42, 63.9635, 0)
spawnMobile("dathomir", "businessman", 60, -79.6404, 18, -1585.09, 131.623, 0)
spawnMobile("dathomir", "cll8_binary_load_lifter", 60, -107.307, 18, -1603.07, 275.094, 0)
spawnMobile("dathomir", "commoner", 60, -60.7253, 18, -1596.21, 88.2297, 0)
spawnMobile("dathomir", "commoner", 60, -37.0445, 18, -1587.75, 47.6817, 0)
spawnMobile("dathomir", "commoner", 60, -78.5124, 18, -1618.16, 179.85, 0)
spawnMobile("dathomir", "commoner", 60, -98.9262, 18, -1590.29, 239.412, 0)
spawnMobile("dathomir", "mercenary", 60, -88.9323, 18, -1606.84, 350.084, 0)
spawnMobile("dathomir", "mercenary", 60, -100.976, 18, -1573.64, 39.7721, 0)
spawnMobile("dathomir", "mercenary", 60, -86.3374, 18, -1555.75, 219.418, 0)
spawnMobile("dathomir", "mercenary", 60, -93.2763, 18, -1569.32, 343.205, 0)
spawnMobile("dathomir", "mercenary", 60, -43.9919, 18, -1585.86, 220.77, 0)
spawnMobile("dathomir", "scientist", 60, -136.034, 18, -1592.07, 62.5196, 0)
spawnMobile("dathomir", "informant_npc_lvl_3", 0,-68,18,-1565,270,0)
--Left these in dathomir.lua
--{"arnecio_ulvaw_op",60,4.06465,0.624999,2.34456,30.9406,2835570, "neutral", ""},
--{"r3",60,-78.3142,18,-1629.93,144.919,0, "calm", "R3-O0"},
--{"r4",60,-134.195,18,-1599.14,45.5678,0, "calm", "R4-J5"},
--{"shibb_nisshil",60,-71.1537,18,-1639.84,66.4233,0, "", "Shibb Nisshil"},
--{"shaki_hamachil",60,-101.049,18,-1542.62,293.515,0, "calm", "Shaki Hamachil"},
end
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/tatooine/guild_university_tatooine_style_02.lua | 3 | 2391 | --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_tatooine_guild_university_tatooine_style_02 = object_building_tatooine_shared_guild_university_tatooine_style_02:new {
gameObjectType = 527,
planetMapCategory = "guild",
planetMapSubCategory = "guild_university"
}
ObjectTemplates:addTemplate(object_building_tatooine_guild_university_tatooine_style_02, "object/building/tatooine/guild_university_tatooine_style_02.iff")
| lgpl-3.0 |
NezzKryptic/Wire | lua/entities/gmod_wire_egp/lib/objects/poly.lua | 6 | 2574 | -- Author: Divran
local Obj = EGP:NewObject( "Poly" )
Obj.w = nil
Obj.h = nil
Obj.x = nil
Obj.y = nil
Obj.vertices = {}
Obj.verticesindex = "vertices"
Obj.HasUV = true
-- Returns whether c is to the left of the line from a to b.
local function counterclockwise( a, b, c )
local area = (a.x - c.x) * (b.y - c.y) - (b.x - c.x) * (a.y - c.y)
return area > 0
end
Obj.Draw = function( self )
if (self.a>0 and #self.vertices>2) then
render.CullMode(counterclockwise(unpack(self.vertices)) and MATERIAL_CULLMODE_CCW or MATERIAL_CULLMODE_CW)
surface.SetDrawColor( self.r, self.g, self.b, self.a )
surface.DrawPoly( self.vertices )
render.CullMode(MATERIAL_CULLMODE_CCW)
end
end
Obj.Transmit = function( self, Ent, ply )
if (#self.vertices <= 28) then
net.WriteUInt( #self.vertices, 8 )
for i=1,#self.vertices do
net.WriteInt( self.vertices[i].x, 16 )
net.WriteInt( self.vertices[i].y, 16 )
net.WriteFloat( self.vertices[i].u or 0 )
net.WriteFloat( self.vertices[i].v or 0 )
end
else
net.WriteUInt( 0, 8 )
EGP:InsertQueue( Ent, ply, EGP._SetVertex, "SetVertex", self.index, self.vertices )
end
net.WriteUInt(math.Clamp(self.filtering,0,3), 2)
net.WriteInt( self.parent, 16 )
EGP:SendMaterial( self )
EGP:SendColor( self )
end
Obj.Receive = function( self )
local tbl = {}
tbl.vertices = {}
for i = 1, net.ReadUInt(8) do
tbl.vertices[ i ] = { x = net.ReadInt(16), y = net.ReadInt(16), u = net.ReadFloat(), v = net.ReadFloat() }
end
tbl.filtering = net.ReadUInt(2)
tbl.parent = net.ReadInt(16)
EGP:ReceiveMaterial( tbl )
EGP:ReceiveColor( tbl, self )
return tbl
end
Obj.DataStreamInfo = function( self )
return { vertices = self.vertices, material = self.material, r = self.r, g = self.g, b = self.b, a = self.a, filtering = self.filtering, parent = self.parent }
end
function Obj:Contains(point)
if #self.vertices < 3 then return false end
-- To check whether a point is in the polygon, we check whether it's to the
-- 'inside' side of each edge. (If the polygon is counterclockwise then the
-- inside is the left side; otherwise it's the right side.) This only works
-- for convex polygons, but so does `surface.drawPoly`.
local inside
if counterclockwise(self.vertices[1], self.vertices[2], self.vertices[3]) then
inside = counterclockwise
else
inside = function(a, b, c) return counterclockwise(b, a, c) end
end
for i = 1, #self.vertices - 1 do
if not inside(self.vertices[i], self.vertices[i + 1], point) then return false end
end
return inside(self.vertices[#self.vertices], self.vertices[1], point)
end
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_small.lua | 2 | 2376 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_lair_base_poi_all_lair_bones_large_evil_fire_small = object_tangible_lair_base_shared_poi_all_lair_bones_large_evil_fire_small:new {
objectMenuComponent = {"cpp", "LairMenuComponent"},
}
ObjectTemplates:addTemplate(object_tangible_lair_base_poi_all_lair_bones_large_evil_fire_small, "object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_small.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/thug/information_broker.lua | 1 | 1075 | information_broker = Creature:new {
objectName = "@mob/creature_names:bothan_information_broker",
socialGroup = "Mercenary",
pvpFaction = "",
faction = "",
level = 5,
chanceHit = 0.25,
damageMin = 45,
damageMax = 50,
baseXp = 85,
baseHAM = 135,
baseHAMmax = 165,
armor = 0,
resists = {0,0,0,0,0,0,0,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = STALKER,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {},
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "wearables_common", chance = 3000000},
{group = "loot_kit_parts", chance = 2000000},
{group = "tailor_components", chance = 1000000},
},
lootChance = 3000000
}
},
weapons = {"rebel_weapons_light"},
conversationTemplate = "",
attacks = merge(riflemanmaster,pistoleermaster,carbineermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(information_broker, "information_broker") | lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/gualama.lua | 3 | 2144 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_gualama = object_mobile_shared_gualama:new {
}
ObjectTemplates:addTemplate(object_mobile_gualama, "object/mobile/gualama.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/structure/general/streetlamp_large_style_01_off.lua | 3 | 2304 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_structure_general_streetlamp_large_style_01_off = object_static_structure_general_shared_streetlamp_large_style_01_off:new {
}
ObjectTemplates:addTemplate(object_static_structure_general_streetlamp_large_style_01_off, "object/static/structure/general/streetlamp_large_style_01_off.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/clothing/clothing_ith_robe_formal_01.lua | 2 | 3670 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_draft_schematic_clothing_clothing_ith_robe_formal_01 = object_draft_schematic_clothing_shared_clothing_ith_robe_formal_01:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Ithorian Priest\'s Robe",
craftingToolTab = 8, -- (See DraftSchemticImplementation.h)
complexity = 23,
size = 4,
xpType = "crafting_clothing_general",
xp = 360,
assemblySkill = "clothing_assembly",
experimentingSkill = "clothing_experimentation",
customizationSkill = "clothing_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n"},
ingredientTitleNames = {"trim_and_binding", "extra_trim", "jewelry_setting", "hardware", "inner_gown", "outer_gown"},
ingredientSlotType = {0, 1, 1, 0, 1, 1},
resourceTypes = {"hide", "object/tangible/component/clothing/shared_trim.iff", "object/tangible/component/clothing/shared_jewelry_setting.iff", "metal", "object/tangible/component/clothing/shared_synthetic_cloth.iff", "object/tangible/component/clothing/shared_synthetic_cloth.iff"},
resourceQuantities = {80, 3, 2, 40, 3, 3},
contribution = {100, 100, 100, 100, 100, 100},
targetTemplate = "object/tangible/wearables/ithorian/ith_robe_s02.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_clothing_clothing_ith_robe_formal_01, "object/draft_schematic/clothing/clothing_ith_robe_formal_01.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/loot/collectible/collectible_rewards/gong.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_tangible_loot_collectible_collectible_rewards_gong = object_tangible_loot_collectible_collectible_rewards_shared_gong:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_collectible_collectible_rewards_gong, "object/tangible/loot/collectible/collectible_rewards/gong.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/static/item/item_basket_frame.lua | 3 | 2204 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_static_item_item_basket_frame = object_static_item_shared_item_basket_frame:new {
}
ObjectTemplates:addTemplate(object_static_item_item_basket_frame, "object/static/item/item_basket_frame.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/rancor_hue.lua | 3 | 2156 | --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_rancor_hue = object_mobile_shared_rancor_hue:new {
}
ObjectTemplates:addTemplate(object_mobile_rancor_hue, "object/mobile/rancor_hue.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/item/item_tumble_blender.lua | 2 | 3503 | --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_item_item_tumble_blender = object_draft_schematic_item_shared_item_tumble_blender:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Tumble Blender",
craftingToolTab = 524288, -- (See DraftSchemticImplementation.h)
complexity = 12,
size = 1,
xpType = "crafting_general",
xp = 36,
assemblySkill = "general_assembly",
experimentingSkill = "general_experimentation",
customizationSkill = "general_customization",
customizationOptions = {},
customizationStringNames = {},
customizationDefaults = {},
ingredientTemplateNames = {"craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n", "craft_item_ingredients_n"},
ingredientTitleNames = {"wiring_blue", "battery_cheap_copper", "interior_gears", "agitator_motor", "inert_atmosphere_lining"},
ingredientSlotType = {2, 2, 0, 1, 0},
resourceTypes = {"object/tangible/loot/simple_kit/shared_wiring_blue.iff", "object/tangible/loot/simple_kit/shared_battery_cheap_copper.iff", "metal_ferrous", "object/tangible/loot/simple_kit/shared_motor_small_red.iff", "fiberplast"},
resourceQuantities = {3, 2, 40, 1, 40},
contribution = {100, 100, 100, 100, 100},
targetTemplate = "object/tangible/loot/simple_kit/tumble_blender.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_item_item_tumble_blender, "object/draft_schematic/item/item_tumble_blender.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/lair/striped_fish/serverobjects.lua | 3 | 2187 | --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/striped_fish/lair_striped_fish.lua")
includeFile("tangible/lair/striped_fish/lair_striped_fish_underwater.lua")
| lgpl-3.0 |
dlannan/funLuaJit | byt3d/ffi/win32.lua | 1 | 12440 | --
-- Created by David Lannan
-- User: grover
-- Date: 19/04/13
-- Time: 12:04 AM
-- Copyright 2013 Developed for use with the byt3d engine.
--
local ffi = require( "ffi" )
user32 = ffi.load( "USER32" )
kernel32 = ffi.load( "KERNEL32" )
ffi.cdef[[
typedef char* PCIDLIST_ABSOLUTE;
typedef char* LPCTSTR;
typedef char* LPTSTR;
typedef char TCHAR;
typedef uint32_t LPARAM;
typedef uint32_t UINT;
typedef uint32_t HWND;
typedef uint32_t DWORD;
typedef uint32_t LPVOID;
typedef uint32_t LONG;
typedef uint32_t HINSTANCE;
typedef uint16_t WORD;
typedef struct tagBITMAP {
LONG bmType;
LONG bmWidth;
LONG bmHeight;
LONG bmWidthBytes;
WORD bmPlanes;
WORD bmBitsPixel;
void * bmBits;
} BITMAP;
typedef BITMAP *PBITMAP;
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
typedef SYSTEMTIME *PSYSTEMTIME;
typedef struct tagBITMAPFILEHEADER {
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
} BITMAPFILEHEADER;
typedef BITMAPFILEHEADER *PBITMAPFILEHEADER;
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
uint32_t bInheritHandle;
} SECURITY_ATTRIBUTES;
typedef SECURITY_ATTRIBUTES *PSECURITY_ATTRIBUTES;
typedef SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES;
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
typedef FILETIME *PFILETIME;
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[4096];
TCHAR cAlternateFileName[14];
} WIN32_FIND_DATA;
typedef WIN32_FIND_DATA *PWIN32_FIND_DATA;
typedef WIN32_FIND_DATA *LPWIN32_FIND_DATA;
typedef struct tagOFN {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCTSTR lpstrFilter;
LPTSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPTSTR lpstrFile;
DWORD nMaxFile;
LPTSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCTSTR lpstrInitialDir;
LPCTSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCTSTR lpstrDefExt;
LPARAM lCustData;
void * lpfnHook;
LPCTSTR lpTemplateName;
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
} OPENFILENAME;
typedef OPENFILENAME *LPOPENFILENAME;
typedef int32_t bool32;
typedef intptr_t (__stdcall *WNDPROC)(void* hwnd, unsigned int message, uintptr_t wparam, intptr_t lparam);
enum {
CS_VREDRAW = 0x0001,
CS_HREDRAW = 0x0002,
CS_OWNDC = 0x0020,
ES_LEFT = 0x00000000,
ES_CENTER = 0x00000001,
ES_RIGHT = 0x00000002,
ES_MULTILINE = 0x00000004,
ES_UPPERCASE = 0x00000008,
ES_LOWERCASE = 0x00000010,
ES_PASSWORD = 0x00000020,
ES_AUTOVSCROLL = 0x00000040,
ES_AUTOHSCROLL = 0x00000080,
ES_NOHIDESEL = 0x00000100,
ES_COMBO = 0x00000200,
ES_OEMCONVERT = 0x00000400,
ES_READONLY = 0x00000800,
ES_WANTRETURN = 0x00001000,
ES_NUMBER = 0x00002000,
CTLCOLOR_MSGBOX = 0,
CTLCOLOR_EDIT = 1,
CTLCOLOR_LISTBOX = 2,
CTLCOLOR_BTN = 3,
CTLCOLOR_DLG = 4,
CTLCOLOR_SCROLLBAR = 5,
CTLCOLOR_STATIC = 6,
CTLCOLOR_MAX = 7,
COLOR_SCROLLBAR = 0,
COLOR_BACKGROUND = 1,
COLOR_ACTIVECAPTION = 2,
COLOR_INACTIVECAPTION = 3,
COLOR_MENU = 4,
COLOR_WINDOW = 5,
COLOR_WINDOWFRAME = 6,
COLOR_MENUTEXT = 7,
COLOR_WINDOWTEXT = 8,
COLOR_CAPTIONTEXT = 9,
COLOR_ACTIVEBORDER = 10,
COLOR_INACTIVEBORDER = 11,
COLOR_APPWORKSPACE = 12,
COLOR_HIGHLIGHT = 13,
COLOR_HIGHLIGHTTEXT = 14,
COLOR_BTNFACE = 15,
COLOR_BTNSHADOW = 16,
COLOR_GRAYTEXT = 17,
COLOR_BTNTEXT = 18,
COLOR_INACTIVECAPTIONTEXT = 19,
COLOR_BTNHIGHLIGHT = 20,
COLOR_3DDKSHADOW = 21,
COLOR_3DLIGHT = 22,
COLOR_INFOTEXT = 23,
COLOR_INFOBK = 24,
COLOR_DESKTOP = COLOR_BACKGROUND,
COLOR_3DFACE = COLOR_BTNFACE,
COLOR_3DSHADOW = COLOR_BTNSHADOW,
COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT,
COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT,
COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT,
WM_CREATE = 0x0001,
WM_DESTROY = 0x0002,
WM_MOVE = 0x0003,
WM_SIZE = 0x0005,
WM_ACTIVATE = 0x0006,
WM_KILLFOCUS = 0x0008,
WM_ENABLE = 0x000A,
WM_SETREDRAW = 0x000B,
WM_SETTEXT = 0x000C,
WM_GETTEXT = 0x000D,
WM_GETTEXTLENGTH = 0x000E,
WM_PAINT = 0x000F,
WM_CLOSE = 0x0010,
WM_QUERYENDSESSION = 0x0011,
WM_QUIT = 0x0012,
WM_QUERYOPEN = 0x0013,
WM_ERASEBKGND = 0x0014,
WM_SYSCOLORCHANGE = 0x0015,
WM_ENDSESSION = 0x0016,
WM_SHOWWINDOW = 0x0018,
WM_WININICHANGE = 0x001A,
WS_EX_DLGMODALFRAME = 0x00000001,
WS_EX_NOPARENTNOTIFY = 0x00000004,
WS_EX_TOPMOST = 0x00000008,
WS_EX_ACCEPTFILES = 0x00000010,
WS_EX_TRANSPARENT = 0x00000020,
WS_EX_MDICHILD = 0x00000040,
WS_EX_TOOLWINDOW = 0x00000080,
WS_EX_WINDOWEDGE = 0x00000100,
WS_EX_CLIENTEDGE = 0x00000200,
WS_EX_CONTEXTHELP = 0x00000400,
WS_EX_RIGHT = 0x00001000,
WS_EX_LEFT = 0x00000000,
WS_EX_RTLREADING = 0x00002000,
WS_EX_LTRREADING = 0x00000000,
WS_EX_LEFTSCROLLBAR = 0x00004000,
WS_EX_RIGHTSCROLLBAR = 0x00000000,
WS_EX_CONTROLPARENT = 0x00010000,
WS_EX_STATICEDGE = 0x00020000,
WS_EX_APPWINDOW = 0x00040000,
WS_BORDER = 0x00800000,
WS_CAPTION = 0x00C00000,
WS_CHILD = 0x40000000,
WS_CHILDWINDOW = 0x40000000,
WS_CLIPCHILDREN = 0x02000000,
WS_CLIPSIBLINGS = 0x04000000,
WS_DISABLED = 0x08000000,
WS_DLGFRAME = 0x00400000,
WS_GROUP = 0x00020000,
WS_HSCROLL = 0x00100000,
WS_ICONIC = 0x20000000,
WS_MAXIMIZE = 0x01000000,
WS_MAXIMIZEBOX = 0x00010000,
WS_MINIMIZE = 0x20000000,
WS_MINIMIZEBOX = 0x00020000,
WS_OVERLAPPED = 0x00000000,
WS_SIZEBOX = 0x00040000,
WS_SYSMENU = 0x00080000,
WS_TABSTOP = 0x00010000,
WS_THICKFRAME = 0x00040000,
WS_TILED = 0x00000000,
WS_VISIBLE = 0x10000000,
WS_VSCROLL = 0x00200000,
WS_POPUP = ((int)0x80000000),
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU,
WS_TILEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
WAIT_OBJECT_0 = 0x00000000,
PM_REMOVE = 0x0001,
SW_SHOW = 5,
INFINITE = 0xFFFFFFFF,
QS_ALLEVENTS = 0x04BF,
FILE_ATTRIBUTE_READONLY = 0x00000001,
FILE_ATTRIBUTE_HIDDEN = 0x00000002,
FILE_ATTRIBUTE_SYSTEM = 0x00000004,
FILE_ATTRIBUTE_DIRECTORY = 0x00000010,
FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
FILE_ATTRIBUTE_NORMAL = 0x00000080,
FILE_ATTRIBUTE_TEMPORARY = 0x00000100,
FILE_ATTRIBUTE_COMPRESSED = 0x00000800,
FILE_ATTRIBUTE_OFFLINE = 0x00001000
};
typedef struct RECT { int32_t left, top, right, bottom; } RECT;
typedef struct POINT { int32_t x, y; } POINT;
typedef struct WNDCLASSEXA {
uint32_t cbSize, style;
WNDPROC lpfnWndProc;
int32_t cbClsExtra, cbWndExtra;
void* hInstance;
void* hIcon;
void* hCursor;
int32_t hbrBackground;
const char* lpszMenuName;
const char* lpszClassName;
void* hIconSm;
} WNDCLASSEXA;
typedef struct MSG {
void* hwnd;
uint32_t message;
uintptr_t wParam, lParam;
uint32_t time;
POINT pt;
} MSG;
typedef struct SECURITY_ATTRIBUTES {
uint32_t nLength;
void* lpSecurityDescriptor;
bool32 bInheritHandle;
} SECURITY_ATTRIBUTES;
typedef DWORD COLORREF;
typedef DWORD* LPCOLORREF;
enum {
CF_TEXT = 1,
CF_BITMAP = 2,
CF_DIB = 8
};
int OpenClipboard(void*);
void* GetClipboardData(unsigned);
int CloseClipboard();
void* GlobalLock(void*);
int GlobalUnlock(void*);
size_t GlobalSize(void*);
bool32 EmptyClipboard(void);
bool32 IsClipboardFormatAvailable(uint32_t format);
uint32_t LoadLibraryA( const char *lpFileName );
void * GetModuleHandleA(const char* name);
uint16_t RegisterClassExA(const WNDCLASSEXA*);
intptr_t DefWindowProcA(void* hwnd, uint32_t msg, uintptr_t wparam, uintptr_t lparam);
void PostQuitMessage(int exitCode);
void* LoadIconA(void* hInstance, const char* iconName);
void* LoadCursorA(void* hInstance, const char* cursorName);
uint32_t GetLastError();
void * CreateWindowExA(uint32_t exstyle, const char* classname, const char* windowname, int32_t style, int32_t x, int32_t y, int32_t width, int32_t height, void * parent_hwnd, void * hmenu, void * hinstance, void * param);
bool32 ShowWindow(void* hwnd, int32_t command);
bool32 UpdateWindow(void* hwnd);
bool32 SetWindowTextA(void *hWnd, const char *lpString);
int GetKeyState( int nVirtKey );
int GetMessageA(MSG* out_msg, void* hwnd, uint32_t filter_min, uint32_t filter_max);
int PeekMessageA(MSG* out_msg, void* hwnd, uint32_t filter_min, uint32_t filter_max, uint32_t removalMode);
bool32 TranslateMessage(const MSG* msg);
intptr_t DispatchMessageA(const MSG* msg);
bool32 InvalidateRect(void* hwnd, const RECT*, bool32 erase);
void* CreateEventA(SECURITY_ATTRIBUTES*, bool32 manualReset, bool32 initialState, const char* name);
uint32_t MsgWaitForMultipleObjects(uint32_t count, void** handles, bool32 waitAll, uint32_t ms, uint32_t wakeMask);
bool32 GetOpenFileNameA( LPOPENFILENAME lpofn);
bool32 CreateDirectoryA( const char* lpPathName, LPSECURITY_ATTRIBUTES lpsec );
uint32_t FindFirstFileA( const char* lpFileName, LPWIN32_FIND_DATA lpFindFileData );
bool32 FindNextFileA( uint32_t hFindFile, LPWIN32_FIND_DATA lpFindFileData );
bool32 FindClose( uint32_t hFindFile );
bool32 MessageBoxA(uint32_t, const char * message, const char * title, uint32_t ok);
void keybd_event(uint8_t bVk, uint8_t bScan, uint32_t dwFlags, void * dwExtraInfo);
void Sleep(DWORD dwMilliseconds);
bool32 FileTimeToSystemTime( const FILETIME *lpFileTime, PSYSTEMTIME lpSystemTime);
int GetObjectA(void * hgdiobj, uint32_t cbBuffer, void * lpvObject);
uint32_t GetBitmapBits( void * hbmp, uint32_t cbBuffer,void * lpvBits);
uint32_t CreateSolidBrush(uint32_t crColor);
uint32_t GetSysColorBrush(int nIndex);
]]
| mit |
Death15/SuperSwatchTG | plugins/media.lua | 297 | 1590 | do
local function run(msg, matches)
local receiver = get_receiver(msg)
local url = matches[1]
local ext = matches[2]
local file = download_to_file(url)
local cb_extra = {file_path=file}
local mime_type = mimetype.get_content_type_no_sub(ext)
if ext == 'gif' then
print('send_file')
send_document(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'text' then
print('send_document')
send_document(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'image' then
print('send_photo')
send_photo(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'audio' then
print('send_audio')
send_audio(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'video' then
print('send_video')
send_video(receiver, file, rmtmp_cb, cb_extra)
else
print('send_file')
send_file(receiver, file, rmtmp_cb, cb_extra)
end
end
return {
description = "When user sends media URL (ends with gif, mp4, pdf, etc.) download and send it to origin.",
usage = "",
patterns = {
"(https?://[%w-_%.%?%.:/%+=&]+%.(gif))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(mp4))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(pdf))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(ogg))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(zip))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(mp3))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(rar))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(wmv))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(doc))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(avi))$",
"(https?://[%w-_%.%?%.:/%+=&]+%.(webp))$"
},
run = run
}
end
| gpl-2.0 |
e-lab/torch-toolbox | Sanitize/sanitize.lua | 1 | 2501 | require('torch')
require('nn')
require('cunn')
require('cudnn')
-- common obj name to be freed
local common = {'output', 'gradInput'}
-- temporary buffer name other than output/gradInput
local t = {
-- convolution
['nn.SpatialConvolution'] = {'finput', 'fgradInput'},
['nn.SpatialConvolutionMM'] = {'finput', 'fgradInput'},
-- pooling
['nn.SpatialMaxPooling'] = {'indices'},
['nn.TemporalMaxPooling'] = {'indices'},
['nn.VolumetricMaxPooling'] = {'indices'},
['nn.SpatialFractionalMaxPooling'] = {'indices'},
-- regularizer
['nn.BatchNormalization'] = {'buffer', 'buffer2', 'centered', 'normalized'},
['nn.SpatialBatchNormalization'] = {'buffer', 'buffer2','centered', 'normalized'},
['nn.Dropout'] = {'noise'},
['nn.SpatialDropout'] = {'noise'},
-- transfer
['nn.PReLU'] = {'gradWeightBuf', 'gradWeightBuf2'},
['nn.LogSigmoid'] = {'buffer'},
-- etc
['nn.Mean'] = {'_gradInput'},
['nn.Normalize'] = {'_output', 'norm', 'normp'},
['nn.PairwiseDistance'] = {'diff'},
['nn.Reshape'] = {'_input', '_gradOutput'},
-- fbcunn
['nn.AbstractParallel'] = {'homeGradBuffers', 'input_gpu', 'gradOutput_gpu', 'gradInput_gpu'},
['nn.DataParallel'] = {'homeGradBuffers', 'input_gpu', 'gradOutput_gpu', 'gradInput_gpu'},
['nn.ModelParallel'] = {'homeGradBuffers', 'input_gpu', 'gradOutput_gpu', 'gradInput_gpu'},
}
local function free_table_or_tensor(val, name, field)
if type(val[name]) == 'table' then
val[name] = {}
elseif type(val[name]) == 'userdata' then
val[name] = field.new()
end
end
local function is_member(name, t)
if t == nil then
return false
end
for _, value in pairs(t) do
if name == value then
return true
end
end
return false
end
-- Taken and modified from Soumith's imagenet-multiGPU.torch code
-- https://github.com/soumith/imagenet-multiGPU.torch/blob/master/train.lua
local function sanitize(model)
local list = model:listModules()
for _,val in ipairs(list) do
for name,field in pairs(val) do
-- remove ffi obj
if torch.type(field) == 'cdata' then
val[name] = nil
-- remove common obj
elseif is_member(name, common) then
free_table_or_tensor(val, name, field)
-- remove specific obj
elseif is_member(name, t[val.__typename]) then
free_table_or_tensor(val, name, field)
end
end
end
return model
end
return sanitize
| bsd-3-clause |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/clothing/clothing_bodysuit_field_15.lua | 2 | 3422 | --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_bodysuit_field_15 = object_draft_schematic_clothing_shared_clothing_bodysuit_field_15:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Tactical Skinsuit",
craftingToolTab = 8, -- (See DraftSchemticImplementation.h)
complexity = 21,
size = 3,
xpType = "crafting_clothing_general",
xp = 900,
assemblySkill = "clothing_assembly",
experimentingSkill = "clothing_experimentation",
customizationSkill = "clothing_customization",
customizationOptions = {2, 1},
customizationStringNames = {"/private/index_color_1", "/private/index_color_2"},
customizationDefaults = {55, 40},
ingredientTemplateNames = {"craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n"},
ingredientTitleNames = {"highly_elastic_skin_fabric", "wiring_and_reinforcement", "hardware"},
ingredientSlotType = {0, 0, 1},
resourceTypes = {"petrochem_inert_polymer", "petrochem_inert_polymer", "object/tangible/component/clothing/shared_metal_fasteners.iff"},
resourceQuantities = {240, 60, 4},
contribution = {100, 100, 100},
targetTemplate = "object/tangible/wearables/bodysuit/bodysuit_s15.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_clothing_clothing_bodysuit_field_15, "object/draft_schematic/clothing/clothing_bodysuit_field_15.iff")
| lgpl-3.0 |
Whit3Tig3R/telegrambot2 | plugins/weather.lua | 274 | 1531 | do
local BASE_URL = "http://api.openweathermap.org/data/2.5/weather"
local function get_weather(location)
print("Finding weather in ", location)
location = string.gsub(location," ","+")
local url = BASE_URL
url = url..'?q='..location
url = url..'&units=metric'
url = url..'&appid=bd82977b86bf27fb59a04b61b657fb6f'
local b, c, h = http.request(url)
if c ~= 200 then return nil end
local weather = json:decode(b)
local city = weather.name
local country = weather.sys.country
local temp = 'The temperature in '..city
..' (' ..country..')'
..' is '..weather.main.temp..'°C'
local conditions = 'Current conditions are: '
.. weather.weather[1].description
if weather.weather[1].main == 'Clear' then
conditions = conditions .. ' ☀'
elseif weather.weather[1].main == 'Clouds' then
conditions = conditions .. ' ☁☁'
elseif weather.weather[1].main == 'Rain' then
conditions = conditions .. ' ☔'
elseif weather.weather[1].main == 'Thunderstorm' then
conditions = conditions .. ' ☔☔☔☔'
end
return temp .. '\n' .. conditions
end
local function run(msg, matches)
local city = 'Madrid,ES'
if matches[1] ~= '!weather' then
city = matches[1]
end
local text = get_weather(city)
if not text then
text = 'Can\'t get weather from that city.'
end
return text
end
return {
description = "weather in that city (Madrid is default)",
usage = "!weather (city)",
patterns = {
"^!weather$",
"^!weather (.*)$"
},
run = run
}
end
| gpl-2.0 |
eraffxi/darkstar | scripts/zones/Outer_Horutoto_Ruins/TextIDs.lua | 2 | 2336 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6586; -- You cannot obtain the item <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6592; -- Obtained: <item>.
GIL_OBTAINED = 6593; -- Obtained <number> gil.
KEYITEM_OBTAINED = 6595; -- Obtained key item: <keyitem>.
-- Treasure Coffer/Chest Dialog
CHEST_UNLOCKED = 7278; -- You unlock the chest!
CHEST_FAIL = 7279; -- Fails to open the chest.
CHEST_TRAP = 7280; -- The chest was trapped!
CHEST_WEAK = 7281; -- You cannot open the chest when you are in a weakened state.
CHEST_MIMIC = 7282; -- The chest was a mimic!
CHEST_MOOGLE = 7283; -- You cannot open the chest while participating in the moogle event.
CHEST_ILLUSION = 7284; -- The chest was but an illusion...
CHEST_LOCKED = 7285; -- The chest appears to be locked.
-- Mission Texts
ORB_ALREADY_PLACED = 0; -- A dark Mana Orb is already placed here.
G_ORB_ALREADY_GOTTEN = 3; -- You have already retrieved a glowing Mana Orb from here.
RETRIEVED_ALL_G_ORBS = 4; -- You have retrieved all of the glowing Mana Orbs.
ALL_DARK_MANA_ORBS_SET = 5; -- You have set all of the dark Mana Orbs in place.
FIRST_DARK_ORB_IN_PLACE = 6; -- The first Mana Orb receptacle is ready for use.
SECOND_DARK_ORB_IN_PLACE = 7; -- The second Mana Orb receptacle is ready for use.
THIRD_DARK_ORB_IN_PLACE = 8; -- Third Mana Orb Receptacle is ready for use.
FOURTH_DARK_ORB_IN_PLACE = 9; -- Forth Mana Orb Receptacle is ready for use.
FIFTH_DARK_ORB_IN_PLACE = 10; -- Fifth Mana Orb Receptacle is ready for use.
SIXTH_DARK_ORB_IN_PLACE = 11; -- Sixth Mana Orb Receptacle is ready for use.
dsp.ki.DARK_MANA_ORB_RECHARGER = 12; -- This appears to be a device that recharges Mana Orbs.
DOOR_FIRMLY_SHUT = 7253; -- The door is firmly shut.
ALL_G_ORBS_ENERGIZED = 7256; -- The six Mana Orbs have been successfully energized with magic!
-- conquest Base
CONQUEST_BASE = 15;
-- Strange Apparatus
DEVICE_NOT_WORKING = 188; -- The device is not working.
SYS_OVERLOAD = 197; -- arning! Sys...verload! Enterin...fety mode. ID eras...d
YOU_LOST_THE = 202; -- You lost the #.
| gpl-3.0 |
mramir8274/x.ybot | plugins/ingroup.lua | 527 | 44020 | do
-- Check Member
local function check_member_autorealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Welcome to your new realm !')
end
end
end
local function check_member_realm_add(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been added!')
end
end
end
function check_member_group(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'You have been promoted as the owner.')
end
end
end
local function check_member_modadd(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_name = 'yes',
lock_photo = 'no',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group is added and you have been promoted as the owner ')
end
end
end
local function automodadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_group,{receiver=receiver, data=data, msg = msg})
end
end
local function autorealmadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_autorealm,{receiver=receiver, data=data, msg = msg})
end
end
local function check_member_realmrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Realm configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Realm has been removed!')
end
end
end
local function check_member_modrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Group has been removed')
end
end
end
--End Check Member
local function show_group_settingsmod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local bots_protection = "Yes"
if data[tostring(msg.to.id)]['settings']['lock_bots'] then
bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots']
end
local leave_ban = "no"
if data[tostring(msg.to.id)]['settings']['leave_ban'] then
leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nLock group leave : "..leave_ban.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection--"\nPublic: "..public
return text
end
local function set_descriptionmod(msg, data, target, about)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function get_description(msg, data)
local data_cat = 'description'
if not data[tostring(msg.to.id)][data_cat] then
return 'No description available.'
end
local about = data[tostring(msg.to.id)][data_cat]
local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about
return 'About '..about
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'Arabic is already locked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'Arabic has been locked'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'Arabic is already unlocked'
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'Arabic has been unlocked'
end
end
local function lock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'yes' then
return 'Bots protection is already enabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'yes'
save_data(_config.moderation.data, data)
return 'Bots protection has been enabled'
end
end
local function unlock_group_bots(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'no' then
return 'Bots protection is already disabled'
else
data[tostring(target)]['settings']['lock_bots'] = 'no'
save_data(_config.moderation.data, data)
return 'Bots protection has been disabled'
end
end
local function lock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function unlock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
local function lock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function unlock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "Only admins can do it for now"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
local function set_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'yes' then
return 'Group is already public'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group is now: public'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'no' then
return 'Group is not public'
else
data[tostring(target)]['settings']['public'] = 'no'
save_data(_config.moderation.data, data)
return 'Group is now: not public'
end
end
local function lock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'yes' then
return 'Leaving users will be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Leaving users will be banned'
end
local function unlock_group_leave(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'no' then
return 'Leaving users will not be banned'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'no'
save_data(_config.moderation.data, data)
return 'Leaving users will not be banned'
end
end
local function unlock_group_photomod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
local function modadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if is_group(msg) then
return 'Group is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg})
end
local function realmadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if is_realm(msg) then
return 'Realm is already added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realm_add,{receiver=receiver, data=data, msg = msg})
end
-- Global functions
function modrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if not is_group(msg) then
return 'Group is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg})
end
function realmrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "You're not admin"
end
local data = load_data(_config.moderation.data)
if not is_realm(msg) then
return 'Realm is not added.'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realmrem,{receiver=receiver, data=data, msg = msg})
end
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(msg.to.id)][data_cat]
local rules = 'Chat rules:\n'..rules
return rules
end
local function set_group_photo(msg, success, result)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
chat_set_photo (receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes'
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'Photo saved!', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
local function promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is already a moderator.')
end
data[group]['moderators'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username..' has been promoted.')
end
local function promote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'.. msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return promote(get_receiver(msg), member_username, member_id)
end
end
local function demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if not data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is not a moderator.')
end
data[group]['moderators'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username..' has been demoted.')
end
local function demote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'..msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return demote(get_receiver(msg), member_username, member_id)
end
end
local function setowner_by_reply(extra, success, result)
local msg = result
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
local name_log = msg.from.print_name:gsub("_", " ")
data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] setted ["..msg.from.id.."] as owner")
local text = msg.from.print_name:gsub("_", " ").." is the owner now"
return send_large_msg(receiver, text)
end
local function promote_demote_res(extra, success, result)
--vardump(result)
--vardump(extra)
local member_id = result.id
local member_username = "@"..result.username
local chat_id = extra.chat_id
local mod_cmd = extra.mod_cmd
local receiver = "chat#id"..chat_id
if mod_cmd == 'promote' then
return promote(receiver, member_username, member_id)
elseif mod_cmd == 'demote' then
return demote(receiver, member_username, member_id)
end
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'Group is not added.'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function callbackres(extra, success, result)
--vardump(result)
local user = result.id
local name = string.gsub(result.print_name, "_", " ")
local chat = 'chat#id'..extra.chatid
send_large_msg(chat, user..'\n'..name)
return user
end
local function help()
local help_text = tostring(_config.help_text)
return help_text
end
local function cleanmember(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user(v.id, result.id)
end
end
local function killchat(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function killrealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function user_msgs(user_id, chat_id)
local user_info
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info = tonumber(redis:get(um_hash) or 0)
return user_info
end
local function kick_zero(cb_extra, success, result)
local chat_id = cb_extra.chat_id
local chat = "chat#id"..chat_id
local ci_user
local re_user
for k,v in pairs(result.members) do
local si = false
ci_user = v.id
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
for i = 1, #users do
re_user = users[i]
if tonumber(ci_user) == tonumber(re_user) then
si = true
end
end
if not si then
if ci_user ~= our_id then
if not is_momod2(ci_user, chat_id) then
chat_del_user(chat, 'user#id'..ci_user, ok_cb, true)
end
end
end
end
end
local function kick_inactive(chat_id, num, receiver)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = user_msgs(user_id, chat_id)
local nmsg = user_info
if tonumber(nmsg) < tonumber(num) then
if not is_momod2(user_id, chat_id) then
chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true)
end
end
end
return chat_info(receiver, kick_zero, {chat_id = chat_id})
end
local function run(msg, matches)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
local name_log = user_print_name(msg.from)
local group = msg.to.id
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then
load_photo(msg.id, set_group_photo, msg)
end
end
if matches[1] == 'add' and not matches[2] then
if is_realm(msg) then
return 'Error: Already a realm.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added")
return modadd(msg)
end
if matches[1] == 'add' and matches[2] == 'realm' then
if is_group(msg) then
return 'Error: Already a group.'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm")
return realmadd(msg)
end
if matches[1] == 'rem' and not matches[2] then
print("group "..msg.to.print_name.."("..msg.to.id..") removed")
return modrem(msg)
end
if matches[1] == 'rem' and matches[2] == 'realm' then
print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm")
return realmrem(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then
return automodadd(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then
return autorealmadd(msg)
end
if msg.to.id and data[tostring(msg.to.id)] then
local settings = data[tostring(msg.to.id)]['settings']
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_member_lock = settings.lock_member
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then
chat_del_user(chat, user, ok_cb, true)
elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then
return nil
elseif group_member_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_del_user' then
if not msg.service then
-- return "Are you trying to troll me?"
end
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user)
end
if matches[1] == 'chat_delete_photo' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_rename' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_name_set = settings.set_name
local group_name_lock = settings.lock_name
local to_rename = 'chat#id'..msg.to.id
if group_name_lock == 'yes' then
if group_name_set ~= tostring(msg.to.print_name) then
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:incr(namehash)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
local nameprotectionredis = redis:get(namehash)
if nameprotectionredis then
if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:set(namehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
elseif group_name_lock == 'no' then
return nil
end
end
if matches[1] == 'setname' and is_momod(msg) then
local new_name = string.gsub(matches[2], '_', ' ')
data[tostring(msg.to.id)]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(msg.to.id)]['settings']['set_name']
local to_rename = 'chat#id'..msg.to.id
rename_chat(to_rename, group_name_set, ok_cb, false)
savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]")
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
return 'Please send me new group photo now'
end
if matches[1] == 'promote' and not matches[2] then
if not is_owner(msg) then
return "Only the owner can prmote new moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, promote_by_reply, false)
end
end
if matches[1] == 'promote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can promote"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'promote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'demote' and not matches[2] then
if not is_owner(msg) then
return "Only the owner can demote moderators"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, demote_by_reply, false)
end
end
if matches[1] == 'demote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner can demote"
end
if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then
return "You can't demote yourself"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'demote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'modlist' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
end
if matches[1] == 'about' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description")
return get_description(msg, data)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'set' then
if matches[2] == 'rules' then
rules = matches[3]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]")
return set_rulesmod(msg, data, target)
end
if matches[2] == 'about' then
local data = load_data(_config.moderation.data)
local target = msg.to.id
local about = matches[3]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]")
return set_descriptionmod(msg, data, target, about)
end
end
if matches[1] == 'lock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_floodmod(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ")
return lock_group_bots(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ")
return lock_group_leave(msg, data, target)
end
end
if matches[1] == 'unlock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ")
return unlock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
if matches[2] == 'photo' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ")
return unlock_group_photomod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ")
return unlock_group_floodmod(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked arabic ")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ")
return unlock_group_bots(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ")
return unlock_group_leave(msg, data, target)
end
end
if matches[1] == 'settings' then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ")
return show_group_settingsmod(msg, data, target)
end
--[[if matches[1] == 'public' then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public")
return unset_public_membermod(msg, data, target)
end
end]]
if matches[1] == 'newlink' and not is_realm(msg) then
if not is_momod(msg) then
return "For moderators only!"
end
local function callback (extra , success, result)
local receiver = 'chat#'..msg.to.id
if success == 0 then
return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.')
end
send_large_msg(receiver, "Created a new link")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
local receiver = 'chat#'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] revoked group link ")
return export_chat_link(receiver, callback, true)
end
if matches[1] == 'link' then
if not is_momod(msg) then
return "For moderators only!"
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first !"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "Group link:\n"..group_link
end
if matches[1] == 'setowner' and matches[2] then
if not is_owner(msg) then
return "For owner only!"
end
data[tostring(msg.to.id)]['set_owner'] = matches[2]
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = matches[2].." added as owner"
return text
end
if matches[1] == 'setowner' and not matches[2] then
if not is_owner(msg) then
return "only for the owner!"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, setowner_by_reply, false)
end
end
if matches[1] == 'owner' then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
return "no owner,ask admins in support groups to set owner for your group"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
return "Group owner is ["..group_owner..']'
end
if matches[1] == 'setgpowner' then
local receiver = "chat#id"..matches[2]
if not is_admin(msg) then
return "For admins only!"
end
data[tostring(matches[2])]['set_owner'] = matches[3]
save_data(_config.moderation.data, data)
local text = matches[3].." added as owner"
send_large_msg(receiver, text)
return
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return "For moderators only!"
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
return 'Group flood has been set to '..matches[2]
end
if matches[1] == 'clean' then
if not is_owner(msg) then
return "Only owner can clean"
end
if matches[2] == 'member' then
if not is_owner(msg) then
return "Only admins can clean members"
end
local receiver = get_receiver(msg)
chat_info(receiver, cleanmember, {receiver=receiver})
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'No moderator in this group.'
end
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
end
if matches[2] == 'rules' then
local data_cat = 'rules'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
end
if matches[2] == 'about' then
local data_cat = 'description'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
end
end
if matches[1] == 'kill' and matches[2] == 'chat' then
if not is_admin(msg) then
return nil
end
if not is_realm(msg) then
local receiver = get_receiver(msg)
return modrem(msg),
print("Closing Group..."),
chat_info(receiver, killchat, {receiver=receiver})
else
return 'This is a realm'
end
end
if matches[1] == 'kill' and matches[2] == 'realm' then
if not is_admin(msg) then
return nil
end
if not is_group(msg) then
local receiver = get_receiver(msg)
return realmrem(msg),
print("Closing Realm..."),
chat_info(receiver, killrealm, {receiver=receiver})
else
return 'This is a group'
end
end
if matches[1] == 'help' then
if not is_momod(msg) or is_realm(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help")
return help()
end
if matches[1] == 'res' and is_momod(msg) then
local cbres_extra = {
chatid = msg.to.id
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username)
return res_user(username, callbackres, cbres_extra)
end
if matches[1] == 'kickinactive' then
--send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]')
if not is_momod(msg) then
return 'Only a moderator can kick inactive users'
end
local num = 1
if matches[2] then
num = matches[2]
end
local chat_id = msg.to.id
local receiver = get_receiver(msg)
return kick_inactive(chat_id, num, receiver)
end
end
end
return {
patterns = {
"^[!/](add)$",
"^[!/](add) (realm)$",
"^[!/](rem)$",
"^[!/](rem) (realm)$",
"^[!/](rules)$",
"^[!/](about)$",
"^[!/](setname) (.*)$",
"^[!/](setphoto)$",
"^[!/](promote) (.*)$",
"^[!/](promote)",
"^[!/](help)$",
"^[!/](clean) (.*)$",
"^[!/](kill) (chat)$",
"^[!/](kill) (realm)$",
"^[!/](demote) (.*)$",
"^[!/](demote)",
"^[!/](set) ([^%s]+) (.*)$",
"^[!/](lock) (.*)$",
"^[!/](setowner) (%d+)$",
"^[!/](setowner)",
"^[!/](owner)$",
"^[!/](res) (.*)$",
"^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^[!/](unlock) (.*)$",
"^[!/](setflood) (%d+)$",
"^[!/](settings)$",
-- "^[!/](public) (.*)$",
"^[!/](modlist)$",
"^[!/](newlink)$",
"^[!/](link)$",
"^[!/](kickinactive)$",
"^[!/](kickinactive) (%d+)$",
"%[(photo)%]",
"^!!tgservice (.+)$",
},
run = run
}
end
| gpl-2.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/space/shields/serverobjects.lua | 3 | 3911 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--Children folder includes
-- Server Objects
includeFile("draft_schematic/space/shields/adv_deflector_shields.lua")
includeFile("draft_schematic/space/shields/basic_shields.lua")
includeFile("draft_schematic/space/shields/deflector_shields.lua")
includeFile("draft_schematic/space/shields/exp_deflector_shields.lua")
includeFile("draft_schematic/space/shields/heavy_deflector_shields.lua")
includeFile("draft_schematic/space/shields/light_deflector_shields.lua")
includeFile("draft_schematic/space/shields/shield_energy_saver_kit_mk1.lua")
includeFile("draft_schematic/space/shields/shield_energy_saver_kit_mk2.lua")
includeFile("draft_schematic/space/shields/shield_energy_saver_kit_mk3.lua")
includeFile("draft_schematic/space/shields/shield_energy_saver_kit_mk4.lua")
includeFile("draft_schematic/space/shields/shield_energy_saver_kit_mk5.lua")
includeFile("draft_schematic/space/shields/shield_intensifier_mk1.lua")
includeFile("draft_schematic/space/shields/shield_intensifier_mk2.lua")
includeFile("draft_schematic/space/shields/shield_intensifier_mk3.lua")
includeFile("draft_schematic/space/shields/shield_intensifier_mk4.lua")
includeFile("draft_schematic/space/shields/shield_intensifier_mk5.lua")
includeFile("draft_schematic/space/shields/shield_limiter_mk1.lua")
includeFile("draft_schematic/space/shields/shield_limiter_mk2.lua")
includeFile("draft_schematic/space/shields/shield_limiter_mk3.lua")
includeFile("draft_schematic/space/shields/shield_limiter_mk4.lua")
includeFile("draft_schematic/space/shields/shield_limiter_mk5.lua")
includeFile("draft_schematic/space/shields/shield_overcharger_mk1.lua")
includeFile("draft_schematic/space/shields/shield_overcharger_mk2.lua")
includeFile("draft_schematic/space/shields/shield_overcharger_mk3.lua")
includeFile("draft_schematic/space/shields/shield_overcharger_mk4.lua")
includeFile("draft_schematic/space/shields/shield_overcharger_mk5.lua")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/commands/harmful.lua | 4 | 2114 | --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
HarmfulCommand = {
name = "harmful",
}
AddCommand(HarmfulCommand)
| lgpl-3.0 |
eraffxi/darkstar | scripts/zones/Temple_of_Uggalepih/npcs/_4fx.lua | 2 | 1536 | -----------------------------------
-- Area: Temple of Uggalepih
-- NPC: Granite Door
-- !pos 340 0.1 329 159
-----------------------------------
package.loaded["scripts/zones/Temple_of_Uggalepih/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Temple_of_Uggalepih/TextIDs");
require("scripts/globals/missions");
require("scripts/globals/keyitems");
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(1143,1) and trade:getItemCount() == 1 and player:getZPos() < 332) then -- Trade cursed key
if (player:getCurrentMission(WINDURST) == AWAKENING_OF_THE_GODS and player:getVar("MissionStatus") == 4) then
player:tradeComplete();
player:startEvent(23);
else
player:tradeComplete();
player:messageSpecial(YOUR_KEY_BREAKS,0,1143);
player:startEvent(25);
end
else
player:messageSpecial(NOTHING_HAPPENS);
end
end;
function onTrigger(player,npc)
if (player:getZPos() < 332) then
player:messageSpecial(DOOR_LOCKED);
else
player:startEvent(26);
end
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
if (csid == 23) then
player:setPos(340,0,333);
player:delKeyItem(dsp.ki.BLANK_BOOK_OF_THE_GODS);
player:addKeyItem(dsp.ki.BOOK_OF_THE_GODS);
player:messageSpecial(KEYITEM_OBTAINED,dsp.ki.BOOK_OF_THE_GODS);
player:setVar("MissionStatus",5);
end
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/components/shield_generator/shd_unknown_holosteel_x1.lua | 3 | 2352 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_ship_components_shield_generator_shd_unknown_holosteel_x1 = object_tangible_ship_components_shield_generator_shared_shd_unknown_holosteel_x1:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_shield_generator_shd_unknown_holosteel_x1, "object/tangible/ship/components/shield_generator/shd_unknown_holosteel_x1.iff")
| lgpl-3.0 |
eraffxi/darkstar | scripts/globals/items/serving_of_herb_quus.lua | 2 | 1076 | -----------------------------------------
-- ID: 4559
-- Item: serving_of_herb_quus
-- Food Effect: 180Min, All Races
-----------------------------------------
-- Dexterity 1
-- Mind -1
-- Ranged ACC % 7
-- Ranged ACC Cap 10
-----------------------------------------
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,10800,4559);
end;
function onEffectGain(target, effect)
target:addMod(dsp.mod.DEX, 1);
target:addMod(dsp.mod.MND, -1);
target:addMod(dsp.mod.FOOD_RACCP, 7);
target:addMod(dsp.mod.FOOD_RACC_CAP, 10);
end;
function onEffectLose(target, effect)
target:delMod(dsp.mod.DEX, 1);
target:delMod(dsp.mod.MND, -1);
target:delMod(dsp.mod.FOOD_RACCP, 7);
target:delMod(dsp.mod.FOOD_RACC_CAP, 10);
end;
| gpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/draft_schematic/droid/droid_binary_load_lifter.lua | 2 | 4027 | --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_droid_binary_load_lifter = object_draft_schematic_droid_shared_droid_binary_load_lifter:new {
templateType = DRAFTSCHEMATIC,
customObjectName = "Deed for: Binary Load Lifter Droid",
craftingToolTab = 32, -- (See DraftSchemticImplementation.h)
complexity = 30,
size = 1,
xpType = "crafting_droid_general",
xp = 4000,
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", "craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n", "craft_droid_ingredients_n"},
ingredientTitleNames = {"primary_frame", "secondary_frame", "support_struts", "frame_sub_assembly", "leg_struts", "droid_brain", "manipulator_arm", "motivator", "sensor_suite", "droid_defensive_module"},
ingredientSlotType = {0, 0, 0, 0, 0, 1, 1, 1, 1, 3},
resourceTypes = {"steel", "steel_duranium", "metal", "fiberplast", "steel_duralloy", "object/tangible/component/droid/shared_droid_brain.iff", "object/tangible/component/droid/shared_manipulator_arm.iff", "object/tangible/component/droid/shared_droid_motive_system_advanced.iff", "object/tangible/component/droid/shared_sensor_package_droid.iff", "object/tangible/component/droid/shared_defensive_module_base.iff"},
resourceQuantities = {250, 250, 750, 500, 750, 1, 2, 6, 1, 1},
contribution = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100},
targetTemplate = "object/tangible/deed/pet_deed/deed_binary_load_lifter_basic.iff",
additionalTemplates = {
}
}
ObjectTemplates:addTemplate(object_draft_schematic_droid_droid_binary_load_lifter, "object/draft_schematic/droid/droid_binary_load_lifter.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/crafted/shields/shield_energy_saver_kit_mk5.lua | 1 | 2906 | --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_shields_shield_energy_saver_kit_mk5 = object_tangible_ship_crafted_shields_shared_shield_energy_saver_kit_mk5:new {
numberExperimentalProperties = {1, 1, 2, 2, 2},
experimentalProperties = {"XX", "XX", "OQ", "UT", "OQ", "UT", "OQ", "UT"},
experimentalWeights = {1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "exp_shield_max_front_hp", "exp_shield_max_back_hp", "exp_energy_maintenance"},
experimentalSubGroupTitles = {"null", "null", "shield_max_front_hp", "shield_max_back_hp", "energy_maintenance"},
experimentalMin = {0, 0, -422, -422, -446},
experimentalMax = {0, 0, -312, -312, -604},
experimentalPrecision = {0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_ship_crafted_shields_shield_energy_saver_kit_mk5, "object/tangible/ship/crafted/shields/shield_energy_saver_kit_mk5.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/tangible/ship/components/armor/arm_koensayr_light_advanced_durasteel.lua | 3 | 2360 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_ship_components_armor_arm_koensayr_light_advanced_durasteel = object_tangible_ship_components_armor_shared_arm_koensayr_light_advanced_durasteel:new {
}
ObjectTemplates:addTemplate(object_tangible_ship_components_armor_arm_koensayr_light_advanced_durasteel, "object/tangible/ship/components/armor/arm_koensayr_light_advanced_durasteel.iff")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/building/poi/dathomir_freedprisonercamp_small2.lua | 1 | 2272 | --Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_building_poi_dathomir_freedprisonercamp_small2 = object_building_poi_shared_dathomir_freedprisonercamp_small2:new {
}
ObjectTemplates:addTemplate(object_building_poi_dathomir_freedprisonercamp_small2, "object/building/poi/dathomir_freedprisonercamp_small2.iff")
| lgpl-3.0 |
meshr-net/meshr_tomato-RT-N | usr/lib/lua/luci/jsonrpc.lua | 12 | 2238 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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: jsonrpc.lua 3000 2008-08-29 12:27:54Z Cyrus $
]]--
module("luci.jsonrpc", package.seeall)
require "luci.json"
function resolve(mod, method)
local path = luci.util.split(method, ".")
for j=1, #path-1 do
if not type(mod) == "table" then
break
end
mod = rawget(mod, path[j])
if not mod then
break
end
end
mod = type(mod) == "table" and rawget(mod, path[#path]) or nil
if type(mod) == "function" then
return mod
end
end
function handle(tbl, rawsource, ...)
local decoder = luci.json.Decoder()
local stat = luci.ltn12.pump.all(rawsource, decoder:sink())
local json = decoder:get()
local response
local success = false
if stat then
if type(json.method) == "string"
and (not json.params or type(json.params) == "table") then
local method = resolve(tbl, json.method)
if method then
response = reply(json.jsonrpc, json.id,
proxy(method, unpack(json.params or {})))
else
response = reply(json.jsonrpc, json.id,
nil, {code=-32601, message="Method not found."})
end
else
response = reply(json.jsonrpc, json.id,
nil, {code=-32600, message="Invalid request."})
end
else
response = reply("2.0", nil,
nil, {code=-32700, message="Parse error."})
end
return luci.json.Encoder(response, ...):source()
end
function reply(jsonrpc, id, res, err)
require "luci.json"
id = id or luci.json.null
-- 1.0 compatibility
if jsonrpc ~= "2.0" then
jsonrpc = nil
res = res or luci.json.null
err = err or luci.json.null
end
return {id=id, result=res, error=err, jsonrpc=jsonrpc}
end
function proxy(method, ...)
local res = {luci.util.copcall(method, ...)}
local stat = table.remove(res, 1)
if not stat then
return nil, {code=-32602, message="Invalid params.", data=table.remove(res, 1)}
else
if #res <= 1 then
return res[1] or luci.json.null
else
return res
end
end
end
| apache-2.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/townsperson/serverobjects.lua | 1 | 2035 |
includeFile("townsperson/agriculturalist.lua")
includeFile("townsperson/artisan.lua")
includeFile("townsperson/audience_member.lua")
includeFile("townsperson/bartender.lua")
includeFile("townsperson/businessman.lua")
includeFile("townsperson/chassis_broker.lua")
includeFile("townsperson/cll8_binary_load_lifter.lua")
includeFile("townsperson/commoner.lua")
includeFile("townsperson/commoner_fat.lua")
includeFile("townsperson/commoner_old.lua")
includeFile("townsperson/commoner_naboo.lua")
includeFile("townsperson/commoner_tatooine.lua")
includeFile("townsperson/commoner_technician.lua")
includeFile("townsperson/contractor.lua")
includeFile("townsperson/default.lua")
includeFile("townsperson/entertainer.lua")
includeFile("townsperson/farmer.lua")
includeFile("townsperson/farmer_rancher.lua")
includeFile("townsperson/hunter.lua")
includeFile("townsperson/info_broker.lua")
includeFile("townsperson/judge.lua")
includeFile("townsperson/junk_dealer.lua")
includeFile("townsperson/medic.lua")
includeFile("townsperson/noble.lua")
includeFile("townsperson/patron_chiss.lua")
includeFile("townsperson/patron_devaronian.lua")
includeFile("townsperson/patron_ishitib.lua")
includeFile("townsperson/patron_ithorian.lua")
includeFile("townsperson/patron_klaatu.lua")
includeFile("townsperson/patron_nikto.lua")
includeFile("townsperson/patron_quarren.lua")
includeFile("townsperson/patron.lua")
includeFile("townsperson/rancher.lua")
includeFile("townsperson/ris_inventor.lua")
includeFile("townsperson/r2.lua")
includeFile("townsperson/r3.lua")
includeFile("townsperson/r4.lua")
includeFile("townsperson/r5.lua")
includeFile("townsperson/scavenger.lua")
includeFile("townsperson/scientist.lua")
includeFile("townsperson/slave.lua")
includeFile("townsperson/spacer.lua")
includeFile("townsperson/surgical_droid_21b.lua")
includeFile("townsperson/teras_kasi_master.lua")
includeFile("townsperson/theater_manager.lua")
includeFile("townsperson/twilek_slave.lua")
includeFile("townsperson/vendor.lua")
includeFile("townsperson/vrak.lua")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/mobile/event/event_dark_jedi_sentinel.lua | 1 | 1028 | event_dark_jedi_sentinel = Creature:new {
objectName = "@mob/creature_names:dark_jedi_sentinel",
customName = "a Dark Jedi Sentinel (event)",
socialGroup = "self",
pvpFaction = "self",
faction = "",
level = 300,
chanceHit = 300,
damageMin = 2645,
damageMax = 5000,
baseXp = 0,
baseHAM = 1106000,
baseHAMmax = 1352000,
armor = 3,
resists = {95,95,95,95,95,95,95,95,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + HERD + KILLER + STALKER,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_dark_jedi_human_male_01.iff",
"object/mobile/dressed_dark_jedi_human_female_01.iff"},
lootGroups = {},
weapons = {"dark_jedi_weapons_gen4"},
conversationTemplate = "",
attacks = merge(lightsabermaster,forcepowermaster)
}
CreatureTemplates:addCreatureTemplate(event_dark_jedi_sentinel, "event_dark_jedi_sentinel")
| lgpl-3.0 |
kidaa/Awakening-Core3 | bin/scripts/object/mobile/gamorrean.lua | 3 | 2152 | --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_gamorrean = object_mobile_shared_gamorrean:new {
}
ObjectTemplates:addTemplate(object_mobile_gamorrean, "object/mobile/gamorrean.iff")
| lgpl-3.0 |
sam1i/Turres-Monacorum | love2d/external/anim.lua | 3 | 5864 | --[[
Copyright (c) 2009-2013 Bart Bes
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
]]
local animation = {}
animation.__index = animation
--- Create a new animation
-- Replaces love.graphics.newAnimation
-- @param image The image that contains the frames
-- @param fw The frame width
-- @param fh The frame height
-- @param delay The delay between two frames
-- @param frames The number of frames, 0 for autodetect
-- @return The created animation
function newAnimation(image, fw, fh, delay, frames)
local a = {}
a.img = image
a.frames = {}
a.delays = {}
a.timer = 0
a.position = 1
a.fw = fw
a.fh = fh
a.playing = true
a.speed = 1
a.mode = 1
a.direction = 1
local imgw = image:getWidth()
local imgh = image:getHeight()
if frames == 0 then
frames = imgw / fw * imgh / fh
end
local rowsize = imgw/fw
for i = 1, frames do
local row = math.floor((i-1)/rowsize)
local column = (i-1)%rowsize
local frame = love.graphics.newQuad(column*fw, row*fh, fw, fh, imgw, imgh)
table.insert(a.frames, frame)
table.insert(a.delays, delay)
end
return setmetatable(a, animation)
end
--- Update the animation
-- @param dt Time that has passed since last call
function animation:update(dt)
if not self.playing then return end
self.timer = self.timer + dt * self.speed
if self.timer > self.delays[self.position] then
self.timer = self.timer - self.delays[self.position]
self.position = self.position + 1 * self.direction
if self.position > #self.frames then
if self.mode == 1 then
self.position = 1
elseif self.mode == 2 then
self.position = self.position - 1
self:stop()
elseif self.mode == 3 then
self.direction = -1
self.position = self.position - 1
end
elseif self.position < 1 and self.mode == 3 then
self.direction = 1
self.position = self.position + 1
elseif self.position < 1 and self.mode == 4 then
self.position = #self.frames
end
end
end
--- Draw the animation
local drawq = love.graphics.drawq or love.graphics.draw
function animation:draw(...)
return drawq(self.img, self.frames[self.position], ...)
end
--- Add a frame
-- @param x The X coordinate of the frame on the original image
-- @param y The Y coordinate of the frame on the original image
-- @param w The width of the frame
-- @param h The height of the frame
-- @param delay The delay before the next frame is shown
function animation:addFrame(x, y, w, h, delay)
local frame = love.graphics.newQuad(x, y, w, h, self.img:getWidth(), self.img:getHeight())
table.insert(self.frames, frame)
table.insert(self.delays, delay)
end
--- Play the animation
-- Starts it if it was stopped.
-- Basically makes sure it uses the delays
-- to switch to the next frame.
function animation:play()
self.playing = true
end
--- Stop the animation
function animation:stop()
self.playing = false
end
--- Reset
-- Go back to the first frame.
function animation:reset()
return self:seek(1)
end
--- Seek to a frame
-- @param frame The frame to display now
function animation:seek(frame)
self.position = frame
self.timer = 0
end
--- Get the currently shown frame
-- @return The current frame
function animation:getCurrentFrame()
return self.position
end
--- Get the number of frames
-- @return The number of frames
function animation:getSize()
return #self.frames
end
--- Set the delay between frames
-- @param frame Which frame to set the delay for
-- @param delay The delay
function animation:setDelay(frame, delay)
self.delays[frame] = delay
end
--- Set the speed
-- @param speed The speed to play at (1 is normal, 2 is double, etc)
function animation:setSpeed(speed)
self.speed = speed
end
--- Get the width of the current frame
-- @return The width of the current frame
function animation:getWidth()
return (select(3, self.frames[self.position]:getViewport()))
end
--- Get the height of the current frame
-- @return The height of the current frame
function animation:getHeight()
return (select(4, self.frames[self.position]:getViewport()))
end
--- Set the play mode
-- Could be "loop" to loop it, "once" to play it once, or "bounce" to play it, reverse it, and play it again (looping)
-- @param mode The mode: one of the above
function animation:setMode(mode)
if mode == "loop" then
self.mode = 1
self.direction = 1
elseif mode == "once" then
self.mode = 2
self.direction = 1
elseif mode == "bounce" then
self.mode = 3
elseif mode == "reverse" then
self.mode = 4
self.direction = -1
end
end
--- Animations_legacy_support
-- @usage Add legacy support, basically set love.graphics.newAnimation again, and allow you to use love.graphics.draw
if Animations_legacy_support then
love.graphics.newAnimation = newAnimation
local oldLGDraw = love.graphics.draw
function love.graphics.draw(item, ...)
if type(item) == "table" and item.draw then
return item:draw(...)
else
return oldLGDraw(item, ...)
end
end
end | mit |
davymai/CN-QulightUI | Interface/AddOns/Aurora/AddOns/Blizzard_LookingForGuildUI.lua | 1 | 3920 | local F, C = unpack(select(2, ...))
C.themes["Blizzard_LookingForGuildUI"] = function()
local r, g, b = C.r, C.g, C.b
F.SetBD(LookingForGuildFrame)
F.CreateBD(LookingForGuildInterestFrame, .25)
LookingForGuildInterestFrameBg:Hide()
F.CreateBD(LookingForGuildAvailabilityFrame, .25)
LookingForGuildAvailabilityFrameBg:Hide()
F.CreateBD(LookingForGuildRolesFrame, .25)
LookingForGuildRolesFrameBg:Hide()
F.CreateBD(LookingForGuildCommentFrame, .25)
LookingForGuildCommentFrameBg:Hide()
F.CreateBD(LookingForGuildCommentInputFrame, .12)
LookingForGuildFrame:DisableDrawLayer("BACKGROUND")
LookingForGuildFrame:DisableDrawLayer("BORDER")
LookingForGuildFrameInset:DisableDrawLayer("BACKGROUND")
LookingForGuildFrameInset:DisableDrawLayer("BORDER")
F.CreateBD(GuildFinderRequestMembershipFrame)
for i = 1, 9 do
select(i, LookingForGuildCommentInputFrame:GetRegions()):Hide()
end
for i = 1, 3 do
for j = 1, 6 do
select(j, _G["LookingForGuildFrameTab"..i]:GetRegions()):Hide()
select(j, _G["LookingForGuildFrameTab"..i]:GetRegions()).Show = F.dummy
end
end
for i = 1, 6 do
select(i, GuildFinderRequestMembershipFrameInputFrame:GetRegions()):Hide()
end
LookingForGuildFrameTabardBackground:Hide()
LookingForGuildFrameTabardEmblem:Hide()
LookingForGuildFrameTabardBorder:Hide()
LookingForGuildFramePortraitFrame:Hide()
LookingForGuildFrameTopBorder:Hide()
LookingForGuildFrameTopRightCorner:Hide()
F.Reskin(LookingForGuildBrowseButton)
F.Reskin(GuildFinderRequestMembershipFrameAcceptButton)
F.Reskin(GuildFinderRequestMembershipFrameCancelButton)
F.ReskinClose(LookingForGuildFrameCloseButton)
F.ReskinCheck(LookingForGuildQuestButton)
F.ReskinCheck(LookingForGuildDungeonButton)
F.ReskinCheck(LookingForGuildRaidButton)
F.ReskinCheck(LookingForGuildPvPButton)
F.ReskinCheck(LookingForGuildRPButton)
F.ReskinCheck(LookingForGuildWeekdaysButton)
F.ReskinCheck(LookingForGuildWeekendsButton)
F.ReskinInput(GuildFinderRequestMembershipFrameInputFrame)
-- [[ Browse frame ]]
F.Reskin(LookingForGuildRequestButton)
F.ReskinScroll(LookingForGuildBrowseFrameContainerScrollBar)
for i = 1, 5 do
local bu = _G["LookingForGuildBrowseFrameContainerButton"..i]
bu:SetBackdrop(nil)
bu:SetHighlightTexture("")
-- my client crashes if I put this in a var? :x
bu:GetRegions():SetTexture(C.media.backdrop)
bu:GetRegions():SetVertexColor(r, g, b, .2)
bu:GetRegions():SetPoint("TOPLEFT", 1, -1)
bu:GetRegions():SetPoint("BOTTOMRIGHT", -1, 2)
local bg = F.CreateBDFrame(bu, .25)
bg:SetPoint("TOPLEFT")
bg:SetPoint("BOTTOMRIGHT", 0, 1)
end
-- [[ Role buttons ]]
for _, roleButton in pairs({LookingForGuildTankButton, LookingForGuildHealerButton, LookingForGuildDamagerButton}) do
roleButton.cover:SetTexture(C.media.roleIcons)
roleButton:SetNormalTexture(C.media.roleIcons)
roleButton.checkButton:SetFrameLevel(roleButton:GetFrameLevel() + 2)
local left = roleButton:CreateTexture()
left:SetDrawLayer("OVERLAY", 1)
left:SetWidth(1)
left:SetTexture(C.media.backdrop)
left:SetVertexColor(0, 0, 0)
left:SetPoint("TOPLEFT", 5, -4)
left:SetPoint("BOTTOMLEFT", 5, 6)
local right = roleButton:CreateTexture()
right:SetDrawLayer("OVERLAY", 1)
right:SetWidth(1)
right:SetTexture(C.media.backdrop)
right:SetVertexColor(0, 0, 0)
right:SetPoint("TOPRIGHT", -5, -4)
right:SetPoint("BOTTOMRIGHT", -5, 6)
local top = roleButton:CreateTexture()
top:SetDrawLayer("OVERLAY", 1)
top:SetHeight(1)
top:SetTexture(C.media.backdrop)
top:SetVertexColor(0, 0, 0)
top:SetPoint("TOPLEFT", 5, -4)
top:SetPoint("TOPRIGHT", -5, -4)
local bottom = roleButton:CreateTexture()
bottom:SetDrawLayer("OVERLAY", 1)
bottom:SetHeight(1)
bottom:SetTexture(C.media.backdrop)
bottom:SetVertexColor(0, 0, 0)
bottom:SetPoint("BOTTOMLEFT", 5, 6)
bottom:SetPoint("BOTTOMRIGHT", -5, 6)
F.ReskinCheck(roleButton.checkButton)
end
end | gpl-2.0 |
ppriest/mame | 3rdparty/genie/tests/actions/make/test_makesettings.lua | 57 | 1055 | --
-- tests/actions/make/test_makesettings.lua
-- Tests makesettings lists in generated makefiles.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.make_settings = { }
local suite = T.make_settings
local make = premake.make
local sln, prj, cfg
function suite.setup()
_ACTION = "gmake"
sln = solution("MySolution")
configurations { "Debug", "Release" }
makesettings { "SOLUTION_LEVEL_SETTINGS" }
project("MyProject")
makesettings { "PROJECT_LEVEL_SETTINGS" }
configuration { "Debug" }
makesettings { "DEBUG_LEVEL_SETTINGS" }
configuration { "Release" }
makesettings { "RELEASE_LEVEL_SETTINGS" }
premake.bake.buildconfigs()
prj = premake.solution.getproject(sln, 1)
cfg = premake.getconfig(prj, "Debug")
end
function suite.writesProjectSettings()
make.settings(prj, premake.gcc)
test.capture [[
SOLUTION_LEVEL_SETTINGS
PROJECT_LEVEL_SETTINGS
]]
end
function suite.writesConfigSettings()
make.settings(cfg, premake.gcc)
test.capture [[
DEBUG_LEVEL_SETTINGS
]]
end
| gpl-2.0 |
ddysher/turbo | turbo/3rdparty/JSON.lua | 10 | 26141 | -- -*- coding: utf-8 -*-
--
-- Copyright 2010-2011 Jeffrey Friedl
-- http://regex.info/blog/
--
local VERSION = 20111207.5 -- version history at end of file
local OBJDEF = { VERSION = VERSION }
--
-- Simple JSON encoding and decoding in pure Lua.
-- http://www.json.org/
--
--
-- JSON = loadfile "JSON.lua" -- one-time load of the routines
--
-- local lua_value = JSON:decode(raw_json_text)
--
-- local raw_json_text = JSON:encode(lua_table_or_value)
-- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability
--
--
-- DECODING
--
-- JSON = (loadfile "JSON.lua")() -- one-time load of the routines
--
-- local lua_value = JSON:decode(raw_json_text)
--
-- If the JSON text is for an object or an array, e.g.
-- { "what": "books", "count": 3 }
-- or
-- [ "Larry", "Curly", "Moe" ]
--
-- the result is a Lua table, e.g.
-- { what = "books", count = 3 }
-- or
-- { "Larry", "Curly", "Moe" }
--
--
-- The encode and decode routines accept an optional second argument, "etc", which is not used
-- during encoding or decoding, but upon error is passed along to error handlers. It can be of any
-- type (including nil).
--
-- With most errors during decoding, this code calls
--
-- JSON:onDecodeError(message, text, location, etc)
--
-- with a message about the error, and if known, the JSON text being parsed and the byte count
-- where the problem was discovered. You can replace the default JSON:onDecodeError() with your
-- own function.
--
-- The default onDecodeError() merely augments the message with data about the text and the
-- location if known (and if a second 'etc' argument had been provided to decode(), its value is
-- tacked onto the message as well), and then calls JSON.assert(), which itself defaults to Lua's
-- built-in assert(), and can also be overridden.
--
-- For example, in an Adobe Lightroom plugin, you might use something like
--
-- function JSON:onDecodeError(message, text, location, etc)
-- LrErrors.throwUserError("Internal Error: invalid JSON data")
-- end
--
-- or even just
--
-- function JSON.assert(message)
-- LrErrors.throwUserError("Internal Error: " .. message)
-- end
--
-- If JSON:decode() is passed a nil, this is called instead:
--
-- JSON:onDecodeOfNilError(message, nil, nil, etc)
--
-- and if JSON:decode() is passed HTML instead of JSON, this is called:
--
-- JSON:onDecodeOfHTMLError(message, text, nil, etc)
--
-- The use of the fourth 'etc' argument allows stronger coordination between decoding and error
-- reporting, especially when you provide your own error-handling routines. Continuing with the
-- the Adobe Lightroom plugin example:
--
-- function JSON:onDecodeError(message, text, location, etc)
-- local note = "Internal Error: invalid JSON data"
-- if type(etc) = 'table' and etc.photo then
-- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName')
-- end
-- LrErrors.throwUserError(note)
-- end
--
-- :
-- :
--
-- for i, photo in ipairs(photosToProcess) do
-- :
-- :
-- local data = JSON:decode(someJsonText, { photo = photo })
-- :
-- :
-- end
--
--
--
--
-- DECODING AND STRICT TYPES
--
-- Because both JSON objects and JSON arrays are converted to Lua tables, it's not normally
-- possible to tell which a Lua table came from, or guarantee decode-encode round-trip
-- equivalency.
--
-- However, if you enable strictTypes, e.g.
--
-- JSON = (loadfile "JSON.lua")() --load the routines
-- JSON.strictTypes = true
--
-- then the Lua table resulting from the decoding of a JSON object or JSON array is marked via Lua
-- metatable, so that when re-encoded with JSON:encode() it ends up as the appropriate JSON type.
--
-- (This is not the default because other routines may not work well with tables that have a
-- metatable set, for example, Lightroom API calls.)
--
--
-- ENCODING
--
-- JSON = (loadfile "JSON.lua")() -- one-time load of the routines
--
-- local raw_json_text = JSON:encode(lua_table_or_value)
-- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability
-- On error during encoding, this code calls:
--
-- JSON:onEncodeError(message, etc)
--
-- which you can override in your local JSON object.
--
--
-- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT
--
-- assert
-- onDecodeError
-- onDecodeOfNilError
-- onDecodeOfHTMLError
-- onEncodeError
--
-- If you want to create a separate Lua JSON object with its own error handlers,
-- you can reload JSON.lua or use the :new() method.
--
---------------------------------------------------------------------------
local author = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json), version " .. tostring(VERSION) .. " ]-"
local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray
local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject
function OBJDEF:newArray(tbl)
return setmetatable(tbl or {}, isArray)
end
function OBJDEF:newObject(tbl)
return setmetatable(tbl or {}, isObject)
end
local function unicode_codepoint_as_utf8(codepoint)
--
-- codepoint is a number
--
if codepoint <= 127 then
return string.char(codepoint)
elseif codepoint <= 2047 then
--
-- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8
--
local highpart = math.floor(codepoint / 0x40)
local lowpart = codepoint - (0x40 * highpart)
return string.char(0xC0 + highpart,
0x80 + lowpart)
elseif codepoint <= 65535 then
--
-- 1110yyyy 10yyyyxx 10xxxxxx
--
local highpart = math.floor(codepoint / 0x1000)
local remainder = codepoint - 0x1000 * highpart
local midpart = math.floor(remainder / 0x40)
local lowpart = remainder - 0x40 * midpart
highpart = 0xE0 + highpart
midpart = 0x80 + midpart
lowpart = 0x80 + lowpart
--
-- Check for an invalid character (thanks Andy R. at Adobe).
-- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070
--
if ( highpart == 0xE0 and midpart < 0xA0 ) or
( highpart == 0xED and midpart > 0x9F ) or
( highpart == 0xF0 and midpart < 0x90 ) or
( highpart == 0xF4 and midpart > 0x8F )
then
return "?"
else
return string.char(highpart,
midpart,
lowpart)
end
else
--
-- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx
--
local highpart = math.floor(codepoint / 0x40000)
local remainder = codepoint - 0x40000 * highpart
local midA = math.floor(remainder / 0x1000)
remainder = remainder - 0x1000 * midA
local midB = math.floor(remainder / 0x40)
local lowpart = remainder - 0x40 * midB
return string.char(0xF0 + highpart,
0x80 + midA,
0x80 + midB,
0x80 + lowpart)
end
end
function OBJDEF:onDecodeError(message, text, location, etc)
if text then
if location then
message = string.format("%s at char %d of: %s", message, location, text)
else
message = string.format("%s: %s", message, text)
end
end
if etc ~= nil then
message = message .. " (" .. OBJDEF:encode(etc) .. ")"
end
if self.assert then
self.assert(false, message)
else
assert(false, message)
end
end
OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError
OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError
function OBJDEF:onEncodeError(message, etc)
if etc ~= nil then
message = message .. " (" .. OBJDEF:encode(etc) .. ")"
end
if self.assert then
self.assert(false, message)
else
assert(false, message)
end
end
local function grok_number(self, text, start, etc)
--
-- Grab the integer part
--
local integer_part = text:match('^-?[1-9]%d*', start)
or text:match("^-?0", start)
if not integer_part then
self:onDecodeError("expected number", text, start, etc)
end
local i = start + integer_part:len()
--
-- Grab an optional decimal part
--
local decimal_part = text:match('^%.%d+', i) or ""
i = i + decimal_part:len()
--
-- Grab an optional exponential part
--
local exponent_part = text:match('^[eE][-+]?%d+', i) or ""
i = i + exponent_part:len()
local full_number_text = integer_part .. decimal_part .. exponent_part
local as_number = tonumber(full_number_text)
if not as_number then
self:onDecodeError("bad number", text, start, etc)
end
return as_number, i
end
local function grok_string(self, text, start, etc)
if text:sub(start,start) ~= '"' then
self:onDecodeError("expected string's opening quote", text, start, etc)
end
local i = start + 1 -- +1 to bypass the initial quote
local text_len = text:len()
local VALUE = ""
while i <= text_len do
local c = text:sub(i,i)
if c == '"' then
return VALUE, i + 1
end
if c ~= '\\' then
VALUE = VALUE .. c
i = i + 1
elseif text:match('^\\b', i) then
VALUE = VALUE .. "\b"
i = i + 2
elseif text:match('^\\f', i) then
VALUE = VALUE .. "\f"
i = i + 2
elseif text:match('^\\n', i) then
VALUE = VALUE .. "\n"
i = i + 2
elseif text:match('^\\r', i) then
VALUE = VALUE .. "\r"
i = i + 2
elseif text:match('^\\t', i) then
VALUE = VALUE .. "\t"
i = i + 2
else
local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i)
if hex then
i = i + 6 -- bypass what we just read
-- We have a Unicode codepoint. It could be standalone, or if in the proper range and
-- followed by another in a specific range, it'll be a two-code surrogate pair.
local codepoint = tonumber(hex, 16)
if codepoint >= 0xD800 and codepoint <= 0xDBFF then
-- it's a hi surrogate... see whether we have a following low
local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i)
if lo_surrogate then
i = i + 6 -- bypass the low surrogate we just read
codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16)
else
-- not a proper low, so we'll just leave the first codepoint as is and spit it out.
end
end
VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint)
else
-- just pass through what's escaped
VALUE = VALUE .. text:match('^\\(.)', i)
i = i + 2
end
end
end
self:onDecodeError("unclosed string", text, start, etc)
end
local function skip_whitespace(text, start)
local match_start, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2
if match_end then
return match_end + 1
else
return start
end
end
local grok_one -- assigned later
local function grok_object(self, text, start, etc)
if not text:sub(start,start) == '{' then
self:onDecodeError("expected '{'", text, start, etc)
end
local i = skip_whitespace(text, start + 1) -- +1 to skip the '{'
local VALUE = self.strictTypes and self:newObject { } or { }
if text:sub(i,i) == '}' then
return VALUE, i + 1
end
local text_len = text:len()
while i <= text_len do
local key, new_i = grok_string(self, text, i, etc)
i = skip_whitespace(text, new_i)
if text:sub(i, i) ~= ':' then
self:onDecodeError("expected colon", text, i, etc)
end
i = skip_whitespace(text, i + 1)
local val, new_i = grok_one(self, text, i)
VALUE[key] = val
--
-- Expect now either '}' to end things, or a ',' to allow us to continue.
--
i = skip_whitespace(text, new_i)
local c = text:sub(i,i)
if c == '}' then
return VALUE, i + 1
end
if text:sub(i, i) ~= ',' then
self:onDecodeError("expected comma or '}'", text, i, etc)
end
i = skip_whitespace(text, i + 1)
end
self:onDecodeError("unclosed '{'", text, start, etc)
end
local function grok_array(self, text, start, etc)
if not text:sub(start,start) == '[' then
self:onDecodeError("expected '['", text, start, etc)
end
local i = skip_whitespace(text, start + 1) -- +1 to skip the '['
local VALUE = self.strictTypes and self:newArray { } or { }
if text:sub(i,i) == ']' then
return VALUE, i + 1
end
local text_len = text:len()
while i <= text_len do
local val, new_i = grok_one(self, text, i)
table.insert(VALUE, val)
i = skip_whitespace(text, new_i)
--
-- Expect now either ']' to end things, or a ',' to allow us to continue.
--
local c = text:sub(i,i)
if c == ']' then
return VALUE, i + 1
end
if text:sub(i, i) ~= ',' then
self:onDecodeError("expected comma or '['", text, i, etc)
end
i = skip_whitespace(text, i + 1)
end
self:onDecodeError("unclosed '['", text, start, etc)
end
grok_one = function(self, text, start, etc)
-- Skip any whitespace
start = skip_whitespace(text, start)
if start > text:len() then
self:onDecodeError("unexpected end of string", text, nil, etc)
end
if text:find('^"', start) then
return grok_string(self, text, start, etc)
elseif text:find('^[-0123456789 ]', start) then
return grok_number(self, text, start, etc)
elseif text:find('^%{', start) then
return grok_object(self, text, start, etc)
elseif text:find('^%[', start) then
return grok_array(self, text, start, etc)
elseif text:find('^true', start) then
return true, start + 4
elseif text:find('^false', start) then
return false, start + 5
elseif text:find('^null', start) then
return nil, start + 4
else
self:onDecodeError("can't parse JSON", text, start, etc)
end
end
function OBJDEF:decode(text, etc)
if type(self) ~= 'table' or self.__index ~= OBJDEF then
OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc)
end
if text == nil then
self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc)
elseif type(text) ~= 'string' then
self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc)
end
if text:match('^%s*$') then
return nil
end
if text:match('^%s*<') then
-- Can't be JSON... we'll assume it's HTML
self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc)
end
--
-- Ensure that it's not UTF-32 or UTF-16.
-- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3),
-- but this package can't handle them.
--
if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then
self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc)
end
local success, value = pcall(grok_one, self, text, 1, etc)
if success then
return value
else
-- should never get here... JSON parse errors should have been caught earlier
assert(false, value)
return nil
end
end
local function backslash_replacement_function(c)
if c == "\n" then
return "\\n"
elseif c == "\r" then
return "\\r"
elseif c == "\t" then
return "\\t"
elseif c == "\b" then
return "\\b"
elseif c == "\f" then
return "\\f"
elseif c == '"' then
return '\\"'
elseif c == '\\' then
return '\\\\'
else
return string.format("\\u%04x", c:byte())
end
end
local chars_to_be_escaped_in_JSON_string
= '['
.. '"' -- class sub-pattern to match a double quote
.. '%\\' -- class sub-pattern to match a backslash
.. '%z' -- class sub-pattern to match a null
.. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters
.. ']'
local function json_string_literal(value)
local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function)
return '"' .. newval .. '"'
end
local function object_or_array(self, T, etc)
--
-- We need to inspect all the keys... if there are any strings, we'll convert to a JSON
-- object. If there are only numbers, it's a JSON array.
--
-- If we'll be converting to a JSON object, we'll want to sort the keys so that the
-- end result is deterministic.
--
local string_keys = { }
local seen_number_key = false
local maximum_number_key
for key in pairs(T) do
if type(key) == 'number' then
seen_number_key = true
if not maximum_number_key or maximum_number_key < key then
maximum_number_key = key
end
elseif type(key) == 'string' then
table.insert(string_keys, key)
else
self:onEncodeError("can't encode table with a key of type " .. type(key), etc)
end
end
if seen_number_key and #string_keys > 0 then
--
-- Mixed key types... don't know what to do, so bail
--
self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc)
elseif #string_keys == 0 then
--
-- An array
--
if seen_number_key then
return nil, maximum_number_key -- an array
else
--
-- An empty table...
--
if tostring(T) == "JSON array" then
return nil
elseif tostring(T) == "JSON object" then
return { }
else
-- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects
return nil
end
end
else
--
-- An object, so return a list of keys
--
table.sort(string_keys)
return string_keys
end
end
--
-- Encode
--
local encode_value -- must predeclare because it calls itself
function encode_value(self, value, parents, etc)
if value == nil then
return 'null'
end
if type(value) == 'string' then
return json_string_literal(value)
elseif type(value) == 'number' then
if value ~= value then
--
-- NaN (Not a Number).
-- JSON has no NaN, so we have to fudge the best we can. This should really be a package option.
--
return "null"
elseif value >= math.huge then
--
-- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should
-- really be a package option. Note: at least with some implementations, positive infinity
-- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is.
-- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">="
-- case first.
--
return "1e+9999"
elseif value <= -math.huge then
--
-- Negative infinity.
-- JSON has no INF, so we have to fudge the best we can. This should really be a package option.
--
return "-1e+9999"
else
return tostring(value)
end
elseif type(value) == 'boolean' then
return tostring(value)
elseif type(value) ~= 'table' then
self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc)
else
--
-- A table to be converted to either a JSON object or array.
--
local T = value
if parents[T] then
self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc)
else
parents[T] = true
end
local result_value
local object_keys, maximum_number_key = object_or_array(self, T, etc)
if maximum_number_key then
--
-- An array...
--
local ITEMS = { }
for i = 1, maximum_number_key do
table.insert(ITEMS, encode_value(self, T[i], parents, etc))
end
result_value = "[" .. table.concat(ITEMS, ",") .. "]"
elseif object_keys then
--
-- An object
--
--
-- We'll always sort the keys, so that comparisons can be made on
-- the results, etc. The actual order is not particularly
-- important (e.g. it doesn't matter what character set we sort
-- as); it's only important that it be deterministic... the same
-- every time.
--
local PARTS = { }
for _, key in ipairs(object_keys) do
local encoded_key = encode_value(self, tostring(key), parents, etc)
local encoded_val = encode_value(self, T[key], parents, etc)
table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val))
end
result_value = "{" .. table.concat(PARTS, ",") .. "}"
else
--
-- An empty array/object... we'll treat it as an array, though it should really be an option
--
result_value = "[]"
end
parents[T] = false
return result_value
end
end
local encode_pretty_value -- must predeclare because it calls itself
function encode_pretty_value(self, value, parents, indent, etc)
if type(value) == 'string' then
return json_string_literal(value)
elseif type(value) == 'number' then
return tostring(value)
elseif type(value) == 'boolean' then
return tostring(value)
elseif type(value) == 'nil' then
return 'null'
elseif type(value) ~= 'table' then
self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc)
else
--
-- A table to be converted to either a JSON object or array.
--
local T = value
if parents[T] then
self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc)
end
parents[T] = true
local result_value
local object_keys = object_or_array(self, T, etc)
if not object_keys then
--
-- An array...
--
local ITEMS = { }
for i = 1, #T do
table.insert(ITEMS, encode_pretty_value(self, T[i], parents, indent, etc))
end
result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]"
else
--
-- An object -- can keys be numbers?
--
local KEYS = { }
local max_key_length = 0
for _, key in ipairs(object_keys) do
local encoded = encode_pretty_value(self, tostring(key), parents, "", etc)
max_key_length = math.max(max_key_length, #encoded)
table.insert(KEYS, encoded)
end
local key_indent = indent .. " "
local subtable_indent = indent .. string.rep(" ", max_key_length + 2 + 4)
local FORMAT = "%s%" .. tostring(max_key_length) .. "s: %s"
local COMBINED_PARTS = { }
for i, key in ipairs(object_keys) do
local encoded_val = encode_pretty_value(self, T[key], parents, subtable_indent, etc)
table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val))
end
result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}"
end
parents[T] = false
return result_value
end
end
function OBJDEF:encode(value, etc)
if type(self) ~= 'table' or self.__index ~= OBJDEF then
OBJDEF:onEncodeError("JSON:encode must be called in method format", etc)
end
local parents = {}
return encode_value(self, value, parents, etc)
end
function OBJDEF:encode_pretty(value, etc)
local parents = {}
local subtable_indent = ""
return encode_pretty_value(self, value, parents, subtable_indent, etc)
end
function OBJDEF.__tostring()
return "JSON encode/decode package"
end
OBJDEF.__index = OBJDEF
function OBJDEF:new(args)
local new = { }
if args then
for key, val in pairs(args) do
new[key] = val
end
end
return setmetatable(new, OBJDEF)
end
return OBJDEF:new()
--
-- Version history:
--
-- 20111207.5 Added support for the 'etc' arguments, for better error reporting.
--
-- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent.
--
-- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules:
--
-- * When encoding lua for JSON, Sparse numeric arrays are now handled by
-- spitting out full arrays, such that
-- JSON:encode({"one", "two", [10] = "ten"})
-- returns
-- ["one","two",null,null,null,null,null,null,null,"ten"]
--
-- In 20100810.2 and earlier, only up to the first non-null value would have been retained.
--
-- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999".
-- Version 20100810.2 and earlier created invalid JSON in both cases.
--
-- * Unicode surrogate pairs are now detected when decoding JSON.
--
-- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding
--
-- 20100731.1 initial public release
--
| apache-2.0 |
feiying1460/witi-openwrt | package/ramips/ui/luci-mtk/src/applications/luci-asterisk/luasrc/model/cbi/asterisk-mod-codec.lua | 80 | 2172 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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$
]]--
cbimap = Map("asterisk", "asterisk", "")
module = cbimap:section(TypedSection, "module", "Modules", "")
module.anonymous = true
codec_a_mu = module:option(ListValue, "codec_a_mu", "A-law and Mulaw direct Coder/Decoder", "")
codec_a_mu:value("yes", "Load")
codec_a_mu:value("no", "Do Not Load")
codec_a_mu:value("auto", "Load as Required")
codec_a_mu.rmempty = true
codec_adpcm = module:option(ListValue, "codec_adpcm", "Adaptive Differential PCM Coder/Decoder", "")
codec_adpcm:value("yes", "Load")
codec_adpcm:value("no", "Do Not Load")
codec_adpcm:value("auto", "Load as Required")
codec_adpcm.rmempty = true
codec_alaw = module:option(ListValue, "codec_alaw", "A-law Coder/Decoder", "")
codec_alaw:value("yes", "Load")
codec_alaw:value("no", "Do Not Load")
codec_alaw:value("auto", "Load as Required")
codec_alaw.rmempty = true
codec_g726 = module:option(ListValue, "codec_g726", "ITU G.726-32kbps G726 Transcoder", "")
codec_g726:value("yes", "Load")
codec_g726:value("no", "Do Not Load")
codec_g726:value("auto", "Load as Required")
codec_g726.rmempty = true
codec_gsm = module:option(ListValue, "codec_gsm", "GSM/PCM16 (signed linear) Codec Translation", "")
codec_gsm:value("yes", "Load")
codec_gsm:value("no", "Do Not Load")
codec_gsm:value("auto", "Load as Required")
codec_gsm.rmempty = true
codec_speex = module:option(ListValue, "codec_speex", "Speex/PCM16 (signed linear) Codec Translator", "")
codec_speex:value("yes", "Load")
codec_speex:value("no", "Do Not Load")
codec_speex:value("auto", "Load as Required")
codec_speex.rmempty = true
codec_ulaw = module:option(ListValue, "codec_ulaw", "Mu-law Coder/Decoder", "")
codec_ulaw:value("yes", "Load")
codec_ulaw:value("no", "Do Not Load")
codec_ulaw:value("auto", "Load as Required")
codec_ulaw.rmempty = true
return cbimap
| gpl-2.0 |
n0xus/darkstar | scripts/globals/items/dish_of_spaghetti_boscaiola.lua | 35 | 1721 | -----------------------------------------
-- ID: 5192
-- Item: dish_of_spaghetti_boscaiola
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Health % 18
-- Health Cap 120
-- Magic 35
-- Strength -5
-- Dexterity -2
-- Vitality 2
-- Mind 4
-- Magic Regen While Healing 1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,5192);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_HPP, 18);
target:addMod(MOD_FOOD_HP_CAP, 120);
target:addMod(MOD_MP, 35);
target:addMod(MOD_STR, -5);
target:addMod(MOD_DEX, -2);
target:addMod(MOD_VIT, 2);
target:addMod(MOD_MND, 4);
target:addMod(MOD_MPHEAL, 1);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_HPP, 18);
target:delMod(MOD_FOOD_HP_CAP, 120);
target:delMod(MOD_MP, 35);
target:delMod(MOD_STR, -5);
target:delMod(MOD_DEX, -2);
target:delMod(MOD_VIT, 2);
target:delMod(MOD_MND, 4);
target:delMod(MOD_MPHEAL, 1);
end;
| gpl-3.0 |
xxlxx20/DEVKEEPER | plugins/banhmmer.lua | 2 | 15023 | local function pre_process(msg)
local data = load_data(_config.moderation.data)
-- SERVICE MESSAGE
if msg.action and msg.action.type then
local action = msg.action.type
-- Check if banned user joins chat by link
if action == 'chat_add_user_link' then
local user_id = msg.from.id
print('Checking invited user '..user_id)
local banned = is_banned(user_id, msg.to.id)
if banned or is_gbanned(user_id) then -- Check it with redis
print('User is banned!')
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] is banned and kicked ! ")-- Save to logs
kick_user(user_id, msg.to.id)
end
end
-- Check if banned user joins chat
if action == 'chat_add_user' then
local user_id = msg.action.user.id
print('Checking invited user '..user_id)
local banned = is_banned(user_id, msg.to.id)
if banned and not is_momod2(msg.from.id, msg.to.id) or is_gbanned(user_id) and not is_admin2(msg.from.id) then -- Check it with redis
print('User is banned!')
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] added a banned user >"..msg.action.user.id)-- Save to logs
kick_user(user_id, msg.to.id)
local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id
redis:incr(banhash)
local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id
local banaddredis = redis:get(banhash)
if banaddredis then
if tonumber(banaddredis) >= 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 3 times
end
if tonumber(banaddredis) >= 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 7 times
local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id
redis:set(banhash, 0)-- Reset the Counter
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings'] then
if data[tostring(msg.to.id)]['settings']['lock_bots'] then
bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots']
end
end
end
if msg.action.user.username ~= nil then
if string.sub(msg.action.user.username:lower(), -3) == 'bot' and not is_momod(msg) and bots_protection == "yes" then --- Will kick bots added by normal users
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] added a bot > @".. msg.action.user.username)-- Save to logs
kick_user(msg.action.user.id, msg.to.id)
end
end
end
-- No further checks
return msg
end
-- banned user is talking !
if msg.to.type == 'chat' or msg.to.type == 'channel' then
local group = msg.to.id
local texttext = 'groups'
--if not data[tostring(texttext)][tostring(msg.to.id)] and not is_realm(msg) then -- Check if this group is one of my groups or not
--chat_del_user('chat#id'..msg.to.id,'user#id'..our_id,ok_cb,false)
--return
--end
local user_id = msg.from.id
local chat_id = msg.to.id
local banned = is_banned(user_id, chat_id)
if banned or is_gbanned(user_id) then -- Check it with redis
print('Banned user talking!')
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] banned user is talking !")-- Save to logs
kick_user(user_id, chat_id)
msg.text = ''
end
end
return msg
end
local function kick_ban_res(extra, success, result)
local chat_id = extra.chat_id
local chat_type = extra.chat_type
if chat_type == "chat" then
receiver = 'chat#id'..chat_id
else
receiver = 'channel#id'..chat_id
end
if success== 0 then
return send_large_msg(receiver, "Cannot find user by that username!")
end
local member_id = result.peer_id
local user_id = member_id
local member = result.username
local from_id = extra.from_id
local get_cmd = extra.get_cmd
if get_cmd == "زحلكه" then
if member_id == from_id then
send_large_msg(receiver, "لآ يمكنـــــك 🗣حظــر نفســـك♥️❗️")
return
end
if is_momod2(member_id, chat_id) and not is_admin2(sender) then
send_large_msg(receiver, "لآ يمكنـــــك🖐🏽 حظـٰر الادمـــن آؤ المديــــــر♥️❗️")
return
end
kick_user(member_id, chat_id)
elseif get_cmd == 'حظر' then
if is_momod2(member_id, chat_id) and not is_admin2(sender) then
send_large_msg(receiver, "لآ يمكنـــــك🖐🏽 حظـٰر الادمـــن آؤ المديــــــر♥️❗️")
return
end
send_large_msg(receiver, 'العضــــــــضو🗣 @'..member..' \nتہمہ بالفعــُُــل ✔️ حظره مہن المجموِعـــةة🍾🍷')
ban_user(member_id, chat_id)
elseif get_cmd == 'الغاء حظر' then
send_large_msg(receiver, 'العضـــــو🗣 @'..member..' \nتہمہ الغــٰاء 🖐🏽حظــره مہنہ المجموعـُ ــةة🍾🍷')
local hash = 'banned:'..chat_id
redis:srem(hash, member_id)
return 'العضـــٰو🗣 ['..user_id..'] \n\nتہمہ بالفعــُُــل ✔️ حظره مہنہ المجموِعـــةة🍾🍷'
elseif get_cmd == 'حظر عام' then
send_large_msg(receiver, 'العضـــــو🗣 [@'..member..'] \nتہمہ بالفعــــل ✔️ حظـــره مہنہ كہل المجموعــــــات♥️❗️ ')
banall_user(member_id)
elseif get_cmd == 'الغاء العام' then
send_large_msg(receiver, 'العضــــٰو🗣 [@'..member..'] \nتہمہ بالفعـــٰل الغــٰٰـاء ✖️ حظُـره مہنہ كہل 🗣المجموعـــــات♥️❗️')
unbanall_user(member_id)
end
end
local function run(msg, matches)
local support_id = msg.from.id
if matches[1]:lower() == 'ايدي' and msg.to.type == "chat" or msg.to.type == "user" then
if msg.to.type == "user" then
return "🔹 ايــــدي البوت : "..msg.to.id.. "\n\n🔹 ايــٰـدي حسابـــٰك : "..msg.from.id.. "\n\n🔹 المطــور : @llX8Xll "
end
if type(msg.reply_id) ~= "nil" then
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ")
id = get_message(msg.reply_id,get_message_callback_id, false)
elseif matches[1]:lower() == 'ايدي' then
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ")
return "ايـــــدي المجموعـــــةة🍾🍷" ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id
end
end
if matches[1]:lower() == 'مغادره' and msg.to.type == "chat" then-- /kickme
local receiver = get_receiver(msg)
if msg.to.type == 'chat' then
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] left using kickme ")-- Save to logs
chat_del_user("chat#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false)
end
end
if not is_momod(msg) then -- Ignore normal users
return
end
if matches[1]:lower() == "المحظورين" then -- Ban list !
local chat_id = msg.to.id
if matches[2] and is_admin1(msg) then
chat_id = matches[2]
end
return ban_list(chat_id)
end
if matches[1]:lower() == 'حظر' then-- /ban
if type(msg.reply_id)~="nil" and is_momod(msg) then
if is_admin1(msg) then
msgr = get_message(msg.reply_id,ban_by_reply_admins, false)
else
msgr = get_message(msg.reply_id,ban_by_reply, false)
end
local user_id = matches[2]
local chat_id = msg.to.id
elseif string.match(matches[2], '^%d+$') then
if tonumber(matches[2]) == tonumber(our_id) then
return
end
if not is_admin1(msg) and is_momod2(matches[2], msg.to.id) then
return "لآ يمكنـــــك🖐🏽 حظـٰر الادمـــن آؤ المديــــــر♥️❗️"
end
if tonumber(matches[2]) == tonumber(msg.from.id) then
return "لآ يمكنـــــك 🗣حظــر نفســـك♥️❗️"
end
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
local receiver = get_receiver(msg)
savelog(msg.to.id, name.."العضـــــو🗣 ["..msg.from.id.."] \nتہمہ بالفعــُُــل ✔️ حظــره مہن المجموِعـــةة🍾🍷".. matches[2])
ban_user(matches[2], msg.to.id)
send_large_msg(receiver, 'العضـــــو🗣 ['..matches[2]..'] \nتہمہ بالفعــُُــل ✔️ حظــره مہن المجموِعـــةة🍾🍷')
else
local cbres_extra = {
chat_id = msg.to.id,
get_cmd = 'حظر',
from_id = msg.from.id,
chat_type = msg.to.type
}
local username = string.gsub(matches[2], '@', '')
resolve_username(username, kick_ban_res, cbres_extra)
end
end
if matches[1]:lower() == 'الغاء حظر' then -- /unban
if type(msg.reply_id)~="nil" and is_momod(msg) then
local msgr = get_message(msg.reply_id,unban_by_reply, false)
end
local user_id = matches[2]
local chat_id = msg.to.id
local targetuser = matches[2]
if string.match(targetuser, '^%d+$') then
local user_id = targetuser
local hash = 'banned:'..chat_id
redis:srem(hash, user_id)
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.."العضـــــو🗣 ["..msg.from.id.."] \nتہمہ الغــٰاء 🖐🏽حظــره مہنہ المجموعـُ ــةة🍾🍷".. matches[2])
return 'العضـــــو🗣 '..user_id..'] \nتہمہ الغــٰاء 🖐🏽حظــره مہنہ المجموعـُ ــةة🍾🍷'
else
local cbres_extra = {
chat_id = msg.to.id,
get_cmd = 'الغاء حظر',
from_id = msg.from.id,
chat_type = msg.to.type
}
local username = string.gsub(matches[2], '@', '')
resolve_username(username, kick_ban_res, cbres_extra)
end
end
if matches[1]:lower() == 'زحلكه' then
if type(msg.reply_id)~="nil" and is_momod(msg) then
if is_admin1(msg) then
msgr = get_message(msg.reply_id,Kick_by_reply_admins, false)
else
msgr = get_message(msg.reply_id,Kick_by_reply, false)
end
elseif string.match(matches[2], '^%d+$') then
if tonumber(matches[2]) == tonumber(our_id) then
return
end
if not is_admin1(msg) and is_momod2(matches[2], msg.to.id) then
return "لآ يمكنـــــك🖐🏽 حظـٰر الادمـــن آؤ المديــــــر♥️❗️"
end
if tonumber(matches[2]) == tonumber(msg.from.id) then
return "لآ يمكنـــــك 🗣حظــر نفســـك♥️❗️"
end
local user_id = matches[2]
local chat_id = msg.to.id
print("sexy")
local print_name = user_print_name(msg.from):gsub("", "")
local name = print_name:gsub("_", "")
savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2])
kick_user(user_id, chat_id)
else
local cbres_extra = {
chat_id = msg.to.id,
get_cmd = 'زحلكه',
from_id = msg.from.id,
chat_type = msg.to.type
}
local username = string.gsub(matches[2], '@', '')
resolve_username(username, kick_ban_res, cbres_extra)
end
end
if not is_admin1(msg) and not is_support(support_id) then
return
end
if matches[1]:lower() == 'حظر عام' and is_admin1(msg) then -- Global ban
if type(msg.reply_id) ~="nil" and is_admin1(msg) then
banall = get_message(msg.reply_id,banall_by_reply, false)
end
local user_id = matches[2]
local chat_id = msg.to.id
local targetuser = matches[2]
if string.match(targetuser, '^%d+$') then
if tonumber(matches[2]) == tonumber(our_id) then
return false
end
banall_user(targetuser)
return 'العضـــــو🗣 ['..user_id..' ] \nتہمہ بالفعــــل ✔️ حظـــره مہنہ كہل المجموعــــــات♥️❗️'
else
local cbres_extra = {
chat_id = msg.to.id,
get_cmd = 'حظر عام',
from_id = msg.from.id,
chat_type = msg.to.type
}
local username = string.gsub(matches[2], '@', '')
resolve_username(username, kick_ban_res, cbres_extra)
end
end
if matches[1]:lower() == 'الغاء العام' then -- Global unban
local user_id = matches[2]
local chat_id = msg.to.id
if string.match(matches[2], '^%d+$') then
if tonumber(matches[2]) == tonumber(our_id) then
return false
end
unbanall_user(user_id)
return 'العضـــــو🗣 ['..user_id..' ] \nتہمہ بالفعـــٰل الغــٰٰـاء ✖️ حظُـره مہنہ كہل 🗣المجموعـــــات♥️❗️'
else
local cbres_extra = {
chat_id = msg.to.id,
get_cmd = 'الغاء العام',
from_id = msg.from.id,
chat_type = msg.to.type
}
local username = string.gsub(matches[2], '@', '')
resolve_username(username, kick_ban_res, cbres_extra)
end
end
if matches[1]:lower() == "قائمه العام" then -- Global ban list
return banall_list()
end
end
return {
patterns = {
"^(حظر عام) (.*)$",
"^(حظر عام)$",
"^(المحظورين) (.*)$",
"^(المحظورين)$",
"^(قائمه العام)$",
"^(مغادره)",
"^(زحلكه)$",
"^(حظر)$",
"^(حظر) (.*)$",
"^(الغاء حظر) (.*)$",
"^(الغاء العام) (.*)$",
"^(الغاء الغام)$",
"^(زحلكه) (.*)$",
"^(الغاء حظر)$",
"^(ايدي)$",
"^[#!/](حظر عام) (.*)$",
"^[#!/](حظر عام)$",
"^[#!/](المحظورين) (.*)$",
"^[#!/](المحظورين)$",
"^[#!/](قائمه العام)$",
"^[#!/](مغادره)",
"^[#!/](دي)$",
"^[#!/](حظر)$",
"^[#!/](حظر) (.*)$",
"^[#!/](الغاء حظر) (.*)$",
"^[#!/](الغاء العام) (.*)$",
"^[#!/](الغاء العام)$",
"^[#!/](زحلكه) (.*)$",
"^[#!/](الغاء حظر)$",
"^[#!/](ايدي)$",
"^!!tgservice (.+)$"
},
run = run,
pre_process = pre_process
}
| gpl-2.0 |
chawan/RepHelper | RepHelperSkin.lua | 1 | 1655 | if IsAddOnLoaded("ElvUI") then
local E = unpack(_G.ElvUI)
local buttons = {
RPH_OptionsButton,
RPH_ShowAllButton,
RPH_ExpandButton,
RPH_ShowNoneButton,
RPH_CollapseButton,
RPH_SupressNoneFactionButton,
RPH_SupressNoneGlobalButton,
RPH_ClearSessionGainButton,
}
local checkboxes = {
RPH_OrderByStandingCheckBox,
RPH_EnableMissingBox,
RPH_ExtendDetailsBox,
RPH_GainToChatBox,
RPH_NoGuildGainBox,
RPH_SupressOriginalGainBox,
RPH_ShowPreviewRepBox,
RPH_SwitchFactionBarBox,
RPH_SilentSwitchBox,
RPH_NoGuildSwitchBox,
RPH_ReputationDetailInactiveCheckBox,
RPH_ReputationDetailMainScreenCheckBox,
RPH_ShowQuestButton,
RPH_ShowInstancesButton,
RPH_ShowMobsButton,
RPH_ShowItemsButton,
RPH_ShowGeneralButton,
RPH_EnableParagonBarBox,
RPH_ShowDarkmoonFaireButton,
}
RPH_ReputationDetailFrame:StripTextures()
RPH_ReputationDetailFrame:SetTemplate("Transparent")
RPH_OptionsFrame:StripTextures()
RPH_OptionsFrame:SetTemplate("Transparent")
E.Skins:HandleCloseButton(RPH_OptionsFrameClose)
E.Skins:HandleCloseButton(RPH_ReputationDetailCloseButton)
E.Skins:HandleCheckBox(RPH_ReputationDetailAtWarCheckBox)
RPH_ReputationDetailAtWarCheckBox:SetCheckedTexture('Interface\\Buttons\\UI-CheckBox-SwordCheck')
RPH_ReputationDetailAtWarCheckBox:SetDisabledCheckedTexture('Interface\\Buttons\\UI-CheckBox-Check-Disabled')
E.Skins:HandleScrollBar(RPH_UpdateListScrollFrameScrollBar)
for _,button in pairs(buttons) do
E.Skins:HandleButton(button)
end
for _,checkbox in pairs(checkboxes) do
E.Skins:HandleCheckBox(checkbox)
end
end | gpl-3.0 |
metadeus/luv | tests/db/sql/mysql.lua | 1 | 6117 | local io, tostring = io, tostring
local TestCase, sql, mysql = require "luv.dev.unittest".TestCase, require "luv.db.sql", require "luv.db.sql.mysql"
module(...)
local validDsn = "mysql://test:test@localhost/test"
return TestCase:extend{
__tag = ...,
dsn = validDsn,
setUp = function (self)
self.db = sql.Factory(self.dsn)
self.db:logger(function (sql, result)
io.write(sql, "<br />")
end)
end,
testPlaceholders = function (self)
local db = self.db
self.assertEquals(db:processPlaceholder("?#", "test"), "`test`")
self.assertEquals(db:processPlaceholder("?#", "te`st"), "`te``st`")
self.assertEquals(db:processPlaceholder("?d", 55), "55")
self.assertThrows(function() db:processPlaceholder("?d", "NaN") end)
self.assertEquals(db:processPlaceholder("?", "test"), [['test']])
self.assertEquals(db:processPlaceholder("?", "te\"s't"), [['te"s\'t']])
end,
testPlaceholders = function (self)
local db = self.db
self.assertEquals(db:processPlaceholders(
"SELECT ?#, ?# FROM ?# WHERE ?# > ?d AND ?# < ?d OR ?# = ?", "id", "title_and_name", "testTable", "id", -46, "id", 58, "test`field``", "test string\" \'there\'"),
"SELECT `id`, `title_and_name` FROM `testTable` WHERE `id` > -46 AND `id` < 58 OR `test``field````` = 'test string\" \\'there\\''"
)
self.assertEquals(db:processPlaceholders(
"SELECT ?# FROM ?# WHERE ?# IN (?a)", "name", "test", "id", {23, 45, 56, 72, 84}),
"SELECT `name` FROM `test` WHERE `id` IN (23, 45, 56, 72, 84)"
)
self.assertEquals(db:processPlaceholders(
"INSERT INTO ?# SET ?v", "test", {name="Max", age=23, gender="M"}),
"INSERT INTO `test` SET `gender`='M', `name`='Max', `age`=23"
)
end,
testSelects = function (self)
self.assertEquals(
tostring(self.db:Select("id", "title"):from("test.table"):where("?# = ?d", "num", 55):orWhere("?# = ?n", "parent"):limitPage(3, 10):order("num", "-date", "*")),
"SELECT `id`, `title` FROM `test`.`table` WHERE (`num` = 55) OR (`parent` = NULL) ORDER BY `num` ASC, `date` DESC, RAND() LIMIT 10 OFFSET 20;"
)
self.assertEquals(
tostring(self.db:SelectRow({p = "test.fld", f = "test.fld2", c = "COUNT(test.counter)"}):from({test = "dtb.test_table", p = "dtb.products"}):order("MAX(test.counter)")),
"SELECT `test`.`fld` AS `p`, COUNT(test.counter) AS `c`, `test`.`fld2` AS `f` FROM `dtb`.`test_table` AS `test`, `dtb`.`products` AS `p` ORDER BY MAX(test.counter) ASC;"
)
self.assertEquals(
tostring(self.db:SelectCell():from("tabl`e"):where("?# = 0 OR ?# IS NULL AND (MAX(?#) < 150)", "id", "id", "total"):limit(10, 25)),
"SELECT `tabl``e`.* FROM `tabl``e` WHERE (`id` = 0 OR `id` IS NULL AND (MAX(`total`) < 150)) LIMIT 15 OFFSET 10;"
)
-- Test limit
self.assertEquals(
tostring(self.db:Select():from("test"):limit(5)),
"SELECT `test`.* FROM `test` LIMIT 5;"
)
end,
testInsertRow = function (self)
self.assertEquals(
tostring(self.db:InsertRow():into("test"):set("?# = ?d, ?# = ?n", "num", 55, "title"):set("?# = ?", "desc", "Description")),
"INSERT INTO `test` SET `num` = 55, `title` = NULL, `desc` = 'Description';"
)
end,
testInsert = function (self)
self.assertEquals(
tostring(self.db:Insert("?, ?n, ?d", "title", "parent", "total"):into("test"):values("abc", nil, 32):values("cde", 15, 64):values("efg", "", -74)),
"INSERT INTO `test` (`title`, `parent`, `total`) VALUES ('abc', NULL, 32), ('cde', 15, 64), ('efg', NULL, -74);"
)
end,
testUpdate = function (self)
self.assertEquals(
tostring(self.db:Update("test"):set("?# = ?", "title", "abc"):set("?# = RAND()", "rand"):set("?# = ?n", "parent"):where("?# = ?d", "num", 55):order("num"):limit(10)),
"UPDATE `test` SET `title` = 'abc', `rand` = RAND(), `parent` = NULL WHERE (`num` = 55) ORDER BY `num` ASC LIMIT 10;"
)
end,
testUpdateRow = function (self)
self.assertThrows(function () self.db:UpdateRow("test"):limitPage(1, 20) end)
self.assertEquals(
tostring(self.db:UpdateRow("test"):set("?# = ?", "title", "abc"):set("?# = RAND()", "rand"):set("?# = ?n", "parent"):where("?# = ?d", "num", 55):order("num"):limit(10)),
"UPDATE `test` SET `title` = 'abc', `rand` = RAND(), `parent` = NULL WHERE (`num` = 55) ORDER BY `num` ASC LIMIT 1;"
)
end,
testDelete = function (self)
self.assertEquals(
tostring(self.db:Delete():from("test"):where("?# = CONCAT(?, ?)", "name", "John ", "Smith"):limit(5, 10)),
"DELETE FROM `test` WHERE (`name` = CONCAT('John ', 'Smith')) LIMIT 5 OFFSET 5;"
)
end,
testDeleteRow = function (self)
self.assertEquals(
tostring(self.db:DeleteRow():from("test"):order("-date", "*"):limit(15, 20)),
"DELETE FROM `test` ORDER BY `date` DESC, RAND() LIMIT 1 OFFSET 15;"
)
end,
testCreateTable = function (self)
self.assertEquals(
tostring(self.db:CreateTable("test_`tbl"):field("id", "INTEGER", {primaryKey = true, serial = true}):field("title", "VARCHAR(255)", {null = true, unique = true, default = "NULL"}):option("charset", "latin1"):option("engine", "MyISAM")),
"CREATE TABLE `test_``tbl` (`id` INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` VARCHAR(255) NULL UNIQUE DEFAULT NULL) CHARACTER SET latin1 ENGINE = MyISAM;"
)
self.assertEquals(
tostring(self.db:CreateTable("test"):field("lang", "CHAR(2)", {unique = true}):field("url", "TEXT"):uniqueTogether("lang", "url"):constraint("lang", "dtb.langs", "id", "SET NULL", "SET NULL")),
"CREATE TABLE `test` (`lang` CHAR(2) NOT NULL UNIQUE, `url` TEXT NOT NULL, UNIQUE (`lang`, `url`), CONSTRAINT FOREIGN KEY (`lang`) REFERENCES `dtb`.`langs` (`id`) ON UPDATE SET NULL ON DELETE SET NULL) CHARACTER SET utf8 ENGINE = InnoDB;"
)
end,
testDropTable = function (self)
self.assertEquals(
tostring(self.db:DropTable("data.tbl")),
"DROP TABLE `data`.`tbl`;"
)
end,
testJoins = function (self)
self.assertEquals(
tostring(self.db:Select("p.product_id", "p.product_name"):from{p="products"}:join({l="line_items"}, {"?# = ?#", "p.product_id", "l.product_id"})),
"SELECT `p`.`product_id`, `p`.`product_name` FROM `products` AS `p` JOIN `line_items` AS `l` ON `p`.`product_id` = `l`.`product_id`;"
)
end
}
| bsd-3-clause |
n0xus/darkstar | scripts/globals/items/dish_of_salsa.lua | 35 | 1591 | -----------------------------------------
-- ID: 5299
-- Item: dish_of_salsa
-- Food Effect: 3Min, All Races
-----------------------------------------
-- Strength -1
-- Dexterity -1
-- Agility -1
-- Vitality -1
-- Intelligence -1
-- Mind -1
-- Sleep Resist 5
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,180,5299);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, -1);
target:addMod(MOD_DEX, -1);
target:addMod(MOD_AGI, -1);
target:addMod(MOD_VIT, -1);
target:addMod(MOD_INT, -1);
target:addMod(MOD_MND, -1);
target:addMod(MOD_SLEEPRES, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, -1);
target:delMod(MOD_DEX, -1);
target:delMod(MOD_AGI, -1);
target:delMod(MOD_VIT, -1);
target:delMod(MOD_INT, -1);
target:delMod(MOD_MND, -1);
target:delMod(MOD_SLEEPRES, 5);
end;
| gpl-3.0 |
n0xus/darkstar | scripts/zones/Port_Bastok/npcs/Kurando.lua | 38 | 2161 | -----------------------------------
-- Area: Port Bastok
-- NPC: Kurando
-- Type: Quest Giver
-- @zone: 236
-- @pos -23.887 3.898 0.870
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Port_Bastok/TextIDs");
require("scripts/globals/quests");
require("scripts/globals/titles");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (player:getQuestStatus(BASTOK,FEAR_OF_FLYING) == QUEST_ACCEPTED) then
if (trade:hasItemQty(4526,1) and trade:getItemCount() == 1) then
player:startEvent(0x00AB); -- Quest Completion Dialogue
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local FearofFlying = player:getQuestStatus(BASTOK,FEAR_OF_FLYING);
-- csid 0x00Ad ?
if (FearofFlying == QUEST_AVAILABLE and player:getFameLevel(BASTOK) >=3) then
player:startEvent(0x00AA); -- Quest Start Dialogue
elseif (FearofFlying == QUEST_COMPLETED) then
player:startEvent(0x00AC); -- Dialogue after Completion
else
player:startEvent(0x001c); -- Default Dialogue
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x00AA) then
player:addQuest(BASTOK,FEAR_OF_FLYING);
elseif (csid == 0x00AB) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13113);
else
player:tradeComplete();
player:addItem(13113,1);
player:messageSpecial(ITEM_OBTAINED,13113);
player:setTitle(AIRSHIP_DENOUNCER);
player:completeQuest(BASTOK,FEAR_OF_FLYING);
player:addFame(BASTOK,BAS_FAME*30);
end
end
end; | gpl-3.0 |
CameronHynes/OpenRA | mods/ra/maps/soviet-01/soviet01.lua | 28 | 2150 | Yaks = { "yak", "yak", "yak" }
Airfields = { Airfield1, Airfield2, Airfield3 }
InsertYaks = function()
local i = 1
Utils.Do(Yaks, function(yakType)
local start = YakEntry.CenterPosition + WVec.New(0, (i - 1) * 1536, Actor.CruiseAltitude(yakType))
local dest = StartJeep.Location + CVec.New(0, 2 * i)
local yak = Actor.Create(yakType, true, { CenterPosition = start, Owner = player, Facing = (Map.CenterOfCell(dest) - start).Facing })
yak.Move(dest)
yak.ReturnToBase(Airfields[i])
i = i + 1
end)
end
JeepDemolishingBridge = function()
StartJeep.Move(StartJeepMovePoint.Location)
Trigger.OnIdle(StartJeep, function()
Trigger.ClearAll(StartJeep)
if not BridgeBarrel.IsDead then
BridgeBarrel.Kill()
end
local bridge = Map.ActorsInBox(BridgeWaypoint.CenterPosition, Airfield1.CenterPosition,
function(self) return self.Type == "bridge1" end)[1]
if not bridge.IsDead then
bridge.Kill()
end
end)
end
WorldLoaded = function()
player = Player.GetPlayer("USSR")
france = Player.GetPlayer("France")
germany = Player.GetPlayer("Germany")
Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
VillageRaidObjective = player.AddPrimaryObjective("Raze the village.")
Trigger.OnAllRemovedFromWorld(Airfields, function()
player.MarkFailedObjective(VillageRaidObjective)
end)
JeepDemolishingBridge()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "MissionAccomplished")
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "MissionFailed")
end)
Trigger.AfterDelay(DateTime.Seconds(2), InsertYaks)
end
Tick = function()
if france.HasNoRequiredUnits() and germany.HasNoRequiredUnits() then
player.MarkCompletedObjective(VillageRaidObjective)
end
end
| gpl-3.0 |
coderpunch/evolvemod | lua/evolve/plugins/sh_ignite.lua | 1 | 1991 | --[[-----------------------------------------------------------------------------------------------------------------------
Ignite a player
-----------------------------------------------------------------------------------------------------------------------]]--
local PLUGIN = {}
PLUGIN.Title = "Ignite"
PLUGIN.Description = "Ignite a player."
PLUGIN.Author = "Overv"
PLUGIN.ChatCommand = "ignite"
PLUGIN.Usage = "[players] [1/0]"
PLUGIN.Privileges = { "Ignite" }
function PLUGIN:Call( ply, args )
if ( ply:EV_HasPrivilege( "Ignite" ) ) then
local players = evolve:FindPlayer( args, ply, true )
local enabled = ( tonumber( args[ #args ] ) or 1 ) > 0
for _, pl in ipairs( players ) do
if ( enabled ) then pl:Ignite( 99999, 1 ) else pl:Extinguish() end
end
if ( #players > 0 ) then
if ( enabled ) then
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has ignited ", evolve.colors.red, evolve:CreatePlayerList( players ), evolve.colors.white, "." )
else
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has extinguished ", evolve.colors.red, evolve:CreatePlayerList( players ), evolve.colors.white, "." )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.noplayers )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
end
end
function PLUGIN:PlayerDeath( ply )
if ( ply:IsOnFire() ) then
ply:Extinguish()
end
end
function PLUGIN:Move( ply )
if ( !SERVER ) then return end
if ( ply:IsOnFire() and ply:WaterLevel() == 3 ) then
ply:Extinguish()
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " extinguished himself by jumping into water." )
end
end
function PLUGIN:Menu( arg, players )
if ( arg ) then
table.insert( players, arg )
RunConsoleCommand( "ev", "ignite", unpack( players ) )
else
return "Ignite", evolve.category.punishment, { { "Enable", 1 }, { "Disable", 0 } }
end
end
evolve:RegisterPlugin( PLUGIN ) | apache-2.0 |
n0xus/darkstar | scripts/globals/spells/armys_paeon_ii.lua | 31 | 1390 | -----------------------------------------
-- Spell: Army's Paeon II
-- Gradually restores target's HP.
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing
local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED);
local power = 2;
if (sLvl+iLvl > 150) then
power = power + 1;
end
local iBoost = caster:getMod(MOD_PAEON_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
power = power + iBoost;
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
caster:delStatusEffect(EFFECT_MARCATO);
local duration = 120;
duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
if not (target:addBardSong(caster,EFFECT_PAEON,power,0,duration,caster:getID(), 0, 2)) then
spell:setMsg(75);
end
return EFFECT_PAEON;
end; | gpl-3.0 |
alexandre-mbm/SimTools | RandomWeather/Lua/RandomWeather/Generator.lua | 2 | 11773 | -- Weather restrictions etc.
local cloud_type_restriction = { -- Allowed cloud types above another
[0] = {
[1] = true,
[8] = true,
[9] = true,
[10] = true,
},
[1] = {
},
[8] = {
[8] = true,
[9] = true,
[10] = true,
},
[9] = {
[9] = true,
[10] = true,
},
[10] = {
[9] = true,
[10] = true,
},
}
local cloud_height_restriction = { -- Minimum and maximum height of layer per type (M)
[1] = { 100, 300 },
[8] = { 300, 1500 },
[9] = { 300, 3000 },
[10] = { 5000, 10000 },
}
local prevailing_wind_direction = { -- Latitude and direction
{ -90, 090 },
{ -75, 090 },
{ -60, -090 }, -- Shift winds from the north
{ -30, -090 },
{ -15, -270 }, -- Shift winds from the south
{ 15, -270 },
{ 30, -450 }, -- Shift winds from the north
{ 60, -450 },
{ 75, -630 }, -- Shift winds from the south
{ 90, -630 },
}
local winds_aloft_increase = { -- Latitude, minimum and maximum speed increase per 1000M (plus square root of 1KT/1000M)
{ -90, -3, 12 },
{ -45, -3, 15 },
{ 0, -3, 9 },
{ 45, -3, 15 },
{ 90, -3, 12 },
}
local temperature_restriction = {
-50, -3, -- Minimum at surface (C) with minimum at altitude based on lapse rate (C/1000M)
50, -9, -- Maximum at surface (C) with maximum at altitude based on lapse rate (C/1000M)
}
local temperature_adjustment = { -- Latitude, temperature delta per month
{ -90, -15, -40, -60, -75, -85, -90, -90, -85, -75, -60, -40, -15, },
{ -45, 15, 11, 5, -5, -11, -15, -15, -11, -5, 5, 11, 15, },
{ 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, },
{ 45, -15, -11, -5, 5, 11, 15, 15, 11, 5, -5, -11, -15, },
{ 90, -90, -85, -75, -60, -40, -15, -15, -40, -60, -75, -85, -90, },
}
local month_days = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
}
local icing_maximum = rwrand(-3, 3) -- a little randomness to the icing level
local icing_minimum = rwrand(-15, -25) -- no icing below this temperature in cloud
local icing_altitude = 6000 -- no icing above this altitude
local DYNAMICS = "Dynamics"
local PRESSURE = "Pressure"
local TEMPERATURE = "Temperature"
local VISIBILITY = "Visibility"
local CLOUDS = "Clouds"
local WINDS = "Winds"
function rwgenerate(theme)
local alt = 0
local lat = 0
local lon = 0
local day = 1
local mon = 4
if (ipc ~= nil) then
day = ipc.readUB(0x023D)
mon = ipc.readUB(0x0242)
alt = ipc.readSD(0x0020)/256
lat = ipc.readDBL(0x6010)
lon = ipc.readDBL(0x6018)
end
local w = rwnew()
-- Dynamics
w.uDynamics = rwround(rwrand(theme[DYNAMICS][1], theme[DYNAMICS][2]))
-- Generate new pressure
w.Press.Pressure = rwround(rwrand(theme[PRESSURE][1], theme[PRESSURE][2]) * 16)
-- Generate new temperature (always from MSL)
local t1 = 1
while (t1+1 < table.getn(temperature_adjustment) and lat > temperature_adjustment[t1+1][1]) do
t1 = t1 + 1
end
local t1latd = lat - temperature_adjustment[t1][1]
local t1latr = temperature_adjustment[t1+1][1] - temperature_adjustment[t1][1]
local t1a = temperature_adjustment[t1][mon+1]
local t1b = temperature_adjustment[t1][(mon%12)+2]
local t2a = temperature_adjustment[t1+1][mon+1]
local t2b = temperature_adjustment[t1+1][(mon%12)+2]
local tr = (day-1) / (month_days[t1]-1)
local t1t = t1a + tr * (t1b-t1a)
local t2t = t2a + tr * (t2b-t2a)
local tadj = t1t + t1latd * (t2t-t1t) / t1latr
w.nTempCtr = theme[TEMPERATURE][10] + 1
-- Surface temperature
local talt = 0
local tmin = temperature_restriction[1]
local tmax = temperature_restriction[3]
local tday = rwrand(theme[TEMPERATURE][1], theme[TEMPERATURE][2]) + tadj
if (tday < tmin) then
tday = tmin
elseif (tday > tmax) then
tday = tmax
end
local tdew = tday - rwrand(theme[TEMPERATURE][3], theme[TEMPERATURE][4])
local tlap = rwrand(theme[TEMPERATURE][6], theme[TEMPERATURE][7])
w.Temp[1].Alt = rwround(talt)
w.Temp[1].Day = rwround(tday)
w.Temp[1].DewPoint = rwround(tdew)
-- Temperature layers
for i = 2,w.nTempCtr do
talt = (i-1) * theme[TEMPERATURE][9] / (w.nTempCtr - 1)
tmin = temperature_restriction[1] + talt * temperature_restriction[2] / 1000
tmax = temperature_restriction[3] + talt * temperature_restriction[4] / 1000
tday = w.Temp[i-1].Day + tlap * (talt - w.Temp[i-1].Alt) / 1000
while (tday < tmin or tday > tmax) do -- get a new lapse rate is we're below/above min/max
tlap = rwrand(theme[TEMPERATURE][6], theme[TEMPERATURE][7])
tday = w.Temp[i-1].Day + tlap * (talt - w.Temp[i-1].Alt) / 1000
end
if (theme[TEMPERATURE][5] == true) then
tdew = tday - rwrand(theme[TEMPERATURE][3], theme[TEMPERATURE][4])
else
tdew = tday - (w.Temp[i-1].Day - w.Temp[i-1].DewPoint)
end
if (false and theme[TEMPERATURE][8] == true) then
tlap = rwrand(theme[TEMPERATURE][6], theme[TEMPERATURE][7])
end
w.Temp[i].Alt = rwround(talt)
w.Temp[i].Day = rwround(tday)
w.Temp[i].DewPoint = rwround(tdew)
end
-- Generate new visibility
w.nUpperVisCtr = theme[VISIBILITY][6]
-- Surface visibility (N/A: fake because it didn't appear to "stick")
local vlalt = -theme[VISIBILITY][5] / w.nUpperVisCtr
local vualt = theme[VISIBILITY][5] / w.nUpperVisCtr / 2
local vlrng = rwrand(theme[VISIBILITY][1], theme[VISIBILITY][2])
local vurng = rwrand(theme[VISIBILITY][3], theme[VISIBILITY][4])
if (theme[VISIBILITY][7] ~= true) then
while (vurng < vlrng) do -- Upper visibility should not be greather than lower
vurng = rwrand(theme[VISIBILITY][3], theme[VISIBILITY][4])
end
end
local vnrng = vlrng
w.Vis.LowerAlt = rwround(vlalt)
w.Vis.UpperAlt = rwround(vualt)
w.Vis.Range = rwround(vnrng * 100)
-- Visibility layers (N/A: including real surface)
for i = 1,w.nUpperVisCtr do
if (i == 1) then
vlalt = theme[VISIBILITY][5] / w.nUpperVisCtr / 2 -- N/A: can't over lap fake surface
else
vlalt = alt + (i-1) * (theme[VISIBILITY][5]-alt) / w.nUpperVisCtr
end
vualt = alt + i * (theme[VISIBILITY][5]-alt) / w.nUpperVisCtr
vnrng = vlrng + (i-1) * (vurng - vlrng) / (w.nUpperVisCtr - 1)
w.UpperVis[i].LowerAlt = rwround(vlalt)
w.UpperVis[i].UpperAlt = rwround(vualt)
while (rwround(vnrng * 20) % 100 == 0) do -- to avoid random METAR visibility extension
vnrng = vnrng + rwrand(-0.5, 0.5)
end
w.UpperVis[i].Range = rwround(vnrng * 100)
end
-- Generate new clouds
w.nCloudsCtr = table.getn(theme[CLOUDS])
-- Cloud layers
local cstemp = rwtemp(w, 0)
local ccov = 0
local calt = alt
local chgt = 0
local ctyp = 0
local j = 0
for i = 1,w.nCloudsCtr do
local ctyn = 0
while (cloud_type_restriction[ctyp][ctyn] == nil) do
ctyn = theme[CLOUDS][i][1][rwround(rwrand(1, table.getn(theme[CLOUDS][i][1])))]
end
ctyp = ctyn
ccov = rwround(rwrand(theme[CLOUDS][i][6], theme[CLOUDS][i][7]))
local calo = theme[CLOUDS][i][2]
local cahi = theme[CLOUDS][i][3]
local cbdif = ccov - theme[CLOUDS][i][15]
if (cbdif ~= 0 and theme[CLOUDS][i][16] ~= 0) then -- adjust cloud bases based on coverage
if (cbdif < 0 and theme[CLOUDS][i][16] < 0) then
calo = calo - cbdif * theme[CLOUDS][i][16]
elseif (cbdif > 0 and theme[CLOUDS][i][16] > 0) then
calo = calo + cbdif * theme[CLOUDS][i][16]
end
if (calo < 0) then
cahi = cahi + calo
calo = 0
end
if (cahi < 0) then
cahi = 0
end
end
calt = calt + rwrand(calo, cahi)
chgt = rwrand(theme[CLOUDS][i][4], theme[CLOUDS][i][5])
if (chgt < cloud_height_restriction[ctyp][1]) then
chgt = cloud_height_restriction[ctyp][1]
elseif (chgt > cloud_height_restriction[ctyp][2]) then
chgt = cloud_height_restriction[ctyp][2]
end
local cbtemp = rwtemp(w, calt)
local cttemp = rwtemp(w, calt + chgt)
w.Cloud[i-j].Type = ctyp
w.Cloud[i-j].LowerAlt = rwround(calt)
w.Cloud[i-j].UpperAlt = rwround(calt + chgt)
w.Cloud[i-j].Coverage = ccov
w.Cloud[i-j].Turbulence = rwround(rwrand(theme[CLOUDS][i][8], theme[CLOUDS][i][9]))
if (rwrand(1, 100) <= theme[CLOUDS][i][10]) then -- precipitation
if (cstemp > icing_maximum or (cbtemp > icing_maximum and cttemp > icing_maximum)) then
w.Cloud[i-j].PrecipType = 1 -- rain
else
w.Cloud[i-j].PrecipType = 2 -- snow
end
w.Cloud[i-j].PrecipRate = rwround(rwrand(theme[CLOUDS][i][11], theme[CLOUDS][i][12]) * w.Cloud[i-j].Coverage / 8)
end
local cbice = (cbtemp <= icing_maximum and cbtemp >= icing_minimum)
local ctice = (cttemp <= icing_maximum and cttemp >= icing_minimum)
if (calt < icing_altitude and (cbice or ctice)) then
local cice = 50
if (cbice and ctice) then
cice = 100
end
if (rwrand(1, 100) <= cice) then
w.Cloud[i-j].Icing = rwround(rwrand(theme[CLOUDS][i][13], theme[CLOUDS][i][14]) * w.Cloud[i-j].Coverage / 8)
end
end
calt = calt + chgt
if (w.Cloud[i-j].Coverage == 0) then
w.nCloudsCtr = w.nCloudsCtr - 1;
j = j + 1
end
end
-- Generate new wind
local w1 = 1
while (w1+1 < table.getn(prevailing_wind_direction) and lat > prevailing_wind_direction[w1+1][1]) do
w1 = w1 + 1
end
local w1latd = lat - prevailing_wind_direction[w1][1]
local w1latr = prevailing_wind_direction[w1+1][1] - prevailing_wind_direction[w1][1]
local w1dirl = prevailing_wind_direction[w1][2]
local w1dird = prevailing_wind_direction[w1+1][2] - w1dirl
local w1dirp = w1dirl + w1dird * w1latd / w1latr -- prevailing wind direction
local w2 = 1
while (w2+1 < table.getn(winds_aloft_increase) and lat > winds_aloft_increase[w2+1][1]) do
w2 = w2 + 1
end
local w2latd = lat - winds_aloft_increase[w2][1]
local w2latr = winds_aloft_increase[w2+1][1] - winds_aloft_increase[w2][1]
local w2spddl = winds_aloft_increase[w2+1][2] - winds_aloft_increase[w2][2]
local w2spddh = winds_aloft_increase[w2+1][3] - winds_aloft_increase[w2][3]
local w2spdil = winds_aloft_increase[w2][2] + w2spddl * w2latd / w2latr -- speed change low per 1000M
local w2spdih = winds_aloft_increase[w2][3] + w2spddh * w2latd / w2latr -- speed change high per 1000M
-- Wind layers
local wspdl = theme[WINDS][1]
local wspdh = theme[WINDS][2]
local wspd = rwrand(wspdl, wspdh)
local wspdg = rwrand(theme[WINDS][3], theme[WINDS][4])
if (wspd + wspdg > wspdh) then
wspdg = wspdh - wspd
end
if (wspd + wspdg < wspdl) then
wspdg = wspdl - wspd
end
local wspdi = rwrand(w2spdil, w2spdih)
local wdirl = rwdeg(rwrand(w1dirp - theme[WINDS][5], w1dirp + theme[WINDS][5]))
local wvarl = theme[WINDS][6]
local wdirh = rwdeg(rwrand(w1dirp - theme[WINDS][7], w1dirp + theme[WINDS][7]))
local wvarh = theme[WINDS][8]
local wdird = rwdeg(wdirh - wdirl)
if (wdird > 180) then
wdird = wdird - 360
end
w.nWindsCtr = theme[WINDS][15] + 1
local j = 0
for i = 1,w.nWindsCtr do
local wr = (i-1) / (w.nWindsCtr - 1)
local walt = alt + wr * (theme[WINDS][14]-alt)
if (theme[WINDS][13] == true) then
wspdi = rwrand(w2spdil, w2spdih)
end
local wualt = alt + i * (theme[WINDS][14]-alt) / w.nWindsCtr
local wualtp = wualt
local wspdp = wspd
if (i > 1) then
wualtp = w.Wind[i+j-1].UpperAlt
wspdp = w.Wind[i+j-1].Speed
end
local wspdn = wspdp + (wualt-wualtp)/1000 * (wspdi+math.sqrt(walt/1000))
if (wspdn < 0) then
wspdn = 0
end
local wdir = wdirl + wr * wdird
local wvar = rwrand(0, wvarl + wr * (wvarh - wvarl))
w.Wind[i+j].UpperAlt = rwround(wualt)
w.Wind[i+j].Speed = rwround(wspdn)
w.Wind[i+j].Gust = rwround(wspdg * (w.nWindsCtr - i) / (w.nWindsCtr - 1))
w.Wind[i+j].Direction = rwround(rwdeg(wdir) * 65535 / 360)
w.Wind[i+j].Variance = rwround(wvar * 65535 / 360)
w.Wind[i+j].Turbulence = rwround(rwrand(theme[WINDS][9], theme[WINDS][10]))
w.Wind[i+j].Shear = rwround(rwrand(theme[WINDS][11], theme[WINDS][12]))
-- hack to create a gap between top of surface and next winds aloft with an ignored layer
if (i == 1) then
w.Wind[i+1] = deepcopy(w.Wind[i])
w.Wind[i].UpperAlt = rwround(wualt/2)
j = 1
end
end
w.nWindsCtr = w.nWindsCtr + 1
return w
end
| mit |
davymai/CN-QulightUI | Interface/AddOns/DBM-BlackrockFoundry/HansgarAndFranzok.lua | 1 | 11185 | local mod = DBM:NewMod(1155, "DBM-BlackrockFoundry", nil, 457)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 12934 $"):sub(12, -3))
mod:SetCreatureID(76974, 76973)
mod:SetEncounterID(1693)
mod:SetZone()
--mod:SetUsedIcons(5, 4, 3, 2, 1)
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_CAST_START 160838 160845 160847 160848 153470",
"SPELL_AURA_APPLIED 157139 162124",
"SPELL_AURA_APPLIED_DOSE 157139",
"UNIT_SPELLCAST_SUCCEEDED boss1 boss2",
"UNIT_TARGETABLE_CHANGED"
)
--TODO, find target scanning for skullcracker. Also, find out how it behaves when it's more than 1 target (just recast?)
--TODO, maybe use http://beta.wowhead.com/spell=154785 for aftershock/Shattered Vertebrae instead?'
--TODO, collect more data to figure out how roar starts/resumes on jump down. One pull/kill is not a sufficient sampling.
local warnSkullcracker = mod:NewSpellAnnounce(153470, 3, nil, false)--This seems pretty worthless.
local warnShatteredVertebrae = mod:NewStackAnnounce(157139, 2, nil, "Tank")--Possibly useless or changed. Needs further logs.
local warnJumpSlam = mod:NewTargetAnnounce("ej9854", 3)--Find pretty icon
local specWarnJumpSlam = mod:NewSpecialWarningYou("ej9854")
local specWarnJumpSlamNear = mod:NewSpecialWarningClose("ej9854")
local yellJumpSlam = mod:NewYell("ej9854")
local specWarnDisruptingRoar = mod:NewSpecialWarningCast("OptionVersion2", 160838, "SpellCaster")
local specWarnShatteredVertebrae = mod:NewSpecialWarningStack(157139, nil, 2, nil, nil, nil, nil, 2)--stack guessed
local specWarnShatteredVertebraeOther = mod:NewSpecialWarningTaunt(157139)
--Move specWarnCripplingSupplex to a health check, warn when near 85, 55, or 25%
local specWarnCripplingSupplex = mod:NewSpecialWarningPreWarn("OptionVersion2", 156938, "Tank|Healer", 9, nil, nil, 3)--pop a cooldown.
local specWarnSearingPlates = mod:NewSpecialWarningSpell(161570, nil, nil, nil, 2)
local specWarnStampers = mod:NewSpecialWarningSpell(174825, nil, nil, nil, 2)
local specWarnSearingPlatesEnd = mod:NewSpecialWarningEnd(161570)
local specWarnStampersEnd = mod:NewSpecialWarningEnd(174825)
local timerDisruptingRoar = mod:NewCastTimer(2.5, 160838, nil, "SpellCaster")
local timerDisruptingRoarCD = mod:NewCDTimer(46, 160838, nil, "SpellCaster")
local timerSkullcrackerCD = mod:NewCDTimer(22, 153470, nil, "Healer")
local timerCripplingSupplex = mod:NewCastTimer(9.5, 156938, nil, "Tank|Healer")
mod:AddTimerLine(ENCOUNTER_JOURNAL_SECTION_FLAG12)
local timerSmartStamperCD = mod:NewNextTimer(12, 162124)--Activation
local timerStamperDodge = mod:NewTimer(10, "timerStamperDodge", 160582)--Time until stamper falls (spell name fits well, time you have to stamper dodge)
--local berserkTimer = mod:NewBerserkTimer(360)
local countCripplingSupplex = mod:NewCountdown("OptionVersion2", "Alt9.5", 156938, "Tank|Healer")
local voiceEnvironmentalThreats = mod:NewVoice("ej10089")
local voiceShatteredVertebrae = mod:NewVoice(157139)
mod.vb.phase = 1
mod.vb.stamperDodgeCount = 0
mod.vb.bossUp = "NoBody"
mod.vb.lastJumpTarget = "None"
mod.vb.firstJump = false
function mod:JumpTarget(targetname, uId)
if not targetname then return end
self.vb.lastJumpTarget = targetname
if targetname == UnitName("player") then
specWarnJumpSlam:Show()
yellJumpSlam:Yell()
elseif self:CheckNearby(12, targetname) then--Near warning disabled on mythic, mythic mechanic requires being near it on purpose. Plus raid always stacked
specWarnJumpSlamNear:Show(targetname)
else
warnJumpSlam:Show(targetname)--No reason to show this if you got a special warning. so reduce spam and display this only to let you know jump is far away and you're safe
end
end
function mod:OnCombatStart(delay)
self.vb.phase = 1
self.vb.stamperDodgeCount = 0
self.vb.bossUp = "NoBody"
self.vb.lastJumpTarget = "None"
self.vb.firstJump = false
timerSkullcrackerCD:Start(20-delay)
timerDisruptingRoarCD:Start(-delay)
if self:IsMythic() then
timerSmartStamperCD:Start(13-delay)
-- berserkTimer:Start(-delay)
end
end
function mod:OnCombatEnd()
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if args:IsSpellID(160838, 160845, 160847, 160848) then
specWarnDisruptingRoar:Show()
timerDisruptingRoarCD:Start()
DBM:GetBossUnitId(args.sourceName)
local _, _, _, _, startTime, endTime = UnitCastingInfo(DBM:GetBossUnitId(args.sourceName))
local time = ((endTime or 0) - (startTime or 0)) / 1000
if time then
timerDisruptingRoar:Start(time)
end
elseif spellId == 153470 then
warnSkullcracker:Show()
timerSkullcrackerCD:Start()
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 157139 then
local uId = DBM:GetRaidUnitId(args.destName)
if self:IsTanking(uId, "boss1") or self:IsTanking(uId, "boss2") then--Assume this can hit non tanks at landing site too, filter them
local amount = args.amount or 1
warnShatteredVertebrae:Show(args.destName, amount)
if amount >= 2 then
if args:IsPlayer() then
specWarnShatteredVertebrae:Show(args.amount)
else
if not UnitDebuff("player", GetSpellInfo(157139)) and not UnitIsDeadOrGhost("player") then
specWarnShatteredVertebraeOther:Show(args.destName)
end
end
voiceShatteredVertebrae:Play("changemt")
end
end
elseif spellId == 162124 and self:AntiSpam(3, args.sourceGUID) then
self.vb.stamperDodgeCount = self.vb.stamperDodgeCount + 1
timerStamperDodge:Start(nil, self.vb.stamperDodgeCount)--Multiple timers at once is intended. But capped at 3
--Run antispam code. If raid moves too fast MANY stampers spawn at once. This code will auto cancel timers as new timers are added once we reach 3
--So only max of 3 bars at once. Cancel current -3 all new timer start
if self.vb.stamperDodgeCount >= 3 then--Bugged (has to be DBM-core or DBT).
timerStamperDodge:Cancel(self.vb.stamperDodgeCount-3)--This is canceling ALL timers, not just the one with this arg.
end
end
end
mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, _, _, spellId)
if (spellId == 156220 or spellId == 156883) and self.vb.bossUp == "Nobody" then--Tactical Retreat (156883 has lots of invalid casts, so self.vb.bossUp to filter)
DBM:Debug("Tactical Retreat "..UnitName(uId))
self.vb.phase = self.vb.phase + 1
self.vb.stamperDodgeCount = 0
timerStamperDodge:Cancel()--Cancel all of them
self.vb.bossUp = UnitName(uId)
local cid = self:GetCIDFromGUID(UnitGUID(uId))
if cid == 76974 then--Fran
timerDisruptingRoarCD:Cancel()
timerSkullcrackerCD:Cancel()
end
--The triggers are these percentages for sure but there is a delay before they do it so it always appears later, but the trigger has been triggered
if self.vb.phase == 2 then--First belt 85% (15 Energy) (fire plates)
specWarnSearingPlates:Show()
voiceEnvironmentalThreats:Play("watchstep")
elseif self.vb.phase == 3 then--Second belt 55% (45 Energy) (Stampers)
specWarnStampers:Show()
voiceEnvironmentalThreats:Play("watchstep")
elseif self.vb.phase == 4 then--Second belt 25% (75 Energy) (Fire plates, then stampers)
specWarnSearingPlates:Show()
voiceEnvironmentalThreats:Play("watchstep")
end
--"<944.72 23:32:59> [UNIT_SPELLCAST_SUCCEEDED] Hans'gar [[boss1:Crippling Suplex::0:156546]]", -- [5133]--Pre cast, Stuns main tank
--"<948.55 23:33:03> [UNIT_SPELLCAST_SUCCEEDED] Hans'gar [[boss1:Crippling Suplex::0:156609]]", -- [5752]--Secondary target (off tank) no stun
--"<951.15 23:33:06> [CLEU] SPELL_CAST_START#Vehicle-0-3783-1205-31925-76974-0000518B7D#Franzok##nil#156938#Crippling Suplex#nil#nil", -- [6168]--cast bar for damage
--"<954.06 23:33:08> [CLEU] SPELL_CAST_SUCCESS#Vehicle-0-3783-1205-31925-76974-0000518B7D#Franzok#Player-76-0580DD5F#playerName#156938#Crippling Suplex#nil#nil", -- [6639]--SMASH (5.5 seconds after stun, VERY tight to cover attack with 6 second cd)
--http://blue.mmo-champion.com/topic/360651-blackrock-foundry-clarification-known-issues/
elseif spellId == 156546 or spellId == 156542 then
specWarnCripplingSupplex:Show()
timerCripplingSupplex:Start()
countCripplingSupplex:Start()
elseif spellId == 157926 then--Jump Activation
self.vb.firstJump = false--So reset firstjump
self.vb.lastJumpTarget = "None"
DBM:Debug("Jump Activation")
elseif spellId == 157922 then--First jump must use 157922
if not self.vb.firstJump then
DBM:Debug("157922: firstJump true")
self.vb.firstJump = true
self.vb.lastJumpTarget = UnitName(uId.."target")--It'll be highest threat at this point, baseline for our first filter
else--Not first jump
DBM:Debug("157922: firstJump false")
if self.vb.lastJumpTarget ~= "None" then
DBM:Debug("157922: lastJumpTarget exists for "..self.vb.lastJumpTarget)
self:BossTargetScanner(UnitGUID(uId), "JumpTarget", 0.05, 30, nil, nil, true, nil, self.vb.lastJumpTarget)--1.5 seconds worth of scans, because i've seen it take as long as 1.2 to get target, and yet, still faster than 157923 by 0.6 seconds. Most often, it finds target in 0.5 or less
else
DBM:Debug("self.vb.lastJumpTarget is unknown, target scanning for jump will be slower")
end
end
elseif spellId == 157923 and self.vb.lastJumpTarget == "None" then--Fallback
DBM:Debug("Using slower scan fallback: 157923", 2)
self:BossTargetScanner(UnitGUID(uId), "JumpTarget", 0.02, 10, nil, nil, true)
end
end
--Currently functional on 6.0.3. But yell method may still be needed in 6.1
function mod:UNIT_TARGETABLE_CHANGED(uId)
DBM:Debug("UNIT_TARGETABLE_CHANGED event fired")
if UnitExists(uId) then--Return, not retreat
self.vb.bossUp = "NoBody"
if self.vb.phase == 4 then--Stampers activate on their own after 3rd jump away, when they return.
specWarnStampers:Show()
voiceEnvironmentalThreats:Play("watchstep")
else
if self:IsMythic() then
timerSmartStamperCD:Start()
voiceEnvironmentalThreats:Play("gather")--Must restack for smart stampers
else
if self.vb.phase == 2 then
specWarnSearingPlatesEnd:Show()
voiceEnvironmentalThreats:Play("safenow")
else
specWarnStampersEnd:Show()
voiceEnvironmentalThreats:Play("safenow")
end
end
end
end
end
--[[
--Don't remove yet. It's possible the UNIT_TARGETABLE_CHANGED change from PTR may still happen when 6.1 goes live
function mod:CHAT_MSG_MONSTER_YELL(msg, npc, _, _, target)
if not target and self.vb.bossUp == npc then--Bosses don't yell with a target for phase change yells. other yells do have targets. For good measure we also make sure sender is boss that's up
self.vb.bossUp = "NoBody"
if self.vb.phase == 4 then--Stampers activate on their own after 3rd jump away, when they return.
specWarnStampers:Show()
voiceEnvironmentalThreats:Play("watchstep")
else
if self:IsMythic() then
timerSmartStamperCD:Start()
voiceEnvironmentalThreats:Play("gather")--Must restack for smart stampers
else
if self.vb.phase == 2 then
specWarnSearingPlatesEnd:Show()
else
specWarnStampersEnd:Show()
end
voiceEnvironmentalThreats:Play("safenow")
end
end
end
end--]]
| gpl-2.0 |
ddysher/turbo | turbo/inotify.lua | 12 | 5820 | --- Turbo.lua inotify Module
--
-- Copyright 2013 John Abrahamsen
--
-- 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 ffi = require "ffi"
local bit = jit and require "bit" or require "bit32"
local fs = require "turbo.fs"
local log = require "turbo.log"
local util = require "turbo.util"
local ioloop = require "turbo.ioloop"
--local syscall = require "turbo.syscall"
local inotify = {}
-- inotify call is available through ffi.C.inotify via cdef.lua.
--- Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH.
inotify.IN_ACCESS = 0x00000001 -- File was accessed.
inotify.IN_MODIFY = 0x00000002 -- File was modified.
inotify.IN_ATTRIB = 0x00000004 -- Metadata changed.
inotify.IN_CLOSE_WRITE = 0x00000008 -- Writtable file was closed.
inotify.IN_CLOSE_NOWRITE = 0x00000010 -- Unwrittable file closed.
inotify.IN_CLOSE = bit.bor (inotify.IN_CLOSE_WRITE,
inotify.IN_CLOSE_NOWRITE) -- Close.
inotify.IN_OPEN = 0x00000020 -- File was opened.
inotify.IN_MOVED_FROM = 0x00000040 -- File was moved from X.
inotify.IN_MOVED_TO = 0x00000080 -- File was moved to Y.
inotify.IN_MOVE = bit.bor (inotify.IN_MOVED_FROM,
inotify.IN_MOVED_TO) -- Moves.
inotify.IN_CREATE = 0x00000100 -- Subfile was created.
inotify.IN_DELETE = 0x00000200 -- Subfile was deleted.
inotify.IN_DELETE_SELF = 0x00000400 -- Self was deleted.
inotify.IN_MOVE_SELF = 0x00000800 -- Self was moved.
--- The following bits may be set in the mask field returned by read(2)
inotify.IN_IGNORED = 0x00008000 -- Watch was removed
--- Provide human readable error description in case of failure
local function check_error(ret, path)
if ret == -1 then
local ern = ffi.errno()
local err = ffi.string(ffi.C.strerror(ern))
error(string.format("%s (%d) on %s", err, ern, path))
end
end
--- Create a new inotify instance
function inotify:new()
self.fd = ffi.C.inotify_init()
self.wd2name = {}
if self.fd == -1 then
error(ffi.string(ffi.C.strerror(ffi.errno())))
end
return self.fd
end
--- Watch on a given file
-- @param file_path must be a valid relative path or absolute path
-- @return true if watch successfully, false otherwise
function inotify:watch_file(file_path)
if fs.is_file(file_path) then
local wd = ffi.C.inotify_add_watch(self.fd, file_path, self.IN_MODIFY)
check_error(wd, file_path)
self.wd2name[wd] = file_path
return true
else
return false
end
end
--- Watch on a given directory, not its sub-directories
-- @param dir_path must be a valid relative path or absolute path
-- @return true if watch successfully, false otherwise
function inotify:watch_dir(dir_path)
if fs.is_dir(dir_path) then
local wd = ffi.C.inotify_add_watch(self.fd, dir_path, self.IN_MODIFY)
check_error(wd, dir_path)
self.wd2name[wd] = dir_path
return true
else
return false
end
end
--- Watch given directory as well as all its sub-directories.
-- @param path must be a valid relative path or absolute path
-- @param ignore an optional table of directories to ignore
function inotify:watch_all(path, ignore)
-- Take care of ignored files
if not ignore or not util.is_in(path, ignore) then
if fs.is_dir(path) then
local wd = ffi.C.inotify_add_watch(self.fd, path, self.IN_MODIFY)
check_error(wd, path)
self.wd2name[wd] = path
end
local ls = io.popen('ls "' .. path .. '"')
for filename in ls:lines() do
local full_path = path .. '/' .. filename
if path == '.' then full_path = filename end -- pass './'
if fs.is_dir(full_path) then
self:watch_all(full_path, ignore)
end
end
ls:close()
end
end
--- Remove watch previously added using watch_* functions.
-- @param path_or_wd valid relative path, absolute path or wd (watch descriptor)
function inotify:watch_remove(path_or_wd)
local typ = type(path_or_wd)
if typ == 'number' then
ffi.C.inotify_rm_watch(self.fd, path_or_wd)
self.wd2name[path_or_wd] = nil
elseif typ == 'string' then
for wd, name in pairs(self.wd2name) do
if name == path_or_wd then
ffi.C.inotify_rm_watch(self.fd, wd)
self.wd2name[wd] = nil
end
end
end
end
--- This helper function should add path to watch list again in case kernel
-- starts ignoring it.
-- @param event struct inotify_event*
-- @param path must be a valid relative path or absolute path
function inotify:rewatch_if_ignored(event, path)
if bit.band(event.mask, inotify.IN_IGNORED) == inotify.IN_IGNORED then
inotify:watch_remove(event.wd)
inotify:watch_file(path)
end
end
--- Return file name from corresponding file descriptor, for
-- currently watched file
-- @param wd file descriptor
function inotify:get_watched_file(wd)
return self.wd2name[wd]
end
--- Return all file names of currently watched files
function inotify:get_watched_files()
return self.wd2name
end
--- Close inotify
function inotify:close()
ffi.C.close(self.fd)
end
return inotify
| apache-2.0 |
n0xus/darkstar | scripts/zones/Metalworks/npcs/Fariel.lua | 34 | 2197 | -----------------------------------
-- Area: Metalworks
-- NPC: Fariel
-- Type: Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Metalworks/TextIDs");
require("scripts/globals/pathfind");
local path = {
53.551208, -14.000000, -7.162227,
54.111534, -14.000000, -6.227105,
54.075279, -14.000000, -5.139729,
53.565350, -14.000000, 6.000605,
52.636345, -14.000000, 6.521872,
51.561535, -14.000000, 6.710593,
50.436523, -14.000000, 6.835652,
41.754219, -14.000000, 7.686310,
41.409531, -14.000000, 6.635177,
41.351002, -14.000000, 5.549131,
41.341057, -14.000000, 4.461191,
41.338020, -14.000000, -9.138797,
42.356136, -14.000000, -9.449953,
43.442558, -14.000000, -9.409095,
44.524868, -14.000000, -9.298069,
53.718494, -14.000000, -8.260445,
54.082706, -14.000000, -7.257769,
54.110283, -14.000000, -6.170790,
54.073116, -14.000000, -5.083439,
53.556625, -14.000000, 6.192736,
52.545383, -14.000000, 6.570893,
51.441212, -14.000000, 6.730487,
50.430820, -14.000000, 6.836911,
41.680725, -14.000000, 7.693455,
41.396103, -14.000000, 6.599321,
41.349224, -14.000000, 5.512603,
41.340771, -14.000000, 4.424644
};
function onSpawn(npc)
npc:initNpcAi();
npc:setPos(pathfind.first(path));
onPath(npc);
end;
function onPath(npc)
pathfind.patrol(npc, path);
end;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x02C2);
npc:wait(-1);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,npc)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
npc:wait(0);
end;
| gpl-3.0 |
chawan/RepHelper | Locales/ruRU.lua | 1 | 25847 | -- Русский (Russian)
-------------------- --------------------
if (GetLocale() =="ruRU") then
-- Binding names
BINDING_HEADER_REPHELPER = "RepHelper"
BINDING_NAME_SHOWCONFIG = "Показать окно опций"
BINDING_NAME_SHOWDETAILS = "Отображение детальной информации о репутации"
RPH_TXT = {}
RPH_TXT.Mob = {}
-- help
RPH_TXT.help = "Инструментарий работы с репутацией"
RPH_TXT.command = "Невозможно разобрать команду"
RPH_TXT.usage = "Использование"
RPH_TXT.helphelp = "Показывает этот текст помощи"
RPH_TXT.helpabout = "Показывает информацию об авторе"
RPH_TXT.helpstatus = "Показывает текущие настройки"
-- about
RPH_TXT.by = "durch"
RPH_TXT.version = "Версия"
RPH_TXT.date = "дата"
RPH_TXT.web = "сайт"
RPH_TXT.slash = "Слэш команды"
RPH_TXT_STAND_LV = {}
RPH_TXT_STAND_LV[0] = "Неизвестно"
RPH_TXT_STAND_LV[1] = "Ненависть"
RPH_TXT_STAND_LV[2] = "Враждебность"
RPH_TXT_STAND_LV[3] = "недружественный"
RPH_TXT_STAND_LV[4] = "Равнодушие"
RPH_TXT_STAND_LV[5] = "Дружелюбие"
RPH_TXT_STAND_LV[6] = "Уважение"
RPH_TXT_STAND_LV[7] = "Почтение"
RPH_TXT_STAND_LV[8] = "Превознесение"
-- status
RPH_TXT.status = "Статус"
RPH_TXT.disabled = "выключено"
RPH_TXT.enabled = "включено"
RPH_TXT.statMobs = "Показывать мобов [М]"
RPH_TXT.statQuests = "Показывать квесты [К]"
RPH_TXT.statInstances = "Показывать подземелья [П]"
RPH_TXT.statItems = "Показывать вещи [В]"
RPH_TXT.statGeneral = "Показать общее [G]"
RPH_TXT.statMissing = "Показывать недостающую репутацию"
RPH_TXT.statDetails = "Показывать окно расширенной информации"
RPH_TXT.statChat = "Детальное сообщение чата"
RPH_TXT.statNoGuildChat = "Не отображать репутацию с гильдией в чат"
RPH_TXT.statSuppress = "Подавить стандартное сообщение в чате"
RPH_TXT.statPreview = "Отображать предпросмотр в окне репутации"
RPH_TXT.statSwitch = "Автоматическое переключение фракции в полосе репутации"
RPH_TXT.statNoGuildSwitch = "Не переключать для репутации с гильдией"
RPH_TXT.statSilentSwitch = "Нет сообщений при переключении полосы репутации"
RPH_TXT.statGuildCap = "Показать лимит репутации с гильдией в чат"
-- XML UI elements
RPH_TXT.showQuests = "Квесты"
RPH_TXT.showInstances = "Подземелья"
RPH_TXT.showMobs = "Мобы"
RPH_TXT.showItems = "Вещи"
RPH_TXT.showGeneral = "Показать общую информацию"
RPH_TXT.showAll = "Показать все"
RPH_TXT.showNone = "Скрыть все"
RPH_TXT.expand = "Развернуть"
RPH_TXT.collapse = "Свернуть"
RPH_TXT.supressNoneFaction = "Убрать исключения фракции"
RPH_TXT.supressNoneGlobal = "Убрать все исключения"
RPH_TXT.suppressHint = "Кликните правой кнопкой, чтобы исключить квест из списка"
RPH_TXT.clearSessionGain = "Очистить счетчик увеличений за сессию"
-- options dialog
RPH_TXT.showMissing = "Показывать недостающую репутацию во фрейме репутации"
RPH_TXT.extendDetails = "Показывать окно детальной информации о репутации"
RPH_TXT.gainToChat = "Replace original faction gain messages with a more detailed version"
RPH_TXT.noGuildGain = "Не писать в чат для репутации с гильдией"
RPH_TXT.suppressOriginalGain = "Подавлять стандартное сообщение повышения репутации"
RPH_TXT.showPreviewRep = "Показывать репутацию, которая может быть получена, в окне репутации"
RPH_TXT.switchFactionBar = "Переключать полосу репутации на фракцию, с которой только что приобрели репутацию"
RPH_TXT.noGuildSwitch = "Не включать полосу репутации для репутации с гильдией"
RPH_TXT.silentSwitch = "Не отображать сообщения в чат при переключении полосы репутации"
RPH_TXT.guildCap = "Показывать в чат дневной максимум репутации с гильдией."
RPH_TXT.defaultChatFrame = "Использовать окно чата по умолчанию"
RPH_TXT.chatFrame = "Использовать окно чата: %d (%s)"
RPH_TXT.usingDefaultChatFrame = "Используется окно чата по умолчанию"
RPH_TXT.usingChatFrame = "Используется окно чата"
RPH_TXT.EnableParagonBar = "Display paragon reputation in bars."
-- various LUA
RPH_TXT.options = "Опции"
RPH_TXT.orderByStanding = "Сортировать по репе"
RPH_TXT.lookup = "Посмотреть фракцию"
RPH_TXT.allFactions = "Список всех фракций"
RPH_TXT.missing = "(до повышения)"
RPH_TXT.missing2 = "Не хватает"
RPH_TXT.heroic = "Героик"
RPH_TXT.normal = "Нормал"
RPH_TXT.switchBar = "Переключаем полосу репутации на"
-- RPH_ShowFactions
RPH_TXT.faction = "Фракция"
RPH_TXT.is = "есть"
RPH_TXT.withStanding = "со стоячим"
RPH_TXT.needed = "необходимо"
RPH_TXT.mob = "[Моб]"
RPH_TXT.limited = "ограничивается"
RPH_TXT.limitedPl = "ограничиваются"
RPH_TXT.quest = "[Квест]"
RPH_TXT.instance = "[Подземелье]"
RPH_TXT.items = "[Вещь]"
RPH_TXT.unknown = "Не известно этому игроку"
-- mob Details
RPH_TXT.tmob = "Обычные мобы (треш)"
RPH_TXT.oboss = "другим боссом"
RPH_TXT.aboss = "все боссы"
RPH_TXT.pboss = "за боссом"
RPH_TXT.fclear = "полный ясно"
RPH_TXT.AU = "Любой Безымянный"
RPH_TXT.AN = "Любой имени"
RPH_TXT.BB = "Пираты Кровавого Паруса"
RPH_TXT.SSP = "пирата Южных морей"
RPH_TXT.Wa = "шайки Скитальцев Пустыни"
RPH_TXT.VCm = "Любой член торговой компании"
RPH_TXT.Mob.MoshOgg_Spellcrafter = "Чаротвор Мош'Огг"
RPH_TXT.Mob.BoulderfistOgre = "Огр из клана Тяжелого Кулака"
-- Quest Details
RPH_TXT.cdq = "Главный город кулинарные ежедневных заданий"
RPH_TXT.coq = "Ежедневные кулинарные квесты других городов"
RPH_TXT.fdq = "Главный город рыболовные ежедневных заданий"
RPH_TXT.foq = "Ежедневные рыболовные квесты других городов"
RPH_TXT.ndq = "нет ежедневных заданий"
RPH_TXT.deleted = "устаревший"
RPH_TXT.Championing = "чемпиона (камзол герольда)"
RPH_TXT.bpqfg = "По процентов поисках усиления фракции"
-- items Details
RPH_TXT.cbadge = "Рекомендательный значок другой город"
-- instance Details
RPH_TXT.srfd = "Перетекают репутация от подземелья"
RPH_TXT.tbd = "ToBe Done"
RPH_TXT.nci = "Нормальные случаи Cataclysm"
RPH_TXT.hci = "Героический случаях Cataclysm"
-- ToBeDone general
RPH_TXT.tfr = "Тиллер Сельское хозяйство репутации"
RPH_TXT.nswts = "Не знаю, когда это начинается"
RPH_TXT.mnd = "Максимальное количество ежедневных заданий"
RPH_TXT.mnds = "Максимальное количество ежедневных газет является"
-- ReputationDetails
RPH_TXT.currentRep = "Текущая репутация"
RPH_TXT.neededRep = "Необходимо набрать"
RPH_TXT.missingRep = "Недостающая репутация"
RPH_TXT.repInBag = "Репутация в сумках"
RPH_TXT.repInBagBank = "Репутация в сумках и банке"
RPH_TXT.repInQuest = "Репутация в квестах"
RPH_TXT.factionGained = "Увеличено за сессию"
RPH_TXT.noInfo = "Информация по этой фракции/репутации не найдена."
RPH_TXT.toExalted = "Нужно до превознесения"
RPH_TXT.toBestFriend = "Reputation to best friend"
-- to chat
RPH_TXT.stats = " (Всего: %s%d, Осталось: %d)"
RPH_TXT.statsNextStanding = " (Total: %s%d, Left to %s: %d)"
-- config changed
RPH_TXT.configQuestion = "Некоторые (новые) настройки были включены. Это происходит только 1 раз для каждой настройки. Рекомендуется убедиться, что новые настройки RepHelper'а Вас удовлетворяют."
RPH_TXT.showConfig = "Посмотреть настройки"
RPH_TXT.later = "Позже"
-- UpdateList
RPH_TXT.mobShort = "[М]"
RPH_TXT.questShort = "[К]"
RPH_TXT.instanceShort = "[П]"
RPH_TXT.itemsShort = "[В]"
RPH_TXT.generalShort = "[G]"
RPH_TXT.mobHead = "Рост репутации за убийство этого моба"
RPH_TXT.questHead = "Рост репутации за выполнение этого квеста"
RPH_TXT.instanceHead = "Рост репутации за прохождение подземелья"
RPH_TXT.itemsHead = "Рост репутации за сдачу предмета"
RPH_TXT.generalHead = "Общая информация о получении репутации"
RPH_TXT.mobTip = "Каждый раз убивая этого моба, вы увеличиваете репутацию. Продолжая в том же духе, вы достигните следующего уровня."
RPH_TXT.questTip = "Каждый раз выполняя этот повторяемый квест, вы увеличиваете репутацию. Продолжая в том же духе, вы достигните следующего уровня."
RPH_TXT.instanceTip = "Каждый раз, проходя подземелье, вы увеличиваете репутацию. Продолжая в том же духе, вы достигнете следующего уровня."
RPH_TXT.itemsName = "Вещей на руках"
RPH_TXT.itemsTip = "Каждый раз сдавая перечисленные вещи, вы увеличиваете репутацию. Продолжая в том же духе, вы достигните следующего уровня."
RPH_TXT.generalTip = "Это информация о получении репутации с фракцией, которая может не относиться к повторяемым способам."
RPH_TXT.allOfTheAbove = "Всего %d за квесты выше"
RPH_TXT.questSummaryHead = RPH_TXT.allOfTheAbove
RPH_TXT.questSummaryTip = "Эта запись показывает краткую сводку всех квестов, перечисленных выше.\\r\\nЭто полезно, когда все квесты ежедневные и можно посчитать сколько дней необходимо до получения нужного уровня репутации."
RPH_TXT.complete = "завершен"
RPH_TXT.active = "Активен"
RPH_TXT.inBag = "В сумках"
RPH_TXT.turnIns = "Сдать:"
RPH_TXT.reputation = "Репутация:"
RPH_TXT.reputationCap = "Лимит репутации:"
RPH_TXT.reputationCapCurrent = "Текущая репутация:"
RPH_TXT.inBagBank = "В сумках и банке"
RPH_TXT.questCompleted = "Квест выполнен"
RPH_TXT.timesToDo = "Сделать раз:"
RPH_TXT.instance2 = "Подземелье:"
RPH_TXT.mode = "Режим:"
RPH_TXT.timesToRun = "Сделать ранов:"
RPH_TXT.mob2 = "Моб:"
RPH_TXT.location = "Локация:"
RPH_TXT.toDo = "Сделать:"
RPH_TXT.quest2 = "Квест:"
RPH_TXT.itemsRequired = "Вещей необходимо"
RPH_TXT.general2 = "Общий:"
RPH_TXT.maxStanding = "Дает репутацию, пока не достигнуто"
-- skills
RPH_TXT.skillHerb = "Травничество"
RPH_TXT.skillMine = "Горное дело"
RPH_TXT.skillSkin = "Снятие шкур"
RPH_TXT.skillAlch = "Алхимия"
RPH_TXT.skillBlack = "Кузнечное дело"
RPH_TXT.skillEnch = "Наложение чар"
RPH_TXT.skillEngi = "Инженерное дело"
RPH_TXT.skillIncrip = "Начертание"
RPH_TXT.skillJewel = "Ювелирное дело"
RPH_TXT.skillLeath = "Кожевничество"
RPH_TXT.skillTail = "Портняжное дело"
RPH_TXT.skillAid = "Первая помощь"
RPH_TXT.skillArch = "Археология"
RPH_TXT.skillCook = "Кулинария"
RPH_TXT.skillFish = "Рыбная ловля"
-- Tooltip
RPH_TXT.elements = {}
RPH_TXT.elements.name = {}
RPH_TXT.elements.tip = {}
RPH_TXT.elements.name.RPH_OptionsButton = RPH_TXT.options
RPH_TXT.elements.tip.RPH_OptionsButton = "Открыть окно для настройки RepHelper'а."
RPH_TXT.elements.name.RPH_OrderByStandingCheckBox = RPH_TXT.orderByStanding
RPH_TXT.elements.tip.RPH_OrderByStandingCheckBox = "Если это поле не отмечено, то список фракций отображается в порядке по умолчанию, т.е. фракции группируются на логические группы, а внутри них по алфавиту. \\r\\nЕсли это поле отмечено, то список фракций сортируется по отношению с ними. \\r\\nЧтобы увидеть |cFFFAA0A0неактивные|r фракции, уберите отметку в этом поле и прокрутите до низа списка."
RPH_TXT.elements.name.RPH_ShowMobsButton = RPH_TXT.showMobs
RPH_TXT.elements.tip.RPH_ShowMobsButton = "Нажмите кнопку, чтобы видеть мобов, за убийство которых растет репутация."
RPH_TXT.elements.name.RPH_ShowQuestButton = RPH_TXT.showQuests
RPH_TXT.elements.tip.RPH_ShowQuestButton = "Нажмите кнопку, чтобы видеть квесты, за выполнение которых растет репутация."
RPH_TXT.elements.name.RPH_ShowItemsButton = RPH_TXT.showItems
RPH_TXT.elements.tip.RPH_ShowItemsButton = "Нажмите кнопку, чтобы видеть вещи, за сдачу которых растет репутация."
RPH_TXT.elements.name.RPH_ShowInstancesButton = RPH_TXT.showInstances
RPH_TXT.elements.tip.RPH_ShowInstancesButton = "Нажмите кнопку, чтобы видеть подземелья, за зачистку которых растет репутация."
RPH_TXT.elements.name.RPH_ShowGeneralButton = RPH_TXT.showGeneral
RPH_TXT.elements.tip.RPH_ShowGeneralButton = "Отметьте это поле, чтобы увидеть общую информацию об увеличении репутации."
RPH_TXT.elements.name.RPH_ShowAllButton = RPH_TXT.showAll
RPH_TXT.elements.tip.RPH_ShowAllButton = "Нажмите эту кнопку чтобы выбрать все 4 элемента.\r\nБудут показаны мобы, квесты, вещи и подземелья для выбранной фракции."
RPH_TXT.elements.name.RPH_ShowNoneButton = RPH_TXT.showNone
RPH_TXT.elements.tip.RPH_ShowNoneButton = "Нажмите эту кнопку чтобы снять выделение с 4 элементов.\r\nВ результате ничего не будет показано. Неожиданно, да? ;-)."
RPH_TXT.elements.name.RPH_ExpandButton = RPH_TXT.expand
RPH_TXT.elements.tip.RPH_ExpandButton = "Нажмите тут, чтобы развернуть все квесты. Будут показаны необходимые для квеста вещи."
RPH_TXT.elements.name.RPH_CollapseButton = RPH_TXT.collapse
RPH_TXT.elements.tip.RPH_CollapseButton = "Нажмите тут, чтобы свернуть все квесты. Угадайте что произойдет. :-)"
RPH_TXT.elements.name.RPH_SupressNoneFactionButton = RPH_TXT.supressNoneFaction
RPH_TXT.elements.tip.RPH_SupressNoneFactionButton = "Нажмите эту кнопку, чтобы вернуть все квесты этой фракции, которые Вы исключили из списка."
RPH_TXT.elements.name.RPH_SupressNoneGlobalButton = RPH_TXT.supressNoneGlobal
RPH_TXT.elements.tip.RPH_SupressNoneGlobalButton = "Нажмите эту кнопку, чтобы вернуть все квесты для всех фракций, которые Вы исключили из списка."
RPH_TXT.elements.name.RPH_ClearSessionGainButton = RPH_TXT.clearSessionGain
RPH_TXT.elements.tip.RPH_ClearSessionGainButton = "Нажмите эту кнопку, чтобы сбросить счетчик полученной репутации за эту сессию."
RPH_TXT.elements.name.RPH_EnableMissingBox = RPH_TXT.showMissing
RPH_TXT.elements.tip.RPH_EnableMissingBox = "Включение этого параметра позволит смотреть недостающую репутацию в окне репутации"
RPH_TXT.elements.name.RPH_ExtendDetailsBox = RPH_TXT.extendDetails
RPH_TXT.elements.tip.RPH_ExtendDetailsBox = "Включение этого параметра позволит смотреть детальную информацию по выбранной фракции.\r\nВ окне будут показаны рекомендуемые квесты, мобы, шмотки и прочая полезная информация"
RPH_TXT.elements.name.RPH_GainToChatBox = RPH_TXT.gainToChat
RPH_TXT.elements.tip.RPH_GainToChatBox = "Включение этого параметра будет показывать полный список фракций с которыми повысилась репутация.\r\nЭто отличается от стандартного уведомления тем, что будет показана не только основная фракция."
RPH_TXT.elements.name.RPH_NoGuildGainBox = RPH_TXT.noGuildGain
RPH_TXT.elements.tip.RPH_NoGuildGainBox = "Включите эту опцию, чтобы не получать сообщения о повышении репутации гильдии."
RPH_TXT.elements.name.RPH_SupressOriginalGainBox = RPH_TXT.suppressOriginalGain
RPH_TXT.elements.tip.RPH_SupressOriginalGainBox = "Включение этого параметра позволит не отображать стандартные сообщени о росте репутации.\r\nИмеет смысл включать, если включен предыдущий пункт."
RPH_TXT.elements.name.RPH_ShowPreviewRepBox = RPH_TXT.showPreviewRep
RPH_TXT.elements.tip.RPH_ShowPreviewRepBox = "Включите этот параметр, чтобы показать репутацию, которую можно получить путем сдачи предметов и завершения уже сделанных квестов, в качестве серой полоски поверх обычной полосы репутации в окне репутации."
RPH_TXT.elements.name.RPH_SwitchFactionBarBox = RPH_TXT.switchFactionBar
RPH_TXT.elements.tip.RPH_SwitchFactionBarBox = "Включите этот параметр для автоматического переключения фракции, за которой вы следите с помощью полосы репутации, на последнюю фракцию, с которой вы приобрели репутацию."
RPH_TXT.elements.name.RPH_NoGuildSwitchBox = RPH_TXT.noGuildSwitch
RPH_TXT.elements.tip.RPH_NoGuildSwitchBox = "Включите этот параметр, чтобы не переключать полосу репутации при получении репутации с гильдией."
RPH_TXT.elements.name.RPH_SilentSwitchBox = RPH_TXT.silentSwitch
RPH_TXT.elements.tip.RPH_SilentSwitchBox = "Включите этот параметр, чтобы полоса репутации переключалась без сообщения в чат."
RPH_TXT.elements.name.RPH_GuildCapBox = RPH_TXT.guildCap
RPH_TXT.elements.name.RPH_ChatFrameSlider = "Вкладка чата"
RPH_TXT.elements.tip.RPH_ChatFrameSlider = "Выберите, в какой вкладке чата RepHelper печатает свои сообщения"
RPH_TXT.elements.name.RPH_EnableParagonBarBox = RPH_TXT.EnableParagonBar
RPH_TXT.elements.tip.RPH_EnableParagonBarBox = "Enable this option to display your current paragon progress in the reputation bars."
RPH_TXT.elements.name.RPH_OptionEnableMissing = RPH_TXT.elements.name.RPH_EnableMissingBox
RPH_TXT.elements.tip.RPH_OptionEnableMissing = RPH_TXT.elements.tip.RPH_EnableMissingBox
RPH_TXT.elements.name.RPH_OptionEnableMissingCB = RPH_TXT.elements.name.RPH_EnableMissingBox
RPH_TXT.elements.tip.RPH_OptionEnableMissingCB = RPH_TXT.elements.tip.RPH_EnableMissingBox
RPH_TXT.elements.name.RPH_OptionExtendDetails = RPH_TXT.elements.name.RPH_ExtendDetailsBox
RPH_TXT.elements.tip.RPH_OptionExtendDetails = RPH_TXT.elements.tip.RPH_ExtendDetailsBox
RPH_TXT.elements.name.RPH_OptionExtendDetailsCB = RPH_TXT.elements.name.RPH_ExtendDetailsBox
RPH_TXT.elements.tip.RPH_OptionExtendDetailsCB = RPH_TXT.elements.tip.RPH_ExtendDetailsBox
RPH_TXT.elements.name.RPH_OptionGainToChat = RPH_TXT.elements.name.RPH_GainToChatBox
RPH_TXT.elements.tip.RPH_OptionGainToChat = RPH_TXT.elements.tip.RPH_GainToChatBox
RPH_TXT.elements.name.RPH_OptionGainToChatCB = RPH_TXT.elements.name.RPH_GainToChatBox
RPH_TXT.elements.tip.RPH_OptionGainToChatCB = RPH_TXT.elements.tip.RPH_GainToChatBox
RPH_TXT.elements.name.RPH_OptionNoGuildGain = RPH_TXT.elements.name.RPH_NoGuildGainBox
RPH_TXT.elements.tip.RPH_OptionNoGuildGain = RPH_TXT.elements.tip.RPH_NoGuildGainBox
RPH_TXT.elements.name.RPH_OptionNoGuildGainCB = RPH_TXT.elements.name.RPH_NoGuildGainBox
RPH_TXT.elements.tip.RPH_OptionNoGuildGainCB = RPH_TXT.elements.tip.RPH_NoGuildGainBox
RPH_TXT.elements.name.RPH_OptionSupressOriginalGain = RPH_TXT.elements.name.RPH_SupressOriginalGainBox
RPH_TXT.elements.tip.RPH_OptionSupressOriginalGain = RPH_TXT.elements.tip.RPH_SupressOriginalGainBox
RPH_TXT.elements.name.RPH_OptionSupressOriginalGainCB = RPH_TXT.elements.name.RPH_SupressOriginalGainBox
RPH_TXT.elements.tip.RPH_OptionSupressOriginalGainCB = RPH_TXT.elements.tip.RPH_SupressOriginalGainBox
RPH_TXT.elements.name.RPH_OptionShowPreviewRep = RPH_TXT.elements.name.RPH_ShowPreviewRepBox
RPH_TXT.elements.tip.RPH_OptionShowPreviewRep = RPH_TXT.elements.tip.RPH_ShowPreviewRepBox
RPH_TXT.elements.name.RPH_OptionShowPreviewRepCB = RPH_TXT.elements.name.RPH_ShowPreviewRepBox
RPH_TXT.elements.tip.RPH_OptionShowPreviewRepCB = RPH_TXT.elements.tip.RPH_ShowPreviewRepBox
RPH_TXT.elements.name.RPH_OptionSwitchFactionBar = RPH_TXT.elements.name.RPH_SwitchFactionBarBox
RPH_TXT.elements.tip.RPH_OptionSwitchFactionBar = RPH_TXT.elements.tip.RPH_SwitchFactionBarBox
RPH_TXT.elements.name.RPH_OptionSwitchFactionBarCB = RPH_TXT.elements.name.RPH_SwitchFactionBarBox
RPH_TXT.elements.tip.RPH_OptionSwitchFactionBarCB = RPH_TXT.elements.tip.RPH_SwitchFactionBarBox
RPH_TXT.elements.name.RPH_OptionNoGuildSwitch = RPH_TXT.elements.name.RPH_NoGuildSwitchBox
RPH_TXT.elements.tip.RPH_OptionNoGuildSwitch = RPH_TXT.elements.tip.RPH_NoGuildSwitchBox
RPH_TXT.elements.name.RPH_OptionNoGuildSwitchCB = RPH_TXT.elements.name.RPH_NoGuildSwitchBox
RPH_TXT.elements.tip.RPH_OptionNoGuildSwitchCB = RPH_TXT.elements.tip.RPH_NoGuildSwitchBox
RPH_TXT.elements.name.RPH_OptionSilentSwitch = RPH_TXT.elements.name.RPH_SilentSwitchBox
RPH_TXT.elements.tip.RPH_OptionSilentSwitch = RPH_TXT.elements.tip.RPH_SilentSwitchBox
RPH_TXT.elements.name.RPH_OptionSilentSwitchCB = RPH_TXT.elements.name.RPH_SilentSwitchBox
RPH_TXT.elements.tip.RPH_OptionSilentSwitchCB = RPH_TXT.elements.tip.RPH_SilentSwitchBox
RPH_TXT.elements.name.RPH_OptionGuildCap = RPH_TXT.elements.name.RPH_GuildCapBox
RPH_TXT.elements.tip.RPH_OptionGuildCap = RPH_TXT.elements.tip.RPH_GuildCapBox
RPH_TXT.elements.name.RPH_OptionGuildCapCB = RPH_TXT.elements.name.RPH_GuildCapBox
RPH_TXT.elements.tip.RPH_OptionGuildCapCB = RPH_TXT.elements.tip.RPH_GuildCapBox
RPH_TXT.elements.name.RPH_OptionChatFrameSlider = RPH_TXT.elements.name.RPH_ChatFrameSlider
RPH_TXT.elements.tip.RPH_OptionChatFrameSlider = RPH_TXT.elements.tip.RPH_ChatFrameSlider
RPH_TXT.elements.name.RPH_OptionEnableParagonBar = RPH_TXT.elements.name.RPH_EnableParagonBarBox
RPH_TXT.elements.tip.RPH_OptionEnableParagonBar = RPH_TXT.elements.tip.RPH_EnableParagonBarBox
RPH_TXT.elements.name.RPH_OptionEnableParagonBarCB = RPH_TXT.elements.name.RPH_EnableParagonBarBox
RPH_TXT.elements.tip.RPH_OptionEnableParagonBarCB = RPH_TXT.elements.tip.RPH_EnableParagonBarBox
end
| gpl-3.0 |
davymai/CN-QulightUI | Interface/AddOns/DBM-Outlands/localization.cn.lua | 1 | 1620 | if GetLocale() ~= "zhCN" then return end
local L
--Maulgar
L = DBM:GetModLocalization("Maulgar")
L:SetGeneralLocalization{
name = "莫加尔大王"
}
--Gruul the Dragonkiller
L = DBM:GetModLocalization("Gruul")
L:SetGeneralLocalization{
name = "屠龙者格鲁尔"
}
L:SetWarningLocalization{
WarnGrowth = "%s (%d)"
}
L:SetOptionLocalization{
WarnGrowth = "Show warning for $spell:36300"
}
-- Magtheridon
L = DBM:GetModLocalization("Magtheridon")
L:SetGeneralLocalization{
name = "玛瑟里顿"
}
L:SetWarningLocalization{
}
L:SetTimerLocalization{
timerP2 = "Phase 2"
}
L:SetOptionLocalization{
timerP2 = "Show timer for start of phase 2"
}
L:SetMiscLocalization{
DBM_MAG_EMOTE_PULL = "%s的禁锢开始变弱!",
DBM_MAG_YELL_PHASE2 = "我……自由了!",
DBM_MAG_YELL_PHASE3 = "I will not be taken so easily! Let the walls of this prison tremble... and fall!"
}
-- Doom Lord Kazzak
L = DBM:GetModLocalization("Kazzak")
L:SetGeneralLocalization{
name = "末日领主卡扎克"
}
L:SetWarningLocalization{
}
L:SetOptionLocalization{
SetIconOnMark = DBM_CORE_AUTO_ICONS_OPTION_TEXT:format(32960)
}
L:SetMiscLocalization{
DBM_KAZZAK_EMOTE_ENRAGE = "%s becomes enraged!"--Probalby won't be used, at least not long. Once spellid replaces it
}
-- Doomwalker
L = DBM:GetModLocalization("Doomwalker")
L:SetGeneralLocalization{
name = "末日行者"
}
L:SetWarningLocalization{
}
L:SetTimerLocalization{
}
L:SetOptionLocalization{
}
L:SetMiscLocalization{
DBM_DOOMW_EMOTE_ENRAGE = "%s becomes enraged!"--Probalby won't be used, at least not long. Once spellid replaces it
} | gpl-2.0 |
privatesource/Vira_max | plugins/pass.lua | 15 | 2226 | do
local function set_pass(msg, pass, id)
local hash = nil
if msg.to.type == "channel" then
hash = 'setpass:'
end
local name = string.gsub(msg.to.print_name, '_', '')
if hash then
redis:hset(hash, pass, id)
return send_large_msg("channel#id"..msg.to.id, "ߔ᠐assword of group:\n["..name.."] has been set to:\n\n "..pass.."\n\nNow user can join in pm by\n!join "..pass.." ⚜", ok_cb, true)
end
end
local function is_used(pass)
local hash = 'setpass:'
local used = redis:hget(hash, pass)
return used or false
end
local function show_add(cb_extra, success, result)
vardump(result)
local receiver = cb_extra.receiver
local text = "I added you toߑ堢"..result.title.."(ߑ䢮.result.participants_count..)"
send_large_msg(receiver, text)
end
local function added(msg, target)
local receiver = get_receiver(msg)
channel_info("channel#id"..target, show_add, {receiver=receiver})
end
local function run(msg, matches)
if matches[1] == "setpass" and msg.to.type == "channel" and matches[2] then
local pass = matches[2]
local id = msg.to.id
if is_used(pass) then
return "Sorry, This pass is already taken."
end
redis:del("setpass:", id)
return set_pass(msg, pass, id)
end
if matches[1] == "join" and matches[2] then
local hash = 'setpass:'
local pass = matches[2]
local id = redis:hget(hash, pass)
local receiver = get_receiver(msg)
if not id then
return "Could not find a group with this pass\nMaby the pass has been changed"
end
chat_add_user("channel#id"..id, "user#id"..msg.from.id, ok_cb, false)
return added(msg, id)
else
return "I could not added you to"..string.gsub(msg.to.id.print_name, '_', ' ')
end
if matches[1] == "pass" then
local hash = 'setpass:'
local chat_id = msg.to.id
local pass = redis:hget(hash, channel_id)
local receiver = get_receiver(msg)
send_large_msg(receiver, "Password for Group:["..msg.to.print_name.."]\n\nPass > "..pass)
end
end
return {
patterns = {
"^[/!#](setpass) (.*)$",
"^[/!#](pass)$",
"^[/!#](join) (.*)$",
"^!!tgservice (chat_add_user)$",
"^!!tgservice (.+)$",
"^!!tgservice (chat_del_user)$"
},
run = run
}
end
| gpl-2.0 |
mpeterv/luacheck | spec/globbing_spec.lua | 2 | 2858 | local globbing = require "luacheck.globbing"
local fs = require "luacheck.fs"
local cur_dir = fs.get_current_dir()
local function check_match(expected_result, glob, path)
glob = fs.normalize(fs.join(cur_dir, glob))
path = fs.normalize(fs.join(cur_dir, path))
assert.equal(expected_result, globbing.match(glob, path))
end
describe("globbing", function()
describe("match", function()
it("returns true on literal match", function()
check_match(true, "foo/bar", "foo/bar")
end)
it("returns true on literal match after normalization", function()
check_match(true, "foo//bar/baz/..", "./foo/bar/")
end)
it("returns false for on literal mismatch", function()
check_match(false, "foo/bar", "foo/baz")
end)
it("accepts subdirectory matches", function()
check_match(true, "foo/bar", "foo/bar/baz")
end)
it("understands wildcards", function()
check_match(true, "*", "foo")
check_match(true, "foo/*r", "foo/bar")
check_match(true, "foo/*r", "foo/bar/baz")
check_match(false, "foo/*r", "foo/baz")
end)
it("understands optional characters", function()
check_match(false, "?", "foo")
check_match(true, "???", "foo")
check_match(true, "????", "foo")
check_match(true, "f?o/?a?", "foo/bar")
check_match(false, "f?o/?a?", "foo/abc")
end)
it("understands ranges and classes", function()
check_match(true, "[d-h]o[something]", "foo")
check_match(false, "[d-h]o[somewhere]", "bar")
check_match(false, "[.-h]o[i-z]", "bar")
end)
it("accepts closing bracket as first class character", function()
check_match(true, "[]]", "]")
check_match(false, "[]]", "[")
check_match(true, "[]foo][]foo][]foo]", "foo")
end)
it("accepts dash as first or last class character", function()
check_match(true, "[-]", "-")
check_match(false, "[-]", "+")
check_match(true, "[---]", "-")
end)
it("understands negation", function()
check_match(true, "[!foo][!bar][!baz]", "boo")
check_match(false, "[!foo][!bar][!baz]", "far")
check_match(false, "[!a-z]", "g")
end)
it("understands recursive globbing using **", function()
check_match(true, "**/*.lua", "foo.lua")
check_match(true, "**/*.lua", "foo/bar.lua")
check_match(false, "foo/**/*.lua", "bar.lua")
check_match(false, "foo/**/*.lua", "foo.lua")
check_match(true, "foo/**/bar/*.lua", "foo/bar/baz.lua")
check_match(true, "foo/**/bar/*.lua", "foo/foo2/foo3/bar/baz.lua")
check_match(false, "foo/**/bar/*.lua", "foo/baz.lua")
check_match(false, "foo/**/bar/*.lua", "bar/baz.lua")
end)
end)
end)
| mit |
n0xus/darkstar | scripts/globals/items/king_truffle.lua | 35 | 1193 | -----------------------------------------
-- ID: 4386
-- King Truffle
-- 5 Minutes, food effect, All Races
-----------------------------------------
-- Strength -6
-- Mind +4
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,300,4386);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR,-6);
target:addMod(MOD_MND, 4);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR,-6);
target:delMod(MOD_MND, 4);
end; | gpl-3.0 |
rekotc/game-engine-demo | Source/GCC4/3rdParty/luaplus51-all/Src/Modules/cgilua/examples/authentication_conf.lua | 4 | 3501 | ----------------------------
-- Authentication configuration file
--
-- Defines the method and details of the authentication mechanism
--
-- $Id: authentication_conf.lua,v 1.1 2007/12/05 18:40:17 carregal Exp $
----------------------------
require"cgilua.authentication"
local options = {
-- Authentication method: "simpledatabase", "webserver", "ldap", "test"
method = "test",
-- How Authentication is stored on the client
-- This directive can be "cookie" or "url"
tokenPersistence="url",
-- Name used for the token persitence
tokenName = "userhash",
-- The criptografic key to encode user information on cookies and URLs
criptKey="sfdtdyedbbg",
-- Where to redirect when authentication is needed
-- checkURL="https://remotehost/sso/authenticate", -- absolute URL
checkURL="check.lua", -- authentication controller used by app.lua
}
--
-- Simple database authentication parameters
--
options.simpledatabase = {
driver="mysql", -- "mysql","oracle","odbc"
sourcename="users",
dbusername="root",
dbpassword="pass",
passwd_hash_function=(require"md5") and md5.sumhexa, -- for MD5 encription
-- passwd_hash_function = function(arg) return arg end , -- for no encription
users_table="Users",
user_name_field="Name",
pass_field="Password",
}
--
-- Web Server authentication parameters
--
options.webserver = {
user_env_var="REMOTE_USER", -- if supports RFC 931 use "REMOTE_IDENT"
}
--
-- LDAP authentication parameters
--
options.ldap = {
host="127.0.0.1", -- accepts host:port
usetls=false,
--baseDN="ou=People,dc=example,dc=com",
baseDN="dc=example,dc=com",
RDNatributeName="cn",
}
local methods = {
simpledatabase = {},
webserver = {},
ldap = {},
test = {},
}
--
-- Simple database authentication method
--
methods.simpledatabase.check = function(username,userpasswd)
local simpledatabase = options.simpledatabase
require ("luasql."..simpledatabase.driver)
local query = "SELECT "..simpledatabase.pass_field.." FROM "..simpledatabase.users_table.." WHERE "..simpledatabase.user_name_field.." = '"..username.."'"
local conn,err = luasql[simpledatabase.driver]:connect(simpledatabase.sourcename,simpledatabase.dbusername,simpledatabase.dbpassword)
if conn == nil then
return false, err
end
local cur=conn:execute(query)
local row=cur:fetch()
local retpasswd=row[simpledatabase.pass_field]
local passwdhash=simpledatabase.passwd_hash_function(userpasswd)
if retpasswd==passwdhash then
return true
end
return false, "Username and password do not match."
end
--
-- Web Server authentication method
--
methods.webserver.user = function ()
return cgilua.servervariable (options.webserver.user_env_var)
end
--
-- LDAP authentication method
--
methods.ldap.check = function(username,userpasswd)
require"lualdap"
local ld,err = options.lualdap.open_simple (options.ldap.host,
options.ldap.RDNatributeName.."="..username..","..options.ldap.baseDN,
userpasswd, options.ldap.usetls)
if ld~=nil then
return true
else
return false, err
end
end
--
-- Test authentication method
--
methods.test.check = function(username,userpasswd)
if (username == "admin") and (userpasswd == "admin") then
return true
else
return false, "Wrong user/password combination!"
end
end
cgilua.authentication.configure(options, methods) | lgpl-3.0 |
mpeterv/busted | spec/randomize_spec.lua | 8 | 1115 | local unexpected = {}
local order = {}
describe('Randomizing test order', function()
randomize()
for i = 1, 100 do
table.insert(unexpected, i)
it('does 100 its', function()
table.insert(order, i)
end)
end
end)
describe('Order of tests ran', function()
it('randomized', function()
assert.are_not.same(unexpected, order)
end)
end)
describe('Disabling randomized test order with randomize(false)', function()
randomize()
randomize(false)
local expected = {}
local order = {}
for i = 1, 100 do
table.insert(expected, i)
it('does 100 its', function()
table.insert(order, i)
end)
end
it('does not randomize tests', function()
assert.are.same(expected, order)
end)
end)
describe('Disabling randomized test order with randomize(nil)', function()
randomize()
randomize(nil)
local expected = {}
local order = {}
for i = 1, 100 do
table.insert(expected, i)
it('does 100 its', function()
table.insert(order, i)
end)
end
it('does not randomize tests', function()
assert.are.same(expected, order)
end)
end)
| mit |
n0xus/darkstar | scripts/zones/Port_Bastok/npcs/Fo_Mocorho.lua | 59 | 1038 | -----------------------------------
-- Area: Port Bastok
-- NPC: Fo Mocorho
-- Type: Weather Reporter
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Port_Bastok/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0074,0,0,0,0,0,0,0,VanadielTime());
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end; | gpl-3.0 |
davymai/CN-QulightUI | Interface/AddOns/DBM-DragonSoul/SpineDeathwing.lua | 1 | 11604 | local mod = DBM:NewMod(318, "DBM-DragonSoul", nil, 187)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 145 $"):sub(12, -3))
mod:SetCreatureID(53879)
mod:SetEncounterID(1291)
mod:SetZone()
mod:SetUsedIcons(6, 5, 4, 3, 2, 1)
mod:SetModelSound("sound\\CREATURE\\Deathwing\\VO_DS_DEATHWING_BACKEVENT_01.OGG", "sound\\CREATURE\\Deathwing\\VO_DS_DEATHWING_BACKSLAY_01.OGG")
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_CAST_START 105845 105847 105848 109379",
"SPELL_CAST_SUCCESS 105219 105248",
"SPELL_AURA_APPLIED 105248 105490 105479",
"SPELL_AURA_APPLIED_DOSE 105248",
"SPELL_AURA_REMOVED 105490 105479",
"SPELL_HEAL",
"SPELL_PERIODIC_HEAL",
"SPELL_DAMAGE",
"SPELL_MISSED",
"SWING_DAMAGE",
"SWING_MISSED",
"RAID_BOSS_EMOTE",
"UNIT_DIED"
)
local warnAbsorbedBlood = mod:NewStackAnnounce(105248, 2)
local warnResidue = mod:NewCountAnnounce("ej4057", 3, nil, false)--This is HIGHLY inaccurate in 5.x, i do not know why right now. I'll actually log fight next week
local warnGrip = mod:NewTargetAnnounce(105490, 4)
local warnNuclearBlast = mod:NewCastAnnounce(105845, 4)
local warnSealArmor = mod:NewAnnounce("warnSealArmor", 4, 105847)
local warnAmalgamation = mod:NewSpellAnnounce("ej4054", 3, 106005)--Amalgamation spawning, give temp icon.
local specWarnRoll = mod:NewSpecialWarningSpell("ej4050", nil, nil, nil, 2)--The actual roll
local specWarnTendril = mod:NewSpecialWarning("SpecWarnTendril", nil, nil, nil, 3)--A personal warning for you only if you're not gripped 3 seconds after roll started
local specWarnGrip = mod:NewSpecialWarningSpell(105490, "Dps")
local specWarnNuclearBlast = mod:NewSpecialWarningRun(105845, "Melee", nil, nil, 4)
local specWarnSealArmor = mod:NewSpecialWarningSpell(105847, "Dps")
local specWarnAmalgamation = mod:NewSpecialWarningSpell("ej4054", false)
local timerSealArmor = mod:NewCastTimer(23, 105847)
local timerBarrelRoll = mod:NewCastTimer(5, "ej4050")
local timerGripCD = mod:NewNextTimer(32, 105490)
local timerDeathCD = mod:NewCDTimer(8.5, 106199)--8.5-10sec variation.
local countdownRoll = mod:NewCountdown(5, "ej4050")
local countdownGrip = mod:NewCountdown("Alt32", 105490, "-Tank")--Can get confusing if used with roll countdown. This is off by default but can be turned on by someone willing to sort out the confusion on their own.
mod:AddBoolOption("InfoFrame", true)
mod:AddBoolOption("SetIconOnGrip", true)
mod:AddBoolOption("ShowShieldInfo", false)--on 25 man this is quite frankly a spammy nightmare, especially on heroic. off by default since it's really only sensible in 10 man. Besides I may be adding an alternate frame option for "grip damage needed"
local sealArmorText = DBM_CORE_AUTO_ANNOUNCE_TEXTS.cast:format(GetSpellInfo(105847), 23)
local gripTargets = {}
local gripIcon = 6
local corruptionActive = {}
local residueNum = 0
local diedOozeGUIDS = {}
local numberOfPlayers = 1
local function checkTendrils()
if not UnitDebuff("player", GetSpellInfo(105563)) and not UnitIsDeadOrGhost("player") then
specWarnTendril:Show()
end
end
local function clearTendrils()
if mod.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
end
local function showGripWarning()
warnGrip:Show(table.concat(gripTargets, "<, >"))
specWarnGrip:Show()
table.wipe(gripTargets)
end
local function warningResidue()
if residueNum >= 0 then -- (better to warn 0 on heroic)
warnResidue:Show(residueNum)
end
end
local function checkOozeResurrect(GUID)
-- set min resurrect time to 5 sec. (guessed)
if diedOozeGUIDS[GUID] and GetTime() - diedOozeGUIDS[GUID] > 5 then
residueNum = residueNum - 1
diedOozeGUIDS[GUID] = nil
mod:Unschedule(warningResidue)
mod:Schedule(1.25, warningResidue)
end
end
local function countCorruptionActive()
local count = 0
for i, v in pairs(corruptionActive) do
count = count + 1
end
return count
end
local clearPlasmaTarget, setPlasmaTarget, clearPlasmaVariables
do
local plasmaTargets = {}
local healed = {}
function mod:SPELL_HEAL(_, _, _, _, destGUID, _, _, _, _, _, _, _, _, absorbed)
if plasmaTargets[destGUID] then
healed[destGUID] = healed[destGUID] + (absorbed or 0)
DBM.BossHealth:Update()
end
end
mod.SPELL_PERIODIC_HEAL = mod.SPELL_HEAL
local function updatePlasmaTargets()
if not mod.Options.ShowShieldInfo then return end
local maxAbsorb = mod:IsDifficulty("heroic25") and 420000 or
mod:IsDifficulty("heroic10") and 280000 or
mod:IsDifficulty("normal25") and 300000 or
mod:IsDifficulty("normal10") and 200000 or 1
DBM.BossHealth:Clear()
if not DBM.BossHealth:IsShown() then
DBM.BossHealth:Show(L.name)
end
for i,v in pairs(plasmaTargets) do
DBM.BossHealth:AddBoss(function() return math.max(1, math.floor((healed[i] or 0) / maxAbsorb * 100)) end, L.PlasmaTarget:format(v))
end
end
function setPlasmaTarget(guid, name)
plasmaTargets[guid] = name
healed[guid] = 0
updatePlasmaTargets()
end
function clearPlasmaTarget(guid, name)
plasmaTargets[guid] = nil
healed[guid] = nil
updatePlasmaTargets()
end
function clearPlasmaVariables()
table.wipe(plasmaTargets)
table.wipe(healed)
updatePlasmaTargets()
end
end
function mod:OnCombatStart(delay)
numberOfPlayers = DBM:GetNumRealGroupMembers()
if self:IsDifficulty("lfr25") then
sealArmorText = DBM_CORE_AUTO_ANNOUNCE_TEXTS.cast:format(GetSpellInfo(105847), 34.5)
else
sealArmorText = DBM_CORE_AUTO_ANNOUNCE_TEXTS.cast:format(GetSpellInfo(105847), 23)
end
table.wipe(gripTargets)
table.wipe(corruptionActive)
table.wipe(diedOozeGUIDS)
if self.Options.ShowShieldInfo then
clearPlasmaVariables()
end
gripIcon = 6
residueNum = 0
end
function mod:OnCombatEnd()
if self.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 105845 then
warnNuclearBlast:Show()
specWarnNuclearBlast:Show()
elseif args:IsSpellID(105847, 105848) then--This still has 2 spellids, since it's locational, location based IDs did NOT get crunched.
warnSealArmor:Show(sealArmorText)
specWarnSealArmor:Show()
if self:IsDifficulty("lfr25") then
timerSealArmor:Start(34.5)
else
timerSealArmor:Start()
end
elseif spellId == 109379 then
if not corruptionActive[args.sourceGUID] then
corruptionActive[args.sourceGUID] = 0
if self:IsDifficulty("normal25", "heroic25") then
timerGripCD:Start(16, args.sourceGUID)
if countCorruptionActive() < 2 then--because using countdowns with more then 1 will be noisy not informative.
countdownGrip:Start(16, nil, args.sourceGUID)
end
else
timerGripCD:Start(nil, args.sourceGUID)
if countCorruptionActive() < 2 then--because using countdowns with more then 1 will be noisy not informative.
countdownGrip:Start(32, nil, args.sourceGUID)
end
end
end
corruptionActive[args.sourceGUID] = corruptionActive[args.sourceGUID] + 1
if corruptionActive[args.sourceGUID] == 2 and self:IsDifficulty("normal25", "heroic25") then
timerGripCD:Update(8, 16, args.sourceGUID)
elseif corruptionActive[args.sourceGUID] == 4 and self:IsDifficulty("normal10", "heroic10") then
timerGripCD:Update(24, 32, args.sourceGUID)
end
end
end
-- not needed guid check. This is residue creation step.
function mod:SPELL_CAST_SUCCESS(args)
local spellId = args.spellId
if spellId == 105219 then
residueNum = residueNum + 1
diedOozeGUIDS[args.sourceGUID] = GetTime()
self:Unschedule(warningResidue)
self:Schedule(1.25, warningResidue)
elseif spellId == 105248 and diedOozeGUIDS[args.sourceGUID] then
residueNum = residueNum - 1
diedOozeGUIDS[args.sourceGUID] = nil
self:Unschedule(warningResidue)
self:Schedule(1.25, warningResidue)
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 105248 then
warnAbsorbedBlood:Cancel()--Just a little anti spam
warnAbsorbedBlood:Schedule(1.25, args.destName, 1)
elseif spellId == 105490 then
gripTargets[#gripTargets + 1] = args.destName
timerGripCD:Cancel(args.sourceGUID)
countdownGrip:Cancel(args.sourceGUID)
if corruptionActive[args.sourceGUID] then
corruptionActive[args.sourceGUID] = nil
end
if self.Options.SetIconOnGrip then
if gripIcon == 0 then
gripIcon = 6
end
self:SetIcon(args.destName, gripIcon)
gripIcon = gripIcon - 1
end
self:Unschedule(showGripWarning)
self:Schedule(0.3, showGripWarning)
elseif spellId == 105479 then
if self.Options.ShowShieldInfo then
setPlasmaTarget(args.destGUID, args.destName)
end
end
end
function mod:SPELL_AURA_APPLIED_DOSE(args)
local spellId = args.spellId
if spellId == 105248 then
warnAbsorbedBlood:Cancel()--Just a little anti spam
if args.amount == 9 then
warnAbsorbedBlood:Show(args.destName, 9)
else
warnAbsorbedBlood:Schedule(1.25, args.destName, args.amount)
end
end
end
function mod:SPELL_AURA_REMOVED(args)
local spellId = args.spellId
if spellId == 105490 then
if self.Options.SetIconOnGrip then
self:SetIcon(args.destName, 0)
end
elseif spellId == 105479 then
if self.Options.ShowShieldInfo then
clearPlasmaTarget(args.destGUID, args.destName)
end
end
end
--Damage event that indicates an ooze is taking damage
--we check its GUID to see if it's a resurrected ooze and if so remove it from table.
--for WoW 5.x priest spell, Shadow Word: Pain (spellid = 124464) fires spell_damage event. (this is damage over time spell, but combat log records this spell as SPELL_DAMAGE event. not SPELL_PERIODIC_DAMAGE)
--this cause bad revive check, so only source SPELL_DAMAGE (fires when ooze dies again) and SWING_DAMAGE event will resolve this.
--although this change causes slow revive check, it will be better than shows bad residue count.
function mod:SPELL_DAMAGE(sourceGUID, _, _, _, destGUID)
checkOozeResurrect(sourceGUID)
end
mod.SPELL_MISSED = mod.SPELL_DAMAGE
function mod:SWING_DAMAGE(sourceGUID, _, _, _, destGUID)
checkOozeResurrect(sourceGUID)
end
mod.SWING_MISSED = mod.SWING_DAMAGE
function mod:RAID_BOSS_EMOTE(msg)
if msg == L.DRoll or msg:find(L.DRoll) then
self:Unschedule(checkTendrils)--In case you manage to spam spin him, we don't want to get a bunch of extra stuff scheduled.
self:Unschedule(clearTendrils)--^
countdownRoll:Cancel()--^
specWarnRoll:Show()--Warn you right away.
self:Schedule(3, checkTendrils)--After 3 seconds of roll starting, check tendrals, you should have leveled him out by now if this wasn't on purpose.
self:Schedule(12, clearTendrils)--Clearing 3 seconds after the roll should be sufficent
if numberOfPlayers > 1 then
timerBarrelRoll:Start(5)
countdownRoll:Start(5)
else
timerBarrelRoll:Start(10)
countdownRoll:Start(10)
end
if self.Options.InfoFrame and not DBM.InfoFrame:IsShown() then
DBM.InfoFrame:SetHeader(L.NoDebuff:format(GetSpellInfo(105563)))
DBM.InfoFrame:Show(5, "playergooddebuff", 105563)
end
elseif msg == L.DLevels or msg:find(L.DLevels) then
self:Unschedule(checkTendrils)
self:Unschedule(clearTendrils)
clearTendrils()
countdownRoll:Cancel()
timerBarrelRoll:Cancel()
end
end
function mod:UNIT_DIED(args)
local cid = self:GetCIDFromGUID(args.destGUID)
if cid == 53891 or cid == 56162 or cid == 56161 then
timerGripCD:Cancel(args.sourceGUID)
countdownGrip:Cancel(args.sourceGUID)
warnAmalgamation:Schedule(4.5)--4.5-5 seconds after corruption dies.
specWarnAmalgamation:Schedule(4.5)
if self:IsDifficulty("heroic10", "heroic25") then
timerDeathCD:Start(args.destGUID)
end
elseif cid == 56341 or cid == 56575 then
timerSealArmor:Cancel()
end
end
| gpl-2.0 |
rekotc/game-engine-demo | Source/GCC4/3rdParty/luaplus51-all/Src/Modules/penlight/lua/pl/classx.lua | 3 | 5439 | --- extra classes: MultiMap, OrderedMap and Typed List.
-- @class module
-- @name pl.classx
local function module(...) end
--[[
module ('pl.classx')
]]
local classes = require 'pl.class'
local tablex = require 'pl.tablex'
local utils = require 'pl.utils'
local List = require 'pl.list' . List
local class,Map = classes.class,classes.Map
local index_by,tsort,concat = tablex.index_by,table.sort,table.concat
local append,extend,slice = List.append,List.extend,List.slice
local append = table.insert
local is_type = utils.is_type
local classx = {}
-- MultiMap is a standard MT
local MultiMap = utils.stdmt.MultiMap
class(Map,nil,MultiMap)
MultiMap._name = 'MultiMap'
function MultiMap:_init (t)
self:update(t)
end
--- update a MultiMap using a table.
-- @param t either a Multimap or a map-like table.
function MultiMap:update (t)
if not t then return end
if Map:class_of(t) then
for k,v in pairs(t) do
self[k] = List()
self[k]:append(v)
end
else
for k,v in pairs(t) do
self[k] = List(v)
end
end
end
--- add a new value to a key. Setting a nil value removes the key.
-- @param key the key
-- @param val the value
function MultiMap:set (key,val)
if val == nil then
self[key] = nil
else
if not self[key] then
self[key] = List()
end
self[key]:append(val)
end
end
local OrderedMap = class(Map)
OrderedMap._name = 'OrderedMap'
function OrderedMap:_init (t)
self._keys = List()
if t then self:update(t) end
end
local assert_arg,raise = utils.assert_arg,utils.raise
--- update an OrderedMap using a table.
-- If the table is itself an OrderedMap, then its entries will be appended. <br>
-- if it s a table of the form {{key1=val1},{key2=val2},...} these will be appended. <br>
-- Otherwise, it is assumed to be a map-like table, and order of extra entries is arbitrary.
-- @param t a table.
function OrderedMap:update (t)
assert_arg(1,t,'table')
if OrderedMap:class_of(t) then
for k,v in t:iter() do
self:set(k,v)
end
elseif #t > 0 then -- an array must contain {key=val} tables
if type(t[1]) == 'table' then
for _,pair in ipairs(t) do
local key,value = next(pair)
if not key then return raise 'empty pair initialization table' end
self:set(key,value)
end
else
return raise 'cannot use an array to initialize an OrderedMap'
end
else
for k,v in pairs(t) do
self:set(k,v)
end
end
end
--- set the key's value. This key will be appended at the end of the map. <br>
-- If the value is nil, then the key is removed.
-- @param key the key
-- @param val the value
function OrderedMap:set (key,val)
if not self[key] then -- ensure that keys are unique
self._keys:append(key)
elseif val == nil then -- removing a key-value pair
self._keys:remove_value(key)
end
self[key] = val
end
--- return the keys in order.
-- (Not a copy!)
function OrderedMap:keys ()
return self._keys
end
--- return the values in order.
-- this is relatively expensive.
function OrderedMap:values ()
return List(index_by(self,self._keys))
end
--- sort the keys.
function OrderedMap:sort (cmp)
tsort(self._keys,cmp)
end
--- iterate over key-value pairs in order.
function OrderedMap:iter ()
local i = 0
local keys = self._keys
local n,idx = #keys
return function()
i = i + 1
if i > #keys then return nil end
idx = keys[i]
return idx,self[idx]
end
end
function OrderedMap:__tostring ()
local res = {}
for i,v in ipairs(self._keys) do
local val = self[v]
local vs = tostring(val)
if type(val) ~= 'number' then
vs = '"'..vs..'"'
end
res[i] = tostring(v)..'='..vs
end
return '{'..concat(res,',')..'}'
end
local function name_of_type (tp)
local tname = type(tp)
if tname == 'table' then
if rawget(tp,'_class') then
tname = rawget(tp,'_name')
if tname then return tname end
end
return '<table>'
else
return tname
end
end
--- construct a specific TypedList.
-- For example, class.StringList(TypedList,'string')
-- @class table
-- @name TypedList
local TypedList = class(List)
TypedList._name = 'TypedList'
function TypedList._class_init (klass,type)
klass._type = type
klass._name = 'TypedList<'..name_of_type(type)..'>'
end
--- append a value to the list.
-- Will throw an error if the value is not of the correct type.
-- @param val a value of the correct type.
-- @return the list
function TypedList:append (val)
if not is_type(val,self._type) then error ('not a '..name_of_type(self._type)) end
return append(self,val)
end
--- extend the list using another list.
-- @param L a list of the same type.
-- @return the list
function TypedList:extend (L)
if self._class ~= L._class then error ('cannot extend with another List type') end
return extend(self,L)
end
--- return a slice of the list
-- @param i1 start of slice
-- @param i2 end of slice
-- @return a new typed list
-- @see pl.List:slice
function TypedList:slice (i1,i2)
return setmetatable(slice(self,i1,i2),self._class)
end
classx.OrderedMap = OrderedMap
classx.MultiMap = MultiMap
classx.TypedList = TypedList
return classx
| lgpl-3.0 |
n0xus/darkstar | scripts/globals/abilities/pets/frost_breath.lua | 25 | 1248 | ---------------------------------------------------
-- Frost Breath
---------------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------------
function onAbilityCheck(player, target, ability)
return 0,0;
end;
function onPetAbility(target, pet, skill, master)
---------- Deep Breathing ----------
-- 0 for none
-- 1 for first merit
-- 0.25 for each merit after the first
-- TODO: 0.1 per merit for augmented AF2 (10663 *w/ augment*)
local deep = 1;
if (pet:hasStatusEffect(EFFECT_MAGIC_ATK_BOOST) == true) then
deep = deep + 1 + (master:getMerit(MERIT_DEEP_BREATHING)-1)*0.25;
pet:delStatusEffect(EFFECT_MAGIC_ATK_BOOST);
end
local gear = master:getMod(MOD_WYVERN_BREATH)/256; -- Master gear that enhances breath
local dmgmod = MobBreathMove(pet, target, 0.185, pet:getMainLvl()*15, ELE_ICE); -- Works out to (hp/6) + 15, as desired
dmgmod = (dmgmod * (1+gear))*deep;
local dmg = MobFinalAdjustments(dmgmod,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_ICE,MOBPARAM_IGNORE_SHADOWS);
target:delHP(dmg);
return dmg;
end | gpl-3.0 |
ArmanIr/ProFbOt | plugins/bugzilla.lua | 611 | 3983 | do
local BASE_URL = "https://bugzilla.mozilla.org/rest/"
local function bugzilla_login()
local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password
print("accessing " .. url)
local res,code = https.request( url )
local data = json:decode(res)
return data
end
local function bugzilla_check(id)
-- data = bugzilla_login()
local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey
-- print(url)
local res,code = https.request( url )
local data = json:decode(res)
return data
end
local function bugzilla_listopened(email)
local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey
local res,code = https.request( url )
print(res)
local data = json:decode(res)
return data
end
local function run(msg, matches)
local response = ""
if matches[1] == "status" then
local data = bugzilla_check(matches[2])
vardump(data)
if data.error == true then
return "Sorry, API failed with message: " .. data.message
else
response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator
response = response .. "\n Last update: "..data.bugs[1].last_change_time
response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution
response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard
response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1]
print(response)
end
elseif matches[1] == "list" then
local data = bugzilla_listopened(matches[2])
vardump(data)
if data.error == true then
return "Sorry, API failed with message: " .. data.message
else
-- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator
-- response = response .. "\n Last update: "..data.bugs[1].last_change_time
-- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution
-- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard
-- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1]
local total = table.map_length(data.bugs)
print("total bugs: " .. total)
local response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2]
if total > 0 then
response = response .. ": "
for tableKey, bug in pairs(data.bugs) do
response = response .. "\n #" .. bug.id
response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution
response = response .. "\n Whiteboard: " .. bug.whiteboard
response = response .. "\n Summary: " .. bug.summary
end
end
end
end
return response
end
-- (table)
-- [bugs] = (table)
-- [1] = (table)
-- [status] = (string) ASSIGNED
-- [id] = (number) 927704
-- [whiteboard] = (string) [approved][full processed]
-- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/
-- [2] = (table)
-- [status] = (string) ASSIGNED
-- [id] = (number) 1049337
-- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos]
-- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/
-- total bugs: 2
return {
description = "Lookup bugzilla status update",
usage = "/bot bugzilla [bug number]",
patterns = {
"^/bugzilla (status) (.*)$",
"^/bugzilla (list) (.*)$"
},
run = run
}
end | gpl-2.0 |
n0xus/darkstar | scripts/zones/Aht_Urhgan_Whitegate/npcs/Hagakoff.lua | 34 | 1998 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Hagakoff
-- Standard Merchant NPC
-- Partitionally Implemented
-- Difficult Shop Script needed
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
require("scripts/globals/shop");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,HAGAKOFF_SHOP_DIALOG);
stock = {0x400f,15448, -- Katars (Not available if beastmen have the AC.)
0x4010,67760, -- Darksteel Katars
0x4023,45760, -- Patas (Not available if beastmen have the AC.)
0x4040,156, -- Bronze Dagger
0x4042,2030, -- Dagger
0x40a7,776, -- Sapara
0x40a8,4525, -- Scimitar
0x40a9,38800, -- Tulwar (Not available if beastmen have the AC.)
0x4111,6600, -- Tabar
0x4112,124305, -- Darksteel Tabar (Not available if beastmen have the AC.)
0x4140,672, -- Butterfly Axe
0x4141,4550, -- Greataxe (Not available if beastmen have the AC.)
0x4180,344, -- Bronze Zaghnal
0x4182,12540, -- Zaghnal (Not available if beastmen have the AC.)
0x4280,72, -- Ash Club
0x4281,1740, -- Chestnut Club (Not available if beastmen have the AC.)
0x4753,238} -- Angon
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
ozhanf/ozhanf--bot | plugins/qr.lua | 637 | 1730 | --[[
* qr plugin uses:
* - http://goqr.me/api/doc/create-qr-code/
* psykomantis
]]
local function get_hex(str)
local colors = {
red = "f00",
blue = "00f",
green = "0f0",
yellow = "ff0",
purple = "f0f",
white = "fff",
black = "000",
gray = "ccc"
}
for color, value in pairs(colors) do
if color == str then
return value
end
end
return str
end
local function qr(receiver, text, color, bgcolor)
local url = "http://api.qrserver.com/v1/create-qr-code/?"
.."size=600x600" --fixed size otherways it's low detailed
.."&data="..URL.escape(text:trim())
if color then
url = url.."&color="..get_hex(color)
end
if bgcolor then
url = url.."&bgcolor="..get_hex(bgcolor)
end
local response, code, headers = http.request(url)
if code ~= 200 then
return "Oops! Error: " .. code
end
if #response > 0 then
send_photo_from_url(receiver, url)
return
end
return "Oops! Something strange happened :("
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local color
local back
if #matches > 1 then
text = matches[3]
color = matches[2]
back = matches[1]
end
return qr(receiver, text, color, back)
end
return {
description = {"qr code plugin for telegram, given a text it returns the qr code"},
usage = {
"!qr [text]",
'!qr "[background color]" "[data color]" [text]\n'
.."Color through text: red|green|blue|purple|black|white|gray\n"
.."Colors through hex notation: (\"a56729\" is brown)\n"
.."Or colors through decimals: (\"255-192-203\" is pink)"
},
patterns = {
'^!qr "(%w+)" "(%w+)" (.+)$',
"^!qr (.+)$"
},
run = run
} | gpl-2.0 |
rekotc/game-engine-demo | Assets/Scripts/TeapotBrains.lua | 4 | 2835 | --========================================================================
-- TeapotBrains.lua : Base class for teapot brains
--
-- Part of the GameCode4 Application
--
-- GameCode4 is the sample application that encapsulates much of the source code
-- discussed in "Game Coding Complete - 4th Edition" by Mike McShaffry and David
-- "Rez" Graham, published by Charles River Media.
-- ISBN-10: 1133776574 | ISBN-13: 978-1133776574
--
-- If this source code has found it's way to you, and you think it has helped you
-- in any way, do the authors a favor and buy a new copy of the book - there are
-- detailed explanations in it that compliment this code well. Buy a copy at Amazon.com
-- by clicking here:
-- http://www.amazon.com/gp/product/1133776574/ref=olp_product_details?ie=UTF8&me=&seller=
--
-- There's a companion web site at http://www.mcshaffry.com/GameCode/
--
-- The source code is managed and maintained through Google Code:
-- http://code.google.com/p/gamecode4/
--
-- (c) Copyright 2012 Michael L. McShaffry and David Graham
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser GPL v3
-- as published by the Free Software Foundation.
--
-- 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
-- http://www.gnu.org/licenses/lgpl-3.0.txt for more details.
--
-- You should have received a copy of the GNU Lesser GPL v3
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--
--========================================================================
require("Scripts\\TeapotStates.lua");
-----------------------------------------------------------------------------------------------------------------------
-- TeapotBrain base class
-- This is the base class for teapot brains. It defines the interface for all decision making that teapots can do.
-- the Think() function is called from the TeapotStateMachine.UpdateState() function whenever a decision needs to be
-- made. It returns a new state for the teapot. Note how the base class throws an error. This is the closest we can
-- get to a pure virtual function; it defines the interface and requires subclasses to define the implementation.
-- It's not perfect, but it beats the generic "attempting to call nil value" error.
-----------------------------------------------------------------------------------------------------------------------
TeapotBrain = class(nil,
{
_teapot = nil,
});
function TeapotBrain:Init()
return true;
end
function TeapotBrain:Think()
error("Calling unimplemented base class version of TeapotBrain.Think()");
end
| lgpl-3.0 |
n0xus/darkstar | scripts/zones/Yuhtunga_Jungle/npcs/Luck_Rune.lua | 34 | 1080 | -----------------------------------
-- Area: Yuhtunga Jungle
-- NPC: Luck Rune
-- Involved in Quest: Mhaura Fortune
-- @pos -95.486 11.188 418.153 123
-----------------------------------
package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil;
-------------------------------------
require("scripts/zones/Yuhtunga_Jungle/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(NOTHING_OUT_OF_THE_ORDINARY);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
n0xus/darkstar | scripts/zones/Dangruf_Wadi/Zone.lua | 17 | 3020 | -----------------------------------
--
-- Zone: Dangruf_Wadi (191)
--
-----------------------------------
package.loaded["scripts/zones/Dangruf_Wadi/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/status");
require("scripts/globals/zone");
require("scripts/zones/Dangruf_Wadi/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
local tomes = {17559931,17559932};
SetGroundsTome(tomes);
zone:registerRegion(1, -133.5, 2, 132.6, -132.7, 4, 133.8); -- I-8 Geyser
zone:registerRegion(2, -213.5, 2, 92.6, -212.7, 4, 94.0); -- H-8 Geyser
zone:registerRegion(3, -67.3, 2, 532.8, -66.3, 4, 534.0); -- J-3 Geyser
UpdateTreasureSpawnPoint(17559920);
end;
-----------------------------------
-- onConquestUpdate
-----------------------------------
function onConquestUpdate(zone, updatetype)
local players = zone:getPlayers();
for name, player in pairs(players) do
conquestUpdate(zone, player, updatetype, CONQUEST_BASE);
end
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then
player:setPos(-4.025,-4.449,0.016,112);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
switch (region:GetRegionID()): caseof
{
[1] = function (x)
player:startEvent(0x000A);
SendEntityVisualPacket(17559897, "kkj2");
end,
[2] = function (x)
player:startEvent(0x000B);
SendEntityVisualPacket(17559898, "kkj1");
end,
[3] = function (x)
player:startEvent(0x000C);
SendEntityVisualPacket(17559899, "kkj3");
end,
}
if (player:hasKeyItem(BLUE_ACIDITY_TESTER)) then
player:delKeyItem(BLUE_ACIDITY_TESTER);
player:addKeyItem(RED_ACIDITY_TESTER);
end
end;
-----------------------------------
-- onRegionLeave
-----------------------------------
function onRegionLeave(player,region)
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
function onZoneWeatherChange(weather)
local qm2 = GetNPCByID(17559907); -- Quest: An Empty Vessel
if (weather == WEATHER_NONE or weather == WEATHER_SUNSHINE) then
qm2:setStatus(STATUS_NORMAL);
else
qm2:setStatus(STATUS_DISAPPEAR);
end
end; | gpl-3.0 |
davymai/CN-QulightUI | Interface/AddOns/DBM-Firelands/FandralStaghelm.lua | 1 | 8089 | local mod = DBM:NewMod(197, "DBM-Firelands", nil, 78)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 142 $"):sub(12, -3))
mod:SetCreatureID(52571)
mod:SetEncounterID(1185)
mod:DisableEEKillDetection()
mod:SetZone()
mod:SetUsedIcons(8)
mod:SetModelSound("Sound\\Creature\\FandralFlameDruid\\VO_FL_FANDRAL_GATE_INTRO_01.wav", "Sound\\Creature\\FandralFlameDruid\\VO_FL_FANDRAL_KILL_05.wav")
--Long: Well, well. I admire your tenacity. Baleroc stood guard over this keep for a thousand mortal lifetimes.
--Short: *Laughs, Burn
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_AURA_APPLIED 98374 98379 97238 97235 98535 98584 98450",
"SPELL_AURA_APPLIED_DOSE 97238 97235 98584",
"SPELL_AURA_REMOVED 98450",
"SPELL_CAST_START 98451",
"SPELL_CAST_SUCCESS 98476"
)
local warnAdrenaline = mod:NewStackAnnounce(97238, 3)
local warnFury = mod:NewStackAnnounce(97235, 3)
local warnLeapingFlames = mod:NewTargetAnnounce(98476, 3)
local warnOrbs = mod:NewCastAnnounce(98451, 4)
local yellLeapingFlames = mod:NewYell(98476)
local specWarnLeapingFlamesCast = mod:NewSpecialWarningYou(98476)
local specWarnLeapingFlamesNear = mod:NewSpecialWarningClose(98476)
local specWarnLeapingFlames = mod:NewSpecialWarningMove(98535)
local specWarnSearingSeed = mod:NewSpecialWarningMoveAway(98450)
local specWarnOrb = mod:NewSpecialWarningStack(98584, true, 4)
local timerOrbActive = mod:NewBuffActiveTimer(64, 98451)
local timerOrb = mod:NewBuffFadesTimer(6, 98584)
local timerSearingSeed = mod:NewBuffFadesTimer(60, 98450)
local timerNextSpecial = mod:NewTimer(4, "timerNextSpecial", 97238)--This one stays localized because it's 1 timer used for two abilities
local berserkTimer = mod:NewBerserkTimer(600)
mod:AddBoolOption("RangeFrameSeeds", true)
mod:AddBoolOption("RangeFrameCat", false)--Diff options for each ability cause seeds strat is pretty universal, don't blow up raid, but leaps may or may not use a stack strategy, plus melee will never want it on by default.
mod:AddBoolOption("IconOnLeapingFlames", false)
mod:AddBoolOption("LeapArrow", true)
local abilityCount = 0
local recentlyJumped = false
local kitty = false
local targetScansDone = 0
local leap = GetSpellInfo(98535)
local swipe = GetSpellInfo(98474)
local seedsDebuff = GetSpellInfo(98450)
local abilityTimers = {
[0] = 17.3,--Still The same baseline.
[1] = 14.4,--Everything here onward nerfed in 4.3
[2] = 12,
[3] = 10.9,
[4] = 9.6,
[5] = 8.4,
[6] = 8.4,
[7] = 7.2,
[8] = 7.2,--Everyting up to here confirmed by MANY logs
[9] = 6.0,
[10]= 6.0,
[11]= 6.0,
[12]= 6.0,
[13]= 4.9,
[14]= 4.9,
[15]= 4.9,
[16]= 4.9,
[17]= 4.9,
}
--caps to 3.7 at 18 stacks.
local function clearLeapWarned()
recentlyJumped = false
end
local function isTank(unit)
-- 1. check blizzard tanks first
-- 2. check blizzard roles second
-- 3. check boss1's highest threat target
if GetPartyAssignment("MAINTANK", unit, 1) then
return true
end
if UnitGroupRolesAssigned(unit) == "TANK" then
return true
end
if UnitExists("boss1target") and UnitDetailedThreatSituation(unit, "boss1") then
return true
end
return false
end
function mod:LeapingFlamesTarget(targetname)
warnLeapingFlames:Show(targetname)
if self.Options.IconOnLeapingFlames then
self:SetIcon(targetname, 8, 5) -- 5seconds should be long enough to notice
end
if targetname == UnitName("player") then
recentlyJumped = true--Anti Spam
specWarnLeapingFlamesCast:Show()
yellLeapingFlames:Yell()
self:Schedule(4, clearLeapWarned)--So you don't get move warning too from debuff.
else
local uId = DBM:GetRaidUnitId(targetname)
if uId then
local inRange = DBM.RangeCheck:GetDistance("player", uId)
if inRange and inRange < 13 then
recentlyJumped = true--Anti Spam
specWarnLeapingFlamesNear:Show(targetname)
if self.Options.LeapArrow then
local x, y = UnitPosition(uId)
DBM.Arrow:ShowRunAway(x, y, 12, 5)
end
self:Schedule(2.5, clearLeapWarned)--Clear it a little faster for near warnings though, cause you definitely don't need 4 seconds to move if it wasn't even on YOU.
end
end
end
end
function mod:TargetScanner(ScansDone)
targetScansDone = targetScansDone + 1
local targetname, uId = self:GetBossTarget(52571)
if UnitExists(targetname) then--Better way to check if target exists and prevent nil errors at same time, without stopping scans from starting still. so even if target is nil, we stil do more checks instead of just blowing off a warning.
if isTank(uId) and not ScansDone then--He's targeting his highest threat target.
if targetScansDone < 16 then--Make sure no infinite loop.
self:ScheduleMethod(0.05, "TargetScanner")--Check multiple times to be sure it's not on something other then tank.
else
self:TargetScanner(true)--It's still on tank, force true isTank and activate else rule and warn target is on tank.
end
else--He's not targeting highest threat target (or isTank was set to true after 16 scans) so this has to be right target.
self:UnscheduleMethod("TargetScanner")--Unschedule all checks just to be sure none are running, we are done.
self:LeapingFlamesTarget(targetname)
end
else--target was nil, lets schedule a rescan here too.
if targetScansDone < 16 then--Make sure not to infinite loop here as well.
self:ScheduleMethod(0.05, "TargetScanner")
end
end
end
function mod:OnCombatStart(delay)
berserkTimer:Start(-delay)
abilityCount = 0
kitty = false
targetScansDone = 0
end
function mod:OnCombatEnd()
if self.Options.RangeFrameSeeds or self.Options.RangeFrameCat then
DBM.RangeCheck:Hide()
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 98374 then -- Cat Form
kitty = true
abilityCount = 0
timerNextSpecial:Cancel()
timerNextSpecial:Start(abilityTimers[abilityCount], leap, abilityCount+1)
if self.Options.RangeFrameCat then
DBM.RangeCheck:Show(10)
end
elseif spellId == 98379 then -- Scorpion Form
kitty = false
abilityCount = 0
timerNextSpecial:Cancel()
timerNextSpecial:Start(abilityTimers[abilityCount], swipe, abilityCount+1)
if self.Options.RangeFrameCat and not UnitDebuff("player", seedsDebuff) then--Only hide range finder if you do not have seed.
DBM.RangeCheck:Hide()
end
elseif spellId == 97238 then
abilityCount = (args.amount or 1)--This should change your ability account to his current stack, which is disconnect friendly.
warnAdrenaline:Show(args.destName, args.amount or 1)
if kitty then
timerNextSpecial:Start(abilityTimers[abilityCount] or 3.7, leap, abilityCount+1)
else
timerNextSpecial:Start(abilityTimers[abilityCount] or 3.7, swipe, abilityCount+1)
end
elseif spellId == 97235 then
warnFury:Show(args.destName, args.amount or 1)
elseif spellId == 98535 and args:IsPlayer() and not recentlyJumped then
specWarnLeapingFlames:Show()--You stood in the fire!
elseif spellId == 98584 and args:IsPlayer() then
if (args.amount or 1) >= 4 then
specWarnOrb:Show(args.amount)--You stood in the fire!
end
timerOrb:Start()
elseif spellId == 98450 and args:IsPlayer() then
local _, _, _, _, _, duration, expires, _, _ = UnitDebuff("player", args.spellName)--Find out what our specific seed timer is
specWarnSearingSeed:Schedule(expires - GetTime() - 5) -- Show "move away" warning 5secs before explode
timerSearingSeed:Start(expires-GetTime())
if self.Options.RangeFrameSeeds then
DBM.RangeCheck:Show(12)
end
end
end
mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:SPELL_AURA_REMOVED(args)
local spellId = args.spellId
if spellId == 98450 and args:IsPlayer() then
specWarnSearingSeed:Cancel()
timerSearingSeed:Cancel()
if self.Options.RangeFrameSeeds then
DBM.RangeCheck:Hide()
end
end
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 98451 then
warnOrbs:Show()
timerOrbActive:Start()
end
end
function mod:SPELL_CAST_SUCCESS(args)
local spellId = args.spellId
if spellId == 98476 then
targetScansDone = 0
self:TargetScanner()
end
end
| gpl-2.0 |
n0xus/darkstar | scripts/zones/Xarcabard/npcs/Heavy_Bear_IM.lua | 30 | 3041 | -----------------------------------
-- Area: Xarcabard
-- NPC: Heavy Bear, I.M.
-- Type: Border Conquest Guards
-- @pos -133.678 -22.517 112.224 112
-----------------------------------
package.loaded["scripts/zones/Xarcabard/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Xarcabard/TextIDs");
local guardnation = BASTOK; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = VALDEAUNIA;
local csid = 0x7ff8;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(EFFECT_SIGIL);
player:delStatusEffect(EFFECT_SANCTION);
player:delStatusEffect(EFFECT_SIGNET);
player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
goblinor/BomBus1 | plugins/stats.lua | 15 | 4017 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(receiver, chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document(receiver,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'Users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'devpoint' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /devpoint ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' or msg.to.type == 'channel' then
local receiver = get_receiver(msg)
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(receiver, chat_id)
else
return
end
end
if matches[2] == "devpoint" then -- Put everything you like :)
if not is_admin1(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin1(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[#!/]([Ss]tats)$",
"^[#!/]([Ss]tatslist)$",
"^[#!/]([Ss]tats) (group) (%d+)",
"^[#!/]([Ss]tats) (devpoint)",
"^[#!/]([Dd]evpoint)"
},
run = run
}
end
| gpl-2.0 |
rigeirani/bib | plugins/stats.lua | 2 | 3997 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'teleseed' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' then
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(chat_id)
else
return
end
end
if matches[2] == "teleseed" then -- Put everything you like :)
if not is_admin(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[!/]([Ss]tats)$",
"^[!/]([Ss]tatslist)$",
"^[!/]([Ss]tats) (group) (%d+)",
"^[!/]([Ss]tats) (lantan)",-- Put everything you like :)
"^[!/]([Ll])antan"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
n0xus/darkstar | scripts/globals/abilities/dark_maneuver.lua | 54 | 1332 | -----------------------------------
-- Ability: Dark Maneuver
-- Enhances the effect of dark attachments. Must have animator equipped.
-- Obtained: Puppetmaster level 1
-- Recast Time: 10 seconds (shared with all maneuvers)
-- Duration: 1 minute
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if (player:getWeaponSubSkillType(SLOT_RANGED) == 10 and
not player:hasStatusEffect(EFFECT_OVERLOAD)) then
return 0,0;
else
return 71,0;
end
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
local burden = 10;
if (target:getMP() < target:getPet():getMP()) then
burden = 15;
end
local overload = target:addBurden(ELE_DARK-1, burden);
if (overload ~= 0) then
target:removeAllManeuvers();
target:addStatusEffect(EFFECT_OVERLOAD, 0, 0, overload);
else
if (target:getActiveManeuvers() == 3) then
target:removeOldestManeuver();
end
target:addStatusEffect(EFFECT_DARK_MANEUVER, 0, 0, 60);
end
return EFFECT_DARK_MANEUVER;
end; | gpl-3.0 |
n0xus/darkstar | scripts/zones/Northern_San_dOria/npcs/Matildie.lua | 34 | 1696 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Matildie
-- Adventurer's Assistant
-------------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:getItemCount() == 1 and trade:hasItemQty(0x218,1) == true) then
player:startEvent(0x277);
player:addGil(GIL_RATE*50);
player:tradeComplete();
end
-- "Flyers for Regine" conditional script
FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE);
if (FlyerForRegine == 1) then
count = trade:getItemCount();
MagicFlyer = trade:hasItemQty(532,1);
if (MagicFlyer == true and count == 1) then
player:messageSpecial(FLYER_REFUSED);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x24B);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x277) then
player:messageSpecial(GIL_OBTAINED,GIL_RATE*50);
end
end;
| gpl-3.0 |
n0xus/darkstar | scripts/zones/The_Eldieme_Necropolis/npcs/_5f4.lua | 34 | 1106 | -----------------------------------
-- Area: The Eldieme Necropolis
-- NPC: Titan's Gate
-- @pos 180 -34 -15 195
-----------------------------------
package.loaded["scripts/zones/The_Eldieme_Necropolis/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/The_Eldieme_Necropolis/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 9) then
player:messageSpecial(SOLID_STONE);
end
return 0;
end;
--
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
n0xus/darkstar | scripts/zones/Riverne-Site_A01/npcs/_0u3.lua | 17 | 1341 | -----------------------------------
-- Area: Riverne Site #A01
-- NPC: Unstable Displacement
-----------------------------------
package.loaded["scripts/zones/Riverne-Site_A01/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Riverne-Site_A01/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(1691,1) and trade:getItemCount() == 1) then -- Trade Giant Scale
player:tradeComplete();
npc:openDoor(RIVERNE_PORTERS);
player:messageSpecial(SD_HAS_GROWN);
end
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 8) then
player:startEvent(0x13);
else
player:messageSpecial(SD_VERY_SMALL);
end;
return 1;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
n0xus/darkstar | scripts/zones/Northern_San_dOria/npcs/Olbergieut.lua | 17 | 2258 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Olbergieut
-- Type: Quest NPC
-- @zone 231
-- @pos 91 0 121
--
-- Starts and Finishes Quest: Gates of Paradise
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/keyitems");
require("scripts/globals/quests");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
gates = player:getQuestStatus(SANDORIA,GATES_TO_PARADISE);
if (player:hasKeyItem(SCRIPTURE_OF_WATER) == true) then
player:startEvent(0x026c);
elseif (gates == QUEST_ACCEPTED) then
player:showText(npc, OLBERGIEUT_DIALOG, SCRIPTURE_OF_WIND);
elseif (player:getFameLevel(SANDORIA) >= 2 and gates == QUEST_AVAILABLE) then
player:startEvent(0x026b);
else
player:startEvent(0x0264);
end;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x026b and option == 0) then
player:addQuest(SANDORIA, GATES_TO_PARADISE);
player:addKeyItem(SCRIPTURE_OF_WIND);
player:messageSpecial(KEYITEM_OBTAINED, SCRIPTURE_OF_WIND);
elseif (csid == 0x026c) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 13584);
else
player:completeQuest(SANDORIA,GATES_TO_PARADISE);
player:addFame(SANDORIA,SAN_FAME*30);
player:addTitle(THE_PIOUS_ONE);
player:delKeyItem(SCRIPTURE_OF_WATER);
player:addItem(13584,1);
player:messageSpecial(ITEM_OBTAINED,13584);
end;
end;
end;
| gpl-3.0 |
n0xus/darkstar | scripts/globals/items/roast_pipira.lua | 35 | 1575 | -----------------------------------------
-- ID: 4538
-- Item: roast_pipira
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Dexterity 3
-- Mind -1
-- Attack % 14
-- Attack Cap 85
-- Ranged ATT % 14
-- Ranged ATT Cap 85
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,4538);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 3);
target:addMod(MOD_MND, -1);
target:addMod(MOD_FOOD_ATTP, 14);
target:addMod(MOD_FOOD_ATT_CAP, 85);
target:addMod(MOD_FOOD_RATTP, 14);
target:addMod(MOD_FOOD_RATT_CAP, 85);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 3);
target:delMod(MOD_MND, -1);
target:delMod(MOD_FOOD_ATTP, 14);
target:delMod(MOD_FOOD_ATT_CAP, 85);
target:delMod(MOD_FOOD_RATTP, 14);
target:delMod(MOD_FOOD_RATT_CAP, 85);
end;
| gpl-3.0 |
realglobe-Inc/edo-auth | lib/erro.lua | 1 | 2248 | -- Copyright 2015 realglobe, Inc.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
local cjson = require("cjson.safe")
local function respond_html(params)
local status = ngx.HTTP_INTERNAL_SERVER_ERROR
local message = "error occurred"
local others = ""
if params.status then
status = params.status
params.status = nil
end
if params.message then
message = params.message
params.message = nil
end
for k, v in pairs(params) do
others = others .. [[<b>]] .. k .. [[:</b> ]] .. v .. [[<br/>]]
end
local body = [[
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Error</title>
</head>
<body>
<h1>]]
.. status ..
[[</h1>
<p>
<b>error:</b> ]]
.. message ..
[[<br/>]]
.. others ..
[[</p>
</body>
</html>]];
-- レスポンスの中身を準備できた。
ngx.log(ngx.ERR, "respond error: " .. status .. " " .. message)
ngx.header["Content-Type"] = "text/html"
ngx.status = status
ngx.print(body)
return ngx.exit(status)
end
local function respond_json(params)
local status = params.status or ngx.HTTP_INTERNAL_SERVER_ERROR
local message = params.message or "error occurred"
local body, err = cjson.encode(params)
if err then
ngx.log(ngx.ERR, err)
body = '{"status"=' .. status .. '}'
end
-- レスポンスの中身を準備できた。
ngx.log(ngx.ERR, "respond error: " .. status .. " " .. message)
ngx.header["Content-Type"] = "application/json"
ngx.status = status
ngx.print(body)
return ngx.exit(status)
end
return {
respond_html = respond_html,
respond_json = respond_json,
}
| apache-2.0 |
n0xus/darkstar | scripts/zones/Meriphataud_Mountains/npcs/Mushosho.lua | 17 | 1888 | -----------------------------------
-- Area: Meriphataud Mountains
-- NPC: Mushosho
-- Type: Outpost Vendor
-- @pos -290 16 415 119
-----------------------------------
package.loaded["scripts/zones/Meriphataud_Mountains/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Meriphataud_Mountains/TextIDs");
local region = ARAGONEU;
local csid = 0x7ff4;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local owner = GetRegionOwner(region);
local arg1 = getArg1(owner,player);
if (owner == player:getNation()) then
nation = 1;
elseif (arg1 < 1792) then
nation = 2;
else
nation = 0;
end
player:startEvent(csid,nation,OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP(),0,0,0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
player:updateEvent(player:getGil(),OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP());
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
if (option == 1) then
ShowOPVendorShop(player);
elseif (option == 2) then
if (player:delGil(OP_TeleFee(player,region))) then
toHomeNation(player);
end
elseif (option == 6) then
player:delCP(OP_TeleFee(player,region));
toHomeNation(player);
end
end; | gpl-3.0 |
davymai/CN-QulightUI | Interface/AddOns/QulightUI/Config/configui.lua | 1 | 1703 | local myPlayerRealm = GetRealmName()
local myPlayerName = UnitName("player")
if not IsAddOnLoaded("Qulight_ConfigUI") then return end
if not QulightConfigAll then QulightConfigAll = {} end
if (QulightConfigAll[myPlayerRealm] == nil) then QulightConfigAll[myPlayerRealm] = {} end
if (QulightConfigAll[myPlayerRealm][myPlayerName] == nil) then QulightConfigAll[myPlayerRealm][myPlayerName] = false end
if QulightConfigAll[myPlayerRealm][myPlayerName] == true and not QulightConfig then return end
if QulightConfigAll[myPlayerRealm][myPlayerName] == false and not QulightConfigSettings then return end
if QulightConfigAll[myPlayerRealm][myPlayerName] == true then
for group,options in pairs(QulightConfig) do
if Qulight[group] then
local count = 0
for option,value in pairs(options) do
if Qulight[group][option] ~= nil then
if Qulight[group][option] == value then
QulightConfig[group][option] = nil
else
count = count+1
Qulight[group][option] = value
end
end
end
-- keeps QulightConfig clean and small
if count == 0 then QulightConfig[group] = nil end
else
QulightConfig[group] = nil
end
end
else
for group,options in pairs(QulightConfigSettings) do
if Qulight[group] then
local count = 0
for option,value in pairs(options) do
if Qulight[group][option] ~= nil then
if Qulight[group][option] == value then
QulightConfigSettings[group][option] = nil
else
count = count+1
Qulight[group][option] = value
end
end
end
-- keeps QulightConfig clean and small
if count == 0 then QulightConfigSettings[group] = nil end
else
QulightConfigSettings[group] = nil
end
end
end
| gpl-2.0 |
n0xus/darkstar | scripts/zones/Mount_Zhayolm/npcs/Runic_Portal.lua | 17 | 1862 | -----------------------------------
-- Area: Mount Zhayolm
-- NPC: Runic Portal
-- Mount Zhayolm Teleporter Back to Aht Urgan Whitegate
-- @pos 688 -23 349 61
-----------------------------------
package.loaded["scripts/zones/Mount_Zhayolm/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/besieged");
require("scripts/globals/teleports");
require("scripts/globals/missions");
require("scripts/zones/Mount_Zhayolm/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(TOAU)== IMMORTAL_SENTRIES) then
if (player:getVar("TOAUM2") == 1) then
player:startEvent(0x006F);
else
player:startEvent(0x006D);
end
elseif (player:getCurrentMission(TOAU) > IMMORTAL_SENTRIES) then
if (hasRunicPortal(player,4) == 1) then
player:startEvent(0x006D);
else
player:startEvent(0x006F);
end
else
player:messageSpecial(RESPONSE);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x006F and option == 1) then
if (player:getVar("TOAUM2") == 1) then
player:setVar("TOAUM2",2);
end
player:addNationTeleport(AHTURHGAN,16);
toChamberOfPassage(player);
elseif (csid == 0x006D and option == 1) then
toChamberOfPassage(player);
end
end; | gpl-3.0 |
xxlxx20/DEVKEEPER | plugins/addword.lua | 2 | 3042 | --[[
----- (منع والغاء منع الكلمات)
---admin @llX8Xll
--]]
local function addword(msg, name)
local hash = 'chat:'..msg.to.id..':badword'
redis:hset(hash, name, 'newword')
return "تــٰم بالفعـــل ☑️ اضافــةة كلمـٰه 🗓 جديده آلى قائمــةة المنـٰـع❌♥️❗️\n>"..name
end
local function get_variables_hash(msg)
return 'chat:'..msg.to.id..':badword'
end
local function list_variablesbad(msg)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = 'قائمـــٰة📝 منع الكلمــٰات المحظـٰٰـوره❌❤️❗️ :\n\n'
for i=1, #names do
text = text..'> '..names[i]..'\n'
end
return text
else
return
end
end
function clear_commandbad(msg, var_name)
--Save on redis
local hash = get_variables_hash(msg)
redis:del(hash, var_name)
return 'تـٰٰم بالفعــــــل ☑️ تنظيـٰــــٰف قائمــــة 📝 المنـع في المجموعـــٰةة♥️‼️'
end
local function list_variables2(msg, value)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = ''
for i=1, #names do
if string.match(value, names[i]) and not is_momod(msg) then
if msg.to.type == 'channel' then
delete_msg(msg.id,ok_cb,false)
else
kick_user(msg.from.id, msg.to.id)
end
return
end
--text = text..names[i]..'\n'
end
end
end
local function get_valuebad(msg, var_name)
local hash = get_variables_hash(msg)
if hash then
local value = redis:hget(hash, var_name)
if not value then
return
else
return value
end
end
end
function clear_commandsbad(msg, cmd_name)
--Save on redis
local hash = get_variables_hash(msg)
redis:hdel(hash, cmd_name)
return ''..cmd_name..' بالفعـــــل ☑️ تم الغائها 👍 من قائمـٰـٰٰـةة 📝 المنــع💛‼️ '
end
local function run(msg, matches)
if matches[2] == 'منع' then
if not is_momod(msg) then
return 'للمشرفيـــــــن 🕵🏻 فـقــط عزيـــزي♥️❗️'
end
local name = string.sub(matches[3], 1, 50)
local text = addword(msg, name)
return text
end
if matches[2] == 'قائمه المنع' then
return list_variablesbad(msg)
elseif matches[2] == 'تنظيف قائمه المنع' then
if not is_momod(msg) then return '_|_' end
local asd = '1'
return clear_commandbad(msg, asd)
elseif matches[2] == 'الغاء منع' or matches[2] == 'rw' then
if not is_momod(msg) then return '_|_' end
return clear_commandsbad(msg, matches[3])
else
local name = user_print_name(msg.from)
return list_variables2(msg, matches[1])
end
end
return {
patterns = {
"^()(rw) (.*)$",
"^()(منع) (.*)$",
"^()(الغاء منع) (.*)$",
"^()(قائمه المنع)$",
"^()(تنظيف قائمه المنع)$",
"^(.+)$",
},
run = run
} | gpl-2.0 |
n0xus/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Icon_Prototype.lua | 16 | 1390 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Icon Prototype
-----------------------------------
package.loaded["scripts/zones/Dynamis-Xarcabard/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/dynamis");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobInitialize Action
-----------------------------------
function onMobInitialize(mob,target)
end;
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
local mobID = mob:getID();
-- Time Bonus: 043
if (mobID == 17330814 and mob:isInBattlefieldList() == false) then
killer:addTimeToDynamis(30);
mob:addInBattlefieldList();
-- HP Bonus: 052
elseif (mobID == 17330533) then
killer:restoreHP(2000);
killer:messageBasic(024,(killer:getMaxHP()-killer:getHP()));
-- HP Bonus: 073
elseif (mobID == 17330843) then
killer:restoreMP(2000);
killer:messageBasic(025,(killer:getMaxMP()-killer:getMP()));
end
end; | gpl-3.0 |
n0xus/darkstar | scripts/globals/items/slice_of_juicy_mutton.lua | 35 | 1397 | -----------------------------------------
-- ID: 4335
-- Item: slice_of_juicy_mutton
-- Food Effect: 240Min, All Races
-----------------------------------------
-- Strength 3
-- Intelligence -1
-- Attack % 27
-- Attack Cap 35
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,4335);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 3);
target:addMod(MOD_INT, -1);
target:addMod(MOD_FOOD_ATTP, 27);
target:addMod(MOD_FOOD_ATT_CAP, 35);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 3);
target:delMod(MOD_INT, -1);
target:delMod(MOD_FOOD_ATTP, 27);
target:delMod(MOD_FOOD_ATT_CAP, 35);
end;
| gpl-3.0 |
Thadah/NSPlugins | crafting/entities/weapons/hl2_m_wrench.lua | 2 | 2134 | if (SERVER) then
SWEP.Weight = 10
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
end
if ( CLIENT ) then
SWEP.PrintName = "Wrench"
SWEP.Author = "Black Tea"
SWEP.Instructions = "Left click to attack."
SWEP.ShowWorldModel = false
SWEP.ViewModelBoneMods = {
["v_weapon.Knife_Handle"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Clavicle"] = { scale = Vector(.1, .1, .1), pos = Vector(300, -300, 0), angle = Angle(0, 0, 0) }
}
SWEP.VElements = {
["weapon"] = { type = "Model", model = "models/warz/melee/wrench.mdl", bone = "v_weapon.Knife_Handle", rel = "", pos = Vector(0, 0, 5.181), angle = Angle(-3.069, 180, 3.068), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["weapon"] = { type = "Model", model = "models/warz/melee/wrench.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.181, 1, -3), angle = Angle(180, 90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
end
SWEP.Base = "hl2_melee"
SWEP.Category = "Black Tea"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.UseHands = true
SWEP.Slot = 1 // Slot in the weapon selection menu
SWEP.SlotPos = 1 // Position in the slot
SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl"
SWEP.WorldModel = "models/weapons/w_crowbar.mdl"
SWEP.HoldType = "melee"
SWEP.Primary.Automatic = true
SWEP.Primary.Damage = 6.6
SWEP.Primary.Angle = -.3
SWEP.Primary.Spread = .2
SWEP.ReOriginPos = Vector(3, -4, 12.267)
SWEP.ReOriginAng = Vector(-5.22, 12, 60.638)
SWEP.LowerAngles = Angle( -10, 12, 0 )-- nut
SWEP.SwingPos = Vector(5, -6, 11)
SWEP.SwingAng = Vector(20.85, 0, 60)
SWEP.DisoriginPos = Vector(-16.143, 20.26, 4.015)
SWEP.DisoriginAng = Vector(-90, 50.165, 60.354)
function SWEP:Impact( trcTrace )
self.Owner:EmitSound( Format( "physics/metal/weapon_impact_hard%d.wav", math.random( 1, 3 ) ), 80, math.random( 150, 170 ) )
end
| gpl-3.0 |
peete-q/lua-socket | samples/lpr.lua | 59 | 1574 | local lp = require("socket.lp")
local function usage()
print('\nUsage: lua lpr.lua [filename] [keyword=val...]\n')
print('Valid keywords are :')
print(
' host=remote host or IP address (default "localhost")\n' ..
' queue=remote queue or printer name (default "printer")\n' ..
' port=remote port number (default 515)\n' ..
' user=sending user name\n' ..
' format=["binary" | "text" | "ps" | "pr" | "fortran"] (default "binary")\n' ..
' banner=true|false\n' ..
' indent=number of columns to indent\n' ..
' mail=email of address to notify when print is complete\n' ..
' title=title to use for "pr" format\n' ..
' width=width for "text" or "pr" formats\n' ..
' class=\n' ..
' job=\n' ..
' name=\n' ..
' localbind=true|false\n'
)
return nil
end
if not arg or not arg[1] then
return usage()
end
do
local opt = {}
local pat = "[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)"
for i = 2, table.getn(arg), 1 do
string.gsub(arg[i], pat, function(name, value) opt[name] = value end)
end
if not arg[2] then
return usage()
end
if arg[1] ~= "query" then
opt.file = arg[1]
r,e=lp.send(opt)
io.stdout:write(tostring(r or e),'\n')
else
r,e=lp.query(opt)
io.stdout:write(tostring(r or e), '\n')
end
end
-- trivial tests
--lua lp.lua lp.lua queue=default host=localhost
--lua lp.lua lp.lua queue=default host=localhost format=binary localbind=1
--lua lp.lua query queue=default host=localhost
| mit |
n0xus/darkstar | scripts/zones/Windurst_Waters/npcs/Qhum_Knaidjn.lua | 17 | 2806 | -----------------------------------
-- Area: Windurst Waters
-- NPC: Qhum_Knaidjn
-- Type: Guildworker's Union Representative
-- @zone: 238
-- @pos -112.561 -2 55.205
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil;
require("scripts/globals/keyitems");
require("scripts/globals/crafting");
require("scripts/zones/Windurst_Waters/TextIDs");
local keyitems = {
[0] = {
id = RAW_FISH_HANDLING,
rank = 3,
cost = 30000
},
[1] = {
id = NOODLE_KNEADING,
rank = 3,
cost = 30000
},
[2] = {
id = PATISSIER,
rank = 3,
cost = 8000
},
[3] = {
id = STEWPOT_MASTERY,
rank = 3,
cost = 30000
},
[4] = {
id = WAY_OF_THE_CULINARIAN,
rank = 9,
cost = 20000
}
};
local items = {
[2] = {
id = 15451, -- Culinarian's Belt
rank = 4,
cost = 10000
},
[3] = {
id = 13948, -- Chef's Hat
rank = 5,
cost = 70000
},
[4] = {
id = 14399, -- Culinarian's Apron
rank = 7,
cost = 100000
},
[5] = {
id = 137, -- Cordon Bleu Cooking Set
rank = 9,
cost = 150000
},
[6] = {
id = 338, -- Culinarian's Signboard
rank = 9,
cost = 200000
},
[7] = {
id = 15826, -- Chef's Ring
rank = 6,
cost = 80000
},
[8] = {
id = 3667, -- Brass Crock
rank = 7,
cost = 50000
},
[9] = {
id = 3328, -- Culinarian's Emblem
rank = 9,
cost = 15000
}
};
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
unionRepresentativeTrade(player, npc, trade, 0x2729, 8);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
unionRepresentativeTrigger(player, 8, 0x2728, "guild_cooking", keyitems);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,target)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x2728) then
unionRepresentativeTriggerFinish(player, option, target, 8, "guild_cooking", keyitems, items);
elseif (csid == 0x2729) then
player:messageSpecial(GP_OBTAINED, option);
end
end;
| gpl-3.0 |
n0xus/darkstar | scripts/zones/Metalworks/npcs/HomePoint#2.lua | 19 | 1185 | -----------------------------------
-- Area: Metalworks
-- NPC: HomePoint#2
-- @pos: -78 2 2 237
-----------------------------------
package.loaded["scripts/zones/Metalworks/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/zones/Metalworks/TextIDs");
require("scripts/globals/homepoint");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
homepointMenu( player, 0x21fd, 102);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x21fd) then
if (option == 1) then
player:setHomePoint();
player:messageSpecial(HOMEPOINT_SET);
else
hpTeleport( player, option);
end
end
end; | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.