repo_name
stringlengths
6
78
path
stringlengths
4
206
copies
stringclasses
281 values
size
stringlengths
4
7
content
stringlengths
625
1.05M
license
stringclasses
15 values
thegrb93/wire
lua/entities/gmod_wire_egp/cl_init.lua
2
1739
include('shared.lua') ENT.gmod_wire_egp = true function ENT:Initialize() self.GPU = GPULib.WireGPU( self ) self.GPU.texture_filtering = TEXFILTER.ANISOTROPIC self.RenderTable = {} self:EGP_Update( EGP.HomeScreen ) end function ENT:EGP_Update( Table ) self.NeedsUpdate = true self.NextUpdate = Table end function ENT:_EGP_Update( bool ) self.NeedsUpdate = nil local Table = self.NextUpdate or self.RenderTable if not Table then return end self.UpdateConstantly = nil self.GPU:RenderToGPU( function() render.Clear( 0, 0, 0, 255 ) --render.ClearRenderTarget( 0, 0, 0, 0 ) local currentfilter = self.GPU.texture_filtering local mat = self:GetEGPMatrix() for k,v in pairs( Table ) do if (v.parent == -1) then self.UpdateConstantly = true end -- Check if an object is parented to the cursor if (v.parent and v.parent != 0) then if (!v.IsParented) then EGP:SetParent( self, v.index, v.parent ) end local _, data = EGP:GetGlobalPos( self, v.index ) EGP:EditObject( v, data ) elseif ((!v.parent or v.parent == 0) and v.IsParented) then EGP:UnParent( self, v.index ) end local oldtex = EGP:SetMaterial( v.material ) if v.filtering != currentfilter then render.PopFilterMin() render.PopFilterMag() render.PushFilterMag(v.filtering) render.PushFilterMin(v.filtering) currentfilter = v.filtering end v:Draw(self, mat) EGP:FixMaterial( oldtex ) end end) end function ENT:GetEGPMatrix() return Matrix() end function ENT:DrawEntityOutline() end function ENT:Draw() self:DrawModel() Wire_Render(self) if self.UpdateConstantly or self.NeedsUpdate then self:_EGP_Update() end self.GPU:Render() end function ENT:OnRemove() self.GPU:Finalize() end
apache-2.0
dr01d3r/darkstar
scripts/zones/Port_Bastok/npcs/Tete.lua
17
1303
----------------------------------- -- Area: Port Bastok -- NPC: Tete -- Continues Quest: The Wisdom Of Elders ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ------------------------------------ require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(BASTOK,THE_WISDOM_OF_ELDERS) == QUEST_ACCEPTED) then player:startEvent(0x00af); else player:startEvent(0x0023); 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 == 0x00af) then player:setVar("TheWisdomVar",2); end end;
gpl-3.0
thegrb93/wire
lua/entities/gmod_wire_consolescreen/cl_init.lua
2
14117
include("shared.lua") function ENT:Initialize() self.Memory1 = {} self.Memory2 = {} for i = 0, 2047 do self.Memory1[i] = 0 end -- Caching control: -- [2020] - Force cache refresh -- [2021] - Cached blocks size (up to 28, 0 if disabled) -- -- Hardware image control: -- [2019] - Clear viewport defined by 2031-2034 -- [2022] - Screen ratio (read only) -- [2023] - Hardware scale -- [2024] - Rotation (0 - 0*, 1 - 90*, 2 - 180*, 3 - 270*) -- [2025] - Brightness White -- [2026] - Brightness B -- [2027] - Brightness G -- [2028] - Brightness R -- [2029] - Vertical scale (1) -- [2030] - Horizontal scale (1) -- -- Shifting control: -- [2031] - Low shift column -- [2032] - High shift column -- [2033] - Low shift row -- [2034] - High shift row -- -- Character output control: -- [2035] - Charset, always 0 -- [2036] - Brightness (additive) -- -- Control registers: -- [2037] - Shift cells (number of cells, >0 right, <0 left) -- [2038] - Shift rows (number of rows, >0 shift up, <0 shift down) -- [2039] - Hardware Clear Row (Writing clears row) -- [2040] - Hardware Clear Column (Writing clears column) -- [2041] - Hardware Clear Screen -- [2042] - Hardware Background Color (000) -- -- Cursor control: -- [2043] - Cursor Blink Rate (0.50) -- [2044] - Cursor Size (0.25) -- [2045] - Cursor Address -- [2046] - Cursor Enabled -- -- [2047] - Clk self.Memory1[2022] = 3/4 self.Memory1[2023] = 0 self.Memory1[2024] = 0 self.Memory1[2025] = 1 self.Memory1[2026] = 1 self.Memory1[2027] = 1 self.Memory1[2028] = 1 self.Memory1[2029] = 1 self.Memory1[2030] = 1 self.Memory1[2031] = 0 self.Memory1[2032] = 29 self.Memory1[2033] = 0 self.Memory1[2034] = 17 self.Memory1[2035] = 0 self.Memory1[2036] = 0 self.Memory1[2042] = 0 self.Memory1[2043] = 0.5 self.Memory1[2044] = 0.25 self.Memory1[2045] = 0 self.Memory1[2046] = 0 for i = 0, 2047 do self.Memory2[i] = self.Memory1[i] end self.LastClk = false self.PrevTime = CurTime() self.IntTimer = 0 self.NeedRefresh = true self.Flash = false self.FrameNeedsFlash = false self.FramesSinceRedraw = 0 self.NewClk = true self.GPU = WireGPU(self) -- Setup caching GPULib.ClientCacheCallback(self,function(Address,Value) self:WriteCell(Address,Value) end) WireLib.netRegister(self) end function ENT:OnRemove() self.GPU:Finalize() self.NeedRefresh = true end function ENT:ReadCell(Address,value) if Address < 0 then return nil end if Address >= 2048 then return nil end return self.Memory2[Address] end function ENT:WriteCell(Address,value) if Address < 0 then return false end if Address >= 2048 then return false end if Address == 2047 then self.NewClk = value ~= 0 end if self.NewClk then self.Memory1[Address] = value -- Vis mem self.NeedRefresh = true end self.Memory2[Address] = value -- Invis mem -- 2038 - Shift rows (number of rows, >0 shift down, <0 shift up) -- 2039 - Hardware Clear Row (Writing clears row) -- 2040 - Hardware Clear Column (Writing clears column) -- 2041 - Hardware Clear Screen if (Address == 2025) or (Address == 2026) or (Address == 2027) or (Address == 2028) or (Address == 2036) then self.NeedRefresh = true end if Address == 2019 then local low = math.floor(math.Clamp(self.Memory1[2033],0,17)) local high = math.floor(math.Clamp(self.Memory1[2034],0,17)) local lowc = math.floor(math.Clamp(self.Memory1[2031],0,29)) local highc = math.floor(math.Clamp(self.Memory1[2032],0,29)) for j = low, high do for i = 2*lowc, 2*highc+1 do self.Memory1[60*j+i] = 0 self.Memory2[60*j+i] = 0 end end self.NeedRefresh = true end if Address == 2037 then local delta = math.floor(math.Clamp(math.abs(value),-30,30)) local low = math.floor(math.Clamp(self.Memory1[2033],0,17)) local high = math.floor(math.Clamp(self.Memory1[2034],0,17)) local lowc = math.floor(math.Clamp(self.Memory1[2031],0,29)) local highc = math.floor(math.Clamp(self.Memory1[2032],0,29)) if (value > 0) then for j = low,high do for i = highc,lowc+delta,-1 do if (self.NewClk) then self.Memory1[j*60+i*2] = self.Memory1[j*60+(i-delta)*2] self.Memory1[j*60+i*2+1] = self.Memory1[j*60+(i-delta)*2+1] end self.Memory2[j*60+i*2] = self.Memory2[j*60+(i-delta)*2] self.Memory2[j*60+i*2+1] = self.Memory2[j*60+(i-delta)*2+1] end end for j = low,high do for i = lowc, lowc+delta-1 do if (self.NewClk) then self.Memory1[j*60+i*2] = 0 self.Memory1[j*60+i*2+1] = 0 end self.Memory2[j*60+i*2] = 0 self.Memory2[j*60+i*2+1] = 0 end end else for j = low,high do for i = lowc,highc-delta do if (self.NewClk) then self.Memory1[j*60+i*2] = self.Memory1[j*60+i*2+delta*2] self.Memory1[j*60+i*2+1] = self.Memory1[j*60+i*2+1+delta*2] end self.Memory2[j*60+i*2] = self.Memory2[j*60+i*2+delta*2] self.Memory2[j*60+i*2+1] = self.Memory2[j*60+i*2+1+delta*2] end end for j = low,high do for i = highc-delta+1,highc do if (self.NewClk) then self.Memory1[j*60+i*2] = 0 self.Memory1[j*60+i*2+1] = 0 end self.Memory2[j*60+i*2] = 0 self.Memory2[j*60+i*2+1] = 0 end end end end if Address == 2038 then local delta = math.floor(math.Clamp(math.abs(value),-30,30)) local low = math.floor(math.Clamp(self.Memory1[2033],0,17)) local high = math.floor(math.Clamp(self.Memory1[2034],0,17)) local lowc = math.floor(math.Clamp(self.Memory1[2031],0,29)) local highc = math.floor(math.Clamp(self.Memory1[2032],0,29)) if (value > 0) then for j = low, high-delta do for i = 2*lowc,2*highc+1 do if (self.NewClk) then self.Memory1[j*60+i] = self.Memory1[(j+delta)*60+i] end self.Memory2[j*60+i] = self.Memory2[(j+delta)*60+i] end end for j = high-delta+1,high do for i = 2*lowc, 2*highc+1 do if (self.NewClk) then self.Memory1[j*60+i] = 0 end self.Memory2[j*60+i] = 0 end end else for j = high,low+delta,-1 do for i = 2*lowc, 2*highc+1 do if (self.NewClk) then self.Memory1[j*60+i] = self.Memory1[(j-delta)*60+i] end self.Memory2[j*60+i] = self.Memory2[(j-delta)*60+i] end end for j = low,low+delta-1 do for i = 2*lowc, 2*highc+1 do if (self.NewClk) then self.Memory1[j*60+i] = 0 end self.Memory2[j*60+i] = 0 end end end end if Address == 2039 then for i = 0, 59 do self.Memory1[value*60+i] = 0 self.Memory2[value*60+i] = 0 end self.NeedRefresh = true end if Address == 2040 then for i = 0, 17 do self.Memory1[i*60+value] = 0 self.Memory2[i*60+value] = 0 end self.NeedRefresh = true end if Address == 2041 then for i = 0, 18*30*2-1 do self.Memory1[i] = 0 self.Memory2[i] = 0 end self.NeedRefresh = true end if self.LastClk ~= self.NewClk then self.LastClk = self.NewClk self.Memory1 = table.Copy(self.Memory2) -- swap the memory if clock changes self.NeedRefresh = true end return true end local specialCharacters = { [128] = { { x = 0, y = 1 }, { x = 1, y = 1 }, { x = 1, y = 0 }, }, [129] = { { x = 0, y = 1 }, { x = 0, y = 0 }, { x = 1, y = 1 }, }, [130] = { { x = 0, y = 1 }, { x = 1, y = 0 }, { x = 0, y = 0 }, }, [131] = { { x = 0, y = 0 }, { x = 1, y = 0 }, { x = 1, y = 1 }, }, } function ENT:DrawSpecialCharacter(c,x,y,w,h,r,g,b) surface.SetDrawColor(r,g,b,255) surface.SetTexture(0) local vertices = specialCharacters[c] if vertices then local vertexData = { { x = vertices[1].x*w+x, y = vertices[1].y*h+y }, { x = vertices[2].x*w+x, y = vertices[2].y*h+y }, { x = vertices[3].x*w+x, y = vertices[3].y*h+y }, } surface.DrawPoly(vertexData) end end function ENT:Draw() self:DrawModel() local curtime = CurTime() local DeltaTime = curtime - self.PrevTime self.PrevTime = curtime self.IntTimer = self.IntTimer + DeltaTime self.FramesSinceRedraw = self.FramesSinceRedraw + 1 if self.NeedRefresh == true then self.FramesSinceRedraw = 0 self.NeedRefresh = false self.FrameNeedsFlash = false if self.Memory1[2046] >= 1 then self.FrameNeedsFlash = true end self.GPU:RenderToGPU(function() -- Draw terminal here -- W/H = 16 local szx = 512/31 local szy = 512/19 local ch = self.Memory1[2042] local hb = 28*math.fmod(ch, 10)*self.Memory1[2026]*self.Memory1[2025] + self.Memory1[2036] local hg = 28*math.fmod(math.floor(ch / 10), 10)*self.Memory1[2027]*self.Memory1[2025] + self.Memory1[2036] local hr = 28*math.fmod(math.floor(ch / 100),10)*self.Memory1[2028]*self.Memory1[2025] + self.Memory1[2036] surface.SetDrawColor(hr,hg,hb,255) surface.DrawRect(0,0,512,512) for ty = 0, 17 do for tx = 0, 29 do local a = tx + ty*30 local c1 = self.Memory1[2*a] local c2 = self.Memory1[2*a+1] local cback = math.floor(c2 / 1000) local cfrnt = c2 - math.floor(c2 / 1000)*1000 local fb = math.Clamp(28*math.fmod(cfrnt, 10)*self.Memory1[2026]*self.Memory1[2025] + self.Memory1[2036],0,255) local fg = math.Clamp(28*math.fmod(math.floor(cfrnt / 10), 10)*self.Memory1[2027]*self.Memory1[2025] + self.Memory1[2036],0,255) local fr = math.Clamp(28*math.fmod(math.floor(cfrnt / 100),10)*self.Memory1[2028]*self.Memory1[2025] + self.Memory1[2036],0,255) local bb = math.Clamp(28*math.fmod(cback, 10)*self.Memory1[2026]*self.Memory1[2025] + self.Memory1[2036],0,255) local bg = math.Clamp(28*math.fmod(math.floor(cback / 10), 10)*self.Memory1[2027]*self.Memory1[2025] + self.Memory1[2036],0,255) local br = math.Clamp(28*math.fmod(math.floor(cback / 100),10)*self.Memory1[2028]*self.Memory1[2025] + self.Memory1[2036],0,255) if (self.Flash == true) and (cback > 999) then fb,bb = bb,fb fg,bg = bg,fg fr,br = br,fr end if cback > 999 then self.FrameNeedsFlash = true end if c1 >= 2097152 then c1 = 0 end if c1 < 0 then c1 = 0 end if cback ~= 0 then surface.SetDrawColor(br,bg,bb,255) surface.DrawRect(tx*szx+szx/2,ty*szy+szy/2,szx*1.2,szy*1.2) else surface.SetDrawColor(hr,hg,hb,255) surface.DrawRect(tx*szx+szx/2,ty*szy+szy/2,szx*1.2,szy*1.2) end if (c1 ~= 0) and (cfrnt ~= 0) then -- Note: the source engine does not handle unicode characters above 65535 properly. local utf8 = "" if c1 <= 127 then utf8 = string.char (c1) elseif c1 < 2048 then utf8 = string.format("%c%c", 192 + math.floor (c1 / 64), 128 + (c1 % 64)) elseif c1 < 65536 then utf8 = string.format("%c%c%c", 224 + math.floor (c1 / 4096), 128 + (math.floor (c1 / 64) % 64), 128 + (c1 % 64)) elseif c1 < 2097152 then utf8 = string.format("%c%c%c%c", 240 + math.floor (c1 / 262144), 128 + (math.floor (c1 / 4096) % 64), 128 + (math.floor (c1 / 64) % 64), 128 + (c1 % 64)) end if specialCharacters[c1] then self:DrawSpecialCharacter( c1, (tx+0.5)*szx, (ty+0.5)*szy, szx, szy, fr,fg,fb ) else draw.DrawText( utf8, "WireGPU_ConsoleFont", (tx + 0.625) * szx, (ty + 0.75) * szy, Color(fr,fg,fb,255),0 ) end end end end if self.Memory1[2045] > 1080 then self.Memory1[2045] = 1080 end if self.Memory1[2045] < 0 then self.Memory1[2045] = 0 end if self.Memory1[2044] > 1 then self.Memory1[2044] = 1 end if self.Memory1[2044] < 0 then self.Memory1[2044] = 0 end if self.Memory1[2046] >= 1 then if self.Flash == true then local a = math.floor(self.Memory1[2045] / 2) local tx = a - math.floor(a / 30)*30 local ty = math.floor(a / 30) local c = self.Memory1[2*a+1] local cback = 999-math.floor(c / 1000) local bb = 28*math.fmod(cback,10) local bg = 28*math.fmod(math.floor(cback / 10),10) local br = 28*math.fmod(math.floor(cback / 100),10) surface.SetDrawColor( math.Clamp(br*self.Memory1[2028]*self.Memory1[2025],0,255), math.Clamp(bg*self.Memory1[2027]*self.Memory1[2025],0,255), math.Clamp(bb*self.Memory1[2026]*self.Memory1[2025],0,255), 255 ) surface.DrawRect( tx*szx+szx/2, ty*szy+szy/2+szy*1.2*(1-self.Memory1[2044]), szx*1.2, szy*1.2*self.Memory1[2044] ) end end end) end if self.FrameNeedsFlash == true then if self.IntTimer < self.Memory1[2043] then if (self.Flash == false) then self.NeedRefresh = true end self.Flash = true end if self.IntTimer >= self.Memory1[2043] then if self.Flash == true then self.NeedRefresh = true end self.Flash = false end if self.IntTimer >= self.Memory1[2043]*2 then self.IntTimer = 0 end end self.GPU:Render(self.Memory1[2024],self.Memory1[2023]) Wire_Render(self) end function ENT:IsTranslucent() return true end
apache-2.0
dr01d3r/darkstar
scripts/zones/Gustav_Tunnel/Zone.lua
11
1655
----------------------------------- -- -- Zone: Gustav Tunnel (212) -- ----------------------------------- package.loaded["scripts/zones/Gustav_Tunnel/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Gustav_Tunnel/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/zone"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) -- Bune SetRespawnTime(17645578, 900, 10800); 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(-260.013,-21.802,-276.352,205); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/RuAun_Gardens/npcs/HomePoint#3.lua
27
1266
----------------------------------- -- Area: RuAun_Gardens -- NPC: HomePoint#3 -- @pos -312 -42 -422 130 ----------------------------------- package.loaded["scripts/zones/RuAun_Gardens/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/RuAun_Gardens/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fe, 61); 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 == 0x21fe) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Windurst_Woods/npcs/Gioh_Ajihri.lua
28
2994
----------------------------------- -- Area: Windurst Woods -- NPC: Gioh Ajihri -- Starts & Finishes Repeatable Quest: Twinstone Bonding ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) GiohAijhriSpokenTo = player:getVar("GiohAijhriSpokenTo"); NeedToZone = player:needToZone(); if (GiohAijhriSpokenTo == 1 and NeedToZone == false) then count = trade:getItemCount(); TwinstoneEarring = trade:hasItemQty(13360,1); if (TwinstoneEarring == true and count == 1) then player:startEvent(0x01ea); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TwinstoneBonding = player:getQuestStatus(WINDURST,TWINSTONE_BONDING); Fame = player:getFameLevel(WINDURST); if (TwinstoneBonding == QUEST_COMPLETED) then if (player:needToZone()) then player:startEvent(0x01eb,0,13360); else player:startEvent(0x01e8,0,13360); end elseif (TwinstoneBonding == QUEST_ACCEPTED) then player:startEvent(0x01e8,0,13360); elseif (TwinstoneBonding == QUEST_AVAILABLE and Fame >= 2) then player:startEvent(0x01e7,0,13360); else player:startEvent(0x01a8); 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 == 0x01e7) then player:addQuest(WINDURST,TWINSTONE_BONDING); player:setVar("GiohAijhriSpokenTo",1); elseif (csid == 0x01ea) then TwinstoneBonding = player:getQuestStatus(WINDURST,TWINSTONE_BONDING); player:tradeComplete(); player:needToZone(true); player:setVar("GiohAijhriSpokenTo",0); if (TwinstoneBonding == QUEST_ACCEPTED) then player:completeQuest(WINDURST,TWINSTONE_BONDING); player:addFame(WINDURST,80); player:addItem(17154); player:messageSpecial(ITEM_OBTAINED,17154); player:addTitle(BOND_FIXER); else player:addFame(WINDURST,10); player:addGil(GIL_RATE*900); player:messageSpecial(GIL_OBTAINED,GIL_RATE*900); end elseif (csid == 0x01e8) then player:setVar("GiohAijhriSpokenTo",1); end end;
gpl-3.0
SOCLE15/mMediaWiki
extensions/Scribunto/engines/LuaCommon/lualib/mw.site.lua
6
2264
local site = {} function site.setupInterface( info ) -- Boilerplate site.setupInterface = nil local php = mw_interface mw_interface = nil site.siteName = info.siteName site.server = info.server site.scriptPath = info.scriptPath site.stylePath = info.stylePath site.currentVersion = info.currentVersion site.stats = info.stats site.stats.pagesInCategory = php.pagesInCategory site.stats.pagesInNamespace = php.pagesInNamespace site.stats.usersInGroup = php.usersInGroup site.interwikiMap = php.interwikiMap -- Process namespace list into more useful tables site.namespaces = {} local namespacesByName = {} site.subjectNamespaces = {} site.talkNamespaces = {} site.contentNamespaces = {} for ns, data in pairs( info.namespaces ) do data.subject = info.namespaces[data.subject] data.talk = info.namespaces[data.talk] data.associated = info.namespaces[data.associated] site.namespaces[ns] = data namespacesByName[data.name] = data if data.canonicalName then namespacesByName[data.canonicalName] = data end for i = 1, #data.aliases do namespacesByName[data.aliases[i]] = data end if data.isSubject then site.subjectNamespaces[ns] = data end if data.isTalk then site.talkNamespaces[ns] = data end if data.isContent then site.contentNamespaces[ns] = data end end -- Set __index for namespacesByName to handle names-with-underscores -- and non-standard case local getNsIndex = php.getNsIndex setmetatable( namespacesByName, { __index = function ( t, k ) if type( k ) == 'string' then -- Try with fixed underscores k = string.gsub( k, '_', ' ' ) if rawget( t, k ) then return rawget( t, k ) end -- Ask PHP, because names are case-insensitive local ns = getNsIndex( k ) if ns then rawset( t, k, site.namespaces[ns] ) end end return rawget( t, k ) end } ) -- Set namespacesByName as the lookup table for site.namespaces, so -- something like site.namespaces.Wikipedia works without having -- pairs( site.namespaces ) iterate all those names. setmetatable( site.namespaces, { __index = namespacesByName } ) -- Register this library in the "mw" global mw = mw or {} mw.site = site package.loaded['mw.site'] = site end return site
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c27873305.lua
2
2876
--DDD怒濤壊薙王カエサル・ラグナロク function c27873305.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x10af),2,true) --tohand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(c27873305.condition) e1:SetTarget(c27873305.target) e1:SetOperation(c27873305.operation) c:RegisterEffect(e1) end function c27873305.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (Duel.GetAttacker()==c or Duel.GetAttackTarget()==c) end function c27873305.thfilter(c) return c:IsFaceup() and (c:IsSetCard(0xaf) or c:IsSetCard(0xae)) and c:IsAbleToHand() end function c27873305.eqfilter(c) return c:IsFaceup() and c:IsAbleToChangeControler() end function c27873305.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and c27873305.thfilter(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(c27873305.thfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) and Duel.IsExistingMatchingCard(c27873305.eqfilter,tp,0,LOCATION_MZONE,1,e:GetHandler():GetBattleTarget()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g1=Duel.SelectTarget(tp,c27873305.thfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,1-tp,LOCATION_MZONE) end function c27873305.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)~=0 then Duel.ConfirmCards(1-tp,tc) local bc=c:GetBattleTarget() if c:IsFaceup() and c:IsRelateToEffect(e) and bc:IsRelateToBattle() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,c27873305.eqfilter,tp,0,LOCATION_MZONE,1,1,bc) local ec=g:GetFirst() if not ec then return end local atk=ec:GetTextAttack() if atk<0 then atk=0 end if not Duel.Equip(tp,ec,c,false) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetValue(c27873305.eqlimit) ec:RegisterEffect(e1) if atk>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESET_EVENT+0x1fe0000) e2:SetValue(atk) ec:RegisterEffect(e2) end end end end function c27873305.eqlimit(e,c) return e:GetOwner()==c end
gpl-2.0
dr01d3r/darkstar
scripts/zones/Buburimu_Peninsula/npcs/Signpost.lua
13
1438
----------------------------------- -- Area: Buburimu Peninsula -- NPC: Signpost ----------------------------------- package.loaded["scripts/zones/Buburimu_Peninsula/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Buburimu_Peninsula/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (npc:getID() == 17261165) then player:messageSpecial(SIGN_5); elseif (npc:getID() == 17261166) then player:messageSpecial(SIGN_4); elseif (npc:getID() == 17261167) then player:messageSpecial(SIGN_3); elseif (npc:getID() == 17261168) then player:messageSpecial(SIGN_2); elseif (npc:getID() == 17261169) or (npc:getID() == 17261170) or (npc:getID() == 17261171) then player:messageSpecial(SIGN_1); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --print("CSID: %u",csid); --print("RESULT: %u",option); end;
gpl-3.0
dr01d3r/darkstar
scripts/globals/mobskills/Sweeping_Flail.lua
39
1067
--------------------------------------------------- -- Sweeping Flail -- Family: Bahamut -- Description: Spins around to deal physical damage to enemies behind user. Additional effect: Knockback -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows -- Range: 20' cone -- Notes: Used when someone pulls hate from behind Bahamut. --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------------- function onMobSkillCheck(target,mob,skill) if (target:isBehind(mob, 55) == false) then return 1; else return 0; end; end; function onMobWeaponSkill(target, mob, skill) local numhits = 1; local accmod = 1; local dmgmod = 2; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,MOBPARAM_3_SHADOW); target:delHP(dmg); return dmg; end;
gpl-3.0
dr01d3r/darkstar
scripts/globals/items/chunk_of_orobon_meat.lua
12
1600
----------------------------------------- -- ID: 5563 -- Item: Chunk of Orobon Meat -- Effect: 5 Minutes, food effect, Galka Only ----------------------------------------- -- HP 10 -- MP -10 -- Strength +6 -- Intelligence -8 -- Demon Killer 10 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 8) then result = 247; end if (target:getMod(MOD_EAT_RAW_MEAT) == 1) then result = 0; end if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,5563); end; ----------------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_MP, -10); target:addMod(MOD_STR, 6); target:addMod(MOD_INT, -8); target:addMod(MOD_DEMON_KILLER, 10); end; ----------------------------------------- -- onEffectLose Action ----------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_MP, -10); target:delMod(MOD_STR, 6); target:delMod(MOD_INT, -8); target:delMod(MOD_DEMON_KILLER, 10); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c96875080.lua
6
1531
--大気圏外射撃 function c96875080.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCost(c96875080.cost) e1:SetTarget(c96875080.target) e1:SetOperation(c96875080.activate) c:RegisterEffect(e1) end function c96875080.cfilter(c) return c:IsFaceup() and c:IsSetCard(0xc) and c:IsAbleToGraveAsCost() end function c96875080.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c96875080.cfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c96875080.cfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c96875080.filter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) end function c96875080.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c96875080.filter(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(c96875080.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c96875080.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c96875080.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
joev/SVUI-Temp
SVUI_UnitFrames/libs/oUF/elements/castbar.lua
3
14537
--[[ Element: Cast Bar THIS FILE HEAVILY MODIFIED FOR USE WITH SUPERVILLAIN UI ]] --GLOBAL NAMESPACE local _G = _G; --LUA local unpack = _G.unpack; local select = _G.select; local assert = _G.assert; local error = _G.error; local print = _G.print; local pairs = _G.pairs; local next = _G.next; local tostring = _G.tostring; local setmetatable = _G.setmetatable; --STRING local string = _G.string; local format = string.format; --MATH local math = _G.math; local floor = math.floor local ceil = math.ceil --BLIZZARD API local GetTime = _G.GetTime; local CreateFrame = _G.CreateFrame; local GetNetStats = _G.GetNetStats; local UnitCastingInfo = _G.UnitCastingInfo; local UnitChannelInfo = _G.UnitChannelInfo; --local GetTradeskillRepeatCount = _G.GetTradeskillRepeatCount; local CastingBarFrame = _G.CastingBarFrame; local PetCastingBarFrame = _G.PetCastingBarFrame; local parent, ns = ... local oUF = ns.oUF local updateSafeZone = function(self) local sz = self.SafeZone local width = self:GetWidth() local _, _, _, ms = GetNetStats() -- Guard against GetNetStats returning latencies of 0. if(ms ~= 0) then -- MADNESS! local safeZonePercent = (width / self.max) * (ms / 1e5) if(safeZonePercent > 1) then safeZonePercent = 1 end sz:SetWidth(width * safeZonePercent) sz:Show() else sz:Hide() end end local UNIT_SPELLCAST_SENT = function (self, event, unit, spell, rank, target) local castbar = self.Castbar castbar.curTarget = (target and target ~= "") and target or nil end local UNIT_SPELLCAST_START = function(self, event, unit, spell) if(self.unit ~= unit) or not unit then return end local castbar = self.Castbar local name, _, text, texture, startTime, endTime, tradeskill, castid, interrupt = UnitCastingInfo(unit) if(not name) then castbar:Hide() return end endTime = endTime / 1e3 startTime = startTime / 1e3 local repeatCount = 1 local start = GetTime() - startTime if(tradeskill and repeatCount >= 1) then if(castbar.previous ~= name) then castbar.recipecount = 1 castbar.maxrecipe = repeatCount castbar.duration = start else castbar.recipecount = castbar.recipecount or 1 castbar.maxrecipe = castbar.maxrecipe or repeatCount castbar.duration = castbar.duration or start end else castbar.recipecount = nil castbar.maxrecipe = 1 castbar.duration = start end castbar.previous = name castbar.tradeskill = tradeskill castbar.castid = castid local max = (endTime - startTime) * castbar.maxrecipe castbar.max = max castbar.delay = 0 castbar.casting = true castbar.interrupt = interrupt castbar:SetMinMaxValues(0, max) castbar:SetValue(0) if(castbar.Text) then castbar.Text:SetText(text) end if(castbar.Icon) then castbar.Icon:SetTexture(texture) end if(castbar.Time) then castbar.Time:SetText() end local shield = castbar.Shield if(shield and interrupt) then shield:Show() elseif(shield) then shield:Hide() end local sf = castbar.SafeZone if(sf) then sf:ClearAllPoints() sf:SetPoint'RIGHT' sf:SetPoint'TOP' sf:SetPoint'BOTTOM' updateSafeZone(castbar) end if(castbar.PostCastStart) then castbar:PostCastStart(unit, name, castid) end castbar:Show() end local UNIT_SPELLCAST_FAILED = function(self, event, unit, spellname, _, castid) if (self.unit ~= unit) or not unit then return end local castbar = self.Castbar if (castbar.castid ~= castid) then return end castbar.previous = nil castbar.casting = nil castbar.tradeskill = nil castbar.recipecount = nil castbar.maxrecipe = 1 castbar.interrupt = nil castbar:SetValue(0) castbar:Hide() if(castbar.PostCastFailed) then return castbar:PostCastFailed(unit, spellname, castid) end end local UNIT_SPELLCAST_INTERRUPTED = function(self, event, unit, spellname, _, castid) if(self.unit ~= unit) or not unit then return end local castbar = self.Castbar if (castbar.castid ~= castid) then return end castbar.previous = nil castbar.casting = nil castbar.tradeskill = nil castbar.recipecount = nil castbar.maxrecipe = 1 castbar.channeling = nil castbar:SetValue(0) castbar:Hide() if(castbar.PostCastInterrupted) then return castbar:PostCastInterrupted(unit, spellname, castid) end end local UNIT_SPELLCAST_INTERRUPTIBLE = function(self, event, unit) if(self.unit ~= unit) or not unit then return end local shield = self.Castbar.Shield if(shield) then shield:Hide() end local castbar = self.Castbar if(castbar.PostCastInterruptible) then return castbar:PostCastInterruptible(unit) end end local UNIT_SPELLCAST_NOT_INTERRUPTIBLE = function(self, event, unit) if(self.unit ~= unit) or not unit then return end local shield = self.Castbar.Shield if(shield) then shield:Show() end local castbar = self.Castbar if(castbar.PostCastNotInterruptible) then return castbar:PostCastNotInterruptible(unit) end end local UNIT_SPELLCAST_DELAYED = function(self, event, unit, spellname, _, castid) if(self.unit ~= unit) or not unit then return end local castbar = self.Castbar local name, _, text, texture, startTime, endTime = UnitCastingInfo(unit) if(not startTime or not castbar:IsShown()) then return end local duration = GetTime() - (startTime / 1000) if(duration < 0) then duration = 0 end castbar.previous = name castbar.delay = castbar.delay + castbar.duration - duration castbar.duration = duration castbar:SetValue(duration) if(castbar.PostCastDelayed) then return castbar:PostCastDelayed(unit, name, castid) end end local UNIT_SPELLCAST_STOP = function(self, event, unit, spellname, _, castid) if (self.unit ~= unit) or not unit then return end local castbar = self.Castbar if (castbar.castid ~= castid) then return end if(castbar.tradeskill and castbar.recipecount and castbar.recipecount >= 0) then castbar.recipecount = castbar.recipecount + 1 else castbar.previous = nil castbar.casting = nil castbar.interrupt = nil castbar.tradeskill = nil castbar.recipecount = nil castbar.maxrecipe = 1 castbar:SetValue(0) end if((not castbar.recipecount) or (castbar.recipecount and castbar.recipecount < 2)) then castbar:Hide() end if(castbar.PostCastStop) then return castbar:PostCastStop(unit, spellname, castid) end end local UNIT_SPELLCAST_CHANNEL_START = function(self, event, unit, spellname) if (self.unit ~= unit) or not unit then return end local castbar = self.Castbar local name, _, text, texture, startTime, endTime, isTrade, interrupt = UnitChannelInfo(unit) if (not name) then return end endTime = endTime / 1e3 startTime = startTime / 1e3 local max = (endTime - startTime) local duration = endTime - GetTime() castbar.previous = name castbar.duration = duration castbar.max = max castbar.delay = 0 castbar.startTime = startTime castbar.endTime = endTime castbar.extraTickRatio = 0 castbar.channeling = true castbar.interrupt = interrupt -- We have to do this, as it's possible for spell casts to never have _STOP -- executed or be fully completed by the OnUpdate handler before CHANNEL_START -- is called. castbar.casting = nil castbar.tradeskill = nil castbar.recipecount = nil castbar.maxrecipe = 1 castbar.castid = nil castbar:SetMinMaxValues(0, max) castbar:SetValue(duration) if(castbar.Text) then castbar.Text:SetText(name) end if(castbar.Icon) then castbar.Icon:SetTexture(texture) end if(castbar.Time) then castbar.Time:SetText() end local shield = castbar.Shield if(shield and interrupt) then shield:Show() elseif(shield) then shield:Hide() end local sf = castbar.SafeZone if(sf) then sf:ClearAllPoints() sf:SetPoint'LEFT' sf:SetPoint'TOP' sf:SetPoint'BOTTOM' updateSafeZone(castbar) end if(castbar.PostChannelStart) then castbar:PostChannelStart(unit, name) end castbar:Show() end local UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, event, unit, spellname) if(self.unit ~= unit) or not unit then return end local castbar = self.Castbar local name, _, text, texture, startTime, endTime, oldStart = UnitChannelInfo(unit) if(not name or not castbar:IsShown()) then return end castbar.previous = name local duration = (endTime / 1000) - GetTime() local startDelay = castbar.startTime - startTime / 1000 castbar.startTime = startTime / 1000 castbar.endTime = endTime / 1000 castbar.delay = castbar.delay + startDelay castbar.duration = duration castbar.max = (endTime - startTime) / 1000 castbar:SetMinMaxValues(0, castbar.max) castbar:SetValue(duration) if(castbar.PostChannelUpdate) then return castbar:PostChannelUpdate(unit, name) end end local UNIT_SPELLCAST_CHANNEL_STOP = function(self, event, unit, spellname) if(self.unit ~= unit) or not unit then return end local castbar = self.Castbar if(castbar:IsShown()) then castbar.channeling = nil castbar.interrupt = nil castbar:SetValue(castbar.max) castbar:Hide() if(castbar.PostChannelStop) then return castbar:PostChannelStop(unit, spellname) end end end local UpdateCastingTimeInfo = function(self, duration) if(self.Time) then if(self.delay ~= 0) then if(self.CustomDelayText) then self:CustomDelayText(duration) else self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) end elseif(self.recipecount and self.recipecount > 0 and self.maxrecipe and self.maxrecipe > 1) then self.Time:SetText(self.recipecount .. "/" .. self.maxrecipe) else if(self.CustomTimeText) then self:CustomTimeText(duration) else self.Time:SetFormattedText("%.1f", duration) end end end if(self.Spark) then self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0) end end local onUpdate = function(self, elapsed) self.lastUpdate = (self.lastUpdate or 0) + elapsed if not (self.casting or self.channeling) then self.unitName = nil self.previous = nil self.casting = nil self.tradeskill = nil self.recipecount = nil self.maxrecipe = 1 self.castid = nil self.channeling = nil self:SetValue(1) self:Hide() return end if(self.casting) then local duration = self.duration + self.lastUpdate if(duration >= self.max) then self.previous = nil self.casting = nil self.tradeskill = nil self.recipecount = nil self.maxrecipe = 1 self:Hide() if(self.PostCastStop) then self:PostCastStop(self.__owner.unit) end return end UpdateCastingTimeInfo(self, duration) self.duration = duration self:SetValue(duration) elseif(self.channeling) then local duration = self.duration - self.lastUpdate if(duration <= 0) then self.channeling = nil self:Hide() if(self.PostChannelStop) then self:PostChannelStop(self.__owner.unit) end return end UpdateCastingTimeInfo(self, duration) self.duration = duration self:SetValue(duration) end self.lastUpdate = 0 end local Update = function(self, ...) UNIT_SPELLCAST_START(self, ...) return UNIT_SPELLCAST_CHANNEL_START(self, ...) end local ForceUpdate = function(element) return Update(element.__owner, 'ForceUpdate', element.__owner.unit) end local Enable = function(object, unit) local castbar = object.Castbar if(castbar) then castbar.__owner = object castbar.ForceUpdate = ForceUpdate if(not (unit and unit:match'%wtarget$')) then object:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT) object:RegisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START) object:RegisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED) object:RegisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP) object:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED) object:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", UNIT_SPELLCAST_INTERRUPTIBLE) object:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", UNIT_SPELLCAST_NOT_INTERRUPTIBLE) object:RegisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED) object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START) object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE) object:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP) --object:RegisterEvent("UPDATE_TRADESKILL_RECAST", UPDATE_TRADESKILL_RECAST) end castbar:SetScript("OnUpdate", castbar.OnUpdate or onUpdate) if(object.unit == "player") then CastingBarFrame:UnregisterAllEvents() CastingBarFrame.Show = CastingBarFrame.Hide CastingBarFrame:Hide() elseif(object.unit == 'pet') then PetCastingBarFrame:UnregisterAllEvents() PetCastingBarFrame.Show = PetCastingBarFrame.Hide PetCastingBarFrame:Hide() end if(castbar:IsObjectType'StatusBar' and not castbar:GetStatusBarTexture()) then castbar:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]] end local spark = castbar.Spark if(spark and spark:IsObjectType'Texture' and not spark:GetTexture()) then spark:SetTexture[[Interface\CastingBar\UI-CastingBar-Spark]] end local shield = castbar.Shield if(shield and shield:IsObjectType'Texture' and not shield:GetTexture()) then shield:SetTexture[[Interface\CastingBar\UI-CastingBar-Small-Shield]] end local sz = castbar.SafeZone if(sz and sz:IsObjectType'Texture' and not sz:GetTexture()) then sz:SetColorTexture(1, 0, 0) end castbar:Hide() return true end end local Disable = function(object, unit) local castbar = object.Castbar if(castbar) then object:UnregisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT) object:UnregisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START) object:UnregisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED) object:UnregisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP) object:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED) object:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", UNIT_SPELLCAST_INTERRUPTIBLE) object:UnregisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", UNIT_SPELLCAST_NOT_INTERRUPTIBLE) object:UnregisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED) object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START) object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE) object:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP) --object:UnregisterEvent("UPDATE_TRADESKILL_RECAST", UPDATE_TRADESKILL_RECAST) castbar:SetScript("OnUpdate", nil) end end oUF:AddElement('Castbar', Update, Enable, Disable)
mit
dr01d3r/darkstar
scripts/globals/items/cheval_salmon.lua
12
1344
----------------------------------------- -- ID: 4379 -- Item: cheval_salmon -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 2 -- Charisma -4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 7) then result = 247; end if (target:getMod(MOD_EAT_RAW_FISH) == 1) then result = 0; end if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4379); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 2); target:addMod(MOD_CHA, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 2); target:delMod(MOD_CHA, -4); end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Chateau_dOraguille/npcs/Chaloutte.lua
14
1066
----------------------------------- -- Area: Chateau d'Oraguille -- NPC: Chaloutte -- Type: Event Scene Replayer -- @zone 233 -- @pos 10.450 -1 -11.985 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Chateau_dOraguille/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x022d); 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
dr01d3r/darkstar
scripts/zones/La_Theine_Plateau/mobs/Battering_Ram.lua
13
1502
----------------------------------- -- Area: La Theine Plateau -- MOB: Battering Ram ----------------------------------- require("scripts/zones/La_Theine_Plateau/MobIDs"); ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) end; ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local mobID = mob:getID(); local chanceForLambert = 0; local chanceForBaldurf = 0; local nmToPop = 0; if (mobID == Battering_Ram) then if (GetServerVariable("[POP]Lumbering_Lambert") <= os.time(t)) then chanceForLambert = math.random(1,100); end if (GetServerVariable("[POP]Bloodtear_Baldurf") <= os.time(t)) then chanceForBaldurf = math.random(1,100); end if (chanceForLambert > 0 or chanceForBaldurf > 0) then if (chanceForLambert > chanceForBaldurf) then nmToPop = Lumbering_Lambert; else nmToPop = Bloodtear_Baldurf; end end if (nmToPop > 0 and GetMobAction(Lumbering_Lambert) == ACTION_NONE and GetMobAction(Bloodtear_Baldurf) == ACTION_NONE) then if (math.random(1,20) == 5) then UpdateNMSpawnPoint(nmToPop); GetMobByID(nmToPop):setRespawnTime(GetMobRespawnTime(mobID)); DeterMob(mobID, true); end end end end;
gpl-3.0
grbd/premake-core
tests/actions/vstudio/vc2010/test_build_events.lua
5
2318
-- -- tests/actions/vstudio/vc2010/test_build_events.lua -- Check generation of pre- and post-build commands for C++ projects. -- Copyright (c) 2012-2013 Jason Perkins and the Premake project -- local suite = test.declare("vstudio_vc2010_build_events") local vc2010 = premake.vstudio.vc2010 -- -- Setup -- local sln, prj, cfg function suite.setup() premake.escaper(premake.vstudio.vs2010.esc) sln = test.createsolution() end local function prepare(platform) prj = premake.solution.getproject(sln, 1) vc2010.buildEvents(prj) end -- -- If no build steps are specified, nothing should be written. -- function suite.noOutput_onNoEvents() prepare() test.isemptycapture() end -- -- If one command set is used and not the other, only the one should be written. -- function suite.onlyOne_onPreBuildOnly() prebuildcommands { "command1" } prepare() test.capture [[ <PreBuildEvent> <Command>command1</Command> </PreBuildEvent> ]] end function suite.onlyOne_onPostBuildOnly() postbuildcommands { "command1" } prepare() test.capture [[ <PostBuildEvent> <Command>command1</Command> </PostBuildEvent> ]] end function suite.both_onBoth() prebuildcommands { "command1" } postbuildcommands { "command2" } prepare() test.capture [[ <PreBuildEvent> <Command>command1</Command> </PreBuildEvent> <PostBuildEvent> <Command>command2</Command> </PostBuildEvent> ]] end -- -- Multiple commands should be separated with un-escaped EOLs. -- function suite.splits_onMultipleCommands() postbuildcommands { "command1", "command2" } prepare() test.capture ("\t\t<PostBuildEvent>\n\t\t\t<Command>command1\r\ncommand2</Command>\n\t\t</PostBuildEvent>\n") end -- -- Quotes should not be escaped, other special characters should. -- function suite.onSpecialChars() postbuildcommands { '\' " < > &' } prepare() test.capture [[ <PostBuildEvent> <Command>' " &lt; &gt; &amp;</Command> </PostBuildEvent> ]] end -- -- If a message is specified, it should be included. -- function suite.onMessageProvided() postbuildcommands { "command1" } postbuildmessage "Post-building..." prepare() test.capture [[ <PostBuildEvent> <Command>command1</Command> <Message>Post-building...</Message> </PostBuildEvent> ]] end
bsd-3-clause
SalvationDevelopment/Salvation-Scripts-Production
c52158283.lua
2
1581
--先史遺産コロッサル・ヘッド function c52158283.initial_effect(c) --adchange local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(52158283,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,52158283) e1:SetCost(c52158283.cost) e1:SetTarget(c52158283.target) e1:SetOperation(c52158283.operation) c:RegisterEffect(e1) end function c52158283.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c52158283.filter(c) return c:IsAttackPos() and c:IsLevelAbove(3) end function c52158283.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c52158283.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c52158283.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,c52158283.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function c52158283.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if tc:IsAttackPos() then local pos=0 if tc:IsCanTurnSet() then pos=Duel.SelectPosition(tp,tc,POS_DEFENSE) else pos=Duel.SelectPosition(tp,tc,POS_FACEUP_DEFENSE) end Duel.ChangePosition(tc,pos) else Duel.ChangePosition(tc,0,0,POS_FACEDOWN_DEFENSE,POS_FACEUP_DEFENSE) end end end
gpl-2.0
retep998/Vana
scripts/instances/kerningToCbdBoarding.lua
2
1170
--[[ Copyright (C) 2008-2016 Vana Development Team 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; version 2 of the License. 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --]] function beginInstance() addInstanceMap(540010100); end function changeMap(playerId, newMap, oldMap, isPartyLeader) if isInstanceMap(newMap) then addInstancePlayer(playerId); elseif not isInstanceMap(oldMap) then removeInstancePlayer(playerId); end end function timerEnd(name, fromTimer) if name == instance_timer then if getInstancePlayerCount() > 0 then createInstance("kerningToCbdTrip", 60, false); passPlayersBetweenInstances(540010101); end end end
gpl-2.0
dr01d3r/darkstar
scripts/zones/Tahrongi_Canyon/npcs/Signpost.lua
17
1390
----------------------------------- -- Area: Tahrongi Canyon -- NPC: Signpost ----------------------------------- package.loaded["scripts/zones/Tahrongi_Canyon/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Tahrongi_Canyon/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (npc:getID() == 17257026) or (npc:getID() == 17257026) then player:messageSpecial(SIGN_1); elseif (npc:getID() == 17257027) or (npc:getID() == 17257028) then player:messageSpecial(SIGN_3); elseif (npc:getID() == 17257031) or (npc:getID() == 17257032) then player:messageSpecial(SIGN_5); elseif (npc:getID() == 17257033) or (npc:getID() == 17257034) then player:messageSpecial(SIGN_7); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --print("CSID: %u",csid); --print("RESULT: %u",option); end;
gpl-3.0
jamesbates/vlc
share/lua/sd/freebox.lua
4
3728
--[[ $Id$ Copyright © 2010 VideoLAN and AUTHORS Authors: Fabio Ritrovato <sephiroth87 at videolan dot org> 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 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. --]] function descriptor() return { title="Freebox TV" } end function main() local logos = {} -- fetch urls for basic channels logos local fd, msg = vlc.stream( "http://free.fr/adsl/pages/television/services-de-television/acces-a-plus-250-chaines/bouquet-basique.html" ) if not fd then vlc.msg.warn(msg) -- not fatal else local channel, logourl local line = fd:readline() while line ~= nil do if( string.find( line, "tv%-chaine%-" ) ) then _, _, channel, logourl = string.find( line, "\"tv%-chaine%-(%d+)\".*<img%s*src=\"([^\"]*)\"" ) -- fix spaces logourl = string.gsub( logourl, " ", "%%20" ) logos[channel] = "http://free.fr" .. logourl end line = fd:readline() end end -- fetch urls for optional channels logos local fd, msg = vlc.stream( "http://www.free.fr/adsl/pages/television/services-de-television/acces-a-plus-250-chaines/en-option.html" ) if not fd then vlc.msg.warn(msg) -- not fatal else local channel, logourl local line = fd:readline() while line ~= nil do if( string.find( line, "tv%-chaine%-" ) ) then _, _, channel, logourl = string.find( line, "\"tv%-chaine%-(%d+)\".*<img%s*src=\"([^\"]*)\"" ) -- fix spaces logourl = string.gsub( logourl, " ", "%%20" ) logos[channel] = "http://free.fr" .. logourl end line = fd:readline() end end -- fetch the playlist fd, msg = vlc.stream( "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u" ) if not fd then vlc.msg.warn(msg) return nil end local line= fd:readline() if line ~= "#EXTM3U" then return nil end line = fd:readline() local duration, artist, name, arturl local options={"deinterlace=1"} while line ~= nil do if( string.find( line, "#EXTINF" ) ) then _, _, duration, artist, name = string.find( line, ":(%w+),(%w+)%s*-%s*(.+)" ) arturl = logos[artist] elseif( string.find( line, "#EXTVLCOPT" ) ) then _, _, option = string.find( line, ":(.+)" ) table.insert( options, option ) else vlc.sd.add_item({ path = line, duration = duration, artist = artist, title = name, arturl = arturl, uiddata = line, meta = {["Listing Type"]="tv"}, options = options }) duration = nil artist = nil name = nil arturl = nil options={"deinterlace=1"} end line = fd:readline() end end
gpl-2.0
erfan70/erfan100
libs/plugins/groupmanager.lua
1
112094
local function modadd(msg) local function modadd(msg) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_admin(msg) then if not lang then return '_You are not bot admin_' else return 'شما مدیر ربات نمیباشید' end end local data = load_data(_config.moderation.data) if data[tostring(msg.chat_id_)] then if not lang then return '_💀 Im G O D of war and ready my owner gladiator @Erfan_herkuless_051 💀_' else return '⚔ آماده پشتیبانی از مردم این قلمرو هستم ⚔' end end -- create data array in moderation.json data[tostring(msg.chat_id_)] = { owners = {}, mods ={}, banned ={}, is_silent_users ={}, filterlist ={}, settings = { lock_link = 'no', lock_tag = 'no', lock_fosh = 'no', lock_spam = 'no', lock_webpage = 'no', lock_arabic = 'no', lock_markdown = 'no', flood = 'no', lock_bots = 'no', welcome = 'no' }, mutes = { mute_forward = 'no', mute_audio = 'no', mute_video = 'no', mute_contact = 'no', mute_text = 'no', mute_photos = 'no', mute_gif = 'no', mute_location = 'no', mute_document = 'no', mute_sticker = 'no', mute_voice = 'no', mute_all = 'no' } } save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = {} save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.chat_id_)] = msg.chat_id_ save_data(_config.moderation.data, data) if not lang then return '*⚔ آماده پشتیبانی از مردم این قلمرو هستم ⚔*' else return '💀 Im G O D of war and ready my owner gladiator @Erfan_herkuless_051 💀' end end local function modrem(msg) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) -- superuser and admins only (because sudo are always has privilege) if not is_admin(msg) then if not lang then return '_You are not bot admin_' else return 'شما مدیر ربات نمیباشید' end end local data = load_data(_config.moderation.data) local receiver = msg.chat_id_ if not data[tostring(msg.chat_id_)] then if not lang then return '_Group is not added_' else return 'گروه به لیست گروه های مدیریتی ربات اضافه نشده است' end end data[tostring(msg.chat_id_)] = nil save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = nil save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.chat_id_)] = nil save_data(_config.moderation.data, data) if not lang then return '*Group has been removed*' else return 'گروه با موفیت از لیست گروه های مدیریتی ربات حذف شد' end end local function filter_word(msg, word) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) local data = load_data(_config.moderation.data) if not data[tostring(msg.chat_id_)]['filterlist'] then data[tostring(msg.chat_id_)]['filterlist'] = {} save_data(_config.moderation.data, data) end if data[tostring(msg.chat_id_)]['filterlist'][(word)] then if not lang then return "_Word_ *"..word.."* _is already filtered_" else return "_کلمه_ *"..word.."* _از قبل فیلتر بود_" end end data[tostring(msg.chat_id_)]['filterlist'][(word)] = true save_data(_config.moderation.data, data) if not lang then return "_Word_ *"..word.."* _added to filtered words list_" else return "_کلمه_ *"..word.."* _به لیست کلمات فیلتر شده اضافه شد_" end end local function unfilter_word(msg, word) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) local data = load_data(_config.moderation.data) if not data[tostring(msg.chat_id_)]['filterlist'] then data[tostring(msg.chat_id_)]['filterlist'] = {} save_data(_config.moderation.data, data) end if data[tostring(msg.chat_id_)]['filterlist'][word] then data[tostring(msg.chat_id_)]['filterlist'][(word)] = nil save_data(_config.moderation.data, data) if not lang then return "_Word_ *"..word.."* _removed from filtered words list_" elseif lang then return "_کلمه_ *"..word.."* _از لیست کلمات فیلتر شده حذف شد_" end else if not lang then return "_Word_ *"..word.."* _is not filtered_" elseif lang then return "_کلمه_ *"..word.."* _از قبل فیلتر نبود_" end end end local function modlist(msg) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) local data = load_data(_config.moderation.data) local i = 1 if not data[tostring(msg.chat_id_)] then if not lang then return "_Group is not added_" else return "گروه به لیست گروه های مدیریتی ربات اضافه نشده است" end end -- determine if table is empty if next(data[tostring(msg.chat_id_)]['mods']) == nil then --fix way if not lang then return "_No_ *moderator* _in this group_" else return "در حال حاضر هیچ مدیری برای گروه انتخاب نشده است" end end if not lang then message = '*List of moderators :*\n' else message = '*لیست مدیران گروه :*\n' end for k,v in pairs(data[tostring(msg.chat_id_)]['mods']) do message = message ..i.. '- '..v..' [' ..k.. '] \n' i = i + 1 end return message end local function ownerlist(msg) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) local data = load_data(_config.moderation.data) local i = 1 if not data[tostring(msg.chat_id_)] then if not lang then return "_Group is not added_" else return "گروه به لیست گروه های مدیریتی ربات اضافه نشده است" end end -- determine if table is empty if next(data[tostring(msg.chat_id_)]['owners']) == nil then --fix way if not lang then return "_No_ *owner* _in this group_" else return "در حال حاضر هیچ مالکی برای گروه انتخاب نشده است" end end if not lang then message = '*List of moderators :*\n' else message = '*لیست مدیران گروه :*\n' end for k,v in pairs(data[tostring(msg.chat_id_)]['owners']) do message = message ..i.. '- '..v..' [' ..k.. '] \n' i = i + 1 end return message end local function action_by_reply(arg, data) local hash = "gp_lang:"..data.chat_id_ local lang = redis:get(hash) local cmd = arg.cmd local administration = load_data(_config.moderation.data) if not tonumber(data.sender_user_id_) then return false end if data.sender_user_id_ then if not administration[tostring(data.chat_id_)] then if not lang then return tdcli.sendMessage(data.chat_id_, "", 0, "_Group is not added_", 0, "md") else return tdcli.sendMessage(data.chat_id_, "", 0, "_گروه به لیست گروه های مدیریتی ربات اضافه نشده است_", 0, "md") end end if cmd == "setowner" then local function owner_cb(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) local administration = load_data(_config.moderation.data) if data.username_ then user_name = '@'..check_markdown(data.username_) else user_name = check_markdown(data.first_name_) end if administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is now the_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام صاحب گروه منتصب شد*", 0, "md") end end tdcli_function ({ ID = "GetUser", user_id_ = data.sender_user_id_ }, owner_cb, {chat_id=data.chat_id_,user_id=data.sender_user_id_}) end if cmd == "promote" then local function promote_cb(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) local administration = load_data(_config.moderation.data) if data.username_ then user_name = '@'..check_markdown(data.username_) else user_name = check_markdown(data.first_name_) end if administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *promoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام مدیر گروه منتصب شد*", 0, "md") end end tdcli_function ({ ID = "GetUser", user_id_ = data.sender_user_id_ }, promote_cb, {chat_id=data.chat_id_,user_id=data.sender_user_id_}) end if cmd == "remowner" then local function rem_owner_cb(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) local administration = load_data(_config.moderation.data) if data.username_ then user_name = '@'..check_markdown(data.username_) else user_name = check_markdown(data.first_name_) end if not administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is no longer a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام صاحب گروه برکنار شد*", 0, "md") end end tdcli_function ({ ID = "GetUser", user_id_ = data.sender_user_id_ }, rem_owner_cb, {chat_id=data.chat_id_,user_id=data.sender_user_id_}) end if cmd == "demote" then local function demote_cb(arg, data) local administration = load_data(_config.moderation.data) if data.username_ then user_name = '@'..check_markdown(data.username_) else user_name = check_markdown(data.first_name_) end if not administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *demoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام مدیر گروه برکنار شد*", 0, "md") end end tdcli_function ({ ID = "GetUser", user_id_ = data.sender_user_id_ }, demote_cb, {chat_id=data.chat_id_,user_id=data.sender_user_id_}) end if cmd == "id" then local function id_cb(arg, data) return tdcli.sendMessage(arg.chat_id, "", 0, "*"..data.id_.."*", 0, "md") end tdcli_function ({ ID = "GetUser", user_id_ = data.sender_user_id_ }, id_cb, {chat_id=data.chat_id_,user_id=data.sender_user_id_}) end else if lang then return tdcli.sendMessage(data.chat_id_, "", 0, "_کاربر یافت نشد_", 0, "md") else return tdcli.sendMessage(data.chat_id_, "", 0, "*User Not Found*", 0, "md") end end end local function action_by_username(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) local cmd = arg.cmd local administration = load_data(_config.moderation.data) if not administration[tostring(arg.chat_id)] then if not lang then return tdcli.sendMessage(data.chat_id_, "", 0, "_Group is not added_", 0, "md") else return tdcli.sendMessage(data.chat_id_, "", 0, "_گروه به لیست گروه های مدیریتی ربات اضافه نشده است_", 0, "md") end end if not arg.username then return false end if data.id_ then if data.type_.user_.username_ then user_name = '@'..check_markdown(data.type_.user_.username_) else user_name = check_markdown(data.title_) end if cmd == "setowner" then if administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is now the_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام صاحب گروه منتصب شد*", 0, "md") end end if cmd == "promote" then if administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *promoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام مدیر گروه منتصب شد*", 0, "md") end end if cmd == "remowner" then if not administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is no longer a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام صاحب گروه برکنار شد*", 0, "md") end end if cmd == "demote" then if not administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *demoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام مدیر گروه برکنار شد*", 0, "md") end end if cmd == "id" then return tdcli.sendMessage(arg.chat_id, "", 0, "*"..data.id_.."*", 0, "md") end if cmd == "res" then if not lang then text = "Result for [ ".. check_markdown(data.type_.user_.username_) .." ] :\n" .. "".. check_markdown(data.title_) .."\n" .. " [".. data.id_ .."]" else text = "اطلاعات برای [ ".. check_markdown(data.type_.user_.username_) .." ] :\n" .. "".. check_markdown(data.title_) .."\n" .. " [".. data.id_ .."]" return tdcli.sendMessage(arg.chat_id, 0, 1, text, 1, 'md') end end else if lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر یافت نشد_", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "*User Not Found*", 0, "md") end end end local function action_by_id(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) local cmd = arg.cmd local administration = load_data(_config.moderation.data) if not administration[tostring(arg.chat_id)] then if not lang then return tdcli.sendMessage(data.chat_id_, "", 0, "_Group is not added_", 0, "md") else return tdcli.sendMessage(data.chat_id_, "", 0, "_گروه به لیست گروه های مدیریتی ربات اضافه نشده است_", 0, "md") end end if not tonumber(arg.user_id) then return false end if data.id_ then if data.first_name_ then if data.username_ then user_name = '@'..check_markdown(data.username_) else user_name = check_markdown(data.first_name_) end if cmd == "setowner" then if administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is now the_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام صاحب گروه منتصب شد*", 0, "md") end end if cmd == "promote" then if administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is already a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه بود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = user_name save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *promoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *به مقام مدیر گروه منتصب شد*", 0, "md") end end if cmd == "remowner" then if not administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* *از قبل صاحب گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['owners'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is no longer a_ *group owner*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام صاحب گروه برکنار شد*", 0, "md") end end if cmd == "demote" then if not administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] then if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _is not a_ *moderator*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از قبل مدیر گروه نبود*", 0, "md") end end administration[tostring(arg.chat_id)]['mods'][tostring(data.id_)] = nil save_data(_config.moderation.data, administration) if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User_ "..user_name.." *"..data.id_.."* _has been_ *demoted*", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر_ "..user_name.." *"..data.id_.."* *از مقام مدیر گروه برکنار شد*", 0, "md") end end if cmd == "whois" then if data.username_ then username = '@'..check_markdown(data.username_) else if not lang then username = 'not found' else username = 'ندارد' end end if not lang then return tdcli.sendMessage(arg.chat_id, 0, 1, 'Info for [ '..data.id_..' ] :\nUserName : '..username..'\nName : '..data.first_name_, 1) else return tdcli.sendMessage(arg.chat_id, 0, 1, 'اطلاعات برای [ '..data.id_..' ] :\nیوزرنیم : '..username..'\nنام : '..data.first_name_, 1) end end else if not lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_User not founded_", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر یافت نشد_", 0, "md") end end else if lang then return tdcli.sendMessage(arg.chat_id, "", 0, "_کاربر یافت نشد_", 0, "md") else return tdcli.sendMessage(arg.chat_id, "", 0, "*User Not Found*", 0, "md") end end end ---------------Lock Link------------------- local function lock_link(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_link = data[tostring(target)]["settings"]["lock_link"] if lock_link == "yes" then if not lang then return "🔒*Link* _Posting Is Already Locked_🔒" elseif lang then return "⚔ ارسال لینک در قلمرو هم اکنون ممنوع است⚔" end else data[tostring(target)]["settings"]["lock_link"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Link* _Posting Has Been Locked_🔒" else return "⚔ارسال لینک در قلمرو ممنوع شد⚔" end end end local function unlock_link(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_link = data[tostring(target)]["settings"]["lock_link"] if lock_link == "no" then if not lang then return "🔓*Link* _Posting Is Not Locked_🔓" elseif lang then return "⚜ارسال لینک در قلمرو ممنوع نمیباشد⚜" end else data[tostring(target)]["settings"]["lock_link"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Link* _Posting Has Been Unlocked_🔓" else return "❗️ارسال لینک درقلمرو آزاد شد❗️" end end end ---------------Lock fosh------------------- local function lock_fosh(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_fosh = data[tostring(target)]["settings"]["lock_fosh"] if lock_fosh == "yes" then if not lang then return "🔒*Fosh* _Posting Is Already Locked_🔒" elseif lang then return "⚔ قفل فحش در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["lock_fosh"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Fosh* _ Has Been Locked_🔒" else return "⚔ قفل فحش در قلمرو فعال شد ⚔" end end end local function unlock_fosh(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_fosh = data[tostring(target)]["settings"]["lock_fosh"] if lock_fosh == "no" then if not lang then return "🔓*Fosh* _Is Not Locked_🔓" elseif lang then return "❗️قفل فحش در قلمرو غیرفعال میباشد❗️" end else data[tostring(target)]["settings"]["lock_fosh"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Fosh* _Has Been Unlocked_🔓" else return "🔓قفل فحش غیرفعال شد🔓" end end end ---------------Lock Tag------------------- local function lock_tag(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_tag = data[tostring(target)]["settings"]["lock_tag"] if lock_tag == "yes" then if not lang then return "🔒*Tag* _Posting Is Already Locked_🔒" elseif lang then return "⚔ ارسال تگ در قلمرو هم اکنون ممنوع است⚔" end else data[tostring(target)]["settings"]["lock_tag"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Tag* _Posting Has Been Locked_🔒" else return "⚔ ارسال تگ درقلمرو ممنوع شد ⚔" end end end local function unlock_tag(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_tag = data[tostring(target)]["settings"]["lock_tag"] if lock_tag == "no" then if not lang then return "🔓*Tag* _Posting Is Not Locked_🔓" elseif lang then return "❗️ارسال تگ در قلمرو ممنوع نمیباشد❗️" end else data[tostring(target)]["settings"]["lock_tag"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Tag* _Posting Has Been Unlocked_🔓" else return "❗️ارسال تگ در قلمرو آزاد شد❗️" end end end ---------------Lock Mention------------------- local function lock_mention(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_mention = data[tostring(target)]["settings"]["lock_mention"] if lock_mention == "yes" then if not lang then return "🔒*Mention* _Posting Is Already Locked_🔒" elseif lang then return "⚔ ارسال توجه افراد هم اکنون در این قلمرو ممنوع است ⚔" end else data[tostring(target)]["settings"]["lock_mention"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Mention* _Posting Has Been Locked_🔒" else return "⚔ ارسال توجه افراد در قلمرو ممنوع شد ⚔" end end end local function unlock_mention(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_mention = data[tostring(target)]["settings"]["lock_mention"] if lock_mention == "no" then if not lang then return "🔓*Mention* _Posting Is Not Locked_🔓" elseif lang then return "❗️ارسال توجه افراد در قلمرو ممنوع نمیباشد❗️" end else data[tostring(target)]["settings"]["lock_mention"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Mention* _Posting Has Been Unlocked_🔓" else return "❗️ارسال توجه افراد درقلمرو آزاد شد❗️" end end end ---------------Lock Arabic-------------- local function lock_arabic(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_arabic = data[tostring(target)]["settings"]["lock_arabic"] if lock_arabic == "yes" then if not lang then return "🔒*Arabic/Persian* _Posting Is Already Locked_🔒" elseif lang then return "🔒ارسال کلمات عربی/فارسی در گروه هم اکنون ممنوع است🔒" end else data[tostring(target)]["settings"]["lock_arabic"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Arabic/Persian* _Posting Has Been Locked_🔒" else return "🔒ارسال کلمات عربی/فارسی در گروه ممنوع شد🔒" end end end local function unlock_arabic(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_arabic = data[tostring(target)]["settings"]["lock_arabic"] if lock_arabic == "no" then if not lang then return "🔓*Arabic/Persian* _Posting Is Not Locked_🔓" elseif lang then return "🔓ارسال کلمات عربی/فارسی در گروه ممنوع نمیباشد🔓" end else data[tostring(target)]["settings"]["lock_arabic"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Arabic/Persian* _Posting Has Been Unlocked_🔓" else return "🔓ارسال کلمات عربی/فارسی در گروه آزاد شد🔓" end end end ---------------Lock Edit------------------- local function lock_edit(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_edit = data[tostring(target)]["settings"]["lock_edit"] if lock_edit == "yes" then if not lang then return "🔒*Editing* _Is Already Locked_🔒" elseif lang then return "🔒ویرایش پیام هم اکنون ممنوع است🔒" end else data[tostring(target)]["settings"]["lock_edit"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Editing* _Has Been Locked_🔒" else return "🔒ویرایش پیام در گروه ممنوع شد🔒" end end end local function unlock_edit(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_edit = data[tostring(target)]["settings"]["lock_edit"] if lock_edit == "no" then if not lang then return "🔓*Editing* _Is Not Locked_🔓" elseif lang then return "🔓ویرایش پیام در گروه ممنوع نمیباشد🔓" end else data[tostring(target)]["settings"]["lock_edit"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Editing* _Has Been Unlocked_🔓" else return "🔓ویرایش پیام در گروه آزاد شد🔓" end end end ---------------Lock spam------------------- local function lock_spam(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_spam = data[tostring(target)]["settings"]["lock_spam"] if lock_spam == "yes" then if not lang then return "🔒*Spam* _Is Already Locked_🔒" elseif lang then return "⚔ ارسال اسپم در قلمرو هم اکنون ممنوع است ⚔" end else data[tostring(target)]["settings"]["lock_spam"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Spam* _Has Been Locked_🔒" else return "⚔ ارسال اسپم در قلمرو ما ممنوع شد ⚔" end end end local function unlock_spam(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_spam = data[tostring(target)]["settings"]["lock_spam"] if lock_spam == "no" then if not lang then return "🔓*Spam* _Posting Is Not Locked_🔓" elseif lang then return "❗️ارسال اسپم در قلمرو ما ممنوع نمیباشد❗️" end else data[tostring(target)]["settings"]["lock_spam"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Spam* _Posting Has Been Unlocked_🔓" else return "❗️ارسال اسپم در قلمرو آزاد شد❗️" end end end ---------------Lock Flood------------------- local function lock_flood(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_flood = data[tostring(target)]["settings"]["flood"] if lock_flood == "yes" then if not lang then return "🔒*Flooding* _Is Already Locked_🔒" elseif lang then return "⚔ ارسال پیام مکرر درقلمرو هم اکنون ممنوع است ⚔" end else data[tostring(target)]["settings"]["flood"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Flooding* _Has Been Locked_🔒" else return "⚔ ارسال پیام مکرر درقلمرو ممنوع شد ⚔" end end end local function unlock_flood(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_flood = data[tostring(target)]["settings"]["flood"] if lock_flood == "no" then if not lang then return "🔓*Flooding* _Is Not Locked_🔓" elseif lang then return "❗️ارسال پیام مکرر در قلمرو ممنوع نمیباشد❗️" end else data[tostring(target)]["settings"]["flood"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Flooding* _Has Been Unlocked_🔓" else return "❗️ارسال پیام مکرر در قلمرو آزاد شد❗️" end end end ---------------Lock Bots------------------- local function lock_bots(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_bots = data[tostring(target)]["settings"]["lock_bots"] if lock_bots == "yes" then if not lang then return "🔒*Bots* _Protection Is Already Enabled_🔒" elseif lang then return "💀 محافظت ازقلمرو در برابر ربات های مخرب هم اکنون فعال است 💀" end else data[tostring(target)]["settings"]["lock_bots"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Bots* _Protection Has Been Enabled_🔒" else return "💀 محافظت ازقلمرو در برابر ربات های مخرب هم اکنون فعال شد 💀" end end end local function unlock_bots(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_bots = data[tostring(target)]["settings"]["lock_bots"] if lock_bots == "no" then if not lang then return "🔓*Bots* _Protection Is Not Enabled_🔓" elseif lang then return "❗️محافظت ازقلمرو در برابر ربات های مخرب غیر فعال است ❗️" end else data[tostring(target)]["settings"]["lock_bots"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Bots* _Protection Has Been Disabled_🔓" else return "❗️محافظت ازقلمرو در برابر ربات های مخرب غیر فعال شد❗️" end end end ---------------Lock Markdown------------------- local function lock_markdown(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_markdown = data[tostring(target)]["settings"]["lock_markdown"] if lock_markdown == "yes" then if not lang then return "🔒*Markdown* _Posting Is Already Locked_🔒" elseif lang then return "⚔ ارسال پیام های دارای فونت در قلمرو هم اکنون ممنوع است ⚔" end else data[tostring(target)]["settings"]["lock_markdown"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Markdown* _Posting Has Been Locked_🔒" else return "⚔ ارسال پیام های دارای فونت در قلمرو ممنوع شد ⚔" end end end local function unlock_markdown(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_markdown = data[tostring(target)]["settings"]["lock_markdown"] if lock_markdown == "no" then if not lang then return "🔓*Markdown* _Posting Is Not Locked_🔓" elseif lang then return "❗️ارسال پیام های دارای فونت در قلمرو ممنوع نمیباشد❗️" end else data[tostring(target)]["settings"]["lock_markdown"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Markdown* _Posting Has Been Unlocked_🔓" else return "❗️ارسال پیام های دارای فونت در قلمرو آزاد شد❗️" end end end ---------------Lock Webpage------------------- local function lock_webpage(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_webpage = data[tostring(target)]["settings"]["lock_webpage"] if lock_webpage == "yes" then if not lang then return "🔒*Webpage* _Is Already Locked_🔒" elseif lang then return "🔒ارسال صفحات وب در گروه هم اکنون ممنوع است🔒" end else data[tostring(target)]["settings"]["lock_webpage"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔒*Webpage* _Has Been Locked_🔒" else return "🔒ارسال صفحات وب در گروه ممنوع شد🔒" end end end local function unlock_webpage(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local lock_webpage = data[tostring(target)]["settings"]["lock_webpage"] if lock_webpage == "no" then if not lang then return "🔓*Webpage* _Is Not Locked_🔓" elseif lang then return "🔓ارسال صفحات وب در گروه ممنوع نمیباشد🔓" end else data[tostring(target)]["settings"]["lock_webpage"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔓*Webpage* _Has Been Unlocked_🔓" else return "🔓ارسال صفحات وب در گروه آزاد شد🔓" end end end function group_settings(msg, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local data = load_data(_config.moderation.data) local target = msg.chat_id_ if data[tostring(target)] then if data[tostring(target)]["settings"]["num_msg_max"] then NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['num_msg_max']) print('custom'..NUM_MSG_MAX) else NUM_MSG_MAX = 5 end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_link"] then data[tostring(target)]["settings"]["lock_link"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_tag"] then data[tostring(target)]["settings"]["lock_tag"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_fosh"] then data[tostring(target)]["settings"]["lock_fosh"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_mention"] then data[tostring(target)]["settings"]["lock_mention"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_arabic"] then data[tostring(target)]["settings"]["lock_arabic"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_edit"] then data[tostring(target)]["settings"]["lock_edit"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_spam"] then data[tostring(target)]["settings"]["lock_spam"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_flood"] then data[tostring(target)]["settings"]["lock_flood"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_bots"] then data[tostring(target)]["settings"]["lock_bots"] = "yes" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_markdown"] then data[tostring(target)]["settings"]["lock_markdown"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["lock_webpage"] then data[tostring(target)]["settings"]["lock_webpage"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["welcome"] then data[tostring(target)]["settings"]["welcome"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_all"] then data[tostring(target)]["settings"]["mute_all"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_gif"] then data[tostring(target)]["settings"]["mute_gif"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_text"] then data[tostring(target)]["settings"]["mute_text"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_photo"] then data[tostring(target)]["settings"]["mute_photo"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_video"] then data[tostring(target)]["settings"]["mute_video"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_audio"] then data[tostring(target)]["settings"]["mute_audio"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_voice"] then data[tostring(target)]["settings"]["mute_voice"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_sticker"] then data[tostring(target)]["settings"]["mute_sticker"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_contact"] then data[tostring(target)]["settings"]["mute_contact"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_forward"] then data[tostring(target)]["settings"]["mute_forward"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_location"] then data[tostring(target)]["settings"]["mute_location"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_document"] then data[tostring(target)]["settings"]["mute_document"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_tgservice"] then data[tostring(target)]["settings"]["mute_tgservice"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_inline"] then data[tostring(target)]["settings"]["mute_inline"] = "no" end end if data[tostring(target)]["settings"] then if not data[tostring(target)]["settings"]["mute_game"] then data[tostring(target)]["settings"]["mute_game"] = "no" end end local expiretime = redis:hget('expiretime', msg.chat_id_) local expire = '' if not expiretime then expire = expire..'Unlimited' else local now = tonumber(os.time()) expire = expire..math.floor((tonumber(expiretime) - tonumber(now)) / 86400) + 1 end if not lang then local settings = data[tostring(target)]["settings"] text = "🔰*Group Settings*🔰\n\n🔐_Lock edit :_ *"..settings.lock_edit.."*\n🔐_Lock links :_ *"..settings.lock_link.."*\n🔐_Lock fosh :_ *"..settings.lock_fosh.."*\n🔐_Lock tags :_ *"..settings.lock_tag.."*\n🔐_Lock Persian* :_ *"..settings.lock_arabic.."*\n🔐_Lock flood :_ *"..settings.flood.."*\n🔐_Lock spam :_ *"..settings.lock_spam.."*\n🔐_Lock mention :_ *"..settings.lock_mention.."*\n🔐_Lock webpage :_ *"..settings.lock_webpage.."*\n🔐_Lock markdown :_ *"..settings.lock_markdown.."*\n🔐_Bots protection :_ *"..settings.lock_bots.."*\n🔐_Flood sensitivity :_ *"..NUM_MSG_MAX.."*\n✋_welcome :_ *"..settings.welcome.."*\n\n 🔊Group Mute List 🔊 \n\n🔇_Mute all : _ *"..settings.mute_all.."*\n🔇_Mute gif :_ *"..settings.mute_gif.."*\n🔇_Mute text :_ *"..settings.mute_text.."*\n🔇_Mute inline :_ *"..settings.mute_inline.."*\n🔇_Mute game :_ *"..settings.mute_game.."*\n🔇_Mute photo :_ *"..settings.mute_photo.."*\n🔇_Mute video :_ *"..settings.mute_video.."*\n🔇_Mute audio :_ *"..settings.mute_audio.."*\n🔇_Mute voice :_ *"..settings.mute_voice.."*\n🔇_Mute sticker :_ *"..settings.mute_sticker.."*\n🔇_Mute contact :_ *"..settings.mute_contact.."*\n🔇_Mute forward :_ *"..settings.mute_forward.."*\n🔇_Mute location :_ *"..settings.mute_location.."*\n🔇_Mute document :_ *"..settings.mute_document.."*\n🔇_Mute TgService :_ *"..settings.mute_tgservice.."*\n*__________________*\n⏱_expire time :_ *"..expire.."*\n*____________________*\n*Language* : *EN*" else local settings = data[tostring(target)]["settings"] text = "🔰*تنظیمات گروه*🔰\n\n🔐_قفل ویرایش پیام :_ *"..settings.lock_edit.."*\n🔐_قفل لینک :_ *"..settings.lock_link.."*\n🔐_قفل فحش :_ *"..settings.lock_fosh.."*\n🔐_قفل تگ :_ *"..settings.lock_tag.."*\n🔐_قفل فارسی* :_ *"..settings.lock_arabic.."*\n🔐_قفل پیام مکرر :_ *"..settings.flood.."*\n🔐_قفل هرزنامه :_ *"..settings.lock_spam.."*\n🔐_قفل فراخوانی :_ *"..settings.lock_mention.."*\n🔐_قفل صفحات وب :_ *"..settings.lock_webpage.."*\n🔐_قفل فونت :_ *"..settings.lock_markdown.."*\n🔐_محافظت در برابر ربات ها :_ *"..settings.lock_bots.."*\n🔐_حداکثر پیام مکرر :_ *"..NUM_MSG_MAX.."*\n✋_پیام خوش آمد گویی :_ *"..settings.welcome.."*\n\n 🔊لیست ممنوعیت ها 🔊 \n\n🔇_ممنوع کردن همه : _ *"..settings.mute_all.."*\n🔇_ممنوع کردن تصاویر متحرک :_ *"..settings.mute_gif.."*\n🔇_ممنوع کردن متن :_ *"..settings.mute_text.."*\n🔇_تبلیغات شیشه ای ممنوع :_ *"..settings.mute_inline.."*\n🔇_ممنوع کردن بازی :_ *"..settings.mute_game.."*\n🔇_ممنوع کردن عکس :_ *"..settings.mute_photo.."*\n🔇_ممنوع کردن فیلم :_ *"..settings.mute_video.."*\n🔇_ممنوع کردن آهنگ :_ *"..settings.mute_audio.."*\n🔇_ممنوع کردن صدا :_ *"..settings.mute_voice.."*\n🔇_ممنوع کردن استیکر :_ *"..settings.mute_sticker.."*\n🔇_ممنوع کردن ارسال اطلاعات :_ *"..settings.mute_contact.."*\n🔇_ممنوع کردن فوروارد :_ *"..settings.mute_forward.."*\n🔇_ممنوع کردن ارسال مکان :_ *"..settings.mute_location.."*\n🔇_ممنوع کردن ارسال فایل :_ *"..settings.mute_document.."*\n🔇_ممنوع کردن اعلانات :_ *"..settings.mute_tgservice.."*\n*__________________*\n⏱_تاریخ انقضا :_ *"..expire.."*\n*____________________*\n*زبان ربات* : *فارسی*" end return text end --------Mutes--------- --------Mute all------------------------ local function mute_all(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_all = data[tostring(target)]["settings"]["mute_all"] if mute_all == "yes" then if not lang then return "🔇*Mute All* _Is Already Enabled_🔇" elseif lang then return "😶بیصدا کردن همه فعال است😶" end else data[tostring(target)]["settings"]["mute_all"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute All* _Has Been Enabled_🔇" else return "😶🔇بیصدا کردن همه فعال شد🔇😶" end end end local function unmute_all(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_all = data[tostring(target)]["settings"]["mute_all"] if mute_all == "no" then if not lang then return "🔊*Mute All* _Is Already Disabled_🔊" elseif lang then return "🔊بیصدا کردن همه غیر فعال است🔊" end else data[tostring(target)]["settings"]["mute_all"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute All* _Has Been Disabled_🔊" else return "🔊😃بیصدا کردن همه غیر فعال شد😃🔊" end end end ---------------Mute Gif------------------- local function mute_gif(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_gif = data[tostring(target)]["settings"]["mute_gif"] if mute_gif == "yes" then if not lang then return "🔇*Mute Gif* _Is Already Enabled_🔇" elseif lang then return "⚔ ارسال تصاویر متحرک در قلمرو ممنوع است ⚔" end else data[tostring(target)]["settings"]["mute_gif"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Gif* _Has Been Enabled_🔊" else return "⚔ ارسال تصاویر متحرک در قلمرو ممنوع شد ⚔" end end end local function unmute_gif(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_gif = data[tostring(target)]["settings"]["mute_gif"] if mute_gif == "no" then if not lang then return "🔇*Mute Gif* _Is Already Disabled_🔇" elseif lang then return "❗️ارسال تصاویر متحرک در قلمرو غیر فعال بود❗️" end else data[tostring(target)]["settings"]["mute_gif"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Gif* _Has Been Disabled_🔇" else return "❗️ارسال تصاویر متحرک در قلمرو غیر فعال شد❗️" end end end ---------------Mute Game------------------- local function mute_game(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_game = data[tostring(target)]["settings"]["mute_game"] if mute_game == "yes" then if not lang then return "🔇*Mute Game* _Is Already Enabled_🔇" elseif lang then return "☑️اجرا نکردن بازی های تحت وب فعال است☑️" end else data[tostring(target)]["settings"]["mute_game"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Game* _Has Been Enabled_🔇" else return "☑️اجرا نکردن بازی های تحت وب فعال شد☑️" end end end local function unmute_game(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_game = data[tostring(target)]["settings"]["mute_game"] if mute_game == "no" then if not lang then return "🔊*Mute Game* _Is Already Disabled_🔊" elseif lang then return "❗️اجرا نکردن بازی های تحت وب غیر فعال است❗️" end else data[tostring(target)]["settings"]["mute_game"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Game* _Has Been Disabled_🔊" else return "❗️اجرا نکردن بازی های تحت وب غیر فعال شد❗️" end end end ---------------Mute Inline------------------- local function mute_inline(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_inline = data[tostring(target)]["settings"]["mute_inline"] if mute_inline == "yes" then if not lang then return "🔇*Mute Inline* _Is Already Enabled_🔇" elseif lang then return "☑️ممنوعیت کیبورد شیشه ای فعال است☑️" end else data[tostring(target)]["settings"]["mute_inline"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Inline* _Has Been Enabled_🔇" else return "☑️ممنوعیت کیبورد شیشه ای فعال شد☑️" end end end local function unmute_inline(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_inline = data[tostring(target)]["settings"]["mute_inline"] if mute_inline == "no" then if not lang then return "🔊*Mute Inline* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت کیبورد شیشه ای غیر فعال است❗️" end else data[tostring(target)]["settings"]["mute_inline"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Inline* _Has Been Disabled_🔊" else return "❗️ممنوعیت کیبورد شیشه ای غیر فعال شد❗️" end end end ---------------Mute Text------------------- local function mute_text(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_text = data[tostring(target)]["settings"]["mute_text"] if mute_text == "yes" then if not lang then return "🔇*Mute Text* _Is Already Enabled_🔇" elseif lang then return "☑️ممنوعیت متن فعال است☑️" end else data[tostring(target)]["settings"]["mute_text"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Text* _Has Been Enabled_🔇" else return "☑️ممنوعیت متن فعال شد☑️" end end end local function unmute_text(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_text = data[tostring(target)]["settings"]["mute_text"] if mute_text == "no" then if not lang then return "🔊*Mute Text* _Is Already Disabled_🔊" elseif lang then return "✍ممنوعیت متن غیر فعال است✍" end else data[tostring(target)]["settings"]["mute_text"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Text* _Has Been Disabled_🔊" else return "✍ممنوعیت متن غیر فعال شد✍" end end end ---------------Mute photo------------------- local function mute_photo(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "🔇_You're Not_ *Moderator*🔇" else return "🔇شما مدیر گروه نمیباشید🔇" end end local mute_photo = data[tostring(target)]["settings"]["mute_photo"] if mute_photo == "yes" then if not lang then return "🔇*Mute Photo* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال عکس در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_photo"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Photo* _Has Been Enabled_🔇" else return "⚔ ممنوعیت ارسال عکس در قلمرو فعال شد ⚔" end end end local function unmute_photo(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_photo = data[tostring(target)]["settings"]["mute_photo"] if mute_photo == "no" then if not lang then return "🔊*Mute Photo* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال عکس در قلمرو غیر فعال است❗️" end else data[tostring(target)]["settings"]["mute_photo"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Photo* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال عکس در قلمرو غیر فعال شد❗️" end end end ---------------Mute Video------------------- local function mute_video(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_video = data[tostring(target)]["settings"]["mute_video"] if mute_video == "yes" then if not lang then return "🔇*Mute Video* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال فیلم در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_video"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Video* _Has Been Enabled_🔇" else return "⚔ ممنوعیت ارسال فیلم در قلمرو فعال شد ⚔" end end end local function unmute_video(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_video = data[tostring(target)]["settings"]["mute_video"] if mute_video == "no" then if not lang then return "🔊*Mute Video* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال فیلم در قلمرو غیر فعال است❗️" end else data[tostring(target)]["settings"]["mute_video"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Video* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال فیلم در قلمرو غیر فعال شد❗️" end end end ---------------Mute Audio------------------- local function mute_audio(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_audio = data[tostring(target)]["settings"]["mute_audio"] if mute_audio == "yes" then if not lang then return "🔇*Mute Audio* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال آهنگ در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_audio"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Audio* _Has Been Enabled_🔇" else return "⚔ ممنوعیت ارسال آهنگ در قلمرو فعال شد ⚔" end end end local function unmute_audio(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_audio = data[tostring(target)]["settings"]["mute_audio"] if mute_audio == "no" then if not lang then return "🔊*Mute Audio* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال آهنگ در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_audio"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Audio* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال آهنگ در قلمرو غیرفعال شد❗️" end end end ---------------Mute Voice------------------- local function mute_voice(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_voice = data[tostring(target)]["settings"]["mute_voice"] if mute_voice == "yes" then if not lang then return "🔇*Mute Voice* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال صدا در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_voice"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Voice* _Has Been Enabled_🔇" else return " ممنوعیت ارسال صدا در قلمرو فعال شد ⚔" end end end local function unmute_voice(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_voice = data[tostring(target)]["settings"]["mute_voice"] if mute_voice == "no" then if not lang then return "🔊*Mute Voice* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال صدا در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_voice"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Voice* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال صدا در قلمرو غیرفعال شد❗️" end end end ---------------Mute Sticker------------------- local function mute_sticker(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_sticker = data[tostring(target)]["settings"]["mute_sticker"] if mute_sticker == "yes" then if not lang then return "🔇*Mute Sticker* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال استیکر در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_sticker"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Sticker* _Has Been Enabled_🔇" else return "⚔ ممنوعیت ارسال استیکر در قلمرو فعال شد ⚔" end end end local function unmute_sticker(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_sticker = data[tostring(target)]["settings"]["mute_sticker"] if mute_sticker == "no" then if not lang then return "🔊*Mute Sticker* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال استیکر در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_sticker"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Sticker* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال استیکر در قلمرو غیرفعال شد❗️" end end end ---------------Mute Contact------------------- local function mute_contact(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_contact = data[tostring(target)]["settings"]["mute_contact"] if mute_contact == "yes" then if not lang then return "🔇*Mute Contact* _Is Already Enabled_🔇" elseif lang then return "☑️ممنوعیت ارسال مخاطب در قلمرو فعال است☑️" end else data[tostring(target)]["settings"]["mute_contact"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Contact* _Has Been Enabled_🔇" else return "☑️ممنوعیت ارسال مخاطب در قلمرو فعال شد☑️" end end end local function unmute_contact(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_contact = data[tostring(target)]["settings"]["mute_contact"] if mute_contact == "no" then if not lang then return "🔊*Mute Contact* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال مخاطب در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_contact"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Contact* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال مخاطب در قلمرو غیرفعال شد❗️" end end end ---------------Mute Forward------------------- local function mute_forward(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_forward = data[tostring(target)]["settings"]["mute_forward"] if mute_forward == "yes" then if not lang then return "🔇*Mute Forward* _Is Already Enabled_🔇" elseif lang then return "⚔ ممنوعیت ارسال فوروارد در قلمرو فعال است ⚔" end else data[tostring(target)]["settings"]["mute_forward"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Forward* _Has Been Enabled_🔇" else return "⚔ ممنوعیت ارسال فوروارد در قلمرو فعال شد ⚔" end end end local function unmute_forward(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_forward = data[tostring(target)]["settings"]["mute_forward"] if mute_forward == "no" then if not lang then return "🔊*Mute Forward* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال فوروارد در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_forward"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Forward* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال فوروارد در قلمرو غیرفعال شد❗️" end end end ---------------Mute Location------------------- local function mute_location(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_location = data[tostring(target)]["settings"]["mute_location"] if mute_location == "yes" then if not lang then return "🔇*Mute Location* _Is Already Enabled_🔇" elseif lang then return "🔇بیصدا کردن موقعیت فعال است🔇" end else data[tostring(target)]["settings"]["mute_location"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Location* _Has Been Enabled_🔇" else return "🔇بیصدا کردن موقعیت فعال شد🔇" end end end local function unmute_location(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_location = data[tostring(target)]["settings"]["mute_location"] if mute_location == "no" then if not lang then return "🔊*Mute Location* _Is Already Disabled_🔊" elseif lang then return "🔊بیصدا کردن موقعیت غیر فعال است🔊" end else data[tostring(target)]["settings"]["mute_location"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Location* _Has Been Disabled_🔊" else return "🔊بیصدا کردن موقعیت غیر فعال شد🔊" end end end ---------------Mute Document------------------- local function mute_document(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_document = data[tostring(target)]["settings"]["mute_document"] if mute_document == "yes" then if not lang then return "🔇*Mute Document* _Is Already Enabled_🔇" elseif lang then return "☑️ممنوعیت ارسال اسناد در قلمرو فعال است☑️" end else data[tostring(target)]["settings"]["mute_document"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute Document* _Has Been Enabled_🔇" else return "☑️ممنوعیت ارسال اسناد در قلمرو فعال شد☑️" end end end local function unmute_document(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_document = data[tostring(target)]["settings"]["mute_document"] if mute_document == "no" then if not lang then return "🔊*Mute Document* _Is Already Disabled_🔊" elseif lang then return "❗️ممنوعیت ارسال اسناد در قلمرو غیرفعال است❗️" end else data[tostring(target)]["settings"]["mute_document"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute Document* _Has Been Disabled_🔊" else return "❗️ممنوعیت ارسال اسناد در قلمرو غیرفعال شد❗️" end end end ---------------Mute TgService------------------- local function mute_tgservice(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نمیباشید" end end local mute_tgservice = data[tostring(target)]["settings"]["mute_tgservice"] if mute_tgservice == "yes" then if not lang then return "🔇*Mute TgService* _Is Already Enabled_🔇" elseif lang then return "🔇بیصدا کردن خدمات تلگرام فعال است🔇" end else data[tostring(target)]["settings"]["mute_tgservice"] = "yes" save_data(_config.moderation.data, data) if not lang then return "🔇*Mute TgService* _Has Been Enabled_🔇" else return "🔇بیصدا کردن خدمات تلگرام فعال شد🔇" end end end local function unmute_tgservice(msg, data, target) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) if not is_mod(msg) then if not lang then return "_You're Not_ *Moderator*" else return "شما مدیر گروه نیستید" end end local mute_tgservice = data[tostring(target)]["settings"]["mute_tgservice"] if mute_tgservice == "no" then if not lang then return "🔊*Mute TgService* _Is Already Disabled_🔊" elseif lang then return "🔊بیصدا کردن خدمات تلگرام غیر فعال است🔊" end else data[tostring(target)]["settings"]["mute_tgservice"] = "no" save_data(_config.moderation.data, data) if not lang then return "🔊*Mute TgService* _Has Been Disabled_🔊" else return "🔊بیصدا کردن خدمات تلگرام غیر فعال شد🔊" end end end local function run(msg, matches) local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) local data = load_data(_config.moderation.data) local chat = msg.chat_id_ local user = msg.sender_user_id_ if matches[1] == "id" then if not matches[2] and tonumber(msg.reply_to_message_id_) == 0 then if not lang then return "*Chat ID :* _"..chat.."_\n*User ID :* _"..user.."_" else return "*شناسه گروه :* _"..chat.."_\n*شناسه شما :* _"..user.."_" end end if not matches[2] and tonumber(msg.reply_to_message_id_) ~= 0 then tdcli_function ({ ID = "GetMessage", chat_id_ = msg.chat_id_, message_id_ = msg.reply_to_message_id_ }, action_by_reply, {chat_id=msg.chat_id_,cmd="id"}) end if matches[2] and tonumber(msg.reply_to_message_id_) == 0 then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="id"}) end end if matches[1] == "pin" and is_owner(msg) then tdcli.pinChannelMessage(msg.chat_id_, msg.reply_to_message_id_, 1) if not lang then return "*Message Has Been Pinned*" else return "پیام سجاق شد" end end if matches[1] == 'unpin' and is_mod(msg) then tdcli.unpinChannelMessage(msg.chat_id_) if not lang then return "*Pin message has been unpinned*" else return "پیام سنجاق شده پاک شد" end end if matches[1] == "add" then return modadd(msg) end if matches[1] == "rem" then return modrem(msg) end if matches[1] == "setowner" and is_admin(msg) then if not matches[2] and tonumber(msg.reply_to_message_id_) ~= 0 then tdcli_function ({ ID = "GetMessage", chat_id_ = msg.chat_id_, message_id_ = msg.reply_to_message_id_ }, action_by_reply, {chat_id=msg.chat_id_,cmd="setowner"}) end if matches[2] and string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "GetUser", user_id_ = matches[2], }, action_by_id, {chat_id=msg.chat_id_,user_id=matches[2],cmd="setowner"}) end if matches[2] and not string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="setowner"}) end end if matches[1] == "remowner" and is_admin(msg) then if not matches[2] and tonumber(msg.reply_to_message_id_) ~= 0 then tdcli_function ({ ID = "GetMessage", chat_id_ = msg.chat_id_, message_id_ = msg.reply_to_message_id_ }, action_by_reply, {chat_id=msg.chat_id_,cmd="remowner"}) end if matches[2] and string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "GetUser", user_id_ = matches[2], }, action_by_id, {chat_id=msg.chat_id_,user_id=matches[2],cmd="remowner"}) end if matches[2] and not string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="remowner"}) end end if matches[1] == "promote" and is_owner(msg) then if not matches[2] and tonumber(msg.reply_to_message_id_) ~= 0 then tdcli_function ({ ID = "GetMessage", chat_id_ = msg.chat_id_, message_id_ = msg.reply_to_message_id_ }, action_by_reply, {chat_id=msg.chat_id_,cmd="promote"}) end if matches[2] and string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "GetUser", user_id_ = matches[2], }, action_by_id, {chat_id=msg.chat_id_,user_id=matches[2],cmd="promote"}) end if matches[2] and not string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="promote"}) end end if matches[1] == "demote" and is_owner(msg) then if not matches[2] and tonumber(msg.reply_to_message_id_) ~= 0 then tdcli_function ({ ID = "GetMessage", chat_id_ = msg.chat_id_, message_id_ = msg.reply_to_message_id_ }, action_by_reply, {chat_id=msg.chat_id_,cmd="demote"}) end if matches[2] and string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "GetUser", user_id_ = matches[2], }, action_by_id, {chat_id=msg.chat_id_,user_id=matches[2],cmd="demote"}) end if matches[2] and not string.match(matches[2], '^%d+$') then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="demote"}) end end if matches[1] == "lock" and is_mod(msg) then local target = msg.chat_id_ if matches[2] == "link" then return lock_link(msg, data, target) end if matches[2] == "fosh" then return lock_fosh(msg, data, target) end if matches[2] == "tag" then return lock_tag(msg, data, target) end if matches[2] == "mention" then return lock_mention(msg, data, target) end if matches[2] == "arabic" then return lock_arabic(msg, data, target) end if matches[2] == "edit" then return lock_edit(msg, data, target) end if matches[2] == "spam" then return lock_spam(msg, data, target) end if matches[2] == "flood" then return lock_flood(msg, data, target) end if matches[2] == "bots" then return lock_bots(msg, data, target) end if matches[2] == "markdown" then return lock_markdown(msg, data, target) end if matches[2] == "webpage" then return lock_webpage(msg, data, target) end end if matches[1] == "unlock" and is_mod(msg) then local target = msg.chat_id_ if matches[2] == "link" then return unlock_link(msg, data, target) end if matches[2] == "fosh" then return unlock_fosh(msg, data, target) end if matches[2] == "tag" then return unlock_tag(msg, data, target) end if matches[2] == "mention" then return unlock_mention(msg, data, target) end if matches[2] == "arabic" then return unlock_arabic(msg, data, target) end if matches[2] == "edit" then return unlock_edit(msg, data, target) end if matches[2] == "spam" then return unlock_spam(msg, data, target) end if matches[2] == "flood" then return unlock_flood(msg, data, target) end if matches[2] == "bots" then return unlock_bots(msg, data, target) end if matches[2] == "markdown" then return unlock_markdown(msg, data, target) end if matches[2] == "webpage" then return unlock_webpage(msg, data, target) end end if matches[1] == "mute" and is_mod(msg) then local target = msg.chat_id_ if matches[2] == "all" then return mute_all(msg, data, target) end if matches[2] == "gif" then return mute_gif(msg, data, target) end if matches[2] == "text" then return mute_text(msg ,data, target) end if matches[2] == "photo" then return mute_photo(msg ,data, target) end if matches[2] == "video" then return mute_video(msg ,data, target) end if matches[2] == "audio" then return mute_audio(msg ,data, target) end if matches[2] == "voice" then return mute_voice(msg ,data, target) end if matches[2] == "sticker" then return mute_sticker(msg ,data, target) end if matches[2] == "contact" then return mute_contact(msg ,data, target) end if matches[2] == "forward" then return mute_forward(msg ,data, target) end if matches[2] == "location" then return mute_location(msg ,data, target) end if matches[2] == "document" then return mute_document(msg ,data, target) end if matches[2] == "tgservice" then return mute_tgservice(msg ,data, target) end if matches[2] == "inline" then return mute_inline(msg ,data, target) end if matches[2] == "game" then return mute_game(msg ,data, target) end end if matches[1] == "unmute" and is_mod(msg) then local target = msg.chat_id_ if matches[2] == "all" then return unmute_all(msg, data, target) end if matches[2] == "gif" then return unmute_gif(msg, data, target) end if matches[2] == "text" then return unmute_text(msg, data, target) end if matches[2] == "photo" then return unmute_photo(msg ,data, target) end if matches[2] == "video" then return unmute_video(msg ,data, target) end if matches[2] == "audio" then return unmute_audio(msg ,data, target) end if matches[2] == "voice" then return unmute_voice(msg ,data, target) end if matches[2] == "sticker" then return unmute_sticker(msg ,data, target) end if matches[2] == "contact" then return unmute_contact(msg ,data, target) end if matches[2] == "forward" then return unmute_forward(msg ,data, target) end if matches[2] == "location" then return unmute_location(msg ,data, target) end if matches[2] == "document" then return unmute_document(msg ,data, target) end if matches[2] == "tgservice" then return unmute_tgservice(msg ,data, target) end if matches[2] == "inline" then return unmute_inline(msg ,data, target) end if matches[2] == "game" then return unmute_game(msg ,data, target) end end if matches[1] == "gpinfo" and is_mod(msg) and gp_type(msg.chat_id_) == "channel" then local function group_info(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) if not lang then ginfo = "*📢Group Info :*📢\n👲_Admin Count :_ *"..data.administrator_count_.."*\n👥_Member Count :_ *"..data.member_count_.."*\n👿_Kicked Count :_ *"..data.kicked_count_.."*\n🆔_Group ID :_ *"..data.channel_.id_.."*" print(serpent.block(data)) elseif lang then ginfo = "📢*اطلاعات گروه *📢\n👲_تعداد مدیران :_ *"..data.administrator_count_.."*\n👥_تعداد اعضا :_ *"..data.member_count_.."*\n👿_تعداد اعضای حذف شده :_ *"..data.kicked_count_.."*\n🆔_شناسه گروه :_ *"..data.channel_.id_.."*" print(serpent.block(data)) end tdcli.sendMessage(arg.chat_id, arg.msg_id, 1, ginfo, 1, 'md') end tdcli.getChannelFull(msg.chat_id_, group_info, {chat_id=msg.chat_id_,msg_id=msg.id_}) end if matches[1] == 'setlink' and is_owner(msg) then data[tostring(chat)]['settings']['linkgp'] = 'waiting' save_data(_config.moderation.data, data) if not lang then return '_Please send the new group_ *link* _now_' else return 'لطفا لینک گروه خود را ارسال کنید' end end if msg.content_.text_ then local is_link = msg.content_.text_:match("^([https?://w]*.?telegram.me/joinchat/%S+)$") or msg.content_.text_:match("^([https?://w]*.?t.me/joinchat/%S+)$") if is_link and data[tostring(chat)]['settings']['linkgp'] == 'waiting' and is_owner(msg) then data[tostring(chat)]['settings']['linkgp'] = msg.content_.text_ save_data(_config.moderation.data, data) if not lang then return "*Newlink* _has been set_" else return "لینک جدید ذخیره شد" end end end if matches[1] == 'link' and is_mod(msg) then local linkgp = data[tostring(chat)]['settings']['linkgp'] if not linkgp then if not lang then return "_First set a link for group with using_ /setlink" else return "اول لینک گروه خود را ذخیره کنید با /setlink" end end if not lang then text = "<b>Group Link :</b>\n"..linkgp else text = "<b>لینک گروه :</b>\n"..linkgp end return tdcli.sendMessage(chat, msg.id_, 1, text, 1, 'html') end if matches[1] == "setrules" and matches[2] and is_mod(msg) then data[tostring(chat)]['rules'] = matches[2] save_data(_config.moderation.data, data) if not lang then return "*Group rules* _has been set_" else return "قوانین گروه ثبت شد" end end if matches[1] == "rules" then if not data[tostring(chat)]['rules'] then if not lang then rules = "ℹ️ The Default Rules :\n1⃣ No Flood.\n2⃣ No Spam.\n3⃣ No Advertising.\n4⃣ Try to stay on topic.\n5⃣ Forbidden any racist, sexual, homophobic or gore content.\n➡️ Repeated failure to comply with these rules will cause ban.\n" elseif lang then rules = "ℹ️ قوانین پپیشفرض:\n1⃣ ارسال پیام مکرر ممنوع.\n2⃣ اسپم ممنوع.\n3⃣ تبلیغ ممنوع.\n4⃣ سعی کنید از موضوع خارج نشید.\n5⃣ هرنوع نژاد پرستی, شاخ بازی و پورنوگرافی ممنوع .\n➡️ از قوانین پیروی کنید, در صورت عدم رعایت قوانین اول اخطار و در صورت تکرار مسدود.\n" end else rules = "*Group Rules :*\n"..data[tostring(chat)]['rules'] end return rules end if matches[1] == "res" and matches[2] and is_mod(msg) then tdcli_function ({ ID = "SearchPublicChat", username_ = matches[2] }, action_by_username, {chat_id=msg.chat_id_,username=matches[2],cmd="res"}) end if matches[1] == "whois" and matches[2] and is_mod(msg) then tdcli_function ({ ID = "GetUser", user_id_ = matches[2], }, action_by_id, {chat_id=msg.chat_id_,user_id=matches[2],cmd="whois"}) end if matches[1] == 'setflood' and is_mod(msg) then if tonumber(matches[2]) < 1 or tonumber(matches[2]) > 50 then return "_Wrong number, range is_ *[1-50]*" end local flood_max = matches[2] data[tostring(chat)]['settings']['num_msg_max'] = flood_max save_data(_config.moderation.data, data) return "_Group_ *flood* _sensitivity has been set to :_ *[ "..matches[2].." ]*" end if matches[1]:lower() == 'clean' and is_owner(msg) then if matches[2] == 'mods' then if next(data[tostring(chat)]['mods']) == nil then if not lang then return "_No_ *moderators* _in this group_" else return "هیچ مدیری برای گروه انتخاب نشده است" end end for k,v in pairs(data[tostring(chat)]['mods']) do data[tostring(chat)]['mods'][tostring(k)] = nil save_data(_config.moderation.data, data) end if not lang then return "_All_ *moderators* _has been demoted_" else return "تمام مدیران گروه تنزیل مقام شدند" end end if matches[2] == 'filterlist' then if next(data[tostring(chat)]['filterlist']) == nil then if not lang then return "*Filtered words list* _is empty_" else return "_لیست کلمات فیلتر شده خالی است_" end end for k,v in pairs(data[tostring(chat)]['filterlist']) do data[tostring(chat)]['filterlist'][tostring(k)] = nil save_data(_config.moderation.data, data) end if not lang then return "*Filtered words list* _has been cleaned_" else return "_لیست کلمات فیلتر شده پاک شد_" end end if matches[2] == 'rules' then if not data[tostring(chat)]['rules'] then if not lang then return "_No_ *rules* _available_" else return "قوانین برای گروه ثبت نشده است" end end data[tostring(chat)]['rules'] = nil save_data(_config.moderation.data, data) if not lang then return "*Group rules* _has been cleaned_" else return "قوانین گروه پاک شد" end end if matches[2] == 'welcome' then if not data[tostring(chat)]['setwelcome'] then if not lang then return "*Welcome Message not set*" else return "پیام خوشآمد گویی ثبت نشده است" end end data[tostring(chat)]['setwelcome'] = nil save_data(_config.moderation.data, data) if not lang then return "*Welcome message* _has been cleaned_" else return "پیام خوشآمد گویی پاک شد" end end if matches[2] == 'about' then if gp_type(chat) == "chat" then if not data[tostring(chat)]['about'] then if not lang then return "_No_ *description* _available_" else return "پیامی مبنی بر درباره گروه ثبت نشده است" end end data[tostring(chat)]['about'] = nil save_data(_config.moderation.data, data) elseif gp_type(chat) == "channel" then tdcli.changeChannelAbout(chat, "", dl_cb, nil) end if not lang then return "*Group description* _has been cleaned_" else return "پیام مبنی بر درباره گروه پاک شد" end end end if matches[1]:lower() == 'clean' and is_admin(msg) then if matches[2] == 'owners' then if next(data[tostring(chat)]['owners']) == nil then if not lang then return "_No_ *owners* _in this group_" else return "مالکی برای گروه انتخاب نشده است" end end for k,v in pairs(data[tostring(chat)]['owners']) do data[tostring(chat)]['owners'][tostring(k)] = nil save_data(_config.moderation.data, data) end if not lang then return "_All_ *owners* _has been demoted_" else return "تمامی مالکان گروه تنزیل مقام شدند" end end end if matches[1] == "setname" and matches[2] and is_mod(msg) then local gp_name = matches[2] tdcli.changeChatTitle(chat, gp_name, dl_cb, nil) end if matches[1] == "setabout" and matches[2] and is_mod(msg) then if gp_type(chat) == "channel" then tdcli.changeChannelAbout(chat, matches[2], dl_cb, nil) elseif gp_type(chat) == "chat" then data[tostring(chat)]['about'] = matches[2] save_data(_config.moderation.data, data) end if not lang then return "*Group description* _has been set_" else return "پیام مبنی بر درباره گروه ثبت شد" end end if matches[1] == "about" and gp_type(chat) == "chat" then if not data[tostring(chat)]['about'] then if not lang then about = "_No_ *description* _available_" elseif lang then about = "پیامی مبنی بر درباره گروه ثبت نشده است" end else about = "*Group Description :*\n"..data[tostring(chat)]['about'] end return about end if matches[1] == 'filter' and is_mod(msg) then return filter_word(msg, matches[2]) end if matches[1] == 'unfilter' and is_mod(msg) then return unfilter_word(msg, matches[2]) end if matches[1] == 'filterlist' and is_mod(msg) then return filter_list(msg) end if matches[1] == "settings" then return group_settings(msg, target) end if matches[1] == "mutelist" then return mutes(msg, target) end if matches[1] == "modlist" then return modlist(msg) end if matches[1] == "ownerlist" and is_owner(msg) then return ownerlist(msg) end if matches[1] == "setlang" and is_owner(msg) then if matches[2] == "en" then local hash = "gp_lang:"..msg.chat_id_ local lang = redis:get(hash) redis:del(hash) return "_Group Language Set To:_ EN" elseif matches[2] == "fa" then redis:set(hash, true) return "*زبان گروه تنظیم شد به : فارسی*" end end if matches[1] == "help" and is_mod(msg) then if not lang then text = [[ 🔰*Bot Commands:*🔰 @Erfan_herkuless_051 در حال حاضر زبان ربات انگلیسی میباشد برای تغییر زبان دستور زیر را ارسال کنید *!setlang fa* 👑*!setowner* `[username|id|reply]` _Set Group Owner(Multi Owner)_ 👑*!remowner* `[username|id|reply]` _Remove User From Owner List_ 🤖*!promote* `[username|id|reply]` _Promote User To Group Admin_ 🤖*!demote* `[username|id|reply]` _Demote User From Group Admins List_ 🗣*!setflood* `[1-50]` _Set Flooding Number_ 🔇*!silent* `[username|id|reply]` _Silent User From Group_ 🔊*!unsilent* `[username|id|reply]` _Unsilent User From Group_ 👽*!kick* `[username|id|reply]` _Kick User From Group_ 👽*!ban* `[username|id|reply]` _Ban User From Group_ 👽*!unban* `[username|id|reply]` _UnBan User From Group_ 🔹*!res* `[username]` _Show User ID_ 🔹*!id* `[reply]` _Show User ID_ 🔹*!whois* `[id]` _Show User's Username And Name_ 🔒*!lock* `[link | tag | arabic | edit | fosh | webpage | bots | spam | flood | markdown | mention]` _If This Actions Lock, Bot Check Actions And Delete Them_ 🔓*!unlock* `[link | tag | arabic | edit | fosh | webpage | bots | spam | flood | markdown | mention]` _If This Actions Unlock, Bot Not Delete Them_ 🔕*!mute* `[gifs | photo | tgservice | document | sticker | video | text | forward | location | audio | voice | contact | all]` _If This Actions Lock, Bot Check Actions And Delete Them_ 🔔*!unmute* `[gif | photo | tgservice | document | sticker | video | tgservice | text | forward | inline | location | audio | voice | contact | all]` _If This Actions Unlock, Bot Not Delete Them_ 🔹*!set*`[rules | name | photo | link | about]` _Bot Set Them_ 🔹*!clean* `[bans | mods | bots | rules | about | silentlist]` _Bot Clean Them_ 🔹*!pin* `[reply]` _Pin Your Message_ 🔹*!unpin* _Unpin Pinned Message_ 🛡*!settings* _Show Group Settings_ 🔕*!silentlist* _Show Silented Users List_ 🔕*!banlist* _Show Banned Users List_ 👑*!ownerlist* _Show Group Owners List_ 🤖*!modlist* _Show Group Moderators List_ 🎖*!rules* _Show Group Rules_ ⚜*!gpinfo* _Show Group Information_ ⚜*!link* _Show Group Link_ 🔇*!mt 0 1* (0h 1m) 🔊*!unmt* _Mute All With Time_ 🚫*!filter* 🚫*!unfilter* _filter word_ 🚫*!filterlist* _Show Filter List_ 〰〰〰〰〰 ♻️*!del* 1-100 ♻️*!delall* `[reply]` _Delete Message_ 〰〰〰〰〰 ⏱*!setexpire* 30 ⏱*!expire* _set expire for group_ 〰〰〰〰〰 🎗*!setwelcome* متن پیام ➕*!welcome enable* ➖*!welcome disable* _set welcome for group_ 〰〰〰〰〰 📣*!broadcast* text _Send Msg To All Groups_ 〰〰〰〰〰 ⚙*!autoleave enable* ⚙*!autoleave disable* _set Auto leave_ _You Can Use_ *[!/#]* _To Run The Commands_ ]] elseif lang then text = [[ ⚔ برای دیدن دستورات مورد نظر خود مورد دلخواه را ارسال کنید ⚔ 💀دستورات مدیریتی ربات های king & queen 💀 درود بر گلادیاتور @Erfan_herkuless_051 ☑️ برای مشاهده دستورات مدیریتی دستور زیر را ارسال کنید #مدیریت ☑️برای مشاهده دستورات قفلی دستور زیر را ارسال کنید #قفل ☑️برای مشاهده دستورات ممنوعیت دستور زیر را ارسال کنید #ممنوع ☑️آگاهی از آنلاین بودن ربات ping ➖➖➖➖➖ در حال حاضر زبان ربات فارسی میباشد برای تغییر زبان دستور زیر را ارسال کنید *!setlang en* ... ]] end return text end if matches[1] == "قفل" and is_mod(msg) then text2 = [[ 🔐 لیست قفل ها 🔐 @Erfan_herkuless_051 .king & queen ⚔ قفل کردن لینک گروه ها ⛔️*قفل لینک* 💣*باز کردن لینک* ☑️☑️☑️☑️☑️☑️ ⚔ قفل کردن یوزرنیم ⛔️*قفل تگ* 💣*باز کردن تگ* ☑️☑️☑️☑️☑️☑️ ⚔ قفل کردن متن فارسی و عربی ⛔️*قفل عربی* 💣*باز کردن عربی* ☑️☑️☑️☑️☑️☑️ ⚔ قفل کردن لینک سایت ها ⛔️*قفل وبسایت* 💣*باز کردن وبسایت* ☑️☑️☑️☑️☑️☑️ ⚔ جلوگیری از ویرایش متن ⛔️*قفل ویرایش* 💣*باز کردن ویرایش* ☑️☑️☑️☑️☑️☑️ ⚔ جلوگیری از وارد کردن ربات ⛔️*قفل ربات* 💣*باز کردن ربات* ☑️☑️☑️☑️☑️☑️ ⚔ قفل پیام های طولانی ⛔️*قفل اسپم* 💣*باز کردن اسپم* ☑️☑️☑️☑️☑️☑️ ⚔ قفل پیام های رگباری ⛔️*قفل فلود* 💣*باز کردن فلود* ☑️☑️☑️☑️☑️☑️ ⚔ قفل بولد و ایتالیک متن ⛔️*قفل فونت* 💣*باز کردن فونت* ☑️☑️☑️☑️☑️☑️ ⚔ قفل هایپرلینک ⛔️*قفل هایپرلینک* 💣*باز کردن هایپرلینک* ☑️☑️☑️☑️☑️☑️ ⚔ قفل فحش ⛔️*قفل فحش* 💣*باز کردن فحش* ☑️☑️☑️☑️☑️☑️ در زدن دستورات به فاصله حروف دقت کنید ... ]] return text2 end if matches[1] == "ممنوع" and is_mod(msg) then text3 = [[ 🔕 لیست ممنوعیت ها 🔕 @Erfan_herkuless_051 .king & queen ⛔️ ارسال گیف ممنوع 🔇*ممنوعیت گیف* 💣*رفع ممنوعیت گیف* ➖➖➖➖➖➖➖ ⛔️ ارسال عکس ممنوع 🔇*ممنوعیت عکس* 💣*رفع ممنوعیت عکس* ➖➖➖➖➖➖➖ ⛔️ ارسال فایل ممنوع 🔇*ممنوعیت فایل* 💣*رفع ممنوعیت فایل* ➖➖➖➖➖➖➖ ⛔️ ارسال استیکر ممنوع 🔇*ممنوعیت استیکر* 💣*رفع ممنوعیت استیکر* ➖➖➖➖➖➖➖ ⛔️ ارسال ویدیو ممنوع 🔇*ممنوعیت فیلم* 💣*رفع ممنوعیت فیلم* ➖➖➖➖➖➖➖ ⛔️ ارسال متن ممنوع 🔇*ممنوعیت متن* 💣*رفع ممنوعیت متن* ➖➖➖➖➖➖➖ ⛔️ ارسال فوروارد ممنوع 🔇*ممنوعیت فوروارد* 💣*رفع ممنوعیت فوروارد* ➖➖➖➖➖➖➖ ⛔️ ارسال بازی به گروه 🔇*ممنوعیت بازی* 💣*رفع ممنوعیت بازی* ➖➖➖➖➖➖➖ ⛔️ ارسال مکان ممنوع 🔇*ممنوعیت مکان* 💣*رفع ممنوعیت مکان* ➖➖➖➖➖➖➖ ⛔️ ارسال موزیک ممنوع 🔇*ممنوعیت موزیک* 💣*رفع ممنوعیت موزیک* ➖➖➖➖➖➖➖ ⛔️ ارسال فایل ضبط شده ممنوع 🔇*ممنوعیت صدا* 💣*رفع ممنوعیت صدا* ➖➖➖➖➖➖➖ ⛔️ ارسال اطلاعات تماس ممنوع 🔇*ممنوعیت اطلاعات تماس* 💣*رفع ممنوعیت اطلاعات تماس* ➖➖➖➖➖➖➖ ⛔️ اعلانات گروه ممنوع 🔇*ممنوعیت اعلانات* 💣*رفع ممنوعیت اعلانات* ➖➖➖➖➖➖➖ ⛔️ ارسال تبلیغات شیشه ای ممنوع 🔇*ممنوعیت اینلاین* 💣*رفع ممنوعیت اینلاین* ➖➖➖➖➖➖➖ ⛔️ همه چیز ممنوع 🔇*ممنوعیت همه چیز* 💣*رفع ممنوعیت همه چیز* ➖➖➖➖➖➖➖ ⛔️ میوت تایم دار عدد اول ساعت عدد دوم دقیقه 🔇*!mt 0 1* 💣*!unmt* ➖➖➖➖➖➖➖ در زدن دستورات به فاصله حروف دقت کنید ... ]] return text3 end if matches[1] == "مدیریت" and is_mod(msg) then text4 = [[ 💀 لیست دستورات مدیریت 💀 ➰شما میتوانید از '/' یا '!' یا '#' برای اجرای دستورات استفاده کنید. @Erfan_herkuless_051 .king & queen 💀💀💀💀💀💀💀💀 💀 *تنظیمات* 💀 نمایش تنظیمات گروه 💀💀💀💀💀💀💀💀 💀 *نیست ساکت* 💀 نمایش لیست ساکت شده ها 💀💀💀💀💀💀💀💀 💀 *لیست مسدود* 💀 نمایش لیست مسدود شده ها 💀💀💀💀💀💀💀💀 💀 *لیست مدیران* 💀 نمایش لیست مدیران 💀💀💀💀💀💀💀💀 💀 *لیست ناظران* 💀 نمایش لیست ناظران 💀💀💀💀💀💀💀💀 💀 *اطلاعات گروه* 💀 نمایش اطلاعات گروه 💀💀💀💀💀💀💀💀 💀 *انتخاب مدیر* `[username|id|reply]` 💀 تعیین مدیر اصلی گروه 💀💀💀💀💀💀💀💀 💀 *حذف مدیر* `[username|id|reply]` 💀 حذف مدیر اصلی 💀💀💀💀💀💀💀💀 💀 *انتخاب ناظر* `[username|id|reply]` 💀 تعیین ناظر گروه 💀💀💀💀💀💀💀💀 💀 *حذف ناظر* `[username|id|reply]` 💀 حذف ناظر گروه 💀💀💀💀💀💀💀💀 💀 *تنظیم فلود* `[1-50]` 💀 تعیین میزان مجاز پست های رگباری 💀💀💀💀💀💀💀💀 💀 *رس* `[username]` 💀 *ایدی* `[reply]` 💀 نمایش آیدی یوزر 💀💀💀💀💀💀💀💀 💀 *چه کسی* `[id]` 💀 نمایش یوزر آیدی 💀💀💀💀💀💀💀💀 💀 *ساکت* `[username|id|reply]` 💀 *مصوت* `[username|id|reply]` 💀 ساکت کردن یک کاربر 💀💀💀💀💀💀💀💀 💀 *اعدام* `[username|id|reply]` 💀 اعدام کردن یه کاربر 💀💀💀💀💀💀💀💀 💀 *مسدود کردن* `[username|id|reply]` 💀 *رفع مسدودیت* `[username|id|reply]` 💀 مسدود کردن یک کاربر 💀💀💀💀💀💀💀💀 ✍ *!تنظیم لینک* *لینک* نمایش لینک ✍ *تنظیم قوانین* قوانین را بنویسید 🔹 *قوانین* نمایش قوانین 💀 ثبت لینک و قوانین و نمایش آنها 💀💀💀💀💀💀💀💀 🚿 *!پاک کردن قوانین* 💀 پاک کردن قوانین گروه 💀💀💀💀💀💀💀💀 🚿 *پاک کردن لیست ساکت * 💀 پاک کردن لیست ساکت ها 💀💀💀💀💀💀💀💀 📍 *سنجاق کردن* `[reply]` 📍 *حذف سنجاق* 💀 سنجاق کردن متن در گروه 💀💀💀💀💀💀💀💀 🚫 *فیلتر* 🚫 *رفع فیلتر* 💀 فیلتر کلمات 🚫 *لیست فیلتر* 💀 نمایش لیست فیلتر 💀💀💀💀💀💀💀💀 🎗*تنظیم ولکام* متن پیام ➕*ولکام نصب* ➖*ولکام حذف* 💀 ست کردن و فعال و غیرفعال کردن خوش آمد گویی 💀💀💀💀💀💀💀💀 ♻️ *!del* 1-100 ♻️ *!delall* `[reply]` 💀 حذف پیام های گروه حداکثر 100 💀💀💀💀💀💀💀💀 ⏱ *!setexpire* 30 ⏱ *!expire* 💀 تنظیم انقضای گروه 💀💀💀💀💀💀💀💀 📣 *!broadcast* متن پیام 💀 ارسال یک پیام به همه گروهایی که ربات مدیر است 💀💀💀💀💀💀💀💀 ⚙*!autoleave enable* ⚙*!autoleave disable* 💀 تنظیم خارج شدن ربات ... ]] return text4 end if matches[1] == "ping" and is_mod(msg) then text5 = [[ 🛡 آسوده باش پادشاه نظاره گر است 🛡 ]] return text5 end --------------------- Welcome ----------------------- if matches[1] == "welcome" and is_mod(msg) then if matches[2] == "enable" then welcome = data[tostring(chat)]['settings']['welcome'] if welcome == "yes" then if not lang then return "_Group_ *welcome* _is already enabled_" elseif lang then return "_خوشآمد گویی از قبل فعال بود_" end else data[tostring(chat)]['settings']['welcome'] = "yes" save_data(_config.moderation.data, data) if not lang then return "_Group_ *welcome* _has been enabled_" elseif lang then return "_خوشآمد گویی فعال شد_" end end end if matches[2] == "disable" then welcome = data[tostring(chat)]['settings']['welcome'] if welcome == "no" then if not lang then return "_Group_ *Welcome* _is already disabled_" elseif lang then return "_خوشآمد گویی از قبل فعال نبود_" end else data[tostring(chat)]['settings']['welcome'] = "no" save_data(_config.moderation.data, data) if not lang then return "_Group_ *welcome* _has been disabled_" elseif lang then return "_خوشآمد گویی غیرفعال شد_" end end end end if matches[1] == "setwelcome" and matches[2] and is_mod(msg) then data[tostring(chat)]['setwelcome'] = matches[2] save_data(_config.moderation.data, data) if not lang then return "_Welcome Message Has Been Set To :_\n*"..matches[2].."*\n\n*You can use :*\n_{rules} ➣ Show Group Rules_\n_{name} ➣ New Member First Name_\n_{username} ➣ New Member Username_" else return "_پیام خوشآمد گویی تنظیم شد به :_\n*"..matches[2].."*\n\n*شما میتوانید از*\n_{rules} ➣ نمایش قوانین گروه_\n_{name} ➣ نام کاربر جدید_\n_{username} ➣ نام کاربری کاربر جدید_\n_استفاده کنید_" end end end ----------------------------------------- local function pre_process(msg) local chat = msg.chat_id_ local user = msg.sender_user_id_ local data = load_data(_config.moderation.data) local function welcome_cb(arg, data) local hash = "gp_lang:"..arg.chat_id local lang = redis:get(hash) administration = load_data(_config.moderation.data) if administration[arg.chat_id]['setwelcome'] then welcome = administration[arg.chat_id]['setwelcome'] else if not lang then welcome = "*Welcome Dude*" elseif lang then welcome = "_خوش آمدید_" end end if administration[tostring(arg.chat_id)]['rules'] then rules = administration[arg.chat_id]['rules'] else if not lang then rules = "ℹ️ The Default Rules :\n1⃣ No Flood.\n2⃣ No Spam.\n3⃣ No Advertising.\n4⃣ Try to stay on topic.\n5⃣ Forbidden any racist, sexual, homophobic or gore content.\n➡️ Repeated failure to comply with these rules will cause ban.\n" elseif lang then rules = "ℹ️ قوانین پپیشفرض:\n1⃣ ارسال پیام مکرر ممنوع.\n2⃣ اسپم ممنوع.\n3⃣ تبلیغ ممنوع.\n4⃣ سعی کنید از موضوع خارج نشید.\n5⃣ هرنوع نژاد پرستی, شاخ بازی و پورنوگرافی ممنوع .\n➡️ از قوانین پیروی کنید, در صورت عدم رعایت قوانین اول اخطار و در صورت تکرار مسدود.\n" end end if data.username_ then user_name = "@"..check_markdown(data.username_) else user_name = "" end local welcome = welcome:gsub("{rules}", rules) local welcome = welcome:gsub("{name}", check_markdown(data.first_name_)) local welcome = welcome:gsub("{username}", user_name) tdcli.sendMessage(arg.chat_id, arg.msg_id, 0, welcome, 0, "md") end if data[tostring(chat)] and data[tostring(chat)]['settings'] then if msg.adduser then welcome = data[tostring(msg.chat_id_)]['settings']['welcome'] if welcome == "yes" then tdcli_function ({ ID = "GetUser", user_id_ = msg.adduser }, welcome_cb, {chat_id=chat,msg_id=msg.id_}) else return false end end if msg.joinuser then welcome = data[tostring(msg.chat_id_)]['settings']['welcome'] if welcome == "yes" then tdcli_function ({ ID = "GetUser", user_id_ = msg.joinuser }, welcome_cb, {chat_id=chat,msg_id=msg.id_}) else return false end end end end return { patterns ={ "^[!/#](مدیریت)$", "^([Pp]ing)$", "^[!/#](ممنوع)$", "^[!/#](قفل)$", "^[!/#](id)$", "^[!/#](id) (.*)$", "^[!/#](pin)$", "^[!/#](unpin)$", "^[!/#](gpinfo)$", "^[!/#](test)$", "^[!/#](add)$", "^[!/#](rem)$", "^[!/#](setowner)$", "^[!/#](setowner) (.*)$", "^[!/#](remowner)$", "^[!/#](remowner) (.*)$", "^[!/#](promote)$", "^[!/#](promote) (.*)$", "^[!/#](demote)$", "^[!/#](demote) (.*)$", "^[!/#](modlist)$", "^[!/#](ownerlist)$", "^[!/#](lock) (.*)$", "^[!/#](unlock) (.*)$", "^[!/#](settings)$", "^[!/#](mutelist)$", "^[!/#](mute) (.*)$", "^[!/#](unmute) (.*)$", "^[!/#](link)$", "^[!/#](setlink)$", "^[!/#](rules)$", "^[!/#](setrules) (.*)$", "^[!/#](about)$", "^[!/#](setabout) (.*)$", "^[!/#](setname) (.*)$", "^[!/#](clean) (.*)$", "^[!/#](setflood) (%d+)$", "^[!/#](res) (.*)$", "^[!/#](whois) (%d+)$", "^[!/#](help)$", "^[!/#](setlang) (.*)$", "^[#!/](filter) (.*)$", "^[#!/](unfilter) (.*)$", "^[#!/](filterlist)$", "^([https?://w]*.?t.me/joinchat/%S+)$", "^([https?://w]*.?telegram.me/joinchat/%S+)$", "^[!/#](setwelcome) (.*)", "^[!/#](welcome) (.*)$" }, run=run, pre_process = pre_process } -- کد های پایین در ربات نشان داده نمیشوند -- http://permag.ir -- @permag_ir -- @permag_bots -- @permag
gpl-3.0
Herve-M/OpenRA
mods/ra/maps/fort-lonestar/fort-lonestar.lua
7
7731
--[[ Copyright 2007-2022 The OpenRA Developers (see AUTHORS) This file is part of OpenRA, which is free software. It is made available to you 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. For more information, see COPYING. ]] SovietEntryPoints = { Entry1, Entry2, Entry3, Entry4, Entry5, Entry6, Entry7, Entry8 } PatrolWaypoints = { Entry2, Entry4, Entry6, Entry8 } ParadropWaypoints = { Paradrop1, Paradrop2, Paradrop3, Paradrop4 } SpawnPoints = { Spawn1, Spawn2, Spawn3, Spawn4 } Snipers = { Sniper1, Sniper2, Sniper3, Sniper4, Sniper5, Sniper6, Sniper7, Sniper8, Sniper9, Sniper10, Sniper11, Sniper12 } Walls = { { WallTopRight1, WallTopRight2, WallTopRight3, WallTopRight4, WallTopRight5, WallTopRight6, WallTopRight7, WallTopRight8, WallTopRight9 }, { WallTopLeft1, WallTopLeft2, WallTopLeft3, WallTopLeft4, WallTopLeft5, WallTopLeft6, WallTopLeft7, WallTopLeft8, WallTopLeft9 }, { WallBottomLeft1, WallBottomLeft2, WallBottomLeft3, WallBottomLeft4, WallBottomLeft5, WallBottomLeft6, WallBottomLeft7, WallBottomLeft8, WallBottomLeft9 }, { WallBottomRight1, WallBottomRight2, WallBottomRight3, WallBottomRight4, WallBottomRight5, WallBottomRight6, WallBottomRight7, WallBottomRight8, WallBottomRight9 } } if Difficulty == "veryeasy" then ParaChance = 20 Patrol = { "e1", "e2", "e1" } Infantry = { "e4", "e1", "e1", "e2", "e2" } Vehicles = { "apc" } Tank = { "3tnk" } LongRange = { "arty" } Boss = { "v2rl" } Swarm = { "shok", "shok", "shok" } elseif Difficulty == "easy" then ParaChance = 25 Patrol = { "e1", "e2", "e1" } Infantry = { "e4", "e1", "e1", "e2", "e1", "e2", "e1" } Vehicles = { "ftrk", "apc", "arty" } Tank = { "3tnk" } LongRange = { "v2rl" } Boss = { "4tnk" } Swarm = { "shok", "shok", "shok", "shok", "ttnk" } elseif Difficulty == "normal" then ParaChance = 30 Patrol = { "e1", "e2", "e1", "e1" } Infantry = { "e4", "e1", "e1", "e2", "e1", "e2", "e1" } Vehicles = { "ftrk", "ftrk", "apc", "arty" } Tank = { "3tnk" } LongRange = { "v2rl" } Boss = { "4tnk" } Swarm = { "shok", "shok", "shok", "shok", "ttnk", "ttnk", "ttnk" } elseif Difficulty == "hard" then ParaChance = 35 Patrol = { "e1", "e2", "e1", "e1", "e4" } Infantry = { "e4", "e1", "e1", "e2", "e1", "e2", "e1" } Vehicles = { "arty", "ftrk", "ftrk", "apc", "apc" } Tank = { "3tnk" } LongRange = { "v2rl" } Boss = { "4tnk" } Swarm = { "shok", "shok", "shok", "shok", "shok", "ttnk", "ttnk", "ttnk", "ttnk" } else ParaChance = 40 Patrol = { "e1", "e2", "e1", "e1", "e4", "e4" } Infantry = { "e4", "e1", "e1", "e2", "e1", "e2", "e1", "e1" } Vehicles = { "arty", "arty", "ftrk", "apc", "apc" } Tank = { "ftrk", "3tnk" } LongRange = { "v2rl" } Boss = { "4tnk" } Swarm = { "shok", "shok", "shok", "shok", "shok", "shok", "ttnk", "ttnk", "ttnk", "ttnk", "ttnk" } end Wave = 0 Waves = { { delay = 500, units = { Infantry } }, { delay = 500, units = { Patrol, Patrol } }, { delay = 700, units = { Infantry, Infantry, Vehicles }, }, { delay = 1500, units = { Infantry, Infantry, Infantry, Infantry } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Vehicles } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Tank, Vehicles } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Tank, Tank, Swarm } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry, LongRange } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry, Infantry, LongRange, Tank, LongRange } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry, Infantry, Infantry, LongRange, LongRange, Tank, Tank, Vehicles } }, { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry, Infantry, Infantry, Infantry, Boss, Swarm } } } -- Now do some adjustments to the waves if Difficulty == "tough" or Difficulty == "endless" then Waves[8] = { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry }, ironUnits = { LongRange } } Waves[9] = { delay = 1500, units = { Infantry, Infantry, Patrol, Infantry, Infantry, Infantry, Infantry, Infantry, LongRange, LongRange, Vehicles, Tank }, ironUnits = { Tank } } Waves[11] = { delay = 1500, units = { Vehicles, Infantry, Patrol, Patrol, Patrol, Infantry, LongRange, Tank, Boss, Infantry, Infantry, Patrol } } end IdleHunt = function(actor) Trigger.OnIdle(actor, function(a) if a.IsInWorld then a.Hunt() end end) end SendUnits = function(entryCell, unitTypes, targetCell, extraData) Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, 40, function(a) if not a.HasProperty("AttackMove") then Trigger.OnIdle(a, function(a) a.Move(targetCell) end) return end a.AttackMove(targetCell) Trigger.OnIdle(a, function(a) a.Hunt() end) if extraData == "IronCurtain" then a.GrantCondition("invulnerability", DateTime.Seconds(25)) end end) end SendWave = function() Wave = Wave + 1 local wave = Waves[Wave] Trigger.AfterDelay(wave.delay, function() Utils.Do(wave.units, function(units) local entry = Utils.Random(SovietEntryPoints).Location local target = Utils.Random(SpawnPoints).Location SendUnits(entry, units, target) end) if wave.ironUnits then Utils.Do(wave.ironUnits, function(units) local entry = Utils.Random(SovietEntryPoints).Location local target = Utils.Random(SpawnPoints).Location SendUnits(entry, units, target, "IronCurtain") end) end Utils.Do(players, function(player) Media.PlaySpeechNotification(player, "EnemyUnitsApproaching") end) if (Wave < #Waves) then if Utils.RandomInteger(1, 100) < ParaChance then local aircraft = ParaProxy.TargetParatroopers(Utils.Random(ParadropWaypoints).CenterPosition) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) IdleHunt(p) end) end) local delay = Utils.RandomInteger(DateTime.Seconds(20), DateTime.Seconds(45)) Trigger.AfterDelay(delay, SendWave) else SendWave() end else if Difficulty == "endless" then Wave = 0 IncreaseDifficulty() SendWave() return end Trigger.AfterDelay(DateTime.Minutes(1), SovietsRetreating) Media.DisplayMessage("You almost survived the onslaught! No more waves incoming.") end end) end SovietsRetreating = function() Utils.Do(Snipers, function(a) if not a.IsDead and a.Owner == soviets then a.Destroy() end end) end IncreaseDifficulty = function() local additions = { Infantry, Patrol, Vehicles, Tank, LongRange, Boss, Swarm } Utils.Do(Waves, function(wave) wave.units[#wave.units + 1] = Utils.Random(additions) end) end Tick = function() if (Utils.RandomInteger(1, 200) == 10) then local delay = Utils.RandomInteger(1, 10) Lighting.Flash("LightningStrike", delay) Trigger.AfterDelay(delay, function() Media.PlaySound("thunder" .. Utils.RandomInteger(1,6) .. ".aud") end) end if (Utils.RandomInteger(1, 200) == 10) then Media.PlaySound("thunder-ambient.aud") end end SetupWallOwners = function() Utils.Do(players, function(player) Utils.Do(Walls[player.Spawn], function(wall) wall.Owner = player end) end) end WorldLoaded = function() soviets = Player.GetPlayer("Soviets") players = { } for i = 0, 4 do local player = Player.GetPlayer("Multi" ..i) players[i] = player if players[i] and players[i].IsBot then ActivateAI(players[i], i) end end Media.DisplayMessage("Defend Fort Lonestar at all costs!") SetupWallOwners() ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) SendWave() end
gpl-3.0
dr01d3r/darkstar
scripts/zones/Abyssea-Misareaux/npcs/qm7.lua
14
1345
----------------------------------- -- Zone: Abyssea-Misareaux -- NPC: qm7 (???) -- Spawns Nehebkau -- @pos ? ? ? 216 ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --[[ if (trade:hasItemQty(3091,1) and trade:getItemCount() == 1) then -- Player has all the required items. if (GetMobAction(17662470) == ACTION_NONE) then -- Mob not already spawned from this SpawnMob(17662470):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, 3091); -- 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
dr01d3r/darkstar
scripts/globals/spells/bluemagic/spiral_spin.lua
31
2001
----------------------------------------- -- Spell: Spiral Spin -- Chance of effect varies with TP. Additional Effect: Accuracy Down -- Spell cost: 39 MP -- Monster Type: Vermin -- Spell Type: Physical (Slashing) -- Blue Magic Points: 3 -- Stat Bonus: STR+1 HP+5 -- Level: 60 -- Casting Time: 4 seconds -- Recast Time: 45 seconds -- Skillchain property: Transfixion (can open Compression, Reverberation, or Distortion) -- Combos: Plantoid Killer ----------------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/bluemagic"); ----------------------------------------- -- OnMagicCastingCheck ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; ----------------------------------------- -- OnSpellCast ----------------------------------------- function onSpellCast(caster,target,spell) local params = {}; -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage params.tpmod = TPMOD_CRITICAL; params.dmgtype = DMGTYPE_SLASH; params.scattr = SC_TRANSFIXION; params.numhits = 1; params.multiplier = 1.925; params.tp150 = 1.25; params.tp300 = 1.25; params.azuretp = 1.25; params.duppercap = 60; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.30; params.int_wsc = 0.10; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; damage = BluePhysicalSpell(caster, target, spell, params); damage = BlueFinalAdjustments(caster, target, spell, damage, params); local chance = math.random(); if (damage > 0 and chance > 4) then local typeEffect = EFFECT_ACCURACY_DOWN; target:delStatusEffect(typeEffect); target:addStatusEffect(typeEffect,4,0,getBlueEffectDuration(caster,resist,typeEffect)); end return damage; end;
gpl-3.0
waruqi/xmake
xmake/modules/core/tools/sdar.lua
1
2715
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Copyright (C) 2015-2020, TBOOX Open Source Group. -- -- @author ruki -- @file sdar.lua -- -- imports import("core.tool.compiler") -- init it function init(self) -- init flags self:set("arflags", "-cr") end -- make the strip flag function strip(self, level) -- the maps local maps = { debug = "-S" , all = "-s" } -- make it return maps[level] end -- make the link arguments list function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- check assert(targetkind == "static") -- init arguments opt = opt or {} local argv = table.join(flags, targetfile, objectfiles) if is_host("windows") and not opt.rawargs then argv = winos.cmdargv(argv) end -- make it return self:program(), argv end -- link the library file function link(self, objectfiles, targetkind, targetfile, flags) -- check assert(targetkind == "static", "the target kind: %s is not support for ar", targetkind) -- ensure the target directory os.mkdir(path.directory(targetfile)) -- @note remove the previous archived file first to force recreating a new file os.tryrm(targetfile) -- link it os.runv(linkargv(self, objectfiles, targetkind, targetfile, flags)) end -- extract the static library to object directory function extract(self, libraryfile, objectdir) -- make the object directory first os.mkdir(objectdir) -- get the absolute path of this library libraryfile = path.absolute(libraryfile) -- enter the object directory local oldir = os.cd(objectdir) -- extract it os.runv(self:program(), {"-x", libraryfile}) -- check repeat object name local repeats = {} local objectfiles = os.iorunv(self:program(), {"-t", libraryfile}) for _, objectfile in ipairs(objectfiles:split('\n')) do if repeats[objectfile] then raise("object name(%s) conflicts in library: %s", objectfile, libraryfile) end repeats[objectfile] = true end -- leave the object directory os.cd(oldir) end
apache-2.0
BlurryRoots/intergalactic-golf
src/EventManager.lua
1
1075
require ("lib.lclass") class "EventManager" function EventManager:EventManager () self.events = {} self.subscriber = {} end function EventManager:push (event) table.insert (self.events, event) end function EventManager:subscribe (typeName, handler) self.subscriber[typeName] = self.subscriber[typeName] or {} table.insert (self.subscriber[typeName], handler) end function EventManager:unsubscribe (typeName, handler) if not self.subscriber[typeName] then error ("No one had previously been subscribed to " .. typeName) end local index = 0 for i, h in pairs (self.subscriber[typeName]) do if handler == h then index = i break end end if 0 < index then table.remove (self.subscriber[typeName], index) end end function EventManager:update (dt) while table.getn (self.events) > 0 do local event = table.remove (self.events) local handlers = self.subscriber[event:getClass ()] if handlers and table.getn (handlers) > 0 then for _,handler in pairs (self.subscriber[event:getClass ()]) do handler:handle (event) end end end end
mit
SalvationDevelopment/Salvation-Scripts-Production
c22530212.lua
9
1298
--マジック・ハンド function c22530212.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_TO_HAND) e1:SetCountLimit(1) e1:SetCondition(c22530212.condition) e1:SetTarget(c22530212.target) e1:SetOperation(c22530212.activate) c:RegisterEffect(e1) end function c22530212.cfilter(c,tp) return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_DECK) and not c:IsReason(REASON_DRAW) end function c22530212.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c22530212.cfilter,1,nil,1-tp) end function c22530212.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=eg:Filter(c22530212.cfilter,nil,1-tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800) end function c22530212.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if g:GetCount()~=0 then Duel.SendtoGrave(g,REASON_EFFECT) if g:IsExists(Card.IsLocation,1,nil,LOCATION_GRAVE) then Duel.Damage(1-tp,800,REASON_EFFECT) end end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c87292536.lua
6
1233
--XX-セイバー レイジグラ function c87292536.initial_effect(c) --salvage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(87292536,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetTarget(c87292536.target) e1:SetOperation(c87292536.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end function c87292536.filter(c) return c:IsSetCard(0x100d) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c87292536.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c87292536.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c87292536.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c87292536.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c87292536.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
gpl-2.0
joev/SVUI-Temp
SVUI_UnitFrames/elements/castbar.lua
1
26037
--[[ ############################################################################## S V U I By: Munglunch # ############################################################################## ########################################################## LOCALIZED LUA FUNCTIONS ########################################################## ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local assert = _G.assert; local type = _G.type; local error = _G.error; local pcall = _G.pcall; local print = _G.print; local ipairs = _G.ipairs; local pairs = _G.pairs; local next = _G.next; local rawset = _G.rawset; local rawget = _G.rawget; local tostring = _G.tostring; local tonumber = _G.tonumber; local tinsert = _G.tinsert; local tremove = _G.tremove; local twipe = _G.wipe; --STRING local string = string; local format = string.format; local sub = string.sub; --MATH local math = math; --TABLE local table = table; local tsort = table.sort; local tremove = table.remove; --[[ MATH METHODS ]]-- local abs, ceil, floor = math.abs, math.ceil, math.floor; -- Basic local parsefloat = math.parsefloat; -- Uncommon local CreateFrame = _G.CreateFrame; local InCombatLockdown = _G.InCombatLockdown; local GameTooltip = _G.GameTooltip; local UnitClass = _G.UnitClass; local UnitIsPlayer = _G.UnitIsPlayer; local UnitReaction = _G.UnitReaction; --[[ ########################################################## GET ADDON DATA ########################################################## ]]-- local SV = _G['SVUI'] local L = SV.L; local LSM = _G.LibStub("LibSharedMedia-3.0") local MOD = SV.UnitFrames if(not MOD) then return end local oUF_SVUI = MOD.oUF assert(oUF_SVUI, "SVUI UnitFrames: unable to locate oUF.") SV.SpecialFX:Register("overlay_castbar", [[Spells\Eastern_plaguelands_beam_effect.m2]], 2, -2, -2, 2, 0.95, -1, 0) SV.SpecialFX:Register("underlay_castbar", [[Spells\Xplosion_twilight_impact_noflash.m2]], 1, -1, -1, 1, 0.9, 0, 0) --[[ ########################################################## LOCAL VARIABLES ########################################################## ]]-- local ticks = {} local function SpellName(id) local name, _, _, _, _, _, _, _, _ = GetSpellInfo(id) if not name then name = "Voodoo Doll"; end return name end local CustomTickData = { ["ChannelTicks"] = { --Warlock [SpellName(1120)] = 6, --"Drain Soul" [SpellName(689)] = 6, -- "Drain Life" [SpellName(108371)] = 6, -- "Harvest Life" [SpellName(5740)] = 4, -- "Rain of Fire" [SpellName(755)] = 6, -- Health Funnel [SpellName(103103)] = 4, --Malefic Grasp --Druid [SpellName(44203)] = 4, -- "Tranquility" [SpellName(16914)] = 10, -- "Hurricane" --Priest [SpellName(15407)] = 3, -- "Mind Flay" [SpellName(129197)] = 3, -- "Mind Flay (Insanity)" [SpellName(48045)] = 5, -- "Mind Sear" [SpellName(47540)] = 2, -- "Penance" [SpellName(64901)] = 4, -- Hymn of Hope [SpellName(64843)] = 4, -- Divine Hymn --Mage [SpellName(5143)] = 5, -- "Arcane Missiles" [SpellName(10)] = 8, -- "Blizzard" [SpellName(12051)] = 4, -- "Evocation" --Monk [SpellName(115175)] = 9, -- "Smoothing Mist" }, ["ChannelTicksSize"] = { --Warlock [SpellName(1120)] = 2, --"Drain Soul" [SpellName(689)] = 1, -- "Drain Life" [SpellName(108371)] = 1, -- "Harvest Life" [SpellName(103103)] = 1, -- "Malefic Grasp" }, ["HastedChannelTicks"] = { [SpellName(64901)] = true, -- Hymn of Hope [SpellName(64843)] = true, -- Divine Hymn }, } --[[ ########################################################## LOCAL FUNCTIONS ########################################################## ]]-- local function HideTicks() for i=1,#ticks do ticks[i]:Hide() end end local function SetCastTicks(bar,count,mod) mod = mod or 0; HideTicks() if count and count <= 0 then return end local barWidth = bar:GetWidth() local offset = barWidth / count + mod; for i=1,count do if not ticks[i] then ticks[i] = bar:CreateTexture(nil,'OVERLAY') ticks[i]:SetTexture(SV.media.statusbar.lazer) ticks[i]:SetVertexColor(0,0,0,0.8) ticks[i]:SetWidth(1) ticks[i]:SetHeight(bar:GetHeight()) end ticks[i]:ClearAllPoints() ticks[i]:SetPoint("RIGHT", bar, "LEFT", offset * i, 0) ticks[i]:Show() end end local Fader_OnEvent = function(self, event, arg) if arg ~= "player" then return end local isTradeskill = self:GetParent().recipecount if(isTradeskill and isTradeskill > 0) then return end; if event == "UNIT_SPELLCAST_START" then self.fails = nil; self.isokey = nil; self.ischanneling = nil; self:SetAlpha(0) self.mask:SetAlpha(1) if self.anim:IsPlaying() then self.anim:Stop() end elseif event == "UNIT_SPELLCAST_CHANNEL_START" then self:SetAlpha(0) self.mask:SetAlpha(1) if self.anim:IsPlaying() then self.anim:Stop() end self.iscasting = nil; self.fails = nil; self.isokey = nil elseif event == "UNIT_SPELLCAST_SUCCEEDED" then self.fails = nil; self.isokey = true; self.fails_a = nil elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then self.fails = true; self.isokey = nil; self.fails_a = nil elseif event == "UNIT_SPELLCAST_INTERRUPTED" then self.fails = nil; self.isokey = nil; self.fails_a = true elseif event == "UNIT_SPELLCAST_STOP" then if self.fails or self.fails_a then self:SetBackdropColor(1, 0.2, 0.2, 0.5) self.txt:SetText(SPELL_FAILED_FIZZLE) self.txt:SetTextColor(1, 0.8, 0, 0.5) elseif self.isokey then self:SetBackdropColor(0.2, 1, 0.2, 0.5) self.txt:SetText(SUCCESS) self.txt:SetTextColor(0.5, 1, 0.4, 0.5) end self.mask:SetAlpha(0) self:SetAlpha(0) if not self.anim:IsPlaying() then self.anim:Play() end elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" then self.mask:SetAlpha(0) self:SetAlpha(0) if self.fails_a then self:SetBackdropColor(1, 0.2, 0.2, 0.5) self.txt:SetText(SPELL_FAILED_FIZZLE) self.txt:SetTextColor(0.5, 1, 0.4, 0.5) if not self.anim:IsPlaying() then self.anim:Play() end end end end local function SetCastbarFading(castbar, texture) local fader = CreateFrame("Frame", nil, castbar) fader:SetFrameLevel(2) fader:InsetPoints(castbar) fader:SetBackdrop({bgFile = texture}) fader:SetBackdropColor(0, 0, 0, 0) fader:SetAlpha(0) fader:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") fader:RegisterEvent("UNIT_SPELLCAST_START") fader:RegisterEvent("UNIT_SPELLCAST_STOP") fader:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") fader:RegisterEvent("UNIT_SPELLCAST_FAILED") fader:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") fader.mask = CreateFrame("Frame", nil, castbar) fader.mask:SetBackdrop({bgFile = texture}) fader.mask:InsetPoints(castbar) fader.mask:SetFrameLevel(2) fader.mask:SetBackdropColor(0, 0, 0, 0) fader.mask:SetAlpha(0) fader.txt = fader:CreateFontString(nil, "OVERLAY") fader.txt:SetFont(SV.media.font.alert, 16) fader.txt:SetAllPoints(fader) fader.txt:SetJustifyH("CENTER") fader.txt:SetJustifyV("CENTER") fader.txt:SetText("") fader.anim = fader:CreateAnimationGroup("Flash") fader.anim.fadein = fader.anim:CreateAnimation("ALPHA", "FadeIn") fader.anim.fadein:SetFromAlpha(0) fader.anim.fadein:SetToAlpha(1) fader.anim.fadein:SetOrder(1) fader.anim.fadeout1 = fader.anim:CreateAnimation("ALPHA", "FadeOut") fader.anim.fadeout1:SetFromAlpha(1) fader.anim.fadeout1:SetToAlpha(0.75) fader.anim.fadeout1:SetOrder(2) fader.anim.fadeout2 = fader.anim:CreateAnimation("ALPHA", "FadeOut") fader.anim.fadeout1:SetFromAlpha(0.75) fader.anim.fadeout1:SetToAlpha(0.25) fader.anim.fadeout2:SetOrder(3) fader.anim.fadein:SetDuration(0) fader.anim.fadeout1:SetDuration(.8) fader.anim.fadeout2:SetDuration(.4) fader:SetScript("OnEvent", Fader_OnEvent) end local CustomCastDelayText = function(self, value) if not self.TimeFormat then return end if self.channeling then if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(abs(value - self.max), self.delay)) elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f |cffaf5050%.1f|r"):format(value, self.max, self.delay)) elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(value, self.delay)) end else if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(value, "+", self.delay)) elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f |cffaf5050%s %.1f|r"):format(value, self.max, "+", self.delay)) elseif self.TimeFormat == "REMAINING"then self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(abs(value - self.max), "+", self.delay)) end end end local CustomTimeText = function(self, value) if not self.TimeFormat then return end if self.channeling then if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f"):format(abs(value - self.max))) elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) self.Time:SetText(("%.1f / %.1f"):format(abs(value - self.max), self.max)) elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f"):format(value)) end else if self.TimeFormat == "CURRENT" then self.Time:SetText(("%.1f"):format(value)) elseif self.TimeFormat == "CURRENTMAX" then self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) elseif self.TimeFormat == "REMAINING" then self.Time:SetText(("%.1f"):format(abs(value - self.max))) end end end local CustomCastTimeUpdate = function(self, duration) if(self.recipecount and self.recipecount > 0 and self.maxrecipe and self.maxrecipe > 1) then self.Text:SetText(self.recipecount .. "/" .. self.maxrecipe .. ": " .. self.previous) end if(self.Time) then if(self.delay ~= 0) then if(self.CustomDelayText) then self:CustomDelayText(duration) else self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) end else if(self.CustomTimeText) then self:CustomTimeText(duration) else self.Time:SetFormattedText("%.1f", duration) end end end if(self.Spark) then local xOffset = 0 local yOffset = 0 if self.Spark.xOffset then xOffset = self.Spark.xOffset yOffset = self.Spark.yOffset end if(self:GetReverseFill()) then self.Spark:SetPoint("CENTER", self, "RIGHT", -((duration / self.max) * self:GetWidth() + xOffset), yOffset) else self.Spark:SetPoint("CENTER", self, "LEFT", ((duration / self.max) * self:GetWidth() + xOffset), yOffset) end end end local CustomCastBarUpdate = function(self, elapsed) self.lastUpdate = (self.lastUpdate or 0) + elapsed if not (self.casting or self.channeling) then self.unitName = nil self.previous = nil self.casting = nil self.castid = nil self.channeling = nil self.tradeskill = nil self.recipecount = nil self.maxrecipe = 1 self:SetValue(1) self:Hide() return end if(self.Spark and self.Spark[1]) then self.Spark[1]:Hide(); self.Spark[1].overlay:Hide() end if(self.Spark and self.Spark[2]) then self.Spark[2]:Hide(); self.Spark[2].overlay:Hide() end if(self.casting) then if self.Spark then if self.Spark.iscustom then self.Spark.xOffset = -12 self.Spark.yOffset = 0 end if(self.Spark[1]) then self.Spark[1]:Show() self.Spark[1].overlay:Show() if not self.Spark[1].anim:IsPlaying() then self.Spark[1].anim:Play() end end end local duration = self.duration + self.lastUpdate if(duration >= self.max) then self.previous = nil self.casting = nil self.tradeskill = nil self.recipecount = nil self.maxrecipe = 1 self:Hide() if(self.PostCastStop) then self:PostCastStop(self.__owner.unit) end return end CustomCastTimeUpdate(self, duration) self.duration = duration self:SetValue(duration) elseif(self.channeling) then if self.Spark then if self.Spark.iscustom then self.Spark.xOffset = 12 self.Spark.yOffset = 4 end if(self.Spark[2]) then self.Spark[2]:Show() self.Spark[2].overlay:Show() if not self.Spark[2].anim:IsPlaying() then self.Spark[2].anim:Play() end end end local duration = self.duration - self.lastUpdate if(duration <= 0) then self.channeling = nil self.previous = nil self.casting = nil self.tradeskill = nil self.recipecount = nil self.maxrecipe = 1 self:Hide() if(self.PostChannelStop) then self:PostChannelStop(self.__owner.unit) end return end CustomCastTimeUpdate(self, duration) self.duration = duration self:SetValue(duration) end self.lastUpdate = 0 end local CustomChannelUpdate = function(self, unit, index, hasTicks) if not(unit == "player" or unit == "vehicle") then return end if hasTicks then local activeTicks = CustomTickData.ChannelTicks[index] if activeTicks and CustomTickData.ChannelTicksSize[index] and CustomTickData.HastedChannelTicks[index] then local mod1 = 1 / activeTicks; local haste = UnitSpellHaste("player") * 0.01; local mod2 = mod1 / 2; local total = 0; if haste >= mod2 then total = total + 1 end local calc1 = tonumber(parsefloat(mod2 + mod1, 2)) while haste >= calc1 do calc1 = tonumber(parsefloat(mod2 + mod1 * total, 2)) if haste >= calc1 then total = total + 1 end end local activeSize = CustomTickData.ChannelTicksSize[index] local sizeMod = activeSize / 1 + haste; local calc2 = self.max - sizeMod * activeTicks + total; if self.chainChannel then self.extraTickRatio = calc2 / sizeMod; self.chainChannel = nil end SetCastTicks(self, activeTicks + total, self.extraTickRatio) elseif activeTicks and CustomTickData.ChannelTicksSize[index] then local haste = UnitSpellHaste("player") * 0.01; local activeSize = CustomTickData.ChannelTicksSize[index] local sizeMod = activeSize / 1 + haste; local calc2 = self.max - sizeMod * activeTicks; if self.chainChannel then self.extraTickRatio = calc2 / sizeMod; self.chainChannel = nil end SetCastTicks(self, activeTicks, self.extraTickRatio) elseif activeTicks then SetCastTicks(self, activeTicks) else HideTicks() end else HideTicks() end end local CustomInterruptible = function(self, unit, useClass) local colors = oUF_SVUI.colors local r, g, b = self.CastColor[1], self.CastColor[2], self.CastColor[3] if useClass then local colorOverride; if UnitIsPlayer(unit) then local _, class = UnitClass(unit) colorOverride = colors.class[class] elseif UnitReaction(unit, "player") then colorOverride = colors.reaction[UnitReaction(unit, "player")] end if colorOverride then r, g, b = colorOverride[1], colorOverride[2], colorOverride[3] end end if self.interrupt and unit ~= "player" and UnitCanAttack("player", unit) then r, g, b = colors.interrupt[1], colors.interrupt[2], colors.interrupt[3] end self:SetStatusBarColor(r, g, b) if self.bg:IsShown() then self.bg:SetVertexColor(r * 0.2, g * 0.2, b * 0.2) end if(self.Spark and self.Spark[1]) then r, g, b = self.SparkColor[1], self.SparkColor[2], self.SparkColor[3] self.Spark[1]:SetVertexColor(r, g, b) self.Spark[2]:SetVertexColor(r, g, b) end end --[[ ########################################################## BUILD FUNCTION ########################################################## ]]-- function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss, hasModel) local colors = oUF_SVUI.colors; local castbar = CreateFrame("StatusBar", nil, frame) castbar.OnUpdate = CustomCastBarUpdate; castbar.CustomDelayText = CustomCastDelayText; castbar.CustomTimeText = CustomTimeText; castbar.PostCastStart = MOD.PostCastStart; castbar.PostChannelStart = MOD.PostCastStart; castbar.PostCastStop = MOD.PostCastStop; castbar.PostChannelStop = MOD.PostCastStop; castbar.PostChannelUpdate = MOD.PostChannelUpdate; castbar.PostCastInterruptible = MOD.PostCastInterruptible; castbar.PostCastNotInterruptible = MOD.PostCastNotInterruptible; castbar:SetClampedToScreen(true) castbar:SetFrameLevel(2) castbar.LatencyTexture = castbar:CreateTexture(nil, "OVERLAY") local cbName = frame:GetName().."Castbar" local castbarHolder = CreateFrame("Frame", cbName, castbar) local organizer = CreateFrame("Frame", nil, castbar) organizer:SetFrameStrata("HIGH") local iconHolder = CreateFrame("Frame", nil, organizer) iconHolder:SetStyle("!_Frame", "Inset", false) organizer.Icon = iconHolder local buttonIcon = iconHolder:CreateTexture(nil, "BORDER") buttonIcon:InsetPoints() buttonIcon:SetTexCoord(unpack(_G.SVUI_ICON_COORDS)) castbar.Icon = buttonIcon; local shieldIcon = iconHolder:CreateTexture(nil, "ARTWORK") shieldIcon:SetPoint("TOPLEFT", buttonIcon, "TOPLEFT", -7, 7) shieldIcon:SetPoint("BOTTOMRIGHT", buttonIcon, "BOTTOMRIGHT", 7, -8) shieldIcon:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\SHIELD") castbar.Shield = shieldIcon; castbar.Time = organizer:CreateFontString(nil, "OVERLAY") castbar.Time:SetDrawLayer("OVERLAY", 7) castbar.Text = organizer:CreateFontString(nil, "OVERLAY") castbar.Text:SetDrawLayer("OVERLAY", 7) castbar.Organizer = organizer local bgFrame = CreateFrame("Frame", nil, castbar) local hadouken = CreateFrame("Frame", nil, castbar) if ryu then castbar.Time:SetFontObject(SVUI_Font_Aura) castbar.Time:SetTextColor(1, 1, 1) castbar.Text:SetFontObject(SVUI_Font_Caps) castbar.Text:SetTextColor(1, 1, 1, 0.75) castbar.Text:SetWordWrap(false) castbar:SetStatusBarTexture(SV.media.statusbar.lazer) bgFrame:InsetPoints(castbar, -2, 10) bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) castbar.LatencyTexture:SetTexture(SV.media.statusbar.lazer) castbar.noupdate = true; castbar.pewpew = true hadouken.iscustom = true; hadouken:SetHeight(50) hadouken:SetWidth(50) hadouken:SetAlpha(0.9) castbarHolder:SetPoint("TOP", frame, "BOTTOM", 0, isBoss and -4 or -35) if reversed then castbar:SetReverseFill(true) hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") hadouken[1]:SetAllPoints(hadouken) hadouken[1]:SetBlendMode("ADD") hadouken[1]:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\HADOUKEN-REVERSED") hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") hadouken[1].overlay:SetHeight(50) hadouken[1].overlay:SetWidth(50) hadouken[1].overlay:SetPoint("CENTER", hadouken) hadouken[1].overlay:SetBlendMode("ADD") hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\SKULLS-REVERSED") hadouken[1].overlay:SetVertexColor(1, 1, 1) SV.Animate:Sprite4(hadouken[1],false,false,true) hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") hadouken[2]:InsetPoints(hadouken, 4, 4) hadouken[2]:SetBlendMode("ADD") hadouken[2]:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\CHANNEL-REVERSED") hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") hadouken[2].overlay:SetHeight(50) hadouken[2].overlay:SetWidth(50) hadouken[2].overlay:SetPoint("CENTER", hadouken) hadouken[2].overlay:SetBlendMode("ADD") hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\CHANNEL-REVERSED") hadouken[2].overlay:SetVertexColor(1, 1, 1) SV.Animate:Sprite4(hadouken[2],false,false,true) castbar:SetPoint("BOTTOMLEFT", castbarHolder, "BOTTOMLEFT", 1, 1) organizer:SetPoint("LEFT", castbar, "RIGHT", 4, 0) castbar.Time:SetPoint("RIGHT", castbar, "LEFT", -4, 0) else hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") hadouken[1]:SetAllPoints(hadouken) hadouken[1]:SetBlendMode("ADD") hadouken[1]:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\HADOUKEN") hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") hadouken[1].overlay:SetHeight(50) hadouken[1].overlay:SetWidth(50) hadouken[1].overlay:SetPoint("CENTER", hadouken) hadouken[1].overlay:SetBlendMode("ADD") hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\HADOUKEN") hadouken[1].overlay:SetVertexColor(1, 1, 1) SV.Animate:Sprite4(hadouken[1],false,false,true) hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") hadouken[2]:InsetPoints(hadouken, 4, 4) hadouken[2]:SetBlendMode("ADD") hadouken[2]:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\CHANNEL") hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") hadouken[2].overlay:SetHeight(50) hadouken[2].overlay:SetWidth(50) hadouken[2].overlay:SetPoint("CENTER", hadouken) hadouken[2].overlay:SetBlendMode("ADD") hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI_UnitFrames\\assets\\Castbar\\CHANNEL") hadouken[2].overlay:SetVertexColor(1, 1, 1) SV.Animate:Sprite4(hadouken[2],false,false,true) castbar:SetPoint("BOTTOMRIGHT", castbarHolder, "BOTTOMRIGHT", -1, 1) organizer:SetPoint("RIGHT", castbar, "LEFT", -4, 0) castbar.Time:SetPoint("LEFT", castbar, "RIGHT", 4, 0) end -- castbar.Time:SetPoint("CENTER", organizer, "CENTER", 0, 0) -- castbar.Time:SetJustifyH("CENTER") castbar.Text:SetAllPoints(castbar) else castbar.Time:SetFontObject(SVUI_Font_Aura) castbar.Time:SetTextColor(1, 1, 1, 0.9) castbar.Time:SetPoint("RIGHT", castbar, "LEFT", -1, 0) castbar.Text:SetFontObject(SVUI_Font_Caps) castbar.Text:SetTextColor(1, 1, 1, 0.9) castbar.Text:SetAllPoints(castbar) castbar.Text:SetWordWrap(false) castbar.pewpew = false castbar:SetStatusBarTexture(SV.media.statusbar.glow) castbarHolder:SetPoint("TOP", frame, "BOTTOM", 0, -4) castbar:InsetPoints(castbarHolder, 2, 2) bgFrame:SetAllPoints(castbarHolder) bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) castbar.LatencyTexture:SetTexture(SV.media.statusbar.default) if reversed then castbar:SetReverseFill(true) organizer:SetPoint("LEFT", castbar, "RIGHT", 6, 0) else organizer:SetPoint("RIGHT", castbar, "LEFT", -6, 0) end end if(hasModel) then SV.SpecialFX:SetFXFrame(bgFrame, "underlay_castbar") bgFrame.FX:SetFrameLevel(0) SV.SpecialFX:SetFXFrame(castbar, "overlay_castbar", nil, bgFrame) end castbar.bg = bgFrame:CreateTexture(nil, "BACKGROUND", nil, -2) castbar.bg:SetAllPoints(bgFrame) castbar.bg:SetTexture(SV.media.statusbar.default) castbar.bg:SetVertexColor(0,0,0,0.5) local borderB = bgFrame:CreateTexture(nil,"OVERLAY") borderB:SetColorTexture(0,0,0) borderB:SetPoint("BOTTOMLEFT") borderB:SetPoint("BOTTOMRIGHT") borderB:SetHeight(2) local borderT = bgFrame:CreateTexture(nil,"OVERLAY") borderT:SetColorTexture(0,0,0) borderT:SetPoint("TOPLEFT") borderT:SetPoint("TOPRIGHT") borderT:SetHeight(2) local borderL = bgFrame:CreateTexture(nil,"OVERLAY") borderL:SetColorTexture(0,0,0) borderL:SetPoint("TOPLEFT") borderL:SetPoint("BOTTOMLEFT") borderL:SetWidth(2) local borderR = bgFrame:CreateTexture(nil,"OVERLAY") borderR:SetColorTexture(0,0,0) borderR:SetPoint("TOPRIGHT") borderR:SetPoint("BOTTOMRIGHT") borderR:SetWidth(2) castbar:SetStatusBarColor(colors.casting[1],colors.casting[2],colors.casting[3]) castbar.LatencyTexture:SetVertexColor(0.1, 1, 0.2, 0.5) castbar.Spark = hadouken; castbar.Holder = castbarHolder; castbar.CastColor = oUF_SVUI.colors.casting castbar.SparkColor = oUF_SVUI.colors.spark if moverName then castbar.Holder.snapOffset = -6 SV:NewAnchor(castbar.Holder, moverName) end if useFader then SetCastbarFading(castbar, SV.media.statusbar.lazer) end castbar.TimeFormat = "REMAINING" return castbar end --[[ ########################################################## UPDATE ########################################################## ]]-- function MOD:PostCastStart(unit, index, ...) if unit == "vehicle" then unit = "player" end local db = SV.db.UnitFrames if(not db or not(db and db[unit] and db[unit].castbar)) then return end local unitDB = db[unit].castbar if unitDB.displayTarget and self.curTarget then self.Text:SetText(sub(index.." --> "..self.curTarget, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) else self.Text:SetText(sub(index, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) end self.unit = unit; if unit == "player" or unit == "target" then CustomChannelUpdate(self, unit, index, unitDB.ticks) CustomInterruptible(self, unit, db.castClassColor) end end function MOD:PostCastStop(unit, ...) self.chainChannel = nil; self.prevSpellCast = nil end function MOD:PostChannelUpdate(unit, index) if unit == "vehicle" then unit = "player" end local db = SV.db.UnitFrames[unit]; if(not db or not db.castbar or not(unit == "player")) then return end CustomChannelUpdate(self, unit, index, db.castbar.ticks) end function MOD:PostCastInterruptible(unit) if unit == "vehicle" or unit == "player" then return end CustomInterruptible(self, unit, SV.db.UnitFrames.castClassColor) end function MOD:PostCastNotInterruptible(unit) local castColor = self.CastColor; self:SetStatusBarColor(castColor[1], castColor[2], castColor[3]) if(self.Spark and self.Spark[1]) then local sparkColor = self.SparkColor; self.Spark[1]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) self.Spark[2]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) end end
mit
dr01d3r/darkstar
scripts/zones/Yhoator_Jungle/npcs/qm3.lua
14
1845
----------------------------------- -- Area: Davoi -- NPC: ??? (qm3) -- Involved in Quest: True will -- @pos 203 0.1 82 124 ----------------------------------- package.loaded["scripts/zones/Yhoator_Jungle/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Yhoator_Jungle/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(OUTLANDS,TRUE_WILL) == QUEST_ACCEPTED and player:hasKeyItem(OLD_TRICK_BOX) == false) then if (player:getVar("trueWillKilledNM") >= 1) then if (GetMobAction(17285544) == 0 and GetMobAction(17285545) == 0 and GetMobAction(17285546) == 0) then player:addKeyItem(OLD_TRICK_BOX); player:messageSpecial(KEYITEM_OBTAINED,OLD_TRICK_BOX); player:setVar("trueWillKilledNM",0); end else SpawnMob(17285544):updateClaim(player); -- Kappa Akuso SpawnMob(17285545):updateClaim(player); -- Kappa Bonze SpawnMob(17285546):updateClaim(player); -- Kappa Biwa end else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); 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
dr01d3r/darkstar
scripts/globals/weaponskills/cataclysm.lua
23
1521
----------------------------------- -- Cataclysm -- Skill level: 290 -- Delivers light elemental damage. Additional effect: Flash. Chance of effect varies with TP. -- Generates a significant amount of Enmity. -- Does not stack with Sneak Attack -- Aligned with Aqua Gorget. -- Aligned with Aqua Belt. -- Properties: -- Element: Light -- Skillchain Properties:Induration Reverberation -- Modifiers: STR:30% MND:30% -- Damage Multipliers by TP: -- 100%TP 200%TP 300%TP -- 3.00 3.00 3.00 ----------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {}; params.ftp100 = 3; params.ftp200 = 3; params.ftp300 = 3; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.3; params.chr_wsc = 0.0; params.ele = ELE_DARK; params.skill = SKILL_STF; params.includemab = true; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp100 = 2.75; params.ftp200 = 4; params.ftp300 = 5; params.str_wsc = 0.3; params.int_wsc = 0.3; params.mnd_wsc = 0.0; end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, tp, primary, action, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
dr01d3r/darkstar
scripts/globals/weaponskills/rock_crusher.lua
23
1258
----------------------------------- -- Rock Crusher -- Staff weapon skill -- Skill Level: 40 -- Delivers an earth elemental attack. Damage varies with TP. -- Aligned with the Thunder Gorget. -- Aligned with the Thunder Belt. -- Element: Earth -- Modifiers: STR:40% ; INT:40% -- 100%TP 200%TP 300%TP -- 1.00 2.00 2.50 ----------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {}; params.ftp100 = 1; params.ftp200 = 2; params.ftp300 = 2.5; params.str_wsc = 0.2; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.2; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.ele = ELE_EARTH; params.skill = SKILL_STF; params.includemab = true; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.4; params.int_wsc = 0.4; end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, tp, primary, action, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
joev/SVUI-Temp
SVUI_UnitFrames/libs/Plugins/oUF_RaidDebuffs/oUF_RaidDebuffs.lua
3
8920
--GLOBAL NAMESPACE local _G = _G; --LUA local unpack = _G.unpack; local select = _G.select; local assert = _G.assert; local error = _G.error; local print = _G.print; local pairs = _G.pairs; local next = _G.next; local tostring = _G.tostring; local type = _G.type; --STRING local string = _G.string; local format = string.format; --MATH local math = _G.math; local floor = math.floor local ceil = math.ceil local random = math.random --TABLE local table = _G.table; local wipe = _G.wipe; --BLIZZARD API local GetTime = _G.GetTime; local GetSpecialization = _G.GetSpecialization; local UnitAura = _G.UnitAura; local UnitIsCharmed = _G.UnitIsCharmed; local UnitCanAttack = _G.UnitCanAttack; local GetSpellInfo = _G.GetSpellInfo; local GetActiveSpecGroup = _G.GetActiveSpecGroup; local _, ns = ... local oUF = ns.oUF or oUF local SymbiosisName = GetSpellInfo(110309) local CleanseName = GetSpellInfo(4987) local addon = {} ns.oUF_RaidDebuffs = addon _G.oUF_RaidDebuffs = ns.oUF_RaidDebuffs local debuff_data = {} addon.DebuffData = debuff_data addon.ShowDispelableDebuff = true addon.FilterDispellableDebuff = true addon.MatchBySpellName = true addon.priority = 10 local function add(spell, priority) if addon.MatchBySpellName and type(spell) == 'number' then spell = GetSpellInfo(spell) end debuff_data[spell] = addon.priority + priority end function addon:RegisterDebuffs(t) for spell, value in pairs(t) do if type(t[spell]) == 'boolean' then local oldValue = t[spell] t[spell] = { ['enable'] = oldValue, ['priority'] = 0 } else if t[spell].enable then add(spell, t[spell].priority) end end end end function addon:ResetDebuffData() wipe(debuff_data) end local DispellColor = { ['Magic'] = {.2, .6, 1}, ['Curse'] = {.6, 0.1, 1}, ['Disease'] = {.6, .4, 0}, ['Poison'] = {0, .6, 0}, ['none'] = { .23, .23, .23}, } local DispellPriority = { ['Magic'] = 4, ['Curse'] = 3, ['Disease'] = 2, ['Poison'] = 1, } local DispellFilter do local dispellClasses = { ['PRIEST'] = { ['Magic'] = true, ['Disease'] = true, }, ['SHAMAN'] = { ['Magic'] = false, ['Curse'] = true, }, ['PALADIN'] = { ['Poison'] = true, ['Magic'] = false, ['Disease'] = true, }, ['MAGE'] = { ['Curse'] = true, }, ['DRUID'] = { ['Magic'] = false, ['Curse'] = true, ['Poison'] = true, ['Disease'] = false, }, ['MONK'] = { ['Magic'] = false, ['Disease'] = true, ['Poison'] = true, }, } DispellFilter = dispellClasses[select(2, UnitClass('player'))] or {} end local DEMO_SPELLS = {116281,116784,116417,116942,116161,117708,118303,118048,118135,117878,117949} local function CheckTalentTree(tree) local activeGroup = GetActiveSpecGroup() if activeGroup and GetSpecialization(false, false, activeGroup) then return tree == GetSpecialization(false, false, activeGroup) end end local playerClass = select(2, UnitClass('player')) local function CheckSpec(self, event, levels) -- Not interested in gained points from leveling if event == "CHARACTER_POINTS_CHANGED" and levels > 0 then return end --Check for certain talents to see if we can dispel magic or not if playerClass == "PRIEST" then if CheckTalentTree(3) then DispellFilter.Disease = false else DispellFilter.Disease = true end elseif playerClass == "PALADIN" then if CheckTalentTree(1) then DispellFilter.Magic = true else DispellFilter.Magic = false end elseif playerClass == "SHAMAN" then if CheckTalentTree(3) then DispellFilter.Magic = true else DispellFilter.Magic = false end elseif playerClass == "DRUID" then if CheckTalentTree(4) then DispellFilter.Magic = true else DispellFilter.Magic = false end elseif playerClass == "MONK" then if CheckTalentTree(2) then DispellFilter.Magic = true else DispellFilter.Magic = false end end end local function CheckSymbiosis() if GetSpellInfo(SymbiosisName) == CleanseName then DispellFilter.Disease = true else DispellFilter.Disease = false end end local function formatTime(s) if s > 60 then return format('%dm', s/60), s%60 elseif s < 1 then return format("%.1f", s), s - floor(s) else return format('%d', s), s - floor(s) end end local abs = math.abs local function OnUpdate(self, elapsed) self.elapsed = (self.elapsed or 0) + elapsed if self.elapsed >= 0.1 then local timeLeft = self.endTime - GetTime() if self.reverse then timeLeft = abs((self.endTime - GetTime()) - self.duration) end if timeLeft > 0 then local text = formatTime(timeLeft) self.time:SetText(text) else self:SetScript('OnUpdate', nil) self.time:Hide() end self.elapsed = 0 end end local function UpdateDebuff(self, name, icon, count, debuffType, duration, endTime, spellId) local f = self.RaidDebuffs if name then f.icon:SetTexture(icon) f.icon:Show() f.duration = duration if f.count then if count and (count > 1) then f.count:SetText(count) f.count:Show() else f.count:SetText("") f.count:Hide() end end if f.time then if duration and (duration > 0) then f.endTime = endTime f.nextUpdate = 0 f:SetScript('OnUpdate', OnUpdate) f.time:Show() else f:SetScript('OnUpdate', nil) f.time:Hide() end end if f.cooldown then if duration and (duration > 0) then f.cooldown:SetCooldown(endTime - duration, duration) f.cooldown:Show() else f.cooldown:Hide() end end local c = DispellColor[debuffType] or DispellColor.none f:SetBackdropBorderColor(c[1], c[2], c[3]) f:Show() if (f.nameText) then f.nameText:Hide(); end else f:Hide() if (f.nameText) then f.nameText:Show(); end end end local blackList = { [105171] = true, -- Deep Corruption [108220] = true, -- Deep Corruption [116095] = true, -- Disable, Slow [137637] = true, -- Warbringer, Slow } local function Update(self, event, unit) if unit ~= self.unit then return end local _name, _icon, _count, _dtype, _duration, _endTime, _spellId local _priority, priority = 0, 0 --store if the unit its charmed, mind controlled units (Imperial Vizier Zor'lok: Convert) local isCharmed = UnitIsCharmed(unit) --store if we cand attack that unit, if its so the unit its hostile (Amber-Shaper Un'sok: Reshape Life) local canAttack = UnitCanAttack("player", unit) for i = 1, 40 do local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId, canApplyAura, isBossDebuff = UnitAura(unit, i, 'HARMFUL') if (not name) then break end --we coudln't dispell if the unit its charmed, or its not friendly if addon.ShowDispelableDebuff and debuffType and (not isCharmed) and (not canAttack) then if addon.FilterDispellableDebuff then DispellPriority[debuffType] = (DispellPriority[debuffType] or 0) + addon.priority --Make Dispell buffs on top of Boss Debuffs priority = DispellFilter[debuffType] and DispellPriority[debuffType] or 0 if priority == 0 then debuffType = nil end else priority = DispellPriority[debuffType] or 0 end if priority > _priority then _priority, _name, _icon, _count, _dtype, _duration, _endTime, _spellId = priority, name, icon, count, debuffType, duration, expirationTime, spellId end end priority = debuff_data[addon.MatchBySpellName and name or spellId] if priority and not blackList[spellId] and (priority > _priority) then _priority, _name, _icon, _count, _dtype, _duration, _endTime, _spellId = priority, name, icon, count, debuffType, duration, expirationTime, spellId end end if(self.RaidDebuffs.forceShow) then _spellId = DEMO_SPELLS[random(1, #DEMO_SPELLS)]; _name, rank, _icon = GetSpellInfo(_spellId) _count, _dtype, _duration, _endTime = 5, 'Magic', 0, 60 end UpdateDebuff(self, _name, _icon, _count, _dtype, _duration, _endTime, _spellId) --Reset the DispellPriority DispellPriority = { ['Magic'] = 4, ['Curse'] = 3, ['Disease'] = 2, ['Poison'] = 1, } end local function Enable(self) if self.RaidDebuffs then self:RegisterEvent('UNIT_AURA', Update) return true end --Need to run these always self:RegisterEvent("PLAYER_TALENT_UPDATE", CheckSpec) self:RegisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec) if playerClass == "DRUID" then self:RegisterEvent("SPELLS_CHANGED", CheckSymbiosis) end end local function Disable(self) if self.RaidDebuffs then self:UnregisterEvent('UNIT_AURA', Update) self.RaidDebuffs:Hide() end self:UnregisterEvent("PLAYER_TALENT_UPDATE", CheckSpec) self:UnregisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec) if playerClass == "DRUID" then self:UnregisterEvent("SPELLS_CHANGED", CheckSymbiosis) end end oUF:AddElement('RaidDebuffs', Update, Enable, Disable)
mit
SalvationDevelopment/Salvation-Scripts-Production
c52198054.lua
5
4026
--ブレイズ・キャノン・マガジン function c52198054.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c52198054.target1) e1:SetOperation(c52198054.operation) e1:SetHintTiming(0,TIMING_MAIN_END) c:RegisterEffect(e1) --tograve local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,52198054) e2:SetCondition(c52198054.condition) e2:SetCost(c52198054.cost) e2:SetTarget(c52198054.target2) e2:SetOperation(c52198054.operation) e2:SetHintTiming(0,TIMING_MAIN_END) e2:SetLabel(1) c:RegisterEffect(e2) --change local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_CHANGE_CODE) e3:SetRange(LOCATION_SZONE) e3:SetValue(21420702) c:RegisterEffect(e3) --tograve local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(52198054,1)) e4:SetCategory(CATEGORY_TOGRAVE) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_GRAVE) e4:SetCondition(c52198054.condition) e4:SetCost(c52198054.tgcost) e4:SetTarget(c52198054.tgtg) e4:SetOperation(c52198054.tgop) e4:SetHintTiming(0,TIMING_MAIN_END) c:RegisterEffect(e4) end function c52198054.target1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end if (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetFlagEffect(tp,52198054)==0 and Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_HAND,0,1,nil,0x32) and Duel.SelectYesNo(tp,aux.Stringid(52198054,0)) then e:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e:SetProperty(EFFECT_FLAG_PLAYER_TARGET) Duel.RegisterFlagEffect(tp,52198054,RESET_PHASE+PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) e:SetLabel(1) e:GetHandler():RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(52198054,2)) else e:SetCategory(0) e:SetProperty(0) e:SetLabel(0) end end function c52198054.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2 end function c52198054.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,52198054)==0 end Duel.RegisterFlagEffect(tp,52198054,RESET_PHASE+PHASE_END,0,1) end function c52198054.target2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_HAND,0,1,nil,0x32) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c52198054.operation(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 or not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_HAND,0,1,1,nil,0x32) if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then Duel.Draw(tp,1,REASON_EFFECT) end end function c52198054.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c52198054.tgfilter(c) return c:IsSetCard(0x32) and c:IsAbleToGrave() end function c52198054.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c52198054.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function c52198054.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c52198054.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c78474168.lua
2
2885
--ブレイクスルー・スキル function c78474168.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1c0) e1:SetTarget(c78474168.target) e1:SetOperation(c78474168.activate) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(78474168,0)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(c78474168.negcon) e2:SetCost(c78474168.negcost) e2:SetTarget(c78474168.target) e2:SetOperation(c78474168.activate2) c:RegisterEffect(e2) end function c78474168.filter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not c:IsDisabled() end function c78474168.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c78474168.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c78474168.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c78474168.filter,tp,0,LOCATION_MZONE,1,1,nil) end function c78474168.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsDisabled() and tc:IsControler(1-tp) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) end end function c78474168.negcon(e,tp,eg,ep,ev,re,r,rp) return aux.exccon(e) and Duel.GetTurnPlayer()==tp end function c78474168.negcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c78474168.activate2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsDisabled() and tc:IsControler(1-tp) and tc:IsType(TYPE_EFFECT) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) end end
gpl-2.0
dr01d3r/darkstar
scripts/globals/abilities/divine_waltz_ii.lua
6
2763
----------------------------------- -- Ability: Divine Waltz II -- Restores the HP of all party members within a small radius. -- Obtained: Dancer Level 78 -- TP Required: 80% -- Recast Time: 00:20 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (target:getHP() == 0) then return MSGBASIC_CANNOT_ON_THAT_TARG,0; elseif (player:hasStatusEffect(EFFECT_SABER_DANCE)) then return MSGBASIC_UNABLE_TO_USE_JA2, 0; elseif (player:hasStatusEffect(EFFECT_TRANCE)) then return 0,0; elseif (player:getTP() < 800) then return MSGBASIC_NOT_ENOUGH_TP,0; else --[[ Apply "Waltz Ability Delay" reduction 1 modifier = 1 second]] local recastMod = player:getMod(MOD_WALTZ_DELAY); if (recastMod ~= 0) then local newRecast = ability:getRecast() +recastMod; ability:setRecast(utils.clamp(newRecast,0,newRecast)); end -- Apply "Fan Dance" Waltz recast reduction if (player:hasStatusEffect(EFFECT_FAN_DANCE)) then local fanDanceMerits = target:getMerit(MERIT_FAN_DANCE); -- Every tier beyond the 1st is -5% recast time if (fanDanceMerits > 5) then ability:setRecast(ability:getRecast() * ((fanDanceMerits -5)/100)); end end return 0,0; end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) -- Only remove TP if the player doesn't have Trance, and only deduct once instead of for each target. if (player:getID() == target:getID() and player:hasStatusEffect(EFFECT_TRANCE) == false) then player:delTP(800); end; -- Grabbing variables. local vit = target:getStat(MOD_VIT); local chr = player:getStat(MOD_CHR); local mjob = player:getMainJob(); --19 for DNC main. local sjob = player:getSubJob(); local cure = 0; -- Performing sj mj check. if (mjob == 19) then cure = (vit+chr)*0.75+270; end if (sjob == 19) then cure = (vit+chr)*0.175+270; end -- Apply waltz modifiers cure = math.floor(cure * (1.0 + (player:getMod(MOD_WALTZ_POTENTCY)/100))); -- Cap the final amount to max HP. if ((target:getMaxHP() - target:getHP()) < cure) then cure = (target:getMaxHP() - target:getHP()); end -- Applying server mods.... cure = cure * CURE_POWER; target:restoreHP(cure); target:wakeUp(); player:updateEnmityFromCure(target,cure); return cure; end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Port_Bastok/npcs/Nokkhi_Jinjahl.lua
9
13210
----------------------------------- -- Area: Port Bastok -- NPC: Nokkhi Jinjahl -- Type: Travelling Merchant NPC / NPC Quiver Maker / Bastok 1st Place -- @zone 236 -- @pos 112.667 7.455 -46.174 ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local count = trade:getItemCount(); local carnation = trade:getItemQty(948) ----------------ARROWS---------------------------- local antlion = (trade:getItemQty(19195) / 99) local beetle = (trade:getItemQty(18154) / 99) local demon = (trade:getItemQty(18159) / 99) local gargou = (trade:getItemQty(19800) / 99) local horn = (trade:getItemQty(18156) / 99) local irona = (trade:getItemQty(17320) / 99) local kabura = (trade:getItemQty(17325) / 99) local ruszor = (trade:getItemQty(19182) / 99) local scorpion = (trade:getItemQty(18155) / 99) local silvera = (trade:getItemQty(17321) / 99) local sleepa = (trade:getItemQty(18158) / 99) ----------------BOLTS----------------------------- local acid = (trade:getItemQty(18148) / 99) local adamana = (trade:getItemQty(19801) / 99) local blind = (trade:getItemQty(18150) / 99) local bloody = (trade:getItemQty(18151) / 99) local darka = (trade:getItemQty(19183) / 99) local darkling = (trade:getItemQty(19196) / 99) local darksteel = (trade:getItemQty(17338) / 99) local fusion = (trade:getItemQty(19197) / 99) local holy = (trade:getItemQty(18153) / 99) local mythril = (trade:getItemQty(17337) / 99) local sleepb = (trade:getItemQty(18149) / 99) local venom = (trade:getItemQty(18152) / 99) ----------------BULLETS--------------------------- local adamanb = (trade:getItemQty(19803) / 99) local bullet = (trade:getItemQty(17340) / 99) local bronze = (trade:getItemQty(17343) / 99) local darkb = (trade:getItemQty(19184) / 99) local dweomer = (trade:getItemQty(19198) / 99) local ironb = (trade:getItemQty(17312) / 99) local oberons = (trade:getItemQty(19199) / 99) local orichalcum = (trade:getItemQty(19802) / 99) local silverb = (trade:getItemQty(17341) / 99) local steel = (trade:getItemQty(18723) / 99) local spartan = (trade:getItemQty(18160) / 99) ----------------CARDS----------------------------- local fire = (trade:getItemQty(2176) / 99) local ice = (trade:getItemQty(2177) / 99) local wind = (trade:getItemQty(2178) / 99) local earth = (trade:getItemQty(2179) / 99) local thunder = (trade:getItemQty(2180) / 99) local water = (trade:getItemQty(2181) / 99) local light = (trade:getItemQty(2182) / 99) local dark = (trade:getItemQty(2183) / 99) ----------------------------------------------------- local quiver = (antlion + beetle + demon + gargou + horn + irona + kabura + ruszor + scorpion + silvera + sleepa + acid + adamana + blind + bloody + darka + darkling + darksteel + fusion + holy + mythril + sleepb + venom + adamanb + bullet + bronze + darkb + dweomer + ironb + oberons + orichalcum + silverb + steel + spartan + fire + ice + wind + earth + thunder + water + light + dark) if (((quiver * 99) + carnation) == count) then if ((quiver == math.floor(quiver)) and (quiver == carnation) and (player:getFreeSlotsCount() >= carnation)) then player:tradeComplete(); ----------------ARROWS---------------------------- if (antlion > 0) then player:addItem(5819,antlion); player:messageSpecial(ITEM_OBTAINED,5819); end if (beetle > 0) then player:addItem(4221,beetle); player:messageSpecial(ITEM_OBTAINED,4221); end if (demon > 0) then player:addItem(4224,demon); player:messageSpecial(ITEM_OBTAINED,4224); end if (gargou > 0) then player:addItem(5912,gargouille); player:messageSpecial(ITEM_OBTAINED,5912); end if (horn > 0) then player:addItem(4222,horn); player:messageSpecial(ITEM_OBTAINED,4222); end if (irona > 0) then player:addItem(4225,irona); player:messageSpecial(ITEM_OBTAINED,4225); end if (kabura > 0) then player:addItem(5332,kabura); player:messageSpecial(ITEM_OBTAINED,5332); end if (ruszor > 0) then player:addItem(5871,ruszor); player:messageSpecial(ITEM_OBTAINED,5871); end if (scorpion > 0) then player:addItem(4223,scorpion); player:messageSpecial(ITEM_OBTAINED,4223); end if (silvera > 0) then player:addItem(4226,silvera); player:messageSpecial(ITEM_OBTAINED,4226); end if (sleepa > 0) then player:addItem(5333,sleepa); player:messageSpecial(ITEM_OBTAINED,5333); end ----------------BOLTS----------------------------- if (acid > 0) then player:addItem(5335,acid); player:messageSpecial(ITEM_OBTAINED,5335); end if (adamana > 0) then player:addItem(5913,adamana); player:messageSpecial(ITEM_OBTAINED,5913); end if (blind > 0) then player:addItem(5334,blind); player:messageSpecial(ITEM_OBTAINED,5334); end if (bloody > 0) then player:addItem(5339,bloody); player:messageSpecial(ITEM_OBTAINED,5339); end if (darka > 0) then player:addItem(5872,darka); player:messageSpecial(ITEM_OBTAINED,5872); end if (darkling > 0) then player:addItem(5820,darkling); player:messageSpecial(ITEM_OBTAINED,5820); end if (darksteel > 0) then player:addItem(4229,darksteel); player:messageSpecial(ITEM_OBTAINED,4229); end if (fusion > 0) then player:addItem(5821,fusion); player:messageSpecial(ITEM_OBTAINED,5821); end if (holy > 0) then player:addItem(5336,holy); player:messageSpecial(ITEM_OBTAINED,5336); end if (mythril > 0) then player:addItem(4228,mythril); player:messageSpecial(ITEM_OBTAINED,4228); end if (sleepb > 0) then player:addItem(5337,sleepb); player:messageSpecial(ITEM_OBTAINED,5337); end if (venom > 0) then player:addItem(5338,venom); player:messageSpecial(ITEM_OBTAINED,5338); end ----------------BULLETS--------------------------- if (adamanb > 0) then player:addItem(5915,adamanb); player:messageSpecial(ITEM_OBTAINED,5915); end if (bullet > 0) then player:addItem(5363,bullet); player:messageSpecial(ITEM_OBTAINED,5363); end if (bronze > 0) then player:addItem(5359,bronze); player:messageSpecial(ITEM_OBTAINED,5359); end if (darkb > 0) then player:addItem(5873,darkb); player:messageSpecial(ITEM_OBTAINED,5873); end if (dweomer > 0) then player:addItem(5822,dweomer); player:messageSpecial(ITEM_OBTAINED,5822); end if (ironb > 0) then player:addItem(5353,ironb); player:messageSpecial(ITEM_OBTAINED,5353); end if (oberons > 0) then player:addItem(5823,oberons); player:messageSpecial(ITEM_OBTAINED,5823); end if (orichalcum > 0) then player:addItem(5914,orichalcum); player:messageSpecial(ITEM_OBTAINED,5914); end if (silverb > 0) then player:addItem(5340,silverb); player:messageSpecial(ITEM_OBTAINED,5340); end if (steel > 0) then player:addItem(5416,steel); player:messageSpecial(ITEM_OBTAINED,5416); end if (spartan > 0) then player:addItem(5341,spartan); player:messageSpecial(ITEM_OBTAINED,5341); end ----------------CARDS----------------------------- if (fire > 0) then player:addItem(5402,fire); player:messageSpecial(ITEM_OBTAINED,5402); end if (ice > 0) then player:addItem(5403,ice); player:messageSpecial(ITEM_OBTAINED,5403); end if (wind > 0) then player:addItem(5404,wind); player:messageSpecial(ITEM_OBTAINED,5404); end if (earth > 0) then player:addItem(5405,earth); player:messageSpecial(ITEM_OBTAINED,5405); end if (thunder > 0) then player:addItem(5406,thunder); player:messageSpecial(ITEM_OBTAINED,5406); end if (water > 0) then player:addItem(5407,water); player:messageSpecial(ITEM_OBTAINED,5407); end if (light > 0) then player:addItem(5408,light); player:messageSpecial(ITEM_OBTAINED,5408); end if (dark > 0) then player:addItem(5409,dark); player:messageSpecial(ITEM_OBTAINED,5409); end end end -- 948 - carnation -- SINGLE -- ARROWS---------------- STACK -- 19195 - antlion arrow - 5819 -- 18154 - beetle arrow - 4221 -- 18159 - demon arrow - 4224 -- 19800 - gargouille arrow - 5912 -- 18156 - horn arrow - 4222 -- 17320 - iron arrow - 4225 -- 17325 - kabura arrow - 5332 -- 19182 - ruszor arrow - 5871 -- 18155 - scorpion arrow - 4223 -- 17321 - silver arrow - 4226 -- 18158 - sleep arrow - 5333 ---------- BOLTS ----------------------- -- 18148 - acid bolt - 5335 -- 19801 - adaman bolt - 5913 -- 18150 - blind bolt - 5334 -- 18151 - bloody bolt - 5339 -- 19183 - dark adaman bolt - 5872 -- 19196 - darkling bolt - 5820 -- 17338 - darksteel bolt - 4229 -- 19197 - fusion bolt - 5821 -- 18153 - holy bolt - 5336 -- 17337 - mythril bolt - 4228 -- 18149 - sleep bolt - 5337 -- 18152 - venom bolt - 5338 ---------- BULLETS --------------------- -- 19803 - adaman bullet - 5915 -- 17340 - bullet - 5363 -- 17343 - bronze bullet - 5359 -- 19184 - dark adaman bullet - 5873 -- 19198 - dweomer bullet - 5822 -- 17312 - iron bullet - 5353 -- 19199 - oberon's bullet - 5823 -- 19802 - orichalcum bullet - 5914 -- 17341 - silver bullet - 5340 -- 18723 - steel bullet - 5416 -- 18160 - spartan bullet - 5341 ---------- CARDS ----------------------- -- 2176 - fire card - 5402 -- 2177 - ice card - 5403 -- 2178 - wind card - 5404 -- 2179 - earth card - 5405 -- 2180 - thunder card - 5406 -- 2181 - water card - 5407 -- 2182 - light card - 5408 -- 2183 - dark card - 5409 -------------------------------------- end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x011d,npc:getID()); 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
koreader/koreader
frontend/ui/data/keyboardlayouts/ja_keyboard.lua
4
11619
-------- -- Japanese 12-key flick keyboard layout, modelled after Android's flick -- keyboard. Rather than being modal, it has the ability to apply modifiers to -- the previous character. In addition, users can tap a kana key to cycle -- through the various kana in that kana row (and associated small kana). -- -- Note that because we cannot have tri-state buttons (and we want to be able -- to input katakana) we emulate a quad-state button using the symbol and shift -- layers. Users just have to tap whatever mode they want and they should be -- able to get there easily. -------- local logger = require("logger") local util = require("util") local time = require("ui/time") local _ = require("gettext") local C_ = _.pgettext local N_ = _.ngettext local T = require("ffi/util").template local K = require("frontend/ui/data/keyboardlayouts/ja_keyboard_keys") local DEFAULT_KEITAI_TAP_INTERVAL_S = 2 -- "Keitai input" is an input mode similar to T9 mobile input, where you tap a -- key to cycle through several candidate characters. The tap interval is how -- long we are going to wait before committing to the current character. See -- <https://en.wikipedia.org/wiki/Japanese_input_method#Mobile_phones> for more -- information. local function getKeitaiTapInterval() return time.s(G_reader_settings:readSetting("keyboard_japanese_keitai_tap_interval", DEFAULT_KEITAI_TAP_INTERVAL_S)) end local function setKeitaiTapInterval(interval) G_reader_settings:saveSetting("keyboard_japanese_keitai_tap_interval", time.to_s(interval)) end local function exitKeitaiMode(inputbox) logger.dbg("ja_kbd: clearing keitai window last tap tv") inputbox._ja_last_tap_time = nil end local function wrappedAddChars(inputbox, char) -- Find the relevant modifier cycle tables. local modifier_table = K.MODIFIER_TABLE[char] local keitai_cycle = K.KEITAI_TABLE[char] -- For keitai buttons, are we still in the tap interval? local within_tap_window if keitai_cycle then if inputbox._ja_last_tap_time then within_tap_window = time.since(inputbox._ja_last_tap_time) < getKeitaiTapInterval() end inputbox._ja_last_tap_time = time.now() else -- This is a non-keitai or non-tap key, so break out of keitai window. exitKeitaiMode(inputbox) end -- Get the character behind the cursor and figure out how to modify it. local new_char local current_char = inputbox:getChar(-1) if modifier_table then new_char = modifier_table[current_char] elseif keitai_cycle and keitai_cycle[current_char] and within_tap_window then new_char = keitai_cycle[current_char] else -- Regular key, just add it as normal. inputbox.addChars:raw_method_call(char) return end -- Replace character if there was a valid replacement. logger.dbg("ja_kbd: applying", char, "key to", current_char, "yielded", new_char) if not current_char then return end -- no character to modify if new_char then -- Use the raw methods to avoid calling the callbacks. inputbox.delChar:raw_method_call() inputbox.addChars:raw_method_call(new_char) end end local function wrapInputBox(inputbox) if inputbox._ja_wrapped == nil then inputbox._ja_wrapped = true local wrappers = {} -- Wrap all of the navigation and non-single-character-input keys with -- a callback to clear the tap window, but pass through to the -- original function. -- Delete text. table.insert(wrappers, util.wrapMethod(inputbox, "delChar", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "delToStartOfLine", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "clear", nil, exitKeitaiMode)) -- Navigation. table.insert(wrappers, util.wrapMethod(inputbox, "leftChar", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "rightChar", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "upLine", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "downLine", nil, exitKeitaiMode)) -- Move to other input box. table.insert(wrappers, util.wrapMethod(inputbox, "unfocus", nil, exitKeitaiMode)) -- Gestures to move cursor. table.insert(wrappers, util.wrapMethod(inputbox, "onTapTextBox", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "onHoldTextBox", nil, exitKeitaiMode)) table.insert(wrappers, util.wrapMethod(inputbox, "onSwipeTextBox", nil, exitKeitaiMode)) -- addChars is the only method we need a more complicated wrapper for. table.insert(wrappers, util.wrapMethod(inputbox, "addChars", wrappedAddChars, nil)) return function() if inputbox._ja_wrapped then for _, wrapper in ipairs(wrappers) do wrapper:revert() end inputbox._ja_last_tap_time = nil inputbox._ja_wrapped = nil end end end end local function genMenuItems(self) return { { text_func = function() local interval = getKeitaiTapInterval() if interval ~= 0 then -- @translators Keitai input is a kind of Japanese keyboard input mode (similar to T9 keypad input). See <https://en.wikipedia.org/wiki/Japanese_input_method#Mobile_phones> for more information. return T(N_("Keitai tap interval: %1 second", "Keitai tap interval: %1 seconds", time.to_s(interval)), time.to_s(interval)) else -- @translators Flick and keitai are kinds of Japanese keyboard input modes. See <https://en.wikipedia.org/wiki/Japanese_input_method#Mobile_phones> for more information. return _("Keitai input: disabled (flick-only input)") end end, help_text = _("How long to wait for the next tap when in keitai input mode before committing to the current character. During this window, tapping a single key will loop through candidates for the current character being input. Any other input will cause you to leave keitai mode."), keep_menu_open = true, callback = function(touchmenu_instance) local SpinWidget = require("ui/widget/spinwidget") local UIManager = require("ui/uimanager") local Screen = require("device").screen local items = SpinWidget:new{ title_text = _("Keitai tap interval"), info_text = _([[ How long to wait (in seconds) for the next tap when in keitai input mode before committing to the current character. During this window, tapping a single key will loop through candidates for the current character being input. Any other input will cause you to leave keitai mode. If set to 0, keitai input is disabled entirely and only flick input can be used.]]), width = math.floor(Screen:getWidth() * 0.75), value = time.to_s(getKeitaiTapInterval()), value_min = 0, value_max = 10, value_step = 1, unit = C_("Time", "s"), ok_text = _("Set interval"), default_value = DEFAULT_KEITAI_TAP_INTERVAL_S, callback = function(spin) setKeitaiTapInterval(time.s(spin.value)) if touchmenu_instance then touchmenu_instance:updateItems() end end, } UIManager:show(items) end, }, } end -- Basic modifier keys. local M_l = { label = "←", } -- Arrow left local M_r = { label = "→", } -- Arrow right local Msw = { label = "🌐", } -- Switch keyboard local Mbk = { label = "", bold = false, } -- Backspace -- Modifier key for kana input. local Mmd = { label = "◌゙ ◌゚", alt_label = "大⇔小", K.MODIFIER_KEY_CYCLIC, west = K.MODIFIER_KEY_DAKUTEN, north = K.MODIFIER_KEY_SMALLKANA, east = K.MODIFIER_KEY_HANDAKUTEN, } -- Modifier key for latin input. local Msh = { label = "a⇔A", K.MODIFIER_KEY_SHIFT } -- In order to emulate the tri-modal system of 12-key keyboards we treat shift -- and symbol modes as being used to specify which of the three target layers -- to use. The four modes are hiragana (default), katakana (shift), English -- letters (symbol), numbers and symbols (shift+symbol). -- -- In order to make it easy for users to know which button will take them to a -- specific mode, we need to give different keys the same name at certain -- times, so we append a \0 to one set so that the VirtualKeyboard can -- differentiate them on key tap even though they look the same to the user. -- Shift-mode toggle button. local Sh_abc = { label = "ABC\0", alt_label = "ひらがな", bold = true, } local Sh_sym = { label = "記号\0", bold = true, } -- Switch to numbers and symbols. local Sh_hir = { label = "ひらがな\0", bold = true, } -- Switch to hiragana. local Sh_kat = { label = "カタカナ\0", bold = true, } -- Switch to katakana. -- Symbol-mode toggle button. local Sy_abc = { label = "ABC", alt_label = "記号", bold = true, } local Sy_sym = { label = "記号", bold = true, } -- Switch to numbers and symbols. local Sy_hir = { label = "ひらがな", bold = true, } -- Switch to hiragana. local Sy_kat = { label = "カタカナ", bold = true, } -- Switch to katakana. return { min_layer = 1, max_layer = 4, shiftmode_keys = {["ABC\0"] = true, ["記号\0"] = true, ["カタカナ\0"] = true, ["ひらがな\0"] = true}, symbolmode_keys = {["ABC"] = true, ["記号"] = true, ["ひらがな"] = true, ["カタカナ"] = true}, utf8mode_keys = {["🌐"] = true}, keys = { -- first row [🌐, あ, か, さ, <bksp>] { -- R r S s Msw, { K.k_a, K.h_a, K.s_1, K.l_1, }, { K.kKa, K.hKa, K.s_2, K.l_2, }, { K.kSa, K.hSa, K.s_3, K.l_3, }, Mbk, }, -- second row [←, た, な, は, →] { -- R r S s M_l, { K.kTa, K.hTa, K.s_4, K.l_4, }, { K.kNa, K.hNa, K.s_5, K.l_5, }, { K.kHa, K.hHa, K.s_6, K.l_6, }, M_r, }, -- third row [<shift>, ま, や, ら, < >] { -- R r S s { Sh_hir, Sh_kat, Sh_abc, Sh_sym, }, -- Shift { K.kMa, K.hMa, K.s_7, K.l_7, }, { K.kYa, K.hYa, K.s_8, K.l_8, }, { K.kRa, K.hRa, K.s_9, K.l_9, }, { label = "␣", " ", " ", " ", " ",} -- whitespace }, -- fourth row [symbol, modifier, わ, 。, enter] { -- R r S s { Sy_sym, Sy_abc, Sy_kat, Sy_hir, }, -- Symbols { Mmd, Mmd, K.s_b, Msh, }, { K.kWa, K.hWa, K.s_0, K.l_0, }, { K.k_P, K.h_P, K.s_p, K.l_P, }, { label = "⮠", bold = true, "\n", "\n", "\n", "\n",}, -- newline }, }, -- Methods. wrapInputBox = wrapInputBox, genMenuItems = genMenuItems, }
agpl-3.0
Maliv/TG-Guard
plugins/stats.lua
458
4098
-- Saves the number of messages from a user -- Can check the number of messages with !stats do local NUM_MSG_MAX = 5 local TIME_CHECK = 4 -- seconds local function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ('..user_id..')' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = '' for k,user in pairs(users_info) do text = text..user.name..' => '..user.msgs..'\n' end return text end -- Save stats, ban user local function pre_process(msg) -- Ignore service msg if msg.service then print('Service message') 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 -- Total user msgs local hash = 'msgs:'..msg.from.id..':'..msg.to.id redis:incr(hash) -- Check flood if msg.from.type == 'user' then local hash = 'user:'..msg.from.id..':msgs' local msgs = tonumber(redis:get(hash) or 0) if msgs > NUM_MSG_MAX then print('User '..msg.from.id..'is flooding '..msgs) msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end return msg end local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nChats: '..r return text end local function run(msg, matches) if matches[1]:lower() == "stats" then if not matches[2] then if msg.to.type == 'chat' then local chat_id = msg.to.id return chat_stats(chat_id) else return 'Stats works only on chats' end end if matches[2] == "bot" then if not is_sudo(msg) then return "Bot stats requires privileged user" else return bot_stats() end end if matches[2] == "chat" then if not is_sudo(msg) then return "This command requires privileged user" else return chat_stats(matches[3]) end end end end return { description = "Plugin to update user stats.", usage = { "!stats: Returns a list of Username [telegram_id]: msg_num", "!stats chat <chat_id>: Show stats for chat_id", "!stats bot: Shows bot stats (sudo users)" }, patterns = { "^!([Ss]tats)$", "^!([Ss]tats) (chat) (%d+)", "^!([Ss]tats) (bot)" }, run = run, pre_process = pre_process } end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c26949946.lua
5
2886
--幻獣機ヤクルスラーン function c26949946.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x101b),aux.NonTuner(Card.IsSetCard,0x101b),1) c:EnableReviveLimit() --handes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(26949946,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c26949946.hdcon) e1:SetCost(c26949946.hdcost) e1:SetTarget(c26949946.hdtg) e1:SetOperation(c26949946.hdop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(c26949946.indtg) e2:SetValue(1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e3) --set local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(26949946,1)) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(c26949946.setcon) e4:SetTarget(c26949946.settg) e4:SetOperation(c26949946.setop) c:RegisterEffect(e4) end function c26949946.hdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO end function c26949946.hdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsCode,1,nil,31533705) and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND) local g=Duel.SelectReleaseGroup(tp,Card.IsCode,1,ct,nil,31533705) e:SetLabel(g:GetCount()) Duel.Release(g,REASON_COST) end function c26949946.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,e:GetLabel()) end function c26949946.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if g:GetCount()>0 then local sg=g:RandomSelect(1-tp,e:GetLabel()) Duel.SendtoGrave(sg,REASON_DISCARD+REASON_EFFECT) end end function c26949946.indtg(e,c) return c:IsSetCard(0x101b) and c~=e:GetHandler() end function c26949946.setcon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and e:GetHandler():GetPreviousControler()==tp end function c26949946.filter(c) return c:GetType()==TYPE_SPELL+TYPE_QUICKPLAY and c:IsSSetable() end function c26949946.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c26949946.filter,tp,LOCATION_DECK,0,1,nil) end end function c26949946.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,c26949946.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) Duel.ConfirmCards(1-tp,g) end end
gpl-2.0
dr01d3r/darkstar
scripts/zones/Windurst_Waters_[S]/npcs/Ragyaya.lua
14
1056
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Ragyaya -- Type: Standard NPC -- @zone 94 -- @pos -95.376 -3 60.795 -- -- 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(0x0196); 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
dr01d3r/darkstar
scripts/zones/Port_Bastok/TextIDs.lua
6
5180
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item>. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6383; -- You cannot obtain the item (item>. Try trading again after sorting your inventory. ITEM_OBTAINED = 6385; -- Obtained: #. GIL_OBTAINED = 6386; -- Obtained <<<Numeric Parameter 0>>> gil. KEYITEM_OBTAINED = 6388; -- Obtained key item: <<<Unknown Parameter (Type: 80) 1>>>. KEYITEM_LOST = 6389; -- Lost key item <<<Unknown Parameter (Type: 80) 1>>>. NOT_HAVE_ENOUGH_GIL = 6390; -- You do not have enough gil. HOMEPOINT_SET = 6503; -- Home point set! FISHING_MESSAGE_OFFSET = 7077; -- You can't fish here. MOGHOUSE_EXIT = 7940; -- You have learned your way through the back alleys of Bastok! Now you can exit to any area from your residence. -- Conquest System CONQUEST = 7996; -- You've earned conquest points! -- Mission Dialogs YOU_ACCEPT_THE_MISSION = 7336; -- You have accepted the mission. ORIGINAL_MISSION_OFFSET = 7341; -- You can consult the ission section of the main menu to review your objectives. Speed and efficiency are your priorities. Dismissed. EXTENDED_MISSION_OFFSET = 8461; -- Go to Ore Street and talk to Medicine Eagle. He says he was there when the commotion started. -- Dialog Texts POWHATAN_DIALOG_1 = 7265; -- I'm sick and tired of entertaining guests. RONAN_DIALOG_1 = 7451; -- Do something! Isn't there anything you can do to make him come out of his shell? PAUJEAN_DIALOG_1 = 7642; -- Where can you find them? If you're the kind of adventurer I think you are, you should have a pretty good idea. UNLOCK_NINJA = 8423; -- You can now become a ninja. TITAN_UNLOCKED = 8528; -- You are now able to summon -- Shop Texts TENSHODO_SHOP_OPEN_DIALOG = 6724; -- Ah, one of our members. Welcome to the Tenshodo shop. EVELYN_CLOSED_DIALOG = 7570; -- I'm trying to start a business selling goods from Gustaberg, ROSSWALD_CLOSED_DIALOG = 7571; -- I'm trying to start a business selling goods from Zulkheim, BELKA_CLOSED_DIALOG = 7572; -- I'm trying to start a business selling goods from Derfland, VATTIAN_CLOSED_DIALOG = 7573; -- I'm trying to start a business selling goods from Kuzotz, VALERIANO_SHOP_DIALOG = 7575; -- Welcome to the Troupe Valeriano. Valeriano, at your service! Have a laugh, then spend some cash! SAWYER_SHOP_DIALOG = 7620; -- Hi, there. For here or to go? MELLOA_SHOP_DIALOG = 7621; -- Welcome to the Steaming Sheep. Would you like something to drink? EVELYN_OPEN_DIALOG = 7624; -- Hello! Might I interest you in some specialty goods from Gustaberg? GALVIN_SHOP_DIALOG = 7625; -- Welcome to Galvin's Travel Gear! NUMA_SHOP_DIALOG = 7626; -- Hello, hello! Won't you buy something? I'll give you a rebate! BELKA_OPEN_DIALOG = 7627; -- Welcome. I've got goods from Derfland. Interested? ROSSWALD_OPEN_DIALOG = 7628; -- Hello, hello! Everything I have is imported directly from Zulkheim! ILITA_SHOP_DIALOG = 7629; -- Hello there. How about buying SUGANDHI_SHOP_DIALOG = 7630; -- Traveler! I am sure my wares will prove useful on your journey. DENVIHR_SHOP_DIALOG = 7631; -- Ah, interested in my wares, are you? You can only buy these in Bastok, my friend. MUSTAFA_DIALOG = 7622; -- Hello. This concourse is for arriving passengers. BARTHOLOMEO_DIALOG = 7622; -- Hello. This concourse is for arriving passengers. KLAUS_DIALOG = 7623; -- Hello. This concourse is for departing passengers. CAREY_DIALOG = 7623; -- Hello. This concourse is for departing passengers. VATTIAN_OPEN_DIALOG = 8356; -- Welcome to my humble establishment. I have a wide variety of specialty goods from Kuzotz. ZOBYQUHYO_OPEN_DIALOG = 8357; -- Hey therrre! I've got lots of wonderrrful goodies, fresh from the Elshimo Lowlands. ZOBYQUHYO_CLOSED_DIALOG = 8358; -- I'm trrrying to start a business selling goods from the Elshimo Lowlands, but it's not easy getting stuff from areas that aren't under Bastokan contrrrol. DHENTEVRYUKOH_OPEN_DIALOG = 8359; -- Welcome! Welcome! Take a wonderrr at these specialty goods from the Elshimo Uplands! DHENTEVRYUKOH_CLOSED_DIALOG = 8360; -- I'm trrrying to start a business selling goods from the Elshimo Uplands, but it's not easy transporting goods from areas that aren't under Bastokan contrrrol. BLABBIVIX_SHOP_DIALOG = 8632; -- I come from the underworld. These chipshhh, you knooow, are popular among us Goblinshhh. Use with heart of shhhtatue. BAGNOBROK_CLOSED_DIALOG = 9115; -- Kbastok sis kweak! Smoblins yonly twant gstrong sfriends! Non sgoods mfrom Smovalpolos ytoday! BAGNOBROK_OPEN_DIALOG = 9116; -- Kbastok! Crepublic sis gstrong! Smoblins lsell sgoods oto gstrong sfriends! -- conquest Base CONQUEST_BASE = 6523; -- Tallying conquest results...
gpl-3.0
dr01d3r/darkstar
scripts/globals/mobskills/Tribulation.lua
27
1087
--------------------------------------------- -- Tribulation -- -- Description: Inflicts Bio and blinds all targets in an area of effect. -- Type: Enfeebling -- Utsusemi/Blink absorb: Ignores shadows -- Range: AoE -- Notes: Bio effect can take away up to 39/tick. --------------------------------------------- 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 blinded = false; local bio = false; blinded = MobStatusEffectMove(mob, target, EFFECT_BLINDNESS, 20, 0, 120); bio = MobStatusEffectMove(mob, target, EFFECT_BIO, 39, 0, 120); skill:setMsg(MSG_ENFEEB_IS); -- display blind first, else bio if (blinded == MSG_ENFEEB_IS) then typeEffect = EFFECT_BLINDNESS; elseif (bio == MSG_ENFEEB_IS) then typeEffect = EFFECT_BIO; else skill:setMsg(MSG_MISS); end return typeEffect; end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Bastok_Markets/npcs/Rabid_Wolf_IM.lua
13
5586
----------------------------------- -- Area: Bastok Markets -- NPC: Rabid Wolf, I.M. -- X Grant Signet -- X Recharge Emperor Band, Empress Band, or Chariot Band -- X Accepts traded Crystals to fill up the Rank bar to open new Missions. -- X Sells items in exchange for Conquest Points -- X Start Supply Run Missions and offers a list of already-delivered supplies. -- Start an Expeditionary Force by giving an E.F. region insignia to you. ------------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ------------------------------------- require("scripts/globals/conquest"); require("scripts/globals/common"); require("scripts/zones/Bastok_Markets/TextIDs"); local guardnation = NATION_BASTOK; -- SANDORIA, BASTOK, WINDURST, JEUNO local guardtype = 1; -- 1: city, 2: foreign, 3: outpost, 4: border local size = #BastInv; local inventory = BastInv; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getNation() == guardnation and player:getVar("supplyQuest_started") > 0 and supplyRunFresh(player) == 0) then player:showText(npc,CONQUEST + 40); -- "We will dispose of those unusable supplies." local region = player:getVar("supplyQuest_region"); player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1,getSupplyKey(region)); player:setVar("supplyQuest_started",0); player:setVar("supplyQuest_region",0); player:setVar("supplyQuest_fresh",0); else local Menu1 = getArg1(guardnation,player); local Menu2 = getExForceAvailable(guardnation,player); local Menu3 = conquestRanking(); local Menu4 = getSupplyAvailable(guardnation,player); local Menu5 = player:getNationTeleport(guardnation); local Menu6 = getArg6(player); local Menu7 = player:getCP(); local Menu8 = getRewardExForce(guardnation,player); player:startEvent(0x7ff9,Menu1,Menu2,Menu3,Menu4,Menu5,Menu6,Menu7,Menu8); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("onUpdateCSID: %u",csid); -- printf("onUpdateOPTION: %u",option); if (option >= 32768 and option <= 32944) then for Item = 1,size,3 do if (option == inventory[Item]) then CPVerify = 1; if (player:getCP() >= inventory[Item + 1]) then CPVerify = 0; end; player:updateEvent(2,CPVerify,inventory[Item + 2]); break; end; end; end; end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("onFinishCSID: %u",csid); -- printf("onFinishOPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option >= 32768 and option <= 32944) then for Item = 1,size,3 do if (option == inventory[Item]) then if (player:getFreeSlotsCount() >= 1) then -- Logic to impose limits on exp bands if (option >= 32933 and option <= 32935) then if (checkConquestRing(player) > 0) then player:messageSpecial(CONQUEST+60,0,0,inventory[Item+2]); break; else player:setVar("CONQUEST_RING_TIMER",getConquestTally()); end end if (player:getNation() == guardnation) then itemCP = inventory[Item + 1]; else if (inventory[Item + 1] <= 8000) then itemCP = inventory[Item + 1] * 2; else itemCP = inventory[Item + 1] + 8000; end; end; if (player:hasItem(inventory[Item + 2]) == false) then player:delCP(itemCP); player:addItem(inventory[Item + 2],1); player:messageSpecial(ITEM_OBTAINED,inventory[Item + 2]); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,inventory[Item + 2]); end; else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,inventory[Item + 2]); end; break; end; end; elseif (option >= 65541 and option <= 65565) then -- player chose supply quest. local region = option - 65541; player:addKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED,getSupplyKey(region)); player:setVar("supplyQuest_started",vanaDay()); player:setVar("supplyQuest_region",region); player:setVar("supplyQuest_fresh",getConquestTally()); end; end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Yuhtunga_Jungle/npcs/Harvesting_Point.lua
17
1103
----------------------------------- -- Area: Yuhtunga Jungle -- NPC: Harvesting Point ----------------------------------- package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil; ------------------------------------- require("scripts/globals/harvesting"); require("scripts/zones/Yuhtunga_Jungle/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startHarvesting(player,player:getZoneID(),npc,trade,0x00CE); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(HARVESTING_IS_POSSIBLE_HERE,1020); 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
SalvationDevelopment/Salvation-Scripts-Production
c70117860.lua
2
2092
--WW-スノウ・ベル function c70117860.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(70117860,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCondition(c70117860.spcon) e1:SetTarget(c70117860.sptg) e1:SetOperation(c70117860.spop) c:RegisterEffect(e1) --effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCondition(c70117860.efcon) e2:SetOperation(c70117860.efop) c:RegisterEffect(e2) end function c70117860.cfilter1(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WIND) end function c70117860.cfilter2(c) return c:IsFacedown() or not c:IsAttribute(ATTRIBUTE_WIND) end function c70117860.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c70117860.cfilter1,tp,LOCATION_MZONE,0,2,nil) and not Duel.IsExistingMatchingCard(c70117860.cfilter2,tp,LOCATION_MZONE,0,1,nil) end function c70117860.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c70117860.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function c70117860.efcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO and e:GetHandler():GetReasonCard():IsAttribute(ATTRIBUTE_WIND) end function c70117860.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(70117860,1)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetValue(c70117860.tgval) e1:SetReset(RESET_EVENT+0x1fe0000) rc:RegisterEffect(e1) end function c70117860.tgval(e,re,rp) return rp~=e:GetHandlerPlayer() end
gpl-2.0
kequanJiang/skynet_start
service/base_app/sock_mgr.lua
2
2884
local skynet = require "skynet" local socket = require "skynet.socket" local utils = require "utils" local packer = require "packer" local msg_define = require "msg_define" local M = { dispatch_tbl = {}, authed_fd = {}, clients = 0 } function M:start(conf) self.gate = skynet.newservice("gate") skynet.call(self.gate, "lua", "open", conf) skynet.error("login service listen on port "..conf.port) end function M:inc_clients() self.clients = self.clients + 1 end function M:dec_clients() if self.clients > 0 then self.clients = self.clients - 1 end end function M:get_clients() return self.clients end function M:auth_fd(fd) self.authed_fd[fd] = true end -------------------处理socket消息开始-------------------- function M:open(fd, addr) skynet.error("New client from : " .. addr) skynet.call(self.gate, "lua", "accept", fd) self:inc_clients() end function M:close(fd) self:close_conn(fd) skynet.error("socket close "..fd) end function M:error(fd, msg) self:close_conn(fd) skynet.error("socket error "..fd.." msg "..msg) end function M:warning(fd, size) self:close_conn(fd) skynet.error(string.format("%dK bytes havn't send out in fd=%d", size, fd)) end function M:data(fd, msg) skynet.error(string.format("recv socket data fd = %d, len = %d ", fd, #msg)) local proto_id, params = string.unpack(">Hs2", msg) local proto_name = msg_define.idToName(proto_id) skynet.error(string.format("socket msg id:%d name:%s %s", proto_id, proto_name, params)) if self.authed_fd[fd] or (proto_name == "login.login_baseapp") then self:dispatch(fd, proto_id, proto_name, params) else skynet.call(self.gate, "lua", "kick", fd) skynet.error("msg not authed!") end end function M:close_conn(fd) self.authed_fd[fd] = nil self:dec_clients() end -------------------处理socket消息结束-------------------- -------------------网络消息回调函数开始------------------ function M:register_callback(name, func) self.dispatch_tbl[name] = func end function M:dispatch(fd, proto_id, proto_name, params) params = utils.str_2_table(params) local func = self.dispatch_tbl[proto_name] if not func then skynet.error("协议编号"..proto_id) skynet.error("can't find socket callback "..proto_name) return end local ret = func(fd, params) if ret then skynet.error("ret msg:"..utils.table_2_str(ret)) socket.write(fd, packer.pack(proto_id, ret)) end end function M:send(fd, proto_name, msg) local proto_id = msg_define.nameToId(proto_name) local str = utils.table_2_str(msg) skynet.error("send msg:"..proto_name) socket.write(fd, packer.pack(proto_id, proto_id)) end -------------------网络消息回调函数结束------------------ return M
mit
dr01d3r/darkstar
scripts/zones/La_Theine_Plateau/npcs/Narvecaint.lua
14
1788
----------------------------------- -- Area: La Theine Plateau -- NPC: Narvecaint -- Involved in Mission: The Rescue Drill -- @pos -263 22 129 102 ----------------------------------- package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/La_Theine_Plateau/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(SANDORIA) == THE_RESCUE_DRILL) then local MissionStatus = player:getVar("MissionStatus"); if (MissionStatus == 6) then player:startEvent(0x006b); elseif (MissionStatus == 7) then player:showText(npc, RESCUE_DRILL + 14); elseif (MissionStatus == 8) then player:showText(npc, RESCUE_DRILL + 21); elseif (MissionStatus >= 9) then player:showText(npc, RESCUE_DRILL + 26); else player:showText(npc, RESCUE_DRILL); end else player:showText(npc, RESCUE_DRILL); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x006b) then player:setVar("MissionStatus",7); end end;
gpl-3.0
Chessnut/hl2rp
plugins/notes/sh_plugin.lua
2
2594
local PLUGIN = PLUGIN PLUGIN.name = "Note Writings" PLUGIN.author = "Black Tea" PLUGIN.desc = "You can write stuffs." NOTELIMIT = 1000 WRITINGDATA = WRITINGDATA or {} nut.util.include("cl_vgui.lua") if (CLIENT) then netstream.Hook("receiveNote", function(id, contents, write) local note = vgui.Create("noteRead") note:allowEdit(write) note:setText(contents) note.id = id end) else function FindNoteByID(id) for k, v in ipairs(ents.GetAll()) do if (v:GetClass() == "nut_note" and v.id == id) then return v end end end netstream.Hook("noteSendText", function(client, id, contents) if (string.len(contents) <= NOTELIMIT) then local note = FindNoteByID(id) if (note:canWrite(client) == false) then return client:notify("You do not own this note") end WRITINGDATA[id] = contents end end) function PLUGIN:EntityRemoved(entity) if (!nut.shuttingDown and entity and IsValid(entity) and entity:GetClass() == "nut_note" and entity.id) then if WRITINGDATA[entity.id] then WRITINGDATA[entity.id] = nil end end end function PLUGIN:OnNoteSpawned(note, item, load) note:SetModel(item.model) note:PhysicsInit(SOLID_VPHYSICS) note:SetMoveType(MOVETYPE_VPHYSICS) note:SetUseType(SIMPLE_USE) local physicsObject = note:GetPhysicsObject() if (IsValid(physicsObject)) then physicsObject:Wake() end if (item.player and IsValid(item.player)) then note:setNetVar("ownerChar", item.player:getChar().id) end if (load != true) then note.id = os.time() WRITINGDATA[note.id] = "" end end function PLUGIN:LoadData() local savedTable = self:getData() or {} local noteItem = nut.item.list["note"] WRITINGDATA = savedTable.noteData if (savedTable.noteEntities) then for k, v in ipairs(savedTable.noteEntities) do local note = ents.Create("nut_note") note:SetPos(v.pos) note:SetAngles(v.ang) note:Spawn() note:Activate() note:setNetVar("ownerChar", v.owner) note.id = v.id hook.Run("OnNoteSpawned", note, noteItem, true) end end end function PLUGIN:SaveData() local saveTable = {} local validNotes = {} saveTable.noteEntities = {} for _, v in ipairs(ents.GetAll()) do if (v:GetClass() == "nut_note") then table.insert(saveTable.noteEntities, {pos = v:GetPos(), ang = v:GetAngles(), id = v.id, owner = v:getOwner()}) table.insert(validNotes, v.id) end end local validNoteData = {} for _, v in ipairs(validNotes) do validNoteData[v] = WRITINGDATA[v] end saveTable.noteData = validNoteData self:setData(saveTable) end end
mit
dr01d3r/darkstar
scripts/zones/Port_Windurst/npcs/Kunchichi.lua
14
1465
----------------------------------- -- Area: Port Windurst -- NPC: Kunchichi -- Type: Standard NPC -- @pos -115.933 -4.25 109.533 240 ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatWindurst = player:getVar("WildcatWindurst"); if (player:getQuestStatus(WINDURST,LURE_OF_THE_WILDCAT_WINDURST) == QUEST_ACCEPTED and player:getMaskBit(WildcatWindurst,15) == false) then player:startEvent(0x026f); else player:startEvent(0x00e4); 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 == 0x026f) then player:setMaskBit(player:getVar("WildcatWindurst"),"WildcatWindurst",15,true); end end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Sauromugue_Champaign/npcs/qm1.lua
14
1514
----------------------------------- -- Area: Sauromugue Champaign -- NPC: qm1 (???) -- @pos 203.939 0.000 -238.811 120 -- Notes: Spawns Dribblix Greasemaw for ACP mission "Gatherer of Light (I)" ----------------------------------- package.loaded["scripts/zones/Sauromugue_Champaign/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Sauromugue_Champaign/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Gob = GetMobAction(17269114); if ( (Gob == ACTION_NONE or Gob == ACTION_SPAWN) and (player:hasKeyItem(CHUNK_OF_SMOKED_GOBLIN_GRUB) == true) and (player:hasKeyItem(SEEDSPALL_VIRIDIS) == false) and (player:hasKeyItem(VIRIDIAN_KEY) == false) ) then SpawnMob(17269114):updateClaim(player); else player:messageSpecial(NOTHING_HAPPENS); 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
Chessnut/hl2rp
schema/derma/cl_combine.lua
3
2082
local PANEL = {} function PANEL:Init() if (IsValid(nut.gui.combine)) then nut.gui.combine:saveData() nut.gui.combine:Remove() end nut.gui.combine = self self:SetSize(580, 360) self:SetPos(cookie.GetNumber("nutCombineX", ScrW() - self:GetWide()), cookie.GetNumber("nutCombineY", ScrH()*0.5 - self:GetTall()*0.5)) self:SetMouseInputEnabled(true) self:SetTitle("Combine Display Locator") self:MakePopup() self:SetScreenLock(true) self:ShowCloseButton(false) self:SetVisible(false) self:SetAlpha(math.max(cookie.GetNumber("nutCombineAlpha", 255) * 255), 1) self.mult = cookie.GetNumber("nutCombineMult", 0.5) self.alpha = self:Add("DAlphaBar") self.alpha:Dock(LEFT) self.alpha:SetValue(cookie.GetNumber("nutCombineAlpha", 1)) self.alpha.OnChange = function(this, value) self:SetAlpha(math.max(value * 255, 1)) end self.multiplier = self:Add("DAlphaBar") self.multiplier:Dock(RIGHT) self.multiplier:SetValue(self.mult) self.multiplier.OnChange = function(this, value) self.mult = value end self.clear = self:Add("DButton") self.clear:Dock(TOP) self.clear:SetText("Clear") self.clear.DoClick = function() SCHEMA.displays = {} end if (nut.plugin.list.scanner) then self.photos = self:Add("DButton") self.photos:Dock(TOP) self.photos:SetText("View Photos") self.photos.DoClick = function() RunConsoleCommand("nut_photocache") end end self.oldOnRelease = self.OnMouseReleased self.OnMouseReleased = function(this) self:oldOnRelease() self:saveData() end end function PANEL:PaintOver(w, h) surface.SetDrawColor(255, 255, 255, 25) surface.DrawLine(0, 24, w, h) surface.DrawLine(w, 24, 0, h) surface.DrawOutlinedRect(0, 24, w, h - 24) end function PANEL:saveData() cookie.Set("nutCombineX", self.x) cookie.Set("nutCombineY", self.y) cookie.Set("nutCombineAlpha", self:GetAlpha() / 255) cookie.Set("nutCombineMult", self.mult) end vgui.Register("nutCombineDisplay", PANEL, "DFrame") if (IsValid(nut.gui.combine)) then vgui.Create("nutCombineDisplay") end
mit
SalvationDevelopment/Salvation-Scripts-Production
c45898858.lua
3
1585
--ボンディング-H2O function c45898858.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c45898858.cost) e1:SetTarget(c45898858.target) e1:SetOperation(c45898858.activate) c:RegisterEffect(e1) end function c45898858.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsCode,2,nil,22587018) and Duel.CheckReleaseGroup(tp,Card.IsCode,1,nil,58071123) end local g1=Duel.SelectReleaseGroup(tp,Card.IsCode,2,2,nil,22587018) local g2=Duel.SelectReleaseGroup(tp,Card.IsCode,1,1,nil,58071123) g1:Merge(g2) Duel.Release(g1,REASON_COST) end function c45898858.filter(c,e,tp) return c:IsCode(85066822) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function c45898858.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and Duel.IsExistingMatchingCard(c45898858.filter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE) end function c45898858.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c45898858.filter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP) g:GetFirst():CompleteProcedure() end end
gpl-2.0
teleaqrab/MR
plugins/GoogleFA.lua
1
1115
local function googlethat(query) local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&" local parameters = "q=".. (URL.escape(query) or "") -- Do the request local res, code = https.request(api..parameters) if code ~=200 then return nil end local data = json:decode(res) local results = {} for key,result in ipairs(data.responseData.results) do table.insert(results, { result.titleNoFormatting, result.unescapedUrl or result.url }) end return results end local function stringlinks(results) local stringresults="نتایج جستجو شده در گوگل:\n______________________________\n" for key,val in ipairs(results) do stringresults=stringresults..val[1].." - "..val[2].."\n" end return stringresults end local function run(msg, matches) local results = googlethat(matches[1]) return stringlinks(results) end return { description = "Searche in Google", usage = "/src (item) : google search", patterns = { "^[*#]src (.*)$", "^%.[s|S]rc (.*)$" }, run = run }
agpl-3.0
dr01d3r/darkstar
scripts/globals/items/nopales_salad.lua
12
1358
----------------------------------------- -- ID: 5701 -- Item: nopales_salad -- Food Effect: 3Hrs, All Races ----------------------------------------- -- Strength 1 -- Agility 6 -- Ranged Accuracy +20 -- Ranged Attack +10 ----------------------------------------- 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,5701); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 1); target:addMod(MOD_AGI, 6); target:addMod(MOD_RACC, 20); target:addMod(MOD_RATT, 10); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 1); target:delMod(MOD_AGI, 6); target:delMod(MOD_RACC, 20); target:delMod(MOD_RATT, 10); end;
gpl-3.0
jinxiaoye1987/RyzomCore
ryzom/common/data_common/r2/r2_ui_lua_inspector.lua
3
7548
------------------------------------------------------------------------------------------------------------ -- Create interface for inspecting a lua table -- The resultat is displayedin a tree control in the UI -- Also support display of reflected objects (interface group & widgets etc.) -- TODO place this elsewhere because useful for other stuffs than r2 local maxEnumerationSize = 4000 -- if a enumeration id done for more than this elements, than -- this value, then a possible infinite loop may have happened so abort the inspection function inspect(object, maxdepth, alreadySeen) if (object ~= nil and object.isNil) then debugInfo("Inspecting nil object") object = nil end local container = getUI("ui:interface:lua_inspector") local treeCtrl = getUI("ui:interface:lua_inspector:content:sbtree:tree_list") local inspectedTableToTreeNode = {} -- for each table / user data, give a pointer to the tree node that is displayed if treeCtrl == nil or container == nil then debugWarning("Cannot find inspector ui") return end if alreadySeen == nil then alreadySeen = {} end if (maxdepth == nil) then maxdepth = 1 end -- color for each type local typeColor = { number = CRGBA(255, 255, 255, 255), string = CRGBA(0, 255, 255, 255), boolean = CRGBA(255, 255, 0, 255), thread = CRGBA(128, 128, 128, 255), table = CRGBA(255, 128, 32, 255), userdata = CRGBA(255, 128, 64, 255) } typeColor["function"] = CRGBA(255, 0, 255, 255) -- separate code here because typeColor["nil"] = CRGBA(255, 0, 0, 255) local id = 0 -- generate a new ID for a tree node local function newId() id = id + 1; return tostring(id) end -- return xml code for a leaf node local function node(content, color, opened) if opened == nil then opened = true end --debugInfo(colorTag(255, 255, 0) .. "node") if color == nil then color = CRGBA(127, 255, 127, 0) end local result = SNode() result.Id = newId() result.Text = content if type(color) ~= "userdata" then debugInfo(tostring(color)) end result.Color = color result.YDecal = -1 result.FontSize = 15 result.Opened = opened -- debugInfo(result) return result end local function objectStr(Name, value) --return tostring(Name).. " (" .. type(value) .. ")" .. " = " .. tostring(value) return tostring(Name) .. " = " .. tostring(value) end -- for each type, gives the code that generate the tree for the inspector local typeTable = { number = function(key, val) return node(objectStr(key, val), typeColor[type(val)]) end, string = function(key, val) return node(objectStr(key, val), typeColor[type(val)]) end, boolean = function(key, val) return node(objectStr(key, val), typeColor[type(val)]) end, thread = function(key, val) return node(objectStr(key, "thread"), typeColor[type(val)]) end, } -- 'function' is a declared keyword, so must declare it this way typeTable["function"] = function(key, val) local caption = "function (" .. debug.getinfo(val).short_src .. ", " .. tostring(debug.getinfo(val).linedefined) .. ")" return node(objectStr(key, caption), typeColor[type(val)]) end typeTable["nil"] = function(key, val) return node(objectStr(key, "nil"), typeColor[type(val)]) end -- recursive code to generate the code for a table typeTable.table = function(key, val, depth) local mt = getmetatable(val) if type(val) == "userdata" and (mt == nil or type(mt.__next) ~= "function") then -- this is a user data with no 'next' method, so can't enumerate return node(tostring(key) .. "(key type = " .. type(key) .. ")", typeColor[type(val)], false); end -- if type(val) == "userdata" then -- debugInfo(colorTag(255, 255, 0) .. "found user data with '__next' metamethod") -- end if (alreadySeen[val] == true) then -- avoid cyclic graph return node("!CYCLE!", CRGBA(0, 255, 0, 255)) end alreadySeen[val] = true -- create a temp table sorted by type local sortedTable = {} local index = 1 for k, v in specPairs(val) do sortedTable[index] = { key = k, value = v }; index = index + 1 if index - 1 > maxEnumerationSize then error(colorTag(255, 0, 0) .. "inspect : table enumeration is over " .. tostring(maxEnumerationSize) .. " elements, possible infinite loop, aborting.") end end local function comp(val1, val2) -- sort by type, then by key if not (type(val1.value) == type(val2.value)) then return type(val1.value) < type(val2.value) end return tostring(val1.key) < tostring(val2.key) end table.sort(sortedTable, comp) --debugInfo("VAL") --luaObject(val) --debugInfo("SORTED") --luaObject(sortedTable) local rootNode = node(tostring(key) .. "(key type = " .. type(key) .. ")", typeColor[type(val)], depth < maxdepth); inspectedTableToTreeNode[val] = rootNode local elemCount = 0 for key, value in specPairs(sortedTable) do if (typeTable[type(value.value)] == nil) then rootNode.addChild(node("?")) else -- add node for a field of the table rootNode:addChild(typeTable[type(value.value)](value.key, value.value, depth + 1)) end elemCount = elemCount + 1 if elemCount > maxEnumerationSize then error(colorTag(255, 0, 0) .. "inspect : table enumeration is over " .. tostring(maxEnumerationSize) .. " elements, possible infinite loop, aborting.") end end return rootNode end typeTable.userdata = typeTable.table -- generate the tree local rootNode = typeTable[type(object)]("#object#", object, 0) treeCtrl:setRootNode(rootNode) treeCtrl:forceRebuild() if container.active == false then container.active = true container:center() end setOnDraw(container, "onLuaInspectorDraw()") -- store the inspected object in the container lua environment for further refresh container.Env.InspectedObject = object container.Env.InspectedTableToTreeNode = inspectedTableToTreeNode container.Env.AutoRefreshWidget = container:find("auto_refresh_button") if container.Env.AutoRefreshWidget == nil then debugInfo("lua inspector : Can't find auto_refresh button") end end ------------------------------------------------------------------------------------------------------------ function refreshLuaInspector() local container = getUI("ui:interface:lua_inspector") if container == nil then debugWarning("Cannot find inspector ui") return end local inspectedObject = container.Env.InspectedObject if inspectedObject ~= nil then -- memorize open / close state of each node local openTreeNode = {} -- special cases for objects with an instance id -- for k, v in pairs(container.Env.InspectedTableToTreeNode) do if not v.isNil then -- if tree node has not been deleted ... openTreeNode[k] = v.Opened end end inspect(inspectedObject) -- restore the open state for each node for k, v in pairs(openTreeNode) do local newTreeNode = container.Env.InspectedTableToTreeNode[k] if newTreeNode ~= nil and not newTreeNode.isNil then newTreeNode.Opened = v end end end end ------------------------------------------------------------------------------------------------------------ function onLuaInspectorDraw() local container = getUI("ui:interface:lua_inspector") if container == nil then return end if not container.active then return end local autoRefreshWidget = container.Env.AutoRefreshWidget if autoRefreshWidget == nil then return end if autoRefreshWidget.pushed == true then refreshLuaInspector() end end
agpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c60577362.lua
5
1126
--威圧する魔眼 function c60577362.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c60577362.target) e1:SetOperation(c60577362.activate) c:RegisterEffect(e1) end function c60577362.filter(c) return c:IsFaceup() and c:IsAttackBelow(2000) and c:IsRace(RACE_ZOMBIE) end function c60577362.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c60577362.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c60577362.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c60577362.filter,tp,LOCATION_MZONE,0,1,1,nil) end function c60577362.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end
gpl-2.0
dr01d3r/darkstar
scripts/globals/weaponskills/hot_shot.lua
15
1367
----------------------------------- -- Hot Shot -- Marksmanship weapon skill -- Skill Level: 5 -- Deals fire elemental damage to enemy. -- Aligned with the Flame Gorget & Light Gorget. -- Aligned with the Flame Belt & Light Belt. -- Element: Fire -- Modifiers: AGI:30% -- 100%TP 200%TP 300%TP -- 0.50 0.75 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 = 1; params.ftp100 = 0.5; params.ftp200 = 0.75; params.ftp300 = 1; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.3; 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.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp200 = 1.55; params.ftp300 = 2.1; params.agi_wsc = 0.7; end local damage, criticalHit, tpHits, extraHits = doRangedWeaponskill(player, target, wsID, params, tp, primary); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c50893987.lua
5
1741
--剣闘獣ティゲル function c50893987.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(50893987,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c50893987.sccon) e1:SetCost(c50893987.sccost) e1:SetTarget(c50893987.sctg) e1:SetOperation(c50893987.scop) c:RegisterEffect(e1) --fusion limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetValue(1) c:RegisterEffect(e2) end function c50893987.sccon(e,tp,eg,ep,ev,re,r,rp) local st=e:GetHandler():GetSummonType() return st>=(SUMMON_TYPE_SPECIAL+100) and st<(SUMMON_TYPE_SPECIAL+150) end function c50893987.costfilter(c) return c:IsSetCard(0x19) and c:IsDiscardable() end function c50893987.sccost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c50893987.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,c50893987.costfilter,1,1,REASON_DISCARD+REASON_COST,nil) end function c50893987.scfilter(c) return c:IsSetCard(0x19) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c50893987.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c50893987.scfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c50893987.scop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c50893987.scfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
gpl-2.0
dvdvideo1234/ZeroBraineProjects
MontyHall/main.lua
1
1728
local dir = require("directories") dir.addPath("myprograms", "ZeroBraineProjects", "CorporateProjects", -- When not located in general directory search in projects "ZeroBraineProjects/dvdlualib", "ZeroBraineProjects/ExtractWireWiki") dir.addBase("D:/LuaIDE") dir.addBase("C:/Programs/ZeroBraineIDE").setBase(1) io.stdout:setvbuf('no') local common = require("common") local tData = { {Item = "goat", Open = false}, {Item = "goat", Open = false}, {Item = "goat", Open = false} }; tData.Size = #tData tData[common.randomGetNumber(tData.Size)].Item = "car" print("Pick a door!") local iPick = io.read("*n") if(tData[iPick]) then print("You picked door "..iPick.."!") else while(not tData[iPick]) do print("There is no such door!") iPick = io.read("*n") end end local iShow = common.randomGetNumber(tData.Size) while(tData[iShow].Item == "car") do iShow = common.randomGetNumber(tData.Size) end tData[iShow].Open = true print("Goat behind door "..iShow.."!") print("Do you want to switch (Y/N)?"); io.read("*l") local sSwap = io.read("*l") sSwap = tostring(sSwap or "Y"):sub(1,1):upper() if(sSwap ~= "Y" and sSwap ~= "N") then while(sSwap ~= "Y" and sSwap ~= "N") do print("Wrong answer ["..sSwap.."] try again!") sSwap = tostring(io.read("*l") or "Y"):sub(1,1):upper() end end if(sSwap == "Y") then for iD = 1, tData.Size do if(not tData[iD].Open and iD ~= iPick) then print("You 1 have won a ["..tData[iD].Item.."]!") end end else print("You 2 have won a ["..tData[iPick].Item.."]!") end
apache-2.0
SalvationDevelopment/Salvation-Scripts-Production
c69954399.lua
4
3529
--疫病ウィルス ブラックダスト function c69954399.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c69954399.target) e1:SetOperation(c69954399.operation) c:RegisterEffect(e1) --Cannot attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e2) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(1) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetCountLimit(1) e4:SetRange(LOCATION_SZONE) e4:SetCondition(c69954399.turncon) e4:SetOperation(c69954399.turnop) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(69954399,0)) e5:SetCategory(CATEGORY_DESTROY) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetCode(EVENT_PHASE+PHASE_END) e5:SetCountLimit(1) e5:SetRange(LOCATION_SZONE) e5:SetCondition(c69954399.descon) e5:SetTarget(c69954399.destg) e5:SetOperation(c69954399.desop) c:RegisterEffect(e5) --tohand local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(69954399,1)) e6:SetCategory(CATEGORY_TOHAND) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e6:SetCode(EVENT_CUSTOM+69954400) e6:SetTarget(c69954399.rettg) e6:SetOperation(c69954399.retop) c:RegisterEffect(e6) end function c69954399.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c69954399.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,e:GetHandler(),tc) e:GetHandler():SetTurnCounter(0) end end function c69954399.turncon(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetEquipTarget() return ec:GetControler()==Duel.GetTurnPlayer() end function c69954399.turnop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() c:SetTurnCounter(ct+1) end function c69954399.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetTurnCounter()==2 end function c69954399.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local ec=e:GetHandler():GetEquipTarget() ec:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_DESTROY,ec,1,0,0) end function c69954399.desop(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetEquipTarget() if ec and ec:IsRelateToEffect(e) and Duel.Destroy(ec,REASON_EFFECT)~=0 then Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+69954400,e,0,0,0,0) end end function c69954399.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function c69954399.retop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,e:GetHandler()) end end
gpl-2.0
dr01d3r/darkstar
scripts/globals/items/bunny_ball.lua
12
1724
----------------------------------------- -- ID: 4349 -- Item: Bunny Ball -- Food Effect: 240Min, All Races ----------------------------------------- -- Health 10 -- Strength 2 -- Vitality 2 -- Intelligence -1 -- Attack % 30 (cap 30) -- Ranged ATT % 30 (cap 30) ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,4349); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_STR, 2); target:addMod(MOD_VIT, 2); target:addMod(MOD_INT, -1); target:addMod(MOD_FOOD_ATTP, 30); target:addMod(MOD_FOOD_ATT_CAP, 30); target:addMod(MOD_FOOD_RATTP, 30); target:addMod(MOD_FOOD_RATT_CAP, 30); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_STR, 2); target:delMod(MOD_VIT, 2); target:delMod(MOD_INT, -1); target:delMod(MOD_FOOD_ATTP, 30); target:delMod(MOD_FOOD_ATT_CAP, 30); target:delMod(MOD_FOOD_RATTP, 30); target:delMod(MOD_FOOD_RATT_CAP, 30); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c47594192.lua
2
1357
--スリーカード function c47594192.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1e0) e1:SetCondition(c47594192.condition) e1:SetTarget(c47594192.target) e1:SetOperation(c47594192.activate) c:RegisterEffect(e1) end function c47594192.cfilter(c,tp) return c:IsFaceup() and not c:IsType(TYPE_TOKEN) and Duel.IsExistingMatchingCard(c47594192.cfilter2,tp,LOCATION_MZONE,0,2,c,c:GetCode()) end function c47594192.cfilter2(c,code) return c:IsFaceup() and c:IsCode(code) end function c47594192.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c47594192.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end function c47594192.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,3,0,0) end function c47594192.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) Duel.Destroy(g,REASON_EFFECT) end
gpl-2.0
thegrb93/wire
lua/wire/stools/hologrid.lua
8
2091
WireToolSetup.setCategory( "Visuals/Holographic" ) WireToolSetup.open( "hologrid", "HoloGrid", "gmod_wire_hologrid", nil, "HoloGrids" ) if CLIENT then language.Add( "tool.wire_hologrid.name", "Holographic Grid Tool (Wire)" ) language.Add( "tool.wire_hologrid.desc", "The grid to aid in holographic projections" ) TOOL.Information = { { name = "left_0", stage = 0, text = "Create grid" }, { name = "right_0", stage = 0, text = "Link HoloGrid with HoloEmitter or reference entity" }, { name = "reload_0", stage = 0, text = "Unlink HoloEmitter or HoloGrid" }, { name = "right_1", stage = 1, text = "Select the HoloGrid to link to" }, } language.Add( "Tool_wire_hologrid_usegps", "Use GPS coordinates" ) end WireToolSetup.BaseLang() WireToolSetup.SetupMax( 20 ) if SERVER then function TOOL:GetConVars() return self:GetClientNumber( "usegps" )~=0 end -- Uses default WireToolObj:MakeEnt's WireLib.MakeWireEnt function end TOOL.ClientConVar = { model = "models/jaanus/wiretool/wiretool_siren.mdl", usegps = 0, } function TOOL:RightClick( trace ) if CLIENT then return true end local ent = trace.Entity if (self:GetStage() == 0) then if (ent:GetClass() == "gmod_wire_holoemitter") then self.Target = ent self:SetStage(1) else self:GetOwner():ChatPrint("That's not a holoemitter.") return false end else if (self.Target == ent or ent:IsWorld()) then self:GetOwner():ChatPrint("Holoemitter unlinked.") self.Target:UnLink() self:SetStage(0) return true end self.Target:Link( ent ) self:SetStage(0) self:GetOwner():ChatPrint( "Holoemitter linked to entity (".. tostring(ent)..")" ) end return true end function TOOL.Reload(trace) self.Linked = nil self:SetStage(0) if IsValid(trace.Entity) and trace.Entity:GetClass() == "gmod_wire_hologrid" then self.Linked:TriggerInput("Reference", nil) return true end end function TOOL.BuildCPanel( panel ) WireDermaExts.ModelSelect(panel, "wire_hologrid_model", list.Get( "Wire_Misc_Tools_Models" ), 1) panel:CheckBox("#Tool_wire_hologrid_usegps", "wire_hologrid_usegps") end
apache-2.0
chaot4/ardour
share/scripts/_route_template_generic_midi.lua
2
2641
ardour { ["type"] = "EditorAction", name = "Generic MIDI Track", description = [[Example]] } -- If a route_setup function is present in an Editor Action Script -- the script is also listed in the "add track/bus" dialog as meta-template -- -- The function is expected to return a Lua table. The table may be empty. function route_setup () return { -- keys control which AddRouteDialog controls are made sensitive. -- The following keys accept a default value to pre-seed the dialog. ['how_many'] = 1, ['name'] = 'MIDI', ['channels'] = nil, ['track_mode'] = nil, ['strict_io'] = true, -- these keys just need to be set (to something other than nil) -- in order to set the control sensitives ['insert_at'] = ARDOUR.PresentationInfo.max_order, ['group'] = false, -- return value will be a RouteGroup* ['instrument'] = true, -- return value will be a PluginInfoPtr } end -- The Script can be used as EditorAction in which case it can -- optionally provide instantiation parmaters function action_params () return { ['how_many'] = { title = "How Many tracks to add", default = "1" }, ["name"] = { title = "Track Name Prefix", default = "MIDI" }, ["instrument"] = { title = "Add Instrument", default = "true" }, } end function factory (params) return function () -- When called from the AddRouteDialog, 'params' will be a table with -- keys as described in route_setup() above. local p = params or route_setup () local name = p["name"] or 'Audio' local how_many = p["how_many"] or 1 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order; local group = p["group"] or nil local strict_io = p["strict_io"] or false local instrument = p["instrument"] or nil -- used in 'action-script mode' if instrument == "true" then instrument = ARDOUR.LuaAPI.new_plugin_info ("http://gareus.org/oss/lv2/gmsynth", ARDOUR.PluginType.LV2) -- general midi synth if instrument:isnil () then instrument = ARDOUR.LuaAPI.new_plugin_info ("https://community.ardour.org/node/7596", ARDOUR.PluginType.LV2) -- reasonable synth end if instrument:isnil () then LuaDialog.Message ("MIDI track add", "Cannot find instrument plugin", LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run () return end end -- add no instrument if type (instrument) ~= "userdata" then instrument = ARDOUR.PluginInfo () end Session:new_midi_track( ARDOUR.ChanCount(ARDOUR.DataType ("midi"), 1), ARDOUR.ChanCount(ARDOUR.DataType ("audio"), 2), strict_io, instrument, nil, group, how_many, name, insert_at, ARDOUR.TrackMode.Normal) end end
gpl-2.0
joev/SVUI-Temp
SVUI_!Core/system/_docklets/breakstuff.lua
1
39885
--[[ ########################################################## S V U I By: Munglunch ########################################################## LOCALIZED LUA FUNCTIONS ########################################################## ]]-- --[[ GLOBALS ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local pairs = _G.pairs; local ipairs = _G.ipairs; local print = _G.print; local table = _G.table; local match = string.match; --[[ TABLE METHODS ]]-- local tremove, tcopy, twipe, tsort, tcat = table.remove, table.copy, table.wipe, table.sort, table.concat; --BLIZZARD API local CreateFrame = _G.CreateFrame; local InCombatLockdown = _G.InCombatLockdown; local GameTooltip = _G.GameTooltip; local ReloadUI = _G.ReloadUI; local hooksecurefunc = _G.hooksecurefunc; local GetItemInfo = _G.GetItemInfo; local GetItemCount = _G.GetItemCount; local GetSpellInfo = _G.GetSpellInfo; local IsSpellKnown = _G.IsSpellKnown; local IsEquippableItem = _G.IsEquippableItem; local GetSpellBookItemInfo = _G.GetSpellBookItemInfo; local ERR_NOT_IN_COMBAT = _G.ERR_NOT_IN_COMBAT; local ITEM_MILLABLE = _G.ITEM_MILLABLE; local ITEM_PROSPECTABLE = _G.ITEM_PROSPECTABLE; local GetMouseFocus = _G.GetMouseFocus; local GetContainerItemLink = _G.GetContainerItemLink; local AutoCastShine_AutoCastStart = _G.AutoCastShine_AutoCastStart; local AutoCastShine_AutoCastStop = _G.AutoCastShine_AutoCastStop; --[[ ########################################################## GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) local L = SV.L; local MOD = SV.Dock; --[[ ########################################################## LOCAL VARS ########################################################## ]]-- local BreakStuff_Cache = {} local DE, PICK, SMITH, BreakStuffParser; local BreakStuffButton = CreateFrame("Button", "BreakStuffButton", UIParent); BreakStuffButton.icon = BreakStuffButton:CreateTexture(nil,"OVERLAY") BreakStuffButton.icon:InsetPoints(BreakStuffButton,2,2) BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) BreakStuffButton.ttText = "BreakStuff : OFF"; BreakStuffButton.subText = ""; local BreakStuffHandler = CreateFrame('Button', "BreakStuffHandler", UIParent, 'SecureActionButtonTemplate, AutoCastShineTemplate') BreakStuffHandler:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end) BreakStuffHandler:SetPoint("LEFT",UIParent,"RIGHT",500) BreakStuffHandler.TipLines = {} BreakStuffHandler.TTextLeft = "" BreakStuffHandler.TTextRight = "" BreakStuffHandler.ReadyToSmash = false; --[[ ########################################################## ITEM PARSING ########################################################## ]]-- do local SkellyKeys = { [GetSpellInfo(130100)] = true, -- Ghostly Skeleton Key [GetSpellInfo(94574)] = true, -- Obsidium Skeleton Key [GetSpellInfo(59403)] = true, -- Titanium Skeleton Key [GetSpellInfo(59404)] = true, -- Colbat Skeleton Key [GetSpellInfo(20709)] = true, -- Arcanite Skeleton Key [GetSpellInfo(19651)] = true, -- Truesilver Skeleton Key [GetSpellInfo(19649)] = true, -- Golden Skeleton Key [GetSpellInfo(19646)] = true, -- Silver Skeleton Key } local BreakableFilter = { ["Pickables"]={['68729']=true,['63349']=true,['45986']=true,['43624']=true,['43622']=true,['43575']=true,['31952']=true,['12033']=true,['29569']=true,['5760']=true,['13918']=true,['5759']=true,['16885']=true,['5758']=true,['13875']=true,['4638']=true,['16884']=true,['4637']=true,['4636']=true,['6355']=true,['16883']=true,['4634']=true,['4633']=true,['6354']=true,['16882']=true,['4632']=true,['88165']=true,['88567']=true},["SafeItems"]={['89392']=true,['89393']=true,['89394']=true,['89395']=true,['89396']=true,['89397']=true,['89398']=true,['89399']=true,['89400']=true,['83260']=true,['83261']=true,['83262']=true,['83263']=true,['83264']=true,['83265']=true,['83266']=true,['83267']=true,['83268']=true,['83269']=true,['83270']=true,['83271']=true,['83274']=true,['83275']=true,['82706']=true,['82707']=true,['82708']=true,['82709']=true,['82710']=true,['82711']=true,['82712']=true,['82713']=true,['82714']=true,['82715']=true,['82716']=true,['82717']=true,['82720']=true,['82721']=true,['81671']=true,['81672']=true,['81673']=true,['81674']=true,['81675']=true,['81676']=true,['81677']=true,['81678']=true,['81679']=true,['81680']=true,['81681']=true,['81682']=true,['81685']=true,['81686']=true,['64377']=true,['64489']=true,['64880']=true,['64885']=true,['62454']=true,['62455']=true,['62456']=true,['62457']=true,['62458']=true,['62459']=true,['62460']=true,['68740']=true,['49888']=true,['49497']=true,['49301']=true,['72980']=true,['72981']=true,['72989']=true,['72990']=true,['72991']=true,['72992']=true,['72993']=true,['72994']=true,['72995']=true,['72996']=true,['72997']=true,['72998']=true,['72999']=true,['73000']=true,['73001']=true,['73002']=true,['73003']=true,['73006']=true,['73007']=true,['73008']=true,['73009']=true,['73010']=true,['73011']=true,['73012']=true,['73325']=true,['73326']=true,['73336']=true,['88622']=true,['88648']=true,['88649']=true,['64460']=true,['44050']=true,['44173']=true,['44174']=true,['44192']=true,['44193']=true,['44199']=true,['44244']=true,['44245']=true,['44249']=true,['44250']=true,['44051']=true,['44052']=true,['44053']=true,['44108']=true,['44166']=true,['44187']=true,['44214']=true,['44241']=true,['38454']=true,['38455']=true,['38456']=true,['38457']=true,['38460']=true,['38461']=true,['38464']=true,['38465']=true,['29115']=true,['29130']=true,['29133']=true,['29137']=true,['29138']=true,['29166']=true,['29167']=true,['29185']=true,['34665']=true,['34666']=true,['34667']=true,['34670']=true,['34671']=true,['34672']=true,['34673']=true,['34674']=true,['29121']=true,['29124']=true,['29125']=true,['29151']=true,['29152']=true,['29153']=true,['29155']=true,['29156']=true,['29165']=true,['29171']=true,['29175']=true,['29182']=true,['30830']=true,['30832']=true,['29456']=true,['29457']=true,['25835']=true,['25836']=true,['25823']=true,['25825']=true,['77559']=true,['77570']=true,['77583']=true,['77586']=true,['77587']=true,['77588']=true,['21392']=true,['21395']=true,['21398']=true,['21401']=true,['21404']=true,['21407']=true,['21410']=true,['21413']=true,['21416']=true,['38632']=true,['38633']=true,['38707']=true,['34661']=true,['11290']=true,['11289']=true,['45858']=true,['84661']=true,['11288']=true,['28164']=true,['11287']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44104']=true,['44116']=true,['44196']=true,['44061']=true,['44062']=true,['29117']=true,['29129']=true,['29174']=true,['30836']=true,['35328']=true,['35329']=true,['35330']=true,['35331']=true,['35332']=true,['35333']=true,['35334']=true,['35335']=true,['35336']=true,['35337']=true,['35338']=true,['35339']=true,['35340']=true,['35341']=true,['35342']=true,['35343']=true,['35344']=true,['35345']=true,['35346']=true,['35347']=true,['35464']=true,['35465']=true,['35466']=true,['35467']=true,['30847']=true,['29122']=true,['29183']=true,['90079']=true,['90080']=true,['90081']=true,['90082']=true,['90083']=true,['90084']=true,['90085']=true,['90086']=true,['90110']=true,['90111']=true,['90112']=true,['90113']=true,['90114']=true,['90115']=true,['90116']=true,['90117']=true,['90136']=true,['90137']=true,['90138']=true,['90139']=true,['90140']=true,['90141']=true,['90142']=true,['90143']=true,['64643']=true,['77678']=true,['77679']=true,['77682']=true,['77692']=true,['77694']=true,['77695']=true,['77709']=true,['77710']=true,['77712']=true,['77886']=true,['77889']=true,['77890']=true,['77899']=true,['77900']=true,['77901']=true,['77917']=true,['77919']=true,['77920']=true,['77680']=true,['77681']=true,['77683']=true,['77690']=true,['77691']=true,['77693']=true,['77708']=true,['77711']=true,['77713']=true,['77887']=true,['77888']=true,['77891']=true,['77898']=true,['77902']=true,['77903']=true,['77916']=true,['77918']=true,['77921']=true,['77778']=true,['77779']=true,['77784']=true,['77795']=true,['77796']=true,['77800']=true,['77801']=true,['77844']=true,['77845']=true,['77846']=true,['77850']=true,['77777']=true,['77781']=true,['77782']=true,['77785']=true,['77797']=true,['77798']=true,['77799']=true,['77802']=true,['77847']=true,['77848']=true,['77851']=true,['77852']=true,['77724']=true,['77725']=true,['77728']=true,['77729']=true,['77732']=true,['77733']=true,['77773']=true,['77783']=true,['77803']=true,['77804']=true,['77843']=true,['77849']=true,['77614']=true,['77615']=true,['77616']=true,['77617']=true,['77618']=true,['77619']=true,['77620']=true,['77627']=true,['77628']=true,['77629']=true,['77630']=true,['77631']=true,['77632']=true,['77647']=true,['77648']=true,['77649']=true,['77650']=true,['77651']=true,['77652']=true,['77770']=true,['77771']=true,['77772']=true,['77774']=true,['77775']=true,['77776']=true,['77786']=true,['77789']=true,['77790']=true,['77791']=true,['77792']=true,['77793']=true,['77794']=true,['77837']=true,['77838']=true,['77839']=true,['77840']=true,['77841']=true,['77842']=true,['20406']=true,['20407']=true,['20408']=true,['77787']=true,['77788']=true,['28155']=true,['22986']=true,['22991']=true,['33292']=true,['86566']=true,['95517']=true,['95518']=true,['95523']=true,['95526']=true,['95527']=true,['95532']=true,['83158']=true,['83162']=true,['83167']=true,['83171']=true,['83176']=true,['83180']=true,['83185']=true,['83189']=true,['83194']=true,['83198']=true,['83203']=true,['83207']=true,['83212']=true,['83216']=true,['83221']=true,['83225']=true,['82614']=true,['82618']=true,['82623']=true,['82627']=true,['82632']=true,['82636']=true,['82641']=true,['82645']=true,['82650']=true,['82654']=true,['82659']=true,['82663']=true,['82668']=true,['82672']=true,['82677']=true,['82681']=true,['81579']=true,['81583']=true,['81588']=true,['81592']=true,['81597']=true,['81601']=true,['81606']=true,['81610']=true,['81615']=true,['81619']=true,['81624']=true,['81628']=true,['81633']=true,['81637']=true,['81642']=true,['81646']=true,['70118']=true,['62364']=true,['62386']=true,['62450']=true,['62441']=true,['62356']=true,['62406']=true,['62424']=true,['72621']=true,['72622']=true,['72623']=true,['72624']=true,['72625']=true,['72626']=true,['72627']=true,['72628']=true,['72638']=true,['72639']=true,['72640']=true,['72641']=true,['72642']=true,['72643']=true,['72644']=true,['72645']=true,['72646']=true,['72647']=true,['72648']=true,['72649']=true,['72650']=true,['72651']=true,['72652']=true,['72653']=true,['72655']=true,['72656']=true,['72657']=true,['72658']=true,['72659']=true,['72660']=true,['72661']=true,['72662']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44106']=true,['44170']=true,['44190']=true,['44117']=true,['44054']=true,['44055']=true,['29116']=true,['29131']=true,['29141']=true,['29142']=true,['29147']=true,['29148']=true,['35356']=true,['35357']=true,['35358']=true,['35359']=true,['35360']=true,['35361']=true,['35362']=true,['35363']=true,['35364']=true,['35365']=true,['35366']=true,['35367']=true,['35368']=true,['35369']=true,['35370']=true,['35371']=true,['35372']=true,['35373']=true,['35374']=true,['35375']=true,['35468']=true,['35469']=true,['35470']=true,['35471']=true,['25838']=true,['90059']=true,['90060']=true,['90061']=true,['90062']=true,['90063']=true,['90064']=true,['90065']=true,['90066']=true,['90088']=true,['90089']=true,['90090']=true,['90091']=true,['90092']=true,['90093']=true,['90094']=true,['90095']=true,['90119']=true,['90120']=true,['90121']=true,['90122']=true,['90123']=true,['90124']=true,['90125']=true,['90126']=true,['77667']=true,['77670']=true,['77671']=true,['77697']=true,['77700']=true,['77701']=true,['77874']=true,['77876']=true,['77878']=true,['77907']=true,['77908']=true,['77909']=true,['77666']=true,['77668']=true,['77669']=true,['77696']=true,['77698']=true,['77699']=true,['77875']=true,['77877']=true,['77879']=true,['77904']=true,['77905']=true,['77906']=true,['77742']=true,['77746']=true,['77748']=true,['77752']=true,['77813']=true,['77815']=true,['77819']=true,['77820']=true,['77744']=true,['77745']=true,['77749']=true,['77811']=true,['77812']=true,['77818']=true,['77821']=true,['77720']=true,['77721']=true,['77730']=true,['77731']=true,['77747']=true,['77750']=true,['77816']=true,['77817']=true,['77598']=true,['77599']=true,['77600']=true,['77601']=true,['77602']=true,['77603']=true,['77604']=true,['77633']=true,['77634']=true,['77635']=true,['77636']=true,['77637']=true,['77638']=true,['77639']=true,['77736']=true,['77737']=true,['77738']=true,['77739']=true,['77740']=true,['77741']=true,['77743']=true,['77805']=true,['77806']=true,['77807']=true,['77808']=true,['77809']=true,['77810']=true,['77814']=true,['77605']=true,['77640']=true,['77753']=true,['77822']=true,['28158']=true,['22987']=true,['22992']=true,['95519']=true,['95521']=true,['95528']=true,['95530']=true,['83159']=true,['83163']=true,['83168']=true,['83172']=true,['83177']=true,['83181']=true,['83186']=true,['83190']=true,['83195']=true,['83199']=true,['83204']=true,['83208']=true,['83213']=true,['83217']=true,['83222']=true,['83226']=true,['82615']=true,['82619']=true,['82624']=true,['82628']=true,['82633']=true,['82637']=true,['82642']=true,['82646']=true,['82651']=true,['82655']=true,['82660']=true,['82664']=true,['82669']=true,['82673']=true,['82678']=true,['82682']=true,['81580']=true,['81584']=true,['81589']=true,['81593']=true,['81598']=true,['81602']=true,['81607']=true,['81611']=true,['81616']=true,['81620']=true,['81625']=true,['81629']=true,['81634']=true,['81638']=true,['81643']=true,['81647']=true,['70114']=true,['70122']=true,['62417']=true,['62420']=true,['62431']=true,['62433']=true,['62358']=true,['62381']=true,['62446']=true,['62374']=true,['62404']=true,['62405']=true,['62425']=true,['62426']=true,['72664']=true,['72665']=true,['72666']=true,['72667']=true,['72668']=true,['72669']=true,['72670']=true,['72671']=true,['72672']=true,['72673']=true,['72674']=true,['72675']=true,['72676']=true,['72677']=true,['72678']=true,['72679']=true,['72681']=true,['72682']=true,['72683']=true,['72684']=true,['72685']=true,['72686']=true,['72687']=true,['72688']=true,['72689']=true,['72690']=true,['72691']=true,['72692']=true,['72693']=true,['72694']=true,['72695']=true,['72696']=true,['88614']=true,['88615']=true,['88616']=true,['88617']=true,['88618']=true,['88619']=true,['88620']=true,['88621']=true,['88623']=true,['88624']=true,['88625']=true,['88626']=true,['88627']=true,['88628']=true,['88629']=true,['88630']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44109']=true,['44110']=true,['44122']=true,['44171']=true,['44189']=true,['44059']=true,['44060']=true,['29135']=true,['29136']=true,['29180']=true,['30835']=true,['35376']=true,['35377']=true,['35378']=true,['35379']=true,['35380']=true,['35381']=true,['35382']=true,['35383']=true,['35384']=true,['35385']=true,['35386']=true,['35387']=true,['35388']=true,['35389']=true,['35390']=true,['35391']=true,['35392']=true,['35393']=true,['35394']=true,['35395']=true,['35472']=true,['35473']=true,['35474']=true,['35475']=true,['64644']=true,['90068']=true,['90069']=true,['90070']=true,['90071']=true,['90072']=true,['90073']=true,['90074']=true,['90075']=true,['90127']=true,['90128']=true,['90129']=true,['90130']=true,['90131']=true,['90132']=true,['90133']=true,['90134']=true,['77673']=true,['77674']=true,['77676']=true,['77704']=true,['77705']=true,['77707']=true,['77880']=true,['77882']=true,['77883']=true,['77910']=true,['77913']=true,['77914']=true,['77672']=true,['77675']=true,['77677']=true,['77702']=true,['77703']=true,['77706']=true,['77881']=true,['77884']=true,['77885']=true,['77911']=true,['77912']=true,['77915']=true,['77642']=true,['77645']=true,['77762']=true,['77763']=true,['77765']=true,['77766']=true,['77831']=true,['77832']=true,['77641']=true,['77643']=true,['77760']=true,['77761']=true,['77768']=true,['77769']=true,['77829']=true,['77834']=true,['77644']=true,['77646']=true,['77722']=true,['77723']=true,['77764']=true,['77767']=true,['77830']=true,['77833']=true,['77606']=true,['77607']=true,['77608']=true,['77609']=true,['77610']=true,['77611']=true,['77612']=true,['77754']=true,['77755']=true,['77756']=true,['77757']=true,['77758']=true,['77759']=true,['77823']=true,['77824']=true,['77825']=true,['77826']=true,['77827']=true,['77828']=true,['77835']=true,['28162']=true,['22985']=true,['22993']=true,['95522']=true,['95525']=true,['95531']=true,['95534']=true,['83160']=true,['83164']=true,['83169']=true,['83173']=true,['83178']=true,['83182']=true,['83187']=true,['83191']=true,['83196']=true,['83200']=true,['83205']=true,['83209']=true,['83214']=true,['83218']=true,['83223']=true,['83227']=true,['82616']=true,['82620']=true,['82625']=true,['82629']=true,['82634']=true,['82638']=true,['82643']=true,['82647']=true,['82652']=true,['82656']=true,['82661']=true,['82665']=true,['82670']=true,['82674']=true,['82679']=true,['82683']=true,['81581']=true,['81585']=true,['81590']=true,['81594']=true,['81599']=true,['81603']=true,['81608']=true,['81612']=true,['81617']=true,['81621']=true,['81626']=true,['81630']=true,['81635']=true,['81639']=true,['81644']=true,['81648']=true,['70115']=true,['70123']=true,['62363']=true,['62385']=true,['62380']=true,['62409']=true,['62429']=true,['62445']=true,['62353']=true,['62407']=true,['62423']=true,['62439']=true,['72698']=true,['72699']=true,['72700']=true,['72701']=true,['72702']=true,['72703']=true,['72704']=true,['72705']=true,['72889']=true,['72890']=true,['72891']=true,['72892']=true,['72893']=true,['72894']=true,['72895']=true,['72896']=true,['72902']=true,['72903']=true,['72904']=true,['72905']=true,['72906']=true,['72907']=true,['72908']=true,['72909']=true,['72910']=true,['72911']=true,['72912']=true,['72913']=true,['72914']=true,['72915']=true,['72916']=true,['72917']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['44111']=true,['44112']=true,['44120']=true,['44121']=true,['44123']=true,['44197']=true,['44239']=true,['44240']=true,['44243']=true,['44057']=true,['44058']=true,['40440']=true,['40441']=true,['40442']=true,['40443']=true,['40444']=true,['29127']=true,['29134']=true,['29184']=true,['35402']=true,['35403']=true,['35404']=true,['35405']=true,['35406']=true,['35407']=true,['35408']=true,['35409']=true,['35410']=true,['35411']=true,['35412']=true,['35413']=true,['35414']=true,['35415']=true,['35416']=true,['35476']=true,['35477']=true,['35478']=true,['90049']=true,['90050']=true,['90051']=true,['90052']=true,['90053']=true,['90054']=true,['90055']=true,['90056']=true,['90096']=true,['90097']=true,['90098']=true,['90099']=true,['90100']=true,['90101']=true,['90102']=true,['90103']=true,['90147']=true,['90148']=true,['90149']=true,['90150']=true,['90151']=true,['90152']=true,['90153']=true,['90154']=true,['77687']=true,['77688']=true,['77689']=true,['77714']=true,['77715']=true,['77718']=true,['77892']=true,['77894']=true,['77897']=true,['77923']=true,['77924']=true,['77927']=true,['77684']=true,['77685']=true,['77686']=true,['77716']=true,['77717']=true,['77719']=true,['77893']=true,['77895']=true,['77896']=true,['77922']=true,['77925']=true,['77926']=true,['77664']=true,['77665']=true,['77859']=true,['77867']=true,['77868']=true,['77869']=true,['77871']=true,['77872']=true,['38661']=true,['38663']=true,['38665']=true,['38666']=true,['38667']=true,['38668']=true,['38669']=true,['38670']=true,['77661']=true,['77662']=true,['77663']=true,['77858']=true,['77864']=true,['77865']=true,['77866']=true,['77873']=true,['77726']=true,['77727']=true,['77734']=true,['77735']=true,['77862']=true,['77863']=true,['77928']=true,['77929']=true,['77621']=true,['77622']=true,['77623']=true,['77624']=true,['77625']=true,['77626']=true,['77653']=true,['77654']=true,['77655']=true,['77656']=true,['77657']=true,['77658']=true,['77659']=true,['77853']=true,['77854']=true,['77855']=true,['77856']=true,['77857']=true,['77860']=true,['77861']=true,['34648']=true,['34649']=true,['34650']=true,['34651']=true,['34652']=true,['34653']=true,['34655']=true,['34656']=true,['77660']=true,['95520']=true,['95524']=true,['95529']=true,['95533']=true,['83161']=true,['83165']=true,['83166']=true,['83170']=true,['83174']=true,['83175']=true,['83179']=true,['83183']=true,['83184']=true,['83188']=true,['83192']=true,['83193']=true,['83197']=true,['83201']=true,['83202']=true,['83206']=true,['83210']=true,['83211']=true,['83215']=true,['83219']=true,['83220']=true,['83224']=true,['83228']=true,['83229']=true,['82617']=true,['82621']=true,['82622']=true,['82626']=true,['82630']=true,['82631']=true,['82635']=true,['82639']=true,['82640']=true,['82644']=true,['82648']=true,['82649']=true,['82653']=true,['82657']=true,['82658']=true,['82662']=true,['82666']=true,['82667']=true,['82671']=true,['82675']=true,['82676']=true,['82680']=true,['82684']=true,['82685']=true,['81582']=true,['81586']=true,['81587']=true,['81591']=true,['81595']=true,['81596']=true,['81600']=true,['81604']=true,['81605']=true,['81609']=true,['81613']=true,['81614']=true,['81618']=true,['81622']=true,['81623']=true,['81627']=true,['81631']=true,['81632']=true,['81636']=true,['81640']=true,['81641']=true,['81645']=true,['81649']=true,['81650']=true,['70108']=true,['70116']=true,['70117']=true,['70120']=true,['70121']=true,['62365']=true,['62384']=true,['62418']=true,['62432']=true,['62448']=true,['62449']=true,['62359']=true,['62382']=true,['62408']=true,['62410']=true,['62428']=true,['62430']=true,['62355']=true,['62438']=true,['72918']=true,['72919']=true,['72920']=true,['72921']=true,['72922']=true,['72923']=true,['72924']=true,['72925']=true,['72929']=true,['72930']=true,['72931']=true,['72932']=true,['72933']=true,['72934']=true,['72935']=true,['72936']=true,['72937']=true,['72938']=true,['72939']=true,['72940']=true,['72941']=true,['72942']=true,['72943']=true,['72944']=true,['72945']=true,['72946']=true,['72947']=true,['72948']=true,['72949']=true,['72950']=true,['72951']=true,['72952']=true,['72955']=true,['72956']=true,['72957']=true,['72958']=true,['72959']=true,['72960']=true,['72961']=true,['72962']=true,['72963']=true,['72964']=true,['72965']=true,['72966']=true,['72967']=true,['72968']=true,['72969']=true,['72970']=true,['72971']=true,['72972']=true,['72973']=true,['72974']=true,['72975']=true,['72976']=true,['72977']=true,['72978']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['31113']=true,['34675']=true,['34676']=true,['34677']=true,['34678']=true,['34679']=true,['34680']=true,['29128']=true,['29132']=true,['29139']=true,['29140']=true,['29145']=true,['29146']=true,['29168']=true,['29169']=true,['29173']=true,['29179']=true,['29276']=true,['29280']=true,['29284']=true,['29288']=true,['30841']=true,['32538']=true,['32539']=true,['29277']=true,['29281']=true,['29285']=true,['29289']=true,['32864']=true,['31341']=true,['29119']=true,['29123']=true,['29126']=true,['29170']=true,['29172']=true,['29176']=true,['29177']=true,['29181']=true,['32770']=true,['32771']=true,['30834']=true,['25824']=true,['25826']=true,['21200']=true,['21205']=true,['21210']=true,['52252']=true,['21199']=true,['21204']=true,['21209']=true,['49052']=true,['49054']=true,['21198']=true,['21203']=true,['21208']=true,['32695']=true,['38662']=true,['38664']=true,['38671']=true,['38672']=true,['38674']=true,['38675']=true,['39320']=true,['39322']=true,['32694']=true,['21394']=true,['21397']=true,['21400']=true,['21403']=true,['21406']=true,['21409']=true,['21412']=true,['21415']=true,['21418']=true,['21197']=true,['21202']=true,['21207']=true,['21393']=true,['21396']=true,['21399']=true,['21402']=true,['21405']=true,['21408']=true,['21411']=true,['21414']=true,['21417']=true,['17904']=true,['17909']=true,['21196']=true,['21201']=true,['21206']=true,['65274']=true,['65360']=true,['17902']=true,['17903']=true,['17907']=true,['17908']=true,['40476']=true,['40477']=true,['17690']=true,['17691']=true,['17900']=true,['17901']=true,['17905']=true,['17906']=true,['34657']=true,['34658']=true,['34659']=true,['38147']=true,['21766']=true,['64886']=true,['64887']=true,['64888']=true,['64889']=true,['64890']=true,['64891']=true,['64892']=true,['64893']=true,['64894']=true,['64895']=true,['64896']=true,['64897']=true,['64898']=true,['64899']=true,['64900']=true,['64901']=true,['64902']=true,['64903']=true,['64905']=true,['64906']=true,['64907']=true,['64908']=true,['64909']=true,['64910']=true,['64911']=true,['64912']=true,['64913']=true,['64914']=true,['64915']=true,['64916']=true,['64917']=true,['64918']=true,['64919']=true,['64920']=true,['64921']=true,['64922']=true,['4614']=true,['22990']=true,['34484']=true,['34486']=true,['23705']=true,['23709']=true,['38309']=true,['38310']=true,['38311']=true,['38312']=true,['38313']=true,['38314']=true,['40643']=true,['43300']=true,['43348']=true,['43349']=true,['98162']=true,['35279']=true,['35280']=true,['40483']=true,['46874']=true,['89401']=true,['89784']=true,['89795']=true,['89796']=true,['89797']=true,['89798']=true,['89799']=true,['89800']=true,['95591']=true,['95592']=true,['97131']=true,['50384']=true,['50386']=true,['50387']=true,['50388']=true,['52570']=true,['50375']=true,['50376']=true,['50377']=true,['50378']=true,['52569']=true,['72982']=true,['72983']=true,['72984']=true,['73004']=true,['73005']=true,['73013']=true,['73014']=true,['73015']=true,['73016']=true,['73017']=true,['73018']=true,['73019']=true,['73020']=true,['73021']=true,['73022']=true,['73023']=true,['73024']=true,['73025']=true,['73026']=true,['73027']=true,['73042']=true,['73060']=true,['73061']=true,['73062']=true,['73063']=true,['73064']=true,['73065']=true,['73066']=true,['73067']=true,['73068']=true,['73101']=true,['73102']=true,['73103']=true,['73104']=true,['73105']=true,['73106']=true,['73107']=true,['73108']=true,['73109']=true,['73110']=true,['73111']=true,['73112']=true,['73113']=true,['73114']=true,['73115']=true,['73116']=true,['73117']=true,['73118']=true,['73119']=true,['73120']=true,['73121']=true,['73122']=true,['73123']=true,['73124']=true,['73125']=true,['73126']=true,['73127']=true,['73128']=true,['73129']=true,['73130']=true,['73131']=true,['73132']=true,['73133']=true,['73134']=true,['73135']=true,['73136']=true,['73137']=true,['73138']=true,['73139']=true,['73140']=true,['73141']=true,['73142']=true,['73143']=true,['73144']=true,['73145']=true,['73146']=true,['73147']=true,['73148']=true,['73149']=true,['73150']=true,['73151']=true,['73152']=true,['73153']=true,['73154']=true,['73155']=true,['73156']=true,['73157']=true,['73158']=true,['73159']=true,['73160']=true,['73161']=true,['73162']=true,['73163']=true,['73164']=true,['73165']=true,['73166']=true,['73167']=true,['73168']=true,['73169']=true,['73170']=true,['73306']=true,['73307']=true,['73308']=true,['73309']=true,['73310']=true,['73311']=true,['73312']=true,['73313']=true,['73314']=true,['73315']=true,['73316']=true,['73317']=true,['73318']=true,['73319']=true,['73320']=true,['73321']=true,['73322']=true,['73323']=true,['73324']=true,['88632']=true,['88633']=true,['88634']=true,['88635']=true,['88636']=true,['88637']=true,['88638']=true,['88639']=true,['88640']=true,['88641']=true,['88642']=true,['88643']=true,['88644']=true,['88645']=true,['88646']=true,['88647']=true,['88667']=true,['44073']=true,['44074']=true,['44283']=true,['44167']=true,['44188']=true,['44216']=true,['44242']=true,['38452']=true,['38453']=true,['38458']=true,['38459']=true,['38462']=true,['38463']=true,['29297']=true,['29301']=true,['29305']=true,['29309']=true,['29296']=true,['29308']=true,['32485']=true,['32486']=true,['32487']=true,['32488']=true,['32489']=true,['32490']=true,['32491']=true,['32492']=true,['32493']=true,['32649']=true,['32757']=true,['29295']=true,['29299']=true,['29303']=true,['29306']=true,['29300']=true,['29304']=true,['29279']=true,['29283']=true,['29287']=true,['29290']=true,['29294']=true,['29298']=true,['29302']=true,['29307']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['98146']=true,['98147']=true,['98148']=true,['98149']=true,['98150']=true,['98335']=true,['92782']=true,['92783']=true,['92784']=true,['92785']=true,['92786']=true,['92787']=true,['93391']=true,['93392']=true,['93393']=true,['93394']=true,['93395']=true,['95425']=true,['95427']=true,['95428']=true,['95429']=true,['95430']=true,['88166']=true,['88167']=true,['88168']=true,['88169']=true,['75274']=true,['83230']=true,['83231']=true,['83232']=true,['83233']=true,['83234']=true,['83235']=true,['83236']=true,['83237']=true,['83238']=true,['83239']=true,['83245']=true,['83246']=true,['83247']=true,['83248']=true,['83249']=true,['83255']=true,['83256']=true,['83257']=true,['83258']=true,['83259']=true,['83272']=true,['83273']=true,['86567']=true,['86570']=true,['86572']=true,['86576']=true,['86579']=true,['86585']=true,['86587']=true,['87780']=true,['82686']=true,['82687']=true,['82688']=true,['82689']=true,['82690']=true,['82691']=true,['82692']=true,['82693']=true,['82694']=true,['82695']=true,['82696']=true,['82697']=true,['82698']=true,['82699']=true,['82700']=true,['82701']=true,['82702']=true,['82703']=true,['82704']=true,['82705']=true,['82718']=true,['82719']=true,['81651']=true,['81652']=true,['81653']=true,['81654']=true,['81655']=true,['81656']=true,['81657']=true,['81658']=true,['81659']=true,['81660']=true,['81661']=true,['81662']=true,['81663']=true,['81664']=true,['81665']=true,['81666']=true,['81667']=true,['81668']=true,['81669']=true,['81670']=true,['81683']=true,['81684']=true,['70105']=true,['70106']=true,['70107']=true,['70110']=true,['70112']=true,['70113']=true,['70119']=true,['70124']=true,['70126']=true,['70127']=true,['70141']=true,['70142']=true,['70143']=true,['70144']=true,['58483']=true,['62362']=true,['62383']=true,['62416']=true,['62434']=true,['62447']=true,['62463']=true,['62464']=true,['62465']=true,['62466']=true,['62467']=true,['64645']=true,['64904']=true,['68775']=true,['68776']=true,['68777']=true,['69764']=true,['62348']=true,['62350']=true,['62351']=true,['62352']=true,['62357']=true,['62361']=true,['62378']=true,['62415']=true,['62427']=true,['62440']=true,['62354']=true,['62375']=true,['62376']=true,['62377']=true,['62436']=true,['62437']=true,['65175']=true,['65176']=true,['50398']=true,['50400']=true,['50402']=true,['50404']=true,['52572']=true,['50397']=true,['50399']=true,['50401']=true,['50403']=true,['52571']=true} } local AllowedItemIDs = { ['109129']='OVERRIDE_MILLABLE', ['109128']='OVERRIDE_MILLABLE', ['109127']='OVERRIDE_MILLABLE', ['109126']='OVERRIDE_MILLABLE', ['109125']='OVERRIDE_MILLABLE', ['109124']='OVERRIDE_MILLABLE', -- ['109119']='OVERRIDE_PROSPECTABLE', } local function IsThisBreakable(link) local _, _, quality = GetItemInfo(link) if(IsEquippableItem(link) and quality and quality > 1 and quality < 5) then return not BreakableFilter["SafeItems"][match(link, 'item:(%d+):')] end end local function IsThisOpenable(link) return BreakableFilter["Pickables"][match(link, 'item:(%d+)')] end local function ScanTooltip(self, itemLink) for index = 1, self:NumLines() do local info = BreakStuff_Cache[_G['GameTooltipTextLeft' .. index]:GetText()] if(info) then return unpack(info) end end local itemID = itemLink:match(":(%w+)") local override = AllowedItemIDs[itemID] if(override and BreakStuff_Cache[override]) then return unpack(BreakStuff_Cache[override]) end end local function CloneTooltip() twipe(BreakStuffHandler.TipLines) for index = 1, GameTooltip:NumLines() do local text = _G['GameTooltipTextLeft' .. index]:GetText() if(text) then BreakStuffHandler.TipLines[#BreakStuffHandler.TipLines+1] = text end end end local function DoIHaveAKey() for key in pairs(SkellyKeys) do if(GetItemCount(key) > 0) then return key end end end local function ApplyButton(itemLink, spell, r, g, b) local slot = GetMouseFocus() local bag = slot:GetParent():GetID() if(GetContainerItemLink(bag, slot:GetID()) == itemLink) then --CloneTooltip() BreakStuffHandler:SetAttribute('spell', spell) BreakStuffHandler:SetAttribute('target-bag', bag) BreakStuffHandler:SetAttribute('target-slot', slot:GetID()) BreakStuffHandler:SetAllPoints(slot) BreakStuffHandler:Show() AutoCastShine_AutoCastStart(BreakStuffHandler, r, g, b) end end function BreakStuffParser(self) local item, link = self:GetItem() if(item and not InCombatLockdown() and (BreakStuffHandler.ReadyToSmash == true)) then local spell, r, g, b = ScanTooltip(self, link) local rr, gg, bb = 1, 1, 1 if(spell) then ApplyButton(link, spell, r, g, b) else spell = "Open" if(DE and IsThisBreakable(link)) then rr, gg, bb = 0.5, 0.5, 1 ApplyButton(link, DE, rr, gg, bb) elseif(PICK and IsThisOpenable(link)) then rr, gg, bb = 0, 1, 1 ApplyButton(link, PICK, rr, gg, bb) elseif(SMITH and IsThisOpenable(link)) then rr, gg, bb = 0, 1, 1 local hasKey = DoIHaveAKey() ApplyButton(link, hasKey, rr, gg, bb) end end BreakStuffHandler.TTextLeft = spell BreakStuffHandler.TTextRight = item end end end --[[ ########################################################## BUILD FOR PACKAGE ########################################################## ]]-- local BreakStuff_OnModifier = function(self, arg) if(not self:IsShown() and not arg and (self.ReadyToSmash == false)) then return; end if(InCombatLockdown()) then self:SetAlpha(0) self:RegisterEvent('PLAYER_REGEN_ENABLED') else self:ClearAllPoints() self:SetAlpha(1) self:Hide() AutoCastShine_AutoCastStop(self) end end BreakStuffHandler.MODIFIER_STATE_CHANGED = BreakStuff_OnModifier; local BreakStuff_OnHide = function() BreakStuffHandler.ReadyToSmash = false BreakStuffButton.ttText = "BreakStuff : OFF"; end local BreakStuff_OnEnter = function(self) GameTooltip:SetOwner(self,"ANCHOR_TOP",0,4) GameTooltip:ClearLines() GameTooltip:AddLine(self.ttText) GameTooltip:AddLine(self.subText) if self.ttText2 then GameTooltip:AddLine(' ') GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1) end if BreakStuffHandler.ReadyToSmash ~= true then self:SetPanelColor("class") self.icon:SetGradient(unpack(SV.media.gradient.highlight)) end GameTooltip:Show() end local BreakStuff_OnLeave = function(self) if BreakStuffHandler.ReadyToSmash ~= true then self:SetPanelColor("default") self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) GameTooltip:Hide() end end local BreakStuff_OnClick = function(self) if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end if BreakStuffHandler.ReadyToSmash == true then BreakStuffHandler:MODIFIER_STATE_CHANGED() BreakStuffHandler.ReadyToSmash = false self.ttText = "BreakStuff : OFF"; self:SetPanelColor("default") self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) else BreakStuffHandler.ReadyToSmash = true self.ttText = "BreakStuff : ON"; self:SetPanelColor("green") self.icon:SetGradient(unpack(SV.media.gradient.green)) if(SV.Inventory and SV.Inventory.MasterFrame) then if(not SV.Inventory.MasterFrame:IsShown()) then GameTooltip:Hide() SV.Inventory.MasterFrame:Show() SV.Inventory.MasterFrame:RefreshBags() if(SV.Tooltip) then SV.Tooltip.GameTooltip_SetDefaultAnchor(GameTooltip,self) end end end end GameTooltip:ClearLines() GameTooltip:AddLine(self.ttText) GameTooltip:AddLine(self.subText) end function BreakStuffHandler:PLAYER_REGEN_ENABLED() self:UnregisterEvent('PLAYER_REGEN_ENABLED') BreakStuff_OnModifier(self) end function MOD:PLAYER_REGEN_ENABLED() self:UnregisterEvent('PLAYER_REGEN_ENABLED') self:LoadBreakStuff() end local SetClonedTip = function(self) GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) GameTooltip:ClearLines() GameTooltip:AddDoubleLine(self.TTextLeft, self.TTextRight, 0,1,0,1,1,1) -- for index = 1, #self.TipLines do -- GameTooltip:AddLine(self.TipLines[index]) -- end GameTooltip:Show() end local function LoadToolBreakStuff() if(InCombatLockdown()) then MOD:RegisterEvent("PLAYER_REGEN_ENABLED"); return end local allowed, spellListing, spellName, _ = false, {}; if(IsSpellKnown(51005)) then --print("Milling") allowed = true spellName,_ = GetSpellInfo(51005) BreakStuff_Cache[ITEM_MILLABLE] = {spellName, 0.5, 1, 0.5} BreakStuff_Cache['OVERRIDE_MILLABLE'] = {spellName, 0.5, 1, 0.5} local count = #spellListing + 1; spellListing[count] = spellName; end if(IsSpellKnown(31252)) then --print("Prospecting") allowed = true spellName,_ = GetSpellInfo(31252) BreakStuff_Cache[ITEM_PROSPECTABLE] = {spellName, 1, 0.33, 0.33} -- BreakStuff_Cache['OVERRIDE_PROSPECTABLE'] = {spellName, 1, 0.33, 0.33} local count = #spellListing + 1; spellListing[count] = spellName; end if(IsSpellKnown(13262)) then --print("Enchanting") allowed = true DE,_ = GetSpellInfo(13262) local count = #spellListing + 1; spellListing[count] = DE; end if(IsSpellKnown(1804)) then --print("Lockpicking") allowed = true PICK,_ = GetSpellInfo(1804) local count = #spellListing + 1; spellListing[count] = PICK; end if(IsSpellKnown(2018)) then --print("Blacksmithing") allowed = true SMITH,_ = GetSpellBookItemInfo((GetSpellInfo(2018))) local count = #spellListing + 1; spellListing[count] = SMITH; end MOD.BreakStuffLoaded = true; if not allowed then return end BreakStuffButton:SetParent(MOD.BottomRight.Bar.ToolBar) local size = MOD.BottomRight.Bar.ToolBar:GetHeight() BreakStuffButton:SetSize(size, size) BreakStuffButton:SetPoint("RIGHT", MOD.BottomRight.Bar.ToolBar, "LEFT", -6, 0) BreakStuffButton.icon:SetTexture(SV.media.dock.breakStuffIcon) BreakStuffButton:Show(); BreakStuffButton:SetStyle("DockButton") BreakStuffButton:SetScript("OnEnter", BreakStuff_OnEnter); BreakStuffButton:SetScript("OnLeave", BreakStuff_OnLeave); BreakStuffButton:SetScript("OnClick", BreakStuff_OnClick); BreakStuffButton:SetScript("OnHide", BreakStuff_OnHide) BreakStuffButton.subText = tcat(spellListing,"\n"); BreakStuffHandler:RegisterForClicks('AnyUp') BreakStuffHandler:SetFrameStrata("TOOLTIP") BreakStuffHandler:SetAttribute("type1","spell") BreakStuffHandler:SetScript("OnEnter", SetClonedTip) BreakStuffHandler:SetScript("OnLeave", BreakStuff_OnModifier) BreakStuffHandler:RegisterEvent("MODIFIER_STATE_CHANGED") BreakStuffHandler:Hide() GameTooltip:HookScript('OnTooltipSetItem', BreakStuffParser) for _, sparks in pairs(BreakStuffHandler.sparkles) do sparks:SetHeight(sparks:GetHeight() * 3) sparks:SetWidth(sparks:GetWidth() * 3) end end function MOD:CloseBreakStuff() if((not SV.db.Dock.dockTools.breakstuff) or self.BreakStuffLoaded) then return end BreakStuffHandler:MODIFIER_STATE_CHANGED() BreakStuffHandler.ReadyToSmash = false BreakStuffButton.ttText = "BreakStuff : OFF"; BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) end function MOD:LoadBreakStuff() if((not SV.db.Dock.dockTools.breakstuff) or self.BreakStuffLoaded) then return end SV.Timers:ExecuteTimer(LoadToolBreakStuff, 5) end
mit
TerryE/nodemcu-firmware
lua_modules/hdc1000/HDC1000.lua
1
2653
------------------------------------------------------- -- This library was written for the Texas Instruments -- HDC1000 temperature and humidity sensor. -- It should work for the HDC1008 too. -- Written by Francesco Truzzi (francesco@truzzi.me) -- Released under GNU GPL v2.0 license. ------------------------------------------------------- -------------- NON-DEFAULT CONFIG VALUES -------------- ------------- config() optional arguments ------------- -- HDC1000_HEAT_OFF 0x00 (heater) -- HDC1000_TEMP_11BIT 0x40 (resolution) -- HDC1000_HUMI_11BIT 0x01 (resolution) -- HDC1000_HUMI_8BIT 0x20 (resolution) ------------------------------------------------------- local modname = ... local M = {} _G[modname] = M local id = 0 local i2c = i2c local delay = 20000 local _drdyn_pin local HDC1000_ADDR = 0x40 local HDC1000_TEMP = 0x00 local HDC1000_HUMI = 0x01 local HDC1000_CONFIG = 0x02 local HDC1000_HEAT_ON = 0x20 local HDC1000_TEMP_HUMI_14BIT = 0x00 -- reads 16bits from the sensor local function read16() i2c.start(id) i2c.address(id, HDC1000_ADDR, i2c.RECEIVER) data_temp = i2c.read(0, 2) i2c.stop(id) data = bit.lshift(string.byte(data_temp, 1, 1), 8) + string.byte(data_temp, 2, 2) return data end -- sets the register to read next local function setReadRegister(register) i2c.start(id) i2c.address(id, HDC1000_ADDR, i2c.TRANSMITTER) i2c.write(id, register) i2c.stop(id) end -- writes the 2 configuration bytes local function writeConfig(config) i2c.start(id) i2c.address(id, HDC1000_ADDR, i2c.TRANSMITTER) i2c.write(id, HDC1000_CONFIG, config, 0x00) i2c.stop(id) end -- returns true if battery voltage is < 2.7V, false otherwise function M.batteryDead() setReadRegister(HDC1000_CONFIG) return(bit.isset(read16(), 11)) end -- setup i2c function M.setup(drdyn_pin) _drdyn_pin = drdyn_pin end function M.config(addr, resolution, heater) -- default values are set if the function is called with no arguments HDC1000_ADDR = addr or HDC1000_ADDR resolution = resolution or HDC1000_TEMP_HUMI_14BIT heater = heater or HDC1000_HEAT_ON writeConfig(bit.bor(resolution, heater)) end -- outputs temperature in Celsius degrees function M.getHumi() setReadRegister(HDC1000_HUMI) if(_drdyn_pin ~= false) then gpio.mode(_drdyn_pin, gpio.INPUT) while(gpio.read(_drdyn_pin)==1) do end else tmr.delay(delay) end return(read16()/65535.0*100) end -- outputs humidity in %RH function M.getTemp() setReadRegister(HDC1000_TEMP) if(_drdyn_pin ~= false) then gpio.mode(_drdyn_pin, gpio.INPUT) while(gpio.read(_drdyn_pin)==1) do end else tmr.delay(delay) end return(read16()/65535.0*165-40) end return M
mit
SalvationDevelopment/Salvation-Scripts-Production
c67284107.lua
2
1270
--スケープ・ゴースト function c67284107.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(67284107,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetTarget(c67284107.sptg) e1:SetOperation(c67284107.spop) c:RegisterEffect(e1) end function c67284107.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,67284108,0,0x4011,0,0,1,RACE_ZOMBIE,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function c67284107.spop(e,tp,eg,ep,ev,re,r,rp) local ft=5 if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end ft=math.min(ft,Duel.GetLocationCount(tp,LOCATION_MZONE)) if ft<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,67284108,0,0x4011,0,0,1,RACE_ZOMBIE,ATTRIBUTE_DARK) then return end repeat local token=Duel.CreateToken(tp,67284108) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) ft=ft-1 until ft<=0 or not Duel.SelectYesNo(tp,aux.Stringid(67284107,1)) Duel.SpecialSummonComplete() end
gpl-2.0
danielmiw/marshal
plugins/self.lua
1
4274
--[[ ################################ # # # Self Plugin # # # # # # by @nigaa_marshal # # marshal # # # # Team Channel @khaleq_marshal # # # # # # Update: 2 March 2017 # # # # Special Tnx To # # @nigaa_marshal # # # ################################ ]] do local function self_names( name ) for k,v in pairs(_self.names) do if string.lower(name) == v then return k end end -- If not found return false end local function self_answers( answer ) for k,v in pairs(_self.answers) do if answer == v then return k end end -- If not found return false end local function reload_plugins( ) plugins = {} load_plugins() end local function namelist(msg) local namelist = _self.names local text = "*Names list :*\n" for i=1,#namelist do text = text..i.." - "..namelist[i].."\n" end return text end local function answerlist(msg) local answerlist = _self.answers local text = "*Answers list :*\n" for i=1,#answerlist do text = text..i.." - "..answerlist[i].."\n" end return text end local function set_name( name ) -- Check if name founded if self_names(name) then return '_Name_ *'..name..'* _founded_' end -- Add to the self table table.insert(_self.names, name) save_self() reload_plugins( ) -- Reload the plugins return '_New name_ *'..name..'* _added to name list_' end local function set_answer( answer ) -- Check if name founded if self_answers(answer) then return '_Word_ *'..answer..'* _founded_' end -- Add to the self table table.insert(_self.answers, answer) save_self() reload_plugins( ) -- Reload the plugins return '_New word_ *'..answer..'* _added to answer list_' end local function rem_name( name ) local k = self_names(name) -- Check if name not founded if not k then return '_Name_ *'..name..'* _not founded_' end -- remove and reload table.remove(_self.names, k) save_self( ) reload_plugins(true) return '_Name_ *'..name..'* _removed from name list_' end local function rem_answer( answer ) local k = self_answers(answer) -- Check if answer not founded if not k then return '_Word_ *'..answer..'* _not founded_' end -- remove and reload table.remove(_self.answers, k) save_self( ) reload_plugins(true) return '_Word_ *'..answer..'* _removed from answer list_' end local function run(msg, matches) local answer = _self.answers local text = answer[math.random(#answer)] if matches[1]:lower() == "addname" and is_sudo(msg) then local name = matches[2] return set_name(name) elseif matches[1]:lower() == "remname" and is_sudo(msg) then local name = matches[2] return rem_name(name) elseif matches[1]:lower() == "setanswer" and is_sudo(msg) then local answer = matches[2] return set_answer(answer) elseif matches[1]:lower() == "remanswer" and is_sudo(msg) then local answer = matches[2] return rem_answer(answer) elseif matches[1]:lower() == 'namelist' and is_sudo(msg) then return tdcli.sendMessage(msg.to.id, msg.id, 0, namelist(msg), 0, "md") elseif matches[1]:lower() == 'answerlist' and is_sudo(msg) then return tdcli.sendMessage(msg.to.id, msg.id, 0, answerlist(msg), 0, "md") end if self_names(matches[1]) then local chat = tostring(msg.to.id) if chat:match("-100") then gpid = string.gsub(msg.to.id, "-100", "") elseif chat:match("-") then gpid = string.gsub(msg.to.id, "-", "") end local hash = 'on-off:'..gpid if not is_sudo(msg) then if redis:get(hash) then return nil elseif not redis:get(hash) then return tdcli.sendMessage(msg.to.id, msg.id, 0, text, 0, "md") end end end end return { patterns = { "^[!/]([Aa]ddname) (.*)$", "^[!/]([Rr]emname) (.*)$", "^[!/]([Nn]amelist)$", "^[!/]([Ss]etanswer) (.*)$", "^[!/]([Rr]emanswer) (.*)$", "^[!/]([Aa]nswerlist)$", "^(.*)$" }, run = run } end --End self.lua By @SoLiD
gpl-3.0
dr01d3r/darkstar
scripts/zones/Pashhow_Marshlands_[S]/npcs/Telepoint.lua
17
1263
----------------------------------- -- Area: Pashhow Marshlands [S] -- NPC: Telepoint ----------------------------------- package.loaded["scripts/zones/Pashhow_Marshlands_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Pashhow_Marshlands_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(PASHHOW_GATE_CRYSTAL) == false) then player:addKeyItem(PASHHOW_GATE_CRYSTAL); player:messageSpecial(KEYITEM_OBTAINED,PASHHOW_GATE_CRYSTAL); else player:messageSpecial(ALREADY_OBTAINED_TELE); 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
dr01d3r/darkstar
scripts/globals/abilities/curing_waltz_v.lua
6
2528
----------------------------------- -- Ability: Curing Waltz V -- Restores target's HP -- Obtained: Dancer Level 87 -- TP Required: 80% -- Recast Time: 00:23 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (target:getHP() == 0) then return MSGBASIC_CANNOT_ON_THAT_TARG,0; elseif (player:hasStatusEffect(EFFECT_SABER_DANCE)) then return MSGBASIC_UNABLE_TO_USE_JA2, 0; elseif (player:hasStatusEffect(EFFECT_TRANCE)) then return 0,0; elseif (player:getTP() < 800) then return MSGBASIC_NOT_ENOUGH_TP,0; else --[[ Apply "Waltz Ability Delay" reduction 1 modifier = 1 second]] local recastMod = player:getMod(MOD_WALTZ_DELAY); if (recastMod ~= 0) then local newRecast = ability:getRecast() +recastMod; ability:setRecast(utils.clamp(newRecast,0,newRecast)); end -- Apply "Fan Dance" Waltz recast reduction if (player:hasStatusEffect(EFFECT_FAN_DANCE)) then local fanDanceMerits = target:getMerit(MERIT_FAN_DANCE); -- Every tier beyond the 1st is -5% recast time if (fanDanceMerits > 5) then ability:setRecast(ability:getRecast() * ((fanDanceMerits -5)/100)); end end return 0,0; end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) -- Only remove TP if the player doesn't have Trance. if not player:hasStatusEffect(EFFECT_TRANCE) then player:delTP(800); end; --Grabbing variables. local vit = target:getStat(MOD_VIT); local chr = player:getStat(MOD_CHR); local mjob = player:getMainJob(); --19 for DNC main. local cure = 0; --Performing mj check. if (mjob == 19) then cure = (vit+chr)*1.25+600; end -- apply waltz modifiers cure = math.floor(cure * (1.0 + (player:getMod(MOD_WALTZ_POTENTCY)/100))); --Reducing TP. --Applying server mods.... cure = cure * CURE_POWER; --Cap the final amount to max HP. if ((target:getMaxHP() - target:getHP()) < cure) then cure = (target:getMaxHP() - target:getHP()); end --Do it target:restoreHP(cure); player:updateEnmityFromCure(target,cure); return cure; end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c89211486.lua
4
1298
--ジェネクス・ドクター function c89211486.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(89211486,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(c89211486.cost) e1:SetTarget(c89211486.target) e1:SetOperation(c89211486.operation) c:RegisterEffect(e1) end function c89211486.cfilter(c) return c:IsFaceup() and c:IsCode(68505803) end function c89211486.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,c89211486.cfilter,1,e:GetHandler()) end local sg=Duel.SelectReleaseGroup(tp,c89211486.cfilter,1,1,e:GetHandler()) Duel.Release(sg,REASON_COST) end function c89211486.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c89211486.operation(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
dr01d3r/darkstar
scripts/globals/weaponskills/chant_du_cygne.lua
26
1307
----------------------------------- -- Chant du Cygne -- Sword weapon skill -- Skill level: EMPYREAN -- Delivers a three-hit attack. Chance of params.critical varies with TP. -- Will stack with Sneak Attack. -- Element: None -- Modifiers: DEX:60% -- 100%TP 200%TP 300%TP -- ALL 2.25 ----------------------------------- 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 = 3; params.ftp100 = 2.25; params.ftp200 = 2.25; params.ftp300 = 2.25; params.str_wsc = 0.0; params.dex_wsc = 0.6; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.1; params.crit200 = 0.3; params.crit300 = 0.5; params.canCrit = true; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.dex_wsc = 0.8; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, tp, primary, action, taChar, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c81661951.lua
6
1240
--ドラグニティ-ミリトゥム function c81661951.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(81661951,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(c81661951.sptg) e1:SetOperation(c81661951.spop) c:RegisterEffect(e1) end function c81661951.filter(c,e,tp) return c:IsFaceup() and c:IsSetCard(0x29) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c81661951.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_SZONE) and c81661951.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c81661951.filter,tp,LOCATION_SZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c81661951.filter,tp,LOCATION_SZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c81661951.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
gpl-2.0
Caduceus/forgottenserver
data/talkactions/scripts/add_skill.lua
35
1716
local function getSkillId(skillName) if skillName == "club" then return SKILL_CLUB elseif skillName == "sword" then return SKILL_SWORD elseif skillName == "axe" then return SKILL_AXE elseif skillName:sub(1, 4) == "dist" then return SKILL_DISTANCE elseif skillName:sub(1, 6) == "shield" then return SKILL_SHIELD elseif skillName:sub(1, 4) == "fish" then return SKILL_FISHING else return SKILL_FIST end end local function getExpForLevel(level) level = level - 1 return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3 end function onSay(player, words, param) if not player:getGroup():getAccess() then return true end if player:getAccountType() < ACCOUNT_TYPE_GOD then return false end local split = param:split(",") if split[2] == nil then player:sendCancelMessage("Insufficient parameters.") return false end local target = Player(split[1]) if target == nil then player:sendCancelMessage("A player with that name is not online.") return false end -- Trim left split[2] = split[2]:gsub("^%s*(.-)$", "%1") local count = 1 if split[3] ~= nil then count = tonumber(split[3]) end local ch = split[2]:sub(1, 1) for i = 1, count do if ch == "l" or ch == "e" then target:addExperience(getExpForLevel(target:getLevel() + 1) - target:getExperience(), false) elseif ch == "m" then target:addManaSpent(target:getVocation():getRequiredManaSpent(target:getBaseMagicLevel() + 1) - target:getManaSpent()) else local skillId = getSkillId(split[2]) target:addSkillTries(skillId, target:getVocation():getRequiredSkillTries(skillId, target:getSkillLevel(skillId) + 1) - target:getSkillTries(skillId)) end end return false end
gpl-2.0
dr01d3r/darkstar
scripts/zones/Bastok_Mines/npcs/Davyad.lua
14
1191
----------------------------------- -- Area: Bastok Mines -- NPC: Davyad -- Involved in Mission: Bastok 3-2 -- @zone 234 -- @pos 83 0 30 ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(BASTOK) == TO_THE_FORSAKEN_MINES) then player:startEvent(0x0036); else player:startEvent(0x0035); 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
SalvationDevelopment/Salvation-Scripts-Production
c8240199.lua
2
2933
--青き眼の賢士 function c8240199.initial_effect(c) --To hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(c8240199.thtg) e1:SetOperation(c8240199.thop) c:RegisterEffect(e1) --To grave local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,8240199) e2:SetCost(c8240199.gvcost) e2:SetTarget(c8240199.gvtg) e2:SetOperation(c8240199.gvop) c:RegisterEffect(e2) end function c8240199.thfilter(c) return c:IsType(TYPE_TUNER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==1 and not c:IsCode(8240199) and c:IsAbleToHand() end function c8240199.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c8240199.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c8240199.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c8240199.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c8240199.gvcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function c8240199.gvfilter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToGrave() end function c8240199.spfilter(c,e,tp) return c:IsSetCard(0xdd) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c8240199.gvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c8240199.gvfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingTarget(c8240199.gvfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(c8240199.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,c8240199.gvfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c8240199.gvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c8240199.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c8240199.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end end
gpl-2.0
mrfoxirani/fox
bot/utils.lua
26
17219
URL = require "socket.url" http = require "socket.http" https = require "ssl.https" ltn12 = require "ltn12" serpent = require "serpent" feedparser = require "feedparser" json = (loadfile "./libs/JSON.lua")() mimetype = (loadfile "./libs/mimetype.lua")() redis = (loadfile "./libs/redis.lua")() JSON = (loadfile "./libs/dkjson.lua")() http.TIMEOUT = 10 function get_receiver(msg) if msg.to.type == 'user' then return 'user#id'..msg.from.id end if msg.to.type == 'chat' then return 'chat#id'..msg.to.id end if msg.to.type == 'encr_chat' then return msg.to.print_name end end function is_chat_msg( msg ) if msg.to.type == 'chat' then return true end return false end function string.random(length) local str = ""; for i = 1, length do math.random(97, 122) str = str..string.char(math.random(97, 122)); end return str; end function string:split(sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end -- DEPRECATED function string.trim(s) print("string.trim(s) is DEPRECATED use string:trim() instead") return s:gsub("^%s*(.-)%s*$", "%1") end -- Removes spaces function vardump(value) print(serpent.block(value, {comment=false})) end -- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen function run_command(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end -- User has privileges function is_sudo(msg) local var = false -- Check users id in config for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end --Check if this chat is realm or not function is_realm(msg) local var = false for v,group in pairs(_config.realm) do if group == msg.to.id then var = true end end return var end function savelog(group, logtxt) local text = (os.date("[ %c ]=> "..logtxt.."\n \n")) local file = io.open("./groups/"..group.."log.txt", "a") file:write(text) file:close() end function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end --Check if user is the owner of that group or not function is_owner(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_owner2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is admin or not function is_admin(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_admin2(user_id) local var = false local data = load_data(_config.moderation.data) local user = user_id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is the mod of that group or not function is_momod(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['moderators'] then if data[tostring(msg.to.id)]['moderators'][tostring(user)] then var = true end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_momod2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) local usert = user_id if data[tostring(group_id)] then if data[tostring(group_id)]['moderators'] then if data[tostring(group_id)]['moderators'][tostring(usert)] then var = true end end end if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == usert then var = true end end return var end -- Returns the name of the sender function get_name(msg) local name = msg.from.first_name if name == nil then name = msg.from.id end return name end -- Returns at table of lua files inside plugins function plugins_names( ) local files = {} for k, v in pairs(scandir("plugins")) do -- Ends with .lua if (v:match(".lua$")) then table.insert(files, v) end end return files end -- Function name explains what it does. function file_exists(name) local f = io.open(name,"r") if f ~= nil then io.close(f) return true else return false end end -- Save into file the data serialized for lua. -- Set uglify true to minify the file. function serialize_to_file(data, file, uglify) file = io.open(file, 'w+') local serialized if not uglify then serialized = serpent.block(data, { comment = false, name = '_' }) else serialized = serpent.dump(data) end file:write(serialized) file:close() end -- Returns true if the string is empty function string:isempty() return self == nil or self == '' end -- Returns true if the string is blank function string:isblank() self = self:trim() return self:isempty() end -- DEPRECATED!!!!! function string.starts(String, Start) print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead") return Start == string.sub(String,1,string.len(Start)) end -- Returns true if String starts with Start function string:starts(text) return text == string.sub(self,1,string.len(text)) end -- Callback to remove a file function rmtmp_cb(cb_extra, success, result) local file_path = cb_extra.file_path local cb_function = cb_extra.cb_function or ok_cb local cb_extra = cb_extra.cb_extra if file_path ~= nil then os.remove(file_path) print("Deleted: "..file_path) end -- Finally call the callback cb_function(cb_extra, success, result) end -- Send document to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_document(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function or ok_cb, cb_extra = cb_extra or false } -- Call to remove with optional callback send_document(receiver, file_path, rmtmp_cb, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_document_from_url(receiver, url, cb_function, cb_extra) local file_path = download_to_file(url, false) print("File path: "..file_path) _send_document(receiver, file_path, cb_function, cb_extra) end -- Parameters in ?a=1&b=2 style function format_http_params(params, is_get) local str = '' -- If is get add ? to the beginning if is_get then str = '?' end local first = true -- Frist param for k,v in pairs (params) do if v then -- nil value if first then first = false str = str..k.. "="..v else str = str.."&"..k.. "="..v end end end return str end -- Check if user can use the plugin and warns user -- Returns true if user was warned and false if not warned (is allowed) function warns_user_not_allowed(plugin, msg) if not user_allowed(plugin, msg) then return true else return false end end -- Check if user can use the plugin function user_allowed(plugin, msg) if plugin.privileged and not is_sudo(msg) then return false end return true end function send_order_msg(destination, msgs) local cb_extra = { destination = destination, msgs = msgs } send_order_msg_callback(cb_extra, true) end function send_order_msg_callback(cb_extra, success, result) local destination = cb_extra.destination local msgs = cb_extra.msgs local file_path = cb_extra.file_path if file_path ~= nil then os.remove(file_path) print("Deleted: " .. file_path) end if type(msgs) == 'string' then send_large_msg(destination, msgs) elseif type(msgs) ~= 'table' then return end if #msgs < 1 then return end local msg = table.remove(msgs, 1) local new_cb_extra = { destination = destination, msgs = msgs } if type(msg) == 'string' then send_msg(destination, msg, send_order_msg_callback, new_cb_extra) elseif type(msg) == 'table' then local typ = msg[1] local nmsg = msg[2] new_cb_extra.file_path = nmsg if typ == 'document' then send_document(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'image' or typ == 'photo' then send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'audio' then send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'video' then send_video(destination, nmsg, send_order_msg_callback, new_cb_extra) else send_file(destination, nmsg, send_order_msg_callback, new_cb_extra) end end end -- Same as send_large_msg_callback but friendly params function send_large_msg(destination, text) local cb_extra = { destination = destination, text = text } send_large_msg_callback(cb_extra, true) end -- If text is longer than 4096 chars, send multiple msg. -- https://core.telegram.org/method/messages.sendMessage function send_large_msg_callback(cb_extra, success, result) local text_max = 4096 local destination = cb_extra.destination local text = cb_extra.text local text_len = string.len(text) local num_msg = math.ceil(text_len / text_max) if num_msg <= 1 then send_msg(destination, text, ok_cb, false) else local my_text = string.sub(text, 1, 4096) local rest = string.sub(text, 4096, text_len) local cb_extra = { destination = destination, text = rest } send_msg(destination, my_text, send_large_msg_callback, cb_extra) end end -- Returns a table with matches or nil function match_pattern(pattern, text, lower_case) if text then local matches = {} if lower_case then matches = { string.match(text:lower(), pattern) } else matches = { string.match(text, pattern) } end if next(matches) then return matches end end -- nil end -- Function to read data from files function load_from_file(file, default_data) local f = io.open(file, "r+") -- If file doesn't exists if f == nil then -- Create a new empty table default_data = default_data or {} serialize_to_file(default_data, file) print ('Created file', file) else print ('Data loaded from file', file) f:close() end return loadfile (file)() end -- Kick function kick_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_owner2(user_id, chat_id) then -- Ignore admins return end local chat = 'chat#id'..chat_id local user = 'user#id'..user_id chat_del_user(chat, user, ok_cb, true) end -- Ban function ban_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'banned:'..chat_id redis:sadd(hash, user_id) -- Kick from chat kick_user(user_id, chat_id) end -- Global ban function banall_user(user_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'gbanned' redis:sadd(hash, user_id) end -- Global unban function unbanall_user(user_id) --Save on redis local hash = 'gbanned' redis:srem(hash, user_id) end -- Check if user_id is banned in chat_id or not function is_banned(user_id, chat_id) --Save on redis local hash = 'banned:'..chat_id local banned = redis:sismember(hash, user_id) return banned or false end -- Check if user_id is globally banned or not function is_gbanned(user_id) --Save on redis local hash = 'gbanned' local banned = redis:sismember(hash, user_id) return banned or false end -- Returns chat_id ban list function ban_list(chat_id) local hash = 'banned:'..chat_id local list = redis:smembers(hash) local text = "Ban list !\n\n" for k,v in pairs(list) do text = text..k.." - "..v.." \n" end return text end -- Returns globally ban list function banall_list() local hash = 'gbanned' local list = redis:smembers(hash) local text = "global bans !\n\n" for k,v in pairs(list) do text = text..k.." - "..v.." \n" end return text end -- /id by reply function get_id_by_reply(extra, success, result) if result.to.type == 'chat' then send_large_msg(chat, result.from.id) else return 'Use This in Your Groups' end end -- kick by reply for mods and owner function Kick_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end -- Kick by reply for admins function Kick_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_admin2(result.from.id) then -- Ignore admins return end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end --Ban by reply for admins function ban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Ban by reply for admins function ban_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_admin2(result.from.id) then -- Ignore admins return end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Unban by reply function unban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't unban myself" end send_large_msg(chat, "User "..result.from.id.." Unbanned") -- Save on redis local hash = 'banned:'..result.to.id redis:srem(hash, result.from.id) else return 'Use This in Your Groups' end end
gpl-2.0
SOCLE15/mMediaWiki
extensions/Scribunto/engines/LuaCommon/lualib/mwInit.lua
6
3939
-- This file is for anything that needs to be set up before a Lua engine can -- start. Things in this file may run more than once, so avoid putting anything -- other than function definitions in it. Also, because this can run before -- PHP can do anything, mw_interface is unavailable here. mw = mw or {} -- Extend pairs and ipairs to recognize __pairs and __ipairs, if they don't already do local t = {} setmetatable( t, { __pairs = function() return 1, 2, 3 end } ) local f = pairs( t ) if f ~= 1 then local old_pairs = pairs pairs = function ( t ) local mt = getmetatable( t ) local f, s, var = ( mt and mt.__pairs or old_pairs )( t ) return f, s, var end local old_ipairs = ipairs ipairs = function ( t ) local mt = getmetatable( t ) local f, s, var = ( mt and mt.__ipairs or old_ipairs )( t ) return f, s, var end end end --- Do a "deep copy" of a table or other value. function mw.clone( val ) local tableRefs = {} local function recursiveClone( val ) if type( val ) == 'table' then -- Encode circular references correctly if tableRefs[val] ~= nil then return tableRefs[val] end local retVal retVal = {} tableRefs[val] = retVal -- Copy metatable if getmetatable( val ) then setmetatable( retVal, recursiveClone( getmetatable( val ) ) ) end for key, elt in pairs( val ) do retVal[key] = recursiveClone( elt ) end return retVal else return val end end return recursiveClone( val ) end --- Make isolation-safe setfenv and getfenv functions -- -- @param protectedEnvironments A table where the keys are protected environment -- tables. These environments cannot be accessed with getfenv(), and -- functions with these environments cannot be modified or accessed using -- integer indexes to setfenv(). However, functions with these environments -- can have their environment set with setfenv() with a function value -- argument. -- -- @param protectedFunctions A table where the keys are protected functions, -- which cannot have their environments set by setfenv() with a function -- value argument. -- -- @return setfenv -- @return getfenv function mw.makeProtectedEnvFuncs( protectedEnvironments, protectedFunctions ) local old_setfenv = setfenv local old_getfenv = getfenv local function my_setfenv( func, newEnv ) if type( func ) == 'number' then local stackIndex = math.floor( func ) if stackIndex <= 0 then error( "'setfenv' cannot set the global environment, it is protected", 2 ) end if stackIndex > 10 then error( "'setfenv' cannot set an environment at a level greater than 10", 2 ) end -- Add one because we are still in Lua and 1 is right here stackIndex = stackIndex + 1 local env = old_getfenv( stackIndex ) if env == nil or protectedEnvironments[ env ] then error( "'setfenv' cannot set the requested environment, it is protected", 2 ) end func = old_setfenv( stackIndex, newEnv ) elseif type( func ) == 'function' then if protectedFunctions[func] then error( "'setfenv' cannot be called on a protected function", 2 ) end local env = old_getfenv( func ) if env == nil or protectedEnvironments[ env ] then error( "'setfenv' cannot set the requested environment, it is protected", 2 ) end old_setfenv( func, newEnv ) else error( "'setfenv' can only be called with a function or integer as the first argument", 2 ) end return func end local function my_getfenv( func ) local env if type( func ) == 'number' then if func <= 0 then error( "'getfenv' cannot get the global environment" ) end env = old_getfenv( func + 1 ) elseif type( func ) == 'function' then env = old_getfenv( func ) else error( "'getfenv' cannot get the global environment" ) end if protectedEnvironments[env] then return nil else return env end end return my_setfenv, my_getfenv end return mw
gpl-2.0
thegrb93/wire
lua/wire/stools/output.lua
8
1075
WireToolSetup.setCategory( "Input, Output/Keyboard Interaction" ) WireToolSetup.open( "output", "Numpad Output", "gmod_wire_output", nil, "Numpad Outputs" ) if CLIENT then language.Add( "Tool.wire_output.name", "Output Tool (Wire)" ) language.Add( "Tool.wire_output.desc", "Spawns an output for use with the wire system." ) language.Add( "Tool.wire_output.keygroup", "Key:" ) TOOL.Information = { { name = "left", text = "Create/Update " .. TOOL.Name } } end WireToolSetup.BaseLang() WireToolSetup.SetupMax( 10 ) if SERVER then ModelPlug_Register("Numpad") function TOOL:GetConVars() return self:GetClientNumber( "keygroup" ) end end TOOL.ClientConVar = { model = "models/beer/wiremod/numpad.mdl", modelsize = "", keygroup = 1 } function TOOL.BuildCPanel(panel) WireToolHelpers.MakePresetControl(panel, "wire_output") WireToolHelpers.MakeModelSizer(panel, "wire_output_modelsize") ModelPlug_AddToCPanel(panel, "Numpad", "wire_output", true) panel:AddControl("Numpad", { Label = "#Tool.wire_output.keygroup", Command = "wire_output_keygroup", }) end
apache-2.0
SalvationDevelopment/Salvation-Scripts-Production
c93298460.lua
6
1483
--魔装戦士 ヴァンドラ function c93298460.initial_effect(c) --direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(93298460,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(c93298460.condition) e2:SetTarget(c93298460.target) e2:SetOperation(c93298460.operation) c:RegisterEffect(e2) end function c93298460.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function c93298460.filter(c) return c:IsType(TYPE_NORMAL) and c:IsRace(RACE_DRAGON+RACE_WARRIOR+RACE_SPELLCASTER) and c:IsAbleToHand() end function c93298460.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c93298460.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c93298460.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c93298460.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c93298460.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c5861892.lua
2
4970
--アルカナフォースEX-THE LIGHT RULER function c5861892.initial_effect(c) c:EnableReviveLimit() --spsummon proc local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c5861892.spcon) e1:SetOperation(c5861892.spop) c:RegisterEffect(e1) --cannot special summon local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e2) --coin local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(5861892,0)) e3:SetCategory(CATEGORY_COIN) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetTarget(c5861892.cointg) e3:SetOperation(c5861892.coinop) c:RegisterEffect(e3) end function c5861892.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>-3 and Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,c:GetControler(),LOCATION_MZONE,0,3,nil) end function c5861892.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,c:GetControler(),LOCATION_MZONE,0,3,3,nil) Duel.SendtoGrave(g,REASON_COST) end function c5861892.cointg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function c5861892.coinop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local res=0 if c:IsHasEffect(73206827) then res=1-Duel.SelectOption(tp,60,61) else res=Duel.TossCoin(tp,1) end c5861892.arcanareg(c,res) end function c5861892.arcanareg(c,coin) --coin effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(5861892,1)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(c5861892.thcon) e1:SetTarget(c5861892.thtg) e1:SetOperation(c5861892.thop) e1:SetReset(RESET_EVENT+0x1fe0000) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(5861892,2)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_F) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c5861892.negcon) e2:SetTarget(c5861892.negtg) e2:SetOperation(c5861892.negop) e2:SetReset(RESET_EVENT+0x1fe0000) c:RegisterEffect(e2) c:RegisterFlagEffect(36690018,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CLIENT_HINT,1,coin,63-coin) end function c5861892.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetFlagEffectLabel(36690018)==1 and c:IsRelateToBattle() and c:GetBattleTarget():IsLocation(LOCATION_GRAVE) end function c5861892.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c5861892.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function c5861892.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or not g:IsContains(c) then return false end return c:GetFlagEffectLabel(36690018)==0 and (re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsActiveType(TYPE_MONSTER)) end function c5861892.negtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(5861892)==0 end if c:IsHasEffect(EFFECT_REVERSE_UPDATE) then c:RegisterFlagEffect(5861892,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function c5861892.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsFaceup() or c:GetAttack()<1000 or not c:IsRelateToEffect(e) or Duel.GetCurrentChain()~=ev+1 then return end if Duel.NegateActivation(ev) then if re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESET_EVENT+0x1ff0000) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-1000) c:RegisterEffect(e1) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-Production
c511000228.lua
2
1058
--カタパルト·タートル (GX) function c511000228.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(511000228,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(c511000228.cost) e1:SetTarget(c511000228.target) e1:SetOperation(c511000228.operation) c:RegisterEffect(e1) end function c511000228.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,nil) end local sg=Duel.SelectReleaseGroup(tp,nil,1,1,nil) e:SetLabel(sg:GetFirst():GetAttack()/2) Duel.Release(sg,REASON_COST) end function c511000228.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(e:GetLabel()) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,e:GetLabel()) end function c511000228.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
gpl-2.0
koreader/koreader
frontend/ui/data/keyboardlayouts/ru_keyboard.lua
4
6602
local ru_popup = require("ui/data/keyboardlayouts/keypopup/ru_popup") local pco = ru_popup.pco local cop = ru_popup.cop local cse = ru_popup.cse local sec = ru_popup.sec local quo = ru_popup.quo -- Russian layout, top row of letters local _YK = ru_popup._YK local _yk = ru_popup._yk local _TS = ru_popup._TS local _ts = ru_popup._ts local _UU = ru_popup._UU local _uu = ru_popup._uu local _KK = ru_popup._KK local _kk = ru_popup._kk local _YE = ru_popup._YE local _ye = ru_popup._ye local _EN = ru_popup._EN local _en = ru_popup._en local _GG = ru_popup._GG local _gg = ru_popup._gg local _WA = ru_popup._WA local _wa = ru_popup._wa local _WE = ru_popup._WE local _we = ru_popup._we local _ZE = ru_popup._ZE local _ze = ru_popup._ze local _HA = ru_popup._HA local _ha = ru_popup._ha -- Russian layout, middle row of letters local _EF = ru_popup._EF local _ef = ru_popup._ef local _YY = ru_popup._YY local _yy = ru_popup._yy local _VE = ru_popup._VE local _ve = ru_popup._ve local _AA = ru_popup._AA local _aa = ru_popup._aa local _PE = ru_popup._PE local _pe = ru_popup._pe local _ER = ru_popup._ER local _er = ru_popup._er local _OO = ru_popup._OO local _oo = ru_popup._oo local _EL = ru_popup._EL local _el = ru_popup._el local _DE = ru_popup._DE local _de = ru_popup._de local _JE = ru_popup._JE local _je = ru_popup._je local _EE = ru_popup._EE local _ee = ru_popup._ee -- Russian layout, bottom row of letters local _YA = ru_popup._YA local _ya = ru_popup._ya local _CH = ru_popup._CH local _ch = ru_popup._ch local _ES = ru_popup._ES local _es = ru_popup._es local _EM = ru_popup._EM local _em = ru_popup._em local _II = ru_popup._II local _ii = ru_popup._ii local _TE = ru_popup._TE local _te = ru_popup._te local _SH = ru_popup._SH local _sh = ru_popup._sh -- the Russian soft/hard sign local _BE = ru_popup._BE local _be = ru_popup._be local _YU = ru_popup._YU local _yu = ru_popup._yu -- other local _1_ = ru_popup._1_ -- numeric key 1 local _1p = ru_popup._1p -- numeric key 1, popup sibling (they have north swipe ups of each other, the rest is the same) local _1n = ru_popup._1n -- numpad key 1 local _1s = ru_popup._1s -- superscript key 1 local _2_ = ru_popup._2_ local _2p = ru_popup._2p local _2n = ru_popup._2n local _2s = ru_popup._2s local _3_ = ru_popup._3_ local _3p = ru_popup._3p local _3n = ru_popup._3n local _3s = ru_popup._3s local _4_ = ru_popup._4_ local _4p = ru_popup._4p local _4n = ru_popup._4n local _4s = ru_popup._4s local _5_ = ru_popup._5_ local _5p = ru_popup._5p local _5n = ru_popup._5n local _5s = ru_popup._5s local _6_ = ru_popup._6_ local _6p = ru_popup._6p local _6n = ru_popup._6n local _6s = ru_popup._6s local _7_ = ru_popup._7_ local _7p = ru_popup._7p local _7n = ru_popup._7n local _7s = ru_popup._7s local _8_ = ru_popup._8_ local _8p = ru_popup._8p local _8n = ru_popup._8n local _8s = ru_popup._8s local _9_ = ru_popup._9_ local _9p = ru_popup._9p local _9n = ru_popup._9n local _9s = ru_popup._9s local _0_ = ru_popup._0_ local _0p = ru_popup._0p local _0n = ru_popup._0n local _0s = ru_popup._0s local sla = ru_popup.sla local sl2 = ru_popup.sl2 local eql = ru_popup.eql local eq2 = ru_popup.eq2 local pls = ru_popup.pls local pl2 = ru_popup.pl2 local mns = ru_popup.mns local mn2 = ru_popup.mn2 local dsh = ru_popup.dsh local dgr = ru_popup.dgr local tpg = ru_popup.tpg local mth = ru_popup.mth local mt2 = ru_popup.mt2 local int = ru_popup.int local dif = ru_popup.dif local df2 = ru_popup.df2 local ls1 = ru_popup.ls1 local ls2 = ru_popup.ls2 local mr1 = ru_popup.mr1 local mr2 = ru_popup.mr2 local pdc = ru_popup.pdc local pd2 = ru_popup.pd2 local bar = ru_popup.bar local prm = ru_popup.prm local hsh = ru_popup.hsh local hs2 = ru_popup.hs2 return { min_layer = 1, max_layer = 4, shiftmode_keys = { [""] = true }, symbolmode_keys = { ["⌥"] = true }, utf8mode_keys = { ["🌐"] = true }, -- Width of any key can be modified by adding "width = 1.0, " in the list. keys = { -- First row { -- R r S s { _1p, _1_, "`", "!", }, { _2p, _2_, "‘", "¡", }, { _3p, _3_, "’", dsh, }, { _4p, _4_, "“", "_", }, { _5p, _5_, "”", quo, }, { _6p, _6_, eq2, eql, }, { _7p, _7_, _7s, _7n, }, { _8p, _8_, _8s, _8n, }, { _9p, _9_, _9s, _9n, }, { _0p, _0_, sec, cse, }, { sec, cse, "Ѣ", "ѣ", }, -- comma/semicolon with CSS popup block, plus Russian old letter yat (ять) }, -- Second row { -- R r S s { _YK, _yk, dif, "?", }, { _TS, _ts, int, "¿", }, { _UU, _uu, mth, "~", }, { _KK, _kk, mt2, "\\", }, { _YE, _ye, df2, bar, }, { _EN, _en, sl2, sla, }, { _GG, _gg, _4s, _4n, }, { _WA, _wa, _5s, _5n, }, { _WE, _we, _6s, _6n, }, { _ZE, _ze, mn2, mns, }, { _HA, _ha, "Ѳ", "ѳ", }, -- Russian old letter fita (фита) }, -- Third row { -- R r S s { _EF, _ef, ls2, ls1, }, { _YY, _yy, mr2, mr1, }, { _VE, _ve, dgr, "(", }, { _AA, _aa, tpg, ")", }, { _PE, _pe, hs2, hsh, }, { _ER, _er, pd2, pdc, }, { _OO, _oo, _1s, _1n, }, { _EL, _el, _2s, _2n, }, { _DE, _de, _3s, _3n, }, { _JE, _je, pl2, pls, }, { _EE, _ee, "Ѵ", "ѵ", }, -- Russian old letter izhitsa (ижица) }, -- Fourth row { -- R r S s { label = "", width = 1.0, }, -- Shift { _YA, _ya, prm, "{", }, { _CH, _ch, "°", "}", }, { _ES, _es, "«", "«", }, { _EM, _em, "»", "»", }, { _II, _ii, "„", "[", }, { _TE, _te, "”", "]", }, { _SH, _sh, _0s, _0n, }, { _BE, _be, "↑", "↑", }, { _YU, _yu, "↓", "↓", }, { label = "", width = 1.0, }, -- Backspace }, -- Fifth row { -- R r S s { label = "⌥", width = 1.5, bold = true, }, -- SYM key { label = "🌐", }, -- Globe key { cop, pco, cop, pco, }, -- period/colon with RegEx popup block { label = "_", " ", " ", " ", " ", width = 4.0, }, -- Spacebar { label = "←", }, -- Arrow left { label = "→", }, -- Arrow right { label = "⮠", "\n","\n","\n","\n", width = 1.5, }, -- Enter }, }, }
agpl-3.0
dr01d3r/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Qutiba.lua
27
2282
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Qutiba -- Type: Standard NPC -- @pos 92.341 -7.5 -129.980 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local vanishProg = player:getVar("vanishingactCS"); if (player:getVar("deliveringTheGoodsCS") == 1) then player:startEvent(0x0028); elseif (player:getQuestStatus(AHT_URHGAN,DELIVERING_THE_GOODS) == QUEST_COMPLETED and vanishProg == 1) then player:startEvent(0x002a); elseif (vanishProg == 2) then player:startEvent(0x0036); elseif (vanishProg == 4 and player:hasKeyItem(RAINBOW_BERRY)) then player:startEvent(0x002d); else player:startEvent(0x0033); 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 == (0x028)) then player:setVar("deliveringTheGoodsCS",2); elseif (csid == 0x002a and option == 0) then player:addQuest(AHT_URHGAN,VANISHING_ACT); player:setVar("vanishingactCS",2); elseif (csid == 0x002d) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,2185); else player:setVar("vanishingactCS",0); player:delKeyItem(RAINBOW_BERRY); player:addItem(2185,1); player:messageSpecial(ITEM_OBTAINED,2185); player:completeQuest(AHT_URHGAN,VANISHING_ACT); end end end;
gpl-3.0
dr01d3r/darkstar
scripts/globals/items/dish_of_spaghetti_nero_di_seppia.lua
12
1809
----------------------------------------- -- ID: 5193 -- Item: dish_of_spaghetti_nero_di_seppia -- Food Effect: 30Min, All Races ----------------------------------------- -- HP % 17 (cap 130) -- Dexterity 3 -- Vitality 2 -- Agility -1 -- Mind -2 -- Charisma -1 -- Double Attack 1 -- Store TP 6 ----------------------------------------- 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,5193); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 17); target:addMod(MOD_FOOD_HP_CAP, 130); target:addMod(MOD_DEX, 3); target:addMod(MOD_VIT, 2); target:addMod(MOD_AGI, -1); target:addMod(MOD_MND, -2); target:addMod(MOD_CHR, -1); target:addMod(MOD_DOUBLE_ATTACK, 1); target:addMod(MOD_STORETP, 6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 17); target:delMod(MOD_FOOD_HP_CAP, 130); target:delMod(MOD_DEX, 3); target:delMod(MOD_VIT, 2); target:delMod(MOD_AGI, -1); target:delMod(MOD_MND, -2); target:delMod(MOD_CHR, -1); target:delMod(MOD_DOUBLE_ATTACK, 1); target:delMod(MOD_STORETP, 6); end;
gpl-3.0
asmagill/hammerspoon-config
_gists/graphpaper.lua
1
5132
-- save file in ~/.hammerspoon and use as follows: -- -- graph = require("graphpaper") -- images = graph.fillScreen(x,y,screen) -- all three parameters are optional. x and y specify the graph size in screen points. -- default 10 for x, default whatever x is for y, default hs.screen.mainScreen() for screen -- -- so, on a MacBook Air with a 1920x900 non-retina screen: `images = graph.fillScreen(20)` -- images will be an array of 6 images. The array has a metatable set replicating the hs.drawing methods -- and applies them to all elements of the array, so you can show the graph with: -- -- images:setAlpha(.5):show() -- -- which is just a shorthand for: -- -- for i, v in ipairs(images) do v:setAlpha(.5):show() end -- -- Note, in multi-monitor setups, this should only create drawings for the main (or specified, if the parameter is provided) -- monitor. In some cases, depending upon size of display and graph size, pre 0.9.42 versions of Hammerspoon will display -- some edge portions on the wrong monitor... we can't do anything about that without significant changes to this code. -- Hammerspoon 0.9.42 and later, however, have a work around included here. See the end of module.fillScreen for more details. local module = {} local markers = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" } local availableLines = math.floor(#markers / 2) local mt = {} for k, v in pairs(hs.getObjectMetatable("hs.drawing")) do mt[k] = function(_, ...) for a, b in ipairs(_) do v(b, ...) end return _ end end local graphWithSpacing = function(x,y) x = x or 10 y = y or x local rows = {} rows[2] = "" for i = 1, availableLines do rows[1 + (i - 1) * y] = markers[i] .. string.rep(".", x * availableLines - 2) .. markers[i] rows[2] = rows[2] .. markers[i + availableLines] .. string.rep(".", x - 1) end rows[y * availableLines] = rows[2] for i = 1, (y * availableLines) do if not rows[i] then rows[i] = string.rep(".", x * availableLines) end end return hs.drawing.image({x = 0, y = 0, h = y * availableLines, w = x * availableLines}, hs.image.imageFromASCII(table.concat(rows, "\n"), {{ strokeColor = {alpha = 1}, fillColor = {alpha = 0}, strokeWidth = 1, shouldClose = false, antialias = false, }})) --:imageScaling("scaleToFit") end local fillScreen = function(x, y, which) if type(x) == "number" and type(y) ~= "number" then which = y elseif type(x) ~= "number" then which = x end x = type(x) == "number" and x or 10 y = type(y) == "number" and y or x which = which or hs.screen.mainScreen() local whichRect = which:fullFrame() local d = {} local width = math.ceil(whichRect.w / (x * availableLines)) local height = math.ceil(whichRect.h / (y * availableLines)) local wOnRatio = (whichRect.w / (x * availableLines)) - (width - 1) local hOnRatio = (whichRect.h / (y * availableLines)) - (height - 1) for i = 1, width do for j = 1, height do local h, w = y * availableLines, x * availableLines -- correct for OS X's naive assumption that the monitor with "most" of the window visible is the one we want. -- only works with 0.9.42 and later. Previous versions will *mostly* work, but in some cases, if an image -- making up part of the graph is *mostly* on another monitor, the windowserver automatically moves it and we -- can't stop it (at least I haven't found a way to). So you'll have to upgrade or tweak the graph size. local v1,v2,v3 = hs.processInfo.version:match("^(%d+)%.(%d+)%.(%d+)$") local tooEarlyToCorrect = false if tonumber(v1) < 1 and tonumber(v2) < 10 and tonumber(v3) < 42 then tooEarlyToCorrect = true end if not tooEarlyToCorrect then if i == width then w = w * wOnRatio end if j == height then h = h * hOnRatio end end table.insert(d, graphWithSpacing(x, y):setFrame{ x = whichRect.x + (i - 1) * (x * availableLines), y = whichRect.y + (j - 1) * (y * availableLines), h = h, w = w }) if not tooEarlyToCorrect then d[#d]:imageScaling("none") end end end return setmetatable(d, {__index = mt}) end module.fillScreen = fillScreen module.graphWithSpacing = graphWithSpacing return module
mit
SalvationDevelopment/Salvation-Scripts-Production
c51549976.lua
6
1707
--ファイナル・インゼクション function c51549976.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c51549976.cost) e1:SetTarget(c51549976.target) e1:SetOperation(c51549976.activate) c:RegisterEffect(e1) end function c51549976.cfilter(c) return c:IsFaceup() and c:IsSetCard(0x56) and c:IsAbleToGraveAsCost() end function c51549976.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c51549976.cfilter,tp,LOCATION_ONFIELD,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c51549976.cfilter,tp,LOCATION_ONFIELD,0,5,5,nil) Duel.SendtoGrave(g,REASON_COST) end function c51549976.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c51549976.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(0,1) e1:SetCondition(c51549976.actcon) e1:SetValue(c51549976.aclimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function c51549976.actcon(e) local ph=Duel.GetCurrentPhase() return ph>PHASE_MAIN1 and ph<PHASE_MAIN2 end function c51549976.aclimit(e,re,tp) return re:GetHandler():IsType(TYPE_MONSTER) and re:GetHandler():IsLocation(LOCATION_HAND+LOCATION_GRAVE) end
gpl-2.0
dr01d3r/darkstar
scripts/globals/mobskills/Heavy_Stomp.lua
33
1070
--------------------------------------------- -- Heavy Stomp -- -- Description: Deals heavy damage to targets within an area of effect. Additional effect: Paralysis -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows -- Range: Unknown radial -- Notes: Paralysis effect has a very long duration. --------------------------------------------- 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 = math.random(2,3); local accmod = 1; local dmgmod = .7; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded); local typeEffect = EFFECT_PARALYSIS; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 15, 0, 360); target:delHP(dmg); return dmg; end;
gpl-3.0
dr01d3r/darkstar
scripts/zones/Castle_Oztroja/npcs/_47y.lua
14
1429
----------------------------------- -- Area: Castle Oztroja -- NPC: _47y (Torch Stand) -- Notes: Opens door _474 -- @pos -57.575 24.218 -67.651 151 ----------------------------------- package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Castle_Oztroja/TextIDs"); require("scripts/globals/settings"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) DoorID = npc:getID() - 3; local DoorA = GetNPCByID(DoorID):getAnimation(); local TorchStandA = npc:getAnimation(); Torch1 = npc:getID(); Torch2 = npc:getID() + 1; if (DoorA == 9 and TorchStandA == 9) then player:startEvent(0x000a); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) if (option == 1) then GetNPCByID(Torch1):openDoor(10); -- Torch Lighting GetNPCByID(Torch2):openDoor(10); -- Torch Lighting GetNPCByID(DoorID):openDoor(6); end end; -- printf("CSID: %u",csid); -- printf("RESULT: %u",option);
gpl-3.0
dr01d3r/darkstar
scripts/zones/Selbina/npcs/Yaya.lua
14
1465
----------------------------------- -- Area: Selbina -- NPC: Yaya -- Starts Quest: Under the sea -- @pos -19 -2 -16 248 ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Selbina/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getFameLevel(SELBINA) >= 2 and player:getQuestStatus(OTHER_AREAS,UNDER_THE_SEA) == QUEST_AVAILABLE) then player:startEvent(0x001f); -- Start quest "Under the sea" else player:startEvent(0x0099); -- Standard dialog 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 == 0x001f) then player:addQuest(OTHER_AREAS,UNDER_THE_SEA); player:setVar("underTheSeaVar",1); end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-Production
c86016245.lua
9
1368
--弱者の意地 function c86016245.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(86016245,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetRange(LOCATION_SZONE) e2:SetCondition(c86016245.drcon) e2:SetTarget(c86016245.drtg) e2:SetOperation(c86016245.drop) c:RegisterEffect(e2) end function c86016245.drcon(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() local bc=tc:GetBattleTarget() return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 and eg:GetCount()==1 and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE) and bc:IsRelateToBattle() and bc:IsControler(tp) and bc:IsLevelBelow(2) end function c86016245.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c86016245.drop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)~=0 then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
gpl-2.0
teleaqrab/MR
plugins/remmsgs.lua
2
1054
local function history(extra, suc, result) for i=1, #result do delete_msg(result[i].id, ok_cb, false) end if tonumber(extra.con) == #result then send_msg(extra.chatid, 'ℹ "'..#result..'" پیام اخیر سوپر گروه حذف شد', ok_cb, false) else send_msg(extra.chatid, 'ℹ️ تمام پیام های سوپر گروه حذف شد', ok_cb, false) end end local function run(msg, matches) if matches[1] == 'remmsg' then if permissions(msg.from.id, msg.to.id, "settings") then if msg.to.type == 'channel' then if tonumber(matches[2]) > 99 or tonumber(matches[2]) < 1 then return '🚫 '..lang_text(msg.to.id, 'require_down100') end get_history(msg.to.peer_id, matches[2] + 1 , history , {chatid = msg.to.peer_id, con = matches[2]}) else return '🚫 '..lang_text(msg.to.id, 'onlychannel') end else return '🚫 '..lang_text(msg.to.id, 'require_mod') end end end return { patterns = { '^[!/#](remmsg) (%d*)$' }, run = run }
agpl-3.0
dr01d3r/darkstar
scripts/zones/Phomiuna_Aqueducts/npcs/_0ro.lua
14
1644
----------------------------------- -- Area: Phomiuna_Aqueducts -- NPC: Oil lamp -- @pos -60 -23 60 27 ----------------------------------- package.loaded["scripts/zones/Phomiuna_Aqueducts/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/Phomiuna_Aqueducts/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local DoorOffset = npc:getID(); player:messageSpecial(LAMP_OFFSET+4); -- ice lamp npc:openDoor(7); -- lamp animation local element = VanadielDayElement(); --printf("element: %u",element); if (element == 0) then -- fireday if (GetNPCByID(DoorOffset+6):getAnimation() == 8) then -- lamp fire open? GetNPCByID(DoorOffset-3):openDoor(15); -- Open Door _0rk end elseif (element == 4) then -- iceday if (GetNPCByID(DoorOffset+5):getAnimation() == 8) then -- lamp wind open? GetNPCByID(DoorOffset-3):openDoor(15); -- Open Door _0rk end 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
HHmmominion/basemmominion
LuaMods/minionlib/ml_marker_mgr.lua
1
30231
--ml_marker_mgr is a gwen GUI for editing general marker information --it should ALWAYS remain independent from any game-specific data -- --the game implementation is responsible for the following: --(1) creating marker templates (see setup example) --(2) overriding the GetPosition() function so that it returns a valid player position --(3) setting markerPath to the proper location for reading/writing marker files ml_marker_mgr = {} ml_marker_mgr.version = 1.0 ml_marker_mgr.parentWindow = nil ml_marker_mgr.mainwindow = { name = GetStringML("markerManager"), x = 340, y = 50, w = 250, h = 300} ml_marker_mgr.editwindow = { name = GetStringML("editMarker"), w = 250, h = 300} ml_marker_mgr.markerList = {} ml_marker_mgr.renderList = {} ml_marker_mgr.currentMarker = {} --current marker selected by the GetNextMarker() function ml_marker_mgr.currentEditMarker = {} --current marker displayed in the edit window ml_marker_mgr.markersLoaded = false --CREATE THIS LIST IN GAME IMPLEMENTATION ml_marker_mgr.templateList = {} --list of marker templates for defining marker types and creating new markers --SET THIS PATH IN GAME IMPLEMENTATION ml_marker_mgr.markerPath = "" -- OVERRIDE THIS FUNCTION IN GAME IMPLEMENTATION function ml_marker_mgr.GetPosition() return {x = 0.0, y = 0.0, z = 0.0, h = 0.0} end -- OVERRIDE THIS FUNCTION IN GAME IMPLEMENTATION function ml_marker_mgr.GetLevel() return 99 end -- OVERRIDE THIS FUNCTION IN GAME IMPLEMENTATION function ml_marker_mgr.DrawMarker(marker) return false end -- ACCESSORS -- Global function to get current marker function GetCurrentMarker() if (ValidTable(ml_task_hub:CurrentTask())) then if (ValidTable(ml_task_hub:CurrentTask().currentMarker)) then return ml_task_hub:CurrentTask().currentMarker end end if (ValidTable(ml_task_hub:RootTask())) then if (ValidTable(ml_task_hub:RootTask().currentMarker)) then return ml_task_hub:RootTask().currentMarker end end return nil end function ml_marker_mgr.GetList(markerType, filterEnabled, filterLevel) local list = ml_marker_mgr.markerList[markerType] local newlist = {} if (list) then for name, marker in pairs(list) do local addMarker = true if (filterEnabled and marker.order < 1) then addMarker = false end if (filterLevel) then local level = ml_marker_mgr.GetLevel() if (marker:GetMinLevel() > level or marker:GetMaxLevel() < level) then addMarker = false end end if (addMarker) then newlist[name] = marker end end end return newlist end function ml_marker_mgr.GetListByOrder(markerType, filterLevel) local list = ml_marker_mgr.GetList(markerType, true, filterLevel) if (ValidTable(list)) then local orderedList = {} for name, marker in pairs(list) do orderedList[marker.order] = marker end if (ValidTable(orderedList)) then return orderedList end end end function ml_marker_mgr.GetMarker(markerName) for _, list in pairs(ml_marker_mgr.markerList) do for name, marker in pairs(list) do if (name == markerName) then return marker end end end ml_debug("No marker data for marker name "..markerName.." found in the marker list") return nil end function ml_marker_mgr.GetMarkerByOrder(type, order) local list = ml_marker_mgr.GetList(type, false) if (list) then for name, marker in pairs(list) do if (marker.order == order) then return marker end end end ml_debug("No marker data for marker with order "..tostring(order).." found in the marker list") return nil end function ml_marker_mgr.GetLastMarker(markerType) local lastMarker = nil local markerList = ml_marker_mgr.GetList(markerType, true) if (markerList) then for name, marker in pairs(markerList) do if (lastMarker == nil or marker.order > lastMarker.order) then lastMarker = marker end end end return lastMarker end function ml_marker_mgr.GetNextMarker(markerType, filterLevel) if (gMarkerMgrMode == GetStringML("singleMarker")) then if (ValidTable(ml_marker_mgr.currentMarker) and ml_marker_mgr.currentMarker:GetType() ~= markerType) then local markerName = Settings.minionlib.lastSelectedMarker[markerType] if (markerName) then local marker = ml_marker_mgr.GetMarker(markerName) if (marker) then ml_marker_mgr.currentMarker = marker return marker end else ml_debug("Error in GetNextMarker_SingleMode - nil entry for last marker of type "..markerType) end else local marker = ml_marker_mgr.GetMarker(gMarkerMgrName) if (marker) then ml_marker_mgr.currentMarker = marker return marker else ml_debug("Error in GetNextMarker_SingleMode - no marker found matching "..gMarkerMgrName) end end elseif (gMarkerMgrMode == GetStringML("randomMarker")) then local list = ml_marker_mgr.GetList(markerType, true, filterLevel) if (ValidTable(list)) then local marker = GetRandomTableEntry(list) if (ValidTable(marker)) then ml_marker_mgr.currentMarker = marker return marker end end elseif (gMarkerMgrMode == GetStringML("markerList")) then --lots of repeat code in this conditional. many of these cases could be dumped together but --keeping them separate for now in case we decide to handle one differently during testing local list = ml_marker_mgr.GetListByOrder(markerType, filterLevel) if (ValidTable(list)) then -- compress the list indices so that we can iterate through them properly local counter = 1 for order, marker in pairsByKeys(list) do --d("Order:"..tostring(order)..",Counter:"..tostring(counter)..",Marker:"..tostring(marker:GetName())) list[counter] = marker counter = counter + 1 end local firstMarker = list[1] if (ValidTable(ml_marker_mgr.currentMarker)) then if (ml_marker_mgr.currentMarker:GetType() == markerType) then --d("Marker Type:"..tostring(markerType)) --get the next marker in the sequence local nextMarker = nil for index, marker in pairsByKeys(list) do --d("Current Order:"..tostring(ml_marker_mgr.currentMarker.order)) if (marker.order == ml_marker_mgr.currentMarker.order) then d("Returning index:"..tostring(index+1)) nextMarker = list[index+1] break end end if (nextMarker) then --d("nextMarker exists, return it:"..tostring(nextMarker:GetName())) ml_marker_mgr.currentMarker = nextMarker return nextMarker else ml_debug("GetNextMarker end of list - returning first marker for type "..markerType) --d("nextMarker doesnt exist, return first:"..tostring(firstMarker:GetName())) ml_marker_mgr.currentMarker = firstMarker return firstMarker end else ml_debug("Type "..markerType.." is not the same as current marker type. Returning first marker in list") --d("markerType is not equal, return first:"..tostring(firstMarker:GetName())) ml_marker_mgr.currentMarker = firstMarker return firstMarker end else --d("Returning first marker"..firstMarker:GetName()) ml_marker_mgr.currentMarker = firstMarker return firstMarker end else ml_debug("No markers returned for params") end end ml_debug("Error in ml_marker_mgr.GetNextMarker()") end function ml_marker_mgr.GetClosestMarker( x, y, z, radius, markertype) local closestmarker local closestmarkerdistance if ( TableSize(ml_marker_mgr.markerList) > 0 ) then for mtype,_ in pairs(ml_marker_mgr.markerList) do if ( not markertype or mtype == markertype ) then local markerlist = ml_marker_mgr.GetList(mtype, false) if ( TableSize(markerlist) > 0 ) then for name, marker in pairs(markerlist) do if ( type(marker) == "table" ) then mpos = marker:GetPosition() if (TableSize(mpos)>0) then local dist = Distance3D ( mpos.x, mpos.y, mpos.z, x, y, z) if ( dist < radius and ( closestmarkerdistance == nil or closestmarkerdistance > dist ) ) then closestmarkerdistance = dist closestmarker = marker end end else d("Error in ml_marker_mgr.GetClosestMarker, type(marker) != table") end end end end end end return closestmarker end --LIST MODIFICATION FUNCTIONS function ml_marker_mgr.AddMarker(newMarker) if (not newMarker:GetName() or not newMarker:GetType()) then ml_debug("Invalid marker - No name or type specified") return false end local found = false for _, list in pairs(ml_marker_mgr.markerList) do for name, marker in pairs(list) do if (name == newMarker:GetName()) then ml_debug("Marker "..newMarker:GetName().." cannot be added because another marker with that name already exists") return false end end end -- Set the marker order to be next in the list local lastMarker = ml_marker_mgr.GetLastMarker(newMarker:GetType()) if (lastMarker) then newMarker.order = lastMarker.order + 1 else newMarker.order = 1 end local markerList = ml_marker_mgr.markerList[newMarker:GetType()] if not markerList then markerList = {} ml_marker_mgr.markerList[newMarker:GetType()] = markerList end markerList[newMarker:GetName()] = newMarker ml_marker_mgr.renderList[newMarker:GetName()] = ml_marker_mgr.DrawMarker(newMarker) return true end function ml_marker_mgr.AddMarkerTemplate(templateMarker) if (ValidTable(templateMarker)) then ml_marker_mgr.templateList[templateMarker:GetType()] = templateMarker end end function ml_marker_mgr.DeleteMarker(oldMarker) if ( ml_marker_mgr.markerPath == "" or not FileExists(ml_marker_mgr.markerPath)) then d("ml_marker_mgr.DeleteMarker: Invalid MarkerPath : "..ml_marker_mgr.markerPath) return false end if type(oldMarker) == "string" then oldMarker = ml_marker_mgr.GetMarker(oldMarker) end if (not oldMarker:GetName()) then ml_debug("Invalid marker - No name specified") return false end for _, list in pairs(ml_marker_mgr.markerList) do for name, marker in pairs(list) do if (name == oldMarker:GetName()) then list[name] = nil --RenderManager:RemoveObject(ml_marker_mgr.renderList[name]) -- this does not work out of some magically unknown reason ml_marker_mgr.renderList[name] = nil ml_marker_mgr.WriteMarkerFile(ml_marker_mgr.markerPath) GUI_WindowVisible(ml_marker_mgr.editwindow.name, false) ml_marker_mgr.DrawMarkerList() -- added this for now to refresh the drawn markers after deleting one..seems to do the job fine return true end end end return false end function ml_marker_mgr.NewMarker() local templateMarker = ml_marker_mgr.currentEditMarker local newMarker = nil if (ValidTable(templateMarker)) then newMarker = templateMarker:Copy() else templateMarker = ml_marker_mgr.templateList[gMarkerMgrType] if (ValidTable(templateMarker)) then newMarker = templateMarker:Copy() newMarker:SetName(newMarker:GetType()) else ml_error("No Marker Types defined!") end end if (ValidTable(newMarker)) then --add a random number onto the name until the string is unique local name = "" local tries = 0 repeat name = newMarker:GetName()..tostring(math.random(1,99)) -- just a little check here to ensure we never get stuck in an infinite loop -- if somehow some idiot has the same marker name with 1-99 already tries = tries + 1 until ml_marker_mgr.GetMarker(name) == nil or tries > 99 newMarker:SetName(name) newMarker:SetPosition(ml_marker_mgr.GetPosition()) ml_marker_mgr.AddMarker(newMarker) ml_marker_mgr.CreateEditWindow(newMarker) ml_marker_mgr.RefreshMarkerNames() end end function ml_marker_mgr.AddMarkerToList() local marker = ml_marker_mgr.GetMarker(gMarkerMgrName) if (ValidTable(marker) and marker.order == 0) then local lastMarker = ml_marker_mgr.GetLastMarker(gMarkerMgrType) if (ValidTable(lastMarker)) then marker.order = lastMarker.order + 1 ml_marker_mgr.RefreshMarkerNames() else marker.order = 1 ml_marker_mgr.RefreshMarkerNames() end end end -- iterates through marker list with order gaps and compresses the order values function ml_marker_mgr.CleanMarkerOrder(markerType) local list = ml_marker_mgr.GetList(markerType, true) if (ValidTable(list)) then local orderedList = {} for name, marker in pairs(list) do orderedList[marker.order] = marker end if (ValidTable(orderedList)) then local counter = 1 for order, marker in spairs(orderedList) do marker.order = counter counter = counter + 1 end end for name, marker in pairs(ml_marker_mgr.markerList[markerType]) do for order, modMarker in pairs(orderedList) do if modMarker.name == name then marker.order = order end end end if ( ml_marker_mgr.markerPath == "" or not FileExists(ml_marker_mgr.markerPath)) then d("ml_marker_mgr.CleanMarkerOrder: Invalid MarkerPath : "..ml_marker_mgr.markerPath) return false end ml_marker_mgr.WriteMarkerFile(ml_marker_mgr.markerPath) end end function ml_marker_mgr.ClearMarkerList() ml_marker_mgr.markerList = {} ml_marker_mgr.renderList = {} RenderManager:RemoveAllObjects() ml_marker_mgr.markersLoaded = false end function ml_marker_mgr.DrawMarkerList() ml_marker_mgr.renderList = {} RenderManager:RemoveAllObjects() --only draw templated markers for markerType, marker in pairs(ml_marker_mgr.templateList) do local list = ml_marker_mgr.GetList(markerType) if (ValidTable(list)) then for name, marker in pairs(list) do ml_marker_mgr.DrawMarker(marker) end end end end --IO FUNCTIONS function ml_marker_mgr.ReadMarkerFile(path) local markerList = persistence.load(path) -- needs to be set, else the whole markermanager breaks when a mesh without a .info file is beeing loaded if ( ValidString(path) ) then ml_marker_mgr.markerPath = path end if (ValidTable(markerList)) then ml_marker_mgr.markerList = markerList for type, list in pairs(ml_marker_mgr.markerList) do local templateMarker = ml_marker_mgr.templateList[type] if (ValidTable(templateMarker)) then for name, marker in pairs(list) do -- set marker class metatable for each marker setmetatable(marker, {__index = ml_marker}) for name, fieldTable in pairs(templateMarker.fields) do if (not marker:HasField(name)) then marker:AddField(templateMarker:GetFieldType(name), name, templateMarker:GetFieldValue(name)) end end end end end ml_marker_mgr.markersLoaded = true else ml_debug("Invalid path specified for marker file") end end function ml_marker_mgr.WriteMarkerFile(path) if ( path == "" ) then d("ml_marker_mgr.WriteMarkerFile: Invalid Path : "..path) return false end persistence.store(path, ml_marker_mgr.markerList) end --GUI Refresh Functions function ml_marker_mgr.RefreshMarkerTypes() if (ValidTable(ml_marker_mgr.templateList)) then local typestring = "" local found = false local first = nil for name, marker in pairs(ml_marker_mgr.templateList) do if (typestring == "") then typestring = marker:GetType() first = typestring else typestring = typestring..","..marker:GetType() end if (marker:GetType() == gMarkerMgrType) then found = true end end gMarkerMgrType_listitems = typestring if (not found or gMarkerMgrType == "") then gMarkerMgrType = first end end end function ml_marker_mgr.RefreshMarkerNames() if (ValidTable(ml_marker_mgr.markerList)) then ml_marker_mgr.CleanMarkerOrder(gMarkerMgrType) local list = ml_marker_mgr.GetList(gMarkerMgrType, false) if (ValidTable(list)) then local markerNameList = GetComboBoxList(list) local namestring = "" if (markerNameList) then namestring = markerNameList["keyList"] local markerList = ml_marker_mgr.markerList[gMarkerMgrType] if (gMarkerMgrName == "" or not markerList or markerList[gMarkerMgrName] == nil) then gMarkerMgrName = markerNameList["firstKey"] or "" --if we've never selected a marker for this type then save the first marker if (gMarkerMgrName ~= "") then Settings.minionlib.lastSelectedMarker[gMarkerMgrType] = gMarkerMgrName Settings.minionlib.lastSelectedMarker = Settings.minionlib.lastSelectedMarker elseif (gMarkerMgrName == "") then ml_marker_mgr.WipeEditWindow() end end end gMarkerMgrName_listitems = namestring ml_marker_mgr.RefreshMarkerList() else gMarkerMgrName_listitems = "" ml_marker_mgr.RefreshMarkerList() end end end function ml_marker_mgr.RefreshMarkerList() if (ValidTable(ml_marker_mgr.markerList)) then ml_marker_mgr.CleanMarkerOrder(gMarkerMgrType) local window = GUI_GetWindowInfo(ml_marker_mgr.mainwindow.name) GUI_DeleteGroup(ml_marker_mgr.mainwindow.name, GetStringML("markerList")) local markerTable = {} local markerList = ml_marker_mgr.GetList(gMarkerMgrType, true) if (markerList) then for name, marker in pairs(markerList) do markerTable[marker.order] = marker end end if (TableSize(markerTable) > 0) then for index, marker in pairsByKeys(markerTable) do GUI_NewButton(ml_marker_mgr.mainwindow.name,marker:GetName(),"Marker_" .. tostring(marker:GetName()),GetStringML("markerList")) end end GUI_UnFoldGroup(ml_marker_mgr.mainwindow.name, GetStringML("markerList")) GUI_SizeWindow(ml_marker_mgr.mainwindow.name, window.width, window.height) end end function ml_marker_mgr.CreateEditWindow(marker) if (ValidTable(marker)) then ml_marker_mgr.currentEditMarker = marker local templateMarker = ml_marker_mgr.templateList[gMarkerMgrType] for fieldName, fieldTable in pairs(templateMarker.fields) do local choiceString = templateMarker:GetFieldChoices(fieldName) if not (marker:HasField(fieldName)) then marker:AddField(marker:GetFieldType(fieldName), fieldName, marker:GetFieldValue(fieldName), choiceString) end if (marker:GetFieldChoices(fieldName) ~= choiceString) then marker:SetFieldChoices(fieldName, choiceString) end end GUI_DeleteGroup(ml_marker_mgr.editwindow.name, GetStringML("markerFields")) local fieldNames = marker:GetFieldNames() if (ValidTable(fieldNames)) then for _, name in pairsByKeys(fieldNames) do local fieldType = marker:GetFieldType(name) if (fieldType == "float" or fieldType == "string") then GUI_NewField(ml_marker_mgr.editwindow.name,name,"Field_"..name, GetStringML("markerFields")) elseif (fieldType == "int") then GUI_NewNumeric(ml_marker_mgr.editwindow.name,name,"Field_"..name, GetStringML("markerFields")) elseif (fieldType == "button") then GUI_NewButton(ml_marker_mgr.editwindow.name,name,"Field_"..name, GetStringML("markerFields")) elseif (fieldType == "checkbox") then GUI_NewCheckbox(ml_marker_mgr.editwindow.name,name,"Field_"..name, GetStringML("markerFields")) elseif (fieldType == "combobox") then local choiceString = marker:GetFieldChoices(name) GUI_NewComboBox(ml_marker_mgr.editwindow.name,name,"Field_"..name, GetStringML("markerFields"), choiceString) end if (fieldType ~= "button") then _G["Field_"..name] = marker:GetFieldValue(name) end end end GUI_UnFoldGroup(ml_marker_mgr.editwindow.name, GetStringML("markerFields")) GUI_SizeWindow(ml_marker_mgr.editwindow.name,ml_marker_mgr.editwindow.w,ml_marker_mgr.editwindow.h) GUI_WindowVisible(ml_marker_mgr.editwindow.name, true) end end function ml_marker_mgr.WipeEditWindow() ml_marker_mgr.currentEditMarker = nil GUI_WindowVisible(ml_marker_mgr.editwindow.name, false) end -- GUI/Eventhandler functions function ml_marker_mgr.HandleInit() if (Settings.minionlib.gMarkerMgrMode == nil) then Settings.minionlib.gMarkerMgrMode = GetStringML("markerList") end if (Settings.minionlib.lastSelectedMarkerType == nil) then Settings.minionlib.lastSelectedMarkerType = GetStringML("grindMarker") end if (Settings.minionlib.lastSelectedMarker == nil) then Settings.minionlib.lastSelectedMarker = {} end -- main window GUI_NewWindow(ml_marker_mgr.mainwindow.name,ml_marker_mgr.mainwindow.x,ml_marker_mgr.mainwindow.y,ml_marker_mgr.mainwindow.w,ml_marker_mgr.mainwindow.h) GUI_NewComboBox(ml_marker_mgr.mainwindow.name,GetStringML("markerMode"),"gMarkerMgrMode",GetStringML("generalSettings"),"") GUI_NewComboBox(ml_marker_mgr.mainwindow.name,GetStringML("markerType"),"gMarkerMgrType",GetStringML("generalSettings"),"") GUI_NewComboBox(ml_marker_mgr.mainwindow.name,GetStringML("markerName"),"gMarkerMgrName",GetStringML("generalSettings"),"") GUI_NewButton(ml_marker_mgr.mainwindow.name,GetStringML("addMarker"),"ml_marker_mgr.AddMarkerToList",GetStringML("generalSettings")) RegisterEventHandler("ml_marker_mgr.AddMarkerToList",ml_marker_mgr.AddMarkerToList) GUI_NewButton(ml_marker_mgr.mainwindow.name,GetStringML("newMarker"),"ml_marker_mgr.NewMarker",GetStringML("generalSettings")) RegisterEventHandler("ml_marker_mgr.NewMarker",ml_marker_mgr.NewMarker) -- setup marker mode list gMarkerMgrMode_listitems = GetStringML("markerList")..","..GetStringML("singleMarker")..","..GetStringML("randomMarker") gMarkerMgrMode = Settings.minionlib.gMarkerMgrMode GUI_UnFoldGroup(ml_marker_mgr.mainwindow.name, GetStringML("generalSettings")) GUI_SizeWindow(ml_marker_mgr.mainwindow.name, ml_marker_mgr.mainwindow.w, ml_marker_mgr.mainwindow.h) GUI_WindowVisible(ml_marker_mgr.mainwindow.name,false) -- marker editor window GUI_NewWindow(ml_marker_mgr.editwindow.name, ml_marker_mgr.mainwindow.x+ml_marker_mgr.mainwindow.w, ml_marker_mgr.mainwindow.y, ml_marker_mgr.editwindow.w, ml_marker_mgr.editwindow.h,"",true) GUI_NewField(ml_marker_mgr.editwindow.name, "Placeholder", "gPlaceholder", GetStringML("markerFields")) GUI_NewButton(ml_marker_mgr.editwindow.name,GetStringML("deleteMarker"),"ml_marker_mgr.DeleteMarker") GUI_NewButton(ml_marker_mgr.editwindow.name,GetStringML("removeMarker"),"ml_marker_mgr.RemoveMarker") GUI_NewButton(ml_marker_mgr.editwindow.name,GetStringML("priorityDown"),"ml_marker_mgr.MarkerDown") GUI_NewButton(ml_marker_mgr.editwindow.name,GetStringML("priorityUp"),"ml_marker_mgr.MarkerUp") GUI_SizeWindow(ml_marker_mgr.editwindow.name,ml_marker_mgr.editwindow.w,ml_marker_mgr.editwindow.h) GUI_WindowVisible(ml_marker_mgr.editwindow.name,false) gMarkerMgrMode = Settings.minionlib.gMarkerMgrMode end function ml_marker_mgr.SetMarkerType(strType) gMarkerMgrType = strType ml_marker_mgr.RefreshMarkerNames() ml_marker_mgr.currentEditMarker = nil local lastSelected = Settings.minionlib.lastSelectedMarker if (ValidTable(lastSelected)) then if (lastSelected[gMarkerMgrType]) then gMarkerMgrName = lastSelected[gMarkerMgrType] end end end function ml_marker_mgr.GUIVarUpdate(Event, NewVals, OldVals) for k,v in pairs(NewVals) do if (k == "gMarkerMgrType") then Settings.minionlib.lastSelectedMarkerType = gMarkerMgrType ml_marker_mgr.RefreshMarkerNames() GUI_WindowVisible(ml_marker_mgr.editwindow.name,false) ml_marker_mgr.currentEditMarker = nil elseif (string.sub(k,1,6) == "Field_") then local name = string.sub(k,7) if (ValidTable(ml_marker_mgr.currentEditMarker)) then local value = nil if (ml_marker_mgr.currentEditMarker:GetFieldType(name) == "string") then value = v elseif (ml_marker_mgr.currentEditMarker:GetFieldType(name) == "checkbox") then value = tostring(v) elseif (ml_marker_mgr.currentEditMarker:GetFieldType(name) == "combobox") then value = v else value = tonumber(v) end --handle special case when name field is changed if (name == "Name") then local list = ml_marker_mgr.markerList[gMarkerMgrType] if (list) then --if another marker with this name exists then don't allow the update if(list[value] ~= nil) then return end list[ml_marker_mgr.currentEditMarker:GetFieldValue("Name")] = nil list[value] = ml_marker_mgr.currentEditMarker end end ml_marker_mgr.currentEditMarker:SetFieldValue(name, value) if (name == "Name") then ml_marker_mgr.RefreshMarkerNames() end if ( ml_marker_mgr.markerPath == "" or not FileExists(ml_marker_mgr.markerPath)) then d("ml_marker_mgr.GUIVarUpdate: Invalid MarkerPath : "..ml_marker_mgr.markerPath) else ml_marker_mgr.WriteMarkerFile(ml_marker_mgr.markerPath) end end elseif (k == "gMarkerMgrName") then if (v ~= "") then Settings.minionlib.lastSelectedMarker[gMarkerMgrType] = gMarkerMgrName Settings.minionlib.lastSelectedMarker = Settings.minionlib.lastSelectedMarker end elseif (k == "gMarkerMgrMode") then Settings.minionlib.gMarkerMgrMode = v end end end function ml_marker_mgr.GUIItem( evnttype , event ) local tokenlen = string.len("Marker_") local writeFile = false if (string.sub(event,1,tokenlen) == "Marker_") then local name = string.sub(event,tokenlen+1) local marker = ml_marker_mgr.GetMarker(name) if (marker) then ml_marker_mgr.CreateEditWindow(marker) end elseif (event == "ml_marker_mgr.RemoveMarker") then if (ValidTable(ml_marker_mgr.currentEditMarker)) then ml_marker_mgr.currentEditMarker.order = 0 ml_marker_mgr.CleanMarkerOrder(ml_marker_mgr.currentEditMarker:GetType()) ml_marker_mgr.RefreshMarkerList() writeFile = true end elseif (event == "ml_marker_mgr.MarkerUp") then if (ValidTable(ml_marker_mgr.currentEditMarker)) then local temp = ml_marker_mgr.currentEditMarker.order local tempMarker = ml_marker_mgr.GetMarkerByOrder(gMarkerMgrType, temp - 1) if (ValidTable(tempMarker)) then tempMarker.order = temp ml_marker_mgr.currentEditMarker.order = temp - 1 ml_marker_mgr.RefreshMarkerList() writeFile = true end end elseif (event == "ml_marker_mgr.MarkerDown") then if (ValidTable(ml_marker_mgr.currentEditMarker)) then local temp = ml_marker_mgr.currentEditMarker.order d(temp) local tempMarker = ml_marker_mgr.GetMarkerByOrder(gMarkerMgrType, temp + 1) if (ValidTable(tempMarker)) then tempMarker.order = temp ml_marker_mgr.currentEditMarker.order = temp + 1 ml_marker_mgr.RefreshMarkerList() writeFile = true end end elseif (event == "ml_marker_mgr.DeleteMarker") then if (ValidTable(ml_marker_mgr.currentEditMarker)) then ml_marker_mgr.DeleteMarker(ml_marker_mgr.currentEditMarker) ml_marker_mgr.RefreshMarkerTypes() ml_marker_mgr.RefreshMarkerNames() writeFile = true end end if (writeFile) then ml_marker_mgr.WriteMarkerFile(ml_marker_mgr.markerPath) end end function ml_marker_mgr.ToggleMenu() if (ml_marker_mgr.visible) then GUI_WindowVisible(ml_marker_mgr.mainwindow.name,false) GUI_WindowVisible(ml_marker_mgr.editwindow.name,false) ml_marker_mgr.visible = false else local wnd = GUI_GetWindowInfo(ml_marker_mgr.parentWindow.Name) if (wnd) then GUI_MoveWindow( ml_marker_mgr.mainwindow.name, wnd.x+wnd.width,wnd.y) GUI_WindowVisible(ml_marker_mgr.mainwindow.name,true) end ml_marker_mgr.visible = true end end function ml_marker_mgr.SetupTest() local grindMarker = ml_marker:Create("grindTemplate") grindMarker:SetType("Grind Marker") grindMarker:AddField("contentID=", string, "") grindMarker:AddField("NOTcontentID=", string, "") local botanyMarker = ml_marker:Create("botanyTemplate") botanyMarker:SetType("Botany Marker") botanyMarker:AddField("Priority 1 Item", string, "") botanyMarker:AddField("Priority 2 Item", string, "") local miningMarker = botanyMarker:Copy() miningMarker:SetName("miningTemplate") miningMarker:SetType("Mining Marker") if (TableSize(ml_marker_mgr.markerList) == 0) then local testMarker1 = ml_marker:Create("testMarker1") testMarker1:SetType("grindMarker") local testMarker2 = ml_marker:Create("testMarker2") testMarker2:SetType("grindMarker") local testMarker3 = ml_marker:Create("testMarker3") testMarker3:SetType("botanyMarker") --markers to test remove local testMarker4 = ml_marker:Create("testMarker4") testMarker4:SetType("grindMarker") local testMarker5 = ml_marker:Create("testMarker5") testMarker5:SetType("botanyMarker") ml_marker_mgr.AddMarker(testMarker1) ml_marker_mgr.AddMarker(testMarker2) ml_marker_mgr.AddMarker(testMarker3) ml_marker_mgr.AddMarker(testMarker4) ml_marker_mgr.AddMarker(testMarker5) -- remove via marker reference ml_marker_mgr.DeleteMarker(testMarker4) -- remove via string ml_marker_mgr.DeleteMarker("testMarker5") -- refresh markers for GUI gMarkerMgrType = "grindMarker" ml_marker_mgr.RefreshMarkerTypes() ml_marker_mgr.RefreshMarkerNames() ml_marker_mgr.RefreshMarkerList() ml_marker_mgr.WriteMarkerFile(ml_marker_mgr.profilePath) end end RegisterEventHandler("ToggleMarkerMgr", ml_marker_mgr.ToggleMenu) RegisterEventHandler("Module.Initalize",ml_marker_mgr.HandleInit) RegisterEventHandler("GUI.Update",ml_marker_mgr.GUIVarUpdate) RegisterEventHandler("GUI.Item",ml_marker_mgr.GUIItem)
gpl-2.0
dr01d3r/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Aligi-Kufongi.lua
27
3114
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Aligi-Kufongi -- Title Change NPC -- @pos -23 -21 15 26 ----------------------------------- require("scripts/globals/titles"); local title2 = { TAVNAZIAN_SQUIRE ,PUTRID_PURVEYOR_OF_PUNGENT_PETALS , MONARCH_LINN_PATROL_GUARD , SIN_HUNTER_HUNTER , DISCIPLE_OF_JUSTICE , DYNAMISTAVNAZIA_INTERLOPER , CONFRONTER_OF_NIGHTMARES , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title3 = { DEAD_BODY , FROZEN_DEAD_BODY , DREAMBREAKER , MIST_MELTER , DELTA_ENFORCER , OMEGA_OSTRACIZER , ULTIMA_UNDERTAKER , ULMIAS_SOULMATE , TENZENS_ALLY , COMPANION_OF_LOUVERANCE , TRUE_COMPANION_OF_LOUVERANCE , PRISHES_BUDDY , NAGMOLADAS_UNDERLING , ESHANTARLS_COMRADE_IN_ARMS , THE_CHEBUKKIS_WORST_NIGHTMARE , UNQUENCHABLE_LIGHT , WARRIOR_OF_THE_CRYSTAL , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title4 = { ANCIENT_FLAME_FOLLOWER , TAVNAZIAN_TRAVELER , TRANSIENT_DREAMER , THE_LOST_ONE , TREADER_OF_AN_ICY_PAST , BRANDED_BY_LIGHTNING , SEEKER_OF_THE_LIGHT , AVERTER_OF_THE_APOCALYPSE , BANISHER_OF_EMPTINESS , BREAKER_OF_THE_CHAINS , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title5 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title6 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title7 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0156,npcUtil.genTmask(player,title2),npcUtil.genTmask(player,title3),npcUtil.genTmask(player,title4),npcUtil.genTmask(player,title5),npcUtil.genTmask(player,title6),npcUtil.genTmask(player,title7),1 ,player:getGil()); 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 == 0x0156) then if (option > 0 and option <29) then if (player:delGil(200)) then player:setTitle( title2[option] ) end elseif (option > 256 and option <285) then if (player:delGil(300)) then player:setTitle( title3[option - 256] ) end elseif (option > 512 and option < 541) then if (player:delGil(400)) then player:setTitle( title4[option - 512] ) end end end end;
gpl-3.0
Goodzilam/Goodzila-bot
plugins/stats.lua
236
3989
do -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ['..user_id..']' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end local file = io.open("./groups/"..chat_id.."stats.txt", "w") file:write(text) file:flush() file:close() send_document("chat#id"..chat_id,"./groups/"..chat_id.."stats.txt", ok_cb, false) return --text end local function chat_stats2(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end return text end -- Save stats, ban user local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nGroups: '..r return text end local function run(msg, matches) if matches[1]:lower() == 'teleseed' then -- Put everything you like :) local about = _config.about_text local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ") return about end if matches[1]:lower() == "statslist" then if not is_momod(msg) then return "For mods only !" end local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats2(chat_id) end if matches[1]:lower() == "stats" then if not matches[2] then if not is_momod(msg) then return "For mods only !" end if msg.to.type == 'chat' then local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats(chat_id) else return end end if matches[2] == "teleseed" then -- Put everything you like :) if not is_admin(msg) then return "For admins only !" else return bot_stats() end end if matches[2] == "group" then if not is_admin(msg) then return "For admins only !" else return chat_stats(matches[3]) end end end end return { patterns = { "^[!/]([Ss]tats)$", "^[!/]([Ss]tatslist)$", "^[!/]([Ss]tats) (group) (%d+)", "^[!/]([Ss]tats) (teleseed)",-- Put everything you like :) "^[!/]([Tt]eleseed)"-- Put everything you like :) }, run = run } end
gpl-2.0
AutoJames/KkthnxUI_Legion
KkthnxUI/Modules/UnitFrames/Elements/ClassModules.lua
1
5892
local K, C, L = select(2, ...):unpack() if C.Unitframe.Enable ~= true then return end local _, ns = ... ns.classModule = {} local function updateTotemPosition() TotemFrame:ClearAllPoints() if (K.Class == "PALADIN" or K.Class == "DEATHKNIGHT") then local hasPet = oUF_KkthnxPet and oUF_KkthnxPet:IsShown() if (hasPet) then TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", -18, -12) else TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 17, 0) end elseif (K.Class == "DRUID") then local form = GetShapeshiftFormID() if (form == CAT_FORM) then TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 37, -5) else TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 57, 0) end elseif (K.Class == "MAGE") then TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", 0, -12) elseif (K.Class == "MONK") then TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", -18, -12) elseif (K.Class == "SHAMAN") then local form = GetShapeshiftFormID() if ((GetSpecialization() == SPEC_SHAMAN_RESTORATION) or (form == 16)) then -- wolf form TotemFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 27, 2) else TotemFrame:SetPoint("TOP", oUF_KkthnxPlayer, "BOTTOM", 27, -10) end elseif (K.Class == "WARLOCK") then TotemFrame:SetPoint("TOPLEFT", oUF_KkthnxPlayer, "BOTTOMLEFT", -18, -12) end end function ns.classModule.Totems(self) TotemFrame:ClearAllPoints() TotemFrame:SetParent(self) for i = 1, MAX_TOTEMS do local _, totemBorder = _G["TotemFrameTotem"..i]:GetChildren() if C.Blizzard.ColorTextures == true then totemBorder:GetRegions():SetVertexColor(unpack(C.Blizzard.TexturesColor)) end _G["TotemFrameTotem"..i]:SetFrameStrata("LOW") if C.Cooldown.Enable then _G["TotemFrameTotem"..i.. "Duration"]:SetParent(UIFrameHider) else _G["TotemFrameTotem"..i.. "Duration"]:SetParent(totemBorder) _G["TotemFrameTotem"..i.. "Duration"]:SetDrawLayer("OVERLAY") _G["TotemFrameTotem"..i.. "Duration"]:ClearAllPoints() _G["TotemFrameTotem"..i.. "Duration"]:SetPoint("BOTTOM", _G["TotemFrameTotem"..i], 0, 3) _G["TotemFrameTotem"..i.. "Duration"]:SetFont(C.Media.Font, 10, "OUTLINE") _G["TotemFrameTotem"..i.. "Duration"]:SetShadowOffset(0, 0) end end -- K.Noop these else we'll get a taint TotemFrame_AdjustPetFrame = K.Noop PlayerFrame_AdjustAttachments = K.Noop hooksecurefunc("TotemFrame_Update", updateTotemPosition) updateTotemPosition() end function ns.classModule.alternatePowerBar(self) self.AdditionalPower = K.CreateOutsideBar(self, false, 0, 0, 1) self.DruidMana = self.AdditionalPower self.AdditionalPower.colorPower = true self.AdditionalPower.Value = K.SetFontString(self.AdditionalPower, C.Media.Font, 13, nil, "CENTER") self.AdditionalPower.Value:SetPoint("CENTER", self.AdditionalPower, 0, 0.5) self.AdditionalPower.Value:Hide() self:Tag(self.AdditionalPower.Value, "[KkthnxUI:DruidMana]") end function ns.classModule.DEATHKNIGHT(self, config, uconfig) if (config.DEATHKNIGHT.showRunes) then RuneFrame:SetParent(self) RuneFrame_OnLoad(RuneFrame) RuneFrame:ClearAllPoints() RuneFrame:SetPoint("TOP", self, "BOTTOM", 33, -1) if (ns.config.playerStyle == "normal") then RuneFrame:SetFrameStrata("LOW") end for i = 1, 6 do local b = _G["RuneButtonIndividual"..i].Border if C.Blizzard.ColorTextures == true then b:GetRegions():SetVertexColor(unpack(C.Blizzard.TexturesColor)) end end end end function ns.classModule.MAGE(self, config, uconfig) if (config.MAGE.showArcaneStacks) then MageArcaneChargesFrame:SetParent(self) MageArcaneChargesFrame:ClearAllPoints() MageArcaneChargesFrame:SetPoint("TOP", self, "BOTTOM", 30, -0.5) return MageArcaneChargesFrame end end function ns.classModule.MONK(self, config, uconfig) if (config.MONK.showStagger) then -- Stagger Bar for tank monk MonkStaggerBar:SetParent(self) MonkStaggerBar_OnLoad(MonkStaggerBar) MonkStaggerBar:ClearAllPoints() MonkStaggerBar:SetPoint("TOP", self, "BOTTOM", 31, 0) if C.Blizzard.ColorTextures == true then MonkStaggerBar.MonkBorder:SetVertexColor(unpack(C.Blizzard.TexturesColor)) end MonkStaggerBar:SetFrameLevel(1) end if (config.MONK.showChi) then -- Monk combo points for Windwalker MonkHarmonyBarFrame:SetParent(self) MonkHarmonyBarFrame:ClearAllPoints() MonkHarmonyBarFrame:SetPoint("TOP", self, "BOTTOM", 31, 18) if C.Blizzard.ColorTextures == true then select(2, MonkHarmonyBarFrame:GetRegions()):SetVertexColor(unpack(C.Blizzard.TexturesColor)) end return MonkHarmonyBarFrame end end function ns.classModule.PALADIN(self, config, uconfig) if (config.PALADIN.showHolyPower) then PaladinPowerBarFrame:SetParent(self) PaladinPowerBarFrame:ClearAllPoints() PaladinPowerBarFrame:SetPoint("TOP", self, "BOTTOM", 27, 4) PaladinPowerBarFrame:SetFrameStrata("LOW") if C.Blizzard.ColorTextures == true then PaladinPowerBarFrameBG:SetVertexColor(unpack(C.Blizzard.TexturesColor)) end return PaladinPowerBarFrame end end function ns.classModule.PRIEST(self, config, uconfig) if (config.PRIEST.showInsanity) then InsanityBarFrame:SetParent(self) InsanityBarFrame:ClearAllPoints() InsanityBarFrame:SetPoint("BOTTOMRIGHT", self, "TOPLEFT", 52, -50) return InsanityBarFrame end end function ns.classModule.WARLOCK(self, config, uconfig) if (config.WARLOCK.showShards) then WarlockPowerFrame:SetParent(self) WarlockPowerFrame:ClearAllPoints() WarlockPowerFrame:SetPoint("TOP", self, "BOTTOM", 29, -2) if (ns.config.playerStyle == "normal") then WarlockPowerFrame:SetFrameStrata("LOW") end for i = 1, 5 do local shard = _G["WarlockPowerFrameShard"..i] if C.Blizzard.ColorTextures == true then select(5, shard:GetRegions()):SetVertexColor(unpack(C.Blizzard.TexturesColor)) end end return WarlockPowerFrame end end
mit
dr01d3r/darkstar
scripts/zones/Bostaunieux_Oubliette/npcs/Chumia.lua
14
1059
----------------------------------- -- Area: Bostaunieux Oubliette -- NPC: Chumia -- Type: Standard NPC -- @pos 102.420 -25.001 70.457 167 ----------------------------------- package.loaded["scripts/zones/Bostaunieux_Oubliette/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Bostaunieux_Oubliette/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, CHUMIA_DIALOG); 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