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
ricker75/Global-Server
data/npc/scripts/Elane.lua
2
6719
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then if player:getStorageValue(12055) < 1 then npcHandler:say("Oh, my winged tiara? Those are traditionally awarded after having completed a difficult {task} for our guild, only to female aspirants though. Male warriors will receive a hooded cloak.", player) npcHandler.topic[cid] = 1 end elseif msgcontains(msg, "Task") then if npcHandler.topic[cid] == 1 then npcHandler:say("So you are saying that you would like to prove that you deserve to wear such a hooded cloak?", player) npcHandler.topic[cid] = 2 end elseif msgcontains(msg, "crossbow") then if player:getStorageValue(12055) == 1 then npcHandler:say("I'm so excited! Have you really found my crossbow?", player) npcHandler.topic[cid] = 4 end elseif msgcontains(msg, "leather") then if player:getStorageValue(12055) == 2 then npcHandler:say("Did you bring me 100 pieces of lizard leather and 100 pieces of red dragon leather?", player) npcHandler.topic[cid] = 5 end elseif msgcontains(msg, "chicken wing") then if player:getStorageValue(12055) == 3 then npcHandler:say("Were you able to get hold of 5 enchanted chicken wings?", player) npcHandler.topic[cid] = 6 end elseif msgcontains(msg, "steel") then if player:getStorageValue(12055) == 4 then npcHandler:say("Ah, have you brought one piece of royal steel, draconian steel and hell steel each?", player) npcHandler.topic[cid] = 7 end elseif msgcontains(msg, "Sniper Gloves") then if player:getStorageValue(12056) < 1 then npcHandler:say("You found sniper gloves?! Incredible! Listen, if you give them to me, I will grant you the right to wear the sniper gloves accessory. How about it?", player) npcHandler.topic[cid] = 8 end elseif msgcontains(msg, "yes") then if npcHandler.topic[cid] == 2 then selfSay("Alright, I will give you a chance. Pay close attention to what I'm going to tell you now. ...", cid) selfSay("Recently, one of our members moved to Liberty Bay out of nowhere, talking about some strange cult. That is not the problem, but he took my favourite crossbow with him. ...", cid) selfSay("Please find my crossbow. It has my name engraved on it and is very special to me. ...", cid) selfSay("Secondly, we need a lot of leather for new quivers. 100 pieces of lizard leather and 100 pieces of red dragon leather should suffice. ...", cid) selfSay("Third, since we are giving out tiaras, we are always in need of enchanted chicken wings. Please bring me 5, that would help us tremendously. ...", cid) selfSay("Lastly, for our arrow heads we need a lot of steel. Best would be one piece of royal steel, one piece of draconian steel and one piece of hell steel. ...", cid) npcHandler:say("Did you understand everything I told you and are willing to handle this task?", cid) npcHandler.topic[cid] = 3 elseif npcHandler.topic[cid] == 3 then npcHandler:say("That's the spirit! I hope you will find my crossbow, " .. player:getName() .. "!", player) player:setStorageValue(12055, 1) player:setStorageValue(12010, 1) --this for default start of Outfit and Addon Quests npcHandler.topic[cid] = 0 elseif npcHandler.topic[cid] == 4 then if player:getItemCount( 5947) >= 1 then npcHandler:say("Yeah! I could kiss you right here and there! Besides, you're a handsome one. <giggles> Please bring me 100 pieces of lizard leather and 100 pieces of red dragon leather now!", player) player:removeItem(5947, 1) player:setStorageValue(12055, 2) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have it...", player) end elseif npcHandler.topic[cid] == 5 then if player:getItemCount( 5876) >= 100 and player:getItemCount( 5948) >= 100 then npcHandler:say("Good work, " .. player:getName() .. "! That is enough leather for a lot of sturdy quivers. Now, please bring me 5 enchanted chicken wings.", player) player:removeItem(5876, 100) player:removeItem(5948, 100) player:setStorageValue(12055, 3) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have it...", player) end elseif npcHandler.topic[cid] == 6 then if player:getItemCount( 5891) >= 5 then npcHandler:say("Great! Now we can create a few more Tiaras. If only they weren't that expensive... Well anyway, please obtain one piece of royal steel, draconian steel and hell steel each.", player) player:removeItem(5891, 5) player:setStorageValue(12055, 4) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have it...", player) end elseif npcHandler.topic[cid] == 7 then if player:getItemCount( 5887) >= 1 and player:getItemCount( 5888) >= 1 and player:getItemCount( 5889) >= 1 then npcHandler:say("Wow, I'm impressed, " .. player:getName() .. ". Your really are a valuable member of our paladin guild. I shall grant you your reward now. Wear it proudly!", player) player:removeItem(5887, 1) player:removeItem(5888, 1) player:removeItem(5889, 1) player:setStorageValue(12055, 5) player:addOutfitAddon(player:getSex() == 0 and 137 or 129, 1) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have it...", player) end elseif npcHandler.topic[cid] == 8 then if player:getItemCount( 5875) >= 1 then npcHandler:say("Great! I hereby grant you the right to wear the sniper gloves as accessory. Congratulations!", player) player:removeItem(5875, 1) player:setStorageValue(12010, 1) --this for default start of Outfit and Addon Quests player:setStorageValue(12056, 1) player:addOutfitAddon(player:getSex() == 0 and 137 or 129, 2) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have it...", player) end end elseif msgcontains(msg, "no") then if npcHandler.topic[cid] > 1 then npcHandler:say("Then no.", player) npcHandler.topic[cid] = 0 end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
gpl-2.0
GENRALVS/GENRAL-VS
plugins/anti_spam.lua
191
5291
--An empty table for solving multiple kicking problem(thanks to @topkecleon ) kicktable = {} do local TIME_CHECK = 2 -- seconds -- Save stats, ban user local function pre_process(msg) -- Ignore service msg if msg.service then return msg end if msg.from.id == our_id then return msg end -- Save user on Redis if msg.from.type == 'user' then local hash = 'user:'..msg.from.id print('Saving user', hash) if msg.from.print_name then redis:hset(hash, 'print_name', msg.from.print_name) end if msg.from.first_name then redis:hset(hash, 'first_name', msg.from.first_name) end if msg.from.last_name then redis:hset(hash, 'last_name', msg.from.last_name) end end -- Save stats on Redis if msg.to.type == 'chat' then -- User is on chat local hash = 'chat:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end -- Save stats on Redis if msg.to.type == 'channel' then -- User is on channel local hash = 'channel:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end if msg.to.type == 'user' then -- User is on chat local hash = 'PM:'..msg.from.id redis:sadd(hash, msg.from.id) end -- Total user msgs local hash = 'msgs:'..msg.from.id..':'..msg.to.id redis:incr(hash) --Load moderation data local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then --Check if flood is on or off if data[tostring(msg.to.id)]['settings']['flood'] == 'no' then return msg end end -- Check flood if msg.from.type == 'user' then local hash = 'user:'..msg.from.id..':msgs' local msgs = tonumber(redis:get(hash) or 0) local data = load_data(_config.moderation.data) local NUM_MSG_MAX = 5 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'])--Obtain group flood sensitivity end end local max_msg = NUM_MSG_MAX * 1 if msgs > max_msg then local user = msg.from.id local chat = msg.to.id local whitelist = "whitelist" local is_whitelisted = redis:sismember(whitelist, user) -- Ignore mods,owner and admins if is_momod(msg) then return msg end if is_whitelisted == true then return msg end local receiver = get_receiver(msg) if msg.to.type == 'user' then local max_msg = 7 * 1 print(msgs) if msgs >= max_msg then print("Pass2") send_large_msg("user#id"..msg.from.id, "User ["..msg.from.id.."] blocked for spam.") savelog(msg.from.id.." PM", "User ["..msg.from.id.."] blocked for spam.") block_user("user#id"..msg.from.id,ok_cb,false)--Block user if spammed in private end end if kicktable[user] == true then return end delete_msg(msg.id, ok_cb, false) kick_user(user, chat) local username = msg.from.username local print_name = user_print_name(msg.from):gsub("‮", "") local name_log = print_name:gsub("_", "") if msg.to.type == 'chat' or msg.to.type == 'channel' then if username then savelog(msg.to.id, name_log.." @"..username.." ["..msg.from.id.."] kicked for #spam") send_large_msg(receiver , "Flooding is not allowed here\n@"..username.."["..msg.from.id.."]\nStatus: User kicked") else savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked for #spam") send_large_msg(receiver , "Flooding is not allowed here\nName:"..name_log.."["..msg.from.id.."]\nStatus: User kicked") end end -- incr it on redis local gbanspam = 'gban:spam'..msg.from.id redis:incr(gbanspam) local gbanspam = 'gban:spam'..msg.from.id local gbanspamonredis = redis:get(gbanspam) --Check if user has spammed is group more than 4 times if gbanspamonredis then if tonumber(gbanspamonredis) == 4 and not is_owner(msg) then --Global ban that user banall_user(msg.from.id) local gbanspam = 'gban:spam'..msg.from.id --reset the counter redis:set(gbanspam, 0) if msg.from.username ~= nil then username = msg.from.username else username = "---" end local print_name = user_print_name(msg.from):gsub("‮", "") local name = print_name:gsub("_", "") --Send this to that chat send_large_msg("chat#id"..msg.to.id, "User [ "..name.." ]"..msg.from.id.." globally banned (spamming)") send_large_msg("channel#id"..msg.to.id, "User [ "..name.." ]"..msg.from.id.." globally banned (spamming)") local GBan_log = 'GBan_log' local GBan_log = data[tostring(GBan_log)] for k,v in pairs(GBan_log) do log_SuperGroup = v gban_text = "User [ "..name.." ] ( @"..username.." )"..msg.from.id.." Globally banned from ( "..msg.to.print_name.." ) [ "..msg.to.id.." ] (spamming)" --send it to log group/channel send_large_msg(log_SuperGroup, gban_text) end end end kicktable[user] = true msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end return msg end local function cron() --clear that table on the top of the plugins kicktable = {} end return { patterns = {}, cron = cron, pre_process = pre_process } end
gpl-2.0
LegionXI/darkstar
scripts/globals/spells/bluemagic/metallic_body.lua
45
1520
----------------------------------------- -- Spell: Metallic Body -- Absorbs an certain amount of damage from physical and magical attacks -- Spell cost: 19 MP -- Monster Type: Aquans -- Spell Type: Magical (Earth) -- Blue Magic Points: 1 -- Stat Bonus: None -- Level: 8 -- Casting Time: 7 seconds -- Recast Time: 60 seconds -- Duration: 5 minutes -- -- Combos: Max MP Boost ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/bluemagic"); ----------------------------------------- -- OnMagicCastingCheck ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; ----------------------------------------- -- OnSpellCast ----------------------------------------- function onSpellCast(caster,target,spell) local typeEffect = EFFECT_STONESKIN local blueskill = caster:getSkillLevel(BLUE_SKILL); local power = (blueskill/3) + (caster:getMainLvl()/3) + 10; local duration = 300; if (power > 150) then power = 150; end; if (caster:hasStatusEffect(EFFECT_DIFFUSION)) then local diffMerit = caster:getMerit(MERIT_DIFFUSION); if (diffMerit > 0) then duration = duration + (duration/100)* diffMerit; end; caster:delStatusEffect(EFFECT_DIFFUSION); end; if (target:addStatusEffect(typeEffect,power,0,duration) == false) then spell:setMsg(75); end; return typeEffect; end;
gpl-3.0
LegionXI/darkstar
scripts/globals/spells/temper.lua
27
1135
----------------------------------------- -- -- Spell: Temper -- ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local effect = EFFECT_MULTI_STRIKES; local enhskill = caster:getSkillLevel(ENHANCING_MAGIC_SKILL); local final = 0; local duration = 180; if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then duration = duration * 3; end if (enhskill<360) then final = 5; elseif (enhskill>=360) then final = math.floor( (enhskill - 300) / 10 ); else print("Warning: Unknown enhancing magic skill for Temper."); end if (final>20) then final = 20; end if (target:addStatusEffect(effect,final,0,duration)) then spell:setMsg(230); else spell:setMsg(75); end return effect; end;
gpl-3.0
greasydeal/darkstar
scripts/globals/mobskills/Damnation_Dive.lua
7
1350
--------------------------------------------- -- Damnation Dive -- -- Description: Dives into a single target. Additional effect: Knockback + Stun -- Type: Physical -- Utsusemi/Blink absorb: 3 shadow -- Range: Melee -- Notes: Used instead of Gliding Spike by certain notorious monsters. --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- --------------------------------------------------- -- onMobSkillCheck -- Check for Grah Family id 122,123,124 -- if not in Bird form, then ignore. --------------------------------------------------- function onMobSkillCheck(target,mob,skill) if((mob:getFamily() == 122 or mob:getFamily() == 123 or mob:getFamily() == 124) and mob:AnimationSub() ~= 3) then return 1; else return 0; end end; function onMobWeaponSkill(target, mob, skill) local numhits = 3; local accmod = 1; local dmgmod = .8; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,info.hitslanded); local typeEffect = EFFECT_STUN; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 1, 0, 4); target:delHP(dmg); return dmg; end;
gpl-3.0
teslamint/packages
net/acme/files/acme-cbi.lua
3
5143
--[[ LuCI - Lua Configuration Interface Copyright 2016 Toke Høiland-Jørgensen <toke@toke.dk> # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 3 of the License, or (at your option) any later # version. ]]-- local ipkg = require "luci.model.ipkg" local nginx_presence = ipkg.installed("nginx-all-module") or ipkg.installed("nginx-ssl") or false local uhttpd_presence = ipkg.installed("uhttpd") or false m = Map("acme", translate("ACME certificates"), translate("This configures ACME (Letsencrypt) automatic certificate installation. " .. "Simply fill out this to have the router configured with Letsencrypt-issued " .. "certificates for the web interface. " .. "Note that the domain names in the certificate must already be configured to " .. "point at the router's public IP address. " .. "Once configured, issuing certificates can take a while. " .. "Check the logs for progress and any errors.")) s = m:section(TypedSection, "acme", translate("ACME global config")) s.anonymous = true st = s:option(Value, "state_dir", translate("State directory"), translate("Where certs and other state files are kept.")) st.rmempty = false st.datatype = "directory" ae = s:option(Value, "account_email", translate("Account email"), translate("Email address to associate with account key.")) ae.rmempty = false ae.datatype = "minlength(1)" d = s:option(Flag, "debug", translate("Enable debug logging")) d.rmempty = false cs = m:section(TypedSection, "cert", translate("Certificate config")) cs.anonymous = false cs.addremove = true e = cs:option(Flag, "enabled", translate("Enabled")) e.rmempty = false us = cs:option(Flag, "use_staging", translate("Use staging server"), translate("Get certificate from the Letsencrypt staging server " .. "(use for testing; the certificate won't be valid).")) us.rmempty = false kl = cs:option(ListValue, "keylength", translate("Key size"), translate("Key size (and type) for the generated certificate.")) kl:value("2048", "RSA 2048 bits") kl:value("3072", "RSA 3072 bits") kl:value("4096", "RSA 4096 bits") kl:value("ec-256", "ECC 256 bits") kl:value("ec-384", "ECC 384 bits") kl.default = "2048" kl.rmempty = false if uhttpd_presence then u = cs:option(Flag, "update_uhttpd", translate("Use for uhttpd"), translate("Update the uhttpd config with this certificate once issued " .. "(only select this for one certificate)." .. "Is also available luci-app-uhttpd to configure uhttpd form the LuCI interface.")) u.rmempty = false end if nginx_presence then u = cs:option(Flag, "update_nginx", translate("Use for nginx"), translate("Update the nginx config with this certificate once issued " .. "(only select this for one certificate)." .. "Nginx must support ssl, if not it won't start as it needs to be " .. "compiled with ssl support to use cert options")) u.rmempty = false end wr = cs:option(Value, "webroot", translate("Webroot directory"), translate("Webserver root directory. Set this to the webserver " .. "document root to run Acme in webroot mode. The web " .. "server must be accessible from the internet on port 80.")) wr.optional = true dom = cs:option(DynamicList, "domains", translate("Domain names"), translate("Domain names to include in the certificate. " .. "The first name will be the subject name, subsequent names will be alt names. " .. "Note that all domain names must point at the router in the global DNS.")) dom.datatype = "list(string)" dns = cs:option(Value, "dns", translate("DNS API"), translate("To use DNS mode to issue certificates, set this to the name of a DNS API supported by acme.sh. " .. "See https://github.com/Neilpang/acme.sh/tree/master/dnsapi for the list of available APIs. " .. "In DNS mode, the domain name does not have to resolve to the router IP. " .. "DNS mode is also the only mode that supports wildcard certificates. " .. "Using this mode requires the acme-dnsapi package to be installed.")) dns.optional = true cred = cs:option(DynamicList, "credentials", translate("DNS API credentials"), translate("The credentials for the DNS API mode selected above. " .. "See https://github.com/Neilpang/acme.sh/tree/master/dnsapi#how-to-use-dns-api for the format of credentials required by each API. " .. "Add multiple entries here in KEY=VAL shell variable format to supply multiple credential variables.")) cred.datatype = "list(string)" return m
gpl-2.0
naclander/tome
game/modules/tome/data/zones/town-zigur/zone.lua
1
2076
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org return { name = "Zigur", level_range = {15, 50}, level_scheme = "player", actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end, update_base_level_on_enter = true, max_level = 1, width = 50, height = 50, decay = {300, 800, only={object=true}, no_respawn=true}, persistent = "zone", no_worldport = true, all_remembered = true, day_night = true, all_lited = true, ambient_music = {"Straight Into Ambush.ogg", "weather/town_large_base.ogg"}, min_material_level = function() return game.state:isAdvanced() and 3 or 2 end, max_material_level = function() return game.state:isAdvanced() and 4 or 3 end, store_levels_by_restock = { 20, 35, 45 }, nicer_tiler_overlay = "DungeonWallsGrass", generator = { map = { class = "engine.generator.map.Static", map = "towns/zigur", }, actor = { class = "mod.class.generator.actor.Random", nb_npc = {0, 0}, }, object = { class = "engine.generator.object.Random", nb_object = {0, 0}, }, }, post_process = function(level) game.state:makeAmbientSounds(level, { town_large={ chance=250, volume_mod=1, pitch=1, random_pos={rad=10}, files={"ambient/town/town_large1","ambient/town/town_large2","ambient/town/town_large3"}}, }) end, }
gpl-3.0
naclander/tome
game/modules/tome/data/quests/paradoxology.lua
1
5061
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org name = "The Way We Weren't" desc = function(self, who) local desc = {} desc[#desc+1] = "You have met what seems to be a future version of yourself.\n" if self:isCompleted("combat") then desc[#desc+1] = "You tried to kill yourself to prevent you from doing something, or going somewhere... you were not very clear.\n" end if self:isCompleted("now-died") then desc[#desc+1] = "You were killed by your future self, and thus this event never occured.\n" end if self:isCompleted("future-died") then desc[#desc+1] = "You killed your future self. In the future, you might wish to avoid time-traveling back to this moment...\n" end return table.concat(desc, "\n") end on_status_change = function(self, who, status, sub) if sub then if self:isCompleted("future-died") or self:isCompleted("now-died") then who:setQuestStatus(self.id, engine.Quest.DONE) end end end generate = function(self, player, x, y) local a = mod.class.NPC.new{} a:replaceWith(player:resolveSource():cloneFull()) mod.class.NPC.castAs(a) engine.interface.ActorAI.init(a, a) a.no_drops = true a.energy.value = 0 a.player = nil a.rank = 4 a.name = a.name.." the Paradox Mage" a.color_r = 250 a.color_g = 50 a.color_b = 250 a:removeAllMOs() a.ai = "tactical" a.ai_state = {talent_in=1} a.faction = "enemies" a.max_life = a.max_life * 2 a.puuid = nil a.life = a.max_life -- Remove all talents local tids = {} for tid, _ in pairs(a.talents) do local t = a:getTalentFromId(tid) tids[#tids+1] = t end for i, t in ipairs(tids) do if t.mode == "sustained" and a:isTalentActive(t.id) then a:forceUseTalent(t.id, {ignore_energy=true}) end a.talents[t.id] = nil end -- Add talents a:learnTalent(a.T_TURN_BACK_THE_CLOCK, true, 3) a:learnTalent(a.T_BODY_REVERSION, true, 3) a:learnTalent(a.T_TEMPORAL_FUGUE, true, 4) a:learnTalent(a.T_STATIC_HISTORY, true, 4) a:learnTalent(a.T_RETHREAD, true, 3) a:learnTalent(a.T_GATHER_THE_THREADS, true, 3) a:learnTalent(a.T_FADE_FROM_TIME, true, 3) a:learnTalent(a.T_ASHES_TO_ASHES, true, 4) a:learnTalent(a.T_QUANTUM_SPIKE, true, 3) a:learnTalent(a.T_SEVER_LIFELINE, true, 5) a.talent_cd_reduction = a.talent_cd_reduction or {} a.talent_cd_reduction[a.T_STATIC_HISTORY] = 15 a.talents_cd[a.T_SEVER_LIFELINE] = 20 a:forceLevelup(a.level + 7) a:incIncStat("wil", 200) a.self_resurrect = nil -- In case this is a skeleton player a.on_die = function(self) local o = game.zone:makeEntityByName(game.level, "object", "RUNE_RIFT") o:identify(true) game.zone:addEntity(game.level, o, "object", self.x, self.y) game.player:setQuestStatus("paradoxology", engine.Quest.COMPLETED, "future-died") world:gainAchievement("PARADOX_FUTURE", p) game.logSeen(self, "#LIGHT_BLUE#Killing your own future self does feel weird, but you know that you can avoid this future. Just do not time travel.") end a.on_takehit = function(self, val) if not self.half_life_check and (self.life - val < self.max_life / 2) then self:doEmote("Meet the guardian!") game:onTickEnd(function() game:changeLevel(1, "paradox-plane") end) self.half_life_check = true self:heal(self.max_life) return 0 end return val end a.on_kill = function(self, who) local p = game.party:findMember{main=true} if who == p then p:setQuestStatus("paradoxology", engine.Quest.COMPLETED, "now-died") game.logSeen(self, "#LIGHT_BLUE#Your future self kills you! The timestreams are broken by the paradox!") game.logSeen(self, "#LIGHT_BLUE#All those events never happened. Except they did, somewhen.") game:setAllowedBuild("chronomancer_paradox_mage", true) world:gainAchievement("PARADOX_NOW", p) local rift = game.zone:makeEntityByName(game.level, "terrain", "RIFT") rift.change_level_check = function() game.log("This rift in time has been created by the paradox. You dare not enter it; it could make things worse. Another Warden will have to fix your mess.") return true end game.zone:addEntity(game.level, rift, "terrain", self.x, self.y) self.on_die = nil self:die() who.changed = true who.life = math.max(who.life, who.max_life * 0.3) return true end end game.zone:addEntity(game.level, a, "actor", x, y) local chat = require("engine.Chat").new("paradoxology", a, player) chat:invoke() end
gpl-3.0
siktirmirza/supergp
plugins/plugmanager.lua
22
3691
do local function run(msg, matches) if not is_sudo(msg) then return "you have not accsess to filemanager" end local receiver = get_receiver(msg) if matches[1] == 'بفرس' then local file = matches[3] if matches[2] == 'sticker' and not matches[4] then send_document(receiver, "./media/"..file..".webp", ok_cb, false) end if matches[2] == 'photo' then send_photo(receiver, "./media/"..file..".jpeg", ok_cb, false) send_photo(receiver, "./media/"..file..".jpg", ok_cb, false) send_photo(receiver, "./media/"..file..".png", ok_cb, false) end if matches[2] == 'GIF' and not matches[4] then send_photo(receiver, "./media/"..file..".gif", ok_cb, false) end if matches[2] == 'music' then send_audio(receiver, "./media/"..file..".mp3", ok_cb, false) send_audio(receiver, "./media/"..file..".flac", ok_cb, false) send_audio(receiver, "./media/"..file..".aac", ok_cb, false) end if matches[2] == 'video' then send_photo(receiver, "./media/"..file..".avi", ok_cb, false) send_photo(receiver, "./media/"..file..".mpeg", ok_cb, false) send_photo(receiver, "./media/"..file..".mp4", ok_cb, false) end if matches[2] == 'file' then local extension = matches[4] send_document(receiver, "./media/"..file..'.'..extension, ok_cb, false) end if matches[2] == 'plugin' then send_document(receiver, "./plugins/"..file..".lua", ok_cb, false) end if matches[2] == 'dev' or matches[2] == 'm4ster' or matches[2] == 'master' or matches[2] == 'developer' or matches[2] == 'creator'then local extension = matches[4] if matches[3] == 'file' then send_document(receiver, "./media/M4STER.png", ok_cb, false) elseif matches[3] ~= 'file' or not matches[3] then send_photo(receiver, "./media/M4STER.png", ok_cb, false) end end if matches[2] == 'manual' and is_admin(msg) then local ruta = matches[3] local document = matches[4] send_document(receiver, "./"..ruta.."/"..document, ok_cb, false) end end if matches[1] == 'extensions' then return 'No disponible actualmente' end if matches[1] == 'list' and matches[2] == 'files' then return 'No disponible actualmente' --send_document(receiver, "./media/files/files.txt", ok_cb, false) end end return { description = "Kicking ourself (bot) from unmanaged groups.", usage = { "!list files : Envía un archivo con los nombres de todo lo que se puede enviar", "!extensions : Envía un mensaje con las extensiones para cada tipo de archivo permitidas", "➖➖➖➖➖➖➖➖➖➖", "!send sticker <nombre del sticker> : Envía ese sticker del servidor", "!send photo <nombre de la foto> <extension de la foto> : Envía esa foto del servidor", "!send GIF <nombre del GIF> : Envía ese GIF del servidor", "!send music <nombre de la canción <extension de la canción> : Envía esa canción del servidor", "!send video <nombre del video> <extension del video> : Envía ese video del servidor", "!send file <nombre del archivo> <extension del archivo> : Envía ese archivo del servidor", "!send plugin <Nombre del plugin> : Envía ese archivo del servidor", "!send manual <Ruta de archivo> <Nombre del plugin> : Envía un archivo desde el directorio TeleSeed", "!send dev : Envía una foto del desarrollador" }, patterns = { "^(بفرس) (.*) (.*) (.*)$", "^(بفرس) (.*) (.*)$", "^(بفرس) (.*)$", "^[!/](list) (files)$", "^[!/](extensions)$" }, run = run } end --MODDED by @M4STER_ANGEL
gpl-2.0
ibm2431/darkstar
scripts/zones/Vunkerl_Inlet_[S]/Zone.lua
12
1428
----------------------------------- -- -- Zone: Vunkerl_Inlet_[S] (83) -- ----------------------------------- local ID = require("scripts/zones/Vunkerl_Inlet_[S]/IDs"); require("scripts/globals/weather"); require("scripts/globals/status"); ----------------------------------- function onInitialize(zone) end; function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(-393.238,-50.034,741.199,2); end return cs; end; function onZoneWeatherChange(weather) local npc = GetNPCByID(ID.npc.INDESCRIPT_MARKINGS); -- Indescript Markings if (npc ~= nil) then if (weather == dsp.weather.FOG or weather == dsp.weather.THUNDER) then npc:setStatus(dsp.status.DISAPPEAR); elseif (VanadielHour() >= 16 or VanadielHour() <= 6) then npc:setStatus(dsp.status.NORMAL); end end end; function onGameHour(zone) local npc = GetNPCByID(ID.npc.INDESCRIPT_MARKINGS); -- Indescript Markings if (npc ~= nil) then if (VanadielHour() == 16) then npc:setStatus(dsp.status.DISAPPEAR); end if (VanadielHour() == 6) then npc:setStatus(dsp.status.NORMAL); end end end; function onRegionEnter(player,region) end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/angler_stewpot.lua
11
1608
----------------------------------------- -- ID: 5611 -- Item: Angler's Stewpot -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- HP +10% (cap 200) -- MP +10 -- HP Recoverd while healing 5 -- MP Recovered while healing 1 -- Accuracy +15% Cap 15 -- Ranged Accuracy 15% Cap 15 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,10800,5611) end function onEffectGain(target, effect) target:addMod(dsp.mod.FOOD_HPP, 10) target:addMod(dsp.mod.FOOD_HP_CAP, 200) target:addMod(dsp.mod.MP, 10) target:addMod(dsp.mod.HPHEAL, 5) target:addMod(dsp.mod.MPHEAL, 1) target:addMod(dsp.mod.FOOD_ACCP, 15) target:addMod(dsp.mod.FOOD_ACC_CAP, 15) target:addMod(dsp.mod.FOOD_RACCP, 15) target:addMod(dsp.mod.FOOD_RACC_CAP, 15) end function onEffectLose(target, effect) target:delMod(dsp.mod.FOOD_HPP, 10) target:delMod(dsp.mod.FOOD_HP_CAP, 200) target:delMod(dsp.mod.MP, 10) target:delMod(dsp.mod.HPHEAL, 5) target:delMod(dsp.mod.MPHEAL, 1) target:delMod(dsp.mod.FOOD_ACCP, 15) target:delMod(dsp.mod.FOOD_ACC_CAP, 15) target:delMod(dsp.mod.FOOD_RACCP, 15) target:delMod(dsp.mod.FOOD_RACC_CAP, 15) end
gpl-3.0
LegionXI/darkstar
scripts/globals/items/broiled_trout.lua
12
1385
----------------------------------------- -- ID: 4587 -- Item: Broiled Trout -- Food Effect: 60Min, All Races ----------------------------------------- -- Dexterity 4 -- Mind -1 -- Ranged ATT % 14 (cap 55) ----------------------------------------- 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,3600,4587); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 4); target:addMod(MOD_MND, -1); target:addMod(MOD_FOOD_RATTP, 14); target:addMod(MOD_FOOD_RATT_CAP, 45); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 4); target:delMod(MOD_MND, -1); target:delMod(MOD_FOOD_RATTP, 14); target:delMod(MOD_FOOD_RATT_CAP, 45); end;
gpl-3.0
ibm2431/darkstar
scripts/zones/Dynamis-Xarcabard/IDs.lua
9
8606
----------------------------------- -- Area: Dynamis-Xarcabard ----------------------------------- require("scripts/globals/keyitems") require("scripts/globals/dynamis") require("scripts/globals/zone") ----------------------------------- zones = zones or {} zones[dsp.zone.DYNAMIS_XARCABARD] = { text = { ITEM_CANNOT_BE_OBTAINED = 6382, -- You cannot obtain the <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6388, -- Obtained: <item>. GIL_OBTAINED = 6389, -- Obtained <number> gil. KEYITEM_OBTAINED = 6391, -- Obtained key item: <keyitem>. CONQUEST_BASE = 7055, -- Tallying conquest results... DYNAMIS_TIME_BEGIN = 7214, -- The sands of the <item> have begun to fall. You have <number> minutes (Earth time) remaining in Dynamis. DYNAMIS_TIME_EXTEND = 7215, -- our stay in Dynamis has been extended by <number> minute[/s]. DYNAMIS_TIME_UPDATE_1 = 7216, -- ou will be expelled from Dynamis in <number> [second/minute] (Earth time). DYNAMIS_TIME_UPDATE_2 = 7217, -- ou will be expelled from Dynamis in <number> [seconds/minutes] (Earth time). DYNAMIS_TIME_EXPIRED = 7219, -- The sands of the hourglass have emptied... OMINOUS_PRESENCE = 7230, -- You feel an ominous presence, as if something might happen if you possessed <item>. ANIMATED_KNUCKLES_DIALOG = 7297, -- I am known as the Fists of Mystics. Come, show me your fighting spirit. ANIMATED_DAGGER_DIALOG = 7329, -- I am called the Ornate Blade. Now, show me your strength. ANIMATED_LONGSWORD_DIALOG = 7361, -- People have named me the Holy Blade. I will try thy resolution. ANIMATED_CLAYMORE_DIALOG = 7393, -- I am the Intricate Blade. Show me the depths of your fury! ANIMATED_TABAR_DIALOG = 7425, -- Me, axe. Runaeic, Axe. You, die? ANIMATED_GREATAXE_DIALOG = 7457, -- I have been given the title of Seraphic Axe. Will you attempt to survive my love? ANIMATED_SPEAR_DIALOG = 7489, -- I am the Stellar Spear. It is time to test your courage. ANIMATED_SCYTHE_DIALOG = 7521, -- I am known as the Tenebrous Scythe. Overwhelm me with your greed for power. ANIMATED_KUNAI_DIALOG = 7553, -- I am called the Demoniac Blade. Allow me to witness your technique. ANIMATED_TACHI_DIALOG = 7585, -- I am the Divine Blade. I demand a test of your will. ANIMATED_HAMMER_DIALOG = 7617, -- People have named me the Heavenly Hammer. I will test your might to its very limits. ANIMATED_STAFF_DIALOG = 7649, -- I am called the Celestial Staff. I will glimpse into your mind's eye... ANIMATED_LONGBOW_DIALOG = 7681, -- I am known as the Snarled Bow. I will measure the limits of your determination. ANIMATED_GUN_DIALOG = 7713, -- I am known as the Ethereal Rifle. Do you realize my incredible value? ANIMATED_HORN_DIALOG = 7745, -- I am called the Mysterial Horn. Show me your true intentions. ANIMATED_SHIELD_DIALOG = 7777, -- I am Aegis, the impervious shield of everlasting. PRISON_OF_SOULS_HAS_SET_FREE = 7809, -- e prison of souls has set free its captive spirits! }, mob = { TIME_EXTENSION = { {minutes = 10, ki = dsp.ki.CRIMSON_GRANULES_OF_TIME, mob = 17330531}, {minutes = 10, ki = dsp.ki.AZURE_GRANULES_OF_TIME, mob = 17330532}, {minutes = 10, ki = dsp.ki.AMBER_GRANULES_OF_TIME, mob = 17330533}, {minutes = 10, ki = dsp.ki.ALABASTER_GRANULES_OF_TIME, mob = 17330534}, {minutes = 20, ki = dsp.ki.OBSIDIAN_GRANULES_OF_TIME, mob = 17330535}, }, REFILL_STATUE = { { {mob = 17330230, eye = dynamis.eye.RED }, -- Adamantking_Effigy {mob = 17330231, eye = dynamis.eye.GREEN}, }, { {mob = 17330240, eye = dynamis.eye.RED }, -- Adamantking_Effigy {mob = 17330241, eye = dynamis.eye.BLUE }, }, { {mob = 17330248, eye = dynamis.eye.RED }, -- Serjeant_Tombstone {mob = 17330249, eye = dynamis.eye.GREEN}, }, { {mob = 17330256, eye = dynamis.eye.RED }, -- Serjeant_Tombstone {mob = 17330257, eye = dynamis.eye.BLUE }, }, { {mob = 17330273, eye = dynamis.eye.RED }, -- Avatar_Icon {mob = 17330274, eye = dynamis.eye.GREEN}, }, { {mob = 17330285, eye = dynamis.eye.RED }, -- Avatar_Icon {mob = 17330286, eye = dynamis.eye.BLUE }, }, { {mob = 17330471, eye = dynamis.eye.RED }, -- Goblin_Replica {mob = 17330472, eye = dynamis.eye.GREEN}, }, { {mob = 17330483, eye = dynamis.eye.RED }, -- Goblin_Replica {mob = 17330484, eye = dynamis.eye.BLUE }, }, }, YING = 17330183, COUNT_ZAEBOS_PH = {[17330376] = 17330377}, -- Kindred_Warrior DUKE_GOMORY_PH = {[17330303] = 17330304}, -- Kindred_Monk PRINCE_SEERE_PH = {[17330331] = 17330332}, -- Kindred_White_Mage MARQUIS_ORIAS_PH = {[17330333] = 17330343}, -- Kindred_Black_Mage DUKE_BERITH_PH = {[17330352] = 17330353}, -- Kindred_Red_Mage COUNT_RAUM_PH = {[17330314] = 17330315}, -- Kindred_Thief MARQUIS_SABNAK_PH = {[17330359] = 17330360}, -- Kindred_Paladin DUKE_SCOX_PH = {[17330427] = 17330417}, -- Kindred_Dark_Knight MARQUIS_ANDRAS_PH = {[17330388] = 17330390}, -- Kindred_Beastmaster MARQUIS_DECARABIA_PH = {[17330222] = 17330223}, -- Kindred_Bard MARQUIS_CIMERIES_PH = {[17330414] = 17330415}, -- Kindred_Ranger COUNT_VINE_PH = {[17330439] = 17330440}, -- Kindred_Samurai MARQUIS_GAMYGYN_PH = {[17330450] = 17330451}, -- Kindred_Ninja KING_ZAGAN_PH = {[17330418] = 17330430}, -- Kindred_Dragoon MARQUIS_NEBIROS_PH = {[17330479] = 17330481}, -- Kindred_Summoner }, npc = { QM = { [17330780] = { param = {3358, 3429, 3430, 3431, 3432, 3433}, trade = { {item = 3358, mob = 17330177}, -- Dynamis Lord {item = {3429, 3430, 3431, 3432, 3433}, mob = 17330191}, -- Arch Dynamis Lord } }, [17330781] = {trade = {{item = 3400, mob = 17330185}}}, -- Duke Haures [17330782] = {trade = {{item = 3401, mob = 17330186}}}, -- Marquis Caim [17330783] = {trade = {{item = 3402, mob = 17330188}}}, -- Baron Avnas [17330784] = {trade = {{item = 3403, mob = 17330189}}}, -- Count Haagenti [17330785] = {trade = {{item = 3364, mob = 17330199}}}, -- Animated Knuckles [17330786] = {trade = {{item = 3365, mob = 17330200}}}, -- Animated Dagger [17330787] = {trade = {{item = 3366, mob = 17330201}}}, -- Animated Longsword [17330788] = {trade = {{item = 3367, mob = 17330202}}}, -- Animated Claymore [17330789] = {trade = {{item = 3368, mob = 17330203}}}, -- Animated Tabar [17330790] = {trade = {{item = 3369, mob = 17330204}}}, -- Animated Great Axe [17330791] = {trade = {{item = 3371, mob = 17330205}}}, -- Animated Spear [17330792] = {trade = {{item = 3370, mob = 17330206}}}, -- Animated Scythe [17330793] = {trade = {{item = 3372, mob = 17330207}}}, -- Animated Kunai [17330794] = {trade = {{item = 3373, mob = 17330208}}}, -- Animated Tachi [17330795] = {trade = {{item = 3374, mob = 17330209}}}, -- Animated Hammer [17330796] = {trade = {{item = 3375, mob = 17330210}}}, -- Animated Staff [17330797] = {trade = {{item = 3376, mob = 17330211}}}, -- Animated Longbow [17330798] = {trade = {{item = 3377, mob = 17330212}}}, -- Animated Gun [17330799] = {trade = {{item = 3378, mob = 17330213}}}, -- Animated Horn [17330800] = {trade = {{item = 3379, mob = 17330214}}}, -- Animated Shield }, }, } return zones[dsp.zone.DYNAMIS_XARCABARD]
gpl-3.0
gwlim/luci
applications/luci-asterisk/luasrc/model/cbi/asterisk-mod-format.lua
80
3636
--[[ 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 format_au = module:option(ListValue, "format_au", "Sun Microsystems AU format (signed linear)", "") format_au:value("yes", "Load") format_au:value("no", "Do Not Load") format_au:value("auto", "Load as Required") format_au.rmempty = true format_g723 = module:option(ListValue, "format_g723", "G.723.1 Simple Timestamp File Format", "") format_g723:value("yes", "Load") format_g723:value("no", "Do Not Load") format_g723:value("auto", "Load as Required") format_g723.rmempty = true format_g726 = module:option(ListValue, "format_g726", "Raw G.726 (16/24/32/40kbps) data", "") format_g726:value("yes", "Load") format_g726:value("no", "Do Not Load") format_g726:value("auto", "Load as Required") format_g726.rmempty = true format_g729 = module:option(ListValue, "format_g729", "Raw G729 data", "") format_g729:value("yes", "Load") format_g729:value("no", "Do Not Load") format_g729:value("auto", "Load as Required") format_g729.rmempty = true format_gsm = module:option(ListValue, "format_gsm", "Raw GSM data", "") format_gsm:value("yes", "Load") format_gsm:value("no", "Do Not Load") format_gsm:value("auto", "Load as Required") format_gsm.rmempty = true format_h263 = module:option(ListValue, "format_h263", "Raw h263 data", "") format_h263:value("yes", "Load") format_h263:value("no", "Do Not Load") format_h263:value("auto", "Load as Required") format_h263.rmempty = true format_jpeg = module:option(ListValue, "format_jpeg", "JPEG (Joint Picture Experts Group) Image", "") format_jpeg:value("yes", "Load") format_jpeg:value("no", "Do Not Load") format_jpeg:value("auto", "Load as Required") format_jpeg.rmempty = true format_pcm = module:option(ListValue, "format_pcm", "Raw uLaw 8khz Audio support (PCM)", "") format_pcm:value("yes", "Load") format_pcm:value("no", "Do Not Load") format_pcm:value("auto", "Load as Required") format_pcm.rmempty = true format_pcm_alaw = module:option(ListValue, "format_pcm_alaw", "load => .so ; Raw aLaw 8khz PCM Audio support", "") format_pcm_alaw:value("yes", "Load") format_pcm_alaw:value("no", "Do Not Load") format_pcm_alaw:value("auto", "Load as Required") format_pcm_alaw.rmempty = true format_sln = module:option(ListValue, "format_sln", "Raw Signed Linear Audio support (SLN)", "") format_sln:value("yes", "Load") format_sln:value("no", "Do Not Load") format_sln:value("auto", "Load as Required") format_sln.rmempty = true format_vox = module:option(ListValue, "format_vox", "Dialogic VOX (ADPCM) File Format", "") format_vox:value("yes", "Load") format_vox:value("no", "Do Not Load") format_vox:value("auto", "Load as Required") format_vox.rmempty = true format_wav = module:option(ListValue, "format_wav", "Microsoft WAV format (8000hz Signed Line", "") format_wav:value("yes", "Load") format_wav:value("no", "Do Not Load") format_wav:value("auto", "Load as Required") format_wav.rmempty = true format_wav_gsm = module:option(ListValue, "format_wav_gsm", "Microsoft WAV format (Proprietary GSM)", "") format_wav_gsm:value("yes", "Load") format_wav_gsm:value("no", "Do Not Load") format_wav_gsm:value("auto", "Load as Required") format_wav_gsm.rmempty = true return cbimap
apache-2.0
LegionXI/darkstar
scripts/zones/Al_Zahbi/npcs/Chochoroon.lua
14
1035
----------------------------------- -- Area: Al Zahbi -- NPC: Chochoroon -- Type: Appraiser -- @zone 48 -- @pos -42.739 -1 -45.987 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0104); 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
gwlim/luci
applications/luci-statistics/luasrc/model/cbi/luci_statistics/dns.lua
78
1344
--[[ Luci configuration model for statistics - collectd dns plugin configuration (c) 2008 Freifunk Leipzig / 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$ ]]-- require("luci.sys") m = Map("luci_statistics", translate("DNS Plugin Configuration"), translate( "The dns plugin collects detailled statistics about dns " .. "related traffic on selected interfaces." )) -- collectd_dns config section s = m:section( NamedSection, "collectd_dns", "luci_statistics" ) -- collectd_dns.enable enable = s:option( Flag, "enable", translate("Enable this plugin") ) enable.default = 0 -- collectd_dns.interfaces (Interface) interfaces = s:option( MultiValue, "Interfaces", translate("Monitor interfaces") ) interfaces.widget = "select" interfaces.size = 5 interfaces:depends( "enable", 1 ) interfaces:value("any") for k, v in pairs(luci.sys.net.devices()) do interfaces:value(v) end -- collectd_dns.ignoresources (IgnoreSource) ignoresources = s:option( Value, "IgnoreSources", translate("Ignore source addresses") ) ignoresources.default = "127.0.0.1" ignoresources:depends( "enable", 1 ) return m
apache-2.0
u20024804/skynet
examples/client.lua
67
2101
package.cpath = "luaclib/?.so" package.path = "lualib/?.lua;examples/?.lua" if _VERSION ~= "Lua 5.3" then error "Use lua 5.3" end local socket = require "clientsocket" local proto = require "proto" local sproto = require "sproto" local host = sproto.new(proto.s2c):host "package" local request = host:attach(sproto.new(proto.c2s)) local fd = assert(socket.connect("127.0.0.1", 8888)) local function send_package(fd, pack) local package = string.pack(">s2", pack) socket.send(fd, package) end local function unpack_package(text) local size = #text if size < 2 then return nil, text end local s = text:byte(1) * 256 + text:byte(2) if size < s+2 then return nil, text end return text:sub(3,2+s), text:sub(3+s) end local function recv_package(last) local result result, last = unpack_package(last) if result then return result, last end local r = socket.recv(fd) if not r then return nil, last end if r == "" then error "Server closed" end return unpack_package(last .. r) end local session = 0 local function send_request(name, args) session = session + 1 local str = request(name, args, session) send_package(fd, str) print("Request:", session) end local last = "" local function print_request(name, args) print("REQUEST", name) if args then for k,v in pairs(args) do print(k,v) end end end local function print_response(session, args) print("RESPONSE", session) if args then for k,v in pairs(args) do print(k,v) end end end local function print_package(t, ...) if t == "REQUEST" then print_request(...) else assert(t == "RESPONSE") print_response(...) end end local function dispatch_package() while true do local v v, last = recv_package(last) if not v then break end print_package(host:dispatch(v)) end end send_request("handshake") send_request("set", { what = "hello", value = "world" }) while true do dispatch_package() local cmd = socket.readstdin() if cmd then if cmd == "quit" then send_request("quit") else send_request("get", { what = cmd }) end else socket.usleep(100) end end
mit
naclander/tome
game/modules/tome/data/zones/town-elvala/objects.lua
3
1173
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org load("/data/general/objects/objects-maj-eyal.lua") for i = 1, 8 do local l = mod.class.interface.PartyLore.lore_defs["spellblaze-chronicles-"..i] newEntity{ base = "BASE_LORE", define_as = "SPELLBLAZE_NOTE"..i, subtype = "spellblaze", unique=true, no_unique_lore=true, not_in_stores=false, name = l.name, lore="spellblaze-chronicles-"..i, rarity = false, encumberance = 0, cost = 70, } end
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/particles/generic_ball.lua
1
1890
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org bx = x or 0 by = y or 0 local nb = 0 return { generator = function() local radius = radius local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 local ad = rng.float(0, 360) local a = math.rad(ad) local r = rng.float(0, sradius / 2) local x = r * math.cos(a) local y = r * math.sin(a) local bx = math.floor(x / engine.Map.tile_w) local by = math.floor(y / engine.Map.tile_h) local static = rng.percent(40) return { trail = 1, life = 30, size = 3, sizev = 0, sizea = 0, x = bx + x, xv = 0, xa = 0, y = by + y, yv = 0, ya = 0, dir = a, dirv = 0, dira = 0, vel = sradius / 2 / 30, velv = 0, vela = 0, r = rng.range(rm, rM)/255, rv = 0, ra = 0, g = rng.range(gm, gM)/255, gv = 0, ga = 0, b = rng.range(bm, bM)/255, bv = 0, ba = 0, a = rng.range(am, aM)/255, av = 0.01, aa = 0, } end, }, function(self) if nb < 5 then self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 end end, 5*radius*266
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/particles/bolt_slime.lua
3
1580
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org return { generator = function() local radius = 0 local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 local ad = rng.float(0, 360) local a = math.rad(ad) local r = rng.float(0, sradius / 6) local x = r * math.cos(a) local y = r * math.sin(a) local bx = math.floor(x / engine.Map.tile_w) local by = math.floor(y / engine.Map.tile_h) local static = rng.percent(40) return { trail = 1, life = 6, size = 3, sizev = 0, sizea = 0, x = x, xv = 0, xa = 0, y = y, yv = 0, ya = 0, dir = a, dirv = 0, dira = 0, vel = sradius / 2 / 6, velv = 0, vela = 0, r = 0, rv = 0, ra = 0, g = rng.range(80, 200)/255, gv = 0, ga = 0, b = 0, bv = 0, ba = 0, a = rng.range(80, 220)/255, av = 0, aa = 0, } end, }, function(self) self.ps:emit(30) end, 30*6
gpl-3.0
greasydeal/darkstar
scripts/zones/Labyrinth_of_Onzozo/mobs/Goblin_Shepherd.lua
23
1059
----------------------------------- -- Area: Labyrinth of Onzozo -- MOB: Goblin Shepherd -- Note: Place holder Soulstealer Skullnix ----------------------------------- require("scripts/zones/Labyrinth_of_Onzozo/MobIDs"); ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) checkGoVregime(killer,mob,771,2); checkGoVregime(killer,mob,772,2); checkGoVregime(killer,mob,774,2); local mob = mob:getID(); if (Soulstealer_Skullnix_PH[mob] ~= nil) then local ToD = GetServerVariable("[POP]Soulstealer_Skullnix"); if (ToD <= os.time(t) and GetMobAction(Soulstealer_Skullnix) == 0) then if (math.random((1),(20)) == 5) then UpdateNMSpawnPoint(Soulstealer_Skullnix); GetMobByID(Soulstealer_Skullnix):setRespawnTime(GetMobRespawnTime(mob)); SetServerVariable("[PH]Soulstealer_Skullnix", mob); DeterMob(mob, true); end end end end;
gpl-3.0
Startg/security
plugins/msg-checks.lua
1
11979
--Begin msg_checks.lua By @sudo_star local TIME_CHECK = 2 local function pre_process(msg) local data = load_data(_config.moderation.data) local chat = msg.to.id local user = msg.from.id local is_channel = msg.to.type == "channel" local is_chat = msg.to.type == "chat" local auto_leave = 'auto_leave_bot' local hash = "gp_lang:"..chat local lang = redis:get(hash) if is_channel or is_chat then if msg.text then if msg.text:match("(.*)") then if not data[tostring(msg.to.id)] and not redis:get(auto_leave) and not is_admin(msg) then tdcli.sendMessage(msg.to.id, "", 0, "_This Is Not One Of My_ *Groups*", 0, "md") tdcli.changeChatMemberStatus(chat, our_id, 'Left', dl_cb, nil) end end end if data[tostring(chat)] and data[tostring(chat)]['mutes'] then mutes = data[tostring(chat)]['mutes'] else return end if mutes.mute_all then mute_all = mutes.mute_all else mute_all = 'no' end if mutes.mute_gif then mute_gif = mutes.mute_gif else mute_gif = 'no' end if mutes.mute_photo then mute_photo = mutes.mute_photo else mute_photo = 'no' end if mutes.mute_sticker then mute_sticker = mutes.mute_sticker else mute_sticker = 'no' end if mutes.mute_contact then mute_contact = mutes.mute_contact else mute_contact = 'no' end if mutes.mute_inline then mute_inline = mutes.mute_inline else mute_inline = 'no' end if mutes.mute_game then mute_game = mutes.mute_game else mute_game = 'no' end if mutes.mute_text then mute_text = mutes.mute_text else mute_text = 'no' end if mutes.mute_keyboard then mute_keyboard = mutes.mute_keyboard else mute_keyboard = 'no' end if mutes.mute_forward then mute_forward = mutes.mute_forward else mute_forward = 'no' end if mutes.mute_location then mute_location = mutes.mute_location else mute_location = 'no' end if mutes.mute_document then mute_document = mutes.mute_document else mute_document = 'no' end if mutes.mute_voice then mute_voice = mutes.mute_voice else mute_voice = 'no' end if mutes.mute_audio then mute_audio = mutes.mute_audio else mute_audio = 'no' end if mutes.mute_video then mute_video = mutes.mute_video else mute_video = 'no' end if mutes.mute_tgservice then mute_tgservice = mutes.mute_tgservice else mute_tgservice = 'no' end if data[tostring(chat)] and data[tostring(chat)]['settings'] then settings = data[tostring(chat)]['settings'] else return end if settings.lock_link then lock_link = settings.lock_link else lock_link = 'no' end if settings.lock_tag then lock_tag = settings.lock_tag else lock_tag = 'no' end if settings.lock_pin then lock_pin = settings.lock_pin else lock_pin = 'no' end if settings.lock_arabic then lock_arabic = settings.lock_arabic else lock_arabic = 'no' end if settings.lock_mention then lock_mention = settings.lock_mention else lock_mention = 'no' end if settings.lock_edit then lock_edit = settings.lock_edit else lock_edit = 'no' end if settings.lock_spam then lock_spam = settings.lock_spam else lock_spam = 'no' end if settings.flood then lock_flood = settings.flood else lock_flood = 'no' end if settings.lock_markdown then lock_markdown = settings.lock_markdown else lock_markdown = 'no' end if settings.lock_webpage then lock_webpage = settings.lock_webpage else lock_webpage = 'no' end if msg.adduser or msg.joinuser or msg.deluser then if mute_tgservice == "yes" then del_msg(chat, tonumber(msg.id)) end end if msg.pinned and is_channel then if lock_pin == "yes" then if is_owner(msg) then return end if tonumber(msg.from.id) == our_id then return end local pin_msg = data[tostring(chat)]['pin'] if pin_msg then tdcli.pinChannelMessage(msg.to.id, pin_msg, 1) elseif not pin_msg then tdcli.unpinChannelMessage(msg.to.id) end if lang then tdcli.sendMessage(msg.to.id, msg.id, 0, '<b>User ID :</b> <code>'..msg.from.id..'</code>\n<b>Username :</b> '..('@'..msg.from.username or '<i>No Username</i>')..'\n<i>شما اجازه دسترسی به سنجاق پیام را ندارید، به همین دلیل پیام قبلی مجدد سنجاق میگردد</i>', 0, "html") elseif not lang then tdcli.sendMessage(msg.to.id, msg.id, 0, '<b>User ID :</b> <code>'..msg.from.id..'</code>\n<b>Username :</b> '..('@'..msg.from.username or '<i>No Username</i>')..'\n<i>You Have Not Permission To Pin Message, Last Message Has Been Pinned Again</i>', 0, "html") end end end if not is_mod(msg) then if msg.edited and lock_edit == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.forward_info_ and mute_forward == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.photo_ and mute_photo == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.video_ and mute_video == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.document_ and mute_document == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.sticker_ and mute_sticker == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.animation_ and mute_gif == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.contact_ and mute_contact == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.location_ and mute_location == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.voice_ and mute_voice == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.content_ and mute_keyboard == "yes" then if msg.reply_markup_ and msg.reply_markup_.ID == "ReplyMarkupInlineKeyboard" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end if tonumber(msg.via_bot_user_id_) ~= 0 and mute_inline == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.game_ and mute_game == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.audio_ and mute_audio == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.media.caption then local link_caption = msg.media.caption:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.media.caption:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Dd][Oo][Gg]/") or msg.media.caption:match("[Tt].[Mm][Ee]/") or msg.media.caption:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if link_caption and lock_link == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end local tag_caption = msg.media.caption:match("@") or msg.media.caption:match("#") if tag_caption and lock_tag == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if is_filter(msg, msg.media.caption) then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end local arabic_caption = msg.media.caption:match("[\216-\219][\128-\191]") if arabic_caption and lock_arabic == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end if msg.text then local _nl, ctrl_chars = string.gsub(msg.text, '%c', '') local _nl, real_digits = string.gsub(msg.text, '%d', '') if lock_spam == "yes" then if string.len(msg.text) > 2049 or ctrl_chars > 40 or real_digits > 2000 then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end local link_msg = msg.text:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.text:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Dd][Oo][Gg]/") or msg.text:match("[Tt].[Mm][Ee]/") or msg.text:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if link_msg and lock_link == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end local tag_msg = msg.text:match("@") or msg.text:match("#") if tag_msg and lock_tag == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if is_filter(msg, msg.text) then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end local arabic_msg = msg.text:match("[\216-\219][\128-\191]") if arabic_msg and lock_arabic == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.text:match("(.*)") and mute_text == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end if mute_all == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end if msg.content_.entities_ and msg.content_.entities_[0] then if msg.content_.entities_[0].ID == "MessageEntityMentionName" then if lock_mention == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end if msg.content_.entities_[0].ID == "MessageEntityUrl" or msg.content_.entities_[0].ID == "MessageEntityTextUrl" then if lock_webpage == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end if msg.content_.entities_[0].ID == "MessageEntityBold" or msg.content_.entities_[0].ID == "MessageEntityCode" or msg.content_.entities_[0].ID == "MessageEntityPre" or msg.content_.entities_[0].ID == "MessageEntityItalic" then if lock_markdown == "yes" then if is_channel then del_msg(chat, tonumber(msg.id)) elseif is_chat then kick_user(user, chat) end end end end if msg.to.type ~= 'pv' then if lock_flood == "yes" then local hash = 'user:'..user..':msgs' local msgs = tonumber(redis:get(hash) or 0) local NUM_MSG_MAX = 5 if data[tostring(chat)] then if data[tostring(chat)]['settings']['num_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(chat)]['settings']['num_msg_max']) end end if msgs > NUM_MSG_MAX then if is_mod(msg) then return end if msg.adduser and msg.from.id then return end if msg.from.username then user_name = "@"..msg.from.username else user_name = msg.from.first_name end if redis:get('sender:'..user..':flood') then return else del_msg(chat, msg.id) kick_user(user, chat) if not lang then tdcli.sendMessage(chat, msg.id, 0, "_User_ "..user_name.." `[ "..user.." ]` _has been_ *kicked* _because of_ *flooding*", 0, "md") elseif lang then tdcli.sendMessage(chat, msg.id, 0, "_کاربر_ "..user_name.." `[ "..user.." ]` _به دلیل ارسال پیام های مکرر اخراج شد_", 0, "md") end redis:setex('sender:'..user..':flood', 30, true) end end redis:setex(hash, TIME_CHECK, msgs+1) end end end end end return { patterns = {}, pre_process = pre_process } --End msg_checks.lua--
gpl-3.0
LegionXI/darkstar
scripts/zones/Kazham/npcs/Hari_Pakhroib.lua
29
3020
----------------------------------- -- Area: Kazham -- NPC: Hari Pakhroib -- Starts and Finishes Quest: Greetings to the Guardian ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/titles"); require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) Guardian = player:getQuestStatus(OUTLANDS,GREETINGS_TO_THE_GUARDIAN); Pamamas = player:getVar("PamamaVar"); pfame = player:getFameLevel(KAZHAM) needToZone = player:needToZone(); if (Guardian == QUEST_ACCEPTED) then if (Pamamas == 1) then player:startEvent(0x0047); --Finish Quest else player:startEvent(0x0045,0,4596); --Reminder Dialogue end elseif (Guardian == QUEST_AVAILABLE and pfame >= 7) then player:startEvent(0x0044,4596,4596,4596); --Start Quest elseif (Guardian == QUEST_COMPLETED and needToZone == false) then if (Pamamas == 2) then player:startEvent(0x0047); --Finish quest dialogue (no different csid between initial and repeats) else player:startEvent(0x0048); --Dialogue for after completion of quest end elseif (Guardian == QUEST_COMPLETED and needToZone == true) then player:startEvent(0x0048); else player:startEvent(0x0054); --Standard 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 == 0x0044 and option == 1) then player:addQuest(OUTLANDS,GREETINGS_TO_THE_GUARDIAN); player:setVar("PamamaVar",0); elseif (csid == 0x0047) then if (Pamamas == 1) then --First completion of quest; set title, complete quest, and give higher fame player:addGil(GIL_RATE*5000); player:messageSpecial(GIL_OBTAINED, 5000); player:completeQuest(OUTLANDS,GREETINGS_TO_THE_GUARDIAN); player:addFame(WINDURST,100); player:addTitle(KAZHAM_CALLER); player:setVar("PamamaVar",0); player:needToZone(true); elseif (Pamamas == 2) then --Repeats of quest; give only gil and less fame player:addGil(GIL_RATE*5000); player:messageSpecial(GIL_OBTAINED, 5000); player:addFame(WINDURST,30); player:setVar("PamamaVar",0); player:needToZone(true); end end end;
gpl-3.0
LegionXI/darkstar
scripts/globals/abilities/feral_howl.lua
58
3525
--------------------------------------------------- -- Ability: Feral Howl -- Terrorizes the target. -- Obtained: Beastmaster Level 75 -- Recast Time: 0:05:00 -- Duration: Apprx. 0:00:01 - 0:00:10 --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) return 0,0; end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local modAcc = player:getMerit(MERIT_FERAL_HOWL); --printf("modAcc : %u",modAcc); local feralHowlMod = player:getMod(MOD_FERAL_HOWL_DURATION); --printf("feralHowlMod : %u",feralHowlMod); local duration = 10; --printf("Duration : %u",duration); if target:hasStatusEffect(EFFECT_TERROR) == true or target:hasStatusEffect(EFFECT_STUN) == true then -- effect already on, or target stunned, do nothing -- reserved for miss based on target already having stun or terror effect active else -- Calculate duration. if feralHowlMod >= 1 then -- http://wiki.ffxiclopedia.org/wiki/Monster_Jackcoat_(Augmented)_%2B2 -- add 20% duration per merit level if wearing Augmented Monster Jackcoat +2 duration = (duration + (duration * modAcc * 0.04)); -- modAcc returns intervals of 5. (0.2 / 5 = 0.04) --printf("Duration post merit : %u",duration); end end -- Leaving potency at 1 since I am not sure it applies with this ability... no known way to increase resistance local potency = 1; --printf("Potency : %u",potency); -- Grabbing variables for terror accuracy. Unknown if ability is stat based. Using Beastmaster's level versus Target's level local pLvl = player:getMainLvl(); --printf("player level : %u",pLvl); local mLvl = target:getMainLvl(); --printf("mob level : %u",mLvl); -- Checking level difference between the target and the BST local dLvl = (mLvl - pLvl); --printf("level difference : %u",dLvl); -- Determining what level of resistance the target will have to the ability local resist = 0 dLvl = (10 * dLvl) - modAcc; -- merits increase accuracy by 5% per level if dLvl <= 0 then -- default level difference to 1 if mob is equal to the Beastmaster's level or less. resist = 1; --printf("resist : %u",resist); else resist = math.random(1,(dLvl + 100)); -- calculate chance of missing based on number of levels mob is higher than you. Target gets 10% resist per level over BST --printf("resist : %u",resist); end -- Adjusting duration based on resistance. Only fair way I could see to do it... if resist >= 20 then if (resist / 10) >= (duration) then duration = (duration - math.random(1,(duration - 2))); --printf("Duration post resist : %u",duration); else duration = (duration - math.random(1,(resist / 10))); --printf("Duration post resist : %u",duration); end end -- execute ability based off of resistance value; space reserved for resist message if resist <= 90 then -- still experimental. not exactly sure how to calculate hit % target:addStatusEffect(EFFECT_TERROR,potency,0,duration); else -- reserved for text related to resist end return EFFECT_TERROR; end;
gpl-3.0
naclander/tome
game/modules/tome/data/zones/blighted-ruins/grids.lua
3
1406
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org load("/data/general/grids/basic.lua") newEntity{ define_as = "SUMMON_CIRCLE", name = "unholy circle", image = "terrain/marble_floor.png", add_mos = {{image=resolvers.generic(function() return "object/candle_dark"..rng.range(1,3)..".png" end)}}, force_clone = true, display = ';', color=colors.GOLD, back_color=colors.GREY, always_remember = true, does_block_move = true, } newEntity{ define_as = "SUMMON_CIRCLE_BROKEN", name = "broken unholy circle", image = "terrain/marble_floor.png", add_mos = {{image="object/candle_dark4.png"}}, display = '.', color=colors.GOLD, back_color=colors.GREY, always_remember = true, }
gpl-3.0
rigeirani/btg
plugins/gnuplot.lua
622
1813
--[[ * Gnuplot plugin by psykomantis * dependencies: * - gnuplot 5.00 * - libgd2-xpm-dev (on Debian distr) for more info visit: https://libgd.github.io/pages/faq.html * ]] -- Gnuplot needs absolute path for the plot, so i run some commands to find where we are local outputFile = io.popen("pwd","r") io.input(outputFile) local _pwd = io.read("*line") io.close(outputFile) local _absolutePlotPath = _pwd .. "/data/plot.png" local _scriptPath = "./data/gnuplotScript.gpl" do local function gnuplot(msg, fun) local receiver = get_receiver(msg) -- We generate the plot commands local formattedString = [[ set grid set terminal png set output "]] .. _absolutePlotPath .. [[" plot ]] .. fun local file = io.open(_scriptPath,"w"); file:write(formattedString) file:close() os.execute("gnuplot " .. _scriptPath) os.remove (_scriptPath) return _send_photo(receiver, _absolutePlotPath) end -- Check all dependencies before executing local function checkDependencies() local status = os.execute("gnuplot -h") if(status==true) then status = os.execute("gnuplot -e 'set terminal png'") if(status == true) then return 0 -- OK ready to go! else return 1 -- missing libgd2-xpm-dev end else return 2 -- missing gnuplot end end local function run(msg, matches) local status = checkDependencies() if(status == 0) then return gnuplot(msg,matches[1]) elseif(status == 1) then return "It seems that this bot miss a dependency :/" else return "It seems that this bot doesn't have gnuplot :/" end end return { description = "use gnuplot through telegram, only plot single variable function", usage = "!gnuplot [single variable function]", patterns = {"^!gnuplot (.+)$"}, run = run } end
gpl-2.0
shadog/shado
admin.lua
27
10309
local function set_bot_photo(msg, success, result) local receiver = get_receiver(msg) if success then local file = 'data/photos/bot.jpg' print('File downloaded to:', result) os.rename(result, file) print('File moved to:', file) set_profile_photo(file, ok_cb, false) send_large_msg(receiver, 'Photo changed!', ok_cb, false) redis:del("bot:photo") else print('Error downloading: '..msg.id) send_large_msg(receiver, 'Failed, please try again!', ok_cb, false) end end --Function to add log supergroup local function logadd(msg) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) local GBan_log = 'GBan_log' if not data[tostring(GBan_log)] then data[tostring(GBan_log)] = {} save_data(_config.moderation.data, data) end data[tostring(GBan_log)][tostring(msg.to.id)] = msg.to.peer_id save_data(_config.moderation.data, data) local text = 'Log_SuperGroup has has been set!' reply_msg(msg.id,text,ok_cb,false) return end --Function to remove log supergroup local function logrem(msg) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) local GBan_log = 'GBan_log' if not data[tostring(GBan_log)] then data[tostring(GBan_log)] = nil save_data(_config.moderation.data, data) end data[tostring(GBan_log)][tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) local text = 'Log_SuperGroup has has been removed!' reply_msg(msg.id,text,ok_cb,false) return end local function parsed_url(link) local parsed_link = URL.parse(link) local parsed_path = URL.parse_path(parsed_link.path) return parsed_path[2] end local function get_contact_list_callback (cb_extra, success, result) local text = " " for k,v in pairs(result) do if v.print_name and v.id and v.phone then text = text..string.gsub(v.print_name , "_" , " ").." ["..v.id.."] = "..v.phone.."\n" end end local file = io.open("contact_list.txt", "w") file:write(text) file:flush() file:close() send_document("user#id"..cb_extra.target,"contact_list.txt", ok_cb, false)--.txt format local file = io.open("contact_list.json", "w") file:write(json:encode_pretty(result)) file:flush() file:close() send_document("user#id"..cb_extra.target,"contact_list.json", ok_cb, false)--json format end local function get_dialog_list_callback(cb_extra, success, result) local text = "" for k,v in pairsByKeys(result) do if v.peer then if v.peer.type == "chat" then text = text.."group{"..v.peer.title.."}["..v.peer.id.."]("..v.peer.members_num..")" else if v.peer.print_name and v.peer.id then text = text.."user{"..v.peer.print_name.."}["..v.peer.id.."]" end if v.peer.username then text = text.."("..v.peer.username..")" end if v.peer.phone then text = text.."'"..v.peer.phone.."'" end end end if v.message then text = text..'\nlast msg >\nmsg id = '..v.message.id if v.message.text then text = text .. "\n text = "..v.message.text end if v.message.action then text = text.."\n"..serpent.block(v.message.action, {comment=false}) end if v.message.from then if v.message.from.print_name then text = text.."\n From > \n"..string.gsub(v.message.from.print_name, "_"," ").."["..v.message.from.id.."]" end if v.message.from.username then text = text.."( "..v.message.from.username.." )" end if v.message.from.phone then text = text.."' "..v.message.from.phone.." '" end end end text = text.."\n\n" end local file = io.open("dialog_list.txt", "w") file:write(text) file:flush() file:close() send_document("user#id"..cb_extra.target,"dialog_list.txt", ok_cb, false)--.txt format local file = io.open("dialog_list.json", "w") file:write(json:encode_pretty(result)) file:flush() file:close() send_document("user#id"..cb_extra.target,"dialog_list.json", ok_cb, false)--json format end -- Returns the key (index) in the config.enabled_plugins table local function plugin_enabled( name ) for k,v in pairs(_config.enabled_plugins) do if name == v then return k end end -- If not found return false end -- Returns true if file exists in plugins folder local function plugin_exists( name ) for k,v in pairs(plugins_names()) do if name..'.lua' == v then return true end end return false end local function reload_plugins( ) plugins = {} return load_plugins() end local function run(msg,matches) local receiver = get_receiver(msg) local group = msg.to.id local print_name = user_print_name(msg.from):gsub("‮", "") local name_log = print_name:gsub("_", " ") if not is_admin1(msg) then return end if msg.media then if msg.media.type == 'photo' and redis:get("bot:photo") then if redis:get("bot:photo") == 'waiting' then load_photo(msg.id, set_bot_photo, msg) end end end if matches[1] == "setbotphoto" then redis:set("bot:photo", "waiting") return 'Please send me bot photo now' end if matches[1] == "markread" then if matches[2] == "on" then redis:set("bot:markread", "on") return "Mark read > on" end if matches[2] == "off" then redis:del("bot:markread") return "Mark read > off" end return end if matches[1] == "pm" then local text = "Message From "..(msg.from.username or msg.from.last_name).."\n\nMessage : "..matches[3] send_large_msg("user#id"..matches[2],text) return "Message has been sent" end if matches[1] == "pmblock" then if is_admin2(matches[2]) then return "You can't block admins" end block_user("user#id"..matches[2],ok_cb,false) return "User blocked" end if matches[1] == "pmunblock" then unblock_user("user#id"..matches[2],ok_cb,false) return "User unblocked" end if matches[1] == "import" then--join by group link local hash = parsed_url(matches[2]) import_chat_link(hash,ok_cb,false) end if matches[1] == "contactlist" then if not is_sudo(msg) then-- Sudo only return end get_contact_list(get_contact_list_callback, {target = msg.from.id}) return "I've sent contact list with both json and text format to your private" end if matches[1] == "delcontact" then if not is_sudo(msg) then-- Sudo only return end del_contact("user#id"..matches[2],ok_cb,false) return "User "..matches[2].." removed from contact list" end if matches[1] == "addcontact" and is_sudo(msg) then phone = matches[2] first_name = matches[3] last_name = matches[4] add_contact(phone, first_name, last_name, ok_cb, false) return "User With Phone +"..matches[2].." has been added" end if matches[1] == "sendcontact" and is_sudo(msg) then phone = matches[2] first_name = matches[3] last_name = matches[4] send_contact(get_receiver(msg), phone, first_name, last_name, ok_cb, false) end if matches[1] == "mycontact" and is_sudo(msg) then if not msg.from.phone then return "I must Have Your Phone Number!" end phone = msg.from.phone first_name = (msg.from.first_name or msg.from.phone) last_name = (msg.from.last_name or msg.from.id) send_contact(get_receiver(msg), phone, first_name, last_name, ok_cb, false) end if matches[1] == "dialoglist" then get_dialog_list(get_dialog_list_callback, {target = msg.from.id}) return "I've sent a group dialog list with both json and text format to your private messages" end if matches[1] == "whois" then user_info("user#id"..matches[2],user_info_callback,{msg=msg}) end if matches[1] == "sync_gbans" then if not is_sudo(msg) then-- Sudo only return end local url = "http://seedteam.org/Teleseed/Global_bans.json" local SEED_gbans = http.request(url) local jdat = json:decode(SEED_gbans) for k,v in pairs(jdat) do redis:hset('user:'..v, 'print_name', k) banall_user(v) print(k, v.." Globally banned") end end if matches[1] == 'reload' then receiver = get_receiver(msg) reload_plugins(true) post_msg(receiver, "Reloaded!", ok_cb, false) return "Reloaded!" end --[[*For Debug* if matches[1] == "vardumpmsg" and is_admin1(msg) then local text = serpent.block(msg, {comment=false}) send_large_msg("channel#id"..msg.to.id, text) end]] if matches[1] == 'updateid' then local data = load_data(_config.moderation.data) local long_id = data[tostring(msg.to.id)]['long_id'] if not long_id then data[tostring(msg.to.id)]['long_id'] = msg.to.peer_id save_data(_config.moderation.data, data) return "Updated ID" end end if matches[1] == 'addlog' and not matches[2] then if is_log_group(msg) then return "Already a Log_SuperGroup" end print("Log_SuperGroup "..msg.to.title.."("..msg.to.id..") added") savelog(msg.to.id, name_log.." ["..msg.from.id.."] added Log_SuperGroup") logadd(msg) end if matches[1] == 'remlog' and not matches[2] then if not is_log_group(msg) then return "Not a Log_SuperGroup" end print("Log_SuperGroup "..msg.to.title.."("..msg.to.id..") removed") savelog(msg.to.id, name_log.." ["..msg.from.id.."] added Log_SuperGroup") logrem(msg) end return end local function pre_process(msg) if not msg.text and msg.media then msg.text = '['..msg.media.type..']' end return msg end return { patterns = { "^[#!/](pm) (%d+) (.*)$", "^[#!/](import) (.*)$", "^[#!/](pmunblock) (%d+)$", "^[#!/](pmblock) (%d+)$", "^[#!/](markread) (on)$", "^[#!/](markread) (off)$", "^[#!/](setbotphoto)$", "^[#!/](contactlist)$", "^[#!/](dialoglist)$", "^[#!/](delcontact) (%d+)$", "^[#!/](addcontact) (.*) (.*) (.*)$", "^[#!/](sendcontact) (.*) (.*) (.*)$", "^[#!/](mycontact)$", "^[#/!](reload)$", "^[#/!](updateid)$", "^[#/!](sync_gbans)$", "^[#/!](addlog)$", "^[#/!](remlog)$", "%[(photo)%]", }, run = run, pre_process = pre_process } --By @imandaneshi :) --https://github.com/SEEDTEAM/TeleSeed/blob/test/plugins/admin.lua ---Modified by @Rondoozle for supergroups
gpl-2.0
greasydeal/darkstar
scripts/zones/QuBia_Arena/bcnms/those_who_lurk_in_shadows.lua
59
2394
----------------------------------- -- Area: Qu'Bia Arena -- NPC: Those Who Lurk in Shadows -- @pos -221 -24 19 206 ----------------------------------- package.loaded["scripts/zones/QuBia_Arena/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/QuBia_Arena/TextIDs"); ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if (player:hasKeyItem(MARK_OF_SEED)) then player:delKeyItem(MARK_OF_SEED); end if (leavecode == 2) then -- Play end CS. Need time and battle id for record keeping + storage player:addExp(700); if (player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_III) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,20,0); else -- Gives skip dialog if previously completed player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,20,1); end elseif (leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if (csid == 0x7d01) then if (player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_III) then player:completeMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_III); player:addMission(ACP,REMEMBER_ME_IN_YOUR_DREAMS); end if (player:hasKeyItem(IVORY_KEY) == false and player:getCurrentMission(ACP) >= THOSE_WHO_LURK_IN_SHADOWS_III) then player:addKeyItem(IVORY_KEY); player:setVar("LastIvoryKey", os.date("%j")); player:messageSpecial(KEYITEM_OBTAINED,IVORY_KEY); end end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/QuBia_Arena/bcnms/those_who_lurk_in_shadows.lua
59
2394
----------------------------------- -- Area: Qu'Bia Arena -- NPC: Those Who Lurk in Shadows -- @pos -221 -24 19 206 ----------------------------------- package.loaded["scripts/zones/QuBia_Arena/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/QuBia_Arena/TextIDs"); ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if (player:hasKeyItem(MARK_OF_SEED)) then player:delKeyItem(MARK_OF_SEED); end if (leavecode == 2) then -- Play end CS. Need time and battle id for record keeping + storage player:addExp(700); if (player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_III) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,20,0); else -- Gives skip dialog if previously completed player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,20,1); end elseif (leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if (csid == 0x7d01) then if (player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_III) then player:completeMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_III); player:addMission(ACP,REMEMBER_ME_IN_YOUR_DREAMS); end if (player:hasKeyItem(IVORY_KEY) == false and player:getCurrentMission(ACP) >= THOSE_WHO_LURK_IN_SHADOWS_III) then player:addKeyItem(IVORY_KEY); player:setVar("LastIvoryKey", os.date("%j")); player:messageSpecial(KEYITEM_OBTAINED,IVORY_KEY); end end end;
gpl-3.0
ciarand/luvit.io
libs/controllers/blog.lua
3
1650
local renderTemplate = require('render-template') local pathJoin = require('luvi').path.join local fs = require('coro-fs').chroot(pathJoin(module.dir, "../..")) local loadContent = require('load-content') local function loadArticles() local articles = {} for entry in fs.scandir("articles") do if entry.type == "file" and entry.name:match("%.md$") then local name = entry.name:match("^(.*)%.md$") local data = loadContent("articles", name) if data.published then articles[#articles + 1] = data articles[name] = data end end end table.sort(articles, function (a, b) return a.published > b.published end) for i = 1, #articles do local article = articles[i] if i > 1 then article.after = articles[i - 1] end if i < #articles then article.before = articles[i + 1] end end return articles end function exports.index(req, res, go) local articles = loadArticles() if #articles == 0 then return renderTemplate(res, "empty", { title = "Blog - Luvit.io", }) end -- Redirect to the newest published article res.code = 302 res.headers.Location = "/blog/" .. articles[1].name .. ".html" res.body = nil end function exports.tags(req, res, go) console.log("TODO: Implement tags") return go() end function exports.article(req, res, go) local name = req.params.name local articles = loadArticles() local article = articles[name] or loadContent("articles", name) if not article then return go() end return renderTemplate(res, "article", { title = article.title .. " - Blog - Luvit.io", article = article }) end
apache-2.0
lichtl/darkstar
scripts/zones/Sacrarium/npcs/Large_Keyhole.lua
27
1422
----------------------------------- -- Area: Sacrarium -- NPC: Large Keyhole -- Notes: Used to open R. Gate -- @pos 100.231 -1.414 51.700 28 ----------------------------------- package.loaded["scripts/zones/Sacrarium/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Sacrarium/TextIDs"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local LargeKeyholeID = npc:getID(); local DoorID = GetNPCByID(LargeKeyholeID):getID() - 2; if (player:hasKeyItem(TEMPLE_KNIGHT_KEY)) then GetNPCByID(DoorID):openDoor(15); else player:messageSpecial(LARGE_KEYHOLE); end end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local Timemax=GetServerVariable("SACRARIUM_Coral_Key_trade")+10; local CurentTime=os.time(); local LargeKeyholeID = npc:getID(); local DoorID = GetNPCByID(LargeKeyholeID):getID() - 2; if (trade:hasItemQty(1658,1) and trade:getItemCount() == 1) then if (CurentTime < Timemax) then GetNPCByID(DoorID):openDoor(15); SetServerVariable("SACRARIUM_Coral_Key_trade",0); end end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) end;
gpl-3.0
RunAwayDSP/darkstar
scripts/globals/weaponskills/asuran_fists.lua
10
1711
----------------------------------- -- Asuran Fists -- Hand-to-Hand weapon skill -- Skill Level: 250 -- Delivers an eightfold attack. params.accuracy varies with TP. -- In order to obtain Asuran Fists, the quest The Walls of Your Mind must be completed. -- Due to the 95% params.accuracy cap there is only a 66% chance of all 8 hits landing, so approximately a one third chance of missing some of the hits at the cap. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget, Soil Gorget & Flame Gorget. -- Aligned with the Shadow Belt, Soil Belt & Flame Belt. -- Element: None -- Modifiers: STR:10% VIT:10% -- 100%TP 200%TP 300%TP -- 1.00 1.00 1.00 ----------------------------------- require("scripts/globals/status") require("scripts/globals/settings") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.numHits = 8 params.ftp100 = 1 params.ftp200 = 1 params.ftp300 = 1 params.str_wsc = 0.1 params.dex_wsc = 0.0 params.vit_wsc = 0.1 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0 params.canCrit = false params.acc100 = 0.8 params.acc200= 0.9 params.acc300= 1 params.atk100 = 1; params.atk200 = 1; params.atk300 = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.15 params.vit_wsc = 0.15 end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar) return tpHits, extraHits, criticalHit, damage end
gpl-3.0
NiLuJe/koreader
frontend/ui/widget/screensaverwidget.lua
3
7785
local Device = require("device") local Event = require("ui/event") local Geom = require("ui/geometry") local GestureRange = require("ui/gesturerange") local FrameContainer = require("ui/widget/container/framecontainer") local InfoMessage = require("ui/widget/infomessage") local InputContainer = require("ui/widget/container/inputcontainer") local UIManager = require("ui/uimanager") local util = require("util") local _ = require("gettext") local Screen = Device.screen local ScreenSaverWidget = InputContainer:extend{ name = "ScreenSaver", widget = nil, background = nil, } function ScreenSaverWidget:init() if Device:hasKeys() then self.key_events.AnyKeyPressed = { { Device.input.group.Any } } end if Device:isTouchDevice() then if G_reader_settings:readSetting("screensaver_delay") == "gesture" then self:setupGestureEvents() end if not self.has_exit_screensaver_gesture then -- Exit with gesture not enabled, or no configured gesture found: allow exiting with tap local range = Geom:new{ x = 0, y = 0, w = Screen:getWidth(), h = Screen:getHeight(), } self.ges_events.Tap = { GestureRange:new{ ges = "tap", range = range } } end end self:update() end function ScreenSaverWidget:setupGestureEvents() -- The configured gesture(s) won't trigger, because this widget is at top -- of the UI stack and will prevent ReaderUI/Filemanager from getting -- and handling any configured gesture event. -- We need to find all the ones configured for the "exit_screensaver" action, -- and clone them so they are handled by this widget. local ReaderUI = require("apps/reader/readerui") local ui = ReaderUI:_getRunningInstance() if not ui then local FileManager = require("apps/filemanager/filemanager") ui = FileManager.instance end if ui and ui.gestures and ui.gestures.gestures then local multiswipe_already_met = false for gesture, actions in pairs(ui.gestures.gestures) do if util.stringStartsWith(gesture, "multiswipe") then -- All multiswipes are handled by the single handler for "multiswipe" -- We only need to clone one of them gesture = "multiswipe" end if actions["exit_screensaver"] and (gesture ~= "multiswipe" or not multiswipe_already_met) then if gesture == "multiswipe" then multiswipe_already_met = true end -- Clone the gesture found in our self.ges_events local ui_gesture = ui._zones[gesture] if ui_gesture and ui_gesture.handler then -- We can reuse its GestureRange object self.ges_events[gesture] = { ui_gesture.gs_range } -- For each of them, we need a distinct event and its handler. -- This handler will call the original handler (created by gestures.koplugin) -- which, after some checks (like swipe distance and direction, and multiswipe -- directions), will emit normally the configured real ExitScreensaver event, -- that this widget (being at top of the UI stack) will get and that -- onExitScreensaver() will handle. local event_name = "TriggerExitScreensaver_" .. gesture self.ges_events[gesture].event = event_name self["on"..event_name] = function(this, args, ev) ui_gesture.handler(ev) return true end end end end end if next(self.ges_events) then -- we found a gesture configured self.has_exit_screensaver_gesture = true -- Override handleEvent(), so we can stop any event from propagating to widgets -- below this one (we may get some from other multiswipe as the handler does -- not filter the one we are insterested with, but also when multiple actions -- are assigned to a single gesture). self.handleEvent = function(this, event) InputContainer.handleEvent(this, event) return true end self.key_events = {} -- also disable exit with keys end end function ScreenSaverWidget:showWaitForGestureMessage(msg) -- We just paint an InfoMessage on screen directly: we don't want -- another widget that we would need to prevent catching events local infomsg = InfoMessage:new{ text = self.has_exit_screensaver_gesture and _("Waiting for specific gesture to exit screensaver.") or _("No exit screensaver gesture configured. Tap to exit.") } infomsg:paintTo(Screen.bb, 0, 0) infomsg:onShow() -- get the screen refreshed infomsg:free() end function ScreenSaverWidget:update() self.height = Screen:getHeight() self.width = Screen:getWidth() self.region = Geom:new{ x = 0, y = 0, w = self.width, h = self.height, } self.main_frame = FrameContainer:new{ radius = 0, bordersize = 0, padding = 0, margin = 0, background = self.background, width = self.width, height = self.height, self.widget, } self.dithered = true self[1] = self.main_frame UIManager:setDirty(self, function() return "full", self.main_frame.dimen end) end function ScreenSaverWidget:onShow() UIManager:setDirty(self, function() return "full", self.main_frame.dimen end) return true end function ScreenSaverWidget:onTap(_, ges) if ges.pos:intersectWith(self.main_frame.dimen) then self:onClose() end return true end function ScreenSaverWidget:onClose() -- If we happened to shortcut a delayed close via user input, unschedule it to avoid a spurious refresh. local Screensaver = require("ui/screensaver") if Screensaver.delayed_close then UIManager:unschedule(Screensaver.close_widget) end UIManager:close(self) return true end ScreenSaverWidget.onAnyKeyPressed = ScreenSaverWidget.onClose ScreenSaverWidget.onExitScreensaver = ScreenSaverWidget.onClose function ScreenSaverWidget:onCloseWidget() Device.screen_saver_mode = false Device.screen_saver_lock = false -- Restore to previous rotation mode, if need be. if Device.orig_rotation_mode then Screen:setRotationMode(Device.orig_rotation_mode) Device.orig_rotation_mode = nil end -- Make it full-screen (self.main_frame.dimen might be in a different orientation, and it's already full-screen anyway...) UIManager:setDirty(nil, function() return "full" end) -- Will come after the Resume event, iff screensaver_delay is set. -- Comes *before* it otherwise. UIManager:broadcastEvent(Event:new("OutOfScreenSaver")) end function ScreenSaverWidget:onResume() -- If we actually catch this event, it means screensaver_delay is set. -- Tell Device about it, so that further power button presses while we're still shown send us back to suspend. -- NOTE: This only affects devices where we handle Power events ourselves (i.e., rely on Device -> Generic's onPowerEvent), -- and it *always* implies that Device.screen_saver_mode is true. Device.screen_saver_lock = true end function ScreenSaverWidget:onSuspend() -- Also flip this back on suspend, in case we suspend again on a delayed screensaver (e.g., via SleepCover or AutoSuspend). Device.screen_saver_lock = false end return ScreenSaverWidget
agpl-3.0
inmatarian/bronxcombat1999
color.lua
1
4739
-- Color flyweights local color local unpack = unpack or table.unpack local function clamp(x, min, max) if x < min then return min end if x > max then return max end return x end local function hsl2rgb(hue, sat, lit) hue = clamp(hue or 360, 0, 360) sat = clamp(sat or 1, 0, 1) lit = clamp(lit or 1, 0, 1) local chroma = (1 - math.abs(2*lit - 1)) * sat local h = hue / 60 local x = (1 - math.abs(h%2 -1)) * chroma local r, g, b if h < 1 then r, g, b = chroma, x, 0 elseif h < 2 then r, g, b = x, chroma, 0 elseif h < 3 then r, g, b = 0, chroma, x elseif h < 4 then r, g, b = 0, x, chroma elseif h < 5 then r, g, b = x, 0, chroma else r, g, b = chroma, 0, x end local m = lit - chroma/2 return (r+m)*255, (g+m)*255, (b+m)*255 end local function rgb2hsl(r, g, b) r = clamp(r or 255, 0, 255) / 255.0 g = clamp(g or 255, 0, 255) / 255.0 b = clamp(b or 255, 0, 255) / 255.0 local max, min = math.max(r, g, b), math.min(r, g, b) local lit = (max + min) / 2 local hue, sat = 0, 0 if max ~= min then local d = max - min sat = (max - min) / ((sat > 0.5) and (2 - max - min) or (max + min)) local maxhalf = max / 2 local dr = (((max-r) / 6) + maxhalf) / max local dg = (((max-g) / 6) + maxhalf) / max local db = (((max-b) / 6) + maxhalf) / max if max == r then hue = db + dg elseif max == g then hue = (1/3) + dr - db else hue = (2/3) + dg - dr end while hue < 0 do hue = hue + 1 end while hue > 1 do hue = hue - 1 end end return hue * 360, sat, lit end local cache = {} local function makecolor(r, g, b, a) r = clamp(r or 255, 0, 255) g = clamp(g or 255, 0, 255) b = clamp(b or 255, 0, 255) a = clamp(a or 255, 0, 255) local s = string.format("#%02X%02X%02X%02X", r, g, b, a) local c = cache[s] if c == nil then c = setmetatable({ r, g, b, a }, color) cache[s] = c end return c end color = setmetatable({ hsl = function(hue, sat, lit, alpha) local r, g, b = hsl2rgb(hue, sat, lit) return makecolor(r, g, b, alpha) end, __index = { 255, 255, 255, 255, red = function(self, v) if v == nil then return self[1] end return makecolor(v, self[2], self[3], self[4]) end, green = function(self, v) if v == nil then return self[2] end return makecolor(self[1], v, self[3], self[4]) end, blue = function(self, v) if v == nil then return self[3] end return makecolor(self[1], self[2], v, self[4]) end, alpha = function(self, v) if v == nil then return self[4] end return makecolor(self[1], self[2], self[3], v) end, rgb = function(self, r, g, b) if r == nil then return self[1], self[2], self[3] end return makecolor(r, g, b, self[4]) end, rgba = function(self, r, g, b, a) if r == nil then return self[1], self[2], self[3], self[4] end return makecolor(r, g, b, a) end, hsl = function(self, h, s, l) if h == nil then return rgb2hsl(self[1], self[2], self[3]) end return color.hsl(h, s, l, self[4]) end, hue = function(self, v) local h, s, l = rgb2hsl(self[1], self[2], self[3]) if v == nil then return h end return color.hsl(v, s, l) end, saturation = function(self, v) local h, s, l = rgb2hsl(self[1], self[2], self[3]) if v == nil then return s end return color.hsl(h, v, l) end, lightness = function(self, v) local h, s, l = rgb2hsl(self[1], self[2], self[3]) if v == nil then return l end return color.hsl(h, s, v) end, } }, { __call = function(self, r, g, b, a) return makecolor(r, b, g, a) end, }) for _, row in ipairs { { "BLACK", 0, 0, 0, }, { "BLUE", 0, 0, 255, }, { "BROWN", 170, 85, 0, }, { "CYAN", 0, 255, 255, }, { "GRAY", 85, 85, 85, }, { "GREEN", 0, 255, 0, }, { "MAGENTA", 255, 0, 255, }, { "MAROON", 170, 0, 0, }, { "MIDNIGHT", 0, 0, 85, }, { "NAVY", 0, 0, 170, }, { "OLIVE", 170, 170, 0, }, { "ORANGE", 255, 170, 0, }, { "ORANGERED", 255, 85, 0, }, { "PURPLE", 170, 0, 170, }, { "RED", 255, 0, 0, }, { "SILVER", 170, 170, 170, }, { "TEAL", 0, 170, 170, }, { "WHITE", 255, 255, 255, }, { "YELLOW", 255, 255, 0, }, { "PUREWHITE", 255, 255, 255, }, { "PUREBLACK", 0, 0, 0, }, { "ALPHA100", 0, 0, 0, 255, }, { "ALPHA75", 0, 0, 0, 192, }, { "ALPHA50", 0, 0, 0, 128, }, { "ALPHA25", 0, 0, 0, 64, }, { "ALPHA0", 0, 0, 0, 0, }, } do local n, r, g, b, a = unpack(row) color[n] = color(r, g, b, a) end return color
mit
RunAwayDSP/darkstar
scripts/globals/spells/bluemagic/grand_slam.lua
4
1517
----------------------------------------- -- Spell: Grand Slam -- Delivers an area attack. Damage varies with TP -- Spell cost: 24 MP -- Monster Type: Beastmen -- Spell Type: Physical (Blunt) -- Blue Magic Points: 2 -- Stat Bonus: INT+1 -- Level: 30 -- Casting Time: 1 seconds -- Recast Time: 14.25 seconds -- Skillchain Element(s): Ice (can open Impaction, Compression, or Fragmentation can close Induration) -- Combos: Defense Bonus ----------------------------------------- require("scripts/globals/bluemagic") require("scripts/globals/status") require("scripts/globals/magic") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0 end function onSpellCast(caster,target,spell) local params = {} -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage params.tpmod = TPMOD_ATTACK params.dmgtype = dsp.damageType.BLUNT params.scattr = SC_INDURATION params.numhits = 1 params.multiplier = 1.0 params.tp150 = 1.0 params.tp300 = 1.0 params.azuretp = 1.0 params.duppercap = 33 params.str_wsc = 0.0 params.dex_wsc = 0.0 params.vit_wsc = 0.3 params.agi_wsc = 0.0 params.int_wsc = 0.1 params.mnd_wsc = 0.1 params.chr_wsc = 0.1 damage = BluePhysicalSpell(caster, target, spell, params) damage = BlueFinalAdjustments(caster, target, spell, damage, params) return damage end
gpl-3.0
OctoEnigma/shiny-octo-system
addons/darkrpmodification-master/lua/darkrp_modules/tcb_f4menu/cl_panel_vehicles.lua
1
1909
/*--------------------------------------------------------------------------- Creator: TheCodingBeast - TheCodingBeast.com This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ ---------------------------------------------------------------------------*/ -- Variables local PANEL = {} local TCB_Scroll -- Panel function PANEL:Init() self:SetSize( 650 - 2, 620 - 2 ) self:SetPos( 250, 2 ) self.Paint = function() draw.RoundedBoxEx( 0, 0, 0, self:GetWide(), self:GetTall(), TCB_Settings.Transparent, false, true, false, false ) end TCB_Scroll = vgui.Create( "tcb_panel_scroll", self ) -- Fill Data self:FillData( TCB_Scroll ) end -- Fill Data function PANEL:FillData( parent ) local StartYPos = 0 local ItemTable = CustomVehicles for i, item in ipairs( ItemTable ) do local ShowThisItem = true if TCB_Settings.HideWrongJob == true then if istable(item.allowed) and not table.HasValue( item.allowed, LocalPlayer():Team() ) then ShowThisItem = false end if item.customCheck and not item.customCheck( LocalPlayer() ) then ShowThisItem = false end end if ShowThisItem == true then CurrentItem = vgui.Create( "tcb_panel_item", parent ) CurrentItem:SetPos( 0, StartYPos ) CurrentItem:UpdateInfo( item, "vehicles", "vehicles" ) StartYPos = StartYPos + CurrentItem:GetTall() + 11 end end if TCB_Settings.HideWrongJob == true then local HideElementsMsg = vgui.Create( "tcb_panel_hidden", parent ) HideElementsMsg:SetPos( 0, StartYPos ) end end -- Refill Data function PANEL:RefillData() -- Remove Items TCB_Scroll:Clear() -- Scroll Fix TCB_Scroll:ScrollFix() -- Fill Items self:FillData( TCB_Scroll ) end -- Derma vgui.Register( "tcb_panel_vehicles", PANEL, "DPanel" )
mit
RunAwayDSP/darkstar
scripts/globals/mobskills/hex_palm.lua
11
1024
--------------------------------------------- -- Hex Palm -- Family: Qutrub -- Description: Steals HP from targets in front. -- Type: Magical -- Utsusemi/Blink absorb: Wipes shadows -- Range: Front cone -- Notes: Used only when wielding no weapon. --------------------------------------------- require("scripts/globals/monstertpmoves") require("scripts/globals/settings") require("scripts/globals/status") --------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:AnimationSub() == 1 or mob:AnimationSub() == 3) then return 0 else return 1 end end function onMobWeaponSkill(target, mob, skill) local dmgmod = 1.1 local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*2,dsp.magic.ele.DARK,dmgmod,TP_MAB_BONUS,1) local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,dsp.attackType.MAGICAL,dsp.damageType.DARK,MOBPARAM_WIPE_SHADOWS) skill:setMsg(MobPhysicalDrainMove(mob, target, skill, MOBDRAIN_HP, dmg)) return dmg end
gpl-3.0
lichtl/darkstar
scripts/globals/mobskills/Vorpal_Wheel.lua
37
1063
--------------------------------------------- -- Vorpal Wheel -- -- Description: Throws a slicing wheel at a single target. -- Type: Physical -- Utsusemi/Blink absorb: No -- Range: Unknown -- Notes: Only used by Gulool Ja Ja, and will use it as a counterattack to any spells cast on him. Damage increases as his health drops. Can be Shield Blocked. --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local numhits = 1; local accmod = 1; -- Increase damage as health drops local dmgmod = (1 - (mob:getHP() / mob:getMaxHP())) * 6; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,info.hitslanded); target:delHP(dmg); return dmg; end;
gpl-3.0
RunAwayDSP/darkstar
scripts/globals/items/kayabaligi.lua
11
1049
----------------------------------------- -- ID: 5460 -- Item: Kayabaligi -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 4 -- Mind -6 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if (target:getRace() ~= dsp.race.MITHRA) then result = dsp.msg.basic.CANNOT_EAT end if (target:getMod(dsp.mod.EAT_RAW_FISH) == 1) then result = 0 end if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,300,5460) end function onEffectGain(target, effect) target:addMod(dsp.mod.DEX, 4) target:addMod(dsp.mod.MND, -6) end function onEffectLose(target, effect) target:delMod(dsp.mod.DEX, 4) target:delMod(dsp.mod.MND, -6) end
gpl-3.0
DrYaling/eluna-trinitycore
src/server/scripts/Scripts-master/Blizzlike/EasternKingdoms/zone_eastern_plaguelands.lua
1
3173
--[[ EmuDevs <http://emudevs.com/forum.php> Eluna Lua Engine <https://github.com/ElunaLuaEngine/Eluna> Eluna Scripts <https://github.com/ElunaLuaEngine/Scripts> Eluna Wiki <http://wiki.emudevs.com/doku.php?id=eluna> -= Script Information =- * Zone: Eastern Plaugelands * QuestId: 5742 / 6164 * Script Type: Gossip, CreatureAI and Quest * Npc: Ghoul Flayer <8530, 8531, 8532>, Augustus the Touched <12384>, Darrowshire Spirit <11064> and Tirion Fordring <1855> --]] -- Ghoul Flayer function Flayer_Died(event, creature, killer) if (killer:GetUnitType() == "Player") then creature:SpawnCreature(11064, 0, 0, 0, 0, 3, 60000) end end RegisterCreatureEvent(8530, 4, Flayer_Died) RegisterCreatureEvent(8531, 4, Flayer_Died) RegisterCreatureEvent(8532, 4, Flayer_Died) -- Augustus the Touched function Augustus_GossipHello(event, player, creature) if (creature:IsQuestGiver()) then player:GossipAddQuests(creature) end if (creature:IsVendor() and player:GetQuestRewardStatus(6164)) then player:GossipMenuAddItem(0, "I'd like to browse your goods.", 0, 1) end player:GossipSendMenu(player:GetGossipTextId(creature), creature) end function Augustus_GossipSelect(event, player, creature, sender, intid, code) player:GossipClearMenu() if (intid == 1) then player:SendListInventory(creature) end end RegisterCreatureGossipEvent(12384, 1, Augustus_GossipHello) RegisterCreatureGossipEvent(12384, 2, Augustus_GossipSelect) -- Darrowshire Spirit function Darrowshire_GossipHello(event, player, creature) player:GossipSendMenu(3873, creature) player:TalkedToCreature(creature:GetEntry(), creature) creature:SetFlag(59, 33554432) end function Darrowshire_Reset(event, creature) creature:CastSpell(creature, 17321) creature:RemoveFlag(59, 33554432) end RegisterCreatureGossipEvent(11064, 1, Darrowshire_GossipHello) RegisterCreatureEvent(11064, 23, Darrowshire_Reset) -- Tirion Fordring function Tirion_GossipHello(event, player, creature) if (creature:IsQuestGiver()) then player:GossipAddQuests(creature) end if (player:GetQuestStatus(5742) == 3 and player:GetStandState() == 1) then player:GossipMenuAddItem(0, "I am ready to hear your tale, Tirion.", 0, 1) end player:GossipSendMenu(player:GetGossipTextId(creature), creature) end function Tirion_GossipSelect(event, player, creature, sender, intid, code) player:GossipClearMenu() if (intid == 1) then player:GossipMenuAddItem(0, "Thank you, Tirion. What of your identity?", 0, 2) player:GossipSendMenu(4493, creature) elseif (intid == 2) then player:GossipMenuAddItem(0, "That is terrible.", 0, 3) player:GossipSendMenu(4494, creature) elseif (intid == 3) then player:GossipMenuAddItem(0, "I will, Tirion.", 0, 4) player:GossipSendMenu(4495, creature) elseif (intid == 3) then player:GossipComplete() player:AreaExploredOrEventHappens(5742) end end RegisterCreatureGossipEvent(1855, 1, Tirion_GossipHello) RegisterCreatureGossipEvent(1855, 2, Tirion_GossipSelect)
gpl-2.0
lichtl/darkstar
scripts/globals/items/cinna-cookie.lua
18
1325
----------------------------------------- -- ID: 4397 -- Item: cinna-cookie -- Food Effect: 3Min, All Races ----------------------------------------- -- Magic Regen While Healing 4 -- Vermin Killer 5 -- Poison 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,4397); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPHEAL, 4); target:addMod(MOD_VERMIN_KILLER, 5); target:addMod(MOD_POISONRES, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPHEAL, 4); target:delMod(MOD_VERMIN_KILLER, 5); target:delMod(MOD_POISONRES, 5); end;
gpl-3.0
sjznxd/lc-20130222
modules/admin-full/luasrc/controller/admin/index.lua
79
1245
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- module("luci.controller.admin.index", package.seeall) function index() local root = node() if not root.target then root.target = alias("admin") root.index = true end local page = node("admin") page.target = firstchild() page.title = _("Administration") page.order = 10 page.sysauth = "root" page.sysauth_authenticator = "htmlauth" page.ucidata = true page.index = true -- Empty services menu to be populated by addons entry({"admin", "services"}, firstchild(), _("Services"), 40).index = true entry({"admin", "logout"}, call("action_logout"), _("Logout"), 90) end function action_logout() local dsp = require "luci.dispatcher" local sauth = require "luci.sauth" if dsp.context.authsession then sauth.kill(dsp.context.authsession) dsp.context.urltoken.stok = nil end luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) luci.http.redirect(luci.dispatcher.build_url()) end
apache-2.0
RunAwayDSP/darkstar
scripts/globals/items/plate_of_ikra_gunkan.lua
11
1458
----------------------------------------- -- ID: 5219 -- Item: plate_of_ikra_gunkan -- Food Effect: 30Min, All Races ----------------------------------------- -- Health 30 -- Magic 10 -- Dexterity 3 -- Mind -2 -- Accuracy % 18 -- Accuracy Cap 28 -- Ranged ACC % 18 -- Ranged ACC Cap 28 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,1800,5219) end function onEffectGain(target, effect) target:addMod(dsp.mod.HP, 30) target:addMod(dsp.mod.MP, 10) target:addMod(dsp.mod.DEX, 3) target:addMod(dsp.mod.MND, -2) target:addMod(dsp.mod.FOOD_ACCP, 18) target:addMod(dsp.mod.FOOD_ACC_CAP, 28) target:addMod(dsp.mod.FOOD_RACCP, 18) target:addMod(dsp.mod.FOOD_RACC_CAP, 28) end function onEffectLose(target, effect) target:delMod(dsp.mod.HP, 30) target:delMod(dsp.mod.MP, 10) target:delMod(dsp.mod.DEX, 3) target:delMod(dsp.mod.MND, -2) target:delMod(dsp.mod.FOOD_ACCP, 18) target:delMod(dsp.mod.FOOD_ACC_CAP, 28) target:delMod(dsp.mod.FOOD_RACCP, 18) target:delMod(dsp.mod.FOOD_RACC_CAP, 28) end
gpl-3.0
blackguardtm/blackguardtm
plugins/banhammer.lua
34
11497
local function pre_process(msg) -- 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 name = user_print_name(msg.from) 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 or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) 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 name = user_print_name(msg.from) 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' then local data = load_data(_config.moderation.data) 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 name = user_print_name(msg.from) 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) --vardump(result) --vardump(extra) local member_id = result.id local user_id = member_id local member = result.username local chat_id = extra.chat_id local from_id = extra.from_id local get_cmd = extra.get_cmd local receiver = "chat#id"..chat_id if get_cmd == "kick" then if member_id == from_id then return send_large_msg(receiver, "You can't kick yourself") end if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't kick mods/owner/admins") end return kick_user(member_id, chat_id) elseif get_cmd == 'ban' then if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't ban mods/owner/admins") end send_large_msg(receiver, 'User @'..member..' ['..member_id..'] banned') return ban_user(member_id, chat_id) elseif get_cmd == 'unban' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') local hash = 'banned:'..chat_id redis:srem(hash, member_id) return 'User '..user_id..' unbanned' elseif get_cmd == 'banall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] globally banned') return banall_user(member_id, chat_id) elseif get_cmd == 'unbanall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] un-globally banned') return unbanall_user(member_id, chat_id) end end local function run(msg, matches) if matches[1]:lower() == 'id' then if msg.to.type == "user" then return "Bot ID: "..msg.to.id.. "\n\nYour ID: "..msg.from.id end if type(msg.reply_id) ~= "nil" then local name = user_print_name(msg.from) 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() == 'id' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") return "Group ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id end end if matches[1]:lower() == 'kickme' then-- /kickme local receiver = get_receiver(msg) if msg.to.type == 'chat' then local name = user_print_name(msg.from) 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() == "banlist" then -- Ban list ! local chat_id = msg.to.id if matches[2] and is_admin(msg) then chat_id = matches[2] end return ban_list(chat_id) end if matches[1]:lower() == 'ban' then-- /ban if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,ban_by_reply_admins, false) else msgr = get_message(msg.reply_id,ban_by_reply, false) end end 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 end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't ban mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't ban your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) ban_user(user_id, chat_id) else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'ban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unban' 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 name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] unbaned user ".. matches[2]) return 'User '..user_id..' unbanned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'kick' then if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,Kick_by_reply_admins, false) else msgr = get_message(msg.reply_id,Kick_by_reply, false) end end if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local user_id = matches[2] local chat_id = msg.to.id name = user_print_name(msg.from) 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 = 'kick', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if not is_admin(msg) then return end if matches[1]:lower() == 'banall' then -- Global ban if type(msg.reply_id) ~="nil" and is_admin(msg) then return 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 ['..user_id..' ] globally banned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'banall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unbanall' 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 ['..user_id..' ] removed from global ban list' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unbanall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == "gbanlist" then -- Global ban list return banall_list() end end return { patterns = { "^([Bb]anall) (.*)$", "^([Bb]anall)$", "^([Bb]anlist) (.*)$", "^([Bb]anlist)$", "^([Gg]banlist)$", "^([Bb]an) (.*)$", "^([Kk]ick)$", "^([Uu]nban) (.*)$", "^([Uu]nbanall) (.*)$", "^([Uu]nbanall)$", "^([Kk]ick) (.*)$", "^([Kk]ickme)$", "^([Bb]an)$", "^([Uu]nban)$", "^([Ii]d)$", "^!!tgservice (.+)$" }, run = run, pre_process = pre_process }
gpl-2.0
lichtl/darkstar
scripts/globals/items/serving_of_flint_caviar.lua
18
1422
----------------------------------------- -- ID: 4276 -- Item: serving_of_flint_caviar -- Food Effect: 30Min, All Races ----------------------------------------- -- Health 10 -- Magic 10 -- Dexterity 4 -- Mind -1 -- Charisma 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,1800,4276); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_MP, 10); target:addMod(MOD_DEX, 4); target:addMod(MOD_MND, -1); target:addMod(MOD_CHR, 4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_MP, 10); target:delMod(MOD_DEX, 4); target:delMod(MOD_MND, -1); target:delMod(MOD_CHR, 4); end;
gpl-3.0
RunAwayDSP/darkstar
scripts/zones/Maze_of_Shakhrami/npcs/Rockwell.lua
9
1129
----------------------------------- -- Area: Maze of Shakhrami -- NPC: Rockwell -- Quest: Your Crystal Ball -- !pos -18 -13 181 198 ----------------------------------- local ID = require("scripts/zones/Maze_of_Shakhrami/IDs") require("scripts/globals/npc_util") require("scripts/globals/quests") ----------------------------------- function onTrade(player, npc, trade) if player:getQuestStatus(JEUNO, dsp.quest.id.jeuno.YOUR_CRYSTAL_BALL) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 557) then player:setCharVar("QuestYourCrystalBall_prog", 1) player:confirmTrade(trade) end end function onTrigger(player, npc) if player:getQuestStatus(JEUNO, dsp.quest.id.jeuno.YOUR_CRYSTAL_BALL) == QUEST_ACCEPTED and player:getCharVar("QuestYourCrystalBall_prog") == 1 then player:startEvent(52) else player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 52 and npcUtil.giveItem(player, 556) then player:setCharVar("QuestYourCrystalBall_prog", 0) end end
gpl-3.0
Zariel/bollo2
lib/AceGUI-3.0/widgets/AceGUIWidget-TreeGroup.lua
2
18219
local AceGUI = LibStub("AceGUI-3.0") -- Recycling functions local new, del do local pool = setmetatable({},{__mode='k'}) function new() local t = next(pool) if t then pool[t] = nil return t else return {} end end function del(t) for k in pairs(t) do t[k] = nil end pool[t] = true end end -------------- -- TreeView -- -------------- do local Type = "TreeGroup" local Version = 17 local DEFAULT_TREE_WIDTH = 175 local DEFAULT_TREE_SIZABLE = true local PaneBackdrop = { bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 3, right = 3, top = 5, bottom = 3 } } local DraggerBackdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = nil, tile = true, tileSize = 16, edgeSize = 0, insets = { left = 3, right = 3, top = 7, bottom = 7 } } local function OnAcquire(self) self:SetTreeWidth(DEFAULT_TREE_WIDTH,DEFAULT_TREE_SIZABLE) self:EnableButtonTooltips(true) end local function OnRelease(self) self.frame:ClearAllPoints() self.frame:Hide() self.status = nil for k, v in pairs(self.localstatus) do if k == "groups" then for k2 in pairs(v) do v[k2] = nil end else self.localstatus[k] = nil end end self.localstatus.scrollvalue = 0 self.localstatus.treewidth = DEFAULT_TREE_WIDTH self.localstatus.treesizable = DEFAULT_TREE_SIZABLE end local function GetButtonParents(line) local parent = line.parent if parent and parent.value then return parent.value, GetButtonParents(parent) end end local function GetButtonUniqueValue(line) local parent = line.parent if parent and parent.value then return GetButtonUniqueValue(parent).."\001"..line.value else return line.value end end local function ButtonOnClick(this) local self = this.obj self:Fire("OnClick",this.uniquevalue, this.selected) if not this.selected then self:SetSelected(this.uniquevalue) this.selected = true this:LockHighlight() self:RefreshTree() end AceGUI:ClearFocus() end local function ExpandOnClick(this) local button = this.button local self = button.obj local status = (self.status or self.localstatus).groups status[button.uniquevalue] = not status[button.uniquevalue] self:RefreshTree() end local function ButtonOnDoubleClick(button) local self = button.obj local status = self.status or self.localstatus local status = (self.status or self.localstatus).groups status[button.uniquevalue] = not status[button.uniquevalue] self:RefreshTree() end local function EnableButtonTooltips(self, enable) self.enabletooltips = enable end local function Button_OnEnter(this) local self = this.obj self:Fire("OnButtonEnter", this.uniquevalue, this) if self.enabletooltips then GameTooltip:SetOwner(this, "ANCHOR_NONE") GameTooltip:SetPoint("LEFT",this,"RIGHT") GameTooltip:SetText(this.text:GetText(), 1, .82, 0, 1) GameTooltip:Show() end end local function Button_OnLeave(this) local self = this.obj self:Fire("OnButtonLeave", this.uniquevalue, this) if self.enabletooltips then GameTooltip:Hide() end end local buttoncount = 1 local function CreateButton(self) local button = CreateFrame("Button",("AceGUI30TreeButton%d"):format(buttoncount),self.treeframe, "OptionsListButtonTemplate") buttoncount = buttoncount + 1 button.obj = self button:SetScript("OnClick",ButtonOnClick) button:SetScript("OnDoubleClick", ButtonOnDoubleClick) button:SetScript("OnEnter",Button_OnEnter) button:SetScript("OnLeave",Button_OnLeave) button.toggle.button = button button.toggle:SetScript("OnClick",ExpandOnClick) return button end local function UpdateButton(button, treeline, selected, canExpand, isExpanded) local self = button.obj local toggle = button.toggle local frame = self.frame local text = treeline.text or "" local level = treeline.level local value = treeline.value local uniquevalue = treeline.uniquevalue local disabled = treeline.disabled button.treeline = treeline button.value = value button.uniquevalue = uniquevalue if selected then button:LockHighlight() button.selected = true else button:UnlockHighlight() button.selected = false end local normalText = button.text local normalTexture = button:GetNormalTexture() local line = button.line button.level = level if ( level == 1 ) then button:SetNormalFontObject("GameFontNormal") button:SetHighlightFontObject("GameFontHighlight") button.text:SetPoint("LEFT", 8, 2) else button:SetNormalFontObject("GameFontHighlightSmall") button:SetHighlightFontObject("GameFontHighlightSmall") button.text:SetPoint("LEFT", 8 * level, 2) end if disabled then button:EnableMouse(false) button.text:SetText("|cff808080"..text..FONT_COLOR_CODE_CLOSE) else button.text:SetText(text) button:EnableMouse(true) end if canExpand then if not isExpanded then toggle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP") toggle:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN") else toggle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-UP") toggle:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-DOWN") end toggle:Show() else toggle:Hide() end end local function OnScrollValueChanged(this, value) if this.obj.noupdate then return end local self = this.obj local status = self.status or self.localstatus status.scrollvalue = value self:RefreshTree() AceGUI:ClearFocus() end -- called to set an external table to store status in local function SetStatusTable(self, status) assert(type(status) == "table") self.status = status if not status.groups then status.groups = {} end if not status.scrollvalue then status.scrollvalue = 0 end if not status.treewidth then status.treewidth = DEFAULT_TREE_WIDTH end if not status.treesizable then status.treesizable = DEFAULT_TREE_SIZABLE end self:SetTreeWidth(status.treewidth,status.treesizable) self:RefreshTree() end --sets the tree to be displayed --[[ example tree Alpha Bravo -Charlie -Delta -Echo Foxtrot tree = { { value = "A", text = "Alpha" }, { value = "B", text = "Bravo", children = { { value = "C", text = "Charlie" }, { value = "D", text = "Delta" children = { { value = "E", text = "Echo" } } } } }, { value = "F", text = "Foxtrot" }, } ]] local function SetTree(self, tree, filter) self.filter = filter if tree then assert(type(tree) == "table") end self.tree = tree self:RefreshTree() end local function ShouldDisplayLevel(tree) local result = false for k, v in ipairs(tree) do if v.children == nil and v.visible ~= false then result = true elseif v.children then result = result or ShouldDisplayLevel(v.children) end if result then return result end end return false end local function addLine(self, v, tree, level, parent) local line = new() line.value = v.value line.text = v.text line.disabled = v.disabled line.tree = tree line.level = level line.parent = parent line.visible = v.visible line.uniquevalue = GetButtonUniqueValue(line) if v.children then line.hasChildren = true else line.hasChildren = nil end self.lines[#self.lines+1] = line return line end local function BuildLevel(self, tree, level, parent) local groups = (self.status or self.localstatus).groups local hasChildren = self.hasChildren for i, v in ipairs(tree) do if v.children then if not self.filter or ShouldDisplayLevel(v.children) then local line = addLine(self, v, tree, level, parent) if groups[line.uniquevalue] then self:BuildLevel(v.children, level+1, line) end end elseif v.visible ~= false or not self.filter then addLine(self, v, tree, level, parent) end end end --fire an update after one frame to catch the treeframes height local function FirstFrameUpdate(this) local self = this.obj this:SetScript("OnUpdate",nil) self:RefreshTree() end local function ResizeUpdate(this) this.obj:RefreshTree() end local function RefreshTree(self) local buttons = self.buttons local lines = self.lines for i, v in ipairs(buttons) do v:Hide() end while lines[1] do local t = tremove(lines) for k in pairs(t) do t[k] = nil end del(t) end if not self.tree then return end --Build the list of visible entries from the tree and status tables local status = self.status or self.localstatus local groupstatus = status.groups local tree = self.tree local treeframe = self.treeframe self:BuildLevel(tree, 1) local numlines = #lines local maxlines = (math.floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) local first, last if numlines <= maxlines then --the whole tree fits in the frame status.scrollvalue = 0 self:ShowScroll(false) first, last = 1, numlines else self:ShowScroll(true) --scrolling will be needed self.noupdate = true self.scrollbar:SetMinMaxValues(0, numlines - maxlines) --check if we are scrolled down too far if numlines - status.scrollvalue < maxlines then status.scrollvalue = numlines - maxlines self.scrollbar:SetValue(status.scrollvalue) end self.noupdate = nil first, last = status.scrollvalue+1, status.scrollvalue + maxlines end local buttonnum = 1 for i = first, last do local line = lines[i] local button = buttons[buttonnum] if not button then button = self:CreateButton() buttons[buttonnum] = button button:SetParent(treeframe) button:SetFrameLevel(treeframe:GetFrameLevel()+1) button:ClearAllPoints() if i == 1 then if self.showscroll then button:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10) button:SetPoint("TOPLEFT", self.treeframe, "TOPLEFT", 0, -10) else button:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10) button:SetPoint("TOPLEFT", self.treeframe, "TOPLEFT", 0, -10) end else button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0) button:SetPoint("TOPLEFT", buttons[buttonnum-1], "BOTTOMLEFT",0,0) end end UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue] ) button:Show() buttonnum = buttonnum + 1 end end local function SetSelected(self, value) local status = self.status or self.localstatus if status.selected ~= value then status.selected = value self:Fire("OnGroupSelected", value) end end local function BuildUniqueValue(...) local n = select('#', ...) if n == 1 then return ... else return (...).."\001"..BuildUniqueValue(select(2,...)) end end local function Select(self, uniquevalue, ...) self.filter = false local status = self.status or self.localstatus local groups = status.groups for i = 1, select('#', ...) do groups[BuildUniqueValue(select(i, ...))] = true end status.selected = uniquevalue self:RefreshTree() self:Fire("OnGroupSelected", uniquevalue) end local function SelectByPath(self, ...) self:Select(BuildUniqueValue(...), ...) end --Selects a tree node by UniqueValue local function SelectByValue(self, uniquevalue) self:Select(uniquevalue,string.split("\001", uniquevalue)) end local function ShowScroll(self, show) self.showscroll = show if show then self.scrollbar:Show() if self.buttons[1] then self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10) end else self.scrollbar:Hide() if self.buttons[1] then self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10) end end end local function OnWidthSet(self, width) local content = self.content local treeframe = self.treeframe local status = self.status or self.localstatus local contentwidth = width - status.treewidth - 20 if contentwidth < 0 then contentwidth = 0 end content:SetWidth(contentwidth) content.width = contentwidth local maxtreewidth = math.min(400, width - 50) if maxtreewidth > 100 and status.treewidth > maxtreewidth then self:SetTreeWidth(maxtreewidth, status.treesizable) end treeframe:SetMaxResize(maxtreewidth,1600) end local function OnHeightSet(self, height) local content = self.content local contentheight = height - 20 if contentheight < 0 then contentheight = 0 end content:SetHeight(contentheight) content.height = contentheight end local function TreeOnMouseWheel(this, delta) local self = this.obj if self.showscroll then local scrollbar = self.scrollbar local min, max = scrollbar:GetMinMaxValues() local value = scrollbar:GetValue() local newvalue = math.min(max,math.max(min,value - delta)) if value ~= newvalue then scrollbar:SetValue(newvalue) end end end local function SetTreeWidth(self, treewidth, resizable) if not resizable then if type(treewidth) == 'number' then resizable = false elseif type(treewidth) == 'boolean' then resizable = treewidth treewidth = DEFAULT_TREE_WIDTH else resizable = false treewidth = DEFAULT_TREE_WIDTH end end self.treeframe:SetWidth(treewidth) self.dragger:EnableMouse(resizable) local status = self.status or self.localstatus status.treewidth = treewidth status.treesizable = resizable end local function draggerLeave(this) this:SetBackdropColor(1, 1, 1, 0) end local function draggerEnter(this) this:SetBackdropColor(1, 1, 1, 0.8) end local function draggerDown(this) local treeframe = this:GetParent() treeframe:StartSizing("RIGHT") end local function draggerUp(this) local treeframe = this:GetParent() local self = treeframe.obj local frame = treeframe:GetParent() treeframe:StopMovingOrSizing() --treeframe:SetScript("OnUpdate", nil) treeframe:SetUserPlaced(false) --Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize treeframe:SetHeight(0) treeframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) treeframe:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0) treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) local status = self.status or self.localstatus status.treewidth = treeframe:GetWidth() end local createdcount = 0 local function Constructor() local frame = CreateFrame("Frame",nil,UIParent) local self = {} self.type = Type self.lines = {} self.levels = {} self.buttons = {} self.hasChildren = {} self.localstatus = {} self.localstatus.groups = {} self.filter = false local treeframe = CreateFrame("Frame",nil,frame) treeframe.obj = self treeframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) treeframe:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0) treeframe:SetWidth(DEFAULT_TREE_WIDTH) treeframe:SetScript("OnUpdate",FirstFrameUpdate) treeframe:SetScript("OnSizeChanged",ResizeUpdate) treeframe:EnableMouseWheel(true) treeframe:SetScript("OnMouseWheel", TreeOnMouseWheel) treeframe:SetBackdrop(PaneBackdrop) treeframe:SetBackdropColor(0.1,0.1,0.1,0.5) treeframe:SetBackdropBorderColor(0.4,0.4,0.4) treeframe:SetResizable(true) treeframe:SetMinResize(100, 1) treeframe:SetMaxResize(400,1600) local dragger = CreateFrame("Frame", nil, treeframe) dragger:SetWidth(8) dragger:SetPoint("TOP", treeframe, "TOPRIGHT") dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT") dragger:SetBackdrop(DraggerBackdrop) dragger:SetBackdropColor(1, 1, 1, 0) dragger:SetScript("OnMouseDown", draggerDown) dragger:SetScript("OnMouseUp", draggerUp) dragger:SetScript("OnEnter", draggerEnter) dragger:SetScript("OnLeave", draggerLeave) self.dragger = dragger self.treeframe = treeframe self.OnRelease = OnRelease self.OnAcquire = OnAcquire self.SetTree = SetTree self.SetTreeWidth = SetTreeWidth self.RefreshTree = RefreshTree self.SetStatusTable = SetStatusTable self.BuildLevel = BuildLevel self.CreateButton = CreateButton self.SetSelected = SetSelected self.ShowScroll = ShowScroll self.SetStatusTable = SetStatusTable self.Select = Select self.SelectByValue = SelectByValue self.SelectByPath = SelectByPath self.OnWidthSet = OnWidthSet self.OnHeightSet = OnHeightSet self.EnableButtonTooltips = EnableButtonTooltips self.Filter = Filter self.frame = frame frame.obj = self createdcount = createdcount + 1 local scrollbar = CreateFrame("Slider",("AceConfigDialogTreeGroup%dScrollBar"):format(createdcount),treeframe,"UIPanelScrollBarTemplate") self.scrollbar = scrollbar local scrollbg = scrollbar:CreateTexture(nil,"BACKGROUND") scrollbg:SetAllPoints(scrollbar) scrollbg:SetTexture(0,0,0,0.4) scrollbar.obj = self self.noupdate = true scrollbar:SetPoint("TOPRIGHT",treeframe,"TOPRIGHT",-10,-26) scrollbar:SetPoint("BOTTOMRIGHT",treeframe,"BOTTOMRIGHT",-10,26) scrollbar:SetScript("OnValueChanged", OnScrollValueChanged) scrollbar:SetMinMaxValues(0,0) self.localstatus.scrollvalue = 0 scrollbar:SetValueStep(1) scrollbar:SetValue(0) scrollbar:SetWidth(16) self.noupdate = nil local border = CreateFrame("Frame",nil,frame) self.border = border border:SetPoint("TOPLEFT",treeframe,"TOPRIGHT", 0,0) border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0) border:SetBackdrop(PaneBackdrop) border:SetBackdropColor(0.1,0.1,0.1,0.5) border:SetBackdropBorderColor(0.4,0.4,0.4) --Container Support local content = CreateFrame("Frame",nil,border) self.content = content content.obj = self content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-10) content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,10) AceGUI:RegisterAsContainer(self) --AceGUI:RegisterAsWidget(self) return self end AceGUI:RegisterWidgetType(Type,Constructor,Version) end
bsd-3-clause
lichtl/darkstar
scripts/zones/Kazham/npcs/Bhi_Telifahgo.lua
17
1071
----------------------------------- -- Area: Kazham -- NPC: Bhi Telifahgo -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getVar("BathedInScent") == 1) then player:startEvent(0x00B7); -- scent from Blue Rafflesias else player:startEvent(0x005D); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
RunAwayDSP/darkstar
scripts/zones/Throne_Room/bcnms/shadow_lord_battle.lua
8
2156
----------------------------------- -- Area: Throne Room -- Name: Mission 5-2 -- !pos -111 -6 0.1 165 ----------------------------------- local ID = require("scripts/zones/Throne_Room/IDs") require("scripts/globals/battlefield") require("scripts/globals/keyitems") require("scripts/globals/missions") ----------------------------------- function onBattlefieldTick(battlefield, tick) dsp.battlefield.onBattlefieldTick(battlefield, tick) end function onBattlefieldInitialise(battlefield) battlefield:setLocalVar("loot", 1) battlefield:setLocalVar("lootSpawned", 1) end function onBattlefieldRegister(player, battlefield) end function onBattlefieldEnter(player, battlefield) end function onBattlefieldLeave(player, battlefield, leavecode) if leavecode == dsp.battlefield.leaveCode.WON then -- play end CS. Need time and battle id for record keeping + storage local name, clearTime, partySize = battlefield:getRecord() local arg8 = player:hasCompletedMission(player:getNation(), 15) and 1 or 0 player:startEvent(32001, battlefield:getArea(), clearTime, partySize, battlefield:getTimeInside(), 1, battlefield:getLocalVar("[cs]bit"), arg8) elseif leavecode == dsp.battlefield.leaveCode.LOST then player:startEvent(32002) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 32001 and player:getCurrentMission(player:getNation()) == 15 and player:getCharVar("MissionStatus") == 3 then if player:getCurrentMission(ZILART) ~= dsp.mission.id.zilart.THE_NEW_FRONTIER and not player:hasCompletedMission(ZILART, dsp.mission.id.zilart.THE_NEW_FRONTIER) then -- Don't add missions we already completed. Players who change nation will hit this. player:addMission(ZILART, dsp.mission.id.zilart.THE_NEW_FRONTIER) end player:startEvent(7) elseif csid == 7 then player:addKeyItem(dsp.ki.SHADOW_FRAGMENT) player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.SHADOW_FRAGMENT) player:setCharVar("MissionStatus", 4) player:setPos(378, -12, -20, 125, 161) end end
gpl-3.0
GPUOpen-Effects/ShadowFX
amd_shadowfx/premake/premake5.lua
1
3542
_AMD_LIBRARY_NAME = "ShadowFX" _AMD_LIBRARY_NAME_ALL_CAPS = string.upper(_AMD_LIBRARY_NAME) _AMD_D3D_VERSION = "d3d11" -- Set _AMD_LIBRARY_NAME and _AMD_D3D_VERSION before including amd_premake_util.lua dofile ("../../premake/amd_premake_util.lua") workspace ("AMD_" .. _AMD_LIBRARY_NAME .. "11") configurations { "DLL_Debug", "DLL_Release", "Lib_Debug", "Lib_Release", "DLL_Release_MT" } platforms { "Win32", "x64" } location "../build" filename ("AMD_" .. _AMD_LIBRARY_NAME .. "11" .. _AMD_VS_SUFFIX) startproject ("AMD_" .. _AMD_LIBRARY_NAME .. "11") filter "platforms:Win32" system "Windows" architecture "x86" filter "platforms:x64" system "Windows" architecture "x64" externalproject "AMD_LIB" kind "StaticLib" language "C++" location "../../amd_lib/shared/%{_AMD_D3D_VERSION}/build" filename ("AMD_LIB" .. _AMD_VS_SUFFIX) uuid "0D2AEA47-7909-69E3-8221-F4B9EE7FCF44" configmap { ["DLL_Debug"] = "Debug", ["DLL_Release"] = "Release", ["Lib_Debug"] = "Debug", ["Lib_Release"] = "Release", ["DLL_Release_MT"] = "Release_MT" } project ("AMD_" .. _AMD_LIBRARY_NAME .. "11") language "C++" location "../build" filename ("AMD_" .. _AMD_LIBRARY_NAME .. "11" .. _AMD_VS_SUFFIX) uuid "21473363-E6A1-4460-8454-0F4C411B5B3D" targetdir "../lib/%{_AMD_LIBRARY_DIR_LAYOUT}" objdir "../build/%{_AMD_LIBRARY_DIR_LAYOUT}" warnings "Extra" exceptionhandling "Off" rtti "Off" -- Specify WindowsTargetPlatformVersion here for VS2015 systemversion (_AMD_WIN_SDK_VERSION) files { "../inc/**.h", "../src/AMD_%{_AMD_LIBRARY_NAME}_Precompiled.h", "../src/AMD_%{_AMD_LIBRARY_NAME}11*.h", "../src/AMD_%{_AMD_LIBRARY_NAME}11*.cpp", "../src/Shaders/**.hlsl" } includedirs { "../inc", "../../amd_lib/shared/common/inc", "../../amd_lib/shared/%{_AMD_D3D_VERSION}/inc" } links { "AMD_LIB" } filter "configurations:DLL_*" kind "SharedLib" defines { "_USRDLL" } -- Copy DLL and import library to the lib directory postbuildcommands { amdLibPostbuildCommands() } postbuildmessage "Copying build output to lib directory..." filter "configurations:Lib_*" kind "StaticLib" defines { "_LIB", "AMD_SHADOWFX_COMPILE_STATIC_LIB" } filter "configurations:*_Debug" defines { "WIN32", "_DEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } flags { "FatalWarnings" } symbols "On" characterset "Unicode" -- add "d" to the end of the library name for debug builds targetsuffix "d" filter "configurations:*_Release" defines { "WIN32", "NDEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } flags { "FatalWarnings" } characterset "Unicode" optimize "On" filter "configurations:DLL_Release_MT" defines { "WIN32", "NDEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } flags { "FatalWarnings" } characterset "Unicode" -- link against the static runtime to avoid introducing a dependency -- on the particular version of Visual Studio used to build the DLLs flags { "StaticRuntime" } optimize "On" filter "action:vs*" -- specify exception handling model for Visual Studio to avoid -- "'noexcept' used with no exception handling mode specified" -- warning in vs2015 buildoptions { "/EHsc" } filter "platforms:Win32" targetname "%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}11_x86" filter "platforms:x64" targetname "%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}11_x64"
mit
lichtl/darkstar
scripts/zones/The_Garden_of_RuHmet/npcs/Ebon_Panel.lua
14
3785
----------------------------------- -- Area: The Garden of RuHmet -- NPC: Ebon_Panel -- @pos 100.000 -5.180 -337.661 35 | Mithra Tower -- @pos 740.000 -5.180 -342.352 35 | Elvaan Tower -- @pos 257.650 -5.180 -699.999 35 | Tarutaru Tower -- @pos 577.648 -5.180 -700.000 35 | Galka Tower ----------------------------------- package.loaded["scripts/zones/The_Garden_of_RuHmet/TextIDs"] = nil; ----------------------------------- require("scripts/zones/The_Garden_of_RuHmet/TextIDs"); require("scripts/globals/missions"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Race = player:getRace(); local xPos = npc:getXPos(); if (player:getCurrentMission(COP) == WHEN_ANGELS_FALL and player:getVar("PromathiaStatus") == 1) then player:startEvent(0x00CA); elseif (player:getCurrentMission(COP) == WHEN_ANGELS_FALL and player:getVar("PromathiaStatus") == 2) then if (xPos > 99 and xPos < 101) then -- Mithra Tower if ( Race==7 ) then player:startEvent(0x007C); else player:messageSpecial(NO_NEED_INVESTIGATE); end elseif (xPos > 739 and xPos < 741) then -- Elvaan Tower if ( Race==3 or Race==4) then player:startEvent(0x0079); else player:messageSpecial(NO_NEED_INVESTIGATE); end elseif (xPos > 256 and xPos < 258) then -- Tarutaru Tower if ( Race==5 or Race==6 ) then player:startEvent(0x007B); else player:messageSpecial(NO_NEED_INVESTIGATE); end elseif (xPos > 576 and xPos < 578) then -- Galka Tower if ( Race==8) then player:startEvent(0x007A); else player:messageSpecial(NO_NEED_INVESTIGATE); end end else player:messageSpecial(NO_NEED_INVESTIGATE); 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 == 0x00CA) then player:setVar("PromathiaStatus",2); elseif (0x007C and option ~=0) then -- Mithra player:addTitle(WARRIOR_OF_THE_CRYSTAL); player:setVar("PromathiaStatus",3); player:addKeyItem(LIGHT_OF_DEM); player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_DEM); elseif (0x0079 and option ~=0) then -- Elvaan player:addTitle(WARRIOR_OF_THE_CRYSTAL); player:setVar("PromathiaStatus",3); player:addKeyItem(LIGHT_OF_MEA); player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_MEA); elseif (0x007B and option ~=0) then -- Tarutaru player:addTitle(WARRIOR_OF_THE_CRYSTAL); player:setVar("PromathiaStatus",3); player:addKeyItem(LIGHT_OF_HOLLA); player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_HOLLA); elseif (0x007A and option ~=0) then -- Galka player:addTitle(WARRIOR_OF_THE_CRYSTAL); player:setVar("PromathiaStatus",3); player:addKeyItem(LIGHT_OF_ALTAIEU); player:messageSpecial(KEYITEM_OBTAINED,LIGHT_OF_ALTAIEU); end end;
gpl-3.0
lichtl/darkstar
scripts/zones/Mhaura/npcs/Bihoro-Guhoro.lua
14
1538
----------------------------------- -- Area: Mhaura -- NPC: Bihoro-Guhoro -- Involved in Quest: Riding on the Clouds -- @pos -28 -8 41 249 ----------------------------------- package.loaded["scripts/zones/Mhaura/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Mhaura/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_3") == 7) then if (trade:hasItemQty(1127,1) and trade:getItemCount() == 1) then -- Trade Kindred seal player:setVar("ridingOnTheClouds_3",0); player:tradeComplete(); player:addKeyItem(SOMBER_STONE); player:messageSpecial(KEYITEM_OBTAINED,SOMBER_STONE); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x2ee); 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
RunAwayDSP/darkstar
scripts/globals/abilities/pets/eraser.lua
12
1808
--------------------------------------------- -- Eraser --------------------------------------------- require("scripts/globals/automatonweaponskills") require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/msg") --------------------------------------------- function onMobSkillCheck(target, automaton, skill) return 0 end function onPetAbility(target, automaton, skill, master, action) automaton:addRecast(dsp.recast.ABILITY, skill:getID(), 30) local maneuvers = master:countEffect(dsp.effect.LIGHT_MANEUVER) skill:setMsg(dsp.msg.basic.USES) local function removeStatus() if target:delStatusEffect(dsp.effect.PETRIFICATION) then return true end if target:delStatusEffect(dsp.effect.SILENCE) then return true end if target:delStatusEffect(dsp.effect.BANE) then return true end if target:delStatusEffect(dsp.effect.CURSE_II) then return true end if target:delStatusEffect(dsp.effect.CURSE) then return true end if target:delStatusEffect(dsp.effect.PARALYSIS) then return true end if target:delStatusEffect(dsp.effect.PLAGUE) then return true end if target:delStatusEffect(dsp.effect.POISON) then return true end if target:delStatusEffect(dsp.effect.DISEASE) then return true end if target:delStatusEffect(dsp.effect.BLINDNESS) then return true end if target:eraseStatusEffect() ~= 255 then return true end return false end local toremove = maneuvers local removed = 0 repeat if not removeStatus() then break end toremove = toremove - 1 removed = removed + 1 until (toremove <= 0) for i = 1, maneuvers do master:delStatusEffectSilent(dsp.effect.LIGHT_MANEUVER) end return removed end
gpl-3.0
lichtl/darkstar
scripts/zones/Abyssea-Uleguerand/npcs/qm7.lua
14
1348
----------------------------------- -- Zone: Abyssea-Uleguerand -- NPC: qm7 (???) -- Spawns Veri Selen -- @pos ? ? ? 253 ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --[[ if (trade:hasItemQty(3254,1) and trade:getItemCount() == 1) then -- Player has all the required items. if (GetMobAction(17813937) == ACTION_NONE) then -- Mob not already spawned from this SpawnMob(17813937):updateClaim(player); -- Spawn NM, Despawn after inactive for 5 minutes (pt has to reclaim within 5 of a wipe) player:tradeComplete(); end end ]] end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(1010, 3254); -- Inform player what items they need. 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
lichtl/darkstar
scripts/zones/Carpenters_Landing/npcs/relic.lua
14
1880
----------------------------------- -- Area: Carpenter's Landing -- NPC: <this space intentionally left blank> -- @pos -99 -0 -514 2 ----------------------------------- package.loaded["scripts/zones/Carpenters_Landing/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Carpenters_Landing/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- Working on correct relic, 4 items, Stage 4 item, Shard, Necropsyche, currencypiece if (player:getVar("RELIC_IN_PROGRESS") == 15069 and trade:getItemCount() == 4 and trade:hasItemQty(15069,1) and trade:hasItemQty(1822,1) and trade:hasItemQty(1589,1) and trade:hasItemQty(1454,1)) then player:startEvent(44,15070); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 44) then if (player:getFreeSlotsCount() < 2) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,15070); player:messageSpecial(FULL_INVENTORY_AFTER_TRADE,1453); else player:tradeComplete(); player:addItem(15070); player:addItem(1453,30); player:messageSpecial(ITEM_OBTAINED,15070); player:messageSpecial(ITEMS_OBTAINED,1453,30); player:setVar("RELIC_IN_PROGRESS",0); end end end;
gpl-3.0
lichtl/darkstar
scripts/zones/Windurst_Waters_[S]/npcs/Parukoko.lua
14
1061
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Parukoko -- Type: Standard NPC -- @zone 94 -- @pos -32.400 -3.5 -103.666 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01b4); 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
lichtl/darkstar
scripts/globals/mobskills/Sand_Blast.lua
24
1154
--------------------------------------------------- -- Sand Blast -- Deals Earth damage to targets in a fan-shaped area of effect. Additional effect: Blind -- Range: 8' cone --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local typeEffect = EFFECT_BLINDNESS; skill:setMsg(MobStatusEffectMove(mob, target, typeEffect, 20, 0, 120)); if (mob:getPool() == 1318 and mob:getLocalVar("SAND_BLAST") == 1) then -- Feeler Anltion if (GetMobAction(mob:getID()+6) == 0) then -- Alastor Antlion mob:setLocalVar("SAND_BLAST",0); -- Don't spawn more NMs local alastorAntlion = GetMobByID(mob:getID() + 6); alastorAntlion:setSpawn(mob:getXPos() + 1, mob:getYPos() + 1, mob:getZPos() + 1); -- Set its spawn location. SpawnMob((mob:getID() + 6), 120):updateClaim(target); end end return typeEffect; end;
gpl-3.0
scscgit/scsc_wildstar_addons
RaidCore/Encounters/TEST/HousingTest.lua
1
20436
---------------------------------------------------------------------------------------------------- -- Client Lua Script for RaidCore Addon on WildStar Game. -- -- Copyright (C) 2015 RaidCore ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -- Description: -- Using the Large Training Grounds fabkit it is possible to spawn enemies. -- There are 4 different modes: easy, normal, hard, elite. In each mode you get -- a random enemy out of 3 possibilities. -- These enemies have atleast one cast each and some of them have buffs and debuffs -- Easy: -- Chompacabra: Applies bleed debuff on the player -- Chompacabra: Applies melt debuff on the player -- Moodie: Applies melt debuff on the player -- Hard: -- Krogg: Applies a crit buff on himself -- -- It's not possible to control what enemy you want to get so it's recommended -- to use the easy mode since there are 2 mobs there that will apply debuffs -- on the player. ---------------------------------------------------------------------------------------------------- local Apollo = require "Apollo" local ChatSystemLib = require "ChatSystemLib" local GameLib = require "GameLib" local core = Apollo.GetPackage("Gemini:Addon-1.1").tPackage:GetAddon("RaidCore") --@alpha@ local mod = core:NewEncounter("HousingTest", 36, 0, 60, true) --@end-alpha@ if not mod then return end ---------------------------------------------------------------------------------------------------- -- Registering combat. ---------------------------------------------------------------------------------------------------- local TRIG_MOBS = { -- Easy. "unit.chompacabra", "unit.moodie", "unit.aggressorbot", -- Normal. "unit.bandit", "unit.girrok", "unit.shootbot", -- Hard. "unit.pumera", "unit.osun", "unit.krogg", -- Elite. "unit.ravenok", "unit.pell", "unit.titan", -- Extra units "unit.ai", "unit.computer", } mod:RegisterTrigMob(core.E.TRIGGER_ANY, TRIG_MOBS) mod:RegisterEnglishLocale({ -- Unit names. -- Easy. ["unit.chompacabra"] = "Holographic Chompacabra", ["unit.moodie"] = "Holographic Moodie", ["unit.aggressorbot"] = "Holographic Aggressorbot", -- Normal. ["unit.bandit"] = "Holographic Bandit", ["unit.girrok"] = "Holographic Girrok", ["unit.shootbot"] = "Holographic Shootbot", -- Hard. ["unit.pumera"] = "Holographic Pumera", ["unit.osun"] = "Holographic Osun", ["unit.krogg"] = "Holographic Krogg", -- Elite. ["unit.ravenok"] = "Holographic Ravenok", ["unit.pell"] = "Holographic Pell", ["unit.titan"] = "Holographic Titan", ["unit.buffer"] = "Invisible Unit s71975 - Aquatic Buffer", -- titan cast, -- Extra units. ["unit.ai"] = "SDC-AI", ["unit.computer"] = "Super Duper Computer", ["unit.invis.0"] = "Hostile Invisible Unit for Fields (0 hit radius)", -- Cast names. ["cast.chompacabra.frenzy"] = "Feeding Frenzy", ["cast.chompacabra.trap"] = "Snap Trap", ["cast.moodie.firestorm"] = "Firestorm", ["cast.moodie.fissure"] = "Erupting Fissure", ["cast.shootbot.dash"] = "Slasher Dash", ["cast.shootbot.jump"] = "Jump Shot", ["cast.bandit.blast"] = "Blast Shot", ["cast.girrok.roar"] = "Roar", ["cast.aggressorbot.spin"] = "Mauling Spin", ["cast.pumera.pounce"] = "Pride Pounce", ["cast.pumera.frenzy"] = "Frenzy of the Feline", ["cast.pumera.swipe"] = "Leaping Swipe", ["cast.osun.firestorm"] = "Firestorm", ["cast.osun.fisure"] = "Erupting Fissure", ["cast.osun.superheated"] = "Superheated", ["cast.krogg.rush"] = "Crushing Rush", ["cast.krogg.flurry"] = "Crushing Flurry", ["cast.krogg.assault"] = "Focused Assault", ["cast.ravenok.head_shoulders"] = "Head and Shoulders", ["cast.ravenok.tooth_nail"] = "Tooth and Nail", ["cast.ravenok.winds"] = "Tail Winds", ["cast.ravenok.rush"] = "Ravenok Rush", ["cast.titan.slash"] = "Shellark Slash", ["cast.titan.strike"] = "Trident Strike", ["cast.titan.buffer"] = "Aquatic Buffer", ["cast.pell.vortex"] = "Swirling Vortex", -- Datachron. ["chron.equal.first"] = "First simulated datachron.", ["chron.equal.second"] = "Second simulated datachron.", ["chron.find.first.partial"] = "find me first", ["chron.find.second.partial"] = "find me second", ["chron.find.first.full"] = "Do find me first.", ["chron.find.second.full"] = "And then find me second.", ["chron.match.first.partial"] = "First match this name: ([^%s]+%s[^%s]+) hopefully%.", ["chron.match.second.partial"] = "Secondly match this name: ([^%s]+%s[^%s]+) please%.", ["chron.match.first.full"] = "First match this name: Zod Bain hopefully.", ["chron.match.second.full"] = "Secondly match this name: Zod Bain please.", }) ---------------------------------------------------------------------------------------------------- -- Settings. ---------------------------------------------------------------------------------------------------- mod:RegisterDefaultSetting("TestEnabledSettingOne") mod:RegisterDefaultSetting("TestDisabledSettingOne", false) mod:RegisterDefaultSetting("TestEnabledSettingTwo") mod:RegisterDefaultSetting("TestDisabledSettingTwo", false) mod:RegisterDefaultSetting("TestEnabledSettingThree") mod:RegisterDefaultSetting("TestDisabledSettingThree", false) mod:RegisterMessageSetting("MSG_1", core.E.COMPARE_EQUAL, "TestEnabledSettingOne", "TestEnabledSettingTwo") mod:RegisterMessageSetting("MSG_2", core.E.COMPARE_EQUAL, "TestEnabledSettingOne", "TestDisabledSettingTwo") mod:RegisterMessageSetting("MSG_3", core.E.COMPARE_EQUAL, "TestDisabledSettingOne", "TestEnabledSettingTwo") mod:RegisterMessageSetting("MSG_4", core.E.COMPARE_EQUAL, "TestDisabledSettingOne", "TestDisabledSettingTwo") mod:RegisterMessageSetting("MSG_5", core.E.COMPARE_EQUAL, nil, "TestEnabledSettingThree") mod:RegisterMessageSetting("MSG_6", core.E.COMPARE_EQUAL, "TestEnabledSettingThree", nil) mod:RegisterMessageSetting("MSG_7", core.E.COMPARE_EQUAL, nil, "TestDisabledSettingThree") mod:RegisterMessageSetting("MSG_8", core.E.COMPARE_EQUAL, "TestDisabledSettingThree", nil) mod:RegisterDefaultSetting("TestEqualOne") mod:RegisterDefaultSetting("TestEqualTwo") mod:RegisterDefaultSetting("TestFindOne") mod:RegisterDefaultSetting("TestFindTwo") mod:RegisterDefaultSetting("TestMatchOne") mod:RegisterDefaultSetting("TestMatchTwo") mod:RegisterMessageSetting("MSG_TEST_ONE", core.E.COMPARE_EQUAL, "TestEqualOne", "TestEqualTwo") mod:RegisterMessageSetting("MSG_FIND_ME", core.E.COMPARE_FIND, "TestFindOne", "TestFindTwo") mod:RegisterMessageSetting("MSG_MATCH_%d_ME", core.E.COMPARE_MATCH, "TestMatchOne", "TestMatchTwo") ---------------------------------------------------------------------------------------------------- -- Constants. ---------------------------------------------------------------------------------------------------- local BUFF_KROGG_FOCUSED_ASSAULT = 72202 local BUFF_OSUN_SUPERHEAT = 71236 --moodie and chompacabra debuff local DEBUFF_MELT = 50233 local DEBUFF_CHOMPACABRA_BLEED = 43759 local EXPECTED_DATACHRON_RESULTS = { { registerMessage = "chron.equal.first", message = "chron.equal.first", match = core.E.COMPARE_EQUAL, result = true, },{ registerMessage = "chron.equal.second", message = "chron.equal.second", match = core.E.COMPARE_EQUAL, result = true, },{ registerMessage = "chron.find.first.partial", message = "chron.find.first.full", match = core.E.COMPARE_FIND, result = 4, },{ registerMessage = "chron.find.second.partial", message = "chron.find.second.full", match = core.E.COMPARE_FIND, result = 10, },{ registerMessage = "chron.match.first.partial", message = "chron.match.first.full", match = core.E.COMPARE_MATCH, result = "Zod Bain", },{ registerMessage = "chron.match.second.partial", message = "chron.match.second.full", match = core.E.COMPARE_MATCH, result = "Zod Bain", }, } local ALL_MOBS = { -- Easy. "unit.chompacabra", "unit.moodie", "unit.aggressorbot", -- Normal. "unit.bandit", "unit.girrok", "unit.shootbot", -- Hard. "unit.pumera", "unit.osun", "unit.krogg", -- Elite. "unit.ravenok", "unit.pell", "unit.titan", "unit.buffer", "unit.invis.0", } local ALL_SPELLS = { ["unit.chompacabra"] = { "cast.chompacabra.frenzy", "cast.chompacabra.trap", }, ["unit.moodie"] = { "cast.moodie.firestorm", "cast.moodie.fissure", }, ["unit.shootbot"] = { "cast.shootbot.dash", "cast.shootbot.jump", }, ["unit.bandit"] = { "cast.bandit.blast", }, ["unit.girrok"] = { "cast.girrok.roar", }, ["unit.aggressorbot"] = { "cast.aggressorbot.spin", }, ["unit.pumera"] = { "cast.pumera.pounce", "cast.pumera.frenzy", "cast.pumera.swipe", }, ["unit.osun"] = { "cast.osun.firestorm", "cast.osun.fisure", "cast.osun.superheated", BUFF_OSUN_SUPERHEAT, }, ["unit.krogg"] = { "cast.krogg.rush", "cast.krogg.flurry", "cast.krogg.assault", BUFF_KROGG_FOCUSED_ASSAULT, }, ["unit.ravenok"] = { "cast.ravenok.head_shoulders", "cast.ravenok.tooth_nail", "cast.ravenok.rush", "cast.ravenok.winds", }, ["unit.titan"] = { "cast.titan.slash", "cast.titan.strike", "cast.titan.buffer", }, ["unit.pell"] = { "cast.pell.vortex", }, } local EVENTS_TO_TEST = { core.E.UNIT_CREATED, core.E.UNIT_DESTROYED, core.E.HEALTH_CHANGED, core.E.ENTERED_COMBAT, core.E.CAST_START, core.E.CAST_END, core.E.DEBUFF_ADD, core.E.DEBUFF_UPDATE, core.E.DEBUFF_REMOVE, core.E.BUFF_ADD, core.E.BUFF_UPDATE, core.E.BUFF_REMOVE, } local SPELL_EVENTS = { [core.E.CAST_START] = true, [core.E.CAST_END] = true, [core.E.BUFF_ADD] = true, [core.E.BUFF_UPDATE] = true, [core.E.BUFF_REMOVE] = true, [core.E.DEBUFF_ADD] = true, [core.E.DEBUFF_UPDATE] = true, [core.E.DEBUFF_REMOVE] = true, } local MESSAGE_SETTINGS_TESTS = { {key = "MSG_1", msg = true, sound = true}, {key = "MSG_2", msg = true, sound = false}, {key = "MSG_3", msg = false, sound = true}, {key = "MSG_4", msg = false, sound = false}, {key = "MSG_5", msg = true, sound = true}, {key = "MSG_6", msg = true, sound = true}, {key = "MSG_7", msg = true, sound = false}, {key = "MSG_8", msg = false, sound = true}, {key = "MSG_TEST_ONE", msg = true, sound = true}, {key = "MSG_FIND_ME_SOMEWHERE", msg = true, sound = true}, {key = "MSG_MATCH_123_ME", msg = true, sound = true}, } ---------------------------------------------------------------------------------------------------- -- Locals. ---------------------------------------------------------------------------------------------------- local FakeDatachron = {} function FakeDatachron:GetType() return ChatSystemLib.ChatChannel_Datachron end local datachronResult local datachronExpected local datachronTestNumber local eventCounter local unitEventCounter local events local unitEventsInitialized = false local messageTestCounter ---------------------------------------------------------------------------------------------------- -- Functions. ---------------------------------------------------------------------------------------------------- local next = next local function SimulateDatachron(message) core:CI_OnChatMessage(FakeDatachron, { strSender = "TestEncounter", arMessageSegments = {{strText = message}}, } ) end local function RegisterDatachronTestResult(registerMessage, message, result, oldEvent) --Add a event result that occured table.insert(datachronResult, { registerMessage = registerMessage, message = message, result = result, oldEvent = oldEvent, }) end local function RegisterDatachronTestEvent(registerMessage, match) --Bind datachron events based on the expected results mod:RegisterDatachronEvent(registerMessage, match, function (_, message, result) RegisterDatachronTestResult(registerMessage, message, result, false) end ) end local function RegisterTestEvent(eventName) --Register old events and unit events and keep count of how many events --happened and remove them in the same order again. mod[eventName] = function(...) --Handle normal events eventCounter[eventName] = eventCounter[eventName] or 0 local eventKey = eventName .. tostring(eventCounter[eventName]) events[eventKey] = {...} eventCounter[eventName] = eventCounter[eventName] + 1 --Handle buff and cast events if SPELL_EVENTS[eventName] then local primaryEventName = eventName .. "_Primary" eventCounter[primaryEventName] = eventCounter[primaryEventName] or 0 eventKey = primaryEventName .. tostring(eventCounter[primaryEventName]) events[eventKey] = {...} eventCounter[primaryEventName] = eventCounter[primaryEventName] + 1 local secondaryEventName = eventName .. "_Secondary" eventCounter[secondaryEventName] = eventCounter[secondaryEventName] or 0 eventKey = secondaryEventName .. tostring(eventCounter[secondaryEventName]) events[eventKey] = {...} eventCounter[secondaryEventName] = eventCounter[secondaryEventName] + 1 end end mod:RegisterUnitEvents(core.E.ALL_UNITS, { [eventName] = function(...) unitEventCounter[eventName] = unitEventCounter[eventName] or 0 local eventKey = eventName .. tostring(unitEventCounter[eventName]) mod:CompareEvents(eventName, events[eventKey], {...}) events[eventKey] = nil unitEventCounter[eventName] = unitEventCounter[eventName] + 1 end } ) if not SPELL_EVENTS[eventName] then return end for mob, spellIds in next, ALL_SPELLS do local size = #spellIds for i = 1, size do local spellId = spellIds[i] mod:RegisterUnitEvents(mob, { [eventName] = { [spellId] = function(...) local primaryEventName = eventName .. "_Primary" unitEventCounter[primaryEventName] = unitEventCounter[primaryEventName] or 0 local eventKey = primaryEventName .. tostring(unitEventCounter[primaryEventName]) mod:CompareEvents(primaryEventName, events[eventKey], {...}) events[eventKey] = nil unitEventCounter[primaryEventName] = unitEventCounter[primaryEventName] + 1 end }, [spellId] = { [eventName] = function(...) local secondaryEventName = eventName .. "_Secondary" unitEventCounter[secondaryEventName] = unitEventCounter[secondaryEventName] or 0 local eventKey = secondaryEventName .. tostring(unitEventCounter[secondaryEventName]) mod:CompareEvents(secondaryEventName, events[eventKey], {...}) events[eventKey] = nil unitEventCounter[secondaryEventName] = unitEventCounter[secondaryEventName] + 1 end }, } ) end end end ---------------------------------------------------------------------------------------------------- -- Encounter description. ---------------------------------------------------------------------------------------------------- for _, result in next, EXPECTED_DATACHRON_RESULTS do RegisterDatachronTestEvent(result.registerMessage, result.match) end function mod:OnBossEnable() eventCounter = {} unitEventCounter = {} events = {} if not unitEventsInitialized then local playerName = GameLib.GetPlayerUnit():GetName() ALL_SPELLS[playerName] = { DEBUFF_MELT, DEBUFF_CHOMPACABRA_BLEED, } table.insert(ALL_MOBS, playerName) for _, eventName in next, EVENTS_TO_TEST do RegisterTestEvent(eventName) end unitEventsInitialized = true end --Start datachron test cycles. datachronTestNumber = 0 mod:AddTimerBar("DATACHRON", "Simulate datachron", 0.5, false, nil, mod.SimulateDatachron, mod) --Start unit events cycle. mod:AddTimerBar("UNIT_EVENTS", "Check if events have not been caught", 0.5, false, nil, mod.CheckEvents, mod) messageTestCounter = 1 mod:AddTimerBar("MSG_SETTINGS", "Start message tests", 0.5, false, nil, mod.MessageTest, mod) end function mod:MessageTest() local msgTest = MESSAGE_SETTINGS_TESTS[messageTestCounter] messageTestCounter = messageTestCounter + 1 if not msgTest then return end local key = msgTest.key local msg = msgTest.msg and key or "You should not see this "..key local sound = msgTest.sound and "Info" or "Inferno" mod:AddMsg(key, msg, 1, sound) mod:AddTimerBar("MSG_SETTINGS", "Next message tests", 1, false, nil, mod.MessageTest, mod) end function mod:SimulateDatachron() --Cycle through datachron tests until we finished them all datachronTestNumber = datachronTestNumber + 1 datachronResult = {} datachronExpected = EXPECTED_DATACHRON_RESULTS[datachronTestNumber] if datachronExpected then SimulateDatachron(self.L[datachronExpected.message]) --Check results after a short timer to make sure all the events got caught mod:AddTimerBar("DATACHRON", "Check datachron result", 0.5, false, nil, mod.CheckDatachronResult, mod) end end function mod:CheckDatachronResult() --Check the results from the last simulated datachron. local expectedFound = false local expectedOldFound = false local nCount = #datachronResult for i = 1, nCount do local testResult = datachronResult[i] local message = testResult.message local result = testResult.result local registerMessage = testResult.registerMessage if registerMessage == datachronExpected.registerMessage then --Test against the expected result assert(self.L[datachronExpected.message] == message, "Messages are not the same: "..message.." == "..self.L[datachronExpected.message]) assert(result == datachronExpected.result, "Results are not the same: "..tostring(result).." == "..tostring(datachronExpected.result)) expectedFound = true elseif testResult.oldEvent then --Test message passthrough of old datachron events. assert(self.L[datachronExpected.message] == message, "Messages are not the same: "..message.." == "..self.L[datachronExpected.message]) expectedOldFound = true else --This should never happen. Too many results have been found. assert(registerMessage == nil, registerMessage.." should not be here, expected: "..datachronExpected.registerMessage) end end --No results are found = bad assert(expectedFound == true, "Expected result for "..datachronExpected.registerMessage.." has not been found.") assert(expectedOldFound == true, "Expected old result for "..datachronExpected.registerMessage.." has not been found.") --Start next cycle mod:AddTimerBar("DATACHRON", "Simulate datachron", 0.5, false, nil, mod.SimulateDatachron, mod) end function mod:OnDatachron (message) --Register old datachron events just to make sure they still get passed through too RegisterDatachronTestResult(nil, message, nil, true) end function mod:CompareEvents(eventName, args1, args2) assert(args1 ~= nil, "Old args for "..eventName.." not found") assert(args2 ~= nil, "Unit event args for "..eventName.." not found") --Compare the amount of arguments and the arguments themselves local count1 = #args1 local count2 = #args2 assert(count1 == count2, "Different amount of parameters in "..eventName.." "..tostring(count1).." == "..tostring(count2)) for i = 1, count1 do local arg1 = args1[i] local arg2 = args2[i] assert(arg1 == arg2, "Arguments are not equal "..eventName.." "..tostring(arg1).." == "..tostring(arg2)) end end function mod:CheckEvents() --Check if any events have not been caught by unit events. --If this ever causes a race condition add a flag to the events and then --do the assert on the second pass if they are still there for eventName, _ in next, events do assert(eventName == nil, eventName.." has not been detected by unit events") end mod:AddTimerBar("UNIT_EVENTS", "Check if events have not been caught", 1, false, nil, mod.CheckEvents, mod) end mod:RegisterUnitEvents(ALL_MOBS, { ["OnUnitCreated"] = function (_, _, unit) core:WatchUnit(unit) core:AddUnit(unit) end, } )
mit
ShahriyarB/Warcraft-Lua-Engine-2
luasocket-master/test/urltest.lua
30
17349
local socket = require("socket") socket.url = require("socket.url") dofile("testsupport.lua") local check_build_url = function(parsed) local built = socket.url.build(parsed) if built ~= parsed.url then print("built is different from expected") print(built) print(expected) os.exit() end end local check_protect = function(parsed, path, unsafe) local built = socket.url.build_path(parsed, unsafe) if built ~= path then print(built, path) print("path composition failed.") os.exit() end end local check_invert = function(url) local parsed = socket.url.parse(url) parsed.path = socket.url.build_path(socket.url.parse_path(parsed.path)) local rebuilt = socket.url.build(parsed) if rebuilt ~= url then print(url, rebuilt) print("original and rebuilt are different") os.exit() end end local check_parse_path = function(path, expect) local parsed = socket.url.parse_path(path) for i = 1, math.max(#parsed, #expect) do if parsed[i] ~= expect[i] then print(path) os.exit() end end if expect.is_directory ~= parsed.is_directory then print(path) print("is_directory mismatch") os.exit() end if expect.is_absolute ~= parsed.is_absolute then print(path) print("is_absolute mismatch") os.exit() end local built = socket.url.build_path(expect) if built ~= path then print(built, path) print("path composition failed.") os.exit() end end local check_absolute_url = function(base, relative, absolute) local res = socket.url.absolute(base, relative) if res ~= absolute then io.write("absolute: In test for '", relative, "' expected '", absolute, "' but got '", res, "'\n") os.exit() end end local check_parse_url = function(gaba) local url = gaba.url gaba.url = nil local parsed = socket.url.parse(url) for i, v in pairs(gaba) do if v ~= parsed[i] then io.write("parse: In test for '", url, "' expected ", i, " = '", v, "' but got '", tostring(parsed[i]), "'\n") for i,v in pairs(parsed) do print(i,v) end os.exit() end end for i, v in pairs(parsed) do if v ~= gaba[i] then io.write("parse: In test for '", url, "' expected ", i, " = '", tostring(gaba[i]), "' but got '", v, "'\n") for i,v in pairs(parsed) do print(i,v) end os.exit() end end end print("testing URL parsing") check_parse_url{ url = "scheme://userinfo@host:port/path;params?query#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", query = "query", fragment = "fragment" } check_parse_url{ url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", authority = "user:password@host:port", host = "host", port = "port", userinfo = "user:password", user = "user", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment", } check_parse_url{ url = "scheme://userinfo@host:port/path;params?query#", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", query = "query", fragment = "" } check_parse_url{ url = "scheme://userinfo@host:port/path;params?#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", query = "", fragment = "fragment" } check_parse_url{ url = "scheme://userinfo@host:port/path;params#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", fragment = "fragment" } check_parse_url{ url = "scheme://userinfo@host:port/path;?query#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "", query = "query", fragment = "fragment" } check_parse_url{ url = "scheme://userinfo@host:port/path?query#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", query = "query", fragment = "fragment" } check_parse_url{ url = "scheme://userinfo@host:port/;params?query#fragment", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/", params = "params", query = "query", fragment = "fragment" } check_parse_url{ url = "scheme://userinfo@host:port", scheme = "scheme", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", } check_parse_url{ url = "//userinfo@host:port/path;params?query#fragment", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", query = "query", fragment = "fragment" } check_parse_url{ url = "//userinfo@host:port/path", authority = "userinfo@host:port", host = "host", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", } check_parse_url{ url = "//userinfo@host/path", authority = "userinfo@host", host = "host", userinfo = "userinfo", user = "userinfo", path = "/path", } check_parse_url{ url = "//user:password@host/path", authority = "user:password@host", host = "host", userinfo = "user:password", password = "password", user = "user", path = "/path", } check_parse_url{ url = "//user:@host/path", authority = "user:@host", host = "host", userinfo = "user:", password = "", user = "user", path = "/path", } check_parse_url{ url = "//user@host:port/path", authority = "user@host:port", host = "host", userinfo = "user", user = "user", port = "port", path = "/path", } check_parse_url{ url = "//host:port/path", authority = "host:port", port = "port", host = "host", path = "/path", } check_parse_url{ url = "//host/path", authority = "host", host = "host", path = "/path", } check_parse_url{ url = "//host", authority = "host", host = "host", } check_parse_url{ url = "/path", path = "/path", } check_parse_url{ url = "path", path = "path", } -- IPv6 tests check_parse_url{ url = "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", scheme = "http", host = "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", authority = "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80", port = "80", path = "/index.html" } check_parse_url{ url = "http://[1080:0:0:0:8:800:200C:417A]/index.html", scheme = "http", host = "1080:0:0:0:8:800:200C:417A", authority = "[1080:0:0:0:8:800:200C:417A]", path = "/index.html" } check_parse_url{ url = "http://[3ffe:2a00:100:7031::1]", scheme = "http", host = "3ffe:2a00:100:7031::1", authority = "[3ffe:2a00:100:7031::1]", } check_parse_url{ url = "http://[1080::8:800:200C:417A]/foo", scheme = "http", host = "1080::8:800:200C:417A", authority = "[1080::8:800:200C:417A]", path = "/foo" } check_parse_url{ url = "http://[::192.9.5.5]/ipng", scheme = "http", host = "::192.9.5.5", authority = "[::192.9.5.5]", path = "/ipng" } check_parse_url{ url = "http://[::FFFF:129.144.52.38]:80/index.html", scheme = "http", host = "::FFFF:129.144.52.38", port = "80", authority = "[::FFFF:129.144.52.38]:80", path = "/index.html" } check_parse_url{ url = "http://[2010:836B:4179::836B:4179]", scheme = "http", host = "2010:836B:4179::836B:4179", authority = "[2010:836B:4179::836B:4179]", } check_parse_url{ url = "//userinfo@[::FFFF:129.144.52.38]:port/path;params?query#fragment", authority = "userinfo@[::FFFF:129.144.52.38]:port", host = "::FFFF:129.144.52.38", port = "port", userinfo = "userinfo", user = "userinfo", path = "/path", params = "params", query = "query", fragment = "fragment" } check_parse_url{ url = "scheme://user:password@[::192.9.5.5]:port/path;params?query#fragment", scheme = "scheme", authority = "user:password@[::192.9.5.5]:port", host = "::192.9.5.5", port = "port", userinfo = "user:password", user = "user", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } print("testing URL building") check_build_url { url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", host = "host", port = "port", user = "user", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url{ url = "//userinfo@[::FFFF:129.144.52.38]:port/path;params?query#fragment", host = "::FFFF:129.144.52.38", port = "port", user = "userinfo", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url{ url = "scheme://user:password@[::192.9.5.5]:port/path;params?query#fragment", scheme = "scheme", host = "::192.9.5.5", port = "port", user = "user", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://user:password@host/path;params?query#fragment", scheme = "scheme", host = "host", user = "user", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://user@host/path;params?query#fragment", scheme = "scheme", host = "host", user = "user", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://host/path;params?query#fragment", scheme = "scheme", host = "host", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://host/path;params#fragment", scheme = "scheme", host = "host", path = "/path", params = "params", fragment = "fragment" } check_build_url { url = "scheme://host/path#fragment", scheme = "scheme", host = "host", path = "/path", fragment = "fragment" } check_build_url { url = "scheme://host/path", scheme = "scheme", host = "host", path = "/path", } check_build_url { url = "//host/path", host = "host", path = "/path", } check_build_url { url = "/path", path = "/path", } check_build_url { url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", host = "host", port = "port", user = "user", userinfo = "not used", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", host = "host", port = "port", user = "user", userinfo = "not used", authority = "not used", password = "password", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", host = "host", port = "port", userinfo = "user:password", authority = "not used", path = "/path", params = "params", query = "query", fragment = "fragment" } check_build_url { url = "scheme://user:password@host:port/path;params?query#fragment", scheme = "scheme", authority = "user:password@host:port", path = "/path", params = "params", query = "query", fragment = "fragment" } -- standard RFC tests print("testing absolute resolution") check_absolute_url("http://a/b/c/d;p?q#f", "g:h", "g:h") check_absolute_url("http://a/b/c/d;p?q#f", "g", "http://a/b/c/g") check_absolute_url("http://a/b/c/d;p?q#f", "./g", "http://a/b/c/g") check_absolute_url("http://a/b/c/d;p?q#f", "g/", "http://a/b/c/g/") check_absolute_url("http://a/b/c/d;p?q#f", "/g", "http://a/g") check_absolute_url("http://a/b/c/d;p?q#f", "//g", "http://g") check_absolute_url("http://a/b/c/d;p?q#f", "?y", "http://a/b/c/d;p?y") check_absolute_url("http://a/b/c/d;p?q#f", "g?y", "http://a/b/c/g?y") check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/./x") check_absolute_url("http://a/b/c/d;p?q#f", "#s", "http://a/b/c/d;p?q#s") check_absolute_url("http://a/b/c/d;p?q#f", "g#s", "http://a/b/c/g#s") check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/./x") check_absolute_url("http://a/b/c/d;p?q#f", "g?y#s", "http://a/b/c/g?y#s") check_absolute_url("http://a/b/c/d;p?q#f", ";x", "http://a/b/c/d;x") check_absolute_url("http://a/b/c/d;p?q#f", "g;x", "http://a/b/c/g;x") check_absolute_url("http://a/b/c/d;p?q#f", "g;x?y#s", "http://a/b/c/g;x?y#s") check_absolute_url("http://a/b/c/d;p?q#f", ".", "http://a/b/c/") check_absolute_url("http://a/b/c/d;p?q#f", "./", "http://a/b/c/") check_absolute_url("http://a/b/c/d;p?q#f", "..", "http://a/b/") check_absolute_url("http://a/b/c/d;p?q#f", "../", "http://a/b/") check_absolute_url("http://a/b/c/d;p?q#f", "../g", "http://a/b/g") check_absolute_url("http://a/b/c/d;p?q#f", "../..", "http://a/") check_absolute_url("http://a/b/c/d;p?q#f", "../../", "http://a/") check_absolute_url("http://a/b/c/d;p?q#f", "../../g", "http://a/g") check_absolute_url("http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q#f") check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/./g") check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/../g") check_absolute_url("http://a/b/c/d;p?q#f", "g.", "http://a/b/c/g.") check_absolute_url("http://a/b/c/d;p?q#f", ".g", "http://a/b/c/.g") check_absolute_url("http://a/b/c/d;p?q#f", "g..", "http://a/b/c/g..") check_absolute_url("http://a/b/c/d;p?q#f", "..g", "http://a/b/c/..g") check_absolute_url("http://a/b/c/d;p?q#f", "./../g", "http://a/b/g") check_absolute_url("http://a/b/c/d;p?q#f", "./g/.", "http://a/b/c/g/") check_absolute_url("http://a/b/c/d;p?q#f", "g/./h", "http://a/b/c/g/h") check_absolute_url("http://a/b/c/d;p?q#f", "g/../h", "http://a/b/c/h") -- extra tests check_absolute_url("//a/b/c/d;p?q#f", "d/e/f", "//a/b/c/d/e/f") check_absolute_url("/a/b/c/d;p?q#f", "d/e/f", "/a/b/c/d/e/f") check_absolute_url("a/b/c/d", "d/e/f", "a/b/c/d/e/f") check_absolute_url("a/b/c/d/../", "d/e/f", "a/b/c/d/e/f") check_absolute_url("http://velox.telemar.com.br", "/dashboard/index.html", "http://velox.telemar.com.br/dashboard/index.html") print("testing path parsing and composition") check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 }) check_parse_path("/eu/", { "eu"; is_absolute = 1, is_directory = 1 }) check_parse_path("eu/tu/ele/nos/vos/eles/", { "eu", "tu", "ele", "nos", "vos", "eles"; is_directory = 1}) check_parse_path("/", { is_absolute = 1, is_directory = 1}) check_parse_path("", { }) check_parse_path("eu%01/%02tu/e%03l%04e/nos/vos%05/e%12les/", { "eu\1", "\2tu", "e\3l\4e", "nos", "vos\5", "e\18les"; is_directory = 1}) check_parse_path("eu/tu", { "eu", "tu" }) print("testing path protection") check_protect({ "eu", "-_.!~*'():@&=+$,", "tu" }, "eu/-_.!~*'():@&=+$,/tu") check_protect({ "eu ", "~diego" }, "eu%20/~diego") check_protect({ "/eu>", "<diego?" }, "%2feu%3e/%3cdiego%3f") check_protect({ "\\eu]", "[diego`" }, "%5ceu%5d/%5bdiego%60") check_protect({ "{eu}", "|diego\127" }, "%7beu%7d/%7cdiego%7f") check_protect({ "eu ", "~diego" }, "eu /~diego", 1) check_protect({ "/eu>", "<diego?" }, "/eu>/<diego?", 1) check_protect({ "\\eu]", "[diego`" }, "\\eu]/[diego`", 1) check_protect({ "{eu}", "|diego\127" }, "{eu}/|diego\127", 1) print("testing inversion") check_invert("http:") check_invert("a/b/c/d.html") check_invert("//net_loc") check_invert("http:a/b/d/c.html") check_invert("//net_loc/a/b/d/c.html") check_invert("http://net_loc/a/b/d/c.html") check_invert("//who:isit@net_loc") check_invert("http://he:man@boo.bar/a/b/c/i.html;type=moo?this=that#mark") check_invert("/b/c/d#fragment") check_invert("/b/c/d;param#fragment") check_invert("/b/c/d;param?query#fragment") check_invert("/b/c/d?query") check_invert("/b/c/d;param?query") check_invert("http://he:man@[::192.168.1.1]/a/b/c/i.html;type=moo?this=that#mark") print("the library passed all tests")
gpl-2.0
OctoEnigma/shiny-octo-system
gamemodes/darkrp/gamemode/modules/fadmin/fadmin/playeractions/teleport/cl_init.lua
6
2349
FAdmin.StartHooks["zz_Teleport"] = function() FAdmin.Messages.RegisterNotification{ name = "goto", hasTarget = true, message = {"instigator", " teleported to ", "targets"} } FAdmin.Messages.RegisterNotification{ name = "bring", hasTarget = true, message = {"instigator", " brought ", "targets", " to them"} } FAdmin.Access.AddPrivilege("Teleport", 2) FAdmin.Commands.AddCommand("Teleport", nil, "[Player]") FAdmin.Commands.AddCommand("TP", nil, "[Player]") FAdmin.Commands.AddCommand("Bring", nil, "<Player>", "[Player]") FAdmin.Commands.AddCommand("goto", nil, "<Player>") FAdmin.ScoreBoard.Player:AddActionButton("Teleport", "fadmin/icons/teleport", Color(0, 200, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "Teleport") end, function(ply, button) RunConsoleCommand("_FAdmin", "Teleport", ply:UserID()) end) FAdmin.ScoreBoard.Player:AddActionButton("Goto", "fadmin/icons/teleport", Color(0, 200, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "Teleport") and ply ~= LocalPlayer() end, function(ply, button) RunConsoleCommand("_FAdmin", "goto", ply:UserID()) end) FAdmin.ScoreBoard.Player:AddActionButton("Bring", "fadmin/icons/teleport", Color(0, 200, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "Teleport") and ply ~= LocalPlayer() end, function(ply, button) local menu = DermaMenu() local Padding = vgui.Create("DPanel") Padding:SetPaintBackgroundEnabled(false) Padding:SetSize(1,5) menu:AddPanel(Padding) local Title = vgui.Create("DLabel") Title:SetText(" Bring to:\n") Title:SetFont("UiBold") Title:SizeToContents() Title:SetTextColor(color_black) menu:AddPanel(Title) local uid = ply:UserID() menu:AddOption("Yourself", function() RunConsoleCommand("_FAdmin", "bring", uid) end) for k, v in pairs(DarkRP.nickSortedPlayers()) do if v ~= LocalPlayer() then local vUid = v:UserID() menu:AddOption(v:Nick(), function() RunConsoleCommand("_FAdmin", "bring", uid, vUid) end) end end menu:Open() end) end
mit
RunAwayDSP/darkstar
scripts/globals/items/strip_of_bison_jerky.lua
11
1077
----------------------------------------- -- ID: 5207 -- Item: strip_of_bison_jerky -- Food Effect: 60Min, All Races ----------------------------------------- -- Strength 5 -- Mind -2 -- Attack % 18 -- Attack Cap 70 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,3600,5207) end function onEffectGain(target,effect) target:addMod(dsp.mod.STR, 5) target:addMod(dsp.mod.MND, -2) target:addMod(dsp.mod.FOOD_ATTP, 18) target:addMod(dsp.mod.FOOD_ATT_CAP, 70) end function onEffectLose(target, effect) target:delMod(dsp.mod.STR, 5) target:delMod(dsp.mod.MND, -2) target:delMod(dsp.mod.FOOD_ATTP, 18) target:delMod(dsp.mod.FOOD_ATT_CAP, 70) end
gpl-3.0
lichtl/darkstar
scripts/zones/Dynamis-Xarcabard/mobs/Animated_Claymore.lua
17
1498
----------------------------------- -- Area: Dynamis Xarcabard -- MOB: Animated Claymore ----------------------------------- require("scripts/globals/status"); require("scripts/zones/Dynamis-Xarcabard/TextIDs"); ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) if (mob:AnimationSub() == 3) then SetDropRate(102,1574,1000); else SetDropRate(102,1574,0); end target:showText(mob,ANIMATED_CLAYMORE_DIALOG); SpawnMob(17330365):updateEnmity(target); SpawnMob(17330366):updateEnmity(target); SpawnMob(17330367):updateEnmity(target); SpawnMob(17330372):updateEnmity(target); SpawnMob(17330373):updateEnmity(target); SpawnMob(17330374):updateEnmity(target); end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) -- TODO: add battle dialog end; ----------------------------------- -- onMobDisengage ----------------------------------- function onMobDisengage(mob) mob:showText(mob,ANIMATED_CLAYMORE_DIALOG+2); end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) player:showText(mob,ANIMATED_CLAYMORE_DIALOG+1); DespawnMob(17330365); DespawnMob(17330366); DespawnMob(17330367); DespawnMob(17330372); DespawnMob(17330373); DespawnMob(17330374); end;
gpl-3.0
lichtl/darkstar
scripts/globals/abilities/wind_maneuver.lua
19
1605
----------------------------------- -- Ability: Wind Maneuver -- Enhances the effect of wind attachments. Must have animator equipped. -- Obtained: Puppetmaster level 1 -- Recast Time: 10 seconds (shared with all maneuvers) -- Duration: 1 minute ----------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (player:getWeaponSubSkillType(SLOT_RANGED) == 10 and not player:hasStatusEffect(EFFECT_OVERLOAD)) then return 0,0; else return 71,0; end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local burden = 15; if (target:getStat(MOD_AGI) < target:getPet():getStat(MOD_AGI)) then burden = 20; end local overload = target:addBurden(ELE_WIND-1, burden); if (overload ~= 0) then target:removeAllManeuvers(); target:addStatusEffect(EFFECT_OVERLOAD, 0, 0, overload); else local level; if (target:getMainJob() == JOBS.PUP) then level = target:getMainLvl() else level = target:getSubLvl() end local bonus = 1 + (level/15) + target:getMod(MOD_MANEUVER_BONUS); if (target:getActiveManeuvers() == 3) then target:removeOldestManeuver(); end target:addStatusEffect(EFFECT_WIND_MANEUVER, bonus, 0, 60); end return EFFECT_WIND_MANEUVER; end;
gpl-3.0
lichtl/darkstar
scripts/zones/East_Ronfaure/npcs/Field_Manual.lua
29
1057
----------------------------------- -- Field Manual -- Area: East Ronfaure ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/fieldsofvalor"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) startFov(FOV_EVENT_EAST_RONFAURE,player); end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onEventSelection ----------------------------------- function onEventUpdate(player,csid,menuchoice) updateFov(player,csid,menuchoice,64,65,66,67,68); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) finishFov(player,csid,option,64,65,66,67,68,FOV_MSG_EAST_RONFAURE); end;
gpl-3.0
lichtl/darkstar
scripts/zones/Al_Zahbi/npcs/Bjibar.lua
14
1037
----------------------------------- -- Area: Al Zahbi -- NPC: Bjibar -- Type: Standard NPC -- @zone 48 -- @pos -105.178 0.999 60.115 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0107); 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
lichtl/darkstar
scripts/zones/RuLude_Gardens/npcs/Pursuivant.lua
14
1047
----------------------------------- -- Area: Ru'Lude Gardens -- NPC: Pursuivant -- Type: Pursuivant -- @zone 243 -- @pos 52.020 -1 -17.813 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0045); 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
lichtl/darkstar
scripts/zones/Horlais_Peak/bcnms/under_observation.lua
30
1739
----------------------------------- -- Area: Horlias peak -- Name: under_observation -- BCNM40 ----------------------------------- package.loaded["scripts/zones/Horlais_Peak/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Horlais_Peak/TextIDs"); ----------------------------------- -- EXAMPLE SCRIPT -- -- What should go here: -- giving key items, playing ENDING cutscenes -- -- What should NOT go here: -- Handling of "battlefield" status, spawning of monsters, -- putting loot into treasure pool, -- enforcing ANY rules (SJ/number of people/etc), moving -- chars around, playing entrance CSes (entrance CSes go in bcnm.lua) -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if (leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,12,0); elseif (leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); end;
gpl-3.0
misterfish/fish-pines
coro.lua
1
3299
needs ({ me = 'coro' }, '__imported_util') local _, k, v -- resume coroutines sequentially until they all finish. -- -- hashooks means the yields give a 'how' object, which gives info about -- whether the coro is waiting, done, or failed. local pool pool = (function () local function new (args) local self = { verbose = false, coros = {}, numtasks = 0, done = {}, numdone = 0, amdone = false, done_cb = nil, } local tasks = args.tasks or error2 "pool.new: need tasks" self.verbose = args.verbose or false self.done_cb = args.done_cb or nil (function () local taskidx = 0 local task for _, task in pairs (tasks) do local coro = task[1] local kind = task.kind or 'function' local hashooks = task.hashooks or false self.numtasks = self.numtasks + 1 taskidx = taskidx + 1 self.coros [taskidx] = { coro = coro, hashooks = hashooks } end return coros, numtasks end) () setmetatable(self, { __index = function (tbl, varname, val) if val == nil then return pool[varname] end end }) return self end local function once (self) local idx, cowrap for idx, cowrap in ipairs (self.coros) do if self.done [idx] then goto nxt end local coro = cowrap.coro or error 'need coro.coro' local hashooks = cowrap.hashooks or false if coroutine.status (coro) ~= 'suspended' then self.done [idx] = true self.numdone = self.numdone + 1 if self.numdone == self.numtasks then self.amdone = true if self.done_cb then self.done_cb () end break end goto nxt end local yield, how if hashooks then yield, how = coroutine.resume (coro) else yield = coroutine.resume (coro) end if not yield then error "Error running coroutine." end if hashooks then if how.ok == nil then if self.verbose then infof ("Task %s still spinning.", ( ({ CY, Y }) [idx % 2 + 1] ) (idx) ) end elseif how.ok then if self.verbose then infof ("Task %s went home.", G (idx)) end else if self.verbose then infof ("Task %s went crazy.", BR (idx)) end end end ::nxt:: end end local function isdone (self) return self.amdone end return { new = new, once = once, isdone = isdone, } end)() --if done_cb then done_cb () end return { pool = pool, }
gpl-2.0
da03/OpenNMT
onmt/scorers/tercom.lua
3
13718
-- implementation based on tercom v6 perl ----------------------- DEFAULT PARAMETERS ----------------------- -- standard costs local MATCH_COST = 0 local INSERT_COST = 1 local DELETE_COST = 1 local SUB_COST = 1 local SHIFT_COST = 1 -- Super high value used to mark an impossible path local INF = 99999999999 -- Maximum Length Sequence to Shift -- Set to 0 to turn on shifting local MAX_SHIFT_SIZE = 10 -- Maximum Distance To Shift local MAX_SHIFT_DIST = 50 ----------------------- ACTUAL CODE ----------------------- local function _min_edit_dist(i, j, hw, rw, mat, pat, full) -- recursively calculate the min edit path -- finalized exploration if i == 0 and j == 0 then return 0 end -- should never happen if i < 0 or j < 0 then return INF end -- extra-words horizontally or vertically if i == 0 then return j * DELETE_COST end if j == 0 then return i * INSERT_COST end -- already calculated if mat[i][j] then return mat[i][j] end -- diagonal cost local dia_cost = _min_edit_dist(i-1, j-1, hw, rw, mat, pat, full) local mcost = INF local scost = INF if hw[i] == rw[j] then mcost = MATCH_COST + dia_cost else scost = SUB_COST + dia_cost end local ip_cost = _min_edit_dist(i-1, j, hw, rw, mat, pat, full) local dp_cost = _min_edit_dist(i, j-1, hw, rw, mat, pat, full) local icost = INSERT_COST + ip_cost local dcost = DELETE_COST + dp_cost if mcost <= icost and mcost <= dcost and mcost <= scost then -- Match is best mat[i][j] = mcost pat[i][j] = " " elseif full and scost <= icost and scost <= dcost then -- local function is best mat[i][j] = scost pat[i][j] = "S" elseif icost <= dcost then -- Insert is best mat[i][j] = icost pat[i][j] = "I" else -- Deletion is best mat[i][j] = dcost pat[i][j] = "D" end return mat[i][j] end local function backtrace_path(pat, i, j) -- backtrace the min-edit-path local path = {} while i >= 1 or j >= 1 do if i < 1 then table.insert(path, 1, "D") j = j - 1 elseif j < 1 then table.insert(path, 1, "I") i = i - 1 else table.insert(path, 1, pat[i][j]) if pat[i][j] == " " or pat[i][j] == "S" then i = i - 1 j = j - 1 elseif pat[i][j] == "I" then i = i - 1 else j = j - 1 end end end return path end local function min_edit_dist_arr(hw, rw, full) -- calculate the min-edit-dist on array of words local mat = {} local pat = {} for _ = 1, #hw do table.insert(mat, {}) table.insert(pat, {}) end _min_edit_dist(#hw, #rw, hw, rw, mat, pat, full) local score = mat[#hw][#rw] local path = backtrace_path(pat, #hw, #rw) return score, path end local function perform_shift(hwords, startpos, endpos, moveto) -- perform a shift on a string of words local range = {} if moveto == 0 then for j = startpos, endpos do table.insert(range, hwords[j]) end for j = 0, startpos - 1 do table.insert(range, hwords[j]) end for j = endpos + 1, #hwords do table.insert(range, hwords[j]) end elseif moveto < startpos then for j = 1, moveto do table.insert(range, hwords[j]) end for j = startpos, endpos do table.insert(range, hwords[j]) end for j = moveto + 1, startpos - 1 do table.insert(range, hwords[j]) end for j = endpos + 1, #hwords do table.insert(range, hwords[j]) end elseif moveto > endpos then for j = 1, startpos-1 do table.insert(range, hwords[j]) end for j = endpos+1, moveto do table.insert(range, hwords[j]) end for j = startpos, endpos do table.insert(range, hwords[j]) end for j = moveto + 1, #hwords do table.insert(range, hwords[j]) end else -- we are moving inside of ourselves for j = 1, startpos-1 do table.insert(range, hwords[j]) end for j = endpos+1, endpos + moveto - startpos do table.insert(range, hwords[j]) end for j = startpos, endpos do table.insert(range, hwords[j]) end for j = endpos + moveto - startpos + 1, #hwords do table.insert(range, hwords[j]) end end return range end local function gather_all_poss_shifts(hwords, rloc, ralign, herr, rerr, min_size) -- find all possible shifts to search through local poss = {} local max_poss = -1 -- return an array (@poss), indexed by len of shift -- each entry is (startpos, end, moveto) for startpos = 1, #hwords do if rloc[hwords[startpos]] then local ok = false for _, moveto in ipairs(rloc[hwords[startpos]]) do ok = ok or (startpos ~= ralign[moveto] and ralign[moveto] - startpos <= MAX_SHIFT_DIST and startpos - ralign[moveto]-1 <= MAX_SHIFT_DIST) end local endpos = startpos + min_size - 1 while ok and endpos <= #hwords and endpos < startpos + MAX_SHIFT_SIZE do local cand_range = {} for j = startpos, endpos do table.insert(cand_range, hwords[j]) end local cand = table.concat(cand_range, " ") ok = false if rloc[cand] then local any_herr = false local i = 0 while i <= endpos - startpos and not any_herr do any_herr = herr[startpos+i] i = i + 1 end if not any_herr then ok = true else -- consider moving startpos..end for _, moveto in ipairs(rloc[cand]) do if ralign[moveto] ~= startpos and (ralign[moveto] < startpos or ralign[moveto] > endpos) and ralign[moveto] - startpos <= MAX_SHIFT_DIST and startpos - ralign[moveto] - 1 <= MAX_SHIFT_DIST then ok = true -- check to see if there are any errors in either string -- (only move if this is the case!) local any_rerr = false i = 0 while i <= endpos - startpos and not any_rerr do any_rerr = rerr[moveto+i] i = i + 1 end if any_rerr then for roff = 0, endpos - startpos do if startpos ~= ralign[moveto+roff] and (roff == 0 or ralign[moveto+roff] ~= ralign[moveto]) then if not poss[endpos-startpos] then poss[endpos - startpos] = {} end if endpos - startpos > max_poss then max_poss = endpos - startpos end table.insert(poss[endpos - startpos], {startpos, endpos, moveto+roff}) end end end end end end end endpos = endpos + 1 end end end return poss, max_poss end local function build_word_matches(harr, rarr) -- take in two arrays of words -- build a hash mapping each valid subseq of the ref to its location -- this is a utility func for calculating shifts local rloc = {} -- do a quick pass to check to see which words occur in both strings local hwhash = {} local cor_hash = {} for _, w in ipairs(harr) do hwhash[w] = 1 end for _, w in ipairs(rarr) do cor_hash[w] = cor_hash[w] or hwhash[w] end -- build a hash of all the reference sequences for startpos = 1, #rarr do if cor_hash[rarr[startpos]] then local endpos = startpos local last = false while not last and endpos <= math.min(#rarr, startpos + MAX_SHIFT_SIZE) do if cor_hash[rarr[endpos]] then -- add sequence start...end to hash local range = {} for k = startpos, endpos do table.insert(range, rarr[k]) end local topush = table.concat(range, " ") if not rloc[topush] then rloc[topush] = {} end table.insert(rloc[topush], startpos) else last = true end endpos = endpos + 1 end end end return rloc end local function calc_best_shift(hyp, ref, rloc, curerr, path_vals) -- one greedy step in finding the shift -- find the best one at this point and return it local cur_best_score = curerr local cur_best_shift_cost = 0 local cur_best_path = "" local cur_best_hyp = "" local cur_best_start = 0 local cur_best_end = 0 local cur_best_dest = 0 local ralign = {} -- boolean. true if words[i] is an error local herr = {} local rerr = {} local hpos = 0 for _, sym in ipairs(path_vals) do if sym == " " then hpos = hpos + 1 table.insert(herr, false) table.insert(rerr, false) table.insert(ralign, hpos) elseif sym == "S" then hpos = hpos + 1 table.insert(herr, true) table.insert(rerr, true) table.insert(ralign, hpos) elseif sym == "I" then hpos = hpos + 1 table.insert(herr, true) elseif sym == "D" then table.insert(rerr, true) table.insert(ralign, hpos) end end -- Have we found any good shift yet? local anygain = false local poss_shifts, max_pos_shifts = gather_all_poss_shifts(hyp, rloc, ralign, herr, rerr, 1) local stop = false local i = max_pos_shifts while i >= 0 and not stop do local curfix = curerr - (cur_best_shift_cost + cur_best_score) local maxfix = 2 * (1 + i) - SHIFT_COST stop = curfix > maxfix or (cur_best_shift_cost ~= 0 and curfix == maxfix) if not stop then local work_start = -1 local work_end = -1 local j = 1 while not stop and poss_shifts[i] and j <= #poss_shifts[i] do local s = poss_shifts[i][j] curfix = curerr - (cur_best_shift_cost + cur_best_score) maxfix = (2 * (1 + i)) - SHIFT_COST stop = curfix > maxfix or (cur_best_shift_cost ~= 0 and curfix == maxfix) if not stop then local startpos, endpos, moveto = table.unpack(s) if work_start == -1 then work_start, work_end = startpos, endpos elseif work_start ~= startpos and work_end ~= endpos then if not anygain then work_start, work_end = startpos, endpos end end local shifted_str = perform_shift(hyp, startpos, endpos, ralign[moveto]) local try_score, try_path = min_edit_dist_arr(shifted_str, ref, 1) local gain = (cur_best_score + cur_best_shift_cost) - (try_score + SHIFT_COST) if gain > 0 or (cur_best_shift_cost == 0 and gain == 0) then anygain = true cur_best_score = try_score cur_best_shift_cost = SHIFT_COST cur_best_path = try_path cur_best_hyp = shifted_str cur_best_start = startpos cur_best_end = endpos cur_best_dest = ralign[moveto] end end j = j + 1 end end i = i - 1 end return cur_best_hyp, cur_best_score, cur_best_path, cur_best_start, cur_best_end, cur_best_dest end local function calc_shifts(cand, ref) local rloc = build_word_matches(cand, ref) local med_score, med_path = min_edit_dist_arr(cand, ref, 1) local edits = 0 local cur = cand local all_shifts = {} while 1 do local new_hyp, new_score, new_path, sstart, send, sdest = calc_best_shift(cur, ref, rloc, med_score, med_path) if new_hyp == '' then break end table.insert(all_shifts, {sstart, send, sdest, cur, new_hyp, new_score, new_path}) edits = edits + SHIFT_COST med_score = new_score med_path = new_path cur = new_hyp end return med_score + edits, med_path, cur, all_shifts end local function get_score_breakdown(path, shifts) -- Calculate the score breakdown by type -- INS DEL SUB SHIFT WORDS_SHIFTED local spieces = torch.Tensor{0, 0, 0, #shifts, 0} for _, e in ipairs(path) do if e == "I" then spieces[1] = spieces[1] + 1 elseif e == "D" then spieces[2] = spieces[2] + 1 elseif e == "S" then spieces[3] = spieces[3] + 1 end end for _, s in ipairs(shifts) do spieces[5] = spieces[5] + (s[2] - s[1]) + 1 end return spieces end local function score_sent(id, HYP, REFS) -- try all references, and find the one with the lowest score -- return the score, path, shifts, etc local tmparr = {} local best_score = -1 local best_ref = "" local best_path = "" local best_allshift = tmparr local best_hyp local rlen = 0 for _, ref in ipairs(REFS) do rlen = rlen + #ref[id] local s, p, newhyp, allshifts = calc_shifts(HYP[id], ref[id]) if best_score < 0 or s < best_score then best_score = s best_path = p best_ref = ref best_hyp = newhyp best_allshift = allshifts end end rlen = rlen / #REFS return best_score/rlen, best_path, best_ref, best_hyp, best_allshift end local function calculate_ter(cand, refs) local score = 0 local nb = 0 local score_breakdown = torch.Tensor(5) for k,_ in ipairs(cand) do local best_score, best_path, _, _, best_allshift = score_sent(k, cand, refs) score = score + best_score score_breakdown:add(get_score_breakdown(best_path, best_allshift)) nb = nb + 1 end score_breakdown:div(nb) local score_detail = string.format("TER = %.2f (Ins %.1f, Del %.1f, Sub %.1f, Shft %.1f, WdSh %.1f)", score*100/nb, score_breakdown[1], score_breakdown[2], score_breakdown[3], score_breakdown[4], score_breakdown[5] ) return score/nb, score_detail end return calculate_ter
mit
lichtl/darkstar
scripts/zones/The_Sanctuary_of_ZiTah/Zone.lua
4
4466
----------------------------------- -- -- Zone: The_Sanctuary_of_ZiTah (121) -- ----------------------------------- package.loaded["scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"] = nil; package.loaded["scripts/globals/chocobo_digging"] = nil; ----------------------------------- require("scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"); require("scripts/globals/icanheararainbow"); require("scripts/globals/zone"); require("scripts/globals/conquest"); require("scripts/globals/chocobo_digging"); ----------------------------------- -- Chocobo Digging vars ----------------------------------- local itemMap = { -- itemid, abundance, requirement { 688, 117, DIGREQ_NONE }, { 17296, 150, DIGREQ_NONE }, { 880, 100, DIGREQ_NONE }, { 833, 83, DIGREQ_NONE }, { 696, 100, DIGREQ_NONE }, { 690, 33, DIGREQ_NONE }, { 772, 17, DIGREQ_NONE }, { 773, 33, DIGREQ_NONE }, { 4386, 9, DIGREQ_NONE }, { 703, 7, DIGREQ_NONE }, { 4096, 100, DIGREQ_NONE }, -- all crystals { 1255, 10, DIGREQ_NONE }, -- all ores { 656, 117, DIGREQ_BURROW }, { 750, 133, DIGREQ_BURROW }, { 749, 117, DIGREQ_BURROW }, { 748, 8, DIGREQ_BURROW }, { 751, 14, DIGREQ_BURROW }, { 720, 1, DIGREQ_BURROW }, { 699, 9, DIGREQ_BORE }, { 720, 1, DIGREQ_BORE }, { 4570, 10, DIGREQ_MODIFIER }, { 4487, 11, DIGREQ_MODIFIER }, { 4409, 12, DIGREQ_MODIFIER }, { 1188, 10, DIGREQ_MODIFIER }, { 4532, 12, DIGREQ_MODIFIER }, }; local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED }; ----------------------------------- -- onChocoboDig ----------------------------------- function onChocoboDig(player, precheck) return chocoboDig(player, itemMap, precheck, messageArray); end; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local manuals = {17273417,17273418}; SetFieldManual(manuals); local vwnpc = {17273425,17273426,17273427}; SetVoidwatchNPC(vwnpc); local Noble_Mold = 17273278; GetMobByID(Noble_Mold):setLocalVar("ToD",os.time() + math.random((43200), (57600))); SetRegionalConquestOverseers(zone:getRegionID()) 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(539.901, 3.379, -580.218, 126); end if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; elseif (player:getCurrentMission(WINDURST) == VAIN and player:getVar("MissionStatus") ==1) then cs = 0x0004; end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0002) then lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow elseif (csid == 0x0004) then if (player:getPreviousZone() == 153) then player:updateEvent(0,0,0,0,0,7); elseif (player:getPreviousZone() == 119) then player:updateEvent(0,0,0,0,0,1); end end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0002) then lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow end end;
gpl-3.0
RunAwayDSP/darkstar
scripts/globals/spells/freeze_ii.lua
6
1201
----------------------------------------- -- Spell: Freeze II -- Deals ice damage to an enemy and lowers its resistance against fire. ----------------------------------------- require("scripts/globals/status") require("scripts/globals/magic") ----------------------------------------- function onMagicCastingCheck(caster, target, spell) return 0 end function onSpellCast(caster, target, spell) local spellParams = {} spellParams.hasMultipleTargetReduction = false spellParams.resistBonus = 1.0 spellParams.V = 710 spellParams.V0 = 800 spellParams.V50 = 900 spellParams.V100 = 1000 spellParams.V200 = 1200 spellParams.M = 2 spellParams.M0 = 2 spellParams.M50 = 2 spellParams.M100 = 2 spellParams.M200 = 2 spellParams.I = 780 spellParams.bonusmab = caster:getMerit(dsp.merit.ANCIENT_MAGIC_ATK_BONUS) spellParams.AMIIburstBonus = caster:getMerit(dsp.merit.ANCIENT_MAGIC_BURST_DMG)/100 -- no point in making a separate function for this if the only thing they won't have in common is the name handleNinjutsuDebuff(caster,target,spell,30,10,dsp.mod.FIRERES) return doElementalNuke(caster, spell, target, spellParams) end
gpl-3.0
lichtl/darkstar
scripts/zones/Abyssea-Tahrongi/npcs/qm17.lua
14
1904
----------------------------------- -- Zone: Abyssea-Tahrongi -- NPC: ??? -- Spawns Glavoid -- @pos ? ? ? 45 ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/status"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) --[[ if (GetMobAction(16961930) == ACTION_NONE) then -- NM not already spawned from this if (player:hasKeyItem(FAT_LINED_COCKATRICE_SKIN) and player:hasKeyItem(SODDEN_SANDWORM_HUSK) and player:hasKeyItem(LUXURIANT_MANTICORE_MANE) -- I broke it into 3 lines at the 'and' because it was so long. and player:hasKeyItem(STICKY_GNAT_WING)) then player:startEvent(1020, FAT_LINED_COCKATRICE_SKIN, SODDEN_SANDWORM_HUSK, LUXURIANT_MANTICORE_MANE, STICKY_GNAT_WING); -- Ask if player wants to use KIs else player:startEvent(1021, FAT_LINED_COCKATRICE_SKIN, SODDEN_SANDWORM_HUSK, LUXURIANT_MANTICORE_MANE, STICKY_GNAT_WING); -- Do not ask, because player is missing at least 1. end end ]] end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID2: %u",csid); -- printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 1020 and option == 1) then SpawnMob(16961930):updateClaim(player); -- Spawn NM, Despawn after inactive for 5 minutes (pt has to reclaim within 5 of a wipe) player:delKeyItem(FAT_LINED_COCKATRICE_SKIN); player:delKeyItem(SODDEN_SANDWORM_HUSK); player:delKeyItem(LUXURIANT_MANTICORE_MANE); player:delKeyItem(STICKY_GNAT_WING); end end;
gpl-3.0
Mudlet-cn/mudlet
src/mudlet-lua/lua/geyser/GeyserContainer.lua
11
10164
-------------------------------------- -- -- -- The Geyser Layout Manager by guy -- -- -- -------------------------------------- --- Represents a generic container with positional information. -- Has no notion of contents and is used to contain other windows -- and impose some sense of order. -- @class table -- @name Geyser.Container -- @field parent The parent class of this window -- @field type The type of this window, usually lowercase of the classname and -- can be used in checks for certain types. For a Container -- instance, type is “container.” -- @field name The name of this window. This is the same name that Mudlet will -- use internally for primitive types like labels and -- miniconsoles. If not specified in the constraints table during -- creation, an anonymous name unique to this session will be -- made up. -- @field x The x-coordinate relative to this window's container, not absolute -- from the Mudlet main window. This is not a number, but a -- constraint specification. To find out the numeric x-coordinate in -- terms of pixels from the Mudlet main window's origin, use the -- get_x() method. Default is "10px". -- @field y The y-coordinate relative to this window's container, not absolute -- from the Mudlet main window. This is not a number, but a -- constraint specification. To find out the numeric y-coordinate in -- terms of pixels from the Mudlet main window's origin, use the -- get_y() method. Default is "10px". -- @field width The width of this window, possibly relative to the window's -- container. This is not a number, but a constraint -- specification. To find out the numeric width in terms of -- pixels, use the get_width() method. Default is "300px". -- @field height The height of this window, possibly relative to the window's -- container. This is not a number, but a constraint -- specification. To find out the numeric width in terms of -- pixels, use the get_width() method. Default is "200px". -- @field windowList This is a list of all windows held by this container. It -- used to handle proper resizing of held windows as well as -- during show()s and hide()s to recursive show and hide all -- children windows. -- @field windows This is an ordered list of the names of the window held by this container. -- @field fontSize The default size font used when calculating dimensions -- based on the character constraint. Default is 8. -- @field h_policy This sets if this widget should be stretched/shrinked horizontally or not -- @field v_policy This sets if this widget should be stretched/shrinked vertically or not -- @field v_stretch_factor This sets by how much more then window will be stretched horizontally in comparison to -- other windows -- @field v_stretch_factor This sets by how much more then window will be stretched vertically in comparison to -- other windows Geyser.Container = { name = "ContainerClass", x = "10px", y = "10px", height = "200px", width = "300px", windowList = {}, windows = {}, fontSize = 8, h_policy = Geyser.Dynamic, v_policy = Geyser.Dynamic, h_stretch_factor = 1.0, v_stretch_factor = 1.0, } function Geyser.Container:calculate_dynamic_window_size() local total_count = #self.windows local fixed_horizontal_count = 0 local fixed_vertical_count = 0 local fixed_width_sum = 0 local fixed_height_sum = 0 local ret_size = {} ret_size.width = self.get_width() ret_size.height = self.get_height() local dynamic_horizontal_count = 0.0 local dynamic_vertical_count = 0.0 if total_count <= 1 then --If there is only one window it can have all the width/height, if there are none then it doesn't matter return ret_size end for _, window in pairs(self.windowList) do if window.h_policy == Geyser.Fixed then fixed_horizontal_count = fixed_horizontal_count + 1 fixed_width_sum = fixed_width_sum + window.get_width() else dynamic_horizontal_count = dynamic_horizontal_count + window.h_stretch_factor - 1.0 end if window.v_policy == Geyser.Fixed then fixed_vertical_count = fixed_vertical_count + 1 fixed_height_sum = fixed_height_sum + window.get_height() else dynamic_vertical_count = dynamic_vertical_count + window.v_stretch_factor - 1.0 end end dynamic_horizontal_count = dynamic_horizontal_count + total_count - fixed_horizontal_count dynamic_vertical_count = dynamic_vertical_count + total_count - fixed_vertical_count if dynamic_horizontal_count == 0 then ret_size.width = 0 else ret_size.width = (self.get_width() - fixed_width_sum) / dynamic_horizontal_count end if dynamic_vertical_count == 0 then ret_size.height = 0 else ret_size.height = (self.get_height() - fixed_height_sum) / dynamic_vertical_count end return ret_size end --- Responsible for placing/moving/resizing this window to the correct place/size. -- Called on window resize events. function Geyser.Container:reposition () local x,y,w,h = self:get_x(), self:get_y(), self:get_width(), self:get_height() moveWindow(self.name, self:get_x(), self:get_y()) resizeWindow(self.name, self:get_width(), self:get_height()) -- deal with all children of this container for k,v in pairs(self.windowList) do if k ~= self then v:reposition() end end -- Calls optional redraw method if it is available to cause a gui element to -- redraw itself after moving. if self.redraw then self:redraw() end end --- Hides this window and all its contained windows. function Geyser.Container:hide (auto) if not (self.hidden or self.auto_hidden) then self:hide_impl() end auto = auto or false if auto then self.auto_hidden=true else self.hidden=true end for _,v in pairs(self.windowList) do v:hide(true) end end function Geyser.Container:hide_impl() hideWindow(self.name) end --- Shows this window and all windows it contains. function Geyser.Container:show (auto) auto = auto or false if auto then self.auto_hidden=false else self.hidden=false end if not self.hidden and not self.auto_hidden then self:show_impl() end for _,v in pairs(self.windowList) do v:show(true) end end function Geyser.Container:show_impl() showWindow(self.name) end --- Moves this window according to the new x and y contraints set. -- @param x New x constraint to use. If nil, uses current value. -- @param y New y constraint to use. If nil, uses current value. function Geyser.Container:move (x, y) self.x = x or self.x self.y = y or self.y self:set_constraints(self) end --- Resizes this window according to the new width and height constraints set. -- @param width New width constraint to use. If nil, uses current value. -- @param height New height constraint to use. If nil, uses current value. function Geyser.Container:resize (width, height) self.width = width or self.width self.height = height or self.height self:set_constraints(self) end --- Sets the default font size for this window. -- Will resizes this window if necessary to meet constraints. -- @param fontSize The new font size to use. function Geyser.Container:setFontSize (fontSize) if type(fontSize) ~= "number" then error("fontSize must be a number") return end self.fontSize = fontSize or self.fontSize self:set_constraints() end --- Sets all contraints (x, y, width, height) for this window. -- @param cons Any Lua table that contains appropriate constraint entries. function Geyser.Container:set_constraints (cons) cons = cons or self Geyser.set_constraints(self, cons, self.container) for k,v in pairs(self.windowList) do v:set_constraints(v) end end --- Flashes a white box over the dimensions of this container. -- This is very useful to see where a container actually is if you've -- forgotten its details. -- @param time Time in seconds to flash for, default is 1.0s. function Geyser.Container:flash (time) local time = time or 1.0 local x, y, width, height = self.get_x(), self.get_y(), self.get_width(), self.get_height() local name = self.name .. "_dimensions_flash" createLabel(name, x, y, width, height, 1) resizeWindow(name, width, height) moveWindow(name, x, y) setBackgroundColor(name, 190, 190, 190, 128) showWindow(name) tempTimer(time, "hideWindow(\"" .. name .. "\")") end Geyser.Container.parent = Geyser.Container -- I'm my own grandpa too! -- Someone has to be the root! setmetatable(Geyser.Container, Geyser) --- Constructor for containers. -- This function creates a new container/window -- @param cons Any Lua table that contains appropriate constraint entries. -- Include any parameter such as name or fontSize in cons -- that are to be used for the new window. function Geyser.Container:new(cons, container) -- create new table for the container and copy over constraints local me = Geyser.copyTable(cons) -- enforce a default type, name and parent me.type = me.type or "container" me.name = me.name or Geyser.nameGen() me.windowList = {} me.windows = {} me.hidden = false me.auto_hidden = false -- Set the metatable. setmetatable(me, self) self.__index = self -- If we're not not a class definition then add to a controlling -- container. if not string.find(me.name, ".*Class") then -- If passed in a container, add me to that container if container then container:add(me) else -- Else assume the root window is my container Geyser:add(me) end end --print("New in " .. self.name .. " : " .. me.name) return me end
gpl-2.0
OctoEnigma/shiny-octo-system
lua/includes/modules/player_manager.lua
1
17556
local hook = hook local player = player local pairs = pairs local Msg = Msg local ErrorNoHalt = ErrorNoHalt local baseclass = baseclass local setmetatable = setmetatable local SERVER = SERVER local string = string local util = util module( "player_manager" ) -- Stores a table of valid player models local ModelList = {} local ModelListRev = {} local HandNames = {} --[[--------------------------------------------------------- Utility to add models to the acceptable model list -----------------------------------------------------------]] function AddValidModel( name, model ) ModelList[ name ] = model ModelListRev[ string.lower( model ) ] = name end -- -- Valid hands -- function AddValidHands( name, model, skin, body ) HandNames[ name ] = { model = model, skin = skin, body = body } end --[[--------------------------------------------------------- Return list of all valid player models -----------------------------------------------------------]] function AllValidModels( ) return ModelList end --[[--------------------------------------------------------- Translate the simple name of a model into the full model name -----------------------------------------------------------]] function TranslatePlayerModel( name ) if ( ModelList[ name ] != nil ) then return ModelList[ name ] end return "models/player/kleiner.mdl" end -- Translate from the full model name to simple model name function TranslateToPlayerModelName( model ) model = string.lower( model ) if ( ModelListRev[ model ] != nil ) then return ModelListRev[ model ] end return "kleiner" end -- -- Translate hands based on model -- function TranslatePlayerHands( name ) if ( HandNames[ name ] != nil ) then return HandNames[ name ] end return { model = "models/weapons/c_arms_citizen.mdl", skin = 0, body = "100000000" } end --[[--------------------------------------------------------- Compile a list of valid player models -----------------------------------------------------------]] AddValidModel( "alyx", "models/player/alyx.mdl" ) AddValidHands( "alyx", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "barney", "models/player/barney.mdl" ) AddValidHands( "barney", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "breen", "models/player/breen.mdl" ) AddValidHands( "breen", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "charple", "models/player/charple.mdl" ) AddValidHands( "charple", "models/weapons/c_arms_citizen.mdl", 2, "0000000" ) AddValidModel( "chell", "models/player/p2_chell.mdl" ) AddValidHands( "chell", "models/weapons/c_arms_chell.mdl", 0, "0000000" ) AddValidModel( "corpse", "models/player/corpse1.mdl" ) AddValidHands( "corpse", "models/weapons/c_arms_citizen.mdl", 2, "0000000" ) AddValidModel( "combine", "models/player/combine_soldier.mdl" ) AddValidHands( "combine", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "combineprison", "models/player/combine_soldier_prisonguard.mdl" ) AddValidHands( "combineprison", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "combineelite", "models/player/combine_super_soldier.mdl" ) AddValidHands( "combineelite", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "eli", "models/player/eli.mdl" ) AddValidHands( "eli", "models/weapons/c_arms_citizen.mdl", 1, "0000000" ) AddValidModel( "gman", "models/player/gman_high.mdl" ) AddValidHands( "gman", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "kleiner", "models/player/kleiner.mdl" ) AddValidHands( "kleiner", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "monk", "models/player/monk.mdl" ) AddValidHands( "monk", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "mossman", "models/player/mossman.mdl" ) AddValidHands( "mossman", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "mossmanarctic", "models/player/mossman_arctic.mdl" ) AddValidHands( "mossmanarctic", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "odessa", "models/player/odessa.mdl" ) AddValidHands( "odessa", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "police", "models/player/police.mdl" ) AddValidHands( "police", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "policefem", "models/player/police_fem.mdl" ) AddValidHands( "policefem", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "magnusson", "models/player/magnusson.mdl" ) AddValidHands( "magnusson", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "stripped", "models/player/soldier_stripped.mdl" ) AddValidHands( "stripped", "models/weapons/c_arms_hev.mdl", 2, "0000000" ) AddValidModel( "zombie", "models/player/zombie_classic.mdl" ) AddValidHands( "zombie", "models/weapons/c_arms_citizen.mdl", 2, "0000000" ) AddValidModel( "zombiefast", "models/player/zombie_fast.mdl" ) AddValidHands( "zombiefast", "models/weapons/c_arms_citizen.mdl", 2, "0000000" ) AddValidModel( "female01", "models/player/Group01/female_01.mdl" ) AddValidHands( "female01", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "female02", "models/player/Group01/female_02.mdl" ) AddValidHands( "female02", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "female03", "models/player/Group01/female_03.mdl" ) AddValidHands( "female03", "models/weapons/c_arms_citizen.mdl", 1, "0000000" ) AddValidModel( "female04", "models/player/Group01/female_04.mdl" ) AddValidHands( "female04", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "female05", "models/player/Group01/female_05.mdl" ) AddValidHands( "female05", "models/weapons/c_arms_citizen.mdl", 1, "0000000" ) AddValidModel( "female06", "models/player/Group01/female_06.mdl" ) AddValidHands( "female06", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "female07", "models/player/Group03/female_01.mdl" ) AddValidHands( "female07", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "female08", "models/player/Group03/female_02.mdl" ) AddValidHands( "female08", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "female09", "models/player/Group03/female_03.mdl" ) AddValidHands( "female09", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "female10", "models/player/Group03/female_04.mdl" ) AddValidHands( "female10", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "female11", "models/player/Group03/female_05.mdl" ) AddValidHands( "female11", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "female12", "models/player/Group03/female_06.mdl" ) AddValidHands( "female12", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male01", "models/player/Group01/male_01.mdl" ) AddValidHands( "male01", "models/weapons/c_arms_citizen.mdl", 1, "0000000" ) AddValidModel( "male02", "models/player/Group01/male_02.mdl" ) AddValidHands( "male02", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male03", "models/player/Group01/male_03.mdl" ) AddValidHands( "male03", "models/weapons/c_arms_citizen.mdl", 1, "0000000" ) AddValidModel( "male04", "models/player/Group01/male_04.mdl" ) AddValidHands( "male04", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male05", "models/player/Group01/male_05.mdl" ) AddValidHands( "male05", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male06", "models/player/Group01/male_06.mdl" ) AddValidHands( "male06", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male07", "models/player/Group01/male_07.mdl" ) AddValidHands( "male07", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male08", "models/player/Group01/male_08.mdl" ) AddValidHands( "male08", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male09", "models/player/Group01/male_09.mdl" ) AddValidHands( "male09", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "male10", "models/player/Group03/male_01.mdl" ) AddValidHands( "male10", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "male11", "models/player/Group03/male_02.mdl" ) AddValidHands( "male11", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male12", "models/player/Group03/male_03.mdl" ) AddValidHands( "male12", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "male13", "models/player/Group03/male_04.mdl" ) AddValidHands( "male13", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male14", "models/player/Group03/male_05.mdl" ) AddValidHands( "male14", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male15", "models/player/Group03/male_06.mdl" ) AddValidHands( "male15", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male16", "models/player/Group03/male_07.mdl" ) AddValidHands( "male16", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male17", "models/player/Group03/male_08.mdl" ) AddValidHands( "male17", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "male18", "models/player/Group03/male_09.mdl" ) AddValidHands( "male18", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "medic01", "models/player/Group03m/male_01.mdl" ) AddValidHands( "medic01", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "medic02", "models/player/Group03m/male_02.mdl" ) AddValidHands( "medic02", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic03", "models/player/Group03m/male_03.mdl" ) AddValidHands( "medic03", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "medic04", "models/player/Group03m/male_04.mdl" ) AddValidHands( "medic04", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic05", "models/player/Group03m/male_05.mdl" ) AddValidHands( "medic05", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "medic06", "models/player/Group03m/male_06.mdl" ) AddValidHands( "medic06", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic07", "models/player/Group03m/male_07.mdl" ) AddValidHands( "medic07", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic08", "models/player/Group03m/male_08.mdl" ) AddValidHands( "medic08", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic09", "models/player/Group03m/male_09.mdl" ) AddValidHands( "medic09", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic10", "models/player/Group03m/female_01.mdl" ) AddValidHands( "medic10", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "medic11", "models/player/Group03m/female_02.mdl" ) AddValidHands( "medic11", "models/weapons/c_arms_refugee.mdl", 0, "0000000" ) AddValidModel( "medic12", "models/player/Group03m/female_03.mdl" ) AddValidHands( "medic12", "models/weapons/c_arms_refugee.mdl", 1, "0000000" ) AddValidModel( "medic13", "models/player/Group03m/female_04.mdl" ) AddValidHands( "medic13", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "medic14", "models/player/Group03m/female_05.mdl" ) AddValidHands( "medic14", "models/weapons/c_arms_refugee.mdl", 0, "0100000" ) AddValidModel( "medic15", "models/player/Group03m/female_06.mdl" ) AddValidHands( "medic15", "models/weapons/c_arms_refugee.mdl", 1, "0100000" ) AddValidModel( "refugee01", "models/player/Group02/male_02.mdl" ) AddValidHands( "refugee01", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "refugee02", "models/player/Group02/male_04.mdl" ) AddValidHands( "refugee02", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "refugee03", "models/player/Group02/male_06.mdl" ) AddValidHands( "refugee03", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "refugee04", "models/player/Group02/male_08.mdl" ) AddValidHands( "refugee04", "models/weapons/c_arms_citizen.mdl", 0, "0000000" ) -- -- Game specific player models! (EP2, CSS, DOD) -- Moving them to here since we're now shipping all required files / fallbacks AddValidModel( "magnusson", "models/player/magnusson.mdl" ) AddValidHands( "magnusson","models/weapons/c_arms_citizen.mdl", 0, "0000000" ) AddValidModel( "skeleton", "models/player/skeleton.mdl" ) AddValidHands( "skeleton", "models/weapons/c_arms_citizen.mdl", 2, "0000000" ) AddValidModel( "zombine", "models/player/zombie_soldier.mdl" ) AddValidHands( "zombine", "models/weapons/c_arms_combine.mdl", 0, "0000000" ) AddValidModel( "hostage01", "models/player/hostage/hostage_01.mdl" ) AddValidModel( "hostage02", "models/player/hostage/hostage_02.mdl" ) AddValidModel( "hostage03", "models/player/hostage/hostage_03.mdl" ) AddValidModel( "hostage04", "models/player/hostage/hostage_04.mdl" ) AddValidModel( "css_arctic", "models/player/arctic.mdl" ) AddValidHands( "css_arctic", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_gasmask", "models/player/gasmask.mdl" ) AddValidHands( "css_gasmask", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_guerilla", "models/player/guerilla.mdl" ) AddValidHands( "css_guerilla", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_leet", "models/player/leet.mdl" ) AddValidHands( "css_leet", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_phoenix", "models/player/phoenix.mdl" ) AddValidHands( "css_phoenix", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_riot", "models/player/riot.mdl" ) AddValidHands( "css_riot", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_swat", "models/player/swat.mdl" ) AddValidHands( "css_swat", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" ) AddValidModel( "css_urban", "models/player/urban.mdl" ) AddValidHands( "css_urban", "models/weapons/c_arms_cstrike.mdl", 7, "10000000" ) AddValidModel( "dod_german", "models/player/dod_german.mdl" ) AddValidHands( "dod_german", "models/weapons/c_arms_dod.mdl", 0, "10000000" ) AddValidModel( "dod_american", "models/player/dod_american.mdl" ) AddValidHands( "dod_american", "models/weapons/c_arms_dod.mdl", 1, "10000000" ) -- -- Player Class Stuff -- local Type = {} function RegisterClass( name, table, base ) Type[ name ] = table; -- -- If we have a base method then hook -- it up in the meta table -- if ( base ) then if ( !Type[ name ] ) then ErrorNoHalt( "RegisterClass - deriving "..name.." from unknown class "..base.."!\n" ) end setmetatable( Type[ name ], { __index = Type[ base ] } ) end if ( SERVER ) then util.AddNetworkString( name ) end -- -- drive methods cooperate with the baseclass system -- /lua/includes/modules/baseclass.lua -- baseclass.Set( name, Type[ name ] ) end function SetPlayerClass( ply, classname ) local t = Type[ classname ] if ( !Type[ classname ] ) then ErrorNoHalt( "SetPlayerClass - attempt to use unknown player class "..classname .. "!\n" ) end local id = util.NetworkStringToID( classname ) ply:SetClassID( id ) end function GetPlayerClass( ply ) local id = ply:GetClassID() if ( id == 0 ) then return end return util.NetworkIDToString( id ) end function ClearPlayerClass( ply ) ply:SetClassID( 0 ) end local function LookupPlayerClass( ply ) local id = ply:GetClassID() if ( id == 0 ) then return end -- -- Check the cache -- local method = ply.m_CurrentPlayerClass; if ( method && method.Player == ply && method.ClassID == id && method.Func ) then return method end -- -- No class, lets create one -- local classname = util.NetworkIDToString( id ) if ( !classname ) then return end -- -- Get that type. Fail if we don't have the type. -- local t = Type[ classname ] if ( !t ) then return end local method = {} method.Player = ply method.ClassID = id method.Func = function() end setmetatable( method, { __index = t } ) ply.m_CurrentPlayerClass = method method.Player:InstallDataTable(); method:SetupDataTables() method:Init() return method end function RunClass( ply, funcname, ... ) local class = LookupPlayerClass( ply ) if ( !class ) then return end local func = class[funcname] if ( !func ) then ErrorNoHalt( "Function "..funcname.." not found on player class!\n" ) return end return func( class, ... ) end -- -- Should be called on spawn automatically to set the variables below -- This is called in the base gamemode :PlayerSpawn function -- function OnPlayerSpawn( ply ) local class = LookupPlayerClass( ply ) if ( !class ) then return end ply:SetWalkSpeed( class.WalkSpeed ) ply:SetRunSpeed( class.RunSpeed ) ply:SetCrouchedWalkSpeed( class.CrouchedWalkSpeed ) ply:SetDuckSpeed( class.DuckSpeed ) ply:SetUnDuckSpeed( class.UnDuckSpeed ) ply:SetJumpPower( class.JumpPower ) ply:AllowFlashlight( class.CanUseFlashlight ) ply:SetMaxHealth( class.MaxHealth ) ply:SetHealth( class.StartHealth ) ply:SetArmor( class.StartArmor ) ply:ShouldDropWeapon( class.DropWeaponOnDie ) ply:SetNoCollideWithTeammates( class.TeammateNoCollide ) ply:SetAvoidPlayers( class.AvoidPlayers ) end
mit
lichtl/darkstar
scripts/globals/items/prized_angler_stewpot.lua
18
2003
----------------------------------------- -- ID: 5613 -- Item: Prized Angler's Stewpot -- Food Effect: 4 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- HP +10% -- MP +20 -- Dexterity 4 -- Agility 2 -- Mind 2 -- HP Recovered while healing 9 -- MP Recovered while healing 3 -- Accuracy 15% Cap 45 -- Ranged Accuracy 15% Cap 45 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0 if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,5613); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 10); target:addMod(MOD_MP, 20); target:addMod(MOD_DEX, 4); target:addMod(MOD_AGI, 2); target:addMod(MOD_MND, 2); target:addMod(MOD_HPHEAL, 9); target:addMod(MOD_MPHEAL, 3); target:addMod(MOD_FOOD_ACCP, 15); target:addMod(MOD_FOOD_ACC_CAP, 45); target:addMod(MOD_FOOD_RACCP, 15); target:addMod(MOD_FOOD_RACC_CAP, 45); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 10); target:delMod(MOD_MP, 20); target:delMod(MOD_DEX, 4); target:delMod(MOD_AGI, 2); target:delMod(MOD_MND, 2); target:delMod(MOD_HPHEAL, 9); target:delMod(MOD_MPHEAL, 3); target:delMod(MOD_FOOD_ACCP, 15); target:delMod(MOD_FOOD_ACC_CAP, 45); target:delMod(MOD_FOOD_RACCP, 15); target:delMod(MOD_FOOD_RACC_CAP, 45); end;
gpl-3.0
da03/OpenNMT
test/onmt/TerTest.lua
3
2406
require('onmt.init') local tester = ... local terTest = torch.TestSuite() local ref1 = { [[After 60 days of hard work , the scientists from Xi ' an Satellite Testing and Monitoring Center overcame various technical difficulties and successfully solved the malfunction of the Beidou Navigation Experimental Satellites ( BDNES ) .]], [[Currently , the satellites are running smoothly and the devices on the satellites are functioning properly .]], [[According to the person - in - charge , on the 3 rd Febuary 2007 , after the Beidou Navigation Experimental Satellite was launched at the Xichang Satellite Launch Center , the satellite could not function properly because the solar sailboard malfunctioned during its spread .]]} local ref2 = { [[After 60 days of trying to resolve technical problems , the technicians at the Xi ' an Satelllite Control Centre of China have successfully rectified the errors in the test flights of the Beidou satellite .]], [[Currently , the satellite and its equipment are functioning as per normal .]], [[According to the relative directors of the centre , the test launch of the Beidou satellite on 3 February , 2007 failed when the satellite ' s solar panels encountered problems while unfolding .]]} local cand = { [[After 60 days of fierce battle , the technical personnel of Xi ' an Satellite Monitoring and Control Center fought out several technical difficulties and successfully excluded the satellite satellite satellite malfunction .]], [[At present , the satellite has good attitude and the instrument works normally .]], [[On February 3 , 2007 , the Beidou Navigation Satellite launched a satellite in Xichang Satellite Launch Center , causing a malfunction of the satellite , according to officials concerned .]]} local function tok(t) local tt = {} for i = 1, #t do local toks = {} for word in t[i]:gmatch'([^%s]+)' do table.insert(toks, word) end table.insert(tt, toks) end return tt end function terTest.basic() local refs = { tok(ref1) } local candtok = tok(cand) -- one reference local ter = onmt.scorers['ter'](candtok, refs) tester:eq(ter,0.659,0.01) table.insert(refs, tok(ref2)) -- two references local details ter, details = onmt.scorers['ter'](candtok, refs) tester:eq(ter,0.646,0.01) tester:assert(details:find("20.5") ~= 0) tester:assert(details:find("+/- 0") ~= 0) end return terTest
mit
bogvak/nodemcu-firmware
lua_modules/http/http.lua
89
6624
------------------------------------------------------------------------------ -- HTTP server module -- -- LICENCE: http://opensource.org/licenses/MIT -- Vladimir Dronnikov <dronnikov@gmail.com> ------------------------------------------------------------------------------ local collectgarbage, tonumber, tostring = collectgarbage, tonumber, tostring local http do ------------------------------------------------------------------------------ -- request methods ------------------------------------------------------------------------------ local make_req = function(conn, method, url) local req = { conn = conn, method = method, url = url, } -- return setmetatable(req, { -- }) return req end ------------------------------------------------------------------------------ -- response methods ------------------------------------------------------------------------------ local send = function(self, data, status) local c = self.conn -- TODO: req.send should take care of response headers! if self.send_header then c:send("HTTP/1.1 ") c:send(tostring(status or 200)) -- TODO: real HTTP status code/name table c:send(" OK\r\n") -- we use chunked transfer encoding, to not deal with Content-Length: -- response header self:send_header("Transfer-Encoding", "chunked") -- TODO: send standard response headers, such as Server:, Date: end if data then -- NB: no headers allowed after response body started if self.send_header then self.send_header = nil -- end response headers c:send("\r\n") end -- chunked transfer encoding c:send(("%X\r\n"):format(#data)) c:send(data) c:send("\r\n") end end local send_header = function(self, name, value) local c = self.conn -- NB: quite a naive implementation c:send(name) c:send(": ") c:send(value) c:send("\r\n") end -- finalize request, optionally sending data local finish = function(self, data, status) local c = self.conn -- NB: req.send takes care of response headers if data then self:send(data, status) end -- finalize chunked transfer encoding c:send("0\r\n\r\n") -- close connection c:close() end -- local make_res = function(conn) local res = { conn = conn, } -- return setmetatable(res, { -- send_header = send_header, -- send = send, -- finish = finish, -- }) res.send_header = send_header res.send = send res.finish = finish return res end ------------------------------------------------------------------------------ -- HTTP parser ------------------------------------------------------------------------------ local http_handler = function(handler) return function(conn) local req, res local buf = "" local method, url local ondisconnect = function(conn) collectgarbage("collect") end -- header parser local cnt_len = 0 local onheader = function(conn, k, v) -- TODO: look for Content-Type: header -- to help parse body -- parse content length to know body length if k == "content-length" then cnt_len = tonumber(v) end if k == "expect" and v == "100-continue" then conn:send("HTTP/1.1 100 Continue\r\n") end -- delegate to request object if req and req.onheader then req:onheader(k, v) end end -- body data handler local body_len = 0 local ondata = function(conn, chunk) -- NB: do not reset node in case of lengthy requests tmr.wdclr() -- feed request data to request handler if not req or not req.ondata then return end req:ondata(chunk) -- NB: once length of seen chunks equals Content-Length: -- onend(conn) is called body_len = body_len + #chunk -- print("-B", #chunk, body_len, cnt_len, node.heap()) if body_len >= cnt_len then req:ondata() end end local onreceive = function(conn, chunk) -- merge chunks in buffer if buf then buf = buf .. chunk else buf = chunk end -- consume buffer line by line while #buf > 0 do -- extract line local e = buf:find("\r\n", 1, true) if not e then break end local line = buf:sub(1, e - 1) buf = buf:sub(e + 2) -- method, url? if not method then local i -- NB: just version 1.1 assumed _, i, method, url = line:find("^([A-Z]+) (.-) HTTP/1.1$") if method then -- make request and response objects req = make_req(conn, method, url) res = make_res(conn) end -- header line? elseif #line > 0 then -- parse header local _, _, k, v = line:find("^([%w-]+):%s*(.+)") -- header seems ok? if k then k = k:lower() onheader(conn, k, v) end -- headers end else -- spawn request handler -- NB: do not reset in case of lengthy requests tmr.wdclr() handler(req, res) tmr.wdclr() -- NB: we feed the rest of the buffer as starting chunk of body ondata(conn, buf) -- buffer no longer needed buf = nil -- NB: we explicitly reassign receive handler so that -- next received chunks go directly to body handler conn:on("receive", ondata) -- parser done break end end end conn:on("receive", onreceive) conn:on("disconnection", ondisconnect) end end ------------------------------------------------------------------------------ -- HTTP server ------------------------------------------------------------------------------ local srv local createServer = function(port, handler) -- NB: only one server at a time if srv then srv:close() end srv = net.createServer(net.TCP, 15) -- listen srv:listen(port, http_handler(handler)) return srv end ------------------------------------------------------------------------------ -- HTTP server methods ------------------------------------------------------------------------------ http = { createServer = createServer, } end return http
mit
lichtl/darkstar
scripts/zones/Port_Bastok/npcs/Rosswald.lua
17
1648
----------------------------------- -- Area: Port Bastok -- NPC: Rosswald -- Only sells when Bastok controlls Zulkheim Region -- Confirmed shop stock, August 2013 ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(ZULKHEIM); if (RegionOwner ~= NATION_BASTOK) then player:showText(npc,ROSSWALD_CLOSED_DIALOG); else player:showText(npc,ROSSWALD_OPEN_DIALOG); stock = { 0x1114, 44, --Giant Sheep Meat 0x026E, 44, --Dried Marjoram 0x0262, 55, --San d'Orian Flour 0x0263, 36, --Rye Flour 0x0730, 1840, --Semolina 0x110E, 22, --La Theine Cabbage 0x111A, 55 --Selbina Milk } showShop(player,BASTOK,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
lichtl/darkstar
scripts/zones/The_Sanctuary_of_ZiTah/npcs/Kasim.lua
14
1909
----------------------------------- -- Area: The Sanctuary of Zitah -- NPC: Kasim -- @pos -46 0 -148 121 ----------------------------------- package.loaded["scripts/zones/The_Sanctuary_of_Zitah/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); require("scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"); local region = LITELOR; 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
lichtl/darkstar
scripts/zones/Abyssea-Konschtat/npcs/qm20.lua
10
1349
----------------------------------- -- Zone: Abyssea-Konschtat -- NPC: qm20 (???) -- Spawns Siranpa-Kamuy -- @pos ? ? ? 15 ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --[[ if (trade:hasItemQty(2906,1) and trade:getItemCount() == 1) then -- Player has all the required items. if (GetMobAction(16838962) == ACTION_NONE) then -- Mob not already spawned from this SpawnMob(16838962):updateClaim(player); -- Spawn NM, Despawn after inactive for 5 minutes (pt has to reclaim within 5 of a wipe) player:tradeComplete(); end end ]] end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(1010, 2906); -- Inform payer what items they need. 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
RunAwayDSP/darkstar
scripts/zones/West_Ronfaure/npcs/Zovriace.lua
9
41586
----------------------------------- -- Area: West Ronfaure -- NPC: Zovriace -- Type: Patrol NPC -- !pos -436.356 -15.851 -258.168 100 ----------------------------------- local ID = require("scripts/zones/West_Ronfaure/IDs") require("scripts/globals/pathfind") ----------------------------------- local path = { -439.970062, -16.752592, -255.100327, -440.602631, -16.538126, -255.958786, -441.127228, -16.394150, -256.900909, -441.494019, -16.267317, -257.915710, -441.581543, -16.133537, -258.985992, -441.024231, -16.028330, -259.826294, -439.954132, -16.028715, -259.822601, -438.925629, -16.072157, -259.474915, -437.941528, -16.180017, -259.014008, -437.021820, -15.868464, -258.524048, -436.108673, -15.583454, -258.000946, -435.179413, -15.400028, -257.455811, -432.864655, -15.075329, -256.065369, -423.557495, -14.982476, -250.437790, -422.761383, -15.055836, -249.708817, -422.268677, -15.117037, -248.744232, -421.972382, -15.198636, -247.701523, -421.776733, -15.333975, -246.640106, -421.618866, -15.467649, -245.572189, -421.478943, -15.717875, -244.517334, -421.351807, -15.921570, -243.463135, -421.186218, -16.198463, -241.860138, -421.114075, -16.145809, -240.774628, -421.063721, -16.139482, -239.687912, -420.994019, -16.130768, -237.785126, -420.230377, -15.989685, -211.979935, -420.197784, -15.922558, -210.893448, -420.124512, -15.798100, -207.772995, -420.100586, -15.813488, -206.552765, -419.909180, -16.017889, -199.219910, -420.047943, -16.120964, -198.143524, -420.387573, -15.748003, -197.158432, -420.822083, -15.460172, -196.220764, -421.321320, -15.238870, -195.271896, -421.853363, -15.129681, -194.327469, -423.947327, -15.024358, -190.672211, -427.640472, -14.942602, -184.327072, -428.275848, -15.015442, -183.448257, -428.993866, -15.115380, -182.637329, -429.774628, -15.196917, -181.884567, -430.584961, -15.269184, -181.162048, -431.407013, -15.339080, -180.452606, -432.945740, -15.590717, -179.147598, -446.838165, -18.853514, -167.615036, -447.872925, -18.977230, -166.740967, -450.464325, -19.402002, -164.580673, -451.186340, -19.500000, -163.781158, -451.724823, -19.500000, -162.836929, -452.156342, -19.526083, -161.839020, -452.542633, -19.574369, -160.823151, -452.902069, -19.619282, -159.797119, -453.247406, -19.652224, -158.765945, -454.379395, -19.973661, -155.298203, -455.345062, -20.866318, -152.299789, -455.671997, -20.945515, -151.285309, -456.993286, -21.072395, -147.165604, -457.321960, -21.268314, -146.147049, -460.919006, -21.558647, -134.955734, -461.252441, -21.516457, -133.920914, -463.684235, -20.974045, -126.322334, -463.735504, -21.005585, -125.238617, -463.618225, -21.100723, -124.159538, -463.476532, -21.130386, -123.083138, -460.845245, -21.814005, -103.009911, -460.340668, -21.860525, -102.053253, -459.548370, -21.859089, -101.316696, -458.651062, -21.799015, -100.705299, -457.715729, -21.738424, -100.153778, -456.764191, -21.662802, -99.631622, -455.801666, -21.716837, -99.128433, -452.543488, -21.461651, -97.451981, -427.263428, -19.779127, -84.644547, -426.292938, -19.805960, -84.153252, -424.000397, -20.058718, -82.994804, -423.030975, -19.983002, -82.507225, -396.179047, -20.642097, -68.915520, -395.230957, -20.758915, -68.394829, -394.369598, -20.974821, -67.755898, -393.589478, -21.246567, -67.048546, -392.859406, -21.419449, -66.273178, -392.153625, -21.557785, -65.456947, -391.468964, -21.778866, -64.640053, -390.559631, -22.323750, -63.552891, -389.849030, -22.824114, -62.691097, -387.739929, -24.336773, -60.088634, -387.035553, -24.853951, -59.230145, -386.339355, -25.370905, -58.366211, -385.651886, -26.125864, -57.510376, -385.033325, -27.045774, -56.701607, -384.452972, -27.587692, -55.817024, -383.951385, -27.987345, -54.938370, -383.386536, -28.294943, -53.910427, -382.906982, -28.606924, -52.984940, -382.409454, -28.917976, -52.069004, -381.867371, -29.025024, -51.137131, -381.301788, -29.172449, -50.219383, -380.727570, -29.320223, -49.307129, -364.454529, -30.016165, -24.085087, -354.090363, -29.671881, -8.006002, -353.540497, -29.834528, -7.080005, -353.008911, -30.037712, -6.150451, -351.508148, -30.500000, -3.461302, -344.298309, -31.130165, 9.622360, -343.719788, -31.229996, 10.534849, -343.014465, -31.336742, 11.354795, -342.196075, -31.448938, 12.062510, -341.337769, -31.562546, 12.721281, -340.463776, -31.676613, 13.359138, -339.578003, -31.747307, 13.983932, -338.684845, -31.777473, 14.604170, -331.282471, -31.493895, 19.661541, -330.308228, -31.447271, 20.141212, -329.288361, -31.455376, 20.518837, -328.249207, -31.395697, 20.818035, -327.199799, -31.337658, 21.087675, -326.141876, -31.381889, 21.338877, -325.082703, -31.432835, 21.581512, -320.835022, -31.395533, 22.525442, -319.773651, -31.337238, 22.757223, -316.724976, -31.168060, 23.434225, -315.697601, -31.067081, 23.774858, -314.713531, -31.001366, 24.234629, -313.761444, -30.953598, 24.758646, -312.835083, -30.887995, 25.325043, -311.918732, -30.789017, 25.902380, -310.216614, -30.826614, 27.010038, -307.517303, -31.226393, 28.788122, -306.582703, -31.154129, 29.342878, -305.625275, -31.055418, 29.852215, -304.660309, -30.967735, 30.347439, -303.691956, -30.867880, 30.831894, -301.273224, -30.522186, 32.021267, -300.325226, -30.253407, 32.488640, -297.896606, -29.961315, 33.678493, -296.921356, -29.980268, 34.155445, -283.175232, -30.000000, 40.879360, -282.197723, -30.000000, 41.357021, -273.907654, -30.223761, 45.435520, -273.112213, -30.613419, 46.087021, -272.551117, -31.027349, 46.919304, -272.154144, -31.419172, 47.850975, -271.860565, -31.801704, 48.831139, -271.583862, -32.090355, 49.799915, -271.340332, -32.425247, 50.806000, -270.992645, -32.844288, 52.328403, -269.161621, -35.016342, 60.795799, -268.899292, -35.537270, 62.046036, -267.436157, -38.003387, 68.796013, -267.218933, -38.403229, 69.785110, -266.716248, -39.181328, 72.162575, -266.646820, -39.236248, 73.245872, -266.741486, -39.305218, 74.326553, -266.943451, -39.503807, 75.379707, -267.198029, -39.606842, 76.420052, -267.467224, -39.573181, 77.473747, -267.751343, -39.537670, 78.523438, -269.489166, -39.688145, 84.654762, -269.779968, -39.940563, 85.672394, -270.407593, -40.357700, 87.859993, -270.701263, -40.217247, 88.897224, -271.803741, -39.582218, 92.765701, -272.103394, -39.621971, 93.822968, -274.938629, -40.094635, 103.757698, -275.234436, -39.950058, 104.796463, -278.316315, -39.956299, 115.598122, -278.657959, -40.000000, 116.626968, -279.067108, -40.000000, 117.634903, -279.518555, -40.000000, 118.624847, -279.993774, -40.000000, 119.603645, -280.484222, -40.000000, 120.574821, -280.980164, -40.000000, 121.543243, -286.929169, -39.008667, 132.941757, -287.430420, -38.897781, 133.901459, -287.937683, -38.781601, 134.856888, -288.510773, -38.692963, 135.778198, -289.157349, -38.665531, 136.652649, -289.833923, -38.639122, 137.504150, -290.523529, -38.604607, 138.344910, -291.396698, -38.552856, 139.386200, -300.068176, -35.596138, 149.616638, -300.450134, -35.417088, 150.612869, -300.480957, -35.302635, 151.691971, -300.363770, -35.374798, 152.765915, -300.181000, -35.526699, 153.827637, -299.967926, -35.682739, 154.883087, -299.740814, -35.856140, 155.933807, -299.166321, -36.110737, 158.434998, -297.842926, -36.519508, 164.110306, -297.711517, -36.728516, 165.169052, -297.791962, -36.897087, 166.237534, -298.034912, -37.036209, 167.288712, -298.354279, -37.162457, 168.321182, -298.708008, -37.283379, 169.343033, -299.123047, -37.480621, 170.478378, -299.870880, -38.047672, 172.461945, -300.458160, -38.762894, 173.968826, -301.121552, -39.588573, 175.707932, -301.488495, -39.880459, 176.703125, -301.741180, -40.187134, 177.714966, -301.840820, -40.504196, 178.748749, -301.855133, -40.822124, 179.788849, -301.822845, -41.188747, 180.817581, -301.758820, -41.552467, 181.840881, -301.682739, -41.920956, 182.862518, -301.407043, -42.825760, 186.114990, -300.501160, -45.446545, 196.063461, -300.327515, -45.781693, 197.086868, -300.107330, -46.023857, 198.101761, -299.892059, -46.020031, 199.202560, -299.658722, -46.049198, 200.264832, -299.083496, -45.989109, 202.775665, -298.839966, -45.840462, 203.825668, -298.599335, -45.612335, 204.856720, -297.294495, -45.038647, 210.384552, -296.802460, -45.031513, 211.348297, -296.003754, -44.947575, 212.076996, -295.089417, -44.939152, 212.665131, -294.132080, -44.971771, 213.180725, -293.159241, -45.004112, 213.666809, -292.177643, -45.043068, 214.134933, -290.945007, -45.035225, 214.709396, -282.860168, -45.922268, 218.423615, -281.928314, -46.162800, 218.882782, -280.925964, -46.093803, 219.302551, -279.942993, -46.035995, 219.765259, -278.976990, -46.039272, 220.261993, -278.019318, -46.126381, 220.774200, -276.532257, -45.679039, 221.595612, -273.266785, -45.098358, 223.469131, -272.324432, -45.015408, 224.010422, -268.550629, -45.024551, 226.176529, -267.745361, -45.022247, 226.900223, -267.117981, -44.979355, 227.787445, -266.573853, -44.975834, 228.729248, -266.066772, -44.982010, 229.691788, -265.576538, -45.041542, 230.663071, -265.079071, -45.163151, 231.627274, -264.597351, -45.264587, 232.595947, -264.152435, -45.446598, 233.563171, -263.697998, -45.680012, 234.523819, -262.016174, -46.281578, 238.029846, -261.556702, -46.201237, 239.014328, -256.600128, -45.025234, 249.377197, -255.970734, -44.957794, 250.260529, -255.212357, -44.939751, 251.038193, -254.386093, -44.945457, 251.745514, -253.526093, -44.969048, 252.411560, -252.652176, -45.002594, 253.058823, -251.770966, -45.036087, 253.696213, -244.441742, -45.275829, 258.863953, -243.505188, -45.542328, 259.357666, -242.523361, -45.906620, 259.648193, -241.460144, -46.028633, 259.823212, -240.374603, -46.019741, 259.894318, -239.287964, -46.013302, 259.945831, -238.200699, -46.008728, 259.982391, -235.359665, -46.299160, 260.041962, -231.212814, -47.047096, 260.111084, -228.414734, -47.613140, 260.165649, -227.395874, -48.089172, 260.184479, -225.697647, -48.950203, 260.216675, -224.363464, -49.629337, 260.239838, -223.352081, -49.953148, 260.253906, -216.001205, -52.412048, 260.375458, -214.947723, -52.636997, 260.390472, -204.417313, -55.326168, 260.560699, -203.368652, -55.655231, 260.576294, -202.049591, -56.112896, 260.577698, -200.935196, -56.080486, 260.591614, -184.915848, -56.834442, 260.617188, -183.857697, -57.100548, 260.594025, -182.771301, -57.095242, 260.613068, -181.551437, -57.195465, 260.611603, -180.467743, -57.268650, 260.554718, -179.388474, -57.235741, 260.443207, -178.313416, -57.323948, 260.301849, -177.240799, -57.410061, 260.141052, -175.639709, -57.602425, 259.888031, -153.454758, -59.971466, 256.230652, -152.371017, -59.941368, 256.202332, -151.338013, -59.899998, 256.526245, -150.409531, -59.899998, 257.091797, -149.546631, -59.905708, 257.754150, -148.712616, -59.944000, 258.451752, -147.891266, -59.982349, 259.164490, -147.077164, -59.987167, 259.886108, -145.559814, -59.996250, 261.249481, -135.296967, -61.920395, 270.550049, -- report? -136.090424, -61.731232, 269.830048, -136.884094, -61.542065, 269.110352, -150.086914, -59.899998, 257.147797, -151.020218, -59.899998, 256.592834, -152.073257, -59.902092, 256.345337, -153.159882, -59.929256, 256.347260, -154.243652, -59.956352, 256.436890, -155.322754, -59.991856, 256.572998, -156.398727, -59.956062, 256.729126, -158.145386, -59.938908, 257.003632, -178.976608, -57.275406, 260.436218, -180.056641, -57.302162, 260.523682, -181.140915, -57.218544, 260.571320, -182.225555, -57.135334, 260.593964, -183.310730, -57.070732, 260.604950, -184.389069, -56.970604, 260.592346, -185.446976, -56.699245, 260.612305, -186.534317, -56.616566, 260.619019, -188.029251, -56.562798, 260.618652, -207.543884, -54.695351, 260.506195, -208.593231, -54.421879, 260.490112, -227.786392, -47.844944, 260.176392, -228.828674, -47.528126, 260.161072, -230.026764, -47.278732, 260.139496, -234.035889, -46.541107, 260.063751, -240.660934, -46.011520, 259.960083, -241.744278, -46.169971, 259.869843, -242.749298, -45.785637, 259.621307, -243.688675, -45.496006, 259.184814, -244.613403, -45.269833, 258.647064, -245.518509, -45.137951, 258.052887, -246.419617, -45.087288, 257.445129, -247.315887, -45.036938, 256.830475, -249.769028, -45.024799, 255.119431, -254.651855, -44.940964, 251.663010, -255.433929, -44.937099, 250.909637, -256.076324, -44.971489, 250.033737, -256.635040, -45.035885, 249.102524, -257.142975, -45.097923, 248.142441, -257.629761, -45.233803, 247.177734, -258.461090, -45.483078, 245.483109, -259.049194, -45.740898, 244.276123, -259.516541, -45.851563, 243.307846, -264.719360, -45.247227, 232.364548, -265.227234, -45.105091, 231.261398, -265.719788, -44.985176, 230.292435, -266.195129, -44.977989, 229.313889, -266.685333, -44.971275, 228.342972, -267.309906, -44.990795, 227.454300, -268.097290, -45.024536, 226.706238, -268.976410, -45.019974, 226.065643, -269.888763, -45.017735, 225.473099, -270.818024, -45.019180, 224.907379, -271.753998, -45.000942, 224.352997, -273.165039, -45.084061, 223.535965, -274.098724, -45.217224, 222.991837, -275.034912, -45.352219, 222.454132, -276.433075, -45.645039, 221.653473, -278.282349, -46.227036, 220.580002, -279.259583, -46.019772, 220.105209, -280.239838, -46.051945, 219.636856, -281.715057, -46.138523, 218.944061, -295.072144, -44.942986, 212.826477, -295.975891, -44.965645, 212.229233, -296.626495, -44.995678, 211.363297, -297.092560, -45.025742, 210.383209, -297.438629, -45.079567, 209.353546, -297.736084, -45.130760, 208.308319, -298.005737, -45.248287, 207.260376, -298.264038, -45.386070, 206.212494, -299.041473, -45.962364, 202.959167, -299.294495, -46.129169, 201.913116, -299.533417, -46.064907, 200.852234, -299.778412, -46.034283, 199.792679, -300.021393, -46.009171, 198.732605, -300.230682, -45.949970, 197.678162, -300.387177, -45.645302, 196.654877, -300.517700, -45.328785, 195.618057, -300.631744, -45.131599, 194.554199, -300.736755, -44.933083, 193.489655, -301.916626, -41.039673, 180.393494, -301.952759, -40.689056, 179.362061, -301.844147, -40.380367, 178.326706, -301.584625, -40.074371, 177.315918, -301.265717, -39.777336, 176.319107, -300.939575, -39.442776, 175.363297, -300.565338, -38.942703, 174.325500, -300.181183, -38.417553, 173.289810, -299.740601, -37.873989, 172.134750, -299.364197, -37.599380, 171.148911, -298.786713, -37.338978, 169.644882, -298.402985, -37.208858, 168.635559, -298.027802, -37.092781, 167.620956, -297.779541, -36.955162, 166.573044, -297.768494, -36.779991, 165.501678, -297.893860, -36.572292, 164.441559, -298.075348, -36.378498, 163.386337, -298.291718, -36.245903, 162.328415, -298.523804, -36.191105, 161.267609, -299.099976, -36.119068, 158.749771, -300.622803, -35.272141, 152.185272, -300.546265, -35.356747, 151.112457, -300.139984, -35.533932, 150.124802, -299.563080, -35.738934, 149.226395, -298.926300, -35.974628, 148.366928, -298.292847, -36.369488, 147.566315, -297.652222, -36.771412, 146.784256, -296.598267, -37.424564, 145.524170, -289.386353, -38.662991, 137.017761, -288.751190, -38.680820, 136.135315, -288.184235, -38.716503, 135.207581, -287.656708, -38.841850, 134.261246, -286.957916, -39.001762, 132.948334, -286.436218, -38.979378, 131.993698, -285.933044, -39.086742, 131.035538, -279.544037, -40.000000, 118.786339, -279.095001, -40.000000, 117.795532, -278.723389, -40.000000, 116.773209, -278.390717, -40.000000, 115.739441, -278.077759, -39.844975, 114.705635, -277.060913, -39.500000, 111.198402, -271.665955, -39.568001, 92.294022, -271.258362, -39.819828, 90.879639, -269.650452, -39.829777, 85.218178, -269.097565, -39.500000, 83.293137, -266.809784, -39.475517, 75.200165, -266.649567, -39.287212, 74.141655, -266.706604, -39.230602, 73.057381, -266.841522, -39.182301, 71.979034, -267.013214, -38.883488, 70.972496, -267.203888, -38.458267, 69.986374, -267.405945, -38.092369, 68.997025, -267.967316, -37.205059, 66.336739, -269.169342, -35.011940, 60.768829, -269.416901, -34.755840, 59.608253, -271.049866, -32.833099, 52.036350, -271.266663, -32.500420, 51.020298, -271.939880, -31.580200, 47.963612, -272.323029, -31.133356, 47.024605, -273.091705, -30.631182, 46.207066, -273.918060, -30.234310, 45.609779, -274.847778, -30.141161, 45.052742, -275.801636, -30.049332, 44.537346, -276.767395, -30.004099, 44.039276, -277.740051, -30.000000, 43.551609, -295.029419, -30.001234, 35.084103, -296.004395, -30.028824, 34.606136, -298.320343, -30.011620, 33.472553, -299.292633, -30.127960, 32.998138, -300.744598, -30.420561, 32.287434, -301.822388, -30.660269, 31.766117, -305.449860, -31.039577, 29.961134, -306.393860, -31.150333, 29.427002, -307.322937, -31.208359, 28.864517, -308.242828, -31.225145, 28.287502, -309.370667, -30.999538, 27.554298, -313.548218, -30.951408, 24.807213, -314.496948, -30.999880, 24.278208, -315.499756, -31.051682, 23.858809, -316.537872, -31.154470, 23.544914, -317.590332, -31.206734, 23.277721, -318.646790, -31.269846, 23.025274, -319.705627, -31.330627, 22.782150, -328.585144, -31.461010, 20.809793, -329.604736, -31.452932, 20.447485, -330.576935, -31.458323, 19.959888, -331.516846, -31.525490, 19.415882, -332.434601, -31.586788, 18.835255, -333.342133, -31.637566, 18.237196, -334.808746, -31.720680, 17.253775, -341.755096, -31.512569, 12.505347, -342.587311, -31.399881, 11.814846, -343.284424, -31.293304, 10.987100, -343.903748, -31.204266, 10.098687, -344.476776, -31.068769, 9.182813, -345.021790, -30.936897, 8.250527, -345.557404, -30.848867, 7.308527, -346.944550, -30.665789, 4.819434, -352.769531, -30.134678, -5.750056, -353.430542, -29.865831, -6.908241, -353.990356, -29.703238, -7.826676, -354.571625, -29.606535, -8.750077, -359.278839, -30.020227, -16.060516, -359.865417, -29.940750, -16.974663, -366.939056, -29.873177, -27.931231, -367.528503, -29.888115, -28.845236, -376.512451, -29.969620, -42.758610, -377.103638, -29.932671, -43.671219, -381.560516, -29.108587, -50.606083, -382.097595, -28.962421, -51.540813, -382.600891, -28.786295, -52.479153, -383.076721, -28.473091, -53.406521, -383.741272, -28.044344, -54.676407, -384.273438, -27.694052, -55.554253, -384.877289, -27.241680, -56.411148, -385.524475, -26.414268, -57.283955, -386.158508, -25.591860, -58.105274, -386.828674, -24.977655, -58.949734, -390.529175, -22.315744, -63.529224, -392.262146, -21.522633, -65.653603, -392.948425, -21.380217, -66.485573, -393.689911, -21.182203, -67.244202, -394.540680, -20.930220, -67.872482, -395.454437, -20.739042, -68.440071, -396.398987, -20.635540, -68.968857, -397.357697, -20.571712, -69.479454, -398.320526, -20.508863, -69.982239, -400.858337, -20.346436, -71.281647, -416.078491, -20.016394, -78.992798, -417.048981, -19.936098, -79.480896, -427.943085, -19.760998, -84.990929, -428.913177, -19.807173, -85.480782, -432.057404, -20.048246, -87.078934, -433.018707, -20.206867, -87.563354, -434.463531, -20.382471, -88.293999, -435.430756, -20.458065, -88.786209, -452.483673, -21.459229, -97.418785, -453.453613, -21.498474, -97.910263, -455.629822, -21.682997, -99.016502, -456.597382, -21.676950, -99.507576, -459.140961, -21.836069, -100.792534, -459.946869, -21.893318, -101.510696, -460.448151, -21.846874, -102.472565, -460.755463, -21.810520, -103.514992, -460.974854, -21.743179, -104.577850, -461.155731, -21.659788, -105.647171, -461.317200, -21.591896, -106.720940, -461.468292, -21.524906, -107.796364, -463.602295, -21.103918, -124.129204, -463.619171, -21.024265, -125.213806, -463.478882, -21.006443, -126.292236, -463.249878, -21.002714, -127.355629, -462.966309, -21.089417, -128.399185, -462.668304, -21.285374, -129.427078, -462.235779, -21.446602, -130.840286, -460.657928, -21.688395, -135.754669, -460.330139, -21.662376, -136.789734, -455.015533, -20.520708, -153.317886, -454.692139, -20.245014, -154.319489, -452.376251, -19.553642, -161.505966, -451.983276, -19.504547, -162.518814, -451.383820, -19.500000, -163.425491, -450.662170, -19.500000, -164.235107, -449.881348, -19.324495, -164.978180, -449.075256, -19.183504, -165.695129, -448.256256, -19.045288, -166.398026, -447.224274, -18.874338, -167.267380, -446.393372, -18.880678, -167.969147, -444.853027, -18.565512, -169.265442, -429.819672, -15.220426, -181.753754, -429.047333, -15.136473, -182.514877, -428.378082, -15.023755, -183.364578, -427.766907, -14.929929, -184.258438, -427.184479, -14.948370, -185.176834, -426.620789, -14.981401, -186.106918, -420.939972, -15.316271, -195.861465, -420.463104, -15.644215, -196.799393, -420.179413, -15.996948, -197.782822, -420.054016, -16.013285, -198.776382, -420.006409, -16.007343, -199.863220, -419.994202, -16.007246, -200.951035, -420.002808, -16.006878, -202.039001, -420.028076, -16.012650, -203.534683, -420.136383, -15.819376, -208.158340, -420.158417, -15.863979, -209.517258, -420.217560, -15.970049, -212.114258, -420.270721, -15.849182, -213.198792, -420.324890, -15.797634, -214.692932, -420.826080, -15.902279, -232.085022, -420.854614, -15.979057, -233.178070, -421.049957, -16.137796, -239.834213, -421.117493, -16.146238, -240.920044, -421.206573, -16.172615, -242.004349, -421.315979, -15.984070, -243.070419, -421.494659, -15.643467, -244.787292, -421.819092, -15.221020, -247.595215, -422.154602, -15.128119, -248.622253, -422.758545, -15.061894, -249.519104, -423.569183, -14.987906, -250.238434, -424.447510, -14.935026, -250.876724, -425.353729, -14.944465, -251.478790, -426.272919, -14.957020, -252.060471, -427.197968, -14.990112, -252.632385, -435.669800, -15.466051, -257.761230, -436.582245, -15.703817, -258.315826, -437.807831, -16.083422, -259.079224, -438.774384, -16.063610, -259.543793, -439.841156, -16.037457, -259.752838, -440.927063, -16.028862, -259.821381, -442.012054, -16.065359, -259.827911, -443.029694, -15.716091, -259.796082, -444.055817, -15.340240, -259.815460, -445.097931, -15.219767, -260.104065, -446.074341, -15.110579, -260.570770, -447.027344, -15.057332, -261.092285, -447.959381, -15.005149, -261.650909, -448.870300, -15.018632, -262.244598, -452.834351, -15.055134, -264.874695, -453.655518, -15.037918, -265.585449, -454.313416, -14.975594, -266.448151, -454.843811, -14.943377, -267.396851, -455.317291, -14.926654, -268.376190, -455.755920, -14.934984, -269.371826, -456.179169, -14.990575, -270.372711, -458.718781, -15.924042, -276.598358, -459.454010, -16.074858, -278.487640, -459.765564, -16.035896, -279.529297, -460.018890, -16.008865, -280.586884, -460.219788, -16.034010, -281.655853, -460.388611, -15.869349, -282.697662, -460.631561, -15.373913, -284.238556, -463.079895, -10.491953, -301.043823, -463.087708, -10.158780, -302.077850, -462.960846, -9.836479, -303.109039, -462.774170, -9.560242, -304.125580, -462.522583, -8.986555, -305.196259, -462.273163, -8.643255, -306.190765, -462.021210, -8.278727, -307.184570, -460.034760, -6.387301, -314.867249, -459.871155, -6.200213, -315.926605, -459.784912, -6.106617, -317.006958, -459.729767, -6.040372, -318.091217, -459.694733, -6.044695, -319.178589, -459.585297, -6.053058, -324.342834, -459.546967, -5.772733, -326.638885, -459.503937, -5.646238, -328.802887, -459.475159, -5.742835, -330.568115, -459.458099, -5.785998, -331.654663, -459.434814, -5.762313, -332.741577, -459.407196, -5.823767, -334.235260, -459.388367, -5.885840, -335.321259, -459.238617, -5.855601, -343.748810, -459.212708, -5.653573, -345.233765, -459.171204, -5.405949, -347.661652, -459.148193, -5.488004, -349.155365, -459.102081, -5.651767, -351.733948, -459.078918, -5.694240, -352.820526, -459.029205, -6.086042, -355.647919, -459.029083, -6.127892, -356.731750, -459.140869, -6.113956, -357.812897, -459.383789, -6.083621, -358.872314, -459.727936, -6.040620, -359.903625, -460.125519, -6.022241, -360.915192, -460.547241, -6.109803, -361.916656, -460.983124, -5.974494, -362.906189, -461.694427, -5.748822, -364.503021, -464.664276, -4.937500, -371.008911, -465.236359, -4.933529, -371.931122, -466.029266, -4.964595, -372.673553, -466.928986, -4.997910, -373.282715, -467.884674, -5.034942, -373.801270, -468.857971, -5.029415, -374.286438, -469.843262, -5.023180, -374.747375, -470.833405, -5.019099, -375.197601, -472.694275, -5.035691, -376.029572, -473.677887, -5.200471, -376.472137, -474.661591, -5.361502, -376.908600, -476.374115, -5.724977, -377.667419, -477.943665, -6.254426, -378.389740, -478.940887, -6.155789, -378.806549, -479.933899, -6.100767, -379.246948, -480.918152, -6.043252, -379.707092, -481.900665, -6.081943, -380.169891, -484.013855, -5.418111, -381.186493, -491.435669, -5.052667, -384.848053, -492.353546, -5.041574, -385.430573, -493.202301, -5.007907, -386.109772, -493.992279, -4.974132, -386.856659, -494.756409, -4.940371, -387.630280, -495.507080, -4.923118, -388.417175, -496.431793, -4.977174, -389.412140, -497.107117, -5.046514, -390.261566, -497.657043, -5.110490, -391.197357, -498.112122, -5.190608, -392.182343, -498.507446, -5.332036, -393.186005, -498.873962, -5.472911, -394.200806, -499.234314, -5.613681, -395.218109, -499.678253, -5.800858, -396.489166, -500.778503, -6.103849, -399.830353, -501.068237, -6.140066, -400.878174, -501.285126, -6.187640, -401.943726, -501.455048, -5.907662, -402.972321, -501.603912, -5.583361, -404.001343, -501.743408, -5.360402, -405.062927, -502.090485, -4.776625, -407.835724, -503.105774, -2.217786, -416.217438, -503.239807, -1.832487, -417.352051, -503.333099, -1.481157, -418.377258, -503.423798, -1.100163, -419.395477, -503.386627, -0.703467, -420.402710, -503.246399, -0.351263, -421.441803, -502.988159, -0.045092, -422.453247, -502.687469, 0.254894, -423.455109, -502.373627, 0.594657, -424.430695, -502.022430, 1.109420, -425.470734, -501.691040, 1.542306, -426.415924, -499.392395, 3.206969, -433.018402, -499.253448, 3.375491, -434.080170, -499.522461, 3.599207, -435.105164, -500.032349, 3.822114, -436.033020, -500.653107, 3.809904, -436.925049, -501.312653, 3.793942, -437.789276, -501.987488, 3.745028, -438.639038, -503.010254, 3.617167, -439.904755, -504.546265, 3.195670, -441.791504, -505.474762, 3.454881, -442.943634, -506.260468, 3.535620, -443.878723, -506.956055, 3.542965, -444.714844, -508.938232, 3.486761, -447.139069, -509.594696, 3.471608, -448.007050, -510.234344, 3.489084, -448.886902, -512.427246, 3.586239, -451.998352, -513.936096, 3.984726, -454.195862, -514.540894, 4.233383, -455.064941, -515.166321, 4.378668, -455.945282, -516.262939, 4.290412, -457.499878, -516.891174, 4.174067, -458.381256, -517.627136, 3.970321, -459.154846, -518.497131, 3.965434, -459.776428, -519.472900, 3.961867, -460.252655, -520.468811, 3.907594, -460.686981, -521.475464, 3.856341, -461.097015, -522.467651, 3.899534, -461.479309, -523.431274, 4.273953, -461.837158, -532.930542, 4.970236, -465.372864, -533.836426, 5.003310, -465.964172, -534.517090, 5.036720, -466.809723, -535.063843, 5.069100, -467.748749, -535.532227, 5.071708, -468.730682, -535.968689, 5.042767, -469.726746, -536.385559, 4.985219, -470.730225, -536.996216, 4.874025, -472.240662, -538.487976, 4.135559, -475.968048, -538.877197, 4.030794, -476.973175, -539.262268, 3.887287, -477.981995, -539.575439, 3.940336, -479.021515, -539.779053, 3.965811, -480.089569, -539.916809, 3.983058, -481.168549, -540.027405, 3.990070, -482.250732, -540.122314, 3.997955, -483.334686, -540.210938, 3.984653, -484.419312, -541.090576, 3.211054, -496.324768, -541.168152, 3.029897, -497.395050, -541.225708, 2.852559, -498.466858, -541.208801, 2.688696, -499.542267, -541.137390, 2.576481, -500.620575, -541.029846, 2.491427, -501.699982, -540.901306, 2.387329, -502.777466, -540.700256, 2.348901, -504.390961, -539.072510, 0.190201, -516.318054, -538.841309, 0.175944, -517.380859, -538.530579, 0.156524, -518.422974, -538.178406, 0.134513, -519.452148, -537.805481, 0.111208, -520.473999, -537.424194, 0.087378, -521.492676, -536.306885, 0.056635, -524.412842, -533.919128, 0.072274, -530.589355, -534.307983, 0.225401, -529.584229, -534.697571, 0.361172, -528.577515, -538.121399, 0.130942, -519.723328, -538.474670, 0.153023, -518.694641, -538.752563, 0.170393, -517.643005, -538.969421, 0.183949, -516.577148, -539.157410, 0.272568, -515.513428, -539.318237, 0.485071, -514.458435, -539.542297, 0.803161, -512.873474, -539.692932, 0.970816, -511.811584, -539.838379, 1.181126, -510.753571, -540.765686, 2.421811, -503.992981, -540.907532, 2.391479, -502.915649, -541.162781, 2.543372, -500.897217, -541.213013, 2.639980, -499.816193, -541.198853, 2.814182, -498.741730, -541.153137, 2.989250, -497.668915, -541.090637, 3.167528, -496.597382, -540.901733, 3.472016, -493.766296, -539.946655, 3.986804, -480.899536, -539.758118, 3.963221, -479.829315, -539.464539, 3.926524, -478.782715, -539.127625, 3.884508, -477.750854, -538.753662, 4.055820, -476.738281, -538.086609, 4.375992, -474.991974, -535.247925, 5.074961, -467.828430, -534.701660, 5.041934, -466.858551, -533.907593, 5.008235, -466.119568, -532.972717, 4.975322, -465.566498, -531.983582, 4.943339, -465.114624, -530.979858, 4.951505, -464.695160, -529.968079, 4.959478, -464.295441, -528.951843, 4.983376, -463.907593, -522.430969, 3.916511, -461.465240, -521.404968, 3.857628, -461.086182, -520.377686, 3.902210, -460.729462, -519.369934, 3.953047, -460.322479, -518.443848, 3.963709, -459.761841, -517.644409, 3.968113, -459.040253, -516.927307, 4.138369, -458.245422, -516.257751, 4.275104, -457.397705, -515.619324, 4.360233, -456.520050, -514.989380, 4.372784, -455.633331, -514.354065, 4.148522, -454.766449, -513.569702, 3.888090, -453.690735, -512.848206, 3.701035, -452.650909, -512.268372, 3.550035, -451.781738, -511.656403, 3.532558, -450.883881, -510.565186, 3.495838, -449.323639, -509.924683, 3.478686, -448.444824, -509.263702, 3.481614, -447.580719, -508.588806, 3.498191, -446.727631, -507.732697, 3.521606, -445.671478, -504.967285, 3.235765, -442.320770, -504.184204, 3.426662, -441.405670, -503.524536, 3.552731, -440.548615, -502.838013, 3.638559, -439.709167, -499.995270, 3.863406, -436.248932, -499.458771, 3.631288, -435.332092, -499.354584, 3.427225, -434.275543, -499.518890, 3.263798, -433.213623, -499.786255, 3.119409, -432.168945, -500.093414, 2.942964, -431.138855, -500.416901, 2.698143, -430.129211, -500.756897, 2.452024, -429.125366, -501.102753, 2.205250, -428.123657, -501.993927, 1.130284, -425.598083, -502.375153, 0.625838, -424.550262, -502.760925, 0.259216, -423.439453, -503.125061, -0.073914, -422.319733, -503.344879, -0.434069, -421.301147, -503.392548, -0.782053, -420.267029, -503.345978, -1.156086, -419.237427, -503.275909, -1.517113, -418.212494, -503.200043, -1.875748, -417.190155, -503.092529, -2.185827, -416.171051, -501.571167, -5.735084, -403.501678, -501.418823, -6.069547, -402.475281, -501.176941, -6.153698, -401.405243, -500.898254, -6.118875, -400.354431, -500.586060, -6.079853, -399.313019, -500.255157, -6.038494, -398.277283, -499.919769, -5.917615, -397.250214, -498.133850, -5.162109, -391.881653, -497.607086, -5.099213, -390.933563, -496.951874, -5.030679, -390.068451, -496.247040, -4.960183, -389.242767, -495.526642, -4.922899, -388.429321, -494.798859, -4.939609, -387.620911, -494.057587, -4.973323, -386.825287, -493.242004, -5.007064, -386.107086, -492.357513, -5.040519, -385.475281, -491.422150, -5.050906, -384.920258, -490.463867, -5.046978, -384.405090, -489.496246, -5.027953, -383.907104, -488.524017, -5.008810, -383.419098, -483.903564, -5.444798, -381.144897, -482.970856, -5.764278, -380.673676, -482.046753, -6.081060, -380.195770, -481.059265, -6.036974, -379.756531, -480.068268, -6.092669, -379.310974, -478.083740, -6.252785, -378.424103, -475.939850, -5.600721, -377.478241, -474.095123, -5.269806, -376.659973, -472.988983, -5.088950, -376.167572, -471.997314, -4.996942, -375.725739, -467.519684, -5.021126, -373.745483, -466.568787, -4.988472, -373.221497, -465.785889, -4.954824, -372.473022, -465.155731, -4.938012, -371.586975, -464.613434, -4.943035, -370.644104, -464.112732, -4.970317, -369.678741, -463.636993, -5.030797, -368.702332, -463.174835, -5.119479, -367.720856, -462.721741, -5.261708, -366.742218, -461.430298, -5.878856, -363.953918, -460.990692, -5.964869, -362.965485, -459.656555, -6.049467, -359.997162, -459.353271, -6.087378, -358.954742, -459.191864, -6.107553, -357.879517, -459.106384, -6.118238, -356.795227, -459.081055, -6.089601, -355.710297, -459.074738, -5.935709, -354.633362, -459.104004, -5.658697, -351.932465, -459.120667, -5.591868, -350.846558, -459.187042, -5.479144, -346.507324, -459.430115, -5.749809, -332.941071, -459.453735, -5.802073, -331.854553, -459.471832, -5.754164, -330.767517, -459.490845, -5.694329, -329.681580, -459.512299, -5.627197, -328.459930, -459.529968, -5.682715, -327.376678, -459.596893, -6.022334, -323.863861, -459.627655, -6.068361, -321.961487, -459.653656, -6.049818, -320.465668, -459.672607, -6.047450, -319.377808, -459.690857, -6.045168, -318.289795, -459.733826, -6.098748, -317.204376, -459.866302, -6.163945, -316.126587, -460.061859, -6.354894, -315.070129, -460.284729, -6.588387, -314.031128, -460.533112, -6.826213, -312.999054, -460.823303, -7.095395, -311.840057, -462.704620, -9.301330, -304.645416, -462.954193, -9.692020, -303.546783, -463.049988, -10.017150, -302.513519, -463.025604, -10.351537, -301.479034, -462.936340, -10.689318, -300.448883, -462.818665, -11.044333, -299.424500, -462.686890, -11.409551, -298.408417, -462.388000, -12.191285, -296.252502, -460.616119, -15.430405, -284.034149, -460.460663, -15.766811, -283.004272, -460.297577, -16.098799, -281.981476, -460.138611, -16.023895, -280.905792, -459.880035, -16.021536, -279.850311, -459.524323, -16.066000, -278.793884, -459.151947, -16.112444, -277.774414, -458.760895, -15.948345, -276.768036, -457.728149, -15.418857, -274.162994, -457.121918, -15.183194, -272.663147, -455.141998, -14.929026, -267.753723, -454.605865, -14.961267, -266.809937, -453.910492, -14.994783, -265.975586, -453.106659, -15.028536, -265.243866, -452.248810, -15.071724, -264.575989, -451.363373, -15.070765, -263.944366, -450.467194, -15.049448, -263.327393, -449.339539, -15.027678, -262.566895, -446.158661, -15.106158, -260.478607, -445.146484, -15.217936, -260.096680, -444.094391, -15.313764, -259.845978, -443.059662, -15.693615, -259.832489, -442.038452, -16.061672, -259.905914, -440.926056, -16.011379, -259.961243, -439.853027, -16.029181, -259.818878, -438.834473, -16.076151, -259.442963, -437.860443, -16.135080, -258.975220, -436.944824, -15.842243, -258.482483, -436.029755, -15.561083, -257.958588, -435.103333, -15.389626, -257.408356, -433.018707, -15.096863, -256.158447, -423.253204, -15.007891, -250.244461, -422.581299, -15.076889, -249.399033, -422.162994, -15.134439, -248.398422, -421.907043, -15.243899, -247.346481, -421.727417, -15.378567, -246.282013, -421.576630, -15.511925, -245.212921, -421.436920, -15.814054, -244.166107, -421.312561, -15.977121, -243.104950, -421.161774, -16.151787, -241.633881, -421.101837, -16.144278, -240.547592, -421.054230, -16.138294, -239.460739, -420.986694, -16.129854, -237.557938, -420.237152, -15.986206, -212.018356, -420.191437, -15.916931, -210.797974, -420.120667, -15.789013, -207.812439, -420.097992, -15.820995, -206.456985, -419.913025, -16.017410, -199.259720, -420.074188, -16.138962, -198.186157, -420.394592, -15.806675, -197.200790, -420.823639, -15.475427, -196.257751, -421.315735, -15.246454, -195.308350, -421.840698, -15.131503, -194.360291, -422.374817, -15.078588, -193.413864, -424.067291, -15.028349, -190.467560, -427.695129, -14.944219, -184.241776, -428.330750, -15.027770, -183.363968, -429.060547, -15.124342, -182.563538, -429.847046, -15.204210, -181.816025, -430.657654, -15.276329, -181.094086, -431.483185, -15.340816, -180.388275, -432.919403, -15.584278, -179.168777, -446.700073, -18.848972, -167.730667, -447.838928, -18.971676, -166.769211, -450.328156, -19.379137, -164.696960, -451.060272, -19.534018, -163.909332, -451.625610, -19.500000, -162.980560, -452.083923, -19.517031, -161.994354, -452.476959, -19.566160, -160.981140, -452.841187, -19.611700, -159.956909, -453.191650, -19.646599, -158.927551, -454.367828, -19.964460, -155.331253, -455.293671, -20.791029, -152.456436, -455.619934, -20.976021, -151.448273, -460.864044, -21.582912, -135.124496, -461.198395, -21.523344, -134.089920, -463.464020, -20.982677, -127.008972, -463.628113, -20.996647, -125.935585, -463.609283, -21.038952, -124.848961, -463.521912, -21.146475, -123.767731, -463.400543, -21.146563, -122.686722, -463.201691, -21.188892, -121.067558, -463.072876, -21.257940, -119.990120, -462.932098, -21.293131, -118.911903, -460.858124, -21.810720, -103.154648, -460.394226, -21.855116, -102.181808, -459.633484, -21.864172, -101.409859, -458.751892, -21.805742, -100.775322, -457.821533, -21.747103, -100.215164, -456.871063, -21.669014, -99.690086, -455.908997, -21.711084, -99.185425, -452.652191, -21.466049, -97.507286, -427.503632, -19.772459, -84.766029, -426.533905, -19.798971, -84.273788, -424.118073, -20.060156, -83.055641, -423.148651, -19.991360, -82.567337 } function onSpawn(npc) npc:initNpcAi() npc:setPos(dsp.path.first(path)) onPath(npc) end function onPath(npc) if npc:atPoint(dsp.path.get(path, 288)) then GetNPCByID(npc:getID() + 4):showText(npc, ID.text.ZOVRIACE_REPORT) -- small delay after path finish npc:wait(8000) end dsp.path.patrol(npc, path) end function onTrade(player, npc, trade) end function onTrigger(player, npc) player:showText(npc, ID.text.ZOVRIACE_DIALOG) npc:wait() end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) end
gpl-3.0
lichtl/darkstar
scripts/globals/items/dragon_steak.lua
18
1866
----------------------------------------- -- ID: 4350 -- Item: dragon_steak -- Food Effect: 180Min, All Races ----------------------------------------- -- Health 25 -- Strength 7 -- Intelligence -3 -- Health Regen While Healing 2 -- Attack % 20 -- Attack Cap 150 -- Ranged ATT % 20 -- Ranged ATT Cap 150 -- Demon Killer 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,10800,4350); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 25); target:addMod(MOD_STR, 7); target:addMod(MOD_INT, -3); target:addMod(MOD_HPHEAL, 2); target:addMod(MOD_FOOD_ATTP, 20); target:addMod(MOD_FOOD_ATT_CAP, 150); target:addMod(MOD_FOOD_RATTP, 20); target:addMod(MOD_FOOD_RATT_CAP, 150); target:addMod(MOD_DEMON_KILLER, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 25); target:delMod(MOD_STR, 7); target:delMod(MOD_INT, -3); target:delMod(MOD_HPHEAL, 2); target:delMod(MOD_FOOD_ATTP, 20); target:delMod(MOD_FOOD_ATT_CAP, 150); target:delMod(MOD_FOOD_RATTP, 20); target:delMod(MOD_FOOD_RATT_CAP, 150); target:delMod(MOD_DEMON_KILLER, 5); end;
gpl-3.0
raingloom/yaoui
examples/anime/yaoui/Dropdown.lua
4
4408
local yui_path = (...):match('(.-)[^%.]+$') local Object = require(yui_path .. 'UI.classic.classic') local Dropdown = Object:extend('Dropdown') function Dropdown:new(yui, settings) self.yui = yui self.timer = self.yui.Timer() self.x, self.y = 0, 0 self.name = settings.name self.size = settings.size or 20 self.options = settings.options self.font = love.graphics.newFont(self.yui.Theme.open_sans_semibold, math.floor(self.size*0.7)) self.font:setFallbacks(love.graphics.newFont(self.yui.Theme.font_awesome_path, math.floor(self.size*0.7))) self.icon = self.yui.Theme.font_awesome['fa-sort-desc'] self.current_option = settings.current_option or 1 self.title = settings.title or '' self.drop_up = settings.drop_up self.hot = false self.show_dropdown = false self.w = settings.w or self.font:getWidth(self.title .. ' ' .. self.options[self.current_option] .. ' ' .. self.icon) + 2*self.size self.h = self.font:getHeight() + math.floor(self.size)*0.7 self.main_button = self.yui.UI.Button(0, 0, self.w, self.h, { yui = self.yui, extensions = {self.yui.Theme.Dropdown}, font = self.font, parent = self, icon = self.icon, title = self.title, }) local min_w = 0 for i = 1, #self.options do local w = self.font:getWidth(self.options[i]) + 2*self.size if w > min_w then min_w = w end end local h = self.font:getHeight() + math.floor(self.size)*0.7 self.down_area = self.yui.UI.Scrollarea(0, 0, math.max(min_w, self.w), #self.options*h + self.size, { yui = self.yui, extensions = {self.yui.Theme.DropdownScrollarea}, parent = self, show_scrollbars = true, }) for i, option in ipairs(self.options) do self.down_area:addElement(self.yui.UI.Button(0, self.size/2 + (i-1)*h, math.max(min_w, self.w), h, { yui = self.yui, extensions = {self.yui.Theme.DropdownButton}, font = love.graphics.newFont(self.yui.Theme.open_sans_semibold, math.floor(self.size*0.65)), text = self.options[i], size = self.size, })) end self.onSelect = settings.onSelect self.onWidthChange = settings.onWidthChange self.w = self.main_button.w end function Dropdown:update(dt) self.timer:update(dt) self.main_button.x, self.main_button.y = self.x, self.y if self.drop_up then self.down_area.ix, self.down_area.iy = self.x, self.y - self.down_area.h else self.down_area.ix, self.down_area.iy = self.x, self.y + self.h end local any_hot = false if self.main_button.hot then any_hot = true end for i, element in ipairs(self.down_area.elements) do if element.hot then any_hot = true end if element.released and element.hot then self.current_option = i self.show_dropdown = false if self.onSelect then self:onSelect(self.options[self.current_option]) end for _, element in ipairs(self.down_area.elements) do if element.dropdown_selected then element.add_x = 0 element.draw_bg = false element.alpha = 0 end end self.w = self.font:getWidth(self.title .. ' ' .. self.options[self.current_option] .. ' ' .. self.icon) + 2*self.size self.main_button.w = self.w self.down_area:update(0) self.down_area.hot = false if self.onWidthChange then self:onWidthChange() end end end if self.main_button.input:pressed('left-click') and not any_hot then self.show_dropdown = false self.down_area:update(0) self.down_area.hot = false end if self.main_button.pressed then self.show_dropdown = not self.show_dropdown end for i, element in ipairs(self.down_area.elements) do if i == self.current_option then element.dropdown_selected = true else element.dropdown_selected = false end end self.main_button:update(dt) if self.show_dropdown then self.down_area:update(dt) end if self.main_button.hot then love.mouse.setCursor(self.yui.Theme.hand_cursor) end end function Dropdown:draw() self.main_button:draw() end function Dropdown:postDraw() if self.show_dropdown then self.down_area:draw() end end return Dropdown
mit
RunAwayDSP/darkstar
scripts/globals/shop.lua
7
24263
----------------------------------- -- -- Functions for Shop system -- ----------------------------------- require("scripts/globals/conquest") require("scripts/globals/settings") require("scripts/globals/crafting") ----------------------------------- dsp = dsp or {} dsp.shop = { --[[ ******************************************************************************* send general shop dialog to player stock cuts off after 16 items. if you add more, extras will not display stock is of form {itemId1, price1, itemId2, price2, ...} log is a log ID from scripts/globals/log_ids.lua ******************************************************************************* --]] general = function(player, stock, log) local priceMultiplier = 1 if log then priceMultiplier = (1 + (0.20 * (9 - player:getFameLevel(log)) / 8)) * SHOP_PRICE else log = -1 end player:createShop(#stock / 2, log) for i = 1, #stock, 2 do player:addShopItem(stock[i], stock[i+1] * priceMultiplier) end player:sendMenu(2) end, --[[ ******************************************************************************* send general guild shop dialog to player (Added on June 2014 QoL) stock is of form {itemId1, price1, guildID, guildRank, ...} log is default set to -1 as it's needed as part of createShop() ******************************************************************************* --]] generalGuild = function(player, stock, guildRank) local log = -1 player:createShop(#stock / 3, log) for i = 1, #stock, 3 do if guildRank >= stock[i+2] then player:addShopItem(stock[i], stock[i+1]) end end player:sendMenu(2) end, --[[ ******************************************************************************* send nation shop dialog to player stock cuts off after 16 items. if you add more, extras will not display stock is of form {itemId1, price1, place1, itemId2, price2, place2, ...} where place is what place the nation must be in for item to be stocked nation is a dsp.nation ID from scripts/globals/zone.lua ******************************************************************************* --]] nation = function(player, stock, nation) local rank = getNationRank(nation) local newStock = {} for i = 1, #stock, 3 do if (stock[i+2] == 1 and player:getNation() == nation and rank == 1) or (stock[i+2] == 2 and rank <= 2) or (stock[i+2] == 3) then table.insert(newStock, stock[i]) table.insert(newStock, stock[i+1]) end end dsp.shop.general(player, newStock, nation) end, --[[ ******************************************************************************* send outpost shop dialog to player ******************************************************************************* --]] outpost = function(player) local stock = { 4148, 316, -- Antidote 4151, 800, -- Echo Drops 4128, 4832, -- Ether 4150, 2595, -- Eye Drops 4112, 910, -- Potion } dsp.shop.general(player, stock) end, --[[ ******************************************************************************* send celebratory chest shop dialog to player ******************************************************************************* --]] celebratory = function(player) local stock = { 4167, 30, -- Cracker 4168, 30, -- Twinkle Shower 4215, 60, -- Popstar 4216, 60, -- Brilliant Snow 4256, 30, -- Ouka Ranman 4169, 30, -- Little Comet 5769, 650, -- Popper 4170, 1000, -- Wedding Bell 5424, 6000, -- Serene Serinette 5425, 6000, -- Joyous Serinette 4441, 1116, -- Grape Juice 4238, 3000, -- Inferno Crystal 4240, 3000, -- Cyclone Crystal 4241, 3000, -- Terra Crystal } dsp.shop.general(player, stock) end, --[[ ******************************************************************************* stock for guild vendors that are open 24/8 ******************************************************************************* --]] generalGuildStock = { [guild.cooking] = { 936, 16, dsp.craftRank.AMATEUR, -- Rock Salt 4509, 12, dsp.craftRank.AMATEUR, -- Distilled Water 4362, 100, dsp.craftRank.AMATEUR, -- Lizard Egg 4392, 32, dsp.craftRank.AMATEUR, -- Saruta Orange 4431, 76, dsp.craftRank.AMATEUR, -- San d'Orian Grapes 9193, 2500, dsp.craftRank.AMATEUR, -- Miso 9194, 2500, dsp.craftRank.AMATEUR, -- Soy Sauce 9195, 2500, dsp.craftRank.AMATEUR, -- Dried Bonito 610, 60, dsp.craftRank.RECRUIT, -- San d'Orian Flour 627, 40, dsp.craftRank.RECRUIT, -- Maple Sugar 4363, 44, dsp.craftRank.RECRUIT, -- Faerie Apple 4378, 60, dsp.craftRank.RECRUIT, -- Selbina Milk 4370, 200, dsp.craftRank.RECRUIT, -- Honey 4432, 60, dsp.craftRank.INITIATE, -- Kazham Pineapple 4366, 24, dsp.craftRank.INITIATE, -- La Theine Cabbage 611, 40, dsp.craftRank.INITIATE, -- Rye Flour 4412, 325, dsp.craftRank.NOVICE, -- Thundermelon 4491, 200, dsp.craftRank.NOVICE, -- Watermelon 615, 60, dsp.craftRank.NOVICE, -- Selbina Butter 612, 60, dsp.craftRank.APPRENTICE, -- Kazham Peppers 1111, 900, dsp.craftRank.APPRENTICE, -- Gelatin 1776, 3000, dsp.craftRank.JOURNEYMAN, -- Spaghetti 5164, 2595, dsp.craftRank.JOURNEYMAN, -- Ground Wasabi 616, 1600, dsp.craftRank.CRAFTSMAN, -- Pie Dough 2561, 3000, dsp.craftRank.CRAFTSMAN, -- Pizza Dough 8800, 600, dsp.craftRank.CRAFTSMAN, -- Azuki Bean 8903, 300, dsp.craftRank.AMATEUR, -- Cooking Kit 5 8904, 400, dsp.craftRank.AMATEUR, -- Cooking Kit 10 8905, 650, dsp.craftRank.AMATEUR, -- Cooking Kit 15 8906, 1050, dsp.craftRank.AMATEUR, -- Cooking Kit 20 8907, 1600, dsp.craftRank.AMATEUR, -- Cooking Kit 25 8908, 2300, dsp.craftRank.AMATEUR, -- Cooking Kit 30 8909, 3150, dsp.craftRank.AMATEUR, -- Cooking Kit 35 8910, 4150, dsp.craftRank.AMATEUR, -- Cooking Kit 40 8911, 5300, dsp.craftRank.AMATEUR, -- Cooking Kit 45 8912, 7600, dsp.craftRank.AMATEUR -- Cooking Kit 50 }, [guild.clothcraft] = { 2128, 75, dsp.craftRank.AMATEUR, -- Spindle 2145, 75, dsp.craftRank.AMATEUR, -- Zephyr Thread 833, 20, dsp.craftRank.AMATEUR, -- Moko Grass 834, 500, dsp.craftRank.RECRUIT, -- Saruta Cotton 1845, 200, dsp.craftRank.RECRUIT, -- Red Moko Grass 819, 150, dsp.craftRank.INITIATE, -- Linen Thread 820, 2800, dsp.craftRank.NOVICE, -- Wool Thread 2295, 800, dsp.craftRank.APPRENTICE, -- Mohbwa Grass 816, 1500, dsp.craftRank.APPRENTICE, -- Silk Thread 2315, 1400, dsp.craftRank.JOURNEYMAN, -- Karakul Wool 823, 14500, dsp.craftRank.CRAFTSMAN, -- Gold Thread 8847, 300, dsp.craftRank.AMATEUR, -- Clothcraft kit 5 8848, 400, dsp.craftRank.AMATEUR, -- Clothcraft Kit 10 8849, 650, dsp.craftRank.AMATEUR, -- Clothcraft Kit 15 8850, 1050, dsp.craftRank.AMATEUR, -- Clothcraft Kit 20 8851, 1600, dsp.craftRank.AMATEUR, -- Clothcraft Kit 25 8852, 2300, dsp.craftRank.AMATEUR, -- Clothcraft Kit 30 8853, 3150, dsp.craftRank.AMATEUR, -- Clothcraft Kit 35 8854, 4150, dsp.craftRank.AMATEUR, -- Clothcraft Kit 40 8855, 5300, dsp.craftRank.AMATEUR, -- Clothcraft Kit 45 8856, 7600, dsp.craftRank.AMATEUR, -- Clothcraft Kit 50 9251, 1126125, dsp.craftRank.AMATEUR -- Khoma Thread }, [guild.goldsmithing] = { 2144, 75, dsp.craftRank.AMATEUR, -- Workshop Anvil 2143, 75, dsp.craftRank.AMATEUR, -- Mandrel 642, 200, dsp.craftRank.AMATEUR, -- Zinc Ore 640, 12, dsp.craftRank.AMATEUR, -- Copper Ore 1231, 40, dsp.craftRank.RECRUIT, -- Brass Nugget 661, 300, dsp.craftRank.RECRUIT, -- Brass Sheet 736, 450, dsp.craftRank.RECRUIT, -- Silver Ore 1233, 200, dsp.craftRank.INITIATE, -- Silver Nugget 806, 1863, dsp.craftRank.INITIATE, -- Tourmaline 807, 1863, dsp.craftRank.INITIATE, -- Sardonyx 809, 1863, dsp.craftRank.INITIATE, -- Clear Topaz 800, 1863, dsp.craftRank.INITIATE, -- Amethyst 795, 1863, dsp.craftRank.INITIATE, -- Lapis Lazuli 814, 1863, dsp.craftRank.INITIATE, -- Amber 799, 1863, dsp.craftRank.INITIATE, -- Onyx 796, 1863, dsp.craftRank.INITIATE, -- Light Opal 760, 23000, dsp.craftRank.NOVICE, -- Silver Chain 644, 2000, dsp.craftRank.NOVICE, -- Mythril Ore 737, 3000, dsp.craftRank.APPRENTICE, -- Gold Ore 663, 12000, dsp.craftRank.APPRENTICE, -- Mythril Sheet 788, 8000, dsp.craftRank.APPRENTICE, -- Peridot 790, 8000, dsp.craftRank.APPRENTICE, -- Garnet 808, 8000, dsp.craftRank.APPRENTICE, -- Goshenite 811, 8000, dsp.craftRank.APPRENTICE, -- Ametrine 798, 8000, dsp.craftRank.APPRENTICE, -- Turquoise 815, 8000, dsp.craftRank.APPRENTICE, -- Sphene 793, 8000, dsp.craftRank.APPRENTICE, -- Black Pearl 792, 8000, dsp.craftRank.APPRENTICE, -- Pearl 678, 5000, dsp.craftRank.APPRENTICE, -- Aluminum Ore 752, 32000, dsp.craftRank.JOURNEYMAN, -- Gold Sheet 761, 58000, dsp.craftRank.JOURNEYMAN, -- Gold Chain 738, 5000, dsp.craftRank.CRAFTSMAN, -- Platinum Ore 8833, 300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 5 8834, 400, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 10 8835, 650, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 15 8836, 1050, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 20 8837, 1600, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 25 8838, 2300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 30 8839, 3150, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 35 8840, 4150, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 40 8841, 5300, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 45 8842, 7600, dsp.craftRank.AMATEUR, -- Goldsmithing Kit 50 9249, 1126125, dsp.craftRank.AMATEUR -- Ruthenium Ore }, [guild.woodworking] = { 1657, 100, dsp.craftRank.AMATEUR, -- Bundling Twine 688, 25, dsp.craftRank.AMATEUR, -- Arrowwood Log 689, 50, dsp.craftRank.AMATEUR, -- Lauan Log 691, 70, dsp.craftRank.AMATEUR, -- Maple Log 697, 800, dsp.craftRank.RECRUIT, -- Holly Log 695, 1600, dsp.craftRank.RECRUIT, -- Willow Log 693, 1300, dsp.craftRank.RECRUIT, -- Walnut Log 696, 500, dsp.craftRank.INITIATE, -- Yew Log 690, 3800, dsp.craftRank.INITIATE, -- Elm Log 694, 3400, dsp.craftRank.INITIATE, -- Chestnut Log 727, 2000, dsp.craftRank.NOVICE, -- Dogwood Log 699, 4000, dsp.craftRank.NOVICE, -- Oak Log 701, 4500, dsp.craftRank.APPRENTICE, -- Rosewood Log 700, 4500, dsp.craftRank.JOURNEYMAN, -- Mahogany Log 702, 5000, dsp.craftRank.CRAFTSMAN, -- Ebony Log 2761, 5500, dsp.craftRank.CRAFTSMAN, -- Feyweald Log 8805, 300, dsp.craftRank.AMATEUR, -- Smithing Kit 5 8806, 400, dsp.craftRank.AMATEUR, -- Smithing Kit 10 8807, 650, dsp.craftRank.AMATEUR, -- Smithing Kit 15 8808, 1050, dsp.craftRank.AMATEUR, -- Smithing Kit 20 8809, 1600, dsp.craftRank.AMATEUR, -- Smithing Kit 25 8810, 2300, dsp.craftRank.AMATEUR, -- Smithing Kit 30 8811, 3150, dsp.craftRank.AMATEUR, -- Smithing Kit 35 8812, 4150, dsp.craftRank.AMATEUR, -- Smithing Kit 40 8813, 5300, dsp.craftRank.AMATEUR, -- Smithing Kit 45 8814, 7600, dsp.craftRank.AMATEUR, -- Smithing Kit 50 9245, 1126125, dsp.craftRank.AMATEUR -- Cypress Log }, [guild.alchemy] = { 2131, 75, dsp.craftRank.AMATEUR, -- Triturator 912, 40, dsp.craftRank.AMATEUR, -- Beehive Chip 914, 1700, dsp.craftRank.AMATEUR, -- Mercury 937, 300, dsp.craftRank.RECRUIT, -- Animal Glue 943, 320, dsp.craftRank.RECRUIT, -- Poison Dust 637, 1500, dsp.craftRank.INITIATE, -- Slime Oil 928, 515, dsp.craftRank.INITIATE, -- Bomb Ash 921, 200, dsp.craftRank.INITIATE, -- Ahriman Tears 933, 1200, dsp.craftRank.NOVICE, -- Glass Fiber 947, 5000, dsp.craftRank.NOVICE, -- Firesand 4171, 700, dsp.craftRank.APPRENTICE, -- Vitriol 1886, 4000, dsp.craftRank.APPRENTICE, -- Sieglinde Putty 923, 1800, dsp.craftRank.APPRENTICE, -- Dryad Root 932, 1900, dsp.craftRank.JOURNEYMAN, -- Carbon Fiber 939, 2100, dsp.craftRank.JOURNEYMAN, -- Hecteyes Eye 915, 3600, dsp.craftRank.JOURNEYMAN, -- Toad Oil 931, 5000, dsp.craftRank.CRAFTSMAN, -- Cermet Chunk 944, 1035, dsp.craftRank.CRAFTSMAN, -- Venom Dust 8889, 300, dsp.craftRank.AMATEUR, -- Alchemy Kit 5 8890, 400, dsp.craftRank.AMATEUR, -- Alchemy Kit 10 8891, 650, dsp.craftRank.AMATEUR, -- Alchemy Kit 15 8892, 1050, dsp.craftRank.AMATEUR, -- Alchemy Kit 20 8893, 1600, dsp.craftRank.AMATEUR, -- Alchemy Kit 25 8894, 2300, dsp.craftRank.AMATEUR, -- Alchemy Kit 30 8895, 3150, dsp.craftRank.AMATEUR, -- Alchemy Kit 35 8896, 4150, dsp.craftRank.AMATEUR, -- Alchemy Kit 40 8897, 5300, dsp.craftRank.AMATEUR, -- Alchemy Kit 45 8898, 7600, dsp.craftRank.AMATEUR, -- Alchemy Kit 50 9257, 1126125, dsp.craftRank.AMATEUR -- Azure Leaf }, [guild.bonecraft] = { 2130, 75, dsp.craftRank.AMATEUR, -- Shagreen File 880, 150, dsp.craftRank.AMATEUR, -- Bone Chip 864, 96, dsp.craftRank.AMATEUR, -- Fish Scales 898, 1500, dsp.craftRank.RECRUIT, -- Chicken Bone [Recruit] 893, 1400, dsp.craftRank.RECRUIT, -- Giant Femur [Recruit] 889, 500, dsp.craftRank.INITIATE, -- Beetle Shell [Initiate] 894, 1000, dsp.craftRank.INITIATE, -- Beetle Jaw [Initiate] 895, 1800, dsp.craftRank.NOVICE, -- Ram Horn [Novice] 884, 2000, dsp.craftRank.NOVICE, -- Black Tiger Fang [Novice] 881, 2500, dsp.craftRank.APPRENTICE, -- Crab Shell [Apprentice] 885, 6000, dsp.craftRank.JOURNEYMAN, -- Turtle Shell [Journeyman] 897, 2400, dsp.craftRank.JOURNEYMAN, -- Scorpion Claw [Journeyman] 1622, 4000, dsp.craftRank.JOURNEYMAN, -- Bugard Tusk [Journeyman] 896, 3000, dsp.craftRank.CRAFTSMAN, -- Scorpion Shell [Craftsman] 2147, 4500, dsp.craftRank.CRAFTSMAN, -- Marid Tusk [Craftsman] 8875, 300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 5 8876, 400, dsp.craftRank.AMATEUR, -- Bonecraft Kit 10 8877, 650, dsp.craftRank.AMATEUR, -- Bonecraft Kit 15 8878, 1050, dsp.craftRank.AMATEUR, -- Bonecraft Kit 20 8879, 1600, dsp.craftRank.AMATEUR, -- Bonecraft Kit 25 8880, 2300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 30 8881, 3150, dsp.craftRank.AMATEUR, -- Bonecraft Kit 35 8882, 4150, dsp.craftRank.AMATEUR, -- Bonecraft Kit 40 8883, 5300, dsp.craftRank.AMATEUR, -- Bonecraft Kit 45 8884, 7600, dsp.craftRank.AMATEUR, -- Bonecraft Kit 50 9255, 1126125, dsp.craftRank.AMATEUR -- Cyan Coral }, [guild.leathercraft] = { 2129, 75, dsp.craftRank.AMATEUR, -- Tanning Vat 505, 100, dsp.craftRank.AMATEUR, -- Sheepskin 856, 80, dsp.craftRank.AMATEUR, -- Rabbit Hide 852, 600, dsp.craftRank.RECRUIT, -- Lizard Skin 878, 600, dsp.craftRank.RECRUIT, -- Karakul Skin 858, 600, dsp.craftRank.RECRUIT, -- Wolf Hide 857, 2400, dsp.craftRank.INITIATE, -- Dhalmel Hide 1640, 2500, dsp.craftRank.INITIATE, -- Bugard Skin 859, 1500, dsp.craftRank.NOVICE, -- Ram Skin 1628, 16000, dsp.craftRank.APPRENTICE, -- Buffalo Hide 853, 3000, dsp.craftRank.JOURNEYMAN, -- Raptor Skin 2123, 2500, dsp.craftRank.JOURNEYMAN, -- Catoblepas Hide 2518, 3000, dsp.craftRank.CRAFTSMAN, -- Smilodon Hide 854, 3000, dsp.craftRank.CRAFTSMAN, -- Cockatrice Skin 8861, 300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 5 8862, 400, dsp.craftRank.AMATEUR, -- Leathercraft Kit 10 8863, 650, dsp.craftRank.AMATEUR, -- Leathercraft Kit 15 8864, 1050, dsp.craftRank.AMATEUR, -- Leathercraft Kit 20 8865, 1600, dsp.craftRank.AMATEUR, -- Leathercraft Kit 25 8866, 2300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 30 8867, 3150, dsp.craftRank.AMATEUR, -- Leathercraft Kit 35 8868, 4150, dsp.craftRank.AMATEUR, -- Leathercraft Kit 40 8869, 5300, dsp.craftRank.AMATEUR, -- Leathercraft Kit 45 8870, 7600, dsp.craftRank.AMATEUR, -- Leathercraft Kit 50 9253, 1126125, dsp.craftRank.AMATEUR -- Synthetic Faulpie Leather }, [guild.smithing] = { 2144, 75, dsp.craftRank.AMATEUR, -- Workshop Anvil 2143, 75, dsp.craftRank.AMATEUR, -- Mandrel 640, 12, dsp.craftRank.AMATEUR, -- Copper Ore 1232, 70, dsp.craftRank.AMATEUR, -- Bronze Nugget 641, 60, dsp.craftRank.RECRUIT, -- Tin Ore 660, 120, dsp.craftRank.RECRUIT, -- Bronze Sheet 643, 900, dsp.craftRank.RECRUIT, -- Iron Ore 1650, 800, dsp.craftRank.INITIATE, -- Kopparnickel Ore 1234, 500, dsp.craftRank.INITIATE, -- Iron Nugget 662, 6000, dsp.craftRank.INITIATE, -- Iron Sheet 666, 10000, dsp.craftRank.NOVICE, -- Steel Sheet 652, 6000, dsp.craftRank.APPRENTICE, -- Steel Ingot 657, 12000, dsp.craftRank.APPRENTICE, -- Tama-Hagane 1228, 2700, dsp.craftRank.JOURNEYMAN, -- Darksteel Nugget 645, 7000, dsp.craftRank.JOURNEYMAN, -- Darksteel Ore 1235, 800, dsp.craftRank.JOURNEYMAN, -- Steel Nugget 664, 28000, dsp.craftRank.JOURNEYMAN, -- Darksteel Sheet 2763, 5000, dsp.craftRank.CRAFTSMAN, -- Swamp Ore 8819, 300, dsp.craftRank.AMATEUR, -- Smithing Kit 5 8820, 400, dsp.craftRank.AMATEUR, -- Smithing Kit 10 8821, 650, dsp.craftRank.AMATEUR, -- Smithing Kit 15 8822, 1050, dsp.craftRank.AMATEUR, -- Smithing Kit 20 8823, 1600, dsp.craftRank.AMATEUR, -- Smithing Kit 25 8824, 2300, dsp.craftRank.AMATEUR, -- Smithing Kit 30 8825, 3150, dsp.craftRank.AMATEUR, -- Smithing Kit 35 8826, 4150, dsp.craftRank.AMATEUR, -- Smithing Kit 40 8827, 5300, dsp.craftRank.AMATEUR, -- Smithing Kit 45 8828, 7600, dsp.craftRank.AMATEUR, -- Smithing Kit 50 9247, 1126125, dsp.craftRank.AMATEUR -- Niobium Ore } } }
gpl-3.0
lichtl/darkstar
scripts/zones/Beaucedine_Glacier/TextIDs.lua
4
1124
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6562; -- You cannot obtain the item. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6564; -- You cannot obtain the #. Try trading again after sorting your inventory. ITEM_OBTAINED = 6565; -- Obtained: <item>. GIL_OBTAINED = 6566; -- Obtained <number> gil. KEYITEM_OBTAINED = 6568; -- Obtained key item: <keyitem>. ITEMS_OBTAINED = 6571; -- You obtain BEASTMEN_BANNER = 81; -- There is a beastmen's banner. FISHING_MESSAGE_OFFSET = 7226; -- You can't fish here. -- Conquest CONQUEST = 7479; -- You've earned conquest points! -- Other dialog NOTHING_OUT_OF_ORDINARY = 6579; -- There is nothing out of the ordinary here. -- Dynamis dialogs YOU_CANNOT_ENTER_DYNAMIS = 7860; -- You cannot enter Dynamis PLAYERS_HAVE_NOT_REACHED_LEVEL = 7862; -- Players who have not reached levelare prohibited from entering Dynamis. UNUSUAL_ARRANGEMENT_OF_BRANCHES = 7872; -- There is an unusual arrangement of branches here. -- conquest Base CONQUEST_BASE = 0;
gpl-3.0
lichtl/darkstar
scripts/zones/RuLude_Gardens/npcs/Magian_Moogle_Orange.lua
14
2327
----------------------------------- -- Area: Ru'Lude Gardens -- NPC: Magian Moogle (Orange Bobble) -- Type: Magian Trials NPC (Weapon/Empyrean Armor) -- @pos -11 2.453 118 64 ----------------------------------- package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/RuLude_Gardens/TextIDs"); require("scripts/globals/magiantrials"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1) then local ItemID = trade:getItemId(); local TrialInfo = getTrialInfo(ItemID); local invalid = 0; if (TrialInfo.t1 == 0 and TrialInfo.t2 == 0 and TrialInfo.t3 == 0 and TrialInfo.t4 == 0) then invalid = 1; end player:startEvent(10124, TrialInfo.t1, TrialInfo.t2, TrialInfo.t3, TrialInfo.t4, 0, ItemID, 0, invalid); else -- placeholder for multi item trades such as geode etc. end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getMainLvl() < 75) then player:startEvent(10121); elseif (player:hasKeyItem(MAGIAN_TRIAL_LOG) == false) then player:startEvent(10122); else player:startEvent(10123); -- parameters unknown end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) printf("CSID: %u",csid); printf("RESULT: %u",option); if (csid == 10124) then local ItemID =0 ; if (option == 4456449) then ItemID = 19327; elseif (option == 4456449) then ItemID = 19327; end magianOrangeEventUpdate(player,ItemID,csid,option); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) printf("CSID: %u",csid); printf("RESULT: %u",option); if (csid == 10122 and option == 1) then player:messageSpecial(KEYITEM_OBTAINED,MAGIAN_TRIAL_LOG); player:addKeyItem(MAGIAN_TRIAL_LOG); --elseif -- end end;
gpl-3.0
lichtl/darkstar
scripts/zones/Western_Adoulin/npcs/Preterig.lua
14
1184
----------------------------------- -- Area: Western Adoulin -- NPC: Preterig -- Type: Shop NPC -- @zone 256 -- @pos 6 0 -53 256 ----------------------------------- package.loaded["scripts/zones/Western_Adoulin/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Western_Adoulin/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) -- Standard shop player:showText(npc, PRETERIG_SHOP_TEXT); local stock = { 0x1147, 300, -- Apple Juice 0x1738, 125, -- Frontier Soda 0x1145, 1560, -- Melon Pie 0x1146, 200, -- Orange Juice } showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) end;
gpl-3.0
lichtl/darkstar
scripts/zones/Metalworks/npcs/Elayne.lua
33
1375
----------------------------------- -- Area: Metalworks -- NPC: Elayne -- Involved in Quest: Stamp Hunt ----------------------------------- package.loaded["scripts/zones/Metalworks/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Metalworks/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local StampHunt = player:getQuestStatus(BASTOK,STAMP_HUNT); if (StampHunt == QUEST_ACCEPTED and player:getMaskBit(player:getVar("StampHunt_Mask"),3) == false) then player:startEvent(0x02d5); else player:startEvent(0x02c0); 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 == 0x02d5) then player:setMaskBit(player:getVar("StampHunt_Mask"),"StampHunt_Mask",3,true); end end;
gpl-3.0
scscgit/scsc_wildstar_addons
RaidCore/Encounters/DS/miniboss/Earth_Fully_Optimized_Canimid.lua
1
3437
---------------------------------------------------------------------------------------------------- -- Client Lua Script for RaidCore Addon on WildStar Game. -- -- Copyright (C) 2015 RaidCore ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -- Description: -- TODO ---------------------------------------------------------------------------------------------------- local Apollo = require "Apollo" local core = Apollo.GetPackage("Gemini:Addon-1.1").tPackage:GetAddon("RaidCore") local mod = core:NewEncounter("FullyOptimizedCanimid", 52, 98, 108) if not mod then return end ---------------------------------------------------------------------------------------------------- -- Registering combat. ---------------------------------------------------------------------------------------------------- mod:RegisterTrigMob(core.E.TRIGGER_ANY, { "Fully-Optimized Canimid" }) mod:RegisterEnglishLocale({ -- Unit names. ["Fully-Optimized Canimid"] = "Fully-Optimized Canimid", -- Cast ["Terra-forme"] = "Terra-forme", ["Undermine"] = "Undermine", -- Bar and messages. ["5 x undermine"] = "5x undermine", }) mod:RegisterFrenchLocale({ -- Unit names. ["Fully-Optimized Canimid"] = "Canimide entièrement optimisé", -- Cast ["Terra-forme"] = "Terra-forme", ["Undermine"] = "Ébranler", -- Bar and messages. ["5 x undermine"] = "5x Ébranler", }) mod:RegisterGermanLocale({ }) -- Timers default configs. mod:RegisterDefaultTimerBarConfigs({ ["Terra-forme"] = { sColor = "xkcdAmethyst" }, ["Undermine"] = { sColor = "xkcdBloodOrange" }, }) ---------------------------------------------------------------------------------------------------- -- Constants. ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -- Locals. ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -- Encounter description. ---------------------------------------------------------------------------------------------------- function mod:OnBossEnable() mod:AddTimerBar("Terra-forme", "Terra-forme", 59.5) mod:AddTimerBar("Undermine", "5 x undermine", 31.7) end function mod:OnUnitCreated(nId, tUnit, sName) if sName == self.L["Fully-Optimized Canimid"] then core:AddUnit(tUnit) core:WatchUnit(tUnit) end end function mod:OnCastStart(nId, sCastName, nCastEndTime, sName) if self.L["Fully-Optimized Canimid"] == sName then if self.L["Terra-forme"] == sCastName then mod:RemoveTimerBar("Terra-forme") elseif self.L["Undermine"] == sCastName then mod:RemoveTimerBar("5 x undermine") end end end function mod:OnCastEnd(nId, sCastName, bInterrupted, nCastEndTime, sName) if self.L["Fully-Optimized Canimid"] == sName then if self.L["Terra-forme"] == sCastName then -- Timings are corrects only if the absorb have been broken. -- The MOO duration is 10s. mod:AddTimerBar("Undermine", "5 x undermine", 28.8) mod:AddTimerBar("Terra-forme", "Terra-forme", 66) end end end
mit
OctoEnigma/shiny-octo-system
gamemodes/darkrp/gamemode/modules/tipjar/sv_communication.lua
2
3840
util.AddNetworkString("DarkRP_TipJarUI") util.AddNetworkString("DarkRP_TipJarDonate") util.AddNetworkString("DarkRP_TipJarUpdate") util.AddNetworkString("DarkRP_TipJarExit") util.AddNetworkString("DarkRP_TipJarDonatedList") net.Receive("DarkRP_TipJarDonate", function(_, ply) local tipjar = net.ReadEntity() local amount = net.ReadUInt(32) if not IsValid(tipjar) then return end local owner = tipjar:Getowning_ent() if not IsValid(owner) then return end if owner == ply then return end ply.DarkRPLastTip = ply.DarkRPLastTip or -1 if ply.DarkRPLastTip > CurTime() - 0.5 then DarkRP.notify(ply, NOTIFY_ERROR, 4, DarkRP.getPhrase("wait_with_that")) return end if not ply:canAfford(amount) then DarkRP.notify(activator, NOTIFY_ERROR, 4, DarkRP.getPhrase("cant_afford", amount)) return end if tipjar:GetPos():DistToSqr(ply:GetPos()) > 100 * 100 then DarkRP.notify(ply, NOTIFY_ERROR, 4, DarkRP.getPhrase("distance_too_big")) return end DarkRP.payPlayer(ply, owner, amount) tipjar:AddDonation(ply:Nick(), amount) tipjar:EmitSound("ambient/alarms/warningbell1.wav") local strAmount = DarkRP.formatMoney(amount) DarkRP.notify(ply, NOTIFY_HINT, 4, DarkRP.getPhrase("you_donated", strAmount, owner:Nick())) DarkRP.notify(owner, NOTIFY_HINT, 4, DarkRP.getPhrase("has_donated", ply:Nick(), strAmount)) net.Start("DarkRP_TipJarDonate") net.WriteEntity(tipjar) net.WriteEntity(ply) net.WriteUInt(amount, 32) net.Broadcast() end) net.Receive("DarkRP_TipJarUpdate", function(_, ply) local tipjar = net.ReadEntity() local amount = net.ReadUInt(32) if not IsValid(tipjar) then return end -- Larger margin of distance, to prevent false positives if tipjar:GetPos():DistToSqr(ply:GetPos()) > 150 * 150 then return end tipjar:UpdateActiveDonation(ply, amount) end) -- Send a tipjar's donation data to a single player local function sendJarData(tipjar, ply) if table.Count(tipjar.activeDonations) > 0 then net.Start("DarkRP_TipJarUpdate") net.WriteEntity(tipjar) for p, amnt in pairs(tipjar.activeDonations) do net.WriteEntity(p) net.WriteUInt(amnt, 32) end net.Send(ply) end if table.Count(tipjar.madeDonations) > 0 then net.Start("DarkRP_TipJarDonatedList") net.WriteEntity(tipjar) net.WriteUInt(#tipjar.madeDonations, 8) for _, donation in ipairs(tipjar.madeDonations) do net.WriteString(donation.name) net.WriteUInt(donation.amount, 32) end net.Send(ply) end end function DarkRP.hooks:tipjarUpdateActiveDonation(tipjar, ply, amount, old) -- Player is new to this jar, send all data if not old then sendJarData(tipjar, ply) end -- Tell the rest of the player's active donation local updateTargets = RecipientFilter() for p, _ in pairs(tipjar.activeDonations) do updateTargets:AddPlayer(p) end updateTargets:RemovePlayer(ply) net.Start("DarkRP_TipJarUpdate") net.WriteEntity(tipjar) net.WriteEntity(ply) net.WriteUInt(amount, 32) net.Send(updateTargets) end net.Receive("DarkRP_TipJarExit", function(_, ply) local tipjar = net.ReadEntity() if not IsValid(tipjar) then return end tipjar:ExitActiveDonation(ply) end) function DarkRP.hooks:tipjarExitActiveDonation(tipjar, ply, old) local updateTargets = RecipientFilter() for p, _ in pairs(tipjar.activeDonations) do updateTargets:AddPlayer(p) end net.Start("DarkRP_TipJarExit") net.WriteEntity(tipjar) net.WriteEntity(ply) net.Send(updateTargets) end
mit
Benjarobbi/UzzBott
plugins/gnuplot.lua
622
1813
--[[ * Gnuplot plugin by psykomantis * dependencies: * - gnuplot 5.00 * - libgd2-xpm-dev (on Debian distr) for more info visit: https://libgd.github.io/pages/faq.html * ]] -- Gnuplot needs absolute path for the plot, so i run some commands to find where we are local outputFile = io.popen("pwd","r") io.input(outputFile) local _pwd = io.read("*line") io.close(outputFile) local _absolutePlotPath = _pwd .. "/data/plot.png" local _scriptPath = "./data/gnuplotScript.gpl" do local function gnuplot(msg, fun) local receiver = get_receiver(msg) -- We generate the plot commands local formattedString = [[ set grid set terminal png set output "]] .. _absolutePlotPath .. [[" plot ]] .. fun local file = io.open(_scriptPath,"w"); file:write(formattedString) file:close() os.execute("gnuplot " .. _scriptPath) os.remove (_scriptPath) return _send_photo(receiver, _absolutePlotPath) end -- Check all dependencies before executing local function checkDependencies() local status = os.execute("gnuplot -h") if(status==true) then status = os.execute("gnuplot -e 'set terminal png'") if(status == true) then return 0 -- OK ready to go! else return 1 -- missing libgd2-xpm-dev end else return 2 -- missing gnuplot end end local function run(msg, matches) local status = checkDependencies() if(status == 0) then return gnuplot(msg,matches[1]) elseif(status == 1) then return "It seems that this bot miss a dependency :/" else return "It seems that this bot doesn't have gnuplot :/" end end return { description = "use gnuplot through telegram, only plot single variable function", usage = "!gnuplot [single variable function]", patterns = {"^!gnuplot (.+)$"}, run = run } end
gpl-2.0
JocysCom/TextToSpeech
TextToSpeech/WoW/JocysCom-TextToSpeech-WoW/JocysCom-TextToSpeech-WoW.lua
1
80186
-- Extract current TOC Version (Interface) in chat window: /run print((select(4, GetBuildInfo()))); -- Show errors (1) or hide errors (0): /console scriptErrors 1 -- Show or hide frame names: /fstack -- Show events: /eventtrace -- Blizzard > Settings > Game Settings > Game Name > [v] Additional command line arguments > [-console] > WoW Game > "`" > [exportInterfaceFiles code] or [exportInterfaceFiles art] -- #:\Program Files (x86)\World of Warcraft\_retail_\WTF\Account\ACCOUNTNAME\SavedVariables.lua - Blizzard's saved variables. -- #:\Program Files (x86)\World of Warcraft\_retail_WTF\Account\ACCOUNTNAME\SavedVariables\JocysCom-TextToSpeech-WoW.lua - Per-account settings for each individual AddOn. -- #:\Program Files (x86)\World of Warcraft\_retail_WTF\Account\ACCOUNTNAME\RealmName\CharacterName\JocysCom-TextToSpeech-WoW.lua - Per-character settings for each individual AddOn. -- Debug mode true(enabled) or false(disabled). local DebugEnabled = false -- version, build, date, tocversion = GetBuildInfo() local version, build, date, tocversion = GetBuildInfo() local classic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC or WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC) -- Set variables. local addonVersion = "Jocys.com Text to Speech World of Warcraft Addon 10.0.2.1 ( 2022-11-22 )" local addonName = "JocysCom-TextToSpeech-WoW" local addonPrefix = "JocysComTTS" -- Message prefix for Monitor to find pixel line. local messagePrefixPixels = "|cff220000·|r|cff002200·|r|cff000022·|r|cff220000·|r|cff002200·|r|cff000022·|r" local unitName = UnitName("player") -- GetUnitName() local customName = UnitName("player") local unitClass = UnitClass("player") local lastArg = nil local dashIndex = nil local hashIndex = nil local messageDoNotDisturb = "Please wait... NPC dialog window is open and text-to-speech is enabled." local messageStop = "<message command=\"stop\" />" local macroName = "NPCSaveTTSMacro" local macroIcon = "Spell_Holy_PrayerofSpirit" local macroMessage = "/targetfriend" local pixelX = 0 local pixelY = 0 local chatMessageLimit = 240 local NPCNamesTable = {} local messageTable = {} local messageInterval = 0.2 local messageChanged = math.random(10, 80) local locale = GetLocale() locale = locale:gsub("(..)(..)", "%1" .. "-" .. "%2") local function Clear(v) if v == nil or v == "" then return "" else v = string.gsub(v, "&", " and ") v = string.gsub(v, "\"", "") return v end end -- Create attribute name="value". local function Attribute(n, v) if v == nil or v == "" then return "", "" else return " " .. n .. "=\"" .. Clear(v) .. "\"", "" end end -- Gender() local function Gender(v) if v == nil or v == "" then return "" else if v == 2 then return "Male" elseif v == 3 then return "Female" else return "Neutral" end end end function JocysCom_CreateOrUpdateMacro() -- Do nothing if player is in combat. if InCombatLockdown() then if DebugEnabled then JocysCom_DebugPrint("Lockdown", InCombatLockdown()) end return end -- Create macro if doesn't exist and slot is available. if GetMacroIndexByName(macroName) == 0 then local numglobal, numperchar = GetNumMacros() if numperchar < 17 then CreateMacro(macroName, macroIcon, macroMessage, 1) if GetMacroIndexByName(macroName) > 0 then print("|cffffff00" .. macroName .. "|r |cff88aaff in|r |cffffff00" .. unitName .. " Specific Macros|r |cff88aaffcreated.|r") end end end -- Update macro if exists. if GetMacroIndexByName(macroName) > 0 then -- Set macro text and icon. if #NPCNamesTable > 0 then macroIcon = "Spell_Holy_PrayerofSpirit" macroMessage = "" -- Add NPC names from table to macro. for i, n in pairs(NPCNamesTable) do macroMessage = macroMessage .. "/target " .. n .. "\n" end -- Add at the end of macro. macroMessage = macroMessage .. "/JocysComTTS Macro Reset\n" else macroIcon = "Spell_Holy_DivineSpirit" macroMessage = "/targetfriend" if DebugEnabled then JocysCom_DebugPrint("NPCNameListEmpty") end end -- Edit macro. EditMacro(GetMacroIndexByName(macroName), macroName, macroIcon, macroMessage, 1) end end -- Add NPC name to NPCNamesTable (max 9). function JocysCom_AddNPCNameToTable(name) -- Do not add NPC name if it is already in NPCNamesTable. if #NPCNamesTable > 0 then for i, n in pairs(NPCNamesTable) do if string.find(n, name) then if DebugEnabled then JocysCom_DebugPrint("NPCNameListExist", name) end return end end end -- Add NPC name to NPCNamesTable. table.insert(NPCNamesTable, name) -- Remove names exceeding max (9) number. if #NPCNamesTable > 9 then repeat table.remove(NPCNamesTable, 1) until (#NPCNamesTable < 10) end if DebugEnabled then JocysCom_DebugPrint("NPCNameListAdded", name, NPCNamesTable) end JocysCom_CreateOrUpdateMacro() end -- Remove NPC names from NPCNamesTable. function JocysCom_RemoveNPCNamesFromTable() NPCNamesTable = {} JocysCom_CreateOrUpdateMacro() end local function JocysCom_AddonCommands(msg, editbox) -- pattern matching skips leading whitespace and whitespace between cmd and args. -- any whitespace at end of args is retained local _, _, cmd, args = string.find(msg, "%s?(%w+)%s?(.*)") if cmd == "Macro" and args == "Reset" then JocysCom_RemoveNPCNamesFromTable() elseif cmd == "Debug" then DebugEnabled = not DebugEnabled JocysCom_SaveTocFileSettings() if DebugEnabled then JocysCom_DebugEnabledSettings() print("|cffff0000JocysComTTS Debug: [Enabled]|r") else JocysCom_DebugEnabledSettings() print("|cff00ff00JocysComTTS Debug: [Disabled]|r") end else -- If cmd is nil, display help message. print("|cff77ccff------------------------------------------------------------------------------------|r") print("|cff77ccffJocys.com Text to Speech addon's slash commands and macros|r") print("|cff77ccff------------------------------------------------------------------------------------|r") print("|cffffff55/JocysComTTS|r -- Show this help") print("|cffffff55/JocysComTTS Debug|r -- Debug enable / disable") print("|cffffff55/JocysComTTS Macro Reset|r -- Reset |cff40fb40" .. macroName .. "|r") print("Macro: |cffffff55/run JocysCom_SaveNPCAs(\"Orc\")|r -- Save in TTS Monitor as \"effect\" |r") print("|cff77ccff------------------------------------------------------------------------------------|r") end end SLASH_JocysComTTS1 = '/JocysComTTS' SlashCmdList["JocysComTTS"] = JocysCom_AddonCommands function JocysCom_DebugEnabledSettings() if DebugEnabled then JocysCom_ClipboardMessageFrame:Show() else JocysCom_ClipboardMessageFrame:Hide() end end -- Set text. function JocysCom_AddonTXT_EN() -- OptionsFrame title. JocysCom_OptionsFrame.TitleText:SetText(addonVersion) -- CheckButtons (Options) text. JocysCom_ColorMessageCheckButton.text:SetText("|cff808080 Enable|r |cffffffffDisplay|r|cff808080 mode. In|r |cff77ccffTTS Monitor > [Options] Tab > [Monitor: Display] Tab > [Checked] Enable|r|cff808080.|r") JocysCom_NetworkMessageCheckButton.text:SetText("|cff808080 Enable|r |cffffffffNetwork|r|cff808080 mode. In|r |cff77ccffTTS Monitor > [Options] Tab > [Monitor: Network] Tab > [Checked] Enable|r|cff808080.|r") JocysCom_ColorMessagePixelYFontString:SetText("|cff808080 [LEFT] and [TOP] position of color pixel line for|r |cff77ccffMonitor|r|cff808080. Default values [0] and [0].|r") JocysCom_LockCheckButton.text:SetText("|cff808080 Lock frame with |cffffffff[Options]|r |cff808080and|r |cffffffff[Stop]|r |cff808080buttons. Grab frame by clicking on dark background around buttons.|r") JocysCom_MenuCheckButton.text:SetText("|cff808080 [Checked] show menu on right side of |cffffffff[Options]|r |cff808080button. [Unchecked] show menu on left side.|r") JocysCom_SaveCheckButton.text:SetText("|cff808080 Save \"target\" and \"mouseover\" NPC's name, gender and type in|r |cffffffffMonitor|r|cff808080. Default: [Checked]|r"); JocysCom_LanguageQuestCheckButton.text:SetText("|cff808080 Send-force quest language=\"|cffffffff" .. locale .. "|r|cff808080\" in|r |cffffffffMonitor|r|cff808080.|r"); JocysCom_LanguageChatCheckButton.text:SetText("|cff808080 Send-force chat language=\"|cffffffff" .. locale .. "|r|cff808080\" in|r |cffffffffMonitor|r|cff808080.|r"); --JocysCom_FilterCheckButton.text:SetText("|cff808080 Hide detailed information about addon|r |cffffffff<messages>|r |cff808080in chat window. Default: [Unchecked]|r") -- Font Strings. JocysCom_DialogueScrollFrame_FontString:SetText("When mouse pointer is over this frame...\n\nSCROLL UP will START SPEECH\n\nSCROLL DOWN will STOP SPEECH\n\nClose \"Options\" to make it transparent") JocysCom_DescriptionFrameFontString:SetText("|cff808080 All text-to-speech options (voices, pitch, rate, effects, etc.) are in |cff77ccffJocys.Com Text to Speech Monitor|r.\n\nHow it works: When you open NPC dialogue window or receive chat message, |cff77ccffWoW Addon|r creates special message. If |cffffffffDisplay|r mode is selected, |cff77ccffWoW Addon|r converts message into line of coloured pixels and shows it on your display. If |cffffffffNetwork|r mode is selected, |cff77ccffWoW Addon|r sends special addon message to your character. Message can include dialogue text, character name, effect name, etc.. Then, |cff77ccffTTS Monitor|r (which must be running in background) picks-up this message from your display or network traffic and reads it with text-to-speech voice. You can use free text-to-speech voices by Microsoft or you can download and install additional and better text-to-speech voices from |cff77ccffIvona.com|r website. Good voices are English-British \"Amy\" and \"Brian\". English-American \"Salli\" and \"Joey\" are not bad too. For more help and to download or update |cff77ccffWoW Addon|r with |cff77ccffTTS Monitor|r, visit \"Software\" section of |cff77ccffJocys.com|r website.|r") JocysCom_ReplaceNameFontString:SetText("|cff808080 Here you can change your name for text to speech from |cff00ff00" .. unitName .. "|r to something else.|r") JocysCom_MessageForMonitorFrameFontString:SetText("|cff808080 Latest message for|r |cff77ccffJocys.Com Text to Speech Monitor|r |cff808080... it must be runninng in background:|r") end -- Unlock frames. function JocysCom_OptionsFrame_OnShow() JocysCom_StopButtonFrame_Texture:SetColorTexture(0, 0, 0, 0.8) --JocysCom_DialogueScrollFrame:EnableMouse(true) JocysCom_DialogueScrollFrame_Texture:SetColorTexture(0, 0, 0, 0.8) JocysCom_DialogueScrollFrame_FontString:Show() --JocysCom_DialogueScrollFrameResizeButton:Show() end -- Lock frames. function JocysCom_OptionsFrame_OnHide() if string.len(JocysCom_ReplaceNameEditBox:GetText()) < 2 then JocysCom_ReplaceNameEditBox:SetText(unitName) end JocysCom_StopButtonFrame_Texture:SetColorTexture(0, 0, 0, 0) JocysCom_DialogueScrollFrame:EnableMouse(false) JocysCom_DialogueScrollFrame_Texture:SetColorTexture(0, 0, 0, 0) JocysCom_DialogueScrollFrame_FontString:Hide() JocysCom_DialogueScrollFrameResizeButton:Hide() JocysCom_ClipboardMessageEditBoxSetFocus() end -- MessageStop function. function JocysCom_SendChatMessageStop(group) -- button = button (mouse wheel down) or check-box. -- Add group attribute if goup exists. local messageStop = "<message command=\"stop\"" .. Attribute("group", group) .. " />" JocysCom_SendMessage(messageStop, true) if DebugEnabled and JocysCom_NetworkMessageCheckButton:GetChecked() then print(JocysCom_MessageAddColors(messageStop)) end end -- Register or unregister events. function JocysCom_SetEvent(checked, ...) if not JocysCom_NetworkMessageCheckButton:GetChecked() and not JocysCom_ColorMessageCheckButton:GetChecked() then checked = false end if checked then for i,v in pairs({...}) do JocysCom_OptionsFrame:RegisterEvent(v) if DebugEnabled then JocysCom_DebugPrint("Registered", v) end end else for i,v in pairs({...}) do JocysCom_OptionsFrame:UnregisterEvent(v) if DebugEnabled then JocysCom_DebugPrint("Unregistered", v) end end end end -- Check and set text. local function nilCheck(v, d) if v == nil then return "" elseif d ~= nil then return v .. d else return v end end -- Load saved event settings. function JocysCom_LoadEventSettings() -- QUESTS and MAIL. GOSSIP_* (open or close frame), QUEST_* (quest), ITEM_* (books, scrolls, plaques, gravestones, mail). JocysCom_SetEvent(JocysCom_QuestCB, "GOSSIP_SHOW", "QUEST_GREETING", "QUEST_DETAIL", "QUEST_PROGRESS", "QUEST_COMPLETE", "QUEST_LOG_UPDATE", "ITEM_TEXT_READY", "GOSSIP_CLOSED","MAIL_SHOW", "MAIL_CLOSED") -- MONSTER. JocysCom_SetEvent(JocysCom_MonsterCB, "CHAT_MSG_MONSTER_EMOTE", "CHAT_MSG_MONSTER_PARTY", "CHAT_MSG_MONSTER_SAY", "CHAT_MSG_MONSTER_WHISPER", "CHAT_MSG_MONSTER_YELL") JocysCom_SetEvent(JocysCom_ChannelCB, "CHAT_MSG_CHANNEL") -- EMOTE. JocysCom_SetEvent(JocysCom_EmoteCB, "CHAT_MSG_EMOTE", "CHAT_MSG_TEXT_EMOTE") -- WHISPER. JocysCom_SetEvent(JocysCom_WhisperCB, "CHAT_MSG_WHISPER", "CHAT_MSG_WHISPER_INFORM", "CHAT_MSG_BN_WHISPER", "CHAT_MSG_BN_WHISPER_INFORM") -- SAY. JocysCom_SetEvent(JocysCom_SayCB, "CHAT_MSG_SAY") -- YELL. JocysCom_SetEvent(JocysCom_YellCB, "CHAT_MSG_YELL") -- PARTY. JocysCom_SetEvent(JocysCom_PartyLCB, "CHAT_MSG_PARTY_LEADER") JocysCom_SetEvent(JocysCom_PartyCB, "CHAT_MSG_PARTY") -- GUILD JocysCom_SetEvent(JocysCom_OfficerCB, "CHAT_MSG_OFFICER") JocysCom_SetEvent(JocysCom_GuildCB, "CHAT_MSG_GUILD", "CHAT_MSG_GUILD_ACHIEVEMENT") -- RAID JocysCom_SetEvent(JocysCom_RaidLCB, "CHAT_MSG_RAID_LEADER", "CHAT_MSG_RAID_WARNING") JocysCom_SetEvent(JocysCom_RaidCB, "CHAT_MSG_RAID") -- INSTANCE. JocysCom_SetEvent(JocysCom_InstanceLCB, "CHAT_MSG_INSTANCE_CHAT_LEADER") JocysCom_SetEvent(JocysCom_InstanceCB, "CHAT_MSG_INSTANCE_CHAT") -- Save unit name, gender and type. JocysCom_SetEvent(JocysCom_SaveCB, "UPDATE_MOUSEOVER_UNIT") JocysCom_SetEvent(JocysCom_SaveCB, "PLAYER_TARGET_CHANGED") -- if DebugEnabled then JocysCom_OptionsFrame:RegisterAllEvents() end end -- Register events. function JocysCom_RegisterEvents() if classic then QuestLogDetailScrollFrame:SetScript("OnShow", JocysCom_AttachAndShowFrames) end C_ChatInfo.RegisterAddonMessagePrefix(addonPrefix) -- Addon message prefix. JocysCom_OptionsFrame:SetScript("OnEvent", function(...) JocysCom_OptionsFrame_OnEvent(false, ...) end) -- Register events on JocysCom_OptionsFrame --- JocysCom_OptionsFrame_OnEvent(playButton, ...). JocysCom_OptionsFrame:RegisterEvent("ADDON_LOADED") -- Load all addon settings on this event. JocysCom_OptionsFrame:RegisterEvent("PLAYER_ENTERING_WORLD") -- Create or edit macro on this event. JocysCom_OptionsFrame:RegisterEvent("PLAYER_LOGOUT") end function JocysCom_OptionsFrame_OnEvent(button, self, ...) local group = "" local name = nil local sex = nil -- UnitSex(name) -- UnitSex("npc") local text = nil local speakMessage = nil local nameIntro = false local soundIntro = false local soundEffect = nil -- event, text, playerName, languageName, channelName, playerName2, specialFlags, zoneChannelID, channelIndex, channelBaseName, unused, lineID, guid, bnSenderID, isMobile, isSubtitle, hideSenderInLetterbox, supressRaidIcons = ... local event, text, playerName, languageName, channelName, playerName2, specialFlags, zoneChannelID, channelIndex, channelBaseName, unused, lineID, guid, bnSenderID = ... -- Ignore events. -- if string.find(event, "COMBAT") ~= nil or string.find(event, "SPELL") ~= nil or string.find(event, "COMPANION") ~= nil or string.find(event, "PET") ~= nil or string.find(event, "EXHAUSTION") ~= nil or string.find(event, "PLATE") ~= nil or string.find(event, "AURA") ~= nil or string.find(event, "POWER") ~= nil or string.find(event, "TICKET") ~= nil or string.find(event, "HEALTH") ~= nil or string.find(event, "FLAGS") ~= nil or string.find(event, "ACTIONBAR") ~= nil or string.find(event, "MOUSEOVER") ~= nil or string.find(event, "TARGET") ~= nil or string.find(event, "MODEL") ~= nil or string.find(event, "INVENTORY") ~= nil or string.find(event, "CURSOR") ~= nil or string.find(event, "ABSORB") ~= nil or string.find(event, "CHALLENGE") ~= nil or string.find(event, "TRADESKILLS") ~= nil or string.find(event, "TOYS") ~= nil or string.find(event, "PORTRAIT") ~= nil or string.find(event, "NAME_UPDATE") ~= nil or string.find(event, "WATCH_LIST") ~= nil then return end if event == "ADDON_LOADED" and text ~= addonName then return end -- Ignore other addons. if event == "CHAT_MSG_WHISPER" and JocysCom_RemoveRealmName(playerName) == unitName then return end -- Don't process your own whispers twice. if string.find(tostring(text), "<message") ~= nil then return end -- Don't proceed messages with <message> tags and your own incoming whispers. -- Print event details. if DebugEnabled then JocysCom_DebugPrint("EventDetails", {...}) end -- Attach and show frames. if event == "ADDON_LOADED" or event == "GOSSIP_SHOW" or event == "QUEST_GREETING" or event == "QUEST_DETAIL" or event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_LOG_UPDATE" or event == "MAIL_SHOW" or event == "ITEM_TEXT_READY" then -- or event == "QUEST_GREETING" JocysCom_AttachAndShowFrames() end -- Events. if event == "ADDON_LOADED" and text == addonName then JocysCom_LoadTocFileSettings() -- Load addon settings. JocysCom_DebugEnabledSettings() -- Show / Hide clipboard EditBox and other settings. JocysCom_MenuCheckButton_OnClick() -- Set MiniMenuFrame on left or right side. JocysCom_OptionsFrame_OnHide() -- Set DialogueScrollFrame and make it transparent. JocysCom_AddonTXT_EN() -- Set text of elements. JocysCom_LoadEventSettings() -- Register or unregister events. if JocysCom_ColorMessageCheckButton:GetChecked() then JocysCom_SendMessageTimer() end JocysCom_DialogueScrollFrame:Show() JocysCom_DialogueMiniFrame:Show() if DebugEnabled then JocysCom_DebugPrint("GameVersion") end return elseif event == "PLAYER_ENTERING_WORLD" then JocysCom_CreateOrUpdateMacro() return elseif event == "PLAYER_LOGOUT" then JocysCom_SaveTocFileSettings() return elseif event == "UPDATE_MOUSEOVER_UNIT" then -- if GossipFrame:IsVisible() or QuestFrame:IsVisible() or ItemTextFrame:IsVisible() or MailFrame:IsVisible() or (not classic and QuestMapFrame:IsVisible()) or (classic and QuestLogFrame:IsVisible()) then return end JocysCom_SaveNPC("mouseover") return elseif event == "PLAYER_TARGET_CHANGED" then JocysCom_SaveNPC("target") return elseif event == "GOSSIP_CLOSED" or event == "MAIL_CLOSED" then return --QUEST events. elseif event == "MAIL_SHOW_JOCYS" then local packageIcon, stationeryIcon, sender, subject = GetInboxHeaderInfo(InboxFrame.openMailID) -- packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply, isGM = GetInboxHeaderInfo(InboxFrame.openMailID) local bodyText = GetInboxText(InboxFrame.openMailID) -- bodyText, texture, isTakeable, isInvoice = GetInboxText(InboxFrame.openMailID) group = "Quest" name = sender speakMessage = nilCheck(sender, ". ") .. nilCheck(subject, ". ") .. nilCheck(bodyText, ". ") nameIntro = JocysCom_NameQuestCheckButton:GetChecked() soundIntro = JocysCom_SoundQuestCheckButton:GetChecked() elseif event == "QUEST_LOG_UPDATE_JOCYS" then -- local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle() local questDescription, questObjectives = GetQuestLogQuestText() group = "Quest" name = "Quest Log" local title = nil if classic then title = JocysCom_TitlesCheckButton:GetChecked() and QuestLogQuestTitle:GetText() or nil else title = JocysCom_TitlesCheckButton:GetChecked() and QuestInfoTitleHeader:GetText() or nil end speakMessage = nilCheck(title, ". ") .. nilCheck(questObjectives, ". ") .. nilCheck(QuestInfoDescriptionHeader:GetText(), ". ") .. questDescription soundIntro = JocysCom_SoundQuestCheckButton:GetChecked() elseif event == "GOSSIP_SHOW" or event == "QUEST_GREETING" or event == "QUEST_DETAIL" or event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "ITEM_TEXT_READY" then if event == "ITEM_TEXT_READY" then speakMessage = ItemTextGetText() elseif event == "GOSSIP_SHOW" then if classic then speakMessage = GetGossipText() else speakMessage = C_GossipInfo.GetText() end -- print("NPCNAME: " .. _G.GossipFrameNpcNameText:GetText()); elseif event == "QUEST_GREETING" then speakMessage = GetGreetingText() elseif event == "QUEST_PROGRESS" then local title = JocysCom_TitlesCheckButton:GetChecked() and QuestProgressTitleText:GetText() or nil speakMessage = nilCheck(title, ". ") .. GetProgressText() elseif event == "QUEST_COMPLETE" then local title = JocysCom_TitlesCheckButton:GetChecked() and QuestInfoTitleHeader:GetText() or nil speakMessage = nilCheck(title, ". ") .. GetRewardText() elseif event == "QUEST_DETAIL" then local title = JocysCom_TitlesCheckButton:GetChecked() and QuestInfoTitleHeader:GetText() or nil local objective = JocysCom_ObjectivesCheckButton:GetChecked() and nilCheck(QuestInfoObjectivesHeader:GetText(), ". ") .. GetObjectiveText() or nil speakMessage = nilCheck(title, ". ") .. GetQuestText() .. " " .. nilCheck(objective, ". ") -- print("NPCNAME: " .. _G.QuestFrameNpcNameText:GetText()) end group = "Quest" name = UnitName("npc") sex = UnitSex("npc") soundEffect = UnitCreatureType("npc") -- Set sound effect (Beast, Dragonkin, Demon, Elemental, Giant, Undead, Humanoid, Critter, Mechanical, Not specified, Totem, Non-combat Pet, Gas Cloud). nameIntro = JocysCom_NameQuestCheckButton:GetChecked() soundIntro = JocysCom_SoundQuestCheckButton:GetChecked() -- MONSTER. elseif string.find(event, "MSG_MONSTER") ~= nil then -- don't proceed repetitive NPC messages by the same NPC. if (lastArg == text .. playerName) then if DebugEnabled then print("Repetitive message ignored.") end return else lastArg = text .. playerName end -- Add NPC name to NPCNamesTable. JocysCom_AddNPCNameToTable(playerName) group = "Monster" name = playerName if event == "CHAT_MSG_MONSTER_EMOTE" or JocysCom_NameMonsterCheckButton:GetChecked() then nameIntro = true end soundIntro = JocysCom_SoundMonsterCheckButton:GetChecked() -- WHISPER. elseif event == "CHAT_MSG_WHISPER" or event == "CHAT_MSG_WHISPER_INFORM" then name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) group = "Whisper" soundIntro = JocysCom_SoundWhisperCheckButton:GetChecked() nameIntro = JocysCom_NameWhisperCheckButton:GetChecked() elseif event == "CHAT_MSG_BN_WHISPER_INFORM" then name = unitName sex = UnitSex(unitName) -- sex = select(5, GetPlayerInfoByGUID(guid)) group = "Whisper" soundIntro = JocysCom_SoundWhisperCheckButton:GetChecked() nameIntro = JocysCom_NameWhisperCheckButton:GetChecked() elseif event == "CHAT_MSG_BN_WHISPER" then --or event == "CHAT_MSG_BN_CONVERSATION" local nameType = "name" -- bnSenderID = presenceID -- local presenceID, accountName, battleTag, isBattleTagPresence, characterName, bnetIDGameAccount, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR, isReferAFriend, canSummonFriend = BNGetFriendInfoByID(bnSenderID) local presenceID, accountName, battleTag, isBattleTagPresence, characterName = BNGetFriendInfoByID(bnSenderID) -- Select if not nil priority: characterName > battleTag > accountName if characterName ~= nil then name = JocysCom_RemoveRealmName(characterName) nameType = "characterName" sex = UnitSex(name) elseif battleTag ~= nil then name = tostring(battleTag) nameType = "battleTag" -- remove #0000 from batleTag if string.find(name, "#") ~= nil then local hashIndex = string.find(name, "#") name = string.sub(name, 1, hashIndex - 1) end -- elseif accountName ~= nil then -- name = accountName -- if DebugEnabled then print("BN_WHISPER accountName: " .. tostring(name)) end else name = "Your friend" end if DebugEnabled then JocysCom_DebugPrint("BNGetFriendInfoByID", bnSenderID, presenceID, accountName, battleTag, nameType, characterName) end group = "Whisper" soundIntro = JocysCom_SoundWhisperCheckButton:GetChecked() nameIntro = JocysCom_NameWhisperCheckButton:GetChecked() elseif event == "CHAT_MSG_EMOTE" or event == "CHAT_MSG_TEXT_EMOTE" then group = "Emote" name = JocysCom_RemoveRealmName(playerName) -- local locClass, engClass, locRace, engRace, gender, name, server = GetPlayerInfoByGUID(guid) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = false soundIntro = JocysCom_SoundEmoteCheckButton:GetChecked() elseif event == "CHAT_MSG_CHANNEL" then group = "Say" name = JocysCom_RemoveRealmName(playerName) -- print("1. " .. tostring(GetPlayerInfoByGUID(guid))) -- print("2. " .. tostring(UnitSex(name))) -- sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameChannelCheckButton:GetChecked() soundIntro = JocysCom_SoundChannelCheckButton:GetChecked() elseif event == "CHAT_MSG_SAY" then group = "Say" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameSayCheckButton:GetChecked() soundIntro = JocysCom_SoundSayCheckButton:GetChecked() elseif event == "CHAT_MSG_YELL" then group = "Yell" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameYellCheckButton:GetChecked() soundIntro = JocysCom_SoundYellCheckButton:GetChecked() elseif event == "CHAT_MSG_GUILD" then group = "Guild" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameGuildCheckButton:GetChecked() soundIntro = JocysCom_SoundGuildCheckButton:GetChecked() elseif event == "CHAT_MSG_OFFICER" then group = "Officer" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameOfficerCheckButton:GetChecked() soundIntro = JocysCom_SoundOfficerCheckButton:GetChecked() elseif event == "CHAT_MSG_RAID" then group = "Raid" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameRaidCheckButton:GetChecked() soundIntro = JocysCom_SoundRaidCheckButton:GetChecked() elseif event == "CHAT_MSG_RAID_LEADER" or event == "CHAT_MSG_RAID_WARNING" then group = "RaidLeader" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameRaidLeaderCheckButton:GetChecked() soundIntro = JocysCom_SoundRaidLeaderCheckButton:GetChecked() elseif event == "CHAT_MSG_PARTY" then group = "Party" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NamePartyCheckButton:GetChecked() soundIntro = JocysCom_SoundPartyCheckButton:GetChecked() elseif event == "CHAT_MSG_PARTY_LEADER" then group = "PartyLeader" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NamePartyLeaderCheckButton:GetChecked() soundIntro = JocysCom_SoundPartyLeaderCheckButton:GetChecked() elseif event == "CHAT_MSG_INSTANCE_CHAT" then group = "Instance" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameInstanceCheckButton:GetChecked() soundIntro = JocysCom_SoundInstanceCheckButton:GetChecked() elseif event == "CHAT_MSG_INSTANCE_CHAT_LEADER" then group = "InstanceLeader" name = JocysCom_RemoveRealmName(playerName) sex = select(5, GetPlayerInfoByGUID(guid)) nameIntro = JocysCom_NameInstanceLeaderCheckButton:GetChecked() soundIntro = JocysCom_SoundInstanceLeaderCheckButton:GetChecked() else return end -- If event CHAT. if string.find(event, "CHAT") ~= nil then speakMessage = text end if DebugEnabled then JocysCom_DebugPrint("CHAT", event, name, sex, group, soundIntro, soundEffect, speakMessage) end -- Add name intro to text. if nameIntro then local introType = "" -- Set "whispers", "says" or "yells". if group == "Whisper" then introType = " whispers. " elseif group == "Yell" then introType = " yells. " else introType = " says. " end -- Add "***Leader" before name. Replace "***Leader" to "*** leader ". local messageLeader = "" if string.find(group, "Leader") ~= nil then messageLeader = string.gsub(group, "Leader", " leader ") end speakMessage = messageLeader .. name .. " " .. introType .. speakMessage end -- On Quest event or Quest play. if group == "Quest" then -- Don't start automatic play if StartOnOpen[0] and Play[0] -- command "play" is not from button-mouse. if not JocysCom_StartOnOpenCheckButton:GetChecked() and not button then return end -- If StopOnClose[1] remove all old messages and play new message instantly. if JocysCom_StopOnCloseCheckButton:GetChecked() then JocysCom_SendChatMessageStop() end end -- Send message. JocysCom_SpeakMessage(event, speakMessage, name, sex, group, soundIntro, soundEffect) end -- Remove realm name from name. function JocysCom_RemoveRealmName(name) if name ~= nil and string.find(name, "-") ~= nil then name = string.sub(name, 1, string.find(name, "-") - 1) end return name end function JocysCom_Replace(m) m = m .. " " -- Remove HTML <> tags and text between them. if string.find(m, "HTML") ~= nil then m = string.gsub(m, "<.->", "") m = string.gsub(m, "\"", "") end -- Remove colors / class / race. if string.find(m, "|") ~= nil then m = string.gsub(m, "|+", "|") -- Remove colors. m = string.gsub(m, "|c........", "") m = string.gsub(m, "|r", "") -- Remove hyperlinks. m = string.gsub(m, "|H.-|h", "") m = string.gsub(m, "|h", "") -- Replace brackets. m = string.gsub(m, "%[", " \"") m = string.gsub(m, "%]", "\" ") -- Fix class / race. m = string.gsub(m, "|[%d]+.[%d]+%((.-)%)", "%1") end -- Remove / Replace. m = string.gsub(m, "&", " and ") m = string.gsub(m, "%c(%u)", ".%1") m = string.gsub(m, "%c", " ") m = string.gsub(m, "%s", " ") m = string.gsub(m, "%%s ", " ") m = string.gsub(m, "[ ]+", " ") m = string.gsub(m, "%!+", "!") m = string.gsub(m, "%?+", "?") m = string.gsub(m, " %.", ".") m = string.gsub(m, "%.+", ".") m = string.gsub(m, "%!%.", "!") m = string.gsub(m, "%?%.", "?") m = string.gsub(m, "%?%-", "?") m = string.gsub(m, "%?%!%?", "?!") m = string.gsub(m, "%!%?%!", "?!") m = string.gsub(m, "%!%?", "?!") m = string.gsub(m, "%!", "! ") m = string.gsub(m, "%?", "? ") m = string.gsub(m, " %!", "!") m = string.gsub(m, "^%.+", "") m = string.gsub(m, ">%.", ".>") m = string.gsub(m, "%.+", ". ") m = string.gsub(m, "<", " [comment] ") m = string.gsub(m, ">", " [/comment] ") m = string.gsub(m, "[ ]+", " ") m = string.gsub(m, "lvl", "level") return m end --Send message. function JocysCom_SendMessage(message, messageOptions) if JocysCom_NetworkMessageCheckButton:GetChecked() then C_ChatInfo.SendAddonMessage(addonPrefix, message, "WHISPER", unitName) if messageOptions then JocysCom_MessageForOptionsEditBox(message) end -- Fill EditBox in Options window. else message = string.gsub(message, "<message ", "<message position=\"" .. pixelX .. "," .. pixelY .. "\" ") -- Add pixel line position (optional). table.insert(messageTable, message) JocysCom_ColorMessagesCountFontString:SetText(#messageTable) if DebugEnabled then JocysCom_DebugPrint("MessageAdded", #messageTable, messageChanged, message) end end end --Messages. function JocysCom_SpeakMessage(event, speakMessage, name, sex, group, soundIntro, soundEffect) if speakMessage == nil then return end -- Replace player name in speakMessage. local newUnitName = JocysCom_ReplaceNameEditBox:GetText() if string.len(newUnitName) > 1 and newUnitName ~= unitName then customName = newUnitName speakMessage = string.gsub(speakMessage, unitName, newUnitName) else customName = unitName end -- Send player Name, Class and custom Name to Monitor. if string.find(speakMessage, customName) ~= nil or string.find(string.lower(speakMessage), string.lower(unitClass)) ~= nil then local messagePlayer = "<message command=\"player\" name=\"" .. unitName .. ", " .. customName .. ", " .. unitClass .. "\" />" -- Send message and do not fill EditBox in Options window. JocysCom_SendMessage(messagePlayer, false) end --Replace text in message. speakMessage = JocysCom_Replace(speakMessage) -- Send message (false = do not fill EditBox in Options window). if soundIntro and group ~= nil then JocysCom_SendMessage("<message command=\"sound\"" .. Attribute("group", group) .. " />", false) end -- Set locale. --"frFR": French (France) --"deDE": German (Germany) --"enGB": English (Great Britain) if returned, can substitute 'enUS' for consistancy --"enUS": English (America) --"itIT": Italian (Italy) --"koKR": Korean (Korea) RTL - right-to-left --"zhCN": Chinese (China) (simplified) implemented LTR left-to-right in WoW --"zhTW": Chinese (Taiwan) (traditional) implemented LTR left-to-right in WoW --"ruRU": Russian (Russia) --"esES": Spanish (Spain) --"esMX": Spanish (Mexico) --"ptBR": Portuguese (Brazil) local localeAttribute = nil if group == "Quest" and JocysCom_LanguageQuestCheckButton:GetChecked() or group == "Monster" and JocysCom_LanguageQuestCheckButton:GetChecked() or group ~= "Quest" and group ~= "Monster" and JocysCom_LanguageChatCheckButton:GetChecked() then localeAttribute = locale end -- Format and send whisper message. local chatMessageSP = "<message command=\"play\"" .. Attribute("language", localeAttribute) .. Attribute("group", group) .. Attribute("name", name) .. Attribute("gender", Gender(sex)) .. Attribute("effect", soundEffect) .. "><part>" local chatMessageSA = "<message command=\"add\"><part>" local chatMessageE = "</part></message>" local chatMessage if JocysCom_NetworkMessageCheckButton:GetChecked() then chatMessageLimit = 240 else chatMessageLimit = 10000 end local sizeAdd = chatMessageLimit - string.len(chatMessageSA) - string.len(chatMessageE) - string.len(addonPrefix) local sizePlay = chatMessageLimit - string.len(chatMessageSP) - string.len(chatMessageE) - string.len(addonPrefix) if DebugEnabled then JocysCom_DebugPrint("MessageMax", chatMessageLimit, sizeAdd, sizePlay) end local startIndex = 1 local endIndex = 1 local part = "" local speakMessageLen = string.len(speakMessage) local speakMessageRemainingLen = speakMessageLen while true do local command = "" local index = string.find(speakMessage, " ", endIndex) if index == speakMessageLen or index == nil then index = speakMessageLen endIndex = speakMessageLen + 1 -- 0-1000 end -- If text length less than max then... if speakMessageRemainingLen <= sizePlay then part = string.sub(speakMessage, startIndex) chatMessage = chatMessageSP .. part .. chatMessageE -- Send message and fill EditBox in Options window. JocysCom_SendMessage(chatMessage, true) if DebugEnabled and JocysCom_NetworkMessageCheckButton:GetChecked() then JocysCom_DebugPrint("MessageFromTo", startIndex, speakMessageLen, JocysCom_MessageAddColors(chatMessage)) end break -- If text length more than max then... elseif (index - startIndex) > sizeAdd or (index >= speakMessageLen and speakMessageRemainingLen > sizePlay) then -- If space is out of size then... part = string.sub(speakMessage, startIndex, endIndex - 1) chatMessage = chatMessageSA .. part .. chatMessageE -- Send message and do not fill EditBox in Options window. JocysCom_SendMessage(chatMessage, false) if DebugEnabled and JocysCom_NetworkMessageCheckButton:GetChecked() then JocysCom_DebugPrint("MessageFromTo2", tostring(index), startIndex, endIndex - 1, JocysCom_MessageAddColors(chatMessage)) end startIndex = endIndex speakMessageRemainingLen = string.len(string.sub(speakMessage, startIndex)) end -- look for next space. endIndex = index + 1 end -- Set MessageForEditBox. if JocysCom_NetworkMessageCheckButton:GetChecked() then JocysCom_MessageForOptionsEditBox(chatMessageSP .. speakMessage .. chatMessageE) end end -- Enable / Disable "Do Not Disturb" (DND) / <Busy> function JocysCom_DND(b) if b and JocysCom_DialogueMiniFrame:IsVisible() then if not UnitIsDND("player") then SendChatMessage("<" .. unitName .. ">: " .. messageDoNotDisturb, "DND") end else if UnitIsDND("player") then SendChatMessage("", "DND") end end end -- DialogueMiniFrame OnShow. function JocysCom_DialogueMiniFrame_OnShow() -- Enable DND <Busy> except QuestLogFrame (classic) or QuestMapFrame (retail). if classic then if JocysCom_DndCheckButton:GetChecked() and not QuestLogFrame:IsVisible() then JocysCom_DND(true) end else if JocysCom_DndCheckButton:GetChecked() and not QuestMapFrame:IsVisible() then JocysCom_DND(true) end end if JocysCom_StartOnOpenCheckButton:GetChecked() and MailFrame:IsVisible() then -- QuestMapFrame:IsVisible() JocysCom_PlayOpenedFrame() end end -- DialogueMiniFrame OnHide. function JocysCom_DialogueMiniFrame_OnHide() -- Disable DND <Busy>. if JocysCom_DndCheckButton:GetChecked() then JocysCom_DND(false) end -- Remove "Quest" messages if StopOnClose enabled. if JocysCom_StopOnCloseCheckButton:GetChecked() then JocysCom_SendChatMessageStop("Quest") end end -- DND CheckButton OnClick. function JocysCom_DndCheckButton_OnClick(self) PlaySound(856) JocysCom_SaveTocFileSettings() if self:GetChecked() then JocysCom_FilterDND() JocysCom_DND(true) else JocysCom_DND(false) JocysCom_FilterDND() end end -- Play sound and save settings. function JocysCom_PlaySoundAndSaveSettings() PlaySound(856) JocysCom_SaveTocFileSettings() end -- Lock Enable / Disable. function JocysCom_LockCheckButton_OnClick() PlaySound(856) if JocysCom_LockCheckButton:GetChecked() then JocysCom_StopButtonFrame:RegisterForDrag() else JocysCom_StopButtonFrame:RegisterForDrag("LeftButton") end JocysCom_SaveTocFileSettings() end -- StopButtonFrame position Right or Left. function JocysCom_MenuCheckButton_OnClick() PlaySound(856) JocysCom_MiniMenuFrame:ClearAllPoints() JocysCom_ColorMessagesCountFontString:ClearAllPoints() if JocysCom_MenuCheckButton:GetChecked() then JocysCom_MiniMenuFrame:SetPoint("BOTTOMLEFT", JocysCom_StopButtonFrame, "BOTTOMRIGHT", -8, 3) JocysCom_ColorMessagesCountFontString:SetPoint("LEFT", JocysCom_StopButtonFrame, "RIGHT", 0, -11) else JocysCom_MiniMenuFrame:SetPoint("BOTTOMRIGHT", JocysCom_StopButtonFrame, "BOTTOMLEFT", 4, 3) JocysCom_ColorMessagesCountFontString:SetPoint("RIGHT", JocysCom_StopButtonFrame, "LEFT", 0, -11) end JocysCom_SaveTocFileSettings() end local function round(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) return math.floor(num * mult + 0.5) / mult end -- Enable disable check-boxes (speech). function JocysCom_CheckButton_OnClick(self, name) PlaySound(856) if self:GetChecked() == false then -- Remove disabled group messages. JocysCom_SendChatMessageStop(name) end JocysCom_SaveTocFileSettings() JocysCom_LoadEventSettings() end -- Show MiniMenuFrame and set text. function JocysCom_MiniMenuFrame_Show(name) local fontString = "" JocysCom_MiniMenuFrame_FontString:Show() if name == "Options" then fontString = "|cffddddddMouse over [=] shows Quick Menu.\nMouse click opens Options Window.|r" elseif name == "Save" then fontString = "|cffddddddSave target name, gender, type in Monitor.\n|r" elseif name == "Stop" then fontString = "|cffddddddStop text-to-speech and clear all playlist.\n|r" elseif name == "Busy" then fontString = "|cff6464ffShow <Busy> over your character\nwhen window is open and speech is on.|r" elseif name == "Titles" then fontString = "|cffefc176Include QUEST TITLES\nin text-to-speech.|r" elseif name == "Objectives" then fontString = "|cffefc176Include QUEST OBJECTIVES\nin text-to-speech.|r" elseif name == "StartOnOpen" then fontString = "|cffefc176START to play DIALOGUE, BOOK, etc.\non opening window.|r" elseif name == "StopOnClose" then fontString = "|cffefc176STOP to play DIALOGUE, BOOK, etc. on\nclosing window. Uncheck to collect quests.|r" elseif name == "Quest" then fontString = "|cffefc176Play DIALOGUE, BOOK, PLAQUE, etc.\nwindow text.|r" elseif name == "Monster" then fontString = "|cfffffb9fPlay NPC chat messages.\n|r" elseif name == "Channel" then fontString = "|cffc3e6e8Play CHANNEL chat messages.\n|r" elseif name == "Whisper" then fontString = "|cffffb2ebPlay WHISPER chat messages.\n|r" elseif name == "Emote" then fontString = "|cffff6b26Play player EMOTE chat messages.\n|r" elseif name == "Say" then fontString = "|cffffffffPlay SAY chat messages.\n|r" elseif name == "Yell" then fontString = "|cffff3f40Play YELL chat messages.\n|r" elseif name == "Guild" then fontString = "|cff40fb40Play GUILD member chat messages.\n|r" elseif name == "Officer" then fontString = "|cff40fb40Play GUILD OFFICER chat messages.\n|r" elseif name == "RaidLeader" then fontString = "|cffff4709Play RAID LEADER chat messages.\n|r" elseif name == "Raid" then fontString = "|cffff7d00Play RAID member chat messages.\n|r" elseif name == "PartyLeader" then fontString = "|cffaaa7ffPlay PARTY LEADER chat messages.\n|r" elseif name == "Party" then fontString = "|cffaaa7ffPlay PARTY member chat messages.\n|r" elseif name == "InstanceLeader" then fontString = "|cffff4709Play INSTANCE LEADER chat messages.\n|r" elseif name == "Instance" then fontString = "|cffff7d00Play INSTANCE member chat messages.\n|r" -- Play intro sound check-boxes. elseif name == "SoundQuest" then fontString = "|cffefc176Play intro sound at the beginning of\nDIALOGUE, BOOK, etc. window text.|r" elseif name == "SoundMonster" then fontString = "|cfffffb9fPlay intro sound at the beginning of\nNPC messages.|r" elseif name == "SoundChannel" then fontString = "|cffc3e6e8Play intro sound at the beginning of\nCHANNEL messages.|r" elseif name == "SoundWhisper" then fontString = "|cffffb2ebPlay intro sound at the beginning of\nWHISPER messages.|r" elseif name == "SoundEmote" then fontString = "|cffff6b26Play intro sound at the beginning of\nplayer EMOTE messages.|r" elseif name == "SoundSay" then fontString = "|cffffffffPlay intro sound at the beginning of\nSAY messages.|r" elseif name == "SoundYell" then fontString = "|cffff3f40Play intro sound at the beginning of\nYELL messages.|r" elseif name == "SoundOfficer" then fontString = "|cff40fb40Play intro sound at the beginning of\nGUILD OFFICER messages.|r" elseif name == "SoundGuild" then fontString = "|cff40fb40Play intro sound at the beginning of\nGUILD member messages.|r" elseif name == "SoundRaidLeader" then fontString = "|cffff4709Play intro sound at the beginning of\nRAID LEADER messages.|r" elseif name == "SoundRaid" then fontString = "|cffff7d00Play intro sound at the beginning of\nRAID member messages.|r" elseif name == "SoundPartyLeader" then fontString = "|cffaaa7ffPlay intro sound at the beginning of\nPARTY LEADER messages.|r" elseif name == "SoundParty" then fontString = "|cffaaa7ffPlay intro sound at the beginning of\nPARTY member messages.|r" elseif name == "SoundInstanceLeader" then fontString = "|cffff4709Play intro sound at the beginning of\nINSTANCE LEADER messages.|r" elseif name == "SoundInstance" then fontString = "|cffff7d00Play intro sound at the beginning of\nINSTANCE member messages.|r" -- Add name check-boxes. elseif name == "NameQuest" then fontString = "|cffefc176Add \"<CharacterName> says.\" to\nDIALOGUE, BOOK, etc. window text.|r" elseif name == "NameMonster" then fontString = "|cfffffb9fAdd \"<Name> whispers \\ says \\ yells.\" to\nNPC messages.|r" elseif name == "NameChannel" then fontString = "|cffc3e6e8Add \"<CharacterName> says.\" to\nCHANNEL messages.|r" elseif name == "NameWhisper" then fontString = "|cffffb2ebAdd \"<CharacterName> whispers.\" to\nWHISPER messages.|r" elseif name == "NameSay" then fontString = "|cffffffffAdd \"<CharacterName> says.\" to\nSAY messages.|r" elseif name == "NameYell" then fontString = "|cffff3f40Add \"<CharacterName> yells.\" to\nYELL messages.|r" elseif name == "NameOfficer" then fontString = "|cff40fb40Add \"<CharacterName> says.\" to\nGUILD OFFICER messages.|r" elseif name == "NameGuild" then fontString = "|cff40fb40Add \"<CharacterName> says.\" to\nGUILD memeber messages.|r" elseif name == "NameRaidLeader" then fontString = "|cffff4709Add \"<CharacterName> says.\" to\nRAID LEADER messages.|r" elseif name == "NameRaid" then fontString = "|cffff7d00Add \"<CharacterName> says.\" to\nRAID member messages.|r" elseif name == "NamePartyLeader" then fontString = "|cffaaa7ffAdd \"<CharacterName> says.\" to\nPARTY LEADER messages.|r" elseif name == "NameParty" then fontString = "|cffaaa7ffAdd \"<CharacterName> says.\" to\nPARTY memeber messages.|r" elseif name == "NameInstanceLeader" then fontString = "|cffff4709Add \"<CharacterName> says.\" to\nINSTANCE LEADER messages.|r" elseif name == "NameInstance" then fontString = "|cffff7d00Add \"<CharacterName> says.\" to\nINSTANCE memeber messages.|r" else JocysCom_MiniMenuFrame_FontString:Hide() end JocysCom_MiniMenuFrame_FontString:SetText(fontString) JocysCom_MiniMenuFrame:Show() end -- Hide MiniMenuFrame. function JocysCom_MiniMenuFrame_Hide() JocysCom_MiniMenuFrame:Hide() end -- [ Stop ] dialog button. function JocysCom_StopButton_OnClick(name) PlaySound(856) if JocysCom_ColorMessageCheckButton:GetChecked() then JocysCom_ClipboardMessageEditBoxSetFocus() end if name == "Quest" then -- Remove only "Quest" messages -- [■] stop button on dialogue windows. JocysCom_SendChatMessageStop(name) else -- Remove all messages -- [≡][■] stop button on mini frame. JocysCom_SendChatMessageStop() end -- Disable DND <Busy>. if JocysCom_DndCheckButton:GetChecked() then JocysCom_DND(false) end end -- [ Play ] button. function JocysCom_PlayButton_OnClick() -- Disable DND. if JocysCom_DndCheckButton:GetChecked() then JocysCom_DND(true) end --if JocysCom_ColorMessageCheckButton:GetChecked() then JocysCom_ClipboardMessageEditBoxSetFocus() end JocysCom_PlayOpenedFrame() end -- ScrollFrame - scroll-up or scroll-down. function JocysCom_DialogueScrollFrame_OnMouseWheel(self, delta) if delta == 1 then JocysCom_PlayButton_OnClick() else JocysCom_StopButton_OnClick("Quest") end end function JocysCom_PlayOpenedFrame() -- Default. local event = nil -- Gossip. if GossipFrame:IsVisible() then event = "GOSSIP_SHOW" -- Quest. elseif QuestFrame:IsVisible() then if QuestGreetingScrollFrame:IsVisible() then event = "QUEST_GREETING" elseif QuestDetailScrollFrame:IsVisible() then event = "QUEST_DETAIL" elseif QuestProgressScrollFrame:IsVisible() then event = "QUEST_PROGRESS" elseif QuestRewardScrollFrame:IsVisible() then event = "QUEST_COMPLETE" end -- QuestLog. elseif not classic and QuestMapFrame:IsVisible() then event = "QUEST_LOG_UPDATE_JOCYS" elseif classic and QuestLogFrame:IsVisible() then event = "QUEST_LOG_UPDATE_JOCYS" -- Item. elseif ItemTextFrame:IsVisible() then event = "ITEM_TEXT_READY" -- Mail. elseif MailFrame:IsVisible() then event = "MAIL_SHOW_JOCYS" end -- Return. if event ~= nil then JocysCom_OptionsFrame_OnEvent(true, nil, event) end end -- Show or Hide JocysCom frames. function JocysCom_AttachAndShowFrames() local frameMargin = -4 local frameButton = GossipFrame local frameScroll = GossipFrameInset -- GossipGreetingScrollFrame -- Gossip. if GossipFrame:IsVisible() then frameButton = GossipFrame frameScroll = GossipFrameInset -- GossipGreetingScrollFrame frameMargin = -30 -- Log. elseif not classic and QuestMapFrame:IsVisible() then frameButton = QuestMapFrame.DetailsFrame frameScroll = QuestMapDetailsScrollFrame frameMargin = -4 -- Quest. elseif classic and QuestLogFrame:IsVisible() then frameButton = QuestLogFrame frameScroll = QuestLogDetailScrollFrame frameMargin = -4 -- Quest. elseif QuestFrame:IsVisible() then if QuestGreetingScrollFrame:IsVisible() then frameScroll = QuestGreetingScrollFrame frameMargin = -30 elseif QuestDetailScrollFrame:IsVisible() then frameScroll = QuestDetailScrollFrame frameMargin = -30 elseif QuestProgressScrollFrame:IsVisible() then frameScroll = QuestProgressScrollFrame frameMargin = -30 elseif QuestRewardScrollFrame:IsVisible() then frameScroll = QuestRewardScrollFrame frameMargin = -30 end frameButton = QuestFrame -- Item. elseif ItemTextFrame:IsVisible() then frameButton = ItemTextFrame frameScroll = ItemTextScrollFrame frameMargin = -4 -- Mail. elseif MailFrame:IsVisible() then frameButton = OpenMailFrame frameScroll = OpenMailScrollFrame frameMargin = -4 end -- ScrollFrame JocysCom_DialogueScrollFrame:ClearAllPoints() JocysCom_DialogueScrollFrame:SetParent(frameScroll) JocysCom_DialogueScrollFrame:SetPoint("TOPLEFT", frameScroll, 4, -4) JocysCom_DialogueScrollFrame:SetPoint("BOTTOMRIGHT", frameScroll, frameMargin, 4) JocysCom_DialogueScrollFrame:SetFrameLevel(100) -- ButtonFrame JocysCom_DialogueMiniFrame:ClearAllPoints() JocysCom_DialogueMiniFrame:SetParent(frameButton) if not classic and QuestMapFrame:IsVisible() then frameButton = QuestMapFrame JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", 0, -2) -- Exception for QuestMapFrame. else if classic then if QuestLogFrame:IsVisible() then JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", -36, 50) elseif ItemTextFrame:IsVisible() then JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", -33, 75) elseif MailFrame:IsVisible() then JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", 0, 1) else JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", -33, 69) end else JocysCom_DialogueMiniFrame:SetPoint("TOPRIGHT", frameButton, "BOTTOMRIGHT", 0, 1) end end if DebugEnabled then JocysCom_DebugPrint("FrameParent", frameButton:GetName()) end end -- [ Options ] button. function JocysCom_OptionsButton_OnClick() if JocysCom_OptionsFrame:IsShown() then JocysCom_OptionsFrame:Hide() else JocysCom_OptionsFrame:Show() end end -- Function for macro. Saves targeted NPC in TTS Monitor with custom effect name. Macro example: /run JocysCom_SaveNPCAs("Orc") -- If CheckBox [Save "target" and "mouseover" NPC's name, gender and type in Monitor.] in TTS Addon "Options" window is enabled, targeting or mouseover NPC will overwrite custom save. function JocysCom_SaveNPCAs(e) local t = "target" if UnitIsPlayer(t) or UnitPlayerControlled(t) or UnitName(t) == nil or UnitSex(t) == nil then if DebugEnabled then JocysCom_DebugPrint("NPCSaved0") end else local saveMessage = "<message command=\"save\"" .. Attribute("name", UnitName(t)) .. Attribute("gender", Gender(UnitSex(t))) .. Attribute("effect", e) .. " />" --Send message. messageEditBox = "|cff808080" .. saveMessage .. "|r" -- Send message and do not fill EditBox in Options window. JocysCom_SendMessage(saveMessage, false) end end -- [ Save ] button. function JocysCom_SaveNPC(m) if UnitIsPlayer(m) or UnitPlayerControlled(m) or UnitName(m) == nil or UnitSex(m) == nil then if DebugEnabled then JocysCom_DebugPrint("NPCSaved0") end else local saveMessage = "<message command=\"save\"" .. Attribute("name", UnitName(m)) .. Attribute("gender", Gender(UnitSex(m))) .. Attribute("effect", UnitCreatureType(m)) .. " />" --Send message. messageEditBox = "|cff808080" .. saveMessage .. "|r" -- Send message and do not fill EditBox in Options window. JocysCom_SendMessage(saveMessage, false) end end -- Clipboard mode Enable / Disable. function JocysCom_ColorMessageCheckButton_OnClick() PlaySound(856) if JocysCom_ColorMessageCheckButton:GetChecked() then JocysCom_NetworkMessageCheckButton:SetChecked(false) JocysCom_SendMessageTimer() end JocysCom_ClearForm() JocysCom_SaveTocFileSettings() JocysCom_LoadEventSettings() end -- Nwtwork mode Enable / Disable. function JocysCom_NetworkMessageCheckButton_OnClick() PlaySound(856) if JocysCom_NetworkMessageCheckButton:GetChecked() then JocysCom_ColorMessageCheckButton:SetChecked(false) end JocysCom_ClearForm() JocysCom_SaveTocFileSettings() JocysCom_LoadEventSettings() end function JocysCom_ClearForm() JocysCom_StopButton_OnClick() JocysCom_OptionsEditBox:SetText("") JocysCom_ClipboardMessageEditBox:SetText("") end -- Add Colors to message. function JocysCom_MessageAddColors(m) m = string.gsub(m, "%[comment]", "|cff808080[comment]|r|cfff7e593") m = string.gsub(m, "%[/comment]", "|r|cff808080[/comment]|r") m = string.gsub(m, "<", "|cff808080<") m = string.gsub(m, ">", ">|r") return m end -- Send message to Options EditBox. function JocysCom_MessageForOptionsEditBox(m) if string.find(m, "command=\"sound\"") ~= nil or string.find(m, "command=\"player\"") ~= nil or string.find(m, "command=\"save\"") ~= nil then return else -- Add Colors to message. JocysCom_OptionsEditBox:SetText(JocysCom_MessageAddColors(m)) end end -- Send messages from table. function JocysCom_SendMessageFromTable() --JocysCom_ButtonFlashing() --if JocysCom_ClipboardMessageEditBox:HasFocus() then local messageBytes = messageTable[1]:gsub(".", function(c) return string.format("%02x", string.byte(c)) end) -- Convert message characters to bytes (UTF-8). a ш B Ш C • 61 D188 42 D0A8 43 • 61D18842D0A843 local messageLen = #messageBytes / 2 -- Count bytes-pairs (7). 61 D1 88 42 D0 A8 43 local messageLenBytes = string.format("%06x", messageLen) -- Create message length value-color (3 bytes). Add missing bytes. local messageLenPixel = "|cff" .. messageLenBytes .. "·|r" -- Create message length character-pixel. local ungroupedBytes = math.fmod(messageLen,3) -- Divide message (7) into 3 byte groups and get ungrouped byte(s) • (7)-3-3=1 left • (61D188) (42D0A8) 43 -- If ungrouped bytes left, add missing bytes: "00" or "0000". if ungroupedBytes > 0 then messageBytes = messageBytes .. string.rep("00", 3 - ungroupedBytes) end -- Get (3 byte) groups. Switch red color with blue (RGB > BGR). Create coloured pixels. |cff88D161·|r local messagePixels = messageBytes:gsub("(..)(..)(..)", "|cff" .. "%3%2%1" .. "·|r") -- Update message change indicator color for Monitor: add 1 to red, green and blue. messageChanged = messageChanged + 1 -- Do not exceed color brightness #808080 if messageChanged > 80 then messageChanged = 10 end local messageChangedPixel = "|cff" .. string.rep(messageChanged, 3) .. "·|r" -- Set message change value. -- Create final message with prefixes: prefix(6px) + change(1px) + size(1px) + message(#px) local message = messagePrefixPixels .. messageChangedPixel .. messageLenPixel .. messagePixels -- Set color frame position. pixelX = JocysCom_ColorMessagePixelXEditBox:GetNumber() pixelY = JocysCom_ColorMessagePixelYEditBox:GetNumber() if pixelY > 0 then pixelY = pixelY * -1 end JocysCom_ColorMessageFrame:ClearAllPoints() JocysCom_ColorMessageFrame:SetPoint("TOPLEFT", pixelX, pixelY) JocysCom_ColorMessageFrame:SetPoint("TOPRIGHT") JocysCom_ColorMessageFrame:Show() -- Send to Display. JocysCom_ColorMessageFontString:SetText(message) -- Send to Options. JocysCom_MessageForOptionsEditBox(messageTable[1]) -- Send to Clipboard. if DebugEnabled then JocysCom_ClipboardMessageEditBox:SetText(messageTable[1]) end JocysCom_ClipboardMessageEditBoxSetFocus() -- Debug. if DebugEnabled then JocysCom_DebugPrint("MessageSent", #messageTable, messageChanged, messageLen, messageLenBytes, #messageBytes, ungroupedBytes, message, messageTable[1]) end table.remove(messageTable, 1) if #messageTable > 0 then JocysCom_ColorMessagesCountFontString:SetText(#messageTable) else JocysCom_ColorMessagesCountFontString:SetText("") end end function JocysCom_SendMessageTimer() if #messageTable > 0 then JocysCom_SendMessageFromTable() end if JocysCom_ColorMessageCheckButton:GetChecked() then C_Timer.After(messageInterval, JocysCom_SendMessageTimer) end end function JocysCom_ButtonFlashing() if JocysCom_ClipboardMessageEditBox:HasFocus() then if UIFrameIsFading(JocysCom_ContinueButton) then UIFrameFlashRemoveFrame(JocysCom_ContinueButton) end JocysCom_ContinueButton:Hide() JocysCom_StopButton:Show() else UIFrameFlash(JocysCom_ContinueButton, 1, 1, 10, true, 0, 0) JocysCom_ContinueButton:Show() JocysCom_StopButton:Hide() end end function JocysCom_ClipboardMessageEditBoxSetFocus() if DebugEnabled then JocysCom_ClipboardMessageFrame:Show() -- Clear focus... if JocysCom_ClipboardMessageEditBox:HasFocus() then JocysCom_ClipboardMessageEditBox:ClearFocus() end --JocysCom_ClipboardMessageFrame:SetFocus() --JocysCom_ClipboardMessageEditBox:HighlightText() else JocysCom_ClipboardMessageFrame:Hide() end end local function Color(c, v) return c .. " " .. v .. ": " .. "|r" end -- Print debug information. function JocysCom_DebugPrint(name, ...) local v1, v2, v3, v4, v5, v6, v7, v8 = ... local ln = string.rep("-", 85) local c0 = "|r" local c1 = "|cff999999" -- Gray local c2 = "|cffffff55" -- Yellow local c3 = "|cff40fb40" -- Green local c4 = "|cffff0000" -- Red local c5 = "|cff558a84" -- Dark green local c6 = "|cff77ccff" -- na local c7 = "|cffaaa7ff" -- na local c8 = "|cffabd473" -- na local l1 = c1 .. ln .. c0 .. "\n" local l2 = c2 .. ln .. c0 .. "\n" local l6 = c6 .. ln .. c0 .. "\n" local l7 = c7 .. ln .. c0 .. "\n" local l8 = c8 .. ln .. c0 .. "\n" -- print(c4 .. "DebugName: " .. c0 .. name) if name == "GameVersion" then print("WoW Classic: " .. tostring(classic) .. " TOC: " .. tocversion) elseif name == "Lockdown" then print(Color(c1,"Macro inLockdown") .. tostring(v1)) elseif name == "NPCNameListEmpty" then print(l2 .. Color(c2,"NPCSaveTTSMacro (no names)")) print(Color(c2,"0") .. "TargetFriend") elseif name == "NPCNameListExist" then print(l2 .. Color(c2,"NPCSaveTTSMacro (name exists)") .. v1) elseif name == "NPCNameListAdded" then print(l2 .. Color(c2,"NPCSaveTTSMacro (name added)") .. v1) for i,v in ipairs(v2) do print(c2 .. i .. ". " .. c0 .. v) end elseif name == "Registered" then print(c2 .. "Registered: " .. v1 .. c0) elseif name == "Unregistered" then print(c5 .. "Unregistered: " .. v1 .. c0) elseif name == "EventDetails" then print(l6) for i,v in pairs(v1) do print(Color(c2, i .. ". " .. type(v)) .. tostring(v)) end elseif name == "BNGetFriendInfoByID" then print(Color(c6,"BNGetFriendInfoByID") .. tostring(v1) .. Color(c6,"presenceID") .. tostring(v2) .. Color(c6,"accountName") .. tostring(v3) .. Color(c6,"battleTag") .. tostring(v4) .. Color(c6, v6) .. tostring(v5)) elseif name == "CHAT" then print(l6 .. Color(c6,"event") .. tostring(v1) .. Color(c6,"name") .. tostring(v2) .. Color(c6,"sex") .. tostring(v3) .. Color(c6,"group") .. tostring(v4) .. Color(c6,"soundIntro") .. tostring(v5) .. Color(c6,"soundEffect") .. tostring(v6) .. Color(c6,"\nspeakMessage") .. tostring(v7)) elseif name == "MessageMax" then print(l7 .. Color(c7,"Message max") .. v1 .. Color(c7,"command=\"add\" size") .. v2 .. Color(c7,"command=\"play\" size") .. v3) elseif name == "MessageFromTo" then print(Color(c6,"Message From-To") .. v1 .. "-" .. v2 .. Color(c6,"Message") .. v3) elseif name == "MessageFromTo2" then print(Color(c7,"Space found") .. v1 .. Color(c6,"Message From-To") .. v2 .. "-" .. v3 .. Color(c6,"Message") .. v4) elseif name == "FrameParent" then print(l8 .. c8 .. "PLAY and STOP buttons attached to " .. c0 .. v1) elseif name == "NPCSaved0" then print(l1 .. c1 .. "Only uncontrollable by players NPC targets will be saved." .. c0) elseif name == "MessageAdded" then print(l6 .. Color(c6,"Message added") .. v1 .. Color(c6,"Changed") .. string.rep(v2, 3) .. "\n" .. JocysCom_MessageAddColors(v3)) elseif name == "MessageSent" then print(l6 .. Color(c6,"Message sent") .. v1 .. Color(c6,"Changed") .. string.rep(v2, 3) .. Color(c6,"Chars") .. v5 .. Color(c6,"Bytes") .. v3 .. " · " .. v4 .. Color(c6,"Ungrouped(3)") .. v6 .. "\n" .. v7:gsub("·","●") .. "\n" .. JocysCom_MessageAddColors(v8)) end end ---- Enable/Disable DND message filter. function JocysCom_FilterDND() ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(self, event, msg) return not DebugEnabled and JocysCom_DndCheckButton:GetChecked() and string.find(msg, "You are no longer marked Busy.") ~= nil end) ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(self, event, msg) return not DebugEnabled and JocysCom_DndCheckButton:GetChecked() and string.find(msg, "You are now Busy:") ~= nil end) -- WoW Classic ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(self, event, msg) return not DebugEnabled and JocysCom_DndCheckButton:GetChecked() and string.find(msg, "You are no longer marked DND.") ~= nil end) ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(self, event, msg) return not DebugEnabled and JocysCom_DndCheckButton:GetChecked() and string.find(msg, "You are now DND.") ~= nil end) end -- Load and apply settings from toc file. function JocysCom_LoadTocFileSettings() -- Set (Debug) value. if JocysCom_DebugEnabled == true then DebugEnabled = true else DebugEnabled = false end -- Set (Options) CheckButtons. if JocysCom_DndCB == false then JocysCom_DndCheckButton:SetChecked(false) else JocysCom_DndCheckButton:SetChecked(true) end if JocysCom_NetworkMessageCB == true then JocysCom_NetworkMessageCheckButton:SetChecked(true) else JocysCom_NetworkMessageCheckButton:SetChecked(false) end if JocysCom_ColorMessageCB == false then JocysCom_ColorMessageCheckButton:SetChecked(false) else JocysCom_ColorMessageCheckButton:SetChecked(true) end -- Set LockCheckButton and StopButtonFrame. if JocysCom_LockCB == true then JocysCom_LockCheckButton:SetChecked(true) else JocysCom_LockCheckButton:SetChecked(false) end if JocysCom_LockCheckButton:GetChecked() then JocysCom_StopButtonFrame:RegisterForDrag() else JocysCom_StopButtonFrame:RegisterForDrag("LeftButton") end -- Set MenuCheckButton and MiniMenuFrame. if JocysCom_MenuCB == false then JocysCom_MenuCheckButton:SetChecked(false) else JocysCom_MenuCheckButton:SetChecked(true) end -- Set save NPC name, gender and type to Monitor. if JocysCom_SaveCB == false then JocysCom_SaveCheckButton:SetChecked(false) else JocysCom_SaveCheckButton:SetChecked(true) end -- Set if send locale information to Monitor. if JocysCom_LanguageQuestCB == true then JocysCom_LanguageQuestCheckButton:SetChecked(true) else JocysCom_LanguageQuestCheckButton:SetChecked(false) end if JocysCom_LanguageChatCB == true then JocysCom_LanguageChatCheckButton:SetChecked(true) else JocysCom_LanguageChatCheckButton:SetChecked(false) end -- Add chat message filters. ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", function(self, event, msg) return string.find(msg, "<message") ~= nil end) ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", function(self, event, msg) return string.find(msg, "<message") ~= nil end) ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", function(self, event, msg, name) return string.find(JocysCom_RemoveRealmName(name), unitName) ~= nil end) -- Don't process your own whisper twice. JocysCom_FilterDND() -- Set (Options) EditBoxes. if JocysCom_ColorMessagePixelXEB == "" or JocysCom_ColorMessagePixelXEB == nil then JocysCom_ColorMessagePixelXEB = 0 JocysCom_ColorMessagePixelXEditBox:SetNumber(JocysCom_ColorMessagePixelXEB) else JocysCom_ColorMessagePixelXEditBox:SetNumber(JocysCom_ColorMessagePixelXEB) end if JocysCom_ColorMessagePixelYEB == "" or JocysCom_ColorMessagePixelYEB == nil then JocysCom_ColorMessagePixelYEB = 0 JocysCom_ColorMessagePixelYEditBox:SetNumber(JocysCom_ColorMessagePixelYEB) else JocysCom_ColorMessagePixelYEditBox:SetNumber(JocysCom_ColorMessagePixelYEB) end if JocysCom_ReplaceNameEB == "" or JocysCom_ReplaceNameEB == nil then JocysCom_ReplaceNameEB = unitName JocysCom_ReplaceNameEditBox:SetText(JocysCom_ReplaceNameEB) else JocysCom_ReplaceNameEditBox:SetText(JocysCom_ReplaceNameEB) end -- Set (MiniFrame) CheckButtons. if JocysCom_QuestCB == false then JocysCom_QuestCheckButton:SetChecked(false) else JocysCom_QuestCheckButton:SetChecked(true) end if JocysCom_MonsterCB == false then JocysCom_MonsterCheckButton:SetChecked(false) else JocysCom_MonsterCheckButton:SetChecked(true) end if JocysCom_ChannelCB == true then JocysCom_ChannelCheckButton:SetChecked(true) else JocysCom_ChannelCheckButton:SetChecked(false) end if JocysCom_WhisperCB == false then JocysCom_WhisperCheckButton:SetChecked(false) else JocysCom_WhisperCheckButton:SetChecked(true) end if JocysCom_EmoteCB == false then JocysCom_EmoteCheckButton:SetChecked(false) else JocysCom_EmoteCheckButton:SetChecked(true) end if JocysCom_SayCB == false then JocysCom_SayCheckButton:SetChecked(false) else JocysCom_SayCheckButton:SetChecked(true) end if JocysCom_YellCB == false then JocysCom_YellCheckButton:SetChecked(false) else JocysCom_YellCheckButton:SetChecked(true) end if JocysCom_GuildCB == false then JocysCom_GuildCheckButton:SetChecked(false) else JocysCom_GuildCheckButton:SetChecked(true) end if JocysCom_OfficerCB == false then JocysCom_OfficerCheckButton:SetChecked(false) else JocysCom_OfficerCheckButton:SetChecked(true) end if JocysCom_PartyCB == false then JocysCom_PartyCheckButton:SetChecked(false) else JocysCom_PartyCheckButton:SetChecked(true) end if JocysCom_PartyLCB == false then JocysCom_PartyLeaderCheckButton:SetChecked(false) else JocysCom_PartyLeaderCheckButton:SetChecked(true) end if JocysCom_RaidCB == false then JocysCom_RaidCheckButton:SetChecked(false) else JocysCom_RaidCheckButton:SetChecked(true) end if JocysCom_RaidLCB == false then JocysCom_RaidLeaderCheckButton:SetChecked(false) else JocysCom_RaidLeaderCheckButton:SetChecked(true) end if JocysCom_InstanceCB == false then JocysCom_InstanceCheckButton:SetChecked(false) else JocysCom_InstanceCheckButton:SetChecked(true) end if JocysCom_InstanceLCB == false then JocysCom_InstanceLeaderCheckButton:SetChecked(false) else JocysCom_InstanceLeaderCheckButton:SetChecked(true) end if JocysCom_TitlesCB == true then JocysCom_TitlesCheckButton:SetChecked(true) else JocysCom_TitlesCheckButton:SetChecked(false) end if JocysCom_ObjectivesCB == false then JocysCom_ObjectivesCheckButton:SetChecked(false) else JocysCom_ObjectivesCheckButton:SetChecked(true) end if JocysCom_StartOnOpenCB == false then JocysCom_StartOnOpenCheckButton:SetChecked(false) else JocysCom_StartOnOpenCheckButton:SetChecked(true) end if JocysCom_StopOnCloseCB == false then JocysCom_StopOnCloseCheckButton:SetChecked(false) else JocysCom_StopOnCloseCheckButton:SetChecked(true) end -- Set (MiniFrame) Sound CheckButtons. if JocysCom_SQuestCB == true then JocysCom_SoundQuestCheckButton:SetChecked(true) else JocysCom_SoundQuestCheckButton:SetChecked(false) end if JocysCom_SMonsterCB == false then JocysCom_SoundMonsterCheckButton:SetChecked(false) else JocysCom_SoundMonsterCheckButton:SetChecked(true) end if JocysCom_SChannelCB == false then JocysCom_SoundChannelCheckButton:SetChecked(false) else JocysCom_SoundChannelCheckButton:SetChecked(true) end if JocysCom_SWhisperCB == false then JocysCom_SoundWhisperCheckButton:SetChecked(false) else JocysCom_SoundWhisperCheckButton:SetChecked(true) end if JocysCom_SEmoteCB == false then JocysCom_SoundEmoteCheckButton:SetChecked(false) else JocysCom_SoundEmoteCheckButton:SetChecked(true) end if JocysCom_SSayCB == false then JocysCom_SoundSayCheckButton:SetChecked(false) else JocysCom_SoundSayCheckButton:SetChecked(true) end if JocysCom_SYellCB == false then JocysCom_SoundYellCheckButton:SetChecked(false) else JocysCom_SoundYellCheckButton:SetChecked(true) end if JocysCom_SGuildCB == false then JocysCom_SoundGuildCheckButton:SetChecked(false) else JocysCom_SoundGuildCheckButton:SetChecked(true) end if JocysCom_SOfficerCB == false then JocysCom_SoundOfficerCheckButton:SetChecked(false) else JocysCom_SoundOfficerCheckButton:SetChecked(true) end if JocysCom_SPartyCB == false then JocysCom_SoundPartyCheckButton:SetChecked(false) else JocysCom_SoundPartyCheckButton:SetChecked(true) end if JocysCom_SPartyLCB == false then JocysCom_SoundPartyLeaderCheckButton:SetChecked(false) else JocysCom_SoundPartyLeaderCheckButton:SetChecked(true) end if JocysCom_SRaidCB == false then JocysCom_SoundRaidCheckButton:SetChecked(false) else JocysCom_SoundRaidCheckButton:SetChecked(true) end if JocysCom_SRaidLCB == false then JocysCom_SoundRaidLeaderCheckButton:SetChecked(false) else JocysCom_SoundRaidLeaderCheckButton:SetChecked(true) end if JocysCom_SInstanceCB == false then JocysCom_SoundInstanceCheckButton:SetChecked(false) else JocysCom_SoundInstanceCheckButton:SetChecked(true) end if JocysCom_SInstanceLCB == false then JocysCom_SoundInstanceLeaderCheckButton:SetChecked(false) else JocysCom_SoundInstanceLeaderCheckButton:SetChecked(true) end -- Set (MiniFrame) Name CheckButtons. if JocysCom_NQuestCB == true then JocysCom_NameQuestCheckButton:SetChecked(true) else JocysCom_NameQuestCheckButton:SetChecked(false) end if JocysCom_NMonsterCB == true then JocysCom_NameMonsterCheckButton:SetChecked(true) else JocysCom_NameMonsterCheckButton:SetChecked(false) end if JocysCom_NChannelCB == true then JocysCom_NameChannelCheckButton:SetChecked(true) else JocysCom_NameChannelCheckButton:SetChecked(false) end if JocysCom_NWhisperCB == true then JocysCom_NameWhisperCheckButton:SetChecked(true) else JocysCom_NameWhisperCheckButton:SetChecked(false) end if JocysCom_NSayCB == true then JocysCom_NameSayCheckButton:SetChecked(true) else JocysCom_NameSayCheckButton:SetChecked(false) end if JocysCom_NYellCB == true then JocysCom_NameYellCheckButton:SetChecked(true) else JocysCom_NameYellCheckButton:SetChecked(false) end if JocysCom_NGuildCB == true then JocysCom_NameGuildCheckButton:SetChecked(true) else JocysCom_NameGuildCheckButton:SetChecked(false) end if JocysCom_NOfficerCB == true then JocysCom_NameOfficerCheckButton:SetChecked(true) else JocysCom_NameOfficerCheckButton:SetChecked(false) end if JocysCom_NPartyCB == true then JocysCom_NamePartyCheckButton:SetChecked(true) else JocysCom_NamePartyCheckButton:SetChecked(false) end if JocysCom_NPartyLCB == true then JocysCom_NamePartyLeaderCheckButton:SetChecked(true) else JocysCom_NamePartyLeaderCheckButton:SetChecked(false) end if JocysCom_NRaidCB == true then JocysCom_NameRaidCheckButton:SetChecked(true) else JocysCom_NameRaidCheckButton:SetChecked(false) end if JocysCom_NRaidLCB == true then JocysCom_NameRaidLeaderCheckButton:SetChecked(true) else JocysCom_NameRaidLeaderCheckButton:SetChecked(false) end if JocysCom_NInstanceCB == true then JocysCom_NameInstanceCheckButton:SetChecked(true) else JocysCom_NameInstanceCheckButton:SetChecked(false) end if JocysCom_NInstanceLCB == true then JocysCom_NameInstanceLeaderCheckButton:SetChecked(true) else JocysCom_NameInstanceLeaderCheckButton:SetChecked(false) end end -- Save settings. function JocysCom_SaveTocFileSettings() JocysCom_DebugEnabled = DebugEnabled -- Save check buttons. JocysCom_ColorMessagePixelXEB = JocysCom_ColorMessagePixelXEditBox:GetNumber() JocysCom_ColorMessagePixelYEB = JocysCom_ColorMessagePixelYEditBox:GetNumber() JocysCom_ReplaceNameEB = JocysCom_ReplaceNameEditBox:GetText() JocysCom_NetworkMessageCB = JocysCom_NetworkMessageCheckButton:GetChecked() JocysCom_ColorMessageCB = JocysCom_ColorMessageCheckButton:GetChecked() JocysCom_DndCB = JocysCom_DndCheckButton:GetChecked() JocysCom_LockCB = JocysCom_LockCheckButton:GetChecked() JocysCom_MenuCB = JocysCom_MenuCheckButton:GetChecked() JocysCom_SaveCB = JocysCom_SaveCheckButton:GetChecked(); JocysCom_LanguageQuestCB = JocysCom_LanguageQuestCheckButton:GetChecked(); JocysCom_LanguageChatCB = JocysCom_LanguageChatCheckButton:GetChecked(); JocysCom_QuestCB = JocysCom_QuestCheckButton:GetChecked() JocysCom_MonsterCB = JocysCom_MonsterCheckButton:GetChecked() JocysCom_ChannelCB = JocysCom_ChannelCheckButton:GetChecked() JocysCom_WhisperCB = JocysCom_WhisperCheckButton:GetChecked() JocysCom_EmoteCB = JocysCom_EmoteCheckButton:GetChecked() JocysCom_SayCB = JocysCom_SayCheckButton:GetChecked() JocysCom_YellCB = JocysCom_YellCheckButton:GetChecked() JocysCom_GuildCB = JocysCom_GuildCheckButton:GetChecked() JocysCom_OfficerCB = JocysCom_OfficerCheckButton:GetChecked() JocysCom_PartyCB = JocysCom_PartyCheckButton:GetChecked() JocysCom_PartyLCB = JocysCom_PartyLeaderCheckButton:GetChecked() JocysCom_RaidCB = JocysCom_RaidCheckButton:GetChecked() JocysCom_RaidLCB = JocysCom_RaidLeaderCheckButton:GetChecked() JocysCom_InstanceCB = JocysCom_InstanceCheckButton:GetChecked() JocysCom_InstanceLCB = JocysCom_InstanceLeaderCheckButton:GetChecked() JocysCom_TitlesCB = JocysCom_TitlesCheckButton:GetChecked() JocysCom_ObjectivesCB = JocysCom_ObjectivesCheckButton:GetChecked() JocysCom_StartOnOpenCB = JocysCom_StartOnOpenCheckButton:GetChecked() JocysCom_StopOnCloseCB = JocysCom_StopOnCloseCheckButton:GetChecked() -- Save sound check buttons. JocysCom_SQuestCB = JocysCom_SoundQuestCheckButton:GetChecked() JocysCom_SMonsterCB = JocysCom_SoundMonsterCheckButton:GetChecked() JocysCom_SChannelCB = JocysCom_SoundChannelCheckButton:GetChecked() JocysCom_SWhisperCB = JocysCom_SoundWhisperCheckButton:GetChecked() JocysCom_SEmoteCB = JocysCom_SoundEmoteCheckButton:GetChecked() JocysCom_SSayCB = JocysCom_SoundSayCheckButton:GetChecked() JocysCom_SYellCB = JocysCom_SoundYellCheckButton:GetChecked() JocysCom_SGuildCB = JocysCom_SoundGuildCheckButton:GetChecked() JocysCom_SOfficerCB = JocysCom_SoundOfficerCheckButton:GetChecked() JocysCom_SPartyCB = JocysCom_SoundPartyCheckButton:GetChecked() JocysCom_SPartyLCB = JocysCom_SoundPartyLeaderCheckButton:GetChecked() JocysCom_SRaidCB = JocysCom_SoundRaidCheckButton:GetChecked() JocysCom_SRaidLCB = JocysCom_SoundRaidLeaderCheckButton:GetChecked() JocysCom_SInstanceCB = JocysCom_SoundInstanceCheckButton:GetChecked() JocysCom_SInstanceLCB = JocysCom_SoundInstanceLeaderCheckButton:GetChecked() -- Save name check buttons. JocysCom_NQuestCB = JocysCom_NameQuestCheckButton:GetChecked() JocysCom_NMonsterCB = JocysCom_NameMonsterCheckButton:GetChecked() JocysCom_NChannelCB = JocysCom_NameChannelCheckButton:GetChecked() JocysCom_NWhisperCB = JocysCom_NameWhisperCheckButton:GetChecked() JocysCom_NSayCB = JocysCom_NameSayCheckButton:GetChecked() JocysCom_NYellCB = JocysCom_NameYellCheckButton:GetChecked() JocysCom_NGuildCB = JocysCom_NameGuildCheckButton:GetChecked() JocysCom_NOfficerCB = JocysCom_NameOfficerCheckButton:GetChecked() JocysCom_NPartyCB = JocysCom_NamePartyCheckButton:GetChecked() JocysCom_NPartyLCB = JocysCom_NamePartyLeaderCheckButton:GetChecked() JocysCom_NRaidCB = JocysCom_NameRaidCheckButton:GetChecked() JocysCom_NRaidLCB = JocysCom_NameRaidLeaderCheckButton:GetChecked() JocysCom_NInstanceCB = JocysCom_NameInstanceCheckButton:GetChecked() JocysCom_NInstanceLCB = JocysCom_NameInstanceLeaderCheckButton:GetChecked() end --Load events and settings. JocysCom_RegisterEvents() --Create_SetBackdrop_Frames. function JocysCom_Create_SetBackdrop_Frames() local frame1 local frame2 local frame3 local frame4 local frameLevel1 local frameLevel2 local frameLevel3 local frameLevel4 if classic then frame1 = CreateFrame("Frame", nil, JocysCom_MiniMenuFrameBackdrop) frame2 = CreateFrame("Frame", nil, JocysCom_DialogueMiniFrameBackdrop) frame3 = CreateFrame("Frame", nil, JocysCom_MessageFrameBackdrop) frame4 = CreateFrame("Frame", nil, JocysCom_DescriptionFrameBackdrop) frame3:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" }) frame3:SetBackdropColor(1,1,1,1); frame4:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" }) frame4:SetBackdropColor(1,1,1,0); else frame1 = CreateFrame("Frame", nil, JocysCom_MiniMenuFrameBackdrop, BackdropTemplateMixin and "BackdropTemplate") frame2 = CreateFrame("Frame", nil, JocysCom_DialogueMiniFrameBackdrop, BackdropTemplateMixin and "BackdropTemplate") frame3 = CreateFrame("Frame", nil, JocysCom_MessageFrameBackdrop, BackdropTemplateMixin and "BackdropTemplate") frame4 = CreateFrame("Frame", nil, JocysCom_DescriptionFrameBackdrop, BackdropTemplateMixin and "BackdropTemplate") frame3:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" }) frame3:SetBackdropColor(1,1,1,1); frame4:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" }) frame4:SetBackdropColor(1,1,1,0.6); end -- JocysCom_MiniMenuFrame frameLevel1 = JocysCom_MiniMenuFrameBackdrop:GetFrameLevel() frame1:SetFrameLevel(frameLevel1) frame1:SetParent(JocysCom_MiniMenuFrameBackdrop) frame1:SetPoint("TOPLEFT", 0, 0) frame1:SetPoint("BOTTOMRIGHT", 0, 0) frame1:SetBackdrop({ insets = { left = 7, right = 3, top = 3, bottom = 5 }, edgeFile = "Interface\\AddOns\\JocysCom-TextToSpeech-WoW\\Images\\JocysCom-MiniMenuFrame-Border", edgeSize = 23 }) -- JocysCom_MiniMenuFrameBackdrop Texture. local texture1 = frame1:CreateTexture(nil, "BACKGROUND") texture1:SetPoint("TOPLEFT", 7, -3) texture1:SetPoint("BOTTOMRIGHT", -3, 7) texture1:SetHorizTile(true) texture1:SetVertTile(true) texture1:SetTexture("Interface\\FrameGeneral\\UI-Background-Rock", "REPEAT", "REPEAT") -- JocysCom_DialogueMiniFrame. frameLevel2 = JocysCom_DialogueMiniFrameBackdrop:GetFrameLevel() frame2:SetFrameLevel(frameLevel2 - 1) frame2:SetPoint("TOPLEFT", 0, 0) frame2:SetPoint("BOTTOMRIGHT", 0, 0) frame2:SetBackdrop({ bgFile = "Interface\\AddOns\\JocysCom-TextToSpeech-WoW\\Images\\JocysCom-DialogueMiniFrame-Background" }) -- JocysCom_MessageFrame. frameLevel3 = JocysCom_MessageFrameBackdrop:GetFrameLevel() frame3:SetFrameLevel(frameLevel3 - 1) frame3:SetPoint("TOPLEFT", 3, -3) frame3:SetPoint("BOTTOMRIGHT", -2, 2) -- JocysCom_DescriptionFrame. frameLevel4 = JocysCom_DescriptionFrameBackdrop:GetFrameLevel() frame4:SetFrameLevel(frameLevel4 -1) frame4:SetPoint("TOPLEFT", 3, -3) frame4:SetPoint("BOTTOMRIGHT", -2, 2) end JocysCom_Create_SetBackdrop_Frames()
lgpl-3.0
NiLuJe/koreader
spec/unit/readerhighlight_spec.lua
4
14277
describe("Readerhighlight module", function() local DocumentRegistry, ReaderUI, UIManager, Screen, Geom, Event setup(function() require("commonrequire") package.unloadAll() require("document/canvascontext"):init(require("device")) DocumentRegistry = require("document/documentregistry") Event = require("ui/event") Geom = require("ui/geometry") ReaderUI = require("apps/reader/readerui") Screen = require("device").screen UIManager = require("ui/uimanager") end) local function highlight_single_word(readerui, pos0) local s = spy.on(readerui.languagesupport, "improveWordSelection") readerui.highlight:onHold(nil, { pos = pos0 }) readerui.highlight:onHoldRelease() readerui.highlight:onHighlight() assert.spy(s).was_called() assert.spy(s).was_called_with(match.is_ref(readerui.languagesupport), match.is_ref(readerui.highlight.selected_text)) -- Reset in case we're called more than once. readerui.languagesupport.improveWordSelection:revert() UIManager:scheduleIn(1, function() UIManager:close(readerui.dictionary.dict_window) UIManager:close(readerui) -- We haven't torn it down yet ReaderUI.instance = readerui UIManager:quit() end) UIManager:run() end local function highlight_text(readerui, pos0, pos1) readerui.highlight:onHold(nil, { pos = pos0 }) readerui.highlight:onHoldPan(nil, { pos = pos1 }) local next_slot for i = #UIManager._window_stack, 0, -1 do local top_window = UIManager._window_stack[i] -- skip modal window if not top_window or not top_window.widget.modal then next_slot = i + 1 break end end readerui.highlight:onHoldRelease() assert.truthy(readerui.highlight.highlight_dialog) assert.truthy(UIManager._window_stack[next_slot].widget == readerui.highlight.highlight_dialog) readerui.highlight:onHighlight() UIManager:scheduleIn(1, function() UIManager:close(readerui.highlight.highlight_dialog) UIManager:close(readerui) -- We haven't torn it down yet ReaderUI.instance = readerui UIManager:quit() end) UIManager:run() end local function tap_highlight_text(readerui, pos0, pos1, pos2) readerui.highlight:onHold(nil, { pos = pos0 }) readerui.highlight:onHoldPan(nil, { pos = pos1 }) readerui.highlight:onHoldRelease() readerui.highlight:onHighlight() readerui.highlight:clear() UIManager:close(readerui.highlight.highlight_dialog) readerui.highlight:onTap(nil, { pos = pos2 }) assert.truthy(readerui.highlight.edit_highlight_dialog) UIManager:nextTick(function() UIManager:close(readerui.highlight.edit_highlight_dialog) UIManager:close(readerui) -- We haven't torn it down yet ReaderUI.instance = readerui UIManager:quit() end) UIManager:run() end describe("highlight for EPUB documents", function() local page = 10 local readerui, selection_spy setup(function() local sample_epub = "spec/front/unit/data/juliet.epub" readerui = ReaderUI:new{ dimen = Screen:getSize(), document = DocumentRegistry:openDocument(sample_epub), } selection_spy = spy.on(readerui.languagesupport, "improveWordSelection") end) teardown(function() readerui:closeDocument() readerui:onClose() end) before_each(function() UIManager:quit() readerui.rolling:onGotoPage(page) UIManager:show(readerui) selection_spy:clear() --- @fixme HACK: Mock UIManager:run x and y for readerui.dimen --- @todo Refactor readerview's dimen handling so we can get rid of -- this workaround readerui:paintTo(Screen.bb, 0, 0) end) after_each(function() readerui.highlight:clear() end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 400, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_epub.png") assert.spy(selection_spy).was_called() assert.truthy(readerui.view.highlight.saved[page]) end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 400, y = 110 }, Geom:new{ x = 400, y = 170 }) Screen:shot("screenshots/reader_highlight_text_epub.png") assert.spy(selection_spy).was_called() assert.truthy(readerui.view.highlight.saved[page]) end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 130, y = 100 }, Geom:new{ x = 350, y = 395 }, Geom:new{ x = 80, y = 265 }) Screen:shot("screenshots/reader_tap_highlight_text_epub.png") assert.spy(selection_spy).was_called() end) end) describe("highlight for PDF documents in page mode", function() local readerui setup(function() local sample_pdf = "spec/front/unit/data/sample.pdf" readerui = ReaderUI:new{ dimen = Screen:getSize(), document = DocumentRegistry:openDocument(sample_pdf), } readerui:handleEvent(Event:new("SetScrollMode", false)) end) teardown(function() readerui:closeDocument() readerui:onClose() end) describe("for scanned page with text layer", function() before_each(function() UIManager:quit() UIManager:show(readerui) readerui.paging:onGotoPage(10) end) after_each(function() readerui.highlight:clear() end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }) Screen:shot("screenshots/reader_highlight_text_pdf.png") end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf.png") end) end) describe("for scanned page without text layer", function() before_each(function() UIManager:quit() UIManager:show(readerui) readerui.paging:onGotoPage(28) end) after_each(function() readerui.highlight:clear() end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf_scanned.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }) Screen:shot("screenshots/reader_highlight_text_pdf_scanned.png") end) it("should respond to tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf_scanned.png") end) end) describe("for reflowed page", function() before_each(function() UIManager:quit() readerui.document.configurable.text_wrap = 1 UIManager:show(readerui) readerui.paging:onGotoPage(31) end) after_each(function() readerui.highlight:clear() readerui.document.configurable.text_wrap = 0 UIManager:close(readerui) -- close to flush settings -- We haven't torn it down yet ReaderUI.instance = readerui end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf_reflowed.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }) Screen:shot("screenshots/reader_highlight_text_pdf_reflowed.png") end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf_reflowed.png") end) end) end) describe("highlight for PDF documents in scroll mode", function() local readerui setup(function() local sample_pdf = "spec/front/unit/data/sample.pdf" readerui = ReaderUI:new{ dimen = Screen:getSize(), document = DocumentRegistry:openDocument(sample_pdf), } readerui:handleEvent(Event:new("SetScrollMode", true)) end) teardown(function() readerui:closeDocument() readerui:onClose() end) describe("for scanned page with text layer", function() before_each(function() UIManager:quit() UIManager:show(readerui) readerui.paging:onGotoPage(10) readerui.zooming:setZoomMode("contentwidth") end) after_each(function() readerui.highlight:clear() end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf_scroll.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }) Screen:shot("screenshots/reader_highlight_text_pdf_scroll.png") end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf_scroll.png") end) end) describe("for scanned page without text layer", function() before_each(function() UIManager:quit() UIManager:show(readerui) readerui.paging:onGotoPage(28) readerui.zooming:setZoomMode("contentwidth") end) after_each(function() readerui.highlight:clear() end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf_scanned_scroll.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{x = 192, y = 186}, Geom:new{x = 280, y = 186}) Screen:shot("screenshots/reader_highlight_text_pdf_scanned_scroll.png") end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf_scanned_scroll.png") end) end) describe("for reflowed page", function() before_each(function() UIManager:quit() readerui.document.configurable.text_wrap = 1 UIManager:show(readerui) readerui.paging:onGotoPage(31) end) after_each(function() readerui.highlight:clear() readerui.document.configurable.text_wrap = 0 UIManager:close(readerui) -- close to flush settings -- We haven't torn it down yet ReaderUI.instance = readerui end) it("should highlight single word", function() highlight_single_word(readerui, Geom:new{ x = 260, y = 70 }) Screen:shot("screenshots/reader_highlight_single_word_pdf_reflowed_scroll.png") end) it("should highlight text", function() highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }) Screen:shot("screenshots/reader_highlight_text_pdf_reflowed_scroll.png") end) it("should response on tap gesture", function() tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 }) Screen:shot("screenshots/reader_tap_highlight_text_pdf_reflowed_scroll.png") end) end) end) end)
agpl-3.0
RunAwayDSP/darkstar
scripts/zones/Stellar_Fulcrum/npcs/_4z1.lua
27
1030
----------------------------------- -- Area: Stellar Fulcrum -- NPC: Qe'Lov Gate ------------------------------------- require("scripts/globals/status"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) player:startEvent(32003); return 1; end; function onEventUpdate(player,csid,option) -- printf("onUpdate CSID: %u",csid); -- printf("onUpdate RESULT: %u",option); end; function onEventFinish(player,csid,option) -- printf("onFinish CSID: %u",csid); -- printf("onFinish RESULT: %u",option); local pZone = player:getZoneID(); if (csid == 32003 and option == 4) then if (player:getCharVar(tostring(pZone) .. "_Fight") == 100) then player:setCharVar("BCNM_Killed",0); player:setCharVar("BCNM_Timer",0); end player:setCharVar(tostring(pZone) .. "_Runaway",1); player:delStatusEffect(dsp.effect.BATTLEFIELD); player:setCharVar(tostring(pZone) .. "_Runaway",0) end end;
gpl-3.0
lichtl/darkstar
scripts/globals/events/harvest_festivals.lua
3
11444
--------------------------------------------------------- --------------------------------------------------------- ------------ Harvest Festivals -------------------- --------------------------------------------------------- --------------------------------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); --------------------------------------------------------- --------------------------------------------------------- function isHalloweenEnabled() local option = 0; local month = tonumber(os.date("%m")); local day = tonumber(os.date("%d")); if (month == 10 and day >= 20 or month == 11 and day == 1 or HALLOWEEN_YEAR_ROUND ~= 0) then -- According to wiki Harvest Fest is Oct 20 - Nov 1. if (HALLOWEEN_2005 == 1) then option = 1; elseif (HALLOWEEN_2008 == 1) then option = 2; elseif (HALLOWEEN_2009 == 1) then option = 3; elseif (HALLOWEEN_2010 == 1) then option = 4; end end return option; end; function halloweenItemsCheck(player) local headSlot = player:getEquipID(SLOT_HEAD); local mainHand = player:getEquipID(SLOT_MAIN); local reward = 0; -- Normal Quality Rewards local pumpkinHead = 13916 local pumpkinHead2 = 15176; local trickStaff = 17565; local trickStaff2 = 17587; reward_list = {pumpkinHead,pumpkinHead2,trickStaff,trickStaff2}; -- Checks for HQ Upgrade for ri = 1, #reward_list do if (headSlot == reward_list[ri] or mainHand == reward_list[ri]) then if (headSlot == pumpkinHead and player:hasItem(13917) == false) then reward = 13917; -- Horror Head elseif (headSlot == pumpkinHead2 and player:hasItem(15177) == false) then reward = 15177; -- Horror Head II elseif (mainHand == trickStaff and player:hasItem(17566) == false) then reward = 17566; -- Treat Staff elseif (mainHand == trickStaff2 and player:hasItem(17588) == false) then reward = 17588; -- Treat Staff II end return reward; end end -- Checks the possible item rewards to ensure player doesnt already have the item we are about to give them local cnt = #reward_list; while cnt ~= 0 do local picked = reward_list[math.random(1,#reward_list)]; if (player:hasItem(picked) == false) then reward = picked; cnt = 0; else table.remove(reward_list,picked); cnt = cnt - 1; end return reward; end; end; function onHalloweenTrade(player,trade,npc) local zone = player:getZoneName(); local TextIDs = "scripts/zones/" .. zone .. "/TextIDs"; package.loaded[TextIDs] = nil; require(TextIDs); local contentEnabled = isHalloweenEnabled(); local item = trade:getItemId(); ------------------- -- 2005 edition --- ------------------- if (contentEnabled == 1) then ----------------------------------- -- Treats allowed ----------------------------------- treats_table = {4510, -- Acorn Cookie 5646, -- Bloody Chocolate 4496, -- Bubble Chocolate 4397, -- Cinna-cookie 4394, -- Ginger Cookie 4495, -- Goblin Chocolate 4413, -- Apple Pie 4488, -- Jack-o'-Pie 4421, -- Melon Pie 4563, -- Pamama Tart 4446, -- Pumpkin Pie 4414, -- Rolanberry Pie 4406, -- Baked Apple 5729, -- Bavarois 5745, -- Cherry Bavarois 5653, -- Cherry Muffin 5655, -- Coffee Muffin 5718, -- Cream Puff 5144, -- Crimson Jelly 5681, -- Cupid Chocolate 5672, -- Dried Berry 5567, -- Dried Date 4556, -- Icecap Rolanberry 5614, -- Konigskuchen 5230, -- Love Chocolate 4502, -- Marron Glace 4393, -- Orange Kuchen 5147, -- Snoll Gelato 4270, -- Sweet Rice Cake 5645, -- Witch Nougat 5552, -- Black Pudding --safe 5550, -- Buche au Chocolat -- safe @ 43 items 5616, -- Lebkuchen House --breaks 5633, -- Chocolate Cake 5542, -- Gateau aux Fraises 5572, -- Irmik Helvasi 5625, -- Maple Cake 5559, -- Mille Feuille 5557, -- Mont Blanc 5629, -- Orange Cake 5631, -- Pumpkin Cake 5577, -- Sutlac 5627}; -- Yogurt Cake for itemInList = 1, #treats_table do if (item == treats_table[itemInList]) then local itemReward = halloweenItemsCheck(player); local varName = "harvestFestTreats"; local harvestFestTreats; if (itemInList < 32) then -- The size of the list is too big for int 32 used that stores the bit mask, as such there are two lists harvestFestTreats = player:getVar(varName); else varName = "harvestFestTreats2"; harvestFestTreats = player:getVar(varName); -- this is the second list itemInList = itemInList - 32; end local AlreadyTradedChk = player:getMaskBit(harvestFestTreats,itemInList); if (itemReward ~= 0 and player:getFreeSlotsCount() >= 1 and math.random(1,3) < 2) then -- Math.random added so you have 33% chance on getting item player:messageSpecial(HERE_TAKE_THIS); player:addItem(itemReward); player:messageSpecial(ITEM_OBTAINED,itemReward); elseif (player:canUseCostume() and AlreadyTradedChk == false) then -- Other neat looking halloween type costumes -- two dragon skins: @420/421 -- @422 dancing weapon -- @ 433/432 golem -- 265 dark eye, 266 Giant version -- 290 dark bombs -- 301 dark mandy -- 313 black spiders -- 488 gob -- 531 - 548 shade -- 564/579 skele -- Possible costume values: Yagudo = math.random(580,607); Quadav = math.random(644,671); Shade = math.random(535,538); Orc = math.random(612,639); Ghost = 368; Hound = 365; Skeleton = 564; Dark_Stalker = math.random(531,534); halloween_costume_list = {Quadav,Orc,Yagudo,Shade,Ghost,Hound,Skeleton,Dark_Stalker}; local costumePicked = halloween_costume_list[math.random(1,#halloween_costume_list)]; -- will randomly pick one of the costumes in the list player:addStatusEffect(EFFECT_COSTUME,costumePicked,0,3600); -- pitchForkCostumeList defines the special costumes per zone that can trigger the pitch fork requirement -- zone, costumeID pitchForkCostumeList = {234,Shade,Skeleton, -- Bastok mines 235,Hound,Ghost, -- Bastok Markets 230,Ghost,Skeleton, -- Southern Sandoria 231,Hound,Skeleton, -- Northern Sandoria 241,Ghost,Shade, -- Windurst Woods 238,Shade,Hound}; -- Windurst Woods for zi = 1, #pitchForkCostumeList, 3 do if (zone == pitchForkCostumeList[zi] and (costumePicked == pitchForkCostumeList[zi + 1] or zone == pitchForkCostumeList[zi] and costumePicked == pitchForkCostumeList[zi + 2])) then -- Gives special hint for pitch fork costume player:messageSpecial(IF_YOU_WEAR_THIS); elseif (zi == 16) then player:messageSpecial(THANK_YOU_TREAT); end end else player:messageSpecial(THANK_YOU); end if (AlreadyTradedChk == false) then player:setMaskBit(harvestFestTreats,varName,itemInList,true); end player:tradeComplete(); break; end end end end; function applyHalloweenNpcCostumes(zoneid) if (isHalloweenEnabled() ~= 0) then -- npcID, skinID (skin ID can be found in mob_change_skin Sql table) local npc_costume_map = { [234] = { [17735787] = 40, -- Proud_Beard - Bastok Mines [17735742] = 41, -- Faustin - Bastok Mines [17814119] = 42, -- Aulavia - Bastok Mines [17735744] = 43, -- Mille - Bastok Mines [17735810] = 44 -- Emaliveulaux - Bastok Mines }, [235] = { [17739805] = 45 -- Olwyn - Bastok Markets }, [230] = { [17719306] = 46, -- Apairemant - Southern Sandoria [17719303] = 47, -- Machielle - Southern Sandoria [17719305] = 48, -- Phamelise - Southern Sandoria [17719485] = 49, -- Pourette - Southern Sandoria [17719304] = 50 -- Corua -- Southern Sandoria }, [231] = { [17723497] = 51, -- Attarena - Northern Sandoria [17723492] = 52, -- Antonian - Northern Sandoria [17723487] = 53 -- Vichuel - Northern Sandoria }, [241] = { [17764401] = 54, -- Kuzah_Hpirohpon - Windurst Woods [17764400] = 55, -- Meriri - Windurst Woods [17764464] = 56, -- Nhobi_Zalkia - Windurst Woods [17764465] = 57, -- Millerovieunet - Windurst Woods [17764462] = 58 -- Taraihi-Perunhi - Windurst Woods }, [238] = { [17752101] = 59, -- Ness_Rugetomal - Windurst Waters [17752098] = 60, -- Upih_Khachla - Windurst Waters [17752097] = 61, -- Ensasa - Windurst Waters [17752103] = 62, -- Ahyeekih - Windurst Waters [17752102] = 63 -- Maqu_Molpih - Windurst Waters } }; for id,skin in pairs(npc_costume_map[zoneid]) do local hfNpc = GetNPCByID(id); if (hfNpc ~= nil) then hfNpc:changeSkin(skin); end end end end;
gpl-3.0
lichtl/darkstar
scripts/zones/Southern_San_dOria/npcs/Melledanne.lua
14
1537
----------------------------------- -- Area: Southern San dOria -- NPC: Melledanne -- Type: Melody Minstrel NPC -- @zone 230 -- @pos -33.194 0.000 34.662 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then local count = trade:getItemCount(); local MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x03af); 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
mbattersby/LiteBag
LiteBagBank.lua
1
4665
--[[---------------------------------------------------------------------------- LiteBag/BankFrame.lua Copyright 2013-2020 Mike Battersby Released under the terms of the GNU General Public License version 2 (GPLv2). See the file LICENSE.txt. ----------------------------------------------------------------------------]]-- local addonName, LB = ... local BANK_BAG_IDS = { -1, 5, 6, 7, 8, 9, 10, 11 } function LiteBagBank_OnLoad(self) LiteBagFrame_OnLoad(self) local placer = self:GetParent() self.CloseButton:SetScript('OnClick', function () HideUIPanel(placer) end) self:RegisterEvent('ADDON_LOADED') end function LiteBagBank_Initialize(self) -- Basic slots panel for the bank slots local panel = CreateFrame('Frame', 'LiteBagBankPanel', self, 'LiteBagPanelTemplate') LiteBagPanel_Initialize(panel, BANK_BAG_IDS) panel.defaultColumns = 16 panel.canResize = true LiteBagFrame_AddPanel(self, panel, BankFrameTab1:GetText()) -- Attach in the other Blizzard bank panels. Note that we are also -- responsible for handling their events! for i = 2, #BANK_PANELS do local data = BANK_PANELS[i] panel = _G[data.name] panel:ClearAllPoints() panel:SetSize(data.size.x, data.size.y) LiteBagFrame_AddPanel(self, panel, _G['BankFrameTab'..i]:GetText()) end self.OnShowPanel = function (self, n) -- Use the title text from the Bank Frame itself BANK_PANELS[n].SetTitle() self.TitleText:SetText(BankFrameTitleText:GetText()) -- The itembuttons use BankFrame.selectedTab to know where -- to put something that's clicked. BankFrame.selectedTab = n -- The AutoSortButton uses activeTabIndex to know which tooltip to -- show (and what to sort, but we override that). BankFrame.activeTabIndex = n end -- Different inset texture for the bank self.Inset.Bg:SetTexture("Interface\\BankFrame\\Bank-Background", true, true) self.Inset.Bg:SetVertexColor(0.4, 0.4, 0.4, 1) -- Select the right search box self.searchBox = BankItemSearchBox self.sortButton = BankItemAutoSortButton -- Bank frame specific events self:RegisterEvent('BANKFRAME_OPENED') self:RegisterEvent('BANKFRAME_CLOSED') end function LiteBagBank_OnEvent(self, event, arg1, arg2, ...) LB.Debug(format("Bank OnEvent %s %s %s", event, tostring(arg1), tostring(arg2))) if event == 'ADDON_LOADED' then if arg1 == 'LiteBag' then LiteBagBank_Initialize(self) end elseif event == 'BANKFRAME_OPENED' then LiteBagFrame_ShowPanel(self, 1) ShowUIPanel(self:GetParent()) elseif event == 'BANKFRAME_CLOSED' then HideUIPanel(self:GetParent()) elseif event == 'INVENTORY_SEARCH_UPDATE' then ContainerFrame_UpdateSearchResults(ReagentBankFrame) elseif event == 'ITEM_LOCK_CHANGED' then -- bag, slot = arg1, arg2 if arg1 == REAGENTBANK_CONTAINER then local button = ReagentBankFrame['Item'..(arg2)] if button then BankFrameItemButton_UpdateLocked(button) end end elseif event == 'PLAYERREAGENTBANKSLOTS_CHANGED' then -- slot = arg1 local button = ReagentBankFrame['Item'..(arg1)] if button then BankFrameItemButton_Update(button) end elseif event == 'PLAYER_MONEY' then if self.selectedTab == 1 then LiteBagPanel_UpdateBagSlotCounts(LiteBagBankPanel) LiteBagPanel_UpdateSizeAndLayout(LiteBagBankPanel) LiteBagPanel_UpdateAllBags(LiteBagBankPanel) end end end -- Note that the reagent bank frame refreshes all its own slots in its -- OnShow handler so we don't have to do that for it. function LiteBagBank_OnShow(self) LiteBagFrame_OnShow(self) SetPortraitTexture(self.portrait, 'npc') self:RegisterEvent('PLAYERBANKSLOTS_CHANGED') self:RegisterEvent('PLAYERREAGENTBANKSLOTS_CHANGED') self:RegisterEvent('INVENTORY_SEARCH_UPDATE') self:RegisterEvent('ITEM_LOCK_CHANGED') self:RegisterEvent('PLAYER_MONEY') end function LiteBagBank_OnHide(self) -- Call this so the server knows we closed and it needs to send us a -- new BANKFRAME_OPENED event if we interact with the NPC again. CloseBankFrame() self:UnregisterEvent('PLAYERBANKSLOTS_CHANGED') self:UnregisterEvent('PLAYERREAGENTBANKSLOTS_CHANGED') self:UnregisterEvent('INVENTORY_SEARCH_UPDATE') self:UnregisterEvent('ITEM_LOCK_CHANGED') self:UnregisterEvent('PLAYER_MONEY') end
gpl-2.0
lichtl/darkstar
scripts/zones/Bastok_Mines/npcs/Deadly_Spider.lua
33
1388
----------------------------------- -- Area: Bastok Mines -- NPC: Deadly Spider -- Involved in Quest: Stamp Hunt ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local StampHunt = player:getQuestStatus(BASTOK,STAMP_HUNT); if (StampHunt == QUEST_ACCEPTED and player:getMaskBit(player:getVar("StampHunt_Mask"),0) == false) then player:startEvent(0x0056); else player:startEvent(0x0011); 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 == 0x0056) then player:setMaskBit(player:getVar("StampHunt_Mask"),"StampHunt_Mask",0,true); end end;
gpl-3.0
lc412/skynet
lualib/mysql.lua
31
15725
-- Copyright (C) 2012 Yichun Zhang (agentzh) -- Copyright (C) 2014 Chang Feng -- This file is modified version from https://github.com/openresty/lua-resty-mysql -- The license is under the BSD license. -- Modified by Cloud Wu (remove bit32 for lua 5.3) local socketchannel = require "socketchannel" local mysqlaux = require "mysqlaux.c" local crypt = require "crypt" local sub = string.sub local strgsub = string.gsub local strformat = string.format local strbyte = string.byte local strchar = string.char local strrep = string.rep local strunpack = string.unpack local strpack = string.pack local sha1= crypt.sha1 local setmetatable = setmetatable local error = error local tonumber = tonumber local new_tab = function (narr, nrec) return {} end local _M = { _VERSION = '0.13' } -- constants local STATE_CONNECTED = 1 local STATE_COMMAND_SENT = 2 local COM_QUERY = 0x03 local SERVER_MORE_RESULTS_EXISTS = 8 -- 16MB - 1, the default max allowed packet size used by libmysqlclient local FULL_PACKET_SIZE = 16777215 local mt = { __index = _M } -- mysql field value type converters local converters = new_tab(0, 8) for i = 0x01, 0x05 do -- tiny, short, long, float, double converters[i] = tonumber end converters[0x08] = tonumber -- long long converters[0x09] = tonumber -- int24 converters[0x0d] = tonumber -- year converters[0xf6] = tonumber -- newdecimal local function _get_byte2(data, i) return strunpack("<I2",data,i) end local function _get_byte3(data, i) return strunpack("<I3",data,i) end local function _get_byte4(data, i) return strunpack("<I4",data,i) end local function _get_byte8(data, i) return strunpack("<I8",data,i) end local function _set_byte2(n) return strpack("<I2", n) end local function _set_byte3(n) return strpack("<I3", n) end local function _set_byte4(n) return strpack("<I4", n) end local function _from_cstring(data, i) return strunpack("z", data, i) end local function _dumphex(bytes) return strgsub(bytes, ".", function(x) return strformat("%02x ", strbyte(x)) end) end local function _compute_token(password, scramble) if password == "" then return "" end --_dumphex(scramble) local stage1 = sha1(password) --print("stage1:", _dumphex(stage1) ) local stage2 = sha1(stage1) local stage3 = sha1(scramble .. stage2) local i = 0 return strgsub(stage3,".", function(x) i = i + 1 -- ~ is xor in lua 5.3 return strchar(strbyte(x) ~ strbyte(stage1, i)) end) end local function _compose_packet(self, req, size) self.packet_no = self.packet_no + 1 local packet = _set_byte3(size) .. strchar(self.packet_no) .. req return packet end local function _send_packet(self, req, size) local sock = self.sock self.packet_no = self.packet_no + 1 local packet = _set_byte3(size) .. strchar(self.packet_no) .. req return socket.write(self.sock,packet) end local function _recv_packet(self,sock) local data = sock:read( 4) if not data then return nil, nil, "failed to receive packet header: " end local len, pos = _get_byte3(data, 1) if len == 0 then return nil, nil, "empty packet" end if len > self._max_packet_size then return nil, nil, "packet size too big: " .. len end local num = strbyte(data, pos) self.packet_no = num data = sock:read(len) if not data then return nil, nil, "failed to read packet content: " end local field_count = strbyte(data, 1) local typ if field_count == 0x00 then typ = "OK" elseif field_count == 0xff then typ = "ERR" elseif field_count == 0xfe then typ = "EOF" elseif field_count <= 250 then typ = "DATA" end return data, typ end local function _from_length_coded_bin(data, pos) local first = strbyte(data, pos) if not first then return nil, pos end if first >= 0 and first <= 250 then return first, pos + 1 end if first == 251 then return nil, pos + 1 end if first == 252 then pos = pos + 1 return _get_byte2(data, pos) end if first == 253 then pos = pos + 1 return _get_byte3(data, pos) end if first == 254 then pos = pos + 1 return _get_byte8(data, pos) end return false, pos + 1 end local function _from_length_coded_str(data, pos) local len len, pos = _from_length_coded_bin(data, pos) if len == nil then return nil, pos end return sub(data, pos, pos + len - 1), pos + len end local function _parse_ok_packet(packet) local res = new_tab(0, 5) local pos res.affected_rows, pos = _from_length_coded_bin(packet, 2) res.insert_id, pos = _from_length_coded_bin(packet, pos) res.server_status, pos = _get_byte2(packet, pos) res.warning_count, pos = _get_byte2(packet, pos) local message = sub(packet, pos) if message and message ~= "" then res.message = message end return res end local function _parse_eof_packet(packet) local pos = 2 local warning_count, pos = _get_byte2(packet, pos) local status_flags = _get_byte2(packet, pos) return warning_count, status_flags end local function _parse_err_packet(packet) local errno, pos = _get_byte2(packet, 2) local marker = sub(packet, pos, pos) local sqlstate if marker == '#' then -- with sqlstate pos = pos + 1 sqlstate = sub(packet, pos, pos + 5 - 1) pos = pos + 5 end local message = sub(packet, pos) return errno, message, sqlstate end local function _parse_result_set_header_packet(packet) local field_count, pos = _from_length_coded_bin(packet, 1) local extra extra = _from_length_coded_bin(packet, pos) return field_count, extra end local function _parse_field_packet(data) local col = new_tab(0, 2) local catalog, db, table, orig_table, orig_name, charsetnr, length local pos catalog, pos = _from_length_coded_str(data, 1) db, pos = _from_length_coded_str(data, pos) table, pos = _from_length_coded_str(data, pos) orig_table, pos = _from_length_coded_str(data, pos) col.name, pos = _from_length_coded_str(data, pos) orig_name, pos = _from_length_coded_str(data, pos) pos = pos + 1 -- ignore the filler charsetnr, pos = _get_byte2(data, pos) length, pos = _get_byte4(data, pos) col.type = strbyte(data, pos) --[[ pos = pos + 1 col.flags, pos = _get_byte2(data, pos) col.decimals = strbyte(data, pos) pos = pos + 1 local default = sub(data, pos + 2) if default and default ~= "" then col.default = default end --]] return col end local function _parse_row_data_packet(data, cols, compact) local pos = 1 local ncols = #cols local row if compact then row = new_tab(ncols, 0) else row = new_tab(0, ncols) end for i = 1, ncols do local value value, pos = _from_length_coded_str(data, pos) local col = cols[i] local typ = col.type local name = col.name if value ~= nil then local conv = converters[typ] if conv then value = conv(value) end end if compact then row[i] = value else row[name] = value end end return row end local function _recv_field_packet(self, sock) local packet, typ, err = _recv_packet(self, sock) if not packet then return nil, err end if typ == "ERR" then local errno, msg, sqlstate = _parse_err_packet(packet) return nil, msg, errno, sqlstate end if typ ~= 'DATA' then return nil, "bad field packet type: " .. typ end -- typ == 'DATA' return _parse_field_packet(packet) end local function _recv_decode_packet_resp(self) return function(sock) -- don't return more than 2 results return true, (_recv_packet(self,sock)) end end local function _recv_auth_resp(self) return function(sock) local packet, typ, err = _recv_packet(self,sock) if not packet then --print("recv auth resp : failed to receive the result packet") error ("failed to receive the result packet"..err) --return nil,err end if typ == 'ERR' then local errno, msg, sqlstate = _parse_err_packet(packet) error( strformat("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate)) --return nil, errno,msg, sqlstate end if typ == 'EOF' then error "old pre-4.1 authentication protocol not supported" end if typ ~= 'OK' then error "bad packet type: " end return true, true end end local function _mysql_login(self,user,password,database) return function(sockchannel) local packet, typ, err = sockchannel:response( _recv_decode_packet_resp(self) ) --local aat={} if not packet then error( err ) end if typ == "ERR" then local errno, msg, sqlstate = _parse_err_packet(packet) error( strformat("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate)) end self.protocol_ver = strbyte(packet) local server_ver, pos = _from_cstring(packet, 2) if not server_ver then error "bad handshake initialization packet: bad server version" end self._server_ver = server_ver local thread_id, pos = _get_byte4(packet, pos) local scramble1 = sub(packet, pos, pos + 8 - 1) if not scramble1 then error "1st part of scramble not found" end pos = pos + 9 -- skip filler -- two lower bytes self._server_capabilities, pos = _get_byte2(packet, pos) self._server_lang = strbyte(packet, pos) pos = pos + 1 self._server_status, pos = _get_byte2(packet, pos) local more_capabilities more_capabilities, pos = _get_byte2(packet, pos) self._server_capabilities = self._server_capabilities|more_capabilities<<16 local len = 21 - 8 - 1 pos = pos + 1 + 10 local scramble_part2 = sub(packet, pos, pos + len - 1) if not scramble_part2 then error "2nd part of scramble not found" end local scramble = scramble1..scramble_part2 local token = _compute_token(password, scramble) local client_flags = 260047; local req = strpack("<I4I4c24zs1z", client_flags, self._max_packet_size, strrep("\0", 24), -- TODO: add support for charset encoding user, token, database) local packet_len = #req local authpacket=_compose_packet(self,req,packet_len) return sockchannel:request(authpacket,_recv_auth_resp(self)) end end local function _compose_query(self, query) self.packet_no = -1 local cmd_packet = strchar(COM_QUERY) .. query local packet_len = 1 + #query local querypacket = _compose_packet(self, cmd_packet, packet_len) return querypacket end local function read_result(self, sock) local packet, typ, err = _recv_packet(self, sock) if not packet then return nil, err --error( err ) end if typ == "ERR" then local errno, msg, sqlstate = _parse_err_packet(packet) return nil, msg, errno, sqlstate --error( strformat("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate)) end if typ == 'OK' then local res = _parse_ok_packet(packet) if res and res.server_status&SERVER_MORE_RESULTS_EXISTS ~= 0 then return res, "again" end return res end if typ ~= 'DATA' then return nil, "packet type " .. typ .. " not supported" --error( "packet type " .. typ .. " not supported" ) end -- typ == 'DATA' local field_count, extra = _parse_result_set_header_packet(packet) local cols = new_tab(field_count, 0) for i = 1, field_count do local col, err, errno, sqlstate = _recv_field_packet(self, sock) if not col then return nil, err, errno, sqlstate --error( strformat("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate)) end cols[i] = col end local packet, typ, err = _recv_packet(self, sock) if not packet then --error( err) return nil, err end if typ ~= 'EOF' then --error ( "unexpected packet type " .. typ .. " while eof packet is ".. "expected" ) return nil, "unexpected packet type " .. typ .. " while eof packet is ".. "expected" end -- typ == 'EOF' local compact = self.compact local rows = new_tab( 4, 0) local i = 0 while true do packet, typ, err = _recv_packet(self, sock) if not packet then --error (err) return nil, err end if typ == 'EOF' then local warning_count, status_flags = _parse_eof_packet(packet) if status_flags&SERVER_MORE_RESULTS_EXISTS ~= 0 then return rows, "again" end break end -- if typ ~= 'DATA' then -- return nil, 'bad row packet type: ' .. typ -- end -- typ == 'DATA' local row = _parse_row_data_packet(packet, cols, compact) i = i + 1 rows[i] = row end return rows end local function _query_resp(self) return function(sock) local res, err, errno, sqlstate = read_result(self,sock) if not res then local badresult ={} badresult.badresult = true badresult.err = err badresult.errno = errno badresult.sqlstate = sqlstate return true , badresult end if err ~= "again" then return true, res end local mulitresultset = {res} mulitresultset.mulitresultset = true local i =2 while err =="again" do res, err, errno, sqlstate = read_result(self,sock) if not res then return true, mulitresultset end mulitresultset[i]=res i=i+1 end return true, mulitresultset end end function _M.connect( opts) local self = setmetatable( {}, mt) local max_packet_size = opts.max_packet_size if not max_packet_size then max_packet_size = 1024 * 1024 -- default 1 MB end self._max_packet_size = max_packet_size self.compact = opts.compact_arrays local database = opts.database or "" local user = opts.user or "" local password = opts.password or "" local channel = socketchannel.channel { host = opts.host, port = opts.port or 3306, auth = _mysql_login(self,user,password,database ), } -- try connect first only once channel:connect(true) self.sockchannel = channel return self end function _M.disconnect(self) self.sockchannel:close() setmetatable(self, nil) end function _M.query(self, query) local querypacket = _compose_query(self, query) local sockchannel = self.sockchannel if not self.query_resp then self.query_resp = _query_resp(self) end return sockchannel:request( querypacket, self.query_resp ) end function _M.server_ver(self) return self._server_ver end function _M.quote_sql_str( str) return mysqlaux.quote_sql_str(str) end function _M.set_compact_arrays(self, value) self.compact = value end return _M
mit
taiha/luci
applications/luci-app-shairplay/luasrc/model/cbi/shairplay.lua
78
1789
-- Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com> -- Licensed to the public under the Apache License 2.0. m = Map("shairplay", "Shairplay", translate("Shairplay is a simple AirPlay server implementation, here you can configure the settings.")) s = m:section(TypedSection, "shairplay", "") s.addremove = true s.anonymous = false enable=s:option(Flag, "disabled", translate("Enabled")) enable.enabled="0" enable.disabled="1" enable.default = "1" enable.rmempty = false respawn=s:option(Flag, "respawn", translate("Respawn")) respawn.default = false apname = s:option(Value, "apname", translate("Airport Name")) apname.rmempty = true port=s:option(Value, "port", translate("Port")) port.rmempty = true port.datatype = "port" pw = s:option(Value, "password", translate("Password")) pw.rmempty = true pw.password = true hwaddr=s:option(Value, "hwaddr", translate("HW Address")) hwaddr.rmempty = true hwaddr.datatype = "macaddr" ao_driver=s:option(ListValue, "ao_driver", translate("AO Driver")) ao_driver:value("", translate("Default")) ao_driver:value("alsa") --ao_driver:value("alsa05") --ao_driver:value("arts") --ao_driver:value("esd") --ao_driver:value("irix") --ao_driver:value("nas") ao_driver:value("oss") --ao_driver:value("sun") ao_devicename=s:option(Value, "ao_devicename", translate("AO Device Name")) ao_devicename.rmempty = true ao_deviceid = s:option(ListValue, "ao_deviceid", translate("AO Device ID")) ao_deviceid.rmempty = true ao_deviceid:value("", translate("Default")) local pats = io.popen("find /proc/asound/ -type d -name 'card*' | sort") if pats then local l while true do l = pats:read("*l") if not l then break end l = string.gsub(l, "/proc/asound/card", "") if l then ao_deviceid:value(l) end end pats:close() end return m
apache-2.0